termdock 1.4.243 → 1.4.245

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 (487) hide show
  1. package/dist/client/assets/App-4yuJhk8K.js +155 -0
  2. package/dist/client/assets/App-4yuJhk8K.js.br +0 -0
  3. package/dist/client/assets/App-4yuJhk8K.js.gz +0 -0
  4. package/dist/client/assets/{ChangeWalkthroughPanel-BOKLP0Aa.js → ChangeWalkthroughPanel-CO6hA8Zz.js} +1 -1
  5. package/dist/client/assets/ChangeWalkthroughPanel-CO6hA8Zz.js.br +0 -0
  6. package/dist/client/assets/ChangeWalkthroughPanel-CO6hA8Zz.js.gz +0 -0
  7. package/dist/client/assets/{DagPlayground-D-y62Yjj.js → DagPlayground-CYNBQUiS.js} +1 -1
  8. package/dist/client/assets/DagPlayground-CYNBQUiS.js.br +0 -0
  9. package/dist/client/assets/DagPlayground-CYNBQUiS.js.gz +0 -0
  10. package/dist/client/assets/{DiffLab-BmPowG45.js → DiffLab-D1EGXPSO.js} +1 -1
  11. package/dist/client/assets/DiffLab-D1EGXPSO.js.br +0 -0
  12. package/dist/client/assets/DiffLab-D1EGXPSO.js.gz +0 -0
  13. package/dist/client/assets/{DiffReview-CGVgXgpW.js → DiffReview-B3l9lyZN.js} +1 -1
  14. package/dist/client/assets/DiffReview-B3l9lyZN.js.br +0 -0
  15. package/dist/client/assets/DiffReview-B3l9lyZN.js.gz +0 -0
  16. package/dist/client/assets/{DiffReviewLab-CuzOT2xb.js → DiffReviewLab-HnyTETr4.js} +1 -1
  17. package/dist/client/assets/DiffReviewLab-HnyTETr4.js.br +0 -0
  18. package/dist/client/assets/DiffReviewLab-HnyTETr4.js.gz +0 -0
  19. package/dist/client/assets/{DiffViewer-BDHnNu2-.js → DiffViewer-Cg2L1fpw.js} +1 -1
  20. package/dist/client/assets/DiffViewer-Cg2L1fpw.js.br +0 -0
  21. package/dist/client/assets/DiffViewer-Cg2L1fpw.js.gz +0 -0
  22. package/dist/client/assets/{ModelPreview-WPo18n63.js → ModelPreview-m9zsjnCS.js} +1 -1
  23. package/dist/client/assets/ModelPreview-m9zsjnCS.js.br +0 -0
  24. package/dist/client/assets/ModelPreview-m9zsjnCS.js.gz +0 -0
  25. package/dist/client/assets/{RightSidebar-CC7yX38D.js → RightSidebar-D8UOa663.js} +29 -29
  26. package/dist/client/assets/RightSidebar-D8UOa663.js.br +0 -0
  27. package/dist/client/assets/RightSidebar-D8UOa663.js.gz +0 -0
  28. package/dist/client/assets/{abnfDiagram-VCTEODGH-Cg90MbDX.js → abnfDiagram-VCTEODGH-B6aAcqAH.js} +1 -1
  29. package/dist/client/assets/abnfDiagram-VCTEODGH-B6aAcqAH.js.br +0 -0
  30. package/dist/client/assets/abnfDiagram-VCTEODGH-B6aAcqAH.js.gz +0 -0
  31. package/dist/client/assets/app-DiN3Jz4F.js +35 -0
  32. package/dist/client/assets/app-DiN3Jz4F.js.br +0 -0
  33. package/dist/client/assets/app-DiN3Jz4F.js.gz +0 -0
  34. package/dist/client/assets/{arc-D5m1C5_F.js → arc-MDwycufi.js} +1 -1
  35. package/dist/client/assets/arc-MDwycufi.js.br +0 -0
  36. package/dist/client/assets/arc-MDwycufi.js.gz +0 -0
  37. package/dist/client/assets/{architectureDiagram-5GKGNRK7-CibYfpyp.js → architectureDiagram-5GKGNRK7-DpW68CEx.js} +1 -1
  38. package/dist/client/assets/architectureDiagram-5GKGNRK7-DpW68CEx.js.br +0 -0
  39. package/dist/client/assets/architectureDiagram-5GKGNRK7-DpW68CEx.js.gz +0 -0
  40. package/dist/client/assets/{blockDiagram-I7D4REHJ-rk7OY5q4.js → blockDiagram-I7D4REHJ-CZQQVsmh.js} +1 -1
  41. package/dist/client/assets/blockDiagram-I7D4REHJ-CZQQVsmh.js.br +0 -0
  42. package/dist/client/assets/blockDiagram-I7D4REHJ-CZQQVsmh.js.gz +0 -0
  43. package/dist/client/assets/{c4Diagram-7LVT6UL2-dOK22mdg.js → c4Diagram-7LVT6UL2-DjvDIEs1.js} +1 -1
  44. package/dist/client/assets/c4Diagram-7LVT6UL2-DjvDIEs1.js.br +0 -0
  45. package/dist/client/assets/c4Diagram-7LVT6UL2-DjvDIEs1.js.gz +0 -0
  46. package/dist/client/assets/channel-DXQeuo6Q.js +1 -0
  47. package/dist/client/assets/{chunk-2Q5K7J3B-BrhYtaF9.js → chunk-2Q5K7J3B-C7cBdwoS.js} +1 -1
  48. package/dist/client/assets/{chunk-5VM5RSS4-CnqKUXPl.js → chunk-5VM5RSS4-DdwZ_Ooa.js} +1 -1
  49. package/dist/client/assets/{chunk-F27PBJKO-Bdj77Kyj.js → chunk-F27PBJKO-CyDTfLmz.js} +1 -1
  50. package/dist/client/assets/chunk-F27PBJKO-CyDTfLmz.js.br +0 -0
  51. package/dist/client/assets/chunk-F27PBJKO-CyDTfLmz.js.gz +0 -0
  52. package/dist/client/assets/{chunk-IMKFNOWR-B8Gtv6AG.js → chunk-IMKFNOWR-BYCj4545.js} +1 -1
  53. package/dist/client/assets/chunk-IMKFNOWR-BYCj4545.js.br +0 -0
  54. package/dist/client/assets/chunk-IMKFNOWR-BYCj4545.js.gz +0 -0
  55. package/dist/client/assets/{chunk-JWPE2WC7-CM2Goygi.js → chunk-JWPE2WC7-Buwl5THX.js} +1 -1
  56. package/dist/client/assets/{chunk-POPQ4Y6H-C3BQ1qmP.js → chunk-POPQ4Y6H-C7p1ptYd.js} +1 -1
  57. package/dist/client/assets/{chunk-SVP7TREG-CjL_qH1j.js → chunk-SVP7TREG-Biy6yZrB.js} +1 -1
  58. package/dist/client/assets/chunk-SVP7TREG-Biy6yZrB.js.br +0 -0
  59. package/dist/client/assets/chunk-SVP7TREG-Biy6yZrB.js.gz +0 -0
  60. package/dist/client/assets/{chunk-TICWLB2K-B-ca5DIp.js → chunk-TICWLB2K-8e9Sd9jU.js} +1 -1
  61. package/dist/client/assets/chunk-TICWLB2K-8e9Sd9jU.js.br +0 -0
  62. package/dist/client/assets/chunk-TICWLB2K-8e9Sd9jU.js.gz +0 -0
  63. package/dist/client/assets/{chunk-XXDRQBXY-CbVj2dIw.js → chunk-XXDRQBXY-DECwND6H.js} +1 -1
  64. package/dist/client/assets/classDiagram-ZZMXUADV-u-fQC4d0.js +1 -0
  65. package/dist/client/assets/classDiagram-v2-VYDZK3BY-u-fQC4d0.js +1 -0
  66. package/dist/client/assets/{cose-bilkent-JH36ORCC-3DGxUNO0.js → cose-bilkent-JH36ORCC-PPh2sDUy.js} +1 -1
  67. package/dist/client/assets/cose-bilkent-JH36ORCC-PPh2sDUy.js.br +0 -0
  68. package/dist/client/assets/cose-bilkent-JH36ORCC-PPh2sDUy.js.gz +0 -0
  69. package/dist/client/assets/{cynefin-OW5HDTMX-CGuEp5qx.js → cynefin-OW5HDTMX-B11p1v5N.js} +1 -1
  70. package/dist/client/assets/cynefin-OW5HDTMX-B11p1v5N.js.br +0 -0
  71. package/dist/client/assets/cynefin-OW5HDTMX-B11p1v5N.js.gz +0 -0
  72. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-C72W7yEn.js → cynefinDiagram-5FMLGOSQ-BKyWp8p1.js} +1 -1
  73. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-BKyWp8p1.js.br +0 -0
  74. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-BKyWp8p1.js.gz +0 -0
  75. package/dist/client/assets/{dagre-GXQ25YYZ-BKQwdkXC.js → dagre-GXQ25YYZ-B79CVuuK.js} +1 -1
  76. package/dist/client/assets/dagre-GXQ25YYZ-B79CVuuK.js.br +0 -0
  77. package/dist/client/assets/dagre-GXQ25YYZ-B79CVuuK.js.gz +0 -0
  78. package/dist/client/assets/{diagram-S7CK7UJ4-BLMlGHfz.js → diagram-S7CK7UJ4-BKPJHT5i.js} +1 -1
  79. package/dist/client/assets/diagram-S7CK7UJ4-BKPJHT5i.js.br +0 -0
  80. package/dist/client/assets/diagram-S7CK7UJ4-BKPJHT5i.js.gz +0 -0
  81. package/dist/client/assets/{diagram-UQ7AKVKN-veBe9JyG.js → diagram-UQ7AKVKN-adkntJ-H.js} +1 -1
  82. package/dist/client/assets/diagram-UQ7AKVKN-adkntJ-H.js.br +0 -0
  83. package/dist/client/assets/diagram-UQ7AKVKN-adkntJ-H.js.gz +0 -0
  84. package/dist/client/assets/{diagram-VSXAHHWV-B-C7VeWe.js → diagram-VSXAHHWV-CGOHyiQX.js} +1 -1
  85. package/dist/client/assets/diagram-VSXAHHWV-CGOHyiQX.js.br +0 -0
  86. package/dist/client/assets/diagram-VSXAHHWV-CGOHyiQX.js.gz +0 -0
  87. package/dist/client/assets/{diagram-VX7I27RA-CvmZ0BA1.js → diagram-VX7I27RA-C6uqmbvW.js} +1 -1
  88. package/dist/client/assets/diagram-VX7I27RA-C6uqmbvW.js.br +0 -0
  89. package/dist/client/assets/diagram-VX7I27RA-C6uqmbvW.js.gz +0 -0
  90. package/dist/client/assets/{diagram-Z3DM3KII-BJ2L5PMj.js → diagram-Z3DM3KII-DRbP0rNc.js} +1 -1
  91. package/dist/client/assets/diagram-Z3DM3KII-DRbP0rNc.js.br +0 -0
  92. package/dist/client/assets/diagram-Z3DM3KII-DRbP0rNc.js.gz +0 -0
  93. package/dist/client/assets/{ebnfDiagram-PWID7BFC-BUY4xoiJ.js → ebnfDiagram-PWID7BFC-ZH3JjPxG.js} +1 -1
  94. package/dist/client/assets/ebnfDiagram-PWID7BFC-ZH3JjPxG.js.br +0 -0
  95. package/dist/client/assets/ebnfDiagram-PWID7BFC-ZH3JjPxG.js.gz +0 -0
  96. package/dist/client/assets/{erDiagram-RLTQ6QDP-Cz4eMcO7.js → erDiagram-RLTQ6QDP-2pB0nAqM.js} +1 -1
  97. package/dist/client/assets/erDiagram-RLTQ6QDP-2pB0nAqM.js.br +0 -0
  98. package/dist/client/assets/erDiagram-RLTQ6QDP-2pB0nAqM.js.gz +0 -0
  99. package/dist/client/assets/{flowDiagram-HODETNUW-CfUF4E27.js → flowDiagram-HODETNUW-g-NFSGVN.js} +1 -1
  100. package/dist/client/assets/flowDiagram-HODETNUW-g-NFSGVN.js.br +0 -0
  101. package/dist/client/assets/flowDiagram-HODETNUW-g-NFSGVN.js.gz +0 -0
  102. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-DMlqyly8.js → ganttDiagram-EL5Y4UJY-ou0k7MyH.js} +1 -1
  103. package/dist/client/assets/ganttDiagram-EL5Y4UJY-ou0k7MyH.js.br +0 -0
  104. package/dist/client/assets/ganttDiagram-EL5Y4UJY-ou0k7MyH.js.gz +0 -0
  105. package/dist/client/assets/{gestureArbiter-Ct7GE8Vn.js → gestureArbiter-BVGXbPvq.js} +1 -1
  106. package/dist/client/assets/gestureArbiter-BVGXbPvq.js.br +0 -0
  107. package/dist/client/assets/gestureArbiter-BVGXbPvq.js.gz +0 -0
  108. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-WxfCDRbn.js → gitGraphDiagram-WWUBYQGX-9FN50t1H.js} +1 -1
  109. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-9FN50t1H.js.br +0 -0
  110. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-9FN50t1H.js.gz +0 -0
  111. package/dist/client/assets/{infoDiagram-27XIBGKW-BWDhPWlk.js → infoDiagram-27XIBGKW-CDTlLBns.js} +1 -1
  112. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-DrqtXpGk.js → ishikawaDiagram-5VMMS53U-DJigQx1g.js} +1 -1
  113. package/dist/client/assets/ishikawaDiagram-5VMMS53U-DJigQx1g.js.br +0 -0
  114. package/dist/client/assets/ishikawaDiagram-5VMMS53U-DJigQx1g.js.gz +0 -0
  115. package/dist/client/assets/{journeyDiagram-3NMN7TZE-BUJu4ksN.js → journeyDiagram-3NMN7TZE-D2B7mocZ.js} +1 -1
  116. package/dist/client/assets/journeyDiagram-3NMN7TZE-D2B7mocZ.js.br +0 -0
  117. package/dist/client/assets/journeyDiagram-3NMN7TZE-D2B7mocZ.js.gz +0 -0
  118. package/dist/client/assets/{kanban-definition-UXKFOSKX-DkwvppsF.js → kanban-definition-UXKFOSKX-Dibgxrol.js} +1 -1
  119. package/dist/client/assets/kanban-definition-UXKFOSKX-Dibgxrol.js.br +0 -0
  120. package/dist/client/assets/kanban-definition-UXKFOSKX-Dibgxrol.js.gz +0 -0
  121. package/dist/client/assets/{layout-CXXsOUxv.js → layout-l7vsNiDT.js} +1 -1
  122. package/dist/client/assets/layout-l7vsNiDT.js.br +0 -0
  123. package/dist/client/assets/layout-l7vsNiDT.js.gz +0 -0
  124. package/dist/client/assets/{linear-D58UH8pU.js → linear-DYyWv-7A.js} +1 -1
  125. package/dist/client/assets/linear-DYyWv-7A.js.br +0 -0
  126. package/dist/client/assets/linear-DYyWv-7A.js.gz +0 -0
  127. package/dist/client/assets/{mermaid.core-DbPHytFc.js → mermaid.core-filx9uhD.js} +5 -5
  128. package/dist/client/assets/mermaid.core-filx9uhD.js.br +0 -0
  129. package/dist/client/assets/mermaid.core-filx9uhD.js.gz +0 -0
  130. package/dist/client/assets/{mindmap-definition-YA3MSWOX-Cw9Or2bt.js → mindmap-definition-YA3MSWOX-fs33msHm.js} +1 -1
  131. package/dist/client/assets/mindmap-definition-YA3MSWOX-fs33msHm.js.br +0 -0
  132. package/dist/client/assets/mindmap-definition-YA3MSWOX-fs33msHm.js.gz +0 -0
  133. package/dist/client/assets/{passwordBootstrap-D8_QAGU4.js → passwordBootstrap-v6a4CT6d.js} +1 -1
  134. package/dist/client/assets/passwordBootstrap-v6a4CT6d.js.br +0 -0
  135. package/dist/client/assets/passwordBootstrap-v6a4CT6d.js.gz +0 -0
  136. package/dist/client/assets/{pegDiagram-XKGWAZYB-D2BZC108.js → pegDiagram-XKGWAZYB-mdj0nBrT.js} +1 -1
  137. package/dist/client/assets/pegDiagram-XKGWAZYB-mdj0nBrT.js.br +0 -0
  138. package/dist/client/assets/pegDiagram-XKGWAZYB-mdj0nBrT.js.gz +0 -0
  139. package/dist/client/assets/{pieDiagram-E7YTZNPT-DWG3V8rh.js → pieDiagram-E7YTZNPT-YoRrPBgl.js} +1 -1
  140. package/dist/client/assets/pieDiagram-E7YTZNPT-YoRrPBgl.js.br +0 -0
  141. package/dist/client/assets/pieDiagram-E7YTZNPT-YoRrPBgl.js.gz +0 -0
  142. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-BUG1FEHA.js → quadrantDiagram-AXDQQJYC-DgZmaoSe.js} +1 -1
  143. package/dist/client/assets/quadrantDiagram-AXDQQJYC-DgZmaoSe.js.br +0 -0
  144. package/dist/client/assets/quadrantDiagram-AXDQQJYC-DgZmaoSe.js.gz +0 -0
  145. package/dist/client/assets/{railroadDiagram-O6MQD6OU-HNQAFV2N.js → railroadDiagram-O6MQD6OU-CnBSlDaa.js} +1 -1
  146. package/dist/client/assets/railroadDiagram-O6MQD6OU-CnBSlDaa.js.br +0 -0
  147. package/dist/client/assets/railroadDiagram-O6MQD6OU-CnBSlDaa.js.gz +0 -0
  148. package/dist/client/assets/{referenceLongPress-DjPrgH7e.js → referenceLongPress-DJsVBw_j.js} +1 -1
  149. package/dist/client/assets/referenceLongPress-DJsVBw_j.js.br +0 -0
  150. package/dist/client/assets/referenceLongPress-DJsVBw_j.js.gz +0 -0
  151. package/dist/client/assets/{requirementDiagram-BXWQKSXE-Q467WyDg.js → requirementDiagram-BXWQKSXE-BA9ZoM3G.js} +1 -1
  152. package/dist/client/assets/requirementDiagram-BXWQKSXE-BA9ZoM3G.js.br +0 -0
  153. package/dist/client/assets/requirementDiagram-BXWQKSXE-BA9ZoM3G.js.gz +0 -0
  154. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-BRhQkSIm.js → sankeyDiagram-P5KCCOFB-bcxqUb6q.js} +1 -1
  155. package/dist/client/assets/sankeyDiagram-P5KCCOFB-bcxqUb6q.js.br +0 -0
  156. package/dist/client/assets/sankeyDiagram-P5KCCOFB-bcxqUb6q.js.gz +0 -0
  157. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-Bwm7jKPw.js → sequenceDiagram-WJ2MYXX4-TLqeD9u8.js} +1 -1
  158. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-TLqeD9u8.js.br +0 -0
  159. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-TLqeD9u8.js.gz +0 -0
  160. package/dist/client/assets/{sizeCapture-INFHLROL-BzppmTFt.js → sizeCapture-INFHLROL-D180O8mH.js} +1 -1
  161. package/dist/client/assets/sizeCapture-INFHLROL-D180O8mH.js.br +0 -0
  162. package/dist/client/assets/sizeCapture-INFHLROL-D180O8mH.js.gz +0 -0
  163. package/dist/client/assets/{sparkles-Cx3WfNBe.js → sparkles-B2dq58Vr.js} +1 -1
  164. package/dist/client/assets/{stateDiagram-D77RDMKH-B0vmOYRa.js → stateDiagram-D77RDMKH-CVeaj7aj.js} +1 -1
  165. package/dist/client/assets/stateDiagram-D77RDMKH-CVeaj7aj.js.br +0 -0
  166. package/dist/client/assets/stateDiagram-D77RDMKH-CVeaj7aj.js.gz +0 -0
  167. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-Cja01XE6.js +1 -0
  168. package/dist/client/assets/{swimlanes-42K2YHIH-ClVJUm6S.js → swimlanes-42K2YHIH-BSfkryAI.js} +1 -1
  169. package/dist/client/assets/swimlanes-42K2YHIH-BSfkryAI.js.br +0 -0
  170. package/dist/client/assets/swimlanes-42K2YHIH-BSfkryAI.js.gz +0 -0
  171. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-Bt2D90qE.js +8 -0
  172. package/dist/client/assets/{timeline-definition-24CTP7MA-C55BHZGa.js → timeline-definition-24CTP7MA-CXrJcUqt.js} +1 -1
  173. package/dist/client/assets/timeline-definition-24CTP7MA-CXrJcUqt.js.br +0 -0
  174. package/dist/client/assets/timeline-definition-24CTP7MA-CXrJcUqt.js.gz +0 -0
  175. package/dist/client/assets/{triangle-alert-fkNWBAOB.js → triangle-alert-DiB-zDg8.js} +1 -1
  176. package/dist/client/assets/{vennDiagram-4TSXK5OY-Dn01JiD_.js → vennDiagram-4TSXK5OY-DUlZIoBs.js} +1 -1
  177. package/dist/client/assets/vennDiagram-4TSXK5OY-DUlZIoBs.js.br +0 -0
  178. package/dist/client/assets/{vennDiagram-4TSXK5OY-Dn01JiD_.js.gz → vennDiagram-4TSXK5OY-DUlZIoBs.js.gz} +0 -0
  179. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-CGkIhHWg.js → wardleyDiagram-VM6X3IG4-PW7fiK5-.js} +1 -1
  180. package/dist/client/assets/wardleyDiagram-VM6X3IG4-PW7fiK5-.js.br +0 -0
  181. package/dist/client/assets/wardleyDiagram-VM6X3IG4-PW7fiK5-.js.gz +0 -0
  182. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-BAaOu-kq.js → xychartDiagram-S5SC5T6Z-CGgWBXnk.js} +1 -1
  183. package/dist/client/assets/xychartDiagram-S5SC5T6Z-CGgWBXnk.js.br +0 -0
  184. package/dist/client/assets/xychartDiagram-S5SC5T6Z-CGgWBXnk.js.gz +0 -0
  185. package/dist/client/index.html +1 -1
  186. package/dist/client/index.html.br +0 -0
  187. package/dist/client/index.html.gz +0 -0
  188. package/dist/client/sw.js +1 -1
  189. package/dist/client/sw.js.br +0 -0
  190. package/dist/client/sw.js.gz +0 -0
  191. package/dist/server/agent/collaborationCli.js +4 -1
  192. package/dist/server/agent/collaborationPrompt.js +9 -1
  193. package/package.json +1 -1
  194. package/runtime-manifest.json +3 -3
  195. package/dist/client/apple-splash-default-1170x2532.png +0 -0
  196. package/dist/client/apple-splash-landscape-1136x640.png +0 -0
  197. package/dist/client/apple-splash-landscape-1334x750.png +0 -0
  198. package/dist/client/apple-splash-landscape-1792x828.png +0 -0
  199. package/dist/client/apple-splash-landscape-2048x1536.png +0 -0
  200. package/dist/client/apple-splash-landscape-2160x1620.png +0 -0
  201. package/dist/client/apple-splash-landscape-2208x1242.png +0 -0
  202. package/dist/client/apple-splash-landscape-2224x1668.png +0 -0
  203. package/dist/client/apple-splash-landscape-2266x1488.png +0 -0
  204. package/dist/client/apple-splash-landscape-2360x1640.png +0 -0
  205. package/dist/client/apple-splash-landscape-2388x1668.png +0 -0
  206. package/dist/client/apple-splash-landscape-2436x1125.png +0 -0
  207. package/dist/client/apple-splash-landscape-2532x1170.png +0 -0
  208. package/dist/client/apple-splash-landscape-2556x1179.png +0 -0
  209. package/dist/client/apple-splash-landscape-2622x1206.png +0 -0
  210. package/dist/client/apple-splash-landscape-2688x1242.png +0 -0
  211. package/dist/client/apple-splash-landscape-2732x2048.png +0 -0
  212. package/dist/client/apple-splash-landscape-2778x1284.png +0 -0
  213. package/dist/client/apple-splash-landscape-2796x1290.png +0 -0
  214. package/dist/client/apple-splash-landscape-2868x1320.png +0 -0
  215. package/dist/client/apple-splash-portrait-1125x2436.png +0 -0
  216. package/dist/client/apple-splash-portrait-1170x2532.png +0 -0
  217. package/dist/client/apple-splash-portrait-1179x2556.png +0 -0
  218. package/dist/client/apple-splash-portrait-1206x2622.png +0 -0
  219. package/dist/client/apple-splash-portrait-1242x2208.png +0 -0
  220. package/dist/client/apple-splash-portrait-1242x2688.png +0 -0
  221. package/dist/client/apple-splash-portrait-1284x2778.png +0 -0
  222. package/dist/client/apple-splash-portrait-1290x2796.png +0 -0
  223. package/dist/client/apple-splash-portrait-1320x2868.png +0 -0
  224. package/dist/client/apple-splash-portrait-1488x2266.png +0 -0
  225. package/dist/client/apple-splash-portrait-1536x2048.png +0 -0
  226. package/dist/client/apple-splash-portrait-1620x2160.png +0 -0
  227. package/dist/client/apple-splash-portrait-1640x2360.png +0 -0
  228. package/dist/client/apple-splash-portrait-1668x2224.png +0 -0
  229. package/dist/client/apple-splash-portrait-1668x2388.png +0 -0
  230. package/dist/client/apple-splash-portrait-2048x2732.png +0 -0
  231. package/dist/client/apple-splash-portrait-640x1136.png +0 -0
  232. package/dist/client/apple-splash-portrait-750x1334.png +0 -0
  233. package/dist/client/apple-splash-portrait-828x1792.png +0 -0
  234. package/dist/client/apple-touch-icon-180x180.png +0 -0
  235. package/dist/client/assets/App-DxuaHe8h.js +0 -155
  236. package/dist/client/assets/App-DxuaHe8h.js.br +0 -0
  237. package/dist/client/assets/App-DxuaHe8h.js.gz +0 -0
  238. package/dist/client/assets/ChangeWalkthroughPanel-BOKLP0Aa.js.br +0 -0
  239. package/dist/client/assets/ChangeWalkthroughPanel-BOKLP0Aa.js.gz +0 -0
  240. package/dist/client/assets/DagPlayground-D-y62Yjj.js.br +0 -0
  241. package/dist/client/assets/DagPlayground-D-y62Yjj.js.gz +0 -0
  242. package/dist/client/assets/DiffLab-BmPowG45.js.br +0 -0
  243. package/dist/client/assets/DiffLab-BmPowG45.js.gz +0 -0
  244. package/dist/client/assets/DiffReview-CGVgXgpW.js.br +0 -0
  245. package/dist/client/assets/DiffReview-CGVgXgpW.js.gz +0 -0
  246. package/dist/client/assets/DiffReviewLab-CuzOT2xb.js.br +0 -0
  247. package/dist/client/assets/DiffReviewLab-CuzOT2xb.js.gz +0 -0
  248. package/dist/client/assets/DiffViewer-BDHnNu2-.js.br +0 -0
  249. package/dist/client/assets/DiffViewer-BDHnNu2-.js.gz +0 -0
  250. package/dist/client/assets/ModelPreview-WPo18n63.js.br +0 -0
  251. package/dist/client/assets/ModelPreview-WPo18n63.js.gz +0 -0
  252. package/dist/client/assets/RightSidebar-CC7yX38D.js.br +0 -0
  253. package/dist/client/assets/RightSidebar-CC7yX38D.js.gz +0 -0
  254. package/dist/client/assets/abnfDiagram-VCTEODGH-Cg90MbDX.js.br +0 -0
  255. package/dist/client/assets/abnfDiagram-VCTEODGH-Cg90MbDX.js.gz +0 -0
  256. package/dist/client/assets/app-BiDthfAY.js +0 -35
  257. package/dist/client/assets/app-BiDthfAY.js.br +0 -0
  258. package/dist/client/assets/app-BiDthfAY.js.gz +0 -0
  259. package/dist/client/assets/arc-D5m1C5_F.js.br +0 -0
  260. package/dist/client/assets/arc-D5m1C5_F.js.gz +0 -0
  261. package/dist/client/assets/architectureDiagram-5GKGNRK7-CibYfpyp.js.br +0 -0
  262. package/dist/client/assets/architectureDiagram-5GKGNRK7-CibYfpyp.js.gz +0 -0
  263. package/dist/client/assets/blockDiagram-I7D4REHJ-rk7OY5q4.js.br +0 -0
  264. package/dist/client/assets/blockDiagram-I7D4REHJ-rk7OY5q4.js.gz +0 -0
  265. package/dist/client/assets/c4Diagram-7LVT6UL2-dOK22mdg.js.br +0 -0
  266. package/dist/client/assets/c4Diagram-7LVT6UL2-dOK22mdg.js.gz +0 -0
  267. package/dist/client/assets/channel-Ck5sO4Js.js +0 -1
  268. package/dist/client/assets/chunk-F27PBJKO-Bdj77Kyj.js.br +0 -0
  269. package/dist/client/assets/chunk-F27PBJKO-Bdj77Kyj.js.gz +0 -0
  270. package/dist/client/assets/chunk-IMKFNOWR-B8Gtv6AG.js.br +0 -0
  271. package/dist/client/assets/chunk-IMKFNOWR-B8Gtv6AG.js.gz +0 -0
  272. package/dist/client/assets/chunk-SVP7TREG-CjL_qH1j.js.br +0 -0
  273. package/dist/client/assets/chunk-SVP7TREG-CjL_qH1j.js.gz +0 -0
  274. package/dist/client/assets/chunk-TICWLB2K-B-ca5DIp.js.br +0 -0
  275. package/dist/client/assets/chunk-TICWLB2K-B-ca5DIp.js.gz +0 -0
  276. package/dist/client/assets/classDiagram-ZZMXUADV-9G7iCqG9.js +0 -1
  277. package/dist/client/assets/classDiagram-v2-VYDZK3BY-9G7iCqG9.js +0 -1
  278. package/dist/client/assets/cose-bilkent-JH36ORCC-3DGxUNO0.js.br +0 -0
  279. package/dist/client/assets/cose-bilkent-JH36ORCC-3DGxUNO0.js.gz +0 -0
  280. package/dist/client/assets/cynefin-OW5HDTMX-CGuEp5qx.js.br +0 -0
  281. package/dist/client/assets/cynefin-OW5HDTMX-CGuEp5qx.js.gz +0 -0
  282. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-C72W7yEn.js.br +0 -0
  283. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-C72W7yEn.js.gz +0 -0
  284. package/dist/client/assets/dagre-GXQ25YYZ-BKQwdkXC.js.br +0 -0
  285. package/dist/client/assets/dagre-GXQ25YYZ-BKQwdkXC.js.gz +0 -0
  286. package/dist/client/assets/diagram-S7CK7UJ4-BLMlGHfz.js.br +0 -0
  287. package/dist/client/assets/diagram-S7CK7UJ4-BLMlGHfz.js.gz +0 -0
  288. package/dist/client/assets/diagram-UQ7AKVKN-veBe9JyG.js.br +0 -0
  289. package/dist/client/assets/diagram-UQ7AKVKN-veBe9JyG.js.gz +0 -0
  290. package/dist/client/assets/diagram-VSXAHHWV-B-C7VeWe.js.br +0 -0
  291. package/dist/client/assets/diagram-VSXAHHWV-B-C7VeWe.js.gz +0 -0
  292. package/dist/client/assets/diagram-VX7I27RA-CvmZ0BA1.js.br +0 -0
  293. package/dist/client/assets/diagram-VX7I27RA-CvmZ0BA1.js.gz +0 -0
  294. package/dist/client/assets/diagram-Z3DM3KII-BJ2L5PMj.js.br +0 -0
  295. package/dist/client/assets/diagram-Z3DM3KII-BJ2L5PMj.js.gz +0 -0
  296. package/dist/client/assets/ebnfDiagram-PWID7BFC-BUY4xoiJ.js.br +0 -0
  297. package/dist/client/assets/ebnfDiagram-PWID7BFC-BUY4xoiJ.js.gz +0 -0
  298. package/dist/client/assets/erDiagram-RLTQ6QDP-Cz4eMcO7.js.br +0 -0
  299. package/dist/client/assets/erDiagram-RLTQ6QDP-Cz4eMcO7.js.gz +0 -0
  300. package/dist/client/assets/flowDiagram-HODETNUW-CfUF4E27.js.br +0 -0
  301. package/dist/client/assets/flowDiagram-HODETNUW-CfUF4E27.js.gz +0 -0
  302. package/dist/client/assets/ganttDiagram-EL5Y4UJY-DMlqyly8.js.br +0 -0
  303. package/dist/client/assets/ganttDiagram-EL5Y4UJY-DMlqyly8.js.gz +0 -0
  304. package/dist/client/assets/gestureArbiter-Ct7GE8Vn.js.br +0 -0
  305. package/dist/client/assets/gestureArbiter-Ct7GE8Vn.js.gz +0 -0
  306. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-WxfCDRbn.js.br +0 -0
  307. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-WxfCDRbn.js.gz +0 -0
  308. package/dist/client/assets/ishikawaDiagram-5VMMS53U-DrqtXpGk.js.br +0 -0
  309. package/dist/client/assets/ishikawaDiagram-5VMMS53U-DrqtXpGk.js.gz +0 -0
  310. package/dist/client/assets/journeyDiagram-3NMN7TZE-BUJu4ksN.js.br +0 -0
  311. package/dist/client/assets/journeyDiagram-3NMN7TZE-BUJu4ksN.js.gz +0 -0
  312. package/dist/client/assets/kanban-definition-UXKFOSKX-DkwvppsF.js.br +0 -0
  313. package/dist/client/assets/kanban-definition-UXKFOSKX-DkwvppsF.js.gz +0 -0
  314. package/dist/client/assets/layout-CXXsOUxv.js.br +0 -0
  315. package/dist/client/assets/layout-CXXsOUxv.js.gz +0 -0
  316. package/dist/client/assets/linear-D58UH8pU.js.br +0 -0
  317. package/dist/client/assets/linear-D58UH8pU.js.gz +0 -0
  318. package/dist/client/assets/mermaid.core-DbPHytFc.js.br +0 -0
  319. package/dist/client/assets/mermaid.core-DbPHytFc.js.gz +0 -0
  320. package/dist/client/assets/mindmap-definition-YA3MSWOX-Cw9Or2bt.js.br +0 -0
  321. package/dist/client/assets/mindmap-definition-YA3MSWOX-Cw9Or2bt.js.gz +0 -0
  322. package/dist/client/assets/passwordBootstrap-D8_QAGU4.js.br +0 -0
  323. package/dist/client/assets/passwordBootstrap-D8_QAGU4.js.gz +0 -0
  324. package/dist/client/assets/pegDiagram-XKGWAZYB-D2BZC108.js.br +0 -0
  325. package/dist/client/assets/pegDiagram-XKGWAZYB-D2BZC108.js.gz +0 -0
  326. package/dist/client/assets/pieDiagram-E7YTZNPT-DWG3V8rh.js.br +0 -0
  327. package/dist/client/assets/pieDiagram-E7YTZNPT-DWG3V8rh.js.gz +0 -0
  328. package/dist/client/assets/quadrantDiagram-AXDQQJYC-BUG1FEHA.js.br +0 -0
  329. package/dist/client/assets/quadrantDiagram-AXDQQJYC-BUG1FEHA.js.gz +0 -0
  330. package/dist/client/assets/railroadDiagram-O6MQD6OU-HNQAFV2N.js.br +0 -0
  331. package/dist/client/assets/railroadDiagram-O6MQD6OU-HNQAFV2N.js.gz +0 -0
  332. package/dist/client/assets/referenceLongPress-DjPrgH7e.js.br +0 -0
  333. package/dist/client/assets/referenceLongPress-DjPrgH7e.js.gz +0 -0
  334. package/dist/client/assets/requirementDiagram-BXWQKSXE-Q467WyDg.js.br +0 -0
  335. package/dist/client/assets/requirementDiagram-BXWQKSXE-Q467WyDg.js.gz +0 -0
  336. package/dist/client/assets/sankeyDiagram-P5KCCOFB-BRhQkSIm.js.br +0 -0
  337. package/dist/client/assets/sankeyDiagram-P5KCCOFB-BRhQkSIm.js.gz +0 -0
  338. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-Bwm7jKPw.js.br +0 -0
  339. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-Bwm7jKPw.js.gz +0 -0
  340. package/dist/client/assets/sizeCapture-INFHLROL-BzppmTFt.js.br +0 -0
  341. package/dist/client/assets/sizeCapture-INFHLROL-BzppmTFt.js.gz +0 -0
  342. package/dist/client/assets/stateDiagram-D77RDMKH-B0vmOYRa.js.br +0 -0
  343. package/dist/client/assets/stateDiagram-D77RDMKH-B0vmOYRa.js.gz +0 -0
  344. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CTEByrn1.js +0 -1
  345. package/dist/client/assets/swimlanes-42K2YHIH-ClVJUm6S.js.br +0 -0
  346. package/dist/client/assets/swimlanes-42K2YHIH-ClVJUm6S.js.gz +0 -0
  347. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-Dqn5Nbl_.js +0 -8
  348. package/dist/client/assets/timeline-definition-24CTP7MA-C55BHZGa.js.br +0 -0
  349. package/dist/client/assets/timeline-definition-24CTP7MA-C55BHZGa.js.gz +0 -0
  350. package/dist/client/assets/vennDiagram-4TSXK5OY-Dn01JiD_.js.br +0 -0
  351. package/dist/client/assets/wardleyDiagram-VM6X3IG4-CGkIhHWg.js.br +0 -0
  352. package/dist/client/assets/wardleyDiagram-VM6X3IG4-CGkIhHWg.js.gz +0 -0
  353. package/dist/client/assets/xychartDiagram-S5SC5T6Z-BAaOu-kq.js.br +0 -0
  354. package/dist/client/assets/xychartDiagram-S5SC5T6Z-BAaOu-kq.js.gz +0 -0
  355. package/dist/client/favicon.ico +0 -0
  356. package/dist/client/fonts/JetBrainsMonoNLNerdFontMono-Bold.woff2 +0 -0
  357. package/dist/client/fonts/JetBrainsMonoNLNerdFontMono-BoldItalic.woff2 +0 -0
  358. package/dist/client/fonts/JetBrainsMonoNLNerdFontMono-Italic.woff2 +0 -0
  359. package/dist/client/fonts/JetBrainsMonoNLNerdFontMono-Regular.woff2 +0 -0
  360. package/dist/client/fonts/NotoSansMonoCJKsc-Bold-Subset.woff2 +0 -0
  361. package/dist/client/fonts/NotoSansMonoCJKsc-Subset.woff2 +0 -0
  362. package/dist/client/fonts/NotoSansSymbols2-Subset.woff2 +0 -0
  363. package/dist/client/fonts/TermdockStarSymbol-Subset.woff2 +0 -0
  364. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Bold-icons-38-022d7c89c800.woff2 +0 -0
  365. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Bold-icons-39-63f8fa5b3eba.woff2 +0 -0
  366. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Bold-icons-3a-2d8d46cc4dca.woff2 +0 -0
  367. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Bold-icons-3b-e75aed5d3969.woff2 +0 -0
  368. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Bold-icons-3c-ac2534aae681.woff2 +0 -0
  369. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Bold-icons-3c0-8c49a98e75c4.woff2 +0 -0
  370. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Bold-icons-3c1-971c5e7a86ce.woff2 +0 -0
  371. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Bold-icons-3c2-e5c4893acfb9.woff2 +0 -0
  372. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Bold-icons-3c3-156f2560c871.woff2 +0 -0
  373. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Bold-icons-3c4-49f0d18a7492.woff2 +0 -0
  374. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Bold-icons-3c5-33d81ad28c5c.woff2 +0 -0
  375. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Bold-icons-3c6-5c301879d053.woff2 +0 -0
  376. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Bold-icons-3d-52c90894de44.woff2 +0 -0
  377. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Bold-text-9e8d9df2dd02.woff2 +0 -0
  378. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-BoldItalic-icons-38-7942d3c93afb.woff2 +0 -0
  379. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-BoldItalic-icons-39-19989a2be535.woff2 +0 -0
  380. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-BoldItalic-icons-3a-7786ff4a4dd9.woff2 +0 -0
  381. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-BoldItalic-icons-3b-a759fd623d7e.woff2 +0 -0
  382. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-BoldItalic-icons-3c-2a1178076740.woff2 +0 -0
  383. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-BoldItalic-icons-3c0-6f2c7518f354.woff2 +0 -0
  384. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-BoldItalic-icons-3c1-4bf64cae9dd2.woff2 +0 -0
  385. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-BoldItalic-icons-3c2-7f26d4c7240b.woff2 +0 -0
  386. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-BoldItalic-icons-3c3-fc8e5a85d620.woff2 +0 -0
  387. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-BoldItalic-icons-3c4-91819b7977d3.woff2 +0 -0
  388. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-BoldItalic-icons-3c5-26933eec54e2.woff2 +0 -0
  389. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-BoldItalic-icons-3c6-af186404c8af.woff2 +0 -0
  390. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-BoldItalic-icons-3d-b004d85f5642.woff2 +0 -0
  391. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-BoldItalic-text-da002b4e56d3.woff2 +0 -0
  392. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Italic-icons-38-b3e69191d92f.woff2 +0 -0
  393. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Italic-icons-39-c4d8d66882cb.woff2 +0 -0
  394. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Italic-icons-3a-27609324e8a3.woff2 +0 -0
  395. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Italic-icons-3b-5e73d85d7506.woff2 +0 -0
  396. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Italic-icons-3c-7e535d65bbdb.woff2 +0 -0
  397. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Italic-icons-3c0-6465060a06a1.woff2 +0 -0
  398. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Italic-icons-3c1-9fd72ccd9350.woff2 +0 -0
  399. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Italic-icons-3c2-ea7dd77de270.woff2 +0 -0
  400. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Italic-icons-3c3-12808f88907a.woff2 +0 -0
  401. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Italic-icons-3c4-14b598e5e739.woff2 +0 -0
  402. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Italic-icons-3c5-3d40530ce6c2.woff2 +0 -0
  403. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Italic-icons-3c6-7020aec0d9e1.woff2 +0 -0
  404. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Italic-icons-3d-19831897003a.woff2 +0 -0
  405. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Italic-text-b7a9c776b048.woff2 +0 -0
  406. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Regular-icons-38-a637901140d8.woff2 +0 -0
  407. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Regular-icons-39-838726e8eeca.woff2 +0 -0
  408. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Regular-icons-3a-ec149087d0b9.woff2 +0 -0
  409. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Regular-icons-3b-db8e5a24d580.woff2 +0 -0
  410. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Regular-icons-3c-2290d2ad4621.woff2 +0 -0
  411. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Regular-icons-3c0-3b9edaf85d65.woff2 +0 -0
  412. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Regular-icons-3c1-5e7fb0696bbc.woff2 +0 -0
  413. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Regular-icons-3c2-cfad2884adf5.woff2 +0 -0
  414. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Regular-icons-3c3-d641de88278b.woff2 +0 -0
  415. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Regular-icons-3c4-3b0227356b3b.woff2 +0 -0
  416. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Regular-icons-3c5-9dc67c4d20b4.woff2 +0 -0
  417. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Regular-icons-3c6-c5b444110c62.woff2 +0 -0
  418. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Regular-icons-3d-2b19b65bb43a.woff2 +0 -0
  419. package/dist/client/fonts/terminal/JetBrainsMonoNLNerdFontMono-Regular-text-d7b9316fdf4f.woff2 +0 -0
  420. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-4e-46bdca5c323f.woff2 +0 -0
  421. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-4f-17200dc0dd0d.woff2 +0 -0
  422. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-50-370e36250c30.woff2 +0 -0
  423. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-51-66352f738581.woff2 +0 -0
  424. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-52-191f4025d2b5.woff2 +0 -0
  425. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-53-fb0a637c39bf.woff2 +0 -0
  426. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-54-66f2e72c9ca0.woff2 +0 -0
  427. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-55-54b538fd4fd8.woff2 +0 -0
  428. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-56-88f45aeb2030.woff2 +0 -0
  429. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-57-154d4324f0ce.woff2 +0 -0
  430. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-58-1660c86b8a05.woff2 +0 -0
  431. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-59-31a4c5afa3aa.woff2 +0 -0
  432. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-5a-fa1d1941710e.woff2 +0 -0
  433. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-5b-031a2b2ebeb7.woff2 +0 -0
  434. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-5c-065b634c07b3.woff2 +0 -0
  435. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-5d-71f6cd3ed180.woff2 +0 -0
  436. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-5e-f59de7a6e5c5.woff2 +0 -0
  437. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-5f-8cbe737b6011.woff2 +0 -0
  438. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-60-22913526da09.woff2 +0 -0
  439. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-61-c810c1d1a3a3.woff2 +0 -0
  440. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-62-9464d5d87d65.woff2 +0 -0
  441. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-63-79564d99f5da.woff2 +0 -0
  442. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-64-4b7cff1dae6f.woff2 +0 -0
  443. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-65-8dd48db5e297.woff2 +0 -0
  444. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-66-a808e22a3d14.woff2 +0 -0
  445. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-67-ae5f61af3f79.woff2 +0 -0
  446. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-68-a46bf47bd9ba.woff2 +0 -0
  447. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-69-28210414eafb.woff2 +0 -0
  448. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-6a-6bfb1f5e4fb7.woff2 +0 -0
  449. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-6b-39be890e04e4.woff2 +0 -0
  450. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-6c-79a4ff740d98.woff2 +0 -0
  451. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-6d-2de5a763980e.woff2 +0 -0
  452. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-6e-8e55b339244d.woff2 +0 -0
  453. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-6f-a56caf9fc7fc.woff2 +0 -0
  454. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-70-d70c6ee8e03c.woff2 +0 -0
  455. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-71-ac6f5f86dfef.woff2 +0 -0
  456. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-72-db3d346ecc61.woff2 +0 -0
  457. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-73-e7371bd71f0b.woff2 +0 -0
  458. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-74-43946d9b2f0b.woff2 +0 -0
  459. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-75-ea7cf53e31fa.woff2 +0 -0
  460. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-76-04c7fa4e0ebf.woff2 +0 -0
  461. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-77-24d70898f6b8.woff2 +0 -0
  462. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-78-c6a5d7135296.woff2 +0 -0
  463. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-79-7812cb6432aa.woff2 +0 -0
  464. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-7a-6e123be5cd36.woff2 +0 -0
  465. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-7b-a183ddc6890f.woff2 +0 -0
  466. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-7c-0895291ece9c.woff2 +0 -0
  467. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-7d-1d44252384cf.woff2 +0 -0
  468. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-7e-7be4dc6f056e.woff2 +0 -0
  469. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-7f-0d8e987db151.woff2 +0 -0
  470. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-80-c0c154bb8be0.woff2 +0 -0
  471. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-81-5343baca5ce7.woff2 +0 -0
  472. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-82-6d89af9614ce.woff2 +0 -0
  473. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-83-fa17ef529c5b.woff2 +0 -0
  474. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-84-287ecb493fad.woff2 +0 -0
  475. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-85-fea695c48165.woff2 +0 -0
  476. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-86-8bb35373cb82.woff2 +0 -0
  477. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-87-f83e9f70a6cc.woff2 +0 -0
  478. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-88-894cd19292c1.woff2 +0 -0
  479. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-89-2903a6eaf546.woff2 +0 -0
  480. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-8a-3ce275bfcf96.woff2 +0 -0
  481. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-8b-3aaeb26309a6.woff2 +0 -0
  482. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-8c-719b6608b746.woff2 +0 -0
  483. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-8d-a7f1ccd0dfb7.woff2 +0 -0
  484. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-8e-d503ad5c4958.woff2 +0 -0
  485. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-8f-18c6d04746c8.woff2 +0 -0
  486. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-90-e9d94d915dfe.woff2 +0 -0
  487. package/dist/client/fonts/terminal/NotoSansMonoCJKsc-Bold-Subset-cjk-91-c258b07ec626.woff2 +0 -0
@@ -0,0 +1,155 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RightSidebar-D8UOa663.js","assets/app-DiN3Jz4F.js","assets/react-XDCjal2T.js","assets/dnd-BCFAPC0L.js","assets/terminal-C7X98Amf.js","assets/index-fjWWhVQp.css","assets/gestureArbiter-BVGXbPvq.js","assets/gestureArbiter-C2J0D0kV.css","assets/DiffReview-B3l9lyZN.js","assets/sparkles-B2dq58Vr.js","assets/DiffViewer-Cg2L1fpw.js","assets/referenceLongPress-DJsVBw_j.js","assets/DiffViewer-T3uj2-aP.css","assets/triangle-alert-DiB-zDg8.js","assets/ChangeWalkthroughPanel-CO6hA8Zz.js","assets/RightSidebar-DW-JEgm2.css"])))=>i.map(i=>d[i]);
2
+ import{a3 as nr,a0 as Uy,bc as a,cM as Ta,cC as jo,cE as Ws,aL as V0,R as Qu,ci as $y,cD as Zd,aQ as na,cF as Gr,a2 as j0,bZ as Lh,cq as zy,ad as Pc,bb as Oc,f as Hy,cd as dd,H as Wy,aU as Bf,bk as jf,ca as Gy,aj as Vy,bU as qy,Q as R5,bS as Zy,c8 as N5,Z as Yy,a4 as Ky,L as Sn,C as Uo,X as ws,e as Xy,c as Cl,aZ as Jy,aK as Pf,cK as Qr,bj as _p,cJ as Ft,ao as ev,cR as tv,o as rv,bq as nv,bD as sv,bt as iv,c6 as W1,c7 as G1,c9 as V1,W as q1,bC as ov,cj as av,m as Z1,cB as lv,aS as cv,h as uv,aI as Ca,T as $o,cI as dv,bV as hv,aa as fv,a8 as Cd,aH as pv,bA as mv,bB as gv,P as D5,V as Y1,br as xv,be as Q5,k as Ri,aw as Zc,I as hd,cr as kh,cH as bv,aY as La,cO as yv,B as Kl,d as hu,n as vv,a7 as wv,x as Of,c3 as Av,g as P0,b7 as Tv,b8 as Cv,ac as B5,am as j5,cp as P5,bf as Sv,bh as O5,U as Xl,bX as _v,j as F5,bH as Lv,cb as kv,b_ as Iv,bF as Ev,ah as K1,c4 as Mv,bG as Lp,bi as X1,c1 as Hc,bJ as U5,cn as Rv,c5 as Nv,bs as $5,c0 as Dv,cc as Qv,ai as Bv,bg as J1,as as jv,aJ as Pv,D as Ov,ar as em,bm as Fv,bK as z5,S as Uv,bp as $v,l as zv,bn as Hv,bI as Wv,_ as Gv,bE as Vv,af as qv,al as Zv,an as Yv,aT as lc,b1 as Kv,cx as Xv,b2 as Jv,ab as e7,cz as t7,z as r7,a6 as n7,a1 as s7,A as i7,M as o7,cL as a7,bu as p0,aP as l7,aM as c7,aN as u7,aO as d7,aF as Ih,bv as h7,bO as f7,bW as p7,aR as m7,co as tm,Y as g7,G as x7,cv as b7,cP as Vn,cl as y7,aE as v7,aV as rm,bN as w7,ch as Bu,cu as cc,cy as A7,bP as T7,cm as C7,ce as S7,ct as Eh,cf as _7,cg as L7,cG as k7,a9 as I7,c2 as uc,t as E7,bl as M7,ba as ju,b9 as R7,bL as nm,bQ as N7,bM as m0,bR as D7,O as Q7,$ as B7}from"./app-DiN3Jz4F.js";import{R as S,b as A,r as qa,a as j7}from"./dnd-BCFAPC0L.js";import{b as P7,c as O7,F as Jl,S as F7,e as U7,h as $7,r as z7,y as H7,d as W7,u as G7}from"./gestureArbiter-BVGXbPvq.js";import{L as V7,l as q7}from"./terminal-C7X98Amf.js";import{T as H5,L as O0,M as Z7,G as Y7,C as sm}from"./triangle-alert-DiB-zDg8.js";import{r as K7}from"./react-XDCjal2T.js";import{u as kp,G as X7}from"./referenceLongPress-DJsVBw_j.js";const J7=[["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"}]],e8=nr("app-window",J7);const t8=[["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"}]],r8=nr("arrow-down-a-z",t8);const n8=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],s8=nr("arrow-down",n8);const i8=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],W5=nr("arrow-up",i8);const o8=[["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"}]],a8=nr("bell",o8);const l8=[["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"}]],Yd=nr("bot",l8);const c8=[["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"}]],u8=nr("box",c8);const d8=[["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"}]],h8=nr("cable",d8);const f8=[["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"}]],p8=nr("calendar-clock",f8);const m8=[["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"}]],g8=nr("chart-bar",m8);const x8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],b8=nr("circle-dot",x8);const y8=[["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"}]],Sd=nr("circle-question-mark",y8);const v8=[["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"}]],w8=nr("clipboard-paste",v8);const A8=[["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"}]],G5=nr("clipboard",A8);const T8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],Yc=nr("clock-3",T8);const C8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],S8=nr("clock",C8);const _8=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],L8=nr("code",_8);const k8=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],zl=nr("columns-2",k8);const I8=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],E8=nr("corner-down-left",I8);const M8=[["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"}]],Kc=nr("download",M8);const R8=[["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"}]],Ip=nr("external-link",R8);const N8=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],D8=nr("file-code",N8);const Q8=[["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"}]],B8=nr("file-up",Q8);const j8=[["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=nr("file",j8);const P8=[["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"}]],N0=nr("folder-open",P8);const O8=[["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"}]],Ep=nr("folder-search",O8);const F8=[["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"}]],U8=nr("folder-tree",F8);const $8=[["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"}]],im=nr("grid-2x2",$8);const z8=[["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"}]],Kd=nr("grip-vertical",z8);const H8=[["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"}]],W8=nr("hash",H8);const G8=[["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"}]],Hl=nr("history",G8);const V8=[["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"}]],q8=nr("keyboard",V8);const Z8=[["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"}]],Y8=nr("layers",Z8);const K8=[["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"}]],F0=nr("layout-grid",K8);const X8=[["path",{d:"M5 12h14",key:"1ays0h"}]],J8=nr("minus",X8);const e9=[["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"}]],t9=nr("moon",e9);const r9=[["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"}]],n9=nr("move",r9);const s9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],i9=nr("panel-left",s9);const o9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],q5=nr("panel-right",o9);const a9=[["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"}]],l9=nr("pause",a9);const c9=[["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"}]],u9=nr("pen-line",c9);const d9=[["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"}]],h9=nr("pencil-line",d9);const f9=[["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"}]],Xc=nr("pin",f9);const p9=[["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"}]],Jc=nr("pin-off",p9);const m9=[["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"}]],om=nr("play",m9);const g9=[["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"}]],As=nr("refresh-cw",g9);const x9=[["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"}]],Z5=nr("rotate-ccw",x9);const b9=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],am=nr("rows-2",b9);const y9=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],eu=nr("search",y9);const v9=[["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"}]],w9=nr("settings",v9);const A9=[["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"}]],T9=nr("sliders-horizontal",A9);const C9=[["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"}]],S9=nr("stethoscope",C9);const _9=[["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"}]],L9=nr("sun",_9);const k9=[["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"}]],qi=nr("trash-2",k9);const I9=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],E9=nr("type",I9);const M9=[["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=nr("unlink",M9);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"}]],D9=nr("unplug",N9);const Q9=[["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"}]],B9=nr("video",Q9);const j9=[["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"}]],P9=nr("wand-sparkles",j9);const O9=[["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"}]],lm=nr("workflow",O9);function F9(e,t){return e==="webgl"&&t}function U9(e){return e.isActive&&e.viewportFocused&&e.documentVisible&&e.windowFocused&&e.streamReady}function $9(e){return e.isActive&&e.documentVisible&&e.streamReady&&(!e.isDesktop||e.windowFocused)}function z9(e){return e.isActive&&!e.isMobile&&e.documentVisible&&!e.activeElementIsEditable}function H9(e,t){return!e&&t}const Wc=Uy(e=>({collaborationGroups:[],setCollaborationGroups:t=>e(r=>({collaborationGroups:typeof t=="function"?t(r.collaborationGroups):t}))}));function cm(){const e=Ta(),t=e.visualViewport,r=document.documentElement.style,s=g=>g===void 0?"?":Math.round(g),i=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(),p=document.getElementById("root")?.getBoundingClientRect();return[`VVP ${s(t?.height)} off ${s(t?.offsetTop)} win ${e.innerHeight}`,`base ${i("--app-base-vh")} kb ${i("--kb-height")} move ${i("--kb-translate-y")}`,`bar ${s(f?.top)}…${s(f?.bottom)} h ${s(f?.height)} root ${s(p?.bottom)}`,`safe ${i("--safe-top-inset")}/${i("--safe-bottom-inset")} frame ${e!==window?"child":"root"} focus ${document.activeElement?.tagName??"?"}`].join(`
3
+ `)}function W9({onClose:e}){const[t,r]=S.useState(cm);return S.useEffect(()=>{const s=window.setInterval(()=>r(cm()),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})]})}const G9={x:0,y:0,width:1,height:1};function Gl(e){return"id"in e?[e.id]:[...Gl(e.first),...Gl(e.second)]}function Ff(e,t=0,r=new Set){if(!e||typeof e!="object"||t>24)return null;const s=e;if(typeof s.id=="string"&&s.id&&!r.has(s.id))return r.add(s.id),{id:s.id};if(!["x","y"].includes(String(s.axis))||!Number.isFinite(s.ratio))return null;const i=Ff(s.first,t+1,r),c=Ff(s.second,t+1,r);return i&&c?{axis:s.axis,ratio:Math.max(.02,Math.min(.98,Number(s.ratio))),first:i,second:c}:i??c}function tu(e,t){if("id"in e)return t.has(e.id)?e:null;const r=tu(e.first,t),s=tu(e.second,t);return r&&s?{...e,first:r,second:s}:r??s}function _d(e,t,r,s){return"id"in e?e.id===t?{axis:s==="left"||s==="right"?"x":"y",ratio:.5,first:s==="left"||s==="top"?{id:r}:e,second:s==="left"||s==="top"?e:{id:r}}:e:{...e,first:_d(e.first,t,r,s),second:_d(e.second,t,r,s)}}function V9(e,t,r,s){if(t===r||!Gl(e).includes(t)||!Gl(e).includes(r))return e;if(s==="center"){const i=c=>"id"in c?{id:c.id===t?r:c.id===r?t:c.id}:{...c,first:i(c.first),second:i(c.second)};return i(e)}return _d(tu(e,new Set(Gl(e).filter(i=>i!==t))),r,t,s)}function D0(e,t){if(e.length===1)return{id:e[0]};if(t==="grid"&&e.length>2){const r=Math.ceil(e.length/2);return{axis:"y",ratio:.5,first:D0(e.slice(0,r),"horizontal"),second:D0(e.slice(r),"horizontal")}}return{axis:t==="vertical"?"y":"x",ratio:1/e.length,first:{id:e[0]},second:D0(e.slice(1),t)}}function Uf(e,t=G9,r=""){if("id"in e)return{panes:[{id:e.id,rect:t}],dividers:[]};const s={...t},i={...t};e.axis==="x"?(s.width*=e.ratio,i.x+=s.width,i.width-=s.width):(s.height*=e.ratio,i.y+=s.height,i.height-=s.height);const c=Uf(e.first,s,r+"0"),u=Uf(e.second,i,r+"1");return{panes:[...c.panes,...u.panes],dividers:[{path:r,node:e,rect:t},...c.dividers,...u.dividers]}}function Gc(e,t,r){return"id"in e?e:t?t[0]==="0"?{...e,first:Gc(e.first,t.slice(1),r)}:{...e,second:Gc(e.second,t.slice(1),r)}:{...e,ratio:r}}function Y5(e){return"id"in e||"id"in e.first||"id"in e.second||e.first.axis===e.axis||e.second.axis===e.axis||!("id"in e.first.first)||!("id"in e.first.second)||!("id"in e.second.first)||!("id"in e.second.second)?null:e.axis==="y"?{ids:[e.first.first.id,e.first.second.id,e.second.first.id,e.second.second.id],top:e.first.ratio,bottom:e.second.ratio,left:e.ratio,right:e.ratio}:{ids:[e.first.first.id,e.second.first.id,e.first.second.id,e.second.second.id],top:e.ratio,bottom:e.ratio,left:e.first.ratio,right:e.second.ratio}}function Mh(e,t,r){const s=Y5(e);if(!s)return e;const[i,c,u,f]=s.ids.map(p=>({id:p}));return t==="top"||t==="bottom"?{axis:"y",ratio:(s.left+s.right)/2,first:{axis:"x",ratio:t==="top"?r:s.top,first:i,second:c},second:{axis:"x",ratio:t==="bottom"?r:s.bottom,first:u,second:f}}:{axis:"x",ratio:(s.top+s.bottom)/2,first:{axis:"y",ratio:t==="left"?r:s.left,first:i,second:u},second:{axis:"y",ratio:t==="right"?r:s.right,first:c,second:f}}}function q9(e,t,r,s,i){const c=(p,g,x)=>{if(p.length===1)return p[0];const b=x?.length===p.length&&x.every(v=>Number.isFinite(v)&&v>0)?x:p.map(()=>1);return{axis:g,ratio:b[0]/b.reduce((v,w)=>v+w,0),first:p[0],second:c(p.slice(1),g,b.slice(1))}};if(t!=="grid")return c(e.map(p=>({id:p})),t==="vertical"?"y":"x",r);const u=Math.ceil(Math.sqrt(e.length)),f=[];for(let p=0;p<e.length;p+=u){const g=e.slice(p,p+u).map(b=>({id:b})),x=s?.length===u?s.slice(0,g.length):void 0;x&&g.length<u&&(x[x.length-1]+=s.slice(g.length).reduce((b,v)=>b+v,0)),f.push(c(g,"x",x))}return c(f,"y",i)}let Z9;function Xd(){try{const e="termdock-collaboration-panel-client",t=localStorage.getItem(e);if(t)return t;const r=crypto.randomUUID();return localStorage.setItem(e,r),r}catch{return Z9??=crypto.randomUUID()}}let um=Promise.resolve();function Wa(e,t){t&&(e={groups:{[t]:e}});const r=Xd(),s=um.catch(()=>{}).then(()=>jo({collaborationPanel:{clientId:r,state:e}}));return um=s,s.then(()=>{})}function dm(e,t,r,s,i,c){return{x:i>0?Math.max(0,Math.min(1,(e-r)/i)):.5,y:c>0?Math.max(0,Math.min(1,(t-s)/c)):.5}}function K5(e,t){return t?{...{...e?.floatingGroupId===t?e:{},...e?.groups?.[t]},drafts:e?.drafts}:{drafts:e?.drafts}}function X5(e){const t=Object.entries(e?.groups??{}).filter(([,r])=>r.floatingGroupId).map(([r])=>r);return e?.floatingGroupId&&!e.groups?.[e.floatingGroupId]&&t.push(e.floatingGroupId),t}const Y9=e=>e.startsWith("@collaboration:"),hm=e=>({left:`${e.x*100}%`,top:`${e.y*100}%`,width:`${e.width*100}%`,height:`${e.height*100}%`});function K9({groupId:e}){const t=Ws(s=>s.setHost),r=A.useCallback(s=>t(e,s),[e,t]);return a.jsx("div",{ref:r,className:"h-full min-h-0 min-w-0 bg-surface"})}function fm({layoutId:e,panes:t,preset:r="grid",initialTree:s,focusId:i,mobile:c=!1}){const u=Ws(ee=>ee.docks),f=JSON.stringify(t.map(ee=>ee.id)),p=Object.entries(u).filter(([,ee])=>t.some(ye=>ye.id===ee.sessionId)),g=JSON.stringify(p),x=A.useRef(null),[b,v]=A.useState(()=>s??D0(t.map(ee=>ee.id),c?"vertical":r)),w=A.useRef(b);w.current=b;const[k,I]=A.useState(!1),N=Ws(ee=>ee.activePaneId),[M,D]=A.useState(null),[F,Z]=A.useState(null),[G,U]=A.useState(null),q=A.useRef(r),pe=A.useRef(t.map(ee=>ee.id)),Ue=A.useRef({}),be=A.useRef(!1),Ae=()=>{be.current&&(be.current=!1,Wa({layouts:{[e]:w.current}}).catch(()=>{be.current=!0,D("布局保存失败,调整后重试")}))};A.useEffect(()=>{let ee=!1;return V0().then(ye=>{if(ee)return;const ce=ye.collaborationPanels?.[Xd()];for(const at of X5(ce)){const _e=K5(ce,at);_e.mode==="docked"&&_e.dock&&t.some($=>$.id===_e.dock.sessionId)&&!Ws.getState().docks[at]&&Ws.getState().setDock(at,_e.dock)}let Ye=Ff(ce?.layouts?.[e]);if(Ye&&ce?.floatingGroupId){const at=_e=>"id"in _e?{id:_e.id==="@collaboration"?Qu(ce.floatingGroupId):_e.id}:{..._e,first:at(_e.first),second:at(_e.second)};Ye=at(Ye)}Ye&&v(Ye),I(!0)}).catch(()=>{ee||D("布局加载失败,请刷新重试")}),()=>{ee=!0}},[e]);const Ke=ee=>{be.current=!0,w.current=ee,v(ee)};A.useLayoutEffect(()=>{if(!k)return;const ee=JSON.parse(f),ye=q.current!==r;q.current=r;let ce=ye?D0(ee,r):w.current;const Ye=pe.current;if(!ye&&Ye.length===ee.length&&Ye.every($=>ee.includes($))&&Ye.some(($,$e)=>$!==ee[$e])){const $=new Map(Ye.map((Xe,Le)=>[Xe,ee[Le]])),$e=Xe=>"id"in Xe?{id:$.get(Xe.id)??Xe.id}:{...Xe,first:$e(Xe.first),second:$e(Xe.second)};ce=$e(ce)}pe.current=ee;const at=new Set([...ee,...p.map(([$])=>Qu($))]);ce=tu(ce,at)??D0(ee,r);for(const $ of ee)Gl(ce).includes($)||(ce={axis:"x",ratio:.5,first:ce,second:{id:$}});const _e={};for(const[$,$e]of p){const Xe=Qu($),Le=`${$e.sessionId}:${$e.side}`;_e[$]=Le,(!Gl(ce).includes(Xe)||Ue.current[$]&&Ue.current[$]!==Le)&&(ce=tu(ce,new Set([...at].filter(K=>K!==Xe))),ce=_d(ce,$e.sessionId,Xe,$e.side))}Ue.current=_e,JSON.stringify(ce)!==JSON.stringify(w.current)&&(Ke(ce),Ae())},[k,f,r,g]),A.useEffect(()=>{const ee=()=>Ae();return window.addEventListener("pagehide",ee),()=>{window.removeEventListener("pagehide",ee),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),ee()}},[e]);const qe=Uf(b),ie=Y5(b),Se=[...t,...p.map(([ee])=>({id:Qu(ee),content:a.jsx(K9,{groupId:ee})}))],tt=A.useRef(null),Ee=A.useRef(G);Ee.current=G;const oe=A.useRef(null);A.useEffect(()=>{const ee=x.current;if(!ee||!k)return;const ye=Ye=>{if(Ye.button!==0||!(Ye.target instanceof Element))return;const at=Ye.target.closest("[data-split-pane-title], [data-panel-drag-title]"),_e=Ye.target.closest("button, a, input, textarea, select");if(!at||_e&&_e!==at)return;const $=at.closest("[data-layout-pane]");if(!$||!ee.contains($))return;document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}}));const $e=$.getBoundingClientRect();tt.current={id:$.dataset.layoutPane,x:Ye.clientX,y:Ye.clientY,moved:!1,originX:Ye.clientX-$e.left,originY:Ye.clientY-$e.top,scale:Math.min(.8,480/Math.max(1,$e.width),320/Math.max(1,$e.height))},ee.setPointerCapture?.(Ye.pointerId)},ce=Ye=>{const at=Ye.target;if(!(at instanceof Element))return;const _e=at.closest("[data-layout-pane]");if(!(!_e||!ee.contains(_e))){if(Ye.type==="pointerdown"&&Ws.getState().activePaneId!==_e.dataset.layoutPane){const $=document.activeElement;$ instanceof HTMLElement&&$.closest("[data-layout-pane]")&&!_e.contains($)&&$.blur();const $e=window.getSelection();$e?.anchorNode&&!_e.contains($e.anchorNode)&&$e.removeAllRanges()}Ws.getState().setActivePane(_e.dataset.layoutPane)}};return ee.addEventListener("pointerdown",ce,!0),ee.addEventListener("focusin",ce,!0),ee.addEventListener("pointerdown",ye,!0),()=>{ee.removeEventListener("pointerdown",ye,!0),ee.removeEventListener("pointerdown",ce,!0),ee.removeEventListener("focusin",ce,!0)}},[k]);const de=(ee,ye)=>{const ce=x.current?.getBoundingClientRect(),Ye=oe.current;if(!ce||!Ye)return;const at=Ye.axis==="x"?ce.width*Ye.rect.width:ce.height*Ye.rect.height,_e=Ye.axis==="x"?ce.left+ce.width*Ye.rect.x:ce.top+ce.height*Ye.rect.y,$=Math.min(.45,(c?48:120)/Math.max(1,at)),$e=Math.max($,Math.min(1-$,((Ye.axis==="x"?ee:ye)-_e)/Math.max(1,at)));Ke(Ye.side?Mh(w.current,Ye.side,$e):Gc(w.current,Ye.path,$e))},Te=ie?[{key:"top",side:"top",axis:"x",x:ie.top,y:0,length:(ie.left+ie.right)/2},{key:"bottom",side:"bottom",axis:"x",x:ie.bottom,y:(ie.left+ie.right)/2,length:1-(ie.left+ie.right)/2},{key:"left",side:"left",axis:"y",x:0,y:ie.left,length:(ie.top+ie.bottom)/2},{key:"right",side:"right",axis:"y",x:(ie.top+ie.bottom)/2,y:ie.right,length:1-(ie.top+ie.bottom)/2}].map(ee=>({...ee,rect:{x:0,y:0,width:1,height:1},path:void 0})):qe.dividers.map(ee=>({key:ee.path,path:ee.path,side:void 0,axis:ee.node.axis,rect:ee.rect,x:ee.rect.x+(ee.node.axis==="x"?ee.rect.width*ee.node.ratio:0),y:ee.rect.y+(ee.node.axis==="y"?ee.rect.height*ee.node.ratio:0),length:ee.node.axis==="x"?ee.rect.height:ee.rect.width}));return a.jsxs("div",{ref:x,"data-split-container":"true",className:"relative h-full min-h-0 min-w-0 flex-1 overflow-hidden bg-border [&_[data-split-pane-title]]:touch-none [&_[data-panel-drag-title]]:touch-none",onPointerMove:ee=>{if(oe.current){ee.preventDefault(),de(ee.clientX,ee.clientY);return}const ye=tt.current,ce=x.current?.getBoundingClientRect();if(!ye||!ce||!ye.moved&&Math.hypot(ee.clientX-ye.x,ee.clientY-ye.y)<6)return;ye.moved=!0,Z({id:ye.id,dx:ee.clientX-ye.x,dy:ee.clientY-ye.y,originX:ye.originX,originY:ye.originY,scale:ye.scale});const Ye=(ee.clientX-ce.left)/ce.width,at=(ee.clientY-ce.top)/ce.height,_e=qe.panes.find(K=>Ye>=K.rect.x&&Ye<=K.rect.x+K.rect.width&&at>=K.rect.y&&at<=K.rect.y+K.rect.height);if(!_e||_e.id===ye.id){Ee.current=null,U(null);return}const $=(Ye-_e.rect.x)/_e.rect.width,$e=(at-_e.rect.y)/_e.rect.height,Xe=Math.min($,1-$,$e,1-$e)>.25?"center":$<1-$&&$<=$e&&$<=1-$e?"left":1-$<=$e&&1-$<=1-$e?"right":$e<1-$e?"top":"bottom",Le={id:_e.id,side:Xe};Ee.current=Le,U(Le)},onPointerUp:ee=>{oe.current&&(oe.current=null,Ae()),tt.current?.moved&&Ee.current&&(Ke(V9(w.current,tt.current.id,Ee.current.id,Ee.current.side)),Ae()),tt.current=null,Ee.current=null,U(null),Z(null),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),ee.currentTarget.hasPointerCapture?.(ee.pointerId)&&ee.currentTarget.releasePointerCapture(ee.pointerId)},onLostPointerCapture:()=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),oe.current=null,tt.current=null,Ee.current=null,U(null),Z(null),Ae()},onKeyDownCapture:ee=>{ee.key==="Escape"&&(tt.current=null,Ee.current=null,U(null),Z(null),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})))},onPointerCancel:()=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!1}})),oe.current=null,tt.current=null,Ee.current=null,U(null),Z(null),Ae()},children:[F&&a.jsx("div",{"aria-hidden":"true","data-drag-placeholder":"true",className:"pointer-events-none absolute border-2 border-dashed border-primary/30 bg-primary/5",style:hm(qe.panes.find(ee=>ee.id===F.id)?.rect??{x:0,y:0,width:0,height:0})}),Se.map(ee=>{const ye=qe.panes.find(Ye=>Ye.id===ee.id)?.rect,ce=!ye||!!i&&ee.id!==i;return a.jsxs("div",{"data-layout-pane":ee.id,"data-pane-active":N===ee.id,className:`${N===ee.id?"[&_[data-pane-titlebar]]:bg-surface":""} absolute min-h-0 min-w-0 overflow-hidden bg-[var(--chrome-bg)] ${F?.id===ee.id?"pointer-events-none z-30 rounded-lg ring-1 ring-primary/60 opacity-90 shadow-xl":""}`,style:{...hm(i===ee.id?{x:0,y:0,width:1,height:1}:ye??{x:0,y:0,width:0,height:0}),padding:Se.length>1?"0.5px":0,transition:"none",visibility:ce?"hidden":void 0,...F?.id===ee.id?{transform:`translate(${F.dx}px, ${F.dy}px) scale(${F.scale})`,transformOrigin:`${F.originX}px ${F.originY}px`}:{}},onDragStart:Ye=>{Ye.target.closest("[data-split-pane-title], [data-panel-drag-title]")&&Ye.preventDefault()},children:[ee.content,c&&Se.length>1&&!Y9(ee.id)&&a.jsx("button",{type:"button","data-panel-drag-title":"true","aria-label":"拖动面板到其他区域",className:"swiper-no-swiping absolute right-1 top-1 z-20 rounded bg-surface p-1 text-muted-foreground",children:a.jsx(Kd,{size:14})}),G?.id===ee.id&&a.jsx("div",{className:"pointer-events-none absolute z-30 border-2 border-primary bg-primary/20",style:{top:G.side==="bottom"?"50%":0,bottom:G.side==="top"?"50%":0,left:G.side==="right"?"50%":0,right:G.side==="left"?"50%":0}})]},ee.id)}),!i&&Te.map(ee=>a.jsx("button",{type:"button",role:"separator","aria-label":ee.side?`调整${{top:"上",bottom:"下",left:"左",right:"右"}[ee.side]}半段分隔线`:"调整分屏大小","aria-orientation":ee.axis==="x"?"vertical":"horizontal",disabled:!k,className:`swiper-no-swiping absolute z-10 touch-none bg-border hover:bg-primary focus-visible:bg-primary ${ee.axis==="x"?"w-px cursor-col-resize":"h-px cursor-row-resize"}`,style:{left:`${ee.x*100}%`,top:`${ee.y*100}%`,...ee.axis==="x"?{height:`${ee.length*100}%`}:{width:`${ee.length*100}%`}},onPointerDown:ye=>{ye.preventDefault(),ye.stopPropagation(),document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:!0}})),oe.current=ee,x.current?.setPointerCapture?.(ye.pointerId)},onDoubleClick:()=>{Ke(ee.side?Mh(w.current,ee.side,.5):Gc(w.current,ee.path,.5)),Ae()},onKeyDown:ye=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(ye.key))return;ye.preventDefault();const ce=ee.side?ie[ee.side]:qe.dividers.find(at=>at.path===ee.path).node.ratio,Ye=Math.max(.05,Math.min(.95,ce+(["ArrowRight","ArrowDown"].includes(ye.key)?.03:-.03)));Ke(ee.side?Mh(w.current,ee.side,Ye):Gc(w.current,ee.path,Ye)),Ae()},children:a.jsx("span",{"aria-hidden":"true",className:`absolute ${ee.axis==="x"?"inset-y-0 -inset-x-1":"inset-x-0 -inset-y-1"}`})},ee.key)),M&&a.jsx("div",{role:"alert",className:"absolute bottom-1 left-1 z-20 rounded bg-surface px-2 py-1 text-[10px] text-destructive",children:M})]})}let $f=0,pm=!1,I0=0;function X9(){if(pm||typeof window>"u")return;pm=!0;const e=()=>{$f=performance.now()};window.addEventListener("pointerdown",()=>{I0+=1,e()},{passive:!0,capture:!0});for(const t of["pointerup","pointercancel"])window.addEventListener(t,()=>{I0=Math.max(0,I0-1),e()},{passive:!0,capture:!0});for(const t of["pointermove","wheel","keydown"])window.addEventListener(t,e,{passive:!0,capture:!0});window.addEventListener("blur",()=>{I0=0,e()})}function Mp(e,t=500){X9();let r=!1,s,i;const c=()=>{if(r)return;if(I0>0||performance.now()-$f<400){i=setTimeout(c,100);return}const u=()=>{if(!r){if(I0>0||performance.now()-$f<400){i=setTimeout(c,100);return}e()}};"requestIdleCallback"in window?s=window.requestIdleCallback(u):i=setTimeout(u,16)};return i=setTimeout(c,t),()=>{r=!0,clearTimeout(i),s!==void 0&&window.cancelIdleCallback(s)}}function J9(e){const[t,r]=A.useState(e);return A.useEffect(()=>Mp(()=>r(e),0),[e]),t}function ew(e,t,r){A.useEffect(()=>{e&&$y(e,!0)},[e,r])}const bi=[];for(let e=0;e<256;++e)bi.push((e+256).toString(16).slice(1));function tw(e,t=0){return(bi[e[t+0]]+bi[e[t+1]]+bi[e[t+2]]+bi[e[t+3]]+"-"+bi[e[t+4]]+bi[e[t+5]]+"-"+bi[e[t+6]]+bi[e[t+7]]+"-"+bi[e[t+8]]+bi[e[t+9]]+"-"+bi[e[t+10]]+bi[e[t+11]]+bi[e[t+12]]+bi[e[t+13]]+bi[e[t+14]]+bi[e[t+15]]).toLowerCase()}let Rh;const rw=new Uint8Array(16);function nw(){if(!Rh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Rh=crypto.getRandomValues.bind(crypto)}return Rh(rw)}const sw=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),mm={randomUUID:sw};function iw(e,t,r){e=e||{};const s=e.random??e.rng?.()??nw();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,tw(s)}function ow(e,t,r){return mm.randomUUID&&!e?mm.randomUUID():iw(e)}const J5="\x1B[?2026h",aw="\x1B[?2026l",ex="\x1Bc";function lw(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===ex||t.endsWith("!p"))return t+J5;if(r===void 0)return t;const i=r.split(";").filter(c=>Number(c)!==2026);return i.length?`\x1B[?${i.join(";")}${s}`:""})}function cw(e){const t=e.filter(s=>s.length>0).join("");if(!t)return[];const r=lw(t.replace(/^(?:\x1bc)+/,""));return[`${ex}${J5}${r}${aw}`]}function uw(e){return[`\x1B[!p\x1B[?2026h\x1B[H\x1B[2J\x1B[3J${e.join("")}\x1B[?2026l`]}const dw={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},hw={F1:"P",F2:"Q",F3:"R",F4:"S"},fw={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 pw(e,t=!1){if(e.metaKey||e.isComposing||e.keyCode===229||e.getModifierState?.("AltGraph"))return null;const{key:r,shiftKey:s,altKey:i,ctrlKey:c}=e,u=1+Number(s)+2*Number(i)+4*Number(c),f=u===1?"":`;${u}`,p=dw[r];if(p)return u!==1?`\x1B[1${f}${p}`:`\x1B${t?"O":"["}${p}`;const g=hw[r];if(g)return u!==1?`\x1B[1${f}${g}`:`\x1BO${g}`;if(r==="Insert"&&!i&&(s||c))return null;const x=fw[r];if(x)return`\x1B[${x}${f}~`;if(r==="Tab")return i?`\x1B${s?"\x1B[Z":" "}`:s?"\x1B[Z":" ";if(r==="Escape")return i?"\x1B\x1B":"\x1B";if(r==="Enter")return i?"\x1B\r":null;if(r==="Backspace")return c||i?`${i?"\x1B":""}${c?"\b":""}`:null;if(r.length!==1)return null;if(c){const b=r.toUpperCase();let v;return/^[A-Z]$/.test(b)?v=b.charCodeAt(0)-64:r===" "||r==="@"||r==="2"?v=0:"[\\]^_".includes(r)?v=r.charCodeAt(0)-64:/^[3-7]$/.test(r)?v=Number(r)+24:r==="?"||r==="8"?v=127:r==="/"&&(v=31),v===void 0?null:`${i?"\x1B":""}${String.fromCharCode(v)}`}return i?`\x1B${r}`:null}async function mw(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 Zd("/tmp",[r]);if(!s[0]?.path)throw new Error("Upload did not return an image path");return s[0].path}async function gm(e){const t=na();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 i=await r.getType(s),c=s==="image/jpeg"?"jpg":s.split("/")[1].replace(/[^a-z0-9]/gi,"")||"png";return new File([i],`termdock-clipboard-${Date.now()}.${c}`,{type:s})}return null}async function gw(){return(await na()?.readClipboardFiles?.()??[]).map(t=>new File([t.bytes],t.name,{type:"application/octet-stream"}))}async function xw(e){if(!e.length)return[];const{files:t}=await Zd("/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 Gs(e){return{dispose:e}}function bw(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function yw(...e){return Gs(()=>bw(e))}var tx=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()}},r0=class{constructor(){this._store=new tx}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};r0.None=Object.freeze({dispose(){}});var dc=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}},rx=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),fu=rx?"node":navigator.userAgent,vw=rx?"node":navigator.platform,ww=fu.includes("Firefox");fu.includes("Chrome");var Aw=fu.includes("Edge"),nx=/^((?!chrome|android).)*safari/i.test(fu);function Tw(){if(!nx)return 0;let e=fu.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1],10)}vw.indexOf("Linux")>=0;var ti=0,ri=0,ni=0,ys=0,Bo={css:"#00000000",rgba:0},Vi;(e=>{function t(i,c,u,f){return f!==void 0?`#${Dl(i)}${Dl(c)}${Dl(u)}${Dl(f)}`:`#${Dl(i)}${Dl(c)}${Dl(u)}`}e.toCss=t;function r(i,c,u,f=255){return(i<<24|c<<16|u<<8|f)>>>0}e.toRgba=r;function s(i,c,u,f){return{css:e.toCss(i,c,u,f),rgba:e.toRgba(i,c,u,f)}}e.toColor=s})(Vi||={});var Fc;(e=>{function t(p,g){if(ys=(g.rgba&255)/255,ys===1)return{css:g.css,rgba:g.rgba};let x=g.rgba>>24&255,b=g.rgba>>16&255,v=g.rgba>>8&255,w=p.rgba>>24&255,k=p.rgba>>16&255,I=p.rgba>>8&255;ti=w+Math.round((x-w)*ys),ri=k+Math.round((b-k)*ys),ni=I+Math.round((v-I)*ys);let N=Vi.toCss(ti,ri,ni),M=Vi.toRgba(ti,ri,ni);return{css:N,rgba:M}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function s(p,g,x){let b=Vl.ensureContrastRatio(p.rgba,g.rgba,x);if(b)return Vi.toColor(b>>24&255,b>>16&255,b>>8&255)}e.ensureContrastRatio=s;function i(p){let g=(p.rgba|255)>>>0;return[ti,ri,ni]=Vl.toChannels(g),{css:Vi.toCss(ti,ri,ni),rgba:g}}e.opaque=i;function c(p,g){return ys=Math.round(g*255),[ti,ri,ni]=Vl.toChannels(p.rgba),{css:Vi.toCss(ti,ri,ni,ys),rgba:Vi.toRgba(ti,ri,ni,ys)}}e.opacity=c;function u(p,g){return ys=p.rgba&255,c(p,ys*g/255)}e.multiplyOpacity=u;function f(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=f})(Fc||={});var Cw;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let c=i.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function s(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return ti=parseInt(i.slice(1,2).repeat(2),16),ri=parseInt(i.slice(2,3).repeat(2),16),ni=parseInt(i.slice(3,4).repeat(2),16),Vi.toColor(ti,ri,ni);case 5:return ti=parseInt(i.slice(1,2).repeat(2),16),ri=parseInt(i.slice(2,3).repeat(2),16),ni=parseInt(i.slice(3,4).repeat(2),16),ys=parseInt(i.slice(4,5).repeat(2),16),Vi.toColor(ti,ri,ni,ys);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let c=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return ti=parseInt(c[1],10),ri=parseInt(c[2],10),ni=parseInt(c[3],10),ys=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),Vi.toColor(ti,ri,ni,ys);if(i==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ti,ri,ni,ys]=t.getImageData(0,0,1,1).data,ys!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Vi.toRgba(ti,ri,ni,ys),css:i}}e.toColor=s})(Cw||={});var Hi;(e=>{function t(s){return r(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function r(s,i,c){let u=s/255,f=i/255,p=c/255,g=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),x=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),b=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return g*.2126+x*.7152+b*.0722}e.relativeLuminance2=r})(Hi||={});var Vl;(e=>{function t(u,f){if(ys=(f&255)/255,ys===1)return f;let p=f>>24&255,g=f>>16&255,x=f>>8&255,b=u>>24&255,v=u>>16&255,w=u>>8&255;return ti=b+Math.round((p-b)*ys),ri=v+Math.round((g-v)*ys),ni=w+Math.round((x-w)*ys),Vi.toRgba(ti,ri,ni)}e.blend=t;function r(u,f,p){let g=Hi.relativeLuminance(u>>8),x=Hi.relativeLuminance(f>>8);if(ja(g,x)<p){if(x<g){let w=s(u,f,p),k=ja(g,Hi.relativeLuminance(w>>8));if(k<p){let I=i(u,f,p),N=ja(g,Hi.relativeLuminance(I>>8));return k>N?w:I}return w}let b=i(u,f,p),v=ja(g,Hi.relativeLuminance(b>>8));if(v<p){let w=s(u,f,p),k=ja(g,Hi.relativeLuminance(w>>8));return v>k?b:w}return b}}e.ensureContrastRatio=r;function s(u,f,p){let g=u>>24&255,x=u>>16&255,b=u>>8&255,v=f>>24&255,w=f>>16&255,k=f>>8&255,I=ja(Hi.relativeLuminance2(v,w,k),Hi.relativeLuminance2(g,x,b));for(;I<p&&(v>0||w>0||k>0);)v-=Math.max(0,Math.ceil(v*.1)),w-=Math.max(0,Math.ceil(w*.1)),k-=Math.max(0,Math.ceil(k*.1)),I=ja(Hi.relativeLuminance2(v,w,k),Hi.relativeLuminance2(g,x,b));return(v<<24|w<<16|k<<8|255)>>>0}e.reduceLuminance=s;function i(u,f,p){let g=u>>24&255,x=u>>16&255,b=u>>8&255,v=f>>24&255,w=f>>16&255,k=f>>8&255,I=ja(Hi.relativeLuminance2(v,w,k),Hi.relativeLuminance2(g,x,b));for(;I<p&&(v<255||w<255||k<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),k=Math.min(255,k+Math.ceil((255-k)*.1)),I=ja(Hi.relativeLuminance2(v,w,k),Hi.relativeLuminance2(g,x,b));return(v<<24|w<<16|k<<8|255)>>>0}e.increaseLuminance=i;function c(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=c})(Vl||={});function Dl(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ja(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Bs(e){if(!e)throw new Error("value must not be falsy");return e}function Rp(e){return 57508<=e&&e<=57558}function Sw(e){return 57520<=e&&e<=57527}function _w(e){return 57344<=e&&e<=63743}function Lw(e){return 9472<=e&&e<=9631}function kw(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 Iw(e,t,r,s){return t===1&&r>Math.ceil(s*1.5)&&e!==void 0&&e>255&&!kw(e)&&!Rp(e)&&!_w(e)}function sx(e){return Rp(e)||Lw(e)}function Ew(){return{css:{canvas:Pu(),cell:Pu()},device:{canvas:Pu(),cell:Pu(),char:{width:0,height:0,left:0,top:0}}}}function Pu(){return{width:0,height:0}}function Mw(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var ge;(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})))(ge||={});var Rw={"─":{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},"":ge.LINE_H,"":ge.LINE_V,"":ge.FADE_RIGHT,"":ge.FADE_LEFT,"":ge.FADE_DOWN,"":ge.FADE_UP,"":ge.CURVE_DOWN_RIGHT,"":ge.CURVE_DOWN_LEFT,"":ge.CURVE_UP_RIGHT,"":ge.CURVE_UP_LEFT,"":[ge.LINE_V,ge.CURVE_UP_RIGHT],"":[ge.LINE_V,ge.CURVE_DOWN_RIGHT],"":[ge.CURVE_DOWN_RIGHT,ge.CURVE_UP_RIGHT],"":[ge.LINE_V,ge.CURVE_UP_LEFT],"":[ge.LINE_V,ge.CURVE_DOWN_LEFT],"":[ge.CURVE_DOWN_LEFT,ge.CURVE_UP_LEFT],"":[ge.LINE_H,ge.CURVE_DOWN_LEFT],"":[ge.LINE_H,ge.CURVE_DOWN_RIGHT],"":[ge.CURVE_DOWN_LEFT,ge.CURVE_DOWN_RIGHT],"":[ge.LINE_H,ge.CURVE_UP_LEFT],"":[ge.LINE_H,ge.CURVE_UP_RIGHT],"":[ge.CURVE_UP_LEFT,ge.CURVE_UP_RIGHT],"":[ge.LINE_V,ge.CURVE_UP_LEFT,ge.CURVE_UP_RIGHT],"":[ge.LINE_V,ge.CURVE_DOWN_LEFT,ge.CURVE_DOWN_RIGHT],"":[ge.LINE_H,ge.CURVE_DOWN_LEFT,ge.CURVE_UP_LEFT],"":[ge.LINE_H,ge.CURVE_DOWN_RIGHT,ge.CURVE_UP_RIGHT],"":[ge.LINE_V,ge.CURVE_DOWN_RIGHT,ge.CURVE_UP_LEFT],"":[ge.LINE_V,ge.CURVE_DOWN_LEFT,ge.CURVE_UP_RIGHT],"":[ge.LINE_H,ge.CURVE_DOWN_RIGHT,ge.CURVE_UP_LEFT],"":[ge.LINE_H,ge.CURVE_DOWN_LEFT,ge.CURVE_UP_RIGHT],"":[ge.NODE_FILL,ge.NODE_STROKE],"":ge.NODE_STROKE,"":[ge.NODE_FILL,ge.NODE_STROKE,ge.NODE_LINE_RIGHT],"":[ge.NODE_STROKE,ge.NODE_LINE_RIGHT],"":[ge.NODE_FILL,ge.NODE_STROKE,ge.NODE_LINE_LEFT],"":[ge.NODE_STROKE,ge.NODE_LINE_LEFT],"":[ge.NODE_FILL,ge.NODE_STROKE,ge.NODE_LINE_LEFT,ge.NODE_LINE_RIGHT],"":[ge.NODE_STROKE,ge.NODE_LINE_LEFT,ge.NODE_LINE_RIGHT],"":[ge.NODE_FILL,ge.NODE_STROKE,ge.NODE_LINE_DOWN],"":[ge.NODE_STROKE,ge.NODE_LINE_DOWN],"":[ge.NODE_FILL,ge.NODE_STROKE,ge.NODE_LINE_UP],"":[ge.NODE_STROKE,ge.NODE_LINE_UP],"":[ge.NODE_FILL,ge.NODE_STROKE,ge.NODE_LINE_DOWN,ge.NODE_LINE_UP],"":[ge.NODE_STROKE,ge.NODE_LINE_DOWN,ge.NODE_LINE_UP],"":[ge.NODE_FILL,ge.NODE_STROKE,ge.NODE_LINE_DOWN,ge.NODE_LINE_RIGHT],"":[ge.NODE_STROKE,ge.NODE_LINE_DOWN,ge.NODE_LINE_RIGHT],"":[ge.NODE_FILL,ge.NODE_STROKE,ge.NODE_LINE_DOWN,ge.NODE_LINE_LEFT],"":[ge.NODE_STROKE,ge.NODE_LINE_DOWN,ge.NODE_LINE_LEFT],"":[ge.NODE_FILL,ge.NODE_STROKE,ge.NODE_LINE_UP,ge.NODE_LINE_RIGHT],"":[ge.NODE_STROKE,ge.NODE_LINE_UP,ge.NODE_LINE_RIGHT],"":[ge.NODE_FILL,ge.NODE_STROKE,ge.NODE_LINE_UP,ge.NODE_LINE_LEFT],"":[ge.NODE_STROKE,ge.NODE_LINE_UP,ge.NODE_LINE_LEFT],"":[ge.NODE_FILL,ge.NODE_STROKE,ge.NODE_LINE_UP,ge.NODE_LINE_DOWN,ge.NODE_LINE_RIGHT],"":[ge.NODE_STROKE,ge.NODE_LINE_UP,ge.NODE_LINE_DOWN,ge.NODE_LINE_RIGHT],"":[ge.NODE_FILL,ge.NODE_STROKE,ge.NODE_LINE_UP,ge.NODE_LINE_DOWN,ge.NODE_LINE_LEFT],"":[ge.NODE_STROKE,ge.NODE_LINE_UP,ge.NODE_LINE_DOWN,ge.NODE_LINE_LEFT],"":[ge.NODE_FILL,ge.NODE_STROKE,ge.NODE_LINE_DOWN,ge.NODE_LINE_LEFT,ge.NODE_LINE_RIGHT],"":[ge.NODE_STROKE,ge.NODE_LINE_DOWN,ge.NODE_LINE_LEFT,ge.NODE_LINE_RIGHT],"":[ge.NODE_FILL,ge.NODE_STROKE,ge.NODE_LINE_UP,ge.NODE_LINE_LEFT,ge.NODE_LINE_RIGHT],"":[ge.NODE_STROKE,ge.NODE_LINE_UP,ge.NODE_LINE_LEFT,ge.NODE_LINE_RIGHT],"":[ge.NODE_FILL,ge.NODE_STROKE,ge.NODE_LINE_UP,ge.NODE_LINE_DOWN,ge.NODE_LINE_LEFT,ge.NODE_LINE_RIGHT],"":[ge.NODE_STROKE,ge.NODE_LINE_UP,ge.NODE_LINE_DOWN,ge.NODE_LINE_LEFT,ge.NODE_LINE_RIGHT],"🬀":rr(1),"🬁":rr(2),"🬂":rr(3),"🬃":rr(4),"🬄":rr(5),"🬅":rr(6),"🬆":rr(7),"🬇":rr(8),"🬈":rr(9),"🬉":rr(10),"🬊":rr(11),"🬋":rr(12),"🬌":rr(13),"🬍":rr(14),"🬎":rr(15),"🬏":rr(16),"🬐":rr(17),"🬑":rr(18),"🬒":rr(19),"🬓":rr(20),"🬔":rr(22),"🬕":rr(23),"🬖":rr(24),"🬗":rr(25),"🬘":rr(26),"🬙":rr(27),"🬚":rr(28),"🬛":rr(29),"🬜":rr(30),"🬝":rr(31),"🬞":rr(32),"🬟":rr(33),"🬠":rr(34),"🬡":rr(35),"🬢":rr(36),"🬣":rr(37),"🬤":rr(38),"🬥":rr(39),"🬦":rr(40),"🬧":rr(41),"🬨":rr(43),"🬩":rr(44),"🬪":rr(45),"🬫":rr(46),"🬬":rr(47),"🬭":rr(48),"🬮":rr(49),"🬯":rr(50),"🬰":rr(51),"🬱":rr(52),"🬲":rr(53),"🬳":rr(54),"🬴":rr(55),"🬵":rr(56),"🬶":rr(57),"🬷":rr(58),"🬸":rr(59),"🬹":rr(60),"🬺":rr(61),"🬻":rr(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:pa(126),type:0},scaleType:1},"🯱":{type:5,data:{d:pa(48),type:0},scaleType:1},"🯲":{type:5,data:{d:pa(109),type:0},scaleType:1},"🯳":{type:5,data:{d:pa(121),type:0},scaleType:1},"🯴":{type:5,data:{d:pa(51),type:0},scaleType:1},"🯵":{type:5,data:{d:pa(91),type:0},scaleType:1},"🯶":{type:5,data:{d:pa(95),type:0},scaleType:1},"🯷":{type:5,data:{d:pa(114),type:0},scaleType:1},"🯸":{type:5,data:{d:pa(127),type:0},scaleType:1},"🯹":{type:5,data:{d:pa(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}]))},Nw=new Set([9617,9618,9619,129932,129933,129934,129935,129936,129937,129938,129940,129948,129949,129950,129951]);function rr(e){return{type:2,data:()=>{let t=[],r=[.375,.25,.375],s=[0,3/8,5/8];for(let i=0;i<3;i++){let c=e>>i*2&1,u=e>>i*2+1&1;c&&u?t.push(`M0,${s[i]} L1,${s[i]} L1,${s[i]+r[i]} L0,${s[i]+r[i]} Z`):c?t.push(`M0,${s[i]} L${.5},${s[i]} L${.5},${s[i]+r[i]} L0,${s[i]+r[i]} Z`):u&&t.push(`M${.5},${s[i]} L1,${s[i]} L1,${s[i]+r[i]} L${.5},${s[i]+r[i]} Z`)}return t.join(" ")}}}function pa(e){let t=[];if(e&64){let r=.21500000000000002,s=.95-.15-.015;t.push(`M${r},${.2125} L${r+.075},${.175} L${s-.075},${.175} L${s},${.2125} L${s-.075},${.25} L${r+.075},${.25} Z`)}if(e&32){let r=.7999999999999999,s=.95-.15/2,i=.95,c=.175+.075+.015,u=.5-.015;t.push(`M${s},${c} L${i},${c+.0375} L${i},${u-.0375} L${s},${u} L${r},${u-.0375} L${r},${c+.0375} Z`)}if(e&16){let r=.7999999999999999,s=.95-.15/2,i=.95,c=.5+.015,u=.825-.075-.015;t.push(`M${s},${c} L${i},${c+.0375} L${i},${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 mi=0,Js=0,ma=!1,Pa=!1,Ou=!1,to,hc=0,Dw=class{constructor(e,t,r,s,i,c){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=s,this._coreBrowserService=i,this._themeService=c,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,s,i){this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Js=0,mi=0,Pa=!1,ma=!1,Ou=!1,to=this._themeService.colors,hc=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));hc=t*s%(Math.round(u)*2)}if(hc===0&&Nw.has(c)&&(hc=t*s%2*2+r*i%2),this._decorationService.forEachDecorationAtCell(t,r,"bottom",u=>{u.backgroundColorRGB&&(Js=u.backgroundColorRGB.rgba>>8&16777215,Pa=!0),u.foregroundColorRGB&&(mi=u.foregroundColorRGB.rgba>>8&16777215,ma=!0)}),Ou=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Ou){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Js=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Js=(this.result.fg&16777215)<<8|255;break;default:Js=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Js=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Js=(this.result.bg&16777215)<<8|255;break}Js=Vl.blend(Js,(this._coreBrowserService.isFocused?to.selectionBackgroundOpaque:to.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Js=(this._coreBrowserService.isFocused?to.selectionBackgroundOpaque:to.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Pa=!0,to.selectionForeground&&(mi=to.selectionForeground.rgba>>8&16777215,ma=!0),sx(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)mi=(this._coreBrowserService.isFocused?to.selectionBackgroundOpaque:to.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:mi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:mi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:mi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:mi=(this.result.fg&16777215)<<8|255;break;default:mi=this._themeService.colors.foreground.rgba}mi=Vl.blend(mi,(this._coreBrowserService.isFocused?to.selectionBackgroundOpaque:to.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}ma=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",u=>{u.backgroundColorRGB&&(Js=u.backgroundColorRGB.rgba>>8&16777215,Pa=!0),u.foregroundColorRGB&&(mi=u.foregroundColorRGB.rgba>>8&16777215,ma=!0)}),Pa&&(Ou?Js=e.bg&-16777216&-134217729|Js|50331648:Js=e.bg&-16777216|Js|50331648),ma&&(mi=e.fg&-16777216&-67108865|mi|50331648),this.result.fg&67108864&&(Pa&&!ma&&((this.result.bg&50331648)===0?mi=this.result.fg&-134217728|to.background.rgba>>8&16777215&16777215|50331648:mi=this.result.fg&-134217728|this.result.bg&67108863,ma=!0),!Pa&&ma&&((this.result.fg&50331648)===0?Js=this.result.bg&-67108864|to.foreground.rgba>>8&16777215&16777215|50331648:Js=this.result.bg&-67108864|this.result.fg&67108863,Pa=!0)),to=void 0,this.result.bg=Pa?Js:this.result.bg,this.result.fg=ma?mi:this.result.fg,this.result.ext&=536870911,this.result.ext|=hc<<29&3758096384}},Qw=.5,ix=ww||Aw?"bottom":"ideographic";function Bw(e,t,r,s,i,c,u,f,p,g,x,b,v=0){let w=Rw[t];if(w){let k=Array.isArray(w)?w:[w];for(let I of k)jw(e,I,r,s,i,c,u,f,p,g,x,b,v);return!0}return!1}function jw(e,t,r,s,i,c,u,f,p,g,x,b,v=0){let w=i,k=c,I=r,N=s;switch(t.scaleType===1&&(w=u,k=f,I=r+(i-u)/2,N=s+(c-f)/2),t.clipPath&&(e.save(),Ww(e,t.clipPath,I,N,w,k)),t.type){case 0:Pw(e,t.data,I,N,w,k);break;case 1:zw(e,t.data,I,N,w,k,v);break;case 2:Hw(e,t.data,I,N,w,k,g,x,t.strokeWidth);break;case 3:Fw(e,t.data,I,N,w,k,g,t.strokeWidth);break;case 4:$w(e,t.data,I,N,w,k,g,b);break;case 5:Gw(e,t.data,I,N,w,k,p,g,x);break;case 6:Ow(e,t.data,I,N,w,k);break}t.clipPath&&e.restore()}function Pw(e,t,r,s,i,c){for(let u=0;u<t.length;u++){let f=t[u],p=i/8,g=c/8;e.fillRect(r+f.x*p,s+f.y*g,f.w*p,f.h*g)}}var xm=new Uint8Array([1,0,1,2,1,4,5,0,5,2,5,4,1,6,5,6]);function Ow(e,t,r,s,i,c){let u=i/8,f=c*.1,p=c*.8/8,g=Math.min(u,p);for(let x=0;x<8;x++)if(t&1<<x){let b=xm[x*2],v=xm[x*2+1],w=r+(b+1)*u,k=s+f+(v+1)*p;e.beginPath(),e.arc(w,k,g,0,Math.PI*2),e.fill()}}function Fw(e,t,r,s,i,c,u,f){let p=typeof t=="string"?t:t(0,0);e.beginPath();let g=0,x=0,b=0,v=0,w="";for(let k of p.split(" ")){let I=k[0],N=k.substring(1).split(",");if(I==="Z"){e.closePath(),w=I;continue}if(I==="V"){let D=s+parseFloat(N[0])*c;e.lineTo(g,D),x=D,b=g,v=x,w=I;continue}if(I==="H"){let D=r+parseFloat(N[0])*i;e.lineTo(D,x),g=D,b=g,v=x,w=I;continue}if(!N[0]||!N[1])continue;if(I==="A"){let D=parseFloat(N[0])*i,F=parseFloat(N[1])*c,Z=parseFloat(N[2])*Math.PI/180,G=parseInt(N[3],10),U=parseInt(N[4],10),q=r+parseFloat(N[5])*i,pe=s+parseFloat(N[6])*c;Uw(e,g,x,D,F,Z,G,U,q,pe),g=q,x=pe;continue}let M=N.map((D,F)=>{let Z=parseFloat(D);return F%2===0?r+Z*i:s+Z*c});if(I==="M")e.moveTo(M[0],M[1]),g=M[0],x=M[1],b=g,v=x;else if(I==="L")e.lineTo(M[0],M[1]),g=M[0],x=M[1],b=g,v=x;else if(I==="Q")e.quadraticCurveTo(M[0],M[1],M[2],M[3]),b=M[0],v=M[1],g=M[2],x=M[3];else if(I==="T"){let D,F;w==="Q"||w==="T"?(D=2*g-b,F=2*x-v):(D=g,F=x),e.quadraticCurveTo(D,F,M[0],M[1]),b=D,v=F,g=M[0],x=M[1]}else I==="C"&&(e.bezierCurveTo(M[0],M[1],M[2],M[3],M[4],M[5]),b=M[2],v=M[3],g=M[4],x=M[5]);w=I}f!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=u*f,e.stroke()):e.fill()}function Uw(e,t,r,s,i,c,u,f,p,g){if(s===0||i===0){e.lineTo(p,g);return}s=Math.abs(s),i=Math.abs(i);let x=Math.cos(c),b=Math.sin(c),v=(t-p)/2,w=(r-g)/2,k=x*v+b*w,I=-b*v+x*w,N=s*s,M=i*i,D=k*k,F=I*I,Z=D/N+F/M;if(Z>1){let oe=Math.sqrt(Z);s*=oe,i*=oe,N=s*s,M=i*i}let G=(N*M-N*F-M*D)/(N*F+M*D);G<0&&(G=0);let U=(u===f?-1:1)*Math.sqrt(G),q=U*(s*I/i),pe=U*-(i*k/s),Ue=x*q-b*pe+(t+p)/2,be=b*q+x*pe+(r+g)/2,Ae=(k-q)/s,Ke=(I-pe)/i,qe=(-k-q)/s,ie=(-I-pe)/i,Se=Math.atan2(Ke,Ae),tt=Math.atan2(ie,qe)-Se;f===0&&tt>0?tt-=2*Math.PI:f===1&&tt<0&&(tt+=2*Math.PI);let Ee=Se+tt;e.ellipse(Ue,be,s,i,c,Se,Ee,f===0)}function $w(e,t,r,s,i,c,u,f){e.save(),e.fillRect(r,s,i,c),f&&(e.fillStyle=f,e.strokeStyle=f),e.lineWidth=u,e.lineCap="square",e.beginPath();for(let p of t.d.split(" ")){let g=p[0],x=p.substring(1).split(",");if(!x[0]||!x[1]){g==="Z"&&e.closePath();continue}let b=x.map((v,w)=>{let k=parseFloat(v);return w%2===0?r+k*i:s+k*c});g==="M"?e.moveTo(b[0],b[1]):g==="L"&&e.lineTo(b[0],b[1])}t.type===1?e.stroke():e.fill(),e.restore()}var bm=new Map;function zw(e,t,r,s,i,c,u=0){let f=bm.get(t);f||(f=new Map,bm.set(t,f));let p=e.fillStyle;if(typeof p!="string")throw new Error(`Unexpected fillStyle type "${p}"`);let g=f.get(p);if(!g){let v=t[0].length,w=t.length,k=e.canvas.ownerDocument.createElement("canvas");k.width=v,k.height=w;let I=Bs(k.getContext("2d")),N=new ImageData(v,w),M,D,F,Z;if(p.startsWith("#"))M=parseInt(p.slice(1,3),16),D=parseInt(p.slice(3,5),16),F=parseInt(p.slice(5,7),16),Z=p.length>7&&parseInt(p.slice(7,9),16)||1;else if(p.startsWith("rgba"))[M,D,F,Z]=p.substring(5,p.length-1).split(",").map(G=>parseFloat(G));else throw new Error(`Unexpected fillStyle color format "${p}" when drawing pattern glyph`);for(let G=0;G<w;G++)for(let U=0;U<v;U++)N.data[(G*v+U)*4]=M,N.data[(G*v+U)*4+1]=D,N.data[(G*v+U)*4+2]=F,N.data[(G*v+U)*4+3]=t[G][U]*(Z*255);I.putImageData(N,0,0),g=Bs(e.createPattern(k,null)),f.set(p,g)}let x=u>>1&1,b=u&1;x!==0||b!==0?g.setTransform(new DOMMatrix().translateSelf(-x,-b)):g.setTransform(new DOMMatrix),e.fillStyle=g,e.fillRect(r,s,i,c)}function Hw(e,t,r,s,i,c,u,f,p){e.save(),e.beginPath(),e.rect(r,s,i,c),e.clip(),e.beginPath();let g;if(typeof t=="function"){let b=.15/c*i;g=t(.15,b)}else g=t;let x={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let b of g.split(" ")){let v=b[0];if(v==="Z"){e.closePath(),x.lastCommand=v;continue}let w=ox[v];if(!w){f.error(`Could not find drawing instructions for "${v}"`);continue}let k=b.substring(1).split(",");!k[0]||!k[1]||(w(e,ax(k,i,c,r,s,!0,u,0,0,!1),x),x.lastCommand=v)}p!==void 0?(e.strokeStyle=e.fillStyle,e.lineWidth=u*p,e.stroke()):e.fill(),e.closePath(),e.restore()}function Ww(e,t,r,s,i,c){e.beginPath();for(let u of t.split(" ")){let f=u[0];if(f==="Z"){e.closePath();continue}let p=u.substring(1).split(",");if(!p[0]||!p[1])continue;let g=r+parseFloat(p[0])*i,x=s+parseFloat(p[1])*c;f==="M"?e.moveTo(g,x):f==="L"&&e.lineTo(g,x)}e.clip()}function Gw(e,t,r,s,i,c,u,f,p){let g=new Path2D;g.rect(r,s,i,c),e.clip(g),e.beginPath();let x=u/12;e.lineWidth=f*x;let b={currentX:0,currentY:0,lastControlX:0,lastControlY:0,lastCommand:""};for(let v of t.d.split(" ")){let w=v[0];if(w==="Z"){e.closePath(),b.lastCommand=w;continue}let k=ox[w];if(!k){p.error(`Could not find drawing instructions for "${w}"`);continue}let I=v.substring(1).split(",");!I[0]||!I[1]||(k(e,ax(I,i,c,r,s,!1,f,(t.leftPadding??0)*(x/2),(t.rightPadding??0)*(x/2)),b),b.lastCommand=w)}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function ym(e,t,r=0){return Math.max(Math.min(e,t),r)}var ox={C:(e,t,r)=>{e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),r.lastControlX=t[2],r.lastControlY=t[3],r.currentX=t[4],r.currentY=t[5]},L:(e,t,r)=>{e.lineTo(t[0],t[1]),r.lastControlX=r.currentX=t[0],r.lastControlY=r.currentY=t[1]},M:(e,t,r)=>{e.moveTo(t[0],t[1]),r.lastControlX=r.currentX=t[0],r.lastControlY=r.currentY=t[1]},Q:(e,t,r)=>{e.quadraticCurveTo(t[0],t[1],t[2],t[3]),r.lastControlX=t[0],r.lastControlY=t[1],r.currentX=t[2],r.currentY=t[3]},T:(e,t,r)=>{let s,i;r.lastCommand==="Q"||r.lastCommand==="T"?(s=2*r.currentX-r.lastControlX,i=2*r.currentY-r.lastControlY):(s=r.currentX,i=r.currentY),e.quadraticCurveTo(s,i,t[0],t[1]),r.lastControlX=s,r.lastControlY=i,r.currentX=t[0],r.currentY=t[1]}};function ax(e,t,r,s,i,c,u,f=0,p=0,g=!0){let x=e.map(b=>parseFloat(b)||parseInt(b));if(x.length<2)throw new Error("Too few arguments for instruction");for(let b=0;b<x.length;b+=2){if(x[b]*=t-f*u-p*u,c&&x[b]!==0){let v=Math.round(x[b]+.5)-.5;x[b]=g?ym(v,t,0):v}x[b]+=s+f*u}for(let b=1;b<x.length;b+=2){if(x[b]*=r,c&&x[b]!==0){let v=Math.round(x[b]+.5)-.5;x[b]=g?ym(v,r,0):v}x[b]+=i}return x}var vm=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={}}},wm=class{constructor(){this._data=new vm}set(e,t,r,s,i){this._data.get(e,t)||this._data.set(e,t,new vm),this._data.get(e,t).set(r,s,i)}get(e,t,r,s){return this._data.get(e,t)?.get(r,s)}clear(){this._data.clear()}},lx=class{constructor(e){this._tasks=[],this._i=0,this._logService=e}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t,r=0,s=e.timeRemaining(),i;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),i=e.timeRemaining(),r*1.5>i){s-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=i}this.clear()}},Vw=class extends lx{_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())}}},qw=class extends lx{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},Zw="requestIdleCallback"in globalThis?qw:Vw,E0=class cx{constructor(){this.fg=0,this.bg=0,this.extended=new ux}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 cx;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}},ux=class dx{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 dx(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},sa=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,s)=>{if(this._disposed)return Gs(()=>{});let i={fn:t,thisArgs:r};this._listeners.push(i);let c=Gs(()=>{let u=this._listeners.indexOf(i);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:i}of r)s.call(i,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},Wl;(e=>{function t(c,u){return c(f=>u.fire(f))}e.forward=t;function r(c,u){return(f,p,g)=>c(x=>f.call(p,u(x)),void 0,g)}e.map=r;function s(...c){return(u,f,p)=>{let g=new tx;for(let x of c)g.add(x(b=>u.call(f,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=s;function i(c,u,f){return u(f),c(p=>u(p))}e.runAndSubscribe=i})(Wl||={});var Am={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}},fc=2,pc,bl=class L0{constructor(t,r,s,i){this._document=t,this._config=r,this._unicodeService=s,this._logService=i,this._didWarmUp=!1,this._cacheMap=new wm,this._cacheMapCombined=new wm,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new E0,this._textureSize=512,this._onAddTextureAtlasCanvas=new sa,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new sa,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=fx(t,this._config.deviceCellWidth*4+fc*2,this._config.deviceCellHeight+fc*2),this._tmpCtx=Bs(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose(),this._onRemoveTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new Zw(this._logService);for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let s=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,s)}})}beginFrame(){let t=this._requestClearModel;return this._requestClearModel=!1,t}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(L0.maxAtlasPages&&this._pages.length>=Math.max(4,L0.maxAtlasPages)){let r=this._pages.filter(g=>g.canvas.width*2<=(L0.maxTextureSize||4096)).sort((g,x)=>x.canvas.width!==g.canvas.width?x.canvas.width-g.canvas.width:x.percentageUsed-g.percentageUsed),s=-1,i=0;for(let g=0;g<r.length;g++)if(r[g].canvas.width!==i)s=g,i=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 Ql(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,x)=>g-x),f=this.pages.length-c.length,p=this._mergePages(c,f);p.version=++Ql.nextVersion;for(let g=u.length-1;g>=0;g--)this._deletePage(u[g]);this.pages.push(p),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(p.canvas)}let t=new Ql(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let s=t[0].canvas.width*2,i=new Ql(this._document,s,t);for(let[c,u]of t.entries()){let f=c*u.canvas.width%s,p=Math.floor(c/2)*u.canvas.height;i.ctx.drawImage(u.canvas,f,p);for(let x of u.glyphs)x.texturePage=r,x.sizeClipSpace.x=x.size.x/s,x.sizeClipSpace.y=x.size.y/s,x.texturePosition.x+=f,x.texturePosition.y+=p,x.texturePositionClipSpace.x=x.texturePosition.x/s,x.texturePositionClipSpace.y=x.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(u.canvas);let g=this._activePages.indexOf(u);g!==-1&&this._activePages.splice(g,1)}return i}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let s=this._pages[r];for(let i of s.glyphs)i.texturePage--;s.version=++Ql.nextVersion}}getRasterizedGlyphCombinedChar(t,r,s,i,c,u){return this._getFromCacheMap(this._cacheMapCombined,t,r,s,i,c,u)}getRasterizedGlyph(t,r,s,i,c,u){return this._getFromCacheMap(this._cacheMap,t,r,s,i,c,u)}_getFromCacheMap(t,r,s,i,c,u,f){return pc=t.get(r,s,i,c),pc||(pc=this._drawToCache(r,s,i,c,u,f),t.set(r,s,i,c,pc)),pc}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,r,s,i){if(this._config.allowTransparency)return Bo;let c;switch(t){case 16777216:case 33554432:c=this._getColorFromAnsiIndex(r);break;case 50331648:let u=E0.toColorRGB(r);c=Vi.toColor(u[0],u[1],u[2]);break;default:s?c=Fc.opaque(this._config.colors.foreground):c=this._config.colors.background;break}return this._config.allowTransparency||(c=Fc.opaque(c)),c}_getForegroundColor(t,r,s,i,c,u,f,p,g,x){let b=this._getMinimumContrastColor(t,r,s,i,c,u,f,g,p,x);if(b)return b;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=E0.toColorRGB(u);v=Vi.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=Fc.opaque(v)),p&&(v=Fc.multiplyOpacity(v,Qw)),v}_resolveBackgroundRgba(t,r,s){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,s,i){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&i&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,s,i,c,u,f,p,g,x){if(this._config.minimumContrastRatio===1||x)return;let b=this._getContrastCache(g),v=b.getColor(t,i);if(v!==void 0)return v??void 0;let w=this._resolveBackgroundRgba(r,s,f),k=this._resolveForegroundRgba(c,u,f,p),I=Vl.ensureContrastRatio(w,k,this._config.minimumContrastRatio/(g?2:1));if(!I){b.setColor(t,i,null);return}let N=Vi.toColor(I>>24&255,I>>16&255,I>>8&255);return b.setColor(t,i,N),N}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,s,i,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 p=Math.min(this._config.deviceCellWidth*Math.max(f.length,2)+fc*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<p&&(this._tmpCanvas.width=p);let g=Math.min(this._config.deviceCellHeight+fc*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=i,!!this._workAttributeData.isInvisible())return Am;let x=!!this._workAttributeData.isBold(),b=!!this._workAttributeData.isInverse(),v=!!this._workAttributeData.isDim(),w=!!this._workAttributeData.isItalic(),k=!!this._workAttributeData.isUnderline(),I=!!this._workAttributeData.isStrikethrough(),N=!!this._workAttributeData.isOverline(),M=this._workAttributeData.getFgColor(),D=this._workAttributeData.getFgColorMode(),F=this._workAttributeData.getBgColor(),Z=this._workAttributeData.getBgColorMode();if(b){let Te=M;M=F,F=Te;let ee=D;D=Z,Z=ee}let G=this._getBackgroundColor(Z,F,b,v);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=G.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let U=x?this._config.fontWeightBold:this._config.fontWeight,q=w?"italic":"";this._tmpCtx.font=`${q} ${U} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=ix;let pe=f.length===1&&Rp(f.charCodeAt(0)),Ue=f.length===1&&Sw(f.charCodeAt(0)),be=this._getForegroundColor(r,Z,F,s,D,M,b,v,x,sx(f.charCodeAt(0)));this._tmpCtx.fillStyle=be.css;let Ae=Ue?0:fc*2,Ke=!1;if(this._config.customGlyphs!==!1){let Te=this._workAttributeData.getUnderlineVariantOffset();Ke=Bw(this._tmpCtx,f,Ae,Ae,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.deviceCharWidth,this._config.deviceCharHeight,this._config.fontSize,this._config.devicePixelRatio,this._logService,G.css,Te)}let qe=!pe,ie;if(typeof t=="number"?ie=this._unicodeService.wcwidth(t):ie=this._unicodeService.getStringCellWidth(t),k){this._tmpCtx.save();let Te=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),ee=Te%2===1?.5:0;if(this._tmpCtx.lineWidth=Te,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())qe=!1,this._tmpCtx.strokeStyle=`rgb(${E0.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{qe=!1;let $e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&$e<8&&($e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex($e).css}this._tmpCtx.fillStyle=this._tmpCtx.strokeStyle,this._tmpCtx.beginPath();let ye=Ae,ce=Math.ceil(Ae+this._config.deviceCharHeight)-ee-(c?Te*2:0),Ye=ce+Te*2,at=this._workAttributeData.getUnderlineVariantOffset(),_e=0,$=0;for(let $e=0;$e<ie;$e++){let Xe=!1;this._tmpCtx.save(),_e=ce,$=Ye;let Le=ye+$e*this._config.deviceCellWidth,K=ye+($e+1)*this._config.deviceCellWidth;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Le,ce),this._tmpCtx.lineTo(K,ce),this._tmpCtx.moveTo(Le,Ye),this._tmpCtx.lineTo(K,Ye);break;case 3:_e=this._config.deviceCharHeight+1,$=_e+3*this._config.devicePixelRatio;let Fe=new Path2D;Fe.rect(Le,_e,this._config.deviceCellWidth,$-_e),this._tmpCtx.clip(Fe);let fe=this._config.deviceCellWidth,De=$-_e,lt=fe/6,Tt=De/3,we=[[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 Qt of we){this._tmpCtx.beginPath();for(let ut=0;ut<Qt.length;ut+=2){let bt=Le+Qt[ut]*lt,It=$-Qt[ut+1]*Tt;ut===0?this._tmpCtx.moveTo(bt,It):this._tmpCtx.lineTo(bt,It)}this._tmpCtx.closePath(),this._tmpCtx.fill()}Xe=!0;break;case 4:let me=at===0?0:at>=Te?Te*2-at:Te-at;at>=Te||me===0?(this._tmpCtx.setLineDash([Math.round(Te),Math.round(Te)]),this._tmpCtx.moveTo(Le+me,ce),this._tmpCtx.lineTo(K,ce)):(this._tmpCtx.setLineDash([Math.round(Te),Math.round(Te)]),this._tmpCtx.moveTo(Le,ce),this._tmpCtx.lineTo(Le+me,ce),this._tmpCtx.moveTo(Le+me+Te,ce),this._tmpCtx.lineTo(K,ce)),at=Mw(K-Le,Te,at);break;case 5:let Qe=.6,gt=.3,ft=K-Le,ct=Math.floor(Qe*ft),Kt=Math.floor(gt*ft),$t=ft-ct-Kt;this._tmpCtx.setLineDash([ct,Kt,$t]),this._tmpCtx.moveTo(Le,ce),this._tmpCtx.lineTo(K,ce);break;default:this._tmpCtx.moveTo(Le,ce),this._tmpCtx.lineTo(K,ce);break}Xe||this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Ke&&this._config.fontSize>=12&&!this._config.allowTransparency&&f!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let $e=this._tmpCtx.measureText(f);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in $e&&$e.actualBoundingBoxDescent>0){this._tmpCtx.save();let Xe=new Path2D;Xe.rect(ye,_e-Math.ceil(Te/2),this._config.deviceCellWidth*ie,$-_e+Math.ceil(Te/2)),this._tmpCtx.clip(Xe),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=G.css,this._tmpCtx.strokeText(f,Ae,Ae+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(N){let Te=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),ee=Te%2===1?.5:0;this._tmpCtx.lineWidth=Te,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Ae,Ae+ee),this._tmpCtx.lineTo(Ae+this._config.deviceCharWidth*ie,Ae+ee),this._tmpCtx.stroke()}if(Ke||this._tmpCtx.fillText(f,Ae,Ae+this._config.deviceCharHeight),f==="_"&&!this._config.allowTransparency){let Te=Nh(this._tmpCtx.getImageData(Ae,Ae,this._config.deviceCellWidth,this._config.deviceCellHeight),G,be,qe);if(Te)for(let ee=1;ee<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=G.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(f,Ae,Ae+this._config.deviceCharHeight-ee),Te=Nh(this._tmpCtx.getImageData(Ae,Ae,this._config.deviceCellWidth,this._config.deviceCellHeight),G,be,qe),!!Te);ee++);}if(I){let Te=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),ee=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=Te,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Ae,Ae+Math.floor(this._config.deviceCharHeight/2)-ee),this._tmpCtx.lineTo(Ae+this._config.deviceCharWidth*ie,Ae+Math.floor(this._config.deviceCharHeight/2)-ee),this._tmpCtx.stroke()}this._tmpCtx.restore();let Se=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),tt;if(this._config.allowTransparency?tt=Yw(Se):tt=Nh(Se,G,be,qe),tt)return Am;let Ee=this._findGlyphBoundingBox(Se,this._workBoundingBox,p,Ue,Ke,Ae),oe,de;for(;;){if(this._activePages.length===0){let Te=this._createNewPage();oe=Te,de=Te.currentRow,de.height=Ee.size.y;break}oe=this._activePages[this._activePages.length-1],de=oe.currentRow;for(let Te of this._activePages)Ee.size.y<=Te.currentRow.height&&(oe=Te,de=Te.currentRow);for(let Te=this._activePages.length-1;Te>=0;Te--)for(let ee of this._activePages[Te].fixedRows)ee.height<=de.height&&Ee.size.y<=ee.height&&(oe=this._activePages[Te],de=ee);if(Ee.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Ql(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),oe=this._overflowSizePage,de=this._overflowSizePage.currentRow,de.x+Ee.size.x>=oe.canvas.width&&(de.x=0,de.y+=de.height,de.height=0);break}if(de.y+Ee.size.y>=oe.canvas.height||de.height>Ee.size.y+2){let Te=!1;if(oe.currentRow.y+oe.currentRow.height+Ee.size.y>=oe.canvas.height){let ee;for(let ye of this._activePages)if(ye.currentRow.y+ye.currentRow.height+Ee.size.y<ye.canvas.height){ee=ye;break}if(ee)oe=ee;else if(L0.maxAtlasPages&&this._pages.length>=L0.maxAtlasPages&&de.y+Ee.size.y<=oe.canvas.height&&de.height>=Ee.size.y&&de.x+Ee.size.x<=oe.canvas.width)Te=!0;else{let ye=this._createNewPage();oe=ye,de=ye.currentRow,de.height=Ee.size.y,Te=!0}}Te||(oe.currentRow.height>0&&oe.fixedRows.push(oe.currentRow),de={x:0,y:oe.currentRow.y+oe.currentRow.height,height:Ee.size.y},oe.fixedRows.push(de),oe.currentRow={x:0,y:de.y+de.height,height:0})}if(de.x+Ee.size.x<=oe.canvas.width)break;de===oe.currentRow?(de.x=0,de.y+=de.height,de.height=0):oe.fixedRows.splice(oe.fixedRows.indexOf(de),1)}return Ee.texturePage=this._pages.indexOf(oe),Ee.texturePosition.x=de.x,Ee.texturePosition.y=de.y,Ee.texturePositionClipSpace.x=de.x/oe.canvas.width,Ee.texturePositionClipSpace.y=de.y/oe.canvas.height,Ee.sizeClipSpace.x/=oe.canvas.width,Ee.sizeClipSpace.y/=oe.canvas.height,de.height=Math.max(de.height,Ee.size.y),de.x+=Ee.size.x,oe.ctx.putImageData(Se,Ee.texturePosition.x-this._workBoundingBox.left,Ee.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,Ee.size.x,Ee.size.y),oe.addGlyph(Ee),oe.version=++Ql.nextVersion,Ee}_findGlyphBoundingBox(t,r,s,i,c,u){r.top=0;let f=i?this._config.deviceCellHeight:this._tmpCanvas.height,p=i?this._config.deviceCellWidth:s,g=!1;for(let x=0;x<f;x++){for(let b=0;b<p;b++){let v=x*this._tmpCanvas.width*4+b*4+3;if(t.data[v]!==0){r.top=x,g=!0;break}}if(g)break}r.left=0,g=!1;for(let x=0;x<u+p;x++){for(let b=0;b<f;b++){let v=b*this._tmpCanvas.width*4+x*4+3;if(t.data[v]!==0){r.left=x,g=!0;break}}if(g)break}r.right=p,g=!1;for(let x=u+p-1;x>=u;x--){for(let b=0;b<f;b++){let v=b*this._tmpCanvas.width*4+x*4+3;if(t.data[v]!==0){r.right=x,g=!0;break}}if(g)break}r.bottom=f,g=!1;for(let x=f-1;x>=0;x--){for(let b=0;b<p;b++){let v=x*this._tmpCanvas.width*4+b*4+3;if(t.data[v]!==0){r.bottom=x,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+(i||c?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+u+(i||c?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},hx=class zf{constructor(t,r,s){if(this._usedPixels=0,this._glyphs=[],this.version=++zf.nextVersion,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],this.canvas=fx(t,r,r),this.ctx=Bs(this.canvas.getContext("2d",{alpha:!0})),s)if(s.length===4)this._glyphs=this._glyphs.concat(s[0].glyphs,s[1].glyphs,s[2].glyphs,s[3].glyphs),this._usedPixels=s[0]._usedPixels+s[1]._usedPixels+s[2]._usedPixels+s[3]._usedPixels;else for(let i=0;i<s.length;++i)this._glyphs=this._glyphs.concat(s[i].glyphs),this._usedPixels+=s[i]._usedPixels}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version=++zf.nextVersion}};hx.nextVersion=0;var Ql=hx;function Nh(e,t,r,s){let i=t.rgba>>>24,c=t.rgba>>>16&255,u=t.rgba>>>8&255,f=r.rgba>>>24,p=r.rgba>>>16&255,g=r.rgba>>>8&255,x=Math.floor((Math.abs(i-f)+Math.abs(c-p)+Math.abs(u-g))/12),b=!0;for(let v=0;v<e.data.length;v+=4)e.data[v]===i&&e.data[v+1]===c&&e.data[v+2]===u||s&&Math.abs(e.data[v]-i)+Math.abs(e.data[v+1]-c)+Math.abs(e.data[v+2]-u)<x?e.data[v+3]=0:b=!1;return b}function Yw(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function fx(e,t,r){let s=e.createElement("canvas");return s.width=t,s.height=r,s}function Kw(e,t,r,s,i,c,u,f,p=!0){let g={foreground:c.foreground,background:c.background,cursor:Bo,cursorAccent:Bo,selectionForeground:Bo,selectionBackgroundTransparent:Bo,selectionBackgroundOpaque:Bo,selectionInactiveBackgroundTransparent:Bo,selectionInactiveBackgroundOpaque:Bo,overviewRulerBorder:Bo,scrollbarSliderBackground:Bo,scrollbarSliderHoverBackground:Bo,scrollbarSliderActiveBackground:Bo,ansi:c.ansi.slice(),contrastCache:c.contrastCache,halfContrastCache:c.halfContrastCache};return{customGlyphs:p,devicePixelRatio:u,deviceMaxTextureSize:f,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:s,fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontWeightBold:i.fontWeightBold,allowTransparency:i.allowTransparency,drawBoldTextInBrightColors:i.drawBoldTextInBrightColors,minimumContrastRatio:i.minimumContrastRatio,colors:g}}function Tm(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 Xw(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Po=[];function px(e,t,r,s,i,c,u,f,p,g=!0){let x=Kw(s,i,c,u,t,r,f,p,g);for(let k=0;k<Po.length;k++){let I=Po[k],N=I.ownedBy.indexOf(e);if(N>=0){if(Tm(I.config,x))return I.atlas;I.ownedBy.length===1?(I.atlas.dispose(),Po.splice(k,1)):I.ownedBy.splice(N,1);break}}for(let k=0;k<Po.length;k++){let I=Po[k];if(Tm(I.config,x))return I.ownedBy.push(e),I.atlas}let b=e._core,v=b._logService,w={atlas:new bl(document,x,b.unicodeService,v),config:x,ownedBy:[e]};return Po.push(w),w.atlas}function Cm(e){for(let t=0;t<Po.length;t++){let r=Po[t].ownedBy.indexOf(e);if(r!==-1){Po[t].ownedBy.length===1?(Po[t].atlas.dispose(),Po.splice(t,1)):Po[t].ownedBy.splice(r,1);break}}}var Jw=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 Sm(e,t,r){let s=new t.ResizeObserver(i=>{let c=i.find(p=>p.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 Gs(()=>s?.disconnect())}function eA(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var tA=class mx extends E0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ux,this.combinedData=""}static fromCharData(t){let r=new mx;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?eA(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(s-55296)*1024+i-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}attributesEquals(t){if(this.getFgColorMode()!==t.getFgColorMode()||this.getFgColor()!==t.getFgColor()||this.getBgColorMode()!==t.getBgColorMode()||this.getBgColor()!==t.getBgColor()||this.isInverse()!==t.isInverse()||this.isBold()!==t.isBold()||this.isUnderline()!==t.isUnderline())return!1;if(this.isUnderline()){if(this.getUnderlineStyle()!==t.getUnderlineStyle())return!1;let r=this.isUnderlineColorDefault(),s=t.isUnderlineColorDefault();if(!(r&&s)&&(r!==s||this.getUnderlineColor()!==t.getUnderlineColor()||this.getUnderlineColorMode()!==t.getUnderlineColorMode()))return!1}return!(this.isOverline()!==t.isOverline()||this.isBlink()!==t.isBlink()||this.isInvisible()!==t.isInvisible()||this.isItalic()!==t.isItalic()||this.isDim()!==t.isDim()||this.isStrikethrough()!==t.isStrikethrough())}},rA=class extends r0{constructor(e,t,r){super(),this._renderCallback=e,this._coreBrowserService=t,this._optionsService=r,this._intervalDuration=0,this._blinkOn=!0,this._needsBlinkInViewport=!1,this._isViewportVisible=!0,this._register(this._optionsService.onSpecificOptionChange("blinkIntervalDuration",s=>{this.setIntervalDuration(s)})),this.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration),this._register(Gs(()=>this._clearInterval()))}get isBlinkOn(){return this._blinkOn}get isEnabled(){return this._intervalDuration>0}setNeedsBlinkInViewport(e){this._needsBlinkInViewport!==e&&(this._needsBlinkInViewport=e,this._updateIntervalState())}setViewportVisible(e){this._isViewportVisible!==e&&(this._isViewportVisible=e,this._updateIntervalState())}setIntervalDuration(e){e!==this._intervalDuration&&(this._intervalDuration=e,this._clearInterval(),this._updateIntervalState())}_updateIntervalState(){if(this._intervalDuration>0&&this._needsBlinkInViewport&&this._isViewportVisible){if(this._interval!==void 0)return;let e=this._blinkOn;this._blinkOn=!0,this._interval=this._coreBrowserService.window.setInterval(()=>{this._blinkOn=!this._blinkOn,this._renderCallback()},this._intervalDuration),e||this._renderCallback();return}this._clearInterval(),this._blinkOn||(this._blinkOn=!0,this._renderCallback())}_clearInterval(){this._interval!==void 0&&(this._coreBrowserService.window.clearInterval(this._interval),this._interval=void 0)}},gx=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function xx(e,t,r,s){let i=Bs(e.createProgram());if(e.attachShader(i,Bs(_m(e,e.VERTEX_SHADER,t,s))),e.attachShader(i,Bs(_m(e,e.FRAGMENT_SHADER,r,s))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;s.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function _m(e,t,r,s){let i=Bs(e.createShader(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;s.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function nA(e,t){let r=Math.min(e.length*2,t),s=new Float32Array(r);for(let i=0;i<e.length;i++)s[i]=e[i];return s}var sA=class{constructor(t){this.texture=t,this.version=-1}},iA=`#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 oA(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 bs=0,ns,Dh=0,mc=0,aA=class extends r0{constructor(t,r,s,i,c){super(),this._terminal=t,this._gl=r,this._dimensions=s,this._optionsService=i,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;bl.maxAtlasPages===void 0&&(bl.maxAtlasPages=Math.min(32,Bs(u.getParameter(u.MAX_TEXTURE_IMAGE_UNITS))),bl.maxTextureSize=Bs(u.getParameter(u.MAX_TEXTURE_SIZE))),this._program=Bs(xx(u,iA,oA(bl.maxAtlasPages),this._logService)),this._register(Gs(()=>u.deleteProgram(this._program))),this._projectionLocation=Bs(u.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Bs(u.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Bs(u.getUniformLocation(this._program,"u_texture"));let f=this._vertexArrayObject=u.createVertexArray();this._register(Gs(()=>u.deleteVertexArray(f))),u.bindVertexArray(f);let p=new Float32Array([0,0,1,0,0,1,1,1]),g=u.createBuffer();this._register(Gs(()=>u.deleteBuffer(g))),u.bindBuffer(u.ARRAY_BUFFER,g),u.bufferData(u.ARRAY_BUFFER,p,u.STATIC_DRAW),u.enableVertexAttribArray(0),u.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),b=u.createBuffer();this._register(Gs(()=>u.deleteBuffer(b))),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,b),u.bufferData(u.ELEMENT_ARRAY_BUFFER,x,u.STATIC_DRAW),this._attributesBuffer=Bs(u.createBuffer()),this._register(Gs(()=>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(bl.maxAtlasPages);for(let w=0;w<bl.maxAtlasPages;w++)v[w]=w;u.uniform1iv(this._textureLocation,v),u.uniformMatrix4fv(this._projectionLocation,!1,gx),this._atlasTextures=[];for(let w=0;w<bl.maxAtlasPages;w++){let k=new sA(Bs(u.createTexture()));this._register(Gs(()=>u.deleteTexture(k.texture))),u.activeTexture(u.TEXTURE0+w),u.bindTexture(u.TEXTURE_2D,k.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]=k}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,i,c,u,f,p,g){this._updateCell(this._vertices.attributes,t,r,s,i,c,u,f,p,g)}_updateCell(t,r,s,i,c,u,f,p,g,x){if(bs=(s*this._terminal.cols+r)*11,i===0||i===void 0){t.fill(0,bs,bs+11-1-2);return}this._atlas&&(p&&p.length>1?ns=this._atlas.getRasterizedGlyphCombinedChar(p,c,u,f,!1,this._terminal.element):ns=this._atlas.getRasterizedGlyph(i,c,u,f,!1,this._terminal.element),Dh=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),c!==x&&ns.offset.x>Dh?(mc=ns.offset.x-Dh,t[bs]=-(ns.offset.x-mc)+this._dimensions.device.char.left,t[bs+1]=-ns.offset.y+this._dimensions.device.char.top,t[bs+2]=(ns.size.x-mc)/this._dimensions.device.canvas.width,t[bs+3]=ns.size.y/this._dimensions.device.canvas.height,t[bs+4]=ns.texturePage,t[bs+5]=ns.texturePositionClipSpace.x+mc/this._atlas.pages[ns.texturePage].canvas.width,t[bs+6]=ns.texturePositionClipSpace.y,t[bs+7]=ns.sizeClipSpace.x-mc/this._atlas.pages[ns.texturePage].canvas.width,t[bs+8]=ns.sizeClipSpace.y):(t[bs]=-ns.offset.x+this._dimensions.device.char.left,t[bs+1]=-ns.offset.y+this._dimensions.device.char.top,t[bs+2]=ns.size.x/this._dimensions.device.canvas.width,t[bs+3]=ns.size.y/this._dimensions.device.canvas.height,t[bs+4]=ns.texturePage,t[bs+5]=ns.texturePositionClipSpace.x,t[bs+6]=ns.texturePositionClipSpace.y,t[bs+7]=ns.sizeClipSpace.x,t[bs+8]=ns.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Iw(i,g,ns.size.x,this._dimensions.device.cell.width)&&(t[bs+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,r=t.cols*t.rows*11;this._vertices.count!==r?this._vertices.attributes=new Float32Array(r):this._vertices.attributes.fill(0);let s=0;for(;s<this._vertices.attributesBuffers.length;s++)this._vertices.count!==r?this._vertices.attributesBuffers[s]=new Float32Array(r):this._vertices.attributesBuffers[s].fill(0);this._vertices.count=r,s=0;for(let i=0;i<t.rows;i++)for(let c=0;c<t.cols;c++)this._vertices.attributes[s+9]=c/t.cols,this._vertices.attributes[s+10]=i/t.rows,s+=11}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,this._dimensions.device.canvas.width,this._dimensions.device.canvas.height),t.uniform2f(this._resolutionLocation,this._dimensions.device.canvas.width,this._dimensions.device.canvas.height),this.clear()}render(t){if(!this._atlas)return;let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let s=this._vertices.attributesBuffers[this._activeBuffer],i=0;for(let 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,i),i+=f.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,s.subarray(0,i),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,i/11)}setAtlas(t){this._atlas=t,this.invalidateAtlasTextures()}invalidateAtlasTextures(){for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(t,r,s){t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[s].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r.pages[s].canvas),this._atlasTextures[s].version=r.pages[s].version}setDimensions(t){this._dimensions=t}},lA=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,r,s,i=!1){if(this.selectionStart=r,this.selectionEnd=s,!r||!s||r[0]===s[0]&&r[1]===s[1]){this.clear();return}let c=t.buffers.active.ydisp,u=r[1]-c,f=s[1]-c,p=Math.max(u,0),g=Math.min(f,t.rows-1);if(p>=t.rows||g<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=u,this.viewportEndRow=f,this.viewportCappedStartRow=p,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 cA(){return new lA}var uA=2147483648,dA=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=cA()}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)}},hA=`#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
+ }`,fA=`#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,Qh=Sa*Float32Array.BYTES_PER_ELEMENT,pA=20*Sa,Lm=class{constructor(){this.attributes=new Float32Array(pA),this.count=0}},Oa=0,km=0,Im=0,Em=0,Mm=0,Rm=0,Nm=0,mA=class extends r0{constructor(t,r,s,i,c){super(),this._terminal=t,this._gl=r,this._dimensions=s,this._themeService=i,this._logService=c,this._vertices=new Lm,this._verticesCursor=new Lm;let u=this._gl;this._program=Bs(xx(u,hA,fA,this._logService)),this._register(Gs(()=>u.deleteProgram(this._program))),this._projectionLocation=Bs(u.getUniformLocation(this._program,"u_projection"));let f=this._vertexArrayObject=u.createVertexArray();this._register(Gs(()=>u.deleteVertexArray(f))),u.bindVertexArray(f);let p=new Float32Array([0,0,1,0,0,1,1,1]),g=u.createBuffer();this._register(Gs(()=>u.deleteBuffer(g))),u.bindBuffer(u.ARRAY_BUFFER,g),u.bufferData(u.ARRAY_BUFFER,p,u.STATIC_DRAW),u.enableVertexAttribArray(3),u.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let x=new Uint8Array([0,1,2,3]),b=u.createBuffer();this._register(Gs(()=>u.deleteBuffer(b))),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,b),u.bufferData(u.ELEMENT_ARRAY_BUFFER,x,u.STATIC_DRAW),this._attributesBuffer=Bs(u.createBuffer()),this._register(Gs(()=>u.deleteBuffer(this._attributesBuffer))),u.bindBuffer(u.ARRAY_BUFFER,this._attributesBuffer),u.enableVertexAttribArray(0),u.vertexAttribPointer(0,2,u.FLOAT,!1,Qh,0),u.vertexAttribDivisor(0,1),u.enableVertexAttribArray(1),u.vertexAttribPointer(1,2,u.FLOAT,!1,Qh,2*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(1,1),u.enableVertexAttribArray(2),u.vertexAttribPointer(2,4,u.FLOAT,!1,Qh,4*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(v=>{this._updateCachedColors(v),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),r.uniformMatrix4fv(this._projectionLocation,!1,gx),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,t.attributes,r.DYNAMIC_DRAW),r.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(t){let r=this._terminal,s=this._vertices,i=1,c,u,f,p,g,x,b,v,w,k,I;for(c=0;c<r.rows;c++){for(f=-1,p=0,g=0,x=!1,u=0;u<r.cols;u++)b=(c*r.cols+u)*4,v=t.cells[b+1],w=t.cells[b+2],k=!!(w&67108864),(v!==p||w!==g&&(x||k))&&((p!==0||x&&g!==0)&&(I=i++*Sa,this._updateRectangle(s,I,g,p,f,u,c)),f=u,p=v,g=w,x=k);(p!==0||x&&g!==0)&&(I=i++*Sa,this._updateRectangle(s,I,g,p,f,r.cols,c))}s.count=i}updateCursor(t){let r=this._verticesCursor,s=t.cursor;if(!s||s.style==="block"){r.count=0;return}let i,c=0;(s.style==="bar"||s.style==="outline")&&(i=c++*Sa,this._addRectangleFloat(r.attributes,i,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.style==="bar"?s.dpr*s.cursorWidth:s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(s.style==="underline"||s.style==="outline")&&(i=c++*Sa,this._addRectangleFloat(r.attributes,i,s.x*this._dimensions.device.cell.width,(s.y+1)*this._dimensions.device.cell.height-s.dpr,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat)),s.style==="outline"&&(i=c++*Sa,this._addRectangleFloat(r.attributes,i,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat),i=c++*Sa,this._addRectangleFloat(r.attributes,i,(s.x+s.width)*this._dimensions.device.cell.width-s.dpr,s.y*this._dimensions.device.cell.height,s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),r.count=c}_updateRectangle(t,r,s,i,c,u,f){if(s&67108864)switch(s&50331648){case 16777216:case 33554432:Oa=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Oa=(s&16777215)<<8;break;default:Oa=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:Oa=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Oa=(i&16777215)<<8;break;default:Oa=this._themeService.colors.background.rgba}t.attributes.length<r+Sa&&(t.attributes=nA(t.attributes,(this._terminal.rows*this._terminal.cols+1)*Sa)),km=c*this._dimensions.device.cell.width,Im=f*this._dimensions.device.cell.height,Em=(Oa>>24&255)/255,Mm=(Oa>>16&255)/255,Rm=(Oa>>8&255)/255,Nm=1,this._addRectangle(t.attributes,r,km,Im,(u-c)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Em,Mm,Rm,Nm)}_addRectangle(t,r,s,i,c,u,f,p,g,x){t[r]=s/this._dimensions.device.canvas.width,t[r+1]=i/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]=p,t[r+6]=g,t[r+7]=x}_addRectangleFloat(t,r,s,i,c,u,f){t[r]=s/this._dimensions.device.canvas.width,t[r+1]=i/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])}},gA=class extends r0{constructor(e,t,r,s,i,c,u,f){super(),this._container=t,this._alpha=i,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(p=>{this._refreshCharAtlas(e,p),this.reset(e)})),this._register(Gs(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Bs(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,r){}handleSelectionChanged(e,t,r,s=!1){}_setTransparency(e,t){if(t===this._alpha)return;let r=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=px(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=ix,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}`}},xA=class extends gA{constructor(t,r,s,i,c,u,f){super(s,t,"link",r,!0,c,u,f),this._register(i.onShowLinkUnderline(p=>this._handleShowLinkUnderline(p))),this._register(i.onHideLinkUnderline(p=>this._handleHideLinkUnderline(p)))}resize(t,r){super.resize(t,r),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&Xw(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()}},bA=class{constructor(t,r,s,i){this._node=t,this._type=r,this._handler=s,this._options=i,t.addEventListener(r,s,i)}dispose(){!this._node||!this._handler||(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Bh(e,t,r,s){return new bA(e,t,r,s)}var yA=class extends r0{constructor(e,t,r,s,i,c,u,f,p,g=!0,x){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=r,this._coreBrowserService=s,this._coreService=i,this._decorationService=c,this._logService=u,this._optionsService=f,this._themeService=p,this._customGlyphs=g,this._cursorBlinkStateManager=this._register(new dc),this._charAtlasDisposable=this._register(new dc),this._observerDisposable=this._register(new dc),this._model=new dA,this._rowHasBlinkingCells=[],this._rowHasBlinkingCellsCount=0,this._workCell=new tA,this._rectangleRenderer=this._register(new dc),this._glyphRenderer=this._register(new dc),this._onChangeTextureAtlas=this._register(new sa),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new sa),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new sa),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new sa),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new sa),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let b={antialias:!1,depth:!1,preserveDrawingBuffer:x};if(this._gl=this._canvas.getContext("webgl2",b),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Dw(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new xA(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,f,this._themeService)],this.dimensions=Ew(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(f.onOptionChange(()=>this._handleOptionsChanged())),this._textBlinkStateManager=this._register(new rA(()=>this._requestRedrawViewport(),this._coreBrowserService,this._optionsService)),this._resetBlinkingRowState(),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Bh(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(Bh(this._canvas,"webglcontextrestored",v=>{this._logService.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Cm(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Sm(this._canvas,this._coreBrowserService.window,(v,w)=>this._setCanvasDevicePixelDimensions(v,w)),this._register(this._coreBrowserService.onWindowChange(v=>{this._observerDisposable.value=Sm(this._canvas,v,(w,k)=>this._setCanvasDevicePixelDimensions(w,k))})),this._register(Bh(this._coreBrowserService.mainDocument,"mousedown",()=>this._cursorBlinkStateManager.value?.restartBlinkAnimation())),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Gs(()=>{clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0;for(let v of this._renderLayers)v.dispose();this._canvas.parentElement?.removeChild(this._canvas),Cm(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 mA(this._terminal,this._gl,this.dimensions,this._themeService,this._logService),this._glyphRenderer.value=new aA(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=px(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=yw(Wl.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Wl.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._resetBlinkingRowState(),this._textBlinkStateManager.setNeedsBlinkInViewport(!1),this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);if(!this._glyphRenderer.value||!this._rectangleRenderer.value)return;this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t);let r=!1,s=0;for(;this._charAtlas&&this._glyphRenderer.value.beginFrame()&&s++<32;)r=!0,this._clearModel(!0),this._updateModel(0,this._terminal.rows-1);r&&this._glyphRenderer.value.invalidateAtlasTextures(),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor()}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new Jw(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let r=this._core,s=this._workCell,i,c,u,f,p,g,x,b,v,w,k,I,N,M,D,F,Z;e=Dm(e,r.rows-1,0),t=Dm(t,r.rows-1,0);let G=this._coreService.decPrivateModes.cursorStyle??r.options.cursorStyle??"block",U=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,q=U-r.buffer.ydisp,pe=Math.min(this._terminal.buffer.active.cursorX,r.cols-1),Ue=-1,be=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let Ae=!1;for(c=e;c<=t;c++){u=c+r.buffer.ydisp;let Ke=r.buffer.lines.get(u);if(!Ke){for(this._model.lineLengths[c]=0,F=0;F<r.cols;F++)Z=(c*r.cols+F)*4,Ae=!0,this._nullModelCell(F,c,Z,0,0,0);this._setRowBlinkState(c,!1);continue}f=Ke;let qe=!1;for(this._model.lineLengths[c]=0,k=U===u,x=0,p=this._characterJoinerService.getJoinedCharacters(u),F=0;F<r.cols;F++){if(i=this._cellColorResolver.result.bg,f.loadCell(F,s),F===0&&(i=this._cellColorResolver.result.bg),g=!1,b=F>=x,v=F,p.length>0&&F===p[0][0]&&b){w=p.shift();let ie=this._model.selection.isCellSelected(this._terminal,w[0],u);for(D=w[0]+1;D<w[1];D++)b&&=ie===this._model.selection.isCellSelected(this._terminal,D,u);b&&=!k||pe<w[0]||pe>=w[1],b?(g=!0,s=new vA(s,f.translateToString(!0,w[0],w[1]),w[1]-w[0]),v=w[1]-1):x=w[1]}if(I=s.getChars(),N=s.getCode(),D=(c*r.cols+F)*4,!qe&&s.isBlink()&&(qe=!0),this._cellColorResolver.resolve(s,F,u,this.dimensions.device.cell.width,this.dimensions.device.cell.height),be&&u===U&&(F===pe&&(this._model.cursor={x:pe,y:q,width:s.getWidth(),style:this._coreBrowserService.isFocused?G:r.options.cursorInactiveStyle,cursorWidth:r.options.cursorWidth,dpr:this._devicePixelRatio},Ue=pe+s.getWidth()-1),F>=pe&&F<=Ue&&(this._coreBrowserService.isFocused&&G==="block"||this._coreBrowserService.isFocused===!1&&r.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),this._textBlinkStateManager.isEnabled&&!this._textBlinkStateManager.isBlinkOn&&s.isBlink()&&(this._cellColorResolver.result.fg|=1073741824),N!==0&&(this._model.lineLengths[c]=F+1),!(this._model.cells[D]===N&&this._model.cells[D+1]===this._cellColorResolver.result.bg&&this._model.cells[D+2]===this._cellColorResolver.result.fg&&this._model.cells[D+3]===this._cellColorResolver.result.ext)&&(Ae=!0,I.length>1&&(N|=uA),this._model.cells[D]=N,this._model.cells[D+1]=this._cellColorResolver.result.bg,this._model.cells[D+2]=this._cellColorResolver.result.fg,this._model.cells[D+3]=this._cellColorResolver.result.ext,M=s.getWidth(),this._glyphRenderer.value.updateCell(F,c,N,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,I,M,i),g)){for(s=this._workCell,F++;F<=v;F++)Z=(c*r.cols+F)*4,this._nullModelCell(F,c,Z,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext);F--}}this._setRowBlinkState(c,qe)}Ae&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model),this._updateTextBlinkState()}_nullModelCell(e,t,r,s,i,c){this._glyphRenderer.value.updateCell(e,t,0,s,i,c,"",0,0),this._model.cells[r]=0,this._model.cells[r+1]=s,this._model.cells[r+2]=i,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})}},vA=class extends E0{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 Dm(e,t,r=0){return Math.max(Math.min(e,t),r)}var wA=class extends r0{constructor(e){if(nx&&Tw()<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 sa),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new sa),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new sa),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new sa),this.onContextLoss=this._onContextLoss.event,this._customGlyphs=e?.customGlyphs??!0,this._preserveDrawingBuffer=e?.preserveDrawingBuffer}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let r=t.coreService,s=t.optionsService,i=t,c=i._renderService,u=i._characterJoinerService,f=i._charSizeService,p=i._coreBrowserService,g=i._decorationService,x=i._logService,b=i._themeService;this._renderer=this._register(new yA(e,u,f,p,r,g,x,s,b,this._customGlyphs,this._preserveDrawingBuffer)),this._register(Wl.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Wl.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Wl.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Wl.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),c.setRenderer(this._renderer),this._register(Gs(()=>{if(this._terminal._core._store._isDisposed)return;let v=this._terminal._core._renderService;v.setRenderer(this._terminal._core._createRenderer()),v.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var AA=class{constructor(t,r,s,i={}){this._terminal=t,this._regex=r,this._handler=s,this._options=i}provideLinks(t,r){let s=CA.computeLink(t,this._regex,this._terminal,this._handler);r(this._addCallbacks(s))}_addCallbacks(t){return t.map(r=>(r.leave=this._options.leave,r.hover=(s,i)=>{if(this._options.hover){let{range:c}=r;this._options.hover(s,i,c)}},r))}};function TA(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 CA=class fd{static computeLink(t,r,s,i){let c=r.flags.includes("g")?r.flags:`${r.flags}g`,u=new RegExp(r.source,c),[f,p]=fd._getWindowedLineStrings(t-1,s),g=f.join(""),x,b=[];for(;x=u.exec(g);){let v=x[0];if(!TA(v))continue;let[w,k]=fd._mapStrIdx(s,p,0,x.index),[I,N]=fd._mapStrIdx(s,w,k,v.length);if(w===-1||k===-1||I===-1||N===-1)continue;let M={start:{x:k+1,y:w+1},end:{x:N,y:I+1}};b.push({range:M,text:v,activate:i})}return b}static _getWindowedLineStrings(t,r){let s,i=t,c=t,u,f,p=[];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(--i))&&u<2048&&(f=s.translateToString(!0),u+=f.length,p.push(f),!(!s.isWrapped||f.indexOf(" ")!==-1)););p.reverse()}for(p.push(g),u=0;(s=r.buffer.active.getLine(++c))&&s.isWrapped&&u<2048&&(f=s.translateToString(!0),u+=f.length,p.push(f),f.indexOf(" ")===-1););}return[p,i]}static _mapStrIdx(t,r,s,i){let c=t.buffer.active,u=c.getNullCell(),f=s;for(;i;){let p=c.getLine(r);if(!p)return[-1,-1];for(let g=f;g<p.length;++g){p.getCell(g,u);let x=u.getChars();if(u.getWidth()&&(i-=x.length||1,g===p.length-1&&x==="")){let b=c.getLine(r+1);b&&b.isWrapped&&(b.getCell(0,u),u.getWidth()===2&&(i+=1))}if(i<0)return[r,g]}r++,f=0}return[r,f]}},SA=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function _A(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 LA=class{constructor(t=_A,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,s=r.urlRegex??SA;this._linkProvider=this._terminal.registerLinkProvider(new AA(this._terminal,s,this._handler,r))}dispose(){this._linkProvider?.dispose()}};function Qm(e){return{dispose:e}}var kA=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()}},IA=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,r,s)=>{if(this._disposed)return Qm(()=>{});let i={fn:t,thisArgs:r};this._listeners.push(i);let c=Qm(()=>{let u=this._listeners.indexOf(i);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:i}of r)s.call(i,t)}}}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,p,g)=>c(x=>f.call(p,u(x)),void 0,g)}e.map=r;function s(...c){return(u,f,p)=>{let g=new kA;for(let x of c)g.add(x(b=>u.call(f,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=s;function i(c,u,f){return u(f),c(p=>u(p))}e.runAndSubscribe=i})(EA||={});var Bm=class pd{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new IA,this.onChange=this._onChange.event}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,s=!1){return(t&16777215)<<3|(r&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t,this._active||(this.activeVersion=t.version)}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,s=0,i=t.length;for(let c=0;c<i;++c){let u=t.charCodeAt(c);if(55296<=u&&u<=56319){if(++c>=i)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),p=pd.extractWidth(f);pd.extractShouldJoin(f)&&(p-=pd.extractWidth(s)),r+=p,s=f}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},jh=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],MA=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],Ph=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],RA=[[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]],Fa;function jm(e,t){let r=0,s=t.length-1,i;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=r;)if(i=r+s>>1,e>t[i][1])r=i+1;else if(e<t[i][0])s=i-1;else return!0;return!1}var NA=class{constructor(){if(this.version="11",!Fa){Fa=new Uint8Array(65536),Fa.fill(1),Fa[0]=0,Fa.fill(0,1,32),Fa.fill(0,127,160);for(let e=0;e<jh.length;++e)Fa.fill(0,jh[e][0],jh[e][1]+1);for(let e=0;e<Ph.length;++e)Fa.fill(2,Ph[e][0],Ph[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Fa[e]:jm(e,MA)?0:jm(e,RA)?2:1}charProperties(e,t){let r=this.wcwidth(e),s=r===0&&t!==0;if(s){let i=Bm.extractWidth(t);i===0?s=!1:i>r&&(r=i)}return Bm.createPropertyValue(0,r,s)}},DA=class{activate(e){e.unicode.register(new NA)}dispose(){}};function e0(e){return{dispose:e}}function md(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}function QA(...e){return e0(()=>md(e))}var bx=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()}},pu=class{constructor(){this._store=new bx}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};pu.None=Object.freeze({dispose(){}});var Ld=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},Hf=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return e0(()=>{});let s={fn:e,thisArgs:t};this._listeners.push(s);let i=e0(()=>{let c=this._listeners.indexOf(s);c!==-1&&this._listeners.splice(c,1)});return r&&(Array.isArray(r)?r.push(i):r.add(i)),i},this._event)}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:r}=this._listeners[0];t.call(r,e);return}default:{let t=this._listeners.slice();for(let{fn:r,thisArgs:s}of t)r.call(s,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},BA;(e=>{function t(c,u){return c(f=>u.fire(f))}e.forward=t;function r(c,u){return(f,p,g)=>c(x=>f.call(p,u(x)),void 0,g)}e.map=r;function s(...c){return(u,f,p)=>{let g=new bx;for(let x of c)g.add(x(b=>u.call(f,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=s;function i(c,u,f){return u(f),c(p=>u(p))}e.runAndSubscribe=i})(BA||={});function yx(e,t=0,r){let s=setTimeout(()=>{e()},t);return e0(()=>{clearTimeout(s)})}var jA=class extends pu{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Ld),this._linesCacheDisposables=this._register(new Ld),this._lastAccessTimestamp=0,this._register(e0(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=QA(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=yx(()=>{if(!this._linesCache)return;let t=Date.now()-this._lastAccessTimestamp;if(t>=15e3){this._destroyLinesCache();return}this._scheduleLinesCacheTimeout(15e3-t)},e)}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let r=[],s=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let c=this._terminal.buffer.active.getLine(e+1),u=c?c.isWrapped:!1,f=i.translateToString(!u&&t);if(u&&c){let p=i.getCell(i.length-1);p&&p.getCode()===0&&p.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++,i=c}return[r.join(""),s]}},PA=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}},OA=class{constructor(t,r){this._terminal=t,this._lineCache=r}find(t,r,s,i){if(!t||t.length===0){this._terminal.clearSelection();return}if(s>=this._terminal.cols)throw new Error(`Invalid col: ${s} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let c={startRow:r,startCol:s},u=this._findInLine(t,c,i);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,i),!u);f++);return u}findNextWithSelection(t,r,s){if(!t||t.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let c=0,u=0;i&&(s===t?(c=i.end.x,u=i.end.y):(c=i.start.x,u=i.start.y)),this._lineCache.initLinesCache();let f={startRow:u,startCol:c},p=this._findInLine(t,f,r);if(!p)for(let g=u+1;g<this._terminal.buffer.active.baseY+this._terminal.rows&&(f.startRow=g,f.startCol=0,p=this._findInLine(t,f,r),!p);g++);if(!p&&u!==0)for(let g=0;g<u&&(f.startRow=g,f.startCol=0,p=this._findInLine(t,f,r),!p);g++);return!p&&i&&(f.startRow=i.start.y,f.startCol=0,p=this._findInLine(t,f,r)),p}findPreviousWithSelection(t,r,s){if(!t||t.length===0){this._terminal.clearSelection();return}let i=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 p={startRow:c,startCol:u},g;if(i&&(p.startRow=c=i.start.y,p.startCol=i.start.x,s!==t&&(g=this._findInLine(t,p,r,!1),g||(p.startRow=c=i.end.y,p.startCol=i.end.x))),g??=this._findInLine(t,p,r,f),!g){p.startCol=Math.max(p.startCol,this._terminal.cols);for(let x=c-1;x>=0&&(p.startRow=x,g=this._findInLine(t,p,r,f),!g);x--);}if(!g&&c!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let x=this._terminal.buffer.active.baseY+this._terminal.rows-1;x>=c&&(p.startRow=x,g=this._findInLine(t,p,r,f),!g);x--);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={},i=!1){let c=r.startRow,u=r.startCol;if(this._terminal.buffer.active.getLine(c)?.isWrapped){if(i){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[p,g]=f,x=this._bufferColsToStringOffset(c,u),b=t,v=p;s.regex||(b=s.caseSensitive?t:t.toLowerCase(),v=s.caseSensitive?p:p.toLowerCase());let w=-1;if(s.regex){let k=RegExp(b,s.caseSensitive?"g":"gi"),I;if(i)for(;I=k.exec(v.slice(0,x));)w=k.lastIndex-I[0].length,t=I[0],k.lastIndex-=t.length-1;else I=k.exec(v.slice(x)),I&&I[0].length>0&&(w=x+(k.lastIndex-I[0].length),t=I[0])}else i?x-b.length>=0&&(w=v.lastIndexOf(b,x-b.length)):w=v.indexOf(b,x);if(w>=0){if(s.wholeWord&&!this._isWholeWord(w,v,t))return;let k=0;for(;k<g.length-1&&w>=g[k+1];)k++;let I=k;for(;I<g.length-1&&w+t.length>=g[I+1];)I++;let N=w-g[k],M=w+t.length-g[I],D=this._stringLengthToBufferSize(c+k,N),F=this._stringLengthToBufferSize(c+I,M)-D+this._terminal.cols*(I-k);return{term:t,col:D,row:c+k,size:F}}}_stringLengthToBufferSize(t,r){let s=this._terminal.buffer.active.getLine(t);if(!s)return 0;for(let i=0;i<r;i++){let c=s.getCell(i);if(!c)break;let u=c.getChars();u.length>1&&(r-=u.length-1);let f=s.getCell(i+1);f&&f.getWidth()===0&&r++}return r}_bufferColsToStringOffset(t,r){let s=t,i=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()&&(i+=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 i}},FA=class extends pu{constructor(t){super(),this._terminal=t,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(e0(()=>this.clearHighlightDecorations()))}createHighlightDecorations(t,r){this.clearHighlightDecorations();for(let s of t){let i=this._createResultDecorations(s,r,!1);if(i)for(let c of i)this._storeDecoration(c,s)}}createActiveDecoration(t,r){let s=this._createResultDecorations(t,r,!0);if(s)return{decorations:s,match:t,dispose(){md(s)}}}clearHighlightDecorations(){md(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(t,r){this._highlightedLines.add(t.marker.line),this._highlightDecorations.push({decoration:t,match:r,dispose(){t.dispose()}})}_applyStyles(t,r,s){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),r&&(t.style.outline=`1px solid ${r}`)),s&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,r,s){let i=[],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);i.push([f,c,g]),c=0,u-=g,f++}let p=[];for(let g of i){let x=this._terminal.registerMarker(g[0]),b=this._terminal.registerDecoration({marker:x,x:g[1],width:g[2],layer:s?"top":"bottom",backgroundColor:s?r.activeMatchBackground:r.matchBackground,overviewRulerOptions:this._highlightedLines.has(x.line)?void 0:{color:s?r.activeMatchColorOverviewRuler:r.matchOverviewRuler,position:"center"}});if(b){let v=[];v.push(x),v.push(b.onRender(w=>this._applyStyles(w,s?r.activeMatchBorder:r.matchBorder,!1))),v.push(b.onDispose(()=>md(v))),p.push(b)}}return p.length===0?void 0:p}},UA=class extends pu{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Hf)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(t){this._selectedDecoration=t}updateResults(t,r){this._searchResults=t.slice(0,r)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(t){for(let r=0;r<this._searchResults.length;r++){let s=this._searchResults[r];if(s.row===t.row&&s.col===t.col&&s.size===t.size)return r}return-1}fireResultsChanged(t){if(!t)return;let r=-1;this._selectedDecoration&&(r=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:r,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},$A=class extends pu{constructor(t){super(),this._highlightTimeout=this._register(new Ld),this._lineCache=this._register(new Ld),this._state=new PA,this._resultTracker=this._register(new UA),this._onAfterSearch=this._register(new Hf),this.onAfterSearch=this._onAfterSearch.event,this._onBeforeSearch=this._register(new Hf),this.onBeforeSearch=this._onBeforeSearch.event,this._highlightLimit=t?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(t){this._terminal=t,this._lineCache.value=new jA(t),this._engine=new OA(t,this._lineCache.value),this._decorationManager=new FA(t),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(e0(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=yx(()=>{let t=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(t,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(t){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),t||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(t,r,s){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._onBeforeSearch.fire(),this._state.lastSearchOptions=r,this._state.shouldUpdateHighlighting(t,r)&&this._highlightAllMatches(t,r);let i=this._findNextAndSelect(t,r,s);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),i}_highlightAllMatches(t,r){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(t)){this.clearDecorations();return}this.clearDecorations(!0);let s=[],i,c=this._engine.find(t,0,0,r);for(;c&&(i?.row!==c.row||i?.col!==c.col)&&!(s.length>=this._highlightLimit);){i=c,s.push(i);let u=this._terminal.cols,f=i.col+i.size,p=i.row;f>=u&&(p+=Math.floor(f/u),f=f%u),c=this._engine.find(t,p,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 i=this._engine.findNextWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(i,r?.decorations,s?.noScroll)}findPrevious(t,r,s){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._onBeforeSearch.fire(),this._state.lastSearchOptions=r,this._state.shouldUpdateHighlighting(t,r)&&this._highlightAllMatches(t,r);let i=this._findPreviousAndSelect(t,r,s);return this._fireResults(r),this._state.cachedSearchTerm=t,this._onAfterSearch.fire(),i}_fireResults(t){this._resultTracker.fireResultsChanged(!!t?.decorations)}_findPreviousAndSelect(t,r,s){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findPreviousWithSelection(t,r,this._state.cachedSearchTerm);return this._selectResult(i,r?.decorations,s?.noScroll)}_selectResult(t,r,s){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!t)return this._terminal.clearSelection(),!1;if(this._terminal.select(t.col,t.row,t.size),r){let i=this._decorationManager.createActiveDecoration(t,r);i&&(this._resultTracker.selectedDecoration=i)}if(!s&&(t.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||t.row<this._terminal.buffer.active.viewportY)){let i=t.row-this._terminal.buffer.active.viewportY;i-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(i)}return!0}};var si=0,ii=0,oi=0,vs=0,Mi;(e=>{function t(i,c,u,f){return f!==void 0?`#${Bl(i)}${Bl(c)}${Bl(u)}${Bl(f)}`:`#${Bl(i)}${Bl(c)}${Bl(u)}`}e.toCss=t;function r(i,c,u,f=255){return(i<<24|c<<16|u<<8|f)>>>0}e.toRgba=r;function s(i,c,u,f){return{css:e.toCss(i,c,u,f),rgba:e.toRgba(i,c,u,f)}}e.toColor=s})(Mi||={});var zA;(e=>{function t(p,g){if(vs=(g.rgba&255)/255,vs===1)return{css:g.css,rgba:g.rgba};let x=g.rgba>>24&255,b=g.rgba>>16&255,v=g.rgba>>8&255,w=p.rgba>>24&255,k=p.rgba>>16&255,I=p.rgba>>8&255;si=w+Math.round((x-w)*vs),ii=k+Math.round((b-k)*vs),oi=I+Math.round((v-I)*vs);let N=Mi.toCss(si,ii,oi),M=Mi.toRgba(si,ii,oi);return{css:N,rgba:M}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function s(p,g,x){let b=gd.ensureContrastRatio(p.rgba,g.rgba,x);if(b)return Mi.toColor(b>>24&255,b>>16&255,b>>8&255)}e.ensureContrastRatio=s;function i(p){let g=(p.rgba|255)>>>0;return[si,ii,oi]=gd.toChannels(g),{css:Mi.toCss(si,ii,oi),rgba:g}}e.opaque=i;function c(p,g){return vs=Math.round(g*255),[si,ii,oi]=gd.toChannels(p.rgba),{css:Mi.toCss(si,ii,oi,vs),rgba:Mi.toRgba(si,ii,oi,vs)}}e.opacity=c;function u(p,g){return vs=p.rgba&255,c(p,vs*g/255)}e.multiplyOpacity=u;function f(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=f})(zA||={});var yi;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let c=i.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function s(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return si=parseInt(i.slice(1,2).repeat(2),16),ii=parseInt(i.slice(2,3).repeat(2),16),oi=parseInt(i.slice(3,4).repeat(2),16),Mi.toColor(si,ii,oi);case 5:return si=parseInt(i.slice(1,2).repeat(2),16),ii=parseInt(i.slice(2,3).repeat(2),16),oi=parseInt(i.slice(3,4).repeat(2),16),vs=parseInt(i.slice(4,5).repeat(2),16),Mi.toColor(si,ii,oi,vs);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let c=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return si=parseInt(c[1],10),ii=parseInt(c[2],10),oi=parseInt(c[3],10),vs=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),Mi.toColor(si,ii,oi,vs);if(i==="transparent")return{css:"transparent",rgba:0};if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[si,ii,oi,vs]=t.getImageData(0,0,1,1).data,vs!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Mi.toRgba(si,ii,oi,vs),css:i}}e.toColor=s})(yi||={});var Wi;(e=>{function t(s){return r(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function r(s,i,c){let u=s/255,f=i/255,p=c/255,g=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),x=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),b=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return g*.2126+x*.7152+b*.0722}e.relativeLuminance2=r})(Wi||={});var gd;(e=>{function t(u,f){if(vs=(f&255)/255,vs===1)return f;let p=f>>24&255,g=f>>16&255,x=f>>8&255,b=u>>24&255,v=u>>16&255,w=u>>8&255;return si=b+Math.round((p-b)*vs),ii=v+Math.round((g-v)*vs),oi=w+Math.round((x-w)*vs),Mi.toRgba(si,ii,oi)}e.blend=t;function r(u,f,p){let g=Wi.relativeLuminance(u>>8),x=Wi.relativeLuminance(f>>8);if(Ua(g,x)<p){if(x<g){let w=s(u,f,p),k=Ua(g,Wi.relativeLuminance(w>>8));if(k<p){let I=i(u,f,p),N=Ua(g,Wi.relativeLuminance(I>>8));return k>N?w:I}return w}let b=i(u,f,p),v=Ua(g,Wi.relativeLuminance(b>>8));if(v<p){let w=s(u,f,p),k=Ua(g,Wi.relativeLuminance(w>>8));return v>k?b:w}return b}}e.ensureContrastRatio=r;function s(u,f,p){let g=u>>24&255,x=u>>16&255,b=u>>8&255,v=f>>24&255,w=f>>16&255,k=f>>8&255,I=Ua(Wi.relativeLuminance2(v,w,k),Wi.relativeLuminance2(g,x,b));for(;I<p&&(v>0||w>0||k>0);)v-=Math.max(0,Math.ceil(v*.1)),w-=Math.max(0,Math.ceil(w*.1)),k-=Math.max(0,Math.ceil(k*.1)),I=Ua(Wi.relativeLuminance2(v,w,k),Wi.relativeLuminance2(g,x,b));return(v<<24|w<<16|k<<8|255)>>>0}e.reduceLuminance=s;function i(u,f,p){let g=u>>24&255,x=u>>16&255,b=u>>8&255,v=f>>24&255,w=f>>16&255,k=f>>8&255,I=Ua(Wi.relativeLuminance2(v,w,k),Wi.relativeLuminance2(g,x,b));for(;I<p&&(v<255||w<255||k<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),k=Math.min(255,k+Math.ceil((255-k)*.1)),I=Ua(Wi.relativeLuminance2(v,w,k),Wi.relativeLuminance2(g,x,b));return(v<<24|w<<16|k<<8|255)>>>0}e.increaseLuminance=i;function c(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=c})(gd||={});function Bl(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ua(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var HA=Object.freeze((()=>{let e=[yi.toColor("#2e3436"),yi.toColor("#cc0000"),yi.toColor("#4e9a06"),yi.toColor("#c4a000"),yi.toColor("#3465a4"),yi.toColor("#75507b"),yi.toColor("#06989a"),yi.toColor("#d3d7cf"),yi.toColor("#555753"),yi.toColor("#ef2929"),yi.toColor("#8ae234"),yi.toColor("#fce94f"),yi.toColor("#729fcf"),yi.toColor("#ad7fa8"),yi.toColor("#34e2e2"),yi.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let s=t[r/36%6|0],i=t[r/6%6|0],c=t[r%6];e.push({css:Mi.toCss(s,i,c),rgba:Mi.toRgba(s,i,c)})}for(let r=0;r<24;r++){let s=8+r*10;e.push({css:Mi.toCss(s,s,s),rgba:Mi.toRgba(s,s,s)})}return e})());function Pm(e,t,r){return Math.max(t,Math.min(e,r))}function WA(e){switch(e){case"&":return"&amp;";case"<":return"&lt;"}return e}var vx=class{constructor(e){this._buffer=e}serialize(e,t){let r=this._buffer.getNullCell(),s=this._buffer.getNullCell(),i=r,c=e.start.y,u=e.end.y,f=e.start.x,p=e.end.x;this._beforeSerialize(u-c,c,u);for(let g=c;g<=u;g++){let x=this._buffer.getLine(g);if(x){let b=g===e.start.y?f:0,v=g===e.end.y?p:x.length;for(let w=b;w<v;w++){let k=x.getCell(w,i===r?s:r);if(!k){console.warn(`Can't get cell at row=${g}, col=${w}`);continue}this._nextCell(k,i,g,w),i=k}}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 Np(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function _a(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function wx(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 Dp(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&wx(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 Ax(e,t){let r=e;return typeof r.attributesEquals=="function"?r.attributesEquals(t):Np(e,t)&&_a(e,t)&&Dp(e,t)}var GA=class extends vx{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&&!_a(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let s="";if(!r){t-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let i=this._buffer.getLine(t),c=this._buffer.getLine(t+1);if(!c.isWrapped)s=`\r
61
+ `,this._lastCursorRow=t+1,this._lastCursorCol=0;else{s="";let u=i.getCell(i.length-1,this._thisRowLastChar),f=i.getCell(i.length-2,this._thisRowLastSecondChar),p=c.getCell(0,this._nextRowFirstChar),g=p.getWidth()>1,x=!1;(p.getChars()&&g?this._nullCellCount<=1:this._nullCellCount<=0)&&((u.getChars()||u.getWidth()===0)&&_a(u,p)&&(x=!0),g&&(f.getChars()||f.getWidth()===0)&&_a(u,p)&&_a(f,p)&&(x=!0)),x||(s="-".repeat(this._nullCellCount+1),s+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(s+="\x1B[A",s+=`\x1B[${i.length-this._nullCellCount}C`,s+=`\x1B[${this._nullCellCount}X`,s+=`\x1B[${i.length-this._nullCellCount}D`,s+="\x1B[B"),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=s,this._currentRow="",this._nullCellCount=0}_diffStyle(t,r){let s=[];if(Ax(t,r))return s;let i=!Np(t,r),c=!_a(t,r),u=!Dp(t,r);if(i||c||u)if(t.isAttributeDefault())r.isAttributeDefault()||s.push(0);else{if(i){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),wx(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 p=t.getUnderlineColor();t.isUnderlineColorRGB()?s.push("58:2::"+(p>>>16&255)+":"+(p>>>8&255)+":"+(p&255)):s.push("58:5:"+p)}}t.isOverline()!==r.isOverline()&&s.push(t.isOverline()?53:55),t.isBlink()!==r.isBlink()&&s.push(t.isBlink()?5:25),t.isInvisible()!==r.isInvisible()&&s.push(t.isInvisible()?8:28),t.isItalic()!==r.isItalic()&&s.push(t.isItalic()?3:23),t.isDim()!==r.isDim()&&s.push(t.isDim()?2:22),t.isStrikethrough()!==r.isStrikethrough()&&s.push(t.isStrikethrough()?9:29)}}return s}_nextCell(t,r,s,i){if(t.getWidth()===0)return;let c=t.getChars()==="",u=this._diffStyle(t,this._cursorStyle);if(c?!_a(this._cursorStyle,t):u.length>0){this._nullCellCount>0&&(_a(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=s,this._lastContentCursorCol=this._lastCursorCol=i,this._currentRow+=`\x1B[${u.join(";")}m`;let f=this._buffer.getLine(s);f!==void 0&&(f.getCell(i,this._cursorStyle),this._cursorStyleRow=s,this._cursorStyleCol=i)}c?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(_a(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=s,this._lastContentCursorCol=this._lastCursorCol=i+t.getWidth())}_serializeString(t){let r=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(r=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let s="";for(let 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,p=u!==this._lastCursorRow||f!==this._lastCursorCol,g=x=>{x>0?s+=`\x1B[${x}C`:x<0&&(s+=`\x1B[${-x}D`)};p&&((x=>{x>0?s+=`\x1B[${x}B`:x<0&&(s+=`\x1B[${-x}A`)})(u-this._lastCursorRow),g(f-this._lastCursorCol))}let i=this._terminal._core._inputHandler._curAttrData,c=this._diffStyle(i,this._cursorStyle);return c.length>0&&(s+=`\x1B[${c.join(";")}m`),s}},VA=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,r,s){let i=r.length,c=s===void 0?i:Pm(s+t.rows,0,i);return this._serializeBufferByRange(t,r,{start:i-c,end:i-1},!1)}_serializeBufferByRange(t,r,s,i){return new GA(r,t).serialize({start:{x:0,y:typeof s.start=="number"?s.start:s.start.line},end:{x:t.cols,y:typeof s.end=="number"?s.end:s.end.line}},i)}_serializeBufferAsHTML(t,r){let s=t.buffer.active,i=new qA(s,t,r),c=r.onlySelection??!1,u=r.range;if(u)return i.serialize({start:{x:u.startCol,y:(u.startLine,u.startLine)},end:{x:t.cols,y:(u.endLine,u.endLine)}});if(!c){let p=s.length,g=r.scrollback,x=g===void 0?p:Pm(g+t.rows,0,p);return i.serialize({start:{x:0,y:p-x},end:{x:t.cols,y:p-1}})}let f=this._terminal?.getSelectionPosition();return f!==void 0?i.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,i=r.scrollBottom;return s!==0||i!==t.rows-1?`\x1B[${s+1};${i+1}r`:""}_serializeModes(t){let r="",s=t.modes;if(s.applicationCursorKeysMode&&(r+="\x1B[?1h"),s.applicationKeypadMode&&(r+="\x1B[?66h"),s.bracketedPasteMode&&(r+="\x1B[?2004h"),s.insertMode&&(r+="\x1B[4h"),s.originMode&&(r+="\x1B[?6h"),s.reverseWraparoundMode&&(r+="\x1B[?45h"),s.sendFocusMode&&(r+="\x1B[?1004h"),s.wraparoundMode===!1&&(r+="\x1B[?7l"),s.mouseTrackingMode!=="none")switch(s.mouseTrackingMode){case"x10":r+="\x1B[?9h";break;case"vt200":r+="\x1B[?1000h";break;case"drag":r+="\x1B[?1002h";break;case"any":r+="\x1B[?1003h";break}return s.showCursor||(r+="\x1B[?25l"),r}serialize(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let r=t?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,t.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,t?.scrollback);if(!t?.excludeAltBuffer&&this._terminal.buffer.active.type==="alternate"){let s=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);r+=`\x1B[?1049h\x1B[H${s}`}return t?.excludeModes||(r+=this._serializeModes(this._terminal),r+=this._serializeScrollRegion(this._terminal)),r}serializeAsHTML(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,t??{})}dispose(){}},qA=class extends vx{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=HA}_beforeSerialize(t,r,s){this._htmlContent+="<html><body><!--StartFragment--><pre>";let i="#000000",c="#ffffff";(this._options.includeGlobalBackground??!1)&&(i=this._terminal.options.theme?.foreground??"#ffffff",c=this._terminal.options.theme?.background??"#000000");let u=[];u.push("color: "+i+";"),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(i=>i.toString(16).padStart(2,"0")).join("");if(r?t.isFgPalette():t.isBgPalette())return this._ansiColors[s].css}_getUnderlineColor(t){if(t.isUnderlineColorDefault())return;let r=t.getUnderlineColor();return t.isUnderlineColorRGB()?"#"+[r>>16&255,r>>8&255,r&255].map(s=>s.toString(16).padStart(2,"0")).join(""):this._ansiColors[r].css}_getUnderlineStyle(t){switch(t.getUnderlineStyle()){case 1:return"underline";case 2:return"underline double";case 3:return"underline wavy";case 4:return"underline dotted";case 5:return"underline dashed";default:return"underline"}}_diffStyle(t,r){let s=[];if(Ax(t,r))return;let i=!Np(t,r),c=!_a(t,r),u=!Dp(t,r);if(i||c||u){let f=this._getHexColor(t,!0);f&&s.push("color: "+f+";");let p=this._getHexColor(t,!1);p&&s.push("background-color: "+p+";"),t.isInverse()&&s.push("color: #000000; background-color: #BFBFBF;"),t.isBold()&&s.push("font-weight: bold;");let 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 x=this._getUnderlineColor(t);x&&s.push("text-decoration-color: "+x+";")}return t.isInvisible()&&s.push("visibility: hidden;"),t.isItalic()&&s.push("font-style: italic;"),t.isDim()&&s.push("opacity: 0.5;"),s}}_nextCell(t,r,s,i){if(t.getWidth()===0)return;let 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+=WA(t.getChars())}_serializeString(){return this._htmlContent}};var ZA=class{constructor(e=new YA,t=new Tx){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 i="";try{i=this._base64.decodeText(s)}catch{}let c=this._provider.writeText(r,i);return c instanceof Promise?c.then(()=>!0):!0}},Tx=class{readText(e){return navigator.clipboard.readText()}writeText(e,t){return navigator.clipboard.writeText(t)}},YA=class{encodeText(t){let r=new TextEncoder().encode(t);if(r.toBase64!==void 0)return r.toBase64();let s="";for(let i=0;i<r.length;i++)s+=String.fromCharCode(r[i]);return btoa(s)}decodeText(t){if(Uint8Array.fromBase64!==void 0){try{return new TextDecoder().decode(Uint8Array.fromBase64(t))}catch{}return""}try{let r=atob(t),s=new Uint8Array(r.length);for(let i=0;i<r.length;++i)s[i]=r.charCodeAt(i);return new TextDecoder().decode(s)}catch{}return""}};var KA=Object.create,Cx=Object.defineProperty,XA=Object.getOwnPropertyDescriptor,JA=Object.getOwnPropertyNames,eT=Object.getPrototypeOf,tT=Object.prototype.hasOwnProperty,q0=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},rT=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of JA(t))!tT.call(e,i)&&i!==r&&Cx(e,i,{get:()=>t[i],enumerable:!(s=XA(t,i))||s.enumerable});return e},Z0=(e,t,r)=>(r=e!=null?KA(eT(e)):{},rT(!e||!e.__esModule?Cx(r,"default",{value:e,enumerable:!0}):r,e)),Qp=q0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_FOREGROUND=e.DEFAULT_BACKGROUND=e.PALETTE_ANSI_256=e.PALETTE_VT340_GREY=e.PALETTE_VT340_COLOR=e.normalizeHLS=e.normalizeRGB=e.nearestColorIndex=e.fromRGBA8888=e.toRGBA8888=e.alpha=e.blue=e.green=e.red=e.BIG_ENDIAN=void 0,e.BIG_ENDIAN=new Uint8Array(new Uint32Array([4278190080]).buffer)[0]===255,e.BIG_ENDIAN&&console.warn("BE platform detected. This version of node-sixel works only on LE properly.");function t(w){return w&255}e.red=t;function r(w){return w>>>8&255}e.green=r;function s(w){return w>>>16&255}e.blue=s;function i(w){return w>>>24&255}e.alpha=i;function c(w,k,I,N=255){return((N&255)<<24|(I&255)<<16|(k&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,k){let I=t(w),N=r(w),M=s(w),D=Number.MAX_SAFE_INTEGER,F=-1;for(let Z=0;Z<k.length;++Z){let G=I-k[Z][0],U=N-k[Z][1],q=M-k[Z][2],pe=G*G+U*U+q*q;if(!pe)return Z;pe<D&&(D=pe,F=Z)}return F}e.nearestColorIndex=f;function p(w,k,I){return Math.max(w,Math.min(I,k))}function g(w,k,I){return I<0&&(I+=1),I>1&&(I-=1),I*6<1?k+(w-k)*6*I:I*2<1?w:I*3<2?k+(w-k)*(4-I*6):k}function x(w,k,I){if(!I){let D=Math.round(k*255);return c(D,D,D)}let N=k<.5?k*(1+I):k+I-k*I,M=2*k-N;return c(p(0,255,Math.round(g(N,M,w+1/3)*255)),p(0,255,Math.round(g(N,M,w)*255)),p(0,255,Math.round(g(N,M,w-1/3)*255)))}function b(w,k,I){return(4278190080|Math.round(I/100*255)<<16|Math.round(k/100*255)<<8|Math.round(w/100*255))>>>0}e.normalizeRGB=b;function v(w,k,I){return x((w+240%360)/360,k/100,I/100)}e.normalizeHLS=v,e.PALETTE_VT340_COLOR=new Uint32Array([b(0,0,0),b(20,20,80),b(80,13,13),b(20,80,20),b(80,20,80),b(20,80,80),b(80,80,20),b(53,53,53),b(26,26,26),b(33,33,60),b(60,26,26),b(33,60,33),b(60,33,60),b(33,60,60),b(60,60,33),b(80,80,80)]),e.PALETTE_VT340_GREY=new Uint32Array([b(0,0,0),b(13,13,13),b(26,26,26),b(40,40,40),b(6,6,6),b(20,20,20),b(33,33,33),b(46,46,46),b(0,0,0),b(13,13,13),b(26,26,26),b(40,40,40),b(6,6,6),b(20,20,20),b(33,33,33),b(46,46,46)]),e.PALETTE_ANSI_256=(()=>{let w=[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)],k=[0,95,135,175,215,255];for(let I=0;I<6;++I)for(let N=0;N<6;++N)for(let M=0;M<6;++M)w.push(c(k[I],k[N],k[M]));for(let I=8;I<=238;I+=10)w.push(c(I,I,I));return new Uint32Array(w)})(),e.DEFAULT_BACKGROUND=c(0,0,0,255),e.DEFAULT_FOREGROUND=c(255,255,255,255)}),Sx=q0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InWasm=r;var t=s=>{if(Uint8Array.fromBase64)return Uint8Array.fromBase64(s);if(typeof Buffer<"u")return Buffer.from(s,"base64");let i=atob(s),c=new Uint8Array(i.length);for(let u=0;u<c.length;++u)c[u]=i.charCodeAt(u);return c};function r(s){if(s.d){let{t:i,s:c,d:u}=s,f,p,g=WebAssembly;return i===0?c?x=>new g.Instance(p||(p=new g.Module(f||(f=t(u)))),x):x=>p?g.instantiate(p,x):g.instantiate(f||(f=t(u)),x).then(b=>(p=b.module)&&b.instance):i===1?c?()=>p||(p=new g.Module(f||(f=t(u)))):()=>p?Promise.resolve(p):g.compile(f||(f=t(u))).then(x=>p=x):c?()=>f||(f=t(u)):()=>Promise.resolve(f||(f=t(u)))}if(typeof _wasmCtx>"u")throw new Error('must run "inwasm"');_wasmCtx.add(s)}}),_x=q0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=Sx(),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))),i=new Uint32Array(1024);i.fill(4278190080);for(let f=0;f<s.length;++f)i[s[f]]=f<<2;for(let f=0;f<s.length;++f)i[256+s[f]]=f>>4|(f<<4&255)<<8;for(let f=0;f<s.length;++f)i[512+s[f]]=f>>2<<8|(f<<6&255)<<16;for(let f=0;f<s.length;++f)i[768+s[f]]=f<<16;var c=new Uint8Array(0),u=class{constructor(f,p,g){if(this._inst=null,this._ended=!0,this._bytes=0,this.keepSize=f??1048576,this.maxBytes=p??4294901760,this._bytes=g??32768,this._bytes>this.maxBytes||this.maxBytes>4294901760)throw new Error("invalid byte settings")}get data8(){return this._inst?this._d.subarray(0,this._m32[1282]):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,p){if(this.maxBytes=f??this.maxBytes,this._bytes=p??Math.min(this._bytes,this.maxBytes),this._bytes>this.maxBytes||this.maxBytes>4294901760)throw Error("invalid byte settings");let g=this._m32,x=this._bytes+5152;this._inst?this._mem.buffer.byteLength<x&&(this._mem.grow(Math.ceil((x-this._mem.buffer.byteLength)/65536)),g=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)):(this._mem=new WebAssembly.Memory({initial:Math.ceil(x/65536)}),this._inst=r({env:{memory:this._mem}}),g=new Uint32Array(this._mem.buffer,0),g.set(i,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 p=this._m32[1280]+f;if(this._bytes<p){if(p>this.maxBytes)return-3;let g=this._bytes;for(;(g*=2)<p;);if(g=Math.min(g,this.maxBytes),g<p)return-3;if(g+5152>this._mem.buffer.byteLength){let x=Math.ceil((g+5152-this._mem.buffer.byteLength)/65536);this._mem.grow(x),this._m32=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)}this._bytes=g}return 0}put(f){if(!this._inst||this._ended)return-2;if(this._realloc(f.length))return-3;let p=this._m32;return this._d.set(f,p[1280]),p[1280]+=f.length,p[1280]-p[1281]>=131072?this._inst.exports.dec():0}end(){return this._ended=!0,this._inst?this._inst.exports.end():-2}get loadedBytes(){return this._inst?this._m32[1280]:0}get freeBytes(){return this._inst?this.maxBytes-this._m32[1280]:0}};e.default=u}),nT=q0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=Sx(),r=(0,t.InWasm)({s:1,t:0,d:"AGFzbQEAAAABCgJgAABgA39/fwACDwEDZW52Bm1lbW9yeQIAAQMDAgABBwcBA2RlYwABCAEACu4EAgwAQQBBAEGAAvwLAAveBAEJf0EAQQBBgAL8CwAgAUEXTgRAIAAgAWpBCGshCkGACCEBIAJBAnRBgAhqIQsgAEEOaiEDQf8BIQZBACECA0AgA0EBaiEHIAMtAAAiCEE/cSEAAkACQCAIQcABcSIJRQRAIABBAnQiAC0AAyEGIAAtAAIhBCAALQABIQUgAC0AACECIAchAwwBCwJAIAhB/QFLDQAgCUHAAUcNACAFQQVsIAJBA2xqIARBB2xqIAZBC2xqQT9xQQJ0IgMgBDoAAiADIAU6AAEgAyACOgAAIANBA2ogBjoAAANAIAEgAjoAACABQQNqIAY6AAAgAUECaiAEOgAAIAFBAWogBToAACABQQRqIQEgAEUEQCAHIQMMBAsgAEEBayEAIAEgC0kNAAsgByEDDAILAn8CQAJAAkAgCEH+AWsOAgABAgsgAy0AAyEEIAMtAAIhBSADLQABIQIgA0EEagwCCyADKAIBIgJBGHYhBiACQRB2IQQgAkEIdiEFIANBBWoMAQsgCUGAAUcEQCAHIAlBwABHDQEaIAQgCEEDcWpBAmshBCACIABBBHZqQQJrIQIgBSAIQQJ2QQNxakECayEFIAcMAQsgBCAAQShrIgkgAy0AASIHQQ9xamohBCACIAdBBHYgCWpqIQIgACAFakEgayEFIANBAmoLIQMgBUEFbCACQQNsaiAEQQdsaiAGQQtsakE/cUECdCIAIAQ6AAIgACAFOgABIAAgAjoAACAAQQNqIAY6AAALIAEgBjoAAyABIAQ6AAIgASAFOgABIAEgAjoAACABQQRqIQELIAMgCkkNAAsLCw=="}),s=class{constructor(i){this.keepSize=i,this.width=0,this.height=0}decode(i){this.width=i[4]<<24|i[5]<<16|i[6]<<8|i[7],this.height=i[8]<<24|i[9]<<16|i[10]<<8|i[11];let c=this.width*this.height,u=c*4,f=i.length,p=Math.max(u,f)+(Math.min(u,f)>>1)+4096;this._inst?this._mem.buffer.byteLength<p&&(this._mem.grow(Math.ceil((p-this._mem.buffer.byteLength)/65536)),this._d=null):(this._mem=new WebAssembly.Memory({initial:Math.ceil(p/65536)}),this._inst=r({env:{memory:this._mem}})),this._d||(this._d=new Uint8Array(this._mem.buffer));let g=this._mem.buffer.byteLength-f&-256;return this._d.set(i,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}),sT=q0(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"}}),iT=q0(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;var t=Qp(),r=sT();function s(w){if(typeof Buffer<"u")return Buffer.from(w,"base64");let k=atob(w),I=new Uint8Array(k.length);for(let N=0;N<I.length;++N)I[N]=k.charCodeAt(N);return I}var i=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)}},p={memoryLimit:2048*65536,sixelColor:t.DEFAULT_FOREGROUND,fillColor:t.DEFAULT_BACKGROUND,palette:t.PALETTE_VT340_COLOR,paletteLimit:r.LIMITS.PALETTE_SIZE,truncate:!0};function g(w){let k=new f,I={env:{handle_band:k.handle_band.bind(k),mode_parsed:k.mode_parsed.bind(k)}};return WebAssembly.instantiate(c||i,I).then(N=>(c=c||N.module,new x(w,N.instance||N,k)))}e.DecoderAsync=g;var x=class{constructor(w,k,I){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({},p,w),this._opts.paletteLimit>r.LIMITS.PALETTE_SIZE)throw new Error(`DecoderOptions.paletteLimit must not exceed ${r.LIMITS.PALETTE_SIZE}`);if(k)I.bandHandler=this._handle_band.bind(this),I.modeHandler=this._initCanvas.bind(this);else{let N=c||(c=new WebAssembly.Module(i));k=new WebAssembly.Instance(N,{env:{handle_band:this._handle_band.bind(this),mode_parsed:this._initCanvas.bind(this)}})}this._instance=k,this._wasm=this._instance.exports,this._chunk=new Uint8Array(this._wasm.memory.buffer,this._wasm.get_chunk_address(),r.LIMITS.CHUNK_SIZE),this._states=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_state_address(),12),this._palette=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_palette_address(),r.LIMITS.PALETTE_SIZE),this._palette.set(this._opts.palette),this._pSrc=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_p0_address()),this._wasm.init(t.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}get _fillColor(){return this._states[0]}get _truncate(){return this._states[8]}get _rasterWidth(){return this._states[6]}get _rasterHeight(){return this._states[7]}get _width(){return this._states[2]?this._states[2]-4:0}get _height(){return this._states[3]}get _level(){return this._states[9]}get _mode(){return this._states[10]}get _paletteLimit(){return this._states[11]}_initCanvas(w){if(w===2){let k=this.width*this.height;if(k>this._canvas.length){if(this._opts.memoryLimit&&k*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(k)}this._maxWidth=this._width}else if(w===1)if(this._level===2){let k=Math.min(this._rasterWidth,r.LIMITS.MAX_WIDTH)*this._rasterHeight;if(k>this._canvas.length){if(this._opts.memoryLimit&&k*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(k)}}else this._canvas.length<65536&&(this._canvas=new Uint32Array(65536));return 0}_realloc(w,k){let I=w+k;if(I>this._canvas.length){if(this._opts.memoryLimit&&I*4>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");let N=new Uint32Array(Math.ceil(I/65536)*65536);N.set(this._canvas),this._canvas=N}}_handle_band(w){let k=this._PIXEL_OFFSET,I=this._lastOffset;if(this._mode===2){let N=this.height-this._currentHeight,M=0;for(;M<6&&N>0;)this._canvas.set(this._pSrc.subarray(k*M,k*M+w),I+w*M),M++,N--;this._lastOffset+=w*M,this._currentHeight+=M}else if(this._mode===1){this._realloc(I,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(k*N,k*N+w),I+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,k=this._opts.palette,I=this._opts.paletteLimit,N=this._opts.truncate){this._wasm.init(this._opts.sixelColor,w,I,N?1:0),k&&this._palette.set(k.subarray(0,r.LIMITS.PALETTE_SIZE)),this._bandWidths.length=0,this._maxWidth=0,this._minWidth=r.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0}decode(w,k=0,I=w.length){let N=k;for(;N<I;){let M=Math.min(I-N,r.LIMITS.CHUNK_SIZE);this._chunk.set(w.subarray(N,N+=M)),this._wasm.decode(0,M)}}decodeString(w,k=0,I=w.length){let N=k;for(;N<I;){let M=Math.min(I-N,r.LIMITS.CHUNK_SIZE);for(let D=0,F=N;D<M;++D,++F)this._chunk[D]=w.charCodeAt(F);N+=M,this._wasm.decode(0,M)}}get data32(){if(this._mode===0||!this.width||!this.height)return u;let w=this._wasm.current_width();if(this._mode===2){let k=this.height-this._currentHeight;if(k>0){let I=this._PIXEL_OFFSET,N=this._lastOffset,M=0;for(;M<6&&k>0;)this._canvas.set(this._pSrc.subarray(I*M,I*M+w),N+w*M),M++,k--;k&&this._canvas.fill(this._fillColor,N+w*M)}return this._canvas.subarray(0,this.width*this.height)}if(this._mode===1){if(this._minWidth===this._maxWidth){let M=!1;if(w)if(w!==this._minWidth)M=!0;else{let D=this._PIXEL_OFFSET,F=this._lastOffset;this._realloc(F,w*6);for(let Z=0;Z<6;++Z)this._canvas.set(this._pSrc.subarray(D*Z,D*Z+w),F+w*Z)}if(!M)return this._canvas.subarray(0,this.width*this.height)}let k=new Uint32Array(this.width*this.height);k.fill(this._fillColor);let I=0,N=0;for(let M=0;M<this._bandWidths.length;++M){let D=this._bandWidths[M];for(let F=0;F<6;++F)k.set(this._canvas.subarray(N,N+=D),I),I+=this.width}if(w){let M=this._PIXEL_OFFSET,D=this._wasm.current_height();for(let F=0;F<D;++F)k.set(this._pSrc.subarray(M*F,M*F+w),I+this.width*F)}return k}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=x;function b(w,k){let I=new x(k);return I.init(),typeof w=="string"?I.decodeString(w):I.decode(w),{width:I.width,height:I.height,data32:I.data32,data8:I.data8}}e.decode=b;async function v(w,k){let I=await g(k);return I.init(),typeof w=="string"?I.decodeString(w):I.decode(w),{width:I.width,height:I.height,data32:I.data32,data8:I.data8}}e.decodeAsync=v});function Wf(e){return{dispose:e}}var Lx=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()}},kx=class{constructor(){this._store=new Lx}dispose(){this._store.dispose()}_register(t){return this._store.add(t)}};kx.None=Object.freeze({dispose(){}});var oT=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}},aT=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event?this._event:(this._event=(e,t,r)=>{if(this._disposed)return Wf(()=>{});let s={fn:e,thisArgs:t};this._listeners.push(s);let i=Wf(()=>{let c=this._listeners.indexOf(s);c!==-1&&this._listeners.splice(c,1)});return r&&(Array.isArray(r)?r.push(i):r.add(i)),i},this._event)}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:r}=this._listeners[0];t.call(r,e);return}default:{let t=this._listeners.slice();for(let{fn:r,thisArgs:s}of t)r.call(s,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},lT;(e=>{function t(c,u){return c(f=>u.fire(f))}e.forward=t;function r(c,u){return(f,p,g)=>c(x=>f.call(p,u(x)),void 0,g)}e.map=r;function s(...c){return(u,f,p)=>{let g=new Lx;for(let x of c)g.add(x(b=>u.call(f,b)));return p&&(Array.isArray(p)?p.push(g):p.add(g)),g}}e.any=s;function i(c,u,f){return u(f),c(p=>u(p))}e.runAndSubscribe=i})(lT||={});var Om=Z0(Qp()),U0=class yl extends kx{constructor(t){super(),this._terminal=t,this._layers=new Map,this._optionsRefresh=this._register(new oT),this._oldOpen=this._terminal._core.open,this._terminal._core.open=r=>{this._oldOpen?.call(this._terminal._core,r),this._open()},this._terminal._core.screenElement&&this._open(),this._optionsRefresh.value=this._terminal._core.optionsService.onOptionChange(r=>{r==="fontSize"&&(this.rescaleCanvas(),this._renderService?.refreshRows(0,this._terminal.rows))}),this._register(Wf(()=>{this.removeLayerFromDom(),this.removeLayerFromDom("bottom"),this._terminal._core&&this._oldOpen&&(this._terminal._core.open=this._oldOpen,this._oldOpen=void 0),this._renderService&&this._oldSetRenderer&&(this._renderService.setRenderer=this._oldSetRenderer,this._oldSetRenderer=void 0),this._renderService=void 0,this._layers.clear(),this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0}))}get canvas(){return this._layers.get("top")?.canvas}static createCanvas(t,r,s){let i=(t??document).createElement("canvas");return i.width=r|0,i.height=s|0,i}static createImageData(t,r,s,i){if(typeof ImageData!="function"){let c=t.createImageData(r,s);return i&&c.data.set(new Uint8ClampedArray(i,0,r*s*4)),c}return i?new ImageData(new Uint8ClampedArray(i,0,r*s*4),r,s):new ImageData(r,s)}static createImageBitmap(t){return typeof createImageBitmap!="function"?Promise.resolve(void 0):createImageBitmap(t)}showPlaceholder(t){t?!this._placeholder&&this.cellSize.height!==-1&&this._createPlaceHolder(Math.max(this.cellSize.height+1,24)):(this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0),this._renderService?.refreshRows(0,this._terminal.rows)}get dimensions(){return this._terminal.dimensions}get cellSize(){return{width:this.dimensions?.css.cell.width||-1,height:this.dimensions?.css.cell.height||-1}}clearLines(t,r,s){let i=t*(this.dimensions?.css.cell.height||0),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,i,c,u),(!s||s==="bottom")&&this._layers.get("bottom")?.clearRect(0,i,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,i,c=1){let u=this._layers.get(t.layer);if(!u)return;let{width:f,height:p}=this.cellSize;if(f===-1||p===-1)return;this._rescaleImage(t,f,p);let g=t.actual,x=Math.ceil(g.width/f),b=r%x*f,v=Math.floor(r/x)*p,w=s*f,k=i*p,I=c*f+b>g.width?g.width-b:c*f,N=v+p>g.height?g.height-v:p;u.drawImage(g,Math.floor(b),Math.floor(v),Math.ceil(I),Math.ceil(N),Math.floor(w),Math.floor(k),Math.ceil(I),Math.ceil(N))}extractTile(t,r){let{width:s,height:i}=this.cellSize;if(s===-1||i===-1)return;this._rescaleImage(t,s,i);let c=t.actual,u=Math.ceil(c.width/s),f=r%u*s,p=Math.floor(r/u)*i,g=s+f>c.width?c.width-f:s,x=p+i>c.height?c.height-p:i,b=yl.createCanvas(this.document,g,x),v=b.getContext("2d");if(v)return v.drawImage(c,Math.floor(f),Math.floor(p),Math.floor(g),Math.floor(x),0,0,Math.floor(g),Math.floor(x)),b}drawPlaceholder(t,r,s=1){let i=this._layers.get("top");if(i){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;i.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:i,height:c}=t.origCellSize;if(r===i&&s===c){t.actual=t.orig,t.actualCellSize.width=i,t.actualCellSize.height=c;return}let u=yl.createCanvas(this.document,Math.ceil(t.orig.width*r/i),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=yl.createCanvas(this.document,this.dimensions?.css.canvas.width||0,this.dimensions?.css.canvas.height||0);r.classList.add(`xterm-image-layer-${t}`);let s=this._terminal._core.screenElement;s.style.isolation="isolate",t==="bottom"?(r.style.zIndex="-1",s.insertBefore(r,s.firstChild)):(r.style.zIndex="0",s.appendChild(r));let i=r.getContext("2d",{alpha:!0});if(!i){r.remove();return}this._layers.set(t,i),this.clearAll(t)}removeLayerFromDom(t="top"){let r=this._layers.get(t);r&&(r.canvas.remove(),this._layers.delete(t))}hasLayer(t){return this._layers.has(t)}_createPlaceHolder(t=24){this._placeholderBitmap?.close(),this._placeholderBitmap=void 0;let r=32,s=yl.createCanvas(this.document,r,t),i=s.getContext("2d",{alpha:!1});if(!i)return;let c=yl.createImageData(i,r,t),u=new Uint32Array(c.data.buffer),f=(0,Om.toRGBA8888)(0,0,0),p=(0,Om.toRGBA8888)(255,255,255);u.fill(f);for(let b=0;b<t;++b){let v=b%2,w=b*r;for(let k=0;k<r;k+=2)u[w+k+v]=p}i.putImageData(c,0,0);let g=screen.width+r-1&-32||4096;this._placeholder=yl.createCanvas(this.document,g,t);let x=this._placeholder.getContext("2d",{alpha:!1});if(!x){this._placeholder=void 0;return}for(let b=0;b<g;b+=r)x.drawImage(s,b,0);yl.createImageBitmap(this._placeholder).then(b=>this._placeholderBitmap=b)}get document(){return this._terminal._core._coreBrowserService?.window.document}},Ga={width:7,height:14},Gf=class Ix{constructor(t=0,r=0,s=-1,i=-1){this.imageId=s,this.tileId=i,this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}get urlId(){return this._urlId}set urlId(t){this._urlId=t}clone(){return new Ix(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0&&this.imageId===-1}},Fu=new Gf,cT=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=Ga);let s=Math.ceil(e.width/r.width),i=Math.ceil(e.height/r.height),c=++this._lastId,u=this._terminal._core.buffer,f=this._terminal.cols,p=this._terminal.rows,g=u.x,x=u.y,b=g,v=0;t.scrolling||(u.x=0,u.y=0,b=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(u.y);for(let N=0;N<i;++N){let M=u.lines.get(u.y+u.ybase);for(let D=0;D<s&&!(b+D>=f);++D)this._writeToCell(M,b+D,c,N*s+D),v++;if(t.scrolling)N<i-1&&this._terminal._core._inputHandler.lineFeed();else if(++u.y>=p)break;u.x=b}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(u.y),t.scrolling?t.cursorPos==="iip"?u.x=Math.min(b+s,f):u.x=b:(u.x=g,u.y=x);let w=[];for(let[N,M]of this._images.entries())M.tileCount<1&&(M.marker?.dispose(),w.push(N));for(let N of w)this._delImg(N);let k=this._terminal.registerMarker(0);k?.onDispose(()=>{this._images.get(c)&&this._delImg(c)}),this._terminal.buffer.active.type==="alternate"&&this._evictOnAlternate();let I={orig:e,origCellSize:r,actual:e,actualCellSize:{...r},marker:k||void 0,tileCount:v,bufferType:this._terminal.buffer.active.type,layer:t.layer,zIndex:t.zIndex};return this._images.set(c,I),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:i}=e,c=this._terminal._core.buffer,u=this._terminal._core.cols;this._renderer.clearLines(s,i);let f=[],p=[];for(let g=s;g<=i;++g){let x=c.lines.get(g+c.ydisp);if(!x)return;for(let b=0;b<u;++b){let v;if(x.getBg(b)&268435456)v=x._extendedAttrs[b]??Fu;else{let I=x._extendedAttrs[b];if(!I||I.imageId===void 0||I.imageId===-1)continue;v=I}let w=v.imageId;if(w===void 0||w===-1)continue;let k=this._images.get(w);if(v.tileId!==-1){let I=v.tileId,N=b,M=1;for(;++b<u;){let D=x._extendedAttrs[b];if(!D||D.imageId!==w||D.tileId!==I+M)break;M++}b--,k?k.actual&&f.push({imgSpec:k,tileId:I,col:N,row:g,count:M}):this._opts.showPlaceholder&&p.push({col:N,row:g,count:M}),this._fullyCleared=!1}}}f.sort((g,x)=>g.imgSpec.zIndex-x.imgSpec.zIndex);for(let g of p)this._renderer.drawPlaceholder(g.col,g.row,g.count);for(let g of 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 i=0;i<r;++i){let c=t.lines.get(i);if(c.getBg(s)&268435456){let u=c._extendedAttrs[s]??Fu,f=u.imageId;if(f===void 0||f===-1)continue;let p=this._images.get(f);if(!p)continue;let g=Math.ceil((p.actual?.width||0)/p.actualCellSize.width);if(u.tileId%g+1>=g)continue;let x=!1;for(let w=s+1;w>e.cols;++w)if(c._data[w*3+0]&4194303){x=!0;break}if(x)continue;let b=Math.min(e.cols,g-u.tileId%g+s),v=u.tileId;for(let w=s+1;w<b;++w)this._writeToCell(c,w,f,++v),p.tileCount++}}this._viewportMetrics=e}getImageAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let s=r._extendedAttrs[e]??Fu;if(s.imageId&&s.imageId!==-1){let i=this._images.get(s.imageId)?.orig;if(window.ImageBitmap&&i instanceof ImageBitmap){let c=U0.createCanvas(window.document,i.width,i.height);return c.getContext("2d")?.drawImage(i,0,0,i.width,i.height),c}return i}}}extractTileAtBufferCell(e,t){let r=this._terminal._core.buffer.lines.get(t);if(r&&r.getBg(e)&268435456){let s=r._extendedAttrs[e]??Fu;if(s.imageId&&s.imageId!==-1&&s.tileId!==-1){let i=this._images.get(s.imageId);if(i)return this._renderer.extractTile(i,s.tileId)}}}_evictOldest(e){let t=this._getStoredPixels(),r=t;for(;this._pixelLimit<r+e&&this._images.size;){let s=this._images.get(++this._lowestId);s&&s.orig&&(r-=s.orig.width*s.orig.height,s.actual&&s.orig!==s.actual&&(r-=s.actual.width*s.actual.height),s.marker?.dispose(),this._delImg(this._lowestId))}return t-r}_writeToCell(e,t,r,s){if(e._data[t*3+2]&268435456){let i=e._extendedAttrs[t];if(i){if(i.imageId!==void 0){let c=this._images.get(i.imageId);c&&c.tileCount--,i.imageId=r,i.tileId=s;return}e._extendedAttrs[t]=new Gf(i.ext,i.urlId,r,s);return}}e._data[t*3+2]|=268435456,e._extendedAttrs[t]=new Gf(0,0,r,s)}_evictOnAlternate(){for(let r of this._images.values())r.bufferType==="alternate"&&(r.tileCount=0);let e=this._terminal._core.buffer;for(let r=0;r<this._terminal.rows;++r){let s=e.lines.get(r);if(s){for(let i=0;i<this._terminal.cols;++i)if(s._data[i*3+2]&268435456){let c=s._extendedAttrs[i]?.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)}},uT=Z0(_x()),dT=Z0(nT());function kd(e){let t="";for(let r=0;r<e.length;++r)t+=String.fromCharCode(e[r]);return t}function Oh(e){let t=0;for(let r=0;r<e.length;++r){if(e[r]<48||e[r]>57)throw new Error("illegal char");t=t*10+e[r]-48}return t}function Fm(e){let t=kd(e);if(!t.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return t}function hT(e){if(typeof Buffer<"u")return Buffer.from(kd(e),"base64").toString();let t=atob(kd(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 Um={inline:Oh,size:Oh,name:hT,width:Fm,height:Fm,preserveAspectRatio:Oh},$m=[70,105,108,101],zm=[77,117,108,116,105,112,97,114,116,70,105,108,101],Fh=[70,105,108,101,80,97,114,116],Uh=[70,105,108,101,69,110,100],$h=[82,101,112,111,114,116,67,101,108,108,83,105,122,101],zh=1024,fT=class{constructor(){this.state=0,this._buffer=new Uint32Array(zh),this._position=0,this._key="",this.fields={}}reset(){this._buffer.fill(0),this.state=0,this._position=0,this.fields={},this._key=""}end(){if(this.state===0){if(this._position===Uh.length){for(let t=0;t<Uh.length;++t)if(this._buffer[t]!==Uh[t])return this._a();return this.fields.type=4,this.state=4,0}if(this._position===$h.length){for(let t=0;t<$h.length;++t)if(this._buffer[t]!==$h[t])return this._a();return this.fields.type=5,this.state=4,0}return this._a()}return this.state===4?0:this.state===3&&this.fields.type===2?this._storeValue(this._position)?(this.state=4,0):this._a():this._a()}parse(t,r,s){let i=this.state,c=this._position,u=this._buffer;if(i===1||i===4||i===0&&c>14)return-1;for(let f=r;f<s;++f){let p=t[f];switch(p){case 59:if(!this._storeValue(c))return this._a();i=2,c=0;break;case 61:if(i===0){if(u[0]===70){let g=0;for(;g<$m.length;++g)if(u[g]!==$m[g])return this._a();if(this.fields.type=1,c===Fh.length){for(;g<Fh.length;++g)if(u[g]!==Fh[g])return this._a();return this.fields.type=3,this.state=4,f+1}}else if(u[0]===77){for(let g=0;g<zm.length;++g)if(u[g]!==zm[g])return this._a();this.fields.type=2}else return this._a();i=2,c=0}else if(i===2){if(!this._storeKey(c))return this._a();i=3,c=0}else if(i===3){if(c>=zh)return this._a();u[c++]=p}break;case 58:return i===3&&!this._storeValue(c)?this._a():(this.state=4,f+1);default:if(c>=zh)return this._a();u[c++]=p}}return this.state=i,this._position=c,-2}_a(){return this.fields.type=0,this.state=1,-1}_storeKey(t){let r=kd(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]=Um[this._key]?Um[this._key](r):r}catch{return!1}return!0}return!1}},Id={mime:"unsupported",width:0,height:0};function pT(e){if(e.length<24)return Id;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]=mT(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]}:Id}function mT(e){let t=e.length,r=4,s=e[r]<<8|e[r+1];for(;;){if(r+=s,r>=t)return[0,0];if(e[r]!==255)return[0,0];if(e[r+1]===192||e[r+1]===194)return r+8<t?[e[r+7]<<8|e[r+8],e[r+5]<<8|e[r+6]]:[0,0];r+=2,s=e[r]<<8|e[r+1]}}var Hh={type:0,name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0},gT=class{constructor(e,t,r,s){this._opts=e,this._renderer=t,this._storage=r,this._coreTerminal=s,this._aborted=!1,this._hp=new fT,this._header=Hh,this._metrics=Id,this._isMultipart=!1,this._abortMulti=!1;let i=Math.ceil(this._opts.iipSizeLimit*4/3),c=Math.min(1048576,i);this._dec=new uT.default(4194304,i,c),this._qoiDec=new dT.default(4194304)}reset(){this._hp.reset(),this._dec.release(),this._qoiDec.release()}start(){this._aborted=!1,this._metrics=Id,this._hp.reset()}put(e,t,r){if(!this._aborted)if(this._hp.state===4)this._dec.put(e.subarray(t,r))!==0&&(this._dec.release(),this._aborted=!0);else{let s=this._hp.parse(e,t,r);if(s===-1){this._aborted=!0;return}if(s>0){if(this._hp.fields.type===1){if(this._isMultipart&&(this._isMultipart=!1,this._abortMulti=!1,this._dec.release()),this._header=Object.assign({},Hh,this._hp.fields),!this._header.inline){this._aborted=!0;return}this._dec.init()}else if(this._abortMulti){this._aborted=!0;return}this._dec.put(e.subarray(s,r))!==0&&(this._dec.release(),this._aborted=!0,this._isMultipart&&(this._abortMulti=!0))}}}end(e){if(this._aborted||this._hp.state!==4&&this._hp.end())return!0;let t=this._hp.fields.type;if(t===3)return!0;if(t===5){let u=Ga.width,f=Ga.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 p=this._coreTerminal._core._coreBrowserService?.dpr??1,g=`\x1B]1337;ReportCellSize=${f.toFixed(3)};${u.toFixed(3)};${p.toFixed(3)}\x1B\\`;return this._coreTerminal.input(g,!1),!0}if(t===2)return this._header=Object.assign({},Hh,this._hp.fields),this._isMultipart=!0,this._abortMulti=!1,this._dec.release(),this._dec.init(),!0;if(t===4&&(!this._isMultipart||(this._isMultipart=!1,this._abortMulti||this._header.type!==2)))return!0;let r=0,s=0,i;if((i=e)&&(i=!this._dec.end())&&(this._metrics=pT(this._dec.data8),(i=this._metrics.mime!=="unsupported")&&(r=this._metrics.width,s=this._metrics.height,(i=r&&s&&r*s<this._opts.pixelLimit)&&([r,s]=this._resize(r,s).map(Math.floor),i=r&&s&&r*s<this._opts.pixelLimit))),!i)return this._dec.release(),!0;let 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=U0.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||Ga.width,s=this._renderer.dimensions?.css.cell.height||Ga.height,i=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,i,r),f=this._dim(this._header.height,c,s);if(!u&&!f){let p=i/e,g=(c-s)/t,x=Math.min(p,g);return x<1?[e*x,t*x]:[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}},xT=Z0(_x());function Hm(e){let t={},r=e.split(",");for(let s of r){let i=s.indexOf("=");if(i===-1)continue;let c=s.substring(0,i),u=s.substring(i+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 Wm=0,bT=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 i=s-t;if(this._controlLength+i>512){this._aborted=!0;return}if(this._controlData.set(e.subarray(t,s),this._controlLength),this._controlLength+=i,!this._inControlData){if(this._parsedCommand=Hm(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,i=this._pendingTransmissions.get(s),c=i?.totalEncodedSize??0;if(this._totalEncodedSize+=r-t,c+this._totalEncodedSize>this._encodedSizeLimit){let u=this._activeDecoder??i?.decoder;u&&u.release(),this._activeDecoder=null,i&&this._removePendingEntry(s),this._aborted=!0;return}this._decodeError||(i?.decoder&&!this._activeDecoder&&(this._activeDecoder=i.decoder),this._activeDecoder||(this._activeDecoder=new xT.default(4194304,this._maxEncodedBytes,this._initialEncodedBytes),this._activeDecoder.init()),this._activeDecoder.put(e.subarray(t,r))!==Wm&&(this._activeDecoder.release(),this._activeDecoder=null,this._decodeError=!0,i&&this._removePendingEntry(s)))}end(e){if(this._aborted||!e)return this._activeDecoder&&(this._activeDecoder.release(),this._activeDecoder=null),!0;if(this._inControlData)return this._handleNoPayloadCommand();let t=this._parsedCommand;if(t.action==="d")return this._handleDelete(t);let r=t.id??this._lastPendingKey??0,s=t.more===1,i=this._pendingTransmissions.get(r);if(s)return this._activeDecoder&&(i?(i.totalEncodedSize+=this._totalEncodedSize,i.decodeError=i.decodeError||this._decodeError):this._pendingTransmissions.set(r,{cmd:{...t},decoder:this._activeDecoder,totalEncodedSize:this._totalEncodedSize,decodeError:this._decodeError}),this._lastPendingKey=r,this._activeDecoder=null),!0;i&&(this._lastPendingKey=void 0);let c=this._decodeError,u=t,f=this._activeDecoder;i&&(u=i.cmd,f=i.decoder,c=c||i.decodeError,this._pendingTransmissions.delete(r));let p=new Uint8Array(0);f&&(f.end()!==Wm&&(c=!0),p=f.data8),this._activeDecoder=null;let g=this._handleCommandWithBytesAndCmd(u,p,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=Hm(this._parseControlDataString());if(e.id!==void 0&&e.imageNumber!==void 0)return this._sendResponse(e.id,"EINVAL:cannot specify both i and I keys",e.quiet??0),!0;switch(e.action??"t"){case"d":return this._handleDelete(e);case"q":return this._sendResponse(e.id??0,"OK",e.quiet??0),!0;case"p":return this._handlePlacement(e);default:return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported action",e.quiet??0),!0}}_handleCommandWithBytesAndCmd(e,t,r){switch(e.action??"t"){case"t":{let s=this._handleTransmit(e,t,r);return(e.transmission??"d")==="d"&&e.id!==void 0&&(r?this._sendResponse(e.id,"EINVAL:invalid base64 data",e.quiet??0):t.length>0&&this._sendResponse(e.id,"OK",e.quiet??0)),s}case"T":return this._handleTransmitDisplay(e,t,r);case"q":return this._handleQuery(e,t,r);case"p":return this._handlePlacement(e);default:return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported action",e.quiet??0),!0}}_handlePlacement(e){if(e.id===void 0)return!0;let t=e.id,r=this._kittyStorage.getImage(t);return r?this._displayImage(r,e).then(s=>(this._sendResponse(t,s?"OK":"EINVAL:image rendering failed",e.quiet??0,e.placementId),!0)):(this._sendResponse(t,"ENOENT:image not found",e.quiet??0,e.placementId),!0)}_handleTransmit(e,t,r){return(e.transmission??"d")!=="d"?(e.id!==void 0&&this._sendResponse(e.id,"EINVAL:unsupported transmission medium",e.quiet??0),!0):(r||t.length===0||this._kittyStorage.storeImage(e.id,{data:new Blob([t]),width:e.width??0,height:e.height??0,format:e.format??32,compression:e.compression??""}),!0)}_handleTransmitDisplay(e,t,r){if(r)return e.id!==void 0&&this._sendResponse(e.id,"EINVAL:invalid base64 data",e.quiet??0),!0;this._handleTransmit(e,t,r);let s=e.id??this._kittyStorage.lastImageId,i=this._kittyStorage.getImage(s);if(i){let c=this._displayImage(i,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,i=e.quiet??0;if((e.transmission??"d")!=="d")return this._sendResponse(s,"EINVAL:unsupported transmission medium",i),!0;if(r)return this._sendResponse(s,"EINVAL:invalid base64 data",i),!0;if(t.length===0)return this._sendResponse(s,"OK",i),!0;let c=e.format??32;if(c===100)this._sendResponse(s,"OK",i);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",i),!0;let p=c===32?4:3,g=u*f*p;if(t.length<g)return this._sendResponse(s,"EINVAL:insufficient pixel data",i),!0;this._sendResponse(s,"OK",i)}return!0}_handleDelete(e){switch(e.deleteSelector??"a"){case"a":case"A":this._cleanupAllPending(),this._kittyStorage.deleteAll();break;case"i":case"I":if(e.id!==void 0){let t=this._pendingTransmissions.get(e.id);t&&t.decoder.release(),this._removePendingEntry(e.id),this._kittyStorage.deleteById(e.id)}break}return!0}_sendResponse(e,t,r,s){let i=t==="OK";if(i&&r>=1||!i&&r>=2)return;let 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),i=Math.max(0,t.y??0),c=t.sourceWidth||r.width-s,u=t.sourceHeight||r.height-i,f=Math.max(0,r.width-s),p=Math.max(0,r.height-i),g=Math.max(0,Math.min(c,f)),x=Math.max(0,Math.min(u,p));if(g===0||x===0)throw new Error("invalid source rectangle");if(s!==0||i!==0||g!==r.width||x!==r.height){let Ue=await createImageBitmap(r,s,i,g,x);r.close(),r=Ue}let b=this._renderer.dimensions?.css.cell.width||Ga.width,v=this._renderer.dimensions?.css.cell.height||Ga.height,w,k;t.columns!==void 0&&t.rows!==void 0?(w=t.columns,k=t.rows):t.columns!==void 0?(w=t.columns,k=Math.max(1,Math.ceil(r.height/r.width*(w*b)/v))):t.rows!==void 0?(k=t.rows,w=Math.max(1,Math.ceil(r.width/r.height*(k*v)/b))):(w=Math.ceil(r.width/b),k=Math.ceil(r.height/v));let I=r.width,N=r.height;if((t.columns!==void 0||t.rows!==void 0)&&(I=Math.round(w*b),N=Math.round(k*v)),I*N>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");let M=this._coreTerminal._core.buffer,D=M.x,F=M.y,Z=M.ybase,G=t.zIndex!==void 0&&t.zIndex<0?"bottom":"top";if(I!==r.width||N!==r.height){let Ue=await createImageBitmap(r,{resizeWidth:I,resizeHeight:N});r.close(),r=Ue}let U=Math.min(Math.max(0,t.xOffset??0),b-1),q=Math.min(Math.max(0,t.yOffset??0),v-1);if(U!==0||q!==0){let Ue=t.columns!==void 0?Math.round(w*b):r.width+U,be=t.rows!==void 0?Math.round(k*v):r.height+q,Ae=U0.createCanvas(window.document,Ue,be),Ke=Ae.getContext("2d");if(!Ke)throw new Error("Failed to create offset canvas context");Ke.drawImage(r,U,q);let qe=await createImageBitmap(Ae);if(Ae.width=Ae.height=0,r.close(),r=qe,I=r.width,N=r.height,I*N>this._opts.pixelLimit)throw new Error("image exceeds pixel limit");t.columns===void 0&&(w=Math.ceil(r.width/b)),t.rows===void 0&&(k=Math.ceil(r.height/v))}let pe=t.zIndex??0;if(this._kittyStorage.addImage(e.id,r,!0,G,pe),r=void 0,t.cursorMovement===1){let Ue=M.ybase-Z;M.x=D,M.y=Math.max(F-Ue,0)}else M.x=Math.min(D+w,this._coreTerminal.cols)}catch(s){throw r?.close(),s}}async _createBitmap(e){let t=new Uint8Array(await e.data.arrayBuffer());if(e.compression==="z"&&(t=await this._decompressZlib(t)),e.format===100){let I=new Blob([t],{type:"image/png"});if(!window.createImageBitmap){let N=URL.createObjectURL(I),M=new Image;return new Promise((D,F)=>{M.addEventListener("load",()=>{URL.revokeObjectURL(N);let Z=U0.createCanvas(window.document,M.width,M.height);Z.getContext("2d")?.drawImage(M,0,0),createImageBitmap(Z).then(D).catch(F)}),M.addEventListener("error",()=>{URL.revokeObjectURL(N),F(new Error("Failed to load image"))}),M.src=N})}return createImageBitmap(I)}let r=e.width,s=e.height;if(!r||!s)throw new Error("Width and height required for raw pixel data");let i=e.format===32?4:3,c=r*s*i;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),p=new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),g=new Uint32Array(f.buffer),x=u&-4,b=0,v=0;for(let I=0;I<x;I+=4){let N=p[b++],M=p[b++],D=p[b++];g[v++]=4278190080|N,g[v++]=4278190080|N>>>24|M<<8,g[v++]=4278190080|M>>>16|D<<16,g[v++]=4278190080|D>>>8}let w=x*3,k=x*4;for(let I=x;I<u;I++)f[k]=t[w],f[k+1]=t[w+1],f[k+2]=t[w+2],f[k+3]=255,w+=3,k+=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 i=[],c=r.readable.getReader();for(;;){let{done:g,value:x}=await c.read();if(g)break;i.push(x)}let u=i.reduce((g,x)=>g+x.length,0),f=new Uint8Array(u),p=0;for(let g of i)f.set(g,p),p+=g.length;return f}get images(){return this._kittyStorage.images}get _kittyIdToStorageId(){return this._kittyStorage.kittyIdToStorageId}get pendingTransmissions(){return this._pendingTransmissions}},Ex=class Vf{constructor(t){this._storage=t,this._nextImageId=1,this._images=new Map,this._kittyIdToStorageId=new Map,this._storageIdToKittyId=new Map,this._handleStorageImageDeleted=r=>{let s=this._storageIdToKittyId.get(r);s!==void 0&&(this._kittyIdToStorageId.delete(s),this._storageIdToKittyId.delete(r),this._images.delete(s))},this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"},this._previousOnImageDeleted=this._storage.onImageDeleted,this._wrappedOnImageDeleted=r=>{this._previousOnImageDeleted?.(r),this._handleStorageImageDeleted(r)},this._storage.onImageDeleted=this._wrappedOnImageDeleted}reset(){this._nextImageId=1,this._images.clear(),this._kittyIdToStorageId.clear(),this._storageIdToKittyId.clear()}dispose(){this.reset(),this._storage.onImageDeleted===this._wrappedOnImageDeleted&&(this._storage.onImageDeleted=this._previousOnImageDeleted)}storeImage(t,r){let s=t??this._nextImageId++,i=this._kittyIdToStorageId.get(s);return i!==void 0&&(this._storage.deleteImage(i),this._kittyIdToStorageId.delete(s),this._storageIdToKittyId.delete(i)),!this._images.has(s)&&this._images.size>=Vf._maxStoredImages&&this._evictUndisplayedImages(),this._images.set(s,{...r,id:s}),s}addImage(t,r,s,i,c){let u=this._kittyIdToStorageId.get(t);u!==void 0&&this._storageIdToKittyId.delete(u),this._addImageOpts.scrolling=s,this._addImageOpts.layer=i,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<=Vf._maxStoredImages/2)break;this._kittyIdToStorageId.has(t)||this._images.delete(t)}}};Ex._maxStoredImages=256;var yT=Ex,ru=Z0(Qp()),vT=Z0(iT()),wT=4194304,qf=ru.PALETTE_ANSI_256;qf.set(ru.PALETTE_VT340_COLOR);var AT=class{constructor(e,t,r){this._opts=e,this._storage=t,this._coreTerminal=r,this._size=0,this._aborted=!1,(0,vT.DecoderAsync)({memoryLimit:this._opts.pixelLimit*4,palette:qf,paletteLimit:this._opts.sixelPaletteLimit}).then(s=>this._dec=s)}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,qf,this._opts.sixelPaletteLimit))}hook(e){if(this._size=0,this._aborted=!1,this._dec){let t=e.params[1]===1?0:TT(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=U0.createCanvas(void 0,t,r);return s.getContext("2d")?.putImageData(new ImageData(this._dec.data8,t,r),0,0),this._dec.memoryUsage>wT&&this._dec.release(),this._storage.addImage(s),!0}};function TT(e,t){let r=0;if(!t)return r;if(e.isInverse())if(e.isFgDefault())r=Uu(t.foreground.rgba);else if(e.isFgRGB()){let s=e.constructor.toColorRGB(e.getFgColor());r=(0,ru.toRGBA8888)(...s)}else r=Uu(t.ansi[e.getFgColor()].rgba);else if(e.isBgDefault())r=Uu(t.background.rgba);else if(e.isBgRGB()){let s=e.constructor.toColorRGB(e.getBgColor());r=(0,ru.toRGBA8888)(...s)}else r=Uu(t.ansi[e.getBgColor()].rgba);return r}function Uu(e){return ru.BIG_ENDIAN?e:(e&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255}var CT=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=Ga);let r=Math.ceil(e/t.height);for(let s=1;s<r;++s)this._terminal._core._inputHandler.lineFeed()}}},ST=class{constructor(e){this._storage=e,this._addImageOpts={scrolling:!0,layer:"top",zIndex:0,cursorPos:"iip"}}addImage(e){this._storage.addImage(e,this._addImageOpts)}},Gm={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:4096,sixelSizeLimit:33554432,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:33554432,kittySupport:!0,kittySizeLimit:33554432},Vm=4096,_T=class{constructor(t){this._disposables=[],this._handlers=new Map,this._onImageAdded=new aT,this.onImageAdded=this._onImageAdded.event,this._opts=Object.assign({},Gm,t),this._defaultOpts=Object.assign({},Gm,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 U0(t),this._storage=new cT(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 CT(this._storage,this._opts,this._renderer,t),s=new AT(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 ST(this._storage),s=new gT(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 yT(this._storage),s=new bT(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]<=Vm?(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;${Vm}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=Ga;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 i=Math.floor(Math.sqrt(this._opts.pixelLimit));return this._report(`\x1B[?${t[0]};0;${i};${i}S`),!0;default:return this._report(`\x1B[?${t[0]};2S`),!0}return this._report(`\x1B[?${t[0]};1S`),!0}};const g0=new Map;function k0(e){return{name:e,get hasSubscribers(){return(g0.get(e)?.size??0)>0},publish(t){const r=g0.get(e);if(r)for(const s of r)s(t,e)},subscribe(t){const r=g0.get(e)??new Set;r.add(t),g0.set(e,r)},unsubscribe(t){const r=g0.get(e);if(!r)return!1;const s=r.delete(t);return r.size===0&&g0.delete(e),s}}}function LT(e){const t={start:`${e}:start`,end:`${e}:end`,asyncStart:`${e}:asyncStart`,asyncEnd:`${e}:asyncEnd`,error:`${e}:error`},r={start:k0(t.start),end:k0(t.end),asyncStart:k0(t.asyncStart),asyncEnd:k0(t.asyncEnd),error:k0(t.error),traceSync(s,i,c,...u){r.start.publish(i);try{const f=s.apply(c,u);return r.end.publish(i),f}catch(f){throw r.error.publish(f),f}},async tracePromise(s,i,c,...u){r.asyncStart.publish(i);try{const f=await s.apply(c,u);return r.asyncEnd.publish(i),f}catch(f){throw r.error.publish(f),f}},traceCallback(s,i,c,u,...f){r.start.publish(c);try{const p=s.apply(u,f);return r.end.publish(c),p}catch(p){throw r.error.publish(p),p}}};return r}var kT=Object.create,Bp=Object.defineProperty,IT=Object.getOwnPropertyDescriptor,ET=Object.getOwnPropertyNames,MT=Object.getPrototypeOf,RT=Object.prototype.hasOwnProperty,Mx=e=>{throw TypeError(e)},NT=(e,t,r)=>t in e?Bp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,DT=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},QT=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ET(t))!RT.call(e,i)&&i!==r&&Bp(e,i,{get:()=>t[i],enumerable:!(s=IT(t,i))||s.enumerable});return e},BT=(e,t,r)=>(r=e!=null?kT(MT(e)):{},QT(!e||!e.__esModule?Bp(r,"default",{value:e,enumerable:!0}):r,e)),Hs=(e,t,r)=>NT(e,typeof t!="symbol"?t+"":t,r),jp=(e,t,r)=>t.has(e)||Mx("Cannot "+r),V=(e,t,r)=>(jp(e,t,"read from private field"),r?r.call(e):t.get(e)),Zr=(e,t,r)=>t.has(e)?Mx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),cr=(e,t,r,s)=>(jp(e,t,"write to private field"),t.set(e,r),r),Rt=(e,t,r)=>(jp(e,t,"access private method"),r),Wh=(e,t,r,s)=>({set _(i){cr(e,t,i)},get _(){return V(e,t,s)}}),jT=DT((e,t)=>{var r=(()=>{var s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,u=Object.prototype.hasOwnProperty,f=(n,o)=>{for(var l in o)s(n,l,{get:o[l],enumerable:!0})},p=(n,o,l,d)=>{if(o&&typeof o=="object"||typeof o=="function")for(let h of c(o))!u.call(n,h)&&h!==l&&s(n,h,{get:()=>o[h],enumerable:!(d=i(o,h))||d.enumerable});return n},g=n=>p(s({},"__esModule",{value:!0}),n),x={};f(x,{BoundingBox:()=>ee,Font:()=>F1,Glyph:()=>br,Path:()=>$e,_parse:()=>it,load:()=>Py,loadSync:()=>Oy,parse:()=>jy});var b=0,v=-3;function w(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function k(n,o){this.source=n,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=o,this.destLen=0,this.ltree=new w,this.dtree=new w}var I=new w,N=new w,M=new Uint8Array(30),D=new Uint16Array(30),F=new Uint8Array(30),Z=new Uint16Array(30),G=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),U=new w,q=new Uint8Array(320);function pe(n,o,l,d){var h,m;for(h=0;h<l;++h)n[h]=0;for(h=0;h<30-l;++h)n[h+l]=h/l|0;for(m=d,h=0;h<30;++h)o[h]=m,m+=1<<n[h]}function Ue(n,o){var l;for(l=0;l<7;++l)n.table[l]=0;for(n.table[7]=24,n.table[8]=152,n.table[9]=112,l=0;l<24;++l)n.trans[l]=256+l;for(l=0;l<144;++l)n.trans[24+l]=l;for(l=0;l<8;++l)n.trans[168+l]=280+l;for(l=0;l<112;++l)n.trans[176+l]=144+l;for(l=0;l<5;++l)o.table[l]=0;for(o.table[5]=32,l=0;l<32;++l)o.trans[l]=l}var be=new Uint16Array(16);function Ae(n,o,l,d){var h,m;for(h=0;h<16;++h)n.table[h]=0;for(h=0;h<d;++h)n.table[o[l+h]]++;for(n.table[0]=0,m=0,h=0;h<16;++h)be[h]=m,m+=n.table[h];for(h=0;h<d;++h)o[l+h]&&(n.trans[be[o[l+h]]++]=h)}function Ke(n){n.bitcount--||(n.tag=n.source[n.sourceIndex++],n.bitcount=7);var o=n.tag&1;return n.tag>>>=1,o}function qe(n,o,l){if(!o)return l;for(;n.bitcount<24;)n.tag|=n.source[n.sourceIndex++]<<n.bitcount,n.bitcount+=8;var d=n.tag&65535>>>16-o;return n.tag>>>=o,n.bitcount-=o,d+l}function ie(n,o){for(;n.bitcount<24;)n.tag|=n.source[n.sourceIndex++]<<n.bitcount,n.bitcount+=8;var l=0,d=0,h=0,m=n.tag;do d=2*d+(m&1),m>>>=1,++h,l+=o.table[h],d-=o.table[h];while(d>=0);return n.tag=m,n.bitcount-=h,o.trans[l+d]}function Se(n,o,l){var d,h,m,y,T,_;for(d=qe(n,5,257),h=qe(n,5,1),m=qe(n,4,4),y=0;y<19;++y)q[y]=0;for(y=0;y<m;++y){var R=qe(n,3,0);q[G[y]]=R}for(Ae(U,q,0,19),T=0;T<d+h;){var E=ie(n,U);switch(E){case 16:var H=q[T-1];for(_=qe(n,2,3);_;--_)q[T++]=H;break;case 17:for(_=qe(n,3,3);_;--_)q[T++]=0;break;case 18:for(_=qe(n,7,11);_;--_)q[T++]=0;break;default:q[T++]=E;break}}Ae(o,q,0,d),Ae(l,q,d,h)}function tt(n,o,l){for(;;){var d=ie(n,o);if(d===256)return b;if(d<256)n.dest[n.destLen++]=d;else{var h,m,y,T;for(d-=257,h=qe(n,M[d],D[d]),m=ie(n,l),y=n.destLen-qe(n,F[m],Z[m]),T=y;T<y+h;++T)n.dest[n.destLen++]=n.dest[T]}}}function Ee(n){for(var o,l,d;n.bitcount>8;)n.sourceIndex--,n.bitcount-=8;if(o=n.source[n.sourceIndex+1],o=256*o+n.source[n.sourceIndex],l=n.source[n.sourceIndex+3],l=256*l+n.source[n.sourceIndex+2],o!==(~l&65535))return v;for(n.sourceIndex+=4,d=o;d;--d)n.dest[n.destLen++]=n.source[n.sourceIndex++];return n.bitcount=0,b}function oe(n,o){var l=new k(n,o),d,h,m;do{switch(d=Ke(l),h=qe(l,2,0),h){case 0:m=Ee(l);break;case 1:m=tt(l,I,N);break;case 2:Se(l,l.ltree,l.dtree),m=tt(l,l.ltree,l.dtree);break;default:m=v}if(m!==b)throw new Error("Data error")}while(!d);return l.destLen<l.dest.length?typeof l.dest.slice=="function"?l.dest.slice(0,l.destLen):l.dest.subarray(0,l.destLen):l.dest}Ue(I,N),pe(M,D,4,3),pe(F,Z,2,1),M[28]=0,D[28]=258;function de(n,o,l,d,h){return Math.pow(1-h,3)*n+3*Math.pow(1-h,2)*h*o+3*(1-h)*Math.pow(h,2)*l+Math.pow(h,3)*d}function Te(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}Te.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},Te.prototype.addPoint=function(n,o){typeof n=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=n,this.x2=n),n<this.x1&&(this.x1=n),n>this.x2&&(this.x2=n)),typeof o=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=o,this.y2=o),o<this.y1&&(this.y1=o),o>this.y2&&(this.y2=o))},Te.prototype.addX=function(n){this.addPoint(n,null)},Te.prototype.addY=function(n){this.addPoint(null,n)},Te.prototype.addBezier=function(n,o,l,d,h,m,y,T){let _=[n,o],R=[l,d],E=[h,m],H=[y,T];this.addPoint(n,o),this.addPoint(y,T);for(let z=0;z<=1;z++){let se=6*_[z]-12*R[z]+6*E[z],X=-3*_[z]+9*R[z]-9*E[z]+3*H[z],ue=3*R[z]-3*_[z];if(X===0){if(se===0)continue;let fr=-ue/se;0<fr&&fr<1&&(z===0&&this.addX(de(_[z],R[z],E[z],H[z],fr)),z===1&&this.addY(de(_[z],R[z],E[z],H[z],fr)));continue}let Ze=Math.pow(se,2)-4*ue*X;if(Ze<0)continue;let er=(-se+Math.sqrt(Ze))/(2*X);0<er&&er<1&&(z===0&&this.addX(de(_[z],R[z],E[z],H[z],er)),z===1&&this.addY(de(_[z],R[z],E[z],H[z],er)));let qt=(-se-Math.sqrt(Ze))/(2*X);0<qt&&qt<1&&(z===0&&this.addX(de(_[z],R[z],E[z],H[z],qt)),z===1&&this.addY(de(_[z],R[z],E[z],H[z],qt)))}},Te.prototype.addQuad=function(n,o,l,d,h,m){let y=n+.6666666666666666*(l-n),T=o+2/3*(d-o),_=y+1/3*(h-n),R=T+1/3*(m-o);this.addBezier(n,o,y,T,_,R,h,m)};var ee=Te;function ye(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}var ce={};function Ye(n,o){let l=Math.floor(n),d=n-l;if(ce[o]||(ce[o]={}),ce[o][d]!==void 0){let m=ce[o][d];return l+m}let h=+(Math.round(d+"e+"+o)+"e-"+o);return ce[o][d]=h,l+h}function at(n){let o=[[]],l=0,d=0;for(let h=0;h<n.length;h+=1){let m=o[o.length-1],y=n[h],T=m[0],_=m[1],R=m[m.length-1],E=n[h+1];m.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||m.pop():y.type==="L"&&R&&R.x===y.x&&R.y===y.y?m.pop():y.type==="Z"&&(T&&_&&R&&T.type==="M"&&_.type==="L"&&R.type==="L"&&R.x===T.x&&R.y===T.y&&(m.shift(),m[0].type="M"),h+1<n.length&&o.push([]))}return n=[].concat.apply([],o),n}function _e(n){return Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0,scale:1,x:0,y:0},n)}function $(n){return parseInt(n)===n&&(n={decimalPlaces:n,flipY:!1}),Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0},n)}ye.prototype.fromSVG=function(n,o={}){typeof SVGPathElement<"u"&&n instanceof SVGPathElement&&(n=n.getAttribute("d")),o=_e(o),this.commands=[];let l="0123456789",d="MmLlQqCcZzHhVv",h="SsTtAa",m="-+",y={},T=[""],_=!1;function R(X){return X.filter(ue=>ue.length).map(ue=>{let Ze=parseFloat(ue);return(o.decimalPlaces||o.decimalPlaces===0)&&(Ze=Ye(Ze,o.decimalPlaces)),Ze})}function E(X){if(!this.commands.length)return X;let ue=this.commands[this.commands.length-1];for(let Ze=0;Ze<X.length;Ze++)X[Ze]+=ue[Ze&1?"y":"x"];return X}function H(){if(y.type===void 0)return;let X=y.type.toUpperCase(),ue=X!=="Z"&&y.type.toUpperCase()!==y.type,Ze=R(T);if(T=[""],!Ze.length&&X!=="Z")return;ue&&X!=="H"&&X!=="V"&&(Ze=E.apply(this,[Ze]));let er=this.commands.length&&this.commands[this.commands.length-1].x||0,qt=this.commands.length&&this.commands[this.commands.length-1].y||0;switch(X){case"M":this.moveTo(...Ze);break;case"L":this.lineTo(...Ze);break;case"V":for(let fr=0;fr<Ze.length;fr++){let Er=0;ue&&(Er=this.commands.length&&this.commands[this.commands.length-1].y||0),this.lineTo(er,Ze[fr]+Er)}break;case"H":for(let fr=0;fr<Ze.length;fr++){let Er=0;ue&&(Er=this.commands.length&&this.commands[this.commands.length-1].x||0),this.lineTo(Ze[fr]+Er,qt)}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 fr in this.commands[this.commands.length-1])this.commands[this.commands.length-1][fr]===void 0&&(this.commands[this.commands.length-1][fr]=0)}for(let X=0;X<n.length;X++){let ue=n.charAt(X),Ze=T[T.length-1];if(l.indexOf(ue)>-1)T[T.length-1]+=ue;else if(m.indexOf(ue)>-1)if(!y.type&&!this.commands.length&&(y.type="L"),ue==="-")!y.type||Ze.indexOf("-")>0?_=!0:Ze.length?T.push("-"):T[T.length-1]=ue;else if(!y.type||Ze.length>0)_=!0;else continue;else if(d.indexOf(ue)>-1)y.type?(H.apply(this),y={type:ue}):y.type=ue;else{if(h.indexOf(ue)>-1)throw new Error("Unsupported path command: "+ue+". Currently supported commands are "+d.split("").join(", ")+".");` ,
62
+ \r\f\v`.indexOf(ue)>-1?T.push(""):ue==="."?!y.type||Ze.indexOf(ue)>-1?_=!0:T[T.length-1]+=ue:_=!0}if(_)throw new Error("Unexpected character: "+ue+" at offset "+X)}H.apply(this),o.optimize&&(this.commands=at(this.commands));let z=o.flipY,se=o.flipYBase;if(z===!0&&o.flipYBase===void 0){let X=this.getBoundingBox();se=X.y1+X.y2}for(let X in this.commands){let ue=this.commands[X];for(let Ze in ue)["x","x1","x2"].includes(Ze)?this.commands[X][Ze]=o.x+ue[Ze]*o.scale:["y","y1","y2"].includes(Ze)&&(this.commands[X][Ze]=o.y+(z?se-ue[Ze]:ue[Ze])*o.scale)}return this},ye.fromSVG=function(n,o){return new ye().fromSVG(n,o)},ye.prototype.moveTo=function(n,o){this.commands.push({type:"M",x:n,y:o})},ye.prototype.lineTo=function(n,o){this.commands.push({type:"L",x:n,y:o})},ye.prototype.curveTo=ye.prototype.bezierCurveTo=function(n,o,l,d,h,m){this.commands.push({type:"C",x1:n,y1:o,x2:l,y2:d,x:h,y:m})},ye.prototype.quadTo=ye.prototype.quadraticCurveTo=function(n,o,l,d){this.commands.push({type:"Q",x1:n,y1:o,x:l,y:d})},ye.prototype.close=ye.prototype.closePath=function(){this.commands.push({type:"Z"})},ye.prototype.extend=function(n){if(n.commands)n=n.commands;else if(n instanceof ee){let o=n;this.moveTo(o.x1,o.y1),this.lineTo(o.x2,o.y1),this.lineTo(o.x2,o.y2),this.lineTo(o.x1,o.y2),this.close();return}Array.prototype.push.apply(this.commands,n)},ye.prototype.getBoundingBox=function(){let n=new ee,o=0,l=0,d=0,h=0;for(let m=0;m<this.commands.length;m++){let y=this.commands[m];switch(y.type){case"M":n.addPoint(y.x,y.y),o=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=o,h=l;break;default:throw new Error("Unexpected path command "+y.type)}}return n.isEmpty()&&n.addPoint(0,0),n},ye.prototype.draw=function(n){let o=this._layers;if(o&&o.length){for(let d=0;d<o.length;d++)this.draw.call(o[d],n);return}let l=this._image;if(l){n.drawImage(l.image,l.x,l.y,l.width,l.height);return}n.beginPath();for(let d=0;d<this.commands.length;d+=1){let 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())},ye.prototype.toPathData=function(n){n=$(n);function o(T){let _=Ye(T,n.decimalPlaces);return Math.round(T)===_?""+_:_.toFixed(n.decimalPlaces)}function l(){let T="";for(let _=0;_<arguments.length;_+=1){let R=arguments[_];R>=0&&_>0&&(T+=" "),T+=o(R)}return T}let d=this.commands;n.optimize&&(d=JSON.parse(JSON.stringify(this.commands)),d=at(d));let h=n.flipY,m=n.flipYBase;if(h===!0&&m===void 0){let T=new ye;T.extend(d);let _=T.getBoundingBox();m=_.y1+_.y2}let y="";for(let T=0;T<d.length;T+=1){let _=d[T];_.type==="M"?y+="M"+l(_.x,h?m-_.y:_.y):_.type==="L"?y+="L"+l(_.x,h?m-_.y:_.y):_.type==="C"?y+="C"+l(_.x1,h?m-_.y1:_.y1,_.x2,h?m-_.y2:_.y2,_.x,h?m-_.y:_.y):_.type==="Q"?y+="Q"+l(_.x1,h?m-_.y1:_.y1,_.x,h?m-_.y:_.y):_.type==="Z"&&(y+="Z")}return y},ye.prototype.toSVG=function(n,o){this._layers&&this._layers.length&&console.warn("toSVG() does not support colr font layers yet"),this._image&&console.warn("toSVG() does not support SVG glyphs yet"),o||(o=this.toPathData(n));let l='<path d="';return l+=o,l+='"',this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?l+=' fill="none"':l+=' fill="'+this.fill+'"'),this.stroke&&(l+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),l+="/>",l},ye.prototype.toDOMElement=function(n,o){this._layers&&this._layers.length&&console.warn("toDOMElement() does not support colr font layers yet"),o||(o=this.toPathData(n));let l=document.createElementNS("http://www.w3.org/2000/svg","path");return l.setAttribute("d",o),this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?l.setAttribute("fill","none"):l.setAttribute("fill",this.fill)),this.stroke&&(l.setAttribute("stroke",this.stroke),l.setAttribute("stroke-width",this.strokeWidth)),l};var $e=ye;function Xe(n){throw new Error(n)}function Le(n,o){n||Xe(o)}var K={fail:Xe,argument:Le,assert:Le},Fe=32768,fe=2147483648,De=-32768,lt=32767+1/65536,Tt={},we={},me={};function Qe(n){return function(){return n}}we.BYTE=function(n){return K.argument(n>=0&&n<=255,"Byte value should be between 0 and 255."),[n]},me.BYTE=Qe(1),we.CHAR=function(n){return[n.charCodeAt(0)]},me.CHAR=Qe(1),we.CHARARRAY=function(n){(n===null||typeof n>"u")&&(n="",console.warn("CHARARRAY with undefined or null value encountered and treated as an empty string. This is probably caused by a missing glyph name."));let o=[];for(let l=0;l<n.length;l+=1)o[l]=n.charCodeAt(l);return o},me.CHARARRAY=function(n){return typeof n>"u"?0:n.length},we.USHORT=function(n){return[n>>8&255,n&255]},me.USHORT=Qe(2),we.SHORT=function(n){return n>=Fe&&(n=-(2*Fe-n)),[n>>8&255,n&255]},me.SHORT=Qe(2),we.UINT24=function(n){return[n>>16&255,n>>8&255,n&255]},me.UINT24=Qe(3),we.ULONG=function(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]},me.ULONG=Qe(4),we.LONG=function(n){return n>=fe&&(n=-(2*fe-n)),[n>>24&255,n>>16&255,n>>8&255,n&255]},me.LONG=Qe(4),we.FLOAT=function(n){if(n>lt||n<De)throw new Error(`Value ${n} is outside the range of representable values in 16.16 format`);let o=Math.round(n*65536)<<0;return we.ULONG(o)},me.FLOAT=me.ULONG,we.FIXED=we.ULONG,me.FIXED=me.ULONG,we.FWORD=we.SHORT,me.FWORD=me.SHORT,we.UFWORD=we.USHORT,me.UFWORD=me.USHORT,we.F2DOT14=function(n){return we.USHORT(n*16384)},me.F2DOT14=me.USHORT,we.LONGDATETIME=function(n){return[0,0,0,0,n>>24&255,n>>16&255,n>>8&255,n&255]},me.LONGDATETIME=Qe(8),we.TAG=function(n){return K.argument(n.length===4,"Tag should be exactly 4 ASCII characters."),[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)]},me.TAG=Qe(4),we.Card8=we.BYTE,me.Card8=me.BYTE,we.Card16=we.USHORT,me.Card16=me.USHORT,we.OffSize=we.BYTE,me.OffSize=me.BYTE,we.SID=we.USHORT,me.SID=me.USHORT,we.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?we.NUMBER16(n):we.NUMBER32(n)},me.NUMBER=function(n){return we.NUMBER(n).length},we.NUMBER16=function(n){return[28,n>>8&255,n&255]},me.NUMBER16=Qe(3),we.NUMBER32=function(n){return[29,n>>24&255,n>>16&255,n>>8&255,n&255]},me.NUMBER32=Qe(5),we.REAL=function(n){let o=n.toString(),l=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(o);if(l){let m=parseFloat("1e"+((l[2]?+l[2]:0)+l[1].length));o=(Math.round(n*m)/m).toString()}let d="";for(let m=0,y=o.length;m<y;m+=1){let T=o[m];T==="e"?d+=o[++m]==="-"?"c":"b":T==="."?d+="a":T==="-"?d+="e":d+=T}d+=d.length&1?"f":"ff";let h=[30];for(let m=0,y=d.length;m<y;m+=2)h.push(parseInt(d.substr(m,2),16));return h},me.REAL=function(n){return we.REAL(n).length},we.NAME=we.CHARARRAY,me.NAME=me.CHARARRAY,we.STRING=we.CHARARRAY,me.STRING=me.CHARARRAY,Tt.UTF8=function(n,o,l){let d=[],h=l;for(let m=0;m<h;m++,o+=1)d[m]=n.getUint8(o);return String.fromCharCode.apply(null,d)},Tt.UTF16=function(n,o,l){let d=[],h=l/2;for(let m=0;m<h;m++,o+=2)d[m]=n.getUint16(o);return String.fromCharCode.apply(null,d)},we.UTF16=function(n){let o=[];for(let l=0;l<n.length;l+=1){let d=n.charCodeAt(l);o[o.length]=d>>8&255,o[o.length]=d&255}return o},me.UTF16=function(n){return n.length*2};var gt={"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":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};Tt.MACSTRING=function(n,o,l,d){let h=gt[d];if(h===void 0)return;let m="";for(let y=0;y<l;y++){let T=n.getUint8(o+y);T<=127?m+=String.fromCharCode(T):m+=h[T&127]}return m};var ft=typeof WeakMap=="function"&&new WeakMap,ct,Kt=function(n){if(!ct){ct={};for(let h in gt)ct[h]=new String(h)}let o=ct[n];if(o===void 0)return;if(ft){let h=ft.get(o);if(h!==void 0)return h}let l=gt[n];if(l===void 0)return;let d={};for(let h=0;h<l.length;h++)d[l.charCodeAt(h)]=h+128;return ft&&ft.set(o,d),d};we.MACSTRING=function(n,o){let l=Kt(o);if(l===void 0)return;let d=[];for(let h=0;h<n.length;h++){let m=n.charCodeAt(h);if(m>=128&&(m=l[m],m===void 0))return;d[h]=m}return d},me.MACSTRING=function(n,o){let l=we.MACSTRING(n,o);return l!==void 0?l.length:0};function $t(n){return n>=-128&&n<=127}function Qt(n,o,l){let d=0,h=n.length;for(;o<h&&d<64&&n[o]===0;)++o,++d;return l.push(128|d-1),o}function ut(n,o,l){let d=0,h=n.length,m=o;for(;m<h&&d<64;){let y=n[m];if(!$t(y)||y===0&&m+1<h&&n[m+1]===0)break;++m,++d}l.push(d-1);for(let y=o;y<m;++y)l.push(n[y]+256&255);return m}function bt(n,o,l){let d=0,h=n.length,m=o;for(;m<h&&d<64;){let y=n[m];if(y===0||$t(y)&&m+1<h&&$t(n[m+1]))break;++m,++d}l.push(64|d-1);for(let y=o;y<m;++y){let T=n[y];l.push(T+65536>>8&255,T+256&255)}return m}we.VARDELTAS=function(n){let o=0,l=[];for(;o<n.length;){let d=n[o];d===0?o=Qt(n,o,l):d>=-128&&d<=127?o=ut(n,o,l):o=bt(n,o,l)}return l},we.INDEX=function(n){let o=1,l=[o],d=[];for(let T=0;T<n.length;T+=1){let _=we.OBJECT(n[T]);Array.prototype.push.apply(d,_),o+=_.length,l.push(o)}if(d.length===0)return[0,0];let h=[],m=1+Math.floor(Math.log(o)/Math.log(2))/8|0,y=[void 0,we.BYTE,we.USHORT,we.UINT24,we.ULONG][m];for(let T=0;T<l.length;T+=1){let _=y(l[T]);Array.prototype.push.apply(h,_)}return Array.prototype.concat(we.Card16(n.length),we.OffSize(m),h,d)},me.INDEX=function(n){return we.INDEX(n).length},we.DICT=function(n){let o=[],l=Object.keys(n),d=l.length;for(let h=0;h<d;h+=1){let m=parseInt(l[h],0),y=n[m],T=we.OPERAND(y.value,y.type),_=we.OPERATOR(m);for(let R=0;R<T.length;R++)o.push(T[R]);for(let R=0;R<_.length;R++)o.push(_[R])}return o},me.DICT=function(n){return we.DICT(n).length},we.OPERATOR=function(n){return n<1200?[n]:[12,n-1200]},we.OPERAND=function(n,o){let l=[];if(Array.isArray(o))for(let d=0;d<o.length;d+=1){K.argument(n.length===o.length,"Not enough arguments given for type"+o);let h=we.OPERAND(n[d],o[d]);for(let m=0;m<h.length;m++)l.push(h[m])}else if(o==="SID"){let d=we.NUMBER(n);for(let h=0;h<d.length;h++)l.push(d[h])}else if(o==="offset"){let d=we.NUMBER32(n);for(let h=0;h<d.length;h++)l.push(d[h])}else if(o==="number"){let d=we.NUMBER(n);for(let h=0;h<d.length;h++)l.push(d[h])}else if(o==="real"){let d=we.REAL(n);for(let h=0;h<d.length;h++)l.push(d[h])}else throw new Error("Unknown operand type "+o);return l},we.OP=we.BYTE,me.OP=me.BYTE;var It=typeof WeakMap=="function"&&new WeakMap;we.CHARSTRING=function(n){if(It){let d=It.get(n);if(d!==void 0)return d}let o=[],l=n.length;for(let d=0;d<l;d+=1){let h=n[d],m=we[h.type](h.value);for(let y=0;y<m.length;y++)o.push(m[y])}return It&&It.set(n,o),o},me.CHARSTRING=function(n){return we.CHARSTRING(n).length},we.OBJECT=function(n){let o=we[n.type];return K.argument(o!==void 0,"No encoding function for type "+n.type),o(n.value)},me.OBJECT=function(n){let o=me[n.type];return K.argument(o!==void 0,"No sizeOf function for type "+n.type),o(n.value)},we.TABLE=function(n){let o=[],l=(n.fields||[]).length,d=[],h=[];for(let m=0;m<l;m+=1){let y=n.fields[m],T=we[y.type];K.argument(T!==void 0,"No encoding function for field type "+y.type+" ("+y.name+")");let _=n[y.name];_===void 0&&(_=y.value);let R=T(_);if(y.type==="TABLE")_.fields!==null&&(h.push(o.length),d.push(R)),o.push(0,0);else for(let E=0;E<R.length;E++)o.push(R[E])}for(let m=0;m<d.length;m+=1){let y=h[m],T=o.length;K.argument(T<65536,"Table "+n.tableName+" too big."),o[y]=T>>8,o[y+1]=T&255;for(let _=0;_<d[m].length;_++)o.push(d[m][_])}return o},me.TABLE=function(n){let o=0,l=(n.fields||[]).length;for(let d=0;d<l;d+=1){let h=n.fields[d],m=me[h.type];K.argument(m!==void 0,"No sizeOf function for field type "+h.type+" ("+h.name+")");let y=n[h.name];y===void 0&&(y=h.value),o+=m(y),h.type==="TABLE"&&(o+=2)}return o},we.RECORD=we.TABLE,me.RECORD=me.TABLE,we.LITERAL=function(n){return n},me.LITERAL=function(n){return n.length};function St(n,o,l){if(o&&o.length)for(let d=0;d<o.length;d+=1){let h=o[d];this[h.name]=h.value}if(this.tableName=n,this.fields=o,l){let d=Object.keys(l);for(let h=0;h<d.length;h+=1){let m=d[h],y=l[m];this[m]!==void 0&&(this[m]=y)}}}St.prototype.encode=function(){return we.TABLE(this)},St.prototype.sizeOf=function(){return me.TABLE(this)};function Ht(n,o,l){l===void 0&&(l=o.length);let d=new Array(o.length+1);d[0]={name:n+"Count",type:"USHORT",value:l};for(let h=0;h<o.length;h++)d[h+1]={name:n+h,type:"USHORT",value:o[h]};return d}function te(n,o,l){let d=o.length,h=new Array(d+1);h[0]={name:n+"Count",type:"USHORT",value:d};for(let m=0;m<d;m++)h[m+1]={name:n+m,type:"TABLE",value:l(o[m],m)};return h}function Me(n,o,l){let d=o.length,h=[];h[0]={name:n+"Count",type:"USHORT",value:d};for(let m=0;m<d;m++)h=h.concat(l(o[m],m));return h}function ve(n){n.format===1?St.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(Ht("glyph",n.glyphs))):n.format===2?St.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Me("rangeRecord",n.ranges,function(o,l){return[{name:"startGlyphID"+l,type:"USHORT",value:o.start},{name:"endGlyphID"+l,type:"USHORT",value:o.end},{name:"startCoverageIndex"+l,type:"USHORT",value:o.index}]}))):K.assert(!1,"Coverage format must be 1 or 2.")}ve.prototype=Object.create(St.prototype),ve.prototype.constructor=ve;function _t(n){St.call(this,"scriptListTable",Me("scriptRecord",n,function(o,l){let d=o.script,h=d.defaultLangSys;return K.assert(!!h,"Unable to write GSUB: script "+o.tag+" has no default language system."),[{name:"scriptTag"+l,type:"TAG",value:o.tag},{name:"script"+l,type:"TABLE",value:new St("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new St("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:h.reqFeatureIndex}].concat(Ht("featureIndex",h.featureIndexes)))}].concat(Me("langSys",d.langSysRecords,function(m,y){let T=m.langSys;return[{name:"langSysTag"+y,type:"TAG",value:m.tag},{name:"langSys"+y,type:"TABLE",value:new St("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:T.reqFeatureIndex}].concat(Ht("featureIndex",T.featureIndexes)))}]})))}]}))}_t.prototype=Object.create(St.prototype),_t.prototype.constructor=_t;function Ve(n){St.call(this,"featureListTable",Me("featureRecord",n,function(o,l){let d=o.feature;return[{name:"featureTag"+l,type:"TAG",value:o.tag},{name:"feature"+l,type:"TABLE",value:new St("featureTable",[{name:"featureParams",type:"USHORT",value:d.featureParams}].concat(Ht("lookupListIndex",d.lookupListIndexes)))}]}))}Ve.prototype=Object.create(St.prototype),Ve.prototype.constructor=Ve;function yt(n,o){St.call(this,"lookupListTable",te("lookup",n,function(l){let d=o[l.lookupType];return K.assert(!!d,"Unable to write GSUB lookup type "+l.lookupType+" tables."),new St("lookupTable",[{name:"lookupType",type:"USHORT",value:l.lookupType},{name:"lookupFlag",type:"USHORT",value:l.lookupFlag}].concat(te("subtable",l.subtables,d)))}))}yt.prototype=Object.create(St.prototype),yt.prototype.constructor=yt;function Gt(n){n.format===1?St.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:1},{name:"startGlyphID",type:"USHORT",value:n.startGlyph}].concat(Ht("glyph",n.classes))):n.format===2?St.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:2}].concat(Me("rangeRecord",n.ranges,function(o,l){return[{name:"startGlyphID"+l,type:"USHORT",value:o.start},{name:"endGlyphID"+l,type:"USHORT",value:o.end},{name:"class"+l,type:"USHORT",value:o.classId}]}))):K.assert(!1,"Class format must be 1 or 2.")}Gt.prototype=Object.create(St.prototype),Gt.prototype.constructor=Gt;var ke={Table:St,Record:St,Coverage:ve,ClassDef:Gt,ScriptList:_t,FeatureList:Ve,LookupList:yt,ushortList:Ht,tableList:te,recordList:Me};function Ce(n,o){return n.getUint8(o)}function nt(n,o){return n.getUint16(o,!1)}function xe(n,o){return n.getInt16(o,!1)}function gr(n,o){return(n.getUint16(o)<<8)+n.getUint8(o+2)}function xt(n,o){return n.getUint32(o,!1)}function hn(n,o){return n.getInt32(o,!1)}function Xr(n,o){let l=n.getInt16(o,!1),d=n.getUint16(o+2,!1);return l+d/65535}function Rr(n,o){let l="";for(let d=o;d<o+4;d+=1)l+=String.fromCharCode(n.getInt8(d));return l}function Vr(n,o,l){let d=0;for(let h=0;h<l;h+=1)d<<=8,d+=n.getUint8(o+h);return d}function Un(n,o,l){let d=[];for(let h=o;h<l;h+=1)d.push(n.getUint8(h));return d}function _r(n){let o="";for(let l=0;l<n.length;l+=1)o+=String.fromCharCode(n[l]);return o}var is={byte:1,uShort:2,f2dot14:2,short:2,uInt24:3,uLong:4,fixed:4,longDateTime:8,tag:4},xr={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 ae(n,o){this.data=n,this.offset=o,this.relativeOffset=0}ae.prototype.parseByte=function(){let n=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,n},ae.prototype.parseChar=function(){let n=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,n},ae.prototype.parseCard8=ae.prototype.parseByte,ae.prototype.parseUShort=function(){let n=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,n},ae.prototype.parseCard16=ae.prototype.parseUShort,ae.prototype.parseSID=ae.prototype.parseUShort,ae.prototype.parseOffset16=ae.prototype.parseUShort,ae.prototype.parseShort=function(){let n=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,n},ae.prototype.parseF2Dot14=function(){let n=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,n},ae.prototype.parseUInt24=function(){let n=gr(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=3,n},ae.prototype.parseULong=function(){let n=xt(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},ae.prototype.parseLong=function(){let n=hn(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},ae.prototype.parseOffset32=ae.prototype.parseULong,ae.prototype.parseFixed=function(){let n=Xr(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,n},ae.prototype.parseString=function(n){let o=this.data,l=this.offset+this.relativeOffset,d="";this.relativeOffset+=n;for(let h=0;h<n;h++)d+=String.fromCharCode(o.getUint8(l+h));return d},ae.prototype.parseTag=function(){return this.parseString(4)},ae.prototype.parseLongDateTime=function(){let n=xt(this.data,this.offset+this.relativeOffset+4);return n-=2082844800,this.relativeOffset+=8,n},ae.prototype.parseVersion=function(n){let o=nt(this.data,this.offset+this.relativeOffset),l=nt(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,n===void 0&&(n=4096),o+l/n/10},ae.prototype.skip=function(n,o){o===void 0&&(o=1),this.relativeOffset+=is[n]*o},ae.prototype.parseULongList=function(n){n===void 0&&(n=this.parseULong());let o=new Array(n),l=this.data,d=this.offset+this.relativeOffset;for(let h=0;h<n;h++)o[h]=l.getUint32(d),d+=4;return this.relativeOffset+=n*4,o},ae.prototype.parseOffset16List=ae.prototype.parseUShortList=function(n){n===void 0&&(n=this.parseUShort());let o=new Array(n),l=this.data,d=this.offset+this.relativeOffset;for(let h=0;h<n;h++)o[h]=l.getUint16(d),d+=2;return this.relativeOffset+=n*2,o},ae.prototype.parseShortList=function(n){let o=new Array(n),l=this.data,d=this.offset+this.relativeOffset;for(let h=0;h<n;h++)o[h]=l.getInt16(d),d+=2;return this.relativeOffset+=n*2,o},ae.prototype.parseByteList=function(n){let o=new Array(n),l=this.data,d=this.offset+this.relativeOffset;for(let h=0;h<n;h++)o[h]=l.getUint8(d++);return this.relativeOffset+=n,o},ae.prototype.parseList=function(n,o){o||(o=n,n=this.parseUShort());let l=new Array(n);for(let d=0;d<n;d++)l[d]=o.call(this);return l},ae.prototype.parseList32=function(n,o){o||(o=n,n=this.parseULong());let l=new Array(n);for(let d=0;d<n;d++)l[d]=o.call(this);return l},ae.prototype.parseRecordList=function(n,o){o||(o=n,n=this.parseUShort());let l=new Array(n),d=Object.keys(o);for(let h=0;h<n;h++){let m={};for(let y=0;y<d.length;y++){let T=d[y],_=o[T];m[T]=_.call(this)}l[h]=m}return l},ae.prototype.parseRecordList32=function(n,o){o||(o=n,n=this.parseULong());let l=new Array(n),d=Object.keys(o);for(let h=0;h<n;h++){let m={};for(let y=0;y<d.length;y++){let T=d[y],_=o[T];m[T]=_.call(this)}l[h]=m}return l},ae.prototype.parseTupleRecords=function(n,o){let l=[];for(let d=0;d<n;d++){let h=[];for(let m=0;m<o;m++)h.push(this.parseF2Dot14());l.push(h)}return l},ae.prototype.parseStruct=function(n){if(typeof n=="function")return n.call(this);{let o=Object.keys(n),l={};for(let d=0;d<o.length;d++){let h=o[d],m=n[h];l[h]=m.call(this)}return l}},ae.prototype.parseValueRecord=function(n){if(n===void 0&&(n=this.parseUShort()),n===0)return;let o={};return n&1&&(o.xPlacement=this.parseShort()),n&2&&(o.yPlacement=this.parseShort()),n&4&&(o.xAdvance=this.parseShort()),n&8&&(o.yAdvance=this.parseShort()),n&16&&(o.xPlaDevice=void 0,this.parseShort()),n&32&&(o.yPlaDevice=void 0,this.parseShort()),n&64&&(o.xAdvDevice=void 0,this.parseShort()),n&128&&(o.yAdvDevice=void 0,this.parseShort()),o},ae.prototype.parseValueRecordList=function(){let n=this.parseUShort(),o=this.parseUShort(),l=new Array(o);for(let d=0;d<o;d++)l[d]=this.parseValueRecord(n);return l},ae.prototype.parsePointer=function(n){let o=this.parseOffset16();if(o>0)return new ae(this.data,this.offset+o).parseStruct(n)},ae.prototype.parsePointer32=function(n){let o=this.parseOffset32();if(o>0)return new ae(this.data,this.offset+o).parseStruct(n)},ae.prototype.parseListOfLists=function(n){let o=this.parseOffset16List(),l=o.length,d=this.relativeOffset,h=new Array(l);for(let m=0;m<l;m++){let y=o[m];if(y===0){h[m]=void 0;continue}if(this.relativeOffset=y,n){let T=this.parseOffset16List(),_=new Array(T.length);for(let R=0;R<T.length;R++)this.relativeOffset=y+T[R],_[R]=n.call(this);h[m]=_}else h[m]=this.parseUShortList()}return this.relativeOffset=d,h},ae.prototype.parseCoverage=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort(),l=this.parseUShort();if(o===1)return{format:1,glyphs:this.parseUShortList(l)};if(o===2){let d=new Array(l);for(let 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.")},ae.prototype.parseClassDef=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();return o===1?{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:o===2?{format:2,ranges:this.parseRecordList({start:ae.uShort,end:ae.uShort,classId:ae.uShort})}:(console.warn(`0x${n.toString(16)}: This font file uses an invalid ClassDef format of ${o}. It might be corrupted and should be reacquired if it doesn't display as intended.`),{format:o})},ae.list=function(n,o){return function(){return this.parseList(n,o)}},ae.list32=function(n,o){return function(){return this.parseList32(n,o)}},ae.recordList=function(n,o){return function(){return this.parseRecordList(n,o)}},ae.recordList32=function(n,o){return function(){return this.parseRecordList32(n,o)}},ae.pointer=function(n){return function(){return this.parsePointer(n)}},ae.pointer32=function(n){return function(){return this.parsePointer32(n)}},ae.tag=ae.prototype.parseTag,ae.byte=ae.prototype.parseByte,ae.uShort=ae.offset16=ae.prototype.parseUShort,ae.uShortList=ae.prototype.parseUShortList,ae.uInt24=ae.prototype.parseUInt24,ae.uLong=ae.offset32=ae.prototype.parseULong,ae.uLongList=ae.prototype.parseULongList,ae.fixed=ae.prototype.parseFixed,ae.f2Dot14=ae.prototype.parseF2Dot14,ae.struct=ae.prototype.parseStruct,ae.coverage=ae.prototype.parseCoverage,ae.classDef=ae.prototype.parseClassDef;var ar={reserved:ae.uShort,reqFeatureIndex:ae.uShort,featureIndexes:ae.uShortList};ae.prototype.parseScriptList=function(){return this.parsePointer(ae.recordList({tag:ae.tag,script:ae.pointer({defaultLangSys:ae.pointer(ar),langSysRecords:ae.recordList({tag:ae.tag,langSys:ae.pointer(ar)})})}))||[]},ae.prototype.parseFeatureList=function(){return this.parsePointer(ae.recordList({tag:ae.tag,feature:ae.pointer({featureParams:ae.offset16,lookupListIndexes:ae.uShortList})}))||[]},ae.prototype.parseLookupList=function(n){return this.parsePointer(ae.list(ae.pointer(function(){let o=this.parseUShort();K.argument(1<=o&&o<=9,"GPOS/GSUB lookup type "+o+" unknown.");let l=this.parseUShort(),d=l&16;return{lookupType:o,lookupFlag:l,subtables:this.parseList(ae.pointer(n[o])),markFilteringSet:d?this.parseUShort():void 0}})))||[]},ae.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){let n=this.parseUShort(),o=this.parseUShort();return K.argument(n===1&&o<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:ae.offset32,featureTableSubstitutionOffset:ae.offset32})})||[]},ae.prototype.parseVariationStore=function(){let n=this.relativeOffset,o=this.parseUShort(),l={itemVariationStore:this.parseItemVariationStore()};return this.relativeOffset=n+o+2,l},ae.prototype.parseItemVariationStore=function(){let n=this.relativeOffset,o={format:this.parseUShort(),variationRegions:[],itemVariationSubtables:[]},l=this.parseOffset32(),d=this.parseUShort(),h=this.parseULongList(d);this.relativeOffset=n+l,o.variationRegions=this.parseVariationRegionList();for(let m=0;m<d;m++){let y=h[m];this.relativeOffset=n+y,o.itemVariationSubtables.push(this.parseItemVariationSubtable())}return o},ae.prototype.parseVariationRegionList=function(){let n=this.parseUShort(),o=this.parseUShort();return this.parseRecordList(o,{regionAxes:ae.recordList(n,{startCoord:ae.f2Dot14,peakCoord:ae.f2Dot14,endCoord:ae.f2Dot14})})},ae.prototype.parseItemVariationSubtable=function(){let n=this.parseUShort(),o=this.parseUShort(),l=this.parseUShortList(),d=l.length;return{regionIndexes:l,deltaSets:n&&d?this.parseDeltaSets(n,o,d):[]}},ae.prototype.parseDeltaSetIndexMap=function(){let n=this.parseByte(),o=this.parseByte(),l=[],d=0;switch(n){case 0:d=this.parseUShort();break;case 1:d=this.parseULong();break;default:console.error(`unsupported DeltaSetIndexMap format ${n}`)}if(!d)return{format:n,entryFormat:o};let h=(o&xr.INNER_INDEX_BIT_COUNT_MASK)+1,m=((o&xr.MAP_ENTRY_SIZE_MASK)>>4)+1;for(let y=0;y<d;y++){let T;if(m===1)T=this.parseByte();else if(m===2)T=this.parseUShort();else if(m===3)T=this.parseUInt24();else if(m===4)T=this.parseULong();else throw new Error(`Invalid entry size of ${m}`);let _=T>>h,R=T&(1<<h)-1;l.push({outerIndex:_,innerIndex:R})}return{format:n,entryFormat:o,map:l}},ae.prototype.parseDeltaSets=function(n,o,l){let d=Array.from({length:n},()=>[]),h=o&xr.LONG_WORDS,m=o&xr.WORD_DELTA_COUNT_MASK;if(m>l)throw Error("wordCount must be less than or equal to regionIndexCount");let y=(h?this.parseLong:this.parseShort).bind(this),T=(h?this.parseShort:this.parseChar).bind(this);for(let _=0;_<n;_++)for(let R=0;R<l;R++)R<m?d[_].push(y()):d[_].push(T());return d},ae.prototype.parseTupleVariationStoreList=function(n,o,l){let d=this.parseUShort(),h=this.parseUShort()&1,m=this.parseOffset32(),y=(h?this.parseULong:this.parseUShort).bind(this),T={},_=y();h||(_*=2);let R;for(let E=0;E<d;E++){R=y(),h||(R*=2);let H=R-_;T[E]=H?this.parseTupleVariationStore(m+_,n,o,l,E):void 0,_=R}return T},ae.prototype.parseTupleVariationStore=function(n,o,l,d,h){let m=this.relativeOffset;this.relativeOffset=n,l==="cvar"&&(this.relativeOffset+=4);let y=this.parseUShort(),T=!!(y&xr.SHARED_POINT_NUMBERS),_=y&xr.COUNT_MASK,R=this.parseOffset16(),E=[],H=[];for(let X=0;X<_;X++){let ue=this.parseTupleVariationHeader(o,l);E.push(ue)}this.relativeOffset!==n+R&&(console.warn(`Unexpected offset after parsing tuple variation headers! Expected ${n+R}, actually ${this.relativeOffset}`),this.relativeOffset=n+R),T&&(H=this.parsePackedPointNumbers());let z=this.relativeOffset;for(let X=0;X<_;X++){let ue=E[X];ue.privatePoints=[],this.relativeOffset=z,l==="cvar"&&!ue.peakTuple&&console.warn("An embedded peak tuple is required in TupleVariationHeaders for the cvar table."),ue.flags.privatePointNumbers&&(ue.privatePoints=this.parsePackedPointNumbers()),delete ue.flags;let Ze=this.offset,er=this.relativeOffset,qt=fr=>{let Er,Cn,jn=()=>{let Pn=0;if(l==="gvar"){if(Pn=ue.privatePoints.length||H.length,!Pn){let Ds=d.get(h);Ds.path,Pn=Ds.points.length,Pn+=4}}else l==="cvar"&&(Pn=d.length);this.offset=Ze,this.relativeOffset=er,Er=this.parsePackedDeltas(Pn),l==="gvar"&&(Cn=this.parsePackedDeltas(Pn))};return{configurable:!0,get:function(){return Er===void 0&&jn(),fr==="deltasY"?Cn:Er},set:function(Pn){Er===void 0&&jn(),fr==="deltasY"?Cn=Pn:Er=Pn}}};Object.defineProperty(ue,"deltas",qt.call(this,"deltas")),l==="gvar"&&Object.defineProperty(ue,"deltasY",qt.call(this,"deltasY")),z+=ue.variationDataSize,delete ue.variationDataSize}this.relativeOffset=m;let se={headers:E};return se.sharedPoints=H,se},ae.prototype.parseTupleVariationHeader=function(n,o){let l=this.parseUShort(),d=this.parseUShort(),h=!!(d&xr.EMBEDDED_PEAK_TUPLE),m=!!(d&xr.INTERMEDIATE_REGION),y=!!(d&xr.PRIVATE_POINT_NUMBERS),T=h?void 0:d&xr.TUPLE_INDEX_MASK,_=h?this.parseTupleRecords(1,n)[0]:void 0,R=m?this.parseTupleRecords(1,n)[0]:void 0,E=m?this.parseTupleRecords(1,n)[0]:void 0,H={variationDataSize:l,peakTuple:_,intermediateStartTuple:R,intermediateEndTuple:E,flags:{embeddedPeakTuple:h,intermediateRegion:m,privatePointNumbers:y}};return o==="gvar"&&(H.sharedTupleRecordsIndex=T),H},ae.prototype.parsePackedPointNumbers=function(){let n=this.parseByte(),o=[],l=n;if(n>=128){let h=this.parseByte();l=(n&xr.POINT_RUN_COUNT_MASK)<<8|h}let d=0;for(;o.length<l;){let h=this.parseByte(),m=!!(h&xr.POINTS_ARE_WORDS),y=(h&xr.POINT_RUN_COUNT_MASK)+1;for(let T=0;T<y&&o.length<l;T++){let _;m?_=this.parseUShort():_=this.parseByte(),d=d+_,o.push(d)}}return o},ae.prototype.parsePackedDeltas=function(n){let o=[];for(;o.length<n;){let l=this.parseByte(),d=!!(l&xr.DELTAS_ARE_ZERO),h=!!(l&xr.DELTAS_ARE_WORDS),m=(l&xr.DELTA_RUN_COUNT_MASK)+1;for(let y=0;y<m&&o.length<n;y++)d?o.push(0):h?o.push(this.parseShort()):o.push(this.parseChar())}return o};var it={getByte:Ce,getCard8:Ce,getUShort:nt,getCard16:nt,getShort:xe,getUInt24:gr,getULong:xt,getFixed:Xr,getTag:Rr,getOffset:Vr,getBytes:Un,bytesToString:_r,Parser:ae},os=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],fn={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"},Zt={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},Yr={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 Ur(n,o,l){switch(n){case 0:if(o===65535)return"und";if(l)return l[o];break;case 1:return fn[o];case 3:return Yr[o]}}var Nr="utf-16",Zn={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"},Ln={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 kn(n,o,l){switch(n){case 0:return Nr;case 1:return Ln[l]||Zn[o];case 3:if(o===1||o===10)return Nr;break}}var as={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function $n(n){return as[n]}function Dr(n,o,l){let d={},h=new it.Parser(n,o),m=h.parseUShort(),y=h.parseUShort(),T=h.offset+h.parseUShort();for(let _=0;_<y;_++){let R=h.parseUShort(),E=h.parseUShort(),H=h.parseUShort(),z=h.parseUShort(),se=os[z]||z,X=h.parseUShort(),ue=h.parseUShort(),Ze=Ur(R,H,l),er=kn(R,E,H),qt=$n(R);if(er!==void 0&&Ze!==void 0&&qt!==void 0){let fr;if(er===Nr?fr=Tt.UTF16(n,T+ue,X):fr=Tt.MACSTRING(n,T+ue,X,er),fr){let Er=d[qt];Er===void 0&&(Er=d[qt]={});let Cn=Er[se];Cn===void 0&&(Cn=Er[se]={}),Cn[Ze]=fr}}}return m===1&&h.parseUShort(),d}function On(n){let o={};for(let l in n)o[n[l]]=parseInt(l);return o}function Y(n,o,l,d,h,m){return new ke.Record("NameRecord",[{name:"platformID",type:"USHORT",value:n},{name:"encodingID",type:"USHORT",value:o},{name:"languageID",type:"USHORT",value:l},{name:"nameID",type:"USHORT",value:d},{name:"length",type:"USHORT",value:h},{name:"offset",type:"USHORT",value:m}])}function We(n,o){let l=n.length,d=o.length-l+1;e:for(let h=0;h<d;h++)for(;h<d;h++){for(let m=0;m<l;m++)if(o[h+m]!==n[m])continue e;return h}return-1}function Mt(n,o){let l=We(n,o);if(l<0){l=o.length;let d=0,h=n.length;for(;d<h;++d)o.push(n[d])}return l}function Xt(n,o){let l=On(as),d=On(fn),h=On(Yr),m=[],y=[];for(let _ in n){let R,E=[],H={},z=On(os),se=l[_];for(let X in n[_]){let ue=z[X];if(ue===void 0&&(ue=X),R=parseInt(ue),isNaN(R))throw new Error('Name table entry "'+X+'" does not exist, see nameTableNames for complete list.');H[R]=n[_][X],E.push(R)}for(let X=0;X<E.length;X++){R=E[X];let ue=H[R];for(let Ze in ue){let er=ue[Ze];if(se===1||se===0){let qt=d[Ze],fr=Zt[qt],Er=kn(se,fr,qt),Cn=we.MACSTRING(er,Er);if(se===0&&(qt=o.indexOf(Ze),qt<0&&(qt=o.length,o.push(Ze)),fr=4,Cn=we.UTF16(er)),Cn!==void 0){let jn=Mt(Cn,y);m.push(Y(se,fr,qt,R,Cn.length,jn))}}if(se===3){let qt=h[Ze];if(qt!==void 0){let fr=we.UTF16(er),Er=Mt(fr,y);m.push(Y(3,1,qt,R,fr.length,Er))}}}}}m.sort(function(_,R){return _.platformID-R.platformID||_.encodingID-R.encodingID||_.languageID-R.languageID||_.nameID-R.nameID});let T=new ke.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:m.length},{name:"stringOffset",type:"USHORT",value:6+m.length*12}]);for(let _=0;_<m.length;_++)T.fields.push({name:"record_"+_,type:"RECORD",value:m[_]});return T.fields.push({name:"strings",type:"LITERAL",value:y}),T}function vr(n,o,l=[]){if(o<256&&o in os){if(l.length&&!l.includes(parseInt(o)))return;o=os[o]}for(let d in n)for(let h in n[d])if(h===o||parseInt(h)===o)return n[d][h]}var At={parse:Dr,make:Xt,getNameByID:vr};function Lr(n,o,l,d){n.length=o.parseUShort(),n.language=o.parseUShort()-1;let h=o.parseByteList(n.length),m=Object.assign({},h),y=kn(l,d,n.language),T=gt[y];for(let _=0;_<T.length;_++)m[T.charCodeAt(_)]=h[128+_];n.glyphIndexMap=m}function jr(n,o,l){o.parseUShort(),n.length=o.parseULong(),n.language=o.parseULong();let d;n.groupCount=d=o.parseULong(),n.glyphIndexMap={};for(let h=0;h<d;h+=1){let m=o.parseULong(),y=o.parseULong(),T=o.parseULong();for(let _=m;_<=y;_+=1)n.glyphIndexMap[_]=T,l===12&&T++}}function Jr(n,o,l,d,h){n.length=o.parseUShort(),n.language=o.parseUShort();let m;n.segCount=m=o.parseUShort()>>1,o.skip("uShort",3),n.glyphIndexMap={};let y=new it.Parser(l,d+h+14),T=new it.Parser(l,d+h+16+m*2),_=new it.Parser(l,d+h+16+m*4),R=new it.Parser(l,d+h+16+m*6),E=d+h+16+m*8;for(let H=0;H<m-1;H+=1){let z,se=y.parseUShort(),X=T.parseUShort(),ue=_.parseShort(),Ze=R.parseUShort();for(let er=X;er<=se;er+=1)Ze!==0?(E=R.offset+R.relativeOffset-2,E+=Ze,E+=(er-X)*2,z=it.getUShort(l,E),z!==0&&(z=z+ue&65535)):z=er+ue&65535,n.glyphIndexMap[er]=z}}function Ts(n,o){let l={};o.skip("uLong");let d=o.parseULong();for(let h=0;h<d;h+=1){let m=o.parseUInt24(),y={varSelector:m},T=o.parseOffset32(),_=o.parseOffset32(),R=o.relativeOffset;T&&(o.relativeOffset=T,y.defaultUVS=o.parseStruct({ranges:function(){return o.parseRecordList32({startUnicodeValue:o.parseUInt24,additionalCount:o.parseByte})}})),_&&(o.relativeOffset=_,y.nonDefaultUVS=o.parseStruct({uvsMappings:function(){let E={},H=o.parseRecordList32({unicodeValue:o.parseUInt24,glyphID:o.parseUShort});for(let z=0;z<H.length;z+=1)E[H[z].unicodeValue]=H[z];return E}})),l[m]=y,o.relativeOffset=R}n.varSelectorList=l}function Nn(n,o){let l={};l.version=it.getUShort(n,o),K.argument(l.version===0,"cmap table version should be 0."),l.numTables=it.getUShort(n,o+2);let d=null,h=-1,m=-1,y=null,T=null,_=[0,1,2,3,4,6],R=[0,1,10];for(let H=l.numTables-1;H>=0;H-=1)if(y=it.getUShort(n,o+4+H*8),T=it.getUShort(n,o+4+H*8+2),y===3&&R.includes(T)||y===0&&_.includes(T)||y===1&&T===0){if(m>0)continue;if(m=it.getULong(n,o+4+H*8+4),d)break}else if(y===0&&T===5){if(h=it.getULong(n,o+4+H*8+4),d=new it.Parser(n,o+h),d.parseUShort()!==14)h=-1,d=null;else if(m>0)break}if(m===-1)throw new Error("No valid cmap sub-tables found.");let E=new it.Parser(n,o+m);if(l.format=E.parseUShort(),l.format===0)Lr(l,E,y,T);else if(l.format===12||l.format===13)jr(l,E,l.format);else if(l.format===4)Jr(l,E,n,o,m);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 "+T+").");return d&&Ts(l,d),l}function $r(n,o,l){n.segments.push({end:o,start:o,delta:-(o-l),offset:0,glyphIndex:l})}function zr(n){n.segments.push({end:65535,start:65535,delta:1,offset:0})}function Pr(n){if(n.length===0)return n;let o=[n[0]];for(let l=1;l<n.length;l++){let d=o[o.length-1],h=n[l];d.end+1===h.start&&d.delta===h.delta&&h.end!==65535?d.end=h.end:o.push(h)}return o}function pn(n){let o=!0,l;for(l=n.length-1;l>0;l-=1)if(n.get(l).unicode>65535){o=!1;break}let d=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:o?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:o?12:20}];o||d.push({name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}),d.push({name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0});let h=new ke.Table("cmap",d);for(h.segments=[],l=0;l<n.length;l+=1){let se=n.get(l);for(let X=0;X<se.unicodes.length;X+=1)$r(h,se.unicodes[X],l)}h.segments.sort(function(se,X){return se.start-X.start}),h.segments=Pr(h.segments),zr(h);let m=h.segments.length,y=0,T=[],_=[],R=[],E=[],H=[],z=[];for(l=0;l<m;l+=1){let se=h.segments[l];se.end<=65535&&se.start<=65535?(T.push({name:"end_"+l,type:"USHORT",value:se.end}),_.push({name:"start_"+l,type:"USHORT",value:se.start}),R.push({name:"idDelta_"+l,type:"SHORT",value:se.delta}),E.push({name:"idRangeOffset_"+l,type:"USHORT",value:se.offset}),se.glyphId!==void 0&&H.push({name:"glyph_"+l,type:"USHORT",value:se.glyphId})):y+=1,!o&&se.glyphIndex!==void 0&&(z.push({name:"cmap12Start_"+l,type:"ULONG",value:se.start}),z.push({name:"cmap12End_"+l,type:"ULONG",value:se.end}),z.push({name:"cmap12Glyph_"+l,type:"ULONG",value:se.glyphIndex}))}h.segCountX2=(m-y)*2,h.searchRange=Math.pow(2,Math.floor(Math.log(m-y)/Math.log(2)))*2,h.entrySelector=Math.log(h.searchRange/2)/Math.log(2),h.rangeShift=h.segCountX2-h.searchRange;for(let se=0;se<T.length;se++)h.fields.push(T[se]);h.fields.push({name:"reservedPad",type:"USHORT",value:0});for(let se=0;se<_.length;se++)h.fields.push(_[se]);for(let se=0;se<R.length;se++)h.fields.push(R[se]);for(let se=0;se<E.length;se++)h.fields.push(E[se]);for(let se=0;se<H.length;se++)h.fields.push(H[se]);if(h.cmap4Length=14+T.length*2+2+_.length*2+R.length*2+E.length*2+H.length*2,!o){let se=16+z.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:se},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:z.length/3});for(let X=0;X<z.length;X++)h.fields.push(z[X])}return h}var Dn={parse:Nn,make:pn},cs=[".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"],Ti=[".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"],kr=[".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"],Yn=[".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"],ur=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Kr=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],sn=[".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 o=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 m=0;m<h.unicodes.length;m+=1)if(h.unicodes[m]===o)return d}return null};function hs(n){this.cmap=n}hs.prototype.charToGlyphIndex=function(n){return this.cmap.glyphIndexMap[n.codePointAt(0)]||0};function Or(n,o){this.encoding=n,this.charset=o}Or.prototype.charToGlyphIndex=function(n){let o=n.codePointAt(0),l=this.encoding[o];return this.charset.indexOf(l)};function mn(n){switch(n.version){case 1:this.names=sn.slice();break;case 2:this.names=new Array(n.numberOfGlyphs);for(let o=0;o<n.numberOfGlyphs;o++)n.glyphNameIndex[o]<sn.length?this.names[o]=sn[n.glyphNameIndex[o]]:this.names[o]=n.names[n.glyphNameIndex[o]-sn.length];break;case 2.5:this.names=new Array(n.numberOfGlyphs);for(let o=0;o<n.numberOfGlyphs;o++)this.names[o]=sn[o+n.glyphNameIndex[o]];break;case 3:this.names=[];break;default:this.names=[];break}}mn.prototype.nameToGlyphIndex=function(n){return this.names.indexOf(n)},mn.prototype.glyphIndexToName=function(n){return this.names[n]};function P(n){let o,l=n.tables.cmap.glyphIndexMap,d=Object.keys(l);for(let h=0;h<d.length;h+=1){let m=d[h],y=l[m];o=n.glyphs.get(y),o.addUnicode(parseInt(m))}for(let h=0;h<n.glyphs.length;h+=1)o=n.glyphs.get(h),n.cffEncoding?o.name=n.cffEncoding.charset[h]:n.glyphNames.names&&(o.name=n.glyphNames.glyphIndexToName(h))}function he(n){n._IndexToUnicodeMap={};let o=n.tables.cmap.glyphIndexMap,l=Object.keys(o);for(let d=0;d<l.length;d+=1){let h=l[d],m=o[h];n._IndexToUnicodeMap[m]===void 0?n._IndexToUnicodeMap[m]={unicodes:[parseInt(h)]}:n._IndexToUnicodeMap[m].unicodes.push(parseInt(h))}}function Ne(n,o){o.lowMemory?he(n):P(n)}function je(n,o,l,d,h){n.beginPath(),n.moveTo(o,l),n.lineTo(d,h),n.stroke()}var Re={line:je};function dt(n,o){let l=new ae(n,o),d=l.parseShort();d!==0&&console.warn("Only CPALv0 is currently fully supported.");let h=l.parseShort(),m=l.parseShort(),y=l.parseShort(),T=l.parseOffset32(),_=l.parseUShortList(m);l.relativeOffset=T;let R=l.parseULongList(y);return l.relativeOffset=T,{version:d,numPaletteEntries:h,colorRecords:R,colorRecordIndices:_}}function wt({version:n=0,numPaletteEntries:o=0,colorRecords:l=[],colorRecordIndices:d=[0]}){return K.argument(n===0,"Only CPALv0 are supported."),K.argument(l.length,"No colorRecords given."),K.argument(d.length,"No colorRecordIndices given."),d.length>1&&K.argument(o,"Can't infer numPaletteEntries on multiple colorRecordIndices"),new ke.Table("CPAL",[{name:"version",type:"USHORT",value:n},{name:"numPaletteEntries",type:"USHORT",value:o||l.length},{name:"numPalettes",type:"USHORT",value:d.length},{name:"numColorRecords",type:"USHORT",value:l.length},{name:"colorRecordsArrayOffset",type:"ULONG",value:12+2*d.length},...d.map((h,m)=>({name:"colorRecordIndices_"+m,type:"USHORT",value:h})),...l.map((h,m)=>({name:"colorRecords_"+m,type:"ULONG",value:h}))])}function Je(n){var o=(n&4278190080)>>24,l=(n&16711680)>>16,d=(n&65280)>>8,h=n&255;return o=o+256&255,l=l+256&255,d=d+256&255,h=(h+256&255)/255,{b:o,g:l,r:d,a:h}}function Ge(n,o,l=0,d="hexa"){if(o==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: ${o})`);if(o>h.numPaletteEntries)throw new Error(`Color index out of range (numPaletteEntries: ${h.numPaletteEntries}, index: ${o})`);let m=h.colorRecordIndices[l]+o;if(m>h.colorRecords)throw new Error(`Color index out of range (colorRecords.length: ${h.colorRecords.length}, lookupIndex: ${m})`);let y=Je(h.colorRecords[m]);return d==="bgra"?y:Jt(y,d)}function ot(n){return("0"+parseInt(n).toString(16)).slice(-2)}function sr(n){let o=n.r/255,l=n.g/255,d=n.b/255,h=Math.max(o,l,d),m=Math.min(o,l,d),y,T,_=(h+m)/2;if(h===m)y=T=0;else{let R=h-m;switch(T=_>.5?R/(2-h-m):R/(h+m),h){case o:y=(l-d)/R+(l<d?6:0);break;case l:y=(d-o)/R+2;break;case d:y=(o-l)/R+4;break}y/=6}return{h:y*360,s:T*100,l:_*100}}function vt(n){let{h:o,s:l,l:d,a:h}=n;o=o%360,l/=100,d/=100;let m=(1-Math.abs(2*d-1))*l,y=m*(1-Math.abs(o/60%2-1)),T=d-m/2,_=0,R=0,E=0;return 0<=o&&o<60?(_=m,R=y,E=0):60<=o&&o<120?(_=y,R=m,E=0):120<=o&&o<180?(_=0,R=m,E=y):180<=o&&o<240?(_=0,R=y,E=m):240<=o&&o<300?(_=y,R=0,E=m):300<=o&&o<=360&&(_=m,R=0,E=y),{r:Math.round((_+T)*255),g:Math.round((R+T)*255),b:Math.round((E+T)*255),a:h}}function zt(n){return parseInt(`0x${ot(n.b)}${ot(n.g)}${ot(n.r)}${ot(n.a*255)}`,16)}function ht(n,o="hexa"){let l=o=="raw"||o=="cpal",d=Number.isInteger(n),h=!0;if(d&&l||n==="currentColor")return n;if(typeof n=="object"){if(o=="bgra")return n;if(l)return zt(n)}else if(!d&&/^#([a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})$/i.test(n.trim())){switch(n=n.trim().substring(1),n.length){case 3:n={r:parseInt(n[0].repeat(2),16),g:parseInt(n[1].repeat(2),16),b:parseInt(n[2].repeat(2),16),a:1};break;case 4:n={r:parseInt(n[0].repeat(2),16),g:parseInt(n[1].repeat(2),16),b:parseInt(n[2].repeat(2),16),a:parseInt(n[3].repeat(2),16)/255};break;case 6:n={r:parseInt(n[0]+n[1],16),g:parseInt(n[2]+n[3],16),b:parseInt(n[4]+n[5],16),a:1};break;case 8:n={r:parseInt(n[0]+n[1],16),g:parseInt(n[2]+n[3],16),b:parseInt(n[4]+n[5],16),a:parseInt(n[6]+n[7],16)/255};break}if(o=="bgra")return n}else if(typeof document<"u"&&/^[a-z]+$/i.test(n)){let m=document.createElement("canvas").getContext("2d");m.fillStyle=n;let y=Jt(m.fillStyle,"hexa");y==="#000000ff"&&n.toLowerCase()!=="black"?h=!1:n=y}else{n=n.trim();let m=/rgba?\(\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:,|\s*)\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:,|\s*)\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:(?:,|\s|\/)\s*(?:(0*(?:\.\d+)?()|0*1(?:\.0+)?())|(?:\.\d+)|(\d+)(%)|(\d*\.\d+)(%)))?\s*\)/;if(m.test(n)){let y=n.match(m).filter(T=>typeof T<"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 T=n.match(y).filter(_=>typeof _<"u");n=vt({h:parseFloat(T[1])*(T[2]==="turn"?360:1),s:parseFloat(T[3]),l:parseFloat(T[4]),a:T[5]?parseFloat(T[5])/(T[6]?100:1):1})}else h=!1}}if(!h)throw new Error(`Invalid color format: ${n}`);return Jt(n,o)}function Jt(n,o="hexa"){if(n==="currentColor")return n;if(Number.isInteger(n)){if(o=="raw"||o=="cpal")return n;n=Je(n)}else typeof n!="object"&&(n=ht(n,"bgra"));let l=["hsl","hsla"].includes(o)?sr(n):null;switch(o){case"rgba":return`rgba(${n.r}, ${n.g}, ${n.b}, ${parseFloat(n.a.toFixed(3))})`;case"rgb":return`rgb(${n.r}, ${n.g}, ${n.b})`;case"hex":case"hex6":case"hex-6":return`#${ot(n.r)}${ot(n.g)}${ot(n.b)}`;case"hexa":case"hex8":case"hex-8":return`#${ot(n.r)}${ot(n.g)}${ot(n.b)}${ot(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 zt(n);default:throw new Error("Unknown color format: "+o)}}var Ir={parse:dt,make:wt,getPaletteColor:Ge,parseColor:ht,formatColor:Jt};function Nt(n,o){let l=o||new $e;return{configurable:!0,get:function(){return typeof l=="function"&&(l=l()),l},set:function(d){l=d}}}function pr(n){this.bindConstructorValues(n)}pr.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",Nt(this,n.path))},pr.prototype.addUnicode=function(n){this.unicodes.length===0&&(this.unicode=n),this.unicodes.push(n)},pr.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},pr.prototype.getPath=function(n,o,l,d,h){n=n!==void 0?n:0,o=o!==void 0?o:0,l=l!==void 0?l:72,d=Object.assign({},h&&h.defaultRenderOptions,d);let m,y,T=d.xScale,_=d.yScale,R=1/(this.path.unitsPerEm||1e3)*l,E=this;h&&h.variation&&(E=h.variation.getTransform(this,d.variation),m=E.path.commands),d.hinting&&h&&h.hinting&&(y=E.path&&h.hinting.exec(E,l,d)),y?(m=h.hinting.getCommands(y),n=Math.round(n),o=Math.round(o),T=_=1):(m=E.path.commands,T===void 0&&(T=R),_===void 0&&(_=R));let H=new $e;if(d.drawSVG){let z=this.getSvgImage(h);if(z){let se=new $e;return se._image={image:z.image,x:n+z.leftSideBearing*R,y:o-z.baseline*R,width:z.image.width*R,height:z.image.height*R},H._layers=[se],H}}if(d.drawLayers){let z=this.getLayers(h);if(z&&z.length){H._layers=[];for(let se=0;se<z.length;se+=1){let X=z[se],ue=Ge(h,X.paletteIndex,d.usePalette);ue==="currentColor"?ue=d.fill||"black":ue=Jt(ue,d.colorFormat||"rgba"),d=Object.assign({},d,{fill:ue}),H._layers.push(this.getPath.call(X.glyph,n,o,l,d,h))}return H}}H.fill=d.fill||this.path.fill,H.stroke=this.path.stroke,H.strokeWidth=this.path.strokeWidth*R;for(let z=0;z<m.length;z+=1){let se=m[z];se.type==="M"?H.moveTo(n+se.x*T,o+-se.y*_):se.type==="L"?H.lineTo(n+se.x*T,o+-se.y*_):se.type==="Q"?H.quadraticCurveTo(n+se.x1*T,o+-se.y1*_,n+se.x*T,o+-se.y*_):se.type==="C"?H.curveTo(n+se.x1*T,o+-se.y1*_,n+se.x2*T,o+-se.y2*_,n+se.x*T,o+-se.y*_):se.type==="Z"&&H.stroke&&H.strokeWidth&&H.closePath()}return H},pr.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)},pr.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)},pr.prototype.getContours=function(n=null){if(this.points===void 0&&!n)return[];let o=[],l=[],d=n||this.points;for(let h=0;h<d.length;h+=1){let m=d[h];l.push(m),m.lastPointOfContour&&(o.push(l),l=[])}return K.argument(l.length===0,"There are still points left in the current contour."),o},pr.prototype.getMetrics=function(){let n=this.path.commands,o=[],l=[];for(let h=0;h<n.length;h+=1){let m=n[h];m.type!=="Z"&&(o.push(m.x),l.push(m.y)),(m.type==="Q"||m.type==="C")&&(o.push(m.x1),l.push(m.y1)),m.type==="C"&&(o.push(m.x2),l.push(m.y2))}let d={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,l),xMax:Math.max.apply(null,o),yMax:Math.max.apply(null,l),leftSideBearing:this.leftSideBearing};return isFinite(d.xMin)||(d.xMin=0),isFinite(d.xMax)||(d.xMax=this.advanceWidth),isFinite(d.yMin)||(d.yMin=0),isFinite(d.yMax)||(d.yMax=0),d.rightSideBearing=this.advanceWidth-d.leftSideBearing-(d.xMax-d.xMin),d},pr.prototype.draw=function(n,o,l,d,h,m){h=Object.assign({},m&&m.defaultRenderOptions,h),this.getPath(o,l,d,h,m).draw(n)},pr.prototype.drawPoints=function(n,o,l,d,h,m){if(h=Object.assign({},m&&m.defaultRenderOptions,h),h.drawLayers){let H=this.getLayers(m);if(H&&H.length){for(let z=0;z<H.length;z+=1)H[z].glyph.index!==this.index&&this.drawPoints.call(H[z].glyph,n,o,l,d);return}}function y(H,z,se,X){n.beginPath();for(let ue=0;ue<H.length;ue+=1)n.moveTo(z+H[ue].x*X,se+H[ue].y*X),n.arc(z+H[ue].x*X,se+H[ue].y*X,2,0,Math.PI*2,!1);n.fill()}o=o!==void 0?o:0,l=l!==void 0?l:0,d=d!==void 0?d:24;let T=1/this.path.unitsPerEm*d,_=[],R=[],E=this.path.commands;m&&m.variation&&(E=m.variation.getTransform(this,h.variation).path.commands);for(let H=0;H<E.length;H+=1){let z=E[H];z.x!==void 0&&_.push({x:z.x,y:-z.y}),z.x1!==void 0&&R.push({x:z.x1,y:-z.y1}),z.x2!==void 0&&R.push({x:z.x2,y:-z.y2})}n.fillStyle="blue",y(_,o,l,T),n.fillStyle="red",y(R,o,l,T)},pr.prototype.drawMetrics=function(n,o,l,d){let h;o=o!==void 0?o: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",Re.line(n,o,-1e4,o,1e4),Re.line(n,-1e4,l,1e4,l);let m=this.xMin||0,y=this.yMin||0,T=this.xMax||0,_=this.yMax||0,R=this.advanceWidth||0;n.strokeStyle="blue",Re.line(n,o+m*h,-1e4,o+m*h,1e4),Re.line(n,o+T*h,-1e4,o+T*h,1e4),Re.line(n,-1e4,l+-y*h,1e4,l+-y*h),Re.line(n,-1e4,l+-_*h,1e4,l+-_*h),n.strokeStyle="green",Re.line(n,o+R*h,-1e4,o+R*h,1e4)},pr.prototype.toPathData=function(n,o){n=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},n);let l=this;o&&o.variation&&(l=o.variation.getTransform(this,n.variation));let d=l.points&&n.pointsTransform?n.pointsTransform(l.points):l.path;return n.pathTransform&&(d=n.pathTransform(d)),d.toPathData(n)},pr.prototype.fromSVG=function(n,o={}){return this.path.fromSVG(n,o)},pr.prototype.toSVG=function(n,o){let l=this.toPathData.apply(this,[n,o]);return this.path.toSVG(n,l)},pr.prototype.toDOMElement=function(n,o){n=Object.assign({},{variation:o&&o.defaultRenderOptions.variation},n);let l=this.path;return o&&o.variation&&(l=o.variation.getTransform(this,n.variation).path),l.toDOMElement(n)};var br=pr;function Xn(n,o,l){Object.defineProperty(n,o,{get:function(){return typeof n[l]>"u"&&n.path,n[l]},set:function(d){n[l]=d},enumerable:!0,configurable:!0})}function zn(n,o){if(this.font=n,this.glyphs={},Array.isArray(o))for(let l=0;l<o.length;l++){let d=o[l];d.path.unitsPerEm=n.unitsPerEm,this.glyphs[l]=d}this.length=o&&o.length||0}typeof Symbol<"u"&&Symbol.iterator&&(zn.prototype[Symbol.iterator]=function(){let n=-1;return{next:(function(){n++;let o=n>=this.length-1;return{value:this.get(n),done:o}}).bind(this)}}),zn.prototype.get=function(n){if(this.font._push&&this.glyphs[n]===void 0){this.font._push(n),typeof this.glyphs[n]=="function"&&(this.glyphs[n]=this.glyphs[n]());let o=this.glyphs[n],l=this.font._IndexToUnicodeMap[n];if(l)for(let d=0;d<l.unicodes.length;d++)o.addUnicode(l.unicodes[d]);this.font.cffEncoding?o.name=this.font.cffEncoding.charset[n]:this.font.glyphNames.names&&(o.name=this.font.glyphNames.glyphIndexToName(n)),this.glyphs[n].advanceWidth=this.font._hmtxTableData[n].advanceWidth,this.glyphs[n].leftSideBearing=this.font._hmtxTableData[n].leftSideBearing}else typeof this.glyphs[n]=="function"&&(this.glyphs[n]=this.glyphs[n]());return this.glyphs[n]},zn.prototype.push=function(n,o){this.glyphs[n]=o,this.length++};function Jn(n,o){return new br({index:o,font:n})}function Cs(n,o,l,d,h,m){return function(){let y=new br({index:o,font:n});return y.path=function(){l(y,d,h);let T=m(n.glyphs,y);return T.unitsPerEm=n.unitsPerEm,T},Xn(y,"numberOfContours","_numberOfContours"),Xn(y,"xMin","_xMin"),Xn(y,"xMax","_xMax"),Xn(y,"yMin","_yMin"),Xn(y,"yMax","_yMax"),Xn(y,"points","_points"),y}}function Vs(n,o,l,d,h){return function(){let m=new br({index:o,font:n});return m.path=function(){let y=l(n,m,d,h);return y.unitsPerEm=n.unitsPerEm,y},m}}var yn={GlyphSet:zn,glyphLoader:Jn,ttfGlyphLoader:Cs,cffGlyphLoader:Vs};function Fr(n,o){if(n===o)return!0;if(Array.isArray(n)&&Array.isArray(o)){if(n.length!==o.length)return!1;for(let l=0;l<n.length;l+=1)if(!Fr(n[l],o[l]))return!1;return!0}else return!1}var O=10;function ne(n){let o;return n.length<1240?o=107:n.length<33900?o=1131:o=32768,o}function le(n,o,l,d){let h=[],m=[],y=d>1?it.getULong(n,o):it.getCard16(n,o),T=d>1?4:2,_,R;if(y!==0){let E=it.getByte(n,o+T);_=o+(y+1)*E+T;let H=o+T+1;for(let z=0;z<y+1;z+=1)h.push(it.getOffset(n,H,E)),H+=E;R=_+h[y]}else R=o+T;for(let E=0;E<h.length-1;E+=1){let H=it.getBytes(n,_+h[E],_+h[E+1]);l&&(H=l(H,n,o,d)),m.push(H)}return{objects:m,startOffset:o,endOffset:R}}function ze(n,o,l){let d=[],h=l>1?it.getULong(n,o):it.getCard16(n,o),m=l>1?4:2,y,T;if(h!==0){let _=it.getByte(n,o+m);y=o+(h+1)*_+m;let R=o+m+1;for(let E=0;E<h+1;E+=1)d.push(it.getOffset(n,R,_)),R+=_;T=y+d[h]}else T=o+m;return{offsets:d,startOffset:o,endOffset:T}}function Lt(n,o,l,d,h,m){let y=m>1?it.getULong(l,d):it.getCard16(l,d),T=m>1?4:2,_=0;if(y!==0){let E=it.getByte(l,d+T);_=d+(y+1)*E+T}let R=it.getBytes(l,_+o[n],_+o[n+1]);return h&&(R=h(R)),R}function Pt(n){let o="",l=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){let d=n.parseByte(),h=d>>4,m=d&15;if(h===15||(o+=l[h],m===15))break;o+=l[m]}return parseFloat(o)}function Vt(n,o){let l,d,h,m;if(o===28)return l=n.parseByte(),d=n.parseByte(),l<<8|d;if(o===29)return l=n.parseByte(),d=n.parseByte(),h=n.parseByte(),m=n.parseByte(),l<<24|d<<16|h<<8|m;if(o===30)return Pt(n);if(o>=32&&o<=246)return o-139;if(o>=247&&o<=250)return l=n.parseByte(),(o-247)*256+l+108;if(o>=251&&o<=254)return l=n.parseByte(),-(o-251)*256-l-108;throw new Error("Invalid b0 "+o)}function dr(n){let o={};for(let l=0;l<n.length;l+=1){let d=n[l][0],h=n[l][1],m;if(h.length===1?m=h[0]:m=h,Object.prototype.hasOwnProperty.call(o,d)&&!isNaN(o[d]))throw new Error("Object "+o+" already has key "+d);o[d]=m}return o}function Bt(n,o,l,d){o=o!==void 0?o:0;let h=new it.Parser(n,o),m=[],y=[];l=l!==void 0?l:n.byteLength;let T=d<2?22:28;for(;h.relativeOffset<l;){let _=h.parseByte();if(_<T){if(_===12&&(_=1200+h.parseByte()),d>1&&_===23){Qn(y);continue}m.push([_,y]),y=[]}else y.push(Vt(h,_,d))}return dr(m)}function ir(n,o){return o<=390?o=cs[o]:n?o=n[o-391]:o=void 0,o}function qr(n,o,l){let d={},h;for(let m=0;m<o.length;m+=1){let y=o[m];if(Array.isArray(y.type)){let T=[];T.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=ir(l,h)),T[_]=h;d[y.name]=T}else h=n[y.op],h===void 0&&(h=y.value!==void 0?y.value:null),y.type==="SID"&&(h=ir(l,h)),d[y.name]=h}return d}function vn(n,o){let l={};if(l.formatMajor=it.getCard8(n,o),l.formatMinor=it.getCard8(n,o+1),l.formatMajor>2)throw new Error(`Unsupported CFF table version ${l.formatMajor}.${l.formatMinor}`);return l.size=it.getCard8(n,o+2),l.formatMajor<2?(l.offsetSize=it.getCard8(n,o+3),l.startOffset=o,l.endOffset=o+4):(l.topDictLength=it.getCard16(n,o+3),l.endOffset=o+8),l}var Hn=[{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"}],In=[{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"}],ci=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}],es=[{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"}],Cr=[{name:"private",op:18,type:["number","offset"],value:[0,0]}];function Ot(n,o,l,d){let h=Bt(n,o,n.byteLength,d);return qr(h,d>1?In:Hn,l)}function En(n,o,l,d,h){let m=Bt(n,o,l,h);return qr(m,h>1?es:ci,d)}function Ps(n,o,l){let d=Bt(n,o,void 0,l);return qr(d,Cr)}function ui(n,o,l){let d=[];for(let h=0;h<l.length;h++){let m=new DataView(new Uint8Array(l[h]).buffer),y=Ps(m,0,2),T=y.private[0],_=y.private[1];if(T!==0&&_!==0){let R=En(n,_+o,T,[],2);if(R.subrs){let E=_+R.subrs,H=le(n,E+o,void 0,2);y._subrs=H.objects,y._subrsBias=ne(y._subrs)}y._privateDict=R}d.push(y)}return d}function Hr(n,o,l,d,h){let m=[];for(let y=0;y<l.length;y+=1){let T=new DataView(new Uint8Array(l[y]).buffer),_=Ot(T,0,d,h);_._subrs=[],_._subrsBias=0,_._defaultWidthX=0,_._nominalWidthX=0;let R=h<2?_.private[0]:0,E=h<2?_.private[1]:0;if(R!==0&&E!==0){let H=En(n,E+o,R,d,h);if(_._defaultWidthX=H.defaultWidthX,_._nominalWidthX=H.nominalWidthX,H.subrs!==0){let z=E+H.subrs,se=le(n,z+o,void 0,h);_._subrs=se.objects,_._subrsBias=ne(_._subrs)}_._privateDict=H}m.push(_)}return m}function ts(n,o,l,d,h){let m,y,T=new it.Parser(n,o);l-=1;let _=[".notdef"],R=T.parseCard8();if(R===0)for(let E=0;E<l;E+=1)m=T.parseSID(),h?_.push(m):_.push(ir(d,m)||m);else if(R===1)for(;_.length<=l;){m=T.parseSID(),y=T.parseCard8();for(let E=0;E<=y;E+=1)h?_.push("cid"+("00000"+m).slice(-5)):_.push(ir(d,m)||m),m+=1}else if(R===2)for(;_.length<=l;){m=T.parseSID(),y=T.parseCard16();for(let E=0;E<=y;E+=1)h?_.push("cid"+("00000"+m).slice(-5)):_.push(ir(d,m)||m),m+=1}else throw new Error("Unknown charset format "+R);return _}function Ni(n,o){let l,d={},h=new it.Parser(n,o),m=h.parseCard8();if(m===0){let y=h.parseCard8();for(let T=0;T<y;T+=1)l=h.parseCard8(),d[l]=T}else if(m===1){let y=h.parseCard8();l=1;for(let T=0;T<y;T+=1){let _=h.parseCard8(),R=h.parseCard8();for(let E=_;E<=_+R;E+=1)d[E]=l,l+=1}}else throw new Error("Unknown encoding format "+m);return d}function Qn(n){let o=n.pop();for(;n.length>o;)n.pop()}function en(n,o){let l=n.tables.cff&&n.tables.cff.topDict&&n.tables.cff.topDict.paintType||0;return l===2&&(o.fill=null,o.stroke="black",o.strokeWidth=n.tables.cff.topDict.strokeWidth||0),l}function qs(n,o,l,d,h){let m,y,T,_,R=new $e,E=[],H=0,z=!1,se=!1,X=0,ue=0,Ze,er,qt,fr,Er=0,Cn=[],jn,Pn=0,Ds=n.tables.cff2||n.tables.cff;if(qt=Ds.topDict._defaultWidthX,fr=Ds.topDict._nominalWidthX,h=h||n.variation&&n.variation.get(),o.getBlendPath||(o.getBlendPath=function(Ut){return qs(n,o,l,d,Ut)}),n.isCIDFont||d>1){let Ut=Ds.topDict._fdSelect?Ds.topDict._fdSelect[o.index]:0,Wt=Ds.topDict._fdArray[Ut];Ze=Wt._subrs,er=Wt._subrsBias,d>1?(Cn=Ds.topDict._vstore.itemVariationStore,Er=Wt._privateDict.vsindex):(qt=Wt._defaultWidthX,fr=Wt._nominalWidthX)}else Ze=Ds.topDict._subrs,er=Ds.topDict._subrsBias;let Ko=en(n,R),Mr=qt;function fo(Ut,Wt){se&&Ko!==2&&R.closePath(),R.moveTo(Ut,Wt),se=!0}function Pi(){let Ut;Ut=(E.length&1)!==0,Ut&&!z&&(Mr=E.shift()+fr),H+=E.length>>1,E.length=0,z=!0}function tr(Ut){let Wt,ki,fl,Ru,Rl,Xo,Oi,_o,Ii,po,Fi,Ui,Ls=0;for(;Ls<Ut.length;){let ko=Ut[Ls];switch(Ls+=1,ko){case 1:Pi();break;case 3:Pi();break;case 4:E.length>1&&!z&&(Mr=E.shift()+fr,z=!0),ue+=E.pop(),fo(X,ue);break;case 5:for(;E.length>0;)X+=E.shift(),ue+=E.shift(),R.lineTo(X,ue);break;case 6:for(;E.length>0&&(X+=E.shift(),R.lineTo(X,ue),E.length!==0);)ue+=E.shift(),R.lineTo(X,ue);break;case 7:for(;E.length>0&&(ue+=E.shift(),R.lineTo(X,ue),E.length!==0);)X+=E.shift(),R.lineTo(X,ue);break;case 8:for(;E.length>0;)m=X+E.shift(),y=ue+E.shift(),T=m+E.shift(),_=y+E.shift(),X=T+E.shift(),ue=_+E.shift(),R.curveTo(m,y,T,_,X,ue);break;case 10:if(Rl=E.pop()+er,Xo=Ze[Rl],Xo){if(Pn>=O){console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");break}Pn++,tr(Xo),Pn--}break;case 11:if(d>1){console.error("CFF CharString operator return (11) is not supported in CFF2");break}return;case 12:switch(ko=Ut[Ls],Ls+=1,ko){case 35:m=X+E.shift(),y=ue+E.shift(),T=m+E.shift(),_=y+E.shift(),Oi=T+E.shift(),_o=_+E.shift(),Ii=Oi+E.shift(),po=_o+E.shift(),Fi=Ii+E.shift(),Ui=po+E.shift(),X=Fi+E.shift(),ue=Ui+E.shift(),E.shift(),R.curveTo(m,y,T,_,Oi,_o),R.curveTo(Ii,po,Fi,Ui,X,ue);break;case 34:m=X+E.shift(),y=ue,T=m+E.shift(),_=y+E.shift(),Oi=T+E.shift(),_o=_,Ii=Oi+E.shift(),po=_,Fi=Ii+E.shift(),Ui=ue,X=Fi+E.shift(),R.curveTo(m,y,T,_,Oi,_o),R.curveTo(Ii,po,Fi,Ui,X,ue);break;case 36:m=X+E.shift(),y=ue+E.shift(),T=m+E.shift(),_=y+E.shift(),Oi=T+E.shift(),_o=_,Ii=Oi+E.shift(),po=_,Fi=Ii+E.shift(),Ui=po+E.shift(),X=Fi+E.shift(),R.curveTo(m,y,T,_,Oi,_o),R.curveTo(Ii,po,Fi,Ui,X,ue);break;case 37:m=X+E.shift(),y=ue+E.shift(),T=m+E.shift(),_=y+E.shift(),Oi=T+E.shift(),_o=_+E.shift(),Ii=Oi+E.shift(),po=_o+E.shift(),Fi=Ii+E.shift(),Ui=po+E.shift(),Math.abs(Fi-X)>Math.abs(Ui-ue)?X=Fi+E.shift():ue=Ui+E.shift(),R.curveTo(m,y,T,_,Oi,_o),R.curveTo(Ii,po,Fi,Ui,X,ue);break;default:console.log("Glyph "+o.index+": unknown operator 1200"+ko),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 Nl=ur[E.pop()],f0=ur[E.pop()],Nu=E.pop(),Du=E.pop();if(Nl&&f0){o.isComposite=!0,o.components=[];let z1=n.cffEncoding.charset.indexOf(Nl),H1=n.cffEncoding.charset.indexOf(f0);o.components.push({glyphIndex:H1,dx:0,dy:0}),o.components.push({glyphIndex:z1,dx:Du,dy:Nu}),R.extend(n.glyphs.get(H1).path);let Fy=n.glyphs.get(z1),Sh=JSON.parse(JSON.stringify(Fy.path.commands));for(let _h=0;_h<Sh.length;_h+=1){let fa=Sh[_h];fa.type!=="Z"&&(fa.x+=Du,fa.y+=Nu),(fa.type==="Q"||fa.type==="C")&&(fa.x1+=Du,fa.y1+=Nu),fa.type==="C"&&(fa.x2+=Du,fa.y2+=Nu)}R.extend(Sh)}}else E.length>0&&!z&&(Mr=E.shift()+fr,z=!0);se&&Ko!==2&&(R.closePath(),se=!1);break;case 15:if(d<2){console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");break}Er=E.pop();break;case 16:if(d<2){console.error("CFF2 CharString operator blend (16) is not supported in CFF");break}jn||(jn=n.variation&&h&&n.variation.process.getBlendVector(Cn,Er,h));var Fn=E.pop(),eo=jn?jn.length:Cn.itemVariationSubtables[Er].regionIndexes.length,Lo=Fn*eo,Jo=E.length-Lo,Ba=Jo-Fn;if(jn)for(let Nl=0;Nl<Fn;Nl++){var $1=E[Ba+Nl];for(let f0=0;f0<eo;f0++)$1+=jn[f0]*E[Jo++];E[Ba+Nl]=$1}for(;Lo--;)E.pop();break;case 18:Pi();break;case 19:case 20:Pi(),Ls+=H+7>>3;break;case 21:E.length>2&&!z&&(Mr=E.shift()+fr,z=!0),ue+=E.pop(),X+=E.pop(),fo(X,ue);break;case 22:E.length>1&&!z&&(Mr=E.shift()+fr,z=!0),X+=E.pop(),fo(X,ue);break;case 23:Pi();break;case 24:for(;E.length>2;)m=X+E.shift(),y=ue+E.shift(),T=m+E.shift(),_=y+E.shift(),X=T+E.shift(),ue=_+E.shift(),R.curveTo(m,y,T,_,X,ue);X+=E.shift(),ue+=E.shift(),R.lineTo(X,ue);break;case 25:for(;E.length>6;)X+=E.shift(),ue+=E.shift(),R.lineTo(X,ue);m=X+E.shift(),y=ue+E.shift(),T=m+E.shift(),_=y+E.shift(),X=T+E.shift(),ue=_+E.shift(),R.curveTo(m,y,T,_,X,ue);break;case 26:for(E.length&1&&(X+=E.shift());E.length>0;)m=X,y=ue+E.shift(),T=m+E.shift(),_=y+E.shift(),X=T,ue=_+E.shift(),R.curveTo(m,y,T,_,X,ue);break;case 27:for(E.length&1&&(ue+=E.shift());E.length>0;)m=X+E.shift(),y=ue,T=m+E.shift(),_=y+E.shift(),X=T+E.shift(),ue=_,R.curveTo(m,y,T,_,X,ue);break;case 28:Wt=Ut[Ls],ki=Ut[Ls+1],E.push((Wt<<24|ki<<16)>>16),Ls+=2;break;case 29:if(Rl=E.pop()+n.gsubrsBias,Xo=n.gsubrs[Rl],Xo){if(Pn>=O){console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");break}Pn++,tr(Xo),Pn--}break;case 30:for(;E.length>0&&(m=X,y=ue+E.shift(),T=m+E.shift(),_=y+E.shift(),X=T+E.shift(),ue=_+(E.length===1?E.shift():0),R.curveTo(m,y,T,_,X,ue),E.length!==0);)m=X+E.shift(),y=ue,T=m+E.shift(),_=y+E.shift(),ue=_+E.shift(),X=T+(E.length===1?E.shift():0),R.curveTo(m,y,T,_,X,ue);break;case 31:for(;E.length>0&&(m=X+E.shift(),y=ue,T=m+E.shift(),_=y+E.shift(),ue=_+E.shift(),X=T+(E.length===1?E.shift():0),R.curveTo(m,y,T,_,X,ue),E.length!==0);)m=X,y=ue+E.shift(),T=m+E.shift(),_=y+E.shift(),X=T+E.shift(),ue=_+(E.length===1?E.shift():0),R.curveTo(m,y,T,_,X,ue);break;default:ko<32?console.log("Glyph "+o.index+": unknown operator "+ko):ko<247?E.push(ko-139):ko<251?(Wt=Ut[Ls],Ls+=1,E.push((ko-247)*256+Wt+108)):ko<255?(Wt=Ut[Ls],Ls+=1,E.push(-(ko-251)*256-Wt-108)):(Wt=Ut[Ls],ki=Ut[Ls+1],fl=Ut[Ls+2],Ru=Ut[Ls+3],Ls+=4,E.push((Wt<<24|ki<<16|fl<<8|Ru)/65536))}}}return tr(l),n.variation&&h&&(R.commands=R.commands.map(Ut=>{let Wt=Object.keys(Ut);for(let ki=0;ki<Wt.length;ki++){let fl=Wt[ki];fl!=="type"&&(Ut[fl]=Math.round(Ut[fl]))}return Ut})),z&&(o.advanceWidth=Mr),R}function Os(n,o,l,d,h){let m=[],y,T=new it.Parser(n,o),_=T.parseCard8();if(_===0)for(let R=0;R<l;R++){if(y=T.parseCard8(),y>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+y+" (FD count "+d+")");m.push(y)}else if(_===3||h>1&&_===4){let R=_===4?T.parseULong():T.parseCard16(),E=_===4?T.parseULong():T.parseCard16();if(E!==0)throw new Error(`CFF Table CID Font FDSelect format ${_} range has bad initial GID ${E}`);let H;for(let z=0;z<R;z++){if(y=_===4?T.parseUShort():T.parseCard8(),H=_===4?T.parseULong():T.parseCard16(),y>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+y+" (FD count "+d+")");if(H>l)throw new Error(`CFF Table CID Font FDSelect format ${h} range has bad GID ${H}`);for(;E<H;E++)m.push(y);E=H}if(H!==l)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final (Sentinal) GID "+H)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+_);return m}function Mn(n,o,l,d){let h,m=vn(n,o);m.formatMajor===2?h=l.tables.cff2={}:h=l.tables.cff={};let y=m.formatMajor>1?null:le(n,m.endOffset,it.bytesToString),T=m.formatMajor>1?null:le(n,y.endOffset),_=m.formatMajor>1?null:le(n,T.endOffset,it.bytesToString),R=le(n,m.formatMajor>1?o+m.size+m.topDictLength:_.endOffset,void 0,m.formatMajor);l.gsubrs=R.objects,l.gsubrsBias=ne(l.gsubrs);let E;if(m.formatMajor>1){let z=o+m.size,se=it.getBytes(n,z,z+m.topDictLength);E=Hr(n,0,[se],void 0,m.formatMajor)[0]}else{let z=Hr(n,o,T.objects,_.objects,m.formatMajor);if(z.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+z.length);E=z[0]}if(h.topDict=E,E._privateDict&&(l.defaultWidthX=E._privateDict.defaultWidthX,l.nominalWidthX=E._privateDict.nominalWidthX),m.formatMajor<2&&E.ros[0]!==void 0&&E.ros[1]!==void 0&&(l.isCIDFont=!0),m.formatMajor>1){let z=E.fdArray,se=E.fdSelect;if(!z)throw new Error("This is a CFF2 font, but FDArray information is missing");let X=le(n,o+z,null,m.formatMajor),ue=ui(n,o,X.objects);E._fdArray=ue,se&&(E._fdSelect=Os(n,o+se,l.numGlyphs,ue.length,m.formatMajor))}else if(l.isCIDFont){let z=E.fdArray,se=E.fdSelect;if(z===0||se===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");z+=o;let X=le(n,z),ue=Hr(n,o,X.objects,_.objects,m.formatMajor);E._fdArray=ue,se+=o,E._fdSelect=Os(n,se,l.numGlyphs,ue.length,m.formatMajor)}if(m.formatMajor<2){let z=o+E.private[1],se=En(n,z,E.private[0],_.objects,m.formatMajor);if(l.defaultWidthX=se.defaultWidthX,l.nominalWidthX=se.nominalWidthX,se.subrs!==0){let X=z+se.subrs,ue=le(n,X);l.subrs=ue.objects,l.subrsBias=ne(l.subrs)}else l.subrs=[],l.subrsBias=0}let H;if(d.lowMemory?(H=ze(n,o+E.charStrings,m.formatMajor),l.nGlyphs=H.offsets.length-(m.formatMajor>1?1:0)):(H=le(n,o+E.charStrings,null,m.formatMajor),l.nGlyphs=H.objects.length),m.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})`),m.formatMajor<2){let z=[],se=[];E.charset===0?z=Ti:E.charset===1?z=kr:E.charset===2?z=Yn:z=ts(n,o+E.charset,l.nGlyphs,_.objects,l.isCIDFont),E.encoding===0?se=ur:E.encoding===1?se=Kr:se=Ni(n,o+E.encoding),l.cffEncoding=new Or(se,z),l.encoding=l.encoding||l.cffEncoding}if(l.glyphs=new yn.GlyphSet(l),d.lowMemory)l._push=function(z){let se=Lt(z,H.offsets,n,o+E.charStrings,void 0,m.formatMajor);l.glyphs.push(z,yn.cffGlyphLoader(l,z,qs,se,m.formatMajor))};else for(let z=0;z<l.nGlyphs;z+=1){let se=H.objects[z];l.glyphs.push(z,yn.cffGlyphLoader(l,z,qs,se,m.formatMajor))}if(E.vstore){let z=new it.Parser(n,o+E.vstore);E._vstore=z.parseVariationStore()}}function Fs(n,o){let l,d=cs.indexOf(n);return d>=0&&(l=d),d=o.indexOf(n),d>=0?l=d+cs.length:(l=cs.length+o.length,o.push(n)),l}function Ho(){return new ke.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 ka(n){let o=new ke.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);o.names=[];for(let l=0;l<n.length;l+=1)o.names.push({name:"name_"+l,type:"NAME",value:n[l]});return o}function vo(n,o,l){let d={};for(let h=0;h<n.length;h+=1){let m=n[h],y=o[m.name];y!==void 0&&!Fr(y,m.value)&&(m.type==="SID"&&(y=Fs(y,l)),d[m.op]={name:m.name,type:m.type,value:y})}return d}function oa(n,o,l){let d=new ke.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=vo(l>1?In:Hn,n,o),d}function Za(n){let o=new ke.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return o.topDicts=[{name:"topDict_0",type:"TABLE",value:n}],o}function wo(n){let o=new ke.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);o.strings=[];for(let l=0;l<n.length;l+=1)o.strings.push({name:"string_"+l,type:"STRING",value:n[l]});return o}function aa(){return new ke.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function Ao(n,o){let l=new ke.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let d=0;d<n.length;d+=1){let h=n[d],m=Fs(h,o);l.fields.push({name:"glyph_"+d,type:"SID",value:m})}return l}function la(n,o){let l=[],d=n.path;o<2&&l.push({name:"width",type:"NUMBER",value:n.advanceWidth});let h=0,m=0;for(let y=0;y<d.commands.length;y+=1){let T,_,R=d.commands[y];if(R.type==="Q"){let E=.3333333333333333,H=2/3;R={type:"C",x:R.x,y:R.y,x1:Math.round(E*h+H*R.x1),y1:Math.round(E*m+H*R.y1),x2:Math.round(E*R.x+H*R.x1),y2:Math.round(E*R.y+H*R.y1)}}if(R.type==="M")T=Math.round(R.x-h),_=Math.round(R.y-m),l.push({name:"dx",type:"NUMBER",value:T}),l.push({name:"dy",type:"NUMBER",value:_}),l.push({name:"rmoveto",type:"OP",value:21}),h=Math.round(R.x),m=Math.round(R.y);else if(R.type==="L")T=Math.round(R.x-h),_=Math.round(R.y-m),l.push({name:"dx",type:"NUMBER",value:T}),l.push({name:"dy",type:"NUMBER",value:_}),l.push({name:"rlineto",type:"OP",value:5}),h=Math.round(R.x),m=Math.round(R.y);else if(R.type==="C"){let E=Math.round(R.x1-h),H=Math.round(R.y1-m),z=Math.round(R.x2-R.x1),se=Math.round(R.y2-R.y1);T=Math.round(R.x-R.x2),_=Math.round(R.y-R.y2),l.push({name:"dx1",type:"NUMBER",value:E}),l.push({name:"dy1",type:"NUMBER",value:H}),l.push({name:"dx2",type:"NUMBER",value:z}),l.push({name:"dy2",type:"NUMBER",value:se}),l.push({name:"dx",type:"NUMBER",value:T}),l.push({name:"dy",type:"NUMBER",value:_}),l.push({name:"rrcurveto",type:"OP",value:8}),h=Math.round(R.x),m=Math.round(R.y)}}return o<2&&l.push({name:"endchar",type:"OP",value:14}),l}function Zi(n,o){let l=new ke.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let d=0;d<n.length;d+=1){let h=n.get(d),m=la(h,o);l.charStrings.push({name:h.name,type:"CHARSTRING",value:m})}return l}function Yi(n,o,l){let d=new ke.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return d.dict=vo(l>1?es:ci,n,o),d}function di(n,o){let l=new ke.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),d=1/o.unitsPerEm,h={version:o.version,fullName:o.fullName,familyName:o.familyName,weight:o.weightName,fontBBox:o.fontBBox||[0,0,0,0],fontMatrix:[d,0,0,d,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},m=o&&o.topDict||{};m.paintType&&(h.paintType=m.paintType,h.strokeWidth=m.strokeWidth||0);let y={},T=[],_;for(let z=1;z<n.length;z+=1)_=n.get(z),T.push(_.name);let R=[];l.header=Ho(),l.nameIndex=ka([o.postScriptName]);let E=oa(h,R);l.topDictIndex=Za(E),l.globalSubrIndex=aa(),l.charsets=Ao(T,R),l.charStringsIndex=Zi(n,1),l.privateDict=Yi(y,R),l.stringIndex=wo(R);let H=l.header.sizeOf()+l.nameIndex.sizeOf()+l.topDictIndex.sizeOf()+l.stringIndex.sizeOf()+l.globalSubrIndex.sizeOf();return h.charset=H,h.encoding=0,h.charStrings=h.charset+l.charsets.sizeOf(),h.private[1]=h.charStrings+l.charStringsIndex.sizeOf(),E=oa(h,R),l.topDictIndex=Za(E),l}var Zs={parse:Mn,make:di};function us(n,o){let l={},d=new it.Parser(n,o);return l.version=d.parseVersion(),l.fontRevision=Math.round(d.parseFixed()*1e3)/1e3,l.checkSumAdjustment=d.parseULong(),l.magicNumber=d.parseULong(),K.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 Ya(n){let o=Math.round(new Date().getTime()/1e3)+2082844800,l=o,d=n.macStyle||0;return n.createdTimestamp&&(l=n.createdTimestamp+2082844800),new ke.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:l},{name:"modified",type:"LONGDATETIME",value:o},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:d},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],n)}var fs={parse:us,make:Ya};function Ia(n,o){let l={},d=new it.Parser(n,o);return l.version=d.parseVersion(),l.ascender=d.parseShort(),l.descender=d.parseShort(),l.lineGap=d.parseShort(),l.advanceWidthMax=d.parseUShort(),l.minLeftSideBearing=d.parseShort(),l.minRightSideBearing=d.parseShort(),l.xMaxExtent=d.parseShort(),l.caretSlopeRise=d.parseShort(),l.caretSlopeRun=d.parseShort(),l.caretOffset=d.parseShort(),d.relativeOffset+=8,l.metricDataFormat=d.parseShort(),l.numberOfHMetrics=d.parseUShort(),l}function Ki(n){return new ke.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 ca={parse:Ia,make:Ki};function Wo(n,o,l,d,h){let m,y,T=new it.Parser(n,o);for(let _=0;_<d;_+=1){_<l&&(m=T.parseUShort(),y=T.parseShort());let R=h.get(_);R.advanceWidth=m,R.leftSideBearing=y}}function oo(n,o,l,d,h){n._hmtxTableData={};let m,y,T=new it.Parser(o,l);for(let _=0;_<h;_+=1)_<d&&(m=T.parseUShort(),y=T.parseShort()),n._hmtxTableData[_]={advanceWidth:m,leftSideBearing:y}}function Ea(n,o,l,d,h,m,y){y.lowMemory?oo(n,o,l,d,h):Wo(o,l,d,h,m)}function Ma(n){let o=new ke.Table("hmtx",[]);for(let l=0;l<n.length;l+=1){let d=n.get(l),h=d.advanceWidth||0,m=d.leftSideBearing||0;o.fields.push({name:"advanceWidth_"+l,type:"USHORT",value:h}),o.fields.push({name:"leftSideBearing_"+l,type:"SHORT",value:m})}return o}var Ra={parse:Ea,make:Ma};function ua(n){let o=new ke.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 m=l.indexOf(n[h]);m<0&&(m=l.length,l+=n[h]),o.fields.push({name:"offset "+h,type:"USHORT",value:d+m}),o.fields.push({name:"length "+h,type:"USHORT",value:n[h].length})}return o.fields.push({name:"stringPool",type:"CHARARRAY",value:l}),o}function rs(n,o){let l=new it.Parser(n,o),d=l.parseULong();K.argument(d===1,"Unsupported ltag table version."),l.skip("uLong",1);let h=l.parseULong(),m=[];for(let y=0;y<h;y++){let T="",_=o+l.parseUShort(),R=l.parseUShort();for(let E=_;E<_+R;++E)T+=String.fromCharCode(n.getInt8(E));m.push(T)}return m}var Go={make:ua,parse:rs};function Ci(n,o){let l={},d=new it.Parser(n,o);return l.version=d.parseVersion(),l.numGlyphs=d.parseUShort(),l.version===1&&(l.maxPoints=d.parseUShort(),l.maxContours=d.parseUShort(),l.maxCompositePoints=d.parseUShort(),l.maxCompositeContours=d.parseUShort(),l.maxZones=d.parseUShort(),l.maxTwilightPoints=d.parseUShort(),l.maxStorage=d.parseUShort(),l.maxFunctionDefs=d.parseUShort(),l.maxInstructionDefs=d.parseUShort(),l.maxStackElements=d.parseUShort(),l.maxSizeOfInstructions=d.parseUShort(),l.maxComponentElements=d.parseUShort(),l.maxComponentDepth=d.parseUShort()),l}function Ka(n){return new ke.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:n}])}var Vo={parse:Ci,make:Ka},Wn=[{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 hi(n){for(let o=0;o<Wn.length;o+=1){let l=Wn[o];if(n>=l.begin&&n<l.end)return o}return-1}function To(n,o){let l={},d=new it.Parser(n,o);l.version=d.parseUShort(),l.xAvgCharWidth=d.parseShort(),l.usWeightClass=d.parseUShort(),l.usWidthClass=d.parseUShort(),l.fsType=d.parseUShort(),l.ySubscriptXSize=d.parseShort(),l.ySubscriptYSize=d.parseShort(),l.ySubscriptXOffset=d.parseShort(),l.ySubscriptYOffset=d.parseShort(),l.ySuperscriptXSize=d.parseShort(),l.ySuperscriptYSize=d.parseShort(),l.ySuperscriptXOffset=d.parseShort(),l.ySuperscriptYOffset=d.parseShort(),l.yStrikeoutSize=d.parseShort(),l.yStrikeoutPosition=d.parseShort(),l.sFamilyClass=d.parseShort(),l.panose=[];for(let 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 ke.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 ao={parse:To,make:da,unicodeRanges:Wn,getUnicodeRange:hi};function ha(n,o){let l={},d=new it.Parser(n,o);switch(l.version=d.parseVersion(),l.italicAngle=d.parseFixed(),l.underlinePosition=d.parseShort(),l.underlineThickness=d.parseShort(),l.isFixedPitch=d.parseULong(),l.minMemType42=d.parseULong(),l.maxMemType42=d.parseULong(),l.minMemType1=d.parseULong(),l.maxMemType1=d.parseULong(),l.version){case 1:l.names=sn.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]>=sn.length){let m=d.parseChar();l.names.push(d.parseString(m))}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 Ys(n){let{italicAngle:o=Math.round((n.italicAngle||0)*65536),underlinePosition:l=0,underlineThickness:d=0,isFixedPitch:h=0,minMemType42:m=0,maxMemType42:y=0,minMemType1:T=0,maxMemType1:_=0}=n.tables.post||{};return new ke.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:o},{name:"underlinePosition",type:"FWORD",value:l},{name:"underlineThickness",type:"FWORD",value:d},{name:"isFixedPitch",type:"ULONG",value:h},{name:"minMemType42",type:"ULONG",value:m},{name:"maxMemType42",type:"ULONG",value:y},{name:"minMemType1",type:"ULONG",value:T},{name:"maxMemType1",type:"ULONG",value:_}])}var Xa={parse:ha,make:Ys},gn=new Array(9);gn[1]=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(ae.coverage),deltaGlyphId:this.parseShort()};if(o===2)return{substFormat:2,coverage:this.parsePointer(ae.coverage),substitute:this.parseOffset16List()};K.assert(!1,"0x"+n.toString(16)+": lookup type 1 format must be 1 or 2.")},gn[2]=function(){let n=this.parseUShort();return K.argument(n===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(ae.coverage),sequences:this.parseListOfLists()}},gn[3]=function(){let n=this.parseUShort();return K.argument(n===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(ae.coverage),alternateSets:this.parseListOfLists()}},gn[4]=function(){let n=this.parseUShort();return K.argument(n===1,"GSUB ligature table identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(ae.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var ps={sequenceIndex:ae.uShort,lookupListIndex:ae.uShort};gn[5]=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:o,coverage:this.parsePointer(ae.coverage),ruleSets:this.parseListOfLists(function(){let l=this.parseUShort(),d=this.parseUShort();return{input:this.parseUShortList(l-1),lookupRecords:this.parseRecordList(d,ps)}})};if(o===2)return{substFormat:o,coverage:this.parsePointer(ae.coverage),classDef:this.parsePointer(ae.classDef),classSets:this.parseListOfLists(function(){let l=this.parseUShort(),d=this.parseUShort();return{classes:this.parseUShortList(l-1),lookupRecords:this.parseRecordList(d,ps)}})};if(o===3){let l=this.parseUShort(),d=this.parseUShort();return{substFormat:o,coverages:this.parseList(l,ae.pointer(ae.coverage)),lookupRecords:this.parseRecordList(d,ps)}}K.assert(!1,"0x"+n.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},gn[6]=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{substFormat:1,coverage:this.parsePointer(ae.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(ps)}})};if(o===2)return{substFormat:2,coverage:this.parsePointer(ae.coverage),backtrackClassDef:this.parsePointer(ae.classDef),inputClassDef:this.parsePointer(ae.classDef),lookaheadClassDef:this.parsePointer(ae.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(ps)}})};if(o===3)return{substFormat:3,backtrackCoverage:this.parseList(ae.pointer(ae.coverage)),inputCoverage:this.parseList(ae.pointer(ae.coverage)),lookaheadCoverage:this.parseList(ae.pointer(ae.coverage)),lookupRecords:this.parseRecordList(ps)};K.assert(!1,"0x"+n.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},gn[7]=function(){let n=this.parseUShort();K.argument(n===1,"GSUB Extension Substitution subtable identifier-format must be 1");let o=this.parseUShort(),l=new ae(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:o,extension:gn[o].call(l)}},gn[8]=function(){let n=this.parseUShort();return K.argument(n===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:n,coverage:this.parsePointer(ae.coverage),backtrackCoverage:this.parseList(ae.pointer(ae.coverage)),lookaheadCoverage:this.parseList(ae.pointer(ae.coverage)),substitutes:this.parseUShortList()}};function Gn(n,o){o=o||0;let l=new ae(n,o),d=l.parseVersion(1);return K.argument(d===1||d===1.1,"Unsupported GSUB table version."),d===1?{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(gn)}:{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(gn),variations:l.parseFeatureVariationsList()}}var ks=new Array(9);ks[1]=function(n){if(n.substFormat===1)return new ke.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new ke.Coverage(n.coverage)},{name:"deltaGlyphID",type:"SHORT",value:n.deltaGlyphId}]);if(n.substFormat===2)return new ke.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new ke.Coverage(n.coverage)}].concat(ke.ushortList("substitute",n.substitute)));K.fail("Lookup type 1 substFormat must be 1 or 2.")},ks[2]=function(n){return K.assert(n.substFormat===1,"Lookup type 2 substFormat must be 1."),new ke.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new ke.Coverage(n.coverage)}].concat(ke.tableList("seqSet",n.sequences,function(o){return new ke.Table("sequenceSetTable",ke.ushortList("sequence",o))})))},ks[3]=function(n){return K.assert(n.substFormat===1,"Lookup type 3 substFormat must be 1."),new ke.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new ke.Coverage(n.coverage)}].concat(ke.tableList("altSet",n.alternateSets,function(o){return new ke.Table("alternateSetTable",ke.ushortList("alternate",o))})))},ks[4]=function(n){return K.assert(n.substFormat===1,"Lookup type 4 substFormat must be 1."),new ke.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new ke.Coverage(n.coverage)}].concat(ke.tableList("ligSet",n.ligatureSets,function(o){return new ke.Table("ligatureSetTable",ke.tableList("ligature",o,function(l){return new ke.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:l.ligGlyph}].concat(ke.ushortList("component",l.components,l.components.length+1)))}))})))},ks[5]=function(n){if(n.substFormat===1)return new ke.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:n.substFormat},{name:"coverage",type:"TABLE",value:new ke.Coverage(n.coverage)}].concat(ke.tableList("sequenceRuleSet",n.ruleSets,function(o){return o?new ke.Table("sequenceRuleSetTable",ke.tableList("sequenceRule",o,function(l){let d=ke.ushortList("seqLookup",[],l.lookupRecords.length).concat(ke.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 m=l.lookupRecords[h];d=d.concat({name:"sequenceIndex"+h,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+h,type:"USHORT",value:m.lookupListIndex})}return new ke.Table("sequenceRuleTable",d)})):new ke.Table("NULL",null)})));if(n.substFormat===2)return new ke.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:n.substFormat},{name:"coverage",type:"TABLE",value:new ke.Coverage(n.coverage)},{name:"classDef",type:"TABLE",value:new ke.ClassDef(n.classDef)}].concat(ke.tableList("classSeqRuleSet",n.classSets,function(o){return o?new ke.Table("classSeqRuleSetTable",ke.tableList("classSeqRule",o,function(l){let d=ke.ushortList("classes",l.classes,l.classes.length+1).concat(ke.ushortList("seqLookupCount",[],l.lookupRecords.length));for(let h=0;h<l.lookupRecords.length;h++){let m=l.lookupRecords[h];d=d.concat({name:"sequenceIndex"+h,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+h,type:"USHORT",value:m.lookupListIndex})}return new ke.Table("classSeqRuleTable",d)})):new ke.Table("NULL",null)})));if(n.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:n.substFormat}];o.push({name:"inputGlyphCount",type:"USHORT",value:n.coverages.length}),o.push({name:"substitutionCount",type:"USHORT",value:n.lookupRecords.length});for(let l=0;l<n.coverages.length;l++){let d=n.coverages[l];o.push({name:"inputCoverage"+l,type:"TABLE",value:new ke.Coverage(d)})}for(let l=0;l<n.lookupRecords.length;l++){let d=n.lookupRecords[l];o=o.concat({name:"sequenceIndex"+l,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+l,type:"USHORT",value:d.lookupListIndex})}return new ke.Table("contextualSubstitutionTable",o)}K.assert(!1,"lookup type 5 format must be 1, 2 or 3.")},ks[6]=function(n){if(n.substFormat===1)return new ke.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:n.substFormat},{name:"coverage",type:"TABLE",value:new ke.Coverage(n.coverage)}].concat(ke.tableList("chainRuleSet",n.chainRuleSets,function(o){return new ke.Table("chainRuleSetTable",ke.tableList("chainRule",o,function(l){let d=ke.ushortList("backtrackGlyph",l.backtrack,l.backtrack.length).concat(ke.ushortList("inputGlyph",l.input,l.input.length+1)).concat(ke.ushortList("lookaheadGlyph",l.lookahead,l.lookahead.length)).concat(ke.ushortList("substitution",[],l.lookupRecords.length));for(let h=0;h<l.lookupRecords.length;h++){let m=l.lookupRecords[h];d=d.concat({name:"sequenceIndex"+h,type:"USHORT",value:m.sequenceIndex}).concat({name:"lookupListIndex"+h,type:"USHORT",value:m.lookupListIndex})}return new ke.Table("chainRuleTable",d)}))})));if(n.substFormat===2)K.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(n.substFormat===3){let o=[{name:"substFormat",type:"USHORT",value:n.substFormat}];o.push({name:"backtrackGlyphCount",type:"USHORT",value:n.backtrackCoverage.length});for(let l=0;l<n.backtrackCoverage.length;l++){let d=n.backtrackCoverage[l];o.push({name:"backtrackCoverage"+l,type:"TABLE",value:new ke.Coverage(d)})}o.push({name:"inputGlyphCount",type:"USHORT",value:n.inputCoverage.length});for(let l=0;l<n.inputCoverage.length;l++){let d=n.inputCoverage[l];o.push({name:"inputCoverage"+l,type:"TABLE",value:new ke.Coverage(d)})}o.push({name:"lookaheadGlyphCount",type:"USHORT",value:n.lookaheadCoverage.length});for(let l=0;l<n.lookaheadCoverage.length;l++){let d=n.lookaheadCoverage[l];o.push({name:"lookaheadCoverage"+l,type:"TABLE",value:new ke.Coverage(d)})}o.push({name:"substitutionCount",type:"USHORT",value:n.lookupRecords.length});for(let l=0;l<n.lookupRecords.length;l++){let d=n.lookupRecords[l];o=o.concat({name:"sequenceIndex"+l,type:"USHORT",value:d.sequenceIndex}).concat({name:"lookupListIndex"+l,type:"USHORT",value:d.lookupListIndex})}return new ke.Table("chainContextTable",o)}K.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function lo(n){return new ke.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new ke.ScriptList(n.scripts)},{name:"features",type:"TABLE",value:new ke.FeatureList(n.features)},{name:"lookups",type:"TABLE",value:new ke.LookupList(n.lookups,ks)}])}var qo={parse:Gn,make:lo};function co(n,o){let l=new it.Parser(n,o),d=l.parseULong();K.argument(d===1,"Unsupported META table version."),l.parseULong(),l.parseULong();let h=l.parseULong(),m={};for(let y=0;y<h;y++){let T=l.parseTag(),_=l.parseULong(),R=l.parseULong();if(T==="appl"||T==="bild")continue;let E=Tt.UTF8(n,o+_,R);m[T]=E}return m}function Di(n){let o=Object.keys(n).length,l="",d=16+o*12,h=new ke.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:d},{name:"numTags",type:"ULONG",value:o}]);for(let m in n){let y=l.length;l+=n[m],h.fields.push({name:"tag "+m,type:"TAG",value:m}),h.fields.push({name:"offset "+m,type:"ULONG",value:d+y}),h.fields.push({name:"length "+m,type:"ULONG",value:n[m].length})}return h.fields.push({name:"stringPool",type:"CHARARRAY",value:l}),h}var fi={parse:co,make:Di};function wn(n,o){let l=new ae(n,o),d=l.parseUShort();d!==0&&console.warn("Only COLRv0 is currently fully supported. A subset of color glyphs might be available in this font if provided in the v0 format.");let h=l.parseUShort(),m=l.parseOffset32(),y=l.parseOffset32(),T=l.parseUShort();l.relativeOffset=m;let _=l.parseRecordList(h,{glyphID:ae.uShort,firstLayerIndex:ae.uShort,numLayers:ae.uShort});l.relativeOffset=y;let R=l.parseRecordList(T,{glyphID:ae.uShort,paletteIndex:ae.uShort});return{version:d,baseGlyphRecords:_,layerRecords:R}}function re({version:n=0,baseGlyphRecords:o=[],layerRecords:l=[]}){K.argument(n===0,"Only COLRv0 supported.");let d=14,h=d+o.length*6;return new ke.Table("COLR",[{name:"version",type:"USHORT",value:n},{name:"numBaseGlyphRecords",type:"USHORT",value:o.length},{name:"baseGlyphRecordsOffset",type:"ULONG",value:d},{name:"layerRecordsOffset",type:"ULONG",value:h},{name:"numLayerRecords",type:"USHORT",value:l.length},...o.map((m,y)=>[{name:"glyphID_"+y,type:"USHORT",value:m.glyphID},{name:"firstLayerIndex_"+y,type:"USHORT",value:m.firstLayerIndex},{name:"numLayers_"+y,type:"USHORT",value:m.numLayers}]).flat(),...l.map((m,y)=>[{name:"LayerGlyphID_"+y,type:"USHORT",value:m.glyphID},{name:"paletteIndex_"+y,type:"USHORT",value:m.paletteIndex}]).flat()])}var Pe={parse:wn,make:re};function rt(n,o){return[{name:"tag_"+n,type:"TAG",value:o.tag},{name:"minValue_"+n,type:"FIXED",value:o.minValue<<16},{name:"defaultValue_"+n,type:"FIXED",value:o.defaultValue<<16},{name:"maxValue_"+n,type:"FIXED",value:o.maxValue<<16},{name:"flags_"+n,type:"USHORT",value:0},{name:"nameID_"+n,type:"USHORT",value:o.axisNameID}]}function Dt(n,o,l){let d={},h=new it.Parser(n,o);d.tag=h.parseTag(),d.minValue=h.parseFixed(),d.defaultValue=h.parseFixed(),d.maxValue=h.parseFixed(),h.skip("uShort",1);let m=h.parseUShort();return d.axisNameID=m,d.name=vr(l,m),d}function Be(n,o,l,d={}){let h=[{name:"nameID_"+n,type:"USHORT",value:o.subfamilyNameID},{name:"flags_"+n,type:"USHORT",value:0}];for(let m=0;m<l.length;++m){let y=l[m].tag;h.push({name:"axis_"+n+" "+y,type:"FIXED",value:o.coordinates[y]<<16})}return d&&d.postScriptNameID&&h.push({name:"postScriptNameID_",type:"USHORT",value:o.postScriptNameID!==void 0?o.postScriptNameID:65535}),h}function pt(n,o,l,d,h){let m={},y=new it.Parser(n,o),T=y.parseUShort();m.subfamilyNameID=T,m.name=vr(d,T,[2,17]),y.skip("uShort",1),m.coordinates={};for(let R=0;R<l.length;++R)m.coordinates[l[R].tag]=y.parseFixed();if(y.relativeOffset===h)return m.postScriptNameID=void 0,m.postScriptName=void 0,m;let _=y.parseUShort();return m.postScriptNameID=_==65535?void 0:_,m.postScriptName=m.postScriptNameID!==void 0?vr(d,_,[6]):"",m}function yr(n,o){let l=new ke.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(rt(h,n.axes[h],o));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(Be(h,n.instances[h],n.axes,d));return l}function Ar(n,o,l){let d=new it.Parser(n,o),h=d.parseULong();K.argument(h===65536,"Unsupported fvar table version.");let m=d.parseOffset16();d.skip("uShort",1);let y=d.parseUShort(),T=d.parseUShort(),_=d.parseUShort(),R=d.parseUShort(),E=[];for(let se=0;se<y;se++)E.push(Dt(n,o+m+se*T,l));let H=[],z=o+m+y*T;for(let se=0;se<_;se++)H.push(pt(n,z+se*R,E,l,R));return{axes:E,instances:H}}var on={make:yr,parse:Ar},wr={tag:ae.tag,nameID:ae.uShort,ordering:ae.uShort},Bn=new Array(5);Bn[1]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed()}},Bn[2]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),nominalValue:this.parseFixed(),rangeMinValue:this.parseFixed(),rangeMaxValue:this.parseFixed()}},Bn[3]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed(),linkedValue:this.parseFixed()}},Bn[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 Sr(){let n=this.parseUShort(),o=Bn[n],l={format:n};return o===void 0?(console.warn(`Unknown axis value table format ${n}`),l):Object.assign(l,this.parseStruct(o.bind(this)))}function ms(n,o,l){o||(o=0);let d=new it.Parser(n,o),h=d.parseUShort(),m=d.parseUShort();h!==1&&console.warn(`Unsupported STAT table version ${h}.${m}`);let y=[h,m],T=d.parseUShort(),_=d.parseUShort(),R=d.parseOffset32(),E=d.parseUShort(),H=d.parseOffset32(),z=h>1||m>0?d.parseUShort():void 0;l!==void 0&&K.argument(_>=l.axes.length,"STAT axis count must be greater than or equal to fvar axis count"),E>0&&K.argument(_>=0,"STAT axis count must be greater than 0 if STAT axis value count is greater than 0");let se=[];for(let Ze=0;Ze<_;Ze++)d.offset=o+R,d.relativeOffset=Ze*T,se.push(d.parseStruct(wr));d.offset=o,d.relativeOffset=H;let X=d.parseUShortList(E),ue=[];for(let Ze=0;Ze<E;Ze++)d.offset=o+H,d.relativeOffset=X[Ze],ue.push(Sr.apply(d));return{version:y,axes:se,values:ue,elidedFallbackNameID:z}}var Ss=new Array(5);Ss[1]=function(n,o){return[{name:`format${n}`,type:"USHORT",value:1},{name:`axisIndex${n}`,type:"USHORT",value:o.axisIndex},{name:`flags${n}`,type:"USHORT",value:o.flags},{name:`valueNameID${n}`,type:"USHORT",value:o.valueNameID},{name:`value${n}`,type:"FLOAT",value:o.value}]},Ss[2]=function(n,o){return[{name:`format${n}`,type:"USHORT",value:2},{name:`axisIndex${n}`,type:"USHORT",value:o.axisIndex},{name:`flags${n}`,type:"USHORT",value:o.flags},{name:`valueNameID${n}`,type:"USHORT",value:o.valueNameID},{name:`nominalValue${n}`,type:"FLOAT",value:o.nominalValue},{name:`rangeMinValue${n}`,type:"FLOAT",value:o.rangeMinValue},{name:`rangeMaxValue${n}`,type:"FLOAT",value:o.rangeMaxValue}]},Ss[3]=function(n,o){return[{name:`format${n}`,type:"USHORT",value:3},{name:`axisIndex${n}`,type:"USHORT",value:o.axisIndex},{name:`flags${n}`,type:"USHORT",value:o.flags},{name:`valueNameID${n}`,type:"USHORT",value:o.valueNameID},{name:`value${n}`,type:"FLOAT",value:o.value},{name:`linkedValue${n}`,type:"FLOAT",value:o.linkedValue}]},Ss[4]=function(n,o){let l=[{name:`format${n}`,type:"USHORT",value:4},{name:`axisCount${n}`,type:"USHORT",value:o.axisValues.length},{name:`flags${n}`,type:"USHORT",value:o.flags},{name:`valueNameID${n}`,type:"USHORT",value:o.valueNameID}];for(let d=0;d<o.axisValues.length;d++)l=l.concat([{name:`format${n}axisIndex${d}`,type:"USHORT",value:o.axisValues[d].axisIndex},{name:`format${n}value${d}`,type:"FLOAT",value:o.axisValues[d].value}]);return l};function Ks(n,o){return new ke.Record("axisRecord_"+n,[{name:"axisTag_"+n,type:"TAG",value:o.tag},{name:"axisNameID_"+n,type:"USHORT",value:o.nameID},{name:"axisOrdering_"+n,type:"USHORT",value:o.ordering}])}function Us(n,o){let l=o.format,d=Ss[l];K.argument(d!==void 0,`Unknown axis value table format ${l}`);let h=d(n,o);return new ke.Table("axisValueTable_"+n,h)}function Ja(n){let o=new ke.Table("STAT",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:2},{name:"designAxisSize",type:"USHORT",value:8},{name:"designAxisCount",type:"USHORT",value:n.axes.length},{name:"designAxesOffset",type:"ULONG",value:0},{name:"axisValueCount",type:"USHORT",value:n.values.length},{name:"offsetToAxisValueOffsets",type:"ULONG",value:0},{name:"elidedFallbackNameID",type:"USHORT",value:n.elidedFallbackNameID}]);o.designAxesOffset=o.offsetToAxisValueOffsets=o.sizeOf();for(let m=0;m<n.axes.length;m++){let y=Ks(m,n.axes[m]);o.offsetToAxisValueOffsets+=y.sizeOf(),o.fields=o.fields.concat(y.fields)}let l=[],d=[],h=n.values.length*2;for(let m=0;m<n.values.length;m++){let y=Us(m,n.values[m]);l.push({name:"offset_"+m,type:"USHORT",value:h}),h+=y.sizeOf(),d=d.concat(y.fields)}return o.fields=o.fields.concat(l),o.fields=o.fields.concat(d),o}var _l={make:Ja,parse:ms};function Qi(n,o){return new ke.Record("axisValueMap_"+n,[{name:"fromCoordinate_"+n,type:"F2DOT14",value:o.fromCoordinate},{name:"toCoordinate_"+n,type:"F2DOT14",value:o.toCoordinate}])}function Xs(n,o){let l=new ke.Record("segmentMap_"+n,[{name:"positionMapCount_"+n,type:"USHORT",value:o.axisValueMaps.length}]),d=[];for(let h=0;h<o.axisValueMaps.length;h++){let m=Qi(`${n}_${h}`,o.axisValueMaps[h]);d=d.concat(m.fields)}return l.fields=l.fields.concat(d),l}function s0(n,o){K.argument(n.axisSegmentMaps.length===o.axes.length,"avar axis count must correspond to fvar axis count");let l=new ke.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=Xs(d,n.axisSegmentMaps[d]);l.fields=l.fields.concat(h.fields)}return l}function i0(n,o,l){o||(o=0);let d=new ae(n,o),h=d.parseUShort(),m=d.parseUShort();h!==1&&console.warn(`Unsupported avar table version ${h}.${m}`),d.skip("uShort",1);let y=d.parseUShort();K.argument(y===l.axes.length,"avar axis count must correspond to fvar axis count");let T=[];for(let _=0;_<y;_++){let R=[],E=d.parseUShort();for(let H=0;H<E;H++){let z=d.parseF2Dot14(),se=d.parseF2Dot14();R.push({fromCoordinate:z,toCoordinate:se})}T.push({axisValueMaps:R})}return{version:[h,m],axisSegmentMaps:T}}var Na={make:s0,parse:i0};function un(n,o,l,d){let h=new it.Parser(n,o),m=h.parseTupleVariationStore(h.relativeOffset,l.axes.length,"cvar",d),y=h.parseUShort(),T=h.parseUShort();return y!==1&&console.warn(`Unsupported cvar table version ${y}.${T}`),{version:[y,T],...m}}function J0(){console.warn("Writing of cvar tables is not yet supported.")}var Xi={make:J0,parse:un};function Zo(n,o,l,d){let h=new it.Parser(n,o),m=h.parseUShort(),y=h.parseUShort();m!==1&&console.warn(`Unsupported gvar table version ${m}.${y}`);let T=h.parseUShort();T!==l.axes.length&&console.warn(`axisCount ${T} in gvar table does not match the number of axes ${l.axes.length} in the fvar table!`);let _=h.parseUShort(),R=h.parsePointer32(function(){return this.parseTupleRecords(_,T)}),E=h.parseTupleVariationStoreList(T,"gvar",d);return{version:[m,y],sharedTuples:R,glyphVariations:E}}function Da(){console.warn("Writing of gvar tables is not yet supported.")}var L={make:Da,parse:Zo};function B(n,o){let l={},d=new it.Parser(n,o);l.version=d.parseUShort(),K.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 j(n){let o=new ke.Table("gasp",[{name:"version",type:"USHORT",value:1},{name:"numRanges",type:"USHORT",value:n.numRanges}]);for(let l in n.gaspRanges)o.fields.push({name:"rangeMaxPPEM",type:"USHORT",value:n.gaspRanges[l].rangeMaxPPEM}),o.fields.push({name:"rangeGaspBehavior",type:"USHORT",value:n.gaspRanges[l].rangeGaspBehavior});return o}var W={parse:B,make:j};function Oe(n,o){let l=new Map,d=n.buffer,h=new ae(n,o);if(h.parseUShort()!==0)return l;h.relativeOffset=h.parseOffset32();let m=n.byteOffset+o+h.relativeOffset,y=h.parseUShort(),T=new Map;for(let _=0;_<y;_++){let R=h.parseUShort(),E=h.parseUShort(),H=m+h.parseOffset32(),z=h.parseULong(),se=T.get(H);se===void 0&&(se=new Uint8Array(d,H,z),T.set(H,se));for(let X=R;X<=E;X++)l.set(X,se)}return l}function Ie(n){let o=Array.from(n.keys()).sort(),l=[],d=[],h=new Map,m=0,y={endGlyphID:null};for(let z=0,se=o.length;z<se;z++){let X=o[z],ue=n.get(X),Ze=h.get(ue);Ze===void 0&&(Ze=m,d.push(ue),h.set(ue,Ze),m+=ue.byteLength),X-1===y.endGlyphID&&Ze===y.svgDocOffset?y.endGlyphID=X:(y={startGlyphID:X,endGlyphID:X,svgDocOffset:Ze,svgDocLength:ue.byteLength},l.push(y))}let T=l.length,_=d.length,R=2+T*12,E=new Array(4+T*4+_),H=0;E[H++]={name:"version",type:"USHORT",value:0},E[H++]={name:"svgDocumentListOffset",type:"ULONG",value:10},E[H++]={name:"reserved",type:"ULONG",value:0},E[H++]={name:"numEntries",type:"USHORT",value:T};for(let z=0;z<T;z++){let se="documentRecord_"+z,{startGlyphID:X,endGlyphID:ue,svgDocOffset:Ze,svgDocLength:er}=l[z];E[H++]={name:se+"_startGlyphID",type:"USHORT",value:X},E[H++]={name:se+"_endGlyphID",type:"USHORT",value:ue},E[H++]={name:se+"_svgDocOffset",type:"ULONG",value:R+Ze},E[H++]={name:se+"_svgDocLength",type:"ULONG",value:er}}for(let z=0;z<_;z++)E[H++]={name:"svgDoc_"+z,type:"LITERAL",value:d[z]};return new ke.Table("SVG ",E)}var st={make:Ie,parse:Oe};function et(n){return Math.log(n)/Math.log(2)|0}function Et(n){for(;n.length%4!==0;)n.push(0);let o=0;for(let l=0;l<n.length;l+=4)o+=(n[l]<<24)+(n[l+1]<<16)+(n[l+2]<<8)+n[l+3];return o%=Math.pow(2,32),o}function lr(n,o,l,d){return new ke.Record("Table Record",[{name:"tag",type:"TAG",value:n!==void 0?n:""},{name:"checkSum",type:"ULONG",value:o!==void 0?o:0},{name:"offset",type:"ULONG",value:l!==void 0?l:0},{name:"length",type:"ULONG",value:d!==void 0?d:0}])}function an(n){let o=new ke.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);o.tables=n,o.numTables=n.length;let l=Math.pow(2,et(o.numTables));o.searchRange=16*l,o.entrySelector=et(l),o.rangeShift=o.numTables*16-o.searchRange;let d=[],h=[],m=o.sizeOf()+lr().sizeOf()*o.numTables;for(;m%4!==0;)m+=1,h.push({name:"padding",type:"BYTE",value:0});for(let y=0;y<n.length;y+=1){let T=n[y];K.argument(T.tableName.length===4,"Table name"+T.tableName+" is invalid.");let _=T.sizeOf(),R=lr(T.tableName,Et(T.encode()),m,_);for(d.push({name:R.tag+" Table Record",type:"RECORD",value:R}),h.push({name:T.tableName+" table",type:"RECORD",value:T}),m+=_,K.argument(!isNaN(m),"Something went wrong calculating the offset.");m%4!==0;)m+=1,h.push({name:"padding",type:"BYTE",value:0})}return d.sort(function(y,T){return y.value.tag>T.value.tag?1:-1}),o.fields=o.fields.concat(d),o.fields=o.fields.concat(h),o}function Br(n,o,l){for(let d=0;d<o.length;d+=1){let h=n.charToGlyphIndex(o[d]);if(h>0)return n.glyphs.get(h).getMetrics()}return l}function An(n){let o=0;for(let l=0;l<n.length;l+=1)o+=n[l];return o/n.length}function ln(n){let o=[],l=[],d=[],h=[],m=[],y=[],T=[],_,R=0,E=0,H=0,z=0,se=0;for(let Fn=0;Fn<n.glyphs.length;Fn+=1){let eo=n.glyphs.get(Fn),Lo=eo.unicode|0;if(isNaN(eo.advanceWidth))throw new Error("Glyph "+eo.name+" ("+Fn+"): advanceWidth is not a number.");(_>Lo||_===void 0)&&Lo>0&&(_=Lo),R<Lo&&(R=Lo);let Jo=ao.getUnicodeRange(Lo);if(Jo<32)E|=1<<Jo;else if(Jo<64)H|=1<<Jo-32;else if(Jo<96)z|=1<<Jo-64;else if(Jo<123)se|=1<<Jo-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(eo.name===".notdef")continue;let Ba=eo.getMetrics();o.push(Ba.xMin),l.push(Ba.yMin),d.push(Ba.xMax),h.push(Ba.yMax),y.push(Ba.leftSideBearing),T.push(Ba.rightSideBearing),m.push(eo.advanceWidth)}let X={xMin:Math.min.apply(null,o),yMin:Math.min.apply(null,l),xMax:Math.max.apply(null,d),yMax:Math.max.apply(null,h),advanceWidthMax:Math.max.apply(null,m),advanceWidthAvg:An(m),minLeftSideBearing:Math.min.apply(null,y),maxLeftSideBearing:Math.max.apply(null,y),minRightSideBearing:Math.min.apply(null,T)};X.ascender=n.ascender,X.descender=n.descender;let ue=0;n.weightClass>=600&&(ue|=n.macStyleValues.BOLD),n.italicAngle<0&&(ue|=n.macStyleValues.ITALIC);let Ze=fs.make({flags:3,unitsPerEm:n.unitsPerEm,xMin:X.xMin,yMin:X.yMin,xMax:X.xMax,yMax:X.yMax,lowestRecPPEM:3,macStyle:ue,createdTimestamp:n.createdTimestamp}),er=ca.make({ascender:X.ascender,descender:X.descender,advanceWidthMax:X.advanceWidthMax,minLeftSideBearing:X.minLeftSideBearing,minRightSideBearing:X.minRightSideBearing,xMaxExtent:X.maxLeftSideBearing+(X.xMax-X.xMin),numberOfHMetrics:n.glyphs.length}),qt=Vo.make(n.glyphs.length),fr=ao.make(Object.assign({xAvgCharWidth:Math.round(X.advanceWidthAvg),usFirstCharIndex:_,usLastCharIndex:R,ulUnicodeRange1:E,ulUnicodeRange2:H,ulUnicodeRange3:z,ulUnicodeRange4:se,sTypoAscender:X.ascender,sTypoDescender:X.descender,sTypoLineGap:0,usWinAscent:X.yMax,usWinDescent:Math.abs(X.yMin),ulCodePageRange1:1,sxHeight:Br(n,"xyvw",{yMax:Math.round(X.ascender/2)}).yMax,sCapHeight:Br(n,"HIKLEFJMNTZBDPRAGOQSUVWXY",X).yMax,usDefaultChar:n.hasChar(" ")?32:0,usBreakChar:n.hasChar(" ")?32:0},n.tables.os2)),Er=Ra.make(n.glyphs),Cn=Dn.make(n.glyphs),jn=n.getEnglishName("fontFamily"),Pn=n.getEnglishName("fontSubfamily"),Ds=jn+" "+Pn,Ko=n.getEnglishName("postScriptName");Ko||(Ko=jn.replace(/\s/g,"")+"-"+Pn);let Mr={};for(let Fn in n.names)Mr[Fn]=n.names[Fn];Mr.unicode=Mr.unicode||{},Mr.macintosh=Mr.macintosh||{},Mr.windows=Mr.windows||{};let fo=n.names.unicode||{},Pi=n.names.macintosh||{},tr=n.names.windows||{};for(let Fn in Mr){if(Mr[Fn]=Mr[Fn]||{},!Mr[Fn].uniqueID){let eo=n.getEnglishName("manufacturer")||"";Mr[Fn].uniqueID={en:`${eo}: ${Ds}`}}Mr[Fn].postScriptName||(Mr[Fn].postScriptName={en:Ko})}Mr.unicode.preferredFamily||(Mr.unicode.preferredFamily=fo.fontFamily||Pi.fontFamily||tr.fontFamily),Mr.macintosh.preferredFamily||(Mr.macintosh.preferredFamily=Pi.fontFamily||fo.fontFamily||tr.fontFamily),Mr.windows.preferredFamily||(Mr.windows.preferredFamily=tr.fontFamily||fo.fontFamily||Pi.fontFamily),Mr.unicode.preferredSubfamily||(Mr.unicode.preferredSubfamily=fo.fontSubfamily||Pi.fontSubfamily||tr.fontSubfamily),Mr.macintosh.preferredSubfamily||(Mr.macintosh.preferredSubfamily=Pi.fontSubfamily||fo.fontSubfamily||tr.fontSubfamily),Mr.windows.preferredSubfamily||(Mr.windows.preferredSubfamily=tr.fontSubfamily||fo.fontSubfamily||Pi.fontSubfamily);let Ut=[],Wt=At.make(Mr,Ut),ki=Ut.length>0?Go.make(Ut):void 0,fl=Xa.make(n),Ru=Zs.make(n.glyphs,{version:n.getEnglishName("version"),fullName:Ds,familyName:jn,weightName:Pn,postScriptName:Ko,unitsPerEm:n.unitsPerEm,fontBBox:[0,X.yMin,X.ascender,X.advanceWidthMax],topDict:n.tables.cff&&n.tables.cff.topDict||{}}),Rl=n.metas&&Object.keys(n.metas).length>0?fi.make(n.metas):void 0,Xo=[Ze,er,qt,fr,Wt,Cn,fl,Ru,Er];ki&&Xo.push(ki);let Oi={gsub:qo,cpal:Ir,colr:Pe,stat:_l,avar:Na,cvar:Xi,fvar:on,gvar:L,gasp:W,svg:st},_o={avar:[n.tables.fvar],fvar:[n.names]};for(let Fn in Oi){let eo=n.tables[Fn];if(eo){let Lo=Oi[Fn].make.call(n,eo,..._o[Fn]||[]);Lo&&Xo.push(Lo)}}Rl&&Xo.push(Rl);let Ii=an(Xo),po=Ii.encode(),Fi=Et(po),Ui=Ii.fields,Ls=!1;for(let Fn=0;Fn<Ui.length;Fn+=1)if(Ui[Fn].name==="head table"){Ui[Fn].value.checkSumAdjustment=2981146554-Fi,Ls=!0;break}if(!Ls)throw new Error("Could not find head table with checkSum to adjust.");return Ii}var hr={make:an,fontToTable:ln,computeCheckSum:Et};function dn(n,o){let l=0,d=n.length-1;for(;l<=d;){let h=l+d>>>1,m=n[h].tag;if(m===o)return h;m<o?l=h+1:d=h-1}return-l-1}function cn(n,o){let l=0,d=n.length-1;for(;l<=d;){let h=l+d>>>1,m=n[h];if(m===o)return h;m<o?l=h+1:d=h-1}return-l-1}function Si(n,o){let l,d=0,h=n.length-1;for(;d<=h;){let m=d+h>>>1;l=n[m];let y=l.start;if(y===o)return l;y<o?d=m+1:h=m-1}if(d>0)return l=n[d-1],o>l.end?0:l}function el(n,o){this.font=n,this.tableName=o}el.prototype={searchTag:dn,binSearch:cn,getTable:function(n){let o=this.font.tables[this.tableName];return!o&&n&&(o=this.font.tables[this.tableName]=this.createDefaultTable()),o},getScriptNames:function(){let n=this.getTable();return n?n.scripts.map(function(o){return o.tag}):[]},getDefaultScriptName:function(){let n=this.getTable();if(!n)return;let o=!1;for(let l=0;l<n.scripts.length;l++){let d=n.scripts[l].tag;if(d==="DFLT")return d;d==="latn"&&(o=!0)}if(o)return"latn"},getScriptTable:function(n,o){let l=this.getTable(o);if(l){n=n||"DFLT";let d=l.scripts,h=dn(l.scripts,n);if(h>=0)return d[h].script;if(o){let m={tag:n,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return d.splice(-1-h,0,m),m.script}}},getLangSysTable:function(n,o,l){let d=this.getScriptTable(n,l);if(d){if(!o||o==="dflt"||o==="DFLT")return d.defaultLangSys;let h=dn(d.langSysRecords,o);if(h>=0)return d.langSysRecords[h].langSys;if(l){let m={tag:o,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return d.langSysRecords.splice(-1-h,0,m),m.langSys}}},getFeatureTable:function(n,o,l,d){let h=this.getLangSysTable(n,o,d);if(h){let m,y=h.featureIndexes,T=this.font.tables[this.tableName].features;for(let _=0;_<y.length;_++)if(m=T[y[_]],m.tag===l)return m.feature;if(d){let _=T.length;return K.assert(_===0||l>=T[_-1].tag,"Features must be added in alphabetical order."),m={tag:l,feature:{params:0,lookupListIndexes:[]}},T.push(m),y.push(_),m.feature}}},getLookupTables:function(n,o,l,d,h){let m=this.getFeatureTable(n,o,l,h),y=[];if(m){let T,_=m.lookupListIndexes,R=this.font.tables[this.tableName].lookups;for(let E=0;E<_.length;E++)T=R[_[E]],T.lookupType===d&&y.push(T);if(y.length===0&&h){T={lookupType:d,lookupFlag:0,subtables:[],markFilteringSet:void 0};let E=R.length;return R.push(T),_.push(E),[T]}}return y},getGlyphClass:function(n,o){switch(n.format){case 1:return n.startGlyph<=o&&o<n.startGlyph+n.classes.length?n.classes[o-n.startGlyph]:0;case 2:{let l=Si(n.ranges,o);return l?l.classId:0}}},getCoverageIndex:function(n,o){switch(n.format){case 1:{let l=cn(n.glyphs,o);return l>=0?l:-1}case 2:{let l=Si(n.ranges,o);return l?l.index+o-l.start:-1}}},expandCoverage:function(n){if(n.format===1)return n.glyphs;{let o=[],l=n.ranges;for(let d=0;d<l.length;d++){let h=l[d],m=h.start,y=h.end;for(let T=m;T<=y;T++)o.push(T)}return o}}};var gs=el;function Is(n){gs.call(this,n,"gpos")}Is.prototype=gs.prototype,Is.prototype.init=function(){let n=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(n)},Is.prototype.getKerningValue=function(n,o,l){for(let d=0;d<n.length;d++){let h=n[d].subtables;for(let m=0;m<h.length;m++){let y=h[m],T=this.getCoverageIndex(y.coverage,o);if(!(T<0))switch(y.posFormat){case 1:{let _=y.pairSets[T];for(let R=0;R<_.length;R++){let E=_[R];if(E.secondGlyph===l)return E.value1&&E.value1.xAdvance||0}break}case 2:{let _=this.getGlyphClass(y.classDef1,o),R=this.getGlyphClass(y.classDef2,l),E=y.classRecords[_][R];return E.value1&&E.value1.xAdvance||0}}}}return 0},Is.prototype.getKerningTables=function(n,o){if(this.font.tables.gpos)return this.getLookupTables(n,o,"kern",2)};var _s=Is;function Ji(n,o){let l=n.length;if(l!==o.length)return!1;for(let d=0;d<l;d++)if(n[d]!==o[d])return!1;return!0}function tl(n,o,l){let d=0,h=n.length-1,m=null;for(;d<=h;){let y=Math.floor((d+h)/2),T=n[y],_=T[o];if(_<l)d=y+1;else if(_>l)h=y-1;else{m=T;break}}return m}function o0(n,o,l){let d=0,h=n.length-1;for(;d<=h;){let m=Math.floor((d+h)/2),y=n[m];if(y[o]<l)d=m+1;else if(y[o]>l)h=m-1;else return m}return-1}function a0(n,o,l){let d=0,h=n.length,m=(y,T)=>y[o]-T[o];for(;d<h;){let y=d+h>>>1;m(n[y],l)<0?d=y+1:h=y}return n.splice(d,0,l),d}function yu(n){return n[0]===31&&n[1]===139&&n[2]===8}function ph(n){let o=new DataView(n.buffer,n.byteOffset,n.byteLength),l=10,d=n.byteLength-8,h=o.getInt8(3);if(h&4&&(l+=2+o.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 m=o.getUint32(o.byteLength-4,!0);return oe(n.subarray(l,d),new Uint8Array(m))}function Co(n){return{x:n.x,y:n.y,onCurve:n.onCurve,lastPointOfContour:n.lastPointOfContour}}function Qa(n){return{glyphIndex:n.glyphIndex,xScale:n.xScale,scale01:n.scale01,scale10:n.scale10,yScale:n.yScale,dx:n.dx,dy:n.dy}}function Bi(n){gs.call(this,n,"gsub")}function rl(n,o,l){let d=n.subtables;for(let h=0;h<d.length;h++){let m=d[h];if(m.substFormat===o)return m}if(l)return d.push(l),l}Bi.prototype=gs.prototype,Bi.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Bi.prototype.getSingle=function(n,o,l){let d=[],h=this.getLookupTables(o,l,n,1);for(let m=0;m<h.length;m++){let y=h[m].subtables;for(let T=0;T<y.length;T++){let _=y[T],R=this.expandCoverage(_.coverage),E;if(_.substFormat===1){let H=_.deltaGlyphId;for(E=0;E<R.length;E++){let z=R[E];d.push({sub:z,by:z+H})}}else{let H=_.substitute;for(E=0;E<R.length;E++)d.push({sub:R[E],by:H[E]})}}}return d},Bi.prototype.getMultiple=function(n,o,l){let d=[],h=this.getLookupTables(o,l,n,2);for(let m=0;m<h.length;m++){let y=h[m].subtables;for(let T=0;T<y.length;T++){let _=y[T],R=this.expandCoverage(_.coverage),E;for(E=0;E<R.length;E++){let H=R[E],z=_.sequences[E];d.push({sub:H,by:z})}}}return d},Bi.prototype.getAlternates=function(n,o,l){let d=[],h=this.getLookupTables(o,l,n,3);for(let m=0;m<h.length;m++){let y=h[m].subtables;for(let T=0;T<y.length;T++){let _=y[T],R=this.expandCoverage(_.coverage),E=_.alternateSets;for(let H=0;H<R.length;H++)d.push({sub:R[H],by:E[H]})}}return d},Bi.prototype.getLigatures=function(n,o,l){let d=[],h=this.getLookupTables(o,l,n,4);for(let m=0;m<h.length;m++){let y=h[m].subtables;for(let T=0;T<y.length;T++){let _=y[T],R=this.expandCoverage(_.coverage),E=_.ligatureSets;for(let H=0;H<R.length;H++){let z=R[H],se=E[H];for(let X=0;X<se.length;X++){let ue=se[X];d.push({sub:[z].concat(ue.components),by:ue.ligGlyph})}}}}return d},Bi.prototype.addSingle=function(n,o,l,d){let h=this.getLookupTables(l,d,n,1,!0)[0],m=rl(h,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});K.assert(m.coverage.format===1,"Single: unable to modify coverage table format "+m.coverage.format);let y=o.sub,T=this.binSearch(m.coverage.glyphs,y);T<0&&(T=-1-T,m.coverage.glyphs.splice(T,0,y),m.substitute.splice(T,0,0)),m.substitute[T]=o.by},Bi.prototype.addMultiple=function(n,o,l,d){K.assert(o.by instanceof Array&&o.by.length>1,'Multiple: "by" must be an array of two or more ids');let h=this.getLookupTables(l,d,n,2,!0)[0],m=rl(h,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});K.assert(m.coverage.format===1,"Multiple: unable to modify coverage table format "+m.coverage.format);let y=o.sub,T=this.binSearch(m.coverage.glyphs,y);T<0&&(T=-1-T,m.coverage.glyphs.splice(T,0,y),m.sequences.splice(T,0,0)),m.sequences[T]=o.by},Bi.prototype.addAlternate=function(n,o,l,d){let h=this.getLookupTables(l,d,n,3,!0)[0],m=rl(h,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});K.assert(m.coverage.format===1,"Alternate: unable to modify coverage table format "+m.coverage.format);let y=o.sub,T=this.binSearch(m.coverage.glyphs,y);T<0&&(T=-1-T,m.coverage.glyphs.splice(T,0,y),m.alternateSets.splice(T,0,0)),m.alternateSets[T]=o.by},Bi.prototype.addLigature=function(n,o,l,d){let h=this.getLookupTables(l,d,n,4,!0)[0],m=h.subtables[0];m||(m={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},h.subtables[0]=m),K.assert(m.coverage.format===1,"Ligature: unable to modify coverage table format "+m.coverage.format);let y=o.sub[0],T=o.sub.slice(1),_={ligGlyph:o.by,components:T},R=this.binSearch(m.coverage.glyphs,y);if(R>=0){let E=m.ligatureSets[R];for(let H=0;H<E.length;H++)if(Ji(E[H].components,T))return;E.push(_)}else R=-1-R,m.coverage.glyphs.splice(R,0,y),m.ligatureSets.splice(R,0,[_])},Bi.prototype.getFeature=function(n,o,l){if(/ss\d\d/.test(n))return this.getSingle(n,o,l);switch(n){case"aalt":case"salt":return this.getSingle(n,o,l).concat(this.getAlternates(n,o,l));case"dlig":case"liga":case"rlig":return this.getLigatures(n,o,l);case"ccmp":return this.getMultiple(n,o,l).concat(this.getLigatures(n,o,l));case"stch":return this.getMultiple(n,o,l)}},Bi.prototype.add=function(n,o,l,d){if(/ss\d\d/.test(n))return this.addSingle(n,o,l,d);switch(n){case"aalt":case"salt":return typeof o.by=="number"?this.addSingle(n,o,l,d):this.addAlternate(n,o,l,d);case"dlig":case"liga":case"rlig":return this.addLigature(n,o,l,d);case"ccmp":return o.by instanceof Array?this.addMultiple(n,o,l,d):this.addLigature(n,o,l,d)}};var vu=Bi,ec=class{constructor(n){this.defaultValue=255,this.font=n}cpal(){return this.font.tables&&this.font.tables.cpal?this.font.tables.cpal:!1}getAll(n){let o=[],l=this.cpal();if(!l)return o;for(let d=0;d<l.colorRecordIndices.length;d++){let h=l.colorRecordIndices[d],m=[];for(let y=h;y<h+l.numPaletteEntries;y++)m.push(Jt(l.colorRecords[y],n||"hexa"));o.push(m)}return o}toCPALcolor(n){return Array.isArray(n)?n.map(o=>ht(o,"raw")):ht(n,"raw")}fillPalette(n,o=[],l=this.cpal().numPaletteEntries){return n=Number.isInteger(n)?this.get(n,"raw"):n,Object.assign(Array(l).fill(this.defaultValue),this.toCPALcolor(n).concat(this.toCPALcolor(o)))}extend(n){if(this.ensureCPAL(Array(n).fill(this.defaultValue)))return;let o=this.cpal(),l=o.numPaletteEntries+n,d=this.getAll().map(h=>this.fillPalette(h,[],l));o.numPaletteEntries=l,o.colorRecords=this.toCPALcolor(d.flat()),this.updateIndices()}get(n,o="hexa"){return this.getAll(o)[n]||null}getColor(n,o=0,l="hexa"){return Ge(this.font,n,o,l)}setColor(n,o,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 m=this.cpal(),y=m.numPaletteEntries;Array.isArray(o)||(o=[o]),o.length+n>y&&(this.extend(o.length+n-y),d=this.getAll("raw"),h=d[l]);for(let T=0;T<o.length;T++)h[T+n]=this.toCPALcolor(o[T]);m.colorRecords=d.flat(),this.updateIndices()}add(n){if(this.ensureCPAL(n))return;let o=this.cpal(),l=o.numPaletteEntries;n&&n.length?(n=this.toCPALcolor(n),n.length>l?this.extend(n.length-l):n.length<l&&(n=this.fillPalette(n)),o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...n)):(o.colorRecordIndices.push(o.colorRecords.length),o.colorRecords.push(...Array(l).fill(this.defaultValue)))}delete(n){let o=this.getAll("raw");delete o[n];let l=this.cpal();l.colorRecordIndices.pop(),l.colorRecords=o.flat()}deleteColor(n,o){if(n===o)throw Error("replacementIndex cannot be the same as colorIndex");let l=this.cpal(),d=this.getAll("raw"),h=[];if(o>l.numPaletteEntries-1)throw Error(`Replacement index out of range: numPaletteEntries after deletion: ${l.numPaletteEntries-1}, replacementIndex: ${o})`);for(let T=0;T<d.length;T++){let _=d[T].filter((R,E)=>E!==n);h.push(_)}let m=this.font.tables.colr;if(m){let T=m.layerRecords;for(let _=0;_<T.length;_++){let R=T[_].paletteIndex;if(R>n)T[_].paletteIndex-=1;else if(R===n){let E=0;for(let H=0;H<d.length;H++)if(o>n&&o<=n+d[H].length){E++;break}T[_].paletteIndex=o-E}}this.font.tables.colr={...m,layerRecords:T}}let y=h.flat();for(let T=0;T<d.length;T++)l.colorRecordIndices[T]-=T;l.numPaletteEntries=Math.max(0,l.numPaletteEntries-1),l.colorRecords=this.toCPALcolor(y)}ensureCPAL(n){return this.cpal()?!1:(!n||!n.length?n=[this.defaultValue]:n=this.toCPALcolor(n),this.font.tables.cpal={version:0,numPaletteEntries:n.length,colorRecords:n,colorRecordIndices:[0]},!0)}updateIndices(){let n=this.cpal(),o=Math.ceil(n.colorRecords.length/n.numPaletteEntries);n.colorRecordIndices=[];for(let l=0;l<o;l++)n.colorRecordIndices.push(l*n.numPaletteEntries)}},wu=class{constructor(n){this.font=n}ensureCOLR(){return this.font.tables.colr||(this.font.tables.colr={version:0,baseGlyphRecords:[],layerRecords:[]}),this.font}get(n){let o=this.font,l=[],d=o.tables.colr,h=o.tables.cpal;if(!d||!h)return l;let m=tl(d.baseGlyphRecords,"glyphID",n);if(!m)return l;let y=m.firstLayerIndex,T=m.numLayers;for(let _=0;_<T;_++){let R=d.layerRecords[y+_];l.push({glyph:o.glyphs.get(R.glyphID),paletteIndex:R.paletteIndex})}return l}add(n,o,l){let d=this.get(n);o=Array.isArray(o)?o:[o],l===void 0||l===1/0||l>d.length?l=d.length:l<0&&(l=d.length+1+l%(d.length+1),l>=d.length+1&&(l-=d.length+1));let h=[];for(let m=0;m<l;m++){let y=Number.isInteger(d[m].glyph)?d[m].glyph:d[m].glyph.index;h.push({glyphID:y,paletteIndex:d[m].paletteIndex})}for(let m of o){let y=Number.isInteger(m.glyph)?m.glyph:m.glyph.index;h.push({glyphID:y,paletteIndex:m.paletteIndex})}for(let m=l;m<d.length;m++){let y=Number.isInteger(d[m].glyph)?d[m].glyph:d[m].glyph.index;h.push({glyphID:y,paletteIndex:d[m].paletteIndex})}this.updateColrTable(n,h)}setPaletteIndex(n,o,l){let d=this.get(n);d[o]?(d=d.map((h,m)=>({glyphID:h.glyph.index,paletteIndex:m===o?l:h.paletteIndex})),this.updateColrTable(n,d)):console.error("Invalid layer index")}remove(n,o,l=o){let d=this.get(n);d=d.map(h=>({glyphID:h.glyph.index,paletteIndex:h.paletteIndex})),d.splice(o,l-o+1),this.updateColrTable(n,d)}updateColrTable(n,o){this.ensureCOLR();let l=this.font.tables.colr,d=o0(l.baseGlyphRecords,"glyphID",n);if(d===-1){let _={glyphID:n,firstLayerIndex:l.layerRecords.length,numLayers:0};d=a0(l.baseGlyphRecords,"glyphID",_)}let h=l.baseGlyphRecords[d],m=h.numLayers,y=o.length,T=y-m;if(T>0){let _=o.slice(m).map(R=>({glyphID:R.glyphID,paletteIndex:R.paletteIndex}));l.layerRecords.splice(h.firstLayerIndex+m,0,..._)}else T<0&&l.layerRecords.splice(h.firstLayerIndex+y,-T);for(let _=0;_<Math.min(m,y);_++)l.layerRecords[h.firstLayerIndex+_]={glyphID:o[_].glyphID,paletteIndex:o[_].paletteIndex};if(h.numLayers=y,T!==0)for(let _=0;_<l.baseGlyphRecords.length;_++){let R=l.baseGlyphRecords[_];_===d||R.firstLayerIndex<h.firstLayerIndex||(l.baseGlyphRecords[_].firstLayerIndex+=T)}}},Au=class{constructor(n){this.font=n,this.cache=new WeakMap}get(n){let o=this.getOrCreateSvgImageCacheEntry(n);return o&&o.image}getAsync(n){let o=this.getOrCreateSvgImageCacheEntry(n);return o&&o.promise}getOrCreateSvgImageCacheEntry(n){let o=this.font.tables.svg;if(o===void 0)return;let l=o.get(n);if(l===void 0)return;let d=this.cache.get(l);d===void 0&&(d=Tu(l),this.cache.set(l,d));let h=d.images.get(n);return h===void 0&&(h=Ll(this.font,d.template,n),h.promise.then(m=>{if(h.image=m,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 Tu(n){return{template:nl(n).then(tc),images:new Map}}function Ll(n,o,l){return{promise:o.then(d=>{let h;typeof d=="string"?h=d:(d[4]=l,h=d.join(""));let m=rc(h,n.unitsPerEm);return m.image.decode().then(()=>m)}),image:void 0}}var nl=typeof DecompressionStream=="function"?Cu:mh;function mh(n){try{return Promise.resolve(new TextDecoder().decode(yu(n)?ph(n):n))}catch(o){return Promise.reject(o)}}function Cu(n){if(yu(n))return new Response(new Response(n).body.pipeThrough(new DecompressionStream("gzip"))).text();try{return Promise.resolve(new TextDecoder().decode(n))}catch(o){return Promise.reject(o)}}function tc(n){let o=n.indexOf("<svg"),l=n.indexOf(">",o+4)+1;if(/ id=['"]glyph\d+['"]/.test(n.substring(o,l)))return n;let d=n.lastIndexOf("</svg>");return[n.substring(0,l),"<defs>",n.substring(l,d),'</defs><use href="#glyph',"",'"/>',n.substring(d)]}function rc(n,o){let l=new DOMParser().parseFromString(n,"image/svg+xml").documentElement,d=l.viewBox.baseVal,h=l.width.baseVal,m=l.height.baseVal,y=1,T=1;d.width>0&&d.height>0&&(h.unitType===1?(y=h.valueInSpecifiedUnits/d.width,T=m.unitType===1?m.valueInSpecifiedUnits/d.height:y):m.unitType===1?(T=m.valueInSpecifiedUnits/d.height,y=T):o&&(y=o/d.width,T=o/d.height));let _=document.createElement("div");_.style.position="fixed",_.style.visibility="hidden",_.appendChild(l),document.body.appendChild(_);let R=l.getBBox();document.body.removeChild(_);let E=(R.x-d.x)*y,H=(d.y-R.y)*T,z=R.width*y,se=R.height*T;l.setAttribute("viewBox",[R.x,R.y,R.width,R.height].join(" ")),y!==1&&l.setAttribute("width",z),T!==1&&l.setAttribute("height",se);let X=new Image(z,se);return X.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(l.outerHTML),{leftSideBearing:E,baseline:H,image:X}}var nc=new WeakMap;function sc(n,o,l,d,h){let m;return(o&d)>0?(m=n.parseByte(),(o&h)===0&&(m=-m),m=l+m):(o&h)>0?m=l:m=l+n.parseShort(),m}function l0(n,o,l){let d=new it.Parser(o,l);n._numberOfContours=d.parseShort(),n._xMin=d.parseShort(),n._yMin=d.parseShort(),n._xMax=d.parseShort(),n._yMax=d.parseShort();let h,m;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 T=y[y.length-1]+1;h=[];for(let _=0;_<T;_+=1)if(m=d.parseByte(),h.push(m),(m&8)>0){let R=d.parseByte();for(let E=0;E<R;E+=1)h.push(m),_+=1}if(K.argument(h.length===T,"Bad flags."),y.length>0){let _=[],R;if(T>0){for(let z=0;z<T;z+=1)m=h[z],R={},R.onCurve=!!(m&1),R.lastPointOfContour=y.indexOf(z)>=0,_.push(R);let E=0;for(let z=0;z<T;z+=1)m=h[z],R=_[z],R.x=sc(d,m,E,2,16),E=R.x;let H=0;for(let z=0;z<T;z+=1)m=h[z],R=_[z],R.y=sc(d,m,H,4,32),H=R.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 T={glyphIndex:d.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(h&1)>0?(h&2)>0?(T.dx=d.parseShort(),T.dy=d.parseShort()):T.matchedPoints=[d.parseUShort(),d.parseUShort()]:(h&2)>0?(T.dx=d.parseChar(),T.dy=d.parseChar()):T.matchedPoints=[d.parseByte(),d.parseByte()],(h&8)>0?T.xScale=T.yScale=d.parseF2Dot14():(h&64)>0?(T.xScale=d.parseF2Dot14(),T.yScale=d.parseF2Dot14()):(h&128)>0&&(T.xScale=d.parseF2Dot14(),T.scale01=d.parseF2Dot14(),T.scale10=d.parseF2Dot14(),T.yScale=d.parseF2Dot14()),n.components.push(T),y=!!(h&32)}if(h&256){n.instructionLength=d.parseUShort(),n.instructions=[];for(let T=0;T<n.instructionLength;T+=1)n.instructions.push(d.parseByte())}}}function kl(n,o){let l=[];for(let d=0;d<n.length;d+=1){let h=n[d],m={x:o.xScale*h.x+o.scale10*h.y+o.dx,y:o.scale01*h.x+o.yScale*h.y+o.dy,onCurve:h.onCurve,lastPointOfContour:h.lastPointOfContour};l.push(m)}return l}function uo(n){let o=[],l=[];for(let d=0;d<n.length;d+=1){let h=n[d];l.push(h),h.lastPointOfContour&&(o.push(l),l=[])}return K.argument(l.length===0,"There are still points left in the current contour."),o}function sl(n){let o=new $e;if(!n)return o;let l=uo(n);for(let d=0;d<l.length;++d){let h=l[d],m=h[h.length-1],y=h[0];if(m.onCurve)o.moveTo(m.x,m.y);else if(y.onCurve)o.moveTo(y.x,y.y);else{let T={x:(m.x+y.x)*.5,y:(m.y+y.y)*.5};o.moveTo(T.x,T.y)}for(let T=0;T<h.length;++T)if(m=y,y=h[(T+1)%h.length],m.onCurve)o.lineTo(m.x,m.y);else{let _=y;y.onCurve||(_={x:(m.x+y.x)*.5,y:(m.y+y.y)*.5}),o.quadraticCurveTo(m.x,m.y,_.x,_.y)}o.closePath()}return o}function c0(n,o){if(o.isComposite){nc.has(n)||nc.set(n,new Set);let l=nc.get(n);l.add(o.index);try{for(let d=0;d<o.components.length;d+=1){let h=o.components[d];if(l.has(h.glyphIndex))continue;let m=n.get(h.glyphIndex);if(m.getPath(),m.points){let y;if(h.matchedPoints===void 0)y=kl(m.points,h);else{if(h.matchedPoints[0]>o.points.length-1||h.matchedPoints[1]>m.points.length-1)throw Error("Matched points out of range in "+o.name);let T=o.points[h.matchedPoints[0]],_=m.points[h.matchedPoints[1]],R={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};_=kl([_],R)[0],R.dx=T.x-_.x,R.dy=T.y-_.y,y=kl(m.points,R)}o.points=o.points.concat(y)}}}finally{l.delete(o.index)}}return sl(o.points)}function u0(n,o,l,d){let h=new yn.GlyphSet(d);for(let m=0;m<l.length-1;m+=1){let y=l[m],T=l[m+1];y!==T?h.push(m,yn.ttfGlyphLoader(d,m,l0,n,o+y,c0)):h.push(m,yn.glyphLoader(d,m))}return h}function il(n,o,l,d){let h=new yn.GlyphSet(d);return d._push=function(m){let y=l[m],T=l[m+1];y!==T?h.push(m,yn.ttfGlyphLoader(d,m,l0,n,o+y,c0)):h.push(m,yn.glyphLoader(d,m))},h}function Es(n,o,l,d,h){return h.lowMemory?il(n,o,l,d):u0(n,o,l,d)}var Su={getPath:sl,parse:Es},_u=class{constructor(n){this.font=n}normalizeCoordTags(n){for(let o in n)if(o.length<4){let l=o.padEnd(4," ");n[l]===void 0&&(n[l]=n[o]),delete n[o]}}getNormalizedCoords(n){n||(n=this.font.variation.get());let o=[];this.normalizeCoordTags(n);for(let l=0;l<this.fvar().axes.length;l++){let d=this.fvar().axes[l],h=n[d.tag];h===void 0&&(h=d.defaultValue),h<d.defaultValue?o.push((h-d.defaultValue+Number.EPSILON)/(d.defaultValue-d.minValue+Number.EPSILON)):o.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 m=d.axisValueMaps[h];if(h>=1&&o[l]<m.fromCoordinate){let y=d.axisValueMaps[h-1];o[l]=((o[l]-y.fromCoordinate)*(m.toCoordinate-y.toCoordinate)+Number.EPSILON)/(m.fromCoordinate-y.fromCoordinate+Number.EPSILON)+y.toCoordinate;break}}}return o}interpolatePoints(n,o,l){if(n.length===0)return;let d=0;for(;d<n.length;){let h=d,m=d,y=n[m];for(;!y.lastPointOfContour;)y=n[++m];for(;d<=m&&!l[d];)d++;if(d>m)continue;let T=d,_=d;for(d++;d<=m;)l[d]&&(this.deltaInterpolate(_+1,d-1,_,d,o,n),_=d),d++;_===T?this.deltaShift(h,m,_,o,n):(this.deltaInterpolate(_+1,m,_,T,o,n),T>0&&this.deltaInterpolate(h,T-1,_,T,o,n)),d=m+1}}deltaInterpolate(n,o,l,d,h,m){if(n>o)return;let y=["x","y"];for(let _=0;_<y.length;_++){let R=y[_];if(h[l][R]>h[d][R]){var T=l;l=d,d=T}let E=h[l][R],H=h[d][R],z=m[l][R],se=m[d][R];if(E!==H||z===se){let X=E===H?0:(se-z)/(H-E);for(let ue=n;ue<=o;ue++){let Ze=h[ue][R];Ze<=E?Ze+=z-E:Ze>=H?Ze+=se-H:Ze=z+(Ze-E)*X,m[ue][R]=Ze}}}}deltaShift(n,o,l,d,h){let m=h[l].x-d[l].x,y=h[l].y-d[l].y;if(!(m===0&&y===0))for(let T=n;T<=o;T++)T!==l&&(h[T].x+=m,h[T].y+=y)}transformComponents(n,o,l,d,h,m){let y=0;for(let T=0;T<n.components.length;T++){let _=n.components[T],R=this.font.glyphs.get(_.glyphIndex),E=Qa(_),H=d.indexOf(T);H>-1&&(E.dx+=Math.round(h.deltas[H]*m),E.dy+=Math.round(h.deltasY[H]*m));let z=kl(this.getTransform(R,l).points,E);o.splice(y,z.length,...z),y+=R.points.length}}applyTupleVariationStore(n,o,l,d="gvar",h={}){l||(l=this.font.variation.get());let m=this.getNormalizedCoords(l),{headers:y,sharedPoints:T}=n,_=this.fvar().axes.length,R;d==="gvar"?R=o.map(Co):d==="cvar"&&(R=[...o]);for(let E=0;E<y.length;E++){let H=y[E],z=1;for(let X=0;X<_;X++){let ue=[0];switch(d){case"gvar":ue=H.peakTuple?H.peakTuple:this.gvar().sharedTuples[H.sharedTupleRecordsIndex];break;case"cvar":ue=H.peakTuple;break}if(ue[X]!==0){if(m[X]===0){z=0;break}if(H.intermediateStartTuple)if(m[X]<H.intermediateStartTuple[X]||m[X]>H.intermediateEndTuple[X]){z=0;break}else m[X]<ue[X]?z=z*(m[X]-H.intermediateStartTuple[X]+Number.EPSILON)/(ue[X]-H.intermediateStartTuple[X]+Number.EPSILON):z=z*(H.intermediateEndTuple[X]-m[X]+Number.EPSILON)/(H.intermediateEndTuple[X]-ue[X]+Number.EPSILON);else{if(m[X]<Math.min(0,ue[X])||m[X]>Math.max(0,ue[X])){z=0;break}z=(z*m[X]+Number.EPSILON)/(ue[X]+Number.EPSILON)}}}if(z===0)continue;let se=H.privatePoints.length?H.privatePoints:T;if(d==="gvar"&&h.glyph&&h.glyph.isComposite)this.transformComponents(h.glyph,R,l,se,H,z);else if(se.length===0)for(let X=0;X<R.length;X++){let ue=R[X];d==="gvar"?R[X]={x:Math.round(ue.x+H.deltas[X]*z),y:Math.round(ue.y+H.deltasY[X]*z),onCurve:ue.onCurve,lastPointOfContour:ue.lastPointOfContour}:d==="cvar"&&(R[X]=Math.round(ue+H.deltas[X]*z))}else{let X;d==="gvar"?X=R.map(Co):d==="cvar"&&(X=R);let ue=Array(o.length).fill(!1);for(let Ze=0;Ze<se.length;Ze++){let er=se[Ze];if(er<o.length){let qt=X[er];d==="gvar"?(ue[er]=!0,qt.x+=H.deltas[Ze]*z,qt.y+=H.deltasY[Ze]*z):d==="cvar"&&(R[er]=Math.round(qt+H.deltas[Ze]*z))}}if(d==="gvar"){this.interpolatePoints(X,R,ue);for(let Ze=0;Ze<o.length;Ze++){let er=X[Ze].x-R[Ze].x,qt=X[Ze].y-R[Ze].y;R[Ze].x=Math.round(R[Ze].x+er),R[Ze].y=Math.round(R[Ze].y+qt)}}}}return R}getTransform(n,o){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(o||(o=this.font.variation.get()),d){let m=this.gvar()&&this.gvar().glyphVariations[n.index];if(m){let y=n.points,T=this.applyTupleVariationStore(m,y,o,"gvar",{glyph:n});h=new br(Object.assign({},n,{points:T,path:sl(T)}))}}else if(l){let m=n.getBlendPath(o);h=new br(Object.assign({},n,{path:m}))}}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",o)),n._leftSideBearing=typeof n._leftSideBearing<"u"?n._leftSideBearing:n.leftSideBearing,n.leftSideBearing=h.leftSideBearing=Math.round(n._leftSideBearing+this.getVariableAdjustment(h.index,"hvar","lsb",o))),h}getCvarTransform(n){let o=this.font.tables.cvt,l=this.cvar();return!o||!o.length||!l||!l.headers.length?o:this.applyTupleVariationStore(l,o,n,"cvar")}getVariableAdjustment(n,o,l,d){d=d||this.font.variation.get();let h,m,y=this.font.tables[o];if(!y)throw Error(`trying to get variation adjustment from non-existent table "${y}"`);if(!y.itemVariationStore)throw Error(`trying to get variation adjustment from table "${y}" which does not have an itemVariationStore`);let T=y[l]&&y[l].map.length;if(T){let _=n;_>=T&&(_=T-1),{outerIndex:h,innerIndex:m}=y[l].map[_]}else h=0,m=n;return this.getDelta(y.itemVariationStore,h,m,d)}getDelta(n,o,l,d){if(o>=n.itemVariationSubtables.length)return 0;let h=n.itemVariationSubtables[o];if(l>=h.deltaSets.length)return 0;let m=h.deltaSets[l],y=this.getBlendVector(n,o,d),T=0;for(let _=0;_<h.regionIndexes.length;_++)T+=m[_]*y[_];return T}getBlendVector(n,o,l){l||(l=this.font.variation.get());let d=n.itemVariationSubtables[o],h=this.getNormalizedCoords(l),m=[];for(let y=0;y<d.regionIndexes.length;y++){let T=1,_=d.regionIndexes[y],R=n.variationRegions[_].regionAxes;for(let E=0;E<R.length;E++){let H=R[E],z;H.startCoord>H.peakCoord||H.peakCoord>H.endCoord||H.startCoord<0&&H.endCoord>0&&H.peakCoord!==0||H.peakCoord===0?z=1:h[E]<H.startCoord||h[E]>H.endCoord?z=0:h[E]===H.peakCoord?z=1:h[E]<H.peakCoord?z=(h[E]-H.startCoord+Number.EPSILON)/(H.peakCoord-H.startCoord+Number.EPSILON):z=(H.endCoord-h[E]+Number.EPSILON)/(H.endCoord-H.peakCoord+Number.EPSILON),T*=z}m[y]=T}return m}avar(){return this.font.tables.avar}cvar(){return this.font.tables.cvar}fvar(){return this.font.tables.fvar}gvar(){return this.font.tables.gvar}hvar(){return this.font.tables.hvar}},gh=class{constructor(n){this.font=n,this.process=new _u(this.font),this.activateDefaultVariation(),this.getTransform=this.process.getTransform.bind(this.process)}activateDefaultVariation(){let n=this.getDefaultInstanceIndex();n>-1?this.set(n):this.set(this.getDefaultCoordinates())}getDefaultCoordinates(){return this.fvar().axes.reduce((n,o)=>(n[o.tag]=o.defaultValue,n),{})}getDefaultInstanceIndex(){let n=this.getDefaultCoordinates(),o=this.getInstanceIndex(n);return o<0&&(o=this.fvar().instances.findIndex(l=>l.name&&l.name.en==="Regular")),o}getInstanceIndex(n){return this.fvar().instances.findIndex(o=>Object.keys(n).every(l=>o.coordinates[l]===n[l]))}getInstance(n){return this.fvar().instances&&this.fvar().instances[n]}set(n){let o;if(Number.isInteger(n)){let l=this.getInstance(n);if(!l)throw Error(`Invalid instance index ${n}`);o={...l.coordinates}}else o=n,this.process.normalizeCoordTags(o);o=Object.assign({},this.font.defaultRenderOptions.variation,o),this.font.defaultRenderOptions=Object.assign({},this.font.defaultRenderOptions,{variation:o})}get(){return Object.assign({},this.font.defaultRenderOptions.variation)}avar(){return this.font.tables.avar}cvar(){return this.font.tables.cvar}fvar(){return this.font.tables.fvar}gvar(){return this.font.tables.gvar}hvar(){return this.font.tables.hvar}},ic=1e6,Il=64,C=1e4,Q,J,He,mt;function jt(n){this.font=n,this.getCommands=function(o){return Su.getPath(o).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function mr(n){return n}function tn(n){return Math.sign(n)*Math.round(Math.abs(n))}function Tn(n){return Math.sign(n)*Math.round(Math.abs(n*2))/2}function xn(n){return Math.sign(n)*(Math.round(Math.abs(n)+.5)-.5)}function _i(n){return Math.sign(n)*Math.ceil(Math.abs(n))}function rn(n){return Math.sign(n)*Math.floor(Math.abs(n))}var Li=function(n){let o=this.srPeriod,l=this.srPhase,d=this.srThreshold,h=1;return n<0&&(n=-n,h=-1),n+=d-l,n=Math.trunc(n/o)*o,n+=l,n<0?l*h:n*h},Ms={x:1,y:0,axis:"x",distance:function(n,o,l,d){return(l?n.xo:n.x)-(d?o.xo:o.x)},interpolate:function(n,o,l,d){let h,m,y,T,_,R,E;if(!d||d===this){if(h=n.xo-o.xo,m=n.xo-l.xo,_=o.x-o.xo,R=l.x-l.xo,y=Math.abs(h),T=Math.abs(m),E=y+T,E===0){n.x=n.xo+(_+R)/2;return}n.x=n.xo+(_*T+R*y)/E;return}if(h=d.distance(n,o,!0,!0),m=d.distance(n,l,!0,!0),_=d.distance(o,o,!1,!0),R=d.distance(l,l,!1,!0),y=Math.abs(h),T=Math.abs(m),E=y+T,E===0){Ms.setRelative(n,n,(_+R)/2,d,!0);return}Ms.setRelative(n,n,(_*T+R*y)/E,d,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(n,o,l,d,h){if(!d||d===this){n.x=(h?o.xo:o.x)+l;return}let m=h?o.xo:o.x,y=h?o.yo:o.y,T=m+l*d.x,_=y+l*d.y;n.x=T+(n.y-_)/d.normalSlope},slope:0,touch:function(n){n.xTouched=!0},touched:function(n){return n.xTouched},untouch:function(n){n.xTouched=!1}},$s={x:0,y:1,axis:"y",distance:function(n,o,l,d){return(l?n.yo:n.y)-(d?o.yo:o.y)},interpolate:function(n,o,l,d){let h,m,y,T,_,R,E;if(!d||d===this){if(h=n.yo-o.yo,m=n.yo-l.yo,_=o.y-o.yo,R=l.y-l.yo,y=Math.abs(h),T=Math.abs(m),E=y+T,E===0){n.y=n.yo+(_+R)/2;return}n.y=n.yo+(_*T+R*y)/E;return}if(h=d.distance(n,o,!0,!0),m=d.distance(n,l,!0,!0),_=d.distance(o,o,!1,!0),R=d.distance(l,l,!1,!0),y=Math.abs(h),T=Math.abs(m),E=y+T,E===0){$s.setRelative(n,n,(_+R)/2,d,!0);return}$s.setRelative(n,n,(_*T+R*y)/E,d,!0)},normalSlope:0,setRelative:function(n,o,l,d,h){if(!d||d===this){n.y=(h?o.yo:o.y)+l;return}let m=h?o.xo:o.x,y=h?o.yo:o.y,T=m+l*d.x,_=y+l*d.y;n.y=_+d.normalSlope*(n.x-T)},slope:Number.POSITIVE_INFINITY,touch:function(n){n.yTouched=!0},touched:function(n){return n.yTouched},untouch:function(n){n.yTouched=!1}};Object.freeze(Ms),Object.freeze($s);function pi(n,o){this.x=n,this.y=o,this.axis=void 0,this.slope=o/n,this.normalSlope=-n/o,Object.freeze(this)}pi.prototype.distance=function(n,o,l,d){return this.x*Ms.distance(n,o,l,d)+this.y*$s.distance(n,o,l,d)},pi.prototype.interpolate=function(n,o,l,d){let h,m,y,T,_,R,E;if(y=d.distance(n,o,!0,!0),T=d.distance(n,l,!0,!0),h=d.distance(o,o,!1,!0),m=d.distance(l,l,!1,!0),_=Math.abs(y),R=Math.abs(T),E=_+R,E===0){this.setRelative(n,n,(h+m)/2,d,!0);return}this.setRelative(n,n,(h*R+m*_)/E,d,!0)},pi.prototype.setRelative=function(n,o,l,d,h){d=d||this;let m=h?o.xo:o.x,y=h?o.yo:o.y,T=m+l*d.x,_=y+l*d.y,R=d.normalSlope,E=this.slope,H=n.x,z=n.y;n.x=(E*H-R*T+_-z)/(E-R),n.y=E*(n.x-H)+z},pi.prototype.touch=function(n){n.xTouched=!0,n.yTouched=!0};function Rs(n,o){let l=Math.sqrt(n*n+o*o);return n/=l,o/=l,n===1&&o===0?Ms:n===0&&o===1?$s:new pi(n,o)}function Ns(n,o,l,d){this.x=this.xo=Math.round(n*64)/64,this.y=this.yo=Math.round(o*64)/64,this.lastPointOfContour=l,this.onCurve=d,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}Ns.prototype.nextTouched=function(n){let o=this.nextPointOnContour;for(;!n.touched(o)&&o!==this;)o=o.nextPointOnContour;return o},Ns.prototype.prevTouched=function(n){let o=this.prevPointOnContour;for(;!n.touched(o)&&o!==this;)o=o.prevPointOnContour;return o};var El=Object.freeze(new Ns(0,0)),oc={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function ol(n,o){switch(this.env=n,this.stack=[],this.prog=o,n){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=Ms,this.round=tn}}jt.prototype.exec=function(n,o){if(typeof o!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;let l=this.font,d=this._prepState;if(!d||d.ppem!==o){let h=this._fpgmState;if(!h){ol.prototype=oc,h=this._fpgmState=new ol("fpgm",l.tables.fpgm),h.funcs=[],h.font=l,h.instructionCount=0,h.callDepth=0;try{J(h)}catch(y){console.log("Hinting error in FPGM:"+y),this._errorState=3;return}}ol.prototype=h,d=this._prepState=new ol("prep",l.tables.prep),d.ppem=o,d.instructionCount=0,d.callDepth=0;let m=l.variation&&l.variation.process.getCvarTransform()||l.tables.cvt;if(m){let y=d.cvt=new Array(m.length),T=o/l.unitsPerEm;for(let _=0;_<m.length;_++)y[_]=m[_]*T}else d.cvt=[];try{J(d)}catch(y){this._errorState<2&&console.log("Hinting error in PREP:"+y),this._errorState=2}}if(!(this._errorState>1))try{return He(n,d)}catch(h){this._errorState<1&&(console.log("Hinting error:"+h),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},He=function(n,o){let l=o.ppem/o.font.unitsPerEm,d=l,h=n.components,m,y,T;if(ol.prototype=o,!h)T=new ol("glyf",n.instructions),T.instructionCount=0,T.callDepth=0,mt(n,T,l,d),y=T.gZone;else{let _=o.font;y=[],m=[];for(let R=0;R<h.length;R++){let E=h[R],H=_.glyphs.get(E.glyphIndex);T=new ol("glyf",H.instructions),T.instructionCount=0,T.callDepth=0,mt(H,T,l,d);let z=Math.round(E.dx*l),se=Math.round(E.dy*d),X=T.gZone,ue=T.contours;for(let er=0;er<X.length;er++){let qt=X[er];qt.xTouched=qt.yTouched=!1,qt.xo=qt.x=qt.x+z,qt.yo=qt.y=qt.y+se}let Ze=y.length;y.push.apply(y,X);for(let er=0;er<ue.length;er++)m.push(ue[er]+Ze)}n.instructions&&!T.inhibitGridFit&&(T=new ol("glyf",n.instructions),T.gZone=T.z0=T.z1=T.z2=y,T.contours=m,y.push(new Ns(0,0),new Ns(Math.round(n.advanceWidth*l),0)),J(T),y.length-=2)}return y},mt=function(n,o,l,d){let h=n.points||[],m=h.length,y=o.gZone=o.z0=o.z1=o.z2=[],T=o.contours=[],_;for(let H=0;H<m;H++)_=h[H],y[H]=new Ns(_.x*l,_.y*d,_.lastPointOfContour,_.onCurve);let R,E;for(let H=0;H<m;H++)_=y[H],R||(R=_,T.push(H)),_.lastPointOfContour?(_.nextPointOnContour=R,R.prevPointOnContour=_,R=void 0):(E=y[H+1],_.nextPointOnContour=E,E.prevPointOnContour=_);o.inhibitGridFit||(y.push(new Ns(0,0),new Ns(Math.round(n.advanceWidth*l),0)),J(o),y.length-=2)},J=function(n){let o=n.prog;if(!o)return;let l=o.length,d;for(n.ip=0;n.ip<l;n.ip++){if(++n.instructionCount>ic)throw new Error("Hinting instructions exceeded maximum of "+ic);if(d=Q[o[n.ip]],!d)throw new Error("unknown instruction: 0x"+Number(o[n.ip]).toString(16));d(n)}};function Lu(n){let o=n.tZone=new Array(n.gZone.length);for(let l=0;l<o.length;l++)o[l]=new Ns(0,0)}function g1(n,o){let l=n.prog,d=n.ip,h=1,m;do if(m=l[++d],m===88)h++;else if(m===89)h--;else if(m===64)d+=l[d+1]+1;else if(m===65)d+=2*l[d+1]+1;else if(m>=176&&m<=183)d+=m-176+1;else if(m>=184&&m<=191)d+=(m-184+1)*2;else if(o&&h===1&&m===27)break;while(h>0);n.ip=d}function x1(n,o){o.fv=o.pv=o.dpv=n}function b1(n,o){o.pv=o.dpv=n}function y1(n,o){o.fv=n}function v1(n,o){let l=o.stack,d=l.pop(),h=l.pop(),m=o.z2[d],y=o.z1[h],T,_;n?(T=m.y-y.y,_=y.x-m.x):(T=y.x-m.x,_=y.y-m.y),o.pv=o.dpv=Rs(T,_)}function w1(n,o){let l=o.stack,d=l.pop(),h=l.pop(),m=o.z2[d],y=o.z1[h],T,_;n?(T=m.y-y.y,_=y.x-m.x):(T=y.x-m.x,_=y.y-m.y),o.fv=Rs(T,_)}function O6(n){let o=n.stack,l=o.pop(),d=o.pop();n.pv=n.dpv=Rs(d,l)}function F6(n){let o=n.stack,l=o.pop(),d=o.pop();n.fv=Rs(d,l)}function U6(n){let o=n.stack,l=n.pv;o.push(l.x*16384),o.push(l.y*16384)}function $6(n){let o=n.stack,l=n.fv;o.push(l.x*16384),o.push(l.y*16384)}function z6(n){n.fv=n.pv}function H6(n){let o=n.stack,l=o.pop(),d=o.pop(),h=o.pop(),m=o.pop(),y=o.pop(),T=n.z0,_=n.z1,R=T[l],E=T[d],H=_[h],z=_[m],se=n.z2[y],X=R.x,ue=R.y,Ze=E.x,er=E.y,qt=H.x,fr=H.y,Er=z.x,Cn=z.y,jn=(X-Ze)*(fr-Cn)-(ue-er)*(qt-Er),Pn=X*er-ue*Ze,Ds=qt*Cn-fr*Er;se.x=(Pn*(qt-Er)-Ds*(X-Ze))/jn,se.y=(Pn*(fr-Cn)-Ds*(ue-er))/jn}function W6(n){n.rp0=n.stack.pop()}function G6(n){n.rp1=n.stack.pop()}function V6(n){n.rp2=n.stack.pop()}function q6(n){let o=n.stack.pop();switch(n.zp0=o,o){case 0:n.tZone||Lu(n),n.z0=n.tZone;break;case 1:n.z0=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function Z6(n){let o=n.stack.pop();switch(n.zp1=o,o){case 0:n.tZone||Lu(n),n.z1=n.tZone;break;case 1:n.z1=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function Y6(n){let o=n.stack.pop();switch(n.zp2=o,o){case 0:n.tZone||Lu(n),n.z2=n.tZone;break;case 1:n.z2=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function K6(n){let o=n.stack.pop();switch(n.zp0=n.zp1=n.zp2=o,o){case 0:n.tZone||Lu(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 X6(n){n.loop=n.stack.pop(),n.loop>C&&(n.loop=C)}function J6(n){n.round=tn}function eb(n){n.round=xn}function tb(n){let o=n.stack.pop();n.minDis=o/64}function rb(n){g1(n,!1)}function nb(n){let o=n.stack.pop();n.ip+=o-1}function sb(n){let o=n.stack.pop();n.cvCutIn=o/64}function ib(n){let o=n.stack;o.push(o[o.length-1])}function xh(n){n.stack.pop()}function ob(n){n.stack.length=0}function ab(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(l),o.push(d)}function lb(n){let o=n.stack;o.push(o.length)}function cb(n){let o=n.stack,l=o.pop(),d=o.pop();if(d>C&&(d=C),++n.callDepth>Il)throw new Error("Hinting call depth exceeded maximum of "+Il);let h=n.ip,m=n.prog;n.prog=n.funcs[l];for(let y=0;y<d;y++)J(n);n.ip=h,n.prog=m,n.callDepth--}function ub(n){let o=n.stack.pop();if(++n.callDepth>Il)throw new Error("Hinting call depth exceeded maximum of "+Il);let l=n.ip,d=n.prog;n.prog=n.funcs[o],J(n),n.ip=l,n.prog=d,n.callDepth--}function db(n){let o=n.stack,l=o.pop();o.push(o[o.length-l])}function hb(n){let o=n.stack,l=o.pop();o.push(o.splice(o.length-l,1)[0])}function fb(n){if(n.env!=="fpgm")throw new Error("FDEF not allowed here");let o=n.stack,l=n.prog,d=n.ip,h=o.pop(),m=d;for(;l[++d]!==45;);n.ip=d,n.funcs[h]=l.slice(m+1,d)}function A1(n,o){let l=o.stack.pop(),d=o.z0[l],h=o.fv,m=o.pv,y=m.distance(d,El);n&&(y=o.round(y)),h.setRelative(d,El,y,m),h.touch(d),o.rp0=o.rp1=l}function T1(n,o){let l=o.z2,d=l.length-2,h,m,y;for(let T=0;T<d;T++)h=l[T],!n.touched(h)&&(m=h.prevTouched(n),m!==h&&(y=h.nextTouched(n),m===y&&n.setRelative(h,h,n.distance(m,m,!1,!0),n,!0),n.interpolate(h,m,y,n)))}function C1(n,o){let l=o.stack,d=n?o.rp1:o.rp2,h=(n?o.z0:o.z1)[d],m=o.fv,y=o.pv,T=o.loop,_=o.z2;for(;T--;){let R=l.pop(),E=_[R],H=y.distance(h,h,!1,!0);m.setRelative(E,E,H,y),m.touch(E)}o.loop=1}function S1(n,o){let l=o.stack,d=n?o.rp1:o.rp2,h=(n?o.z0:o.z1)[d],m=o.fv,y=o.pv,T=l.pop(),_=o.z2[o.contours[T]],R=_,E=y.distance(h,h,!1,!0);do R!==h&&m.setRelative(R,R,E,y),R=R.nextPointOnContour;while(R!==_)}function _1(n,o){let l=o.stack,d=n?o.rp1:o.rp2,h=(n?o.z0:o.z1)[d],m=o.fv,y=o.pv,T=l.pop(),_;switch(T){case 0:_=o.tZone;break;case 1:_=o.gZone;break;default:throw new Error("Invalid zone")}let R,E=y.distance(h,h,!1,!0),H=_.length-2;for(let z=0;z<H;z++)R=_[z],m.setRelative(R,R,E,y)}function pb(n){let o=n.stack,l=n.loop,d=n.fv,h=o.pop()/64,m=n.z2;for(;l--;){let y=o.pop(),T=m[y];d.setRelative(T,T,h),d.touch(T)}n.loop=1}function mb(n){let o=n.stack,l=n.rp1,d=n.rp2,h=n.loop,m=n.z0[l],y=n.z1[d],T=n.fv,_=n.dpv,R=n.z2;for(;h--;){let E=o.pop(),H=R[E];T.interpolate(H,m,y,_),T.touch(H)}n.loop=1}function L1(n,o){let l=o.stack,d=l.pop()/64,h=l.pop(),m=o.z1[h],y=o.z0[o.rp0],T=o.fv,_=o.pv;T.setRelative(m,y,d,_),T.touch(m),o.rp1=o.rp0,o.rp2=h,n&&(o.rp0=h)}function gb(n){let o=n.stack,l=n.rp0,d=n.z0[l],h=n.loop,m=n.fv,y=n.pv,T=n.z1;for(;h--;){let _=o.pop(),R=T[_];m.setRelative(R,d,0,y),m.touch(R)}n.loop=1}function xb(n){n.round=Tn}function k1(n,o){let l=o.stack,d=l.pop(),h=l.pop(),m=o.z0[h],y=o.fv,T=o.pv,_=o.cvt[d],R=T.distance(m,El);n&&(Math.abs(R-_)<o.cvCutIn&&(R=_),R=o.round(R)),y.setRelative(m,El,R,T),o.zp0===0&&(m.xo=m.x,m.yo=m.y),y.touch(m),o.rp0=o.rp1=h}function bb(n){let o=n.prog,l=n.ip,d=n.stack,h=o[++l];for(let m=0;m<h;m++)d.push(o[++l]);n.ip=l}function yb(n){let o=n.ip,l=n.prog,d=n.stack,h=l[++o];for(let m=0;m<h;m++){let y=l[++o]<<8|l[++o];y&32768&&(y=-((y^65535)+1)),d.push(y)}n.ip=o}function vb(n){let o=n.stack,l=n.store;l||(l=n.store=[]);let d=o.pop(),h=o.pop();l[h]=d}function wb(n){let o=n.stack,l=n.store,d=o.pop(),h=l&&l[d]||0;o.push(h)}function Ab(n){let o=n.stack,l=o.pop(),d=o.pop();n.cvt[d]=l/64}function Tb(n){let o=n.stack,l=o.pop();o.push(n.cvt[l]*64)}function I1(n,o){let l=o.stack,d=l.pop(),h=o.z2[d];l.push(o.dpv.distance(h,El,n,!1)*64)}function E1(n,o){let l=o.stack,d=l.pop(),h=l.pop(),m=o.z1[d],y=o.z0[h],T=o.dpv.distance(y,m,n,n);o.stack.push(Math.round(T*64))}function Cb(n){n.stack.push(n.ppem)}function Sb(n){n.autoFlip=!0}function _b(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d<l?1:0)}function Lb(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d<=l?1:0)}function kb(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d>l?1:0)}function Ib(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d>=l?1:0)}function Eb(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(l===d?1:0)}function Mb(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(l!==d?1:0)}function Rb(n){let o=n.stack,l=o.pop();o.push(Math.trunc(l)&1?1:0)}function Nb(n){let o=n.stack,l=o.pop();o.push(Math.trunc(l)&1?0:1)}function Db(n){let o=n.stack.pop(),l;o||g1(n,!0)}function Qb(n){}function Bb(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(l&&d?1:0)}function jb(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(l||d?1:0)}function Pb(n){let o=n.stack,l=o.pop();o.push(l?0:1)}function bh(n,o){let l=o.stack,d=l.pop(),h=o.fv,m=o.pv,y=o.ppem,T=o.deltaBase+(n-1)*16,_=o.deltaShift,R=o.z0;for(let E=0;E<d;E++){let H=l.pop(),z=l.pop();if(T+((z&240)>>4)!==y)continue;let se=(z&15)-8;se>=0&&se++;let X=R[H];h.setRelative(X,X,se*_,m)}}function Ob(n){let o=n.stack.pop();n.deltaBase=o}function Fb(n){let o=n.stack.pop();n.deltaShift=Math.pow(.5,o)}function Ub(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d+l)}function $b(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d-l)}function zb(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d*64/l)}function Hb(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(d*l/64)}function Wb(n){let o=n.stack,l=o.pop();o.push(Math.abs(l))}function Gb(n){let o=n.stack,l=o.pop();o.push(-l)}function Vb(n){let o=n.stack,l=o.pop();o.push(Math.floor(l/64)*64)}function qb(n){let o=n.stack,l=o.pop();o.push(Math.ceil(l/64)*64)}function ku(n,o){let l=o.stack,d=l.pop();l.push(o.round(d/64)*64)}function Zb(n){let o=n.stack,l=o.pop(),d=o.pop();n.cvt[d]=l*n.ppem/n.font.unitsPerEm}function yh(n,o){let l=o.stack,d=l.pop(),h=o.ppem,m=o.deltaBase+(n-1)*16,y=o.deltaShift;for(let T=0;T<d;T++){let _=l.pop(),R=l.pop();if(m+((R&240)>>4)!==h)continue;let E=(R&15)-8;E>=0&&E++;let H=E*y;o.cvt[_]+=H}}function Yb(n){let o=n.stack.pop();n.round=Li;let l;switch(o&192){case 0:l=.5;break;case 64:l=1;break;case 128:l=2;break;default:throw new Error("invalid SROUND value")}switch(n.srPeriod=l,o&48){case 0:n.srPhase=0;break;case 16:n.srPhase=.25*l;break;case 32:n.srPhase=.5*l;break;case 48:n.srPhase=.75*l;break;default:throw new Error("invalid SROUND value")}o&=15,o===0?n.srThreshold=0:n.srThreshold=(o/8-.5)*l}function Kb(n){let o=n.stack.pop();n.round=Li;let l;switch(o&192){case 0:l=Math.sqrt(2)/2;break;case 64:l=Math.sqrt(2);break;case 128:l=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(n.srPeriod=l,o&48){case 0:n.srPhase=0;break;case 16:n.srPhase=.25*l;break;case 32:n.srPhase=.5*l;break;case 48:n.srPhase=.75*l;break;default:throw new Error("invalid S45ROUND value")}o&=15,o===0?n.srThreshold=0:n.srThreshold=(o/8-.5)*l}function Xb(n){n.round=mr}function Jb(n){n.round=_i}function e4(n){n.round=rn}function t4(n){let o=n.stack.pop()}function M1(n,o){let l=o.stack,d=l.pop(),h=l.pop(),m=o.z2[d],y=o.z1[h],T,_;n?(T=m.y-y.y,_=y.x-m.x):(T=y.x-m.x,_=y.y-m.y),o.dpv=Rs(T,_)}function r4(n){let o=n.stack,l=o.pop(),d=0;l&1&&(d=35),l&32&&(d|=4096),o.push(d)}function n4(n){let o=n.stack,l=o.pop(),d=o.pop(),h=o.pop();o.push(d),o.push(l),o.push(h)}function s4(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(Math.max(d,l))}function i4(n){let o=n.stack,l=o.pop(),d=o.pop();o.push(Math.min(d,l))}function o4(n){let o=n.stack.pop()}function a4(n){let o=n.stack.pop(),l=n.stack.pop();switch(o){case 1:n.inhibitGridFit=!!l;return;case 2:n.ignoreCvt=!!l;return;default:throw new Error("invalid INSTCTRL[] selector")}}function al(n,o){let l=o.stack,d=o.prog,h=o.ip;for(let m=0;m<n;m++)l.push(d[++h]);o.ip=h}function ll(n,o){let l=o.ip,d=o.prog,h=o.stack;for(let m=0;m<n;m++){let y=d[++l]<<8|d[++l];y&32768&&(y=-((y^65535)+1)),h.push(y)}o.ip=l}function Yt(n,o,l,d,h,m){let y=m.stack,T=n&&y.pop(),_=y.pop(),R=m.rp0,E=m.z0[R],H=m.z1[_],z=m.minDis,se=m.fv,X=m.dpv,ue,Ze,er,qt;Ze=ue=X.distance(H,E,!0,!0),er=Ze>=0?1:-1,Ze=Math.abs(Ze),n&&(qt=m.cvt[T],d&&Math.abs(Ze-qt)<m.cvCutIn&&(Ze=qt)),l&&Ze<z&&(Ze=z),d&&(Ze=m.round(Ze)),se.setRelative(H,E,er*Ze,X),se.touch(H),m.rp1=m.rp0,m.rp2=_,o&&(m.rp0=_)}Q=[x1.bind(void 0,$s),x1.bind(void 0,Ms),b1.bind(void 0,$s),b1.bind(void 0,Ms),y1.bind(void 0,$s),y1.bind(void 0,Ms),v1.bind(void 0,0),v1.bind(void 0,1),w1.bind(void 0,0),w1.bind(void 0,1),O6,F6,U6,$6,z6,H6,W6,G6,V6,q6,Z6,Y6,K6,X6,J6,eb,tb,rb,nb,sb,void 0,void 0,ib,xh,ob,ab,lb,db,hb,void 0,void 0,void 0,cb,ub,fb,void 0,A1.bind(void 0,0),A1.bind(void 0,1),T1.bind(void 0,$s),T1.bind(void 0,Ms),C1.bind(void 0,0),C1.bind(void 0,1),S1.bind(void 0,0),S1.bind(void 0,1),_1.bind(void 0,0),_1.bind(void 0,1),pb,mb,L1.bind(void 0,0),L1.bind(void 0,1),gb,xb,k1.bind(void 0,0),k1.bind(void 0,1),bb,yb,vb,wb,Ab,Tb,I1.bind(void 0,0),I1.bind(void 0,1),void 0,E1.bind(void 0,0),E1.bind(void 0,1),Cb,void 0,Sb,void 0,void 0,_b,Lb,kb,Ib,Eb,Mb,Rb,Nb,Db,Qb,Bb,jb,Pb,bh.bind(void 0,1),Ob,Fb,Ub,$b,zb,Hb,Wb,Gb,Vb,qb,ku.bind(void 0,0),ku.bind(void 0,1),ku.bind(void 0,2),ku.bind(void 0,3),void 0,void 0,void 0,void 0,Zb,bh.bind(void 0,2),bh.bind(void 0,3),yh.bind(void 0,1),yh.bind(void 0,2),yh.bind(void 0,3),Yb,Kb,void 0,void 0,Xb,void 0,Jb,e4,xh,xh,void 0,void 0,void 0,void 0,void 0,t4,M1.bind(void 0,0),M1.bind(void 0,1),r4,void 0,n4,s4,i4,o4,a4,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,al.bind(void 0,1),al.bind(void 0,2),al.bind(void 0,3),al.bind(void 0,4),al.bind(void 0,5),al.bind(void 0,6),al.bind(void 0,7),al.bind(void 0,8),ll.bind(void 0,1),ll.bind(void 0,2),ll.bind(void 0,3),ll.bind(void 0,4),ll.bind(void 0,5),ll.bind(void 0,6),ll.bind(void 0,7),ll.bind(void 0,8),Yt.bind(void 0,0,0,0,0,0),Yt.bind(void 0,0,0,0,0,1),Yt.bind(void 0,0,0,0,0,2),Yt.bind(void 0,0,0,0,0,3),Yt.bind(void 0,0,0,0,1,0),Yt.bind(void 0,0,0,0,1,1),Yt.bind(void 0,0,0,0,1,2),Yt.bind(void 0,0,0,0,1,3),Yt.bind(void 0,0,0,1,0,0),Yt.bind(void 0,0,0,1,0,1),Yt.bind(void 0,0,0,1,0,2),Yt.bind(void 0,0,0,1,0,3),Yt.bind(void 0,0,0,1,1,0),Yt.bind(void 0,0,0,1,1,1),Yt.bind(void 0,0,0,1,1,2),Yt.bind(void 0,0,0,1,1,3),Yt.bind(void 0,0,1,0,0,0),Yt.bind(void 0,0,1,0,0,1),Yt.bind(void 0,0,1,0,0,2),Yt.bind(void 0,0,1,0,0,3),Yt.bind(void 0,0,1,0,1,0),Yt.bind(void 0,0,1,0,1,1),Yt.bind(void 0,0,1,0,1,2),Yt.bind(void 0,0,1,0,1,3),Yt.bind(void 0,0,1,1,0,0),Yt.bind(void 0,0,1,1,0,1),Yt.bind(void 0,0,1,1,0,2),Yt.bind(void 0,0,1,1,0,3),Yt.bind(void 0,0,1,1,1,0),Yt.bind(void 0,0,1,1,1,1),Yt.bind(void 0,0,1,1,1,2),Yt.bind(void 0,0,1,1,1,3),Yt.bind(void 0,1,0,0,0,0),Yt.bind(void 0,1,0,0,0,1),Yt.bind(void 0,1,0,0,0,2),Yt.bind(void 0,1,0,0,0,3),Yt.bind(void 0,1,0,0,1,0),Yt.bind(void 0,1,0,0,1,1),Yt.bind(void 0,1,0,0,1,2),Yt.bind(void 0,1,0,0,1,3),Yt.bind(void 0,1,0,1,0,0),Yt.bind(void 0,1,0,1,0,1),Yt.bind(void 0,1,0,1,0,2),Yt.bind(void 0,1,0,1,0,3),Yt.bind(void 0,1,0,1,1,0),Yt.bind(void 0,1,0,1,1,1),Yt.bind(void 0,1,0,1,1,2),Yt.bind(void 0,1,0,1,1,3),Yt.bind(void 0,1,1,0,0,0),Yt.bind(void 0,1,1,0,0,1),Yt.bind(void 0,1,1,0,0,2),Yt.bind(void 0,1,1,0,0,3),Yt.bind(void 0,1,1,0,1,0),Yt.bind(void 0,1,1,0,1,1),Yt.bind(void 0,1,1,0,1,2),Yt.bind(void 0,1,1,0,1,3),Yt.bind(void 0,1,1,1,0,0),Yt.bind(void 0,1,1,1,0,1),Yt.bind(void 0,1,1,1,0,2),Yt.bind(void 0,1,1,1,0,3),Yt.bind(void 0,1,1,1,1,0),Yt.bind(void 0,1,1,1,1,1),Yt.bind(void 0,1,1,1,1,2),Yt.bind(void 0,1,1,1,1,3)];var l4=jt;function d0(n){this.char=n,this.state={},this.activeState=null}function vh(n,o,l){this.contextName=l,this.startIndex=n,this.endOffset=o}function c4(n,o,l){this.contextName=n,this.openRange=null,this.ranges=[],this.checkStart=o,this.checkEnd=l}function ji(n,o){this.context=n,this.index=o,this.length=n.length,this.current=n[o],this.backtrack=n.slice(0,o),this.lookahead=n.slice(o+1)}function Iu(n){this.eventId=n,this.subscribers=[]}function u4(n){let o=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];for(let d=0;d<o.length;d++){let h=o[d];Object.defineProperty(this.events,h,{value:new Iu(h)})}if(n)for(let d=0;d<o.length;d++){let h=o[d],m=n[h];typeof m=="function"&&this.events[h].subscribe(m)}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 xs(n){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],u4.call(this,n)}d0.prototype.setState=function(n,o){return this.state[n]=o,this.activeState={key:n,value:this.state[n]},this.activeState},d0.prototype.getState=function(n){return this.state[n]||null},xs.prototype.inboundIndex=function(n){return n>=0&&n<this.tokens.length},xs.prototype.composeRUD=function(n){let o=n.map(d=>this[d[0]].apply(this,d.slice(1).concat(!0))),l=d=>typeof d=="object"&&Object.prototype.hasOwnProperty.call(d,"FAIL");if(o.every(l))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:o.filter(l)};this.dispatch("composeRUD",[o.filter(d=>!l(d))])},xs.prototype.replaceRange=function(n,o,l,d){o=o!==null?o:this.tokens.length;let h=l.every(m=>m instanceof d0);if(!isNaN(n)&&this.inboundIndex(n)&&h){let m=this.tokens.splice.apply(this.tokens,[n,o].concat(l));return d||this.dispatch("replaceToken",[n,o,l]),[m,l]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},xs.prototype.replaceToken=function(n,o,l){if(!isNaN(n)&&this.inboundIndex(n)&&o instanceof d0){let d=this.tokens.splice(n,1,o);return l||this.dispatch("replaceToken",[n,o]),[d[0],o]}else return{FAIL:"replaceToken: invalid token or index."}},xs.prototype.removeRange=function(n,o,l){o=isNaN(o)?this.tokens.length:o;let d=this.tokens.splice(n,o);return l||this.dispatch("removeRange",[d,n,o]),d},xs.prototype.removeToken=function(n,o){if(!isNaN(n)&&this.inboundIndex(n)){let l=this.tokens.splice(n,1);return o||this.dispatch("removeToken",[l,n]),l}else return{FAIL:"removeToken: invalid token index."}},xs.prototype.insertToken=function(n,o,l){return n.every(d=>d instanceof d0)?(this.tokens.splice.apply(this.tokens,[o,0].concat(n)),l||this.dispatch("insertToken",[n,o]),n):{FAIL:"insertToken: invalid token(s)."}},xs.prototype.registerModifier=function(n,o,l){this.events.newToken.subscribe(function(d,h){let m=[d,h],y=o===null||o.apply(this,m)===!0,T=[d,h];if(y){let _=l.apply(this,T);d.setState(n,_)}}),this.registeredModifiers.push(n)},Iu.prototype.subscribe=function(n){return typeof n=="function"?this.subscribers.push(n)-1:{FAIL:`invalid '${this.eventId}' event handler`}},Iu.prototype.unsubscribe=function(n){this.subscribers.splice(n,1)},ji.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)},ji.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}},xs.prototype.rangeToText=function(n){if(n instanceof vh)return this.getRangeTokens(n).map(o=>o.char).join("")},xs.prototype.getText=function(){return this.tokens.map(n=>n.char).join("")},xs.prototype.getContext=function(n){return this.registeredContexts[n]||null},xs.prototype.on=function(n,o){let l=this.events[n];return l?l.subscribe(o):null},xs.prototype.dispatch=function(n,o){let l=this.events[n];if(l instanceof Iu)for(let d=0;d<l.subscribers.length;d++)l.subscribers[d].apply(this,o||[])},xs.prototype.registerContextChecker=function(n,o,l){if(this.getContext(n))return{FAIL:`context name '${n}' is already registered.`};if(typeof o!="function")return{FAIL:"missing context start check."};if(typeof l!="function")return{FAIL:"missing context end check."};let d=new c4(n,o,l);return this.registeredContexts[n]=d,this.contextCheckers.push(d),d},xs.prototype.getRangeTokens=function(n){let o=n.startIndex+n.endOffset;return[].concat(this.tokens.slice(n.startIndex,o))},xs.prototype.getContextRanges=function(n){let o=this.getContext(n);return o?o.ranges:{FAIL:`context checker '${n}' is not registered.`}},xs.prototype.resetContextsRanges=function(){let n=this.registeredContexts;for(let o in n)if(Object.prototype.hasOwnProperty.call(n,o)){let l=n[o];l.ranges=[]}},xs.prototype.updateContextsRanges=function(){this.resetContextsRanges();let n=this.tokens.map(o=>o.char);for(let o=0;o<n.length;o++){let l=new ji(n,o);this.runContextCheck(l)}this.dispatch("updateContextsRanges",[this.registeredContexts])},xs.prototype.setEndOffset=function(n,o){let l=this.getContext(o).openRange.startIndex,d=new vh(l,n,o),h=this.getContext(o).ranges;return d.rangeId=`${o}.${h.length}`,h.push(d),this.getContext(o).openRange=null,d},xs.prototype.runContextCheck=function(n){let o=n.index;for(let l=0;l<this.contextCheckers.length;l++){let d=this.contextCheckers[l],h=d.contextName,m=this.getContext(h).openRange;if(!m&&d.checkStart(n)&&(m=new vh(o,null,h),this.getContext(h).openRange=m,this.dispatch("contextStart",[h,o])),m&&d.checkEnd(n)){let y=o-m.startIndex+1,T=this.setEndOffset(y,h);this.dispatch("contextEnd",[h,T])}}},xs.prototype.tokenize=function(n){this.tokens=[],this.resetContextsRanges();let o=Array.from(n);this.dispatch("start");for(let l=0;l<o.length;l++){let d=o[l],h=new ji(o,l);this.dispatch("next",[h]),this.runContextCheck(h);let m=new d0(d);this.tokens.push(m),this.dispatch("newToken",[m,h])}return this.dispatch("end",[this.tokens]),this.tokens};var d4=xs;function cl(n){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(n)}function R1(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 ul(n){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(n)}function Eu(n){return/[\u0E00-\u0E7F]/.test(n)}function Mu(n){return/[A-z]/.test(n)}function h4(n){return/\s/.test(n)}function ho(n){this.font=n,this.features={}}function dl(n){this.id=n.id,this.tag=n.tag,this.substitution=n.substitution}function hl(n,o){if(!n)return-1;switch(o.format){case 1:return o.glyphs.indexOf(n);case 2:{let l=o.ranges;for(let d=0;d<l.length;d++){let h=l[d];if(n>=h.start&&n<=h.end){let m=n-h.start;return h.index+m}}break}default:return-1}return-1}function f4(n,o){return hl(n,o.coverage)===-1?null:n+o.deltaGlyphId}function p4(n,o){let l=hl(n,o.coverage);return l===-1?null:o.substitute[l]}function wh(n,o){let l=[];for(let d=0;d<n.length;d++){let h=n[d],m=o.current;m=Array.isArray(m)?m[0]:m;let y=hl(m,h);y!==-1&&l.push(y)}return l.length!==n.length?-1:l}function m4(n,o){let l=o.inputCoverage.length+o.lookaheadCoverage.length+o.backtrackCoverage.length;if(n.context.length<l)return[];let d=wh(o.inputCoverage,n);if(d===-1)return[];let h=o.inputCoverage.length-1;if(n.lookahead.length<o.lookaheadCoverage.length)return[];let m=n.lookahead.slice(h);for(;m.length&&ul(m[0].char);)m.shift();let y=new ji(m,0),T=wh(o.lookaheadCoverage,y),_=[].concat(n.backtrack);for(_.reverse();_.length&&ul(_[0].char);)_.shift();if(_.length<o.backtrackCoverage.length)return[];let R=new ji(_,0),E=wh(o.backtrackCoverage,R),H=d.length===o.inputCoverage.length&&T.length===o.lookaheadCoverage.length&&E.length===o.backtrackCoverage.length,z=[];if(H)for(let se=0;se<o.lookupRecords.length;se++){let X=o.lookupRecords[se],ue=X.lookupListIndex,Ze=this.getLookupByIndex(ue);for(let er=0;er<Ze.subtables.length;er++){let qt=Ze.subtables[er],fr,Er=this.getSubstitutionType(Ze,qt);if(Er==="71"?(Er=this.getSubstitutionType(qt,qt.extension),fr=this.getLookupMethod(qt,qt.extension),qt=qt.extension):fr=this.getLookupMethod(Ze,qt),Er==="12"){let Cn=n.get(X.sequenceIndex),jn=fr(Cn);jn&&z.push(jn)}else if(Er==="21"){let Cn=n.get(X.sequenceIndex),jn=fr(Cn);jn&&z.push(jn)}else throw new Error(`Substitution type ${Er} is not supported in chaining substitution`)}}return z}function g4(n,o){let l=n.current,d=hl(l,o.coverage);if(d===-1)return null;let h,m=o.ligatureSets[d];for(let y=0;y<m.length;y++){h=m[y];for(let T=0;T<h.components.length;T++){let _=n.lookahead[T],R=h.components[T];if(_!==R)break;if(T===h.components.length-1)return h}}return null}function x4(n,o){let l=n.current;if(hl(l,o.coverage)===-1)return null;for(let d of o.ruleSets)for(let h of d){let m=!0;for(let y=0;y<h.input.length;y++)if(n.lookahead[y]!==h.input[y]){m=!1;break}if(m){let y=[];y.push(l);for(let _=0;_<h.input.length;_++)y.push(h.input[_]);let T=(_,R)=>{let{lookupListIndex:E,sequenceIndex:H}=R,{subtables:z}=this.getLookupByIndex(E);for(let se of z)hl(_[H],se.coverage)!==-1&&(_[H]=se.deltaGlyphId)};for(let _=0;_<h.lookupRecords.length;_++){let R=h.lookupRecords[_];T(y,R)}return y}}return null}function b4(n,o){if(n.context.length<o.coverages.length)return[];for(let d=0;d<o.coverages.length;d++){let h=n.get(d);if(h=Array.isArray(h)?h[0]:h,hl(h,o.coverages[d])===-1)return[]}let l=[];for(let d=0;d<o.lookupRecords.length;d++){let h=o.lookupRecords[d],m=h.lookupListIndex,y=this.getLookupByIndex(m);for(let T=0;T<y.subtables.length;T++){let _=y.subtables[T],R,E=this.getSubstitutionType(y,_);if(E==="71"?(E=this.getSubstitutionType(_,_.extension),R=this.getLookupMethod(_,_.extension),_=_.extension):R=this.getLookupMethod(y,_),E==="12"){let H=n.get(h.sequenceIndex),z=R(H);z&&l.push(z)}else if(E==="21"){let H=n.get(h.sequenceIndex),z=R(H);z&&l.push(z)}}}return l}function y4(n,o){let l=hl(n,o.coverage);return l===-1?null:o.sequences[l]}ho.prototype.getDefaultScriptFeaturesIndexes=function(){let n=this.font.tables.gsub.scripts;for(let o=0;o<n.length;o++){let l=n[o];if(l.tag==="DFLT")return l.script.defaultLangSys.featureIndexes}return[]},ho.prototype.getScriptFeaturesIndexes=function(n){if(!this.font.tables.gsub)return[];if(!n)return this.getDefaultScriptFeaturesIndexes();let o=this.font.tables.gsub.scripts;for(let l=0;l<o.length;l++){let d=o[l];if(d.tag===n&&d.script.defaultLangSys)return d.script.defaultLangSys.featureIndexes;{let h=d.langSysRecords;if(h)for(let m=0;m<h.length;m++){let y=h[m];if(y.tag===n)return y.langSys.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},ho.prototype.mapTagsToFeatures=function(n,o){let l={};for(let d=0;d<n.length;d++){let h=n[d].tag,m=n[d].feature;l[h]=m}this.features[o].tags=l},ho.prototype.getScriptFeatures=function(n){let o=this.features[n];if(Object.prototype.hasOwnProperty.call(this.features,n))return o;let l=this.getScriptFeaturesIndexes(n);if(!l)return null;let d=this.font.tables.gsub;return o=l.map(h=>d.features[h]),this.features[n]=o,this.mapTagsToFeatures(o,n),o},ho.prototype.getSubstitutionType=function(n,o){let l=n.lookupType.toString(),d=o.substFormat.toString();return l+d},ho.prototype.getLookupMethod=function(n,o){let l=this.getSubstitutionType(n,o);switch(l){case"11":return d=>f4.apply(this,[d,o]);case"12":return d=>p4.apply(this,[d,o]);case"63":return d=>m4.apply(this,[d,o]);case"41":return d=>g4.apply(this,[d,o]);case"21":return d=>y4.apply(this,[d,o]);case"51":return d=>x4.apply(this,[d,o]);case"53":return d=>b4.apply(this,[d,o]);default:throw new Error(`substitutionType : ${l} lookupType: ${n.lookupType} - substFormat: ${o.substFormat} is not yet supported`)}},ho.prototype.lookupFeature=function(n){let o=n.contextParams,l=o.index,d=this.getFeature({tag:n.tag,script:n.script});if(!d)return new Error(`font '${(this.font.names.unicode||this.font.names.windows||this.font.names.macintosh).fullName.en}' doesn't support feature '${n.tag}' for script '${n.script}'.`);let h=this.getFeatureLookups(d),m=[].concat(o.context);for(let y=0;y<h.length;y++){let T=h[y],_=this.getLookupSubtables(T);for(let R=0;R<_.length;R++){let E=_[R],H=this.getSubstitutionType(T,E),z;H==="71"?(H=this.getSubstitutionType(E,E.extension),z=this.getLookupMethod(E,E.extension),E=E.extension):z=this.getLookupMethod(T,E);let se;switch(H){case"11":se=z(o.current),se&&m.splice(l,1,new dl({id:11,tag:n.tag,substitution:se}));break;case"12":se=z(o.current),se&&m.splice(l,1,new dl({id:12,tag:n.tag,substitution:se}));break;case"63":se=z(o),Array.isArray(se)&&se.length&&m.splice(l,1,new dl({id:63,tag:n.tag,substitution:se}));break;case"41":se=z(o),se&&m.splice(l,1,new dl({id:41,tag:n.tag,substitution:se}));break;case"21":se=z(o.current),se&&m.splice(l,1,new dl({id:21,tag:n.tag,substitution:se}));break;case"51":case"53":se=z(o),Array.isArray(se)&&se.length&&m.splice(l,1,new dl({id:parseInt(H),tag:n.tag,substitution:se}));break}o=new ji(m,l),!(Array.isArray(se)&&!se.length)&&(se=null)}}return m.length?m:null},ho.prototype.supports=function(n){if(!n.script)return!1;this.getScriptFeatures(n.script);let o=Object.prototype.hasOwnProperty.call(this.features,n.script);if(!n.tag)return o;let l=this.features[n.script].some(d=>d.tag===n.tag);return o&&l},ho.prototype.getLookupSubtables=function(n){return n.subtables||null},ho.prototype.getLookupByIndex=function(n){return this.font.tables.gsub.lookups[n]||null},ho.prototype.getFeatureLookups=function(n){return n.lookupListIndexes.map(this.getLookupByIndex.bind(this))},ho.prototype.getFeature=function(n){if(!this.font)return{FAIL:"No font was found"};Object.prototype.hasOwnProperty.call(this.features,n.script)||this.getScriptFeatures(n.script);let o=this.features[n.script];return o?o.tags[n.tag]?this.features[n.script].tags[n.tag]:null:{FAIL:`No feature for script ${n.script}`}};var v4=ho;function w4(n){let o=n.current,l=n.get(-1);return l===null&&cl(o)||!cl(l)&&cl(o)}function A4(n){let o=n.get(1);return o===null||!cl(o)}var T4={startCheck:w4,endCheck:A4};function C4(n){let o=n.current,l=n.get(-1);return(cl(o)||ul(o))&&!cl(l)}function S4(n){let o=n.get(1);switch(!0){case o===null:return!0;case(!cl(o)&&!ul(o)):{let l=h4(o);if(!l)return!0;if(l){let d=!1;if(d=n.lookahead.some(h=>cl(h)||ul(h)),!d)return!0}break}default:return!1}}var _4={startCheck:C4,endCheck:S4};function L4(n,o,l){o[l].setState(n.tag,n.substitution)}function k4(n,o,l){o[l].setState(n.tag,n.substitution)}function Ah(n,o,l){for(let d=0;d<n.substitution.length;d++){let h=n.substitution[d],m=o[l+d];if(Array.isArray(h)){h.length?m.setState(n.tag,h[0]):m.setState("deleted",!0);continue}m.setState(n.tag,h)}}function I4(n,o,l){let d=o[l];d.setState(n.tag,n.substitution.ligGlyph);let h=n.substitution.components.length;for(let m=0;m<h;m++)d=o[l+m+1],d.setState("deleted",!0)}var N1={11:L4,12:k4,63:Ah,41:I4,51:Ah,53:Ah};function E4(n,o,l){n instanceof dl&&N1[n.id]&&N1[n.id](n,o,l)}var Ml=E4;function M4(n){let o=[].concat(n.backtrack);for(let l=o.length-1;l>=0;l--){let d=o[l],h=R1(d),m=ul(d);if(!h&&!m)return!0;if(h)return!1}return!1}function R4(n){if(R1(n.current))return!1;for(let o=0;o<n.lookahead.length;o++){let l=n.lookahead[o];if(!ul(l))return!0}return!1}function N4(n){let o="arab",l=this.featuresTags[o],d=this.tokenizer.getRangeTokens(n);if(d.length===1)return;let h=new ji(d.map(y=>y.getState("glyphIndex")),0),m=new ji(d.map(y=>y.char),0);for(let y=0;y<d.length;y++){let T=d[y];if(ul(T.char))continue;h.setCurrentIndex(y),m.setCurrentIndex(y);let _=0;M4(m)&&(_|=1),R4(m)&&(_|=2);let R;switch(_){case 1:R="fina";break;case 2:R="init";break;case 3:R="medi";break}if(l.indexOf(R)===-1)continue;let E=this.query.lookupFeature({tag:R,script:o,contextParams:h});if(E instanceof Error){console.info(E.message);continue}for(let H=0;H<E.length;H++){let z=E[H];z instanceof dl&&(Ml(z,d,H),h.context[H]=z.substitution)}}}var D4=N4;function D1(n,o){let l=n.map(d=>d.activeState.value);return new ji(l,o||0)}function Q4(n){let o="arab",l=this.tokenizer.getRangeTokens(n),d=D1(l);for(let h=0;h<d.context.length;h++){d.setCurrentIndex(h);let m=this.query.lookupFeature({tag:"rlig",script:o,contextParams:d});if(m.length){for(let y=0;y<m.length;y++){let T=m[y];Ml(T,l,h)}d=D1(l)}}}var B4=Q4;function j4(n){return n.index===0&&n.context.length>1}function P4(n){return n.index===n.context.length-1}var O4={startCheck:j4,endCheck:P4};function Q1(n,o){let l=n.map(d=>d.activeState.value);return new ji(l,o||0)}function F4(n){let o="delf",l="ccmp",d=this.tokenizer.getRangeTokens(n),h=Q1(d);for(let m=0;m<h.context.length;m++){if(!this.query.getFeature({tag:l,script:o,contextParams:h}))continue;h.setCurrentIndex(m);let y=this.query.lookupFeature({tag:l,script:o,contextParams:h});if(y.length){for(let T=0;T<y.length;T++){let _=y[T];Ml(_,d,m)}h=Q1(d)}}}var U4=F4;function $4(n){let o=n.current,l=n.get(-1);return l===null&&Mu(o)||!Mu(l)&&Mu(o)}function z4(n){let o=n.get(1);return o===null||!Mu(o)}var H4={startCheck:$4,endCheck:z4};function B1(n,o){let l=n.map(d=>d.activeState.value);return new ji(l,o||0)}function W4(n){let o="latn",l=this.tokenizer.getRangeTokens(n),d=B1(l);for(let h=0;h<d.context.length;h++){d.setCurrentIndex(h);let m=this.query.lookupFeature({tag:"liga",script:o,contextParams:d});if(m.length){for(let y=0;y<m.length;y++){let T=m[y];Ml(T,l,h)}d=B1(l)}}}var G4=W4;function V4(n){let o=n.current,l=n.get(-1);return l===null&&Eu(o)||!Eu(l)&&Eu(o)}function q4(n){let o=n.get(1);return o===null||!Eu(o)}var Z4={startCheck:V4,endCheck:q4};function j1(n,o){let l=n.map(d=>d.activeState.value);return new ji(l,o||0)}function Y4(n){let o="thai",l=this.tokenizer.getRangeTokens(n),d=j1(l,0);for(let h=0;h<d.context.length;h++){d.setCurrentIndex(h);let m=this.query.lookupFeature({tag:"ccmp",script:o,contextParams:d});if(m.length){for(let y=0;y<m.length;y++){let T=m[y];Ml(T,l,h)}d=j1(l,h)}}}var K4=Y4;function P1(n,o){let l=n.map(d=>d.activeState.value);return new ji(l,o||0)}function X4(n){let o="thai",l=this.tokenizer.getRangeTokens(n),d=P1(l,0);for(let h=0;h<d.context.length;h++){d.setCurrentIndex(h);let m=this.query.lookupFeature({tag:"liga",script:o,contextParams:d});if(m.length){for(let y=0;y<m.length;y++){let T=m[y];Ml(T,l,h)}d=P1(l,h)}}}var J4=X4;function O1(n,o){let l=n.map(d=>d.activeState.value);return new ji(l,o||0)}function ey(n){let o="thai",l=this.tokenizer.getRangeTokens(n),d=O1(l,0);for(let h=0;h<d.context.length;h++){d.setCurrentIndex(h);let m=this.query.lookupFeature({tag:"rlig",script:o,contextParams:d});if(m.length){for(let y=0;y<m.length;y++){let T=m[y];Ml(T,l,h)}d=O1(l,h)}}}var ty=ey;function Th(n){if(n===null)return!1;let o=n.codePointAt(0);return o>=6155&&o<=6157||o>=65024&&o<=65039||o>=917760&&o<=917999}function ry(n){let o=n.current,l=n.get(1);return l===null&&Th(o)||Th(l)}function ny(n){let o=n.get(1);return o===null||!Th(o)}var sy={startCheck:ry,endCheck:ny};function iy(n){let o=this.query.font,l=this.tokenizer.getRangeTokens(n);if(l[1].setState("deleted",!0),o.tables.cmap&&o.tables.cmap.varSelectorList){let d=l[0].char.codePointAt(0),h=l[1].char.codePointAt(0),m=o.tables.cmap.varSelectorList[h];if(m!==void 0&&m.nonDefaultUVS){let y=m.nonDefaultUVS.uvsMappings;if(y[d]){let T=y[d].glyphID;o.glyphs.glyphs[T]!==void 0&&l[0].setState("glyphIndex",T)}}}}var oy=iy;function So(n){this.baseDir=n||"ltr",this.tokenizer=new d4,this.featuresTags={}}So.prototype.setText=function(n){this.text=n},So.prototype.contextChecks={ccmpReplacementCheck:O4,latinWordCheck:H4,arabicWordCheck:T4,arabicSentenceCheck:_4,thaiWordCheck:Z4,unicodeVariationSequenceCheck:sy};function h0(n){let o=this.contextChecks[`${n}Check`];return this.tokenizer.registerContextChecker(n,o.startCheck,o.endCheck)}function ay(){return h0.call(this,"ccmpReplacement"),h0.call(this,"latinWord"),h0.call(this,"arabicWord"),h0.call(this,"arabicSentence"),h0.call(this,"thaiWord"),h0.call(this,"unicodeVariationSequence"),this.tokenizer.tokenize(this.text)}function ly(){let n=this.tokenizer.getContextRanges("arabicSentence");for(let o=0;o<n.length;o++){let l=n[o],d=this.tokenizer.getRangeTokens(l);this.tokenizer.replaceRange(l.startIndex,l.endOffset,d.reverse())}}So.prototype.registerFeatures=function(n,o){let l=o.filter(d=>this.query.supports({script:n,tag:d}));Object.prototype.hasOwnProperty.call(this.featuresTags,n)?this.featuresTags[n]=this.featuresTags[n].concat(l):this.featuresTags[n]=l},So.prototype.applyFeatures=function(n,o){if(!n)throw new Error("No valid font was provided to apply features");this.query||(this.query=new v4(n));for(let l=0;l<o.length;l++){let d=o[l];this.query.supports({script:d.script})&&this.registerFeatures(d.script,d.tags)}},So.prototype.registerModifier=function(n,o,l){this.tokenizer.registerModifier(n,o,l)};function ac(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function cy(){if(!Object.prototype.hasOwnProperty.call(this.featuresTags,"arab"))return;ac.call(this);let n=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<n.length;o++){let l=n[o];D4.call(this,l)}}function uy(){ac.call(this);let n=this.tokenizer.getContextRanges("ccmpReplacement");for(let o=0;o<n.length;o++){let l=n[o];U4.call(this,l)}}function dy(){if(!this.hasFeatureEnabled("arab","rlig"))return;ac.call(this);let n=this.tokenizer.getContextRanges("arabicWord");for(let o=0;o<n.length;o++){let l=n[o];B4.call(this,l)}}function hy(){if(!this.hasFeatureEnabled("latn","liga"))return;ac.call(this);let n=this.tokenizer.getContextRanges("latinWord");for(let o=0;o<n.length;o++){let l=n[o];G4.call(this,l)}}function fy(){let n=this.tokenizer.getContextRanges("unicodeVariationSequence");for(let o=0;o<n.length;o++){let l=n[o];oy.call(this,l)}}function py(){ac.call(this);let n=this.tokenizer.getContextRanges("thaiWord");for(let o=0;o<n.length;o++){let l=n[o];this.hasFeatureEnabled("thai","liga")&&J4.call(this,l),this.hasFeatureEnabled("thai","rlig")&&ty.call(this,l),this.hasFeatureEnabled("thai","ccmp")&&K4.call(this,l)}}So.prototype.checkContextReady=function(n){return!!this.tokenizer.getContext(n)},So.prototype.applyFeaturesToContexts=function(){this.checkContextReady("ccmpReplacement")&&uy.call(this),this.checkContextReady("arabicWord")&&(cy.call(this),dy.call(this)),this.checkContextReady("latinWord")&&hy.call(this),this.checkContextReady("arabicSentence")&&ly.call(this),this.checkContextReady("thaiWord")&&py.call(this),this.checkContextReady("unicodeVariationSequence")&&fy.call(this)},So.prototype.hasFeatureEnabled=function(n,o){return(this.featuresTags[n]||[]).indexOf(o)!==-1},So.prototype.processText=function(n){(!this.text||this.text!==n)&&(this.setText(n),ay.call(this),this.applyFeaturesToContexts())},So.prototype.getBidiText=function(n){return this.processText(n),this.tokenizer.getText()},So.prototype.getTextGlyphs=function(n){this.processText(n);let o=[];for(let l=0;l<this.tokenizer.tokens.length;l++){let d=this.tokenizer.tokens[l];if(d.state.deleted)continue;let h=d.activeState.value;o.push(Array.isArray(h)?h[0]:h)}return o};var my=So;function Ch(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 Rn(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=Ch(n),this.names.macintosh=Ch(n),this.names.windows=Ch(n),this.unitsPerEm=n.unitsPerEm||1e3,this.ascender=n.ascender,this.descender=n.descender,this.createdTimestamp=n.createdTimestamp,this.italicAngle=n.italicAngle||0,this.weightClass=n.weightClass||0;let o=0;n.fsSelection?o=n.fsSelection:(this.italicAngle<0?o|=this.fsSelectionValues.ITALIC:this.italicAngle>0&&(o|=this.fsSelectionValues.OBLIQUE),this.weightClass>=600&&(o|=this.fsSelectionValues.BOLD),o===0&&(o=this.fsSelectionValues.REGULAR)),(!n.panose||!Array.isArray(n.panose))&&(n.panose=[0,0,0,0,0,0,0,0,0]),this.tables=Object.assign(n.tables,{os2:Object.assign({usWeightClass:n.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:n.widthClass||this.usWidthClasses.MEDIUM,bFamilyType:n.panose[0]||0,bSerifStyle:n.panose[1]||0,bWeight:n.panose[2]||0,bProportion:n.panose[3]||0,bContrast:n.panose[4]||0,bStrokeVariation:n.panose[5]||0,bArmStyle:n.panose[6]||0,bLetterform:n.panose[7]||0,bMidline:n.panose[8]||0,bXHeight:n.panose[9]||0,fsSelection:o},n.tables.os2)})}this.supported=!0,this.glyphs=new yn.GlyphSet(this,n.glyphs||[]),this.encoding=new Kn(this),this.position=new _s(this),this.substitution=new vu(this),this.tables=this.tables||{},this.tables=new Proxy(this.tables,{set:(o,l,d)=>(o[l]=d,o.fvar&&(o.gvar||o.cff2)&&!this.variation&&(this.variation=new gh(this)),!0)}),this.palettes=new ec(this),this.layers=new wu(this),this.svgImages=new Au(this),this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:this.outlinesFormat==="truetype"?this._hinting=new l4(this):null}})}Rn.prototype.hasChar=function(n){return this.encoding.charToGlyphIndex(n)>0},Rn.prototype.charToGlyphIndex=function(n){return this.encoding.charToGlyphIndex(n)},Rn.prototype.charToGlyph=function(n){let o=this.charToGlyphIndex(n),l=this.glyphs.get(o);return l||(l=this.glyphs.get(0)),l},Rn.prototype.updateFeatures=function(n){return this.defaultRenderOptions.features.map(o=>o.script==="latn"?{script:"latn",tags:o.tags.filter(l=>n[l])}:o)},Rn.prototype.stringToGlyphIndexes=function(n,o){let l=new my,d=m=>this.charToGlyphIndex(m.char);l.registerModifier("glyphIndex",null,d);let h=o?this.updateFeatures(o.features):this.defaultRenderOptions.features;return l.applyFeatures(this,h),l.getTextGlyphs(n)},Rn.prototype.stringToGlyphs=function(n,o){let l=this.stringToGlyphIndexes(n,o),d=l.length,h=new Array(d),m=this.glyphs.get(0);for(let y=0;y<d;y+=1)h[y]=this.glyphs.get(l[y])||m;return h},Rn.prototype.nameToGlyphIndex=function(n){return this.glyphNames.nameToGlyphIndex(n)},Rn.prototype.nameToGlyph=function(n){let o=this.nameToGlyphIndex(n),l=this.glyphs.get(o);return l||(l=this.glyphs.get(0)),l},Rn.prototype.glyphIndexToName=function(n){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(n):""},Rn.prototype.getKerningValue=function(n,o){n=n.index||n,o=o.index||o;let l=this.position.defaultKerningTables;return l?this.position.getKerningValue(l,n,o):this.kerningPairs[n+","+o]||0},Rn.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},Rn.prototype.forEachGlyph=function(n,o,l,d,h,m){o=o!==void 0?o: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,T=this.stringToGlyphs(n,h),_;if(h.kerning){let R=h.script||this.position.getDefaultScriptName();_=this.position.getKerningTables(R,h.language)}for(let R=0;R<T.length;R+=1){let E=T[R];if(m.call(this,E,o,l,d,h),E.advanceWidth&&(o+=E.advanceWidth*y),h.kerning&&R<T.length-1){let H=_?this.position.getKerningValue(_,E.index,T[R+1].index):this.getKerningValue(E,T[R+1]);o+=H*y}h.letterSpacing?o+=h.letterSpacing*d:h.tracking&&(o+=h.tracking/1e3*d)}return o},Rn.prototype.getPath=function(n,o,l,d,h){h=Object.assign({},this.defaultRenderOptions,h);let m=new $e;if(m._layers=[],en(this,m,d),m.stroke){let y=1/(m.unitsPerEm||1e3)*d;m.strokeWidth*=y}return this.forEachGlyph(n,o,l,d,h,(y,T,_,R)=>{let E=y.getPath(T,_,R,h,this);if(h.drawSVG||h.drawLayers){let H=E._layers;if(H&&H.length){for(let z=0;z<H.length;z++){let se=H[z];m._layers.push(se)}return}}m.extend(E)}),m},Rn.prototype.getPaths=function(n,o,l,d,h){h=Object.assign({},this.defaultRenderOptions,h);let m=[];return this.forEachGlyph(n,o,l,d,h,function(y,T,_,R){let E=y.getPath(T,_,R,h,this);m.push(E)}),m},Rn.prototype.getAdvanceWidth=function(n,o,l){return l=Object.assign({},this.defaultRenderOptions,l),this.forEachGlyph(n,0,0,o,l,function(){})},Rn.prototype.draw=function(n,o,l,d,h,m){this.getPath(o,l,d,h,m).draw(n)},Rn.prototype.drawPoints=function(n,o,l,d,h,m){m=Object.assign({},this.defaultRenderOptions,m),this.forEachGlyph(o,l,d,h,m,function(y,T,_,R){y.drawPoints(n,T,_,R,m,this)})},Rn.prototype.drawMetrics=function(n,o,l,d,h,m){m=Object.assign({},this.defaultRenderOptions,m),this.forEachGlyph(o,l,d,h,m,function(y,T,_,R){y.drawMetrics(n,T,_,R)})},Rn.prototype.getEnglishName=function(n){let o=(this.names.unicode||this.names.macintosh||this.names.windows)[n];if(o)return o.en},Rn.prototype.validate=function(){let n=[],o=this;function l(h,m){h||(console.warn(`[opentype.js] ${m}`),n.push(m))}function d(h){let m=o.getEnglishName(h);l(m&&m.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,m=-1;for(let y=0;y<h.length;y++){let T=h[y].glyphID;if(l(m<h[y].glyphID,`baseGlyphs must be sorted by GlyphID in ascending order, but glyphID ${T} comes after ${m}`),m>h[y].glyphID)break;m=T}}return n},Rn.prototype.toTables=function(){return hr.fontToTable(this)},Rn.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},Rn.prototype.toArrayBuffer=function(){let n=this.toTables().encode(),o=new ArrayBuffer(n.length),l=new Uint8Array(o);for(let d=0;d<n.length;d++)l[d]=n[d];return o},Rn.prototype.download=function(){console.error("DEPRECATED: platform-specific actions are to be implemented on user-side")},Rn.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},Rn.prototype.macStyleValues={BOLD:1,ITALIC:2,UNDERLINE:4,OUTLINED:8,SHADOW:16,CONDENSED:32,EXTENDED:64},Rn.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},Rn.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};var F1=Rn;function gy(n,o){let l=new it.Parser(n,o),d=l.parseUShort(),h=l.parseUShort();d!==1&&console.warn(`Unsupported hvar table version ${d}.${h}`);let m=[d,h],y=l.parsePointer32(function(){return this.parseItemVariationStore()}),T=l.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),_=l.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),R=l.parsePointer32(function(){return this.parseDeltaSetIndexMap()});return{version:m,itemVariationStore:y,advanceWidth:T,lsb:_,rsb:R}}function xy(){console.warn("Writing of hvar tables is not yet supported.")}var by={make:xy,parse:gy},yy=function(){return{coverage:this.parsePointer(ae.coverage),attachPoints:this.parseList(ae.pointer(ae.uShortList))}},vy=function(){var n=this.parseUShort();if(K.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()}},wy=function(){return this.parseList(ae.pointer(vy))},Ay=function(){return{coverage:this.parsePointer(ae.coverage),ligGlyphs:this.parseList(ae.pointer(wy))}},Ty=function(){return this.parseUShort(),this.parseList(ae.pointer(ae.coverage))};function Cy(n,o){o=o||0;let l=new ae(n,o),d=l.parseVersion(1);K.argument(d===1||d===1.2||d===1.3,"Unsupported GDEF table version.");var h={version:d,classDef:l.parsePointer(ae.classDef),attachList:l.parsePointer(yy),ligCaretList:l.parsePointer(Ay),markAttachClassDef:l.parsePointer(ae.classDef)};return d>=1.2&&(h.markGlyphSets=l.parsePointer(Ty)),h}var Sy={parse:Cy},Yo=new Array(10);Yo[1]=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();if(o===1)return{posFormat:1,coverage:this.parsePointer(ae.coverage),value:this.parseValueRecord()};if(o===2)return{posFormat:2,coverage:this.parsePointer(ae.coverage),values:this.parseValueRecordList()};K.assert(!1,"0x"+n.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},Yo[2]=function(){let n=this.offset+this.relativeOffset,o=this.parseUShort();K.assert(o===1||o===2,"0x"+n.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");let l=this.parsePointer(ae.coverage),d=this.parseUShort(),h=this.parseUShort();if(o===1)return{posFormat:o,coverage:l,valueFormat1:d,valueFormat2:h,pairSets:this.parseList(ae.pointer(ae.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(d),value2:this.parseValueRecord(h)}})))};if(o===2){let m=this.parsePointer(ae.classDef),y=this.parsePointer(ae.classDef),T=this.parseUShort(),_=this.parseUShort();return{posFormat:o,coverage:l,valueFormat1:d,valueFormat2:h,classDef1:m,classDef2:y,class1Count:T,class2Count:_,classRecords:this.parseList(T,ae.list(_,function(){return{value1:this.parseValueRecord(d),value2:this.parseValueRecord(h)}}))}}},Yo[3]=function(){return{error:"GPOS Lookup 3 not supported"}},Yo[4]=function(){return{error:"GPOS Lookup 4 not supported"}},Yo[5]=function(){return{error:"GPOS Lookup 5 not supported"}},Yo[6]=function(){return{error:"GPOS Lookup 6 not supported"}},Yo[7]=function(){return{error:"GPOS Lookup 7 not supported"}},Yo[8]=function(){return{error:"GPOS Lookup 8 not supported"}},Yo[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function _y(n,o){o=o||0;let l=new ae(n,o),d=l.parseVersion(1);return K.argument(d===1||d===1.1,"Unsupported GPOS table version "+d),d===1?{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(Yo)}:{version:d,scripts:l.parseScriptList(),features:l.parseFeatureList(),lookups:l.parseLookupList(Yo),variations:l.parseFeatureVariationsList()}}var Ly=new Array(10);function ky(n){return new ke.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new ke.ScriptList(n.scripts)},{name:"features",type:"TABLE",value:new ke.FeatureList(n.features)},{name:"lookups",type:"TABLE",value:new ke.LookupList(n.lookups,Ly)}])}var Iy={parse:_y,make:ky};function Ey(n){let o={};n.skip("uShort");let l=n.parseUShort();K.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 m=n.parseUShort(),y=n.parseUShort(),T=n.parseShort();o[m+","+y]=T}return o}function My(n){let o={};n.skip("uShort"),n.parseULong()>1&&console.warn("Only the first kern subtable is supported."),n.skip("uLong");let l=n.parseUShort()&255;if(n.skip("uShort"),l===0){let d=n.parseUShort();n.skip("uShort",3);for(let h=0;h<d;h+=1){let m=n.parseUShort(),y=n.parseUShort(),T=n.parseShort();o[m+","+y]=T}}return o}function Ry(n,o){let l=new it.Parser(n,o),d=l.parseUShort();if(d===0)return Ey(l);if(d===1)return My(l);throw new Error("Unsupported kern table version ("+d+").")}var Ny={parse:Ry};function Dy(n,o,l,d){let h=new it.Parser(n,o),m=d?h.parseUShort:h.parseULong,y=[];for(let T=0;T<l+1;T+=1){let _=m.call(h);d&&(_*=2),y.push(_)}return y}var Qy={parse:Dy};function U1(n,o){let l=[],d=12;for(let h=0;h<o;h+=1){let m=it.getTag(n,d),y=it.getULong(n,d+4),T=it.getULong(n,d+8),_=it.getULong(n,d+12);l.push({tag:m,checksum:y,offset:T,length:_,compression:!1}),d+=16}return l}function By(n,o){let l=[],d=44;for(let h=0;h<o;h+=1){let m=it.getTag(n,d),y=it.getULong(n,d+4),T=it.getULong(n,d+8),_=it.getULong(n,d+12),R;T<_?R="WOFF":R=!1,l.push({tag:m,offset:y,compression:R,compressedLength:T,length:_}),d+=20}return l}function bn(n,o){if(o.compression==="WOFF"){let l=new Uint8Array(n.buffer,o.offset+2,o.compressedLength-2),d=new Uint8Array(o.length);if(oe(l,d),d.byteLength!==o.length)throw new Error("Decompression error: "+o.tag+" decompressed length doesn't match recorded length");return{data:new DataView(d.buffer,0),offset:0}}else return{data:n,offset:o.offset}}function jy(n,o={}){let l,d,h=new F1({empty:!0});n.constructor!==ArrayBuffer&&(n=new Uint8Array(n).buffer);let m=new DataView(n,0),y,T=[],_=it.getTag(m,0);if(_==="\0\0\0"||_==="true"||_==="typ1")h.outlinesFormat="truetype",y=it.getUShort(m,4),T=U1(m,y);else if(_==="OTTO")h.outlinesFormat="cff",y=it.getUShort(m,4),T=U1(m,y);else if(_==="wOFF"){let tr=it.getTag(m,4);if(tr==="\0\0\0")h.outlinesFormat="truetype";else if(tr==="OTTO")h.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+_);y=it.getUShort(m,12),T=By(m,y)}else if(_==="wOF2"){let tr="https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025";throw new Error("WOFF2 require an external decompressor library, see examples at: "+tr)}else throw new Error("Unsupported OpenType signature "+_);let R,E,H,z,se,X,ue,Ze,er,qt,fr,Er,Cn,jn,Pn,Ds,Ko,Mr;for(let tr=0;tr<y;tr+=1){let Ut=T[tr],Wt;switch(Ut.tag){case"avar":ue=Ut;break;case"cmap":Wt=bn(m,Ut),h.tables.cmap=Dn.parse(Wt.data,Wt.offset),h.encoding=new hs(h.tables.cmap);break;case"cvt ":Wt=bn(m,Ut),Mr=new it.Parser(Wt.data,Wt.offset),h.tables.cvt=Mr.parseShortList(Ut.length/2);break;case"fvar":H=Ut;break;case"STAT":z=Ut;break;case"gvar":se=Ut;break;case"cvar":X=Ut;break;case"fpgm":Wt=bn(m,Ut),Mr=new it.Parser(Wt.data,Wt.offset),h.tables.fpgm=Mr.parseByteList(Ut.length);break;case"head":Wt=bn(m,Ut),h.tables.head=fs.parse(Wt.data,Wt.offset),h.unitsPerEm=h.tables.head.unitsPerEm,l=h.tables.head.indexToLocFormat;break;case"hhea":Wt=bn(m,Ut),h.tables.hhea=ca.parse(Wt.data,Wt.offset),h.ascender=h.tables.hhea.ascender,h.descender=h.tables.hhea.descender,h.numberOfHMetrics=h.tables.hhea.numberOfHMetrics;break;case"HVAR":Cn=Ut;break;case"hmtx":Er=Ut;break;case"ltag":Wt=bn(m,Ut),d=Go.parse(Wt.data,Wt.offset);break;case"COLR":Wt=bn(m,Ut),h.tables.colr=Pe.parse(Wt.data,Wt.offset);break;case"CPAL":Wt=bn(m,Ut),h.tables.cpal=Ir.parse(Wt.data,Wt.offset);break;case"maxp":Wt=bn(m,Ut),h.tables.maxp=Vo.parse(Wt.data,Wt.offset),h.numGlyphs=h.tables.maxp.numGlyphs;break;case"name":Ds=Ut;break;case"OS/2":Wt=bn(m,Ut),h.tables.os2=ao.parse(Wt.data,Wt.offset);break;case"post":Wt=bn(m,Ut),h.tables.post=Xa.parse(Wt.data,Wt.offset),h.glyphNames=new mn(h.tables.post);break;case"prep":Wt=bn(m,Ut),Mr=new it.Parser(Wt.data,Wt.offset),h.tables.prep=Mr.parseByteList(Ut.length);break;case"glyf":Ze=Ut;break;case"loca":Pn=Ut;break;case"CFF ":R=Ut;break;case"CFF2":E=Ut;break;case"kern":jn=Ut;break;case"GDEF":er=Ut;break;case"GPOS":qt=Ut;break;case"GSUB":fr=Ut;break;case"meta":Ko=Ut;break;case"gasp":try{Wt=bn(m,Ut),h.tables.gasp=W.parse(Wt.data,Wt.offset)}catch(ki){console.warn("Failed to parse gasp table, skipping."),console.warn(ki)}break;case"SVG ":Wt=bn(m,Ut),h.tables.svg=st.parse(Wt.data,Wt.offset);break;default:break}}let fo=bn(m,Ds);if(h.tables.name=At.parse(fo.data,fo.offset,d),h.names=h.tables.name,Ze&&Pn){let tr=l===0,Ut=bn(m,Pn),Wt=Qy.parse(Ut.data,Ut.offset,h.numGlyphs,tr),ki=bn(m,Ze);h.glyphs=Su.parse(ki.data,ki.offset,Wt,h,o)}else if(R){let tr=bn(m,R);Zs.parse(tr.data,tr.offset,h,o)}else if(E){let tr=bn(m,E);Zs.parse(tr.data,tr.offset,h,o)}else throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");let Pi=bn(m,Er);if(Ra.parse(h,Pi.data,Pi.offset,h.numberOfHMetrics,h.numGlyphs,h.glyphs,o),Ne(h,o),jn){let tr=bn(m,jn);h.kerningPairs=Ny.parse(tr.data,tr.offset)}else h.kerningPairs={};if(er){let tr=bn(m,er);h.tables.gdef=Sy.parse(tr.data,tr.offset)}if(qt){let tr=bn(m,qt);h.tables.gpos=Iy.parse(tr.data,tr.offset),h.position.init()}if(fr){let tr=bn(m,fr);h.tables.gsub=qo.parse(tr.data,tr.offset)}if(H){let tr=bn(m,H);h.tables.fvar=on.parse(tr.data,tr.offset,h.names)}if(z){let tr=bn(m,z);h.tables.stat=_l.parse(tr.data,tr.offset,h.tables.fvar)}if(se){H||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 tr=bn(m,se);h.tables.gvar=L.parse(tr.data,tr.offset,h.tables.fvar,h.glyphs)}if(X){H||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 tr=bn(m,X);h.tables.cvar=Xi.parse(tr.data,tr.offset,h.tables.fvar,h.tables.cvt||[])}if(ue){H||console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");let tr=bn(m,ue);h.tables.avar=Na.parse(tr.data,tr.offset,h.tables.fvar)}if(Cn){H||console.warn("This font provides an HVAR table, but no fvar table, which is required for variable fonts."),Er||console.warn("This font provides an HVAR table, but no hmtx table to vary.");let tr=bn(m,Cn);h.tables.hvar=by.parse(tr.data,tr.offset,h.tables.fvar)}if(Ko){let tr=bn(m,Ko);h.tables.meta=fi.parse(tr.data,tr.offset),h.metas=h.tables.meta}return h.palettes=new ec(h),h}function Py(){console.error("DEPRECATED! migrate to: opentype.parse(buffer, opt) See: https://github.com/opentypejs/opentype.js/issues/675")}function Oy(){console.error('DEPRECATED! migrate to: opentype.parse(require("fs").readFileSync(url), opt)')}return g(x)})();(function(s,i){typeof define=="function"&&define.amd?define(i):typeof t=="object"&&t.exports?t.exports=i():s.opentype=i()})(typeof self<"u"?self:e,()=>({...r,default:r}))}),PT=BT(jT()),vi=k0("lru-cache:metrics"),Uc=LT("lru-cache"),OT=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Gh=()=>vi.hasSubscribers||Uc.hasSubscribers,Rx=new Set,qm=typeof process=="object"&&process?process:{},FT=(e,t,r,s)=>{typeof qm.emitWarning=="function"?qm.emitWarning(e,t,r,s):console.error(`[${r}] ${t}: ${e}`)},UT=e=>!Rx.has(e),vl=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),Nx=e=>vl(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?xd:null:null,xd=class extends Array{constructor(e){super(e),this.fill(0)}},jl,gc,$T=(jl=class{constructor(e,t){if(Hs(this,"heap"),Hs(this,"length"),!V(jl,gc))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[];cr(jl,gc,!0);let r=new jl(e,t);return cr(jl,gc,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},gc=new WeakMap,Zr(jl,gc,!1),jl),Zm,Ym,ea,Io,ga,x0,xa,xc,bc,ba,ei,Eo,zs,ls,Tr,ro,Mo,$i,gi,ya,xi,va,wa,Ro,No,Aa,yc,no,b0,kt,Vh,y0,pl,$u,Do,Km,v0,vc,zu,ml,gl,qh,w0,Hu,Xm,Jm,Wu,qn,Zh,eg,tg,wc,Yh,Ac,xl,Kh,Xh,zT=(Xh=class{constructor(e){Zr(this,kt),Zr(this,ea),Zr(this,Io),Zr(this,ga),Zr(this,x0),Zr(this,xa),Zr(this,xc),Zr(this,bc),Zr(this,ba),Hs(this,"ttl"),Hs(this,"ttlResolution"),Hs(this,"ttlAutopurge"),Hs(this,"updateAgeOnGet"),Hs(this,"updateAgeOnHas"),Hs(this,"allowStale"),Hs(this,"noDisposeOnSet"),Hs(this,"noUpdateTTL"),Hs(this,"maxEntrySize"),Hs(this,"sizeCalculation"),Hs(this,"noDeleteOnFetchRejection"),Hs(this,"noDeleteOnStaleGet"),Hs(this,"allowStaleOnFetchAbort"),Hs(this,"allowStaleOnFetchRejection"),Hs(this,"ignoreFetchAbort"),Hs(this,"backgroundFetchSize"),Zr(this,ei),Zr(this,Eo),Zr(this,zs),Zr(this,ls),Zr(this,Tr),Zr(this,ro),Zr(this,Mo),Zr(this,$i),Zr(this,gi),Zr(this,ya),Zr(this,xi),Zr(this,va),Zr(this,wa),Zr(this,Ro),Zr(this,No),Zr(this,Aa),Zr(this,yc),Zr(this,no),Zr(this,b0),Zr(this,y0,()=>{}),Zr(this,pl,()=>{}),Zr(this,$u,()=>{}),Zr(this,Do,()=>!1),Zr(this,v0,be=>{}),Zr(this,vc,(be,Ae,Ke)=>{}),Zr(this,zu,(be,Ae,Ke,qe)=>{if(Ke||qe)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0}),Hs(this,Zm,"LRUCache");let{max:t=0,ttl:r,ttlResolution:s=1,ttlAutopurge:i,updateAgeOnGet:c,updateAgeOnHas:u,allowStale:f,dispose:p,onInsert:g,disposeAfter:x,noDisposeOnSet:b,noUpdateTTL:v,maxSize:w=0,maxEntrySize:k=0,sizeCalculation:I,fetchMethod:N,memoMethod:M,noDeleteOnFetchRejection:D,noDeleteOnStaleGet:F,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:G,ignoreFetchAbort:U,backgroundFetchSize:q=1,perf:pe}=e;if(this.backgroundFetchSize=q,pe!==void 0&&typeof pe?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(cr(this,ba,pe??OT),t!==0&&!vl(t))throw new TypeError("max option must be a nonnegative integer");let Ue=t?Nx(t):Array;if(!Ue)throw new Error("invalid max value: "+t);if(cr(this,ea,t),cr(this,Io,w),this.maxEntrySize=k||V(this,Io),this.sizeCalculation=I,this.sizeCalculation){if(!V(this,Io)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(M!==void 0&&typeof M!="function")throw new TypeError("memoMethod must be a function if defined");if(cr(this,bc,M),N!==void 0&&typeof N!="function")throw new TypeError("fetchMethod must be a function if specified");if(cr(this,xc,N),cr(this,yc,!!N),cr(this,zs,new Map),cr(this,ls,Array.from({length:t}).fill(void 0)),cr(this,Tr,Array.from({length:t}).fill(void 0)),cr(this,ro,new Ue(t)),cr(this,Mo,new Ue(t)),cr(this,$i,0),cr(this,gi,0),cr(this,ya,$T.create(t)),cr(this,ei,0),cr(this,Eo,0),typeof p=="function"&&cr(this,ga,p),typeof g=="function"&&cr(this,x0,g),typeof x=="function"?(cr(this,xa,x),cr(this,xi,[])):(cr(this,xa,void 0),cr(this,xi,void 0)),cr(this,Aa,!!V(this,ga)),cr(this,b0,!!V(this,x0)),cr(this,no,!!V(this,xa)),this.noDisposeOnSet=!!b,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!D,this.allowStaleOnFetchRejection=!!Z,this.allowStaleOnFetchAbort=!!G,this.ignoreFetchAbort=!!U,this.maxEntrySize!==0){if(V(this,Io)!==0&&!vl(V(this,Io)))throw new TypeError("maxSize must be a positive integer if specified");if(!vl(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Rt(this,kt,Km).call(this)}if(this.allowStale=!!f,this.noDeleteOnStaleGet=!!F,this.updateAgeOnGet=!!c,this.updateAgeOnHas=!!u,this.ttlResolution=vl(s)||s===0?s:1,this.ttlAutopurge=!!i,this.ttl=r||0,this.ttl){if(!vl(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Rt(this,kt,Vh).call(this)}if(V(this,ea)===0&&this.ttl===0&&V(this,Io)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!V(this,ea)&&!V(this,Io)){let be="LRU_CACHE_UNBOUNDED";UT(be)&&(Rx.add(be),FT("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",be,Xh))}}get perf(){return V(this,ba)}static unsafeExposeInternals(e){return{starts:V(e,wa),ttls:V(e,Ro),autopurgeTimers:V(e,No),sizes:V(e,va),keyMap:V(e,zs),keyList:V(e,ls),valList:V(e,Tr),next:V(e,ro),prev:V(e,Mo),get head(){return V(e,$i)},get tail(){return V(e,gi)},free:V(e,ya),isBackgroundFetch:t=>{var r;return Rt(r=e,kt,qn).call(r,t)},backgroundFetch:(t,r,s,i)=>{var c;return Rt(c=e,kt,Wu).call(c,t,r,s,i)},moveToTail:t=>{var r;return Rt(r=e,kt,Ac).call(r,t)},indexes:t=>{var r;return Rt(r=e,kt,ml).call(r,t)},rindexes:t=>{var r;return Rt(r=e,kt,gl).call(r,t)},isStale:t=>{var r;return V(r=e,Do).call(r,t)}}}get max(){return V(this,ea)}get maxSize(){return V(this,Io)}get calculatedSize(){return V(this,Eo)}get size(){return V(this,ei)}get fetchMethod(){return V(this,xc)}get memoMethod(){return V(this,bc)}get dispose(){return V(this,ga)}get onInsert(){return V(this,x0)}get disposeAfter(){return V(this,xa)}getRemainingTTL(e){return V(this,zs).has(e)?1/0:0}*entries(){for(let e of Rt(this,kt,ml).call(this))V(this,Tr)[e]!==void 0&&V(this,ls)[e]!==void 0&&!Rt(this,kt,qn).call(this,V(this,Tr)[e])&&(yield[V(this,ls)[e],V(this,Tr)[e]])}*rentries(){for(let e of Rt(this,kt,gl).call(this))V(this,Tr)[e]!==void 0&&V(this,ls)[e]!==void 0&&!Rt(this,kt,qn).call(this,V(this,Tr)[e])&&(yield[V(this,ls)[e],V(this,Tr)[e]])}*keys(){for(let e of Rt(this,kt,ml).call(this)){let t=V(this,ls)[e];t!==void 0&&!Rt(this,kt,qn).call(this,V(this,Tr)[e])&&(yield t)}}*rkeys(){for(let e of Rt(this,kt,gl).call(this)){let t=V(this,ls)[e];t!==void 0&&!Rt(this,kt,qn).call(this,V(this,Tr)[e])&&(yield t)}}*values(){for(let e of Rt(this,kt,ml).call(this))V(this,Tr)[e]!==void 0&&!Rt(this,kt,qn).call(this,V(this,Tr)[e])&&(yield V(this,Tr)[e])}*rvalues(){for(let e of Rt(this,kt,gl).call(this))V(this,Tr)[e]!==void 0&&!Rt(this,kt,qn).call(this,V(this,Tr)[e])&&(yield V(this,Tr)[e])}[(Ym=Symbol.iterator,Zm=Symbol.toStringTag,Ym)](){return this.entries()}find(e,t={}){for(let r of Rt(this,kt,ml).call(this)){let s=V(this,Tr)[r],i=Rt(this,kt,qn).call(this,s)?s.__staleWhileFetching:s;if(i!==void 0&&e(i,V(this,ls)[r],this))return Rt(this,kt,wc).call(this,V(this,ls)[r],t)}}forEach(e,t=this){for(let r of Rt(this,kt,ml).call(this)){let s=V(this,Tr)[r],i=Rt(this,kt,qn).call(this,s)?s.__staleWhileFetching:s;i!==void 0&&e.call(t,i,V(this,ls)[r],this)}}rforEach(e,t=this){for(let r of Rt(this,kt,gl).call(this)){let s=V(this,Tr)[r],i=Rt(this,kt,qn).call(this,s)?s.__staleWhileFetching:s;i!==void 0&&e.call(t,i,V(this,ls)[r],this)}}purgeStale(){let e=!1;for(let t of Rt(this,kt,gl).call(this,{allowStale:!0}))V(this,Do).call(this,t)&&(Rt(this,kt,xl).call(this,V(this,ls)[t],"expire"),e=!0);return e}info(e){let t=V(this,zs).get(e);if(t===void 0)return;let r=V(this,Tr)[t],s=Rt(this,kt,qn).call(this,r)?r.__staleWhileFetching:r;if(s===void 0)return;let i={value:s};if(V(this,Ro)&&V(this,wa)){let c=V(this,Ro)[t],u=V(this,wa)[t];if(c&&u){let f=c-(V(this,ba).now()-u);i.ttl=f,i.start=Date.now()}}return V(this,va)&&(i.size=V(this,va)[t]),i}dump(){let e=[];for(let t of Rt(this,kt,ml).call(this,{allowStale:!0})){let r=V(this,ls)[t],s=V(this,Tr)[t],i=Rt(this,kt,qn).call(this,s)?s.__staleWhileFetching:s;if(i===void 0||r===void 0)continue;let c={value:i};if(V(this,Ro)&&V(this,wa)){c.ttl=V(this,Ro)[t];let u=V(this,ba).now()-V(this,wa)[t];c.start=Math.floor(Date.now()-u)}V(this,va)&&(c.size=V(this,va)[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=V(this,ba).now()-s}Rt(this,kt,w0).call(this,t,r.value,r)}}set(e,t,r={}){let{status:s=vi.hasSubscribers?{}:void 0}=r;r.status=s,s&&(s.op="set",s.key=e,t!==void 0&&(s.value=t),s.cache=this);let i=Rt(this,kt,w0).call(this,e,t,r);return s&&vi.hasSubscribers&&vi.publish(s),i}pop(){var e;try{for(;V(this,ei);){let t=V(this,Tr)[V(this,$i)];if(Rt(this,kt,Hu).call(this,!0),Rt(this,kt,qn).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(V(this,no)&&V(this,xi)){let t=V(this,xi),r;for(;r=t?.shift();)(e=V(this,xa))==null||e.call(this,...r)}}}has(e,t={}){let{status:r=vi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="has",r.key=e,r.cache=this);let s=Rt(this,kt,Xm).call(this,e,t);return vi.hasSubscribers&&vi.publish(r),s}peek(e,t={}){let{status:r=Gh()?{}:void 0}=t;r&&(r.op="peek",r.key=e,r.cache=this),t.status=r;let s=Rt(this,kt,Jm).call(this,e,t);return vi.hasSubscribers&&vi.publish(r),s}fetch(e,t={}){let r=Uc.hasSubscribers,{status:s=Gh()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let i=Rt(this,kt,Zh).call(this,e,t);return s&&r&&(s.trace=!0,Uc.tracePromise(()=>i,s).catch(()=>{})),i}forceFetch(e,t={}){let r=Uc.hasSubscribers,{status:s=Gh()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let i=Rt(this,kt,eg).call(this,e,t);return s&&r&&(s.trace=!0,Uc.tracePromise(()=>i,s).catch(()=>{})),i}memo(e,t={}){let{status:r=vi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="memo",r.key=e,t.context&&(r.context=t.context),r.cache=this);let s=Rt(this,kt,tg).call(this,e,t);return r&&(r.value=s),vi.hasSubscribers&&vi.publish(r),s}get(e,t={}){let{status:r=vi.hasSubscribers?{}:void 0}=t;t.status=r,r&&(r.op="get",r.key=e,r.cache=this);let s=Rt(this,kt,wc).call(this,e,t);return r&&(s!==void 0&&(r.value=s),vi.hasSubscribers&&vi.publish(r)),s}delete(e){return Rt(this,kt,xl).call(this,e,"delete")}clear(){return Rt(this,kt,Kh).call(this,"delete")}},ea=new WeakMap,Io=new WeakMap,ga=new WeakMap,x0=new WeakMap,xa=new WeakMap,xc=new WeakMap,bc=new WeakMap,ba=new WeakMap,ei=new WeakMap,Eo=new WeakMap,zs=new WeakMap,ls=new WeakMap,Tr=new WeakMap,ro=new WeakMap,Mo=new WeakMap,$i=new WeakMap,gi=new WeakMap,ya=new WeakMap,xi=new WeakMap,va=new WeakMap,wa=new WeakMap,Ro=new WeakMap,No=new WeakMap,Aa=new WeakMap,yc=new WeakMap,no=new WeakMap,b0=new WeakMap,kt=new WeakSet,Vh=function(){let e=new xd(V(this,ea)),t=new xd(V(this,ea));cr(this,Ro,e),cr(this,wa,t);let r=this.ttlAutopurge?Array.from({length:V(this,ea)}):void 0;cr(this,No,r),cr(this,$u,(u,f,p=V(this,ba).now())=>{t[u]=f!==0?p:0,e[u]=f,s(u,f)}),cr(this,y0,u=>{t[u]=e[u]!==0?V(this,ba).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 p=setTimeout(()=>{V(this,Do).call(this,u)&&Rt(this,kt,xl).call(this,V(this,ls)[u],"expire")},f+1);p.unref&&p.unref(),r[u]=p}}:()=>{};cr(this,pl,(u,f)=>{if(e[f]){let p=e[f],g=t[f];if(!p||!g)return;u.ttl=p,u.start=g,u.now=i||c();let x=u.now-g;u.remainingTTL=p-x}});let i=0,c=()=>{let u=V(this,ba).now();if(this.ttlResolution>0){i=u;let f=setTimeout(()=>i=0,this.ttlResolution);f.unref&&f.unref()}return u};this.getRemainingTTL=u=>{let f=V(this,zs).get(u);if(f===void 0)return 0;let p=e[f],g=t[f];if(!p||!g)return 1/0;let x=(i||c())-g;return p-x},cr(this,Do,u=>{let f=t[u],p=e[u];return!!p&&!!f&&(i||c())-f>p})},y0=new WeakMap,pl=new WeakMap,$u=new WeakMap,Do=new WeakMap,Km=function(){let e=new xd(V(this,ea));cr(this,Eo,0),cr(this,va,e),cr(this,v0,t=>{cr(this,Eo,V(this,Eo)-e[t]),e[t]=0}),cr(this,zu,(t,r,s,i)=>{if(!vl(s)){if(Rt(this,kt,qn).call(this,r))return this.backgroundFetchSize;if(i){if(typeof i!="function")throw new TypeError("sizeCalculation must be a function");if(s=i(r,t),!vl(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}),cr(this,vc,(t,r,s)=>{if(e[t]=r,V(this,Io)){let i=V(this,Io)-e[t];for(;V(this,Eo)>i;)Rt(this,kt,Hu).call(this,!0)}cr(this,Eo,V(this,Eo)+e[t]),s&&(s.entrySize=r,s.totalCalculatedSize=V(this,Eo))})},v0=new WeakMap,vc=new WeakMap,zu=new WeakMap,ml=function*({allowStale:e=this.allowStale}={}){if(V(this,ei))for(let t=V(this,gi);Rt(this,kt,qh).call(this,t)&&((e||!V(this,Do).call(this,t))&&(yield t),t!==V(this,$i));)t=V(this,Mo)[t]},gl=function*({allowStale:e=this.allowStale}={}){if(V(this,ei))for(let t=V(this,$i);Rt(this,kt,qh).call(this,t)&&((e||!V(this,Do).call(this,t))&&(yield t),t!==V(this,gi));)t=V(this,ro)[t]},qh=function(e){return e!==void 0&&V(this,zs).get(V(this,ls)[e])===e},w0=function(e,t,r,s){var i,c,u,f;let{ttl:p=this.ttl,start:g,noDisposeOnSet:x=this.noDisposeOnSet,sizeCalculation:b=this.sizeCalculation,status:v}=r,w=Rt(this,kt,qn).call(this,t);if(t===void 0)return v&&(v.set="deleted"),this.delete(e),this;let{noUpdateTTL:k=this.noUpdateTTL}=r;v&&!w&&(v.value=t);let I=V(this,zu).call(this,e,t,r.size||0,b,v);if(this.maxEntrySize&&I>this.maxEntrySize)return Rt(this,kt,xl).call(this,e,"set"),v&&(v.set="miss",v.maxEntrySizeExceeded=!0),this;let N=V(this,ei)===0?void 0:V(this,zs).get(e);if(N===void 0)N=V(this,ei)===0?V(this,gi):V(this,ya).length!==0?V(this,ya).pop():V(this,ei)===V(this,ea)?Rt(this,kt,Hu).call(this,!1):V(this,ei),V(this,ls)[N]=e,V(this,Tr)[N]=t,V(this,zs).set(e,N),V(this,ro)[V(this,gi)]=N,V(this,Mo)[N]=V(this,gi),cr(this,gi,N),Wh(this,ei)._++,V(this,vc).call(this,N,I,v),v&&(v.set="add"),k=!1,V(this,b0)&&!w&&((i=V(this,x0))==null||i.call(this,t,e,"add"));else{Rt(this,kt,Ac).call(this,N);let M=V(this,Tr)[N];if(t!==M){if(!x)if(Rt(this,kt,qn).call(this,M)){M!==s&&M.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:D}=M;D!==void 0&&D!==t&&(V(this,Aa)&&((c=V(this,ga))==null||c.call(this,D,e,"set")),V(this,no)&&V(this,xi)?.push([D,e,"set"]))}else V(this,Aa)&&((u=V(this,ga))==null||u.call(this,M,e,"set")),V(this,no)&&V(this,xi)?.push([M,e,"set"]);if(V(this,v0).call(this,N),V(this,vc).call(this,N,I,v),V(this,Tr)[N]=t,!w){let D=M&&Rt(this,kt,qn).call(this,M)?M.__staleWhileFetching:M,F=D===void 0?"add":t!==D?"replace":"update";v&&(v.set=F,D!==void 0&&(v.oldValue=D)),V(this,b0)&&this.onInsert?.(t,e,F)}}else w||(v&&(v.set="update"),V(this,b0)&&this.onInsert?.(t,e,"update"))}if(p!==0&&!V(this,Ro)&&Rt(this,kt,Vh).call(this),V(this,Ro)&&(k||V(this,$u).call(this,N,p,g),v&&V(this,pl).call(this,v,N)),!x&&V(this,no)&&V(this,xi)){let M=V(this,xi),D;for(;D=M?.shift();)(f=V(this,xa))==null||f.call(this,...D)}return this},Hu=function(e){var t;let r=V(this,$i),s=V(this,ls)[r],i=V(this,Tr)[r],c=Rt(this,kt,qn).call(this,i);c&&i.__abortController.abort(new Error("evicted"));let u=c?i.__staleWhileFetching:i;return(V(this,Aa)||V(this,no))&&u!==void 0&&(V(this,Aa)&&((t=V(this,ga))==null||t.call(this,u,s,"evict")),V(this,no)&&V(this,xi)?.push([u,s,"evict"])),V(this,v0).call(this,r),V(this,No)?.[r]&&(clearTimeout(V(this,No)[r]),V(this,No)[r]=void 0),e&&(V(this,ls)[r]=void 0,V(this,Tr)[r]=void 0,V(this,ya).push(r)),V(this,ei)===1?(cr(this,$i,cr(this,gi,0)),V(this,ya).length=0):cr(this,$i,V(this,ro)[r]),V(this,zs).delete(s),Wh(this,ei)._--,r},Xm=function(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=t,i=V(this,zs).get(e);if(i!==void 0){let c=V(this,Tr)[i];if(Rt(this,kt,qn).call(this,c)&&c.__staleWhileFetching===void 0)return!1;if(V(this,Do).call(this,i))s&&(s.has="stale",V(this,pl).call(this,s,i));else return r&&V(this,y0).call(this,i),s&&(s.has="hit",V(this,pl).call(this,s,i)),!0}else s&&(s.has="miss");return!1},Jm=function(e,t){let{status:r,allowStale:s=this.allowStale}=t,i=V(this,zs).get(e);if(i===void 0||!s&&V(this,Do).call(this,i)){r&&(r.peek=i===void 0?"miss":"stale");return}let c=V(this,Tr)[i],u=Rt(this,kt,qn).call(this,c)?c.__staleWhileFetching:c;return r&&(u!==void 0?(r.peek="hit",r.value=u):r.peek="miss"),u},Wu=function(e,t,r,s){let i=t===void 0?void 0:V(this,Tr)[t];if(Rt(this,kt,qn).call(this,i))return i;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},p=(k,I=!1)=>{let{aborted:N}=c.signal,M=r.ignoreFetchAbort&&k!==void 0,D=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&k!==void 0);if(r.status&&(N&&!I?(r.status.fetchAborted=!0,r.status.fetchError=c.signal.reason,M&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),N&&!M&&!I)return x(c.signal.reason,D);let F=v,Z=V(this,Tr)[t];return(Z===v||Z===void 0&&M&&I)&&(k===void 0?F.__staleWhileFetching!==void 0?V(this,Tr)[t]=F.__staleWhileFetching:Rt(this,kt,xl).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),Rt(this,kt,w0).call(this,e,k,f.options,F))),k},g=k=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=k),x(k,!1)),x=(k,I)=>{let{aborted:N}=c.signal,M=N&&r.allowStaleOnFetchAbort,D=M||r.allowStaleOnFetchRejection,F=D||r.noDeleteOnFetchRejection,Z=v;if(V(this,Tr)[t]===v&&(!F||!I&&Z.__staleWhileFetching===void 0?Rt(this,kt,xl).call(this,e,"fetch"):M||(V(this,Tr)[t]=Z.__staleWhileFetching)),D)return r.status&&Z.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),Z.__staleWhileFetching;if(Z.__returned===Z)throw k},b=(k,I)=>{var N;let M=(N=V(this,xc))==null?void 0:N.call(this,e,i,f);c.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(k(void 0),r.allowStaleOnFetchAbort&&(k=D=>p(D,!0)))}),M&&M instanceof Promise?M.then(D=>k(D===void 0?void 0:D),I):M!==void 0&&k(M)};r.status&&(r.status.fetchDispatched=!0);let v=new Promise(b).then(p,g),w=Object.assign(v,{__abortController:c,__staleWhileFetching:i,__returned:void 0});return t===void 0?(Rt(this,kt,w0).call(this,e,w,{...f.options,status:void 0}),t=V(this,zs).get(e)):V(this,Tr)[t]=w,w},qn=function(e){if(!V(this,yc))return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController},Zh=async function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:c=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:f=0,sizeCalculation:p=this.sizeCalculation,noUpdateTTL:g=this.noUpdateTTL,noDeleteOnFetchRejection:x=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:b=this.allowStaleOnFetchRejection,ignoreFetchAbort:v=this.ignoreFetchAbort,allowStaleOnFetchAbort:w=this.allowStaleOnFetchAbort,context:k,forceRefresh:I=!1,status:N,signal:M}=t;if(N&&(N.op="fetch",N.key=e,I&&(N.forceRefresh=!0),N.cache=this),!V(this,yc))return N&&(N.fetch="get"),Rt(this,kt,wc).call(this,e,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:i,status:N});let D={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:i,ttl:c,noDisposeOnSet:u,size:f,sizeCalculation:p,noUpdateTTL:g,noDeleteOnFetchRejection:x,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:w,ignoreFetchAbort:v,status:N,signal:M},F=V(this,zs).get(e);if(F===void 0){N&&(N.fetch="miss");let Z=Rt(this,kt,Wu).call(this,e,F,D,k);return Z.__returned=Z}else{let Z=V(this,Tr)[F];if(Rt(this,kt,qn).call(this,Z)){let pe=r&&Z.__staleWhileFetching!==void 0;return N&&(N.fetch="inflight",pe&&(N.returnedStale=!0)),pe?Z.__staleWhileFetching:Z.__returned=Z}let G=V(this,Do).call(this,F);if(!I&&!G)return N&&(N.fetch="hit"),Rt(this,kt,Ac).call(this,F),s&&V(this,y0).call(this,F),N&&V(this,pl).call(this,N,F),Z;let U=Rt(this,kt,Wu).call(this,e,F,D,k),q=U.__staleWhileFetching!==void 0&&r;return N&&(N.fetch=G?"stale":"refresh",q&&G&&(N.returnedStale=!0)),q?U.__staleWhileFetching:U.__returned=U}},eg=async function(e,t={}){let r=await Rt(this,kt,Zh).call(this,e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r},tg=function(e,t={}){let r=V(this,bc);if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,status:i,forceRefresh:c,...u}=t;i&&c&&(i.forceRefresh=!0);let f=Rt(this,kt,wc).call(this,e,u),p=c||f===void 0;if(i&&(i.memo=p?"miss":"hit",p||(i.value=f)),!p)return f;let g=r(e,f,{options:u,context:s});return i&&(i.value=g),Rt(this,kt,w0).call(this,e,g,u),g},wc=function(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:c}=t,u=V(this,zs).get(e);if(u===void 0){c&&(c.get="miss");return}let f=V(this,Tr)[u],p=Rt(this,kt,qn).call(this,f);return c&&V(this,pl).call(this,c,u),V(this,Do).call(this,u)?p?(c&&(c.get="stale-fetching"),r&&f.__staleWhileFetching!==void 0?(c&&(c.returnedStale=!0),f.__staleWhileFetching):void 0):(i||Rt(this,kt,xl).call(this,e,"expire"),c&&(c.get="stale"),r?(c&&(c.returnedStale=!0),f):void 0):(c&&(c.get=p?"fetching":"hit"),Rt(this,kt,Ac).call(this,u),s&&V(this,y0).call(this,u),p?f.__staleWhileFetching:f)},Yh=function(e,t){V(this,Mo)[t]=e,V(this,ro)[e]=t},Ac=function(e){e!==V(this,gi)&&(e===V(this,$i)?cr(this,$i,V(this,ro)[e]):Rt(this,kt,Yh).call(this,V(this,Mo)[e],V(this,ro)[e]),Rt(this,kt,Yh).call(this,V(this,gi),e),cr(this,gi,e))},xl=function(e,t){var r,s;vi.hasSubscribers&&vi.publish({op:"delete",delete:t,key:e,cache:this});let i=!1;if(V(this,ei)!==0){let c=V(this,zs).get(e);if(c!==void 0)if(V(this,No)?.[c]&&(clearTimeout(V(this,No)?.[c]),V(this,No)[c]=void 0),i=!0,V(this,ei)===1)Rt(this,kt,Kh).call(this,t);else{V(this,v0).call(this,c);let u=V(this,Tr)[c];if(Rt(this,kt,qn).call(this,u)?u.__abortController.abort(new Error("deleted")):(V(this,Aa)||V(this,no))&&(V(this,Aa)&&((r=V(this,ga))==null||r.call(this,u,e,t)),V(this,no)&&V(this,xi)?.push([u,e,t])),V(this,zs).delete(e),V(this,ls)[c]=void 0,V(this,Tr)[c]=void 0,c===V(this,gi))cr(this,gi,V(this,Mo)[c]);else if(c===V(this,$i))cr(this,$i,V(this,ro)[c]);else{let f=V(this,Mo)[c];V(this,ro)[f]=V(this,ro)[c];let p=V(this,ro)[c];V(this,Mo)[p]=V(this,Mo)[c]}Wh(this,ei)._--,V(this,ya).push(c)}}if(V(this,no)&&V(this,xi)?.length){let c=V(this,xi),u;for(;u=c?.shift();)(s=V(this,xa))==null||s.call(this,...u)}return i},Kh=function(e){var t,r;for(let s of Rt(this,kt,gl).call(this,{allowStale:!0})){let i=V(this,Tr)[s];if(Rt(this,kt,qn).call(this,i))i.__abortController.abort(new Error("deleted"));else{let c=V(this,ls)[s];V(this,Aa)&&((t=V(this,ga))==null||t.call(this,i,c,e)),V(this,no)&&V(this,xi)?.push([i,c,e])}}if(V(this,zs).clear(),V(this,Tr).fill(void 0),V(this,ls).fill(void 0),V(this,Ro)&&V(this,wa)){V(this,Ro).fill(0),V(this,wa).fill(0);for(let s of V(this,No)??[])s!==void 0&&clearTimeout(s);V(this,No)?.fill(void 0)}if(V(this,va)&&V(this,va).fill(0),cr(this,$i,0),cr(this,gi,0),V(this,ya).length=0,cr(this,Eo,0),cr(this,ei,0),V(this,no)&&V(this,xi)){let s=V(this,xi),i;for(;i=s?.shift();)(r=V(this,xa))==null||r.call(this,...i)}},Xh);function Dx(e){let t={individual:{},range:[]},r=new WeakMap;for(let s of e)Zf(t,s,r);return t}function Zf(e,t,r){for(let[s,i]of Object.entries(t.individual))if(e.individual[s])A0(e.individual[s],i,r);else{let c=!1;for(let[u,{range:f,entry:p}]of e.range.entries()){let g=Jh(Number(s),f);if(g.both!==null){c=!0,e.individual[s]=i,A0(e.individual[s],wi(p),r),e.range.splice(u,1);for(let x of g.second)Array.isArray(x)?e.range.push({range:x,entry:wi(p)}):e.individual[x]=wi(p)}}c||(e.individual[s]=i)}for(let{range:s,entry:i}of t.range){let c=[s];for(let u=0;u<e.range.length;u++){let{range:f,entry:p}=e.range[u];for(let[g,x]of c.entries())if(Array.isArray(x)){let b=HT(x,f);if(b.both===null)continue;e.range.splice(u,1),u--;let v=wi(p);Array.isArray(b.both)?e.range.push({range:b.both,entry:v}):e.individual[b.both]=v,A0(v,wi(i),r);for(let w of b.second)Array.isArray(w)?e.range.push({range:w,entry:wi(p)}):e.individual[w]=wi(p);c=b.first}else{let b=Jh(x,f);if(b.both===null)continue;e.individual[x]=wi(i),A0(e.individual[x],wi(p),r),e.range.splice(u,1),u--;for(let v of b.second)Array.isArray(v)?e.range.push({range:v,entry:wi(p)}):e.individual[v]=wi(p);c.splice(g,1,...b.first);break}}for(let u of Object.keys(e.individual))for(let[f,p]of c.entries())if(Array.isArray(p)){let g=Jh(Number(u),p);if(g.both===null)continue;A0(e.individual[u],wi(i),r),c.splice(f,1,...g.second);break}else if(Number(u)===p){A0(e.individual[u],wi(i),r);break}for(let u of c)Array.isArray(u)?e.range.push({range:u,entry:wi(i)}):e.individual[u]=wi(i)}}function A0(e,t,r){let s=r.get(e);s?.has(t)||(s||(s=new Set,r.set(e,s)),s.add(t),t.lookup&&(!e.lookup||e.lookup.index>t.lookup.index||e.lookup.index===t.lookup.index&&e.lookup.subIndex>t.lookup.subIndex)&&(e.lookup=t.lookup),t.forward&&(e.forward?Zf(e.forward,t.forward,r):e.forward=t.forward),t.reverse&&(e.reverse?Zf(e.reverse,t.reverse,r):e.reverse=t.reverse))}function HT(e,t){let r={first:[],second:[],both:null};if(e[0]<t[1]&&t[0]<e[1]){let s=Math.max(e[0],t[0]),i=Math.min(e[1],t[1]);r.both=$l(s,i)}if(e[0]<t[0]){let s=e[0],i=Math.min(t[0],e[1]);r.first.push($l(s,i))}else if(t[0]<e[0]){let s=t[0],i=Math.min(t[1],e[0]);r.second.push($l(s,i))}if(e[1]>t[1]){let s=Math.max(e[0],t[1]),i=e[1];r.first.push($l(s,i))}else if(t[1]>e[1]){let s=Math.max(e[1],t[0]),i=t[1];r.second.push($l(s,i))}return r}function Jh(e,t){if(e<t[0]||e>t[1])return{first:[e],second:[t],both:null};let r={first:[],second:[],both:e};return t[0]<e&&r.second.push($l(t[0],e)),t[1]>e&&r.second.push($l(e+1,t[1])),r}function $l(e,t){return t-e===1?e:[e,t]}function wi(e,t=new Map){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=rg(e.forward,t)),e.reverse&&(r.reverse=rg(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 rg(e,t=new Map){let r={};for(let[s,i]of Object.entries(e.individual))r[s]=wi(i,t);return{individual:r,range:e.range.map(({range:s,entry:i})=>({range:s.slice(),entry:wi(i,t)}))}}function Yf(e,t,r,s){let i=t[s],c=e[i];if(!c)return;let u=c.lookup;if(c.reverse){let p=WT(c.reverse,t,r);(!u&&p||p&&u&&(u.index>p.index||u.index===p.index&&u.subIndex>p.subIndex))&&(u=p)}if(++s>=t.length||!c.forward)return u;let f=Yf(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 WT(e,t,r){let s=e[t[--r]],i=s&&s.lookup;for(;s&&((!i&&s.lookup||s.lookup&&i&&i.index>s.lookup.index)&&(i=s.lookup),!(--r<0||!s.reverse));)s=s.reverse[t[r]];return i}function ng(e,t,r){let s=!1;for(let i=0;i<e.length;i++){let c=e[i];if(s){if(r<=c[0])return e[i-1][1]=r,e;if(r<=c[1])return e[i-1][1]=Math.max(r,c[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(r<=c[0])return e.splice(i,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 GT(e,t){switch(e.format){case 1:let r=e.glyphs.indexOf(t);return r!==-1?r:null;case 2:let s=e.ranges.find(i=>i.start<=t&&i.end>=t);return s?s.index:null}}function 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 VT(e,t){let r=t[0],s=Kf(e,r),i=t[0]+1,c=new Map;for(;i<t[1];)Kf(e,i)!==s&&(i-r<=1?c.set(r,s):c.set([r,i],s)),i++;return i-r<=1?c.set(r,s):c.set([r,i],s),c}function Kf(e,t){let r=GT(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 Pp(e,t,r,s,i){let c=[];for(let u of r){u.entry.forward={individual:{},range:[]};for(let f of e)c.push(...th(u.entry.forward,s,i,t,f).map(({entry:p,substitution:g})=>({entry:p,substitutions:[...u.substitutions,g]})))}return c}function Jd(e,t){let r=[],s=new Set;for(let i of t){if(s.has(i.entry))continue;s.add(i.entry),i.entry.forward??={individual:{},range:[]};let c={};for(let u of e)Array.isArray(u)?i.entry.forward.range.push({entry:c,range:u}):i.entry.forward.individual[u]=c;r.push({entry:c,substitutions:i.substitutions})}return r}function eh(e,t){let r=[],s=new Set;for(let i of t){if(s.has(i.entry))continue;s.add(i.entry),i.entry.reverse??={individual:{},range:[]};let c={};for(let u of e)Array.isArray(u)?i.entry.reverse.range.push({entry:c,range:u}):i.entry.reverse.individual[u]=c;r.push({entry:c,substitutions:i.substitutions})}return r}function th(e,t,r,s,i){let c=[];if(!Array.isArray(i))e.individual[i]={},c.push({entry:e.individual[i],substitution:ZT(t,r,s,i)});else{let u=qT(t,r,s,i);for(let[f,p]of u){let g={};Array.isArray(f)?e.range.push({range:f,entry:g}):e.individual[f]={},c.push({entry:g,substitution:p})}}return c}function qT(e,t,r,s){for(let i of e.filter(c=>c.sequenceIndex===r))for(let c of t[i.lookupListIndex].subtables){let u=VT(c,s);if(!Array.from(u.values()).every(f=>f!==null))return u}return new Map([[s,null]])}function ZT(e,t,r,s){for(let i of e.filter(c=>c.sequenceIndex===r))for(let c of t[i.lookupListIndex].subtables){let u=Kf(c,s);if(u!==null)return u}return null}function YT(e,t,r){let s={individual:{},range:[]},i=Va(e.coverage);for(let{glyphId:c,index:u}of i){let f=e.chainRuleSets[u];if(f)for(let[p,g]of f.entries()){let x=th(s,g.lookupRecords,t,0,c).map(({entry:b,substitution:v})=>({entry:b,substitutions:[v]}));for(let[b,v]of g.input.entries())x=Pp([v],b+1,x,g.lookupRecords,t);for(let b of g.lookahead)x=Jd([b],x);for(let b of g.backtrack)x=eh([b],x);for(let{entry:b,substitutions:v}of x)b.lookup={substitutions:v,length:g.input.length+1,index:r,subIndex:p,contextRange:[-1*g.backtrack.length,1+g.input.length+g.lookahead.length]}}}return s}function KT(e,t){return e.format===2?Array.isArray(t)?XT(e,t):new Map([[t,Xf(e,t)]]):new Map([[t,null]])}function XT(e,t){let r=t[0],s=Xf(e,r),i=t[0]+1,c=new Map;for(;i<t[1];)Xf(e,i)!==s&&(i-r<=1?c.set(r,s):c.set([r,i],s)),i++;return i-r<=1?c.set(r,s):c.set([r,i],s),c}function Xf(e,t){for(let r of e.ranges)if(r.start<=t&&r.end>=t)return r.classId;return null}function ef(e,t){switch(e.format){case 2:let r=[];for(let s of e.ranges)s.classId===t&&(s.end===s.start?r.push(s.start):r.push([s.start,s.end+1]));return r;default:return[]}}function JT(e,t,r){let s=[],i=Va(e.coverage);for(let{glyphId:c}of i){let u=KT(e.inputClassDef,c);for(let[f,p]of u.entries()){if(p===null)continue;let g=e.chainClassSet[p];if(g)for(let[x,b]of g.entries()){let v={individual:{},range:[]},w=th(v,b.lookupRecords,t,0,f).map(({entry:k,substitution:I})=>({entry:k,substitutions:[I]}));for(let[k,I]of b.input.entries())w=Pp(ef(e.inputClassDef,I),k+1,w,b.lookupRecords,t);for(let k of b.lookahead)w=Jd(ef(e.lookaheadClassDef,k),w);for(let k of b.backtrack)w=eh(ef(e.backtrackClassDef,k),w);for(let{entry:k,substitutions:I}of w)k.lookup={substitutions:I,index:r,subIndex:x,length:b.input.length+1,contextRange:[-1*b.backtrack.length,1+b.input.length+b.lookahead.length]};s.push(v)}}}return Dx(s)}function eC(e,t,r){let s={individual:{},range:[]},i=Va(e.inputCoverage[0]);for(let{glyphId:c}of i){let u=th(s,e.lookupRecords,t,0,c).map(({entry:f,substitution:p})=>({entry:f,substitutions:[p]}));for(let[f,p]of e.inputCoverage.slice(1).entries())u=Pp(Va(p).map(g=>g.glyphId),f+1,u,e.lookupRecords,t);for(let f of e.lookaheadCoverage)u=Jd(Va(f).map(p=>p.glyphId),u);for(let f of e.backtrackCoverage)u=eh(Va(f).map(p=>p.glyphId),u);for(let{entry:f,substitutions:p}of u)f.lookup={substitutions:p,index:r,subIndex:0,length:e.inputCoverage.length,contextRange:[-1*e.backtrackCoverage.length,e.inputCoverage.length+e.lookaheadCoverage.length]}}return s}function tC(e,t){let r={individual:{},range:[]},s=Va(e.coverage);for(let{glyphId:i,index:c}of s){let u={};Array.isArray(i)?r.range.push({entry:u,range:i}):r.individual[i]=u;let f=[{entry:u,substitutions:[e.substitutes[c]]}];for(let p of e.lookaheadCoverage)f=Jd(Va(p).map(g=>g.glyphId),f);for(let p of e.backtrackCoverage)f=eh(Va(p).map(g=>g.glyphId),f);for(let{entry:p,substitutions:g}of f)p.lookup={substitutions:g,index:t,subIndex:0,length:1,contextRange:[-1*e.backtrackCoverage.length,1+e.lookaheadCoverage.length]}}return r}function Jf(e,t=new Map){let r={};for(let[s,i]of Object.entries(e.individual))r[s]=sg(i,t);for(let{range:s,entry:i}of e.range){let c=sg(i,t);for(let u=s[0];u<s[1];u++)r[u]=c}return r}function sg(e,t){if(t.has(e))return t.get(e);let r={};return t.set(e,r),e.forward&&(r.forward=Jf(e.forward,t)),e.reverse&&(r.reverse=Jf(e.reverse,t)),e.lookup&&(r.lookup=e.lookup),r}var rC=class{constructor(e,t){this._lookupTrees=[],this._glyphLookups={},this._font=e,t.cacheSize>0&&(this._cache=new zT({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||[],i=s.filter((c,u)=>r.some(f=>f===u));for(let[c,u]of i.entries()){let f=[];switch(u.lookupType){case 6:for(let[g,x]of u.subtables.entries())switch(x.substFormat){case 1:f.push(YT(x,s,g));break;case 2:f.push(JT(x,s,g));break;case 3:f.push(eC(x,s,g));break}break;case 8:for(let[g,x]of u.subtables.entries())f.push(tC(x,g));break}let p=Jf(Dx(f));this._lookupTrees.push({tree:p,processForward:u.lookupType!==8});for(let g of Object.keys(p))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()),i={inputGlyphs:r,outputGlyphs:s.sequence,contextRanges:s.ranges};return this._cache&&this._cache.set(e,i),i}findLigatureRanges(e){if(this._lookupTrees.length===0)return[];let t=this._cache&&this._cache.get(e);if(t)return Array.isArray(t)?t:t.contextRanges;let r=[];for(let i of e)r.push(this._font.charToGlyphIndex(i));let s=this._findInternal(r);return this._cache&&this._cache.set(e,s.ranges),s.ranges}_findInternal(e){let t=[],r=this._getNextLookup(e,0);for(;r.index!==null;){let s=this._lookupTrees[r.index];if(s.processForward){let i=r.last;for(let c=r.first;c<i;c++){let u=Yf(s.tree,e,c,c);if(u){for(let f=0;f<u.substitutions.length;f++){let p=u.substitutions[f];p!==null&&(e[c+f]=p)}ng(t,u.contextRange[0]+c,u.contextRange[1]+c),c+u.length>=i&&(i=c+u.length+1),c+=u.length-1}}}else for(let i=r.last-1;i>=r.first;i--){let c=Yf(s.tree,e,i,i);if(c){for(let u=0;u<c.substitutions.length;u++){let f=c.substitutions[u];f!==null&&(e[i+u]=f)}ng(t,c.contextRange[0]+i,c.contextRange[1]+i),i-=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 i=this._glyphLookups[e[s]];if(i)for(let c=0;c<i.length;c++){let u=i[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 nC(e,t){let r=PT.parse(e);return new rC(r,{cacheSize:0,...t})}function sC(e){if(typeof e!="string")throw new Error("Font family must be a string");let t={input:e,offset:0},r=[],s="";for(;t.offset<t.input.length;){let i=t.input[t.offset++];switch(i){case"'":case'"':s+=iC(t,i);break;case",":r.push(s),s="";break;default:/\s/.test(i)||(t.offset--,s+=oC(t),r.push(s),s="")}}return r}function iC(e,t){let r="",s=!1;for(;e.offset<e.input.length;){let i=e.input[e.offset++];if(s)/[\dA-Fa-f]/.test(i)?(e.offset--,r+=Qx(e)):i!==`
63
+ `&&(r+=i),s=!1;else switch(i){case t:return r;case"\\":s=!0;break;default:r+=i}}throw new Error("Unterminated string")}function oC(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+=Qx(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 Qx(e){let t="";for(;e.offset<e.input.length;){let r=e.input[e.offset++];if(/\s/.test(r))return tf(t);if(t.length>=6||!/[\dA-Fa-f]/.test(r))return e.offset--,tf(t);t+=r}return tf(t)}function tf(e){return String.fromCodePoint(parseInt(e,16))}var Tc;async function aC(e,t){if(!Tc){if(typeof navigator<"u"&&"fonts"in navigator){try{let i=await navigator.permissions.request?.({name:"local-fonts"});if(i&&i.state!=="granted")throw new Error("Permission to access local fonts not granted.")}catch(i){if(i instanceof Error&&i.name!=="TypeError")throw i}let s={};try{let i=await navigator.fonts.query();for(let c of i)s.hasOwnProperty(c.family)||(s[c.family]=[]),s[c.family].push(c);Tc=Promise.resolve(s)}catch(i){i instanceof Error&&console.error(i.name,i.message)}}else if(typeof window<"u"&&"queryLocalFonts"in window){let s={};try{let i=await window.queryLocalFonts();for(let c of i)s.hasOwnProperty(c.family)||(s[c.family]=[]),s[c.family].push(c);Tc=Promise.resolve(s)}catch(i){i instanceof Error&&console.error(i.name,i.message)}}Tc??=Promise.resolve({})}let r=await Tc;for(let s of sC(e)){if(lC.includes(s))return;if(r.hasOwnProperty(s)&&r[s].length>0){let i=r[s][0];if("blob"in i){let c=await(await i.blob()).arrayBuffer();return nC(c,{cacheSize:t})}return}}}var lC=["serif","sans-serif","cursive","fantasy","monospace","system-ui","emoji","math","fangsong"],cC=1e5;function uC(e,t=[]){let r,s,i=0,c;return e.registerCharacterJoiner(u=>{let f=e.options.fontFamily;if(f&&(i===0||r!==f)){s=void 0,i=1,r=f;let p=r;aC(p,cC).then(g=>{p===e.options.fontFamily&&(i=2,s=g,g&&e.refresh(0,e.rows-1))}).catch(g=>{p===e.options.fontFamily&&(i=3,e.options.logLevel==="debug"&&console.debug(c,new Error("Failure while loading font")),s=void 0,c=g)})}return s&&i===2?s.findLigatureRanges(u).map(p=>[p[0],p[1]]):dC(u,t)})}function dC(e,t){let r=[];for(let s=0;s<e.length;s++)for(let i=0;i<t.length;i++)if(e.startsWith(t[i],s)){r.push([s,s+t[i].length]),s+=t[i].length-1;break}return r}var hC=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=uC(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 ig(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 fC=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=ig(r[1]),i=ig(r[2]);switch(s){case 0:this.progress={state:s,value:0};break;case 1:if(i<0)return!0;this.progress={state:s,value:i};break;case 2:case 4:if(i<0)return!0;this.progress={state:s,value:i||this._pr};break;case 3:this.progress={state:s,value:this._pr};break}return!0}),this._onChange=new e._core._onData.constructor,this.onChange=this._onChange.event}get progress(){return{state:this._st,value:this._pr}}set progress(e){if(e.state<0||e.state>4){console.warn("progress state out of bounds, not applied");return}this._st=e.state,this._pr=Math.min(Math.max(e.value,0),100),this._onChange?.fire({state:this._st,value:this._pr})}};function Bx(e,t){const r=Math.max(e.left,t.left),s=Math.max(e.top,t.top),i=Math.min(e.right,t.right),c=Math.min(e.bottom,t.bottom);return i>r&&c>s?{left:r,top:s,right:i,bottom:c}:null}function og(e,t){const r=Bx(e,t);return r?(r.right-r.left)*(r.bottom-r.top):0}function ql(e){const t=e.element;if(!t||!e.cols||!e.rows)return null;const s=(t.querySelector?.(".xterm-screen")??null??t).getBoundingClientRect();if(!s.width||!s.height)return null;const i=e.dimensions?.css?.cell?.height,c=s.width/e.cols,u=i&&i>0?i:s.height/e.rows;return{originLeft:s.left,originTop:s.top,cellW:c,cellH:u}}function bd(e,t){const r=ql(e);if(!r)return null;const s=t.row-e.buffer.active.viewportY;if(s<0||s>=e.rows)return null;const i=Math.max(0,Math.min(e.cols-1,t.col));return{x:r.originLeft+(i+.5)*r.cellW,y:r.originTop+s*r.cellH}}function pC(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 Ed(e,t,r){const s=e.row*r+e.col,i=t.row*r+t.col;return s<=i?{start:e,end:t}:{start:t,end:e}}function mC(e,t,r){const s=ql(e);if(!s)return null;const{start:i,end:c}=Ed(t,r,e.cols),u=e.buffer.active.viewportY,f=u+e.rows-1;if(c.row<u||i.row>f)return null;const p=Math.max(i.row,u),g=Math.min(c.row,f),x=s.originTop+(p-u)*s.cellH,b=s.originTop+(g-u+1)*s.cellH;return i.row===c.row?{left:s.originLeft+i.col*s.cellW,top:x,right:s.originLeft+(c.col+1)*s.cellW,bottom:b}:{left:s.originLeft,top:x,right:s.originLeft+e.cols*s.cellW,bottom:b}}function gC(e){const t=Math.max(e.viewport.left,e.terminal.left),r=Math.max(e.viewport.top,e.terminal.top),s=Math.min(e.viewport.right,e.terminal.right),i=Math.min(e.viewport.bottom,e.terminal.bottom),c=t+e.margin,u=r+e.margin,f=Math.max(c,s-e.width-e.margin),p=Math.max(u,i-e.height-e.margin),g=pe=>Math.max(c,Math.min(pe,f)),x=pe=>Math.max(u,Math.min(pe,p)),b=e.selection?Bx(e.selection,{left:t,top:r,right:s,bottom:i}):null;if(!b){const pe=g(e.clientX-e.width/2),Ue=e.clientY-e.height-e.fingerGap,be=e.clientY+e.fingerGap,Ae=x(Ue>=u?Ue:be);return{left:Math.round(pe),top:Math.round(Ae)}}const v=(b.left+b.right)/2,w=(b.top+b.bottom)/2,k=e.preference?.alignX??v,I=e.selectionGap??e.fingerGap,N=b.top-e.height-I,M=b.bottom+I,D=e.preference?.vertical==="below"?M:N,F=e.preference?.vertical==="below"?N:M,Z=[{left:c,top:u},{left:f,top:u},{left:c,top:p},{left:f,top:p}];e.preference&&Z.sort((pe,Ue)=>{const be=Ae=>{const Ke=Ae.left+e.width/2,qe=Ae.top+e.height/2;return Math.hypot(Ke-e.preference.focusX,qe-e.preference.focusY)};return be(Ue)-be(pe)});const G=[{left:k-e.width/2,top:D},{left:v-e.width/2,top:D},{left:k-e.width/2,top:F},{left:v-e.width/2,top:F},{left:b.left-e.width-e.fingerGap,top:w-e.height/2},{left:b.right+e.fingerGap,top:w-e.height/2},...Z].map(pe=>({left:g(pe.left),top:x(pe.top)}));let U=G[0],q=Number.POSITIVE_INFINITY;return G.forEach((pe,Ue)=>{const be={left:pe.left,top:pe.top,right:pe.left+e.width,bottom:pe.top+e.height},Ae=(e.avoid??[]).reduce((qe,ie)=>qe+og(be,ie),0),Ke=(Ae>0?1e6:0)+Ae*100+og(be,b)*10+Ue*.01;Ke<q&&(U=pe,q=Ke)}),{left:Math.round(U.left),top:Math.round(U.top)}}function xC(e){const t=e.willChange.split(",").map(s=>s.trim()),r=(s,i)=>!!(s&&s!==i);return r(e.transform,"none")||r(e.perspective,"none")||r(e.filter,"none")||r(e.backdropFilter,"none")||r(e.containerType,"normal")||e.contain.includes("layout")||e.contain.includes("paint")||e.contain.includes("strict")||e.contain.includes("content")||t.includes("transform")||t.includes("perspective")||t.includes("filter")}function bC(e){let t=e.parentElement;for(;t;){if(xC(window.getComputedStyle(t)))return t;t=t.parentElement}return null}function yC(e,t,r,s){const i=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:i.left-c+r,y:i.top-u+s}}function vC(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 wC(e,t,r){let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];)s+=1;let i=0;const c=e.length-s,u=t.length-s;for(;i<c&&i<u&&e[e.length-1-i]===t[t.length-1-i];)i+=1;const f=t.slice(s,t.length-i);return f&&(r==="insertFromPaste"||r==="insertFromPasteAsQuotation"||/[\r\n]/.test(f))?f:null}const ag=2,AC=new Set(["mount","init-fit","resize","dpr-change","session-key-change","session-reset","tmux-layout"]);function TC(e){const t=e.reason.replace(/^refresh:/,""),r=AC.has(t),s=Math.abs(e.proposedCols-e.currentCols),i=Math.abs(e.proposedRows-e.currentRows);return{accept:r?s>0||i>0:s>=ag||i>=ag,isRealResize:r,colsDelta:s,rowsDelta:i}}function CC(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 SC(e,t){return!e||t}function _C(e,t,r){return e!=="alternate"&&r>=t}function LC(e,t){return e?"none":t?"single":"settled"}function kC(e,t,r){return!r&&(e||t)}function IC(e){let t,r,s=!1,i=0;const c=e.parser.registerCsiHandler({prefix:"?",final:"l"},f=>(t&&f.some(p=>p===2026)&&(s=!0),!1)),u=f=>{const p=t;if(!p)return;const g=r;if(t=void 0,r=void 0,s=!1,p(),f){const x=e._core?._renderService?._renderer?.value;g&&x?.handleResize(...g),x?.renderRows(0,e.rows-1),e.refresh(0,e.rows-1)}};return{begin(){if(i++,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 p=f.handleResize,g=f.renderRows,x=f.clear;f.handleResize=(b,v)=>{r=[b,v]},f.renderRows=()=>{},f.clear=()=>{},t=()=>{f.handleResize=p,f.renderRows=g,f.clear=x}},get generation(){return i},written(f){f===i&&s&&!e.modes.synchronizedOutputMode&&u(!0)},cancel(){u(!0)},dispose(){u(!1),c.dispose()}}}function rf(){return{confirmed:null,pending:null,nextSeq:1}}function lg(e,t){return e?.cols===t.cols&&e.rows===t.rows}function Op(e,t,r){const s={...t,seq:e.nextSeq,attempt:r};return{state:{...e,pending:s,nextSeq:e.nextSeq+1},request:s}}function EC(e,t){return lg(e.pending,t)||!e.pending&&lg(e.confirmed,t)?{state:e,request:null}:Op(e,t,0)}function MC(e,t){return Op(e,t,0)}function RC(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 cg(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}:{...Op(e,s,s.attempt+1),exhausted:!1}}function NC(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 DC(e){return{...e,pending:null}}const QC=150;function ug(e=0){return{lastPushAt:e}}function BC(e,t,r=QC){return t-e.lastPushAt>=r?(e.lastPushAt=t,{action:"send"}):{action:"hold",readyAt:e.lastPushAt+r}}function jC(e){return{lastPushAt:e}}const ep="termdock-settings",PC=6,OC=100,FC='"calt" on',UC=["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!==","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"];function $C(){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 Fp(){return{fontFamily:"var(--font-mono)",fontSize:$C(),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 Gu(e,t,r,s){return typeof e=="number"&&Number.isFinite(e)?Math.max(t,Math.min(r,e)):s}function dg(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 Q0(e){const t=Fp(),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:Gu(r.fontSize,PC,OC,t.fontSize),rendererMode:s==="auto"||s==="webgl"||s==="canvas"?s:t.rendererMode,fontWeight:dg(r.fontWeight,t.fontWeight),fontWeightBold:dg(r.fontWeightBold,t.fontWeightBold),letterSpacing:Math.round(Gu(r.letterSpacing,-5,10,t.letterSpacing)),lineHeight:Gu(r.lineHeight,1,2,t.lineHeight),minimumContrastRatio:Gu(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 Vu(e){return e.pointerType==="touch"||e.pointerType==="pen"}class zC{handlers=new Map;active=new Map;pointerStates=new Map;sorted=[];sortedDirty=!1;listenersRegistered=!1;changeListeners=new Set;constructor(){this.ensureListeners()}register(t){return this.handlers.has(t.name)&&this.log("replace",t.name),this.handlers.set(t.name,t),this.sortedDirty=!0,this.log("register",t.name,`prio=${t.priority}`),()=>{this.unregister(t.name)}}unregister(t){this.handlers.delete(t),this.sortedDirty=!0;for(const[r,s]of this.active)s===t&&(this.active.delete(r),this.pointerStates.delete(r));this.log("unregister",t)}getHandlers(){return this.sortedHandlers().map(t=>({name:t.name,priority:t.priority,hasContainer:t.container!=null}))}getClaimedHandler(t){return this.active.get(t)??null}isClaimedBy(t,r){return this.active.get(t)===r}isAnyPointerClaimed(){return this.active.size>0}onChange(t){return this.changeListeners.add(t),()=>{this.changeListeners.delete(t)}}emitChange(t,r,s){this.changeListeners.size!==0&&this.changeListeners.forEach(i=>{try{i({type:t,pointerId:r,handler:s})}catch{}})}log(t,r,s=""){if(typeof window<"u"&&window.__TERMDOCK_GESTURE_DEBUG__){const i=performance.now().toFixed(0);console.debug(`[GestureManager ${i}] ${t} ${r} ${s}`)}}sortedHandlers(){return this.sortedDirty&&(this.sorted=[...this.handlers.values()].sort((t,r)=>r.priority-t.priority),this.sortedDirty=!1),this.sorted}ensureListeners(){this.listenersRegistered||(this.listenersRegistered=!0,document.addEventListener("pointerdown",this.handlePointerDown,{capture:!0,passive:!1}),document.addEventListener("pointermove",this.handlePointerMove,{capture:!0,passive:!1}),document.addEventListener("pointerup",this.handlePointerUp,{capture:!0,passive:!1}),document.addEventListener("pointercancel",this.handlePointerCancel,{capture:!0,passive:!1}))}handlePointerDown=t=>{if(!Vu(t))return;const r={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,startTime:performance.now()};this.pointerStates.set(t.pointerId,r);let s=!1;for(const i of this.sortedHandlers()){if(!this.handlerMatchesContainer(i,t)){this.log("skip-container",i.name);continue}i.onPointerDown(t,r)&&!s&&(this.active.set(t.pointerId,i.name),s=!0,this.log("claim",i.name,`pid=${t.pointerId} onPointerDown`),this.emitChange("claim",t.pointerId,i.name))}s&&t.preventDefault()};handlePointerMove=t=>{if(!Vu(t)||!this.pointerStates.has(t.pointerId))return;let r=!1;for(const s of this.sortedHandlers()){if(!this.handlerMatchesContainer(s,t))continue;const i=this.active.get(t.pointerId)===s.name,c=s.onPointerMove(t,i);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"&&i&&!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(!Vu(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(!Vu(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 jx=new zC,HC=90,WC=80,GC=70,VC=(e,t)=>{const{scrollMultiplier:r=1.2,maxScrollBoost:s=.8,boostDenominator:i=50,velocityAlpha:c=.15,maxVelocity:u=15,minVelocity:f=.3,decelerationRate:p=.998,enableKinetic:g=!0,shouldCaptureTouch:x,canStartScrollGesture:b,onScroll:v,onScrollWithCoords:w,onTap:k,onClickWithCoords:I,onClaimChange:N,tapThreshold:M=10,gestureName:D="normal-scroll"}=t,F=1.06,Z=S.useRef({lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1,pointerId:null,isCurrentlyScrolling:!1,gestureAxis:null}),G=S.useRef(0),U=S.useRef(0),q=S.useRef(0),pe=S.useRef(null),Ue=S.useRef(0),be=S.useRef(!1),Ae=S.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),Ke=S.useCallback(()=>{pe.current=null,G.current!==0&&(w&&U.current>0&&q.current>0?w(G.current,U.current,q.current):v&&v(G.current),G.current=0,U.current=0,q.current=0)},[v,w]),qe=S.useCallback(()=>{pe.current===null&&typeof window<"u"&&(pe.current=window.requestAnimationFrame(Ke))},[Ke]),ie=S.useCallback((_e,$,$e)=>{G.current+=_e,$!==void 0&&$e!==void 0&&(U.current=$,q.current=$e),qe()},[qe]),Se=S.useCallback(_e=>{if(!_e||!v)return!1;const $=v(_e);return $?Ue.current=0:Ue.current++,$},[v]),tt=S.useCallback(_e=>{be.current!==_e&&(be.current=_e,N?.(_e))},[N]),Ee=S.useCallback(()=>{const _e=Z.current;_e.rafId!==null&&typeof window<"u"&&window.cancelAnimationFrame(_e.rafId),_e.rafId=null,pe.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(pe.current),pe.current=null,G.current=0},[]),oe=S.useRef(k);oe.current=k;const de=S.useRef(I);de.current=I;const Te=S.useRef(x);Te.current=x;const ee=S.useCallback(()=>{const _e=e.current;if(!_e||!("PointerEvent"in window))return()=>{};const $=Z.current,$e={name:D,priority:GC,get container(){return e.current??void 0},onPointerDown:(K,Fe)=>(K.pointerType!=="touch"||($.pointerId=K.pointerId,$.startX=Fe.startX,$.startY=Fe.startY,$.didMove=!1,$.gestureAxis=null,$.lastY=K.clientY,$.lastTime=Ae(),$.velocity=0,Ee()),!1),onPointerMove:(K,Fe)=>{if(K.pointerType!=="touch"||$.pointerId!==K.pointerId||!$.lastY||!$.lastTime)return"neutral";const fe=K.clientX,De=K.clientY,lt=Ae(),Tt=lt-$.lastTime,we=De-$.lastY;if($.startX!==null&&$.startY!==null){const Qe=fe-$.startX,gt=De-$.startY;if(!$.didMove&&Math.hypot(Qe,gt)>=M&&($.didMove=!0),$.gestureAxis===null&&$.didMove){const ft=Math.abs(Qe),ct=Math.abs(gt);ft>ct*F?$.gestureAxis="x":ct>ft*F&&($.gestureAxis="y")}if($.gestureAxis==="x")return $.isCurrentlyScrolling=!1,tt(!1),$.lastY=De,$.lastTime=lt,Fe?"release":"neutral";if($.gestureAxis===null)return $.lastY=De,$.lastTime=lt,"neutral"}if($.gestureAxis==="y"&&!Fe&&!(b?.()??!0))return $.lastY=De,$.lastTime=lt,tt(!1),"neutral";const me=we/Math.max(Tt,1);if($.velocity=$.velocity*(1-c)+me*c,$.velocity=Math.max(-u,Math.min(u,$.velocity)),Math.abs(we)>1){if(!Fe)return tt(!0),$.lastY=De,$.lastTime=lt,"claim";$.isCurrentlyScrolling=!0;const Qe=r+Math.min(s,Math.abs(we)/i),gt=-we*Qe;ie(gt,fe,De),tt(!0)}return $.lastY=De,$.lastTime=lt,Fe?"claim":"neutral"},onPointerUp:K=>{if(K.pointerType!=="touch"||$.pointerId!==K.pointerId)return;const Fe=$.isCurrentlyScrolling;$.isCurrentlyScrolling=!1,tt(!1);const fe=$.rafId!==null||pe.current!==null;!$.didMove&&!fe&&$.startX!==null&&$.startY!==null&&oe.current?.($.startX,$.startY),!$.didMove&&!fe&&$.startX!==null&&$.startY!==null&&de.current?.($.startX,$.startY),$.pointerId=null,$.startX=null,$.startY=null;const De=$.gestureAxis==="x";if($.gestureAxis=null,g&&Fe&&!De&&Math.abs($.velocity)>f&&$.didMove){const lt=()=>{const Tt=Ae(),we=Tt-($.lastTime||Tt);if($.lastTime=Tt,$.velocity*=Math.pow(p,we),Math.abs($.velocity)<f){$.velocity=0,Ee();return}if(!Se(-$.velocity*we)&&Ue.current>2){$.velocity=0,Ee();return}$.rafId=requestAnimationFrame(lt)};$.rafId=requestAnimationFrame(lt)}},onPointerCancel:K=>{K.pointerType!=="touch"||$.pointerId!==K.pointerId||($.isCurrentlyScrolling=!1,tt(!1),$.pointerId=null,$.startX=null,$.startY=null,$.gestureAxis=null,Ee())}},Xe=jx.register($e),Le=_e.style.touchAction;return _e.style.touchAction="none",()=>{tt(!1),Xe(),_e.style.touchAction=Le,Ee()}},[e,D,r,s,i,c,u,f,p,Ae,Ee,Se,ie,M,g,tt,b]),ye=S.useCallback(()=>{const _e=e.current;if(!_e)return()=>{};const $=Z.current,$e=Fe=>{Fe.touches.length===1&&((x?.()??!0)&&Fe.cancelable&&Fe.preventDefault(),$.isCurrentlyScrolling=!1,$.gestureAxis=null,$.lastY=Fe.touches[0].clientY,$.startX=Fe.touches[0].clientX,$.startY=Fe.touches[0].clientY,$.didMove=!1,$.velocity=0,Ee())},Xe=Fe=>{if(Fe.touches.length!==1)return;const fe=Fe.touches[0].clientX,De=Fe.touches[0].clientY;if($.startX!==null&&$.startY!==null){const Tt=fe-$.startX,we=De-$.startY;if(!$.didMove&&Math.hypot(Tt,we)>=M&&($.didMove=!0),$.gestureAxis===null&&$.didMove){const me=Math.abs(Tt),Qe=Math.abs(we);me>Qe*F?$.gestureAxis="x":Qe>me*F&&($.gestureAxis="y")}if($.gestureAxis==="x"){$.isCurrentlyScrolling=!1,$.lastY=De;return}if($.gestureAxis===null){(x?.()??!1)&&Fe.cancelable&&Fe.preventDefault(),$.lastY=De;return}}if(Fe.preventDefault(),!$.lastY){$.lastY=De;return}const lt=De-$.lastY;if(Math.abs(lt)>1){$.isCurrentlyScrolling=!0;const Tt=r+Math.min(s,Math.abs(lt)/i),we=-lt*Tt;ie(we,fe,De)}$.lastY=De},Le=Fe=>{if(!Fe.changedTouches?.[0])return;const De=$.isCurrentlyScrolling;$.isCurrentlyScrolling=!1;const lt=$.rafId!==null||pe.current!==null;!$.didMove&&!lt&&k&&$.startX!==null&&$.startY!==null&&k($.startX,$.startY),!$.didMove&&!lt&&I&&$.startX!==null&&$.startY!==null&&I($.startX,$.startY),$.startX=null,$.startY=null;const Tt=$.gestureAxis==="x";if($.gestureAxis=null,g&&De&&!Tt&&$.didMove&&Math.abs($.velocity)>f){const we=()=>{if($.velocity*=Math.pow(p,16),Math.abs($.velocity)<f){$.velocity=0,Ee();return}if(!Se(-$.velocity*16)&&Ue.current>2){$.velocity=0,Ee();return}$.rafId=requestAnimationFrame(we)};$.rafId=requestAnimationFrame(we)}};_e.addEventListener("touchstart",$e,{passive:!1}),_e.addEventListener("touchmove",Xe,{passive:!1}),_e.addEventListener("touchend",Le,{passive:!1}),_e.addEventListener("touchcancel",Le,{passive:!1});const K=_e.style.touchAction;return _e.style.touchAction="none",()=>{_e.removeEventListener("touchstart",$e),_e.removeEventListener("touchmove",Xe),_e.removeEventListener("touchend",Le),_e.removeEventListener("touchcancel",Le),_e.style.touchAction=K,Ee()}},[e,r,s,i,f,p,Ee,Se,ie,k,I,M,x,g]),ce=S.useCallback(()=>{Ee();const _e=typeof window<"u"&&"PointerEvent"in window,$=_e?ee():()=>{},$e=_e?()=>{}:ye();return()=>{$(),$e(),Ee()}},[ee,ye,Ee]),Ye=S.useCallback(()=>Z.current.isCurrentlyScrolling||Z.current.rafId!==null||pe.current!==null,[]),at=S.useCallback(()=>{Ee();const _e=Z.current;_e.isCurrentlyScrolling=!1,_e.velocity=0,_e.lastY=null,_e.lastTime=null,_e.startX=null,_e.startY=null,_e.pointerId=null,_e.didMove=!1,_e.gestureAxis=null},[Ee]);return{setupTouchScroll:ce,isScrolling:Ye,stopAllScroll:at}};function hg(e){const{name:t,priority:r}=e,s=A.useRef(e.onPointerDown),i=A.useRef(e.onPointerMove),c=A.useRef(e.onPointerUp),u=A.useRef(e.onPointerCancel),f=A.useRef(e.container);s.current=e.onPointerDown,i.current=e.onPointerMove,c.current=e.onPointerUp,u.current=e.onPointerCancel,f.current=e.container,A.useEffect(()=>{const p={name:t,priority:r,get container(){const x=f.current;return typeof x=="function"?x():x},onPointerDown(x,b){return s.current?.(x,b)??!1},onPointerMove(x,b){return i.current?.(x,b)??"neutral"},onPointerUp(x){c.current?.(x)},onPointerCancel(x){u.current?.(x)}};return jx.register(p)},[t,r])}var js;(function(e){e.Light="light",e.Medium="medium",e.Heavy="heavy",e.Success="success",e.Warning="warning",e.Error="error"})(js||(js={}));js.Light,js.Medium,js.Heavy,js.Success,js.Warning,js.Error;js.Light,js.Medium,js.Heavy,js.Success,js.Warning,js.Error;js.Light,js.Medium,js.Heavy,js.Success,js.Warning,js.Error;const qC=()=>typeof navigator<"u"&&typeof navigator.vibrate=="function",ZC=()=>typeof document<"u"&&!!document.body,YC=()=>{if(ZC())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{}},fg=e=>Array.isArray(e)?[...e]:[e],KC=e=>{if(qC()){try{const i=fg(e),c=i.length===1?i[0]:i;navigator.vibrate(c)}catch{}return}const t=fg(e),r=Array.from({length:Math.ceil(t.length/2)},(i,c)=>[t[c*2]??0,t[c*2+1]??0]);let s=0;for(const[i,c]of r)i>0&&setTimeout(YC,s),s+=i+c},ra=e=>KC(e),XC=({message:e})=>{const{t}=Gr();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")})]})})},JC=()=>{const{t:e}=Gr();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")})]})})},eS=({message:e,onRetry:t})=>{const{t:r}=Gr();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 yd(e){return Array.from(e)}function pg(e,t,r){return Math.max(t,Math.min(r,e))}function tS(e,t,r,s){const i=yd(e),c=yd(t);let u=pg(r,0,i.length);const f=pg(s,0,c.length);let p=0;for(;p<i.length&&p<c.length&&i[p]===c[p];)p++;let g=0;for(;g<i.length-p&&g<c.length-p&&i[i.length-1-g]===c[c.length-1-g];)g++;const x=i.length-p-g,b=c.slice(p,c.length-g).join(""),v=[];if(x>0||b){const w=p+x;u>w?v.push({left:u-w}):u<w&&v.push({right:w-u}),u=w,x>0&&(v.push({backspace:x}),u=p),b&&(v.push({insert:b}),u+=yd(b).length)}return u>f?v.push({left:u-f}):u<f&&v.push({right:f-u}),u=f,{ops:v,cursor:u}}function mg(e){const t=e.value,r=e.selectionStart??t.length;return yd(t.slice(0,r)).length}const Md=16,rS=10,gg=1.5,nS=1.8,xg=240,sS=125,iS=92;function oS(e,t,r){const s=Math.hypot(e,t),i=Math.abs(e),c=Math.abs(t),u=()=>i>=c*gg?e>0?"right":"left":c>=i*gg?t>0?"down":"up":"";if(r==="")return s>Md?u():"";if(s<rS)return"";if(s<=Md)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:i)>=(g?i:c)*nS?f:r}function aS(e){const t=iS-Md,r=Math.min(Math.max((e-Md)/t,0),1);return xg-r*(xg-sS)}const lS="termdock-open-terminal-directory",tp=/(?:\\[ \t]|[^\s`"'<>|()[\]{}=,:;!?:,;!?。、“”‘’])+/gu,cS=new RegExp(`^( *)(${tp.source})`,"u"),uS=/[,;:!?]+$/u,dS=/^[a-z][a-z\d+.-]*:\/\//iu;function hS(e){return!e||e==="/"||dS.test(e)||e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("~/")||e.startsWith("./")||e.startsWith("../")?!0:e.endsWith("/")||/^[^/:]+\/[^/:]+\/(?:[^/:]+\/?)+$/u.test(e)}function Px(e){const t=[];tp.lastIndex=0;let r;for(;(r=tp.exec(e))!==null;){const i=r[0].replace(uS,"");if(!hS(i))continue;const c=e.slice(r.index+i.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:i,...f?{line:u}:{},startIndex:r.index,endIndex:r.index+i.length+(f?c[0].length:0)})}return t}function nf(e){const t=[];for(const r of e.split("/"))!r||r==="."||(r===".."?t.pop():t.push(r));return`/${t.join("/")}`}function fS(e){return e.match(/^\/(?:home|Users)\/[^/]+/u)?.[0]??null}function pS(e,t){const r=e.replace(/\\([ \t])/gu,"$1").replace(/\/+$/u,"")||"/";if(r.startsWith("/"))return nf(r);if(r==="~"||r.startsWith("~/")){const s=t?fS(t):null;return s?nf(`${s}/${r.slice(2)}`):null}return t?.startsWith("/")?nf(`${t}/${r}`):null}function qu(e,t){const r=e.buffer.active.getLine(t-1),s=e.buffer.active.getLine(t);if(!r||!s||s.isWrapped)return null;const i=r.translateToString(!0).trimEnd(),c=s.translateToString(!0),u=Px(i).at(-1),f=c.match(cS);if(!u||u.endIndex!==i.length||!u.text.endsWith("/")||!f||/^[~./]/u.test(f[2]))return null;const p=f[2];if(!p.includes("/")&&!/^[^/:]+\.[\p{L}\p{N}_-]+$/u.test(p))return null;let g=r.length-1;for(;g>=0&&!(r.getCell(g)?.getChars()||"").trim();)g-=1;const x=f[1].length;let b=0;for(let I=x;I<s.length;I+=1){const N=s.getCell(I);if(N?.getWidth()!==0){if(!N||/[\s/:]/u.test(N.getChars()||" "))break;b+=N.getWidth()}}if(r.length-g-1>=Math.max(8,x+2,b))return null;const w=r.getCell(g),k=s.getCell(x);return!w||!k||w.isFgDefault()||k.isFgDefault()||w.getFgColorMode()!==k.getFgColorMode()||w.getFgColor()!==k.getFgColor()?null:x}function mS(e,t){const r=e.buffer.active;let s=t-1;if(!r.getLine(s))return null;for(;s>0&&(r.getLine(s)?.isWrapped||qu(e,s)!==null);)s-=1;let i=t-1;for(;i+1<r.length&&(r.getLine(i+1)?.isWrapped||qu(e,i+1)!==null);)i+=1;let c="";const u=[],f=[];for(let g=s;g<=i&&c.length<=2048;g+=1){const x=r.getLine(g);if(!x)break;const b=g>s?qu(e,g)??0:0;let v=x.length;if(g<i&&qu(e,g+1)!==null)for(;v>0&&!(x.getCell(v-1)?.getChars()||"").trim();)v-=1;for(let w=b;w<v;w+=1){const k=x.getCell(w);if(!k||k.getWidth()===0)continue;const I=k.getChars()||" ";c+=I;for(let N=0;N<I.length;N+=1)u.push({x:w+1,y:g+1}),f.push({x:w+Math.max(1,k.getWidth()),y:g+1})}}const p=c.trimEnd().length;return{text:c.slice(0,p),startPositions:u.slice(0,p),endPositions:f.slice(0,p)}}function gS(e,t){return{provideLinks(r,s){const i=mS(e,r);if(!i){s(void 0);return}const c=Px(i.text).map(u=>({text:u.text,range:{start:i.startPositions[u.startIndex]??{x:u.startIndex+1,y:r},end:i.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 bg(e,t){if(!e||e.lines.length===0||!Number.isFinite(t)||t<=0)return 0;const r=Math.floor(t),s=Number.isFinite(e.lines.maxLength)&&e.lines.maxLength>0?Math.floor(e.lines.maxLength):null;let i=0;if(s!==null){const p=Math.max(0,s-r);e.ybase>p&&(e.ybase=p,Number.isFinite(e.ydisp)&&(e.ydisp=Math.min(e.ydisp,p)),i++)}let 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 p=Math.max(0,e.lines.length-r);e.ybase>p&&(e.ybase=p,Number.isFinite(e.ydisp)&&(e.ydisp=Math.min(e.ydisp,p)),i++),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 p=0;p<f;p++){const g=e.lines.length;if(e.lines.push(e.getBlankLine(void 0)),e.lines.length<=g)break;i++}return i}function yg(e,t=e.rows){const s=e._core?._bufferService?.buffers;return s?bg(s.normal,t)+bg(s.alt,t):0}function Zu(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:0}function xS(e,t,r){const s=Zu(e.fontBoundingBoxAscent)+Zu(e.fontBoundingBoxDescent),i=Zu(e.actualBoundingBoxAscent)+Zu(e.actualBoundingBoxDescent);return Math.max(1,Math.floor(Math.ceil(s||i||t)*r))}const Pl=8,Yu=36,vg=10,bS=1.08,yS=1.16,Ku=6,vS=.94,wS=.08,AS=.12,TS=88,CS=36,SS=10,_S=14,LS=52;function Cc(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 kS=80,IS=8;function Xu(e,t){return e.modes?.applicationCursorKeysMode===!0?`\x1BO${t}`:`\x1B[${t}`}function ES(e){return e.nativeEvent.isComposing||e.isComposing===!0||e.keyCode===229}function MS(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 RS(e){const t="\x1B]52;";let r=0,s="";for(;r<e.length;){const i=e.indexOf(t,r);if(i===-1)return s+=e.slice(r),{cleaned:s,remainder:""};s+=e.slice(r,i);let c=-1,u=1;for(let g=i+t.length;g<e.length;g+=1){const x=e.charCodeAt(g);if(x===7){c=g,u=1;break}if(x===27&&g+1<e.length&&e[g+1]==="\\"){c=g,u=2;break}}if(c===-1)return{cleaned:s,remainder:e.slice(i)};const f=e.slice(i+t.length,c),p=f.indexOf(";");if(p>=0){const g=f.slice(p+1);if(g&&g!=="?"){const x=MS(g);x!==null&&navigator.clipboard?.writeText(x).catch(()=>{})}}r=c+u}return{cleaned:s,remainder:""}}function NS(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 DS=new Set(["visibility","bfcache","online"]),QS=5e5,BS=1e5,Sc=260,_c=140,wg=80;function jS(e){return!e}let T0=null;const PS=[{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:"⏺⏸⏹✓✗"}],OS=()=>{if(T0)return T0;if(typeof document>"u"||!("fonts"in document))return T0=Promise.resolve(),T0;const e=document.fonts;return T0=Promise.allSettled(PS.map(({font:r,text:s})=>e.load(r,s))).then(()=>e.ready).then(()=>{}).catch(()=>{}),T0},Ag=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 Tg(e){return e==="normal"||e==="bold"?e:Math.max(1,Math.min(1e3,Math.round(e)))}function Ol(e,t,r){const s=e?.dimensions?.css.cell.height;return Math.max(8,Math.round(s||t*r))}function FS(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 Cg=new Map;function US(e,t,r,s,i){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}::${i}::${u}::${t}`;let p=Cg.get(f);if(!p)try{const v=document.createElement("canvas").getContext("2d");if(!v)return null;v.font=`${r}px ${t}`;const w=v.measureText("M"),I=(Math.floor(w.width*u)+Math.round(s))/u,N=xS(w,r,i);I>=1&&N>=1&&(p={cellWidth:I,cellHeight:N},Cg.set(f,p))}catch{return null}if(!p)return null;const g=Math.max(2,Math.floor(c.width/p.cellWidth)),x=Math.max(2,Math.floor(c.height/p.cellHeight));return!Number.isFinite(g)||!Number.isFinite(x)?null:{cols:g,rows:x}}async function Sg(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 $S(e){const t=e.buffer.active,r=t.viewportY,s=Math.min(t.length,r+e.rows),i=[];for(let c=r;c<s;c+=1){const u=t.getLine(c);u&&i.push(u.translateToString(!0))}return i.join(`
64
+ `).replace(/\s+$/g,"")}function Lc(e,t,r){const s=ql(e);if(!s)return null;const i=Math.max(0,Math.min(e.cols-1,Math.floor((t-s.originLeft)/s.cellW))),c=Math.max(0,Math.min(e.rows-1,Math.floor((r-s.originTop)/s.cellH)));return{col:i,row:e.buffer.active.viewportY+c}}function sf(e,t,r){const s=t.row*e.cols+t.col,i=r.row*e.cols+r.col;if(s===i)return e.clearSelection(),!1;const c=Math.min(s,i),u=Math.max(s,i)+1,f=c%e.cols,p=Math.floor(c/e.cols);return e.select(f,p,u-c),!0}function _g(e){if(typeof document>"u")return 0;const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e)||"0");return Number.isFinite(t)?t:0}function zS(e,t,r,s,i=!0){if(typeof window>"u")return{left:0,top:0};const c=window.visualViewport,u=c?.offsetLeft??0,f=c?.offsetTop??0,p=c?.width??window.innerWidth,g=c?.height??window.innerHeight,x=_g("--safe-top-inset"),b=_g("--safe-bottom-inset"),v=s?mC(s.terminal,s.anchor,s.focus):null,w=[];let k;if(i&&w.push({left:e-32,top:t-32,right:e+32,bottom:t+32}),s){const N=ql(s.terminal),{start:M,end:D}=Ed(s.anchor,s.focus,s.terminal.cols),F=bd(s.terminal,M),Z=bd(s.terminal,D);if(F&&w.push({left:F.x-24,top:F.y-48,right:F.x+24,bottom:F.y+4}),Z&&N){const G=Z.y+N.cellH;w.push({left:Z.x-24,top:G-4,right:Z.x+24,bottom:G+48})}if(v){const G=s.anchor.row*s.terminal.cols+s.anchor.col,U=s.focus.row*s.terminal.cols+s.focus.col,q=G<=U,pe=v.right-v.left,be=s.anchor.row===s.focus.row?q?v.left+pe*.25:v.right-pe*.25:(v.left+v.right)/2,Ae=bd(s.terminal,s.focus),Ke=Ae&&N?Ae.y+N.cellH/2:t;k={vertical:s.focus.row<s.anchor.row?"below":"above",alignX:be,focusX:Ae?.x??e,focusY:Ke}}}const I=gC({clientX:e,clientY:t,viewport:{left:u,top:f+x,right:u+p,bottom:f+g-b},terminal:r,width:TS,height:CS,margin:SS,fingerGap:_S,selection:v,avoid:w,preference:k,selectionGap:LS});return{left:I.left-r.left,top:I.top-r.top}}const Ox=S.forwardRef(({sessionKey:e,sessionId:t,isLayoutVisible:r=!0,chunks:s,onInput:i,onResize:c,onFlowControl:u,onTmuxScroll:f,tmuxScrollSensitivity:p=.55,onDoubleTap:g,onInputFocusChange:x,onMobileLongPressCopyResult:b,onMobilePasteResult:v,onReadyChange:w,onSizeSynchronizedChange:k,onWritesSettled:I,onWriteProgress:N,onCursorPositionChange:M,onDirectoryLinkActivate:D,terminalSettings:F,theme:Z,className:G,enableTouchScroll:U,mobileLongPressMode:q="arrows",autoFocus:pe=!0,cursorVisible:Ue=!0,suppressSmoothScroll:be=!1},Ae)=>{const{t:Ke}=Gr(),qe=S.useRef(null),ie=S.useRef(null),Se=S.useRef(null),tt=S.useRef(null),Ee=S.useRef(null),oe=S.useRef(be);oe.current=be;const de=S.useRef(null),Te=S.useRef(i),ee=S.useRef(c),ye=S.useRef(x),ce=S.useRef(u),Ye=S.useRef(w);Ye.current=w;const at=S.useRef(k);at.current=k;const _e=S.useRef(I);_e.current=I;const $=S.useRef(N);$.current=N;const $e=S.useRef(M);$e.current=M;const Xe=S.useRef(D);Xe.current=D;const Le=S.useRef(F.rendererMode),K=S.useRef(""),Fe=S.useRef(0),fe=S.useRef(!1),De=S.useRef(null),lt=S.useRef(0),Tt=S.useRef(0),we=S.useRef(!1),me=S.useRef(null),Qe=S.useRef(null),gt=S.useRef(()=>{}),ft=S.useRef(null),ct=S.useRef(null),Kt=S.useRef(void 0),$t=S.useRef(null),Qt=S.useRef(!1),ut=S.useRef(0),bt=S.useRef(""),It=S.useRef(null),St=S.useRef(null),Ht=S.useRef(!1),te=S.useRef(typeof window<"u"?window.devicePixelRatio:1),Me=S.useRef(!1),ve=S.useRef(!1),_t=S.useRef(null),Ve=S.useRef(""),yt=S.useRef(0),Gt=S.useRef(null),ke=S.useRef(null),Ce=S.useRef(null),nt=S.useRef(0),xe=S.useRef(0),gr=S.useRef(0),xt=S.useRef(null),hn=S.useRef(0),Xr=S.useRef(0),Rr=S.useRef(!1),Vr=S.useRef(0),[,Un]=S.useReducer(L=>L+1,0),[_r,is]=S.useReducer(L=>L+1,0),[xr,ae]=S.useState("loading"),[ar,it]=S.useState(null),[os,fn]=S.useState(null);S.useEffect(()=>{const L=B=>{(B.target instanceof Element?B.target.closest("[data-termdock-terminal-dropzone]"):null)?.dataset.termdockTerminalDropzone===e&&fn(String(B.detail))};return window.addEventListener("termdock:file-drop-error",L),()=>window.removeEventListener("termdock:file-drop-error",L)},[e]);const Zt=S.useMemo(()=>j0("terminal"),[]),[Yr,Ur]=S.useState(!0),[Nr,Zn]=S.useState(!1);S.useEffect(()=>{if(!Yr&&xr!=="loading"){Zn(!1);return}const L=window.setTimeout(()=>Zn(!0),160);return()=>window.clearTimeout(L)},[Yr,xr]);const[Ln,kn]=S.useState(!1),[as,$n]=S.useState({visible:!1,activeDir:""}),[Dr,On]=S.useState(null),Y=S.useRef(null),We=S.useRef(!1),Mt=S.useRef({active:!1,anchor:null,focus:null,dragging:null}),[Xt,vr]=S.useState(null),[At,Lr]=S.useState({x:0,y:0,cellW:8,cellH:17,cursorX:0}),jr=S.useRef(At);jr.current=At;const Jr=S.useRef(null),[Ts,Nn]=S.useState({active:!1,text:""}),$r=S.useRef(null),zr=S.useRef(null);Te.current=i,ee.current=c,ye.current=x,ce.current=u,Le.current=F.rendererMode;const Pr=S.useRef(pe);Pr.current=pe;const pn=S.useRef(Ue);pn.current=Ue;const Dn=S.useRef(U);Dn.current=U;const cs=S.useRef(r);cs.current=r;const kr=jS(!!f),{rendererMode:Yn,fontFamily:ur,fontSize:Kr,fontWeight:sn,fontWeightBold:Kn,letterSpacing:hs,lineHeight:Or,minimumContrastRatio:mn,drawBoldTextInBrightColors:P,unicodeVersion:he,customGlyphs:Ne,rescaleOverlappingGlyphs:je,fontLigatures:Re,enableImages:dt,smoothScrolling:wt}=F,Je=Yn==="webgl",Ge=S.useCallback(()=>{Y.current!==null&&(clearTimeout(Y.current),Y.current=null),On(null)},[]),ot=S.useCallback((L,B)=>{Y.current!==null&&(clearTimeout(Y.current),Y.current=null),We.current=!1,On(L),!B?.persistent&&(Y.current=setTimeout(()=>{Y.current=null,On(null)},3e3))},[]);S.useEffect(()=>{if(!Dr)return;const L=()=>{Mt.current.active||Ge()},B=()=>Ge();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)}},[Ge,Dr]),S.useEffect(()=>()=>{Y.current!==null&&(clearTimeout(Y.current),Y.current=null)},[]);const sr=S.useCallback(()=>{const L=Se.current,B=qe.current,j=Mt.current;if(!L||!B||!j.active||!j.anchor||!j.focus){vr(null);return}const W=B.getBoundingClientRect(),Oe=ql(L)?.cellH??16,{start:Ie,end:st}=Ed(j.anchor,j.focus,L.cols),et=j.dragging==="start"?j.focus:j.dragging==="end"?j.anchor:Ie,Et=j.dragging==="end"?j.focus:j.dragging==="start"?j.anchor:st,lr=(an,Br)=>{const An=bd(L,an);return An?{left:An.x-W.left,top:Br?An.y-W.top:An.y+Oe-W.top}:null};vr({start:lr(et,!0),end:lr(Et,!1)})},[]),vt=S.useCallback(L=>{const B=Se.current,j=qe.current,W=Mt.current;if(!B||!j||!W.active||!W.anchor||!W.focus)return;if(W.dragging){Ge();return}const Oe=j.getBoundingClientRect(),Ie={x:(Oe.left+Oe.right)/2,y:(Oe.top+Oe.bottom)/2};ot(zS(L?.x??Ie.x,L?.y??Ie.y,Oe,{terminal:B,anchor:W.anchor,focus:W.focus},L!==void 0),{persistent:!0})},[Ge,ot]),zt=S.useCallback(()=>{const L=Mt.current;L.active=!1,L.anchor=null,L.focus=null,L.dragging=null,vr(null),Ge()},[Ge]);S.useEffect(()=>{if(!Xt)return;const L=Se.current;if(!L)return;const B=L.onScroll(()=>{sr(),vt()}),j=L.onResize(()=>zt());return()=>{B.dispose(),j.dispose()}},[Xt,sr,vt,zt]),S.useEffect(()=>{U||ye.current?.(!1)},[U]);const ht=S.useCallback((L,B,j)=>{const W=(j.element?.offsetWidth||0)/j.cols||8,Oe=(j.element?.offsetHeight||0)/j.rows||16,Ie=Math.max(1,Math.min(j.cols,Math.floor(L/W)+1)),st=Math.max(1,Math.min(j.rows,Math.floor(B/Oe)+1));return{x:Ie,y:st}},[]),Jt=S.useCallback((L,B,j)=>{const W=Se.current;if(!W)return!1;const Oe=L>0?-1:1;if(W.modes?.mouseTrackingMode!=="none"){let Ie,st;if(B!==void 0&&j!==void 0){const lr=ht(B,j,W);Ie=lr.x,st=lr.y}else Ie=W.buffer.active.cursorX+1,st=W.buffer.active.cursorY+1;const Et=`\x1B[<${Oe>0?64:65};${Ie};${st}M`;return Te.current(Et),!0}if(W.buffer.active.type==="alternate"){const Ie=Oe>0?"\x1B[A":"\x1B[B";return Te.current(Ie),!0}return null},[ht]),Ir=S.useCallback(L=>{const B=Se.current;if(!B)return!1;const j=Ol(Se.current,Kr,Or),W=ut.current+L,Oe=Math.trunc(W/j);return ut.current=W-Oe*j,Oe!==0?(B.scrollLines(Oe),!0):!1},[Kr,Or]),Nt=S.useCallback(L=>{if(!Se.current)return!1;const W=Ol(Se.current,Kr,Or)/Math.max(.1,p),Oe=ut.current+L;let Ie=Math.trunc(Oe/W);if(ut.current=Oe-Ie*W,Ie===0&&Math.abs(Oe)>=W/3&&(Ie=Oe>0?1:-1,ut.current=0),Ie===0)return!1;const st=Ie>0?"down":"up",et=Math.max(1,Math.min(Math.abs(Ie),10));return f(st,et),!0},[Kr,Or,f,p]),pr=S.useRef(Jt);pr.current=Jt;const br=S.useRef(Ir);br.current=Ir;const Xn=S.useRef(Nt);Xn.current=Nt;const zn=S.useRef(f);zn.current=f;const Jn=S.useRef({pointerId:null,tmuxActiveAtDown:!1});S.useEffect(()=>{if(!U)return;const L=qe.current;if(!L)return;const B=W=>{W.pointerType==="touch"&&(Jn.current.pointerId=W.pointerId,Jn.current.tmuxActiveAtDown=!!zn.current)},j=W=>{W.pointerType==="touch"&&Jn.current.pointerId===W.pointerId&&(Jn.current.pointerId=null,Jn.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)}},[U]);const Cs=S.useCallback(()=>{if(Rr.current)return!1;const L=Jn.current;return L.pointerId!==null?!L.tmuxActiveAtDown:!zn.current},[]),Vs=S.useCallback((L,B,j)=>{const W=pr.current(L,B,j);return W!==null?W:zn.current?Xn.current(L):br.current(L)},[]),yn=S.useCallback((L,B)=>{if(performance.now()<=Xr.current){Xr.current=0;return}const j=Se.current;if(j&&j.modes?.mouseTrackingMode!=="none"){const W=ht(L,B,j),Oe=W.x,Ie=W.y,st=`\x1B[<0;${Oe};${Ie}M`,et=`\x1B[<0;${Oe};${Ie}m`;Te.current(st),Te.current(et)}},[ht]),Fr=S.useCallback(()=>typeof performance<"u"?performance.now():Date.now(),[]),O=S.useCallback((L=700)=>{xt.current=null,hn.current=Fr()+L},[Fr]),ne=S.useCallback(()=>Dn.current&&Fr()<=hn.current,[Fr]),le=S.useCallback(()=>{const L=ct.current;return!L||typeof document>"u"?!1:document.activeElement===L},[]),ze=S.useCallback(()=>{if(typeof window>"u")return!1;const L=et=>{if(typeof document>"u")return 0;const Et=Number.parseFloat(document.documentElement.style.getPropertyValue(et)||"0");return Number.isFinite(Et)?Et:0},B=L("--kb-height");if(B>0)return B>=wg;const j=window.visualViewport;if(!j)return!1;const W=L("--app-base-vh")||window.innerHeight,Oe=L("--safe-bottom-inset"),Ie=j.height+j.offsetTop;return Math.max(0,Math.round(W-Ie-Oe))>=wg},[]),Lt=S.useCallback(()=>{Gt.current!==null&&(clearTimeout(Gt.current),Gt.current=null),ke.current=null},[]),Pt=S.useCallback(L=>{const B=Se.current;let j="";for(const W of L)W.left&&(j+=(B?Xu(B,"D"):"\x1B[D").repeat(W.left)),W.right&&(j+=(B?Xu(B,"C"):"\x1B[C").repeat(W.right)),W.backspace&&(j+="".repeat(W.backspace)),W.insert&&(j+=W.insert);return j},[]),Vt=S.useCallback(L=>{const B=L.value,j=Cc(B),W=Ve.current;if(!(Dn.current&&!j.includes("\r")&&!W.includes("\r"))){if(j===W)return;let lr=0;for(;lr<W.length&&lr<j.length&&W[lr]===j[lr];)lr++;const an=W.length-lr;an>0&&Te.current("".repeat(an));const Br=j.slice(lr);if(Br){try{Se.current?.clearSelection()}catch{}Te.current(Br)}Ve.current=j,yt.current=Array.from(j).length;return}const Ie=mg(L),{ops:st,cursor:et}=tS(W,j,yt.current,Ie),Et=Pt(st);if(Et){if(st.some(lr=>lr.insert))try{Se.current?.clearSelection()}catch{}Te.current(Et)}Ve.current=j,yt.current=et},[Pt]),dr=S.useCallback((L,B)=>{const j=L.value,W=Cc(j),Oe=Ve.current;if(W===Oe){Lt();return}let Ie=0;for(;Ie<Oe.length&&Ie<W.length&&Oe[Ie]===W[Ie];)Ie++;const st=Oe.length-Ie;if(U&&!B?.immediate&&st>=IS){ke.current=L,Gt.current!==null&&clearTimeout(Gt.current),Gt.current=setTimeout(()=>{Gt.current=null;const Et=ke.current;ke.current=null,Et&&Vt(Et)},kS);return}Lt(),Vt(L)},[Lt,U,Vt]),Bt=S.useCallback(L=>{dr(L,{immediate:!0}),Te.current("\r"),L.value="",Ve.current="",yt.current=0},[dr]),ir=S.useCallback((L,B,j)=>{if(!L)return;Lt();const W=B??ct.current;W&&(W.value=""),Ve.current="",yt.current=0;try{Se.current?.clearSelection()}catch{}if(zt(),j?.paste&&/[\r\n]/.test(L)){const Oe=j.submitAfterPaste??L.endsWith("\r"),Ie=vC(L,Oe);Te.current(Ie,{skipModifierTransform:!0,consumeModifier:j?.consumeModifier});return}Te.current(L,{skipModifierTransform:!0,consumeModifier:j?.consumeModifier})},[Lt]),qr=S.useCallback((L,B)=>{const j=Cc(L);return j?(fn(null),Lh(j)||(ir(j,B,{paste:!0,submitAfterPaste:!1}),Ge()),!0):!1},[Ge,ir]);S.useEffect(()=>zy(L=>{if(L.sessionKey!==e||L.paths.length===0)return;const B=L.paths.map(Pc).join(" ");ir(`${B} `);try{ct.current?.focus({preventScroll:!0})}catch{}}),[ir,e]);const vn=S.useCallback(async(L,B)=>{fn(null);try{const j=await mw(L);return Lh(`${Pc(j)} `)||(ir(`${Pc(j)} `,B),Ge()),!0}catch(j){return fn(j instanceof Error?j.message:"Image upload failed"),!1}},[Ge,ir]),Hn=S.useCallback(async(L,B)=>{fn(null);try{const j=await xw(L);if(!j.length)return!1;const W=`${j.map(Pc).join(" ")} `;return Lh(W)||(ir(W,B),Ge()),!0}catch(j){return fn(j instanceof Error?j.message:"File upload failed"),!1}},[Ge,ir]),In=S.useCallback(async L=>{fn(null);try{if(na()?.readClipboardFiles){const W=await gw();if(W.length)return Hn(W,L)}if(!na()?.readClipboardImage){if(typeof navigator.clipboard?.read=="function"){const W=await navigator.clipboard.read(),Oe=await gm({read:async()=>W});if(Oe)return vn(Oe,L);for(const Ie of W){if(!Ie.types.includes("text/plain"))continue;const st=await(await Ie.getType("text/plain")).text();return qr(st,L)}return!1}return navigator.clipboard?.readText?qr(await navigator.clipboard.readText(),L):!1}const B=await gm(navigator.clipboard);if(B)return vn(B,L);if(!navigator.clipboard?.readText)return!1;const j=await navigator.clipboard.readText();return qr(j,L)}catch(B){return fn(B instanceof Error?B.message:"Clipboard read failed"),!1}},[Hn,vn,qr]),ci=S.useCallback(L=>{if(Jr.current&&!L?.repositionFrozen)return null;const B=Se.current;if(!B||!B.element)return null;const j=ql(B),Oe=B.element.querySelector(".xterm-screen")??B.element,Ie=Oe.getBoundingClientRect(),st=j?.cellW??(Ie.width>0&&B.cols>0?Ie.width/B.cols:8),et=j?.cellH??(Ie.height>0&&B.rows>0?Ie.height/B.rows:17),Et=ct.current;let lr=Kt.current;Et&&(lr===void 0||lr!==null&&(!lr.isConnected||!lr.contains(Et)))&&(lr=bC(Et),Kt.current=lr);const an=B.buffer.active,Br=an.cursorX*st,An=an.cursorY*et,ln=yC(Oe,lr??null,Br,An),hr=Math.round(ln.x),dn=Math.round(ln.y),cn={x:hr,y:dn,cellW:st,cellH:et,cursorX:an.cursorX};return jr.current=cn,Jr.current&&L?.repositionFrozen&&(Jr.current={...cn}),Lr(Si=>Math.abs(Si.x-hr)<.5&&Math.abs(Si.y-dn)<.5&&Math.abs(Si.cellW-st)<.5&&Math.abs(Si.cellH-et)<.5&&Si.cursorX===an.cursorX?Si:cn),cn},[]),es=S.useRef(ci);es.current=ci,S.useEffect(()=>{if(!U)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,es.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)}},[U]);const Cr=S.useCallback(L=>{let B=0;for(const j of L){const W=j.codePointAt(0)??0,Oe=W>=4352&&W<=4447||W>=11904&&W<=12350||W>=12353&&W<=13311||W>=13312&&W<=19903||W>=19968&&W<=40959||W>=40960&&W<=42191||W>=44032&&W<=55203||W>=63744&&W<=64255||W>=65072&&W<=65103||W>=65280&&W<=65376||W>=65504&&W<=65510||W>=127744&&W<=129791;B+=Oe?2:1}return B},[]),Ot=S.useCallback(L=>{const B=Se.current,{cellW:j,cellH:W}=At;if(!B||!L)return{width:Math.max(1,Math.round(j)),height:Math.max(1,Math.round(W)),whiteSpace:"pre"};const Ie=Jr.current?.cursorX??B.buffer.active.cursorX,st=Math.max(1,B.cols),et=Math.max(1,Cr(L)),Et=Math.max(1,st-Ie);if(et<=Et)return{width:Math.max(1,Math.round(et*j)),height:Math.max(1,Math.round(W)),whiteSpace:"pre"};const lr=et-Et,Br=1+Math.ceil(lr/st);return{width:Math.max(1,Math.round(Et*j)),height:Math.max(1,Math.round(Br*W)),whiteSpace:"pre-wrap"}},[At,Cr]),En=S.useCallback(()=>{Kt.current=void 0;const L=es.current();Jr.current={...L??jr.current}},[]),Ps=S.useCallback(()=>{Jr.current=null},[]),ui=S.useCallback(L=>{if(!Me.current&&Jr.current===null)return!1;if(Me.current=!1,Jr.current=null,Lt(),_t.current!==null&&(clearTimeout(_t.current),_t.current=null),ve.current=!1,L){L.value=Ve.current;try{L.setSelectionRange(L.value.length,L.value.length)}catch{}}return Nn(B=>B.active||B.text?{active:!1,text:""}:B),!0},[Lt]),Hr=S.useCallback((L,B)=>{const j=ct.current;if(j)try{j.removeAttribute("readonly");const Oe=typeof document<"u"&&document.activeElement===j&&!ze(),Ie=Fr(),st=Ie-Vr.current;Vr.current=Ie,Oe&&st>600?(j.blur(),j.removeAttribute("readonly"),j.focus(),Vr.current=Fr()):j.focus()}catch{}},[ze,Fr]),ts=S.useCallback(L=>{xe.current=Fr()+L},[Fr]),Ni=S.useCallback(()=>U?Fr()<=xe.current:!1,[U,Fr]),Qn=S.useCallback(L=>{ts(L),gr.current=Fr()},[ts,Fr]),en=S.useCallback(()=>{U&&ct.current?.removeAttribute("readonly")},[U]),qs=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),[]),Os=S.useCallback(L=>{if(en(),Qn(Sc),!U||L.pointerType!=="touch"){xt.current=null;return}const B=L.target;if(qs(B)){O();return}Dr&&!(B instanceof HTMLElement&&B.closest('[data-terminal-copy-popover="true"]'))&&Ge(),xt.current={pointerId:L.pointerId,startX:L.clientX,startY:L.clientY,moved:!1}},[Ge,U,Qn,qs,Dr,en,O]),Mn=S.useCallback(L=>{Qn(Sc);const B=xt.current;!B||B.pointerId!==L.pointerId||Math.hypot(L.clientX-B.startX,L.clientY-B.startY)>12&&(B.moved=!0)},[Qn]),Fs=S.useCallback(L=>{Qn(_c);const B=xt.current;xt.current=null,!(!U||L.pointerType!=="touch")&&(!B||B.pointerId!==L.pointerId||B.moved||ne()||Hr(L.clientX,L.clientY))},[U,Qn,Hr,ne]),Ho=S.useCallback(()=>{xt.current=null,Qn(_c)},[Qn]),ka=S.useMemo(()=>({enableKinetic:!0}),[]),vo=S.useRef(()=>!1),oa=S.useRef(Hr);oa.current=Hr;const Za=S.useCallback((L,B)=>{ne()||oa.current(L,B)},[ne]),wo=S.useRef(g);wo.current=g;const aa=S.useRef(b);aa.current=b;const Ao=S.useRef(v);Ao.current=v;const la=S.useCallback(()=>{if(We.current)return;We.current=!0,O();const L=Se.current,B=L?.hasSelection()?L.getSelection():"";try{L?.clearSelection()}catch{}qa.flushSync(()=>{zt()}),(async()=>{const j=await Sg(B);aa.current?.(j)})()},[zt,O]),Zi=S.useCallback(L=>{document.dispatchEvent(new CustomEvent("termdock:gesture-lock",{detail:{locked:L}}))},[]),{setupTouchScroll:Yi,stopAllScroll:di}=VC(qe,{...ka,shouldCaptureTouch:vo.current,canStartScrollGesture:Cs,onScroll:Vs,onScrollWithCoords:Vs,onClickWithCoords:yn,onTap:Za,onClaimChange:Zi,tapThreshold:12,gestureName:`normal-scroll:${e}`});S.useEffect(()=>{if(!U)return;ct.current?.setAttribute("readonly","");const L=Yi();return()=>{L()}},[U,Yi]),S.useEffect(()=>{if(!U)return;let L=ze();const B=()=>{const j=ze();if(L&&!j){const W=ct.current;W&&typeof document<"u"&&document.activeElement===W&&(W.setAttribute("readonly",""),W.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)}},[U,ze]),S.useEffect(()=>{if(!U)return;const L=qe.current;if(!L)return;const B=W=>{const Ie=W.sourceCapabilities?.firesTouchEvents===!0,st=Fr()-gr.current<=1200;return!Ie&&!st?!1:L.contains(W.target)},j=W=>{B(W)&&(W.cancelable&&W.preventDefault(),W.stopImmediatePropagation(),W.stopPropagation())};return L.addEventListener("mousedown",j,{capture:!0,passive:!1}),L.addEventListener("mouseup",j,{capture:!0,passive:!1}),L.addEventListener("click",j,{capture:!0,passive:!1}),document.addEventListener("mouseup",j,{capture:!0,passive:!1}),()=>{L.removeEventListener("mousedown",j,!0),L.removeEventListener("mouseup",j,!0),L.removeEventListener("click",j,!0),document.removeEventListener("mouseup",j,!0)}},[U,Fr]);const Zs=S.useRef({pointerId:null,lastX:null,lastY:null,startX:null,startY:null,gestureAxis:null,remainder:0,didScroll:!1,rafId:null,velocity:0,instantSpeed:0}),us=S.useCallback(()=>{const L=Zs.current;L.rafId!==null&&(cancelAnimationFrame(L.rafId),L.rafId=null)},[]),Ya=S.useCallback((L,B,j)=>{const W=Se.current;if(!W||!W.element||!W.cols||!W.rows)return null;const Oe=Zs.current,Ie=W.element.getBoundingClientRect(),st=B??Oe.lastX??Ie.left+Ie.width/2,et=j??Oe.lastY??Ie.top+Ie.height/2,Et=st-Ie.left,lr=et-Ie.top,an=W.element.offsetWidth/W.cols||8,Br=W.element.offsetHeight/W.rows||16,An=Math.max(1,Math.min(W.cols,Math.floor(Et/an)+1)),ln=Math.max(1,Math.min(W.rows,Math.floor(lr/Br)+1));return`\x1B[<${L==="up"?64:65};${An};${ln}M`},[]),fs=S.useCallback((L,B,j,W)=>{if(B<=0)return;const Oe=Ya(L,j,W);Oe&&Te.current(B===1?Oe:Oe.repeat(B))},[Ya]),Ia=S.useRef(fs);Ia.current=fs;const Ki=S.useRef(()=>{}),ca=S.useCallback(()=>{const B=Ol(Se.current,Kr,Or)/Math.max(.1,p),j=1+Zs.current.instantSpeed*.1;return B/Math.min(6,j)},[Kr,Or,p]),Wo=S.useCallback(()=>{const L=Zs.current;L.rafId=null;const B=ca();let j=0,W=0;for(;j+W<Ku&&L.remainder>=B;)L.remainder-=B,W++;for(;j+W<Ku&&L.remainder<=-B;)L.remainder+=B,j++;if(W>0&&fs("down",W),j>0&&fs("up",j),j+W>0)L.rafId=requestAnimationFrame(Wo);else if(L.pointerId!==null&&Math.abs(L.remainder)>=B/3){const Ie=L.remainder>0?"down":"up";L.remainder=0,fs(Ie,1),L.rafId=requestAnimationFrame(Wo)}},[ca,fs]),oo=S.useCallback(()=>{const L=Zs.current;L.rafId===null&&typeof requestAnimationFrame<"u"&&(L.rafId=requestAnimationFrame(Wo))},[Wo]),Ea=S.useCallback(L=>{if(L.pointerType!=="touch")return!1;us();const B=Zs.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},[us]),Ma=S.useCallback((L,B)=>{if(Rr.current)return B?"release":"neutral";if(performance.now()<=Xr.current)return"neutral";const j=Zs.current;if(L.pointerType!=="touch"||L.pointerId!==j.pointerId||j.lastY==null)return"neutral";if(j.gestureAxis===null&&j.startX!==null&&j.startY!==null){const Ie=Math.abs(L.clientX-j.startX),st=Math.abs(L.clientY-j.startY);if(Ie>vg||st>vg){if(Ie>st*bS)return j.gestureAxis="x","release";st>Ie*yS&&(j.gestureAxis="y")}}if(j.gestureAxis==="x")return j.lastX=L.clientX,j.lastY=L.clientY,"release";if(j.gestureAxis===null)return j.lastX=L.clientX,j.lastY=L.clientY,"neutral";const W=L.clientY-j.lastY;j.lastX=L.clientX,j.lastY=L.clientY;const Oe=-W;if(j.remainder+=Oe,j.instantSpeed=Math.abs(Oe),j.velocity=j.velocity*.45+Oe*.55,B){const st=Ol(Se.current,Kr,Or)/Math.max(.1,p);Math.abs(j.remainder)>=st/3&&(j.didScroll=!0,oo())}return"claim"},[Kr,Or,p,oo]),Ra=S.useCallback(L=>{const B=Zs.current;if(L.pointerType!=="touch"||L.pointerId!==B.pointerId)return;if(us(),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 W=Ol(Se.current,Kr,Or)/Math.max(.1,p);if(B.didScroll&&Math.abs(B.velocity)>W*wS){const Oe=()=>{B.velocity*=vS,B.remainder+=B.velocity;const Ie=1+Math.abs(B.velocity)*.1,st=W/Math.min(6,Ie);if(Math.abs(B.velocity)<W*AS){if(Math.abs(B.remainder)>=st/3){const lr=B.remainder>0?"down":"up";fs(lr,1),B.remainder=0}B.velocity=0,B.rafId=null;return}let et=0,Et=0;for(;et+Et<Ku&&B.remainder>=st;)B.remainder-=st,Et++;for(;et+Et<Ku&&B.remainder<=-st;)B.remainder+=st,et++;Et>0&&fs("down",Et),et>0&&fs("up",et),B.rafId=requestAnimationFrame(Oe)};B.rafId=requestAnimationFrame(Oe)}else Math.abs(B.remainder)>=W/3&&oo();B.didScroll&&L.stopImmediatePropagation()},[us,fs,oo,p,Kr,Or]),ua=S.useCallback(L=>{const B=Zs.current;L.pointerType!=="touch"||L.pointerId!==B.pointerId||(us(),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)},[us]);hg({name:`tmux-scroll:${e}`,priority:WC,container:()=>qe.current,onPointerDown:U&&f?Ea:void 0,onPointerMove:U&&f?Ma:void 0,onPointerUp:U&&f?Ra:void 0,onPointerCancel:U&&f?ua:void 0});const rs=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}),Go=S.useRef(null);Go.current=qe.current;const Ci=Go,Ka=Te,Vo=S.useRef(q);Vo.current=q;const Wn=S.useCallback(L=>{const B=rs.current;B.gestureLocked!==L&&(B.gestureLocked=L,Zi(L))},[Zi]),hi=S.useCallback(()=>{const L=rs.current;L.edgeScrollTimer!==null&&(clearInterval(L.edgeScrollTimer),L.edgeScrollTimer=null),L.edgeScrollDir=0},[]),To=S.useCallback(L=>{const B=Se.current,j=rs.current;if(B){if(j.mode==="copy"&&j.copyStart){j.copyDidSelect=sf(B,j.copyStart,L)||j.copyDidSelect;return}if(j.mode==="adjust"){const W=Mt.current;if(!W.active||!W.anchor)return;W.focus=pC(B,L),sf(B,W.anchor,W.focus),sr()}}},[sr]),da=S.useCallback((L,B)=>{const j=Se.current,W=rs.current;if(!j)return;const Oe=ql(j);if(!Oe)return;const Ie=Oe.originTop,st=Oe.originTop+j.rows*Oe.cellH,et=Math.max(28,Oe.cellH*1.5),Et=B-Ie,lr=st-B;let an=0,Br=0;if(Et<et?(an=-1,Br=Math.min(1,(et-Et)/et)):lr<et&&(an=1,Br=Math.min(1,(et-lr)/et)),W.edgeClientX=L,W.edgeClientY=B,an===0){hi();return}W.edgeScrollDir=an,W.edgeScrollLines=1+Math.round(Br*5),W.edgeScrollTimer===null&&(W.edgeScrollTimer=setInterval(()=>{const An=Se.current,ln=rs.current;if(!An||ln.edgeScrollDir===0)return;if(ln.mode!=="copy"&&ln.mode!=="adjust"){hi();return}An.scrollLines(ln.edgeScrollDir*ln.edgeScrollLines);const hr=Lc(An,ln.edgeClientX,ln.edgeClientY-Yu);hr&&To(hr)},60))},[To,hi]),ao=S.useCallback(L=>{if(L.pointerType!=="touch")return!1;const B=Ci.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 W=rs.current;W.longPressMode=Vo.current;const Oe=Mt.current;if(Oe.active&&W.pointerId===null){const Ie=j.closest("[data-selection-handle]");if(Ie instanceof HTMLElement){const st=Se.current,et=Ie.dataset.selectionHandle==="start"?"start":"end";if(st&&Oe.anchor&&Oe.focus){const Et=Ed(Oe.anchor,Oe.focus,st.cols);return Oe.anchor=et==="start"?Et.end:Et.start,Oe.focus=et==="start"?Et.start:Et.end,Oe.dragging=et,Ge(),W.pointerId=L.pointerId,W.tapStartX=L.clientX,W.tapStartY=L.clientY,W.tapDidMove=!1,W.mode="adjust",Rr.current=!0,O(1800),ct.current?.setAttribute("readonly",""),di(),us(),ra(Pl),Wn(!0),!0}}if(!j.closest("[data-terminal-copy-popover]")){zt();try{Se.current?.clearSelection()}catch{}}}if(W.pointerId!==null)return!0;if(Rr.current=!1,wo.current){const Ie=performance.now(),st=L.clientX,et=L.clientY;if(W.lastTapTime!==0&&Ie-W.lastTapTime<=300&&Math.hypot(st-W.lastTapX,et-W.lastTapY)<=25)return ra(Pl),Xr.current=performance.now()+500,wo.current?.(),kn(!0),zr.current&&clearTimeout(zr.current),zr.current=setTimeout(()=>kn(!1),400),W.lastTapTime=0,!0}return W.holdTimer!==null&&(clearTimeout(W.holdTimer),W.holdTimer=null),W.joystickRepeatTimer!==null&&(clearTimeout(W.joystickRepeatTimer),W.joystickRepeatTimer=null),W.joystickDir="",W.copyStart=null,W.copyDidSelect=!1,W.pointerId=L.pointerId,W.originX=L.clientX,W.originY=L.clientY,W.tapStartX=L.clientX,W.tapStartY=L.clientY,W.tapDidMove=!1,W.mode="holding",W.longPressMode==="copy"&&Wn(!0),W.holdTimer=setTimeout(()=>{if(W.holdTimer=null,W.mode==="holding"){if(W.longPressMode==="copy"){const Ie=Se.current,st=Ie?Lc(Ie,W.tapStartX,W.tapStartY):null;if(!Ie||!st){W.mode="idle";return}W.mode="copy",Rr.current=!0,O(1800),ct.current?.setAttribute("readonly",""),W.copyStart=st,W.copyDidSelect=!1,di(),us(),Ie.clearSelection(),ra(Pl),Wn(!0);return}W.mode="arrow",Rr.current=!0,O(1e3),di(),us(),ra(Pl),Wn(!0),requestAnimationFrame(()=>{$n({visible:!0,activeDir:""})})}},350),!0},[Wn,Ge,zt]),ha=S.useCallback((L,B)=>{if(L.pointerType!=="touch")return"neutral";const j=rs.current;if(j.mode==="arrow"&&L.pointerId!==j.pointerId||j.mode==="copy"&&L.pointerId!==j.pointerId||j.mode!=="arrow"&&j.mode!=="copy"&&L.pointerId!==j.pointerId)return"neutral";const W=L.clientX-j.tapStartX,Oe=L.clientY-j.tapStartY;if(Math.hypot(W,Oe)>10&&(j.tapDidMove=!0),j.mode==="holding"){if(!B)return j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),Wn(!1),Rr.current=!1,j.mode="idle","neutral";const Ie=L.clientX-j.originX,st=L.clientY-j.originY;return j.longPressMode==="copy"&&Math.hypot(Ie,st)>20?(j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),Wn(!1),Rr.current=!1,j.mode="idle","release"):Math.hypot(Ie,st)>20?(j.holdTimer!==null&&(clearTimeout(j.holdTimer),j.holdTimer=null),Wn(!1),j.mode="idle","release"):"claim"}if(j.mode==="adjust"){if(!B)return"claim";di();const Ie=Se.current,st=Mt.current;if(!Ie||!st.active||!st.anchor||!st.focus)return"claim";const et=Lc(Ie,L.clientX,L.clientY-Yu);return et&&(To(et),da(L.clientX,L.clientY)),"claim"}if(j.mode==="copy"){if(!B)return"claim";di();const Ie=Se.current;if(!Ie||!j.copyStart)return"claim";const st=Lc(Ie,L.clientX,L.clientY-Yu);return st&&(To(st),da(L.clientX,L.clientY)),"claim"}if(j.mode==="arrow"){if(!B)return"claim";const Ie={up:"\x1B[A",down:"\x1B[B",left:"\x1B[D",right:"\x1B[C"},st=L.clientX-j.tapStartX,et=L.clientY-j.tapStartY,Et=oS(st,et,j.joystickDir);if(Et&&Et!==j.joystickDir&&(j.originX=L.clientX,j.originY=L.clientY),Et){const lr=L.clientX-j.originX,an=L.clientY-j.originY,Br=Math.hypot(lr,an);if(j.repeatIntervalMs=aS(Br),Et!==j.joystickDir){j.joystickRepeatTimer!==null&&clearTimeout(j.joystickRepeatTimer);const An=j.joystickDir==="";j.joystickDir=Et,Ka.current(Ie[Et]);const ln=performance.now();ln-j.lastHapticTime>120&&(ra(Pl),j.lastHapticTime=ln);const hr=An?400:300;j.joystickRepeatTimer=setTimeout(function dn(){if(j.joystickDir!==Et)return;Ka.current(Ie[Et]);const cn=performance.now();cn-j.lastHapticTime>120&&(ra(Pl),j.lastHapticTime=cn),j.joystickRepeatTimer=setTimeout(dn,j.repeatIntervalMs)},hr)}$n({visible:!0,activeDir:Et})}else j.joystickRepeatTimer!==null&&(clearTimeout(j.joystickRepeatTimer),j.joystickRepeatTimer=null),j.joystickDir="",$n({visible:!0,activeDir:""});return"claim"}return"neutral"},[Wn,To,da]),Ys=S.useCallback(L=>{if(L.pointerType!=="touch"||L.pointerId!==rs.current.pointerId)return;const B=rs.current;if(B.mode==="copy"){di(),us(),hi(),Wn(!1);const W=Se.current;let Oe=null;if(W&&B.copyStart&&(Oe=Lc(W,L.clientX,L.clientY-Yu),Oe&&(B.copyDidSelect=sf(W,B.copyStart,Oe)||B.copyDidSelect)),W&&B.copyDidSelect&&W.hasSelection()&&B.copyStart){const Ie=Mt.current;Ie.active=!0,Ie.anchor=B.copyStart,Ie.focus=Oe??B.copyStart,Ie.dragging=null,sr(),vt({x:L.clientX,y:L.clientY}),O(1800),ra(Pl)}else aa.current?.(!1);B.holdTimer!==null&&(clearTimeout(B.holdTimer),B.holdTimer=null),B.copyStart=null,B.copyDidSelect=!1,B.pointerId=null,B.mode="idle",Rr.current=!1;return}if(B.mode==="adjust"){di(),us(),hi(),Wn(!1),Mt.current.dragging=null,sr(),vt({x:L.clientX,y:L.clientY}),O(1800),B.pointerId=null,B.mode="idle",Rr.current=!1;return}if(B.mode==="arrow"){di(),us(),Wn(!1),$n({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",Rr.current=!1;return}const j=Ci.current;if(j&&!B.tapDidMove){const W=L.target;W instanceof HTMLElement&&j.contains(W)&&!W.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="",Wn(!1),Rr.current=!1,B.copyStart=null,B.copyDidSelect=!1,B.pointerId=null,B.mode="idle"},[Wn,di,O,hi,sr,vt]),Xa=S.useCallback(()=>{const L=rs.current;Wn(!1),hi(),L.mode==="arrow"&&$n({visible:!1,activeDir:""}),L.mode==="adjust"&&(Mt.current.dragging=null,sr(),vt()),L.holdTimer!==null&&(clearTimeout(L.holdTimer),L.holdTimer=null),L.joystickRepeatTimer!==null&&(clearTimeout(L.joystickRepeatTimer),L.joystickRepeatTimer=null),L.joystickDir="",Rr.current=!1,L.copyStart=null,L.copyDidSelect=!1,L.pointerId=null,L.tapDidMove=!1,L.mode="idle"},[Wn,hi,sr,vt]);hg({name:`long-press:${e}`,priority:HC,container:()=>qe.current,onPointerDown:U?ao:void 0,onPointerMove:U?ha:void 0,onPointerUp:U?Ys:void 0,onPointerCancel:U?Xa:void 0});const gn=S.useCallback((L={})=>{Tt.current+=1,K.current="",Qe.current=null,Fe.current=0,fe.current&&(fe.current=!1,L.notifyFlowResume===!0&&ce.current?.(!1)),De.current=null,we.current=!1,me.current=null,bt.current=""},[]),ps=S.useCallback((L="unknown")=>{const B=de.current,j=Se.current,W=qe.current;if(!B||!j||!W||!j.element||!j.cols||!j.rows)return;const Oe=W.getBoundingClientRect();if(Oe.width<24||Oe.height<24){Zt("skip fit: container too small",{reason:L,width:Math.round(Oe.width),height:Math.round(Oe.height)});return}try{const Ie={cols:j.cols,rows:j.rows},st=j.buffer.active,et=_C(st.type,st.baseY,st.viewportY),Et=B.proposeDimensions();if(!Et||Et.cols<=0||Et.rows<=0)return;const lr=yg(j,Ie.rows),an=TC({reason:L,currentCols:Ie.cols,currentRows:Ie.rows,proposedCols:Et.cols,proposedRows:Et.rows});let Br=0;if(an.accept){pt.current&&zn.current&&(Ie.cols!==Et.cols||Ie.rows!==Et.rows)&&Ee.current?.begin();const ln=j.options.smoothScrollDuration;try{j.options.smoothScrollDuration=0,j.resize(Et.cols,Et.rows),Br=yg(j,Et.rows),et&&j.scrollToBottom()}finally{j.options.smoothScrollDuration=ln}ut.current=0}(lr>0||Br>0)&&(j.refresh(0,Math.max(0,j.rows-1)),Zt("xterm buffer invariant repaired",{reason:L,before:lr,after:Br,cols:j.cols,rows:j.rows}));const An={cols:j.cols,rows:j.rows};Zt("fit",{reason:L,backend:"xterm",width:Math.round(Oe.width),height:Math.round(Oe.height),before:Ie,proposed:Et,next:An,hysteresis:an,changed:Ie.cols!==An.cols||Ie.rows!==An.rows})}catch{Ee.current?.cancel()}},[Zt]),Gn=S.useCallback(L=>{const B=Se.current;if(B)try{B.refresh(0,Math.max(0,B.rows-1)),Zt("terminal refreshed (sync)",{reason:L,cols:B.cols,rows:B.rows,hasWebgl:!!It.current})}catch(j){Zt("terminal refresh (sync) failed",{reason:L,error:j})}},[Zt]),ks=S.useCallback(L=>{const B=St.current;if(B){try{B.dispose()}catch{}St.current=null}const j=It.current;if(!j)return!1;Ee.current?.cancel();try{j.dispose()}catch{}return It.current=null,Zt("renderer disposed",{type:"webgl",reason:L}),!0},[Zt]),lo=S.useCallback((L,B)=>{if(It.current)return!0;try{const j=new wA({customGlyphs:Ne});return St.current=j.onContextLoss(()=>{Zt("webgl context loss",{reason:"onContextLoss"}),Ht.current=!0,typeof window<"u"&&window.setTimeout(()=>{un("webgl-context-loss",{forceRendererRecreate:!0})},0)}),Ee.current?.cancel(),L.loadAddon(j),It.current=j,Ht.current=!1,Zt("renderer",{type:"webgl",reason:B,mobile:U,mode:Le.current}),Gn(`webgl-enabled:${B}`),ps(`webgl-enabled:${B}`),Be.current=!0,!0}catch(j){return Zt("webgl load failed, fallback to dom renderer",{reason:B,error:j,mobile:U,mode:Le.current}),!1}},[Zt,Ne,U,ps,Gn]),qo=200,co=S.useRef(0),Di=S.useRef(new Map),fi=S.useRef(new Map),wn=S.useRef(rf()),re=S.useRef(null),Pe=S.useRef(null),rt=S.useRef(-1),Dt=S.useRef(new Map),Be=S.useRef(!1),pt=S.useRef(!1),yr=S.useRef(ug()),Ar=S.useRef(null),on=S.useRef(null),wr=S.useCallback(()=>{Ar.current!==null&&(clearTimeout(Ar.current),Ar.current=null),on.current=null},[]),Bn=S.useCallback(()=>{const L=Di.current;L.forEach(B=>cancelAnimationFrame(B)),L.clear(),fi.current.clear()},[]),Sr=S.useCallback(()=>{re.current!==null&&(window.clearTimeout(re.current),re.current=null)},[]),ms=S.useRef(()=>{}),Ss=S.useCallback(L=>{Sr(),at.current?.(!1),ee.current(L.cols,L.rows,L.seq),re.current=window.setTimeout(()=>{re.current=null;const B=cg(wn.current,L.seq);wn.current=B.state,B.request&&pt.current?(Zt("resize ack timeout; retrying",{seq:L.seq,retrySeq:B.request.seq,cols:B.request.cols,rows:B.request.rows}),ms.current(B.request)):B.exhausted&&(Ee.current?.cancel(),Zt("resize ack timeout; leaving size unconfirmed",{seq:L.seq,cols:L.cols,rows:L.rows}))},1200)},[Sr,Zt]);ms.current=Ss;const Ks=S.useCallback((L,B)=>{if(!pt.current)return;const j=EC(wn.current,{cols:L,rows:B});wn.current=j.state,j.request&&Ss(j.request)},[Ss]),Us=S.useCallback((L,B)=>{const j=BC(yr.current,Date.now());if(j.action==="send"){on.current=null,Ks(L,B);return}on.current={cols:L,rows:B},Ar.current===null&&(Ar.current=setTimeout(()=>{Ar.current=null;const W=on.current;on.current=null,W&&(yr.current=jC(Date.now()),Ks(W.cols,W.rows))},Math.max(0,j.readyAt-Date.now())))},[Ks]),Ja=1500,_l=400,Qi=S.useRef(0),Xs=S.useRef(0),s0=S.useCallback((L,B,j)=>{if(!Number.isFinite(L)||!Number.isFinite(B)||L<=0||B<=0)return;const W=Math.floor(L),Oe=Math.floor(B);wn.current=NC(wn.current,{cols:W,rows:Oe}),Qi.current=Date.now(),Zt("pty-size broadcast received",{cols:W,rows:Oe,source:j??"unknown"})},[Zt]),i0=S.useCallback(L=>{const B=Se.current;if(!B||!B.cols||!B.rows||!pt.current||typeof document<"u"&&(document.visibilityState!=="visible"||!Oc()))return;const j=Date.now();if(j-Qi.current<Ja||j-Xs.current<_l)return;const W=B.cols,Oe=B.rows,Ie=wn.current.confirmed;Ie&&Ie.cols===W&&Ie.rows===Oe||(Xs.current=j,Zt("ensureSizeMatches push",{reason:L,cols:W,rows:Oe,lastServerSize:Ie}),Ks(W,Oe))},[Zt,Ks]),Na=S.useCallback((L,B)=>{const j=Se.current,W=de.current;if(!j||!W)return;if(!Be.current){Zt("refresh skipped: renderer not ready",{reason:L});return}if(B.dedupeKey!==void 0){if(Dt.current.get(L)===B.dedupeKey){Zt("refresh deduped",{reason:L,dedupeKey:B.dedupeKey});return}Dt.current.set(L,B.dedupeKey)}Zt("refresh",{reason:L,options:B});const Oe=B.forceRendererRecreate===!0||Ht.current||Je&&!!It.current&&DS.has(L)&&/Android/i.test(navigator.userAgent);let Ie=!1;Oe&&(Ht.current=!1,Je?(ks(`refresh:${L}`),lo(j,`refresh:${L}`)||Gn(`refresh:${L}:webgl-fallback`),Ie=!0):(Gn(`refresh:${L}`),Ie=!0)),kC(B.forceRedraw===!0,L==="dpr-change",Ie)?Gn(`refresh:${L}`):Ie||Zt("terminal redraw skipped: fit/write already repaints",{reason:L});const st={cols:j.cols,rows:j.rows};ps(`refresh:${L}`);const et={cols:j.cols,rows:j.rows};if(B.skipResizePush||CC({before:st,after:et,lastServerSize:wn.current.confirmed,reconcileServerSize:B.reconcileServerSize})&&Us(et.cols,et.rows),!B.skipScrollToBottom&&L!=="resize"&&L!=="dpr-change"){const lr=requestAnimationFrame(()=>{const An=Se.current;if(An&&An.buffer.active.type!=="alternate")try{An.scrollToBottom()}catch{}}),an=Di.current,Br=an.get(L);Br!==void 0&&cancelAnimationFrame(Br),an.set(L,lr)}},[Zt,Je,ks,lo,Gn,ps,Us]),un=S.useCallback((L,B={})=>{if(Se.current,L==="session-key-change"&&(wn.current=rf(),Sr(),wr(),yr.current=ug(),Dt.current.clear(),Bn()),!B.force&&(L==="visibility"||L==="bfcache"||L==="online")){const W=Date.now();if(W-co.current<qo){Zt("refresh throttled",{reason:L});return}co.current=W}if(fi.current.set(L,B),Di.current.has(L))return;const j=requestAnimationFrame(()=>{const W=fi.current.get(L)??{};Di.current.delete(L),fi.current.delete(L),Na(L,W)});Di.current.set(L,j)},[Zt,Bn,Sr,wr,Na]),J0=S.useCallback(L=>{const B=Di.current.get(L);if(B===void 0)return;const j=fi.current.get(L)??{};cancelAnimationFrame(B),Di.current.delete(L),fi.current.delete(L),Na(L,j)},[Na]);Ki.current=()=>J0("resize"),S.useEffect(()=>()=>{Bn(),$t.current!==null&&(window.clearTimeout($t.current),$t.current=null)},[e,Bn]),S.useEffect(()=>{wn.current=rf(),Sr(),Dt.current.clear()},[e,Sr]);const Xi=S.useCallback(()=>{if(we.current)return;const L=Se.current;if(!L){gn();return}if(!K.current)return;const B=K.current,j=B.length,W=Qe.current;K.current="",Qe.current=null,we.current=!0;const Oe=Ee.current,Ie=Oe?.generation;L.write(B,()=>{if(Ie!==void 0&&Oe?.written(Ie),we.current=!1,Fe.current-=j,Fe.current<0&&(Fe.current=0),W!==null&&$.current?.(W),fe.current&&Fe.current<BS&&(fe.current=!1,ce.current?.(!1)),K.current){Xi();return}const st=++Tt.current,et=()=>{if(st!==Tt.current||we.current||K.current)return;const Et=L.buffer.active;_e.current?.({x:Et.cursorX,y:Et.cursorY,rows:L.rows,lastProcessedChunkId:me.current})};typeof window>"u"?et():window.requestAnimationFrame(()=>{window.requestAnimationFrame(et)})})},[gn]);gt.current=Xi;const Zo=S.useCallback(()=>{if(De.current!==null)return;const L=++lt.current;De.current=L,queueMicrotask(()=>{De.current===L&&(De.current=null,Xi())})},[Xi]),Da=S.useCallback((L,B)=>{L&&(Tt.current+=1,K.current+=L,Qe.current=B,Fe.current+=L.length,!fe.current&&Fe.current>=QS&&(fe.current=!0,ce.current?.(!0)),Zo())},[Zo]);return S.useEffect(()=>{let L=!1,B=null,j=null,W=[];const Oe=qe.current;return Oe?(Oe.tabIndex=U?-1:0,(async()=>{if(Ye.current?.(!1),ae("loading"),it(null),Ur(!0),await OS(),!L)try{const st=US(Oe,Ag(ur),Kr,hs,Or),et=new V7({...st?{cols:st.cols,rows:st.rows}:{},allowProposedApi:!0,fontFamily:Ag(ur),fontSize:Kr,fontWeight:Tg(sn),fontWeightBold:Tg(Kn),theme:FS(Z),logLevel:"off",cursorBlink:!Je,cursorStyle:"block",cursorInactiveStyle:pn.current?"bar":"none",scrollback:f?2e3:5e3,scrollbar:{showScrollbar:!1},allowTransparency:F9(Yn,dt),convertEol:kr,drawBoldTextInBrightColors:P,rescaleOverlappingGlyphs:je,minimumContrastRatio:mn,letterSpacing:hs,lineHeight:Or,smoothScrollDuration:wt&&!oe.current?125:0,scrollOnEraseInDisplay:!0,tabStopWidth:8,vtExtensions:{kittyKeyboard:!0},windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}}),Et=new q7;et.loadAddon(Et),et.loadAddon(new LA),et.registerLinkProvider(gS(et,(hr,dn)=>{Xe.current?.(hr,dn)}));const lr=new DA;et.loadAddon(lr),et.unicode.activeVersion=he,et.loadAddon(new $A({highlightLimit:1e3}));const an=new VA;et.loadAddon(an),tt.current=an,et.loadAddon(new fC);try{et.loadAddon(new ZA(void 0,new Tx))}catch(hr){Zt("clipboard addon skipped",{error:hr})}B=et,Se.current=et,de.current=Et,te.current=typeof window<"u"?window.devicePixelRatio:1,et.open(Oe),Ee.current=IC(et),Re&&et.loadAddon(new hC({fontFeatureSettings:FC,fallbackLigatures:UC}));try{const hr=et._core;hr?.coreService&&(hr.coreService.isCursorInitialized=!0),et.refresh(0,et.rows-1)}catch{}Je?(lo(et,"init"),Be.current=!0):(Zt("renderer",{type:"dom",reason:"renderer-mode-dom-fallback",mobile:U,mode:Yn}),Be.current=!0),Ur(!1),is();const Br=hr=>{if(hr.ctrlKey||hr.metaKey){hr.preventDefault();const dn=hr.deltaY>0?-1:1;dd(t,Kr+dn)}};if(Ce.current=Br,Oe.addEventListener("wheel",Br,{passive:!1}),!U){let hr=0,dn=null,cn=null,Si=null;const el=()=>{Si=null,Ki.current();const gs=Ol(Se.current,Kr,Or),Is=nt.current+hr;hr=0;const _s=Math.trunc(Is/gs);if(nt.current=Is-_s*gs,_s!==0){const Ji=_s>0?"down":"up",tl=Se.current,o0=Math.max(3,Math.floor((tl?.rows??24)/2)),a0=Math.abs(_s);a0>o0&&(nt.current=0),Ia.current(Ji,Math.min(a0,o0),dn??void 0,cn??void 0)}};et.attachCustomWheelEventHandler(gs=>{if(gs.ctrlKey||gs.metaKey||gs.shiftKey)return!0;if(gs.deltaY===0)return!1;if(!Se.current||!zn.current)return!0;const _s=Ol(Se.current,Kr,Or);let Ji=gs.deltaY;return gs.deltaMode===1?Ji=gs.deltaY*_s:gs.deltaMode===2&&(Ji=gs.deltaY*(Oe.clientHeight||_s*20)),hr+=Ji,dn=gs.clientX,cn=gs.clientY,Si===null&&(Si=requestAnimationFrame(el)),gs.preventDefault(),!1})}const An=NS(Oe);if(An?(An.classList.add("overlay-scrollbar-target","overlay-scrollbar-container"),ie.current=An,Un()):ie.current=null,un("mount",{skipResizePush:!0,skipScrollToBottom:!0}),Pr.current&&(U?et.focus():ct.current?.focus({preventScroll:!0})),U||es.current(),W.push(et.onRender(()=>{const hr=et.buffer.active;$e.current?.({x:hr.cursorX,y:hr.cursorY,rows:et.rows}),U||es.current()})),!U){try{const hr=et.textarea;if(hr){hr.tabIndex=-1,hr.setAttribute("aria-hidden","true"),hr.setAttribute("readonly",""),hr.value="";const dn=()=>{ct.current?.focus({preventScroll:!0})};hr.addEventListener("focus",dn),W.push({dispose:()=>hr.removeEventListener("focus",dn)})}}catch{}try{W.push(et.onCursorMove(()=>es.current())),W.push(et.onResize(()=>es.current()))}catch{}}W.push(et.onData(hr=>{Te.current(hr)}));const ln=hr=>{const dn=typeof window<"u"?window.devicePixelRatio:1,cn=Math.abs(dn-te.current)>.001;return cn&&(te.current=dn,Zt("device pixel ratio changed",{value:dn,source:hr})),cn};if(j=new ResizeObserver(hr=>{if(!SC(!!Dn.current,cs.current)){Zt("resize observer skipped: hidden mobile session");return}Kt.current=void 0;const dn=hr[0];dn&&Zt("resize observer",{width:Math.round(dn.contentRect.width),height:Math.round(dn.contentRect.height)});const cn=ln("resize-observer");un(cn?"dpr-change":"resize")}),j.observe(Oe),typeof window<"u"){const hr=()=>{ln("window-resize")&&un("dpr-change")};window.addEventListener("resize",hr),W.push({dispose:()=>window.removeEventListener("resize",hr)});const dn=window.visualViewport;if(dn){const cn=()=>{ln("visual-viewport-resize")&&un("dpr-change")};dn.addEventListener("resize",cn),W.push({dispose:()=>dn.removeEventListener("resize",cn)})}}ps("init-fit"),ae("ready"),Ye.current?.(!0)}catch(st){console.error("Failed to initialize terminal:",st),Ur(!1),ae("error"),it(st instanceof Error?st.message:"Failed to load terminal")}})(),()=>{Ye.current?.(!1),L=!0,ye.current?.(!1),ft.current?.(),ft.current=null,Me.current=!1,_t.current!==null&&(clearTimeout(_t.current),_t.current=null),ve.current=!1,Jr.current=null,Lt(),Nn({active:!1,text:""});for(const st of W)st.dispose();j?.disconnect(),Ce.current&&(Oe.removeEventListener("wheel",Ce.current),Ce.current=null),Ee.current?.dispose(),Ee.current=null,ks("component-unmount"),B?.dispose(),Se.current=null,de.current=null,ie.current=null,gn({notifyFlowResume:!0}),Sr(),wr()}):void 0},[ps,ur,Kr,sn,Kn,hs,Or,mn,P,he,Ne,je,Re,dt,wt,Z,gn,Lt,U,lo,ks,Zt,Sr,wr]),S.useEffect(()=>{const L=Se.current;L&&(L.options.smoothScrollDuration=wt&&!be?125:0)},[wt,be,_r]),S.useEffect(()=>{const L=Se.current;L&&(L.options.cursorInactiveStyle=Ue?"bar":"none",Ue||L.blur())},[Ue,_r]),S.useEffect(()=>{const L=Se.current;if(L){if(Je){if(L.options.cursorBlink=!1,lo(L,"renderer-mode-change")&&dt&&!Qt.current)try{L.loadAddon(new _T({storageLimit:64,pixelLimit:1<<24,sixelSupport:!0,iipSupport:!0,kittySupport:!0})),Qt.current=!0}catch(j){Zt("image addon skipped",{error:j})}return}L.options.cursorBlink=!0,ks("renderer-mode-change")&&(Gn("renderer-mode-change:webgl-disabled"),ps("renderer-mode-change:webgl-disabled"))}},[Je,dt,lo,ks,Gn,ps,Zt]),S.useEffect(()=>{const L=Se.current;L&&(me.current!==null&&L.reset(),gn(),Ve.current="",yt.current=0,ct.current&&(ct.current.value=""),un("session-reset",{skipScrollToBottom:!0}),Pr.current&&(Dn.current?L.focus():ct.current?.focus({preventScroll:!0})))},[e,_r,un,gn]),S.useEffect(()=>{if(!U||typeof document>"u")return;let L=null;const B=()=>{L=null;const W=ct.current;if(!W||document.activeElement!==W||Me.current)return;const Oe=Ve.current,Ie=Cc(W.value);if(Ie!==Oe||Ie.includes("\r")||!ze())return;const st=Math.min(mg(W),Array.from(Ie).length),et=st-yt.current;if(et===0)return;const Et=Se.current,lr=et<0?(Et?Xu(Et,"D"):"\x1B[D").repeat(-et):(Et?Xu(Et,"C"):"\x1B[C").repeat(et);Te.current(lr),yt.current=st},j=()=>{L===null&&(L=requestAnimationFrame(B))};return document.addEventListener("selectionchange",j),()=>{document.removeEventListener("selectionchange",j),L!==null&&cancelAnimationFrame(L)}},[U,ze]),S.useEffect(()=>{if(!U)return;const L=Yi();return ft.current=L,()=>{L(),ft.current=null}},[U,Yi]),S.useEffect(()=>{const L=Se.current;if(L)try{L.options.scrollback=f?0:1e3}catch{}},[f,_r]),S.useEffect(()=>{const L=Se.current;if(!L)return;if(s.length===0){me.current!==null&&(L.reset(),gn(),un("buffer-reset",{skipResizePush:!0,skipScrollToBottom:!0}));return}const B=me.current;let j;if(B===null)j=s;else{const W=s.findIndex(Oe=>Oe.id===B);j=W>=0?s.slice(W+1):s}if(j.length>0){const W=j.map(et=>et.data).join(""),Oe=bt.current+W,{cleaned:Ie,remainder:st}=RS(Oe);bt.current=st,Ie?Da(Ie,j[j.length-1].id):$.current?.(j[j.length-1].id)}me.current=s[s.length-1].id},[s,_r,Da,un,gn]),S.useImperativeHandle(Ae,()=>({serializeSnapshot:()=>Se.current?tt.current?.serialize({scrollback:100})??null:null,focus:()=>{if(Dn.current){Hr();return}ct.current?.focus({preventScroll:!0})},blur:()=>{const L=ct.current;ui(L),L&&typeof document<"u"&&document.activeElement===L&&L.blur(),Dn.current&&L?.setAttribute("readonly",""),ye.current?.(!1)},clear:()=>{const L=Se.current;L&&(L.reset(),gn(),un("clear",{skipResizePush:!0,skipScrollToBottom:!0}))},prepareScreenReplacement:()=>{gn({notifyFlowResume:!0})},copySelectionOrViewport:async()=>{const L=Se.current;if(!L)return!1;const B=L.hasSelection()?L.getSelection():$S(L),j=await Sg(B);return j&&L.hasSelection()&&Ge(),j},pasteClipboardText:async()=>{O();const L=await In(ct.current);return Ao.current?.(L),L},sendSequence:(L,B)=>{ir(L,null,B)},getDimensions:()=>{const L=Se.current;return!L||!L.cols||!L.rows?null:{cols:L.cols,rows:L.rows}},requestRefresh:un,setSessionReady:L=>{pt.current=L,L||(Ee.current?.cancel(),Sr(),wn.current=DC(wn.current),Pe.current=null,rt.current=-1,at.current?.(!1))},acknowledgeResize:L=>{if(!L.ok&&typeof L.seq=="number"){const Ie=cg(wn.current,L.seq);if(!Ie.request&&!Ie.exhausted)return;Sr(),wn.current=Ie.state,Ie.request&&pt.current?ms.current(Ie.request):Ie.exhausted&&Ee.current?.cancel();return}const B=RC(wn.current,L);if(!B.accepted)return;Sr(),wn.current=B.state,Zt("resize acknowledged",{seq:L.seq,ok:L.ok,cols:L.cols,rows:L.rows,screenSyncPending:L.screenSyncPending===!0,screenSyncGeneration:L.screenSyncGeneration});const j=Se.current,W=B.state.confirmed;if(!!!(j&&W&&j.cols===W.cols&&j.rows===W.rows)){at.current?.(!1);return}if(L.screenSyncPending&&typeof L.screenSyncGeneration=="number"){Pe.current=L.screenSyncGeneration;const Ie=rt.current>=L.screenSyncGeneration;at.current?.(Ie),Ie&&(Pe.current=null);return}Pe.current=null,at.current?.(!0)},notifyScreenSynchronized:L=>{if(!Number.isFinite(L))return;rt.current=Math.max(rt.current,L);const B=Pe.current;if(B===null||L<B)return;Pe.current=null;const j=Se.current,W=wn.current.confirmed;at.current?.(!!(j&&W&&j.cols===W.cols&&j.rows===W.rows))},notifyServerSize:s0,ensureSizeMatches:i0,requestPtyRedraw:()=>{const L=Se.current;if(!L||!pt.current||wn.current.pending||Pe.current!==null)return;const B=MC(wn.current,{cols:L.cols,rows:L.rows});wn.current=B.state,ms.current(B.request)}}),[U,ui,Hr,gn,In,ir,un,Sr,Zt,Ks,s0,i0]),a.jsxs("div",{ref:qe,"data-termdock-terminal-dropzone":e,className:`relative h-full w-full terminal-viewport-container ${G||""}`,style:{backgroundColor:Z.background,touchAction:as.visible?"none":void 0},role:"button",tabIndex:-1,onPointerDownCapture:Os,onPointerMoveCapture:Mn,onPointerUpCapture:Fs,onPointerCancelCapture:Ho,onTouchStartCapture:L=>{if(qs(L.target)){O(),Qn(Sc);return}en(),Qn(Sc)},onTouchMoveCapture:()=>Qn(Sc),onTouchEndCapture:()=>Qn(_c),onTouchCancelCapture:()=>Qn(_c),onMouseDown:L=>{U||L.button===0&&($t.current!==null&&(window.clearTimeout($t.current),$t.current=null),requestAnimationFrame(()=>{try{ct.current?.focus({preventScroll:!0})}catch{}}))},onMouseUp:L=>{U||L.button===0&&($t.current!==null&&window.clearTimeout($t.current),$t.current=window.setTimeout(()=>{$t.current=null;try{ct.current?.focus({preventScroll:!0})}catch{}},0))},children:[os&&a.jsx("button",{type:"button",role:"alert",onClick:()=>fn(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:os}),Dr&&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:Dr.left,top:Dr.top,WebkitBackdropFilter:"blur(18px)"},onPointerDown:L=>{O(),L.stopPropagation()},onPointerUp:L=>{L.preventDefault(),L.stopPropagation(),la()},onTouchStart:L=>{O(),L.stopPropagation()},onTouchEnd:L=>{L.preventDefault(),L.stopPropagation(),la()},onClick:L=>{L.preventDefault(),L.stopPropagation(),la()},children:[a.jsx(Hy,{size:14,strokeWidth:2.4}),a.jsx("span",{children:Ke("common.copy")})]}),Xt?.start&&a.jsx("div",{"data-selection-handle":"start",className:"absolute z-30 h-11 w-11 select-none",style:{left:Xt.start.left,top:Xt.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)]"})]})}),Xt?.end&&a.jsx("div",{"data-selection-handle":"end",className:"absolute z-30 h-11 w-11 select-none",style:{left:Xt.end.left,top:Xt.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)]"})]})}),Nr&&Yr&&a.jsx(JC,{}),Nr&&xr==="loading"&&!Yr&&a.jsx(XC,{}),xr==="error"&&a.jsx(eS,{message:ar||void 0,onRetry:()=>{window.location.reload()}}),xr==="ready"&&a.jsxs(a.Fragment,{children:[a.jsx("textarea",{ref:ct,"aria-label":Ke("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",...U?{inset:0,touchAction:"none",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",pointerEvents:"auto",fontSize:"16px"}:(()=>{const L=At.x,B=At.y,j={position:"fixed",left:L,top:B,pointerEvents:"none",touchAction:"auto",fontSize:`${Kr}px`,fontFamily:ur,lineHeight:"1",whiteSpace:"pre",boxSizing:"content-box",width:Math.max(1,Math.round(At.cellW)),height:Math.max(1,Math.round(At.cellH))};if(!Ts.active)return j;const W=Ot(Ts.text);return{...j,opacity:1,color:"transparent",WebkitTextFillColor:"transparent",background:"transparent",transition:"none",caretColor:"transparent",textDecorationColor:"transparent",wordBreak:"break-all",zIndex:20,width:W.width,height:W.height,whiteSpace:W.whiteSpace}})()},onContextMenu:L=>{L.preventDefault()},onFocus:()=>{Zt("input anchor focus"),Kt.current=void 0,es.current(),un("focus",{skipResizePush:!0,skipScrollToBottom:!0}),ye.current?.(!0)},onBlur:L=>{U||ui(L.currentTarget);const B=Ni(),j=typeof document<"u"?document.activeElement:null;if(Zt("input anchor blur",{guarded:B,activeTag:j?.tagName??null,activeClass:j?.className??null}),!B){U&&ct.current?.setAttribute("readonly",""),ye.current?.(!1);return}if(typeof window>"u"){ye.current?.(!1);return}window.setTimeout(()=>{le()||ze()||(U&&ct.current?.setAttribute("readonly",""),ye.current?.(!1))},_c)},onBeforeInput:L=>{if(Me.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 W=qr(j,L.currentTarget);U&&Ao.current?.(W)}return}if(B.inputType==="insertLineBreak"){if(ve.current){ve.current=!1,_t.current!==null&&(clearTimeout(_t.current),_t.current=null),L.preventDefault();return}L.preventDefault(),Bt(L.currentTarget);return}if(B.inputType==="deleteContentBackward"||B.inputType==="deleteContentForward"||B.inputType==="deleteByCut"){if(!L.currentTarget.value){L.preventDefault(),Te.current("");return}if(B.inputType==="deleteContentBackward"&&L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),Te.current("");return}return}}},onInput:L=>{if(Me.current)return;const B=L.nativeEvent,j=wC(Ve.current,Cc(L.currentTarget.value),B.inputType);if(j){const W=qr(j,L.currentTarget);U&&Ao.current?.(W);return}dr(L.currentTarget)},onPaste:L=>{if(window.termdockDesktop?.readClipboardFiles){L.preventDefault(),In(L.currentTarget);return}const B=Array.from(L.clipboardData.files);if(B.length&&(B.length>1||!B[0].type.startsWith("image/"))){L.preventDefault(),Hn(B,L.currentTarget);return}const j=B[0];if(j){L.preventDefault(),vn(j,L.currentTarget);return}const W=L.clipboardData.getData("text/plain");if(!W){window.termdockDesktop&&(L.preventDefault(),In(L.currentTarget));return}L.preventDefault();const Oe=qr(W,L.currentTarget);U&&Ao.current?.(Oe)},onKeyDown:L=>{const B=ES(L);if(!B&&!Me.current){if(L.getModifierState("AltGraph"))return;const j=Se.current,W=L.metaKey,Oe=L.ctrlKey,Ie=L.altKey,st=L.shiftKey,et=L.key;if(W&&!Oe&&!Ie&&!st&&et==="Enter"){L.preventDefault(),Bt(L.currentTarget);return}if((W||Oe)&&!Ie&&!st&&(et==="v"||et==="V")){if(window.termdockDesktop?.readClipboardFiles||window.termdockDesktop?.readClipboardImage){L.preventDefault(),In(L.currentTarget);return}return}if(W&&!Oe&&!Ie&&!st&&(et==="c"||et==="C")){L.preventDefault();const lr=j?.hasSelection()?j.getSelection():"";lr&&navigator.clipboard?.writeText(lr).catch(()=>{});return}if((W||Oe)&&!Ie&&!st&&(et==="k"||et==="K")){L.preventDefault(),j&&(j.reset(),gn(),un("clear",{skipResizePush:!0,skipScrollToBottom:!0})),L.currentTarget.value="",Ve.current="",yt.current=0;return}if(W&&!Oe&&!Ie&&!st&&et==="Backspace"){L.preventDefault(),ir("",L.currentTarget);return}if(W&&!Oe&&!Ie&&!st&&et==="Delete"){L.preventDefault(),ir("\v",L.currentTarget);return}if(W&&!Oe&&!Ie&&!st&&et==="ArrowLeft"){L.preventDefault(),ir("",L.currentTarget);return}if(W&&!Oe&&!Ie&&!st&&et==="ArrowRight"){L.preventDefault(),ir("",L.currentTarget);return}if(W)return;if(Ie&&!Oe&&!W&&!st&&et==="Backspace"){L.preventDefault(),ir("\x1B",L.currentTarget);return}if(Ie&&!Oe&&!W&&!st&&et==="Delete"){L.preventDefault(),ir("\x1Bd",L.currentTarget);return}if(Ie&&!Oe&&!W&&!st&&et==="ArrowLeft"){L.preventDefault(),ir("\x1Bb",L.currentTarget);return}if(Ie&&!Oe&&!W&&!st&&et==="ArrowRight"){L.preventDefault(),ir("\x1Bf",L.currentTarget);return}const Et=pw(L,j?.modes?.applicationCursorKeysMode===!0);if(Et!==null){L.preventDefault(),ir(Et,L.currentTarget);return}}if(L.key==="Enter"||L.key==="Go"||L.key==="done"||L.key==="send"){if(B||Me.current){L.preventDefault();return}if(ve.current){ve.current=!1,_t.current!==null&&(clearTimeout(_t.current),_t.current=null),L.preventDefault();return}L.preventDefault(),Bt(L.currentTarget);return}if(L.key==="Backspace"){if(B||Me.current)return;if(!L.currentTarget.value){L.preventDefault(),Te.current("");return}if(L.currentTarget.selectionStart===0&&L.currentTarget.selectionEnd===0){L.preventDefault(),Te.current("");return}}},onCompositionStart:()=>{Me.current=!0,En(),Nn({active:!0,text:""})},onCompositionUpdate:L=>{Me.current=!0;const B=L.data??L.currentTarget.value;Nn(j=>j.active&&j.text===B?j:{active:!0,text:B})},onCompositionEnd:L=>{Me.current=!1,ve.current=!0,_t.current!==null&&clearTimeout(_t.current),_t.current=setTimeout(()=>{ve.current=!1,_t.current=null},50),Nn({active:!1,text:""}),dr(L.currentTarget),Ps()}}),Ts.active&&(()=>{const L=Ot(Ts.text);return a.jsx("div",{"aria-hidden":"true","data-terminal-ime-composition":"true",style:{position:"fixed",left:At.x,top:At.y,zIndex:21,pointerEvents:"none",overflow:"hidden",boxSizing:"content-box",width:L.width,height:L.height,margin:0,padding:0,color:Z.foreground,background:Z.background,boxShadow:`-1px 0 0 1px ${Z.background}`,fontSize:`${Kr}px`,fontFamily:ur,lineHeight:"1",textDecorationLine:"underline",textDecorationStyle:"solid",textDecorationColor:Z.foreground,wordBreak:"break-all",whiteSpace:L.whiteSpace,transition:"none"},children:Ts.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:Ln?1:0,transform:Ln?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:"Tab"}),a.jsx("div",{ref:$r,"aria-hidden":!0,className:"absolute left-1/2 top-6 z-30 pointer-events-none transition-opacity duration-150 ease-out",style:{opacity:as.visible?1:0,transform:as.visible?"translate(-50%, 0) scale(1)":"translate(-50%, -8px) scale(0.9)"},children:as.visible&&(()=>{const{activeDir:L}=as,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"})})})]})})()})]})]})});Ox.displayName="TerminalViewport";const HS=Ox,WS=e=>{const t=e?.retry;return{maxRetries:t?.maxRetries??3,initialRetryDelay:t?.initialDelayMs??1e3,maxRetryDelay:t?.maxDelayMs??8e3,connectionTimeout:e?.connectionTimeoutMs??1e4}},GS=()=>({async createSession(e){return Ky(e)},connect(e,t,r){const s=Yy(e,t.onEvent,t.onError,{...WS(r),getDimensions:r?.getDimensions});return{close:()=>s()}},async sendInput(e,t){await N5(e,t)},async resize(e){await Zy(e.sessionId,e.cols,e.rows,e.seq)},async close(e){await R5(e)},async restartSession(e,t){return qy(e,{cols:t.cols,rows:t.rows,mode:t.mode,tmuxSessionName:t.tmuxSessionName})},async forceKill(e){await Vy(e)},async tmuxAction(e,t){return Gy(e,t)},async listTmuxSessions(){return jf()},async getTmuxStatus(){return Bf()},async checkHealth(e){return Wy(e)}}),VS="\x1B",qS=/\x1b\[[IO]/g,ZS=/\x1b\[<[0-9]+;[0-9]+;[0-9]+[mM]/y,YS=/\x1b\[[0-9]+;[0-9]+;[0-9]+M/y;function Lg(e,t,r){return e.lastIndex=r,e.exec(t)?e.lastIndex:-1}function KS(e){const t=e.replace(qS,"");if(t.length===0)return e.length>0;let r=0;for(;r<t.length;){let s=Lg(ZS,t,r);if(s<0&&(s=Lg(YS,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 XS(e){return e===VS}function rp(e,t){return e.label.trim().length>0?e.label:`Key ${t+1}`}const $c=15;function JS(){return Fx.map(e=>e.id)}const Fx=[{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 nu(){return Fx.map(e=>({...e,programs:[...e.programs],includeAlt:e.includeAlt,rowLayout:[...e.rowLayout],actions:e.actions.map(t=>({...t})),showOnDesktop:e.showOnDesktop}))}function Up(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 Ux(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.length>0?t:null}const $p=/^\/(.+)\/([gimsuy]*)$/;function kg(e){return $p.test(e.trim())}function Rd(e){const t=e.trim().match($p);if(!t)return null;try{return new RegExp(t[1]??"",t[2]??"")}catch{return null}}function $x(e){if(typeof e!="string")return null;const t=e.trim();return t?$p.test(t)?Rd(t)?t:null:t.toLowerCase():null}function Ig(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 Eg="||",e_=120;function t_(e){return e.includes(Eg)?e.split(Eg).filter(t=>t.length>0):[e]}function M0(e){const t=new Set,r=e.map((i,c)=>{const u=typeof i.id=="string"&&i.id.trim().length>0?i.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 i.label=="string"&&i.label.trim().length>0?i.label.trim():"Preset",programs:Array.isArray(i.programs)?i.programs.map(p=>$x(p)).filter(p=>!!p):[],includeAlt:typeof i.includeAlt=="boolean"?!!i.includeAlt:!1,rowLayout:Up(i.rowLayout),showOnDesktop:typeof i.showOnDesktop=="boolean"?!!i.showOnDesktop:!1,actions:Array.isArray(i.actions)?i.actions.map((p,g)=>{const x={id:typeof p.id=="string"&&p.id.trim().length>0?p.id:`${f}-action-${g+1}`,label:typeof p.label=="string"?p.label:`Key ${g+1}`,sequence:typeof p.sequence=="string"?p.sequence:""};return typeof p.doubleTapSequence=="string"&&(x.doubleTapSequence=p.doubleTapSequence),x}):[]}}).filter(i=>i.id!=="auto"),s=nu()[0];return s&&!r.some(i=>i.id==="default")&&r.unshift(s),r}function r_(e,t){const r=Ux(e);if(!r)return"default";for(const s of t)if(s.id!=="default")for(const i of s.programs){const c=Rd(i);if(c){if(c.test(r))return s.id}else if(r.includes(i))return s.id}return"default"}function Mg(e,t){return e.find(r=>r.id===t)??e.find(r=>r.id==="default")??nu()[0]}function n_(e){return[{id:"auto",label:"Auto"},...e.map(t=>({id:t.id,label:t.label}))]}function s_(e){return[{id:"auto",label:"Auto"},...e.filter(t=>t.showOnDesktop===!0).map(t=>({id:t.id,label:t.label}))]}function zx(e,t){const r=Up(t),s=[];let i=0,c=0;for(;i<e.length;){const u=r[Math.min(c,r.length-1)]??3;s.push({columns:u,items:e.slice(i,i+u)}),i+=u,c+=1}return s}const Hx=28,Wx=({mode:e,presetLabel:t,title:r,ariaLabel:s,disabled:i,onPointerDown:c,buttonRef:u})=>a.jsx("button",{ref:u,type:"button",onPointerDown:c,tabIndex:-1,disabled:i,className:"h-7 w-7 rounded-full bg-surface-2 shadow-sm text-[11px] font-medium active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center",title:r,"aria-label":s??r,children:e==="auto"?a.jsx(P9,{size:14}):(t.charAt(0)||"?").toUpperCase()}),i_={esc:"\x1B",enter:"\r",home:"\x1B[H",end:"\x1B[F","ctrl-c":"","ctrl-d":"","ctrl-w":"","ctrl-u":""},Ju=8;function o_(e,t){return i_[e]??null}const a_=({visible:e,interactive:t=!0,presentation:r="mobile",activeModifier:s,lockedModifier:i,disabled:c,defaultShowExtended:u=!1,presetLabel:f,presetModeLabel:p,presetMode:g,presetOptions:x,includeAlt:b,presetRowLayout:v,extraActions:w,onKeyPress:k,onTextPress:I,onPastePress:N,onFilePress:M,fileUploadState:D="idle",fileUploadProgress:F=0,longPressMode:Z="arrows",copyFeedback:G="idle",onLongPressModeToggle:U,onModifierToggle:q,onPresetSelect:pe,onExpandedChange:Ue})=>{const{t:be}=Gr(),[Ae,Ke]=S.useState(u),[qe,ie]=S.useState(!1),Se=S.useRef(null),tt=r==="desktop-actions",Ee=tt||Ae,[oe,de]=S.useState(!1),[Te,ee]=S.useState(null),ye=c||!e||!t,ce=c||!e,Ye=S.useRef(null),at=S.useRef(null),_e=S.useRef(null),$=S.useRef(null),$e=S.useRef(null),Xe=S.useRef(G),Le=S.useRef(null),K=S.useRef(0),Fe=S.useCallback(Ve=>{if(ye)return;const yt=Ve.target;if(!(yt instanceof Element))return;const Gt=yt.closest("button"),ke=Gt?.hasAttribute("data-mobile-native-action")===!0;Gt&&!ke?(Ve.preventDefault(),ra(Ju)):Gt&&ra(Ju)},[ye]),fe=S.useCallback(Ve=>{Ve.preventDefault()},[]),De=S.useCallback(Ve=>{const yt=Ve.target;ye||yt instanceof HTMLElement&&yt.closest("button")&&yt.blur()},[ye]);S.useEffect(()=>{Ke(u)},[u]),S.useEffect(()=>{tt||Ue?.(Ae)},[tt,Ue,Ae]),S.useEffect(()=>{ye&&(Le.current!==null&&(window.clearTimeout(Le.current.timer),Le.current=null),de(!1),ee(null))},[ye]),S.useEffect(()=>{e||(de(!1),ee(null))},[e]),S.useEffect(()=>{if(!oe)return;const Ve=()=>{const yt=Ye.current?.getBoundingClientRect();yt&&ee({left:Math.max(8,yt.left),top:Math.max(8,yt.top-8)})};return Ve(),window.addEventListener("resize",Ve),window.addEventListener("scroll",Ve,!0),()=>{window.removeEventListener("resize",Ve),window.removeEventListener("scroll",Ve,!0)}},[oe]),S.useEffect(()=>{const Ve=Xe.current;if(Xe.current=G,G==="idle"||G===Ve)return;if($e.current!==null&&window.clearTimeout($e.current),!(typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches))if(G==="copied"){at.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 Gt=[{opacity:0,transform:"scale(0.65)"},{opacity:.75,transform:"scale(0.9)",offset:.18},{opacity:0,transform:"scale(1.65)"}];_e.current?.animate?.(Gt,{duration:760,easing:"ease-out"}),$.current?.animate?.(Gt,{duration:760,delay:130,easing:"ease-out"})}else at.current?.animate?.([{transform:"translateX(0)"},{transform:"translateX(-2px)"},{transform:"translateX(2px)"},{transform:"translateX(0)"}],{duration:280,easing:"ease-out"});ra(Ju),G==="copied"&&($e.current=window.setTimeout(()=>{ra(Ju),$e.current=null},90),Z==="copy"&&U?.())},[G,Z,U]),S.useEffect(()=>()=>{$e.current!==null&&window.clearTimeout($e.current)},[]);const lt=S.useCallback((Ve,yt)=>{ye||(Ve.preventDefault(),k(yt))},[k,ye]),Tt=S.useCallback((Ve,yt)=>{ye||(Ve.preventDefault(),q(yt))},[q,ye]),we=S.useCallback(Ve=>{ye||(Ve.preventDefault(),Ke(yt=>{const Gt=!yt;return Gt&&(ie(!0),Se.current!==null&&window.clearTimeout(Se.current),Se.current=window.setTimeout(()=>{ie(!1),Se.current=null},350)),Gt}))},[ye]),me=S.useCallback(()=>{const Ve=typeof performance<"u"?performance.now():Date.now();Ve-K.current<350||(K.current=Ve,N?.())},[N]),Qe=S.useCallback(Ve=>{ye||(Ve.stopPropagation(),Ve.pointerType!=="touch"&&(Ve.preventDefault(),me()))},[ye,me]),gt=S.useCallback(Ve=>{ye||(Ve.preventDefault(),Ve.stopPropagation(),me())},[ye,me]),ft=S.useCallback(Ve=>{ye||D==="uploading"||!M||(Ve.preventDefault(),Ve.stopPropagation(),M())},[D,M,ye]),ct=S.useCallback(Ve=>{ye||Ve.stopPropagation()},[ye]),Kt=250,$t=S.useCallback(()=>{Le.current!==null&&(window.clearTimeout(Le.current.timer),Le.current=null)},[]);S.useEffect(()=>()=>{$t(),Se.current!==null&&(window.clearTimeout(Se.current),Se.current=null)},[$t]);const Qt=S.useCallback((Ve,yt)=>{if(ye)return;if(Ve.preventDefault(),!yt.doubleTapSequence){I(yt.sequence);return}const Gt=Le.current;if(Gt!==null&&Gt.actionId===yt.id){window.clearTimeout(Gt.timer),Le.current=null,I(yt.doubleTapSequence);return}$t();const ke=window.setTimeout(()=>{Le.current=null,I(yt.sequence)},Kt);Le.current={actionId:yt.id,timer:ke}},[$t,I,ye]),ut=S.useCallback(Ve=>{ye||(Ve.preventDefault(),Ve.stopPropagation(),U?.())},[U,ye]),bt=S.useCallback(Ve=>{ye||Ve.stopPropagation()},[ye]),It=S.useCallback(Ve=>{if(ye)return;Ve.preventDefault();const yt=Ve.currentTarget.getBoundingClientRect();ee({left:Math.max(8,yt.left),top:Math.max(8,yt.top-8)}),de(Gt=>!Gt)},[ye]),St=S.useCallback((Ve,yt)=>{ye||(Ve.preventDefault(),de(!1),ee(null),pe(yt))},[pe,ye]),Ht=w.length>0,te=S.useMemo(()=>{const Ve=[{id:"preset",kind:"preset"}];if(!tt&&b&&Ve.push({id:"alt",kind:"alt"}),Ht){const yt=w.map(Gt=>({id:Gt.id,kind:"text",action:Gt}));return Ve.concat(yt)}return tt?Ve:Ve.concat([{id:"home",kind:"key",keyName:"home"},{id:"end",kind:"key",keyName:"end"},{id:"ctrl-d",kind:"key",keyName:"ctrl-d"}])},[w,Ht,b,tt]),Me=S.useMemo(()=>zx(te,v),[te,v]),ve=`${tt?"space-y-1":"mt-1 space-y-1"}${qe?" pointer-events-none":""}`,_t=oe&&Te?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:Te.left,top:Te.top},children:a.jsx("div",{className:"grid gap-1",children:x.map(Ve=>a.jsx("button",{type:"button",onPointerDown:yt=>St(yt,Ve.id),tabIndex:-1,disabled:ce,className:`h-7 rounded-full px-3 text-left text-xs font-medium transition-colors disabled:opacity-50 ${Ve.id===g?"bg-primary text-primary-foreground":"bg-surface-2 hover:bg-surface-elevated text-muted-foreground hover:text-foreground"}`,children:Ve.label},Ve.id))})}),document.body):null;return a.jsxs(a.Fragment,{children:[_t,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?tt?"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:Fe,onPointerDownCapture:Fe,onContextMenuCapture:fe,onFocusCapture:De,children:a.jsxs("div",{className:"rounded-2xl bg-surface-elevated p-0.5 space-y-0.5",children:[!tt&&a.jsxs("div",{"data-mobile-keyboard-primary-row":"true",className:"grid grid-cols-10 gap-1",children:[a.jsx("button",{type:"button",onPointerDown:Ve=>lt(Ve,"esc"),tabIndex:-1,disabled:ce,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:Ve=>Tt(Ve,"ctrl"),tabIndex:-1,disabled:ce,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${s==="ctrl"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${i==="ctrl"?"ring-2 ring-accent":""}`,children:a.jsx("span",{className:"font-medium",children:i==="ctrl"?"Ctrl*":"Ctrl"})}),a.jsx("button",{type:"button",onPointerDown:Ve=>lt(Ve,"ctrl-c"),tabIndex:-1,disabled:ce,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:Ve=>lt(Ve,"ctrl-u"),tabIndex:-1,disabled:ce,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:ct,onTouchStart:ct,onClick:ft,tabIndex:-1,disabled:ce||!M||D==="uploading",title:D==="uploading"?`${be("rightSidebar.uploading")} ${Math.round(F)}%`:be(D==="inserted"?"rightSidebar.inserted":D==="failed"?"rightSidebar.uploadFailed":"rightSidebar.insertLocalFile"),"aria-label":be("rightSidebar.insertLocalFile"),className:`relative h-7 w-full overflow-hidden rounded-full shadow-sm active:bg-accent active:text-accent-foreground transition-all keyboard-button-active disabled:opacity-50 flex items-center justify-center ${D==="inserted"?"bg-primary/15 text-primary":D==="failed"?"bg-destructive/15 text-destructive":"bg-surface-2"}`,children:[D==="uploading"&&a.jsx("span",{"aria-hidden":"true","data-file-upload-progress":"true",className:"absolute inset-y-0 left-0 bg-primary/25 transition-[width] duration-150 ease-out",style:{width:`${Math.max(0,Math.min(100,F))}%`}}),a.jsx("span",{className:"relative z-10 flex items-center justify-center",children:D==="uploading"?a.jsx(Sn,{size:15,className:"animate-spin"}):D==="inserted"?a.jsx(Uo,{size:15}):D==="failed"?a.jsx(ws,{size:15}):a.jsx(B8,{size:15})}),D!=="idle"&&a.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:D==="uploading"?`${be("rightSidebar.uploading")} ${Math.round(F)}%`:be(D==="inserted"?"rightSidebar.inserted":"rightSidebar.uploadFailed")})]}),a.jsx("button",{type:"button",onPointerDown:()=>I("/"),tabIndex:-1,disabled:ce,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:Ve=>lt(Ve,"enter"),tabIndex:-1,disabled:ce,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(E8,{size:16})}),a.jsxs("button",{ref:at,type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:bt,onTouchStart:bt,onClick:ut,tabIndex:-1,disabled:ce,title:be(G==="copied"?"terminal.copied":G==="failed"?"terminal.copyFailed":Z==="copy"?"terminal.longPressSelectsText":"terminal.longPressSendsArrows"),"aria-label":be(Z==="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 ${G==="copied"?"bg-primary/15 text-primary":G==="failed"?"bg-destructive/15 text-destructive":Z==="copy"?"bg-primary/15 text-primary":"bg-surface-2"}`,children:[a.jsx("span",{ref:_e,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-0 rounded-full border border-primary/70 opacity-0"}),a.jsx("span",{ref:$,"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(Uo,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${G==="copied"?"scale-100 rotate-0 opacity-100":"scale-50 -rotate-45 opacity-0"}`}),a.jsx(ws,{size:16,className:`absolute inset-0 transition-[opacity,transform] duration-200 ease-out motion-reduce:transition-none ${G==="failed"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),a.jsx(G5,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${G==="idle"&&Z==="copy"?"scale-100 opacity-100":"scale-50 opacity-0"}`}),a.jsx(n9,{size:15,className:`absolute inset-0 transition-[opacity,transform] duration-300 ease-out motion-reduce:transition-none ${G==="idle"&&Z==="arrows"?"scale-100 rotate-0 opacity-100":"scale-50 rotate-45 opacity-0"}`})]}),G!=="idle"&&a.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:G==="copied"?`${be("terminal.copied")} · ${be("terminal.longPressSendsArrows")}`:`${be("terminal.copyFailed")} · ${be("terminal.longPressSelectsText")}`})]}),a.jsx("button",{type:"button","data-mobile-copy-button":"true","data-mobile-native-action":"true",onPointerDown:Qe,onPointerUp:ct,onTouchStart:ct,onTouchEnd:ct,onClick:gt,tabIndex:-1,disabled:ce,title:be("terminal.paste"),"aria-label":be("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(w8,{size:15})}),a.jsx("button",{type:"button",onPointerDown:we,tabIndex:-1,disabled:ce,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:Ae?a.jsx(Xy,{size:16}):a.jsx(Cl,{size:16})})]}),Ee&&a.jsx("div",{className:ve,children:Me.map((Ve,yt)=>{const Gt=Ve.items[0]?.kind==="preset",ke=Math.max(2,Ve.columns),Ce=Gt?`${Hx}px repeat(${Math.max(1,ke-1)}, minmax(0, 1fr))`:`repeat(${ke}, minmax(0, 1fr))`;return a.jsx("div",{className:"relative grid gap-1",style:{gridTemplateColumns:Ce},children:Ve.items.map(nt=>nt.kind==="preset"?a.jsx(Wx,{buttonRef:nt.id==="preset"?Ye:void 0,mode:g,presetLabel:f,title:p,disabled:ce,onPointerDown:It},nt.id):nt.kind==="alt"?a.jsx("button",{type:"button",onPointerDown:xe=>Tt(xe,"alt"),tabIndex:-1,disabled:ce,className:`h-7 w-full rounded-full shadow-sm text-xs disabled:opacity-50 flex items-center justify-center transition-all ${s==="alt"?"bg-primary text-primary-foreground scale-105 shadow-md shadow-primary/40":"bg-surface-2"} ${i==="alt"?"ring-2 ring-accent":""}`,children:a.jsx("span",{className:"font-medium",children:i==="alt"?"Alt*":"Alt"})},nt.id):nt.kind==="text"?a.jsxs("button",{type:"button",onPointerDown:xe=>Qt(xe,nt.action),tabIndex:-1,disabled:ce,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:[nt.action.label,nt.action.doubleTapSequence&&a.jsx("span",{className:"absolute top-0.5 right-1.5 h-1 w-1 rounded-full bg-accent/60"})]},nt.id):a.jsx("button",{type:"button",onPointerDown:xe=>lt(xe,nt.keyName),tabIndex:-1,disabled:ce,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:nt.keyName==="ctrl-d"?"Ctrl-D":nt.keyName==="home"?"Home":"End"},nt.id))},`row-${yt}`)})})]})})]})},l_=({isMobile:e,isInputFocused:t,isIOS:r,isConnecting:s,connectionError:i,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:i?"text-destructive":"text-accent",children:i?"Yes":"No"})]}),a.jsxs("div",{children:["isIOS:"," ",a.jsx("span",{className:r?"text-muted-foreground":"text-accent",children:String(r)})]})]}),a.jsx("div",{className:"mt-2 pt-2 border-t border-border/15",children:a.jsx("div",{children:"Tip: Tap the status bar 3 times to toggle debug panel"})})]})},c_=/^Reconnecting/i,u_=({connectionError:e,isFatalError:t,isRestarting:r,isConnecting:s,onHardRestart:i})=>{const{t:c}=Gr(),u=!!e&&c_.test(e),f=!!(s&&!e||u),[p,g]=S.useState(!1);return S.useEffect(()=>{if(!f){g(!1);return}const x=setTimeout(()=>g(!0),1500);return()=>clearTimeout(x)},[f]),f?p?a.jsx("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center pb-2 pointer-events-none",children:a.jsx("span",{className:"text-[11px] text-muted-foreground/60 animate-pulse tracking-wide",children: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:i,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 zc=[],of=!1;function mo(e,t,r={}){typeof window>"u"||(zc.push(JSON.stringify({level:e,message:t,data:{ts:Date.now(),...r}})),d_())}async function d_(){if(!of){of=!0;try{for(;zc.length>0;){const e=zc[0];try{await fetch("/api/client-log",{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0}),zc.shift()}catch{zc=[];break}}}finally{of=!1}}}const h_=120,f_=80,p_=400;function Rg(){if(typeof window>"u"||document.visibilityState!=="visible"||!Jy())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=Ta().visualViewport;if(!t)return 0;const r=Number.parseFloat(document.documentElement.style.getPropertyValue("--app-base-vh")||"0")||window.innerHeight,s=Number.parseFloat(document.documentElement.style.getPropertyValue("--safe-bottom-inset")||"0")||0,i=t.height+t.offsetTop;return Math.max(0,Math.round(r-i-s))}function Gx(e){const{enabled:t,openThresholdPx:r=h_,closeThresholdPx:s=f_,settleDelayMs:i=p_}=e,c=S.useMemo(()=>j0("keyboard"),[]),u=S.useRef(!1),f=S.useRef(null),p=S.useRef(0),[g,x]=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),x(U=>!U.isOpen&&!U.isSettled&&U.keyboardHeight===0?U:{isOpen:!1,isSettled:!1,keyboardHeight:0});return}let b=null;const v=()=>{b=null;const U=Rg();let q=u.current;if(U>=r?q=!0:U<=s&&(q=!1),u.current=q,q){const pe=Math.abs(U-p.current);p.current=U,pe>10&&(f.current!==null&&clearTimeout(f.current),f.current=setTimeout(()=>{f.current=null,x(Ue=>Ue.isSettled?Ue:{...Ue,isSettled:!0})},i))}else f.current!==null&&(clearTimeout(f.current),f.current=null);x(pe=>{const Ue=q?pe.isSettled:!1;return pe.isOpen===q&&pe.keyboardHeight===U&&pe.isSettled===Ue?pe:(c("sync",{keyboardHeight:U,isOpen:q,isSettled:Ue,visualViewport:Ta().visualViewport?{width:Math.round(Ta().visualViewport.width),height:Math.round(Ta().visualViewport.height),offsetTop:Math.round(Ta().visualViewport.offsetTop)}:null}),{isOpen:q,isSettled:Ue,keyboardHeight:U})})},w=(U="event")=>{(U.includes("visibilitychange")||U.includes("pageshow"))&&c("schedule",{source:U}),b===null&&(b=window.requestAnimationFrame(v))};w("mount");const k=()=>w("resize"),I=()=>w("orientationchange"),N=()=>w("visualViewport.resize"),M=()=>w("visualViewport.scroll"),D=()=>w("viewport-keyboard-change");window.addEventListener("resize",k),window.addEventListener("orientationchange",I),Ta().visualViewport?.addEventListener("resize",N),Ta().visualViewport?.addEventListener("scroll",M),document.addEventListener("termdock:viewport-keyboard-change",D);const F=U=>{c("resume",{source:U,keyboardHeight:Rg(),hidden:document.hidden}),w(`${U}:now`),window.setTimeout(()=>w(`${U}:50ms`),50),window.setTimeout(()=>w(`${U}:200ms`),200)},Z=()=>{document.hidden||F("visibilitychange")},G=()=>F("pageshow");return document.addEventListener("visibilitychange",Z),window.addEventListener("pageshow",G),()=>{window.removeEventListener("resize",k),window.removeEventListener("orientationchange",I),Ta().visualViewport?.removeEventListener("resize",N),Ta().visualViewport?.removeEventListener("scroll",M),document.removeEventListener("termdock:viewport-keyboard-change",D),document.removeEventListener("visibilitychange",Z),window.removeEventListener("pageshow",G),b!==null&&window.cancelAnimationFrame(b),f.current!==null&&(clearTimeout(f.current),f.current=null)}},[c,t,r,s,i]),g}const vd=300,m_=120,g_=2e3,x_=250,b_=6e4;function y_(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 i=e.slides[s-1]??[],c=e.slides[s+1]??[];for(let u=0;u<Math.max(i.length,c.length)&&r.size<3;u+=1)for(const f of[i[u],c[u]])f&&r.size<3&&r.add(f);return r}function af(e,t){return t?e.find(r=>r.id===t||r.backendSessionId===t)?.id??null:null}function ed(e){return e.prioritySessionId??e.activeSessionId??e.persistedActiveSessionId??e.firstSessionId}function v_(e){return e.foregroundSessionId===null||e.isVisible===!0||e.sessionId===e.foregroundSessionId||e.foregroundReady}function w_(e){return e.sessionId===e.foregroundSessionId||e.visibleSessionIds.has(e.sessionId)||e.deferredViewportSessionIds.has(e.sessionId)}function A_(e){return e.isMobile&&(!e.viewportReady||!e.streamReady||!e.contentReady)}function T_(e){return e.writtenChunkId!==null&&e.initialTargetChunkId!==null&&e.writtenChunkId>=e.initialTargetChunkId}function C_(e){return!e.initialConnectionPending}function S_(e){return!e}function __(e){return e.requestToken===0||e.isVisible===!0||e.foregroundSessionId===null||e.isVisible===void 0&&e.sessionId===e.foregroundSessionId||e.foregroundCompletedToken===e.requestToken}function L_(e,t){return[...e].every(r=>t.has(r))}function k_(e,t){return e===null||t-e>=x_}function I_(e){return!1}function E_(e){return!e.isActive||e.isStreamReady||e.reconnectStartedAt===null?null:Math.max(0,b_-(e.now-e.reconnectStartedAt))}function M_(e,t){const r=new Map;let s=0;for(const i of e)if(!r.has(i)){if(t.has(i)){r.set(i,0);continue}r.set(i,vd+s*m_),s+=1}return r}const R_="Session not found on server",lf="Terminal session not found",N_="STALE_SESSION_RESTORE_REJECTED";function D_(e){return e?.message===R_}function Ng(e){return e?.code===N_}function Q_(e,t){if(!e||e.startsWith("/"))return e;const r=e.replace(/^\.\//,"");return t?`${t.replace(/\/+$/,"")}/${r}`:r}function Vx(e,t){return Q_(e,t).replace(/ /g,"\\ ")}function B_(e,t){return`${Vx(e,t)} `}function Dg(e,t){return Vx(e,t)}function jB(e,t,r){if(!r)return Dg(e,t);const s=r.start===r.end?`${r.start}`:`${r.start}-${r.end}`;return`${Dg(e,t)}:${s}`}const j_="/tmp";async function qx(e,t,r){const i=(await t(j_,[e])).files[0];if(!i?.path)throw new Error("Upload did not return a file path");return r(i.path),i}const PB=qx,P_=320,Qg="termdock:mobile-keyboard-expanded",Bg="termdock:mobile-keyboard-preset-mode",jg="termdock:mobile-long-press-mode",O_=80;function cf(){return typeof window>"u"?!1:(navigator.maxTouchPoints>0||"ontouchstart"in window)&&window.innerWidth<768}const F_={retry:{maxRetries:60,initialDelayMs:1e3,maxDelayMs:2e4},connectionTimeoutMs:15e3},U_=({sessionId:e,mode:t,tmuxSessionName:r=null,terminalSettings:s=Fp(),colorTheme:i="dark",toolbarPresets:c=[],isActive:u=!0,focusSuspended:f=!1,deferCursorUntilPositioned:p=!1,isLayoutVisible:g=!0,focusRequestToken:x=0,resumeRequestToken:b=0,resumeRequestReason:v="visibility",resumeRequestDelayMs:w=0,forceResumeReconnect:k=!1,initialConnectDelayMs:I=0,initialConnectEnabled:N=!0,resumeRequestEnabled:M=!0,onStreamReadyChange:D,onStreamConnected:F,onViewportReadyChange:Z,onContentReadyChange:G,onKeyboardVisibilityChange:U,suppressKeyboard:q=!1,keyboardPortalTarget:pe=null,sharedMobileKeyboardLayout:Ue=!1,suppressPageFlipRefresh:be=!1,showDebug:Ae,onStatusChange:Ke})=>{const{t:qe}=Gr(),[ie]=S.useState(e||ow()),[Se,tt]=S.useState(()=>(e?Pf(e):null)??s.fontSize),Ee=S.useMemo(()=>GS(),[]),oe=S.useMemo(()=>j0("session"),[]),de=S.useMemo(()=>j0("keyboard"),[]),Te=S.useRef(null),ee=S.useRef(null);S.useEffect(()=>{Pf(ie)===null&&tt(s.fontSize)},[s.fontSize,ie]);const ye=S.useMemo(()=>({...s,fontSize:Se}),[s,Se]),[ce,Ye]=S.useState(cf),[at,_e]=S.useState(!1),[$,$e]=S.useState(!1),[Xe,Le]=S.useState(!1),[K,Fe]=S.useState(()=>typeof document>"u"?!0:!document.hidden&&Oc()),[fe,De]=S.useState(()=>typeof document>"u"?!0:document.hasFocus()),[lt,Tt]=S.useState(!1),[we,me]=S.useState(!1),[Qe,gt]=S.useState(!1),[ft,ct]=S.useState(!1),[Kt,$t]=S.useState(!0),{isOpen:Qt,keyboardHeight:ut}=Gx({enabled:ce&&u}),[bt,It]=S.useState(null),[St,Ht]=S.useState(null),[te,Me]=S.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(Qg)==="true"),[ve,_t]=S.useState(()=>{if(typeof window>"u")return"auto";const re=window.localStorage.getItem(Bg);return re&&re.length>0?re:"auto"}),[Ve,yt]=S.useState(()=>typeof window>"u"?"arrows":window.localStorage.getItem(jg)==="copy"?"copy":"arrows"),[Gt,ke]=S.useState("idle"),[Ce,nt]=S.useState("idle"),[xe,gr]=S.useState(0),xt=Qr(re=>re.sessions.get(ie)),{setTerminalSession:hn,setConnecting:Xr,appendToBuffer:Rr,replaceBuffer:Vr,clearTerminalSession:Un,removeTerminalSession:_r,clearBuffer:is,setSessionActiveProgram:xr,setSessionCwd:ae,setSessionCopyMode:ar,setSessionAgentStatus:it,setSessionShellTitle:os,setSessionPromptState:fn,clearAgentNeedsReview:Zt}=Qr.getState(),Yr=S.useMemo(()=>`wt-${ie.replace(/[^a-zA-Z0-9_-]/g,"").slice(0,12)}`,[ie]),Ur=xt?.terminalSessionId??null,Nr=xt?.mode??"shell",Zn=xt?.activeProgram??null,Ln=S.useMemo(()=>M0(c),[c]),kn=Nr==="tmux",as=xt?.bufferChunks??[],$n=xt?.isConnecting??!1,Dr=Ur,On=S.useCallback(async(re,Pe)=>{const rt=pS(re,xt?.cwd||xt?.directory);if(!rt)return;let Dt=rt,Be="directory";try{Dt=(await _p(rt)).path}catch(pt){if(!(pt instanceof Error)||pt.message!=="Path is not a directory")return;Be="file"}try{const pt=Ft.getState();pt.setRightTab("files"),pt.openRight(),window.dispatchEvent(new CustomEvent(lS,{detail:{path:Dt,kind:Be,line:Pe}}))}catch{}},[xt?.cwd,xt?.directory]),Y=t??xt?.mode??"shell",We=Y==="tmux"?r??xt?.tmuxSessionName??null:null,[Mt,Xt]=S.useState(null),vr=S.useRef(!1),[At,Lr]=S.useState(!1),[jr,Jr]=S.useState(!1),[Ts,Nn]=S.useState(null),[$r,zr]=S.useState(0),[Pr,pn]=S.useState(null),Dn=Ae!==void 0?Ae:!1,cs=S.useRef(null),Ti=S.useRef(null),kr=S.useRef(null),Yn=S.useRef(null),ur=S.useRef(null),Kr=S.useRef(!1),sn=S.useRef(null),Kn=S.useRef([]),hs=S.useRef(0),Or=S.useRef(!1),mn=S.useRef(null),P=S.useRef(null),he=S.useRef(-1),Ne=S.useRef(null),je=S.useRef(0),Re=S.useRef(null),dt=S.useRef(null),wt=S.useRef(0),Je=S.useRef(!1),Ge=S.useRef(null),ot=S.useRef(null),sr=S.useRef(!1),vt=S.useRef(0),zt=S.useRef(!1),ht=S.useRef(!1),Jt=S.useRef(!1),Ir=S.useRef(null),Nt=S.useRef(null),pr=S.useRef(null),br=S.useRef(u);br.current=u;const Xn=S.useRef(f);Xn.current=f;const zn=S.useRef(ce),Jn=S.useRef(null),Cs=S.useRef(null),Vs=S.useRef(null),yn=S.useRef(null),Fr=S.useRef(null),O=S.useRef(null),ne=S.useRef(null),le=S.useCallback(()=>{const re=++vt.current,Pe=()=>{re===vt.current&&me(!0)};if(typeof window>"u"){Pe();return}window.requestAnimationFrame(()=>window.requestAnimationFrame(Pe))},[]),ze=S.useCallback(re=>{if(zt.current){if(Nt.current!==null&&(window.clearTimeout(Nt.current),Nt.current=null),re.x===0&&re.y>=re.rows-1){$t(!1);return}Nt.current=window.setTimeout(()=>{Nt.current=null,$t(!0)},O_)}},[]),Lt=S.useRef(null);S.useEffect(()=>()=>{Lt.current?.()},[]);const Pt=S.useCallback(()=>{Lt.current||(Lt.current=Mp(()=>{Lt.current=null;const re=Qr.getState(),Pe=kr.current,rt=re.getTerminalSession(ie);if(!Pe||rt?.mode!=="shell"||re.hasPendingBufferWrites(ie))return;const Dt=ev(Pe),Be=ur.current?.getDimensions();if(!Dt||!Be)return;const pt=ur.current?.serializeSnapshot();pt&&tv({id:Pe,version:1,...Dt,...Be,data:pt,savedAt:Date.now()})},2e3))},[ie]),Vt=S.useCallback(re=>{const Pe=Qr.getState(),rt=Pe.getTerminalSession(ie)?.bufferChunks.at(-1)?.id;if(kr.current&&rt!==void 0&&rt<=re&&!Pe.hasPendingBufferWrites(ie)&&(rv(kr.current),Pt()),!Je.current||!T_({writtenChunkId:re,initialTargetChunkId:Ge.current}))return;const Dt=ot.current;ot.current=null,Dt!==null&&ur.current?.notifyScreenSynchronized(Dt),Je.current=!1,Ge.current=null,le()},[le,Pt,ie]),dr=S.useCallback(re=>{if(!zt.current)return;const Pe=Ir.current;Pe&&Pe.x===re.x&&Pe.y===re.y&&Pe.rows===re.rows||(Ir.current=re,Nt.current!==null&&(window.clearTimeout(Nt.current),Nt.current=null),re.x===0&&re.y>=re.rows-1&&$t(!1))},[]);S.useEffect(()=>{if(!p){ht.current=!1;return}ht.current||(ht.current=!0,Jt.current=!1,zt.current=!0,Ir.current=null,$t(!1),Nt.current!==null&&(window.clearTimeout(Nt.current),Nt.current=null),pr.current!==null&&window.clearTimeout(pr.current),pr.current=window.setTimeout(()=>{pr.current=null,Nt.current!==null&&typeof window<"u"&&window.clearTimeout(Nt.current),Nt.current=null,zt.current=!1,$t(!0)},15e3))},[p]);const Bt=S.useCallback(()=>{yn.current=null;const re=Vs.current;Vs.current=null,re&&os(re.sessionId,re.title)},[os]),ir=S.useCallback((re,Pe)=>{if(Vs.current={sessionId:re,title:Pe},yn.current===null){if(typeof window>"u"){Bt();return}yn.current=window.requestAnimationFrame(Bt)}},[Bt]),qr=S.useCallback(()=>{yn.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(yn.current),yn.current=null,Vs.current=null},[]),vn=S.useCallback(async()=>{const re=Y;return(await nv({preferredFrontendSessionId:ie,mode:re,tmuxSessionName:re==="tmux"?We||Yr:void 0,termType:"xterm-256color",requireExisting:!0})).terminalSession},[Y,We,Yr,ie]),Hn=S.useRef(u);S.useEffect(()=>{if(!u){ur.current?.blur(),Hn.current=!1;return}if(Hn.current)return;Hn.current=!0;const re=LC(ce,be);if(re==="single"){ur.current?.requestRefresh("focus",{skipResizePush:!0,skipScrollToBottom:!0});return}re!=="none"&&ur.current?.requestRefresh("page-flip",{reconcileServerSize:!0,skipScrollToBottom:!0})},[u,ce,be,Dr]),S.useEffect(()=>{zn.current=ce},[ce]);const In=S.useCallback(()=>{!br.current||Xn.current||ur.current?.focus()},[]);S.useLayoutEffect(()=>{f&&ur.current?.blur()},[f]),S.useEffect(()=>{if(!u||f||Kt||Jt.current)return;Jt.current=!0;const re=window.requestAnimationFrame(()=>{ur.current?.requestPtyRedraw()});return()=>window.cancelAnimationFrame(re)},[f,u,Kt]);const ci=S.useCallback(re=>{typeof window>"u"||typeof document>"u"||!br.current||Xn.current||zn.current||document.hidden||!Oc()||(Jn.current!==null&&window.clearTimeout(Jn.current),Jn.current=window.setTimeout(()=>{if(Jn.current=null,!br.current||Xn.current||zn.current||document.hidden||!Oc())return;const Pe=document.activeElement,rt=Pe?.getAttribute("data-terminal-input-anchor")==="true";if((Pe instanceof HTMLInputElement||Pe instanceof HTMLTextAreaElement||Pe instanceof HTMLSelectElement||Pe?.isContentEditable===!0)&&!rt){de("desktop resume focus skipped: editable active",{reason:re});return}de("desktop resume focus",{reason:re}),ur.current?.requestRefresh("focus",{force:!0,forceRedraw:!0,skipResizePush:!0,skipScrollToBottom:!0}),ur.current?.focus()},50))},[de]);S.useEffect(()=>()=>{Jn.current!==null&&typeof window<"u"&&window.clearTimeout(Jn.current),Jn.current=null,Cs.current!==null&&typeof window<"u"&&window.clearTimeout(Cs.current),Cs.current=null,Fr.current!==null&&typeof window<"u"&&window.clearTimeout(Fr.current),Fr.current=null,O.current!==null&&typeof window<"u"&&window.clearTimeout(O.current),O.current=null,pr.current!==null&&typeof window<"u"&&window.clearTimeout(pr.current),pr.current=null,Nt.current!==null&&typeof window<"u"&&window.clearTimeout(Nt.current),Nt.current=null},[]),S.useEffect(()=>{if(typeof document>"u"||typeof window>"u")return;const re=()=>{Cs.current!==null&&window.clearTimeout(Cs.current),Cs.current=window.setTimeout(()=>{Cs.current=null;const Pe=document.activeElement,Dt=!(Pe?.getAttribute("data-terminal-input-anchor")==="true")&&!!(Pe&&(Pe instanceof HTMLInputElement||Pe instanceof HTMLTextAreaElement||Pe instanceof HTMLSelectElement||Pe.isContentEditable));z9({isActive:br.current&&!Xn.current,isMobile:zn.current,documentVisible:!document.hidden,activeElementIsEditable:Dt})&&In()},0)};return document.addEventListener("pointerup",re),()=>{document.removeEventListener("pointerup",re),Cs.current!==null&&(window.clearTimeout(Cs.current),Cs.current=null)}},[In]);const es=S.useCallback(()=>{Os.current=!1,zr(re=>re+1)},[]),Cr=S.useCallback((re,Pe,rt)=>{const Dt=kr.current,Be=Date.now();if(Dt&&Pe&&sv(Dt)){ee.current={startedAt:Be,strategy:"reconnect",reason:re},mo("info","PWA_RESUME terminal-start",{frontendSessionId:ie,backendSessionId:Dt,strategy:"reconnect",reason:re,active:br.current});return}if(Dt&&iv(Dt,()=>{const pt=ee.current;mo("info","PWA_RESUME terminal-responsive",{frontendSessionId:ie,backendSessionId:Dt,durationMs:pt?Date.now()-pt.startedAt:null,strategy:pt?.strategy??"probe",reason:pt?.reason??re}),ee.current=null,F?.(ie)},{visible:rt})){ee.current={startedAt:Be,strategy:"probe",reason:re},mo("info","PWA_RESUME terminal-start",{frontendSessionId:ie,backendSessionId:Dt,strategy:"probe",reason:re,active:br.current}),oe("[Terminal] resume probe sent",{reason:re,backendSessionId:Dt,active:br.current});return}if(oe("[Terminal] resume probe missing connection, restarting ensureSession",{reason:re,backendSessionId:Dt,active:br.current}),!C_({initialConnectionPending:sr.current})){oe("[Terminal] resume probe deferred during initial websocket handshake",{reason:re,backendSessionId:Dt});return}es()},[oe,F,es,ie]),Ot=S.useCallback((re,Pe)=>{const rt=kr.current;rt&&sn.current!==re&&(sn.current=re,W1(rt,re,Pe),oe("[Terminal] flow-control state sent",{backendSessionId:rt,paused:re,reason:Pe}))},[oe]),En=S.useCallback((re,Pe)=>{const rt=kr.current;rt&&Re.current!==re&&(Re.current=re,G1(rt,re,Pe),oe("[Terminal] focus state sent",{backendSessionId:rt,focused:re,reason:Pe}))},[oe]),Ps=S.useCallback((re,Pe)=>{const rt=kr.current;rt&&dt.current!==re&&(dt.current=re,V1(rt,re,Pe),oe("[Terminal] viewing state sent",{backendSessionId:rt,viewing:re,reason:Pe}))},[oe]),ui=U9({isActive:u&&!f,viewportFocused:Xe,documentVisible:K,windowFocused:fe,streamReady:lt}),Hr=$9({isActive:u,documentVisible:K,windowFocused:fe,streamReady:lt,isDesktop:na()!==null}),ts=S.useRef(ui),Ni=S.useRef(Hr);S.useEffect(()=>{ts.current=ui,En(ui,"logical-focus-change")},[ui,En,Dr]),S.useEffect(()=>{Ni.current=Hr,Ps(Hr,"logical-viewing-change")},[Hr,Ps,Dr]),ew(Dr,K,lt),S.useEffect(()=>{const re=Pe=>{const rt=Pe.detail;!rt||rt.sessionId!==ie||tt(rt.fontSize??s.fontSize)};return window.addEventListener("termfontchange",re),()=>window.removeEventListener("termfontchange",re)},[ie,s.fontSize]),S.useEffect(()=>{const re=()=>{const Be=!document.hidden&&Oc();Fe(Be),Be&&u&&ci("visibility")},Pe=Be=>{u&&ci(Be.persisted?"bfcache":"pageshow")},rt=()=>{De(!0),ci("window-focus")},Dt=()=>De(!1);return document.addEventListener("visibilitychange",re),window.addEventListener(q1,re),window.addEventListener("pageshow",Pe),window.addEventListener("focus",rt),window.addEventListener("blur",Dt),()=>{document.removeEventListener("visibilitychange",re),window.removeEventListener(q1,re),window.removeEventListener("pageshow",Pe),window.removeEventListener("focus",rt),window.removeEventListener("blur",Dt)}},[u,ci]),S.useEffect(()=>{if(!b||!M||!Mn.current)return;const re=w,Pe=re<=0,rt=Te.current;if(rt?.token===b&&(rt.visible||!Pe))return;const Dt=()=>{Te.current={token:b,visible:Pe},ur.current?.requestRefresh(v,{skipScrollToBottom:!0}),Cr(re>0?"global-resume-background":"global-resume-visible",re<=0&&k,Pe)};if(re<=0){Dt();return}const Be=window.setTimeout(Dt,re);return()=>window.clearTimeout(Be)},[b,v,M,w,k,Cr]);const Qn=S.useRef(0);S.useEffect(()=>{if(lt){Qn.current=0;return}if(!At||Mt==="Authentication required"||Mt===lf)return;const re=Qn.current,Pe=Math.min(2e3*Math.pow(2,Math.min(re,4)),3e4),rt=setTimeout(()=>{Qn.current+=1,oe("[Terminal] fatal self-heal: auto restarting ensureSession",{attempt:Qn.current,backendSessionId:kr.current}),Xt("Reconnecting..."),Lr(!1),es()},Pe);return()=>clearTimeout(rt)},[Mt,At,lt,$r,oe,es]),S.useEffect(()=>{if(typeof window>"u"){_e(!1);return}const re=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;_e(re)},[]),S.useEffect(()=>{(!u||!ce)&&$e(!1),u||Le(!1)},[u,ce]),S.useEffect(()=>{kr.current=Dr,he.current=-1,ot.current=null,Re.current=null,dt.current=null,sn.current=null},[Dr]),S.useEffect(()=>{D?.(ie,lt)},[lt,D,ie]),S.useEffect(()=>{G?.(ie,lt&&we&&Qe)},[we,Qe,lt,G,ie]),S.useEffect(()=>{kn||(Or.current=!1,mn.current=null,P.current&&(clearTimeout(P.current),P.current=null))},[kn]),S.useEffect(()=>{Dr&&ur.current?.requestRefresh("session-key-change",{force:!0})},[Dr]),S.useEffect(()=>{const re=u&&ce&&Qt;de("visibility signal",{sessionId:ie,isActive:u,isMobile:ce,isInputFocused:$,isViewportKeyboardOpen:Qt,viewportKeyboardHeight:ut,visible:re}),U?.(ie,re)},[U,ie,u,ce,Qt,ut,de]),S.useEffect(()=>{u&&x&&x!==je.current&&(je.current=x,In())},[x,In,u]),S.useEffect(()=>{Yn.current=ie},[ie]),S.useEffect(()=>{!ce&&(bt!==null||St!==null)&&(It(null),Ht(null),Ne.current=null)},[ce,bt,St]),S.useEffect(()=>{!Dr&&(bt!==null||St!==null)&&(It(null),Ht(null),Ne.current=null)},[Dr,bt,St]),S.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(Qg,te?"true":"false")},[te]),S.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(Bg,ve)},[ve]),S.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(jg,Ve)},[Ve]),S.useEffect(()=>{Ye(cf());const re=()=>{Ye(cf())};return window.addEventListener("resize",re),()=>window.removeEventListener("resize",re)},[]);const en=S.useCallback(()=>{wt.current+=1,Bt(),qr();const re=cs.current;cs.current=null,Ti.current=null,sr.current=!1,Tt(!1),ur.current?.setSessionReady(!1);const Pe=kr.current;Pe&&W1(Pe,!1,"stream-disconnect"),Kr.current=!1,sn.current=null,Kn.current=[],re?.()},[qr,Bt]),qs=S.useCallback(async re=>{if(Ti.current===re){oe(`[startStream] Skipping - already connected to ${re}`);return}oe(`[startStream] Starting stream for frontendSessionId=${ie} backendSessionId=${re}`),Nn(null),vt.current+=1,Je.current=!1,Ge.current=null,me(!1),gt(!1),en();const Pe=wt.current+1;wt.current=Pe,sr.current=!0;const rt=Qr.getState().getTerminalSession(ie);if(rt?.mode==="shell"&&!rt.bufferChunks.length){const Be=await Promise.race([ov(re),new Promise(pt=>window.setTimeout(()=>pt(null),75))]);if(wt.current!==Pe||Yn.current!==ie)return;if(Be&&!Qr.getState().getTerminalSession(ie)?.bufferChunks.length){Qr.getState().replaceBuffer(ie,[Be.data]);const pt=ur.current?.getDimensions();pt?.cols===Be.cols&&pt.rows===Be.rows&&av(re,Be.seq,Be.epoch)}}const Dt=Ee.connect(re,{onEvent:Be=>{if(wt.current!==Pe)return;const pt=ie;if(pt)switch(Be.type){case"connected":{sr.current=!1;const yr=ee.current;yr&&(mo("info","PWA_RESUME terminal-connected",{frontendSessionId:pt,backendSessionId:kr.current,durationMs:Date.now()-yr.startedAt,strategy:yr.strategy,reason:yr.reason}),ee.current=null),F?.(pt),(Be.runtime||Be.ptyBackend)&&oe(`[Terminal] connected frontendSessionId=${pt} backendSessionId=${kr.current} runtime=${Be.runtime??"unknown"} pty=${Be.ptyBackend??"unknown"} cwd=${Be.cwd??"unknown"}`),Xr(pt,!1),Xt(null),Lr(!1),Nn(null),Tt(!0),kr.current&&(G1(kr.current,ts.current,"stream-connected"),V1(kr.current,Ni.current,"stream-connected")),ur.current?.setSessionReady(!0),sn.current=null,Ot(Kr.current,"stream-connected"),Be.tuiProgress!==void 0&&Qr.getState().setSessionTuiProgress(pt,Be.tuiProgress??null),Be.shellTitle!==void 0&&Qr.getState().setSessionShellTitle(pt,Be.shellTitle??null),Be.promptState!==void 0&&Be.promptState!==null&&Qr.getState().setSessionPromptState(pt,Be.promptState);const Ar=Qr.getState().getTerminalSession(pt);if(Ar?.terminalSessionId&&Be.mode&&Qr.getState().setTerminalSession(pt,{sessionId:Ar.terminalSessionId,cols:80,rows:24,mode:Be.mode,tmuxSessionName:Be.tmuxSessionName??null,cwd:Be.cwd??null}),Be.activeProgram!==void 0&&xr(pt,Be.activeProgram??null,Be.activeProgramSource??null,Be.activeProgramRaw??null),ur.current?.requestRefresh("connected",{force:!0,reconcileServerSize:br.current}),Be.mode!=="tmux"&&(pn(null),ar(pt,!1)),oe("[Terminal] Connected event received:",{frontendSessionId:pt,backendSessionId:kr.current,storeHasState:!!Ar,storeTerminalId:Ar?.terminalSessionId,hasHistoryInStore:!!Ar?.history?.length,historyLength:Ar?.history?.length??0}),Ar?.history&&Ar.history.length>0){oe(`[Terminal] Restoring ${Ar.history.length} history chunks to frontend session ${pt}`);const Bn=Ar.history.reduce((ms,Ss)=>ms+Ss.length,0),Sr=Math.max(300,Math.min(2e3,Math.ceil(Bn/200)));hs.current=Date.now()+Sr,Ar.history.forEach(ms=>{Rr(pt,ms,{markActivity:!1})}),Qr.getState().setSessionHistory(pt,[]),oe(`[Terminal] History restoration complete for ${pt}`)}else oe(`[Terminal] No history to restore for ${pt}`);const on=Be.replayChunks,wr=!!Ar?.history?.length||!!on?.length;if(wr?Je.current=!0:le(),on&&on.length>0){let Bn=null;if(Be.replayOutOfWindow)oe(`[Terminal] Replay out-of-window, atomically replacing buffer (${on.length} chunks)`),Bn=Vr(pt,cw(on));else{oe(`[Terminal] Replay incremental: ${on.length} chunks`);for(const Ss of on)Rr(pt,Ss)}const Sr=on.reduce((Ss,Ks)=>Ss+Ks.length,0),ms=Math.max(200,Math.min(1500,Math.ceil(Sr/200)));hs.current=Math.max(hs.current,Date.now()+ms),Ge.current=Bn}wr&&Ge.current===null&&(Ge.current=Qr.getState().flushPendingBufferWrites(pt),Ge.current===null&&(Je.current=!1,le()));break}case"reconnecting":{Nn(yr=>yr??Date.now()),Xt("Reconnecting..."),Lr(!1);break}case"data":{Be.data&&(Kr.current?Kn.current.push(Be.data):Rr(pt,Be.data));break}case"tmux-layout":{pn(Be.layout??null),Be.layout&&ar(pt,Be.layout.inCopyMode);break}case"tmux-screen-sync":{const yr=Be.generation??0;if(yr<he.current)break;he.current=yr,vt.current+=1,Je.current=!0,me(!1),Kn.current=[],ur.current?.prepareScreenReplacement(),ot.current=yr,Ge.current=Vr(pt,uw(Be.chunks??[])),Ge.current===null&&(ot.current=null,ur.current?.notifyScreenSynchronized(yr),Je.current=!1,le()),typeof Be.cols=="number"&&typeof Be.rows=="number"&&ur.current?.notifyServerSize(Be.cols,Be.rows,"tmux-screen-sync");break}case"active-program":{xr(pt,Be.activeProgram??null,Be.activeProgramSource??null,Be.activeProgramRaw??null);break}case"cwd":{ae(pt,Be.cwd??null);break}case"agent-status":{it(pt,{agentStatus:Be.agentStatus??null,agentIndicator:Be.agentIndicator??null,agentStatusDetail:Be.agentStatusDetail??null,agent:Be.agent??null,agentMessage:Be.agentMessage??null,agentNativeSessionId:Be.agentNativeSessionId??null,agentResumeRecovered:Be.agentResumeRecovered===!0,agentRich:Be.agentRich===!0,agentActivity:Be.agentActivity??0,agentCwd:Be.agentCwd??null,reviewed:Be.reviewed??null});break}case"git-status":{Qr.getState().setSessionGitStatus(pt,Be.gitStatus??null);break}case"focus-mode":{oe("[Terminal] focus tracking mode",{backendSessionId:kr.current,requested:Be.focusTrackingRequested===!0});break}case"resize-ack":{ur.current?.acknowledgeResize({seq:Be.seq,ok:Be.ok!==!1,cols:Be.cols,rows:Be.rows,screenSyncPending:Be.screenSyncPending,screenSyncGeneration:Be.screenSyncGeneration});break}case"pty-size":{typeof Be.cols=="number"&&typeof Be.rows=="number"&&ur.current?.notifyServerSize(Be.cols,Be.rows,Be.source);break}case"shell-title":{ir(pt,Be.title??null);break}case"prompt-state":{fn(pt,Be.state??"idle",Be.exitCode??null);break}case"tui-progress":{Qr.getState().setSessionTuiProgress(pt,Be.tuiProgress??null);break}case"exit":{const yr=typeof Be.exitCode=="number"?Be.exitCode:null,Ar=typeof Be.signal=="number"?Be.signal:null;Rr(pt,`\r
68
+ [Process exited${yr!==null?` with code ${yr}`:""}${Ar!==null?` (signal ${Ar})`:""}]\r
69
+ `),Un(pt),Xr(pt,!1),Xt("Terminal session ended"),Tt(!1),Lr(!1),Nn(null),pn(null),ar(pt,!1),en();break}}},onError:(Be,pt)=>{if(wt.current!==Pe)return;const yr=ie;if(!yr)return;sr.current=!1;const Ar=pt&&Be.message==="Authentication required",on=D_(Be),wr=Ar?Be.message:on||pt?"Reconnecting...":Be.message||"Terminal stream connection error";console.error(`[Terminal] Stream error (fatal=${pt}):`,wr),on&&console.warn("[Terminal] SESSION_NOT_FOUND_DETECTED",{terminalIdAtError:kr.current,frontendSessionId:yr,isActive:u,isMobile:ce,fatal:pt,stack:new Error().stack}),Xt(wr),Lr(!!pt),pt&&(Nn(null),Xr(yr,!1),en(),on&&(oe("[onError] Session lost, auto-recreating"),Xt("Reconnecting..."),Lr(!1),Un(yr),is(yr),kr.current=null,Os.current=!1,es()))}},{...F_,getDimensions:()=>ur.current?.getDimensions()??null});cs.current=()=>{Dt.close(),wt.current===Pe&&(Ti.current=null)},Ti.current=re},[Rr,is,Un,oe,en,le,F,Ot,es,ir,Xr,xr,it,ar,ae,fn,Ee,ie]);S.useEffect(()=>{const re=E_({isActive:u,isStreamReady:lt,reconnectStartedAt:Ts,now:Date.now()});if(re===null)return;const Pe=window.setTimeout(()=>{oe("[Terminal] visible reconnect watchdog expired",{backendSessionId:kr.current,reconnectStartedAt:Ts}),en(),Xr(ie,!1),Xt("Reconnecting..."),Lr(!1),Nn(Date.now()),es()},re);return()=>window.clearTimeout(Pe)},[oe,en,u,lt,Ts,es,ie,Xr]);const Os=S.useRef(!1),Mn=S.useRef(!1),Fs=S.useRef(0);S.useEffect(()=>()=>{Fs.current+=1,Os.current=!1,en()},[en]);const Ho=S.useRef(Y),ka=S.useRef(We);S.useEffect(()=>{const re=Ho.current,Pe=ka.current;Ho.current=Y,ka.current=We,Yn.current===ie&&(re===Y&&Pe===We||(Os.current=!1,en(),zr(rt=>rt+1)))},[Y,We,en,ie]),S.useEffect(()=>{if(Yn.current!==ie&&(oe(`[useEffect] sessionId changed from ${Yn.current} to ${ie}, allowing reinitialization`),Os.current=!1,Mn.current=!1),Os.current&&Yn.current===ie){oe(`[useEffect] Already initialized for sessionId=${ie}, skipping`);return}if(!ft)return;const re=async pt=>{if(oe(`[ensureSession] Starting for sessionId=${ie}, runId=${pt}`),!Yn.current||Yn.current!==ie){oe(`[ensureSession] SessionId mismatch or stale run (current=${Yn.current}, target=${ie}), skipping`);return}if(pt!==Fs.current){oe(`[ensureSession] Stale run detected (runId=${pt}, currentRunId=${Fs.current}), skipping`);return}const yr=Qr.getState(),Ar=yr.getTerminalSession(ie),on=Ar?.mode??Y;oe("[ensureSession] Current state from store:",{terminalSessionId:Ar?.terminalSessionId,mode:Ar?.mode,tmuxSessionName:Ar?.tmuxSessionName,isConnecting:Ar?.isConnecting});let wr=Ar?.terminalSessionId??null,Bn=!wr;if(wr&&on!==Y?(oe(`[ensureSession] Store mode mismatch for ${wr}: current=${on} desired=${Y}, will create new session`),Bn=!0,yr.clearTerminalSession(ie),wr=null):wr&&Y==="tmux"&&We&&Ar?.tmuxSessionName!==We&&(oe(`[ensureSession] Store tmux name mismatch for ${wr}: current=${Ar?.tmuxSessionName} desired=${We}, will create new session`),Bn=!0,yr.clearTerminalSession(ie),wr=null),wr&&Ee.checkHealth&&!br.current){oe(`[ensureSession] Checking health of existing session ${wr}`);try{const Sr=await Ee.checkHealth(wr);if(oe("[ensureSession] Health check result:",Sr),!Sr.healthy)oe(`[ensureSession] Session ${wr} is NOT healthy (healthy=${Sr.healthy}), will create new session`),oe("[ensureSession] Health check details:",Sr),Bn=!0,Sr.mode&&Ar?.terminalSessionId&&yr.setTerminalSession(ie,{sessionId:Ar.terminalSessionId,cols:80,rows:24,mode:Sr.mode,tmuxSessionName:Sr.tmuxSessionName??null}),yr.clearTerminalSession(ie),oe("[ensureSession] Cleared unhealthy session from store");else{oe(`[ensureSession] Session ${wr} is healthy, reusing it, cwd=${Sr.cwd}, clients=${Sr.clients}, lastActivity=${Date.now()-(Sr.lastActivity||0)}ms ago`),Sr.mode&&Ar?.terminalSessionId&&yr.setTerminalSession(ie,{sessionId:Ar.terminalSessionId,cols:80,rows:24,mode:Sr.mode,tmuxSessionName:Sr.tmuxSessionName??null}),oe(`[ensureSession] Setting terminalIdRef to ${wr} and starting stream`),kr.current=wr,qs(wr),oe(`[ensureSession] Successfully reused healthy session ${wr}, returning early`);return}}catch(Sr){oe(`[ensureSession] Failed to check health of session ${wr}:`,Sr),oe("[ensureSession] Health check API call failed, proceeding as if session might be unhealthy")}}if(oe(`[ensureSession] Decision: shouldCreateNewSession=${Bn}, terminalId=${wr}`),Bn){oe(`[ensureSession] Creating new session, shouldCreateNewSession=${Bn}, runId=${pt}`),Xt(null),Lr(!1),yr.setConnecting(ie,!0);const ms=Qr.getState().getTerminalSession(ie),Ks=(ms?.mode??Y)===Y&&(Y!=="tmux"||!We||ms?.tmuxSessionName===We);if(ms?.terminalSessionId&&Ks)oe(`[ensureSession] Race condition avoided: another instance already created session ${ms.terminalSessionId}`),yr.setConnecting(ie,!1),wr=ms.terminalSessionId,Bn=!1;else try{const Us=await vn();if(oe(`[ensureSession] Opened managed backend session ${Us.sessionId}`),pt!==Fs.current){oe(`[ensureSession] Stale run after session creation (runId=${pt}, currentRunId=${Fs.current}), leaving ${Us.sessionId} for sibling`);return}yr.setTerminalSession(ie,Us),oe(`[ensureSession] Updated store with new session ${Us.sessionId}`),wr=Us.sessionId}catch(Us){if(pt!==Fs.current){oe("[ensureSession] Stale run after session creation failed, skipping error handling");return}if(Us instanceof Z1&&Ng(Us)){oe("[ensureSession] Confirmed missing persisted session:",{sessionId:ie,error:Us.message}),yr.clearTerminalSession(ie),Xt(lf),Lr(!0),yr.setConnecting(ie,!1);return}Xt("Reconnecting..."),Lr(!0),yr.setConnecting(ie,!1);return}}if(pt!==Fs.current){oe(`[ensureSession] Stale run before starting stream (runId=${pt}, currentRunId=${Fs.current}), skipping`);return}if(!wr){oe(`[ensureSession] No terminalId, terminalId=${wr}`);return}oe(`[ensureSession] Starting stream for session ${wr}`),kr.current=wr,qs(wr),oe(`[ensureSession] ensureSession completed for sessionId=${ie}, terminalId=${wr}`)};let Pe=null,rt=null;const Dt=()=>{rt=null,!(Os.current&&Yn.current===ie)&&(oe(`[useEffect] Running ensureSession for sessionId=${ie}, hasInitialized=${Os.current}`),Os.current=!0,Mn.current=!0,Pe=++Fs.current,re(Pe))};if(!N&&!Mn.current){oe(`[useEffect] Holding background connection until the selected session is ready: ${ie}`);return}const Be=Mn.current?0:Math.max(0,I);return Be>0?(oe(`[useEffect] Delaying initial connection for sessionId=${ie} by ${Be}ms`),rt=window.setTimeout(Dt,Be)):Dt(),()=>{rt!==null&&window.clearTimeout(rt),oe(`[useEffect] Cleanup for sessionId=${ie}, runId=${Pe??"pending"}`)}},[ie,$r,qs,en,Ee,oe,Y,We,Yr,I,N,ft]);const vo=S.useCallback(async()=>{if(ie&&!jr){Jr(!0),Xt(null),Lr(!1),Nn(null),en();try{Ee.forceKill&&await Ee.forceKill({sessionId:ie})}catch{}_r(ie),is(ie),ur.current?.clear(),await new Promise(re=>setTimeout(re,100));try{Xr(ie,!0);const re=await vn();hn(ie,re),kr.current=re.sessionId,qs(re.sessionId)}catch(re){Xt(re instanceof Z1&&Ng(re)?lf:"Reconnecting..."),Lr(!0),Xr(ie,!1)}finally{Jr(!1)}}},[ie,jr,en,Ee,_r,is,Xr,hn,qs,vn]),oa=S.useCallback((re,Pe)=>{if(!br.current||!re)return;const rt=KS(re),Dt=/^(\x1b\[<6[45];[0-9]+;[0-9]+M)+$/.test(re);if(kn&&Dt&&(Or.current=!0),Date.now()<hs.current)return;let Be=re,pt=Pe?.consumeModifier??!1;if(!Pe?.skipModifierTransform&&bt&&re.length>0){const on=re[0];if(on.length===1&&/[a-zA-Z]/.test(on)){const wr=on.toUpperCase();bt==="ctrl"?(Be=String.fromCharCode(wr.charCodeAt(0)&31),pt=!0):bt==="alt"&&(Be=`\x1B${re}`,pt=!0)}pt||(bt==="alt"&&(Be=`\x1B${re}`),pt=!0)}const yr=kr.current;if(!yr)return;(async()=>{try{if(kn&&!rt&&Or.current&&Ee.tmuxAction){Or.current=!1;try{await Ee.tmuxAction(yr,{action:"copy-mode",enabled:!1})}catch{}if(XS(Be))return}await Ee.sendInput(yr,Be),Zt(ie)}catch(on){Xt(on instanceof Error?on.message:"Failed to send input")}})(),pt&&(St||It(null),In())},[bt,Zt,In,kn,St,Ee]);S.useEffect(()=>{const re=Pe=>{if(!br.current)return;const rt=Pe,Dt=rt.detail?.text;if(!Dt)return;const Be=rt.detail?.nonce;if(vr.current){Be&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:Be,ok:!1}}));return}ur.current?.sendSequence(Dt,{paste:rt.detail?.paste}),Be&&window.dispatchEvent(new CustomEvent("termdock-insert-reference-ack",{detail:{nonce:Be,ok:!0}})),H9(zn.current,rt.detail?.focus!==!1)&&In()};return window.addEventListener("termdock-insert-reference",re),()=>window.removeEventListener("termdock-insert-reference",re)},[In]);const Za=S.useCallback((re,Pe,rt)=>{const Dt=kr.current;if(!Dt){de("xterm resize push skipped: no terminalId",{cols:re,rows:Pe});return}de("xterm resize push",{cols:re,rows:Pe}),Ee.resize({sessionId:Dt,cols:re,rows:Pe,seq:rt}).catch(Be=>{ur.current?.acknowledgeResize({seq:rt,ok:!1}),Be&&/session not found/i.test(String(Be.message||Be))&&console.warn("[Terminal] resize 404 session not found",{sessionId:Dt,cols:re,rows:Pe,stack:new Error().stack})})},[Ee,de]),wo=S.useCallback(async re=>{const Pe=kr.current;if(!(!Pe||!Ee.tmuxAction))try{const rt=await Ee.tmuxAction(Pe,re);rt.layout&&(pn(rt.layout),re.action==="switch-session"&&(hn(ie,{sessionId:Pe,cols:80,rows:24,mode:"tmux",tmuxSessionName:rt.layout.sessionName}),lv(ie,{tmuxSessionName:rt.layout.sessionName}).catch(Dt=>{console.warn("[Terminal] failed to update inventory after tmux switch",Dt)})))}catch(rt){Xt(rt instanceof Error?rt.message:"Failed to execute tmux action")}},[ie,hn,Ee]);S.useEffect(()=>{if(!Pr||!Dr)return;const Pe=Pr.windows.find(rt=>rt.id===Pr.activeWindowId)?.panes.find(rt=>rt.id===Pr.activePaneId);Pe&&ur.current?.requestRefresh("tmux-layout",{skipScrollToBottom:!0,dedupeKey:`${Dr}:${Pr.sessionId}:${Pe.id}:${Pe.width}x${Pe.height}`})},[Pr,Dr]);const aa=S.useCallback((re,Pe=5)=>{const rt=Math.max(1,Math.min(Math.floor(Pe)||1,40));Or.current=!0;const Dt=mn.current;if(Dt&&Dt.direction===re){Dt.lines+=rt;return}Dt&&wo({action:"scroll",direction:Dt.direction,lines:Dt.lines}).finally(()=>{In()}),mn.current={direction:re,lines:rt},P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{const Be=mn.current;Be&&(mn.current=null,wo({action:"scroll",direction:Be.direction,lines:Be.lines}).finally(()=>{In()}))},0)},[In,wo]),Ao=S.useCallback(re=>{const Pe=Date.now(),rt=Ne.current,Dt=rt!==null&&rt.modifier===re&&Pe-rt.timestamp<=P_;if(Ne.current={modifier:re,timestamp:Pe},St===re){Ht(null),It(null);return}if(Dt){Ht(re),It(re);return}St!==null&&St!==re&&Ht(null),It(Be=>Be===re?null:re)},[St]),la=S.useCallback(re=>{if(Le(re&&br.current),de("input focus changed",{focused:re,isActive:br.current,isMobile:zn.current}),!zn.current||!br.current){$e(!1);return}$e(Pe=>Pe===re?Pe:re)},[de]),Zi=S.useCallback(re=>{if(Kr.current=re,Ot(re,"viewport-watermark"),!re&&Kn.current.length>0){const Pe=ie;if(Pe){const rt=Kn.current;Kn.current=[];for(const Dt of rt)Rr(Pe,Dt)}}},[Rr,Ot,ie]),Yi=S.useCallback(re=>{br.current&&ur.current?.ensureSizeMatches(re)},[]),di=S.useRef(null);S.useEffect(()=>{if(!u)return;const re=di.current;if(!re)return;const Pe=()=>Yi("pointerdown"),rt=()=>Yi("keydown"),Dt=()=>Yi("touchstart"),Be=()=>Yi("wheel");return re.addEventListener("pointerdown",Pe),re.addEventListener("keydown",rt),re.addEventListener("touchstart",Dt,{passive:!0}),re.addEventListener("wheel",Be,{passive:!0}),()=>{re.removeEventListener("pointerdown",Pe),re.removeEventListener("keydown",rt),re.removeEventListener("touchstart",Dt),re.removeEventListener("wheel",Be)}},[u,Yi]);const Zs=S.useCallback(re=>{ur.current=re},[]),us=S.useCallback(re=>{ct(re),Z?.(ie,re)},[Z,ie]),Ya=S.useCallback(re=>{const Pe=o_(re);if(!Pe)return;const rt=bt!==null;ur.current?.sendSequence(Pe,{consumeModifier:rt})},[bt]),fs=S.useCallback(re=>{const Pe=t_(re);if(Pe.length===0)return;const rt=bt!==null;ur.current?.sendSequence(Ig(Pe[0]),{consumeModifier:rt});for(let Dt=1;Dt<Pe.length;Dt+=1){const Be=Pe[Dt];window.setTimeout(()=>{ur.current?.sendSequence(Ig(Be))},e_*Dt)}},[bt]),Ia=S.useCallback(()=>{ur.current?.pasteClipboardText()},[]),Ki=S.useCallback(re=>{O.current!==null&&(window.clearTimeout(O.current),O.current=null),nt(re),(re==="inserted"||re==="failed")&&(O.current=window.setTimeout(()=>{O.current=null,nt("idle")},1400))},[]),ca=S.useCallback(()=>{Ki("idle"),gr(0),ne.current?.click()},[Ki]),Wo=S.useCallback(re=>{const Pe=re.currentTarget.files?.[0];re.currentTarget.value="",Pe&&(gr(0),Ki("uploading"),qx(Pe,(rt,Dt)=>Zd(rt,Dt,void 0,gr),rt=>{if(!br.current||vr.current)throw new Error("Terminal unavailable");window.dispatchEvent(new CustomEvent("termdock-insert-reference",{detail:{text:B_(rt,null),focus:!0}}))}).then(()=>Ki("inserted"),()=>Ki("failed")))},[Ki]),oo=$n||Mt!==null;vr.current=oo;const Ea=S.useRef(Zn);oo||(Ea.current=Zn);const Ma=oo?Ea.current:Zn,Ra=S.useMemo(()=>r_(Ma,Ln),[Ma,Ln]),ua=S.useMemo(()=>Mg(Ln,ve),[ve,Ln]),rs=!ce&&ve!=="auto"&&ua.showOnDesktop!==!0?"auto":ve,Go=rs==="auto"?Ra:rs,Ci=S.useMemo(()=>Mg(Ln,Go),[Go,Ln]),Ka=S.useMemo(()=>Ci.actions.filter(re=>re.sequence.trim().length>0).map((re,Pe)=>({...re,label:rp(re,Pe)})),[Ci.actions]),Vo=S.useMemo(()=>Ux(Zn),[Zn]),Wn=Ci.label,hi=S.useMemo(()=>rs!=="auto"?`Manual preset: ${Ci.label}`:Vo?`Auto preset · ${Ci.label} (${Vo})`:"Auto preset",[Vo,rs,Ci.label]),To=S.useCallback(re=>{_t(re)},[]),da=S.useCallback(()=>{yt(re=>re==="copy"?"arrows":"copy"),ke("idle")},[]),ao=S.useCallback(()=>{typeof window>"u"||(Fr.current!==null&&window.clearTimeout(Fr.current),Fr.current=window.setTimeout(()=>{Fr.current=null,ke("idle")},1200))},[]),ha=S.useCallback(re=>{Fr.current!==null&&typeof window<"u"&&(window.clearTimeout(Fr.current),Fr.current=null),ke(re?"copied":"failed"),ao()},[ao]),Ys=S.useCallback(re=>{Me(re)},[]),Xa=S.useMemo(()=>ce?n_(Ln):s_(Ln),[ce,Ln]),gn=S.useMemo(()=>cv(i),[i]),ps=S.useMemo(()=>`terminal::${ie}`,[ie]);S.useEffect(()=>{Ke?.({isConnecting:$n,isRestarting:jr,hasError:!!Mt,sessionId:Dr})},[$n,jr,Mt,Dr,Ke]);const Gn=!Dr||$n||jr,ks=S.useCallback((re,Pe)=>{if(Gn)return;const rt=Math.max(1,Math.min(Math.floor(Pe)||1,40));aa(re,rt)},[aa,Gn]);S.useEffect(()=>{if(!u||!ce)return;ur.current?.requestRefresh("resize",{skipScrollToBottom:!Qt,force:!0})},[u,ce,Qt,ut,ie]),S.useEffect(()=>{if(!u||!ce)return;const re=Pe=>{const rt=Pe.detail;ur.current?.requestRefresh("resize",{skipScrollToBottom:rt?.isOpen!==!0,force:!0})};return document.addEventListener("termdock:viewport-keyboard-change",re),()=>{document.removeEventListener("termdock:viewport-keyboard-change",re)}},[u,ce,ie]);const lo=!q&&(ce||Ci.showOnDesktop===!0),qo=u,co=ce&&!Ue?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,Di=ce&&!Ue?{marginTop:"var(--kb-margin-top, 0px)",transition:"none"}:void 0,fi=a.jsx(a_,{visible:lo,interactive:qo,presentation:ce?"mobile":"desktop-actions",activeModifier:bt,lockedModifier:St,disabled:Gn,defaultShowExtended:te,presetLabel:Wn,presetModeLabel:hi,presetMode:rs,presetOptions:Xa,includeAlt:Ci.includeAlt,presetRowLayout:Ci.rowLayout,extraActions:Ka,onKeyPress:Ya,onTextPress:fs,onPastePress:ce?Ia:void 0,onFilePress:ce?ca:void 0,fileUploadState:Ce,fileUploadProgress:xe,longPressMode:Ve,copyFeedback:Gt,onLongPressModeToggle:da,onModifierToggle:Ao,onPresetSelect:To,onExpandedChange:Ys}),wn=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:co,children:[a.jsx("input",{ref:ne,type:"file",className:"hidden",onChange:Wo}),Dn&&a.jsx(l_,{isMobile:ce,isInputFocused:$,isIOS:at,isConnecting:$n,connectionError:Mt,terminalSessionId:Dr}),a.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden",style:{backgroundColor:gn.background,...Di},children:[a.jsx("div",{ref:di,className:"h-full w-full box-border",children:a.jsx(uv,{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:qe("terminal.componentFailed")})]})}),children:a.jsx(HS,{ref:Zs,sessionKey:ps,sessionId:ie,isLayoutVisible:g,chunks:as,onInput:oa,onResize:Za,onFlowControl:Zi,onTmuxScroll:kn?ks:void 0,tmuxScrollSensitivity:.38,onDoubleTap:ce?()=>{ur.current?.sendSequence(" ")}:void 0,onInputFocusChange:la,onMobileLongPressCopyResult:ha,onReadyChange:us,onSizeSynchronizedChange:gt,onWritesSettled:ze,onWriteProgress:Vt,onCursorPositionChange:dr,onDirectoryLinkActivate:On,terminalSettings:ye,theme:gn,enableTouchScroll:ce,mobileLongPressMode:Ve,autoFocus:!f&&!ce&&!wn,cursorVisible:!f&&Kt,suppressSmoothScroll:!we||!Qe,className:f||!Kt?"terminal-focus-suspended":void 0},ps)})}),a.jsx(u_,{connectionError:Mt,isFatalError:At,isRestarting:jr,isConnecting:$n,onHardRestart:vo})]}),pe?q?null:qa.createPortal(fi,pe):fi]})};function $_({session:e,active:t,onActivate:r,onToggleRightSidebar:s}){const{t:i}=Gr(),c=Qr(u=>{const f=u.sessions.get(e.id);return Ca(e,f?.activeProgram??null,f?.cwd??null,void 0,f?.shellTitle??null,f?.promptState??null).primary});return a.jsxs("div",{"data-pane-titlebar":"true",className:"swiper-no-swiping flex h-6 min-h-6 shrink-0 items-center border-b border-border app-chrome-bg",children:[a.jsxs("button",{type:"button","data-split-pane-title":e.id,draggable:!1,onDragStart:u=>u.preventDefault(),"aria-pressed":t,title:`${c} · 拖动标题移动,边缘拆分,中央交换`,onClick:r,className:"split-pane-drag-handle flex h-full min-w-0 cursor-grab active:cursor-grabbing flex-1 items-center gap-1.5 overflow-hidden px-2 text-left text-[12px] font-medium leading-none text-foreground hover:bg-surface focus-visible:outline focus-visible:outline-1 focus-visible:outline-primary focus-visible:-outline-offset-1",children:[a.jsx($o,{size:11,className:`shrink-0 ${t?"text-primary":"text-muted-foreground"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),a.jsx(Kd,{size:12,"aria-hidden":"true",className:"shrink-0 text-muted-foreground"}),t&&a.jsx("span",{"aria-hidden":"true",className:"h-1 w-1 shrink-0 rounded-full bg-primary"})]}),s&&a.jsx("button",{type:"button",onClick:s,"aria-label":i("tab.explorerTitle"),title:i("tab.explorerTitle"),className:"inline-flex h-full w-7 shrink-0 items-center justify-center text-muted-foreground hover:bg-surface hover:text-foreground focus-visible:outline focus-visible:outline-1 focus-visible:outline-primary focus-visible:-outline-offset-1",children:a.jsx(q5,{size:14})})]})}const z_="termdock:startup:";function R0(e){if(typeof performance>"u"||typeof performance.mark!="function")return;const t=`${z_}${e}`;performance.getEntriesByName(t,"mark").length>0||performance.mark(t)}function H_(e,t){e||qa.flushSync(t)}const np="horizontal";function B0(e){return e<=0?[]:Array.from({length:e},()=>1/e)}function wd(e,t){if(!Array.isArray(e)||e.length!==t)return B0(t);const r=e.map(Number);if(r.some(i=>!Number.isFinite(i)||i<=0))return B0(t);const s=r.reduce((i,c)=>i+c,0);return s<=0?B0(t):r.map(i=>i/s)}function W_(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 G_(e){return e==="horizontal"||e==="vertical"||e==="grid"}function V_(e){if(!Array.isArray(e))return[];const t=new Set,r=new Set,s=[];for(const i of e){if(!i||typeof i!="object")continue;const c=i;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 p=W_(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:G_(c.layout)?c.layout:np,ratios:wd(c.ratios,f.length),...c.gridColumnRatios!==void 0?{gridColumnRatios:wd(c.gridColumnRatios,p.columns)}:{},...c.gridRowRatios!==void 0?{gridRowRatios:wd(c.gridRowRatios,p.rows)}:{}})}return s}function q_(e,t){const r=new Set(t);return e.flatMap(s=>{const i=s.sessionIds.filter(c=>r.has(c));return i.length<2?[]:[{...s,sessionIds:i,ratios:i.length===s.sessionIds.length?wd(s.ratios,i.length):B0(i.length)}]})}function su(e,t){if(t)return e.find(r=>r.sessionIds.includes(t))}function uf(e,t,r){if(!t||!r||t===r)return e;const s=su(e,t),i=su(e,r);if(s&&s.id===i?.id)return e;const c=[...s?.sessionIds??[t],...i?.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===np)?"grid":s?.layout??np,ratios:B0(u.length)},p=new Set([s?.id,i?.id].filter(Boolean)),g=e.filter(b=>!p.has(b.id)),x=s?Math.max(0,e.findIndex(b=>b.id===s.id)):g.length;return g.splice(Math.min(x,g.length),0,f),g}function Z_(e,t){const r=su(e,t);if(!r||!t)return e;if(r.sessionIds.length<=2)return e.filter(i=>i.id!==r.id);const s=r.sessionIds.filter(i=>i!==t);return e.map(i=>i.id===r.id?{...i,sessionIds:s,ratios:B0(s.length)}:i)}function Y_(e,t){const r=su(e,t);return r?e.filter(s=>s.id!==r.id):e}function K_(e,t,r){return e.map(s=>{if(s.id!==t)return s;const i=[...new Set(r)],c=new Set(s.sessionIds);return i.length===s.sessionIds.length&&i.every(f=>c.has(f))?{...s,sessionIds:i}:s})}function X_(e,t,r){const s=r.trim().slice(0,80);return e.map(i=>i.id===t?{...i,...s?{name:s}:{name:void 0}}:i)}const sp=320,Zx=1,J_=sp+120,ip="termdock:split-workspaces:v2",Yx="termdock:split-workspace:v1",eL=.1,tL=.9;function df(){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 rL(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(ip);if(e)return V_(JSON.parse(e));const t=JSON.parse(window.localStorage.getItem(Yx)||"null");if(t&&typeof t.primaryId=="string"&&typeof t.secondaryId=="string"&&t.primaryId!==t.secondaryId){const r=Math.min(tL,Math.max(eL,typeof t.ratio=="number"?t.ratio:.5));return[{id:`split:${t.primaryId}`,sessionIds:[t.primaryId,t.secondaryId],layout:t.direction==="vertical"?"vertical":"horizontal",ratios:[r,1-r]}]}}catch{}return[]}function nL(e,t){const r=new Map(e.map(u=>[u.id,u])),s=new Map;t.forEach(u=>u.sessionIds.forEach(f=>s.set(f,u)));const i=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(i.has(f.id))continue;i.add(f.id);const p=f.sessionIds.flatMap(g=>{const x=r.get(g);return x?[x]:[]});p.length>=2&&c.push({key:f.id,sessions:p,workspace:f})}return c}function Pg(e){const t=e.wrapperEl;if(t)try{t.getAnimations().forEach(r=>r.cancel())}catch{}}function td(e,t){const r=Nd(e,t);if(r===null)return;const s=e.wrapperEl;Pg(e),s&&(s.style.transitionDuration="0ms");try{const i=e;i.setTransition?.(0),i.setTranslate?.(r),Pg(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 op(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 Nd(e,t){const r=e.snapGrid,s=Array.isArray(r)?r[t]:void 0;return typeof s!="number"||!Number.isFinite(s)?null:-s}function sL(e,t){const r=op(e),s=Nd(e,t);return r!==null&&s!==null&&Math.abs(r-s)<=Zx}function iL(e){const t=[],r=new Map,s=new Map,i=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=i.get(c.tmuxSessionName)??[];f.push(c.id),i.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 i)u.length>1&&t.push({kind:"tmux",key:c,sessionIds:u});return t}function Kx(e){const t=new Map;for(const r of e)t.set(r.id,r);return Array.from(t.values())}function Xx(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 oL(e,t){const r=Kx(e),s=r.findIndex(i=>i.id===t.id);if(s>=0){const i=[...r];return i[s]=t,i}return[...r,t]}function Og(e,t){const r=new Map(e.map(s=>[s.id,s]));return t.map(s=>{const i=r.get(s.sessionId);return{...Xx(s),history:i?.history}})}function Fg(e,t){return e.length===0?null:t&&e.some(r=>r.sessionId===t)?t:e[0]?.sessionId??null}function Ug(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 $g(e){const t=new Map;for(const[r,s]of e)t.set(r,s.cwd??null);return t}function aL(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 lL(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 cL=({terminalSettings:e=Fp(),colorTheme:t="dark",toolbarPresets:r=[],showDebug:s,terminalFocusAvailable:i=!0,defaultSessionMode:c="shell",defaultTmuxSessionName:u="",connectionPrioritySessionId:f=null,connectionPriorityReady:p=!0,desktopRightSidebarEnabled:g=!1,onToggleRightSidebar:x,desktopFloatingTitle:b=!1,desktopPinnedLeftSidebarWidth:v=0,desktopViewportWidth:w=0,onStatusChange:k,onSessionDataUpdate:I,onInitialViewportReady:N,onInitialRecoveryRequired:M})=>{const{t:D}=Gr(),F=A.useMemo(()=>j0("session"),[]),Z=A.useMemo(()=>j0("terminal"),[]),[G,U]=A.useState([]),[q,pe]=A.useState(null),Ue=Ws(O=>O.activePaneId);A.useEffect(()=>{Ws.getState().setActivePane(q)},[q]);const[be,Ae]=A.useState(null),[Ke,qe]=A.useState(!0),[ie,Se]=A.useState({token:0,reason:"visibility",forceForegroundReconnect:!1}),[tt,Ee]=A.useState(()=>new Set),[oe,de]=A.useState(()=>({token:0,completed:new Set})),[Te,ee]=A.useState(0),[ye,ce]=A.useState(()=>new Set),[Ye,at]=A.useState(()=>new Set),[_e,$]=A.useState(()=>new Set),$e=A.useRef(!1),Xe=A.useRef(null),Le=A.useRef({}),[K,Fe]=A.useState(null),[fe,De]=A.useState(()=>rL()),[lt,Tt]=A.useState(!1),[we,me]=A.useState(null),[Qe,gt]=A.useState(null),[ft,ct]=A.useState(null),[Kt,$t]=A.useState(!1),[Qt,ut]=A.useState(()=>df().mobile),[bt,It]=A.useState(()=>df().landscape),[St,Ht]=A.useState(null),[te,Me]=A.useState(null),ve=A.useRef(i),_t=A.useRef(!1),Ve=A.useRef(!1),yt=A.useRef(null),Gt=A.useRef(null),ke=A.useRef(Qt),Ce=A.useRef(null),nt=A.useRef(0),xe=A.useRef([]),gr=A.useRef(0),xt=A.useRef(null),hn=A.useRef(!1),Xr=A.useRef(!0),Rr=A.useRef(null),Vr=A.useRef(""),Un=A.useRef(0);A.useEffect(()=>{if(typeof window>"u")return;const O=()=>{const ne=df();ke.current=ne.mobile,ut(ne.mobile),It(ne.landscape)};return O(),window.addEventListener("resize",O),()=>window.removeEventListener("resize",O)},[]);const{sessions:_r,inventory:is,activeSessionId:xr,isLoading:ae,openSession:ar,setActiveSession:it,removeSession:os,renameSession:fn,resetSessionCustomName:Zt,reorderSessions:Yr,restoreSessions:Ur}=dv(),Nr=is?.tmuxRecovery??null;A.useEffect(()=>{Nr&&M?.()},[Nr,M]),A.useEffect(()=>{ct(null),gt(null)},[Nr?.id]);const Zn=A.useCallback(async()=>{gt("restore"),ct(null);try{const O=await hv();await Ur(),O.failed>0&&ct(D("tab.tmuxRecoveryPartial",{restored:O.restored,failed:O.failed}))}catch{ct(D("tab.tmuxRecoveryFailed"))}finally{gt(null)}},[Ur,D]),Ln=A.useCallback(async()=>{gt("dismiss"),ct(null);try{await fv(),await Ur()}catch{ct(D("tab.tmuxRecoveryDismissFailed"))}finally{gt(null)}},[Ur,D]),kn=Ft(O=>O.groupByFolder),as=Wc(O=>O.collaborationGroups),$n=Ft(O=>O.leftOpen||O.rightOpen),Dr=Ft(O=>O.rightSidebarWidthContextKey),On=Ft(O=>O.rightSidebarWidth),Y=Ft(O=>O.rightPinned),[We,Mt]=A.useState(()=>$g(Qr.getState().sessions));A.useEffect(()=>Qr.subscribe(O=>{const ne=$g(O.sessions);Mt(le=>aL(le,ne)?le:ne)}),[]);const{arranged:Xt}=A.useMemo(()=>Cd(G,O=>We.get(O.id)??null,kn,"",fe,as),[G,We,kn,fe,as]),vr=A.useRef(Xt);vr.current=Xt;const At=A.useMemo(()=>nL(Xt,fe),[Xt,fe]),Lr=A.useRef(At);Lr.current=At;const jr=A.useMemo(()=>su(fe,q),[q,fe]),Jr=A.useMemo(()=>{const O=At.find(ne=>ne.sessions.some(le=>le.id===q));return new Set(O?.sessions.map(ne=>ne.id)??[])},[q,At]),Ts=A.useMemo(()=>{const O=new Map;if(!g||w<=0)return O;for(const ne of At){const le=ne.sessions[0];if(!le)continue;const ze=pv(le.id,We.get(le.id)??null,ne.workspace?.id??null);if(!(ze===Dr?Y:mv(le.id,We.get(le.id)??null,ne.workspace?.id??null)))continue;const Pt=ze===Dr?On:gv(le.id,We.get(le.id)??null,ne.workspace?.id??null),Vt=hd(Pt,w,v);O.set(ne.key,Vt+D5)}return O},[We,v,g,Y,Dr,On,w,At]),Nn=A.useMemo(()=>af(G.map(O=>({id:O.id,backendSessionId:O.sessionId})),f),[f,G]),$r=A.useMemo(()=>Fg(_r,xr),[xr,_r]),zr=ed({prioritySessionId:Nn,activeSessionId:be??q,persistedActiveSessionId:$r,firstSessionId:G[0]?.id??null}),Pr=A.useMemo(()=>M_(At.flatMap(O=>O.sessions.map(ne=>ne.id)),Jr),[Jr,At]),pn=zr!==null&&tt.has(zr),Dn=A.useMemo(()=>{const O=new Set(Jr);return be&&O.add(be),!O.size&&zr&&O.add(zr),O},[Jr,be,zr]),cs=oe.token===ie.token&&L_(Dn,oe.completed),Ti=cs||Te===ie.token?ie.token:-1;A.useEffect(()=>{if(!ie.token||cs)return;const O=window.setTimeout(()=>ee(ie.token),g_);return()=>window.clearTimeout(O)},[ie.token,cs]);const kr=A.useCallback((O,ne)=>{Ee(le=>{if(le.has(O)===ne)return le;const Lt=new Set(le);return ne?Lt.add(O):Lt.delete(O),Lt})},[]),Yn=A.useCallback(O=>{const ne=nt.current;de(ze=>{if(ze.token===ne&&ze.completed.has(O))return ze;const Lt=new Set(ze.token===ne?ze.completed:[]);return Lt.add(O),{token:ne,completed:Lt}});const le=Nn??be??Ce.current;O===le&&R0("foreground-stream-connected")},[be,Nn]),ur=A.useCallback((O,ne)=>{ce(le=>{if(le.has(O)===ne)return le;const ze=new Set(le);return ne?ze.add(O):ze.delete(O),ze})},[]),Kr=A.useCallback((O,ne)=>{at(le=>{if(le.has(O)===ne)return le;const ze=new Set(le);return ne?ze.add(O):ze.delete(O),ze})},[]),sn=zr!==null&&ye.has(zr),Kn=zr!==null&&Ye.has(zr);A.useEffect(()=>{sn&&R0("foreground-viewport-ready")},[sn]),A.useEffect(()=>{Kn&&R0("foreground-content-ready")},[Kn]),A.useEffect(()=>{if(N){if(!Ke&&G.length===0){N();return}!sn||!pn||!Kn||(R0("initial-viewport-presented"),N())}},[pn,Kn,sn,Ke,N,G.length]);const hs=A.useMemo(()=>Qt?y_({slides:At.map(O=>O.sessions.map(ne=>ne.id)),visibleSessionIds:Jr,foregroundSessionId:zr}):_e,[Qt,At,Jr,zr,_e]);A.useEffect(()=>{if(Qt||Jr.size===0)return;const O=new Set(Jr),ne=At.findIndex(le=>le.sessions.some(ze=>Jr.has(ze.id)));for(let le=-2;le<=2;le+=1)le!==0&&At[ne+le]?.sessions.forEach(ze=>O.add(ze.id));$(le=>{let ze=!1;const Lt=new Set(le);for(const Pt of O)Lt.has(Pt)||(Lt.add(Pt),ze=!0);return ze?Lt:le})},[Qt,Jr,At]);const Or=J9(hs);A.useEffect(()=>{if(!be)return;if(!G.some(ne=>ne.id===be)){Ae(null);return}if(!ye.has(be)||!tt.has(be)||!Ye.has(be))return;const O=window.setTimeout(()=>{Ae(ne=>ne===be?null:ne),ve.current&&!ke.current&&Fe({sessionId:be,token:Date.now()})},80);return()=>window.clearTimeout(O)},[Ye,be,tt,G,ye]),A.useEffect(()=>{typeof window>"u"||(fe.length>0?(window.localStorage.setItem(ip,JSON.stringify(fe)),window.localStorage.removeItem(Yx)):window.localStorage.removeItem(ip))},[fe]),A.useEffect(()=>{ae||Ke||fe.length===0||De(O=>q_(O,G.map(ne=>ne.id)))},[ae,Ke,G,fe.length]),A.useEffect(()=>{if(!we)return;const O=window.setTimeout(()=>me(null),3200);return()=>window.clearTimeout(O)},[we]),Ce.current=q,nt.current=ie.token,xe.current=G,xt.current=xr,hn.current=ae,Xr.current=Ke,ve.current=i;const mn=A.useCallback((O=Xe.current)=>{const ne=gr.current,le=typeof window<"u"?window.visualViewport:null,ze=O?op(O):null,Lt=O?Nd(O,ne):null;return{sessionsLength:xe.current.length,workspaceSlidesLength:Lr.current.length,sessionIds:xe.current.map(Pt=>Pt.id),activeSessionId:Ce.current,activeSessionIndex:ne,persistedActiveId:xt.current,isLoading:hn.current,isRestoring:Xr.current,activeIndex:O?.activeIndex??null,previousIndex:O?.previousIndex??null,animating:O?.animating??null,allowTouchMove:O?.allowTouchMove??null,width:O?.width??null,translate:ze,targetTranslate:Lt,translateDelta:ze!==null&&Lt!==null?ze-Lt:null,snapGridLength:O?.snapGrid?.length??null,targetSnap:O?.snapGrid?.[ne]??null,visualViewport:le?{width:Math.round(le.width),height:Math.round(le.height),offsetTop:Math.round(le.offsetTop)}:null}},[]),P=A.useCallback((O,ne)=>{F(O,{...mn(),...ne})},[F,mn]);A.useEffect(()=>{ae||Ke||q!==xr&&it(q)},[q,ae,Ke,xr,it]);const he=A.useMemo(()=>{if(Xt.length===0||!q)return 0;const O=At.findIndex(ne=>ne.sessions.some(le=>le.id===q));return O>=0?O:0},[At,q]);gr.current=he;const Ne=A.useCallback(()=>{yt.current&&(clearTimeout(yt.current),yt.current=null)},[]),je=A.useCallback(O=>{Ne(),yt.current=setTimeout(()=>{yt.current=null,_t.current=!1,P("[swiper:touch-guard-clear]",{reason:O})},J_)},[Ne,P]),Re=A.useCallback((O,ne={})=>{const le=Xe.current,ze=gr.current,Lt=Lr.current;if(!le||Lt.length===0||ze<0||ze>=Lt.length)return;if(_t.current){P("[swiper:sync-skip-touch]",{reason:O});return}if(le.animating){P("[swiper:sync-skip-animating]",{reason:O});return}const Pt=op(le),Vt=Nd(le,ze),dr=Pt!==null&&Vt!==null&&Math.abs(Pt-Vt)<=Zx,Bt=le.activeIndex===ze;if(P("[swiper:sync-check]",{reason:O,activeIndexAligned:Bt,translateAligned:dr,immediate:ne.immediate===!0}),!(Bt&&dr)){if(Bt){td(le,ze),P("[swiper:sync-forced-active]",{reason:O,translateAligned:dr,immediate:ne.immediate===!0});return}ne.immediate?(td(le,ze),le.slideTo(ze,0,!1),td(le,ze)):le.slideTo(ze,sp,!1),P("[swiper:sync-applied]",{reason:O,activeIndexAligned:Bt,translateAligned:dr,immediate:ne.immediate===!0})}},[P]);A.useEffect(()=>{const O=ne=>{const le=ne;Xe.current&&(Xe.current.allowTouchMove=!le.detail.locked),P("[swiper:gesture-lock]",{locked:le.detail.locked})};return document.addEventListener("termdock:gesture-lock",O),()=>document.removeEventListener("termdock:gesture-lock",O)},[P]),A.useEffect(()=>{if(G.length===0){q!==null&&pe(null);return}if(!q){if(!p)return;pe(ed({prioritySessionId:Nn,activeSessionId:null,persistedActiveSessionId:$r,firstSessionId:G[0]?.id??null}));return}G.some(ne=>ne.id===q)||pe(G[0].id)},[G,q,p,Nn,$r]);const dt=A.useCallback((O,ne)=>{if(ne&&Date.now()<Un.current){Le.current[O]=!1;return}Le.current[O]=ne,Me(le=>ne?O:le===O?null:le)},[]),wt=A.useCallback(O=>{if(!_t.current&&O.activeIndex!==gr.current){P("[swiper:slide-change-ignored-layout]",{instanceActiveIndex:O.activeIndex,expectedActiveIndex:gr.current}),requestAnimationFrame(()=>Re("ignored-layout-slide-change",{immediate:!0}));return}const ne=Lr.current[O.activeIndex],le=ne?.sessions.some(Pt=>Pt.id===q)?q:ne?.sessions[0]?.id;if(P("[swiper:slide-change]",{nextSessionId:le??null,instanceActiveIndex:O.activeIndex}),!le||le===q)return;const ze=!!q&&Le.current[q]===!0,Lt=ve.current&&(!ke.current||ze);if(Gt.current=le,pe(le),Lt){Fe({sessionId:le,token:Date.now()});return}Fe(null)},[G,q,P,Re]);A.useLayoutEffect(()=>{if(Gt.current===q){P("[swiper:sync-skip-swiper-driven]",{activeSessionId:q}),Gt.current=null;return}Re("active-session-index",{immediate:!0})},[q,he,G.length,Re,P]),A.useEffect(()=>{const O=Xe.current;if(!O)return;const ne=At.length>1&&!$n&&!lt;O.allowTouchMove!==ne&&(O.allowTouchMove=ne,P("[swiper:allow-touch-sync]",{nextAllow:ne,sidebarOverlayOpen:$n}))},[At.length,P,$n,lt]);const Je=A.useCallback(O=>{const ne=Xe.current;if(!ne)return;const le=ne.el;if(P("[swiper:layout-before]",{reason:O,scrollLeft:le?.scrollLeft??null}),le&&(le.scrollLeft=0),ne.updateSize(),ne.updateSlides(),ne.updateProgress(),ne.updateSlidesClasses(),le&&(le.scrollLeft=0),P("[swiper:layout-after]",{reason:O,scrollLeft:le?.scrollLeft??null}),_t.current||ne.animating){P("[swiper:layout-skip-sync-motion]",{reason:O});return}Re(`layout:${O}`,{immediate:!0}),requestAnimationFrame(()=>{const ze=Xe.current;ze&&(_t.current||ze.animating||td(ze,gr.current))})},[P,Re]);A.useEffect(()=>()=>Ne(),[Ne]);const Ge=At.map(O=>O.key).join("\0");A.useEffect(()=>{requestAnimationFrame(()=>Je("group-change"))},[kn,Ge,Je]),A.useEffect(()=>{let O=null,ne="mount";const le=dr=>{ne=dr,O===null&&(O=requestAnimationFrame(()=>{O=null,Je(`viewport-change:${ne}`)}))},ze=()=>le("window-resize"),Lt=()=>le("visual-viewport-resize"),Pt=()=>le("visual-viewport-scroll"),Vt=dr=>{le(`measured:${dr.detail?.source??"unknown"}`)};return window.addEventListener("resize",ze),window.visualViewport?.addEventListener("resize",Lt),window.visualViewport?.addEventListener("scroll",Pt),document.addEventListener(Y1,Vt),le("mount"),()=>{window.removeEventListener("resize",ze),window.visualViewport?.removeEventListener("resize",Lt),window.visualViewport?.removeEventListener("scroll",Pt),document.removeEventListener(Y1,Vt),O!==null&&cancelAnimationFrame(O)}},[Je]),A.useEffect(()=>{if(typeof document>"u")return;let O=null,ne=null;const le=Bt=>{if(Bt!=="online"&&document.hidden)return;const ir=performance.now();if(!k_(ne,ir))return;ne=ir;const qr=Bt==="bfcache"||Bt==="online"?Bt:"visibility",vn=I_();kh(),mo("info","PWA_RESUME scheduled",{source:Bt,forceForegroundReconnect:vn,activeSessionId:Ce.current}),Se(Hn=>({token:Hn.token+1,reason:qr,forceForegroundReconnect:vn})),requestAnimationFrame(()=>Je(`resume:${Bt}:raf`)),O&&clearTimeout(O),O=setTimeout(()=>{O=null,Je(`resume:${Bt}:settled`)},320)},ze=()=>{if(document.hidden){kh();return}le("visibility")},Lt=()=>{kh()},Pt=Bt=>{le(Bt.persisted?"bfcache":"pageshow")},Vt=()=>le("online"),dr=()=>le("focus");return document.addEventListener("visibilitychange",ze),window.addEventListener("pagehide",Lt),window.addEventListener("pageshow",Pt),window.addEventListener("online",Vt),window.addEventListener("focus",dr),()=>{document.removeEventListener("visibilitychange",ze),window.removeEventListener("pagehide",Lt),window.removeEventListener("pageshow",Pt),window.removeEventListener("online",Vt),window.removeEventListener("focus",dr),O&&clearTimeout(O)}},[Je]),A.useLayoutEffect(()=>{if(!S_(Ke))return;const O=iL(G),ne=JSON.stringify(O);O.length>0&&ne!==Vr.current?(Vr.current=ne,console.warn("[session-invariant] duplicate mapping detected",O)):O.length===0&&Vr.current&&(Vr.current=""),I?.({sessions:G.map(le=>({id:le.id,name:le.name,customName:le.customName,mode:le.mode,tmuxSessionName:le.tmuxSessionName})),activeSessionId:q,splitWorkspaces:fe.map(({id:le,name:ze,sessionIds:Lt,layout:Pt})=>({id:le,...ze?{name:ze}:{},sessionIds:Lt,layout:Pt}))})},[G,q,fe,I,Ke]),A.useEffect(()=>{if(ae||$e.current)return;$e.current=!0;const O=af(_r.map(Pt=>({id:Pt.sessionId,backendSessionId:Pt.backendSessionId??null})),f),ne=Fg(_r,xr),le=ed({prioritySessionId:p?O:null,activeSessionId:null,persistedActiveSessionId:ne,firstSessionId:_r[0]?.sessionId??null}),ze=Kx(_r.map(Xx));if(F("[Session] Restoring",ze.length,"persisted sessions (one-shot)"),P("[swiper:restore-start]",{persistedSessionIds:_r.map(Pt=>Pt.sessionId),nextActiveSessionId:le}),ze.length>0){const Pt=Qr.getState();ze.forEach(dr=>{dr.sessionId&&Pt.setTerminalSession(dr.id,{sessionId:dr.sessionId,cols:80,rows:24,mode:dr.mode,tmuxSessionName:dr.tmuxSessionName,history:dr.history})}),_r.forEach(dr=>{dr.activeProgram!=null&&Pt.setSessionActiveProgram(dr.sessionId,dr.activeProgram),dr.cwd!=null&&Pt.setSessionCwd(dr.sessionId,dr.cwd)}),U(ze);const Vt=le||ze[0]?.id||null;pe(Vt),P("[swiper:restore-complete]",{restoredSessionIds:ze.map(dr=>dr.id),nextActiveSessionId:Vt})}(async()=>(ze.length===0&&await Rr.current?.({createIfEmpty:!0}),qe(!1),requestAnimationFrame(()=>Re("restore-finished",{immediate:!0}))))()},[ae,_r,xr,F,P,Re,p,f]),A.useEffect(()=>{if(!p||Ke||G.length===0)return;const O=af(G.map(le=>({id:le.id,backendSessionId:le.sessionId})),f),ne=ed({prioritySessionId:O,activeSessionId:Ce.current,persistedActiveSessionId:$r,firstSessionId:G[0]?.id??null});ne&&ne!==Ce.current&&pe(ne)},[p,f,Ke,$r,G]);const ot=A.useRef([]),sr=A.useRef(!1);Ce.current=q,A.useEffect(()=>{if(Ke)return;const O=ot.current,ne=_r;if(!sr.current){U(Bt=>Og(Bt,ne)),ot.current=ne,sr.current=!0;return}const le=new Set(O.map(Bt=>Bt.sessionId)),ze=new Set(ne.map(Bt=>Bt.sessionId)),Lt=new Map(O.map(Bt=>[Bt.sessionId,Bt.name]));ot.current=ne,U(Bt=>{const ir=Og(Bt,ne);return(!Ce.current||!ir.some(qr=>qr.id===Ce.current))&&pe(ir[0]?.id??null),ir});const Pt=ne.filter(Bt=>!le.has(Bt.sessionId)),Vt=[...le].filter(Bt=>!ze.has(Bt)),dr=ne.filter(Bt=>le.has(Bt.sessionId)&&Lt.get(Bt.sessionId)!==Bt.name);(Pt.length>0||Vt.length>0||dr.length>0)&&F("[Session] Synced persisted sessions:",{newSessionIds:Pt.map(Bt=>Bt.sessionId),removedSessionIds:Vt,renamedSessionIds:dr.map(Bt=>Bt.sessionId),currentSessionIds:ne.map(Bt=>Bt.sessionId)});for(const Bt of ne){if(!Bt.backendSessionId)continue;Qr.getState().setTerminalSession(Bt.sessionId,{sessionId:Bt.backendSessionId,cols:80,rows:24,mode:Bt.mode,tmuxSessionName:Bt.tmuxSessionName})}},[_r,Ke,F]);const vt=A.useCallback(async O=>{try{const ne=O?.mode==="tmux"||O?.mode==="shell"?O.mode:c,le=(O?.tmuxSessionName||"").trim(),ze=u.trim(),Lt=ne==="tmux"?le||ze||lL():null,Pt=typeof O?.cwd=="string"?O.cwd:null,Vt=q?Qr.getState().sessions.get(q)?.cwd??null:null,dr=typeof Pt=="string"&&Pt.trim().length>0?Pt:typeof Vt=="string"&&Vt.trim().length>0?Vt:void 0,Bt=await ar({mode:ne,tmuxSessionName:Lt,cwd:dr,termType:"xterm-256color",createIfEmpty:O?.createIfEmpty===!0}),ir=Bt.session,qr=Bt.terminalSession,vn={id:ir.sessionId,name:ir.name,customName:ir.customName===!0,sessionId:qr.sessionId,mode:qr.mode??ir.mode,tmuxSessionName:qr.tmuxSessionName??ir.tmuxSessionName};U(ci=>oL(ci,vn)),pe(vn.id),Qr.getState().setTerminalSession(vn.id,{sessionId:qr.sessionId,cols:80,rows:24,mode:vn.mode,tmuxSessionName:vn.tmuxSessionName,activeProgram:qr.activeProgram,activeProgramRaw:qr.activeProgramRaw,activeProgramSource:qr.activeProgramSource,cwd:qr.cwd}),F("[Session] Inventory opened session:",{frontendSessionId:vn.id,backendSessionId:qr.sessionId,reused:Bt.reused,mode:vn.mode,tmuxSessionName:vn.tmuxSessionName});const In=O?.command?.trim();return In&&await N5(qr.sessionId,`${In}\r`),vn.id}catch(ne){return console.error("[Session] Failed to create new session:",ne),null}},[c,u,q,ar,F]);Rr.current=vt;const zt=A.useCallback((O,ne={})=>{Ws.getState().setActivePane(O);const le=Ce.current,ze=!!le&&Le.current[le]===!0;if(pe(O),ke.current&&ne.preserveMobileKeyboard===!1){Un.current=Date.now()+600,le&&(Le.current[le]=!1),Me(null),Fe(null);const Lt=document.activeElement;Lt instanceof HTMLTextAreaElement&&Lt.closest(".terminal-viewport-container")&&Lt.blur();return}ze&&ke.current&&Me(O),ve.current&&(!ke.current||ze)&&Fe({sessionId:O,token:Date.now()})},[]),ht=A.useCallback(O=>{pe(O),Tt(!0),me(null)},[]),Jt=A.useCallback(O=>{const ne=Ce.current;!ne||ne===O||(De(le=>uf(le,ne,O)),Tt(!1),zt(ne,{preserveMobileKeyboard:!1}))},[zt]),Ir=A.useCallback(async()=>{const O=Ce.current;if(!O||Kt)return;$t(!0);const ne=Qr.getState().sessions.get(O)?.cwd??void 0,le=await vt({cwd:ne||void 0,mode:c});if($t(!1),!le){me(D("common.error"));return}De(ze=>uf(ze,O,le)),Tt(!1),zt(O,{preserveMobileKeyboard:!1})},[zt,c,vt,Kt,D]),Nt=A.useCallback(O=>{De(ne=>Y_(ne,O)),O&&zt(O,{preserveMobileKeyboard:!1})},[zt]),pr=A.useCallback(O=>{De(ne=>Z_(ne,O)),zt(O,{preserveMobileKeyboard:!1})},[zt]),br=A.useCallback(O=>{if(G.find(le=>le.id===O)){if(Ws.getState().setActivePane(O),O===Ce.current)return;if(pe(O),!A_({isMobile:ke.current,viewportReady:ye.has(O),streamReady:tt.has(O),contentReady:Ye.has(O)})){Ae(null),ve.current&&Fe({sessionId:O,token:Date.now()}),F("[Session] Switched to session:",O);return}$(ze=>{if(ze.has(O))return ze;const Lt=new Set(ze);return Lt.add(O),Lt}),Ae(O),F("[Session] Switched to session:",O)}},[Ye,F,tt,G,ye]),Xn=A.useCallback((O,ne)=>{ne.trim()&&(U(le=>le.map(ze=>ze.id===O?{...ze,name:ne.trim(),customName:!0}:ze)),fn(O,ne.trim()))},[fn]),zn=A.useCallback(O=>{U(ne=>ne.map(le=>le.id===O?{...le,customName:!1}:le)),Zt(O)},[Zt]),Jn=A.useCallback(O=>{U(ne=>{const le=new Map(ne.map(Vt=>[Vt.id,Vt])),ze=O.map(Vt=>le.get(Vt)).filter(Vt=>Vt!==void 0),Lt=new Set(O),Pt=ne.filter(Vt=>!Lt.has(Vt.id));return[...ze,...Pt]}),Yr(O),F("[Session] Reordered sessions:",O),requestAnimationFrame(()=>{Xe.current?.update()})},[Yr,F]),Cs=A.useCallback(async O=>{const ne=typeof O=="string"?O:O.sessionId,le=typeof O=="string"?"auto":O.closeMode??"auto",ze=G.find(Pt=>Pt.id===ne);if(!ze)return;const Lt=xv(Xt,ne,Pt=>Pt.id);try{le==="destroy"&&ze.mode==="tmux"&&ze.tmuxSessionName?(await Q5(ze.tmuxSessionName),F("[Session] Destroyed tmux session:",{frontendSessionId:ze.id,tmuxSessionName:ze.tmuxSessionName})):ze.sessionId&&(await R5(ze.sessionId),F("[Session] Closed backend terminal:",ze.sessionId))}catch(Pt){console.error("[Session] Failed to close backend terminal:",Pt);return}U(Pt=>{const Vt=Pt.filter(dr=>dr.id!==ne);return pe(Lt),Vt}),os(ne,Lt),delete Le.current[ne],F("[Session] Closed session:",{sessionId:ne,closeMode:le})},[G,Xt,os,F]),Vs=A.useCallback(O=>{if(!O)return;const ne=G.filter(le=>le.sessionId===O);if(ne.length!==0){ne.length>1&&console.warn("[session-invariant] backend matched multiple frontend sessions during cleanup",{backendSessionId:O,frontendSessionIds:ne.map(le=>le.id)}),U(le=>{const ze=le.filter(Lt=>Lt.sessionId!==O);return ze.length!==le.length&&!ze.some(Pt=>Pt.id===q)&&pe(ze.length>0?ze[0].id:null),ze});for(const le of ne)os(le.id),delete Le.current[le.id];F("[Session] Backend gone, dropped local session(s):",ne.map(le=>le.id))}},[G,q,os,F]);A.useEffect(()=>{const O=Cr=>{vt(Cr.detail)},ne=Cr=>{br(Cr.detail)},le=()=>{const Cr=Ce.current;!Cr||ke.current||Fe({sessionId:Cr,token:Date.now()})},ze=Cr=>{const Ot=Cr;Ot.detail&&ht(Ot.detail)},Lt=Cr=>{const Ot=Cr.detail;Nt(Ot??Ce.current??void 0)},Pt=Cr=>{const Ot=Cr.detail;Ot&&pr(Ot)},Vt=Cr=>{const Ot=Cr.detail,En=typeof Ot=="string"?Ot:Ot?.layout,Ps=typeof Ot=="string"?Ce.current:Ot?.sessionId;En!=="horizontal"&&En!=="vertical"&&En!=="grid"||De(ui=>ui.map(Hr=>Hr.sessionIds.includes(Ps??"")?{...Hr,layout:En}:Hr))},dr=Cr=>{const En=Cr.detail?.direction;if(En!=="prev"&&En!=="next")return;const Ps=vr.current;if(Ps.length<=1)return;const ui=Ce.current,Hr=ui?Ps.findIndex(qs=>qs.id===ui):-1,Qn=((Hr>=0?Hr:0)+(En==="next"?1:-1)+Ps.length)%Ps.length,en=Ps[Qn]?.id;en&&en!==ui&&br(en)},Bt=Cr=>{Cs(Cr.detail)},ir=Cr=>{Vs(Cr.detail)},qr=Cr=>{const Ot=Cr;!Ot.detail?.sessionId||!Ot.detail?.name||Xn(Ot.detail.sessionId,Ot.detail.name)},vn=Cr=>{const Ot=Cr;Ot.detail?.sessionId&&zn(Ot.detail.sessionId)},Hn=Cr=>{const Ot=Cr;Ot.detail?.sessionIds&&Jn(Ot.detail.sessionIds)},In=Cr=>{const Ot=Cr.detail;!Ot?.workspaceId||!Array.isArray(Ot.sessionIds)||De(En=>K_(En,Ot.workspaceId,Ot.sessionIds))},ci=Cr=>{const Ot=Cr.detail;!Ot?.workspaceId||typeof Ot.name!="string"||De(En=>X_(En,Ot.workspaceId,Ot.name))},es=Cr=>{const Ot=Cr.detail;!Ot?.primaryId||!Ot.secondaryId||Ot.primaryId===Ot.secondaryId||(De(En=>uf(En,Ot.primaryId,Ot.secondaryId)),zt(Ot.primaryId,{preserveMobileKeyboard:!1}))};return window.addEventListener("new-terminal-session",O),window.addEventListener("switch-terminal-session",ne),window.addEventListener("focus-active-terminal-session",le),window.addEventListener("open-terminal-split-chooser",ze),window.addEventListener("close-terminal-split",Lt),window.addEventListener("remove-terminal-split-pane",Pt),window.addEventListener("set-terminal-split-direction",Vt),window.addEventListener("cycle-terminal-session",dr),window.addEventListener("close-terminal-session",Bt),window.addEventListener("close-terminal-session-by-backend",ir),window.addEventListener("rename-terminal-session",qr),window.addEventListener("reset-terminal-session-name",vn),window.addEventListener("reorder-terminal-session",Hn),window.addEventListener("reorder-terminal-split-workspace",In),window.addEventListener("rename-terminal-split-workspace",ci),window.addEventListener("combine-terminal-split-sessions",es),()=>{window.removeEventListener("new-terminal-session",O),window.removeEventListener("switch-terminal-session",ne),window.removeEventListener("focus-active-terminal-session",le),window.removeEventListener("open-terminal-split-chooser",ze),window.removeEventListener("close-terminal-split",Lt),window.removeEventListener("remove-terminal-split-pane",Pt),window.removeEventListener("set-terminal-split-direction",Vt),window.removeEventListener("cycle-terminal-session",dr),window.removeEventListener("close-terminal-session",Bt),window.removeEventListener("close-terminal-session-by-backend",ir),window.removeEventListener("rename-terminal-session",qr),window.removeEventListener("reset-terminal-session-name",vn),window.removeEventListener("reorder-terminal-session",Hn),window.removeEventListener("reorder-terminal-split-workspace",In),window.removeEventListener("rename-terminal-split-workspace",ci),window.removeEventListener("combine-terminal-split-sessions",es)}},[zt,vt,br,ht,Nt,pr,Cs,Vs,Xn,zn,Jn]),A.useEffect(()=>{if(!jr||Qt)return;const O=ne=>{if(!(ne.ctrlKey||ne.metaKey)||!ne.shiftKey)return;if(jr.layout==="horizontal"?ne.key==="ArrowLeft"||ne.key==="ArrowRight":jr.layout==="vertical"?ne.key==="ArrowUp"||ne.key==="ArrowDown":ne.key.startsWith("Arrow")){ne.preventDefault(),ne.stopPropagation();const ze=jr.sessionIds.indexOf(Ce.current??""),Lt=ne.key==="ArrowLeft"||ne.key==="ArrowUp"?-1:1,Pt=(Math.max(0,ze)+Lt+jr.sessionIds.length)%jr.sessionIds.length,Vt=jr.sessionIds[Pt];if(!Vt)return;zt(Vt);return}ne.key==="Backspace"&&(ne.preventDefault(),ne.stopPropagation(),Nt(Ce.current??void 0))};return window.addEventListener("keydown",O,!0),()=>window.removeEventListener("keydown",O,!0)},[zt,jr,Nt,Qt]);const yn=O=>{const ne=Qr.getState().sessions.get(O.id);return Ca(O,ne?.activeProgram??null,ne?.cwd??null,void 0,ne?.shellTitle??null,ne?.promptState??null)},Fr=(O,ne={})=>{const le=O.id===q&&!Ue?.startsWith("@collaboration:"),ze=Jr.has(O.id)&&!ne.hidden,Lt=p&&w_({sessionId:O.id,foregroundSessionId:zr,visibleSessionIds:Jr,deferredViewportSessionIds:Qt?Or:hs}),Pt=v_({sessionId:O.id,foregroundSessionId:zr,foregroundReady:pn,isVisible:ze})&&p,Vt=__({sessionId:O.id,foregroundSessionId:zr,requestToken:ie.token,foregroundCompletedToken:Ti,isVisible:Dn.has(O.id)})&&p,dr=ze||O.id===zr||hs.has(O.id)?0:Pr.get(O.id)??vd;return a.jsxs("div",{className:`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden ${ne.hidden?"invisible pointer-events-none":""}`,style:ne.containerStyle,"aria-hidden":ne.hidden||void 0,onPointerDown:()=>{!le&&ze&&zt(O.id)},onWheelCapture:()=>{H_(le,()=>zt(O.id))},children:[ne.showPaneTitle&&a.jsx($_,{session:O,active:le,onActivate:()=>zt(O.id),onToggleRightSidebar:le?x:void 0}),a.jsx("div",{className:"min-h-0 flex-1 app-chrome-bg",children:Lt&&a.jsx(U_,{sessionId:O.id,mode:O.mode,tmuxSessionName:O.tmuxSessionName,terminalSettings:e,colorTheme:t,toolbarPresets:r,isActive:le,focusSuspended:be!==null,deferCursorUntilPositioned:be===O.id||O.mode==="tmux"&&!Ye.has(O.id),isLayoutVisible:ze,initialConnectEnabled:Pt&&Vt,resumeRequestEnabled:Vt,suppressKeyboard:ne.suppressKeyboard,keyboardPortalTarget:ne.keyboardPortalTarget,sharedMobileKeyboardLayout:ne.sharedMobileKeyboardLayout,suppressPageFlipRefresh:ne.suppressPageFlipRefresh,focusRequestToken:K?.sessionId===O.id?K.token:0,resumeRequestToken:ie.token,resumeRequestReason:ie.reason,forceResumeReconnect:ie.forceForegroundReconnect&&Dn.has(O.id),resumeRequestDelayMs:Dn.has(O.id)?0:ne.hidden?vd:Pr.get(O.id)??vd,initialConnectDelayMs:dr,onStreamReadyChange:kr,onStreamConnected:Yn,onViewportReadyChange:ur,onContentReadyChange:Kr,onKeyboardVisibilityChange:dt,showDebug:s,onStatusChange:le?k:void 0})})]},O.id)};return a.jsxs("div",{className:"relative h-full flex flex-col",children:[Nr&&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(H5,{size:18})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-[13px] font-semibold text-foreground",children:D("tab.tmuxRecoveryTitle",{count:Nr.sessions.length})}),a.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:D("tab.tmuxRecoveryHint")}),a.jsx("p",{className:"mt-1.5 truncate text-[10px] text-foreground/70",children:Nr.sessions.map(O=>O.name).join(" · ")}),ft&&a.jsx("p",{className:"mt-2 text-[10px] text-destructive",children:ft}),a.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[a.jsxs("button",{type:"button",disabled:Qe!==null,onClick:()=>{Zn()},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(Z5,{size:13,className:Qe==="restore"?"animate-spin":""}),D(Qe==="restore"?"tab.tmuxRecoveryRestoring":"tab.tmuxRecoveryRestoreAll")]}),a.jsx("button",{type:"button",disabled:Qe!==null,onClick:()=>{Ln()},className:"inline-flex min-h-9 items-center rounded-lg px-3 text-[11px] text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:opacity-50",children:D("tab.tmuxRecoveryDismiss")})]})]})]})}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(P7,{onSwiper:O=>{Xe.current=O,O.allowTouchMove=At.length>1&&!$n&&!lt,P("[swiper:on-swiper]",{allowTouchMove:O.allowTouchMove}),requestAnimationFrame(()=>Je("on-swiper"))},onSlideChange:wt,onTouchStart:(O,ne)=>{const le=Ug(ne),ze=le==="touch"||le==="pen"||le==="unknown";Z("[swipe:touch-start]",{pointerType:le,allowed:ze}),P("[swiper:touch-start]",{pointerType:le,allowed:ze}),ze&&(Ne(),Ve.current=!0,_t.current=!0)},onTouchEnd:(O,ne)=>{const le=Ug(ne),ze=le==="touch"||le==="pen"||le==="unknown";Z("[swipe:touch-end]",{pointerType:le,allowed:ze}),P("[swiper:touch-end]",{pointerType:le,allowed:ze}),ze&&(Ve.current=!1,je("touch-end"))},onTransitionEnd:()=>{const O=Xe.current;if(Ve.current){P("[swiper:transition-end-during-touch]");return}if(_t.current&&O&&!sL(O,gr.current)){P("[swiper:transition-end-deferred]");return}Ne(),_t.current=!1,P("[swiper:transition-end]")},initialSlide:Math.max(0,he),speed:sp,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:At.map(O=>{const ne=O.workspace,le=!!ne&&O.sessions.length>=2,ze=Qt?bt?"horizontal":"vertical":ne?.layout??"horizontal",Lt=Qt&&te?O.sessions.some(Vt=>Vt.id===te):!1,Pt=O.sessions.some(Vt=>Vt.id===q)?q:O.sessions[0]?.id;return a.jsx(O7,{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:b&&!le?"2.5rem":void 0},children:le?a.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--chrome-bg)]",style:Qt?{transform:"translateY(var(--kb-translate-y, 0px))",transition:"none"}:void 0,children:[a.jsx(fm,{layoutId:O.key,preset:ne?.layout??"horizontal",initialTree:q9(O.sessions.map(Vt=>Vt.id),ze,ne?.ratios,ne?.gridColumnRatios,ne?.gridRowRatios),mobile:Qt,focusId:Lt?te:null,panes:O.sessions.map(Vt=>({id:Vt.id,content:Fr(Vt,{showPaneTitle:!Qt,suppressKeyboard:Qt&&Vt.id!==Pt,keyboardPortalTarget:Qt?St:null,sharedMobileKeyboardLayout:Qt,suppressPageFlipRefresh:!0})}))}),Qt&&a.jsx("div",{ref:Ht,className:"relative shrink-0 app-chrome-bg","data-split-keyboard-host":"true"})]}):a.jsx(fm,{layoutId:O.key,preset:ne?.layout??"horizontal",mobile:Qt,panes:[{id:O.sessions[0].id,content:Fr(O.sessions[0])}]})})},O.key)})})}),lt&&q&&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:()=>Tt(!1),"aria-label":D("common.close")}),a.jsxs("section",{className:"fixed inset-x-3 bottom-3 z-modal-panel mx-auto max-h-[min(78svh,620px)] max-w-md overflow-hidden rounded-2xl border border-border/20 bg-surface shadow-[0_24px_70px_var(--app-shadow-strong)] sm:bottom-auto sm:top-1/2 sm:-translate-y-1/2",style:{paddingBottom:"var(--safe-bottom-inset)"},role:"dialog","aria-modal":"true","aria-label":D("tab.splitTitle"),children:[a.jsxs("header",{className:"flex items-start gap-3 border-b border-border/20 px-4 py-3.5",children:[a.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary",children:a.jsx(zl,{size:17})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:D("tab.splitTitle")}),a.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-muted-foreground",children:D("tab.splitExistingHint")})]}),a.jsx("button",{type:"button",className:"inline-flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground",onClick:()=>Tt(!1),"aria-label":D("common.close"),children:a.jsx(ws,{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:Kt,onClick:()=>{Ir()},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(Ri,{size:17})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block text-[13px] font-medium text-foreground",children:D("tab.splitNew")}),a.jsx("span",{className:"mt-0.5 block text-[11px] text-muted-foreground",children:D("tab.splitNewHint")})]})]}),fe.filter(O=>O.id!==jr?.id).length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:D("tab.splitExistingGroups")}),fe.filter(O=>O.id!==jr?.id).map((O,ne)=>{const le=O.sessionIds.flatMap(Pt=>{const Vt=G.find(dr=>dr.id===Pt);return Vt?[Vt]:[]});if(le.length<2)return null;const ze=O.name||`${D("tab.splitWorkspace")} ${ne+1}`,Lt=le.map(Pt=>yn(Pt).primary).join(" · ");return a.jsxs("button",{type:"button",onClick:()=>Jt(le[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(zl,{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:ze}),a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium text-primary",children:D("tab.splitOccupied")})]}),a.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[D("tab.sessionCount",{count:le.length})," · ",Lt]})]}),a.jsx(Uo,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},O.id)})]}),a.jsx("div",{className:"px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-[0.12em] text-muted-foreground",children:D("tab.splitAvailableSessions")}),G.filter(O=>!fe.some(ne=>ne.sessionIds.includes(O.id))&&O.id!==q).length===0&&fe.filter(O=>O.id!==jr?.id).length===0?a.jsx("p",{className:"px-3 py-4 text-[12px] text-muted-foreground",children:D("tab.splitNoOtherSessions")}):G.filter(O=>!fe.some(ne=>ne.sessionIds.includes(O.id))&&O.id!==q).map(O=>{const ne=We.get(O.id)??null,le=yn(O);return a.jsxs("button",{type:"button",onClick:()=>Jt(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:ne?a.jsx(Jl,{size:15}):a.jsx(zl,{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:le.primary}),a.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:ne?Zc(ne)??ne:O.name})]}),a.jsx(Uo,{size:14,className:"text-primary opacity-0 transition group-hover:opacity-100"})]},O.id)})]})]})]}),we&&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:we})]})},uL={sm:"h-4 w-7",md:"h-6 w-10"},dL={sm:"h-3 w-3",md:"h-5 w-5"},hL={sm:"translate-x-3",md:"translate-x-4"};function $a({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 ${uL[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 ${dL[r]} ${e?hL[r]:""}`})})}function Gi(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 fL=typeof Symbol=="function"&&Symbol.observable||"@@observable",zg=fL,Hg=()=>Math.random().toString(36).substring(7).split("").join("."),pL={INIT:`@@redux/INIT${Hg()}`,REPLACE:`@@redux/REPLACE${Hg()}`},Wg=pL;function mL(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 Jx(e,t,r){if(typeof e!="function")throw new Error(Gi(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Gi(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Gi(1));return r(Jx)(e,t)}let s=e,i=t,c=new Map,u=c,f=0,p=!1;function g(){u===c&&(u=new Map,c.forEach((N,M)=>{u.set(M,N)}))}function x(){if(p)throw new Error(Gi(3));return i}function b(N){if(typeof N!="function")throw new Error(Gi(4));if(p)throw new Error(Gi(5));let M=!0;g();const D=f++;return u.set(D,N),function(){if(M){if(p)throw new Error(Gi(6));M=!1,g(),u.delete(D),c=null}}}function v(N){if(!mL(N))throw new Error(Gi(7));if(typeof N.type>"u")throw new Error(Gi(8));if(typeof N.type!="string")throw new Error(Gi(17));if(p)throw new Error(Gi(9));try{p=!0,i=s(i,N)}finally{p=!1}return(c=u).forEach(D=>{D()}),N}function w(N){if(typeof N!="function")throw new Error(Gi(10));s=N,v({type:Wg.REPLACE})}function k(){const N=b;return{subscribe(M){if(typeof M!="object"||M===null)throw new Error(Gi(11));function D(){const Z=M;Z.next&&Z.next(x())}return D(),{unsubscribe:N(D)}},[zg](){return this}}}return v({type:Wg.INIT}),{dispatch:v,subscribe:b,getState:x,replaceReducer:w,[zg]:k}}function Gg(e,t){return function(...r){return t(e.apply(this,r))}}function Vg(e,t){if(typeof e=="function")return Gg(e,t);if(typeof e!="object"||e===null)throw new Error(Gi(16));const r={};for(const s in e){const i=e[s];typeof i=="function"&&(r[s]=Gg(i,t))}return r}function e3(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...s)=>t(r(...s)))}function gL(...e){return t=>(r,s)=>{const i=t(r,s);let c=()=>{throw new Error(Gi(15))};const u={getState:i.getState,dispatch:(p,...g)=>c(p,...g)},f=e.map(p=>p(u));return c=e3(...f)(i.dispatch),{...i,dispatch:c}}}var hf={exports:{}},ff={};var qg;function xL(){if(qg)return ff;qg=1;var e=K7();function t(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var r=typeof Object.is=="function"?Object.is:t,s=e.useSyncExternalStore,i=e.useRef,c=e.useEffect,u=e.useMemo,f=e.useDebugValue;return ff.useSyncExternalStoreWithSelector=function(p,g,x,b,v){var w=i(null);if(w.current===null){var k={hasValue:!1,value:null};w.current=k}else k=w.current;w=u(function(){function N(G){if(!M){if(M=!0,D=G,G=b(G),v!==void 0&&k.hasValue){var U=k.value;if(v(U,G))return F=U}return F=G}if(U=F,r(D,G))return U;var q=b(G);return v!==void 0&&v(U,q)?(D=G,U):(D=G,F=q)}var M=!1,D,F,Z=x===void 0?null:x;return[function(){return N(g())},Z===null?void 0:function(){return N(Z())}]},[g,x,b,v]);var I=s(p,w[0],w[1]);return c(function(){k.hasValue=!0,k.value=I},[I]),f(I),I},ff}var Zg;function bL(){return Zg||(Zg=1,hf.exports=xL()),hf.exports}bL();var yL=A.version.startsWith("19"),vL=Symbol.for(yL?"react.transitional.element":"react.element"),wL=Symbol.for("react.portal"),AL=Symbol.for("react.fragment"),TL=Symbol.for("react.strict_mode"),CL=Symbol.for("react.profiler"),SL=Symbol.for("react.consumer"),_L=Symbol.for("react.context"),t3=Symbol.for("react.forward_ref"),LL=Symbol.for("react.suspense"),kL=Symbol.for("react.suspense_list"),zp=Symbol.for("react.memo"),IL=Symbol.for("react.lazy"),EL=t3,ML=zp;function RL(e){if(typeof e=="object"&&e!==null){const{$$typeof:t}=e;switch(t){case vL:switch(e=e.type,e){case AL:case CL:case TL:case LL:case kL:return e;default:switch(e=e&&e.$$typeof,e){case _L:case t3:case IL:case zp:return e;case SL:return e;default:return t}}case wL:return t}}}function NL(e){return RL(e)===zp}function DL(e,t,r,s,{areStatesEqual:i,areOwnPropsEqual:c,areStatePropsEqual:u}){let f=!1,p,g,x,b,v;function w(D,F){return p=D,g=F,x=e(p,g),b=t(s,g),v=r(x,b,g),f=!0,v}function k(){return x=e(p,g),t.dependsOnOwnProps&&(b=t(s,g)),v=r(x,b,g),v}function I(){return e.dependsOnOwnProps&&(x=e(p,g)),t.dependsOnOwnProps&&(b=t(s,g)),v=r(x,b,g),v}function N(){const D=e(p,g),F=!u(D,x);return x=D,F&&(v=r(x,b,g)),v}function M(D,F){const Z=!c(F,g),G=!i(D,p,F,g);return p=D,g=F,Z&&G?k():Z?I():G?N():v}return function(F,Z){return f?M(F,Z):w(F,Z)}}function QL(e,{initMapStateToProps:t,initMapDispatchToProps:r,initMergeProps:s,...i}){const c=t(e,i),u=r(e,i),f=s(e,i);return DL(c,u,f,e,i)}function BL(e,t){const r={};for(const s in e){const i=e[s];typeof i=="function"&&(r[s]=(...c)=>t(i(...c)))}return r}function ap(e){return function(r){const s=e(r);function i(){return s}return i.dependsOnOwnProps=!1,i}}function Yg(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:e.length!==1}function r3(e,t){return function(s,{displayName:i}){const c=function(f,p){return c.dependsOnOwnProps?c.mapToProps(f,p):c.mapToProps(f,void 0)};return c.dependsOnOwnProps=!0,c.mapToProps=function(f,p){c.mapToProps=e,c.dependsOnOwnProps=Yg(e);let g=c(f,p);return typeof g=="function"&&(c.mapToProps=g,c.dependsOnOwnProps=Yg(g),g=c(f,p)),g},c}}function Hp(e,t){return(r,s)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${s.wrappedComponentName}.`)}}function jL(e){return e&&typeof e=="object"?ap(t=>BL(e,t)):e?typeof e=="function"?r3(e):Hp(e,"mapDispatchToProps"):ap(t=>({dispatch:t}))}function PL(e){return e?typeof e=="function"?r3(e):Hp(e,"mapStateToProps"):ap(()=>({}))}function OL(e,t,r){return{...r,...e,...t}}function FL(e){return function(r,{displayName:s,areMergedPropsEqual:i}){let c=!1,u;return function(p,g,x){const b=e(p,g,x);return c?i(b,u)||(u=b):(c=!0,u=b),u}}}function UL(e){return e?typeof e=="function"?FL(e):Hp(e,"mergeProps"):()=>OL}function $L(e){e()}function zL(){let e=null,t=null;return{clear(){e=null,t=null},notify(){$L(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let s=e;for(;s;)r.push(s),s=s.next;return r},subscribe(r){let s=!0;const i=t={callback:r,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!s||e===null||(s=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var Kg={notify(){},get:()=>[]};function n3(e,t){let r,s=Kg,i=0,c=!1;function u(I){x();const N=s.subscribe(I);let M=!1;return()=>{M||(M=!0,N(),b())}}function f(){s.notify()}function p(){k.onStateChange&&k.onStateChange()}function g(){return c}function x(){i++,r||(r=t?t.addNestedSub(p):e.subscribe(p),s=zL())}function b(){i--,r&&i===0&&(r(),r=void 0,s.clear(),s=Kg)}function v(){c||(c=!0,x())}function w(){c&&(c=!1,b())}const k={addNestedSub:u,notifyNestedSubs:f,handleChangeWrapper:p,isSubscribed:g,trySubscribe:v,tryUnsubscribe:w,getListeners:()=>s};return k}var HL=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",WL=HL(),GL=()=>typeof navigator<"u"&&navigator.product==="ReactNative",VL=GL(),qL=()=>WL||VL?A.useLayoutEffect:A.useEffect,Dd=qL();function Xg(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function pf(e,t){if(Xg(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(let i=0;i<r.length;i++)if(!Object.prototype.hasOwnProperty.call(t,r[i])||!Xg(e[r[i]],t[r[i]]))return!1;return!0}var ZL={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},YL={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},KL={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s3={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},XL={[EL]:KL,[ML]:s3};function Jg(e){return NL(e)?s3:XL[e.$$typeof]||ZL}var JL=Object.defineProperty,ek=Object.getOwnPropertyNames,e2=Object.getOwnPropertySymbols,tk=Object.getOwnPropertyDescriptor,rk=Object.getPrototypeOf,t2=Object.prototype;function lp(e,t){if(typeof t!="string"){if(t2){const c=rk(t);c&&c!==t2&&lp(e,c)}let r=ek(t);e2&&(r=r.concat(e2(t)));const s=Jg(e),i=Jg(t);for(let c=0;c<r.length;++c){const u=r[c];if(!YL[u]&&!(i&&i[u])&&!(s&&s[u])){const f=tk(t,u);try{JL(e,u,f)}catch{}}}}return e}var nk=Symbol.for("react-redux-context"),sk=typeof globalThis<"u"?globalThis:{};function ik(){if(!A.createContext)return{};const e=sk[nk]??=new Map;let t=e.get(A.createContext);return t||(t=A.createContext(null),e.set(A.createContext,t)),t}var i3=ik(),ok=[null,null];function ak(e,t,r){Dd(()=>e(...t),r)}function lk(e,t,r,s,i,c){e.current=s,r.current=!1,i.current&&(i.current=null,c())}function ck(e,t,r,s,i,c,u,f,p,g,x){if(!e)return()=>{};let b=!1,v=null;const w=()=>{if(b||!f.current)return;const I=t.getState();let N,M;try{N=s(I,i.current)}catch(D){M=D,v=D}M||(v=null),N===c.current?u.current||g():(c.current=N,p.current=N,u.current=!0,x())};return r.onStateChange=w,r.trySubscribe(),w(),()=>{if(b=!0,r.tryUnsubscribe(),r.onStateChange=null,v)throw v}}function uk(e,t){return e===t}function dk(e,t,r,{pure:s,areStatesEqual:i=uk,areOwnPropsEqual:c=pf,areStatePropsEqual:u=pf,areMergedPropsEqual:f=pf,forwardRef:p=!1,context:g=i3}={}){const x=g,b=PL(e),v=jL(t),w=UL(r),k=!!e;return N=>{const M=N.displayName||N.name||"Component",D=`Connect(${M})`,F={shouldHandleStateChanges:k,displayName:D,wrappedComponentName:M,WrappedComponent:N,initMapStateToProps:b,initMapDispatchToProps:v,initMergeProps:w,areStatesEqual:i,areStatePropsEqual:u,areOwnPropsEqual:c,areMergedPropsEqual:f};function Z(q){const[pe,Ue,be]=A.useMemo(()=>{const{reactReduxForwardedRef:Fe,...fe}=q;return[q.context,Fe,fe]},[q]),Ae=A.useMemo(()=>{let Fe=x;return pe?.Consumer,Fe},[pe,x]),Ke=A.useContext(Ae),qe=!!q.store&&!!q.store.getState&&!!q.store.dispatch,ie=!!Ke&&!!Ke.store,Se=qe?q.store:Ke.store,tt=ie?Ke.getServerState:Se.getState,Ee=A.useMemo(()=>QL(Se.dispatch,F),[Se]),[oe,de]=A.useMemo(()=>{if(!k)return ok;const Fe=n3(Se,qe?void 0:Ke.subscription),fe=Fe.notifyNestedSubs.bind(Fe);return[Fe,fe]},[Se,qe,Ke]),Te=A.useMemo(()=>qe?Ke:{...Ke,subscription:oe},[qe,Ke,oe]),ee=A.useRef(void 0),ye=A.useRef(be),ce=A.useRef(void 0),Ye=A.useRef(!1),at=A.useRef(!1),_e=A.useRef(void 0);Dd(()=>(at.current=!0,()=>{at.current=!1}),[]);const $=A.useMemo(()=>()=>ce.current&&be===ye.current?ce.current:Ee(Se.getState(),be),[Se,be]),$e=A.useMemo(()=>fe=>oe?ck(k,Se,oe,Ee,ye,ee,Ye,at,ce,de,fe):()=>{},[oe]);ak(lk,[ye,ee,Ye,be,ce,de]);let Xe;try{Xe=A.useSyncExternalStore($e,$,tt?()=>Ee(tt(),be):$)}catch(Fe){throw _e.current&&(Fe.message+=`
70
+ The error may be correlated with this previous error:
71
+ ${_e.current.stack}
72
+
73
+ `),Fe}Dd(()=>{_e.current=void 0,ce.current=void 0,ee.current=Xe});const Le=A.useMemo(()=>A.createElement(N,{...Xe,ref:Ue}),[Ue,N,Xe]);return A.useMemo(()=>k?A.createElement(Ae.Provider,{value:Te},Le):Le,[Ae,Le,Te])}const U=A.memo(Z);if(U.WrappedComponent=N,U.displayName=Z.displayName=D,p){const pe=A.forwardRef(function(be,Ae){return A.createElement(U,{...be,reactReduxForwardedRef:Ae})});return pe.displayName=D,pe.WrappedComponent=N,lp(pe,N)}return lp(U,N)}}var o3=dk;function hk(e){const{children:t,context:r,serverState:s,store:i}=e,c=A.useMemo(()=>{const p=n3(i);return{store:i,subscription:p,getServerState:s?()=>s:void 0}},[i,s]),u=A.useMemo(()=>i.getState(),[i]);Dd(()=>{const{subscription:p}=c;return p.onStateChange=p.notifyNestedSubs,p.trySubscribe(),u!==i.getState()&&p.notifyNestedSubs(),()=>{p.tryUnsubscribe(),p.onStateChange=void 0}},[c,u]);const f=r||i3;return A.createElement(f.Provider,{value:c},t)}var fk=hk,pk="Invariant failed";function mk(e,t){throw new Error(pk)}var ia=function(t){var r=t.top,s=t.right,i=t.bottom,c=t.left,u=s-c,f=i-r,p={top:r,right:s,bottom:i,left:c,width:u,height:f,x:c,y:r,center:{x:(s+c)/2,y:(i+r)/2}};return p},Wp=function(t,r){return{top:t.top-r.top,left:t.left-r.left,bottom:t.bottom+r.bottom,right:t.right+r.right}},r2=function(t,r){return{top:t.top+r.top,left:t.left+r.left,bottom:t.bottom-r.bottom,right:t.right-r.right}},gk=function(t,r){return{top:t.top+r.y,left:t.left+r.x,bottom:t.bottom+r.y,right:t.right+r.x}},mf={top:0,right:0,bottom:0,left:0},Gp=function(t){var r=t.borderBox,s=t.margin,i=s===void 0?mf:s,c=t.border,u=c===void 0?mf:c,f=t.padding,p=f===void 0?mf:f,g=ia(Wp(r,i)),x=ia(r2(r,u)),b=ia(r2(x,p));return{marginBox:g,borderBox:ia(r),paddingBox:x,contentBox:b,margin:i,border:u,padding:p}},Qo=function(t){var r=t.slice(0,-2),s=t.slice(-2);if(s!=="px")return 0;var i=Number(r);return isNaN(i)&&mk(),i},xk=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Qd=function(t,r){var s=t.borderBox,i=t.border,c=t.margin,u=t.padding,f=gk(s,r);return Gp({borderBox:f,border:i,margin:c,padding:u})},Bd=function(t,r){return r===void 0&&(r=xk()),Qd(t,r)},a3=function(t,r){var s={top:Qo(r.marginTop),right:Qo(r.marginRight),bottom:Qo(r.marginBottom),left:Qo(r.marginLeft)},i={top:Qo(r.paddingTop),right:Qo(r.paddingRight),bottom:Qo(r.paddingBottom),left:Qo(r.paddingLeft)},c={top:Qo(r.borderTopWidth),right:Qo(r.borderRightWidth),bottom:Qo(r.borderBottomWidth),left:Qo(r.borderLeftWidth)};return Gp({borderBox:t,margin:s,padding:i,border:c})},l3=function(t){var r=t.getBoundingClientRect(),s=window.getComputedStyle(t);return a3(r,s)},iu=function(t){var r=[],s=null,i=function(){for(var u=arguments.length,f=new Array(u),p=0;p<u;p++)f[p]=arguments[p];r=f,!s&&(s=requestAnimationFrame(function(){s=null,t.apply(void 0,r)}))};return i.cancel=function(){s&&(cancelAnimationFrame(s),s=null)},i};function jd(){return jd=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},jd.apply(null,arguments)}function c3(e,t){}c3.bind(null,"warn");c3.bind(null,"error");function Al(){}function bk(e,t){return{...e,...t}}function Fo(e,t,r){const s=t.map(i=>{const c=bk(r,i.options);return e.addEventListener(i.eventName,i.fn,c),function(){e.removeEventListener(i.eventName,i.fn,c)}});return function(){s.forEach(c=>{c()})}}const yk="Invariant failed";class Pd extends Error{}Pd.prototype.toString=function(){return this.message};function Ct(e,t){throw new Pd(yk)}class vk extends S.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=Al,this.onWindowError=r=>{const s=this.getCallbacks();s.isDragging()&&s.tryAbort(),r.error instanceof Pd&&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=Fo(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof Pd){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const wk=`
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
+ `,Od=e=>e+1,Ak=e=>`
78
+ You have lifted an item in position ${Od(e.source.index)}
79
+ `,u3=(e,t)=>{const r=e.droppableId===t.droppableId,s=Od(e.index),i=Od(t.index);return r?`
80
+ You have moved the item from position ${s}
81
+ to position ${i}
82
+ `:`
83
+ You have moved the item from position ${s}
84
+ in list ${e.droppableId}
85
+ to list ${t.droppableId}
86
+ in position ${i}
87
+ `},d3=(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
+ `,Tk=e=>{const t=e.destination;if(t)return u3(e.source,t);const r=e.combine;return r?d3(e.draggableId,e.source,r):"You are over an area that cannot be dropped on"},n2=e=>`
95
+ The item has returned to its starting position
96
+ of ${Od(e.index)}
97
+ `,Ck=e=>{if(e.reason==="CANCEL")return`
98
+ Movement cancelled.
99
+ ${n2(e.source)}
100
+ `;const t=e.destination,r=e.combine;return t?`
101
+ You have dropped the item.
102
+ ${u3(e.source,t)}
103
+ `:r?`
104
+ You have dropped the item.
105
+ ${d3(e.draggableId,e.source,r)}
106
+ `:`
107
+ The item has been dropped while not over a drop area.
108
+ ${n2(e.source)}
109
+ `},Ad={dragHandleUsageInstructions:wk,onDragStart:Ak,onDragUpdate:Tk,onDragEnd:Ck};function Sk(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function h3(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Sk(e[r],t[r]))return!1;return!0}function nn(e,t){const r=A.useState(()=>({inputs:t,result:e()}))[0],s=A.useRef(!0),i=A.useRef(r),u=s.current||!!(t&&i.current.inputs&&h3(t,i.current.inputs))?i.current:{inputs:t,result:e()};return A.useEffect(()=>{s.current=!1,i.current=u},[u]),u.result}function or(e,t){return nn(()=>e,t)}const li={x:0,y:0},Ai=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),go=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),Tl=(e,t)=>e.x===t.x&&e.y===t.y,Y0=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),t0=(e,t,r=0)=>e==="x"?{x:t,y:r}:{x:r,y:t},ou=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),s2=(e,t)=>Math.min(...t.map(r=>ou(e,r))),f3=e=>t=>({x:e(t.x),y:e(t.y)});var _k=(e,t)=>{const r=ia({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 mu=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),i2=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}],Lk={top:0,right:0,bottom:0,left:0},kk=(e,t)=>t?mu(e,t.scroll.diff.displacement):e,Ik=(e,t,r)=>r&&r.increasedBy?{...e,[t.end]:e[t.end]+r.increasedBy[t.line]}:e,Ek=(e,t)=>t&&t.shouldClipSubject?_k(t.pageMarginBox,e):ia(e);var $0=({page:e,withPlaceholder:t,axis:r,frame:s})=>{const i=kk(e.marginBox,s),c=Ik(i,r,t),u=Ek(c,s);return{page:e,withPlaceholder:t,active:u}},Vp=(e,t)=>{e.frame||Ct();const r=e.frame,s=go(t,r.scroll.initial),i=Y0(s),c={...r,scroll:{initial:r.scroll.initial,current:t,diff:{value:s,displacement:i},max:r.scroll.max}},u=$0({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:c});return{...e,frame:c,subject:u}};function ai(e,t=h3){let r=null;function s(...i){if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;const c=e.apply(this,i);return r={lastResult:c,lastArgs:i,lastThis:this},c}return s.clear=function(){r=null},s}const p3=ai(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),m3=ai(e=>e.reduce((t,r)=>(t[r.descriptor.id]=r,t),{})),rh=ai(e=>Object.values(e)),Mk=ai(e=>Object.values(e));var K0=ai((e,t)=>Mk(t).filter(s=>e===s.descriptor.droppableId).sort((s,i)=>s.descriptor.index-i.descriptor.index));function qp(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function nh(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var sh=ai((e,t)=>t.filter(r=>r.descriptor.id!==e.descriptor.id)),Rk=({isMovingForward:e,draggable:t,destination:r,insideDestination:s,previousImpact:i})=>{if(!r.isCombineEnabled||!qp(i))return null;function u(w){const k={type:"COMBINE",combine:{draggableId:w,droppableId:r.descriptor.id}};return{...i,at:k}}const f=i.displaced.all,p=f.length?f[0]:null;if(e)return p?u(p):null;const g=sh(t,s);if(!p){if(!g.length)return null;const w=g[g.length-1];return u(w.descriptor.id)}const x=g.findIndex(w=>w.descriptor.id===p);x===-1&&Ct();const b=x-1;if(b<0)return null;const v=g[b];return u(v.descriptor.id)},X0=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const g3={point:li,value:0},au={invisible:{},visible:{},all:[]},Nk={displaced:au,displacedBy:g3,at:null};var zo=(e,t)=>r=>e<=r&&r<=t,x3=e=>{const t=zo(e.top,e.bottom),r=zo(e.left,e.right);return s=>{if(t(s.top)&&t(s.bottom)&&r(s.left)&&r(s.right))return!0;const c=t(s.top)||t(s.bottom),u=r(s.left)||r(s.right);if(c&&u)return!0;const p=s.top<e.top&&s.bottom>e.bottom,g=s.left<e.left&&s.right>e.right;return p&&g?!0:p&&u||g&&c}},Dk=e=>{const t=zo(e.top,e.bottom),r=zo(e.left,e.right);return s=>t(s.top)&&t(s.bottom)&&r(s.left)&&r(s.right)};const Zp={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},b3={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var Qk=e=>t=>{const r=zo(t.top,t.bottom),s=zo(t.left,t.right);return i=>e===Zp?r(i.top)&&r(i.bottom):s(i.left)&&s(i.right)};const Bk=(e,t)=>{const r=t.frame?t.frame.scroll.diff.displacement:li;return mu(e,r)},jk=(e,t,r)=>t.subject.active?r(t.subject.active)(e):!1,Pk=(e,t,r)=>r(t)(e),Yp=({target:e,destination:t,viewport:r,withDroppableDisplacement:s,isVisibleThroughFrameFn:i})=>{const c=s?Bk(e,t):e;return jk(c,t,i)&&Pk(c,r,i)},Ok=e=>Yp({...e,isVisibleThroughFrameFn:x3}),y3=e=>Yp({...e,isVisibleThroughFrameFn:Dk}),Fk=e=>Yp({...e,isVisibleThroughFrameFn:Qk(e.destination.axis)}),Uk=(e,t,r)=>{if(typeof r=="boolean")return r;if(!t)return!0;const{invisible:s,visible:i}=t;if(s[e])return!1;const c=i[e];return c?c.shouldAnimate:!0};function $k(e,t){const r=e.page.marginBox,s={top:t.point.y,right:0,bottom:0,left:t.point.x};return ia(Wp(r,s))}function lu({afterDragging:e,destination:t,displacedBy:r,viewport:s,forceShouldAnimate:i,last:c}){return e.reduce(function(f,p){const g=$k(p,r),x=p.descriptor.id;if(f.all.push(x),!Ok({target:g,destination:t,viewport:s,withDroppableDisplacement:!0}))return f.invisible[p.descriptor.id]=!0,f;const v=Uk(x,c,i),w={draggableId:x,shouldAnimate:v};return f.visible[x]=w,f},{all:[],visible:{},invisible:{}})}function zk(e,t){if(!e.length)return 0;const r=e[e.length-1].descriptor.index;return t.inHomeList?r:r+1}function o2({insideDestination:e,inHomeList:t,displacedBy:r,destination:s}){const i=zk(e,{inHomeList:t});return{displaced:au,displacedBy:r,at:{type:"REORDER",destination:{droppableId:s.descriptor.id,index:i}}}}function Fd({draggable:e,insideDestination:t,destination:r,viewport:s,displacedBy:i,last:c,index:u,forceShouldAnimate:f}){const p=X0(e,r);if(u==null)return o2({insideDestination:t,inHomeList:p,displacedBy:i,destination:r});const g=t.find(k=>k.descriptor.index===u);if(!g)return o2({insideDestination:t,inHomeList:p,displacedBy:i,destination:r});const x=sh(e,t),b=t.indexOf(g),v=x.slice(b);return{displaced:lu({afterDragging:v,destination:r,displacedBy:i,last:c,viewport:s.frame,forceShouldAnimate:f}),displacedBy:i,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:u}}}}function Sl(e,t){return!!t.effected[e]}var Hk=({isMovingForward:e,destination:t,draggables:r,combine:s,afterCritical:i})=>{if(!t.isCombineEnabled)return null;const c=s.draggableId,f=r[c].descriptor.index;return Sl(c,i)?e?f:f-1:e?f+1:f},Wk=({isMovingForward:e,isInHomeList:t,insideDestination:r,location:s})=>{if(!r.length)return null;const i=s.index,c=e?i+1:i-1,u=r[0].descriptor.index,f=r[r.length-1].descriptor.index,p=t?f:f+1;return c<u||c>p?null:c},Gk=({isMovingForward:e,isInHomeList:t,draggable:r,draggables:s,destination:i,insideDestination:c,previousImpact:u,viewport:f,afterCritical:p})=>{const g=u.at;if(g||Ct(),g.type==="REORDER"){const b=Wk({isMovingForward:e,isInHomeList:t,location:g.destination,insideDestination:c});return b==null?null:Fd({draggable:r,insideDestination:c,destination:i,viewport:f,last:u.displaced,displacedBy:u.displacedBy,index:b})}const x=Hk({isMovingForward:e,destination:i,displaced:u.displaced,draggables:s,combine:g.combine,afterCritical:p});return x==null?null:Fd({draggable:r,insideDestination:c,destination:i,viewport:f,last:u.displaced,displacedBy:u.displacedBy,index:x})},Vk=({displaced:e,afterCritical:t,combineWith:r,displacedBy:s})=>{const i=!!(e.visible[r]||e.invisible[r]);return Sl(r,t)?i?li:Y0(s.point):i?s.point:li},qk=({afterCritical:e,impact:t,draggables:r})=>{const s=nh(t);s||Ct();const i=s.draggableId,c=r[i].page.borderBox.center,u=Vk({displaced:t.displaced,afterCritical:e,combineWith:i,displacedBy:t.displacedBy});return Ai(c,u)};const v3=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,Zk=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,Kp=(e,t,r)=>t[e.crossAxisStart]+r.margin[e.crossAxisStart]+r.borderBox[e.crossAxisSize]/2,a2=({axis:e,moveRelativeTo:t,isMoving:r})=>t0(e.line,t.marginBox[e.end]+v3(e,r),Kp(e,t.marginBox,r)),l2=({axis:e,moveRelativeTo:t,isMoving:r})=>t0(e.line,t.marginBox[e.start]-Zk(e,r),Kp(e,t.marginBox,r)),Yk=({axis:e,moveInto:t,isMoving:r})=>t0(e.line,t.contentBox[e.start]+v3(e,r),Kp(e,t.contentBox,r));var Kk=({impact:e,draggable:t,draggables:r,droppable:s,afterCritical:i})=>{const c=K0(s.descriptor.id,r),u=t.page,f=s.axis;if(!c.length)return Yk({axis:f,moveInto:s.page,isMoving:u});const{displaced:p,displacedBy:g}=e,x=p.all[0];if(x){const v=r[x];if(Sl(x,i))return l2({axis:f,moveRelativeTo:v.page,isMoving:u});const w=Qd(v.page,g.point);return l2({axis:f,moveRelativeTo:w,isMoving:u})}const b=c[c.length-1];if(b.descriptor.id===t.descriptor.id)return u.borderBox.center;if(Sl(b.descriptor.id,i)){const v=Qd(b.page,Y0(i.displacedBy.point));return a2({axis:f,moveRelativeTo:v,isMoving:u})}return a2({axis:f,moveRelativeTo:b.page,isMoving:u})},cp=(e,t)=>{const r=e.frame;return r?Ai(t,r.scroll.diff.displacement):t};const Xk=({impact:e,draggable:t,droppable:r,draggables:s,afterCritical:i})=>{const c=t.page.borderBox.center,u=e.at;return!r||!u?c:u.type==="REORDER"?Kk({impact:e,draggable:t,draggables:s,droppable:r,afterCritical:i}):qk({impact:e,draggables:s,afterCritical:i})};var ih=e=>{const t=Xk(e),r=e.droppable;return r?cp(r,t):t},w3=(e,t)=>{const r=go(t,e.scroll.initial),s=Y0(r);return{frame:ia({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 c2(e,t){return e.map(r=>t[r])}function Jk(e,t){for(let r=0;r<t.length;r++){const s=t[r].visible[e];if(s)return s}return null}var eI=({impact:e,viewport:t,destination:r,draggables:s,maxScrollChange:i})=>{const c=w3(t,Ai(t.scroll.current,i)),u=r.frame?Vp(r,Ai(r.frame.scroll.current,i)):r,f=e.displaced,p=lu({afterDragging:c2(f.all,s),destination:r,displacedBy:e.displacedBy,viewport:c.frame,last:f,forceShouldAnimate:!1}),g=lu({afterDragging:c2(f.all,s),destination:u,displacedBy:e.displacedBy,viewport:t.frame,last:f,forceShouldAnimate:!1}),x={},b={},v=[f,p,g];return f.all.forEach(k=>{const I=Jk(k,v);if(I){b[k]=I;return}x[k]=!0}),{...e,displaced:{all:f.all,invisible:x,visible:b}}},tI=(e,t)=>Ai(e.scroll.diff.displacement,t),Xp=({pageBorderBoxCenter:e,draggable:t,viewport:r})=>{const s=tI(r,e),i=go(s,t.page.borderBox.center);return Ai(t.client.borderBox.center,i)},A3=({draggable:e,destination:t,newPageBorderBoxCenter:r,viewport:s,withDroppableDisplacement:i,onlyOnMainAxis:c=!1})=>{const u=go(r,e.page.borderBox.center),p={target:mu(e.page.borderBox,u),destination:t,withDroppableDisplacement:i,viewport:s};return c?Fk(p):y3(p)},rI=({isMovingForward:e,draggable:t,destination:r,draggables:s,previousImpact:i,viewport:c,previousPageBorderBoxCenter:u,previousClientSelection:f,afterCritical:p})=>{if(!r.isEnabled)return null;const g=K0(r.descriptor.id,s),x=X0(t,r),b=Rk({isMovingForward:e,draggable:t,destination:r,insideDestination:g,previousImpact:i})||Gk({isMovingForward:e,isInHomeList:x,draggable:t,draggables:s,destination:r,insideDestination:g,previousImpact:i,viewport:c,afterCritical:p});if(!b)return null;const v=ih({impact:b,draggable:t,droppable:r,draggables:s,afterCritical:p});if(A3({draggable:t,destination:r,newPageBorderBoxCenter:v,viewport:c.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:Xp({pageBorderBoxCenter:v,draggable:t,viewport:c}),impact:b,scrollJumpRequest:null};const k=go(v,u),I=eI({impact:b,viewport:c,destination:r,draggables:s,maxScrollChange:k});return{clientSelection:f,impact:I,scrollJumpRequest:k}};const zi=e=>{const t=e.subject.active;return t||Ct(),t};var nI=({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:s,viewport:i})=>{const c=r.subject.active;if(!c)return null;const u=r.axis,f=zo(c[u.start],c[u.end]),p=rh(s).filter(x=>x!==r).filter(x=>x.isEnabled).filter(x=>!!x.subject.active).filter(x=>x3(i.frame)(zi(x))).filter(x=>{const b=zi(x);return e?c[u.crossAxisEnd]<b[u.crossAxisEnd]:b[u.crossAxisStart]<c[u.crossAxisStart]}).filter(x=>{const b=zi(x),v=zo(b[u.start],b[u.end]);return f(b[u.start])||f(b[u.end])||v(c[u.start])||v(c[u.end])}).sort((x,b)=>{const v=zi(x)[u.crossAxisStart],w=zi(b)[u.crossAxisStart];return e?v-w:w-v}).filter((x,b,v)=>zi(x)[u.crossAxisStart]===zi(v[0])[u.crossAxisStart]);if(!p.length)return null;if(p.length===1)return p[0];const g=p.filter(x=>zo(zi(x)[u.start],zi(x)[u.end])(t[u.line]));return g.length===1?g[0]:g.length>1?g.sort((x,b)=>zi(x)[u.start]-zi(b)[u.start])[0]:p.sort((x,b)=>{const v=s2(t,i2(zi(x))),w=s2(t,i2(zi(b)));return v!==w?v-w:zi(x)[u.start]-zi(b)[u.start]})[0]};const u2=(e,t)=>{const r=e.page.borderBox.center;return Sl(e.descriptor.id,t)?go(r,t.displacedBy.point):r},sI=(e,t)=>{const r=e.page.borderBox;return Sl(e.descriptor.id,t)?mu(r,Y0(t.displacedBy.point)):r};var iI=({pageBorderBoxCenter:e,viewport:t,destination:r,insideDestination:s,afterCritical:i})=>s.filter(u=>y3({target:sI(u,i),destination:r,viewport:t.frame,withDroppableDisplacement:!0})).sort((u,f)=>{const p=ou(e,cp(r,u2(u,i))),g=ou(e,cp(r,u2(f,i)));return p<g?-1:g<p?1:u.descriptor.index-f.descriptor.index})[0]||null,gu=ai(function(t,r){const s=r[t.line];return{value:s,point:t0(t.line,s)}});const oI=(e,t,r)=>{const s=e.axis;if(e.descriptor.mode==="virtual")return t0(s.line,t[s.line]);const i=e.subject.page.contentBox[s.size],p=K0(e.descriptor.id,r).reduce((g,x)=>g+x.client.marginBox[s.size],0)+t[s.line]-i;return p<=0?null:t0(s.line,p)},T3=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),C3=(e,t,r)=>{const s=e.frame;X0(t,e)&&Ct(),e.subject.withPlaceholder&&Ct();const i=gu(e.axis,t.displaceBy).point,c=oI(e,i,r),u={placeholderSize:i,increasedBy:c,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!s){const x=$0({page:e.subject.page,withPlaceholder:u,axis:e.axis,frame:e.frame});return{...e,subject:x}}const f=c?Ai(s.scroll.max,c):s.scroll.max,p=T3(s,f),g=$0({page:e.subject.page,withPlaceholder:u,axis:e.axis,frame:p});return{...e,subject:g,frame:p}},aI=e=>{const t=e.subject.withPlaceholder;t||Ct();const r=e.frame;if(!r){const u=$0({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:u}}const s=t.oldFrameMaxScroll;s||Ct();const i=T3(r,s),c=$0({page:e.subject.page,axis:e.axis,frame:i,withPlaceholder:null});return{...e,subject:c,frame:i}};var lI=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:r,draggable:s,draggables:i,destination:c,viewport:u,afterCritical:f})=>{if(!t){if(r.length)return null;const b={displaced:au,displacedBy:g3,at:{type:"REORDER",destination:{droppableId:c.descriptor.id,index:0}}},v=ih({impact:b,draggable:s,droppable:c,draggables:i,afterCritical:f}),w=X0(s,c)?c:C3(c,s,i);return A3({draggable:s,destination:w,newPageBorderBoxCenter:v,viewport:u.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?b:null}const p=e[c.axis.line]<=t.page.borderBox.center[c.axis.line],g=(()=>{const b=t.descriptor.index;return t.descriptor.id===s.descriptor.id||p?b:b+1})(),x=gu(c.axis,s.displaceBy);return Fd({draggable:s,insideDestination:r,destination:c,viewport:u,displacedBy:x,last:au,index:g})},cI=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:r,isOver:s,draggables:i,droppables:c,viewport:u,afterCritical:f})=>{const p=nI({isMovingForward:e,pageBorderBoxCenter:t,source:s,droppables:c,viewport:u});if(!p)return null;const g=K0(p.descriptor.id,i),x=iI({pageBorderBoxCenter:t,viewport:u,destination:p,insideDestination:g,afterCritical:f}),b=lI({previousPageBorderBoxCenter:t,destination:p,draggable:r,draggables:i,moveRelativeTo:x,insideDestination:g,viewport:u,afterCritical:f});if(!b)return null;const v=ih({impact:b,draggable:r,droppable:p,draggables:i,afterCritical:f});return{clientSelection:Xp({pageBorderBoxCenter:v,draggable:r,viewport:u}),impact:b,scrollJumpRequest:null}},bo=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const uI=(e,t)=>{const r=bo(e);return r?t[r]:null};var dI=({state:e,type:t})=>{const r=uI(e.impact,e.dimensions.droppables),s=!!r,i=e.dimensions.droppables[e.critical.droppable.id],c=r||i,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 p=t==="MOVE_DOWN"||t==="MOVE_RIGHT",g=e.dimensions.draggables[e.critical.draggable.id],x=e.current.page.borderBoxCenter,{draggables:b,droppables:v}=e.dimensions;return f?rI({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:g,destination:c,draggables:b,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):cI({isMovingForward:p,previousPageBorderBoxCenter:x,draggable:g,isOver:c,draggables:b,droppables:v,viewport:e.viewport,afterCritical:e.afterCritical})};function Ul(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function S3(e){const t=zo(e.top,e.bottom),r=zo(e.left,e.right);return function(i){return t(i.y)&&r(i.x)}}function hI(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function fI({pageBorderBox:e,draggable:t,candidates:r}){const s=t.page.borderBox.center,i=r.map(c=>{const u=c.axis,f=t0(c.axis.line,e.center[u.line],c.page.borderBox.center[u.crossAxisLine]);return{id:c.descriptor.id,distance:ou(s,f)}}).sort((c,u)=>u.distance-c.distance);return i[0]?i[0].id:null}function pI({pageBorderBox:e,draggable:t,droppables:r}){const s=rh(r).filter(i=>{if(!i.isEnabled)return!1;const c=i.subject.active;if(!c||!hI(e,c))return!1;if(S3(c)(e.center))return!0;const u=i.axis,f=c.center[u.crossAxisLine],p=e[u.crossAxisStart],g=e[u.crossAxisEnd],x=zo(c[u.crossAxisStart],c[u.crossAxisEnd]),b=x(p),v=x(g);return!b&&!v?!0:b?p<f:g>f});return s.length?s.length===1?s[0].descriptor.id:fI({pageBorderBox:e,draggable:t,candidates:s}):null}const _3=(e,t)=>ia(mu(e,t));var mI=(e,t)=>{const r=e.frame;return r?_3(t,r.scroll.diff.value):t};function L3({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function gI({draggable:e,closest:t,inHomeList:r}){return t?r&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var xI=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:r,insideDestination:s,last:i,viewport:c,afterCritical:u})=>{const f=r.axis,p=gu(r.axis,t.displaceBy),g=p.value,x=e[f.start],b=e[f.end],w=sh(t,s).find(I=>{const N=I.descriptor.id,M=I.page.borderBox.center[f.line],D=Sl(N,u),F=L3({displaced:i,id:N});return D?F?b<=M:x<M-g:F?b<=M+g:x<M})||null,k=gI({draggable:t,closest:w,inHomeList:X0(t,r)});return Fd({draggable:t,insideDestination:s,destination:r,viewport:c,last:i,displacedBy:p,index:k})};const bI=4;var yI=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:r,destination:s,insideDestination:i,afterCritical:c})=>{if(!s.isCombineEnabled)return null;const u=s.axis,f=gu(s.axis,e.displaceBy),p=f.value,g=t[u.start],x=t[u.end],v=sh(e,i).find(k=>{const I=k.descriptor.id,N=k.page.borderBox,D=N[u.size]/bI,F=Sl(I,c),Z=L3({displaced:r.displaced,id:I});return F?Z?x>N[u.start]+D&&x<N[u.end]-D:g>N[u.start]-p+D&&g<N[u.end]-p-D:Z?x>N[u.start]+p+D&&x<N[u.end]+p-D:g>N[u.start]+D&&g<N[u.end]-D});return v?{displacedBy:f,displaced:r.displaced,at:{type:"COMBINE",combine:{draggableId:v.descriptor.id,droppableId:s.descriptor.id}}}:null},k3=({pageOffset:e,draggable:t,draggables:r,droppables:s,previousImpact:i,viewport:c,afterCritical:u})=>{const f=_3(t.page.borderBox,e),p=pI({pageBorderBox:f,draggable:t,droppables:s});if(!p)return Nk;const g=s[p],x=K0(g.descriptor.id,r),b=mI(g,f);return yI({pageBorderBoxWithDroppableScroll:b,draggable:t,previousImpact:i,destination:g,insideDestination:x,afterCritical:u})||xI({pageBorderBoxWithDroppableScroll:b,draggable:t,destination:g,insideDestination:x,last:i.displaced,viewport:c,afterCritical:u})},Jp=(e,t)=>({...e,[t.descriptor.id]:t});const vI=({previousImpact:e,impact:t,droppables:r})=>{const s=bo(e),i=bo(t);if(!s||s===i)return r;const c=r[s];if(!c.subject.withPlaceholder)return r;const u=aI(c);return Jp(r,u)};var wI=({draggable:e,draggables:t,droppables:r,previousImpact:s,impact:i})=>{const c=vI({previousImpact:s,impact:i,droppables:r}),u=bo(i);if(!u)return c;const f=r[u];if(X0(e,f)||f.subject.withPlaceholder)return c;const p=C3(f,e,t);return Jp(c,p)},Vc=({state:e,clientSelection:t,dimensions:r,viewport:s,impact:i,scrollJumpRequest:c})=>{const u=s||e.viewport,f=r||e.dimensions,p=t||e.current.client.selection,g=go(p,e.initial.client.selection),x={offset:g,selection:p,borderBoxCenter:Ai(e.initial.client.borderBoxCenter,g)},b={selection:Ai(x.selection,u.scroll.current),borderBoxCenter:Ai(x.borderBoxCenter,u.scroll.current),offset:Ai(x.offset,u.scroll.diff.value)},v={client:x,page:b};if(e.phase==="COLLECTING")return{...e,dimensions:f,viewport:u,current:v};const w=f.draggables[e.critical.draggable.id],k=i||k3({pageOffset:b.offset,draggable:w,draggables:f.draggables,droppables:f.droppables,previousImpact:e.impact,viewport:u,afterCritical:e.afterCritical}),I=wI({draggable:w,impact:k,previousImpact:e.impact,draggables:f.draggables,droppables:f.droppables});return{...e,current:v,dimensions:{draggables:f.draggables,droppables:I},impact:k,viewport:u,scrollJumpRequest:c||null,forceShouldAnimate:c?!1:null}};function AI(e,t){return e.map(r=>t[r])}var I3=({impact:e,viewport:t,draggables:r,destination:s,forceShouldAnimate:i})=>{const c=e.displaced,u=AI(c.all,r),f=lu({afterDragging:u,destination:s,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:i,last:c});return{...e,displaced:f}},E3=({impact:e,draggable:t,droppable:r,draggables:s,viewport:i,afterCritical:c})=>{const u=ih({impact:e,draggable:t,draggables:s,droppable:r,afterCritical:c});return Xp({pageBorderBoxCenter:u,draggable:t,viewport:i})},M3=({state:e,dimensions:t,viewport:r})=>{e.movementMode!=="SNAP"&&Ct();const s=e.impact,i=r||e.viewport,c=t||e.dimensions,{draggables:u,droppables:f}=c,p=u[e.critical.draggable.id],g=bo(s);g||Ct();const x=f[g],b=I3({impact:s,viewport:i,destination:x,draggables:u}),v=E3({impact:b,draggable:p,droppable:x,draggables:u,viewport:i,afterCritical:e.afterCritical});return Vc({impact:b,clientSelection:v,state:e,dimensions:c,viewport:i})},TI=e=>({index:e.index,droppableId:e.droppableId}),R3=({draggable:e,home:t,draggables:r,viewport:s})=>{const i=gu(t.axis,e.displaceBy),c=K0(t.descriptor.id,r),u=c.indexOf(e);u===-1&&Ct();const f=c.slice(u+1),p=f.reduce((v,w)=>(v[w.descriptor.id]=!0,v),{}),g={inVirtualList:t.descriptor.mode==="virtual",displacedBy:i,effected:p};return{impact:{displaced:lu({afterDragging:f,destination:t,displacedBy:i,last:null,viewport:s.frame,forceShouldAnimate:!1}),displacedBy:i,at:{type:"REORDER",destination:TI(e.descriptor)}},afterCritical:g}},CI=(e,t)=>({draggables:e.draggables,droppables:Jp(e.droppables,t)}),SI=({draggable:e,offset:t,initialWindowScroll:r})=>{const s=Qd(e.client,t),i=Bd(s,r);return{...e,placeholder:{...e.placeholder,client:s},client:s,page:i}},_I=e=>{const t=e.frame;return t||Ct(),t},LI=({additions:e,updatedDroppables:t,viewport:r})=>{const s=r.scroll.diff.value;return e.map(i=>{const c=i.descriptor.droppableId,u=t[c],p=_I(u).scroll.diff.value,g=Ai(s,p);return SI({draggable:i,offset:g,initialWindowScroll:r.scroll.initial})})},kI=({state:e,published:t})=>{const r=t.modified.map(M=>{const D=e.dimensions.droppables[M.droppableId];return Vp(D,M.scroll)}),s={...e.dimensions.droppables,...p3(r)},i=m3(LI({additions:t.additions,updatedDroppables:s,viewport:e.viewport})),c={...e.dimensions.draggables,...i};t.removals.forEach(M=>{delete c[M]});const u={droppables:s,draggables:c},f=bo(e.impact),p=f?u.droppables[f]:null,g=u.draggables[e.critical.draggable.id],x=u.droppables[e.critical.droppable.id],{impact:b,afterCritical:v}=R3({draggable:g,home:x,draggables:c,viewport:e.viewport}),w=p&&p.isCombineEnabled?e.impact:b,k=k3({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}),I={...e,phase:"DRAGGING",impact:k,onLiftImpact:b,dimensions:u,afterCritical:v,forceShouldAnimate:!1};return e.phase==="COLLECTING"?I:{...I,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const up=e=>e.movementMode==="SNAP",gf=(e,t,r)=>{const s=CI(e.dimensions,t);return!up(e)||r?Vc({state:e,dimensions:s}):M3({state:e,dimensions:s})};function xf(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const d2={phase:"IDLE",completed:null,shouldFlush:!1};var II=(e=d2,t)=>{if(t.type==="FLUSH")return{...d2,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&Ct();const{critical:r,clientSelection:s,viewport:i,dimensions:c,movementMode:u}=t.payload,f=c.draggables[r.draggable.id],p=c.droppables[r.droppable.id],g={selection:s,borderBoxCenter:f.client.borderBox.center,offset:li},x={client:g,page:{selection:Ai(g.selection,i.scroll.initial),borderBoxCenter:Ai(g.selection,i.scroll.initial),offset:Ai(g.selection,i.scroll.diff.value)}},b=rh(c.droppables).every(I=>!I.isFixedOnPage),{impact:v,afterCritical:w}=R3({draggable:f,home:p,draggables:c.draggables,viewport:i});return{phase:"DRAGGING",isDragging:!0,critical:r,movementMode:u,dimensions:c,initial:x,current:x,isWindowScrollAllowed:b,impact:v,afterCritical:w,onLiftImpact:v,viewport:i,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&Ct(),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||Ct(),kI({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;Ul(e)||Ct();const{client:r}=t.payload;return Tl(r,e.current.client.selection)?e:Vc({state:e,clientSelection:r,impact:up(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return xf(e);Ul(e)||Ct();const{id:r,newScroll:s}=t.payload,i=e.dimensions.droppables[r];if(!i)return e;const c=Vp(i,s);return gf(e,c,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;Ul(e)||Ct();const{id:r,isEnabled:s}=t.payload,i=e.dimensions.droppables[r];i||Ct(),i.isEnabled===s&&Ct();const c={...i,isEnabled:s};return gf(e,c,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;Ul(e)||Ct();const{id:r,isCombineEnabled:s}=t.payload,i=e.dimensions.droppables[r];i||Ct(),i.isCombineEnabled===s&&Ct();const c={...i,isCombineEnabled:s};return gf(e,c,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;Ul(e)||Ct(),e.isWindowScrollAllowed||Ct();const r=t.payload.newScroll;if(Tl(e.viewport.scroll.current,r))return xf(e);const s=w3(e.viewport,r);return up(e)?M3({state:e,viewport:s}):Vc({state:e,viewport:s})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!Ul(e))return e;const r=t.payload.maxScroll;if(Tl(r,e.viewport.scroll.max))return e;const s={...e.viewport,scroll:{...e.viewport.scroll,max:r}};return{...e,viewport:s}}if(t.type==="MOVE_UP"||t.type==="MOVE_DOWN"||t.type==="MOVE_LEFT"||t.type==="MOVE_RIGHT"){if(e.phase==="COLLECTING"||e.phase==="DROP_PENDING")return e;e.phase!=="DRAGGING"&&Ct();const r=dI({state:e,type:t.type});return r?Vc({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"&&Ct(),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:r}}if(t.type==="DROP_ANIMATE"){const{completed:r,dropDuration:s,newHomeClientOffset:i}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||Ct(),{phase:"DROP_ANIMATING",completed:r,dropDuration:s,newHomeClientOffset:i,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:r}=t.payload;return{phase:"IDLE",completed:r,shouldFlush:!1}}return e};function _n(e,t){return e instanceof Object&&"type"in e&&e.type===t}const EI=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),MI=e=>({type:"LIFT",payload:e}),RI=e=>({type:"INITIAL_PUBLISH",payload:e}),NI=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),DI=()=>({type:"COLLECTION_STARTING",payload:null}),QI=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),BI=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),jI=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),N3=e=>({type:"MOVE",payload:e}),PI=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),OI=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),FI=()=>({type:"MOVE_UP",payload:null}),UI=()=>({type:"MOVE_DOWN",payload:null}),$I=()=>({type:"MOVE_RIGHT",payload:null}),zI=()=>({type:"MOVE_LEFT",payload:null}),e1=()=>({type:"FLUSH",payload:null}),HI=e=>({type:"DROP_ANIMATE",payload:e}),t1=e=>({type:"DROP_COMPLETE",payload:e}),D3=e=>({type:"DROP",payload:e}),WI=e=>({type:"DROP_PENDING",payload:e}),Q3=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var GI=e=>({getState:t,dispatch:r})=>s=>i=>{if(!_n(i,"LIFT")){s(i);return}const{id:c,clientSelection:u,movementMode:f}=i.payload,p=t();p.phase==="DROP_ANIMATING"&&r(t1({completed:p.completed})),t().phase!=="IDLE"&&Ct(),r(e1()),r(EI({draggableId:c,movementMode:f}));const x={draggableId:c,scrollOptions:{shouldPublishImmediately:f==="SNAP"}},{critical:b,dimensions:v,viewport:w}=e.startPublishing(x);r(RI({critical:b,dimensions:v,clientSelection:u,movementMode:f,viewport:w}))},VI=e=>()=>t=>r=>{_n(r,"INITIAL_PUBLISH")&&e.dragging(),_n(r,"DROP_ANIMATE")&&e.dropping(r.payload.completed.result.reason),(_n(r,"FLUSH")||_n(r,"DROP_COMPLETE"))&&e.resting(),t(r)};const r1={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},cu={opacity:{drop:0,combining:.7},scale:{drop:.75}},B3={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},Fl=`${B3.outOfTheWay}s ${r1.outOfTheWay}`,qc={fluid:`opacity ${Fl}`,snap:`transform ${Fl}, opacity ${Fl}`,drop:e=>{const t=`${e}s ${r1.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${Fl}`,placeholder:`height ${Fl}, width ${Fl}, margin ${Fl}`},h2=e=>Tl(e,li)?void 0:`translate(${e.x}px, ${e.y}px)`,dp={moveTo:h2,drop:(e,t)=>{const r=h2(e);if(r)return t?`${r} scale(${cu.scale.drop})`:r}},{minDropTime:hp,maxDropTime:j3}=B3,qI=j3-hp,f2=1500,ZI=.6;var YI=({current:e,destination:t,reason:r})=>{const s=ou(e,t);if(s<=0)return hp;if(s>=f2)return j3;const i=s/f2,c=hp+qI*i,u=r==="CANCEL"?c*ZI:c;return Number(u.toFixed(2))},KI=({impact:e,draggable:t,dimensions:r,viewport:s,afterCritical:i})=>{const{draggables:c,droppables:u}=r,f=bo(e),p=f?u[f]:null,g=u[t.descriptor.droppableId],x=E3({impact:e,draggable:t,draggables:c,afterCritical:i,droppable:p||g,viewport:s});return go(x,t.client.borderBox.center)},XI=({draggables:e,reason:t,lastImpact:r,home:s,viewport:i,onLiftImpact:c})=>!r.at||t!=="DROP"?{impact:I3({draggables:e,impact:c,destination:s,viewport:i,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:r.at.type==="REORDER"?{impact:r,didDropInsideDroppable:!0}:{impact:{...r,displaced:au},didDropInsideDroppable:!0};const JI=({getState:e,dispatch:t})=>r=>s=>{if(!_n(s,"DROP")){r(s);return}const i=e(),c=s.payload.reason;if(i.phase==="COLLECTING"){t(WI({reason:c}));return}if(i.phase==="IDLE")return;i.phase==="DROP_PENDING"&&i.isWaiting&&Ct(),i.phase==="DRAGGING"||i.phase==="DROP_PENDING"||Ct();const f=i.critical,p=i.dimensions,g=p.draggables[i.critical.draggable.id],{impact:x,didDropInsideDroppable:b}=XI({reason:c,lastImpact:i.impact,afterCritical:i.afterCritical,onLiftImpact:i.onLiftImpact,home:i.dimensions.droppables[i.critical.droppable.id],viewport:i.viewport,draggables:i.dimensions.draggables}),v=b?qp(x):null,w=b?nh(x):null,k={index:f.draggable.index,droppableId:f.droppable.id},I={draggableId:g.descriptor.id,type:g.descriptor.type,source:k,reason:c,mode:i.movementMode,destination:v,combine:w},N=KI({impact:x,draggable:g,dimensions:p,viewport:i.viewport,afterCritical:i.afterCritical}),M={critical:i.critical,afterCritical:i.afterCritical,result:I,impact:x};if(!(!Tl(i.current.client.offset,N)||!!I.combine)){t(t1({completed:M}));return}const F=YI({current:i.current.client.offset,destination:N,reason:c});t(HI({newHomeClientOffset:N,dropDuration:F,completed:M}))};var P3=()=>({x:window.pageXOffset,y:window.pageYOffset});function eE(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function tE({onWindowScroll:e}){function t(){e(P3())}const r=iu(t),s=eE(r);let i=Al;function c(){return i!==Al}function u(){c()&&Ct(),i=Fo(window,[s])}function f(){c()||Ct(),r.cancel(),i(),i=Al}return{start:u,stop:f,isActive:c}}const rE=e=>_n(e,"DROP_COMPLETE")||_n(e,"DROP_ANIMATE")||_n(e,"FLUSH"),nE=e=>{const t=tE({onWindowScroll:r=>{e.dispatch(PI({newScroll:r}))}});return r=>s=>{!t.isActive()&&_n(s,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&rE(s)&&t.stop(),r(s)}};var sE=e=>{let t=!1,r=!1;const s=setTimeout(()=>{r=!0}),i=c=>{t||r||(t=!0,e(c),clearTimeout(s))};return i.wasCalled=()=>t,i},iE=()=>{const e=[],t=i=>{const c=e.findIndex(f=>f.timerId===i);c===-1&&Ct();const[u]=e.splice(c,1);u.callback()};return{add:i=>{const c=setTimeout(()=>t(c)),u={timerId:c,callback:i};e.push(u)},flush:()=>{if(!e.length)return;const i=[...e];e.length=0,i.forEach(c=>{clearTimeout(c.timerId),c.callback()})}}};const oE=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,aE=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,lE=(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},kc=(e,t)=>{t()},rd=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function bf(e,t,r,s){if(!e){r(s(t));return}const i=sE(r);e(t,{announce:i}),i.wasCalled()||r(s(t))}var cE=(e,t)=>{const r=iE();let s=null;const i=(b,v)=>{s&&Ct(),kc("onBeforeCapture",()=>{const w=e().onBeforeCapture;w&&w({draggableId:b,mode:v})})},c=(b,v)=>{s&&Ct(),kc("onBeforeDragStart",()=>{const w=e().onBeforeDragStart;w&&w(rd(b,v))})},u=(b,v)=>{s&&Ct();const w=rd(b,v);s={mode:v,lastCritical:b,lastLocation:w.source,lastCombine:null},r.add(()=>{kc("onDragStart",()=>bf(e().onDragStart,w,t,Ad.onDragStart))})},f=(b,v)=>{const w=qp(v),k=nh(v);s||Ct();const I=!lE(b,s.lastCritical);I&&(s.lastCritical=b);const N=!oE(s.lastLocation,w);N&&(s.lastLocation=w);const M=!aE(s.lastCombine,k);if(M&&(s.lastCombine=k),!I&&!N&&!M)return;const D={...rd(b,s.mode),combine:k,destination:w};r.add(()=>{kc("onDragUpdate",()=>bf(e().onDragUpdate,D,t,Ad.onDragUpdate))})},p=()=>{s||Ct(),r.flush()},g=b=>{s||Ct(),s=null,kc("onDragEnd",()=>bf(e().onDragEnd,b,t,Ad.onDragEnd))};return{beforeCapture:i,beforeStart:c,start:u,update:f,flush:p,drop:g,abort:()=>{if(!s)return;const b={...rd(s.lastCritical,s.mode),combine:null,destination:null,reason:"CANCEL"};g(b)}}},uE=(e,t)=>{const r=cE(e,t);return s=>i=>c=>{if(_n(c,"BEFORE_INITIAL_CAPTURE")){r.beforeCapture(c.payload.draggableId,c.payload.movementMode);return}if(_n(c,"INITIAL_PUBLISH")){const f=c.payload.critical;r.beforeStart(f,c.payload.movementMode),i(c),r.start(f,c.payload.movementMode);return}if(_n(c,"DROP_COMPLETE")){const f=c.payload.completed.result;r.flush(),i(c),r.drop(f);return}if(i(c),_n(c,"FLUSH")){r.abort();return}const u=s.getState();u.phase==="DRAGGING"&&r.update(u.critical,u.impact)}};const dE=e=>t=>r=>{if(!_n(r,"DROP_ANIMATION_FINISHED")){t(r);return}const s=e.getState();s.phase!=="DROP_ANIMATING"&&Ct(),e.dispatch(t1({completed:s.completed}))},hE=e=>{let t=null,r=null;function s(){r&&(cancelAnimationFrame(r),r=null),t&&(t(),t=null)}return i=>c=>{if((_n(c,"FLUSH")||_n(c,"DROP_COMPLETE")||_n(c,"DROP_ANIMATION_FINISHED"))&&s(),i(c),!_n(c,"DROP_ANIMATE"))return;const u={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(Q3())}};r=requestAnimationFrame(()=>{r=null,t=Fo(window,[u])})}};var fE=e=>()=>t=>r=>{(_n(r,"DROP_COMPLETE")||_n(r,"FLUSH")||_n(r,"DROP_ANIMATE"))&&e.stopPublishing(),t(r)},pE=e=>{let t=!1;return()=>r=>s=>{if(_n(s,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(s.payload.critical.draggable.id),r(s),e.tryRestoreFocusRecorded();return}if(r(s),!!t){if(_n(s,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(_n(s,"DROP_COMPLETE")){t=!1;const i=s.payload.completed.result;i.combine&&e.tryShiftRecord(i.draggableId,i.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const mE=e=>_n(e,"DROP_COMPLETE")||_n(e,"DROP_ANIMATE")||_n(e,"FLUSH");var gE=e=>t=>r=>s=>{if(mE(s)){e.stop(),r(s);return}if(_n(s,"INITIAL_PUBLISH")){r(s);const i=t.getState();i.phase!=="DRAGGING"&&Ct(),e.start(i);return}r(s),e.scroll(t.getState())};const xE=e=>t=>r=>{if(t(r),!_n(r,"PUBLISH_WHILE_DRAGGING"))return;const s=e.getState();s.phase==="DROP_PENDING"&&(s.isWaiting||e.dispatch(D3({reason:s.reason})))},bE=e3;var yE=({dimensionMarshal:e,focusMarshal:t,styleMarshal:r,getResponders:s,announce:i,autoScroller:c})=>Jx(II,bE(gL(VI(r),fE(e),GI(e),JI,dE,hE,xE,gE(c),nE,pE(t),uE(s,i))));const yf=()=>({additions:{},removals:{},modified:{}});function vE({registry:e,callbacks:t}){let r=yf(),s=null;const i=()=>{s||(t.collectionStarting(),s=requestAnimationFrame(()=>{s=null;const{additions:p,removals:g,modified:x}=r,b=Object.keys(p).map(k=>e.draggable.getById(k).getDimension(li)).sort((k,I)=>k.descriptor.index-I.descriptor.index),v=Object.keys(x).map(k=>{const N=e.droppable.getById(k).callbacks.getScrollWhileDragging();return{droppableId:k,scroll:N}}),w={additions:b,removals:Object.keys(g),modified:v};r=yf(),t.publish(w)}))};return{add:p=>{const g=p.descriptor.id;r.additions[g]=p,r.modified[p.descriptor.droppableId]=!0,r.removals[g]&&delete r.removals[g],i()},remove:p=>{const g=p.descriptor;r.removals[g.id]=!0,r.modified[g.droppableId]=!0,r.additions[g.id]&&delete r.additions[g.id],i()},stop:()=>{s&&(cancelAnimationFrame(s),s=null,r=yf())}}}var O3=({scrollHeight:e,scrollWidth:t,height:r,width:s})=>{const i=go({x:t,y:e},{x:s,y:r});return{x:Math.max(0,i.x),y:Math.max(0,i.y)}},F3=()=>{const e=document.documentElement;return e||Ct(),e},U3=()=>{const e=F3();return O3({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},wE=()=>{const e=P3(),t=U3(),r=e.y,s=e.x,i=F3(),c=i.clientWidth,u=i.clientHeight,f=s+c,p=r+u;return{frame:ia({top:r,left:s,right:f,bottom:p}),scroll:{initial:e,current:e,max:t,diff:{value:li,displacement:li}}}},AE=({critical:e,scrollOptions:t,registry:r})=>{const s=wE(),i=s.scroll.current,c=e.droppable,u=r.droppable.getAllByType(c.type).map(x=>x.callbacks.getDimensionAndWatchScroll(i,t)),f=r.draggable.getAllByType(e.draggable.type).map(x=>x.getDimension(i));return{dimensions:{draggables:m3(f),droppables:p3(u)},critical:e,viewport:s}};function p2(e,t,r){return!(r.descriptor.id===t.id||r.descriptor.type!==t.type||e.droppable.getById(r.descriptor.droppableId).descriptor.mode!=="virtual")}var TE=(e,t)=>{let r=null;const s=vE({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),i=(v,w)=>{e.droppable.exists(v)||Ct(),r&&t.updateDroppableIsEnabled({id:v,isEnabled:w})},c=(v,w)=>{r&&(e.droppable.exists(v)||Ct(),t.updateDroppableIsCombineEnabled({id:v,isCombineEnabled:w}))},u=(v,w)=>{r&&(e.droppable.exists(v)||Ct(),t.updateDroppableScroll({id:v,newScroll:w}))},f=(v,w)=>{r&&e.droppable.getById(v).callbacks.scroll(w)},p=()=>{if(!r)return;s.stop();const v=r.critical.droppable;e.droppable.getAllByType(v.type).forEach(w=>w.callbacks.dragStopped()),r.unsubscribe(),r=null},g=v=>{r||Ct();const w=r.critical.draggable;v.type==="ADDITION"&&p2(e,w,v.value)&&s.add(v.value),v.type==="REMOVAL"&&p2(e,w,v.value)&&s.remove(v.value)};return{updateDroppableIsEnabled:i,updateDroppableIsCombineEnabled:c,scrollDroppable:f,updateDroppableScroll:u,startPublishing:v=>{r&&Ct();const w=e.draggable.getById(v.draggableId),k=e.droppable.getById(w.descriptor.droppableId),I={draggable:w.descriptor,droppable:k.descriptor},N=e.subscribe(g);return r={critical:I,unsubscribe:N},AE({critical:I,registry:e,scrollOptions:v.scrollOptions})},stopPublishing:p}},$3=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",CE=e=>{window.scrollBy(e.x,e.y)};const SE=ai(e=>rh(e).filter(t=>!(!t.isEnabled||!t.frame))),_E=(e,t)=>SE(t).find(s=>(s.frame||Ct(),S3(s.frame.pageMarginBox)(e)))||null;var LE=({center:e,destination:t,droppables:r})=>{if(t){const i=r[t];return i.frame?i:null}return _E(e,r)};const uu={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var kE=(e,t,r=()=>uu)=>{const s=r(),i=e[t.size]*s.startFromPercentage,c=e[t.size]*s.maxScrollAtPercentage;return{startScrollingFrom:i,maxScrollValueAt:c}},z3=({startOfRange:e,endOfRange:t,current:r})=>{const s=t-e;return s===0?0:(r-e)/s},n1=1,IE=(e,t,r=()=>uu)=>{const s=r();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return s.maxPixelScroll;if(e===t.startScrollingFrom)return n1;const c=1-z3({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),u=s.maxPixelScroll*s.ease(c);return Math.ceil(u)},EE=(e,t,r)=>{const s=r(),i=s.durationDampening.accelerateAt,c=s.durationDampening.stopDampeningAt,u=t,f=c,g=Date.now()-u;if(g>=c)return e;if(g<i)return n1;const x=z3({startOfRange:i,endOfRange:f,current:g}),b=e*s.ease(x);return Math.ceil(b)},m2=({distanceToEdge:e,thresholds:t,dragStartTime:r,shouldUseTimeDampening:s,getAutoScrollerOptions:i})=>{const c=IE(e,t,i);return c===0?0:s?Math.max(EE(c,r,i),n1):c},g2=({container:e,distanceToEdges:t,dragStartTime:r,axis:s,shouldUseTimeDampening:i,getAutoScrollerOptions:c})=>{const u=kE(e,s,c);return t[s.end]<t[s.start]?m2({distanceToEdge:t[s.end],thresholds:u,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c}):-1*m2({distanceToEdge:t[s.start],thresholds:u,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c})},ME=({container:e,subject:t,proposedScroll:r})=>{const s=t.height>e.height,i=t.width>e.width;return!i&&!s?r:i&&s?null:{x:i?0:r.x,y:s?0:r.y}};const RE=f3(e=>e===0?0:e);var H3=({dragStartTime:e,container:t,subject:r,center:s,shouldUseTimeDampening:i,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=g2({container:t,distanceToEdges:u,dragStartTime:e,axis:Zp,shouldUseTimeDampening:i,getAutoScrollerOptions:c}),p=g2({container:t,distanceToEdges:u,dragStartTime:e,axis:b3,shouldUseTimeDampening:i,getAutoScrollerOptions:c}),g=RE({x:p,y:f});if(Tl(g,li))return null;const x=ME({container:t,subject:r,proposedScroll:g});return x?Tl(x,li)?null:x:null};const NE=f3(e=>e===0?0:e>0?1:-1),s1=(()=>{const e=(t,r)=>t<0?t:t>r?t-r:0;return({current:t,max:r,change:s})=>{const i=Ai(t,s),c={x:e(i.x,r.x),y:e(i.y,r.y)};return Tl(c,li)?null:c}})(),W3=({max:e,current:t,change:r})=>{const s={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},i=NE(r),c=s1({max:s,current:t,change:i});return!c||i.x!==0&&c.x===0||i.y!==0&&c.y===0},i1=(e,t)=>W3({current:e.scroll.current,max:e.scroll.max,change:t}),DE=(e,t)=>{if(!i1(e,t))return null;const r=e.scroll.max,s=e.scroll.current;return s1({current:s,max:r,change:t})},o1=(e,t)=>{const r=e.frame;return r?W3({current:r.scroll.current,max:r.scroll.max,change:t}):!1},QE=(e,t)=>{const r=e.frame;return!r||!o1(e,t)?null:s1({current:r.scroll.current,max:r.scroll.max,change:t})};var BE=({viewport:e,subject:t,center:r,dragStartTime:s,shouldUseTimeDampening:i,getAutoScrollerOptions:c})=>{const u=H3({dragStartTime:s,container:e.frame,subject:t,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c});return u&&i1(e,u)?u:null},jE=({droppable:e,subject:t,center:r,dragStartTime:s,shouldUseTimeDampening:i,getAutoScrollerOptions:c})=>{const u=e.frame;if(!u)return null;const f=H3({dragStartTime:s,container:u.pageMarginBox,subject:t,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c});return f&&o1(e,f)?f:null},x2=({state:e,dragStartTime:t,shouldUseTimeDampening:r,scrollWindow:s,scrollDroppable:i,getAutoScrollerOptions:c})=>{const u=e.current.page.borderBoxCenter,p=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const b=e.viewport,v=BE({dragStartTime:t,viewport:b,subject:p,center:u,shouldUseTimeDampening:r,getAutoScrollerOptions:c});if(v){s(v);return}}const g=LE({center:u,destination:bo(e.impact),droppables:e.dimensions.droppables});if(!g)return;const x=jE({dragStartTime:t,droppable:g,subject:p,center:u,shouldUseTimeDampening:r,getAutoScrollerOptions:c});x&&i(g.descriptor.id,x)},PE=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:r=()=>uu})=>{const s=iu(e),i=iu(t);let c=null;const u=g=>{c||Ct();const{shouldUseTimeDampening:x,dragStartTime:b}=c;x2({state:g,scrollWindow:s,scrollDroppable:i,dragStartTime:b,shouldUseTimeDampening:x,getAutoScrollerOptions:r})};return{start:g=>{c&&Ct();const x=Date.now();let b=!1;const v=()=>{b=!0};x2({state:g,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:v,scrollDroppable:v,getAutoScrollerOptions:r}),c={dragStartTime:x,shouldUseTimeDampening:b},b&&u(g)},stop:()=>{c&&(s.cancel(),i.cancel(),c=null)},scroll:u}},OE=({move:e,scrollDroppable:t,scrollWindow:r})=>{const s=(f,p)=>{const g=Ai(f.current.client.selection,p);e({client:g})},i=(f,p)=>{if(!o1(f,p))return p;const g=QE(f,p);if(!g)return t(f.descriptor.id,p),null;const x=go(p,g);return t(f.descriptor.id,x),go(p,x)},c=(f,p,g)=>{if(!f||!i1(p,g))return g;const x=DE(p,g);if(!x)return r(g),null;const b=go(g,x);return r(b),go(g,b)};return f=>{const p=f.scrollJumpRequest;if(!p)return;const g=bo(f.impact);g||Ct();const x=i(f.dimensions.droppables[g],p);if(!x)return;const b=f.viewport,v=c(f.isWindowScrollAllowed,b,x);v&&s(f,v)}},FE=({scrollDroppable:e,scrollWindow:t,move:r,getAutoScrollerOptions:s})=>{const i=PE({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:s}),c=OE({move:r,scrollWindow:t,scrollDroppable:e});return{scroll:p=>{if(!(s().disabled||p.phase!=="DRAGGING")){if(p.movementMode==="FLUID"){i.scroll(p);return}p.scrollJumpRequest&&c(p)}},start:i.start,stop:i.stop}};const z0="data-rfd",H0=(()=>{const e=`${z0}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),fp=(()=>{const e=`${z0}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),UE=(()=>{const e=`${z0}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),b2={contextId:`${z0}-scroll-container-context-id`},$E=e=>t=>`[${t}="${e}"]`,Ic=(e,t)=>e.map(r=>{const s=r.styles[t];return s?`${r.selector} { ${s} }`:""}).join(" "),zE="pointer-events: none;";var HE=e=>{const t=$E(e),r=(()=>{const f=`
110
+ cursor: -webkit-grab;
111
+ cursor: grab;
112
+ `;return{selector:t(H0.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:zE,dropAnimating:f}}})(),s=(()=>{const f=`
117
+ transition: ${qc.outOfTheWay};
118
+ `;return{selector:t(fp.contextId),styles:{dragging:f,dropAnimating:f,userCancel:f}}})(),i={selector:t(UE.contextId),styles:{always:"overflow-anchor: none;"}},u=[s,r,i,{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:Ic(u,"always"),resting:Ic(u,"resting"),dragging:Ic(u,"dragging"),dropAnimating:Ic(u,"dropAnimating"),userCancel:Ic(u,"userCancel")}};const yo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?A.useLayoutEffect:A.useEffect,vf=()=>{const e=document.querySelector("head");return e||Ct(),e},y2=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function WE(e,t){const r=nn(()=>HE(e),[e]),s=A.useRef(null),i=A.useRef(null),c=or(ai(b=>{const v=i.current;v||Ct(),v.textContent=b}),[]),u=or(b=>{const v=s.current;v||Ct(),v.textContent=b},[]);yo(()=>{!s.current&&!i.current||Ct();const b=y2(t),v=y2(t);return s.current=b,i.current=v,b.setAttribute(`${z0}-always`,e),v.setAttribute(`${z0}-dynamic`,e),vf().appendChild(b),vf().appendChild(v),u(r.always),c(r.resting),()=>{const w=k=>{const I=k.current;I||Ct(),vf().removeChild(I),k.current=null};w(s),w(i)}},[t,u,c,r.always,r.resting,e]);const f=or(()=>c(r.dragging),[c,r.dragging]),p=or(b=>{if(b==="DROP"){c(r.dropAnimating);return}c(r.userCancel)},[c,r.dropAnimating,r.userCancel]),g=or(()=>{i.current&&c(r.resting)},[c,r.resting]);return nn(()=>({dragging:f,dropping:p,resting:g}),[f,p,g])}function G3(e,t){return Array.from(e.querySelectorAll(t))}var V3=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function oh(e){return e instanceof V3(e).HTMLElement}function GE(e,t){const r=`[${H0.contextId}="${e}"]`,s=G3(document,r);if(!s.length)return null;const i=s.find(c=>c.getAttribute(H0.draggableId)===t);return!i||!oh(i)?null:i}function VE(e){const t=A.useRef({}),r=A.useRef(null),s=A.useRef(null),i=A.useRef(!1),c=or(function(v,w){const k={id:v,focus:w};return t.current[v]=k,function(){const N=t.current;N[v]!==k&&delete N[v]}},[]),u=or(function(v){const w=GE(e,v);w&&w!==document.activeElement&&w.focus()},[e]),f=or(function(v,w){r.current===v&&(r.current=w)},[]),p=or(function(){s.current||i.current&&(s.current=requestAnimationFrame(()=>{s.current=null;const v=r.current;v&&u(v)}))},[u]),g=or(function(v){r.current=null;const w=document.activeElement;w&&w.getAttribute(H0.draggableId)===v&&(r.current=v)},[]);return yo(()=>(i.current=!0,function(){i.current=!1;const v=s.current;v&&cancelAnimationFrame(v)}),[]),nn(()=>({register:c,tryRecordFocus:g,tryRestoreFocusRecorded:p,tryShiftRecord:f}),[c,g,p,f])}function qE(){const e={draggables:{},droppables:{}},t=[];function r(b){return t.push(b),function(){const w=t.indexOf(b);w!==-1&&t.splice(w,1)}}function s(b){t.length&&t.forEach(v=>v(b))}function i(b){return e.draggables[b]||null}function c(b){const v=i(b);return v||Ct(),v}const u={register:b=>{e.draggables[b.descriptor.id]=b,s({type:"ADDITION",value:b})},update:(b,v)=>{const w=e.draggables[v.descriptor.id];w&&w.uniqueId===b.uniqueId&&(delete e.draggables[v.descriptor.id],e.draggables[b.descriptor.id]=b)},unregister:b=>{const v=b.descriptor.id,w=i(v);w&&b.uniqueId===w.uniqueId&&(delete e.draggables[v],e.droppables[b.descriptor.droppableId]&&s({type:"REMOVAL",value:b}))},getById:c,findById:i,exists:b=>!!i(b),getAllByType:b=>Object.values(e.draggables).filter(v=>v.descriptor.type===b)};function f(b){return e.droppables[b]||null}function p(b){const v=f(b);return v||Ct(),v}const g={register:b=>{e.droppables[b.descriptor.id]=b},unregister:b=>{const v=f(b.descriptor.id);v&&b.uniqueId===v.uniqueId&&delete e.droppables[b.descriptor.id]},getById:p,findById:f,exists:b=>!!f(b),getAllByType:b=>Object.values(e.droppables).filter(v=>v.descriptor.type===b)};function x(){e.draggables={},e.droppables={},t.length=0}return{draggable:u,droppable:g,subscribe:r,clean:x}}function ZE(){const e=nn(qE,[]);return A.useEffect(()=>function(){e.clean()},[e]),e}var a1=S.createContext(null),Ud=()=>{const e=document.body;return e||Ct(),e};const YE={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},KE=e=>`rfd-announcement-${e}`;function XE(e){const t=nn(()=>KE(e),[e]),r=A.useRef(null);return A.useEffect(function(){const c=document.createElement("div");return r.current=c,c.id=t,c.setAttribute("aria-live","assertive"),c.setAttribute("aria-atomic","true"),jd(c.style,YE),Ud().appendChild(c),function(){setTimeout(function(){const p=Ud();p.contains(c)&&p.removeChild(c),c===r.current&&(r.current=null)})}},[t]),or(i=>{const c=r.current;if(c){c.textContent=i;return}},[])}const JE={separator:"::"};function l1(e,t=JE){const r=S.useId();return nn(()=>`${e}${t.separator}${r}`,[t.separator,e,r])}function eM({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function tM({contextId:e,text:t}){const r=l1("hidden-text",{separator:"-"}),s=nn(()=>eM({contextId:e,uniqueId:r}),[r,e]);return A.useEffect(function(){const c=document.createElement("div");return c.id=s,c.textContent=t,c.style.display="none",Ud().appendChild(c),function(){const f=Ud();f.contains(c)&&f.removeChild(c)}},[s,t]),s}var ah=S.createContext(null);function q3(e){const t=A.useRef(e);return A.useEffect(()=>{t.current=e}),t}function rM(){let e=null;function t(){return!!e}function r(u){return u===e}function s(u){e&&Ct();const f={abandon:u};return e=f,f}function i(){e||Ct(),e=null}function c(){e&&(e.abandon(),i())}return{isClaimed:t,isActive:r,claim:s,release:i,tryAbandon:c}}function du(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const nM=9,sM=13,c1=27,Z3=32,iM=33,oM=34,aM=35,lM=36,cM=37,uM=38,dM=39,hM=40,fM={[sM]:!0,[nM]:!0};var Y3=e=>{fM[e.keyCode]&&e.preventDefault()};const lh=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(s=>`on${s}`in document)||e})(),K3=0,v2=5;function pM(e,t){return Math.abs(t.x-e.x)>=v2||Math.abs(t.y-e.y)>=v2}const w2={type:"IDLE"};function mM({cancel:e,completed:t,getPhase:r,setPhase:s}){return[{eventName:"mousemove",fn:i=>{const{button:c,clientX:u,clientY:f}=i;if(c!==K3)return;const p={x:u,y:f},g=r();if(g.type==="DRAGGING"){i.preventDefault(),g.actions.move(p);return}g.type!=="PENDING"&&Ct();const x=g.point;if(!pM(x,p))return;i.preventDefault();const b=g.actions.fluidLift(p);s({type:"DRAGGING",actions:b})}},{eventName:"mouseup",fn:i=>{const c=r();if(c.type!=="DRAGGING"){e();return}i.preventDefault(),c.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:i=>{r().type==="DRAGGING"&&i.preventDefault(),e()}},{eventName:"keydown",fn:i=>{if(r().type==="PENDING"){e();return}if(i.keyCode===c1){i.preventDefault(),e();return}Y3(i)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{r().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:i=>{const c=r();if(c.type==="IDLE"&&Ct(),c.actions.shouldRespectForcePress()){e();return}i.preventDefault()}},{eventName:lh,fn:e}]}function gM(e){const t=A.useRef(w2),r=A.useRef(Al),s=nn(()=>({eventName:"mousedown",fn:function(b){if(b.defaultPrevented||b.button!==K3||b.ctrlKey||b.metaKey||b.shiftKey||b.altKey)return;const v=e.findClosestDraggableId(b);if(!v)return;const w=e.tryGetLock(v,u,{sourceEvent:b});if(!w)return;b.preventDefault();const k={x:b.clientX,y:b.clientY};r.current(),g(w,k)}}),[e]),i=nn(()=>({eventName:"webkitmouseforcewillbegin",fn:x=>{if(x.defaultPrevented)return;const b=e.findClosestDraggableId(x);if(!b)return;const v=e.findOptionsForDraggable(b);v&&(v.shouldRespectForcePress||e.canGetLock(b)&&x.preventDefault())}}),[e]),c=or(function(){const b={passive:!1,capture:!0};r.current=Fo(window,[i,s],b)},[i,s]),u=or(()=>{t.current.type!=="IDLE"&&(t.current=w2,r.current(),c())},[c]),f=or(()=>{const x=t.current;u(),x.type==="DRAGGING"&&x.actions.cancel({shouldBlockNextClick:!0}),x.type==="PENDING"&&x.actions.abort()},[u]),p=or(function(){const b={capture:!0,passive:!1},v=mM({cancel:f,completed:u,getPhase:()=>t.current,setPhase:w=>{t.current=w}});r.current=Fo(window,v,b)},[f,u]),g=or(function(b,v){t.current.type!=="IDLE"&&Ct(),t.current={type:"PENDING",point:v,actions:b},p()},[p]);yo(function(){return c(),function(){r.current()}},[c])}function xM(){}const bM={[oM]:!0,[iM]:!0,[lM]:!0,[aM]:!0};function yM(e,t){function r(){t(),e.cancel()}function s(){t(),e.drop()}return[{eventName:"keydown",fn:i=>{if(i.keyCode===c1){i.preventDefault(),r();return}if(i.keyCode===Z3){i.preventDefault(),s();return}if(i.keyCode===hM){i.preventDefault(),e.moveDown();return}if(i.keyCode===uM){i.preventDefault(),e.moveUp();return}if(i.keyCode===dM){i.preventDefault(),e.moveRight();return}if(i.keyCode===cM){i.preventDefault(),e.moveLeft();return}if(bM[i.keyCode]){i.preventDefault();return}Y3(i)}},{eventName:"mousedown",fn:r},{eventName:"mouseup",fn:r},{eventName:"click",fn:r},{eventName:"touchstart",fn:r},{eventName:"resize",fn:r},{eventName:"wheel",fn:r,options:{passive:!0}},{eventName:lh,fn:r}]}function vM(e){const t=A.useRef(xM),r=nn(()=>({eventName:"keydown",fn:function(c){if(c.defaultPrevented||c.keyCode!==Z3)return;const u=e.findClosestDraggableId(c);if(!u)return;const f=e.tryGetLock(u,x,{sourceEvent:c});if(!f)return;c.preventDefault();let p=!0;const g=f.snapLift();t.current();function x(){p||Ct(),p=!1,t.current(),s()}t.current=Fo(window,yM(g,x),{capture:!0,passive:!1})}}),[e]),s=or(function(){const c={passive:!1,capture:!0};t.current=Fo(window,[r],c)},[r]);yo(function(){return s(),function(){t.current()}},[s])}const wf={type:"IDLE"},wM=120,AM=.15;function TM({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===c1&&r.preventDefault(),e()}},{eventName:lh,fn:e}]}function CM({cancel:e,completed:t,getPhase:r}){return[{eventName:"touchmove",options:{capture:!1},fn:s=>{const i=r();if(i.type!=="DRAGGING"){e();return}i.hasMoved=!0;const{clientX:c,clientY:u}=s.touches[0],f={x:c,y:u};s.preventDefault(),i.actions.move(f)}},{eventName:"touchend",fn:s=>{const i=r();if(i.type!=="DRAGGING"){e();return}s.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:s=>{if(r().type!=="DRAGGING"){e();return}s.preventDefault(),e()}},{eventName:"touchforcechange",fn:s=>{const i=r();i.type==="IDLE"&&Ct();const c=s.touches[0];if(!c||!(c.force>=AM))return;const f=i.actions.shouldRespectForcePress();if(i.type==="PENDING"){f&&e();return}if(f){if(i.hasMoved){s.preventDefault();return}e();return}s.preventDefault()}},{eventName:lh,fn:e}]}function SM(e){const t=A.useRef(wf),r=A.useRef(Al),s=or(function(){return t.current},[]),i=or(function(w){t.current=w},[]),c=nn(()=>({eventName:"touchstart",fn:function(w){if(w.defaultPrevented)return;const k=e.findClosestDraggableId(w);if(!k)return;const I=e.tryGetLock(k,f,{sourceEvent:w});if(!I)return;const N=w.touches[0],{clientX:M,clientY:D}=N,F={x:M,y:D};r.current(),b(I,F)}}),[e]),u=or(function(){const w={capture:!0,passive:!1};r.current=Fo(window,[c],w)},[c]),f=or(()=>{const v=t.current;v.type!=="IDLE"&&(v.type==="PENDING"&&clearTimeout(v.longPressTimerId),i(wf),r.current(),u())},[u,i]),p=or(()=>{const v=t.current;f(),v.type==="DRAGGING"&&v.actions.cancel({shouldBlockNextClick:!0}),v.type==="PENDING"&&v.actions.abort()},[f]),g=or(function(){const w={capture:!0,passive:!1},k={cancel:p,completed:f,getPhase:s},I=Fo(window,CM(k),w),N=Fo(window,TM(k),w);r.current=function(){I(),N()}},[p,s,f]),x=or(function(){const w=s();w.type!=="PENDING"&&Ct();const k=w.actions.fluidLift(w.point);i({type:"DRAGGING",actions:k,hasMoved:!1})},[s,i]),b=or(function(w,k){s().type!=="IDLE"&&Ct();const I=setTimeout(x,wM);i({type:"PENDING",point:k,actions:w,longPressTimerId:I}),g()},[g,s,i,x]);yo(function(){return u(),function(){r.current();const k=s();k.type==="PENDING"&&(clearTimeout(k.longPressTimerId),i(wf))}},[s,u,i]),yo(function(){return Fo(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const _M=["input","button","textarea","select","option","optgroup","video","audio"];function X3(e,t){if(t==null)return!1;if(_M.includes(t.tagName.toLowerCase()))return!0;const s=t.getAttribute("contenteditable");return s==="true"||s===""?!0:t===e?!1:X3(e,t.parentElement)}function LM(e,t){const r=t.target;return oh(r)?X3(e,r):!1}var kM=e=>ia(e.getBoundingClientRect()).center;function IM(e){return e instanceof V3(e).Element}const EM=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(s=>s in Element.prototype)||e})();function J3(e,t){return e==null?null:e[EM](t)?e:J3(e.parentElement,t)}function MM(e,t){return e.closest?e.closest(t):J3(e,t)}function RM(e){return`[${H0.contextId}="${e}"]`}function NM(e,t){const r=t.target;if(!IM(r))return null;const s=RM(e),i=MM(r,s);return!i||!oh(i)?null:i}function DM(e,t){const r=NM(e,t);return r?r.getAttribute(H0.draggableId):null}function QM(e,t){const r=`[${fp.contextId}="${e}"]`,i=G3(document,r).find(c=>c.getAttribute(fp.id)===t);return!i||!oh(i)?null:i}function BM(e){e.preventDefault()}function nd({expected:e,phase:t,isLockActive:r,shouldWarn:s}){return!(!r()||e!==t)}function e6({lockAPI:e,store:t,registry:r,draggableId:s}){if(e.isClaimed())return!1;const i=r.draggable.findById(s);return!(!i||!i.options.isEnabled||!$3(t.getState(),s))}function jM({lockAPI:e,contextId:t,store:r,registry:s,draggableId:i,forceSensorStop:c,sourceEvent:u}){if(!e6({lockAPI:e,store:r,registry:s,draggableId:i}))return null;const p=s.draggable.getById(i),g=QM(t,p.descriptor.id);if(!g||u&&!p.options.canDragInteractiveElements&&LM(g,u))return null;const x=e.claim(c||Al);let b="PRE_DRAG";function v(){return p.options.shouldRespectForcePress}function w(){return e.isActive(x)}function k(G,U){nd({expected:G,phase:b,isLockActive:w,shouldWarn:!0})&&r.dispatch(U())}const I=k.bind(null,"DRAGGING");function N(G){function U(){e.release(),b="COMPLETED"}b!=="PRE_DRAG"&&(U(),Ct()),r.dispatch(MI(G.liftActionArgs)),b="DRAGGING";function q(pe,Ue={shouldBlockNextClick:!1}){if(G.cleanup(),Ue.shouldBlockNextClick){const be=Fo(window,[{eventName:"click",fn:BM,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(be)}U(),r.dispatch(D3({reason:pe}))}return{isActive:()=>nd({expected:"DRAGGING",phase:b,isLockActive:w,shouldWarn:!1}),shouldRespectForcePress:v,drop:pe=>q("DROP",pe),cancel:pe=>q("CANCEL",pe),...G.actions}}function M(G){const U=iu(pe=>{I(()=>N3({client:pe}))});return{...N({liftActionArgs:{id:i,clientSelection:G,movementMode:"FLUID"},cleanup:()=>U.cancel(),actions:{move:U}}),move:U}}function D(){const G={moveUp:()=>I(FI),moveRight:()=>I($I),moveDown:()=>I(UI),moveLeft:()=>I(zI)};return N({liftActionArgs:{id:i,clientSelection:kM(g),movementMode:"SNAP"},cleanup:Al,actions:G})}function F(){nd({expected:"PRE_DRAG",phase:b,isLockActive:w,shouldWarn:!0})&&e.release()}return{isActive:()=>nd({expected:"PRE_DRAG",phase:b,isLockActive:w,shouldWarn:!1}),shouldRespectForcePress:v,fluidLift:M,snapLift:D,abort:F}}const PM=[gM,vM,SM];function OM({contextId:e,store:t,registry:r,customSensors:s,enableDefaultSensors:i}){const c=[...i?PM:[],...s||[]],u=A.useState(()=>rM())[0],f=or(function(N,M){du(N)&&!du(M)&&u.tryAbandon()},[u]);yo(function(){let N=t.getState();return t.subscribe(()=>{const D=t.getState();f(N,D),N=D})},[u,t,f]),yo(()=>u.tryAbandon,[u.tryAbandon]);const p=or(I=>e6({lockAPI:u,registry:r,store:t,draggableId:I}),[u,r,t]),g=or((I,N,M)=>jM({lockAPI:u,registry:r,contextId:e,store:t,draggableId:I,forceSensorStop:N||null,sourceEvent:M&&M.sourceEvent?M.sourceEvent:null}),[e,u,r,t]),x=or(I=>DM(e,I),[e]),b=or(I=>{const N=r.draggable.findById(I);return N?N.options:null},[r.draggable]),v=or(function(){u.isClaimed()&&(u.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(e1()))},[u,t]),w=or(()=>u.isClaimed(),[u]),k=nn(()=>({canGetLock:p,tryGetLock:g,findClosestDraggableId:x,findOptionsForDraggable:b,tryReleaseLock:v,isLockClaimed:w}),[p,g,x,b,v,w]);for(let I=0;I<c.length;I++)c[I](k)}const FM=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}),UM=e=>({...uu,...e.autoScrollerOptions,durationDampening:{...uu.durationDampening,...e.autoScrollerOptions}});function Ec(e){return e.current||Ct(),e.current}function $M(e){const{contextId:t,setCallbacks:r,sensors:s,nonce:i,dragHandleUsageInstructions:c}=e,u=A.useRef(null),f=q3(e),p=or(()=>FM(f.current),[f]),g=or(()=>UM(f.current),[f]),x=XE(t),b=tM({contextId:t,text:c}),v=WE(t,i),w=or(be=>{Ec(u).dispatch(be)},[]),k=nn(()=>Vg({publishWhileDragging:NI,updateDroppableScroll:QI,updateDroppableIsEnabled:BI,updateDroppableIsCombineEnabled:jI,collectionStarting:DI},w),[w]),I=ZE(),N=nn(()=>TE(I,k),[I,k]),M=nn(()=>FE({scrollWindow:CE,scrollDroppable:N.scrollDroppable,getAutoScrollerOptions:g,...Vg({move:N3},w)}),[N.scrollDroppable,w,g]),D=VE(t),F=nn(()=>yE({announce:x,autoScroller:M,dimensionMarshal:N,focusMarshal:D,getResponders:p,styleMarshal:v}),[x,M,N,D,p,v]);u.current=F;const Z=or(()=>{const be=Ec(u);be.getState().phase!=="IDLE"&&be.dispatch(e1())},[]),G=or(()=>{const be=Ec(u).getState();return be.phase==="DROP_ANIMATING"?!0:be.phase==="IDLE"?!1:be.isDragging},[]),U=nn(()=>({isDragging:G,tryAbort:Z}),[G,Z]);r(U);const q=or(be=>$3(Ec(u).getState(),be),[]),pe=or(()=>Ul(Ec(u).getState()),[]),Ue=nn(()=>({marshal:N,focus:D,contextId:t,canLift:q,isMovementAllowed:pe,dragHandleUsageInstructionsId:b,registry:I}),[t,N,b,D,q,pe,I]);return OM({contextId:t,store:F,registry:I,customSensors:s||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),A.useEffect(()=>Z,[Z]),S.createElement(ah.Provider,{value:Ue},S.createElement(fk,{context:a1,store:F},e.children))}function zM(){return S.useId()}function $d(e){const t=zM(),r=e.dragHandleUsageInstructions||Ad.dragHandleUsageInstructions;return S.createElement(vk,null,s=>S.createElement($M,{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 A2={dragging:5e3,dropAnimating:4500},HM=(e,t)=>t?qc.drop(t.duration):e?qc.snap:qc.fluid,WM=(e,t)=>{if(e)return t?cu.opacity.drop:cu.opacity.combining},GM=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function VM(e){const r=e.dimension.client,{offset:s,combineWith:i,dropping:c}=e,u=!!i,f=GM(e),p=!!c,g=p?dp.drop(s,u):dp.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:HM(f,c),transform:g,opacity:WM(u,p),zIndex:p?A2.dropAnimating:A2.dragging,pointerEvents:"none"}}function qM(e){return{transform:dp.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function ZM(e){return e.type==="DRAGGING"?VM(e):qM(e)}function YM(e,t,r=li){const s=window.getComputedStyle(t),i=t.getBoundingClientRect(),c=a3(i,s),u=Bd(c,r),f={client:c,tagName:t.tagName.toLowerCase(),display:s.display},p={x:c.marginBox.width,y:c.marginBox.height};return{descriptor:e,placeholder:f,displaceBy:p,client:c,page:u}}function KM(e){const t=l1("draggable"),{descriptor:r,registry:s,getDraggableRef:i,canDragInteractiveElements:c,shouldRespectForcePress:u,isEnabled:f}=e,p=nn(()=>({canDragInteractiveElements:c,shouldRespectForcePress:u,isEnabled:f}),[c,f,u]),g=or(w=>{const k=i();return k||Ct(),YM(r,k,w)},[r,i]),x=nn(()=>({uniqueId:t,descriptor:r,options:p,getDimension:g}),[r,g,p,t]),b=A.useRef(x),v=A.useRef(!0);yo(()=>(s.draggable.register(b.current),()=>s.draggable.unregister(b.current)),[s.draggable]),yo(()=>{if(v.current){v.current=!1;return}const w=b.current;b.current=x,s.draggable.update(x,w)},[x,s.draggable])}var u1=S.createContext(null);function zd(e){const t=A.useContext(e);return t||Ct(),t}function XM(e){e.preventDefault()}const JM=e=>{const t=A.useRef(null),r=or((U=null)=>{t.current=U},[]),s=or(()=>t.current,[]),{contextId:i,dragHandleUsageInstructionsId:c,registry:u}=zd(ah),{type:f,droppableId:p}=zd(u1),g=nn(()=>({id:e.draggableId,index:e.index,type:f,droppableId:p}),[e.draggableId,e.index,f,p]),{children:x,draggableId:b,isEnabled:v,shouldRespectForcePress:w,canDragInteractiveElements:k,isClone:I,mapped:N,dropAnimationFinished:M}=e;if(!I){const U=nn(()=>({descriptor:g,registry:u,getDraggableRef:s,canDragInteractiveElements:k,shouldRespectForcePress:w,isEnabled:v}),[g,u,s,k,w,v]);KM(U)}const D=nn(()=>v?{tabIndex:0,role:"button","aria-describedby":c,"data-rfd-drag-handle-draggable-id":b,"data-rfd-drag-handle-context-id":i,draggable:!1,onDragStart:XM}:null,[i,c,b,v]),F=or(U=>{N.type==="DRAGGING"&&N.dropping&&U.propertyName==="transform"&&qa.flushSync(M)},[M,N]),Z=nn(()=>{const U=ZM(N),q=N.type==="DRAGGING"&&N.dropping?F:void 0;return{innerRef:r,draggableProps:{"data-rfd-draggable-context-id":i,"data-rfd-draggable-id":b,style:U,onTransitionEnd:q},dragHandleProps:D}},[i,D,b,N,F,r]),G=nn(()=>({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,x(Z,N.snapshot,G))};var t6=(e,t)=>e===t,r6=e=>{const{combine:t,destination:r}=e;return r?r.droppableId:t?t.droppableId:null};const eR=e=>e.combine?e.combine.draggableId:null,tR=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function rR(){const e=ai((i,c)=>({x:i,y:c})),t=ai((i,c,u=null,f=null,p=null)=>({isDragging:!0,isClone:c,isDropAnimating:!!p,dropAnimation:p,mode:i,draggingOver:u,combineWith:f,combineTargetFor:null})),r=ai((i,c,u,f,p=null,g=null,x=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:p,combineWith:g,mode:c,offset:i,dimension:u,forceShouldAnimate:x,snapshot:t(c,f,p,g,null)}}));return(i,c)=>{if(du(i)){if(i.critical.draggable.id!==c.draggableId)return null;const u=i.current.client.offset,f=i.dimensions.draggables[c.draggableId],p=bo(i.impact),g=tR(i.impact),x=i.forceShouldAnimate;return r(e(u.x,u.y),i.movementMode,f,c.isClone,p,g,x)}if(i.phase==="DROP_ANIMATING"){const u=i.completed;if(u.result.draggableId!==c.draggableId)return null;const f=c.isClone,p=i.dimensions.draggables[c.draggableId],g=u.result,x=g.mode,b=r6(g),v=eR(g),k={duration:i.dropDuration,curve:r1.drop,moveTo:i.newHomeClientOffset,opacity:v?cu.opacity.drop:null,scale:v?cu.scale.drop:null};return{mapped:{type:"DRAGGING",offset:i.newHomeClientOffset,dimension:p,dropping:k,draggingOver:b,combineWith:v,mode:x,forceShouldAnimate:null,snapshot:t(x,f,b,v,k)}}}return null}}function n6(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const nR={mapped:{type:"SECONDARY",offset:li,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:n6(null)}};function sR(){const e=ai((u,f)=>({x:u,y:f})),t=ai(n6),r=ai((u,f=null,p)=>({mapped:{type:"SECONDARY",offset:u,combineTargetFor:f,shouldAnimateDisplacement:p,snapshot:t(f)}})),s=u=>u?r(li,u,!0):null,i=(u,f,p,g)=>{const x=p.displaced.visible[u],b=!!(g.inVirtualList&&g.effected[u]),v=nh(p),w=v&&v.draggableId===u?f:null;if(!x){if(!b)return s(w);if(p.displaced.invisible[u])return null;const N=Y0(g.displacedBy.point),M=e(N.x,N.y);return r(M,w,!0)}if(b)return s(w);const k=p.displacedBy.point,I=e(k.x,k.y);return r(I,w,x.shouldAnimate)};return(u,f)=>{if(du(u))return u.critical.draggable.id===f.draggableId?null:i(f.draggableId,u.critical.draggable.id,u.impact,u.afterCritical);if(u.phase==="DROP_ANIMATING"){const p=u.completed;return p.result.draggableId===f.draggableId?null:i(f.draggableId,p.result.draggableId,p.impact,p.afterCritical)}return null}}const iR=()=>{const e=rR(),t=sR();return(s,i)=>e(s,i)||t(s,i)||nR},oR={dropAnimationFinished:Q3},aR=o3(iR,oR,null,{context:a1,areStatePropsEqual:t6})(JM);function s6(e){return zd(u1).isUsingCloneFor===e.draggableId&&!e.isClone?null:S.createElement(aR,e)}function za(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,r=!!e.disableInteractiveElementBlocking,s=!!e.shouldRespectForcePress;return S.createElement(s6,jd({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:r,shouldRespectForcePress:s}))}const i6=e=>t=>e===t,lR=i6("scroll"),cR=i6("auto"),T2=(e,t)=>t(e.overflowX)||t(e.overflowY),uR=e=>{const t=window.getComputedStyle(e),r={overflowX:t.overflowX,overflowY:t.overflowY};return T2(r,lR)||T2(r,cR)},dR=()=>!1,o6=e=>e==null?null:e===document.body?dR()?e:null:e===document.documentElement?null:uR(e)?e:o6(e.parentElement);var pp=e=>({x:e.scrollLeft,y:e.scrollTop});const a6=e=>e?window.getComputedStyle(e).position==="fixed"?!0:a6(e.parentElement):!1;var hR=e=>{const t=o6(e),r=a6(e);return{closestScrollable:t,isFixedOnPage:r}},fR=({descriptor:e,isEnabled:t,isCombineEnabled:r,isFixedOnPage:s,direction:i,client:c,page:u,closest:f})=>{const p=(()=>{if(!f)return null;const{scrollSize:v,client:w}=f,k=O3({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:k,diff:{value:li,displacement:li}}}})(),g=i==="vertical"?Zp:b3,x=$0({page:u,withPlaceholder:null,axis:g,frame:p});return{descriptor:e,isCombineEnabled:r,isFixedOnPage:s,axis:g,isEnabled:t,client:c,page:u,frame:p,subject:x}};const pR=(e,t)=>{const r=l3(e);if(!t||e!==t)return r;const s=r.paddingBox.top-t.scrollTop,i=r.paddingBox.left-t.scrollLeft,c=s+t.scrollHeight,u=i+t.scrollWidth,p=Wp({top:s,right:u,bottom:c,left:i},r.border);return Gp({borderBox:p,margin:r.margin,border:r.border,padding:r.padding})};var mR=({ref:e,descriptor:t,env:r,windowScroll:s,direction:i,isDropDisabled:c,isCombineEnabled:u,shouldClipSubject:f})=>{const p=r.closestScrollable,g=pR(e,p),x=Bd(g,s),b=(()=>{if(!p)return null;const w=l3(p),k={scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth};return{client:w,page:Bd(w,s),scroll:pp(p),scrollSize:k,shouldClipSubject:f}})();return fR({descriptor:t,isEnabled:!c,isCombineEnabled:u,isFixedOnPage:r.isFixedOnPage,direction:i,client:g,page:x,closest:b})};const gR={passive:!1},xR={passive:!0};var C2=e=>e.shouldPublishImmediately?gR:xR;const sd=e=>e&&e.env.closestScrollable||null;function bR(e){const t=A.useRef(null),r=zd(ah),s=l1("droppable"),{registry:i,marshal:c}=r,u=q3(e),f=nn(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),p=A.useRef(f),g=nn(()=>ai((Z,G)=>{t.current||Ct();const U={x:Z,y:G};c.updateDroppableScroll(f.id,U)}),[f.id,c]),x=or(()=>{const Z=t.current;return!Z||!Z.env.closestScrollable?li:pp(Z.env.closestScrollable)},[]),b=or(()=>{const Z=x();g(Z.x,Z.y)},[x,g]),v=nn(()=>iu(b),[b]),w=or(()=>{const Z=t.current,G=sd(Z);if(Z&&G||Ct(),Z.scrollOptions.shouldPublishImmediately){b();return}v()},[v,b]),k=or((Z,G)=>{t.current&&Ct();const U=u.current,q=U.getDroppableRef();q||Ct();const pe=hR(q),Ue={ref:q,descriptor:f,env:pe,scrollOptions:G};t.current=Ue;const be=mR({ref:q,descriptor:f,env:pe,windowScroll:Z,direction:U.direction,isDropDisabled:U.isDropDisabled,isCombineEnabled:U.isCombineEnabled,shouldClipSubject:!U.ignoreContainerClipping}),Ae=pe.closestScrollable;return Ae&&(Ae.setAttribute(b2.contextId,r.contextId),Ae.addEventListener("scroll",w,C2(Ue.scrollOptions))),be},[r.contextId,f,w,u]),I=or(()=>{const Z=t.current,G=sd(Z);return Z&&G||Ct(),pp(G)},[]),N=or(()=>{const Z=t.current;Z||Ct();const G=sd(Z);t.current=null,G&&(v.cancel(),G.removeAttribute(b2.contextId),G.removeEventListener("scroll",w,C2(Z.scrollOptions)))},[w,v]),M=or(Z=>{const G=t.current;G||Ct();const U=sd(G);U||Ct(),U.scrollTop+=Z.y,U.scrollLeft+=Z.x},[]),D=nn(()=>({getDimensionAndWatchScroll:k,getScrollWhileDragging:I,dragStopped:N,scroll:M}),[N,k,I,M]),F=nn(()=>({uniqueId:s,descriptor:f,callbacks:D}),[D,f,s]);yo(()=>(p.current=F.descriptor,i.droppable.register(F),()=>{t.current&&N(),i.droppable.unregister(F)}),[D,f,N,F,c,i.droppable]),yo(()=>{t.current&&c.updateDroppableIsEnabled(p.current.id,!e.isDropDisabled)},[e.isDropDisabled,c]),yo(()=>{t.current&&c.updateDroppableIsCombineEnabled(p.current.id,e.isCombineEnabled)},[e.isCombineEnabled,c])}function Af(){}const S2={width:0,height:0,margin:Lk},yR=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>e||r==="close"?S2:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},vR=({isAnimatingOpenOnMount:e,placeholder:t,animate:r})=>{const s=yR({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"?qc.placeholder:null}},wR=e=>{const t=A.useRef(null),r=or(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:s,onTransitionEnd:i,onClose:c,contextId:u}=e,[f,p]=A.useState(e.animate==="open");A.useEffect(()=>f?s!=="open"?(r(),p(!1),Af):t.current?Af:(t.current=setTimeout(()=>{t.current=null,p(!1)}),r):Af,[s,f,r]);const g=or(b=>{b.propertyName==="height"&&(i(),s==="close"&&c())},[s,c,i]),x=vR({isAnimatingOpenOnMount:f,animate:e.animate,placeholder:e.placeholder});return S.createElement(e.placeholder.tagName,{style:x,"data-rfd-placeholder-context-id":u,onTransitionEnd:g,ref:e.innerRef})};var AR=S.memo(wR);class TR 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 CR=e=>{const t=A.useContext(ah);t||Ct();const{contextId:r,isMovementAllowed:s}=t,i=A.useRef(null),c=A.useRef(null),{children:u,droppableId:f,type:p,mode:g,direction:x,ignoreContainerClipping:b,isDropDisabled:v,isCombineEnabled:w,snapshot:k,useClone:I,updateViewportMaxScroll:N,getContainerForClone:M}=e,D=or(()=>i.current,[]),F=or((Ae=null)=>{i.current=Ae},[]);or(()=>c.current,[]);const Z=or((Ae=null)=>{c.current=Ae},[]),G=or(()=>{s()&&N({maxScroll:U3()})},[s,N]);bR({droppableId:f,type:p,mode:g,direction:x,isDropDisabled:v,isCombineEnabled:w,ignoreContainerClipping:b,getDroppableRef:D});const U=nn(()=>S.createElement(TR,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:Ae,data:Ke,animate:qe})=>S.createElement(AR,{placeholder:Ke,onClose:Ae,innerRef:Z,animate:qe,contextId:r,onTransitionEnd:G})),[r,G,e.placeholder,e.shouldAnimatePlaceholder,Z]),q=nn(()=>({innerRef:F,placeholder:U,droppableProps:{"data-rfd-droppable-id":f,"data-rfd-droppable-context-id":r}}),[r,f,U,F]),pe=I?I.dragging.draggableId:null,Ue=nn(()=>({droppableId:f,type:p,isUsingCloneFor:pe}),[f,pe,p]);function be(){if(!I)return null;const{dragging:Ae,render:Ke}=I,qe=S.createElement(s6,{draggableId:Ae.draggableId,index:Ae.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(ie,Se)=>Ke(ie,Se,Ae));return j7.createPortal(qe,M())}return S.createElement(u1.Provider,{value:Ue},u(q,k),be())};function SR(){return document.body||Ct(),document.body}const _2={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:SR},l6=e=>{let t={...e},r;for(r in _2)e[r]===void 0&&(t={...t,[r]:_2[r]});return t},Tf=(e,t)=>e===t.droppable.type,L2=(e,t)=>t.draggables[e.draggable.id],_R=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},r=ai(c=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}})),s=ai((c,u,f,p,g,x)=>{const b=g.descriptor.id;if(g.descriptor.droppableId===c){const k=x?{render:x,dragging:r(g.descriptor)}:null,I={isDraggingOver:f,draggingOverWith:f?b:null,draggingFromThisWith:b,isUsingPlaceholder:!0};return{placeholder:g.placeholder,shouldAnimatePlaceholder:!1,snapshot:I,useClone:k}}if(!u)return t;if(!p)return e;const w={isDraggingOver:f,draggingOverWith:b,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:g.placeholder,shouldAnimatePlaceholder:!0,snapshot:w,useClone:null}});return(c,u)=>{const f=l6(u),p=f.droppableId,g=f.type,x=!f.isDropDisabled,b=f.renderClone;if(du(c)){const v=c.critical;if(!Tf(g,v))return t;const w=L2(v,c.dimensions),k=bo(c.impact)===p;return s(p,x,k,k,w,b)}if(c.phase==="DROP_ANIMATING"){const v=c.completed;if(!Tf(g,v.critical))return t;const w=L2(v.critical,c.dimensions);return s(p,x,r6(v.result)===p,bo(v.impact)===p,w,b)}if(c.phase==="IDLE"&&c.completed&&!c.shouldFlush){const v=c.completed;if(!Tf(g,v.critical))return t;const w=bo(v.impact)===p,k=!!(v.impact.at&&v.impact.at.type==="COMBINE"),I=v.critical.droppable.id===p;return w?k?e:t:I?e:t}return t}},LR={updateViewportMaxScroll:OI},Ha=o3(_R,LR,(e,t,r)=>({...l6(r),...e,...t}),{context:a1,areStatePropsEqual:t6})(CR);function kR(){if(typeof window>"u")return Q0(void 0);try{const e=window.localStorage.getItem(ep);return Q0(e?JSON.parse(e):void 0)}catch{return Q0(void 0)}}function Cf(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(ep),r=t?JSON.parse(t):{},s=Q0({...r,...e});window.localStorage.setItem(ep,JSON.stringify(s))}catch{}}function IR(){const[e,t]=S.useState(kR);S.useEffect(()=>{Cf(e)},[e]);const r=S.useCallback(i=>{t(c=>{const u=Q0({...c,...i});return Cf(u),u})},[]),s=S.useCallback(()=>{const i=Q0(void 0);t(i),Cf(i)},[]);return{terminalSettings:e,updateTerminalSettings:r,resetTerminalSettings:s}}const mp="termdock-settings";function ER(e){return e==="shell"||e==="tmux"}function MR(){if(typeof window>"u")return{mode:"shell",tmuxName:"",userSelectedMode:null};try{const e=window.localStorage.getItem(mp);if(!e)return{mode:"shell",tmuxName:"",userSelectedMode:null};const t=JSON.parse(e),r=t.newSessionModeUserSelected===!0&&ER(t.newSessionMode)?t.newSessionMode:null,s=r??"shell",i=typeof t.newSessionTmuxName=="string"?t.newSessionTmuxName:"";return{mode:s,tmuxName:i,userSelectedMode:r}}catch{return{mode:"shell",tmuxName:"",userSelectedMode:null}}}function k2(e){if(!(typeof window>"u"))try{const t=window.localStorage.getItem(mp),s={...t?JSON.parse(t):{},...e};window.localStorage.setItem(mp,JSON.stringify(s))}catch{}}function RR(){const[e,t]=S.useState(MR),r=S.useCallback((i,c)=>{const u=c?.userInitiated!==!1;t(f=>({...f,mode:i,userSelectedMode:u?i:f.userSelectedMode})),u&&k2({newSessionMode:i,newSessionModeUserSelected:!0})},[]),s=S.useCallback(i=>{t(c=>({...c,tmuxName:i})),k2({newSessionTmuxName:i})},[]);return{newSessionMode:e.mode,newSessionTmuxName:e.tmuxName,userSelectedNewSessionMode:e.userSelectedMode,setNewSessionMode:r,setNewSessionTmuxName:s}}const NR=550,DR=10;function c6(){const e=A.useRef(null),t=A.useRef(null),r=A.useRef(!1),s=A.useRef(!1),i=A.useRef(null),c=A.useCallback(()=>{e.current!=null&&(window.clearTimeout(e.current),e.current=null)},[]),u=A.useCallback(()=>{c(),t.current=null},[c]);return A.useCallback(p=>({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,p())},NR))},onPointerMove:g=>{const x=t.current;if(!x||x.pointerId!==g.pointerId||r.current)return;const b=g.clientX-x.startX,v=g.clientY-x.startY;Math.hypot(b,v)>DR&&u()},onPointerUp:g=>{r.current&&(g.preventDefault(),r.current=!1,s.current=!0,i.current!=null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{s.current=!1,i.current=null},600)),u()},onPointerCancel:u,onPointerLeave:g=>{t.current?.pointerId===g.pointerId&&!r.current&&u()},onClickCapture:g=>{s.current&&(s.current=!1,i.current!=null&&(window.clearTimeout(i.current),i.current=null),g.preventDefault(),g.stopPropagation())}}),[u])}function I2({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 QR(e,t,r){return!!(e&&t===e&&!r)}function E2({sessionIds:e}){const t=bv(i=>e.reduce((c,u)=>c+(i.unread[u]?.length??0),0)),{locale:r}=Gr();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 BR(e){if(!e.startsWith("remote:"))return null;const t=e.slice(7).split(":");if(t.length!==2)return null;try{const r=decodeURIComponent(t[0]),s=decodeURIComponent(t[1]),i=new URL(r);return!["https:","http:"].includes(i.protocol)||i.origin!==r||!s?null:{origin:r,sessionId:s}}catch{return null}}async function u6(e){const t=BR(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 jR(e,t,r){return Math.max(t,Math.min(e,r))}const ss={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 M2(e,t,r){return t===0||Math.abs(t)===1/0?Math.pow(e,r*5):e*t*r/(t+r*e)}function R2(e,t,r,s=.15){return s===0?jR(e,t,r):e<t?-M2(t-e,r-t,s)+t:e>r?+M2(e-r,r-t,s)+r:e}function PR(e,[t,r],[s,i]){const[[c,u],[f,p]]=e;return[R2(t,c,u,s),R2(r,f,p,i)]}function OR(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 FR(e){var t=OR(e,"string");return typeof t=="symbol"?t:String(t)}function Qs(e,t,r){return t=FR(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function N2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function ds(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?N2(Object(r),!0).forEach(function(s){Qs(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N2(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}const d6={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 D2(e){return e?e[0].toUpperCase()+e.slice(1):""}const UR=["enter","leave"];function $R(e=!1,t){return e&&!UR.includes(t)}function zR(e,t="",r=!1){const s=d6[e],i=s&&s[t]||t;return"on"+D2(e)+D2(i)+($R(r,i)?"Capture":"")}const HR=["gotpointercapture","lostpointercapture"];function WR(e){let t=e.substring(2).toLowerCase();const r=!!~t.indexOf("passive");r&&(t=t.replace("passive",""));const s=HR.includes(t)?"capturecapture":"capture",i=!!~t.indexOf(s);return i&&(t=t.replace("capture","")),{device:t,capture:i,passive:r}}function GR(e,t=""){const r=d6[e],s=r&&r[t]||t;return e+s}function ch(e){return"touches"in e}function h6(e){return ch(e)?"touch":"pointerType"in e?e.pointerType:"mouse"}function VR(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 qR(e){return e.type==="touchend"||e.type==="touchcancel"?e.changedTouches:e.targetTouches}function f6(e){return ch(e)?qR(e)[0]:e}function gp(e,t){try{const r=t.clientX-e.clientX,s=t.clientY-e.clientY,i=(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:[i,c]}}catch{}return null}function ZR(e){return VR(e).map(t=>t.identifier)}function Q2(e,t){const[r,s]=Array.from(e.touches).filter(i=>t.includes(i.identifier));return gp(r,s)}function Sf(e){const t=f6(e);return ch(e)?t.identifier:t.pointerId}function W0(e){const t=f6(e);return[t.clientX,t.clientY]}const B2=40,j2=800;function p6(e){let{deltaX:t,deltaY:r,deltaMode:s}=e;return s===1?(t*=B2,r*=B2):s===2&&(t*=j2,r*=j2),[t,r]}function YR(e){var t,r;const{scrollX:s,scrollY:i,scrollLeft:c,scrollTop:u}=e.currentTarget;return[(t=s??c)!==null&&t!==void 0?t:0,(r=i??u)!==null&&r!==void 0?r:0]}function KR(e){const t={};if("buttons"in e&&(t.buttons=e.buttons),"shiftKey"in e){const{shiftKey:r,altKey:s,metaKey:i,ctrlKey:c}=e;Object.assign(t,{shiftKey:r,altKey:s,metaKey:i,ctrlKey:c})}return t}function Hd(e,...t){return typeof e=="function"?e(...t):e}function XR(){}function JR(...e){return e.length===0?XR:e.length===1?e[0]:function(){let t;for(const r of e)t=r.apply(this,arguments)||t;return t}}function P2(e,t){return Object.assign({},t,e||{})}const eN=32;class m6{constructor(t,r,s){this.ctrl=t,this.args=r,this.key=s,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(t){this.ctrl.state[this.key]=t}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:t,shared:r,ingKey:s,args:i}=this;r[s]=t._active=t.active=t._blocked=t._force=!1,t._step=[!1,!1],t.intentional=!1,t._movement=[0,0],t._distance=[0,0],t._direction=[0,0],t._delta=[0,0],t._bounds=[[-1/0,1/0],[-1/0,1/0]],t.args=i,t.axis=void 0,t.memo=void 0,t.elapsedTime=t.timeDelta=0,t.direction=[0,0],t.distance=[0,0],t.overflow=[0,0],t._movementBound=[!1,!1],t.velocity=[0,0],t.movement=[0,0],t.delta=[0,0],t.timeStamp=0}start(t){const r=this.state,s=this.config;r._active||(this.reset(),this.computeInitial(),r._active=!0,r.target=t.target,r.currentTarget=t.currentTarget,r.lastOffset=s.from?Hd(s.from,r):r.offset,r.offset=r.lastOffset,r.startTime=r.timeStamp=t.timeStamp)}computeValues(t){const r=this.state;r._values=t,r.values=this.config.transform(t)}computeInitial(){const t=this.state;t._initial=t._values,t.initial=t.values}compute(t){const{state:r,config:s,shared:i}=this;r.args=this.args;let c=0;if(t&&(r.event=t,s.preventDefault&&t.cancelable&&r.event.preventDefault(),r.type=t.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,KR(t)),i.down=i.pressed=i.buttons%2===1||i.touches>0,c=t.timeStamp-r.timeStamp,r.timeStamp=t.timeStamp,r.elapsedTime=r.timeStamp-r.startTime),r._active){const U=r._delta.map(Math.abs);ss.addTo(r._distance,U)}this.axisIntent&&this.axisIntent(t);const[u,f]=r._movement,[p,g]=s.threshold,{_step:x,values:b}=r;if(s.hasCustomTransform?(x[0]===!1&&(x[0]=Math.abs(u)>=p&&b[0]),x[1]===!1&&(x[1]=Math.abs(f)>=g&&b[1])):(x[0]===!1&&(x[0]=Math.abs(u)>=p&&Math.sign(u)*p),x[1]===!1&&(x[1]=Math.abs(f)>=g&&Math.sign(f)*g)),r.intentional=x[0]!==!1||x[1]!==!1,!r.intentional)return;const v=[0,0];if(s.hasCustomTransform){const[U,q]=b;v[0]=x[0]!==!1?U-x[0]:0,v[1]=x[1]!==!1?q-x[1]:0}else v[0]=x[0]!==!1?u-x[0]:0,v[1]=x[1]!==!1?f-x[1]:0;this.restrictToAxis&&!r._blocked&&this.restrictToAxis(v);const w=r.offset,k=r._active&&!r._blocked||r.active;k&&(r.first=r._active&&!r.active,r.last=!r._active&&r.active,r.active=i[this.ingKey]=r._active,t&&(r.first&&("bounds"in s&&(r._bounds=Hd(s.bounds,r)),this.setup&&this.setup()),r.movement=v,this.computeOffset()));const[I,N]=r.offset,[[M,D],[F,Z]]=r._bounds;r.overflow=[I<M?-1:I>D?1:0,N<F?-1:N>Z?1:0],r._movementBound[0]=r.overflow[0]?r._movementBound[0]===!1?r._movement[0]:r._movementBound[0]:!1,r._movementBound[1]=r.overflow[1]?r._movementBound[1]===!1?r._movement[1]:r._movementBound[1]:!1;const G=r._active?s.rubberband||[0,0]:[0,0];if(r.offset=PR(r._bounds,r.offset,G),r.delta=ss.sub(r.offset,w),this.computeMovement(),k&&(!r.last||c>eN)){r.delta=ss.sub(r.offset,w);const U=r.delta.map(Math.abs);ss.addTo(r.distance,U),r.direction=r.delta.map(Math.sign),r._direction=r._delta.map(Math.sign),!r.first&&c>0&&(r.velocity=[U[0]/c,U[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 i=this.handler(ds(ds(ds({},r),t),{},{[this.aliasKey]:t.values}));i!==void 0&&(t.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function tN([e,t],r){const s=Math.abs(e),i=Math.abs(t);if(s>i&&s>r)return"x";if(i>s&&i>r)return"y"}class xu extends m6{constructor(...t){super(...t),Qs(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=ss.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=ss.sub(this.state.offset,this.state.lastOffset)}axisIntent(t){const r=this.state,s=this.config;if(!r.axis&&t){const i=typeof s.axisThreshold=="object"?s.axisThreshold[h6(t)]:s.axisThreshold;r.axis=tN(r._movement,i)}r._blocked=(s.lockDirection||!!s.axis)&&!r.axis||!!s.axis&&s.axis!==r.axis}restrictToAxis(t){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":t[1]=0;break;case"y":t[0]=0;break}}}const rN=e=>e,O2=.15,g6={enabled(e=!0){return e},eventOptions(e,t,r){return ds(ds({},r.shared.eventOptions),e)},preventDefault(e=!1){return e},triggerAllEvents(e=!1){return e},rubberband(e=0){switch(e){case!0:return[O2,O2];case!1:return[0,0];default:return ss.toVector(e)}},from(e){if(typeof e=="function")return e;if(e!=null)return ss.toVector(e)},transform(e,t,r){const s=e||r.shared.transform;return this.hasCustomTransform=!!s,s||rN},threshold(e){return ss.toVector(e,0)}},nN=0,n0=ds(ds({},g6),{},{axis(e,t,{axis:r}){if(this.lockDirection=r==="lock",!this.lockDirection)return r},axisThreshold(e=nN){return e},bounds(e={}){if(typeof e=="function")return c=>n0.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:i=1/0}=e;return[[t,r],[s,i]]}}),F2={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 sN extends xu{constructor(...t){super(...t),Qs(this,"ingKey","dragging")}reset(){super.reset();const t=this.state;t._pointerId=void 0,t._pointerActive=!1,t._keyboardActive=!1,t._preventScroll=!1,t._delayed=!1,t.swipe=[0,0],t.tap=!1,t.canceled=!1,t.cancel=this.cancel.bind(this)}setup(){const t=this.state;if(t._bounds instanceof HTMLElement){const r=t._bounds.getBoundingClientRect(),s=t.currentTarget.getBoundingClientRect(),i={left:r.left-s.left+t.offset[0],right:r.right-s.right+t.offset[0],top:r.top-s.top+t.offset[1],bottom:r.bottom-s.bottom+t.offset[1]};t._bounds=n0.bounds(i)}}cancel(){const t=this.state;t.canceled||(t.canceled=!0,t._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(t){const r=this.config,s=this.state;if(t.buttons!=null&&(Array.isArray(r.pointerButtons)?!r.pointerButtons.includes(t.buttons):r.pointerButtons!==-1&&r.pointerButtons!==t.buttons))return;const i=this.ctrl.setEventIds(t);r.pointerCapture&&t.target.setPointerCapture(t.pointerId),!(i&&i.size>1&&s._pointerActive)&&(this.start(t),this.setupPointer(t),s._pointerId=Sf(t),s._pointerActive=!0,this.computeValues(W0(t)),this.computeInitial(),r.preventScrollAxis&&h6(t)!=="mouse"?(s._active=!1,this.setupScrollPrevention(t)):r.delay>0?(this.setupDelayTrigger(t),r.triggerAllEvents&&(this.compute(t),this.emit())):this.startPointerDrag(t))}startPointerDrag(t){const r=this.state;r._active=!0,r._preventScroll=!0,r._delayed=!1,this.compute(t),this.emit()}pointerMove(t){const r=this.state,s=this.config;if(!r._pointerActive)return;const i=Sf(t);if(r._pointerId!==void 0&&i!==r._pointerId)return;const c=W0(t);if(document.pointerLockElement===t.target?r._delta=[t.movementX,t.movementY]:(r._delta=ss.sub(c,r._values),this.computeValues(c)),ss.addTo(r._movement,r._delta),this.compute(t),r._delayed&&r.intentional){this.timeoutStore.remove("dragDelay"),r.active=!1,this.startPointerDrag(t);return}if(s.preventScrollAxis&&!r._preventScroll)if(r.axis)if(r.axis===s.preventScrollAxis||s.preventScrollAxis==="xy"){r._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(t);return}else return;this.emit()}pointerUp(t){this.ctrl.setEventIds(t);try{this.config.pointerCapture&&t.target.hasPointerCapture(t.pointerId)&&t.target.releasePointerCapture(t.pointerId)}catch{}const r=this.state,s=this.config;if(!r._active||!r._pointerActive)return;const i=Sf(t);if(r._pointerId!==void 0&&i!==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,p]=r._delta,[g,x]=r._movement,[b,v]=s.swipe.velocity,[w,k]=s.swipe.distance,I=s.swipe.duration;if(r.elapsedTime<I){const N=Math.abs(f/r.timeDelta),M=Math.abs(p/r.timeDelta);N>b&&Math.abs(g)>w&&(r.swipe[0]=Math.sign(f)),M>v&&Math.abs(x)>k&&(r.swipe[1]=Math.sign(p))}}this.emit()}pointerClick(t){!this.state.tap&&t.detail>0&&(t.preventDefault(),t.stopPropagation())}setupPointer(t){const r=this.config,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,iN(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=F2[t.key];if(r){const s=this.state,i=t.shiftKey?10:t.altKey?.1:1;this.start(t),s._delta=r(this.config.keyboardDisplacement,i),s._keyboardActive=!0,ss.addTo(s._movement,s._delta),this.compute(t),this.emit()}}keyUp(t){t.key in F2&&(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 iN(e){"persist"in e&&typeof e.persist=="function"&&e.persist()}const bu=typeof window<"u"&&window.document&&window.document.createElement;function x6(){return bu&&"ontouchstart"in window}function oN(){return x6()||bu&&window.navigator.maxTouchPoints>1}function aN(){return bu&&"onpointerdown"in window}function lN(){return bu&&"exitPointerLock"in window.document}function cN(){try{return"constructor"in GestureEvent}catch{return!1}}const Oo={isBrowser:bu,gesture:cN(),touch:x6(),touchscreen:oN(),pointer:aN(),pointerLock:lN()},uN=250,dN=180,hN=.5,fN=50,pN=250,mN=10,U2={mouse:0,touch:0,pen:8},gN=ds(ds({},n0),{},{device(e,t,{pointer:{touch:r=!1,lock:s=!1,mouse:i=!1}={}}){return this.pointerLock=s&&Oo.pointerLock,Oo.touch&&r?"touch":this.pointerLock?"mouse":Oo.pointer&&!i?"pointer":Oo.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:r}){if(this.preventScrollDelay=typeof r=="number"?r:r||r===void 0&&e?uN:void 0,!(!Oo.touchscreen||r===!1))return e||(r!==void 0?"y":void 0)},pointerCapture(e,t,{pointer:{capture:r=!0,buttons:s=1,keys:i=!0}={}}){return this.pointerButtons=s,this.keys=i,!this.pointerLock&&this.device==="pointer"&&r},threshold(e,t,{filterTaps:r=!1,tapsThreshold:s=3,axis:i=void 0}){const c=ss.toVector(e,r?s:i?1:0);return this.filterTaps=r,this.tapsThreshold=s,c},swipe({velocity:e=hN,distance:t=fN,duration:r=pN}={}){return{velocity:this.transform(ss.toVector(e)),distance:this.transform(ss.toVector(t)),duration:r}},delay(e=0){switch(e){case!0:return dN;case!1:return 0;default:return e}},axisThreshold(e){return e?ds(ds({},U2),e):U2},keyboardDisplacement(e=mN){return e}});function b6(e){const[t,r]=e.overflow,[s,i]=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&&i>0&&u<0||r>0&&i<0&&u>0)&&(e._movement[1]=e._movementBound[1])}const xN=30,bN=100;class yN extends m6{constructor(...t){super(...t),Qs(this,"ingKey","pinching"),Qs(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=ss.add(r,s):this.state.offset=[(1+r[0])*s[0],r[1]+s[1]]}computeMovement(){const{offset:t,lastOffset:r}=this.state;this.state.movement=[t[0]/r[0],t[1]-r[1]]}axisIntent(){const t=this.state,[r,s]=t._movement;if(!t.axis){const i=Math.abs(r)*xN-Math.abs(s);i<0?t.axis="angle":i>0&&(t.axis="scale")}}restrictToAxis(t){this.config.lockDirection&&(this.state.axis==="scale"?t[1]=0:this.state.axis==="angle"&&(t[0]=0))}cancel(){const t=this.state;t.canceled||setTimeout(()=>{t.canceled=!0,t._active=!1,this.compute(),this.emit()},0)}touchStart(t){this.ctrl.setEventIds(t);const r=this.state,s=this.ctrl.touchIds;if(r._active&&r._touchIds.every(c=>s.has(c))||s.size<2)return;this.start(t),r._touchIds=Array.from(s).slice(0,2);const i=Q2(t,r._touchIds);i&&this.pinchStart(t,i)}pointerStart(t){if(t.buttons!=null&&t.buttons%2!==1)return;this.ctrl.setEventIds(t),t.target.setPointerCapture(t.pointerId);const r=this.state,s=r._pointerEvents,i=this.ctrl.pointerIds;if(r._active&&Array.from(s.keys()).every(u=>i.has(u))||(s.size<2&&s.set(t.pointerId,t),r._pointerEvents.size<2))return;this.start(t);const c=gp(...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=Q2(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=gp(...Array.from(r.values()));s&&this.pinchMove(t,s)}pinchMove(t,r){const s=this.state,i=s._values[1],c=r.angle-i;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=ss.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=[-p6(t)[1]/bN*s.offset[0],0],ss.addTo(s._movement,s._delta),b6(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 vN=ds(ds({},g6),{},{device(e,t,{shared:r,pointer:{touch:s=!1}={}}){if(r.target&&!Oo.touch&&Oo.gesture)return"gesture";if(Oo.touch&&s)return"touch";if(Oo.touchscreen){if(Oo.pointer)return"pointer";if(Oo.touch)return"touch"}},bounds(e,t,{scaleBounds:r={},angleBounds:s={}}){const i=u=>{const f=P2(Hd(r,u),{min:-1/0,max:1/0});return[f.min,f.max]},c=u=>{const f=P2(Hd(s,u),{min:-1/0,max:1/0});return[f.min,f.max]};return typeof r!="function"&&typeof s!="function"?[i(),c()]:u=>[i(u),c(u)]},threshold(e,t,r){return this.lockDirection=r.axis==="lock",ss.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey(e){return e===void 0?"ctrlKey":e},pinchOnWheel(e=!0){return e}});class wN extends xu{constructor(...t){super(...t),Qs(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(W0(t)),this.compute(t),this.computeInitial(),this.emit()}moveChange(t){if(!this.state._active)return;const r=W0(t),s=this.state;s._delta=ss.sub(r,s._values),ss.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 AN=ds(ds({},n0),{},{mouseOnly:(e=!0)=>e});class TN extends xu{constructor(...t){super(...t),Qs(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=YR(t);r._delta=ss.sub(s,r._values),ss.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 CN=n0;class SN extends xu{constructor(...t){super(...t),Qs(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=p6(t),ss.addTo(r._movement,r._delta),b6(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 _N=n0;class LN extends xu{constructor(...t){super(...t),Qs(this,"ingKey","hovering")}enter(t){this.config.mouseOnly&&t.pointerType!=="mouse"||(this.start(t),this.computeValues(W0(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=W0(t);r._movement=r._delta=ss.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 kN=ds(ds({},n0),{},{mouseOnly:(e=!0)=>e}),d1=new Map,xp=new Map;function y6(e){d1.set(e.key,e.engine),xp.set(e.key,e.resolver)}const v6={key:"drag",engine:sN,resolver:gN},IN={key:"hover",engine:LN,resolver:kN},EN={key:"move",engine:wN,resolver:AN},MN={key:"pinch",engine:yN,resolver:vN},RN={key:"scroll",engine:TN,resolver:CN},NN={key:"wheel",engine:SN,resolver:_N};function DN(e,t){if(e==null)return{};var r={},s=Object.keys(e),i,c;for(c=0;c<s.length;c++)i=s[c],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}function QN(e,t){if(e==null)return{};var r=DN(e,t),s,i;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(i=0;i<c.length;i++)s=c[i],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}const BN={target(e){if(e)return()=>"current"in e?e.current:e},enabled(e=!0){return e},window(e=Oo.isBrowser?window:void 0){return e},eventOptions({passive:e=!0,capture:t=!1}={}){return{passive:e,capture:t}},transform(e){return e}},jN=["target","eventOptions","window","enabled","transform"];function Td(e={},t){const r={};for(const[s,i]of Object.entries(t))switch(typeof i){case"function":r[s]=i.call(r,e[s],s,e);break;case"object":r[s]=Td(e[s],i);break;case"boolean":i&&(r[s]=e[s]);break}return r}function PN(e,t,r={}){const s=e,{target:i,eventOptions:c,window:u,enabled:f,transform:p}=s,g=QN(s,jN);if(r.shared=Td({target:i,eventOptions:c,window:u,enabled:f,transform:p},BN),t){const x=xp.get(t);r[t]=Td(ds({shared:r.shared},g),x)}else for(const x in g){const b=xp.get(x);b&&(r[x]=Td(ds({shared:r.shared},g[x]),b))}return r}class w6{constructor(t,r){Qs(this,"_listeners",new Set),this._ctrl=t,this._gestureKey=r}add(t,r,s,i,c){const u=this._listeners,f=GR(r,s),p=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},g=ds(ds({},p),c);t.addEventListener(f,i,g);const x=()=>{t.removeEventListener(f,i,g),u.delete(x)};return u.add(x),x}clean(){this._listeners.forEach(t=>t()),this._listeners.clear()}}class ON{constructor(){Qs(this,"_timeouts",new Map)}add(t,r,s=140,...i){this.remove(t),this._timeouts.set(t,window.setTimeout(r,s,...i))}remove(t){const r=this._timeouts.get(t);r&&window.clearTimeout(r)}clean(){this._timeouts.forEach(t=>{window.clearTimeout(t)}),this._timeouts.clear()}}class FN{constructor(t){Qs(this,"gestures",new Set),Qs(this,"_targetEventStore",new w6(this)),Qs(this,"gestureEventStores",{}),Qs(this,"gestureTimeoutStores",{}),Qs(this,"handlers",{}),Qs(this,"config",{}),Qs(this,"pointerIds",new Set),Qs(this,"touchIds",new Set),Qs(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),UN(this,t)}setEventIds(t){if(ch(t))return this.touchIds=new Set(ZR(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=PN(t,r,this.config)}clean(){this._targetEventStore.clean();for(const t of this.gestures)this.gestureEventStores[t].clean(),this.gestureTimeoutStores[t].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...t){const r=this.config.shared,s={};let i;if(!(r.target&&(i=r.target(),!i))){if(r.enabled){for(const u of this.gestures){const f=this.config[u],p=$2(s,f.eventOptions,!!i);if(f.enabled){const g=d1.get(u);new g(this,t,u).bind(p)}}const c=$2(s,r.eventOptions,!!i);for(const u in this.nativeHandlers)c(u,"",f=>this.nativeHandlers[u](ds(ds({},this.state.shared),{},{event:f,args:t})),void 0,!0)}for(const c in s)s[c]=JR(...s[c]);if(!i)return s;for(const c in s){const{device:u,capture:f,passive:p}=WR(c);this._targetEventStore.add(i,u,"",s[c],{capture:f,passive:p})}}}}function C0(e,t){e.gestures.add(t),e.gestureEventStores[t]=new w6(e,t),e.gestureTimeoutStores[t]=new ON}function UN(e,t){t.drag&&C0(e,"drag"),t.wheel&&C0(e,"wheel"),t.scroll&&C0(e,"scroll"),t.move&&C0(e,"move"),t.pinch&&C0(e,"pinch"),t.hover&&C0(e,"hover")}const $2=(e,t,r)=>(s,i,c,u={},f=!1)=>{var p,g;const x=(p=u.capture)!==null&&p!==void 0?p:t.capture,b=(g=u.passive)!==null&&g!==void 0?g:t.passive;let v=f?s:zR(s,i,x);r&&b&&(v+="Passive"),e[v]=e[v]||[],e[v].push(c)},$N=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function zN(e){const t={},r={},s=new Set;for(let i in e)$N.test(i)?(s.add(RegExp.lastMatch),r[i]=e[i]):t[i]=e[i];return[r,t,s]}function S0(e,t,r,s,i,c){if(!e.has(r)||!d1.has(s))return;const u=r+"Start",f=r+"End",p=g=>{let x;return g.first&&u in t&&t[u](g),r in t&&(x=t[r](g)),g.last&&f in t&&t[f](g),x};i[s]=p,c[s]=c[s]||{}}function HN(e,t){const[r,s,i]=zN(e),c={};return S0(i,r,"onDrag","drag",c,t),S0(i,r,"onWheel","wheel",c,t),S0(i,r,"onScroll","scroll",c,t),S0(i,r,"onPinch","pinch",c,t),S0(i,r,"onMove","move",c,t),S0(i,r,"onHover","hover",c,t),{handlers:c,config:t,nativeHandlers:s}}function A6(e,t={},r,s){const i=S.useMemo(()=>new FN(e),[]);if(i.applyHandlers(e,s),i.applyConfig(t,r),S.useEffect(i.effect.bind(i)),S.useEffect(()=>i.clean.bind(i),[]),t.target===void 0)return i.bind.bind(i)}function z2(e,t){return y6(v6),A6({drag:e},t||{},"drag")}function WN(e){return e.forEach(y6),function(r,s){const{handlers:i,nativeHandlers:c,config:u}=HN(r,s||{});return A6(i,u,void 0,c)}}function OB(e,t){return WN([v6,MN,RN,NN,EN,IN])(e,t||{})}const H2={dampingRatio:.8,response:.3},GN=.998;function VN(e,t,r,s){const i=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,k=u+i*c;return{value:I=>s+(w+k*I)*Math.exp(-i*I),velocity:I=>(k-i*(w+k*I))*Math.exp(-i*I)}}if(f<1){const w=i*Math.sqrt(1-f*f),k=c,I=(u+f*i*c)/w;return{value:N=>s+Math.exp(-f*i*N)*(k*Math.cos(w*N)+I*Math.sin(w*N)),velocity:N=>Math.exp(-f*i*N)*((I*w-f*i*k)*Math.cos(w*N)-(k*w+f*i*I)*Math.sin(w*N))}}const p=i*Math.sqrt(f*f-1),g=-f*i+p,x=-f*i-p,b=(u-x*c)/(g-x),v=c-b;return{value:w=>s+b*Math.exp(g*w)+v*Math.exp(x*w),velocity:w=>b*g*Math.exp(g*w)+v*x*Math.exp(x*w)}}function qN(e,t=GN){return e/1e3*(t/(1-t))}function W2(e,t,r=.55){return e*t*r/(t+r*Math.abs(e))}function ZN(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const YN=.1,KN=5;function XN(e,t,r,s,i){const c=VN(e,t,r,s),u=1e3/60,f=240,p=[];for(let g=0;g<f;g++){const x=g*u/1e3,b=c.value(x),v=c.velocity(x);if(p.push(i?i(b):b),g>0&&Math.abs(b-s)<YN&&Math.abs(v)<KN)break}return p.push(i?i(s):s),{frames:p,durationMs:(p.length-1)*u,solver:c}}const JN='input:not([type="hidden"]), textarea, select, [contenteditable]:not([contenteditable="false"])';function eD(){if(typeof document>"u")return;const e=document.activeElement;e instanceof HTMLElement&&e.matches(JN)&&e.blur()}const tD=18,G2=8,V2={touch:G2,pen:G2},rD=500,_f=200,q2=50,nD=`[${F7}]`;function Lf(e,t,r){return Math.min(r,Math.max(t,e))}function Z2(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 Y2(e){if(!e||typeof e!="object")return!1;const t=e.target;return t instanceof Element&&!!t.closest(nD)}function Mc(...e){typeof window<"u"&&window.__SIDEBAR_DEBUG__&&console.log("[Sidebar]",...e)}const T6=S.forwardRef(function({side:t,isOpen:r,drawerWidthPx:s,onClose:i,onOpen:c,children:u,pinned:f=!1},p){const{t:g}=Gr(),x=t==="left",b=x?-s:s,v=A.useRef(null),w=A.useRef(null),k=A.useRef(r?0:b),I=A.useRef(null),N=A.useRef(null),M=A.useRef(0),D=A.useRef(null),F=A.useRef(null),Z=A.useRef(!1),G=A.useRef(null),U=A.useRef(!1),q=A.useRef([]),pe=A.useRef(null),Ue=A.useRef(k.current),be=A.useRef(r?1:0),Ae=A.useRef(r);Ae.current=r;const Ke=A.useRef(b);Ke.current=b;const qe=A.useRef(s);qe.current=s;const ie=A.useRef(x);ie.current=x;const Se=A.useRef(i);Se.current=i;const tt=A.useRef(c);tt.current=c;const Ee=A.useCallback(me=>{v.current=me,typeof p=="function"?p(me):p&&(p.current=me)},[p]),oe=A.useCallback(()=>{N.current!==null&&(window.cancelAnimationFrame(N.current),N.current=null),I.current=null},[]),de=A.useCallback(me=>{const Qe=qe.current;return ie.current?(me+Qe)/Qe:(Qe-me)/Qe},[]),Te=A.useCallback(me=>{const Qe=w.current;Qe&&(Qe.style.opacity=String(Lf(de(me),0,1)))},[de]),ee=A.useCallback(me=>{k.current=me;const Qe=v.current;Qe&&(Qe.style.transform=`translateX(${me}px)`,Te(me))},[Te]),ye=A.useCallback(me=>{I.current=me,N.current===null&&(N.current=window.requestAnimationFrame(()=>{N.current=null;const Qe=I.current;I.current=null,Qe!==null&&ee(Qe)}))},[ee]),ce=A.useCallback(()=>{N.current!==null&&(window.cancelAnimationFrame(N.current),N.current=null);const me=I.current;I.current=null,me!==null&&ee(me)},[ee]),Ye=A.useCallback(me=>{const Qe=Ke.current;return Lf(me,Math.min(0,Qe),Math.max(0,Qe))},[]),at=A.useCallback(()=>{const me=D.current;if(!me)return null;D.current=null;const Qe=(performance.now()-me.startTime)/1e3,gt={value:me.solver.value(Qe),velocity:me.solver.velocity(Qe)};return me.animations.forEach(ft=>ft.cancel()),gt},[]),_e=A.useCallback(()=>{F.current!==null&&(window.clearTimeout(F.current),F.current=null)},[]),$=A.useCallback(()=>{pe.current?.(),pe.current=null},[]),$e=A.useCallback(()=>{ce(),_e();const me=at();me&&ee(Ye(me.value));const Qe=v.current,gt=w.current;Qe?.getAnimations().forEach(ft=>ft.cancel()),Qe&&(Qe.style.transition="none",Qe.style.opacity="1"),gt?.getAnimations().forEach(ft=>ft.cancel()),gt&&(gt.style.transition="none")},[ee,_e,Ye,ce,at]),Xe=A.useCallback((me,Qe)=>{ce(),_e();const gt=v.current,ft=w.current,ct=me?0:Ke.current;ft&&(ft.style.pointerEvents=me?"auto":"none");const Kt=at(),$t=Kt?Ye(Kt.value):k.current,Qt=Qe?.velocity??Kt?.velocity??0;if(ZN())return k.current=ct,gt&&(gt.style.transition=`opacity ${_f}ms ease`,gt.style.opacity=me?"1":"0",gt.style.transform=`translateX(${ct}px)`),ft&&(ft.style.transition=`opacity ${_f}ms ease`,ft.style.opacity=me?"1":"0"),_f;gt&&(gt.style.transition="none",gt.style.opacity="1"),ft&&(ft.style.transition="none");const ut=Math.abs(Qe?.velocity??0)>rD,{frames:bt,durationMs:It,solver:St}=XN({dampingRatio:ut?H2.dampingRatio:1,response:H2.response},$t,Qt,ct,Ye);if(!gt||Math.abs($t-ct)<.5&&Math.abs(Qt)<5)return ee(ct),0;const Ht=gt.animate(bt.map(Me=>({transform:`translateX(${Me}px)`})),{duration:It,easing:"linear",fill:"forwards"}),te=[Ht];return ft&&te.push(ft.animate(bt.map(Me=>({opacity:String(Lf(de(Me),0,1))})),{duration:It,easing:"linear",fill:"forwards"})),D.current={solver:St,startTime:performance.now(),target:ct,animations:te},Mc("spring start",{startX:$t,startVelocity:Qt,targetX:ct,frames:bt.length,durationMs:It}),Ht.onfinish=()=>{const Me=D.current;!Me||!Me.animations.includes(Ht)||(D.current=null,ee(ct),Me.animations.forEach(ve=>ve.cancel()),Mc("spring finish",{targetX:ct}))},It},[ee,_e,Ye,ce,de,at]),Le=A.useCallback(me=>{ce();const Qe=me,gt=0,ft=Ke.current,ct=k.current+qN(Qe),Kt=Math.abs(ct-gt)<=Math.abs(ct-ft);Mc("decideSnap",{velocity:Qe,currentX:k.current,projected:ct,shouldOpen:Kt});const $t=Xe(Kt,{velocity:Qe});return Kt&&!Ae.current?F.current=window.setTimeout(()=>{F.current=null,tt.current?.()},$t+q2):!Kt&&Ae.current&&(F.current=window.setTimeout(()=>{F.current=null,Se.current()},$t+q2)),Kt},[Xe,ce]),K=A.useCallback(me=>{const Qe=Ke.current,gt=Math.min(0,Qe),ft=Math.max(0,Qe),ct=qe.current;return me<gt?gt-W2(gt-me,ct):me>ft?ft+W2(me-ft,ct):me},[]),Fe=A.useCallback(me=>{const Qe=q.current,gt=performance.now();Qe.push({t:gt,x:me});const ft=gt-120;for(;Qe.length>0&&Qe[0].t<ft;)Qe.shift()},[]),fe=A.useCallback(()=>{const me=q.current;if(me.length<2)return 0;const Qe=me[me.length-1];if(performance.now()-Qe.t>60)return 0;const gt=me[0],ft=(Qe.t-gt.t)/1e3;return ft<.016?0:(Qe.x-gt.x)/ft},[]);A.useEffect(()=>{_e();const me=D.current,Qe=r?0:Ke.current;me&&me.target===Qe||Xe(r)},[r,Xe,_e]),A.useEffect(()=>{$e(),ye(Ae.current?0:b)},[b,$e,ye]),A.useEffect(()=>()=>{oe(),_e(),at(),$()},[_e,oe,$,at]);const De=z2(({active:me,cancel:Qe,first:gt,last:ft,movement:[ct],event:Kt})=>{if(Mc("bindPanel",{active:me,first:gt,last:ft,mx:ct}),!Z2(Kt)){Qe();return}if(gt){if($(),Z.current=!1,G.current=null,q.current=[],Y2(Kt)){Qe();return}const $t=v.current,Qt=$t?U7(Kt.target,$t):null;if(!Qt||$7()){Qe();return}const ut=z7(Qt,ct,ie.current?-1:1);if(Mc("arbitrate",{owner:ut.kind,mx:ct}),ut.kind==="swiper"){pe.current=H7(ut.instance),Qe();return}if(ut.kind==="scroller"){const bt=W7(ut.element);if(bt)G.current=bt;else{Qe();return}}G.current||(Z.current=!0,$e(),M.current=k.current)}if(!me){G.current=null,Z.current&&(Z.current=!1,Le(fe()));return}if(G.current){G7(G.current,ct);return}if(Z.current){const $t=K(M.current+ct);Fe($t),ye($t)}},{axis:"x",axisThreshold:V2,filterTaps:!0,pointer:{touch:!0}}),lt=z2(({active:me,cancel:Qe,first:gt,movement:[ft],event:ct})=>{if(!Z2(ct)){Qe();return}if(Ae.current){Qe();return}if(gt&&(U.current=!0,q.current=[],$e(),M.current=k.current),!me){U.current&&(U.current=!1,Le(fe())&&eD());return}if(U.current){const Kt=K(M.current+ft);Fe(Kt),ye(Kt)}},{axis:"x",axisThreshold:V2,filterTaps:!0,pointer:{touch:!0}}),Tt=A.useCallback(me=>{me.preventDefault(),me.stopPropagation(),Ae.current||tt.current?.()},[]);if(f)return a.jsx("aside",{ref:Ee,"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 we=De();return a.jsxs(a.Fragment,{children:[a.jsx("div",{...lt(),style:{position:"fixed",top:"1.5rem",bottom:"10rem",...x?{left:0}:{right:0},width:tD,zIndex:"var(--z-chrome-hint)",touchAction:"none",pointerEvents:r?"none":"auto"},onClick:Tt,"aria-label":g(x?"sidebar.openLeftSidebar":"sidebar.openRightSidebar")}),a.jsx("div",{ref:w,"data-sidebar-backdrop":t,className:"fixed inset-0 z-sidebar-backdrop bg-[var(--app-backdrop)] cursor-default",style:{opacity:be.current,pointerEvents:r?"auto":"none",transition:"none",willChange:"opacity"},onClick:i,"aria-label":g("sidebar.closeSidebar")}),a.jsx("aside",{...we,onClickCapture:me=>{Y2(me)||we.onClickCapture?.(me)},ref:Ee,"data-sidebar":t,className:`fixed inset-y-0 z-sidebar-panel flex flex-col chrome-glow-panel will-change-transform ${x?"border-r border-border":"border-l border-border/15"}`,style:{...x?{left:0}:{right:0},width:s,maxWidth:x?"94vw":"95vw",transform:`translateX(${Ue.current}px)`,transition:"none",touchAction:"pan-y",pointerEvents:r?"auto":"none",paddingTop:"var(--safe-top-inset, env(safe-area-inset-top, 0px))",paddingBottom:"var(--safe-bottom-inset, env(safe-area-inset-bottom, 0px))",...x?{paddingLeft:"var(--safe-left-inset, env(safe-area-inset-left, 0px))"}:{paddingRight:"var(--safe-right-inset, env(safe-area-inset-right, 0px))"}},children:u})]})}),sD={activeKey:"root",items:[]},iD=()=>()=>{},oD=()=>sD;function aD(e){const t=La(),r=A.useSyncExternalStore(t?.subscribe??iD,t?.snapshot??oD),s=yv(),i=r.items.map(c=>c.key===s?{...c,reviewCount:e}:c).filter(c=>c.reviewCount>0);return{host:t,groups:i,currentKey:s,active:!t||r.activeKey===s,total:t?e+i.reduce((c,u)=>c+(u.key===s?0:u.reviewCount),0):e,hasOtherAttention:i.some(c=>c.key!==s)}}function lD({groups:e,currentKey:t,onClose:r}){const{t:s}=Gr(),i=A.useId(),c=A.useRef(null),u=A.useRef(null),f=A.useRef(r);f.current=r;const p=A.useRef(!0),[g,x]=A.useState(""),b=e.reduce((k,I)=>k+I.reviewCount,0);A.useEffect(()=>{const k=document.activeElement;u.current?.focus({preventScroll:!0});const I=N=>{if(N.key==="Escape"&&(N.preventDefault(),N.stopImmediatePropagation(),f.current()),N.key!=="Tab")return;const M=Array.from(c.current?.querySelectorAll("button:not(:disabled)")??[]),D=M[0],F=M[M.length-1],Z=!c.current?.contains(document.activeElement);N.shiftKey&&(document.activeElement===D||Z)?(N.preventDefault(),F?.focus()):!N.shiftKey&&(document.activeElement===F||Z)&&(N.preventDefault(),D?.focus())};return document.addEventListener("keydown",I,!0),()=>{document.removeEventListener("keydown",I,!0),p.current&&k?.isConnected&&!k.closest("[inert]")&&k.focus({preventScroll:!0})}},[]);const v=(k,I)=>{const N=La(),M=N?.snapshot().items.find(F=>F.key===k.key);if(!M?.reviewCount||I&&!M.attentionSessions?.some(F=>F.id===I)){x(s("serviceAttention.changed"));return}p.current=!1;let D=!1;I&&k.key===t?(window.dispatchEvent(new CustomEvent("termdock:focus-session",{detail:I})),D=!0):I&&M.service?.targetPeerId?D=N?.focusSession(M.service.targetPeerId,I)??!1:M.service&&(D=N?.activate(M.service,!0)??!1),D?r():(p.current=!0,x(s("serviceAttention.unavailable")))},w=k=>k.phase==="offline"?s("serviceAttention.offline"):k.phase==="login"?s("serviceAttention.login"):k.phase==="connecting"||k.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":i,"data-sidebar-gesture-ignore":!0,onKeyDown:k=>k.stopPropagation(),className:"pointer-events-auto flex max-h-full w-full max-w-md flex-col overflow-hidden rounded-2xl border border-border bg-surface text-foreground shadow-xl",children:[a.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[a.jsx(Kl,{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:i,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:b})})]}),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(ws,{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(k=>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:k.service?.label,children:k.service?.label||s("serviceAttention.currentService")}),k.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:k.reviewCount})]}),w(k)&&a.jsx("p",{className:"px-3 pb-1 text-xs text-[color:var(--warning)]",children:w(k)}),k.attentionSessions?.length?k.attentionSessions.map(I=>a.jsxs("button",{type:"button",onClick:()=>v(k,I.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:I.label,children:I.label}),a.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:I.waiting?s("serviceAttention.waiting"):s("agent.needsReview")})]}),a.jsx(hu,{size:16,className:"shrink-0 text-muted-foreground","aria-hidden":"true"})]},I.id)):a.jsx("button",{type:"button",onClick:()=>v(k),className:"min-h-11 w-full rounded-xl px-3 py-2 text-left text-sm hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",children:s("serviceAttention.viewService")})]},k.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 cD(e){const t=e.icon&&e.isPlugin?`/api/terminal/agent-plugin-icon/${encodeURIComponent(e.slug)}${e.iconVersion?`?v=${Math.floor(e.iconVersion)}`:""}`:void 0,[r,s]=A.useState();if(A.useEffect(()=>{if(s(void 0),!t)return;const i=new AbortController;let c;return fetch(t,{signal:i.signal}).then(async u=>{if(!u.ok)throw new Error(`Icon request failed: ${u.status}`);const f=await u.blob();i.signal.aborted||(c=URL.createObjectURL(f),s({endpoint:t,src:c}))}).catch(()=>{}),()=>{i.abort(),c&&URL.revokeObjectURL(c)}},[t]),!!e.icon)return e.isPlugin?r?.endpoint===t?r?.src:void 0:`/icons/agents/${e.icon}.svg`}function uD(e){return e.agentStatus==="waiting"||e.agentNeedsReview===!0}function dD(e,t,r,s="next"){if(e.length===0)return null;const i=t?e.findIndex(c=>c.sessionId===t):-1;for(let c=1;c<=e.length;c+=1){const u=s==="next"?c:-c,f=(i+u+e.length)%e.length,p=e[f];if(p&&r(p))return p.sessionId}return null}function hD(e,t,r="next"){return dD(e,t,uD,r)}const xo=42,Wd=20,fD=10;function bp(e,t,r){return Math.min(r,Math.max(t,e))}function uh(e){const t=Math.max(0,e.safeTop??0),r=Math.max(0,e.safeRight??0),s=Math.max(0,e.safeBottom??0),i=Math.max(0,e.safeLeft??0),c=Math.max(0,e.bottomClearance??72),u=i+Wd,f=Math.max(u,e.width-r-Wd-xo),p=Math.max(t+12,52),g=Math.max(p,e.height-s-c-xo);return{minX:u,maxX:f,minY:p,maxY:g}}function K2(e,t){const r=uh(e),s=bp(t.yRatio,0,1);return{x:t.side==="left"?r.minX:r.maxX,y:r.minY+(r.maxY-r.minY)*s}}function Zl(e,t){const r=uh(e);return{x:bp(t.x,r.minX,r.maxX),y:bp(t.y,r.minY,r.maxY)}}function X2(e,t){const r=uh(e),s=Zl(e,t),i=(r.minX+r.maxX+xo)/2,c=s.x+xo/2<i?"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 J2(e,t,r){const s=Zl(e,t),i=xo+fD,c=g=>Math.abs(g.x-r.x)<i&&Math.abs(g.y-r.y)<i;if(!c(s))return s;const u=[{...s,y:r.y-i},{...s,y:r.y+i}].map(g=>Zl(e,g)).filter(g=>!c(g)).sort((g,x)=>Math.abs(g.y-s.y)-Math.abs(x.y-s.y));if(u[0])return u[0];const f=uh(e);return[{...s,x:f.minX},{...s,x:f.maxX}].map(g=>Zl(e,g)).filter(g=>!c(g)).sort((g,x)=>Math.abs(g.x-s.x)-Math.abs(x.x-s.x))[0]??s}const kf="var(--warning)",pD="var(--success)",e5="var(--tmux)",t5="termdock:mobile-attention-position:v1",r5="termdock:running-session-position:v1",mD={side:"right",yRatio:.68},gD={side:"right",yRatio:.54};function n5(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 xD(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function id(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 bD(e,t,r={}){if(typeof window>"u")return{width:390,height:664};const s=window.visualViewport,i=s?.width??window.innerWidth,c=s?.height??window.innerHeight,u=t?.getBoundingClientRect(),f=!!(u&&u.width>0&&u.height>0);return{width:i,height:c,safeTop:Math.max(id("--safe-top-inset"),(f?Math.max(0,u.top):0)+Math.max(0,r.top??0)),safeRight:Math.max(id("--safe-right-inset"),(f?Math.max(0,i-u.right):0)+Math.max(0,r.right??0)),safeBottom:Math.max(id("--safe-bottom-inset"),(f?Math.max(0,c-u.bottom):0)+Math.max(0,r.bottom??0)),safeLeft:Math.max(id("--safe-left-inset"),(f?Math.max(0,u.left):0)+Math.max(0,r.left??0)),bottomClearance:e?Wd:72}}function C6(){const e=Qr.getState(),t=Array.from(e.sessions.values()),r=hD(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 s5(e){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e}))}function S6(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 yD({indicator:e,tone:t,size:r}){const s=S6(t);switch(e){case"spinner":return a.jsx(Sn,{size:r,className:"shrink-0 animate-spin",style:{color:s}});case"question":return a.jsx(Sd,{size:r,className:"shrink-0 animate-bounce-y",style:{color:s}});case"badge":return a.jsx(Kl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:s}});case"terminal":return a.jsx($o,{size:r,className:"shrink-0",style:{color:s}});case"pulse":return a.jsx(b8,{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 Yl({agent:e,size:t=12}){const r=t-4,s=cD(e);return s?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`}})}):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(Yd,{size:r,className:"text-white"})})}function vD({sessionMode:e,state:t,size:r=11}){const s=t?.agent?a.jsx(Yl,{agent:t.agent,size:r+1}):e==="tmux"?a.jsx(F0,{size:r,className:"shrink-0"}):a.jsx($o,{size:r,className:"shrink-0"});return t?.agentStatusDetail&&t.agentIndicator&&!(t.agentStatus==="done"&&t.agentNeedsReview)?a.jsx("span",{title:t.agentMessage??t.agentStatusDetail.label,"aria-label":t.agentStatusDetail.label,children:a.jsx(yD,{indicator:t.agentIndicator,tone:t.agentStatusDetail.tone,size:r})}):t?.agentStatus==="working"?a.jsx("span",{title:t.agentMessage??t.agent?.displayName,children:a.jsx(Sn,{size:r,className:"shrink-0 animate-spin",style:{color:pD}})}):t?.agentStatus==="waiting"?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(Sd,{size:r,className:"shrink-0 animate-bounce-y",style:{color:kf}})}):t?.agentStatus==="done"&&t.agentNeedsReview?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(Kl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:kf}})}):t?.agentNeedsReview?a.jsx("span",{title:t.agentMessage??void 0,children:a.jsx(Kl,{size:r+1,className:"shrink-0 animate-pulse",style:{color:kf}})}):t?.inCopyMode?e==="tmux"?a.jsx(F0,{size:r,className:"shrink-0 animate-pulse",style:{color:e5}}):a.jsx($o,{size:r,className:"shrink-0 animate-pulse",style:{color:e5}}):s}function wD({status:e,detail:t,needsReview:r,inCopyMode:s}){const{t:i}=Gr();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:S6(t.tone)},title:t.label}):e==="working"?a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--success)] ring-2 ring-surface shadow-[0_0_6px_rgb(var(--success-rgb)_/_0.50)] animate-pulse",title:i("agent.aiRunning")}):e==="waiting"||r?a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--warning)] ring-2 ring-surface shadow-[0_0_0_1px_rgb(var(--warning-rgb)_/_0.24)] animate-pulse",title:i(r?"agent.finishedReview":"agent.aiWaiting")}):e==="done"&&r?a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full bg-[var(--warning)] ring-2 ring-surface shadow-[0_0_0_1px_rgb(var(--warning-rgb)_/_0.24)] animate-pulse",title:i("agent.finishedReview")}):s?a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-[2px] bg-[var(--tmux)] ring-2 ring-surface",title:i("agent.copyMode")}):null}function _6({count:e,tone:t,title:r}){const{t:s}=Gr();if(e<=0)return null;const i=t==="running"?"inline-flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.12)] px-1.5 py-0.5 text-[10px] font-medium text-[color:var(--success)]":"inline-flex min-h-6 items-center gap-1 rounded-full bg-[rgb(var(--warning-rgb)_/_0.14)] px-2 py-0.5 text-[10px] font-semibold text-[color:var(--warning)] ring-1 ring-[rgb(var(--warning-rgb)_/_0.24)] transition hover:bg-[rgb(var(--warning-rgb)_/_0.22)] active:scale-[0.97]",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:i,title:`${u} · ${s("agent.jumpToNext")}`,"aria-label":`${u}: ${e}. ${s("agent.jumpToNext")}`,onClick:C6,children:[a.jsx(Kl,{size:11,className:"shrink-0"}),a.jsx("span",{children:s("agent.needsReview")}),a.jsx("span",{className:"tabular-nums",children:e})]})}return a.jsxs("span",{className:i,title:r,children:[a.jsx("span",{className:c}),e]})}function AD({runningCount:e,reviewCount:t,className:r=""}){const s=[];return e>0&&s.push({key:"running",count:e,className:"bg-[var(--success)] text-[color:var(--success-foreground)]"}),t>0&&s.push({key:"review",count:t,className:"bg-[var(--warning)] text-[color:var(--warning-foreground)]"}),s.length===0?null:a.jsx("span",{"aria-hidden":"true",className:`pointer-events-none absolute -right-1 ${s.length>1?"top-0.5 flex flex-col gap-0.5":"-top-1"} ${r}`,children:s.map(i=>a.jsx("span",{className:`flex h-3 min-w-3 items-center justify-center rounded-full px-0.5 text-[7px] font-bold leading-3 shadow-sm ring-1 ring-background ${i.className}`,children:i.count>9?"9+":i.count},i.key))})}const TD=380,i5=10,od=10,If=52,CD=104;function SD(e,t,r){const s=Math.max(0,t.safeLeft??0),i=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=Wd,p=e.x+xo/2>=s+(i-s)/2,g=p?e.x-od-s-f:i-f-e.x-xo-od,x=Math.max(1,Math.min(Math.max(0,g),Math.max(168,r*CD))),b=p?e.x-od-x:e.x+xo+od,v=Math.min(Math.max(b,s+f),Math.max(s+f,i-f-x)),w=e.y+xo/2-If/2,k=Math.min(Math.max(w,c+f),Math.max(c+f,u-f-If));return{left:v,top:k,width:x,height:If,itemWidth:x/Math.max(1,r),side:p?"left":"right"}}function o5(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 _D(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 LD({reviewCount:e,runningSessions:t,activeSessionId:r,runningButtonEnabled:s,isDesktopLayout:i,containerElement:c,occlusionInsets:u}){const{t:f}=Gr(),p=Ft(fe=>fe.leftOpen),g=Ft(fe=>fe.rightOpen),{isOpen:x}=Gx({enabled:!i}),b=i||!p&&!g&&!x,v=aD(e),[w,k]=S.useState(!1);S.useEffect(()=>{(!v.active||!b)&&k(!1)},[v.active,b]);const I=v.total>0&&b,N=t.length>1||t.length===1&&t[0]?.id!==r,M=s&&t.length>0&&N&&b,D=Math.max(0,u?.top??0),F=Math.max(0,u?.right??0),Z=Math.max(0,u?.bottom??0),G=Math.max(0,u?.left??0),U=S.useCallback(()=>bD(i,c,{top:D,right:F,bottom:Z,left:G}),[c,i,Z,G,F,D]),q=S.useRef({attention:n5(t5,mD),running:n5(r5,gD)}),pe=S.useCallback(()=>{const fe=U(),De=K2(fe,q.current.attention),lt=K2(fe,q.current.running);return{attention:De,running:I&&M?J2(fe,lt,De):lt}},[I,U,M]),[Ue,be]=S.useState(()=>pe()),Ae=S.useRef(Ue);Ae.current=Ue;const[Ke,qe]=S.useState(null),ie=S.useRef(null),[Se,tt]=S.useState("idle"),[Ee,oe]=S.useState(null),de=S.useRef(null),Te=S.useRef({attention:!1,running:!1});S.useEffect(()=>()=>{const fe=de.current?.longPressTimer;fe!=null&&window.clearTimeout(fe)},[]),S.useEffect(()=>{if(M)return;const fe=de.current?.longPressTimer;fe!=null&&window.clearTimeout(fe),de.current=null,tt("idle"),oe(null)},[M]),S.useLayoutEffect(()=>{const fe=()=>{const lt=pe();Ae.current=lt,be(lt)};fe(),window.addEventListener("resize",fe),window.addEventListener("orientationchange",fe),window.visualViewport?.addEventListener("resize",fe);const De=typeof ResizeObserver>"u"?null:new ResizeObserver(fe);return c&&De?.observe(c),()=>{window.removeEventListener("resize",fe),window.removeEventListener("orientationchange",fe),window.visualViewport?.removeEventListener("resize",fe),De?.disconnect()}},[c,pe]);const ee=S.useCallback(fe=>fe==="attention"?M:I,[I,M]),ye=S.useCallback((fe,De)=>{if(!ee(fe))return De;const lt=fe==="attention"?"running":"attention";return J2(U(),De,Ae.current[lt])},[U,ee]),ce=S.useCallback((fe,De,lt,Tt)=>{const we=U(),me=De.moved?Zl(we,{x:De.startX+(lt-De.originX),y:De.startY+(Tt-De.originY)}):Ae.current[fe],Qe=X2(we,me),gt=ye(fe,Qe.position),ft=X2(we,gt);q.current[fe]=ft.preference,xD(fe==="attention"?t5:r5,ft.preference);const ct={...Ae.current,[fe]:ft.position};Ae.current=ct,be(ct)},[ye,U]),Ye=S.useCallback(fe=>{Te.current[fe]=!0,window.setTimeout(()=>{Te.current[fe]=!1},0)},[]),at=S.useCallback(fe=>{const De=ie.current;!De||De.kind!=="attention"||De.pointerId!==fe.pointerId||(ie.current=null,qe(null),ce("attention",De,fe.clientX,fe.clientY),De.moved&&Ye("attention"))},[ce,Ye]),_e={onPointerDown:fe=>{fe.stopPropagation(),fe.currentTarget.setPointerCapture(fe.pointerId),ie.current={kind:"attention",pointerId:fe.pointerId,originX:fe.clientX,originY:fe.clientY,startX:Ue.attention.x,startY:Ue.attention.y,moved:!1}},onPointerMove:fe=>{const De=ie.current;if(!De||De.kind!=="attention"||De.pointerId!==fe.pointerId)return;const lt=fe.clientX-De.originX,Tt=fe.clientY-De.originY;if(!De.moved&&Math.hypot(lt,Tt)<5)return;De.moved=!0,qe("attention");const we=U(),me=ye("attention",Zl(we,{x:De.startX+lt,y:De.startY+Tt})),Qe={...Ae.current,attention:me};Ae.current=Qe,be(Qe)},onPointerUp:at,onPointerCancel:at},$=c?SD(Ue.running,U(),t.length):null,$e=fe=>{fe.longPressTimer!==null&&(window.clearTimeout(fe.longPressTimer),fe.longPressTimer=null)},Xe={onPointerDown:fe=>{fe.stopPropagation(),fe.currentTarget.setPointerCapture(fe.pointerId);const De=fe.pointerId,lt={pointerId:De,originX:fe.clientX,originY:fe.clientY,startX:Ue.running.x,startY:Ue.running.y,mode:"pressing",moved:!1,selectedIndex:null,longPressTimer:null};lt.longPressTimer=window.setTimeout(()=>{const Tt=de.current;!Tt||Tt.pointerId!==De||Tt.mode!=="pressing"||(Tt.longPressTimer=null,Tt.mode="dragging",Te.current.running=!0,tt("dragging"))},TD),de.current=lt,tt("pressing"),oe(null)},onPointerMove:fe=>{const De=de.current;if(!De||De.pointerId!==fe.pointerId)return;const lt=fe.clientX-De.originX,Tt=fe.clientY-De.originY;if(De.mode==="pressing")if(Math.abs(lt)>=i5&&Math.abs(lt)>=Math.abs(Tt))$e(De),De.mode="selecting",Te.current.running=!0,tt("selecting");else if(Math.hypot(lt,Tt)>=i5){$e(De),De.mode="cancelled",Te.current.running=!0,tt("idle");return}else return;if(De.mode==="selecting"){const gt=$?o5($,fe.clientX,fe.clientY,t.length):null;De.selectedIndex=gt,oe(gt);return}if(De.mode!=="dragging"||!De.moved&&Math.hypot(lt,Tt)<5)return;De.moved=!0;const we=U(),me=ye("running",Zl(we,{x:De.startX+lt,y:De.startY+Tt})),Qe={...Ae.current,running:me};Ae.current=Qe,be(Qe)},onPointerUp:fe=>{const De=de.current;if(!De||De.pointerId!==fe.pointerId)return;$e(De);const lt=De.mode;if(lt==="selecting"){const Tt=$?o5($,fe.clientX,fe.clientY,t.length):De.selectedIndex,we=Tt===null?null:t[Tt]?.id;we&&s5(we)}else lt==="dragging"&&ce("running",De,fe.clientX,fe.clientY);de.current=null,tt("idle"),oe(null),lt!=="pressing"&&Ye("running")},onPointerCancel:fe=>{const De=de.current;!De||De.pointerId!==fe.pointerId||($e(De),de.current=null,tt("idle"),oe(null),Ye("running"))}},Le=(fe,De)=>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)] ${De==="attention"?"text-[color:var(--warning)]":"text-[color:var(--success)]"}`,children:fe>9?"9+":fe}),K=()=>{const fe=v.hasOtherAttention?f("serviceAttention.title"):f("agent.jumpToNext"),De=Ue.attention,lt=Ke==="attention";return a.jsxs("button",{type:"button","data-attention-button":!0,"data-mobile-attention-button":!0,..._e,onClick:Tt=>{Tt.stopPropagation(),!Te.current.attention&&(v.hasOtherAttention?k(!0):C6())},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 ${lt?"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:De.x,top:De.y,width:xo,height:xo,touchAction:"none"},"aria-label":`${fe}: ${v.total}`,"aria-haspopup":v.hasOtherAttention?"dialog":void 0,title:fe,children:[a.jsx(Kl,{size:17,className:"shrink-0"}),Le(v.total,"attention")]},"attention")},Fe=()=>{const fe=t.length,De=Ue.running,lt=Se==="selecting",Tt=Se==="dragging";return a.jsxs(S.Fragment,{children:[a.jsxs("button",{type:"button","data-running-session-button":!0,"data-running-session-gesture":Se,...Xe,onClick:we=>{if(we.stopPropagation(),Te.current.running)return;const me=_D(t,r);me&&s5(me)},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 ${Tt?"cursor-grabbing scale-[1.04] shadow-[0_12px_30px_var(--app-shadow-strong)]":lt?"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:De.x,top:De.y,width:xo,height:xo,touchAction:"none"},"aria-label":`${f("agent.jumpToNextRunning")}: ${fe}`,title:f("agent.runningSessionGestureHint"),children:[a.jsx(Sn,{size:18,className:"shrink-0 animate-spin"}),Le(fe,"running")]}),lt&&$&&a.jsx("div",{role:"listbox","data-running-session-rail":!0,"data-side":$.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:$.left,top:$.top,width:$.width,height:$.height},children:t.map((we,me)=>{const Qe=me===Ee,gt=we.id===r,ft=`${we.label}${we.detail?` · ${we.detail}`:""}${gt?` · ${f("agent.currentSession")}`:""}`;return a.jsxs("div",{role:"option","aria-selected":Qe,"data-running-session-option":we.id,"data-selected":Qe?"true":"false",title:ft,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 ${Qe?"scale-[1.02] bg-[var(--success)] text-[color:var(--success-foreground)]":gt?"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 ${Qe?"bg-surface/25":"bg-surface-2 text-muted-foreground"}`,children:me+1}),a.jsx("span",{className:"truncate text-[10px] font-medium",children:we.label})]},we.id)})})]},"running")};return!I&&!M&&!w||c===null||typeof document>"u"?null:a.jsxs(vv,{children:[I&&K(),M&&!w&&Fe(),w&&v.active&&b&&a.jsx(lD,{groups:v.groups,currentKey:v.currentKey,onClose:()=>k(!1)})]})}const kD=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"]),a5=120,l5=120,ID=new Set,ED=[],MD={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 h1(e,t){if(t==="directory")return null;if(Tv(e))return a.jsx(u8,{size:14});if(Cv(e))return a.jsx(B9,{size:14});const r=e.lastIndexOf(".")>=0?e.slice(e.lastIndexOf(".")):"";return kD.has(r)?a.jsx(D8,{size:14}):a.jsx(V5,{size:14})}function L6({path:e}){const r=Ft(i=>i.changedFiles.get(e))?.status;if(!r)return null;const s=MD[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 G0(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 f1(e){return G0(e)}const RD=A.memo(function({path:t}){const{t:r}=Gr(),[s,i]=A.useState("idle"),[c,u]=A.useState(null),f=A.useCallback(async p=>{if(p.stopPropagation(),s!=="pending"){i("pending"),u(null);try{await B5(t),i("idle")}catch(g){i("error"),u(g instanceof Error?g.message:r("rightSidebar.downloadFailed"))}}},[t,s,r]);return a.jsx("span",{role:"button",tabIndex:-1,onClick:p=>{f(p)},className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${G0(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(Sn,{size:12,className:"animate-spin"}):a.jsx(Kc,{size:12})})});function k6(){const{t:e}=Gr(),[t,r]=A.useState({status:"idle"}),s=A.useCallback(async i=>{r({status:"pending"});try{await B5(i),r({status:"idle"})}catch(c){r({status:"error",message:c instanceof Error?c.message:e("rightSidebar.downloadFailed")})}},[e]);return{state:t,run:s}}function yp(e){return e instanceof DOMException&&e.name==="AbortError"}function Gd(){if(typeof window>"u")return!1;const e=window.getSelection();return!!(e&&!e.isCollapsed&&e.toString().trim())}function I6(e){return e.button===2||e.ctrlKey}const ND=176,DD=160,Rc=8;function c5(e,t,r,s){const i=window.visualViewport,c=i?.offsetLeft??0,u=i?.offsetTop??0,f=c+(i?.width??window.innerWidth),p=u+(i?.height??window.innerHeight),g=c+Rc,x=u+Rc,b=Math.max(g,f-r-Rc),v=Math.max(x,p-s-Rc),w=t+s<=p-Rc?t:t-s;return{anchorX:e,anchorY:t,left:Math.min(Math.max(e,g),b),top:Math.min(Math.max(w,x),v)}}function E6(e){const[t,r]=A.useState(null),s=A.useRef(null),i=A.useCallback((c,u)=>{r(c5(c,u,ND,DD))},[]);return A.useLayoutEffect(()=>{if(!e||!t||!s.current)return;const c=s.current.getBoundingClientRect();if(c.width<=0||c.height<=0)return;const u=c5(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:i,clearPosition:()=>r(null)}}function M6(e,t){return t&&typeof document<"u"?qa.createPortal(e,document.body):e}function QD(e,t){return t?`${e.name} ${e.path}`.toLowerCase().includes(t):!0}function p1(e,t,r){if(!t||QD(e,t))return!0;const s=r.get(e.path);return s?s.some(i=>p1(i,t,r)):!1}function vp(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 wp(e,t){return!e||!t.startsWith(e)?t:t.slice(e.length).replace(/^\/+/,"")||t}const BD=A.memo(function e({node:t,depth:r,onFileSelect:s,directoriesOnly:i=!1,onPathReference:c,getReferenceText:u,onReferenceCopied:f,insertedReferenceKey:p,copiedReferenceKey:g,onDirectoryRoot:x,onSearchFromDirectory:b,onDirectoryPinToggle:v,onFilePinToggle:w,onOpenInFileBrowser:k,canOpenInFileBrowser:I,pinnedPaths:N,selectedFilePath:M,queryLower:D,onDirectoryDropFiles:F,onFileDeleteRequest:Z,deletingFilePath:G,revealedDirectoryPath:U}){const{t:q}=Gr(),pe=Ft(xe=>xe.expandedPaths.has(t.path)),Ue=Ft(xe=>xe.directoryCache.get(t.path)),be=Ft(xe=>xe.showHiddenFiles),Ae=Ft(xe=>xe.toggleExpanded),Ke=Ft(xe=>xe.setDirectoryCache),qe=Ft(xe=>xe.fileSortModes[t.path]??"name"),ie=Ft(xe=>xe.setDirectorySortMode),[Se,tt]=A.useState(!1),[Ee,oe]=A.useState(!1),{position:de,menuRef:Te,openAt:ee,clearPosition:ye}=E6(Ee),[ce,Ye]=A.useState(!1),at=A.useRef(0),_e=A.useRef(null),$=A.useRef(null),$e=t.path===M||t.path===U,Xe=t.type==="directory"&&(pe||!!D),Le=t.type==="directory",K=N.has(t.path),Fe=!Le&&!!w,fe=!!(I&&k),De=`path:${t.path}`,lt=p===De,Tt=g===De,we=u?.(t.path)??t.path,me=kp(f),{state:Qe,run:gt}=k6(),ft=G===t.path,ct=Le&&!i&&!!(x||b||v||fe),Kt=A.useMemo(()=>{if(!Ue)return;if(!D)return Ue;const xe=Ft.getState().directoryCache;return Ue.filter(gr=>(!i||gr.type==="directory")&&p1(gr,D,xe))},[Ue,i,D]),$t=A.useCallback(async()=>{if(!Ft.getState().directoryCache.has(t.path)&&!Se){const gr=`file-tree:${t.path}`;_e.current?.abort(),Of(gr);const xt=new AbortController;_e.current=xt,tt(!0);try{const hn=await _p(t.path,xt.signal,be,"expand_directory",gr,qe),Xr=vp(hn.entries);Ke(t.path,Xr)}catch(hn){yp(hn)}finally{_e.current===xt&&(_e.current=null),tt(!1)}}},[t.path,Se,Ke,be,qe]),Qt=A.useCallback(async()=>{if(t.type!=="directory"){s(t.path);return}if(i&&x){x(t.path);return}const xe=!Ft.getState().expandedPaths.has(t.path);Ae(t.path),xe&&await $t()},[i,t.path,t.type,$t,x,Ae,s]);A.useEffect(()=>{t.type==="directory"&&pe&&!Ue&&!Se&&$t()},[Ue,pe,$t,Se,t.type]);const ut=A.useCallback(xe=>{xe.stopPropagation(),c?.(t.path,De)},[c,t.path,De]),bt=A.useCallback(xe=>{xe.stopPropagation(),x?.(t.path),oe(!1)},[t.path,x]),It=A.useCallback(xe=>{xe.stopPropagation(),b?.(t.path),oe(!1)},[t.path,b]),St=A.useCallback(xe=>{xe.stopPropagation(),v?.(t.path),oe(!1)},[t.path,v]),Ht=A.useCallback(xe=>{xe.stopPropagation(),ie(t.path,qe==="modified"?"name":"modified"),oe(!1)},[t.path,ie,qe]),te=A.useCallback(xe=>{xe.stopPropagation(),w?.(t.path),oe(!1)},[t.path,w]),Me=A.useCallback(xe=>{xe.stopPropagation(),oe(!1),gt(t.path)},[t.path,gt]),ve=A.useCallback(xe=>{xe.stopPropagation(),oe(!1),Z(t)},[t,Z]),_t=A.useCallback(xe=>{xe.stopPropagation(),k?.(t.path),oe(!1)},[t.path,k]),Ve=A.useCallback(xe=>{!Le||!F||!xe.dataTransfer.types.includes("Files")||(xe.preventDefault(),xe.stopPropagation(),at.current+=1,Ye(!0))},[Le,F]),yt=A.useCallback(xe=>{!Le||!F||!xe.dataTransfer.types.includes("Files")||(xe.preventDefault(),xe.stopPropagation(),xe.dataTransfer.dropEffect="copy",Ye(!0))},[Le,F]),Gt=A.useCallback(xe=>{!Le||!F||(xe.preventDefault(),xe.stopPropagation(),at.current-=1,at.current<=0&&(at.current=0,Ye(!1)))},[Le,F]),ke=A.useCallback(xe=>{if(!Le||!F)return;xe.preventDefault(),xe.stopPropagation(),at.current=0,Ye(!1);const gr=Array.from(xe.dataTransfer.files);gr.length>0&&F(t.path,gr)},[Le,t.path,F]),Ce=A.useCallback(xe=>{xe.stopPropagation(),ye(),oe(gr=>!gr)},[ye]),nt=A.useCallback(xe=>{!ct||!I6(xe)||(xe.preventDefault(),xe.stopPropagation(),ee(xe.clientX,xe.clientY),oe(!0))},[ct,ee]);return A.useEffect(()=>{if(!Ee)return;const xe=xt=>{const hn=xt.target;hn instanceof Node&&($.current?.contains(hn)||Te.current?.contains(hn))||oe(!1)},gr=xt=>{xt.key==="Escape"&&oe(!1)};return document.addEventListener("pointerdown",xe),document.addEventListener("keydown",gr),()=>{document.removeEventListener("pointerdown",xe),document.removeEventListener("keydown",gr)}},[Ee,Te]),A.useEffect(()=>()=>{_e.current?.abort()},[]),a.jsxs("div",{style:!Xe&&!Ee?{contentVisibility:"auto",containIntrinsicSize:"auto 32px"}:void 0,children:[a.jsxs("div",{ref:$,className:"relative",children:[me.popoverNode,a.jsxs("div",{"data-file-tree-path":t.path,"data-sort-mode":qe,role:"button",tabIndex:0,onClick:()=>{Gd()||Qt()},onContextMenu:nt,onKeyDown:xe=>{xe.key!=="Enter"&&xe.key!==" "||(xe.preventDefault(),Qt())},onDragEnter:Ve,onDragOver:yt,onDragLeave:Gt,onDrop:ke,className:`group relative flex w-full cursor-pointer items-center gap-1 rounded px-2 py-1 text-[13px] transition ${ce?"scale-[1.015] bg-primary/15 text-foreground shadow-[0_0_0_1px_rgb(var(--primary-rgb)_/_0.45)]":$e?"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`}}),ce&&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:q("fileTree.dropToUploadHere")}),t.type==="directory"?a.jsxs(a.Fragment,{children:[Xe?a.jsx(Cl,{size:14,className:"shrink-0 text-muted-foreground/80"}):a.jsx(hu,{size:14,className:"shrink-0 text-muted-foreground/80"}),Xe?a.jsx(N0,{size:14,className:"shrink-0 text-[color:var(--folder)]"}):a.jsx(Jl,{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:$e?"text-primary":"text-muted-foreground/80",children:h1(t.name,t.type)})]}),a.jsxs("span",{className:`flex-1 select-text whitespace-nowrap text-left leading-snug ${$e?"font-medium":""}`,children:[t.name,qe==="modified"&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-primary",title:q("fileTree.sortedByModified"),"aria-label":q("fileTree.sortedByModified"),children:a.jsx(Yc,{size:11})}),t.isSymlink&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:q("fileTree.symbolicLink"),children:a.jsx(O0,{size:11})})]}),a.jsxs("div",{className:`sticky right-0 z-20 flex shrink-0 items-center rounded pl-1 ${$e?"bg-surface-elevated":"bg-surface group-hover:bg-surface-2"}`,onClick:xe=>xe.stopPropagation(),onKeyDown:xe=>xe.stopPropagation(),children:[Se&&a.jsx(Sn,{size:12,className:"shrink-0 animate-spin text-muted-foreground"}),a.jsx(L6,{path:t.path}),ct&&a.jsx("span",{onClick:Ce,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${G0(Ee)} ${Ee?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:q("fileTree.moreDirActions"),children:a.jsx(P0,{size:13})}),!Le&&a.jsx("span",{onClick:Ce,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${G0(Ee||Qe.status==="pending"||ft||K)} ${Ee?"bg-surface-elevated text-foreground":K?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:Qe.status==="error"?Qe.message??q("rightSidebar.downloadFailed"):q("fileTree.moreFileActions"),children:Qe.status==="pending"||ft?a.jsx(Sn,{size:13,className:"animate-spin"}):a.jsx(P0,{size:13})}),c&&a.jsx("span",{onClick:ut,...me(we,De),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${f1(lt||Tt)} ${lt||Tt?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":q(Tt?"rightSidebar.copied":lt?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:q(Tt?"rightSidebar.copied":lt?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:Tt||lt?a.jsx(Uo,{size:12}):a.jsx(O0,{size:12})}),ct&&Ee&&M6(a.jsxs("div",{ref:Te,className:`${de?"fixed z-menu-panel":"absolute right-2 top-[calc(100%+2px)] z-30"} w-44 overflow-hidden rounded-xl border border-border/15 bg-surface/98 p-1 text-[12px] shadow-xl shadow-[0_18px_48px_var(--app-shadow-soft)] backdrop-blur animate-fade-in`,style:de?{left:de.left,top:de.top}:void 0,children:[fe&&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 text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:q("fileTree.openInFileBrowserTitle"),children:[a.jsx(N0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q("fileTree.openInFileBrowser")})]}),x&&a.jsxs("button",{type:"button",onClick:bt,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:q("fileTree.openDirRootTitle"),children:[a.jsx(N0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q("fileTree.openDirRoot")})]}),b&&a.jsxs("button",{type:"button",onClick:It,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:q("fileTree.searchFromDirTitle"),children:[a.jsx(Ep,{size:13,className:"shrink-0 text-primary"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q("fileTree.searchFromDir")})]}),v&&a.jsxs("button",{type:"button",onClick:St,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] ${K?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:q(K?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[K?a.jsx(Jc,{size:13,className:"shrink-0"}):a.jsx(Xc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q(K?"fileTree.unpinDir":"fileTree.pinDir")})]}),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]",children:[qe==="modified"?a.jsx(r8,{size:13,className:"shrink-0"}):a.jsx(Yc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q(qe==="modified"?"fileTree.sortByName":"fileTree.sortByModified")})]})]}),!!de),!Le&&Ee&&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:[fe&&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 text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:q("fileTree.openInFileBrowserTitle"),children:[a.jsx(V5,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q("fileTree.openInFileBrowser")})]}),a.jsxs("button",{type:"button",onClick:Me,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:q("rightSidebar.downloadFile"),children:[a.jsx(Kc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q("rightSidebar.downloadFile")})]}),Fe&&a.jsxs("button",{type:"button",onClick:te,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium transition active:scale-[0.99] ${K?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:q(K?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[K?a.jsx(Jc,{size:13,className:"shrink-0"}):a.jsx(Xc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q(K?"fileTree.unpinFile":"fileTree.pinFile")})]}),a.jsxs("button",{type:"button",onClick:ve,disabled:ft,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:q("fileTree.deleteFile"),children:[ft?a.jsx(Sn,{size:13,className:"shrink-0 animate-spin"}):a.jsx(qi,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:q("fileTree.deleteFile")})]})]})]})]})]}),Xe&&Kt&&Kt.length>0&&a.jsx("div",{className:r===0?"mt-0.5":"",children:Kt.map(xe=>a.jsx(e,{node:xe,depth:r+1,onFileSelect:s,directoriesOnly:i,onPathReference:c,getReferenceText:u,onReferenceCopied:f,onDirectoryRoot:x,onSearchFromDirectory:b,onDirectoryPinToggle:v,onFilePinToggle:w,onOpenInFileBrowser:k,canOpenInFileBrowser:I,pinnedPaths:N,selectedFilePath:M,queryLower:D,insertedReferenceKey:p,copiedReferenceKey:g,onDirectoryDropFiles:F,onFileDeleteRequest:Z,deletingFilePath:G,revealedDirectoryPath:U},xe.path))})]})}),jD=A.memo(function({node:t,rootPath:r,onFileSelect:s,onPathReference:i,getReferenceText:c,onReferenceCopied:u,insertedReferenceKey:f,copiedReferenceKey:p,onDirectoryRoot:g,onSearchFromDirectory:x,onDirectoryPinToggle:b,onFilePinToggle:v,pinnedPaths:w,selectedFilePath:k,onFileDeleteRequest:I,deletingFilePath:N}){const{t:M}=Gr(),D=t.path===k,F=t.type==="directory",Z=w.has(t.path),G=!F&&!!v,U=`path:${t.path}`,q=f===U,pe=p===U,Ue=c?.(t.path)??t.path,be=kp(u),{state:Ae,run:Ke}=k6(),[qe,ie]=A.useState(!1),{position:Se,menuRef:tt,openAt:Ee,clearPosition:oe}=E6(qe),de=A.useRef(null),Te=N===t.path,ee=F&&!!(g||x||b),ye=A.useCallback(()=>{Gd()||(t.type==="directory"?g?.(t.path):s(t.path))},[t.path,t.type,g,s]),ce=A.useCallback(Le=>{Le.stopPropagation(),i?.(t.path,U)},[i,t.path,U]),Ye=A.useCallback(Le=>{Le.stopPropagation(),b?.(t.path),ie(!1)},[t.path,b]),at=A.useCallback(Le=>{Le.stopPropagation(),v?.(t.path),ie(!1)},[t.path,v]),_e=A.useCallback(Le=>{Le.stopPropagation(),ie(!1),Ke(t.path)},[t.path,Ke]),$=A.useCallback(Le=>{Le.stopPropagation(),ie(!1),I(t)},[t,I]),$e=A.useCallback(Le=>{Le.stopPropagation(),oe(),ie(K=>!K)},[oe]),Xe=A.useCallback(Le=>{!ee||!I6(Le)||(Le.preventDefault(),Le.stopPropagation(),Ee(Le.clientX,Le.clientY),ie(!0))},[ee,Ee]);return A.useEffect(()=>{if(!qe)return;const Le=Fe=>{const fe=Fe.target;fe instanceof Node&&(de.current?.contains(fe)||tt.current?.contains(fe))||ie(!1)},K=Fe=>{Fe.key==="Escape"&&ie(!1)};return document.addEventListener("pointerdown",Le),document.addEventListener("keydown",K),()=>{document.removeEventListener("pointerdown",Le),document.removeEventListener("keydown",K)}},[qe,tt]),a.jsxs("div",{ref:de,className:"relative border-b border-border/10 last:border-b-0",children:[be.popoverNode,a.jsxs("div",{role:"button",tabIndex:0,onClick:ye,onContextMenu:Xe,onKeyDown:Le=>{Le.key!=="Enter"&&Le.key!==" "||(Le.preventDefault(),ye())},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${D?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[t.type==="directory"?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-[14px] shrink-0"}),a.jsx(Jl,{size:14,className:"shrink-0 text-[color:var(--folder)]"})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-[14px] shrink-0"}),a.jsx("span",{className:D?"text-primary":"text-muted-foreground/80",children:h1(t.name,t.type)})]}),a.jsxs("span",{className:"min-w-0 flex-1 select-text",children:[a.jsxs("span",{className:`block whitespace-normal break-all font-medium leading-snug ${D?"text-primary":"text-foreground"}`,children:[t.name,t.isSymlink&&a.jsx("span",{className:"ml-1 inline-flex align-middle text-muted-foreground/70",title:M("fileTree.symbolicLink"),children:a.jsx(O0,{size:11})})]}),a.jsx("span",{className:"mt-0.5 block truncate font-mono text-[10px] text-muted-foreground/80",children:wp(r,t.path)})]}),a.jsx(L6,{path:t.path}),t.type==="directory"&&(b||x)&&a.jsx("span",{onClick:$e,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${G0(qe)} ${qe?"bg-surface-elevated text-foreground":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:M("fileTree.moreDirActions"),children:a.jsx(P0,{size:13})}),!F&&a.jsx("span",{onClick:$e,className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-muted-foreground transition active:scale-95 ${G0(qe||Ae.status==="pending"||Te||Z)} ${qe?"bg-surface-elevated text-foreground":Z?"bg-primary/15 text-primary":"bg-surface-2 hover:bg-surface-elevated hover:text-foreground"}`,title:Ae.status==="error"?Ae.message??M("rightSidebar.downloadFailed"):M("fileTree.moreFileActions"),children:Ae.status==="pending"||Te?a.jsx(Sn,{size:13,className:"animate-spin"}):a.jsx(P0,{size:13})}),i&&a.jsx("span",{onClick:ce,...be(Ue,U),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${f1(q||pe)} ${q||pe?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":M(pe?"rightSidebar.copied":q?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:M(pe?"rightSidebar.copied":q?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:pe||q?a.jsx(Uo,{size:12}):a.jsx(O0,{size:12})})]}),ee&&qe&&M6(a.jsxs("div",{ref:tt,className:`${Se?"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:Se?{left:Se.left,top:Se.top}:void 0,children:[g&&a.jsxs("button",{type:"button",onClick:Le=>{Le.stopPropagation(),g(t.path),ie(!1)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:M("fileTree.openDirRootTitle"),children:[a.jsx(N0,{size:13,className:"shrink-0 text-[color:var(--folder)]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("fileTree.openDirRoot")})]}),x&&a.jsxs("button",{type:"button",onClick:Le=>{Le.stopPropagation(),x(t.path),ie(!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(Ep,{size:13,className:"shrink-0 text-primary"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("fileTree.searchFromDir")})]}),b&&a.jsxs("button",{type:"button",onClick:Ye,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] ${Z?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:M(Z?"fileTree.unpinDirTitle":"fileTree.pinDirTitle"),children:[Z?a.jsx(Jc,{size:13,className:"shrink-0"}):a.jsx(Xc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M(Z?"fileTree.unpinDir":"fileTree.pinDir")})]})]}),!!Se),!F&&qe&&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:_e,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-foreground transition hover:bg-surface-2 active:scale-[0.99]",title:M("rightSidebar.downloadFile"),children:[a.jsx(Kc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("rightSidebar.downloadFile")})]}),G&&a.jsxs("button",{type:"button",onClick:at,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] ${Z?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,title:M(Z?"fileTree.unpinFileTitle":"fileTree.pinFileTitle"),children:[Z?a.jsx(Jc,{size:13,className:"shrink-0"}):a.jsx(Xc,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M(Z?"fileTree.unpinFile":"fileTree.pinFile")})]}),a.jsxs("button",{type:"button",onClick:$,disabled:Te,className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left font-medium text-destructive transition hover:bg-destructive/10 active:scale-[0.99] disabled:opacity-50",title:M("fileTree.deleteFile"),children:[Te?a.jsx(Sn,{size:13,className:"shrink-0 animate-spin"}):a.jsx(qi,{size:13,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:M("fileTree.deleteFile")})]})]})]})}),PD=60,u5=60,OD=20;function d5({count:e,loading:t,engine:r,limited:s,scope:i,content:c}){const{t:u}=Gr();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(Ep,{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(Sn,{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:i,children:i}),t&&a.jsx("span",{className:"ml-auto shrink-0",children:u("fileTree.searching")})]})]})}function FD(e,t){if(!t)return e;const r=e.toLowerCase(),s=t.toLowerCase(),i=[];let c=0,u=r.indexOf(s,c),f=0;for(;u>=0&&s;)u>c&&i.push(e.slice(c,u)),i.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&&i.push(e.slice(c)),i.length>0?i:e}const UD=A.memo(function({entry:t,rootPath:r,selectedFilePath:s,query:i,onContentMatchSelect:c,onPathReference:u,getReferenceText:f,onReferenceCopied:p,insertedReferenceKey:g,copiedReferenceKey:x}){const{t:b}=Gr(),[v,w]=A.useState(!0),k=t.path===s,I=v?t.matches.slice(0,OD):[],N=t.matches.length-I.length,M=`path:${t.path}`,D=g===M,F=x===M,Z=f?.(t.path)??t.path,G=kp(p);return a.jsxs("div",{className:"border-b border-border/10 last:border-b-0",children:[G.popoverNode,a.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{Gd()||w(U=>!U)},onKeyDown:U=>{U.key!=="Enter"&&U.key!==" "||(U.preventDefault(),w(q=>!q))},className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-2 text-left text-[13px] transition ${k?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,title:t.path,children:[v?a.jsx(Cl,{size:14,className:"shrink-0 text-muted-foreground/80"}):a.jsx(hu,{size:14,className:"shrink-0 text-muted-foreground/80"}),a.jsx("span",{className:k?"text-primary":"text-muted-foreground/80",children:h1(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:wp(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(RD,{path:t.path}),u&&a.jsx("span",{onClick:U=>{U.stopPropagation(),u(t.path,M)},...G(Z,M),className:`inline-flex h-6 shrink-0 select-none items-center justify-center rounded-md text-[11px] font-semibold transition active:scale-95 ${f1(D||F)} ${D||F?"bg-surface-elevated text-foreground":"bg-primary/10 text-primary"}`,"aria-label":b(F?"rightSidebar.copied":D?"rightSidebar.inserted":"fileTree.insertRefTitle"),title:b(F?"rightSidebar.copied":D?"rightSidebar.inserted":"fileTree.insertRefTitle"),children:F||D?a.jsx(Uo,{size:12}):a.jsx(O0,{size:12})})]}),v&&a.jsxs("div",{className:"mb-1 ml-3 border-l border-border/20 pl-1",children:[I.map((U,q)=>a.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{Gd()||c?.(t.path,U.line)},onKeyDown:pe=>{pe.key!=="Enter"&&pe.key!==" "||(pe.preventDefault(),c?.(t.path,U.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:`${wp(r,t.path)}:${U.line}`,children:[a.jsx("span",{className:"shrink-0 select-none tabular-nums text-muted-foreground/60",children:U.line}),a.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-pre select-text",children:FD(U.text,i)})]},`${U.line}-${q}`)),N>0&&a.jsx("div",{className:"px-2 py-1 text-[10px] text-muted-foreground/70",children:b("fileTree.moreMatches",{count:N})})]})]})});function $D({rootPath:e,onFileSelect:t,directoriesOnly:r=!1,onPathReference:s,getReferenceText:i,onReferenceCopied:c,insertedReferenceKey:u,copiedReferenceKey:f,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:b,onOpenInFileBrowser:v,canOpenInFileBrowser:w=!1,pinnedPaths:k=ID,selectedFilePath:I,query:N="",searchRootPath:M,searchOptions:D={},searchMode:F="name",onContentMatchSelect:Z,onDirectoryDropFiles:G,revealDirectory:U}){const{t:q}=Gr(),pe=Ft(ut=>e?ut.directoryCache.get(e):void 0),Ue=Ft(ut=>ut.setDirectoryCache),be=Ft(ut=>ut.showHiddenFiles),Ae=Ft(ut=>ut.fileSortModesHydrated),Ke=Ft(ut=>ut.fileSortModes[e]??"name"),qe=Ft(ut=>ut.hydrateFileSortModes),[ie,Se]=A.useState(!1),[tt,Ee]=A.useState(null),[oe,de]=A.useState(!1),[Te,ee]=A.useState(!1),[ye,ce]=A.useState(null),[Ye,at]=A.useState(Ae),_e=Ae||Ye;A.useEffect(()=>{let ut=!1;return qe().catch(()=>{}).finally(()=>{ut||at(!0)}),()=>{ut=!0}},[qe]);const[$,$e]=A.useState([]),[Xe,Le]=A.useState(null),[K,Fe]=A.useState(a5),[fe,De]=A.useState([]),[lt,Tt]=A.useState(null),we=A.useRef(null),me=A.useRef(0),Qe=N.trim().toLowerCase(),gt=F==="content",ft=M||e,ct=D.excludePatterns??ED,Kt=ct.join(`
127
+ `);A.useEffect(()=>{const ut=U?.path;if(!ut||!ut.startsWith(`${e}/`)&&ut!==e)return;const bt=ut.slice(e.length).replace(/^\/+/,""),It=bt?bt.split("/"):[],St=It.map((yt,Gt)=>`${e}/${It.slice(0,Gt+1).join("/")}`),Ht=Ft.getState(),te=St.filter(yt=>!Ht.expandedPaths.has(yt));te.length>0&&Ft.setState(yt=>({expandedPaths:new Set([...yt.expandedPaths,...te])}));let Me=!1,ve=0;const _t=()=>{if(Me)return;const yt=Array.from(document.querySelectorAll("[data-file-tree-path]")).find(Gt=>Gt.dataset.fileTreePath===ut);if(yt){yt.scrollIntoView({block:"center",behavior:"smooth"});return}ve+=1,ve<80&&window.setTimeout(_t,50)},Ve=window.requestAnimationFrame(_t);return()=>{Me=!0,window.cancelAnimationFrame(Ve)}},[U?.nonce,U?.path,e]);const $t=A.useCallback(async ut=>{if(!(lt||ut.type==="directory")&&window.confirm(q("fileTree.deleteFileConfirm",{name:ut.name}))){Tt(ut.path);try{await wv(ut.path),Ft.getState().applyFileWatchEvents([{type:"deleted",path:ut.path}]),$e(bt=>bt.filter(It=>It.path!==ut.path)),De(bt=>bt.filter(It=>It.path!==ut.path)),k.has(ut.path)&&b?.(ut.path)}catch(bt){const It=bt instanceof Error?bt.message:String(bt);window.alert(q("fileTree.deleteFileFailed",{message:It}))}finally{Tt(null)}}},[lt,b,k,q]);A.useEffect(()=>{if(!e||!_e)return;if(Qe){Se(!1);return}if(Ft.getState().directoryCache.has(e)){Se(!1);return}let ut=!1;const bt=new AbortController;return Se(!0),Ee(null),_p(e,bt.signal,be,"load_file_tree_root",`file-tree-root:${e}`,Ke).then(It=>{if(ut)return;const St=vp(It.entries);de(!!It.truncated),Ue(e,St)}).catch(It=>{ut||yp(It)||Ee(It instanceof Error?It.message:"Failed to load directory")}).finally(()=>{ut||Se(!1)}),()=>{ut=!0,bt.abort(),Of(`file-tree-root:${e}`)}},[Qe,pe,e,Ke,Ue,be,_e]),A.useEffect(()=>{if(!ft||!Qe){ee(!1),ce(null),$e([]),De([]),Le(null);return}let ut=!1;const bt=new AbortController,It=new Set;ee(!0),ce(null),$e([]),De([]),Fe(gt?PD:a5),Le({truncated:!1,total:0,engine:"rg",limited:!1,done:!1});const St=`file-search:${ft}:${++me.current}`;return Av(ft,N.trim(),Ht=>{if(!ut){if(Ht.engine&&Le(te=>({truncated:te?.truncated??!1,total:te?.total??0,engine:Ht.engine,limited:Ht.limited??te?.limited??!1,done:te?.done??!1})),Ht.entries?.length){const te=Ht.entries.filter(Me=>It.has(Me.path)?!1:(It.add(Me.path),!0));te.length>0&&($e(Me=>[...Me,...vp(te)]),Le(Me=>Me?{...Me,total:It.size}:{truncated:!1,total:It.size,engine:"rg",limited:!1,done:!1}))}if(Ht.contentEntries?.length){const te=Ht.contentEntries.filter(Me=>It.has(Me.path)?!1:(It.add(Me.path),!0));te.length>0&&(De(Me=>[...Me,...te]),Le(Me=>Me?{...Me,total:It.size}:{truncated:!1,total:It.size,engine:"rg",limited:!1,done:!1}))}Ht.done&&Le(te=>({truncated:!!Ht.truncated,total:typeof Ht.total=="number"?Ht.total:It.size,engine:Ht.engine??te?.engine??"rg",limited:!!Ht.limited,done:!0}))}},bt.signal,be,F,St,{excludePatterns:ct,caseSensitive:D.caseSensitive,wholeWord:D.wholeWord,regex:D.regex}).catch(Ht=>{ut||yp(Ht)||(ce(Ht instanceof Error?Ht.message:"Failed to search files"),$e([]),De([]),Le(null))}).finally(()=>{ut||ee(!1)}),()=>{ut=!0,bt.abort(),Of(St)}},[ft,Kt,gt,N,Qe,F,D.caseSensitive,D.regex,D.wholeWord,be]),A.useEffect(()=>{if(!Qe)return;const ut=we.current;if(!ut)return;const bt=gt?fe.length:$.length,It=gt?u5:l5,St=new IntersectionObserver(Ht=>{Ht.some(te=>te.isIntersecting)&&Fe(te=>Math.min(te+It,bt))},{rootMargin:"160px 0px"});return St.observe(ut),()=>St.disconnect()},[Qe,$.length,fe.length,gt]);const Qt=A.useMemo(()=>{if(!pe)return;if(!Qe)return r?pe.filter(bt=>bt.type==="directory"):pe;const ut=Ft.getState().directoryCache;return pe.filter(bt=>(!r||bt.type==="directory")&&p1(bt,Qe,ut))},[r,Qe,pe]);if(!e)return a.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:q("fileTree.noWorkingDir")});if(ie||!_e)return a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(Sn,{size:20,className:"animate-spin text-muted-foreground"})});if(Qe&&gt){const ut=Xe?.total??fe.length,bt=fe.slice(0,K),It=K<fe.length;return a.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[a.jsx(d5,{count:ut,loading:Te,engine:Xe?.engine,limited:Xe?.limited,scope:ft,content:!0}),ye?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:[q("fileTree.contentSearchNeedsRipgrep"),a.jsx("div",{className:"mt-1 break-words text-[11px] text-muted-foreground/70",children:ye})]}):Te&&fe.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(Sn,{size:20,className:"animate-spin text-muted-foreground"})}):fe.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:q("fileTree.noContentMatches")}):a.jsxs(a.Fragment,{children:[Xe?.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:q("fileTree.searchTruncatedHint",{count:Xe.total})}),bt.map(St=>a.jsx(UD,{entry:St,rootPath:ft,selectedFilePath:I,query:N.trim(),onContentMatchSelect:Z,onPathReference:s,getReferenceText:i,onReferenceCopied:c,insertedReferenceKey:u,copiedReferenceKey:f},St.path)),a.jsx("div",{ref:we,className:"py-2 text-center text-[11px] text-muted-foreground",children:It?a.jsx("button",{type:"button",onClick:()=>Fe(St=>Math.min(St+u5,fe.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:q("fileTree.loadMoreSearchResults",{shown:bt.length,total:fe.length})}):Te?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Sn,{size:10,className:"animate-spin"}),q("fileTree.searchStillRunning")]}):bt.length>0?a.jsx("span",{children:q("fileTree.showingSearchResults",{shown:bt.length,total:ut})}):null})]})]})}if(Qe){const ut=Xe?.total??$.length,bt=$.slice(0,K),It=K<$.length;return a.jsxs("div",{className:"termdock-native-select min-h-full space-y-px bg-surface px-2 py-2",children:[a.jsx(d5,{count:ut,loading:Te,engine:Xe?.engine,limited:Xe?.limited,scope:ft,content:!1}),Te&&$.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(Sn,{size:20,className:"animate-spin text-muted-foreground"})}):ye?a.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:ye}):$.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:q("fileTree.noMatchingFiles")}):a.jsxs(a.Fragment,{children:[Xe?.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:q("fileTree.searchTruncatedHint",{count:Xe.total})}),bt.map(St=>a.jsx(jD,{node:St,rootPath:ft,onFileSelect:t,onPathReference:s,getReferenceText:i,onReferenceCopied:c,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:b,pinnedPaths:k,selectedFilePath:I,insertedReferenceKey:u,copiedReferenceKey:f,onFileDeleteRequest:$t,deletingFilePath:lt},St.path)),a.jsx("div",{ref:we,className:"py-2 text-center text-[11px] text-muted-foreground",children:It?a.jsx("button",{type:"button",onClick:()=>Fe(St=>Math.min(St+l5,$.length)),className:"rounded-full bg-surface-2 px-3 py-1 hover:bg-surface-elevated hover:text-foreground",children:q("fileTree.loadMoreSearchResults",{shown:bt.length,total:$.length})}):Te?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Sn,{size:10,className:"animate-spin"}),q("fileTree.searchStillRunning")]}):bt.length>0?a.jsx("span",{children:q("fileTree.showingSearchResults",{shown:bt.length,total:ut})}):null})]})]})}return tt?a.jsx("div",{className:"px-4 py-4 text-sm text-destructive",children:tt}):!pe||pe.length===0?a.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:q("fileTree.emptyDir")}):!Qt||Qt.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:q("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:q("fileTree.truncatedHint")}),Qt.map(ut=>a.jsx(BD,{node:ut,depth:0,onFileSelect:t,directoriesOnly:r,onPathReference:s,getReferenceText:i,onReferenceCopied:c,onDirectoryRoot:p,onSearchFromDirectory:g,onDirectoryPinToggle:x,onFilePinToggle:b,onOpenInFileBrowser:v,canOpenInFileBrowser:w,pinnedPaths:k,selectedFilePath:I,queryLower:Qe,insertedReferenceKey:u,copiedReferenceKey:f,onDirectoryDropFiles:G,onFileDeleteRequest:$t,deletingFilePath:lt,revealedDirectoryPath:U?.path},ut.path))]})}function Ap(e){return e.trim().replace(/\/+$/,"")||"/"}function zD(e){const t=Ap(e);if(t==="/")return"/";const r=t.lastIndexOf("/");return r<=0?"/":t.slice(0,r)}function R6({open:e,initialPath:t,title:r,labels:s,onCancel:i,onConfirm:c}){const{t:u}=Gr(),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")},[p,g]=A.useState(()=>Ap(t));return A.useEffect(()=>{e&&g(Ap(t))},[t,e]),A.useEffect(()=>{if(!e)return;const x=document.body.style.overflow,b=v=>{v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),i())};return document.body.style.overflow="hidden",document.addEventListener("keydown",b,!0),()=>{document.body.style.overflow=x,document.removeEventListener("keydown",b,!0)}},[i,e]),e?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:i,"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(U8,{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:i,className:"inline-flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground","aria-label":f.close,children:a.jsx(ws,{size:15})})]}),a.jsxs("div",{className:"flex min-h-11 shrink-0 items-center gap-2 border-b border-border/15 px-3 py-1.5",children:[a.jsx("button",{type:"button",disabled:p==="/",onClick:()=>g(zD(p)),className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition hover:bg-surface-2 hover:text-foreground disabled:opacity-30","aria-label":f.parent,children:a.jsx(W5,{size:14})}),a.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10.5px] text-foreground",title:p,children:p})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain py-1",children:a.jsx($D,{rootPath:p,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:i,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(p),className:"inline-flex min-h-10 items-center gap-1.5 rounded-lg bg-primary px-4 text-[11px] font-semibold text-primary-foreground transition hover:bg-primary/90",children:[a.jsx(Uo,{size:13}),f.confirm]})]})]})]}),document.body):null}const Tp="termdock:new-session-commands:v1",wl="__saved_command__:";function ad(e){return[...new Set(Object.entries(e).filter(([t])=>t.startsWith(wl)||t==="__custom__"||t==="__terminal__").map(([,t])=>t.trim()).filter(Boolean))]}function Nc(){try{const e=JSON.parse(localStorage.getItem(Tp)||"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="string"))}catch{return{}}}function HD({directories:e,tmuxAvailable:t,options:r,agents:s,selectedAgent:i,detecting:c,resumeHistory:u,resumeHistoryLoading:f,resumeHistoryPendingId:p,resumeHistoryError:g,onRefreshAgents:x,onSelectAgent:b,onLaunchAgent:v,onResumeHistory:w,onRemoveResumeHistory:k,onClose:I,onOptionsChange:N}){const{t:M,locale:D}=Gr(),[F,Z]=A.useState(i),[G,U]=A.useState(!1),[q,pe]=A.useState(!1),[Ue,be]=A.useState(Nc),[Ae,Ke]=A.useState(()=>ad(Nc())),[qe,ie]=A.useState(null),[Se,tt]=A.useState("idle"),Ee=q?"__custom__":F?.slug??"__terminal__",oe=F?.command??"",de=q?Ue.__custom__??Ue.__terminal__??"":F?Ue[Ee]??oe:"",Te=()=>{const K=de.trim()||oe;if(!(q&&!K))try{const Fe={...Nc(),[Ee]:K};if(q){for(const fe of ad(Nc()))Fe[wl+fe]=fe;Fe[wl+K]=K}localStorage.setItem(Tp,JSON.stringify(Fe)),Ke(ad(Fe)),q&&ie(K),tt("saved")}catch{tt("error")}},ee=()=>{if(qe)try{const K=Nc();for(const[Fe,fe]of Object.entries(K))(Fe.startsWith(wl)||Fe==="__custom__"||Fe==="__terminal__")&&fe.trim()===qe&&delete K[Fe];localStorage.setItem(Tp,JSON.stringify(K)),Ke(ad(K)),be(Fe=>({...Fe,__custom__:""})),ie(null),tt("idle")}catch{tt("error")}},ye=()=>{const K=de.trim()||oe;q&&!K||(Te(),v(F,K))},ce=A.useMemo(()=>[...new Set(e.filter(Boolean))].slice(0,5),[e]),Ye=q?qe?wl+qe:"__custom__":F?.slug??"__terminal__",at=K=>{tt("idle");const Fe=K.startsWith(wl)?K.slice(wl.length):null;ie(Fe),pe(K==="__custom__"||Fe!==null),(Fe!==null||K==="__custom__")&&be(fe=>({...fe,__custom__:Fe??""})),Z(s.find(fe=>fe.slug===K)??null)},_e=q?qe??M("sidebar.customStartupCommand"):F?.displayName??"Terminal",$=i?.displayName??"Terminal",$e=!q&&(F===null?i===null:i?.slug===F.slug);A.useEffect(()=>{const K=Fe=>{Fe.key==="Escape"&&(G||I())};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[G,I]);const Xe=K=>{N({...r,cwd:K}),U(!1)},Le=K=>new Intl.DateTimeFormat(D==="zh"?"zh-CN":"en",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(K));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":M("sidebar.newSessionComposerTitle"),children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 px-3 py-1.5",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[a.jsx("span",{className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground",children:a.jsx($o,{size:14})}),a.jsx("div",{className:"min-w-0",children:a.jsx("div",{className:"text-[12px] font-semibold text-foreground",children:M("sidebar.newSessionComposerTitle")})})]}),a.jsx("button",{type:"button",onClick:I,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":M("common.close"),children:a.jsx(ws,{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:M("sidebar.sessionMode")}),a.jsx("div",{className:"grid grid-cols-2 gap-1 rounded-lg bg-surface p-0.5",children:["shell","tmux"].map(K=>a.jsx("button",{type:"button",disabled:K==="tmux"&&!t,onClick:()=>N({...r,mode:K}),"aria-pressed":r.mode===K,title:K==="tmux"?M(t?"sidebar.tmuxKeepsRunning":"sidebar.newTmuxDisabled"):void 0,className:`min-h-9 rounded-md px-4 text-[11px] font-medium transition ${r.mode===K?"bg-surface-2 text-foreground":"text-muted-foreground hover:text-foreground"} disabled:cursor-not-allowed disabled:opacity-40`,children:M(K==="shell"?"sidebar.newShell":"sidebar.newTmux")},K))})]}),a.jsxs("div",{className:"mt-1 flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:M("sidebar.startupCommand")}),a.jsx("button",{type:"button",onClick:x,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:M("sidebar.detectAgents"),"aria-label":M("sidebar.detectAgents"),children:a.jsx(As,{size:12,className:c?"animate-spin":""})})]}),a.jsxs("div",{role:"radiogroup","aria-label":M("sidebar.startupCommand"),className:"flex flex-wrap gap-1",children:[s.map(K=>{const Fe=!q&&F?.slug===K.slug;return a.jsxs("button",{type:"button",role:"radio","aria-checked":Fe,onClick:()=>at(K.slug),className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 text-[10.5px] font-medium transition ${Fe?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(Yl,{agent:K,size:12}),a.jsx("span",{className:"max-w-[9rem] truncate",children:K.displayName}),i?.slug===K.slug&&a.jsx("span",{className:"ml-0.5 text-[9px] text-muted-foreground",children:M("sidebar.defaultAgent")})]},K.slug)}),Ae.map(K=>{const Fe=q&&qe===K;return a.jsxs("button",{type:"button",role:"radio","aria-checked":Fe,onClick:()=>at(wl+K),title:K,className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 transition ${Fe?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(Hl,{size:10,className:"shrink-0"}),a.jsx("span",{className:"max-w-[9rem] truncate font-mono text-[10px]",children:K})]},K)}),a.jsxs("button",{type:"button",role:"radio","aria-checked":Ye==="__terminal__",onClick:()=>at("__terminal__"),className:`inline-flex min-h-7 items-center gap-1 rounded-md px-2 text-[10.5px] font-medium transition ${Ye==="__terminal__"?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx($o,{size:11,className:"shrink-0"}),a.jsx("span",{children:"Terminal"}),i===null&&a.jsx("span",{className:"ml-0.5 text-[9px] font-normal text-muted-foreground",children:M("sidebar.defaultAgent")})]}),a.jsxs("button",{type:"button",role:"radio","aria-checked":Ye==="__custom__",onClick:()=>at("__custom__"),className:`inline-flex min-h-7 items-center gap-0.5 rounded-md px-2 text-[10.5px] font-medium transition ${Ye==="__custom__"?"bg-surface-2 text-foreground ring-1 ring-inset ring-primary/50":"bg-surface text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(Ri,{size:10,className:"shrink-0"}),a.jsx("span",{children:M("sidebar.addStartupCommand")})]})]}),!$e&&!q&&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:M("sidebar.currentDefaultAgent",{name:$})}),a.jsx("button",{type:"button",onClick:()=>b(F),className:"relative z-10 shrink-0 rounded-md px-2 py-1.5 font-medium text-primary transition hover:bg-primary/10",children:M("sidebar.makeDefault")})]}),Se==="error"&&a.jsx("p",{role:"alert",className:"text-[10px] text-destructive",children:M("sidebar.saveStartupCommandFailed")}),(F||q)&&a.jsxs("details",{open:q&&!qe||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:[M(q&&!qe?"sidebar.customStartupCommand":"sidebar.changeStartupCommand"),a.jsx(Cl,{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:M("sidebar.startupCommand")}),F&&de!==oe&&a.jsx("button",{type:"button",onClick:()=>{be(K=>({...K,[Ee]:oe})),tt("idle")},className:"min-h-8 rounded-md px-2 text-[10px] text-primary transition hover:bg-primary/10",children:M("sidebar.resetStartupCommand")})]}),a.jsx("input",{id:"new-session-command",value:de,onChange:K=>{be(Fe=>({...Fe,[Ee]:K.target.value})),tt("idle")},placeholder:oe||M("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:[q&&qe&&a.jsxs("button",{type:"button",onClick:ee,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":M("sidebar.deleteStartupCommand"),children:[a.jsx(qi,{size:11}),M("sidebar.deleteStartupCommand")]}),a.jsx("button",{type:"button",onClick:Te,disabled:Se==="saved"||q&&!de.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:M(Se==="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:M(F?"sidebar.agentStartupCommandHint":"sidebar.terminalStartupCommandHint")})]},qe??Ee),a.jsx("label",{htmlFor:"new-session-directory",className:"mt-2 block text-[11px] text-muted-foreground",children:M("sidebar.workingDirectory")}),a.jsxs("button",{id:"new-session-directory",type:"button","aria-haspopup":"dialog",onClick:()=>U(!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(Jl,{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||M("sidebar.directoryPlaceholder")})]}),ce.length>0&&a.jsx("div",{className:"mt-1.5 flex gap-1 overflow-x-auto pb-0.5","aria-label":M("sidebar.recentDirectories"),children:ce.map(K=>a.jsx("button",{type:"button",onClick:()=>Xe(K),title:K,className:"min-h-8 shrink-0 rounded-md px-2 text-[10px] text-muted-foreground transition hover:bg-surface hover:text-foreground",children:Zc(K)||K},K))}),(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(Hl,{size:11}),a.jsx("span",{className:"flex-1",children:M("sidebar.resumeHistory")}),f&&a.jsx(Sn,{size:10,className:"animate-spin"}),u.length>0&&a.jsx("span",{className:"normal-case tracking-normal",children:M("sidebar.resumeHistoryCount",{n:u.length})}),a.jsx(Cl,{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(K=>{const Fe=p===K.id;return a.jsxs("div",{className:"group flex min-w-0 items-stretch transition hover:bg-surface-2",children:[a.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>w(K),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":M("sidebar.resumeHistoryAction",{title:K.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:Fe?a.jsx(Sn,{size:13,className:"animate-spin"}):a.jsx(Yl,{agent:K.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:K.title}),a.jsxs("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[K.agent.displayName," · ",Le(K.closedAt)]})]}),a.jsx(Z5,{size:12,className:"shrink-0 text-muted-foreground transition group-hover:text-primary"})]}),a.jsxs("button",{type:"button",disabled:p!==null,onClick:()=>k(K.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":M("sidebar.resumeHistoryRemove",{title:K.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(qi,{size:12})]})]},K.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:ye,disabled:q&&!de.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":M("sidebar.launchSessionWith",{name:_e}),children:[F?a.jsx(Yl,{agent:F,size:15}):a.jsx($o,{size:14}),a.jsx("span",{className:"truncate",children:M("sidebar.launchSessionWith",{name:_e})})]})}),a.jsx(R6,{open:G,initialPath:r.cwd?.trim()||ce[0]||"/",title:M("sidebar.chooseDirectory"),onCancel:()=>U(!1),onConfirm:Xe})]})}const N6="termdock:new-session-agent:v1";function WD(){if(typeof window>"u")return null;try{const e=JSON.parse(window.localStorage.getItem(N6)||"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 Ef(e){if(!(typeof window>"u"))try{window.localStorage.setItem(N6,JSON.stringify(e))}catch{}}function GD(e,t){return e?t.find(r=>r.slug===e)??null:null}function VD(){const[e,t]=A.useState(WD),[r,s]=A.useState([]),[i,c]=A.useState(!0),u=A.useCallback(async()=>{c(!0);try{const[p,g]=await Promise.all([V0(),j5()]),x=GD(p.newSessionAgentSlug,g);s(g),t(x),Ef(x)}finally{c(!1)}},[]);A.useEffect(()=>{const p=()=>{u().catch(()=>{})};if(performance.getEntriesByName("termdock:startup:initial-viewport-presented").length>0){p();return}return window.addEventListener("termdock:initial-viewport-presented",p,{once:!0}),()=>window.removeEventListener("termdock:initial-viewport-presented",p)},[u]);const f=A.useCallback(async p=>{const g=e;t(p),Ef(p);try{await jo({newSessionAgentSlug:p?.slug??null})}catch(x){throw t(g),Ef(g),x}},[e]);return{preference:e,agents:r,detecting:i,refresh:u,selectAgent:f}}function qD(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 Ei="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",Cp="inline-flex min-h-7 items-center justify-center rounded-md border px-2 py-1 text-[11px] leading-4 font-medium transition",Wr="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 h5(e){const[t,r]=A.useState(null),[s,i]=A.useState(!1),[c,u]=A.useState({}),f=A.useCallback(x=>u(b=>({...x,...b})),[]),p=A.useCallback((x,b)=>u(v=>JSON.stringify(v[x])===JSON.stringify(b)?v:{...v,[x]:b}),[]),g={drafts:c,loadDrafts:f,updateDraft:p};return a.jsxs(a.Fragment,{children:[!s&&a.jsx(f5,{...e,...g,onOpenOverlay:r,onClose:()=>{t?i(!0):e.onClose()}}),t&&a.jsx(f5,{...e,...g,overlayOnly:!0,initialFloating:t==="floating",onFloatingChange:void 0,onOpenOverlay:r,onClose:()=>{r(null),s&&e.onClose()}})]})}function f5({activeSessionId:e,initialCollaborationGroupId:t=null,initialFloating:r=!1,onFloatingChange:s,defaultSessionMode:i="shell",onClose:c,onNewSession:u,overlayOnly:f=!1,onOpenOverlay:p,drafts:g,loadDrafts:x,updateDraft:b}){const[v,w]=A.useState(r);A.useEffect(()=>{w(r)},[r]);const[k,I]=A.useState(!1),[N,M]=A.useState(t),D=Ws(Ce=>Ce.docks[t??"workbench"]),F=Ws(Ce=>Ce.hosts[t??"workbench"]),[Z,G]=A.useState("floating"),[U,q]=A.useState(null),[pe,Ue]=A.useState({x:16,y:80}),be=A.useRef(null),Ae=A.useRef({x:.5,y:.5}),[Ke,qe]=A.useState(null),[ie,Se]=A.useState(null);A.useEffect(()=>{let Ce=!1;return V0().then(nt=>{if(Ce)return;const xe=K5(nt.collaborationPanels?.[Xd()],t);xe.position&&(Ae.current=xe.position),xe.size&&q(xe.size),x(xe.drafts??{}),f||G(xe.mode??"floating"),qe(xe)}).catch(()=>{Ce||Se("面板草稿加载失败,请重新打开面板重试")}),()=>{Ce=!0}},[]);const[tt,Ee]=A.useState(null);A.useEffect(()=>{const Ce=nt=>Se(String(nt.detail));return window.addEventListener("termdock-panel-save-error",Ce),()=>{window.removeEventListener("termdock-panel-save-error",Ce),f||Ws.getState().setDock(t??"workbench",null)}},[]);const oe=!f&&v&&Z==="docked"&&!!F;A.useEffect(()=>{!f&&!v&&Ws.getState().setDock(t??"workbench",null)},[v]);const de=async Ce=>{if(f||k||Ce==="docked"&&!e)return;const nt={sessionId:e,side:"right"};I(!0);try{await Wa({mode:Ce,...Ce==="docked"?{dock:nt}:{}},t),G(Ce),Ws.getState().setDock(t??"workbench",Ce==="docked"?nt:null)}catch{Se("面板布局保存失败,请重试")}finally{I(!1)}},Te=A.useRef(!1),ee=A.useRef(null),ye=A.useCallback((Ce,nt)=>{const xe=be.current?.getBoundingClientRect(),gr=window.visualViewport,xt=(gr?.offsetLeft??0)+12,hn=(gr?.offsetTop??0)+12;return{x:Math.max(xt,Math.min(Ce,xt+(gr?.width??window.innerWidth)-(xe?.width??440)-24)),y:Math.max(hn,Math.min(nt,hn+(gr?.height??window.innerHeight)-(xe?.height??340)-24))}},[]);A.useLayoutEffect(()=>{if(!v||oe)return;const Ce=()=>{const xe=window.visualViewport;Ee(xe?.height??window.innerHeight);const gr=be.current?.getBoundingClientRect();!gr?.width||!gr.height||Te.current||Ue(ye((xe?.offsetLeft??0)+12+Math.max(0,(xe?.width??window.innerWidth)-gr.width-24)*Ae.current.x,(xe?.offsetTop??0)+12+Math.max(0,(xe?.height??window.innerHeight)-gr.height-24)*Ae.current.y))},nt=new ResizeObserver(Ce);return be.current&&nt.observe(be.current),window.addEventListener("resize",Ce),window.visualViewport?.addEventListener("resize",Ce),Ce(),()=>{nt.disconnect(),window.removeEventListener("resize",Ce),window.visualViewport?.removeEventListener("resize",Ce)}},[v,oe,ye,Ke,U]);const[ce,Ye]=A.useState(t?"collaboration":"automation"),[at,_e]=A.useState([]),[$,$e]=A.useState([]),[Xe,Le]=A.useState([]),[K,Fe]=A.useState([]),[fe,De]=A.useState([]),[lt,Tt]=A.useState(null),[we,me]=A.useState(null),[Qe,gt]=A.useState(null),[ft,ct]=A.useState("loading"),[Kt,$t]=A.useState(null),[Qt,ut]=A.useState(),[bt,It]=A.useState(null),St=A.useRef(null),Ht=A.useRef(null),te=A.useRef(null),Me=t?K.find(Ce=>Ce.id===t)??null:null,ve=N?K.find(Ce=>Ce.id===N)??null:K[0]??null,_t=!!t&&ft==="loaded"&&!Me,Ve=!!e&&(!!ve?.sessionIds.includes(e)||!!t&&(!Me||!!ie));A.useEffect(()=>{if(f)return;const Ce=t??"workbench",nt=Ws.getState();_t?nt.docks[Ce]&&nt.setDock(Ce,null):Me&&v&&Z==="docked"&&Ke?.dock&&!nt.docks[Ce]&&nt.setDock(Ce,Ke.dock)},[_t,Me,v,Z,Ke,t,D]);const yt=async(Ce,nt=!1)=>{if(!(k||Ce&&!ve)){if(!f&&!Ce&&!nt&&D){p("full");return}if(f){nt?c():(w(Ce),p(Ce?"floating":"full"));return}I(!0);try{await s?.(Ce?ve.id:null),w(Ce),Ce&&Z==="docked"&&e&&Ws.getState().setDock(t??"workbench",{sessionId:e,side:D?.side??Ke?.dock?.side??"right"}),nt&&c()}catch(xe){me(`常驻浮窗状态保存失败,请重试:${xe instanceof Error?xe.message:"连接失败"}`)}finally{I(!1)}}},Gt=A.useCallback(Ce=>{Fe(Ce.groups),De(Ce.sessions),ut(Ce.peers),$t(null),ct("loaded")},[]);A.useEffect(()=>P5(Gt),[Gt]);const ke=A.useCallback(async(Ce={})=>{Ce.silent||me(null),Ht.current||(Ht.current=Sv().then(nt=>{_e(nt.automations),$e(nt.runs)}).catch(nt=>{Ce.silent||me(nt instanceof Error?nt.message:"自动任务加载失败")}).finally(()=>{Ht.current=null})),te.current||(te.current=j5().then(nt=>{Le(nt),It(null)}).catch(()=>{It("Agent 命令检测失败;已有会话可继续协作。")}).finally(()=>{te.current=null})),St.current||(ct(nt=>nt==="error"?"loading":nt),St.current=O5().then(Gt).catch(nt=>{ct("error"),$t(`协作会话加载失败:${nt instanceof Error?nt.message:"请重试"}`)}).finally(()=>{St.current=null})),await St.current},[Gt]);return A.useEffect(()=>{ke();const Ce=window.setInterval(()=>{ke({silent:!0})},1e4);return()=>window.clearInterval(Ce)},[ke]),A.useEffect(()=>{const Ce=nt=>{nt.key==="Escape"&&!v&&c()};return window.addEventListener("keydown",Ce),()=>window.removeEventListener("keydown",Ce)},[c,v]),qa.createPortal(a.jsxs(a.Fragment,{children:[!v&&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",{onPointerDown:Ce=>{oe&&Ce.stopPropagation()},ref:be,"aria-label":oe?"工作组消息分屏":v?"工作组消息浮窗":"Agent 工作台",style:v&&!oe?{display:Ve?void 0:"none",left:pe.x,top:pe.y,...U?{width:`min(calc(100vw - 24px), max(280px, ${U.width*100}vw))`,height:`min(calc(100dvh - 24px), max(220px, ${U.height*100}dvh))`}:{},maxHeight:tt?tt-24:"calc(100dvh - 24px)"}:void 0,className:oe?"flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden bg-surface":v?"fixed z-menu-panel flex w-[min(400px,calc(100vw-24px))] flex-col overflow-hidden rounded-2xl border border-border/20 bg-surface shadow-xl":"fixed left-[max(0.75rem,env(safe-area-inset-left,0px))] right-[max(0.75rem,env(safe-area-inset-right,0px))] top-[max(1.5rem,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",{"data-pane-titlebar":oe?"true":void 0,"data-panel-drag-title":oe?"true":void 0,onDragStart:Ce=>Ce.preventDefault(),className:`flex items-center gap-2 border-b border-border/15 ${oe?"h-6 min-h-6 shrink-0 cursor-grab select-none bg-[var(--chrome-bg)] px-2 active:cursor-grabbing":v?"px-3 py-2 cursor-move touch-none select-none":"px-4 py-3"}`,onPointerDown:Ce=>{!v||oe||Ce.button!==0||Ce.target.closest("button")||(ee.current={x:Ce.clientX,y:Ce.clientY,left:pe.x,top:pe.y},Ce.currentTarget.setPointerCapture?.(Ce.pointerId))},onPointerMove:Ce=>{ee.current&&Ue(ye(ee.current.left+Ce.clientX-ee.current.x,ee.current.top+Ce.clientY-ee.current.y))},onPointerUp:()=>{if(!ee.current)return;ee.current=null;const Ce=be.current?.getBoundingClientRect(),nt=window.visualViewport;Ce&&(Ae.current=dm(pe.x,pe.y,(nt?.offsetLeft??0)+12,(nt?.offsetTop??0)+12,(nt?.width??window.innerWidth)-Ce.width-24,(nt?.height??window.innerHeight)-Ce.height-24),Wa({position:Ae.current},t).catch(()=>Se("浮窗位置保存失败,请重新拖动重试")))},onPointerCancel:()=>{ee.current=null},children:[a.jsx(Yd,{size:oe?13:17,className:"shrink-0 text-primary"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:`${v?"truncate text-[12px]":"text-[14px]"} font-semibold text-foreground`,title:oe?"拖动标题移动面板;放在边缘拆分,中央交换":Me?.name,children:Me?`${Me.name} · 协作消息`:t?"协作消息":"Agent 工作台"}),!oe&&a.jsx("p",{className:"text-[10px] text-muted-foreground",children:v?"引用、文件路径和粘贴优先加入此处":Me?"选择成员,发送协作消息":"自动任务、会话协作与全文恢复"})]}),!oe&&ce==="collaboration"&&K.length>0&&a.jsx("button",{className:`${Wr} shrink-0 text-primary hover:bg-primary/10`,disabled:k,onClick:()=>{yt(!v)},children:v?"完整面板":"常驻浮窗"}),oe&&a.jsxs(a.Fragment,{children:[a.jsx(Kd,{size:14,"aria-hidden":"true",className:"shrink-0 text-muted-foreground"}),a.jsx("button",{type:"button","aria-label":"打开完整弹窗",title:"打开完整弹窗",disabled:k,className:"rounded p-1 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:()=>p("full"),children:a.jsx(Z7,{size:14})}),a.jsx("button",{type:"button","aria-label":"切换为小浮窗",title:"切换为小浮窗",disabled:k,className:"rounded p-1 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:()=>{de("floating")},children:a.jsx(Ip,{size:14})})]}),a.jsx("button",{className:`${oe?"rounded p-1":"rounded-lg p-2"} text-muted-foreground hover:bg-surface-2 hover:text-foreground`,disabled:k,onClick:()=>{v?yt(!1,!0):c()},"aria-label":"关闭",children:a.jsx(ws,{size:16})})]}),v&&!oe&&!f&&a.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-border/15 px-3 py-1.5",children:[a.jsx("button",{type:"button",disabled:k,"aria-pressed":Z==="floating",className:`${Cp} ${Z==="floating"?"border-primary/40 text-primary":"border-transparent text-muted-foreground"}`,onClick:()=>{de("floating")},children:"浮窗"}),a.jsx("button",{type:"button",disabled:k||!e||_t,"aria-pressed":Z==="docked",className:`${Cp} ${Z==="docked"?"border-primary/40 text-primary":"border-transparent text-muted-foreground"}`,onClick:()=>{de("docked")},children:"占用分屏"})]}),!v&&a.jsx("nav",{className:"flex gap-1 border-b border-border/15 px-3 py-2",children:[["automation",Yc,"自动任务"],["collaboration",O0,"会话协作"],["search",eu,"全文搜索"]].map(([Ce,nt,xe])=>a.jsxs("button",{onClick:()=>Ye(Ce),className:`${Wr} ${ce===Ce?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,children:[a.jsx(nt,{size:14}),xe]},Ce))}),Kt&&a.jsxs("div",{role:"alert",className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:[Kt,a.jsx("button",{className:`${Wr} ml-2`,onClick:()=>{ke()},children:"重新加载会话"})]}),!v&&ce==="collaboration"&&Qt&&["loading","partial","error","unsupported"].includes(Qt.state)&&a.jsxs("div",{role:"status",className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:[Qt.state==="loading"?"正在加载其他服务的会话;当前服务内可先组队。":Qt.state==="unsupported"?"当前客户端不支持跨服务会话,请更新客户端;当前服务内可继续组队。":Qt.state==="partial"?"部分服务的协作会话暂不可用;已有成员会保留,恢复后继续同步。":"其他服务的会话暂时加载失败;当前服务内仍可组队。",Qt.error&&a.jsx("span",{className:"mt-1 block break-words text-[10px]",children:Qt.error}),Qt.services?.filter(Ce=>!Ce.connected&&Ce.error).map(Ce=>a.jsxs("span",{className:"mt-1 block break-words text-[10px]",children:[Xl({serviceLabel:Ce.label,serviceOrigin:Ce.origin}),":",Ce.error]},Ce.origin)),["partial","error"].includes(Qt.state)&&a.jsx("button",{className:`${Wr} ml-2`,onClick:_v,children:"重试跨服务连接"})]}),bt&&a.jsx("div",{className:"mx-4 mt-3 text-[11px] text-muted-foreground",children:bt}),we&&a.jsx("div",{className:"mx-4 mt-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:we}),Qe&&!v&&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(Uo,{size:13}),Qe]}),a.jsxs("div",{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain ${v?"p-3":"p-4"}`,children:[ce==="automation"&&a.jsx(ZD,{automations:at,runs:$,agents:Xe,sessions:fe,activeSessionId:e,busy:lt,setBusy:Tt,setError:me,setNotice:gt,refresh:ke,onClose:c}),ce==="collaboration"&&!Ke&&!ie&&a.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"正在恢复消息面板…"}),ce==="collaboration"&&t&&!Me&&a.jsxs("div",{role:"status",className:"space-y-2 text-[11px] text-muted-foreground",children:[a.jsx("p",{children:ft==="loading"?"正在加载协作组…":ft==="error"?"协作组加载失败,恢复连接后可重试。":"此协作组暂不可用,已释放分屏位置。草稿和布局偏好仍保留。"}),ft!=="loading"&&a.jsx("button",{className:Wr,onClick:()=>{ke()},children:"重新加载"})]}),ie&&a.jsx("p",{role:"alert",className:"text-[11px] text-destructive",children:ie}),ce==="collaboration"&&Ke&&(!t||Me)&&a.jsx(KD,{notice:Qe,initialDrafts:g,onDraftChange:b,docked:oe,inputKeySuffix:f?":overlay":"",selectedGroupId:N,setSelectedGroupId:M,floatingVisible:Ve,floating:v,sessionsState:ft,groups:K,sessions:fe,agents:Xe,activeSessionId:e,initialGroupId:t,defaultSessionMode:i,busy:lt,setBusy:Tt,setError:me,setNotice:gt,refresh:ke}),ce==="search"&&a.jsx(sQ,{onClose:c,onNewSession:u,setError:me})]}),v&&!oe&&a.jsx("button",{type:"button","aria-label":"调整协作浮窗大小",className:"absolute bottom-0 right-0 h-4 w-4 cursor-nwse-resize touch-none text-muted-foreground hover:text-primary",onPointerDown:Ce=>{Ce.preventDefault(),Te.current=!0,Ce.currentTarget.setPointerCapture(Ce.pointerId)},onPointerMove:Ce=>{if(!Ce.currentTarget.hasPointerCapture(Ce.pointerId))return;const nt=window.visualViewport,xe=nt?.width??window.innerWidth,gr=nt?.height??window.innerHeight;q({width:Math.min(1,Math.max(280,Ce.clientX-pe.x)/xe),height:Math.min(1,Math.max(220,Ce.clientY-pe.y)/gr)})},onPointerUp:()=>{Te.current=!1;const Ce=be.current?.getBoundingClientRect(),nt=window.visualViewport;Ce&&(Ae.current=dm(pe.x,pe.y,(nt?.offsetLeft??0)+12,(nt?.offsetTop??0)+12,(nt?.width??window.innerWidth)-Ce.width-24,(nt?.height??window.innerHeight)-Ce.height-24)),U&&Wa({size:U,position:Ae.current},t).catch(()=>Se("浮窗大小保存失败,请重新调整重试"))},onPointerCancel:()=>{Te.current=!1},onKeyDown:Ce=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(Ce.key))return;Ce.preventDefault();const nt=be.current?.getBoundingClientRect(),xe={width:Math.max(.15,Math.min(1,(U?.width??(nt?.width??400)/window.innerWidth)+(Ce.key==="ArrowRight"?.03:Ce.key==="ArrowLeft"?-.03:0))),height:Math.max(.15,Math.min(1,(U?.height??(nt?.height??300)/window.innerHeight)+(Ce.key==="ArrowDown"?.03:Ce.key==="ArrowUp"?-.03:0)))};q(xe),Wa({size:xe},t).catch(()=>Se("浮窗大小保存失败,请重试"))},children:a.jsx("span",{"aria-hidden":"true",children:"⌟"})})]})]}),oe?F:document.body)}function ZD({automations:e,runs:t,agents:r,sessions:s,activeSessionId:i,busy:c,setBusy:u,setError:f,setNotice:p,refresh:g,onClose:x}){const[b,v]=A.useState(null),[w,k]=A.useState(!1),[I,N]=A.useState(null),M=async(D,F,Z)=>{u(D),f(null),p(null);try{await F(),await g(),p(Z)}catch(G){f(G instanceof Error?G.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:`${Wr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{v(null),k(!0),p(null)},children:[a.jsx(Ri,{size:13}),"新建任务"]})]}),w&&a.jsx(YD,{agents:r,sessions:s,activeSessionId:i,initial:b,onCancel:()=>{v(null),k(!1)},onSaved:async D=>{v(null),k(!1),await g(),p(b?`“${D}”已更新`:`“${D}”已创建,将按计划自动运行`)},setError:f}),e.length===0&&!w&&a.jsxs("div",{className:"border-y border-border/15 py-8 text-center",children:[a.jsx(p8,{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:`${Wr} mt-4 bg-primary text-primary-foreground`,onClick:()=>k(!0),children:[a.jsx(Ri,{size:13}),"创建第一个任务"]})]}),a.jsx("div",{className:"space-y-2",children:e.map(D=>{const F=t.find(G=>G.automationId===D.id),Z=r.find(G=>G.command===D.command);return a.jsxs("article",{className:"rounded-xl border border-border/15 bg-surface-2/40 p-3 transition hover:border-border/30",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:D.name}),a.jsx("span",{className:`rounded-full px-2 py-0.5 text-[9px] ${D.enabled?"bg-primary/10 text-primary":"bg-surface-elevated text-muted-foreground"}`,children:D.enabled?"已启用":"已停用"}),D.lastRunStatus&&a.jsx("span",{className:`text-[10px] ${cQ(D.lastRunStatus)}`,children:lQ(D.lastRunStatus)})]}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-muted-foreground",children:[a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Yc,{size:11}),oQ(D)]}),a.jsx("span",{children:D.enabled&&D.nextRunAt?`下次 ${qd(D.nextRunAt)}`:"不会自动运行"})]}),a.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:D.targetSessionId?`发送到 ${s.find(G=>G.sessionId===D.targetSessionId)?.name??"指定会话"}`:`新建 ${Z?.displayName??"Agent"} 会话 · ${D.cwd}`}),a.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-relaxed text-foreground/80",children:D.prompt}),D.lastRunAt&&a.jsxs("p",{className:"mt-2 text-[10px] text-muted-foreground",children:["上次 ",qd(D.lastRunAt),D.lastRunMessage?` · ${D.lastRunMessage}`:""]})]}),a.jsx("button",{"aria-label":`编辑 ${D.name}`,title:"编辑",className:"rounded-lg p-2 text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",onClick:()=>{v(D),k(!0),p(null)},children:a.jsx(F5,{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:I===D.id?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"mr-auto text-[10px] text-destructive",children:"删除后不会再自动运行"}),a.jsx("button",{className:`${Wr} bg-surface-elevated text-foreground`,onClick:()=>N(null),children:"取消"}),a.jsxs("button",{disabled:c!==null,className:`${Wr} bg-destructive text-destructive-foreground`,onClick:()=>{M(`delete:${D.id}`,()=>Lv(D.id),`“${D.name}”已删除`).then(()=>N(null))},children:[c===`delete:${D.id}`?a.jsx(As,{size:13,className:"animate-spin"}):a.jsx(qi,{size:13}),"确认删除"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:`${Wr} mr-auto px-2 text-destructive hover:bg-destructive/10`,onClick:()=>N(D.id),children:[a.jsx(qi,{size:13}),"删除"]}),a.jsxs("button",{disabled:c!==null,className:`${Wr} ${D.enabled?"bg-surface-elevated text-foreground":"bg-primary/15 text-primary"}`,onClick:()=>{M(`toggle:${D.id}`,()=>kv(D.id,!D.enabled),D.enabled?`“${D.name}”已暂停,不会自动运行`:`“${D.name}”已恢复,将按原计划运行`)},children:[c===`toggle:${D.id}`?a.jsx(As,{size:13,className:"animate-spin"}):D.enabled?a.jsx(l9,{size:13}):a.jsx(om,{size:13}),D.enabled?"暂停":"恢复"]}),F?.frontendSessionId&&a.jsxs("button",{className:`${Wr} bg-surface-elevated text-foreground`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:F.frontendSessionId})),x()},children:[a.jsx(Ip,{size:13}),"打开上次会话"]}),a.jsxs("button",{disabled:c!==null,className:`${Wr} bg-primary/15 text-primary`,onClick:()=>{M(`run:${D.id}`,()=>Iv(D.id),`“${D.name}”已投递,可打开会话查看进度`)},children:[c===`run:${D.id}`?a.jsx(As,{size:13,className:"animate-spin"}):a.jsx(om,{size:13}),"立即运行"]})]})})]},D.id)})})]})}function YD({agents:e,sessions:t,activeSessionId:r,initial:s,onCancel:i,onSaved:c,setError:u}){const[f,p]=A.useState(s?.name??""),g=t.find($=>$.sessionId===r),x=s?.cwd??g?.cwd??t[0]?.cwd??"",[b,v]=A.useState(x),[w,k]=A.useState(!1),[I,N]=A.useState(()=>e.find($=>$.command===s?.command)?.slug??""),[M,D]=A.useState(s?.prompt??""),[F,Z]=A.useState(s?.targetSessionId??""),[G,U]=A.useState(s?.targetSessionId?"existing":"new"),[q,pe]=A.useState(s?.schedule.kind??"interval"),[Ue,be]=A.useState(s?.schedule.kind==="interval"?s.schedule.everyMinutes:60),[Ae,Ke]=A.useState(s?.schedule.kind==="daily"?s.schedule.time:"09:00"),[qe,ie]=A.useState(s?.schedule.kind==="daily"?s.schedule.weekdays:[1,2,3,4,5]),[Se,tt]=A.useState(s?.enabled??!0),[Ee,oe]=A.useState(!1),Te=(e.find($=>$.slug===I)??null)?.command??s?.command??"";A.useEffect(()=>{!s&&!I&&e[0]&&N(e[0].slug)},[e,s,I]);const ee=async()=>{oe(!0),u(null);try{await Dv({id:s?.id,name:f,cwd:b,command:G==="new"?Te:"",prompt:M,targetSessionId:G==="existing"&&F||null,enabled:Se,schedule:q==="interval"?{kind:q,everyMinutes:Ue}:{kind:q,time:Ae,weekdays:qe}}),await c(f.trim())}catch($){u($ instanceof Error?$.message:"保存失败")}finally{oe(!1)}},ye=q==="interval"?{kind:q,everyMinutes:Ue}:{kind:q,time:Ae,weekdays:qe},[ce,Ye]=Ae.split(":"),at=($,$e)=>Ke(`${$}:${$e}`),_e=!!(f.trim()&&M.trim()&&(G==="existing"?F:Te)&&(q==="interval"?Ue>=1:qe.length>0));return a.jsxs("div",{className:"overflow-hidden rounded-xl border border-primary/25 bg-primary/5",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-primary/15 px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[13px] font-medium text-foreground",children:s?"编辑自动任务":"创建自动任务"}),a.jsx("p",{className:"mt-0.5 text-[10px] text-muted-foreground",children:"三步完成,保存后可立即试跑"})]}),a.jsx("button",{className:"rounded-lg p-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:i,"aria-label":"关闭任务表单",children:a.jsx(ws,{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:Ei,value:f,onChange:$=>p($.target.value),placeholder:"例如:每日代码巡检"})]}),a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["任务内容",a.jsx("textarea",{className:`${Ei} min-h-24 resize-y`,value:M,onChange:$=>D($.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":G==="new",className:`${Wr} justify-start border px-3 text-left ${G==="new"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>U("new"),children:"每次新建会话"}),a.jsx("button",{type:"button","aria-pressed":G==="existing",disabled:t.length===0,className:`${Wr} justify-start border px-3 text-left ${G==="existing"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>{U("existing"),F||Z(r??t[0]?.sessionId??"")},children:"发送到现有会话"})]}),G==="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:Ei,value:I,onChange:$=>N($.target.value),children:[s&&!e.some($=>$.command===s.command)&&a.jsx("option",{value:"",children:"原 Agent 当前不可用"}),e.map($=>a.jsxs("option",{value:$.slug,children:[$.displayName,$.isPlugin?" · Plugin":""]},$.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:Ei,value:b,onChange:$=>v($.target.value),placeholder:"默认使用当前目录"}),a.jsxs("button",{type:"button","aria-haspopup":"dialog",className:`${Wr} shrink-0 bg-surface-2 text-foreground`,onClick:()=>k(!0),children:[a.jsx(N0,{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:Ei,value:F,onChange:$=>Z($.target.value),children:t.map($=>a.jsxs("option",{value:$.sessionId,children:[$.name," · ",$.status]},$.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":q==="interval",className:`${Wr} border ${q==="interval"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>pe("interval"),children:"固定间隔"}),a.jsx("button",{type:"button","aria-pressed":q==="daily",className:`${Wr} border ${q==="daily"?"border-primary/40 bg-primary/10 text-primary":"border-border/15 bg-surface-2 text-muted-foreground"}`,onClick:()=>pe("daily"),children:"指定日期与时间"})]}),q==="interval"?a.jsxs("label",{className:"block space-y-1 text-[10px] text-muted-foreground",children:["每隔多少分钟",a.jsx("input",{className:Ei,type:"number",min:1,max:43200,value:Ue,onChange:$=>be(Number($.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(Yc,{size:15,className:"mr-3 shrink-0 text-primary"}),a.jsx(p5,{label:"小时",value:ce,options:24,onChange:$=>at($,Ye)}),a.jsx("span",{"aria-hidden":"true",className:"px-2 text-[18px] font-medium text-muted-foreground",children:":"}),a.jsx(p5,{label:"分钟",value:Ye,options:60,onChange:$=>at(ce,$)}),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(($,$e)=>{const Xe=qe.includes($e);return a.jsx("button",{type:"button","aria-pressed":Xe,"aria-label":`星期${$}`,className:`rounded-lg py-2.5 text-[10px] transition ${Xe?"bg-primary text-primary-foreground":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,onClick:()=>ie(Le=>Xe?Le.filter(K=>K!==$e):[...Le,$e].sort()),children:$},$e)})}),qe.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:Se,onChange:$=>tt($.target.checked)}),"保存后启用"]}),a.jsx("p",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:Se&&_e?`${s?"下次运行":"首次运行"}:${qd(aQ(ye,Date.now(),s?.createdAt))}`:Se?"填写完整后显示首次运行时间":"任务会保存,但不会自动运行"})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{className:`${Wr} bg-surface-2 text-foreground`,onClick:i,children:"取消"}),a.jsx("button",{disabled:Ee||!_e,className:`${Wr} bg-primary text-primary-foreground`,onClick:()=>{ee()},children:Ee?"保存中…":s?"保存修改":"创建任务"})]})]}),a.jsx(R6,{open:w,initialPath:b||x||"/",title:"选择工作目录",labels:{hint:"进入文件夹,确认后才会更改工作目录。",cancel:"取消",confirm:"使用此目录",close:"关闭",parent:"上一级目录"},onCancel:()=>k(!1),onConfirm:$=>{v($),k(!1)}})]})}function p5({label:e,value:t,options:r,onChange:s}){return a.jsxs("label",{className:"relative min-w-0 flex-1",children:[a.jsx("span",{className:"sr-only",children:e}),a.jsx("select",{"aria-label":e,className:"w-full appearance-none bg-transparent py-1 pl-1 pr-7 text-center text-[18px] font-semibold tabular-nums text-foreground outline-none",value:t,onChange:i=>s(i.target.value),children:Array.from({length:r},(i,c)=>{const u=String(c).padStart(2,"0");return a.jsx("option",{value:u,children:u},u)})}),a.jsx(Cl,{"aria-hidden":"true",size:13,className:"pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground"})]})}function KD({notice:e,initialDrafts:t,onDraftChange:r,docked:s,inputKeySuffix:i,selectedGroupId:c,setSelectedGroupId:u,floatingVisible:f,floating:p,sessionsState:g,groups:x,sessions:b,agents:v,activeSessionId:w,initialGroupId:k,defaultSessionMode:I,busy:N,setBusy:M,setError:D,setNotice:F,refresh:Z}){const[G,U]=A.useState(""),[q,pe]=A.useState(()=>new Set(w?[w]:[])),[Ue,be]=A.useState(""),[Ae,Ke]=A.useState(()=>new Set),[qe,ie]=A.useState(!1),[Se,tt]=A.useState([]),[Ee,oe]=A.useState(!1),[de,Te]=A.useState(null),[ee,ye]=A.useState("all"),[ce,Ye]=A.useState(!0),[at,_e]=A.useState(new Set),[$,$e]=A.useState(null),[Xe,Le]=A.useState(""),[K,Fe]=A.useState(!1),[fe,De]=A.useState(new Set),[lt,Tt]=A.useState(),[we,me]=A.useState({}),[Qe,gt]=A.useState(!1),[ft,ct]=A.useState(""),[Kt,$t]=A.useState(""),[Qt,ut]=A.useState(""),[bt,It]=A.useState(""),St=A.useRef(null),Ht=s,te=(c??x[0]?.id??"")+i,Me=A.useRef(!1),ve=c==="new"?null:(c?x.find(Y=>Y.id===c):x[0])??null,[_t,Ve]=A.useState(0),yt=A.useRef(new Map(Object.entries(t??{}))),Gt=A.useRef(void 0),ke=A.useRef(!1),Ce=A.useRef($);Ce.current=$;const nt=A.useRef(Xe);nt.current=Xe,A.useLayoutEffect(()=>{if(Gt.current===ve?.id)return;if(Gt.current){const We={content:nt.current,targets:$};yt.current.set(Gt.current,We),Wa({drafts:{[Gt.current]:We}}).catch(()=>D("草稿保存失败,请返回该组重试"))}Gt.current=ve?.id,ke.current=!0;const Y=yt.current.get(ve?.id??"");Le(Y?.content??""),$e(Y?.targets??null)},[ve?.id]);const xe=A.useRef(null),gr=A.useRef(t);A.useLayoutEffect(()=>{if(gr.current===t)return;gr.current=t;for(const[We,Mt]of Object.entries(t??{}))yt.current.set(We,Mt);const Y=t?.[ve?.id??""];!Y||Y.content===nt.current&&JSON.stringify(Y.targets)===JSON.stringify(Ce.current)||(ke.current=!0,xe.current=null,Le(Y.content),$e(Y.targets))},[t,ve?.id]);const xt=A.useCallback(Y=>{Wa(Y).catch(()=>D("草稿保存失败,请保持面板打开,修改内容后重试"))},[D]);A.useEffect(()=>{if(ke.current){ke.current=!1;return}if(!ve||Gt.current!==ve.id)return;const Y={drafts:{[ve.id]:{content:Xe,targets:$}}};r(ve.id,Y.drafts[ve.id]),xe.current=Y;const We=setTimeout(()=>{xe.current=null,xt(Y)},400);return()=>{clearTimeout(We)}},[ve?.id,Xe,$,xt]),A.useEffect(()=>{const Y=()=>{xe.current&&(xt(xe.current),xe.current=null)},We=()=>{document.visibilityState==="hidden"&&Y()};return document.addEventListener("visibilitychange",We),window.addEventListener("pagehide",Y),()=>{document.removeEventListener("visibilitychange",We),window.removeEventListener("pagehide",Y),Y()}},[xt]),A.useEffect(()=>{if(!(!p||!f||!ve))return Ev(Y=>{Le(We=>We+(We&&!/\s$/.test(We)?`
128
+ `:"")+Y.replace(/\r\n?/g,`
129
+ `))},te,Ht)},[p,f,ve?.id,Ht,te]),A.useEffect(()=>{const Y=St.current;if(!p||!Y)return;const We=Mt=>D(String(Mt.detail));return Y.addEventListener("termdock:file-drop-error",We),()=>Y.removeEventListener("termdock:file-drop-error",We)},[p,ve?.id,D]);const hn=async Y=>{const We=ve?.id;D(null),Ve(Mt=>Mt+1);try{const Mt=await Zd("/tmp",Y);if(Mt.files.length!==Y.length||Mt.files.some(vr=>!vr.path))throw new Error("文件路径准备失败,请重试");const Xt=Mt.files.map(vr=>Pc(vr.path)).join(" ")+" ";if(Gt.current===We)Le(vr=>vr+(vr&&!/\s$/.test(vr)?`
130
+ `:"")+Xt);else if(We){const vr=yt.current.get(We)??{content:"",targets:null},At={...vr,content:vr.content+`
131
+ `+Xt};yt.current.set(We,At),xt({drafts:{[We]:At}})}}catch(Mt){D(Mt instanceof Error?Mt.message:"文件上传失败")}finally{Ve(Mt=>Mt-1)}},Xr=new Set(b.filter(Mf).map(Y=>Y.sessionId)),Rr=q.size,Vr=[...q].filter(Y=>!Xr.has(Y)),Un=JD(ve,b),_r=Ue.trim().toLocaleLowerCase(),is=b.filter(Y=>!_r||[Y.name,Y.serviceLabel??"",Y.cwd,Df(Y.currentTask)].some(We=>We.toLocaleLowerCase().includes(_r))),xr=m5(is),ae=m5(Un),ar=Y=>!_r&&Ae.has(Y),it=Y=>Ke(We=>{const Mt=new Set(We);return Mt.has(Y)?Mt.delete(Y):Mt.add(Y),Mt});A.useEffect(()=>{!c&&x[0]&&u(x[0].id)},[x,c]),A.useEffect(()=>{Fe(!1),gt(!1);try{_e(new Set(JSON.parse(localStorage.getItem(`collab-seen:${ve?.id}`)??"[]")))}catch{_e(new Set)}De(new Set(ve?.sessionIds??[]))},[ve?.id]),A.useEffect(()=>{!ft&&v[0]&&ct(v[0].slug)},[v,ft]),A.useEffect(()=>{if(tt([]),Te(null),!ve){oe(!1);return}oe(!0);let Y=!1,We=0;const Mt=()=>{const vr=++We;X1(ve.id).then(At=>{!Y&&vr===We&&(tt(At.messages),Te(null))}).catch(At=>{!Y&&vr===We&&Te(At instanceof Error?At.message:"消息加载失败")}).finally(()=>{!Y&&vr===We&&oe(!1)})};Mt();const Xt=window.setInterval(Mt,3e3);return()=>{Y=!0,window.clearInterval(Xt)}},[ve?.id]),A.useEffect(()=>{!k||ve?.id!==k||Me.current||(Me.current=!0,St.current?.scrollIntoView?.({block:"nearest"}))},[k,ve?.id]);const os=async()=>{M("create-group"),D(null),F(null);try{if(Vr.length)throw new Error("所选会话已变化,请先清除不可用选择");const Y=await Hc({name:G,sessionIds:[...q]});U(""),be(""),u(Y.group.id),await Z(),F(`“${Y.group.name}”已创建,${Y.group.sessionIds.length} 个会话可以开始协作`)}catch(Y){D(Y instanceof Error?Y.message:"创建失败")}finally{M(null)}},fn=ve?.sessionIds.filter(Y=>$===null||$.includes(Y))??[],Zt=async()=>{if(!ve||N||_t||!Xe.trim()||!fn.length)return;const Y=Xe,We=ve.id;M("send-message"),D(null),F(null);try{const Mt=await Nv(ve.id,{fromSessionId:null,toSessionIds:$===null?void 0:fn,kind:"message",content:Xe});if(Gt.current===We){const Lr=nt.current,jr=Lr===Y?"":Lr.startsWith(Y)?Lr.slice(Y.length).replace(/^\n/,""):Lr;Le(jr),xt({drafts:{[We]:{content:jr,targets:Ce.current}}})}else{const Lr=yt.current.get(We);if(Lr){const jr={...Lr,content:Lr.content===Y?"":Lr.content.startsWith(Y)?Lr.content.slice(Y.length).replace(/^\n/,""):Lr.content};yt.current.set(We,jr),xt({drafts:{[We]:jr}})}}const Xt=await X1(We).catch(()=>null);Xt&&Gt.current===We&&tt(Xt.messages);const vr=Mt.deliveries?.filter(Lr=>Lr.serviceUnavailable).length??0,At=Mt.deliveries?.filter(Lr=>Lr.pending>0).length??0;F(vr>0?`已保存消息;${vr} 个接收成员的服务不可达,尚未送达,等待重连`:At>0?`已保存消息;${At} 个成员等待投递确认`:`消息已送达 ${Mt.messages.length} 个会话`)}catch(Mt){D(Mt instanceof Error?Mt.message:"发送失败")}finally{M(null)}},Yr=async()=>{if(!ve)return;M(`delete:${ve.id}`),D(null),F(null);const Y=ve.name;try{await U5(ve.id),u(null),ie(!1),await Z(),F(`“${Y}”已删除`)}catch(We){D(We instanceof Error?We.message:"删除失败")}finally{M(null)}},Ur=async()=>{if(!ve)return;const Y=[...fe];M("save-members"),D(null),F(null);try{const We=await Hc({id:ve.id,name:ve.name,sessionIds:Y,expectedUpdatedAt:lt});u(We.group.id),Fe(!1),await Z(),F(`“${ve.name}”成员已更新,共 ${Y.length} 个会话`)}catch(We){D(We instanceof Error?We.message:"成员更新失败")}finally{M(null)}},Nr=async Y=>{if(!ve)return;const We=we[Y]??"";M(`role:${Y}`),D(null),F(null);try{await Qv(ve.id,Y,We.trim()||null),await Z(),F(We.trim()?"定位已保存,该成员每次收到消息都会看到":"定位已清除")}catch(Mt){D(Mt instanceof Error?Mt.message:"定位保存失败")}finally{M(null)}},Zn=()=>{const Y=b.find(We=>We.sessionId===w)?.cwd??b.find(We=>ve?.sessionIds.includes(We.sessionId))?.cwd??"";ut(Y),$t(""),It(""),gt(!0),Fe(!1)},Ln=async()=>{if(!(!ve||!ft)){M("spawn-agent"),D(null),F(null);try{const Y=await Rv(ve.id,{agentSlug:ft,name:Kt.trim()||void 0,cwd:Qt.trim()||void 0,task:bt.trim()||void 0,mode:I});gt(!1),await Z(),F(`“${Y.session.name}”已创建并加入“${Y.group.name}”`)}catch(Y){D(Y instanceof Error?Y.message:"Agent Session 创建失败")}finally{M(null)}}},kn=Se.filter(Y=>(!ce||!at.has(Y.id))&&(ee==="all"||Y.responseKind===ee)),as=nQ(kn,b),$n=()=>{const Y=new Set([...at,...kn.map(We=>We.id)].slice(-1e4));try{localStorage.setItem(`collab-seen:${ve?.id}`,JSON.stringify([...Y]))}catch{D("无法保存已看记录,请检查浏览器存储空间");return}_e(Y)},Dr=Y=>a.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-2 py-2.5 transition hover:bg-surface-2",children:[a.jsx("input",{className:"mt-0.5",type:"checkbox",disabled:!Mf(Y),checked:q.has(Y.sessionId),onChange:()=>pe(We=>{const Mt=new Set(We);return Mt.has(Y.sessionId)?Mt.delete(Y.sessionId):Mt.add(Y.sessionId),Mt})}),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:Y.name}),a.jsx(Rf,{session:Y}),a.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground",children:Nf(Y)})]}),a.jsxs("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",children:[Df(Y.currentTask)," · ",Y.cwd]})]})]},Y.sessionId),On=Y=>{const We=we[Y.sessionId]??"",Mt=ve?.roles?.[Y.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:!ve?.sessionIds.includes(Y.sessionId)&&!Mf(Y),checked:fe.has(Y.sessionId),onChange:()=>De(Xt=>{const vr=new Set(Xt);return vr.has(Y.sessionId)?vr.delete(Y.sessionId):vr.add(Y.sessionId),vr})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-[11px] text-foreground",children:Y.name}),a.jsx(Rf,{session:Y}),a.jsxs("span",{className:"block truncate text-[9px] text-muted-foreground",children:[Nf(Y)," · ",Y.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":`${Y.name} 的定位`,className:`${Ei} min-h-8 py-1 text-[10px]`,value:We,maxLength:200,placeholder:"成员收到的定位;清空后保存可移除",onChange:Xt=>me(vr=>({...vr,[Y.sessionId]:Xt.target.value}))}),a.jsx("button",{"aria-label":`保存 ${Y.name} 的定位`,title:We.trim()===Mt?"定位未变化":"保存此成员的定位",disabled:N!==null||We.trim()===Mt,className:`${Wr} min-h-8 shrink-0 px-2 text-muted-foreground`,onClick:()=>{Nr(Y.sessionId)},children:N===`role:${Y.sessionId}`?a.jsx(As,{size:12,className:"animate-spin"}):a.jsx(Uo,{size:12})})]})]},Y.sessionId)};return a.jsxs("div",{className:p?"space-y-0":"space-y-5",children:[de&&a.jsxs("p",{role:"alert",className:"mb-3 rounded-lg bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:["消息同步暂时失败,正在自动重试:",de]}),a.jsxs("div",{hidden:p,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 会话可以把任务直接交给另一个会话。比如“开发”写完代码后通知“测试”检查,测试结果再回复回来;你也可以给单个会话或全组发任务,所有交接和进展都记录在这里。"})]}),ve&&a.jsxs("button",{className:`${Wr} shrink-0 bg-primary text-primary-foreground`,onClick:()=>{u("new"),ie(!1),F(null)},children:[a.jsx(Ri,{size:13}),"新建组"]})]}),x.length>0&&a.jsx("div",{className:"flex gap-2 overflow-x-auto border-b border-border/15 pb-3",children:x.map(Y=>a.jsxs("button",{onClick:()=>u(Y.id),className:`${Wr} shrink-0 ${ve?.id===Y.id?"bg-primary/15 text-primary":"bg-surface-2 text-muted-foreground"}`,children:[Y.name,a.jsx("span",{className:"text-[9px] opacity-70",children:Y.sessionIds.length})]},Y.id))}),!ve&&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] ${Rr>=2?"text-primary":"text-muted-foreground"}`,children:["已选 ",Rr," 个"]})]}),a.jsxs("label",{className:"mt-4 block space-y-1 text-[10px] text-muted-foreground",children:["协作组名称",a.jsx("input",{className:Ei,value:G,onChange:Y=>U(Y.target.value),placeholder:"例如:发布准备"})]}),b.length>5&&a.jsxs("label",{className:"relative mt-3 block",children:[a.jsx("span",{className:"sr-only",children:"筛选会话"}),a.jsx(eu,{size:13,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{className:`${Ei} pl-8`,value:Ue,onChange:Y=>be(Y.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:[xr.length<=1?is.map(Dr):xr.map(Y=>{const We=ar(Y.key);return a.jsxs("div",{children:[a.jsx(g5,{label:Y.label,count:Y.sessions.length,collapsed:We,onToggle:()=>it(Y.key)}),!We&&a.jsx("div",{className:"divide-y divide-border/10",children:Y.sessions.map(Dr)})]},Y.key)}),b.length===0&&a.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:g==="loading"?"正在加载会话…":g==="error"?"会话加载失败,请重试":"当前服务暂无可选会话"}),b.length>0&&is.length===0&&a.jsx("p",{className:"px-3 py-6 text-center text-[11px] text-muted-foreground",children:"没有符合筛选条件的会话"})]}),Vr.length>0&&a.jsxs("div",{role:"alert",className:"mt-2 text-[11px] text-destructive",children:["有 ",Vr.length," 个所选会话暂不可用。",a.jsx("button",{className:Wr,onClick:()=>pe(Y=>new Set([...Y].filter(We=>Xr.has(We)))),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] ${Rr<2?"text-muted-foreground":"text-primary"}`,children:Rr<2?`还需选择 ${2-Rr} 个会话`:"成员已满足要求,可以创建"}),a.jsxs("div",{className:"flex justify-end gap-2",children:[x.length>0&&a.jsx("button",{className:`${Wr} bg-surface-2 text-foreground`,onClick:()=>u(x[0]?.id??null),children:"取消"}),a.jsxs("button",{disabled:N!==null||g!=="loaded"||!G.trim()||Rr<2||Vr.length>0,className:`${Wr} bg-primary text-primary-foreground`,onClick:()=>{os()},children:[N==="create-group"?a.jsx(As,{size:13,className:"animate-spin"}):a.jsx(Ri,{size:13}),"创建协作组"]})]})]})]})]}),ve&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{hidden:p,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:ve.name}),a.jsxs("p",{className:"mt-1 text-[10px] text-muted-foreground",children:[ve.sessionIds.length," 个成员 · 组 ID:",a.jsx("span",{className:"break-all font-mono",children:qD(ve.id)})]})]}),qe?a.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:[a.jsx("button",{className:`${Wr} bg-surface-2 px-2 text-foreground`,onClick:()=>ie(!1),children:"取消"}),a.jsxs("button",{disabled:N!==null,className:`${Wr} bg-destructive px-2 text-destructive-foreground`,onClick:()=>{Yr()},children:[N===`delete:${ve.id}`?a.jsx(As,{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:`${Wr} px-2 text-muted-foreground hover:bg-surface-2 hover:text-foreground`,onClick:()=>{De(new Set(ve.sessionIds)),Tt(ve.updatedAt);const Y=!K;Fe(Y),Y&&me(Object.fromEntries(ve.sessionIds.map(We=>[We,ve.roles?.[We]??""]))),gt(!1)},children:[a.jsx(F5,{size:13}),"管理成员"]}),a.jsxs("button",{className:`${Wr} px-2 text-primary hover:bg-primary/10`,onClick:Zn,children:[a.jsx(Ri,{size:13}),"新建 Agent"]}),a.jsx("button",{"aria-label":`删除协作组 ${ve.name}`,title:"删除协作组",disabled:N!==null,className:"rounded-lg p-2 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",onClick:()=>ie(!0),children:a.jsx(qi,{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:ve.sessionIds.map(Y=>{const We=b.find(Xt=>Xt.sessionId===Y),Mt=ve.roles?.[Y];return a.jsxs("button",{disabled:!We,onClick:()=>We&&void eQ(We).catch(Xt=>D(Xt instanceof Error?Xt.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 ${We?.status==="working"?"bg-primary":We?"bg-[var(--success)]":"bg-muted-foreground"}`}),a.jsx("span",{className:"truncate text-[11px] text-foreground",children:We?.name??Y}),We&&a.jsx(Rf,{session:We}),a.jsx("span",{className:"ml-auto shrink-0 text-[9px] text-muted-foreground",children:We?Nf(We):"已离线"})]}),a.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-[9px] text-muted-foreground",children:[Mt?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"min-w-0 truncate font-medium text-primary/80",children:["定位:",Mt]}),a.jsx("span",{className:"shrink-0 text-muted-foreground/50",children:"·"})]}):null,We?a.jsx("span",{className:"min-w-0 truncate",children:Df(We.currentTask)}):a.jsx("span",{className:"shrink-0",children:"重新上线后可继续接收消息"})]})]},Y)})}),K&&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:["已选 ",fe.size]})]}),a.jsx("div",{className:"mt-3 max-h-72 divide-y divide-border/10 overflow-y-auto border-y border-border/10",children:ae.length<=1?Un.map(On):ae.map(Y=>{const We=ar(Y.key);return a.jsxs("div",{children:[a.jsx(g5,{label:Y.label,count:Y.sessions.length,collapsed:We,onToggle:()=>it(Y.key)}),!We&&a.jsx("div",{className:"divide-y divide-border/10",children:Y.sessions.map(On)})]},Y.key)})}),a.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[a.jsx("button",{className:`${Wr} bg-surface-2 text-foreground`,onClick:()=>{Fe(!1),me({})},children:"取消"}),a.jsxs("button",{disabled:N!==null||g!=="loaded"||fe.size<2,className:`${Wr} bg-primary text-primary-foreground`,onClick:()=>{Ur()},children:[N==="save-members"?a.jsx(As,{size:13,className:"animate-spin"}):a.jsx(Uo,{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:Ei,value:ft,onChange:Y=>ct(Y.target.value),children:v.map(Y=>a.jsxs("option",{value:Y.slug,children:[Y.displayName,Y.isPlugin?" · Plugin":""]},Y.slug))})]}),a.jsxs("label",{className:"space-y-1 text-[9px] text-muted-foreground",children:["会话名称",a.jsx("input",{"aria-label":"新 Agent 会话名称",className:Ei,value:Kt,onChange:Y=>$t(Y.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:Ei,value:Qt,onChange:Y=>ut(Y.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:`${Ei} min-h-16 resize-y`,value:bt,onChange:Y=>It(Y.target.value),placeholder:"说明它加入后要先完成什么"})]}),a.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[a.jsx("button",{className:`${Wr} bg-surface-2 text-foreground`,onClick:()=>gt(!1),children:"取消"}),a.jsxs("button",{disabled:N!==null||!ft,className:`${Wr} bg-primary text-primary-foreground`,onClick:()=>{Ln()},children:[N==="spawn-agent"?a.jsx(As,{size:13,className:"animate-spin"}):a.jsx(Yd,{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:[as.length," 条"]})]}),a.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[a.jsxs("select",{"aria-label":"筛选回复类型",className:`${Ei} w-auto`,value:ee,onChange:Y=>ye(Y.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:ce,onChange:Y=>Ye(Y.target.checked)}),"只看新记录"]}),a.jsx("button",{className:`${Wr} min-h-9 text-muted-foreground`,disabled:!kn.length,onClick:$n,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:[as.map(Y=>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:Y.responseKind==="ack"?"收到确认":Y.responseKind==="progress"?"进展":Y.responseKind==="result"?"结果":rQ(Y.kind)}),a.jsx("span",{children:Y.fromName}),a.jsx("span",{children:"→"}),a.jsx("span",{className:"truncate",children:Y.toNames.join("、")}),a.jsx("span",{className:"ml-auto shrink-0",children:new Date(Y.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("p",{className:"mt-1 whitespace-pre-wrap text-[11px] leading-relaxed text-foreground",children:Y.content}),a.jsx("p",{className:"mt-1 text-[9px] text-muted-foreground",children:Y.status==="pending"?"尚未送达 · 等待连接或接收方读取":Y.status==="read"?"接收方已确认读取 · 不代表任务完成":Y.status==="failed"?"投递失败":Y.status==="expired"?"消息已过期,未继续投递":"已写入接收方终端 · 等待接手确认"}),(Y.task||Y.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(Y.task??{failure_reason:Y.failureReason},null,2)})]})]},Y.key)),as.length===0&&a.jsx(uQ,{text:Ee?"正在加载协作记录…":Se.length?"没有符合筛选条件的新记录。可切换类型或取消“只看新记录”。":"还没有消息。可以先发一个任务或问题。"})]})]})]}),a.jsxs("section",{onFocusCapture:()=>K1(te),onPointerDownCapture:()=>K1(te),"data-termdock-terminal-dropzone":p?w??"collaboration-composer":void 0,onDragOver:Y=>{p&&Y.preventDefault()},onDrop:Y=>{if(!p)return;const We=Array.from(Y.dataTransfer.files);if(!(We.length&&na()))if(Y.preventDefault(),Y.stopPropagation(),We.length)hn(We);else{const Mt=Y.dataTransfer.getData("text/plain")||Y.dataTransfer.getData("text/uri-list");Mt&&Le(Xt=>Xt+(Xt?`
132
+ `:"")+Mt)}},ref:St,className:p?"":"border-t border-primary/20 bg-primary/5 px-3 py-3",children:[!p&&a.jsx("h4",{className:"text-[11px] font-medium text-foreground",children:"发送给成员"}),a.jsx("div",{className:p?"space-y-2":"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:"全组成员"},...ve.sessionIds.map(Y=>({id:Y,label:D6(b.find(We=>We.sessionId===Y),b.filter(We=>ve.sessionIds.includes(We.sessionId)))??`${Y.slice(0,8)}(离线)`}))].map(({id:Y,label:We})=>{const Mt=Y==="*"?$===null:$?.includes(Y)??!1;return a.jsxs("button",{type:"button","aria-pressed":Mt,onClick:()=>$e(Xt=>Y==="*"?null:Xt?.includes(Y)?Xt.filter(vr=>vr!==Y):[...Xt??[],Y]),className:`${Cp} max-w-full gap-1 ${Mt?"border-primary/40 bg-primary/15 text-primary":"border-border/20 bg-surface-2 text-muted-foreground hover:text-foreground"}`,children:[Mt&&a.jsx(Uo,{size:12,"aria-hidden":"true",className:"shrink-0"}),a.jsx("span",{className:"break-words text-left",children:We})]},Y)})})]})}),a.jsxs("label",{className:"mt-2 block space-y-1 text-[9px] text-muted-foreground",children:["内容",a.jsx("textarea",{onKeyDown:Y=>{Y.key==="Enter"&&(Y.metaKey||Y.ctrlKey)&&!Y.nativeEvent.isComposing&&Y.keyCode!==229&&(Y.preventDefault(),Zt())},onPaste:Y=>{const We=Array.from(Y.clipboardData.files);We.length&&(Y.preventDefault(),hn(We))},className:`${Ei} min-h-16 max-h-48 resize-y`,value:Xe,onChange:Y=>Le(Y.target.value),placeholder:"输入消息,可粘贴引用或文件…"})]}),a.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3",children:[a.jsx("p",{role:"status","aria-live":"polite",title:p&&e?e:void 0,className:`min-w-0 flex-1 text-[9px] leading-relaxed ${p?"truncate":""} ${p&&e?"text-primary":"text-muted-foreground"}`,children:_t>0?"正在准备文件路径…":p&&e?e:ve.federated?"消息由服务端后台投递,可查看送达结果;无需保持客户端在线。":"在线成员立即入队;离线成员上线后送达。"}),a.jsxs("button",{disabled:N!==null||_t>0||!Xe.trim()||!fn.length,className:`${Wr} shrink-0 bg-primary text-primary-foreground`,title:"发送(⌘ / Ctrl + Enter)",onClick:()=>{Zt()},children:[N==="send-message"?a.jsx(As,{size:13,className:"animate-spin"}):null,"发送"]})]})]})]})]})}function Mf(e){return!Lp(e.sessionId)||e.serviceConnected!==!1}function XD(e){return e.serviceOrigin?e.serviceOrigin===window.location.origin?"":e.serviceOrigin:Lp(e.sessionId)?.origin??""}function m5(e){const t=new Map;for(const r of e){const s=XD(r),i=t.get(s)??{key:s,label:s?Xl(r):"本机服务",sessions:[]};s&&i.label==="远端服务"&&(i.label=Xl(r)),i.sessions.push(r),t.set(s,i)}return[...t.values()].sort((r,s)=>(r.key?1:0)-(s.key?1:0)||r.label.localeCompare(s.label))}function g5({label:e,count:t,collapsed:r,onToggle:s}){return a.jsxs("button",{type:"button","aria-expanded":!r,onClick:s,className:"flex w-full items-center gap-1.5 bg-surface-2/50 px-2 py-1.5 text-left text-muted-foreground transition hover:bg-surface-elevated",children:[a.jsx(Cl,{size:12,className:`shrink-0 transition-transform ${r?"-rotate-90":""}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-[10px] font-semibold uppercase tracking-wide",children:e}),a.jsx("span",{className:"shrink-0 text-[9px] text-muted-foreground/70",children:t})]})}function JD(e,t){const r=new Map(t.map(s=>[s.sessionId,s]));for(const s of e?.sessionIds??[]){if(r.has(s))continue;const i=e?.remoteSessions?.find(c=>c.sessionId===s);r.set(s,i?{...i,status:"offline",serviceConnected:!1}:{sessionId:s,name:s,backendSessionId:null,cwd:"",agent:null,status:"offline",capability:"",currentTask:"暂不可用,保留成员身份",updatedAt:0,...Lp(s)?{serviceConnected:!1}:{}})}return[...r.values()]}function Rf({session:e}){return!e.serviceOrigin||e.serviceOrigin===window.location.origin?null:a.jsxs("span",{className:"inline-flex max-w-28 shrink-0 items-center gap-1 rounded border border-border/20 px-1 py-0.5 text-[9px] text-muted-foreground",children:[a.jsx(Ip,{size:9}),a.jsx("span",{className:"truncate",children:Xl(e)})]})}function Nf(e){return e.serviceConnected===!1?"服务不可达":tQ(e.status)}function D6(e,t=[]){if(!e)return;const r=t.some(i=>i.sessionId!==e.sessionId&&i.name.trim()===e.name.trim()),s=e.sessionId.startsWith("remote:")?Xl(e):"本机服务";return r?`${e.name} · ${s}`:e.name}async function eQ(e){e.sessionId.startsWith("remote:")?await u6(e.sessionId):window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:e.sessionId}))}function tQ(e){return e==="working"?"处理中":e==="idle"||e==="done"?"可接收":e==="offline"?"已离线":"在线"}function Df(e){if(!e)return"暂无任务摘要";try{const t=JSON.parse(e);if(typeof t.prompt=="string")return Vd(t.prompt)||"暂无任务摘要"}catch{}return Vd(e)||"暂无任务摘要"}function rQ(e){return{message:"消息",ask:"问题",reply:"回复",task:"任务",handoff:"交接",done:"完成"}[e]}function nQ(e,t){const r=new Map(t.map(i=>[i.sessionId,D6(i,t)])),s=new Map;for(const i of e){const c=`${i.threadId}:${i.createdAt}:${i.fromSessionId??"user"}:${i.kind}:${i.responseKind??""}:${JSON.stringify(i.task??null)}:${i.content}`,u=s.get(c),f=r.get(i.toSessionId)??i.toSessionId.slice(0,8);if(u){u.toNames.push(f);const p={failed:-2,expired:-1,pending:0,delivered:1,read:2};p[i.status]<p[u.status]&&(u.status=i.status);continue}s.set(c,{key:c,kind:i.kind,content:i.content,createdAt:i.createdAt,fromName:i.fromSessionId?r.get(i.fromSessionId)??i.fromSessionId.slice(0,8):"你",toNames:[f],status:i.status,responseKind:i.responseKind,task:i.task,failureReason:i.failureReason})}return[...s.values()].sort((i,c)=>c.createdAt-i.createdAt)}function sQ({onClose:e,onNewSession:t,setError:r}){const[s,i]=A.useState(""),[c,u]=A.useState([]),[f,p]=A.useState(!1),g=A.useRef(0);A.useEffect(()=>{const b=s.trim(),v=++g.current;if(u([]),!b){p(!1);return}p(!0);const w=window.setTimeout(()=>{Mv(b).then(k=>{v===g.current&&u(k.results)}).catch(k=>{v===g.current&&r(k instanceof Error?k.message:"搜索失败")}).finally(()=>{v===g.current&&p(!1)})},250);return()=>window.clearTimeout(w)},[s,r]);const x=async b=>{if(b.live){window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:b.sessionId})),e();return}if(b.resumeHistoryId)try{const v=await $5(b.resumeHistoryId);t({mode:"shell",cwd:v.cwd,command:v.command}),e()}catch(v){r(v instanceof Error?v.message:"恢复失败")}};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"sticky -top-4 z-20 -mx-4 -mt-4 border-b border-border/15 bg-surface px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:"全文搜索"}),a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:"搜索会话标题、项目目录、任务内容和终端记录"})]}),a.jsxs("label",{className:"relative mt-3 block",children:[a.jsx("span",{className:"sr-only",children:"搜索全部会话"}),a.jsx(eu,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{autoFocus:!0,className:`${Ei} pl-9 pr-9`,value:s,onChange:b=>{r(null),i(b.target.value)},placeholder:"输入你记得的关键词"}),f?a.jsx(As,{size:13,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"}):s&&a.jsx("button",{type:"button","aria-label":"清空搜索",className:"absolute right-1.5 top-1/2 -translate-y-1/2 rounded-md p-1.5 text-muted-foreground hover:bg-surface-2 hover:text-foreground",onClick:()=>i(""),children:a.jsx(ws,{size:13})})]})]}),!s.trim()&&a.jsxs("div",{className:"border-y border-border/15 py-10 text-center",children:[a.jsx(eu,{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(b=>{const v=b.live||!!b.resumeHistoryId,w=b.live?"打开会话":b.resumeHistoryId?"恢复会话":"仅供查阅",k=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-[12px] font-medium text-foreground",children:b.title}),a.jsx("p",{className:"mt-0.5 truncate text-[9px] text-muted-foreground",children:b.cwd})]}),a.jsx("span",{className:`shrink-0 text-[10px] ${b.live?"text-[var(--success)]":b.resumeHistoryId?"text-primary":"text-muted-foreground"}`,children:w})]}),a.jsx("p",{className:"mt-2 line-clamp-3 text-[10px] leading-relaxed text-foreground/75",children:iQ(b)||"匹配内容来自标题、目录或终端控制信息"}),a.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:[qd(b.updatedAt)," · ",b.matchCount," 处匹配",v?"":" · 没有可恢复记录"]})]});return v?a.jsx("button",{onClick:()=>{x(b)},className:"block w-full px-2 py-3 text-left transition hover:bg-surface-2 focus-visible:bg-surface-2 focus-visible:outline-none",children:k},b.sessionId):a.jsx("article",{className:"px-2 py-3",children:k},b.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:`${Wr} mt-3 bg-surface-2 text-foreground`,onClick:()=>i(""),children:"清空后重试"})]})]})}function Vd(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 iQ(e){let t=Vd(e.snippet);for(const r of[e.title,e.cwd,e.agentSlug])r&&(t=t.split(r).join(" "));return Vd(t)}function oQ(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 aQ(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,i]=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,i,0,0),u.getTime()>t&&e.weekdays.includes(u.getDay()))return u.getTime()}return t}function qd(e){return new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)}function lQ(e){return e==="running"?"投递中":e==="success"?"已投递":e==="failed"?"投递失败":""}function cQ(e){return e==="running"?"text-[var(--warning)]":e==="success"?"text-[var(--success)]":e==="failed"?"text-destructive":"text-muted-foreground"}function uQ({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 dQ(e,t){return Hv(e,t)}function ld(e,t){const r=new Set(e),s=t.filter(c=>c.sessionIds.length>=2&&c.sessionIds.every(u=>r.has(u))),i=new Set;return e.flatMap(c=>{const u=s.find(f=>f.sessionIds.includes(c));return u?i.has(u.id)?[]:(i.add(u.id),[{sessionIds:u.sessionIds,workspace:u}]):[{sessionIds:[c]}]})}function Dc(e,t,r,s=[]){const i=new Map,c=new Map,u=new Set(e.map(x=>x.id));for(const x of s){const b=x.sessionIds.filter(w=>u.has(w));if(b.length<(x.federated?1:2))continue;const v=b.length===x.sessionIds.length?x:{...x,sessionIds:b};b.forEach(w=>i.set(w,v))}for(const x of t)if(!(x.sessionIds.length<2||!x.sessionIds.every(b=>u.has(b)))&&!x.sessionIds.some(b=>i.has(b)))for(const b of x.sessionIds)c.set(b,x);const f=new Set,p=new Set,g=[];for(const x of e){const b=i.get(x.id);if(b){if(f.has(b.id))continue;f.add(b.id);const k=b.sessionIds.flatMap(I=>{const N=r.get(I);return N?[N]:[]});g.push({kind:"collaboration",id:`collaboration:${b.id}`,group:b,members:k,sessionIds:b.sessionIds});continue}const v=c.get(x.id);if(!v){g.push({kind:"session",id:`session:${x.id}`,session:x,sessionIds:[x.id]});continue}if(p.has(v.id))continue;p.add(v.id);const w=v.sessionIds.flatMap(k=>{const I=r.get(k);return I?[I]:[]});g.push({kind:"workspace",id:`workspace:${v.id}`,workspace:v,members:w,sessionIds:v.sessionIds})}return g}function x5(e,t,r){const s=Math.min(e.length,Math.max(0,r)),i=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[...i,t,...c]}function hQ({status:e,detail:t,needsReview:r,inCopyMode:s}){return a.jsx(wD,{status:e,detail:t,needsReview:r,inCopyMode:s})}function b5({isOpen:e,drawerWidthPx:t,onClose:r,onOpen:s,sessions:i,activeSessionId:c,sessionStates:u,onJumpToNextAttention:f,onNewSession:p,onCloseSession:g,onSplitSession:x,onCloseSplit:b,onRemoveFromSplit:v,splitWorkspaces:w,onSetSplitLayout:k,onReorderSplitWorkspace:I,onCombineSplitSessions:N,onReorderSessions:M,onSessionMenu:D,onOpenSettings:F,onOpenQuota:Z,updateState:G,updateActionPending:U=!1,onConfirmUpdateRestart:q,onRetryUpdate:pe,tmuxAvailable:Ue=!0,defaultSessionMode:be="shell",push:Ae,pinned:Ke,runningSessionButtonEnabled:qe=!1,onRunningSessionButtonEnabledChange:ie,onTogglePinned:Se,recoverableTmuxSessions:tt=[],recoverableTmuxSessionsLoading:Ee=!1,onRefreshRecoverableTmuxSessions:oe}){const{t:de}=Gr(),[Te,ee]=A.useState(!1),[,ye]=A.useState(0),[ce,Ye]=A.useState(null),[at,_e]=A.useState(!1),[$,$e]=A.useState(!1),[Xe,Le]=A.useState({}),K=$||Object.keys(Xe).length>0,Fe=A.useRef(!1);A.useEffect(()=>{let P=!1;return V0().then(he=>{P||Fe.current||Le(Object.fromEntries(X5(he.collaborationPanels?.[Xd()]).map(Ne=>[Ne,!0])))}).catch(()=>{}),()=>{P=!0}},[]);const fe=async(P,he)=>{Fe.current=!0,await Wa({floatingGroupId:he},P),Le(Ne=>({...Ne,[P]:he!==null}))},[De,lt]=A.useState([]),[Tt,we]=A.useState(!1),[me,Qe]=A.useState(null),[gt,ft]=A.useState(null),[ct,Kt]=A.useState(null),[$t,Qt]=A.useState(null),ut=async P=>{if(Fe.current=!0,!P){$e(!0);return}const he=Wc.getState().collaborationGroups.find(Re=>Re.id===P),Ne=Ws.getState().docks[P]?.sessionId,je=i.find(Re=>Re.id===Ne)??i.find(Re=>Re.id===c&&he?.sessionIds.includes(Re.id))??i.find(Re=>he?.sessionIds.includes(Re.id));if(je&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:je.id})),Xe[P]===void 0)try{await Wa({floatingGroupId:P},P),Le(Re=>({...Re,[P]:!0}))}catch{Qt("协作面板打开失败,请重试")}},bt=Wc(P=>P.collaborationGroups),It=Wc(P=>P.setCollaborationGroups),[St,Ht]=A.useState({mode:be}),{preference:te,agents:Me,detecting:ve,refresh:_t,selectAgent:Ve}=VD(),yt=A.useRef(null),Gt=A.useRef(null),ke=A.useRef(null),Ce=!!(G?.latestVersion&&["installing","ready","restarting","error"].includes(G.status)),nt=Ft(P=>P.groupByFolder),xe=Ft(P=>P.collapsedGroups),gr=Ft(P=>P.toggleGroupCollapsed),xt=A.useRef(null),hn=A.useRef(null),Xr=A.useRef(null),Rr=A.useRef(0),Vr=A.useRef(!1),Un=A.useRef(null),_r=A.useRef(null),[is,xr]=A.useState(!1),ae=A.useRef([]),ar=A.useRef(null),it=A.useRef(null),os=A.useRef(new Set),fn=A.useRef(null),Zt=A.useMemo(()=>new Set(w.flatMap(P=>P.sessionIds)),[w]),Yr=A.useMemo(()=>new Map(i.map(P=>[P.id,P])),[i]),Ur=A.useMemo(()=>dQ(bt,new Set(Yr.keys())),[bt,Yr]),Nr=A.useCallback(async()=>{const P=++Rr.current;try{const he=await O5();if(P!==Rr.current)return;It(Array.isArray(he.groups)?he.groups:[])}catch{}},[]);A.useEffect(()=>P5(P=>It(P.groups)),[]),A.useEffect(()=>{Nr();const P=window.setInterval(()=>{Nr()},1e4),he=()=>{Nr()};return window.addEventListener("focus",he),()=>{Rr.current+=1,window.clearInterval(P),window.removeEventListener("focus",he)}},[Nr]),A.useEffect(()=>{(e||!K)&&Nr()},[K,e,Nr]);const Zn=A.useCallback(()=>{ae.current=Array.from(document.querySelectorAll("[data-collaboration-member], [data-collaboration-background]")).flatMap(P=>{const he=P.dataset.collaborationMember??"",Ne=P.hasAttribute("data-collaboration-background"),je=P.closest("[data-collaboration-group]")?.dataset.collaborationGroup;if(!he&&!Ne||!je)return[];const Re=[];for(let dt=P.parentElement;dt;dt=dt.parentElement)Re.push({element:dt,top:dt.scrollTop,left:dt.scrollLeft});return[{element:P,sessionId:he,groupId:je,background:Ne,rect:P.getBoundingClientRect(),scrollParents:Re}]})},[]),Ln=A.useCallback((P,he)=>{if(!Vr.current)return;document.querySelectorAll("[data-split-exit-drop-index]").forEach(ht=>ht.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(ht=>ht.removeAttribute("data-drop-active"));const je=document.elementsFromPoint(P,he).map(ht=>ht.closest("[data-collaboration-background]")).find(Boolean)?.closest("[data-collaboration-group]");if(je?.dataset.collaborationGroup){je.dataset.dropActive="true",it.current={kind:"collaboration",groupId:je.dataset.collaborationGroup,background:!0};return}const Re=ae.current.find(ht=>{if(ht.sessionId===_r.current||!ht.element.isConnected)return!1;const Jt=ht.scrollParents.reduce((Nt,pr)=>Nt+pr.element.scrollLeft-pr.left,0),Ir=ht.scrollParents.reduce((Nt,pr)=>Nt+pr.element.scrollTop-pr.top,0);return P>=ht.rect.left-Jt&&P<=ht.rect.right-Jt&&he>=ht.rect.top-Ir+ht.rect.height*.25&&he<=ht.rect.bottom-Ir-ht.rect.height*.25});if(Re?.background){Re.element.closest("[data-collaboration-group]")?.setAttribute("data-drop-active","true"),it.current={kind:"collaboration",groupId:Re.groupId,background:!0};return}if(Re&&!w.find(Jt=>Jt.sessionIds.includes(Re.sessionId))?.sessionIds.includes(_r.current??"")){Re.element.dataset.dropActive="true",it.current={kind:"split",sessionId:Re.sessionId,groupId:Re.groupId};return}const dt=document.elementsFromPoint(P,he).filter(ht=>{const Jt=ht.closest("[data-rfd-draggable-id]");return!Jt||!["session:","split-member:","collaboration-member:"].some(Ir=>Jt.dataset.rfdDraggableId===`${Ir}${_r.current}`)}),wt=dt.map(ht=>ht.closest("[data-collaboration-group]")).find(ht=>ht?.dataset.collaborationGroup);if(wt?.dataset.collaborationGroup){const ht=wt.dataset.collaborationGroup,Jt=dt.map(br=>br.closest("[data-collaboration-split]")).find(Boolean),Ir=dt.map(br=>br.closest("[data-collaboration-member]")).find(Boolean),Nt=Ir?.dataset.collaborationMember??Jt?.dataset.splitAnchor,pr=ht===Un.current&&w.some(br=>br.sessionIds.includes(Nt??"")&&br.sessionIds.includes(_r.current??""));if(Nt&&!pr&&(ht!==Un.current||!Ir&&Jt)){wt.dataset.dropActive="true";const br=Ir??Jt;br&&(br.dataset.dropActive="true"),it.current={kind:"split",sessionId:Nt,groupId:ht}}else{const br=dt.some(Xn=>Xn.closest("[data-collaboration-background]"));(ht!==Un.current||br)&&(wt.dataset.dropActive="true"),it.current={kind:"collaboration",groupId:ht,background:br}}return}const Ge=Array.from(document.querySelectorAll("[data-sidebar-entity-list-id]")).filter(ht=>ht.dataset.sidebarEntityListId===ar.current).find(ht=>{const Jt=ht.getBoundingClientRect();return P>=Jt.left&&P<=Jt.right&&he>=Jt.top-8&&he<=Jt.bottom+8});if(!Ge){it.current=null;return}const ot=Array.from(Ge.children).filter(ht=>ht instanceof HTMLElement&&ht.hasAttribute("data-sidebar-entity-index")),sr=ot.findIndex(ht=>{const Jt=ht.getBoundingClientRect();return he<Jt.top+Jt.height/2}),vt=sr<0?ot.length:sr;it.current={kind:"list",listId:Ge.dataset.sidebarEntityListId??"",index:vt};const zt=Array.from(Ge.querySelectorAll(":scope > [data-sidebar-entity-index] > [data-split-exit-drop-index]")).find(ht=>ht.dataset.splitExitDropIndex===String(vt));zt instanceof HTMLElement&&(zt.dataset.active="true")},[w]);A.useEffect(()=>{const P=Ne=>Ln(Ne.clientX,Ne.clientY),he=Ne=>{const je=Ne.touches[0];je&&Ln(je.clientX,je.clientY)};return window.addEventListener("pointermove",P),window.addEventListener("touchmove",he,{passive:!0}),()=>{window.removeEventListener("pointermove",P),window.removeEventListener("touchmove",he)}},[Ln]);const kn=A.useCallback((P,he)=>{try{P(he)}finally{document.querySelectorAll("[data-sidebar-dragging]").forEach(Ne=>{delete Ne.dataset.sidebarDragging}),Vr.current=!1,ae.current=[],xr(!1),Un.current=null,_r.current=null,ar.current=null,it.current=null,document.querySelectorAll("[data-split-exit-drop-index]").forEach(Ne=>Ne.removeAttribute("data-active")),document.querySelectorAll("[data-drop-active]").forEach(Ne=>Ne.removeAttribute("data-drop-active"))}},[]),as=A.useMemo(()=>i.filter(P=>!Zt.has(P.id)),[i,Zt]),$n=A.useMemo(()=>{let P=0;for(const he of i)u.get(he.id)?.agentStatus==="working"&&(P+=1);return P},[i,u]);A.useLayoutEffect(()=>{const P=xt.current,he=hn.current;if(!e||!P||!he){Xr.current=null;return}const Ne=he.getBoundingClientRect(),je=P.getBoundingClientRect(),Re={item:P,top:Math.round(je.top-Ne.top+he.scrollTop),height:Math.round(je.height),viewportHeight:he.clientHeight},dt=Xr.current;if(Xr.current=Re,dt?.item===Re.item&&dt.top===Re.top&&dt.height===Re.height&&dt.viewportHeight===Re.viewportHeight||Vr.current||he.clientHeight===0)return;const wt=8,Je=je.top-Ne.top,Ge=je.bottom-Ne.top;Je<wt?he.scrollTop+=Je-wt:Ge>he.clientHeight-wt&&(he.scrollTop+=Ge-he.clientHeight+wt)});const Dr=A.useMemo(()=>{if(!nt||!c)return null;const P=u.get(c)?.cwd??null;return Bv(P)},[nt,c,u]);A.useEffect(()=>{if(!nt){fn.current=null,os.current.clear();return}if(!c){fn.current=null;return}const P=Ft.getState(),he=os.current,Ne=fn.current,je=Dr;Ne!==null&&Ne!==je&&he.has(Ne)&&(P.collapsedGroups.has(Ne)||P.toggleGroupCollapsed(Ne),he.delete(Ne)),je!==null&&je!==""&&P.collapsedGroups.has(je)&&(P.toggleGroupCollapsed(je),he.add(je)),fn.current=je},[nt,c,Dr]),A.useEffect(()=>{e||(ee(!1),_e(!1))},[e]),A.useEffect(()=>{Ht(P=>({...P,command:te?.command}))},[te]),A.useEffect(()=>{if(!at)return;let P=!1;return we(!0),ft(null),J1().then(he=>{P||lt(he)}).catch(()=>{P||ft(de("sidebar.resumeHistoryLoadFailed"))}).finally(()=>{P||we(!1)}),()=>{P=!0}},[at,de]),A.useLayoutEffect(()=>{if(!Te)return;const P=yt.current,he=Gt.current;if(!P||!he)return;const Ne=window.visualViewport,je=()=>{const wt=(Ne?.offsetLeft??0)+8,Je=(Ne?.offsetTop??0)+8,Ge=Math.max(0,(Ne?.width??window.innerWidth)-16),ot=Math.max(0,(Ne?.height??window.innerHeight)-16);he.style.maxWidth=`${Ge}px`,he.style.maxHeight=`${ot}px`;const sr=P.getBoundingClientRect(),vt=Math.max(wt,Math.min(sr.right-he.offsetWidth,wt+Ge-he.offsetWidth)),zt=Math.max(Je,Math.min(sr.bottom+4,Je+ot-he.offsetHeight));he.style.left=`${vt-sr.left}px`,he.style.top=`${zt-sr.top}px`};je();const Re=typeof ResizeObserver>"u"?null:new ResizeObserver(je);return Re?.observe(P),Re?.observe(he),window.addEventListener("resize",je),window.addEventListener("scroll",je,!0),Ne?.addEventListener("resize",je),Ne?.addEventListener("scroll",je),()=>{Re?.disconnect(),window.removeEventListener("resize",je),window.removeEventListener("scroll",je,!0),Ne?.removeEventListener("resize",je),Ne?.removeEventListener("scroll",je)}},[Te,t]),A.useEffect(()=>{if(!Te)return;const P=he=>{he instanceof KeyboardEvent&&he.key!=="Escape"||he instanceof MouseEvent&&he.target instanceof Node&&yt.current?.contains(he.target)||ee(!1)};return window.addEventListener("mousedown",P),window.addEventListener("keydown",P),()=>{window.removeEventListener("mousedown",P),window.removeEventListener("keydown",P)}},[Te]),A.useEffect(()=>{if(!ce)return;const P=he=>{he instanceof KeyboardEvent&&he.key!=="Escape"||he instanceof PointerEvent&&he.target instanceof Node&&ke.current?.contains(he.target)||Ye(null)};return window.addEventListener("pointerdown",P),window.addEventListener("keydown",P),()=>{window.removeEventListener("pointerdown",P),window.removeEventListener("keydown",P)}},[ce]);const On=()=>{!Ae&&!Ke&&r()},Y=be==="tmux"&&!Ue?"shell":be,We=()=>{p({mode:Y}),On()},Mt=()=>{te&&(p({mode:Y,command:te.command}),On())},Xt=P=>{Kt(P.name),p({mode:"tmux",tmuxSessionName:P.name,cwd:P.cwd??void 0}),On()};A.useEffect(()=>{ct&&(tt.some(P=>P.name===ct)||Kt(null))},[ct,tt]);const vr=(P,he)=>{p({...St,cwd:St.cwd?.trim()||void 0,command:he??P?.command}),_e(!1),On()},At=async P=>{Qe(P.id),ft(null);try{const he=await $5(P.id);p({mode:"shell",cwd:he.cwd,command:he.command}),_e(!1),On()}catch(he){const Ne=he&&typeof he=="object"&&"code"in he?String(he.code??""):"";ft(de(Ne==="AGENT_SESSION_ACTIVE_ELSEWHERE"?"tab.resumeAgentConflict":"sidebar.resumeHistoryFailed"))}finally{Qe(null)}},Lr=async P=>{lt(he=>he.filter(Ne=>Ne.id!==P));try{await Wv(P)}catch{ft(de("sidebar.resumeHistoryRemoveFailed")),J1().then(lt).catch(()=>{})}},jr=()=>{if(at){_e(!1);return}Ht({mode:be==="tmux"&&!Ue?"shell":be,cwd:c?u.get(c)?.cwd??void 0:void 0,command:te?.command}),_e(!0)},Jr=A.useCallback(P=>{const he=u.get(P);return he?.agentStatus==="waiting"||he?.agentNeedsReview?"bg-[rgb(var(--warning-rgb)_/_0.10)] text-foreground":he?.agentStatus==="working"?"bg-[rgb(var(--success-rgb)_/_0.08)] text-foreground":he?.inCopyMode?"bg-[rgb(var(--tmux-rgb)_/_0.08)] text-foreground":null},[u]),Ts=c6(),Nn=A.useCallback((P,he,Ne,je)=>{const Re=P.id===c,dt=Zt.has(P.id),wt=!!(Ne&&dt),Je=u.get(P.id),Ge=Zc(Je?.cwd??null),ot=Je?.shellTitle??jv(P.id),sr=ot===Je?.cwd||ot===Ge?null:ot,vt=Pv(P,Je?.activeProgram??null,null,Ov,sr,Je?.promptState??null),zt=!!(Je?.tuiProgress&&Je.tuiProgress.state!=="remove"),Jt=Je?.promptState==="running"||Je?.agentStatus==="working"||zt?"bg-[var(--success)]":Je?.agentStatus==="waiting"||Je?.agentNeedsReview?"bg-[var(--warning)]":Je?.inCopyMode?"bg-[var(--tmux)]":"bg-primary";return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:Re?xt:null,type:"button",...he??{},onContextMenu:Ir=>{D&&(Ir.preventDefault(),D(P.id,{x:Ir.clientX,y:Ir.clientY}))},onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:P.id})),On()},className:`sidebar-session-primary relative min-w-0 flex flex-1 items-center overflow-hidden text-left ${he?"cursor-grab active:cursor-grabbing ":""}${Ne?"gap-1.5 py-0.5 pl-1.5 pr-0.5":"gap-1.5 py-1 pl-2 pr-1"}`,title:Je?.cwd??P.name,children:[Re&&a.jsx("span",{className:`absolute inset-y-2 left-0 w-0.5 rounded-full ${Jt}`}),a.jsxs("span",{className:`relative inline-flex shrink-0 items-center justify-center rounded-md ${Ne?"h-5 w-[22px]":"h-[22px] w-[22px]"} ${Re?P.mode==="tmux"?"bg-[rgb(var(--tmux-rgb)_/_0.15)] text-[color:var(--tmux)]":"bg-primary/15 text-primary":P.mode==="tmux"?"bg-surface text-[rgb(var(--tmux-rgb)_/_0.80)]":"bg-surface text-muted-foreground"}`,children:[Je?.isConnecting||zt&&!Je?.agentStatus?a.jsx(Sn,{size:Ne?10:11,className:"animate-spin"}):Je?.agent??em(P.id)?a.jsx(Yl,{agent:Je?.agent??em(P.id),size:Ne?13:15}):P.mode==="tmux"?a.jsx(F0,{size:Ne?10:11}):a.jsx($o,{size:Ne?10:11}),a.jsx(hQ,{status:Je?.agentStatus??null,detail:Je?.agentStatusDetail,needsReview:Je?.agentNeedsReview,inCopyMode:Je?.inCopyMode})]}),a.jsx("span",{className:`min-w-0 flex-1 truncate leading-tight ${Ne?"text-[11px]":"text-[12px]"} ${Re?"font-medium text-foreground":""} ${Je?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:vt}),a.jsx(E2,{sessionIds:[P.id]})]}),je,a.jsx("button",{type:"button",onClick:Ir=>{Ir.stopPropagation(),wt?v(P.id):dt?b(P.id):x(P.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 ${Ne?"h-6 w-6":"h-[26px] w-[26px]"} ${dt?"bg-primary/15 text-primary":"text-muted-foreground/70"}`,"aria-label":`${de(wt?"tab.splitRemovePane":dt?"tab.splitClose":"tab.split")} ${vt}`,title:de(wt?"tab.splitRemovePane":dt?"tab.splitClose":"tab.split"),children:wt?a.jsx(R9,{size:11}):a.jsx(zl,{size:12})}),a.jsx("button",{type:"button",onClick:Ir=>{Ir.stopPropagation(),g(P.id,Ir)},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 ${Ne?"h-6 w-6":"h-[26px] w-[26px]"}`,"aria-label":de("sidebar.closeSession",{name:vt}),title:de("common.close"),children:a.jsx(ws,{size:Ne?11:12})})]})},[c,Zt,u,g,x,b,v,D,de]),$r=A.useMemo(()=>Cd(i,P=>u.get(P.id)?.cwd??null,nt,de("sidebar.ungrouped"),w,Ur).groups,[Ur,nt,i,u,w,de]),zr=A.useMemo(()=>Dc(i,w,Yr,Ur),[Ur,i,Yr,w]),Pr=A.useCallback(P=>{xr(P.draggableId.startsWith("collaboration:")||P.draggableId.startsWith("workspace:"));const he=P.draggableId.replace(/^split-member:/,"");_r.current=P.draggableId.replace(/^(?:session|split-member|collaboration-member):/,"");const Ne=P.type==="split-member"?w.find(Je=>Je.sessionIds.includes(he)):null,je=P.type==="collaboration-member"?P.source.droppableId.replace(/^collaboration-members:/,""):null,Re=je?Ur.find(Je=>Je.id===je):null;Vr.current=!!(Ne||Re||P.type==="session"&&P.draggableId.startsWith("session:")),Vr.current&&document.querySelectorAll("[data-collaboration-group]").forEach(Je=>{Je.dataset.sidebarDragging="true"}),Un.current=Re?.id??null;const dt=Ne?.sessionIds??Re?.sessionIds??[],wt=dt.length>0?$r.find(Je=>dt.every(Ge=>Je.sessions.some(ot=>ot.id===Ge))):null;ar.current=nt?wt?`group-sessions:${wt.key}`:null:dt.length>0?"sidebar-entities":null,it.current=null},[Ur,$r,nt,w]),pn=A.useCallback((P,he,Ne)=>{if(he===Ne)return;const je=he?bt.find(Ge=>Ge.id===he):null,Re=Ne?bt.find(Ge=>Ge.id===Ne):null;if(Ne&&!Re)return;if(Re){const Ge=i.map(sr=>sr.id).filter(sr=>sr!==P);let ot=-1;Ge.forEach((sr,vt)=>{Re.sessionIds.includes(sr)&&(ot=vt)}),ot>=0&&(Ge.splice(ot+1,0,P),M(Ge))}const dt=je?.sessionIds.filter(Ge=>Ge!==P)??[],wt=Re?[...Re.sessionIds.filter(Ge=>Ge!==P),P]:[];It(Ge=>Ge.flatMap(ot=>ot.id===he?dt.length>=2?[{...ot,sessionIds:dt}]:[]:ot.id===Ne?[{...ot,sessionIds:wt}]:[ot])),Qt(null),(je&&Re?Fv({sourceGroupId:je.id,targetGroupId:Re.id,sessionId:P,expectedSourceUpdatedAt:je.updatedAt,expectedTargetUpdatedAt:Re.updatedAt}):je?dt.length>=2?Hc({id:je.id,name:je.name,sessionIds:dt,expectedUpdatedAt:je.updatedAt}):U5(je.id,je.updatedAt):Re?Hc({id:Re.id,name:Re.name,sessionIds:wt,expectedUpdatedAt:Re.updatedAt}):Promise.resolve()).then(()=>Nr(),Ge=>(Qt(Ge instanceof Error?Ge.message:"协作成员移动失败"),Nr()))},[bt,Nr,i,M]),Dn=A.useCallback((P,he,Ne)=>{const je=bt.find(Ge=>Ge.id===P);if(!je||he===Ne)return;const Re=je.sessionIds.filter(Ge=>!Ge.startsWith("remote:")),dt=ld(Re,w).flatMap(Ge=>Ge.sessionIds),[wt]=dt.splice(he,1);if(!wt)return;dt.splice(Ne,0,wt);const Je=w.find(Ge=>Ge.sessionIds.includes(wt));if(Je&&Je.sessionIds.every(Ge=>je.sessionIds.includes(Ge))){const Ge=dt.filter(ot=>Je.sessionIds.includes(ot));I(Je.id,Ge)}dt.push(...je.sessionIds.filter(Ge=>Ge.startsWith("remote:"))),It(Ge=>Ge.map(ot=>ot.id===P?{...ot,sessionIds:dt}:ot)),Qt(null),Hc({id:je.id,name:je.name,sessionIds:dt,expectedUpdatedAt:je.updatedAt}).then(()=>Nr(),Ge=>(Qt(Ge instanceof Error?Ge.message:"成员排序失败"),Nr()))},[bt,Nr,w,I]);A.useEffect(()=>{const P=he=>{const{sourceId:Ne,targetId:je}=he.detail;if(!Ne||!je||Ne===je)return;const Re=Cd(i,Nt=>u.get(Nt.id)?.cwd??null,nt,"",w,Ur).arranged.map(Nt=>Nt.id),dt=Re.indexOf(Ne),wt=Re.indexOf(je);if(dt<0||wt<0)return;const Je=Ur.find(Nt=>Nt.sessionIds.includes(Ne));if(Je?.sessionIds.includes(je)){const Nt=ld(Je.sessionIds,w).flatMap(pr=>pr.sessionIds);Dn(Je.id,Nt.indexOf(Ne),Nt.indexOf(je));return}const Ge=w.filter(Nt=>Nt.sessionIds.length>=2&&Nt.sessionIds.every(pr=>Yr.has(pr))&&!Ur.some(pr=>Nt.sessionIds.some(br=>pr.sessionIds.includes(br)))),ot=Ge.find(Nt=>Nt.sessionIds.includes(Ne));if(ot?.sessionIds.includes(je)){const Nt=[...ot.sessionIds];Nt.splice(Nt.indexOf(Ne),1),Nt.splice(ot.sessionIds.indexOf(je),0,Ne),I(ot.id,Nt);return}const sr=Nt=>Ur.find(pr=>pr.sessionIds.includes(Nt))?.sessionIds??Ge.find(pr=>pr.sessionIds.includes(Nt))?.sessionIds??[Nt],vt=new Set(sr(Ne)),zt=new Set(sr(je)),ht=Re.filter(Nt=>!vt.has(Nt)),Jt=ht.flatMap((Nt,pr)=>zt.has(Nt)?[pr]:[]),Ir=dt<wt?Math.max(...Jt)+1:Math.min(...Jt);ht.splice(Ir,0,...Re.filter(Nt=>vt.has(Nt))),M(ht)};return window.addEventListener("reorder-navigation-session",P),()=>window.removeEventListener("reorder-navigation-session",P)},[i,u,nt,w,Ur,Yr,Dn,I,M]);const cs=A.useCallback(P=>{if(P.type!=="collaboration-member")return!1;if(P.reason==="CANCEL")return!0;const he=P.source.droppableId.replace(/^collaboration-members:/,""),Ne=P.draggableId.replace(/^collaboration-member:/,""),je=it.current;if(je?.kind==="split")return pn(Ne,he,je.groupId),N(je.sessionId,Ne),!0;if(je?.kind==="collaboration"&&je.groupId!==he)return pn(Ne,he,je.groupId),!0;if(je?.kind==="collaboration"&&je.background)return Zt.has(Ne)&&v(Ne),!0;if(P.destination&&P.destination.droppableId!==P.source.droppableId){const Re=P.destination.droppableId.replace(/^collaboration-members:/,"");if(Ur.some(dt=>dt.id===Re))return pn(Ne,he,Re),!0}if(P.combine){const Re=P.combine.droppableId.replace(/^collaboration-members:/,"");Re!==he&&pn(Ne,he,Re);const dt=P.combine.draggableId.replace(/^collaboration-member:/,"");if(w.find(Je=>Je.sessionIds.includes(Ne))?.sessionIds.includes(dt)){const Je=Ur.find(ot=>ot.id===he),Ge=Je?ld(Je.sessionIds,w).flatMap(ot=>ot.sessionIds).indexOf(dt):-1;Ge>=0&&Dn(he,P.source.index,Ge)}else Yr.has(dt)&&N(dt,Ne);return!0}if(P.destination?.droppableId===P.source.droppableId)return Dn(he,P.source.index,P.destination.index),!0;if(je?.kind!=="list")return!0;if(je?.kind==="list"){const Re=$r.find(wt=>`group-sessions:${wt.key}`===je.listId),dt=je.listId==="sidebar-entities"?zr:Re?Dc(Re.sessions,w,Yr,Ur):null;if(dt){const wt=x5(dt,Ne,je.index);je.listId==="sidebar-entities"?M(wt):Re&&M($r.flatMap(Je=>Je.key===Re.key?wt:Je.sessions.map(Ge=>Ge.id)))}}return pn(Ne,he,null),!0},[Ur,zr,$r,pn,M,Dn,Yr,w,Zt,v,N]),Ti=A.useCallback(P=>{if(P.type!=="split-member")return!1;if(P.reason==="CANCEL")return!0;const he=P.draggableId.replace(/^split-member:/,""),Ne=w.find(Ge=>Ge.sessionIds.includes(he));if(!Ne?.sessionIds.includes(he))return!0;const je=Ne.id,Re=it.current;if(Re?.kind==="split")return pn(he,null,Re.groupId),N(Re.sessionId,he),!0;if(Re?.kind==="collaboration")return pn(he,null,Re.groupId),!0;if(!P.destination&&Re?.kind==="list"){const Ge=$r.find(vt=>`group-sessions:${vt.key}`===Re.listId),ot=Re.listId==="sidebar-entities"?zr:Ge?Dc(Ge.sessions,w,Yr,Ur):null;if(!ot)return!0;const sr=x5(ot,he,Re.index);return v(he),Re.listId==="sidebar-entities"?M(sr):Ge&&M($r.flatMap(vt=>vt.key===Ge.key?sr:vt.sessions.map(zt=>zt.id))),!0}if(!P.destination)return!0;const dt=P.destination.droppableId.replace(/^split-members:/,"");if(dt!==je){const ot=w.find(sr=>sr.id===dt)?.sessionIds[0];return ot&&N(ot,he),!0}if(P.source.index===P.destination.index)return!0;const wt=[...Ne.sessionIds],[Je]=wt.splice(P.source.index,1);return Je&&(wt.splice(P.destination.index,0,Je),I(je,wt)),!0},[Ur,zr,$r,pn,N,v,M,I,Yr,w]),kr=(P,he="top")=>a.jsx("div",{"data-split-exit-drop-index":P,className:`group/split-exit pointer-events-none absolute inset-x-0 z-10 h-2 ${he==="top"?"-top-1":"-bottom-1"}`,children:a.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-1 top-1/2 h-px -translate-y-1/2 rounded-full bg-transparent transition-colors group-data-[active=true]/split-exit:bg-primary"})}),Yn=A.useCallback((P,he,Ne)=>{if(cs(P)||Ti(P)||P.reason==="CANCEL")return;const je=he.find(Ge=>Ge.id===P.draggableId);if(!je)return;const Re=it.current;if(Re?.kind==="split"&&je.kind==="session"){pn(je.session.id,null,Re.groupId),N(Re.sessionId,je.session.id);return}if(Re?.kind==="collaboration"&&je.kind==="session"){pn(je.session.id,null,Re.groupId);return}if(P.combine&&je.kind!=="session"){const Ge=he.findIndex(ot=>ot.id===P.combine?.draggableId);if(Ge<0)return;P={...P,combine:null,destination:{...P.source,index:Ge}}}if(P.combine){const Ge=he.find(ht=>ht.id===P.combine?.draggableId);if(!Ge)return;const ot=Ge.kind==="workspace"?Ge:je.kind==="workspace"?je:Ge,sr=ot===je?Ge:je,vt=ot.sessionIds[0],zt=sr.sessionIds[0];vt&&zt&&vt!==zt&&N(vt,zt);return}if(!P.destination||P.source.index===P.destination.index)return;const dt=[...he],[wt]=dt.splice(P.source.index,1);if(!wt)return;dt.splice(P.destination.index,0,wt);const Je=dt.flatMap(Ge=>Ge.sessionIds);if(Ne===void 0){M(Je);return}M($r.flatMap(Ge=>Ge.key===Ne?Je:Ge.sessions.map(ot=>ot.id)))},[$r,cs,Ti,pn,N,M]),ur=A.useCallback(P=>{if(P.reason==="CANCEL"||cs(P)||Ti(P))return;if(P.type==="group"){if(!P.destination||P.source.index===P.destination.index)return;M(z5($r,P.source.index,P.destination.index));return}const he=P.source.droppableId.replace(/^group-sessions:/,""),Ne=$r.find(Re=>Re.key===he);if(!Ne)return;const je=Dc(Ne.sessions,w,Yr,Ur);if(P.combine||it.current?.kind==="collaboration"||it.current?.kind==="split"){Yn(P,je,he);return}!P.destination||P.destination.droppableId!==P.source.droppableId||Yn(P,je,he)},[Ur,$r,Yr,w,cs,Yn,Ti,M]),Kr=P=>{const he=ce===P.id,Ne=[{layout:"horizontal",label:de("tab.splitHorizontal"),icon:zl},{layout:"vertical",label:de("tab.splitVertical"),icon:am},...P.sessionIds.length>=3||P.layout==="grid"?[{layout:"grid",label:de("tab.splitGrid"),icon:im}]:[]],je=P.layout==="vertical"?am:P.layout==="grid"?im:zl,Re=Ne.find(dt=>dt.layout===P.layout)?.label??de("tab.splitHorizontal");return a.jsxs("div",{ref:he?ke:void 0,className:"relative shrink-0",onPointerDown:dt=>dt.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 ${he?"bg-primary/15 text-primary":"text-muted-foreground/70 hover:bg-surface-2 hover:text-foreground"}`,"aria-label":`${de("tab.splitLayout")}: ${Re}`,"aria-haspopup":"menu","aria-expanded":he,title:de("tab.splitLayout"),onClick:dt=>{dt.stopPropagation(),Ye(wt=>wt===P.id?null:P.id)},children:a.jsx(je,{size:12})}),he&&a.jsx("div",{role:"menu","aria-label":de("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:Ne.map(dt=>{const wt=dt.icon,Je=dt.layout===P.layout;return a.jsx("button",{type:"button",role:"menuitemradio","aria-checked":Je,"aria-label":dt.label,title:dt.label,className:`sidebar-session-action inline-flex h-7 w-7 items-center justify-center rounded-sm transition active:scale-95 ${Je?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,onClick:Ge=>{Ge.stopPropagation(),k(P.sessionIds[0],dt.layout),Ye(null)},children:a.jsx(wt,{size:13})},dt.layout)})})]})},sn=(P,he)=>he&&a.jsx("button",{type:"button",...he,"aria-label":P,title:P,onClick:Ne=>Ne.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(Kd,{size:10})}),Kn=(P,he,Ne=!1,je=!1,Re)=>{if(he.length<2)return null;const dt=he.some(vt=>vt.id===c),wt=[],Je=[],Ge=[];for(const vt of he){const zt=u.get(vt.id);zt?.agentStatus==="waiting"||zt?.agentNeedsReview?wt.push(vt):zt?.agentStatus==="working"?Je.push(vt):zt?.inCopyMode&&Ge.push(vt)}const ot=P.name?.trim()||`${de("tab.splitWorkspace")} ${w.findIndex(vt=>vt.id===P.id)+1}`,sr=ce===P.id;return a.jsxs("section",{"data-split-workspace":P.id,"aria-label":ot,className:`group/split relative rounded-md p-0.5 before:pointer-events-none before:absolute before:inset-0 before:rounded-md before:border before:border-border transition-colors ${je?"bg-primary/15 ring-1 ring-primary/40":Ne?"bg-surface-elevated opacity-90 shadow-lg":wt.length>0?"bg-[rgb(var(--warning-rgb)_/_0.08)] hover:bg-[rgb(var(--warning-rgb)_/_0.12)]":Je.length>0?"bg-[rgb(var(--success-rgb)_/_0.06)] hover:bg-[rgb(var(--success-rgb)_/_0.10)]":Ge.length>0?"bg-[rgb(var(--tmux-rgb)_/_0.07)] hover:bg-[rgb(var(--tmux-rgb)_/_0.11)]":dt?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[sn(`移动分屏组 ${ot}`,Re),a.jsx(Ha,{droppableId:`split-members:${P.id}`,type:"split-member",direction:"vertical",children:(vt,zt)=>a.jsxs("div",{ref:vt.innerRef,...vt.droppableProps,"data-split-members":!0,className:zt.isDraggingOver?"rounded-sm bg-primary/10 ring-1 ring-primary/40":"",children:[he.map((ht,Jt)=>a.jsx(za,{draggableId:`split-member:${ht.id}`,index:Jt,disableInteractiveElementBlocking:!0,children:(Ir,Nt)=>a.jsx("div",{ref:Ir.innerRef,...Ir.draggableProps,...D?Ts(()=>D(ht.id)):{},className:`${Jt===0&&sr?"relative z-20 ":"relative "}flex items-center rounded-sm pr-0.5 transition-colors ${Nt.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${Jr(ht.id)??(ht.id===c?"bg-surface-elevated/80 text-foreground":"text-muted-foreground hover:bg-surface-2")}`,children:Nn(ht,Ir.dragHandleProps,!0,Jt===0?Kr(P):void 0)})},ht.id)),vt.placeholder]})})]})},hs=(P,he,Ne,je=!1,Re=!1)=>{if(he.length<(P.federated?1:2))return null;const dt=he.some(ot=>ot.id===c),wt=ld(P.sessionIds,w),Je=wt.flatMap(ot=>ot.sessionIds),Ge=wt.length===1?wt[0]?.workspace:void 0;return a.jsxs("section",{"data-collaboration-group":P.id,"data-collaboration-group-name":P.name,"aria-label":`Agent 工作组:${P.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 ${Re?"bg-primary/15 ring-1 ring-primary/40":je?"bg-surface-elevated opacity-90 shadow-lg":dt?"bg-primary/[0.07]":"hover:bg-surface-2"}`,children:[sn(`移动工作组 ${P.name}`,Ne),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:`打开 ${P.name} 的协作消息`,"aria-label":`打开 Agent 工作组消息:${P.name}`,onClick:ot=>{ot.stopPropagation(),ut(P.id)},children:a.jsx(lm,{size:9})}),a.jsx(Ha,{droppableId:`collaboration-members:${P.id}`,type:"collaboration-member",direction:"vertical",isCombineEnabled:!0,children:(ot,sr)=>a.jsxs("div",{ref:ot.innerRef,...ot.droppableProps,"data-collaboration-members":!0,className:`${sr.isDraggingOver?"rounded-sm bg-primary/10":""}`,children:[wt.map(vt=>a.jsx("div",{"data-collaboration-split":vt.workspace?.id,"data-split-anchor":vt.workspace?.sessionIds[0],role:vt.workspace?"region":void 0,"aria-label":vt.workspace?`${de("tab.splitWorkspace")} · ${vt.sessionIds.length}`:void 0,className:vt.workspace&&!Ge?`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 ${vt.sessionIds.includes(c??"")?"bg-primary/[0.07]":"bg-surface/35"}`:void 0,children:vt.sessionIds.map(zt=>{const ht=Yr.get(zt);return ht?a.jsx(za,{draggableId:`collaboration-member:${ht.id}`,index:Je.indexOf(ht.id),disableInteractiveElementBlocking:!0,children:(Jt,Ir)=>a.jsxs("div",{ref:Jt.innerRef,...Jt.draggableProps,"data-collaboration-member":ht.id,"data-split-member":Zt.has(ht.id)?"true":void 0,...D?Ts(()=>D(ht.id)):{},className:`${vt.workspace&&zt===vt.sessionIds[0]&&ce===vt.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 ${Ir.combineTargetFor?"bg-primary/15 ring-1 ring-primary/40 ":Ir.isDragging?"bg-surface-elevated opacity-90 shadow-lg ":""}${Jr(ht.id)??(ht.id===c?"bg-surface-elevated/80 text-foreground":Zt.has(ht.id)?"bg-primary/[0.05] text-muted-foreground hover:bg-primary/[0.09]":"text-muted-foreground hover:bg-surface-2")}`,children:[Nn(ht,Jt.dragHandleProps,!0,vt.workspace&&zt===vt.sessionIds[0]?Kr(vt.workspace):void 0),!vt.workspace&&Zt.has(ht.id)&&a.jsx("button",{type:"button",className:"shrink-0 px-1 text-[10px] text-primary",title:`与 ${w.find(Nt=>Nt.sessionIds.includes(ht.id))?.sessionIds.filter(Nt=>Nt!==ht.id).map(Nt=>Yr.get(Nt)?.name??Nt).join("、")} 分屏`,"aria-label":`查看 ${ht.name} 的跨组分屏`,onClick:()=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:ht.id})),On()},children:a.jsx(zl,{size:10})})]})},ht.id):null})},vt.workspace?.id??vt.sessionIds[0])),ot.placeholder]})}),P.remoteSessions?.map(ot=>a.jsxs("button",{type:"button",title:`${Xl(ot)} · ${ot.serviceConnected===!1?"服务不可达,消息尚未送达":ot.status}`,className:"flex w-full min-w-0 items-center gap-1.5 rounded-sm px-2 py-1 text-left text-[11px] text-muted-foreground hover:bg-surface-2",onClick:()=>{u6(ot.sessionId).catch(()=>{ut(P.id)})},children:[a.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${ot.serviceConnected===!1?"bg-muted-foreground":"bg-primary"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:ot.name}),a.jsx("span",{className:"max-w-20 truncate rounded border border-border/20 px-1 text-[9px]",children:Xl(ot)}),ot.serviceConnected===!1&&a.jsx("span",{className:"shrink-0 text-[9px]",children:"不可达"})]},ot.sessionId)),a.jsx("div",{"data-collaboration-background":!0,className:"h-1.5"})]})},Or=(P,he,Ne)=>a.jsx($d,{onBeforeCapture:Zn,onDragStart:Pr,onDragEnd:je=>kn(Re=>Yn(Re,P,Ne),je),children:a.jsx(Ha,{droppableId:he,direction:"vertical",isCombineEnabled:!is,children:je=>a.jsxs("div",{ref:je.innerRef,...je.droppableProps,"data-sidebar-entity-list-id":he,className:"space-y-0.5",children:[P.map((Re,dt)=>a.jsx(za,{draggableId:Re.id,index:dt,disableInteractiveElementBlocking:!0,children:(wt,Je)=>a.jsxs("div",{ref:wt.innerRef,...wt.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":dt,className:"relative",children:[kr(dt),dt===P.length-1&&kr(P.length,"bottom"),Re.kind==="workspace"?Kn(Re.workspace,Re.members,Je.isDragging,!!Je.combineTargetFor,wt.dragHandleProps):Re.kind==="collaboration"?hs(Re.group,Re.members,wt.dragHandleProps,Je.isDragging,!!Je.combineTargetFor):a.jsx("div",{...D?Ts(()=>D(Re.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${Je.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":Je.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":Jr(Re.session.id)??(Re.session.id===c?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:Nn(Re.session,wt.dragHandleProps)})]})},Re.id)),je.placeholder]})})}),mn=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:de("sidebar.sessions")}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:i.length}),$n>0&&a.jsx("span",{className:"ml-0.5 flex items-center",children:a.jsx(_6,{count:$n,tone:"running",title:de("agent.aiRunning")})})]})}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[a.jsxs("div",{ref:yt,className:Te?"relative z-20":"relative",children:[a.jsxs("button",{type:"button",onClick:()=>ee(P=>!P),className:`relative inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg transition active:scale-95 ${Te?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,"aria-expanded":Te,"aria-haspopup":"menu","aria-label":Ce&&G?.latestVersion?`${de("sidebar.moreActions")}: ${de("sidebar.updateAvailable",{version:G.latestVersion})}`:de("sidebar.moreActions"),title:Ce&&G?.latestVersion?`${de("sidebar.moreActions")}: ${de("sidebar.updateAvailable",{version:G.latestVersion})}`:de("sidebar.moreActions"),children:[a.jsx(P0,{size:15}),Ce&&a.jsx("span",{className:"absolute right-0.5 top-0.5 z-10 h-2 w-2 rounded-full bg-[var(--warning)] ring-2 ring-[var(--chrome-bg)]","aria-hidden":"true"})]}),Te&&a.jsxs("div",{ref:Gt,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:[Ce&&G?.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(As,{size:13,className:G.status==="installing"||G.status==="restarting"?"animate-spin":""})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-semibold",children:de("sidebar.updateAvailable",{version:G.latestVersion})}),a.jsx("span",{className:"mt-0.5 block text-[10.5px] leading-relaxed text-muted-foreground",children:G.status==="installing"?de("sidebar.updateInstalling"):G.status==="ready"?de("sidebar.updateReady"):G.status==="restarting"?de("sidebar.updateRestarting"):de("sidebar.updateFailed")})]})]}),G.status==="ready"&&q&&a.jsx("button",{type:"button",role:"menuitem",disabled:U,onClick:q,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:de("sidebar.updateRestart")}),G.status==="error"&&pe&&a.jsx("button",{type:"button",role:"menuitem",disabled:U,onClick:pe,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:de("sidebar.updateRetry")})]}),ie&&a.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":qe,onClick:()=>ie(!qe),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:de("sidebar.runningSessionButtonHint"),children:[a.jsx(Sn,{size:14,className:qe?"text-[color:var(--success)]":"text-muted-foreground"}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block",children:de("sidebar.runningSessionButton")}),a.jsx("span",{className:"mt-0.5 block text-[10px] leading-tight text-muted-foreground",children:de("sidebar.runningSessionButtonHint")})]}),a.jsx($a,{checked:qe,size:"sm"})]}),Z&&a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ee(!1),Z()},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(g8,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:de("sidebar.subscriptionQuota")})]}),a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ee(!1),ut(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(lm,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:"Agent 工作台"})]}),a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ee(!1),$v()},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:"服务与设备"})]}),a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ee(!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(w9,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:de("sidebar.settings")})]}),Se&&a.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ee(!1),Se()},className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left transition ${Ke?"text-primary hover:bg-primary/10":"text-foreground hover:bg-surface-2"}`,children:[Ke?a.jsx(Jc,{size:14}):a.jsx(Xc,{size:14,className:"text-muted-foreground"}),a.jsx("span",{children:de(Ke?"sidebar.unpinSidebar":"sidebar.pinSidebar")})]})]})]}),(!Ae||Ke)&&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":de("common.close"),children:a.jsx(ws,{size:14})})]})]})]}),$t&&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:$t}),a.jsx("button",{type:"button","aria-label":"关闭协作错误提示",className:"shrink-0",onClick:()=>Qt(null),children:a.jsx(ws,{size:14})})]}),a.jsxs("div",{ref:hn,className:"relative z-10 min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pt-0.5 pb-1.5",children:[tt.length>0&&a.jsxs("section",{className:"mb-2 rounded-lg bg-[rgb(var(--tmux-rgb)_/_0.07)] p-1","aria-label":de("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(Hl,{size:12,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:de("sidebar.recoverableSessions")}),a.jsx("span",{className:"text-muted-foreground",children:tt.length}),oe&&a.jsx("button",{type:"button",onClick:oe,disabled:Ee,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":de("sidebar.refreshRecoverableSessions"),title:de("sidebar.refreshRecoverableSessions"),children:a.jsx(As,{size:11,className:Ee?"animate-spin":""})})]}),a.jsx("div",{className:"space-y-0.5",children:tt.slice(0,4).map(P=>{const he=P.friendlyName?.trim()||P.label?.trim()||P.name,Ne=Zc(P.cwd??null),je=ct===P.name;return a.jsxs("button",{type:"button",disabled:ct!==null,onClick:()=>Xt(P),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":de("sidebar.restoreRecoverableSession",{name:he}),title:P.cwd||P.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:je?a.jsx(Sn,{size:12,className:"animate-spin"}):a.jsx(F0,{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:he}),a.jsx("span",{className:"block truncate text-[9.5px] text-muted-foreground",children:[P.program,Ne].filter(Boolean).join(" · ")||`tmux:${P.name}`})]}),a.jsx("span",{className:"shrink-0 text-[10px] font-medium text-[color:var(--tmux)] group-hover:text-foreground",children:de(je?"sidebar.restoringRecoverableSession":"sidebar.restore")})]},P.name)})})]}),i.length===0?a.jsxs("div",{className:"rounded-xl bg-surface-2/60 px-4 py-8 text-center",children:[a.jsx($o,{size:26,className:"mx-auto mb-2 text-muted-foreground"}),a.jsx("p",{className:"text-[12px] text-muted-foreground",children:de("sidebar.noSessions")})]}):as.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:de("sidebar.noMatchingSessions")})}):nt?a.jsx("div",{className:"space-y-1.5",children:a.jsx($d,{onBeforeCapture:Zn,onDragStart:Pr,onDragEnd:P=>kn(ur,P),children:a.jsx(Ha,{droppableId:"sidebar-groups",type:"group",direction:"vertical",children:P=>a.jsxs("div",{ref:P.innerRef,...P.droppableProps,className:"space-y-1.5",children:[$r.map((he,Ne)=>{const je=xe.has(he.key),Re=Dc(he.sessions,w,Yr,Ur);let dt=0,wt=0;for(const Ge of he.sessions){const ot=u.get(Ge.id);ot?.agentStatus==="working"&&(dt+=1),(ot?.agentStatus==="waiting"||ot?.agentNeedsReview)&&(wt+=1)}const Je=he.key==="";return a.jsx(za,{draggableId:`sidebar-group:${he.key||"__ungrouped__"}`,index:Ne,isDragDisabled:Je,disableInteractiveElementBlocking:!0,children:(Ge,ot)=>a.jsxs("div",{ref:Ge.innerRef,...Ge.draggableProps,className:`rounded-md transition-colors ${ot.isDragging?"bg-surface-elevated shadow-lg opacity-90":""}`,children:[a.jsxs("button",{type:"button",...Je?{}:Ge.dragHandleProps,onClick:()=>{gr(he.key),os.current.delete(he.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 ${Je?"":"cursor-grab active:cursor-grabbing"}`,title:he.key||he.label,children:[a.jsx(hu,{size:13,className:`shrink-0 transition-transform ${je?"":"rotate-90"}`}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold uppercase tracking-wide",children:he.label}),dt>0&&a.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)] animate-pulse"}),wt>0&&a.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] animate-pulse"}),a.jsx(E2,{sessionIds:he.sessions.map(sr=>sr.id)}),a.jsx("span",{className:"shrink-0 text-[10.5px] text-muted-foreground/70",children:he.sessions.length})]}),!je&&a.jsx("div",{className:"mt-0.5 pl-2",children:a.jsx(Ha,{droppableId:`group-sessions:${he.key}`,type:"session",direction:"vertical",isCombineEnabled:!is,children:sr=>a.jsxs("div",{ref:sr.innerRef,...sr.droppableProps,"data-sidebar-entity-list-id":`group-sessions:${he.key}`,className:"space-y-0.5",children:[Re.map((vt,zt)=>a.jsx(za,{draggableId:vt.id,index:zt,disableInteractiveElementBlocking:!0,children:(ht,Jt)=>a.jsxs("div",{ref:ht.innerRef,...ht.draggableProps,"data-sidebar-gesture-ignore":!0,"data-sidebar-entity-index":zt,className:"relative",children:[kr(zt),zt===Re.length-1&&kr(Re.length,"bottom"),vt.kind==="workspace"?Kn(vt.workspace,vt.members,Jt.isDragging,!!Jt.combineTargetFor,ht.dragHandleProps):vt.kind==="collaboration"?hs(vt.group,vt.members,ht.dragHandleProps,Jt.isDragging,!!Jt.combineTargetFor):a.jsx("div",{...D?Ts(()=>D(vt.session.id)):{},className:`group relative flex items-center gap-1 rounded-md pr-1 transition-colors ${Jt.combineTargetFor?"bg-primary/15 text-foreground ring-1 ring-primary/40":Jt.isDragging?"bg-surface-elevated text-foreground opacity-90 shadow-lg":Jr(vt.session.id)??(vt.session.id===c?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2")} cursor-grab active:cursor-grabbing`,children:Nn(vt.session,ht.dragHandleProps)})]})},vt.id)),sr.placeholder]})})})]})},he.key||"__ungrouped__")}),P.placeholder]})})})}):Or(zr,"sidebar-entities")]}),a.jsx(zv,{onReselect:()=>{f&&(Xr.current=null,ye(P=>P+1),f())}}),at&&a.jsx(HD,{directories:i.flatMap(P=>{const he=u.get(P.id)?.cwd;return he?[he]:[]}),tmuxAvailable:Ue,options:St,agents:Me,selectedAgent:te,detecting:ve,resumeHistory:De,resumeHistoryLoading:Tt,resumeHistoryPendingId:me,resumeHistoryError:gt,onRefreshAgents:()=>{_t().catch(()=>{})},onSelectAgent:P=>{Ve(P).catch(()=>{})},onLaunchAgent:vr,onResumeHistory:P=>{At(P)},onRemoveResumeHistory:P=>{Lr(P)},onClose:()=>_e(!1),onOptionsChange:Ht}),$&&a.jsx(h5,{onFloatingChange:async P=>{P&&(await ut(P),$e(!1))},activeSessionId:c,defaultSessionMode:be,onClose:()=>$e(!1),onNewSession:P=>p(P)}),Object.entries(Xe).map(([P,he])=>a.jsx(h5,{activeSessionId:c,initialCollaborationGroupId:P,initialFloating:he,onFloatingChange:Ne=>fe(P,Ne),defaultSessionMode:be,onClose:()=>{Fe.current=!0,Le(Ne=>{const je={...Ne};return delete je[P],je})},onNewSession:Ne=>p(Ne)},P)),!at&&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:We,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:de("sidebar.newSession"),"aria-label":de("sidebar.newSession"),children:[a.jsx($o,{size:15,className:"shrink-0"}),a.jsx("span",{className:"truncate",children:"Terminal"})]}),te&&a.jsxs("button",{type:"button",onClick:Mt,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:de("sidebar.newSessionWithAgent",{agent:te.displayName}),"aria-label":de("sidebar.newSessionWithAgent",{agent:te.displayName}),children:[a.jsx(Yl,{agent:te,size:15}),a.jsx("span",{className:"truncate",children:te.displayName})]}),a.jsx("button",{type:"button",onClick:jr,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:de("sidebar.moreLaunchOptions"),"aria-label":de("sidebar.moreLaunchOptions"),"aria-expanded":!1,children:a.jsx(Cl,{size:15,className:"transition-transform duration-200"})})]})})]});return Ke?a.jsx("div",{"data-session-sidebar-pinned":!0,className:"h-full flex flex-col app-chrome-bg border-r border-border",children:mn}):a.jsx(T6,{side:"left",isOpen:e,drawerWidthPx:t,onClose:r,onOpen:s,push:Ae,children:mn})}function fQ(){const{t:e}=Gr();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 pQ({slow:e=!1}){const{t}=Gr();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 Q6=()=>Gv(()=>import("./RightSidebar-D8UOa663.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})),mQ=A.lazy(Q6);function y5(e){const t=A.useRef(!1);A.useEffect(()=>{const p=navigator.connection;if(!(p?.saveData||/2g|3g/.test(p?.effectiveType??"")))return Mp(()=>{Q6().catch(()=>{})},3e3)},[]);const{t:r}=Gr(),s=Ft(p=>p.rootPath),i=Ft(p=>p.rightTab),c=Ft(p=>p.setRightTab),u=s?.replace(/\/+$/,"").split("/").pop()||r("rightSidebar.workspace");(e.isOpen||e.pinned)&&(t.current=!0);const f=a.jsx(T6,{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:[eu,h9,P0].map((p,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(p,{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(ws,{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",Y7,"rightSidebar.tabGit"],["diff",X7,"rightSidebar.tabChanges"],["files",Jl,"rightSidebar.tabFiles"]].map(([p,g,x])=>a.jsxs("button",{type:"button",onClick:()=>c(p),className:`flex items-center justify-center gap-1 rounded px-2 py-1.5 text-[11px] font-medium ${i===p?"bg-surface-elevated text-foreground":"text-muted-foreground"}`,children:[a.jsx(g,{size:12}),r(x)]},p))}),a.jsx("div",{className:"h-2"})]}),a.jsx("div",{className:"min-h-0 flex-1 bg-surface",children:i==="git"?a.jsx(pQ,{}):a.jsx(fQ,{})})]})});return t.current?a.jsx(A.Suspense,{fallback:f,children:a.jsx(mQ,{...e})}):f}function gQ(e){return e>=90?"var(--destructive)":e>=70?"var(--warning)":"var(--success)"}function xQ(e){return e>=90?"var(--destructive)/0.15":e>=70?"var(--warning)/0.15":"var(--success)/0.12"}function bQ(e){if(!e)return"";const t=new Date(e),r=Date.now(),s=t.getTime()-r;if(s<=0)return"";const i=Math.floor(s/6e4),c=Math.floor(i/60),u=Math.floor(c/24),f=c%24,p=i%60,g=t.toLocaleDateString(void 0,{month:"short",day:"numeric"}),x=t.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});let b;return u>0?b=`${u}d ${f}h`:f>0?b=`${f}h ${p}m`:p>0?b=`${p}m`:b="soon",`resets in ${b} (${g} ${x})`}function yQ(e){return{claude:"🧠",codex:"✨",kimi:"🌙",copilot:"🐙",grok:"🚀",gemini:"💎"}[e]||"📊"}function vQ({result:e}){const{t}=Gr(),r=e.windows.filter(f=>f.percent===0&&!f.resetAt),s=e.windows.filter(f=>f.percent>0||f.resetAt),i=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:yQ(e.slug)}),a.jsx("span",{className:"truncate",children:e.displayName}),i&&a.jsx("span",{className:"shrink-0 rounded-full bg-surface-elevated px-2 py-0.5 text-[10px] font-normal text-muted-foreground",children:i})]}),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 p=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:xQ(f.percent)},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${p}%`,background:gQ(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:bQ(f.resetAt)})]},f.label)})}):c?a.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:e.error}):null]})}function wQ({isOpen:e,onClose:t}){const{t:r}=Gr(),[s,i]=A.useState([]),[c,u]=A.useState(!1),f=async(x=!1)=>{u(!0);try{const b=x?await Vv():await qv();i(b.providers||[])}catch{}finally{u(!1)}};if(A.useEffect(()=>{e&&f()},[e]),A.useEffect(()=>{if(!e)return;const x=b=>{const v=b.detail;Array.isArray(v)&&i(v)};return window.addEventListener("termdock:quota-update",x),()=>{window.removeEventListener("termdock:quota-update",x)}},[e]),!e)return null;const p=s.filter(x=>!x.error),g=p.length>0?new Date(Math.max(...p.map(x=>x.fetchedAt||0))):null;return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"fixed inset-0 z-modal-backdrop bg-[var(--app-backdrop)] backdrop-blur-sm cursor-default",onClick:t}),a.jsxs("div",{className:"fixed inset-x-3 z-modal-panel mx-auto flex max-w-lg flex-col overflow-hidden rounded-2xl bg-surface border border-border/15 shadow-[0_28px_70px_var(--app-shadow-strong),0_14px_32px_var(--app-shadow-soft)]",style:{top:"max(1.5rem, env(safe-area-inset-top, 0px))",bottom:"max(1.5rem, env(safe-area-inset-bottom, 0px))"},children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/15 px-3 py-2.5 sm:px-6 sm:py-3",children:[a.jsx("h2",{className:"text-[14px] font-semibold text-foreground sm:text-base",children:r("quota.title")}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{type:"button",onClick:()=>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(As,{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(ws,{size:17})})]})]}),a.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3 sm:p-5",children:[c&&p.length===0?a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx(As,{size:24,className:"animate-spin text-muted-foreground"})}):p.length===0?a.jsxs("div",{className:"py-8 text-center text-[13px] text-muted-foreground",children:[a.jsx("p",{children:r("quota.noProviders")}),a.jsx("p",{className:"mt-1.5 text-[11px]",children:r("quota.noProvidersHint")})]}):a.jsx("div",{className:"space-y-2.5",children:p.map(x=>a.jsx(vQ,{result:x},x.slug))}),g&&a.jsx("p",{className:"mt-3 text-center text-[10px] text-muted-foreground",children:r("quota.updated",{time:g.toLocaleTimeString()})})]})]})]})}const v5=[{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~"}],AQ=2,TQ=20;function CQ({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 SQ({value:e,onChange:t,placeholder:r}){const{t:s}=Gr(),[i,c]=S.useState(""),u=b=>{const v=[];let w="",k=!1;const I=()=>{const M=w.trim();M&&v.push(M),w=""};for(let M=0;M<b.length;M+=1){const D=b[M];if(!k&&D==="/"&&w.trim().length===0){k=!0,w+=D;continue}if(k){if(w+=D,D==="/"&&b[M-1]!=="\\"&&w.length>1){for(;M+1<b.length&&/[gimsuy]/.test(b[M+1]??"");)M+=1,w+=b[M];I(),k=!1}continue}if(D===","||/\s/.test(D)){I();continue}w+=D}if(I(),v.length===0)return;const N=[...e];for(const M of v){const D=$x(M);D&&(N.includes(D)||N.push(D))}t(N),c("")},f=b=>{t(e.filter(v=>v!==b))},p=i.trim(),g=p.length>0&&kg(p),x=g&&!Rd(p);return a.jsx("div",{className:"rounded-2xl bg-surface px-3 py-2 ring-1 ring-border/15 focus-within:ring-accent/40",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(b=>{const v=kg(b),w=v&&!Rd(b);return a.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] ${w?"bg-destructive/15 text-destructive":v?"bg-accent/15 font-mono text-accent":"bg-surface-elevated text-foreground"}`,title:v?w?s("settings.invalidRegex"):"Regex match":"Substring match (case-insensitive)",children:[v&&a.jsx("span",{className:"text-[10px] opacity-70",children:"re"}),b,a.jsx("button",{type:"button",onClick:()=>f(b),className:"rounded-full p-0.5 text-muted-foreground hover:bg-destructive/20 hover:text-destructive","aria-label":s("toolbarPresets.removeAction",{name:b}),children:a.jsx(ws,{size:12})})]},b)}),a.jsx("input",{type:"text",value:i,onChange:b=>c(b.target.value),onKeyDown:b=>{b.key==="Enter"||b.key===","&&!g?(b.preventDefault(),u(i)):b.key==="Backspace"&&i.length===0&&e.length>0&&f(e[e.length-1])},onBlur:()=>u(i),placeholder:e.length===0?r:"",className:`min-w-[8ch] flex-1 bg-transparent py-1 text-sm outline-none placeholder:text-muted/60 ${g?"font-mono":""} ${x?"text-destructive":""}`,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off"})]})})}function _Q({value:e,min:t,max:r,onChange:s}){const{t:i}=Gr();return a.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full bg-surface px-1 py-1 ring-1 ring-border/15",children:[a.jsx("button",{type:"button",onClick:()=>s(Math.max(t,e-1)),disabled:e<=t,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":i("common.decrease"),children:a.jsx(J8,{size:14})}),a.jsx("span",{className:"w-6 text-center text-sm font-medium tabular-nums text-foreground",children:e}),a.jsx("button",{type:"button",onClick:()=>s(Math.min(r,e+1)),disabled:e>=r,className:"h-7 w-7 rounded-full bg-surface-2 text-muted-foreground transition hover:bg-surface-elevated disabled:opacity-40 inline-flex items-center justify-center","aria-label":i("common.increase"),children:a.jsx(Ri,{size:14})})]})}const LQ=({presets:e,selectedPresetId:t,onSelectPreset:r,onUpdatePreset:s,onAddPreset:i,onRemovePreset:c,onResetDefaults:u})=>{const{t:f}=Gr(),p=e.find(M=>M.id===t)??e[0]??null,[g,x]=S.useState(null);if(!p)return null;const b=p.actions.length>0,v=[{id:"preview-auto",label:p.label,kind:"preset"},...p.includeAlt?[{id:"preview-alt",label:"Alt"}]:[],...b?p.actions.map((M,D)=>({id:M.id,label:rp(M,D)})):["Enter","Home","End","Ctrl-C","Ctrl-D"].map(M=>({id:M,label:M}))],w=zx(v,p.rowLayout),k=(M,D)=>{s(p.id,F=>{const Z=F.actions.findIndex(q=>q.id===M);if(Z===-1)return F;const G=Z+D;if(G<0||G>=F.actions.length)return F;const U=[...F.actions];return[U[Z],U[G]]=[U[G],U[Z]],{...F,actions:U}})},I=p.rowLayout.reduce((M,D)=>M+D,0),N=1+(p.includeAlt?1:0);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"sticky top-[-1rem] sm:top-[-1.5rem] z-10 -mx-4 -mt-4 sm:-mx-6 sm:-mt-6 border-b border-border/15 bg-surface/95 backdrop-blur px-4 py-3 sm:px-6",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[a.jsx("span",{className:"ui-kicker",children:f("toolbarPresets.preview")}),a.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[p.actions.length," button",p.actions.length===1?"":"s"," · ",I," slot",I===1?"":"s"]})]}),a.jsx("div",{className:"space-y-1 rounded-2xl bg-surface-2/60 p-2",children:w.map((M,D)=>{const F=M.items[0]?.kind==="preset",Z=Math.max(2,M.columns),G=F?`${Hx}px repeat(${Math.max(1,Z-1)}, minmax(0, 1fr))`:`repeat(${Z}, minmax(0, 1fr))`;return a.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:G},children:M.items.map(U=>U.kind==="preset"?a.jsx(Wx,{mode:"auto",presetLabel:U.label,title:`Auto preset · ${U.label}`,disabled:!0},U.id):a.jsx(CQ,{label:U.label},U.id))},`preview-row-${D}`)})}),p.actions.length>I-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:i,className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-2 text-xs font-medium hover:bg-surface-elevated transition",children:[a.jsx(Ri,{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(As,{size:14}),f("toolbarPresets.reset")]})]})]}),a.jsx("div",{className:"-mx-1 flex flex-wrap gap-1.5 px-1",children:e.map(M=>a.jsxs("button",{type:"button",onClick:()=>r(M.id),className:`rounded-full px-3 py-2 text-xs font-medium transition ${M.id===p.id?"bg-primary/20 text-primary ring-1 ring-primary/30":"bg-surface-2 text-muted-foreground hover:bg-surface-elevated"}`,children:[M.label,M.actions.length>0&&a.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground",children:M.actions.length})]},M.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:p.label,onChange:M=>s(p.id,D=>({...D,label:M.target.value})),className:"flex-1 rounded-full bg-surface-2 px-4 py-2.5 text-sm placeholder:text-muted/60 outline-none ring-1 ring-transparent focus:ring-accent/40",placeholder:f("toolbarPresets.presetLabelPlaceholder"),autoCapitalize:"off",autoCorrect:"off"}),p.id!=="default"&&a.jsx("button",{type:"button",onClick:()=>c(p.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:p.label}),children:a.jsx(qi,{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(SQ,{value:p.programs,onChange:M=>s(p.id,D=>({...D,programs:M})),placeholder:f("toolbarPresets.programsPlaceholder")}),a.jsx("p",{className:"text-[10px] text-muted-foreground",children:f("toolbarPresets.programsHelp")})]}),a.jsxs("button",{type:"button",onClick:()=>s(p.id,M=>({...M,includeAlt:!M.includeAlt})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[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($a,{checked:p.includeAlt})]}),a.jsxs("button",{type:"button",onClick:()=>s(p.id,M=>({...M,showOnDesktop:!M.showOnDesktop})),className:"flex w-full items-center justify-between rounded-2xl bg-surface-2 px-4 py-3 text-sm transition hover:bg-surface-elevated",children:[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($a,{checked:p.showOnDesktop===!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("span",{className:"ui-kicker",children:f("toolbarPresets.rowLayout")}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:f("toolbarPresets.rowLayoutHint")})]}),a.jsxs("button",{type:"button",onClick:()=>s(p.id,M=>({...M,rowLayout:[...Up(M.rowLayout),3]})),className:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-3 py-1.5 text-xs font-medium hover:bg-surface-elevated",children:[a.jsx(Ri,{size:12}),f("toolbarPresets.addRow")]})]}),a.jsx("div",{className:"space-y-2",children:p.rowLayout.map((M,D)=>a.jsxs("div",{className:"flex items-center gap-3 rounded-2xl bg-surface-2 px-3 py-2",children:[a.jsx("span",{className:"w-12 shrink-0 text-xs text-muted-foreground",children:f("toolbarPresets.rowN",{n:D+1})}),a.jsx("div",{className:"flex-1"}),a.jsx(_Q,{value:M,min:AQ,max:TQ,onChange:F=>s(p.id,Z=>({...Z,rowLayout:Z.rowLayout.map((G,U)=>U===D?F:G)}))}),p.rowLayout.length>1&&a.jsx("button",{type:"button",onClick:()=>s(p.id,F=>({...F,rowLayout:F.rowLayout.filter((Z,G)=>G!==D)})),className:"rounded-full bg-surface px-2.5 py-1 text-[11px] text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":f("toolbarPresets.removeRow",{n:D+1}),children:f("toolbarPresets.del")})]},`row-${D}`))})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("span",{className:"ui-kicker",children:f("toolbarPresets.buttons")}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:f("toolbarPresets.buttonsHint")})]}),a.jsxs("button",{type:"button",onClick:()=>{const M=`${p.id}-action-${Date.now()}`;s(p.id,D=>({...D,actions:[...D.actions,{id:M,label:`Key ${D.actions.length+1}`,sequence:""}]})),x(M)},className:"inline-flex items-center gap-1 rounded-full bg-primary/15 px-3 py-1.5 text-xs font-medium text-primary hover:bg-primary/25",children:[a.jsx(Ri,{size:12}),f("toolbarPresets.addButton")]})]}),p.actions.length===0&&a.jsx("div",{className:"rounded-2xl bg-surface-2/60 px-4 py-6 text-center text-[11px] text-muted-foreground",children:f("toolbarPresets.noCustomButtons")}),p.actions.map((M,D)=>{const F=g===M.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:()=>k(M.id,-1),disabled:D===0,className:"h-6 w-6 rounded-full bg-surface text-muted-foreground hover:bg-surface-elevated disabled:opacity-30 inline-flex items-center justify-center","aria-label":f("toolbarPresets.moveUp"),children:a.jsx(W5,{size:12})}),a.jsx("button",{type:"button",onClick:()=>k(M.id,1),disabled:D===p.actions.length-1,className:"h-6 w-6 rounded-full bg-surface text-muted-foreground hover:bg-surface-elevated disabled:opacity-30 inline-flex items-center justify-center","aria-label":f("toolbarPresets.moveDown"),children:a.jsx(s8,{size:12})})]}),a.jsxs("button",{type:"button",onClick:()=>x(F?null:M.id),className:"min-w-0 flex-1 text-left",children:[a.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:rp(M,D)}),a.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:[M.sequence?M.sequence:f("toolbarPresets.noSequence"),M.doubleTapSequence&&a.jsxs("span",{className:"ml-1 text-accent/70",children:["· 2× ",M.doubleTapSequence]})]})]}),a.jsx("button",{type:"button",onClick:()=>s(p.id,Z=>({...Z,actions:Z.actions.filter(G=>G.id!==M.id)})),className:"shrink-0 rounded-full bg-surface p-2 text-muted-foreground hover:bg-destructive/15 hover:text-destructive","aria-label":f("toolbarPresets.removeAction",{name:M.label}),children:a.jsx(qi,{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:M.label,onChange:Z=>s(p.id,G=>({...G,actions:G.actions.map(U=>U.id===M.id?{...U,label:Z.target.value}:U)})),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:M.sequence,onChange:Z=>s(p.id,G=>({...G,actions:G.actions.map(U=>U.id===M.id?{...U,sequence:Z.target.value}:U)})),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:v5.map(Z=>a.jsx("button",{type:"button",onClick:()=>s(p.id,G=>({...G,actions:G.actions.map(U=>U.id===M.id?{...U,sequence:Z.sequence}:U)})),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:Z.label},Z.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")}),!M.doubleTapSequence&&a.jsx("button",{type:"button",onClick:()=>s(p.id,Z=>({...Z,actions:Z.actions.map(G=>G.id===M.id?{...G,doubleTapSequence:""}:G)})),className:"text-[10px] text-accent hover:text-accent/80",children:f("toolbarPresets.doubleTapAdd")})]}),M.doubleTapSequence!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"text",value:M.doubleTapSequence,onChange:Z=>s(p.id,G=>({...G,actions:G.actions.map(U=>U.id===M.id?{...U,doubleTapSequence:Z.target.value}:U)})),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:[v5.map(Z=>a.jsx("button",{type:"button",onClick:()=>s(p.id,G=>({...G,actions:G.actions.map(U=>U.id===M.id?{...U,doubleTapSequence:(U.doubleTapSequence??"")+Z.sequence}:U)})),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:Z.label},Z.label)),a.jsx("button",{type:"button",onClick:()=>s(p.id,Z=>({...Z,actions:Z.actions.map(G=>{if(G.id!==M.id)return G;const{doubleTapSequence:U,...q}=G;return q})})),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")})]})]})]})]})]},M.id)})]})]})]})},kQ={installed:"text-[color:var(--success)]",outdated:"text-[color:var(--warning)]","needs-approval":"text-[color:var(--warning)]","not-installed":"text-muted-foreground"};function IQ(){const{t:e}=Gr(),[t,r]=S.useState(null),[s,i]=S.useState(null),[c,u]=S.useState(null),[f,p]=S.useState(null),[g,x]=S.useState(!1),[b,v]=S.useState(!1),[w,k]=S.useState(""),[I,N]=S.useState(""),[M,D]=S.useState(null),[F,Z]=S.useState([]),[G,U]=S.useState([]),[q,pe]=S.useState(null),[Ue,be]=S.useState(new Set),[Ae,Ke]=S.useState(null),[qe,ie]=S.useState("auto"),[Se,tt]=S.useState({}),[Ee,oe]=S.useState(null),[de,Te]=S.useState(null),[ee,ye]=S.useState(10),[ce,Ye]=S.useState(""),[at,_e]=S.useState(""),[$,$e]=S.useState(12e3),[Xe,Le]=S.useState(null),[K,Fe]=S.useState(null),fe=S.useCallback(async()=>{const[te,Me,ve,_t]=await Promise.allSettled([Zv(),Yv(),V0(),lc()]);if(r(te.status==="fulfilled"?te.value:[]),Me.status==="fulfilled"){const Ve=Me.value;Z(Ve.plugins??[]),U(Ve.errors??[])}else Z([]),U([]);if(ve.status==="fulfilled"){const Ve=ve.value;be(new Set(Ve.autoRenameAgents??[])),ie(Ve.autoRenameNamer??"auto"),tt(Ve.autoRenameModels??{}),ye(Ve.autoRenameIntervalMinutes??10),Ye(Ve.autoRenamePromptPreference??""),_e(Ve.autoRenamePromptPreference??""),$e(Ve.autoRenamePromptPayloadChars??12e3)}else be(new Set);oe(_t.status==="fulfilled"?_t.value:[])},[]);S.useEffect(()=>{fe()},[fe]);const De=async(te,Me)=>{i(te),u(null);try{Me==="install"?(await Kv(te)).devMode&&p(te):(await Xv(te),f===te&&p(null)),await fe()}catch(ve){u(ve instanceof Error?ve.message:String(ve))}finally{i(null)}},lt=te=>e(te==="installed"?"settings.agentHooksInstalled":te==="outdated"?"settings.agentHooksOutdated":te==="needs-approval"?"settings.agentHooksNeedsApproval":"settings.agentHooksNotInstalled"),Tt=async()=>{D(null);let te;try{te=JSON.parse(I)}catch{D("Invalid JSON");return}try{await s7(te),N(""),x(!1),await fe()}catch(Me){if(Me instanceof i7&&Me.migration){U(ve=>[{slug:typeof te.slug=="string"?te.slug:"manifest.json",errors:Me.message.split(`
133
+ `),code:Me.code,migration:Me.migration},...ve.filter(_t=>_t.slug!==te.slug)]);return}D(Me instanceof Error?Me.message:String(Me))}},we=async()=>{const te=w.trim();if(te){Le("install"),D(null);try{await Jv(te),k(""),v(!1),await fe()}catch(Me){D(Me instanceof Error?Me.message:String(Me))}finally{Le(null)}}},me=async te=>{Le(`remove:${te}`);try{await n7(te),Fe(Me=>Me?.slug===te?null:Me),await fe()}catch(Me){u(Me instanceof Error?Me.message:String(Me))}finally{Le(null)}},Qe=async te=>{Le(`check:${te}`),u(null);try{await r7(te),await fe()}catch(Me){u(Me instanceof Error?Me.message:String(Me))}finally{Le(null)}},gt=async te=>{Le(`update:${te}`),u(null);try{const Me=await t7(te),ve=[Me.hookWarning,Me.titleWarning].filter(Boolean).join(" ");ve&&u(ve),Fe(_t=>_t?.slug===te?null:_t),await fe()}catch(Me){u(Me instanceof Error?Me.message:String(Me))}finally{Le(null)}},ft=async te=>{Le(`doctor:${te}`),u(null),Fe(null);try{const Me=await e7(te);Fe(Me),oe(await lc())}catch(Me){u(Me instanceof Error?Me.message:String(Me))}finally{Le(null)}},ct=async te=>{const Me=te.migration?.aiPrompt??te.errors.join(`
134
+ `);try{await navigator.clipboard.writeText(Me),pe(te.slug),window.setTimeout(()=>pe(ve=>ve===te.slug?null:ve),1800)}catch{D(Me)}},Kt=async te=>{if(Ae)return;const Me=Ue,ve=new Set(Me);ve.has(te)?ve.delete(te):ve.add(te),be(ve),Ke(te),u(null);try{const _t=await jo({autoRenameAgents:[...ve]});be(new Set(_t.autoRenameAgents??[])),oe(await lc(!0))}catch(_t){be(Me),u(_t instanceof Error?_t.message:String(_t))}finally{Ke(null)}},$t=async te=>{const Me=qe;ie(te),Te("namer"),u(null);try{const ve=await jo({autoRenameNamer:te});ie(ve.autoRenameNamer??"auto"),oe(await lc(!0))}catch(ve){ie(Me),u(ve instanceof Error?ve.message:String(ve))}finally{Te(null)}},Qt=async(te,Me)=>{const ve=Se,_t={...ve};Me?_t[te]=Me:delete _t[te],tt(_t),Te(te),u(null);try{const Ve=await jo({autoRenameModels:_t});tt(Ve.autoRenameModels??{})}catch(Ve){tt(ve),u(Ve instanceof Error?Ve.message:String(Ve))}finally{Te(null)}},ut=async te=>{const Me=ee;ye(te),Te("interval"),u(null);try{const ve=await jo({autoRenameIntervalMinutes:te});ye(ve.autoRenameIntervalMinutes??10)}catch(ve){ye(Me),u(ve instanceof Error?ve.message:String(ve))}finally{Te(null)}},bt=async()=>{const te=ce.trim();if(te!==at){Te("preference"),u(null);try{const ve=(await jo({autoRenamePromptPreference:te})).autoRenamePromptPreference??"";Ye(ve),_e(ve)}catch(Me){Ye(at),u(Me instanceof Error?Me.message:String(Me))}finally{Te(null)}}},It=async te=>{const Me=Math.max(1e3,Math.min(64e3,Math.round(te||12e3))),ve=$;$e(Me),Te("payload-limit"),u(null);try{const _t=await jo({autoRenamePromptPayloadChars:Me});$e(_t.autoRenamePromptPayloadChars??12e3)}catch(_t){$e(ve),u(_t instanceof Error?_t.message:String(_t))}finally{Te(null)}},St=new Set(F.map(te=>te.slug)),Ht=K?{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")}[K.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:qe,disabled:de!==null,onChange:te=>{$t(te.target.value)},className:"min-w-0 rounded-lg bg-surface px-2.5 py-1.5 text-[11px] text-foreground outline-none disabled:opacity-50",children:[a.jsx("option",{value:"auto",children:e("settings.agentAutoRenameFollow")}),Ee?.filter(te=>te.available).map(te=>a.jsx("option",{value:te.slug,children:te.displayName},te.slug))]})]}),a.jsxs("label",{className:"mt-2 flex items-center justify-between gap-3",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:e("settings.agentAutoRenameInterval")}),a.jsx("select",{value:ee,disabled:de!==null,onChange:te=>{ut(Number(te.target.value))},className:"min-w-0 rounded-lg bg-surface px-2.5 py-1.5 text-[11px] text-foreground outline-none disabled:opacity-50",children:[5,10,30,60].map(te=>a.jsxs("option",{value:te,children:[te," ",e("settings.agentAutoRenameMinutes")]},te))})]}),a.jsxs("details",{className:"mt-2 border-t border-border/40 pt-2",children:[a.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentAutoRenameAdvanced")}),a.jsxs("label",{className:"mt-2 block",children:[a.jsx("span",{className:"text-[11px] font-medium text-foreground",children:e("settings.agentAutoRenamePreference")}),a.jsx("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:e("settings.agentAutoRenamePreferenceHint")}),a.jsx("textarea",{value:ce,maxLength:2e3,rows:3,disabled:de!==null,placeholder:e("settings.agentAutoRenamePreferencePlaceholder"),onChange:te=>Ye(te.target.value),onBlur:()=>{bt()},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:de==="preference"?e("settings.saving"):`${ce.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:$,disabled:de!==null,onChange:te=>$e(Number(te.target.value)),onBlur:te=>{It(Number(te.target.value))},className:"mt-1.5 w-full rounded-lg bg-surface px-2.5 py-2 text-[11px] text-foreground outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50"})]})]}),a.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/40 pt-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"text-[10px] text-muted-foreground",children:e("settings.agentAutoRenameModelsFromCli")}),a.jsx("button",{type:"button",onClick:async()=>{oe(null);try{oe(await lc(!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(As,{size:11,className:Ee===null?"animate-spin":""})})]}),Ee?.filter(te=>te.available).map(te=>{const Me=te.models.find(ve=>ve.id===te.recommendedModel);return a.jsxs("label",{className:"flex items-center justify-between gap-3",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:te.displayName}),a.jsxs("select",{value:Se[te.slug]??"",disabled:de!==null,onChange:ve=>{Qt(te.slug,ve.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:Me?`${e("settings.agentAutoRenameAutomatic")} · ${Me.displayName}`:e("settings.agentAutoRenameCliDefault")}),te.models.map(ve=>a.jsx("option",{value:ve.id,children:ve.displayName},ve.id))]})]},te.slug)}),Ee?.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(Sn,{size:12,className:"animate-spin"})," …"]}),t?.map(te=>{const Me=s===te.slug,ve=te.state!=="not-installed",_t=St.has(te.slug);return a.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-surface-2 px-3 py-2.5",children:[a.jsx(Yl,{agent:{slug:te.slug,displayName:te.displayName,accentColor:te.accentColor??"#878580",icon:te.icon,isPlugin:_t,iconMode:te.iconMode,iconVersion:te.iconVersion??void 0},size:18}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[13px] font-medium text-foreground",children:te.displayName}),_t&&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] ${kQ[te.state]}`,children:[te.state==="installed"&&a.jsx(sm,{size:10,className:"mr-0.5 inline"}),(te.state==="outdated"||te.state==="needs-approval")&&a.jsx(H5,{size:10,className:"mr-0.5 inline"}),lt(te.state)]})]}),a.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",title:te.targetDisplay,children:[e("settings.agentHooksTarget")," ",te.targetDisplay]}),f===te.slug&&a.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksDevMode")}),te.state==="needs-approval"&&a.jsx("div",{className:"mt-0.5 text-[10px] text-[color:var(--warning)]",children:e("settings.agentHooksApprovalHint")})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("button",{type:"button",disabled:Ae!==null,onClick:()=>{Kt(te.slug)},className:"flex shrink-0 items-center gap-1.5 rounded-full px-2 py-1 text-[10px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50","aria-pressed":Ue.has(te.slug),title:e("settings.agentAutoRenameToggle"),children:[a.jsx("span",{children:e("settings.agentAutoRenameShort")}),a.jsx($a,{checked:Ue.has(te.slug),disabled:Ae!==null,size:"sm"})]}),a.jsxs("button",{type:"button",disabled:Me,onClick:()=>{De(te.slug,ve?"uninstall":"install")},className:`flex shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition ${ve?"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:[Me?a.jsx(Sn,{size:11,className:"animate-spin"}):ve?a.jsx(qi,{size:11}):te.state==="outdated"?a.jsx(As,{size:11}):a.jsx(Kc,{size:11}),Me?"…":ve?e("settings.agentHooksUninstall"):te.state==="outdated"?e("settings.agentHooksReinstall"):e("settings.agentHooksInstall")]})]})]},te.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(!b),className:"flex items-center gap-1 rounded-full bg-[rgb(var(--success-rgb)_/_0.14)] px-2.5 py-1 text-[11px] font-medium text-[color:var(--success)] hover:bg-[rgb(var(--success-rgb)_/_0.22)] transition",children:[a.jsx(Ri,{size:11}),e("settings.agentPluginAdd")]})]}),a.jsx("p",{className:"mt-1 text-[10px] text-muted-foreground",children:e("settings.agentPluginHint")}),b&&a.jsxs("div",{className:"mt-2 space-y-2",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{value:w,onChange:te=>k(te.target.value),onKeyDown:te=>{te.key==="Enter"&&we()},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()||Xe!==null,onClick:()=>{we()},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:[Xe==="install"?a.jsx(Sn,{size:11,className:"animate-spin"}):a.jsx(Kc,{size:11}),e("settings.agentPluginInstallPackage")]})]}),a.jsx("button",{type:"button",onClick:()=>x(!g),className:"text-[10px] text-muted-foreground transition hover:text-foreground",children:e("settings.agentPluginAdvancedManifest")})]}),F.map(te=>{const Me=te.revision?.slice(0,8),ve=Xe?.endsWith(`:${te.slug}`)===!0;return a.jsxs("div",{className:"mt-2 flex items-center gap-2 border-t border-border/40 pt-2",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-medium text-foreground",children:[a.jsx("span",{className:"truncate",children:te.displayName}),te.updateAvailable&&a.jsx("span",{className:"text-[9px] text-[color:var(--warning)]",children:e("settings.agentPluginUpdateAvailable")})]}),a.jsxs("div",{className:"truncate text-[9px] text-muted-foreground",title:te.source??void 0,children:[te.source??e("settings.agentPluginManualSource"),Me?` · ${Me}`:""]})]}),a.jsxs("button",{type:"button",disabled:Xe!==null,onClick:()=>{ft(te.slug)},className:"flex items-center gap-1 rounded-full bg-surface px-2 py-1 text-[10px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50",title:e("settings.agentPluginDoctorHint"),children:[Xe===`doctor:${te.slug}`?a.jsx(Sn,{size:10,className:"animate-spin"}):a.jsx(S9,{size:10}),e("settings.agentPluginDoctor")]}),te.updateSupported&&a.jsxs("button",{type:"button",disabled:Xe!==null,onClick:()=>{te.updateAvailable?gt(te.slug):Qe(te.slug)},className:"flex items-center gap-1 rounded-full bg-surface px-2 py-1 text-[10px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:opacity-50",children:[ve?a.jsx(Sn,{size:10,className:"animate-spin"}):a.jsx(As,{size:10}),te.updateAvailable?e("settings.agentPluginUpdate"):e("settings.agentPluginCheck")]}),a.jsx("button",{type:"button",disabled:Xe!==null,onClick:()=>{me(te.slug)},className:"rounded-full p-1 text-muted-foreground transition hover:bg-surface-elevated hover:text-[color:var(--warning)] disabled:opacity-50",title:e("settings.agentPluginDelete"),children:a.jsx(qi,{size:11})})]},te.slug)}),K&&a.jsxs("div",{className:`mt-2 rounded-lg px-3 py-2 text-[10px] ${K.status==="ok"||K.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:[K.displayName,": ",Ht]}),a.jsx("div",{className:"mt-1 text-muted-foreground",children:K.models.length>0?`${K.models.length} ${e("settings.agentPluginDoctorModels")}${K.recommendedModel?` · ${e("settings.agentPluginDoctorAutomatic")} ${K.recommendedModel}`:""}`:e("settings.agentPluginDoctorCliDefault")}),K.error&&a.jsx("div",{className:"mt-1 break-words",children:K.error}),K.warnings.length>0&&a.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:K.warnings.map(te=>a.jsxs("div",{children:["• ",te]},te))}),K.nextSteps.length>0&&a.jsx("div",{className:"mt-1 space-y-0.5 text-muted-foreground",children:K.nextSteps.map(te=>a.jsxs("div",{children:["→ ",te]},te))})]}),G.map(te=>a.jsxs("div",{className:"mt-2 rounded-lg bg-[rgb(var(--warning-rgb)_/_0.10)] px-3 py-2 text-[10px] text-[color:var(--warning)]",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("span",{className:"font-medium",children:[te.slug,": ",te.code??e("settings.agentPluginInvalid")]}),a.jsxs("button",{type:"button",onClick:()=>{ct(te)},className:"flex shrink-0 items-center gap-1 rounded-full bg-[rgb(var(--warning-rgb)_/_0.14)] px-2 py-1 font-medium transition hover:bg-[rgb(var(--warning-rgb)_/_0.22)]",children:[q===te.slug?a.jsx(sm,{size:10}):a.jsx(G5,{size:10}),q===te.slug?e("settings.agentPluginCopied"):e("settings.agentPluginCopyAiPrompt")]})]}),a.jsx("div",{className:"mt-1 whitespace-pre-wrap break-words text-muted-foreground",children:te.errors.join(`
135
+ `)}),te.migration?.guideCommand&&a.jsx("code",{className:"mt-1 block select-all text-foreground",children:te.migration.guideCommand})]},te.slug)),b&&g&&a.jsxs("div",{className:"mt-2 space-y-2",children:[a.jsx("textarea",{value:I,onChange:te=>N(te.target.value),rows:10,className:"w-full rounded-lg bg-surface px-3 py-2 font-mono text-[11px] text-foreground placeholder:text-muted-foreground outline-none resize-y",placeholder:`{
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
+ }`}),M&&a.jsx("div",{className:"whitespace-pre-wrap break-words text-[10px] text-[color:var(--warning)]",children:M}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>{Tt()},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(L8,{size:11}),e("settings.agentPluginCreate")]}),a.jsx("button",{type:"button",onClick:()=>{x(!1),N(""),D(null)},className:"rounded-full px-3 py-1 text-[11px] text-muted-foreground hover:text-foreground transition",children:e("common.cancel")})]})]})]})]})}function EQ({state:e,pending:t,onCheck:r,onConfirmRestart:s,desktopState:i,desktopPending:c=!1,onCheckDesktop:u,onInstallDesktop:f}){const{t:p}=Gr(),g=e?.status??"idle",x=t||g==="checking"||g==="installing"||g==="restarting",b=g==="ready"&&!!e?.latestVersion,v=g==="checking"?p("settings.updateChecking"):g==="installing"?p("sidebar.updateInstalling"):g==="ready"?p("sidebar.updateReady"):g==="restarting"?p("sidebar.updateRestarting"):g==="current"?p("settings.updateCurrent"):g==="error"?e?.error||p("sidebar.updateFailed"):p("settings.updateHint"),w=i?.status??"idle",k=c||w==="checking"||w==="downloading"||w==="installing",I=w==="ready",N=w==="unsupported"?p("settings.desktopUpdateUnsupported"):w==="checking"?p("settings.desktopUpdateChecking"):w==="current"?p("settings.desktopUpdateCurrent"):w==="downloading"?p("settings.desktopUpdateDownloading"):w==="ready"?p("settings.desktopUpdateReady"):w==="installing"?p("settings.desktopUpdateInstalling"):w==="error"&&i?.error||p("settings.desktopUpdateHint");return a.jsxs("section",{className:"mt-3 overflow-hidden rounded-xl bg-surface-2","aria-labelledby":"termdock-update-title",children:[a.jsx("div",{id:"termdock-update-title",className:"px-3 pt-3 text-[12px] font-semibold text-foreground",children:p("settings.updateTitle")}),a.jsxs("div",{className:"flex items-start justify-between gap-3 px-3 py-3",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[a.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${b?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:a.jsx(As,{size:15,className:x?"animate-spin":""})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:p("settings.updateRuntimeTitle")}),a.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:v}),e&&a.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:b&&e.latestVersion?`${e.currentVersion} → ${e.latestVersion}`:`v${e.currentVersion}`})]})]}),b?a.jsx("button",{type:"button",disabled:x,onClick:s,className:"shrink-0 rounded-full bg-[var(--warning)] px-3 py-1.5 text-[11px] font-semibold text-[color:var(--bg)] transition hover:opacity-90 disabled:cursor-wait disabled:opacity-60",children:p("sidebar.updateRestart")}):a.jsx("button",{type:"button",disabled:x,onClick:r,className:"shrink-0 rounded-full bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground transition hover:bg-surface-elevated disabled:cursor-wait disabled:opacity-60",children:p(g==="checking"?"settings.updateCheckingShort":g==="installing"?"settings.updateInstallingShort":g==="error"?"sidebar.updateRetry":g==="current"?"settings.updateCheckAgain":"settings.updateCheck")})]}),i&&a.jsxs("div",{className:"flex items-start justify-between gap-3 border-t border-border/10 px-3 py-3",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[a.jsx("span",{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${I?"bg-[rgb(var(--warning-rgb)_/_0.16)] text-[color:var(--warning)]":"bg-primary/15 text-primary"}`,children:a.jsx(As,{size:15,className:k?"animate-spin":""})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[12px] font-medium text-foreground",children:p("settings.desktopUpdateTitle")}),a.jsx("div",{className:"mt-0.5 text-[10px] leading-relaxed text-muted-foreground",children:N}),a.jsx("div",{className:"mt-1 text-[10px] tabular-nums text-muted-foreground/75",children:I&&i.latestVersion?`${i.currentVersion} → ${i.latestVersion}`:`v${i.currentVersion}`})]})]}),I?a.jsx("button",{type:"button",disabled:k||!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:p("settings.desktopUpdateRestart")}):a.jsx("button",{type:"button",disabled:k||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:p(w==="checking"?"settings.updateCheckingShort":w==="current"||w==="error"?"settings.desktopUpdateCheckAgain":"settings.desktopUpdateCheck")})]})]})}const MQ=()=>()=>{},RQ=()=>1/0;function NQ(){const{t:e}=Gr(),t=A.useId(),r=La(),s=A.useSyncExternalStore(r?.subscribe??MQ,r?.retentionLimit??RQ);if(!r)return null;const i=o7+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:i,step:1,value:s===1/0?i:s,"aria-valuetext":c,"aria-describedby":`${t}-hint`,onChange:u=>{const f=Number(u.target.value);r.setRetentionLimit(f===i?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 Sp="mobile-session-destroy";function DQ(e,t){return t&&e.type==="session"&&e.destination?.droppableId===Sp}const so="termdock-program-rules-cache",cd="termdock-toolbar-presets-cache",Qc="termdock-settings-cache",w5="termdock-color-theme",A5="termdock:right-sidebar:file-preview-open-by-session:v2",Bc="termdock:running-session-button-enabled:v1",QQ=60,T5=320,C5=420,ta=8;function S5(e,t,r){return Math.min(Math.max(e,t),r)}function _5(e){if(typeof window>"u")return{left:ta,top:ta};const t=window.innerWidth/2,r=Math.min(64,window.innerHeight/4),s=e?.x??t,i=e?.y??r,c=Math.max(ta,window.innerWidth-T5-ta),u=Math.max(ta,window.innerHeight-C5-ta);return{left:S5(s+ta,ta,c),top:S5(i+ta,ta,u),width:T5,maxHeight:`min(${C5}px, calc(100vh - ${ta*2}px))`}}function BQ(e){return e==="dark"||e==="light"}function jQ(e){return!e||typeof e!="object"||Array.isArray(e)?!1:Object.entries(e).every(([t,r])=>{if(!t||!r||typeof r!="object"||Array.isArray(r))return!1;const s=r;return typeof s.updatedAt=="number"&&Number.isFinite(s.updatedAt)})}function Qf(e){const t=Object.entries(e).filter(([r,s])=>r&&Number.isFinite(s.updatedAt)).sort(([,r],[,s])=>s.updatedAt-r.updatedAt).slice(0,QQ);return Object.fromEntries(t)}function PQ(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 OQ(e){return typeof e=="object"&&e!==null&&typeof e.version=="number"&&Array.isArray(e.presets)}function FQ(e,t){const r=nu(),s=new Set(JS()),i=Array.isArray(e)?e:[],c=M0(i),u=t<$c;if(c.length===0)return r;if(u){const p=new Map(c.map(v=>[v.id,v])),g=new Map(i.map(v=>[typeof v.id=="string"?v.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-"):"",v])),x=c.filter(v=>!s.has(v.id));return[...r.map(v=>{const w=p.get(v.id),k=g.get(v.id);return w?{...v,rowLayout:w.rowLayout,showOnDesktop:typeof k?.showOnDesktop=="boolean"?k.showOnDesktop:v.showOnDesktop}:v}),...x]}const f=new Set(c.map(p=>p.id));return[...c,...r.filter(p=>!f.has(p.id))]}function UQ(e){return typeof e=="object"&&e!==null&&typeof e.preventSleep=="boolean"&&typeof e.networkAvailable=="boolean"}const $Q={name:"",source:"auto",hostname:"",fallbackHostname:"",url:"",fallbackUrl:"",onboardingUrl:null,status:"disabled",reason:null,httpsEnabled:!1,caAvailable:!1,lanAddresses:[],interfaces:[]},dh="__termdockOverlay",hh="__termdockBaseAnchor",fh="__termdockBaseGuard",zQ=3,L5=250,HQ="termdock-notification-target-v1",k5="/__termdock-notification-target",I5=3e4;function WQ(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 _0(e){if(!e||typeof e!="object")return null;const t=e[dh];return WQ(t)?t:null}function m1(e){return e&&typeof e=="object"?{...e}:{}}function B6(e){const t=m1(e);return delete t[dh],t}function GQ(e){const t=B6(e);return delete t[fh],{...t,[hh]:!0}}function VQ(){typeof window>"u"||window.history.pushState({...B6(window.history.state),[hh]:!0,[fh]:!0},"",window.location.href)}function j6(){for(let e=0;e<zQ;e+=1)VQ()}function ud(){typeof window>"u"||(window.history.replaceState(GQ(window.history.state),"",window.location.href),j6())}function jc(e){typeof window>"u"||window.history.pushState({...m1(window.history.state),[hh]:!0,[dh]:e,[fh]:!1},"",window.location.href)}function qQ(e){typeof window>"u"||window.history.replaceState({...m1(window.history.state),[hh]:!0,[dh]:e,[fh]:!1},"",window.location.href)}const P6=["bash","zsh","fish","sh","dash","ksh","tcsh","csh","nu"];let io=new Set(P6);function E5(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 ZQ(e,t){if(e.size!==t.size)return!1;for(const[r,s]of t){const i=e.get(r);if(!i||i.cwd!==s.cwd||i.activeProgram!==s.activeProgram||i.activeProgramRaw!==s.activeProgramRaw||i.inCopyMode!==s.inCopyMode||i.isConnecting!==s.isConnecting||i.agentStatus!==s.agentStatus||i.agentIndicator!==s.agentIndicator||i.agentStatusDetail!==s.agentStatusDetail||i.agent!==s.agent||i.agentMessage!==s.agentMessage||i.agentNativeSessionId!==s.agentNativeSessionId||i.agentResumeRecovered!==s.agentResumeRecovered||i.terminalSessionId!==s.terminalSessionId||i.agentNeedsReview!==s.agentNeedsReview||i.gitStatus!==s.gitStatus||i.shellTitle!==s.shellTitle||i.promptState!==s.promptState||i.tuiProgress?.state!==s.tuiProgress?.state||i.tuiProgress?.progress!==s.tuiProgress?.progress)return!1}return!0}function M5(e,t){return a.jsx(vD,{sessionMode:e,state:t})}function YQ(e,t){const r=new Map(e.map(u=>[u.id,u])),s=t.map(u=>r.get(u)).filter(u=>u!==void 0),i=new Set(t),c=e.filter(u=>!i.has(u.id));return[...s,...c]}function KQ(){const{t:e,locale:t,setLocale:r}=Gr(),s="env(safe-area-inset-top, 0px)",i="env(safe-area-inset-bottom, 0px)";a7();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),[p,g]=S.useState(()=>p0(w5,BQ)??"dark"),x=S.useRef(p0(Qc,UQ)).current,[b,v]=S.useState(x?.preventSleep??!1),[w,k]=S.useState(x?.networkAvailable??!0),[I,N]=S.useState(l7),[M,D]=S.useState(c7),[F,Z]=S.useState(u7),[G,U]=S.useState(d7),[q,pe]=S.useState(Ih),[Ue,be]=S.useState(x?.localAccess??$Q),[Ae,Ke]=S.useState(x?.localAccess?.name??""),[qe,ie]=S.useState(!1),[Se,tt]=S.useState(null),[Ee,oe]=S.useState(null),[de,Te]=S.useState(null),[ee,ye]=S.useState(!1),ce=S.useMemo(()=>na(),[]),Ye=!!(ce?.desktopUpdateState&&ce.checkDesktopUpdate&&ce.installDesktopUpdate),[at,_e]=S.useState(null),[$,$e]=S.useState(null),[Xe,Le]=S.useState(!1),[K,Fe]=S.useState(null),[fe,De]=S.useState(!1),[lt,Tt]=S.useState(()=>Qf(p0(A5,jQ)??{})),[we,me]=S.useState(0),[Qe,gt]=S.useState(!1),[ft,ct]=S.useState(0),[Kt,$t]=S.useState(!1),[Qt,ut]=S.useState(0),[bt,It]=S.useState(!1),[St,Ht]=S.useState(0),te=S.useRef(null),[Me,ve]=S.useState({}),{terminalSettings:_t,updateTerminalSettings:Ve}=IR(),yt=_t.fontSize,Gt=_t.rendererMode,[ke,Ce]=S.useState(!1),nt=S.useRef(h7()).current,[xe,gr]=A.useState(()=>nt.sessions.map(C=>({id:C.sessionId,name:C.name,customName:C.customName,mode:C.mode,tmuxSessionName:C.tmuxSessionName}))),[xt,hn]=S.useState(nt.activeSessionId),[Xr,Rr]=S.useState(!1);S.useEffect(()=>{Xr&&f7({rendered:!0})},[Xr]);const[Vr,Un]=S.useState(null),[_r,is]=S.useState(null),[xr,ae]=S.useState([]),[ar,it]=A.useState(()=>{const C=Qr.getState();return nt.sessions.forEach(Q=>{Q.backendSessionId&&C.setTerminalSession(Q.sessionId,{sessionId:Q.backendSessionId,cols:80,rows:24,mode:Q.mode,tmuxSessionName:Q.tmuxSessionName}),Q.activeProgram!=null&&C.setSessionActiveProgram(Q.sessionId,Q.activeProgram),Q.cwd!=null&&C.setSessionCwd(Q.sessionId,Q.cwd)}),R0("session-chrome-hydrated"),E5(Qr.getState().sessions)});A.useEffect(()=>{!ce||!ke||Promise.all([ce.snapshot(),ce.desktopUpdateState?.()??Promise.resolve(null)]).then(([C,Q])=>{_e(C),$e(Q)}).catch(C=>Fe(C instanceof Error?C.message:String(C)))},[ce,ke]),A.useEffect(()=>{ce?.onDesktopUpdateState&&ce.onDesktopUpdateState($e)},[ce]),A.useEffect(()=>Qr.subscribe(C=>{const Q=E5(C.sessions);it(J=>ZQ(J,Q)?J:Q)}),[]);const os=A.useCallback(async(C,Q)=>{is(null),Un({sessionId:C,status:"submitting",error:null});try{await p7(Q),Un(J=>J?.sessionId===C?{...J,status:"waiting",error:null}:J)}catch(J){const mt=(J&&typeof J=="object"&&"code"in J?String(J.code??""):"")==="AGENT_SESSION_ACTIVE_ELSEWHERE"?e("tab.resumeAgentConflict"):J instanceof Error&&/busy/i.test(J.message)?e("tab.resumeAgentBusy"):e("tab.resumeAgentFailed");Un(jt=>jt?.sessionId===C?{...jt,error:mt}:jt),is({tone:"error",message:mt})}},[e]);A.useEffect(()=>{if(!Vr||Vr.status!=="waiting")return;const C=ar.get(Vr.sessionId);if(!C||C.agentResumeRecovered||C.agentStatus===null&&!C.agent)return;const Q=C.agent?.displayName??"Agent";Un(null),is({tone:"success",message:e("tab.resumeAgentSuccess",{agent:Q})})},[Vr,ar,e]),A.useEffect(()=>{if(!Vr||Vr.status!=="waiting"||Vr.error)return;const C=Vr.sessionId,Q=window.setTimeout(()=>{const J=e("tab.resumeAgentTimeout");Un(He=>He?.sessionId===C&&He.status==="waiting"?{...He,error:J}:He),is({tone:"error",message:J})},15e3);return()=>window.clearTimeout(Q)},[Vr,e]),A.useEffect(()=>{if(_r?.tone!=="success")return;const C=window.setTimeout(()=>is(null),3200);return()=>window.clearTimeout(C)},[_r]),A.useEffect(()=>{let C=!1;m7().then(J=>{C||Te(J)}).catch(()=>{});const Q=tm(J=>{J.type==="update-state"&&!C&&Te(J.state)});return()=>{C=!0,Q()}},[]);const fn=A.useCallback(async()=>{const C=de?.latestVersion;if(!(!C||ee)&&window.confirm(e("sidebar.updateRestartConfirm",{version:C}))){ye(!0);try{Te(await g7())}catch(Q){window.alert(Q instanceof Error?Q.message:String(Q))}finally{ye(!1)}}},[de?.latestVersion,e,ee]),Zt=A.useCallback(async()=>{if(!ee){ye(!0);try{Te(await x7())}catch(C){window.alert(C instanceof Error?C.message:String(C))}finally{ye(!1)}}},[ee]),Yr=A.useCallback(async()=>{if(!(!ce?.checkDesktopUpdate||Xe)){Le(!0);try{$e(await ce.checkDesktopUpdate())}catch(C){Fe(C instanceof Error?C.message:String(C))}finally{Le(!1)}}},[ce,Xe]),Ur=A.useCallback(async()=>{if(!(!ce?.installDesktopUpdate||Xe||$?.status!=="ready")&&window.confirm(e("settings.desktopUpdateRestartConfirm"))){Le(!0);try{$e(await ce.installDesktopUpdate())}catch(C){Fe(C instanceof Error?C.message:String(C)),Le(!1)}}},[ce,Xe,$?.status,e]);A.useEffect(()=>{document.documentElement.dataset.theme=p,b7(p),Vn(w5,p)},[p]),A.useEffect(()=>{Vn(A5,Qf(lt))},[lt]);const Nr=Ft(C=>C.leftOpen),Zn=Ft(C=>C.rightOpen),Ln=Ft(C=>C.leftPinned),kn=Ft(C=>C.leftSidebarWidth),as=Ft(C=>C.rightPinned),$n=Ft(C=>C.rightSidebarWidth),Dr=Ft(C=>C.rootPath),On=Ft(C=>C.contextKey),Y=Ft(C=>C.selectedFilePath),We=Ft(C=>C.groupByFolder),Mt=Wc(C=>C.collaborationGroups),Xt=Ft(C=>C.collapsedGroups),vr=Ft(C=>C.toggleGroupCollapsed),[At,Lr]=A.useState(()=>typeof window>"u"?!0:window.matchMedia("(min-width: 1024px)").matches),[jr,Jr]=A.useState(()=>typeof window>"u"?1024:window.innerWidth),[Ts,Nn]=A.useState(()=>typeof window>"u"?!1:window.matchMedia("(orientation: landscape)").matches),[$r,zr]=A.useState([]),[Pr,pn]=A.useState({available:!0,version:null,reason:null}),[Dn,cs]=A.useState(!1),[Ti,kr]=A.useState(null),[Yn,ur]=A.useState(null),[Kr,sn]=A.useState(null),[Kn,hs]=A.useState(null),[Or,mn]=A.useState(null),[P,he]=A.useState(null),[Ne,je]=A.useState(null),[,Re]=A.useState(0),[dt,wt]=A.useState(null),[Je,Ge]=A.useState(null),[ot,sr]=A.useState(null),[vt,zt]=A.useState(!1),[ht,Jt]=A.useState(()=>p0(Bc,C=>typeof C=="boolean")??!1),Ir=A.useCallback(async C=>{const Q=ht;Jt(C),Vn(Bc,C);try{const J=await jo({runningSessionButtonEnabled:C});Jt(J.runningSessionButtonEnabled),Vn(Bc,J.runningSessionButtonEnabled)}catch{Jt(Q),Vn(Bc,Q)}},[ht]),[Nt,pr]=A.useState(null),br=A.useCallback(C=>{pr(C)},[]),Xn=A.useRef(!1),[zn,Jn]=A.useState(null),[Cs,Vs]=A.useState(null),yn=S.useRef(null),Fr=S.useRef(!1),O=S.useRef(null),ne=S.useRef(!1),le=A.useCallback(()=>{he(null),je(null)},[]),ze=S.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("session")),[Lt,Pt]=S.useState(ze.current),[Vt,dr]=S.useState(!0),Bt=S.useRef(ze.current),ir=S.useRef(typeof window>"u"?null:new URLSearchParams(window.location.search).get("_notifTrace"));A.useEffect(()=>{if(typeof window>"u")return;const C=window.matchMedia("(min-width: 1024px)"),Q=()=>{Lr(C.matches),Jr(window.innerWidth)};return Q(),C.addEventListener("change",Q),window.addEventListener("resize",Q),()=>{C.removeEventListener("change",Q),window.removeEventListener("resize",Q)}},[]),A.useEffect(()=>{if(typeof window>"u")return;const C=window.matchMedia("(orientation: landscape)"),Q=()=>Nn(C.matches);return Q(),C.addEventListener("change",Q),()=>C.removeEventListener("change",Q)},[]);const qr=S.useMemo(()=>xt?xr.find(C=>C.sessionIds.includes(xt))??null:null,[xt,xr]),vn=qr?.id??null,Hn=qr?.sessionIds[0]??xt,In=S.useRef([]);S.useLayoutEffect(()=>{const C=In.current;if(In.current=xr,C.length===0)return;const Q=new Set(xr.flatMap(J=>J.sessionIds));for(const J of C){const He=J.sessionIds.filter(mt=>!Q.has(mt)).map(mt=>({sessionId:mt,rootPath:Qr.getState().sessions.get(mt)?.cwd??null}));He.length>0&&Ft.getState().inheritRightSidebarStateFromSplitWorkspace(J.id,He)}},[xr]),S.useLayoutEffect(()=>((()=>{const Q=Hn?Qr.getState().sessions.get(Hn)?.cwd??null:null;Ft.getState().setRootPath(Q,Hn,vn)})(),Qr.subscribe((Q,J)=>{const He=Hn?Q.sessions.get(Hn)?.cwd??null:null,mt=Hn?J.sessions.get(Hn)?.cwd??null:null;He!==mt&&Ft.getState().setRootPath(He,Hn,vn)})),[vn,Hn]);const ci=At||Ts,es=jr*.95,Cr=ci?Math.min(Math.max(jr*.22,280),340):Math.min(jr*.86,380),Ot=xt&&Dr?`${xt}\0${Dr}`:"",En=!!(Ot&&Y&&lt[Ot]),Ps=A.useCallback(C=>{Ot&&(C&&!Ft.getState().selectedFilePath||Tt(Q=>{if(!!Q[Ot]===C)return Q;if(C)return Qf({...Q,[Ot]:{updatedAt:Date.now()}});const He={...Q};return delete He[Ot],He}))},[Ot]);A.useEffect(()=>{QR(Ot,On,Y)&&Tt(C=>{if(!C[Ot])return C;const Q={...C};return delete Q[Ot],Q})},[Ot,On,Y]);const Hr=bt?"markdown-image-lightbox":Kt?"markdown-outline":Qe?"right-sidebar-repo-picker":Zn&&En?"right-sidebar-file-preview":ke?"settings":Zn&&!(as&&At)?"right-sidebar":Nr&&!(Ln&&At)?"left-sidebar":null,ts=S.useRef(Hr),Ni=S.useRef(Hr),Qn=S.useRef(!1),en=S.useRef(!1),qs=A.useCallback(()=>{if(typeof window>"u")return;const C=window.matchMedia("(hover: hover) and (pointer: fine)").matches;!At||!C||navigator.maxTouchPoints>0||window.setTimeout(()=>{window.dispatchEvent(new CustomEvent("focus-active-terminal-session"))},0)},[At]),Os=A.useCallback(C=>{if(C==="markdown-image-lightbox"){It(!1),Ht(Q=>Q+1);return}if(C==="markdown-outline"){$t(!1),ut(Q=>Q+1);return}if(C==="right-sidebar-file-preview"){$t(!1),ut(Q=>Q+1),Ps(!1),me(Q=>Q+1);return}if(C==="right-sidebar-repo-picker"){gt(!1),ct(Q=>Q+1);return}if(C==="settings"){Ce(!1),wn(!1),Pe(!1),Ks(!1);return}if(C==="left-sidebar"){Ft.getState().closeLeft();return}$t(!1),ut(Q=>Q+1),gt(!1),ct(Q=>Q+1),It(!1),Ht(Q=>Q+1),Ft.getState().closeRight()},[Ps]),Mn=A.useCallback(C=>{if(!c&&typeof window<"u"&&ts.current===C&&_0(window.history.state)===C){window.history.back();return}Os(C)},[Os,c]),Fs=A.useCallback(()=>{Ce(!1);const C=Ft.getState();C.closeRight(),C.openLeft()},[]),Ho=A.useCallback(()=>{Ce(!1);const C=Ft.getState();C.closeLeft(),C.openRight()},[]),ka=A.useCallback(()=>{Ce(!1);const C=Ft.getState();C.closeLeft(),C.openRight(),C.setRightTab("files"),C.openRightSearch()},[]),vo=A.useCallback(()=>{const C=Ft.getState();if(C.leftPinned){C.setLeftPinned(!1),C.closeLeft();return}if(Nr){Mn("left-sidebar");return}Fs()},[Fs,Mn,Nr]),oa=A.useCallback(()=>{const C=Ft.getState();C.leftPinned?(C.setLeftPinned(!1),C.openLeft()):(C.setLeftPinned(!0),C.openLeft())},[]),Za=A.useCallback(()=>{const C=Ft.getState();C.setLeftPinned(!1),C.closeLeft()},[]),wo=A.useCallback(()=>{const C=Ft.getState();C.rightPinned?(C.setRightPinned(!1),C.openRight()):(C.setRightPinned(!0),C.openRight())},[]),aa=A.useCallback(()=>{const C=Ft.getState();C.setRightPinned(!1),C.closeRight()},[]),Ao=A.useRef(0),la=A.useRef(0),Zi=A.useRef(null),Yi=A.useCallback(C=>{C.preventDefault(),Ao.current=C.clientX,la.current=Ft.getState().leftSidebarWidth;const Q=He=>{Zi.current===null&&(Zi.current=requestAnimationFrame(()=>{Zi.current=null;const mt=He.clientX-Ao.current;Ft.getState().setLeftSidebarWidth(la.current+mt)}))},J=()=>{window.removeEventListener("mousemove",Q),window.removeEventListener("mouseup",J),Zi.current!==null&&(cancelAnimationFrame(Zi.current),Zi.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",Q),window.addEventListener("mouseup",J)},[]),di=A.useRef(0),Zs=A.useRef(0),us=A.useRef(null),Ya=A.useCallback(C=>{C.preventDefault(),di.current=C.clientX;const Q=Ft.getState(),J=Q.leftPinned?Q.leftSidebarWidth:0;Zs.current=hd(Q.rightSidebarWidth,window.innerWidth,J);const He=jt=>{us.current===null&&(us.current=requestAnimationFrame(()=>{us.current=null;const mr=di.current-jt.clientX,tn=Ft.getState(),Tn=tn.leftPinned?tn.leftSidebarWidth:0;tn.setRightSidebarWidth(hd(Zs.current+mr,window.innerWidth,Tn))}))},mt=()=>{window.removeEventListener("mousemove",He),window.removeEventListener("mouseup",mt),us.current!==null&&(cancelAnimationFrame(us.current),us.current=null),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",He),window.addEventListener("mouseup",mt)},[]),fs=A.useCallback(()=>{const C=Ft.getState();if(C.rightPinned){C.setRightPinned(!1),C.closeRight();return}if(Zn){Mn("right-sidebar");return}Ho()},[Ho,Mn,Zn]),Ia=A.useCallback(()=>{!En&&!c&&typeof window<"u"&&ts.current==="right-sidebar"&&_0(window.history.state)==="right-sidebar"&&(jc("right-sidebar-file-preview"),Ni.current="right-sidebar-file-preview"),Ps(!0)},[En,c,Ps]),Ki=A.useCallback(()=>{Mn("right-sidebar-file-preview")},[Mn]),ca=A.useCallback(()=>{!Qe&&!c&&typeof window<"u"&&ts.current==="right-sidebar"&&_0(window.history.state)==="right-sidebar"&&(jc("right-sidebar-repo-picker"),Ni.current="right-sidebar-repo-picker"),gt(!0)},[Qe,c]),Wo=A.useCallback(()=>{Mn("right-sidebar-repo-picker")},[Mn]),oo=A.useCallback(()=>{!Kt&&!c&&typeof window<"u"&&ts.current&&_0(window.history.state)===ts.current&&(jc("markdown-outline"),Ni.current="markdown-outline"),$t(!0)},[Kt,c]),Ea=A.useCallback(()=>{Mn("markdown-outline")},[Mn]),Ma=A.useCallback(()=>{!c&&typeof window<"u"&&ts.current&&_0(window.history.state)===ts.current&&(jc("markdown-image-lightbox"),Ni.current="markdown-image-lightbox"),It(!0)},[c]),Ra=A.useCallback(()=>{Mn("markdown-image-lightbox")},[Mn]),ua=A.useCallback(()=>{!c&&typeof window<"u"&&ts.current&&_0(window.history.state)===ts.current&&(qQ("settings"),Ni.current="settings"),Ft.getState().closeAll(),Ce(!0)},[c]),rs=A.useCallback(()=>{Mn("settings")},[Mn]);A.useEffect(()=>{if(!ce)return;const C=()=>ua();return window.addEventListener("termdock:open-settings",C),()=>window.removeEventListener("termdock:open-settings",C)},[ce,ua]);const Go=A.useCallback(()=>{De(!0),te.current!==null&&(window.clearTimeout(te.current),te.current=null)},[]),Ci=A.useCallback(()=>{te.current!==null&&(window.clearTimeout(te.current),te.current=null),De(!1),en.current=!0,ud(),en.current},[]);A.useEffect(()=>()=>{te.current!==null&&window.clearTimeout(te.current)},[]),A.useEffect(()=>{c||ud()},[c]),A.useEffect(()=>{if(typeof window>"u"||c)return;let C=null;const Q=()=>{C!==null&&(window.clearTimeout(C),C=null)},J=tn=>{if(ts.current,en.current,ts.current){ts.current;return}!tn?.force&&en.current||(tn?.userActivated&&(en.current=!0),ud(),en.current,void 0)},He=()=>{Q(),C=window.setTimeout(()=>{C=null,J({force:!0})},L5)},mt=()=>{J({userActivated:!0})},jt=()=>{He()},mr=()=>{document.visibilityState==="visible"&&He()};return window.addEventListener("pointerdown",mt,{capture:!0,passive:!0}),window.addEventListener("touchstart",mt,{capture:!0,passive:!0}),window.addEventListener("keydown",mt,{capture:!0}),window.addEventListener("pageshow",jt),document.addEventListener("visibilitychange",mr),()=>{Q(),window.removeEventListener("pointerdown",mt,{capture:!0}),window.removeEventListener("touchstart",mt,{capture:!0}),window.removeEventListener("keydown",mt,{capture:!0}),window.removeEventListener("pageshow",jt),document.removeEventListener("visibilitychange",mr)}},[c]),A.useEffect(()=>{ts.current=Hr},[Hr]),A.useEffect(()=>{if(typeof window>"u"||Hr||c)return;const C=window.setTimeout(()=>{ts.current?(ts.current,void 0):ud()},L5);return()=>window.clearTimeout(C)},[Hr,c]),A.useEffect(()=>{if(typeof window>"u"||c)return;const C=Ni.current;Qn.current,Hr&&Hr!==C&&!Qn.current&&jc(Hr),!Hr&&C&&qs(),Ni.current=Hr,!Hr&&Qn.current&&window.setTimeout(()=>{Qn.current=!1},0)},[Hr,c,qs]),A.useEffect(()=>{if(typeof window>"u"||c)return;const C=()=>{const Q=ts.current;if(en.current,!Q){en.current=!1,en.current,Go(),j6();return}Qn.current=!0,Os(Q)};return window.addEventListener("popstate",C),()=>window.removeEventListener("popstate",C)},[Os,Go,c]),A.useEffect(()=>{const C=Q=>{const J=Q.metaKey||Q.ctrlKey;if(J&&Q.key==="b"&&!Q.shiftKey&&(Q.preventDefault(),vo()),J&&Q.shiftKey&&Q.key==="E"&&(Q.preventDefault(),fs()),J&&Q.shiftKey&&Q.key==="P"&&(Q.preventDefault(),ka()),J&&!Q.shiftKey&&Q.altKey&&(Q.key==="ArrowLeft"||Q.key==="ArrowRight")){Q.preventDefault();const He=Q.key==="ArrowRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:He}}));return}if(J&&Q.shiftKey&&!Q.altKey&&(Q.code==="BracketLeft"||Q.code==="BracketRight")){Q.preventDefault();const He=Q.code==="BracketRight"?"next":"prev";window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:He}}));return}};return document.addEventListener("keydown",C),()=>{document.removeEventListener("keydown",C)}},[vo,fs,ka]);const Ka=A.useCallback(async()=>{ie(!0),tt(null);try{const C=await jo({localAccess:{name:Ae}});be(C.localAccess),Ke(C.localAccess.name),Vn(Qc,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}catch(C){tt(C instanceof Error?C.message:"Failed to save local access name")}finally{ie(!1)}},[Ae]),Vo=A.useCallback(async()=>{ie(!0),tt(null);try{const C=await jo({localAccess:{reset:!0}});be(C.localAccess),Ke(C.localAccess.name),Vn(Qc,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}catch(C){tt(C instanceof Error?C.message:"Failed to reset local access name")}finally{ie(!1)}},[]),Wn=A.useCallback(async(C,Q="url")=>{if(C)try{if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(C);else{const J=document.createElement("textarea");J.value=C,J.style.position="fixed",J.style.left="-9999px",document.body.appendChild(J),J.focus(),J.select(),document.execCommand("copy"),document.body.removeChild(J)}oe(Q),window.setTimeout(()=>oe(J=>J===Q?null:J),1600)}catch{oe(null)}},[]),hi=A.useCallback(C=>{const Q=YQ(xe,C);Q.map(J=>J.id).join("\0")!==xe.map(J=>J.id).join("\0")&&(gr(Q),window.dispatchEvent(new CustomEvent("reorder-terminal-session",{detail:{sessionIds:Q.map(J=>J.id)}})))},[xe]),To=A.useCallback(C=>{At||C.type!=="session"||(Xn.current=!1,zt(!1),sr(C.draggableId))},[At]),da=A.useCallback(C=>{if(At||C.type!=="session")return;const Q=C.destination?.droppableId===Sp;Q!==Xn.current&&(Xn.current=Q,zt(Q),Q&&navigator.vibrate?.(20))},[At]),ao=A.useCallback(C=>{const Q=DQ(C,!At);if(Xn.current=!1,zt(!1),sr(null),!Q)return!1;const J=xe.find(mt=>mt.id===C.draggableId),He=J?ar.get(J.id):null;return J&&I2({mode:J.mode,activeProgram:He?.activeProgram??null,promptState:He?.promptState??null,shellNames:io})?(Vs(null),Jn(J.id),sn(null)):J&&window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:{sessionId:J.id,source:"other",closeMode:J.mode==="tmux"?"destroy":"auto"}})),!0},[At,xe,ar]),{groups:ha,arranged:Ys}=S.useMemo(()=>Cd(xe,C=>ar.get(C.id)?.cwd??null,We,e("sidebar.ungrouped"),xr,Mt),[xe,ar,We,e,xr,Mt]),Xa=A.useCallback(C=>{ao(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}}))},[ao,Ys]),gn=A.useCallback((C,Q)=>{const J=Q.trim();J&&window.dispatchEvent(new CustomEvent("rename-terminal-session",{detail:{sessionId:C,name:J}}))},[]),ps=A.useCallback(C=>{window.dispatchEvent(new CustomEvent("reset-terminal-session-name",{detail:{sessionId:C}}))},[]),{newSessionMode:Gn,newSessionTmuxName:ks,userSelectedNewSessionMode:lo,setNewSessionMode:qo}=RR(),[co,Di]=A.useState(null),[fi,wn]=S.useState(!1),[re,Pe]=S.useState(!1),[rt,Dt]=S.useState("idle"),Be=S.useRef(p0(cd,OQ)).current,[pt,yr]=S.useState(()=>{const C=Be?.presets;if(C&&C.length>0){const Q=M0(C);if(Q.length>0)return Q}return nu()}),[Ar,on]=S.useState(!1),[wr,Bn]=S.useState("default"),Sr=S.useRef(typeof Be?.updatedAt=="number"?Be.updatedAt:null),ms=S.useRef(!1),[Ss,Ks]=S.useState(!1),[Us,Ja]=S.useState(!1),_l=S.useRef(p0(so,PQ)).current,[Qi,Xs]=S.useState(_l??[]),[s0,i0]=S.useState(_l!==null),[Na,un]=S.useState(!1),J0=!Hr&&!re&&!fi&&!Ss&&!Us&&!P&&!zn&&!co,Xi=S.useCallback(C=>{const Q=typeof C.version=="number"?C.version:0,J=FQ(Array.isArray(C.presets)?C.presets:[],Q);Sr.current=typeof C.updatedAt=="number"?C.updatedAt:null,yr(He=>y7(He,J)?He:(ms.current=!0,J)),Vn(cd,{version:$c,presets:J,updatedAt:Sr.current??void 0})},[]);A.useEffect(()=>{const C=Q=>{if(Q.key!=="Escape")return;if(re){Q.preventDefault(),Pe(!1);return}if(fi){Q.preventDefault(),wn(!1);return}if(Ss){Q.preventDefault(),Ks(!1);return}if(Us){Q.preventDefault(),Ja(!1);return}if(P){Q.preventDefault(),le();return}if(dt){Q.preventDefault(),mn(null),wt(null);return}if(ke){Q.preventDefault(),rs();return}if(Zn&&!(as&&At)){Q.preventDefault(),Mn("right-sidebar");return}Nr&&!(Ln&&At)&&(Q.preventDefault(),Mn("left-sidebar"))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[re,fi,Ss,P,le,ke,Zn,as,Nr,Ln,At,rs,Mn]),A.useEffect(()=>{i0(!0)},[]);const[Zo,Da]=S.useState({genericProgramNames:[],wrapperScriptNames:[],shellNames:P6}),[,L]=S.useState(!1),B=S.useCallback(()=>v7().then(C=>{Da(C),io=new Set(C.shellNames),L(!0)}).catch(()=>{}),[]);A.useEffect(()=>{B()},[B]),A.useEffect(()=>tm(C=>{if(C.type==="config-updated"){if(C.key==="toolbar-presets"){rm().then(Q=>Xi(Q)).catch(Q=>{console.warn("[toolbar-presets] Failed to refresh after remote update:",Q)});return}C.key==="program-detection"&&B()}}),[Xi,B]),A.useEffect(()=>{let C=!1;return(async()=>{try{const Q=await rm();if(C)return;Xi(Q)}catch(Q){console.warn("[toolbar-presets] Failed to load from server:",Q)}finally{C||on(!0)}})(),()=>{C=!0}},[Xi]),A.useEffect(()=>{if(Ar){if(ms.current){ms.current=!1;return}Vn(cd,{version:$c,presets:pt,updatedAt:Sr.current??void 0}),w7({version:$c,presets:pt,baseUpdatedAt:Sr.current??void 0}).then(C=>{Sr.current=typeof C.updatedAt=="number"?C.updatedAt:null,Vn(cd,{version:$c,presets:pt,updatedAt:Sr.current??void 0})}).catch(C=>{const Q=C instanceof Error&&"current"in C?C.current:null;Q&&typeof Q=="object"&&Xi(Q),console.warn("[toolbar-presets] Failed to save to server:",C)})}},[Xi,pt,Ar]),A.useEffect(()=>{V0().then(C=>{v(Q=>Q===C.preventSleep?Q:C.preventSleep),k(Q=>Q===C.networkAvailable?Q:C.networkAvailable),be(C.localAccess),Ke(C.localAccess.name),Jt(C.runningSessionButtonEnabled),Vn(Bc,C.runningSessionButtonEnabled),Vn(Qc,{preventSleep:C.preventSleep,networkAvailable:C.networkAvailable,localAccess:C.localAccess})}).catch(()=>{})},[]),A.useEffect(()=>{if(!I)return;const C=Ih();pe(C),C!=="granted"&&(N(!1),Bu(!1))},[I]),A.useEffect(()=>{if(!I)return;cc();const C=()=>{document.visibilityState==="visible"&&(cc(),Q7())},Q=window.setInterval(()=>{cc()},360*60*1e3);return document.addEventListener("visibilitychange",C),window.addEventListener("focus",C),()=>{window.clearInterval(Q),document.removeEventListener("visibilitychange",C),window.removeEventListener("focus",C)}},[I]);const j=A.useCallback(async()=>{if(I){N(!1),Bu(!1),A7(),pe(Ih());return}const C=await T7();if(pe(C),C!=="granted"){N(!1),Bu(!1);return}N(!0),Bu(!0),await cc(!0,!0),Dt("idle")},[I]),W=A.useCallback(async()=>{Dt("checking"),await na()?.prepareNotificationTest?.();const C=await C7({title:"Termdock",body:e("settings.notificationsTestBody"),tag:"termdock-notification-test",requireHidden:!1,data:{url:"/"}});Dt(C?"delivered":"failed")},[e]),Oe=A.useCallback(C=>{D(C),S7(C),Eh()},[]),Ie=A.useCallback(C=>{Z(C),_7(C),Eh()},[]),st=A.useCallback(C=>{U(C),L7(C),Eh()},[]);A.useEffect(()=>{pt.some(C=>C.id===wr)||Bn(pt[0]?.id??"default")},[wr,pt]),A.useEffect(()=>{if(!Pr.available&&Gn==="tmux"){qo("shell",{userInitiated:!1});return}Pr.available&&lo!=="shell"&&Gn!=="tmux"&&qo("tmux",{userInitiated:!1})},[Gn,Pr.available,lo,qo]),A.useEffect(()=>{Di(null)},[ke,Gn,Pr.available]),A.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),ve(C)},[]);const et=A.useCallback(C=>{if(ao(C)||!C.destination)return;if(C.type==="group"){if(C.source.index===C.destination.index)return;hi(z5(ha,C.source.index,C.destination.index));return}if(C.source.droppableId!==C.destination.droppableId||C.source.index===C.destination.index)return;const Q=C.source.droppableId.replace(/^group-sessions:/,""),J=ha.find(He=>He.key===Q);J&&window.dispatchEvent(new CustomEvent("reorder-navigation-session",{detail:{sourceId:J.sessions[C.source.index]?.id,targetId:J.sessions[C.destination.index]?.id}}))},[ha,hi,ao]),Et=S.useMemo(()=>Ys.flatMap(C=>{const Q=ar.get(C.id);if(Q?.agentStatus!=="working")return[];const{primary:J,secondary:He}=Ca(C,Q?.activeProgram??null,Q?.cwd??null,io,Q?.shellTitle??null,Q?.promptState??null);return[{id:C.id,label:J,detail:He}]}),[Ys,ar]),lr=xt?Ys.findIndex(C=>C.id===xt):-1,an=Ys.length>0&&lr>=0?`${lr+1}/${Ys.length}`:`${Ys.length}`,Br=S.useMemo(()=>{let C=0;for(const Q of xe){const J=ar.get(Q.id);(J?.agentStatus==="waiting"||J?.agentNeedsReview)&&(C+=1)}return{running:Et.length,review:C}},[Et.length,xe,ar]),An=S.useMemo(()=>Ys.flatMap(C=>{const Q=ar.get(C.id);if(Q?.agentStatus!=="waiting"&&!Q?.agentNeedsReview)return[];const{primary:J}=Ca(C,Q.activeProgram,Q.cwd,io,Q.shellTitle,Q.promptState);return[{id:Q.terminalSessionId??C.id,label:J,waiting:Q.agentStatus==="waiting"}]}),[Ys,ar]);k7(Br.running,Br.review,An);const ln=xt?xe.find(C=>C.id===xt)??null:null,hr=ln?ar.get(ln.id):void 0,dn=!!(ln&&hr?.agentResumeRecovered&&hr.agentNativeSessionId&&hr.terminalSessionId),cn=ln&&Vr?.sessionId===ln.id?Vr:null;S.useLayoutEffect(()=>{if(!Vt)return;const C=O.current;if(!C)return;const Q=!ne.current;C.scrollIntoView({inline:"nearest",block:"nearest",behavior:Q?"auto":"smooth"}),ne.current=!0,Q&&R0("active-tab-positioned")},[xt,Vt]),A.useEffect(()=>{Or&&yn.current&&(yn.current.scrollIntoView({block:"nearest",inline:"nearest"}),yn.current.focus(),yn.current.select()),Or||(Fr.current=!1)},[Or]);const Si=A.useCallback(C=>{window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:C}))},[]),el=A.useCallback((C,Q)=>{je(Q??null),he(C)},[]),gs=c6(),Is=A.useCallback(C=>{if(!C)return;Pt(C),ir.current&&mo("info","PWA_NOTIFICATION_CLICK app-focus-request",{traceId:ir.current,requestedSessionId:C,activeSessionId:xt,sessions:xe.map(J=>({id:J.id,terminalSessionId:ar.get(J.id)?.terminalSessionId??null}))}),I7(C);const Q=xe.find(J=>J.id===C||ar.get(J.id)?.terminalSessionId===C);Q?(Bt.current=null,ir.current&&mo("info","PWA_NOTIFICATION_CLICK app-focus-dispatch",{traceId:ir.current,requestedSessionId:C,targetSessionId:Q.id}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:Q.id}))):(Bt.current=C,ir.current&&mo("info","PWA_NOTIFICATION_CLICK app-focus-pending",{traceId:ir.current,requestedSessionId:C}))},[xt,xe,ar]);A.useEffect(()=>{if(typeof window>"u"||typeof caches>"u")return;let C=!1;const Q=async()=>{if(window.parent!==window&&La()){dr(!0);return}try{const He=await caches.open(HQ),mt=await He.match(k5);if(!mt)return;await He.delete(k5);const jt=await mt.json();if(C)return;const mr=typeof jt.sessionId=="string"?jt.sessionId:null,tn=typeof jt.traceId=="string"?jt.traceId:null,Tn=typeof jt.clickedAt=="number"?jt.clickedAt:0,xn=Date.now()-Tn;mo("info","PWA_NOTIFICATION_CLICK app-cache-consumed",{traceId:tn,sessionId:mr,ageMs:xn,valid:!!(mr&&xn>=0&&xn<=I5),visibilityState:document.visibilityState}),mr&&xn>=0&&xn<=I5&&(ir.current=tn,typeof jt.targetPeerId=="string"&&jt.targetPeerId!==uc()?.targetPeerId?La()?.focusSession(jt.targetPeerId,mr):Is(mr))}catch(He){mo("warn","PWA_NOTIFICATION_CLICK app-cache-failed",{error:He instanceof Error?He.message:String(He)})}finally{C||dr(!0)}},J=()=>{document.visibilityState==="visible"&&Q()};return Q(),document.addEventListener("visibilitychange",J),window.addEventListener("pageshow",Q),()=>{C=!0,document.removeEventListener("visibilitychange",J),window.removeEventListener("pageshow",Q)}},[Is]),A.useEffect(()=>{if(typeof window>"u")return;const C=new URLSearchParams(window.location.search),Q=C.get("session");if(!Q)return;mo("info","PWA_NOTIFICATION_CLICK app-url-received",{traceId:ir.current,targetSessionId:Q,href:window.location.href,visibilityState:document.visibilityState});const J=C.get("service");J&&J!==uc()?.targetPeerId?La()?.focusSession(J,Q):Bt.current=Q,C.delete("service"),C.delete("session"),C.delete("_notifTrace");const He=C.toString(),mt=`${window.location.pathname}${He?`?${He}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",mt)},[]),A.useEffect(()=>{if(typeof window>"u")return;const C=new URLSearchParams(window.location.search);if(C.get("_notif")!=="1")return;const Q=C.get("session");C.delete("_notif");const J=C.toString(),He=`${window.location.pathname}${J?`?${J}`:""}${window.location.hash}`;if(window.history.replaceState(window.history.state,"",He),window.parent!==window&&La())return;const mt=new BroadcastChannel("termdock:notif");let jt=!1;const mr=Tn=>{Tn.data?.type==="termdock:notif-pong"&&!jt&&(jt=!0,mt.close(),window.close())};mt.addEventListener("message",mr),mt.postMessage({type:"termdock:notif-ping",sessionId:Q,targetPeerId:C.get("service")});const tn=setTimeout(()=>{jt||mt.close()},500);return()=>{clearTimeout(tn),jt||mt.close()}},[]),A.useEffect(()=>{if(typeof window>"u"||window.parent!==window&&La())return;const C=new BroadcastChannel("termdock:notif"),Q=J=>{J.data?.type==="termdock:notif-ping"&&(C.postMessage({type:"termdock:notif-pong"}),typeof J.data.sessionId=="string"&&(typeof J.data.targetPeerId=="string"&&J.data.targetPeerId!==uc()?.targetPeerId?La()?.focusSession(J.data.targetPeerId,J.data.sessionId):Is(J.data.sessionId)))};return C.addEventListener("message",Q),()=>C.close()},[Is]),A.useEffect(()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return;const C=Q=>{const J=Q.data;if(J&&J.type==="termdock:focus-session"&&typeof J.sessionId=="string"){if(typeof J.targetPeerId=="string"&&J.targetPeerId!==uc()?.targetPeerId){La()?.focusSession(J.targetPeerId,J.sessionId)&&Q.ports[0]?.postMessage({type:"termdock:focus-session-ack"});return}Q.ports[0]?.postMessage({type:"termdock:focus-session-ack"}),Is(J.sessionId)}else J?.type==="termdock:push-subscription-changed"?cc(!0):J?.type};return navigator.serviceWorker.addEventListener("message",C),()=>navigator.serviceWorker.removeEventListener("message",C)},[Is]),A.useEffect(()=>{const C=Q=>{const J=Q.detail;typeof J=="string"&&Is(J)};return window.addEventListener("termdock:focus-session",C),()=>window.removeEventListener("termdock:focus-session",C)},[Is]),A.useEffect(()=>{const C=()=>{const Q=B7(uc()?.targetPeerId);Q&&Is(Q)};return C(),window.addEventListener("termdock:workspace-session",C),()=>window.removeEventListener("termdock:workspace-session",C)},[Is]),A.useEffect(()=>{const C=Bt.current;if(!C)return;const Q=xe.find(J=>J.id===C||ar.get(J.id)?.terminalSessionId===C);Q?(Bt.current=null,ir.current&&mo("info","PWA_NOTIFICATION_CLICK app-pending-dispatch",{traceId:ir.current,requestedSessionId:C,targetSessionId:Q.id,activeSessionId:xt}),window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:Q.id}))):ir.current&&mo("info","PWA_NOTIFICATION_CLICK app-pending-unmatched",{traceId:ir.current,requestedSessionId:C,activeSessionId:xt,sessions:xe.map(J=>({id:J.id,terminalSessionId:ar.get(J.id)?.terminalSessionId??null}))})},[xt,xe,ar]);const _s=S.useMemo(()=>{const C=[];for(const Q of xe){const J=ar.get(Q.id);(J?.agentStatus==="waiting"||J?.agentNeedsReview)&&C.push(Q.id)}return C},[xe,ar]),Ji=A.useCallback(()=>{if(_s.length===0)return;xt&&Qr.getState().clearAgentNeedsReview(xt);const C=xt?xe.findIndex(J=>J.id===xt):-1,Q=_s.find(J=>xe.findIndex(He=>He.id===J)>C)??_s[0];Q&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:Q}))},[_s,xe,xt]),tl=A.useCallback(()=>{if(_s.length===0)return;xt&&Qr.getState().clearAgentNeedsReview(xt);const C=xt?xe.findIndex(J=>J.id===xt):xe.length,Q=[..._s].reverse().find(J=>xe.findIndex(He=>He.id===J)<C)??_s[_s.length-1];Q&&window.dispatchEvent(new CustomEvent("switch-terminal-session",{detail:Q}))},[_s,xe,xt]);A.useEffect(()=>{const C=Q=>{!Q.altKey||!Q.shiftKey||Q.metaKey||Q.ctrlKey||Q.key!=="ArrowUp"&&Q.key!=="ArrowDown"||(Q.preventDefault(),Q.key==="ArrowUp"?tl():Ji())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[Ji,tl]);const o0=A.useCallback(async C=>{const J=Qr.getState().sessions.get(C)?.cwd;if(J)try{await navigator.clipboard?.writeText(J),Ge(J),window.setTimeout(()=>{Ge(He=>He===J?null:He)},1400)}catch{}},[]),a0=A.useCallback(C=>{gr(C.sessions),hn(C.activeSessionId),ae(C.splitWorkspaces),Qr.getState().setActiveSessionId(C.activeSessionId)},[]),yu=A.useCallback(()=>{Rr(!0)},[]),ph=A.useCallback(()=>{Rr(!0),window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("termdock:initial-viewport-presented"))})},[]);A.useEffect(()=>{if(!Lt||!xt)return;xe.find(Q=>Q.id===Lt||ar.get(Q.id)?.terminalSessionId===Lt)?.id===xt&&Pt(null)},[xt,Lt,xe,ar]);const Co=A.useCallback(C=>{const Q=C?.mode??Gn,J=Q==="tmux"&&(C?.tmuxSessionName?.trim()||ks.trim())||void 0,He=C?.cwd||(xt?Qr.getState().sessions.get(xt)?.cwd:void 0);window.dispatchEvent(new CustomEvent("new-terminal-session",{detail:{mode:Q,tmuxSessionName:J,cwd:He,command:C?.command}}))},[Gn,ks,xt]),Qa=A.useCallback(async()=>{cs(!0);try{const C=await Bf();if(pn(C),!C.available){zr([]);return}const Q=await jf();zr(Q)}catch{pn({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),zr([])}finally{cs(!1)}},[]),Bi=A.useCallback(async C=>{ur(C),sn(null);try{const{cleanedSessions:Q}=await Q5(C);for(const J of Q)window.dispatchEvent(new CustomEvent("close-terminal-session-by-backend",{detail:J}));kr(null),await Qa()}catch(Q){sn(Q instanceof Error?Q.message:"Failed to kill tmux session")}finally{ur(null)}},[Qa]);A.useEffect(()=>{if(!Kn)return;if($r.find(J=>J.name===Kn&&(J.connected||J.boundFrontendSessionId))){hs(null);return}const Q=setTimeout(()=>hs(null),1e4);return()=>clearTimeout(Q)},[Kn,$r]);const rl=A.useCallback(C=>{window.dispatchEvent(new CustomEvent("close-terminal-session",{detail:C}))},[]),vu=A.useCallback(C=>{const Q=C??xt;Q&&window.dispatchEvent(new CustomEvent("open-terminal-split-chooser",{detail:Q}))},[xt]),ec=A.useCallback((C,Q)=>{window.dispatchEvent(new CustomEvent("set-terminal-split-direction",{detail:{sessionId:C,layout:Q}}))},[]),wu=A.useCallback((C,Q)=>{window.dispatchEvent(new CustomEvent("reorder-terminal-split-workspace",{detail:{workspaceId:C,sessionIds:Q}}))},[]),Au=A.useCallback((C,Q)=>{window.dispatchEvent(new CustomEvent("rename-terminal-split-workspace",{detail:{workspaceId:C,name:Q}}))},[]),Tu=A.useCallback((C,Q)=>{window.dispatchEvent(new CustomEvent("combine-terminal-split-sessions",{detail:{primaryId:C,secondaryId:Q}}))},[]),Ll=A.useCallback((C,Q)=>{const J=xe.find(mt=>mt.id===C);if(!J)return;const He=ar.get(C);if(!I2({mode:J.mode,activeProgram:He?.activeProgram??null,promptState:He?.promptState??null,shellNames:io})){rl({sessionId:C,source:"sidebar",closeMode:J.mode==="tmux"?"destroy":"auto"});return}Vs(Q?{x:Q.clientX,y:Q.clientY}:null),Jn(C),sn(null)},[xe,ar,rl]);A.useEffect(()=>{if(!ce)return;const C=Q=>{const J=Q.detail;J==="new-session"?Co():J==="close-session"?xt&&Ll(xt):J==="previous-session"||J==="next-session"?window.dispatchEvent(new CustomEvent("cycle-terminal-session",{detail:{direction:J==="next-session"?"next":"prev"}})):J==="toggle-left-sidebar"?vo():J==="toggle-right-sidebar"?fs():J==="previous-attention"?tl():J==="next-attention"&&Ji()};return window.addEventListener("termdock:native-command",C),()=>window.removeEventListener("termdock:native-command",C)},[xt,ce,Co,Ll,vo,fs,Ji,tl]);const nl=S.useMemo(()=>xe.find(C=>C.id===zn)??null,[xe,zn]),mh=S.useMemo(()=>{if(!nl)return"";const C=ar.get(nl.id);return Ca(nl,C?.activeProgram??null,C?.cwd??null,io,C?.shellTitle??null,C?.promptState??null).primary},[nl,ar]);A.useEffect(()=>{if(!ke)return;let C=!1,Q=!1;const J=async()=>{if(!Q)try{const mt=await Bf();if(C||pn(mt),!mt.available){C||zr([]);return}const jt=await jf();C||zr(jt)}catch{Q=!0,C||(pn({available:!1,version:null,reason:"tmux integration is unavailable with the current server build."}),zr([]))}};J();const He=setInterval(()=>{J()},4e3);return()=>{C=!0,clearInterval(He)}},[ke]);const Cu=co??Gn,tc=Cu==="shell",rc=Cu==="tmux"&&Pr.available,nc=S.useMemo(()=>E7($r.map(C=>({...C,id:C.name})),C=>C.cwd??null,e("sidebar.ungrouped")),[$r,e]),sc=S.useMemo(()=>$r.filter(C=>C.recoveryCandidate===!0&&!C.connected&&!C.boundFrontendSessionId).sort((C,Q)=>(Q.lastActiveAt??Q.createdAt??0)-(C.lastActiveAt??C.createdAt??0)),[$r]);A.useEffect(()=>{!Nr&&!(Ln&&At)||Qa()},[Nr,Ln,At,xe.length,Qa]);const l0=(C,Q,J,He=!1)=>{const mt=C.id===xt,jt=C.id===Or,mr=ar.get(C.id),{primary:tn,secondary:Tn}=Ca(C,mr?.activeProgram??null,mr?.cwd??null,io,mr?.shellTitle??null,mr?.promptState??null),xn=Zc(mr?.cwd??null),_i=Q?Tn??(xn&&xn!==tn?xn:null):null,rn=mr?.gitStatus,Li=`${mr?.cwd||C.name}${rn?`
155
+ ⎇ ${rn.branch} +${rn.added} −${rn.removed}`:""}`,Ms=!!(mr?.tuiProgress&&mr.tuiProgress.state!=="remove"),$s=mr?.agentStatus==="working"||Ms?"var(--success)":mr?.agentStatus==="waiting"||mr?.agentNeedsReview?"var(--warning)":mr?.inCopyMode?"var(--tmux)":null;if(jt&&At&&!dt){const pi=C.customName?C.name:tn,Rs=(Ns,El)=>{const oc=El.trim();oc?oc!==pi&&gn(Ns,oc):ps(Ns),mn(null)};return a.jsx("input",{ref:Ns=>{yn.current=Ns},type:"text",defaultValue:pi,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(pi.length,5)}ch`},onKeyDown:Ns=>{Ns.key==="Enter"?Rs(C.id,Ns.target.value):Ns.key==="Escape"&&mn(null)},onBlur:Ns=>Rs(C.id,Ns.target.value)})}return a.jsx("div",{ref:mt?O:null,onContextMenu:pi=>{pi.preventDefault(),je({x:pi.clientX,y:pi.clientY}),he(C.id)},...gs(()=>el(C.id)),className:He?`group relative inline-flex h-5 shrink-0 items-center rounded-sm text-[11px] leading-none transition ${mt?"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 ${mt?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:bg-surface-elevated/50 hover:text-foreground"}`,style:!He&&mt&&$s?{boxShadow:`inset 2px 0 0 0 ${$s}`}:!He&&mt?{boxShadow:"inset 2px 0 0 0 rgb(var(--primary-rgb, 99 102 241))"}:void 0,title:Li,children:a.jsx("button",{type:"button",...J??{},onClick:()=>Si(C.id),className:`inline-flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-left ${He?"px-1":"py-1 pl-1 pr-1.5 sm:pl-1.5 sm:pr-2"} ${J?"cursor-grab active:cursor-grabbing":""}`,title:Li,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:[M5(C.mode,mr),mr?.agentResumeRecovered&&a.jsx(Hl,{size:He?9:10,className:"-ml-0.5 shrink-0 text-[color:var(--warning)]","aria-label":e("tab.resumeAgentAvailable")}),Ms&&!mr?.agentStatus&&a.jsx(Sn,{size:He?9:10,className:"-ml-0.5 shrink-0 animate-spin text-[color:var(--success)]"})]}),_i?a.jsxs("span",{className:"flex min-w-0 flex-col justify-center leading-[0.82rem] sm:leading-[0.85rem]",children:[a.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${mr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:tn}),a.jsx("span",{className:"truncate text-[9px] text-muted-foreground/80 sm:text-[9.5px]",children:_i})]}):a.jsx("span",{className:`whitespace-nowrap text-[11px] sm:text-[12px] ${mr?.inCopyMode?"text-[color:var(--tmux)]":""}`,children:tn})]})})})},kl=()=>a.jsx(Ha,{droppableId:Sp,type:"session",isDropDisabled:At,children:(C,Q)=>{const J=vt||Q.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":!ot,"data-mobile-session-destroy-target":"","data-active":J?"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 ${ot?J?"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(qi,{size:28,strokeWidth:1.8}),a.jsx("span",{className:"px-2 text-center text-[11px] font-semibold leading-tight",children:e(J?"tab.releaseToClose":"tab.dragToClose")})]}),C.placeholder]})}}),uo=Ln&&At,sl=as&&At,c0=hd($n,jr,uo?kn:0),u0=sl?c0+D5:0,il=uo?xe.find(C=>C.id===xt):null,Es=il?ar.get(il.id):void 0,Su=il?Ca(il,Es?.activeProgram??null,Es?.cwd??null,io,Es?.shellTitle??null,Es?.promptState??null).primary:"",_u=At?qr:null,gh=uo&&!_u&&Es?Es.agentStatus==="working"?"bg-gradient-to-r from-[rgb(var(--success-rgb)_/_0.08)] to-transparent":Es.agentStatus==="waiting"?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.14)] to-transparent":Es.agentNeedsReview?"bg-gradient-to-r from-[rgb(var(--warning-rgb)_/_0.08)] to-transparent":Es.inCopyMode?"bg-gradient-to-r from-[rgb(var(--tmux-rgb)_/_0.07)] to-transparent":"":"",ic=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:`${At?"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 ${uo?"flex justify-end":"flex justify-between"} ${We?"h-10 sm:h-10":"h-9 sm:h-10"} ${gh}`,style:{marginRight:u0||void 0,display:_u?"none":void 0},children:[!uo&&a.jsxs("button",{type:"button",onClick:vo,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")}: ${Br.running} · ${e("agent.needsReview")}: ${Br.review}`,children:[a.jsx(i9,{size:14}),a.jsx(AD,{runningCount:Br.running,reviewCount:Br.review,className:"sm:hidden"})]}),uo?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:il?a.jsxs(a.Fragment,{children:[M5(il.mode,Es),a.jsx("span",{className:`truncate text-[12px] font-medium ${Es?.inCopyMode?"text-[color:var(--tmux)]":"text-foreground"}`,children:Su}),Es?.agentStatus==="working"&&a.jsx("span",{title:Es?.agentMessage??void 0,children:a.jsx(Sn,{size:12,className:"shrink-0 animate-spin text-[color:var(--success)]"})}),Es?.agentStatus==="waiting"&&a.jsx("span",{title:Es?.agentMessage??void 0,children:a.jsx(Sd,{size:12,className:"shrink-0 animate-bounce-y text-[color:var(--warning)]"})}),!Es?.agentStatus&&Es?.agentNeedsReview&&a.jsx("span",{title:Es?.agentMessage??void 0,children:a.jsx(Kl,{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")})}):We?a.jsxs($d,{onDragStart:To,onDragUpdate:da,onDragEnd:et,children:[kl(),a.jsx(Ha,{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:[ha.map((Q,J)=>{let He=0,mt=0;for(const Tn of Q.sessions){const xn=ar.get(Tn.id);xn?.agentStatus==="working"&&(He+=1),(xn?.agentStatus==="waiting"||xn?.agentNeedsReview)&&(mt+=1)}const jt=Q.sessions.some(Tn=>Tn.id===xt),mr=Xt.has(Q.key),tn=Q.key==="";return a.jsx(za,{draggableId:`group-${Q.key||"__ungrouped__"}`,index:J,isDragDisabled:tn,disableInteractiveElementBlocking:!0,children:(Tn,xn)=>a.jsxs("div",{ref:Tn.innerRef,...Tn.draggableProps,className:`flex w-fit shrink-0 flex-col justify-center gap-px rounded-md py-0.5 px-1 ring-1 transition-colors ${xn.isDragging?"bg-surface-elevated ring-primary/30 shadow-lg opacity-90":jt?"bg-primary/[0.06] ring-primary/20":"bg-surface-2/40 ring-border/10"}`,children:[a.jsxs("button",{type:"button",...tn?{}:Tn.dragHandleProps,onClick:()=>vr(Q.key),className:`flex ${mr?"":Q.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 ${tn?"":"cursor-grab active:cursor-grabbing"} ${jt?"text-primary/80":"text-muted-foreground/55"}`,title:Q.key||Q.label,children:[a.jsx(hu,{size:9,className:`shrink-0 opacity-70 transition-transform ${mr?"":"rotate-90"}`}),a.jsx("span",{className:"min-w-0 truncate",children:Q.label}),He>0&&a.jsx("span",{className:"ml-auto h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--success)]"}),mt>0&&a.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--warning)] ${He>0?"":"ml-auto"}`})]}),mr?a.jsx("span",{className:"flex h-5 items-center text-[10px] leading-none text-muted-foreground/50",children:e("tab.sessionCount",{count:Q.sessions.length})}):a.jsx(Ha,{droppableId:`group-sessions:${Q.key}`,type:"session",direction:"horizontal",children:_i=>a.jsxs("div",{ref:_i.innerRef,..._i.droppableProps,className:"flex items-center gap-px",children:[Q.sessions.map((rn,Li)=>a.jsx(za,{draggableId:rn.id,index:Li,disableInteractiveElementBlocking:!0,children:(Ms,$s)=>a.jsx("div",{ref:Ms.innerRef,...Ms.draggableProps,className:`flex shrink-0 items-center ${$s.isDragging?"opacity-70":""}`,children:l0(rn,!1,Ms.dragHandleProps,!0)})},rn.id)),_i.placeholder]})})]})},Q.key||"__ungrouped__")}),C.placeholder,a.jsx("button",{type:"button",onClick:()=>Co(),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(Ri,{size:14})})]})})]}):a.jsxs($d,{onDragStart:To,onDragUpdate:da,onDragEnd:Xa,children:[kl(),a.jsx(Ha,{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((Q,J)=>Q.id===Or?a.jsx(S.Fragment,{children:a.jsx(za,{draggableId:Q.id,index:J,isDragDisabled:!0,children:mt=>a.jsx("div",{ref:mt.innerRef,...mt.draggableProps,className:"flex h-full items-center",children:l0(Q,!0)})})},Q.id):a.jsx(S.Fragment,{children:a.jsx(za,{draggableId:Q.id,index:J,disableInteractiveElementBlocking:!0,children:(mt,jt)=>a.jsx("div",{ref:mt.innerRef,...mt.draggableProps,className:`flex h-full shrink-0 items-center ${jt.isDragging?"opacity-70":""}`,children:l0(Q,!0,mt.dragHandleProps)})})},Q.id)),a.jsx("button",{type:"button",onClick:()=>Co(),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(Ri,{size:14})}),C.placeholder]})})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[!uo&&Br.running>0&&a.jsx("span",{className:"hidden items-center gap-1 sm:inline-flex",children:a.jsx(_6,{count:Br.running,tone:"running",title:e("agent.aiRunning")})}),!uo&&xe.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 ${lr+1} of ${xe.length}`,children:an}),!sl&&a.jsx("button",{type:"button",onClick:fs,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(q5,{size:14})})]})]}),dn&&ln&&hr?.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:u0||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:!cn?.error&&(cn?.status==="submitting"||cn?.status==="waiting")?a.jsx(Sn,{size:14,className:"animate-spin"}):a.jsx(Hl,{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:hr.agent?.displayName??"Agent"})}),a.jsx("div",{className:`truncate text-[10px] sm:text-[11px] ${cn?.error?"text-destructive":"text-muted-foreground"}`,children:cn?.error??(cn?.status==="submitting"?e("tab.resumeAgentSubmitting"):cn?.status==="waiting"?e("tab.resumeAgentWaiting"):e("tab.resumeAgentRecoveredHint"))})]}),a.jsx("button",{type:"button",disabled:!cn?.error&&(cn?.status==="submitting"||cn?.status==="waiting"),onClick:()=>{os(ln.id,hr.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:cn?.error?e("common.retry"):e("tab.resumeAgentNow")}),a.jsx("button",{type:"button",onClick:()=>{Qr.getState().setAgentResumeRecovered(ln.id,!1),Un(C=>C?.sessionId===ln.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(ws,{size:13})})]}),a.jsx("div",{ref:br,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(cL,{terminalSettings:_t,colorTheme:p,toolbarPresets:pt,showDebug:u&&At,terminalFocusAvailable:J0,defaultSessionMode:Gn,defaultTmuxSessionName:ks,connectionPrioritySessionId:Lt,connectionPriorityReady:Vt,desktopRightSidebarEnabled:At,onToggleRightSidebar:fs,desktopFloatingTitle:At,desktopPinnedLeftSidebarWidth:uo?kn:0,desktopViewportWidth:jr,onSessionDataUpdate:a0,onInitialViewportReady:ph,onInitialRecoveryRequired:yu})})})]})}),a.jsx(LD,{reviewCount:Br.review,runningSessions:Et,activeSessionId:xt,runningButtonEnabled:ht,isDesktopLayout:At,containerElement:Nt,occlusionInsets:{right:u0}}),ke&&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:rs,"aria-label":e("settings.closeSettings")}),a.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-dialog-title",className:"pointer-events-none fixed inset-0 z-drawer-panel flex items-stretch justify-center p-0 animate-fade-in sm:p-4 md:p-6",children:a.jsxs("div",{className:"pointer-events-auto flex h-full w-full max-w-5xl flex-col overflow-hidden bg-surface shadow-[0_28px_90px_var(--app-shadow-strong),0_14px_34px_var(--app-shadow-soft)] sm:max-h-[calc(100dvh-3rem)] sm:rounded-3xl sm:border sm:border-border/15",style:{paddingTop:s,paddingBottom:i},children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border/15 px-4 py-3 sm:px-6 sm:py-4",children:[a.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full bg-primary/15 text-primary sm:h-9 sm:w-9",children:a.jsx(T9,{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:rs,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(ws,{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:()=>Ve({fontSize:Math.max(8,yt-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:yt,onChange:C=>Ve({fontSize:parseInt(C.target.value,10)}),className:"min-w-0 flex-1","aria-label":e("settings.font")}),a.jsx("button",{type:"button",onClick:()=>Ve({fontSize:Math.min(32,yt+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:[yt,"px"]})]}),a.jsx(NQ,{}),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 Q=Gt===C;return a.jsx("button",{type:"button",onClick:()=>Ve({rendererMode:C}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${Q?"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",t9,e("settings.darkTheme")],["light",L9,e("settings.lightTheme")]].map(([C,Q,J])=>{const He=p===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 ${He?"bg-primary/20 text-primary":"text-muted-foreground hover:bg-surface-elevated"}`,children:[a.jsx(Q,{size:12}),a.jsx("span",{children:J})]},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 Q=Gn===C,J=C==="tmux"&&!Pr.available;return a.jsx("button",{type:"button",disabled:J,onClick:()=>qo(C,{userInitiated:!0}),className:`flex-1 rounded px-2 py-1 text-[11px] font-medium transition ${Q?"bg-primary/20 text-primary":J?"cursor-not-allowed text-muted-foreground/40":"text-muted-foreground hover:bg-surface-elevated"}`,title:J?Pr.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($a,{checked:u,size:"sm"})]}),a.jsxs("button",{type:"button",onClick:async()=>{const C=!b;v(C);try{const Q=await jo({preventSleep:C});v(Q.preventSleep),k(Q.networkAvailable),be(Q.localAccess),Vn(Qc,{preventSleep:Q.preventSleep,networkAvailable:Q.networkAvailable,localAccess:Q.localAccess})}catch{v(!C)}},className:`flex items-center justify-between rounded-xl px-3 py-2 text-[12px] transition ${b?"bg-[rgb(var(--success-rgb)_/_0.15)] text-[color:var(--success)]":"bg-surface-2 text-foreground hover:bg-surface-elevated"}`,title:!w&&b?e("settings.noSleepUnavailable"):void 0,children:[a.jsx("span",{className:"font-medium truncate",children:e("settings.noSleep")}),a.jsx($a,{checked:b,size:"sm"})]})]})]}),a.jsxs("button",{type:"button",onClick:()=>Pe(!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(a8,{size:14,className:I?"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(I?M&&F?"settings.notificationsBothOnSummary":M?"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(I?"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] ${Ue.status==="active"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:Ue.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:Ae,onChange:C=>Ke(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:qe,onClick:()=>{Ka()},className:"rounded-full bg-primary/15 px-3 py-1.5 text-[11px] font-medium text-primary transition hover:bg-primary/25 disabled:opacity-50",children:e(qe?"settings.saving":"common.save")}),a.jsx("button",{type:"button",disabled:qe,onClick:()=>{Vo()},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:[Ue.url&&a.jsxs("button",{type:"button",onClick:()=>{Wn(Ue.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: ",Ue.url]}),a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium",children:Ee==="lan"?"Copied":e("common.copy")})]}),Ue.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:Ue.interfaces.map(C=>{const Q=C.url??`${Ue.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 ${Q}`,className:"h-28 w-28"})}),a.jsxs("button",{type:"button",onClick:()=>{Wn(Q,`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:Q}),a.jsx("span",{className:"shrink-0 text-[10px]",children:Ee===`ip-${C.address}`?"Copied":e("common.copy")})]})]},`${C.name}-${C.address}`)})})]}),Ue.onboardingUrl&&a.jsxs("button",{type:"button",onClick:()=>{Wn(Ue.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"),": ",Ue.onboardingUrl]}),a.jsx("span",{className:"shrink-0 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-medium",children:Ee==="setup"?"Copied":e("common.copy")})]}),a.jsxs("div",{className:"text-muted-foreground",children:[Ue.httpsEnabled?e("settings.httpsActive"):e("settings.httpsInactive"),!Ue.caAvailable&&` · ${e("settings.caMissing")}`]}),Ue.reason&&a.jsx("div",{className:"text-[color:var(--warning)]",children:Ue.reason}),Se&&a.jsx("div",{className:"text-destructive",children:Se})]})]}),a.jsx(EQ,{state:de,pending:ee,onCheck:()=>{Zt()},onConfirmRestart:()=>{fn()},desktopState:Ye?$:void 0,desktopPending:Xe,onCheckDesktop:()=>{Yr()},onInstallDesktop:()=>{Ur()}}),ce&&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(e8,{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:at?`App ${at.appVersion} · CLI ${at.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:()=>{ce.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(h8,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopSwitchService")]}),a.jsxs("button",{type:"button",onClick:()=>{Fe(null),ce.installCli().then(C=>{_e(C),Fe(e("settings.desktopCliUpdated"))}).catch(C=>Fe(C instanceof Error?C.message:String(C)))},className:"flex items-center gap-2 bg-surface-2 px-3 py-2.5 text-left text-[11px] text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:[a.jsx($o,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopInstallCli")]}),a.jsxs("button",{type:"button",onClick:()=>{Fe(null),ce.revealDataDirectory().catch(C=>Fe(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(N0,{size:13,className:"shrink-0 text-primary"}),e("settings.desktopOpenDataDirectory")]})]}),K&&a.jsx("div",{className:"border-t border-border/10 px-3 py-2 text-[10px] text-muted-foreground",children:K})]}),a.jsxs("div",{className:"mt-3 flex gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>{Di(null),Co({mode:"shell"}),rs()},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${tc?"flex-[2.7] bg-primary px-3 py-2.5 text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 hover:bg-primary/90":"flex-[0.78] bg-surface-2 px-2 py-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground"}`,title:e(co==="shell"?"sidebar.confirmNewShell":"settings.shell"),children:[a.jsx(Ri,{size:14,className:tc?"shrink-0":"hidden"}),a.jsx($o,{size:12}),a.jsx("span",{className:tc?"whitespace-nowrap":"hidden",children:e(co==="shell"?"sidebar.confirmNewShell":"settings.shell")})]}),a.jsxs("button",{type:"button",disabled:!Pr.available,onClick:()=>{Pr.available&&(Di(null),Co({mode:"tmux"}),rs())},className:`flex min-w-0 items-center justify-center gap-1.5 rounded-xl text-[13px] font-semibold transition active:scale-[0.98] ${Pr.available?rc?"flex-[2.7] bg-primary px-3 py-2.5 text-primary-foreground ring-1 ring-primary/40 shadow-md shadow-primary/25 hover:bg-primary/90":"flex-[0.78] bg-surface-2 px-2 py-2 text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"flex-1 bg-surface-2/50 text-muted-foreground/50 cursor-not-allowed"}`,title:Pr.available?e(co==="tmux"?"sidebar.confirmNewTmux":"settings.tmux"):Pr.reason||e("settings.installTmuxHint"),children:[a.jsx(Ri,{size:14,className:rc?"shrink-0":"hidden"}),a.jsx(F0,{size:12}),a.jsx("span",{className:rc?"whitespace-nowrap":"hidden",children:e(co==="tmux"?"sidebar.confirmNewTmux":"settings.tmux")})]})]}),(Pr.available||$r.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 ${Pr.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:Pr.available?e("settings.sessions",{n:$r.length}):e("settings.tmuxUnavailable")})]}),a.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),Qa()},disabled:Dn,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(As,{size:12,className:Dn?"animate-spin":""})})]}),a.jsx("div",{className:"px-2 pb-2",children:Pr.available?$r.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:[nc.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(Jl,{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(Q=>{const J=Q.boundFrontendSessionId??null,He=!!(Q.connected||J),mt=J?xe.find(Rs=>Rs.id===J)??null:null,jt=Q.friendlyName?.trim()||null,mr=Q.label&&Q.label!==Q.name?Q.label:null,tn=jt||mr||Q.name,Tn=jt||mr?`tmux:${Q.name}`:null,xn=Q.clientCount&&Q.clientCount>0?t==="zh"?`网页连接 ${Q.clientCount}`:`Web clients ${Q.clientCount}`:null,_i=Q.attached>0?t==="zh"?`原生 tmux ${Q.attached}`:`Native tmux ${Q.attached}`:null,rn=[Tn,He?Q.restorable?e("settings.restorable"):e("settings.attached"):null,xn,_i].filter(Rs=>!!Rs),Li=[e("settings.windows",{n:Q.windows}),Q.createdAt?new Date(Q.createdAt).toLocaleDateString():null].filter(Rs=>!!Rs),Ms=Ti===Q.name,$s=Yn===Q.name,pi=Kn===Q.name;return a.jsxs("div",{className:`flex items-start gap-2 rounded-lg px-2.5 py-2 ${Ms?"bg-destructive/10 ring-1 ring-destructive/40":"bg-surface"}`,children:[a.jsx(F0,{size:13,className:He?"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:tn}),Q.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"})]}),rn.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:rn.map(Rs=>a.jsx("span",{className:"max-w-full truncate",children:Rs},Rs))}),(Q.program||Q.cwd)&&a.jsxs("div",{className:"grid min-w-0 gap-0.5 text-[10px] text-muted-foreground",children:[Q.program&&a.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[a.jsx(W8,{size:10,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"truncate text-foreground/75",children:Q.program})]}),Q.cwd&&a.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[a.jsx(Jl,{size:10,className:"shrink-0 text-muted-foreground/70"}),a.jsx("span",{className:"truncate",children:Q.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:Li.map(Rs=>a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(S8,{size:10,className:"shrink-0 text-muted-foreground/60"}),Rs]},Rs))})]}),Ms?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",disabled:$s,onClick:()=>{Bi(Q.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:$s?"…":e("settings.destroy")}),a.jsx("button",{type:"button",disabled:$s,onClick:()=>{kr(null),sn(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:()=>{mt?Si(mt.id):(hs(Q.name),Co({mode:"tmux",tmuxSessionName:Q.name}))},disabled:pi,className:`shrink-0 inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium transition disabled:opacity-50 ${He?"bg-surface text-foreground hover:bg-surface-elevated":pi?"bg-primary/10 text-primary":"bg-primary/15 text-primary hover:bg-primary/25"}`,children:pi?a.jsxs(a.Fragment,{children:[a.jsx(Sn,{size:10,className:"animate-spin"}),e("settings.attaching")]}):e(He?"settings.attached":"settings.attach")}),a.jsx("button",{type:"button",disabled:$s,onClick:()=>{sn(null),kr(Q.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 ${Q.name}`,children:a.jsx(qi,{size:12})})]})]},Q.name)})]},C.key||"__ungrouped_tmux__")),Kr&&a.jsx("p",{className:"px-2 text-[11px] text-destructive",children:Kr})]}):a.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:Pr.reason||e("settings.installTmuxHint")})})]}),a.jsxs("button",{type:"button",onClick:()=>wn(!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(q8,{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:pt.length})}),a.jsx("span",{children:"›"})]})]}),a.jsxs("button",{type:"button",onClick:()=>Ks(!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(Yd,{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 Q=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 ${Q?"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 M7()}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(D9,{size:14}),e("settings.signOut")]})]})]})})]}),nl&&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:()=>{Jn(null),Vs(null),sn(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 ${Cs&&At?"":"inset-x-3 bottom-6 mx-auto max-w-sm sm:bottom-auto sm:top-[15%]"}`,style:Cs&&At?{..._5(Cs),paddingBottom:i}:{paddingBottom:i},children:[a.jsxs("div",{className:"border-b border-border/15 px-4 py-3",children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.closeChooserTitle")}),a.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:mh}),a.jsx("div",{className:"mt-0.5 text-[11px] text-muted-foreground/80",children:e("tab.closeChooserDescription")})]}),a.jsxs("div",{className:"flex flex-col py-1",children:[a.jsxs("button",{type:"button",onClick:()=>{rl({sessionId:nl.id,source:"sidebar",closeMode:"destroy"}),Jn(null),Vs(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(qi,{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")})]})]}),Kr&&a.jsx("p",{className:"px-4 py-2 text-[11px] text-destructive",children:Kr})]}),a.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:a.jsx("button",{type:"button",onClick:()=>{Jn(null),Vs(null),sn(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")})})]})]}),P&&(()=>{const C=xe.find(xn=>xn.id===P);if(!C)return null;const Q=ar.get(C.id),{primary:J}=Ca(C,Q?.activeProgram??null,Q?.cwd??null,io),He=At,mt=He?_5(Ne):{paddingBottom:i},jt=He?"fixed z-menu-panel overflow-y-auto overflow-x-hidden rounded-lg bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in":"fixed inset-x-3 bottom-6 z-menu-panel mx-auto max-w-sm rounded-2xl bg-surface-elevated border border-border/15 shadow-[0_18px_48px_var(--app-shadow-soft)] animate-fade-in sm:bottom-auto sm:top-[15%]",mr=He?"border-b border-border/15 px-3 py-2":"border-b border-border/15 px-4 py-3",tn=He?"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",Tn=He?"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 ${He?"bg-transparent":"bg-[var(--app-backdrop-soft)] backdrop-blur-sm"}`,onClick:le,"aria-label":"Close menu"}),a.jsxs("div",{className:jt,style:mt,children:[a.jsxs("div",{className:mr,children:[a.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-muted-foreground",children:e("tab.session")}),a.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:J}),Q?.cwd&&a.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/80",children:Q.cwd})]}),a.jsxs("div",{className:"flex flex-col py-1",children:[a.jsxs("button",{type:"button",onClick:()=>{const xn=Ne;le(),wt(xn),mn(C.id)},className:`${tn} text-foreground hover:bg-surface-2`,children:[a.jsx("span",{className:`${Tn} bg-primary/15 text-primary`,children:a.jsx(u9,{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:!Q?.cwd,onClick:()=>{o0(C.id),le()},className:`${tn} ${Q?.cwd?"text-foreground hover:bg-surface-2":"text-muted-foreground/50 cursor-not-allowed"}`,children:[a.jsx("span",{className:`${Tn} bg-surface-2 text-muted-foreground`,children:a.jsx(Y8,{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")})]}),Je&&Je===Q?.cwd&&a.jsx("span",{className:"ml-auto text-[11px] text-primary",children:e("tab.copied")})]}),(()=>{const xn=Pf(C.id),_i=xn??yt;return a.jsxs("div",{className:`${tn} text-foreground`,children:[a.jsx("span",{className:`${Tn} bg-surface-2 text-muted-foreground`,children:a.jsx(E9,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block font-medium",children:e("tab.fontSize")}),a.jsx("span",{className:"block text-[11px] text-muted-foreground",children:e("tab.fontSizeHint")})]}),a.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[a.jsx("button",{type:"button",onClick:()=>{dd(C.id,_i-1),Re(rn=>rn+1)},className:"h-7 w-7 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95","aria-label":`${e("tab.fontSize")} -1`,children:"−"}),a.jsxs("span",{className:"w-8 text-center text-[11px] tabular-nums text-muted-foreground",children:[_i,"px"]}),a.jsx("button",{type:"button",onClick:()=>{dd(C.id,_i+1),Re(rn=>rn+1)},className:"h-7 w-7 shrink-0 rounded-md bg-surface text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95","aria-label":`${e("tab.fontSize")} +1`,children:"+"}),xn!==null&&a.jsx("button",{type:"button",onClick:()=>{dd(C.id,null),Re(rn=>rn+1)},className:"ml-1 shrink-0 rounded-md px-1.5 py-1 text-[11px] text-primary transition hover:bg-primary/10",children:e("tab.fontSizeReset")})]})]})})(),Q?.agentNativeSessionId&&Q.agentStatus!=="working"&&Q.agentStatus!=="waiting"&&Q.terminalSessionId&&a.jsxs("button",{type:"button",onClick:()=>{const xn=Q.terminalSessionId;xn&&(le(),os(C.id,xn))},className:`${tn} text-foreground hover:bg-surface-2`,children:[a.jsx("span",{className:`${Tn} bg-[rgb(var(--success-rgb)_/_0.14)] text-[color:var(--success)]`,children:a.jsx(Hl,{size:14})}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"block font-medium",children:[e("tab.resumeAgent"),Q.agent?.displayName?` · ${Q.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:()=>{le(),Ll(C.id)},className:`${tn} text-destructive hover:bg-destructive/10`,children:[a.jsx("span",{className:`${Tn} bg-destructive/15 text-destructive`,children:a.jsx(qi,{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:()=>{le(),rl({sessionId:C.id,source:"tab-menu",closeMode:"auto"})},className:`${tn} text-destructive hover:bg-destructive/10`,children:[a.jsx("span",{className:`${Tn} bg-destructive/15 text-destructive`,children:a.jsx(ws,{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")})]})]}),!He&&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:()=>{le()},children:e("tab.longPressTip")})]}),!He&&a.jsx("div",{className:"border-t border-border/15 px-3 py-2",children:a.jsx("button",{type:"button",onClick:le,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")})})]})]})})(),Or&&dt&&At&&(()=>{const C=xe.find(rn=>rn.id===Or);if(!C)return null;const Q=ar.get(C.id),{primary:J}=Ca(C,Q?.activeProgram??null,Q?.cwd??null,io,Q?.shellTitle??null,Q?.promptState??null),He=C.customName?C.name:J,mt=rn=>{const Li=rn.trim();Li?Li!==He&&gn(C.id,Li):ps(C.id),mn(null),wt(null)},jt=300,mr=160,tn=dt.x,Tn=dt.y,xn=Math.min(Math.max(tn-jt/2,12),window.innerWidth-jt-12),_i=Tn+mr+20>window.innerHeight?Math.max(Tn-mr-12,12):Tn+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:()=>{mn(null),wt(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:`${xn}px`,top:`${_i}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:J}),Q?.cwd&&a.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground/70",children:Q.cwd})]}),a.jsxs("form",{className:"px-3 py-2.5",onSubmit:rn=>{rn.preventDefault();const Li=new FormData(rn.currentTarget).get("session-name");mt(typeof Li=="string"?Li:"")},children:[a.jsx("input",{ref:rn=>{yn.current=rn,rn&&!Fr.current&&(Fr.current=!0,rn.focus({preventScroll:!0}),rn.select())},type:"text",name:"session-name",defaultValue:He,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:rn=>{rn.key==="Escape"&&(rn.stopPropagation(),mn(null),wt(null))}}),a.jsxs("div",{className:"mt-2.5 flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{mn(null),wt(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")})]})]})]})]})})(),Or&&!At&&(()=>{const C=xe.find(jt=>jt.id===Or);if(!C)return null;const Q=ar.get(C.id),{primary:J}=Ca(C,Q?.activeProgram??null,Q?.cwd??null,io,Q?.shellTitle??null,Q?.promptState??null),He=C.customName?C.name:J,mt=jt=>{const mr=jt.trim();mr?mr!==He&&gn(C.id,mr):ps(C.id),mn(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:()=>mn(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:jt=>{jt.preventDefault();const mr=new FormData(jt.currentTarget).get("session-name");mt(typeof mr=="string"?mr:"")},children:[a.jsx("input",{ref:jt=>{yn.current=jt,jt&&!Fr.current&&(Fr.current=!0,jt.focus({preventScroll:!0}),jt.select())},type:"text",name:"session-name",defaultValue:He,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:jt=>{jt.key==="Escape"&&(jt.stopPropagation(),mn(null))}}),a.jsxs("div",{className:"mt-3 flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>mn(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")})]})]})]})]})})(),re&&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:()=>Pe(!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:()=>Pe(!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(ws,{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:q==="denied"?e("settings.notificationsDenied"):ju()?e("settings.notificationsMasterHint"):e("settings.notificationsUnsupported")}),ju()&&!R7()&&a.jsx("div",{className:"mt-1.5 text-[11px] leading-relaxed text-[var(--warning)]",children:e("settings.notificationsIOSInstallHint")})]}),a.jsx("button",{type:"button",onClick:()=>{j()},disabled:!ju()||q==="denied",className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":I,children:a.jsx($a,{checked:I,disabled:!ju()||q==="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 ${q==="granted"?"bg-primary/15 text-primary":"bg-surface text-muted-foreground"}`,children:[e("settings.notificationsPermission"),": ",na()?e("settings.notificationsPermissionSystem"):q]}),a.jsx("button",{type:"button",disabled:!I||q!=="granted"||rt==="checking",onClick:()=>{W()},className:"rounded-full bg-surface px-3 py-1.5 font-medium text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:e(rt==="checking"?"settings.notificationsTestChecking":"settings.notificationsTest")}),na()?.openNotificationSettings&&a.jsx("button",{type:"button",onClick:()=>{na()?.openNotificationSettings?.()},className:"rounded-full bg-surface px-3 py-1.5 font-medium text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground",children:e("settings.notificationsOpenSystemSettings")})]}),rt!=="idle"&&rt!=="checking"&&a.jsx("div",{className:`mt-2 text-[11px] leading-relaxed ${rt==="delivered"?"text-primary":"text-[var(--warning)]"}`,children:e(rt==="delivered"?"settings.notificationsTestDelivered":"settings.notificationsTestFailed")})]}),a.jsxs("div",{className:"mt-4 rounded-2xl bg-surface-2 p-3",children:[a.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:e("settings.notificationsAlertStyle")}),a.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e("settings.notificationsAlertStyleHint")}),a.jsx("div",{className:"mt-3 grid grid-cols-3 gap-1 rounded-xl bg-surface p-1",children:[["normal",e("settings.notificationsStyleNormal"),e("settings.notificationsStyleNormalHint")],["quiet",e("settings.notificationsStyleQuiet"),e("settings.notificationsStyleQuietHint")],["persistent",e("settings.notificationsStylePersistent"),e("settings.notificationsStylePersistentHint")]].map(([C,Q,J])=>{const He=G===C;return a.jsxs("button",{type:"button",disabled:!I,onClick:()=>st(C),className:`min-w-0 rounded-lg px-2 py-2 text-left transition ${He&&I?"bg-primary/15 text-primary":I?"text-muted-foreground hover:bg-surface-elevated hover:text-foreground":"cursor-not-allowed text-muted-foreground/40"}`,title:J,children:[a.jsx("span",{className:"block truncate text-[11px] font-semibold",children:Q}),a.jsx("span",{className:"mt-0.5 block truncate text-[9px] opacity-80",children:J})]},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:!I,onClick:()=>Oe(!M),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":M&&I,children:a.jsx($a,{checked:M&&I,disabled:!I})})]}),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:!I,onClick:()=>Ie(!F),className:"shrink-0 transition disabled:cursor-not-allowed","aria-pressed":F&&I,children:a.jsx($a,{checked:F&&I,disabled:!I})})]})]}),a.jsx("p",{className:"mt-2 text-[10px] text-muted-foreground",children:e("settings.notificationsFutureHint")})]})]})]})]}),fi&&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:()=>wn(!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:()=>wn(!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(ws,{size:18})})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:a.jsx(LQ,{presets:pt,selectedPresetId:wr,onSelectPreset:Bn,onUpdatePreset:(C,Q)=>{yr(J=>M0(J.map(He=>He.id===C?Q(He):He)))},onAddPreset:()=>{const C=`preset-${Date.now()}`;yr(Q=>M0([...Q,{id:C,label:`Preset ${Q.length}`,programs:[],includeAlt:!1,rowLayout:[3,3],actions:[],showOnDesktop:!1}])),Bn(C)},onRemovePreset:C=>{yr(Q=>M0(Q.filter(J=>J.id!==C)))},onResetDefaults:()=>{yr(nu()),Bn("default")}})})]})]}),Ss&&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:()=>Ks(!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:()=>Ks(!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(ws,{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(IQ,{}),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:xe.map(C=>{const Q=ar.get(C.id),J=Q?.activeProgramRaw??null,He=Q?.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:"})," ",He||"—"]}),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:"})," ",J||"—"]})]},`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:Q,hint:J})=>a.jsxs("div",{children:[a.jsx("div",{className:"mb-0.5 text-[11px] font-medium text-foreground",children:Q}),a.jsx("div",{className:"text-[10px] text-muted-foreground",children:J}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[Zo[C].map(He=>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:[He,a.jsx("button",{type:"button",onClick:()=>{const mt={...Zo,[C]:Zo[C].filter(jt=>jt!==He)};Da(mt),C==="shellNames"&&(io=new Set(mt.shellNames)),nm(mt).catch(()=>{})},className:"ml-0.5 text-muted-foreground hover:text-destructive",children:"×"})]},He)),a.jsx("input",{placeholder:e("settings.addTag"),className:"w-16 rounded bg-surface px-1.5 py-0.5 text-[11px] font-mono",onKeyDown:He=>{if(He.key!=="Enter")return;const mt=He.target.value.trim().toLowerCase();if(!mt||Zo[C].includes(mt))return;const jt={...Zo,[C]:[...Zo[C],mt]};Da(jt),C==="shellNames"&&(io=new Set(jt.shellNames)),He.target.value="",nm(jt).catch(()=>{})}})]})]},C)),a.jsx("button",{type:"button",onClick:()=>{N7().then(C=>{Da(C),io=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")}),Qi.map((C,Q)=>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:J=>{const He=Qi.map((mt,jt)=>jt===Q?{...mt,enabled:J.target.checked}:mt);Xs(He),Vn(so,He),un(!0),m0(He).then(mt=>{Xs(mt),Vn(so,mt)}).catch(()=>{}).finally(()=>un(!1))}}),a.jsxs("select",{value:C.matchType,onChange:J=>{const He=Qi.map((mt,jt)=>jt===Q?{...mt,matchType:J.target.value}:mt);Xs(He),Vn(so,He),un(!0),m0(He).then(mt=>{Xs(mt),Vn(so,mt)}).catch(()=>{}).finally(()=>un(!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:J=>{const He=Qi.map((mt,jt)=>jt===Q?{...mt,pattern:J.target.value}:mt);Xs(He),Vn(so,He)},onBlur:()=>{un(!0),m0(Qi).then(J=>{Xs(J),Vn(so,J)}).catch(()=>{}).finally(()=>un(!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:J=>{const He=Qi.map((mt,jt)=>jt===Q?{...mt,output:J.target.value}:mt);Xs(He),Vn(so,He)},onBlur:()=>{un(!0),m0(Qi).then(J=>{Xs(J),Vn(so,J)}).catch(()=>{}).finally(()=>un(!1))},placeholder:"output",className:"w-28 rounded bg-surface px-2 py-1 text-[11px]"}),a.jsx("button",{type:"button",onClick:()=>{const J=Qi.filter((He,mt)=>mt!==Q);Xs(J),Vn(so,J),un(!0),m0(J).then(He=>{Xs(He),Vn(so,He)}).catch(()=>{}).finally(()=>un(!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=[...Qi,{id:`rule-${Date.now()}`,enabled:!0,priority:100,matchType:"includes",pattern:"",output:""}];Xs(C),Vn(so,C),un(!0),m0(C).then(Q=>{Xs(Q),Vn(so,Q)}).catch(()=>{}).finally(()=>un(!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:()=>{un(!0),D7().then(C=>{Xs(C),Vn(so,C)}).catch(()=>{}).finally(()=>un(!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:Na?e("settings.saving"):s0?`${Qi.length} rules`:"…"})]})]})]})]})]})]}),Us&&a.jsx(wQ,{isOpen:Us,onClose:()=>Ja(!1)}),!uo&&a.jsx(b5,{isOpen:Nr,drawerWidthPx:Cr,onClose:()=>Mn("left-sidebar"),onOpen:Fs,sessions:xe,activeSessionId:xt,sessionStates:ar,onNewSession:C=>Co(C),recoverableTmuxSessions:sc,recoverableTmuxSessionsLoading:Dn,onRefreshRecoverableTmuxSessions:()=>{Qa()},onCloseSession:Ll,onSplitSession:vu,onCloseSplit:C=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:C})),onRemoveFromSplit:C=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:C})),splitWorkspaces:xr,onSetSplitLayout:ec,onReorderSplitWorkspace:wu,onRenameSplitWorkspace:Au,onCombineSplitSessions:Tu,onReorderSessions:hi,onSessionMenu:el,onOpenSettings:ua,onJumpToNextAttention:_s.length>0?Ji:void 0,onOpenQuota:()=>Ja(!0),updateState:de,updateActionPending:ee,onConfirmUpdateRestart:fn,onRetryUpdate:Zt,tmuxAvailable:Pr.available,defaultSessionMode:Gn,runningSessionButtonEnabled:ht,onRunningSessionButtonEnabledChange:Ir,onTogglePinned:At?oa:void 0}),!sl&&a.jsx(y5,{isOpen:Zn,drawerWidthPx:es,onClose:()=>Mn("right-sidebar"),onOpen:Ho,rightSidebarFilePreviewOpen:En,rightSidebarFilePreviewCloseSignal:we,onOpenRightSidebarFilePreview:Ia,onCloseRightSidebarFilePreview:Ki,rightSidebarRepoPickerOpen:Qe,rightSidebarRepoPickerCloseSignal:ft,onOpenRightSidebarRepoPicker:ca,onCloseRightSidebarRepoPicker:Wo,markdownOutlineOpen:Kt,markdownOutlineCloseSignal:Qt,onOpenMarkdownOutline:oo,onCloseMarkdownOutline:Ea,markdownImageLightboxOpen:bt,markdownImageLightboxCloseSignal:St,onOpenMarkdownImageLightbox:Ma,onCloseMarkdownImageLightbox:Ra,onTogglePinned:At?wo:void 0}),fe&&!c&&a.jsx("button",{type:"button",onClick:Ci,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"})]})}),_r&&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 ${_r.tone==="success"?"border-[rgb(var(--success-rgb)_/_0.24)] bg-surface-elevated text-foreground":"border-destructive/30 bg-surface-elevated text-destructive"}`,role:_r.tone==="error"?"alert":"status",children:[_r.tone==="success"?a.jsx(Hl,{size:14,className:"shrink-0 text-[color:var(--success)]"}):a.jsx(Sd,{size:14,className:"shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1",children:_r.message}),a.jsx("button",{type:"button",onClick:()=>is(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(ws,{size:12})})]}),u&&a.jsxs(a.Fragment,{children:[!At&&a.jsx(W9,{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(Me,null,2)})]})]})]}),Il=Xr?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 At?a.jsxs("div",{className:"w-screen h-full flex flex-row",children:[uo&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{width:kn,flexShrink:0,height:"100%"},children:a.jsx(b5,{isOpen:Nr,drawerWidthPx:kn,onClose:Za,onOpen:Fs,sessions:xe,activeSessionId:xt,sessionStates:ar,onNewSession:C=>Co(C),recoverableTmuxSessions:sc,recoverableTmuxSessionsLoading:Dn,onRefreshRecoverableTmuxSessions:()=>{Qa()},onCloseSession:Ll,onSplitSession:vu,onCloseSplit:C=>window.dispatchEvent(new CustomEvent("close-terminal-split",{detail:C})),onRemoveFromSplit:C=>window.dispatchEvent(new CustomEvent("remove-terminal-split-pane",{detail:C})),splitWorkspaces:xr,onSetSplitLayout:ec,onReorderSplitWorkspace:wu,onRenameSplitWorkspace:Au,onCombineSplitSessions:Tu,onReorderSessions:hi,onSessionMenu:el,onOpenSettings:ua,onJumpToNextAttention:_s.length>0?Ji:void 0,onOpenQuota:()=>Ja(!0),updateState:de,updateActionPending:ee,onConfirmUpdateRestart:fn,onRetryUpdate:Zt,tmuxAvailable:Pr.available,defaultSessionMode:Gn,runningSessionButtonEnabled:ht,onRunningSessionButtonEnabledChange:Ir,pinned:!0,onTogglePinned:oa})}),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:Yi})]}),a.jsxs("div",{className:"relative flex-1 min-w-0 h-full overflow-hidden",children:[ic,sl&&a.jsxs("div",{className:"absolute inset-y-0 right-0 z-20 flex",style:{width:u0},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:c0,flexShrink:0,height:"100%"},children:a.jsx(y5,{isOpen:!0,drawerWidthPx:c0,onClose:aa,onOpen:Ho,pinned:!0,onTogglePinned:wo,rightSidebarFilePreviewOpen:En,rightSidebarFilePreviewCloseSignal:we,onOpenRightSidebarFilePreview:Ia,onCloseRightSidebarFilePreview:Ki,rightSidebarRepoPickerOpen:Qe,rightSidebarRepoPickerCloseSignal:ft,onOpenRightSidebarRepoPicker:ca,onCloseRightSidebarRepoPicker:Wo,markdownOutlineOpen:Kt,markdownOutlineCloseSignal:Qt,onOpenMarkdownOutline:oo,onCloseMarkdownOutline:Ea,markdownImageLightboxOpen:bt,markdownImageLightboxCloseSignal:St,onOpenMarkdownImageLightbox:Ma,onCloseMarkdownImageLightbox:Ra})})]})]}),Il]}):a.jsxs(a.Fragment,{children:[ic,Il]})}const FB=Object.freeze(Object.defineProperty({__proto__:null,default:KQ},Symbol.toStringTag,{value:"Module"}));export{FB as A,fQ as C,Kc as D,$D as F,pQ as G,Y8 as L,t9 as M,l9 as P,As as R,eu as S,lS as T,s8 as a,r8 as b,W5 as c,Yc as d,E8 as e,Ep as f,u9 as g,h9 as h,Xc as i,Jc as j,om as k,Z5 as l,T6 as m,T9 as n,L9 as o,qi as p,Vx as q,jB as r,Dg as s,B_ as t,Q_ as u,PB as v,OB as w,ow as x};