termdock 1.4.222 → 1.4.224

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 (324) hide show
  1. package/README.md +30 -0
  2. package/dist/client/assets/App-Cld3O8C2.js +155 -0
  3. package/dist/client/assets/App-Cld3O8C2.js.br +0 -0
  4. package/dist/client/assets/App-Cld3O8C2.js.gz +0 -0
  5. package/dist/client/assets/{ChangeWalkthroughPanel-CuKGb2vm.js → ChangeWalkthroughPanel-C5RRvTfo.js} +2 -2
  6. package/dist/client/assets/ChangeWalkthroughPanel-C5RRvTfo.js.br +0 -0
  7. package/dist/client/assets/ChangeWalkthroughPanel-C5RRvTfo.js.gz +0 -0
  8. package/dist/client/assets/{DagPlayground-PkAiSUqv.js → DagPlayground-Cb99juZB.js} +1 -1
  9. package/dist/client/assets/DagPlayground-Cb99juZB.js.br +0 -0
  10. package/dist/client/assets/DagPlayground-Cb99juZB.js.gz +0 -0
  11. package/dist/client/assets/{DiffLab-rqBUCnUj.js → DiffLab-CLftmGmh.js} +1 -1
  12. package/dist/client/assets/DiffLab-CLftmGmh.js.br +0 -0
  13. package/dist/client/assets/DiffLab-CLftmGmh.js.gz +0 -0
  14. package/dist/client/assets/{DiffReview-uLyEyKGh.js → DiffReview-DQri2Ybs.js} +1 -1
  15. package/dist/client/assets/DiffReview-DQri2Ybs.js.br +0 -0
  16. package/dist/client/assets/DiffReview-DQri2Ybs.js.gz +0 -0
  17. package/dist/client/assets/{DiffReviewLab-M9OnURIF.js → DiffReviewLab-DboW5kVe.js} +1 -1
  18. package/dist/client/assets/DiffReviewLab-DboW5kVe.js.br +0 -0
  19. package/dist/client/assets/DiffReviewLab-DboW5kVe.js.gz +0 -0
  20. package/dist/client/assets/{DiffViewer-CSYkLmfZ.js → DiffViewer-DFCeAPLJ.js} +4 -4
  21. package/dist/client/assets/DiffViewer-DFCeAPLJ.js.br +0 -0
  22. package/dist/client/assets/DiffViewer-DFCeAPLJ.js.gz +0 -0
  23. package/dist/client/assets/{ModelPreview-C2__4PcL.js → ModelPreview-CCG0pfHi.js} +1 -1
  24. package/dist/client/assets/ModelPreview-CCG0pfHi.js.br +0 -0
  25. package/dist/client/assets/ModelPreview-CCG0pfHi.js.gz +0 -0
  26. package/dist/client/assets/{RightSidebar-CxN_uNGK.js → RightSidebar-g_aBUJMG.js} +46 -46
  27. package/dist/client/assets/RightSidebar-g_aBUJMG.js.br +0 -0
  28. package/dist/client/assets/RightSidebar-g_aBUJMG.js.gz +0 -0
  29. package/dist/client/assets/{abnfDiagram-VCTEODGH-DF12U-Dn.js → abnfDiagram-VCTEODGH-BJpFAXlO.js} +1 -1
  30. package/dist/client/assets/abnfDiagram-VCTEODGH-BJpFAXlO.js.br +0 -0
  31. package/dist/client/assets/abnfDiagram-VCTEODGH-BJpFAXlO.js.gz +0 -0
  32. package/dist/client/assets/app-C6b0uY52.js +35 -0
  33. package/dist/client/assets/app-C6b0uY52.js.br +0 -0
  34. package/dist/client/assets/app-C6b0uY52.js.gz +0 -0
  35. package/dist/client/assets/{arc-DB0T9mv4.js → arc-BdJDW1lu.js} +1 -1
  36. package/dist/client/assets/arc-BdJDW1lu.js.br +0 -0
  37. package/dist/client/assets/arc-BdJDW1lu.js.gz +0 -0
  38. package/dist/client/assets/{architectureDiagram-5GKGNRK7-CPAaChHX.js → architectureDiagram-5GKGNRK7-fbj0F3dM.js} +1 -1
  39. package/dist/client/assets/architectureDiagram-5GKGNRK7-fbj0F3dM.js.br +0 -0
  40. package/dist/client/assets/architectureDiagram-5GKGNRK7-fbj0F3dM.js.gz +0 -0
  41. package/dist/client/assets/{blockDiagram-I7D4REHJ-Bch_ccgD.js → blockDiagram-I7D4REHJ-B7pADDyc.js} +1 -1
  42. package/dist/client/assets/blockDiagram-I7D4REHJ-B7pADDyc.js.br +0 -0
  43. package/dist/client/assets/blockDiagram-I7D4REHJ-B7pADDyc.js.gz +0 -0
  44. package/dist/client/assets/{c4Diagram-7LVT6UL2-CHvaTFm7.js → c4Diagram-7LVT6UL2-4QmMGHz9.js} +1 -1
  45. package/dist/client/assets/c4Diagram-7LVT6UL2-4QmMGHz9.js.br +0 -0
  46. package/dist/client/assets/c4Diagram-7LVT6UL2-4QmMGHz9.js.gz +0 -0
  47. package/dist/client/assets/channel-CVdWcjpf.js +1 -0
  48. package/dist/client/assets/{chunk-2Q5K7J3B-DJBrVN2-.js → chunk-2Q5K7J3B-DOOBZfu4.js} +1 -1
  49. package/dist/client/assets/{chunk-5VM5RSS4-DMJ2N_u7.js → chunk-5VM5RSS4-B_3rAi5P.js} +1 -1
  50. package/dist/client/assets/{chunk-F27PBJKO-BhTQR78r.js → chunk-F27PBJKO-YNbIq50s.js} +1 -1
  51. package/dist/client/assets/chunk-F27PBJKO-YNbIq50s.js.br +0 -0
  52. package/dist/client/assets/chunk-F27PBJKO-YNbIq50s.js.gz +0 -0
  53. package/dist/client/assets/{chunk-IMKFNOWR-CITSHCd2.js → chunk-IMKFNOWR-0BVWaDVc.js} +1 -1
  54. package/dist/client/assets/chunk-IMKFNOWR-0BVWaDVc.js.br +0 -0
  55. package/dist/client/assets/chunk-IMKFNOWR-0BVWaDVc.js.gz +0 -0
  56. package/dist/client/assets/{chunk-JWPE2WC7-DmQ_i8W8.js → chunk-JWPE2WC7-eSY9TWMP.js} +1 -1
  57. package/dist/client/assets/{chunk-POPQ4Y6H-Bz8KvQzJ.js → chunk-POPQ4Y6H-D39v1dzx.js} +1 -1
  58. package/dist/client/assets/{chunk-SVP7TREG-QAi_E4VI.js → chunk-SVP7TREG-BXHTF277.js} +1 -1
  59. package/dist/client/assets/chunk-SVP7TREG-BXHTF277.js.br +0 -0
  60. package/dist/client/assets/chunk-SVP7TREG-BXHTF277.js.gz +0 -0
  61. package/dist/client/assets/{chunk-TICWLB2K-DXh1I4n3.js → chunk-TICWLB2K-CYJgRp3n.js} +1 -1
  62. package/dist/client/assets/chunk-TICWLB2K-CYJgRp3n.js.br +0 -0
  63. package/dist/client/assets/chunk-TICWLB2K-CYJgRp3n.js.gz +0 -0
  64. package/dist/client/assets/{chunk-XXDRQBXY-DOIry6Wc.js → chunk-XXDRQBXY-CbzDQZH7.js} +1 -1
  65. package/dist/client/assets/classDiagram-ZZMXUADV-Dw2Jkvjn.js +1 -0
  66. package/dist/client/assets/classDiagram-v2-VYDZK3BY-Dw2Jkvjn.js +1 -0
  67. package/dist/client/assets/{cose-bilkent-JH36ORCC-BKe41TZy.js → cose-bilkent-JH36ORCC-D8dthIbT.js} +1 -1
  68. package/dist/client/assets/cose-bilkent-JH36ORCC-D8dthIbT.js.br +0 -0
  69. package/dist/client/assets/cose-bilkent-JH36ORCC-D8dthIbT.js.gz +0 -0
  70. package/dist/client/assets/{cynefin-OW5HDTMX-BPxcvHsH.js → cynefin-OW5HDTMX-PBaLFt2i.js} +1 -1
  71. package/dist/client/assets/cynefin-OW5HDTMX-PBaLFt2i.js.br +0 -0
  72. package/dist/client/assets/cynefin-OW5HDTMX-PBaLFt2i.js.gz +0 -0
  73. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-D0WT5xpa.js → cynefinDiagram-5FMLGOSQ-4Bv4ySZu.js} +1 -1
  74. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-4Bv4ySZu.js.br +0 -0
  75. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-4Bv4ySZu.js.gz +0 -0
  76. package/dist/client/assets/{dagre-GXQ25YYZ-1aHx1jHJ.js → dagre-GXQ25YYZ-DIojN35W.js} +1 -1
  77. package/dist/client/assets/dagre-GXQ25YYZ-DIojN35W.js.br +0 -0
  78. package/dist/client/assets/dagre-GXQ25YYZ-DIojN35W.js.gz +0 -0
  79. package/dist/client/assets/{diagram-S7CK7UJ4-C3EoNHOa.js → diagram-S7CK7UJ4-DYa3GOaX.js} +1 -1
  80. package/dist/client/assets/diagram-S7CK7UJ4-DYa3GOaX.js.br +0 -0
  81. package/dist/client/assets/diagram-S7CK7UJ4-DYa3GOaX.js.gz +0 -0
  82. package/dist/client/assets/{diagram-UQ7AKVKN-CPFyA7uT.js → diagram-UQ7AKVKN-MZArHUml.js} +1 -1
  83. package/dist/client/assets/diagram-UQ7AKVKN-MZArHUml.js.br +0 -0
  84. package/dist/client/assets/diagram-UQ7AKVKN-MZArHUml.js.gz +0 -0
  85. package/dist/client/assets/{diagram-VSXAHHWV-DUNhd6k2.js → diagram-VSXAHHWV-DOg-qopG.js} +1 -1
  86. package/dist/client/assets/diagram-VSXAHHWV-DOg-qopG.js.br +0 -0
  87. package/dist/client/assets/diagram-VSXAHHWV-DOg-qopG.js.gz +0 -0
  88. package/dist/client/assets/{diagram-VX7I27RA-243N_jy3.js → diagram-VX7I27RA-Cl1hWkHe.js} +1 -1
  89. package/dist/client/assets/diagram-VX7I27RA-Cl1hWkHe.js.br +0 -0
  90. package/dist/client/assets/diagram-VX7I27RA-Cl1hWkHe.js.gz +0 -0
  91. package/dist/client/assets/{diagram-Z3DM3KII-Bi5rovI0.js → diagram-Z3DM3KII-B_DYMsTz.js} +1 -1
  92. package/dist/client/assets/diagram-Z3DM3KII-B_DYMsTz.js.br +0 -0
  93. package/dist/client/assets/diagram-Z3DM3KII-B_DYMsTz.js.gz +0 -0
  94. package/dist/client/assets/{ebnfDiagram-PWID7BFC-DlrVdduC.js → ebnfDiagram-PWID7BFC-DKkQawMy.js} +1 -1
  95. package/dist/client/assets/ebnfDiagram-PWID7BFC-DKkQawMy.js.br +0 -0
  96. package/dist/client/assets/ebnfDiagram-PWID7BFC-DKkQawMy.js.gz +0 -0
  97. package/dist/client/assets/{erDiagram-RLTQ6QDP-DQS5M4b5.js → erDiagram-RLTQ6QDP-Dn9ywQPh.js} +1 -1
  98. package/dist/client/assets/erDiagram-RLTQ6QDP-Dn9ywQPh.js.br +0 -0
  99. package/dist/client/assets/erDiagram-RLTQ6QDP-Dn9ywQPh.js.gz +0 -0
  100. package/dist/client/assets/{flowDiagram-HODETNUW-mLbIp0uj.js → flowDiagram-HODETNUW-fySCe0cE.js} +1 -1
  101. package/dist/client/assets/flowDiagram-HODETNUW-fySCe0cE.js.br +0 -0
  102. package/dist/client/assets/flowDiagram-HODETNUW-fySCe0cE.js.gz +0 -0
  103. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-B2seYQXF.js → ganttDiagram-EL5Y4UJY-C03JLSbZ.js} +1 -1
  104. package/dist/client/assets/ganttDiagram-EL5Y4UJY-C03JLSbZ.js.br +0 -0
  105. package/dist/client/assets/ganttDiagram-EL5Y4UJY-C03JLSbZ.js.gz +0 -0
  106. package/dist/client/assets/{gestureArbiter-BHJqBOYt.js → gestureArbiter-Ca_CSCVo.js} +1 -1
  107. package/dist/client/assets/gestureArbiter-Ca_CSCVo.js.br +0 -0
  108. package/dist/client/assets/gestureArbiter-Ca_CSCVo.js.gz +0 -0
  109. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-B_ShtYt_.js → gitGraphDiagram-WWUBYQGX-BSAe1f_B.js} +1 -1
  110. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BSAe1f_B.js.br +0 -0
  111. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-BSAe1f_B.js.gz +0 -0
  112. package/dist/client/assets/{index-D-2UYHja.css → index-DF6ug-qD.css} +1 -1
  113. package/dist/client/assets/index-DF6ug-qD.css.br +0 -0
  114. package/dist/client/assets/{index-D-2UYHja.css.gz → index-DF6ug-qD.css.gz} +0 -0
  115. package/dist/client/assets/{infoDiagram-27XIBGKW-Cszf7rNB.js → infoDiagram-27XIBGKW-VTsV1pM4.js} +1 -1
  116. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-gcChM9AT.js → ishikawaDiagram-5VMMS53U-C7DJxPEv.js} +1 -1
  117. package/dist/client/assets/ishikawaDiagram-5VMMS53U-C7DJxPEv.js.br +0 -0
  118. package/dist/client/assets/ishikawaDiagram-5VMMS53U-C7DJxPEv.js.gz +0 -0
  119. package/dist/client/assets/{journeyDiagram-3NMN7TZE-De_pY7WJ.js → journeyDiagram-3NMN7TZE-DgRhdTHR.js} +1 -1
  120. package/dist/client/assets/journeyDiagram-3NMN7TZE-DgRhdTHR.js.br +0 -0
  121. package/dist/client/assets/journeyDiagram-3NMN7TZE-DgRhdTHR.js.gz +0 -0
  122. package/dist/client/assets/{kanban-definition-UXKFOSKX-B1JSuNpC.js → kanban-definition-UXKFOSKX-DaWZbETt.js} +1 -1
  123. package/dist/client/assets/kanban-definition-UXKFOSKX-DaWZbETt.js.br +0 -0
  124. package/dist/client/assets/kanban-definition-UXKFOSKX-DaWZbETt.js.gz +0 -0
  125. package/dist/client/assets/{layout-CCzdJbmI.js → layout-DNda62xi.js} +1 -1
  126. package/dist/client/assets/layout-DNda62xi.js.br +0 -0
  127. package/dist/client/assets/layout-DNda62xi.js.gz +0 -0
  128. package/dist/client/assets/{linear-DrfFkTtI.js → linear-CadrI0GP.js} +1 -1
  129. package/dist/client/assets/linear-CadrI0GP.js.br +0 -0
  130. package/dist/client/assets/linear-CadrI0GP.js.gz +0 -0
  131. package/dist/client/assets/{mermaid.core-DEUGaS9p.js → mermaid.core-HFssyUb5.js} +5 -5
  132. package/dist/client/assets/mermaid.core-HFssyUb5.js.br +0 -0
  133. package/dist/client/assets/mermaid.core-HFssyUb5.js.gz +0 -0
  134. package/dist/client/assets/{mindmap-definition-YA3MSWOX-CSudeofQ.js → mindmap-definition-YA3MSWOX-BLX420et.js} +1 -1
  135. package/dist/client/assets/mindmap-definition-YA3MSWOX-BLX420et.js.br +0 -0
  136. package/dist/client/assets/mindmap-definition-YA3MSWOX-BLX420et.js.gz +0 -0
  137. package/dist/client/assets/{passwordBootstrap-CL6A4jgo.js → passwordBootstrap-B4C87XkY.js} +2 -2
  138. package/dist/client/assets/passwordBootstrap-B4C87XkY.js.br +0 -0
  139. package/dist/client/assets/passwordBootstrap-B4C87XkY.js.gz +0 -0
  140. package/dist/client/assets/{pegDiagram-XKGWAZYB-GvJqArvT.js → pegDiagram-XKGWAZYB-DMHN3Uz6.js} +1 -1
  141. package/dist/client/assets/pegDiagram-XKGWAZYB-DMHN3Uz6.js.br +0 -0
  142. package/dist/client/assets/pegDiagram-XKGWAZYB-DMHN3Uz6.js.gz +0 -0
  143. package/dist/client/assets/{pieDiagram-E7YTZNPT-v2I8vefl.js → pieDiagram-E7YTZNPT-u3MQV9-X.js} +1 -1
  144. package/dist/client/assets/pieDiagram-E7YTZNPT-u3MQV9-X.js.br +0 -0
  145. package/dist/client/assets/pieDiagram-E7YTZNPT-u3MQV9-X.js.gz +0 -0
  146. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-Dwl9ynUP.js → quadrantDiagram-AXDQQJYC-B0iS0MxY.js} +1 -1
  147. package/dist/client/assets/quadrantDiagram-AXDQQJYC-B0iS0MxY.js.br +0 -0
  148. package/dist/client/assets/quadrantDiagram-AXDQQJYC-B0iS0MxY.js.gz +0 -0
  149. package/dist/client/assets/{railroadDiagram-O6MQD6OU-C5P0Vrje.js → railroadDiagram-O6MQD6OU-Cny1bhbK.js} +1 -1
  150. package/dist/client/assets/railroadDiagram-O6MQD6OU-Cny1bhbK.js.br +0 -0
  151. package/dist/client/assets/railroadDiagram-O6MQD6OU-Cny1bhbK.js.gz +0 -0
  152. package/dist/client/assets/referenceLongPress-CRjkeJkj.js +1 -0
  153. package/dist/client/assets/referenceLongPress-CRjkeJkj.js.br +0 -0
  154. package/dist/client/assets/referenceLongPress-CRjkeJkj.js.gz +0 -0
  155. package/dist/client/assets/{requirementDiagram-BXWQKSXE-Ch7mWqTe.js → requirementDiagram-BXWQKSXE-gQqK4Hig.js} +1 -1
  156. package/dist/client/assets/{requirementDiagram-BXWQKSXE-Ch7mWqTe.js.br → requirementDiagram-BXWQKSXE-gQqK4Hig.js.br} +0 -0
  157. package/dist/client/assets/requirementDiagram-BXWQKSXE-gQqK4Hig.js.gz +0 -0
  158. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-XNhXUjTd.js → sankeyDiagram-P5KCCOFB-5ZoSBB75.js} +1 -1
  159. package/dist/client/assets/sankeyDiagram-P5KCCOFB-5ZoSBB75.js.br +0 -0
  160. package/dist/client/assets/sankeyDiagram-P5KCCOFB-5ZoSBB75.js.gz +0 -0
  161. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-yW-mK8dy.js → sequenceDiagram-WJ2MYXX4-Cq1VlUlL.js} +1 -1
  162. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-Cq1VlUlL.js.br +0 -0
  163. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-Cq1VlUlL.js.gz +0 -0
  164. package/dist/client/assets/{sizeCapture-INFHLROL-BFl2AgCE.js → sizeCapture-INFHLROL-lLK8eFcJ.js} +1 -1
  165. package/dist/client/assets/sizeCapture-INFHLROL-lLK8eFcJ.js.br +0 -0
  166. package/dist/client/assets/sizeCapture-INFHLROL-lLK8eFcJ.js.gz +0 -0
  167. package/dist/client/assets/{sparkles-DqJudZhx.js → sparkles-BNQv3v-n.js} +1 -1
  168. package/dist/client/assets/{stateDiagram-D77RDMKH-B7o3ltV5.js → stateDiagram-D77RDMKH-Xtxea1-c.js} +1 -1
  169. package/dist/client/assets/stateDiagram-D77RDMKH-Xtxea1-c.js.br +0 -0
  170. package/dist/client/assets/stateDiagram-D77RDMKH-Xtxea1-c.js.gz +0 -0
  171. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-1BGERJKu.js +1 -0
  172. package/dist/client/assets/{swimlanes-42K2YHIH-ChCdr5XE.js → swimlanes-42K2YHIH-CpVFOhSV.js} +1 -1
  173. package/dist/client/assets/swimlanes-42K2YHIH-CpVFOhSV.js.br +0 -0
  174. package/dist/client/assets/swimlanes-42K2YHIH-CpVFOhSV.js.gz +0 -0
  175. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-C1U7ALsL.js +8 -0
  176. package/dist/client/assets/{timeline-definition-24CTP7MA-DoJRJjZJ.js → timeline-definition-24CTP7MA-BGM7_COx.js} +1 -1
  177. package/dist/client/assets/timeline-definition-24CTP7MA-BGM7_COx.js.br +0 -0
  178. package/dist/client/assets/timeline-definition-24CTP7MA-BGM7_COx.js.gz +0 -0
  179. package/dist/client/assets/{triangle-alert-CxA0lQgO.js → triangle-alert-t6xUbEkq.js} +1 -1
  180. package/dist/client/assets/{vennDiagram-4TSXK5OY-zKAx920b.js → vennDiagram-4TSXK5OY-DxxWi2bH.js} +1 -1
  181. package/dist/client/assets/{vennDiagram-4TSXK5OY-zKAx920b.js.br → vennDiagram-4TSXK5OY-DxxWi2bH.js.br} +0 -0
  182. package/dist/client/assets/vennDiagram-4TSXK5OY-DxxWi2bH.js.gz +0 -0
  183. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-DywJyU0p.js → wardleyDiagram-VM6X3IG4-BIBrAH7x.js} +1 -1
  184. package/dist/client/assets/wardleyDiagram-VM6X3IG4-BIBrAH7x.js.br +0 -0
  185. package/dist/client/assets/wardleyDiagram-VM6X3IG4-BIBrAH7x.js.gz +0 -0
  186. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-CZGjZLhe.js → xychartDiagram-S5SC5T6Z-KxQx_cvI.js} +1 -1
  187. package/dist/client/assets/xychartDiagram-S5SC5T6Z-KxQx_cvI.js.br +0 -0
  188. package/dist/client/assets/xychartDiagram-S5SC5T6Z-KxQx_cvI.js.gz +0 -0
  189. package/dist/client/index.html +2 -2
  190. package/dist/client/index.html.br +0 -0
  191. package/dist/client/index.html.gz +0 -0
  192. package/dist/client/sw.js +1 -1
  193. package/dist/client/sw.js.br +0 -0
  194. package/dist/client/sw.js.gz +0 -0
  195. package/dist/server/agent/notifyCli.js +65 -0
  196. package/dist/server/cli.js +47 -0
  197. package/dist/server/notifications/progressRoutes.js +26 -0
  198. package/dist/server/routes/filesystem.js +3 -19
  199. package/dist/server/routes/terminal.js +28 -1
  200. package/dist/server/utils/recentCommitHistory.js +45 -0
  201. package/dist/server/utils/settings.js +16 -0
  202. package/package.json +1 -1
  203. package/runtime-manifest.json +3 -3
  204. package/dist/client/assets/App-DyJ9kO7R.js +0 -156
  205. package/dist/client/assets/App-DyJ9kO7R.js.br +0 -0
  206. package/dist/client/assets/App-DyJ9kO7R.js.gz +0 -0
  207. package/dist/client/assets/ChangeWalkthroughPanel-CuKGb2vm.js.br +0 -0
  208. package/dist/client/assets/ChangeWalkthroughPanel-CuKGb2vm.js.gz +0 -0
  209. package/dist/client/assets/DagPlayground-PkAiSUqv.js.br +0 -0
  210. package/dist/client/assets/DagPlayground-PkAiSUqv.js.gz +0 -0
  211. package/dist/client/assets/DiffLab-rqBUCnUj.js.br +0 -0
  212. package/dist/client/assets/DiffLab-rqBUCnUj.js.gz +0 -0
  213. package/dist/client/assets/DiffReview-uLyEyKGh.js.br +0 -0
  214. package/dist/client/assets/DiffReview-uLyEyKGh.js.gz +0 -0
  215. package/dist/client/assets/DiffReviewLab-M9OnURIF.js.br +0 -0
  216. package/dist/client/assets/DiffReviewLab-M9OnURIF.js.gz +0 -0
  217. package/dist/client/assets/DiffViewer-CSYkLmfZ.js.br +0 -0
  218. package/dist/client/assets/DiffViewer-CSYkLmfZ.js.gz +0 -0
  219. package/dist/client/assets/ModelPreview-C2__4PcL.js.br +0 -0
  220. package/dist/client/assets/ModelPreview-C2__4PcL.js.gz +0 -0
  221. package/dist/client/assets/RightSidebar-CxN_uNGK.js.br +0 -0
  222. package/dist/client/assets/RightSidebar-CxN_uNGK.js.gz +0 -0
  223. package/dist/client/assets/abnfDiagram-VCTEODGH-DF12U-Dn.js.br +0 -0
  224. package/dist/client/assets/abnfDiagram-VCTEODGH-DF12U-Dn.js.gz +0 -0
  225. package/dist/client/assets/app-C5_tJqmt.js +0 -34
  226. package/dist/client/assets/app-C5_tJqmt.js.br +0 -0
  227. package/dist/client/assets/app-C5_tJqmt.js.gz +0 -0
  228. package/dist/client/assets/arc-DB0T9mv4.js.br +0 -0
  229. package/dist/client/assets/arc-DB0T9mv4.js.gz +0 -0
  230. package/dist/client/assets/architectureDiagram-5GKGNRK7-CPAaChHX.js.br +0 -0
  231. package/dist/client/assets/architectureDiagram-5GKGNRK7-CPAaChHX.js.gz +0 -0
  232. package/dist/client/assets/blockDiagram-I7D4REHJ-Bch_ccgD.js.br +0 -0
  233. package/dist/client/assets/blockDiagram-I7D4REHJ-Bch_ccgD.js.gz +0 -0
  234. package/dist/client/assets/c4Diagram-7LVT6UL2-CHvaTFm7.js.br +0 -0
  235. package/dist/client/assets/c4Diagram-7LVT6UL2-CHvaTFm7.js.gz +0 -0
  236. package/dist/client/assets/channel-CEI-kuiJ.js +0 -1
  237. package/dist/client/assets/chunk-F27PBJKO-BhTQR78r.js.br +0 -0
  238. package/dist/client/assets/chunk-F27PBJKO-BhTQR78r.js.gz +0 -0
  239. package/dist/client/assets/chunk-IMKFNOWR-CITSHCd2.js.br +0 -0
  240. package/dist/client/assets/chunk-IMKFNOWR-CITSHCd2.js.gz +0 -0
  241. package/dist/client/assets/chunk-SVP7TREG-QAi_E4VI.js.br +0 -0
  242. package/dist/client/assets/chunk-SVP7TREG-QAi_E4VI.js.gz +0 -0
  243. package/dist/client/assets/chunk-TICWLB2K-DXh1I4n3.js.br +0 -0
  244. package/dist/client/assets/chunk-TICWLB2K-DXh1I4n3.js.gz +0 -0
  245. package/dist/client/assets/classDiagram-ZZMXUADV-BzKuQFWs.js +0 -1
  246. package/dist/client/assets/classDiagram-v2-VYDZK3BY-BzKuQFWs.js +0 -1
  247. package/dist/client/assets/cose-bilkent-JH36ORCC-BKe41TZy.js.br +0 -0
  248. package/dist/client/assets/cose-bilkent-JH36ORCC-BKe41TZy.js.gz +0 -0
  249. package/dist/client/assets/cynefin-OW5HDTMX-BPxcvHsH.js.br +0 -0
  250. package/dist/client/assets/cynefin-OW5HDTMX-BPxcvHsH.js.gz +0 -0
  251. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-D0WT5xpa.js.br +0 -0
  252. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-D0WT5xpa.js.gz +0 -0
  253. package/dist/client/assets/dagre-GXQ25YYZ-1aHx1jHJ.js.br +0 -0
  254. package/dist/client/assets/dagre-GXQ25YYZ-1aHx1jHJ.js.gz +0 -0
  255. package/dist/client/assets/diagram-S7CK7UJ4-C3EoNHOa.js.br +0 -0
  256. package/dist/client/assets/diagram-S7CK7UJ4-C3EoNHOa.js.gz +0 -0
  257. package/dist/client/assets/diagram-UQ7AKVKN-CPFyA7uT.js.br +0 -0
  258. package/dist/client/assets/diagram-UQ7AKVKN-CPFyA7uT.js.gz +0 -0
  259. package/dist/client/assets/diagram-VSXAHHWV-DUNhd6k2.js.br +0 -0
  260. package/dist/client/assets/diagram-VSXAHHWV-DUNhd6k2.js.gz +0 -0
  261. package/dist/client/assets/diagram-VX7I27RA-243N_jy3.js.br +0 -0
  262. package/dist/client/assets/diagram-VX7I27RA-243N_jy3.js.gz +0 -0
  263. package/dist/client/assets/diagram-Z3DM3KII-Bi5rovI0.js.br +0 -0
  264. package/dist/client/assets/diagram-Z3DM3KII-Bi5rovI0.js.gz +0 -0
  265. package/dist/client/assets/ebnfDiagram-PWID7BFC-DlrVdduC.js.br +0 -0
  266. package/dist/client/assets/ebnfDiagram-PWID7BFC-DlrVdduC.js.gz +0 -0
  267. package/dist/client/assets/erDiagram-RLTQ6QDP-DQS5M4b5.js.br +0 -0
  268. package/dist/client/assets/erDiagram-RLTQ6QDP-DQS5M4b5.js.gz +0 -0
  269. package/dist/client/assets/flowDiagram-HODETNUW-mLbIp0uj.js.br +0 -0
  270. package/dist/client/assets/flowDiagram-HODETNUW-mLbIp0uj.js.gz +0 -0
  271. package/dist/client/assets/ganttDiagram-EL5Y4UJY-B2seYQXF.js.br +0 -0
  272. package/dist/client/assets/ganttDiagram-EL5Y4UJY-B2seYQXF.js.gz +0 -0
  273. package/dist/client/assets/gestureArbiter-BHJqBOYt.js.br +0 -0
  274. package/dist/client/assets/gestureArbiter-BHJqBOYt.js.gz +0 -0
  275. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-B_ShtYt_.js.br +0 -0
  276. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-B_ShtYt_.js.gz +0 -0
  277. package/dist/client/assets/index-D-2UYHja.css.br +0 -0
  278. package/dist/client/assets/ishikawaDiagram-5VMMS53U-gcChM9AT.js.br +0 -0
  279. package/dist/client/assets/ishikawaDiagram-5VMMS53U-gcChM9AT.js.gz +0 -0
  280. package/dist/client/assets/journeyDiagram-3NMN7TZE-De_pY7WJ.js.br +0 -0
  281. package/dist/client/assets/journeyDiagram-3NMN7TZE-De_pY7WJ.js.gz +0 -0
  282. package/dist/client/assets/kanban-definition-UXKFOSKX-B1JSuNpC.js.br +0 -0
  283. package/dist/client/assets/kanban-definition-UXKFOSKX-B1JSuNpC.js.gz +0 -0
  284. package/dist/client/assets/layout-CCzdJbmI.js.br +0 -0
  285. package/dist/client/assets/layout-CCzdJbmI.js.gz +0 -0
  286. package/dist/client/assets/linear-DrfFkTtI.js.br +0 -0
  287. package/dist/client/assets/linear-DrfFkTtI.js.gz +0 -0
  288. package/dist/client/assets/mermaid.core-DEUGaS9p.js.br +0 -0
  289. package/dist/client/assets/mermaid.core-DEUGaS9p.js.gz +0 -0
  290. package/dist/client/assets/mindmap-definition-YA3MSWOX-CSudeofQ.js.br +0 -0
  291. package/dist/client/assets/mindmap-definition-YA3MSWOX-CSudeofQ.js.gz +0 -0
  292. package/dist/client/assets/passwordBootstrap-CL6A4jgo.js.br +0 -0
  293. package/dist/client/assets/passwordBootstrap-CL6A4jgo.js.gz +0 -0
  294. package/dist/client/assets/pegDiagram-XKGWAZYB-GvJqArvT.js.br +0 -0
  295. package/dist/client/assets/pegDiagram-XKGWAZYB-GvJqArvT.js.gz +0 -0
  296. package/dist/client/assets/pieDiagram-E7YTZNPT-v2I8vefl.js.br +0 -0
  297. package/dist/client/assets/pieDiagram-E7YTZNPT-v2I8vefl.js.gz +0 -0
  298. package/dist/client/assets/quadrantDiagram-AXDQQJYC-Dwl9ynUP.js.br +0 -0
  299. package/dist/client/assets/quadrantDiagram-AXDQQJYC-Dwl9ynUP.js.gz +0 -0
  300. package/dist/client/assets/railroadDiagram-O6MQD6OU-C5P0Vrje.js.br +0 -0
  301. package/dist/client/assets/railroadDiagram-O6MQD6OU-C5P0Vrje.js.gz +0 -0
  302. package/dist/client/assets/referenceLongPress-BPZ3zpO3.js +0 -1
  303. package/dist/client/assets/referenceLongPress-BPZ3zpO3.js.br +0 -0
  304. package/dist/client/assets/referenceLongPress-BPZ3zpO3.js.gz +0 -0
  305. package/dist/client/assets/requirementDiagram-BXWQKSXE-Ch7mWqTe.js.gz +0 -0
  306. package/dist/client/assets/sankeyDiagram-P5KCCOFB-XNhXUjTd.js.br +0 -0
  307. package/dist/client/assets/sankeyDiagram-P5KCCOFB-XNhXUjTd.js.gz +0 -0
  308. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-yW-mK8dy.js.br +0 -0
  309. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-yW-mK8dy.js.gz +0 -0
  310. package/dist/client/assets/sizeCapture-INFHLROL-BFl2AgCE.js.br +0 -0
  311. package/dist/client/assets/sizeCapture-INFHLROL-BFl2AgCE.js.gz +0 -0
  312. package/dist/client/assets/stateDiagram-D77RDMKH-B7o3ltV5.js.br +0 -0
  313. package/dist/client/assets/stateDiagram-D77RDMKH-B7o3ltV5.js.gz +0 -0
  314. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-0TFe3GLN.js +0 -1
  315. package/dist/client/assets/swimlanes-42K2YHIH-ChCdr5XE.js.br +0 -0
  316. package/dist/client/assets/swimlanes-42K2YHIH-ChCdr5XE.js.gz +0 -0
  317. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-bs9RM1xq.js +0 -8
  318. package/dist/client/assets/timeline-definition-24CTP7MA-DoJRJjZJ.js.br +0 -0
  319. package/dist/client/assets/timeline-definition-24CTP7MA-DoJRJjZJ.js.gz +0 -0
  320. package/dist/client/assets/vennDiagram-4TSXK5OY-zKAx920b.js.gz +0 -0
  321. package/dist/client/assets/wardleyDiagram-VM6X3IG4-DywJyU0p.js.br +0 -0
  322. package/dist/client/assets/wardleyDiagram-VM6X3IG4-DywJyU0p.js.gz +0 -0
  323. package/dist/client/assets/xychartDiagram-S5SC5T6Z-CZGjZLhe.js.br +0 -0
  324. package/dist/client/assets/xychartDiagram-S5SC5T6Z-CZGjZLhe.js.gz +0 -0
@@ -0,0 +1,155 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RightSidebar-g_aBUJMG.js","assets/app-C6b0uY52.js","assets/react-XDCjal2T.js","assets/dnd-BCFAPC0L.js","assets/terminal-C7X98Amf.js","assets/index-DF6ug-qD.css","assets/gestureArbiter-Ca_CSCVo.js","assets/gestureArbiter-C2J0D0kV.css","assets/DiffReview-DQri2Ybs.js","assets/sparkles-BNQv3v-n.js","assets/DiffViewer-DFCeAPLJ.js","assets/referenceLongPress-CRjkeJkj.js","assets/DiffViewer-T3uj2-aP.css","assets/triangle-alert-t6xUbEkq.js","assets/ChangeWalkthroughPanel-C5RRvTfo.js","assets/RightSidebar-DW-JEgm2.css"])))=>i.map(i=>d[i]);
2
+ import{a1 as rr,Z as fy,b8 as a,cG as Ca,cd as py,cy as Rd,aM as ea,cz as qr,a0 as M0,bV as ph,cl as my,ab as kc,b7 as Ec,f as gy,H as xy,aQ as Af,bg as Tf,c6 as by,ag as yy,bQ as vy,Q as n5,bO as wy,c4 as s5,U as Ay,a2 as Ty,L as mn,C as na,X as ys,e as Cy,c as bl,aV as _y,cE as Ur,bf as lp,cD as Ft,al as Sy,cL as Ly,o as Iy,bm as ky,bz as Ey,bp as My,c2 as _1,c3 as S1,c5 as L1,W as I1,by as Ry,ce as Ny,m as k1,cw as Dy,aO as Qy,h as By,aF as _a,T as Po,cC as jy,bR as Py,a8 as Oy,a6 as ad,aE as Fy,bw as Uy,bx as $y,P as i5,V as E1,bn as zy,ba as o5,k as zi,at as Pc,I as Yu,cm as mh,cB as Hy,aU as Ia,cI as Gy,B as Vl,d as eu,n as Wy,a5 as Vy,x as Cf,b$ as qy,g as R0,b3 as Zy,b4 as Yy,aa as a5,aH as Nd,aj as l5,cx as Do,ck as c5,bb as Ky,bd as u5,bT as Xy,j as d5,bD as Jy,c7 as e7,bW as t7,bB as r7,c0 as n7,bC as h5,be as M1,bZ as Qc,bF as f5,c8 as s7,ci as i7,c1 as o7,bo as p5,bY as a7,af as l7,bc as R1,ap as c7,aG as u7,D as d7,ao as N1,bi as h7,bG as m5,S as f7,bl as p7,l as m7,bj as g7,bE as x7,_ as b7,bA as y7,ad as v7,ai as w7,ak as A7,aP as J0,aZ as T7,cs as C7,a_ as _7,a9 as S7,cu as L7,z as I7,a4 as k7,$ as E7,A as M7,M as R7,cF as N7,bq as c0,aL as D7,aI as Q7,aJ as B7,aK as j7,aC as gh,br as P7,bK as O7,bS as F7,aN as U7,cj as D1,R as $7,G as z7,cq as H7,cJ as Jn,cg as G7,aB as W7,aR as Q1,bJ as V7,cc as wu,cp as ec,ct as q7,bL as Z7,ch as Y7,c9 as K7,co as xh,ca as X7,cb as J7,cA as ev,a7 as tv,b_ as tc,t as rv,bh as nv,b6 as Au,b5 as sv,bH as B1,bM as iv,bI as u0,bN as ov,O as av,Y as lv}from"./app-C6b0uY52.js";import{R as S,b as T,r as qa,a as cv}from"./dnd-BCFAPC0L.js";import{b as uv,c as dv,F as ql,S as hv,e as fv,h as pv,r as mv,y as gv,d as xv,u as bv}from"./gestureArbiter-Ca_CSCVo.js";import{L as yv,l as vv}from"./terminal-C7X98Amf.js";import{T as g5,L as N0,G as wv,C as j1}from"./triangle-alert-t6xUbEkq.js";import{r as Av}from"./react-XDCjal2T.js";import{u as cp,G as Tv}from"./referenceLongPress-CRjkeJkj.js";const Cv=[["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"}]],_v=rr("app-window",Cv);const Sv=[["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"}]],Lv=rr("arrow-down-a-z",Sv);const Iv=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],kv=rr("arrow-down",Iv);const Ev=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],x5=rr("arrow-up",Ev);const Mv=[["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"}]],Rv=rr("bell",Mv);const Nv=[["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"}]],Dd=rr("bot",Nv);const Dv=[["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"}]],Qv=rr("box",Dv);const Bv=[["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"}]],jv=rr("cable",Bv);const Pv=[["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"}]],Ov=rr("calendar-clock",Pv);const Fv=[["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"}]],Uv=rr("chart-bar",Fv);const $v=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],zv=rr("circle-dot",$v);const Hv=[["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"}]],ld=rr("circle-question-mark",Hv);const Gv=[["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"}]],Wv=rr("clipboard-paste",Gv);const Vv=[["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"}]],b5=rr("clipboard",Vv);const qv=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],Oc=rr("clock-3",qv);const Zv=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],Yv=rr("clock",Zv);const Kv=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Xv=rr("code",Kv);const Jv=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Fl=rr("columns-2",Jv);const e8=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],t8=rr("corner-down-left",e8);const r8=[["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"}]],Fc=rr("download",r8);const n8=[["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"}]],y5=rr("external-link",n8);const s8=[["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"}]],i8=rr("file-code",s8);const o8=[["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"}]],a8=rr("file-up",o8);const l8=[["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"}]],v5=rr("file",l8);const c8=[["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"}]],k0=rr("folder-open",c8);const u8=[["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"}]],up=rr("folder-search",u8);const d8=[["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"}]],h8=rr("folder-tree",d8);const f8=[["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"}]],P1=rr("grid-2x2",f8);const p8=[["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"}]],m8=rr("grip-vertical",p8);const g8=[["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"}]],x8=rr("hash",g8);const b8=[["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"}]],C0=rr("history",b8);const y8=[["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"}]],v8=rr("keyboard",y8);const w8=[["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"}]],A8=rr("layers",w8);const T8=[["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"}]],D0=rr("layout-grid",T8);const C8=[["path",{d:"M5 12h14",key:"1ays0h"}]],_8=rr("minus",C8);const S8=[["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"}]],L8=rr("moon",S8);const I8=[["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"}]],k8=rr("move",I8);const E8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],M8=rr("panel-left",E8);const R8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],w5=rr("panel-right",R8);const N8=[["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"}]],D8=rr("pause",N8);const Q8=[["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"}]],B8=rr("pen-line",Q8);const j8=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],P8=rr("pencil-line",j8);const O8=[["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"}]],Uc=rr("pin",O8);const F8=[["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"}]],$c=rr("pin-off",F8);const U8=[["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"}]],O1=rr("play",U8);const $8=[["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"}]],vs=rr("refresh-cw",$8);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"}]],A5=rr("rotate-ccw",z8);const H8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],F1=rr("rows-2",H8);const G8=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],zc=rr("search",G8);const W8=[["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"}]],V8=rr("settings",W8);const q8=[["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"}]],Z8=rr("sliders-horizontal",q8);const Y8=[["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"}]],K8=rr("stethoscope",Y8);const X8=[["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"}]],J8=rr("sun",X8);const e9=[["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"}]],Hi=rr("trash-2",e9);const t9=[["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"}]],r9=rr("unlink",t9);const n9=[["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"}]],s9=rr("unplug",n9);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"}]],o9=rr("video",i9);const a9=[["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"}]],l9=rr("wand-sparkles",a9);const c9=[["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"}]],U1=rr("workflow",c9);function u9(e,t){return e==="webgl"&&t}function d9(e){return e.isActive&&e.viewportFocused&&e.documentVisible&&e.windowFocused&&e.streamReady}function h9(e){return e.isActive&&e.documentVisible&&e.streamReady&&(!e.isDesktop||e.windowFocused)}function f9(e){return e.isActive&&!e.isMobile&&e.documentVisible&&!e.activeElementIsEditable}function p9(e,t){return!e&&t}const cd=fy(e=>({collaborationGroups:[],setCollaborationGroups:t=>e(r=>({collaborationGroups:typeof t=="function"?t(r.collaborationGroups):t}))}));function $1(){const e=Ca(),t=e.visualViewport,r=document.documentElement.style,s=g=>g===void 0?"?":Math.round(g),o=g=>r.getPropertyValue(g)||"?";let c=document.activeElement?.parentElement,u=null;for(;c&&!u;)u=c.querySelector('[data-mobile-keyboard="true"]'),c=c.parentElement;const f=u?.getBoundingClientRect(),m=document.getElementById("root")?.getBoundingClientRect();return[`VVP ${s(t?.height)} off ${s(t?.offsetTop)} win ${e.innerHeight}`,`base ${o("--app-base-vh")} kb ${o("--kb-height")} move ${o("--kb-translate-y")}`,`bar ${s(f?.top)}…${s(f?.bottom)} h ${s(f?.height)} root ${s(m?.bottom)}`,`safe ${o("--safe-top-inset")}/${o("--safe-bottom-inset")} frame ${e!==window?"child":"root"} focus ${document.activeElement?.tagName??"?"}`].join(`
3
+ `)}function m9({onClose:e}){const[t,r]=S.useState($1);return S.useEffect(()=>{const s=window.setInterval(()=>r($1()),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 _f=0,z1=!1,_0=0;function g9(){if(z1||typeof window>"u")return;z1=!0;const e=()=>{_f=performance.now()};window.addEventListener("pointerdown",()=>{_0+=1,e()},{passive:!0,capture:!0});for(const t of["pointerup","pointercancel"])window.addEventListener(t,()=>{_0=Math.max(0,_0-1),e()},{passive:!0,capture:!0});for(const t of["pointermove","wheel","keydown"])window.addEventListener(t,e,{passive:!0,capture:!0});window.addEventListener("blur",()=>{_0=0,e()})}function dp(e,t=500){g9();let r=!1,s,o;const c=()=>{if(r)return;if(_0>0||performance.now()-_f<400){o=setTimeout(c,100);return}const u=()=>{if(!r){if(_0>0||performance.now()-_f<400){o=setTimeout(c,100);return}e()}};"requestIdleCallback"in window?s=window.requestIdleCallback(u):o=setTimeout(u,16)};return o=setTimeout(c,t),()=>{r=!0,clearTimeout(o),s!==void 0&&window.cancelIdleCallback(s)}}function x9(e){const[t,r]=T.useState(e);return T.useEffect(()=>dp(()=>r(e),0),[e]),t}function b9(e,t,r){T.useEffect(()=>{e&&py(e,!0)},[e,r])}const mi=[];for(let e=0;e<256;++e)mi.push((e+256).toString(16).slice(1));function y9(e,t=0){return(mi[e[t+0]]+mi[e[t+1]]+mi[e[t+2]]+mi[e[t+3]]+"-"+mi[e[t+4]]+mi[e[t+5]]+"-"+mi[e[t+6]]+mi[e[t+7]]+"-"+mi[e[t+8]]+mi[e[t+9]]+"-"+mi[e[t+10]]+mi[e[t+11]]+mi[e[t+12]]+mi[e[t+13]]+mi[e[t+14]]+mi[e[t+15]]).toLowerCase()}let bh;const v9=new Uint8Array(16);function w9(){if(!bh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");bh=crypto.getRandomValues.bind(crypto)}return bh(v9)}const A9=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),H1={randomUUID:A9};function T9(e,t,r){e=e||{};const s=e.random??e.rng?.()??w9();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,y9(s)}function C9(e,t,r){return H1.randomUUID&&!e?H1.randomUUID():T9(e)}const T5="\x1B[?2026h",_9="\x1B[?2026l",C5="\x1Bc";function S9(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===C5||t.endsWith("!p"))return t+T5;if(r===void 0)return t;const o=r.split(";").filter(c=>Number(c)!==2026);return o.length?`\x1B[?${o.join(";")}${s}`:""})}function L9(e){const t=e.filter(s=>s.length>0).join("");if(!t)return[];const r=S9(t.replace(/^(?:\x1bc)+/,""));return[`${C5}${T5}${r}${_9}`]}function I9(e){return[`\x1B[!p\x1B[?2026h\x1B[H\x1B[2J\x1B[3J${e.join("")}\x1B[?2026l`]}const k9={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},E9={F1:"P",F2:"Q",F3:"R",F4:"S"},M9={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 R9(e,t=!1){if(e.metaKey||e.isComposing||e.keyCode===229||e.getModifierState?.("AltGraph"))return null;const{key:r,shiftKey:s,altKey:o,ctrlKey:c}=e,u=1+Number(s)+2*Number(o)+4*Number(c),f=u===1?"":`;${u}`,m=k9[r];if(m)return u!==1?`\x1B[1${f}${m}`:`\x1B${t?"O":"["}${m}`;const g=E9[r];if(g)return u!==1?`\x1B[1${f}${g}`:`\x1BO${g}`;if(r==="Insert"&&!o&&(s||c))return null;const b=M9[r];if(b)return`\x1B[${b}${f}~`;if(r==="Tab")return o?`\x1B${s?"\x1B[Z":" "}`:s?"\x1B[Z":" ";if(r==="Escape")return o?"\x1B\x1B":"\x1B";if(r==="Enter")return o?"\x1B\r":null;if(r==="Backspace")return c||o?`${o?"\x1B":""}${c?"\b":""}`:null;if(r.length!==1)return null;if(c){const x=r.toUpperCase();let v;return/^[A-Z]$/.test(x)?v=x.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:`${o?"\x1B":""}${String.fromCharCode(v)}`}return o?`\x1B${r}`:null}async function N9(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 Rd("/tmp",[r]);if(!s[0]?.path)throw new Error("Upload did not return an image path");return s[0].path}async function G1(e){const t=ea();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(u=>u.startsWith("image/"));if(!s)continue;const o=await r.getType(s),c=s==="image/jpeg"?"jpg":s.split("/")[1].replace(/[^a-z0-9]/gi,"")||"png";return new File([o],`termdock-clipboard-${Date.now()}.${c}`,{type:s})}return null}async function D9(){return(await ea()?.readClipboardFiles?.()??[]).map(t=>new File([t.bytes],t.name,{type:"application/octet-stream"}))}async function Q9(e){if(!e.length)return[];const{files:t}=await Rd("/tmp",e);if(t.length!==e.length||t.some(r=>!r.path))throw new Error("Upload did not return every file path");return t.map(r=>r.path)}function Vs(e){return{dispose:e}}function B9(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function j9(...e){return Vs(()=>B9(e))}var _5=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()}},Kl=class{constructor(){this._store=new _5}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};Kl.None=Object.freeze({dispose(){}});var rc=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}},S5=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),tu=S5?"node":navigator.userAgent,P9=S5?"node":navigator.platform,O9=tu.includes("Firefox");tu.includes("Chrome");var F9=tu.includes("Edge"),L5=/^((?!chrome|android).)*safari/i.test(tu);function U9(){if(!L5)return 0;let e=tu.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1],10)}P9.indexOf("Linux")>=0;var ei=0,ti=0,ri=0,xs=0,No={css:"#00000000",rgba:0},$i;(e=>{function t(o,c,u,f){return f!==void 0?`#${Ml(o)}${Ml(c)}${Ml(u)}${Ml(f)}`:`#${Ml(o)}${Ml(c)}${Ml(u)}`}e.toCss=t;function r(o,c,u,f=255){return(o<<24|c<<16|u<<8|f)>>>0}e.toRgba=r;function s(o,c,u,f){return{css:e.toCss(o,c,u,f),rgba:e.toRgba(o,c,u,f)}}e.toColor=s})($i||={});var Mc;(e=>{function t(m,g){if(xs=(g.rgba&255)/255,xs===1)return{css:g.css,rgba:g.rgba};let b=g.rgba>>24&255,x=g.rgba>>16&255,v=g.rgba>>8&255,w=m.rgba>>24&255,I=m.rgba>>16&255,k=m.rgba>>8&255;ei=w+Math.round((b-w)*xs),ti=I+Math.round((x-I)*xs),ri=k+Math.round((v-k)*xs);let N=$i.toCss(ei,ti,ri),R=$i.toRgba(ei,ti,ri);return{css:N,rgba:R}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function s(m,g,b){let x=$l.ensureContrastRatio(m.rgba,g.rgba,b);if(x)return $i.toColor(x>>24&255,x>>16&255,x>>8&255)}e.ensureContrastRatio=s;function o(m){let g=(m.rgba|255)>>>0;return[ei,ti,ri]=$l.toChannels(g),{css:$i.toCss(ei,ti,ri),rgba:g}}e.opaque=o;function c(m,g){return xs=Math.round(g*255),[ei,ti,ri]=$l.toChannels(m.rgba),{css:$i.toCss(ei,ti,ri,xs),rgba:$i.toRgba(ei,ti,ri,xs)}}e.opacity=c;function u(m,g){return xs=m.rgba&255,c(m,xs*g/255)}e.multiplyOpacity=u;function f(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=f})(Mc||={});var $9;(e=>{let t,r;try{let o=document.createElement("canvas");o.width=1,o.height=1;let c=o.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function s(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return ei=parseInt(o.slice(1,2).repeat(2),16),ti=parseInt(o.slice(2,3).repeat(2),16),ri=parseInt(o.slice(3,4).repeat(2),16),$i.toColor(ei,ti,ri);case 5:return ei=parseInt(o.slice(1,2).repeat(2),16),ti=parseInt(o.slice(2,3).repeat(2),16),ri=parseInt(o.slice(3,4).repeat(2),16),xs=parseInt(o.slice(4,5).repeat(2),16),$i.toColor(ei,ti,ri,xs);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let c=o.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return ei=parseInt(c[1],10),ti=parseInt(c[2],10),ri=parseInt(c[3],10),xs=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),$i.toColor(ei,ti,ri,xs);if(o==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ei,ti,ri,xs]=t.getImageData(0,0,1,1).data,xs!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:$i.toRgba(ei,ti,ri,xs),css:o}}e.toColor=s})($9||={});var Oi;(e=>{function t(s){return r(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function r(s,o,c){let u=s/255,f=o/255,m=c/255,g=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),b=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),x=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return g*.2126+b*.7152+x*.0722}e.relativeLuminance2=r})(Oi||={});var $l;(e=>{function t(u,f){if(xs=(f&255)/255,xs===1)return f;let m=f>>24&255,g=f>>16&255,b=f>>8&255,x=u>>24&255,v=u>>16&255,w=u>>8&255;return ei=x+Math.round((m-x)*xs),ti=v+Math.round((g-v)*xs),ri=w+Math.round((b-w)*xs),$i.toRgba(ei,ti,ri)}e.blend=t;function r(u,f,m){let g=Oi.relativeLuminance(u>>8),b=Oi.relativeLuminance(f>>8);if(Pa(g,b)<m){if(b<g){let w=s(u,f,m),I=Pa(g,Oi.relativeLuminance(w>>8));if(I<m){let k=o(u,f,m),N=Pa(g,Oi.relativeLuminance(k>>8));return I>N?w:k}return w}let x=o(u,f,m),v=Pa(g,Oi.relativeLuminance(x>>8));if(v<m){let w=s(u,f,m),I=Pa(g,Oi.relativeLuminance(w>>8));return v>I?x:w}return x}}e.ensureContrastRatio=r;function s(u,f,m){let g=u>>24&255,b=u>>16&255,x=u>>8&255,v=f>>24&255,w=f>>16&255,I=f>>8&255,k=Pa(Oi.relativeLuminance2(v,w,I),Oi.relativeLuminance2(g,b,x));for(;k<m&&(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=Pa(Oi.relativeLuminance2(v,w,I),Oi.relativeLuminance2(g,b,x));return(v<<24|w<<16|I<<8|255)>>>0}e.reduceLuminance=s;function o(u,f,m){let g=u>>24&255,b=u>>16&255,x=u>>8&255,v=f>>24&255,w=f>>16&255,I=f>>8&255,k=Pa(Oi.relativeLuminance2(v,w,I),Oi.relativeLuminance2(g,b,x));for(;k<m&&(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=Pa(Oi.relativeLuminance2(v,w,I),Oi.relativeLuminance2(g,b,x));return(v<<24|w<<16|I<<8|255)>>>0}e.increaseLuminance=o;function c(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=c})($l||={});function Ml(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Pa(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Ps(e){if(!e)throw new Error("value must not be falsy");return e}function hp(e){return 57508<=e&&e<=57558}function z9(e){return 57520<=e&&e<=57527}function H9(e){return 57344<=e&&e<=63743}function G9(e){return 9472<=e&&e<=9631}function W9(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 V9(e,t,r,s){return t===1&&r>Math.ceil(s*1.5)&&e!==void 0&&e>255&&!W9(e)&&!hp(e)&&!H9(e)}function I5(e){return hp(e)||G9(e)}function q9(){return{css:{canvas:Tu(),cell:Tu()},device:{canvas:Tu(),cell:Tu(),char:{width:0,height:0,left:0,top:0}}}}function Tu(){return{width:0,height:0}}function Z9(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var pe;(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})))(pe||={});var Y9={"─":{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},"":pe.LINE_H,"":pe.LINE_V,"":pe.FADE_RIGHT,"":pe.FADE_LEFT,"":pe.FADE_DOWN,"":pe.FADE_UP,"":pe.CURVE_DOWN_RIGHT,"":pe.CURVE_DOWN_LEFT,"":pe.CURVE_UP_RIGHT,"":pe.CURVE_UP_LEFT,"":[pe.LINE_V,pe.CURVE_UP_RIGHT],"":[pe.LINE_V,pe.CURVE_DOWN_RIGHT],"":[pe.CURVE_DOWN_RIGHT,pe.CURVE_UP_RIGHT],"":[pe.LINE_V,pe.CURVE_UP_LEFT],"":[pe.LINE_V,pe.CURVE_DOWN_LEFT],"":[pe.CURVE_DOWN_LEFT,pe.CURVE_UP_LEFT],"":[pe.LINE_H,pe.CURVE_DOWN_LEFT],"":[pe.LINE_H,pe.CURVE_DOWN_RIGHT],"":[pe.CURVE_DOWN_LEFT,pe.CURVE_DOWN_RIGHT],"":[pe.LINE_H,pe.CURVE_UP_LEFT],"":[pe.LINE_H,pe.CURVE_UP_RIGHT],"":[pe.CURVE_UP_LEFT,pe.CURVE_UP_RIGHT],"":[pe.LINE_V,pe.CURVE_UP_LEFT,pe.CURVE_UP_RIGHT],"":[pe.LINE_V,pe.CURVE_DOWN_LEFT,pe.CURVE_DOWN_RIGHT],"":[pe.LINE_H,pe.CURVE_DOWN_LEFT,pe.CURVE_UP_LEFT],"":[pe.LINE_H,pe.CURVE_DOWN_RIGHT,pe.CURVE_UP_RIGHT],"":[pe.LINE_V,pe.CURVE_DOWN_RIGHT,pe.CURVE_UP_LEFT],"":[pe.LINE_V,pe.CURVE_DOWN_LEFT,pe.CURVE_UP_RIGHT],"":[pe.LINE_H,pe.CURVE_DOWN_RIGHT,pe.CURVE_UP_LEFT],"":[pe.LINE_H,pe.CURVE_DOWN_LEFT,pe.CURVE_UP_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE],"":pe.NODE_STROKE,"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_LEFT],"":[pe.NODE_STROKE,pe.NODE_LINE_LEFT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_DOWN],"":[pe.NODE_STROKE,pe.NODE_LINE_DOWN],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_UP],"":[pe.NODE_STROKE,pe.NODE_LINE_UP],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_UP],"":[pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_UP],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT],"":[pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_LEFT],"":[pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_LEFT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_DOWN,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_DOWN,pe.NODE_LINE_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT],"":[pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"":[pe.NODE_FILL,pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"":[pe.NODE_STROKE,pe.NODE_LINE_UP,pe.NODE_LINE_DOWN,pe.NODE_LINE_LEFT,pe.NODE_LINE_RIGHT],"🬀":tr(1),"🬁":tr(2),"🬂":tr(3),"🬃":tr(4),"🬄":tr(5),"🬅":tr(6),"🬆":tr(7),"🬇":tr(8),"🬈":tr(9),"🬉":tr(10),"🬊":tr(11),"🬋":tr(12),"🬌":tr(13),"🬍":tr(14),"🬎":tr(15),"🬏":tr(16),"🬐":tr(17),"🬑":tr(18),"🬒":tr(19),"🬓":tr(20),"🬔":tr(22),"🬕":tr(23),"🬖":tr(24),"🬗":tr(25),"🬘":tr(26),"🬙":tr(27),"🬚":tr(28),"🬛":tr(29),"🬜":tr(30),"🬝":tr(31),"🬞":tr(32),"🬟":tr(33),"🬠":tr(34),"🬡":tr(35),"🬢":tr(36),"🬣":tr(37),"🬤":tr(38),"🬥":tr(39),"🬦":tr(40),"🬧":tr(41),"🬨":tr(43),"🬩":tr(44),"🬪":tr(45),"🬫":tr(46),"🬬":tr(47),"🬭":tr(48),"🬮":tr(49),"🬯":tr(50),"🬰":tr(51),"🬱":tr(52),"🬲":tr(53),"🬳":tr(54),"🬴":tr(55),"🬵":tr(56),"🬶":tr(57),"🬷":tr(58),"🬸":tr(59),"🬹":tr(60),"🬺":tr(61),"🬻":tr(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:ma(126),type:0},scaleType:1},"🯱":{type:5,data:{d:ma(48),type:0},scaleType:1},"🯲":{type:5,data:{d:ma(109),type:0},scaleType:1},"🯳":{type:5,data:{d:ma(121),type:0},scaleType:1},"🯴":{type:5,data:{d:ma(51),type:0},scaleType:1},"🯵":{type:5,data:{d:ma(91),type:0},scaleType:1},"🯶":{type:5,data:{d:ma(95),type:0},scaleType:1},"🯷":{type:5,data:{d:ma(114),type:0},scaleType:1},"🯸":{type:5,data:{d:ma(127),type:0},scaleType:1},"🯹":{type:5,data:{d:ma(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}]))},K9=new Set([9617,9618,9619,129932,129933,129934,129935,129936,129937,129938,129940,129948,129949,129950,129951]);function tr(e){return{type:2,data:()=>{let t=[],r=[.375,.25,.375],s=[0,3/8,5/8];for(let o=0;o<3;o++){let c=e>>o*2&1,u=e>>o*2+1&1;c&&u?t.push(`M0,${s[o]} L1,${s[o]} L1,${s[o]+r[o]} L0,${s[o]+r[o]} Z`):c?t.push(`M0,${s[o]} L${.5},${s[o]} L${.5},${s[o]+r[o]} L0,${s[o]+r[o]} Z`):u&&t.push(`M${.5},${s[o]} L1,${s[o]} L1,${s[o]+r[o]} L${.5},${s[o]+r[o]} Z`)}return t.join(" ")}}}function ma(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,o=.95,c=.175+.075+.015,u=.5-.015;t.push(`M${s},${c} L${o},${c+.0375} L${o},${u-.0375} L${s},${u} L${r},${u-.0375} L${r},${c+.0375} Z`)}if(e&16){let r=.7999999999999999,s=.95-.15/2,o=.95,c=.5+.015,u=.825-.075-.015;t.push(`M${s},${c} L${o},${c+.0375} L${o},${u-.0375} L${s},${u} L${r},${u-.0375} L${r},${c+.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 hi=0,Xs=0,ga=!1,Oa=!1,Cu=!1,Ki,nc=0,X9=class{constructor(e,t,r,s,o,c){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=s,this._coreBrowserService=o,this._themeService=c,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,s,o){this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Xs=0,hi=0,Oa=!1,ga=!1,Cu=!1,Ki=this._themeService.colors,nc=0;let c=e.getCode();if(c!==0&&e.extended.underlineStyle===4){let u=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));nc=t*s%(Math.round(u)*2)}if(nc===0&&K9.has(c)&&(nc=t*s%2*2+r*o%2),this._decorationService.forEachDecorationAtCell(t,r,"bottom",u=>{u.backgroundColorRGB&&(Xs=u.backgroundColorRGB.rgba>>8&16777215,Oa=!0),u.foregroundColorRGB&&(hi=u.foregroundColorRGB.rgba>>8&16777215,ga=!0)}),Cu=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Cu){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Xs=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Xs=(this.result.fg&16777215)<<8|255;break;default:Xs=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Xs=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Xs=(this.result.bg&16777215)<<8|255;break}Xs=$l.blend(Xs,(this._coreBrowserService.isFocused?Ki.selectionBackgroundOpaque:Ki.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Xs=(this._coreBrowserService.isFocused?Ki.selectionBackgroundOpaque:Ki.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Oa=!0,Ki.selectionForeground&&(hi=Ki.selectionForeground.rgba>>8&16777215,ga=!0),I5(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)hi=(this._coreBrowserService.isFocused?Ki.selectionBackgroundOpaque:Ki.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:hi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:hi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:hi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:hi=(this.result.fg&16777215)<<8|255;break;default:hi=this._themeService.colors.foreground.rgba}hi=$l.blend(hi,(this._coreBrowserService.isFocused?Ki.selectionBackgroundOpaque:Ki.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}ga=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",u=>{u.backgroundColorRGB&&(Xs=u.backgroundColorRGB.rgba>>8&16777215,Oa=!0),u.foregroundColorRGB&&(hi=u.foregroundColorRGB.rgba>>8&16777215,ga=!0)}),Oa&&(Cu?Xs=e.bg&-16777216&-134217729|Xs|50331648:Xs=e.bg&-16777216|Xs|50331648),ga&&(hi=e.fg&-16777216&-67108865|hi|50331648),this.result.fg&67108864&&(Oa&&!ga&&((this.result.bg&50331648)===0?hi=this.result.fg&-134217728|Ki.background.rgba>>8&16777215&16777215|50331648:hi=this.result.fg&-134217728|this.result.bg&67108863,ga=!0),!Oa&&ga&&((this.result.fg&50331648)===0?Xs=this.result.bg&-67108864|Ki.foreground.rgba>>8&16777215&16777215|50331648:Xs=this.result.bg&-67108864|this.result.fg&67108863,Oa=!0)),Ki=void 0,this.result.bg=Oa?Xs:this.result.bg,this.result.fg=ga?hi:this.result.fg,this.result.ext&=536870911,this.result.ext|=nc<<29&3758096384}},J9=.5,k5=O9||F9?"bottom":"ideographic";function ew(e,t,r,s,o,c,u,f,m,g,b,x,v=0){let w=Y9[t];if(w){let I=Array.isArray(w)?w:[w];for(let k of I)tw(e,k,r,s,o,c,u,f,m,g,b,x,v);return!0}return!1}function tw(e,t,r,s,o,c,u,f,m,g,b,x,v=0){let w=o,I=c,k=r,N=s;switch(t.scaleType===1&&(w=u,I=f,k=r+(o-u)/2,N=s+(c-f)/2),t.clipPath&&(e.save(),cw(e,t.clipPath,k,N,w,I)),t.type){case 0:rw(e,t.data,k,N,w,I);break;case 1:aw(e,t.data,k,N,w,I,v);break;case 2:lw(e,t.data,k,N,w,I,g,b,t.strokeWidth);break;case 3:sw(e,t.data,k,N,w,I,g,t.strokeWidth);break;case 4:ow(e,t.data,k,N,w,I,g,x);break;case 5:uw(e,t.data,k,N,w,I,m,g,b);break;case 6:nw(e,t.data,k,N,w,I);break}t.clipPath&&e.restore()}function rw(e,t,r,s,o,c){for(let u=0;u<t.length;u++){let f=t[u],m=o/8,g=c/8;e.fillRect(r+f.x*m,s+f.y*g,f.w*m,f.h*g)}}var W1=new Uint8Array([1,0,1,2,1,4,5,0,5,2,5,4,1,6,5,6]);function nw(e,t,r,s,o,c){let u=o/8,f=c*.1,m=c*.8/8,g=Math.min(u,m);for(let b=0;b<8;b++)if(t&1<<b){let x=W1[b*2],v=W1[b*2+1],w=r+(x+1)*u,I=s+f+(v+1)*m;e.beginPath(),e.arc(w,I,g,0,Math.PI*2),e.fill()}}function sw(e,t,r,s,o,c,u,f){let m=typeof t=="string"?t:t(0,0);e.beginPath();let g=0,b=0,x=0,v=0,w="";for(let I of m.split(" ")){let k=I[0],N=I.substring(1).split(",");if(k==="Z"){e.closePath(),w=k;continue}if(k==="V"){let Q=s+parseFloat(N[0])*c;e.lineTo(g,Q),b=Q,x=g,v=b,w=k;continue}if(k==="H"){let Q=r+parseFloat(N[0])*o;e.lineTo(Q,b),g=Q,x=g,v=b,w=k;continue}if(!N[0]||!N[1])continue;if(k==="A"){let Q=parseFloat(N[0])*o,F=parseFloat(N[1])*c,q=parseFloat(N[2])*Math.PI/180,P=parseInt(N[3],10),Z=parseInt(N[4],10),V=r+parseFloat(N[5])*o,fe=s+parseFloat(N[6])*c;iw(e,g,b,Q,F,q,P,Z,V,fe),g=V,b=fe;continue}let R=N.map((Q,F)=>{let q=parseFloat(Q);return F%2===0?r+q*o:s+q*c});if(k==="M")e.moveTo(R[0],R[1]),g=R[0],b=R[1],x=g,v=b;else if(k==="L")e.lineTo(R[0],R[1]),g=R[0],b=R[1],x=g,v=b;else if(k==="Q")e.quadraticCurveTo(R[0],R[1],R[2],R[3]),x=R[0],v=R[1],g=R[2],b=R[3];else if(k==="T"){let Q,F;w==="Q"||w==="T"?(Q=2*g-x,F=2*b-v):(Q=g,F=b),e.quadraticCurveTo(Q,F,R[0],R[1]),x=Q,v=F,g=R[0],b=R[1]}else k==="C"&&(e.bezierCurveTo(R[0],R[1],R[2],R[3],R[4],R[5]),x=R[2],v=R[3],g=R[4],b=R[5]);w=k}f!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=u*f,e.stroke()):e.fill()}function iw(e,t,r,s,o,c,u,f,m,g){if(s===0||o===0){e.lineTo(m,g);return}s=Math.abs(s),o=Math.abs(o);let b=Math.cos(c),x=Math.sin(c),v=(t-m)/2,w=(r-g)/2,I=b*v+x*w,k=-x*v+b*w,N=s*s,R=o*o,Q=I*I,F=k*k,q=Q/N+F/R;if(q>1){let Oe=Math.sqrt(q);s*=Oe,o*=Oe,N=s*s,R=o*o}let P=(N*R-N*F-R*Q)/(N*F+R*Q);P<0&&(P=0);let Z=(u===f?-1:1)*Math.sqrt(P),V=Z*(s*k/o),fe=Z*-(o*I/s),_e=b*V-x*fe+(t+m)/2,De=x*V+b*fe+(r+g)/2,be=(I-V)/s,st=(k-fe)/o,Ue=(-I-V)/s,Ee=(-k-fe)/o,ht=Math.atan2(st,be),Ve=Math.atan2(Ee,Ue)-ht;f===0&&Ve>0?Ve-=2*Math.PI:f===1&&Ve<0&&(Ve+=2*Math.PI);let he=ht+Ve;e.ellipse(_e,De,s,o,c,ht,he,f===0)}function ow(e,t,r,s,o,c,u,f){e.save(),e.fillRect(r,s,o,c),f&&(e.fillStyle=f,e.strokeStyle=f),e.lineWidth=u,e.lineCap="square",e.beginPath();for(let m of t.d.split(" ")){let g=m[0],b=m.substring(1).split(",");if(!b[0]||!b[1]){g==="Z"&&e.closePath();continue}let x=b.map((v,w)=>{let I=parseFloat(v);return w%2===0?r+I*o:s+I*c});g==="M"?e.moveTo(x[0],x[1]):g==="L"&&e.lineTo(x[0],x[1])}t.type===1?e.stroke():e.fill(),e.restore()}var V1=new Map;function aw(e,t,r,s,o,c,u=0){let f=V1.get(t);f||(f=new Map,V1.set(t,f));let m=e.fillStyle;if(typeof m!="string")throw new Error(`Unexpected fillStyle type "${m}"`);let g=f.get(m);if(!g){let v=t[0].length,w=t.length,I=e.canvas.ownerDocument.createElement("canvas");I.width=v,I.height=w;let k=Ps(I.getContext("2d")),N=new ImageData(v,w),R,Q,F,q;if(m.startsWith("#"))R=parseInt(m.slice(1,3),16),Q=parseInt(m.slice(3,5),16),F=parseInt(m.slice(5,7),16),q=m.length>7&&parseInt(m.slice(7,9),16)||1;else if(m.startsWith("rgba"))[R,Q,F,q]=m.substring(5,m.length-1).split(",").map(P=>parseFloat(P));else throw new Error(`Unexpected fillStyle color format "${m}" when drawing pattern glyph`);for(let P=0;P<w;P++)for(let Z=0;Z<v;Z++)N.data[(P*v+Z)*4]=R,N.data[(P*v+Z)*4+1]=Q,N.data[(P*v+Z)*4+2]=F,N.data[(P*v+Z)*4+3]=t[P][Z]*(q*255);k.putImageData(N,0,0),g=Ps(e.createPattern(I,null)),f.set(m,g)}let b=u>>1&1,x=u&1;b!==0||x!==0?g.setTransform(new DOMMatrix().translateSelf(-b,-x)):g.setTransform(new DOMMatrix),e.fillStyle=g,e.fillRect(r,s,o,c)}function lw(e,t,r,s,o,c,u,f,m){e.save(),e.beginPath(),e.rect(r,s,o,c),e.clip(),e.beginPath();let g;if(typeof t=="function"){let x=.15/c*o;g=t(.15,x)}else g=t;let b={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let x of g.split(" ")){let v=x[0];if(v==="Z"){e.closePath(),b.lastCommand=v;continue}let w=E5[v];if(!w){f.error(`Could not find drawing instructions for "${v}"`);continue}let I=x.substring(1).split(",");!I[0]||!I[1]||(w(e,M5(I,o,c,r,s,!0,u,0,0,!1),b),b.lastCommand=v)}m!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=u*m,e.stroke()):e.fill(),e.closePath(),e.restore()}function cw(e,t,r,s,o,c){e.beginPath();for(let u of t.split(" ")){let f=u[0];if(f==="Z"){e.closePath();continue}let m=u.substring(1).split(",");if(!m[0]||!m[1])continue;let g=r+parseFloat(m[0])*o,b=s+parseFloat(m[1])*c;f==="M"?e.moveTo(g,b):f==="L"&&e.lineTo(g,b)}e.clip()}function uw(e,t,r,s,o,c,u,f,m){let g=new Path2D;g.rect(r,s,o,c),e.clip(g),e.beginPath();let b=u/12;e.lineWidth=f*b;let x={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(),x.lastCommand=w;continue}let I=E5[w];if(!I){m.error(`Could not find drawing instructions for "${w}"`);continue}let k=v.substring(1).split(",");!k[0]||!k[1]||(I(e,M5(k,o,c,r,s,!1,f,(t.leftPadding??0)*(b/2),(t.rightPadding??0)*(b/2)),x),x.lastCommand=w)}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function q1(e,t,r=0){return Math.max(Math.min(e,t),r)}var E5={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,o;r.lastCommand==="Q"||r.lastCommand==="T"?(s=2*r.currentX-r.lastControlX,o=2*r.currentY-r.lastControlY):(s=r.currentX,o=r.currentY),e.quadraticCurveTo(s,o,t[0],t[1]),r.lastControlX=s,r.lastControlY=o,r.currentX=t[0],r.currentY=t[1]}};function M5(e,t,r,s,o,c,u,f=0,m=0,g=!0){let b=e.map(x=>parseFloat(x)||parseInt(x));if(b.length<2)throw new Error("Too few arguments for instruction");for(let x=0;x<b.length;x+=2){if(b[x]*=t-f*u-m*u,c&&b[x]!==0){let v=Math.round(b[x]+.5)-.5;b[x]=g?q1(v,t,0):v}b[x]+=s+f*u}for(let x=1;x<b.length;x+=2){if(b[x]*=r,c&&b[x]!==0){let v=Math.round(b[x]+.5)-.5;b[x]=g?q1(v,r,0):v}b[x]+=o}return b}var Z1=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={}}},Y1=class{constructor(){this._data=new Z1}set(e,t,r,s,o){this._data.get(e,t)||this._data.set(e,t,new Z1),this._data.get(e,t).set(r,s,o)}get(e,t,r,s){return this._data.get(e,t)?.get(r,s)}clear(){this._data.clear()}},R5=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(),o;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),o=e.timeRemaining(),r*1.5>o){s-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=o}this.clear()}},dw=class extends R5{_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())}}},hw=class extends R5{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},fw="requestIdleCallback"in globalThis?hw:dw,S0=class N5{constructor(){this.fg=0,this.bg=0,this.extended=new D5}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 N5;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}},D5=class Q5{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 Q5(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ta=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,s)=>{if(this._disposed)return Vs(()=>{});let o={fn:t,thisArgs:r};this._listeners.push(o);let c=Vs(()=>{let u=this._listeners.indexOf(o);u!==-1&&this._listeners.splice(u,1)});return s&&(Array.isArray(s)?s.push(c):s.add(c)),c},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:o}of r)s.call(o,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},Ul;(e=>{function t(c,u){return c(f=>u.fire(f))}e.forward=t;function r(c,u){return(f,m,g)=>c(b=>f.call(m,u(b)),void 0,g)}e.map=r;function s(...c){return(u,f,m)=>{let g=new _5;for(let b of c)g.add(b(x=>u.call(f,x)));return m&&(Array.isArray(m)?m.push(g):m.add(g)),g}}e.any=s;function o(c,u,f){return u(f),c(m=>u(m))}e.runAndSubscribe=o})(Ul||={});var K1={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}},sc=2,ic,pl=class A0{constructor(t,r,s,o){this._document=t,this._config=r,this._unicodeService=s,this._logService=o,this._didWarmUp=!1,this._cacheMap=new Y1,this._cacheMapCombined=new Y1,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new S0,this._textureSize=512,this._onAddTextureAtlasCanvas=new ta,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new ta,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=j5(t,this._config.deviceCellWidth*4+sc*2,this._config.deviceCellHeight+sc*2),this._tmpCtx=Ps(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 fw(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(A0.maxAtlasPages&&this._pages.length>=Math.max(4,A0.maxAtlasPages)){let r=this._pages.filter(g=>g.canvas.width*2<=(A0.maxTextureSize||4096)).sort((g,b)=>b.canvas.width!==g.canvas.width?b.canvas.width-g.canvas.width:b.percentageUsed-g.percentageUsed),s=-1,o=0;for(let g=0;g<r.length;g++)if(r[g].canvas.width!==o)s=g,o=r[g].canvas.width;else if(g-s===3)break;let c=r.slice(s,s+4);if(c.length<4||c.some(g=>g.canvas.width!==c[0].canvas.width)){let g=new Rl(this._document,this._textureSize);return this._pages.push(g),this._activePages.push(g),this._onAddTextureAtlasCanvas.fire(g.canvas),g}let u=c.map(g=>g.glyphs[0].texturePage).sort((g,b)=>g-b),f=this.pages.length-c.length,m=this._mergePages(c,f);m.version=++Rl.nextVersion;for(let g=u.length-1;g>=0;g--)this._deletePage(u[g]);this.pages.push(m),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(m.canvas)}let t=new Rl(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,o=new Rl(this._document,s,t);for(let[c,u]of t.entries()){let f=c*u.canvas.width%s,m=Math.floor(c/2)*u.canvas.height;o.ctx.drawImage(u.canvas,f,m);for(let b of u.glyphs)b.texturePage=r,b.sizeClipSpace.x=b.size.x/s,b.sizeClipSpace.y=b.size.y/s,b.texturePosition.x+=f,b.texturePosition.y+=m,b.texturePositionClipSpace.x=b.texturePosition.x/s,b.texturePositionClipSpace.y=b.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(u.canvas);let g=this._activePages.indexOf(u);g!==-1&&this._activePages.splice(g,1)}return o}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let s=this._pages[r];for(let o of s.glyphs)o.texturePage--;s.version=++Rl.nextVersion}}getRasterizedGlyphCombinedChar(t,r,s,o,c,u){return this._getFromCacheMap(this._cacheMapCombined,t,r,s,o,c,u)}getRasterizedGlyph(t,r,s,o,c,u){return this._getFromCacheMap(this._cacheMap,t,r,s,o,c,u)}_getFromCacheMap(t,r,s,o,c,u,f){return ic=t.get(r,s,o,c),ic||(ic=this._drawToCache(r,s,o,c,u,f),t.set(r,s,o,c,ic)),ic}_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,o){if(this._config.allowTransparency)return No;let c;switch(t){case 16777216:case 33554432:c=this._getColorFromAnsiIndex(r);break;case 50331648:let u=S0.toColorRGB(r);c=$i.toColor(u[0],u[1],u[2]);break;default:s?c=Mc.opaque(this._config.colors.foreground):c=this._config.colors.background;break}return this._config.allowTransparency||(c=Mc.opaque(c)),c}_getForegroundColor(t,r,s,o,c,u,f,m,g,b){let x=this._getMinimumContrastColor(t,r,s,o,c,u,f,g,m,b);if(x)return x;let v;switch(c){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&g&&u<8&&(u+=8),v=this._getColorFromAnsiIndex(u);break;case 50331648:let w=S0.toColorRGB(u);v=$i.toColor(w[0],w[1],w[2]);break;default:f?v=this._config.colors.background:v=this._config.colors.foreground}return this._config.allowTransparency&&(v=Mc.opaque(v)),m&&(v=Mc.multiplyOpacity(v,J9)),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,o){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&o&&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,o,c,u,f,m,g,b){if(this._config.minimumContrastRatio===1||b)return;let x=this._getContrastCache(g),v=x.getColor(t,o);if(v!==void 0)return v??void 0;let w=this._resolveBackgroundRgba(r,s,f),I=this._resolveForegroundRgba(c,u,f,m),k=$l.ensureContrastRatio(w,I,this._config.minimumContrastRatio/(g?2:1));if(!k){x.setColor(t,o,null);return}let N=$i.toColor(k>>24&255,k>>16&255,k>>8&255);return x.setColor(t,o,N),N}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,s,o,c,u){let f=typeof t=="number"?String.fromCharCode(t):t;u&&this._tmpCanvas.parentElement!==u&&(this._tmpCanvas.style.display="none",u.append(this._tmpCanvas));let m=Math.min(this._config.deviceCellWidth*Math.max(f.length,2)+sc*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<m&&(this._tmpCanvas.width=m);let g=Math.min(this._config.deviceCellHeight+sc*4,this._textureSize);if(this._tmpCanvas.height<g&&(this._tmpCanvas.height=g),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=o,!!this._workAttributeData.isInvisible())return K1;let b=!!this._workAttributeData.isBold(),x=!!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(),Q=this._workAttributeData.getFgColorMode(),F=this._workAttributeData.getBgColor(),q=this._workAttributeData.getBgColorMode();if(x){let Le=R;R=F,F=Le;let Xe=Q;Q=q,q=Xe}let P=this._getBackgroundColor(q,F,x,v);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=P.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let Z=b?this._config.fontWeightBold:this._config.fontWeight,V=w?"italic":"";this._tmpCtx.font=`${V} ${Z} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=k5;let fe=f.length===1&&hp(f.charCodeAt(0)),_e=f.length===1&&z9(f.charCodeAt(0)),De=this._getForegroundColor(r,q,F,s,Q,R,x,v,b,I5(f.charCodeAt(0)));this._tmpCtx.fillStyle=De.css;let be=_e?0:sc*2,st=!1;if(this._config.customGlyphs!==!1){let Le=this._workAttributeData.getUnderlineVariantOffset();st=ew(this._tmpCtx,f,be,be,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.deviceCharWidth,this._config.deviceCharHeight,this._config.fontSize,this._config.devicePixelRatio,this._logService,P.css,Le)}let Ue=!fe,Ee;if(typeof t=="number"?Ee=this._unicodeService.wcwidth(t):Ee=this._unicodeService.getStringCellWidth(t),I){this._tmpCtx.save();let Le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Xe=Le%2===1?.5:0;if(this._tmpCtx.lineWidth=Le,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Ue=!1,this._tmpCtx.strokeStyle=`rgb(${S0.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Ue=!1;let Je=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Je<8&&(Je+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Je).css}this._tmpCtx.fillStyle=this._tmpCtx.strokeStyle,this._tmpCtx.beginPath();let re=be,ge=Math.ceil(be+this._config.deviceCharHeight)-Xe-(c?Le*2:0),Qt=ge+Le*2,Rt=this._workAttributeData.getUnderlineVariantOffset(),We=0,W=0;for(let Je=0;Je<Ee;Je++){let Se=!1;this._tmpCtx.save(),We=ge,W=Qt;let me=re+Je*this._config.deviceCellWidth,ce=re+(Je+1)*this._config.deviceCellWidth;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(me,ge),this._tmpCtx.lineTo(ce,ge),this._tmpCtx.moveTo(me,Qt),this._tmpCtx.lineTo(ce,Qt);break;case 3:We=this._config.deviceCharHeight+1,W=We+3*this._config.devicePixelRatio;let qe=new Path2D;qe.rect(me,We,this._config.deviceCellWidth,W-We),this._tmpCtx.clip(qe);let ue=this._config.deviceCellWidth,Me=W-We,et=ue/6,bt=Me/3,xe=[[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 gr of xe){this._tmpCtx.beginPath();for(let ct=0;ct<gr.length;ct+=2){let gt=me+gr[ct]*et,vt=W-gr[ct+1]*bt;ct===0?this._tmpCtx.moveTo(gt,vt):this._tmpCtx.lineTo(gt,vt)}this._tmpCtx.closePath(),this._tmpCtx.fill()}Se=!0;break;case 4:let de=Rt===0?0:Rt>=Le?Le*2-Rt:Le-Rt;Rt>=Le||de===0?(this._tmpCtx.setLineDash([Math.round(Le),Math.round(Le)]),this._tmpCtx.moveTo(me+de,ge),this._tmpCtx.lineTo(ce,ge)):(this._tmpCtx.setLineDash([Math.round(Le),Math.round(Le)]),this._tmpCtx.moveTo(me,ge),this._tmpCtx.lineTo(me+de,ge),this._tmpCtx.moveTo(me+de+Le,ge),this._tmpCtx.lineTo(ce,ge)),Rt=Z9(ce-me,Le,Rt);break;case 5:let Ie=.6,Qe=.3,Pe=ce-me,ft=Math.floor(Ie*Pe),Mt=Math.floor(Qe*Pe),Be=Pe-ft-Mt;this._tmpCtx.setLineDash([ft,Mt,Be]),this._tmpCtx.moveTo(me,ge),this._tmpCtx.lineTo(ce,ge);break;default:this._tmpCtx.moveTo(me,ge),this._tmpCtx.lineTo(ce,ge);break}Se||this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!st&&this._config.fontSize>=12&&!this._config.allowTransparency&&f!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Je=this._tmpCtx.measureText(f);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Je&&Je.actualBoundingBoxDescent>0){this._tmpCtx.save();let Se=new Path2D;Se.rect(re,We-Math.ceil(Le/2),this._config.deviceCellWidth*Ee,W-We+Math.ceil(Le/2)),this._tmpCtx.clip(Se),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=P.css,this._tmpCtx.strokeText(f,be,be+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(N){let Le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Xe=Le%2===1?.5:0;this._tmpCtx.lineWidth=Le,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(be,be+Xe),this._tmpCtx.lineTo(be+this._config.deviceCharWidth*Ee,be+Xe),this._tmpCtx.stroke()}if(st||this._tmpCtx.fillText(f,be,be+this._config.deviceCharHeight),f==="_"&&!this._config.allowTransparency){let Le=yh(this._tmpCtx.getImageData(be,be,this._config.deviceCellWidth,this._config.deviceCellHeight),P,De,Ue);if(Le)for(let Xe=1;Xe<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=P.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(f,be,be+this._config.deviceCharHeight-Xe),Le=yh(this._tmpCtx.getImageData(be,be,this._config.deviceCellWidth,this._config.deviceCellHeight),P,De,Ue),!!Le);Xe++);}if(k){let Le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),Xe=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=Le,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(be,be+Math.floor(this._config.deviceCharHeight/2)-Xe),this._tmpCtx.lineTo(be+this._config.deviceCharWidth*Ee,be+Math.floor(this._config.deviceCharHeight/2)-Xe),this._tmpCtx.stroke()}this._tmpCtx.restore();let ht=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),Ve;if(this._config.allowTransparency?Ve=pw(ht):Ve=yh(ht,P,De,Ue),Ve)return K1;let he=this._findGlyphBoundingBox(ht,this._workBoundingBox,m,_e,st,be),Oe,ie;for(;;){if(this._activePages.length===0){let Le=this._createNewPage();Oe=Le,ie=Le.currentRow,ie.height=he.size.y;break}Oe=this._activePages[this._activePages.length-1],ie=Oe.currentRow;for(let Le of this._activePages)he.size.y<=Le.currentRow.height&&(Oe=Le,ie=Le.currentRow);for(let Le=this._activePages.length-1;Le>=0;Le--)for(let Xe of this._activePages[Le].fixedRows)Xe.height<=ie.height&&he.size.y<=Xe.height&&(Oe=this._activePages[Le],ie=Xe);if(he.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Rl(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),Oe=this._overflowSizePage,ie=this._overflowSizePage.currentRow,ie.x+he.size.x>=Oe.canvas.width&&(ie.x=0,ie.y+=ie.height,ie.height=0);break}if(ie.y+he.size.y>=Oe.canvas.height||ie.height>he.size.y+2){let Le=!1;if(Oe.currentRow.y+Oe.currentRow.height+he.size.y>=Oe.canvas.height){let Xe;for(let re of this._activePages)if(re.currentRow.y+re.currentRow.height+he.size.y<re.canvas.height){Xe=re;break}if(Xe)Oe=Xe;else if(A0.maxAtlasPages&&this._pages.length>=A0.maxAtlasPages&&ie.y+he.size.y<=Oe.canvas.height&&ie.height>=he.size.y&&ie.x+he.size.x<=Oe.canvas.width)Le=!0;else{let re=this._createNewPage();Oe=re,ie=re.currentRow,ie.height=he.size.y,Le=!0}}Le||(Oe.currentRow.height>0&&Oe.fixedRows.push(Oe.currentRow),ie={x:0,y:Oe.currentRow.y+Oe.currentRow.height,height:he.size.y},Oe.fixedRows.push(ie),Oe.currentRow={x:0,y:ie.y+ie.height,height:0})}if(ie.x+he.size.x<=Oe.canvas.width)break;ie===Oe.currentRow?(ie.x=0,ie.y+=ie.height,ie.height=0):Oe.fixedRows.splice(Oe.fixedRows.indexOf(ie),1)}return he.texturePage=this._pages.indexOf(Oe),he.texturePosition.x=ie.x,he.texturePosition.y=ie.y,he.texturePositionClipSpace.x=ie.x/Oe.canvas.width,he.texturePositionClipSpace.y=ie.y/Oe.canvas.height,he.sizeClipSpace.x/=Oe.canvas.width,he.sizeClipSpace.y/=Oe.canvas.height,ie.height=Math.max(ie.height,he.size.y),ie.x+=he.size.x,Oe.ctx.putImageData(ht,he.texturePosition.x-this._workBoundingBox.left,he.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,he.size.x,he.size.y),Oe.addGlyph(he),Oe.version=++Rl.nextVersion,he}_findGlyphBoundingBox(t,r,s,o,c,u){r.top=0;let f=o?this._config.deviceCellHeight:this._tmpCanvas.height,m=o?this._config.deviceCellWidth:s,g=!1;for(let b=0;b<f;b++){for(let x=0;x<m;x++){let v=b*this._tmpCanvas.width*4+x*4+3;if(t.data[v]!==0){r.top=b,g=!0;break}}if(g)break}r.left=0,g=!1;for(let b=0;b<u+m;b++){for(let x=0;x<f;x++){let v=x*this._tmpCanvas.width*4+b*4+3;if(t.data[v]!==0){r.left=b,g=!0;break}}if(g)break}r.right=m,g=!1;for(let b=u+m-1;b>=u;b--){for(let x=0;x<f;x++){let v=x*this._tmpCanvas.width*4+b*4+3;if(t.data[v]!==0){r.right=b,g=!0;break}}if(g)break}r.bottom=f,g=!1;for(let b=f-1;b>=0;b--){for(let x=0;x<m;x++){let v=b*this._tmpCanvas.width*4+x*4+3;if(t.data[v]!==0){r.bottom=b,g=!0;break}}if(g)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+u+(o||c?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+u+(o||c?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},B5=class Sf{constructor(t,r,s){if(this._usedPixels=0,this._glyphs=[],this.version=++Sf.nextVersion,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],this.canvas=j5(t,r,r),this.ctx=Ps(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 o=0;o<s.length;++o)this._glyphs=this._glyphs.concat(s[o].glyphs),this._usedPixels+=s[o]._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=++Sf.nextVersion}};B5.nextVersion=0;var Rl=B5;function yh(e,t,r,s){let o=t.rgba>>>24,c=t.rgba>>>16&255,u=t.rgba>>>8&255,f=r.rgba>>>24,m=r.rgba>>>16&255,g=r.rgba>>>8&255,b=Math.floor((Math.abs(o-f)+Math.abs(c-m)+Math.abs(u-g))/12),x=!0;for(let v=0;v<e.data.length;v+=4)e.data[v]===o&&e.data[v+1]===c&&e.data[v+2]===u||s&&Math.abs(e.data[v]-o)+Math.abs(e.data[v+1]-c)+Math.abs(e.data[v+2]-u)<b?e.data[v+3]=0:x=!1;return x}function pw(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function j5(e,t,r){let s=e.createElement("canvas");return s.width=t,s.height=r,s}function mw(e,t,r,s,o,c,u,f,m=!0){let g={foreground:c.foreground,background:c.background,cursor:No,cursorAccent:No,selectionForeground:No,selectionBackgroundTransparent:No,selectionBackgroundOpaque:No,selectionInactiveBackgroundTransparent:No,selectionInactiveBackgroundOpaque:No,overviewRulerBorder:No,scrollbarSliderBackground:No,scrollbarSliderHoverBackground:No,scrollbarSliderActiveBackground:No,ansi:c.ansi.slice(),contrastCache:c.contrastCache,halfContrastCache:c.halfContrastCache};return{customGlyphs:m,devicePixelRatio:u,deviceMaxTextureSize:f,letterSpacing:o.letterSpacing,lineHeight:o.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:s,fontFamily:o.fontFamily,fontSize:o.fontSize,fontWeight:o.fontWeight,fontWeightBold:o.fontWeightBold,allowTransparency:o.allowTransparency,drawBoldTextInBrightColors:o.drawBoldTextInBrightColors,minimumContrastRatio:o.minimumContrastRatio,colors:g}}function X1(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 gw(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Qo=[];function P5(e,t,r,s,o,c,u,f,m,g=!0){let b=mw(s,o,c,u,t,r,f,m,g);for(let I=0;I<Qo.length;I++){let k=Qo[I],N=k.ownedBy.indexOf(e);if(N>=0){if(X1(k.config,b))return k.atlas;k.ownedBy.length===1?(k.atlas.dispose(),Qo.splice(I,1)):k.ownedBy.splice(N,1);break}}for(let I=0;I<Qo.length;I++){let k=Qo[I];if(X1(k.config,b))return k.ownedBy.push(e),k.atlas}let x=e._core,v=x._logService,w={atlas:new pl(document,b,x.unicodeService,v),config:b,ownedBy:[e]};return Qo.push(w),w.atlas}function J1(e){for(let t=0;t<Qo.length;t++){let r=Qo[t].ownedBy.indexOf(e);if(r!==-1){Qo[t].ownedBy.length===1?(Qo[t].atlas.dispose(),Qo.splice(t,1)):Qo[t].ownedBy.splice(r,1);break}}}var xw=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 em(e,t,r){let s=new t.ResizeObserver(o=>{let c=o.find(m=>m.target===e);if(!c)return;if(!("devicePixelContentBoxSize"in c)){s?.disconnect(),s=void 0;return}let u=c.devicePixelContentBoxSize[0].inlineSize,f=c.devicePixelContentBoxSize[0].blockSize;u>0&&f>0&&r(u,f)});try{s.observe(e,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return Vs(()=>s?.disconnect())}function bw(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var yw=class O5 extends S0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new D5,this.combinedData=""}static fromCharData(t){let r=new O5;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?bw(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 o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(s-55296)*1024+o-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())}},vw=class extends Kl{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(Vs(()=>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)}},F5=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function U5(e,t,r,s){let o=Ps(e.createProgram());if(e.attachShader(o,Ps(tm(e,e.VERTEX_SHADER,t,s))),e.attachShader(o,Ps(tm(e,e.FRAGMENT_SHADER,r,s))),e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS))return o;s.error(e.getProgramInfoLog(o)),e.deleteProgram(o)}function tm(e,t,r,s){let o=Ps(e.createShader(t));if(e.shaderSource(o,r),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS))return o;s.error(e.getShaderInfoLog(o)),e.deleteShader(o)}function ww(e,t){let r=Math.min(e.length*2,t),s=new Float32Array(r);for(let o=0;o<e.length;o++)s[o]=e[o];return s}var Aw=class{constructor(t){this.texture=t,this.version=-1}},Tw=`#version 300 es
4
+ layout (location = 0) in vec2 a_unitquad;
5
+ layout (location = 1) in vec2 a_cellpos;
6
+ layout (location = 2) in vec2 a_offset;
7
+ layout (location = 3) in vec2 a_size;
8
+ layout (location = 4) in float a_texpage;
9
+ layout (location = 5) in vec2 a_texcoord;
10
+ layout (location = 6) in vec2 a_texsize;
11
+
12
+ uniform mat4 u_projection;
13
+ uniform vec2 u_resolution;
14
+
15
+ out vec2 v_texcoord;
16
+ flat out int v_texpage;
17
+
18
+ void main() {
19
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
20
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
21
+ v_texpage = int(a_texpage);
22
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
23
+ }`;function Cw(e){let t="";for(let r=1;r<e;r++)t+=` else if (v_texpage == ${r}) { outColor = texture(u_texture[${r}], v_texcoord); }`;return`#version 300 es
24
+ precision lowp float;
25
+
26
+ in vec2 v_texcoord;
27
+ flat in int v_texpage;
28
+
29
+ uniform sampler2D u_texture[${e}];
30
+
31
+ out vec4 outColor;
32
+
33
+ void main() {
34
+ if (v_texpage == 0) {
35
+ outColor = texture(u_texture[0], v_texcoord);
36
+ } ${t}
37
+ }`}var gs=0,is,vh=0,oc=0,_w=class extends Kl{constructor(t,r,s,o,c){super(),this._terminal=t,this._gl=r,this._dimensions=s,this._optionsService=o,this._logService=c,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let u=this._gl;pl.maxAtlasPages===void 0&&(pl.maxAtlasPages=Math.min(32,Ps(u.getParameter(u.MAX_TEXTURE_IMAGE_UNITS))),pl.maxTextureSize=Ps(u.getParameter(u.MAX_TEXTURE_SIZE))),this._program=Ps(U5(u,Tw,Cw(pl.maxAtlasPages),this._logService)),this._register(Vs(()=>u.deleteProgram(this._program))),this._projectionLocation=Ps(u.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Ps(u.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Ps(u.getUniformLocation(this._program,"u_texture"));let f=this._vertexArrayObject=u.createVertexArray();this._register(Vs(()=>u.deleteVertexArray(f))),u.bindVertexArray(f);let m=new Float32Array([0,0,1,0,0,1,1,1]),g=u.createBuffer();this._register(Vs(()=>u.deleteBuffer(g))),u.bindBuffer(u.ARRAY_BUFFER,g),u.bufferData(u.ARRAY_BUFFER,m,u.STATIC_DRAW),u.enableVertexAttribArray(0),u.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let b=new Uint8Array([0,1,2,3]),x=u.createBuffer();this._register(Vs(()=>u.deleteBuffer(x))),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,x),u.bufferData(u.ELEMENT_ARRAY_BUFFER,b,u.STATIC_DRAW),this._attributesBuffer=Ps(u.createBuffer()),this._register(Vs(()=>u.deleteBuffer(this._attributesBuffer))),u.bindBuffer(u.ARRAY_BUFFER,this._attributesBuffer),u.enableVertexAttribArray(2),u.vertexAttribPointer(2,2,u.FLOAT,!1,44,0),u.vertexAttribDivisor(2,1),u.enableVertexAttribArray(3),u.vertexAttribPointer(3,2,u.FLOAT,!1,44,2*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(3,1),u.enableVertexAttribArray(4),u.vertexAttribPointer(4,1,u.FLOAT,!1,44,4*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(4,1),u.enableVertexAttribArray(5),u.vertexAttribPointer(5,2,u.FLOAT,!1,44,5*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(5,1),u.enableVertexAttribArray(6),u.vertexAttribPointer(6,2,u.FLOAT,!1,44,7*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(6,1),u.enableVertexAttribArray(1),u.vertexAttribPointer(1,2,u.FLOAT,!1,44,9*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(1,1),u.useProgram(this._program);let v=new Int32Array(pl.maxAtlasPages);for(let w=0;w<pl.maxAtlasPages;w++)v[w]=w;u.uniform1iv(this._textureLocation,v),u.uniformMatrix4fv(this._projectionLocation,!1,F5),this._atlasTextures=[];for(let w=0;w<pl.maxAtlasPages;w++){let I=new Aw(Ps(u.createTexture()));this._register(Vs(()=>u.deleteTexture(I.texture))),u.activeTexture(u.TEXTURE0+w),u.bindTexture(u.TEXTURE_2D,I.texture),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[w]=I}u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,s,o,c,u,f,m,g){this._updateCell(this._vertices.attributes,t,r,s,o,c,u,f,m,g)}_updateCell(t,r,s,o,c,u,f,m,g,b){if(gs=(s*this._terminal.cols+r)*11,o===0||o===void 0){t.fill(0,gs,gs+11-1-2);return}this._atlas&&(m&&m.length>1?is=this._atlas.getRasterizedGlyphCombinedChar(m,c,u,f,!1,this._terminal.element):is=this._atlas.getRasterizedGlyph(o,c,u,f,!1,this._terminal.element),vh=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),c!==b&&is.offset.x>vh?(oc=is.offset.x-vh,t[gs]=-(is.offset.x-oc)+this._dimensions.device.char.left,t[gs+1]=-is.offset.y+this._dimensions.device.char.top,t[gs+2]=(is.size.x-oc)/this._dimensions.device.canvas.width,t[gs+3]=is.size.y/this._dimensions.device.canvas.height,t[gs+4]=is.texturePage,t[gs+5]=is.texturePositionClipSpace.x+oc/this._atlas.pages[is.texturePage].canvas.width,t[gs+6]=is.texturePositionClipSpace.y,t[gs+7]=is.sizeClipSpace.x-oc/this._atlas.pages[is.texturePage].canvas.width,t[gs+8]=is.sizeClipSpace.y):(t[gs]=-is.offset.x+this._dimensions.device.char.left,t[gs+1]=-is.offset.y+this._dimensions.device.char.top,t[gs+2]=is.size.x/this._dimensions.device.canvas.width,t[gs+3]=is.size.y/this._dimensions.device.canvas.height,t[gs+4]=is.texturePage,t[gs+5]=is.texturePositionClipSpace.x,t[gs+6]=is.texturePositionClipSpace.y,t[gs+7]=is.sizeClipSpace.x,t[gs+8]=is.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&V9(o,g,is.size.x,this._dimensions.device.cell.width)&&(t[gs+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 o=0;o<t.rows;o++)for(let c=0;c<t.cols;c++)this._vertices.attributes[s+9]=c/t.cols,this._vertices.attributes[s+10]=o/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],o=0;for(let c=0;c<t.lineLengths.length;c++){let u=c*this._terminal.cols*11,f=this._vertices.attributes.subarray(u,u+t.lineLengths[c]*11);s.set(f,o),o+=f.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,s.subarray(0,o),r.STREAM_DRAW);for(let c=0;c<this._atlas.pages.length;c++)this._atlas.pages[c].version!==this._atlasTextures[c].version&&this._bindAtlasPageTexture(r,this._atlas,c);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,o/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}},Sw=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,o=!1){if(this.selectionStart=r,this.selectionEnd=s,!r||!s||r[0]===s[0]&&r[1]===s[1]){this.clear();return}let c=t.buffers.active.ydisp,u=r[1]-c,f=s[1]-c,m=Math.max(u,0),g=Math.min(f,t.rows-1);if(m>=t.rows||g<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=o,this.viewportStartRow=u,this.viewportEndRow=f,this.viewportCappedStartRow=m,this.viewportCappedEndRow=g,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 Lw(){return new Sw}var Iw=2147483648,kw=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=Lw()}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)}},Ew=`#version 300 es
38
+ layout (location = 0) in vec2 a_position;
39
+ layout (location = 1) in vec2 a_size;
40
+ layout (location = 2) in vec4 a_color;
41
+ layout (location = 3) in vec2 a_unitquad;
42
+
43
+ uniform mat4 u_projection;
44
+
45
+ out vec4 v_color;
46
+
47
+ void main() {
48
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
49
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
50
+ v_color = a_color;
51
+ }`,Mw=`#version 300 es
52
+ precision lowp float;
53
+
54
+ in vec4 v_color;
55
+
56
+ out vec4 outColor;
57
+
58
+ void main() {
59
+ outColor = v_color;
60
+ }`,Sa=8,wh=Sa*Float32Array.BYTES_PER_ELEMENT,Rw=20*Sa,rm=class{constructor(){this.attributes=new Float32Array(Rw),this.count=0}},Fa=0,nm=0,sm=0,im=0,om=0,am=0,lm=0,Nw=class extends Kl{constructor(t,r,s,o,c){super(),this._terminal=t,this._gl=r,this._dimensions=s,this._themeService=o,this._logService=c,this._vertices=new rm,this._verticesCursor=new rm;let u=this._gl;this._program=Ps(U5(u,Ew,Mw,this._logService)),this._register(Vs(()=>u.deleteProgram(this._program))),this._projectionLocation=Ps(u.getUniformLocation(this._program,"u_projection"));let f=this._vertexArrayObject=u.createVertexArray();this._register(Vs(()=>u.deleteVertexArray(f))),u.bindVertexArray(f);let m=new Float32Array([0,0,1,0,0,1,1,1]),g=u.createBuffer();this._register(Vs(()=>u.deleteBuffer(g))),u.bindBuffer(u.ARRAY_BUFFER,g),u.bufferData(u.ARRAY_BUFFER,m,u.STATIC_DRAW),u.enableVertexAttribArray(3),u.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let b=new Uint8Array([0,1,2,3]),x=u.createBuffer();this._register(Vs(()=>u.deleteBuffer(x))),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,x),u.bufferData(u.ELEMENT_ARRAY_BUFFER,b,u.STATIC_DRAW),this._attributesBuffer=Ps(u.createBuffer()),this._register(Vs(()=>u.deleteBuffer(this._attributesBuffer))),u.bindBuffer(u.ARRAY_BUFFER,this._attributesBuffer),u.enableVertexAttribArray(0),u.vertexAttribPointer(0,2,u.FLOAT,!1,wh,0),u.vertexAttribDivisor(0,1),u.enableVertexAttribArray(1),u.vertexAttribPointer(1,2,u.FLOAT,!1,wh,2*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(1,1),u.enableVertexAttribArray(2),u.vertexAttribPointer(2,4,u.FLOAT,!1,wh,4*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(2,1),this._updateCachedColors(o.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,F5),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,o=1,c,u,f,m,g,b,x,v,w,I,k;for(c=0;c<r.rows;c++){for(f=-1,m=0,g=0,b=!1,u=0;u<r.cols;u++)x=(c*r.cols+u)*4,v=t.cells[x+1],w=t.cells[x+2],I=!!(w&67108864),(v!==m||w!==g&&(b||I))&&((m!==0||b&&g!==0)&&(k=o++*Sa,this._updateRectangle(s,k,g,m,f,u,c)),f=u,m=v,g=w,b=I);(m!==0||b&&g!==0)&&(k=o++*Sa,this._updateRectangle(s,k,g,m,f,r.cols,c))}s.count=o}updateCursor(t){let r=this._verticesCursor,s=t.cursor;if(!s||s.style==="block"){r.count=0;return}let o,c=0;(s.style==="bar"||s.style==="outline")&&(o=c++*Sa,this._addRectangleFloat(r.attributes,o,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")&&(o=c++*Sa,this._addRectangleFloat(r.attributes,o,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"&&(o=c++*Sa,this._addRectangleFloat(r.attributes,o,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),o=c++*Sa,this._addRectangleFloat(r.attributes,o,(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=c}_updateRectangle(t,r,s,o,c,u,f){if(s&67108864)switch(s&50331648){case 16777216:case 33554432:Fa=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Fa=(s&16777215)<<8;break;default:Fa=this._themeService.colors.foreground.rgba}else switch(o&50331648){case 16777216:case 33554432:Fa=this._themeService.colors.ansi[o&255].rgba;break;case 50331648:Fa=(o&16777215)<<8;break;default:Fa=this._themeService.colors.background.rgba}t.attributes.length<r+Sa&&(t.attributes=ww(t.attributes,(this._terminal.rows*this._terminal.cols+1)*Sa)),nm=c*this._dimensions.device.cell.width,sm=f*this._dimensions.device.cell.height,im=(Fa>>24&255)/255,om=(Fa>>16&255)/255,am=(Fa>>8&255)/255,lm=1,this._addRectangle(t.attributes,r,nm,sm,(u-c)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,im,om,am,lm)}_addRectangle(t,r,s,o,c,u,f,m,g,b){t[r]=s/this._dimensions.device.canvas.width,t[r+1]=o/this._dimensions.device.canvas.height,t[r+2]=c/this._dimensions.device.canvas.width,t[r+3]=u/this._dimensions.device.canvas.height,t[r+4]=f,t[r+5]=m,t[r+6]=g,t[r+7]=b}_addRectangleFloat(t,r,s,o,c,u,f){t[r]=s/this._dimensions.device.canvas.width,t[r+1]=o/this._dimensions.device.canvas.height,t[r+2]=c/this._dimensions.device.canvas.width,t[r+3]=u/this._dimensions.device.canvas.height,t[r+4]=f[0],t[r+5]=f[1],t[r+6]=f[2],t[r+7]=f[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])}},Dw=class extends Kl{constructor(e,t,r,s,o,c,u,f){super(),this._container=t,this._alpha=o,this._coreBrowserService=c,this._optionsService=u,this._themeService=f,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(m=>{this._refreshCharAtlas(e,m),this.reset(e)})),this._register(Vs(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Ps(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=P5(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=k5,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}`}},Qw=class extends Dw{constructor(t,r,s,o,c,u,f){super(s,t,"link",r,!0,c,u,f),this._register(o.onShowLinkUnderline(m=>this._handleShowLinkUnderline(m))),this._register(o.onHideLinkUnderline(m=>this._handleHideLinkUnderline(m)))}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&&gw(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()}},Bw=class{constructor(t,r,s,o){this._node=t,this._type=r,this._handler=s,this._options=o,t.addEventListener(r,s,o)}dispose(){!this._node||!this._handler||(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Ah(e,t,r,s){return new Bw(e,t,r,s)}var jw=class extends Kl{constructor(e,t,r,s,o,c,u,f,m,g=!0,b){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=s,this._coreService=o,this._decorationService=c,this._logService=u,this._optionsService=f,this._themeService=m,this._customGlyphs=g,this._cursorBlinkStateManager=this._register(new rc),this._charAtlasDisposable=this._register(new rc),this._observerDisposable=this._register(new rc),this._model=new kw,this._rowHasBlinkingCells=[],this._rowHasBlinkingCellsCount=0,this._workCell=new yw,this._rectangleRenderer=this._register(new rc),this._glyphRenderer=this._register(new rc),this._onChangeTextureAtlas=this._register(new ta),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ta),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ta),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ta),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ta),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let x={antialias:!1,depth:!1,preserveDrawingBuffer:b};if(this._gl=this._canvas.getContext("webgl2",x),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new X9(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Qw(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,f,this._themeService)],this.dimensions=q9(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(f.onOptionChange(()=>this._handleOptionsChanged())),this._textBlinkStateManager=this._register(new vw(()=>this._requestRedrawViewport(),this._coreBrowserService,this._optionsService)),this._resetBlinkingRowState(),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Ah(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(Ah(this._canvas,"webglcontextrestored",v=>{this._logService.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,J1(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=em(this._canvas,this._coreBrowserService.window,(v,w)=>this._setCanvasDevicePixelDimensions(v,w)),this._register(this._coreBrowserService.onWindowChange(v=>{this._observerDisposable.value=em(this._canvas,v,(w,I)=>this._setCanvasDevicePixelDimensions(w,I))})),this._register(Ah(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(Vs(()=>{clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0;for(let v of this._renderLayers)v.dispose();this._canvas.parentElement?.removeChild(this._canvas),J1(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 Nw(this._terminal,this._gl,this.dimensions,this._themeService,this._logService),this._glyphRenderer.value=new _w(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=P5(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=j9(Ul.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ul.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 o of this._renderLayers)o.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 xw(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,s=this._workCell,o,c,u,f,m,g,b,x,v,w,I,k,N,R,Q,F,q;e=cm(e,r.rows-1,0),t=cm(t,r.rows-1,0);let P=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",Z=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,V=Z-r.buffer.ydisp,fe=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),_e=-1,De=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let be=!1;for(c=e;c<=t;c++){u=c+r.buffer.ydisp;let st=r.buffer.lines.get(u);if(!st){for(this._model.lineLengths[c]=0,F=0;F<r.cols;F++)q=(c*r.cols+F)*4,be=!0,this._nullModelCell(F,c,q,0,0,0);this._setRowBlinkState(c,!1);continue}f=st;let Ue=!1;for(this._model.lineLengths[c]=0,I=Z===u,b=0,m=this._characterJoinerService.getJoinedCharacters(u),F=0;F<r.cols;F++){if(o=this._cellColorResolver.result.bg,f.loadCell(F,s),F===0&&(o=this._cellColorResolver.result.bg),g=!1,x=F>=b,v=F,m.length>0&&F===m[0][0]&&x){w=m.shift();let Ee=this._model.selection.isCellSelected(this._terminal,w[0],u);for(Q=w[0]+1;Q<w[1];Q++)x&&=Ee===this._model.selection.isCellSelected(this._terminal,Q,u);x&&=!I||fe<w[0]||fe>=w[1],x?(g=!0,s=new Pw(s,f.translateToString(!0,w[0],w[1]),w[1]-w[0]),v=w[1]-1):b=w[1]}if(k=s.getChars(),N=s.getCode(),Q=(c*r.cols+F)*4,!Ue&&s.isBlink()&&(Ue=!0),this._cellColorResolver.resolve(s,F,u,this.dimensions.device.cell.width,this.dimensions.device.cell.height),De&&u===Z&&(F===fe&&(this._model.cursor={x:fe,y:V,width:s.getWidth(),style:this._coreBrowserService.isFocused?P:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},_e=fe+s.getWidth()-1),F>=fe&&F<=_e&&(this._coreBrowserService.isFocused&&P==="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[c]=F+1),!(this._model.cells[Q]===N&&this._model.cells[Q+1]===this._cellColorResolver.result.bg&&this._model.cells[Q+2]===this._cellColorResolver.result.fg&&this._model.cells[Q+3]===this._cellColorResolver.result.ext)&&(be=!0,k.length>1&&(N|=Iw),this._model.cells[Q]=N,this._model.cells[Q+1]=this._cellColorResolver.result.bg,this._model.cells[Q+2]=this._cellColorResolver.result.fg,this._model.cells[Q+3]=this._cellColorResolver.result.ext,R=s.getWidth(),this._glyphRenderer.value.updateCell(F,c,N,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,k,R,o),g)){for(s=this._workCell,F++;F<=v;F++)q=(c*r.cols+F)*4,this._nullModelCell(F,c,q,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext);F--}}this._setRowBlinkState(c,Ue)}be&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model),this._updateTextBlinkState()}_nullModelCell(e,t,r,s,o,c){this._glyphRenderer.value.updateCell(e,t,0,s,o,c,"",0,0),this._model.cells[r]=0,this._model.cells[r+1]=s,this._model.cells[r+2]=o,this._model.cells[r+3]=c}_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})}},Pw=class extends S0{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 cm(e,t,r=0){return Math.max(Math.min(e,t),r)}var Ow=class extends Kl{constructor(e){if(L5&&U9()<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 ta),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ta),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ta),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ta),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,o=t,c=o._renderService,u=o._characterJoinerService,f=o._charSizeService,m=o._coreBrowserService,g=o._decorationService,b=o._logService,x=o._themeService;this._renderer=this._register(new jw(e,u,f,m,r,g,b,s,x,this._customGlyphs,this._preserveDrawingBuffer)),this._register(Ul.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ul.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ul.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ul.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),c.setRenderer(this._renderer),this._register(Vs(()=>{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 Fw=class{constructor(t,r,s,o={}){this._terminal=t,this._regex=r,this._handler=s,this._options=o}provideLinks(t,r){let s=$w.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,o)=>{if(this._options.hover){let{range:c}=r;this._options.hover(s,o,c)}},r))}};function Uw(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 $w=class Ku{static computeLink(t,r,s,o){let c=r.flags.includes("g")?r.flags:`${r.flags}g`,u=new RegExp(r.source,c),[f,m]=Ku._getWindowedLineStrings(t-1,s),g=f.join(""),b,x=[];for(;b=u.exec(g);){let v=b[0];if(!Uw(v))continue;let[w,I]=Ku._mapStrIdx(s,m,0,b.index),[k,N]=Ku._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}};x.push({range:R,text:v,activate:o})}return x}static _getWindowedLineStrings(t,r){let s,o=t,c=t,u,f,m=[];if(s=r.buffer.active.getLine(t)){let g=s.translateToString(!0);if(s.isWrapped&&g[0]!==" "){for(u=0;(s=r.buffer.active.getLine(--o))&&u<2048&&(f=s.translateToString(!0),u+=f.length,m.push(f),!(!s.isWrapped||f.indexOf(" ")!==-1)););m.reverse()}for(m.push(g),u=0;(s=r.buffer.active.getLine(++c))&&s.isWrapped&&u<2048&&(f=s.translateToString(!0),u+=f.length,m.push(f),f.indexOf(" ")===-1););}return[m,o]}static _mapStrIdx(t,r,s,o){let c=t.buffer.active,u=c.getNullCell(),f=s;for(;o;){let m=c.getLine(r);if(!m)return[-1,-1];for(let g=f;g<m.length;++g){m.getCell(g,u);let b=u.getChars();if(u.getWidth()&&(o-=b.length||1,g===m.length-1&&b==="")){let x=c.getLine(r+1);x&&x.isWrapped&&(x.getCell(0,u),u.getWidth()===2&&(o+=1))}if(o<0)return[r,g]}r++,f=0}return[r,f]}},zw=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Hw(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 Gw=class{constructor(t=Hw,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,s=r.urlRegex??zw;this._linkProvider=this._terminal.registerLinkProvider(new Fw(this._terminal,s,this._handler,r))}dispose(){this._linkProvider?.dispose()}};function um(e){return{dispose:e}}var Ww=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()}},Vw=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 o={fn:t,thisArgs:r};this._listeners.push(o);let c=um(()=>{let u=this._listeners.indexOf(o);u!==-1&&this._listeners.splice(u,1)});return s&&(Array.isArray(s)?s.push(c):s.add(c)),c},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:o}of r)s.call(o,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},qw;(e=>{function t(c,u){return c(f=>u.fire(f))}e.forward=t;function r(c,u){return(f,m,g)=>c(b=>f.call(m,u(b)),void 0,g)}e.map=r;function s(...c){return(u,f,m)=>{let g=new Ww;for(let b of c)g.add(b(x=>u.call(f,x)));return m&&(Array.isArray(m)?m.push(g):m.add(g)),g}}e.any=s;function o(c,u,f){return u(f),c(m=>u(m))}e.runAndSubscribe=o})(qw||={});var dm=class Xu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Vw,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,o=t.length;for(let c=0;c<o;++c){let u=t.charCodeAt(c);if(55296<=u&&u<=56319){if(++c>=o)return r+this.wcwidth(u);let g=t.charCodeAt(c);56320<=g&&g<=57343?u=(u-55296)*1024+g-56320+65536:r+=this.wcwidth(g)}let f=this.charProperties(u,s),m=Xu.extractWidth(f);Xu.extractShouldJoin(f)&&(m-=Xu.extractWidth(s)),r+=m,s=f}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},Th=[[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]],Zw=[[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]],Ch=[[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]],Yw=[[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]],Ua;function hm(e,t){let r=0,s=t.length-1,o;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=r;)if(o=r+s>>1,e>t[o][1])r=o+1;else if(e<t[o][0])s=o-1;else return!0;return!1}var Kw=class{constructor(){if(this.version="11",!Ua){Ua=new Uint8Array(65536),Ua.fill(1),Ua[0]=0,Ua.fill(0,1,32),Ua.fill(0,127,160);for(let e=0;e<Th.length;++e)Ua.fill(0,Th[e][0],Th[e][1]+1);for(let e=0;e<Ch.length;++e)Ua.fill(2,Ch[e][0],Ch[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ua[e]:hm(e,Zw)?0:hm(e,Yw)?2:1}charProperties(e,t){let r=this.wcwidth(e),s=r===0&&t!==0;if(s){let o=dm.extractWidth(t);o===0?s=!1:o>r&&(r=o)}return dm.createPropertyValue(0,r,s)}},Xw=class{activate(e){e.unicode.register(new Kw)}dispose(){}};function Zl(e){return{dispose:e}}function Ju(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function Jw(...e){return Zl(()=>Ju(e))}var $5=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()}},ru=class{constructor(){this._store=new $5}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};ru.None=Object.freeze({dispose(){}});var ud=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}},Lf=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return Zl(()=>{});let s={fn:e,thisArgs:t};this._listeners.push(s);let o=Zl(()=>{let c=this._listeners.indexOf(s);c!==-1&&this._listeners.splice(c,1)});return r&&(Array.isArray(r)?r.push(o):r.add(o)),o},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)}},eA;(e=>{function t(c,u){return c(f=>u.fire(f))}e.forward=t;function r(c,u){return(f,m,g)=>c(b=>f.call(m,u(b)),void 0,g)}e.map=r;function s(...c){return(u,f,m)=>{let g=new $5;for(let b of c)g.add(b(x=>u.call(f,x)));return m&&(Array.isArray(m)?m.push(g):m.add(g)),g}}e.any=s;function o(c,u,f){return u(f),c(m=>u(m))}e.runAndSubscribe=o})(eA||={});function z5(e,t=0,r){let s=setTimeout(()=>{e()},t);return Zl(()=>{clearTimeout(s)})}var tA=class extends ru{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new ud),this._linesCacheDisposables=this._register(new ud),this._lastAccessTimestamp=0,this._register(Zl(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Jw(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=z5(()=>{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],o=this._terminal.buffer.active.getLine(e);for(;o;){let c=this._terminal.buffer.active.getLine(e+1),u=c?c.isWrapped:!1,f=o.translateToString(!u&&t);if(u&&c){let m=o.getCell(o.length-1);m&&m.getCode()===0&&m.getWidth()===1&&c.getCell(0)?.getWidth()===2&&(f=f.slice(0,-1))}if(r.push(f),u)s.push(s[s.length-1]+f.length);else break;e++,o=c}return[r.join(""),s]}},rA=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}},nA=class{constructor(t,r){this._terminal=t,this._lineCache=r}find(t,r,s,o){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 c={startRow:r,startCol:s},u=this._findInLine(t,c,o);if(!u)for(let f=r+1;f<this._terminal.buffer.active.baseY+this._terminal.rows&&(c.startRow=f,c.startCol=0,u=this._findInLine(t,c,o),!u);f++);return u}findNextWithSelection(t,r,s){if(!t||t.length===0){this._terminal.clearSelection();return}let o=this._terminal.getSelectionPosition();this._terminal.clearSelection();let c=0,u=0;o&&(s===t?(c=o.end.x,u=o.end.y):(c=o.start.x,u=o.start.y)),this._lineCache.initLinesCache();let f={startRow:u,startCol:c},m=this._findInLine(t,f,r);if(!m)for(let g=u+1;g<this._terminal.buffer.active.baseY+this._terminal.rows&&(f.startRow=g,f.startCol=0,m=this._findInLine(t,f,r),!m);g++);if(!m&&u!==0)for(let g=0;g<u&&(f.startRow=g,f.startCol=0,m=this._findInLine(t,f,r),!m);g++);return!m&&o&&(f.startRow=o.start.y,f.startCol=0,m=this._findInLine(t,f,r)),m}findPreviousWithSelection(t,r,s){if(!t||t.length===0){this._terminal.clearSelection();return}let o=this._terminal.getSelectionPosition();this._terminal.clearSelection();let c=this._terminal.buffer.active.baseY+this._terminal.rows-1,u=this._terminal.cols,f=!0;this._lineCache.initLinesCache();let m={startRow:c,startCol:u},g;if(o&&(m.startRow=c=o.start.y,m.startCol=o.start.x,s!==t&&(g=this._findInLine(t,m,r,!1),g||(m.startRow=c=o.end.y,m.startCol=o.end.x))),g??=this._findInLine(t,m,r,f),!g){m.startCol=Math.max(m.startCol,this._terminal.cols);for(let b=c-1;b>=0&&(m.startRow=b,g=this._findInLine(t,m,r,f),!g);b--);}if(!g&&c!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let b=this._terminal.buffer.active.baseY+this._terminal.rows-1;b>=c&&(m.startRow=b,g=this._findInLine(t,m,r,f),!g);b--);return g}_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={},o=!1){let c=r.startRow,u=r.startCol;if(this._terminal.buffer.active.getLine(c)?.isWrapped){if(o){r.startCol+=this._terminal.cols;return}return r.startRow--,r.startCol+=this._terminal.cols,this._findInLine(t,r,s)}let f=this._lineCache.getLineFromCache(c);f||(f=this._lineCache.translateBufferLineToStringWithWrap(c,!0),this._lineCache.setLineInCache(c,f));let[m,g]=f,b=this._bufferColsToStringOffset(c,u),x=t,v=m;s.regex||(x=s.caseSensitive?t:t.toLowerCase(),v=s.caseSensitive?m:m.toLowerCase());let w=-1;if(s.regex){let I=RegExp(x,s.caseSensitive?"g":"gi"),k;if(o)for(;k=I.exec(v.slice(0,b));)w=I.lastIndex-k[0].length,t=k[0],I.lastIndex-=t.length-1;else k=I.exec(v.slice(b)),k&&k[0].length>0&&(w=b+(I.lastIndex-k[0].length),t=k[0])}else o?b-x.length>=0&&(w=v.lastIndexOf(x,b-x.length)):w=v.indexOf(x,b);if(w>=0){if(s.wholeWord&&!this._isWholeWord(w,v,t))return;let I=0;for(;I<g.length-1&&w>=g[I+1];)I++;let k=I;for(;k<g.length-1&&w+t.length>=g[k+1];)k++;let N=w-g[I],R=w+t.length-g[k],Q=this._stringLengthToBufferSize(c+I,N),F=this._stringLengthToBufferSize(c+k,R)-Q+this._terminal.cols*(k-I);return{term:t,col:Q,row:c+I,size:F}}}_stringLengthToBufferSize(t,r){let s=this._terminal.buffer.active.getLine(t);if(!s)return 0;for(let o=0;o<r;o++){let c=s.getCell(o);if(!c)break;let u=c.getChars();u.length>1&&(r-=u.length-1);let f=s.getCell(o+1);f&&f.getWidth()===0&&r++}return r}_bufferColsToStringOffset(t,r){let s=t,o=0,c=this._terminal.buffer.active.getLine(s);for(;r>0&&c;){for(let u=0;u<r&&u<this._terminal.cols;u++){let f=c.getCell(u);if(!f)break;f.getWidth()&&(o+=f.getCode()===0?1:f.getChars().length)}if(s++,c=this._terminal.buffer.active.getLine(s),c&&!c.isWrapped)break;r-=this._terminal.cols}return o}},sA=class extends ru{constructor(t){super(),this._terminal=t,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Zl(()=>this.clearHighlightDecorations()))}createHighlightDecorations(t,r){this.clearHighlightDecorations();for(let s of t){let o=this._createResultDecorations(s,r,!1);if(o)for(let c of o)this._storeDecoration(c,s)}}createActiveDecoration(t,r){let s=this._createResultDecorations(t,r,!0);if(s)return{decorations:s,match:t,dispose(){Ju(s)}}}clearHighlightDecorations(){Ju(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 o=[],c=t.col,u=t.size,f=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;u>0;){let g=Math.min(this._terminal.cols-c,u);o.push([f,c,g]),c=0,u-=g,f++}let m=[];for(let g of o){let b=this._terminal.registerMarker(g[0]),x=this._terminal.registerDecoration({marker:b,x:g[1],width:g[2],layer:s?"top":"bottom",backgroundColor:s?r.activeMatchBackground:r.matchBackground,overviewRulerOptions:this._highlightedLines.has(b.line)?void 0:{color:s?r.activeMatchColorOverviewRuler:r.matchOverviewRuler,position:"center"}});if(x){let v=[];v.push(b),v.push(x.onRender(w=>this._applyStyles(w,s?r.activeMatchBorder:r.matchBorder,!1))),v.push(x.onDispose(()=>Ju(v))),m.push(x)}}return m.length===0?void 0:m}},iA=class extends ru{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Lf)}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()}},oA=class extends ru{constructor(t){super(),this._highlightTimeout=this._register(new ud),this._lineCache=this._register(new ud),this._state=new rA,this._resultTracker=this._register(new iA),this._onAfterSearch=this._register(new Lf),this.onAfterSearch=this._onAfterSearch.event,this._onBeforeSearch=this._register(new Lf),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 tA(t),this._engine=new nA(t,this._lineCache.value),this._decorationManager=new sA(t),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Zl(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=z5(()=>{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 o=this._findNextAndSelect(t,r,s);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),o}_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=[],o,c=this._engine.find(t,0,0,r);for(;c&&(o?.row!==c.row||o?.col!==c.col)&&!(s.length>=this._highlightLimit);){o=c,s.push(o);let u=this._terminal.cols,f=o.col+o.size,m=o.row;f>=u&&(m+=Math.floor(f/u),f=f%u),c=this._engine.find(t,m,f,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 o=this._engine.findNextWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(o,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 o=this._findPreviousAndSelect(t,r,s);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),o}_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 o=this._engine.findPreviousWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(o,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 o=this._decorationManager.createActiveDecoration(t,r);o&&(this._resultTracker.selectedDecoration=o)}if(!s&&(t.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||t.row<this._terminal.buffer.active.viewportY)){let o=t.row-this._terminal.buffer.active.viewportY;o-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(o)}return!0}};var ni=0,si=0,ii=0,bs=0,Li;(e=>{function t(o,c,u,f){return f!==void 0?`#${Nl(o)}${Nl(c)}${Nl(u)}${Nl(f)}`:`#${Nl(o)}${Nl(c)}${Nl(u)}`}e.toCss=t;function r(o,c,u,f=255){return(o<<24|c<<16|u<<8|f)>>>0}e.toRgba=r;function s(o,c,u,f){return{css:e.toCss(o,c,u,f),rgba:e.toRgba(o,c,u,f)}}e.toColor=s})(Li||={});var aA;(e=>{function t(m,g){if(bs=(g.rgba&255)/255,bs===1)return{css:g.css,rgba:g.rgba};let b=g.rgba>>24&255,x=g.rgba>>16&255,v=g.rgba>>8&255,w=m.rgba>>24&255,I=m.rgba>>16&255,k=m.rgba>>8&255;ni=w+Math.round((b-w)*bs),si=I+Math.round((x-I)*bs),ii=k+Math.round((v-k)*bs);let N=Li.toCss(ni,si,ii),R=Li.toRgba(ni,si,ii);return{css:N,rgba:R}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function s(m,g,b){let x=ed.ensureContrastRatio(m.rgba,g.rgba,b);if(x)return Li.toColor(x>>24&255,x>>16&255,x>>8&255)}e.ensureContrastRatio=s;function o(m){let g=(m.rgba|255)>>>0;return[ni,si,ii]=ed.toChannels(g),{css:Li.toCss(ni,si,ii),rgba:g}}e.opaque=o;function c(m,g){return bs=Math.round(g*255),[ni,si,ii]=ed.toChannels(m.rgba),{css:Li.toCss(ni,si,ii,bs),rgba:Li.toRgba(ni,si,ii,bs)}}e.opacity=c;function u(m,g){return bs=m.rgba&255,c(m,bs*g/255)}e.multiplyOpacity=u;function f(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=f})(aA||={});var gi;(e=>{let t,r;try{let o=document.createElement("canvas");o.width=1,o.height=1;let c=o.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function s(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return ni=parseInt(o.slice(1,2).repeat(2),16),si=parseInt(o.slice(2,3).repeat(2),16),ii=parseInt(o.slice(3,4).repeat(2),16),Li.toColor(ni,si,ii);case 5:return ni=parseInt(o.slice(1,2).repeat(2),16),si=parseInt(o.slice(2,3).repeat(2),16),ii=parseInt(o.slice(3,4).repeat(2),16),bs=parseInt(o.slice(4,5).repeat(2),16),Li.toColor(ni,si,ii,bs);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let c=o.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return ni=parseInt(c[1],10),si=parseInt(c[2],10),ii=parseInt(c[3],10),bs=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),Li.toColor(ni,si,ii,bs);if(o==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ni,si,ii,bs]=t.getImageData(0,0,1,1).data,bs!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Li.toRgba(ni,si,ii,bs),css:o}}e.toColor=s})(gi||={});var Fi;(e=>{function t(s){return r(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function r(s,o,c){let u=s/255,f=o/255,m=c/255,g=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),b=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),x=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return g*.2126+b*.7152+x*.0722}e.relativeLuminance2=r})(Fi||={});var ed;(e=>{function t(u,f){if(bs=(f&255)/255,bs===1)return f;let m=f>>24&255,g=f>>16&255,b=f>>8&255,x=u>>24&255,v=u>>16&255,w=u>>8&255;return ni=x+Math.round((m-x)*bs),si=v+Math.round((g-v)*bs),ii=w+Math.round((b-w)*bs),Li.toRgba(ni,si,ii)}e.blend=t;function r(u,f,m){let g=Fi.relativeLuminance(u>>8),b=Fi.relativeLuminance(f>>8);if($a(g,b)<m){if(b<g){let w=s(u,f,m),I=$a(g,Fi.relativeLuminance(w>>8));if(I<m){let k=o(u,f,m),N=$a(g,Fi.relativeLuminance(k>>8));return I>N?w:k}return w}let x=o(u,f,m),v=$a(g,Fi.relativeLuminance(x>>8));if(v<m){let w=s(u,f,m),I=$a(g,Fi.relativeLuminance(w>>8));return v>I?x:w}return x}}e.ensureContrastRatio=r;function s(u,f,m){let g=u>>24&255,b=u>>16&255,x=u>>8&255,v=f>>24&255,w=f>>16&255,I=f>>8&255,k=$a(Fi.relativeLuminance2(v,w,I),Fi.relativeLuminance2(g,b,x));for(;k<m&&(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=$a(Fi.relativeLuminance2(v,w,I),Fi.relativeLuminance2(g,b,x));return(v<<24|w<<16|I<<8|255)>>>0}e.reduceLuminance=s;function o(u,f,m){let g=u>>24&255,b=u>>16&255,x=u>>8&255,v=f>>24&255,w=f>>16&255,I=f>>8&255,k=$a(Fi.relativeLuminance2(v,w,I),Fi.relativeLuminance2(g,b,x));for(;k<m&&(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=$a(Fi.relativeLuminance2(v,w,I),Fi.relativeLuminance2(g,b,x));return(v<<24|w<<16|I<<8|255)>>>0}e.increaseLuminance=o;function c(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=c})(ed||={});function Nl(e){let t=e.toString(16);return t.length<2?"0"+t:t}function $a(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var lA=Object.freeze((()=>{let e=[gi.toColor("#2e3436"),gi.toColor("#cc0000"),gi.toColor("#4e9a06"),gi.toColor("#c4a000"),gi.toColor("#3465a4"),gi.toColor("#75507b"),gi.toColor("#06989a"),gi.toColor("#d3d7cf"),gi.toColor("#555753"),gi.toColor("#ef2929"),gi.toColor("#8ae234"),gi.toColor("#fce94f"),gi.toColor("#729fcf"),gi.toColor("#ad7fa8"),gi.toColor("#34e2e2"),gi.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let s=t[r/36%6|0],o=t[r/6%6|0],c=t[r%6];e.push({css:Li.toCss(s,o,c),rgba:Li.toRgba(s,o,c)})}for(let r=0;r<24;r++){let s=8+r*10;e.push({css:Li.toCss(s,s,s),rgba:Li.toRgba(s,s,s)})}return e})());function fm(e,t,r){return Math.max(t,Math.min(e,r))}function cA(e){switch(e){case"&":return"&amp;";case"<":return"&lt;"}return e}var H5=class{constructor(e){this._buffer=e}serialize(e,t){let r=this._buffer.getNullCell(),s=this._buffer.getNullCell(),o=r,c=e.start.y,u=e.end.y,f=e.start.x,m=e.end.x;this._beforeSerialize(u-c,c,u);for(let g=c;g<=u;g++){let b=this._buffer.getLine(g);if(b){let x=g===e.start.y?f:0,v=g===e.end.y?m:b.length;for(let w=x;w<v;w++){let I=b.getCell(w,o===r?s:r);if(!I){console.warn(`Can't get cell at row=${g}, col=${w}`);continue}this._nextCell(I,o,g,w),o=I}}this._rowEnd(g,g===u)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,r,s){}_rowEnd(e,t){}_beforeSerialize(e,t,r){}_afterSerialize(){}_serializeString(e){return""}};function fp(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function La(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function G5(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 pp(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&G5(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 W5(e,t){let r=e;return typeof r.attributesEquals=="function"?r.attributesEquals(t):fp(e,t)&&La(e,t)&&pp(e,t)}var uA=class extends H5{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&&!La(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 o=this._buffer.getLine(t),c=this._buffer.getLine(t+1);if(!c.isWrapped)s=`\r
61
+ `,this._lastCursorRow=t+1,this._lastCursorCol=0;else{s="";let u=o.getCell(o.length-1,this._thisRowLastChar),f=o.getCell(o.length-2,this._thisRowLastSecondChar),m=c.getCell(0,this._nextRowFirstChar),g=m.getWidth()>1,b=!1;(m.getChars()&&g?this._nullCellCount<=1:this._nullCellCount<=0)&&((u.getChars()||u.getWidth()===0)&&La(u,m)&&(b=!0),g&&(f.getChars()||f.getWidth()===0)&&La(u,m)&&La(f,m)&&(b=!0)),b||(s="-".repeat(this._nullCellCount+1),s+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(s+="\x1B[A",s+=`\x1B[${o.length-this._nullCellCount}C`,s+=`\x1B[${this._nullCellCount}X`,s+=`\x1B[${o.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(W5(t,r))return s;let o=!fp(t,r),c=!La(t,r),u=!pp(t,r);if(o||c||u)if(t.isAttributeDefault())r.isAttributeDefault()||s.push(0);else{if(o){let f=t.getFgColor();t.isFgRGB()?s.push(38,2,f>>>16&255,f>>>8&255,f&255):t.isFgPalette()?f>=16?s.push(38,5,f):s.push(f&8?90+(f&7):30+(f&7)):s.push(39)}if(c){let f=t.getBgColor();t.isBgRGB()?s.push(48,2,f>>>16&255,f>>>8&255,f&255):t.isBgPalette()?f>=16?s.push(48,5,f):s.push(f&8?100+(f&7):40+(f&7)):s.push(49)}if(u){if(t.isInverse()!==r.isInverse()&&s.push(t.isInverse()?7:27),t.isBold()!==r.isBold()&&s.push(t.isBold()?1:22),G5(t,r))t.isUnderline()!==r.isUnderline()&&s.push(t.isUnderline()?4:24);else{let f=t.getUnderlineStyle();if(f===0)s.push(24);else if(f===1&&t.isUnderlineColorDefault())s.push(4);else if(s.push("4:"+f),!t.isUnderlineColorDefault()){let m=t.getUnderlineColor();t.isUnderlineColorRGB()?s.push("58:2::"+(m>>>16&255)+":"+(m>>>8&255)+":"+(m&255)):s.push("58:5:"+m)}}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,o){if(t.getWidth()===0)return;let c=t.getChars()==="",u=this._diffStyle(t,this._cursorStyle);if(c?!La(this._cursorStyle,t):u.length>0){this._nullCellCount>0&&(La(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=o,this._currentRow+=`\x1B[${u.join(";")}m`;let f=this._buffer.getLine(s);f!==void 0&&(f.getCell(o,this._cursorStyle),this._cursorStyleRow=s,this._cursorStyleCol=o)}c?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(La(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=o+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 u=0;u<r;u++)s+=this._allRows[u],u+1<r&&(s+=this._allRowSeparators[u]);if(!t){let u=this._buffer.baseY+this._buffer.cursorY,f=this._buffer.cursorX,m=u!==this._lastCursorRow||f!==this._lastCursorCol,g=b=>{b>0?s+=`\x1B[${b}C`:b<0&&(s+=`\x1B[${-b}D`)};m&&((b=>{b>0?s+=`\x1B[${b}B`:b<0&&(s+=`\x1B[${-b}A`)})(u-this._lastCursorRow),g(f-this._lastCursorCol))}let o=this._terminal._core._inputHandler._curAttrData,c=this._diffStyle(o,this._cursorStyle);return c.length>0&&(s+=`\x1B[${c.join(";")}m`),s}},dA=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,r,s){let o=r.length,c=s===void 0?o:fm(s+t.rows,0,o);return this._serializeBufferByRange(t,r,{start:o-c,end:o-1},!1)}_serializeBufferByRange(t,r,s,o){return new uA(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}},o)}_serializeBufferAsHTML(t,r){let s=t.buffer.active,o=new hA(s,t,r),c=r.onlySelection??!1,u=r.range;if(u)return o.serialize({start:{x:u.startCol,y:(u.startLine,u.startLine)},end:{x:t.cols,y:(u.endLine,u.endLine)}});if(!c){let m=s.length,g=r.scrollback,b=g===void 0?m:fm(g+t.rows,0,m);return o.serialize({start:{x:0,y:m-b},end:{x:t.cols,y:m-1}})}let f=this._terminal?.getSelectionPosition();return f!==void 0?o.serialize({start:{x:f.start.x,y:f.start.y},end:{x:f.end.x,y:f.end.y}}):""}_serializeScrollRegion(t){let r=t._core.buffer,s=r.scrollTop,o=r.scrollBottom;return s!==0||o!==t.rows-1?`\x1B[${s+1};${o+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(){}},hA=class extends H5{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=lA}_beforeSerialize(t,r,s){this._htmlContent+="<html><body><!--StartFragment--><pre>";let o="#000000",c="#ffffff";(this._options.includeGlobalBackground??!1)&&(o=this._terminal.options.theme?.foreground??"#ffffff",c=this._terminal.options.theme?.background??"#000000");let u=[];u.push("color: "+o+";"),u.push("background-color: "+c+";"),u.push("font-family: "+this._terminal.options.fontFamily+";"),u.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+u.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(o=>o.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(W5(t,r))return;let o=!fp(t,r),c=!La(t,r),u=!pp(t,r);if(o||c||u){let f=this._getHexColor(t,!0);f&&s.push("color: "+f+";");let m=this._getHexColor(t,!1);m&&s.push("background-color: "+m+";"),t.isInverse()&&s.push("color: #000000; background-color: #BFBFBF;"),t.isBold()&&s.push("font-weight: bold;");let g=[];if(t.isUnderline()&&g.push(this._getUnderlineStyle(t)),t.isOverline()&&g.push("overline"),t.isStrikethrough()&&g.push("line-through"),t.isBlink()&&g.push("blink"),g.length>0&&s.push("text-decoration: "+g.join(" ")+";"),t.isUnderline()){let b=this._getUnderlineColor(t);b&&s.push("text-decoration-color: "+b+";")}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,o){if(t.getWidth()===0)return;let c=t.getChars()==="",u=this._diffStyle(t,r);u&&(this._currentRow+=u.length===0?"</span><span>":"</span><span style='"+u.join(" ")+"'>"),c?this._currentRow+=" ":this._currentRow+=cA(t.getChars())}_serializeString(){return this._htmlContent}};var fA=class{constructor(e=new pA,t=new V5){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 u=this._provider.readText(r);return u instanceof Promise?u.then(f=>(this._readText(r,f),!0)):(this._readText(r,u),!0)}let o="";try{o=this._base64.decodeText(s)}catch{}let c=this._provider.writeText(r,o);return c instanceof Promise?c.then(()=>!0):!0}},V5=class{readText(e){return navigator.clipboard.readText()}writeText(e,t){return navigator.clipboard.writeText(t)}},pA=class{encodeText(t){let r=new TextEncoder().encode(t);if(r.toBase64!==void 0)return r.toBase64();let s="";for(let o=0;o<r.length;o++)s+=String.fromCharCode(r[o]);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 o=0;o<r.length;++o)s[o]=r.charCodeAt(o);return new TextDecoder().decode(s)}catch{}return""}};var mA=Object.create,q5=Object.defineProperty,gA=Object.getOwnPropertyDescriptor,xA=Object.getOwnPropertyNames,bA=Object.getPrototypeOf,yA=Object.prototype.hasOwnProperty,U0=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},vA=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of xA(t))!yA.call(e,o)&&o!==r&&q5(e,o,{get:()=>t[o],enumerable:!(s=gA(t,o))||s.enumerable});return e},$0=(e,t,r)=>(r=e!=null?mA(bA(e)):{},vA(!e||!e.__esModule?q5(r,"default",{value:e,enumerable:!0}):r,e)),mp=U0(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 o(w){return w>>>24&255}e.alpha=o;function c(w,I,k,N=255){return((N&255)<<24|(k&255)<<16|(I&255)<<8|w&255)>>>0}e.toRGBA8888=c;function u(w){return[w&255,w>>8&255,w>>16&255,w>>>24]}e.fromRGBA8888=u;function f(w,I){let k=t(w),N=r(w),R=s(w),Q=Number.MAX_SAFE_INTEGER,F=-1;for(let q=0;q<I.length;++q){let P=k-I[q][0],Z=N-I[q][1],V=R-I[q][2],fe=P*P+Z*Z+V*V;if(!fe)return q;fe<Q&&(Q=fe,F=q)}return F}e.nearestColorIndex=f;function m(w,I,k){return Math.max(w,Math.min(k,I))}function g(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 b(w,I,k){if(!k){let Q=Math.round(I*255);return c(Q,Q,Q)}let N=I<.5?I*(1+k):I+k-I*k,R=2*I-N;return c(m(0,255,Math.round(g(N,R,w+1/3)*255)),m(0,255,Math.round(g(N,R,w)*255)),m(0,255,Math.round(g(N,R,w-1/3)*255)))}function x(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=x;function v(w,I,k){return b((w+240%360)/360,I/100,k/100)}e.normalizeHLS=v,e.PALETTE_VT340_COLOR=new Uint32Array([x(0,0,0),x(20,20,80),x(80,13,13),x(20,80,20),x(80,20,80),x(20,80,80),x(80,80,20),x(53,53,53),x(26,26,26),x(33,33,60),x(60,26,26),x(33,60,33),x(60,33,60),x(33,60,60),x(60,60,33),x(80,80,80)]),e.PALETTE_VT340_GREY=new Uint32Array([x(0,0,0),x(13,13,13),x(26,26,26),x(40,40,40),x(6,6,6),x(20,20,20),x(33,33,33),x(46,46,46),x(0,0,0),x(13,13,13),x(26,26,26),x(40,40,40),x(6,6,6),x(20,20,20),x(33,33,33),x(46,46,46)]),e.PALETTE_ANSI_256=(()=>{let w=[c(0,0,0),c(205,0,0),c(0,205,0),c(205,205,0),c(0,0,238),c(205,0,205),c(0,250,205),c(229,229,229),c(127,127,127),c(255,0,0),c(0,255,0),c(255,255,0),c(92,92,255),c(255,0,255),c(0,255,255),c(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(c(I[k],I[N],I[R]));for(let k=8;k<=238;k+=10)w.push(c(k,k,k));return new Uint32Array(w)})(),e.DEFAULT_BACKGROUND=c(0,0,0,255),e.DEFAULT_FOREGROUND=c(255,255,255,255)}),Z5=U0(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 o=atob(s),c=new Uint8Array(o.length);for(let u=0;u<c.length;++u)c[u]=o.charCodeAt(u);return c};function r(s){if(s.d){let{t:o,s:c,d:u}=s,f,m,g=WebAssembly;return o===0?c?b=>new g.Instance(m||(m=new g.Module(f||(f=t(u)))),b):b=>m?g.instantiate(m,b):g.instantiate(f||(f=t(u)),b).then(x=>(m=x.module)&&x.instance):o===1?c?()=>m||(m=new g.Module(f||(f=t(u)))):()=>m?Promise.resolve(m):g.compile(f||(f=t(u))).then(b=>m=b):c?()=>f||(f=t(u)):()=>Promise.resolve(f||(f=t(u)))}if(typeof _wasmCtx>"u")throw new Error('must run "inwasm"');_wasmCtx.add(s)}}),Y5=U0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=Z5(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABBQFgAAF/Ag8BA2VudgZtZW1vcnkCAAEDAwIAAAcNAgNkZWMAAANlbmQAAQqLBgKZBAEKf0GIKCgCAEGgKGohAUGEKCgCACIDQaAoaiEAQYAoKAIAQQFrQXxxIgRBoChqIQUgBEEQayADSgRAIARBkChqIQMDQCABIABBA2otAABBAnQoAoAgIABBAmotAABBAnQoAoAYIABBAWotAABBAnQoAoAQIAAtAABBAnQoAoAIcnJyIgY2AgAgAUEDaiAAQQdqLQAAQQJ0KAKAICAAQQZqLQAAQQJ0KAKAGCAAQQVqLQAAQQJ0KAKAECAAQQRqLQAAQQJ0KAKACHJyciIHNgIAIAFBBmogAEELai0AAEECdCgCgCAgAEEKai0AAEECdCgCgBggAEEJai0AAEECdCgCgBAgAEEIai0AAEECdCgCgAhycnIiCDYCACABQQlqIABBD2otAABBAnQoAoAgIABBDmotAABBAnQoAoAYIABBDWotAABBAnQoAoAQIABBDGotAABBAnQoAoAIcnJyIgk2AgAgAiAGciAHciAIciAJciECIAFBDGohASAAQRBqIgAgA0kNAAsLIAAgBUkEQANAIAEgAEEDai0AAEECdCgCgCAgAEECai0AAEECdCgCgBggAEEBai0AAEECdCgCgBAgAC0AAEECdCgCgAhycnIiAzYCACACIANyIQIgAUEDaiEBIABBBGoiACAFSQ0ACwtBfyEAIAJB////B00Ef0GEKCAENgIAQYgoIAFBoChrNgIAQQAFQX8LC+0BAQR/AkBBgCgoAgAiAUGEKCgCACIAa0EFTgRAQX8hAxAADQFBgCgoAgAhAUGEKCgCACEAC0F/IQMgASAAayIBQQJIDQAgAC0AoShBAnQoAoAQIAAtAKAoQQJ0KAKACHIhAgJ/IAFBBEYEQEEDQQQgAC0AoyhBPUYbIAAtAKIoQT1GayEBC0EBIAFBA0kNABogAC0AoihBAnQoAoAYIAJyIQJBAiABQQRHDQAaIAAtAKMoQQJ0KAKAICACciECQQMLIQEgAkH///8HSw0AQQAhA0GIKCgCACIAIAI2AKAoQYgoIAAgAWo2AgALIAML"}),s=new Uint8Array("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").map(f=>f.charCodeAt(0))),o=new Uint32Array(1024);o.fill(4278190080);for(let f=0;f<s.length;++f)o[s[f]]=f<<2;for(let f=0;f<s.length;++f)o[256+s[f]]=f>>4|(f<<4&255)<<8;for(let f=0;f<s.length;++f)o[512+s[f]]=f>>2<<8|(f<<6&255)<<16;for(let f=0;f<s.length;++f)o[768+s[f]]=f<<16;var c=new Uint8Array(0),u=class{constructor(f,m,g){if(this._inst=null,this._ended=!0,this._bytes=0,this.keepSize=f??1048576,this.maxBytes=m??4294901760,this._bytes=g??32768,this._bytes>this.maxBytes||this.maxBytes>4294901760)throw new Error("invalid byte settings")}get data8(){return this._inst?this._d.subarray(0,this._m32[1282]):c}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(f,m){if(this.maxBytes=f??this.maxBytes,this._bytes=m??Math.min(this._bytes,this.maxBytes),this._bytes>this.maxBytes||this.maxBytes>4294901760)throw Error("invalid byte settings");let g=this._m32,b=this._bytes+5152;this._inst?this._mem.buffer.byteLength<b&&(this._mem.grow(Math.ceil((b-this._mem.buffer.byteLength)/65536)),g=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)):(this._mem=new WebAssembly.Memory({initial:Math.ceil(b/65536)}),this._inst=r({env:{memory:this._mem}}),g=new Uint32Array(this._mem.buffer,0),g.set(o,256),this._d=new Uint8Array(this._mem.buffer,5152)),g[1280]=0,g[1281]=0,g[1282]=0,this._m32=g,this._ended=!1}_realloc(f){let m=this._m32[1280]+f;if(this._bytes<m){if(m>this.maxBytes)return-3;let g=this._bytes;for(;(g*=2)<m;);if(g=Math.min(g,this.maxBytes),g<m)return-3;if(g+5152>this._mem.buffer.byteLength){let b=Math.ceil((g+5152-this._mem.buffer.byteLength)/65536);this._mem.grow(b),this._m32=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)}this._bytes=g}return 0}put(f){if(!this._inst||this._ended)return-2;if(this._realloc(f.length))return-3;let m=this._m32;return this._d.set(f,m[1280]),m[1280]+=f.length,m[1280]-m[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=u}),wA=U0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=Z5(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABCgJgAABgA39/fwACDwEDZW52Bm1lbW9yeQIAAQMDAgABBwcBA2RlYwABCAEACu4EAgwAQQBBAEGAAvwLAAveBAEJf0EAQQBBgAL8CwAgAUEXTgRAIAAgAWpBCGshCkGACCEBIAJBAnRBgAhqIQsgAEEOaiEDQf8BIQZBACECA0AgA0EBaiEHIAMtAAAiCEE/cSEAAkACQCAIQcABcSIJRQRAIABBAnQiAC0AAyEGIAAtAAIhBCAALQABIQUgAC0AACECIAchAwwBCwJAIAhB/QFLDQAgCUHAAUcNACAFQQVsIAJBA2xqIARBB2xqIAZBC2xqQT9xQQJ0IgMgBDoAAiADIAU6AAEgAyACOgAAIANBA2ogBjoAAANAIAEgAjoAACABQQNqIAY6AAAgAUECaiAEOgAAIAFBAWogBToAACABQQRqIQEgAEUEQCAHIQMMBAsgAEEBayEAIAEgC0kNAAsgByEDDAILAn8CQAJAAkAgCEH+AWsOAgABAgsgAy0AAyEEIAMtAAIhBSADLQABIQIgA0EEagwCCyADKAIBIgJBGHYhBiACQRB2IQQgAkEIdiEFIANBBWoMAQsgCUGAAUcEQCAHIAlBwABHDQEaIAQgCEEDcWpBAmshBCACIABBBHZqQQJrIQIgBSAIQQJ2QQNxakECayEFIAcMAQsgBCAAQShrIgkgAy0AASIHQQ9xamohBCACIAdBBHYgCWpqIQIgACAFakEgayEFIANBAmoLIQMgBUEFbCACQQNsaiAEQQdsaiAGQQtsakE/cUECdCIAIAQ6AAIgACAFOgABIAAgAjoAACAAQQNqIAY6AAALIAEgBjoAAyABIAQ6AAIgASAFOgABIAEgAjoAACABQQRqIQELIAMgCkkNAAsLCw=="}),s=class{constructor(o){this.keepSize=o,this.width=0,this.height=0}decode(o){this.width=o[4]<<24|o[5]<<16|o[6]<<8|o[7],this.height=o[8]<<24|o[9]<<16|o[10]<<8|o[11];let c=this.width*this.height,u=c*4,f=o.length,m=Math.max(u,f)+(Math.min(u,f)>>1)+4096;this._inst?this._mem.buffer.byteLength<m&&(this._mem.grow(Math.ceil((m-this._mem.buffer.byteLength)/65536)),this._d=null):(this._mem=new WebAssembly.Memory({initial:Math.ceil(m/65536)}),this._inst=r({env:{memory:this._mem}})),this._d||(this._d=new Uint8Array(this._mem.buffer));let g=this._mem.buffer.byteLength-f&-256;return this._d.set(o,g),this._inst.exports.dec(g,f,c),this._d.subarray(1024,1024+u)}release(){this._inst&&this._mem.buffer.byteLength>this.keepSize&&(this._inst=this._d=this._mem=null)}};e.default=s}),AA=U0(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"}}),TA=U0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;var t=mp(),r=AA();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 o=s(r.LIMITS.BYTES),c,u=new Uint32Array,f=class{constructor(){this.bandHandler=w=>1,this.modeHandler=w=>1}handle_band(w){return this.bandHandler(w)}mode_parsed(w){return this.modeHandler(w)}},m={memoryLimit:2048*65536,sixelColor:t.DEFAULT_FOREGROUND,fillColor:t.DEFAULT_BACKGROUND,palette:t.PALETTE_VT340_COLOR,paletteLimit:r.LIMITS.PALETTE_SIZE,truncate:!0};function g(w){let I=new f,k={env:{handle_band:I.handle_band.bind(I),mode_parsed:I.mode_parsed.bind(I)}};return WebAssembly.instantiate(c||o,k).then(N=>(c=c||N.module,new b(w,N.instance||N,I)))}e.DecoderAsync=g;var b=class{constructor(w,I,k){if(this._PIXEL_OFFSET=r.LIMITS.MAX_WIDTH+4,this._canvas=u,this._bandWidths=[],this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0,this._opts=Object.assign({},m,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=c||(c=new WebAssembly.Module(o));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 Q=0,F=N;Q<R;++Q,++F)this._chunk[Q]=w.charCodeAt(F);N+=R,this._wasm.decode(0,R)}}get data32(){if(this._mode===0||!this.width||!this.height)return u;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 Q=this._PIXEL_OFFSET,F=this._lastOffset;this._realloc(F,w*6);for(let q=0;q<6;++q)this._canvas.set(this._pSrc.subarray(Q*q,Q*q+w),F+w*q)}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 Q=this._bandWidths[R];for(let F=0;F<6;++F)I.set(this._canvas.subarray(N,N+=Q),k),k+=this.width}if(w){let R=this._PIXEL_OFFSET,Q=this._wasm.current_height();for(let F=0;F<Q;++F)I.set(this._pSrc.subarray(R*F,R*F+w),k+this.width*F)}return I}return u}get data8(){return new Uint8ClampedArray(this.data32.buffer,0,this.width*this.height*4)}release(){this._canvas=u,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=b;function x(w,I){let k=new b(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=x;async function v(w,I){let k=await g(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 If(e){return{dispose:e}}var K5=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()}},X5=class{constructor(){this._store=new K5}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};X5.None=Object.freeze({dispose(){}});var CA=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}},_A=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return If(()=>{});let s={fn:e,thisArgs:t};this._listeners.push(s);let o=If(()=>{let c=this._listeners.indexOf(s);c!==-1&&this._listeners.splice(c,1)});return r&&(Array.isArray(r)?r.push(o):r.add(o)),o},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)}},SA;(e=>{function t(c,u){return c(f=>u.fire(f))}e.forward=t;function r(c,u){return(f,m,g)=>c(b=>f.call(m,u(b)),void 0,g)}e.map=r;function s(...c){return(u,f,m)=>{let g=new K5;for(let b of c)g.add(b(x=>u.call(f,x)));return m&&(Array.isArray(m)?m.push(g):m.add(g)),g}}e.any=s;function o(c,u,f){return u(f),c(m=>u(m))}e.runAndSubscribe=o})(SA||={});var pm=$0(mp()),Q0=class ml extends X5{constructor(t){super(),this._terminal=t,this._layers=new Map,this._optionsRefresh=this._register(new CA),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(If(()=>{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 o=(t??document).createElement("canvas");return o.width=r|0,o.height=s|0,o}static createImageData(t,r,s,o){if(typeof ImageData!="function"){let c=t.createImageData(r,s);return o&&c.data.set(new Uint8ClampedArray(o,0,r*s*4)),c}return o?new ImageData(new Uint8ClampedArray(o,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 o=t*(this.dimensions?.css.cell.height||0),c=this.dimensions?.css.canvas.width||0,u=(r+1-t)*(this.dimensions?.css.cell.height||0);(!s||s==="top")&&this._layers.get("top")?.clearRect(0,o,c,u),(!s||s==="bottom")&&this._layers.get("bottom")?.clearRect(0,o,c,u)}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,o,c=1){let u=this._layers.get(t.layer);if(!u)return;let{width:f,height:m}=this.cellSize;if(f===-1||m===-1)return;this._rescaleImage(t,f,m);let g=t.actual,b=Math.ceil(g.width/f),x=r%b*f,v=Math.floor(r/b)*m,w=s*f,I=o*m,k=c*f+x>g.width?g.width-x:c*f,N=v+m>g.height?g.height-v:m;u.drawImage(g,Math.floor(x),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:o}=this.cellSize;if(s===-1||o===-1)return;this._rescaleImage(t,s,o);let c=t.actual,u=Math.ceil(c.width/s),f=r%u*s,m=Math.floor(r/u)*o,g=s+f>c.width?c.width-f:s,b=m+o>c.height?c.height-m:o,x=ml.createCanvas(this.document,g,b),v=x.getContext("2d");if(v)return v.drawImage(c,Math.floor(f),Math.floor(m),Math.floor(g),Math.floor(b),0,0,Math.floor(g),Math.floor(b)),x}drawPlaceholder(t,r,s=1){let o=this._layers.get("top");if(o){let{width:c,height:u}=this.cellSize;if(c===-1||u===-1||(this._placeholder?u>=this._placeholder.height&&this._createPlaceHolder(u+1):this._createPlaceHolder(Math.max(u+1,24)),!this._placeholder))return;o.drawImage(this._placeholderBitmap??this._placeholder,t*c,r*u%2?0:1,c*s,u,t*c,r*u,c*s,u)}}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:o,height:c}=t.origCellSize;if(r===o&&s===c){t.actual=t.orig,t.actualCellSize.width=o,t.actualCellSize.height=c;return}let u=ml.createCanvas(this.document,Math.ceil(t.orig.width*r/o),Math.ceil(t.orig.height*s/c)),f=u.getContext("2d");f&&(f.drawImage(t.orig,0,0,u.width,u.height),t.actual=u,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=ml.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 o=r.getContext("2d",{alpha:!0});if(!o){r.remove();return}this._layers.set(t,o),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=ml.createCanvas(this.document,r,t),o=s.getContext("2d",{alpha:!1});if(!o)return;let c=ml.createImageData(o,r,t),u=new Uint32Array(c.data.buffer),f=(0,pm.toRGBA8888)(0,0,0),m=(0,pm.toRGBA8888)(255,255,255);u.fill(f);for(let x=0;x<t;++x){let v=x%2,w=x*r;for(let I=0;I<r;I+=2)u[w+I+v]=m}o.putImageData(c,0,0);let g=screen.width+r-1&-32||4096;this._placeholder=ml.createCanvas(this.document,g,t);let b=this._placeholder.getContext("2d",{alpha:!1});if(!b){this._placeholder=void 0;return}for(let x=0;x<g;x+=r)b.drawImage(s,x,0);ml.createImageBitmap(this._placeholder).then(x=>this._placeholderBitmap=x)}get document(){return this._terminal._core._coreBrowserService?.window.document}},Wa={width:7,height:14},kf=class J5{constructor(t=0,r=0,s=-1,o=-1){this.imageId=s,this.tileId=o,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 J5(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0&&this.imageId===-1}},_u=new kf,LA=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=Wa);let s=Math.ceil(e.width/r.width),o=Math.ceil(e.height/r.height),c=++this._lastId,u=this._terminal._core.buffer,f=this._terminal.cols,m=this._terminal.rows,g=u.x,b=u.y,x=g,v=0;t.scrolling||(u.x=0,u.y=0,x=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(u.y);for(let N=0;N<o;++N){let R=u.lines.get(u.y+u.ybase);for(let Q=0;Q<s&&!(x+Q>=f);++Q)this._writeToCell(R,x+Q,c,N*s+Q),v++;if(t.scrolling)N<o-1&&this._terminal._core._inputHandler.lineFeed();else if(++u.y>=m)break;u.x=x}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(u.y),t.scrolling?t.cursorPos==="iip"?u.x=Math.min(x+s,f):u.x=x:(u.x=g,u.y=b);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(c)&&this._delImg(c)}),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(c,k),this.onImageAdded?.(),c}render(e){let t=!1,r=!1;for(let g of this._images.values())if(g.layer==="bottom"?r=!0:t=!0,t&&r)break;if(t&&!this._renderer.hasLayer("top")&&(this._renderer.insertLayerToDom("top"),!this._renderer.hasLayer("top")))return;if(r&&!this._renderer.hasLayer("bottom")&&this._renderer.insertLayerToDom("bottom"),this._renderer.rescaleCanvas(),!this._images.size){this._fullyCleared||(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1),this._renderer.hasLayer("top")&&this._renderer.removeLayerFromDom("top"),this._renderer.hasLayer("bottom")&&this._renderer.removeLayerFromDom("bottom");return}!t&&this._renderer.hasLayer("top")&&(this._renderer.clearAll("top"),this._renderer.removeLayerFromDom("top")),!r&&this._renderer.hasLayer("bottom")&&(this._renderer.clearAll("bottom"),this._renderer.removeLayerFromDom("bottom")),this._needsFullClear&&(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1);let{start:s,end:o}=e,c=this._terminal._core.buffer,u=this._terminal._core.cols;this._renderer.clearLines(s,o);let f=[],m=[];for(let g=s;g<=o;++g){let b=c.lines.get(g+c.ydisp);if(!b)return;for(let x=0;x<u;++x){let v;if(b.getBg(x)&268435456)v=b._extendedAttrs[x]??_u;else{let k=b._extendedAttrs[x];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=x,R=1;for(;++x<u;){let Q=b._extendedAttrs[x];if(!Q||Q.imageId!==w||Q.tileId!==k+R)break;R++}x--,I?I.actual&&f.push({imgSpec:I,tileId:k,col:N,row:g,count:R}):this._opts.showPlaceholder&&m.push({col:N,row:g,count:R}),this._fullyCleared=!1}}}f.sort((g,b)=>g.imgSpec.zIndex-b.imgSpec.zIndex);for(let g of m)this._renderer.drawPlaceholder(g.col,g.row,g.count);for(let g of f)this._renderer.draw(g.imgSpec,g.tileId,g.col,g.row,g.count)}viewportResize(e){if(!this._images.size){this._viewportMetrics=e;return}if(this._viewportMetrics.cols>=e.cols){this._viewportMetrics=e;return}let t=this._terminal._core.buffer,r=t.lines.length,s=this._viewportMetrics.cols-1;for(let o=0;o<r;++o){let c=t.lines.get(o);if(c.getBg(s)&268435456){let u=c._extendedAttrs[s]??_u,f=u.imageId;if(f===void 0||f===-1)continue;let m=this._images.get(f);if(!m)continue;let g=Math.ceil((m.actual?.width||0)/m.actualCellSize.width);if(u.tileId%g+1>=g)continue;let b=!1;for(let w=s+1;w>e.cols;++w)if(c._data[w*3+0]&4194303){b=!0;break}if(b)continue;let x=Math.min(e.cols,g-u.tileId%g+s),v=u.tileId;for(let w=s+1;w<x;++w)this._writeToCell(c,w,f,++v),m.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]??_u;if(s.imageId&&s.imageId!==-1){let o=this._images.get(s.imageId)?.orig;if(window.ImageBitmap&&o instanceof ImageBitmap){let c=Q0.createCanvas(window.document,o.width,o.height);return c.getContext("2d")?.drawImage(o,0,0,o.width,o.height),c}return o}}}extractTileAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let s=r._extendedAttrs[e]??_u;if(s.imageId&&s.imageId!==-1&&s.tileId!==-1){let o=this._images.get(s.imageId);if(o)return this._renderer.extractTile(o,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 o=e._extendedAttrs[t];if(o){if(o.imageId!==void 0){let c=this._images.get(o.imageId);c&&c.tileCount--,o.imageId=r,o.tileId=s;return}e._extendedAttrs[t]=new kf(o.ext,o.urlId,r,s);return}}e._data[t*3+2]|=268435456,e._extendedAttrs[t]=new kf(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 o=0;o<this._terminal.cols;++o)if(s._data[o*3+2]&268435456){let c=s._extendedAttrs[o]?.imageId;if(c){let u=this._images.get(c);u&&u.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)}},IA=$0(Y5()),kA=$0(wA());function dd(e){let t="";for(let r=0;r<e.length;++r)t+=String.fromCharCode(e[r]);return t}function _h(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 mm(e){let t=dd(e);if(!t.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return t}function EA(e){if(typeof Buffer<"u")return Buffer.from(dd(e),"base64").toString();let t=atob(dd(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 gm={inline:_h,size:_h,name:EA,width:mm,height:mm,preserveAspectRatio:_h},xm=[70,105,108,101],bm=[77,117,108,116,105,112,97,114,116,70,105,108,101],Sh=[70,105,108,101,80,97,114,116],Lh=[70,105,108,101,69,110,100],Ih=[82,101,112,111,114,116,67,101,108,108,83,105,122,101],kh=1024,MA=class{constructor(){this.state=0,this._buffer=new Uint32Array(kh),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===Lh.length){for(let t=0;t<Lh.length;++t)if(this._buffer[t]!==Lh[t])return this._a();return this.fields.type=4,this.state=4,0}if(this._position===Ih.length){for(let t=0;t<Ih.length;++t)if(this._buffer[t]!==Ih[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 o=this.state,c=this._position,u=this._buffer;if(o===1||o===4||o===0&&c>14)return-1;for(let f=r;f<s;++f){let m=t[f];switch(m){case 59:if(!this._storeValue(c))return this._a();o=2,c=0;break;case 61:if(o===0){if(u[0]===70){let g=0;for(;g<xm.length;++g)if(u[g]!==xm[g])return this._a();if(this.fields.type=1,c===Sh.length){for(;g<Sh.length;++g)if(u[g]!==Sh[g])return this._a();return this.fields.type=3,this.state=4,f+1}}else if(u[0]===77){for(let g=0;g<bm.length;++g)if(u[g]!==bm[g])return this._a();this.fields.type=2}else return this._a();o=2,c=0}else if(o===2){if(!this._storeKey(c))return this._a();o=3,c=0}else if(o===3){if(c>=kh)return this._a();u[c++]=m}break;case 58:return o===3&&!this._storeValue(c)?this._a():(this.state=4,f+1);default:if(c>=kh)return this._a();u[c++]=m}}return this.state=o,this._position=c,-2}_a(){return this.fields.type=0,this.state=1,-1}_storeKey(t){let r=dd(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]=gm[this._key]?gm[this._key](r):r}catch{return!1}return!0}return!1}},hd={mime:"unsupported",width:0,height:0};function RA(e){if(e.length<24)return hd;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]=NA(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]}:hd}function NA(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 Eh={type:0,name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0},DA=class{constructor(e,t,r,s){this._opts=e,this._renderer=t,this._storage=r,this._coreTerminal=s,this._aborted=!1,this._hp=new MA,this._header=Eh,this._metrics=hd,this._isMultipart=!1,this._abortMulti=!1;let o=Math.ceil(this._opts.iipSizeLimit*4/3),c=Math.min(1048576,o);this._dec=new IA.default(4194304,o,c),this._qoiDec=new kA.default(4194304)}reset(){this._hp.reset(),this._dec.release(),this._qoiDec.release()}start(){this._aborted=!1,this._metrics=hd,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({},Eh,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 u=Wa.width,f=Wa.height;this._renderer.dimensions&&(u=this._renderer.dimensions.css.canvas.width/this._coreTerminal.cols,f=this._renderer.dimensions.css.canvas.height/this._coreTerminal.rows);let m=this._coreTerminal._core._coreBrowserService?.dpr??1,g=`\x1B]1337;ReportCellSize=${f.toFixed(3)};${u.toFixed(3)};${m.toFixed(3)}\x1B\\`;return this._coreTerminal.input(g,!1),!0}if(t===2)return this._header=Object.assign({},Eh,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,o;if((o=e)&&(o=!this._dec.end())&&(this._metrics=RA(this._dec.data8),(o=this._metrics.mime!=="unsupported")&&(r=this._metrics.width,s=this._metrics.height,(o=r&&s&&r*s<this._opts.pixelLimit)&&([r,s]=this._resize(r,s).map(Math.floor),o=r&&s&&r*s<this._opts.pixelLimit))),!o)return this._dec.release(),!0;let c;if(this._metrics.mime==="image/qoi"){let u=this._qoiDec.decode(this._dec.data8);if(c=new ImageData(new Uint8ClampedArray(u.buffer,u.byteOffset,u.byteLength),this._qoiDec.width,this._qoiDec.height),this._qoiDec.release(),r===this._qoiDec.width&&s===this._qoiDec.height){this._dec.release();let f=Q0.createCanvas(void 0,this._qoiDec.width,this._qoiDec.height);return f.getContext("2d")?.putImageData(c,0,0),this._storage.addImage(f),!0}}else c=new Blob([this._dec.data8],{type:this._metrics.mime});return this._dec.release(),createImageBitmap(c,{resizeWidth:r,resizeHeight:s}).then(u=>(this._storage.addImage(u),!0))}_resize(e,t){let r=this._renderer.dimensions?.css.cell.width||Wa.width,s=this._renderer.dimensions?.css.cell.height||Wa.height,o=this._renderer.dimensions?.css.canvas.width||r*this._coreTerminal.cols,c=this._renderer.dimensions?.css.canvas.height||s*this._coreTerminal.rows,u=this._dim(this._header.width,o,r),f=this._dim(this._header.height,c,s);if(!u&&!f){let m=o/e,g=(c-s)/t,b=Math.min(m,g);return b<1?[e*b,t*b]:[e,t]}return u?this._header.preserveAspectRatio||!u||!f?[u,t*u/e]:[u,f]:[e*f/t,f]}_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}},QA=$0(Y5());function ym(e){let t={},r=e.split(",");for(let s of r){let o=s.indexOf("=");if(o===-1)continue;let c=s.substring(0,o),u=s.substring(o+1);if(c==="a"){t.action=u;continue}if(c==="o"){t.compression=u;continue}if(c==="t"){t.transmission=u;continue}if(c==="d"){t.deleteSelector=u;continue}let f=parseInt(u,10);switch(c){case"f":t.format=f;break;case"i":t.id=f;break;case"I":t.imageNumber=f;break;case"s":t.width=f;break;case"v":t.height=f;break;case"x":t.x=f;break;case"y":t.y=f;break;case"w":t.sourceWidth=f;break;case"h":t.sourceHeight=f;break;case"X":t.xOffset=f;break;case"Y":t.yOffset=f;break;case"c":t.columns=f;break;case"r":t.rows=f;break;case"m":t.more=f;break;case"q":t.quiet=f;break;case"C":t.cursorMovement=f;break;case"z":t.zIndex=f;break;case"p":t.placementId=f;break}}return t}var vm=0,BA=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 c=t;c<r;c++)if(e[c]===59){this._inControlData=!1,s=c;break}let o=s-t;if(this._controlLength+o>512){this._aborted=!0;return}if(this._controlData.set(e.subarray(t,s),this._controlLength),this._controlLength+=o,!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 c=s+1;c<r&&this._streamPayload(e,c,r)}}}_streamPayload(e,t,r){if(this._aborted)return;let s=this._parsedCommand?.id??this._lastPendingKey??0,o=this._pendingTransmissions.get(s),c=o?.totalEncodedSize??0;if(this._totalEncodedSize+=r-t,c+this._totalEncodedSize>this._encodedSizeLimit){let u=this._activeDecoder??o?.decoder;u&&u.release(),this._activeDecoder=null,o&&this._removePendingEntry(s),this._aborted=!0;return}this._decodeError||(o?.decoder&&!this._activeDecoder&&(this._activeDecoder=o.decoder),this._activeDecoder||(this._activeDecoder=new QA.default(4194304,this._maxEncodedBytes,this._initialEncodedBytes),this._activeDecoder.init()),this._activeDecoder.put(e.subarray(t,r))!==vm&&(this._activeDecoder.release(),this._activeDecoder=null,this._decodeError=!0,o&&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,o=this._pendingTransmissions.get(r);if(s)return this._activeDecoder&&(o?(o.totalEncodedSize+=this._totalEncodedSize,o.decodeError=o.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;o&&(this._lastPendingKey=void 0);let c=this._decodeError,u=t,f=this._activeDecoder;o&&(u=o.cmd,f=o.decoder,c=c||o.decodeError,this._pendingTransmissions.delete(r));let m=new Uint8Array(0);f&&(f.end()!==vm&&(c=!0),m=f.data8),this._activeDecoder=null;let g=this._handleCommandWithBytesAndCmd(u,m,c);return f&&f.release(),g}_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,o=this._kittyStorage.getImage(s);if(o){let c=this._displayImage(o,e);return e.id!==void 0?c.then(u=>(this._sendResponse(s,u?"OK":"EINVAL:image rendering failed",e.quiet??0),!0)):c.then(()=>!0)}return!0}_handleQuery(e,t,r){let s=e.id??0,o=e.quiet??0;if((e.transmission??"d")!=="d")return this._sendResponse(s,"EINVAL:unsupported transmission medium",o),!0;if(r)return this._sendResponse(s,"EINVAL:invalid base64 data",o),!0;if(t.length===0)return this._sendResponse(s,"OK",o),!0;let c=e.format??32;if(c===100)this._sendResponse(s,"OK",o);else{let u=e.width??0,f=e.height??0;if(!u||!f)return this._sendResponse(s,"EINVAL:width and height required for raw pixel data",o),!0;let m=c===32?4:3,g=u*f*m;if(t.length<g)return this._sendResponse(s,"EINVAL:insufficient pixel data",o),!0;this._sendResponse(s,"OK",o)}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 o=t==="OK";if(o&&r>=1||!o&&r>=2)return;let c=s?`,p=${s}`:"",u=`\x1B_Gi=${e}${c};${t}\x1B\\`;this._coreTerminal._core.coreService.triggerDataEvent(u)}_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),o=Math.max(0,t.y??0),c=t.sourceWidth||r.width-s,u=t.sourceHeight||r.height-o,f=Math.max(0,r.width-s),m=Math.max(0,r.height-o),g=Math.max(0,Math.min(c,f)),b=Math.max(0,Math.min(u,m));if(g===0||b===0)throw new Error("invalid source rectangle");if(s!==0||o!==0||g!==r.width||b!==r.height){let _e=await createImageBitmap(r,s,o,g,b);r.close(),r=_e}let x=this._renderer.dimensions?.css.cell.width||Wa.width,v=this._renderer.dimensions?.css.cell.height||Wa.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*x)/v))):t.rows!==void 0?(I=t.rows,w=Math.max(1,Math.ceil(r.width/r.height*(I*v)/x))):(w=Math.ceil(r.width/x),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*x),N=Math.round(I*v)),k*N>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");let R=this._coreTerminal._core.buffer,Q=R.x,F=R.y,q=R.ybase,P=t.zIndex!==void 0&&t.zIndex<0?"bottom":"top";if(k!==r.width||N!==r.height){let _e=await createImageBitmap(r,{resizeWidth:k,resizeHeight:N});r.close(),r=_e}let Z=Math.min(Math.max(0,t.xOffset??0),x-1),V=Math.min(Math.max(0,t.yOffset??0),v-1);if(Z!==0||V!==0){let _e=t.columns!==void 0?Math.round(w*x):r.width+Z,De=t.rows!==void 0?Math.round(I*v):r.height+V,be=Q0.createCanvas(window.document,_e,De),st=be.getContext("2d");if(!st)throw new Error("Failed to create offset canvas context");st.drawImage(r,Z,V);let Ue=await createImageBitmap(be);if(be.width=be.height=0,r.close(),r=Ue,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/x)),t.rows===void 0&&(I=Math.ceil(r.height/v))}let fe=t.zIndex??0;if(this._kittyStorage.addImage(e.id,r,!0,P,fe),r=void 0,t.cursorMovement===1){let _e=R.ybase-q;R.x=Q,R.y=Math.max(F-_e,0)}else R.x=Math.min(Q+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((Q,F)=>{R.addEventListener("load",()=>{URL.revokeObjectURL(N);let q=Q0.createCanvas(window.document,R.width,R.height);q.getContext("2d")?.drawImage(R,0,0),createImageBitmap(q).then(Q).catch(F)}),R.addEventListener("error",()=>{URL.revokeObjectURL(N),F(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 o=e.format===32?4:3,c=r*s*o;if(t.length<c)throw new Error("Insufficient pixel data");let u=r*s;if(e.format===32)return createImageBitmap(new ImageData(new Uint8ClampedArray(t.buffer,t.byteOffset,u*4),r,s));let f=new Uint8ClampedArray(u*4),m=new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),g=new Uint32Array(f.buffer),b=u&-4,x=0,v=0;for(let k=0;k<b;k+=4){let N=m[x++],R=m[x++],Q=m[x++];g[v++]=4278190080|N,g[v++]=4278190080|N>>>24|R<<8,g[v++]=4278190080|R>>>16|Q<<16,g[v++]=4278190080|Q>>>8}let w=b*3,I=b*4;for(let k=b;k<u;k++)f[I]=t[w],f[I+1]=t[w+1],f[I+2]=t[w+2],f[I+3]=255,w+=3,I+=4;return createImageBitmap(new ImageData(f,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 o=[],c=r.readable.getReader();for(;;){let{done:g,value:b}=await c.read();if(g)break;o.push(b)}let u=o.reduce((g,b)=>g+b.length,0),f=new Uint8Array(u),m=0;for(let g of o)f.set(g,m),m+=g.length;return f}get images(){return this._kittyStorage.images}get _kittyIdToStorageId(){return this._kittyStorage.kittyIdToStorageId}get pendingTransmissions(){return this._pendingTransmissions}},ex=class Ef{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++,o=this._kittyIdToStorageId.get(s);return o!==void 0&&(this._storage.deleteImage(o),this._kittyIdToStorageId.delete(s),this._storageIdToKittyId.delete(o)),!this._images.has(s)&&this._images.size>=Ef._maxStoredImages&&this._evictUndisplayedImages(),this._images.set(s,{...r,id:s}),s}addImage(t,r,s,o,c){let u=this._kittyIdToStorageId.get(t);u!==void 0&&this._storageIdToKittyId.delete(u),this._addImageOpts.scrolling=s,this._addImageOpts.layer=o,this._addImageOpts.zIndex=c;let f=this._storage.addImage(r,this._addImageOpts);this._kittyIdToStorageId.set(t,f),this._storageIdToKittyId.set(f,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<=Ef._maxStoredImages/2)break;this._kittyIdToStorageId.has(t)||this._images.delete(t)}}};ex._maxStoredImages=256;var jA=ex,Hc=$0(mp()),PA=$0(TA()),OA=4194304,Mf=Hc.PALETTE_ANSI_256;Mf.set(Hc.PALETTE_VT340_COLOR);var FA=class{constructor(e,t,r){this._opts=e,this._storage=t,this._coreTerminal=r,this._size=0,this._aborted=!1,(0,PA.DecoderAsync)({memoryLimit:this._opts.pixelLimit*4,palette:Mf,paletteLimit:this._opts.sixelPaletteLimit}).then(s=>this._dec=s)}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,Mf,this._opts.sixelPaletteLimit))}hook(e){if(this._size=0,this._aborted=!1,this._dec){let t=e.params[1]===1?0:UA(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=Q0.createCanvas(void 0,t,r);return s.getContext("2d")?.putImageData(new ImageData(this._dec.data8,t,r),0,0),this._dec.memoryUsage>OA&&this._dec.release(),this._storage.addImage(s),!0}};function UA(e,t){let r=0;if(!t)return r;if(e.isInverse())if(e.isFgDefault())r=Su(t.foreground.rgba);else if(e.isFgRGB()){let s=e.constructor.toColorRGB(e.getFgColor());r=(0,Hc.toRGBA8888)(...s)}else r=Su(t.ansi[e.getFgColor()].rgba);else if(e.isBgDefault())r=Su(t.background.rgba);else if(e.isBgRGB()){let s=e.constructor.toColorRGB(e.getBgColor());r=(0,Hc.toRGBA8888)(...s)}else r=Su(t.ansi[e.getBgColor()].rgba);return r}function Su(e){return Hc.BIG_ENDIAN?e:(e&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255}var $A=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=Wa);let r=Math.ceil(e/t.height);for(let s=1;s<r;++s)this._terminal._core._inputHandler.lineFeed()}}},zA=class{constructor(e){this._storage=e,this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"}}addImage(e){this._storage.addImage(e,this._addImageOpts)}},wm={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:4096,sixelSizeLimit:33554432,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:33554432,kittySupport:!0,kittySizeLimit:33554432},Am=4096,HA=class{constructor(t){this._disposables=[],this._handlers=new Map,this._onImageAdded=new _A,this.onImageAdded=this._onImageAdded.event,this._opts=Object.assign({},wm,t),this._defaultOpts=Object.assign({},wm,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 Q0(t),this._storage=new LA(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 $A(this._storage,this._opts,this._renderer,t),s=new FA(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 zA(this._storage),s=new DA(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 jA(this._storage),s=new BA(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]<=Am?(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;${Am}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 c=Wa;r=(this._terminal?.cols||80)*c.width,s=(this._terminal?.rows||24)*c.height}if(r*s<this._opts.pixelLimit)this._report(`\x1B[?${t[0]};0;${r.toFixed(0)};${s.toFixed(0)}S`);else{let c=Math.floor(Math.sqrt(this._opts.pixelLimit));this._report(`\x1B[?${t[0]};0;${c};${c}S`)}return!0;case 4:let o=Math.floor(Math.sqrt(this._opts.pixelLimit));return this._report(`\x1B[?${t[0]};0;${o};${o}S`),!0;default:return this._report(`\x1B[?${t[0]};2S`),!0}return this._report(`\x1B[?${t[0]};1S`),!0}};const d0=new Map;function T0(e){return{name:e,get hasSubscribers(){return(d0.get(e)?.size??0)>0},publish(t){const r=d0.get(e);if(r)for(const s of r)s(t,e)},subscribe(t){const r=d0.get(e)??new Set;r.add(t),d0.set(e,r)},unsubscribe(t){const r=d0.get(e);if(!r)return!1;const s=r.delete(t);return r.size===0&&d0.delete(e),s}}}function GA(e){const t={start:`${e}:start`,end:`${e}:end`,asyncStart:`${e}:asyncStart`,asyncEnd:`${e}:asyncEnd`,error:`${e}:error`},r={start:T0(t.start),end:T0(t.end),asyncStart:T0(t.asyncStart),asyncEnd:T0(t.asyncEnd),error:T0(t.error),traceSync(s,o,c,...u){r.start.publish(o);try{const f=s.apply(c,u);return r.end.publish(o),f}catch(f){throw r.error.publish(f),f}},async tracePromise(s,o,c,...u){r.asyncStart.publish(o);try{const f=await s.apply(c,u);return r.asyncEnd.publish(o),f}catch(f){throw r.error.publish(f),f}},traceCallback(s,o,c,u,...f){r.start.publish(c);try{const m=s.apply(u,f);return r.end.publish(c),m}catch(m){throw r.error.publish(m),m}}};return r}var WA=Object.create,gp=Object.defineProperty,VA=Object.getOwnPropertyDescriptor,qA=Object.getOwnPropertyNames,ZA=Object.getPrototypeOf,YA=Object.prototype.hasOwnProperty,tx=e=>{throw TypeError(e)},KA=(e,t,r)=>t in e?gp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,XA=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},JA=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of qA(t))!YA.call(e,o)&&o!==r&&gp(e,o,{get:()=>t[o],enumerable:!(s=VA(t,o))||s.enumerable});return e},eT=(e,t,r)=>(r=e!=null?WA(ZA(e)):{},JA(!e||!e.__esModule?gp(r,"default",{value:e,enumerable:!0}):r,e)),Ws=(e,t,r)=>KA(e,typeof t!="symbol"?t+"":t,r),xp=(e,t,r)=>t.has(e)||tx("Cannot "+r),G=(e,t,r)=>(xp(e,t,"read from private field"),r?r.call(e):t.get(e)),Zr=(e,t,r)=>t.has(e)?tx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),dr=(e,t,r,s)=>(xp(e,t,"write to private field"),t.set(e,r),r),Ct=(e,t,r)=>(xp(e,t,"access private method"),r),Mh=(e,t,r,s)=>({set _(o){dr(e,t,o)},get _(){return G(e,t,s)}}),tT=XA((e,t)=>{var r=(()=>{var s=Object.defineProperty,o=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,u=Object.prototype.hasOwnProperty,f=(n,i)=>{for(var l in i)s(n,l,{get:i[l],enumerable:!0})},m=(n,i,l,d)=>{if(i&&typeof i=="object"||typeof i=="function")for(let h of c(i))!u.call(n,h)&&h!==l&&s(n,h,{get:()=>i[h],enumerable:!(d=o(i,h))||d.enumerable});return n},g=n=>m(s({},"__esModule",{value:!0}),n),b={};f(b,{BoundingBox:()=>Xe,Font:()=>v1,Glyph:()=>sr,Path:()=>Je,_parse:()=>mt,load:()=>uy,loadSync:()=>dy,parse:()=>cy});var x=0,v=-3;function w(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function I(n,i){this.source=n,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=i,this.destLen=0,this.ltree=new w,this.dtree=new w}var k=new w,N=new w,R=new Uint8Array(30),Q=new Uint16Array(30),F=new Uint8Array(30),q=new Uint16Array(30),P=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Z=new w,V=new Uint8Array(320);function fe(n,i,l,d){var h,p;for(h=0;h<l;++h)n[h]=0;for(h=0;h<30-l;++h)n[h+l]=h/l|0;for(p=d,h=0;h<30;++h)i[h]=p,p+=1<<n[h]}function _e(n,i){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)i.table[l]=0;for(i.table[5]=32,l=0;l<32;++l)i.trans[l]=l}var De=new Uint16Array(16);function be(n,i,l,d){var h,p;for(h=0;h<16;++h)n.table[h]=0;for(h=0;h<d;++h)n.table[i[l+h]]++;for(n.table[0]=0,p=0,h=0;h<16;++h)De[h]=p,p+=n.table[h];for(h=0;h<d;++h)i[l+h]&&(n.trans[De[i[l+h]]++]=h)}function st(n){n.bitcount--||(n.tag=n.source[n.sourceIndex++],n.bitcount=7);var i=n.tag&1;return n.tag>>>=1,i}function Ue(n,i,l){if(!i)return l;for(;n.bitcount<24;)n.tag|=n.source[n.sourceIndex++]<<n.bitcount,n.bitcount+=8;var d=n.tag&65535>>>16-i;return n.tag>>>=i,n.bitcount-=i,d+l}function Ee(n,i){for(;n.bitcount<24;)n.tag|=n.source[n.sourceIndex++]<<n.bitcount,n.bitcount+=8;var l=0,d=0,h=0,p=n.tag;do d=2*d+(p&1),p>>>=1,++h,l+=i.table[h],d-=i.table[h];while(d>=0);return n.tag=p,n.bitcount-=h,i.trans[l+d]}function ht(n,i,l){var d,h,p,y,A,_;for(d=Ue(n,5,257),h=Ue(n,5,1),p=Ue(n,4,4),y=0;y<19;++y)V[y]=0;for(y=0;y<p;++y){var M=Ue(n,3,0);V[P[y]]=M}for(be(Z,V,0,19),A=0;A<d+h;){var E=Ee(n,Z);switch(E){case 16:var z=V[A-1];for(_=Ue(n,2,3);_;--_)V[A++]=z;break;case 17:for(_=Ue(n,3,3);_;--_)V[A++]=0;break;case 18:for(_=Ue(n,7,11);_;--_)V[A++]=0;break;default:V[A++]=E;break}}be(i,V,0,d),be(l,V,d,h)}function Ve(n,i,l){for(;;){var d=Ee(n,i);if(d===256)return x;if(d<256)n.dest[n.destLen++]=d;else{var h,p,y,A;for(d-=257,h=Ue(n,R[d],Q[d]),p=Ee(n,l),y=n.destLen-Ue(n,F[p],q[p]),A=y;A<y+h;++A)n.dest[n.destLen++]=n.dest[A]}}}function he(n){for(var i,l,d;n.bitcount>8;)n.sourceIndex--,n.bitcount-=8;if(i=n.source[n.sourceIndex+1],i=256*i+n.source[n.sourceIndex],l=n.source[n.sourceIndex+3],l=256*l+n.source[n.sourceIndex+2],i!==(~l&65535))return v;for(n.sourceIndex+=4,d=i;d;--d)n.dest[n.destLen++]=n.source[n.sourceIndex++];return n.bitcount=0,x}function Oe(n,i){var l=new I(n,i),d,h,p;do{switch(d=st(l),h=Ue(l,2,0),h){case 0:p=he(l);break;case 1:p=Ve(l,k,N);break;case 2:ht(l,l.ltree,l.dtree),p=Ve(l,l.ltree,l.dtree);break;default:p=v}if(p!==x)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}_e(k,N),fe(R,Q,4,3),fe(F,q,2,1),R[28]=0,Q[28]=258;function ie(n,i,l,d,h){return Math.pow(1-h,3)*n+3*Math.pow(1-h,2)*h*i+3*(1-h)*Math.pow(h,2)*l+Math.pow(h,3)*d}function Le(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}Le.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},Le.prototype.addPoint=function(n,i){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 i=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=i,this.y2=i),i<this.y1&&(this.y1=i),i>this.y2&&(this.y2=i))},Le.prototype.addX=function(n){this.addPoint(n,null)},Le.prototype.addY=function(n){this.addPoint(null,n)},Le.prototype.addBezier=function(n,i,l,d,h,p,y,A){let _=[n,i],M=[l,d],E=[h,p],z=[y,A];this.addPoint(n,i),this.addPoint(y,A);for(let U=0;U<=1;U++){let te=6*_[U]-12*M[U]+6*E[U],Y=-3*_[U]+9*M[U]-9*E[U]+3*z[U],ae=3*M[U]-3*_[U];if(Y===0){if(te===0)continue;let mr=-ae/te;0<mr&&mr<1&&(U===0&&this.addX(ie(_[U],M[U],E[U],z[U],mr)),U===1&&this.addY(ie(_[U],M[U],E[U],z[U],mr)));continue}let ze=Math.pow(te,2)-4*ae*Y;if(ze<0)continue;let Jt=(-te+Math.sqrt(ze))/(2*Y);0<Jt&&Jt<1&&(U===0&&this.addX(ie(_[U],M[U],E[U],z[U],Jt)),U===1&&this.addY(ie(_[U],M[U],E[U],z[U],Jt)));let Vt=(-te-Math.sqrt(ze))/(2*Y);0<Vt&&Vt<1&&(U===0&&this.addX(ie(_[U],M[U],E[U],z[U],Vt)),U===1&&this.addY(ie(_[U],M[U],E[U],z[U],Vt)))}},Le.prototype.addQuad=function(n,i,l,d,h,p){let y=n+.6666666666666666*(l-n),A=i+2/3*(d-i),_=y+1/3*(h-n),M=A+1/3*(p-i);this.addBezier(n,i,y,A,_,M,h,p)};var Xe=Le;function re(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}var ge={};function Qt(n,i){let l=Math.floor(n),d=n-l;if(ge[i]||(ge[i]={}),ge[i][d]!==void 0){let p=ge[i][d];return l+p}let h=+(Math.round(d+"e+"+i)+"e-"+i);return ge[i][d]=h,l+h}function Rt(n){let i=[[]],l=0,d=0;for(let h=0;h<n.length;h+=1){let p=i[i.length-1],y=n[h],A=p[0],_=p[1],M=p[p.length-1],E=n[h+1];p.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||p.pop():y.type==="L"&&M&&M.x===y.x&&M.y===y.y?p.pop():y.type==="Z"&&(A&&_&&M&&A.type==="M"&&_.type==="L"&&M.type==="L"&&M.x===A.x&&M.y===A.y&&(p.shift(),p[0].type="M"),h+1<n.length&&i.push([]))}return n=[].concat.apply([],i),n}function We(n){return Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0,scale:1,x:0,y:0},n)}function W(n){return parseInt(n)===n&&(n={decimalPlaces:n,flipY:!1}),Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0},n)}re.prototype.fromSVG=function(n,i={}){typeof SVGPathElement<"u"&&n instanceof SVGPathElement&&(n=n.getAttribute("d")),i=We(i),this.commands=[];let l="0123456789",d="MmLlQqCcZzHhVv",h="SsTtAa",p="-+",y={},A=[""],_=!1;function M(Y){return Y.filter(ae=>ae.length).map(ae=>{let ze=parseFloat(ae);return(i.decimalPlaces||i.decimalPlaces===0)&&(ze=Qt(ze,i.decimalPlaces)),ze})}function E(Y){if(!this.commands.length)return Y;let ae=this.commands[this.commands.length-1];for(let ze=0;ze<Y.length;ze++)Y[ze]+=ae[ze&1?"y":"x"];return Y}function z(){if(y.type===void 0)return;let Y=y.type.toUpperCase(),ae=Y!=="Z"&&y.type.toUpperCase()!==y.type,ze=M(A);if(A=[""],!ze.length&&Y!=="Z")return;ae&&Y!=="H"&&Y!=="V"&&(ze=E.apply(this,[ze]));let Jt=this.commands.length&&this.commands[this.commands.length-1].x||0,Vt=this.commands.length&&this.commands[this.commands.length-1].y||0;switch(Y){case"M":this.moveTo(...ze);break;case"L":this.lineTo(...ze);break;case"V":for(let mr=0;mr<ze.length;mr++){let Dr=0;ae&&(Dr=this.commands.length&&this.commands[this.commands.length-1].y||0),this.lineTo(Jt,ze[mr]+Dr)}break;case"H":for(let mr=0;mr<ze.length;mr++){let Dr=0;ae&&(Dr=this.commands.length&&this.commands[this.commands.length-1].x||0),this.lineTo(ze[mr]+Dr,Vt)}break;case"C":this.bezierCurveTo(...ze);break;case"Q":this.quadraticCurveTo(...ze);break;case"Z":(this.commands.length<1||this.commands[this.commands.length-1].type!=="Z")&&this.close();break}if(this.commands.length)for(let mr in this.commands[this.commands.length-1])this.commands[this.commands.length-1][mr]===void 0&&(this.commands[this.commands.length-1][mr]=0)}for(let Y=0;Y<n.length;Y++){let ae=n.charAt(Y),ze=A[A.length-1];if(l.indexOf(ae)>-1)A[A.length-1]+=ae;else if(p.indexOf(ae)>-1)if(!y.type&&!this.commands.length&&(y.type="L"),ae==="-")!y.type||ze.indexOf("-")>0?_=!0:ze.length?A.push("-"):A[A.length-1]=ae;else if(!y.type||ze.length>0)_=!0;else continue;else if(d.indexOf(ae)>-1)y.type?(z.apply(this),y={type:ae}):y.type=ae;else{if(h.indexOf(ae)>-1)throw new Error("Unsupported path command: "+ae+". Currently supported commands are "+d.split("").join(", ")+".");` ,
62
+ \r\f\v`.indexOf(ae)>-1?A.push(""):ae==="."?!y.type||ze.indexOf(ae)>-1?_=!0:A[A.length-1]+=ae:_=!0}if(_)throw new Error("Unexpected character: "+ae+" at offset "+Y)}z.apply(this),i.optimize&&(this.commands=Rt(this.commands));let U=i.flipY,te=i.flipYBase;if(U===!0&&i.flipYBase===void 0){let Y=this.getBoundingBox();te=Y.y1+Y.y2}for(let Y in this.commands){let ae=this.commands[Y];for(let ze in ae)["x","x1","x2"].includes(ze)?this.commands[Y][ze]=i.x+ae[ze]*i.scale:["y","y1","y2"].includes(ze)&&(this.commands[Y][ze]=i.y+(U?te-ae[ze]:ae[ze])*i.scale)}return this},re.fromSVG=function(n,i){return new re().fromSVG(n,i)},re.prototype.moveTo=function(n,i){this.commands.push({type:"M",x:n,y:i})},re.prototype.lineTo=function(n,i){this.commands.push({type:"L",x:n,y:i})},re.prototype.curveTo=re.prototype.bezierCurveTo=function(n,i,l,d,h,p){this.commands.push({type:"C",x1:n,y1:i,x2:l,y2:d,x:h,y:p})},re.prototype.quadTo=re.prototype.quadraticCurveTo=function(n,i,l,d){this.commands.push({type:"Q",x1:n,y1:i,x:l,y:d})},re.prototype.close=re.prototype.closePath=function(){this.commands.push({type:"Z"})},re.prototype.extend=function(n){if(n.commands)n=n.commands;else if(n instanceof Xe){let i=n;this.moveTo(i.x1,i.y1),this.lineTo(i.x2,i.y1),this.lineTo(i.x2,i.y2),this.lineTo(i.x1,i.y2),this.close();return}Array.prototype.push.apply(this.commands,n)},re.prototype.getBoundingBox=function(){let n=new Xe,i=0,l=0,d=0,h=0;for(let p=0;p<this.commands.length;p++){let y=this.commands[p];switch(y.type){case"M":n.addPoint(y.x,y.y),i=d=y.x,l=h=y.y;break;case"L":n.addPoint(y.x,y.y),d=y.x,h=y.y;break;case"Q":n.addQuad(d,h,y.x1,y.y1,y.x,y.y),d=y.x,h=y.y;break;case"C":n.addBezier(d,h,y.x1,y.y1,y.x2,y.y2,y.x,y.y),d=y.x,h=y.y;break;case"Z":d=i,h=l;break;default:throw new Error("Unexpected path command "+y.type)}}return n.isEmpty()&&n.addPoint(0,0),n},re.prototype.draw=function(n){let i=this._layers;if(i&&i.length){for(let d=0;d<i.length;d++)this.draw.call(i[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 h=this.commands[d];h.type==="M"?n.moveTo(h.x,h.y):h.type==="L"?n.lineTo(h.x,h.y):h.type==="C"?n.bezierCurveTo(h.x1,h.y1,h.x2,h.y2,h.x,h.y):h.type==="Q"?n.quadraticCurveTo(h.x1,h.y1,h.x,h.y):h.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())},re.prototype.toPathData=function(n){n=W(n);function i(A){let _=Qt(A,n.decimalPlaces);return Math.round(A)===_?""+_:_.toFixed(n.decimalPlaces)}function l(){let A="";for(let _=0;_<arguments.length;_+=1){let M=arguments[_];M>=0&&_>0&&(A+=" "),A+=i(M)}return A}let d=this.commands;n.optimize&&(d=JSON.parse(JSON.stringify(this.commands)),d=Rt(d));let h=n.flipY,p=n.flipYBase;if(h===!0&&p===void 0){let A=new re;A.extend(d);let _=A.getBoundingBox();p=_.y1+_.y2}let y="";for(let A=0;A<d.length;A+=1){let _=d[A];_.type==="M"?y+="M"+l(_.x,h?p-_.y:_.y):_.type==="L"?y+="L"+l(_.x,h?p-_.y:_.y):_.type==="C"?y+="C"+l(_.x1,h?p-_.y1:_.y1,_.x2,h?p-_.y2:_.y2,_.x,h?p-_.y:_.y):_.type==="Q"?y+="Q"+l(_.x1,h?p-_.y1:_.y1,_.x,h?p-_.y:_.y):_.type==="Z"&&(y+="Z")}return y},re.prototype.toSVG=function(n,i){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"),i||(i=this.toPathData(n));let l='<path d="';return l+=i,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},re.prototype.toDOMElement=function(n,i){this._layers&&this._layers.length&&console.warn("toDOMElement() does not support colr font layers yet"),i||(i=this.toPathData(n));let l=document.createElementNS("http://www.w3.org/2000/svg","path");return l.setAttribute("d",i),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 Je=re;function Se(n){throw new Error(n)}function me(n,i){n||Se(i)}var ce={fail:Se,argument:me,assert:me},qe=32768,ue=2147483648,Me=-32768,et=32767+1/65536,bt={},xe={},de={};function Ie(n){return function(){return n}}xe.BYTE=function(n){return ce.argument(n>=0&&n<=255,"Byte value should be between 0 and 255."),[n]},de.BYTE=Ie(1),xe.CHAR=function(n){return[n.charCodeAt(0)]},de.CHAR=Ie(1),xe.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 i=[];for(let l=0;l<n.length;l+=1)i[l]=n.charCodeAt(l);return i},de.CHARARRAY=function(n){return typeof n>"u"?0:n.length},xe.USHORT=function(n){return[n>>8&255,n&255]},de.USHORT=Ie(2),xe.SHORT=function(n){return n>=qe&&(n=-(2*qe-n)),[n>>8&255,n&255]},de.SHORT=Ie(2),xe.UINT24=function(n){return[n>>16&255,n>>8&255,n&255]},de.UINT24=Ie(3),xe.ULONG=function(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]},de.ULONG=Ie(4),xe.LONG=function(n){return n>=ue&&(n=-(2*ue-n)),[n>>24&255,n>>16&255,n>>8&255,n&255]},de.LONG=Ie(4),xe.FLOAT=function(n){if(n>et||n<Me)throw new Error(`Value ${n} is outside the range of representable values in 16.16 format`);let i=Math.round(n*65536)<<0;return xe.ULONG(i)},de.FLOAT=de.ULONG,xe.FIXED=xe.ULONG,de.FIXED=de.ULONG,xe.FWORD=xe.SHORT,de.FWORD=de.SHORT,xe.UFWORD=xe.USHORT,de.UFWORD=de.USHORT,xe.F2DOT14=function(n){return xe.USHORT(n*16384)},de.F2DOT14=de.USHORT,xe.LONGDATETIME=function(n){return[0,0,0,0,n>>24&255,n>>16&255,n>>8&255,n&255]},de.LONGDATETIME=Ie(8),xe.TAG=function(n){return ce.argument(n.length===4,"Tag should be exactly 4 ASCII characters."),[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)]},de.TAG=Ie(4),xe.Card8=xe.BYTE,de.Card8=de.BYTE,xe.Card16=xe.USHORT,de.Card16=de.USHORT,xe.OffSize=xe.BYTE,de.OffSize=de.BYTE,xe.SID=xe.USHORT,de.SID=de.USHORT,xe.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?xe.NUMBER16(n):xe.NUMBER32(n)},de.NUMBER=function(n){return xe.NUMBER(n).length},xe.NUMBER16=function(n){return[28,n>>8&255,n&255]},de.NUMBER16=Ie(3),xe.NUMBER32=function(n){return[29,n>>24&255,n>>16&255,n>>8&255,n&255]},de.NUMBER32=Ie(5),xe.REAL=function(n){let i=n.toString(),l=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(i);if(l){let p=parseFloat("1e"+((l[2]?+l[2]:0)+l[1].length));i=(Math.round(n*p)/p).toString()}let d="";for(let p=0,y=i.length;p<y;p+=1){let A=i[p];A==="e"?d+=i[++p]==="-"?"c":"b":A==="."?d+="a":A==="-"?d+="e":d+=A}d+=d.length&1?"f":"ff";let h=[30];for(let p=0,y=d.length;p<y;p+=2)h.push(parseInt(d.substr(p,2),16));return h},de.REAL=function(n){return xe.REAL(n).length},xe.NAME=xe.CHARARRAY,de.NAME=de.CHARARRAY,xe.STRING=xe.CHARARRAY,de.STRING=de.CHARARRAY,bt.UTF8=function(n,i,l){let d=[],h=l;for(let p=0;p<h;p++,i+=1)d[p]=n.getUint8(i);return String.fromCharCode.apply(null,d)},bt.UTF16=function(n,i,l){let d=[],h=l/2;for(let p=0;p<h;p++,i+=2)d[p]=n.getUint16(i);return String.fromCharCode.apply(null,d)},xe.UTF16=function(n){let i=[];for(let l=0;l<n.length;l+=1){let d=n.charCodeAt(l);i[i.length]=d>>8&255,i[i.length]=d&255}return i},de.UTF16=function(n){return n.length*2};var Qe={"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":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};bt.MACSTRING=function(n,i,l,d){let h=Qe[d];if(h===void 0)return;let p="";for(let y=0;y<l;y++){let A=n.getUint8(i+y);A<=127?p+=String.fromCharCode(A):p+=h[A&127]}return p};var Pe=typeof WeakMap=="function"&&new WeakMap,ft,Mt=function(n){if(!ft){ft={};for(let h in Qe)ft[h]=new String(h)}let i=ft[n];if(i===void 0)return;if(Pe){let h=Pe.get(i);if(h!==void 0)return h}let l=Qe[n];if(l===void 0)return;let d={};for(let h=0;h<l.length;h++)d[l.charCodeAt(h)]=h+128;return Pe&&Pe.set(i,d),d};xe.MACSTRING=function(n,i){let l=Mt(i);if(l===void 0)return;let d=[];for(let h=0;h<n.length;h++){let p=n.charCodeAt(h);if(p>=128&&(p=l[p],p===void 0))return;d[h]=p}return d},de.MACSTRING=function(n,i){let l=xe.MACSTRING(n,i);return l!==void 0?l.length:0};function Be(n){return n>=-128&&n<=127}function gr(n,i,l){let d=0,h=n.length;for(;i<h&&d<64&&n[i]===0;)++i,++d;return l.push(128|d-1),i}function ct(n,i,l){let d=0,h=n.length,p=i;for(;p<h&&d<64;){let y=n[p];if(!Be(y)||y===0&&p+1<h&&n[p+1]===0)break;++p,++d}l.push(d-1);for(let y=i;y<p;++y)l.push(n[y]+256&255);return p}function gt(n,i,l){let d=0,h=n.length,p=i;for(;p<h&&d<64;){let y=n[p];if(y===0||Be(y)&&p+1<h&&Be(n[p+1]))break;++p,++d}l.push(64|d-1);for(let y=i;y<p;++y){let A=n[y];l.push(A+65536>>8&255,A+256&255)}return p}xe.VARDELTAS=function(n){let i=0,l=[];for(;i<n.length;){let d=n[i];d===0?i=gr(n,i,l):d>=-128&&d<=127?i=ct(n,i,l):i=gt(n,i,l)}return l},xe.INDEX=function(n){let i=1,l=[i],d=[];for(let A=0;A<n.length;A+=1){let _=xe.OBJECT(n[A]);Array.prototype.push.apply(d,_),i+=_.length,l.push(i)}if(d.length===0)return[0,0];let h=[],p=1+Math.floor(Math.log(i)/Math.log(2))/8|0,y=[void 0,xe.BYTE,xe.USHORT,xe.UINT24,xe.ULONG][p];for(let A=0;A<l.length;A+=1){let _=y(l[A]);Array.prototype.push.apply(h,_)}return Array.prototype.concat(xe.Card16(n.length),xe.OffSize(p),h,d)},de.INDEX=function(n){return xe.INDEX(n).length},xe.DICT=function(n){let i=[],l=Object.keys(n),d=l.length;for(let h=0;h<d;h+=1){let p=parseInt(l[h],0),y=n[p],A=xe.OPERAND(y.value,y.type),_=xe.OPERATOR(p);for(let M=0;M<A.length;M++)i.push(A[M]);for(let M=0;M<_.length;M++)i.push(_[M])}return i},de.DICT=function(n){return xe.DICT(n).length},xe.OPERATOR=function(n){return n<1200?[n]:[12,n-1200]},xe.OPERAND=function(n,i){let l=[];if(Array.isArray(i))for(let d=0;d<i.length;d+=1){ce.argument(n.length===i.length,"Not enough arguments given for type"+i);let h=xe.OPERAND(n[d],i[d]);for(let p=0;p<h.length;p++)l.push(h[p])}else if(i==="SID"){let d=xe.NUMBER(n);for(let h=0;h<d.length;h++)l.push(d[h])}else if(i==="offset"){let d=xe.NUMBER32(n);for(let h=0;h<d.length;h++)l.push(d[h])}else if(i==="number"){let d=xe.NUMBER(n);for(let h=0;h<d.length;h++)l.push(d[h])}else if(i==="real"){let d=xe.REAL(n);for(let h=0;h<d.length;h++)l.push(d[h])}else throw new Error("Unknown operand type "+i);return l},xe.OP=xe.BYTE,de.OP=de.BYTE;var vt=typeof WeakMap=="function"&&new WeakMap;xe.CHARSTRING=function(n){if(vt){let d=vt.get(n);if(d!==void 0)return d}let i=[],l=n.length;for(let d=0;d<l;d+=1){let h=n[d],p=xe[h.type](h.value);for(let y=0;y<p.length;y++)i.push(p[y])}return vt&&vt.set(n,i),i},de.CHARSTRING=function(n){return xe.CHARSTRING(n).length},xe.OBJECT=function(n){let i=xe[n.type];return ce.argument(i!==void 0,"No encoding function for type "+n.type),i(n.value)},de.OBJECT=function(n){let i=de[n.type];return ce.argument(i!==void 0,"No sizeOf function for type "+n.type),i(n.value)},xe.TABLE=function(n){let i=[],l=(n.fields||[]).length,d=[],h=[];for(let p=0;p<l;p+=1){let y=n.fields[p],A=xe[y.type];ce.argument(A!==void 0,"No encoding function for field type "+y.type+" ("+y.name+")");let _=n[y.name];_===void 0&&(_=y.value);let M=A(_);if(y.type==="TABLE")_.fields!==null&&(h.push(i.length),d.push(M)),i.push(0,0);else for(let E=0;E<M.length;E++)i.push(M[E])}for(let p=0;p<d.length;p+=1){let y=h[p],A=i.length;ce.argument(A<65536,"Table "+n.tableName+" too big."),i[y]=A>>8,i[y+1]=A&255;for(let _=0;_<d[p].length;_++)i.push(d[p][_])}return i},de.TABLE=function(n){let i=0,l=(n.fields||[]).length;for(let d=0;d<l;d+=1){let h=n.fields[d],p=de[h.type];ce.argument(p!==void 0,"No sizeOf function for field type "+h.type+" ("+h.name+")");let y=n[h.name];y===void 0&&(y=h.value),i+=p(y),h.type==="TABLE"&&(i+=2)}return i},xe.RECORD=xe.TABLE,de.RECORD=de.TABLE,xe.LITERAL=function(n){return n},de.LITERAL=function(n){return n.length};function _t(n,i,l){if(i&&i.length)for(let d=0;d<i.length;d+=1){let h=i[d];this[h.name]=h.value}if(this.tableName=n,this.fields=i,l){let d=Object.keys(l);for(let h=0;h<d.length;h+=1){let p=d[h],y=l[p];this[p]!==void 0&&(this[p]=y)}}}_t.prototype.encode=function(){return xe.TABLE(this)},_t.prototype.sizeOf=function(){return de.TABLE(this)};function qt(n,i,l){l===void 0&&(l=i.length);let d=new Array(i.length+1);d[0]={name:n+"Count",type:"USHORT",value:l};for(let h=0;h<i.length;h++)d[h+1]={name:n+h,type:"USHORT",value:i[h]};return d}function ee(n,i,l){let d=i.length,h=new Array(d+1);h[0]={name:n+"Count",type:"USHORT",value:d};for(let p=0;p<d;p++)h[p+1]={name:n+p,type:"TABLE",value:l(i[p],p)};return h}function Te(n,i,l){let d=i.length,h=[];h[0]={name:n+"Count",type:"USHORT",value:d};for(let p=0;p<d;p++)h=h.concat(l(i[p],p));return h}function Ze(n){n.format===1?_t.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(qt("glyph",n.glyphs))):n.format===2?_t.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Te("rangeRecord",n.ranges,function(i,l){return[{name:"startGlyphID"+l,type:"USHORT",value:i.start},{name:"endGlyphID"+l,type:"USHORT",value:i.end},{name:"startCoverageIndex"+l,type:"USHORT",value:i.index}]}))):ce.assert(!1,"Coverage format must be 1 or 2.")}Ze.prototype=Object.create(_t.prototype),Ze.prototype.constructor=Ze;function Ht(n){_t.call(this,"scriptListTable",Te("scriptRecord",n,function(i,l){let d=i.script,h=d.defaultLangSys;return ce.assert(!!h,"Unable to write GSUB: script "+i.tag+" has no default language system."),[{name:"scriptTag"+l,type:"TAG",value:i.tag},{name:"script"+l,type:"TABLE",value:new _t("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new _t("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:h.reqFeatureIndex}].concat(qt("featureIndex",h.featureIndexes)))}].concat(Te("langSys",d.langSysRecords,function(p,y){let A=p.langSys;return[{name:"langSysTag"+y,type:"TAG",value:p.tag},{name:"langSys"+y,type:"TABLE",value:new _t("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:A.reqFeatureIndex}].concat(qt("featureIndex",A.featureIndexes)))}]})))}]}))}Ht.prototype=Object.create(_t.prototype),Ht.prototype.constructor=Ht;function $e(n){_t.call(this,"featureListTable",Te("featureRecord",n,function(i,l){let d=i.feature;return[{name:"featureTag"+l,type:"TAG",value:i.tag},{name:"feature"+l,type:"TABLE",value:new _t("featureTable",[{name:"featureParams",type:"USHORT",value:d.featureParams}].concat(qt("lookupListIndex",d.lookupListIndexes)))}]}))}$e.prototype=Object.create(_t.prototype),$e.prototype.constructor=$e;function Nt(n,i){_t.call(this,"lookupListTable",ee("lookup",n,function(l){let d=i[l.lookupType];return ce.assert(!!d,"Unable to write GSUB lookup type "+l.lookupType+" tables."),new _t("lookupTable",[{name:"lookupType",type:"USHORT",value:l.lookupType},{name:"lookupFlag",type:"USHORT",value:l.lookupFlag}].concat(ee("subtable",l.subtables,d)))}))}Nt.prototype=Object.create(_t.prototype),Nt.prototype.constructor=Nt;function lr(n){n.format===1?_t.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:1},{name:"startGlyphID",type:"USHORT",value:n.startGlyph}].concat(qt("glyph",n.classes))):n.format===2?_t.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:2}].concat(Te("rangeRecord",n.ranges,function(i,l){return[{name:"startGlyphID"+l,type:"USHORT",value:i.start},{name:"endGlyphID"+l,type:"USHORT",value:i.end},{name:"class"+l,type:"USHORT",value:i.classId}]}))):ce.assert(!1,"Class format must be 1 or 2.")}lr.prototype=Object.create(_t.prototype),lr.prototype.constructor=lr;var ye={Table:_t,Record:_t,Coverage:Ze,ClassDef:lr,ScriptList:Ht,FeatureList:$e,LookupList:Nt,ushortList:qt,tableList:ee,recordList:Te};function Bn(n,i){return n.getUint8(i)}function Lr(n,i){return n.getUint16(i,!1)}function ve(n,i){return n.getInt16(i,!1)}function $r(n,i){return(n.getUint16(i)<<8)+n.getUint8(i+2)}function kt(n,i){return n.getUint32(i,!1)}function un(n,i){return n.getInt32(i,!1)}function Ir(n,i){let l=n.getInt16(i,!1),d=n.getUint16(i+2,!1);return l+d/65535}function kn(n,i){let l="";for(let d=i;d<i+4;d+=1)l+=String.fromCharCode(n.getInt8(d));return l}function se(n,i,l){let d=0;for(let h=0;h<l;h+=1)d<<=8,d+=n.getUint8(i+h);return d}function rt(n,i,l){let d=[];for(let h=i;h<l;h+=1)d.push(n.getUint8(h));return d}function Bt(n){let i="";for(let l=0;l<n.length;l+=1)i+=String.fromCharCode(n[l]);return i}var wr={byte:1,uShort:2,f2dot14:2,short:2,uInt24:3,uLong:4,fixed:4,longDateTime:8,tag:4},jt={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 ne(n,i){this.data=n,this.offset=i,this.relativeOffset=0}ne.prototype.parseByte=function(){let n=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,n},ne.prototype.parseChar=function(){let n=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,n},ne.prototype.parseCard8=ne.prototype.parseByte,ne.prototype.parseUShort=function(){let n=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,n},ne.prototype.parseCard16=ne.prototype.parseUShort,ne.prototype.parseSID=ne.prototype.parseUShort,ne.prototype.parseOffset16=ne.prototype.parseUShort,ne.prototype.parseShort=function(){let n=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,n},ne.prototype.parseF2Dot14=function(){let n=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,n},ne.prototype.parseUInt24=function(){let n=$r(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=3,n},ne.prototype.parseULong=function(){let n=kt(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},ne.prototype.parseLong=function(){let n=un(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},ne.prototype.parseOffset32=ne.prototype.parseULong,ne.prototype.parseFixed=function(){let n=Ir(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},ne.prototype.parseString=function(n){let i=this.data,l=this.offset+this.relativeOffset,d="";this.relativeOffset+=n;for(let h=0;h<n;h++)d+=String.fromCharCode(i.getUint8(l+h));return d},ne.prototype.parseTag=function(){return this.parseString(4)},ne.prototype.parseLongDateTime=function(){let n=kt(this.data,this.offset+this.relativeOffset+4);return n-=2082844800,this.relativeOffset+=8,n},ne.prototype.parseVersion=function(n){let i=Lr(this.data,this.offset+this.relativeOffset),l=Lr(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,n===void 0&&(n=4096),i+l/n/10},ne.prototype.skip=function(n,i){i===void 0&&(i=1),this.relativeOffset+=wr[n]*i},ne.prototype.parseULongList=function(n){n===void 0&&(n=this.parseULong());let i=new Array(n),l=this.data,d=this.offset+this.relativeOffset;for(let h=0;h<n;h++)i[h]=l.getUint32(d),d+=4;return this.relativeOffset+=n*4,i},ne.prototype.parseOffset16List=ne.prototype.parseUShortList=function(n){n===void 0&&(n=this.parseUShort());let i=new Array(n),l=this.data,d=this.offset+this.relativeOffset;for(let h=0;h<n;h++)i[h]=l.getUint16(d),d+=2;return this.relativeOffset+=n*2,i},ne.prototype.parseShortList=function(n){let i=new Array(n),l=this.data,d=this.offset+this.relativeOffset;for(let h=0;h<n;h++)i[h]=l.getInt16(d),d+=2;return this.relativeOffset+=n*2,i},ne.prototype.parseByteList=function(n){let i=new Array(n),l=this.data,d=this.offset+this.relativeOffset;for(let h=0;h<n;h++)i[h]=l.getUint8(d++);return this.relativeOffset+=n,i},ne.prototype.parseList=function(n,i){i||(i=n,n=this.parseUShort());let l=new Array(n);for(let d=0;d<n;d++)l[d]=i.call(this);return l},ne.prototype.parseList32=function(n,i){i||(i=n,n=this.parseULong());let l=new Array(n);for(let d=0;d<n;d++)l[d]=i.call(this);return l},ne.prototype.parseRecordList=function(n,i){i||(i=n,n=this.parseUShort());let l=new Array(n),d=Object.keys(i);for(let h=0;h<n;h++){let p={};for(let y=0;y<d.length;y++){let A=d[y],_=i[A];p[A]=_.call(this)}l[h]=p}return l},ne.prototype.parseRecordList32=function(n,i){i||(i=n,n=this.parseULong());let l=new Array(n),d=Object.keys(i);for(let h=0;h<n;h++){let p={};for(let y=0;y<d.length;y++){let A=d[y],_=i[A];p[A]=_.call(this)}l[h]=p}return l},ne.prototype.parseTupleRecords=function(n,i){let l=[];for(let d=0;d<n;d++){let h=[];for(let p=0;p<i;p++)h.push(this.parseF2Dot14());l.push(h)}return l},ne.prototype.parseStruct=function(n){if(typeof n=="function")return n.call(this);{let i=Object.keys(n),l={};for(let d=0;d<i.length;d++){let h=i[d],p=n[h];l[h]=p.call(this)}return l}},ne.prototype.parseValueRecord=function(n){if(n===void 0&&(n=this.parseUShort()),n===0)return;let i={};return n&1&&(i.xPlacement=this.parseShort()),n&2&&(i.yPlacement=this.parseShort()),n&4&&(i.xAdvance=this.parseShort()),n&8&&(i.yAdvance=this.parseShort()),n&16&&(i.xPlaDevice=void 0,this.parseShort()),n&32&&(i.yPlaDevice=void 0,this.parseShort()),n&64&&(i.xAdvDevice=void 0,this.parseShort()),n&128&&(i.yAdvDevice=void 0,this.parseShort()),i},ne.prototype.parseValueRecordList=function(){let n=this.parseUShort(),i=this.parseUShort(),l=new Array(i);for(let d=0;d<i;d++)l[d]=this.parseValueRecord(n);return l},ne.prototype.parsePointer=function(n){let i=this.parseOffset16();if(i>0)return new ne(this.data,this.offset+i).parseStruct(n)},ne.prototype.parsePointer32=function(n){let i=this.parseOffset32();if(i>0)return new ne(this.data,this.offset+i).parseStruct(n)},ne.prototype.parseListOfLists=function(n){let i=this.parseOffset16List(),l=i.length,d=this.relativeOffset,h=new Array(l);for(let p=0;p<l;p++){let y=i[p];if(y===0){h[p]=void 0;continue}if(this.relativeOffset=y,n){let A=this.parseOffset16List(),_=new Array(A.length);for(let M=0;M<A.length;M++)this.relativeOffset=y+A[M],_[M]=n.call(this);h[p]=_}else h[p]=this.parseUShortList()}return this.relativeOffset=d,h},ne.prototype.parseCoverage=function(){let n=this.offset+this.relativeOffset,i=this.parseUShort(),l=this.parseUShort();if(i===1)return{format:1,glyphs:this.parseUShortList(l)};if(i===2){let d=new Array(l);for(let h=0;h<l;h++)d[h]={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.")},ne.prototype.parseClassDef=function(){let n=this.offset+this.relativeOffset,i=this.parseUShort();return i===1?{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:i===2?{format:2,ranges:this.parseRecordList({start:ne.uShort,end:ne.uShort,classId:ne.uShort})}:(console.warn(`0x${n.toString(16)}: This font file uses an invalid ClassDef format of ${i}. It might be corrupted and should be reacquired if it doesn't display as intended.`),{format:i})},ne.list=function(n,i){return function(){return this.parseList(n,i)}},ne.list32=function(n,i){return function(){return this.parseList32(n,i)}},ne.recordList=function(n,i){return function(){return this.parseRecordList(n,i)}},ne.recordList32=function(n,i){return function(){return this.parseRecordList32(n,i)}},ne.pointer=function(n){return function(){return this.parsePointer(n)}},ne.pointer32=function(n){return function(){return this.parsePointer32(n)}},ne.tag=ne.prototype.parseTag,ne.byte=ne.prototype.parseByte,ne.uShort=ne.offset16=ne.prototype.parseUShort,ne.uShortList=ne.prototype.parseUShortList,ne.uInt24=ne.prototype.parseUInt24,ne.uLong=ne.offset32=ne.prototype.parseULong,ne.uLongList=ne.prototype.parseULongList,ne.fixed=ne.prototype.parseFixed,ne.f2Dot14=ne.prototype.parseF2Dot14,ne.struct=ne.prototype.parseStruct,ne.coverage=ne.prototype.parseCoverage,ne.classDef=ne.prototype.parseClassDef;var Pt={reserved:ne.uShort,reqFeatureIndex:ne.uShort,featureIndexes:ne.uShortList};ne.prototype.parseScriptList=function(){return this.parsePointer(ne.recordList({tag:ne.tag,script:ne.pointer({defaultLangSys:ne.pointer(Pt),langSysRecords:ne.recordList({tag:ne.tag,langSys:ne.pointer(Pt)})})}))||[]},ne.prototype.parseFeatureList=function(){return this.parsePointer(ne.recordList({tag:ne.tag,feature:ne.pointer({featureParams:ne.offset16,lookupListIndexes:ne.uShortList})}))||[]},ne.prototype.parseLookupList=function(n){return this.parsePointer(ne.list(ne.pointer(function(){let i=this.parseUShort();ce.argument(1<=i&&i<=9,"GPOS/GSUB lookup type "+i+" unknown.");let l=this.parseUShort(),d=l&16;return{lookupType:i,lookupFlag:l,subtables:this.parseList(ne.pointer(n[i])),markFilteringSet:d?this.parseUShort():void 0}})))||[]},ne.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){let n=this.parseUShort(),i=this.parseUShort();return ce.argument(n===1&&i<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:ne.offset32,featureTableSubstitutionOffset:ne.offset32})})||[]},ne.prototype.parseVariationStore=function(){let n=this.relativeOffset,i=this.parseUShort(),l={itemVariationStore:this.parseItemVariationStore()};return this.relativeOffset=n+i+2,l},ne.prototype.parseItemVariationStore=function(){let n=this.relativeOffset,i={format:this.parseUShort(),variationRegions:[],itemVariationSubtables:[]},l=this.parseOffset32(),d=this.parseUShort(),h=this.parseULongList(d);this.relativeOffset=n+l,i.variationRegions=this.parseVariationRegionList();for(let p=0;p<d;p++){let y=h[p];this.relativeOffset=n+y,i.itemVariationSubtables.push(this.parseItemVariationSubtable())}return i},ne.prototype.parseVariationRegionList=function(){let n=this.parseUShort(),i=this.parseUShort();return this.parseRecordList(i,{regionAxes:ne.recordList(n,{startCoord:ne.f2Dot14,peakCoord:ne.f2Dot14,endCoord:ne.f2Dot14})})},ne.prototype.parseItemVariationSubtable=function(){let n=this.parseUShort(),i=this.parseUShort(),l=this.parseUShortList(),d=l.length;return{regionIndexes:l,deltaSets:n&&d?this.parseDeltaSets(n,i,d):[]}},ne.prototype.parseDeltaSetIndexMap=function(){let n=this.parseByte(),i=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:i};let h=(i&jt.INNER_INDEX_BIT_COUNT_MASK)+1,p=((i&jt.MAP_ENTRY_SIZE_MASK)>>4)+1;for(let y=0;y<d;y++){let A;if(p===1)A=this.parseByte();else if(p===2)A=this.parseUShort();else if(p===3)A=this.parseUInt24();else if(p===4)A=this.parseULong();else throw new Error(`Invalid entry size of ${p}`);let _=A>>h,M=A&(1<<h)-1;l.push({outerIndex:_,innerIndex:M})}return{format:n,entryFormat:i,map:l}},ne.prototype.parseDeltaSets=function(n,i,l){let d=Array.from({length:n},()=>[]),h=i&jt.LONG_WORDS,p=i&jt.WORD_DELTA_COUNT_MASK;if(p>l)throw Error("wordCount must be less than or equal to regionIndexCount");let y=(h?this.parseLong:this.parseShort).bind(this),A=(h?this.parseShort:this.parseChar).bind(this);for(let _=0;_<n;_++)for(let M=0;M<l;M++)M<p?d[_].push(y()):d[_].push(A());return d},ne.prototype.parseTupleVariationStoreList=function(n,i,l){let d=this.parseUShort(),h=this.parseUShort()&1,p=this.parseOffset32(),y=(h?this.parseULong:this.parseUShort).bind(this),A={},_=y();h||(_*=2);let M;for(let E=0;E<d;E++){M=y(),h||(M*=2);let z=M-_;A[E]=z?this.parseTupleVariationStore(p+_,n,i,l,E):void 0,_=M}return A},ne.prototype.parseTupleVariationStore=function(n,i,l,d,h){let p=this.relativeOffset;this.relativeOffset=n,l==="cvar"&&(this.relativeOffset+=4);let y=this.parseUShort(),A=!!(y&jt.SHARED_POINT_NUMBERS),_=y&jt.COUNT_MASK,M=this.parseOffset16(),E=[],z=[];for(let Y=0;Y<_;Y++){let ae=this.parseTupleVariationHeader(i,l);E.push(ae)}this.relativeOffset!==n+M&&(console.warn(`Unexpected offset after parsing tuple variation headers! Expected ${n+M}, actually ${this.relativeOffset}`),this.relativeOffset=n+M),A&&(z=this.parsePackedPointNumbers());let U=this.relativeOffset;for(let Y=0;Y<_;Y++){let ae=E[Y];ae.privatePoints=[],this.relativeOffset=U,l==="cvar"&&!ae.peakTuple&&console.warn("An embedded peak tuple is required in TupleVariationHeaders for the cvar table."),ae.flags.privatePointNumbers&&(ae.privatePoints=this.parsePackedPointNumbers()),delete ae.flags;let ze=this.offset,Jt=this.relativeOffset,Vt=mr=>{let Dr,An,Dn=()=>{let Qn=0;if(l==="gvar"){if(Qn=ae.privatePoints.length||z.length,!Qn){let Bs=d.get(h);Bs.path,Qn=Bs.points.length,Qn+=4}}else l==="cvar"&&(Qn=d.length);this.offset=ze,this.relativeOffset=Jt,Dr=this.parsePackedDeltas(Qn),l==="gvar"&&(An=this.parsePackedDeltas(Qn))};return{configurable:!0,get:function(){return Dr===void 0&&Dn(),mr==="deltasY"?An:Dr},set:function(Qn){Dr===void 0&&Dn(),mr==="deltasY"?An=Qn:Dr=Qn}}};Object.defineProperty(ae,"deltas",Vt.call(this,"deltas")),l==="gvar"&&Object.defineProperty(ae,"deltasY",Vt.call(this,"deltasY")),U+=ae.variationDataSize,delete ae.variationDataSize}this.relativeOffset=p;let te={headers:E};return te.sharedPoints=z,te},ne.prototype.parseTupleVariationHeader=function(n,i){let l=this.parseUShort(),d=this.parseUShort(),h=!!(d&jt.EMBEDDED_PEAK_TUPLE),p=!!(d&jt.INTERMEDIATE_REGION),y=!!(d&jt.PRIVATE_POINT_NUMBERS),A=h?void 0:d&jt.TUPLE_INDEX_MASK,_=h?this.parseTupleRecords(1,n)[0]:void 0,M=p?this.parseTupleRecords(1,n)[0]:void 0,E=p?this.parseTupleRecords(1,n)[0]:void 0,z={variationDataSize:l,peakTuple:_,intermediateStartTuple:M,intermediateEndTuple:E,flags:{embeddedPeakTuple:h,intermediateRegion:p,privatePointNumbers:y}};return i==="gvar"&&(z.sharedTupleRecordsIndex=A),z},ne.prototype.parsePackedPointNumbers=function(){let n=this.parseByte(),i=[],l=n;if(n>=128){let h=this.parseByte();l=(n&jt.POINT_RUN_COUNT_MASK)<<8|h}let d=0;for(;i.length<l;){let h=this.parseByte(),p=!!(h&jt.POINTS_ARE_WORDS),y=(h&jt.POINT_RUN_COUNT_MASK)+1;for(let A=0;A<y&&i.length<l;A++){let _;p?_=this.parseUShort():_=this.parseByte(),d=d+_,i.push(d)}}return i},ne.prototype.parsePackedDeltas=function(n){let i=[];for(;i.length<n;){let l=this.parseByte(),d=!!(l&jt.DELTAS_ARE_ZERO),h=!!(l&jt.DELTAS_ARE_WORDS),p=(l&jt.DELTA_RUN_COUNT_MASK)+1;for(let y=0;y<p&&i.length<n;y++)d?i.push(0):h?i.push(this.parseShort()):i.push(this.parseChar())}return i};var mt={getByte:Bn,getCard8:Bn,getUShort:Lr,getCard16:Lr,getShort:ve,getUInt24:$r,getULong:kt,getFixed:Ir,getTag:kn,getOffset:se,getBytes:rt,bytesToString:Bt,Parser:ne},Br=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],or={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"},ws={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},ts={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 gn(n,i,l){switch(n){case 0:if(i===65535)return"und";if(l)return l[i];break;case 1:return or[i];case 3:return ts[i]}}var Tr="utf-16",en={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"},qn={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 Cn(n,i,l){switch(n){case 0:return Tr;case 1:return qn[l]||en[i];case 3:if(i===1||i===10)return Tr;break}}var As={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function rs(n){return As[n]}function tn(n,i,l){let d={},h=new mt.Parser(n,i),p=h.parseUShort(),y=h.parseUShort(),A=h.offset+h.parseUShort();for(let _=0;_<y;_++){let M=h.parseUShort(),E=h.parseUShort(),z=h.parseUShort(),U=h.parseUShort(),te=Br[U]||U,Y=h.parseUShort(),ae=h.parseUShort(),ze=gn(M,z,l),Jt=Cn(M,E,z),Vt=rs(M);if(Jt!==void 0&&ze!==void 0&&Vt!==void 0){let mr;if(Jt===Tr?mr=bt.UTF16(n,A+ae,Y):mr=bt.MACSTRING(n,A+ae,Y,Jt),mr){let Dr=d[Vt];Dr===void 0&&(Dr=d[Vt]={});let An=Dr[te];An===void 0&&(An=Dr[te]={}),An[ze]=mr}}}return p===1&&h.parseUShort(),d}function jn(n){let i={};for(let l in n)i[n[l]]=parseInt(l);return i}function Vr(n,i,l,d,h,p){return new ye.Record("NameRecord",[{name:"platformID",type:"USHORT",value:n},{name:"encodingID",type:"USHORT",value:i},{name:"languageID",type:"USHORT",value:l},{name:"nameID",type:"USHORT",value:d},{name:"length",type:"USHORT",value:h},{name:"offset",type:"USHORT",value:p}])}function Rr(n,i){let l=n.length,d=i.length-l+1;e:for(let h=0;h<d;h++)for(;h<d;h++){for(let p=0;p<l;p++)if(i[h+p]!==n[p])continue e;return h}return-1}function Pn(n,i){let l=Rr(n,i);if(l<0){l=i.length;let d=0,h=n.length;for(;d<h;++d)i.push(n[d])}return l}function sn(n,i){let l=jn(As),d=jn(or),h=jn(ts),p=[],y=[];for(let _ in n){let M,E=[],z={},U=jn(Br),te=l[_];for(let Y in n[_]){let ae=U[Y];if(ae===void 0&&(ae=Y),M=parseInt(ae),isNaN(M))throw new Error('Name table entry "'+Y+'" does not exist, see nameTableNames for complete list.');z[M]=n[_][Y],E.push(M)}for(let Y=0;Y<E.length;Y++){M=E[Y];let ae=z[M];for(let ze in ae){let Jt=ae[ze];if(te===1||te===0){let Vt=d[ze],mr=ws[Vt],Dr=Cn(te,mr,Vt),An=xe.MACSTRING(Jt,Dr);if(te===0&&(Vt=i.indexOf(ze),Vt<0&&(Vt=i.length,i.push(ze)),mr=4,An=xe.UTF16(Jt)),An!==void 0){let Dn=Pn(An,y);p.push(Vr(te,mr,Vt,M,An.length,Dn))}}if(te===3){let Vt=h[ze];if(Vt!==void 0){let mr=xe.UTF16(Jt),Dr=Pn(mr,y);p.push(Vr(3,1,Vt,M,mr.length,Dr))}}}}}p.sort(function(_,M){return _.platformID-M.platformID||_.encodingID-M.encodingID||_.languageID-M.languageID||_.nameID-M.nameID});let A=new ye.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:p.length},{name:"stringOffset",type:"USHORT",value:6+p.length*12}]);for(let _=0;_<p.length;_++)A.fields.push({name:"record_"+_,type:"RECORD",value:p[_]});return A.fields.push({name:"strings",type:"LITERAL",value:y}),A}function Zn(n,i,l=[]){if(i<256&&i in Br){if(l.length&&!l.includes(parseInt(i)))return;i=Br[i]}for(let d in n)for(let h in n[d])if(h===i||parseInt(h)===i)return n[d][h]}var zt={parse:tn,make:sn,getNameByID:Zn};function On(n,i,l,d){n.length=i.parseUShort(),n.language=i.parseUShort()-1;let h=i.parseByteList(n.length),p=Object.assign({},h),y=Cn(l,d,n.language),A=Qe[y];for(let _=0;_<A.length;_++)p[A.charCodeAt(_)]=h[128+_];n.glyphIndexMap=p}function zr(n,i,l){i.parseUShort(),n.length=i.parseULong(),n.language=i.parseULong();let d;n.groupCount=d=i.parseULong(),n.glyphIndexMap={};for(let h=0;h<d;h+=1){let p=i.parseULong(),y=i.parseULong(),A=i.parseULong();for(let _=p;_<=y;_+=1)n.glyphIndexMap[_]=A,l===12&&A++}}function Fn(n,i,l,d,h){n.length=i.parseUShort(),n.language=i.parseUShort();let p;n.segCount=p=i.parseUShort()>>1,i.skip("uShort",3),n.glyphIndexMap={};let y=new mt.Parser(l,d+h+14),A=new mt.Parser(l,d+h+16+p*2),_=new mt.Parser(l,d+h+16+p*4),M=new mt.Parser(l,d+h+16+p*6),E=d+h+16+p*8;for(let z=0;z<p-1;z+=1){let U,te=y.parseUShort(),Y=A.parseUShort(),ae=_.parseShort(),ze=M.parseUShort();for(let Jt=Y;Jt<=te;Jt+=1)ze!==0?(E=M.offset+M.relativeOffset-2,E+=ze,E+=(Jt-Y)*2,U=mt.getUShort(l,E),U!==0&&(U=U+ae&65535)):U=Jt+ae&65535,n.glyphIndexMap[Jt]=U}}function Ts(n,i){let l={};i.skip("uLong");let d=i.parseULong();for(let h=0;h<d;h+=1){let p=i.parseUInt24(),y={varSelector:p},A=i.parseOffset32(),_=i.parseOffset32(),M=i.relativeOffset;A&&(i.relativeOffset=A,y.defaultUVS=i.parseStruct({ranges:function(){return i.parseRecordList32({startUnicodeValue:i.parseUInt24,additionalCount:i.parseByte})}})),_&&(i.relativeOffset=_,y.nonDefaultUVS=i.parseStruct({uvsMappings:function(){let E={},z=i.parseRecordList32({unicodeValue:i.parseUInt24,glyphID:i.parseUShort});for(let U=0;U<z.length;U+=1)E[z[U].unicodeValue]=z[U];return E}})),l[p]=y,i.relativeOffset=M}n.varSelectorList=l}function as(n,i){let l={};l.version=mt.getUShort(n,i),ce.argument(l.version===0,"cmap table version should be 0."),l.numTables=mt.getUShort(n,i+2);let d=null,h=-1,p=-1,y=null,A=null,_=[0,1,2,3,4,6],M=[0,1,10];for(let z=l.numTables-1;z>=0;z-=1)if(y=mt.getUShort(n,i+4+z*8),A=mt.getUShort(n,i+4+z*8+2),y===3&&M.includes(A)||y===0&&_.includes(A)||y===1&&A===0){if(p>0)continue;if(p=mt.getULong(n,i+4+z*8+4),d)break}else if(y===0&&A===5){if(h=mt.getULong(n,i+4+z*8+4),d=new mt.Parser(n,i+h),d.parseUShort()!==14)h=-1,d=null;else if(p>0)break}if(p===-1)throw new Error("No valid cmap sub-tables found.");let E=new mt.Parser(n,i+p);if(l.format=E.parseUShort(),l.format===0)On(l,E,y,A);else if(l.format===12||l.format===13)zr(l,E,l.format);else if(l.format===4)Fn(l,E,n,i,p);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&&Ts(l,d),l}function _n(n,i,l){n.segments.push({end:i,start:i,delta:-(i-l),offset:0,glyphIndex:l})}function Cr(n){n.segments.push({end:65535,start:65535,delta:1,offset:0})}function jr(n){if(n.length===0)return n;let i=[n[0]];for(let l=1;l<n.length;l++){let d=i[i.length-1],h=n[l];d.end+1===h.start&&d.delta===h.delta&&h.end!==65535?d.end=h.end:i.push(h)}return i}function Yn(n){let i=!0,l;for(l=n.length-1;l>0;l-=1)if(n.get(l).unicode>65535){i=!1;break}let d=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:i?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:i?12:20}];i||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 h=new ye.Table("cmap",d);for(h.segments=[],l=0;l<n.length;l+=1){let te=n.get(l);for(let Y=0;Y<te.unicodes.length;Y+=1)_n(h,te.unicodes[Y],l)}h.segments.sort(function(te,Y){return te.start-Y.start}),h.segments=jr(h.segments),Cr(h);let p=h.segments.length,y=0,A=[],_=[],M=[],E=[],z=[],U=[];for(l=0;l<p;l+=1){let te=h.segments[l];te.end<=65535&&te.start<=65535?(A.push({name:"end_"+l,type:"USHORT",value:te.end}),_.push({name:"start_"+l,type:"USHORT",value:te.start}),M.push({name:"idDelta_"+l,type:"SHORT",value:te.delta}),E.push({name:"idRangeOffset_"+l,type:"USHORT",value:te.offset}),te.glyphId!==void 0&&z.push({name:"glyph_"+l,type:"USHORT",value:te.glyphId})):y+=1,!i&&te.glyphIndex!==void 0&&(U.push({name:"cmap12Start_"+l,type:"ULONG",value:te.start}),U.push({name:"cmap12End_"+l,type:"ULONG",value:te.end}),U.push({name:"cmap12Glyph_"+l,type:"ULONG",value:te.glyphIndex}))}h.segCountX2=(p-y)*2,h.searchRange=Math.pow(2,Math.floor(Math.log(p-y)/Math.log(2)))*2,h.entrySelector=Math.log(h.searchRange/2)/Math.log(2),h.rangeShift=h.segCountX2-h.searchRange;for(let te=0;te<A.length;te++)h.fields.push(A[te]);h.fields.push({name:"reservedPad",type:"USHORT",value:0});for(let te=0;te<_.length;te++)h.fields.push(_[te]);for(let te=0;te<M.length;te++)h.fields.push(M[te]);for(let te=0;te<E.length;te++)h.fields.push(E[te]);for(let te=0;te<z.length;te++)h.fields.push(z[te]);if(h.cmap4Length=14+A.length*2+2+_.length*2+M.length*2+E.length*2+z.length*2,!i){let te=16+U.length*4;h.cmap12Offset=20+h.cmap4Length,h.fields.push({name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:te},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:U.length/3});for(let Y=0;Y<U.length;Y++)h.fields.push(U[Y])}return h}var xn={parse:as,make:Yn},ds=[".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"],li=[".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"],_r=[".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"],Un=[".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"],Ot=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],qs=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],rn=[".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 Kn(n){this.font=n}Kn.prototype.charToGlyphIndex=function(n){let i=n.codePointAt(0),l=this.font.glyphs;if(l)for(let d=0;d<l.length;d+=1){let h=l.get(d);for(let p=0;p<h.unicodes.length;p+=1)if(h.unicodes[p]===i)return d}return null};function Kr(n){this.cmap=n}Kr.prototype.charToGlyphIndex=function(n){return this.cmap.glyphIndexMap[n.codePointAt(0)]||0};function Xn(n,i){this.encoding=n,this.charset=i}Xn.prototype.charToGlyphIndex=function(n){let i=n.codePointAt(0),l=this.encoding[i];return this.charset.indexOf(l)};function bn(n){switch(n.version){case 1:this.names=rn.slice();break;case 2:this.names=new Array(n.numberOfGlyphs);for(let i=0;i<n.numberOfGlyphs;i++)n.glyphNameIndex[i]<rn.length?this.names[i]=rn[n.glyphNameIndex[i]]:this.names[i]=n.names[n.glyphNameIndex[i]-rn.length];break;case 2.5:this.names=new Array(n.numberOfGlyphs);for(let i=0;i<n.numberOfGlyphs;i++)this.names[i]=rn[i+n.glyphNameIndex[i]];break;case 3:this.names=[];break;default:this.names=[];break}}bn.prototype.nameToGlyphIndex=function(n){return this.names.indexOf(n)},bn.prototype.glyphIndexToName=function(n){return this.names[n]};function xr(n){let i,l=n.tables.cmap.glyphIndexMap,d=Object.keys(l);for(let h=0;h<d.length;h+=1){let p=d[h],y=l[p];i=n.glyphs.get(y),i.addUnicode(parseInt(p))}for(let h=0;h<n.glyphs.length;h+=1)i=n.glyphs.get(h),n.cffEncoding?i.name=n.cffEncoding.charset[h]:n.glyphNames.names&&(i.name=n.glyphNames.glyphIndexToName(h))}function $(n){n._IndexToUnicodeMap={};let i=n.tables.cmap.glyphIndexMap,l=Object.keys(i);for(let d=0;d<l.length;d+=1){let h=l[d],p=i[h];n._IndexToUnicodeMap[p]===void 0?n._IndexToUnicodeMap[p]={unicodes:[parseInt(h)]}:n._IndexToUnicodeMap[p].unicodes.push(parseInt(h))}}function le(n,i){i.lowMemory?$(n):xr(n)}function Ge(n,i,l,d,h){n.beginPath(),n.moveTo(i,l),n.lineTo(d,h),n.stroke()}var Ce={line:Ge};function He(n,i){let l=new ne(n,i),d=l.parseShort();d!==0&&console.warn("Only CPALv0 is currently fully supported.");let h=l.parseShort(),p=l.parseShort(),y=l.parseShort(),A=l.parseOffset32(),_=l.parseUShortList(p);l.relativeOffset=A;let M=l.parseULongList(y);return l.relativeOffset=A,{version:d,numPaletteEntries:h,colorRecords:M,colorRecordIndices:_}}function tt({version:n=0,numPaletteEntries:i=0,colorRecords:l=[],colorRecordIndices:d=[0]}){return ce.argument(n===0,"Only CPALv0 are supported."),ce.argument(l.length,"No colorRecords given."),ce.argument(d.length,"No colorRecordIndices given."),d.length>1&&ce.argument(i,"Can't infer numPaletteEntries on multiple colorRecordIndices"),new ye.Table("CPAL",[{name:"version",type:"USHORT",value:n},{name:"numPaletteEntries",type:"USHORT",value:i||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((h,p)=>({name:"colorRecordIndices_"+p,type:"USHORT",value:h})),...l.map((h,p)=>({name:"colorRecords_"+p,type:"ULONG",value:h}))])}function nt(n){var i=(n&4278190080)>>24,l=(n&16711680)>>16,d=(n&65280)>>8,h=n&255;return i=i+256&255,l=l+256&255,d=d+256&255,h=(h+256&255)/255,{b:i,g:l,r:d,a:h}}function it(n,i,l=0,d="hexa"){if(i==65535)return"currentColor";let h=n&&n.tables&&n.tables.cpal;if(!h)return"currentColor";if(l>h.colorRecordIndices.length-1)throw new Error(`Palette index out of range (colorRecordIndices.length: ${h.colorRecordIndices.length}, index: ${i})`);if(i>h.numPaletteEntries)throw new Error(`Color index out of range (numPaletteEntries: ${h.numPaletteEntries}, index: ${i})`);let p=h.colorRecordIndices[l]+i;if(p>h.colorRecords)throw new Error(`Color index out of range (colorRecords.length: ${h.colorRecords.length}, lookupIndex: ${p})`);let y=nt(h.colorRecords[p]);return d==="bgra"?y:ut(y,d)}function Fe(n){return("0"+parseInt(n).toString(16)).slice(-2)}function at(n){let i=n.r/255,l=n.g/255,d=n.b/255,h=Math.max(i,l,d),p=Math.min(i,l,d),y,A,_=(h+p)/2;if(h===p)y=A=0;else{let M=h-p;switch(A=_>.5?M/(2-h-p):M/(h+p),h){case i:y=(l-d)/M+(l<d?6:0);break;case l:y=(d-i)/M+2;break;case d:y=(i-l)/M+4;break}y/=6}return{h:y*360,s:A*100,l:_*100}}function Kt(n){let{h:i,s:l,l:d,a:h}=n;i=i%360,l/=100,d/=100;let p=(1-Math.abs(2*d-1))*l,y=p*(1-Math.abs(i/60%2-1)),A=d-p/2,_=0,M=0,E=0;return 0<=i&&i<60?(_=p,M=y,E=0):60<=i&&i<120?(_=y,M=p,E=0):120<=i&&i<180?(_=0,M=p,E=y):180<=i&&i<240?(_=0,M=y,E=p):240<=i&&i<300?(_=y,M=0,E=p):300<=i&&i<=360&&(_=p,M=0,E=y),{r:Math.round((_+A)*255),g:Math.round((M+A)*255),b:Math.round((E+A)*255),a:h}}function lt(n){return parseInt(`0x${Fe(n.b)}${Fe(n.g)}${Fe(n.r)}${Fe(n.a*255)}`,16)}function br(n,i="hexa"){let l=i=="raw"||i=="cpal",d=Number.isInteger(n),h=!0;if(d&&l||n==="currentColor")return n;if(typeof n=="object"){if(i=="bgra")return n;if(l)return lt(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(i=="bgra")return n}else if(typeof document<"u"&&/^[a-z]+$/i.test(n)){let p=document.createElement("canvas").getContext("2d");p.fillStyle=n;let y=ut(p.fillStyle,"hexa");y==="#000000ff"&&n.toLowerCase()!=="black"?h=!1:n=y}else{n=n.trim();let p=/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(p.test(n)){let y=n.match(p).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(_=>typeof _<"u");n=Kt({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 h=!1}}if(!h)throw new Error(`Invalid color format: ${n}`);return ut(n,i)}function ut(n,i="hexa"){if(n==="currentColor")return n;if(Number.isInteger(n)){if(i=="raw"||i=="cpal")return n;n=nt(n)}else typeof n!="object"&&(n=br(n,"bgra"));let l=["hsl","hsla"].includes(i)?at(n):null;switch(i){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`#${Fe(n.r)}${Fe(n.g)}${Fe(n.b)}`;case"hexa":case"hex8":case"hex-8":return`#${Fe(n.r)}${Fe(n.g)}${Fe(n.b)}${Fe(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 lt(n);default:throw new Error("Unknown color format: "+i)}}var hr={parse:He,make:tt,getPaletteColor:it,parseColor:br,formatColor:ut};function ar(n,i){let l=i||new Je;return{configurable:!0,get:function(){return typeof l=="function"&&(l=l()),l},set:function(d){l=d}}}function St(n){this.bindConstructorValues(n)}St.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",ar(this,n.path))},St.prototype.addUnicode=function(n){this.unicodes.length===0&&(this.unicode=n),this.unicodes.push(n)},St.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},St.prototype.getPath=function(n,i,l,d,h){n=n!==void 0?n:0,i=i!==void 0?i:0,l=l!==void 0?l:72,d=Object.assign({},h&&h.defaultRenderOptions,d);let p,y,A=d.xScale,_=d.yScale,M=1/(this.path.unitsPerEm||1e3)*l,E=this;h&&h.variation&&(E=h.variation.getTransform(this,d.variation),p=E.path.commands),d.hinting&&h&&h.hinting&&(y=E.path&&h.hinting.exec(E,l,d)),y?(p=h.hinting.getCommands(y),n=Math.round(n),i=Math.round(i),A=_=1):(p=E.path.commands,A===void 0&&(A=M),_===void 0&&(_=M));let z=new Je;if(d.drawSVG){let U=this.getSvgImage(h);if(U){let te=new Je;return te._image={image:U.image,x:n+U.leftSideBearing*M,y:i-U.baseline*M,width:U.image.width*M,height:U.image.height*M},z._layers=[te],z}}if(d.drawLayers){let U=this.getLayers(h);if(U&&U.length){z._layers=[];for(let te=0;te<U.length;te+=1){let Y=U[te],ae=it(h,Y.paletteIndex,d.usePalette);ae==="currentColor"?ae=d.fill||"black":ae=ut(ae,d.colorFormat||"rgba"),d=Object.assign({},d,{fill:ae}),z._layers.push(this.getPath.call(Y.glyph,n,i,l,d,h))}return z}}z.fill=d.fill||this.path.fill,z.stroke=this.path.stroke,z.strokeWidth=this.path.strokeWidth*M;for(let U=0;U<p.length;U+=1){let te=p[U];te.type==="M"?z.moveTo(n+te.x*A,i+-te.y*_):te.type==="L"?z.lineTo(n+te.x*A,i+-te.y*_):te.type==="Q"?z.quadraticCurveTo(n+te.x1*A,i+-te.y1*_,n+te.x*A,i+-te.y*_):te.type==="C"?z.curveTo(n+te.x1*A,i+-te.y1*_,n+te.x2*A,i+-te.y2*_,n+te.x*A,i+-te.y*_):te.type==="Z"&&z.stroke&&z.strokeWidth&&z.closePath()}return z},St.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)},St.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)},St.prototype.getContours=function(n=null){if(this.points===void 0&&!n)return[];let i=[],l=[],d=n||this.points;for(let h=0;h<d.length;h+=1){let p=d[h];l.push(p),p.lastPointOfContour&&(i.push(l),l=[])}return ce.argument(l.length===0,"There are still points left in the current contour."),i},St.prototype.getMetrics=function(){let n=this.path.commands,i=[],l=[];for(let h=0;h<n.length;h+=1){let p=n[h];p.type!=="Z"&&(i.push(p.x),l.push(p.y)),(p.type==="Q"||p.type==="C")&&(i.push(p.x1),l.push(p.y1)),p.type==="C"&&(i.push(p.x2),l.push(p.y2))}let d={xMin:Math.min.apply(null,i),yMin:Math.min.apply(null,l),xMax:Math.max.apply(null,i),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},St.prototype.draw=function(n,i,l,d,h,p){h=Object.assign({},p&&p.defaultRenderOptions,h),this.getPath(i,l,d,h,p).draw(n)},St.prototype.drawPoints=function(n,i,l,d,h,p){if(h=Object.assign({},p&&p.defaultRenderOptions,h),h.drawLayers){let z=this.getLayers(p);if(z&&z.length){for(let U=0;U<z.length;U+=1)z[U].glyph.index!==this.index&&this.drawPoints.call(z[U].glyph,n,i,l,d);return}}function y(z,U,te,Y){n.beginPath();for(let ae=0;ae<z.length;ae+=1)n.moveTo(U+z[ae].x*Y,te+z[ae].y*Y),n.arc(U+z[ae].x*Y,te+z[ae].y*Y,2,0,Math.PI*2,!1);n.fill()}i=i!==void 0?i:0,l=l!==void 0?l:0,d=d!==void 0?d:24;let A=1/this.path.unitsPerEm*d,_=[],M=[],E=this.path.commands;p&&p.variation&&(E=p.variation.getTransform(this,h.variation).path.commands);for(let z=0;z<E.length;z+=1){let U=E[z];U.x!==void 0&&_.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(_,i,l,A),n.fillStyle="red",y(M,i,l,A)},St.prototype.drawMetrics=function(n,i,l,d){let h;i=i!==void 0?i:0,l=l!==void 0?l:0,d=d!==void 0?d:24,h=1/this.path.unitsPerEm*d,n.lineWidth=1,n.strokeStyle="black",Ce.line(n,i,-1e4,i,1e4),Ce.line(n,-1e4,l,1e4,l);let p=this.xMin||0,y=this.yMin||0,A=this.xMax||0,_=this.yMax||0,M=this.advanceWidth||0;n.strokeStyle="blue",Ce.line(n,i+p*h,-1e4,i+p*h,1e4),Ce.line(n,i+A*h,-1e4,i+A*h,1e4),Ce.line(n,-1e4,l+-y*h,1e4,l+-y*h),Ce.line(n,-1e4,l+-_*h,1e4,l+-_*h),n.strokeStyle="green",Ce.line(n,i+M*h,-1e4,i+M*h,1e4)},St.prototype.toPathData=function(n,i){n=Object.assign({},{variation:i&&i.defaultRenderOptions.variation},n);let l=this;i&&i.variation&&(l=i.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)},St.prototype.fromSVG=function(n,i={}){return this.path.fromSVG(n,i)},St.prototype.toSVG=function(n,i){let l=this.toPathData.apply(this,[n,i]);return this.path.toSVG(n,l)},St.prototype.toDOMElement=function(n,i){n=Object.assign({},{variation:i&&i.defaultRenderOptions.variation},n);let l=this.path;return i&&i.variation&&(l=i.variation.getTransform(this,n.variation).path),l.toDOMElement(n)};var sr=St;function kr(n,i,l){Object.defineProperty(n,i,{get:function(){return typeof n[l]>"u"&&n.path,n[l]},set:function(d){n[l]=d},enumerable:!0,configurable:!0})}function yn(n,i){if(this.font=n,this.glyphs={},Array.isArray(i))for(let l=0;l<i.length;l++){let d=i[l];d.path.unitsPerEm=n.unitsPerEm,this.glyphs[l]=d}this.length=i&&i.length||0}typeof Symbol<"u"&&Symbol.iterator&&(yn.prototype[Symbol.iterator]=function(){let n=-1;return{next:(function(){n++;let i=n>=this.length-1;return{value:this.get(n),done:i}}).bind(this)}}),yn.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 i=this.glyphs[n],l=this.font._IndexToUnicodeMap[n];if(l)for(let d=0;d<l.unicodes.length;d++)i.addUnicode(l.unicodes[d]);this.font.cffEncoding?i.name=this.font.cffEncoding.charset[n]:this.font.glyphNames.names&&(i.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]},yn.prototype.push=function(n,i){this.glyphs[n]=i,this.length++};function Zs(n,i){return new sr({index:i,font:n})}function ls(n,i,l,d,h,p){return function(){let y=new sr({index:i,font:n});return y.path=function(){l(y,d,h);let A=p(n.glyphs,y);return A.unitsPerEm=n.unitsPerEm,A},kr(y,"numberOfContours","_numberOfContours"),kr(y,"xMin","_xMin"),kr(y,"xMax","_xMax"),kr(y,"yMin","_yMin"),kr(y,"yMax","_yMax"),kr(y,"points","_points"),y}}function Fs(n,i,l,d,h){return function(){let p=new sr({index:i,font:n});return p.path=function(){let y=l(n,p,d,h);return y.unitsPerEm=n.unitsPerEm,y},p}}var Er={GlyphSet:yn,glyphLoader:Zs,ttfGlyphLoader:ls,cffGlyphLoader:Fs};function Xr(n,i){if(n===i)return!0;if(Array.isArray(n)&&Array.isArray(i)){if(n.length!==i.length)return!1;for(let l=0;l<n.length;l+=1)if(!Xr(n[l],i[l]))return!1;return!0}else return!1}var hs=10;function O(n){let i;return n.length<1240?i=107:n.length<33900?i=1131:i=32768,i}function K(n,i,l,d){let h=[],p=[],y=d>1?mt.getULong(n,i):mt.getCard16(n,i),A=d>1?4:2,_,M;if(y!==0){let E=mt.getByte(n,i+A);_=i+(y+1)*E+A;let z=i+A+1;for(let U=0;U<y+1;U+=1)h.push(mt.getOffset(n,z,E)),z+=E;M=_+h[y]}else M=i+A;for(let E=0;E<h.length-1;E+=1){let z=mt.getBytes(n,_+h[E],_+h[E+1]);l&&(z=l(z,n,i,d)),p.push(z)}return{objects:p,startOffset:i,endOffset:M}}function oe(n,i,l){let d=[],h=l>1?mt.getULong(n,i):mt.getCard16(n,i),p=l>1?4:2,y,A;if(h!==0){let _=mt.getByte(n,i+p);y=i+(h+1)*_+p;let M=i+p+1;for(let E=0;E<h+1;E+=1)d.push(mt.getOffset(n,M,_)),M+=_;A=y+d[h]}else A=i+p;return{offsets:d,startOffset:i,endOffset:A}}function Ne(n,i,l,d,h,p){let y=p>1?mt.getULong(l,d):mt.getCard16(l,d),A=p>1?4:2,_=0;if(y!==0){let E=mt.getByte(l,d+A);_=d+(y+1)*E+A}let M=mt.getBytes(l,_+i[n],_+i[n+1]);return h&&(M=h(M)),M}function Tt(n){let i="",l=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){let d=n.parseByte(),h=d>>4,p=d&15;if(h===15||(i+=l[h],p===15))break;i+=l[p]}return parseFloat(i)}function Lt(n,i){let l,d,h,p;if(i===28)return l=n.parseByte(),d=n.parseByte(),l<<8|d;if(i===29)return l=n.parseByte(),d=n.parseByte(),h=n.parseByte(),p=n.parseByte(),l<<24|d<<16|h<<8|p;if(i===30)return Tt(n);if(i>=32&&i<=246)return i-139;if(i>=247&&i<=250)return l=n.parseByte(),(i-247)*256+l+108;if(i>=251&&i<=254)return l=n.parseByte(),-(i-251)*256-l-108;throw new Error("Invalid b0 "+i)}function Yt(n){let i={};for(let l=0;l<n.length;l+=1){let d=n[l][0],h=n[l][1],p;if(h.length===1?p=h[0]:p=h,Object.prototype.hasOwnProperty.call(i,d)&&!isNaN(i[d]))throw new Error("Object "+i+" already has key "+d);i[d]=p}return i}function pt(n,i,l,d){i=i!==void 0?i:0;let h=new mt.Parser(n,i),p=[],y=[];l=l!==void 0?l:n.byteLength;let A=d<2?22:28;for(;h.relativeOffset<l;){let _=h.parseByte();if(_<A){if(_===12&&(_=1200+h.parseByte()),d>1&&_===23){ns(y);continue}p.push([_,y]),y=[]}else y.push(Lt(h,_,d))}return Yt(p)}function It(n,i){return i<=390?i=ds[i]:n?i=n[i-391]:i=void 0,i}function Hr(n,i,l){let d={},h;for(let p=0;p<i.length;p+=1){let y=i[p];if(Array.isArray(y.type)){let A=[];A.length=y.type.length;for(let _=0;_<y.type.length;_++)h=n[y.op]!==void 0?n[y.op][_]:void 0,h===void 0&&(h=y.value!==void 0&&y.value[_]!==void 0?y.value[_]:null),y.type[_]==="SID"&&(h=It(l,h)),A[_]=h;d[y.name]=A}else h=n[y.op],h===void 0&&(h=y.value!==void 0?y.value:null),y.type==="SID"&&(h=It(l,h)),d[y.name]=h}return d}function yr(n,i){let l={};if(l.formatMajor=mt.getCard8(n,i),l.formatMinor=mt.getCard8(n,i+1),l.formatMajor>2)throw new Error(`Unsupported CFF table version ${l.formatMajor}.${l.formatMinor}`);return l.size=mt.getCard8(n,i+2),l.formatMajor<2?(l.offsetSize=mt.getCard8(n,i+3),l.startOffset=i,l.endOffset=i+4):(l.topDictLength=mt.getCard16(n,i+3),l.endOffset=i+8),l}var Gr=[{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"}],Wr=[{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"}],on=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}],Sn=[{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"}],dn=[{name:"private",op:18,type:["number","offset"],value:[0,0]}];function ur(n,i,l,d){let h=pt(n,i,n.byteLength,d);return Hr(h,d>1?Wr:Gr,l)}function Wt(n,i,l,d,h){let p=pt(n,i,l,h);return Hr(p,h>1?Sn:on,d)}function vr(n,i,l){let d=pt(n,i,void 0,l);return Hr(d,dn)}function Xt(n,i,l){let d=[];for(let h=0;h<l.length;h++){let p=new DataView(new Uint8Array(l[h]).buffer),y=vr(p,0,2),A=y.private[0],_=y.private[1];if(A!==0&&_!==0){let M=Wt(n,_+i,A,[],2);if(M.subrs){let E=_+M.subrs,z=K(n,E+i,void 0,2);y._subrs=z.objects,y._subrsBias=O(y._subrs)}y._privateDict=M}d.push(y)}return d}function Ut(n,i,l,d,h){let p=[];for(let y=0;y<l.length;y+=1){let A=new DataView(new Uint8Array(l[y]).buffer),_=ur(A,0,d,h);_._subrs=[],_._subrsBias=0,_._defaultWidthX=0,_._nominalWidthX=0;let M=h<2?_.private[0]:0,E=h<2?_.private[1]:0;if(M!==0&&E!==0){let z=Wt(n,E+i,M,d,h);if(_._defaultWidthX=z.defaultWidthX,_._nominalWidthX=z.nominalWidthX,z.subrs!==0){let U=E+z.subrs,te=K(n,U+i,void 0,h);_._subrs=te.objects,_._subrsBias=O(_._subrs)}_._privateDict=z}p.push(_)}return p}function Mr(n,i,l,d,h){let p,y,A=new mt.Parser(n,i);l-=1;let _=[".notdef"],M=A.parseCard8();if(M===0)for(let E=0;E<l;E+=1)p=A.parseSID(),h?_.push(p):_.push(It(d,p)||p);else if(M===1)for(;_.length<=l;){p=A.parseSID(),y=A.parseCard8();for(let E=0;E<=y;E+=1)h?_.push("cid"+("00000"+p).slice(-5)):_.push(It(d,p)||p),p+=1}else if(M===2)for(;_.length<=l;){p=A.parseSID(),y=A.parseCard16();for(let E=0;E<=y;E+=1)h?_.push("cid"+("00000"+p).slice(-5)):_.push(It(d,p)||p),p+=1}else throw new Error("Unknown charset format "+M);return _}function Pr(n,i){let l,d={},h=new mt.Parser(n,i),p=h.parseCard8();if(p===0){let y=h.parseCard8();for(let A=0;A<y;A+=1)l=h.parseCard8(),d[l]=A}else if(p===1){let y=h.parseCard8();l=1;for(let A=0;A<y;A+=1){let _=h.parseCard8(),M=h.parseCard8();for(let E=_;E<=_+M;E+=1)d[E]=l,l+=1}}else throw new Error("Unknown encoding format "+p);return d}function ns(n){let i=n.pop();for(;n.length>i;)n.pop()}function En(n,i){let l=n.tables.cff&&n.tables.cff.topDict&&n.tables.cff.topDict.paintType||0;return l===2&&(i.fill=null,i.stroke="black",i.strokeWidth=n.tables.cff.topDict.strokeWidth||0),l}function fs(n,i,l,d,h){let p,y,A,_,M=new Je,E=[],z=0,U=!1,te=!1,Y=0,ae=0,ze,Jt,Vt,mr,Dr=0,An=[],Dn,Qn=0,Bs=n.tables.cff2||n.tables.cff;if(Vt=Bs.topDict._defaultWidthX,mr=Bs.topDict._nominalWidthX,h=h||n.variation&&n.variation.get(),i.getBlendPath||(i.getBlendPath=function($t){return fs(n,i,l,d,$t)}),n.isCIDFont||d>1){let $t=Bs.topDict._fdSelect?Bs.topDict._fdSelect[i.index]:0,Gt=Bs.topDict._fdArray[$t];ze=Gt._subrs,Jt=Gt._subrsBias,d>1?(An=Bs.topDict._vstore.itemVariationStore,Dr=Gt._privateDict.vsindex):(Vt=Gt._defaultWidthX,mr=Gt._nominalWidthX)}else ze=Bs.topDict._subrs,Jt=Bs.topDict._subrsBias;let qo=En(n,M),Qr=Vt;function lo($t,Gt){te&&qo!==2&&M.closePath(),M.moveTo($t,Gt),te=!0}function Ni(){let $t;$t=(E.length&1)!==0,$t&&!U&&(Qr=E.shift()+mr),z+=E.length>>1,E.length=0,U=!0}function er($t){let Gt,Ci,cl,bu,kl,Zo,Di,To,_i,co,Qi,Bi,Ms=0;for(;Ms<$t.length;){let _o=$t[Ms];switch(Ms+=1,_o){case 1:Ni();break;case 3:Ni();break;case 4:E.length>1&&!U&&(Qr=E.shift()+mr,U=!0),ae+=E.pop(),lo(Y,ae);break;case 5:for(;E.length>0;)Y+=E.shift(),ae+=E.shift(),M.lineTo(Y,ae);break;case 6:for(;E.length>0&&(Y+=E.shift(),M.lineTo(Y,ae),E.length!==0);)ae+=E.shift(),M.lineTo(Y,ae);break;case 7:for(;E.length>0&&(ae+=E.shift(),M.lineTo(Y,ae),E.length!==0);)Y+=E.shift(),M.lineTo(Y,ae);break;case 8:for(;E.length>0;)p=Y+E.shift(),y=ae+E.shift(),A=p+E.shift(),_=y+E.shift(),Y=A+E.shift(),ae=_+E.shift(),M.curveTo(p,y,A,_,Y,ae);break;case 10:if(kl=E.pop()+Jt,Zo=ze[kl],Zo){if(Qn>=hs){console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");break}Qn++,er(Zo),Qn--}break;case 11:if(d>1){console.error("CFF CharString operator return (11) is not supported in CFF2");break}return;case 12:switch(_o=$t[Ms],Ms+=1,_o){case 35:p=Y+E.shift(),y=ae+E.shift(),A=p+E.shift(),_=y+E.shift(),Di=A+E.shift(),To=_+E.shift(),_i=Di+E.shift(),co=To+E.shift(),Qi=_i+E.shift(),Bi=co+E.shift(),Y=Qi+E.shift(),ae=Bi+E.shift(),E.shift(),M.curveTo(p,y,A,_,Di,To),M.curveTo(_i,co,Qi,Bi,Y,ae);break;case 34:p=Y+E.shift(),y=ae,A=p+E.shift(),_=y+E.shift(),Di=A+E.shift(),To=_,_i=Di+E.shift(),co=_,Qi=_i+E.shift(),Bi=ae,Y=Qi+E.shift(),M.curveTo(p,y,A,_,Di,To),M.curveTo(_i,co,Qi,Bi,Y,ae);break;case 36:p=Y+E.shift(),y=ae+E.shift(),A=p+E.shift(),_=y+E.shift(),Di=A+E.shift(),To=_,_i=Di+E.shift(),co=_,Qi=_i+E.shift(),Bi=co+E.shift(),Y=Qi+E.shift(),M.curveTo(p,y,A,_,Di,To),M.curveTo(_i,co,Qi,Bi,Y,ae);break;case 37:p=Y+E.shift(),y=ae+E.shift(),A=p+E.shift(),_=y+E.shift(),Di=A+E.shift(),To=_+E.shift(),_i=Di+E.shift(),co=To+E.shift(),Qi=_i+E.shift(),Bi=co+E.shift(),Math.abs(Qi-Y)>Math.abs(Bi-ae)?Y=Qi+E.shift():ae=Bi+E.shift(),M.curveTo(p,y,A,_,Di,To),M.curveTo(_i,co,Qi,Bi,Y,ae);break;default:console.log("Glyph "+i.index+": unknown operator 1200"+_o),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 El=Ot[E.pop()],l0=Ot[E.pop()],yu=E.pop(),vu=E.pop();if(El&&l0){i.isComposite=!0,i.components=[];let T1=n.cffEncoding.charset.indexOf(El),C1=n.cffEncoding.charset.indexOf(l0);i.components.push({glyphIndex:C1,dx:0,dy:0}),i.components.push({glyphIndex:T1,dx:vu,dy:yu}),M.extend(n.glyphs.get(C1).path);let hy=n.glyphs.get(T1),hh=JSON.parse(JSON.stringify(hy.path.commands));for(let fh=0;fh<hh.length;fh+=1){let pa=hh[fh];pa.type!=="Z"&&(pa.x+=vu,pa.y+=yu),(pa.type==="Q"||pa.type==="C")&&(pa.x1+=vu,pa.y1+=yu),pa.type==="C"&&(pa.x2+=vu,pa.y2+=yu)}M.extend(hh)}}else E.length>0&&!U&&(Qr=E.shift()+mr,U=!0);te&&qo!==2&&(M.closePath(),te=!1);break;case 15:if(d<2){console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");break}Dr=E.pop();break;case 16:if(d<2){console.error("CFF2 CharString operator blend (16) is not supported in CFF");break}Dn||(Dn=n.variation&&h&&n.variation.process.getBlendVector(An,Dr,h));var Vn=E.pop(),Yi=Dn?Dn.length:An.itemVariationSubtables[Dr].regionIndexes.length,Co=Vn*Yi,Yo=E.length-Co,ja=Yo-Vn;if(Dn)for(let El=0;El<Vn;El++){var A1=E[ja+El];for(let l0=0;l0<Yi;l0++)A1+=Dn[l0]*E[Yo++];E[ja+El]=A1}for(;Co--;)E.pop();break;case 18:Ni();break;case 19:case 20:Ni(),Ms+=z+7>>3;break;case 21:E.length>2&&!U&&(Qr=E.shift()+mr,U=!0),ae+=E.pop(),Y+=E.pop(),lo(Y,ae);break;case 22:E.length>1&&!U&&(Qr=E.shift()+mr,U=!0),Y+=E.pop(),lo(Y,ae);break;case 23:Ni();break;case 24:for(;E.length>2;)p=Y+E.shift(),y=ae+E.shift(),A=p+E.shift(),_=y+E.shift(),Y=A+E.shift(),ae=_+E.shift(),M.curveTo(p,y,A,_,Y,ae);Y+=E.shift(),ae+=E.shift(),M.lineTo(Y,ae);break;case 25:for(;E.length>6;)Y+=E.shift(),ae+=E.shift(),M.lineTo(Y,ae);p=Y+E.shift(),y=ae+E.shift(),A=p+E.shift(),_=y+E.shift(),Y=A+E.shift(),ae=_+E.shift(),M.curveTo(p,y,A,_,Y,ae);break;case 26:for(E.length&1&&(Y+=E.shift());E.length>0;)p=Y,y=ae+E.shift(),A=p+E.shift(),_=y+E.shift(),Y=A,ae=_+E.shift(),M.curveTo(p,y,A,_,Y,ae);break;case 27:for(E.length&1&&(ae+=E.shift());E.length>0;)p=Y+E.shift(),y=ae,A=p+E.shift(),_=y+E.shift(),Y=A+E.shift(),ae=_,M.curveTo(p,y,A,_,Y,ae);break;case 28:Gt=$t[Ms],Ci=$t[Ms+1],E.push((Gt<<24|Ci<<16)>>16),Ms+=2;break;case 29:if(kl=E.pop()+n.gsubrsBias,Zo=n.gsubrs[kl],Zo){if(Qn>=hs){console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");break}Qn++,er(Zo),Qn--}break;case 30:for(;E.length>0&&(p=Y,y=ae+E.shift(),A=p+E.shift(),_=y+E.shift(),Y=A+E.shift(),ae=_+(E.length===1?E.shift():0),M.curveTo(p,y,A,_,Y,ae),E.length!==0);)p=Y+E.shift(),y=ae,A=p+E.shift(),_=y+E.shift(),ae=_+E.shift(),Y=A+(E.length===1?E.shift():0),M.curveTo(p,y,A,_,Y,ae);break;case 31:for(;E.length>0&&(p=Y+E.shift(),y=ae,A=p+E.shift(),_=y+E.shift(),ae=_+E.shift(),Y=A+(E.length===1?E.shift():0),M.curveTo(p,y,A,_,Y,ae),E.length!==0);)p=Y,y=ae+E.shift(),A=p+E.shift(),_=y+E.shift(),Y=A+E.shift(),ae=_+(E.length===1?E.shift():0),M.curveTo(p,y,A,_,Y,ae);break;default:_o<32?console.log("Glyph "+i.index+": unknown operator "+_o):_o<247?E.push(_o-139):_o<251?(Gt=$t[Ms],Ms+=1,E.push((_o-247)*256+Gt+108)):_o<255?(Gt=$t[Ms],Ms+=1,E.push(-(_o-251)*256-Gt-108)):(Gt=$t[Ms],Ci=$t[Ms+1],cl=$t[Ms+2],bu=$t[Ms+3],Ms+=4,E.push((Gt<<24|Ci<<16|cl<<8|bu)/65536))}}}return er(l),n.variation&&h&&(M.commands=M.commands.map($t=>{let Gt=Object.keys($t);for(let Ci=0;Ci<Gt.length;Ci++){let cl=Gt[Ci];cl!=="type"&&($t[cl]=Math.round($t[cl]))}return $t})),U&&(i.advanceWidth=Qr),M}function Or(n,i,l,d,h){let p=[],y,A=new mt.Parser(n,i),_=A.parseCard8();if(_===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+")");p.push(y)}else if(_===3||h>1&&_===4){let M=_===4?A.parseULong():A.parseCard16(),E=_===4?A.parseULong():A.parseCard16();if(E!==0)throw new Error(`CFF Table CID Font FDSelect format ${_} range has bad initial GID ${E}`);let z;for(let U=0;U<M;U++){if(y=_===4?A.parseUShort():A.parseCard8(),z=_===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(z>l)throw new Error(`CFF Table CID Font FDSelect format ${h} range has bad GID ${z}`);for(;E<z;E++)p.push(y);E=z}if(z!==l)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final (Sentinal) GID "+z)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+_);return p}function Gi(n,i,l,d){let h,p=yr(n,i);p.formatMajor===2?h=l.tables.cff2={}:h=l.tables.cff={};let y=p.formatMajor>1?null:K(n,p.endOffset,mt.bytesToString),A=p.formatMajor>1?null:K(n,y.endOffset),_=p.formatMajor>1?null:K(n,A.endOffset,mt.bytesToString),M=K(n,p.formatMajor>1?i+p.size+p.topDictLength:_.endOffset,void 0,p.formatMajor);l.gsubrs=M.objects,l.gsubrsBias=O(l.gsubrs);let E;if(p.formatMajor>1){let U=i+p.size,te=mt.getBytes(n,U,U+p.topDictLength);E=Ut(n,0,[te],void 0,p.formatMajor)[0]}else{let U=Ut(n,i,A.objects,_.objects,p.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(h.topDict=E,E._privateDict&&(l.defaultWidthX=E._privateDict.defaultWidthX,l.nominalWidthX=E._privateDict.nominalWidthX),p.formatMajor<2&&E.ros[0]!==void 0&&E.ros[1]!==void 0&&(l.isCIDFont=!0),p.formatMajor>1){let U=E.fdArray,te=E.fdSelect;if(!U)throw new Error("This is a CFF2 font, but FDArray information is missing");let Y=K(n,i+U,null,p.formatMajor),ae=Xt(n,i,Y.objects);E._fdArray=ae,te&&(E._fdSelect=Or(n,i+te,l.numGlyphs,ae.length,p.formatMajor))}else if(l.isCIDFont){let U=E.fdArray,te=E.fdSelect;if(U===0||te===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");U+=i;let Y=K(n,U),ae=Ut(n,i,Y.objects,_.objects,p.formatMajor);E._fdArray=ae,te+=i,E._fdSelect=Or(n,te,l.numGlyphs,ae.length,p.formatMajor)}if(p.formatMajor<2){let U=i+E.private[1],te=Wt(n,U,E.private[0],_.objects,p.formatMajor);if(l.defaultWidthX=te.defaultWidthX,l.nominalWidthX=te.nominalWidthX,te.subrs!==0){let Y=U+te.subrs,ae=K(n,Y);l.subrs=ae.objects,l.subrsBias=O(l.subrs)}else l.subrs=[],l.subrsBias=0}let z;if(d.lowMemory?(z=oe(n,i+E.charStrings,p.formatMajor),l.nGlyphs=z.offsets.length-(p.formatMajor>1?1:0)):(z=K(n,i+E.charStrings,null,p.formatMajor),l.nGlyphs=z.objects.length),p.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})`),p.formatMajor<2){let U=[],te=[];E.charset===0?U=li:E.charset===1?U=_r:E.charset===2?U=Un:U=Mr(n,i+E.charset,l.nGlyphs,_.objects,l.isCIDFont),E.encoding===0?te=Ot:E.encoding===1?te=qs:te=Pr(n,i+E.encoding),l.cffEncoding=new Xn(te,U),l.encoding=l.encoding||l.cffEncoding}if(l.glyphs=new Er.GlyphSet(l),d.lowMemory)l._push=function(U){let te=Ne(U,z.offsets,n,i+E.charStrings,void 0,p.formatMajor);l.glyphs.push(U,Er.cffGlyphLoader(l,U,fs,te,p.formatMajor))};else for(let U=0;U<l.nGlyphs;U+=1){let te=z.objects[U];l.glyphs.push(U,Er.cffGlyphLoader(l,U,fs,te,p.formatMajor))}if(E.vstore){let U=new mt.Parser(n,i+E.vstore);E._vstore=U.parseVariationStore()}}function Us(n,i){let l,d=ds.indexOf(n);return d>=0&&(l=d),d=i.indexOf(n),d>=0?l=d+ds.length:(l=ds.length+i.length,i.push(n)),l}function Ea(){return new ye.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 go(n){let i=new ye.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);i.names=[];for(let l=0;l<n.length;l+=1)i.names.push({name:"name_"+l,type:"NAME",value:n[l]});return i}function sa(n,i,l){let d={};for(let h=0;h<n.length;h+=1){let p=n[h],y=i[p.name];y!==void 0&&!Xr(y,p.value)&&(p.type==="SID"&&(y=Us(y,l)),d[p.op]={name:p.name,type:p.type,value:y})}return d}function Za(n,i,l){let d=new ye.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=sa(l>1?Wr:Gr,n,i),d}function Fo(n){let i=new ye.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return i.topDicts=[{name:"topDict_0",type:"TABLE",value:n}],i}function Uo(n){let i=new ye.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);i.strings=[];for(let l=0;l<n.length;l+=1)i.strings.push({name:"string_"+l,type:"STRING",value:n[l]});return i}function ro(){return new ye.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function ia(n,i){let l=new ye.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let d=0;d<n.length;d+=1){let h=n[d],p=Us(h,i);l.fields.push({name:"glyph_"+d,type:"SID",value:p})}return l}function Wi(n,i){let l=[],d=n.path;i<2&&l.push({name:"width",type:"NUMBER",value:n.advanceWidth});let h=0,p=0;for(let y=0;y<d.commands.length;y+=1){let A,_,M=d.commands[y];if(M.type==="Q"){let E=.3333333333333333,z=2/3;M={type:"C",x:M.x,y:M.y,x1:Math.round(E*h+z*M.x1),y1:Math.round(E*p+z*M.y1),x2:Math.round(E*M.x+z*M.x1),y2:Math.round(E*M.y+z*M.y1)}}if(M.type==="M")A=Math.round(M.x-h),_=Math.round(M.y-p),l.push({name:"dx",type:"NUMBER",value:A}),l.push({name:"dy",type:"NUMBER",value:_}),l.push({name:"rmoveto",type:"OP",value:21}),h=Math.round(M.x),p=Math.round(M.y);else if(M.type==="L")A=Math.round(M.x-h),_=Math.round(M.y-p),l.push({name:"dx",type:"NUMBER",value:A}),l.push({name:"dy",type:"NUMBER",value:_}),l.push({name:"rlineto",type:"OP",value:5}),h=Math.round(M.x),p=Math.round(M.y);else if(M.type==="C"){let E=Math.round(M.x1-h),z=Math.round(M.y1-p),U=Math.round(M.x2-M.x1),te=Math.round(M.y2-M.y1);A=Math.round(M.x-M.x2),_=Math.round(M.y-M.y2),l.push({name:"dx1",type:"NUMBER",value:E}),l.push({name:"dy1",type:"NUMBER",value:z}),l.push({name:"dx2",type:"NUMBER",value:U}),l.push({name:"dy2",type:"NUMBER",value:te}),l.push({name:"dx",type:"NUMBER",value:A}),l.push({name:"dy",type:"NUMBER",value:_}),l.push({name:"rrcurveto",type:"OP",value:8}),h=Math.round(M.x),p=Math.round(M.y)}}return i<2&&l.push({name:"endchar",type:"OP",value:14}),l}function oa(n,i){let l=new ye.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let d=0;d<n.length;d+=1){let h=n.get(d),p=Wi(h,i);l.charStrings.push({name:h.name,type:"CHARSTRING",value:p})}return l}function Rs(n,i,l){let d=new ye.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=sa(l>1?Sn:on,n,i),d}function ci(n,i){let l=new ye.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/i.unitsPerEm,h={version:i.version,fullName:i.fullName,familyName:i.familyName,weight:i.weightName,fontBBox:i.fontBBox||[0,0,0,0],fontMatrix:[d,0,0,d,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},p=i&&i.topDict||{};p.paintType&&(h.paintType=p.paintType,h.strokeWidth=p.strokeWidth||0);let y={},A=[],_;for(let U=1;U<n.length;U+=1)_=n.get(U),A.push(_.name);let M=[];l.header=Ea(),l.nameIndex=go([i.postScriptName]);let E=Za(h,M);l.topDictIndex=Fo(E),l.globalSubrIndex=ro(),l.charsets=ia(A,M),l.charStringsIndex=oa(n,1),l.privateDict=Rs(y,M),l.stringIndex=Uo(M);let z=l.header.sizeOf()+l.nameIndex.sizeOf()+l.topDictIndex.sizeOf()+l.stringIndex.sizeOf()+l.globalSubrIndex.sizeOf();return h.charset=z,h.encoding=0,h.charStrings=h.charset+l.charsets.sizeOf(),h.private[1]=h.charStrings+l.charStringsIndex.sizeOf(),E=Za(h,M),l.topDictIndex=Fo(E),l}var ss={parse:Gi,make:ci};function Ya(n,i){let l={},d=new mt.Parser(n,i);return l.version=d.parseVersion(),l.fontRevision=Math.round(d.parseFixed()*1e3)/1e3,l.checkSumAdjustment=d.parseULong(),l.magicNumber=d.parseULong(),ce.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 Cs(n){let i=Math.round(new Date().getTime()/1e3)+2082844800,l=i,d=n.macStyle||0;return n.createdTimestamp&&(l=n.createdTimestamp+2082844800),new ye.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:i},{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 aa={parse:Ya,make:Cs};function Ma(n,i){let l={},d=new mt.Parser(n,i);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 Vi(n){return new ye.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 xo={parse:Ma,make:Vi};function $o(n,i,l,d,h){let p,y,A=new mt.Parser(n,i);for(let _=0;_<d;_+=1){_<l&&(p=A.parseUShort(),y=A.parseShort());let M=h.get(_);M.advanceWidth=p,M.leftSideBearing=y}}function la(n,i,l,d,h){n._hmtxTableData={};let p,y,A=new mt.Parser(i,l);for(let _=0;_<h;_+=1)_<d&&(p=A.parseUShort(),y=A.parseShort()),n._hmtxTableData[_]={advanceWidth:p,leftSideBearing:y}}function Ra(n,i,l,d,h,p,y){y.lowMemory?la(n,i,l,d,h):$o(i,l,d,h,p)}function Na(n){let i=new ye.Table("hmtx",[]);for(let l=0;l<n.length;l+=1){let d=n.get(l),h=d.advanceWidth||0,p=d.leftSideBearing||0;i.fields.push({name:"advanceWidth_"+l,type:"USHORT",value:h}),i.fields.push({name:"leftSideBearing_"+l,type:"SHORT",value:p})}return i}var zo={parse:Ra,make:Na};function _s(n){let i=new ye.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 h=0;h<n.length;++h){let p=l.indexOf(n[h]);p<0&&(p=l.length,l+=n[h]),i.fields.push({name:"offset "+h,type:"USHORT",value:d+p}),i.fields.push({name:"length "+h,type:"USHORT",value:n[h].length})}return i.fields.push({name:"stringPool",type:"CHARARRAY",value:l}),i}function no(n,i){let l=new mt.Parser(n,i),d=l.parseULong();ce.argument(d===1,"Unsupported ltag table version."),l.skip("uLong",1);let h=l.parseULong(),p=[];for(let y=0;y<h;y++){let A="",_=i+l.parseUShort(),M=l.parseUShort();for(let E=_;E<_+M;++E)A+=String.fromCharCode(n.getInt8(E));p.push(A)}return p}var ca={make:_s,parse:no};function vi(n,i){let l={},d=new mt.Parser(n,i);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 Ka(n){return new ye.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:n}])}var $n={parse:vi,make:Ka},$s=[{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 bo(n){for(let i=0;i<$s.length;i+=1){let l=$s[i];if(n>=l.begin&&n<l.end)return i}return-1}function ua(n,i){let l={},d=new mt.Parser(n,i);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 h=0;h<10;h++)l.panose[h]=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 da(n){return new ye.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 so={parse:ua,make:da,unicodeRanges:$s,getUnicodeRange:bo};function Ys(n,i){let l={},d=new mt.Parser(n,i);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=rn.slice();break;case 2:l.numberOfGlyphs=d.parseUShort(),l.glyphNameIndex=new Array(l.numberOfGlyphs);for(let h=0;h<l.numberOfGlyphs;h++)l.glyphNameIndex[h]=d.parseUShort();l.names=[];for(let h=0;h<l.numberOfGlyphs;h++)if(l.glyphNameIndex[h]>=rn.length){let p=d.parseChar();l.names.push(d.parseString(p))}break;case 2.5:l.numberOfGlyphs=d.parseUShort(),l.offset=new Array(l.numberOfGlyphs);for(let h=0;h<l.numberOfGlyphs;h++)l.offset[h]=d.parseChar();break}return l}function Al(n){let{italicAngle:i=Math.round((n.italicAngle||0)*65536),underlinePosition:l=0,underlineThickness:d=0,isFixedPitch:h=0,minMemType42:p=0,maxMemType42:y=0,minMemType1:A=0,maxMemType1:_=0}=n.tables.post||{};return new ye.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:i},{name:"underlinePosition",type:"FWORD",value:l},{name:"underlineThickness",type:"FWORD",value:d},{name:"isFixedPitch",type:"ULONG",value:h},{name:"minMemType42",type:"ULONG",value:p},{name:"maxMemType42",type:"ULONG",value:y},{name:"minMemType1",type:"ULONG",value:A},{name:"maxMemType1",type:"ULONG",value:_}])}var Ss={parse:Ys,make:Al},zn=new Array(9);zn[1]=function(){let n=this.offset+this.relativeOffset,i=this.parseUShort();if(i===1)return{substFormat:1,coverage:this.parsePointer(ne.coverage),deltaGlyphId:this.parseShort()};if(i===2)return{substFormat:2,coverage:this.parsePointer(ne.coverage),substitute:this.parseOffset16List()};ce.assert(!1,"0x"+n.toString(16)+": lookup type 1 format must be 1 or 2.")},zn[2]=function(){let n=this.parseUShort();return ce.argument(n===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(ne.coverage),sequences:this.parseListOfLists()}},zn[3]=function(){let n=this.parseUShort();return ce.argument(n===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(ne.coverage),alternateSets:this.parseListOfLists()}},zn[4]=function(){let n=this.parseUShort();return ce.argument(n===1,"GSUB ligature table identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(ne.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var vn={sequenceIndex:ne.uShort,lookupListIndex:ne.uShort};zn[5]=function(){let n=this.offset+this.relativeOffset,i=this.parseUShort();if(i===1)return{substFormat:i,coverage:this.parsePointer(ne.coverage),ruleSets:this.parseListOfLists(function(){let l=this.parseUShort(),d=this.parseUShort();return{input:this.parseUShortList(l-1),lookupRecords:this.parseRecordList(d,vn)}})};if(i===2)return{substFormat:i,coverage:this.parsePointer(ne.coverage),classDef:this.parsePointer(ne.classDef),classSets:this.parseListOfLists(function(){let l=this.parseUShort(),d=this.parseUShort();return{classes:this.parseUShortList(l-1),lookupRecords:this.parseRecordList(d,vn)}})};if(i===3){let l=this.parseUShort(),d=this.parseUShort();return{substFormat:i,coverages:this.parseList(l,ne.pointer(ne.coverage)),lookupRecords:this.parseRecordList(d,vn)}}ce.assert(!1,"0x"+n.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},zn[6]=function(){let n=this.offset+this.relativeOffset,i=this.parseUShort();if(i===1)return{substFormat:1,coverage:this.parsePointer(ne.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(vn)}})};if(i===2)return{substFormat:2,coverage:this.parsePointer(ne.coverage),backtrackClassDef:this.parsePointer(ne.classDef),inputClassDef:this.parsePointer(ne.classDef),lookaheadClassDef:this.parsePointer(ne.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(vn)}})};if(i===3)return{substFormat:3,backtrackCoverage:this.parseList(ne.pointer(ne.coverage)),inputCoverage:this.parseList(ne.pointer(ne.coverage)),lookaheadCoverage:this.parseList(ne.pointer(ne.coverage)),lookupRecords:this.parseRecordList(vn)};ce.assert(!1,"0x"+n.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},zn[7]=function(){let n=this.parseUShort();ce.argument(n===1,"GSUB Extension Substitution subtable identifier-format must be 1");let i=this.parseUShort(),l=new ne(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:i,extension:zn[i].call(l)}},zn[8]=function(){let n=this.parseUShort();return ce.argument(n===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(ne.coverage),backtrackCoverage:this.parseList(ne.pointer(ne.coverage)),lookaheadCoverage:this.parseList(ne.pointer(ne.coverage)),substitutes:this.parseUShortList()}};function wi(n,i){i=i||0;let l=new ne(n,i),d=l.parseVersion(1);return ce.argument(d===1||d===1.1,"Unsupported GSUB table version."),d===1?{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(zn)}:{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(zn),variations:l.parseFeatureVariationsList()}}var zs=new Array(9);zs[1]=function(n){if(n.substFormat===1)return new ye.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)},{name:"deltaGlyphID",type:"SHORT",value:n.deltaGlyphId}]);if(n.substFormat===2)return new ye.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)}].concat(ye.ushortList("substitute",n.substitute)));ce.fail("Lookup type 1 substFormat must be 1 or 2.")},zs[2]=function(n){return ce.assert(n.substFormat===1,"Lookup type 2 substFormat must be 1."),new ye.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)}].concat(ye.tableList("seqSet",n.sequences,function(i){return new ye.Table("sequenceSetTable",ye.ushortList("sequence",i))})))},zs[3]=function(n){return ce.assert(n.substFormat===1,"Lookup type 3 substFormat must be 1."),new ye.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)}].concat(ye.tableList("altSet",n.alternateSets,function(i){return new ye.Table("alternateSetTable",ye.ushortList("alternate",i))})))},zs[4]=function(n){return ce.assert(n.substFormat===1,"Lookup type 4 substFormat must be 1."),new ye.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)}].concat(ye.tableList("ligSet",n.ligatureSets,function(i){return new ye.Table("ligatureSetTable",ye.tableList("ligature",i,function(l){return new ye.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:l.ligGlyph}].concat(ye.ushortList("component",l.components,l.components.length+1)))}))})))},zs[5]=function(n){if(n.substFormat===1)return new ye.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:n.substFormat},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)}].concat(ye.tableList("sequenceRuleSet",n.ruleSets,function(i){return i?new ye.Table("sequenceRuleSetTable",ye.tableList("sequenceRule",i,function(l){let d=ye.ushortList("seqLookup",[],l.lookupRecords.length).concat(ye.ushortList("inputSequence",l.input,l.input.length+1));[d[0],d[1]]=[d[1],d[0]];for(let h=0;h<l.lookupRecords.length;h++){let p=l.lookupRecords[h];d=d.concat({name:"sequenceIndex"+h,type:"USHORT",value:p.sequenceIndex}).concat({name:"lookupListIndex"+h,type:"USHORT",value:p.lookupListIndex})}return new ye.Table("sequenceRuleTable",d)})):new ye.Table("NULL",null)})));if(n.substFormat===2)return new ye.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:n.substFormat},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)},{name:"classDef",type:"TABLE",value:new ye.ClassDef(n.classDef)}].concat(ye.tableList("classSeqRuleSet",n.classSets,function(i){return i?new ye.Table("classSeqRuleSetTable",ye.tableList("classSeqRule",i,function(l){let d=ye.ushortList("classes",l.classes,l.classes.length+1).concat(ye.ushortList("seqLookupCount",[],l.lookupRecords.length));for(let h=0;h<l.lookupRecords.length;h++){let p=l.lookupRecords[h];d=d.concat({name:"sequenceIndex"+h,type:"USHORT",value:p.sequenceIndex}).concat({name:"lookupListIndex"+h,type:"USHORT",value:p.lookupListIndex})}return new ye.Table("classSeqRuleTable",d)})):new ye.Table("NULL",null)})));if(n.substFormat===3){let i=[{name:"substFormat",type:"USHORT",value:n.substFormat}];i.push({name:"inputGlyphCount",type:"USHORT",value:n.coverages.length}),i.push({name:"substitutionCount",type:"USHORT",value:n.lookupRecords.length});for(let l=0;l<n.coverages.length;l++){let d=n.coverages[l];i.push({name:"inputCoverage"+l,type:"TABLE",value:new ye.Coverage(d)})}for(let l=0;l<n.lookupRecords.length;l++){let d=n.lookupRecords[l];i=i.concat({name:"sequenceIndex"+l,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+l,type:"USHORT",value:d.lookupListIndex})}return new ye.Table("contextualSubstitutionTable",i)}ce.assert(!1,"lookup type 5 format must be 1, 2 or 3.")},zs[6]=function(n){if(n.substFormat===1)return new ye.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:n.substFormat},{name:"coverage",type:"TABLE",value:new ye.Coverage(n.coverage)}].concat(ye.tableList("chainRuleSet",n.chainRuleSets,function(i){return new ye.Table("chainRuleSetTable",ye.tableList("chainRule",i,function(l){let d=ye.ushortList("backtrackGlyph",l.backtrack,l.backtrack.length).concat(ye.ushortList("inputGlyph",l.input,l.input.length+1)).concat(ye.ushortList("lookaheadGlyph",l.lookahead,l.lookahead.length)).concat(ye.ushortList("substitution",[],l.lookupRecords.length));for(let h=0;h<l.lookupRecords.length;h++){let p=l.lookupRecords[h];d=d.concat({name:"sequenceIndex"+h,type:"USHORT",value:p.sequenceIndex}).concat({name:"lookupListIndex"+h,type:"USHORT",value:p.lookupListIndex})}return new ye.Table("chainRuleTable",d)}))})));if(n.substFormat===2)ce.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(n.substFormat===3){let i=[{name:"substFormat",type:"USHORT",value:n.substFormat}];i.push({name:"backtrackGlyphCount",type:"USHORT",value:n.backtrackCoverage.length});for(let l=0;l<n.backtrackCoverage.length;l++){let d=n.backtrackCoverage[l];i.push({name:"backtrackCoverage"+l,type:"TABLE",value:new ye.Coverage(d)})}i.push({name:"inputGlyphCount",type:"USHORT",value:n.inputCoverage.length});for(let l=0;l<n.inputCoverage.length;l++){let d=n.inputCoverage[l];i.push({name:"inputCoverage"+l,type:"TABLE",value:new ye.Coverage(d)})}i.push({name:"lookaheadGlyphCount",type:"USHORT",value:n.lookaheadCoverage.length});for(let l=0;l<n.lookaheadCoverage.length;l++){let d=n.lookaheadCoverage[l];i.push({name:"lookaheadCoverage"+l,type:"TABLE",value:new ye.Coverage(d)})}i.push({name:"substitutionCount",type:"USHORT",value:n.lookupRecords.length});for(let l=0;l<n.lookupRecords.length;l++){let d=n.lookupRecords[l];i=i.concat({name:"sequenceIndex"+l,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+l,type:"USHORT",value:d.lookupListIndex})}return new ye.Table("chainContextTable",i)}ce.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function ha(n){return new ye.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new ye.ScriptList(n.scripts)},{name:"features",type:"TABLE",value:new ye.FeatureList(n.features)},{name:"lookups",type:"TABLE",value:new ye.LookupList(n.lookups,zs)}])}var qi={parse:wi,make:ha};function Ii(n,i){let l=new mt.Parser(n,i),d=l.parseULong();ce.argument(d===1,"Unsupported META table version."),l.parseULong(),l.parseULong();let h=l.parseULong(),p={};for(let y=0;y<h;y++){let A=l.parseTag(),_=l.parseULong(),M=l.parseULong();if(A==="appl"||A==="bild")continue;let E=bt.UTF8(n,i+_,M);p[A]=E}return p}function ki(n){let i=Object.keys(n).length,l="",d=16+i*12,h=new ye.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:i}]);for(let p in n){let y=l.length;l+=n[p],h.fields.push({name:"tag "+p,type:"TAG",value:p}),h.fields.push({name:"offset "+p,type:"ULONG",value:d+y}),h.fields.push({name:"length "+p,type:"ULONG",value:n[p].length})}return h.fields.push({name:"stringPool",type:"CHARARRAY",value:l}),h}var an={parse:Ii,make:ki};function Zi(n,i){let l=new ne(n,i),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 h=l.parseUShort(),p=l.parseOffset32(),y=l.parseOffset32(),A=l.parseUShort();l.relativeOffset=p;let _=l.parseRecordList(h,{glyphID:ne.uShort,firstLayerIndex:ne.uShort,numLayers:ne.uShort});l.relativeOffset=y;let M=l.parseRecordList(A,{glyphID:ne.uShort,paletteIndex:ne.uShort});return{version:d,baseGlyphRecords:_,layerRecords:M}}function J({version:n=0,baseGlyphRecords:i=[],layerRecords:l=[]}){ce.argument(n===0,"Only COLRv0 supported.");let d=14,h=d+i.length*6;return new ye.Table("COLR",[{name:"version",type:"USHORT",value:n},{name:"numBaseGlyphRecords",type:"USHORT",value:i.length},{name:"baseGlyphRecordsOffset",type:"ULONG",value:d},{name:"layerRecordsOffset",type:"ULONG",value:h},{name:"numLayerRecords",type:"USHORT",value:l.length},...i.map((p,y)=>[{name:"glyphID_"+y,type:"USHORT",value:p.glyphID},{name:"firstLayerIndex_"+y,type:"USHORT",value:p.firstLayerIndex},{name:"numLayers_"+y,type:"USHORT",value:p.numLayers}]).flat(),...l.map((p,y)=>[{name:"LayerGlyphID_"+y,type:"USHORT",value:p.glyphID},{name:"paletteIndex_"+y,type:"USHORT",value:p.paletteIndex}]).flat()])}var je={parse:Zi,make:J};function ot(n,i){return[{name:"tag_"+n,type:"TAG",value:i.tag},{name:"minValue_"+n,type:"FIXED",value:i.minValue<<16},{name:"defaultValue_"+n,type:"FIXED",value:i.defaultValue<<16},{name:"maxValue_"+n,type:"FIXED",value:i.maxValue<<16},{name:"flags_"+n,type:"USHORT",value:0},{name:"nameID_"+n,type:"USHORT",value:i.axisNameID}]}function At(n,i,l){let d={},h=new mt.Parser(n,i);d.tag=h.parseTag(),d.minValue=h.parseFixed(),d.defaultValue=h.parseFixed(),d.maxValue=h.parseFixed(),h.skip("uShort",1);let p=h.parseUShort();return d.axisNameID=p,d.name=Zn(l,p),d}function Ae(n,i,l,d={}){let h=[{name:"nameID_"+n,type:"USHORT",value:i.subfamilyNameID},{name:"flags_"+n,type:"USHORT",value:0}];for(let p=0;p<l.length;++p){let y=l[p].tag;h.push({name:"axis_"+n+" "+y,type:"FIXED",value:i.coordinates[y]<<16})}return d&&d.postScriptNameID&&h.push({name:"postScriptNameID_",type:"USHORT",value:i.postScriptNameID!==void 0?i.postScriptNameID:65535}),h}function xt(n,i,l,d,h){let p={},y=new mt.Parser(n,i),A=y.parseUShort();p.subfamilyNameID=A,p.name=Zn(d,A,[2,17]),y.skip("uShort",1),p.coordinates={};for(let M=0;M<l.length;++M)p.coordinates[l[M].tag]=y.parseFixed();if(y.relativeOffset===h)return p.postScriptNameID=void 0,p.postScriptName=void 0,p;let _=y.parseUShort();return p.postScriptNameID=_==65535?void 0:_,p.postScriptName=p.postScriptNameID!==void 0?Zn(d,_,[6]):"",p}function cr(n,i){let l=new ye.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 h=0;h<n.axes.length;h++)l.fields=l.fields.concat(ot(h,n.axes[h],i));let d={};for(let h=0;h<n.instances.length;h++)if(n.instances[h].postScriptNameID!==void 0){l.instanceSize+=2,d.postScriptNameID=!0;break}for(let h=0;h<n.instances.length;h++)l.fields=l.fields.concat(Ae(h,n.instances[h],n.axes,d));return l}function Fr(n,i,l){let d=new mt.Parser(n,i),h=d.parseULong();ce.argument(h===65536,"Unsupported fvar table version.");let p=d.parseOffset16();d.skip("uShort",1);let y=d.parseUShort(),A=d.parseUShort(),_=d.parseUShort(),M=d.parseUShort(),E=[];for(let te=0;te<y;te++)E.push(At(n,i+p+te*A,l));let z=[],U=i+p+y*A;for(let te=0;te<_;te++)z.push(xt(n,U+te*M,E,l,M));return{axes:E,instances:z}}var nn={make:cr,parse:Fr},Ar={tag:ne.tag,nameID:ne.uShort,ordering:ne.uShort},Hn=new Array(5);Hn[1]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed()}},Hn[2]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),nominalValue:this.parseFixed(),rangeMinValue:this.parseFixed(),rangeMaxValue:this.parseFixed()}},Hn[3]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed(),linkedValue:this.parseFixed()}},Hn[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 Mn(){let n=this.parseUShort(),i=Hn[n],l={format:n};return i===void 0?(console.warn(`Unknown axis value table format ${n}`),l):Object.assign(l,this.parseStruct(i.bind(this)))}function Ls(n,i,l){i||(i=0);let d=new mt.Parser(n,i),h=d.parseUShort(),p=d.parseUShort();h!==1&&console.warn(`Unsupported STAT table version ${h}.${p}`);let y=[h,p],A=d.parseUShort(),_=d.parseUShort(),M=d.parseOffset32(),E=d.parseUShort(),z=d.parseOffset32(),U=h>1||p>0?d.parseUShort():void 0;l!==void 0&&ce.argument(_>=l.axes.length,"STAT axis count must be greater than or equal to fvar axis count"),E>0&&ce.argument(_>=0,"STAT axis count must be greater than 0 if STAT axis value count is greater than 0");let te=[];for(let ze=0;ze<_;ze++)d.offset=i+M,d.relativeOffset=ze*A,te.push(d.parseStruct(Ar));d.offset=i,d.relativeOffset=z;let Y=d.parseUShortList(E),ae=[];for(let ze=0;ze<E;ze++)d.offset=i+z,d.relativeOffset=Y[ze],ae.push(Mn.apply(d));return{version:y,axes:te,values:ae,elidedFallbackNameID:U}}var Is=new Array(5);Is[1]=function(n,i){return[{name:`format${n}`,type:"USHORT",value:1},{name:`axisIndex${n}`,type:"USHORT",value:i.axisIndex},{name:`flags${n}`,type:"USHORT",value:i.flags},{name:`valueNameID${n}`,type:"USHORT",value:i.valueNameID},{name:`value${n}`,type:"FLOAT",value:i.value}]},Is[2]=function(n,i){return[{name:`format${n}`,type:"USHORT",value:2},{name:`axisIndex${n}`,type:"USHORT",value:i.axisIndex},{name:`flags${n}`,type:"USHORT",value:i.flags},{name:`valueNameID${n}`,type:"USHORT",value:i.valueNameID},{name:`nominalValue${n}`,type:"FLOAT",value:i.nominalValue},{name:`rangeMinValue${n}`,type:"FLOAT",value:i.rangeMinValue},{name:`rangeMaxValue${n}`,type:"FLOAT",value:i.rangeMaxValue}]},Is[3]=function(n,i){return[{name:`format${n}`,type:"USHORT",value:3},{name:`axisIndex${n}`,type:"USHORT",value:i.axisIndex},{name:`flags${n}`,type:"USHORT",value:i.flags},{name:`valueNameID${n}`,type:"USHORT",value:i.valueNameID},{name:`value${n}`,type:"FLOAT",value:i.value},{name:`linkedValue${n}`,type:"FLOAT",value:i.linkedValue}]},Is[4]=function(n,i){let l=[{name:`format${n}`,type:"USHORT",value:4},{name:`axisCount${n}`,type:"USHORT",value:i.axisValues.length},{name:`flags${n}`,type:"USHORT",value:i.flags},{name:`valueNameID${n}`,type:"USHORT",value:i.valueNameID}];for(let d=0;d<i.axisValues.length;d++)l=l.concat([{name:`format${n}axisIndex${d}`,type:"USHORT",value:i.axisValues[d].axisIndex},{name:`format${n}value${d}`,type:"FLOAT",value:i.axisValues[d].value}]);return l};function io(n,i){return new ye.Record("axisRecord_"+n,[{name:"axisTag_"+n,type:"TAG",value:i.tag},{name:"axisNameID_"+n,type:"USHORT",value:i.nameID},{name:"axisOrdering_"+n,type:"USHORT",value:i.ordering}])}function Hs(n,i){let l=i.format,d=Is[l];ce.argument(d!==void 0,`Unknown axis value table format ${l}`);let h=d(n,i);return new ye.Table("axisValueTable_"+n,h)}function Da(n){let i=new ye.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}]);i.designAxesOffset=i.offsetToAxisValueOffsets=i.sizeOf();for(let p=0;p<n.axes.length;p++){let y=io(p,n.axes[p]);i.offsetToAxisValueOffsets+=y.sizeOf(),i.fields=i.fields.concat(y.fields)}let l=[],d=[],h=n.values.length*2;for(let p=0;p<n.values.length;p++){let y=Hs(p,n.values[p]);l.push({name:"offset_"+p,type:"USHORT",value:h}),h+=y.sizeOf(),d=d.concat(y.fields)}return i.fields=i.fields.concat(l),i.fields=i.fields.concat(d),i}var Ln={make:Da,parse:Ls};function ui(n,i){return new ye.Record("axisValueMap_"+n,[{name:"fromCoordinate_"+n,type:"F2DOT14",value:i.fromCoordinate},{name:"toCoordinate_"+n,type:"F2DOT14",value:i.toCoordinate}])}function Xa(n,i){let l=new ye.Record("segmentMap_"+n,[{name:"positionMapCount_"+n,type:"USHORT",value:i.axisValueMaps.length}]),d=[];for(let h=0;h<i.axisValueMaps.length;h++){let p=ui(`${n}_${h}`,i.axisValueMaps[h]);d=d.concat(p.fields)}return l.fields=l.fields.concat(d),l}function Jl(n,i){ce.argument(n.axisSegmentMaps.length===i.axes.length,"avar axis count must correspond to fvar axis count");let l=new ye.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 h=Xa(d,n.axisSegmentMaps[d]);l.fields=l.fields.concat(h.fields)}return l}function e0(n,i,l){i||(i=0);let d=new ne(n,i),h=d.parseUShort(),p=d.parseUShort();h!==1&&console.warn(`Unsupported avar table version ${h}.${p}`),d.skip("uShort",1);let y=d.parseUShort();ce.argument(y===l.axes.length,"avar axis count must correspond to fvar axis count");let A=[];for(let _=0;_<y;_++){let M=[],E=d.parseUShort();for(let z=0;z<E;z++){let U=d.parseF2Dot14(),te=d.parseF2Dot14();M.push({fromCoordinate:U,toCoordinate:te})}A.push({axisValueMaps:M})}return{version:[h,p],axisSegmentMaps:A}}var L={make:Jl,parse:e0};function B(n,i,l,d){let h=new mt.Parser(n,i),p=h.parseTupleVariationStore(h.relativeOffset,l.axes.length,"cvar",d),y=h.parseUShort(),A=h.parseUShort();return y!==1&&console.warn(`Unsupported cvar table version ${y}.${A}`),{version:[y,A],...p}}function j(){console.warn("Writing of cvar tables is not yet supported.")}var H={make:j,parse:B};function ke(n,i,l,d){let h=new mt.Parser(n,i),p=h.parseUShort(),y=h.parseUShort();p!==1&&console.warn(`Unsupported gvar table version ${p}.${y}`);let A=h.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 _=h.parseUShort(),M=h.parsePointer32(function(){return this.parseTupleRecords(_,A)}),E=h.parseTupleVariationStoreList(A,"gvar",d);return{version:[p,y],sharedTuples:M,glyphVariations:E}}function we(){console.warn("Writing of gvar tables is not yet supported.")}var Ye={make:we,parse:ke};function Ke(n,i){let l={},d=new mt.Parser(n,i);l.version=d.parseUShort(),ce.argument(l.version<=1,"Unsupported gasp table version."),l.numRanges=d.parseUShort(),l.gaspRanges=[];for(let h=0;h<l.numRanges;h++)l.gaspRanges[h]={rangeMaxPPEM:d.parseUShort(),rangeGaspBehavior:d.parseUShort()};return l}function Et(n){let i=new ye.Table("gasp",[{name:"version",type:"USHORT",value:1},{name:"numRanges",type:"USHORT",value:n.numRanges}]);for(let l in n.gaspRanges)i.fields.push({name:"rangeMaxPPEM",type:"USHORT",value:n.gaspRanges[l].rangeMaxPPEM}),i.fields.push({name:"rangeGaspBehavior",type:"USHORT",value:n.gaspRanges[l].rangeGaspBehavior});return i}var fr={parse:Ke,make:Et};function ln(n,i){let l=new Map,d=n.buffer,h=new ne(n,i);if(h.parseUShort()!==0)return l;h.relativeOffset=h.parseOffset32();let p=n.byteOffset+i+h.relativeOffset,y=h.parseUShort(),A=new Map;for(let _=0;_<y;_++){let M=h.parseUShort(),E=h.parseUShort(),z=p+h.parseOffset32(),U=h.parseULong(),te=A.get(z);te===void 0&&(te=new Uint8Array(d,z,U),A.set(z,te));for(let Y=M;Y<=E;Y++)l.set(Y,te)}return l}function hn(n){let i=Array.from(n.keys()).sort(),l=[],d=[],h=new Map,p=0,y={endGlyphID:null};for(let U=0,te=i.length;U<te;U++){let Y=i[U],ae=n.get(Y),ze=h.get(ae);ze===void 0&&(ze=p,d.push(ae),h.set(ae,ze),p+=ae.byteLength),Y-1===y.endGlyphID&&ze===y.svgDocOffset?y.endGlyphID=Y:(y={startGlyphID:Y,endGlyphID:Y,svgDocOffset:ze,svgDocLength:ae.byteLength},l.push(y))}let A=l.length,_=d.length,M=2+A*12,E=new Array(4+A*4+_),z=0;E[z++]={name:"version",type:"USHORT",value:0},E[z++]={name:"svgDocumentListOffset",type:"ULONG",value:10},E[z++]={name:"reserved",type:"ULONG",value:0},E[z++]={name:"numEntries",type:"USHORT",value:A};for(let U=0;U<A;U++){let te="documentRecord_"+U,{startGlyphID:Y,endGlyphID:ae,svgDocOffset:ze,svgDocLength:Jt}=l[U];E[z++]={name:te+"_startGlyphID",type:"USHORT",value:Y},E[z++]={name:te+"_endGlyphID",type:"USHORT",value:ae},E[z++]={name:te+"_svgDocOffset",type:"ULONG",value:M+ze},E[z++]={name:te+"_svgDocLength",type:"ULONG",value:Jt}}for(let U=0;U<_;U++)E[z++]={name:"svgDoc_"+U,type:"LITERAL",value:d[U]};return new ye.Table("SVG ",E)}var fn={make:hn,parse:ln};function nr(n){return Math.log(n)/Math.log(2)|0}function Nr(n){for(;n.length%4!==0;)n.push(0);let i=0;for(let l=0;l<n.length;l+=4)i+=(n[l]<<24)+(n[l+1]<<16)+(n[l+2]<<8)+n[l+3];return i%=Math.pow(2,32),i}function ps(n,i,l,d){return new ye.Record("Table Record",[{name:"tag",type:"TAG",value:n!==void 0?n:""},{name:"checkSum",type:"ULONG",value:i!==void 0?i:0},{name:"offset",type:"ULONG",value:l!==void 0?l:0},{name:"length",type:"ULONG",value:d!==void 0?d:0}])}function Gn(n){let i=new ye.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}]);i.tables=n,i.numTables=n.length;let l=Math.pow(2,nr(i.numTables));i.searchRange=16*l,i.entrySelector=nr(l),i.rangeShift=i.numTables*16-i.searchRange;let d=[],h=[],p=i.sizeOf()+ps().sizeOf()*i.numTables;for(;p%4!==0;)p+=1,h.push({name:"padding",type:"BYTE",value:0});for(let y=0;y<n.length;y+=1){let A=n[y];ce.argument(A.tableName.length===4,"Table name"+A.tableName+" is invalid.");let _=A.sizeOf(),M=ps(A.tableName,Nr(A.encode()),p,_);for(d.push({name:M.tag+" Table Record",type:"RECORD",value:M}),h.push({name:A.tableName+" table",type:"RECORD",value:A}),p+=_,ce.argument(!isNaN(p),"Something went wrong calculating the offset.");p%4!==0;)p+=1,h.push({name:"padding",type:"BYTE",value:0})}return d.sort(function(y,A){return y.value.tag>A.value.tag?1:-1}),i.fields=i.fields.concat(d),i.fields=i.fields.concat(h),i}function oo(n,i,l){for(let d=0;d<i.length;d+=1){let h=n.charToGlyphIndex(i[d]);if(h>0)return n.glyphs.get(h).getMetrics()}return l}function Wn(n){let i=0;for(let l=0;l<n.length;l+=1)i+=n[l];return i/n.length}function yo(n){let i=[],l=[],d=[],h=[],p=[],y=[],A=[],_,M=0,E=0,z=0,U=0,te=0;for(let Vn=0;Vn<n.glyphs.length;Vn+=1){let Yi=n.glyphs.get(Vn),Co=Yi.unicode|0;if(isNaN(Yi.advanceWidth))throw new Error("Glyph "+Yi.name+" ("+Vn+"): advanceWidth is not a number.");(_>Co||_===void 0)&&Co>0&&(_=Co),M<Co&&(M=Co);let Yo=so.getUnicodeRange(Co);if(Yo<32)E|=1<<Yo;else if(Yo<64)z|=1<<Yo-32;else if(Yo<96)U|=1<<Yo-64;else if(Yo<123)te|=1<<Yo-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(Yi.name===".notdef")continue;let ja=Yi.getMetrics();i.push(ja.xMin),l.push(ja.yMin),d.push(ja.xMax),h.push(ja.yMax),y.push(ja.leftSideBearing),A.push(ja.rightSideBearing),p.push(Yi.advanceWidth)}let Y={xMin:Math.min.apply(null,i),yMin:Math.min.apply(null,l),xMax:Math.max.apply(null,d),yMax:Math.max.apply(null,h),advanceWidthMax:Math.max.apply(null,p),advanceWidthAvg:Wn(p),minLeftSideBearing:Math.min.apply(null,y),maxLeftSideBearing:Math.max.apply(null,y),minRightSideBearing:Math.min.apply(null,A)};Y.ascender=n.ascender,Y.descender=n.descender;let ae=0;n.weightClass>=600&&(ae|=n.macStyleValues.BOLD),n.italicAngle<0&&(ae|=n.macStyleValues.ITALIC);let ze=aa.make({flags:3,unitsPerEm:n.unitsPerEm,xMin:Y.xMin,yMin:Y.yMin,xMax:Y.xMax,yMax:Y.yMax,lowestRecPPEM:3,macStyle:ae,createdTimestamp:n.createdTimestamp}),Jt=xo.make({ascender:Y.ascender,descender:Y.descender,advanceWidthMax:Y.advanceWidthMax,minLeftSideBearing:Y.minLeftSideBearing,minRightSideBearing:Y.minRightSideBearing,xMaxExtent:Y.maxLeftSideBearing+(Y.xMax-Y.xMin),numberOfHMetrics:n.glyphs.length}),Vt=$n.make(n.glyphs.length),mr=so.make(Object.assign({xAvgCharWidth:Math.round(Y.advanceWidthAvg),usFirstCharIndex:_,usLastCharIndex:M,ulUnicodeRange1:E,ulUnicodeRange2:z,ulUnicodeRange3:U,ulUnicodeRange4:te,sTypoAscender:Y.ascender,sTypoDescender:Y.descender,sTypoLineGap:0,usWinAscent:Y.yMax,usWinDescent:Math.abs(Y.yMin),ulCodePageRange1:1,sxHeight:oo(n,"xyvw",{yMax:Math.round(Y.ascender/2)}).yMax,sCapHeight:oo(n,"HIKLEFJMNTZBDPRAGOQSUVWXY",Y).yMax,usDefaultChar:n.hasChar(" ")?32:0,usBreakChar:n.hasChar(" ")?32:0},n.tables.os2)),Dr=zo.make(n.glyphs),An=xn.make(n.glyphs),Dn=n.getEnglishName("fontFamily"),Qn=n.getEnglishName("fontSubfamily"),Bs=Dn+" "+Qn,qo=n.getEnglishName("postScriptName");qo||(qo=Dn.replace(/\s/g,"")+"-"+Qn);let Qr={};for(let Vn in n.names)Qr[Vn]=n.names[Vn];Qr.unicode=Qr.unicode||{},Qr.macintosh=Qr.macintosh||{},Qr.windows=Qr.windows||{};let lo=n.names.unicode||{},Ni=n.names.macintosh||{},er=n.names.windows||{};for(let Vn in Qr){if(Qr[Vn]=Qr[Vn]||{},!Qr[Vn].uniqueID){let Yi=n.getEnglishName("manufacturer")||"";Qr[Vn].uniqueID={en:`${Yi}: ${Bs}`}}Qr[Vn].postScriptName||(Qr[Vn].postScriptName={en:qo})}Qr.unicode.preferredFamily||(Qr.unicode.preferredFamily=lo.fontFamily||Ni.fontFamily||er.fontFamily),Qr.macintosh.preferredFamily||(Qr.macintosh.preferredFamily=Ni.fontFamily||lo.fontFamily||er.fontFamily),Qr.windows.preferredFamily||(Qr.windows.preferredFamily=er.fontFamily||lo.fontFamily||Ni.fontFamily),Qr.unicode.preferredSubfamily||(Qr.unicode.preferredSubfamily=lo.fontSubfamily||Ni.fontSubfamily||er.fontSubfamily),Qr.macintosh.preferredSubfamily||(Qr.macintosh.preferredSubfamily=Ni.fontSubfamily||lo.fontSubfamily||er.fontSubfamily),Qr.windows.preferredSubfamily||(Qr.windows.preferredSubfamily=er.fontSubfamily||lo.fontSubfamily||Ni.fontSubfamily);let $t=[],Gt=zt.make(Qr,$t),Ci=$t.length>0?ca.make($t):void 0,cl=Ss.make(n),bu=ss.make(n.glyphs,{version:n.getEnglishName("version"),fullName:Bs,familyName:Dn,weightName:Qn,postScriptName:qo,unitsPerEm:n.unitsPerEm,fontBBox:[0,Y.yMin,Y.ascender,Y.advanceWidthMax],topDict:n.tables.cff&&n.tables.cff.topDict||{}}),kl=n.metas&&Object.keys(n.metas).length>0?an.make(n.metas):void 0,Zo=[ze,Jt,Vt,mr,Gt,An,cl,bu,Dr];Ci&&Zo.push(Ci);let Di={gsub:qi,cpal:hr,colr:je,stat:Ln,avar:L,cvar:H,fvar:nn,gvar:Ye,gasp:fr,svg:fn},To={avar:[n.tables.fvar],fvar:[n.names]};for(let Vn in Di){let Yi=n.tables[Vn];if(Yi){let Co=Di[Vn].make.call(n,Yi,...To[Vn]||[]);Co&&Zo.push(Co)}}kl&&Zo.push(kl);let _i=Gn(Zo),co=_i.encode(),Qi=Nr(co),Bi=_i.fields,Ms=!1;for(let Vn=0;Vn<Bi.length;Vn+=1)if(Bi[Vn].name==="head table"){Bi[Vn].value.checkSumAdjustment=2981146554-Qi,Ms=!0;break}if(!Ms)throw new Error("Could not find head table with checkSum to adjust.");return _i}var Ho={make:Gn,fontToTable:yo,computeCheckSum:Nr};function ks(n,i){let l=0,d=n.length-1;for(;l<=d;){let h=l+d>>>1,p=n[h].tag;if(p===i)return h;p<i?l=h+1:d=h-1}return-l-1}function Tl(n,i){let l=0,d=n.length-1;for(;l<=d;){let h=l+d>>>1,p=n[h];if(p===i)return h;p<i?l=h+1:d=h-1}return-l-1}function Qa(n,i){let l,d=0,h=n.length-1;for(;d<=h;){let p=d+h>>>1;l=n[p];let y=l.start;if(y===i)return l;y<i?d=p+1:h=p-1}if(d>0)return l=n[d-1],i>l.end?0:l}function Cl(n,i){this.font=n,this.tableName=i}Cl.prototype={searchTag:ks,binSearch:Tl,getTable:function(n){let i=this.font.tables[this.tableName];return!i&&n&&(i=this.font.tables[this.tableName]=this.createDefaultTable()),i},getScriptNames:function(){let n=this.getTable();return n?n.scripts.map(function(i){return i.tag}):[]},getDefaultScriptName:function(){let n=this.getTable();if(!n)return;let i=!1;for(let l=0;l<n.scripts.length;l++){let d=n.scripts[l].tag;if(d==="DFLT")return d;d==="latn"&&(i=!0)}if(i)return"latn"},getScriptTable:function(n,i){let l=this.getTable(i);if(l){n=n||"DFLT";let d=l.scripts,h=ks(l.scripts,n);if(h>=0)return d[h].script;if(i){let p={tag:n,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return d.splice(-1-h,0,p),p.script}}},getLangSysTable:function(n,i,l){let d=this.getScriptTable(n,l);if(d){if(!i||i==="dflt"||i==="DFLT")return d.defaultLangSys;let h=ks(d.langSysRecords,i);if(h>=0)return d.langSysRecords[h].langSys;if(l){let p={tag:i,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return d.langSysRecords.splice(-1-h,0,p),p.langSys}}},getFeatureTable:function(n,i,l,d){let h=this.getLangSysTable(n,i,d);if(h){let p,y=h.featureIndexes,A=this.font.tables[this.tableName].features;for(let _=0;_<y.length;_++)if(p=A[y[_]],p.tag===l)return p.feature;if(d){let _=A.length;return ce.assert(_===0||l>=A[_-1].tag,"Features must be added in alphabetical order."),p={tag:l,feature:{params:0,lookupListIndexes:[]}},A.push(p),y.push(_),p.feature}}},getLookupTables:function(n,i,l,d,h){let p=this.getFeatureTable(n,i,l,h),y=[];if(p){let A,_=p.lookupListIndexes,M=this.font.tables[this.tableName].lookups;for(let E=0;E<_.length;E++)A=M[_[E]],A.lookupType===d&&y.push(A);if(y.length===0&&h){A={lookupType:d,lookupFlag:0,subtables:[],markFilteringSet:void 0};let E=M.length;return M.push(A),_.push(E),[A]}}return y},getGlyphClass:function(n,i){switch(n.format){case 1:return n.startGlyph<=i&&i<n.startGlyph+n.classes.length?n.classes[i-n.startGlyph]:0;case 2:{let l=Qa(n.ranges,i);return l?l.classId:0}}},getCoverageIndex:function(n,i){switch(n.format){case 1:{let l=Tl(n.glyphs,i);return l>=0?l:-1}case 2:{let l=Qa(n.ranges,i);return l?l.index+i-l.start:-1}}},expandCoverage:function(n){if(n.format===1)return n.glyphs;{let i=[],l=n.ranges;for(let d=0;d<l.length;d++){let h=l[d],p=h.start,y=h.end;for(let A=p;A<=y;A++)i.push(A)}return i}}};var Ei=Cl;function di(n){Ei.call(this,n,"gpos")}di.prototype=Ei.prototype,di.prototype.init=function(){let n=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(n)},di.prototype.getKerningValue=function(n,i,l){for(let d=0;d<n.length;d++){let h=n[d].subtables;for(let p=0;p<h.length;p++){let y=h[p],A=this.getCoverageIndex(y.coverage,i);if(!(A<0))switch(y.posFormat){case 1:{let _=y.pairSets[A];for(let M=0;M<_.length;M++){let E=_[M];if(E.secondGlyph===l)return E.value1&&E.value1.xAdvance||0}break}case 2:{let _=this.getGlyphClass(y.classDef1,i),M=this.getGlyphClass(y.classDef2,l),E=y.classRecords[_][M];return E.value1&&E.value1.xAdvance||0}}}}return 0},di.prototype.getKerningTables=function(n,i){if(this.font.tables.gpos)return this.getLookupTables(n,i,"kern",2)};var Ja=di;function t0(n,i){let l=n.length;if(l!==i.length)return!1;for(let d=0;d<l;d++)if(n[d]!==i[d])return!1;return!0}function Yd(n,i,l){let d=0,h=n.length-1,p=null;for(;d<=h;){let y=Math.floor((d+h)/2),A=n[y],_=A[i];if(_<l)d=y+1;else if(_>l)h=y-1;else{p=A;break}}return p}function Kd(n,i,l){let d=0,h=n.length-1;for(;d<=h;){let p=Math.floor((d+h)/2),y=n[p];if(y[i]<l)d=p+1;else if(y[i]>l)h=p-1;else return p}return-1}function Xd(n,i,l){let d=0,h=n.length,p=(y,A)=>y[i]-A[i];for(;d<h;){let y=d+h>>>1;p(n[y],l)<0?d=y+1:h=y}return n.splice(d,0,l),d}function au(n){return n[0]===31&&n[1]===139&&n[2]===8}function Go(n){let i=new DataView(n.buffer,n.byteOffset,n.byteLength),l=10,d=n.byteLength-8,h=i.getInt8(3);if(h&4&&(l+=2+i.getUint16(l,!0)),h&8)for(;l<d&&n[l++]!==0;);if(h&16)for(;l<d&&n[l++]!==0;);if(h&2&&(l+=2),l>=d)throw new Error("Can't find compressed blocks");let p=i.getUint32(i.byteLength-4,!0);return Oe(n.subarray(l,d),new Uint8Array(p))}function fa(n){return{x:n.x,y:n.y,onCurve:n.onCurve,lastPointOfContour:n.lastPointOfContour}}function Jd(n){return{glyphIndex:n.glyphIndex,xScale:n.xScale,scale01:n.scale01,scale10:n.scale10,yScale:n.yScale,dx:n.dx,dy:n.dy}}function Ks(n){Ei.call(this,n,"gsub")}function r0(n,i,l){let d=n.subtables;for(let h=0;h<d.length;h++){let p=d[h];if(p.substFormat===i)return p}if(l)return d.push(l),l}Ks.prototype=Ei.prototype,Ks.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Ks.prototype.getSingle=function(n,i,l){let d=[],h=this.getLookupTables(i,l,n,1);for(let p=0;p<h.length;p++){let y=h[p].subtables;for(let A=0;A<y.length;A++){let _=y[A],M=this.expandCoverage(_.coverage),E;if(_.substFormat===1){let z=_.deltaGlyphId;for(E=0;E<M.length;E++){let U=M[E];d.push({sub:U,by:U+z})}}else{let z=_.substitute;for(E=0;E<M.length;E++)d.push({sub:M[E],by:z[E]})}}}return d},Ks.prototype.getMultiple=function(n,i,l){let d=[],h=this.getLookupTables(i,l,n,2);for(let p=0;p<h.length;p++){let y=h[p].subtables;for(let A=0;A<y.length;A++){let _=y[A],M=this.expandCoverage(_.coverage),E;for(E=0;E<M.length;E++){let z=M[E],U=_.sequences[E];d.push({sub:z,by:U})}}}return d},Ks.prototype.getAlternates=function(n,i,l){let d=[],h=this.getLookupTables(i,l,n,3);for(let p=0;p<h.length;p++){let y=h[p].subtables;for(let A=0;A<y.length;A++){let _=y[A],M=this.expandCoverage(_.coverage),E=_.alternateSets;for(let z=0;z<M.length;z++)d.push({sub:M[z],by:E[z]})}}return d},Ks.prototype.getLigatures=function(n,i,l){let d=[],h=this.getLookupTables(i,l,n,4);for(let p=0;p<h.length;p++){let y=h[p].subtables;for(let A=0;A<y.length;A++){let _=y[A],M=this.expandCoverage(_.coverage),E=_.ligatureSets;for(let z=0;z<M.length;z++){let U=M[z],te=E[z];for(let Y=0;Y<te.length;Y++){let ae=te[Y];d.push({sub:[U].concat(ae.components),by:ae.ligGlyph})}}}}return d},Ks.prototype.addSingle=function(n,i,l,d){let h=this.getLookupTables(l,d,n,1,!0)[0],p=r0(h,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});ce.assert(p.coverage.format===1,"Single: unable to modify coverage table format "+p.coverage.format);let y=i.sub,A=this.binSearch(p.coverage.glyphs,y);A<0&&(A=-1-A,p.coverage.glyphs.splice(A,0,y),p.substitute.splice(A,0,0)),p.substitute[A]=i.by},Ks.prototype.addMultiple=function(n,i,l,d){ce.assert(i.by instanceof Array&&i.by.length>1,'Multiple: "by" must be an array of two or more ids');let h=this.getLookupTables(l,d,n,2,!0)[0],p=r0(h,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});ce.assert(p.coverage.format===1,"Multiple: unable to modify coverage table format "+p.coverage.format);let y=i.sub,A=this.binSearch(p.coverage.glyphs,y);A<0&&(A=-1-A,p.coverage.glyphs.splice(A,0,y),p.sequences.splice(A,0,0)),p.sequences[A]=i.by},Ks.prototype.addAlternate=function(n,i,l,d){let h=this.getLookupTables(l,d,n,3,!0)[0],p=r0(h,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});ce.assert(p.coverage.format===1,"Alternate: unable to modify coverage table format "+p.coverage.format);let y=i.sub,A=this.binSearch(p.coverage.glyphs,y);A<0&&(A=-1-A,p.coverage.glyphs.splice(A,0,y),p.alternateSets.splice(A,0,0)),p.alternateSets[A]=i.by},Ks.prototype.addLigature=function(n,i,l,d){let h=this.getLookupTables(l,d,n,4,!0)[0],p=h.subtables[0];p||(p={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},h.subtables[0]=p),ce.assert(p.coverage.format===1,"Ligature: unable to modify coverage table format "+p.coverage.format);let y=i.sub[0],A=i.sub.slice(1),_={ligGlyph:i.by,components:A},M=this.binSearch(p.coverage.glyphs,y);if(M>=0){let E=p.ligatureSets[M];for(let z=0;z<E.length;z++)if(t0(E[z].components,A))return;E.push(_)}else M=-1-M,p.coverage.glyphs.splice(M,0,y),p.ligatureSets.splice(M,0,[_])},Ks.prototype.getFeature=function(n,i,l){if(/ss\d\d/.test(n))return this.getSingle(n,i,l);switch(n){case"aalt":case"salt":return this.getSingle(n,i,l).concat(this.getAlternates(n,i,l));case"dlig":case"liga":case"rlig":return this.getLigatures(n,i,l);case"ccmp":return this.getMultiple(n,i,l).concat(this.getLigatures(n,i,l));case"stch":return this.getMultiple(n,i,l)}},Ks.prototype.add=function(n,i,l,d){if(/ss\d\d/.test(n))return this.addSingle(n,i,l,d);switch(n){case"aalt":case"salt":return typeof i.by=="number"?this.addSingle(n,i,l,d):this.addAlternate(n,i,l,d);case"dlig":case"liga":case"rlig":return this.addLigature(n,i,l,d);case"ccmp":return i.by instanceof Array?this.addMultiple(n,i,l,d):this.addLigature(n,i,l,d)}};var lu=Ks,W0=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 i=[],l=this.cpal();if(!l)return i;for(let d=0;d<l.colorRecordIndices.length;d++){let h=l.colorRecordIndices[d],p=[];for(let y=h;y<h+l.numPaletteEntries;y++)p.push(ut(l.colorRecords[y],n||"hexa"));i.push(p)}return i}toCPALcolor(n){return Array.isArray(n)?n.map(i=>br(i,"raw")):br(n,"raw")}fillPalette(n,i=[],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(i)))}extend(n){if(this.ensureCPAL(Array(n).fill(this.defaultValue)))return;let i=this.cpal(),l=i.numPaletteEntries+n,d=this.getAll().map(h=>this.fillPalette(h,[],l));i.numPaletteEntries=l,i.colorRecords=this.toCPALcolor(d.flat()),this.updateIndices()}get(n,i="hexa"){return this.getAll(i)[n]||null}getColor(n,i=0,l="hexa"){return it(this.font,n,i,l)}setColor(n,i,l=0){n=parseInt(n),l=parseInt(l);let d=this.getAll("raw"),h=d[l];if(!h)throw Error(`paletteIndex ${l} out of range`);let p=this.cpal(),y=p.numPaletteEntries;Array.isArray(i)||(i=[i]),i.length+n>y&&(this.extend(i.length+n-y),d=this.getAll("raw"),h=d[l]);for(let A=0;A<i.length;A++)h[A+n]=this.toCPALcolor(i[A]);p.colorRecords=d.flat(),this.updateIndices()}add(n){if(this.ensureCPAL(n))return;let i=this.cpal(),l=i.numPaletteEntries;n&&n.length?(n=this.toCPALcolor(n),n.length>l?this.extend(n.length-l):n.length<l&&(n=this.fillPalette(n)),i.colorRecordIndices.push(i.colorRecords.length),i.colorRecords.push(...n)):(i.colorRecordIndices.push(i.colorRecords.length),i.colorRecords.push(...Array(l).fill(this.defaultValue)))}delete(n){let i=this.getAll("raw");delete i[n];let l=this.cpal();l.colorRecordIndices.pop(),l.colorRecords=i.flat()}deleteColor(n,i){if(n===i)throw Error("replacementIndex cannot be the same as colorIndex");let l=this.cpal(),d=this.getAll("raw"),h=[];if(i>l.numPaletteEntries-1)throw Error(`Replacement index out of range: numPaletteEntries after deletion: ${l.numPaletteEntries-1}, replacementIndex: ${i})`);for(let A=0;A<d.length;A++){let _=d[A].filter((M,E)=>E!==n);h.push(_)}let p=this.font.tables.colr;if(p){let A=p.layerRecords;for(let _=0;_<A.length;_++){let M=A[_].paletteIndex;if(M>n)A[_].paletteIndex-=1;else if(M===n){let E=0;for(let z=0;z<d.length;z++)if(i>n&&i<=n+d[z].length){E++;break}A[_].paletteIndex=i-E}}this.font.tables.colr={...p,layerRecords:A}}let y=h.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(),i=Math.ceil(n.colorRecords.length/n.numPaletteEntries);n.colorRecordIndices=[];for(let l=0;l<i;l++)n.colorRecordIndices.push(l*n.numPaletteEntries)}},cu=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 i=this.font,l=[],d=i.tables.colr,h=i.tables.cpal;if(!d||!h)return l;let p=Yd(d.baseGlyphRecords,"glyphID",n);if(!p)return l;let y=p.firstLayerIndex,A=p.numLayers;for(let _=0;_<A;_++){let M=d.layerRecords[y+_];l.push({glyph:i.glyphs.get(M.glyphID),paletteIndex:M.paletteIndex})}return l}add(n,i,l){let d=this.get(n);i=Array.isArray(i)?i:[i],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 h=[];for(let p=0;p<l;p++){let y=Number.isInteger(d[p].glyph)?d[p].glyph:d[p].glyph.index;h.push({glyphID:y,paletteIndex:d[p].paletteIndex})}for(let p of i){let y=Number.isInteger(p.glyph)?p.glyph:p.glyph.index;h.push({glyphID:y,paletteIndex:p.paletteIndex})}for(let p=l;p<d.length;p++){let y=Number.isInteger(d[p].glyph)?d[p].glyph:d[p].glyph.index;h.push({glyphID:y,paletteIndex:d[p].paletteIndex})}this.updateColrTable(n,h)}setPaletteIndex(n,i,l){let d=this.get(n);d[i]?(d=d.map((h,p)=>({glyphID:h.glyph.index,paletteIndex:p===i?l:h.paletteIndex})),this.updateColrTable(n,d)):console.error("Invalid layer index")}remove(n,i,l=i){let d=this.get(n);d=d.map(h=>({glyphID:h.glyph.index,paletteIndex:h.paletteIndex})),d.splice(i,l-i+1),this.updateColrTable(n,d)}updateColrTable(n,i){this.ensureCOLR();let l=this.font.tables.colr,d=Kd(l.baseGlyphRecords,"glyphID",n);if(d===-1){let _={glyphID:n,firstLayerIndex:l.layerRecords.length,numLayers:0};d=Xd(l.baseGlyphRecords,"glyphID",_)}let h=l.baseGlyphRecords[d],p=h.numLayers,y=i.length,A=y-p;if(A>0){let _=i.slice(p).map(M=>({glyphID:M.glyphID,paletteIndex:M.paletteIndex}));l.layerRecords.splice(h.firstLayerIndex+p,0,..._)}else A<0&&l.layerRecords.splice(h.firstLayerIndex+y,-A);for(let _=0;_<Math.min(p,y);_++)l.layerRecords[h.firstLayerIndex+_]={glyphID:i[_].glyphID,paletteIndex:i[_].paletteIndex};if(h.numLayers=y,A!==0)for(let _=0;_<l.baseGlyphRecords.length;_++){let M=l.baseGlyphRecords[_];_===d||M.firstLayerIndex<h.firstLayerIndex||(l.baseGlyphRecords[_].firstLayerIndex+=A)}}},uu=class{constructor(n){this.font=n,this.cache=new WeakMap}get(n){let i=this.getOrCreateSvgImageCacheEntry(n);return i&&i.image}getAsync(n){let i=this.getOrCreateSvgImageCacheEntry(n);return i&&i.promise}getOrCreateSvgImageCacheEntry(n){let i=this.font.tables.svg;if(i===void 0)return;let l=i.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 h=d.images.get(n);return h===void 0&&(h=el(this.font,d.template,n),h.promise.then(p=>{if(h.image=p,typeof this.font.onGlyphUpdated=="function")try{this.font.onGlyphUpdated(n)}catch(y){console.error("font.onGlyphUpdated",n,y)}}),d.images.set(n,h)),h}};function _l(n){return{template:eh(n).then(q0),images:new Map}}function el(n,i,l){return{promise:i.then(d=>{let h;typeof d=="string"?h=d:(d[4]=l,h=d.join(""));let p=th(h,n.unitsPerEm);return p.image.decode().then(()=>p)}),image:void 0}}var eh=typeof DecompressionStream=="function"?V0:du;function du(n){try{return Promise.resolve(new TextDecoder().decode(au(n)?Go(n):n))}catch(i){return Promise.reject(i)}}function V0(n){if(au(n))return new Response(new Response(n).body.pipeThrough(new DecompressionStream("gzip"))).text();try{return Promise.resolve(new TextDecoder().decode(n))}catch(i){return Promise.reject(i)}}function q0(n){let i=n.indexOf("<svg"),l=n.indexOf(">",i+4)+1;if(/ id=['"]glyph\d+['"]/.test(n.substring(i,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 th(n,i){let l=new DOMParser().parseFromString(n,"image/svg+xml").documentElement,d=l.viewBox.baseVal,h=l.width.baseVal,p=l.height.baseVal,y=1,A=1;d.width>0&&d.height>0&&(h.unitType===1?(y=h.valueInSpecifiedUnits/d.width,A=p.unitType===1?p.valueInSpecifiedUnits/d.height:y):p.unitType===1?(A=p.valueInSpecifiedUnits/d.height,y=A):i&&(y=i/d.width,A=i/d.height));let _=document.createElement("div");_.style.position="fixed",_.style.visibility="hidden",_.appendChild(l),document.body.appendChild(_);let M=l.getBBox();document.body.removeChild(_);let E=(M.x-d.x)*y,z=(d.y-M.y)*A,U=M.width*y,te=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",te);let Y=new Image(U,te);return Y.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(l.outerHTML),{leftSideBearing:E,baseline:z,image:Y}}var n0=new WeakMap;function s0(n,i,l,d,h){let p;return(i&d)>0?(p=n.parseByte(),(i&h)===0&&(p=-p),p=l+p):(i&h)>0?p=l:p=l+n.parseShort(),p}function Z0(n,i,l){let d=new mt.Parser(i,l);n._numberOfContours=d.parseShort(),n._xMin=d.parseShort(),n._yMin=d.parseShort(),n._xMax=d.parseShort(),n._yMax=d.parseShort();let h,p;if(n._numberOfContours>0){let y=n.endPointIndices=[];for(let _=0;_<n._numberOfContours;_+=1)y.push(d.parseUShort());n.instructionLength=d.parseUShort(),n.instructions=[];for(let _=0;_<n.instructionLength;_+=1)n.instructions.push(d.parseByte());let A=y[y.length-1]+1;h=[];for(let _=0;_<A;_+=1)if(p=d.parseByte(),h.push(p),(p&8)>0){let M=d.parseByte();for(let E=0;E<M;E+=1)h.push(p),_+=1}if(ce.argument(h.length===A,"Bad flags."),y.length>0){let _=[],M;if(A>0){for(let U=0;U<A;U+=1)p=h[U],M={},M.onCurve=!!(p&1),M.lastPointOfContour=y.indexOf(U)>=0,_.push(M);let E=0;for(let U=0;U<A;U+=1)p=h[U],M=_[U],M.x=s0(d,p,E,2,16),E=M.x;let z=0;for(let U=0;U<A;U+=1)p=h[U],M=_[U],M.y=s0(d,p,z,4,32),z=M.y}n.points=_}else n.points=[]}else if(n._numberOfContours===0)n.points=[];else{n.isComposite=!0,n.points=[],n.components=[];let y=!0;for(;y;){h=d.parseUShort();let A={glyphIndex:d.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(h&1)>0?(h&2)>0?(A.dx=d.parseShort(),A.dy=d.parseShort()):A.matchedPoints=[d.parseUShort(),d.parseUShort()]:(h&2)>0?(A.dx=d.parseChar(),A.dy=d.parseChar()):A.matchedPoints=[d.parseByte(),d.parseByte()],(h&8)>0?A.xScale=A.yScale=d.parseF2Dot14():(h&64)>0?(A.xScale=d.parseF2Dot14(),A.yScale=d.parseF2Dot14()):(h&128)>0&&(A.xScale=d.parseF2Dot14(),A.scale01=d.parseF2Dot14(),A.scale10=d.parseF2Dot14(),A.yScale=d.parseF2Dot14()),n.components.push(A),y=!!(h&32)}if(h&256){n.instructionLength=d.parseUShort(),n.instructions=[];for(let A=0;A<n.instructionLength;A+=1)n.instructions.push(d.parseByte())}}}function Ai(n,i){let l=[];for(let d=0;d<n.length;d+=1){let h=n[d],p={x:i.xScale*h.x+i.scale10*h.y+i.dx,y:i.scale01*h.x+i.yScale*h.y+i.dy,onCurve:h.onCurve,lastPointOfContour:h.lastPointOfContour};l.push(p)}return l}function i0(n){let i=[],l=[];for(let d=0;d<n.length;d+=1){let h=n[d];l.push(h),h.lastPointOfContour&&(i.push(l),l=[])}return ce.argument(l.length===0,"There are still points left in the current contour."),i}function Sl(n){let i=new Je;if(!n)return i;let l=i0(n);for(let d=0;d<l.length;++d){let h=l[d],p=h[h.length-1],y=h[0];if(p.onCurve)i.moveTo(p.x,p.y);else if(y.onCurve)i.moveTo(y.x,y.y);else{let A={x:(p.x+y.x)*.5,y:(p.y+y.y)*.5};i.moveTo(A.x,A.y)}for(let A=0;A<h.length;++A)if(p=y,y=h[(A+1)%h.length],p.onCurve)i.lineTo(p.x,p.y);else{let _=y;y.onCurve||(_={x:(p.x+y.x)*.5,y:(p.y+y.y)*.5}),i.quadraticCurveTo(p.x,p.y,_.x,_.y)}i.closePath()}return i}function Ll(n,i){if(i.isComposite){n0.has(n)||n0.set(n,new Set);let l=n0.get(n);l.add(i.index);try{for(let d=0;d<i.components.length;d+=1){let h=i.components[d];if(l.has(h.glyphIndex))continue;let p=n.get(h.glyphIndex);if(p.getPath(),p.points){let y;if(h.matchedPoints===void 0)y=Ai(p.points,h);else{if(h.matchedPoints[0]>i.points.length-1||h.matchedPoints[1]>p.points.length-1)throw Error("Matched points out of range in "+i.name);let A=i.points[h.matchedPoints[0]],_=p.points[h.matchedPoints[1]],M={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};_=Ai([_],M)[0],M.dx=A.x-_.x,M.dy=A.y-_.y,y=Ai(p.points,M)}i.points=i.points.concat(y)}}}finally{l.delete(i.index)}}return Sl(i.points)}function tl(n,i,l,d){let h=new Er.GlyphSet(d);for(let p=0;p<l.length-1;p+=1){let y=l[p],A=l[p+1];y!==A?h.push(p,Er.ttfGlyphLoader(d,p,Z0,n,i+y,Ll)):h.push(p,Er.glyphLoader(d,p))}return h}function Ns(n,i,l,d){let h=new Er.GlyphSet(d);return d._push=function(p){let y=l[p],A=l[p+1];y!==A?h.push(p,Er.ttfGlyphLoader(d,p,Z0,n,i+y,Ll)):h.push(p,Er.glyphLoader(d,p))},h}function rh(n,i,l,d,h){return h.lowMemory?Ns(n,i,l,d):tl(n,i,l,d)}var Y0={getPath:Sl,parse:rh},nh=class{constructor(n){this.font=n}normalizeCoordTags(n){for(let i in n)if(i.length<4){let l=i.padEnd(4," ");n[l]===void 0&&(n[l]=n[i]),delete n[i]}}getNormalizedCoords(n){n||(n=this.font.variation.get());let i=[];this.normalizeCoordTags(n);for(let l=0;l<this.fvar().axes.length;l++){let d=this.fvar().axes[l],h=n[d.tag];h===void 0&&(h=d.defaultValue),h<d.defaultValue?i.push((h-d.defaultValue+Number.EPSILON)/(d.defaultValue-d.minValue+Number.EPSILON)):i.push((h-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 h=0;h<d.axisValueMaps.length;h++){let p=d.axisValueMaps[h];if(h>=1&&i[l]<p.fromCoordinate){let y=d.axisValueMaps[h-1];i[l]=((i[l]-y.fromCoordinate)*(p.toCoordinate-y.toCoordinate)+Number.EPSILON)/(p.fromCoordinate-y.fromCoordinate+Number.EPSILON)+y.toCoordinate;break}}}return i}interpolatePoints(n,i,l){if(n.length===0)return;let d=0;for(;d<n.length;){let h=d,p=d,y=n[p];for(;!y.lastPointOfContour;)y=n[++p];for(;d<=p&&!l[d];)d++;if(d>p)continue;let A=d,_=d;for(d++;d<=p;)l[d]&&(this.deltaInterpolate(_+1,d-1,_,d,i,n),_=d),d++;_===A?this.deltaShift(h,p,_,i,n):(this.deltaInterpolate(_+1,p,_,A,i,n),A>0&&this.deltaInterpolate(h,A-1,_,A,i,n)),d=p+1}}deltaInterpolate(n,i,l,d,h,p){if(n>i)return;let y=["x","y"];for(let _=0;_<y.length;_++){let M=y[_];if(h[l][M]>h[d][M]){var A=l;l=d,d=A}let E=h[l][M],z=h[d][M],U=p[l][M],te=p[d][M];if(E!==z||U===te){let Y=E===z?0:(te-U)/(z-E);for(let ae=n;ae<=i;ae++){let ze=h[ae][M];ze<=E?ze+=U-E:ze>=z?ze+=te-z:ze=U+(ze-E)*Y,p[ae][M]=ze}}}}deltaShift(n,i,l,d,h){let p=h[l].x-d[l].x,y=h[l].y-d[l].y;if(!(p===0&&y===0))for(let A=n;A<=i;A++)A!==l&&(h[A].x+=p,h[A].y+=y)}transformComponents(n,i,l,d,h,p){let y=0;for(let A=0;A<n.components.length;A++){let _=n.components[A],M=this.font.glyphs.get(_.glyphIndex),E=Jd(_),z=d.indexOf(A);z>-1&&(E.dx+=Math.round(h.deltas[z]*p),E.dy+=Math.round(h.deltasY[z]*p));let U=Ai(this.getTransform(M,l).points,E);i.splice(y,U.length,...U),y+=M.points.length}}applyTupleVariationStore(n,i,l,d="gvar",h={}){l||(l=this.font.variation.get());let p=this.getNormalizedCoords(l),{headers:y,sharedPoints:A}=n,_=this.fvar().axes.length,M;d==="gvar"?M=i.map(fa):d==="cvar"&&(M=[...i]);for(let E=0;E<y.length;E++){let z=y[E],U=1;for(let Y=0;Y<_;Y++){let ae=[0];switch(d){case"gvar":ae=z.peakTuple?z.peakTuple:this.gvar().sharedTuples[z.sharedTupleRecordsIndex];break;case"cvar":ae=z.peakTuple;break}if(ae[Y]!==0){if(p[Y]===0){U=0;break}if(z.intermediateStartTuple)if(p[Y]<z.intermediateStartTuple[Y]||p[Y]>z.intermediateEndTuple[Y]){U=0;break}else p[Y]<ae[Y]?U=U*(p[Y]-z.intermediateStartTuple[Y]+Number.EPSILON)/(ae[Y]-z.intermediateStartTuple[Y]+Number.EPSILON):U=U*(z.intermediateEndTuple[Y]-p[Y]+Number.EPSILON)/(z.intermediateEndTuple[Y]-ae[Y]+Number.EPSILON);else{if(p[Y]<Math.min(0,ae[Y])||p[Y]>Math.max(0,ae[Y])){U=0;break}U=(U*p[Y]+Number.EPSILON)/(ae[Y]+Number.EPSILON)}}}if(U===0)continue;let te=z.privatePoints.length?z.privatePoints:A;if(d==="gvar"&&h.glyph&&h.glyph.isComposite)this.transformComponents(h.glyph,M,l,te,z,U);else if(te.length===0)for(let Y=0;Y<M.length;Y++){let ae=M[Y];d==="gvar"?M[Y]={x:Math.round(ae.x+z.deltas[Y]*U),y:Math.round(ae.y+z.deltasY[Y]*U),onCurve:ae.onCurve,lastPointOfContour:ae.lastPointOfContour}:d==="cvar"&&(M[Y]=Math.round(ae+z.deltas[Y]*U))}else{let Y;d==="gvar"?Y=M.map(fa):d==="cvar"&&(Y=M);let ae=Array(i.length).fill(!1);for(let ze=0;ze<te.length;ze++){let Jt=te[ze];if(Jt<i.length){let Vt=Y[Jt];d==="gvar"?(ae[Jt]=!0,Vt.x+=z.deltas[ze]*U,Vt.y+=z.deltasY[ze]*U):d==="cvar"&&(M[Jt]=Math.round(Vt+z.deltas[ze]*U))}}if(d==="gvar"){this.interpolatePoints(Y,M,ae);for(let ze=0;ze<i.length;ze++){let Jt=Y[ze].x-M[ze].x,Vt=Y[ze].y-M[ze].y;M[ze].x=Math.round(M[ze].x+Jt),M[ze].y=Math.round(M[ze].y+Vt)}}}}return M}getTransform(n,i){Number.isInteger(n)&&(n=this.font.glyphs.get(n));let l=n.getBlendPath,d=!!(n.points&&n.points.length),h=n;if(l||d){if(i||(i=this.font.variation.get()),d){let p=this.gvar()&&this.gvar().glyphVariations[n.index];if(p){let y=n.points,A=this.applyTupleVariationStore(p,y,i,"gvar",{glyph:n});h=new sr(Object.assign({},n,{points:A,path:Sl(A)}))}}else if(l){let p=n.getBlendPath(i);h=new sr(Object.assign({},n,{path:p}))}}return this.font.tables.hvar&&(n._advanceWidth=typeof n._advanceWidth<"u"?n._advanceWidth:n.advanceWidth,n.advanceWidth=h.advanceWidth=Math.round(n._advanceWidth+this.getVariableAdjustment(h.index,"hvar","advanceWidth",i)),n._leftSideBearing=typeof n._leftSideBearing<"u"?n._leftSideBearing:n.leftSideBearing,n.leftSideBearing=h.leftSideBearing=Math.round(n._leftSideBearing+this.getVariableAdjustment(h.index,"hvar","lsb",i))),h}getCvarTransform(n){let i=this.font.tables.cvt,l=this.cvar();return!i||!i.length||!l||!l.headers.length?i:this.applyTupleVariationStore(l,i,n,"cvar")}getVariableAdjustment(n,i,l,d){d=d||this.font.variation.get();let h,p,y=this.font.tables[i];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 _=n;_>=A&&(_=A-1),{outerIndex:h,innerIndex:p}=y[l].map[_]}else h=0,p=n;return this.getDelta(y.itemVariationStore,h,p,d)}getDelta(n,i,l,d){if(i>=n.itemVariationSubtables.length)return 0;let h=n.itemVariationSubtables[i];if(l>=h.deltaSets.length)return 0;let p=h.deltaSets[l],y=this.getBlendVector(n,i,d),A=0;for(let _=0;_<h.regionIndexes.length;_++)A+=p[_]*y[_];return A}getBlendVector(n,i,l){l||(l=this.font.variation.get());let d=n.itemVariationSubtables[i],h=this.getNormalizedCoords(l),p=[];for(let y=0;y<d.regionIndexes.length;y++){let A=1,_=d.regionIndexes[y],M=n.variationRegions[_].regionAxes;for(let E=0;E<M.length;E++){let z=M[E],U;z.startCoord>z.peakCoord||z.peakCoord>z.endCoord||z.startCoord<0&&z.endCoord>0&&z.peakCoord!==0||z.peakCoord===0?U=1:h[E]<z.startCoord||h[E]>z.endCoord?U=0:h[E]===z.peakCoord?U=1:h[E]<z.peakCoord?U=(h[E]-z.startCoord+Number.EPSILON)/(z.peakCoord-z.startCoord+Number.EPSILON):U=(z.endCoord-h[E]+Number.EPSILON)/(z.endCoord-z.peakCoord+Number.EPSILON),A*=U}p[y]=A}return p}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}},hu=class{constructor(n){this.font=n,this.process=new nh(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,i)=>(n[i.tag]=i.defaultValue,n),{})}getDefaultInstanceIndex(){let n=this.getDefaultCoordinates(),i=this.getInstanceIndex(n);return i<0&&(i=this.fvar().instances.findIndex(l=>l.name&&l.name.en==="Regular")),i}getInstanceIndex(n){return this.fvar().instances.findIndex(i=>Object.keys(n).every(l=>i.coordinates[l]===n[l]))}getInstance(n){return this.fvar().instances&&this.fvar().instances[n]}set(n){let i;if(Number.isInteger(n)){let l=this.getInstance(n);if(!l)throw Error(`Invalid instance index ${n}`);i={...l.coordinates}}else i=n,this.process.normalizeCoordTags(i);i=Object.assign({},this.font.defaultRenderOptions.variation,i),this.font.defaultRenderOptions=Object.assign({},this.font.defaultRenderOptions,{variation:i})}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}},K0=1e6,C=64,D=1e4,X,Re,dt,Dt;function pr(n){this.font=n,this.getCommands=function(i){return Y0.getPath(i).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function cn(n){return n}function wn(n){return Math.sign(n)*Math.round(Math.abs(n))}function Rn(n){return Math.sign(n)*Math.round(Math.abs(n*2))/2}function vo(n){return Math.sign(n)*(Math.round(Math.abs(n)+.5)-.5)}function Nn(n){return Math.sign(n)*Math.ceil(Math.abs(n))}function Mi(n){return Math.sign(n)*Math.floor(Math.abs(n))}var wo=function(n){let i=this.srPeriod,l=this.srPhase,d=this.srThreshold,h=1;return n<0&&(n=-n,h=-1),n+=d-l,n=Math.trunc(n/i)*i,n+=l,n<0?l*h:n*h},Ds={x:1,y:0,axis:"x",distance:function(n,i,l,d){return(l?n.xo:n.x)-(d?i.xo:i.x)},interpolate:function(n,i,l,d){let h,p,y,A,_,M,E;if(!d||d===this){if(h=n.xo-i.xo,p=n.xo-l.xo,_=i.x-i.xo,M=l.x-l.xo,y=Math.abs(h),A=Math.abs(p),E=y+A,E===0){n.x=n.xo+(_+M)/2;return}n.x=n.xo+(_*A+M*y)/E;return}if(h=d.distance(n,i,!0,!0),p=d.distance(n,l,!0,!0),_=d.distance(i,i,!1,!0),M=d.distance(l,l,!1,!0),y=Math.abs(h),A=Math.abs(p),E=y+A,E===0){Ds.setRelative(n,n,(_+M)/2,d,!0);return}Ds.setRelative(n,n,(_*A+M*y)/E,d,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(n,i,l,d,h){if(!d||d===this){n.x=(h?i.xo:i.x)+l;return}let p=h?i.xo:i.x,y=h?i.yo:i.y,A=p+l*d.x,_=y+l*d.y;n.x=A+(n.y-_)/d.normalSlope},slope:0,touch:function(n){n.xTouched=!0},touched:function(n){return n.xTouched},untouch:function(n){n.xTouched=!1}},Es={x:0,y:1,axis:"y",distance:function(n,i,l,d){return(l?n.yo:n.y)-(d?i.yo:i.y)},interpolate:function(n,i,l,d){let h,p,y,A,_,M,E;if(!d||d===this){if(h=n.yo-i.yo,p=n.yo-l.yo,_=i.y-i.yo,M=l.y-l.yo,y=Math.abs(h),A=Math.abs(p),E=y+A,E===0){n.y=n.yo+(_+M)/2;return}n.y=n.yo+(_*A+M*y)/E;return}if(h=d.distance(n,i,!0,!0),p=d.distance(n,l,!0,!0),_=d.distance(i,i,!1,!0),M=d.distance(l,l,!1,!0),y=Math.abs(h),A=Math.abs(p),E=y+A,E===0){Es.setRelative(n,n,(_+M)/2,d,!0);return}Es.setRelative(n,n,(_*A+M*y)/E,d,!0)},normalSlope:0,setRelative:function(n,i,l,d,h){if(!d||d===this){n.y=(h?i.yo:i.y)+l;return}let p=h?i.xo:i.x,y=h?i.yo:i.y,A=p+l*d.x,_=y+l*d.y;n.y=_+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(Ds),Object.freeze(Es);function Qs(n,i){this.x=n,this.y=i,this.axis=void 0,this.slope=i/n,this.normalSlope=-n/i,Object.freeze(this)}Qs.prototype.distance=function(n,i,l,d){return this.x*Ds.distance(n,i,l,d)+this.y*Es.distance(n,i,l,d)},Qs.prototype.interpolate=function(n,i,l,d){let h,p,y,A,_,M,E;if(y=d.distance(n,i,!0,!0),A=d.distance(n,l,!0,!0),h=d.distance(i,i,!1,!0),p=d.distance(l,l,!1,!0),_=Math.abs(y),M=Math.abs(A),E=_+M,E===0){this.setRelative(n,n,(h+p)/2,d,!0);return}this.setRelative(n,n,(h*M+p*_)/E,d,!0)},Qs.prototype.setRelative=function(n,i,l,d,h){d=d||this;let p=h?i.xo:i.x,y=h?i.yo:i.y,A=p+l*d.x,_=y+l*d.y,M=d.normalSlope,E=this.slope,z=n.x,U=n.y;n.x=(E*z-M*A+_-U)/(E-M),n.y=E*(n.x-z)+U},Qs.prototype.touch=function(n){n.xTouched=!0,n.yTouched=!0};function Ti(n,i){let l=Math.sqrt(n*n+i*i);return n/=l,i/=l,n===1&&i===0?Ds:n===0&&i===1?Es:new Qs(n,i)}function Wo(n,i,l,d){this.x=this.xo=Math.round(n*64)/64,this.y=this.yo=Math.round(i*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)}Wo.prototype.nextTouched=function(n){let i=this.nextPointOnContour;for(;!n.touched(i)&&i!==this;)i=i.nextPointOnContour;return i},Wo.prototype.prevTouched=function(n){let i=this.prevPointOnContour;for(;!n.touched(i)&&i!==this;)i=i.prevPointOnContour;return i};var Ba=Object.freeze(new Wo(0,0)),u6={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function rl(n,i){switch(this.env=n,this.stack=[],this.prog=i,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=Ds,this.round=wn}}pr.prototype.exec=function(n,i){if(typeof i!="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!==i){let h=this._fpgmState;if(!h){rl.prototype=u6,h=this._fpgmState=new rl("fpgm",l.tables.fpgm),h.funcs=[],h.font=l,h.instructionCount=0,h.callDepth=0;try{Re(h)}catch(y){console.log("Hinting error in FPGM:"+y),this._errorState=3;return}}rl.prototype=h,d=this._prepState=new rl("prep",l.tables.prep),d.ppem=i,d.instructionCount=0,d.callDepth=0;let p=l.variation&&l.variation.process.getCvarTransform()||l.tables.cvt;if(p){let y=d.cvt=new Array(p.length),A=i/l.unitsPerEm;for(let _=0;_<p.length;_++)y[_]=p[_]*A}else d.cvt=[];try{Re(d)}catch(y){this._errorState<2&&console.log("Hinting error in PREP:"+y),this._errorState=2}}if(!(this._errorState>1))try{return dt(n,d)}catch(h){this._errorState<1&&(console.log("Hinting error:"+h),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},dt=function(n,i){let l=i.ppem/i.font.unitsPerEm,d=l,h=n.components,p,y,A;if(rl.prototype=i,!h)A=new rl("glyf",n.instructions),A.instructionCount=0,A.callDepth=0,Dt(n,A,l,d),y=A.gZone;else{let _=i.font;y=[],p=[];for(let M=0;M<h.length;M++){let E=h[M],z=_.glyphs.get(E.glyphIndex);A=new rl("glyf",z.instructions),A.instructionCount=0,A.callDepth=0,Dt(z,A,l,d);let U=Math.round(E.dx*l),te=Math.round(E.dy*d),Y=A.gZone,ae=A.contours;for(let Jt=0;Jt<Y.length;Jt++){let Vt=Y[Jt];Vt.xTouched=Vt.yTouched=!1,Vt.xo=Vt.x=Vt.x+U,Vt.yo=Vt.y=Vt.y+te}let ze=y.length;y.push.apply(y,Y);for(let Jt=0;Jt<ae.length;Jt++)p.push(ae[Jt]+ze)}n.instructions&&!A.inhibitGridFit&&(A=new rl("glyf",n.instructions),A.gZone=A.z0=A.z1=A.z2=y,A.contours=p,y.push(new Wo(0,0),new Wo(Math.round(n.advanceWidth*l),0)),Re(A),y.length-=2)}return y},Dt=function(n,i,l,d){let h=n.points||[],p=h.length,y=i.gZone=i.z0=i.z1=i.z2=[],A=i.contours=[],_;for(let z=0;z<p;z++)_=h[z],y[z]=new Wo(_.x*l,_.y*d,_.lastPointOfContour,_.onCurve);let M,E;for(let z=0;z<p;z++)_=y[z],M||(M=_,A.push(z)),_.lastPointOfContour?(_.nextPointOnContour=M,M.prevPointOnContour=_,M=void 0):(E=y[z+1],_.nextPointOnContour=E,E.prevPointOnContour=_);i.inhibitGridFit||(y.push(new Wo(0,0),new Wo(Math.round(n.advanceWidth*l),0)),Re(i),y.length-=2)},Re=function(n){let i=n.prog;if(!i)return;let l=i.length,d;for(n.ip=0;n.ip<l;n.ip++){if(++n.instructionCount>K0)throw new Error("Hinting instructions exceeded maximum of "+K0);if(d=X[i[n.ip]],!d)throw new Error("unknown instruction: 0x"+Number(i[n.ip]).toString(16));d(n)}};function fu(n){let i=n.tZone=new Array(n.gZone.length);for(let l=0;l<i.length;l++)i[l]=new Wo(0,0)}function Yp(n,i){let l=n.prog,d=n.ip,h=1,p;do if(p=l[++d],p===88)h++;else if(p===89)h--;else if(p===64)d+=l[d+1]+1;else if(p===65)d+=2*l[d+1]+1;else if(p>=176&&p<=183)d+=p-176+1;else if(p>=184&&p<=191)d+=(p-184+1)*2;else if(i&&h===1&&p===27)break;while(h>0);n.ip=d}function Kp(n,i){i.fv=i.pv=i.dpv=n}function Xp(n,i){i.pv=i.dpv=n}function Jp(n,i){i.fv=n}function e1(n,i){let l=i.stack,d=l.pop(),h=l.pop(),p=i.z2[d],y=i.z1[h],A,_;n?(A=p.y-y.y,_=y.x-p.x):(A=y.x-p.x,_=y.y-p.y),i.pv=i.dpv=Ti(A,_)}function t1(n,i){let l=i.stack,d=l.pop(),h=l.pop(),p=i.z2[d],y=i.z1[h],A,_;n?(A=p.y-y.y,_=y.x-p.x):(A=y.x-p.x,_=y.y-p.y),i.fv=Ti(A,_)}function d6(n){let i=n.stack,l=i.pop(),d=i.pop();n.pv=n.dpv=Ti(d,l)}function h6(n){let i=n.stack,l=i.pop(),d=i.pop();n.fv=Ti(d,l)}function f6(n){let i=n.stack,l=n.pv;i.push(l.x*16384),i.push(l.y*16384)}function p6(n){let i=n.stack,l=n.fv;i.push(l.x*16384),i.push(l.y*16384)}function m6(n){n.fv=n.pv}function g6(n){let i=n.stack,l=i.pop(),d=i.pop(),h=i.pop(),p=i.pop(),y=i.pop(),A=n.z0,_=n.z1,M=A[l],E=A[d],z=_[h],U=_[p],te=n.z2[y],Y=M.x,ae=M.y,ze=E.x,Jt=E.y,Vt=z.x,mr=z.y,Dr=U.x,An=U.y,Dn=(Y-ze)*(mr-An)-(ae-Jt)*(Vt-Dr),Qn=Y*Jt-ae*ze,Bs=Vt*An-mr*Dr;te.x=(Qn*(Vt-Dr)-Bs*(Y-ze))/Dn,te.y=(Qn*(mr-An)-Bs*(ae-Jt))/Dn}function x6(n){n.rp0=n.stack.pop()}function b6(n){n.rp1=n.stack.pop()}function y6(n){n.rp2=n.stack.pop()}function v6(n){let i=n.stack.pop();switch(n.zp0=i,i){case 0:n.tZone||fu(n),n.z0=n.tZone;break;case 1:n.z0=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function w6(n){let i=n.stack.pop();switch(n.zp1=i,i){case 0:n.tZone||fu(n),n.z1=n.tZone;break;case 1:n.z1=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function A6(n){let i=n.stack.pop();switch(n.zp2=i,i){case 0:n.tZone||fu(n),n.z2=n.tZone;break;case 1:n.z2=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function T6(n){let i=n.stack.pop();switch(n.zp0=n.zp1=n.zp2=i,i){case 0:n.tZone||fu(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 C6(n){n.loop=n.stack.pop(),n.loop>D&&(n.loop=D)}function _6(n){n.round=wn}function S6(n){n.round=vo}function L6(n){let i=n.stack.pop();n.minDis=i/64}function I6(n){Yp(n,!1)}function k6(n){let i=n.stack.pop();n.ip+=i-1}function E6(n){let i=n.stack.pop();n.cvCutIn=i/64}function M6(n){let i=n.stack;i.push(i[i.length-1])}function sh(n){n.stack.pop()}function R6(n){n.stack.length=0}function N6(n){let i=n.stack,l=i.pop(),d=i.pop();i.push(l),i.push(d)}function D6(n){let i=n.stack;i.push(i.length)}function Q6(n){let i=n.stack,l=i.pop(),d=i.pop();if(d>D&&(d=D),++n.callDepth>C)throw new Error("Hinting call depth exceeded maximum of "+C);let h=n.ip,p=n.prog;n.prog=n.funcs[l];for(let y=0;y<d;y++)Re(n);n.ip=h,n.prog=p,n.callDepth--}function B6(n){let i=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[i],Re(n),n.ip=l,n.prog=d,n.callDepth--}function j6(n){let i=n.stack,l=i.pop();i.push(i[i.length-l])}function P6(n){let i=n.stack,l=i.pop();i.push(i.splice(i.length-l,1)[0])}function O6(n){if(n.env!=="fpgm")throw new Error("FDEF not allowed here");let i=n.stack,l=n.prog,d=n.ip,h=i.pop(),p=d;for(;l[++d]!==45;);n.ip=d,n.funcs[h]=l.slice(p+1,d)}function r1(n,i){let l=i.stack.pop(),d=i.z0[l],h=i.fv,p=i.pv,y=p.distance(d,Ba);n&&(y=i.round(y)),h.setRelative(d,Ba,y,p),h.touch(d),i.rp0=i.rp1=l}function n1(n,i){let l=i.z2,d=l.length-2,h,p,y;for(let A=0;A<d;A++)h=l[A],!n.touched(h)&&(p=h.prevTouched(n),p!==h&&(y=h.nextTouched(n),p===y&&n.setRelative(h,h,n.distance(p,p,!1,!0),n,!0),n.interpolate(h,p,y,n)))}function s1(n,i){let l=i.stack,d=n?i.rp1:i.rp2,h=(n?i.z0:i.z1)[d],p=i.fv,y=i.pv,A=i.loop,_=i.z2;for(;A--;){let M=l.pop(),E=_[M],z=y.distance(h,h,!1,!0);p.setRelative(E,E,z,y),p.touch(E)}i.loop=1}function i1(n,i){let l=i.stack,d=n?i.rp1:i.rp2,h=(n?i.z0:i.z1)[d],p=i.fv,y=i.pv,A=l.pop(),_=i.z2[i.contours[A]],M=_,E=y.distance(h,h,!1,!0);do M!==h&&p.setRelative(M,M,E,y),M=M.nextPointOnContour;while(M!==_)}function o1(n,i){let l=i.stack,d=n?i.rp1:i.rp2,h=(n?i.z0:i.z1)[d],p=i.fv,y=i.pv,A=l.pop(),_;switch(A){case 0:_=i.tZone;break;case 1:_=i.gZone;break;default:throw new Error("Invalid zone")}let M,E=y.distance(h,h,!1,!0),z=_.length-2;for(let U=0;U<z;U++)M=_[U],p.setRelative(M,M,E,y)}function F6(n){let i=n.stack,l=n.loop,d=n.fv,h=i.pop()/64,p=n.z2;for(;l--;){let y=i.pop(),A=p[y];d.setRelative(A,A,h),d.touch(A)}n.loop=1}function U6(n){let i=n.stack,l=n.rp1,d=n.rp2,h=n.loop,p=n.z0[l],y=n.z1[d],A=n.fv,_=n.dpv,M=n.z2;for(;h--;){let E=i.pop(),z=M[E];A.interpolate(z,p,y,_),A.touch(z)}n.loop=1}function a1(n,i){let l=i.stack,d=l.pop()/64,h=l.pop(),p=i.z1[h],y=i.z0[i.rp0],A=i.fv,_=i.pv;A.setRelative(p,y,d,_),A.touch(p),i.rp1=i.rp0,i.rp2=h,n&&(i.rp0=h)}function $6(n){let i=n.stack,l=n.rp0,d=n.z0[l],h=n.loop,p=n.fv,y=n.pv,A=n.z1;for(;h--;){let _=i.pop(),M=A[_];p.setRelative(M,d,0,y),p.touch(M)}n.loop=1}function z6(n){n.round=Rn}function l1(n,i){let l=i.stack,d=l.pop(),h=l.pop(),p=i.z0[h],y=i.fv,A=i.pv,_=i.cvt[d],M=A.distance(p,Ba);n&&(Math.abs(M-_)<i.cvCutIn&&(M=_),M=i.round(M)),y.setRelative(p,Ba,M,A),i.zp0===0&&(p.xo=p.x,p.yo=p.y),y.touch(p),i.rp0=i.rp1=h}function H6(n){let i=n.prog,l=n.ip,d=n.stack,h=i[++l];for(let p=0;p<h;p++)d.push(i[++l]);n.ip=l}function G6(n){let i=n.ip,l=n.prog,d=n.stack,h=l[++i];for(let p=0;p<h;p++){let y=l[++i]<<8|l[++i];y&32768&&(y=-((y^65535)+1)),d.push(y)}n.ip=i}function W6(n){let i=n.stack,l=n.store;l||(l=n.store=[]);let d=i.pop(),h=i.pop();l[h]=d}function V6(n){let i=n.stack,l=n.store,d=i.pop(),h=l&&l[d]||0;i.push(h)}function q6(n){let i=n.stack,l=i.pop(),d=i.pop();n.cvt[d]=l/64}function Z6(n){let i=n.stack,l=i.pop();i.push(n.cvt[l]*64)}function c1(n,i){let l=i.stack,d=l.pop(),h=i.z2[d];l.push(i.dpv.distance(h,Ba,n,!1)*64)}function u1(n,i){let l=i.stack,d=l.pop(),h=l.pop(),p=i.z1[d],y=i.z0[h],A=i.dpv.distance(y,p,n,n);i.stack.push(Math.round(A*64))}function Y6(n){n.stack.push(n.ppem)}function K6(n){n.autoFlip=!0}function X6(n){let i=n.stack,l=i.pop(),d=i.pop();i.push(d<l?1:0)}function J6(n){let i=n.stack,l=i.pop(),d=i.pop();i.push(d<=l?1:0)}function eb(n){let i=n.stack,l=i.pop(),d=i.pop();i.push(d>l?1:0)}function tb(n){let i=n.stack,l=i.pop(),d=i.pop();i.push(d>=l?1:0)}function rb(n){let i=n.stack,l=i.pop(),d=i.pop();i.push(l===d?1:0)}function nb(n){let i=n.stack,l=i.pop(),d=i.pop();i.push(l!==d?1:0)}function sb(n){let i=n.stack,l=i.pop();i.push(Math.trunc(l)&1?1:0)}function ib(n){let i=n.stack,l=i.pop();i.push(Math.trunc(l)&1?0:1)}function ob(n){let i=n.stack.pop(),l;i||Yp(n,!0)}function ab(n){}function lb(n){let i=n.stack,l=i.pop(),d=i.pop();i.push(l&&d?1:0)}function cb(n){let i=n.stack,l=i.pop(),d=i.pop();i.push(l||d?1:0)}function ub(n){let i=n.stack,l=i.pop();i.push(l?0:1)}function ih(n,i){let l=i.stack,d=l.pop(),h=i.fv,p=i.pv,y=i.ppem,A=i.deltaBase+(n-1)*16,_=i.deltaShift,M=i.z0;for(let E=0;E<d;E++){let z=l.pop(),U=l.pop();if(A+((U&240)>>4)!==y)continue;let te=(U&15)-8;te>=0&&te++;let Y=M[z];h.setRelative(Y,Y,te*_,p)}}function db(n){let i=n.stack.pop();n.deltaBase=i}function hb(n){let i=n.stack.pop();n.deltaShift=Math.pow(.5,i)}function fb(n){let i=n.stack,l=i.pop(),d=i.pop();i.push(d+l)}function pb(n){let i=n.stack,l=i.pop(),d=i.pop();i.push(d-l)}function mb(n){let i=n.stack,l=i.pop(),d=i.pop();i.push(d*64/l)}function gb(n){let i=n.stack,l=i.pop(),d=i.pop();i.push(d*l/64)}function xb(n){let i=n.stack,l=i.pop();i.push(Math.abs(l))}function bb(n){let i=n.stack,l=i.pop();i.push(-l)}function yb(n){let i=n.stack,l=i.pop();i.push(Math.floor(l/64)*64)}function vb(n){let i=n.stack,l=i.pop();i.push(Math.ceil(l/64)*64)}function pu(n,i){let l=i.stack,d=l.pop();l.push(i.round(d/64)*64)}function wb(n){let i=n.stack,l=i.pop(),d=i.pop();n.cvt[d]=l*n.ppem/n.font.unitsPerEm}function oh(n,i){let l=i.stack,d=l.pop(),h=i.ppem,p=i.deltaBase+(n-1)*16,y=i.deltaShift;for(let A=0;A<d;A++){let _=l.pop(),M=l.pop();if(p+((M&240)>>4)!==h)continue;let E=(M&15)-8;E>=0&&E++;let z=E*y;i.cvt[_]+=z}}function Ab(n){let i=n.stack.pop();n.round=wo;let l;switch(i&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,i&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")}i&=15,i===0?n.srThreshold=0:n.srThreshold=(i/8-.5)*l}function Tb(n){let i=n.stack.pop();n.round=wo;let l;switch(i&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,i&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")}i&=15,i===0?n.srThreshold=0:n.srThreshold=(i/8-.5)*l}function Cb(n){n.round=cn}function _b(n){n.round=Nn}function Sb(n){n.round=Mi}function Lb(n){let i=n.stack.pop()}function d1(n,i){let l=i.stack,d=l.pop(),h=l.pop(),p=i.z2[d],y=i.z1[h],A,_;n?(A=p.y-y.y,_=y.x-p.x):(A=y.x-p.x,_=y.y-p.y),i.dpv=Ti(A,_)}function Ib(n){let i=n.stack,l=i.pop(),d=0;l&1&&(d=35),l&32&&(d|=4096),i.push(d)}function kb(n){let i=n.stack,l=i.pop(),d=i.pop(),h=i.pop();i.push(d),i.push(l),i.push(h)}function Eb(n){let i=n.stack,l=i.pop(),d=i.pop();i.push(Math.max(d,l))}function Mb(n){let i=n.stack,l=i.pop(),d=i.pop();i.push(Math.min(d,l))}function Rb(n){let i=n.stack.pop()}function Nb(n){let i=n.stack.pop(),l=n.stack.pop();switch(i){case 1:n.inhibitGridFit=!!l;return;case 2:n.ignoreCvt=!!l;return;default:throw new Error("invalid INSTCTRL[] selector")}}function nl(n,i){let l=i.stack,d=i.prog,h=i.ip;for(let p=0;p<n;p++)l.push(d[++h]);i.ip=h}function sl(n,i){let l=i.ip,d=i.prog,h=i.stack;for(let p=0;p<n;p++){let y=d[++l]<<8|d[++l];y&32768&&(y=-((y^65535)+1)),h.push(y)}i.ip=l}function Zt(n,i,l,d,h,p){let y=p.stack,A=n&&y.pop(),_=y.pop(),M=p.rp0,E=p.z0[M],z=p.z1[_],U=p.minDis,te=p.fv,Y=p.dpv,ae,ze,Jt,Vt;ze=ae=Y.distance(z,E,!0,!0),Jt=ze>=0?1:-1,ze=Math.abs(ze),n&&(Vt=p.cvt[A],d&&Math.abs(ze-Vt)<p.cvCutIn&&(ze=Vt)),l&&ze<U&&(ze=U),d&&(ze=p.round(ze)),te.setRelative(z,E,Jt*ze,Y),te.touch(z),p.rp1=p.rp0,p.rp2=_,i&&(p.rp0=_)}X=[Kp.bind(void 0,Es),Kp.bind(void 0,Ds),Xp.bind(void 0,Es),Xp.bind(void 0,Ds),Jp.bind(void 0,Es),Jp.bind(void 0,Ds),e1.bind(void 0,0),e1.bind(void 0,1),t1.bind(void 0,0),t1.bind(void 0,1),d6,h6,f6,p6,m6,g6,x6,b6,y6,v6,w6,A6,T6,C6,_6,S6,L6,I6,k6,E6,void 0,void 0,M6,sh,R6,N6,D6,j6,P6,void 0,void 0,void 0,Q6,B6,O6,void 0,r1.bind(void 0,0),r1.bind(void 0,1),n1.bind(void 0,Es),n1.bind(void 0,Ds),s1.bind(void 0,0),s1.bind(void 0,1),i1.bind(void 0,0),i1.bind(void 0,1),o1.bind(void 0,0),o1.bind(void 0,1),F6,U6,a1.bind(void 0,0),a1.bind(void 0,1),$6,z6,l1.bind(void 0,0),l1.bind(void 0,1),H6,G6,W6,V6,q6,Z6,c1.bind(void 0,0),c1.bind(void 0,1),void 0,u1.bind(void 0,0),u1.bind(void 0,1),Y6,void 0,K6,void 0,void 0,X6,J6,eb,tb,rb,nb,sb,ib,ob,ab,lb,cb,ub,ih.bind(void 0,1),db,hb,fb,pb,mb,gb,xb,bb,yb,vb,pu.bind(void 0,0),pu.bind(void 0,1),pu.bind(void 0,2),pu.bind(void 0,3),void 0,void 0,void 0,void 0,wb,ih.bind(void 0,2),ih.bind(void 0,3),oh.bind(void 0,1),oh.bind(void 0,2),oh.bind(void 0,3),Ab,Tb,void 0,void 0,Cb,void 0,_b,Sb,sh,sh,void 0,void 0,void 0,void 0,void 0,Lb,d1.bind(void 0,0),d1.bind(void 0,1),Ib,void 0,kb,Eb,Mb,Rb,Nb,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,nl.bind(void 0,1),nl.bind(void 0,2),nl.bind(void 0,3),nl.bind(void 0,4),nl.bind(void 0,5),nl.bind(void 0,6),nl.bind(void 0,7),nl.bind(void 0,8),sl.bind(void 0,1),sl.bind(void 0,2),sl.bind(void 0,3),sl.bind(void 0,4),sl.bind(void 0,5),sl.bind(void 0,6),sl.bind(void 0,7),sl.bind(void 0,8),Zt.bind(void 0,0,0,0,0,0),Zt.bind(void 0,0,0,0,0,1),Zt.bind(void 0,0,0,0,0,2),Zt.bind(void 0,0,0,0,0,3),Zt.bind(void 0,0,0,0,1,0),Zt.bind(void 0,0,0,0,1,1),Zt.bind(void 0,0,0,0,1,2),Zt.bind(void 0,0,0,0,1,3),Zt.bind(void 0,0,0,1,0,0),Zt.bind(void 0,0,0,1,0,1),Zt.bind(void 0,0,0,1,0,2),Zt.bind(void 0,0,0,1,0,3),Zt.bind(void 0,0,0,1,1,0),Zt.bind(void 0,0,0,1,1,1),Zt.bind(void 0,0,0,1,1,2),Zt.bind(void 0,0,0,1,1,3),Zt.bind(void 0,0,1,0,0,0),Zt.bind(void 0,0,1,0,0,1),Zt.bind(void 0,0,1,0,0,2),Zt.bind(void 0,0,1,0,0,3),Zt.bind(void 0,0,1,0,1,0),Zt.bind(void 0,0,1,0,1,1),Zt.bind(void 0,0,1,0,1,2),Zt.bind(void 0,0,1,0,1,3),Zt.bind(void 0,0,1,1,0,0),Zt.bind(void 0,0,1,1,0,1),Zt.bind(void 0,0,1,1,0,2),Zt.bind(void 0,0,1,1,0,3),Zt.bind(void 0,0,1,1,1,0),Zt.bind(void 0,0,1,1,1,1),Zt.bind(void 0,0,1,1,1,2),Zt.bind(void 0,0,1,1,1,3),Zt.bind(void 0,1,0,0,0,0),Zt.bind(void 0,1,0,0,0,1),Zt.bind(void 0,1,0,0,0,2),Zt.bind(void 0,1,0,0,0,3),Zt.bind(void 0,1,0,0,1,0),Zt.bind(void 0,1,0,0,1,1),Zt.bind(void 0,1,0,0,1,2),Zt.bind(void 0,1,0,0,1,3),Zt.bind(void 0,1,0,1,0,0),Zt.bind(void 0,1,0,1,0,1),Zt.bind(void 0,1,0,1,0,2),Zt.bind(void 0,1,0,1,0,3),Zt.bind(void 0,1,0,1,1,0),Zt.bind(void 0,1,0,1,1,1),Zt.bind(void 0,1,0,1,1,2),Zt.bind(void 0,1,0,1,1,3),Zt.bind(void 0,1,1,0,0,0),Zt.bind(void 0,1,1,0,0,1),Zt.bind(void 0,1,1,0,0,2),Zt.bind(void 0,1,1,0,0,3),Zt.bind(void 0,1,1,0,1,0),Zt.bind(void 0,1,1,0,1,1),Zt.bind(void 0,1,1,0,1,2),Zt.bind(void 0,1,1,0,1,3),Zt.bind(void 0,1,1,1,0,0),Zt.bind(void 0,1,1,1,0,1),Zt.bind(void 0,1,1,1,0,2),Zt.bind(void 0,1,1,1,0,3),Zt.bind(void 0,1,1,1,1,0),Zt.bind(void 0,1,1,1,1,1),Zt.bind(void 0,1,1,1,1,2),Zt.bind(void 0,1,1,1,1,3)];var Db=pr;function o0(n){this.char=n,this.state={},this.activeState=null}function ah(n,i,l){this.contextName=l,this.startIndex=n,this.endOffset=i}function Qb(n,i,l){this.contextName=n,this.openRange=null,this.ranges=[],this.checkStart=i,this.checkEnd=l}function Ri(n,i){this.context=n,this.index=i,this.length=n.length,this.current=n[i],this.backtrack=n.slice(0,i),this.lookahead=n.slice(i+1)}function mu(n){this.eventId=n,this.subscribers=[]}function Bb(n){let i=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];for(let d=0;d<i.length;d++){let h=i[d];Object.defineProperty(this.events,h,{value:new mu(h)})}if(n)for(let d=0;d<i.length;d++){let h=i[d],p=n[h];typeof p=="function"&&this.events[h].subscribe(p)}let l=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];for(let d=0;d<l.length;d++){let h=l[d];this.events[h].subscribe(this.updateContextsRanges)}}function ms(n){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],Bb.call(this,n)}o0.prototype.setState=function(n,i){return this.state[n]=i,this.activeState={key:n,value:this.state[n]},this.activeState},o0.prototype.getState=function(n){return this.state[n]||null},ms.prototype.inboundIndex=function(n){return n>=0&&n<this.tokens.length},ms.prototype.composeRUD=function(n){let i=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(i.every(l))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:i.filter(l)};this.dispatch("composeRUD",[i.filter(d=>!l(d))])},ms.prototype.replaceRange=function(n,i,l,d){i=i!==null?i:this.tokens.length;let h=l.every(p=>p instanceof o0);if(!isNaN(n)&&this.inboundIndex(n)&&h){let p=this.tokens.splice.apply(this.tokens,[n,i].concat(l));return d||this.dispatch("replaceToken",[n,i,l]),[p,l]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},ms.prototype.replaceToken=function(n,i,l){if(!isNaN(n)&&this.inboundIndex(n)&&i instanceof o0){let d=this.tokens.splice(n,1,i);return l||this.dispatch("replaceToken",[n,i]),[d[0],i]}else return{FAIL:"replaceToken: invalid token or index."}},ms.prototype.removeRange=function(n,i,l){i=isNaN(i)?this.tokens.length:i;let d=this.tokens.splice(n,i);return l||this.dispatch("removeRange",[d,n,i]),d},ms.prototype.removeToken=function(n,i){if(!isNaN(n)&&this.inboundIndex(n)){let l=this.tokens.splice(n,1);return i||this.dispatch("removeToken",[l,n]),l}else return{FAIL:"removeToken: invalid token index."}},ms.prototype.insertToken=function(n,i,l){return n.every(d=>d instanceof o0)?(this.tokens.splice.apply(this.tokens,[i,0].concat(n)),l||this.dispatch("insertToken",[n,i]),n):{FAIL:"insertToken: invalid token(s)."}},ms.prototype.registerModifier=function(n,i,l){this.events.newToken.subscribe(function(d,h){let p=[d,h],y=i===null||i.apply(this,p)===!0,A=[d,h];if(y){let _=l.apply(this,A);d.setState(n,_)}}),this.registeredModifiers.push(n)},mu.prototype.subscribe=function(n){return typeof n=="function"?this.subscribers.push(n)-1:{FAIL:`invalid '${this.eventId}' event handler`}},mu.prototype.unsubscribe=function(n){this.subscribers.splice(n,1)},Ri.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)},Ri.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}},ms.prototype.rangeToText=function(n){if(n instanceof ah)return this.getRangeTokens(n).map(i=>i.char).join("")},ms.prototype.getText=function(){return this.tokens.map(n=>n.char).join("")},ms.prototype.getContext=function(n){return this.registeredContexts[n]||null},ms.prototype.on=function(n,i){let l=this.events[n];return l?l.subscribe(i):null},ms.prototype.dispatch=function(n,i){let l=this.events[n];if(l instanceof mu)for(let d=0;d<l.subscribers.length;d++)l.subscribers[d].apply(this,i||[])},ms.prototype.registerContextChecker=function(n,i,l){if(this.getContext(n))return{FAIL:`context name '${n}' is already registered.`};if(typeof i!="function")return{FAIL:"missing context start check."};if(typeof l!="function")return{FAIL:"missing context end check."};let d=new Qb(n,i,l);return this.registeredContexts[n]=d,this.contextCheckers.push(d),d},ms.prototype.getRangeTokens=function(n){let i=n.startIndex+n.endOffset;return[].concat(this.tokens.slice(n.startIndex,i))},ms.prototype.getContextRanges=function(n){let i=this.getContext(n);return i?i.ranges:{FAIL:`context checker '${n}' is not registered.`}},ms.prototype.resetContextsRanges=function(){let n=this.registeredContexts;for(let i in n)if(Object.prototype.hasOwnProperty.call(n,i)){let l=n[i];l.ranges=[]}},ms.prototype.updateContextsRanges=function(){this.resetContextsRanges();let n=this.tokens.map(i=>i.char);for(let i=0;i<n.length;i++){let l=new Ri(n,i);this.runContextCheck(l)}this.dispatch("updateContextsRanges",[this.registeredContexts])},ms.prototype.setEndOffset=function(n,i){let l=this.getContext(i).openRange.startIndex,d=new ah(l,n,i),h=this.getContext(i).ranges;return d.rangeId=`${i}.${h.length}`,h.push(d),this.getContext(i).openRange=null,d},ms.prototype.runContextCheck=function(n){let i=n.index;for(let l=0;l<this.contextCheckers.length;l++){let d=this.contextCheckers[l],h=d.contextName,p=this.getContext(h).openRange;if(!p&&d.checkStart(n)&&(p=new ah(i,null,h),this.getContext(h).openRange=p,this.dispatch("contextStart",[h,i])),p&&d.checkEnd(n)){let y=i-p.startIndex+1,A=this.setEndOffset(y,h);this.dispatch("contextEnd",[h,A])}}},ms.prototype.tokenize=function(n){this.tokens=[],this.resetContextsRanges();let i=Array.from(n);this.dispatch("start");for(let l=0;l<i.length;l++){let d=i[l],h=new Ri(i,l);this.dispatch("next",[h]),this.runContextCheck(h);let p=new o0(d);this.tokens.push(p),this.dispatch("newToken",[p,h])}return this.dispatch("end",[this.tokens]),this.tokens};var jb=ms;function il(n){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(n)}function h1(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 ol(n){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(n)}function gu(n){return/[\u0E00-\u0E7F]/.test(n)}function xu(n){return/[A-z]/.test(n)}function Pb(n){return/\s/.test(n)}function ao(n){this.font=n,this.features={}}function al(n){this.id=n.id,this.tag=n.tag,this.substitution=n.substitution}function ll(n,i){if(!n)return-1;switch(i.format){case 1:return i.glyphs.indexOf(n);case 2:{let l=i.ranges;for(let d=0;d<l.length;d++){let h=l[d];if(n>=h.start&&n<=h.end){let p=n-h.start;return h.index+p}}break}default:return-1}return-1}function Ob(n,i){return ll(n,i.coverage)===-1?null:n+i.deltaGlyphId}function Fb(n,i){let l=ll(n,i.coverage);return l===-1?null:i.substitute[l]}function lh(n,i){let l=[];for(let d=0;d<n.length;d++){let h=n[d],p=i.current;p=Array.isArray(p)?p[0]:p;let y=ll(p,h);y!==-1&&l.push(y)}return l.length!==n.length?-1:l}function Ub(n,i){let l=i.inputCoverage.length+i.lookaheadCoverage.length+i.backtrackCoverage.length;if(n.context.length<l)return[];let d=lh(i.inputCoverage,n);if(d===-1)return[];let h=i.inputCoverage.length-1;if(n.lookahead.length<i.lookaheadCoverage.length)return[];let p=n.lookahead.slice(h);for(;p.length&&ol(p[0].char);)p.shift();let y=new Ri(p,0),A=lh(i.lookaheadCoverage,y),_=[].concat(n.backtrack);for(_.reverse();_.length&&ol(_[0].char);)_.shift();if(_.length<i.backtrackCoverage.length)return[];let M=new Ri(_,0),E=lh(i.backtrackCoverage,M),z=d.length===i.inputCoverage.length&&A.length===i.lookaheadCoverage.length&&E.length===i.backtrackCoverage.length,U=[];if(z)for(let te=0;te<i.lookupRecords.length;te++){let Y=i.lookupRecords[te],ae=Y.lookupListIndex,ze=this.getLookupByIndex(ae);for(let Jt=0;Jt<ze.subtables.length;Jt++){let Vt=ze.subtables[Jt],mr,Dr=this.getSubstitutionType(ze,Vt);if(Dr==="71"?(Dr=this.getSubstitutionType(Vt,Vt.extension),mr=this.getLookupMethod(Vt,Vt.extension),Vt=Vt.extension):mr=this.getLookupMethod(ze,Vt),Dr==="12"){let An=n.get(Y.sequenceIndex),Dn=mr(An);Dn&&U.push(Dn)}else if(Dr==="21"){let An=n.get(Y.sequenceIndex),Dn=mr(An);Dn&&U.push(Dn)}else throw new Error(`Substitution type ${Dr} is not supported in chaining substitution`)}}return U}function $b(n,i){let l=n.current,d=ll(l,i.coverage);if(d===-1)return null;let h,p=i.ligatureSets[d];for(let y=0;y<p.length;y++){h=p[y];for(let A=0;A<h.components.length;A++){let _=n.lookahead[A],M=h.components[A];if(_!==M)break;if(A===h.components.length-1)return h}}return null}function zb(n,i){let l=n.current;if(ll(l,i.coverage)===-1)return null;for(let d of i.ruleSets)for(let h of d){let p=!0;for(let y=0;y<h.input.length;y++)if(n.lookahead[y]!==h.input[y]){p=!1;break}if(p){let y=[];y.push(l);for(let _=0;_<h.input.length;_++)y.push(h.input[_]);let A=(_,M)=>{let{lookupListIndex:E,sequenceIndex:z}=M,{subtables:U}=this.getLookupByIndex(E);for(let te of U)ll(_[z],te.coverage)!==-1&&(_[z]=te.deltaGlyphId)};for(let _=0;_<h.lookupRecords.length;_++){let M=h.lookupRecords[_];A(y,M)}return y}}return null}function Hb(n,i){if(n.context.length<i.coverages.length)return[];for(let d=0;d<i.coverages.length;d++){let h=n.get(d);if(h=Array.isArray(h)?h[0]:h,ll(h,i.coverages[d])===-1)return[]}let l=[];for(let d=0;d<i.lookupRecords.length;d++){let h=i.lookupRecords[d],p=h.lookupListIndex,y=this.getLookupByIndex(p);for(let A=0;A<y.subtables.length;A++){let _=y.subtables[A],M,E=this.getSubstitutionType(y,_);if(E==="71"?(E=this.getSubstitutionType(_,_.extension),M=this.getLookupMethod(_,_.extension),_=_.extension):M=this.getLookupMethod(y,_),E==="12"){let z=n.get(h.sequenceIndex),U=M(z);U&&l.push(U)}else if(E==="21"){let z=n.get(h.sequenceIndex),U=M(z);U&&l.push(U)}}}return l}function Gb(n,i){let l=ll(n,i.coverage);return l===-1?null:i.sequences[l]}ao.prototype.getDefaultScriptFeaturesIndexes=function(){let n=this.font.tables.gsub.scripts;for(let i=0;i<n.length;i++){let l=n[i];if(l.tag==="DFLT")return l.script.defaultLangSys.featureIndexes}return[]},ao.prototype.getScriptFeaturesIndexes=function(n){if(!this.font.tables.gsub)return[];if(!n)return this.getDefaultScriptFeaturesIndexes();let i=this.font.tables.gsub.scripts;for(let l=0;l<i.length;l++){let d=i[l];if(d.tag===n&&d.script.defaultLangSys)return d.script.defaultLangSys.featureIndexes;{let h=d.langSysRecords;if(h)for(let p=0;p<h.length;p++){let y=h[p];if(y.tag===n)return y.langSys.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},ao.prototype.mapTagsToFeatures=function(n,i){let l={};for(let d=0;d<n.length;d++){let h=n[d].tag,p=n[d].feature;l[h]=p}this.features[i].tags=l},ao.prototype.getScriptFeatures=function(n){let i=this.features[n];if(Object.prototype.hasOwnProperty.call(this.features,n))return i;let l=this.getScriptFeaturesIndexes(n);if(!l)return null;let d=this.font.tables.gsub;return i=l.map(h=>d.features[h]),this.features[n]=i,this.mapTagsToFeatures(i,n),i},ao.prototype.getSubstitutionType=function(n,i){let l=n.lookupType.toString(),d=i.substFormat.toString();return l+d},ao.prototype.getLookupMethod=function(n,i){let l=this.getSubstitutionType(n,i);switch(l){case"11":return d=>Ob.apply(this,[d,i]);case"12":return d=>Fb.apply(this,[d,i]);case"63":return d=>Ub.apply(this,[d,i]);case"41":return d=>$b.apply(this,[d,i]);case"21":return d=>Gb.apply(this,[d,i]);case"51":return d=>zb.apply(this,[d,i]);case"53":return d=>Hb.apply(this,[d,i]);default:throw new Error(`substitutionType : ${l} lookupType: ${n.lookupType} - substFormat: ${i.substFormat} is not yet supported`)}},ao.prototype.lookupFeature=function(n){let i=n.contextParams,l=i.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 h=this.getFeatureLookups(d),p=[].concat(i.context);for(let y=0;y<h.length;y++){let A=h[y],_=this.getLookupSubtables(A);for(let M=0;M<_.length;M++){let E=_[M],z=this.getSubstitutionType(A,E),U;z==="71"?(z=this.getSubstitutionType(E,E.extension),U=this.getLookupMethod(E,E.extension),E=E.extension):U=this.getLookupMethod(A,E);let te;switch(z){case"11":te=U(i.current),te&&p.splice(l,1,new al({id:11,tag:n.tag,substitution:te}));break;case"12":te=U(i.current),te&&p.splice(l,1,new al({id:12,tag:n.tag,substitution:te}));break;case"63":te=U(i),Array.isArray(te)&&te.length&&p.splice(l,1,new al({id:63,tag:n.tag,substitution:te}));break;case"41":te=U(i),te&&p.splice(l,1,new al({id:41,tag:n.tag,substitution:te}));break;case"21":te=U(i.current),te&&p.splice(l,1,new al({id:21,tag:n.tag,substitution:te}));break;case"51":case"53":te=U(i),Array.isArray(te)&&te.length&&p.splice(l,1,new al({id:parseInt(z),tag:n.tag,substitution:te}));break}i=new Ri(p,l),!(Array.isArray(te)&&!te.length)&&(te=null)}}return p.length?p:null},ao.prototype.supports=function(n){if(!n.script)return!1;this.getScriptFeatures(n.script);let i=Object.prototype.hasOwnProperty.call(this.features,n.script);if(!n.tag)return i;let l=this.features[n.script].some(d=>d.tag===n.tag);return i&&l},ao.prototype.getLookupSubtables=function(n){return n.subtables||null},ao.prototype.getLookupByIndex=function(n){return this.font.tables.gsub.lookups[n]||null},ao.prototype.getFeatureLookups=function(n){return n.lookupListIndexes.map(this.getLookupByIndex.bind(this))},ao.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 i=this.features[n.script];return i?i.tags[n.tag]?this.features[n.script].tags[n.tag]:null:{FAIL:`No feature for script ${n.script}`}};var Wb=ao;function Vb(n){let i=n.current,l=n.get(-1);return l===null&&il(i)||!il(l)&&il(i)}function qb(n){let i=n.get(1);return i===null||!il(i)}var Zb={startCheck:Vb,endCheck:qb};function Yb(n){let i=n.current,l=n.get(-1);return(il(i)||ol(i))&&!il(l)}function Kb(n){let i=n.get(1);switch(!0){case i===null:return!0;case(!il(i)&&!ol(i)):{let l=Pb(i);if(!l)return!0;if(l){let d=!1;if(d=n.lookahead.some(h=>il(h)||ol(h)),!d)return!0}break}default:return!1}}var Xb={startCheck:Yb,endCheck:Kb};function Jb(n,i,l){i[l].setState(n.tag,n.substitution)}function e4(n,i,l){i[l].setState(n.tag,n.substitution)}function ch(n,i,l){for(let d=0;d<n.substitution.length;d++){let h=n.substitution[d],p=i[l+d];if(Array.isArray(h)){h.length?p.setState(n.tag,h[0]):p.setState("deleted",!0);continue}p.setState(n.tag,h)}}function t4(n,i,l){let d=i[l];d.setState(n.tag,n.substitution.ligGlyph);let h=n.substitution.components.length;for(let p=0;p<h;p++)d=i[l+p+1],d.setState("deleted",!0)}var f1={11:Jb,12:e4,63:ch,41:t4,51:ch,53:ch};function r4(n,i,l){n instanceof al&&f1[n.id]&&f1[n.id](n,i,l)}var Il=r4;function n4(n){let i=[].concat(n.backtrack);for(let l=i.length-1;l>=0;l--){let d=i[l],h=h1(d),p=ol(d);if(!h&&!p)return!0;if(h)return!1}return!1}function s4(n){if(h1(n.current))return!1;for(let i=0;i<n.lookahead.length;i++){let l=n.lookahead[i];if(!ol(l))return!0}return!1}function i4(n){let i="arab",l=this.featuresTags[i],d=this.tokenizer.getRangeTokens(n);if(d.length===1)return;let h=new Ri(d.map(y=>y.getState("glyphIndex")),0),p=new Ri(d.map(y=>y.char),0);for(let y=0;y<d.length;y++){let A=d[y];if(ol(A.char))continue;h.setCurrentIndex(y),p.setCurrentIndex(y);let _=0;n4(p)&&(_|=1),s4(p)&&(_|=2);let M;switch(_){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:i,contextParams:h});if(E instanceof Error){console.info(E.message);continue}for(let z=0;z<E.length;z++){let U=E[z];U instanceof al&&(Il(U,d,z),h.context[z]=U.substitution)}}}var o4=i4;function p1(n,i){let l=n.map(d=>d.activeState.value);return new Ri(l,i||0)}function a4(n){let i="arab",l=this.tokenizer.getRangeTokens(n),d=p1(l);for(let h=0;h<d.context.length;h++){d.setCurrentIndex(h);let p=this.query.lookupFeature({tag:"rlig",script:i,contextParams:d});if(p.length){for(let y=0;y<p.length;y++){let A=p[y];Il(A,l,h)}d=p1(l)}}}var l4=a4;function c4(n){return n.index===0&&n.context.length>1}function u4(n){return n.index===n.context.length-1}var d4={startCheck:c4,endCheck:u4};function m1(n,i){let l=n.map(d=>d.activeState.value);return new Ri(l,i||0)}function h4(n){let i="delf",l="ccmp",d=this.tokenizer.getRangeTokens(n),h=m1(d);for(let p=0;p<h.context.length;p++){if(!this.query.getFeature({tag:l,script:i,contextParams:h}))continue;h.setCurrentIndex(p);let y=this.query.lookupFeature({tag:l,script:i,contextParams:h});if(y.length){for(let A=0;A<y.length;A++){let _=y[A];Il(_,d,p)}h=m1(d)}}}var f4=h4;function p4(n){let i=n.current,l=n.get(-1);return l===null&&xu(i)||!xu(l)&&xu(i)}function m4(n){let i=n.get(1);return i===null||!xu(i)}var g4={startCheck:p4,endCheck:m4};function g1(n,i){let l=n.map(d=>d.activeState.value);return new Ri(l,i||0)}function x4(n){let i="latn",l=this.tokenizer.getRangeTokens(n),d=g1(l);for(let h=0;h<d.context.length;h++){d.setCurrentIndex(h);let p=this.query.lookupFeature({tag:"liga",script:i,contextParams:d});if(p.length){for(let y=0;y<p.length;y++){let A=p[y];Il(A,l,h)}d=g1(l)}}}var b4=x4;function y4(n){let i=n.current,l=n.get(-1);return l===null&&gu(i)||!gu(l)&&gu(i)}function v4(n){let i=n.get(1);return i===null||!gu(i)}var w4={startCheck:y4,endCheck:v4};function x1(n,i){let l=n.map(d=>d.activeState.value);return new Ri(l,i||0)}function A4(n){let i="thai",l=this.tokenizer.getRangeTokens(n),d=x1(l,0);for(let h=0;h<d.context.length;h++){d.setCurrentIndex(h);let p=this.query.lookupFeature({tag:"ccmp",script:i,contextParams:d});if(p.length){for(let y=0;y<p.length;y++){let A=p[y];Il(A,l,h)}d=x1(l,h)}}}var T4=A4;function b1(n,i){let l=n.map(d=>d.activeState.value);return new Ri(l,i||0)}function C4(n){let i="thai",l=this.tokenizer.getRangeTokens(n),d=b1(l,0);for(let h=0;h<d.context.length;h++){d.setCurrentIndex(h);let p=this.query.lookupFeature({tag:"liga",script:i,contextParams:d});if(p.length){for(let y=0;y<p.length;y++){let A=p[y];Il(A,l,h)}d=b1(l,h)}}}var _4=C4;function y1(n,i){let l=n.map(d=>d.activeState.value);return new Ri(l,i||0)}function S4(n){let i="thai",l=this.tokenizer.getRangeTokens(n),d=y1(l,0);for(let h=0;h<d.context.length;h++){d.setCurrentIndex(h);let p=this.query.lookupFeature({tag:"rlig",script:i,contextParams:d});if(p.length){for(let y=0;y<p.length;y++){let A=p[y];Il(A,l,h)}d=y1(l,h)}}}var L4=S4;function uh(n){if(n===null)return!1;let i=n.codePointAt(0);return i>=6155&&i<=6157||i>=65024&&i<=65039||i>=917760&&i<=917999}function I4(n){let i=n.current,l=n.get(1);return l===null&&uh(i)||uh(l)}function k4(n){let i=n.get(1);return i===null||!uh(i)}var E4={startCheck:I4,endCheck:k4};function M4(n){let i=this.query.font,l=this.tokenizer.getRangeTokens(n);if(l[1].setState("deleted",!0),i.tables.cmap&&i.tables.cmap.varSelectorList){let d=l[0].char.codePointAt(0),h=l[1].char.codePointAt(0),p=i.tables.cmap.varSelectorList[h];if(p!==void 0&&p.nonDefaultUVS){let y=p.nonDefaultUVS.uvsMappings;if(y[d]){let A=y[d].glyphID;i.glyphs.glyphs[A]!==void 0&&l[0].setState("glyphIndex",A)}}}}var R4=M4;function Ao(n){this.baseDir=n||"ltr",this.tokenizer=new jb,this.featuresTags={}}Ao.prototype.setText=function(n){this.text=n},Ao.prototype.contextChecks={ccmpReplacementCheck:d4,latinWordCheck:g4,arabicWordCheck:Zb,arabicSentenceCheck:Xb,thaiWordCheck:w4,unicodeVariationSequenceCheck:E4};function a0(n){let i=this.contextChecks[`${n}Check`];return this.tokenizer.registerContextChecker(n,i.startCheck,i.endCheck)}function N4(){return a0.call(this,"ccmpReplacement"),a0.call(this,"latinWord"),a0.call(this,"arabicWord"),a0.call(this,"arabicSentence"),a0.call(this,"thaiWord"),a0.call(this,"unicodeVariationSequence"),this.tokenizer.tokenize(this.text)}function D4(){let n=this.tokenizer.getContextRanges("arabicSentence");for(let i=0;i<n.length;i++){let l=n[i],d=this.tokenizer.getRangeTokens(l);this.tokenizer.replaceRange(l.startIndex,l.endOffset,d.reverse())}}Ao.prototype.registerFeatures=function(n,i){let l=i.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},Ao.prototype.applyFeatures=function(n,i){if(!n)throw new Error("No valid font was provided to apply features");this.query||(this.query=new Wb(n));for(let l=0;l<i.length;l++){let d=i[l];this.query.supports({script:d.script})&&this.registerFeatures(d.script,d.tags)}},Ao.prototype.registerModifier=function(n,i,l){this.tokenizer.registerModifier(n,i,l)};function X0(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function Q4(){if(!Object.prototype.hasOwnProperty.call(this.featuresTags,"arab"))return;X0.call(this);let n=this.tokenizer.getContextRanges("arabicWord");for(let i=0;i<n.length;i++){let l=n[i];o4.call(this,l)}}function B4(){X0.call(this);let n=this.tokenizer.getContextRanges("ccmpReplacement");for(let i=0;i<n.length;i++){let l=n[i];f4.call(this,l)}}function j4(){if(!this.hasFeatureEnabled("arab","rlig"))return;X0.call(this);let n=this.tokenizer.getContextRanges("arabicWord");for(let i=0;i<n.length;i++){let l=n[i];l4.call(this,l)}}function P4(){if(!this.hasFeatureEnabled("latn","liga"))return;X0.call(this);let n=this.tokenizer.getContextRanges("latinWord");for(let i=0;i<n.length;i++){let l=n[i];b4.call(this,l)}}function O4(){let n=this.tokenizer.getContextRanges("unicodeVariationSequence");for(let i=0;i<n.length;i++){let l=n[i];R4.call(this,l)}}function F4(){X0.call(this);let n=this.tokenizer.getContextRanges("thaiWord");for(let i=0;i<n.length;i++){let l=n[i];this.hasFeatureEnabled("thai","liga")&&_4.call(this,l),this.hasFeatureEnabled("thai","rlig")&&L4.call(this,l),this.hasFeatureEnabled("thai","ccmp")&&T4.call(this,l)}}Ao.prototype.checkContextReady=function(n){return!!this.tokenizer.getContext(n)},Ao.prototype.applyFeaturesToContexts=function(){this.checkContextReady("ccmpReplacement")&&B4.call(this),this.checkContextReady("arabicWord")&&(Q4.call(this),j4.call(this)),this.checkContextReady("latinWord")&&P4.call(this),this.checkContextReady("arabicSentence")&&D4.call(this),this.checkContextReady("thaiWord")&&F4.call(this),this.checkContextReady("unicodeVariationSequence")&&O4.call(this)},Ao.prototype.hasFeatureEnabled=function(n,i){return(this.featuresTags[n]||[]).indexOf(i)!==-1},Ao.prototype.processText=function(n){(!this.text||this.text!==n)&&(this.setText(n),N4.call(this),this.applyFeaturesToContexts())},Ao.prototype.getBidiText=function(n){return this.processText(n),this.tokenizer.getText()},Ao.prototype.getTextGlyphs=function(n){this.processText(n);let i=[];for(let l=0;l<this.tokenizer.tokens.length;l++){let d=this.tokenizer.tokens[l];if(d.state.deleted)continue;let h=d.activeState.value;i.push(Array.isArray(h)?h[0]:h)}return i};var U4=Ao;function dh(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 In(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=dh(n),this.names.macintosh=dh(n),this.names.windows=dh(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 i=0;n.fsSelection?i=n.fsSelection:(this.italicAngle<0?i|=this.fsSelectionValues.ITALIC:this.italicAngle>0&&(i|=this.fsSelectionValues.OBLIQUE),this.weightClass>=600&&(i|=this.fsSelectionValues.BOLD),i===0&&(i=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:i},n.tables.os2)})}this.supported=!0,this.glyphs=new Er.GlyphSet(this,n.glyphs||[]),this.encoding=new Kn(this),this.position=new Ja(this),this.substitution=new lu(this),this.tables=this.tables||{},this.tables=new Proxy(this.tables,{set:(i,l,d)=>(i[l]=d,i.fvar&&(i.gvar||i.cff2)&&!this.variation&&(this.variation=new hu(this)),!0)}),this.palettes=new W0(this),this.layers=new cu(this),this.svgImages=new uu(this),this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:this.outlinesFormat==="truetype"?this._hinting=new Db(this):null}})}In.prototype.hasChar=function(n){return this.encoding.charToGlyphIndex(n)>0},In.prototype.charToGlyphIndex=function(n){return this.encoding.charToGlyphIndex(n)},In.prototype.charToGlyph=function(n){let i=this.charToGlyphIndex(n),l=this.glyphs.get(i);return l||(l=this.glyphs.get(0)),l},In.prototype.updateFeatures=function(n){return this.defaultRenderOptions.features.map(i=>i.script==="latn"?{script:"latn",tags:i.tags.filter(l=>n[l])}:i)},In.prototype.stringToGlyphIndexes=function(n,i){let l=new U4,d=p=>this.charToGlyphIndex(p.char);l.registerModifier("glyphIndex",null,d);let h=i?this.updateFeatures(i.features):this.defaultRenderOptions.features;return l.applyFeatures(this,h),l.getTextGlyphs(n)},In.prototype.stringToGlyphs=function(n,i){let l=this.stringToGlyphIndexes(n,i),d=l.length,h=new Array(d),p=this.glyphs.get(0);for(let y=0;y<d;y+=1)h[y]=this.glyphs.get(l[y])||p;return h},In.prototype.nameToGlyphIndex=function(n){return this.glyphNames.nameToGlyphIndex(n)},In.prototype.nameToGlyph=function(n){let i=this.nameToGlyphIndex(n),l=this.glyphs.get(i);return l||(l=this.glyphs.get(0)),l},In.prototype.glyphIndexToName=function(n){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(n):""},In.prototype.getKerningValue=function(n,i){n=n.index||n,i=i.index||i;let l=this.position.defaultKerningTables;return l?this.position.getKerningValue(l,n,i):this.kerningPairs[n+","+i]||0},In.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},In.prototype.forEachGlyph=function(n,i,l,d,h,p){i=i!==void 0?i:0,l=l!==void 0?l:0,d=d!==void 0?d:72,h=Object.assign({},this.defaultRenderOptions,h);let y=1/this.unitsPerEm*d,A=this.stringToGlyphs(n,h),_;if(h.kerning){let M=h.script||this.position.getDefaultScriptName();_=this.position.getKerningTables(M,h.language)}for(let M=0;M<A.length;M+=1){let E=A[M];if(p.call(this,E,i,l,d,h),E.advanceWidth&&(i+=E.advanceWidth*y),h.kerning&&M<A.length-1){let z=_?this.position.getKerningValue(_,E.index,A[M+1].index):this.getKerningValue(E,A[M+1]);i+=z*y}h.letterSpacing?i+=h.letterSpacing*d:h.tracking&&(i+=h.tracking/1e3*d)}return i},In.prototype.getPath=function(n,i,l,d,h){h=Object.assign({},this.defaultRenderOptions,h);let p=new Je;if(p._layers=[],En(this,p,d),p.stroke){let y=1/(p.unitsPerEm||1e3)*d;p.strokeWidth*=y}return this.forEachGlyph(n,i,l,d,h,(y,A,_,M)=>{let E=y.getPath(A,_,M,h,this);if(h.drawSVG||h.drawLayers){let z=E._layers;if(z&&z.length){for(let U=0;U<z.length;U++){let te=z[U];p._layers.push(te)}return}}p.extend(E)}),p},In.prototype.getPaths=function(n,i,l,d,h){h=Object.assign({},this.defaultRenderOptions,h);let p=[];return this.forEachGlyph(n,i,l,d,h,function(y,A,_,M){let E=y.getPath(A,_,M,h,this);p.push(E)}),p},In.prototype.getAdvanceWidth=function(n,i,l){return l=Object.assign({},this.defaultRenderOptions,l),this.forEachGlyph(n,0,0,i,l,function(){})},In.prototype.draw=function(n,i,l,d,h,p){this.getPath(i,l,d,h,p).draw(n)},In.prototype.drawPoints=function(n,i,l,d,h,p){p=Object.assign({},this.defaultRenderOptions,p),this.forEachGlyph(i,l,d,h,p,function(y,A,_,M){y.drawPoints(n,A,_,M,p,this)})},In.prototype.drawMetrics=function(n,i,l,d,h,p){p=Object.assign({},this.defaultRenderOptions,p),this.forEachGlyph(i,l,d,h,p,function(y,A,_,M){y.drawMetrics(n,A,_,M)})},In.prototype.getEnglishName=function(n){let i=(this.names.unicode||this.names.macintosh||this.names.windows)[n];if(i)return i.en},In.prototype.validate=function(){let n=[],i=this;function l(h,p){h||(console.warn(`[opentype.js] ${p}`),n.push(p))}function d(h){let p=i.getEnglishName(h);l(p&&p.trim().length>0,"No English "+h+" specified.")}if(d("fontFamily"),d("weightName"),d("manufacturer"),d("copyright"),d("version"),l(this.unitsPerEm>0,"No unitsPerEm specified."),this.tables.colr){let h=this.tables.colr.baseGlyphRecords,p=-1;for(let y=0;y<h.length;y++){let A=h[y].glyphID;if(l(p<h[y].glyphID,`baseGlyphs must be sorted by GlyphID in ascending order, but glyphID ${A} comes after ${p}`),p>h[y].glyphID)break;p=A}}return n},In.prototype.toTables=function(){return Ho.fontToTable(this)},In.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},In.prototype.toArrayBuffer=function(){let n=this.toTables().encode(),i=new ArrayBuffer(n.length),l=new Uint8Array(i);for(let d=0;d<n.length;d++)l[d]=n[d];return i},In.prototype.download=function(){console.error("DEPRECATED: platform-specific actions are to be implemented on user-side")},In.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},In.prototype.macStyleValues={BOLD:1,ITALIC:2,UNDERLINE:4,OUTLINED:8,SHADOW:16,CONDENSED:32,EXTENDED:64},In.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},In.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=In;function $4(n,i){let l=new mt.Parser(n,i),d=l.parseUShort(),h=l.parseUShort();d!==1&&console.warn(`Unsupported hvar table version ${d}.${h}`);let p=[d,h],y=l.parsePointer32(function(){return this.parseItemVariationStore()}),A=l.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),_=l.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),M=l.parsePointer32(function(){return this.parseDeltaSetIndexMap()});return{version:p,itemVariationStore:y,advanceWidth:A,lsb:_,rsb:M}}function z4(){console.warn("Writing of hvar tables is not yet supported.")}var H4={make:z4,parse:$4},G4=function(){return{coverage:this.parsePointer(ne.coverage),attachPoints:this.parseList(ne.pointer(ne.uShortList))}},W4=function(){var n=this.parseUShort();if(ce.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()}},V4=function(){return this.parseList(ne.pointer(W4))},q4=function(){return{coverage:this.parsePointer(ne.coverage),ligGlyphs:this.parseList(ne.pointer(V4))}},Z4=function(){return this.parseUShort(),this.parseList(ne.pointer(ne.coverage))};function Y4(n,i){i=i||0;let l=new ne(n,i),d=l.parseVersion(1);ce.argument(d===1||d===1.2||d===1.3,"Unsupported GDEF table version.");var h={version:d,classDef:l.parsePointer(ne.classDef),attachList:l.parsePointer(G4),ligCaretList:l.parsePointer(q4),markAttachClassDef:l.parsePointer(ne.classDef)};return d>=1.2&&(h.markGlyphSets=l.parsePointer(Z4)),h}var K4={parse:Y4},Vo=new Array(10);Vo[1]=function(){let n=this.offset+this.relativeOffset,i=this.parseUShort();if(i===1)return{posFormat:1,coverage:this.parsePointer(ne.coverage),value:this.parseValueRecord()};if(i===2)return{posFormat:2,coverage:this.parsePointer(ne.coverage),values:this.parseValueRecordList()};ce.assert(!1,"0x"+n.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},Vo[2]=function(){let n=this.offset+this.relativeOffset,i=this.parseUShort();ce.assert(i===1||i===2,"0x"+n.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");let l=this.parsePointer(ne.coverage),d=this.parseUShort(),h=this.parseUShort();if(i===1)return{posFormat:i,coverage:l,valueFormat1:d,valueFormat2:h,pairSets:this.parseList(ne.pointer(ne.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(d),value2:this.parseValueRecord(h)}})))};if(i===2){let p=this.parsePointer(ne.classDef),y=this.parsePointer(ne.classDef),A=this.parseUShort(),_=this.parseUShort();return{posFormat:i,coverage:l,valueFormat1:d,valueFormat2:h,classDef1:p,classDef2:y,class1Count:A,class2Count:_,classRecords:this.parseList(A,ne.list(_,function(){return{value1:this.parseValueRecord(d),value2:this.parseValueRecord(h)}}))}}},Vo[3]=function(){return{error:"GPOS Lookup 3 not supported"}},Vo[4]=function(){return{error:"GPOS Lookup 4 not supported"}},Vo[5]=function(){return{error:"GPOS Lookup 5 not supported"}},Vo[6]=function(){return{error:"GPOS Lookup 6 not supported"}},Vo[7]=function(){return{error:"GPOS Lookup 7 not supported"}},Vo[8]=function(){return{error:"GPOS Lookup 8 not supported"}},Vo[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function X4(n,i){i=i||0;let l=new ne(n,i),d=l.parseVersion(1);return ce.argument(d===1||d===1.1,"Unsupported GPOS table version "+d),d===1?{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(Vo)}:{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(Vo),variations:l.parseFeatureVariationsList()}}var J4=new Array(10);function ey(n){return new ye.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new ye.ScriptList(n.scripts)},{name:"features",type:"TABLE",value:new ye.FeatureList(n.features)},{name:"lookups",type:"TABLE",value:new ye.LookupList(n.lookups,J4)}])}var ty={parse:X4,make:ey};function ry(n){let i={};n.skip("uShort");let l=n.parseUShort();ce.argument(l===0,"Unsupported kern sub-table version."),n.skip("uShort",2);let d=n.parseUShort();n.skip("uShort",3);for(let h=0;h<d;h+=1){let p=n.parseUShort(),y=n.parseUShort(),A=n.parseShort();i[p+","+y]=A}return i}function ny(n){let i={};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 h=0;h<d;h+=1){let p=n.parseUShort(),y=n.parseUShort(),A=n.parseShort();i[p+","+y]=A}}return i}function sy(n,i){let l=new mt.Parser(n,i),d=l.parseUShort();if(d===0)return ry(l);if(d===1)return ny(l);throw new Error("Unsupported kern table version ("+d+").")}var iy={parse:sy};function oy(n,i,l,d){let h=new mt.Parser(n,i),p=d?h.parseUShort:h.parseULong,y=[];for(let A=0;A<l+1;A+=1){let _=p.call(h);d&&(_*=2),y.push(_)}return y}var ay={parse:oy};function w1(n,i){let l=[],d=12;for(let h=0;h<i;h+=1){let p=mt.getTag(n,d),y=mt.getULong(n,d+4),A=mt.getULong(n,d+8),_=mt.getULong(n,d+12);l.push({tag:p,checksum:y,offset:A,length:_,compression:!1}),d+=16}return l}function ly(n,i){let l=[],d=44;for(let h=0;h<i;h+=1){let p=mt.getTag(n,d),y=mt.getULong(n,d+4),A=mt.getULong(n,d+8),_=mt.getULong(n,d+12),M;A<_?M="WOFF":M=!1,l.push({tag:p,offset:y,compression:M,compressedLength:A,length:_}),d+=20}return l}function pn(n,i){if(i.compression==="WOFF"){let l=new Uint8Array(n.buffer,i.offset+2,i.compressedLength-2),d=new Uint8Array(i.length);if(Oe(l,d),d.byteLength!==i.length)throw new Error("Decompression error: "+i.tag+" decompressed length doesn't match recorded length");return{data:new DataView(d.buffer,0),offset:0}}else return{data:n,offset:i.offset}}function cy(n,i={}){let l,d,h=new v1({empty:!0});n.constructor!==ArrayBuffer&&(n=new Uint8Array(n).buffer);let p=new DataView(n,0),y,A=[],_=mt.getTag(p,0);if(_==="\0\0\0"||_==="true"||_==="typ1")h.outlinesFormat="truetype",y=mt.getUShort(p,4),A=w1(p,y);else if(_==="OTTO")h.outlinesFormat="cff",y=mt.getUShort(p,4),A=w1(p,y);else if(_==="wOFF"){let er=mt.getTag(p,4);if(er==="\0\0\0")h.outlinesFormat="truetype";else if(er==="OTTO")h.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+_);y=mt.getUShort(p,12),A=ly(p,y)}else if(_==="wOF2"){let er="https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025";throw new Error("WOFF2 require an external decompressor library, see examples at: "+er)}else throw new Error("Unsupported OpenType signature "+_);let M,E,z,U,te,Y,ae,ze,Jt,Vt,mr,Dr,An,Dn,Qn,Bs,qo,Qr;for(let er=0;er<y;er+=1){let $t=A[er],Gt;switch($t.tag){case"avar":ae=$t;break;case"cmap":Gt=pn(p,$t),h.tables.cmap=xn.parse(Gt.data,Gt.offset),h.encoding=new Kr(h.tables.cmap);break;case"cvt ":Gt=pn(p,$t),Qr=new mt.Parser(Gt.data,Gt.offset),h.tables.cvt=Qr.parseShortList($t.length/2);break;case"fvar":z=$t;break;case"STAT":U=$t;break;case"gvar":te=$t;break;case"cvar":Y=$t;break;case"fpgm":Gt=pn(p,$t),Qr=new mt.Parser(Gt.data,Gt.offset),h.tables.fpgm=Qr.parseByteList($t.length);break;case"head":Gt=pn(p,$t),h.tables.head=aa.parse(Gt.data,Gt.offset),h.unitsPerEm=h.tables.head.unitsPerEm,l=h.tables.head.indexToLocFormat;break;case"hhea":Gt=pn(p,$t),h.tables.hhea=xo.parse(Gt.data,Gt.offset),h.ascender=h.tables.hhea.ascender,h.descender=h.tables.hhea.descender,h.numberOfHMetrics=h.tables.hhea.numberOfHMetrics;break;case"HVAR":An=$t;break;case"hmtx":Dr=$t;break;case"ltag":Gt=pn(p,$t),d=ca.parse(Gt.data,Gt.offset);break;case"COLR":Gt=pn(p,$t),h.tables.colr=je.parse(Gt.data,Gt.offset);break;case"CPAL":Gt=pn(p,$t),h.tables.cpal=hr.parse(Gt.data,Gt.offset);break;case"maxp":Gt=pn(p,$t),h.tables.maxp=$n.parse(Gt.data,Gt.offset),h.numGlyphs=h.tables.maxp.numGlyphs;break;case"name":Bs=$t;break;case"OS/2":Gt=pn(p,$t),h.tables.os2=so.parse(Gt.data,Gt.offset);break;case"post":Gt=pn(p,$t),h.tables.post=Ss.parse(Gt.data,Gt.offset),h.glyphNames=new bn(h.tables.post);break;case"prep":Gt=pn(p,$t),Qr=new mt.Parser(Gt.data,Gt.offset),h.tables.prep=Qr.parseByteList($t.length);break;case"glyf":ze=$t;break;case"loca":Qn=$t;break;case"CFF ":M=$t;break;case"CFF2":E=$t;break;case"kern":Dn=$t;break;case"GDEF":Jt=$t;break;case"GPOS":Vt=$t;break;case"GSUB":mr=$t;break;case"meta":qo=$t;break;case"gasp":try{Gt=pn(p,$t),h.tables.gasp=fr.parse(Gt.data,Gt.offset)}catch(Ci){console.warn("Failed to parse gasp table, skipping."),console.warn(Ci)}break;case"SVG ":Gt=pn(p,$t),h.tables.svg=fn.parse(Gt.data,Gt.offset);break;default:break}}let lo=pn(p,Bs);if(h.tables.name=zt.parse(lo.data,lo.offset,d),h.names=h.tables.name,ze&&Qn){let er=l===0,$t=pn(p,Qn),Gt=ay.parse($t.data,$t.offset,h.numGlyphs,er),Ci=pn(p,ze);h.glyphs=Y0.parse(Ci.data,Ci.offset,Gt,h,i)}else if(M){let er=pn(p,M);ss.parse(er.data,er.offset,h,i)}else if(E){let er=pn(p,E);ss.parse(er.data,er.offset,h,i)}else throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");let Ni=pn(p,Dr);if(zo.parse(h,Ni.data,Ni.offset,h.numberOfHMetrics,h.numGlyphs,h.glyphs,i),le(h,i),Dn){let er=pn(p,Dn);h.kerningPairs=iy.parse(er.data,er.offset)}else h.kerningPairs={};if(Jt){let er=pn(p,Jt);h.tables.gdef=K4.parse(er.data,er.offset)}if(Vt){let er=pn(p,Vt);h.tables.gpos=ty.parse(er.data,er.offset),h.position.init()}if(mr){let er=pn(p,mr);h.tables.gsub=qi.parse(er.data,er.offset)}if(z){let er=pn(p,z);h.tables.fvar=nn.parse(er.data,er.offset,h.names)}if(U){let er=pn(p,U);h.tables.stat=Ln.parse(er.data,er.offset,h.tables.fvar)}if(te){z||console.warn("This font provides a gvar table, but no fvar table, which is required for variable fonts."),ze||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let er=pn(p,te);h.tables.gvar=Ye.parse(er.data,er.offset,h.tables.fvar,h.glyphs)}if(Y){z||console.warn("This font provides a cvar table, but no fvar table, which is required for variable fonts."),h.tables.cvt||console.warn("This font provides a cvar table, but no cvt table which could be made variable."),ze||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let er=pn(p,Y);h.tables.cvar=H.parse(er.data,er.offset,h.tables.fvar,h.tables.cvt||[])}if(ae){z||console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");let er=pn(p,ae);h.tables.avar=L.parse(er.data,er.offset,h.tables.fvar)}if(An){z||console.warn("This font provides an HVAR table, but no fvar table, which is required for variable fonts."),Dr||console.warn("This font provides an HVAR table, but no hmtx table to vary.");let er=pn(p,An);h.tables.hvar=H4.parse(er.data,er.offset,h.tables.fvar)}if(qo){let er=pn(p,qo);h.tables.meta=an.parse(er.data,er.offset),h.metas=h.tables.meta}return h.palettes=new W0(h),h}function uy(){console.error("DEPRECATED! migrate to: opentype.parse(buffer, opt) See: https://github.com/opentypejs/opentype.js/issues/675")}function dy(){console.error('DEPRECATED! migrate to: opentype.parse(require("fs").readFileSync(url), opt)')}return g(b)})();(function(s,o){typeof define=="function"&&define.amd?define(o):typeof t=="object"&&t.exports?t.exports=o():s.opentype=o()})(typeof self<"u"?self:e,()=>({...r,default:r}))}),rT=eT(tT()),xi=T0("lru-cache:metrics"),Rc=GA("lru-cache"),nT=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Rh=()=>xi.hasSubscribers||Rc.hasSubscribers,rx=new Set,Tm=typeof process=="object"&&process?process:{},sT=(e,t,r,s)=>{typeof Tm.emitWarning=="function"?Tm.emitWarning(e,t,r,s):console.error(`[${r}] ${t}: ${e}`)},iT=e=>!rx.has(e),gl=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),nx=e=>gl(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?td:null:null,td=class extends Array{constructor(e){super(e),this.fill(0)}},Dl,ac,oT=(Dl=class{constructor(e,t){if(Ws(this,"heap"),Ws(this,"length"),!G(Dl,ac))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){let t=nx(e);if(!t)return[];dr(Dl,ac,!0);let r=new Dl(e,t);return dr(Dl,ac,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},ac=new WeakMap,Zr(Dl,ac,!1),Dl),Cm,_m,Ko,So,xa,h0,ba,lc,cc,ya,Js,Lo,Gs,cs,Sr,Xi,Io,ji,fi,va,pi,wa,Aa,ko,Eo,Ta,uc,Ji,f0,wt,Nh,p0,ul,Lu,Mo,Sm,m0,dc,Iu,dl,hl,Dh,g0,ku,Lm,Im,Eu,es,Qh,km,Em,hc,Bh,fc,fl,jh,Ph,aT=(Ph=class{constructor(e){Zr(this,wt),Zr(this,Ko),Zr(this,So),Zr(this,xa),Zr(this,h0),Zr(this,ba),Zr(this,lc),Zr(this,cc),Zr(this,ya),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"),Zr(this,Js),Zr(this,Lo),Zr(this,Gs),Zr(this,cs),Zr(this,Sr),Zr(this,Xi),Zr(this,Io),Zr(this,ji),Zr(this,fi),Zr(this,va),Zr(this,pi),Zr(this,wa),Zr(this,Aa),Zr(this,ko),Zr(this,Eo),Zr(this,Ta),Zr(this,uc),Zr(this,Ji),Zr(this,f0),Zr(this,p0,()=>{}),Zr(this,ul,()=>{}),Zr(this,Lu,()=>{}),Zr(this,Mo,()=>!1),Zr(this,m0,De=>{}),Zr(this,dc,(De,be,st)=>{}),Zr(this,Iu,(De,be,st,Ue)=>{if(st||Ue)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0}),Ws(this,Cm,"LRUCache");let{max:t=0,ttl:r,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:c,updateAgeOnHas:u,allowStale:f,dispose:m,onInsert:g,disposeAfter:b,noDisposeOnSet:x,noUpdateTTL:v,maxSize:w=0,maxEntrySize:I=0,sizeCalculation:k,fetchMethod:N,memoMethod:R,noDeleteOnFetchRejection:Q,noDeleteOnStaleGet:F,allowStaleOnFetchRejection:q,allowStaleOnFetchAbort:P,ignoreFetchAbort:Z,backgroundFetchSize:V=1,perf:fe}=e;if(this.backgroundFetchSize=V,fe!==void 0&&typeof fe?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(dr(this,ya,fe??nT),t!==0&&!gl(t))throw new TypeError("max option must be a nonnegative integer");let _e=t?nx(t):Array;if(!_e)throw new Error("invalid max value: "+t);if(dr(this,Ko,t),dr(this,So,w),this.maxEntrySize=I||G(this,So),this.sizeCalculation=k,this.sizeCalculation){if(!G(this,So)&&!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(dr(this,cc,R),N!==void 0&&typeof N!="function")throw new TypeError("fetchMethod must be a function if specified");if(dr(this,lc,N),dr(this,uc,!!N),dr(this,Gs,new Map),dr(this,cs,Array.from({length:t}).fill(void 0)),dr(this,Sr,Array.from({length:t}).fill(void 0)),dr(this,Xi,new _e(t)),dr(this,Io,new _e(t)),dr(this,ji,0),dr(this,fi,0),dr(this,va,oT.create(t)),dr(this,Js,0),dr(this,Lo,0),typeof m=="function"&&dr(this,xa,m),typeof g=="function"&&dr(this,h0,g),typeof b=="function"?(dr(this,ba,b),dr(this,pi,[])):(dr(this,ba,void 0),dr(this,pi,void 0)),dr(this,Ta,!!G(this,xa)),dr(this,f0,!!G(this,h0)),dr(this,Ji,!!G(this,ba)),this.noDisposeOnSet=!!x,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!Q,this.allowStaleOnFetchRejection=!!q,this.allowStaleOnFetchAbort=!!P,this.ignoreFetchAbort=!!Z,this.maxEntrySize!==0){if(G(this,So)!==0&&!gl(G(this,So)))throw new TypeError("maxSize must be a positive integer if specified");if(!gl(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Ct(this,wt,Sm).call(this)}if(this.allowStale=!!f,this.noDeleteOnStaleGet=!!F,this.updateAgeOnGet=!!c,this.updateAgeOnHas=!!u,this.ttlResolution=gl(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!gl(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Ct(this,wt,Nh).call(this)}if(G(this,Ko)===0&&this.ttl===0&&G(this,So)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!G(this,Ko)&&!G(this,So)){let De="LRU_CACHE_UNBOUNDED";iT(De)&&(rx.add(De),sT("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",De,Ph))}}get perf(){return G(this,ya)}static unsafeExposeInternals(e){return{starts:G(e,Aa),ttls:G(e,ko),autopurgeTimers:G(e,Eo),sizes:G(e,wa),keyMap:G(e,Gs),keyList:G(e,cs),valList:G(e,Sr),next:G(e,Xi),prev:G(e,Io),get head(){return G(e,ji)},get tail(){return G(e,fi)},free:G(e,va),isBackgroundFetch:t=>{var r;return Ct(r=e,wt,es).call(r,t)},backgroundFetch:(t,r,s,o)=>{var c;return Ct(c=e,wt,Eu).call(c,t,r,s,o)},moveToTail:t=>{var r;return Ct(r=e,wt,fc).call(r,t)},indexes:t=>{var r;return Ct(r=e,wt,dl).call(r,t)},rindexes:t=>{var r;return Ct(r=e,wt,hl).call(r,t)},isStale:t=>{var r;return G(r=e,Mo).call(r,t)}}}get max(){return G(this,Ko)}get maxSize(){return G(this,So)}get calculatedSize(){return G(this,Lo)}get size(){return G(this,Js)}get fetchMethod(){return G(this,lc)}get memoMethod(){return G(this,cc)}get dispose(){return G(this,xa)}get onInsert(){return G(this,h0)}get disposeAfter(){return G(this,ba)}getRemainingTTL(e){return G(this,Gs).has(e)?1/0:0}*entries(){for(let e of Ct(this,wt,dl).call(this))G(this,Sr)[e]!==void 0&&G(this,cs)[e]!==void 0&&!Ct(this,wt,es).call(this,G(this,Sr)[e])&&(yield[G(this,cs)[e],G(this,Sr)[e]])}*rentries(){for(let e of Ct(this,wt,hl).call(this))G(this,Sr)[e]!==void 0&&G(this,cs)[e]!==void 0&&!Ct(this,wt,es).call(this,G(this,Sr)[e])&&(yield[G(this,cs)[e],G(this,Sr)[e]])}*keys(){for(let e of Ct(this,wt,dl).call(this)){let t=G(this,cs)[e];t!==void 0&&!Ct(this,wt,es).call(this,G(this,Sr)[e])&&(yield t)}}*rkeys(){for(let e of Ct(this,wt,hl).call(this)){let t=G(this,cs)[e];t!==void 0&&!Ct(this,wt,es).call(this,G(this,Sr)[e])&&(yield t)}}*values(){for(let e of Ct(this,wt,dl).call(this))G(this,Sr)[e]!==void 0&&!Ct(this,wt,es).call(this,G(this,Sr)[e])&&(yield G(this,Sr)[e])}*rvalues(){for(let e of Ct(this,wt,hl).call(this))G(this,Sr)[e]!==void 0&&!Ct(this,wt,es).call(this,G(this,Sr)[e])&&(yield G(this,Sr)[e])}[(_m=Symbol.iterator,Cm=Symbol.toStringTag,_m)](){return this.entries()}find(e,t={}){for(let r of Ct(this,wt,dl).call(this)){let s=G(this,Sr)[r],o=Ct(this,wt,es).call(this,s)?s.__staleWhileFetching:s;if(o!==void 0&&e(o,G(this,cs)[r],this))return Ct(this,wt,hc).call(this,G(this,cs)[r],t)}}forEach(e,t=this){for(let r of Ct(this,wt,dl).call(this)){let s=G(this,Sr)[r],o=Ct(this,wt,es).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&e.call(t,o,G(this,cs)[r],this)}}rforEach(e,t=this){for(let r of Ct(this,wt,hl).call(this)){let s=G(this,Sr)[r],o=Ct(this,wt,es).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&e.call(t,o,G(this,cs)[r],this)}}purgeStale(){let e=!1;for(let t of Ct(this,wt,hl).call(this,{allowStale:!0}))G(this,Mo).call(this,t)&&(Ct(this,wt,fl).call(this,G(this,cs)[t],"expire"),e=!0);return e}info(e){let t=G(this,Gs).get(e);if(t===void 0)return;let r=G(this,Sr)[t],s=Ct(this,wt,es).call(this,r)?r.__staleWhileFetching:r;if(s===void 0)return;let o={value:s};if(G(this,ko)&&G(this,Aa)){let c=G(this,ko)[t],u=G(this,Aa)[t];if(c&&u){let f=c-(G(this,ya).now()-u);o.ttl=f,o.start=Date.now()}}return G(this,wa)&&(o.size=G(this,wa)[t]),o}dump(){let e=[];for(let t of Ct(this,wt,dl).call(this,{allowStale:!0})){let r=G(this,cs)[t],s=G(this,Sr)[t],o=Ct(this,wt,es).call(this,s)?s.__staleWhileFetching:s;if(o===void 0||r===void 0)continue;let c={value:o};if(G(this,ko)&&G(this,Aa)){c.ttl=G(this,ko)[t];let u=G(this,ya).now()-G(this,Aa)[t];c.start=Math.floor(Date.now()-u)}G(this,wa)&&(c.size=G(this,wa)[t]),e.unshift([r,c])}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,ya).now()-s}Ct(this,wt,g0).call(this,t,r.value,r)}}set(e,t,r={}){let{status:s=xi.hasSubscribers?{}:void 0}=r;r.status=s,s&&(s.op="set",s.key=e,t!==void 0&&(s.value=t),s.cache=this);let o=Ct(this,wt,g0).call(this,e,t,r);return s&&xi.hasSubscribers&&xi.publish(s),o}pop(){var e;try{for(;G(this,Js);){let t=G(this,Sr)[G(this,ji)];if(Ct(this,wt,ku).call(this,!0),Ct(this,wt,es).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(G(this,Ji)&&G(this,pi)){let t=G(this,pi),r;for(;r=t?.shift();)(e=G(this,ba))==null||e.call(this,...r)}}}has(e,t={}){let{status:r=xi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="has",r.key=e,r.cache=this);let s=Ct(this,wt,Lm).call(this,e,t);return xi.hasSubscribers&&xi.publish(r),s}peek(e,t={}){let{status:r=Rh()?{}:void 0}=t;r&&(r.op="peek",r.key=e,r.cache=this),t.status=r;let s=Ct(this,wt,Im).call(this,e,t);return xi.hasSubscribers&&xi.publish(r),s}fetch(e,t={}){let r=Rc.hasSubscribers,{status:s=Rh()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let o=Ct(this,wt,Qh).call(this,e,t);return s&&r&&(s.trace=!0,Rc.tracePromise(()=>o,s).catch(()=>{})),o}forceFetch(e,t={}){let r=Rc.hasSubscribers,{status:s=Rh()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let o=Ct(this,wt,km).call(this,e,t);return s&&r&&(s.trace=!0,Rc.tracePromise(()=>o,s).catch(()=>{})),o}memo(e,t={}){let{status:r=xi.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=Ct(this,wt,Em).call(this,e,t);return r&&(r.value=s),xi.hasSubscribers&&xi.publish(r),s}get(e,t={}){let{status:r=xi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="get",r.key=e,r.cache=this);let s=Ct(this,wt,hc).call(this,e,t);return r&&(s!==void 0&&(r.value=s),xi.hasSubscribers&&xi.publish(r)),s}delete(e){return Ct(this,wt,fl).call(this,e,"delete")}clear(){return Ct(this,wt,jh).call(this,"delete")}},Ko=new WeakMap,So=new WeakMap,xa=new WeakMap,h0=new WeakMap,ba=new WeakMap,lc=new WeakMap,cc=new WeakMap,ya=new WeakMap,Js=new WeakMap,Lo=new WeakMap,Gs=new WeakMap,cs=new WeakMap,Sr=new WeakMap,Xi=new WeakMap,Io=new WeakMap,ji=new WeakMap,fi=new WeakMap,va=new WeakMap,pi=new WeakMap,wa=new WeakMap,Aa=new WeakMap,ko=new WeakMap,Eo=new WeakMap,Ta=new WeakMap,uc=new WeakMap,Ji=new WeakMap,f0=new WeakMap,wt=new WeakSet,Nh=function(){let e=new td(G(this,Ko)),t=new td(G(this,Ko));dr(this,ko,e),dr(this,Aa,t);let r=this.ttlAutopurge?Array.from({length:G(this,Ko)}):void 0;dr(this,Eo,r),dr(this,Lu,(u,f,m=G(this,ya).now())=>{t[u]=f!==0?m:0,e[u]=f,s(u,f)}),dr(this,p0,u=>{t[u]=e[u]!==0?G(this,ya).now():0,s(u,e[u])});let s=this.ttlAutopurge?(u,f)=>{if(r?.[u]&&(clearTimeout(r[u]),r[u]=void 0),f&&f!==0&&r){let m=setTimeout(()=>{G(this,Mo).call(this,u)&&Ct(this,wt,fl).call(this,G(this,cs)[u],"expire")},f+1);m.unref&&m.unref(),r[u]=m}}:()=>{};dr(this,ul,(u,f)=>{if(e[f]){let m=e[f],g=t[f];if(!m||!g)return;u.ttl=m,u.start=g,u.now=o||c();let b=u.now-g;u.remainingTTL=m-b}});let o=0,c=()=>{let u=G(this,ya).now();if(this.ttlResolution>0){o=u;let f=setTimeout(()=>o=0,this.ttlResolution);f.unref&&f.unref()}return u};this.getRemainingTTL=u=>{let f=G(this,Gs).get(u);if(f===void 0)return 0;let m=e[f],g=t[f];if(!m||!g)return 1/0;let b=(o||c())-g;return m-b},dr(this,Mo,u=>{let f=t[u],m=e[u];return!!m&&!!f&&(o||c())-f>m})},p0=new WeakMap,ul=new WeakMap,Lu=new WeakMap,Mo=new WeakMap,Sm=function(){let e=new td(G(this,Ko));dr(this,Lo,0),dr(this,wa,e),dr(this,m0,t=>{dr(this,Lo,G(this,Lo)-e[t]),e[t]=0}),dr(this,Iu,(t,r,s,o)=>{if(!gl(s)){if(Ct(this,wt,es).call(this,r))return this.backgroundFetchSize;if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(r,t),!gl(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}),dr(this,dc,(t,r,s)=>{if(e[t]=r,G(this,So)){let o=G(this,So)-e[t];for(;G(this,Lo)>o;)Ct(this,wt,ku).call(this,!0)}dr(this,Lo,G(this,Lo)+e[t]),s&&(s.entrySize=r,s.totalCalculatedSize=G(this,Lo))})},m0=new WeakMap,dc=new WeakMap,Iu=new WeakMap,dl=function*({allowStale:e=this.allowStale}={}){if(G(this,Js))for(let t=G(this,fi);Ct(this,wt,Dh).call(this,t)&&((e||!G(this,Mo).call(this,t))&&(yield t),t!==G(this,ji));)t=G(this,Io)[t]},hl=function*({allowStale:e=this.allowStale}={}){if(G(this,Js))for(let t=G(this,ji);Ct(this,wt,Dh).call(this,t)&&((e||!G(this,Mo).call(this,t))&&(yield t),t!==G(this,fi));)t=G(this,Xi)[t]},Dh=function(e){return e!==void 0&&G(this,Gs).get(G(this,cs)[e])===e},g0=function(e,t,r,s){var o,c,u,f;let{ttl:m=this.ttl,start:g,noDisposeOnSet:b=this.noDisposeOnSet,sizeCalculation:x=this.sizeCalculation,status:v}=r,w=Ct(this,wt,es).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,Iu).call(this,e,t,r.size||0,x,v);if(this.maxEntrySize&&k>this.maxEntrySize)return Ct(this,wt,fl).call(this,e,"set"),v&&(v.set="miss",v.maxEntrySizeExceeded=!0),this;let N=G(this,Js)===0?void 0:G(this,Gs).get(e);if(N===void 0)N=G(this,Js)===0?G(this,fi):G(this,va).length!==0?G(this,va).pop():G(this,Js)===G(this,Ko)?Ct(this,wt,ku).call(this,!1):G(this,Js),G(this,cs)[N]=e,G(this,Sr)[N]=t,G(this,Gs).set(e,N),G(this,Xi)[G(this,fi)]=N,G(this,Io)[N]=G(this,fi),dr(this,fi,N),Mh(this,Js)._++,G(this,dc).call(this,N,k,v),v&&(v.set="add"),I=!1,G(this,f0)&&!w&&((o=G(this,h0))==null||o.call(this,t,e,"add"));else{Ct(this,wt,fc).call(this,N);let R=G(this,Sr)[N];if(t!==R){if(!b)if(Ct(this,wt,es).call(this,R)){R!==s&&R.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Q}=R;Q!==void 0&&Q!==t&&(G(this,Ta)&&((c=G(this,xa))==null||c.call(this,Q,e,"set")),G(this,Ji)&&G(this,pi)?.push([Q,e,"set"]))}else G(this,Ta)&&((u=G(this,xa))==null||u.call(this,R,e,"set")),G(this,Ji)&&G(this,pi)?.push([R,e,"set"]);if(G(this,m0).call(this,N),G(this,dc).call(this,N,k,v),G(this,Sr)[N]=t,!w){let Q=R&&Ct(this,wt,es).call(this,R)?R.__staleWhileFetching:R,F=Q===void 0?"add":t!==Q?"replace":"update";v&&(v.set=F,Q!==void 0&&(v.oldValue=Q)),G(this,f0)&&this.onInsert?.(t,e,F)}}else w||(v&&(v.set="update"),G(this,f0)&&this.onInsert?.(t,e,"update"))}if(m!==0&&!G(this,ko)&&Ct(this,wt,Nh).call(this),G(this,ko)&&(I||G(this,Lu).call(this,N,m,g),v&&G(this,ul).call(this,v,N)),!b&&G(this,Ji)&&G(this,pi)){let R=G(this,pi),Q;for(;Q=R?.shift();)(f=G(this,ba))==null||f.call(this,...Q)}return this},ku=function(e){var t;let r=G(this,ji),s=G(this,cs)[r],o=G(this,Sr)[r],c=Ct(this,wt,es).call(this,o);c&&o.__abortController.abort(new Error("evicted"));let u=c?o.__staleWhileFetching:o;return(G(this,Ta)||G(this,Ji))&&u!==void 0&&(G(this,Ta)&&((t=G(this,xa))==null||t.call(this,u,s,"evict")),G(this,Ji)&&G(this,pi)?.push([u,s,"evict"])),G(this,m0).call(this,r),G(this,Eo)?.[r]&&(clearTimeout(G(this,Eo)[r]),G(this,Eo)[r]=void 0),e&&(G(this,cs)[r]=void 0,G(this,Sr)[r]=void 0,G(this,va).push(r)),G(this,Js)===1?(dr(this,ji,dr(this,fi,0)),G(this,va).length=0):dr(this,ji,G(this,Xi)[r]),G(this,Gs).delete(s),Mh(this,Js)._--,r},Lm=function(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=t,o=G(this,Gs).get(e);if(o!==void 0){let c=G(this,Sr)[o];if(Ct(this,wt,es).call(this,c)&&c.__staleWhileFetching===void 0)return!1;if(G(this,Mo).call(this,o))s&&(s.has="stale",G(this,ul).call(this,s,o));else return r&&G(this,p0).call(this,o),s&&(s.has="hit",G(this,ul).call(this,s,o)),!0}else s&&(s.has="miss");return!1},Im=function(e,t){let{status:r,allowStale:s=this.allowStale}=t,o=G(this,Gs).get(e);if(o===void 0||!s&&G(this,Mo).call(this,o)){r&&(r.peek=o===void 0?"miss":"stale");return}let c=G(this,Sr)[o],u=Ct(this,wt,es).call(this,c)?c.__staleWhileFetching:c;return r&&(u!==void 0?(r.peek="hit",r.value=u):r.peek="miss"),u},Eu=function(e,t,r,s){let o=t===void 0?void 0:G(this,Sr)[t];if(Ct(this,wt,es).call(this,o))return o;let c=new AbortController,{signal:u}=r;u?.addEventListener("abort",()=>c.abort(u.reason),{signal:c.signal});let f={signal:c.signal,options:r,context:s},m=(I,k=!1)=>{let{aborted:N}=c.signal,R=r.ignoreFetchAbort&&I!==void 0,Q=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&I!==void 0);if(r.status&&(N&&!k?(r.status.fetchAborted=!0,r.status.fetchError=c.signal.reason,R&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),N&&!R&&!k)return b(c.signal.reason,Q);let F=v,q=G(this,Sr)[t];return(q===v||q===void 0&&R&&k)&&(I===void 0?F.__staleWhileFetching!==void 0?G(this,Sr)[t]=F.__staleWhileFetching:Ct(this,wt,fl).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),Ct(this,wt,g0).call(this,e,I,f.options,F))),I},g=I=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=I),b(I,!1)),b=(I,k)=>{let{aborted:N}=c.signal,R=N&&r.allowStaleOnFetchAbort,Q=R||r.allowStaleOnFetchRejection,F=Q||r.noDeleteOnFetchRejection,q=v;if(G(this,Sr)[t]===v&&(!F||!k&&q.__staleWhileFetching===void 0?Ct(this,wt,fl).call(this,e,"fetch"):R||(G(this,Sr)[t]=q.__staleWhileFetching)),Q)return r.status&&q.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),q.__staleWhileFetching;if(q.__returned===q)throw I},x=(I,k)=>{var N;let R=(N=G(this,lc))==null?void 0:N.call(this,e,o,f);c.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(I(void 0),r.allowStaleOnFetchAbort&&(I=Q=>m(Q,!0)))}),R&&R instanceof Promise?R.then(Q=>I(Q===void 0?void 0:Q),k):R!==void 0&&I(R)};r.status&&(r.status.fetchDispatched=!0);let v=new Promise(x).then(m,g),w=Object.assign(v,{__abortController:c,__staleWhileFetching:o,__returned:void 0});return t===void 0?(Ct(this,wt,g0).call(this,e,w,{...f.options,status:void 0}),t=G(this,Gs).get(e)):G(this,Sr)[t]=w,w},es=function(e){if(!G(this,uc))return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController},Qh=async function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:c=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:f=0,sizeCalculation:m=this.sizeCalculation,noUpdateTTL:g=this.noUpdateTTL,noDeleteOnFetchRejection:b=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:x=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,uc))return N&&(N.fetch="get"),Ct(this,wt,hc).call(this,e,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:N});let Q={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:c,noDisposeOnSet:u,size:f,sizeCalculation:m,noUpdateTTL:g,noDeleteOnFetchRejection:b,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:w,ignoreFetchAbort:v,status:N,signal:R},F=G(this,Gs).get(e);if(F===void 0){N&&(N.fetch="miss");let q=Ct(this,wt,Eu).call(this,e,F,Q,I);return q.__returned=q}else{let q=G(this,Sr)[F];if(Ct(this,wt,es).call(this,q)){let fe=r&&q.__staleWhileFetching!==void 0;return N&&(N.fetch="inflight",fe&&(N.returnedStale=!0)),fe?q.__staleWhileFetching:q.__returned=q}let P=G(this,Mo).call(this,F);if(!k&&!P)return N&&(N.fetch="hit"),Ct(this,wt,fc).call(this,F),s&&G(this,p0).call(this,F),N&&G(this,ul).call(this,N,F),q;let Z=Ct(this,wt,Eu).call(this,e,F,Q,I),V=Z.__staleWhileFetching!==void 0&&r;return N&&(N.fetch=P?"stale":"refresh",V&&P&&(N.returnedStale=!0)),V?Z.__staleWhileFetching:Z.__returned=Z}},km=async function(e,t={}){let r=await Ct(this,wt,Qh).call(this,e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r},Em=function(e,t={}){let r=G(this,cc);if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,status:o,forceRefresh:c,...u}=t;o&&c&&(o.forceRefresh=!0);let f=Ct(this,wt,hc).call(this,e,u),m=c||f===void 0;if(o&&(o.memo=m?"miss":"hit",m||(o.value=f)),!m)return f;let g=r(e,f,{options:u,context:s});return o&&(o.value=g),Ct(this,wt,g0).call(this,e,g,u),g},hc=function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:c}=t,u=G(this,Gs).get(e);if(u===void 0){c&&(c.get="miss");return}let f=G(this,Sr)[u],m=Ct(this,wt,es).call(this,f);return c&&G(this,ul).call(this,c,u),G(this,Mo).call(this,u)?m?(c&&(c.get="stale-fetching"),r&&f.__staleWhileFetching!==void 0?(c&&(c.returnedStale=!0),f.__staleWhileFetching):void 0):(o||Ct(this,wt,fl).call(this,e,"expire"),c&&(c.get="stale"),r?(c&&(c.returnedStale=!0),f):void 0):(c&&(c.get=m?"fetching":"hit"),Ct(this,wt,fc).call(this,u),s&&G(this,p0).call(this,u),m?f.__staleWhileFetching:f)},Bh=function(e,t){G(this,Io)[t]=e,G(this,Xi)[e]=t},fc=function(e){e!==G(this,fi)&&(e===G(this,ji)?dr(this,ji,G(this,Xi)[e]):Ct(this,wt,Bh).call(this,G(this,Io)[e],G(this,Xi)[e]),Ct(this,wt,Bh).call(this,G(this,fi),e),dr(this,fi,e))},fl=function(e,t){var r,s;xi.hasSubscribers&&xi.publish({op:"delete",delete:t,key:e,cache:this});let o=!1;if(G(this,Js)!==0){let c=G(this,Gs).get(e);if(c!==void 0)if(G(this,Eo)?.[c]&&(clearTimeout(G(this,Eo)?.[c]),G(this,Eo)[c]=void 0),o=!0,G(this,Js)===1)Ct(this,wt,jh).call(this,t);else{G(this,m0).call(this,c);let u=G(this,Sr)[c];if(Ct(this,wt,es).call(this,u)?u.__abortController.abort(new Error("deleted")):(G(this,Ta)||G(this,Ji))&&(G(this,Ta)&&((r=G(this,xa))==null||r.call(this,u,e,t)),G(this,Ji)&&G(this,pi)?.push([u,e,t])),G(this,Gs).delete(e),G(this,cs)[c]=void 0,G(this,Sr)[c]=void 0,c===G(this,fi))dr(this,fi,G(this,Io)[c]);else if(c===G(this,ji))dr(this,ji,G(this,Xi)[c]);else{let f=G(this,Io)[c];G(this,Xi)[f]=G(this,Xi)[c];let m=G(this,Xi)[c];G(this,Io)[m]=G(this,Io)[c]}Mh(this,Js)._--,G(this,va).push(c)}}if(G(this,Ji)&&G(this,pi)?.length){let c=G(this,pi),u;for(;u=c?.shift();)(s=G(this,ba))==null||s.call(this,...u)}return o},jh=function(e){var t,r;for(let s of Ct(this,wt,hl).call(this,{allowStale:!0})){let o=G(this,Sr)[s];if(Ct(this,wt,es).call(this,o))o.__abortController.abort(new Error("deleted"));else{let c=G(this,cs)[s];G(this,Ta)&&((t=G(this,xa))==null||t.call(this,o,c,e)),G(this,Ji)&&G(this,pi)?.push([o,c,e])}}if(G(this,Gs).clear(),G(this,Sr).fill(void 0),G(this,cs).fill(void 0),G(this,ko)&&G(this,Aa)){G(this,ko).fill(0),G(this,Aa).fill(0);for(let s of G(this,Eo)??[])s!==void 0&&clearTimeout(s);G(this,Eo)?.fill(void 0)}if(G(this,wa)&&G(this,wa).fill(0),dr(this,ji,0),dr(this,fi,0),G(this,va).length=0,dr(this,Lo,0),dr(this,Js,0),G(this,Ji)&&G(this,pi)){let s=G(this,pi),o;for(;o=s?.shift();)(r=G(this,ba))==null||r.call(this,...o)}},Ph);function sx(e){let t={individual:{},range:[]},r=new WeakMap;for(let s of e)Rf(t,s,r);return t}function Rf(e,t,r){for(let[s,o]of Object.entries(t.individual))if(e.individual[s])x0(e.individual[s],o,r);else{let c=!1;for(let[u,{range:f,entry:m}]of e.range.entries()){let g=Oh(Number(s),f);if(g.both!==null){c=!0,e.individual[s]=o,x0(e.individual[s],bi(m),r),e.range.splice(u,1);for(let b of g.second)Array.isArray(b)?e.range.push({range:b,entry:bi(m)}):e.individual[b]=bi(m)}}c||(e.individual[s]=o)}for(let{range:s,entry:o}of t.range){let c=[s];for(let u=0;u<e.range.length;u++){let{range:f,entry:m}=e.range[u];for(let[g,b]of c.entries())if(Array.isArray(b)){let x=lT(b,f);if(x.both===null)continue;e.range.splice(u,1),u--;let v=bi(m);Array.isArray(x.both)?e.range.push({range:x.both,entry:v}):e.individual[x.both]=v,x0(v,bi(o),r);for(let w of x.second)Array.isArray(w)?e.range.push({range:w,entry:bi(m)}):e.individual[w]=bi(m);c=x.first}else{let x=Oh(b,f);if(x.both===null)continue;e.individual[b]=bi(o),x0(e.individual[b],bi(m),r),e.range.splice(u,1),u--;for(let v of x.second)Array.isArray(v)?e.range.push({range:v,entry:bi(m)}):e.individual[v]=bi(m);c.splice(g,1,...x.first);break}}for(let u of Object.keys(e.individual))for(let[f,m]of c.entries())if(Array.isArray(m)){let g=Oh(Number(u),m);if(g.both===null)continue;x0(e.individual[u],bi(o),r),c.splice(f,1,...g.second);break}else if(Number(u)===m){x0(e.individual[u],bi(o),r);break}for(let u of c)Array.isArray(u)?e.range.push({range:u,entry:bi(o)}):e.individual[u]=bi(o)}}function x0(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?Rf(e.forward,t.forward,r):e.forward=t.forward),t.reverse&&(e.reverse?Rf(e.reverse,t.reverse,r):e.reverse=t.reverse))}function lT(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]),o=Math.min(e[1],t[1]);r.both=Ol(s,o)}if(e[0]<t[0]){let s=e[0],o=Math.min(t[0],e[1]);r.first.push(Ol(s,o))}else if(t[0]<e[0]){let s=t[0],o=Math.min(t[1],e[0]);r.second.push(Ol(s,o))}if(e[1]>t[1]){let s=Math.max(e[0],t[1]),o=e[1];r.first.push(Ol(s,o))}else if(t[1]>e[1]){let s=Math.max(e[1],t[0]),o=t[1];r.second.push(Ol(s,o))}return r}function Oh(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(Ol(t[0],e)),t[1]>e&&r.second.push(Ol(e+1,t[1])),r}function Ol(e,t){return t-e===1?e:[e,t]}function bi(e,t=new Map){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=Mm(e.forward,t)),e.reverse&&(r.reverse=Mm(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 Mm(e,t=new Map){let r={};for(let[s,o]of Object.entries(e.individual))r[s]=bi(o,t);return{individual:r,range:e.range.map(({range:s,entry:o})=>({range:s.slice(),entry:bi(o,t)}))}}function Nf(e,t,r,s){let o=t[s],c=e[o];if(!c)return;let u=c.lookup;if(c.reverse){let m=cT(c.reverse,t,r);(!u&&m||m&&u&&(u.index>m.index||u.index===m.index&&u.subIndex>m.subIndex))&&(u=m)}if(++s>=t.length||!c.forward)return u;let f=Nf(c.forward,t,r,s);return(!u&&f||f&&u&&(u.index>f.index||u.index===f.index&&u.subIndex>f.subIndex))&&(u=f),u}function cT(e,t,r){let s=e[t[--r]],o=s&&s.lookup;for(;s&&((!o&&s.lookup||s.lookup&&o&&o.index>s.lookup.index)&&(o=s.lookup),!(--r<0||!s.reverse));)s=s.reverse[t[r]];return o}function Rm(e,t,r){let s=!1;for(let o=0;o<e.length;o++){let c=e[o];if(s){if(r<=c[0])return e[o-1][1]=r,e;if(r<=c[1])return e[o-1][1]=Math.max(r,c[1]),e.splice(o,1),e;e.splice(o,1),o--}else{if(r<=c[0])return e.splice(o,0,[t,r]),e;if(r<=c[1])return c[0]=Math.min(t,c[0]),e;if(t<c[1])c[0]=Math.min(t,c[0]),s=!0;else continue}}return s?e[e.length-1][1]=r:e.push([t,r]),e}function uT(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(o=>o.start<=t&&o.end>=t);return s?s.index:null}}function Va(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 dT(e,t){let r=t[0],s=Df(e,r),o=t[0]+1,c=new Map;for(;o<t[1];)Df(e,o)!==s&&(o-r<=1?c.set(r,s):c.set([r,o],s)),o++;return o-r<=1?c.set(r,s):c.set([r,o],s),c}function Df(e,t){let r=uT(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 bp(e,t,r,s,o){let c=[];for(let u of r){u.entry.forward={individual:{},range:[]};for(let f of e)c.push(...jd(u.entry.forward,s,o,t,f).map(({entry:m,substitution:g})=>({entry:m,substitutions:[...u.substitutions,g]})))}return c}function Qd(e,t){let r=[],s=new Set;for(let o of t){if(s.has(o.entry))continue;s.add(o.entry),o.entry.forward??={individual:{},range:[]};let c={};for(let u of e)Array.isArray(u)?o.entry.forward.range.push({entry:c,range:u}):o.entry.forward.individual[u]=c;r.push({entry:c,substitutions:o.substitutions})}return r}function Bd(e,t){let r=[],s=new Set;for(let o of t){if(s.has(o.entry))continue;s.add(o.entry),o.entry.reverse??={individual:{},range:[]};let c={};for(let u of e)Array.isArray(u)?o.entry.reverse.range.push({entry:c,range:u}):o.entry.reverse.individual[u]=c;r.push({entry:c,substitutions:o.substitutions})}return r}function jd(e,t,r,s,o){let c=[];if(!Array.isArray(o))e.individual[o]={},c.push({entry:e.individual[o],substitution:fT(t,r,s,o)});else{let u=hT(t,r,s,o);for(let[f,m]of u){let g={};Array.isArray(f)?e.range.push({range:f,entry:g}):e.individual[f]={},c.push({entry:g,substitution:m})}}return c}function hT(e,t,r,s){for(let o of e.filter(c=>c.sequenceIndex===r))for(let c of t[o.lookupListIndex].subtables){let u=dT(c,s);if(!Array.from(u.values()).every(f=>f!==null))return u}return new Map([[s,null]])}function fT(e,t,r,s){for(let o of e.filter(c=>c.sequenceIndex===r))for(let c of t[o.lookupListIndex].subtables){let u=Df(c,s);if(u!==null)return u}return null}function pT(e,t,r){let s={individual:{},range:[]},o=Va(e.coverage);for(let{glyphId:c,index:u}of o){let f=e.chainRuleSets[u];if(f)for(let[m,g]of f.entries()){let b=jd(s,g.lookupRecords,t,0,c).map(({entry:x,substitution:v})=>({entry:x,substitutions:[v]}));for(let[x,v]of g.input.entries())b=bp([v],x+1,b,g.lookupRecords,t);for(let x of g.lookahead)b=Qd([x],b);for(let x of g.backtrack)b=Bd([x],b);for(let{entry:x,substitutions:v}of b)x.lookup={substitutions:v,length:g.input.length+1,index:r,subIndex:m,contextRange:[-1*g.backtrack.length,1+g.input.length+g.lookahead.length]}}}return s}function mT(e,t){return e.format===2?Array.isArray(t)?gT(e,t):new Map([[t,Qf(e,t)]]):new Map([[t,null]])}function gT(e,t){let r=t[0],s=Qf(e,r),o=t[0]+1,c=new Map;for(;o<t[1];)Qf(e,o)!==s&&(o-r<=1?c.set(r,s):c.set([r,o],s)),o++;return o-r<=1?c.set(r,s):c.set([r,o],s),c}function Qf(e,t){for(let r of e.ranges)if(r.start<=t&&r.end>=t)return r.classId;return null}function Fh(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 xT(e,t,r){let s=[],o=Va(e.coverage);for(let{glyphId:c}of o){let u=mT(e.inputClassDef,c);for(let[f,m]of u.entries()){if(m===null)continue;let g=e.chainClassSet[m];if(g)for(let[b,x]of g.entries()){let v={individual:{},range:[]},w=jd(v,x.lookupRecords,t,0,f).map(({entry:I,substitution:k})=>({entry:I,substitutions:[k]}));for(let[I,k]of x.input.entries())w=bp(Fh(e.inputClassDef,k),I+1,w,x.lookupRecords,t);for(let I of x.lookahead)w=Qd(Fh(e.lookaheadClassDef,I),w);for(let I of x.backtrack)w=Bd(Fh(e.backtrackClassDef,I),w);for(let{entry:I,substitutions:k}of w)I.lookup={substitutions:k,index:r,subIndex:b,length:x.input.length+1,contextRange:[-1*x.backtrack.length,1+x.input.length+x.lookahead.length]};s.push(v)}}}return sx(s)}function bT(e,t,r){let s={individual:{},range:[]},o=Va(e.inputCoverage[0]);for(let{glyphId:c}of o){let u=jd(s,e.lookupRecords,t,0,c).map(({entry:f,substitution:m})=>({entry:f,substitutions:[m]}));for(let[f,m]of e.inputCoverage.slice(1).entries())u=bp(Va(m).map(g=>g.glyphId),f+1,u,e.lookupRecords,t);for(let f of e.lookaheadCoverage)u=Qd(Va(f).map(m=>m.glyphId),u);for(let f of e.backtrackCoverage)u=Bd(Va(f).map(m=>m.glyphId),u);for(let{entry:f,substitutions:m}of u)f.lookup={substitutions:m,index:r,subIndex:0,length:e.inputCoverage.length,contextRange:[-1*e.backtrackCoverage.length,e.inputCoverage.length+e.lookaheadCoverage.length]}}return s}function yT(e,t){let r={individual:{},range:[]},s=Va(e.coverage);for(let{glyphId:o,index:c}of s){let u={};Array.isArray(o)?r.range.push({entry:u,range:o}):r.individual[o]=u;let f=[{entry:u,substitutions:[e.substitutes[c]]}];for(let m of e.lookaheadCoverage)f=Qd(Va(m).map(g=>g.glyphId),f);for(let m of e.backtrackCoverage)f=Bd(Va(m).map(g=>g.glyphId),f);for(let{entry:m,substitutions:g}of f)m.lookup={substitutions:g,index:t,subIndex:0,length:1,contextRange:[-1*e.backtrackCoverage.length,1+e.lookaheadCoverage.length]}}return r}function Bf(e,t=new Map){let r={};for(let[s,o]of Object.entries(e.individual))r[s]=Nm(o,t);for(let{range:s,entry:o}of e.range){let c=Nm(o,t);for(let u=s[0];u<s[1];u++)r[u]=c}return r}function Nm(e,t){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=Bf(e.forward,t)),e.reverse&&(r.reverse=Bf(e.reverse,t)),e.lookup&&(r.lookup=e.lookup),r}var vT=class{constructor(e,t){this._lookupTrees=[],this._glyphLookups={},this._font=e,t.cacheSize>0&&(this._cache=new aT({maxSize:t.cacheSize,sizeCalculation:((c,u)=>u.length)}));let r=(this._font.tables.gsub&&this._font.tables.gsub.features.filter(c=>c.tag==="calt")||[]).reduce((c,u)=>[...c,...u.feature.lookupListIndexes],[]),s=this._font.tables.gsub&&this._font.tables.gsub.lookups||[],o=s.filter((c,u)=>r.some(f=>f===u));for(let[c,u]of o.entries()){let f=[];switch(u.lookupType){case 6:for(let[g,b]of u.subtables.entries())switch(b.substFormat){case 1:f.push(pT(b,s,g));break;case 2:f.push(xT(b,s,g));break;case 3:f.push(bT(b,s,g));break}break;case 8:for(let[g,b]of u.subtables.entries())f.push(yT(b,g));break}let m=Bf(sx(f));this._lookupTrees.push({tree:m,processForward:u.lookupType!==8});for(let g of Object.keys(m))this._glyphLookups[g]||(this._glyphLookups[g]=[]),this._glyphLookups[g].push(c)}}findLigatures(e){let t=this._cache&&this._cache.get(e);if(t&&!Array.isArray(t))return t;let r=[];for(let c of e)r.push(this._font.charToGlyphIndex(c));if(this._lookupTrees.length===0)return{inputGlyphs:r,outputGlyphs:r,contextRanges:[]};let s=this._findInternal(r.slice()),o={inputGlyphs:r,outputGlyphs:s.sequence,contextRanges:s.ranges};return this._cache&&this._cache.set(e,o),o}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 o of e)r.push(this._font.charToGlyphIndex(o));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 o=r.last;for(let c=r.first;c<o;c++){let u=Nf(s.tree,e,c,c);if(u){for(let f=0;f<u.substitutions.length;f++){let m=u.substitutions[f];m!==null&&(e[c+f]=m)}Rm(t,u.contextRange[0]+c,u.contextRange[1]+c),c+u.length>=o&&(o=c+u.length+1),c+=u.length-1}}}else for(let o=r.last-1;o>=r.first;o--){let c=Nf(s.tree,e,o,o);if(c){for(let u=0;u<c.substitutions.length;u++){let f=c.substitutions[u];f!==null&&(e[o+u]=f)}Rm(t,c.contextRange[0]+o,c.contextRange[1]+o),o-=c.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 o=this._glyphLookups[e[s]];if(o)for(let c=0;c<o.length;c++){let u=o[c];if(u>=t){(r.index===null||u<=r.index)&&(r.index=u,r.first>s&&(r.first=s),r.last=s+1);break}}}return r}};function wT(e,t){let r=rT.parse(e);return new vT(r,{cacheSize:0,...t})}function AT(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 o=t.input[t.offset++];switch(o){case"'":case'"':s+=TT(t,o);break;case",":r.push(s),s="";break;default:/\s/.test(o)||(t.offset--,s+=CT(t),r.push(s),s="")}}return r}function TT(e,t){let r="",s=!1;for(;e.offset<e.input.length;){let o=e.input[e.offset++];if(s)/[\dA-Fa-f]/.test(o)?(e.offset--,r+=ix(e)):o!==`
63
+ `&&(r+=o),s=!1;else switch(o){case t:return r;case"\\":s=!0;break;default:r+=o}}throw new Error("Unterminated string")}function CT(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+=ix(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 ix(e){let t="";for(;e.offset<e.input.length;){let r=e.input[e.offset++];if(/\s/.test(r))return Uh(t);if(t.length>=6||!/[\dA-Fa-f]/.test(r))return e.offset--,Uh(t);t+=r}return Uh(t)}function Uh(e){return String.fromCodePoint(parseInt(e,16))}var pc;async function _T(e,t){if(!pc){if(typeof navigator<"u"&&"fonts"in navigator){try{let o=await navigator.permissions.request?.({name:"local-fonts"});if(o&&o.state!=="granted")throw new Error("Permission to access local fonts not granted.")}catch(o){if(o instanceof Error&&o.name!=="TypeError")throw o}let s={};try{let o=await navigator.fonts.query();for(let c of o)s.hasOwnProperty(c.family)||(s[c.family]=[]),s[c.family].push(c);pc=Promise.resolve(s)}catch(o){o instanceof Error&&console.error(o.name,o.message)}}else if(typeof window<"u"&&"queryLocalFonts"in window){let s={};try{let o=await window.queryLocalFonts();for(let c of o)s.hasOwnProperty(c.family)||(s[c.family]=[]),s[c.family].push(c);pc=Promise.resolve(s)}catch(o){o instanceof Error&&console.error(o.name,o.message)}}pc??=Promise.resolve({})}let r=await pc;for(let s of AT(e)){if(ST.includes(s))return;if(r.hasOwnProperty(s)&&r[s].length>0){let o=r[s][0];if("blob"in o){let c=await(await o.blob()).arrayBuffer();return wT(c,{cacheSize:t})}return}}}var ST=["serif","sans-serif","cursive","fantasy","monospace","system-ui","emoji","math","fangsong"],LT=1e5;function IT(e,t=[]){let r,s,o=0,c;return e.registerCharacterJoiner(u=>{let f=e.options.fontFamily;if(f&&(o===0||r!==f)){s=void 0,o=1,r=f;let m=r;_T(m,LT).then(g=>{m===e.options.fontFamily&&(o=2,s=g,g&&e.refresh(0,e.rows-1))}).catch(g=>{m===e.options.fontFamily&&(o=3,e.options.logLevel==="debug"&&console.debug(c,new Error("Failure while loading font")),s=void 0,c=g)})}return s&&o===2?s.findLigatureRanges(u).map(m=>[m[0],m[1]]):kT(u,t)})}function kT(e,t){let r=[];for(let s=0;s<e.length;s++)for(let o=0;o<t.length;o++)if(e.startsWith(t[o],s)){r.push([s,s+t[o].length]),s+=t[o].length-1;break}return r}var ET=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=IT(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 Dm(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 MT=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=Dm(r[1]),o=Dm(r[2]);switch(s){case 0:this.progress={state:s,value:0};break;case 1:if(o<0)return!0;this.progress={state:s,value:o};break;case 2:case 4:if(o<0)return!0;this.progress={state:s,value:o||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 ox(e,t){const r=Math.max(e.left,t.left),s=Math.max(e.top,t.top),o=Math.min(e.right,t.right),c=Math.min(e.bottom,t.bottom);return o>r&&c>s?{left:r,top:s,right:o,bottom:c}:null}function Qm(e,t){const r=ox(e,t);return r?(r.right-r.left)*(r.bottom-r.top):0}function zl(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 o=e.dimensions?.css?.cell?.height,c=s.width/e.cols,u=o&&o>0?o:s.height/e.rows;return{originLeft:s.left,originTop:s.top,cellW:c,cellH:u}}function rd(e,t){const r=zl(e);if(!r)return null;const s=t.row-e.buffer.active.viewportY;if(s<0||s>=e.rows)return null;const o=Math.max(0,Math.min(e.cols-1,t.col));return{x:r.originLeft+(o+.5)*r.cellW,y:r.originTop+s*r.cellH}}function RT(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 fd(e,t,r){const s=e.row*r+e.col,o=t.row*r+t.col;return s<=o?{start:e,end:t}:{start:t,end:e}}function NT(e,t,r){const s=zl(e);if(!s)return null;const{start:o,end:c}=fd(t,r,e.cols),u=e.buffer.active.viewportY,f=u+e.rows-1;if(c.row<u||o.row>f)return null;const m=Math.max(o.row,u),g=Math.min(c.row,f),b=s.originTop+(m-u)*s.cellH,x=s.originTop+(g-u+1)*s.cellH;return o.row===c.row?{left:s.originLeft+o.col*s.cellW,top:b,right:s.originLeft+(c.col+1)*s.cellW,bottom:x}:{left:s.originLeft,top:b,right:s.originLeft+e.cols*s.cellW,bottom:x}}function DT(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),o=Math.min(e.viewport.bottom,e.terminal.bottom),c=t+e.margin,u=r+e.margin,f=Math.max(c,s-e.width-e.margin),m=Math.max(u,o-e.height-e.margin),g=fe=>Math.max(c,Math.min(fe,f)),b=fe=>Math.max(u,Math.min(fe,m)),x=e.selection?ox(e.selection,{left:t,top:r,right:s,bottom:o}):null;if(!x){const fe=g(e.clientX-e.width/2),_e=e.clientY-e.height-e.fingerGap,De=e.clientY+e.fingerGap,be=b(_e>=u?_e:De);return{left:Math.round(fe),top:Math.round(be)}}const v=(x.left+x.right)/2,w=(x.top+x.bottom)/2,I=e.preference?.alignX??v,k=e.selectionGap??e.fingerGap,N=x.top-e.height-k,R=x.bottom+k,Q=e.preference?.vertical==="below"?R:N,F=e.preference?.vertical==="below"?N:R,q=[{left:c,top:u},{left:f,top:u},{left:c,top:m},{left:f,top:m}];e.preference&&q.sort((fe,_e)=>{const De=be=>{const st=be.left+e.width/2,Ue=be.top+e.height/2;return Math.hypot(st-e.preference.focusX,Ue-e.preference.focusY)};return De(_e)-De(fe)});const P=[{left:I-e.width/2,top:Q},{left:v-e.width/2,top:Q},{left:I-e.width/2,top:F},{left:v-e.width/2,top:F},{left:x.left-e.width-e.fingerGap,top:w-e.height/2},{left:x.right+e.fingerGap,top:w-e.height/2},...q].map(fe=>({left:g(fe.left),top:b(fe.top)}));let Z=P[0],V=Number.POSITIVE_INFINITY;return P.forEach((fe,_e)=>{const De={left:fe.left,top:fe.top,right:fe.left+e.width,bottom:fe.top+e.height},be=(e.avoid??[]).reduce((Ue,Ee)=>Ue+Qm(De,Ee),0),st=(be>0?1e6:0)+be*100+Qm(De,x)*10+_e*.01;st<V&&(Z=fe,V=st)}),{left:Math.round(Z.left),top:Math.round(Z.top)}}function QT(e){const t=e.willChange.split(",").map(s=>s.trim()),r=(s,o)=>!!(s&&s!==o);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 BT(e){let t=e.parentElement;for(;t;){if(QT(window.getComputedStyle(t)))return t;t=t.parentElement}return null}function jT(e,t,r,s){const o=e.getBoundingClientRect();let c=0,u=0;if(t){const f=t.getBoundingClientRect();c=f.left+t.clientLeft,u=f.top+t.clientTop}return{x:o.left-c+r,y:o.top-u+s}}function PT(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 OT(e,t,r){let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];)s+=1;let o=0;const c=e.length-s,u=t.length-s;for(;o<c&&o<u&&e[e.length-1-o]===t[t.length-1-o];)o+=1;const f=t.slice(s,t.length-o);return f&&(r==="insertFromPaste"||r==="insertFromPasteAsQuotation"||/[\r\n]/.test(f))?f:null}const Bm=2,FT=new Set(["mount","init-fit","resize","dpr-change","session-key-change","session-reset","tmux-layout"]);function UT(e){const t=e.reason.replace(/^refresh:/,""),r=FT.has(t),s=Math.abs(e.proposedCols-e.currentCols),o=Math.abs(e.proposedRows-e.currentRows);return{accept:r?s>0||o>0:s>=Bm||o>=Bm,isRealResize:r,colsDelta:s,rowsDelta:o}}function $T(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 zT(e,t){return!e||t}function HT(e,t,r){return e!=="alternate"&&r>=t}function GT(e,t){return e?"none":t?"single":"settled"}function WT(e,t,r){return!r&&(e||t)}function VT(e){let t,r,s=!1,o=0;const c=e.parser.registerCsiHandler({prefix:"?",final:"l"},f=>(t&&f.some(m=>m===2026)&&(s=!0),!1)),u=f=>{const m=t;if(!m)return;const g=r;if(t=void 0,r=void 0,s=!1,m(),f){const b=e._core?._renderService?._renderer?.value;g&&b?.handleResize(...g),b?.renderRows(0,e.rows-1),e.refresh(0,e.rows-1)}};return{begin(){if(o++,s=!1,t)return;const f=e._core?._renderService?._renderer?.value;if(!f||typeof f.handleResize!="function"||typeof f.renderRows!="function"||typeof f.clear!="function")return;const m=f.handleResize,g=f.renderRows,b=f.clear;f.handleResize=(x,v)=>{r=[x,v]},f.renderRows=()=>{},f.clear=()=>{},t=()=>{f.handleResize=m,f.renderRows=g,f.clear=b}},get generation(){return o},written(f){f===o&&s&&!e.modes.synchronizedOutputMode&&u(!0)},cancel(){u(!0)},dispose(){u(!1),c.dispose()}}}function $h(){return{confirmed:null,pending:null,nextSeq:1}}function jm(e,t){return e?.cols===t.cols&&e.rows===t.rows}function yp(e,t,r){const s={...t,seq:e.nextSeq,attempt:r};return{state:{...e,pending:s,nextSeq:e.nextSeq+1},request:s}}function qT(e,t){return jm(e.pending,t)||!e.pending&&jm(e.confirmed,t)?{state:e,request:null}:yp(e,t,0)}function ZT(e,t){return yp(e,t,0)}function YT(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 Pm(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}:{...yp(e,s,s.attempt+1),exhausted:!1}}function KT(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 XT(e){return{...e,pending:null}}const jf="termdock-settings",JT=6,eC=100,tC='"calt" on',rC=["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!==","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"];function nC(){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 vp(){return{fontFamily:"var(--font-mono)",fontSize:nC(),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 Mu(e,t,r,s){return typeof e=="number"&&Number.isFinite(e)?Math.max(t,Math.min(r,e)):s}function Om(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 E0(e){const t=vp(),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:Mu(r.fontSize,JT,eC,t.fontSize),rendererMode:s==="auto"||s==="webgl"||s==="canvas"?s:t.rendererMode,fontWeight:Om(r.fontWeight,t.fontWeight),fontWeightBold:Om(r.fontWeightBold,t.fontWeightBold),letterSpacing:Math.round(Mu(r.letterSpacing,-5,10,t.letterSpacing)),lineHeight:Mu(r.lineHeight,1,2,t.lineHeight),minimumContrastRatio:Mu(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 Ru(e){return e.pointerType==="touch"||e.pointerType==="pen"}class sC{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(o=>{try{o({type:t,pointerId:r,handler:s})}catch{}})}log(t,r,s=""){if(typeof window<"u"&&window.__TERMDOCK_GESTURE_DEBUG__){const o=performance.now().toFixed(0);console.debug(`[GestureManager ${o}] ${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(!Ru(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 o of this.sortedHandlers()){if(!this.handlerMatchesContainer(o,t)){this.log("skip-container",o.name);continue}o.onPointerDown(t,r)&&!s&&(this.active.set(t.pointerId,o.name),s=!0,this.log("claim",o.name,`pid=${t.pointerId} onPointerDown`),this.emitChange("claim",t.pointerId,o.name))}s&&t.preventDefault()};handlePointerMove=t=>{if(!Ru(t)||!this.pointerStates.has(t.pointerId))return;let r=!1;for(const s of this.sortedHandlers()){if(!this.handlerMatchesContainer(s,t))continue;const o=this.active.get(t.pointerId)===s.name,c=s.onPointerMove(t,o);if(c==="claim"&&!r){const u=this.active.get(t.pointerId)??null;this.active.set(t.pointerId,s.name),r=!0,t.preventDefault(),u&&u!==s.name&&this.log("handoff",`${u}->${s.name}`,`pid=${t.pointerId}`),this.log("claim",s.name,`pid=${t.pointerId} onPointerMove`),this.emitChange("claim",t.pointerId,s.name)}if(c==="release"&&o&&!r){const u=this.active.get(t.pointerId);this.active.delete(t.pointerId),this.log("release",s.name,`pid=${t.pointerId}`),this.emitChange("release",t.pointerId,u??null)}}};handlePointerUp=t=>{if(!Ru(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(!Ru(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 ax=new sC,iC=90,oC=80,aC=70,lC=(e,t)=>{const{scrollMultiplier:r=1.2,maxScrollBoost:s=.8,boostDenominator:o=50,velocityAlpha:c=.15,maxVelocity:u=15,minVelocity:f=.3,decelerationRate:m=.998,enableKinetic:g=!0,shouldCaptureTouch:b,canStartScrollGesture:x,onScroll:v,onScrollWithCoords:w,onTap:I,onClickWithCoords:k,onClaimChange:N,tapThreshold:R=10,gestureName:Q="normal-scroll"}=t,F=1.06,q=S.useRef({lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1,pointerId:null,isCurrentlyScrolling:!1,gestureAxis:null}),P=S.useRef(0),Z=S.useRef(0),V=S.useRef(0),fe=S.useRef(null),_e=S.useRef(0),De=S.useRef(!1),be=S.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),st=S.useCallback(()=>{fe.current=null,P.current!==0&&(w&&Z.current>0&&V.current>0?w(P.current,Z.current,V.current):v&&v(P.current),P.current=0,Z.current=0,V.current=0)},[v,w]),Ue=S.useCallback(()=>{fe.current===null&&typeof window<"u"&&(fe.current=window.requestAnimationFrame(st))},[st]),Ee=S.useCallback((We,W,Je)=>{P.current+=We,W!==void 0&&Je!==void 0&&(Z.current=W,V.current=Je),Ue()},[Ue]),ht=S.useCallback(We=>{if(!We||!v)return!1;const W=v(We);return W?_e.current=0:_e.current++,W},[v]),Ve=S.useCallback(We=>{De.current!==We&&(De.current=We,N?.(We))},[N]),he=S.useCallback(()=>{const We=q.current;We.rafId!==null&&typeof window<"u"&&window.cancelAnimationFrame(We.rafId),We.rafId=null,fe.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(fe.current),fe.current=null,P.current=0},[]),Oe=S.useRef(I);Oe.current=I;const ie=S.useRef(k);ie.current=k;const Le=S.useRef(b);Le.current=b;const Xe=S.useCallback(()=>{const We=e.current;if(!We||!("PointerEvent"in window))return()=>{};const W=q.current,Je={name:Q,priority:aC,get container(){return e.current??void 0},onPointerDown:(ce,qe)=>(ce.pointerType!=="touch"||(W.pointerId=ce.pointerId,W.startX=qe.startX,W.startY=qe.startY,W.didMove=!1,W.gestureAxis=null,W.lastY=ce.clientY,W.lastTime=be(),W.velocity=0,he()),!1),onPointerMove:(ce,qe)=>{if(ce.pointerType!=="touch"||W.pointerId!==ce.pointerId||!W.lastY||!W.lastTime)return"neutral";const ue=ce.clientX,Me=ce.clientY,et=be(),bt=et-W.lastTime,xe=Me-W.lastY;if(W.startX!==null&&W.startY!==null){const Ie=ue-W.startX,Qe=Me-W.startY;if(!W.didMove&&Math.hypot(Ie,Qe)>=R&&(W.didMove=!0),W.gestureAxis===null&&W.didMove){const Pe=Math.abs(Ie),ft=Math.abs(Qe);Pe>ft*F?W.gestureAxis="x":ft>Pe*F&&(W.gestureAxis="y")}if(W.gestureAxis==="x")return W.isCurrentlyScrolling=!1,Ve(!1),W.lastY=Me,W.lastTime=et,qe?"release":"neutral";if(W.gestureAxis===null)return W.lastY=Me,W.lastTime=et,"neutral"}if(W.gestureAxis==="y"&&!qe&&!(x?.()??!0))return W.lastY=Me,W.lastTime=et,Ve(!1),"neutral";const de=xe/Math.max(bt,1);if(W.velocity=W.velocity*(1-c)+de*c,W.velocity=Math.max(-u,Math.min(u,W.velocity)),Math.abs(xe)>1){if(!qe)return Ve(!0),W.lastY=Me,W.lastTime=et,"claim";W.isCurrentlyScrolling=!0;const Ie=r+Math.min(s,Math.abs(xe)/o),Qe=-xe*Ie;Ee(Qe,ue,Me),Ve(!0)}return W.lastY=Me,W.lastTime=et,qe?"claim":"neutral"},onPointerUp:ce=>{if(ce.pointerType!=="touch"||W.pointerId!==ce.pointerId)return;const qe=W.isCurrentlyScrolling;W.isCurrentlyScrolling=!1,Ve(!1);const ue=W.rafId!==null||fe.current!==null;!W.didMove&&!ue&&W.startX!==null&&W.startY!==null&&Oe.current?.(W.startX,W.startY),!W.didMove&&!ue&&W.startX!==null&&W.startY!==null&&ie.current?.(W.startX,W.startY),W.pointerId=null,W.startX=null,W.startY=null;const Me=W.gestureAxis==="x";if(W.gestureAxis=null,g&&qe&&!Me&&Math.abs(W.velocity)>f&&W.didMove){const et=()=>{const bt=be(),xe=bt-(W.lastTime||bt);if(W.lastTime=bt,W.velocity*=Math.pow(m,xe),Math.abs(W.velocity)<f){W.velocity=0,he();return}if(!ht(-W.velocity*xe)&&_e.current>2){W.velocity=0,he();return}W.rafId=requestAnimationFrame(et)};W.rafId=requestAnimationFrame(et)}},onPointerCancel:ce=>{ce.pointerType!=="touch"||W.pointerId!==ce.pointerId||(W.isCurrentlyScrolling=!1,Ve(!1),W.pointerId=null,W.startX=null,W.startY=null,W.gestureAxis=null,he())}},Se=ax.register(Je),me=We.style.touchAction;return We.style.touchAction="none",()=>{Ve(!1),Se(),We.style.touchAction=me,he()}},[e,Q,r,s,o,c,u,f,m,be,he,ht,Ee,R,g,Ve,x]),re=S.useCallback(()=>{const We=e.current;if(!We)return()=>{};const W=q.current,Je=qe=>{qe.touches.length===1&&((b?.()??!0)&&qe.cancelable&&qe.preventDefault(),W.isCurrentlyScrolling=!1,W.gestureAxis=null,W.lastY=qe.touches[0].clientY,W.startX=qe.touches[0].clientX,W.startY=qe.touches[0].clientY,W.didMove=!1,W.velocity=0,he())},Se=qe=>{if(qe.touches.length!==1)return;const ue=qe.touches[0].clientX,Me=qe.touches[0].clientY;if(W.startX!==null&&W.startY!==null){const bt=ue-W.startX,xe=Me-W.startY;if(!W.didMove&&Math.hypot(bt,xe)>=R&&(W.didMove=!0),W.gestureAxis===null&&W.didMove){const de=Math.abs(bt),Ie=Math.abs(xe);de>Ie*F?W.gestureAxis="x":Ie>de*F&&(W.gestureAxis="y")}if(W.gestureAxis==="x"){W.isCurrentlyScrolling=!1,W.lastY=Me;return}if(W.gestureAxis===null){(b?.()??!1)&&qe.cancelable&&qe.preventDefault(),W.lastY=Me;return}}if(qe.preventDefault(),!W.lastY){W.lastY=Me;return}const et=Me-W.lastY;if(Math.abs(et)>1){W.isCurrentlyScrolling=!0;const bt=r+Math.min(s,Math.abs(et)/o),xe=-et*bt;Ee(xe,ue,Me)}W.lastY=Me},me=qe=>{if(!qe.changedTouches?.[0])return;const Me=W.isCurrentlyScrolling;W.isCurrentlyScrolling=!1;const et=W.rafId!==null||fe.current!==null;!W.didMove&&!et&&I&&W.startX!==null&&W.startY!==null&&I(W.startX,W.startY),!W.didMove&&!et&&k&&W.startX!==null&&W.startY!==null&&k(W.startX,W.startY),W.startX=null,W.startY=null;const bt=W.gestureAxis==="x";if(W.gestureAxis=null,g&&Me&&!bt&&W.didMove&&Math.abs(W.velocity)>f){const xe=()=>{if(W.velocity*=Math.pow(m,16),Math.abs(W.velocity)<f){W.velocity=0,he();return}if(!ht(-W.velocity*16)&&_e.current>2){W.velocity=0,he();return}W.rafId=requestAnimationFrame(xe)};W.rafId=requestAnimationFrame(xe)}};We.addEventListener("touchstart",Je,{passive:!1}),We.addEventListener("touchmove",Se,{passive:!1}),We.addEventListener("touchend",me,{passive:!1}),We.addEventListener("touchcancel",me,{passive:!1});const ce=We.style.touchAction;return We.style.touchAction="none",()=>{We.removeEventListener("touchstart",Je),We.removeEventListener("touchmove",Se),We.removeEventListener("touchend",me),We.removeEventListener("touchcancel",me),We.style.touchAction=ce,he()}},[e,r,s,o,f,m,he,ht,Ee,I,k,R,b,g]),ge=S.useCallback(()=>{he();const We=typeof window<"u"&&"PointerEvent"in window,W=We?Xe():()=>{},Je=We?()=>{}:re();return()=>{W(),Je(),he()}},[Xe,re,he]),Qt=S.useCallback(()=>q.current.isCurrentlyScrolling||q.current.rafId!==null||fe.current!==null,[]),Rt=S.useCallback(()=>{he();const We=q.current;We.isCurrentlyScrolling=!1,We.velocity=0,We.lastY=null,We.lastTime=null,We.startX=null,We.startY=null,We.pointerId=null,We.didMove=!1,We.gestureAxis=null},[he]);return{setupTouchScroll:ge,isScrolling:Qt,stopAllScroll:Rt}};function Fm(e){const{name:t,priority:r}=e,s=T.useRef(e.onPointerDown),o=T.useRef(e.onPointerMove),c=T.useRef(e.onPointerUp),u=T.useRef(e.onPointerCancel),f=T.useRef(e.container);s.current=e.onPointerDown,o.current=e.onPointerMove,c.current=e.onPointerUp,u.current=e.onPointerCancel,f.current=e.container,T.useEffect(()=>{const m={name:t,priority:r,get container(){const b=f.current;return typeof b=="function"?b():b},onPointerDown(b,x){return s.current?.(b,x)??!1},onPointerMove(b,x){return o.current?.(b,x)??"neutral"},onPointerUp(b){c.current?.(b)},onPointerCancel(b){u.current?.(b)}};return ax.register(m)},[t,r])}var Os;(function(e){e.Light="light",e.Medium="medium",e.Heavy="heavy",e.Success="success",e.Warning="warning",e.Error="error"})(Os||(Os={}));Os.Light,Os.Medium,Os.Heavy,Os.Success,Os.Warning,Os.Error;Os.Light,Os.Medium,Os.Heavy,Os.Success,Os.Warning,Os.Error;Os.Light,Os.Medium,Os.Heavy,Os.Success,Os.Warning,Os.Error;const cC=()=>typeof navigator<"u"&&typeof navigator.vibrate=="function",uC=()=>typeof document<"u"&&!!document.body,dC=()=>{if(uC())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{}},Um=e=>Array.isArray(e)?[...e]:[e],hC=e=>{if(cC()){try{const o=Um(e),c=o.length===1?o[0]:o;navigator.vibrate(c)}catch{}return}const t=Um(e),r=Array.from({length:Math.ceil(t.length/2)},(o,c)=>[t[c*2]??0,t[c*2+1]??0]);let s=0;for(const[o,c]of r)o>0&&setTimeout(dC,s),s+=o+c},Jo=e=>hC(e),fC=({message:e})=>{const{t}=qr();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")})]})})},pC=()=>{const{t:e}=qr();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")})]})})},mC=({message:e,onRetry:t})=>{const{t:r}=qr();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 nd(e){return Array.from(e)}function $m(e,t,r){return Math.max(t,Math.min(r,e))}function gC(e,t,r,s){const o=nd(e),c=nd(t);let u=$m(r,0,o.length);const f=$m(s,0,c.length);let m=0;for(;m<o.length&&m<c.length&&o[m]===c[m];)m++;let g=0;for(;g<o.length-m&&g<c.length-m&&o[o.length-1-g]===c[c.length-1-g];)g++;const b=o.length-m-g,x=c.slice(m,c.length-g).join(""),v=[];if(b>0||x){const w=m+b;u>w?v.push({left:u-w}):u<w&&v.push({right:w-u}),u=w,b>0&&(v.push({backspace:b}),u=m),x&&(v.push({insert:x}),u+=nd(x).length)}return u>f?v.push({left:u-f}):u<f&&v.push({right:f-u}),u=f,{ops:v,cursor:u}}function zm(e){const t=e.value,r=e.selectionStart??t.length;return nd(t.slice(0,r)).length}const pd=16,xC=10,Hm=1.5,bC=1.8,Gm=240,yC=125,vC=92;function wC(e,t,r){const s=Math.hypot(e,t),o=Math.abs(e),c=Math.abs(t),u=()=>o>=c*Hm?e>0?"right":"left":c>=o*Hm?t>0?"down":"up":"";if(r==="")return s>pd?u():"";if(s<xC)return"";if(s<=pd)return r;const f=u();if(f===""||f===r)return r;if(r==="left"&&f==="right"||r==="right"&&f==="left"||r==="up"&&f==="down"||r==="down"&&f==="up")return f;const g=r==="left"||r==="right";return(g?c:o)>=(g?o:c)*bC?f:r}function AC(e){const t=vC-pd,r=Math.min(Math.max((e-pd)/t,0),1);return Gm-r*(Gm-yC)}const TC="termdock-open-terminal-directory",Pf=/(?:\\[ \t]|[^\s`"'<>|()[\]{}=,:;!?:,;!?。、“”‘’])+/gu,CC=new RegExp(`^( *)(${Pf.source})`,"u"),_C=/[,;:!?]+$/u,SC=/^[a-z][a-z\d+.-]*:\/\//iu;function LC(e){return!e||e==="/"||SC.test(e)||e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("~/")||e.startsWith("./")||e.startsWith("../")?!0:e.endsWith("/")||/^[^/:]+\/[^/:]+\/(?:[^/:]+\/?)+$/u.test(e)}function lx(e){const t=[];Pf.lastIndex=0;let r;for(;(r=Pf.exec(e))!==null;){const o=r[0].replace(_C,"");if(!LC(o))continue;const c=e.slice(r.index+o.length).match(/^:(\d+)(?::\d+)?(?=$|[\s:,,;;。!!??)\]}`])/u),u=c?Number(c[1]):void 0,f=u!==void 0&&Number.isSafeInteger(u)&&u>0;t.push({text:o,...f?{line:u}:{},startIndex:r.index,endIndex:r.index+o.length+(f?c[0].length:0)})}return t}function zh(e){const t=[];for(const r of e.split("/"))!r||r==="."||(r===".."?t.pop():t.push(r));return`/${t.join("/")}`}function IC(e){return e.match(/^\/(?:home|Users)\/[^/]+/u)?.[0]??null}function kC(e,t){const r=e.replace(/\\([ \t])/gu,"$1").replace(/\/+$/u,"")||"/";if(r.startsWith("/"))return zh(r);if(r==="~"||r.startsWith("~/")){const s=t?IC(t):null;return s?zh(`${s}/${r.slice(2)}`):null}return t?.startsWith("/")?zh(`${t}/${r}`):null}function Nu(e,t){const r=e.buffer.active.getLine(t-1),s=e.buffer.active.getLine(t);if(!r||!s||s.isWrapped)return null;const o=r.translateToString(!0).trimEnd(),c=s.translateToString(!0),u=lx(o).at(-1),f=c.match(CC);if(!u||u.endIndex!==o.length||!u.text.endsWith("/")||!f||/^[~./]/u.test(f[2]))return null;const m=f[2];if(!m.includes("/")&&!/^[^/:]+\.[\p{L}\p{N}_-]+$/u.test(m))return null;let g=r.length-1;for(;g>=0&&!(r.getCell(g)?.getChars()||"").trim();)g-=1;const b=f[1].length;let x=0;for(let k=b;k<s.length;k+=1){const N=s.getCell(k);if(N?.getWidth()!==0){if(!N||/[\s/:]/u.test(N.getChars()||" "))break;x+=N.getWidth()}}if(r.length-g-1>=Math.max(8,b+2,x))return null;const w=r.getCell(g),I=s.getCell(b);return!w||!I||w.isFgDefault()||I.isFgDefault()||w.getFgColorMode()!==I.getFgColorMode()||w.getFgColor()!==I.getFgColor()?null:b}function EC(e,t){const r=e.buffer.active;let s=t-1;if(!r.getLine(s))return null;for(;s>0&&(r.getLine(s)?.isWrapped||Nu(e,s)!==null);)s-=1;let o=t-1;for(;o+1<r.length&&(r.getLine(o+1)?.isWrapped||Nu(e,o+1)!==null);)o+=1;let c="";const u=[],f=[];for(let g=s;g<=o&&c.length<=2048;g+=1){const b=r.getLine(g);if(!b)break;const x=g>s?Nu(e,g)??0:0;let v=b.length;if(g<o&&Nu(e,g+1)!==null)for(;v>0&&!(b.getCell(v-1)?.getChars()||"").trim();)v-=1;for(let w=x;w<v;w+=1){const I=b.getCell(w);if(!I||I.getWidth()===0)continue;const k=I.getChars()||" ";c+=k;for(let N=0;N<k.length;N+=1)u.push({x:w+1,y:g+1}),f.push({x:w+Math.max(1,I.getWidth()),y:g+1})}}const m=c.trimEnd().length;return{text:c.slice(0,m),startPositions:u.slice(0,m),endPositions:f.slice(0,m)}}function MC(e,t){return{provideLinks(r,s){const o=EC(e,r);if(!o){s(void 0);return}const c=lx(o.text).map(u=>({text:u.text,range:{start:o.startPositions[u.startIndex]??{x:u.startIndex+1,y:r},end:o.endPositions[u.endIndex-1]??{x:u.endIndex,y:r}},activate:()=>u.line===void 0?t(u.text):t(u.text,u.line)}));s(c.length>0?c:void 0)}}}function Wm(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 o=0;if(s!==null){const m=Math.max(0,s-r);e.ybase>m&&(e.ybase=m,Number.isFinite(e.ydisp)&&(e.ydisp=Math.min(e.ydisp,m)),o++)}let c=Math.max(0,Math.floor(e.ybase)+r),u=s===null?c:Math.min(c,s),f=Math.max(0,u-e.lines.length);if(f>r){const m=Math.max(0,e.lines.length-r);e.ybase>m&&(e.ybase=m,Number.isFinite(e.ydisp)&&(e.ydisp=Math.min(e.ydisp,m)),o++),c=Math.max(0,Math.floor(e.ybase)+r),u=s===null?c:Math.min(c,s),f=Math.max(0,u-e.lines.length)}for(let m=0;m<f;m++){const g=e.lines.length;if(e.lines.push(e.getBlankLine(void 0)),e.lines.length<=g)break;o++}return o}function Vm(e,t=e.rows){const s=e._core?._bufferService?.buffers;return s?Wm(s.normal,t)+Wm(s.alt,t):0}function Du(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:0}function RC(e,t,r){const s=Du(e.fontBoundingBoxAscent)+Du(e.fontBoundingBoxDescent),o=Du(e.actualBoundingBoxAscent)+Du(e.actualBoundingBoxDescent);return Math.max(1,Math.floor(Math.ceil(s||o||t)*r))}const Ql=8,Qu=36,qm=10,NC=1.08,DC=1.16,Bu=6,QC=.94,BC=.08,jC=.12,PC=88,OC=36,FC=10,UC=14,$C=52;function mc(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 zC=80,HC=8;function ju(e,t){return e.modes?.applicationCursorKeysMode===!0?`\x1BO${t}`:`\x1B[${t}`}function GC(e){return e.nativeEvent.isComposing||e.isComposing===!0||e.keyCode===229}function WC(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 VC(e){const t="\x1B]52;";let r=0,s="";for(;r<e.length;){const o=e.indexOf(t,r);if(o===-1)return s+=e.slice(r),{cleaned:s,remainder:""};s+=e.slice(r,o);let c=-1,u=1;for(let g=o+t.length;g<e.length;g+=1){const b=e.charCodeAt(g);if(b===7){c=g,u=1;break}if(b===27&&g+1<e.length&&e[g+1]==="\\"){c=g,u=2;break}}if(c===-1)return{cleaned:s,remainder:e.slice(o)};const f=e.slice(o+t.length,c),m=f.indexOf(";");if(m>=0){const g=f.slice(m+1);if(g&&g!=="?"){const b=WC(g);b!==null&&navigator.clipboard?.writeText(b).catch(()=>{})}}r=c+u}return{cleaned:s,remainder:""}}function qC(e){if(typeof window>"u")return null;const t=[e,...Array.from(e.querySelectorAll("*"))];let r=null;for(const s of t){const c=window.getComputedStyle(s).overflowY;if(!(c!=="auto"&&c!=="scroll")){if(s.scrollHeight-s.clientHeight>2)return s;r||(r=s)}}return r}const ZC=new Set(["visibility","bfcache","online"]),YC=5e5,KC=1e5,gc=260,xc=140,Zm=80;function XC(e){return!e}let b0=null;const JC=[{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:"⏺⏸⏹✓✗"}],e_=()=>{if(b0)return b0;if(typeof document>"u"||!("fonts"in document))return b0=Promise.resolve(),b0;const e=document.fonts;return b0=Promise.allSettled(JC.map(({font:r,text:s})=>e.load(r,s))).then(()=>e.ready).then(()=>{}).catch(()=>{}),b0},Ym=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 Km(e){return e==="normal"||e==="bold"?e:Math.max(1,Math.min(1e3,Math.round(e)))}function Bl(e,t,r){const s=e?.dimensions?.css.cell.height;return Math.max(8,Math.round(s||t*r))}function t_(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 Xm=new Map;function r_(e,t,r,s,o){if(typeof window>"u"||typeof document>"u")return null;const c=e.getBoundingClientRect();if(c.width<24||c.height<24)return null;const u=window.devicePixelRatio||1,f=`${r}::${s}::${o}::${u}::${t}`;let m=Xm.get(f);if(!m)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*u)+Math.round(s))/u,N=RC(w,r,o);k>=1&&N>=1&&(m={cellWidth:k,cellHeight:N},Xm.set(f,m))}catch{return null}if(!m)return null;const g=Math.max(2,Math.floor(c.width/m.cellWidth)),b=Math.max(2,Math.floor(c.height/m.cellHeight));return!Number.isFinite(g)||!Number.isFinite(b)?null:{cols:g,rows:b}}async function Jm(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 n_(e){const t=e.buffer.active,r=t.viewportY,s=Math.min(t.length,r+e.rows),o=[];for(let c=r;c<s;c+=1){const u=t.getLine(c);u&&o.push(u.translateToString(!0))}return o.join(`
64
+ `).replace(/\s+$/g,"")}function bc(e,t,r){const s=zl(e);if(!s)return null;const o=Math.max(0,Math.min(e.cols-1,Math.floor((t-s.originLeft)/s.cellW))),c=Math.max(0,Math.min(e.rows-1,Math.floor((r-s.originTop)/s.cellH)));return{col:o,row:e.buffer.active.viewportY+c}}function Hh(e,t,r){const s=t.row*e.cols+t.col,o=r.row*e.cols+r.col;if(s===o)return e.clearSelection(),!1;const c=Math.min(s,o),u=Math.max(s,o)+1,f=c%e.cols,m=Math.floor(c/e.cols);return e.select(f,m,u-c),!0}function eg(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e)||"0");return Number.isFinite(t)?t:0}function s_(e,t,r,s,o=!0){if(typeof window>"u")return{left:0,top:0};const c=window.visualViewport,u=c?.offsetLeft??0,f=c?.offsetTop??0,m=c?.width??window.innerWidth,g=c?.height??window.innerHeight,b=eg("--safe-top-inset"),x=eg("--safe-bottom-inset"),v=s?NT(s.terminal,s.anchor,s.focus):null,w=[];let I;if(o&&w.push({left:e-32,top:t-32,right:e+32,bottom:t+32}),s){const N=zl(s.terminal),{start:R,end:Q}=fd(s.anchor,s.focus,s.terminal.cols),F=rd(s.terminal,R),q=rd(s.terminal,Q);if(F&&w.push({left:F.x-24,top:F.y-48,right:F.x+24,bottom:F.y+4}),q&&N){const P=q.y+N.cellH;w.push({left:q.x-24,top:P-4,right:q.x+24,bottom:P+48})}if(v){const P=s.anchor.row*s.terminal.cols+s.anchor.col,Z=s.focus.row*s.terminal.cols+s.focus.col,V=P<=Z,fe=v.right-v.left,De=s.anchor.row===s.focus.row?V?v.left+fe*.25:v.right-fe*.25:(v.left+v.right)/2,be=rd(s.terminal,s.focus),st=be&&N?be.y+N.cellH/2:t;I={vertical:s.focus.row<s.anchor.row?"below":"above",alignX:De,focusX:be?.x??e,focusY:st}}}const k=DT({clientX:e,clientY:t,viewport:{left:u,top:f+b,right:u+m,bottom:f+g-x},terminal:r,width:PC,height:OC,margin:FC,fingerGap:UC,selection:v,avoid:w,preference:I,selectionGap:$C});return{left:k.left-r.left,top:k.top-r.top}}const cx=S.forwardRef(({sessionKey:e,isLayoutVisible:t=!0,chunks:r,onInput:s,onResize:o,onFlowControl:c,onTmuxScroll:u,tmuxScrollSensitivity:f=.55,onDoubleTap:m,onInputFocusChange:g,onMobileLongPressCopyResult:b,onMobilePasteResult:x,onReadyChange:v,onSizeSynchronizedChange:w,onWritesSettled:I,onWriteProgress:k,onCursorPositionChange:N,onDirectoryLinkActivate:R,terminalSettings:Q,theme:F,className:q,enableTouchScroll:P,mobileLongPressMode:Z="arrows",autoFocus:V=!0,cursorVisible:fe=!0,suppressSmoothScroll:_e=!1},De)=>{const{t:be}=qr(),st=S.useRef(null),Ue=S.useRef(null),Ee=S.useRef(null),ht=S.useRef(null),Ve=S.useRef(null),he=S.useRef(_e);he.current=_e;const Oe=S.useRef(null),ie=S.useRef(s),Le=S.useRef(o),Xe=S.useRef(g),re=S.useRef(c),ge=S.useRef(v);ge.current=v;const Qt=S.useRef(w);Qt.current=w;const Rt=S.useRef(I);Rt.current=I;const We=S.useRef(k);We.current=k;const W=S.useRef(N);W.current=N;const Je=S.useRef(R);Je.current=R;const Se=S.useRef(Q.rendererMode),me=S.useRef(""),ce=S.useRef(0),qe=S.useRef(!1),ue=S.useRef(null),Me=S.useRef(0),et=S.useRef(0),bt=S.useRef(!1),xe=S.useRef(null),de=S.useRef(null),Ie=S.useRef(()=>{}),Qe=S.useRef(null),Pe=S.useRef(null),ft=S.useRef(void 0),Mt=S.useRef(null),Be=S.useRef(!1),gr=S.useRef(0),ct=S.useRef(""),gt=S.useRef(null),vt=S.useRef(null),_t=S.useRef(!1),qt=S.useRef(typeof window<"u"?window.devicePixelRatio:1),ee=S.useRef(!1),Te=S.useRef(!1),Ze=S.useRef(null),Ht=S.useRef(""),$e=S.useRef(0),Nt=S.useRef(null),lr=S.useRef(null),ye=S.useRef(null),Bn=S.useRef(0),Lr=S.useRef(0),ve=S.useRef(0),$r=S.useRef(null),kt=S.useRef(0),un=S.useRef(0),Ir=S.useRef(!1),kn=S.useRef(0),[,se]=S.useReducer(L=>L+1,0),[rt,Bt]=S.useReducer(L=>L+1,0),[wr,jt]=S.useState("loading"),[ne,Pt]=S.useState(null),[mt,Br]=S.useState(null);S.useEffect(()=>{const L=B=>{(B.target instanceof Element?B.target.closest("[data-termdock-terminal-dropzone]"):null)?.dataset.termdockTerminalDropzone===e&&Br(String(B.detail))};return window.addEventListener("termdock:file-drop-error",L),()=>window.removeEventListener("termdock:file-drop-error",L)},[e]);const or=S.useMemo(()=>M0("terminal"),[]),[ws,ts]=S.useState(!0),[gn,Tr]=S.useState(!1);S.useEffect(()=>{if(!ws&&wr!=="loading"){Tr(!1);return}const L=window.setTimeout(()=>Tr(!0),160);return()=>window.clearTimeout(L)},[ws,wr]);const[en,qn]=S.useState(!1),[Cn,As]=S.useState({visible:!1,activeDir:""}),[rs,tn]=S.useState(null),jn=S.useRef(null),Vr=S.useRef(!1),Rr=S.useRef({active:!1,anchor:null,focus:null,dragging:null}),[Pn,sn]=S.useState(null),[Zn,zt]=S.useState({x:0,y:0,cellW:8,cellH:17,cursorX:0}),On=S.useRef(Zn);On.current=Zn;const zr=S.useRef(null),[Fn,Ts]=S.useState({active:!1,text:""}),as=S.useRef(null),_n=S.useRef(null);ie.current=s,Le.current=o,Xe.current=g,re.current=c,Se.current=Q.rendererMode;const Cr=S.useRef(V);Cr.current=V;const jr=S.useRef(fe);jr.current=fe;const Yn=S.useRef(P);Yn.current=P;const xn=S.useRef(t);xn.current=t;const li=XC(!!u),{rendererMode:_r,fontFamily:Un,fontSize:Ot,fontWeight:qs,fontWeightBold:rn,letterSpacing:Kn,lineHeight:Kr,minimumContrastRatio:Xn,drawBoldTextInBrightColors:bn,unicodeVersion:xr,customGlyphs:$,rescaleOverlappingGlyphs:le,fontLigatures:Ge,enableImages:Ce,smoothScrolling:He}=Q,tt=_r==="webgl",nt=S.useCallback(()=>{jn.current!==null&&(clearTimeout(jn.current),jn.current=null),tn(null)},[]),it=S.useCallback((L,B)=>{jn.current!==null&&(clearTimeout(jn.current),jn.current=null),Vr.current=!1,tn(L),!B?.persistent&&(jn.current=setTimeout(()=>{jn.current=null,tn(null)},3e3))},[]);S.useEffect(()=>{if(!rs)return;const L=()=>{Rr.current.active||nt()},B=()=>nt();return window.addEventListener("scroll",L,!0),window.addEventListener("resize",B),document.addEventListener("visibilitychange",B),()=>{window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",B),document.removeEventListener("visibilitychange",B)}},[nt,rs]),S.useEffect(()=>()=>{jn.current!==null&&(clearTimeout(jn.current),jn.current=null)},[]);const Fe=S.useCallback(()=>{const L=Ee.current,B=st.current,j=Rr.current;if(!L||!B||!j.active||!j.anchor||!j.focus){sn(null);return}const H=B.getBoundingClientRect(),ke=zl(L)?.cellH??16,{start:we,end:Ye}=fd(j.anchor,j.focus,L.cols),Ke=j.dragging==="start"?j.focus:j.dragging==="end"?j.anchor:we,Et=j.dragging==="end"?j.focus:j.dragging==="start"?j.anchor:Ye,fr=(ln,hn)=>{const fn=rd(L,ln);return fn?{left:fn.x-H.left,top:hn?fn.y-H.top:fn.y+ke-H.top}:null};sn({start:fr(Ke,!0),end:fr(Et,!1)})},[]),at=S.useCallback(L=>{const B=Ee.current,j=st.current,H=Rr.current;if(!B||!j||!H.active||!H.anchor||!H.focus)return;if(H.dragging){nt();return}const ke=j.getBoundingClientRect(),we={x:(ke.left+ke.right)/2,y:(ke.top+ke.bottom)/2};it(s_(L?.x??we.x,L?.y??we.y,ke,{terminal:B,anchor:H.anchor,focus:H.focus},L!==void 0),{persistent:!0})},[nt,it]),Kt=S.useCallback(()=>{const L=Rr.current;L.active=!1,L.anchor=null,L.focus=null,L.dragging=null,sn(null),nt()},[nt]);S.useEffect(()=>{if(!Pn)return;const L=Ee.current;if(!L)return;const B=L.onScroll(()=>{Fe(),at()}),j=L.onResize(()=>Kt());return()=>{B.dispose(),j.dispose()}},[Pn,Fe,at,Kt]),S.useEffect(()=>{P||Xe.current?.(!1)},[P]);const lt=S.useCallback((L,B,j)=>{const H=(j.element?.offsetWidth||0)/j.cols||8,ke=(j.element?.offsetHeight||0)/j.rows||16,we=Math.max(1,Math.min(j.cols,Math.floor(L/H)+1)),Ye=Math.max(1,Math.min(j.rows,Math.floor(B/ke)+1));return{x:we,y:Ye}},[]),br=S.useCallback((L,B,j)=>{const H=Ee.current;if(!H)return!1;const ke=L>0?-1:1;if(H.modes?.mouseTrackingMode!=="none"){let we,Ye;if(B!==void 0&&j!==void 0){const fr=lt(B,j,H);we=fr.x,Ye=fr.y}else we=H.buffer.active.cursorX+1,Ye=H.buffer.active.cursorY+1;const Et=`\x1B[<${ke>0?64:65};${we};${Ye}M`;return ie.current(Et),!0}if(H.buffer.active.type==="alternate"){const we=ke>0?"\x1B[A":"\x1B[B";return ie.current(we),!0}return null},[lt]),ut=S.useCallback(L=>{const B=Ee.current;if(!B)return!1;const j=Bl(Ee.current,Ot,Kr),H=gr.current+L,ke=Math.trunc(H/j);return gr.current=H-ke*j,ke!==0?(B.scrollLines(ke),!0):!1},[Ot,Kr]),hr=S.useCallback(L=>{if(!Ee.current)return!1;const H=Bl(Ee.current,Ot,Kr)/Math.max(.1,f),ke=gr.current+L;let we=Math.trunc(ke/H);if(gr.current=ke-we*H,we===0&&Math.abs(ke)>=H/3&&(we=ke>0?1:-1,gr.current=0),we===0)return!1;const Ye=we>0?"down":"up",Ke=Math.max(1,Math.min(Math.abs(we),10));return u(Ye,Ke),!0},[Ot,Kr,u,f]),ar=S.useRef(br);ar.current=br;const St=S.useRef(ut);St.current=ut;const sr=S.useRef(hr);sr.current=hr;const kr=S.useRef(u);kr.current=u;const yn=S.useRef({pointerId:null,tmuxActiveAtDown:!1});S.useEffect(()=>{if(!P)return;const L=st.current;if(!L)return;const B=H=>{H.pointerType==="touch"&&(yn.current.pointerId=H.pointerId,yn.current.tmuxActiveAtDown=!!kr.current)},j=H=>{H.pointerType==="touch"&&yn.current.pointerId===H.pointerId&&(yn.current.pointerId=null,yn.current.tmuxActiveAtDown=!1)};return L.addEventListener("pointerdown",B,{capture:!0,passive:!0}),L.addEventListener("pointerup",j,{capture:!0,passive:!0}),L.addEventListener("pointercancel",j,{capture:!0,passive:!0}),()=>{L.removeEventListener("pointerdown",B,!0),L.removeEventListener("pointerup",j,!0),L.removeEventListener("pointercancel",j,!0)}},[P]);const Zs=S.useCallback(()=>{if(Ir.current)return!1;const L=yn.current;return L.pointerId!==null?!L.tmuxActiveAtDown:!kr.current},[]),ls=S.useCallback((L,B,j)=>{const H=ar.current(L,B,j);return H!==null?H:kr.current?sr.current(L):St.current(L)},[]),Fs=S.useCallback((L,B)=>{if(performance.now()<=un.current){un.current=0;return}const j=Ee.current;if(j&&j.modes?.mouseTrackingMode!=="none"){const H=lt(L,B,j),ke=H.x,we=H.y,Ye=`\x1B[<0;${ke};${we}M`,Ke=`\x1B[<0;${ke};${we}m`;ie.current(Ye),ie.current(Ke)}},[lt]),Er=S.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),Xr=S.useCallback((L=700)=>{$r.current=null,kt.current=Er()+L},[Er]),hs=S.useCallback(()=>Yn.current&&Er()<=kt.current,[Er]),O=S.useCallback(()=>{const L=Pe.current;return!L||typeof document>"u"?!1:document.activeElement===L},[]),K=S.useCallback(()=>{if(typeof window>"u")return!1;const L=Ke=>{if(typeof document>"u")return 0;const Et=Number.parseFloat(document.documentElement.style.getPropertyValue(Ke)||"0");return Number.isFinite(Et)?Et:0},B=L("--kb-height");if(B>0)return B>=Zm;const j=window.visualViewport;if(!j)return!1;const H=L("--app-base-vh")||window.innerHeight,ke=L("--safe-bottom-inset"),we=j.height+j.offsetTop;return Math.max(0,Math.round(H-we-ke))>=Zm},[]),oe=S.useCallback(()=>{Nt.current!==null&&(clearTimeout(Nt.current),Nt.current=null),lr.current=null},[]),Ne=S.useCallback(L=>{const B=Ee.current;let j="";for(const H of L)H.left&&(j+=(B?ju(B,"D"):"\x1B[D").repeat(H.left)),H.right&&(j+=(B?ju(B,"C"):"\x1B[C").repeat(H.right)),H.backspace&&(j+="".repeat(H.backspace)),H.insert&&(j+=H.insert);return j},[]),Tt=S.useCallback(L=>{const B=L.value,j=mc(B),H=Ht.current;if(!(Yn.current&&!j.includes("\r")&&!H.includes("\r"))){if(j===H)return;let fr=0;for(;fr<H.length&&fr<j.length&&H[fr]===j[fr];)fr++;const ln=H.length-fr;ln>0&&ie.current("".repeat(ln));const hn=j.slice(fr);if(hn){try{Ee.current?.clearSelection()}catch{}ie.current(hn)}Ht.current=j,$e.current=Array.from(j).length;return}const we=zm(L),{ops:Ye,cursor:Ke}=gC(H,j,$e.current,we),Et=Ne(Ye);if(Et){if(Ye.some(fr=>fr.insert))try{Ee.current?.clearSelection()}catch{}ie.current(Et)}Ht.current=j,$e.current=Ke},[Ne]),Lt=S.useCallback((L,B)=>{const j=L.value,H=mc(j),ke=Ht.current;if(H===ke){oe();return}let we=0;for(;we<ke.length&&we<H.length&&ke[we]===H[we];)we++;const Ye=ke.length-we;if(P&&!B?.immediate&&Ye>=HC){lr.current=L,Nt.current!==null&&clearTimeout(Nt.current),Nt.current=setTimeout(()=>{Nt.current=null;const Et=lr.current;lr.current=null,Et&&Tt(Et)},zC);return}oe(),Tt(L)},[oe,P,Tt]),Yt=S.useCallback(L=>{Lt(L,{immediate:!0}),ie.current("\r"),L.value="",Ht.current="",$e.current=0},[Lt]),pt=S.useCallback((L,B,j)=>{if(!L)return;oe();const H=B??Pe.current;H&&(H.value=""),Ht.current="",$e.current=0;try{Ee.current?.clearSelection()}catch{}if(Kt(),j?.paste&&/[\r\n]/.test(L)){const ke=j.submitAfterPaste??L.endsWith("\r"),we=PT(L,ke);ie.current(we,{skipModifierTransform:!0,consumeModifier:j?.consumeModifier});return}ie.current(L,{skipModifierTransform:!0,consumeModifier:j?.consumeModifier})},[oe]),It=S.useCallback((L,B)=>{const j=mc(L);return j?(Br(null),ph(j)||(pt(j,B,{paste:!0,submitAfterPaste:!1}),nt()),!0):!1},[nt,pt]);S.useEffect(()=>my(L=>{if(L.sessionKey!==e||L.paths.length===0)return;const B=L.paths.map(kc).join(" ");pt(`${B} `);try{Pe.current?.focus({preventScroll:!0})}catch{}}),[pt,e]);const Hr=S.useCallback(async(L,B)=>{Br(null);try{const j=await N9(L);return ph(`${kc(j)} `)||(pt(`${kc(j)} `,B),nt()),!0}catch(j){return Br(j instanceof Error?j.message:"Image upload failed"),!1}},[nt,pt]),yr=S.useCallback(async(L,B)=>{Br(null);try{const j=await Q9(L);if(!j.length)return!1;const H=`${j.map(kc).join(" ")} `;return ph(H)||(pt(H,B),nt()),!0}catch(j){return Br(j instanceof Error?j.message:"File upload failed"),!1}},[nt,pt]),Gr=S.useCallback(async L=>{Br(null);try{if(ea()?.readClipboardFiles){const H=await D9();if(H.length)return yr(H,L)}if(!ea()?.readClipboardImage){if(typeof navigator.clipboard?.read=="function"){const H=await navigator.clipboard.read(),ke=await G1({read:async()=>H});if(ke)return Hr(ke,L);for(const we of H){if(!we.types.includes("text/plain"))continue;const Ye=await(await we.getType("text/plain")).text();return It(Ye,L)}return!1}return navigator.clipboard?.readText?It(await navigator.clipboard.readText(),L):!1}const B=await G1(navigator.clipboard);if(B)return Hr(B,L);if(!navigator.clipboard?.readText)return!1;const j=await navigator.clipboard.readText();return It(j,L)}catch(B){return Br(B instanceof Error?B.message:"Clipboard read failed"),!1}},[yr,Hr,It]),Wr=S.useCallback(L=>{if(zr.current&&!L?.repositionFrozen)return null;const B=Ee.current;if(!B||!B.element)return null;const j=zl(B),ke=B.element.querySelector(".xterm-screen")??B.element,we=ke.getBoundingClientRect(),Ye=j?.cellW??(we.width>0&&B.cols>0?we.width/B.cols:8),Ke=j?.cellH??(we.height>0&&B.rows>0?we.height/B.rows:17),Et=Pe.current;let fr=ft.current;Et&&(fr===void 0||fr!==null&&(!fr.isConnected||!fr.contains(Et)))&&(fr=BT(Et),ft.current=fr);const ln=B.buffer.active,hn=ln.cursorX*Ye,fn=ln.cursorY*Ke,nr=jT(ke,fr??null,hn,fn),Nr=Math.round(nr.x),ps=Math.round(nr.y),Gn={x:Nr,y:ps,cellW:Ye,cellH:Ke,cursorX:ln.cursorX};return On.current=Gn,zr.current&&L?.repositionFrozen&&(zr.current={...Gn}),zt(oo=>Math.abs(oo.x-Nr)<.5&&Math.abs(oo.y-ps)<.5&&Math.abs(oo.cellW-Ye)<.5&&Math.abs(oo.cellH-Ke)<.5&&oo.cursorX===ln.cursorX?oo:Gn),Gn},[]),on=S.useRef(Wr);on.current=Wr,S.useEffect(()=>{if(!P)return;let L=null,B=null;const j=()=>{L!==null&&window.cancelAnimationFrame(L),B!==null&&window.cancelAnimationFrame(B),L=window.requestAnimationFrame(()=>{L=null,B=window.requestAnimationFrame(()=>{B=null,on.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),B!==null&&window.cancelAnimationFrame(B),window.visualViewport?.removeEventListener("resize",j),window.visualViewport?.removeEventListener("scroll",j),document.removeEventListener("termdock:viewport-keyboard-change",j)}},[P]);const Sn=S.useCallback(L=>{let B=0;for(const j of L){const H=j.codePointAt(0)??0,ke=H>=4352&&H<=4447||H>=11904&&H<=12350||H>=12353&&H<=13311||H>=13312&&H<=19903||H>=19968&&H<=40959||H>=40960&&H<=42191||H>=44032&&H<=55203||H>=63744&&H<=64255||H>=65072&&H<=65103||H>=65280&&H<=65376||H>=65504&&H<=65510||H>=127744&&H<=129791;B+=ke?2:1}return B},[]),dn=S.useCallback(L=>{const B=Ee.current,{cellW:j,cellH:H}=Zn;if(!B||!L)return{width:Math.max(1,Math.round(j)),height:Math.max(1,Math.round(H)),whiteSpace:"pre"};const we=zr.current?.cursorX??B.buffer.active.cursorX,Ye=Math.max(1,B.cols),Ke=Math.max(1,Sn(L)),Et=Math.max(1,Ye-we);if(Ke<=Et)return{width:Math.max(1,Math.round(Ke*j)),height:Math.max(1,Math.round(H)),whiteSpace:"pre"};const fr=Ke-Et,hn=1+Math.ceil(fr/Ye);return{width:Math.max(1,Math.round(Et*j)),height:Math.max(1,Math.round(hn*H)),whiteSpace:"pre-wrap"}},[Zn,Sn]),ur=S.useCallback(()=>{ft.current=void 0;const L=on.current();zr.current={...L??On.current}},[]),Wt=S.useCallback(()=>{zr.current=null},[]),vr=S.useCallback(L=>{if(!ee.current&&zr.current===null)return!1;if(ee.current=!1,zr.current=null,oe(),Ze.current!==null&&(clearTimeout(Ze.current),Ze.current=null),Te.current=!1,L){L.value=Ht.current;try{L.setSelectionRange(L.value.length,L.value.length)}catch{}}return Ts(B=>B.active||B.text?{active:!1,text:""}:B),!0},[oe]),Xt=S.useCallback((L,B)=>{const j=Pe.current;if(j)try{j.removeAttribute("readonly");const ke=typeof document<"u"&&document.activeElement===j&&!K(),we=Er(),Ye=we-kn.current;kn.current=we,ke&&Ye>600?(j.blur(),j.removeAttribute("readonly"),j.focus(),kn.current=Er()):j.focus()}catch{}},[K,Er]),Ut=S.useCallback(L=>{Lr.current=Er()+L},[Er]),Mr=S.useCallback(()=>P?Er()<=Lr.current:!1,[P,Er]),Pr=S.useCallback(L=>{Ut(L),ve.current=Er()},[Ut,Er]),ns=S.useCallback(()=>{P&&Pe.current?.removeAttribute("readonly")},[P]),En=S.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),[]),fs=S.useCallback(L=>{if(ns(),Pr(gc),!P||L.pointerType!=="touch"){$r.current=null;return}const B=L.target;if(En(B)){Xr();return}rs&&!(B instanceof HTMLElement&&B.closest('[data-terminal-copy-popover="true"]'))&&nt(),$r.current={pointerId:L.pointerId,startX:L.clientX,startY:L.clientY,moved:!1}},[nt,P,Pr,En,rs,ns,Xr]),Or=S.useCallback(L=>{Pr(gc);const B=$r.current;!B||B.pointerId!==L.pointerId||Math.hypot(L.clientX-B.startX,L.clientY-B.startY)>12&&(B.moved=!0)},[Pr]),Gi=S.useCallback(L=>{Pr(xc);const B=$r.current;$r.current=null,!(!P||L.pointerType!=="touch")&&(!B||B.pointerId!==L.pointerId||B.moved||hs()||Xt(L.clientX,L.clientY))},[P,Pr,Xt,hs]),Us=S.useCallback(()=>{$r.current=null,Pr(xc)},[Pr]),Ea=S.useMemo(()=>({enableKinetic:!0}),[]),go=S.useRef(()=>!1),sa=S.useRef(Xt);sa.current=Xt;const Za=S.useCallback((L,B)=>{hs()||sa.current(L,B)},[hs]),Fo=S.useRef(m);Fo.current=m;const Uo=S.useRef(b);Uo.current=b;const ro=S.useRef(x);ro.current=x;const ia=S.useCallback(()=>{if(Vr.current)return;Vr.current=!0,Xr();const L=Ee.current,B=L?.hasSelection()?L.getSelection():"";try{L?.clearSelection()}catch{}qa.flushSync(()=>{Kt()}),(async()=>{const j=await Jm(B);Uo.current?.(j)})()},[Kt,Xr]),Wi=S.useCallback(L=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:L}}))},[]),{setupTouchScroll:oa,stopAllScroll:Rs}=lC(st,{...Ea,shouldCaptureTouch:go.current,canStartScrollGesture:Zs,onScroll:ls,onScrollWithCoords:ls,onClickWithCoords:Fs,onTap:Za,onClaimChange:Wi,tapThreshold:12,gestureName:`normal-scroll:${e}`});S.useEffect(()=>{if(!P)return;Pe.current?.setAttribute("readonly","");const L=oa();return()=>{L()}},[P,oa]),S.useEffect(()=>{if(!P)return;let L=K();const B=()=>{const j=K();if(L&&!j){const H=Pe.current;H&&typeof document<"u"&&document.activeElement===H&&(H.setAttribute("readonly",""),H.blur())}L=j};return window.visualViewport?.addEventListener("resize",B),window.visualViewport?.addEventListener("scroll",B),document.addEventListener("termdock:viewport-keyboard-change",B),()=>{window.visualViewport?.removeEventListener("resize",B),window.visualViewport?.removeEventListener("scroll",B),document.removeEventListener("termdock:viewport-keyboard-change",B)}},[P,K]),S.useEffect(()=>{if(!P)return;const L=st.current;if(!L)return;const B=H=>{const we=H.sourceCapabilities?.firesTouchEvents===!0,Ye=Er()-ve.current<=1200;return!we&&!Ye?!1:L.contains(H.target)},j=H=>{B(H)&&(H.cancelable&&H.preventDefault(),H.stopImmediatePropagation(),H.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)}},[P,Er]);const ci=S.useRef({pointerId:null,lastX:null,lastY:null,startX:null,startY:null,gestureAxis:null,remainder:0,didScroll:!1,rafId:null,velocity:0,instantSpeed:0}),ss=S.useCallback(()=>{const L=ci.current;L.rafId!==null&&(cancelAnimationFrame(L.rafId),L.rafId=null)},[]),Ya=S.useCallback((L,B,j)=>{const H=Ee.current;if(!H||!H.element||!H.cols||!H.rows)return null;const ke=ci.current,we=H.element.getBoundingClientRect(),Ye=B??ke.lastX??we.left+we.width/2,Ke=j??ke.lastY??we.top+we.height/2,Et=Ye-we.left,fr=Ke-we.top,ln=H.element.offsetWidth/H.cols||8,hn=H.element.offsetHeight/H.rows||16,fn=Math.max(1,Math.min(H.cols,Math.floor(Et/ln)+1)),nr=Math.max(1,Math.min(H.rows,Math.floor(fr/hn)+1));return`\x1B[<${L==="up"?64:65};${fn};${nr}M`},[]),Cs=S.useCallback((L,B,j,H)=>{if(B<=0)return;const ke=Ya(L,j,H);ke&&ie.current(B===1?ke:ke.repeat(B))},[Ya]),aa=S.useRef(Cs);aa.current=Cs;const Ma=S.useRef(()=>{}),Vi=S.useCallback(()=>{const B=Bl(Ee.current,Ot,Kr)/Math.max(.1,f),j=1+ci.current.instantSpeed*.1;return B/Math.min(6,j)},[Ot,Kr,f]),xo=S.useCallback(()=>{const L=ci.current;L.rafId=null;const B=Vi();let j=0,H=0;for(;j+H<Bu&&L.remainder>=B;)L.remainder-=B,H++;for(;j+H<Bu&&L.remainder<=-B;)L.remainder+=B,j++;if(H>0&&Cs("down",H),j>0&&Cs("up",j),j+H>0)L.rafId=requestAnimationFrame(xo);else if(L.pointerId!==null&&Math.abs(L.remainder)>=B/3){const we=L.remainder>0?"down":"up";L.remainder=0,Cs(we,1),L.rafId=requestAnimationFrame(xo)}},[Vi,Cs]),$o=S.useCallback(()=>{const L=ci.current;L.rafId===null&&typeof requestAnimationFrame<"u"&&(L.rafId=requestAnimationFrame(xo))},[xo]),la=S.useCallback(L=>{if(L.pointerType!=="touch")return!1;ss();const B=ci.current;return B.pointerId=L.pointerId,B.lastX=L.clientX,B.lastY=L.clientY,B.startX=L.clientX,B.startY=L.clientY,B.gestureAxis=null,B.remainder=0,B.velocity=0,B.instantSpeed=0,B.didScroll=!1,!1},[ss]),Ra=S.useCallback((L,B)=>{if(Ir.current)return B?"release":"neutral";if(performance.now()<=un.current)return"neutral";const j=ci.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 we=Math.abs(L.clientX-j.startX),Ye=Math.abs(L.clientY-j.startY);if(we>qm||Ye>qm){if(we>Ye*NC)return j.gestureAxis="x","release";Ye>we*DC&&(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 H=L.clientY-j.lastY;j.lastX=L.clientX,j.lastY=L.clientY;const ke=-H;if(j.remainder+=ke,j.instantSpeed=Math.abs(ke),j.velocity=j.velocity*.45+ke*.55,B){const Ye=Bl(Ee.current,Ot,Kr)/Math.max(.1,f);Math.abs(j.remainder)>=Ye/3&&(j.didScroll=!0,$o())}return"claim"},[Ot,Kr,f,$o]),Na=S.useCallback(L=>{const B=ci.current;if(L.pointerType!=="touch"||L.pointerId!==B.pointerId)return;if(ss(),B.pointerId=null,B.lastX=null,B.lastY=null,B.startX=null,B.startY=null,B.instantSpeed=0,B.gestureAxis==="x"){B.gestureAxis=null;return}B.gestureAxis=null;const H=Bl(Ee.current,Ot,Kr)/Math.max(.1,f);if(B.didScroll&&Math.abs(B.velocity)>H*BC){const ke=()=>{B.velocity*=QC,B.remainder+=B.velocity;const we=1+Math.abs(B.velocity)*.1,Ye=H/Math.min(6,we);if(Math.abs(B.velocity)<H*jC){if(Math.abs(B.remainder)>=Ye/3){const fr=B.remainder>0?"down":"up";Cs(fr,1),B.remainder=0}B.velocity=0,B.rafId=null;return}let Ke=0,Et=0;for(;Ke+Et<Bu&&B.remainder>=Ye;)B.remainder-=Ye,Et++;for(;Ke+Et<Bu&&B.remainder<=-Ye;)B.remainder+=Ye,Ke++;Et>0&&Cs("down",Et),Ke>0&&Cs("up",Ke),B.rafId=requestAnimationFrame(ke)};B.rafId=requestAnimationFrame(ke)}else Math.abs(B.remainder)>=H/3&&$o();B.didScroll&&L.stopImmediatePropagation()},[ss,Cs,$o,f,Ot,Kr]),zo=S.useCallback(L=>{const B=ci.current;L.pointerType!=="touch"||L.pointerId!==B.pointerId||(ss(),B.pointerId=null,B.lastX=null,B.lastY=null,B.startX=null,B.startY=null,B.gestureAxis=null,B.remainder=0,B.velocity=0,B.didScroll=!1)},[ss]);Fm({name:`tmux-scroll:${e}`,priority:oC,container:()=>st.current,onPointerDown:P&&u?la:void 0,onPointerMove:P&&u?Ra:void 0,onPointerUp:P&&u?Na:void 0,onPointerCancel:P&&u?zo:void 0});const _s=S.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}),no=S.useRef(null);no.current=st.current;const ca=no,vi=ie,Ka=S.useRef(Z);Ka.current=Z;const $n=S.useCallback(L=>{const B=_s.current;B.gestureLocked!==L&&(B.gestureLocked=L,Wi(L))},[Wi]),$s=S.useCallback(()=>{const L=_s.current;L.edgeScrollTimer!==null&&(clearInterval(L.edgeScrollTimer),L.edgeScrollTimer=null),L.edgeScrollDir=0},[]),bo=S.useCallback(L=>{const B=Ee.current,j=_s.current;if(B){if(j.mode==="copy"&&j.copyStart){j.copyDidSelect=Hh(B,j.copyStart,L)||j.copyDidSelect;return}if(j.mode==="adjust"){const H=Rr.current;if(!H.active||!H.anchor)return;H.focus=RT(B,L),Hh(B,H.anchor,H.focus),Fe()}}},[Fe]),ua=S.useCallback((L,B)=>{const j=Ee.current,H=_s.current;if(!j)return;const ke=zl(j);if(!ke)return;const we=ke.originTop,Ye=ke.originTop+j.rows*ke.cellH,Ke=Math.max(28,ke.cellH*1.5),Et=B-we,fr=Ye-B;let ln=0,hn=0;if(Et<Ke?(ln=-1,hn=Math.min(1,(Ke-Et)/Ke)):fr<Ke&&(ln=1,hn=Math.min(1,(Ke-fr)/Ke)),H.edgeClientX=L,H.edgeClientY=B,ln===0){$s();return}H.edgeScrollDir=ln,H.edgeScrollLines=1+Math.round(hn*5),H.edgeScrollTimer===null&&(H.edgeScrollTimer=setInterval(()=>{const fn=Ee.current,nr=_s.current;if(!fn||nr.edgeScrollDir===0)return;if(nr.mode!=="copy"&&nr.mode!=="adjust"){$s();return}fn.scrollLines(nr.edgeScrollDir*nr.edgeScrollLines);const Nr=bc(fn,nr.edgeClientX,nr.edgeClientY-Qu);Nr&&bo(Nr)},60))},[bo,$s]),da=S.useCallback(L=>{if(L.pointerType!=="touch")return!1;const B=ca.current;if(!B)return!1;const j=L.target;if(!(j instanceof HTMLElement)||!B.contains(j)||j.closest('[data-mobile-keyboard="true"]'))return!1;const H=_s.current;H.longPressMode=Ka.current;const ke=Rr.current;if(ke.active&&H.pointerId===null){const we=j.closest("[data-selection-handle]");if(we instanceof HTMLElement){const Ye=Ee.current,Ke=we.dataset.selectionHandle==="start"?"start":"end";if(Ye&&ke.anchor&&ke.focus){const Et=fd(ke.anchor,ke.focus,Ye.cols);return ke.anchor=Ke==="start"?Et.end:Et.start,ke.focus=Ke==="start"?Et.start:Et.end,ke.dragging=Ke,nt(),H.pointerId=L.pointerId,H.tapStartX=L.clientX,H.tapStartY=L.clientY,H.tapDidMove=!1,H.mode="adjust",Ir.current=!0,Xr(1800),Pe.current?.setAttribute("readonly",""),Rs(),ss(),Jo(Ql),$n(!0),!0}}if(!j.closest("[data-terminal-copy-popover]")){Kt();try{Ee.current?.clearSelection()}catch{}}}if(H.pointerId!==null)return!0;if(Ir.current=!1,Fo.current){const we=performance.now(),Ye=L.clientX,Ke=L.clientY;if(H.lastTapTime!==0&&we-H.lastTapTime<=300&&Math.hypot(Ye-H.lastTapX,Ke-H.lastTapY)<=25)return Jo(Ql),un.current=performance.now()+500,Fo.current?.(),qn(!0),_n.current&&clearTimeout(_n.current),_n.current=setTimeout(()=>qn(!1),400),H.lastTapTime=0,!0}return H.holdTimer!==null&&(clearTimeout(H.holdTimer),H.holdTimer=null),H.joystickRepeatTimer!==null&&(clearTimeout(H.joystickRepeatTimer),H.joystickRepeatTimer=null),H.joystickDir="",H.copyStart=null,H.copyDidSelect=!1,H.pointerId=L.pointerId,H.originX=L.clientX,H.originY=L.clientY,H.tapStartX=L.clientX,H.tapStartY=L.clientY,H.tapDidMove=!1,H.mode="holding",H.longPressMode==="copy"&&$n(!0),H.holdTimer=setTimeout(()=>{if(H.holdTimer=null,H.mode==="holding"){if(H.longPressMode==="copy"){const we=Ee.current,Ye=we?bc(we,H.tapStartX,H.tapStartY):null;if(!we||!Ye){H.mode="idle";return}H.mode="copy",Ir.current=!0,Xr(1800),Pe.current?.setAttribute("readonly",""),H.copyStart=Ye,H.copyDidSelect=!1,Rs(),ss(),we.clearSelection(),Jo(Ql),$n(!0);return}H.mode="arrow",Ir.current=!0,Xr(1e3),Rs(),ss(),Jo(Ql),$n(!0),requestAnimationFrame(()=>{As({visible:!0,activeDir:""})})}},350),!0},[$n,nt,Kt]),so=S.useCallback((L,B)=>{if(L.pointerType!=="touch")return"neutral";const j=_s.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 H=L.clientX-j.tapStartX,ke=L.clientY-j.tapStartY;if(Math.hypot(H,ke)>10&&(j.tapDidMove=!0),j.mode==="holding"){if(!B)return j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),$n(!1),Ir.current=!1,j.mode="idle","neutral";const we=L.clientX-j.originX,Ye=L.clientY-j.originY;return j.longPressMode==="copy"&&Math.hypot(we,Ye)>20?(j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),$n(!1),Ir.current=!1,j.mode="idle","release"):Math.hypot(we,Ye)>20?(j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),$n(!1),j.mode="idle","release"):"claim"}if(j.mode==="adjust"){if(!B)return"claim";Rs();const we=Ee.current,Ye=Rr.current;if(!we||!Ye.active||!Ye.anchor||!Ye.focus)return"claim";const Ke=bc(we,L.clientX,L.clientY-Qu);return Ke&&(bo(Ke),ua(L.clientX,L.clientY)),"claim"}if(j.mode==="copy"){if(!B)return"claim";Rs();const we=Ee.current;if(!we||!j.copyStart)return"claim";const Ye=bc(we,L.clientX,L.clientY-Qu);return Ye&&(bo(Ye),ua(L.clientX,L.clientY)),"claim"}if(j.mode==="arrow"){if(!B)return"claim";const we={up:"\x1B[A",down:"\x1B[B",left:"\x1B[D",right:"\x1B[C"},Ye=L.clientX-j.tapStartX,Ke=L.clientY-j.tapStartY,Et=wC(Ye,Ke,j.joystickDir);if(Et&&Et!==j.joystickDir&&(j.originX=L.clientX,j.originY=L.clientY),Et){const fr=L.clientX-j.originX,ln=L.clientY-j.originY,hn=Math.hypot(fr,ln);if(j.repeatIntervalMs=AC(hn),Et!==j.joystickDir){j.joystickRepeatTimer!==null&&clearTimeout(j.joystickRepeatTimer);const fn=j.joystickDir==="";j.joystickDir=Et,vi.current(we[Et]);const nr=performance.now();nr-j.lastHapticTime>120&&(Jo(Ql),j.lastHapticTime=nr);const Nr=fn?400:300;j.joystickRepeatTimer=setTimeout(function ps(){if(j.joystickDir!==Et)return;vi.current(we[Et]);const Gn=performance.now();Gn-j.lastHapticTime>120&&(Jo(Ql),j.lastHapticTime=Gn),j.joystickRepeatTimer=setTimeout(ps,j.repeatIntervalMs)},Nr)}As({visible:!0,activeDir:Et})}else j.joystickRepeatTimer!==null&&(clearTimeout(j.joystickRepeatTimer),j.joystickRepeatTimer=null),j.joystickDir="",As({visible:!0,activeDir:""});return"claim"}return"neutral"},[$n,bo,ua]),Ys=S.useCallback(L=>{if(L.pointerType!=="touch"||L.pointerId!==_s.current.pointerId)return;const B=_s.current;if(B.mode==="copy"){Rs(),ss(),$s(),$n(!1);const H=Ee.current;let ke=null;if(H&&B.copyStart&&(ke=bc(H,L.clientX,L.clientY-Qu),ke&&(B.copyDidSelect=Hh(H,B.copyStart,ke)||B.copyDidSelect)),H&&B.copyDidSelect&&H.hasSelection()&&B.copyStart){const we=Rr.current;we.active=!0,we.anchor=B.copyStart,we.focus=ke??B.copyStart,we.dragging=null,Fe(),at({x:L.clientX,y:L.clientY}),Xr(1800),Jo(Ql)}else Uo.current?.(!1);B.holdTimer!==null&&(clearTimeout(B.holdTimer),B.holdTimer=null),B.copyStart=null,B.copyDidSelect=!1,B.pointerId=null,B.mode="idle",Ir.current=!1;return}if(B.mode==="adjust"){Rs(),ss(),$s(),$n(!1),Rr.current.dragging=null,Fe(),at({x:L.clientX,y:L.clientY}),Xr(1800),B.pointerId=null,B.mode="idle",Ir.current=!1;return}if(B.mode==="arrow"){Rs(),ss(),$n(!1),As({visible:!1,activeDir:""}),B.holdTimer!==null&&(clearTimeout(B.holdTimer),B.holdTimer=null),B.joystickRepeatTimer!==null&&(clearTimeout(B.joystickRepeatTimer),B.joystickRepeatTimer=null),B.joystickDir="",B.pointerId=null,B.mode="idle",Ir.current=!1;return}const j=ca.current;if(j&&!B.tapDidMove){const H=L.target;H instanceof HTMLElement&&j.contains(H)&&!H.closest('[data-mobile-keyboard="true"]')&&(B.lastTapTime=performance.now(),B.lastTapX=L.clientX,B.lastTapY=L.clientY)}else B.tapDidMove&&(B.lastTapTime=0);B.holdTimer!==null&&(clearTimeout(B.holdTimer),B.holdTimer=null),B.joystickRepeatTimer!==null&&(clearTimeout(B.joystickRepeatTimer),B.joystickRepeatTimer=null),B.joystickDir="",$n(!1),Ir.current=!1,B.copyStart=null,B.copyDidSelect=!1,B.pointerId=null,B.mode="idle"},[$n,Rs,Xr,$s,Fe,at]),Al=S.useCallback(()=>{const L=_s.current;$n(!1),$s(),L.mode==="arrow"&&As({visible:!1,activeDir:""}),L.mode==="adjust"&&(Rr.current.dragging=null,Fe(),at()),L.holdTimer!==null&&(clearTimeout(L.holdTimer),L.holdTimer=null),L.joystickRepeatTimer!==null&&(clearTimeout(L.joystickRepeatTimer),L.joystickRepeatTimer=null),L.joystickDir="",Ir.current=!1,L.copyStart=null,L.copyDidSelect=!1,L.pointerId=null,L.tapDidMove=!1,L.mode="idle"},[$n,$s,Fe,at]);Fm({name:`long-press:${e}`,priority:iC,container:()=>st.current,onPointerDown:P?da:void 0,onPointerMove:P?so:void 0,onPointerUp:P?Ys:void 0,onPointerCancel:P?Al:void 0});const Ss=S.useCallback((L={})=>{et.current+=1,me.current="",de.current=null,ce.current=0,qe.current&&(qe.current=!1,L.notifyFlowResume===!0&&re.current?.(!1)),ue.current=null,bt.current=!1,xe.current=null,ct.current=""},[]),zn=S.useCallback((L="unknown")=>{const B=Oe.current,j=Ee.current,H=st.current;if(!B||!j||!H||!j.element||!j.cols||!j.rows)return;const ke=H.getBoundingClientRect();if(ke.width<24||ke.height<24){or("skip fit: container too small",{reason:L,width:Math.round(ke.width),height:Math.round(ke.height)});return}try{const we={cols:j.cols,rows:j.rows},Ye=j.buffer.active,Ke=HT(Ye.type,Ye.baseY,Ye.viewportY),Et=B.proposeDimensions();if(!Et||Et.cols<=0||Et.rows<=0)return;const fr=Vm(j,we.rows),ln=UT({reason:L,currentCols:we.cols,currentRows:we.rows,proposedCols:Et.cols,proposedRows:Et.rows});let hn=0;if(ln.accept){Ae.current&&kr.current&&(we.cols!==Et.cols||we.rows!==Et.rows)&&Ve.current?.begin();const nr=j.options.smoothScrollDuration;try{j.options.smoothScrollDuration=0,j.resize(Et.cols,Et.rows),hn=Vm(j,Et.rows),Ke&&j.scrollToBottom()}finally{j.options.smoothScrollDuration=nr}gr.current=0}(fr>0||hn>0)&&(j.refresh(0,Math.max(0,j.rows-1)),or("xterm buffer invariant repaired",{reason:L,before:fr,after:hn,cols:j.cols,rows:j.rows}));const fn={cols:j.cols,rows:j.rows};or("fit",{reason:L,backend:"xterm",width:Math.round(ke.width),height:Math.round(ke.height),before:we,proposed:Et,next:fn,hysteresis:ln,changed:we.cols!==fn.cols||we.rows!==fn.rows})}catch{Ve.current?.cancel()}},[or]),vn=S.useCallback(L=>{const B=Ee.current;if(B)try{B.refresh(0,Math.max(0,B.rows-1)),or("terminal refreshed (sync)",{reason:L,cols:B.cols,rows:B.rows,hasWebgl:!!gt.current})}catch(j){or("terminal refresh (sync) failed",{reason:L,error:j})}},[or]),wi=S.useCallback(L=>{const B=vt.current;if(B){try{B.dispose()}catch{}vt.current=null}const j=gt.current;if(!j)return!1;Ve.current?.cancel();try{j.dispose()}catch{}return gt.current=null,or("renderer disposed",{type:"webgl",reason:L}),!0},[or]),zs=S.useCallback((L,B)=>{if(gt.current)return!0;try{const j=new Ow({customGlyphs:$});return vt.current=j.onContextLoss(()=>{or("webgl context loss",{reason:"onContextLoss"}),_t.current=!0,typeof window<"u"&&window.setTimeout(()=>{Ln("webgl-context-loss",{forceRendererRecreate:!0})},0)}),Ve.current?.cancel(),L.loadAddon(j),gt.current=j,_t.current=!1,or("renderer",{type:"webgl",reason:B,mobile:P,mode:Se.current}),vn(`webgl-enabled:${B}`),zn(`webgl-enabled:${B}`),At.current=!0,!0}catch(j){return or("webgl load failed, fallback to dom renderer",{reason:B,error:j,mobile:P,mode:Se.current}),!1}},[or,$,P,zn,vn]),ha=200,qi=S.useRef(0),Ii=S.useRef(new Map),ki=S.useRef(new Map),an=S.useRef($h()),Zi=S.useRef(null),J=S.useRef(null),je=S.useRef(-1),ot=S.useRef(new Map),At=S.useRef(!1),Ae=S.useRef(!1),xt=S.useCallback(()=>{const L=Ii.current;L.forEach(B=>cancelAnimationFrame(B)),L.clear(),ki.current.clear()},[]),cr=S.useCallback(()=>{Zi.current!==null&&(window.clearTimeout(Zi.current),Zi.current=null)},[]),Fr=S.useRef(()=>{}),nn=S.useCallback(L=>{cr(),Qt.current?.(!1),Le.current(L.cols,L.rows,L.seq),Zi.current=window.setTimeout(()=>{Zi.current=null;const B=Pm(an.current,L.seq);an.current=B.state,B.request&&Ae.current?(or("resize ack timeout; retrying",{seq:L.seq,retrySeq:B.request.seq,cols:B.request.cols,rows:B.request.rows}),Fr.current(B.request)):B.exhausted&&(Ve.current?.cancel(),or("resize ack timeout; leaving size unconfirmed",{seq:L.seq,cols:L.cols,rows:L.rows}))},1200)},[cr,or]);Fr.current=nn;const Ar=S.useCallback((L,B)=>{if(!Ae.current)return;const j=qT(an.current,{cols:L,rows:B});an.current=j.state,j.request&&nn(j.request)},[nn]),Hn=1500,Mn=400,Ls=S.useRef(0),Is=S.useRef(0),io=S.useCallback((L,B,j)=>{if(!Number.isFinite(L)||!Number.isFinite(B)||L<=0||B<=0)return;const H=Math.floor(L),ke=Math.floor(B);an.current=KT(an.current,{cols:H,rows:ke}),Ls.current=Date.now(),or("pty-size broadcast received",{cols:H,rows:ke,source:j??"unknown"})},[or]),Hs=S.useCallback(L=>{const B=Ee.current;if(!B||!B.cols||!B.rows||!Ae.current||typeof document<"u"&&(document.visibilityState!=="visible"||!Ec()))return;const j=Date.now();if(j-Ls.current<Hn||j-Is.current<Mn)return;const H=B.cols,ke=B.rows,we=an.current.confirmed;we&&we.cols===H&&we.rows===ke||(Is.current=j,or("ensureSizeMatches push",{reason:L,cols:H,rows:ke,lastServerSize:we}),Ar(H,ke))},[or,Ar]),Da=S.useCallback((L,B)=>{const j=Ee.current,H=Oe.current;if(!j||!H)return;if(!At.current){or("refresh skipped: renderer not ready",{reason:L});return}if(B.dedupeKey!==void 0){if(ot.current.get(L)===B.dedupeKey){or("refresh deduped",{reason:L,dedupeKey:B.dedupeKey});return}ot.current.set(L,B.dedupeKey)}or("refresh",{reason:L,options:B});const ke=B.forceRendererRecreate===!0||_t.current||tt&&!!gt.current&&ZC.has(L)&&/Android/i.test(navigator.userAgent);let we=!1;ke&&(_t.current=!1,tt?(wi(`refresh:${L}`),zs(j,`refresh:${L}`)||vn(`refresh:${L}:webgl-fallback`),we=!0):(vn(`refresh:${L}`),we=!0)),WT(B.forceRedraw===!0,L==="dpr-change",we)?vn(`refresh:${L}`):we||or("terminal redraw skipped: fit/write already repaints",{reason:L});const Ye={cols:j.cols,rows:j.rows};zn(`refresh:${L}`);const Ke={cols:j.cols,rows:j.rows};if(B.skipResizePush||$T({before:Ye,after:Ke,lastServerSize:an.current.confirmed,reconcileServerSize:B.reconcileServerSize})&&Ar(Ke.cols,Ke.rows),!B.skipScrollToBottom&&L!=="resize"&&L!=="dpr-change"){const fr=requestAnimationFrame(()=>{const fn=Ee.current;if(fn&&fn.buffer.active.type!=="alternate")try{fn.scrollToBottom()}catch{}}),ln=Ii.current,hn=ln.get(L);hn!==void 0&&cancelAnimationFrame(hn),ln.set(L,fr)}},[or,tt,wi,zs,vn,zn,Ar]),Ln=S.useCallback((L,B={})=>{if(Ee.current,L==="session-key-change"&&(an.current=$h(),cr(),ot.current.clear(),xt()),!B.force&&(L==="visibility"||L==="bfcache"||L==="online")){const H=Date.now();if(H-qi.current<ha){or("refresh throttled",{reason:L});return}qi.current=H}if(ki.current.set(L,B),Ii.current.has(L))return;const j=requestAnimationFrame(()=>{const H=ki.current.get(L)??{};Ii.current.delete(L),ki.current.delete(L),Da(L,H)});Ii.current.set(L,j)},[or,xt,cr,Da]),ui=S.useCallback(L=>{const B=Ii.current.get(L);if(B===void 0)return;const j=ki.current.get(L)??{};cancelAnimationFrame(B),Ii.current.delete(L),ki.current.delete(L),Da(L,j)},[Da]);Ma.current=()=>ui("resize"),S.useEffect(()=>()=>{xt(),Mt.current!==null&&(window.clearTimeout(Mt.current),Mt.current=null)},[e,xt]),S.useEffect(()=>{an.current=$h(),cr(),ot.current.clear()},[e,cr]);const Xa=S.useCallback(()=>{if(bt.current)return;const L=Ee.current;if(!L){Ss();return}if(!me.current)return;const B=me.current,j=B.length,H=de.current;me.current="",de.current=null,bt.current=!0;const ke=Ve.current,we=ke?.generation;L.write(B,()=>{if(we!==void 0&&ke?.written(we),bt.current=!1,ce.current-=j,ce.current<0&&(ce.current=0),H!==null&&We.current?.(H),qe.current&&ce.current<KC&&(qe.current=!1,re.current?.(!1)),me.current){Xa();return}const Ye=++et.current,Ke=()=>{if(Ye!==et.current||bt.current||me.current)return;const Et=L.buffer.active;Rt.current?.({x:Et.cursorX,y:Et.cursorY,rows:L.rows,lastProcessedChunkId:xe.current})};typeof window>"u"?Ke():window.requestAnimationFrame(()=>{window.requestAnimationFrame(Ke)})})},[Ss]);Ie.current=Xa;const Jl=S.useCallback(()=>{if(ue.current!==null)return;const L=++Me.current;ue.current=L,queueMicrotask(()=>{ue.current===L&&(ue.current=null,Xa())})},[Xa]),e0=S.useCallback((L,B)=>{L&&(et.current+=1,me.current+=L,de.current=B,ce.current+=L.length,!qe.current&&ce.current>=YC&&(qe.current=!0,re.current?.(!0)),Jl())},[Jl]);return S.useEffect(()=>{let L=!1,B=null,j=null,H=[];const ke=st.current;return ke?(ke.tabIndex=P?-1:0,(async()=>{if(ge.current?.(!1),jt("loading"),Pt(null),ts(!0),await e_(),!L)try{const Ye=r_(ke,Ym(Un),Ot,Kn,Kr),Ke=new yv({...Ye?{cols:Ye.cols,rows:Ye.rows}:{},allowProposedApi:!0,fontFamily:Ym(Un),fontSize:Ot,fontWeight:Km(qs),fontWeightBold:Km(rn),theme:t_(F),logLevel:"off",cursorBlink:!tt,cursorStyle:"block",cursorInactiveStyle:jr.current?"bar":"none",scrollback:u?2e3:5e3,scrollbar:{showScrollbar:!1},allowTransparency:u9(_r,Ce),convertEol:li,drawBoldTextInBrightColors:bn,rescaleOverlappingGlyphs:le,minimumContrastRatio:Xn,letterSpacing:Kn,lineHeight:Kr,smoothScrollDuration:He&&!he.current?125:0,scrollOnEraseInDisplay:!0,tabStopWidth:8,vtExtensions:{kittyKeyboard:!0},windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}}),Et=new vv;Ke.loadAddon(Et),Ke.loadAddon(new Gw),Ke.registerLinkProvider(MC(Ke,(nr,Nr)=>{Je.current?.(nr,Nr)}));const fr=new Xw;Ke.loadAddon(fr),Ke.unicode.activeVersion=xr,Ke.loadAddon(new oA({highlightLimit:1e3}));const ln=new dA;Ke.loadAddon(ln),ht.current=ln,Ke.loadAddon(new MT);try{Ke.loadAddon(new fA(void 0,new V5))}catch(nr){or("clipboard addon skipped",{error:nr})}B=Ke,Ee.current=Ke,Oe.current=Et,qt.current=typeof window<"u"?window.devicePixelRatio:1,Ke.open(ke),Ve.current=VT(Ke),Ge&&Ke.loadAddon(new ET({fontFeatureSettings:tC,fallbackLigatures:rC}));try{const nr=Ke._core;nr?.coreService&&(nr.coreService.isCursorInitialized=!0),Ke.refresh(0,Ke.rows-1)}catch{}if(tt?(zs(Ke,"init"),At.current=!0):(or("renderer",{type:"dom",reason:"renderer-mode-dom-fallback",mobile:P,mode:_r}),At.current=!0),ts(!1),Bt(),P){const nr=Nr=>{if(Nr.ctrlKey||Nr.metaKey){Nr.preventDefault();const ps=Nr.deltaY>0?-1:1,Gn=Math.max(8,Math.min(32,Ot+ps));Gn!==Ot&&ke.dispatchEvent(new CustomEvent("termfontchange",{detail:Gn}))}};ye.current=nr,ke.addEventListener("wheel",nr,{passive:!1})}if(!P){let nr=0,Nr=null,ps=null,Gn=null;const oo=()=>{Gn=null,Ma.current();const Wn=Bl(Ee.current,Ot,Kr),yo=Bn.current+nr;nr=0;const Ho=Math.trunc(yo/Wn);if(Bn.current=yo-Ho*Wn,Ho!==0){const ks=Ho>0?"down":"up",Tl=Ee.current,Qa=Math.max(3,Math.floor((Tl?.rows??24)/2)),Cl=Math.abs(Ho);Cl>Qa&&(Bn.current=0),aa.current(ks,Math.min(Cl,Qa),Nr??void 0,ps??void 0)}};Ke.attachCustomWheelEventHandler(Wn=>{if(Wn.ctrlKey||Wn.metaKey||Wn.shiftKey)return!0;if(Wn.deltaY===0)return!1;if(!Ee.current||!kr.current)return!0;const Ho=Bl(Ee.current,Ot,Kr);let ks=Wn.deltaY;return Wn.deltaMode===1?ks=Wn.deltaY*Ho:Wn.deltaMode===2&&(ks=Wn.deltaY*(ke.clientHeight||Ho*20)),nr+=ks,Nr=Wn.clientX,ps=Wn.clientY,Gn===null&&(Gn=requestAnimationFrame(oo)),Wn.preventDefault(),!1})}const hn=qC(ke);if(hn?(hn.classList.add("overlay-scrollbar-target","overlay-scrollbar-container"),Ue.current=hn,se()):Ue.current=null,Ln("mount",{skipResizePush:!0,skipScrollToBottom:!0}),Cr.current&&(P?Ke.focus():Pe.current?.focus({preventScroll:!0})),P||on.current(),H.push(Ke.onRender(()=>{const nr=Ke.buffer.active;W.current?.({x:nr.cursorX,y:nr.cursorY,rows:Ke.rows}),P||on.current()})),!P){try{const nr=Ke.textarea;if(nr){nr.tabIndex=-1,nr.setAttribute("aria-hidden","true"),nr.setAttribute("readonly",""),nr.value="";const Nr=()=>{Pe.current?.focus({preventScroll:!0})};nr.addEventListener("focus",Nr),H.push({dispose:()=>nr.removeEventListener("focus",Nr)})}}catch{}try{H.push(Ke.onCursorMove(()=>on.current())),H.push(Ke.onResize(()=>on.current()))}catch{}}H.push(Ke.onData(nr=>{ie.current(nr)}));const fn=nr=>{const Nr=typeof window<"u"?window.devicePixelRatio:1,ps=Math.abs(Nr-qt.current)>.001;return ps&&(qt.current=Nr,or("device pixel ratio changed",{value:Nr,source:nr})),ps};if(j=new ResizeObserver(nr=>{if(!zT(!!Yn.current,xn.current)){or("resize observer skipped: hidden mobile session");return}ft.current=void 0;const Nr=nr[0];Nr&&or("resize observer",{width:Math.round(Nr.contentRect.width),height:Math.round(Nr.contentRect.height)});const ps=fn("resize-observer");Ln(ps?"dpr-change":"resize")}),j.observe(ke),typeof window<"u"){const nr=()=>{fn("window-resize")&&Ln("dpr-change")};window.addEventListener("resize",nr),H.push({dispose:()=>window.removeEventListener("resize",nr)});const Nr=window.visualViewport;if(Nr){const ps=()=>{fn("visual-viewport-resize")&&Ln("dpr-change")};Nr.addEventListener("resize",ps),H.push({dispose:()=>Nr.removeEventListener("resize",ps)})}}zn("init-fit"),jt("ready"),ge.current?.(!0)}catch(Ye){console.error("Failed to initialize terminal:",Ye),ts(!1),jt("error"),Pt(Ye instanceof Error?Ye.message:"Failed to load terminal")}})(),()=>{ge.current?.(!1),L=!0,Xe.current?.(!1),Qe.current?.(),Qe.current=null,ee.current=!1,Ze.current!==null&&(clearTimeout(Ze.current),Ze.current=null),Te.current=!1,zr.current=null,oe(),Ts({active:!1,text:""});for(const Ye of H)Ye.dispose();j?.disconnect(),ye.current&&(ke.removeEventListener("wheel",ye.current),ye.current=null),Ve.current?.dispose(),Ve.current=null,wi("component-unmount"),B?.dispose(),Ee.current=null,Oe.current=null,Ue.current=null,Ss({notifyFlowResume:!0}),cr()}):void 0},[zn,Un,Ot,qs,rn,Kn,Kr,Xn,bn,xr,$,le,Ge,Ce,He,F,Ss,oe,P,zs,wi,or,cr]),S.useEffect(()=>{const L=Ee.current;L&&(L.options.smoothScrollDuration=He&&!_e?125:0)},[He,_e,rt]),S.useEffect(()=>{const L=Ee.current;L&&(L.options.cursorInactiveStyle=fe?"bar":"none",fe||L.blur())},[fe,rt]),S.useEffect(()=>{const L=Ee.current;if(L){if(tt){if(L.options.cursorBlink=!1,zs(L,"renderer-mode-change")&&Ce&&!Be.current)try{L.loadAddon(new HA({storageLimit:64,pixelLimit:1<<24,sixelSupport:!0,iipSupport:!0,kittySupport:!0})),Be.current=!0}catch(j){or("image addon skipped",{error:j})}return}L.options.cursorBlink=!0,wi("renderer-mode-change")&&(vn("renderer-mode-change:webgl-disabled"),zn("renderer-mode-change:webgl-disabled"))}},[tt,Ce,zs,wi,vn,zn,or]),S.useEffect(()=>{const L=Ee.current;L&&(xe.current!==null&&L.reset(),Ss(),Ht.current="",$e.current=0,Pe.current&&(Pe.current.value=""),Ln("session-reset",{skipScrollToBottom:!0}),Cr.current&&(Yn.current?L.focus():Pe.current?.focus({preventScroll:!0})))},[e,rt,Ln,Ss]),S.useEffect(()=>{if(!P||typeof document>"u")return;let L=null;const B=()=>{L=null;const H=Pe.current;if(!H||document.activeElement!==H||ee.current)return;const ke=Ht.current,we=mc(H.value);if(we!==ke||we.includes("\r")||!K())return;const Ye=Math.min(zm(H),Array.from(we).length),Ke=Ye-$e.current;if(Ke===0)return;const Et=Ee.current,fr=Ke<0?(Et?ju(Et,"D"):"\x1B[D").repeat(-Ke):(Et?ju(Et,"C"):"\x1B[C").repeat(Ke);ie.current(fr),$e.current=Ye},j=()=>{L===null&&(L=requestAnimationFrame(B))};return document.addEventListener("selectionchange",j),()=>{document.removeEventListener("selectionchange",j),L!==null&&cancelAnimationFrame(L)}},[P,K]),S.useEffect(()=>{if(!P)return;const L=oa();return Qe.current=L,()=>{L(),Qe.current=null}},[P,oa]),S.useEffect(()=>{const L=Ee.current;if(L)try{L.options.scrollback=u?0:1e3}catch{}},[u,rt]),S.useEffect(()=>{const L=Ee.current;if(!L)return;if(r.length===0){xe.current!==null&&(L.reset(),Ss(),Ln("buffer-reset",{skipResizePush:!0,skipScrollToBottom:!0}));return}const B=xe.current;let j;if(B===null)j=r;else{const H=r.findIndex(ke=>ke.id===B);j=H>=0?r.slice(H+1):r}if(j.length>0){const H=j.map(Ke=>Ke.data).join(""),ke=ct.current+H,{cleaned:we,remainder:Ye}=VC(ke);ct.current=Ye,we?e0(we,j[j.length-1].id):We.current?.(j[j.length-1].id)}xe.current=r[r.length-1].id},[r,rt,e0,Ln,Ss]),S.useImperativeHandle(De,()=>({serializeSnapshot:()=>Ee.current?ht.current?.serialize({scrollback:100})??null:null,focus:()=>{if(Yn.current){Xt();return}Pe.current?.focus({preventScroll:!0})},blur:()=>{const L=Pe.current;vr(L),L&&typeof document<"u"&&document.activeElement===L&&L.blur(),Yn.current&&L?.setAttribute("readonly",""),Xe.current?.(!1)},clear:()=>{const L=Ee.current;L&&(L.reset(),Ss(),Ln("clear",{skipResizePush:!0,skipScrollToBottom:!0}))},prepareScreenReplacement:()=>{Ss({notifyFlowResume:!0})},copySelectionOrViewport:async()=>{const L=Ee.current;if(!L)return!1;const B=L.hasSelection()?L.getSelection():n_(L),j=await Jm(B);return j&&L.hasSelection()&&nt(),j},pasteClipboardText:async()=>{Xr();const L=await Gr(Pe.current);return ro.current?.(L),L},sendSequence:(L,B)=>{pt(L,null,B)},getDimensions:()=>{const L=Ee.current;return!L||!L.cols||!L.rows?null:{cols:L.cols,rows:L.rows}},requestRefresh:Ln,setSessionReady:L=>{Ae.current=L,L||(Ve.current?.cancel(),cr(),an.current=XT(an.current),J.current=null,je.current=-1,Qt.current?.(!1))},acknowledgeResize:L=>{if(!L.ok&&typeof L.seq=="number"){const we=Pm(an.current,L.seq);if(!we.request&&!we.exhausted)return;cr(),an.current=we.state,we.request&&Ae.current?Fr.current(we.request):we.exhausted&&Ve.current?.cancel();return}const B=YT(an.current,L);if(!B.accepted)return;cr(),an.current=B.state,or("resize acknowledged",{seq:L.seq,ok:L.ok,cols:L.cols,rows:L.rows,screenSyncPending:L.screenSyncPending===!0,screenSyncGeneration:L.screenSyncGeneration});const j=Ee.current,H=B.state.confirmed;if(!!!(j&&H&&j.cols===H.cols&&j.rows===H.rows)){Qt.current?.(!1);return}if(L.screenSyncPending&&typeof L.screenSyncGeneration=="number"){J.current=L.screenSyncGeneration;const we=je.current>=L.screenSyncGeneration;Qt.current?.(we),we&&(J.current=null);return}J.current=null,Qt.current?.(!0)},notifyScreenSynchronized:L=>{if(!Number.isFinite(L))return;je.current=Math.max(je.current,L);const B=J.current;if(B===null||L<B)return;J.current=null;const j=Ee.current,H=an.current.confirmed;Qt.current?.(!!(j&&H&&j.cols===H.cols&&j.rows===H.rows))},notifyServerSize:io,ensureSizeMatches:Hs,requestPtyRedraw:()=>{const L=Ee.current;if(!L||!Ae.current||an.current.pending||J.current!==null)return;const B=ZT(an.current,{cols:L.cols,rows:L.rows});an.current=B.state,Fr.current(B.request)}}),[P,vr,Xt,Ss,Gr,pt,Ln,cr,or,Ar,io,Hs]),a.jsxs("div",{ref:st,"data-termdock-terminal-dropzone":e,className:`relative h-full w-full terminal-viewport-container ${q||""}`,style:{backgroundColor:F.background,touchAction:Cn.visible?"none":void 0},role:"button",tabIndex:-1,onPointerDownCapture:fs,onPointerMoveCapture:Or,onPointerUpCapture:Gi,onPointerCancelCapture:Us,onTouchStartCapture:L=>{if(En(L.target)){Xr(),Pr(gc);return}ns(),Pr(gc)},onTouchMoveCapture:()=>Pr(gc),onTouchEndCapture:()=>Pr(xc),onTouchCancelCapture:()=>Pr(xc),onMouseDown:L=>{P||L.button===0&&(Mt.current!==null&&(window.clearTimeout(Mt.current),Mt.current=null),requestAnimationFrame(()=>{try{Pe.current?.focus({preventScroll:!0})}catch{}}))},onMouseUp:L=>{P||L.button===0&&(Mt.current!==null&&window.clearTimeout(Mt.current),Mt.current=window.setTimeout(()=>{Mt.current=null;try{Pe.current?.focus({preventScroll:!0})}catch{}},0))},children:[mt&&a.jsx("button",{type:"button",role:"alert",onClick:()=>Br(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:mt}),rs&&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:rs.left,top:rs.top,WebkitBackdropFilter:"blur(18px)"},onPointerDown:L=>{Xr(),L.stopPropagation()},onPointerUp:L=>{L.preventDefault(),L.stopPropagation(),ia()},onTouchStart:L=>{Xr(),L.stopPropagation()},onTouchEnd:L=>{L.preventDefault(),L.stopPropagation(),ia()},onClick:L=>{L.preventDefault(),L.stopPropagation(),ia()},children:[a.jsx(gy,{size:14,strokeWidth:2.4}),a.jsx("span",{children:be("common.copy")})]}),Pn?.start&&a.jsx("div",{"data-selection-handle":"start",className:"absolute z-30 h-11 w-11 select-none",style:{left:Pn.start.left,top:Pn.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)]"})]})}),Pn?.end&&a.jsx("div",{"data-selection-handle":"end",className:"absolute z-30 h-11 w-11 select-none",style:{left:Pn.end.left,top:Pn.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)]"})]})}),gn&&ws&&a.jsx(pC,{}),gn&&wr==="loading"&&!ws&&a.jsx(fC,{}),wr==="error"&&a.jsx(mC,{message:ne||void 0,onRetry:()=>{window.location.reload()}}),wr==="ready"&&a.jsxs(a.Fragment,{children:[a.jsx("textarea",{ref:Pe,"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",...P?{inset:0,touchAction:"none",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",pointerEvents:"auto",fontSize:"16px"}:(()=>{const L=Zn.x,B=Zn.y,j={position:"fixed",left:L,top:B,pointerEvents:"none",touchAction:"auto",fontSize:`${Ot}px`,fontFamily:Un,lineHeight:"1",whiteSpace:"pre",boxSizing:"content-box",width:Math.max(1,Math.round(Zn.cellW)),height:Math.max(1,Math.round(Zn.cellH))};if(!Fn.active)return j;const H=dn(Fn.text);return{...j,opacity:1,color:"transparent",WebkitTextFillColor:"transparent",background:"transparent",transition:"none",caretColor:"transparent",textDecorationColor:"transparent",wordBreak:"break-all",zIndex:20,width:H.width,height:H.height,whiteSpace:H.whiteSpace}})()},onContextMenu:L=>{L.preventDefault()},onFocus:()=>{or("input anchor focus"),ft.current=void 0,on.current(),Ln("focus",{skipResizePush:!0,skipScrollToBottom:!0}),Xe.current?.(!0)},onBlur:L=>{P||vr(L.currentTarget);const B=Mr(),j=typeof document<"u"?document.activeElement:null;if(or("input anchor blur",{guarded:B,activeTag:j?.tagName??null,activeClass:j?.className??null}),!B){P&&Pe.current?.setAttribute("readonly",""),Xe.current?.(!1);return}if(typeof window>"u"){Xe.current?.(!1);return}window.setTimeout(()=>{O()||K()||(P&&Pe.current?.setAttribute("readonly",""),Xe.current?.(!1))},xc)},onBeforeInput:L=>{if(ee.current)return;const B=L.nativeEvent;if(B instanceof InputEvent){if(B.inputType==="insertFromPaste"||B.inputType==="insertFromPasteAsQuotation"){const j=B.dataTransfer?.getData("text/plain")||B.data;if(j){L.preventDefault();const H=It(j,L.currentTarget);P&&ro.current?.(H)}return}if(B.inputType==="insertLineBreak"){if(Te.current){Te.current=!1,Ze.current!==null&&(clearTimeout(Ze.current),Ze.current=null),L.preventDefault();return}L.preventDefault(),Yt(L.currentTarget);return}if(B.inputType==="deleteContentBackward"||B.inputType==="deleteContentForward"||B.inputType==="deleteByCut"){if(!L.currentTarget.value){L.preventDefault(),ie.current("");return}if(B.inputType==="deleteContentBackward"&&L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),ie.current("");return}return}}},onInput:L=>{if(ee.current)return;const B=L.nativeEvent,j=OT(Ht.current,mc(L.currentTarget.value),B.inputType);if(j){const H=It(j,L.currentTarget);P&&ro.current?.(H);return}Lt(L.currentTarget)},onPaste:L=>{if(window.termdockDesktop?.readClipboardFiles){L.preventDefault(),Gr(L.currentTarget);return}const B=Array.from(L.clipboardData.files);if(B.length&&(B.length>1||!B[0].type.startsWith("image/"))){L.preventDefault(),yr(B,L.currentTarget);return}const j=B[0];if(j){L.preventDefault(),Hr(j,L.currentTarget);return}const H=L.clipboardData.getData("text/plain");if(!H){window.termdockDesktop&&(L.preventDefault(),Gr(L.currentTarget));return}L.preventDefault();const ke=It(H,L.currentTarget);P&&ro.current?.(ke)},onKeyDown:L=>{const B=GC(L);if(!B&&!ee.current){if(L.getModifierState("AltGraph"))return;const j=Ee.current,H=L.metaKey,ke=L.ctrlKey,we=L.altKey,Ye=L.shiftKey,Ke=L.key;if(H&&!ke&&!we&&!Ye&&Ke==="Enter"){L.preventDefault(),Yt(L.currentTarget);return}if((H||ke)&&!we&&!Ye&&(Ke==="v"||Ke==="V")){if(window.termdockDesktop?.readClipboardFiles||window.termdockDesktop?.readClipboardImage){L.preventDefault(),Gr(L.currentTarget);return}return}if(H&&!ke&&!we&&!Ye&&(Ke==="c"||Ke==="C")){L.preventDefault();const fr=j?.hasSelection()?j.getSelection():"";fr&&navigator.clipboard?.writeText(fr).catch(()=>{});return}if((H||ke)&&!we&&!Ye&&(Ke==="k"||Ke==="K")){L.preventDefault(),j&&(j.reset(),Ss(),Ln("clear",{skipResizePush:!0,skipScrollToBottom:!0})),L.currentTarget.value="",Ht.current="",$e.current=0;return}if(H&&!ke&&!we&&!Ye&&Ke==="Backspace"){L.preventDefault(),pt("",L.currentTarget);return}if(H&&!ke&&!we&&!Ye&&Ke==="Delete"){L.preventDefault(),pt("\v",L.currentTarget);return}if(H&&!ke&&!we&&!Ye&&Ke==="ArrowLeft"){L.preventDefault(),pt("",L.currentTarget);return}if(H&&!ke&&!we&&!Ye&&Ke==="ArrowRight"){L.preventDefault(),pt("",L.currentTarget);return}if(H)return;if(we&&!ke&&!H&&!Ye&&Ke==="Backspace"){L.preventDefault(),pt("\x1B",L.currentTarget);return}if(we&&!ke&&!H&&!Ye&&Ke==="Delete"){L.preventDefault(),pt("\x1Bd",L.currentTarget);return}if(we&&!ke&&!H&&!Ye&&Ke==="ArrowLeft"){L.preventDefault(),pt("\x1Bb",L.currentTarget);return}if(we&&!ke&&!H&&!Ye&&Ke==="ArrowRight"){L.preventDefault(),pt("\x1Bf",L.currentTarget);return}const Et=R9(L,j?.modes?.applicationCursorKeysMode===!0);if(Et!==null){L.preventDefault(),pt(Et,L.currentTarget);return}}if(L.key==="Enter"||L.key==="Go"||L.key==="done"||L.key==="send"){if(B||ee.current){L.preventDefault();return}if(Te.current){Te.current=!1,Ze.current!==null&&(clearTimeout(Ze.current),Ze.current=null),L.preventDefault();return}L.preventDefault(),Yt(L.currentTarget);return}if(L.key==="Backspace"){if(B||ee.current)return;if(!L.currentTarget.value){L.preventDefault(),ie.current("");return}if(L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),ie.current("");return}}},onCompositionStart:()=>{ee.current=!0,ur(),Ts({active:!0,text:""})},onCompositionUpdate:L=>{ee.current=!0;const B=L.data??L.currentTarget.value;Ts(j=>j.active&&j.text===B?j:{active:!0,text:B})},onCompositionEnd:L=>{ee.current=!1,Te.current=!0,Ze.current!==null&&clearTimeout(Ze.current),Ze.current=setTimeout(()=>{Te.current=!1,Ze.current=null},50),Ts({active:!1,text:""}),Lt(L.currentTarget),Wt()}}),Fn.active&&(()=>{const L=dn(Fn.text);return a.jsx("div",{"aria-hidden":"true","data-terminal-ime-composition":"true",style:{position:"fixed",left:Zn.x,top:Zn.y,zIndex:21,pointerEvents:"none",overflow:"hidden",boxSizing:"content-box",width:L.width,height:L.height,margin:0,padding:0,color:F.foreground,background:F.background,boxShadow:`-1px 0 0 1px ${F.background}`,fontSize:`${Ot}px`,fontFamily:Un,lineHeight:"1",textDecorationLine:"underline",textDecorationStyle:"solid",textDecorationColor:F.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
65
+ rounded-full bg-[var(--surface-elevated)] px-4 py-1.5 text-sm font-semibold text-foreground
66
+ shadow-lg transition-all duration-150 ease-out`,style:{opacity:en?1:0,transform:en?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:"Tab"}),a.jsx("div",{ref:as,"aria-hidden":!0,className:"absolute left-1/2 top-6 z-30 pointer-events-none transition-opacity duration-150 ease-out",style:{opacity:Cn.visible?1:0,transform:Cn.visible?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:Cn.visible&&(()=>{const{activeDir:L}=Cn,B=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 ${B("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 ${B("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 ${B("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 ${B("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"})})})]})})()})]})]})});cx.displayName="TerminalViewport";const i_=cx,o_=e=>{const t=e?.retry;return{maxRetries:t?.maxRetries??3,initialRetryDelay:t?.initialDelayMs??1e3,maxRetryDelay:t?.maxDelayMs??8e3,connectionTimeout:e?.connectionTimeoutMs??1e4}},a_=()=>({async createSession(e){return Ty(e)},connect(e,t,r){const s=Ay(e,t.onEvent,t.onError,{...o_(r),getDimensions:r?.getDimensions});return{close:()=>s()}},async sendInput(e,t){await s5(e,t)},async resize(e){await wy(e.sessionId,e.cols,e.rows,e.seq)},async close(e){await n5(e)},async restartSession(e,t){return vy(e,{cols:t.cols,rows:t.rows,mode:t.mode,tmuxSessionName:t.tmuxSessionName})},async forceKill(e){await yy(e)},async tmuxAction(e,t){return by(e,t)},async listTmuxSessions(){return Tf()},async getTmuxStatus(){return Af()},async checkHealth(e){return xy(e)}}),l_="\x1B",c_=/\x1b\[[IO]/g,u_=/\x1b\[<[0-9]+;[0-9]+;[0-9]+[mM]/y,d_=/\x1b\[[0-9]+;[0-9]+;[0-9]+M/y;function tg(e,t,r){return e.lastIndex=r,e.exec(t)?e.lastIndex:-1}function h_(e){const t=e.replace(c_,"");if(t.length===0)return e.length>0;let r=0;for(;r<t.length;){let s=tg(u_,t,r);if(s<0&&(s=tg(d_,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 f_(e){return e===l_}function Of(e,t){return e.label.trim().length>0?e.label:`Key ${t+1}`}const Nc=15;function p_(){return ux.map(e=>e.id)}const ux=[{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 Gc(){return ux.map(e=>({...e,programs:[...e.programs],includeAlt:e.includeAlt,rowLayout:[...e.rowLayout],actions:e.actions.map(t=>({...t})),showOnDesktop:e.showOnDesktop}))}function wp(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 dx(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.length>0?t:null}const Ap=/^\/(.+)\/([gimsuy]*)$/;function rg(e){return Ap.test(e.trim())}function md(e){const t=e.trim().match(Ap);if(!t)return null;try{return new RegExp(t[1]??"",t[2]??"")}catch{return null}}function hx(e){if(typeof e!="string")return null;const t=e.trim();return t?Ap.test(t)?md(t)?t:null:t.toLowerCase():null}function ng(e){return e.replace(/\\u([0-9a-fA-F]{4})/g,(t,r)=>String.fromCharCode(Number.parseInt(r,16))).replace(/\\r/g,"\r").replace(/\\n/g,`
67
+ `).replace(/\\t/g," ")}const sg="||",m_=120;function g_(e){return e.includes(sg)?e.split(sg).filter(t=>t.length>0):[e]}function L0(e){const t=new Set,r=e.map((o,c)=>{const u=typeof o.id=="string"&&o.id.trim().length>0?o.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):`preset-${c+1}`,f=t.has(u)?`${u}-${c+1}`:u;return t.add(f),{id:f,label:typeof o.label=="string"&&o.label.trim().length>0?o.label.trim():"Preset",programs:Array.isArray(o.programs)?o.programs.map(m=>hx(m)).filter(m=>!!m):[],includeAlt:typeof o.includeAlt=="boolean"?!!o.includeAlt:!1,rowLayout:wp(o.rowLayout),showOnDesktop:typeof o.showOnDesktop=="boolean"?!!o.showOnDesktop:!1,actions:Array.isArray(o.actions)?o.actions.map((m,g)=>{const b={id:typeof m.id=="string"&&m.id.trim().length>0?m.id:`${f}-action-${g+1}`,label:typeof m.label=="string"?m.label:`Key ${g+1}`,sequence:typeof m.sequence=="string"?m.sequence:""};return typeof m.doubleTapSequence=="string"&&(b.doubleTapSequence=m.doubleTapSequence),b}):[]}}).filter(o=>o.id!=="auto"),s=Gc()[0];return s&&!r.some(o=>o.id==="default")&&r.unshift(s),r}function x_(e,t){const r=dx(e);if(!r)return"default";for(const s of t)if(s.id!=="default")for(const o of s.programs){const c=md(o);if(c){if(c.test(r))return s.id}else if(r.includes(o))return s.id}return"default"}function ig(e,t){return e.find(r=>r.id===t)??e.find(r=>r.id==="default")??Gc()[0]}function b_(e){return[{id:"auto",label:"Auto"},...e.map(t=>({id:t.id,label:t.label}))]}function y_(e){return[{id:"auto",label:"Auto"},...e.filter(t=>t.showOnDesktop===!0).map(t=>({id:t.id,label:t.label}))]}function fx(e,t){const r=wp(t),s=[];let o=0,c=0;for(;o<e.length;){const u=r[Math.min(c,r.length-1)]??3;s.push({columns:u,items:e.slice(o,o+u)}),o+=u,c+=1}return s}const px=28,mx=({mode:e,presetLabel:t,title:r,ariaLabel:s,disabled:o,onPointerDown:c,buttonRef:u})=>a.jsx("button",{ref:u,type:"button",onPointerDown:c,tabIndex:-1,disabled:o,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(l9,{size:14}):(t.charAt(0)||"?").toUpperCase()}),v_={esc:"\x1B",enter:"\r",home:"\x1B[H",end:"\x1B[F","ctrl-c":"","ctrl-d":"","ctrl-w":"","ctrl-u":""},Pu=8;function w_(e,t){return v_[e]??null}const A_=({visible:e,interactive:t=!0,presentation:r="mobile",activeModifier:s,lockedModifier:o,disabled:c,defaultShowExtended:u=!1,presetLabel:f,presetModeLabel:m,presetMode:g,presetOptions:b,includeAlt:x,presetRowLayout:v,extraActions:w,onKeyPress:I,onTextPress:k,onPastePress:N,onFilePress:R,fileUploadState:Q="idle",fileUploadProgress:F=0,longPressMode:q="arrows",copyFeedback:P="idle",onLongPressModeToggle:Z,onModifierToggle:V,onPresetSelect:fe,onExpandedChange:_e})=>{const{t:De}=qr(),[be,st]=S.useState(u),[Ue,Ee]=S.useState(!1),ht=S.useRef(null),Ve=r==="desktop-actions",he=Ve||be,[Oe,ie]=S.useState(!1),[Le,Xe]=S.useState(null),re=c||!e||!t,ge=c||!e,Qt=S.useRef(null),Rt=S.useRef(null),We=S.useRef(null),W=S.useRef(null),Je=S.useRef(null),Se=S.useRef(P),me=S.useRef(null),ce=S.useRef(0),qe=S.useCallback($e=>{if(re)return;const Nt=$e.target;if(!(Nt instanceof Element))return;const lr=Nt.closest("button"),ye=lr?.hasAttribute("data-mobile-native-action")===!0;lr&&!ye?($e.preventDefault(),Jo(Pu)):lr&&Jo(Pu)},[re]),ue=S.useCallback($e=>{$e.preventDefault()},[]),Me=S.useCallback($e=>{const Nt=$e.target;re||Nt instanceof HTMLElement&&Nt.closest("button")&&Nt.blur()},[re]);S.useEffect(()=>{st(u)},[u]),S.useEffect(()=>{Ve||_e?.(be)},[Ve,_e,be]),S.useEffect(()=>{re&&(me.current!==null&&(window.clearTimeout(me.current.timer),me.current=null),ie(!1),Xe(null))},[re]),S.useEffect(()=>{e||(ie(!1),Xe(null))},[e]),S.useEffect(()=>{if(!Oe)return;const $e=()=>{const Nt=Qt.current?.getBoundingClientRect();Nt&&Xe({left:Math.max(8,Nt.left),top:Math.max(8,Nt.top-8)})};return $e(),window.addEventListener("resize",$e),window.addEventListener("scroll",$e,!0),()=>{window.removeEventListener("resize",$e),window.removeEventListener("scroll",$e,!0)}},[Oe]),S.useEffect(()=>{const $e=Se.current;if(Se.current=P,P==="idle"||P===$e)return;if(Je.current!==null&&window.clearTimeout(Je.current),!(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches))if(P==="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 lr=[{opacity:0,transform:"scale(0.65)"},{opacity:.75,transform:"scale(0.9)",offset:.18},{opacity:0,transform:"scale(1.65)"}];We.current?.animate?.(lr,{duration:760,easing:"ease-out"}),W.current?.animate?.(lr,{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"});Jo(Pu),P==="copied"&&(Je.current=window.setTimeout(()=>{Jo(Pu),Je.current=null},90),q==="copy"&&Z?.())},[P,q,Z]),S.useEffect(()=>()=>{Je.current!==null&&window.clearTimeout(Je.current)},[]);const et=S.useCallback(($e,Nt)=>{re||($e.preventDefault(),I(Nt))},[I,re]),bt=S.useCallback(($e,Nt)=>{re||($e.preventDefault(),V(Nt))},[V,re]),xe=S.useCallback($e=>{re||($e.preventDefault(),st(Nt=>{const lr=!Nt;return lr&&(Ee(!0),ht.current!==null&&window.clearTimeout(ht.current),ht.current=window.setTimeout(()=>{Ee(!1),ht.current=null},350)),lr}))},[re]),de=S.useCallback(()=>{const $e=typeof performance<"u"?performance.now():Date.now();$e-ce.current<350||(ce.current=$e,N?.())},[N]),Ie=S.useCallback($e=>{re||($e.stopPropagation(),$e.pointerType!=="touch"&&($e.preventDefault(),de()))},[re,de]),Qe=S.useCallback($e=>{re||($e.preventDefault(),$e.stopPropagation(),de())},[re,de]),Pe=S.useCallback($e=>{re||Q==="uploading"||!R||($e.preventDefault(),$e.stopPropagation(),R())},[Q,R,re]),ft=S.useCallback($e=>{re||$e.stopPropagation()},[re]),Mt=250,Be=S.useCallback(()=>{me.current!==null&&(window.clearTimeout(me.current.timer),me.current=null)},[]);S.useEffect(()=>()=>{Be(),ht.current!==null&&(window.clearTimeout(ht.current),ht.current=null)},[Be]);const gr=S.useCallback(($e,Nt)=>{if(re)return;if($e.preventDefault(),!Nt.doubleTapSequence){k(Nt.sequence);return}const lr=me.current;if(lr!==null&&lr.actionId===Nt.id){window.clearTimeout(lr.timer),me.current=null,k(Nt.doubleTapSequence);return}Be();const ye=window.setTimeout(()=>{me.current=null,k(Nt.sequence)},Mt);me.current={actionId:Nt.id,timer:ye}},[Be,k,re]),ct=S.useCallback($e=>{re||($e.preventDefault(),$e.stopPropagation(),Z?.())},[Z,re]),gt=S.useCallback($e=>{re||$e.stopPropagation()},[re]),vt=S.useCallback($e=>{if(re)return;$e.preventDefault();const Nt=$e.currentTarget.getBoundingClientRect();Xe({left:Math.max(8,Nt.left),top:Math.max(8,Nt.top-8)}),ie(lr=>!lr)},[re]),_t=S.useCallback(($e,Nt)=>{re||($e.preventDefault(),ie(!1),Xe(null),fe(Nt))},[fe,re]),qt=w.length>0,ee=S.useMemo(()=>{const $e=[{id:"preset",kind:"preset"}];if(!Ve&&x&&$e.push({id:"alt",kind:"alt"}),qt){const Nt=w.map(lr=>({id:lr.id,kind:"text",action:lr}));return $e.concat(Nt)}return Ve?$e:$e.concat([{id:"home",kind:"key",keyName:"home"},{id:"end",kind:"key",keyName:"end"},{id:"ctrl-d",kind:"key",keyName:"ctrl-d"}])},[w,qt,x,Ve]),Te=S.useMemo(()=>fx(ee,v),[ee,v]),Ze=`${Ve?"space-y-1":"mt-1 space-y-1"}${Ue?" pointer-events-none":""}`,Ht=Oe&&Le?qa.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:Le.left,top:Le.top},children:a.jsx("div",{className:"grid gap-1",children:b.map($e=>a.jsx("button",{type:"button",onPointerDown:Nt=>_t(Nt,$e.id),tabIndex:-1,disabled:ge,className:`h-7 rounded-full px-3 text-left text-xs font-medium transition-colors disabled:opacity-50 ${$e.id===g?"bg-primary text-primary-foreground":"bg-surface-2 hover:bg-surface-elevated text-muted-foreground hover:text-foreground"}`,children:$e.label},$e.id))})}),document.body):null;return a.jsxs(a.Fragment,{children:[Ht,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?Ve?"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:qe,onPointerDownCapture:qe,onContextMenuCapture:ue,onFocusCapture:Me,children:a.jsxs("div",{className:"rounded-2xl bg-surface-elevated p-0.5 space-y-0.5",children:[!Ve&&a.jsxs("div",{"data-mobile-keyboard-primary-row":"true",className:"grid grid-cols-10 gap-1",children:[a.jsx("button",{type:"button",onPointerDown:$e=>et($e,"esc"),tabIndex:-1,disabled:ge,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:$e=>bt($e,"ctrl"),tabIndex:-1,disabled:ge,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"} ${o==="ctrl"?"ring-2 ring-accent":""}`,children:a.jsx("span",{className:"font-medium",children:o==="ctrl"?"Ctrl*":"Ctrl"})}),a.jsx("button",{type:"button",onPointerDown:$e=>et($e,"ctrl-c"),tabIndex:-1,disabled:ge,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:$e=>et($e,"ctrl-u"),tabIndex:-1,disabled:ge,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:ft,onTouchStart:ft,onClick:Pe,tabIndex:-1,disabled:ge||!R||Q==="uploading",title:Q==="uploading"?`${De("rightSidebar.uploading")} ${Math.round(F)}%`:De(Q==="inserted"?"rightSidebar.inserted":Q==="failed"?"rightSidebar.uploadFailed":"rightSidebar.insertLocalFile"),"aria-label":De("rightSidebar.insertLocalFile"),className:`relative h-7 w-full overflow-hidden rounded-full shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center ${Q==="inserted"?"bg-primary/15 text-primary":Q==="failed"?"bg-destructive/15 text-destructive":"bg-surface-2"}`,children:[Q==="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,F))}%`}}),a.jsx("span",{className:"relative z-10 flex items-center justify-center",children:Q==="uploading"?a.jsx(mn,{size:15,className:"animate-spin"}):Q==="inserted"?a.jsx(na,{size:15}):Q==="failed"?a.jsx(ys,{size:15}):a.jsx(a8,{size:15})}),Q!=="idle"&&a.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:Q==="uploading"?`${De("rightSidebar.uploading")} ${Math.round(F)}%`:De(Q==="inserted"?"rightSidebar.inserted":"rightSidebar.uploadFailed")})]}),a.jsx("button",{type:"button",onPointerDown:()=>k("/"),tabIndex:-1,disabled:ge,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:$e=>et($e,"enter"),tabIndex:-1,disabled:ge,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(t8,{size:16})}),a.jsxs("button",{ref:Rt,type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:gt,onTouchStart:gt,onClick:ct,tabIndex:-1,disabled:ge,title:De(P==="copied"?"terminal.copied":P==="failed"?"terminal.copyFailed":q==="copy"?"terminal.longPressSelectsText":"terminal.longPressSendsArrows"),"aria-label":De(q==="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 ${P==="copied"?"bg-primary/15 text-primary":P==="failed"?"bg-destructive/15 text-destructive":q==="copy"?"bg-primary/15 text-primary":"bg-surface-2"}`,children:[a.jsx("span",{ref:We,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/70 opacity-0"}),a.jsx("span",{ref:W,"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(na,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${P==="copied"?"scale-100 rotate-0 opacity-100":"scale-50 -rotate-45 opacity-0"}`}),a.jsx(ys,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-200 ease-out motion-reduce:transition-none ${P==="failed"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),a.jsx(b5,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${P==="idle"&&q==="copy"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),a.jsx(k8,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${P==="idle"&&q==="arrows"?"scale-100 rotate-0 opacity-100":"scale-50 rotate-45 opacity-0"}`})]}),P!=="idle"&&a.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:P==="copied"?`${De("terminal.copied")} · ${De("terminal.longPressSendsArrows")}`:`${De("terminal.copyFailed")} · ${De("terminal.longPressSelectsText")}`})]}),a.jsx("button",{type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:Ie,onPointerUp:ft,onTouchStart:ft,onTouchEnd:ft,onClick:Qe,tabIndex:-1,disabled:ge,title:De("terminal.paste"),"aria-label":De("terminal.paste"),className:"h-7 w-full rounded-full bg-surface-2 shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",children:a.jsx(Wv,{size:15})}),a.jsx("button",{type:"button",onPointerDown:xe,tabIndex:-1,disabled:ge,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(Cy,{size:16}):a.jsx(bl,{size:16})})]}),he&&a.jsx("div",{className:Ze,children:Te.map(($e,Nt)=>{const lr=$e.items[0]?.kind==="preset",ye=Math.max(2,$e.columns),Bn=lr?`${px}px repeat(${Math.max(1,ye-1)}, minmax(0, 1fr))`:`repeat(${ye}, minmax(0, 1fr))`;return a.jsx("div",{className:"relative grid gap-1",style:{gridTemplateColumns:Bn},children:$e.items.map(Lr=>Lr.kind==="preset"?a.jsx(mx,{buttonRef:Lr.id==="preset"?Qt:void 0,mode:g,presetLabel:f,title:m,disabled:ge,onPointerDown:vt},Lr.id):Lr.kind==="alt"?a.jsx("button",{type:"button",onPointerDown:ve=>bt(ve,"alt"),tabIndex:-1,disabled:ge,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"} ${o==="alt"?"ring-2 ring-accent":""}`,children:a.jsx("span",{className:"font-medium",children:o==="alt"?"Alt*":"Alt"})},Lr.id):Lr.kind==="text"?a.jsxs("button",{type:"button",onPointerDown:ve=>gr(ve,Lr.action),tabIndex:-1,disabled:ge,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:[Lr.action.label,Lr.action.doubleTapSequence&&a.jsx("span",{className:"absolute top-0.5 right-1.5 h-1 w-1 rounded-full bg-accent/60"})]},Lr.id):a.jsx("button",{type:"button",onPointerDown:ve=>et(ve,Lr.keyName),tabIndex:-1,disabled:ge,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:Lr.keyName==="ctrl-d"?"Ctrl-D":Lr.keyName==="home"?"Home":"End"},Lr.id))},`row-${Nt}`)})})]})})]})},T_=({isMobile:e,isInputFocused:t,isIOS:r,isConnecting:s,connectionError:o,terminalSessionId:c})=>{if(typeof window>"u")return null;const u=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~: ",u,"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:c?"text-accent":"text-destructive",children:c?"✓":"✗"})]}),a.jsxs("div",{children:["error:"," ",a.jsx("span",{className:o?"text-destructive":"text-accent",children:o?"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"})})]})},C_=/^Reconnecting/i,__=({connectionError:e,isFatalError:t,isRestarting:r,isConnecting:s,onHardRestart:o})=>{const{t:c}=qr(),u=!!e&&C_.test(e),f=!!(s&&!e||u),[m,g]=S.useState(!1);return S.useEffect(()=>{if(!f){g(!1);return}const b=setTimeout(()=>g(!0),1500);return()=>clearTimeout(b)},[f]),f?m?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:c("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:o,disabled:r,className:"text-[11px] text-destructive/90 hover:text-destructive underline underline-offset-2 transition-colors disabled:opacity-40",children:c("common.retry")})]})}):null};let Dc=[],Gh=!1;function uo(e,t,r={}){typeof window>"u"||(Dc.push(JSON.stringify({level:e,message:t,data:{ts:Date.now(),...r}})),S_())}async function S_(){if(!Gh){Gh=!0;try{for(;Dc.length>0;){const e=Dc[0];try{await fetch("/api/client-log",{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0}),Dc.shift()}catch{Dc=[];break}}}finally{Gh=!1}}}const L_=120,I_=80,k_=400;function og(){if(typeof window>"u"||document.visibilityState!=="visible"||!_y())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=Ca().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,o=t.height+t.offsetTop;return Math.max(0,Math.round(r-o-s))}function gx(e){const{enabled:t,openThresholdPx:r=L_,closeThresholdPx:s=I_,settleDelayMs:o=k_}=e,c=S.useMemo(()=>M0("keyboard"),[]),u=S.useRef(!1),f=S.useRef(null),m=S.useRef(0),[g,b]=S.useState({isOpen:!1,isSettled:!1,keyboardHeight:0});return S.useEffect(()=>{if(typeof window>"u"||!t){u.current=!1,f.current!==null&&(clearTimeout(f.current),f.current=null),b(Z=>!Z.isOpen&&!Z.isSettled&&Z.keyboardHeight===0?Z:{isOpen:!1,isSettled:!1,keyboardHeight:0});return}let x=null;const v=()=>{x=null;const Z=og();let V=u.current;if(Z>=r?V=!0:Z<=s&&(V=!1),u.current=V,V){const fe=Math.abs(Z-m.current);m.current=Z,fe>10&&(f.current!==null&&clearTimeout(f.current),f.current=setTimeout(()=>{f.current=null,b(_e=>_e.isSettled?_e:{..._e,isSettled:!0})},o))}else f.current!==null&&(clearTimeout(f.current),f.current=null);b(fe=>{const _e=V?fe.isSettled:!1;return fe.isOpen===V&&fe.keyboardHeight===Z&&fe.isSettled===_e?fe:(c("sync",{keyboardHeight:Z,isOpen:V,isSettled:_e,visualViewport:Ca().visualViewport?{width:Math.round(Ca().visualViewport.width),height:Math.round(Ca().visualViewport.height),offsetTop:Math.round(Ca().visualViewport.offsetTop)}:null}),{isOpen:V,isSettled:_e,keyboardHeight:Z})})},w=(Z="event")=>{(Z.includes("visibilitychange")||Z.includes("pageshow"))&&c("schedule",{source:Z}),x===null&&(x=window.requestAnimationFrame(v))};w("mount");const I=()=>w("resize"),k=()=>w("orientationchange"),N=()=>w("visualViewport.resize"),R=()=>w("visualViewport.scroll"),Q=()=>w("viewport-keyboard-change");window.addEventListener("resize",I),window.addEventListener("orientationchange",k),Ca().visualViewport?.addEventListener("resize",N),Ca().visualViewport?.addEventListener("scroll",R),document.addEventListener("termdock:viewport-keyboard-change",Q);const F=Z=>{c("resume",{source:Z,keyboardHeight:og(),hidden:document.hidden}),w(`${Z}:now`),window.setTimeout(()=>w(`${Z}:50ms`),50),window.setTimeout(()=>w(`${Z}:200ms`),200)},q=()=>{document.hidden||F("visibilitychange")},P=()=>F("pageshow");return document.addEventListener("visibilitychange",q),window.addEventListener("pageshow",P),()=>{window.removeEventListener("resize",I),window.removeEventListener("orientationchange",k),Ca().visualViewport?.removeEventListener("resize",N),Ca().visualViewport?.removeEventListener("scroll",R),document.removeEventListener("termdock:viewport-keyboard-change",Q),document.removeEventListener("visibilitychange",q),window.removeEventListener("pageshow",P),x!==null&&window.cancelAnimationFrame(x),f.current!==null&&(clearTimeout(f.current),f.current=null)}},[c,t,r,s,o]),g}const sd=300,E_=120,M_=2e3,R_=250,N_=6e4;function D_(e){const t=new Set(e.slides.flat()),r=new Set([...e.visibleSessionIds].filter(u=>t.has(u)));e.foregroundSessionId&&t.has(e.foregroundSessionId)&&r.add(e.foregroundSessionId);const s=e.slides.findIndex(u=>u.some(f=>r.has(f)));if(s<0)return r;const o=e.slides[s-1]??[],c=e.slides[s+1]??[];for(let u=0;u<Math.max(o.length,c.length)&&r.size<3;u+=1)for(const f of[o[u],c[u]])f&&r.size<3&&r.add(f);return r}function Wh(e,t){return t?e.find(r=>r.id===t||r.backendSessionId===t)?.id??null:null}function Ou(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 B_(e){return e.sessionId===e.foregroundSessionId||e.visibleSessionIds.has(e.sessionId)||e.deferredViewportSessionIds.has(e.sessionId)}function j_(e){return e.isMobile&&(!e.viewportReady||!e.streamReady||!e.contentReady)}function P_(e){return e.writtenChunkId!==null&&e.initialTargetChunkId!==null&&e.writtenChunkId>=e.initialTargetChunkId}function O_(e){return!e.initialConnectionPending}function F_(e){return!e}function U_(e){return e.requestToken===0||e.isVisible===!0||e.foregroundSessionId===null||e.isVisible===void 0&&e.sessionId===e.foregroundSessionId||e.foregroundCompletedToken===e.requestToken}function $_(e,t){return[...e].every(r=>t.has(r))}function z_(e,t){return e===null||t-e>=R_}function H_(e){return!1}function G_(e){return!e.isActive||e.isStreamReady||e.reconnectStartedAt===null?null:Math.max(0,N_-(e.now-e.reconnectStartedAt))}function W_(e,t){const r=new Map;let s=0;for(const o of e)if(!r.has(o)){if(t.has(o)){r.set(o,0);continue}r.set(o,sd+s*E_),s+=1}return r}const V_="Session not found on server",Vh="Terminal session not found",q_="STALE_SESSION_RESTORE_REJECTED";function Z_(e){return e?.message===V_}function ag(e){return e?.code===q_}function Y_(e,t){if(!e||e.startsWith("/"))return e;const r=e.replace(/^\.\//,"");return t?`${t.replace(/\/+$/,"")}/${r}`:r}function xx(e,t){return Y_(e,t).replace(/ /g,"\\ ")}function K_(e,t){return`${xx(e,t)} `}function lg(e,t){return xx(e,t)}function rB(e,t,r){if(!r)return lg(e,t);const s=r.start===r.end?`${r.start}`:`${r.start}-${r.end}`;return`${lg(e,t)}:${s}`}const X_="/tmp";async function bx(e,t,r){const o=(await t(X_,[e])).files[0];if(!o?.path)throw new Error("Upload did not return a file path");return r(o.path),o}const nB=bx,J_=320,cg="termdock:mobile-keyboard-expanded",ug="termdock:mobile-keyboard-preset-mode",dg="termdock:mobile-long-press-mode",eS=80;function qh(){return typeof window>"u"?!1:(navigator.maxTouchPoints>0||"ontouchstart"in window)&&window.innerWidth<768}const tS={retry:{maxRetries:60,initialDelayMs:1e3,maxDelayMs:2e4},connectionTimeoutMs:15e3},rS=({sessionId:e,mode:t,tmuxSessionName:r=null,terminalSettings:s=vp(),colorTheme:o="dark",toolbarPresets:c=[],isActive:u=!0,focusSuspended:f=!1,deferCursorUntilPositioned:m=!1,isLayoutVisible:g=!0,focusRequestToken:b=0,resumeRequestToken:x=0,resumeRequestReason:v="visibility",resumeRequestDelayMs:w=0,forceResumeReconnect:I=!1,initialConnectDelayMs:k=0,initialConnectEnabled:N=!0,resumeRequestEnabled:R=!0,onStreamReadyChange:Q,onStreamConnected:F,onViewportReadyChange:q,onContentReadyChange:P,onKeyboardVisibilityChange:Z,suppressKeyboard:V=!1,keyboardPortalTarget:fe=null,sharedMobileKeyboardLayout:_e=!1,suppressPageFlipRefresh:De=!1,showDebug:be,onStatusChange:st})=>{const{t:Ue}=qr(),[Ee,ht]=S.useState(s.fontSize),Ve=S.useMemo(()=>a_(),[]),he=S.useMemo(()=>M0("session"),[]),Oe=S.useMemo(()=>M0("keyboard"),[]),ie=S.useRef(null),Le=S.useRef(null);S.useEffect(()=>{ht(s.fontSize)},[s.fontSize]);const Xe=S.useMemo(()=>({...s,fontSize:Ee}),[s,Ee]),[re]=S.useState(e||C9()),[ge,Qt]=S.useState(qh),[Rt,We]=S.useState(!1),[W,Je]=S.useState(!1),[Se,me]=S.useState(!1),[ce,qe]=S.useState(()=>typeof document>"u"?!0:!document.hidden&&Ec()),[ue,Me]=S.useState(()=>typeof document>"u"?!0:document.hasFocus()),[et,bt]=S.useState(!1),[xe,de]=S.useState(!1),[Ie,Qe]=S.useState(!1),[Pe,ft]=S.useState(!1),[Mt,Be]=S.useState(!0),{isOpen:gr,keyboardHeight:ct}=gx({enabled:ge&&u}),[gt,vt]=S.useState(null),[_t,qt]=S.useState(null),[ee,Te]=S.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(cg)==="true"),[Ze,Ht]=S.useState(()=>{if(typeof window>"u")return"auto";const J=window.localStorage.getItem(ug);return J&&J.length>0?J:"auto"}),[$e,Nt]=S.useState(()=>typeof window>"u"?"arrows":window.localStorage.getItem(dg)==="copy"?"copy":"arrows"),[lr,ye]=S.useState("idle"),[Bn,Lr]=S.useState("idle"),[ve,$r]=S.useState(0),kt=Ur(J=>J.sessions.get(re)),{setTerminalSession:un,setConnecting:Ir,appendToBuffer:kn,replaceBuffer:se,clearTerminalSession:rt,removeTerminalSession:Bt,clearBuffer:wr,setSessionActiveProgram:jt,setSessionCwd:ne,setSessionCopyMode:Pt,setSessionAgentStatus:mt,setSessionShellTitle:Br,setSessionPromptState:or,clearAgentNeedsReview:ws}=Ur.getState(),ts=S.useMemo(()=>`wt-${re.replace(/[^a-zA-Z0-9_-]/g,"").slice(0,12)}`,[re]),gn=kt?.terminalSessionId??null,Tr=kt?.mode??"shell",en=kt?.activeProgram??null,qn=S.useMemo(()=>L0(c),[c]),Cn=Tr==="tmux",As=kt?.bufferChunks??[],rs=kt?.isConnecting??!1,tn=gn,jn=S.useCallback(async(J,je)=>{const ot=kC(J,kt?.cwd||kt?.directory);if(!ot)return;let At=ot,Ae="directory";try{At=(await lp(ot)).path}catch(xt){if(!(xt instanceof Error)||xt.message!=="Path is not a directory")return;Ae="file"}try{const xt=Ft.getState();xt.setRightTab("files"),xt.openRight(),window.dispatchEvent(new CustomEvent(TC,{detail:{path:At,kind:Ae,line:je}}))}catch{}},[kt?.cwd,kt?.directory]),Vr=t??kt?.mode??"shell",Rr=Vr==="tmux"?r??kt?.tmuxSessionName??null:null,[Pn,sn]=S.useState(null),Zn=S.useRef(!1),[zt,On]=S.useState(!1),[zr,Fn]=S.useState(!1),[Ts,as]=S.useState(null),[_n,Cr]=S.useState(0),[jr,Yn]=S.useState(null),xn=be!==void 0?be:!1,ds=S.useRef(null),li=S.useRef(null),_r=S.useRef(null),Un=S.useRef(null),Ot=S.useRef(null),qs=S.useRef(!1),rn=S.useRef(null),Kn=S.useRef([]),Kr=S.useRef(0),Xn=S.useRef(!1),bn=S.useRef(null),xr=S.useRef(null),$=S.useRef(-1),le=S.useRef(null),Ge=S.useRef(0),Ce=S.useRef(null),He=S.useRef(null),tt=S.useRef(0),nt=S.useRef(!1),it=S.useRef(null),Fe=S.useRef(null),at=S.useRef(!1),Kt=S.useRef(0),lt=S.useRef(!1),br=S.useRef(!1),ut=S.useRef(!1),hr=S.useRef(null),ar=S.useRef(null),St=S.useRef(null),sr=S.useRef(u);sr.current=u;const kr=S.useRef(f);kr.current=f;const yn=S.useRef(ge),Zs=S.useRef(null),ls=S.useRef(null),Fs=S.useRef(null),Er=S.useRef(null),Xr=S.useRef(null),hs=S.useRef(null),O=S.useRef(null),K=S.useCallback(()=>{const J=++Kt.current,je=()=>{J===Kt.current&&de(!0)};if(typeof window>"u"){je();return}window.requestAnimationFrame(()=>window.requestAnimationFrame(je))},[]),oe=S.useCallback(J=>{if(lt.current){if(ar.current!==null&&(window.clearTimeout(ar.current),ar.current=null),J.x===0&&J.y>=J.rows-1){Be(!1);return}ar.current=window.setTimeout(()=>{ar.current=null,Be(!0)},eS)}},[]),Ne=S.useRef(null);S.useEffect(()=>()=>{Ne.current?.()},[]);const Tt=S.useCallback(()=>{Ne.current||(Ne.current=dp(()=>{Ne.current=null;const J=Ur.getState(),je=_r.current,ot=J.getTerminalSession(re);if(!je||ot?.mode!=="shell"||J.hasPendingBufferWrites(re))return;const At=Sy(je),Ae=Ot.current?.getDimensions();if(!At||!Ae)return;const xt=Ot.current?.serializeSnapshot();xt&&Ly({id:je,version:1,...At,...Ae,data:xt,savedAt:Date.now()})},2e3))},[re]),Lt=S.useCallback(J=>{const je=Ur.getState(),ot=je.getTerminalSession(re)?.bufferChunks.at(-1)?.id;if(_r.current&&ot!==void 0&&ot<=J&&!je.hasPendingBufferWrites(re)&&(Iy(_r.current),Tt()),!nt.current||!P_({writtenChunkId:J,initialTargetChunkId:it.current}))return;const At=Fe.current;Fe.current=null,At!==null&&Ot.current?.notifyScreenSynchronized(At),nt.current=!1,it.current=null,K()},[K,Tt,re]),Yt=S.useCallback(J=>{if(!lt.current)return;const je=hr.current;je&&je.x===J.x&&je.y===J.y&&je.rows===J.rows||(hr.current=J,ar.current!==null&&(window.clearTimeout(ar.current),ar.current=null),J.x===0&&J.y>=J.rows-1&&Be(!1))},[]);S.useEffect(()=>{if(!m){br.current=!1;return}br.current||(br.current=!0,ut.current=!1,lt.current=!0,hr.current=null,Be(!1),ar.current!==null&&(window.clearTimeout(ar.current),ar.current=null),St.current!==null&&window.clearTimeout(St.current),St.current=window.setTimeout(()=>{St.current=null,ar.current!==null&&typeof window<"u"&&window.clearTimeout(ar.current),ar.current=null,lt.current=!1,Be(!0)},15e3))},[m]);const pt=S.useCallback(()=>{Er.current=null;const J=Fs.current;Fs.current=null,J&&Br(J.sessionId,J.title)},[Br]),It=S.useCallback((J,je)=>{if(Fs.current={sessionId:J,title:je},Er.current===null){if(typeof window>"u"){pt();return}Er.current=window.requestAnimationFrame(pt)}},[pt]),Hr=S.useCallback(()=>{Er.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(Er.current),Er.current=null,Fs.current=null},[]),yr=S.useCallback(async()=>{const J=Vr;return(await ky({preferredFrontendSessionId:re,mode:J,tmuxSessionName:J==="tmux"?Rr||ts:void 0,termType:"xterm-256color",requireExisting:!0})).terminalSession},[Vr,Rr,ts,re]),Gr=S.useRef(u);S.useEffect(()=>{if(!u){Ot.current?.blur(),Gr.current=!1;return}if(Gr.current)return;Gr.current=!0;const J=GT(ge,De);if(J==="single"){Ot.current?.requestRefresh("focus",{skipResizePush:!0,skipScrollToBottom:!0});return}J!=="none"&&Ot.current?.requestRefresh("page-flip",{reconcileServerSize:!0,skipScrollToBottom:!0})},[u,ge,De,tn]),S.useEffect(()=>{yn.current=ge},[ge]);const Wr=S.useCallback(()=>{!sr.current||kr.current||Ot.current?.focus()},[]);S.useLayoutEffect(()=>{f&&Ot.current?.blur()},[f]),S.useEffect(()=>{if(!u||f||Mt||ut.current)return;ut.current=!0;const J=window.requestAnimationFrame(()=>{Ot.current?.requestPtyRedraw()});return()=>window.cancelAnimationFrame(J)},[f,u,Mt]);const on=S.useCallback(J=>{typeof window>"u"||typeof document>"u"||!sr.current||kr.current||yn.current||document.hidden||!Ec()||(Zs.current!==null&&window.clearTimeout(Zs.current),Zs.current=window.setTimeout(()=>{if(Zs.current=null,!sr.current||kr.current||yn.current||document.hidden||!Ec())return;const je=document.activeElement,ot=je?.getAttribute("data-terminal-input-anchor")==="true";if((je instanceof HTMLInputElement||je instanceof HTMLTextAreaElement||je instanceof HTMLSelectElement||je?.isContentEditable===!0)&&!ot){Oe("desktop resume focus skipped: editable active",{reason:J});return}Oe("desktop resume focus",{reason:J}),Ot.current?.requestRefresh("focus",{force:!0,forceRedraw:!0,skipResizePush:!0,skipScrollToBottom:!0}),Ot.current?.focus()},50))},[Oe]);S.useEffect(()=>()=>{Zs.current!==null&&typeof window<"u"&&window.clearTimeout(Zs.current),Zs.current=null,ls.current!==null&&typeof window<"u"&&window.clearTimeout(ls.current),ls.current=null,Xr.current!==null&&typeof window<"u"&&window.clearTimeout(Xr.current),Xr.current=null,hs.current!==null&&typeof window<"u"&&window.clearTimeout(hs.current),hs.current=null,St.current!==null&&typeof window<"u"&&window.clearTimeout(St.current),St.current=null,ar.current!==null&&typeof window<"u"&&window.clearTimeout(ar.current),ar.current=null},[]),S.useEffect(()=>{if(typeof document>"u"||typeof window>"u")return;const J=()=>{ls.current!==null&&window.clearTimeout(ls.current),ls.current=window.setTimeout(()=>{ls.current=null;const je=document.activeElement,At=!(je?.getAttribute("data-terminal-input-anchor")==="true")&&!!(je&&(je instanceof HTMLInputElement||je instanceof HTMLTextAreaElement||je instanceof HTMLSelectElement||je.isContentEditable));f9({isActive:sr.current&&!kr.current,isMobile:yn.current,documentVisible:!document.hidden,activeElementIsEditable:At})&&Wr()},0)};return document.addEventListener("pointerup",J),()=>{document.removeEventListener("pointerup",J),ls.current!==null&&(window.clearTimeout(ls.current),ls.current=null)}},[Wr]);const Sn=S.useCallback(()=>{Or.current=!1,Cr(J=>J+1)},[]),dn=S.useCallback((J,je,ot)=>{const At=_r.current,Ae=Date.now();if(At&&je&&Ey(At)){Le.current={startedAt:Ae,strategy:"reconnect",reason:J},uo("info","PWA_RESUME terminal-start",{frontendSessionId:re,backendSessionId:At,strategy:"reconnect",reason:J,active:sr.current});return}if(At&&My(At,()=>{const xt=Le.current;uo("info","PWA_RESUME terminal-responsive",{frontendSessionId:re,backendSessionId:At,durationMs:xt?Date.now()-xt.startedAt:null,strategy:xt?.strategy??"probe",reason:xt?.reason??J}),Le.current=null,F?.(re)},{visible:ot})){Le.current={startedAt:Ae,strategy:"probe",reason:J},uo("info","PWA_RESUME terminal-start",{frontendSessionId:re,backendSessionId:At,strategy:"probe",reason:J,active:sr.current}),he("[Terminal] resume probe sent",{reason:J,backendSessionId:At,active:sr.current});return}if(he("[Terminal] resume probe missing connection, restarting ensureSession",{reason:J,backendSessionId:At,active:sr.current}),!O_({initialConnectionPending:at.current})){he("[Terminal] resume probe deferred during initial websocket handshake",{reason:J,backendSessionId:At});return}Sn()},[he,F,Sn,re]),ur=S.useCallback((J,je)=>{const ot=_r.current;ot&&rn.current!==J&&(rn.current=J,_1(ot,J,je),he("[Terminal] flow-control state sent",{backendSessionId:ot,paused:J,reason:je}))},[he]),Wt=S.useCallback((J,je)=>{const ot=_r.current;ot&&Ce.current!==J&&(Ce.current=J,S1(ot,J,je),he("[Terminal] focus state sent",{backendSessionId:ot,focused:J,reason:je}))},[he]),vr=S.useCallback((J,je)=>{const ot=_r.current;ot&&He.current!==J&&(He.current=J,L1(ot,J,je),he("[Terminal] viewing state sent",{backendSessionId:ot,viewing:J,reason:je}))},[he]),Xt=d9({isActive:u&&!f,viewportFocused:Se,documentVisible:ce,windowFocused:ue,streamReady:et}),Ut=h9({isActive:u,documentVisible:ce,windowFocused:ue,streamReady:et,isDesktop:ea()!==null}),Mr=S.useRef(Xt),Pr=S.useRef(Ut);S.useEffect(()=>{Mr.current=Xt,Wt(Xt,"logical-focus-change")},[Xt,Wt,tn]),S.useEffect(()=>{Pr.current=Ut,vr(Ut,"logical-viewing-change")},[Ut,vr,tn]),b9(tn,ce,et),S.useEffect(()=>{const J=je=>{const At=je.detail;typeof At=="number"&&At>=8&&At<=32&&ht(At)};return document.addEventListener("termfontchange",J),()=>document.removeEventListener("termfontchange",J)},[]),S.useEffect(()=>{const J=()=>{const Ae=!document.hidden&&Ec();qe(Ae),Ae&&u&&on("visibility")},je=Ae=>{u&&on(Ae.persisted?"bfcache":"pageshow")},ot=()=>{Me(!0),on("window-focus")},At=()=>Me(!1);return document.addEventListener("visibilitychange",J),window.addEventListener(I1,J),window.addEventListener("pageshow",je),window.addEventListener("focus",ot),window.addEventListener("blur",At),()=>{document.removeEventListener("visibilitychange",J),window.removeEventListener(I1,J),window.removeEventListener("pageshow",je),window.removeEventListener("focus",ot),window.removeEventListener("blur",At)}},[u,on]),S.useEffect(()=>{if(!x||!R||!Gi.current)return;const J=w,je=J<=0,ot=ie.current;if(ot?.token===x&&(ot.visible||!je))return;const At=()=>{ie.current={token:x,visible:je},Ot.current?.requestRefresh(v,{skipScrollToBottom:!0}),dn(J>0?"global-resume-background":"global-resume-visible",J<=0&&I,je)};if(J<=0){At();return}const Ae=window.setTimeout(At,J);return()=>window.clearTimeout(Ae)},[x,v,R,w,I,dn]);const ns=S.useRef(0);S.useEffect(()=>{if(et){ns.current=0;return}if(!zt||Pn==="Authentication required"||Pn===Vh)return;const J=ns.current,je=Math.min(2e3*Math.pow(2,Math.min(J,4)),3e4),ot=setTimeout(()=>{ns.current+=1,he("[Terminal] fatal self-heal: auto restarting ensureSession",{attempt:ns.current,backendSessionId:_r.current}),sn("Reconnecting..."),On(!1),Sn()},je);return()=>clearTimeout(ot)},[Pn,zt,et,_n,he,Sn]),S.useEffect(()=>{if(typeof window>"u"){We(!1);return}const J=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;We(J)},[]),S.useEffect(()=>{(!u||!ge)&&Je(!1),u||me(!1)},[u,ge]),S.useEffect(()=>{_r.current=tn,$.current=-1,Fe.current=null,Ce.current=null,He.current=null,rn.current=null},[tn]),S.useEffect(()=>{Q?.(re,et)},[et,Q,re]),S.useEffect(()=>{P?.(re,et&&xe&&Ie)},[xe,Ie,et,P,re]),S.useEffect(()=>{Cn||(Xn.current=!1,bn.current=null,xr.current&&(clearTimeout(xr.current),xr.current=null))},[Cn]),S.useEffect(()=>{tn&&Ot.current?.requestRefresh("session-key-change",{force:!0})},[tn]),S.useEffect(()=>{const J=u&&ge&&gr;Oe("visibility signal",{sessionId:re,isActive:u,isMobile:ge,isInputFocused:W,isViewportKeyboardOpen:gr,viewportKeyboardHeight:ct,visible:J}),Z?.(re,J)},[Z,re,u,ge,gr,ct,Oe]),S.useEffect(()=>{u&&b&&b!==Ge.current&&(Ge.current=b,Wr())},[b,Wr,u]),S.useEffect(()=>{Un.current=re},[re]),S.useEffect(()=>{!ge&&(gt!==null||_t!==null)&&(vt(null),qt(null),le.current=null)},[ge,gt,_t]),S.useEffect(()=>{!tn&&(gt!==null||_t!==null)&&(vt(null),qt(null),le.current=null)},[tn,gt,_t]),S.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(cg,ee?"true":"false")},[ee]),S.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(ug,Ze)},[Ze]),S.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(dg,$e)},[$e]),S.useEffect(()=>{Qt(qh());const J=()=>{Qt(qh())};return window.addEventListener("resize",J),()=>window.removeEventListener("resize",J)},[]);const En=S.useCallback(()=>{tt.current+=1,pt(),Hr();const J=ds.current;ds.current=null,li.current=null,at.current=!1,bt(!1),Ot.current?.setSessionReady(!1);const je=_r.current;je&&_1(je,!1,"stream-disconnect"),qs.current=!1,rn.current=null,Kn.current=[],J?.()},[Hr,pt]),fs=S.useCallback(async J=>{if(li.current===J){he(`[startStream] Skipping - already connected to ${J}`);return}he(`[startStream] Starting stream for frontendSessionId=${re} backendSessionId=${J}`),as(null),Kt.current+=1,nt.current=!1,it.current=null,de(!1),Qe(!1),En();const je=tt.current+1;tt.current=je,at.current=!0;const ot=Ur.getState().getTerminalSession(re);if(ot?.mode==="shell"&&!ot.bufferChunks.length){const Ae=await Promise.race([Ry(J),new Promise(xt=>window.setTimeout(()=>xt(null),75))]);if(tt.current!==je||Un.current!==re)return;if(Ae&&!Ur.getState().getTerminalSession(re)?.bufferChunks.length){Ur.getState().replaceBuffer(re,[Ae.data]);const xt=Ot.current?.getDimensions();xt?.cols===Ae.cols&&xt.rows===Ae.rows&&Ny(J,Ae.seq,Ae.epoch)}}const At=Ve.connect(J,{onEvent:Ae=>{if(tt.current!==je)return;const xt=re;if(xt)switch(Ae.type){case"connected":{at.current=!1;const cr=Le.current;cr&&(uo("info","PWA_RESUME terminal-connected",{frontendSessionId:xt,backendSessionId:_r.current,durationMs:Date.now()-cr.startedAt,strategy:cr.strategy,reason:cr.reason}),Le.current=null),F?.(xt),(Ae.runtime||Ae.ptyBackend)&&he(`[Terminal] connected frontendSessionId=${xt} backendSessionId=${_r.current} runtime=${Ae.runtime??"unknown"} pty=${Ae.ptyBackend??"unknown"} cwd=${Ae.cwd??"unknown"}`),Ir(xt,!1),sn(null),On(!1),as(null),bt(!0),_r.current&&(S1(_r.current,Mr.current,"stream-connected"),L1(_r.current,Pr.current,"stream-connected")),Ot.current?.setSessionReady(!0),rn.current=null,ur(qs.current,"stream-connected"),Ae.tuiProgress!==void 0&&Ur.getState().setSessionTuiProgress(xt,Ae.tuiProgress??null),Ae.shellTitle!==void 0&&Ur.getState().setSessionShellTitle(xt,Ae.shellTitle??null),Ae.promptState!==void 0&&Ae.promptState!==null&&Ur.getState().setSessionPromptState(xt,Ae.promptState);const Fr=Ur.getState().getTerminalSession(xt);if(Fr?.terminalSessionId&&Ae.mode&&Ur.getState().setTerminalSession(xt,{sessionId:Fr.terminalSessionId,cols:80,rows:24,mode:Ae.mode,tmuxSessionName:Ae.tmuxSessionName??null,cwd:Ae.cwd??null}),Ae.activeProgram!==void 0&&jt(xt,Ae.activeProgram??null,Ae.activeProgramSource??null,Ae.activeProgramRaw??null),Ot.current?.requestRefresh("connected",{force:!0,reconcileServerSize:sr.current}),Ae.mode!=="tmux"&&(Yn(null),Pt(xt,!1)),he("[Terminal] Connected event received:",{frontendSessionId:xt,backendSessionId:_r.current,storeHasState:!!Fr,storeTerminalId:Fr?.terminalSessionId,hasHistoryInStore:!!Fr?.history?.length,historyLength:Fr?.history?.length??0}),Fr?.history&&Fr.history.length>0){he(`[Terminal] Restoring ${Fr.history.length} history chunks to frontend session ${xt}`);const Hn=Fr.history.reduce((Ls,Is)=>Ls+Is.length,0),Mn=Math.max(300,Math.min(2e3,Math.ceil(Hn/200)));Kr.current=Date.now()+Mn,Fr.history.forEach(Ls=>{kn(xt,Ls,{markActivity:!1})}),Ur.getState().setSessionHistory(xt,[]),he(`[Terminal] History restoration complete for ${xt}`)}else he(`[Terminal] No history to restore for ${xt}`);const nn=Ae.replayChunks,Ar=!!Fr?.history?.length||!!nn?.length;if(Ar?nt.current=!0:K(),nn&&nn.length>0){let Hn=null;if(Ae.replayOutOfWindow)he(`[Terminal] Replay out-of-window, atomically replacing buffer (${nn.length} chunks)`),Hn=se(xt,L9(nn));else{he(`[Terminal] Replay incremental: ${nn.length} chunks`);for(const Is of nn)kn(xt,Is)}const Mn=nn.reduce((Is,io)=>Is+io.length,0),Ls=Math.max(200,Math.min(1500,Math.ceil(Mn/200)));Kr.current=Math.max(Kr.current,Date.now()+Ls),it.current=Hn}Ar&&it.current===null&&(it.current=Ur.getState().flushPendingBufferWrites(xt),it.current===null&&(nt.current=!1,K()));break}case"reconnecting":{as(cr=>cr??Date.now()),sn("Reconnecting..."),On(!1);break}case"data":{Ae.data&&(qs.current?Kn.current.push(Ae.data):kn(xt,Ae.data));break}case"tmux-layout":{Yn(Ae.layout??null),Ae.layout&&Pt(xt,Ae.layout.inCopyMode);break}case"tmux-screen-sync":{const cr=Ae.generation??0;if(cr<$.current)break;$.current=cr,Kt.current+=1,nt.current=!0,de(!1),Kn.current=[],Ot.current?.prepareScreenReplacement(),Fe.current=cr,it.current=se(xt,I9(Ae.chunks??[])),it.current===null&&(Fe.current=null,Ot.current?.notifyScreenSynchronized(cr),nt.current=!1,K()),typeof Ae.cols=="number"&&typeof Ae.rows=="number"&&Ot.current?.notifyServerSize(Ae.cols,Ae.rows,"tmux-screen-sync");break}case"active-program":{jt(xt,Ae.activeProgram??null,Ae.activeProgramSource??null,Ae.activeProgramRaw??null);break}case"cwd":{ne(xt,Ae.cwd??null);break}case"agent-status":{mt(xt,{agentStatus:Ae.agentStatus??null,agentIndicator:Ae.agentIndicator??null,agentStatusDetail:Ae.agentStatusDetail??null,agent:Ae.agent??null,agentMessage:Ae.agentMessage??null,agentNativeSessionId:Ae.agentNativeSessionId??null,agentResumeRecovered:Ae.agentResumeRecovered===!0,agentRich:Ae.agentRich===!0,agentActivity:Ae.agentActivity??0,agentCwd:Ae.agentCwd??null,reviewed:Ae.reviewed??null});break}case"git-status":{Ur.getState().setSessionGitStatus(xt,Ae.gitStatus??null);break}case"focus-mode":{he("[Terminal] focus tracking mode",{backendSessionId:_r.current,requested:Ae.focusTrackingRequested===!0});break}case"resize-ack":{Ot.current?.acknowledgeResize({seq:Ae.seq,ok:Ae.ok!==!1,cols:Ae.cols,rows:Ae.rows,screenSyncPending:Ae.screenSyncPending,screenSyncGeneration:Ae.screenSyncGeneration});break}case"pty-size":{typeof Ae.cols=="number"&&typeof Ae.rows=="number"&&Ot.current?.notifyServerSize(Ae.cols,Ae.rows,Ae.source);break}case"shell-title":{It(xt,Ae.title??null);break}case"prompt-state":{or(xt,Ae.state??"idle",Ae.exitCode??null);break}case"tui-progress":{Ur.getState().setSessionTuiProgress(xt,Ae.tuiProgress??null);break}case"exit":{const cr=typeof Ae.exitCode=="number"?Ae.exitCode:null,Fr=typeof Ae.signal=="number"?Ae.signal:null;kn(xt,`\r
68
+ [Process exited${cr!==null?` with code ${cr}`:""}${Fr!==null?` (signal ${Fr})`:""}]\r
69
+ `),rt(xt),Ir(xt,!1),sn("Terminal session ended"),bt(!1),On(!1),as(null),Yn(null),Pt(xt,!1),En();break}}},onError:(Ae,xt)=>{if(tt.current!==je)return;const cr=re;if(!cr)return;at.current=!1;const Fr=xt&&Ae.message==="Authentication required",nn=Z_(Ae),Ar=Fr?Ae.message:nn||xt?"Reconnecting...":Ae.message||"Terminal stream connection error";console.error(`[Terminal] Stream error (fatal=${xt}):`,Ar),nn&&console.warn("[Terminal] SESSION_NOT_FOUND_DETECTED",{terminalIdAtError:_r.current,frontendSessionId:cr,isActive:u,isMobile:ge,fatal:xt,stack:new Error().stack}),sn(Ar),On(!!xt),xt&&(as(null),Ir(cr,!1),En(),nn&&(he("[onError] Session lost, auto-recreating"),sn("Reconnecting..."),On(!1),rt(cr),wr(cr),_r.current=null,Or.current=!1,Sn()))}},{...tS,getDimensions:()=>Ot.current?.getDimensions()??null});ds.current=()=>{At.close(),tt.current===je&&(li.current=null)},li.current=J},[kn,wr,rt,he,En,K,F,ur,Sn,It,Ir,jt,mt,Pt,ne,or,Ve,re]);S.useEffect(()=>{const J=G_({isActive:u,isStreamReady:et,reconnectStartedAt:Ts,now:Date.now()});if(J===null)return;const je=window.setTimeout(()=>{he("[Terminal] visible reconnect watchdog expired",{backendSessionId:_r.current,reconnectStartedAt:Ts}),En(),Ir(re,!1),sn("Reconnecting..."),On(!1),as(Date.now()),Sn()},J);return()=>window.clearTimeout(je)},[he,En,u,et,Ts,Sn,re,Ir]);const Or=S.useRef(!1),Gi=S.useRef(!1),Us=S.useRef(0);S.useEffect(()=>()=>{Us.current+=1,Or.current=!1,En()},[En]);const Ea=S.useRef(Vr),go=S.useRef(Rr);S.useEffect(()=>{const J=Ea.current,je=go.current;Ea.current=Vr,go.current=Rr,Un.current===re&&(J===Vr&&je===Rr||(Or.current=!1,En(),Cr(ot=>ot+1)))},[Vr,Rr,En,re]),S.useEffect(()=>{if(Un.current!==re&&(he(`[useEffect] sessionId changed from ${Un.current} to ${re}, allowing reinitialization`),Or.current=!1,Gi.current=!1),Or.current&&Un.current===re){he(`[useEffect] Already initialized for sessionId=${re}, skipping`);return}if(!Pe)return;const J=async xt=>{if(he(`[ensureSession] Starting for sessionId=${re}, runId=${xt}`),!Un.current||Un.current!==re){he(`[ensureSession] SessionId mismatch or stale run (current=${Un.current}, target=${re}), skipping`);return}if(xt!==Us.current){he(`[ensureSession] Stale run detected (runId=${xt}, currentRunId=${Us.current}), skipping`);return}const cr=Ur.getState(),Fr=cr.getTerminalSession(re),nn=Fr?.mode??Vr;he("[ensureSession] Current state from store:",{terminalSessionId:Fr?.terminalSessionId,mode:Fr?.mode,tmuxSessionName:Fr?.tmuxSessionName,isConnecting:Fr?.isConnecting});let Ar=Fr?.terminalSessionId??null,Hn=!Ar;if(Ar&&nn!==Vr?(he(`[ensureSession] Store mode mismatch for ${Ar}: current=${nn} desired=${Vr}, will create new session`),Hn=!0,cr.clearTerminalSession(re),Ar=null):Ar&&Vr==="tmux"&&Rr&&Fr?.tmuxSessionName!==Rr&&(he(`[ensureSession] Store tmux name mismatch for ${Ar}: current=${Fr?.tmuxSessionName} desired=${Rr}, will create new session`),Hn=!0,cr.clearTerminalSession(re),Ar=null),Ar&&Ve.checkHealth&&!sr.current){he(`[ensureSession] Checking health of existing session ${Ar}`);try{const Mn=await Ve.checkHealth(Ar);if(he("[ensureSession] Health check result:",Mn),!Mn.healthy)he(`[ensureSession] Session ${Ar} is NOT healthy (healthy=${Mn.healthy}), will create new session`),he("[ensureSession] Health check details:",Mn),Hn=!0,Mn.mode&&Fr?.terminalSessionId&&cr.setTerminalSession(re,{sessionId:Fr.terminalSessionId,cols:80,rows:24,mode:Mn.mode,tmuxSessionName:Mn.tmuxSessionName??null}),cr.clearTerminalSession(re),he("[ensureSession] Cleared unhealthy session from store");else{he(`[ensureSession] Session ${Ar} is healthy, reusing it, cwd=${Mn.cwd}, clients=${Mn.clients}, lastActivity=${Date.now()-(Mn.lastActivity||0)}ms ago`),Mn.mode&&Fr?.terminalSessionId&&cr.setTerminalSession(re,{sessionId:Fr.terminalSessionId,cols:80,rows:24,mode:Mn.mode,tmuxSessionName:Mn.tmuxSessionName??null}),he(`[ensureSession] Setting terminalIdRef to ${Ar} and starting stream`),_r.current=Ar,fs(Ar),he(`[ensureSession] Successfully reused healthy session ${Ar}, returning early`);return}}catch(Mn){he(`[ensureSession] Failed to check health of session ${Ar}:`,Mn),he("[ensureSession] Health check API call failed, proceeding as if session might be unhealthy")}}if(he(`[ensureSession] Decision: shouldCreateNewSession=${Hn}, terminalId=${Ar}`),Hn){he(`[ensureSession] Creating new session, shouldCreateNewSession=${Hn}, runId=${xt}`),sn(null),On(!1),cr.setConnecting(re,!0);const Ls=Ur.getState().getTerminalSession(re),io=(Ls?.mode??Vr)===Vr&&(Vr!=="tmux"||!Rr||Ls?.tmuxSessionName===Rr);if(Ls?.terminalSessionId&&io)he(`[ensureSession] Race condition avoided: another instance already created session ${Ls.terminalSessionId}`),cr.setConnecting(re,!1),Ar=Ls.terminalSessionId,Hn=!1;else try{const Hs=await yr();if(he(`[ensureSession] Opened managed backend session ${Hs.sessionId}`),xt!==Us.current){he(`[ensureSession] Stale run after session creation (runId=${xt}, currentRunId=${Us.current}), leaving ${Hs.sessionId} for sibling`);return}cr.setTerminalSession(re,Hs),he(`[ensureSession] Updated store with new session ${Hs.sessionId}`),Ar=Hs.sessionId}catch(Hs){if(xt!==Us.current){he("[ensureSession] Stale run after session creation failed, skipping error handling");return}if(Hs instanceof k1&&ag(Hs)){he("[ensureSession] Confirmed missing persisted session:",{sessionId:re,error:Hs.message}),cr.clearTerminalSession(re),sn(Vh),On(!0),cr.setConnecting(re,!1);return}sn("Reconnecting..."),On(!0),cr.setConnecting(re,!1);return}}if(xt!==Us.current){he(`[ensureSession] Stale run before starting stream (runId=${xt}, currentRunId=${Us.current}), skipping`);return}if(!Ar){he(`[ensureSession] No terminalId, terminalId=${Ar}`);return}he(`[ensureSession] Starting stream for session ${Ar}`),_r.current=Ar,fs(Ar),he(`[ensureSession] ensureSession completed for sessionId=${re}, terminalId=${Ar}`)};let je=null,ot=null;const At=()=>{ot=null,!(Or.current&&Un.current===re)&&(he(`[useEffect] Running ensureSession for sessionId=${re}, hasInitialized=${Or.current}`),Or.current=!0,Gi.current=!0,je=++Us.current,J(je))};if(!N&&!Gi.current){he(`[useEffect] Holding background connection until the selected session is ready: ${re}`);return}const Ae=Gi.current?0:Math.max(0,k);return Ae>0?(he(`[useEffect] Delaying initial connection for sessionId=${re} by ${Ae}ms`),ot=window.setTimeout(At,Ae)):At(),()=>{ot!==null&&window.clearTimeout(ot),he(`[useEffect] Cleanup for sessionId=${re}, runId=${je??"pending"}`)}},[re,_n,fs,En,Ve,he,Vr,Rr,ts,k,N,Pe]);const sa=S.useCallback(async()=>{if(re&&!zr){Fn(!0),sn(null),On(!1),as(null),En();try{Ve.forceKill&&await Ve.forceKill({sessionId:re})}catch{}Bt(re),wr(re),Ot.current?.clear(),await new Promise(J=>setTimeout(J,100));try{Ir(re,!0);const J=await yr();un(re,J),_r.current=J.sessionId,fs(J.sessionId)}catch(J){sn(J instanceof k1&&ag(J)?Vh:"Reconnecting..."),On(!0),Ir(re,!1)}finally{Fn(!1)}}},[re,zr,En,Ve,Bt,wr,Ir,un,fs,yr]),Za=S.useCallback((J,je)=>{if(!sr.current||!J)return;const ot=h_(J),At=/^(\x1b\[<6[45];[0-9]+;[0-9]+M)+$/.test(J);if(Cn&&At&&(Xn.current=!0),Date.now()<Kr.current)return;let Ae=J,xt=je?.consumeModifier??!1;if(!je?.skipModifierTransform&&gt&&J.length>0){const nn=J[0];if(nn.length===1&&/[a-zA-Z]/.test(nn)){const Ar=nn.toUpperCase();gt==="ctrl"?(Ae=String.fromCharCode(Ar.charCodeAt(0)&31),xt=!0):gt==="alt"&&(Ae=`\x1B${J}`,xt=!0)}xt||(gt==="alt"&&(Ae=`\x1B${J}`),xt=!0)}const cr=_r.current;if(!cr)return;(async()=>{try{if(Cn&&!ot&&Xn.current&&Ve.tmuxAction){Xn.current=!1;try{await Ve.tmuxAction(cr,{action:"copy-mode",enabled:!1})}catch{}if(f_(Ae))return}await Ve.sendInput(cr,Ae),ws(re)}catch(nn){sn(nn instanceof Error?nn.message:"Failed to send input")}})(),xt&&(_t||vt(null),Wr())},[gt,ws,Wr,Cn,_t,Ve]);S.useEffect(()=>{const J=je=>{if(!sr.current)return;const ot=je,At=ot.detail?.text;if(!At)return;const Ae=ot.detail?.nonce;if(Zn.current){Ae&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:Ae,ok:!1}}));return}Ot.current?.sendSequence(At,{paste:ot.detail?.paste}),Ae&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:Ae,ok:!0}})),p9(yn.current,ot.detail?.focus!==!1)&&Wr()};return window.addEventListener("termdock-insert-reference",J),()=>window.removeEventListener("termdock-insert-reference",J)},[Wr]);const Fo=S.useCallback((J,je,ot)=>{const At=_r.current;if(!At){Oe("xterm resize push skipped: no terminalId",{cols:J,rows:je});return}Oe("xterm resize push",{cols:J,rows:je}),Ve.resize({sessionId:At,cols:J,rows:je,seq:ot}).catch(Ae=>{Ot.current?.acknowledgeResize({seq:ot,ok:!1}),Ae&&/session not found/i.test(String(Ae.message||Ae))&&console.warn("[Terminal] resize 404 session not found",{sessionId:At,cols:J,rows:je,stack:new Error().stack})})},[Ve,Oe]),Uo=S.useCallback(async J=>{const je=_r.current;if(!(!je||!Ve.tmuxAction))try{const ot=await Ve.tmuxAction(je,J);ot.layout&&(Yn(ot.layout),J.action==="switch-session"&&(un(re,{sessionId:je,cols:80,rows:24,mode:"tmux",tmuxSessionName:ot.layout.sessionName}),Dy(re,{tmuxSessionName:ot.layout.sessionName}).catch(At=>{console.warn("[Terminal] failed to update inventory after tmux switch",At)})))}catch(ot){sn(ot instanceof Error?ot.message:"Failed to execute tmux action")}},[re,un,Ve]);S.useEffect(()=>{if(!jr||!tn)return;const je=jr.windows.find(ot=>ot.id===jr.activeWindowId)?.panes.find(ot=>ot.id===jr.activePaneId);je&&Ot.current?.requestRefresh("tmux-layout",{skipScrollToBottom:!0,dedupeKey:`${tn}:${jr.sessionId}:${je.id}:${je.width}x${je.height}`})},[jr,tn]);const ro=S.useCallback((J,je=5)=>{const ot=Math.max(1,Math.min(Math.floor(je)||1,40));Xn.current=!0;const At=bn.current;if(At&&At.direction===J){At.lines+=ot;return}At&&Uo({action:"scroll",direction:At.direction,lines:At.lines}).finally(()=>{Wr()}),bn.current={direction:J,lines:ot},xr.current&&clearTimeout(xr.current),xr.current=setTimeout(()=>{const Ae=bn.current;Ae&&(bn.current=null,Uo({action:"scroll",direction:Ae.direction,lines:Ae.lines}).finally(()=>{Wr()}))},0)},[Wr,Uo]),ia=S.useCallback(J=>{const je=Date.now(),ot=le.current,At=ot!==null&&ot.modifier===J&&je-ot.timestamp<=J_;if(le.current={modifier:J,timestamp:je},_t===J){qt(null),vt(null);return}if(At){qt(J),vt(J);return}_t!==null&&_t!==J&&qt(null),vt(Ae=>Ae===J?null:J)},[_t]),Wi=S.useCallback(J=>{if(me(J&&sr.current),Oe("input focus changed",{focused:J,isActive:sr.current,isMobile:yn.current}),!yn.current||!sr.current){Je(!1);return}Je(je=>je===J?je:J)},[Oe]),oa=S.useCallback(J=>{if(qs.current=J,ur(J,"viewport-watermark"),!J&&Kn.current.length>0){const je=re;if(je){const ot=Kn.current;Kn.current=[];for(const At of ot)kn(je,At)}}},[kn,ur,re]),Rs=S.useCallback(J=>{sr.current&&Ot.current?.ensureSizeMatches(J)},[]),ci=S.useRef(null);S.useEffect(()=>{if(!u)return;const J=ci.current;if(!J)return;const je=()=>Rs("pointerdown"),ot=()=>Rs("keydown"),At=()=>Rs("touchstart"),Ae=()=>Rs("wheel");return J.addEventListener("pointerdown",je),J.addEventListener("keydown",ot),J.addEventListener("touchstart",At,{passive:!0}),J.addEventListener("wheel",Ae,{passive:!0}),()=>{J.removeEventListener("pointerdown",je),J.removeEventListener("keydown",ot),J.removeEventListener("touchstart",At),J.removeEventListener("wheel",Ae)}},[u,Rs]);const ss=S.useCallback(J=>{Ot.current=J},[]),Ya=S.useCallback(J=>{ft(J),q?.(re,J)},[q,re]),Cs=S.useCallback(J=>{const je=w_(J);if(!je)return;const ot=gt!==null;Ot.current?.sendSequence(je,{consumeModifier:ot})},[gt]),aa=S.useCallback(J=>{const je=g_(J);if(je.length===0)return;const ot=gt!==null;Ot.current?.sendSequence(ng(je[0]),{consumeModifier:ot});for(let At=1;At<je.length;At+=1){const Ae=je[At];window.setTimeout(()=>{Ot.current?.sendSequence(ng(Ae))},m_*At)}},[gt]),Ma=S.useCallback(()=>{Ot.current?.pasteClipboardText()},[]),Vi=S.useCallback(J=>{hs.current!==null&&(window.clearTimeout(hs.current),hs.current=null),Lr(J),(J==="inserted"||J==="failed")&&(hs.current=window.setTimeout(()=>{hs.current=null,Lr("idle")},1400))},[]),xo=S.useCallback(()=>{Vi("idle"),$r(0),O.current?.click()},[Vi]),$o=S.useCallback(J=>{const je=J.currentTarget.files?.[0];J.currentTarget.value="",je&&($r(0),Vi("uploading"),bx(je,(ot,At)=>Rd(ot,At,void 0,$r),ot=>{if(!sr.current||Zn.current)throw new Error("Terminal unavailable");window.dispatchEvent(new CustomEvent("termdock-insert-reference",{detail:{text:K_(ot,null),focus:!0}}))}).then(()=>Vi("inserted"),()=>Vi("failed")))},[Vi]),la=rs||Pn!==null;Zn.current=la;const Ra=S.useRef(en);la||(Ra.current=en);const Na=la?Ra.current:en,zo=S.useMemo(()=>x_(Na,qn),[Na,qn]),_s=S.useMemo(()=>ig(qn,Ze),[Ze,qn]),no=!ge&&Ze!=="auto"&&_s.showOnDesktop!==!0?"auto":Ze,ca=no==="auto"?zo:no,vi=S.useMemo(()=>ig(qn,ca),[ca,qn]),Ka=S.useMemo(()=>vi.actions.filter(J=>J.sequence.trim().length>0).map((J,je)=>({...J,label:Of(J,je)})),[vi.actions]),$n=S.useMemo(()=>dx(en),[en]),$s=vi.label,bo=S.useMemo(()=>no!=="auto"?`Manual preset: ${vi.label}`:$n?`Auto preset · ${vi.label} (${$n})`:"Auto preset",[$n,no,vi.label]),ua=S.useCallback(J=>{Ht(J)},[]),da=S.useCallback(()=>{Nt(J=>J==="copy"?"arrows":"copy"),ye("idle")},[]),so=S.useCallback(()=>{typeof window>"u"||(Xr.current!==null&&window.clearTimeout(Xr.current),Xr.current=window.setTimeout(()=>{Xr.current=null,ye("idle")},1200))},[]),Ys=S.useCallback(J=>{Xr.current!==null&&typeof window<"u"&&(window.clearTimeout(Xr.current),Xr.current=null),ye(J?"copied":"failed"),so()},[so]),Al=S.useCallback(J=>{Te(J)},[]),Ss=S.useMemo(()=>ge?b_(qn):y_(qn),[ge,qn]),zn=S.useMemo(()=>Qy(o),[o]),vn=S.useMemo(()=>`terminal::${re}`,[re]);S.useEffect(()=>{st?.({isConnecting:rs,isRestarting:zr,hasError:!!Pn,sessionId:tn})},[rs,zr,Pn,tn,st]);const wi=!tn||rs||zr,zs=S.useCallback((J,je)=>{if(wi)return;const ot=Math.max(1,Math.min(Math.floor(je)||1,40));ro(J,ot)},[ro,wi]);S.useEffect(()=>{if(!u||!ge)return;Ot.current?.requestRefresh("resize",{skipScrollToBottom:!gr,force:!0})},[u,ge,gr,ct,re]),S.useEffect(()=>{if(!u||!ge)return;const J=je=>{const ot=je.detail;Ot.current?.requestRefresh("resize",{skipScrollToBottom:ot?.isOpen!==!0,force:!0})};return document.addEventListener("termdock:viewport-keyboard-change",J),()=>{document.removeEventListener("termdock:viewport-keyboard-change",J)}},[u,ge,re]);const ha=!V&&(ge||vi.showOnDesktop===!0),qi=u,Ii=ge&&!_e?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,ki=ge&&!_e?{marginTop:"var(--kb-margin-top, 0px)",transition:"none"}:void 0,an=a.jsx(A_,{visible:ha,interactive:qi,presentation:ge?"mobile":"desktop-actions",activeModifier:gt,lockedModifier:_t,disabled:wi,defaultShowExtended:ee,presetLabel:$s,presetModeLabel:bo,presetMode:no,presetOptions:Ss,includeAlt:vi.includeAlt,presetRowLayout:vi.rowLayout,extraActions:Ka,onKeyPress:Cs,onTextPress:aa,onPastePress:ge?Ma:void 0,onFilePress:ge?xo:void 0,fileUploadState:Bn,fileUploadProgress:ve,longPressMode:$e,copyFeedback:lr,onLongPressModeToggle:da,onModifierToggle:ia,onPresetSelect:ua,onExpandedChange:Al}),Zi=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:Ii,children:[a.jsx("input",{ref:O,type:"file",className:"hidden",onChange:$o}),xn&&a.jsx(T_,{isMobile:ge,isInputFocused:W,isIOS:Rt,isConnecting:rs,connectionError:Pn,terminalSessionId:tn}),a.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden",style:{backgroundColor:zn.background,...ki},children:[a.jsx("div",{ref:ci,className:"h-full w-full box-border",children:a.jsx(By,{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:Ue("terminal.componentFailed")})]})}),children:a.jsx(i_,{ref:ss,sessionKey:vn,isLayoutVisible:g,chunks:As,onInput:Za,onResize:Fo,onFlowControl:oa,onTmuxScroll:Cn?zs:void 0,tmuxScrollSensitivity:.38,onDoubleTap:ge?()=>{Ot.current?.sendSequence(" ")}:void 0,onInputFocusChange:Wi,onMobileLongPressCopyResult:Ys,onReadyChange:Ya,onSizeSynchronizedChange:Qe,onWritesSettled:oe,onWriteProgress:Lt,onCursorPositionChange:Yt,onDirectoryLinkActivate:jn,terminalSettings:Xe,theme:zn,enableTouchScroll:ge,mobileLongPressMode:$e,autoFocus:!f&&!ge&&!Zi,cursorVisible:!f&&Mt,suppressSmoothScroll:!xe||!Ie,className:f||!Mt?"terminal-focus-suspended":void 0},vn)})}),a.jsx(__,{connectionError:Pn,isFatalError:zt,isRestarting:zr,isConnecting:rs,onHardRestart:sa})]}),fe?V?null:qa.createPortal(an,fe):an]})};function nS({session:e,active:t,onActivate:r,onToggleRightSidebar:s}){const{t:o}=qr(),c=Ur(u=>{const f=u.sessions.get(e.id);return _a(e,f?.activeProgram??null,f?.cwd??null,void 0,f?.shellTitle??null,f?.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:c,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(Po,{size:11,className:`shrink-0 ${t?"text-primary":"text-muted-foreground"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),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":o("tab.explorerTitle"),title:o("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(w5,{size:14})})]})}const sS="termdock:startup:";function I0(e){if(typeof performance>"u"||typeof performance.mark!="function")return;const t=`${sS}${e}`;performance.getEntriesByName(t,"mark").length>0||performance.mark(t)}function iS(e,t){e||qa.flushSync(t)}const Ff="horizontal";function ka(e){return e<=0?[]:Array.from({length:e},()=>1/e)}function Hl(e,t){if(!Array.isArray(e)||e.length!==t)return ka(t);const r=e.map(Number);if(r.some(o=>!Number.isFinite(o)||o<=0))return ka(t);const s=r.reduce((o,c)=>o+c,0);return s<=0?ka(t):r.map(o=>o/s)}function yx(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 oS(e,t,r,s){if(t<0||t>=e.length-1)return e;const o=[...e],c=o.slice(0,t).reduce((g,b)=>g+b,0),u=o[t]+o[t+1],f=Math.max(0,Math.min(u/2,s)),m=Math.min(u-f,Math.max(f,r-c));return o[t]=m,o[t+1]=u-m,o}function aS(e){return e==="horizontal"||e==="vertical"||e==="grid"}function lS(e){if(!Array.isArray(e))return[];const t=new Set,r=new Set,s=[];for(const o of e){if(!o||typeof o!="object")continue;const c=o;if(typeof c.id!="string"||!c.id||r.has(c.id))continue;const u=Array.isArray(c.sessionIds)?c.sessionIds.filter(g=>typeof g=="string"&&!!g&&!t.has(g)):[],f=[...new Set(u)];if(f.length<2)continue;const m=yx(f.length);f.forEach(g=>t.add(g)),r.add(c.id),s.push({id:c.id,...typeof c.name=="string"&&c.name.trim()?{name:c.name.trim().slice(0,80)}:{},sessionIds:f,layout:aS(c.layout)?c.layout:Ff,ratios:Hl(c.ratios,f.length),...c.gridColumnRatios!==void 0?{gridColumnRatios:Hl(c.gridColumnRatios,m.columns)}:{},...c.gridRowRatios!==void 0?{gridRowRatios:Hl(c.gridRowRatios,m.rows)}:{}})}return s}function cS(e,t){const r=new Set(t);return e.flatMap(s=>{const o=s.sessionIds.filter(c=>r.has(c));return o.length<2?[]:[{...s,sessionIds:o,ratios:o.length===s.sessionIds.length?Hl(s.ratios,o.length):ka(o.length)}]})}function Wc(e,t){if(t)return e.find(r=>r.sessionIds.includes(t))}function Zh(e,t,r){if(!t||!r||t===r)return e;const s=Wc(e,t),o=Wc(e,r);if(s&&s.id===o?.id)return e;const c=[...s?.sessionIds??[t],...o?.sessionIds??[r]],u=[...new Set(c)],f={id:s?.id??`split:${t}`,...s?.name?{name:s.name}:{},sessionIds:u,layout:u.length>2&&(!s||s.layout===Ff)?"grid":s?.layout??Ff,ratios:ka(u.length)},m=new Set([s?.id,o?.id].filter(Boolean)),g=e.filter(x=>!m.has(x.id)),b=s?Math.max(0,e.findIndex(x=>x.id===s.id)):g.length;return g.splice(Math.min(b,g.length),0,f),g}function uS(e,t){const r=Wc(e,t);if(!r||!t)return e;if(r.sessionIds.length<=2)return e.filter(o=>o.id!==r.id);const s=r.sessionIds.filter(o=>o!==t);return e.map(o=>o.id===r.id?{...o,sessionIds:s,ratios:ka(s.length)}:o)}function dS(e,t){const r=Wc(e,t);return r?e.filter(s=>s.id!==r.id):e}function hS(e,t,r){return e.map(s=>{if(s.id!==t)return s;const o=[...new Set(r)],c=new Set(s.sessionIds);return o.length===s.sessionIds.length&&o.every(f=>c.has(f))?{...s,sessionIds:o}:s})}function fS(e,t,r){const s=r.trim().slice(0,80);return e.map(o=>o.id===t?{...o,...s?{name:s}:{name:void 0}}:o)}const Uf=320,vx=1,pS=Uf+120,$f="termdock:split-workspaces:v2",wx="termdock:split-workspace:v1",mS=.1,gS=.9,xS=.28,bS=300,yS=8,vS=280,wS=160;function Yh(){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 AS(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem($f);if(e)return lS(JSON.parse(e));const t=JSON.parse(window.localStorage.getItem(wx)||"null");if(t&&typeof t.primaryId=="string"&&typeof t.secondaryId=="string"&&t.primaryId!==t.secondaryId){const r=Math.min(gS,Math.max(mS,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 TS(e,t){const r=new Map(e.map(u=>[u.id,u])),s=new Map;t.forEach(u=>u.sessionIds.forEach(f=>s.set(f,u)));const o=new Set,c=[];for(const u of e){const f=s.get(u.id);if(!f){c.push({key:u.id,sessions:[u]});continue}if(o.has(f.id))continue;o.add(f.id);const m=f.sessionIds.flatMap(g=>{const b=r.get(g);return b?[b]:[]});m.length>=2&&c.push({key:f.id,sessions:m,workspace:f})}return c}function hg(e){const t=e.wrapperEl;if(t)try{t.getAnimations().forEach(r=>r.cancel())}catch{}}function Fu(e,t){const r=gd(e,t);if(r===null)return;const s=e.wrapperEl;hg(e),s&&(s.style.transitionDuration="0ms");try{const o=e;o.setTransition?.(0),o.setTranslate?.(r),hg(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 zf(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 gd(e,t){const r=e.snapGrid,s=Array.isArray(r)?r[t]:void 0;return typeof s!="number"||!Number.isFinite(s)?null:-s}function CS(e,t){const r=zf(e),s=gd(e,t);return r!==null&&s!==null&&Math.abs(r-s)<=vx}function _S(e){const t=[],r=new Map,s=new Map,o=new Map;for(const c of e){const u=r.get(c.id)??[];if(u.push(c.id),r.set(c.id,u),c.sessionId){const f=s.get(c.sessionId)??[];f.push(c.id),s.set(c.sessionId,f)}if(c.mode==="tmux"&&c.tmuxSessionName){const f=o.get(c.tmuxSessionName)??[];f.push(c.id),o.set(c.tmuxSessionName,f)}}for(const[c,u]of r)u.length>1&&t.push({kind:"frontend",key:c,sessionIds:u});for(const[c,u]of s)u.length>1&&t.push({kind:"backend",key:c,sessionIds:u});for(const[c,u]of o)u.length>1&&t.push({kind:"tmux",key:c,sessionIds:u});return t}function Ax(e){const t=new Map;for(const r of e)t.set(r.id,r);return Array.from(t.values())}function Tx(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 SS(e,t){const r=Ax(e),s=r.findIndex(o=>o.id===t.id);if(s>=0){const o=[...r];return o[s]=t,o}return[...r,t]}function fg(e,t){const r=new Map(e.map(s=>[s.id,s]));return t.map(s=>{const o=r.get(s.sessionId);return{...Tx(s),history:o?.history}})}function pg(e,t){return e.length===0?null:t&&e.some(r=>r.sessionId===t)?t:e[0]?.sessionId??null}function mg(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 gg(e){const t=new Map;for(const[r,s]of e)t.set(r,s.cwd??null);return t}function LS(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 IS(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 kS=({terminalSettings:e=vp(),colorTheme:t="dark",toolbarPresets:r=[],showDebug:s,terminalFocusAvailable:o=!0,defaultSessionMode:c="shell",defaultTmuxSessionName:u="",connectionPrioritySessionId:f=null,connectionPriorityReady:m=!0,desktopRightSidebarEnabled:g=!1,onToggleRightSidebar:b,desktopFloatingTitle:x=!1,desktopPinnedLeftSidebarWidth:v=0,desktopViewportWidth:w=0,onStatusChange:I,onSessionDataUpdate:k,onInitialViewportReady:N,onInitialRecoveryRequired:R})=>{const{t:Q}=qr(),F=T.useMemo(()=>M0("session"),[]),q=T.useMemo(()=>M0("terminal"),[]),[P,Z]=T.useState([]),[V,fe]=T.useState(null),[_e,De]=T.useState(null),[be,st]=T.useState(!0),[Ue,Ee]=T.useState({token:0,reason:"visibility",forceForegroundReconnect:!1}),[ht,Ve]=T.useState(()=>new Set),[he,Oe]=T.useState(()=>({token:0,completed:new Set})),[ie,Le]=T.useState(0),[Xe,re]=T.useState(()=>new Set),[ge,Qt]=T.useState(()=>new Set),[Rt,We]=T.useState(()=>new Set),W=T.useRef(!1),Je=T.useRef(null),Se=T.useRef({}),[me,ce]=T.useState(null),[qe,ue]=T.useState(()=>AS()),[Me,et]=T.useState(!1),[bt,xe]=T.useState(null),[de,Ie]=T.useState(null),[Qe,Pe]=T.useState(null),[ft,Mt]=T.useState(!1),[Be,gr]=T.useState(()=>Yh().mobile),[ct,gt]=T.useState(()=>Yh().landscape),[vt,_t]=T.useState(null),[qt,ee]=T.useState(null),Te=T.useRef(o),Ze=T.useRef(!1),Ht=T.useRef(!1),$e=T.useRef(null),Nt=T.useRef(null),lr=T.useRef(Be),ye=T.useRef(null),Bn=T.useRef(0),Lr=T.useRef([]),ve=T.useRef(0),$r=T.useRef(null),kt=T.useRef(!1),un=T.useRef(!0),Ir=T.useRef(null),kn=T.useRef(""),se=T.useRef(null),rt=T.useRef(0);T.useEffect(()=>{if(typeof window>"u")return;const O=()=>{const K=Yh();lr.current=K.mobile,gr(K.mobile),gt(K.landscape)};return O(),window.addEventListener("resize",O),()=>window.removeEventListener("resize",O)},[]);const{sessions:Bt,inventory:wr,activeSessionId:jt,isLoading:ne,openSession:Pt,setActiveSession:mt,removeSession:Br,renameSession:or,resetSessionCustomName:ws,reorderSessions:ts,restoreSessions:gn}=jy(),Tr=wr?.tmuxRecovery??null;T.useEffect(()=>{Tr&&R?.()},[Tr,R]),T.useEffect(()=>{Pe(null),Ie(null)},[Tr?.id]);const en=T.useCallback(async()=>{Ie("restore"),Pe(null);try{const O=await Py();await gn(),O.failed>0&&Pe(Q("tab.tmuxRecoveryPartial",{restored:O.restored,failed:O.failed}))}catch{Pe(Q("tab.tmuxRecoveryFailed"))}finally{Ie(null)}},[gn,Q]),qn=T.useCallback(async()=>{Ie("dismiss"),Pe(null);try{await Oy(),await gn()}catch{Pe(Q("tab.tmuxRecoveryDismissFailed"))}finally{Ie(null)}},[gn,Q]),Cn=Ft(O=>O.groupByFolder),As=cd(O=>O.collaborationGroups),rs=Ft(O=>O.leftOpen||O.rightOpen),tn=Ft(O=>O.rightSidebarWidthContextKey),jn=Ft(O=>O.rightSidebarWidth),Vr=Ft(O=>O.rightPinned),[Rr,Pn]=T.useState(()=>gg(Ur.getState().sessions));T.useEffect(()=>Ur.subscribe(O=>{const K=gg(O.sessions);Pn(oe=>LS(oe,K)?oe:K)}),[]);const{arranged:sn}=T.useMemo(()=>ad(P,O=>Rr.get(O.id)??null,Cn,"",qe,As),[P,Rr,Cn,qe,As]),Zn=T.useRef(sn);Zn.current=sn;const zt=T.useMemo(()=>TS(sn,qe),[sn,qe]),On=T.useRef(zt);On.current=zt;const zr=T.useMemo(()=>Wc(qe,V),[V,qe]),Fn=T.useMemo(()=>{const O=zt.find(K=>K.sessions.some(oe=>oe.id===V));return new Set(O?.sessions.map(K=>K.id)??[])},[V,zt]),Ts=T.useMemo(()=>{const O=new Map;if(!g||w<=0)return O;for(const K of zt){const oe=K.sessions[0];if(!oe)continue;const Ne=Fy(oe.id,Rr.get(oe.id)??null,K.workspace?.id??null);if(!(Ne===tn?Vr:Uy(oe.id,Rr.get(oe.id)??null,K.workspace?.id??null)))continue;const Lt=Ne===tn?jn:$y(oe.id,Rr.get(oe.id)??null,K.workspace?.id??null),Yt=Yu(Lt,w,v);O.set(K.key,Yt+i5)}return O},[Rr,v,g,Vr,tn,jn,w,zt]),as=T.useMemo(()=>Wh(P.map(O=>({id:O.id,backendSessionId:O.sessionId})),f),[f,P]),_n=T.useMemo(()=>pg(Bt,jt),[jt,Bt]),Cr=Ou({prioritySessionId:as,activeSessionId:_e??V,persistedActiveSessionId:_n,firstSessionId:P[0]?.id??null}),jr=T.useMemo(()=>W_(zt.flatMap(O=>O.sessions.map(K=>K.id)),Fn),[Fn,zt]),Yn=Cr!==null&&ht.has(Cr),xn=T.useMemo(()=>{const O=new Set(Fn);return _e&&O.add(_e),!O.size&&Cr&&O.add(Cr),O},[Fn,_e,Cr]),ds=he.token===Ue.token&&$_(xn,he.completed),li=ds||ie===Ue.token?Ue.token:-1;T.useEffect(()=>{if(!Ue.token||ds)return;const O=window.setTimeout(()=>Le(Ue.token),M_);return()=>window.clearTimeout(O)},[Ue.token,ds]);const _r=T.useCallback((O,K)=>{Ve(oe=>{if(oe.has(O)===K)return oe;const Tt=new Set(oe);return K?Tt.add(O):Tt.delete(O),Tt})},[]),Un=T.useCallback(O=>{const K=Bn.current;Oe(Ne=>{if(Ne.token===K&&Ne.completed.has(O))return Ne;const Tt=new Set(Ne.token===K?Ne.completed:[]);return Tt.add(O),{token:K,completed:Tt}});const oe=as??_e??ye.current;O===oe&&I0("foreground-stream-connected")},[_e,as]),Ot=T.useCallback((O,K)=>{re(oe=>{if(oe.has(O)===K)return oe;const Ne=new Set(oe);return K?Ne.add(O):Ne.delete(O),Ne})},[]),qs=T.useCallback((O,K)=>{Qt(oe=>{if(oe.has(O)===K)return oe;const Ne=new Set(oe);return K?Ne.add(O):Ne.delete(O),Ne})},[]),rn=Cr!==null&&Xe.has(Cr),Kn=Cr!==null&&ge.has(Cr);T.useEffect(()=>{rn&&I0("foreground-viewport-ready")},[rn]),T.useEffect(()=>{Kn&&I0("foreground-content-ready")},[Kn]),T.useEffect(()=>{if(N){if(!be&&P.length===0){N();return}!rn||!Yn||!Kn||(I0("initial-viewport-presented"),N())}},[Yn,Kn,rn,be,N,P.length]);const Kr=T.useMemo(()=>Be?D_({slides:zt.map(O=>O.sessions.map(K=>K.id)),visibleSessionIds:Fn,foregroundSessionId:Cr}):Rt,[Be,zt,Fn,Cr,Rt]);T.useEffect(()=>{if(Be||Fn.size===0)return;const O=new Set(Fn),K=zt.findIndex(oe=>oe.sessions.some(Ne=>Fn.has(Ne.id)));for(let oe=-2;oe<=2;oe+=1)oe!==0&&zt[K+oe]?.sessions.forEach(Ne=>O.add(Ne.id));We(oe=>{let Ne=!1;const Tt=new Set(oe);for(const Lt of O)Tt.has(Lt)||(Tt.add(Lt),Ne=!0);return Ne?Tt:oe})},[Be,Fn,zt]);const Xn=x9(Kr);T.useEffect(()=>{if(!_e)return;if(!P.some(K=>K.id===_e)){De(null);return}if(!Xe.has(_e)||!ht.has(_e)||!ge.has(_e))return;const O=window.setTimeout(()=>{De(K=>K===_e?null:K),Te.current&&!lr.current&&ce({sessionId:_e,token:Date.now()})},80);return()=>window.clearTimeout(O)},[ge,_e,ht,P,Xe]),T.useEffect(()=>{typeof window>"u"||(qe.length>0?(window.localStorage.setItem($f,JSON.stringify(qe)),window.localStorage.removeItem(wx)):window.localStorage.removeItem($f))},[qe]),T.useEffect(()=>{ne||be||qe.length===0||ue(O=>cS(O,P.map(K=>K.id)))},[ne,be,P,qe.length]),T.useEffect(()=>{if(!bt)return;const O=window.setTimeout(()=>xe(null),3200);return()=>window.clearTimeout(O)},[bt]),T.useEffect(()=>()=>se.current?.(),[]),ye.current=V,Bn.current=Ue.token,Lr.current=P,$r.current=jt,kt.current=ne,un.current=be,Te.current=o;const bn=T.useCallback((O=Je.current)=>{const K=ve.current,oe=typeof window<"u"?window.visualViewport:null,Ne=O?zf(O):null,Tt=O?gd(O,K):null;return{sessionsLength:Lr.current.length,workspaceSlidesLength:On.current.length,sessionIds:Lr.current.map(Lt=>Lt.id),activeSessionId:ye.current,activeSessionIndex:K,persistedActiveId:$r.current,isLoading:kt.current,isRestoring:un.current,activeIndex:O?.activeIndex??null,previousIndex:O?.previousIndex??null,animating:O?.animating??null,allowTouchMove:O?.allowTouchMove??null,width:O?.width??null,translate:Ne,targetTranslate:Tt,translateDelta:Ne!==null&&Tt!==null?Ne-Tt:null,snapGridLength:O?.snapGrid?.length??null,targetSnap:O?.snapGrid?.[K]??null,visualViewport:oe?{width:Math.round(oe.width),height:Math.round(oe.height),offsetTop:Math.round(oe.offsetTop)}:null}},[]),xr=T.useCallback((O,K)=>{F(O,{...bn(),...K})},[F,bn]);T.useEffect(()=>{ne||be||V!==jt&&mt(V)},[V,ne,be,jt,mt]);const $=T.useMemo(()=>{if(sn.length===0||!V)return 0;const O=zt.findIndex(K=>K.sessions.some(oe=>oe.id===V));return O>=0?O:0},[zt,V]);ve.current=$;const le=T.useCallback(()=>{$e.current&&(clearTimeout($e.current),$e.current=null)},[]),Ge=T.useCallback(O=>{le(),$e.current=setTimeout(()=>{$e.current=null,Ze.current=!1,xr("[swiper:touch-guard-clear]",{reason:O})},pS)},[le,xr]),Ce=T.useCallback((O,K={})=>{const oe=Je.current,Ne=ve.current,Tt=On.current;if(!oe||Tt.length===0||Ne<0||Ne>=Tt.length)return;if(Ze.current){xr("[swiper:sync-skip-touch]",{reason:O});return}if(oe.animating){xr("[swiper:sync-skip-animating]",{reason:O});return}const Lt=zf(oe),Yt=gd(oe,Ne),pt=Lt!==null&&Yt!==null&&Math.abs(Lt-Yt)<=vx,It=oe.activeIndex===Ne;if(xr("[swiper:sync-check]",{reason:O,activeIndexAligned:It,translateAligned:pt,immediate:K.immediate===!0}),!(It&&pt)){if(It){Fu(oe,Ne),xr("[swiper:sync-forced-active]",{reason:O,translateAligned:pt,immediate:K.immediate===!0});return}K.immediate?(Fu(oe,Ne),oe.slideTo(Ne,0,!1),Fu(oe,Ne)):oe.slideTo(Ne,Uf,!1),xr("[swiper:sync-applied]",{reason:O,activeIndexAligned:It,translateAligned:pt,immediate:K.immediate===!0})}},[xr]);T.useEffect(()=>{const O=K=>{const oe=K;Je.current&&(Je.current.allowTouchMove=!oe.detail.locked),xr("[swiper:gesture-lock]",{locked:oe.detail.locked})};return document.addEventListener("termdock:gesture-lock",O),()=>document.removeEventListener("termdock:gesture-lock",O)},[xr]),T.useEffect(()=>{if(P.length===0){V!==null&&fe(null);return}if(!V){if(!m)return;fe(Ou({prioritySessionId:as,activeSessionId:null,persistedActiveSessionId:_n,firstSessionId:P[0]?.id??null}));return}P.some(K=>K.id===V)||fe(P[0].id)},[P,V,m,as,_n]);const He=T.useCallback((O,K)=>{if(K&&Date.now()<rt.current){Se.current[O]=!1;return}Se.current[O]=K,ee(oe=>K?O:oe===O?null:oe)},[]),tt=T.useCallback(O=>{if(!Ze.current&&O.activeIndex!==ve.current){xr("[swiper:slide-change-ignored-layout]",{instanceActiveIndex:O.activeIndex,expectedActiveIndex:ve.current}),requestAnimationFrame(()=>Ce("ignored-layout-slide-change",{immediate:!0}));return}const K=On.current[O.activeIndex],oe=K?.sessions.some(Lt=>Lt.id===V)?V:K?.sessions[0]?.id;if(xr("[swiper:slide-change]",{nextSessionId:oe??null,instanceActiveIndex:O.activeIndex}),!oe||oe===V)return;const Ne=!!V&&Se.current[V]===!0,Tt=Te.current&&(!lr.current||Ne);if(Nt.current=oe,fe(oe),Tt){ce({sessionId:oe,token:Date.now()});return}ce(null)},[P,V,xr,Ce]);T.useLayoutEffect(()=>{if(Nt.current===V){xr("[swiper:sync-skip-swiper-driven]",{activeSessionId:V}),Nt.current=null;return}Ce("active-session-index",{immediate:!0})},[V,$,P.length,Ce,xr]),T.useEffect(()=>{const O=Je.current;if(!O)return;const K=zt.length>1&&!rs&&!Me;O.allowTouchMove!==K&&(O.allowTouchMove=K,xr("[swiper:allow-touch-sync]",{nextAllow:K,sidebarOverlayOpen:rs}))},[zt.length,xr,rs,Me]);const nt=T.useCallback(O=>{const K=Je.current;if(!K)return;const oe=K.el;if(xr("[swiper:layout-before]",{reason:O,scrollLeft:oe?.scrollLeft??null}),oe&&(oe.scrollLeft=0),K.updateSize(),K.updateSlides(),K.updateProgress(),K.updateSlidesClasses(),oe&&(oe.scrollLeft=0),xr("[swiper:layout-after]",{reason:O,scrollLeft:oe?.scrollLeft??null}),Ze.current||K.animating){xr("[swiper:layout-skip-sync-motion]",{reason:O});return}Ce(`layout:${O}`,{immediate:!0}),requestAnimationFrame(()=>{const Ne=Je.current;Ne&&(Ze.current||Ne.animating||Fu(Ne,ve.current))})},[xr,Ce]);T.useEffect(()=>()=>le(),[le]);const it=zt.map(O=>O.key).join("\0");T.useEffect(()=>{requestAnimationFrame(()=>nt("group-change"))},[Cn,it,nt]),T.useEffect(()=>{let O=null,K="mount";const oe=pt=>{K=pt,O===null&&(O=requestAnimationFrame(()=>{O=null,nt(`viewport-change:${K}`)}))},Ne=()=>oe("window-resize"),Tt=()=>oe("visual-viewport-resize"),Lt=()=>oe("visual-viewport-scroll"),Yt=pt=>{oe(`measured:${pt.detail?.source??"unknown"}`)};return window.addEventListener("resize",Ne),window.visualViewport?.addEventListener("resize",Tt),window.visualViewport?.addEventListener("scroll",Lt),document.addEventListener(E1,Yt),oe("mount"),()=>{window.removeEventListener("resize",Ne),window.visualViewport?.removeEventListener("resize",Tt),window.visualViewport?.removeEventListener("scroll",Lt),document.removeEventListener(E1,Yt),O!==null&&cancelAnimationFrame(O)}},[nt]),T.useEffect(()=>{if(typeof document>"u")return;let O=null,K=null;const oe=It=>{if(It!=="online"&&document.hidden)return;const Hr=performance.now();if(!z_(K,Hr))return;K=Hr;const yr=It==="bfcache"||It==="online"?It:"visibility",Gr=H_();mh(),uo("info","PWA_RESUME scheduled",{source:It,forceForegroundReconnect:Gr,activeSessionId:ye.current}),Ee(Wr=>({token:Wr.token+1,reason:yr,forceForegroundReconnect:Gr})),requestAnimationFrame(()=>nt(`resume:${It}:raf`)),O&&clearTimeout(O),O=setTimeout(()=>{O=null,nt(`resume:${It}:settled`)},320)},Ne=()=>{if(document.hidden){mh();return}oe("visibility")},Tt=()=>{mh()},Lt=It=>{oe(It.persisted?"bfcache":"pageshow")},Yt=()=>oe("online"),pt=()=>oe("focus");return document.addEventListener("visibilitychange",Ne),window.addEventListener("pagehide",Tt),window.addEventListener("pageshow",Lt),window.addEventListener("online",Yt),window.addEventListener("focus",pt),()=>{document.removeEventListener("visibilitychange",Ne),window.removeEventListener("pagehide",Tt),window.removeEventListener("pageshow",Lt),window.removeEventListener("online",Yt),window.removeEventListener("focus",pt),O&&clearTimeout(O)}},[nt]),T.useLayoutEffect(()=>{if(!F_(be))return;const O=_S(P),K=JSON.stringify(O);O.length>0&&K!==kn.current?(kn.current=K,console.warn("[session-invariant] duplicate mapping detected",O)):O.length===0&&kn.current&&(kn.current=""),k?.({sessions:P.map(oe=>({id:oe.id,name:oe.name,customName:oe.customName,mode:oe.mode,tmuxSessionName:oe.tmuxSessionName})),activeSessionId:V,splitWorkspaces:qe.map(({id:oe,name:Ne,sessionIds:Tt,layout:Lt})=>({id:oe,...Ne?{name:Ne}:{},sessionIds:Tt,layout:Lt}))})},[P,V,qe,k,be]),T.useEffect(()=>{if(ne||W.current)return;W.current=!0;const O=Wh(Bt.map(Lt=>({id:Lt.sessionId,backendSessionId:Lt.backendSessionId??null})),f),K=pg(Bt,jt),oe=Ou({prioritySessionId:m?O:null,activeSessionId:null,persistedActiveSessionId:K,firstSessionId:Bt[0]?.sessionId??null}),Ne=Ax(Bt.map(Tx));if(F("[Session] Restoring",Ne.length,"persisted sessions (one-shot)"),xr("[swiper:restore-start]",{persistedSessionIds:Bt.map(Lt=>Lt.sessionId),nextActiveSessionId:oe}),Ne.length>0){const Lt=Ur.getState();Ne.forEach(pt=>{pt.sessionId&&Lt.setTerminalSession(pt.id,{sessionId:pt.sessionId,cols:80,rows:24,mode:pt.mode,tmuxSessionName:pt.tmuxSessionName,history:pt.history})}),Bt.forEach(pt=>{pt.activeProgram!=null&&Lt.setSessionActiveProgram(pt.sessionId,pt.activeProgram),pt.cwd!=null&&Lt.setSessionCwd(pt.sessionId,pt.cwd)}),Z(Ne);const Yt=oe||Ne[0]?.id||null;fe(Yt),xr("[swiper:restore-complete]",{restoredSessionIds:Ne.map(pt=>pt.id),nextActiveSessionId:Yt})}(async()=>(Ne.length===0&&await Ir.current?.({createIfEmpty:!0}),st(!1),requestAnimationFrame(()=>Ce("restore-finished",{immediate:!0}))))()},[ne,Bt,jt,F,xr,Ce,m,f]),T.useEffect(()=>{if(!m||be||P.length===0)return;const O=Wh(P.map(oe=>({id:oe.id,backendSessionId:oe.sessionId})),f),K=Ou({prioritySessionId:O,activeSessionId:ye.current,persistedActiveSessionId:_n,firstSessionId:P[0]?.id??null});K&&K!==ye.current&&fe(K)},[m,f,be,_n,P]);const Fe=T.useRef([]),at=T.useRef(!1);ye.current=V,T.useEffect(()=>{if(be)return;const O=Fe.current,K=Bt;if(!at.current){Z(It=>fg(It,K)),Fe.current=K,at.current=!0;return}const oe=new Set(O.map(It=>It.sessionId)),Ne=new Set(K.map(It=>It.sessionId)),Tt=new Map(O.map(It=>[It.sessionId,It.name]));Fe.current=K,Z(It=>{const Hr=fg(It,K);return(!ye.current||!Hr.some(yr=>yr.id===ye.current))&&fe(Hr[0]?.id??null),Hr});const Lt=K.filter(It=>!oe.has(It.sessionId)),Yt=[...oe].filter(It=>!Ne.has(It)),pt=K.filter(It=>oe.has(It.sessionId)&&Tt.get(It.sessionId)!==It.name);(Lt.length>0||Yt.length>0||pt.length>0)&&F("[Session] Synced persisted sessions:",{newSessionIds:Lt.map(It=>It.sessionId),removedSessionIds:Yt,renamedSessionIds:pt.map(It=>It.sessionId),currentSessionIds:K.map(It=>It.sessionId)});for(const It of K){if(!It.backendSessionId)continue;Ur.getState().setTerminalSession(It.sessionId,{sessionId:It.backendSessionId,cols:80,rows:24,mode:It.mode,tmuxSessionName:It.tmuxSessionName})}},[Bt,be,F]);const Kt=T.useCallback(async O=>{try{const K=O?.mode==="tmux"||O?.mode==="shell"?O.mode:c,oe=(O?.tmuxSessionName||"").trim(),Ne=u.trim(),Tt=K==="tmux"?oe||Ne||IS():null,Lt=typeof O?.cwd=="string"?O.cwd:null,Yt=V?Ur.getState().sessions.get(V)?.cwd??null:null,pt=typeof Lt=="string"&&Lt.trim().length>0?Lt:typeof Yt=="string"&&Yt.trim().length>0?Yt:void 0,It=await Pt({mode:K,tmuxSessionName:Tt,cwd:pt,termType:"xterm-256color",createIfEmpty:O?.createIfEmpty===!0}),Hr=It.session,yr=It.terminalSession,Gr={id:Hr.sessionId,name:Hr.name,customName:Hr.customName===!0,sessionId:yr.sessionId,mode:yr.mode??Hr.mode,tmuxSessionName:yr.tmuxSessionName??Hr.tmuxSessionName};Z(Sn=>SS(Sn,Gr)),fe(Gr.id),Ur.getState().setTerminalSession(Gr.id,{sessionId:yr.sessionId,cols:80,rows:24,mode:Gr.mode,tmuxSessionName:Gr.tmuxSessionName,activeProgram:yr.activeProgram,activeProgramRaw:yr.activeProgramRaw,activeProgramSource:yr.activeProgramSource,cwd:yr.cwd}),F("[Session] Inventory opened session:",{frontendSessionId:Gr.id,backendSessionId:yr.sessionId,reused:It.reused,mode:Gr.mode,tmuxSessionName:Gr.tmuxSessionName});const on=O?.command?.trim();return on&&await s5(yr.sessionId,`${on}\r`),Gr.id}catch(K){return console.error("[Session] Failed to create new session:",K),null}},[c,u,V,Pt,F]);Ir.current=Kt;const lt=T.useCallback((O,K={})=>{const oe=ye.current,Ne=!!oe&&Se.current[oe]===!0;if(fe(O),lr.current&&K.preserveMobileKeyboard===!1){rt.current=Date.now()+600,oe&&(Se.current[oe]=!1),ee(null),ce(null);const Tt=document.activeElement;Tt instanceof HTMLTextAreaElement&&Tt.closest(".terminal-viewport-container")&&Tt.blur();return}Ne&&lr.current&&ee(O),Te.current&&(!lr.current||Ne)&&ce({sessionId:O,token:Date.now()})},[]),br=T.useCallback(O=>{fe(O),et(!0),xe(null)},[]),ut=T.useCallback(O=>{const K=ye.current;!K||K===O||(ue(oe=>Zh(oe,K,O)),et(!1),lt(K,{preserveMobileKeyboard:!1}))},[lt]),hr=T.useCallback(async()=>{const O=ye.current;if(!O||ft)return;Mt(!0);const K=Ur.getState().sessions.get(O)?.cwd??void 0,oe=await Kt({cwd:K||void 0,mode:c});if(Mt(!1),!oe){xe(Q("common.error"));return}ue(Ne=>Zh(Ne,O,oe)),et(!1),lt(O,{preserveMobileKeyboard:!1})},[lt,c,Kt,ft,Q]),ar=T.useCallback(O=>{ue(K=>dS(K,O)),O&&lt(O,{preserveMobileKeyboard:!1})},[lt]),St=T.useCallback(O=>{ue(K=>uS(K,O)),lt(O,{preserveMobileKeyboard:!1})},[lt]),sr=T.useCallback((O,K,oe,Ne,Tt,Lt="linear",Yt)=>{O.preventDefault(),O.stopPropagation();const pt=O.currentTarget,It=O.pointerId,Hr={x:O.clientX,y:O.clientY};pt.setPointerCapture?.(It);const yr=K.getBoundingClientRect();let Gr=!Be,Wr=null;const on=dn=>{if(dn.pointerId!==It)return;if(!Gr){Math.hypot(dn.clientX-Hr.x,dn.clientY-Hr.y)>yS&&Wr!==null&&(window.clearTimeout(Wr),Wr=null);return}dn.preventDefault();const ur=oe?(dn.clientY-yr.top)/yr.height:(dn.clientX-yr.left)/yr.width,Wt=oe?yr.height:yr.width,vr=Be?0:oe?wS:vS;ue(Xt=>Xt.map(Ut=>{if(Ut.id!==Ne)return Ut;const Mr=Yt??Ut.sessionIds.length,Pr=Lt==="grid-columns"?Ut.gridColumnRatios:Lt==="grid-rows"?Ut.gridRowRatios:Ut.ratios,ns=Hl(Pr,Mr),En=ns[Tt]+ns[Tt+1],fs=vr>0?Math.min(En/2,vr/Math.max(1,Wt)):Math.min(En/2,xS),Or=oS(ns,Tt,ur,fs);return Lt==="grid-columns"?{...Ut,gridColumnRatios:Or}:Lt==="grid-rows"?{...Ut,gridRowRatios:Or}:{...Ut,ratios:Or}}))},Sn=()=>{Wr!==null&&(window.clearTimeout(Wr),Wr=null),window.removeEventListener("pointermove",on),window.removeEventListener("pointerup",Sn),window.removeEventListener("pointercancel",Sn),pt.classList.remove("bg-primary"),Be&&document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),se.current=null};se.current?.(),se.current=Sn,window.addEventListener("pointermove",on),window.addEventListener("pointerup",Sn),window.addEventListener("pointercancel",Sn),Be&&(document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}})),Wr=window.setTimeout(()=>{Wr=null,Gr=!0,pt.classList.add("bg-primary"),navigator.vibrate?.(8)},bS))},[Be]),kr=T.useCallback(O=>{if(P.find(oe=>oe.id===O)){if(O===ye.current)return;if(fe(O),!j_({isMobile:lr.current,viewportReady:Xe.has(O),streamReady:ht.has(O),contentReady:ge.has(O)})){De(null),Te.current&&ce({sessionId:O,token:Date.now()}),F("[Session] Switched to session:",O);return}We(Ne=>{if(Ne.has(O))return Ne;const Tt=new Set(Ne);return Tt.add(O),Tt}),De(O),F("[Session] Switched to session:",O)}},[ge,F,ht,P,Xe]),yn=T.useCallback((O,K)=>{K.trim()&&(Z(oe=>oe.map(Ne=>Ne.id===O?{...Ne,name:K.trim(),customName:!0}:Ne)),or(O,K.trim()))},[or]),Zs=T.useCallback(O=>{Z(K=>K.map(oe=>oe.id===O?{...oe,customName:!1}:oe)),ws(O)},[ws]),ls=T.useCallback(O=>{Z(K=>{const oe=new Map(K.map(Yt=>[Yt.id,Yt])),Ne=O.map(Yt=>oe.get(Yt)).filter(Yt=>Yt!==void 0),Tt=new Set(O),Lt=K.filter(Yt=>!Tt.has(Yt.id));return[...Ne,...Lt]}),ts(O),F("[Session] Reordered sessions:",O),requestAnimationFrame(()=>{Je.current?.update()})},[ts,F]),Fs=T.useCallback(async O=>{const K=typeof O=="string"?O:O.sessionId,oe=typeof O=="string"?"auto":O.closeMode??"auto",Ne=P.find(Lt=>Lt.id===K);if(!Ne)return;const Tt=zy(sn,K,Lt=>Lt.id);try{oe==="destroy"&&Ne.mode==="tmux"&&Ne.tmuxSessionName?(await o5(Ne.tmuxSessionName),F("[Session] Destroyed tmux session:",{frontendSessionId:Ne.id,tmuxSessionName:Ne.tmuxSessionName})):Ne.sessionId&&(await n5(Ne.sessionId),F("[Session] Closed backend terminal:",Ne.sessionId))}catch(Lt){console.error("[Session] Failed to close backend terminal:",Lt);return}Z(Lt=>{const Yt=Lt.filter(pt=>pt.id!==K);return fe(Tt),Yt}),Br(K,Tt),delete Se.current[K],F("[Session] Closed session:",{sessionId:K,closeMode:oe})},[P,sn,Br,F]),Er=T.useCallback(O=>{if(!O)return;const K=P.filter(oe=>oe.sessionId===O);if(K.length!==0){K.length>1&&console.warn("[session-invariant] backend matched multiple frontend sessions during cleanup",{backendSessionId:O,frontendSessionIds:K.map(oe=>oe.id)}),Z(oe=>{const Ne=oe.filter(Tt=>Tt.sessionId!==O);return Ne.length!==oe.length&&!Ne.some(Lt=>Lt.id===V)&&fe(Ne.length>0?Ne[0].id:null),Ne});for(const oe of K)Br(oe.id),delete Se.current[oe.id];F("[Session] Backend gone, dropped local session(s):",K.map(oe=>oe.id))}},[P,V,Br,F]);T.useEffect(()=>{const O=ur=>{Kt(ur.detail)},K=ur=>{kr(ur.detail)},oe=()=>{const ur=ye.current;!ur||lr.current||ce({sessionId:ur,token:Date.now()})},Ne=ur=>{const Wt=ur;Wt.detail&&br(Wt.detail)},Tt=ur=>{const Wt=ur.detail;ar(Wt??ye.current??void 0)},Lt=ur=>{const Wt=ur.detail;Wt&&St(Wt)},Yt=ur=>{const Wt=ur.detail,vr=typeof Wt=="string"?Wt:Wt?.layout,Xt=typeof Wt=="string"?ye.current:Wt?.sessionId;vr!=="horizontal"&&vr!=="vertical"&&vr!=="grid"||ue(Ut=>Ut.map(Mr=>Mr.sessionIds.includes(Xt??"")?{...Mr,layout:vr}:Mr))},pt=ur=>{const vr=ur.detail?.direction;if(vr!=="prev"&&vr!=="next")return;const Xt=Zn.current;if(Xt.length<=1)return;const Ut=ye.current,Mr=Ut?Xt.findIndex(Or=>Or.id===Ut):-1,En=((Mr>=0?Mr:0)+(vr==="next"?1:-1)+Xt.length)%Xt.length,fs=Xt[En]?.id;fs&&fs!==Ut&&kr(fs)},It=ur=>{Fs(ur.detail)},Hr=ur=>{Er(ur.detail)},yr=ur=>{const Wt=ur;!Wt.detail?.sessionId||!Wt.detail?.name||yn(Wt.detail.sessionId,Wt.detail.name)},Gr=ur=>{const Wt=ur;Wt.detail?.sessionId&&Zs(Wt.detail.sessionId)},Wr=ur=>{const Wt=ur;Wt.detail?.sessionIds&&ls(Wt.detail.sessionIds)},on=ur=>{const Wt=ur.detail;!Wt?.workspaceId||!Array.isArray(Wt.sessionIds)||ue(vr=>hS(vr,Wt.workspaceId,Wt.sessionIds))},Sn=ur=>{const Wt=ur.detail;!Wt?.workspaceId||typeof Wt.name!="string"||ue(vr=>fS(vr,Wt.workspaceId,Wt.name))},dn=ur=>{const Wt=ur.detail;!Wt?.primaryId||!Wt.secondaryId||Wt.primaryId===Wt.secondaryId||(ue(vr=>Zh(vr,Wt.primaryId,Wt.secondaryId)),lt(Wt.primaryId,{preserveMobileKeyboard:!1}))};return window.addEventListener("new-terminal-session",O),window.addEventListener("switch-terminal-session",K),window.addEventListener("focus-active-terminal-session",oe),window.addEventListener("open-terminal-split-chooser",Ne),window.addEventListener("close-terminal-split",Tt),window.addEventListener("remove-terminal-split-pane",Lt),window.addEventListener("set-terminal-split-direction",Yt),window.addEventListener("cycle-terminal-session",pt),window.addEventListener("close-terminal-session",It),window.addEventListener("close-terminal-session-by-backend",Hr),window.addEventListener("rename-terminal-session",yr),window.addEventListener("reset-terminal-session-name",Gr),window.addEventListener("reorder-terminal-session",Wr),window.addEventListener("reorder-terminal-split-workspace",on),window.addEventListener("rename-terminal-split-workspace",Sn),window.addEventListener("combine-terminal-split-sessions",dn),()=>{window.removeEventListener("new-terminal-session",O),window.removeEventListener("switch-terminal-session",K),window.removeEventListener("focus-active-terminal-session",oe),window.removeEventListener("open-terminal-split-chooser",Ne),window.removeEventListener("close-terminal-split",Tt),window.removeEventListener("remove-terminal-split-pane",Lt),window.removeEventListener("set-terminal-split-direction",Yt),window.removeEventListener("cycle-terminal-session",pt),window.removeEventListener("close-terminal-session",It),window.removeEventListener("close-terminal-session-by-backend",Hr),window.removeEventListener("rename-terminal-session",yr),window.removeEventListener("reset-terminal-session-name",Gr),window.removeEventListener("reorder-terminal-session",Wr),window.removeEventListener("reorder-terminal-split-workspace",on),window.removeEventListener("rename-terminal-split-workspace",Sn),window.removeEventListener("combine-terminal-split-sessions",dn)}},[lt,Kt,kr,br,ar,St,Fs,Er,yn,Zs,ls]),T.useEffect(()=>{if(!zr||Be)return;const O=K=>{if(!(K.ctrlKey||K.metaKey)||!K.shiftKey)return;if(zr.layout==="horizontal"?K.key==="ArrowLeft"||K.key==="ArrowRight":zr.layout==="vertical"?K.key==="ArrowUp"||K.key==="ArrowDown":K.key.startsWith("Arrow")){K.preventDefault(),K.stopPropagation();const Ne=zr.sessionIds.indexOf(ye.current??""),Tt=K.key==="ArrowLeft"||K.key==="ArrowUp"?-1:1,Lt=(Math.max(0,Ne)+Tt+zr.sessionIds.length)%zr.sessionIds.length,Yt=zr.sessionIds[Lt];if(!Yt)return;lt(Yt);return}K.key==="Backspace"&&(K.preventDefault(),K.stopPropagation(),ar(ye.current??void 0))};return window.addEventListener("keydown",O,!0),()=>window.removeEventListener("keydown",O,!0)},[lt,zr,ar,Be]);const Xr=O=>{const K=Ur.getState().sessions.get(O.id);return _a(O,K?.activeProgram??null,K?.cwd??null,void 0,K?.shellTitle??null,K?.promptState??null)},hs=(O,K={})=>{const oe=O.id===V,Ne=Fn.has(O.id)&&!K.hidden,Tt=m&&B_({sessionId:O.id,foregroundSessionId:Cr,visibleSessionIds:Fn,deferredViewportSessionIds:Be?Xn:Kr}),Lt=Q_({sessionId:O.id,foregroundSessionId:Cr,foregroundReady:Yn,isVisible:Ne})&&m,Yt=U_({sessionId:O.id,foregroundSessionId:Cr,requestToken:Ue.token,foregroundCompletedToken:li,isVisible:xn.has(O.id)})&&m,pt=Ne||O.id===Cr||Kr.has(O.id)?0:jr.get(O.id)??sd;return a.jsxs("div",{className:`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden ${K.hidden?"invisible pointer-events-none":""}`,style:K.containerStyle,"aria-hidden":K.hidden||void 0,onPointerDown:()=>{!oe&&Ne&&lt(O.id)},onWheelCapture:()=>{iS(oe,()=>lt(O.id))},children:[K.showPaneTitle&&a.jsx(nS,{session:O,active:oe,onActivate:()=>lt(O.id),onToggleRightSidebar:oe?b:void 0}),a.jsx("div",{className:"min-h-0 flex-1 app-chrome-bg",children:Tt&&a.jsx(rS,{sessionId:O.id,mode:O.mode,tmuxSessionName:O.tmuxSessionName,terminalSettings:e,colorTheme:t,toolbarPresets:r,isActive:oe,focusSuspended:_e!==null,deferCursorUntilPositioned:_e===O.id||O.mode==="tmux"&&!ge.has(O.id),isLayoutVisible:Ne,initialConnectEnabled:Lt&&Yt,resumeRequestEnabled:Yt,suppressKeyboard:K.suppressKeyboard,keyboardPortalTarget:K.keyboardPortalTarget,sharedMobileKeyboardLayout:K.sharedMobileKeyboardLayout,suppressPageFlipRefresh:K.suppressPageFlipRefresh,focusRequestToken:me?.sessionId===O.id?me.token:0,resumeRequestToken:Ue.token,resumeRequestReason:Ue.reason,forceResumeReconnect:Ue.forceForegroundReconnect&&xn.has(O.id),resumeRequestDelayMs:xn.has(O.id)?0:K.hidden?sd:jr.get(O.id)??sd,initialConnectDelayMs:pt,onStreamReadyChange:_r,onStreamConnected:Un,onViewportReadyChange:Ot,onContentReadyChange:qs,onKeyboardVisibilityChange:He,showDebug:s,onStatusChange:oe?I:void 0})})]},O.id)};return a.jsxs("div",{className:"relative h-full flex flex-col",children:[Tr&&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(g5,{size:18})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-[13px] font-semibold text-foreground",children:Q("tab.tmuxRecoveryTitle",{count:Tr.sessions.length})}),a.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:Q("tab.tmuxRecoveryHint")}),a.jsx("p",{className:"mt-1.5 truncate text-[10px] text-foreground/70",children:Tr.sessions.map(O=>O.name).join(" · ")}),Qe&&a.jsx("p",{className:"mt-2 text-[10px] text-destructive",children:Qe}),a.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[a.jsxs("button",{type:"button",disabled:de!==null,onClick:()=>{en()},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(A5,{size:13,className:de==="restore"?"animate-spin":""}),Q(de==="restore"?"tab.tmuxRecoveryRestoring":"tab.tmuxRecoveryRestoreAll")]}),a.jsx("button",{type:"button",disabled:de!==null,onClick:()=>{qn()},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:Q("tab.tmuxRecoveryDismiss")})]})]})]})}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(uv,{onSwiper:O=>{Je.current=O,O.allowTouchMove=zt.length>1&&!rs&&!Me,xr("[swiper:on-swiper]",{allowTouchMove:O.allowTouchMove}),requestAnimationFrame(()=>nt("on-swiper"))},onSlideChange:tt,onTouchStart:(O,K)=>{const oe=mg(K),Ne=oe==="touch"||oe==="pen"||oe==="unknown";q("[swipe:touch-start]",{pointerType:oe,allowed:Ne}),xr("[swiper:touch-start]",{pointerType:oe,allowed:Ne}),Ne&&(le(),Ht.current=!0,Ze.current=!0)},onTouchEnd:(O,K)=>{const oe=mg(K),Ne=oe==="touch"||oe==="pen"||oe==="unknown";q("[swipe:touch-end]",{pointerType:oe,allowed:Ne}),xr("[swiper:touch-end]",{pointerType:oe,allowed:Ne}),Ne&&(Ht.current=!1,Ge("touch-end"))},onTransitionEnd:()=>{const O=Je.current;if(Ht.current){xr("[swiper:transition-end-during-touch]");return}if(Ze.current&&O&&!CS(O,ve.current)){xr("[swiper:transition-end-deferred]");return}le(),Ze.current=!1,xr("[swiper:transition-end]")},initialSlide:Math.max(0,$),speed:Uf,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:zt.map(O=>{const K=O.workspace,oe=!!K&&O.sessions.length>=2,Ne=Be?ct?"horizontal":"vertical":K?.layout??"horizontal",Tt=Ne==="vertical",Lt=K?.ratios.length===O.sessions.length?K.ratios:ka(O.sessions.length),Yt=qt?O.sessions.findIndex(vr=>vr.id===qt):-1,pt=Be&&qt?O.sessions.some(vr=>vr.id===qt):!1,It=O.sessions.some(vr=>vr.id===V)?V:O.sessions[0]?.id,Hr=Lt.flatMap((vr,Xt)=>[pt&&Xt!==Yt?"0px":`minmax(0, ${vr}fr)`,...Xt<Lt.length-1?[pt?"0px":"1px"]:[]]).join(" "),{columns:yr,rows:Gr}=yx(O.sessions.length),Wr=Hl(K?.gridColumnRatios,yr),on=Hl(K?.gridRowRatios,Gr),Sn=Wr.slice(0,-1).map((vr,Xt)=>Wr.slice(0,Xt+1).reduce((Ut,Mr)=>Ut+Mr,0)),dn=on.slice(0,-1).map((vr,Xt)=>on.slice(0,Xt+1).reduce((Ut,Mr)=>Ut+Mr,0)),ur=O.sessions.length%yr,Wt={...Ne==="grid"?{gridTemplateColumns:Wr.map(vr=>`minmax(0, ${vr}fr)`).join(" "),gridTemplateRows:on.map(vr=>`minmax(0, ${vr}fr)`).join(" "),gap:"1px"}:Tt?{gridTemplateRows:Hr}:{gridTemplateColumns:Hr},...Be?{marginTop:"var(--kb-margin-top, 0px)",transition:"none"}:{}};return a.jsx(dv,{className:"h-full",children:a.jsx("div",{className:"h-full min-w-0","data-pinned-right-sidebar-inset":Ts.get(O.key)??0,style:{paddingRight:Ts.get(O.key)??0,paddingTop:x&&!oe?"2.5rem":void 0},children:oe?a.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--chrome-bg)]",style:Be?{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:Wt,children:[O.sessions.map((vr,Xt)=>a.jsxs(S.Fragment,{children:[hs(vr,{showPaneTitle:!Be,suppressKeyboard:Be&&vr.id!==It,keyboardPortalTarget:Be?vt:null,sharedMobileKeyboardLayout:Be,suppressPageFlipRefresh:!0,hidden:pt&&Yt!==Xt,containerStyle:Ne==="grid"&&ur>0&&Xt===O.sessions.length-1?{gridColumn:`span ${yr-ur+1}`}:void 0}),Ne!=="grid"&&Xt<O.sessions.length-1&&K&&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"} ${pt?"invisible pointer-events-none":""}`,onPointerDownCapture:Ut=>{const Mr=Ut.currentTarget.closest('[data-split-container="true"]');Mr instanceof HTMLDivElement&&sr(Ut,Mr,Tt,K.id,Xt)},onDoubleClick:Ut=>{Be||(Ut.preventDefault(),Ut.stopPropagation(),ue(Mr=>Mr.map(Pr=>Pr.id===K.id?{...Pr,ratios:ka(Pr.sessionIds.length)}:Pr)))},onContextMenu:Ut=>{Be&&Ut.preventDefault()},"aria-label":Q("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}})})]},vr.id)),Ne==="grid"&&K&&Sn.map((vr,Xt)=>a.jsx("button",{type:"button","data-split-grid-column-divider":Xt,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:`${vr*100}%`,bottom:ur===0||Xt<ur-1?0:`${(on.at(-1)??0)*100}%`},onPointerDownCapture:Ut=>{const Mr=Ut.currentTarget.closest('[data-split-container="true"]');Mr instanceof HTMLDivElement&&sr(Ut,Mr,!1,K.id,Xt,"grid-columns",yr)},onDoubleClick:Ut=>{Ut.preventDefault(),Ut.stopPropagation(),ue(Mr=>Mr.map(Pr=>Pr.id===K.id?{...Pr,gridColumnRatios:ka(yr)}:Pr))},"aria-label":Q("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:${Xt}`)),Ne==="grid"&&K&&dn.map((vr,Xt)=>a.jsx("button",{type:"button","data-split-grid-row-divider":Xt,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:`${vr*100}%`},onPointerDownCapture:Ut=>{const Mr=Ut.currentTarget.closest('[data-split-container="true"]');Mr instanceof HTMLDivElement&&sr(Ut,Mr,!0,K.id,Xt,"grid-rows",Gr)},onDoubleClick:Ut=>{Ut.preventDefault(),Ut.stopPropagation(),ue(Mr=>Mr.map(Pr=>Pr.id===K.id?{...Pr,gridRowRatios:ka(Gr)}:Pr))},"aria-label":Q("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:${Xt}`))]}),Be&&a.jsx("div",{ref:_t,className:"relative shrink-0 app-chrome-bg","data-split-keyboard-host":"true"})]}):hs(O.sessions[0])})},O.key)})})}),Me&&V&&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:()=>et(!1),"aria-label":Q("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":Q("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(Fl,{size:17})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:Q("tab.splitTitle")}),a.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-muted-foreground",children:Q("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:()=>et(!1),"aria-label":Q("common.close"),children:a.jsx(ys,{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:ft,onClick:()=>{hr()},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(zi,{size:17})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block text-[13px] font-medium text-foreground",children:Q("tab.splitNew")}),a.jsx("span",{className:"mt-0.5 block text-[11px] text-muted-foreground",children:Q("tab.splitNewHint")})]})]}),qe.filter(O=>O.id!==zr?.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:Q("tab.splitExistingGroups")}),qe.filter(O=>O.id!==zr?.id).map((O,K)=>{const oe=O.sessionIds.flatMap(Lt=>{const Yt=P.find(pt=>pt.id===Lt);return Yt?[Yt]:[]});if(oe.length<2)return null;const Ne=O.name||`${Q("tab.splitWorkspace")} ${K+1}`,Tt=oe.map(Lt=>Xr(Lt).primary).join(" · ");return a.jsxs("button",{type:"button",onClick:()=>ut(oe[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(Fl,{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:Ne}),a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:Q("tab.splitOccupied")})]}),a.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[Q("tab.sessionCount",{count:oe.length})," · ",Tt]})]}),a.jsx(na,{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:Q("tab.splitAvailableSessions")}),P.filter(O=>!qe.some(K=>K.sessionIds.includes(O.id))&&O.id!==V).length===0&&qe.filter(O=>O.id!==zr?.id).length===0?a.jsx("p",{className:"px-3 py-4 text-[12px] text-muted-foreground",children:Q("tab.splitNoOtherSessions")}):P.filter(O=>!qe.some(K=>K.sessionIds.includes(O.id))&&O.id!==V).map(O=>{const K=Rr.get(O.id)??null,oe=Xr(O);return a.jsxs("button",{type:"button",onClick:()=>ut(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:K?a.jsx(ql,{size:15}):a.jsx(Fl,{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:oe.primary}),a.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:K?Pc(K)??K:O.name})]}),a.jsx(na,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},O.id)})]})]})]}),bt&&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:bt})]})},ES={sm:"h-4 w-7",md:"h-6 w-10"},MS={sm:"h-3 w-3",md:"h-5 w-5"},RS={sm:"translate-x-3",md:"translate-x-4"};function za({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 ${ES[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 ${MS[r]} ${e?RS[r]:""}`})})}function Ui(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 NS=typeof Symbol=="function"&&Symbol.observable||"@@observable",xg=NS,bg=()=>Math.random().toString(36).substring(7).split("").join("."),DS={INIT:`@@redux/INIT${bg()}`,REPLACE:`@@redux/REPLACE${bg()}`},yg=DS;function QS(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 Cx(e,t,r){if(typeof e!="function")throw new Error(Ui(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ui(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ui(1));return r(Cx)(e,t)}let s=e,o=t,c=new Map,u=c,f=0,m=!1;function g(){u===c&&(u=new Map,c.forEach((N,R)=>{u.set(R,N)}))}function b(){if(m)throw new Error(Ui(3));return o}function x(N){if(typeof N!="function")throw new Error(Ui(4));if(m)throw new Error(Ui(5));let R=!0;g();const Q=f++;return u.set(Q,N),function(){if(R){if(m)throw new Error(Ui(6));R=!1,g(),u.delete(Q),c=null}}}function v(N){if(!QS(N))throw new Error(Ui(7));if(typeof N.type>"u")throw new Error(Ui(8));if(typeof N.type!="string")throw new Error(Ui(17));if(m)throw new Error(Ui(9));try{m=!0,o=s(o,N)}finally{m=!1}return(c=u).forEach(Q=>{Q()}),N}function w(N){if(typeof N!="function")throw new Error(Ui(10));s=N,v({type:yg.REPLACE})}function I(){const N=x;return{subscribe(R){if(typeof R!="object"||R===null)throw new Error(Ui(11));function Q(){const q=R;q.next&&q.next(b())}return Q(),{unsubscribe:N(Q)}},[xg](){return this}}}return v({type:yg.INIT}),{dispatch:v,subscribe:x,getState:b,replaceReducer:w,[xg]:I}}function vg(e,t){return function(...r){return t(e.apply(this,r))}}function wg(e,t){if(typeof e=="function")return vg(e,t);if(typeof e!="object"||e===null)throw new Error(Ui(16));const r={};for(const s in e){const o=e[s];typeof o=="function"&&(r[s]=vg(o,t))}return r}function _x(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...s)=>t(r(...s)))}function BS(...e){return t=>(r,s)=>{const o=t(r,s);let c=()=>{throw new Error(Ui(15))};const u={getState:o.getState,dispatch:(m,...g)=>c(m,...g)},f=e.map(m=>m(u));return c=_x(...f)(o.dispatch),{...o,dispatch:c}}}var Kh={exports:{}},Xh={};var Ag;function jS(){if(Ag)return Xh;Ag=1;var e=Av();function t(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var r=typeof Object.is=="function"?Object.is:t,s=e.useSyncExternalStore,o=e.useRef,c=e.useEffect,u=e.useMemo,f=e.useDebugValue;return Xh.useSyncExternalStoreWithSelector=function(m,g,b,x,v){var w=o(null);if(w.current===null){var I={hasValue:!1,value:null};w.current=I}else I=w.current;w=u(function(){function N(P){if(!R){if(R=!0,Q=P,P=x(P),v!==void 0&&I.hasValue){var Z=I.value;if(v(Z,P))return F=Z}return F=P}if(Z=F,r(Q,P))return Z;var V=x(P);return v!==void 0&&v(Z,V)?(Q=P,Z):(Q=P,F=V)}var R=!1,Q,F,q=b===void 0?null:b;return[function(){return N(g())},q===null?void 0:function(){return N(q())}]},[g,b,x,v]);var k=s(m,w[0],w[1]);return c(function(){I.hasValue=!0,I.value=k},[k]),f(k),k},Xh}var Tg;function PS(){return Tg||(Tg=1,Kh.exports=jS()),Kh.exports}PS();var OS=T.version.startsWith("19"),FS=Symbol.for(OS?"react.transitional.element":"react.element"),US=Symbol.for("react.portal"),$S=Symbol.for("react.fragment"),zS=Symbol.for("react.strict_mode"),HS=Symbol.for("react.profiler"),GS=Symbol.for("react.consumer"),WS=Symbol.for("react.context"),Sx=Symbol.for("react.forward_ref"),VS=Symbol.for("react.suspense"),qS=Symbol.for("react.suspense_list"),Tp=Symbol.for("react.memo"),ZS=Symbol.for("react.lazy"),YS=Sx,KS=Tp;function XS(e){if(typeof e=="object"&&e!==null){const{$$typeof:t}=e;switch(t){case FS:switch(e=e.type,e){case $S:case HS:case zS:case VS:case qS:return e;default:switch(e=e&&e.$$typeof,e){case WS:case Sx:case ZS:case Tp:return e;case GS:return e;default:return t}}case US:return t}}}function JS(e){return XS(e)===Tp}function eL(e,t,r,s,{areStatesEqual:o,areOwnPropsEqual:c,areStatePropsEqual:u}){let f=!1,m,g,b,x,v;function w(Q,F){return m=Q,g=F,b=e(m,g),x=t(s,g),v=r(b,x,g),f=!0,v}function I(){return b=e(m,g),t.dependsOnOwnProps&&(x=t(s,g)),v=r(b,x,g),v}function k(){return e.dependsOnOwnProps&&(b=e(m,g)),t.dependsOnOwnProps&&(x=t(s,g)),v=r(b,x,g),v}function N(){const Q=e(m,g),F=!u(Q,b);return b=Q,F&&(v=r(b,x,g)),v}function R(Q,F){const q=!c(F,g),P=!o(Q,m,F,g);return m=Q,g=F,q&&P?I():q?k():P?N():v}return function(F,q){return f?R(F,q):w(F,q)}}function tL(e,{initMapStateToProps:t,initMapDispatchToProps:r,initMergeProps:s,...o}){const c=t(e,o),u=r(e,o),f=s(e,o);return eL(c,u,f,e,o)}function rL(e,t){const r={};for(const s in e){const o=e[s];typeof o=="function"&&(r[s]=(...c)=>t(o(...c)))}return r}function Hf(e){return function(r){const s=e(r);function o(){return s}return o.dependsOnOwnProps=!1,o}}function Cg(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:e.length!==1}function Lx(e,t){return function(s,{displayName:o}){const c=function(f,m){return c.dependsOnOwnProps?c.mapToProps(f,m):c.mapToProps(f,void 0)};return c.dependsOnOwnProps=!0,c.mapToProps=function(f,m){c.mapToProps=e,c.dependsOnOwnProps=Cg(e);let g=c(f,m);return typeof g=="function"&&(c.mapToProps=g,c.dependsOnOwnProps=Cg(g),g=c(f,m)),g},c}}function Cp(e,t){return(r,s)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${s.wrappedComponentName}.`)}}function nL(e){return e&&typeof e=="object"?Hf(t=>rL(e,t)):e?typeof e=="function"?Lx(e):Cp(e,"mapDispatchToProps"):Hf(t=>({dispatch:t}))}function sL(e){return e?typeof e=="function"?Lx(e):Cp(e,"mapStateToProps"):Hf(()=>({}))}function iL(e,t,r){return{...r,...e,...t}}function oL(e){return function(r,{displayName:s,areMergedPropsEqual:o}){let c=!1,u;return function(m,g,b){const x=e(m,g,b);return c?o(x,u)||(u=x):(c=!0,u=x),u}}}function aL(e){return e?typeof e=="function"?oL(e):Cp(e,"mergeProps"):()=>iL}function lL(e){e()}function cL(){let e=null,t=null;return{clear(){e=null,t=null},notify(){lL(()=>{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 o=t={callback:r,next:null,prev:t};return o.prev?o.prev.next=o:e=o,function(){!s||e===null||(s=!1,o.next?o.next.prev=o.prev:t=o.prev,o.prev?o.prev.next=o.next:e=o.next)}}}}var _g={notify(){},get:()=>[]};function Ix(e,t){let r,s=_g,o=0,c=!1;function u(k){b();const N=s.subscribe(k);let R=!1;return()=>{R||(R=!0,N(),x())}}function f(){s.notify()}function m(){I.onStateChange&&I.onStateChange()}function g(){return c}function b(){o++,r||(r=t?t.addNestedSub(m):e.subscribe(m),s=cL())}function x(){o--,r&&o===0&&(r(),r=void 0,s.clear(),s=_g)}function v(){c||(c=!0,b())}function w(){c&&(c=!1,x())}const I={addNestedSub:u,notifyNestedSubs:f,handleChangeWrapper:m,isSubscribed:g,trySubscribe:v,tryUnsubscribe:w,getListeners:()=>s};return I}var uL=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",dL=uL(),hL=()=>typeof navigator<"u"&&navigator.product==="ReactNative",fL=hL(),pL=()=>dL||fL?T.useLayoutEffect:T.useEffect,xd=pL();function Sg(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function Jh(e,t){if(Sg(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 o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(t,r[o])||!Sg(e[r[o]],t[r[o]]))return!1;return!0}var mL={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},gL={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},xL={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},kx={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},bL={[YS]:xL,[KS]:kx};function Lg(e){return JS(e)?kx:bL[e.$$typeof]||mL}var yL=Object.defineProperty,vL=Object.getOwnPropertyNames,Ig=Object.getOwnPropertySymbols,wL=Object.getOwnPropertyDescriptor,AL=Object.getPrototypeOf,kg=Object.prototype;function Gf(e,t){if(typeof t!="string"){if(kg){const c=AL(t);c&&c!==kg&&Gf(e,c)}let r=vL(t);Ig&&(r=r.concat(Ig(t)));const s=Lg(e),o=Lg(t);for(let c=0;c<r.length;++c){const u=r[c];if(!gL[u]&&!(o&&o[u])&&!(s&&s[u])){const f=wL(t,u);try{yL(e,u,f)}catch{}}}}return e}var TL=Symbol.for("react-redux-context"),CL=typeof globalThis<"u"?globalThis:{};function _L(){if(!T.createContext)return{};const e=CL[TL]??=new Map;let t=e.get(T.createContext);return t||(t=T.createContext(null),e.set(T.createContext,t)),t}var Ex=_L(),SL=[null,null];function LL(e,t,r){xd(()=>e(...t),r)}function IL(e,t,r,s,o,c){e.current=s,r.current=!1,o.current&&(o.current=null,c())}function kL(e,t,r,s,o,c,u,f,m,g,b){if(!e)return()=>{};let x=!1,v=null;const w=()=>{if(x||!f.current)return;const k=t.getState();let N,R;try{N=s(k,o.current)}catch(Q){R=Q,v=Q}R||(v=null),N===c.current?u.current||g():(c.current=N,m.current=N,u.current=!0,b())};return r.onStateChange=w,r.trySubscribe(),w(),()=>{if(x=!0,r.tryUnsubscribe(),r.onStateChange=null,v)throw v}}function EL(e,t){return e===t}function ML(e,t,r,{pure:s,areStatesEqual:o=EL,areOwnPropsEqual:c=Jh,areStatePropsEqual:u=Jh,areMergedPropsEqual:f=Jh,forwardRef:m=!1,context:g=Ex}={}){const b=g,x=sL(e),v=nL(t),w=aL(r),I=!!e;return N=>{const R=N.displayName||N.name||"Component",Q=`Connect(${R})`,F={shouldHandleStateChanges:I,displayName:Q,wrappedComponentName:R,WrappedComponent:N,initMapStateToProps:x,initMapDispatchToProps:v,initMergeProps:w,areStatesEqual:o,areStatePropsEqual:u,areOwnPropsEqual:c,areMergedPropsEqual:f};function q(V){const[fe,_e,De]=T.useMemo(()=>{const{reactReduxForwardedRef:qe,...ue}=V;return[V.context,qe,ue]},[V]),be=T.useMemo(()=>{let qe=b;return fe?.Consumer,qe},[fe,b]),st=T.useContext(be),Ue=!!V.store&&!!V.store.getState&&!!V.store.dispatch,Ee=!!st&&!!st.store,ht=Ue?V.store:st.store,Ve=Ee?st.getServerState:ht.getState,he=T.useMemo(()=>tL(ht.dispatch,F),[ht]),[Oe,ie]=T.useMemo(()=>{if(!I)return SL;const qe=Ix(ht,Ue?void 0:st.subscription),ue=qe.notifyNestedSubs.bind(qe);return[qe,ue]},[ht,Ue,st]),Le=T.useMemo(()=>Ue?st:{...st,subscription:Oe},[Ue,st,Oe]),Xe=T.useRef(void 0),re=T.useRef(De),ge=T.useRef(void 0),Qt=T.useRef(!1),Rt=T.useRef(!1),We=T.useRef(void 0);xd(()=>(Rt.current=!0,()=>{Rt.current=!1}),[]);const W=T.useMemo(()=>()=>ge.current&&De===re.current?ge.current:he(ht.getState(),De),[ht,De]),Je=T.useMemo(()=>ue=>Oe?kL(I,ht,Oe,he,re,Xe,Qt,Rt,ge,ie,ue):()=>{},[Oe]);LL(IL,[re,Xe,Qt,De,ge,ie]);let Se;try{Se=T.useSyncExternalStore(Je,W,Ve?()=>he(Ve(),De):W)}catch(qe){throw We.current&&(qe.message+=`
70
+ The error may be correlated with this previous error:
71
+ ${We.current.stack}
72
+
73
+ `),qe}xd(()=>{We.current=void 0,ge.current=void 0,Xe.current=Se});const me=T.useMemo(()=>T.createElement(N,{...Se,ref:_e}),[_e,N,Se]);return T.useMemo(()=>I?T.createElement(be.Provider,{value:Le},me):me,[be,me,Le])}const Z=T.memo(q);if(Z.WrappedComponent=N,Z.displayName=q.displayName=Q,m){const fe=T.forwardRef(function(De,be){return T.createElement(Z,{...De,reactReduxForwardedRef:be})});return fe.displayName=Q,fe.WrappedComponent=N,Gf(fe,N)}return Gf(Z,N)}}var Mx=ML;function RL(e){const{children:t,context:r,serverState:s,store:o}=e,c=T.useMemo(()=>{const m=Ix(o);return{store:o,subscription:m,getServerState:s?()=>s:void 0}},[o,s]),u=T.useMemo(()=>o.getState(),[o]);xd(()=>{const{subscription:m}=c;return m.onStateChange=m.notifyNestedSubs,m.trySubscribe(),u!==o.getState()&&m.notifyNestedSubs(),()=>{m.tryUnsubscribe(),m.onStateChange=void 0}},[c,u]);const f=r||Ex;return T.createElement(f.Provider,{value:c},t)}var NL=RL,DL="Invariant failed";function QL(e,t){throw new Error(DL)}var ra=function(t){var r=t.top,s=t.right,o=t.bottom,c=t.left,u=s-c,f=o-r,m={top:r,right:s,bottom:o,left:c,width:u,height:f,x:c,y:r,center:{x:(s+c)/2,y:(o+r)/2}};return m},_p=function(t,r){return{top:t.top-r.top,left:t.left-r.left,bottom:t.bottom+r.bottom,right:t.right+r.right}},Eg=function(t,r){return{top:t.top+r.top,left:t.left+r.left,bottom:t.bottom-r.bottom,right:t.right-r.right}},BL=function(t,r){return{top:t.top+r.y,left:t.left+r.x,bottom:t.bottom+r.y,right:t.right+r.x}},ef={top:0,right:0,bottom:0,left:0},Sp=function(t){var r=t.borderBox,s=t.margin,o=s===void 0?ef:s,c=t.border,u=c===void 0?ef:c,f=t.padding,m=f===void 0?ef:f,g=ra(_p(r,o)),b=ra(Eg(r,u)),x=ra(Eg(b,m));return{marginBox:g,borderBox:ra(r),paddingBox:b,contentBox:x,margin:o,border:u,padding:m}},Ro=function(t){var r=t.slice(0,-2),s=t.slice(-2);if(s!=="px")return 0;var o=Number(r);return isNaN(o)&&QL(),o},jL=function(){return{x:window.pageXOffset,y:window.pageYOffset}},bd=function(t,r){var s=t.borderBox,o=t.border,c=t.margin,u=t.padding,f=BL(s,r);return Sp({borderBox:f,border:o,margin:c,padding:u})},yd=function(t,r){return r===void 0&&(r=jL()),bd(t,r)},Rx=function(t,r){var s={top:Ro(r.marginTop),right:Ro(r.marginRight),bottom:Ro(r.marginBottom),left:Ro(r.marginLeft)},o={top:Ro(r.paddingTop),right:Ro(r.paddingRight),bottom:Ro(r.paddingBottom),left:Ro(r.paddingLeft)},c={top:Ro(r.borderTopWidth),right:Ro(r.borderRightWidth),bottom:Ro(r.borderBottomWidth),left:Ro(r.borderLeftWidth)};return Sp({borderBox:t,margin:s,padding:o,border:c})},Nx=function(t){var r=t.getBoundingClientRect(),s=window.getComputedStyle(t);return Rx(r,s)},Vc=function(t){var r=[],s=null,o=function(){for(var u=arguments.length,f=new Array(u),m=0;m<u;m++)f[m]=arguments[m];r=f,!s&&(s=requestAnimationFrame(function(){s=null,t.apply(void 0,r)}))};return o.cancel=function(){s&&(cancelAnimationFrame(s),s=null)},o};function vd(){return vd=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},vd.apply(null,arguments)}function Dx(e,t){}Dx.bind(null,"warn");Dx.bind(null,"error");function yl(){}function PL(e,t){return{...e,...t}}function jo(e,t,r){const s=t.map(o=>{const c=PL(r,o.options);return e.addEventListener(o.eventName,o.fn,c),function(){e.removeEventListener(o.eventName,o.fn,c)}});return function(){s.forEach(c=>{c()})}}const OL="Invariant failed";class wd extends Error{}wd.prototype.toString=function(){return this.message};function yt(e,t){throw new wd(OL)}class FL extends S.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=yl,this.onWindowError=r=>{const s=this.getCallbacks();s.isDragging()&&s.tryAbort(),r.error instanceof wd&&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=jo(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof wd){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const UL=`
74
+ Press space bar to start a drag.
75
+ When dragging you can use the arrow keys to move the item around and escape to cancel.
76
+ Some screen readers may require you to be in focus mode or to use your pass through key
77
+ `,Ad=e=>e+1,$L=e=>`
78
+ You have lifted an item in position ${Ad(e.source.index)}
79
+ `,Qx=(e,t)=>{const r=e.droppableId===t.droppableId,s=Ad(e.index),o=Ad(t.index);return r?`
80
+ You have moved the item from position ${s}
81
+ to position ${o}
82
+ `:`
83
+ You have moved the item from position ${s}
84
+ in list ${e.droppableId}
85
+ to list ${t.droppableId}
86
+ in position ${o}
87
+ `},Bx=(e,t,r)=>t.droppableId===r.droppableId?`
88
+ The item ${e}
89
+ has been combined with ${r.draggableId}`:`
90
+ The item ${e}
91
+ in list ${t.droppableId}
92
+ has been combined with ${r.draggableId}
93
+ in list ${r.droppableId}
94
+ `,zL=e=>{const t=e.destination;if(t)return Qx(e.source,t);const r=e.combine;return r?Bx(e.draggableId,e.source,r):"You are over an area that cannot be dropped on"},Mg=e=>`
95
+ The item has returned to its starting position
96
+ of ${Ad(e.index)}
97
+ `,HL=e=>{if(e.reason==="CANCEL")return`
98
+ Movement cancelled.
99
+ ${Mg(e.source)}
100
+ `;const t=e.destination,r=e.combine;return t?`
101
+ You have dropped the item.
102
+ ${Qx(e.source,t)}
103
+ `:r?`
104
+ You have dropped the item.
105
+ ${Bx(e.draggableId,e.source,r)}
106
+ `:`
107
+ The item has been dropped while not over a drop area.
108
+ ${Mg(e.source)}
109
+ `},id={dragHandleUsageInstructions:UL,onDragStart:$L,onDragUpdate:zL,onDragEnd:HL};function GL(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function jx(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!GL(e[r],t[r]))return!1;return!0}function Jr(e,t){const r=T.useState(()=>({inputs:t,result:e()}))[0],s=T.useRef(!0),o=T.useRef(r),u=s.current||!!(t&&o.current.inputs&&jx(t,o.current.inputs))?o.current:{inputs:t,result:e()};return T.useEffect(()=>{s.current=!1,o.current=u},[u]),u.result}function ir(e,t){return Jr(()=>e,t)}const ai={x:0,y:0},yi=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),ho=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),vl=(e,t)=>e.x===t.x&&e.y===t.y,z0=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),Yl=(e,t,r=0)=>e==="x"?{x:t,y:r}:{x:r,y:t},qc=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),Rg=(e,t)=>Math.min(...t.map(r=>qc(e,r))),Px=e=>t=>({x:e(t.x),y:e(t.y)});var WL=(e,t)=>{const r=ra({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 nu=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),Ng=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}],VL={top:0,right:0,bottom:0,left:0},qL=(e,t)=>t?nu(e,t.scroll.diff.displacement):e,ZL=(e,t,r)=>r&&r.increasedBy?{...e,[t.end]:e[t.end]+r.increasedBy[t.line]}:e,YL=(e,t)=>t&&t.shouldClipSubject?WL(t.pageMarginBox,e):ra(e);var B0=({page:e,withPlaceholder:t,axis:r,frame:s})=>{const o=qL(e.marginBox,s),c=ZL(o,r,t),u=YL(c,s);return{page:e,withPlaceholder:t,active:u}},Lp=(e,t)=>{e.frame||yt();const r=e.frame,s=ho(t,r.scroll.initial),o=z0(s),c={...r,scroll:{initial:r.scroll.initial,current:t,diff:{value:s,displacement:o},max:r.scroll.max}},u=B0({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:c});return{...e,frame:c,subject:u}};function oi(e,t=jx){let r=null;function s(...o){if(r&&r.lastThis===this&&t(o,r.lastArgs))return r.lastResult;const c=e.apply(this,o);return r={lastResult:c,lastArgs:o,lastThis:this},c}return s.clear=function(){r=null},s}const Ox=oi(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),Fx=oi(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),Pd=oi(e=>Object.values(e)),KL=oi(e=>Object.values(e));var H0=oi((e,t)=>KL(t).filter(s=>e===s.descriptor.droppableId).sort((s,o)=>s.descriptor.index-o.descriptor.index));function Ip(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function Od(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var Fd=oi((e,t)=>t.filter(r=>r.descriptor.id!==e.descriptor.id)),XL=({isMovingForward:e,draggable:t,destination:r,insideDestination:s,previousImpact:o})=>{if(!r.isCombineEnabled||!Ip(o))return null;function u(w){const I={type:"COMBINE",combine:{draggableId:w,droppableId:r.descriptor.id}};return{...o,at:I}}const f=o.displaced.all,m=f.length?f[0]:null;if(e)return m?u(m):null;const g=Fd(t,s);if(!m){if(!g.length)return null;const w=g[g.length-1];return u(w.descriptor.id)}const b=g.findIndex(w=>w.descriptor.id===m);b===-1&&yt();const x=b-1;if(x<0)return null;const v=g[x];return u(v.descriptor.id)},G0=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const Ux={point:ai,value:0},Zc={invisible:{},visible:{},all:[]},JL={displaced:Zc,displacedBy:Ux,at:null};var Oo=(e,t)=>r=>e<=r&&r<=t,$x=e=>{const t=Oo(e.top,e.bottom),r=Oo(e.left,e.right);return s=>{if(t(s.top)&&t(s.bottom)&&r(s.left)&&r(s.right))return!0;const c=t(s.top)||t(s.bottom),u=r(s.left)||r(s.right);if(c&&u)return!0;const m=s.top<e.top&&s.bottom>e.bottom,g=s.left<e.left&&s.right>e.right;return m&&g?!0:m&&u||g&&c}},eI=e=>{const t=Oo(e.top,e.bottom),r=Oo(e.left,e.right);return s=>t(s.top)&&t(s.bottom)&&r(s.left)&&r(s.right)};const kp={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},zx={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var tI=e=>t=>{const r=Oo(t.top,t.bottom),s=Oo(t.left,t.right);return o=>e===kp?r(o.top)&&r(o.bottom):s(o.left)&&s(o.right)};const rI=(e,t)=>{const r=t.frame?t.frame.scroll.diff.displacement:ai;return nu(e,r)},nI=(e,t,r)=>t.subject.active?r(t.subject.active)(e):!1,sI=(e,t,r)=>r(t)(e),Ep=({target:e,destination:t,viewport:r,withDroppableDisplacement:s,isVisibleThroughFrameFn:o})=>{const c=s?rI(e,t):e;return nI(c,t,o)&&sI(c,r,o)},iI=e=>Ep({...e,isVisibleThroughFrameFn:$x}),Hx=e=>Ep({...e,isVisibleThroughFrameFn:eI}),oI=e=>Ep({...e,isVisibleThroughFrameFn:tI(e.destination.axis)}),aI=(e,t,r)=>{if(typeof r=="boolean")return r;if(!t)return!0;const{invisible:s,visible:o}=t;if(s[e])return!1;const c=o[e];return c?c.shouldAnimate:!0};function lI(e,t){const r=e.page.marginBox,s={top:t.point.y,right:0,bottom:0,left:t.point.x};return ra(_p(r,s))}function Yc({afterDragging:e,destination:t,displacedBy:r,viewport:s,forceShouldAnimate:o,last:c}){return e.reduce(function(f,m){const g=lI(m,r),b=m.descriptor.id;if(f.all.push(b),!iI({target:g,destination:t,viewport:s,withDroppableDisplacement:!0}))return f.invisible[m.descriptor.id]=!0,f;const v=aI(b,c,o),w={draggableId:b,shouldAnimate:v};return f.visible[b]=w,f},{all:[],visible:{},invisible:{}})}function cI(e,t){if(!e.length)return 0;const r=e[e.length-1].descriptor.index;return t.inHomeList?r:r+1}function Dg({insideDestination:e,inHomeList:t,displacedBy:r,destination:s}){const o=cI(e,{inHomeList:t});return{displaced:Zc,displacedBy:r,at:{type:"REORDER",destination:{droppableId:s.descriptor.id,index:o}}}}function Td({draggable:e,insideDestination:t,destination:r,viewport:s,displacedBy:o,last:c,index:u,forceShouldAnimate:f}){const m=G0(e,r);if(u==null)return Dg({insideDestination:t,inHomeList:m,displacedBy:o,destination:r});const g=t.find(I=>I.descriptor.index===u);if(!g)return Dg({insideDestination:t,inHomeList:m,displacedBy:o,destination:r});const b=Fd(e,t),x=t.indexOf(g),v=b.slice(x);return{displaced:Yc({afterDragging:v,destination:r,displacedBy:o,last:c,viewport:s.frame,forceShouldAnimate:f}),displacedBy:o,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:u}}}}function wl(e,t){return!!t.effected[e]}var uI=({isMovingForward:e,destination:t,draggables:r,combine:s,afterCritical:o})=>{if(!t.isCombineEnabled)return null;const c=s.draggableId,f=r[c].descriptor.index;return wl(c,o)?e?f:f-1:e?f+1:f},dI=({isMovingForward:e,isInHomeList:t,insideDestination:r,location:s})=>{if(!r.length)return null;const o=s.index,c=e?o+1:o-1,u=r[0].descriptor.index,f=r[r.length-1].descriptor.index,m=t?f:f+1;return c<u||c>m?null:c},hI=({isMovingForward:e,isInHomeList:t,draggable:r,draggables:s,destination:o,insideDestination:c,previousImpact:u,viewport:f,afterCritical:m})=>{const g=u.at;if(g||yt(),g.type==="REORDER"){const x=dI({isMovingForward:e,isInHomeList:t,location:g.destination,insideDestination:c});return x==null?null:Td({draggable:r,insideDestination:c,destination:o,viewport:f,last:u.displaced,displacedBy:u.displacedBy,index:x})}const b=uI({isMovingForward:e,destination:o,displaced:u.displaced,draggables:s,combine:g.combine,afterCritical:m});return b==null?null:Td({draggable:r,insideDestination:c,destination:o,viewport:f,last:u.displaced,displacedBy:u.displacedBy,index:b})},fI=({displaced:e,afterCritical:t,combineWith:r,displacedBy:s})=>{const o=!!(e.visible[r]||e.invisible[r]);return wl(r,t)?o?ai:z0(s.point):o?s.point:ai},pI=({afterCritical:e,impact:t,draggables:r})=>{const s=Od(t);s||yt();const o=s.draggableId,c=r[o].page.borderBox.center,u=fI({displaced:t.displaced,afterCritical:e,combineWith:o,displacedBy:t.displacedBy});return yi(c,u)};const Gx=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,mI=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,Mp=(e,t,r)=>t[e.crossAxisStart]+r.margin[e.crossAxisStart]+r.borderBox[e.crossAxisSize]/2,Qg=({axis:e,moveRelativeTo:t,isMoving:r})=>Yl(e.line,t.marginBox[e.end]+Gx(e,r),Mp(e,t.marginBox,r)),Bg=({axis:e,moveRelativeTo:t,isMoving:r})=>Yl(e.line,t.marginBox[e.start]-mI(e,r),Mp(e,t.marginBox,r)),gI=({axis:e,moveInto:t,isMoving:r})=>Yl(e.line,t.contentBox[e.start]+Gx(e,r),Mp(e,t.contentBox,r));var xI=({impact:e,draggable:t,draggables:r,droppable:s,afterCritical:o})=>{const c=H0(s.descriptor.id,r),u=t.page,f=s.axis;if(!c.length)return gI({axis:f,moveInto:s.page,isMoving:u});const{displaced:m,displacedBy:g}=e,b=m.all[0];if(b){const v=r[b];if(wl(b,o))return Bg({axis:f,moveRelativeTo:v.page,isMoving:u});const w=bd(v.page,g.point);return Bg({axis:f,moveRelativeTo:w,isMoving:u})}const x=c[c.length-1];if(x.descriptor.id===t.descriptor.id)return u.borderBox.center;if(wl(x.descriptor.id,o)){const v=bd(x.page,z0(o.displacedBy.point));return Qg({axis:f,moveRelativeTo:v,isMoving:u})}return Qg({axis:f,moveRelativeTo:x.page,isMoving:u})},Wf=(e,t)=>{const r=e.frame;return r?yi(t,r.scroll.diff.displacement):t};const bI=({impact:e,draggable:t,droppable:r,draggables:s,afterCritical:o})=>{const c=t.page.borderBox.center,u=e.at;return!r||!u?c:u.type==="REORDER"?xI({impact:e,draggable:t,draggables:s,droppable:r,afterCritical:o}):pI({impact:e,draggables:s,afterCritical:o})};var Ud=e=>{const t=bI(e),r=e.droppable;return r?Wf(r,t):t},Wx=(e,t)=>{const r=ho(t,e.scroll.initial),s=z0(r);return{frame:ra({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 jg(e,t){return e.map(r=>t[r])}function yI(e,t){for(let r=0;r<t.length;r++){const s=t[r].visible[e];if(s)return s}return null}var vI=({impact:e,viewport:t,destination:r,draggables:s,maxScrollChange:o})=>{const c=Wx(t,yi(t.scroll.current,o)),u=r.frame?Lp(r,yi(r.frame.scroll.current,o)):r,f=e.displaced,m=Yc({afterDragging:jg(f.all,s),destination:r,displacedBy:e.displacedBy,viewport:c.frame,last:f,forceShouldAnimate:!1}),g=Yc({afterDragging:jg(f.all,s),destination:u,displacedBy:e.displacedBy,viewport:t.frame,last:f,forceShouldAnimate:!1}),b={},x={},v=[f,m,g];return f.all.forEach(I=>{const k=yI(I,v);if(k){x[I]=k;return}b[I]=!0}),{...e,displaced:{all:f.all,invisible:b,visible:x}}},wI=(e,t)=>yi(e.scroll.diff.displacement,t),Rp=({pageBorderBoxCenter:e,draggable:t,viewport:r})=>{const s=wI(r,e),o=ho(s,t.page.borderBox.center);return yi(t.client.borderBox.center,o)},Vx=({draggable:e,destination:t,newPageBorderBoxCenter:r,viewport:s,withDroppableDisplacement:o,onlyOnMainAxis:c=!1})=>{const u=ho(r,e.page.borderBox.center),m={target:nu(e.page.borderBox,u),destination:t,withDroppableDisplacement:o,viewport:s};return c?oI(m):Hx(m)},AI=({isMovingForward:e,draggable:t,destination:r,draggables:s,previousImpact:o,viewport:c,previousPageBorderBoxCenter:u,previousClientSelection:f,afterCritical:m})=>{if(!r.isEnabled)return null;const g=H0(r.descriptor.id,s),b=G0(t,r),x=XL({isMovingForward:e,draggable:t,destination:r,insideDestination:g,previousImpact:o})||hI({isMovingForward:e,isInHomeList:b,draggable:t,draggables:s,destination:r,insideDestination:g,previousImpact:o,viewport:c,afterCritical:m});if(!x)return null;const v=Ud({impact:x,draggable:t,droppable:r,draggables:s,afterCritical:m});if(Vx({draggable:t,destination:r,newPageBorderBoxCenter:v,viewport:c.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:Rp({pageBorderBoxCenter:v,draggable:t,viewport:c}),impact:x,scrollJumpRequest:null};const I=ho(v,u),k=vI({impact:x,viewport:c,destination:r,draggables:s,maxScrollChange:I});return{clientSelection:f,impact:k,scrollJumpRequest:I}};const Pi=e=>{const t=e.subject.active;return t||yt(),t};var TI=({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:s,viewport:o})=>{const c=r.subject.active;if(!c)return null;const u=r.axis,f=Oo(c[u.start],c[u.end]),m=Pd(s).filter(b=>b!==r).filter(b=>b.isEnabled).filter(b=>!!b.subject.active).filter(b=>$x(o.frame)(Pi(b))).filter(b=>{const x=Pi(b);return e?c[u.crossAxisEnd]<x[u.crossAxisEnd]:x[u.crossAxisStart]<c[u.crossAxisStart]}).filter(b=>{const x=Pi(b),v=Oo(x[u.start],x[u.end]);return f(x[u.start])||f(x[u.end])||v(c[u.start])||v(c[u.end])}).sort((b,x)=>{const v=Pi(b)[u.crossAxisStart],w=Pi(x)[u.crossAxisStart];return e?v-w:w-v}).filter((b,x,v)=>Pi(b)[u.crossAxisStart]===Pi(v[0])[u.crossAxisStart]);if(!m.length)return null;if(m.length===1)return m[0];const g=m.filter(b=>Oo(Pi(b)[u.start],Pi(b)[u.end])(t[u.line]));return g.length===1?g[0]:g.length>1?g.sort((b,x)=>Pi(b)[u.start]-Pi(x)[u.start])[0]:m.sort((b,x)=>{const v=Rg(t,Ng(Pi(b))),w=Rg(t,Ng(Pi(x)));return v!==w?v-w:Pi(b)[u.start]-Pi(x)[u.start]})[0]};const Pg=(e,t)=>{const r=e.page.borderBox.center;return wl(e.descriptor.id,t)?ho(r,t.displacedBy.point):r},CI=(e,t)=>{const r=e.page.borderBox;return wl(e.descriptor.id,t)?nu(r,z0(t.displacedBy.point)):r};var _I=({pageBorderBoxCenter:e,viewport:t,destination:r,insideDestination:s,afterCritical:o})=>s.filter(u=>Hx({target:CI(u,o),destination:r,viewport:t.frame,withDroppableDisplacement:!0})).sort((u,f)=>{const m=qc(e,Wf(r,Pg(u,o))),g=qc(e,Wf(r,Pg(f,o)));return m<g?-1:g<m?1:u.descriptor.index-f.descriptor.index})[0]||null,su=oi(function(t,r){const s=r[t.line];return{value:s,point:Yl(t.line,s)}});const SI=(e,t,r)=>{const s=e.axis;if(e.descriptor.mode==="virtual")return Yl(s.line,t[s.line]);const o=e.subject.page.contentBox[s.size],m=H0(e.descriptor.id,r).reduce((g,b)=>g+b.client.marginBox[s.size],0)+t[s.line]-o;return m<=0?null:Yl(s.line,m)},qx=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),Zx=(e,t,r)=>{const s=e.frame;G0(t,e)&&yt(),e.subject.withPlaceholder&&yt();const o=su(e.axis,t.displaceBy).point,c=SI(e,o,r),u={placeholderSize:o,increasedBy:c,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!s){const b=B0({page:e.subject.page,withPlaceholder:u,axis:e.axis,frame:e.frame});return{...e,subject:b}}const f=c?yi(s.scroll.max,c):s.scroll.max,m=qx(s,f),g=B0({page:e.subject.page,withPlaceholder:u,axis:e.axis,frame:m});return{...e,subject:g,frame:m}},LI=e=>{const t=e.subject.withPlaceholder;t||yt();const r=e.frame;if(!r){const u=B0({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:u}}const s=t.oldFrameMaxScroll;s||yt();const o=qx(r,s),c=B0({page:e.subject.page,axis:e.axis,frame:o,withPlaceholder:null});return{...e,subject:c,frame:o}};var II=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:r,draggable:s,draggables:o,destination:c,viewport:u,afterCritical:f})=>{if(!t){if(r.length)return null;const x={displaced:Zc,displacedBy:Ux,at:{type:"REORDER",destination:{droppableId:c.descriptor.id,index:0}}},v=Ud({impact:x,draggable:s,droppable:c,draggables:o,afterCritical:f}),w=G0(s,c)?c:Zx(c,s,o);return Vx({draggable:s,destination:w,newPageBorderBoxCenter:v,viewport:u.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?x:null}const m=e[c.axis.line]<=t.page.borderBox.center[c.axis.line],g=(()=>{const x=t.descriptor.index;return t.descriptor.id===s.descriptor.id||m?x:x+1})(),b=su(c.axis,s.displaceBy);return Td({draggable:s,insideDestination:r,destination:c,viewport:u,displacedBy:b,last:Zc,index:g})},kI=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:r,isOver:s,draggables:o,droppables:c,viewport:u,afterCritical:f})=>{const m=TI({isMovingForward:e,pageBorderBoxCenter:t,source:s,droppables:c,viewport:u});if(!m)return null;const g=H0(m.descriptor.id,o),b=_I({pageBorderBoxCenter:t,viewport:u,destination:m,insideDestination:g,afterCritical:f}),x=II({previousPageBorderBoxCenter:t,destination:m,draggable:r,draggables:o,moveRelativeTo:b,insideDestination:g,viewport:u,afterCritical:f});if(!x)return null;const v=Ud({impact:x,draggable:r,droppable:m,draggables:o,afterCritical:f});return{clientSelection:Rp({pageBorderBoxCenter:v,draggable:r,viewport:u}),impact:x,scrollJumpRequest:null}},po=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const EI=(e,t)=>{const r=po(e);return r?t[r]:null};var MI=({state:e,type:t})=>{const r=EI(e.impact,e.dimensions.droppables),s=!!r,o=e.dimensions.droppables[e.critical.droppable.id],c=r||o,u=c.axis.direction,f=u==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||u==="horizontal"&&(t==="MOVE_LEFT"||t==="MOVE_RIGHT");if(f&&!s)return null;const m=t==="MOVE_DOWN"||t==="MOVE_RIGHT",g=e.dimensions.draggables[e.critical.draggable.id],b=e.current.page.borderBoxCenter,{draggables:x,droppables:v}=e.dimensions;return f?AI({isMovingForward:m,previousPageBorderBoxCenter:b,draggable:g,destination:c,draggables:x,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):kI({isMovingForward:m,previousPageBorderBoxCenter:b,draggable:g,isOver:c,draggables:x,droppables:v,viewport:e.viewport,afterCritical:e.afterCritical})};function Pl(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function Yx(e){const t=Oo(e.top,e.bottom),r=Oo(e.left,e.right);return function(o){return t(o.y)&&r(o.x)}}function RI(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function NI({pageBorderBox:e,draggable:t,candidates:r}){const s=t.page.borderBox.center,o=r.map(c=>{const u=c.axis,f=Yl(c.axis.line,e.center[u.line],c.page.borderBox.center[u.crossAxisLine]);return{id:c.descriptor.id,distance:qc(s,f)}}).sort((c,u)=>u.distance-c.distance);return o[0]?o[0].id:null}function DI({pageBorderBox:e,draggable:t,droppables:r}){const s=Pd(r).filter(o=>{if(!o.isEnabled)return!1;const c=o.subject.active;if(!c||!RI(e,c))return!1;if(Yx(c)(e.center))return!0;const u=o.axis,f=c.center[u.crossAxisLine],m=e[u.crossAxisStart],g=e[u.crossAxisEnd],b=Oo(c[u.crossAxisStart],c[u.crossAxisEnd]),x=b(m),v=b(g);return!x&&!v?!0:x?m<f:g>f});return s.length?s.length===1?s[0].descriptor.id:NI({pageBorderBox:e,draggable:t,candidates:s}):null}const Kx=(e,t)=>ra(nu(e,t));var QI=(e,t)=>{const r=e.frame;return r?Kx(t,r.scroll.diff.value):t};function Xx({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function BI({draggable:e,closest:t,inHomeList:r}){return t?r&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var jI=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:r,insideDestination:s,last:o,viewport:c,afterCritical:u})=>{const f=r.axis,m=su(r.axis,t.displaceBy),g=m.value,b=e[f.start],x=e[f.end],w=Fd(t,s).find(k=>{const N=k.descriptor.id,R=k.page.borderBox.center[f.line],Q=wl(N,u),F=Xx({displaced:o,id:N});return Q?F?x<=R:b<R-g:F?x<=R+g:b<R})||null,I=BI({draggable:t,closest:w,inHomeList:G0(t,r)});return Td({draggable:t,insideDestination:s,destination:r,viewport:c,last:o,displacedBy:m,index:I})};const PI=4;var OI=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:r,destination:s,insideDestination:o,afterCritical:c})=>{if(!s.isCombineEnabled)return null;const u=s.axis,f=su(s.axis,e.displaceBy),m=f.value,g=t[u.start],b=t[u.end],v=Fd(e,o).find(I=>{const k=I.descriptor.id,N=I.page.borderBox,Q=N[u.size]/PI,F=wl(k,c),q=Xx({displaced:r.displaced,id:k});return F?q?b>N[u.start]+Q&&b<N[u.end]-Q:g>N[u.start]-m+Q&&g<N[u.end]-m-Q:q?b>N[u.start]+m+Q&&b<N[u.end]+m-Q:g>N[u.start]+Q&&g<N[u.end]-Q});return v?{displacedBy:f,displaced:r.displaced,at:{type:"COMBINE",combine:{draggableId:v.descriptor.id,droppableId:s.descriptor.id}}}:null},Jx=({pageOffset:e,draggable:t,draggables:r,droppables:s,previousImpact:o,viewport:c,afterCritical:u})=>{const f=Kx(t.page.borderBox,e),m=DI({pageBorderBox:f,draggable:t,droppables:s});if(!m)return JL;const g=s[m],b=H0(g.descriptor.id,r),x=QI(g,f);return OI({pageBorderBoxWithDroppableScroll:x,draggable:t,previousImpact:o,destination:g,insideDestination:b,afterCritical:u})||jI({pageBorderBoxWithDroppableScroll:x,draggable:t,destination:g,insideDestination:b,last:o.displaced,viewport:c,afterCritical:u})},Np=(e,t)=>({...e,[t.descriptor.id]:t});const FI=({previousImpact:e,impact:t,droppables:r})=>{const s=po(e),o=po(t);if(!s||s===o)return r;const c=r[s];if(!c.subject.withPlaceholder)return r;const u=LI(c);return Np(r,u)};var UI=({draggable:e,draggables:t,droppables:r,previousImpact:s,impact:o})=>{const c=FI({previousImpact:s,impact:o,droppables:r}),u=po(o);if(!u)return c;const f=r[u];if(G0(e,f)||f.subject.withPlaceholder)return c;const m=Zx(f,e,t);return Np(c,m)},Bc=({state:e,clientSelection:t,dimensions:r,viewport:s,impact:o,scrollJumpRequest:c})=>{const u=s||e.viewport,f=r||e.dimensions,m=t||e.current.client.selection,g=ho(m,e.initial.client.selection),b={offset:g,selection:m,borderBoxCenter:yi(e.initial.client.borderBoxCenter,g)},x={selection:yi(b.selection,u.scroll.current),borderBoxCenter:yi(b.borderBoxCenter,u.scroll.current),offset:yi(b.offset,u.scroll.diff.value)},v={client:b,page:x};if(e.phase==="COLLECTING")return{...e,dimensions:f,viewport:u,current:v};const w=f.draggables[e.critical.draggable.id],I=o||Jx({pageOffset:x.offset,draggable:w,draggables:f.draggables,droppables:f.droppables,previousImpact:e.impact,viewport:u,afterCritical:e.afterCritical}),k=UI({draggable:w,impact:I,previousImpact:e.impact,draggables:f.draggables,droppables:f.droppables});return{...e,current:v,dimensions:{draggables:f.draggables,droppables:k},impact:I,viewport:u,scrollJumpRequest:c||null,forceShouldAnimate:c?!1:null}};function $I(e,t){return e.map(r=>t[r])}var e3=({impact:e,viewport:t,draggables:r,destination:s,forceShouldAnimate:o})=>{const c=e.displaced,u=$I(c.all,r),f=Yc({afterDragging:u,destination:s,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:o,last:c});return{...e,displaced:f}},t3=({impact:e,draggable:t,droppable:r,draggables:s,viewport:o,afterCritical:c})=>{const u=Ud({impact:e,draggable:t,draggables:s,droppable:r,afterCritical:c});return Rp({pageBorderBoxCenter:u,draggable:t,viewport:o})},r3=({state:e,dimensions:t,viewport:r})=>{e.movementMode!=="SNAP"&&yt();const s=e.impact,o=r||e.viewport,c=t||e.dimensions,{draggables:u,droppables:f}=c,m=u[e.critical.draggable.id],g=po(s);g||yt();const b=f[g],x=e3({impact:s,viewport:o,destination:b,draggables:u}),v=t3({impact:x,draggable:m,droppable:b,draggables:u,viewport:o,afterCritical:e.afterCritical});return Bc({impact:x,clientSelection:v,state:e,dimensions:c,viewport:o})},zI=e=>({index:e.index,droppableId:e.droppableId}),n3=({draggable:e,home:t,draggables:r,viewport:s})=>{const o=su(t.axis,e.displaceBy),c=H0(t.descriptor.id,r),u=c.indexOf(e);u===-1&&yt();const f=c.slice(u+1),m=f.reduce((v,w)=>(v[w.descriptor.id]=!0,v),{}),g={inVirtualList:t.descriptor.mode==="virtual",displacedBy:o,effected:m};return{impact:{displaced:Yc({afterDragging:f,destination:t,displacedBy:o,last:null,viewport:s.frame,forceShouldAnimate:!1}),displacedBy:o,at:{type:"REORDER",destination:zI(e.descriptor)}},afterCritical:g}},HI=(e,t)=>({draggables:e.draggables,droppables:Np(e.droppables,t)}),GI=({draggable:e,offset:t,initialWindowScroll:r})=>{const s=bd(e.client,t),o=yd(s,r);return{...e,placeholder:{...e.placeholder,client:s},client:s,page:o}},WI=e=>{const t=e.frame;return t||yt(),t},VI=({additions:e,updatedDroppables:t,viewport:r})=>{const s=r.scroll.diff.value;return e.map(o=>{const c=o.descriptor.droppableId,u=t[c],m=WI(u).scroll.diff.value,g=yi(s,m);return GI({draggable:o,offset:g,initialWindowScroll:r.scroll.initial})})},qI=({state:e,published:t})=>{const r=t.modified.map(R=>{const Q=e.dimensions.droppables[R.droppableId];return Lp(Q,R.scroll)}),s={...e.dimensions.droppables,...Ox(r)},o=Fx(VI({additions:t.additions,updatedDroppables:s,viewport:e.viewport})),c={...e.dimensions.draggables,...o};t.removals.forEach(R=>{delete c[R]});const u={droppables:s,draggables:c},f=po(e.impact),m=f?u.droppables[f]:null,g=u.draggables[e.critical.draggable.id],b=u.droppables[e.critical.droppable.id],{impact:x,afterCritical:v}=n3({draggable:g,home:b,draggables:c,viewport:e.viewport}),w=m&&m.isCombineEnabled?e.impact:x,I=Jx({pageOffset:e.current.page.offset,draggable:u.draggables[e.critical.draggable.id],draggables:u.draggables,droppables:u.droppables,previousImpact:w,viewport:e.viewport,afterCritical:v}),k={...e,phase:"DRAGGING",impact:I,onLiftImpact:x,dimensions:u,afterCritical:v,forceShouldAnimate:!1};return e.phase==="COLLECTING"?k:{...k,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const Vf=e=>e.movementMode==="SNAP",tf=(e,t,r)=>{const s=HI(e.dimensions,t);return!Vf(e)||r?Bc({state:e,dimensions:s}):r3({state:e,dimensions:s})};function rf(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const Og={phase:"IDLE",completed:null,shouldFlush:!1};var ZI=(e=Og,t)=>{if(t.type==="FLUSH")return{...Og,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&yt();const{critical:r,clientSelection:s,viewport:o,dimensions:c,movementMode:u}=t.payload,f=c.draggables[r.draggable.id],m=c.droppables[r.droppable.id],g={selection:s,borderBoxCenter:f.client.borderBox.center,offset:ai},b={client:g,page:{selection:yi(g.selection,o.scroll.initial),borderBoxCenter:yi(g.selection,o.scroll.initial),offset:yi(g.selection,o.scroll.diff.value)}},x=Pd(c.droppables).every(k=>!k.isFixedOnPage),{impact:v,afterCritical:w}=n3({draggable:f,home:m,draggables:c.draggables,viewport:o});return{phase:"DRAGGING",isDragging:!0,critical:r,movementMode:u,dimensions:c,initial:b,current:b,isWindowScrollAllowed:x,impact:v,afterCritical:w,onLiftImpact:v,viewport:o,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&yt(),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||yt(),qI({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;Pl(e)||yt();const{client:r}=t.payload;return vl(r,e.current.client.selection)?e:Bc({state:e,clientSelection:r,impact:Vf(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return rf(e);Pl(e)||yt();const{id:r,newScroll:s}=t.payload,o=e.dimensions.droppables[r];if(!o)return e;const c=Lp(o,s);return tf(e,c,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;Pl(e)||yt();const{id:r,isEnabled:s}=t.payload,o=e.dimensions.droppables[r];o||yt(),o.isEnabled===s&&yt();const c={...o,isEnabled:s};return tf(e,c,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;Pl(e)||yt();const{id:r,isCombineEnabled:s}=t.payload,o=e.dimensions.droppables[r];o||yt(),o.isCombineEnabled===s&&yt();const c={...o,isCombineEnabled:s};return tf(e,c,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;Pl(e)||yt(),e.isWindowScrollAllowed||yt();const r=t.payload.newScroll;if(vl(e.viewport.scroll.current,r))return rf(e);const s=Wx(e.viewport,r);return Vf(e)?r3({state:e,viewport:s}):Bc({state:e,viewport:s})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!Pl(e))return e;const r=t.payload.maxScroll;if(vl(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"&&yt();const r=MI({state:e,type:t.type});return r?Bc({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"&&yt(),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:r}}if(t.type==="DROP_ANIMATE"){const{completed:r,dropDuration:s,newHomeClientOffset:o}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||yt(),{phase:"DROP_ANIMATING",completed:r,dropDuration:s,newHomeClientOffset:o,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:r}=t.payload;return{phase:"IDLE",completed:r,shouldFlush:!1}}return e};function Tn(e,t){return e instanceof Object&&"type"in e&&e.type===t}const YI=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),KI=e=>({type:"LIFT",payload:e}),XI=e=>({type:"INITIAL_PUBLISH",payload:e}),JI=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),ek=()=>({type:"COLLECTION_STARTING",payload:null}),tk=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),rk=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),nk=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),s3=e=>({type:"MOVE",payload:e}),sk=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),ik=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),ok=()=>({type:"MOVE_UP",payload:null}),ak=()=>({type:"MOVE_DOWN",payload:null}),lk=()=>({type:"MOVE_RIGHT",payload:null}),ck=()=>({type:"MOVE_LEFT",payload:null}),Dp=()=>({type:"FLUSH",payload:null}),uk=e=>({type:"DROP_ANIMATE",payload:e}),Qp=e=>({type:"DROP_COMPLETE",payload:e}),i3=e=>({type:"DROP",payload:e}),dk=e=>({type:"DROP_PENDING",payload:e}),o3=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var hk=e=>({getState:t,dispatch:r})=>s=>o=>{if(!Tn(o,"LIFT")){s(o);return}const{id:c,clientSelection:u,movementMode:f}=o.payload,m=t();m.phase==="DROP_ANIMATING"&&r(Qp({completed:m.completed})),t().phase!=="IDLE"&&yt(),r(Dp()),r(YI({draggableId:c,movementMode:f}));const b={draggableId:c,scrollOptions:{shouldPublishImmediately:f==="SNAP"}},{critical:x,dimensions:v,viewport:w}=e.startPublishing(b);r(XI({critical:x,dimensions:v,clientSelection:u,movementMode:f,viewport:w}))},fk=e=>()=>t=>r=>{Tn(r,"INITIAL_PUBLISH")&&e.dragging(),Tn(r,"DROP_ANIMATE")&&e.dropping(r.payload.completed.result.reason),(Tn(r,"FLUSH")||Tn(r,"DROP_COMPLETE"))&&e.resting(),t(r)};const Bp={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},Kc={opacity:{drop:0,combining:.7},scale:{drop:.75}},a3={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},jl=`${a3.outOfTheWay}s ${Bp.outOfTheWay}`,jc={fluid:`opacity ${jl}`,snap:`transform ${jl}, opacity ${jl}`,drop:e=>{const t=`${e}s ${Bp.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${jl}`,placeholder:`height ${jl}, width ${jl}, margin ${jl}`},Fg=e=>vl(e,ai)?void 0:`translate(${e.x}px, ${e.y}px)`,qf={moveTo:Fg,drop:(e,t)=>{const r=Fg(e);if(r)return t?`${r} scale(${Kc.scale.drop})`:r}},{minDropTime:Zf,maxDropTime:l3}=a3,pk=l3-Zf,Ug=1500,mk=.6;var gk=({current:e,destination:t,reason:r})=>{const s=qc(e,t);if(s<=0)return Zf;if(s>=Ug)return l3;const o=s/Ug,c=Zf+pk*o,u=r==="CANCEL"?c*mk:c;return Number(u.toFixed(2))},xk=({impact:e,draggable:t,dimensions:r,viewport:s,afterCritical:o})=>{const{draggables:c,droppables:u}=r,f=po(e),m=f?u[f]:null,g=u[t.descriptor.droppableId],b=t3({impact:e,draggable:t,draggables:c,afterCritical:o,droppable:m||g,viewport:s});return ho(b,t.client.borderBox.center)},bk=({draggables:e,reason:t,lastImpact:r,home:s,viewport:o,onLiftImpact:c})=>!r.at||t!=="DROP"?{impact:e3({draggables:e,impact:c,destination:s,viewport:o,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:r.at.type==="REORDER"?{impact:r,didDropInsideDroppable:!0}:{impact:{...r,displaced:Zc},didDropInsideDroppable:!0};const yk=({getState:e,dispatch:t})=>r=>s=>{if(!Tn(s,"DROP")){r(s);return}const o=e(),c=s.payload.reason;if(o.phase==="COLLECTING"){t(dk({reason:c}));return}if(o.phase==="IDLE")return;o.phase==="DROP_PENDING"&&o.isWaiting&&yt(),o.phase==="DRAGGING"||o.phase==="DROP_PENDING"||yt();const f=o.critical,m=o.dimensions,g=m.draggables[o.critical.draggable.id],{impact:b,didDropInsideDroppable:x}=bk({reason:c,lastImpact:o.impact,afterCritical:o.afterCritical,onLiftImpact:o.onLiftImpact,home:o.dimensions.droppables[o.critical.droppable.id],viewport:o.viewport,draggables:o.dimensions.draggables}),v=x?Ip(b):null,w=x?Od(b):null,I={index:f.draggable.index,droppableId:f.droppable.id},k={draggableId:g.descriptor.id,type:g.descriptor.type,source:I,reason:c,mode:o.movementMode,destination:v,combine:w},N=xk({impact:b,draggable:g,dimensions:m,viewport:o.viewport,afterCritical:o.afterCritical}),R={critical:o.critical,afterCritical:o.afterCritical,result:k,impact:b};if(!(!vl(o.current.client.offset,N)||!!k.combine)){t(Qp({completed:R}));return}const F=gk({current:o.current.client.offset,destination:N,reason:c});t(uk({newHomeClientOffset:N,dropDuration:F,completed:R}))};var c3=()=>({x:window.pageXOffset,y:window.pageYOffset});function vk(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function wk({onWindowScroll:e}){function t(){e(c3())}const r=Vc(t),s=vk(r);let o=yl;function c(){return o!==yl}function u(){c()&&yt(),o=jo(window,[s])}function f(){c()||yt(),r.cancel(),o(),o=yl}return{start:u,stop:f,isActive:c}}const Ak=e=>Tn(e,"DROP_COMPLETE")||Tn(e,"DROP_ANIMATE")||Tn(e,"FLUSH"),Tk=e=>{const t=wk({onWindowScroll:r=>{e.dispatch(sk({newScroll:r}))}});return r=>s=>{!t.isActive()&&Tn(s,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&Ak(s)&&t.stop(),r(s)}};var Ck=e=>{let t=!1,r=!1;const s=setTimeout(()=>{r=!0}),o=c=>{t||r||(t=!0,e(c),clearTimeout(s))};return o.wasCalled=()=>t,o},_k=()=>{const e=[],t=o=>{const c=e.findIndex(f=>f.timerId===o);c===-1&&yt();const[u]=e.splice(c,1);u.callback()};return{add:o=>{const c=setTimeout(()=>t(c)),u={timerId:c,callback:o};e.push(u)},flush:()=>{if(!e.length)return;const o=[...e];e.length=0,o.forEach(c=>{clearTimeout(c.timerId),c.callback()})}}};const Sk=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,Lk=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,Ik=(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},yc=(e,t)=>{t()},Uu=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function nf(e,t,r,s){if(!e){r(s(t));return}const o=Ck(r);e(t,{announce:o}),o.wasCalled()||r(s(t))}var kk=(e,t)=>{const r=_k();let s=null;const o=(x,v)=>{s&&yt(),yc("onBeforeCapture",()=>{const w=e().onBeforeCapture;w&&w({draggableId:x,mode:v})})},c=(x,v)=>{s&&yt(),yc("onBeforeDragStart",()=>{const w=e().onBeforeDragStart;w&&w(Uu(x,v))})},u=(x,v)=>{s&&yt();const w=Uu(x,v);s={mode:v,lastCritical:x,lastLocation:w.source,lastCombine:null},r.add(()=>{yc("onDragStart",()=>nf(e().onDragStart,w,t,id.onDragStart))})},f=(x,v)=>{const w=Ip(v),I=Od(v);s||yt();const k=!Ik(x,s.lastCritical);k&&(s.lastCritical=x);const N=!Sk(s.lastLocation,w);N&&(s.lastLocation=w);const R=!Lk(s.lastCombine,I);if(R&&(s.lastCombine=I),!k&&!N&&!R)return;const Q={...Uu(x,s.mode),combine:I,destination:w};r.add(()=>{yc("onDragUpdate",()=>nf(e().onDragUpdate,Q,t,id.onDragUpdate))})},m=()=>{s||yt(),r.flush()},g=x=>{s||yt(),s=null,yc("onDragEnd",()=>nf(e().onDragEnd,x,t,id.onDragEnd))};return{beforeCapture:o,beforeStart:c,start:u,update:f,flush:m,drop:g,abort:()=>{if(!s)return;const x={...Uu(s.lastCritical,s.mode),combine:null,destination:null,reason:"CANCEL"};g(x)}}},Ek=(e,t)=>{const r=kk(e,t);return s=>o=>c=>{if(Tn(c,"BEFORE_INITIAL_CAPTURE")){r.beforeCapture(c.payload.draggableId,c.payload.movementMode);return}if(Tn(c,"INITIAL_PUBLISH")){const f=c.payload.critical;r.beforeStart(f,c.payload.movementMode),o(c),r.start(f,c.payload.movementMode);return}if(Tn(c,"DROP_COMPLETE")){const f=c.payload.completed.result;r.flush(),o(c),r.drop(f);return}if(o(c),Tn(c,"FLUSH")){r.abort();return}const u=s.getState();u.phase==="DRAGGING"&&r.update(u.critical,u.impact)}};const Mk=e=>t=>r=>{if(!Tn(r,"DROP_ANIMATION_FINISHED")){t(r);return}const s=e.getState();s.phase!=="DROP_ANIMATING"&&yt(),e.dispatch(Qp({completed:s.completed}))},Rk=e=>{let t=null,r=null;function s(){r&&(cancelAnimationFrame(r),r=null),t&&(t(),t=null)}return o=>c=>{if((Tn(c,"FLUSH")||Tn(c,"DROP_COMPLETE")||Tn(c,"DROP_ANIMATION_FINISHED"))&&s(),o(c),!Tn(c,"DROP_ANIMATE"))return;const u={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(o3())}};r=requestAnimationFrame(()=>{r=null,t=jo(window,[u])})}};var Nk=e=>()=>t=>r=>{(Tn(r,"DROP_COMPLETE")||Tn(r,"FLUSH")||Tn(r,"DROP_ANIMATE"))&&e.stopPublishing(),t(r)},Dk=e=>{let t=!1;return()=>r=>s=>{if(Tn(s,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(s.payload.critical.draggable.id),r(s),e.tryRestoreFocusRecorded();return}if(r(s),!!t){if(Tn(s,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(Tn(s,"DROP_COMPLETE")){t=!1;const o=s.payload.completed.result;o.combine&&e.tryShiftRecord(o.draggableId,o.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const Qk=e=>Tn(e,"DROP_COMPLETE")||Tn(e,"DROP_ANIMATE")||Tn(e,"FLUSH");var Bk=e=>t=>r=>s=>{if(Qk(s)){e.stop(),r(s);return}if(Tn(s,"INITIAL_PUBLISH")){r(s);const o=t.getState();o.phase!=="DRAGGING"&&yt(),e.start(o);return}r(s),e.scroll(t.getState())};const jk=e=>t=>r=>{if(t(r),!Tn(r,"PUBLISH_WHILE_DRAGGING"))return;const s=e.getState();s.phase==="DROP_PENDING"&&(s.isWaiting||e.dispatch(i3({reason:s.reason})))},Pk=_x;var Ok=({dimensionMarshal:e,focusMarshal:t,styleMarshal:r,getResponders:s,announce:o,autoScroller:c})=>Cx(ZI,Pk(BS(fk(r),Nk(e),hk(e),yk,Mk,Rk,jk,Bk(c),Tk,Dk(t),Ek(s,o))));const sf=()=>({additions:{},removals:{},modified:{}});function Fk({registry:e,callbacks:t}){let r=sf(),s=null;const o=()=>{s||(t.collectionStarting(),s=requestAnimationFrame(()=>{s=null;const{additions:m,removals:g,modified:b}=r,x=Object.keys(m).map(I=>e.draggable.getById(I).getDimension(ai)).sort((I,k)=>I.descriptor.index-k.descriptor.index),v=Object.keys(b).map(I=>{const N=e.droppable.getById(I).callbacks.getScrollWhileDragging();return{droppableId:I,scroll:N}}),w={additions:x,removals:Object.keys(g),modified:v};r=sf(),t.publish(w)}))};return{add:m=>{const g=m.descriptor.id;r.additions[g]=m,r.modified[m.descriptor.droppableId]=!0,r.removals[g]&&delete r.removals[g],o()},remove:m=>{const g=m.descriptor;r.removals[g.id]=!0,r.modified[g.droppableId]=!0,r.additions[g.id]&&delete r.additions[g.id],o()},stop:()=>{s&&(cancelAnimationFrame(s),s=null,r=sf())}}}var u3=({scrollHeight:e,scrollWidth:t,height:r,width:s})=>{const o=ho({x:t,y:e},{x:s,y:r});return{x:Math.max(0,o.x),y:Math.max(0,o.y)}},d3=()=>{const e=document.documentElement;return e||yt(),e},h3=()=>{const e=d3();return u3({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},Uk=()=>{const e=c3(),t=h3(),r=e.y,s=e.x,o=d3(),c=o.clientWidth,u=o.clientHeight,f=s+c,m=r+u;return{frame:ra({top:r,left:s,right:f,bottom:m}),scroll:{initial:e,current:e,max:t,diff:{value:ai,displacement:ai}}}},$k=({critical:e,scrollOptions:t,registry:r})=>{const s=Uk(),o=s.scroll.current,c=e.droppable,u=r.droppable.getAllByType(c.type).map(b=>b.callbacks.getDimensionAndWatchScroll(o,t)),f=r.draggable.getAllByType(e.draggable.type).map(b=>b.getDimension(o));return{dimensions:{draggables:Fx(f),droppables:Ox(u)},critical:e,viewport:s}};function $g(e,t,r){return!(r.descriptor.id===t.id||r.descriptor.type!==t.type||e.droppable.getById(r.descriptor.droppableId).descriptor.mode!=="virtual")}var zk=(e,t)=>{let r=null;const s=Fk({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),o=(v,w)=>{e.droppable.exists(v)||yt(),r&&t.updateDroppableIsEnabled({id:v,isEnabled:w})},c=(v,w)=>{r&&(e.droppable.exists(v)||yt(),t.updateDroppableIsCombineEnabled({id:v,isCombineEnabled:w}))},u=(v,w)=>{r&&(e.droppable.exists(v)||yt(),t.updateDroppableScroll({id:v,newScroll:w}))},f=(v,w)=>{r&&e.droppable.getById(v).callbacks.scroll(w)},m=()=>{if(!r)return;s.stop();const v=r.critical.droppable;e.droppable.getAllByType(v.type).forEach(w=>w.callbacks.dragStopped()),r.unsubscribe(),r=null},g=v=>{r||yt();const w=r.critical.draggable;v.type==="ADDITION"&&$g(e,w,v.value)&&s.add(v.value),v.type==="REMOVAL"&&$g(e,w,v.value)&&s.remove(v.value)};return{updateDroppableIsEnabled:o,updateDroppableIsCombineEnabled:c,scrollDroppable:f,updateDroppableScroll:u,startPublishing:v=>{r&&yt();const w=e.draggable.getById(v.draggableId),I=e.droppable.getById(w.descriptor.droppableId),k={draggable:w.descriptor,droppable:I.descriptor},N=e.subscribe(g);return r={critical:k,unsubscribe:N},$k({critical:k,registry:e,scrollOptions:v.scrollOptions})},stopPublishing:m}},f3=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",Hk=e=>{window.scrollBy(e.x,e.y)};const Gk=oi(e=>Pd(e).filter(t=>!(!t.isEnabled||!t.frame))),Wk=(e,t)=>Gk(t).find(s=>(s.frame||yt(),Yx(s.frame.pageMarginBox)(e)))||null;var Vk=({center:e,destination:t,droppables:r})=>{if(t){const o=r[t];return o.frame?o:null}return Wk(e,r)};const Xc={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var qk=(e,t,r=()=>Xc)=>{const s=r(),o=e[t.size]*s.startFromPercentage,c=e[t.size]*s.maxScrollAtPercentage;return{startScrollingFrom:o,maxScrollValueAt:c}},p3=({startOfRange:e,endOfRange:t,current:r})=>{const s=t-e;return s===0?0:(r-e)/s},jp=1,Zk=(e,t,r=()=>Xc)=>{const s=r();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return s.maxPixelScroll;if(e===t.startScrollingFrom)return jp;const c=1-p3({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),u=s.maxPixelScroll*s.ease(c);return Math.ceil(u)},Yk=(e,t,r)=>{const s=r(),o=s.durationDampening.accelerateAt,c=s.durationDampening.stopDampeningAt,u=t,f=c,g=Date.now()-u;if(g>=c)return e;if(g<o)return jp;const b=p3({startOfRange:o,endOfRange:f,current:g}),x=e*s.ease(b);return Math.ceil(x)},zg=({distanceToEdge:e,thresholds:t,dragStartTime:r,shouldUseTimeDampening:s,getAutoScrollerOptions:o})=>{const c=Zk(e,t,o);return c===0?0:s?Math.max(Yk(c,r,o),jp):c},Hg=({container:e,distanceToEdges:t,dragStartTime:r,axis:s,shouldUseTimeDampening:o,getAutoScrollerOptions:c})=>{const u=qk(e,s,c);return t[s.end]<t[s.start]?zg({distanceToEdge:t[s.end],thresholds:u,dragStartTime:r,shouldUseTimeDampening:o,getAutoScrollerOptions:c}):-1*zg({distanceToEdge:t[s.start],thresholds:u,dragStartTime:r,shouldUseTimeDampening:o,getAutoScrollerOptions:c})},Kk=({container:e,subject:t,proposedScroll:r})=>{const s=t.height>e.height,o=t.width>e.width;return!o&&!s?r:o&&s?null:{x:o?0:r.x,y:s?0:r.y}};const Xk=Px(e=>e===0?0:e);var m3=({dragStartTime:e,container:t,subject:r,center:s,shouldUseTimeDampening:o,getAutoScrollerOptions:c})=>{const u={top:s.y-t.top,right:t.right-s.x,bottom:t.bottom-s.y,left:s.x-t.left},f=Hg({container:t,distanceToEdges:u,dragStartTime:e,axis:kp,shouldUseTimeDampening:o,getAutoScrollerOptions:c}),m=Hg({container:t,distanceToEdges:u,dragStartTime:e,axis:zx,shouldUseTimeDampening:o,getAutoScrollerOptions:c}),g=Xk({x:m,y:f});if(vl(g,ai))return null;const b=Kk({container:t,subject:r,proposedScroll:g});return b?vl(b,ai)?null:b:null};const Jk=Px(e=>e===0?0:e>0?1:-1),Pp=(()=>{const e=(t,r)=>t<0?t:t>r?t-r:0;return({current:t,max:r,change:s})=>{const o=yi(t,s),c={x:e(o.x,r.x),y:e(o.y,r.y)};return vl(c,ai)?null:c}})(),g3=({max:e,current:t,change:r})=>{const s={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},o=Jk(r),c=Pp({max:s,current:t,change:o});return!c||o.x!==0&&c.x===0||o.y!==0&&c.y===0},Op=(e,t)=>g3({current:e.scroll.current,max:e.scroll.max,change:t}),eE=(e,t)=>{if(!Op(e,t))return null;const r=e.scroll.max,s=e.scroll.current;return Pp({current:s,max:r,change:t})},Fp=(e,t)=>{const r=e.frame;return r?g3({current:r.scroll.current,max:r.scroll.max,change:t}):!1},tE=(e,t)=>{const r=e.frame;return!r||!Fp(e,t)?null:Pp({current:r.scroll.current,max:r.scroll.max,change:t})};var rE=({viewport:e,subject:t,center:r,dragStartTime:s,shouldUseTimeDampening:o,getAutoScrollerOptions:c})=>{const u=m3({dragStartTime:s,container:e.frame,subject:t,center:r,shouldUseTimeDampening:o,getAutoScrollerOptions:c});return u&&Op(e,u)?u:null},nE=({droppable:e,subject:t,center:r,dragStartTime:s,shouldUseTimeDampening:o,getAutoScrollerOptions:c})=>{const u=e.frame;if(!u)return null;const f=m3({dragStartTime:s,container:u.pageMarginBox,subject:t,center:r,shouldUseTimeDampening:o,getAutoScrollerOptions:c});return f&&Fp(e,f)?f:null},Gg=({state:e,dragStartTime:t,shouldUseTimeDampening:r,scrollWindow:s,scrollDroppable:o,getAutoScrollerOptions:c})=>{const u=e.current.page.borderBoxCenter,m=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const x=e.viewport,v=rE({dragStartTime:t,viewport:x,subject:m,center:u,shouldUseTimeDampening:r,getAutoScrollerOptions:c});if(v){s(v);return}}const g=Vk({center:u,destination:po(e.impact),droppables:e.dimensions.droppables});if(!g)return;const b=nE({dragStartTime:t,droppable:g,subject:m,center:u,shouldUseTimeDampening:r,getAutoScrollerOptions:c});b&&o(g.descriptor.id,b)},sE=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:r=()=>Xc})=>{const s=Vc(e),o=Vc(t);let c=null;const u=g=>{c||yt();const{shouldUseTimeDampening:b,dragStartTime:x}=c;Gg({state:g,scrollWindow:s,scrollDroppable:o,dragStartTime:x,shouldUseTimeDampening:b,getAutoScrollerOptions:r})};return{start:g=>{c&&yt();const b=Date.now();let x=!1;const v=()=>{x=!0};Gg({state:g,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:v,scrollDroppable:v,getAutoScrollerOptions:r}),c={dragStartTime:b,shouldUseTimeDampening:x},x&&u(g)},stop:()=>{c&&(s.cancel(),o.cancel(),c=null)},scroll:u}},iE=({move:e,scrollDroppable:t,scrollWindow:r})=>{const s=(f,m)=>{const g=yi(f.current.client.selection,m);e({client:g})},o=(f,m)=>{if(!Fp(f,m))return m;const g=tE(f,m);if(!g)return t(f.descriptor.id,m),null;const b=ho(m,g);return t(f.descriptor.id,b),ho(m,b)},c=(f,m,g)=>{if(!f||!Op(m,g))return g;const b=eE(m,g);if(!b)return r(g),null;const x=ho(g,b);return r(x),ho(g,x)};return f=>{const m=f.scrollJumpRequest;if(!m)return;const g=po(f.impact);g||yt();const b=o(f.dimensions.droppables[g],m);if(!b)return;const x=f.viewport,v=c(f.isWindowScrollAllowed,x,b);v&&s(f,v)}},oE=({scrollDroppable:e,scrollWindow:t,move:r,getAutoScrollerOptions:s})=>{const o=sE({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:s}),c=iE({move:r,scrollWindow:t,scrollDroppable:e});return{scroll:m=>{if(!(s().disabled||m.phase!=="DRAGGING")){if(m.movementMode==="FLUID"){o.scroll(m);return}m.scrollJumpRequest&&c(m)}},start:o.start,stop:o.stop}};const j0="data-rfd",P0=(()=>{const e=`${j0}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),Yf=(()=>{const e=`${j0}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),aE=(()=>{const e=`${j0}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),Wg={contextId:`${j0}-scroll-container-context-id`},lE=e=>t=>`[${t}="${e}"]`,vc=(e,t)=>e.map(r=>{const s=r.styles[t];return s?`${r.selector} { ${s} }`:""}).join(" "),cE="pointer-events: none;";var uE=e=>{const t=lE(e),r=(()=>{const f=`
110
+ cursor: -webkit-grab;
111
+ cursor: grab;
112
+ `;return{selector:t(P0.contextId),styles:{always:`
113
+ -webkit-touch-callout: none;
114
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
115
+ touch-action: manipulation;
116
+ `,resting:f,dragging:cE,dropAnimating:f}}})(),s=(()=>{const f=`
117
+ transition: ${jc.outOfTheWay};
118
+ `;return{selector:t(Yf.contextId),styles:{dragging:f,dropAnimating:f,userCancel:f}}})(),o={selector:t(aE.contextId),styles:{always:"overflow-anchor: none;"}},u=[s,r,o,{selector:"body",styles:{dragging:`
119
+ cursor: grabbing;
120
+ cursor: -webkit-grabbing;
121
+ user-select: none;
122
+ -webkit-user-select: none;
123
+ -moz-user-select: none;
124
+ -ms-user-select: none;
125
+ overflow-anchor: none;
126
+ `}}];return{always:vc(u,"always"),resting:vc(u,"resting"),dragging:vc(u,"dragging"),dropAnimating:vc(u,"dropAnimating"),userCancel:vc(u,"userCancel")}};const mo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?T.useLayoutEffect:T.useEffect,of=()=>{const e=document.querySelector("head");return e||yt(),e},Vg=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function dE(e,t){const r=Jr(()=>uE(e),[e]),s=T.useRef(null),o=T.useRef(null),c=ir(oi(x=>{const v=o.current;v||yt(),v.textContent=x}),[]),u=ir(x=>{const v=s.current;v||yt(),v.textContent=x},[]);mo(()=>{!s.current&&!o.current||yt();const x=Vg(t),v=Vg(t);return s.current=x,o.current=v,x.setAttribute(`${j0}-always`,e),v.setAttribute(`${j0}-dynamic`,e),of().appendChild(x),of().appendChild(v),u(r.always),c(r.resting),()=>{const w=I=>{const k=I.current;k||yt(),of().removeChild(k),I.current=null};w(s),w(o)}},[t,u,c,r.always,r.resting,e]);const f=ir(()=>c(r.dragging),[c,r.dragging]),m=ir(x=>{if(x==="DROP"){c(r.dropAnimating);return}c(r.userCancel)},[c,r.dropAnimating,r.userCancel]),g=ir(()=>{o.current&&c(r.resting)},[c,r.resting]);return Jr(()=>({dragging:f,dropping:m,resting:g}),[f,m,g])}function x3(e,t){return Array.from(e.querySelectorAll(t))}var b3=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function $d(e){return e instanceof b3(e).HTMLElement}function hE(e,t){const r=`[${P0.contextId}="${e}"]`,s=x3(document,r);if(!s.length)return null;const o=s.find(c=>c.getAttribute(P0.draggableId)===t);return!o||!$d(o)?null:o}function fE(e){const t=T.useRef({}),r=T.useRef(null),s=T.useRef(null),o=T.useRef(!1),c=ir(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]}},[]),u=ir(function(v){const w=hE(e,v);w&&w!==document.activeElement&&w.focus()},[e]),f=ir(function(v,w){r.current===v&&(r.current=w)},[]),m=ir(function(){s.current||o.current&&(s.current=requestAnimationFrame(()=>{s.current=null;const v=r.current;v&&u(v)}))},[u]),g=ir(function(v){r.current=null;const w=document.activeElement;w&&w.getAttribute(P0.draggableId)===v&&(r.current=v)},[]);return mo(()=>(o.current=!0,function(){o.current=!1;const v=s.current;v&&cancelAnimationFrame(v)}),[]),Jr(()=>({register:c,tryRecordFocus:g,tryRestoreFocusRecorded:m,tryShiftRecord:f}),[c,g,m,f])}function pE(){const e={draggables:{},droppables:{}},t=[];function r(x){return t.push(x),function(){const w=t.indexOf(x);w!==-1&&t.splice(w,1)}}function s(x){t.length&&t.forEach(v=>v(x))}function o(x){return e.draggables[x]||null}function c(x){const v=o(x);return v||yt(),v}const u={register:x=>{e.draggables[x.descriptor.id]=x,s({type:"ADDITION",value:x})},update:(x,v)=>{const w=e.draggables[v.descriptor.id];w&&w.uniqueId===x.uniqueId&&(delete e.draggables[v.descriptor.id],e.draggables[x.descriptor.id]=x)},unregister:x=>{const v=x.descriptor.id,w=o(v);w&&x.uniqueId===w.uniqueId&&(delete e.draggables[v],e.droppables[x.descriptor.droppableId]&&s({type:"REMOVAL",value:x}))},getById:c,findById:o,exists:x=>!!o(x),getAllByType:x=>Object.values(e.draggables).filter(v=>v.descriptor.type===x)};function f(x){return e.droppables[x]||null}function m(x){const v=f(x);return v||yt(),v}const g={register:x=>{e.droppables[x.descriptor.id]=x},unregister:x=>{const v=f(x.descriptor.id);v&&x.uniqueId===v.uniqueId&&delete e.droppables[x.descriptor.id]},getById:m,findById:f,exists:x=>!!f(x),getAllByType:x=>Object.values(e.droppables).filter(v=>v.descriptor.type===x)};function b(){e.draggables={},e.droppables={},t.length=0}return{draggable:u,droppable:g,subscribe:r,clean:b}}function mE(){const e=Jr(pE,[]);return T.useEffect(()=>function(){e.clean()},[e]),e}var Up=S.createContext(null),Cd=()=>{const e=document.body;return e||yt(),e};const gE={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},xE=e=>`rfd-announcement-${e}`;function bE(e){const t=Jr(()=>xE(e),[e]),r=T.useRef(null);return T.useEffect(function(){const c=document.createElement("div");return r.current=c,c.id=t,c.setAttribute("aria-live","assertive"),c.setAttribute("aria-atomic","true"),vd(c.style,gE),Cd().appendChild(c),function(){setTimeout(function(){const m=Cd();m.contains(c)&&m.removeChild(c),c===r.current&&(r.current=null)})}},[t]),ir(o=>{const c=r.current;if(c){c.textContent=o;return}},[])}const yE={separator:"::"};function $p(e,t=yE){const r=S.useId();return Jr(()=>`${e}${t.separator}${r}`,[t.separator,e,r])}function vE({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function wE({contextId:e,text:t}){const r=$p("hidden-text",{separator:"-"}),s=Jr(()=>vE({contextId:e,uniqueId:r}),[r,e]);return T.useEffect(function(){const c=document.createElement("div");return c.id=s,c.textContent=t,c.style.display="none",Cd().appendChild(c),function(){const f=Cd();f.contains(c)&&f.removeChild(c)}},[s,t]),s}var zd=S.createContext(null);function y3(e){const t=T.useRef(e);return T.useEffect(()=>{t.current=e}),t}function AE(){let e=null;function t(){return!!e}function r(u){return u===e}function s(u){e&&yt();const f={abandon:u};return e=f,f}function o(){e||yt(),e=null}function c(){e&&(e.abandon(),o())}return{isClaimed:t,isActive:r,claim:s,release:o,tryAbandon:c}}function Jc(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const TE=9,CE=13,zp=27,v3=32,_E=33,SE=34,LE=35,IE=36,kE=37,EE=38,ME=39,RE=40,NE={[CE]:!0,[TE]:!0};var w3=e=>{NE[e.keyCode]&&e.preventDefault()};const Hd=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(s=>`on${s}`in document)||e})(),A3=0,qg=5;function DE(e,t){return Math.abs(t.x-e.x)>=qg||Math.abs(t.y-e.y)>=qg}const Zg={type:"IDLE"};function QE({cancel:e,completed:t,getPhase:r,setPhase:s}){return[{eventName:"mousemove",fn:o=>{const{button:c,clientX:u,clientY:f}=o;if(c!==A3)return;const m={x:u,y:f},g=r();if(g.type==="DRAGGING"){o.preventDefault(),g.actions.move(m);return}g.type!=="PENDING"&&yt();const b=g.point;if(!DE(b,m))return;o.preventDefault();const x=g.actions.fluidLift(m);s({type:"DRAGGING",actions:x})}},{eventName:"mouseup",fn:o=>{const c=r();if(c.type!=="DRAGGING"){e();return}o.preventDefault(),c.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:o=>{r().type==="DRAGGING"&&o.preventDefault(),e()}},{eventName:"keydown",fn:o=>{if(r().type==="PENDING"){e();return}if(o.keyCode===zp){o.preventDefault(),e();return}w3(o)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{r().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:o=>{const c=r();if(c.type==="IDLE"&&yt(),c.actions.shouldRespectForcePress()){e();return}o.preventDefault()}},{eventName:Hd,fn:e}]}function BE(e){const t=T.useRef(Zg),r=T.useRef(yl),s=Jr(()=>({eventName:"mousedown",fn:function(x){if(x.defaultPrevented||x.button!==A3||x.ctrlKey||x.metaKey||x.shiftKey||x.altKey)return;const v=e.findClosestDraggableId(x);if(!v)return;const w=e.tryGetLock(v,u,{sourceEvent:x});if(!w)return;x.preventDefault();const I={x:x.clientX,y:x.clientY};r.current(),g(w,I)}}),[e]),o=Jr(()=>({eventName:"webkitmouseforcewillbegin",fn:b=>{if(b.defaultPrevented)return;const x=e.findClosestDraggableId(b);if(!x)return;const v=e.findOptionsForDraggable(x);v&&(v.shouldRespectForcePress||e.canGetLock(x)&&b.preventDefault())}}),[e]),c=ir(function(){const x={passive:!1,capture:!0};r.current=jo(window,[o,s],x)},[o,s]),u=ir(()=>{t.current.type!=="IDLE"&&(t.current=Zg,r.current(),c())},[c]),f=ir(()=>{const b=t.current;u(),b.type==="DRAGGING"&&b.actions.cancel({shouldBlockNextClick:!0}),b.type==="PENDING"&&b.actions.abort()},[u]),m=ir(function(){const x={capture:!0,passive:!1},v=QE({cancel:f,completed:u,getPhase:()=>t.current,setPhase:w=>{t.current=w}});r.current=jo(window,v,x)},[f,u]),g=ir(function(x,v){t.current.type!=="IDLE"&&yt(),t.current={type:"PENDING",point:v,actions:x},m()},[m]);mo(function(){return c(),function(){r.current()}},[c])}function jE(){}const PE={[SE]:!0,[_E]:!0,[IE]:!0,[LE]:!0};function OE(e,t){function r(){t(),e.cancel()}function s(){t(),e.drop()}return[{eventName:"keydown",fn:o=>{if(o.keyCode===zp){o.preventDefault(),r();return}if(o.keyCode===v3){o.preventDefault(),s();return}if(o.keyCode===RE){o.preventDefault(),e.moveDown();return}if(o.keyCode===EE){o.preventDefault(),e.moveUp();return}if(o.keyCode===ME){o.preventDefault(),e.moveRight();return}if(o.keyCode===kE){o.preventDefault(),e.moveLeft();return}if(PE[o.keyCode]){o.preventDefault();return}w3(o)}},{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:Hd,fn:r}]}function FE(e){const t=T.useRef(jE),r=Jr(()=>({eventName:"keydown",fn:function(c){if(c.defaultPrevented||c.keyCode!==v3)return;const u=e.findClosestDraggableId(c);if(!u)return;const f=e.tryGetLock(u,b,{sourceEvent:c});if(!f)return;c.preventDefault();let m=!0;const g=f.snapLift();t.current();function b(){m||yt(),m=!1,t.current(),s()}t.current=jo(window,OE(g,b),{capture:!0,passive:!1})}}),[e]),s=ir(function(){const c={passive:!1,capture:!0};t.current=jo(window,[r],c)},[r]);mo(function(){return s(),function(){t.current()}},[s])}const af={type:"IDLE"},UE=120,$E=.15;function zE({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===zp&&r.preventDefault(),e()}},{eventName:Hd,fn:e}]}function HE({cancel:e,completed:t,getPhase:r}){return[{eventName:"touchmove",options:{capture:!1},fn:s=>{const o=r();if(o.type!=="DRAGGING"){e();return}o.hasMoved=!0;const{clientX:c,clientY:u}=s.touches[0],f={x:c,y:u};s.preventDefault(),o.actions.move(f)}},{eventName:"touchend",fn:s=>{const o=r();if(o.type!=="DRAGGING"){e();return}s.preventDefault(),o.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:s=>{if(r().type!=="DRAGGING"){e();return}s.preventDefault(),e()}},{eventName:"touchforcechange",fn:s=>{const o=r();o.type==="IDLE"&&yt();const c=s.touches[0];if(!c||!(c.force>=$E))return;const f=o.actions.shouldRespectForcePress();if(o.type==="PENDING"){f&&e();return}if(f){if(o.hasMoved){s.preventDefault();return}e();return}s.preventDefault()}},{eventName:Hd,fn:e}]}function GE(e){const t=T.useRef(af),r=T.useRef(yl),s=ir(function(){return t.current},[]),o=ir(function(w){t.current=w},[]),c=Jr(()=>({eventName:"touchstart",fn:function(w){if(w.defaultPrevented)return;const I=e.findClosestDraggableId(w);if(!I)return;const k=e.tryGetLock(I,f,{sourceEvent:w});if(!k)return;const N=w.touches[0],{clientX:R,clientY:Q}=N,F={x:R,y:Q};r.current(),x(k,F)}}),[e]),u=ir(function(){const w={capture:!0,passive:!1};r.current=jo(window,[c],w)},[c]),f=ir(()=>{const v=t.current;v.type!=="IDLE"&&(v.type==="PENDING"&&clearTimeout(v.longPressTimerId),o(af),r.current(),u())},[u,o]),m=ir(()=>{const v=t.current;f(),v.type==="DRAGGING"&&v.actions.cancel({shouldBlockNextClick:!0}),v.type==="PENDING"&&v.actions.abort()},[f]),g=ir(function(){const w={capture:!0,passive:!1},I={cancel:m,completed:f,getPhase:s},k=jo(window,HE(I),w),N=jo(window,zE(I),w);r.current=function(){k(),N()}},[m,s,f]),b=ir(function(){const w=s();w.type!=="PENDING"&&yt();const I=w.actions.fluidLift(w.point);o({type:"DRAGGING",actions:I,hasMoved:!1})},[s,o]),x=ir(function(w,I){s().type!=="IDLE"&&yt();const k=setTimeout(b,UE);o({type:"PENDING",point:I,actions:w,longPressTimerId:k}),g()},[g,s,o,b]);mo(function(){return u(),function(){r.current();const I=s();I.type==="PENDING"&&(clearTimeout(I.longPressTimerId),o(af))}},[s,u,o]),mo(function(){return jo(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const WE=["input","button","textarea","select","option","optgroup","video","audio"];function T3(e,t){if(t==null)return!1;if(WE.includes(t.tagName.toLowerCase()))return!0;const s=t.getAttribute("contenteditable");return s==="true"||s===""?!0:t===e?!1:T3(e,t.parentElement)}function VE(e,t){const r=t.target;return $d(r)?T3(e,r):!1}var qE=e=>ra(e.getBoundingClientRect()).center;function ZE(e){return e instanceof b3(e).Element}const YE=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(s=>s in Element.prototype)||e})();function C3(e,t){return e==null?null:e[YE](t)?e:C3(e.parentElement,t)}function KE(e,t){return e.closest?e.closest(t):C3(e,t)}function XE(e){return`[${P0.contextId}="${e}"]`}function JE(e,t){const r=t.target;if(!ZE(r))return null;const s=XE(e),o=KE(r,s);return!o||!$d(o)?null:o}function eM(e,t){const r=JE(e,t);return r?r.getAttribute(P0.draggableId):null}function tM(e,t){const r=`[${Yf.contextId}="${e}"]`,o=x3(document,r).find(c=>c.getAttribute(Yf.id)===t);return!o||!$d(o)?null:o}function rM(e){e.preventDefault()}function $u({expected:e,phase:t,isLockActive:r,shouldWarn:s}){return!(!r()||e!==t)}function _3({lockAPI:e,store:t,registry:r,draggableId:s}){if(e.isClaimed())return!1;const o=r.draggable.findById(s);return!(!o||!o.options.isEnabled||!f3(t.getState(),s))}function nM({lockAPI:e,contextId:t,store:r,registry:s,draggableId:o,forceSensorStop:c,sourceEvent:u}){if(!_3({lockAPI:e,store:r,registry:s,draggableId:o}))return null;const m=s.draggable.getById(o),g=tM(t,m.descriptor.id);if(!g||u&&!m.options.canDragInteractiveElements&&VE(g,u))return null;const b=e.claim(c||yl);let x="PRE_DRAG";function v(){return m.options.shouldRespectForcePress}function w(){return e.isActive(b)}function I(P,Z){$u({expected:P,phase:x,isLockActive:w,shouldWarn:!0})&&r.dispatch(Z())}const k=I.bind(null,"DRAGGING");function N(P){function Z(){e.release(),x="COMPLETED"}x!=="PRE_DRAG"&&(Z(),yt()),r.dispatch(KI(P.liftActionArgs)),x="DRAGGING";function V(fe,_e={shouldBlockNextClick:!1}){if(P.cleanup(),_e.shouldBlockNextClick){const De=jo(window,[{eventName:"click",fn:rM,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(De)}Z(),r.dispatch(i3({reason:fe}))}return{isActive:()=>$u({expected:"DRAGGING",phase:x,isLockActive:w,shouldWarn:!1}),shouldRespectForcePress:v,drop:fe=>V("DROP",fe),cancel:fe=>V("CANCEL",fe),...P.actions}}function R(P){const Z=Vc(fe=>{k(()=>s3({client:fe}))});return{...N({liftActionArgs:{id:o,clientSelection:P,movementMode:"FLUID"},cleanup:()=>Z.cancel(),actions:{move:Z}}),move:Z}}function Q(){const P={moveUp:()=>k(ok),moveRight:()=>k(lk),moveDown:()=>k(ak),moveLeft:()=>k(ck)};return N({liftActionArgs:{id:o,clientSelection:qE(g),movementMode:"SNAP"},cleanup:yl,actions:P})}function F(){$u({expected:"PRE_DRAG",phase:x,isLockActive:w,shouldWarn:!0})&&e.release()}return{isActive:()=>$u({expected:"PRE_DRAG",phase:x,isLockActive:w,shouldWarn:!1}),shouldRespectForcePress:v,fluidLift:R,snapLift:Q,abort:F}}const sM=[BE,FE,GE];function iM({contextId:e,store:t,registry:r,customSensors:s,enableDefaultSensors:o}){const c=[...o?sM:[],...s||[]],u=T.useState(()=>AE())[0],f=ir(function(N,R){Jc(N)&&!Jc(R)&&u.tryAbandon()},[u]);mo(function(){let N=t.getState();return t.subscribe(()=>{const Q=t.getState();f(N,Q),N=Q})},[u,t,f]),mo(()=>u.tryAbandon,[u.tryAbandon]);const m=ir(k=>_3({lockAPI:u,registry:r,store:t,draggableId:k}),[u,r,t]),g=ir((k,N,R)=>nM({lockAPI:u,registry:r,contextId:e,store:t,draggableId:k,forceSensorStop:N||null,sourceEvent:R&&R.sourceEvent?R.sourceEvent:null}),[e,u,r,t]),b=ir(k=>eM(e,k),[e]),x=ir(k=>{const N=r.draggable.findById(k);return N?N.options:null},[r.draggable]),v=ir(function(){u.isClaimed()&&(u.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(Dp()))},[u,t]),w=ir(()=>u.isClaimed(),[u]),I=Jr(()=>({canGetLock:m,tryGetLock:g,findClosestDraggableId:b,findOptionsForDraggable:x,tryReleaseLock:v,isLockClaimed:w}),[m,g,b,x,v,w]);for(let k=0;k<c.length;k++)c[k](I)}const oM=e=>({onBeforeCapture:t=>{const r=()=>{e.onBeforeCapture&&e.onBeforeCapture(t)};qa.flushSync(r)},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),aM=e=>({...Xc,...e.autoScrollerOptions,durationDampening:{...Xc.durationDampening,...e.autoScrollerOptions}});function wc(e){return e.current||yt(),e.current}function lM(e){const{contextId:t,setCallbacks:r,sensors:s,nonce:o,dragHandleUsageInstructions:c}=e,u=T.useRef(null),f=y3(e),m=ir(()=>oM(f.current),[f]),g=ir(()=>aM(f.current),[f]),b=bE(t),x=wE({contextId:t,text:c}),v=dE(t,o),w=ir(De=>{wc(u).dispatch(De)},[]),I=Jr(()=>wg({publishWhileDragging:JI,updateDroppableScroll:tk,updateDroppableIsEnabled:rk,updateDroppableIsCombineEnabled:nk,collectionStarting:ek},w),[w]),k=mE(),N=Jr(()=>zk(k,I),[k,I]),R=Jr(()=>oE({scrollWindow:Hk,scrollDroppable:N.scrollDroppable,getAutoScrollerOptions:g,...wg({move:s3},w)}),[N.scrollDroppable,w,g]),Q=fE(t),F=Jr(()=>Ok({announce:b,autoScroller:R,dimensionMarshal:N,focusMarshal:Q,getResponders:m,styleMarshal:v}),[b,R,N,Q,m,v]);u.current=F;const q=ir(()=>{const De=wc(u);De.getState().phase!=="IDLE"&&De.dispatch(Dp())},[]),P=ir(()=>{const De=wc(u).getState();return De.phase==="DROP_ANIMATING"?!0:De.phase==="IDLE"?!1:De.isDragging},[]),Z=Jr(()=>({isDragging:P,tryAbort:q}),[P,q]);r(Z);const V=ir(De=>f3(wc(u).getState(),De),[]),fe=ir(()=>Pl(wc(u).getState()),[]),_e=Jr(()=>({marshal:N,focus:Q,contextId:t,canLift:V,isMovementAllowed:fe,dragHandleUsageInstructionsId:x,registry:k}),[t,N,x,Q,V,fe,k]);return iM({contextId:t,store:F,registry:k,customSensors:s||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),T.useEffect(()=>q,[q]),S.createElement(zd.Provider,{value:_e},S.createElement(NL,{context:Up,store:F},e.children))}function cM(){return S.useId()}function _d(e){const t=cM(),r=e.dragHandleUsageInstructions||id.dragHandleUsageInstructions;return S.createElement(FL,null,s=>S.createElement(lM,{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 Yg={dragging:5e3,dropAnimating:4500},uM=(e,t)=>t?jc.drop(t.duration):e?jc.snap:jc.fluid,dM=(e,t)=>{if(e)return t?Kc.opacity.drop:Kc.opacity.combining},hM=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function fM(e){const r=e.dimension.client,{offset:s,combineWith:o,dropping:c}=e,u=!!o,f=hM(e),m=!!c,g=m?qf.drop(s,u):qf.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:uM(f,c),transform:g,opacity:dM(u,m),zIndex:m?Yg.dropAnimating:Yg.dragging,pointerEvents:"none"}}function pM(e){return{transform:qf.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function mM(e){return e.type==="DRAGGING"?fM(e):pM(e)}function gM(e,t,r=ai){const s=window.getComputedStyle(t),o=t.getBoundingClientRect(),c=Rx(o,s),u=yd(c,r),f={client:c,tagName:t.tagName.toLowerCase(),display:s.display},m={x:c.marginBox.width,y:c.marginBox.height};return{descriptor:e,placeholder:f,displaceBy:m,client:c,page:u}}function xM(e){const t=$p("draggable"),{descriptor:r,registry:s,getDraggableRef:o,canDragInteractiveElements:c,shouldRespectForcePress:u,isEnabled:f}=e,m=Jr(()=>({canDragInteractiveElements:c,shouldRespectForcePress:u,isEnabled:f}),[c,f,u]),g=ir(w=>{const I=o();return I||yt(),gM(r,I,w)},[r,o]),b=Jr(()=>({uniqueId:t,descriptor:r,options:m,getDimension:g}),[r,g,m,t]),x=T.useRef(b),v=T.useRef(!0);mo(()=>(s.draggable.register(x.current),()=>s.draggable.unregister(x.current)),[s.draggable]),mo(()=>{if(v.current){v.current=!1;return}const w=x.current;x.current=b,s.draggable.update(b,w)},[b,s.draggable])}var Hp=S.createContext(null);function Sd(e){const t=T.useContext(e);return t||yt(),t}function bM(e){e.preventDefault()}const yM=e=>{const t=T.useRef(null),r=ir((Z=null)=>{t.current=Z},[]),s=ir(()=>t.current,[]),{contextId:o,dragHandleUsageInstructionsId:c,registry:u}=Sd(zd),{type:f,droppableId:m}=Sd(Hp),g=Jr(()=>({id:e.draggableId,index:e.index,type:f,droppableId:m}),[e.draggableId,e.index,f,m]),{children:b,draggableId:x,isEnabled:v,shouldRespectForcePress:w,canDragInteractiveElements:I,isClone:k,mapped:N,dropAnimationFinished:R}=e;if(!k){const Z=Jr(()=>({descriptor:g,registry:u,getDraggableRef:s,canDragInteractiveElements:I,shouldRespectForcePress:w,isEnabled:v}),[g,u,s,I,w,v]);xM(Z)}const Q=Jr(()=>v?{tabIndex:0,role:"button","aria-describedby":c,"data-rfd-drag-handle-draggable-id":x,"data-rfd-drag-handle-context-id":o,draggable:!1,onDragStart:bM}:null,[o,c,x,v]),F=ir(Z=>{N.type==="DRAGGING"&&N.dropping&&Z.propertyName==="transform"&&qa.flushSync(R)},[R,N]),q=Jr(()=>{const Z=mM(N),V=N.type==="DRAGGING"&&N.dropping?F:void 0;return{innerRef:r,draggableProps:{"data-rfd-draggable-context-id":o,"data-rfd-draggable-id":x,style:Z,onTransitionEnd:V},dragHandleProps:Q}},[o,Q,x,N,F,r]),P=Jr(()=>({draggableId:g.id,type:g.type,source:{index:g.index,droppableId:g.droppableId}}),[g.droppableId,g.id,g.index,g.type]);return S.createElement(S.Fragment,null,b(q,N.snapshot,P))};var S3=(e,t)=>e===t,L3=e=>{const{combine:t,destination:r}=e;return r?r.droppableId:t?t.droppableId:null};const vM=e=>e.combine?e.combine.draggableId:null,wM=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function AM(){const e=oi((o,c)=>({x:o,y:c})),t=oi((o,c,u=null,f=null,m=null)=>({isDragging:!0,isClone:c,isDropAnimating:!!m,dropAnimation:m,mode:o,draggingOver:u,combineWith:f,combineTargetFor:null})),r=oi((o,c,u,f,m=null,g=null,b=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:m,combineWith:g,mode:c,offset:o,dimension:u,forceShouldAnimate:b,snapshot:t(c,f,m,g,null)}}));return(o,c)=>{if(Jc(o)){if(o.critical.draggable.id!==c.draggableId)return null;const u=o.current.client.offset,f=o.dimensions.draggables[c.draggableId],m=po(o.impact),g=wM(o.impact),b=o.forceShouldAnimate;return r(e(u.x,u.y),o.movementMode,f,c.isClone,m,g,b)}if(o.phase==="DROP_ANIMATING"){const u=o.completed;if(u.result.draggableId!==c.draggableId)return null;const f=c.isClone,m=o.dimensions.draggables[c.draggableId],g=u.result,b=g.mode,x=L3(g),v=vM(g),I={duration:o.dropDuration,curve:Bp.drop,moveTo:o.newHomeClientOffset,opacity:v?Kc.opacity.drop:null,scale:v?Kc.scale.drop:null};return{mapped:{type:"DRAGGING",offset:o.newHomeClientOffset,dimension:m,dropping:I,draggingOver:x,combineWith:v,mode:b,forceShouldAnimate:null,snapshot:t(b,f,x,v,I)}}}return null}}function I3(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const TM={mapped:{type:"SECONDARY",offset:ai,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:I3(null)}};function CM(){const e=oi((u,f)=>({x:u,y:f})),t=oi(I3),r=oi((u,f=null,m)=>({mapped:{type:"SECONDARY",offset:u,combineTargetFor:f,shouldAnimateDisplacement:m,snapshot:t(f)}})),s=u=>u?r(ai,u,!0):null,o=(u,f,m,g)=>{const b=m.displaced.visible[u],x=!!(g.inVirtualList&&g.effected[u]),v=Od(m),w=v&&v.draggableId===u?f:null;if(!b){if(!x)return s(w);if(m.displaced.invisible[u])return null;const N=z0(g.displacedBy.point),R=e(N.x,N.y);return r(R,w,!0)}if(x)return s(w);const I=m.displacedBy.point,k=e(I.x,I.y);return r(k,w,b.shouldAnimate)};return(u,f)=>{if(Jc(u))return u.critical.draggable.id===f.draggableId?null:o(f.draggableId,u.critical.draggable.id,u.impact,u.afterCritical);if(u.phase==="DROP_ANIMATING"){const m=u.completed;return m.result.draggableId===f.draggableId?null:o(f.draggableId,m.result.draggableId,m.impact,m.afterCritical)}return null}}const _M=()=>{const e=AM(),t=CM();return(s,o)=>e(s,o)||t(s,o)||TM},SM={dropAnimationFinished:o3},LM=Mx(_M,SM,null,{context:Up,areStatePropsEqual:S3})(yM);function k3(e){return Sd(Hp).isUsingCloneFor===e.draggableId&&!e.isClone?null:S.createElement(LM,e)}function Ha(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,r=!!e.disableInteractiveElementBlocking,s=!!e.shouldRespectForcePress;return S.createElement(k3,vd({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:r,shouldRespectForcePress:s}))}const E3=e=>t=>e===t,IM=E3("scroll"),kM=E3("auto"),Kg=(e,t)=>t(e.overflowX)||t(e.overflowY),EM=e=>{const t=window.getComputedStyle(e),r={overflowX:t.overflowX,overflowY:t.overflowY};return Kg(r,IM)||Kg(r,kM)},MM=()=>!1,M3=e=>e==null?null:e===document.body?MM()?e:null:e===document.documentElement?null:EM(e)?e:M3(e.parentElement);var Kf=e=>({x:e.scrollLeft,y:e.scrollTop});const R3=e=>e?window.getComputedStyle(e).position==="fixed"?!0:R3(e.parentElement):!1;var RM=e=>{const t=M3(e),r=R3(e);return{closestScrollable:t,isFixedOnPage:r}},NM=({descriptor:e,isEnabled:t,isCombineEnabled:r,isFixedOnPage:s,direction:o,client:c,page:u,closest:f})=>{const m=(()=>{if(!f)return null;const{scrollSize:v,client:w}=f,I=u3({scrollHeight:v.scrollHeight,scrollWidth:v.scrollWidth,height:w.paddingBox.height,width:w.paddingBox.width});return{pageMarginBox:f.page.marginBox,frameClient:w,scrollSize:v,shouldClipSubject:f.shouldClipSubject,scroll:{initial:f.scroll,current:f.scroll,max:I,diff:{value:ai,displacement:ai}}}})(),g=o==="vertical"?kp:zx,b=B0({page:u,withPlaceholder:null,axis:g,frame:m});return{descriptor:e,isCombineEnabled:r,isFixedOnPage:s,axis:g,isEnabled:t,client:c,page:u,frame:m,subject:b}};const DM=(e,t)=>{const r=Nx(e);if(!t||e!==t)return r;const s=r.paddingBox.top-t.scrollTop,o=r.paddingBox.left-t.scrollLeft,c=s+t.scrollHeight,u=o+t.scrollWidth,m=_p({top:s,right:u,bottom:c,left:o},r.border);return Sp({borderBox:m,margin:r.margin,border:r.border,padding:r.padding})};var QM=({ref:e,descriptor:t,env:r,windowScroll:s,direction:o,isDropDisabled:c,isCombineEnabled:u,shouldClipSubject:f})=>{const m=r.closestScrollable,g=DM(e,m),b=yd(g,s),x=(()=>{if(!m)return null;const w=Nx(m),I={scrollHeight:m.scrollHeight,scrollWidth:m.scrollWidth};return{client:w,page:yd(w,s),scroll:Kf(m),scrollSize:I,shouldClipSubject:f}})();return NM({descriptor:t,isEnabled:!c,isCombineEnabled:u,isFixedOnPage:r.isFixedOnPage,direction:o,client:g,page:b,closest:x})};const BM={passive:!1},jM={passive:!0};var Xg=e=>e.shouldPublishImmediately?BM:jM;const zu=e=>e&&e.env.closestScrollable||null;function PM(e){const t=T.useRef(null),r=Sd(zd),s=$p("droppable"),{registry:o,marshal:c}=r,u=y3(e),f=Jr(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),m=T.useRef(f),g=Jr(()=>oi((q,P)=>{t.current||yt();const Z={x:q,y:P};c.updateDroppableScroll(f.id,Z)}),[f.id,c]),b=ir(()=>{const q=t.current;return!q||!q.env.closestScrollable?ai:Kf(q.env.closestScrollable)},[]),x=ir(()=>{const q=b();g(q.x,q.y)},[b,g]),v=Jr(()=>Vc(x),[x]),w=ir(()=>{const q=t.current,P=zu(q);if(q&&P||yt(),q.scrollOptions.shouldPublishImmediately){x();return}v()},[v,x]),I=ir((q,P)=>{t.current&&yt();const Z=u.current,V=Z.getDroppableRef();V||yt();const fe=RM(V),_e={ref:V,descriptor:f,env:fe,scrollOptions:P};t.current=_e;const De=QM({ref:V,descriptor:f,env:fe,windowScroll:q,direction:Z.direction,isDropDisabled:Z.isDropDisabled,isCombineEnabled:Z.isCombineEnabled,shouldClipSubject:!Z.ignoreContainerClipping}),be=fe.closestScrollable;return be&&(be.setAttribute(Wg.contextId,r.contextId),be.addEventListener("scroll",w,Xg(_e.scrollOptions))),De},[r.contextId,f,w,u]),k=ir(()=>{const q=t.current,P=zu(q);return q&&P||yt(),Kf(P)},[]),N=ir(()=>{const q=t.current;q||yt();const P=zu(q);t.current=null,P&&(v.cancel(),P.removeAttribute(Wg.contextId),P.removeEventListener("scroll",w,Xg(q.scrollOptions)))},[w,v]),R=ir(q=>{const P=t.current;P||yt();const Z=zu(P);Z||yt(),Z.scrollTop+=q.y,Z.scrollLeft+=q.x},[]),Q=Jr(()=>({getDimensionAndWatchScroll:I,getScrollWhileDragging:k,dragStopped:N,scroll:R}),[N,I,k,R]),F=Jr(()=>({uniqueId:s,descriptor:f,callbacks:Q}),[Q,f,s]);mo(()=>(m.current=F.descriptor,o.droppable.register(F),()=>{t.current&&N(),o.droppable.unregister(F)}),[Q,f,N,F,c,o.droppable]),mo(()=>{t.current&&c.updateDroppableIsEnabled(m.current.id,!e.isDropDisabled)},[e.isDropDisabled,c]),mo(()=>{t.current&&c.updateDroppableIsCombineEnabled(m.current.id,e.isCombineEnabled)},[e.isCombineEnabled,c])}function lf(){}const Jg={width:0,height:0,margin:VL},OM=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>e||r==="close"?Jg:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},FM=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>{const s=OM({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"?jc.placeholder:null}},UM=e=>{const t=T.useRef(null),r=ir(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:s,onTransitionEnd:o,onClose:c,contextId:u}=e,[f,m]=T.useState(e.animate==="open");T.useEffect(()=>f?s!=="open"?(r(),m(!1),lf):t.current?lf:(t.current=setTimeout(()=>{t.current=null,m(!1)}),r):lf,[s,f,r]);const g=ir(x=>{x.propertyName==="height"&&(o(),s==="close"&&c())},[s,c,o]),b=FM({isAnimatingOpenOnMount:f,animate:e.animate,placeholder:e.placeholder});return S.createElement(e.placeholder.tagName,{style:b,"data-rfd-placeholder-context-id":u,onTransitionEnd:g,ref:e.innerRef})};var $M=S.memo(UM);class zM extends S.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 HM=e=>{const t=T.useContext(zd);t||yt();const{contextId:r,isMovementAllowed:s}=t,o=T.useRef(null),c=T.useRef(null),{children:u,droppableId:f,type:m,mode:g,direction:b,ignoreContainerClipping:x,isDropDisabled:v,isCombineEnabled:w,snapshot:I,useClone:k,updateViewportMaxScroll:N,getContainerForClone:R}=e,Q=ir(()=>o.current,[]),F=ir((be=null)=>{o.current=be},[]);ir(()=>c.current,[]);const q=ir((be=null)=>{c.current=be},[]),P=ir(()=>{s()&&N({maxScroll:h3()})},[s,N]);PM({droppableId:f,type:m,mode:g,direction:b,isDropDisabled:v,isCombineEnabled:w,ignoreContainerClipping:x,getDroppableRef:Q});const Z=Jr(()=>S.createElement(zM,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:be,data:st,animate:Ue})=>S.createElement($M,{placeholder:st,onClose:be,innerRef:q,animate:Ue,contextId:r,onTransitionEnd:P})),[r,P,e.placeholder,e.shouldAnimatePlaceholder,q]),V=Jr(()=>({innerRef:F,placeholder:Z,droppableProps:{"data-rfd-droppable-id":f,"data-rfd-droppable-context-id":r}}),[r,f,Z,F]),fe=k?k.dragging.draggableId:null,_e=Jr(()=>({droppableId:f,type:m,isUsingCloneFor:fe}),[f,fe,m]);function De(){if(!k)return null;const{dragging:be,render:st}=k,Ue=S.createElement(k3,{draggableId:be.draggableId,index:be.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(Ee,ht)=>st(Ee,ht,be));return cv.createPortal(Ue,R())}return S.createElement(Hp.Provider,{value:_e},u(V,I),De())};function GM(){return document.body||yt(),document.body}const e2={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:GM},N3=e=>{let t={...e},r;for(r in e2)e[r]===void 0&&(t={...t,[r]:e2[r]});return t},cf=(e,t)=>e===t.droppable.type,t2=(e,t)=>t.draggables[e.draggable.id],WM=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},r=oi(c=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}})),s=oi((c,u,f,m,g,b)=>{const x=g.descriptor.id;if(g.descriptor.droppableId===c){const I=b?{render:b,dragging:r(g.descriptor)}:null,k={isDraggingOver:f,draggingOverWith:f?x:null,draggingFromThisWith:x,isUsingPlaceholder:!0};return{placeholder:g.placeholder,shouldAnimatePlaceholder:!1,snapshot:k,useClone:I}}if(!u)return t;if(!m)return e;const w={isDraggingOver:f,draggingOverWith:x,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:g.placeholder,shouldAnimatePlaceholder:!0,snapshot:w,useClone:null}});return(c,u)=>{const f=N3(u),m=f.droppableId,g=f.type,b=!f.isDropDisabled,x=f.renderClone;if(Jc(c)){const v=c.critical;if(!cf(g,v))return t;const w=t2(v,c.dimensions),I=po(c.impact)===m;return s(m,b,I,I,w,x)}if(c.phase==="DROP_ANIMATING"){const v=c.completed;if(!cf(g,v.critical))return t;const w=t2(v.critical,c.dimensions);return s(m,b,L3(v.result)===m,po(v.impact)===m,w,x)}if(c.phase==="IDLE"&&c.completed&&!c.shouldFlush){const v=c.completed;if(!cf(g,v.critical))return t;const w=po(v.impact)===m,I=!!(v.impact.at&&v.impact.at.type==="COMBINE"),k=v.critical.droppable.id===m;return w?I?e:t:k?e:t}return t}},VM={updateViewportMaxScroll:ik},Ga=Mx(WM,VM,(e,t,r)=>({...N3(r),...e,...t}),{context:Up,areStatePropsEqual:S3})(HM);function qM(){if(typeof window>"u")return E0(void 0);try{const e=window.localStorage.getItem(jf);return E0(e?JSON.parse(e):void 0)}catch{return E0(void 0)}}function uf(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(jf),r=t?JSON.parse(t):{},s=E0({...r,...e});window.localStorage.setItem(jf,JSON.stringify(s))}catch{}}function ZM(){const[e,t]=S.useState(qM);S.useEffect(()=>{uf(e)},[e]);const r=S.useCallback(o=>{t(c=>{const u=E0({...c,...o});return uf(u),u})},[]),s=S.useCallback(()=>{const o=E0(void 0);t(o),uf(o)},[]);return{terminalSettings:e,updateTerminalSettings:r,resetTerminalSettings:s}}const Xf="termdock-settings";function YM(e){return e==="shell"||e==="tmux"}function KM(){if(typeof window>"u")return{mode:"shell",tmuxName:"",userSelectedMode:null};try{const e=window.localStorage.getItem(Xf);if(!e)return{mode:"shell",tmuxName:"",userSelectedMode:null};const t=JSON.parse(e),r=t.newSessionModeUserSelected===!0&&YM(t.newSessionMode)?t.newSessionMode:null,s=r??"shell",o=typeof t.newSessionTmuxName=="string"?t.newSessionTmuxName:"";return{mode:s,tmuxName:o,userSelectedMode:r}}catch{return{mode:"shell",tmuxName:"",userSelectedMode:null}}}function r2(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(Xf),s={...t?JSON.parse(t):{},...e};window.localStorage.setItem(Xf,JSON.stringify(s))}catch{}}function XM(){const[e,t]=S.useState(KM),r=S.useCallback((o,c)=>{const u=c?.userInitiated!==!1;t(f=>({...f,mode:o,userSelectedMode:u?o:f.userSelectedMode})),u&&r2({newSessionMode:o,newSessionModeUserSelected:!0})},[]),s=S.useCallback(o=>{t(c=>({...c,tmuxName:o})),r2({newSessionTmuxName:o})},[]);return{newSessionMode:e.mode,newSessionTmuxName:e.tmuxName,userSelectedNewSessionMode:e.userSelectedMode,setNewSessionMode:r,setNewSessionTmuxName:s}}const JM=550,eR=10;function D3(){const e=T.useRef(null),t=T.useRef(null),r=T.useRef(!1),s=T.useRef(!1),o=T.useRef(null),c=T.useCallback(()=>{e.current!=null&&(window.clearTimeout(e.current),e.current=null)},[]),u=T.useCallback(()=>{c(),t.current=null},[c]);return T.useCallback(m=>({onPointerDown:g=>{g.pointerType!=="touch"&&g.pointerType!=="pen"||(u(),r.current=!1,t.current={pointerId:g.pointerId,startX:g.clientX,startY:g.clientY},e.current=window.setTimeout(()=>{e.current=null,t.current&&(r.current=!0,m())},JM))},onPointerMove:g=>{const b=t.current;if(!b||b.pointerId!==g.pointerId||r.current)return;const x=g.clientX-b.startX,v=g.clientY-b.startY;Math.hypot(x,v)>eR&&u()},onPointerUp:g=>{r.current&&(g.preventDefault(),r.current=!1,s.current=!0,o.current!=null&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>{s.current=!1,o.current=null},600)),u()},onPointerCancel:u,onPointerLeave:g=>{t.current?.pointerId===g.pointerId&&!r.current&&u()},onClickCapture:g=>{s.current&&(s.current=!1,o.current!=null&&(window.clearTimeout(o.current),o.current=null),g.preventDefault(),g.stopPropagation())}}),[u])}function n2({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 tR(e,t,r){return!!(e&&t===e&&!r)}function s2({sessionIds:e}){const t=Hy(o=>e.reduce((c,u)=>c+(o.unread[u]?.length??0),0)),{locale:r}=qr();if(!t)return null;const s=r==="zh"?`${t} 条未读进展`:`${t} unread progress updates`;return a.jsx("span",{title:s,"aria-label":s,className:"inline-flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full bg-primary/15 px-1 text-[10px] font-medium text-primary",children:t>99?"99+":t})}function rR(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]),o=new URL(r);return!["https:","http:"].includes(o.protocol)||o.origin!==r||!s?null:{origin:r,sessionId:s}}catch{return null}}async function Q3(e){const t=rR(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 nR(e,t,r){return Math.max(t,Math.min(e,r))}const os={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 i2(e,t,r){return t===0||Math.abs(t)===1/0?Math.pow(e,r*5):e*t*r/(t+r*e)}function o2(e,t,r,s=.15){return s===0?nR(e,t,r):e<t?-i2(t-e,r-t,s)+t:e>r?+i2(e-r,r-t,s)+r:e}function sR(e,[t,r],[s,o]){const[[c,u],[f,m]]=e;return[o2(t,c,u,s),o2(r,f,m,o)]}function iR(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 oR(e){var t=iR(e,"string");return typeof t=="symbol"?t:String(t)}function js(e,t,r){return t=oR(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,s)}return r}function us(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?a2(Object(r),!0).forEach(function(s){js(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a2(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}const B3={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 l2(e){return e?e[0].toUpperCase()+e.slice(1):""}const aR=["enter","leave"];function lR(e=!1,t){return e&&!aR.includes(t)}function cR(e,t="",r=!1){const s=B3[e],o=s&&s[t]||t;return"on"+l2(e)+l2(o)+(lR(r,o)?"Capture":"")}const uR=["gotpointercapture","lostpointercapture"];function dR(e){let t=e.substring(2).toLowerCase();const r=!!~t.indexOf("passive");r&&(t=t.replace("passive",""));const s=uR.includes(t)?"capturecapture":"capture",o=!!~t.indexOf(s);return o&&(t=t.replace("capture","")),{device:t,capture:o,passive:r}}function hR(e,t=""){const r=B3[e],s=r&&r[t]||t;return e+s}function Gd(e){return"touches"in e}function j3(e){return Gd(e)?"touch":"pointerType"in e?e.pointerType:"mouse"}function fR(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 pR(e){return e.type==="touchend"||e.type==="touchcancel"?e.changedTouches:e.targetTouches}function P3(e){return Gd(e)?pR(e)[0]:e}function Jf(e,t){try{const r=t.clientX-e.clientX,s=t.clientY-e.clientY,o=(t.clientX+e.clientX)/2,c=(t.clientY+e.clientY)/2,u=Math.hypot(r,s);return{angle:-(Math.atan2(r,s)*180)/Math.PI,distance:u,origin:[o,c]}}catch{}return null}function mR(e){return fR(e).map(t=>t.identifier)}function c2(e,t){const[r,s]=Array.from(e.touches).filter(o=>t.includes(o.identifier));return Jf(r,s)}function df(e){const t=P3(e);return Gd(e)?t.identifier:t.pointerId}function O0(e){const t=P3(e);return[t.clientX,t.clientY]}const u2=40,d2=800;function O3(e){let{deltaX:t,deltaY:r,deltaMode:s}=e;return s===1?(t*=u2,r*=u2):s===2&&(t*=d2,r*=d2),[t,r]}function gR(e){var t,r;const{scrollX:s,scrollY:o,scrollLeft:c,scrollTop:u}=e.currentTarget;return[(t=s??c)!==null&&t!==void 0?t:0,(r=o??u)!==null&&r!==void 0?r:0]}function xR(e){const t={};if("buttons"in e&&(t.buttons=e.buttons),"shiftKey"in e){const{shiftKey:r,altKey:s,metaKey:o,ctrlKey:c}=e;Object.assign(t,{shiftKey:r,altKey:s,metaKey:o,ctrlKey:c})}return t}function Ld(e,...t){return typeof e=="function"?e(...t):e}function bR(){}function yR(...e){return e.length===0?bR:e.length===1?e[0]:function(){let t;for(const r of e)t=r.apply(this,arguments)||t;return t}}function h2(e,t){return Object.assign({},t,e||{})}const vR=32;class F3{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:o}=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=o,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?Ld(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:o}=this;r.args=this.args;let c=0;if(t&&(r.event=t,s.preventDefault&&t.cancelable&&r.event.preventDefault(),r.type=t.type,o.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,o.locked=!!document.pointerLockElement,Object.assign(o,xR(t)),o.down=o.pressed=o.buttons%2===1||o.touches>0,c=t.timeStamp-r.timeStamp,r.timeStamp=t.timeStamp,r.elapsedTime=r.timeStamp-r.startTime),r._active){const Z=r._delta.map(Math.abs);os.addTo(r._distance,Z)}this.axisIntent&&this.axisIntent(t);const[u,f]=r._movement,[m,g]=s.threshold,{_step:b,values:x}=r;if(s.hasCustomTransform?(b[0]===!1&&(b[0]=Math.abs(u)>=m&&x[0]),b[1]===!1&&(b[1]=Math.abs(f)>=g&&x[1])):(b[0]===!1&&(b[0]=Math.abs(u)>=m&&Math.sign(u)*m),b[1]===!1&&(b[1]=Math.abs(f)>=g&&Math.sign(f)*g)),r.intentional=b[0]!==!1||b[1]!==!1,!r.intentional)return;const v=[0,0];if(s.hasCustomTransform){const[Z,V]=x;v[0]=b[0]!==!1?Z-b[0]:0,v[1]=b[1]!==!1?V-b[1]:0}else v[0]=b[0]!==!1?u-b[0]:0,v[1]=b[1]!==!1?f-b[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=o[this.ingKey]=r._active,t&&(r.first&&("bounds"in s&&(r._bounds=Ld(s.bounds,r)),this.setup&&this.setup()),r.movement=v,this.computeOffset()));const[k,N]=r.offset,[[R,Q],[F,q]]=r._bounds;r.overflow=[k<R?-1:k>Q?1:0,N<F?-1:N>q?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 P=r._active?s.rubberband||[0,0]:[0,0];if(r.offset=sR(r._bounds,r.offset,P),r.delta=os.sub(r.offset,w),this.computeMovement(),I&&(!r.last||c>vR)){r.delta=os.sub(r.offset,w);const Z=r.delta.map(Math.abs);os.addTo(r.distance,Z),r.direction=r.delta.map(Math.sign),r._direction=r._delta.map(Math.sign),!r.first&&c>0&&(r.velocity=[Z[0]/c,Z[1]/c],r.timeDelta=c)}}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 o=this.handler(us(us(us({},r),t),{},{[this.aliasKey]:t.values}));o!==void 0&&(t.memo=o)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function wR([e,t],r){const s=Math.abs(e),o=Math.abs(t);if(s>o&&s>r)return"x";if(o>s&&o>r)return"y"}class iu extends F3{constructor(...t){super(...t),js(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=os.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=os.sub(this.state.offset,this.state.lastOffset)}axisIntent(t){const r=this.state,s=this.config;if(!r.axis&&t){const o=typeof s.axisThreshold=="object"?s.axisThreshold[j3(t)]:s.axisThreshold;r.axis=wR(r._movement,o)}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 AR=e=>e,f2=.15,U3={enabled(e=!0){return e},eventOptions(e,t,r){return us(us({},r.shared.eventOptions),e)},preventDefault(e=!1){return e},triggerAllEvents(e=!1){return e},rubberband(e=0){switch(e){case!0:return[f2,f2];case!1:return[0,0];default:return os.toVector(e)}},from(e){if(typeof e=="function")return e;if(e!=null)return os.toVector(e)},transform(e,t,r){const s=e||r.shared.transform;return this.hasCustomTransform=!!s,s||AR},threshold(e){return os.toVector(e,0)}},TR=0,Xl=us(us({},U3),{},{axis(e,t,{axis:r}){if(this.lockDirection=r==="lock",!this.lockDirection)return r},axisThreshold(e=TR){return e},bounds(e={}){if(typeof e=="function")return c=>Xl.bounds(e(c));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:o=1/0}=e;return[[t,r],[s,o]]}}),p2={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 CR extends iu{constructor(...t){super(...t),js(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(),o={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=Xl.bounds(o)}}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 o=this.ctrl.setEventIds(t);r.pointerCapture&&t.target.setPointerCapture(t.pointerId),!(o&&o.size>1&&s._pointerActive)&&(this.start(t),this.setupPointer(t),s._pointerId=df(t),s._pointerActive=!0,this.computeValues(O0(t)),this.computeInitial(),r.preventScrollAxis&&j3(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 o=df(t);if(r._pointerId!==void 0&&o!==r._pointerId)return;const c=O0(t);if(document.pointerLockElement===t.target?r._delta=[t.movementX,t.movementY]:(r._delta=os.sub(c,r._values),this.computeValues(c)),os.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 o=df(t);if(r._pointerId!==void 0&&o!==r._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(t);const[c,u]=r._distance;if(r.tap=c<=s.tapsThreshold&&u<=s.tapsThreshold,r.tap&&s.filterTaps)r._force=!0;else{const[f,m]=r._delta,[g,b]=r._movement,[x,v]=s.swipe.velocity,[w,I]=s.swipe.distance,k=s.swipe.duration;if(r.elapsedTime<k){const N=Math.abs(f/r.timeDelta),R=Math.abs(m/r.timeDelta);N>x&&Math.abs(g)>w&&(r.swipe[0]=Math.sign(f)),R>v&&Math.abs(b)>I&&(r.swipe[1]=Math.sign(m))}}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,_R(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=p2[t.key];if(r){const s=this.state,o=t.shiftKey?10:t.altKey?.1:1;this.start(t),s._delta=r(this.config.keyboardDisplacement,o),s._keyboardActive=!0,os.addTo(s._movement,s._delta),this.compute(t),this.emit()}}keyUp(t){t.key in p2&&(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 _R(e){"persist"in e&&typeof e.persist=="function"&&e.persist()}const ou=typeof window<"u"&&window.document&&window.document.createElement;function $3(){return ou&&"ontouchstart"in window}function SR(){return $3()||ou&&window.navigator.maxTouchPoints>1}function LR(){return ou&&"onpointerdown"in window}function IR(){return ou&&"exitPointerLock"in window.document}function kR(){try{return"constructor"in GestureEvent}catch{return!1}}const Bo={isBrowser:ou,gesture:kR(),touch:$3(),touchscreen:SR(),pointer:LR(),pointerLock:IR()},ER=250,MR=180,RR=.5,NR=50,DR=250,QR=10,m2={mouse:0,touch:0,pen:8},BR=us(us({},Xl),{},{device(e,t,{pointer:{touch:r=!1,lock:s=!1,mouse:o=!1}={}}){return this.pointerLock=s&&Bo.pointerLock,Bo.touch&&r?"touch":this.pointerLock?"mouse":Bo.pointer&&!o?"pointer":Bo.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:r}){if(this.preventScrollDelay=typeof r=="number"?r:r||r===void 0&&e?ER:void 0,!(!Bo.touchscreen||r===!1))return e||(r!==void 0?"y":void 0)},pointerCapture(e,t,{pointer:{capture:r=!0,buttons:s=1,keys:o=!0}={}}){return this.pointerButtons=s,this.keys=o,!this.pointerLock&&this.device==="pointer"&&r},threshold(e,t,{filterTaps:r=!1,tapsThreshold:s=3,axis:o=void 0}){const c=os.toVector(e,r?s:o?1:0);return this.filterTaps=r,this.tapsThreshold=s,c},swipe({velocity:e=RR,distance:t=NR,duration:r=DR}={}){return{velocity:this.transform(os.toVector(e)),distance:this.transform(os.toVector(t)),duration:r}},delay(e=0){switch(e){case!0:return MR;case!1:return 0;default:return e}},axisThreshold(e){return e?us(us({},m2),e):m2},keyboardDisplacement(e=QR){return e}});function z3(e){const[t,r]=e.overflow,[s,o]=e._delta,[c,u]=e._direction;(t<0&&s>0&&c<0||t>0&&s<0&&c>0)&&(e._movement[0]=e._movementBound[0]),(r<0&&o>0&&u<0||r>0&&o<0&&u>0)&&(e._movement[1]=e._movementBound[1])}const jR=30,PR=100;class OR extends F3{constructor(...t){super(...t),js(this,"ingKey","pinching"),js(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=os.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 o=Math.abs(r)*jR-Math.abs(s);o<0?t.axis="angle":o>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(c=>s.has(c))||s.size<2)return;this.start(t),r._touchIds=Array.from(s).slice(0,2);const o=c2(t,r._touchIds);o&&this.pinchStart(t,o)}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,o=this.ctrl.pointerIds;if(r._active&&Array.from(s.keys()).every(u=>o.has(u))||(s.size<2&&s.set(t.pointerId,t),r._pointerEvents.size<2))return;this.start(t);const c=Jf(...Array.from(s.values()));c&&this.pinchStart(t,c)}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=c2(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=Jf(...Array.from(r.values()));s&&this.pinchMove(t,s)}pinchMove(t,r){const s=this.state,o=s._values[1],c=r.angle-o;let u=0;Math.abs(c)>270&&(u+=Math.sign(c)),this.computeValues([r.distance,r.angle-360*u]),s.origin=r.origin,s.turns=u,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=os.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=[-O3(t)[1]/PR*s.offset[0],0],os.addTo(s._movement,s._delta),z3(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 FR=us(us({},U3),{},{device(e,t,{shared:r,pointer:{touch:s=!1}={}}){if(r.target&&!Bo.touch&&Bo.gesture)return"gesture";if(Bo.touch&&s)return"touch";if(Bo.touchscreen){if(Bo.pointer)return"pointer";if(Bo.touch)return"touch"}},bounds(e,t,{scaleBounds:r={},angleBounds:s={}}){const o=u=>{const f=h2(Ld(r,u),{min:-1/0,max:1/0});return[f.min,f.max]},c=u=>{const f=h2(Ld(s,u),{min:-1/0,max:1/0});return[f.min,f.max]};return typeof r!="function"&&typeof s!="function"?[o(),c()]:u=>[o(u),c(u)]},threshold(e,t,r){return this.lockDirection=r.axis==="lock",os.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey(e){return e===void 0?"ctrlKey":e},pinchOnWheel(e=!0){return e}});class UR extends iu{constructor(...t){super(...t),js(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(O0(t)),this.compute(t),this.computeInitial(),this.emit()}moveChange(t){if(!this.state._active)return;const r=O0(t),s=this.state;s._delta=os.sub(r,s._values),os.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 $R=us(us({},Xl),{},{mouseOnly:(e=!0)=>e});class zR extends iu{constructor(...t){super(...t),js(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=gR(t);r._delta=os.sub(s,r._values),os.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 HR=Xl;class GR extends iu{constructor(...t){super(...t),js(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=O3(t),os.addTo(r._movement,r._delta),z3(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 WR=Xl;class VR extends iu{constructor(...t){super(...t),js(this,"ingKey","hovering")}enter(t){this.config.mouseOnly&&t.pointerType!=="mouse"||(this.start(t),this.computeValues(O0(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=O0(t);r._movement=r._delta=os.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 qR=us(us({},Xl),{},{mouseOnly:(e=!0)=>e}),Gp=new Map,ep=new Map;function H3(e){Gp.set(e.key,e.engine),ep.set(e.key,e.resolver)}const G3={key:"drag",engine:CR,resolver:BR},ZR={key:"hover",engine:VR,resolver:qR},YR={key:"move",engine:UR,resolver:$R},KR={key:"pinch",engine:OR,resolver:FR},XR={key:"scroll",engine:zR,resolver:HR},JR={key:"wheel",engine:GR,resolver:WR};function eN(e,t){if(e==null)return{};var r={},s=Object.keys(e),o,c;for(c=0;c<s.length;c++)o=s[c],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function tN(e,t){if(e==null)return{};var r=eN(e,t),s,o;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(o=0;o<c.length;o++)s=c[o],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}const rN={target(e){if(e)return()=>"current"in e?e.current:e},enabled(e=!0){return e},window(e=Bo.isBrowser?window:void 0){return e},eventOptions({passive:e=!0,capture:t=!1}={}){return{passive:e,capture:t}},transform(e){return e}},nN=["target","eventOptions","window","enabled","transform"];function od(e={},t){const r={};for(const[s,o]of Object.entries(t))switch(typeof o){case"function":r[s]=o.call(r,e[s],s,e);break;case"object":r[s]=od(e[s],o);break;case"boolean":o&&(r[s]=e[s]);break}return r}function sN(e,t,r={}){const s=e,{target:o,eventOptions:c,window:u,enabled:f,transform:m}=s,g=tN(s,nN);if(r.shared=od({target:o,eventOptions:c,window:u,enabled:f,transform:m},rN),t){const b=ep.get(t);r[t]=od(us({shared:r.shared},g),b)}else for(const b in g){const x=ep.get(b);x&&(r[b]=od(us({shared:r.shared},g[b]),x))}return r}class W3{constructor(t,r){js(this,"_listeners",new Set),this._ctrl=t,this._gestureKey=r}add(t,r,s,o,c){const u=this._listeners,f=hR(r,s),m=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},g=us(us({},m),c);t.addEventListener(f,o,g);const b=()=>{t.removeEventListener(f,o,g),u.delete(b)};return u.add(b),b}clean(){this._listeners.forEach(t=>t()),this._listeners.clear()}}class iN{constructor(){js(this,"_timeouts",new Map)}add(t,r,s=140,...o){this.remove(t),this._timeouts.set(t,window.setTimeout(r,s,...o))}remove(t){const r=this._timeouts.get(t);r&&window.clearTimeout(r)}clean(){this._timeouts.forEach(t=>{window.clearTimeout(t)}),this._timeouts.clear()}}class oN{constructor(t){js(this,"gestures",new Set),js(this,"_targetEventStore",new W3(this)),js(this,"gestureEventStores",{}),js(this,"gestureTimeoutStores",{}),js(this,"handlers",{}),js(this,"config",{}),js(this,"pointerIds",new Set),js(this,"touchIds",new Set),js(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),aN(this,t)}setEventIds(t){if(Gd(t))return this.touchIds=new Set(mR(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=sN(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 o;if(!(r.target&&(o=r.target(),!o))){if(r.enabled){for(const u of this.gestures){const f=this.config[u],m=g2(s,f.eventOptions,!!o);if(f.enabled){const g=Gp.get(u);new g(this,t,u).bind(m)}}const c=g2(s,r.eventOptions,!!o);for(const u in this.nativeHandlers)c(u,"",f=>this.nativeHandlers[u](us(us({},this.state.shared),{},{event:f,args:t})),void 0,!0)}for(const c in s)s[c]=yR(...s[c]);if(!o)return s;for(const c in s){const{device:u,capture:f,passive:m}=dR(c);this._targetEventStore.add(o,u,"",s[c],{capture:f,passive:m})}}}}function y0(e,t){e.gestures.add(t),e.gestureEventStores[t]=new W3(e,t),e.gestureTimeoutStores[t]=new iN}function aN(e,t){t.drag&&y0(e,"drag"),t.wheel&&y0(e,"wheel"),t.scroll&&y0(e,"scroll"),t.move&&y0(e,"move"),t.pinch&&y0(e,"pinch"),t.hover&&y0(e,"hover")}const g2=(e,t,r)=>(s,o,c,u={},f=!1)=>{var m,g;const b=(m=u.capture)!==null&&m!==void 0?m:t.capture,x=(g=u.passive)!==null&&g!==void 0?g:t.passive;let v=f?s:cR(s,o,b);r&&x&&(v+="Passive"),e[v]=e[v]||[],e[v].push(c)},lN=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function cN(e){const t={},r={},s=new Set;for(let o in e)lN.test(o)?(s.add(RegExp.lastMatch),r[o]=e[o]):t[o]=e[o];return[r,t,s]}function v0(e,t,r,s,o,c){if(!e.has(r)||!Gp.has(s))return;const u=r+"Start",f=r+"End",m=g=>{let b;return g.first&&u in t&&t[u](g),r in t&&(b=t[r](g)),g.last&&f in t&&t[f](g),b};o[s]=m,c[s]=c[s]||{}}function uN(e,t){const[r,s,o]=cN(e),c={};return v0(o,r,"onDrag","drag",c,t),v0(o,r,"onWheel","wheel",c,t),v0(o,r,"onScroll","scroll",c,t),v0(o,r,"onPinch","pinch",c,t),v0(o,r,"onMove","move",c,t),v0(o,r,"onHover","hover",c,t),{handlers:c,config:t,nativeHandlers:s}}function V3(e,t={},r,s){const o=S.useMemo(()=>new oN(e),[]);if(o.applyHandlers(e,s),o.applyConfig(t,r),S.useEffect(o.effect.bind(o)),S.useEffect(()=>o.clean.bind(o),[]),t.target===void 0)return o.bind.bind(o)}function x2(e,t){return H3(G3),V3({drag:e},t||{},"drag")}function dN(e){return e.forEach(H3),function(r,s){const{handlers:o,nativeHandlers:c,config:u}=uN(r,s||{});return V3(o,u,void 0,c)}}function sB(e,t){return dN([G3,KR,XR,JR,YR,ZR])(e,t||{})}const b2={dampingRatio:.8,response:.3},hN=.998;function fN(e,t,r,s){const o=2*Math.PI/Math.max(e.response,.001),c=t-s,u=r,f=e.dampingRatio;if(Math.abs(f-1)<1e-4){const w=c,I=u+o*c;return{value:k=>s+(w+I*k)*Math.exp(-o*k),velocity:k=>(I-o*(w+I*k))*Math.exp(-o*k)}}if(f<1){const w=o*Math.sqrt(1-f*f),I=c,k=(u+f*o*c)/w;return{value:N=>s+Math.exp(-f*o*N)*(I*Math.cos(w*N)+k*Math.sin(w*N)),velocity:N=>Math.exp(-f*o*N)*((k*w-f*o*I)*Math.cos(w*N)-(I*w+f*o*k)*Math.sin(w*N))}}const m=o*Math.sqrt(f*f-1),g=-f*o+m,b=-f*o-m,x=(u-b*c)/(g-b),v=c-x;return{value:w=>s+x*Math.exp(g*w)+v*Math.exp(b*w),velocity:w=>x*g*Math.exp(g*w)+v*b*Math.exp(b*w)}}function pN(e,t=hN){return e/1e3*(t/(1-t))}function y2(e,t,r=.55){return e*t*r/(t+r*Math.abs(e))}function mN(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const gN=.1,xN=5;function bN(e,t,r,s,o){const c=fN(e,t,r,s),u=1e3/60,f=240,m=[];for(let g=0;g<f;g++){const b=g*u/1e3,x=c.value(b),v=c.velocity(b);if(m.push(o?o(x):x),g>0&&Math.abs(x-s)<gN&&Math.abs(v)<xN)break}return m.push(o?o(s):s),{frames:m,durationMs:(m.length-1)*u,solver:c}}const yN='input:not([type="hidden"]), textarea, select, [contenteditable]:not([contenteditable="false"])';function vN(){if(typeof document>"u")return;const e=document.activeElement;e instanceof HTMLElement&&e.matches(yN)&&e.blur()}const wN=18,v2=8,w2={touch:v2,pen:v2},AN=500,hf=200,A2=50,TN=`[${hv}]`;function ff(e,t,r){return Math.min(r,Math.max(t,e))}function T2(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 C2(e){if(!e||typeof e!="object")return!1;const t=e.target;return t instanceof Element&&!!t.closest(TN)}function Ac(...e){typeof window<"u"&&window.__SIDEBAR_DEBUG__&&console.log("[Sidebar]",...e)}const q3=S.forwardRef(function({side:t,isOpen:r,drawerWidthPx:s,onClose:o,onOpen:c,children:u,pinned:f=!1},m){const{t:g}=qr(),b=t==="left",x=b?-s:s,v=T.useRef(null),w=T.useRef(null),I=T.useRef(r?0:x),k=T.useRef(null),N=T.useRef(null),R=T.useRef(0),Q=T.useRef(null),F=T.useRef(null),q=T.useRef(!1),P=T.useRef(null),Z=T.useRef(!1),V=T.useRef([]),fe=T.useRef(null),_e=T.useRef(I.current),De=T.useRef(r?1:0),be=T.useRef(r);be.current=r;const st=T.useRef(x);st.current=x;const Ue=T.useRef(s);Ue.current=s;const Ee=T.useRef(b);Ee.current=b;const ht=T.useRef(o);ht.current=o;const Ve=T.useRef(c);Ve.current=c;const he=T.useCallback(de=>{v.current=de,typeof m=="function"?m(de):m&&(m.current=de)},[m]),Oe=T.useCallback(()=>{N.current!==null&&(window.cancelAnimationFrame(N.current),N.current=null),k.current=null},[]),ie=T.useCallback(de=>{const Ie=Ue.current;return Ee.current?(de+Ie)/Ie:(Ie-de)/Ie},[]),Le=T.useCallback(de=>{const Ie=w.current;Ie&&(Ie.style.opacity=String(ff(ie(de),0,1)))},[ie]),Xe=T.useCallback(de=>{I.current=de;const Ie=v.current;Ie&&(Ie.style.transform=`translateX(${de}px)`,Le(de))},[Le]),re=T.useCallback(de=>{k.current=de,N.current===null&&(N.current=window.requestAnimationFrame(()=>{N.current=null;const Ie=k.current;k.current=null,Ie!==null&&Xe(Ie)}))},[Xe]),ge=T.useCallback(()=>{N.current!==null&&(window.cancelAnimationFrame(N.current),N.current=null);const de=k.current;k.current=null,de!==null&&Xe(de)},[Xe]),Qt=T.useCallback(de=>{const Ie=st.current;return ff(de,Math.min(0,Ie),Math.max(0,Ie))},[]),Rt=T.useCallback(()=>{const de=Q.current;if(!de)return null;Q.current=null;const Ie=(performance.now()-de.startTime)/1e3,Qe={value:de.solver.value(Ie),velocity:de.solver.velocity(Ie)};return de.animations.forEach(Pe=>Pe.cancel()),Qe},[]),We=T.useCallback(()=>{F.current!==null&&(window.clearTimeout(F.current),F.current=null)},[]),W=T.useCallback(()=>{fe.current?.(),fe.current=null},[]),Je=T.useCallback(()=>{ge(),We();const de=Rt();de&&Xe(Qt(de.value));const Ie=v.current,Qe=w.current;Ie?.getAnimations().forEach(Pe=>Pe.cancel()),Ie&&(Ie.style.transition="none",Ie.style.opacity="1"),Qe?.getAnimations().forEach(Pe=>Pe.cancel()),Qe&&(Qe.style.transition="none")},[Xe,We,Qt,ge,Rt]),Se=T.useCallback((de,Ie)=>{ge(),We();const Qe=v.current,Pe=w.current,ft=de?0:st.current;Pe&&(Pe.style.pointerEvents=de?"auto":"none");const Mt=Rt(),Be=Mt?Qt(Mt.value):I.current,gr=Ie?.velocity??Mt?.velocity??0;if(mN())return I.current=ft,Qe&&(Qe.style.transition=`opacity ${hf}ms ease`,Qe.style.opacity=de?"1":"0",Qe.style.transform=`translateX(${ft}px)`),Pe&&(Pe.style.transition=`opacity ${hf}ms ease`,Pe.style.opacity=de?"1":"0"),hf;Qe&&(Qe.style.transition="none",Qe.style.opacity="1"),Pe&&(Pe.style.transition="none");const ct=Math.abs(Ie?.velocity??0)>AN,{frames:gt,durationMs:vt,solver:_t}=bN({dampingRatio:ct?b2.dampingRatio:1,response:b2.response},Be,gr,ft,Qt);if(!Qe||Math.abs(Be-ft)<.5&&Math.abs(gr)<5)return Xe(ft),0;const qt=Qe.animate(gt.map(Te=>({transform:`translateX(${Te}px)`})),{duration:vt,easing:"linear",fill:"forwards"}),ee=[qt];return Pe&&ee.push(Pe.animate(gt.map(Te=>({opacity:String(ff(ie(Te),0,1))})),{duration:vt,easing:"linear",fill:"forwards"})),Q.current={solver:_t,startTime:performance.now(),target:ft,animations:ee},Ac("spring start",{startX:Be,startVelocity:gr,targetX:ft,frames:gt.length,durationMs:vt}),qt.onfinish=()=>{const Te=Q.current;!Te||!Te.animations.includes(qt)||(Q.current=null,Xe(ft),Te.animations.forEach(Ze=>Ze.cancel()),Ac("spring finish",{targetX:ft}))},vt},[Xe,We,Qt,ge,ie,Rt]),me=T.useCallback(de=>{ge();const Ie=de,Qe=0,Pe=st.current,ft=I.current+pN(Ie),Mt=Math.abs(ft-Qe)<=Math.abs(ft-Pe);Ac("decideSnap",{velocity:Ie,currentX:I.current,projected:ft,shouldOpen:Mt});const Be=Se(Mt,{velocity:Ie});return Mt&&!be.current?F.current=window.setTimeout(()=>{F.current=null,Ve.current?.()},Be+A2):!Mt&&be.current&&(F.current=window.setTimeout(()=>{F.current=null,ht.current()},Be+A2)),Mt},[Se,ge]),ce=T.useCallback(de=>{const Ie=st.current,Qe=Math.min(0,Ie),Pe=Math.max(0,Ie),ft=Ue.current;return de<Qe?Qe-y2(Qe-de,ft):de>Pe?Pe+y2(de-Pe,ft):de},[]),qe=T.useCallback(de=>{const Ie=V.current,Qe=performance.now();Ie.push({t:Qe,x:de});const Pe=Qe-120;for(;Ie.length>0&&Ie[0].t<Pe;)Ie.shift()},[]),ue=T.useCallback(()=>{const de=V.current;if(de.length<2)return 0;const Ie=de[de.length-1];if(performance.now()-Ie.t>60)return 0;const Qe=de[0],Pe=(Ie.t-Qe.t)/1e3;return Pe<.016?0:(Ie.x-Qe.x)/Pe},[]);T.useEffect(()=>{We();const de=Q.current,Ie=r?0:st.current;de&&de.target===Ie||Se(r)},[r,Se,We]),T.useEffect(()=>{Je(),re(be.current?0:x)},[x,Je,re]),T.useEffect(()=>()=>{Oe(),We(),Rt(),W()},[We,Oe,W,Rt]);const Me=x2(({active:de,cancel:Ie,first:Qe,last:Pe,movement:[ft],event:Mt})=>{if(Ac("bindPanel",{active:de,first:Qe,last:Pe,mx:ft}),!T2(Mt)){Ie();return}if(Qe){if(W(),q.current=!1,P.current=null,V.current=[],C2(Mt)){Ie();return}const Be=v.current,gr=Be?fv(Mt.target,Be):null;if(!gr||pv()){Ie();return}const ct=mv(gr,ft,Ee.current?-1:1);if(Ac("arbitrate",{owner:ct.kind,mx:ft}),ct.kind==="swiper"){fe.current=gv(ct.instance),Ie();return}if(ct.kind==="scroller"){const gt=xv(ct.element);if(gt)P.current=gt;else{Ie();return}}P.current||(q.current=!0,Je(),R.current=I.current)}if(!de){P.current=null,q.current&&(q.current=!1,me(ue()));return}if(P.current){bv(P.current,ft);return}if(q.current){const Be=ce(R.current+ft);qe(Be),re(Be)}},{axis:"x",axisThreshold:w2,filterTaps:!0,pointer:{touch:!0}}),et=x2(({active:de,cancel:Ie,first:Qe,movement:[Pe],event:ft})=>{if(!T2(ft)){Ie();return}if(be.current){Ie();return}if(Qe&&(Z.current=!0,V.current=[],Je(),R.current=I.current),!de){Z.current&&(Z.current=!1,me(ue())&&vN());return}if(Z.current){const Mt=ce(R.current+Pe);qe(Mt),re(Mt)}},{axis:"x",axisThreshold:w2,filterTaps:!0,pointer:{touch:!0}}),bt=T.useCallback(de=>{de.preventDefault(),de.stopPropagation(),be.current||Ve.current?.()},[]);if(f)return a.jsx("aside",{ref:he,"data-sidebar":t,"data-sidebar-pinned":"true",className:"relative flex h-full min-h-0 w-full flex-col app-chrome-bg",children:u});const xe=Me();return a.jsxs(a.Fragment,{children:[a.jsx("div",{...et(),style:{position:"fixed",top:"1.5rem",bottom:"10rem",...b?{left:0}:{right:0},width:wN,zIndex:"var(--z-chrome-hint)",touchAction:"none",pointerEvents:r?"none":"auto"},onClick:bt,"aria-label":g(b?"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:De.current,pointerEvents:r?"auto":"none",transition:"none",willChange:"opacity"},onClick:o,"aria-label":g("sidebar.closeSidebar")}),a.jsx("aside",{...xe,onClickCapture:de=>{C2(de)||xe.onClickCapture?.(de)},ref:he,"data-sidebar":t,className:`fixed inset-y-0 z-sidebar-panel flex flex-col chrome-glow-panel will-change-transform ${b?"border-r border-border":"border-l border-border/15"}`,style:{...b?{left:0}:{right:0},width:s,maxWidth:b?"94vw":"95vw",transform:`translateX(${_e.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))",...b?{paddingLeft:"var(--safe-left-inset, env(safe-area-inset-left, 0px))"}:{paddingRight:"var(--safe-right-inset, env(safe-area-inset-right, 0px))"}},children:u})]})}),CN={activeKey:"root",items:[]},_N=()=>()=>{},SN=()=>CN;function LN(e){const t=Ia(),r=T.useSyncExternalStore(t?.subscribe??_N,t?.snapshot??SN),s=Gy(),o=r.items.map(c=>c.key===s?{...c,reviewCount:e}:c).filter(c=>c.reviewCount>0);return{host:t,groups:o,currentKey:s,active:!t||r.activeKey===s,total:t?e+o.reduce((c,u)=>c+(u.key===s?0:u.reviewCount),0):e,hasOtherAttention:o.some(c=>c.key!==s)}}function IN({groups:e,currentKey:t,onClose:r}){const{t:s}=qr(),o=T.useId(),c=T.useRef(null),u=T.useRef(null),f=T.useRef(r);f.current=r;const m=T.useRef(!0),[g,b]=T.useState(""),x=e.reduce((I,k)=>I+k.reviewCount,0);T.useEffect(()=>{const I=document.activeElement;u.current?.focus({preventScroll:!0});const k=N=>{if(N.key==="Escape"&&(N.preventDefault(),N.stopImmediatePropagation(),f.current()),N.key!=="Tab")return;const R=Array.from(c.current?.querySelectorAll("button:not(:disabled)")??[]),Q=R[0],F=R[R.length-1],q=!c.current?.contains(document.activeElement);N.shiftKey&&(document.activeElement===Q||q)?(N.preventDefault(),F?.focus()):!N.shiftKey&&(document.activeElement===F||q)&&(N.preventDefault(),Q?.focus())};return document.addEventListener("keydown",k,!0),()=>{document.removeEventListener("keydown",k,!0),m.current&&I?.isConnected&&!I.closest("[inert]")&&I.focus({preventScroll:!0})}},[]);const v=(I,k)=>{const N=Ia(),R=N?.snapshot().items.find(F=>F.key===I.key);if(!R?.reviewCount||k&&!R.attentionSessions?.some(F=>F.id===k)){b(s("serviceAttention.changed"));return}m.current=!1;let Q=!1;k&&I.key===t?(window.dispatchEvent(new CustomEvent("termdock:focus-session",{detail:k})),Q=!0):k&&R.service?.targetPeerId?Q=N?.focusSession(R.service.targetPeerId,k)??!1:R.service&&(Q=N?.activate(R.service,!0)??!1),Q?r():(m.current=!0,b(s("serviceAttention.unavailable")))},w=I=>I.phase==="offline"?s("serviceAttention.offline"):I.phase==="login"?s("serviceAttention.login"):I.phase==="connecting"||I.phase==="reconnecting"?s("connection.reconnecting"):null;return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button","aria-label":s("common.close"),tabIndex:-1,className:"fixed inset-0 z-modal-backdrop cursor-default bg-[var(--app-backdrop)]",onClick:r}),a.jsx("div",{className:"pointer-events-none fixed inset-0 z-modal-panel flex items-end justify-center p-3 sm:items-center sm:p-6",style:{paddingTop:"max(12px, var(--safe-top-inset, env(safe-area-inset-top, 0px)))",paddingBottom:"max(12px, var(--safe-bottom-inset, env(safe-area-inset-bottom, 0px)))"},children:a.jsxs("section",{ref:c,role:"dialog","aria-modal":"true","aria-labelledby":o,"data-sidebar-gesture-ignore":!0,onKeyDown:I=>I.stopPropagation(),className:"pointer-events-auto flex max-h-full w-full max-w-md flex-col overflow-hidden rounded-2xl border border-border bg-surface text-foreground shadow-xl",children:[a.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[a.jsx(Vl,{size:20,className:"shrink-0 text-[color:var(--warning)]","aria-hidden":"true"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{id:o,className:"text-sm font-semibold",children:s("serviceAttention.title")}),a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:s("serviceAttention.summary",{services:e.length,count:x})})]}),a.jsx("button",{ref:u,type:"button","aria-label":s("common.close"),onClick:r,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl text-muted-foreground hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:a.jsx(ys,{size:18})})]}),a.jsxs("div",{className:"min-h-0 overflow-y-auto overscroll-contain p-2",children:[e.length===0&&a.jsx("p",{role:"status",className:"px-4 py-8 text-center text-sm text-muted-foreground",children:s("serviceAttention.empty")}),e.map(I=>a.jsxs("section",{className:"mb-2 last:mb-0",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-3 pb-1 pt-2 text-xs",children:[a.jsx("h3",{className:"min-w-0 flex-1 truncate font-medium",title:I.service?.label,children:I.service?.label||s("serviceAttention.currentService")}),I.key===t&&a.jsx("span",{className:"shrink-0 text-muted-foreground",children:s("agent.currentSession")}),a.jsx("span",{className:"shrink-0 tabular-nums text-[color:var(--warning)]",children:I.reviewCount})]}),w(I)&&a.jsx("p",{className:"px-3 pb-1 text-xs text-[color:var(--warning)]",children:w(I)}),I.attentionSessions?.length?I.attentionSessions.map(k=>a.jsxs("button",{type:"button",onClick:()=>v(I,k.id),className:"flex min-h-14 w-full items-center gap-3 rounded-xl px-3 py-2 text-left hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"line-clamp-2 break-words text-sm",title:k.label,children:k.label}),a.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:k.waiting?s("serviceAttention.waiting"):s("agent.needsReview")})]}),a.jsx(eu,{size:16,className:"shrink-0 text-muted-foreground","aria-hidden":"true"})]},k.id)):a.jsx("button",{type:"button",onClick:()=>v(I),className:"min-h-11 w-full rounded-xl px-3 py-2 text-left text-sm hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",children:s("serviceAttention.viewService")})]},I.key))]}),a.jsxs("footer",{className:"shrink-0 border-t border-border px-4 py-3 text-xs text-muted-foreground",children:[g&&a.jsx("p",{role:"alert",className:"mb-1 text-[color:var(--warning)]",children:g}),s("serviceAttention.scope")]})]})})]})}function kN(e){return e.agentStatus==="waiting"||e.agentNeedsReview===!0}function EN(e,t,r,s="next"){if(e.length===0)return null;const o=t?e.findIndex(c=>c.sessionId===t):-1;for(let c=1;c<=e.length;c+=1){const u=s==="next"?c:-c,f=(o+u+e.length)%e.length,m=e[f];if(m&&r(m))return m.sessionId}return null}function MN(e,t,r="next"){return EN(e,t,kN,r)}const fo=42,Id=20,RN=10;function tp(e,t,r){return Math.min(r,Math.max(t,e))}function Wd(e){const t=Math.max(0,e.safeTop??0),r=Math.max(0,e.safeRight??0),s=Math.max(0,e.safeBottom??0),o=Math.max(0,e.safeLeft??0),c=Math.max(0,e.bottomClearance??72),u=o+Id,f=Math.max(u,e.width-r-Id-fo),m=Math.max(t+12,52),g=Math.max(m,e.height-s-c-fo);return{minX:u,maxX:f,minY:m,maxY:g}}function _2(e,t){const r=Wd(e),s=tp(t.yRatio,0,1);return{x:t.side==="left"?r.minX:r.maxX,y:r.minY+(r.maxY-r.minY)*s}}function Gl(e,t){const r=Wd(e);return{x:tp(t.x,r.minX,r.maxX),y:tp(t.y,r.minY,r.maxY)}}function S2(e,t){const r=Wd(e),s=Gl(e,t),o=(r.minX+r.maxX+fo)/2,c=s.x+fo/2<o?"left":"right",u=r.maxY-r.minY;return{position:{x:c==="left"?r.minX:r.maxX,y:s.y},preference:{side:c,yRatio:u>0?(s.y-r.minY)/u:0}}}function L2(e,t,r){const s=Gl(e,t),o=fo+RN,c=g=>Math.abs(g.x-r.x)<o&&Math.abs(g.y-r.y)<o;if(!c(s))return s;const u=[{...s,y:r.y-o},{...s,y:r.y+o}].map(g=>Gl(e,g)).filter(g=>!c(g)).sort((g,b)=>Math.abs(g.y-s.y)-Math.abs(b.y-s.y));if(u[0])return u[0];const f=Wd(e);return[{...s,x:f.minX},{...s,x:f.maxX}].map(g=>Gl(e,g)).filter(g=>!c(g)).sort((g,b)=>Math.abs(g.x-s.x)-Math.abs(b.x-s.x))[0]??s}const pf="var(--warning)",NN="var(--success)",I2="var(--tmux)",k2="termdock:mobile-attention-position:v1",E2="termdock:running-session-position:v1",DN={side:"right",yRatio:.68},QN={side:"right",yRatio:.54};function M2(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 BN(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function Hu(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 jN(e,t,r={}){if(typeof window>"u")return{width:390,height:664};const s=window.visualViewport,o=s?.width??window.innerWidth,c=s?.height??window.innerHeight,u=t?.getBoundingClientRect(),f=!!(u&&u.width>0&&u.height>0);return{width:o,height:c,safeTop:Math.max(Hu("--safe-top-inset"),(f?Math.max(0,u.top):0)+Math.max(0,r.top??0)),safeRight:Math.max(Hu("--safe-right-inset"),(f?Math.max(0,o-u.right):0)+Math.max(0,r.right??0)),safeBottom:Math.max(Hu("--safe-bottom-inset"),(f?Math.max(0,c-u.bottom):0)+Math.max(0,r.bottom??0)),safeLeft:Math.max(Hu("--safe-left-inset"),(f?Math.max(0,u.left):0)+Math.max(0,r.left??0)),bottomClearance:e?Id:72}}function Z3(){const e=Ur.getState(),t=Array.from(e.sessions.values()),r=MN(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 R2(e){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e}))}function Y3(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 PN({indicator:e,tone:t,size:r}){const s=Y3(t);switch(e){case"spinner":return a.jsx(mn,{size:r,className:"shrink-0 animate-spin",style:{color:s}});case"question":return a.jsx(ld,{size:r,className:"shrink-0 animate-bounce-y",style:{color:s}});case"badge":return a.jsx(Vl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:s}});case"terminal":return a.jsx(Po,{size:r,className:"shrink-0",style:{color:s}});case"pulse":return a.jsx(zv,{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 Wl({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(Dd,{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 ON({sessionMode:e,state:t,size:r=11}){const s=t?.agent?a.jsx(Wl,{agent:t.agent,size:r+1}):e==="tmux"?a.jsx(D0,{size:r,className:"shrink-0"}):a.jsx(Po,{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(PN,{indicator:t.agentIndicator,tone:t.agentStatusDetail.tone,size:r})}):t?.agentStatus==="working"?a.jsx("span",{title:t.agentMessage??t.agent?.displayName,children:a.jsx(mn,{size:r,className:"shrink-0 animate-spin",style:{color:NN}})}):t?.agentStatus==="waiting"?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(ld,{size:r,className:"shrink-0 animate-bounce-y",style:{color:pf}})}):t?.agentStatus==="done"&&t.agentNeedsReview?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(Vl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:pf}})}):t?.agentNeedsReview?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(Vl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:pf}})}):t?.inCopyMode?e==="tmux"?a.jsx(D0,{size:r,className:"shrink-0 animate-pulse",style:{color:I2}}):a.jsx(Po,{size:r,className:"shrink-0 animate-pulse",style:{color:I2}}):s}function FN({status:e,detail:t,needsReview:r,inCopyMode:s}){const{t:o}=qr();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:Y3(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:o("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:o(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:o("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:o("agent.copyMode")}):null}function K3({count:e,tone:t,title:r}){const{t:s}=qr();if(e<=0)return null;const o=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]",c=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 u=r??s("agent.jumpToNext");return a.jsxs("button",{type:"button",className:o,title:`${u} · ${s("agent.jumpToNext")}`,"aria-label":`${u}: ${e}. ${s("agent.jumpToNext")}`,onClick:Z3,children:[a.jsx(Vl,{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:o,title:r,children:[a.jsx("span",{className:c}),e]})}function UN({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(o=>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 ${o.className}`,children:o.count>9?"9+":o.count},o.key))})}const $N=380,N2=10,Gu=10,mf=52,zN=104;function HN(e,t,r){const s=Math.max(0,t.safeLeft??0),o=t.width-Math.max(0,t.safeRight??0),c=Math.max(0,t.safeTop??0),u=t.height-Math.max(0,t.safeBottom??0),f=Id,m=e.x+fo/2>=s+(o-s)/2,g=m?e.x-Gu-s-f:o-f-e.x-fo-Gu,b=Math.max(1,Math.min(Math.max(0,g),Math.max(168,r*zN))),x=m?e.x-Gu-b:e.x+fo+Gu,v=Math.min(Math.max(x,s+f),Math.max(s+f,o-f-b)),w=e.y+fo/2-mf/2,I=Math.min(Math.max(w,c+f),Math.max(c+f,u-f-mf));return{left:v,top:I,width:b,height:mf,itemWidth:b/Math.max(1,r),side:m?"left":"right"}}function D2(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 GN(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 WN({reviewCount:e,runningSessions:t,activeSessionId:r,runningButtonEnabled:s,isDesktopLayout:o,containerElement:c,occlusionInsets:u}){const{t:f}=qr(),m=Ft(ue=>ue.leftOpen),g=Ft(ue=>ue.rightOpen),{isOpen:b}=gx({enabled:!o}),x=o||!m&&!g&&!b,v=LN(e),[w,I]=S.useState(!1);S.useEffect(()=>{(!v.active||!x)&&I(!1)},[v.active,x]);const k=v.total>0&&x,N=t.length>1||t.length===1&&t[0]?.id!==r,R=s&&t.length>0&&N&&x,Q=Math.max(0,u?.top??0),F=Math.max(0,u?.right??0),q=Math.max(0,u?.bottom??0),P=Math.max(0,u?.left??0),Z=S.useCallback(()=>jN(o,c,{top:Q,right:F,bottom:q,left:P}),[c,o,q,P,F,Q]),V=S.useRef({attention:M2(k2,DN),running:M2(E2,QN)}),fe=S.useCallback(()=>{const ue=Z(),Me=_2(ue,V.current.attention),et=_2(ue,V.current.running);return{attention:Me,running:k&&R?L2(ue,et,Me):et}},[k,Z,R]),[_e,De]=S.useState(()=>fe()),be=S.useRef(_e);be.current=_e;const[st,Ue]=S.useState(null),Ee=S.useRef(null),[ht,Ve]=S.useState("idle"),[he,Oe]=S.useState(null),ie=S.useRef(null),Le=S.useRef({attention:!1,running:!1});S.useEffect(()=>()=>{const ue=ie.current?.longPressTimer;ue!=null&&window.clearTimeout(ue)},[]),S.useEffect(()=>{if(R)return;const ue=ie.current?.longPressTimer;ue!=null&&window.clearTimeout(ue),ie.current=null,Ve("idle"),Oe(null)},[R]),S.useLayoutEffect(()=>{const ue=()=>{const et=fe();be.current=et,De(et)};ue(),window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),window.visualViewport?.addEventListener("resize",ue);const Me=typeof ResizeObserver>"u"?null:new ResizeObserver(ue);return c&&Me?.observe(c),()=>{window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),window.visualViewport?.removeEventListener("resize",ue),Me?.disconnect()}},[c,fe]);const Xe=S.useCallback(ue=>ue==="attention"?R:k,[k,R]),re=S.useCallback((ue,Me)=>{if(!Xe(ue))return Me;const et=ue==="attention"?"running":"attention";return L2(Z(),Me,be.current[et])},[Z,Xe]),ge=S.useCallback((ue,Me,et,bt)=>{const xe=Z(),de=Me.moved?Gl(xe,{x:Me.startX+(et-Me.originX),y:Me.startY+(bt-Me.originY)}):be.current[ue],Ie=S2(xe,de),Qe=re(ue,Ie.position),Pe=S2(xe,Qe);V.current[ue]=Pe.preference,BN(ue==="attention"?k2:E2,Pe.preference);const ft={...be.current,[ue]:Pe.position};be.current=ft,De(ft)},[re,Z]),Qt=S.useCallback(ue=>{Le.current[ue]=!0,window.setTimeout(()=>{Le.current[ue]=!1},0)},[]),Rt=S.useCallback(ue=>{const Me=Ee.current;!Me||Me.kind!=="attention"||Me.pointerId!==ue.pointerId||(Ee.current=null,Ue(null),ge("attention",Me,ue.clientX,ue.clientY),Me.moved&&Qt("attention"))},[ge,Qt]),We={onPointerDown:ue=>{ue.stopPropagation(),ue.currentTarget.setPointerCapture(ue.pointerId),Ee.current={kind:"attention",pointerId:ue.pointerId,originX:ue.clientX,originY:ue.clientY,startX:_e.attention.x,startY:_e.attention.y,moved:!1}},onPointerMove:ue=>{const Me=Ee.current;if(!Me||Me.kind!=="attention"||Me.pointerId!==ue.pointerId)return;const et=ue.clientX-Me.originX,bt=ue.clientY-Me.originY;if(!Me.moved&&Math.hypot(et,bt)<5)return;Me.moved=!0,Ue("attention");const xe=Z(),de=re("attention",Gl(xe,{x:Me.startX+et,y:Me.startY+bt})),Ie={...be.current,attention:de};be.current=Ie,De(Ie)},onPointerUp:Rt,onPointerCancel:Rt},W=c?HN(_e.running,Z(),t.length):null,Je=ue=>{ue.longPressTimer!==null&&(window.clearTimeout(ue.longPressTimer),ue.longPressTimer=null)},Se={onPointerDown:ue=>{ue.stopPropagation(),ue.currentTarget.setPointerCapture(ue.pointerId);const Me=ue.pointerId,et={pointerId:Me,originX:ue.clientX,originY:ue.clientY,startX:_e.running.x,startY:_e.running.y,mode:"pressing",moved:!1,selectedIndex:null,longPressTimer:null};et.longPressTimer=window.setTimeout(()=>{const bt=ie.current;!bt||bt.pointerId!==Me||bt.mode!=="pressing"||(bt.longPressTimer=null,bt.mode="dragging",Le.current.running=!0,Ve("dragging"))},$N),ie.current=et,Ve("pressing"),Oe(null)},onPointerMove:ue=>{const Me=ie.current;if(!Me||Me.pointerId!==ue.pointerId)return;const et=ue.clientX-Me.originX,bt=ue.clientY-Me.originY;if(Me.mode==="pressing")if(Math.abs(et)>=N2&&Math.abs(et)>=Math.abs(bt))Je(Me),Me.mode="selecting",Le.current.running=!0,Ve("selecting");else if(Math.hypot(et,bt)>=N2){Je(Me),Me.mode="cancelled",Le.current.running=!0,Ve("idle");return}else return;if(Me.mode==="selecting"){const Qe=W?D2(W,ue.clientX,ue.clientY,t.length):null;Me.selectedIndex=Qe,Oe(Qe);return}if(Me.mode!=="dragging"||!Me.moved&&Math.hypot(et,bt)<5)return;Me.moved=!0;const xe=Z(),de=re("running",Gl(xe,{x:Me.startX+et,y:Me.startY+bt})),Ie={...be.current,running:de};be.current=Ie,De(Ie)},onPointerUp:ue=>{const Me=ie.current;if(!Me||Me.pointerId!==ue.pointerId)return;Je(Me);const et=Me.mode;if(et==="selecting"){const bt=W?D2(W,ue.clientX,ue.clientY,t.length):Me.selectedIndex,xe=bt===null?null:t[bt]?.id;xe&&R2(xe)}else et==="dragging"&&ge("running",Me,ue.clientX,ue.clientY);ie.current=null,Ve("idle"),Oe(null),et!=="pressing"&&Qt("running")},onPointerCancel:ue=>{const Me=ie.current;!Me||Me.pointerId!==ue.pointerId||(Je(Me),ie.current=null,Ve("idle"),Oe(null),Qt("running"))}},me=(ue,Me)=>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)] ${Me==="attention"?"text-[color:var(--warning)]":"text-[color:var(--success)]"}`,children:ue>9?"9+":ue}),ce=()=>{const ue=v.hasOtherAttention?f("serviceAttention.title"):f("agent.jumpToNext"),Me=_e.attention,et=st==="attention";return a.jsxs("button",{type:"button","data-attention-button":!0,"data-mobile-attention-button":!0,...We,onClick:bt=>{bt.stopPropagation(),!Le.current.attention&&(v.hasOtherAttention?I(!0):Z3())},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 ${et?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":"cursor-grab transition-[left,top,transform,box-shadow] duration-200 active:scale-95"}`,style:{display:w?"none":void 0,left:Me.x,top:Me.y,width:fo,height:fo,touchAction:"none"},"aria-label":`${ue}: ${v.total}`,"aria-haspopup":v.hasOtherAttention?"dialog":void 0,title:ue,children:[a.jsx(Vl,{size:17,className:"shrink-0"}),me(v.total,"attention")]},"attention")},qe=()=>{const ue=t.length,Me=_e.running,et=ht==="selecting",bt=ht==="dragging";return a.jsxs(S.Fragment,{children:[a.jsxs("button",{type:"button","data-running-session-button":!0,"data-running-session-gesture":ht,...Se,onClick:xe=>{if(xe.stopPropagation(),Le.current.running)return;const de=GN(t,r);de&&R2(de)},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 ${bt?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":et?"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:Me.x,top:Me.y,width:fo,height:fo,touchAction:"none"},"aria-label":`${f("agent.jumpToNextRunning")}: ${ue}`,title:f("agent.runningSessionGestureHint"),children:[a.jsx(mn,{size:18,className:"shrink-0 animate-spin"}),me(ue,"running")]}),et&&W&&a.jsx("div",{role:"listbox","data-running-session-rail":!0,"data-side":W.side,"aria-label":f("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:W.left,top:W.top,width:W.width,height:W.height},children:t.map((xe,de)=>{const Ie=de===he,Qe=xe.id===r,Pe=`${xe.label}${xe.detail?` · ${xe.detail}`:""}${Qe?` · ${f("agent.currentSession")}`:""}`;return a.jsxs("div",{role:"option","aria-selected":Ie,"data-running-session-option":xe.id,"data-selected":Ie?"true":"false",title:Pe,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 ${Ie?"scale-[1.02] bg-[var(--success)] text-[color:var(--success-foreground)]":Qe?"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 ${Ie?"bg-surface/25":"bg-surface-2 text-muted-foreground"}`,children:de+1}),a.jsx("span",{className:"truncate text-[10px] font-medium",children:xe.label})]},xe.id)})})]},"running")};return!k&&!R&&!w||c===null||typeof document>"u"?null:a.jsxs(Wy,{children:[k&&ce(),R&&!w&&qe(),w&&v.active&&x&&a.jsx(IN,{groups:v.groups,currentKey:v.currentKey,onClose:()=>I(!1)})]})}const VN=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"]),Q2=120,B2=120,qN=new Set,ZN=[],YN={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 Wp(e,t){if(t==="directory")return null;if(Zy(e))return a.jsx(Qv,{size:14});if(Yy(e))return a.jsx(o9,{size:14});const r=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"";return VN.has(r)?a.jsx(i8,{size:14}):a.jsx(v5,{size:14})}function X3({path:e}){const r=Ft(o=>o.changedFiles.get(e))?.status;if(!r)return null;const s=YN[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 F0(e){return e?"ml-1 w-6 opacity-100":"ml-1 w-6 opacity-100 sm:ml-0 sm:w-0 sm:overflow-hidden sm:opacity-0 sm:group-hover:ml-1 sm:group-hover:w-6 sm:group-hover:opacity-100"}function Vp(e){return F0(e)}const KN=T.memo(function({path:t}){const{t:r}=qr(),[s,o]=T.useState("idle"),[c,u]=T.useState(null),f=T.useCallback(async m=>{if(m.stopPropagation(),s!=="pending"){o("pending"),u(null);try{await a5(t),o("idle")}catch(g){o("error"),u(g instanceof Error?g.message:r("rightSidebar.downloadFailed"))}}},[t,s,r]);return a.jsx("span",{role:"button",tabIndex:-1,onClick:m=>{f(m)},className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${F0(s==="pending")} ${s==="pending"?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:s==="error"?c??r("rightSidebar.downloadFailed"):r("rightSidebar.downloadFile"),children:s==="pending"?a.jsx(mn,{size:12,className:"animate-spin"}):a.jsx(Fc,{size:12})})});function J3(){const{t:e}=qr(),[t,r]=T.useState({status:"idle"}),s=T.useCallback(async o=>{r({status:"pending"});try{await a5(o),r({status:"idle"})}catch(c){r({status:"error",message:c instanceof Error?c.message:e("rightSidebar.downloadFailed")})}},[e]);return{state:t,run:s}}function rp(e){return e instanceof DOMException&&e.name==="AbortError"}function kd(){if(typeof window>"u")return!1;const e=window.getSelection();return!!(e&&!e.isCollapsed&&e.toString().trim())}function e6(e){return e.button===2||e.ctrlKey}const XN=176,JN=160,Tc=8;function j2(e,t,r,s){const o=window.visualViewport,c=o?.offsetLeft??0,u=o?.offsetTop??0,f=c+(o?.width??window.innerWidth),m=u+(o?.height??window.innerHeight),g=c+Tc,b=u+Tc,x=Math.max(g,f-r-Tc),v=Math.max(b,m-s-Tc),w=t+s<=m-Tc?t:t-s;return{anchorX:e,anchorY:t,left:Math.min(Math.max(e,g),x),top:Math.min(Math.max(w,b),v)}}function t6(e){const[t,r]=T.useState(null),s=T.useRef(null),o=T.useCallback((c,u)=>{r(j2(c,u,XN,JN))},[]);return T.useLayoutEffect(()=>{if(!e||!t||!s.current)return;const c=s.current.getBoundingClientRect();if(c.width<=0||c.height<=0)return;const u=j2(t.anchorX,t.anchorY,c.width,c.height);u.left===t.left&&u.top===t.top||r(u)},[e,t]),{position:t,menuRef:s,openAt:o,clearPosition:()=>r(null)}}function r6(e,t){return t&&typeof document<"u"?qa.createPortal(e,document.body):e}function eD(e,t){return t?`${e.name} ${e.path}`.toLowerCase().includes(t):!0}function qp(e,t,r){if(!t||eD(e,t))return!0;const s=r.get(e.path);return s?s.some(o=>qp(o,t,r)):!1}function np(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 tD=T.memo(function e({node:t,depth:r,onFileSelect:s,directoriesOnly:o=!1,onPathReference:c,getReferenceText:u,onReferenceCopied:f,insertedReferenceKey:m,copiedReferenceKey:g,onDirectoryRoot:b,onSearchFromDirectory:x,onDirectoryPinToggle:v,onFilePinToggle:w,onOpenInFileBrowser:I,canOpenInFileBrowser:k,pinnedPaths:N,selectedFilePath:R,queryLower:Q,onDirectoryDropFiles:F,onFileDeleteRequest:q,deletingFilePath:P,revealedDirectoryPath:Z}){const{t:V}=qr(),fe=Ft(ve=>ve.expandedPaths.has(t.path)),_e=Ft(ve=>ve.directoryCache.get(t.path)),De=Ft(ve=>ve.showHiddenFiles),be=Ft(ve=>ve.toggleExpanded),st=Ft(ve=>ve.setDirectoryCache),Ue=Ft(ve=>ve.fileSortModes[t.path]??"name"),Ee=Ft(ve=>ve.setDirectorySortMode),[ht,Ve]=T.useState(!1),[he,Oe]=T.useState(!1),{position:ie,menuRef:Le,openAt:Xe,clearPosition:re}=t6(he),[ge,Qt]=T.useState(!1),Rt=T.useRef(0),We=T.useRef(null),W=T.useRef(null),Je=t.path===R||t.path===Z,Se=t.type==="directory"&&(fe||!!Q),me=t.type==="directory",ce=N.has(t.path),qe=!me&&!!w,ue=!!(k&&I),Me=`path:${t.path}`,et=m===Me,bt=g===Me,xe=u?.(t.path)??t.path,de=cp(f),{state:Ie,run:Qe}=J3(),Pe=P===t.path,ft=me&&!o&&!!(b||x||v||ue),Mt=T.useMemo(()=>{if(!_e)return;if(!Q)return _e;const ve=Ft.getState().directoryCache;return _e.filter($r=>(!o||$r.type==="directory")&&qp($r,Q,ve))},[_e,o,Q]),Be=T.useCallback(async()=>{if(!Ft.getState().directoryCache.has(t.path)&&!ht){const $r=`file-tree:${t.path}`;We.current?.abort(),Cf($r);const kt=new AbortController;We.current=kt,Ve(!0);try{const un=await lp(t.path,kt.signal,De,"expand_directory",$r,Ue),Ir=np(un.entries);st(t.path,Ir)}catch(un){rp(un)}finally{We.current===kt&&(We.current=null),Ve(!1)}}},[t.path,ht,st,De,Ue]),gr=T.useCallback(async()=>{if(t.type!=="directory"){s(t.path);return}if(o&&b){b(t.path);return}const ve=!Ft.getState().expandedPaths.has(t.path);be(t.path),ve&&await Be()},[o,t.path,t.type,Be,b,be,s]);T.useEffect(()=>{t.type==="directory"&&fe&&!_e&&!ht&&Be()},[_e,fe,Be,ht,t.type]);const ct=T.useCallback(ve=>{ve.stopPropagation(),c?.(t.path,Me)},[c,t.path,Me]),gt=T.useCallback(ve=>{ve.stopPropagation(),b?.(t.path),Oe(!1)},[t.path,b]),vt=T.useCallback(ve=>{ve.stopPropagation(),x?.(t.path),Oe(!1)},[t.path,x]),_t=T.useCallback(ve=>{ve.stopPropagation(),v?.(t.path),Oe(!1)},[t.path,v]),qt=T.useCallback(ve=>{ve.stopPropagation(),Ee(t.path,Ue==="modified"?"name":"modified"),Oe(!1)},[t.path,Ee,Ue]),ee=T.useCallback(ve=>{ve.stopPropagation(),w?.(t.path),Oe(!1)},[t.path,w]),Te=T.useCallback(ve=>{ve.stopPropagation(),Oe(!1),Qe(t.path)},[t.path,Qe]),Ze=T.useCallback(ve=>{ve.stopPropagation(),Oe(!1),q(t)},[t,q]),Ht=T.useCallback(ve=>{ve.stopPropagation(),I?.(t.path),Oe(!1)},[t.path,I]),$e=T.useCallback(ve=>{!me||!F||!ve.dataTransfer.types.includes("Files")||(ve.preventDefault(),ve.stopPropagation(),Rt.current+=1,Qt(!0))},[me,F]),Nt=T.useCallback(ve=>{!me||!F||!ve.dataTransfer.types.includes("Files")||(ve.preventDefault(),ve.stopPropagation(),ve.dataTransfer.dropEffect="copy",Qt(!0))},[me,F]),lr=T.useCallback(ve=>{!me||!F||(ve.preventDefault(),ve.stopPropagation(),Rt.current-=1,Rt.current<=0&&(Rt.current=0,Qt(!1)))},[me,F]),ye=T.useCallback(ve=>{if(!me||!F)return;ve.preventDefault(),ve.stopPropagation(),Rt.current=0,Qt(!1);const $r=Array.from(ve.dataTransfer.files);$r.length>0&&F(t.path,$r)},[me,t.path,F]),Bn=T.useCallback(ve=>{ve.stopPropagation(),re(),Oe($r=>!$r)},[re]),Lr=T.useCallback(ve=>{!ft||!e6(ve)||(ve.preventDefault(),ve.stopPropagation(),Xe(ve.clientX,ve.clientY),Oe(!0))},[ft,Xe]);return T.useEffect(()=>{if(!he)return;const ve=kt=>{const un=kt.target;un instanceof Node&&(W.current?.contains(un)||Le.current?.contains(un))||Oe(!1)},$r=kt=>{kt.key==="Escape"&&Oe(!1)};return document.addEventListener("pointerdown",ve),document.addEventListener("keydown",$r),()=>{document.removeEventListener("pointerdown",ve),document.removeEventListener("keydown",$r)}},[he,Le]),T.useEffect(()=>()=>{We.current?.abort()},[]),a.jsxs("div",{style:!Se&&!he?{contentVisibility:"auto",containIntrinsicSize:"auto 32px"}:void 0,children:[a.jsxs("div",{ref:W,className:"relative",children:[de.popoverNode,a.jsxs("div",{"data-file-tree-path":t.path,"data-sort-mode":Ue,role:"button",tabIndex:0,onClick:()=>{kd()||gr()},onContextMenu:Lr,onKeyDown:ve=>{ve.key!=="Enter"&&ve.key!==" "||(ve.preventDefault(),gr())},onDragEnter:$e,onDragOver:Nt,onDragLeave:lr,onDrop:ye,className:`group relative flex w-full cursor-pointer items-center gap-1 rounded px-2 py-1 text-[13px] transition ${ge?"scale-[1.015] bg-primary/15 text-foreground shadow-[0_0_0_1px_rgb(var(--primary-rgb)_/_0.45)]":Je?"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`}}),ge&&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:V("fileTree.dropToUploadHere")}),t.type==="directory"?a.jsxs(a.Fragment,{children:[Se?a.jsx(bl,{size:14,className:"shrink-0 text-muted-foreground/80"}):a.jsx(eu,{size:14,className:"shrink-0 text-muted-foreground/80"}),Se?a.jsx(k0,{size:14,className:"shrink-0 text-[color:var(--folder)]"}):a.jsx(ql,{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:Je?"text-primary":"text-muted-foreground/80",children:Wp(t.name,t.type)})]}),a.jsxs("span",{className:`flex-1 select-text whitespace-nowrap text-left leading-snug ${Je?"font-medium":""}`,children:[t.name,Ue==="modified"&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-primary",title:V("fileTree.sortedByModified"),"aria-label":V("fileTree.sortedByModified"),children:a.jsx(Oc,{size:11})}),t.isSymlink&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:V("fileTree.symbolicLink"),children:a.jsx(N0,{size:11})})]}),a.jsxs("div",{className:`sticky right-0 z-20 flex shrink-0 items-center rounded pl-1 ${Je?"bg-surface-elevated":"bg-surface group-hover:bg-surface-2"}`,onClick:ve=>ve.stopPropagation(),onKeyDown:ve=>ve.stopPropagation(),children:[ht&&a.jsx(mn,{size:12,className:"shrink-0 animate-spin text-muted-foreground"}),a.jsx(X3,{path:t.path}),ft&&a.jsx("span",{onClick:Bn,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${F0(he)} ${he?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:V("fileTree.moreDirActions"),children:a.jsx(R0,{size:13})}),!me&&a.jsx("span",{onClick:Bn,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${F0(he||Ie.status==="pending"||Pe||ce)} ${he?"bg-surface-elevated text-foreground":ce?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:Ie.status==="error"?Ie.message??V("rightSidebar.downloadFailed"):V("fileTree.moreFileActions"),children:Ie.status==="pending"||Pe?a.jsx(mn,{size:13,className:"animate-spin"}):a.jsx(R0,{size:13})}),c&&a.jsx("span",{onClick:ct,...de(xe,Me),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${Vp(et||bt)} ${et||bt?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":V(bt?"rightSidebar.copied":et?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:V(bt?"rightSidebar.copied":et?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:bt||et?a.jsx(na,{size:12}):a.jsx(N0,{size:12})}),ft&&he&&r6(a.jsxs("div",{ref:Le,className:`${ie?"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:ie?{left:ie.left,top:ie.top}:void 0,children:[ue&&a.jsxs("button",{type:"button",onClick:Ht,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:V("fileTree.openInFileBrowserTitle"),children:[a.jsx(k0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V("fileTree.openInFileBrowser")})]}),b&&a.jsxs("button",{type:"button",onClick:gt,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:V("fileTree.openDirRootTitle"),children:[a.jsx(k0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V("fileTree.openDirRoot")})]}),x&&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]",title:V("fileTree.searchFromDirTitle"),children:[a.jsx(up,{size:13,className:"shrink-0 text-primary"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V("fileTree.searchFromDir")})]}),v&&a.jsxs("button",{type:"button",onClick:_t,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] ${ce?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:V(ce?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[ce?a.jsx($c,{size:13,className:"shrink-0"}):a.jsx(Uc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V(ce?"fileTree.unpinDir":"fileTree.pinDir")})]}),a.jsxs("button",{type:"button",onClick:qt,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:[Ue==="modified"?a.jsx(Lv,{size:13,className:"shrink-0"}):a.jsx(Oc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V(Ue==="modified"?"fileTree.sortByName":"fileTree.sortByModified")})]})]}),!!ie),!me&&he&&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:[ue&&a.jsxs("button",{type:"button",onClick:Ht,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:V("fileTree.openInFileBrowserTitle"),children:[a.jsx(v5,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V("fileTree.openInFileBrowser")})]}),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 text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:V("rightSidebar.downloadFile"),children:[a.jsx(Fc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V("rightSidebar.downloadFile")})]}),qe&&a.jsxs("button",{type:"button",onClick:ee,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] ${ce?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:V(ce?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[ce?a.jsx($c,{size:13,className:"shrink-0"}):a.jsx(Uc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V(ce?"fileTree.unpinFile":"fileTree.pinFile")})]}),a.jsxs("button",{type:"button",onClick:Ze,disabled:Pe,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:V("fileTree.deleteFile"),children:[Pe?a.jsx(mn,{size:13,className:"shrink-0 animate-spin"}):a.jsx(Hi,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:V("fileTree.deleteFile")})]})]})]})]})]}),Se&&Mt&&Mt.length>0&&a.jsx("div",{className:r===0?"mt-0.5":"",children:Mt.map(ve=>a.jsx(e,{node:ve,depth:r+1,onFileSelect:s,directoriesOnly:o,onPathReference:c,getReferenceText:u,onReferenceCopied:f,onDirectoryRoot:b,onSearchFromDirectory:x,onDirectoryPinToggle:v,onFilePinToggle:w,onOpenInFileBrowser:I,canOpenInFileBrowser:k,pinnedPaths:N,selectedFilePath:R,queryLower:Q,insertedReferenceKey:m,copiedReferenceKey:g,onDirectoryDropFiles:F,onFileDeleteRequest:q,deletingFilePath:P,revealedDirectoryPath:Z},ve.path))})]})}),rD=T.memo(function({node:t,rootPath:r,onFileSelect:s,onPathReference:o,getReferenceText:c,onReferenceCopied:u,insertedReferenceKey:f,copiedReferenceKey:m,onDirectoryRoot:g,onSearchFromDirectory:b,onDirectoryPinToggle:x,onFilePinToggle:v,pinnedPaths:w,selectedFilePath:I,onFileDeleteRequest:k,deletingFilePath:N}){const{t:R}=qr(),Q=t.path===I,F=t.type==="directory",q=w.has(t.path),P=!F&&!!v,Z=`path:${t.path}`,V=f===Z,fe=m===Z,_e=c?.(t.path)??t.path,De=cp(u),{state:be,run:st}=J3(),[Ue,Ee]=T.useState(!1),{position:ht,menuRef:Ve,openAt:he,clearPosition:Oe}=t6(Ue),ie=T.useRef(null),Le=N===t.path,Xe=F&&!!(g||b||x),re=T.useCallback(()=>{kd()||(t.type==="directory"?g?.(t.path):s(t.path))},[t.path,t.type,g,s]),ge=T.useCallback(me=>{me.stopPropagation(),o?.(t.path,Z)},[o,t.path,Z]),Qt=T.useCallback(me=>{me.stopPropagation(),x?.(t.path),Ee(!1)},[t.path,x]),Rt=T.useCallback(me=>{me.stopPropagation(),v?.(t.path),Ee(!1)},[t.path,v]),We=T.useCallback(me=>{me.stopPropagation(),Ee(!1),st(t.path)},[t.path,st]),W=T.useCallback(me=>{me.stopPropagation(),Ee(!1),k(t)},[t,k]),Je=T.useCallback(me=>{me.stopPropagation(),Oe(),Ee(ce=>!ce)},[Oe]),Se=T.useCallback(me=>{!Xe||!e6(me)||(me.preventDefault(),me.stopPropagation(),he(me.clientX,me.clientY),Ee(!0))},[Xe,he]);return T.useEffect(()=>{if(!Ue)return;const me=qe=>{const ue=qe.target;ue instanceof Node&&(ie.current?.contains(ue)||Ve.current?.contains(ue))||Ee(!1)},ce=qe=>{qe.key==="Escape"&&Ee(!1)};return document.addEventListener("pointerdown",me),document.addEventListener("keydown",ce),()=>{document.removeEventListener("pointerdown",me),document.removeEventListener("keydown",ce)}},[Ue,Ve]),a.jsxs("div",{ref:ie,className:"relative border-b border-border/10 last:border-b-0",children:[De.popoverNode,a.jsxs("div",{role:"button",tabIndex:0,onClick:re,onContextMenu:Se,onKeyDown:me=>{me.key!=="Enter"&&me.key!==" "||(me.preventDefault(),re())},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${Q?"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(ql,{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:Q?"text-primary":"text-muted-foreground/80",children:Wp(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 ${Q?"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(N0,{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(X3,{path:t.path}),t.type==="directory"&&(x||b)&&a.jsx("span",{onClick:Je,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${F0(Ue)} ${Ue?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:R("fileTree.moreDirActions"),children:a.jsx(R0,{size:13})}),!F&&a.jsx("span",{onClick:Je,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${F0(Ue||be.status==="pending"||Le||q)} ${Ue?"bg-surface-elevated text-foreground":q?"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"||Le?a.jsx(mn,{size:13,className:"animate-spin"}):a.jsx(R0,{size:13})}),o&&a.jsx("span",{onClick:ge,...De(_e,Z),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${Vp(V||fe)} ${V||fe?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":R(fe?"rightSidebar.copied":V?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:R(fe?"rightSidebar.copied":V?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:fe||V?a.jsx(na,{size:12}):a.jsx(N0,{size:12})})]}),Xe&&Ue&&r6(a.jsxs("div",{ref:Ve,className:`${ht?"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:ht?{left:ht.left,top:ht.top}:void 0,children:[g&&a.jsxs("button",{type:"button",onClick:me=>{me.stopPropagation(),g(t.path),Ee(!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(k0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("fileTree.openDirRoot")})]}),b&&a.jsxs("button",{type:"button",onClick:me=>{me.stopPropagation(),b(t.path),Ee(!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(up,{size:13,className:"shrink-0 text-primary"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("fileTree.searchFromDir")})]}),x&&a.jsxs("button",{type:"button",onClick:Qt,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:R(q?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[q?a.jsx($c,{size:13,className:"shrink-0"}):a.jsx(Uc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R(q?"fileTree.unpinDir":"fileTree.pinDir")})]})]}),!!ht),!F&&Ue&&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:We,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(Fc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("rightSidebar.downloadFile")})]}),P&&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] ${q?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:R(q?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[q?a.jsx($c,{size:13,className:"shrink-0"}):a.jsx(Uc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R(q?"fileTree.unpinFile":"fileTree.pinFile")})]}),a.jsxs("button",{type:"button",onClick:W,disabled:Le,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-destructive transition hover:bg-destructive/10 active:scale-[0.99] disabled:opacity-50",title:R("fileTree.deleteFile"),children:[Le?a.jsx(mn,{size:13,className:"shrink-0 animate-spin"}):a.jsx(Hi,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("fileTree.deleteFile")})]})]})]})}),nD=60,P2=60,sD=20;function O2({count:e,loading:t,engine:r,limited:s,scope:o,content:c}){const{t:u}=qr();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(up,{size:14,className:"shrink-0 text-primary"}),a.jsx("span",{children:c?u("fileTree.contentMatchesCount",{count:e}):u("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(mn,{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:u("fileTree.searchScope")}),a.jsx("span",{className:"min-w-0 truncate font-mono text-foreground/75",title:o,children:o}),t&&a.jsx("span",{className:"ml-auto shrink-0",children:u("fileTree.searching")})]})]})}function iD(e,t){if(!t)return e;const r=e.toLowerCase(),s=t.toLowerCase(),o=[];let c=0,u=r.indexOf(s,c),f=0;for(;u>=0&&s;)u>c&&o.push(e.slice(c,u)),o.push(a.jsx("mark",{className:"rounded-sm bg-[rgb(var(--warning-rgb)_/_0.30)] px-0.5 text-foreground",children:e.slice(u,u+s.length)},`m-${f++}`)),c=u+s.length,u=r.indexOf(s,c);return c<e.length&&o.push(e.slice(c)),o.length>0?o:e}const oD=T.memo(function({entry:t,rootPath:r,selectedFilePath:s,query:o,onContentMatchSelect:c,onPathReference:u,getReferenceText:f,onReferenceCopied:m,insertedReferenceKey:g,copiedReferenceKey:b}){const{t:x}=qr(),[v,w]=T.useState(!0),I=t.path===s,k=v?t.matches.slice(0,sD):[],N=t.matches.length-k.length,R=`path:${t.path}`,Q=g===R,F=b===R,q=f?.(t.path)??t.path,P=cp(m);return a.jsxs("div",{className:"border-b border-border/10 last:border-b-0",children:[P.popoverNode,a.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{kd()||w(Z=>!Z)},onKeyDown:Z=>{Z.key!=="Enter"&&Z.key!==" "||(Z.preventDefault(),w(V=>!V))},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(bl,{size:14,className:"shrink-0 text-muted-foreground/80"}):a.jsx(eu,{size:14,className:"shrink-0 text-muted-foreground/80"}),a.jsx("span",{className:I?"text-primary":"text-muted-foreground/80",children:Wp(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(KN,{path:t.path}),u&&a.jsx("span",{onClick:Z=>{Z.stopPropagation(),u(t.path,R)},...P(q,R),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${Vp(Q||F)} ${Q||F?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":x(F?"rightSidebar.copied":Q?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:x(F?"rightSidebar.copied":Q?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:F||Q?a.jsx(na,{size:12}):a.jsx(N0,{size:12})})]}),v&&a.jsxs("div",{className:"mb-1 ml-3 border-l border-border/20 pl-1",children:[k.map((Z,V)=>a.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{kd()||c?.(t.path,Z.line)},onKeyDown:fe=>{fe.key!=="Enter"&&fe.key!==" "||(fe.preventDefault(),c?.(t.path,Z.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)}:${Z.line}`,children:[a.jsx("span",{className:"shrink-0 select-none tabular-nums text-muted-foreground/60",children:Z.line}),a.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-pre select-text",children:iD(Z.text,o)})]},`${Z.line}-${V}`)),N>0&&a.jsx("div",{className:"px-2 py-1 text-[10px] text-muted-foreground/70",children:x("fileTree.moreMatches",{count:N})})]})]})});function aD({rootPath:e,onFileSelect:t,directoriesOnly:r=!1,onPathReference:s,getReferenceText:o,onReferenceCopied:c,insertedReferenceKey:u,copiedReferenceKey:f,onDirectoryRoot:m,onSearchFromDirectory:g,onDirectoryPinToggle:b,onFilePinToggle:x,onOpenInFileBrowser:v,canOpenInFileBrowser:w=!1,pinnedPaths:I=qN,selectedFilePath:k,query:N="",searchRootPath:R,searchOptions:Q={},searchMode:F="name",onContentMatchSelect:q,onDirectoryDropFiles:P,revealDirectory:Z}){const{t:V}=qr(),fe=Ft(ct=>e?ct.directoryCache.get(e):void 0),_e=Ft(ct=>ct.setDirectoryCache),De=Ft(ct=>ct.showHiddenFiles),be=Ft(ct=>ct.fileSortModesHydrated),st=Ft(ct=>ct.fileSortModes[e]??"name"),Ue=Ft(ct=>ct.hydrateFileSortModes),[Ee,ht]=T.useState(!1),[Ve,he]=T.useState(null),[Oe,ie]=T.useState(!1),[Le,Xe]=T.useState(!1),[re,ge]=T.useState(null),[Qt,Rt]=T.useState(be),We=be||Qt;T.useEffect(()=>{let ct=!1;return Ue().catch(()=>{}).finally(()=>{ct||Rt(!0)}),()=>{ct=!0}},[Ue]);const[W,Je]=T.useState([]),[Se,me]=T.useState(null),[ce,qe]=T.useState(Q2),[ue,Me]=T.useState([]),[et,bt]=T.useState(null),xe=T.useRef(null),de=T.useRef(0),Ie=N.trim().toLowerCase(),Qe=F==="content",Pe=R||e,ft=Q.excludePatterns??ZN,Mt=ft.join(`
127
+ `);T.useEffect(()=>{const ct=Z?.path;if(!ct||!ct.startsWith(`${e}/`)&&ct!==e)return;const gt=ct.slice(e.length).replace(/^\/+/,""),vt=gt?gt.split("/"):[],_t=vt.map((Nt,lr)=>`${e}/${vt.slice(0,lr+1).join("/")}`),qt=Ft.getState(),ee=_t.filter(Nt=>!qt.expandedPaths.has(Nt));ee.length>0&&Ft.setState(Nt=>({expandedPaths:new Set([...Nt.expandedPaths,...ee])}));let Te=!1,Ze=0;const Ht=()=>{if(Te)return;const Nt=Array.from(document.querySelectorAll("[data-file-tree-path]")).find(lr=>lr.dataset.fileTreePath===ct);if(Nt){Nt.scrollIntoView({block:"center",behavior:"smooth"});return}Ze+=1,Ze<80&&window.setTimeout(Ht,50)},$e=window.requestAnimationFrame(Ht);return()=>{Te=!0,window.cancelAnimationFrame($e)}},[Z?.nonce,Z?.path,e]);const Be=T.useCallback(async ct=>{if(!(et||ct.type==="directory")&&window.confirm(V("fileTree.deleteFileConfirm",{name:ct.name}))){bt(ct.path);try{await Vy(ct.path),Ft.getState().applyFileWatchEvents([{type:"deleted",path:ct.path}]),Je(gt=>gt.filter(vt=>vt.path!==ct.path)),Me(gt=>gt.filter(vt=>vt.path!==ct.path)),I.has(ct.path)&&x?.(ct.path)}catch(gt){const vt=gt instanceof Error?gt.message:String(gt);window.alert(V("fileTree.deleteFileFailed",{message:vt}))}finally{bt(null)}}},[et,x,I,V]);T.useEffect(()=>{if(!e||!We)return;if(Ie){ht(!1);return}if(Ft.getState().directoryCache.has(e)){ht(!1);return}let ct=!1;const gt=new AbortController;return ht(!0),he(null),lp(e,gt.signal,De,"load_file_tree_root",`file-tree-root:${e}`,st).then(vt=>{if(ct)return;const _t=np(vt.entries);ie(!!vt.truncated),_e(e,_t)}).catch(vt=>{ct||rp(vt)||he(vt instanceof Error?vt.message:"Failed to load directory")}).finally(()=>{ct||ht(!1)}),()=>{ct=!0,gt.abort(),Cf(`file-tree-root:${e}`)}},[Ie,fe,e,st,_e,De,We]),T.useEffect(()=>{if(!Pe||!Ie){Xe(!1),ge(null),Je([]),Me([]),me(null);return}let ct=!1;const gt=new AbortController,vt=new Set;Xe(!0),ge(null),Je([]),Me([]),qe(Qe?nD:Q2),me({truncated:!1,total:0,engine:"rg",limited:!1,done:!1});const _t=`file-search:${Pe}:${++de.current}`;return qy(Pe,N.trim(),qt=>{if(!ct){if(qt.engine&&me(ee=>({truncated:ee?.truncated??!1,total:ee?.total??0,engine:qt.engine,limited:qt.limited??ee?.limited??!1,done:ee?.done??!1})),qt.entries?.length){const ee=qt.entries.filter(Te=>vt.has(Te.path)?!1:(vt.add(Te.path),!0));ee.length>0&&(Je(Te=>[...Te,...np(ee)]),me(Te=>Te?{...Te,total:vt.size}:{truncated:!1,total:vt.size,engine:"rg",limited:!1,done:!1}))}if(qt.contentEntries?.length){const ee=qt.contentEntries.filter(Te=>vt.has(Te.path)?!1:(vt.add(Te.path),!0));ee.length>0&&(Me(Te=>[...Te,...ee]),me(Te=>Te?{...Te,total:vt.size}:{truncated:!1,total:vt.size,engine:"rg",limited:!1,done:!1}))}qt.done&&me(ee=>({truncated:!!qt.truncated,total:typeof qt.total=="number"?qt.total:vt.size,engine:qt.engine??ee?.engine??"rg",limited:!!qt.limited,done:!0}))}},gt.signal,De,F,_t,{excludePatterns:ft,caseSensitive:Q.caseSensitive,wholeWord:Q.wholeWord,regex:Q.regex}).catch(qt=>{ct||rp(qt)||(ge(qt instanceof Error?qt.message:"Failed to search files"),Je([]),Me([]),me(null))}).finally(()=>{ct||Xe(!1)}),()=>{ct=!0,gt.abort(),Cf(_t)}},[Pe,Mt,Qe,N,Ie,F,Q.caseSensitive,Q.regex,Q.wholeWord,De]),T.useEffect(()=>{if(!Ie)return;const ct=xe.current;if(!ct)return;const gt=Qe?ue.length:W.length,vt=Qe?P2:B2,_t=new IntersectionObserver(qt=>{qt.some(ee=>ee.isIntersecting)&&qe(ee=>Math.min(ee+vt,gt))},{rootMargin:"160px 0px"});return _t.observe(ct),()=>_t.disconnect()},[Ie,W.length,ue.length,Qe]);const gr=T.useMemo(()=>{if(!fe)return;if(!Ie)return r?fe.filter(gt=>gt.type==="directory"):fe;const ct=Ft.getState().directoryCache;return fe.filter(gt=>(!r||gt.type==="directory")&&qp(gt,Ie,ct))},[r,Ie,fe]);if(!e)return a.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:V("fileTree.noWorkingDir")});if(Ee||!We)return a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(mn,{size:20,className:"animate-spin text-muted-foreground"})});if(Ie&&Qe){const ct=Se?.total??ue.length,gt=ue.slice(0,ce),vt=ce<ue.length;return a.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[a.jsx(O2,{count:ct,loading:Le,engine:Se?.engine,limited:Se?.limited,scope:Pe,content:!0}),re?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:[V("fileTree.contentSearchNeedsRipgrep"),a.jsx("div",{className:"mt-1 break-words text-[11px] text-muted-foreground/70",children:re})]}):Le&&ue.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(mn,{size:20,className:"animate-spin text-muted-foreground"})}):ue.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:V("fileTree.noContentMatches")}):a.jsxs(a.Fragment,{children:[Se?.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:V("fileTree.searchTruncatedHint",{count:Se.total})}),gt.map(_t=>a.jsx(oD,{entry:_t,rootPath:Pe,selectedFilePath:k,query:N.trim(),onContentMatchSelect:q,onPathReference:s,getReferenceText:o,onReferenceCopied:c,insertedReferenceKey:u,copiedReferenceKey:f},_t.path)),a.jsx("div",{ref:xe,className:"py-2 text-center text-[11px] text-muted-foreground",children:vt?a.jsx("button",{type:"button",onClick:()=>qe(_t=>Math.min(_t+P2,ue.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:V("fileTree.loadMoreSearchResults",{shown:gt.length,total:ue.length})}):Le?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(mn,{size:10,className:"animate-spin"}),V("fileTree.searchStillRunning")]}):gt.length>0?a.jsx("span",{children:V("fileTree.showingSearchResults",{shown:gt.length,total:ct})}):null})]})]})}if(Ie){const ct=Se?.total??W.length,gt=W.slice(0,ce),vt=ce<W.length;return a.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[a.jsx(O2,{count:ct,loading:Le,engine:Se?.engine,limited:Se?.limited,scope:Pe,content:!1}),Le&&W.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(mn,{size:20,className:"animate-spin text-muted-foreground"})}):re?a.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:re}):W.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:V("fileTree.noMatchingFiles")}):a.jsxs(a.Fragment,{children:[Se?.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:V("fileTree.searchTruncatedHint",{count:Se.total})}),gt.map(_t=>a.jsx(rD,{node:_t,rootPath:Pe,onFileSelect:t,onPathReference:s,getReferenceText:o,onReferenceCopied:c,onDirectoryRoot:m,onSearchFromDirectory:g,onDirectoryPinToggle:b,onFilePinToggle:x,pinnedPaths:I,selectedFilePath:k,insertedReferenceKey:u,copiedReferenceKey:f,onFileDeleteRequest:Be,deletingFilePath:et},_t.path)),a.jsx("div",{ref:xe,className:"py-2 text-center text-[11px] text-muted-foreground",children:vt?a.jsx("button",{type:"button",onClick:()=>qe(_t=>Math.min(_t+B2,W.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:V("fileTree.loadMoreSearchResults",{shown:gt.length,total:W.length})}):Le?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(mn,{size:10,className:"animate-spin"}),V("fileTree.searchStillRunning")]}):gt.length>0?a.jsx("span",{children:V("fileTree.showingSearchResults",{shown:gt.length,total:ct})}):null})]})]})}return Ve?a.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:Ve}):!fe||fe.length===0?a.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:V("fileTree.emptyDir")}):!gr||gr.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:V("fileTree.noMatchingFiles")}):a.jsxs("div",{className:"termdock-native-select w-max min-w-full space-y-px px-2 py-2",children:[Oe&&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:V("fileTree.truncatedHint")}),gr.map(ct=>a.jsx(tD,{node:ct,depth:0,onFileSelect:t,directoriesOnly:r,onPathReference:s,getReferenceText:o,onReferenceCopied:c,onDirectoryRoot:m,onSearchFromDirectory:g,onDirectoryPinToggle:b,onFilePinToggle:x,onOpenInFileBrowser:v,canOpenInFileBrowser:w,pinnedPaths:I,selectedFilePath:k,queryLower:Ie,insertedReferenceKey:u,copiedReferenceKey:f,onDirectoryDropFiles:P,onFileDeleteRequest:Be,deletingFilePath:et,revealedDirectoryPath:Z?.path},ct.path))]})}function ip(e){return e.trim().replace(/\/+$/,"")||"/"}function lD(e){const t=ip(e);if(t==="/")return"/";const r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}function n6({open:e,initialPath:t,title:r,labels:s,onCancel:o,onConfirm:c}){const{t:u}=qr(),f={hint:s?.hint??u("sidebar.directoryPickerHint"),cancel:s?.cancel??u("common.cancel"),confirm:s?.confirm??u("sidebar.useThisFolder"),close:s?.close??u("common.close"),parent:s?.parent??u("rightSidebar.parentFolder")},[m,g]=T.useState(()=>ip(t));return T.useEffect(()=>{e&&g(ip(t))},[t,e]),T.useEffect(()=>{if(!e)return;const b=document.body.style.overflow,x=v=>{v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),o())};return document.body.style.overflow="hidden",document.addEventListener("keydown",x,!0),()=>{document.body.style.overflow=b,document.removeEventListener("keydown",x,!0)}},[o,e]),e?qa.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:o,"aria-label":f.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(h8,{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:f.hint})]}),a.jsx("button",{type:"button",autoFocus:!0,onClick:o,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":f.close,children:a.jsx(ys,{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:m==="/",onClick:()=>g(lD(m)),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":f.parent,children:a.jsx(x5,{size:14})}),a.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10.5px] text-foreground",title:m,children:m})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain py-1",children:a.jsx(aD,{rootPath:m,directoriesOnly:!0,onFileSelect:()=>{},onDirectoryRoot:g,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:o,className:"min-h-10 rounded-lg bg-surface-2 px-4 text-[11px] font-medium text-foreground transition hover:bg-surface",children:f.cancel}),a.jsxs("button",{type:"button",onClick:()=>c(m),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(na,{size:13}),f.confirm]})]})]})]}),document.body):null}const op="termdock:new-session-commands:v1",xl="__saved_command__:";function Wu(e){return[...new Set(Object.entries(e).filter(([t])=>t.startsWith(xl)||t==="__custom__"||t==="__terminal__").map(([,t])=>t.trim()).filter(Boolean))]}function Cc(){try{const e=JSON.parse(localStorage.getItem(op)||"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="string"))}catch{return{}}}function cD({directories:e,tmuxAvailable:t,options:r,agents:s,selectedAgent:o,detecting:c,resumeHistory:u,resumeHistoryLoading:f,resumeHistoryPendingId:m,resumeHistoryError:g,onRefreshAgents:b,onSelectAgent:x,onLaunchAgent:v,onResumeHistory:w,onRemoveResumeHistory:I,onClose:k,onOptionsChange:N}){const{t:R,locale:Q}=qr(),[F,q]=T.useState(o),[P,Z]=T.useState(!1),[V,fe]=T.useState(!1),[_e,De]=T.useState(Cc),[be,st]=T.useState(()=>Wu(Cc())),[Ue,Ee]=T.useState(null),[ht,Ve]=T.useState("idle"),he=V?"__custom__":F?.slug??"__terminal__",Oe=F?.command??"",ie=V?_e.__custom__??_e.__terminal__??"":F?_e[he]??Oe:"",Le=()=>{const Se=ie.trim()||Oe;if(!(V&&!Se))try{const me={...Cc(),[he]:Se};if(V){for(const ce of Wu(Cc()))me[xl+ce]=ce;me[xl+Se]=Se}localStorage.setItem(op,JSON.stringify(me)),st(Wu(me)),V&&Ee(Se),Ve("saved")}catch{Ve("error")}},Xe=()=>{if(Ue)try{const Se=Cc();for(const[me,ce]of Object.entries(Se))(me.startsWith(xl)||me==="__custom__"||me==="__terminal__")&&ce.trim()===Ue&&delete Se[me];localStorage.setItem(op,JSON.stringify(Se)),st(Wu(Se)),De(me=>({...me,__custom__:""})),Ee(null),Ve("idle")}catch{Ve("error")}},re=()=>{const Se=ie.trim()||Oe;V&&!Se||(Le(),v(F,Se))},ge=T.useMemo(()=>[...new Set(e.filter(Boolean))].slice(0,5),[e]),Qt=V?Ue??R("sidebar.customStartupCommand"):F?.displayName??"Terminal",Rt=o?.displayName??"Terminal",We=!V&&(F===null?o===null:o?.slug===F.slug);T.useEffect(()=>{const Se=me=>{me.key==="Escape"&&(P||k())};return document.addEventListener("keydown",Se),()=>document.removeEventListener("keydown",Se)},[P,k]);const W=Se=>{N({...r,cwd:Se}),Z(!1)},Je=Se=>new Intl.DateTimeFormat(Q==="zh"?"zh-CN":"en",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(Se));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(Po,{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(ys,{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(Se=>a.jsx("button",{type:"button",disabled:Se==="tmux"&&!t,onClick:()=>N({...r,mode:Se}),"aria-pressed":r.mode===Se,title:Se==="tmux"?R(t?"sidebar.tmuxKeepsRunning":"sidebar.newTmuxDisabled"):void 0,className:`min-h-9 rounded-md px-4 text-[11px] font-medium transition ${r.mode===Se?"bg-surface-2 text-foreground":"text-muted-foreground hover:text-foreground"} disabled:cursor-not-allowed disabled:opacity-40`,children:R(Se==="shell"?"sidebar.newShell":"sidebar.newTmux")},Se))})]}),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:b,disabled:c,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(vs,{size:12,className:c?"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:[F?a.jsx(Wl,{agent:F,size:16}):a.jsx(Po,{size:14,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:Qt}),We&&a.jsx("span",{className:"shrink-0 text-[9.5px] text-muted-foreground",children:R("sidebar.defaultAgent")}),c?a.jsx(mn,{size:12,className:"shrink-0 animate-spin text-muted-foreground"}):a.jsx(bl,{size:13,className:"shrink-0 text-muted-foreground"}),a.jsxs("select",{"aria-label":R("sidebar.startupCommand"),value:V?Ue?xl+Ue:"__custom__":F?.slug??"__terminal__",onChange:Se=>{const me=Se.target.value;Ve("idle");const ce=me.startsWith(xl)?me.slice(xl.length):null;Ee(ce),fe(me==="__custom__"||ce!==null),(ce!==null||me==="__custom__")&&De(qe=>({...qe,__custom__:ce??""})),q(s.find(qe=>qe.slug===me)??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(Se=>a.jsx("option",{value:xl+Se,children:Se},Se)),s.map(Se=>a.jsx("option",{value:Se.slug,children:Se.displayName},Se.slug))]})]}),!We&&!V&&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:()=>x(F),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")})]}),ht==="error"&&a.jsx("p",{role:"alert",className:"text-[10px] text-destructive",children:R("sidebar.saveStartupCommandFailed")}),(F||V)&&a.jsxs("details",{open:V&&!Ue||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(V&&!Ue?"sidebar.customStartupCommand":"sidebar.changeStartupCommand"),a.jsx(bl,{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")}),F&&ie!==Oe&&a.jsx("button",{type:"button",onClick:()=>{De(Se=>({...Se,[he]:Oe})),Ve("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:ie,onChange:Se=>{De(me=>({...me,[he]:Se.target.value})),Ve("idle")},placeholder:Oe||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:[V&&Ue&&a.jsxs("button",{type:"button",onClick:Xe,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(Hi,{size:11}),R("sidebar.deleteStartupCommand")]}),a.jsx("button",{type:"button",onClick:Le,disabled:ht==="saved"||V&&!ie.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(ht==="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(F?"sidebar.agentStartupCommandHint":"sidebar.terminalStartupCommandHint")})]},Ue??he),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:()=>Z(!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(ql,{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")})]}),ge.length>0&&a.jsx("div",{className:"mt-1.5 flex gap-1 overflow-x-auto pb-0.5","aria-label":R("sidebar.recentDirectories"),children:ge.map(Se=>a.jsx("button",{type:"button",onClick:()=>W(Se),title:Se,className:"min-h-8 shrink-0 rounded-md px-2 text-[10px] text-muted-foreground transition hover:bg-surface hover:text-foreground",children:Pc(Se)||Se},Se))}),(u.length>0||g)&&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(C0,{size:11}),a.jsx("span",{className:"flex-1",children:R("sidebar.resumeHistory")}),f&&a.jsx(mn,{size:10,className:"animate-spin"}),u.length>0&&a.jsx("span",{className:"normal-case tracking-normal",children:R("sidebar.resumeHistoryCount",{n:u.length})}),a.jsx(bl,{size:11})]}),u.length>0&&a.jsx("div",{className:"mt-1 divide-y divide-border overflow-hidden rounded-lg border border-border bg-surface",children:u.slice(0,6).map(Se=>{const me=m===Se.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:m!==null,onClick:()=>w(Se),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:Se.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:me?a.jsx(mn,{size:13,className:"animate-spin"}):a.jsx(Wl,{agent:Se.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:Se.title}),a.jsxs("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[Se.agent.displayName," · ",Je(Se.closedAt)]})]}),a.jsx(A5,{size:12,className:"shrink-0 text-muted-foreground transition group-hover:text-primary"})]}),a.jsxs("button",{type:"button",disabled:m!==null,onClick:()=>I(Se.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:Se.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(Hi,{size:12})]})]},Se.id)})}),g&&a.jsx("div",{role:"alert",className:"mt-1.5 px-1 text-[10px] text-destructive",children:g})]})]}),a.jsx("div",{className:"shrink-0 bg-[var(--chrome-bg)] px-3 pb-3 pt-2",children:a.jsxs("button",{type:"button",onClick:re,disabled:V&&!ie.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:Qt}),children:[F?a.jsx(Wl,{agent:F,size:15}):a.jsx(Po,{size:14}),a.jsx("span",{className:"truncate",children:R("sidebar.launchSessionWith",{name:Qt})})]})}),a.jsx(n6,{open:P,initialPath:r.cwd?.trim()||ge[0]||"/",title:R("sidebar.chooseDirectory"),onCancel:()=>Z(!1),onConfirm:W})]})}const s6="termdock:new-session-agent:v1";function uD(){if(typeof window>"u")return null;try{const e=JSON.parse(window.localStorage.getItem(s6)||"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 gf(e){if(!(typeof window>"u"))try{window.localStorage.setItem(s6,JSON.stringify(e))}catch{}}function dD(e,t){return e?t.find(r=>r.slug===e)??null:null}function hD(){const[e,t]=T.useState(uD),[r,s]=T.useState([]),[o,c]=T.useState(!0),u=T.useCallback(async()=>{c(!0);try{const[m,g]=await Promise.all([Nd(),l5()]),b=dD(m.newSessionAgentSlug,g);s(g),t(b),gf(b)}finally{c(!1)}},[]);T.useEffect(()=>{const m=()=>{u().catch(()=>{})};if(performance.getEntriesByName("termdock:startup:initial-viewport-presented").length>0){m();return}return window.addEventListener("termdock:initial-viewport-presented",m,{once:!0}),()=>window.removeEventListener("termdock:initial-viewport-presented",m)},[u]);const f=T.useCallback(async m=>{const g=e;t(m),gf(m);try{await Do({newSessionAgentSlug:m?.slug??null})}catch(b){throw t(g),gf(g),b}},[e]);return{preference:e,agents:r,detecting:o,refresh:u,selectAgent:f}}function fD(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 Si="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",F2="inline-flex min-h-7 items-center justify-center rounded-md border px-2 py-1 text-[11px] leading-4 font-medium transition",Yr="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 pD({activeSessionId:e,initialCollaborationGroupId:t=null,initialFloating:r=!1,onFloatingChange:s,defaultSessionMode:o="shell",onClose:c,onNewSession:u}){const[f,m]=T.useState(r);T.useEffect(()=>{m(r)},[r]);const[g,b]=T.useState(!1),[x,v]=T.useState(t),[w,I]=T.useState({x:16,y:80}),k=T.useRef(null),N=T.useRef(!0),[R,Q]=T.useState(null),F=T.useRef(null),q=T.useCallback((Qe,Pe)=>{const ft=k.current?.getBoundingClientRect(),Mt=window.visualViewport,Be=(Mt?.offsetLeft??0)+12,gr=(Mt?.offsetTop??0)+12;return{x:Math.max(Be,Math.min(Qe,Be+(Mt?.width??window.innerWidth)-(ft?.width??440)-24)),y:Math.max(gr,Math.min(Pe,gr+(Mt?.height??window.innerHeight)-(ft?.height??340)-24))}},[]);T.useLayoutEffect(()=>{if(!f)return;const Qe=()=>{const ft=window.visualViewport;Q(ft?.height??window.innerHeight);const Mt=k.current?.getBoundingClientRect();!Mt?.width||!Mt.height||I(Be=>N.current?q((ft?.offsetLeft??0)+((ft?.width??window.innerWidth)-Mt.width)/2,(ft?.offsetTop??0)+((ft?.height??window.innerHeight)-Mt.height)/2):q(Be.x,Be.y))},Pe=new ResizeObserver(Qe);return k.current&&Pe.observe(k.current),window.addEventListener("resize",Qe),window.visualViewport?.addEventListener("resize",Qe),Qe(),()=>{Pe.disconnect(),window.removeEventListener("resize",Qe),window.visualViewport?.removeEventListener("resize",Qe)}},[f,q]);const[P,Z]=T.useState(t?"collaboration":"automation"),[V,fe]=T.useState([]),[_e,De]=T.useState([]),[be,st]=T.useState([]),[Ue,Ee]=T.useState([]),[ht,Ve]=T.useState([]),[he,Oe]=T.useState(null),[ie,Le]=T.useState(null),[Xe,re]=T.useState(null),[ge,Qt]=T.useState("loading"),[Rt,We]=T.useState(null),[W,Je]=T.useState(),[Se,me]=T.useState(null),ce=T.useRef(null),qe=T.useRef(null),ue=T.useRef(null),Me=t?Ue.find(Qe=>Qe.id===t)??null:null,et=x?Ue.find(Qe=>Qe.id===x)??null:Ue[0]??null,bt=!!e&&!!et?.sessionIds.includes(e),xe=async(Qe,Pe=!1)=>{if(!(g||Qe&&!et)){b(!0);try{await s?.(Qe?et.id:null),m(Qe),Pe&&c()}catch(ft){Le(`常驻浮窗状态保存失败,请重试:${ft instanceof Error?ft.message:"连接失败"}`)}finally{b(!1)}}},de=T.useCallback(Qe=>{Ee(Qe.groups),Ve(Qe.sessions),Je(Qe.peers),We(null),Qt("loaded")},[]);T.useEffect(()=>c5(de),[de]);const Ie=T.useCallback(async(Qe={})=>{Qe.silent||Le(null),qe.current||(qe.current=Ky().then(Pe=>{fe(Pe.automations),De(Pe.runs)}).catch(Pe=>{Qe.silent||Le(Pe instanceof Error?Pe.message:"自动任务加载失败")}).finally(()=>{qe.current=null})),ue.current||(ue.current=l5().then(Pe=>{st(Pe),me(null)}).catch(()=>{me("Agent 命令检测失败;已有会话可继续协作。")}).finally(()=>{ue.current=null})),ce.current||(Qt(Pe=>Pe==="error"?"loading":Pe),ce.current=u5().then(de).catch(Pe=>{Qt("error"),We(`协作会话加载失败:${Pe instanceof Error?Pe.message:"请重试"}`)}).finally(()=>{ce.current=null})),await ce.current},[de]);return T.useEffect(()=>{Ie();const Qe=window.setInterval(()=>{Ie({silent:!0})},1e4);return()=>window.clearInterval(Qe)},[Ie]),T.useEffect(()=>{const Qe=Pe=>{Pe.key==="Escape"&&!f&&c()};return window.addEventListener("keydown",Qe),()=>window.removeEventListener("keydown",Qe)},[c,f]),qa.createPortal(a.jsxs(a.Fragment,{children:[!f&&a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:c,"aria-label":"关闭 Agent 工作台"}),a.jsxs("section",{ref:k,"aria-label":f?"工作组消息浮窗":"Agent 工作台",style:f?{display:bt?void 0:"none",left:w.x,top:w.y,maxHeight:R?R-24:"calc(100dvh - 24px)"}:void 0,className:f?"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 ${f?"cursor-move touch-none select-none":""}`,onPointerDown:Qe=>{!f||Qe.button!==0||Qe.target.closest("button")||(N.current=!1,F.current={x:Qe.clientX,y:Qe.clientY,left:w.x,top:w.y},Qe.currentTarget.setPointerCapture?.(Qe.pointerId))},onPointerMove:Qe=>{F.current&&I(q(F.current.left+Qe.clientX-F.current.x,F.current.top+Qe.clientY-F.current.y))},onPointerUp:()=>{F.current=null},onPointerCancel:()=>{F.current=null},children:[a.jsx(Dd,{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:Me?`${Me.name} · 协作消息`:"Agent 工作台"}),a.jsx("p",{className:"text-[10px] text-muted-foreground",children:f?"引用、文件路径和粘贴优先加入此处":Me?"发送任务、问题或工作交接":"自动任务、会话协作与全文恢复"})]}),P==="collaboration"&&Ue.length>0&&a.jsx("button",{className:`${Yr} shrink-0 text-primary hover:bg-primary/10`,disabled:g,onClick:()=>{xe(!f)},children:f?"完整面板":"常驻浮窗"}),a.jsx("button",{className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground",disabled:g,onClick:()=>{f?xe(!1,!0):c()},"aria-label":"关闭",children:a.jsx(ys,{size:16})})]}),!f&&a.jsx("nav",{className:"flex gap-1 border-b border-border/15 px-3 py-2",children:[["automation",Oc,"自动任务"],["collaboration",N0,"会话协作"],["search",zc,"全文搜索"]].map(([Qe,Pe,ft])=>a.jsxs("button",{onClick:()=>Z(Qe),className:`${Yr} ${P===Qe?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(Pe,{size:14}),ft]},Qe))}),Rt&&a.jsxs("div",{role:"alert",className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:[Rt,a.jsx("button",{className:`${Yr} ml-2`,onClick:()=>{Ie()},children:"重新加载会话"})]}),P==="collaboration"&&W&&["loading","partial","error","unsupported"].includes(W.state)&&a.jsxs("div",{role:"status",className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:[W.state==="loading"?"正在加载其他服务的会话;当前服务内可先组队。":W.state==="unsupported"?"当前客户端不支持跨服务会话,请更新客户端;当前服务内可继续组队。":W.state==="partial"?"部分服务的协作会话暂不可用;已有成员会保留,恢复后继续同步。":"其他服务的会话暂时加载失败;当前服务内仍可组队。",W.error&&a.jsx("span",{className:"mt-1 block break-words text-[10px]",children:W.error}),W.services?.filter(Qe=>!Qe.connected&&Qe.error).map(Qe=>a.jsxs("span",{className:"mt-1 block break-words text-[10px]",children:[Qe.label,":",Qe.error]},Qe.origin)),["partial","error"].includes(W.state)&&a.jsx("button",{className:`${Yr} ml-2`,onClick:Xy,children:"重试跨服务连接"})]}),Se&&a.jsx("div",{className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:Se}),ie&&a.jsx("div",{className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:ie}),Xe&&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(na,{size:13}),Xe]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain p-4",children:[P==="automation"&&a.jsx(mD,{automations:V,runs:_e,agents:be,sessions:ht,activeSessionId:e,busy:he,setBusy:Oe,setError:Le,setNotice:re,refresh:Ie,onClose:c}),P==="collaboration"&&a.jsx(xD,{selectedGroupId:x,setSelectedGroupId:v,floatingVisible:bt,floating:f,sessionsState:ge,groups:Ue,sessions:ht,agents:be,activeSessionId:e,initialGroupId:t,defaultSessionMode:o,busy:he,setBusy:Oe,setError:Le,setNotice:re,refresh:Ie}),P==="search"&&a.jsx(TD,{onClose:c,onNewSession:u,setError:Le})]})]})]}),document.body)}function mD({automations:e,runs:t,agents:r,sessions:s,activeSessionId:o,busy:c,setBusy:u,setError:f,setNotice:m,refresh:g,onClose:b}){const[x,v]=T.useState(null),[w,I]=T.useState(!1),[k,N]=T.useState(null),R=async(Q,F,q)=>{u(Q),f(null),m(null);try{await F(),await g(),m(q)}catch(P){f(P instanceof Error?P.message:"操作失败")}finally{u(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:`${Yr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{v(null),I(!0),m(null)},children:[a.jsx(zi,{size:13}),"新建任务"]})]}),w&&a.jsx(gD,{agents:r,sessions:s,activeSessionId:o,initial:x,onCancel:()=>{v(null),I(!1)},onSaved:async Q=>{v(null),I(!1),await g(),m(x?`“${Q}”已更新`:`“${Q}”已创建,将按计划自动运行`)},setError:f}),e.length===0&&!w&&a.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[a.jsx(Ov,{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:`${Yr} mt-4 bg-primary text-primary-foreground`,onClick:()=>I(!0),children:[a.jsx(zi,{size:13}),"创建第一个任务"]})]}),a.jsx("div",{className:"space-y-2",children:e.map(Q=>{const F=t.find(P=>P.automationId===Q.id),q=r.find(P=>P.command===Q.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:Q.name}),a.jsx("span",{className:`rounded-full px-2 py-0.5 text-[9px] ${Q.enabled?"bg-primary/10 text-primary":"bg-surface-elevated text-muted-foreground"}`,children:Q.enabled?"已启用":"已停用"}),Q.lastRunStatus&&a.jsx("span",{className:`text-[10px] ${ID(Q.lastRunStatus)}`,children:LD(Q.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(Oc,{size:11}),_D(Q)]}),a.jsx("span",{children:Q.enabled&&Q.nextRunAt?`下次 ${Md(Q.nextRunAt)}`:"不会自动运行"})]}),a.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:Q.targetSessionId?`发送到 ${s.find(P=>P.sessionId===Q.targetSessionId)?.name??"指定会话"}`:`新建 ${q?.displayName??"Agent"} 会话 · ${Q.cwd}`}),a.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-relaxed text-foreground/80",children:Q.prompt}),Q.lastRunAt&&a.jsxs("p",{className:"mt-2 text-[10px] text-muted-foreground",children:["上次 ",Md(Q.lastRunAt),Q.lastRunMessage?` · ${Q.lastRunMessage}`:""]})]}),a.jsx("button",{"aria-label":`编辑 ${Q.name}`,title:"编辑",className:"rounded-lg p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",onClick:()=>{v(Q),I(!0),m(null)},children:a.jsx(d5,{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===Q.id?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"mr-auto text-[10px] text-destructive",children:"删除后不会再自动运行"}),a.jsx("button",{className:`${Yr} bg-surface-elevated text-foreground`,onClick:()=>N(null),children:"取消"}),a.jsxs("button",{disabled:c!==null,className:`${Yr} bg-destructive text-destructive-foreground`,onClick:()=>{R(`delete:${Q.id}`,()=>Jy(Q.id),`“${Q.name}”已删除`).then(()=>N(null))},children:[c===`delete:${Q.id}`?a.jsx(vs,{size:13,className:"animate-spin"}):a.jsx(Hi,{size:13}),"确认删除"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:`${Yr} mr-auto px-2 text-destructive hover:bg-destructive/10`,onClick:()=>N(Q.id),children:[a.jsx(Hi,{size:13}),"删除"]}),a.jsxs("button",{disabled:c!==null,className:`${Yr} ${Q.enabled?"bg-surface-elevated text-foreground":"bg-primary/15 text-primary"}`,onClick:()=>{R(`toggle:${Q.id}`,()=>e7(Q.id,!Q.enabled),Q.enabled?`“${Q.name}”已暂停,不会自动运行`:`“${Q.name}”已恢复,将按原计划运行`)},children:[c===`toggle:${Q.id}`?a.jsx(vs,{size:13,className:"animate-spin"}):Q.enabled?a.jsx(D8,{size:13}):a.jsx(O1,{size:13}),Q.enabled?"暂停":"恢复"]}),F?.frontendSessionId&&a.jsxs("button",{className:`${Yr} bg-surface-elevated text-foreground`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:F.frontendSessionId})),b()},children:[a.jsx(y5,{size:13}),"打开上次会话"]}),a.jsxs("button",{disabled:c!==null,className:`${Yr} bg-primary/15 text-primary`,onClick:()=>{R(`run:${Q.id}`,()=>t7(Q.id),`“${Q.name}”已投递,可打开会话查看进度`)},children:[c===`run:${Q.id}`?a.jsx(vs,{size:13,className:"animate-spin"}):a.jsx(O1,{size:13}),"立即运行"]})]})})]},Q.id)})})]})}function gD({agents:e,sessions:t,activeSessionId:r,initial:s,onCancel:o,onSaved:c,setError:u}){const[f,m]=T.useState(s?.name??""),g=t.find(W=>W.sessionId===r),b=s?.cwd??g?.cwd??t[0]?.cwd??"",[x,v]=T.useState(b),[w,I]=T.useState(!1),[k,N]=T.useState(()=>e.find(W=>W.command===s?.command)?.slug??""),[R,Q]=T.useState(s?.prompt??""),[F,q]=T.useState(s?.targetSessionId??""),[P,Z]=T.useState(s?.targetSessionId?"existing":"new"),[V,fe]=T.useState(s?.schedule.kind??"interval"),[_e,De]=T.useState(s?.schedule.kind==="interval"?s.schedule.everyMinutes:60),[be,st]=T.useState(s?.schedule.kind==="daily"?s.schedule.time:"09:00"),[Ue,Ee]=T.useState(s?.schedule.kind==="daily"?s.schedule.weekdays:[1,2,3,4,5]),[ht,Ve]=T.useState(s?.enabled??!0),[he,Oe]=T.useState(!1),Le=(e.find(W=>W.slug===k)??null)?.command??s?.command??"";T.useEffect(()=>{!s&&!k&&e[0]&&N(e[0].slug)},[e,s,k]);const Xe=async()=>{Oe(!0),u(null);try{await a7({id:s?.id,name:f,cwd:x,command:P==="new"?Le:"",prompt:R,targetSessionId:P==="existing"&&F||null,enabled:ht,schedule:V==="interval"?{kind:V,everyMinutes:_e}:{kind:V,time:be,weekdays:Ue}}),await c(f.trim())}catch(W){u(W instanceof Error?W.message:"保存失败")}finally{Oe(!1)}},re=V==="interval"?{kind:V,everyMinutes:_e}:{kind:V,time:be,weekdays:Ue},[ge,Qt]=be.split(":"),Rt=(W,Je)=>st(`${W}:${Je}`),We=!!(f.trim()&&R.trim()&&(P==="existing"?F:Le)&&(V==="interval"?_e>=1:Ue.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:o,"aria-label":"关闭任务表单",children:a.jsx(ys,{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:Si,value:f,onChange:W=>m(W.target.value),placeholder:"例如:每日代码巡检"})]}),a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务内容",a.jsx("textarea",{className:`${Si} min-h-24 resize-y`,value:R,onChange:W=>Q(W.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":P==="new",className:`${Yr} justify-start border px-3 text-left ${P==="new"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>Z("new"),children:"每次新建会话"}),a.jsx("button",{type:"button","aria-pressed":P==="existing",disabled:t.length===0,className:`${Yr} justify-start border px-3 text-left ${P==="existing"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>{Z("existing"),F||q(r??t[0]?.sessionId??"")},children:"发送到现有会话"})]}),P==="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:Si,value:k,onChange:W=>N(W.target.value),children:[s&&!e.some(W=>W.command===s.command)&&a.jsx("option",{value:"",children:"原 Agent 当前不可用"}),e.map(W=>a.jsxs("option",{value:W.slug,children:[W.displayName,W.isPlugin?" · Plugin":""]},W.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:Si,value:x,onChange:W=>v(W.target.value),placeholder:"默认使用当前目录"}),a.jsxs("button",{type:"button","aria-haspopup":"dialog",className:`${Yr} shrink-0 bg-surface-2 text-foreground`,onClick:()=>I(!0),children:[a.jsx(k0,{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:Si,value:F,onChange:W=>q(W.target.value),children:t.map(W=>a.jsxs("option",{value:W.sessionId,children:[W.name," · ",W.status]},W.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":V==="interval",className:`${Yr} border ${V==="interval"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>fe("interval"),children:"固定间隔"}),a.jsx("button",{type:"button","aria-pressed":V==="daily",className:`${Yr} border ${V==="daily"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>fe("daily"),children:"指定日期与时间"})]}),V==="interval"?a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["每隔多少分钟",a.jsx("input",{className:Si,type:"number",min:1,max:43200,value:_e,onChange:W=>De(Number(W.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(Oc,{size:15,className:"mr-3 shrink-0 text-primary"}),a.jsx(U2,{label:"小时",value:ge,options:24,onChange:W=>Rt(W,Qt)}),a.jsx("span",{"aria-hidden":"true",className:"px-2 text-[18px] font-medium text-muted-foreground",children:":"}),a.jsx(U2,{label:"分钟",value:Qt,options:60,onChange:W=>Rt(ge,W)}),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((W,Je)=>{const Se=Ue.includes(Je);return a.jsx("button",{type:"button","aria-pressed":Se,"aria-label":`星期${W}`,className:`rounded-lg py-2.5 text-[10px] transition ${Se?"bg-primary text-primary-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,onClick:()=>Ee(me=>Se?me.filter(ce=>ce!==Je):[...me,Je].sort()),children:W},Je)})}),Ue.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:ht,onChange:W=>Ve(W.target.checked)}),"保存后启用"]}),a.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:ht&&We?`${s?"下次运行":"首次运行"}:${Md(SD(re,Date.now(),s?.createdAt))}`:ht?"填写完整后显示首次运行时间":"任务会保存,但不会自动运行"})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{className:`${Yr} bg-surface-2 text-foreground`,onClick:o,children:"取消"}),a.jsx("button",{disabled:he||!We,className:`${Yr} bg-primary text-primary-foreground`,onClick:()=>{Xe()},children:he?"保存中…":s?"保存修改":"创建任务"})]})]}),a.jsx(n6,{open:w,initialPath:x||b||"/",title:"选择工作目录",labels:{hint:"进入文件夹,确认后才会更改工作目录。",cancel:"取消",confirm:"使用此目录",close:"关闭",parent:"上一级目录"},onCancel:()=>I(!1),onConfirm:W=>{v(W),I(!1)}})]})}function U2({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:o=>s(o.target.value),children:Array.from({length:r},(o,c)=>{const u=String(c).padStart(2,"0");return a.jsx("option",{value:u,children:u},u)})}),a.jsx(bl,{"aria-hidden":"true",size:13,className:"pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground"})]})}function xD({selectedGroupId:e,setSelectedGroupId:t,floatingVisible:r,floating:s,sessionsState:o,groups:c,sessions:u,agents:f,activeSessionId:m,initialGroupId:g,defaultSessionMode:b,busy:x,setBusy:v,setError:w,setNotice:I,refresh:k}){const[N,R]=T.useState(""),[Q,F]=T.useState(()=>new Set(m?[m]:[])),[q,P]=T.useState(""),[Z,V]=T.useState(!1),[fe,_e]=T.useState([]),[De,be]=T.useState(!1),[st,Ue]=T.useState("all"),[Ee,ht]=T.useState(!0),[Ve,he]=T.useState(new Set),[Oe,ie]=T.useState("*"),[Le,Xe]=T.useState("message"),[re,ge]=T.useState(""),[Qt,Rt]=T.useState(!1),[We,W]=T.useState(new Set),[Je,Se]=T.useState(),[me,ce]=T.useState({}),[qe,ue]=T.useState(!1),[Me,et]=T.useState(""),[bt,xe]=T.useState(""),[de,Ie]=T.useState(""),[Qe,Pe]=T.useState(""),ft=T.useRef(null),Mt=T.useRef(!1),Be=e==="new"?null:c.find(se=>se.id===e)??c[0]??null,[gr,ct]=T.useState(0),gt=T.useRef(new Map),vt=T.useRef(Be?.id),_t=T.useRef(re);_t.current=re,T.useEffect(()=>{if(vt.current===Be?.id)return;vt.current&&gt.current.set(vt.current,{content:_t.current,target:Oe,kind:Le}),vt.current=Be?.id;const se=gt.current.get(Be?.id??"");ge(se?.content??""),ie(se?.target??"*"),Xe(se?.kind??"message")},[Be?.id]),T.useEffect(()=>{if(!(!s||!r||!Be))return r7(se=>{ge(rt=>rt+(rt&&!/\s$/.test(rt)?`
128
+ `:"")+se.replace(/\r\n?/g,`
129
+ `))})},[s,r,Be?.id]),T.useEffect(()=>{const se=ft.current;if(!s||!se)return;const rt=Bt=>w(String(Bt.detail));return se.addEventListener("termdock:file-drop-error",rt),()=>se.removeEventListener("termdock:file-drop-error",rt)},[s,Be?.id,w]);const qt=async se=>{const rt=Be?.id;w(null),ct(Bt=>Bt+1);try{const Bt=await Rd("/tmp",se);if(Bt.files.length!==se.length||Bt.files.some(jt=>!jt.path))throw new Error("文件路径准备失败,请重试");const wr=Bt.files.map(jt=>kc(jt.path)).join(" ")+" ";if(vt.current===rt)ge(jt=>jt+(jt&&!/\s$/.test(jt)?`
130
+ `:"")+wr);else if(rt){const jt=gt.current.get(rt)??{content:"",target:"*",kind:"message"};gt.current.set(rt,{...jt,content:jt.content+`
131
+ `+wr})}}catch(Bt){w(Bt instanceof Error?Bt.message:"文件上传失败")}finally{ct(Bt=>Bt-1)}},ee=new Set(u.filter(xf).map(se=>se.sessionId)),Te=Q.size,Ze=[...Q].filter(se=>!ee.has(se)),Ht=bD(Be,u),$e=q.trim().toLocaleLowerCase(),Nt=u.filter(se=>!$e||[se.name,se.serviceLabel??"",se.cwd,vf(se.currentTask)].some(rt=>rt.toLocaleLowerCase().includes($e)));T.useEffect(()=>{!e&&c[0]&&t(c[0].id)},[c,e]),T.useEffect(()=>{Rt(!1),ue(!1);try{he(new Set(JSON.parse(localStorage.getItem(`collab-seen:${Be?.id}`)??"[]")))}catch{he(new Set)}W(new Set(Be?.sessionIds??[]))},[Be?.id]),T.useEffect(()=>{!Me&&f[0]&&et(f[0].slug)},[f,Me]),T.useEffect(()=>{if(_e([]),!Be){be(!1);return}be(!0);let se=!1,rt=0;const Bt=()=>{const jt=++rt;M1(Be.id).then(ne=>{!se&&jt===rt&&_e(ne.messages)}).catch(ne=>{!se&&jt===rt&&w(ne instanceof Error?ne.message:"消息加载失败")}).finally(()=>{!se&&jt===rt&&be(!1)})};Bt();const wr=window.setInterval(Bt,3e3);return()=>{se=!0,window.clearInterval(wr)}},[Be?.id,w]),T.useEffect(()=>{!g||Be?.id!==g||Mt.current||(Mt.current=!0,ft.current?.scrollIntoView?.({block:"nearest"}))},[g,Be?.id]);const lr=async()=>{v("create-group"),w(null),I(null);try{if(Ze.length)throw new Error("所选会话已变化,请先清除不可用选择");const se=await Qc({name:N,sessionIds:[...Q]});R(""),P(""),t(se.group.id),await k(),I(`“${se.group.name}”已创建,${se.group.sessionIds.length} 个会话可以开始协作`)}catch(se){w(se instanceof Error?se.message:"创建失败")}finally{v(null)}},ye=async()=>{if(!Be||x||gr||!re.trim())return;const se=re,rt=Be.id;v("send-message"),w(null),I(null);try{const Bt=await o7(Be.id,{fromSessionId:null,toSessionIds:Oe==="*"?void 0:[Oe],kind:Le,content:re});if(vt.current===rt)ge(Pt=>Pt===se?"":Pt.startsWith(se)?Pt.slice(se.length).replace(/^\n/,""):Pt);else{const Pt=gt.current.get(rt);Pt&&gt.current.set(rt,{...Pt,content:Pt.content===se?"":Pt.content.startsWith(se)?Pt.content.slice(se.length).replace(/^\n/,""):Pt.content})}const wr=await M1(rt).catch(()=>null);wr&&vt.current===rt&&_e(wr.messages);const jt=Bt.deliveries?.filter(Pt=>Pt.serviceUnavailable).length??0,ne=Bt.deliveries?.filter(Pt=>Pt.pending>0).length??0;I(jt>0?`已保存消息;${jt} 个接收成员的服务不可达,尚未送达,等待重连`:ne>0?`已保存消息;${ne} 个成员等待投递确认`:`消息已送达 ${Bt.messages.length} 个会话`)}catch(Bt){w(Bt instanceof Error?Bt.message:"发送失败")}finally{v(null)}},Bn=async()=>{if(!Be)return;v(`delete:${Be.id}`),w(null),I(null);const se=Be.name;try{await f5(Be.id),t(null),V(!1),await k(),I(`“${se}”已删除`)}catch(rt){w(rt instanceof Error?rt.message:"删除失败")}finally{v(null)}},Lr=async()=>{if(!Be)return;const se=[...We];v("save-members"),w(null),I(null);try{const rt=await Qc({id:Be.id,name:Be.name,sessionIds:se,expectedUpdatedAt:Je});t(rt.group.id),Rt(!1),await k(),I(`“${Be.name}”成员已更新,共 ${se.length} 个会话`)}catch(rt){w(rt instanceof Error?rt.message:"成员更新失败")}finally{v(null)}},ve=async se=>{if(!Be)return;const rt=me[se]??"";v(`role:${se}`),w(null),I(null);try{await s7(Be.id,se,rt.trim()||null),await k(),I(rt.trim()?"定位已保存,该成员每次收到消息都会看到":"定位已清除")}catch(Bt){w(Bt instanceof Error?Bt.message:"定位保存失败")}finally{v(null)}},$r=()=>{const se=u.find(rt=>rt.sessionId===m)?.cwd??u.find(rt=>Be?.sessionIds.includes(rt.sessionId))?.cwd??"";Ie(se),xe(""),Pe(""),ue(!0),Rt(!1)},kt=async()=>{if(!(!Be||!Me)){v("spawn-agent"),w(null),I(null);try{const se=await i7(Be.id,{agentSlug:Me,name:bt.trim()||void 0,cwd:de.trim()||void 0,task:Qe.trim()||void 0,mode:b});ue(!1),await k(),I(`“${se.session.name}”已创建并加入“${se.group.name}”`)}catch(se){w(se instanceof Error?se.message:"Agent Session 创建失败")}finally{v(null)}}},un=fe.filter(se=>(!Ee||!Ve.has(se.id))&&(st==="all"||se.responseKind===st)),Ir=AD(un,u),kn=()=>{const se=new Set([...Ve,...un.map(rt=>rt.id)].slice(-1e4));try{localStorage.setItem(`collab-seen:${Be?.id}`,JSON.stringify([...se]))}catch{w("无法保存已看记录,请检查浏览器存储空间");return}he(se)};return a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{hidden:s,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 会话可以把任务直接交给另一个会话。比如“开发”写完代码后通知“测试”检查,测试结果再回复回来;你也可以给单个会话或全组发任务,所有交接和进展都记录在这里。"})]}),Be&&a.jsxs("button",{className:`${Yr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{t("new"),V(!1),I(null)},children:[a.jsx(zi,{size:13}),"新建组"]})]}),c.length>0&&a.jsx("div",{className:"flex gap-2 overflow-x-auto border-b border-border/15 pb-3",children:c.map(se=>a.jsxs("button",{onClick:()=>t(se.id),className:`${Yr} shrink-0 ${Be?.id===se.id?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground"}`,children:[se.name,a.jsx("span",{className:"text-[9px] opacity-70",children:se.sessionIds.length})]},se.id))}),!Be&&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:Si,value:N,onChange:se=>R(se.target.value),placeholder:"例如:发布准备"})]}),u.length>5&&a.jsxs("label",{className:"relative mt-3 block",children:[a.jsx("span",{className:"sr-only",children:"筛选会话"}),a.jsx(zc,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{className:`${Si} pl-8`,value:q,onChange:se=>P(se.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:[Nt.map(se=>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:!xf(se),checked:Q.has(se.sessionId),onChange:()=>F(rt=>{const Bt=new Set(rt);return Bt.has(se.sessionId)?Bt.delete(se.sessionId):Bt.add(se.sessionId),Bt})}),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:se.name}),a.jsx(bf,{session:se}),a.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:yf(se)})]}),a.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[vf(se.currentTask)," · ",se.cwd]})]})]},se.sessionId)),u.length===0&&a.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:o==="loading"?"正在加载会话…":o==="error"?"会话加载失败,请重试":"当前服务暂无可选会话"}),u.length>0&&Nt.length===0&&a.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:"没有符合筛选条件的会话"})]}),Ze.length>0&&a.jsxs("div",{role:"alert",className:"mt-2 text-[11px] text-destructive",children:["有 ",Ze.length," 个所选会话暂不可用。",a.jsx("button",{className:Yr,onClick:()=>F(se=>new Set([...se].filter(rt=>ee.has(rt)))),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:[c.length>0&&a.jsx("button",{className:`${Yr} bg-surface-2 text-foreground`,onClick:()=>t(c[0]?.id??null),children:"取消"}),a.jsxs("button",{disabled:x!==null||o!=="loaded"||!N.trim()||Te<2||Ze.length>0,className:`${Yr} bg-primary text-primary-foreground`,onClick:()=>{lr()},children:[x==="create-group"?a.jsx(vs,{size:13,className:"animate-spin"}):a.jsx(zi,{size:13}),"创建协作组"]})]})]})]})]}),Be&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{hidden:s,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:Be.name}),a.jsxs("p",{className:"mt-1 text-[10px] text-muted-foreground",children:[Be.sessionIds.length," 个成员 · 组 ID:",a.jsx("span",{className:"break-all font-mono",children:fD(Be.id)})]})]}),Z?a.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[a.jsx("button",{className:`${Yr} bg-surface-2 px-2 text-foreground`,onClick:()=>V(!1),children:"取消"}),a.jsxs("button",{disabled:x!==null,className:`${Yr} bg-destructive px-2 text-destructive-foreground`,onClick:()=>{Bn()},children:[x===`delete:${Be.id}`?a.jsx(vs,{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:`${Yr} px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>{W(new Set(Be.sessionIds)),Se(Be.updatedAt);const se=!Qt;Rt(se),se&&ce(Object.fromEntries(Be.sessionIds.map(rt=>[rt,Be.roles?.[rt]??""]))),ue(!1)},children:[a.jsx(d5,{size:13}),"管理成员"]}),a.jsxs("button",{className:`${Yr} px-2 text-primary hover:bg-primary/10`,onClick:$r,children:[a.jsx(zi,{size:13}),"新建 Agent"]}),a.jsx("button",{"aria-label":`删除协作组 ${Be.name}`,title:"删除协作组",disabled:x!==null,className:"rounded-lg p-2 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",onClick:()=>V(!0),children:a.jsx(Hi,{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:Be.sessionIds.map(se=>{const rt=u.find(wr=>wr.sessionId===se),Bt=Be.roles?.[se];return a.jsxs("button",{disabled:!rt,onClick:()=>rt&&void yD(rt).catch(wr=>w(wr instanceof Error?wr.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 ${rt?.status==="working"?"bg-primary":rt?"bg-[var(--success)]":"bg-muted-foreground"}`}),a.jsx("span",{className:"truncate text-[11px] text-foreground",children:rt?.name??se}),rt&&a.jsx(bf,{session:rt}),a.jsx("span",{className:"ml-auto shrink-0 text-[9px] text-muted-foreground",children:rt?yf(rt):"已离线"})]}),a.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-[9px] text-muted-foreground",children:[Bt?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"min-w-0 truncate font-medium text-primary/80",children:["定位:",Bt]}),a.jsx("span",{className:"shrink-0 text-muted-foreground/50",children:"·"})]}):null,rt?a.jsx("span",{className:"min-w-0 truncate",children:vf(rt.currentTask)}):a.jsx("span",{className:"shrink-0",children:"重新上线后可继续接收消息"})]})]},se)})}),Qt&&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:["已选 ",We.size]})]}),a.jsx("div",{className:"mt-3 max-h-72 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:Ht.map(se=>{const rt=me[se.sessionId]??"",Bt=Be.roles?.[se.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:!Be.sessionIds.includes(se.sessionId)&&!xf(se),checked:We.has(se.sessionId),onChange:()=>W(wr=>{const jt=new Set(wr);return jt.has(se.sessionId)?jt.delete(se.sessionId):jt.add(se.sessionId),jt})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[11px] text-foreground",children:se.name}),a.jsx(bf,{session:se}),a.jsxs("span",{className:"block truncate text-[9px] text-muted-foreground",children:[yf(se)," · ",se.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":`${se.name} 的定位`,className:`${Si} min-h-8 py-1 text-[10px]`,value:rt,maxLength:200,placeholder:"成员收到的定位;清空后保存可移除",onChange:wr=>ce(jt=>({...jt,[se.sessionId]:wr.target.value}))}),a.jsx("button",{"aria-label":`保存 ${se.name} 的定位`,title:rt.trim()===Bt?"定位未变化":"保存此成员的定位",disabled:x!==null||rt.trim()===Bt,className:`${Yr} min-h-8 shrink-0 px-2 text-muted-foreground`,onClick:()=>{ve(se.sessionId)},children:x===`role:${se.sessionId}`?a.jsx(vs,{size:12,className:"animate-spin"}):a.jsx(na,{size:12})})]})]},se.sessionId)})}),a.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[a.jsx("button",{className:`${Yr} bg-surface-2 text-foreground`,onClick:()=>{Rt(!1),ce({})},children:"取消"}),a.jsxs("button",{disabled:x!==null||o!=="loaded"||We.size<2,className:`${Yr} bg-primary text-primary-foreground`,onClick:()=>{Lr()},children:[x==="save-members"?a.jsx(vs,{size:13,className:"animate-spin"}):a.jsx(na,{size:13}),"保存成员"]})]})]}),qe&&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:Si,value:Me,onChange:se=>et(se.target.value),children:f.map(se=>a.jsxs("option",{value:se.slug,children:[se.displayName,se.isPlugin?" · Plugin":""]},se.slug))})]}),a.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["会话名称",a.jsx("input",{"aria-label":"新 Agent 会话名称",className:Si,value:bt,onChange:se=>xe(se.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:Si,value:de,onChange:se=>Ie(se.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:`${Si} min-h-16 resize-y`,value:Qe,onChange:se=>Pe(se.target.value),placeholder:"说明它加入后要先完成什么"})]}),a.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[a.jsx("button",{className:`${Yr} bg-surface-2 text-foreground`,onClick:()=>ue(!1),children:"取消"}),a.jsxs("button",{disabled:x!==null||!Me,className:`${Yr} bg-primary text-primary-foreground`,onClick:()=>{kt()},children:[x==="spawn-agent"?a.jsx(vs,{size:13,className:"animate-spin"}):a.jsx(Dd,{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:[Ir.length," 条"]})]}),a.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[a.jsxs("select",{"aria-label":"筛选回复类型",className:`${Si} w-auto`,value:st,onChange:se=>Ue(se.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:Ee,onChange:se=>ht(se.target.checked)}),"只看新记录"]}),a.jsx("button",{className:`${Yr} min-h-9 text-muted-foreground`,disabled:!un.length,onClick:kn,children:"标记当前记录已看"})]}),a.jsxs("div",{className:"max-h-72 touch-pan-y divide-y divide-border/10 overflow-x-hidden overflow-y-auto overscroll-y-contain border-y border-border/10 [overflow-wrap:anywhere]",children:[Ir.map(se=>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:se.responseKind==="ack"?"收到确认":se.responseKind==="progress"?"进展":se.responseKind==="result"?"结果":wD(se.kind)}),a.jsx("span",{children:se.fromName}),a.jsx("span",{children:"→"}),a.jsx("span",{className:"truncate",children:se.toNames.join("、")}),a.jsx("span",{className:"ml-auto shrink-0",children:new Date(se.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[11px] leading-relaxed text-foreground",children:se.content}),a.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:se.status==="pending"?"尚未送达 · 等待连接或接收方读取":se.status==="read"?"接收方已确认读取 · 不代表任务完成":se.status==="failed"?"投递失败":se.status==="expired"?"消息已过期,未继续投递":"已写入接收方终端 · 等待接手确认"}),(se.task||se.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(se.task??{failure_reason:se.failureReason},null,2)})]})]},se.key)),Ir.length===0&&a.jsx(kD,{text:De?"正在加载协作记录…":fe.length?"没有符合筛选条件的新记录。可切换类型或取消“只看新记录”。":"还没有消息。可以先发一个任务或问题。"})]})]})]}),a.jsxs("section",{"data-termdock-terminal-dropzone":s?m??"collaboration-composer":void 0,onDragOver:se=>{s&&se.preventDefault()},onDrop:se=>{if(!s)return;const rt=Array.from(se.dataTransfer.files);if(!(rt.length&&ea()))if(se.preventDefault(),se.stopPropagation(),rt.length)qt(rt);else{const Bt=se.dataTransfer.getData("text/plain")||se.dataTransfer.getData("text/uri-list");Bt&&ge(wr=>wr+(wr?`
132
+ `:"")+Bt)}},ref:ft,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:s?`${Be.name} · 发送给成员`:"发送给成员"}),a.jsxs("div",{className:"mt-2 space-y-2",children:[a.jsxs("fieldset",{className:"min-w-0",children:[a.jsx("legend",{className:"mb-1 text-[10px] text-muted-foreground",children:"接收人"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:[{id:"*",label:"全组成员"},...Be.sessionIds.map(se=>({id:se,label:i6(u.find(rt=>rt.sessionId===se))??`${se.slice(0,8)}(离线)`}))].map(({id:se,label:rt})=>a.jsx("button",{type:"button","aria-pressed":Oe===se,onClick:()=>ie(se),className:`${F2} max-w-full ${Oe===se?"border-primary/40 bg-primary/15 text-primary":"border-border/20 bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:a.jsx("span",{className:"break-words text-left",children:rt})},se))})]}),a.jsxs("fieldset",{className:"min-w-0",children:[a.jsx("legend",{className:"mb-1 text-[10px] text-muted-foreground",children:"消息类型"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:[["message","普通消息"],["ask","需要回答的问题"],["task","需要执行的任务"],["handoff","工作交接"],["done","完成通知"]].map(([se,rt])=>a.jsx("button",{type:"button","aria-pressed":Le===se,onClick:()=>Xe(se),className:`${F2} ${Le===se?"border-primary/40 bg-primary/15 text-primary":"border-border/20 bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:rt},se))})]})]}),a.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["内容",a.jsx("textarea",{onPaste:se=>{const rt=Array.from(se.clipboardData.files);rt.length&&(se.preventDefault(),qt(rt))},className:`${Si} min-h-20 max-h-48 resize-y`,value:re,onChange:se=>ge(se.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:gr>0?"正在准备文件路径…":Be.federated?"跨服务消息由当前客户端转发,请保持窗口或网页运行;手机后台可能暂停,返回后继续同步。":"在线成员立即入队;离线成员上线后送达。"}),a.jsxs("button",{disabled:x!==null||gr>0||!re.trim(),className:`${Yr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{ye()},children:[x==="send-message"?a.jsx(vs,{size:13,className:"animate-spin"}):null,"发送"]})]})]})]})]})}function xf(e){return!h5(e.sessionId)||e.serviceConnected!==!1}function bD(e,t){const r=new Map(t.map(s=>[s.sessionId,s]));for(const s of e?.sessionIds??[]){if(r.has(s))continue;const o=e?.remoteSessions?.find(c=>c.sessionId===s);r.set(s,o?{...o,status:"offline",serviceConnected:!1}:{sessionId:s,name:s,backendSessionId:null,cwd:"",agent:null,status:"offline",capability:"",currentTask:"暂不可用,保留成员身份",updatedAt:0,...h5(s)?{serviceConnected:!1}:{}})}return[...r.values()]}function bf({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(y5,{size:9}),a.jsx("span",{className:"truncate",children:e.serviceLabel??e.serviceOrigin})]})}function yf(e){return e.serviceConnected===!1?"服务不可达":vD(e.status)}function i6(e){return e?`${e.name}${e.serviceOrigin&&e.serviceOrigin!==window.location.origin?` · ${e.serviceLabel??e.serviceOrigin}`:""}`:void 0}async function yD(e){e.sessionId.startsWith("remote:")?await Q3(e.sessionId):window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e.sessionId}))}function vD(e){return e==="working"?"处理中":e==="idle"||e==="done"?"可接收":e==="offline"?"已离线":"在线"}function vf(e){if(!e)return"暂无任务摘要";try{const t=JSON.parse(e);if(typeof t.prompt=="string")return Ed(t.prompt)||"暂无任务摘要"}catch{}return Ed(e)||"暂无任务摘要"}function wD(e){return{message:"消息",ask:"问题",reply:"回复",task:"任务",handoff:"交接",done:"完成"}[e]}function AD(e,t){const r=new Map(t.map(o=>[o.sessionId,i6(o)])),s=new Map;for(const o of e){const c=`${o.threadId}:${o.createdAt}:${o.fromSessionId??"user"}:${o.kind}:${o.responseKind??""}:${JSON.stringify(o.task??null)}:${o.content}`,u=s.get(c),f=r.get(o.toSessionId)??o.toSessionId.slice(0,8);if(u){u.toNames.push(f);const m={failed:-2,expired:-1,pending:0,delivered:1,read:2};m[o.status]<m[u.status]&&(u.status=o.status);continue}s.set(c,{key:c,kind:o.kind,content:o.content,createdAt:o.createdAt,fromName:o.fromSessionId?r.get(o.fromSessionId)??o.fromSessionId.slice(0,8):"你",toNames:[f],status:o.status,responseKind:o.responseKind,task:o.task,failureReason:o.failureReason})}return[...s.values()].sort((o,c)=>c.createdAt-o.createdAt)}function TD({onClose:e,onNewSession:t,setError:r}){const[s,o]=T.useState(""),[c,u]=T.useState([]),[f,m]=T.useState(!1),g=T.useRef(0);T.useEffect(()=>{const x=s.trim(),v=++g.current;if(u([]),!x){m(!1);return}m(!0);const w=window.setTimeout(()=>{n7(x).then(I=>{v===g.current&&u(I.results)}).catch(I=>{v===g.current&&r(I instanceof Error?I.message:"搜索失败")}).finally(()=>{v===g.current&&m(!1)})},250);return()=>window.clearTimeout(w)},[s,r]);const b=async x=>{if(x.live){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:x.sessionId})),e();return}if(x.resumeHistoryId)try{const v=await p5(x.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(zc,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{autoFocus:!0,className:`${Si} pl-9 pr-9`,value:s,onChange:x=>{r(null),o(x.target.value)},placeholder:"输入你记得的关键词"}),f?a.jsx(vs,{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:()=>o(""),children:a.jsx(ys,{size:13})})]})]}),!s.trim()&&a.jsxs("div",{className:"border-y border-border/15 py-10 text-center",children:[a.jsx(zc,{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()&&!f&&c.length>0&&a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("p",{className:"text-[11px] text-foreground",children:["显示 ",c.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:c.map(x=>{const v=x.live||!!x.resumeHistoryId,w=x.live?"打开会话":x.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:x.title}),a.jsx("p",{className:"mt-0.5 truncate text-[9px] text-muted-foreground",children:x.cwd})]}),a.jsx("span",{className:`shrink-0 text-[10px] ${x.live?"text-[var(--success)]":x.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:CD(x)||"匹配内容来自标题、目录或终端控制信息"}),a.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:[Md(x.updatedAt)," · ",x.matchCount," 处匹配",v?"":" · 没有可恢复记录"]})]});return v?a.jsx("button",{onClick:()=>{b(x)},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},x.sessionId):a.jsx("article",{className:"px-2 py-3",children:I},x.sessionId)})}),s.trim()&&!f&&c.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:`${Yr} mt-3 bg-surface-2 text-foreground`,onClick:()=>o(""),children:"清空后重试"})]})]})}function Ed(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 CD(e){let t=Ed(e.snippet);for(const r of[e.title,e.cwd,e.agentSlug])r&&(t=t.split(r).join(" "));return Ed(t)}function _D(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 SD(e,t=Date.now(),r=t){if(e.kind==="interval"){const c=e.everyMinutes*6e4,u=Math.max(0,t-r);return r+(Math.floor(u/c)+1)*c}const[s,o]=e.time.split(":").map(Number);for(let c=0;c<=7;c+=1){const u=new Date(t);if(u.setDate(u.getDate()+c),u.setHours(s,o,0,0),u.getTime()>t&&e.weekdays.includes(u.getDay()))return u.getTime()}return t}function Md(e){return new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)}function LD(e){return e==="running"?"投递中":e==="success"?"已投递":e==="failed"?"投递失败":""}function ID(e){return e==="running"?"text-[var(--warning)]":e==="success"?"text-[var(--success)]":e==="failed"?"text-destructive":"text-muted-foreground"}function kD({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 ED(e,t){return g7(e,t)}function Vu(e,t){const r=new Set(e),s=t.filter(c=>c.sessionIds.length>=2&&c.sessionIds.every(u=>r.has(u))),o=new Set;return e.flatMap(c=>{const u=s.find(f=>f.sessionIds.includes(c));return u?o.has(u.id)?[]:(o.add(u.id),[{sessionIds:u.sessionIds,workspace:u}]):[{sessionIds:[c]}]})}function _c(e,t,r,s=[]){const o=new Map,c=new Map,u=new Set(e.map(b=>b.id));for(const b of s){const x=b.sessionIds.filter(w=>u.has(w));if(x.length<(b.federated?1:2))continue;const v=x.length===b.sessionIds.length?b:{...b,sessionIds:x};x.forEach(w=>o.set(w,v))}for(const b of t)if(!(b.sessionIds.length<2||!b.sessionIds.every(x=>u.has(x)))&&!b.sessionIds.some(x=>o.has(x)))for(const x of b.sessionIds)c.set(x,b);const f=new Set,m=new Set,g=[];for(const b of e){const x=o.get(b.id);if(x){if(f.has(x.id))continue;f.add(x.id);const I=x.sessionIds.flatMap(k=>{const N=r.get(k);return N?[N]:[]});g.push({kind:"collaboration",id:`collaboration:${x.id}`,group:x,members:I,sessionIds:x.sessionIds});continue}const v=c.get(b.id);if(!v){g.push({kind:"session",id:`session:${b.id}`,session:b,sessionIds:[b.id]});continue}if(m.has(v.id))continue;m.add(v.id);const w=v.sessionIds.flatMap(I=>{const k=r.get(I);return k?[k]:[]});g.push({kind:"workspace",id:`workspace:${v.id}`,workspace:v,members:w,sessionIds:v.sessionIds})}return g}function $2(e,t,r){const s=Math.min(e.length,Math.max(0,r)),o=e.slice(0,s).flatMap(u=>u.sessionIds.filter(f=>f!==t)),c=e.slice(s).flatMap(u=>u.sessionIds.filter(f=>f!==t));return[...o,t,...c]}function MD({status:e,detail:t,needsReview:r,inCopyMode:s}){return a.jsx(FN,{status:e,detail:t,needsReview:r,inCopyMode:s})}function z2({isOpen:e,drawerWidthPx:t,onClose:r,onOpen:s,sessions:o,activeSessionId:c,sessionStates:u,onJumpToNextAttention:f,onNewSession:m,onCloseSession:g,onSplitSession:b,onCloseSplit:x,onRemoveFromSplit:v,splitWorkspaces:w,onSetSplitLayout:I,onReorderSplitWorkspace:k,onCombineSplitSessions:N,onReorderSessions:R,onSessionMenu:Q,onOpenSettings:F,onOpenQuota:q,updateState:P,updateActionPending:Z=!1,onConfirmUpdateRestart:V,onRetryUpdate:fe,tmuxAvailable:_e=!0,defaultSessionMode:De="shell",push:be,pinned:st,runningSessionButtonEnabled:Ue=!1,onRunningSessionButtonEnabledChange:Ee,onTogglePinned:ht,recoverableTmuxSessions:Ve=[],recoverableTmuxSessionsLoading:he=!1,onRefreshRecoverableTmuxSessions:Oe}){const{t:ie}=qr(),[Le,Xe]=T.useState(!1),[,re]=T.useState(0),[ge,Qt]=T.useState(null),[Rt,We]=T.useState(!1),[W,Je]=T.useState(!1),[Se,me]=T.useState(null),[ce,qe]=T.useState(!1),ue=T.useRef(!1);T.useEffect(()=>{let $=!1;return Nd().then(le=>{$||ue.current||!le.collaborationFloatingGroupId||(me(le.collaborationFloatingGroupId),qe(!0),Je(!0))}).catch(()=>{}),()=>{$=!0}},[]);const Me=async $=>{ue.current=!0,await Do({collaborationFloatingGroupId:$}),qe($!==null)},[et,bt]=T.useState([]),[xe,de]=T.useState(!1),[Ie,Qe]=T.useState(null),[Pe,ft]=T.useState(null),[Mt,Be]=T.useState(null),[gr,ct]=T.useState(null),gt=async $=>{ue.current=!0;try{ce&&await Me($),me($),Je(!0)}catch{ct("常驻浮窗状态保存失败,请重试")}},vt=cd($=>$.collaborationGroups),_t=cd($=>$.setCollaborationGroups),[qt,ee]=T.useState({mode:De}),{preference:Te,agents:Ze,detecting:Ht,refresh:$e,selectAgent:Nt}=hD(),lr=T.useRef(null),ye=T.useRef(null),Bn=T.useRef(null),Lr=!!(P?.latestVersion&&["installing","ready","restarting","error"].includes(P.status)),ve=Ft($=>$.groupByFolder),$r=Ft($=>$.collapsedGroups),kt=Ft($=>$.toggleGroupCollapsed),un=T.useRef(null),Ir=T.useRef(null),kn=T.useRef(null),se=T.useRef(0),rt=T.useRef(!1),Bt=T.useRef(null),wr=T.useRef(null),[jt,ne]=T.useState(!1),Pt=T.useRef([]),mt=T.useRef(null),Br=T.useRef(null),or=T.useRef(new Set),ws=T.useRef(null),ts=T.useMemo(()=>new Set(w.flatMap($=>$.sessionIds)),[w]),gn=T.useMemo(()=>new Map(o.map($=>[$.id,$])),[o]),Tr=T.useMemo(()=>ED(vt,new Set(gn.keys())),[vt,gn]),en=T.useCallback(async()=>{const $=++se.current;try{const le=await u5();if($!==se.current)return;_t(Array.isArray(le.groups)?le.groups:[])}catch{}},[]);T.useEffect(()=>c5($=>_t($.groups)),[]),T.useEffect(()=>{en();const $=window.setInterval(()=>{en()},1e4),le=()=>{en()};return window.addEventListener("focus",le),()=>{se.current+=1,window.clearInterval($),window.removeEventListener("focus",le)}},[en]),T.useEffect(()=>{(e||!W)&&en()},[W,e,en]);const qn=T.useCallback(()=>{Pt.current=Array.from(document.querySelectorAll("[data-collaboration-member], [data-collaboration-background]")).flatMap($=>{const le=$.dataset.collaborationMember??"",Ge=$.hasAttribute("data-collaboration-background"),Ce=$.closest("[data-collaboration-group]")?.dataset.collaborationGroup;if(!le&&!Ge||!Ce)return[];const He=[];for(let tt=$.parentElement;tt;tt=tt.parentElement)He.push({element:tt,top:tt.scrollTop,left:tt.scrollLeft});return[{element:$,sessionId:le,groupId:Ce,background:Ge,rect:$.getBoundingClientRect(),scrollParents:He}]})},[]),Cn=T.useCallback(($,le)=>{if(!rt.current)return;document.querySelectorAll("[data-split-exit-drop-index]").forEach(ut=>ut.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(ut=>ut.removeAttribute("data-drop-active"));const Ce=document.elementsFromPoint($,le).map(ut=>ut.closest("[data-collaboration-background]")).find(Boolean)?.closest("[data-collaboration-group]");if(Ce?.dataset.collaborationGroup){Ce.dataset.dropActive="true",Br.current={kind:"collaboration",groupId:Ce.dataset.collaborationGroup,background:!0};return}const He=Pt.current.find(ut=>{if(ut.sessionId===wr.current||!ut.element.isConnected)return!1;const hr=ut.scrollParents.reduce((St,sr)=>St+sr.element.scrollLeft-sr.left,0),ar=ut.scrollParents.reduce((St,sr)=>St+sr.element.scrollTop-sr.top,0);return $>=ut.rect.left-hr&&$<=ut.rect.right-hr&&le>=ut.rect.top-ar+ut.rect.height*.25&&le<=ut.rect.bottom-ar-ut.rect.height*.25});if(He?.background){He.element.closest("[data-collaboration-group]")?.setAttribute("data-drop-active","true"),Br.current={kind:"collaboration",groupId:He.groupId,background:!0};return}if(He&&!w.find(hr=>hr.sessionIds.includes(He.sessionId))?.sessionIds.includes(wr.current??"")){He.element.dataset.dropActive="true",Br.current={kind:"split",sessionId:He.sessionId,groupId:He.groupId};return}const tt=document.elementsFromPoint($,le).filter(ut=>{const hr=ut.closest("[data-rfd-draggable-id]");return!hr||!["session:","split-member:","collaboration-member:"].some(ar=>hr.dataset.rfdDraggableId===`${ar}${wr.current}`)}),nt=tt.map(ut=>ut.closest("[data-collaboration-group]")).find(ut=>ut?.dataset.collaborationGroup);if(nt?.dataset.collaborationGroup){const ut=nt.dataset.collaborationGroup,hr=tt.map(kr=>kr.closest("[data-collaboration-split]")).find(Boolean),ar=tt.map(kr=>kr.closest("[data-collaboration-member]")).find(Boolean),St=ar?.dataset.collaborationMember??hr?.dataset.splitAnchor,sr=ut===Bt.current&&w.some(kr=>kr.sessionIds.includes(St??"")&&kr.sessionIds.includes(wr.current??""));if(St&&!sr&&(ut!==Bt.current||!ar&&hr)){nt.dataset.dropActive="true";const kr=ar??hr;kr&&(kr.dataset.dropActive="true"),Br.current={kind:"split",sessionId:St,groupId:ut}}else{const kr=tt.some(yn=>yn.closest("[data-collaboration-background]"));(ut!==Bt.current||kr)&&(nt.dataset.dropActive="true"),Br.current={kind:"collaboration",groupId:ut,background:kr}}return}const Fe=Array.from(document.querySelectorAll("[data-sidebar-entity-list-id]")).filter(ut=>ut.dataset.sidebarEntityListId===mt.current).find(ut=>{const hr=ut.getBoundingClientRect();return $>=hr.left&&$<=hr.right&&le>=hr.top-8&&le<=hr.bottom+8});if(!Fe){Br.current=null;return}const at=Array.from(Fe.children).filter(ut=>ut instanceof HTMLElement&&ut.hasAttribute("data-sidebar-entity-index")),Kt=at.findIndex(ut=>{const hr=ut.getBoundingClientRect();return le<hr.top+hr.height/2}),lt=Kt<0?at.length:Kt;Br.current={kind:"list",listId:Fe.dataset.sidebarEntityListId??"",index:lt};const br=Array.from(Fe.querySelectorAll(":scope > [data-sidebar-entity-index] > [data-split-exit-drop-index]")).find(ut=>ut.dataset.splitExitDropIndex===String(lt));br instanceof HTMLElement&&(br.dataset.active="true")},[w]);T.useEffect(()=>{const $=Ge=>Cn(Ge.clientX,Ge.clientY),le=Ge=>{const Ce=Ge.touches[0];Ce&&Cn(Ce.clientX,Ce.clientY)};return window.addEventListener("pointermove",$),window.addEventListener("touchmove",le,{passive:!0}),()=>{window.removeEventListener("pointermove",$),window.removeEventListener("touchmove",le)}},[Cn]);const As=T.useCallback(($,le)=>{try{$(le)}finally{document.querySelectorAll("[data-sidebar-dragging]").forEach(Ge=>{delete Ge.dataset.sidebarDragging}),rt.current=!1,Pt.current=[],ne(!1),Bt.current=null,wr.current=null,mt.current=null,Br.current=null,document.querySelectorAll("[data-split-exit-drop-index]").forEach(Ge=>Ge.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(Ge=>Ge.removeAttribute("data-drop-active"))}},[]),rs=T.useMemo(()=>o.filter($=>!ts.has($.id)),[o,ts]),tn=T.useMemo(()=>{let $=0;for(const le of o)u.get(le.id)?.agentStatus==="working"&&($+=1);return $},[o,u]);T.useLayoutEffect(()=>{const $=un.current,le=Ir.current;if(!e||!$||!le){kn.current=null;return}const Ge=le.getBoundingClientRect(),Ce=$.getBoundingClientRect(),He={item:$,top:Math.round(Ce.top-Ge.top+le.scrollTop),height:Math.round(Ce.height),viewportHeight:le.clientHeight},tt=kn.current;if(kn.current=He,tt?.item===He.item&&tt.top===He.top&&tt.height===He.height&&tt.viewportHeight===He.viewportHeight||rt.current||le.clientHeight===0)return;const nt=8,it=Ce.top-Ge.top,Fe=Ce.bottom-Ge.top;it<nt?le.scrollTop+=it-nt:Fe>le.clientHeight-nt&&(le.scrollTop+=Fe-le.clientHeight+nt)});const jn=T.useMemo(()=>{if(!ve||!c)return null;const $=u.get(c)?.cwd??null;return l7($)},[ve,c,u]);T.useEffect(()=>{if(!ve){ws.current=null,or.current.clear();return}if(!c){ws.current=null;return}const $=Ft.getState(),le=or.current,Ge=ws.current,Ce=jn;Ge!==null&&Ge!==Ce&&le.has(Ge)&&($.collapsedGroups.has(Ge)||$.toggleGroupCollapsed(Ge),le.delete(Ge)),Ce!==null&&Ce!==""&&$.collapsedGroups.has(Ce)&&($.toggleGroupCollapsed(Ce),le.add(Ce)),ws.current=Ce},[ve,c,jn]),T.useEffect(()=>{e||(Xe(!1),We(!1))},[e]),T.useEffect(()=>{ee($=>({...$,command:Te?.command}))},[Te]),T.useEffect(()=>{if(!Rt)return;let $=!1;return de(!0),ft(null),R1().then(le=>{$||bt(le)}).catch(()=>{$||ft(ie("sidebar.resumeHistoryLoadFailed"))}).finally(()=>{$||de(!1)}),()=>{$=!0}},[Rt,ie]),T.useLayoutEffect(()=>{if(!Le)return;const $=lr.current,le=ye.current;if(!$||!le)return;const Ge=window.visualViewport,Ce=()=>{const nt=(Ge?.offsetLeft??0)+8,it=(Ge?.offsetTop??0)+8,Fe=Math.max(0,(Ge?.width??window.innerWidth)-16),at=Math.max(0,(Ge?.height??window.innerHeight)-16);le.style.maxWidth=`${Fe}px`,le.style.maxHeight=`${at}px`;const Kt=$.getBoundingClientRect(),lt=Math.max(nt,Math.min(Kt.right-le.offsetWidth,nt+Fe-le.offsetWidth)),br=Math.max(it,Math.min(Kt.bottom+4,it+at-le.offsetHeight));le.style.left=`${lt-Kt.left}px`,le.style.top=`${br-Kt.top}px`};Ce();const He=typeof ResizeObserver>"u"?null:new ResizeObserver(Ce);return He?.observe($),He?.observe(le),window.addEventListener("resize",Ce),window.addEventListener("scroll",Ce,!0),Ge?.addEventListener("resize",Ce),Ge?.addEventListener("scroll",Ce),()=>{He?.disconnect(),window.removeEventListener("resize",Ce),window.removeEventListener("scroll",Ce,!0),Ge?.removeEventListener("resize",Ce),Ge?.removeEventListener("scroll",Ce)}},[Le,t]),T.useEffect(()=>{if(!Le)return;const $=le=>{le instanceof KeyboardEvent&&le.key!=="Escape"||le instanceof MouseEvent&&le.target instanceof Node&&lr.current?.contains(le.target)||Xe(!1)};return window.addEventListener("mousedown",$),window.addEventListener("keydown",$),()=>{window.removeEventListener("mousedown",$),window.removeEventListener("keydown",$)}},[Le]),T.useEffect(()=>{if(!ge)return;const $=le=>{le instanceof KeyboardEvent&&le.key!=="Escape"||le instanceof PointerEvent&&le.target instanceof Node&&Bn.current?.contains(le.target)||Qt(null)};return window.addEventListener("pointerdown",$),window.addEventListener("keydown",$),()=>{window.removeEventListener("pointerdown",$),window.removeEventListener("keydown",$)}},[ge]);const Vr=()=>{!be&&!st&&r()},Rr=De==="tmux"&&!_e?"shell":De,Pn=()=>{m({mode:Rr}),Vr()},sn=()=>{Te&&(m({mode:Rr,command:Te.command}),Vr())},Zn=$=>{Be($.name),m({mode:"tmux",tmuxSessionName:$.name,cwd:$.cwd??void 0}),Vr()};T.useEffect(()=>{Mt&&(Ve.some($=>$.name===Mt)||Be(null))},[Mt,Ve]);const zt=($,le)=>{m({...qt,cwd:qt.cwd?.trim()||void 0,command:le??$?.command}),We(!1),Vr()},On=async $=>{Qe($.id),ft(null);try{const le=await p5($.id);m({mode:"shell",cwd:le.cwd,command:le.command}),We(!1),Vr()}catch(le){const Ge=le&&typeof le=="object"&&"code"in le?String(le.code??""):"";ft(ie(Ge==="AGENT_SESSION_ACTIVE_ELSEWHERE"?"tab.resumeAgentConflict":"sidebar.resumeHistoryFailed"))}finally{Qe(null)}},zr=async $=>{bt(le=>le.filter(Ge=>Ge.id!==$));try{await x7($)}catch{ft(ie("sidebar.resumeHistoryRemoveFailed")),R1().then(bt).catch(()=>{})}},Fn=()=>{if(Rt){We(!1);return}ee({mode:De==="tmux"&&!_e?"shell":De,cwd:c?u.get(c)?.cwd??void 0:void 0,command:Te?.command}),We(!0)},Ts=T.useCallback($=>{const le=u.get($);return le?.agentStatus==="waiting"||le?.agentNeedsReview?"bg-[rgb(var(--warning-rgb)_/_0.10)] text-foreground":le?.agentStatus==="working"?"bg-[rgb(var(--success-rgb)_/_0.08)] text-foreground":le?.inCopyMode?"bg-[rgb(var(--tmux-rgb)_/_0.08)] text-foreground":null},[u]),as=D3(),_n=T.useCallback(($,le,Ge,Ce)=>{const He=$.id===c,tt=ts.has($.id),nt=!!(Ge&&tt),it=u.get($.id),Fe=Pc(it?.cwd??null),at=it?.shellTitle??c7($.id),Kt=at===it?.cwd||at===Fe?null:at,lt=u7($,it?.activeProgram??null,null,d7,Kt,it?.promptState??null),br=!!(it?.tuiProgress&&it.tuiProgress.state!=="remove"),hr=it?.promptState==="running"||it?.agentStatus==="working"||br?"bg-[var(--success)]":it?.agentStatus==="waiting"||it?.agentNeedsReview?"bg-[var(--warning)]":it?.inCopyMode?"bg-[var(--tmux)]":"bg-primary";return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:He?un:null,type:"button",...le??{},onContextMenu:ar=>{Q&&(ar.preventDefault(),Q($.id,{x:ar.clientX,y:ar.clientY}))},onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:$.id})),Vr()},className:`sidebar-session-primary relative min-w-0 flex flex-1 items-center overflow-hidden text-left ${le?"cursor-grab active:cursor-grabbing ":""}${Ge?"gap-1.5 py-0.5 pl-1.5 pr-0.5":"gap-1.5 py-1 pl-2 pr-1"}`,title:it?.cwd??$.name,children:[He&&a.jsx("span",{className:`absolute inset-y-2 left-0 w-0.5 rounded-full ${hr}`}),a.jsxs("span",{className:`relative inline-flex shrink-0 items-center justify-center rounded-md ${Ge?"h-5 w-[22px]":"h-[22px] w-[22px]"} ${He?$.mode==="tmux"?"bg-[rgb(var(--tmux-rgb)_/_0.15)] text-[color:var(--tmux)]":"bg-primary/15 text-primary":$.mode==="tmux"?"bg-surface text-[rgb(var(--tmux-rgb)_/_0.80)]":"bg-surface text-muted-foreground"}`,children:[it?.isConnecting||br&&!it?.agentStatus?a.jsx(mn,{size:Ge?10:11,className:"animate-spin"}):it?.agent??N1($.id)?a.jsx(Wl,{agent:it?.agent??N1($.id),size:Ge?13:15}):$.mode==="tmux"?a.jsx(D0,{size:Ge?10:11}):a.jsx(Po,{size:Ge?10:11}),a.jsx(MD,{status:it?.agentStatus??null,detail:it?.agentStatusDetail,needsReview:it?.agentNeedsReview,inCopyMode:it?.inCopyMode})]}),a.jsx("span",{className:`min-w-0 flex-1 truncate leading-tight ${Ge?"text-[11px]":"text-[12px]"} ${He?"font-medium text-foreground":""} ${it?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:lt}),a.jsx(s2,{sessionIds:[$.id]})]}),Ce,a.jsx("button",{type:"button",onClick:ar=>{ar.stopPropagation(),nt?v($.id):tt?x($.id):b($.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 ${Ge?"h-6 w-6":"h-[26px] w-[26px]"} ${tt?"bg-primary/15 text-primary":"text-muted-foreground/70"}`,"aria-label":`${ie(nt?"tab.splitRemovePane":tt?"tab.splitClose":"tab.split")} ${lt}`,title:ie(nt?"tab.splitRemovePane":tt?"tab.splitClose":"tab.split"),children:nt?a.jsx(r9,{size:11}):a.jsx(Fl,{size:12})}),a.jsx("button",{type:"button",onClick:ar=>{ar.stopPropagation(),g($.id,ar)},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 ${Ge?"h-6 w-6":"h-[26px] w-[26px]"}`,"aria-label":ie("sidebar.closeSession",{name:lt}),title:ie("common.close"),children:a.jsx(ys,{size:Ge?11:12})})]})},[c,ts,u,g,b,x,v,Q,ie]),Cr=T.useMemo(()=>ad(o,$=>u.get($.id)?.cwd??null,ve,ie("sidebar.ungrouped"),w,Tr).groups,[Tr,ve,o,u,w,ie]),jr=T.useMemo(()=>_c(o,w,gn,Tr),[Tr,o,gn,w]),Yn=T.useCallback($=>{ne($.draggableId.startsWith("collaboration:")||$.draggableId.startsWith("workspace:"));const le=$.draggableId.replace(/^split-member:/,"");wr.current=$.draggableId.replace(/^(?:session|split-member|collaboration-member):/,"");const Ge=$.type==="split-member"?w.find(it=>it.sessionIds.includes(le)):null,Ce=$.type==="collaboration-member"?$.source.droppableId.replace(/^collaboration-members:/,""):null,He=Ce?Tr.find(it=>it.id===Ce):null;rt.current=!!(Ge||He||$.type==="session"&&$.draggableId.startsWith("session:")),rt.current&&document.querySelectorAll("[data-collaboration-group]").forEach(it=>{it.dataset.sidebarDragging="true"}),Bt.current=He?.id??null;const tt=Ge?.sessionIds??He?.sessionIds??[],nt=tt.length>0?Cr.find(it=>tt.every(Fe=>it.sessions.some(at=>at.id===Fe))):null;mt.current=ve?nt?`group-sessions:${nt.key}`:null:tt.length>0?"sidebar-entities":null,Br.current=null},[Tr,Cr,ve,w]),xn=T.useCallback(($,le,Ge)=>{if(le===Ge)return;const Ce=le?vt.find(Fe=>Fe.id===le):null,He=Ge?vt.find(Fe=>Fe.id===Ge):null;if(Ge&&!He)return;if(He){const Fe=o.map(Kt=>Kt.id).filter(Kt=>Kt!==$);let at=-1;Fe.forEach((Kt,lt)=>{He.sessionIds.includes(Kt)&&(at=lt)}),at>=0&&(Fe.splice(at+1,0,$),R(Fe))}const tt=Ce?.sessionIds.filter(Fe=>Fe!==$)??[],nt=He?[...He.sessionIds.filter(Fe=>Fe!==$),$]:[];_t(Fe=>Fe.flatMap(at=>at.id===le?tt.length>=2?[{...at,sessionIds:tt}]:[]:at.id===Ge?[{...at,sessionIds:nt}]:[at])),ct(null),(Ce&&He?h7({sourceGroupId:Ce.id,targetGroupId:He.id,sessionId:$,expectedSourceUpdatedAt:Ce.updatedAt,expectedTargetUpdatedAt:He.updatedAt}):Ce?tt.length>=2?Qc({id:Ce.id,name:Ce.name,sessionIds:tt,expectedUpdatedAt:Ce.updatedAt}):f5(Ce.id,Ce.updatedAt):He?Qc({id:He.id,name:He.name,sessionIds:nt,expectedUpdatedAt:He.updatedAt}):Promise.resolve()).then(()=>en(),Fe=>(ct(Fe instanceof Error?Fe.message:"协作成员移动失败"),en()))},[vt,en,o,R]),ds=T.useCallback(($,le,Ge)=>{const Ce=vt.find(Fe=>Fe.id===$);if(!Ce||le===Ge)return;const He=Ce.sessionIds.filter(Fe=>!Fe.startsWith("remote:")),tt=Vu(He,w).flatMap(Fe=>Fe.sessionIds),[nt]=tt.splice(le,1);if(!nt)return;tt.splice(Ge,0,nt);const it=w.find(Fe=>Fe.sessionIds.includes(nt));if(it&&it.sessionIds.every(Fe=>Ce.sessionIds.includes(Fe))){const Fe=tt.filter(at=>it.sessionIds.includes(at));k(it.id,Fe)}tt.push(...Ce.sessionIds.filter(Fe=>Fe.startsWith("remote:"))),_t(Fe=>Fe.map(at=>at.id===$?{...at,sessionIds:tt}:at)),ct(null),Qc({id:Ce.id,name:Ce.name,sessionIds:tt,expectedUpdatedAt:Ce.updatedAt}).then(()=>en(),Fe=>(ct(Fe instanceof Error?Fe.message:"成员排序失败"),en()))},[vt,en,w,k]);T.useEffect(()=>{const $=le=>{const{sourceId:Ge,targetId:Ce}=le.detail;if(!Ge||!Ce||Ge===Ce)return;const He=ad(o,St=>u.get(St.id)?.cwd??null,ve,"",w,Tr).arranged.map(St=>St.id),tt=He.indexOf(Ge),nt=He.indexOf(Ce);if(tt<0||nt<0)return;const it=Tr.find(St=>St.sessionIds.includes(Ge));if(it?.sessionIds.includes(Ce)){const St=Vu(it.sessionIds,w).flatMap(sr=>sr.sessionIds);ds(it.id,St.indexOf(Ge),St.indexOf(Ce));return}const Fe=w.filter(St=>St.sessionIds.length>=2&&St.sessionIds.every(sr=>gn.has(sr))&&!Tr.some(sr=>St.sessionIds.some(kr=>sr.sessionIds.includes(kr)))),at=Fe.find(St=>St.sessionIds.includes(Ge));if(at?.sessionIds.includes(Ce)){const St=[...at.sessionIds];St.splice(St.indexOf(Ge),1),St.splice(at.sessionIds.indexOf(Ce),0,Ge),k(at.id,St);return}const Kt=St=>Tr.find(sr=>sr.sessionIds.includes(St))?.sessionIds??Fe.find(sr=>sr.sessionIds.includes(St))?.sessionIds??[St],lt=new Set(Kt(Ge)),br=new Set(Kt(Ce)),ut=He.filter(St=>!lt.has(St)),hr=ut.flatMap((St,sr)=>br.has(St)?[sr]:[]),ar=tt<nt?Math.max(...hr)+1:Math.min(...hr);ut.splice(ar,0,...He.filter(St=>lt.has(St))),R(ut)};return window.addEventListener("reorder-navigation-session",$),()=>window.removeEventListener("reorder-navigation-session",$)},[o,u,ve,w,Tr,gn,ds,k,R]);const li=T.useCallback($=>{if($.type!=="collaboration-member")return!1;if($.reason==="CANCEL")return!0;const le=$.source.droppableId.replace(/^collaboration-members:/,""),Ge=$.draggableId.replace(/^collaboration-member:/,""),Ce=Br.current;if(Ce?.kind==="split")return xn(Ge,le,Ce.groupId),N(Ce.sessionId,Ge),!0;if(Ce?.kind==="collaboration"&&Ce.groupId!==le)return xn(Ge,le,Ce.groupId),!0;if(Ce?.kind==="collaboration"&&Ce.background)return ts.has(Ge)&&v(Ge),!0;if($.destination&&$.destination.droppableId!==$.source.droppableId){const He=$.destination.droppableId.replace(/^collaboration-members:/,"");if(Tr.some(tt=>tt.id===He))return xn(Ge,le,He),!0}if($.combine){const He=$.combine.droppableId.replace(/^collaboration-members:/,"");He!==le&&xn(Ge,le,He);const tt=$.combine.draggableId.replace(/^collaboration-member:/,"");if(w.find(it=>it.sessionIds.includes(Ge))?.sessionIds.includes(tt)){const it=Tr.find(at=>at.id===le),Fe=it?Vu(it.sessionIds,w).flatMap(at=>at.sessionIds).indexOf(tt):-1;Fe>=0&&ds(le,$.source.index,Fe)}else gn.has(tt)&&N(tt,Ge);return!0}if($.destination?.droppableId===$.source.droppableId)return ds(le,$.source.index,$.destination.index),!0;if(Ce?.kind!=="list")return!0;if(Ce?.kind==="list"){const He=Cr.find(nt=>`group-sessions:${nt.key}`===Ce.listId),tt=Ce.listId==="sidebar-entities"?jr:He?_c(He.sessions,w,gn,Tr):null;if(tt){const nt=$2(tt,Ge,Ce.index);Ce.listId==="sidebar-entities"?R(nt):He&&R(Cr.flatMap(it=>it.key===He.key?nt:it.sessions.map(Fe=>Fe.id)))}}return xn(Ge,le,null),!0},[Tr,jr,Cr,xn,R,ds,gn,w,ts,v,N]),_r=T.useCallback($=>{if($.type!=="split-member")return!1;if($.reason==="CANCEL")return!0;const le=$.draggableId.replace(/^split-member:/,""),Ge=w.find(Fe=>Fe.sessionIds.includes(le));if(!Ge?.sessionIds.includes(le))return!0;const Ce=Ge.id,He=Br.current;if(He?.kind==="split")return xn(le,null,He.groupId),N(He.sessionId,le),!0;if(He?.kind==="collaboration")return xn(le,null,He.groupId),!0;if(!$.destination&&He?.kind==="list"){const Fe=Cr.find(lt=>`group-sessions:${lt.key}`===He.listId),at=He.listId==="sidebar-entities"?jr:Fe?_c(Fe.sessions,w,gn,Tr):null;if(!at)return!0;const Kt=$2(at,le,He.index);return v(le),He.listId==="sidebar-entities"?R(Kt):Fe&&R(Cr.flatMap(lt=>lt.key===Fe.key?Kt:lt.sessions.map(br=>br.id))),!0}if(!$.destination)return!0;const tt=$.destination.droppableId.replace(/^split-members:/,"");if(tt!==Ce){const at=w.find(Kt=>Kt.id===tt)?.sessionIds[0];return at&&N(at,le),!0}if($.source.index===$.destination.index)return!0;const nt=[...Ge.sessionIds],[it]=nt.splice($.source.index,1);return it&&(nt.splice($.destination.index,0,it),k(Ce,nt)),!0},[Tr,jr,Cr,xn,N,v,R,k,gn,w]),Un=($,le="top")=>a.jsx("div",{"data-split-exit-drop-index":$,className:`group/split-exit pointer-events-none absolute inset-x-0 z-10 h-2 ${le==="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"})}),Ot=T.useCallback(($,le,Ge)=>{if(li($)||_r($)||$.reason==="CANCEL")return;const Ce=le.find(Fe=>Fe.id===$.draggableId);if(!Ce)return;const He=Br.current;if(He?.kind==="split"&&Ce.kind==="session"){xn(Ce.session.id,null,He.groupId),N(He.sessionId,Ce.session.id);return}if(He?.kind==="collaboration"&&Ce.kind==="session"){xn(Ce.session.id,null,He.groupId);return}if($.combine&&Ce.kind!=="session"){const Fe=le.findIndex(at=>at.id===$.combine?.draggableId);if(Fe<0)return;$={...$,combine:null,destination:{...$.source,index:Fe}}}if($.combine){const Fe=le.find(ut=>ut.id===$.combine?.draggableId);if(!Fe)return;const at=Fe.kind==="workspace"?Fe:Ce.kind==="workspace"?Ce:Fe,Kt=at===Ce?Fe:Ce,lt=at.sessionIds[0],br=Kt.sessionIds[0];lt&&br&&lt!==br&&N(lt,br);return}if(!$.destination||$.source.index===$.destination.index)return;const tt=[...le],[nt]=tt.splice($.source.index,1);if(!nt)return;tt.splice($.destination.index,0,nt);const it=tt.flatMap(Fe=>Fe.sessionIds);if(Ge===void 0){R(it);return}R(Cr.flatMap(Fe=>Fe.key===Ge?it:Fe.sessions.map(at=>at.id)))},[Cr,li,_r,xn,N,R]),qs=T.useCallback($=>{if($.reason==="CANCEL"||li($)||_r($))return;if($.type==="group"){if(!$.destination||$.source.index===$.destination.index)return;R(m5(Cr,$.source.index,$.destination.index));return}const le=$.source.droppableId.replace(/^group-sessions:/,""),Ge=Cr.find(He=>He.key===le);if(!Ge)return;const Ce=_c(Ge.sessions,w,gn,Tr);if($.combine||Br.current?.kind==="collaboration"||Br.current?.kind==="split"){Ot($,Ce,le);return}!$.destination||$.destination.droppableId!==$.source.droppableId||Ot($,Ce,le)},[Tr,Cr,gn,w,li,Ot,_r,R]),rn=$=>{const le=ge===$.id,Ge=[{layout:"horizontal",label:ie("tab.splitHorizontal"),icon:Fl},{layout:"vertical",label:ie("tab.splitVertical"),icon:F1},...$.sessionIds.length>=3||$.layout==="grid"?[{layout:"grid",label:ie("tab.splitGrid"),icon:P1}]:[]],Ce=$.layout==="vertical"?F1:$.layout==="grid"?P1:Fl,He=Ge.find(tt=>tt.layout===$.layout)?.label??ie("tab.splitHorizontal");return a.jsxs("div",{ref:le?Bn:void 0,className:"relative shrink-0",onPointerDown:tt=>tt.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 ${le?"bg-primary/15 text-primary":"text-muted-foreground/70 hover:bg-surface-2 hover:text-foreground"}`,"aria-label":`${ie("tab.splitLayout")}: ${He}`,"aria-haspopup":"menu","aria-expanded":le,title:ie("tab.splitLayout"),onClick:tt=>{tt.stopPropagation(),Qt(nt=>nt===$.id?null:$.id)},children:a.jsx(Ce,{size:12})}),le&&a.jsx("div",{role:"menu","aria-label":ie("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:Ge.map(tt=>{const nt=tt.icon,it=tt.layout===$.layout;return a.jsx("button",{type:"button",role:"menuitemradio","aria-checked":it,"aria-label":tt.label,title:tt.label,className:`sidebar-session-action inline-flex h-7 w-7 items-center justify-center rounded-sm transition active:scale-95 ${it?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,onClick:Fe=>{Fe.stopPropagation(),I($.sessionIds[0],tt.layout),Qt(null)},children:a.jsx(nt,{size:13})},tt.layout)})})]})},Kn=($,le)=>le&&a.jsx("button",{type:"button",...le,"aria-label":$,title:$,onClick:Ge=>Ge.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(m8,{size:10})}),Kr=($,le,Ge=!1,Ce=!1,He)=>{if(le.length<2)return null;const tt=le.some(lt=>lt.id===c),nt=[],it=[],Fe=[];for(const lt of le){const br=u.get(lt.id);br?.agentStatus==="waiting"||br?.agentNeedsReview?nt.push(lt):br?.agentStatus==="working"?it.push(lt):br?.inCopyMode&&Fe.push(lt)}const at=$.name?.trim()||`${ie("tab.splitWorkspace")} ${w.findIndex(lt=>lt.id===$.id)+1}`,Kt=ge===$.id;return a.jsxs("section",{"data-split-workspace":$.id,"aria-label":at,className:`group/split relative rounded-md p-0.5 before:pointer-events-none before:absolute before:inset-0 before:rounded-md before:border before:border-border transition-colors ${Ce?"bg-primary/15 ring-1 ring-primary/40":Ge?"bg-surface-elevated opacity-90 shadow-lg":nt.length>0?"bg-[rgb(var(--warning-rgb)_/_0.08)] hover:bg-[rgb(var(--warning-rgb)_/_0.12)]":it.length>0?"bg-[rgb(var(--success-rgb)_/_0.06)] hover:bg-[rgb(var(--success-rgb)_/_0.10)]":Fe.length>0?"bg-[rgb(var(--tmux-rgb)_/_0.07)] hover:bg-[rgb(var(--tmux-rgb)_/_0.11)]":tt?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[Kn(`移动分屏组 ${at}`,He),a.jsx(Ga,{droppableId:`split-members:${$.id}`,type:"split-member",direction:"vertical",children:(lt,br)=>a.jsxs("div",{ref:lt.innerRef,...lt.droppableProps,"data-split-members":!0,className:br.isDraggingOver?"rounded-sm bg-primary/10 ring-1 ring-primary/40":"",children:[le.map((ut,hr)=>a.jsx(Ha,{draggableId:`split-member:${ut.id}`,index:hr,disableInteractiveElementBlocking:!0,children:(ar,St)=>a.jsx("div",{ref:ar.innerRef,...ar.draggableProps,...Q?as(()=>Q(ut.id)):{},className:`${hr===0&&Kt?"relative z-20 ":"relative "}flex items-center rounded-sm pr-0.5 transition-colors ${St.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${Ts(ut.id)??(ut.id===c?"bg-surface-elevated/80 text-foreground":"text-muted-foreground hover:bg-surface-2")}`,children:_n(ut,ar.dragHandleProps,!0,hr===0?rn($):void 0)})},ut.id)),lt.placeholder]})})]})},Xn=($,le,Ge,Ce=!1,He=!1)=>{if(le.length<($.federated?1:2))return null;const tt=le.some(at=>at.id===c),nt=Vu($.sessionIds,w),it=nt.flatMap(at=>at.sessionIds),Fe=nt.length===1?nt[0]?.workspace:void 0;return a.jsxs("section",{"data-collaboration-group":$.id,"data-collaboration-group-name":$.name,"aria-label":`Agent 工作组:${$.name}`,className:`group/collaboration relative rounded-md p-0.5 before:pointer-events-none before:absolute before:inset-0 before:rounded-md before:border before:border-border transition-colors data-[drop-active=true]:bg-primary/15 data-[drop-active=true]:ring-1 data-[drop-active=true]:ring-primary/40 ${He?"bg-primary/15 ring-1 ring-primary/40":Ce?"bg-surface-elevated opacity-90 shadow-lg":tt?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[Kn(`移动工作组 ${$.name}`,Ge),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:`打开 ${$.name} 的协作消息`,"aria-label":`打开 Agent 工作组消息:${$.name}`,onClick:at=>{at.stopPropagation(),gt($.id)},children:a.jsx(U1,{size:9})}),a.jsx(Ga,{droppableId:`collaboration-members:${$.id}`,type:"collaboration-member",direction:"vertical",isCombineEnabled:!0,children:(at,Kt)=>a.jsxs("div",{ref:at.innerRef,...at.droppableProps,"data-collaboration-members":!0,className:`${Kt.isDraggingOver?"rounded-sm bg-primary/10":""}`,children:[nt.map(lt=>a.jsx("div",{"data-collaboration-split":lt.workspace?.id,"data-split-anchor":lt.workspace?.sessionIds[0],role:lt.workspace?"region":void 0,"aria-label":lt.workspace?`${ie("tab.splitWorkspace")} · ${lt.sessionIds.length}`:void 0,className:lt.workspace&&!Fe?`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 ${lt.sessionIds.includes(c??"")?"bg-primary/[0.07]":"bg-surface/35"}`:void 0,children:lt.sessionIds.map(br=>{const ut=gn.get(br);return ut?a.jsx(Ha,{draggableId:`collaboration-member:${ut.id}`,index:it.indexOf(ut.id),disableInteractiveElementBlocking:!0,children:(hr,ar)=>a.jsxs("div",{ref:hr.innerRef,...hr.draggableProps,"data-collaboration-member":ut.id,"data-split-member":ts.has(ut.id)?"true":void 0,...Q?as(()=>Q(ut.id)):{},className:`${lt.workspace&&br===lt.sessionIds[0]&&ge===lt.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 ${ar.combineTargetFor?"bg-primary/15 ring-1 ring-primary/40 ":ar.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${Ts(ut.id)??(ut.id===c?"bg-surface-elevated/80 text-foreground":ts.has(ut.id)?"bg-primary/[0.05] text-muted-foreground hover:bg-primary/[0.09]":"text-muted-foreground hover:bg-surface-2")}`,children:[_n(ut,hr.dragHandleProps,!0,lt.workspace&&br===lt.sessionIds[0]?rn(lt.workspace):void 0),!lt.workspace&&ts.has(ut.id)&&a.jsx("button",{type:"button",className:"shrink-0 px-1 text-[10px] text-primary",title:`与 ${w.find(St=>St.sessionIds.includes(ut.id))?.sessionIds.filter(St=>St!==ut.id).map(St=>gn.get(St)?.name??St).join("、")} 分屏`,"aria-label":`查看 ${ut.name} 的跨组分屏`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:ut.id})),Vr()},children:a.jsx(Fl,{size:10})})]})},ut.id):null})},lt.workspace?.id??lt.sessionIds[0])),at.placeholder]})}),$.remoteSessions?.map(at=>a.jsxs("button",{type:"button",title:`${at.serviceLabel??at.serviceOrigin} · ${at.serviceConnected===!1?"服务不可达,消息尚未送达":at.status}`,className:"flex w-full min-w-0 items-center gap-1.5 rounded-sm px-2 py-1 text-left text-[11px] text-muted-foreground hover:bg-surface-2",onClick:()=>{Q3(at.sessionId).catch(()=>{gt($.id)})},children:[a.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${at.serviceConnected===!1?"bg-muted-foreground":"bg-primary"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:at.name}),a.jsx("span",{className:"max-w-20 truncate rounded border border-border/20 px-1 text-[9px]",children:at.serviceLabel??at.serviceOrigin}),at.serviceConnected===!1&&a.jsx("span",{className:"shrink-0 text-[9px]",children:"不可达"})]},at.sessionId)),a.jsx("div",{"data-collaboration-background":!0,className:"h-1.5"})]})},bn=($,le,Ge)=>a.jsx(_d,{onBeforeCapture:qn,onDragStart:Yn,onDragEnd:Ce=>As(He=>Ot(He,$,Ge),Ce),children:a.jsx(Ga,{droppableId:le,direction:"vertical",isCombineEnabled:!jt,children:Ce=>a.jsxs("div",{ref:Ce.innerRef,...Ce.droppableProps,"data-sidebar-entity-list-id":le,className:"space-y-0.5",children:[$.map((He,tt)=>a.jsx(Ha,{draggableId:He.id,index:tt,disableInteractiveElementBlocking:!0,children:(nt,it)=>a.jsxs("div",{ref:nt.innerRef,...nt.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":tt,className:"relative",children:[Un(tt),tt===$.length-1&&Un($.length,"bottom"),He.kind==="workspace"?Kr(He.workspace,He.members,it.isDragging,!!it.combineTargetFor,nt.dragHandleProps):He.kind==="collaboration"?Xn(He.group,He.members,nt.dragHandleProps,it.isDragging,!!it.combineTargetFor):a.jsx("div",{...Q?as(()=>Q(He.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${it.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":it.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":Ts(He.session.id)??(He.session.id===c?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:_n(He.session,nt.dragHandleProps)})]})},He.id)),Ce.placeholder]})})}),xr=a.jsxs(a.Fragment,{children:[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:ie("sidebar.sessions")}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:o.length}),tn>0&&a.jsx("span",{className:"ml-0.5 flex items-center",children:a.jsx(K3,{count:tn,tone:"running",title:ie("agent.aiRunning")})})]})}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[a.jsxs("div",{ref:lr,className:Le?"relative z-20":"relative",children:[a.jsxs("button",{type:"button",onClick:()=>Xe($=>!$),className:`relative inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg transition active:scale-95 ${Le?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-expanded":Le,"aria-haspopup":"menu","aria-label":Lr&&P?.latestVersion?`${ie("sidebar.moreActions")}: ${ie("sidebar.updateAvailable",{version:P.latestVersion})}`:ie("sidebar.moreActions"),title:Lr&&P?.latestVersion?`${ie("sidebar.moreActions")}: ${ie("sidebar.updateAvailable",{version:P.latestVersion})}`:ie("sidebar.moreActions"),children:[a.jsx(R0,{size:15}),Lr&&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"})]}),Le&&a.jsxs("div",{ref:ye,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:[Lr&&P?.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(vs,{size:13,className:P.status==="installing"||P.status==="restarting"?"animate-spin":""})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-semibold",children:ie("sidebar.updateAvailable",{version:P.latestVersion})}),a.jsx("span",{className:"mt-0.5 block text-[10.5px] leading-relaxed text-muted-foreground",children:P.status==="installing"?ie("sidebar.updateInstalling"):P.status==="ready"?ie("sidebar.updateReady"):P.status==="restarting"?ie("sidebar.updateRestarting"):ie("sidebar.updateFailed")})]})]}),P.status==="ready"&&V&&a.jsx("button",{type:"button",role:"menuitem",disabled:Z,onClick:V,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:ie("sidebar.updateRestart")}),P.status==="error"&&fe&&a.jsx("button",{type:"button",role:"menuitem",disabled:Z,onClick:fe,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:ie("sidebar.updateRetry")})]}),Ee&&a.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":Ue,onClick:()=>Ee(!Ue),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:ie("sidebar.runningSessionButtonHint"),children:[a.jsx(mn,{size:14,className:Ue?"text-[color:var(--success)]":"text-muted-foreground"}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block",children:ie("sidebar.runningSessionButton")}),a.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:ie("sidebar.runningSessionButtonHint")})]}),a.jsx(za,{checked:Ue,size:"sm"})]}),q&&a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Xe(!1),q()},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(Uv,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:ie("sidebar.subscriptionQuota")})]}),a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Xe(!1),gt(null)},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(U1,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:"Agent 工作台"})]}),a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Xe(!1),p7()},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(f7,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:"服务与设备"})]}),a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Xe(!1),F()},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(V8,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:ie("sidebar.settings")})]}),ht&&a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{Xe(!1),ht()},className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition ${st?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,children:[st?a.jsx($c,{size:14}):a.jsx(Uc,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:ie(st?"sidebar.unpinSidebar":"sidebar.pinSidebar")})]})]})]}),(!be||st)&&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":ie("common.close"),children:a.jsx(ys,{size:14})})]})]})]}),gr&&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:gr}),a.jsx("button",{type:"button","aria-label":"关闭协作错误提示",className:"shrink-0",onClick:()=>ct(null),children:a.jsx(ys,{size:14})})]}),a.jsxs("div",{ref:Ir,className:"relative z-10 min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pt-0.5 pb-1.5",children:[Ve.length>0&&a.jsxs("section",{className:"mb-2 rounded-lg bg-[rgb(var(--tmux-rgb)_/_0.07)] p-1","aria-label":ie("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(C0,{size:12,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:ie("sidebar.recoverableSessions")}),a.jsx("span",{className:"text-muted-foreground",children:Ve.length}),Oe&&a.jsx("button",{type:"button",onClick:Oe,disabled:he,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":ie("sidebar.refreshRecoverableSessions"),title:ie("sidebar.refreshRecoverableSessions"),children:a.jsx(vs,{size:11,className:he?"animate-spin":""})})]}),a.jsx("div",{className:"space-y-0.5",children:Ve.slice(0,4).map($=>{const le=$.friendlyName?.trim()||$.label?.trim()||$.name,Ge=Pc($.cwd??null),Ce=Mt===$.name;return a.jsxs("button",{type:"button",disabled:Mt!==null,onClick:()=>Zn($),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":ie("sidebar.restoreRecoverableSession",{name:le}),title:$.cwd||$.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:Ce?a.jsx(mn,{size:12,className:"animate-spin"}):a.jsx(D0,{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:le}),a.jsx("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[$.program,Ge].filter(Boolean).join(" · ")||`tmux:${$.name}`})]}),a.jsx("span",{className:"shrink-0 text-[10px] font-medium text-[color:var(--tmux)] group-hover:text-foreground",children:ie(Ce?"sidebar.restoringRecoverableSession":"sidebar.restore")})]},$.name)})})]}),o.length===0?a.jsxs("div",{className:"rounded-xl bg-surface-2/60 px-4 py-8 text-center",children:[a.jsx(Po,{size:26,className:"mx-auto mb-2 text-muted-foreground"}),a.jsx("p",{className:"text-[12px] text-muted-foreground",children:ie("sidebar.noSessions")})]}):rs.length===0&&w.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:ie("sidebar.noMatchingSessions")})}):ve?a.jsx("div",{className:"space-y-1.5",children:a.jsx(_d,{onBeforeCapture:qn,onDragStart:Yn,onDragEnd:$=>As(qs,$),children:a.jsx(Ga,{droppableId:"sidebar-groups",type:"group",direction:"vertical",children:$=>a.jsxs("div",{ref:$.innerRef,...$.droppableProps,className:"space-y-1.5",children:[Cr.map((le,Ge)=>{const Ce=$r.has(le.key),He=_c(le.sessions,w,gn,Tr);let tt=0,nt=0;for(const Fe of le.sessions){const at=u.get(Fe.id);at?.agentStatus==="working"&&(tt+=1),(at?.agentStatus==="waiting"||at?.agentNeedsReview)&&(nt+=1)}const it=le.key==="";return a.jsx(Ha,{draggableId:`sidebar-group:${le.key||"__ungrouped__"}`,index:Ge,isDragDisabled:it,disableInteractiveElementBlocking:!0,children:(Fe,at)=>a.jsxs("div",{ref:Fe.innerRef,...Fe.draggableProps,className:`rounded-md transition-colors ${at.isDragging?"bg-surface-elevated shadow-lg opacity-90":""}`,children:[a.jsxs("button",{type:"button",...it?{}:Fe.dragHandleProps,onClick:()=>{kt(le.key),or.current.delete(le.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 ${it?"":"cursor-grab active:cursor-grabbing"}`,title:le.key||le.label,children:[a.jsx(eu,{size:13,className:`shrink-0 transition-transform ${Ce?"":"rotate-90"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold uppercase tracking-wide",children:le.label}),tt>0&&a.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)] animate-pulse"}),nt>0&&a.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] animate-pulse"}),a.jsx(s2,{sessionIds:le.sessions.map(Kt=>Kt.id)}),a.jsx("span",{className:"shrink-0 text-[10.5px] text-muted-foreground/70",children:le.sessions.length})]}),!Ce&&a.jsx("div",{className:"mt-0.5 pl-2",children:a.jsx(Ga,{droppableId:`group-sessions:${le.key}`,type:"session",direction:"vertical",isCombineEnabled:!jt,children:Kt=>a.jsxs("div",{ref:Kt.innerRef,...Kt.droppableProps,"data-sidebar-entity-list-id":`group-sessions:${le.key}`,className:"space-y-0.5",children:[He.map((lt,br)=>a.jsx(Ha,{draggableId:lt.id,index:br,disableInteractiveElementBlocking:!0,children:(ut,hr)=>a.jsxs("div",{ref:ut.innerRef,...ut.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":br,className:"relative",children:[Un(br),br===He.length-1&&Un(He.length,"bottom"),lt.kind==="workspace"?Kr(lt.workspace,lt.members,hr.isDragging,!!hr.combineTargetFor,ut.dragHandleProps):lt.kind==="collaboration"?Xn(lt.group,lt.members,ut.dragHandleProps,hr.isDragging,!!hr.combineTargetFor):a.jsx("div",{...Q?as(()=>Q(lt.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${hr.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":hr.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":Ts(lt.session.id)??(lt.session.id===c?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:_n(lt.session,ut.dragHandleProps)})]})},lt.id)),Kt.placeholder]})})})]})},le.key||"__ungrouped__")}),$.placeholder]})})})}):bn(jr,"sidebar-entities")]}),a.jsx(m7,{onReselect:()=>{f&&(kn.current=null,re($=>$+1),f())}}),Rt&&a.jsx(cD,{directories:o.flatMap($=>{const le=u.get($.id)?.cwd;return le?[le]:[]}),tmuxAvailable:_e,options:qt,agents:Ze,selectedAgent:Te,detecting:Ht,resumeHistory:et,resumeHistoryLoading:xe,resumeHistoryPendingId:Ie,resumeHistoryError:Pe,onRefreshAgents:()=>{$e().catch(()=>{})},onSelectAgent:$=>{Nt($).catch(()=>{})},onLaunchAgent:zt,onResumeHistory:$=>{On($)},onRemoveResumeHistory:$=>{zr($)},onClose:()=>We(!1),onOptionsChange:ee}),W&&a.jsx(pD,{activeSessionId:c,initialCollaborationGroupId:Se,initialFloating:ce,onFloatingChange:Me,defaultSessionMode:De,onClose:()=>{ue.current=!0,Je(!1),me(null)},onNewSession:$=>m($)},Se??"workbench"),!Rt&&a.jsx("div",{className:"relative z-10 shrink-0 bg-[var(--chrome-bg)] px-3 pb-3 pt-1 md:border-t md:border-border md:p-2",children:a.jsxs("div",{className:`grid gap-1.5 [&>button]:min-h-11 [&>button]:shadow-none [&>button]:ring-0 md:[&>button]:min-h-0 ${Te?"grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.5rem]":"grid-cols-[minmax(0,1fr)_2.5rem]"}`,children:[a.jsxs("button",{type:"button",onClick:Pn,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] ${Te?"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:ie("sidebar.newSession"),"aria-label":ie("sidebar.newSession"),children:[a.jsx(Po,{size:15,className:"shrink-0"}),a.jsx("span",{className:"truncate",children:"Terminal"})]}),Te&&a.jsxs("button",{type:"button",onClick:sn,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:ie("sidebar.newSessionWithAgent",{agent:Te.displayName}),"aria-label":ie("sidebar.newSessionWithAgent",{agent:Te.displayName}),children:[a.jsx(Wl,{agent:Te,size:15}),a.jsx("span",{className:"truncate",children:Te.displayName})]}),a.jsx("button",{type:"button",onClick:Fn,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:ie("sidebar.moreLaunchOptions"),"aria-label":ie("sidebar.moreLaunchOptions"),"aria-expanded":!1,children:a.jsx(bl,{size:15,className:"transition-transform duration-200"})})]})})]});return st?a.jsx("div",{"data-session-sidebar-pinned":!0,className:"h-full flex flex-col app-chrome-bg border-r border-border",children:xr}):a.jsx(q3,{side:"left",isOpen:e,drawerWidthPx:t,onClose:r,onOpen:s,push:be,children:xr})}function RD(){const{t:e}=qr();return a.jsxs("div",{role:"status","aria-label":e("rightSidebar.loadingGitChanges"),className:"flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[a.jsx("span",{className:"sr-only",children:e("rightSidebar.loadingGitChanges")}),a.jsxs("div",{"aria-hidden":"true",className:"shrink-0 border-b border-border/15 px-3 py-2",children:[a.jsxs("div",{className:"mb-2 flex h-5 items-center gap-1",children:[a.jsx("div",{className:"h-4 w-16 rounded bg-surface-2"}),a.jsx("div",{className:"h-4 w-7 rounded bg-surface-2"}),a.jsx("div",{className:"h-4 w-12 rounded bg-surface-2"})]}),a.jsxs("div",{className:"flex h-[15px] items-center justify-between",children:[a.jsx("div",{className:"h-2 w-14 rounded bg-surface-2"}),a.jsx("div",{className:"h-2 w-6 rounded bg-surface-2"})]}),a.jsxs("div",{className:"mt-2 flex h-7 items-center gap-1.5",children:[a.jsx("div",{className:"h-7 w-12 rounded-full bg-surface-2"}),a.jsx("div",{className:"h-7 w-16 rounded-full bg-surface-2"}),a.jsx("div",{className:"h-3 w-24 max-w-[30%] rounded bg-surface-2"}),a.jsx("div",{className:"ml-auto h-4 w-4 rounded-full bg-surface-2"})]})]}),a.jsxs("div",{"aria-hidden":"true",className:"overflow-hidden px-3 py-2",children:[a.jsxs("div",{className:"flex h-8 items-center gap-2",children:[a.jsx("div",{className:"h-3 w-3 rounded-sm bg-surface-2"}),a.jsx("div",{className:"h-2 w-32 max-w-[55%] rounded bg-surface-2"})]}),["w-3/5","w-2/5","w-1/2","w-1/3"].map((t,r)=>a.jsxs("div",{className:"flex h-9 items-center gap-2 pl-5",style:{opacity:1-r*.15},children:[a.jsx("div",{className:"h-3 w-3 shrink-0 rounded-sm bg-surface-2"}),a.jsx("div",{className:`h-2 rounded bg-surface-2 ${t}`})]},t))]})]})}function ND({slow:e=!1}){const{t}=qr();return a.jsxs("div",{role:"status","aria-label":t("rightSidebar.loadingGitChanges"),className:"relative h-full min-h-0 overflow-hidden bg-surface px-3",children:[a.jsx("span",{className:"sr-only",children:t("rightSidebar.loadingGitChanges")}),a.jsxs("div",{"aria-hidden":"true",children:[a.jsxs("div",{className:"flex h-[76px] items-center gap-2 border-b border-border/40 px-2",children:[a.jsx("div",{className:"h-6 w-6 rounded-md bg-surface-2"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"h-3 w-16 rounded bg-surface-2"}),a.jsx("div",{className:"h-2 w-12 rounded bg-surface-2"})]})]}),a.jsxs("div",{className:"flex h-11 items-center gap-2 px-1 pt-3",children:[a.jsx("div",{className:"h-6 w-6 rounded-md bg-surface-2"}),a.jsx("div",{className:"h-3 w-16 rounded bg-surface-2"}),a.jsx("div",{className:"ml-auto h-4 w-12 rounded-full bg-surface-2"})]}),[!1,!0].map(r=>a.jsxs("div",{className:"border-b border-border/40 px-1 py-4",children:[a.jsxs("div",{className:"mb-2 flex h-8 items-center justify-between",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"h-3 w-14 rounded bg-surface-2"}),r&&a.jsx("div",{className:"h-2 w-28 rounded bg-surface-2"})]}),a.jsx("div",{className:"h-8 w-12 rounded-md bg-surface-2"})]}),a.jsx("div",{className:"h-10 rounded-md bg-surface-2"})]},String(r))),a.jsx("div",{className:"flex h-[69px] items-center border-b border-border/40 px-2",children:a.jsx("div",{className:"h-3 w-16 rounded bg-surface-2"})}),a.jsxs("div",{className:"space-y-2 px-1 py-4",children:[a.jsxs("div",{className:"flex h-8 items-center justify-between",children:[a.jsx("div",{className:"h-3 w-14 rounded bg-surface-2"}),a.jsx("div",{className:"h-8 w-28 rounded-md bg-surface-2"})]}),a.jsx("div",{className:"h-7 rounded-md bg-surface-2"}),a.jsx("div",{className:"h-10 rounded-md bg-surface-2"})]})]}),e&&a.jsx("div",{className:"absolute inset-x-3 bottom-3 rounded-md bg-surface-elevated px-3 py-2 text-xs text-muted-foreground",children:t("rightSidebar.loadingGitChangesSlow")})]})}const o6=()=>b7(()=>import("./RightSidebar-g_aBUJMG.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})),DD=T.lazy(o6);function H2(e){const t=T.useRef(!1);T.useEffect(()=>{const m=navigator.connection;if(!(m?.saveData||/2g|3g/.test(m?.effectiveType??"")))return dp(()=>{o6().catch(()=>{})},3e3)},[]);const{t:r}=qr(),s=Ft(m=>m.rootPath),o=Ft(m=>m.rightTab),c=Ft(m=>m.setRightTab),u=s?.replace(/\/+$/,"").split("/").pop()||r("rightSidebar.workspace");(e.isOpen||e.pinned)&&(t.current=!0);const f=a.jsx(q3,{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:"shrink-0 border-b border-border/15 bg-surface px-2 pt-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"min-w-0 flex-1 px-1",children:a.jsx("div",{className:"flex min-h-[1.25rem] items-baseline gap-1.5",children:a.jsx("span",{className:"truncate text-[13px] font-semibold text-foreground",children:u})})}),a.jsx("div",{"aria-hidden":"true",className:"flex items-center gap-1.5",children:[zc,P8,R0].map((m,g)=>a.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full bg-surface-2 text-muted-foreground",children:a.jsx(m,{size:14})},g))}),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(ys,{size:14})})]}),a.jsx("div",{className:"mt-2 grid grid-cols-3 gap-0.5 rounded-md bg-surface-2 p-0.5",children:[["git",wv,"rightSidebar.tabGit"],["diff",Tv,"rightSidebar.tabChanges"],["files",ql,"rightSidebar.tabFiles"]].map(([m,g,b])=>a.jsxs("button",{type:"button",onClick:()=>c(m),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium ${o===m?"bg-surface-elevated text-foreground":"text-muted-foreground"}`,children:[a.jsx(g,{size:12}),r(b)]},m))}),a.jsx("div",{className:"h-2"})]}),a.jsx("div",{className:"min-h-0 flex-1 bg-surface",children:o==="git"?a.jsx(ND,{}):a.jsx(RD,{})})]})});return t.current?a.jsx(T.Suspense,{fallback:f,children:a.jsx(DD,{...e})}):f}function QD(e){return e>=90?"var(--destructive)":e>=70?"var(--warning)":"var(--success)"}function BD(e){return e>=90?"var(--destructive)/0.15":e>=70?"var(--warning)/0.15":"var(--success)/0.12"}function jD(e){if(!e)return"";const t=new Date(e),r=Date.now(),s=t.getTime()-r;if(s<=0)return"";const o=Math.floor(s/6e4),c=Math.floor(o/60),u=Math.floor(c/24),f=c%24,m=o%60,g=t.toLocaleDateString(void 0,{month:"short",day:"numeric"}),b=t.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});let x;return u>0?x=`${u}d ${f}h`:f>0?x=`${f}h ${m}m`:m>0?x=`${m}m`:x="soon",`resets in ${x} (${g} ${b})`}function PD(e){return{claude:"🧠",codex:"✨",kimi:"🌙",copilot:"🐙",grok:"🚀",gemini:"💎"}[e]||"📊"}function OD({result:e}){const{t}=qr(),r=e.windows.filter(f=>f.percent===0&&!f.resetAt),s=e.windows.filter(f=>f.percent>0||f.resetAt),o=r.length>0?r.map(f=>f.label).join(" · "):"",c=!!e.error;let u=null;return!c&&e.entitlement&&(e.usagePercent>=90?u=t("quota.exhausted"):e.remaining!==void 0&&e.remaining<e.entitlement?u=t("quota.left",{n:e.remaining}):u=`${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:PD(e.slug)}),a.jsx("span",{className:"truncate",children:e.displayName}),o&&a.jsx("span",{className:"shrink-0 rounded-full bg-surface-elevated px-2 py-0.5 text-[10px] font-normal text-muted-foreground",children:o})]}),u&&a.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:u})]}),s.length>0?a.jsx("div",{className:"mt-2.5 space-y-2",children:s.map(f=>{const m=Math.max(0,Math.min(100,f.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:f.label}),a.jsx("div",{className:"flex-1",children:a.jsx("div",{className:"h-2 rounded-full",style:{background:BD(f.percent)},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${m}%`,background:QD(f.percent)}})})}),a.jsxs("span",{className:"w-9 shrink-0 text-right tabular-nums font-medium text-foreground",children:[Math.round(f.percent),"%"]})]}),f.resetAt&&a.jsx("p",{className:"mt-1 pl-14 text-[10px] text-muted-foreground sm:pl-16",children:jD(f.resetAt)})]},f.label)})}):c?a.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:e.error}):null]})}function FD({isOpen:e,onClose:t}){const{t:r}=qr(),[s,o]=T.useState([]),[c,u]=T.useState(!1),f=async(b=!1)=>{u(!0);try{const x=b?await y7():await v7();o(x.providers||[])}catch{}finally{u(!1)}};if(T.useEffect(()=>{e&&f()},[e]),T.useEffect(()=>{if(!e)return;const b=x=>{const v=x.detail;Array.isArray(v)&&o(v)};return window.addEventListener("termdock:quota-update",b),()=>{window.removeEventListener("termdock:quota-update",b)}},[e]),!e)return null;const m=s.filter(b=>!b.error),g=m.length>0?new Date(Math.max(...m.map(b=>b.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:()=>f(!0),disabled:c,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(vs,{size:15,className:c?"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(ys,{size:17})})]})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3 sm:p-5",children:[c&&m.length===0?a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx(vs,{size:24,className:"animate-spin text-muted-foreground"})}):m.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:m.map(b=>a.jsx(OD,{result:b},b.slug))}),g&&a.jsx("p",{className:"mt-3 text-center text-[10px] text-muted-foreground",children:r("quota.updated",{time:g.toLocaleTimeString()})})]})]})]})}const G2=[{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~"}],UD=2,$D=20;function zD({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 HD({value:e,onChange:t,placeholder:r}){const{t:s}=qr(),[o,c]=S.useState(""),u=x=>{const v=[];let w="",I=!1;const k=()=>{const R=w.trim();R&&v.push(R),w=""};for(let R=0;R<x.length;R+=1){const Q=x[R];if(!I&&Q==="/"&&w.trim().length===0){I=!0,w+=Q;continue}if(I){if(w+=Q,Q==="/"&&x[R-1]!=="\\"&&w.length>1){for(;R+1<x.length&&/[gimsuy]/.test(x[R+1]??"");)R+=1,w+=x[R];k(),I=!1}continue}if(Q===","||/\s/.test(Q)){k();continue}w+=Q}if(k(),v.length===0)return;const N=[...e];for(const R of v){const Q=hx(R);Q&&(N.includes(Q)||N.push(Q))}t(N),c("")},f=x=>{t(e.filter(v=>v!==x))},m=o.trim(),g=m.length>0&&rg(m),b=g&&!md(m);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(x=>{const v=rg(x),w=v&&!md(x);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"}),x,a.jsx("button",{type:"button",onClick:()=>f(x),className:"rounded-full p-0.5 text-muted-foreground hover:bg-destructive/20 hover:text-destructive","aria-label":s("toolbarPresets.removeAction",{name:x}),children:a.jsx(ys,{size:12})})]},x)}),a.jsx("input",{type:"text",value:o,onChange:x=>c(x.target.value),onKeyDown:x=>{x.key==="Enter"||x.key===","&&!g?(x.preventDefault(),u(o)):x.key==="Backspace"&&o.length===0&&e.length>0&&f(e[e.length-1])},onBlur:()=>u(o),placeholder:e.length===0?r:"",className:`min-w-[8ch] flex-1 bg-transparent py-1 text-sm outline-none placeholder:text-muted/60 ${g?"font-mono":""} ${b?"text-destructive":""}`,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off"})]})})}function GD({value:e,min:t,max:r,onChange:s}){const{t:o}=qr();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":o("common.decrease"),children:a.jsx(_8,{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":o("common.increase"),children:a.jsx(zi,{size:14})})]})}const WD=({presets:e,selectedPresetId:t,onSelectPreset:r,onUpdatePreset:s,onAddPreset:o,onRemovePreset:c,onResetDefaults:u})=>{const{t:f}=qr(),m=e.find(R=>R.id===t)??e[0]??null,[g,b]=S.useState(null);if(!m)return null;const x=m.actions.length>0,v=[{id:"preview-auto",label:m.label,kind:"preset"},...m.includeAlt?[{id:"preview-alt",label:"Alt"}]:[],...x?m.actions.map((R,Q)=>({id:R.id,label:Of(R,Q)})):["Enter","Home","End","Ctrl-C","Ctrl-D"].map(R=>({id:R,label:R}))],w=fx(v,m.rowLayout),I=(R,Q)=>{s(m.id,F=>{const q=F.actions.findIndex(V=>V.id===R);if(q===-1)return F;const P=q+Q;if(P<0||P>=F.actions.length)return F;const Z=[...F.actions];return[Z[q],Z[P]]=[Z[P],Z[q]],{...F,actions:Z}})},k=m.rowLayout.reduce((R,Q)=>R+Q,0),N=1+(m.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:f("toolbarPresets.preview")}),a.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[m.actions.length," button",m.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,Q)=>{const F=R.items[0]?.kind==="preset",q=Math.max(2,R.columns),P=F?`${px}px repeat(${Math.max(1,q-1)}, minmax(0, 1fr))`:`repeat(${q}, minmax(0, 1fr))`;return a.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:P},children:R.items.map(Z=>Z.kind==="preset"?a.jsx(mx,{mode:"auto",presetLabel:Z.label,title:`Auto preset · ${Z.label}`,disabled:!0},Z.id):a.jsx(zD,{label:Z.label},Z.id))},`preview-row-${Q}`)})}),m.actions.length>k-N&&a.jsx("p",{className:"mt-1.5 text-[10px] text-muted-foreground",children:f("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:f("toolbarPresets.presets")}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("button",{type:"button",onClick:o,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(zi,{size:14}),f("toolbarPresets.new")]}),a.jsxs("button",{type:"button",onClick:u,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(vs,{size:14}),f("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===m.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:f("toolbarPresets.label")}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:m.label,onChange:R=>s(m.id,Q=>({...Q,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:f("toolbarPresets.presetLabelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"}),m.id!=="default"&&a.jsx("button",{type:"button",onClick:()=>c(m.id),className:"shrink-0 rounded-full bg-surface-2 px-3 py-2.5 text-destructive hover:bg-destructive/15","aria-label":f("toolbarPresets.deletePreset",{name:m.label}),children:a.jsx(Hi,{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:f("toolbarPresets.matchPrograms")}),a.jsx("span",{className:"text-[10px] text-muted-foreground",children:f("toolbarPresets.typeEnterHint")})]}),a.jsx(HD,{value:m.programs,onChange:R=>s(m.id,Q=>({...Q,programs:R})),placeholder:f("toolbarPresets.programsPlaceholder")}),a.jsx("p",{className:"text-[10px] text-muted-foreground",children:f("toolbarPresets.programsHelp")})]}),a.jsxs("button",{type:"button",onClick:()=>s(m.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:f("toolbarPresets.altSlot")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:f("toolbarPresets.altSlotHint")})]}),a.jsx(za,{checked:m.includeAlt})]}),a.jsxs("button",{type:"button",onClick:()=>s(m.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:f("toolbarPresets.desktopVisibility")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:f("toolbarPresets.desktopVisibilityHint")})]}),a.jsx(za,{checked:m.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:f("toolbarPresets.rowLayout")}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:f("toolbarPresets.rowLayoutHint")})]}),a.jsxs("button",{type:"button",onClick:()=>s(m.id,R=>({...R,rowLayout:[...wp(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(zi,{size:12}),f("toolbarPresets.addRow")]})]}),a.jsx("div",{className:"space-y-2",children:m.rowLayout.map((R,Q)=>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:f("toolbarPresets.rowN",{n:Q+1})}),a.jsx("div",{className:"flex-1"}),a.jsx(GD,{value:R,min:UD,max:$D,onChange:F=>s(m.id,q=>({...q,rowLayout:q.rowLayout.map((P,Z)=>Z===Q?F:P)}))}),m.rowLayout.length>1&&a.jsx("button",{type:"button",onClick:()=>s(m.id,F=>({...F,rowLayout:F.rowLayout.filter((q,P)=>P!==Q)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":f("toolbarPresets.removeRow",{n:Q+1}),children:f("toolbarPresets.del")})]},`row-${Q}`))})]}),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:f("toolbarPresets.buttons")}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:f("toolbarPresets.buttonsHint")})]}),a.jsxs("button",{type:"button",onClick:()=>{const R=`${m.id}-action-${Date.now()}`;s(m.id,Q=>({...Q,actions:[...Q.actions,{id:R,label:`Key ${Q.actions.length+1}`,sequence:""}]})),b(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(zi,{size:12}),f("toolbarPresets.addButton")]})]}),m.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:f("toolbarPresets.noCustomButtons")}),m.actions.map((R,Q)=>{const F=g===R.id;return a.jsxs("div",{className:`rounded-2xl bg-surface-2 transition ${F?"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:Q===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":f("toolbarPresets.moveUp"),children:a.jsx(x5,{size:12})}),a.jsx("button",{type:"button",onClick:()=>I(R.id,1),disabled:Q===m.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":f("toolbarPresets.moveDown"),children:a.jsx(kv,{size:12})})]}),a.jsxs("button",{type:"button",onClick:()=>b(F?null:R.id),className:"min-w-0 flex-1 text-left",children:[a.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:Of(R,Q)}),a.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:[R.sequence?R.sequence:f("toolbarPresets.noSequence"),R.doubleTapSequence&&a.jsxs("span",{className:"ml-1 text-accent/70",children:["· 2× ",R.doubleTapSequence]})]})]}),a.jsx("button",{type:"button",onClick:()=>s(m.id,q=>({...q,actions:q.actions.filter(P=>P.id!==R.id)})),className:"shrink-0 rounded-full bg-surface p-2 text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":f("toolbarPresets.removeAction",{name:R.label}),children:a.jsx(Hi,{size:14})})]}),F&&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:f("toolbarPresets.labelField")}),a.jsx("input",{type:"text",value:R.label,onChange:q=>s(m.id,P=>({...P,actions:P.actions.map(Z=>Z.id===R.id?{...Z,label:q.target.value}:Z)})),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:f("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:f("toolbarPresets.sequence")}),a.jsx("input",{type:"text",value:R.sequence,onChange:q=>s(m.id,P=>({...P,actions:P.actions.map(Z=>Z.id===R.id?{...Z,sequence:q.target.value}:Z)})),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:f("toolbarPresets.sequencePlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),a.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:G2.map(q=>a.jsx("button",{type:"button",onClick:()=>s(m.id,P=>({...P,actions:P.actions.map(Z=>Z.id===R.id?{...Z,sequence:q.sequence}:Z)})),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:q.label},q.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:f("toolbarPresets.doubleTap")}),!R.doubleTapSequence&&a.jsx("button",{type:"button",onClick:()=>s(m.id,q=>({...q,actions:q.actions.map(P=>P.id===R.id?{...P,doubleTapSequence:""}:P)})),className:"text-[10px] text-accent hover:text-accent/80",children:f("toolbarPresets.doubleTapAdd")})]}),R.doubleTapSequence!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"text",value:R.doubleTapSequence,onChange:q=>s(m.id,P=>({...P,actions:P.actions.map(Z=>Z.id===R.id?{...Z,doubleTapSequence:q.target.value}:Z)})),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:f("toolbarPresets.doubleTapPlaceholder"),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[G2.map(q=>a.jsx("button",{type:"button",onClick:()=>s(m.id,P=>({...P,actions:P.actions.map(Z=>Z.id===R.id?{...Z,doubleTapSequence:(Z.doubleTapSequence??"")+q.sequence}:Z)})),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:q.label},q.label)),a.jsx("button",{type:"button",onClick:()=>s(m.id,q=>({...q,actions:q.actions.map(P=>{if(P.id!==R.id)return P;const{doubleTapSequence:Z,...V}=P;return V})})),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:f("toolbarPresets.remove")})]})]})]})]})]},R.id)})]})]})]})},VD={installed:"text-[color:var(--success)]",outdated:"text-[color:var(--warning)]","needs-approval":"text-[color:var(--warning)]","not-installed":"text-muted-foreground"};function qD(){const{t:e}=qr(),[t,r]=S.useState(null),[s,o]=S.useState(null),[c,u]=S.useState(null),[f,m]=S.useState(null),[g,b]=S.useState(!1),[x,v]=S.useState(!1),[w,I]=S.useState(""),[k,N]=S.useState(""),[R,Q]=S.useState(null),[F,q]=S.useState([]),[P,Z]=S.useState([]),[V,fe]=S.useState(null),[_e,De]=S.useState(new Set),[be,st]=S.useState(null),[Ue,Ee]=S.useState("auto"),[ht,Ve]=S.useState({}),[he,Oe]=S.useState(null),[ie,Le]=S.useState(null),[Xe,re]=S.useState(10),[ge,Qt]=S.useState(""),[Rt,We]=S.useState(""),[W,Je]=S.useState(12e3),[Se,me]=S.useState(null),[ce,qe]=S.useState(null),ue=S.useCallback(async()=>{const[ee,Te,Ze,Ht]=await Promise.allSettled([w7(),A7(),Nd(),J0()]);if(r(ee.status==="fulfilled"?ee.value:[]),Te.status==="fulfilled"){const $e=Te.value;q($e.plugins??[]),Z($e.errors??[])}else q([]),Z([]);if(Ze.status==="fulfilled"){const $e=Ze.value;De(new Set($e.autoRenameAgents??[])),Ee($e.autoRenameNamer??"auto"),Ve($e.autoRenameModels??{}),re($e.autoRenameIntervalMinutes??10),Qt($e.autoRenamePromptPreference??""),We($e.autoRenamePromptPreference??""),Je($e.autoRenamePromptPayloadChars??12e3)}else De(new Set);Oe(Ht.status==="fulfilled"?Ht.value:[])},[]);S.useEffect(()=>{ue()},[ue]);const Me=async(ee,Te)=>{o(ee),u(null);try{Te==="install"?(await T7(ee)).devMode&&m(ee):(await C7(ee),f===ee&&m(null)),await ue()}catch(Ze){u(Ze instanceof Error?Ze.message:String(Ze))}finally{o(null)}},et=ee=>e(ee==="installed"?"settings.agentHooksInstalled":ee==="outdated"?"settings.agentHooksOutdated":ee==="needs-approval"?"settings.agentHooksNeedsApproval":"settings.agentHooksNotInstalled"),bt=async()=>{Q(null);let ee;try{ee=JSON.parse(k)}catch{Q("Invalid JSON");return}try{await E7(ee),N(""),b(!1),await ue()}catch(Te){if(Te instanceof M7&&Te.migration){Z(Ze=>[{slug:typeof ee.slug=="string"?ee.slug:"manifest.json",errors:Te.message.split(`
133
+ `),code:Te.code,migration:Te.migration},...Ze.filter(Ht=>Ht.slug!==ee.slug)]);return}Q(Te instanceof Error?Te.message:String(Te))}},xe=async()=>{const ee=w.trim();if(ee){me("install"),Q(null);try{await _7(ee),I(""),v(!1),await ue()}catch(Te){Q(Te instanceof Error?Te.message:String(Te))}finally{me(null)}}},de=async ee=>{me(`remove:${ee}`);try{await k7(ee),qe(Te=>Te?.slug===ee?null:Te),await ue()}catch(Te){u(Te instanceof Error?Te.message:String(Te))}finally{me(null)}},Ie=async ee=>{me(`check:${ee}`),u(null);try{await I7(ee),await ue()}catch(Te){u(Te instanceof Error?Te.message:String(Te))}finally{me(null)}},Qe=async ee=>{me(`update:${ee}`),u(null);try{const Te=await L7(ee),Ze=[Te.hookWarning,Te.titleWarning].filter(Boolean).join(" ");Ze&&u(Ze),qe(Ht=>Ht?.slug===ee?null:Ht),await ue()}catch(Te){u(Te instanceof Error?Te.message:String(Te))}finally{me(null)}},Pe=async ee=>{me(`doctor:${ee}`),u(null),qe(null);try{const Te=await S7(ee);qe(Te),Oe(await J0())}catch(Te){u(Te instanceof Error?Te.message:String(Te))}finally{me(null)}},ft=async ee=>{const Te=ee.migration?.aiPrompt??ee.errors.join(`
134
+ `);try{await navigator.clipboard.writeText(Te),fe(ee.slug),window.setTimeout(()=>fe(Ze=>Ze===ee.slug?null:Ze),1800)}catch{Q(Te)}},Mt=async ee=>{if(be)return;const Te=_e,Ze=new Set(Te);Ze.has(ee)?Ze.delete(ee):Ze.add(ee),De(Ze),st(ee),u(null);try{const Ht=await Do({autoRenameAgents:[...Ze]});De(new Set(Ht.autoRenameAgents??[])),Oe(await J0(!0))}catch(Ht){De(Te),u(Ht instanceof Error?Ht.message:String(Ht))}finally{st(null)}},Be=async ee=>{const Te=Ue;Ee(ee),Le("namer"),u(null);try{const Ze=await Do({autoRenameNamer:ee});Ee(Ze.autoRenameNamer??"auto"),Oe(await J0(!0))}catch(Ze){Ee(Te),u(Ze instanceof Error?Ze.message:String(Ze))}finally{Le(null)}},gr=async(ee,Te)=>{const Ze=ht,Ht={...Ze};Te?Ht[ee]=Te:delete Ht[ee],Ve(Ht),Le(ee),u(null);try{const $e=await Do({autoRenameModels:Ht});Ve($e.autoRenameModels??{})}catch($e){Ve(Ze),u($e instanceof Error?$e.message:String($e))}finally{Le(null)}},ct=async ee=>{const Te=Xe;re(ee),Le("interval"),u(null);try{const Ze=await Do({autoRenameIntervalMinutes:ee});re(Ze.autoRenameIntervalMinutes??10)}catch(Ze){re(Te),u(Ze instanceof Error?Ze.message:String(Ze))}finally{Le(null)}},gt=async()=>{const ee=ge.trim();if(ee!==Rt){Le("preference"),u(null);try{const Ze=(await Do({autoRenamePromptPreference:ee})).autoRenamePromptPreference??"";Qt(Ze),We(Ze)}catch(Te){Qt(Rt),u(Te instanceof Error?Te.message:String(Te))}finally{Le(null)}}},vt=async ee=>{const Te=Math.max(1e3,Math.min(64e3,Math.round(ee||12e3))),Ze=W;Je(Te),Le("payload-limit"),u(null);try{const Ht=await Do({autoRenamePromptPayloadChars:Te});Je(Ht.autoRenamePromptPayloadChars??12e3)}catch(Ht){Je(Ze),u(Ht instanceof Error?Ht.message:String(Ht))}finally{Le(null)}},_t=new Set(F.map(ee=>ee.slug)),qt=ce?{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")}[ce.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:Ue,disabled:ie!==null,onChange:ee=>{Be(ee.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")}),he?.filter(ee=>ee.available).map(ee=>a.jsx("option",{value:ee.slug,children:ee.displayName},ee.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:Xe,disabled:ie!==null,onChange:ee=>{ct(Number(ee.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(ee=>a.jsxs("option",{value:ee,children:[ee," ",e("settings.agentAutoRenameMinutes")]},ee))})]}),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:ge,maxLength:2e3,rows:3,disabled:ie!==null,placeholder:e("settings.agentAutoRenamePreferencePlaceholder"),onChange:ee=>Qt(ee.target.value),onBlur:()=>{gt()},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:ie==="preference"?e("settings.saving"):`${ge.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:W,disabled:ie!==null,onChange:ee=>Je(Number(ee.target.value)),onBlur:ee=>{vt(Number(ee.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()=>{Oe(null);try{Oe(await J0(!0))}catch{Oe([])}},className:"rounded p-1 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",title:e("settings.agentAutoRenameRefreshModels"),children:a.jsx(vs,{size:11,className:he===null?"animate-spin":""})})]}),he?.filter(ee=>ee.available).map(ee=>{const Te=ee.models.find(Ze=>Ze.id===ee.recommendedModel);return a.jsxs("label",{className:"flex items-center justify-between gap-3",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:ee.displayName}),a.jsxs("select",{value:ht[ee.slug]??"",disabled:ie!==null,onChange:Ze=>{gr(ee.slug,Ze.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:Te?`${e("settings.agentAutoRenameAutomatic")} · ${Te.displayName}`:e("settings.agentAutoRenameCliDefault")}),ee.models.map(Ze=>a.jsx("option",{value:Ze.id,children:Ze.displayName},Ze.id))]})]},ee.slug)}),he?.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(mn,{size:12,className:"animate-spin"})," …"]}),t?.map(ee=>{const Te=s===ee.slug,Ze=ee.state!=="not-installed",Ht=_t.has(ee.slug);return a.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-surface-2 px-3 py-2.5",children:[a.jsx(Wl,{agent:{slug:ee.slug,displayName:ee.displayName,accentColor:ee.accentColor??"#878580",icon:ee.icon,isPlugin:Ht,iconMode:ee.iconMode,iconVersion:ee.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:ee.displayName}),Ht&&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] ${VD[ee.state]}`,children:[ee.state==="installed"&&a.jsx(j1,{size:10,className:"mr-0.5 inline"}),(ee.state==="outdated"||ee.state==="needs-approval")&&a.jsx(g5,{size:10,className:"mr-0.5 inline"}),et(ee.state)]})]}),a.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",title:ee.targetDisplay,children:[e("settings.agentHooksTarget")," ",ee.targetDisplay]}),f===ee.slug&&a.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksDevMode")}),ee.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:()=>{Mt(ee.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":_e.has(ee.slug),title:e("settings.agentAutoRenameToggle"),children:[a.jsx("span",{children:e("settings.agentAutoRenameShort")}),a.jsx(za,{checked:_e.has(ee.slug),disabled:be!==null,size:"sm"})]}),a.jsxs("button",{type:"button",disabled:Te,onClick:()=>{Me(ee.slug,Ze?"uninstall":"install")},className:`flex shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition ${Ze?"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:[Te?a.jsx(mn,{size:11,className:"animate-spin"}):Ze?a.jsx(Hi,{size:11}):ee.state==="outdated"?a.jsx(vs,{size:11}):a.jsx(Fc,{size:11}),Te?"…":Ze?e("settings.agentHooksUninstall"):ee.state==="outdated"?e("settings.agentHooksReinstall"):e("settings.agentHooksInstall")]})]})]},ee.slug)}),c&&a.jsx("div",{className:"rounded-xl bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[11px] text-[color:var(--warning)]",children:c}),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(!x),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(zi,{size:11}),e("settings.agentPluginAdd")]})]}),a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentPluginHint")}),x&&a.jsxs("div",{className:"mt-2 space-y-2",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{value:w,onChange:ee=>I(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&xe()},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()||Se!==null,onClick:()=>{xe()},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:[Se==="install"?a.jsx(mn,{size:11,className:"animate-spin"}):a.jsx(Fc,{size:11}),e("settings.agentPluginInstallPackage")]})]}),a.jsx("button",{type:"button",onClick:()=>b(!g),className:"text-[10px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentPluginAdvancedManifest")})]}),F.map(ee=>{const Te=ee.revision?.slice(0,8),Ze=Se?.endsWith(`:${ee.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:ee.displayName}),ee.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:ee.source??void 0,children:[ee.source??e("settings.agentPluginManualSource"),Te?` · ${Te}`:""]})]}),a.jsxs("button",{type:"button",disabled:Se!==null,onClick:()=>{Pe(ee.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:[Se===`doctor:${ee.slug}`?a.jsx(mn,{size:10,className:"animate-spin"}):a.jsx(K8,{size:10}),e("settings.agentPluginDoctor")]}),ee.updateSupported&&a.jsxs("button",{type:"button",disabled:Se!==null,onClick:()=>{ee.updateAvailable?Qe(ee.slug):Ie(ee.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:[Ze?a.jsx(mn,{size:10,className:"animate-spin"}):a.jsx(vs,{size:10}),ee.updateAvailable?e("settings.agentPluginUpdate"):e("settings.agentPluginCheck")]}),a.jsx("button",{type:"button",disabled:Se!==null,onClick:()=>{de(ee.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(Hi,{size:11})})]},ee.slug)}),ce&&a.jsxs("div",{className:`mt-2 rounded-lg px-3 py-2 text-[10px] ${ce.status==="ok"||ce.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:[ce.displayName,": ",qt]}),a.jsx("div",{className:"mt-1 text-muted-foreground",children:ce.models.length>0?`${ce.models.length} ${e("settings.agentPluginDoctorModels")}${ce.recommendedModel?` · ${e("settings.agentPluginDoctorAutomatic")} ${ce.recommendedModel}`:""}`:e("settings.agentPluginDoctorCliDefault")}),ce.error&&a.jsx("div",{className:"mt-1 break-words",children:ce.error}),ce.warnings.length>0&&a.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:ce.warnings.map(ee=>a.jsxs("div",{children:["• ",ee]},ee))}),ce.nextSteps.length>0&&a.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:ce.nextSteps.map(ee=>a.jsxs("div",{children:["→ ",ee]},ee))})]}),P.map(ee=>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:[ee.slug,": ",ee.code??e("settings.agentPluginInvalid")]}),a.jsxs("button",{type:"button",onClick:()=>{ft(ee)},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:[V===ee.slug?a.jsx(j1,{size:10}):a.jsx(b5,{size:10}),V===ee.slug?e("settings.agentPluginCopied"):e("settings.agentPluginCopyAiPrompt")]})]}),a.jsx("div",{className:"mt-1 whitespace-pre-wrap break-words text-muted-foreground",children:ee.errors.join(`
135
+ `)}),ee.migration?.guideCommand&&a.jsx("code",{className:"mt-1 block select-all text-foreground",children:ee.migration.guideCommand})]},ee.slug)),x&&g&&a.jsxs("div",{className:"mt-2 space-y-2",children:[a.jsx("textarea",{value:k,onChange:ee=>N(ee.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:`{
136
+ "version": 2,
137
+ "slug": "my-agent",
138
+ "displayName": "My Agent",
139
+ "aliases": ["my-agent"],
140
+ "accentColor": "#4385BE",
141
+ "statuses": [
142
+ { "id": "thinking", "phase": "working", "label": "Thinking", "indicator": "spinner", "tone": "info" },
143
+ { "id": "approval", "phase": "waiting", "label": "Needs approval", "indicator": "question", "tone": "warning" },
144
+ { "id": "complete", "phase": "done", "label": "Complete", "indicator": "badge", "tone": "success" }
145
+ ],
146
+ "hooks": {
147
+ "target": "~/.my-agent/settings.json",
148
+ "events": [
149
+ { "hook": "UserPromptSubmit", "event": "prompt-submit", "status": "thinking" },
150
+ { "hook": "PermissionRequest", "event": "permission-request", "status": "approval" },
151
+ { "hook": "Stop", "event": "stop", "status": "complete" }
152
+ ]
153
+ }
154
+ }`}),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:()=>{bt()},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(Xv,{size:11}),e("settings.agentPluginCreate")]}),a.jsx("button",{type:"button",onClick:()=>{b(!1),N(""),Q(null)},className:"rounded-full px-3 py-1 text-[11px] text-muted-foreground hover:text-foreground transition",children:e("common.cancel")})]})]})]})]})}function ZD({state:e,pending:t,onCheck:r,onConfirmRestart:s,desktopState:o,desktopPending:c=!1,onCheckDesktop:u,onInstallDesktop:f}){const{t:m}=qr(),g=e?.status??"idle",b=t||g==="checking"||g==="installing"||g==="restarting",x=g==="ready"&&!!e?.latestVersion,v=g==="checking"?m("settings.updateChecking"):g==="installing"?m("sidebar.updateInstalling"):g==="ready"?m("sidebar.updateReady"):g==="restarting"?m("sidebar.updateRestarting"):g==="current"?m("settings.updateCurrent"):g==="error"?e?.error||m("sidebar.updateFailed"):m("settings.updateHint"),w=o?.status??"idle",I=c||w==="checking"||w==="downloading"||w==="installing",k=w==="ready",N=w==="unsupported"?m("settings.desktopUpdateUnsupported"):w==="checking"?m("settings.desktopUpdateChecking"):w==="current"?m("settings.desktopUpdateCurrent"):w==="downloading"?m("settings.desktopUpdateDownloading"):w==="ready"?m("settings.desktopUpdateReady"):w==="installing"?m("settings.desktopUpdateInstalling"):w==="error"&&o?.error||m("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:m("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 ${x?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:a.jsx(vs,{size:15,className:b?"animate-spin":""})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:m("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:x&&e.latestVersion?`${e.currentVersion} → ${e.latestVersion}`:`v${e.currentVersion}`})]})]}),x?a.jsx("button",{type:"button",disabled:b,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:m("sidebar.updateRestart")}):a.jsx("button",{type:"button",disabled:b,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:m(g==="checking"?"settings.updateCheckingShort":g==="installing"?"settings.updateInstallingShort":g==="error"?"sidebar.updateRetry":g==="current"?"settings.updateCheckAgain":"settings.updateCheck")})]}),o&&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(vs,{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:m("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&&o.latestVersion?`${o.currentVersion} → ${o.latestVersion}`:`v${o.currentVersion}`})]})]}),k?a.jsx("button",{type:"button",disabled:I||!f,onClick:f,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:m("settings.desktopUpdateRestart")}):a.jsx("button",{type:"button",disabled:I||w==="unsupported"||!u,onClick:u,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:m(w==="checking"?"settings.updateCheckingShort":w==="current"||w==="error"?"settings.desktopUpdateCheckAgain":"settings.desktopUpdateCheck")})]})]})}const YD=()=>()=>{},KD=()=>1/0;function XD(){const{t:e}=qr(),t=T.useId(),r=Ia(),s=T.useSyncExternalStore(r?.subscribe??YD,r?.retentionLimit??KD);if(!r)return null;const o=R7+1,c=s===1/0?e("settings.workspaceUnlimited"):String(s);return a.jsxs("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("label",{htmlFor:t,className:"shrink-0 text-[12px] font-medium text-foreground/90",children:e("settings.workspaceLimit")}),a.jsx("input",{id:t,type:"range",min:3,max:o,step:1,value:s===1/0?o:s,"aria-valuetext":c,"aria-describedby":`${t}-hint`,onChange:u=>{const f=Number(u.target.value);r.setRetentionLimit(f===o?1/0:f)},className:"h-8 min-w-0 flex-1"}),a.jsx("output",{htmlFor:t,className:"min-w-12 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground",children:c})]}),a.jsx("p",{id:`${t}-hint`,className:"text-[11px] leading-relaxed text-muted-foreground",children:e("settings.workspaceLimitHint")})]})}const ap="mobile-session-destroy";function JD(e,t){return t&&e.type==="session"&&e.destination?.droppableId===ap}const eo="termdock-program-rules-cache",qu="termdock-toolbar-presets-cache",Sc="termdock-settings-cache",W2="termdock-color-theme",V2="termdock:right-sidebar:file-preview-open-by-session:v2",Lc="termdock:running-session-button-enabled:v1",eQ=60,q2=320,Z2=420,Xo=8;function Y2(e,t,r){return Math.min(Math.max(e,t),r)}function K2(e){if(typeof window>"u")return{left:Xo,top:Xo};const t=window.innerWidth/2,r=Math.min(64,window.innerHeight/4),s=e?.x??t,o=e?.y??r,c=Math.max(Xo,window.innerWidth-q2-Xo),u=Math.max(Xo,window.innerHeight-Z2-Xo);return{left:Y2(s+Xo,Xo,c),top:Y2(o+Xo,Xo,u),width:q2,maxHeight:`min(${Z2}px, calc(100vh - ${Xo*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 wf(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=Gc(),s=new Set(p_()),o=Array.isArray(e)?e:[],c=L0(o),u=t<Nc;if(c.length===0)return r;if(u){const m=new Map(c.map(v=>[v.id,v])),g=new Map(o.map(v=>[typeof v.id=="string"?v.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):"",v])),b=c.filter(v=>!s.has(v.id));return[...r.map(v=>{const w=m.get(v.id),I=g.get(v.id);return w?{...v,rowLayout:w.rowLayout,showOnDesktop:typeof I?.showOnDesktop=="boolean"?I.showOnDesktop:v.showOnDesktop}:v}),...b]}const f=new Set(c.map(m=>m.id));return[...c,...r.filter(m=>!f.has(m.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:[]},Vd="__termdockOverlay",qd="__termdockBaseAnchor",Zd="__termdockBaseGuard",lQ=3,X2=250,cQ="termdock-notification-target-v1",J2="/__termdock-notification-target",e5=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 w0(e){if(!e||typeof e!="object")return null;const t=e[Vd];return uQ(t)?t:null}function Zp(e){return e&&typeof e=="object"?{...e}:{}}function a6(e){const t=Zp(e);return delete t[Vd],t}function dQ(e){const t=a6(e);return delete t[Zd],{...t,[qd]:!0}}function hQ(){typeof window>"u"||window.history.pushState({...a6(window.history.state),[qd]:!0,[Zd]:!0},"",window.location.href)}function l6(){for(let e=0;e<lQ;e+=1)hQ()}function Zu(){typeof window>"u"||(window.history.replaceState(dQ(window.history.state),"",window.location.href),l6())}function Ic(e){typeof window>"u"||window.history.pushState({...Zp(window.history.state),[qd]:!0,[Vd]:e,[Zd]:!1},"",window.location.href)}function fQ(e){typeof window>"u"||window.history.replaceState({...Zp(window.history.state),[qd]:!0,[Vd]:e,[Zd]:!1},"",window.location.href)}const c6=["bash","zsh","fish","sh","dash","ksh","tcsh","csh","nu"];let to=new Set(c6);function t5(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 o=e.get(r);if(!o||o.cwd!==s.cwd||o.activeProgram!==s.activeProgram||o.activeProgramRaw!==s.activeProgramRaw||o.inCopyMode!==s.inCopyMode||o.isConnecting!==s.isConnecting||o.agentStatus!==s.agentStatus||o.agentIndicator!==s.agentIndicator||o.agentStatusDetail!==s.agentStatusDetail||o.agent!==s.agent||o.agentMessage!==s.agentMessage||o.agentNativeSessionId!==s.agentNativeSessionId||o.agentResumeRecovered!==s.agentResumeRecovered||o.terminalSessionId!==s.terminalSessionId||o.agentNeedsReview!==s.agentNeedsReview||o.gitStatus!==s.gitStatus||o.shellTitle!==s.shellTitle||o.promptState!==s.promptState||o.tuiProgress?.state!==s.tuiProgress?.state||o.tuiProgress?.progress!==s.tuiProgress?.progress)return!1}return!0}function r5(e,t){return a.jsx(ON,{sessionMode:e,state:t})}function mQ(e,t){const r=new Map(e.map(u=>[u.id,u])),s=t.map(u=>r.get(u)).filter(u=>u!==void 0),o=new Set(t),c=e.filter(u=>!o.has(u.id));return[...s,...c]}function gQ(){const{t:e,locale:t,setLocale:r}=qr(),s="env(safe-area-inset-top, 0px)",o="env(safe-area-inset-bottom, 0px)";N7();const c=S.useMemo(()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,[]),[u,f]=S.useState(!1),[m,g]=S.useState(()=>c0(W2,tQ)??"dark"),b=S.useRef(c0(Sc,oQ)).current,[x,v]=S.useState(b?.preventSleep??!1),[w,I]=S.useState(b?.networkAvailable??!0),[k,N]=S.useState(D7),[R,Q]=S.useState(Q7),[F,q]=S.useState(B7),[P,Z]=S.useState(j7),[V,fe]=S.useState(gh),[_e,De]=S.useState(b?.localAccess??aQ),[be,st]=S.useState(b?.localAccess?.name??""),[Ue,Ee]=S.useState(!1),[ht,Ve]=S.useState(null),[he,Oe]=S.useState(null),[ie,Le]=S.useState(null),[Xe,re]=S.useState(!1),ge=S.useMemo(()=>ea(),[]),Qt=!!(ge?.desktopUpdateState&&ge.checkDesktopUpdate&&ge.installDesktopUpdate),[Rt,We]=S.useState(null),[W,Je]=S.useState(null),[Se,me]=S.useState(!1),[ce,qe]=S.useState(null),[ue,Me]=S.useState(!1),[et,bt]=S.useState(()=>wf(c0(V2,rQ)??{})),[xe,de]=S.useState(0),[Ie,Qe]=S.useState(!1),[Pe,ft]=S.useState(0),[Mt,Be]=S.useState(!1),[gr,ct]=S.useState(0),[gt,vt]=S.useState(!1),[_t,qt]=S.useState(0),ee=S.useRef(null),[Te,Ze]=S.useState({}),{terminalSettings:Ht,updateTerminalSettings:$e}=ZM(),Nt=Ht.fontSize,lr=Ht.rendererMode,[ye,Bn]=S.useState(!1),Lr=S.useRef(P7()).current,[ve,$r]=T.useState(()=>Lr.sessions.map(C=>({id:C.sessionId,name:C.name,customName:C.customName,mode:C.mode,tmuxSessionName:C.tmuxSessionName}))),[kt,un]=S.useState(Lr.activeSessionId),[Ir,kn]=S.useState(!1);S.useEffect(()=>{Ir&&O7({rendered:!0})},[Ir]);const[se,rt]=S.useState(null),[Bt,wr]=S.useState(null),[jt,ne]=S.useState([]),[Pt,mt]=T.useState(()=>{const C=Ur.getState();return Lr.sessions.forEach(D=>{D.backendSessionId&&C.setTerminalSession(D.sessionId,{sessionId:D.backendSessionId,cols:80,rows:24,mode:D.mode,tmuxSessionName:D.tmuxSessionName}),D.activeProgram!=null&&C.setSessionActiveProgram(D.sessionId,D.activeProgram),D.cwd!=null&&C.setSessionCwd(D.sessionId,D.cwd)}),I0("session-chrome-hydrated"),t5(Ur.getState().sessions)});T.useEffect(()=>{!ge||!ye||Promise.all([ge.snapshot(),ge.desktopUpdateState?.()??Promise.resolve(null)]).then(([C,D])=>{We(C),Je(D)}).catch(C=>qe(C instanceof Error?C.message:String(C)))},[ge,ye]),T.useEffect(()=>{ge?.onDesktopUpdateState&&ge.onDesktopUpdateState(Je)},[ge]),T.useEffect(()=>Ur.subscribe(C=>{const D=t5(C.sessions);mt(X=>pQ(X,D)?X:D)}),[]);const Br=T.useCallback(async(C,D)=>{wr(null),rt({sessionId:C,status:"submitting",error:null});try{await F7(D),rt(X=>X?.sessionId===C?{...X,status:"waiting",error:null}:X)}catch(X){const dt=(X&&typeof X=="object"&&"code"in X?String(X.code??""):"")==="AGENT_SESSION_ACTIVE_ELSEWHERE"?e("tab.resumeAgentConflict"):X instanceof Error&&/busy/i.test(X.message)?e("tab.resumeAgentBusy"):e("tab.resumeAgentFailed");rt(Dt=>Dt?.sessionId===C?{...Dt,error:dt}:Dt),wr({tone:"error",message:dt})}},[e]);T.useEffect(()=>{if(!se||se.status!=="waiting")return;const C=Pt.get(se.sessionId);if(!C||C.agentResumeRecovered||C.agentStatus===null&&!C.agent)return;const D=C.agent?.displayName??"Agent";rt(null),wr({tone:"success",message:e("tab.resumeAgentSuccess",{agent:D})})},[se,Pt,e]),T.useEffect(()=>{if(!se||se.status!=="waiting"||se.error)return;const C=se.sessionId,D=window.setTimeout(()=>{const X=e("tab.resumeAgentTimeout");rt(Re=>Re?.sessionId===C&&Re.status==="waiting"?{...Re,error:X}:Re),wr({tone:"error",message:X})},15e3);return()=>window.clearTimeout(D)},[se,e]),T.useEffect(()=>{if(Bt?.tone!=="success")return;const C=window.setTimeout(()=>wr(null),3200);return()=>window.clearTimeout(C)},[Bt]),T.useEffect(()=>{let C=!1;U7().then(X=>{C||Le(X)}).catch(()=>{});const D=D1(X=>{X.type==="update-state"&&!C&&Le(X.state)});return()=>{C=!0,D()}},[]);const or=T.useCallback(async()=>{const C=ie?.latestVersion;if(!(!C||Xe)&&window.confirm(e("sidebar.updateRestartConfirm",{version:C}))){re(!0);try{Le(await $7())}catch(D){window.alert(D instanceof Error?D.message:String(D))}finally{re(!1)}}},[ie?.latestVersion,e,Xe]),ws=T.useCallback(async()=>{if(!Xe){re(!0);try{Le(await z7())}catch(C){window.alert(C instanceof Error?C.message:String(C))}finally{re(!1)}}},[Xe]),ts=T.useCallback(async()=>{if(!(!ge?.checkDesktopUpdate||Se)){me(!0);try{Je(await ge.checkDesktopUpdate())}catch(C){qe(C instanceof Error?C.message:String(C))}finally{me(!1)}}},[ge,Se]),gn=T.useCallback(async()=>{if(!(!ge?.installDesktopUpdate||Se||W?.status!=="ready")&&window.confirm(e("settings.desktopUpdateRestartConfirm"))){me(!0);try{Je(await ge.installDesktopUpdate())}catch(C){qe(C instanceof Error?C.message:String(C)),me(!1)}}},[ge,Se,W?.status,e]);T.useEffect(()=>{document.documentElement.dataset.theme=m,H7(m),Jn(W2,m)},[m]),T.useEffect(()=>{Jn(V2,wf(et))},[et]);const Tr=Ft(C=>C.leftOpen),en=Ft(C=>C.rightOpen),qn=Ft(C=>C.leftPinned),Cn=Ft(C=>C.leftSidebarWidth),As=Ft(C=>C.rightPinned),rs=Ft(C=>C.rightSidebarWidth),tn=Ft(C=>C.rootPath),jn=Ft(C=>C.contextKey),Vr=Ft(C=>C.selectedFilePath),Rr=Ft(C=>C.groupByFolder),Pn=cd(C=>C.collaborationGroups),sn=Ft(C=>C.collapsedGroups),Zn=Ft(C=>C.toggleGroupCollapsed),[zt,On]=T.useState(()=>typeof window>"u"?!0:window.matchMedia("(min-width: 1024px)").matches),[zr,Fn]=T.useState(()=>typeof window>"u"?1024:window.innerWidth),[Ts,as]=T.useState(()=>typeof window>"u"?!1:window.matchMedia("(orientation: landscape)").matches),[_n,Cr]=T.useState([]),[jr,Yn]=T.useState({available:!0,version:null,reason:null}),[xn,ds]=T.useState(!1),[li,_r]=T.useState(null),[Un,Ot]=T.useState(null),[qs,rn]=T.useState(null),[Kn,Kr]=T.useState(null),[Xn,bn]=T.useState(null),[xr,$]=T.useState(null),[le,Ge]=T.useState(null),[Ce,He]=T.useState(null),[tt,nt]=T.useState(null),[it,Fe]=T.useState(null),[at,Kt]=T.useState(!1),[lt,br]=T.useState(()=>c0(Lc,C=>typeof C=="boolean")??!1),ut=T.useCallback(async C=>{const D=lt;br(C),Jn(Lc,C);try{const X=await Do({runningSessionButtonEnabled:C});br(X.runningSessionButtonEnabled),Jn(Lc,X.runningSessionButtonEnabled)}catch{br(D),Jn(Lc,D)}},[lt]),[hr,ar]=T.useState(null),St=T.useCallback(C=>{ar(C)},[]),sr=T.useRef(!1),[kr,yn]=T.useState(null),[Zs,ls]=T.useState(null),Fs=S.useRef(null),Er=S.useRef(!1),Xr=S.useRef(null),hs=S.useRef(!1),O=T.useCallback(()=>{$(null),Ge(null)},[]),K=S.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("session")),[oe,Ne]=S.useState(K.current),[Tt,Lt]=S.useState(!0),Yt=S.useRef(K.current),pt=S.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)"),D=()=>{On(C.matches),Fn(window.innerWidth)};return D(),C.addEventListener("change",D),window.addEventListener("resize",D),()=>{C.removeEventListener("change",D),window.removeEventListener("resize",D)}},[]),T.useEffect(()=>{if(typeof window>"u")return;const C=window.matchMedia("(orientation: landscape)"),D=()=>as(C.matches);return D(),C.addEventListener("change",D),()=>C.removeEventListener("change",D)},[]);const It=S.useMemo(()=>kt?jt.find(C=>C.sessionIds.includes(kt))??null:null,[kt,jt]),Hr=It?.id??null,yr=It?.sessionIds[0]??kt,Gr=S.useRef([]);S.useLayoutEffect(()=>{const C=Gr.current;if(Gr.current=jt,C.length===0)return;const D=new Set(jt.flatMap(X=>X.sessionIds));for(const X of C){const Re=X.sessionIds.filter(dt=>!D.has(dt)).map(dt=>({sessionId:dt,rootPath:Ur.getState().sessions.get(dt)?.cwd??null}));Re.length>0&&Ft.getState().inheritRightSidebarStateFromSplitWorkspace(X.id,Re)}},[jt]),S.useLayoutEffect(()=>((()=>{const D=yr?Ur.getState().sessions.get(yr)?.cwd??null:null;Ft.getState().setRootPath(D,yr,Hr)})(),Ur.subscribe((D,X)=>{const Re=yr?D.sessions.get(yr)?.cwd??null:null,dt=yr?X.sessions.get(yr)?.cwd??null:null;Re!==dt&&Ft.getState().setRootPath(Re,yr,Hr)})),[Hr,yr]);const Wr=zt||Ts,on=zr*.95,Sn=Wr?Math.min(Math.max(zr*.22,280),340):Math.min(zr*.86,380),dn=kt&&tn?`${kt}\0${tn}`:"",ur=!!(dn&&Vr&&et[dn]),Wt=T.useCallback(C=>{dn&&(C&&!Ft.getState().selectedFilePath||bt(D=>{if(!!D[dn]===C)return D;if(C)return wf({...D,[dn]:{updatedAt:Date.now()}});const Re={...D};return delete Re[dn],Re}))},[dn]);T.useEffect(()=>{tR(dn,jn,Vr)&&bt(C=>{if(!C[dn])return C;const D={...C};return delete D[dn],D})},[dn,jn,Vr]);const Xt=gt?"markdown-image-lightbox":Mt?"markdown-outline":Ie?"right-sidebar-repo-picker":en&&ur?"right-sidebar-file-preview":ye?"settings":en&&!(As&&zt)?"right-sidebar":Tr&&!(qn&&zt)?"left-sidebar":null,Ut=S.useRef(Xt),Mr=S.useRef(Xt),Pr=S.useRef(!1),ns=S.useRef(!1),En=T.useCallback(()=>{if(typeof window>"u")return;const C=window.matchMedia("(hover: hover) and (pointer: fine)").matches;!zt||!C||navigator.maxTouchPoints>0||window.setTimeout(()=>{window.dispatchEvent(new CustomEvent("focus-active-terminal-session"))},0)},[zt]),fs=T.useCallback(C=>{if(C==="markdown-image-lightbox"){vt(!1),qt(D=>D+1);return}if(C==="markdown-outline"){Be(!1),ct(D=>D+1);return}if(C==="right-sidebar-file-preview"){Be(!1),ct(D=>D+1),Wt(!1),de(D=>D+1);return}if(C==="right-sidebar-repo-picker"){Qe(!1),ft(D=>D+1);return}if(C==="settings"){Bn(!1),an(!1),J(!1),Is(!1);return}if(C==="left-sidebar"){Ft.getState().closeLeft();return}Be(!1),ct(D=>D+1),Qe(!1),ft(D=>D+1),vt(!1),qt(D=>D+1),Ft.getState().closeRight()},[Wt]),Or=T.useCallback(C=>{if(!c&&typeof window<"u"&&Ut.current===C&&w0(window.history.state)===C){window.history.back();return}fs(C)},[fs,c]),Gi=T.useCallback(()=>{Bn(!1);const C=Ft.getState();C.closeRight(),C.openLeft()},[]),Us=T.useCallback(()=>{Bn(!1);const C=Ft.getState();C.closeLeft(),C.openRight()},[]),Ea=T.useCallback(()=>{Bn(!1);const C=Ft.getState();C.closeLeft(),C.openRight(),C.setRightTab("files"),C.openRightSearch()},[]),go=T.useCallback(()=>{const C=Ft.getState();if(C.leftPinned){C.setLeftPinned(!1),C.closeLeft();return}if(Tr){Or("left-sidebar");return}Gi()},[Gi,Or,Tr]),sa=T.useCallback(()=>{const C=Ft.getState();C.leftPinned?(C.setLeftPinned(!1),C.openLeft()):(C.setLeftPinned(!0),C.openLeft())},[]),Za=T.useCallback(()=>{const C=Ft.getState();C.setLeftPinned(!1),C.closeLeft()},[]),Fo=T.useCallback(()=>{const C=Ft.getState();C.rightPinned?(C.setRightPinned(!1),C.openRight()):(C.setRightPinned(!0),C.openRight())},[]),Uo=T.useCallback(()=>{const C=Ft.getState();C.setRightPinned(!1),C.closeRight()},[]),ro=T.useRef(0),ia=T.useRef(0),Wi=T.useRef(null),oa=T.useCallback(C=>{C.preventDefault(),ro.current=C.clientX,ia.current=Ft.getState().leftSidebarWidth;const D=Re=>{Wi.current===null&&(Wi.current=requestAnimationFrame(()=>{Wi.current=null;const dt=Re.clientX-ro.current;Ft.getState().setLeftSidebarWidth(ia.current+dt)}))},X=()=>{window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",X),Wi.current!==null&&(cancelAnimationFrame(Wi.current),Wi.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",D),window.addEventListener("mouseup",X)},[]),Rs=T.useRef(0),ci=T.useRef(0),ss=T.useRef(null),Ya=T.useCallback(C=>{C.preventDefault(),Rs.current=C.clientX;const D=Ft.getState(),X=D.leftPinned?D.leftSidebarWidth:0;ci.current=Yu(D.rightSidebarWidth,window.innerWidth,X);const Re=Dt=>{ss.current===null&&(ss.current=requestAnimationFrame(()=>{ss.current=null;const pr=Rs.current-Dt.clientX,cn=Ft.getState(),wn=cn.leftPinned?cn.leftSidebarWidth:0;cn.setRightSidebarWidth(Yu(ci.current+pr,window.innerWidth,wn))}))},dt=()=>{window.removeEventListener("mousemove",Re),window.removeEventListener("mouseup",dt),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",Re),window.addEventListener("mouseup",dt)},[]),Cs=T.useCallback(()=>{const C=Ft.getState();if(C.rightPinned){C.setRightPinned(!1),C.closeRight();return}if(en){Or("right-sidebar");return}Us()},[Us,Or,en]),aa=T.useCallback(()=>{!ur&&!c&&typeof window<"u"&&Ut.current==="right-sidebar"&&w0(window.history.state)==="right-sidebar"&&(Ic("right-sidebar-file-preview"),Mr.current="right-sidebar-file-preview"),Wt(!0)},[ur,c,Wt]),Ma=T.useCallback(()=>{Or("right-sidebar-file-preview")},[Or]),Vi=T.useCallback(()=>{!Ie&&!c&&typeof window<"u"&&Ut.current==="right-sidebar"&&w0(window.history.state)==="right-sidebar"&&(Ic("right-sidebar-repo-picker"),Mr.current="right-sidebar-repo-picker"),Qe(!0)},[Ie,c]),xo=T.useCallback(()=>{Or("right-sidebar-repo-picker")},[Or]),$o=T.useCallback(()=>{!Mt&&!c&&typeof window<"u"&&Ut.current&&w0(window.history.state)===Ut.current&&(Ic("markdown-outline"),Mr.current="markdown-outline"),Be(!0)},[Mt,c]),la=T.useCallback(()=>{Or("markdown-outline")},[Or]),Ra=T.useCallback(()=>{!c&&typeof window<"u"&&Ut.current&&w0(window.history.state)===Ut.current&&(Ic("markdown-image-lightbox"),Mr.current="markdown-image-lightbox"),vt(!0)},[c]),Na=T.useCallback(()=>{Or("markdown-image-lightbox")},[Or]),zo=T.useCallback(()=>{!c&&typeof window<"u"&&Ut.current&&w0(window.history.state)===Ut.current&&(fQ("settings"),Mr.current="settings"),Ft.getState().closeAll(),Bn(!0)},[c]),_s=T.useCallback(()=>{Or("settings")},[Or]);T.useEffect(()=>{if(!ge)return;const C=()=>zo();return window.addEventListener("termdock:open-settings",C),()=>window.removeEventListener("termdock:open-settings",C)},[ge,zo]);const no=T.useCallback(()=>{Me(!0),ee.current!==null&&(window.clearTimeout(ee.current),ee.current=null)},[]),ca=T.useCallback(()=>{ee.current!==null&&(window.clearTimeout(ee.current),ee.current=null),Me(!1),ns.current=!0,Zu(),ns.current},[]);T.useEffect(()=>()=>{ee.current!==null&&window.clearTimeout(ee.current)},[]),T.useEffect(()=>{c||Zu()},[c]),T.useEffect(()=>{if(typeof window>"u"||c)return;let C=null;const D=()=>{C!==null&&(window.clearTimeout(C),C=null)},X=cn=>{if(Ut.current,ns.current,Ut.current){Ut.current;return}!cn?.force&&ns.current||(cn?.userActivated&&(ns.current=!0),Zu(),ns.current,void 0)},Re=()=>{D(),C=window.setTimeout(()=>{C=null,X({force:!0})},X2)},dt=()=>{X({userActivated:!0})},Dt=()=>{Re()},pr=()=>{document.visibilityState==="visible"&&Re()};return window.addEventListener("pointerdown",dt,{capture:!0,passive:!0}),window.addEventListener("touchstart",dt,{capture:!0,passive:!0}),window.addEventListener("keydown",dt,{capture:!0}),window.addEventListener("pageshow",Dt),document.addEventListener("visibilitychange",pr),()=>{D(),window.removeEventListener("pointerdown",dt,{capture:!0}),window.removeEventListener("touchstart",dt,{capture:!0}),window.removeEventListener("keydown",dt,{capture:!0}),window.removeEventListener("pageshow",Dt),document.removeEventListener("visibilitychange",pr)}},[c]),T.useEffect(()=>{Ut.current=Xt},[Xt]),T.useEffect(()=>{if(typeof window>"u"||Xt||c)return;const C=window.setTimeout(()=>{Ut.current?(Ut.current,void 0):Zu()},X2);return()=>window.clearTimeout(C)},[Xt,c]),T.useEffect(()=>{if(typeof window>"u"||c)return;const C=Mr.current;Pr.current,Xt&&Xt!==C&&!Pr.current&&Ic(Xt),!Xt&&C&&En(),Mr.current=Xt,!Xt&&Pr.current&&window.setTimeout(()=>{Pr.current=!1},0)},[Xt,c,En]),T.useEffect(()=>{if(typeof window>"u"||c)return;const C=()=>{const D=Ut.current;if(ns.current,!D){ns.current=!1,ns.current,no(),l6();return}Pr.current=!0,fs(D)};return window.addEventListener("popstate",C),()=>window.removeEventListener("popstate",C)},[fs,no,c]),T.useEffect(()=>{const C=D=>{const X=D.metaKey||D.ctrlKey;if(X&&D.key==="b"&&!D.shiftKey&&(D.preventDefault(),go()),X&&D.shiftKey&&D.key==="E"&&(D.preventDefault(),Cs()),X&&D.shiftKey&&D.key==="P"&&(D.preventDefault(),Ea()),X&&!D.shiftKey&&D.altKey&&(D.key==="ArrowLeft"||D.key==="ArrowRight")){D.preventDefault();const Re=D.key==="ArrowRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:Re}}));return}if(X&&D.shiftKey&&!D.altKey&&(D.code==="BracketLeft"||D.code==="BracketRight")){D.preventDefault();const Re=D.code==="BracketRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:Re}}));return}};return document.addEventListener("keydown",C),()=>{document.removeEventListener("keydown",C)}},[go,Cs,Ea]);const vi=T.useCallback(async()=>{Ee(!0),Ve(null);try{const C=await Do({localAccess:{name:be}});De(C.localAccess),st(C.localAccess.name),Jn(Sc,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}catch(C){Ve(C instanceof Error?C.message:"Failed to save local access name")}finally{Ee(!1)}},[be]),Ka=T.useCallback(async()=>{Ee(!0),Ve(null);try{const C=await Do({localAccess:{reset:!0}});De(C.localAccess),st(C.localAccess.name),Jn(Sc,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}catch(C){Ve(C instanceof Error?C.message:"Failed to reset local access name")}finally{Ee(!1)}},[]),$n=T.useCallback(async(C,D="url")=>{if(C)try{if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(C);else{const X=document.createElement("textarea");X.value=C,X.style.position="fixed",X.style.left="-9999px",document.body.appendChild(X),X.focus(),X.select(),document.execCommand("copy"),document.body.removeChild(X)}Oe(D),window.setTimeout(()=>Oe(X=>X===D?null:X),1600)}catch{Oe(null)}},[]),$s=T.useCallback(C=>{const D=mQ(ve,C);D.map(X=>X.id).join("\0")!==ve.map(X=>X.id).join("\0")&&($r(D),window.dispatchEvent(new CustomEvent("reorder-terminal-session",{detail:{sessionIds:D.map(X=>X.id)}})))},[ve]),bo=T.useCallback(C=>{zt||C.type!=="session"||(sr.current=!1,Kt(!1),Fe(C.draggableId))},[zt]),ua=T.useCallback(C=>{if(zt||C.type!=="session")return;const D=C.destination?.droppableId===ap;D!==sr.current&&(sr.current=D,Kt(D),D&&navigator.vibrate?.(20))},[zt]),da=T.useCallback(C=>{const D=JD(C,!zt);if(sr.current=!1,Kt(!1),Fe(null),!D)return!1;const X=ve.find(dt=>dt.id===C.draggableId),Re=X?Pt.get(X.id):null;return X&&n2({mode:X.mode,activeProgram:Re?.activeProgram??null,promptState:Re?.promptState??null,shellNames:to})?(ls(null),yn(X.id),rn(null)):X&&window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:{sessionId:X.id,source:"other",closeMode:X.mode==="tmux"?"destroy":"auto"}})),!0},[zt,ve,Pt]),{groups:so,arranged:Ys}=S.useMemo(()=>ad(ve,C=>Pt.get(C.id)?.cwd??null,Rr,e("sidebar.ungrouped"),jt,Pn),[ve,Pt,Rr,e,jt,Pn]),Al=T.useCallback(C=>{da(C)||!C.destination||C.source.index===C.destination.index||window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:Ys[C.source.index]?.id,targetId:Ys[C.destination.index]?.id}}))},[da,Ys]),Ss=T.useCallback((C,D)=>{const X=D.trim();X&&window.dispatchEvent(new CustomEvent("rename-terminal-session",{detail:{sessionId:C,name:X}}))},[]),zn=T.useCallback(C=>{window.dispatchEvent(new CustomEvent("reset-terminal-session-name",{detail:{sessionId:C}}))},[]),{newSessionMode:vn,newSessionTmuxName:wi,userSelectedNewSessionMode:zs,setNewSessionMode:ha}=XM(),[qi,Ii]=T.useState(null),[ki,an]=S.useState(!1),[Zi,J]=S.useState(!1),[je,ot]=S.useState("idle"),At=S.useRef(c0(qu,sQ)).current,[Ae,xt]=S.useState(()=>{const C=At?.presets;if(C&&C.length>0){const D=L0(C);if(D.length>0)return D}return Gc()}),[cr,Fr]=S.useState(!1),[nn,Ar]=S.useState("default"),Hn=S.useRef(typeof At?.updatedAt=="number"?At.updatedAt:null),Mn=S.useRef(!1),[Ls,Is]=S.useState(!1),[io,Hs]=S.useState(!1),Da=S.useRef(c0(eo,nQ)).current,[Ln,ui]=S.useState(Da??[]),[Xa,Jl]=S.useState(Da!==null),[e0,L]=S.useState(!1),B=!Xt&&!Zi&&!ki&&!Ls&&!io&&!xr&&!kr&&!qi,j=S.useCallback(C=>{const D=typeof C.version=="number"?C.version:0,X=iQ(Array.isArray(C.presets)?C.presets:[],D);Hn.current=typeof C.updatedAt=="number"?C.updatedAt:null,xt(Re=>G7(Re,X)?Re:(Mn.current=!0,X)),Jn(qu,{version:Nc,presets:X,updatedAt:Hn.current??void 0})},[]);T.useEffect(()=>{const C=D=>{if(D.key!=="Escape")return;if(Zi){D.preventDefault(),J(!1);return}if(ki){D.preventDefault(),an(!1);return}if(Ls){D.preventDefault(),Is(!1);return}if(io){D.preventDefault(),Hs(!1);return}if(xr){D.preventDefault(),O();return}if(Ce){D.preventDefault(),bn(null),He(null);return}if(ye){D.preventDefault(),_s();return}if(en&&!(As&&zt)){D.preventDefault(),Or("right-sidebar");return}Tr&&!(qn&&zt)&&(D.preventDefault(),Or("left-sidebar"))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[Zi,ki,Ls,xr,O,ye,en,As,Tr,qn,zt,_s,Or]),T.useEffect(()=>{Jl(!0)},[]);const[H,ke]=S.useState({genericProgramNames:[],wrapperScriptNames:[],shellNames:c6}),[,we]=S.useState(!1),Ye=S.useCallback(()=>W7().then(C=>{ke(C),to=new Set(C.shellNames),we(!0)}).catch(()=>{}),[]);T.useEffect(()=>{Ye()},[Ye]),T.useEffect(()=>D1(C=>{if(C.type==="config-updated"){if(C.key==="toolbar-presets"){Q1().then(D=>j(D)).catch(D=>{console.warn("[toolbar-presets] Failed to refresh after remote update:",D)});return}C.key==="program-detection"&&Ye()}}),[j,Ye]),T.useEffect(()=>{let C=!1;return(async()=>{try{const D=await Q1();if(C)return;j(D)}catch(D){console.warn("[toolbar-presets] Failed to load from server:",D)}finally{C||Fr(!0)}})(),()=>{C=!0}},[j]),T.useEffect(()=>{if(cr){if(Mn.current){Mn.current=!1;return}Jn(qu,{version:Nc,presets:Ae,updatedAt:Hn.current??void 0}),V7({version:Nc,presets:Ae,baseUpdatedAt:Hn.current??void 0}).then(C=>{Hn.current=typeof C.updatedAt=="number"?C.updatedAt:null,Jn(qu,{version:Nc,presets:Ae,updatedAt:Hn.current??void 0})}).catch(C=>{const D=C instanceof Error&&"current"in C?C.current:null;D&&typeof D=="object"&&j(D),console.warn("[toolbar-presets] Failed to save to server:",C)})}},[j,Ae,cr]),T.useEffect(()=>{Nd().then(C=>{v(D=>D===C.preventSleep?D:C.preventSleep),I(D=>D===C.networkAvailable?D:C.networkAvailable),De(C.localAccess),st(C.localAccess.name),br(C.runningSessionButtonEnabled),Jn(Lc,C.runningSessionButtonEnabled),Jn(Sc,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}).catch(()=>{})},[]),T.useEffect(()=>{if(!k)return;const C=gh();fe(C),C!=="granted"&&(N(!1),wu(!1))},[k]),T.useEffect(()=>{if(!k)return;ec();const C=()=>{document.visibilityState==="visible"&&(ec(),av())},D=window.setInterval(()=>{ec()},360*60*1e3);return document.addEventListener("visibilitychange",C),window.addEventListener("focus",C),()=>{window.clearInterval(D),document.removeEventListener("visibilitychange",C),window.removeEventListener("focus",C)}},[k]);const Ke=T.useCallback(async()=>{if(k){N(!1),wu(!1),q7(),fe(gh());return}const C=await Z7();if(fe(C),C!=="granted"){N(!1),wu(!1);return}N(!0),wu(!0),await ec(!0,!0),ot("idle")},[k]),Et=T.useCallback(async()=>{ot("checking"),await ea()?.prepareNotificationTest?.();const C=await Y7({title:"Termdock",body:e("settings.notificationsTestBody"),tag:"termdock-notification-test",requireHidden:!1,data:{url:"/"}});ot(C?"delivered":"failed")},[e]),fr=T.useCallback(C=>{Q(C),K7(C),xh()},[]),ln=T.useCallback(C=>{q(C),X7(C),xh()},[]),hn=T.useCallback(C=>{Z(C),J7(C),xh()},[]);T.useEffect(()=>{Ae.some(C=>C.id===nn)||Ar(Ae[0]?.id??"default")},[nn,Ae]),T.useEffect(()=>{if(!jr.available&&vn==="tmux"){ha("shell",{userInitiated:!1});return}jr.available&&zs!=="shell"&&vn!=="tmux"&&ha("tmux",{userInitiated:!1})},[vn,jr.available,zs,ha]),T.useEffect(()=>{Ii(null)},[ye,vn,jr.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),Ze(C)},[]);const fn=T.useCallback(C=>{if(da(C)||!C.destination)return;if(C.type==="group"){if(C.source.index===C.destination.index)return;$s(m5(so,C.source.index,C.destination.index));return}if(C.source.droppableId!==C.destination.droppableId||C.source.index===C.destination.index)return;const D=C.source.droppableId.replace(/^group-sessions:/,""),X=so.find(Re=>Re.key===D);X&&window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:X.sessions[C.source.index]?.id,targetId:X.sessions[C.destination.index]?.id}}))},[so,$s,da]),nr=S.useMemo(()=>Ys.flatMap(C=>{const D=Pt.get(C.id);if(D?.agentStatus!=="working")return[];const{primary:X,secondary:Re}=_a(C,D?.activeProgram??null,D?.cwd??null,to,D?.shellTitle??null,D?.promptState??null);return[{id:C.id,label:X,detail:Re}]}),[Ys,Pt]),Nr=kt?Ys.findIndex(C=>C.id===kt):-1,ps=Ys.length>0&&Nr>=0?`${Nr+1}/${Ys.length}`:`${Ys.length}`,Gn=S.useMemo(()=>{let C=0;for(const D of ve){const X=Pt.get(D.id);(X?.agentStatus==="waiting"||X?.agentNeedsReview)&&(C+=1)}return{running:nr.length,review:C}},[nr.length,ve,Pt]),oo=S.useMemo(()=>Ys.flatMap(C=>{const D=Pt.get(C.id);if(D?.agentStatus!=="waiting"&&!D?.agentNeedsReview)return[];const{primary:X}=_a(C,D.activeProgram,D.cwd,to,D.shellTitle,D.promptState);return[{id:D.terminalSessionId??C.id,label:X,waiting:D.agentStatus==="waiting"}]}),[Ys,Pt]);ev(Gn.running,Gn.review,oo);const Wn=kt?ve.find(C=>C.id===kt)??null:null,yo=Wn?Pt.get(Wn.id):void 0,Ho=!!(Wn&&yo?.agentResumeRecovered&&yo.agentNativeSessionId&&yo.terminalSessionId),ks=Wn&&se?.sessionId===Wn.id?se:null;S.useLayoutEffect(()=>{if(!Tt)return;const C=Xr.current;if(!C)return;const D=!hs.current;C.scrollIntoView({inline:"nearest",block:"nearest",behavior:D?"auto":"smooth"}),hs.current=!0,D&&I0("active-tab-positioned")},[kt,Tt]),T.useEffect(()=>{Xn&&Fs.current&&(Fs.current.scrollIntoView({block:"nearest",inline:"nearest"}),Fs.current.focus(),Fs.current.select()),Xn||(Er.current=!1)},[Xn]);const Tl=T.useCallback(C=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:C}))},[]),Qa=T.useCallback((C,D)=>{Ge(D??null),$(C)},[]),Cl=D3(),Ei=T.useCallback(C=>{if(!C)return;Ne(C),pt.current&&uo("info","PWA_NOTIFICATION_CLICK app-focus-request",{traceId:pt.current,requestedSessionId:C,activeSessionId:kt,sessions:ve.map(X=>({id:X.id,terminalSessionId:Pt.get(X.id)?.terminalSessionId??null}))}),tv(C);const D=ve.find(X=>X.id===C||Pt.get(X.id)?.terminalSessionId===C);D?(Yt.current=null,pt.current&&uo("info","PWA_NOTIFICATION_CLICK app-focus-dispatch",{traceId:pt.current,requestedSessionId:C,targetSessionId:D.id}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D.id}))):(Yt.current=C,pt.current&&uo("info","PWA_NOTIFICATION_CLICK app-focus-pending",{traceId:pt.current,requestedSessionId:C}))},[kt,ve,Pt]);T.useEffect(()=>{if(typeof window>"u"||typeof caches>"u")return;let C=!1;const D=async()=>{if(window.parent!==window&&Ia()){Lt(!0);return}try{const Re=await caches.open(cQ),dt=await Re.match(J2);if(!dt)return;await Re.delete(J2);const Dt=await dt.json();if(C)return;const pr=typeof Dt.sessionId=="string"?Dt.sessionId:null,cn=typeof Dt.traceId=="string"?Dt.traceId:null,wn=typeof Dt.clickedAt=="number"?Dt.clickedAt:0,Rn=Date.now()-wn;uo("info","PWA_NOTIFICATION_CLICK app-cache-consumed",{traceId:cn,sessionId:pr,ageMs:Rn,valid:!!(pr&&Rn>=0&&Rn<=e5),visibilityState:document.visibilityState}),pr&&Rn>=0&&Rn<=e5&&(pt.current=cn,typeof Dt.targetPeerId=="string"&&Dt.targetPeerId!==tc()?.targetPeerId?Ia()?.focusSession(Dt.targetPeerId,pr):Ei(pr))}catch(Re){uo("warn","PWA_NOTIFICATION_CLICK app-cache-failed",{error:Re instanceof Error?Re.message:String(Re)})}finally{C||Lt(!0)}},X=()=>{document.visibilityState==="visible"&&D()};return D(),document.addEventListener("visibilitychange",X),window.addEventListener("pageshow",D),()=>{C=!0,document.removeEventListener("visibilitychange",X),window.removeEventListener("pageshow",D)}},[Ei]),T.useEffect(()=>{if(typeof window>"u")return;const C=new URLSearchParams(window.location.search),D=C.get("session");if(!D)return;uo("info","PWA_NOTIFICATION_CLICK app-url-received",{traceId:pt.current,targetSessionId:D,href:window.location.href,visibilityState:document.visibilityState});const X=C.get("service");X&&X!==tc()?.targetPeerId?Ia()?.focusSession(X,D):Yt.current=D,C.delete("service"),C.delete("session"),C.delete("_notifTrace");const Re=C.toString(),dt=`${window.location.pathname}${Re?`?${Re}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",dt)},[]),T.useEffect(()=>{if(typeof window>"u")return;const C=new URLSearchParams(window.location.search);if(C.get("_notif")!=="1")return;const D=C.get("session");C.delete("_notif");const X=C.toString(),Re=`${window.location.pathname}${X?`?${X}`:""}${window.location.hash}`;if(window.history.replaceState(window.history.state,"",Re),window.parent!==window&&Ia())return;const dt=new BroadcastChannel("termdock:notif");let Dt=!1;const pr=wn=>{wn.data?.type==="termdock:notif-pong"&&!Dt&&(Dt=!0,dt.close(),window.close())};dt.addEventListener("message",pr),dt.postMessage({type:"termdock:notif-ping",sessionId:D,targetPeerId:C.get("service")});const cn=setTimeout(()=>{Dt||dt.close()},500);return()=>{clearTimeout(cn),Dt||dt.close()}},[]),T.useEffect(()=>{if(typeof window>"u"||window.parent!==window&&Ia())return;const C=new BroadcastChannel("termdock:notif"),D=X=>{X.data?.type==="termdock:notif-ping"&&(C.postMessage({type:"termdock:notif-pong"}),typeof X.data.sessionId=="string"&&(typeof X.data.targetPeerId=="string"&&X.data.targetPeerId!==tc()?.targetPeerId?Ia()?.focusSession(X.data.targetPeerId,X.data.sessionId):Ei(X.data.sessionId)))};return C.addEventListener("message",D),()=>C.close()},[Ei]),T.useEffect(()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return;const C=D=>{const X=D.data;if(X&&X.type==="termdock:focus-session"&&typeof X.sessionId=="string"){if(typeof X.targetPeerId=="string"&&X.targetPeerId!==tc()?.targetPeerId){Ia()?.focusSession(X.targetPeerId,X.sessionId)&&D.ports[0]?.postMessage({type:"termdock:focus-session-ack"});return}D.ports[0]?.postMessage({type:"termdock:focus-session-ack"}),Ei(X.sessionId)}else X?.type==="termdock:push-subscription-changed"?ec(!0):X?.type};return navigator.serviceWorker.addEventListener("message",C),()=>navigator.serviceWorker.removeEventListener("message",C)},[Ei]),T.useEffect(()=>{const C=D=>{const X=D.detail;typeof X=="string"&&Ei(X)};return window.addEventListener("termdock:focus-session",C),()=>window.removeEventListener("termdock:focus-session",C)},[Ei]),T.useEffect(()=>{const C=()=>{const D=lv(tc()?.targetPeerId);D&&Ei(D)};return C(),window.addEventListener("termdock:workspace-session",C),()=>window.removeEventListener("termdock:workspace-session",C)},[Ei]),T.useEffect(()=>{const C=Yt.current;if(!C)return;const D=ve.find(X=>X.id===C||Pt.get(X.id)?.terminalSessionId===C);D?(Yt.current=null,pt.current&&uo("info","PWA_NOTIFICATION_CLICK app-pending-dispatch",{traceId:pt.current,requestedSessionId:C,targetSessionId:D.id,activeSessionId:kt}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D.id}))):pt.current&&uo("info","PWA_NOTIFICATION_CLICK app-pending-unmatched",{traceId:pt.current,requestedSessionId:C,activeSessionId:kt,sessions:ve.map(X=>({id:X.id,terminalSessionId:Pt.get(X.id)?.terminalSessionId??null}))})},[kt,ve,Pt]);const di=S.useMemo(()=>{const C=[];for(const D of ve){const X=Pt.get(D.id);(X?.agentStatus==="waiting"||X?.agentNeedsReview)&&C.push(D.id)}return C},[ve,Pt]),Ja=T.useCallback(()=>{if(di.length===0)return;kt&&Ur.getState().clearAgentNeedsReview(kt);const C=kt?ve.findIndex(X=>X.id===kt):-1,D=di.find(X=>ve.findIndex(Re=>Re.id===X)>C)??di[0];D&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D}))},[di,ve,kt]),t0=T.useCallback(()=>{if(di.length===0)return;kt&&Ur.getState().clearAgentNeedsReview(kt);const C=kt?ve.findIndex(X=>X.id===kt):ve.length,D=[...di].reverse().find(X=>ve.findIndex(Re=>Re.id===X)<C)??di[di.length-1];D&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:D}))},[di,ve,kt]);T.useEffect(()=>{const C=D=>{!D.altKey||!D.shiftKey||D.metaKey||D.ctrlKey||D.key!=="ArrowUp"&&D.key!=="ArrowDown"||(D.preventDefault(),D.key==="ArrowUp"?t0():Ja())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[Ja,t0]);const Yd=T.useCallback(async C=>{const X=Ur.getState().sessions.get(C)?.cwd;if(X)try{await navigator.clipboard?.writeText(X),nt(X),window.setTimeout(()=>{nt(Re=>Re===X?null:Re)},1400)}catch{}},[]),Kd=T.useCallback(C=>{$r(C.sessions),un(C.activeSessionId),ne(C.splitWorkspaces),Ur.getState().setActiveSessionId(C.activeSessionId)},[]),Xd=T.useCallback(()=>{kn(!0)},[]),au=T.useCallback(()=>{kn(!0),window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("termdock:initial-viewport-presented"))})},[]);T.useEffect(()=>{if(!oe||!kt)return;ve.find(D=>D.id===oe||Pt.get(D.id)?.terminalSessionId===oe)?.id===kt&&Ne(null)},[kt,oe,ve,Pt]);const Go=T.useCallback(C=>{const D=C?.mode??vn,X=D==="tmux"&&(C?.tmuxSessionName?.trim()||wi.trim())||void 0,Re=C?.cwd||(kt?Ur.getState().sessions.get(kt)?.cwd:void 0);window.dispatchEvent(new CustomEvent("new-terminal-session",{detail:{mode:D,tmuxSessionName:X,cwd:Re,command:C?.command}}))},[vn,wi,kt]),fa=T.useCallback(async()=>{ds(!0);try{const C=await Af();if(Yn(C),!C.available){Cr([]);return}const D=await Tf();Cr(D)}catch{Yn({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),Cr([])}finally{ds(!1)}},[]),Jd=T.useCallback(async C=>{Ot(C),rn(null);try{const{cleanedSessions:D}=await o5(C);for(const X of D)window.dispatchEvent(new CustomEvent("close-terminal-session-by-backend",{detail:X}));_r(null),await fa()}catch(D){rn(D instanceof Error?D.message:"Failed to kill tmux session")}finally{Ot(null)}},[fa]);T.useEffect(()=>{if(!Kn)return;if(_n.find(X=>X.name===Kn&&(X.connected||X.boundFrontendSessionId))){Kr(null);return}const D=setTimeout(()=>Kr(null),1e4);return()=>clearTimeout(D)},[Kn,_n]);const Ks=T.useCallback(C=>{window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:C}))},[]),r0=T.useCallback(C=>{const D=C??kt;D&&window.dispatchEvent(new CustomEvent("open-terminal-split-chooser",{detail:D}))},[kt]),lu=T.useCallback((C,D)=>{window.dispatchEvent(new CustomEvent("set-terminal-split-direction",{detail:{sessionId:C,layout:D}}))},[]),W0=T.useCallback((C,D)=>{window.dispatchEvent(new CustomEvent("reorder-terminal-split-workspace",{detail:{workspaceId:C,sessionIds:D}}))},[]),cu=T.useCallback((C,D)=>{window.dispatchEvent(new CustomEvent("rename-terminal-split-workspace",{detail:{workspaceId:C,name:D}}))},[]),uu=T.useCallback((C,D)=>{window.dispatchEvent(new CustomEvent("combine-terminal-split-sessions",{detail:{primaryId:C,secondaryId:D}}))},[]),_l=T.useCallback((C,D)=>{const X=ve.find(dt=>dt.id===C);if(!X)return;const Re=Pt.get(C);if(!n2({mode:X.mode,activeProgram:Re?.activeProgram??null,promptState:Re?.promptState??null,shellNames:to})){Ks({sessionId:C,source:"sidebar",closeMode:X.mode==="tmux"?"destroy":"auto"});return}ls(D?{x:D.clientX,y:D.clientY}:null),yn(C),rn(null)},[ve,Pt,Ks]);T.useEffect(()=>{if(!ge)return;const C=D=>{const X=D.detail;X==="new-session"?Go():X==="close-session"?kt&&_l(kt):X==="previous-session"||X==="next-session"?window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:X==="next-session"?"next":"prev"}})):X==="toggle-left-sidebar"?go():X==="toggle-right-sidebar"?Cs():X==="previous-attention"?t0():X==="next-attention"&&Ja()};return window.addEventListener("termdock:native-command",C),()=>window.removeEventListener("termdock:native-command",C)},[kt,ge,Go,_l,go,Cs,Ja,t0]);const el=S.useMemo(()=>ve.find(C=>C.id===kr)??null,[ve,kr]),eh=S.useMemo(()=>{if(!el)return"";const C=Pt.get(el.id);return _a(el,C?.activeProgram??null,C?.cwd??null,to,C?.shellTitle??null,C?.promptState??null).primary},[el,Pt]);T.useEffect(()=>{if(!ye)return;let C=!1,D=!1;const X=async()=>{if(!D)try{const dt=await Af();if(C||Yn(dt),!dt.available){C||Cr([]);return}const Dt=await Tf();C||Cr(Dt)}catch{D=!0,C||(Yn({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),Cr([]))}};X();const Re=setInterval(()=>{X()},4e3);return()=>{C=!0,clearInterval(Re)}},[ye]);const du=qi??vn,V0=du==="shell",q0=du==="tmux"&&jr.available,th=S.useMemo(()=>rv(_n.map(C=>({...C,id:C.name})),C=>C.cwd??null,e("sidebar.ungrouped")),[_n,e]),n0=S.useMemo(()=>_n.filter(C=>C.recoveryCandidate===!0&&!C.connected&&!C.boundFrontendSessionId).sort((C,D)=>(D.lastActiveAt??D.createdAt??0)-(C.lastActiveAt??C.createdAt??0)),[_n]);T.useEffect(()=>{!Tr&&!(qn&&zt)||fa()},[Tr,qn,zt,ve.length,fa]);const s0=(C,D,X,Re=!1)=>{const dt=C.id===kt,Dt=C.id===Xn,pr=Pt.get(C.id),{primary:cn,secondary:wn}=_a(C,pr?.activeProgram??null,pr?.cwd??null,to,pr?.shellTitle??null,pr?.promptState??null),Rn=Pc(pr?.cwd??null),vo=D?wn??(Rn&&Rn!==cn?Rn:null):null,Nn=pr?.gitStatus,Mi=`${pr?.cwd||C.name}${Nn?`
155
+ ⎇ ${Nn.branch} +${Nn.added} −${Nn.removed}`:""}`,wo=!!(pr?.tuiProgress&&pr.tuiProgress.state!=="remove"),Ds=pr?.agentStatus==="working"||wo?"var(--success)":pr?.agentStatus==="waiting"||pr?.agentNeedsReview?"var(--warning)":pr?.inCopyMode?"var(--tmux)":null;if(Dt&&zt&&!Ce){const Es=C.customName?C.name:cn,Qs=(Ti,Wo)=>{const Ba=Wo.trim();Ba?Ba!==Es&&Ss(Ti,Ba):zn(Ti),bn(null)};return a.jsx("input",{ref:Ti=>{Fs.current=Ti},type:"text",defaultValue:Es,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(Es.length,5)}ch`},onKeyDown:Ti=>{Ti.key==="Enter"?Qs(C.id,Ti.target.value):Ti.key==="Escape"&&bn(null)},onBlur:Ti=>Qs(C.id,Ti.target.value)})}return a.jsx("div",{ref:dt?Xr:null,onContextMenu:Es=>{Es.preventDefault(),Ge({x:Es.clientX,y:Es.clientY}),$(C.id)},...Cl(()=>Qa(C.id)),className:Re?`group relative inline-flex h-5 shrink-0 items-center rounded-sm text-[11px] leading-none transition ${dt?"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 ${dt?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:bg-surface-elevated/50 hover:text-foreground"}`,style:!Re&&dt&&Ds?{boxShadow:`inset 2px 0 0 0 ${Ds}`}:!Re&&dt?{boxShadow:"inset 2px 0 0 0 rgb(var(--primary-rgb, 99 102 241))"}:void 0,title:Mi,children:a.jsx("button",{type:"button",...X??{},onClick:()=>Tl(C.id),className:`inline-flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-left ${Re?"px-1":"py-1 pl-1 pr-1.5 sm:pl-1.5 sm:pr-2"} ${X?"cursor-grab active:cursor-grabbing":""}`,title:Mi,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:[r5(C.mode,pr),pr?.agentResumeRecovered&&a.jsx(C0,{size:Re?9:10,className:"-ml-0.5 shrink-0 text-[color:var(--warning)]","aria-label":e("tab.resumeAgentAvailable")}),wo&&!pr?.agentStatus&&a.jsx(mn,{size:Re?9:10,className:"-ml-0.5 shrink-0 animate-spin text-[color:var(--success)]"})]}),vo?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] ${pr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:cn}),a.jsx("span",{className:"truncate text-[9px] text-muted-foreground/80 sm:text-[9.5px]",children:vo})]}):a.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${pr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:cn})]})})})},Z0=()=>a.jsx(Ga,{droppableId:ap,type:"session",isDropDisabled:zt,children:(C,D)=>{const X=at||D.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":!it,"data-mobile-session-destroy-target":"","data-active":X?"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 ${it?X?"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(Hi,{size:28,strokeWidth:1.8}),a.jsx("span",{className:"px-2 text-center text-[11px] font-semibold leading-tight",children:e(X?"tab.releaseToClose":"tab.dragToClose")})]}),C.placeholder]})}}),Ai=qn&&zt,i0=As&&zt,Sl=Yu(rs,zr,Ai?Cn:0),Ll=i0?Sl+i5:0,tl=Ai?ve.find(C=>C.id===kt):null,Ns=tl?Pt.get(tl.id):void 0,rh=tl?_a(tl,Ns?.activeProgram??null,Ns?.cwd??null,to,Ns?.shellTitle??null,Ns?.promptState??null).primary:"",Y0=zt?It:null,nh=Ai&&!Y0&&Ns?Ns.agentStatus==="working"?"bg-gradient-to-r from-[rgb(var(--success-rgb)_/_0.08)] to-transparent":Ns.agentStatus==="waiting"?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.14)] to-transparent":Ns.agentNeedsReview?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.08)] to-transparent":Ns.inCopyMode?"bg-gradient-to-r from-[rgb(var(--tmux-rgb)_/_0.07)] to-transparent":"":"",hu=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:`${zt?"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 ${Ai?"flex justify-end":"flex justify-between"} ${Rr?"h-10 sm:h-10":"h-9 sm:h-10"} ${nh}`,style:{marginRight:Ll||void 0,display:Y0?"none":void 0},children:[!Ai&&a.jsxs("button",{type:"button",onClick:go,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")}: ${Gn.running} · ${e("agent.needsReview")}: ${Gn.review}`,children:[a.jsx(M8,{size:14}),a.jsx(UN,{runningCount:Gn.running,reviewCount:Gn.review,className:"sm:hidden"})]}),Ai?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:tl?a.jsxs(a.Fragment,{children:[r5(tl.mode,Ns),a.jsx("span",{className:`truncate text-[12px] font-medium ${Ns?.inCopyMode?"text-[color:var(--tmux)]":"text-foreground"}`,children:rh}),Ns?.agentStatus==="working"&&a.jsx("span",{title:Ns?.agentMessage??void 0,children:a.jsx(mn,{size:12,className:"shrink-0 animate-spin text-[color:var(--success)]"})}),Ns?.agentStatus==="waiting"&&a.jsx("span",{title:Ns?.agentMessage??void 0,children:a.jsx(ld,{size:12,className:"shrink-0 animate-bounce-y text-[color:var(--warning)]"})}),!Ns?.agentStatus&&Ns?.agentNeedsReview&&a.jsx("span",{title:Ns?.agentMessage??void 0,children:a.jsx(Vl,{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")})}):Rr?a.jsxs(_d,{onDragStart:bo,onDragUpdate:ua,onDragEnd:fn,children:[Z0(),a.jsx(Ga,{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:[so.map((D,X)=>{let Re=0,dt=0;for(const wn of D.sessions){const Rn=Pt.get(wn.id);Rn?.agentStatus==="working"&&(Re+=1),(Rn?.agentStatus==="waiting"||Rn?.agentNeedsReview)&&(dt+=1)}const Dt=D.sessions.some(wn=>wn.id===kt),pr=sn.has(D.key),cn=D.key==="";return a.jsx(Ha,{draggableId:`group-${D.key||"__ungrouped__"}`,index:X,isDragDisabled:cn,disableInteractiveElementBlocking:!0,children:(wn,Rn)=>a.jsxs("div",{ref:wn.innerRef,...wn.draggableProps,className:`flex w-fit shrink-0 flex-col justify-center gap-px rounded-md py-0.5 px-1 ring-1 transition-colors ${Rn.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",...cn?{}:wn.dragHandleProps,onClick:()=>Zn(D.key),className:`flex ${pr?"":D.sessions.length>1?"w-0 min-w-full":""} items-center gap-0.5 rounded text-[9px] font-semibold uppercase tracking-[0.08em] leading-none transition hover:bg-surface-elevated/40 ${cn?"":"cursor-grab active:cursor-grabbing"} ${Dt?"text-primary/80":"text-muted-foreground/55"}`,title:D.key||D.label,children:[a.jsx(eu,{size:9,className:`shrink-0 opacity-70 transition-transform ${pr?"":"rotate-90"}`}),a.jsx("span",{className:"min-w-0 truncate",children:D.label}),Re>0&&a.jsx("span",{className:"ml-auto h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)]"}),dt>0&&a.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] ${Re>0?"":"ml-auto"}`})]}),pr?a.jsx("span",{className:"flex h-5 items-center text-[10px] leading-none text-muted-foreground/50",children:e("tab.sessionCount",{count:D.sessions.length})}):a.jsx(Ga,{droppableId:`group-sessions:${D.key}`,type:"session",direction:"horizontal",children:vo=>a.jsxs("div",{ref:vo.innerRef,...vo.droppableProps,className:"flex items-center gap-px",children:[D.sessions.map((Nn,Mi)=>a.jsx(Ha,{draggableId:Nn.id,index:Mi,disableInteractiveElementBlocking:!0,children:(wo,Ds)=>a.jsx("div",{ref:wo.innerRef,...wo.draggableProps,className:`flex shrink-0 items-center ${Ds.isDragging?"opacity-70":""}`,children:s0(Nn,!1,wo.dragHandleProps,!0)})},Nn.id)),vo.placeholder]})})]})},D.key||"__ungrouped__")}),C.placeholder,a.jsx("button",{type:"button",onClick:()=>Go(),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(zi,{size:14})})]})})]}):a.jsxs(_d,{onDragStart:bo,onDragUpdate:ua,onDragEnd:Al,children:[Z0(),a.jsx(Ga,{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:[Ys.map((D,X)=>D.id===Xn?a.jsx(S.Fragment,{children:a.jsx(Ha,{draggableId:D.id,index:X,isDragDisabled:!0,children:dt=>a.jsx("div",{ref:dt.innerRef,...dt.draggableProps,className:"flex h-full items-center",children:s0(D,!0)})})},D.id):a.jsx(S.Fragment,{children:a.jsx(Ha,{draggableId:D.id,index:X,disableInteractiveElementBlocking:!0,children:(dt,Dt)=>a.jsx("div",{ref:dt.innerRef,...dt.draggableProps,className:`flex h-full shrink-0 items-center ${Dt.isDragging?"opacity-70":""}`,children:s0(D,!0,dt.dragHandleProps)})})},D.id)),a.jsx("button",{type:"button",onClick:()=>Go(),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(zi,{size:14})}),C.placeholder]})})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[!Ai&&Gn.running>0&&a.jsx("span",{className:"hidden items-center gap-1 sm:inline-flex",children:a.jsx(K3,{count:Gn.running,tone:"running",title:e("agent.aiRunning")})}),!Ai&&ve.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 ${Nr+1} of ${ve.length}`,children:ps}),!i0&&a.jsx("button",{type:"button",onClick:Cs,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(w5,{size:14})})]})]}),Ho&&Wn&&yo?.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:Ll||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:!ks?.error&&(ks?.status==="submitting"||ks?.status==="waiting")?a.jsx(mn,{size:14,className:"animate-spin"}):a.jsx(C0,{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:yo.agent?.displayName??"Agent"})}),a.jsx("div",{className:`truncate text-[10px] sm:text-[11px] ${ks?.error?"text-destructive":"text-muted-foreground"}`,children:ks?.error??(ks?.status==="submitting"?e("tab.resumeAgentSubmitting"):ks?.status==="waiting"?e("tab.resumeAgentWaiting"):e("tab.resumeAgentRecoveredHint"))})]}),a.jsx("button",{type:"button",disabled:!ks?.error&&(ks?.status==="submitting"||ks?.status==="waiting"),onClick:()=>{Br(Wn.id,yo.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:ks?.error?e("common.retry"):e("tab.resumeAgentNow")}),a.jsx("button",{type:"button",onClick:()=>{Ur.getState().setAgentResumeRecovered(Wn.id,!1),rt(C=>C?.sessionId===Wn.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(ys,{size:13})})]}),a.jsx("div",{ref:St,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(kS,{terminalSettings:Ht,colorTheme:m,toolbarPresets:Ae,showDebug:u&&zt,terminalFocusAvailable:B,defaultSessionMode:vn,defaultTmuxSessionName:wi,connectionPrioritySessionId:oe,connectionPriorityReady:Tt,desktopRightSidebarEnabled:zt,onToggleRightSidebar:Cs,desktopFloatingTitle:zt,desktopPinnedLeftSidebarWidth:Ai?Cn:0,desktopViewportWidth:zr,onSessionDataUpdate:Kd,onInitialViewportReady:au,onInitialRecoveryRequired:Xd})})})]})}),a.jsx(WN,{reviewCount:Gn.review,runningSessions:nr,activeSessionId:kt,runningButtonEnabled:lt,isDesktopLayout:zt,containerElement:hr,occlusionInsets:{right:Ll}}),ye&&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:_s,"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:o},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(Z8,{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:_s,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(ys,{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:()=>$e({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=>$e({fontSize:parseInt(C.target.value,10)}),className:"min-w-0 flex-1","aria-label":e("settings.font")}),a.jsx("button",{type:"button",onClick:()=>$e({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(XD,{}),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 D=lr===C;return a.jsx("button",{type:"button",onClick:()=>$e({rendererMode:C}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${D?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:e(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",L8,e("settings.darkTheme")],["light",J8,e("settings.lightTheme")]].map(([C,D,X])=>{const Re=m===C;return a.jsxs("button",{type:"button",onClick:()=>g(C),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition ${Re?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:[a.jsx(D,{size:12}),a.jsx("span",{children:X})]},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 D=vn===C,X=C==="tmux"&&!jr.available;return a.jsx("button",{type:"button",disabled:X,onClick:()=>ha(C,{userInitiated:!0}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${D?"bg-primary/20 text-primary":X?"cursor-not-allowed text-muted-foreground/40":"text-muted-foreground hover:bg-surface-elevated"}`,title:X?jr.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:()=>f(!u),className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${u?"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(za,{checked:u,size:"sm"})]}),a.jsxs("button",{type:"button",onClick:async()=>{const C=!x;v(C);try{const D=await Do({preventSleep:C});v(D.preventSleep),I(D.networkAvailable),De(D.localAccess),Jn(Sc,{preventSleep:D.preventSleep,networkAvailable:D.networkAvailable,localAccess:D.localAccess})}catch{v(!C)}},className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${x?"bg-[rgb(var(--success-rgb)_/_0.15)] text-[color:var(--success)]":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:!w&&x?e("settings.noSleepUnavailable"):void 0,children:[a.jsx("span",{className:"font-medium truncate",children:e("settings.noSleep")}),a.jsx(za,{checked:x,size:"sm"})]})]})]}),a.jsxs("button",{type:"button",onClick:()=>J(!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(Rv,{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&&F?"settings.notificationsBothOnSummary":R?"settings.notificationsAiOnSummary":F?"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] ${_e.status==="active"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:_e.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=>st(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:Ue,onClick:()=>{vi()},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(Ue?"settings.saving":"common.save")}),a.jsx("button",{type:"button",disabled:Ue,onClick:()=>{Ka()},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:[_e.url&&a.jsxs("button",{type:"button",onClick:()=>{$n(_e.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: ",_e.url]}),a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium",children:he==="lan"?"Copied":e("common.copy")})]}),_e.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:_e.interfaces.map(C=>{const D=C.url??`${_e.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 ${D}`,className:"h-28 w-28"})}),a.jsxs("button",{type:"button",onClick:()=>{$n(D,`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:D}),a.jsx("span",{className:"shrink-0 text-[10px]",children:he===`ip-${C.address}`?"Copied":e("common.copy")})]})]},`${C.name}-${C.address}`)})})]}),_e.onboardingUrl&&a.jsxs("button",{type:"button",onClick:()=>{$n(_e.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"),": ",_e.onboardingUrl]}),a.jsx("span",{className:"shrink-0 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-medium",children:he==="setup"?"Copied":e("common.copy")})]}),a.jsxs("div",{className:"text-muted-foreground",children:[_e.httpsEnabled?e("settings.httpsActive"):e("settings.httpsInactive"),!_e.caAvailable&&` · ${e("settings.caMissing")}`]}),_e.reason&&a.jsx("div",{className:"text-[color:var(--warning)]",children:_e.reason}),ht&&a.jsx("div",{className:"text-destructive",children:ht})]})]}),a.jsx(ZD,{state:ie,pending:Xe,onCheck:()=>{ws()},onConfirmRestart:()=>{or()},desktopState:Qt?W:void 0,desktopPending:Se,onCheckDesktop:()=>{ts()},onInstallDesktop:()=>{gn()}}),ge&&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(_v,{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:()=>{ge.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(jv,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopSwitchService")]}),a.jsxs("button",{type:"button",onClick:()=>{qe(null),ge.installCli().then(C=>{We(C),qe(e("settings.desktopCliUpdated"))}).catch(C=>qe(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(Po,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopInstallCli")]}),a.jsxs("button",{type:"button",onClick:()=>{qe(null),ge.revealDataDirectory().catch(C=>qe(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(k0,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopOpenDataDirectory")]})]}),ce&&a.jsx("div",{className:"border-t border-border/10 px-3 py-2 text-[10px] text-muted-foreground",children:ce})]}),a.jsxs("div",{className:"mt-3 flex gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>{Ii(null),Go({mode:"shell"}),_s()},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${V0?"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(qi==="shell"?"sidebar.confirmNewShell":"settings.shell"),children:[a.jsx(zi,{size:14,className:V0?"shrink-0":"hidden"}),a.jsx(Po,{size:12}),a.jsx("span",{className:V0?"whitespace-nowrap":"hidden",children:e(qi==="shell"?"sidebar.confirmNewShell":"settings.shell")})]}),a.jsxs("button",{type:"button",disabled:!jr.available,onClick:()=>{jr.available&&(Ii(null),Go({mode:"tmux"}),_s())},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${jr.available?q0?"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:jr.available?e(qi==="tmux"?"sidebar.confirmNewTmux":"settings.tmux"):jr.reason||e("settings.installTmuxHint"),children:[a.jsx(zi,{size:14,className:q0?"shrink-0":"hidden"}),a.jsx(D0,{size:12}),a.jsx("span",{className:q0?"whitespace-nowrap":"hidden",children:e(qi==="tmux"?"sidebar.confirmNewTmux":"settings.tmux")})]})]}),(jr.available||_n.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 ${jr.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:jr.available?e("settings.sessions",{n:_n.length}):e("settings.tmuxUnavailable")})]}),a.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),fa()},disabled:xn,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(vs,{size:12,className:xn?"animate-spin":""})})]}),a.jsx("div",{className:"px-2 pb-2",children:jr.available?_n.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:[th.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(ql,{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(D=>{const X=D.boundFrontendSessionId??null,Re=!!(D.connected||X),dt=X?ve.find(Qs=>Qs.id===X)??null:null,Dt=D.friendlyName?.trim()||null,pr=D.label&&D.label!==D.name?D.label:null,cn=Dt||pr||D.name,wn=Dt||pr?`tmux:${D.name}`:null,Rn=D.clientCount&&D.clientCount>0?t==="zh"?`网页连接 ${D.clientCount}`:`Web clients ${D.clientCount}`:null,vo=D.attached>0?t==="zh"?`原生 tmux ${D.attached}`:`Native tmux ${D.attached}`:null,Nn=[wn,Re?D.restorable?e("settings.restorable"):e("settings.attached"):null,Rn,vo].filter(Qs=>!!Qs),Mi=[e("settings.windows",{n:D.windows}),D.createdAt?new Date(D.createdAt).toLocaleDateString():null].filter(Qs=>!!Qs),wo=li===D.name,Ds=Un===D.name,Es=Kn===D.name;return a.jsxs("div",{className:`flex items-start gap-2 rounded-lg px-2.5 py-2 ${wo?"bg-destructive/10 ring-1 ring-destructive/40":"bg-surface"}`,children:[a.jsx(D0,{size:13,className:Re?"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:cn}),D.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"})]}),Nn.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:Nn.map(Qs=>a.jsx("span",{className:"max-w-full truncate",children:Qs},Qs))}),(D.program||D.cwd)&&a.jsxs("div",{className:"grid min-w-0 gap-0.5 text-[10px] text-muted-foreground",children:[D.program&&a.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[a.jsx(x8,{size:10,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"truncate text-foreground/75",children:D.program})]}),D.cwd&&a.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[a.jsx(ql,{size:10,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"truncate",children:D.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:Mi.map(Qs=>a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Yv,{size:10,className:"shrink-0 text-muted-foreground/60"}),Qs]},Qs))})]}),wo?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",disabled:Ds,onClick:()=>{Jd(D.name)},className:"shrink-0 rounded-full bg-destructive/90 px-2.5 py-1 text-[11px] font-medium text-destructive-foreground transition hover:bg-destructive disabled:opacity-50",children:Ds?"…":e("settings.destroy")}),a.jsx("button",{type:"button",disabled:Ds,onClick:()=>{_r(null),rn(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:()=>{dt?Tl(dt.id):(Kr(D.name),Go({mode:"tmux",tmuxSessionName:D.name}))},disabled:Es,className:`shrink-0 inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition disabled:opacity-50 ${Re?"bg-surface text-foreground hover:bg-surface-elevated":Es?"bg-primary/10 text-primary":"bg-primary/15 text-primary hover:bg-primary/25"}`,children:Es?a.jsxs(a.Fragment,{children:[a.jsx(mn,{size:10,className:"animate-spin"}),e("settings.attaching")]}):e(Re?"settings.attached":"settings.attach")}),a.jsx("button",{type:"button",disabled:Ds,onClick:()=>{rn(null),_r(D.name)},className:"shrink-0 inline-flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground transition hover:bg-destructive/15 hover:text-destructive","aria-label":`Kill tmux session ${D.name}`,children:a.jsx(Hi,{size:12})})]})]},D.name)})]},C.key||"__ungrouped_tmux__")),qs&&a.jsx("p",{className:"px-2 text-[11px] text-destructive",children:qs})]}):a.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:jr.reason||e("settings.installTmuxHint")})})]}),a.jsxs("button",{type:"button",onClick:()=>an(!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(v8,{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:Ae.length})}),a.jsx("span",{children:"›"})]})]}),a.jsxs("button",{type:"button",onClick:()=>Is(!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(Dd,{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 D=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 ${D?"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 nv()}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(s9,{size:14}),e("settings.signOut")]})]})]})})]}),el&&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:()=>{yn(null),ls(null),rn(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&&zt?"":"inset-x-3 bottom-6 mx-auto max-w-sm sm:bottom-auto sm:top-[15%]"}`,style:Zs&&zt?{...K2(Zs),paddingBottom:o}:{paddingBottom:o},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:eh}),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:()=>{Ks({sessionId:el.id,source:"sidebar",closeMode:"destroy"}),yn(null),ls(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(Hi,{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")})]})]}),qs&&a.jsx("p",{className:"px-4 py-2 text-[11px] text-destructive",children:qs})]}),a.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:a.jsx("button",{type:"button",onClick:()=>{yn(null),ls(null),rn(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")})})]})]}),xr&&(()=>{const C=ve.find(Rn=>Rn.id===xr);if(!C)return null;const D=Pt.get(C.id),{primary:X}=_a(C,D?.activeProgram??null,D?.cwd??null,to),Re=zt,dt=Re?K2(le):{paddingBottom:o},Dt=Re?"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%]",pr=Re?"border-b border-border/15 px-3 py-2":"border-b border-border/15 px-4 py-3",cn=Re?"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",wn=Re?"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 ${Re?"bg-transparent":"bg-[var(--app-backdrop-soft)] backdrop-blur-sm"}`,onClick:O,"aria-label":"Close menu"}),a.jsxs("div",{className:Dt,style:dt,children:[a.jsxs("div",{className:pr,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:X}),D?.cwd&&a.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/80",children:D.cwd})]}),a.jsxs("div",{className:"flex flex-col py-1",children:[a.jsxs("button",{type:"button",onClick:()=>{const Rn=le;O(),He(Rn),bn(C.id)},className:`${cn} text-foreground hover:bg-surface-2`,children:[a.jsx("span",{className:`${wn} bg-primary/15 text-primary`,children:a.jsx(B8,{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:!D?.cwd,onClick:()=>{Yd(C.id),O()},className:`${cn} ${D?.cwd?"text-foreground hover:bg-surface-2":"text-muted-foreground/50 cursor-not-allowed"}`,children:[a.jsx("span",{className:`${wn} bg-surface-2 text-muted-foreground`,children:a.jsx(A8,{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")})]}),tt&&tt===D?.cwd&&a.jsx("span",{className:"ml-auto text-[11px] text-primary",children:e("tab.copied")})]}),D?.agentNativeSessionId&&D.agentStatus!=="working"&&D.agentStatus!=="waiting"&&D.terminalSessionId&&a.jsxs("button",{type:"button",onClick:()=>{const Rn=D.terminalSessionId;Rn&&(O(),Br(C.id,Rn))},className:`${cn} text-foreground hover:bg-surface-2`,children:[a.jsx("span",{className:`${wn} bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)]`,children:a.jsx(C0,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"block font-medium",children:[e("tab.resumeAgent"),D.agent?.displayName?` · ${D.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:`${cn} text-destructive hover:bg-destructive/10`,children:[a.jsx("span",{className:`${wn} bg-destructive/15 text-destructive`,children:a.jsx(Hi,{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(),Ks({sessionId:C.id,source:"tab-menu",closeMode:"auto"})},className:`${cn} text-destructive hover:bg-destructive/10`,children:[a.jsx("span",{className:`${wn} bg-destructive/15 text-destructive`,children:a.jsx(ys,{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")})]})]}),!Re&&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")})]}),!Re&&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")})})]})]})})(),Xn&&Ce&&zt&&(()=>{const C=ve.find(Nn=>Nn.id===Xn);if(!C)return null;const D=Pt.get(C.id),{primary:X}=_a(C,D?.activeProgram??null,D?.cwd??null,to,D?.shellTitle??null,D?.promptState??null),Re=C.customName?C.name:X,dt=Nn=>{const Mi=Nn.trim();Mi?Mi!==Re&&Ss(C.id,Mi):zn(C.id),bn(null),He(null)},Dt=300,pr=160,cn=Ce.x,wn=Ce.y,Rn=Math.min(Math.max(cn-Dt/2,12),window.innerWidth-Dt-12),vo=wn+pr+20>window.innerHeight?Math.max(wn-pr-12,12):wn+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:()=>{bn(null),He(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:`${Rn}px`,top:`${vo}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:X}),D?.cwd&&a.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/70",children:D.cwd})]}),a.jsxs("form",{className:"px-3 py-2.5",onSubmit:Nn=>{Nn.preventDefault();const Mi=new FormData(Nn.currentTarget).get("session-name");dt(typeof Mi=="string"?Mi:"")},children:[a.jsx("input",{ref:Nn=>{Fs.current=Nn,Nn&&!Er.current&&(Er.current=!0,Nn.focus({preventScroll:!0}),Nn.select())},type:"text",name:"session-name",defaultValue:Re,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:Nn=>{Nn.key==="Escape"&&(Nn.stopPropagation(),bn(null),He(null))}}),a.jsxs("div",{className:"mt-2.5 flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{bn(null),He(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")})]})]})]})]})})(),Xn&&!zt&&(()=>{const C=ve.find(Dt=>Dt.id===Xn);if(!C)return null;const D=Pt.get(C.id),{primary:X}=_a(C,D?.activeProgram??null,D?.cwd??null,to,D?.shellTitle??null,D?.promptState??null),Re=C.customName?C.name:X,dt=Dt=>{const pr=Dt.trim();pr?pr!==Re&&Ss(C.id,pr):zn(C.id),bn(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:()=>bn(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 pr=new FormData(Dt.currentTarget).get("session-name");dt(typeof pr=="string"?pr:"")},children:[a.jsx("input",{ref:Dt=>{Fs.current=Dt,Dt&&!Er.current&&(Er.current=!0,Dt.focus({preventScroll:!0}),Dt.select())},type:"text",name:"session-name",defaultValue:Re,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(),bn(null))}}),a.jsxs("div",{className:"mt-3 flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>bn(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")})]})]})]})]})})(),Zi&&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:()=>J(!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:()=>J(!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(ys,{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:V==="denied"?e("settings.notificationsDenied"):Au()?e("settings.notificationsMasterHint"):e("settings.notificationsUnsupported")}),Au()&&!sv()&&a.jsx("div",{className:"mt-1.5 text-[11px] leading-relaxed text-[var(--warning)]",children:e("settings.notificationsIOSInstallHint")})]}),a.jsx("button",{type:"button",onClick:()=>{Ke()},disabled:!Au()||V==="denied",className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":k,children:a.jsx(za,{checked:k,disabled:!Au()||V==="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 ${V==="granted"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:[e("settings.notificationsPermission"),": ",ea()?e("settings.notificationsPermissionSystem"):V]}),a.jsx("button",{type:"button",disabled:!k||V!=="granted"||je==="checking",onClick:()=>{Et()},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(je==="checking"?"settings.notificationsTestChecking":"settings.notificationsTest")}),ea()?.openNotificationSettings&&a.jsx("button",{type:"button",onClick:()=>{ea()?.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")})]}),je!=="idle"&&je!=="checking"&&a.jsx("div",{className:`mt-2 text-[11px] leading-relaxed ${je==="delivered"?"text-primary":"text-[var(--warning)]"}`,children:e(je==="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,D,X])=>{const Re=P===C;return a.jsxs("button",{type:"button",disabled:!k,onClick:()=>hn(C),className:`min-w-0 rounded-lg px-2 py-2 text-left transition ${Re&&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:X,children:[a.jsx("span",{className:"block truncate text-[11px] font-semibold",children:D}),a.jsx("span",{className:"mt-0.5 block truncate text-[9px] opacity-80",children:X})]},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:()=>fr(!R),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":R&&k,children:a.jsx(za,{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:()=>ln(!F),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":F&&k,children:a.jsx(za,{checked:F&&k,disabled:!k})})]})]}),a.jsx("p",{className:"mt-2 text-[10px] text-muted-foreground",children:e("settings.notificationsFutureHint")})]})]})]})]}),ki&&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:()=>an(!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:()=>an(!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(ys,{size:18})})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:a.jsx(WD,{presets:Ae,selectedPresetId:nn,onSelectPreset:Ar,onUpdatePreset:(C,D)=>{xt(X=>L0(X.map(Re=>Re.id===C?D(Re):Re)))},onAddPreset:()=>{const C=`preset-${Date.now()}`;xt(D=>L0([...D,{id:C,label:`Preset ${D.length}`,programs:[],includeAlt:!1,rowLayout:[3,3],actions:[],showOnDesktop:!1}])),Ar(C)},onRemovePreset:C=>{xt(D=>L0(D.filter(X=>X.id!==C)))},onResetDefaults:()=>{xt(Gc()),Ar("default")}})})]})]}),Ls&&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:()=>Is(!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:()=>Is(!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(ys,{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(qD,{}),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:ve.map(C=>{const D=Pt.get(C.id),X=D?.activeProgramRaw??null,Re=D?.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:"})," ",Re||"—"]}),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:"})," ",X||"—"]})]},`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:D,hint:X})=>a.jsxs("div",{children:[a.jsx("div",{className:"mb-0.5 text-[11px] font-medium text-foreground",children:D}),a.jsx("div",{className:"text-[10px] text-muted-foreground",children:X}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[H[C].map(Re=>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:[Re,a.jsx("button",{type:"button",onClick:()=>{const dt={...H,[C]:H[C].filter(Dt=>Dt!==Re)};ke(dt),C==="shellNames"&&(to=new Set(dt.shellNames)),B1(dt).catch(()=>{})},className:"ml-0.5 text-muted-foreground hover:text-destructive",children:"×"})]},Re)),a.jsx("input",{placeholder:e("settings.addTag"),className:"w-16 rounded bg-surface px-1.5 py-0.5 text-[11px] font-mono",onKeyDown:Re=>{if(Re.key!=="Enter")return;const dt=Re.target.value.trim().toLowerCase();if(!dt||H[C].includes(dt))return;const Dt={...H,[C]:[...H[C],dt]};ke(Dt),C==="shellNames"&&(to=new Set(Dt.shellNames)),Re.target.value="",B1(Dt).catch(()=>{})}})]})]},C)),a.jsx("button",{type:"button",onClick:()=>{iv().then(C=>{ke(C),to=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")}),Ln.map((C,D)=>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:X=>{const Re=Ln.map((dt,Dt)=>Dt===D?{...dt,enabled:X.target.checked}:dt);ui(Re),Jn(eo,Re),L(!0),u0(Re).then(dt=>{ui(dt),Jn(eo,dt)}).catch(()=>{}).finally(()=>L(!1))}}),a.jsxs("select",{value:C.matchType,onChange:X=>{const Re=Ln.map((dt,Dt)=>Dt===D?{...dt,matchType:X.target.value}:dt);ui(Re),Jn(eo,Re),L(!0),u0(Re).then(dt=>{ui(dt),Jn(eo,dt)}).catch(()=>{}).finally(()=>L(!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:X=>{const Re=Ln.map((dt,Dt)=>Dt===D?{...dt,pattern:X.target.value}:dt);ui(Re),Jn(eo,Re)},onBlur:()=>{L(!0),u0(Ln).then(X=>{ui(X),Jn(eo,X)}).catch(()=>{}).finally(()=>L(!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:X=>{const Re=Ln.map((dt,Dt)=>Dt===D?{...dt,output:X.target.value}:dt);ui(Re),Jn(eo,Re)},onBlur:()=>{L(!0),u0(Ln).then(X=>{ui(X),Jn(eo,X)}).catch(()=>{}).finally(()=>L(!1))},placeholder:"output",className:"w-28 rounded bg-surface px-2 py-1 text-[11px]"}),a.jsx("button",{type:"button",onClick:()=>{const X=Ln.filter((Re,dt)=>dt!==D);ui(X),Jn(eo,X),L(!0),u0(X).then(Re=>{ui(Re),Jn(eo,Re)}).catch(()=>{}).finally(()=>L(!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=[...Ln,{id:`rule-${Date.now()}`,enabled:!0,priority:100,matchType:"includes",pattern:"",output:""}];ui(C),Jn(eo,C),L(!0),u0(C).then(D=>{ui(D),Jn(eo,D)}).catch(()=>{}).finally(()=>L(!1))},className:"rounded-full bg-primary/15 px-3 py-1.5 text-[11px] font-medium text-primary hover:bg-primary/25",children:e("settings.addRule")}),a.jsx("button",{type:"button",onClick:()=>{L(!0),ov().then(C=>{ui(C),Jn(eo,C)}).catch(()=>{}).finally(()=>L(!1))},className:"rounded-full bg-surface-2 px-3 py-1.5 text-[11px] font-medium text-muted-foreground hover:bg-surface-elevated hover:text-foreground",children:e("settings.resetDefaults")}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:e0?e("settings.saving"):Xa?`${Ln.length} rules`:"…"})]})]})]})]})]})]}),io&&a.jsx(FD,{isOpen:io,onClose:()=>Hs(!1)}),!Ai&&a.jsx(z2,{isOpen:Tr,drawerWidthPx:Sn,onClose:()=>Or("left-sidebar"),onOpen:Gi,sessions:ve,activeSessionId:kt,sessionStates:Pt,onNewSession:C=>Go(C),recoverableTmuxSessions:n0,recoverableTmuxSessionsLoading:xn,onRefreshRecoverableTmuxSessions:()=>{fa()},onCloseSession:_l,onSplitSession:r0,onCloseSplit:C=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:C})),onRemoveFromSplit:C=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:C})),splitWorkspaces:jt,onSetSplitLayout:lu,onReorderSplitWorkspace:W0,onRenameSplitWorkspace:cu,onCombineSplitSessions:uu,onReorderSessions:$s,onSessionMenu:Qa,onOpenSettings:zo,onJumpToNextAttention:di.length>0?Ja:void 0,onOpenQuota:()=>Hs(!0),updateState:ie,updateActionPending:Xe,onConfirmUpdateRestart:or,onRetryUpdate:ws,tmuxAvailable:jr.available,defaultSessionMode:vn,runningSessionButtonEnabled:lt,onRunningSessionButtonEnabledChange:ut,onTogglePinned:zt?sa:void 0}),!i0&&a.jsx(H2,{isOpen:en,drawerWidthPx:on,onClose:()=>Or("right-sidebar"),onOpen:Us,rightSidebarFilePreviewOpen:ur,rightSidebarFilePreviewCloseSignal:xe,onOpenRightSidebarFilePreview:aa,onCloseRightSidebarFilePreview:Ma,rightSidebarRepoPickerOpen:Ie,rightSidebarRepoPickerCloseSignal:Pe,onOpenRightSidebarRepoPicker:Vi,onCloseRightSidebarRepoPicker:xo,markdownOutlineOpen:Mt,markdownOutlineCloseSignal:gr,onOpenMarkdownOutline:$o,onCloseMarkdownOutline:la,markdownImageLightboxOpen:gt,markdownImageLightboxCloseSignal:_t,onOpenMarkdownImageLightbox:Ra,onCloseMarkdownImageLightbox:Na,onTogglePinned:zt?Fo:void 0}),ue&&!c&&a.jsx("button",{type:"button",onClick:ca,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"})]})}),Bt&&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 ${Bt.tone==="success"?"border-[rgb(var(--success-rgb)_/_0.24)] bg-surface-elevated text-foreground":"border-destructive/30 bg-surface-elevated text-destructive"}`,role:Bt.tone==="error"?"alert":"status",children:[Bt.tone==="success"?a.jsx(C0,{size:14,className:"shrink-0 text-[color:var(--success)]"}):a.jsx(ld,{size:14,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1",children:Bt.message}),a.jsx("button",{type:"button",onClick:()=>wr(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(ys,{size:12})})]}),u&&a.jsxs(a.Fragment,{children:[!zt&&a.jsx(m9,{onClose:()=>f(!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:()=>f(!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(Te,null,2)})]})]})]}),K0=Ir?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 zt?a.jsxs("div",{className:"w-screen h-full flex flex-row",children:[Ai&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{width:Cn,flexShrink:0,height:"100%"},children:a.jsx(z2,{isOpen:Tr,drawerWidthPx:Cn,onClose:Za,onOpen:Gi,sessions:ve,activeSessionId:kt,sessionStates:Pt,onNewSession:C=>Go(C),recoverableTmuxSessions:n0,recoverableTmuxSessionsLoading:xn,onRefreshRecoverableTmuxSessions:()=>{fa()},onCloseSession:_l,onSplitSession:r0,onCloseSplit:C=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:C})),onRemoveFromSplit:C=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:C})),splitWorkspaces:jt,onSetSplitLayout:lu,onReorderSplitWorkspace:W0,onRenameSplitWorkspace:cu,onCombineSplitSessions:uu,onReorderSessions:$s,onSessionMenu:Qa,onOpenSettings:zo,onJumpToNextAttention:di.length>0?Ja:void 0,onOpenQuota:()=>Hs(!0),updateState:ie,updateActionPending:Xe,onConfirmUpdateRestart:or,onRetryUpdate:ws,tmuxAvailable:jr.available,defaultSessionMode:vn,runningSessionButtonEnabled:lt,onRunningSessionButtonEnabledChange:ut,pinned:!0,onTogglePinned:sa})}),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:oa})]}),a.jsxs("div",{className:"relative flex-1 min-w-0 h-full overflow-hidden",children:[hu,i0&&a.jsxs("div",{className:"absolute inset-y-0 right-0 z-20 flex",style:{width:Ll},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:Ya}),a.jsx("div",{style:{width:Sl,flexShrink:0,height:"100%"},children:a.jsx(H2,{isOpen:!0,drawerWidthPx:Sl,onClose:Uo,onOpen:Us,pinned:!0,onTogglePinned:Fo,rightSidebarFilePreviewOpen:ur,rightSidebarFilePreviewCloseSignal:xe,onOpenRightSidebarFilePreview:aa,onCloseRightSidebarFilePreview:Ma,rightSidebarRepoPickerOpen:Ie,rightSidebarRepoPickerCloseSignal:Pe,onOpenRightSidebarRepoPicker:Vi,onCloseRightSidebarRepoPicker:xo,markdownOutlineOpen:Mt,markdownOutlineCloseSignal:gr,onOpenMarkdownOutline:$o,onCloseMarkdownOutline:la,markdownImageLightboxOpen:gt,markdownImageLightboxCloseSignal:_t,onOpenMarkdownImageLightbox:Ra,onCloseMarkdownImageLightbox:Na})})]})]}),K0]}):a.jsxs(a.Fragment,{children:[hu,K0]})}const iB=Object.freeze(Object.defineProperty({__proto__:null,default:gQ},Symbol.toStringTag,{value:"Module"}));export{iB as A,RD as C,Fc as D,aD as F,ND as G,A8 as L,L8 as M,D8 as P,vs as R,zc as S,TC as T,kv as a,Lv as b,x5 as c,Oc as d,t8 as e,up as f,B8 as g,P8 as h,Uc as i,$c as j,O1 as k,A5 as l,q3 as m,Z8 as n,J8 as o,Hi as p,xx as q,rB as r,lg as s,K_ as t,Y_ as u,nB as v,sB as w,C9 as x};