lookatstudy-mobile 0.35.1 → 0.37.0

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 (147) hide show
  1. package/package.json +1 -1
  2. package/server.cjs +2692 -2023
  3. package/web/assets/{CanvasStage-F04y4zgY.js → CanvasStage-DNJ3CvSQ.js} +1 -1
  4. package/web/assets/{CommandPalette-8EbP9nD8.js → CommandPalette-0omhbLg3.js} +1 -1
  5. package/web/assets/{CompanionBotLab-CpDmbEBy.js → CompanionBotLab-CT_JHmNI.js} +1 -1
  6. package/web/assets/{CourseSearchPanel-DBMdIlcw.js → CourseSearchPanel-DVtN9ACi.js} +1 -1
  7. package/web/assets/{ExamView-D9Cgt1bf.js → ExamView-DPMDpplK.js} +2 -2
  8. package/web/assets/MermaidArtifact-BaJ5RvRv.js +9 -0
  9. package/web/assets/PersonalProfileModal-IhrruXfg.js +16 -0
  10. package/web/assets/{ReviewPanel-DH3dhVt3.js → ReviewPanel-C1ldctfO.js} +1 -1
  11. package/web/assets/{SettingsView-DOhBgfmD.js → SettingsView-B6w445fE.js} +6 -6
  12. package/web/assets/{VoicePanel-CAud4bsL.js → VoicePanel-CcYGhBPb.js} +1 -1
  13. package/web/assets/{abnfDiagram-VCTEODGH-CpzdURfK.js → abnfDiagram-VCTEODGH-BU9D6UxH.js} +1 -1
  14. package/web/assets/{abnfDiagram-VCTEODGH-ODA7YWAP-BwflFQl0.js → abnfDiagram-VCTEODGH-ODA7YWAP-CbNOQFqA.js} +1 -1
  15. package/web/assets/{api-web-Dwfo27My.js → api-web-ChIPnpHO.js} +1 -1
  16. package/web/assets/{architectureDiagram-5GKGNRK7-C4PU3XN7-D2fQalh8.js → architectureDiagram-5GKGNRK7-C4PU3XN7-T9qCk6kM.js} +1 -1
  17. package/web/assets/{architectureDiagram-5GKGNRK7-D9E1rxxz.js → architectureDiagram-5GKGNRK7-CKMhI1Ee.js} +1 -1
  18. package/web/assets/{blockDiagram-I7D4REHJ-r15Lh1bi.js → blockDiagram-I7D4REHJ-Bik9DaYN.js} +1 -1
  19. package/web/assets/{blockDiagram-NRAW4CY4-UMJ6PMQQ-Q16ExT0e.js → blockDiagram-NRAW4CY4-UMJ6PMQQ-Dy4ybhQI.js} +1 -1
  20. package/web/assets/{c4Diagram-7LVT6UL2-ODlC-C-l.js → c4Diagram-7LVT6UL2-IRtYuDM_.js} +1 -1
  21. package/web/assets/{c4Diagram-UCG6FXSJ-75X3U2P3-j7xMbgDN.js → c4Diagram-UCG6FXSJ-75X3U2P3-BCGvMp1I.js} +1 -1
  22. package/web/assets/channel-D6qbQnDp.js +1 -0
  23. package/web/assets/{chunk-2Q5K7J3B-DIKZDPWd.js → chunk-2Q5K7J3B-DSi_blpC.js} +1 -1
  24. package/web/assets/{chunk-5VM5RSS4-D_d1aMiX.js → chunk-5VM5RSS4-JiyA-wo9.js} +1 -1
  25. package/web/assets/{chunk-7XDTSPCN-CDCDiD3k.js → chunk-7XDTSPCN-Cvb-oYet.js} +1 -1
  26. package/web/assets/{chunk-CTNIYPP6-BHWWkYo7.js → chunk-CTNIYPP6-HjnzrVvf.js} +1 -1
  27. package/web/assets/{chunk-CXNFBKHE-Ddv1ywyJ.js → chunk-CXNFBKHE-DzkNdxBi.js} +1 -1
  28. package/web/assets/{chunk-F27PBJKO-Csh41uLz.js → chunk-F27PBJKO-DqqFugb1.js} +1 -1
  29. package/web/assets/{chunk-IMKFNOWR-CPE5ucO6.js → chunk-IMKFNOWR-0q0swfWT.js} +1 -1
  30. package/web/assets/{chunk-ISA7TJRJ-7TzBMXNZ.js → chunk-ISA7TJRJ-BX1hKFZw.js} +1 -1
  31. package/web/assets/{chunk-JWPE2WC7-ZaRjjvWe.js → chunk-JWPE2WC7-BGDdCd7e.js} +1 -1
  32. package/web/assets/{chunk-LV3HUYFY-CehBNNki.js → chunk-LV3HUYFY-DXfPtXuN.js} +1 -1
  33. package/web/assets/{chunk-M3IUQBOH-BFEOlC3u.js → chunk-M3IUQBOH-BGP9XzSA.js} +1 -1
  34. package/web/assets/{chunk-NDIOYS4C-EGU3EjM6.js → chunk-NDIOYS4C-CzRGOiBm.js} +1 -1
  35. package/web/assets/{chunk-POPQ4Y6H-6tlv39Ki.js → chunk-POPQ4Y6H-CJEN76eb.js} +1 -1
  36. package/web/assets/{chunk-RE4WF27V-Bi2fqKq7.js → chunk-RE4WF27V-CwpP9UVY.js} +1 -1
  37. package/web/assets/{chunk-SVP7TREG-B-ulnIuy.js → chunk-SVP7TREG-DKVY1S0P.js} +1 -1
  38. package/web/assets/{chunk-TICWLB2K-BjrX7t7Y.js → chunk-TICWLB2K-DnGZt5_T.js} +1 -1
  39. package/web/assets/{chunk-VII2H2IX-BMAB3iRM.js → chunk-VII2H2IX-DXWnTQhH.js} +1 -1
  40. package/web/assets/{chunk-X5GNSKZ3-B7QFlx10.js → chunk-X5GNSKZ3-EYUWZKOs.js} +1 -1
  41. package/web/assets/{chunk-XCWWM2C3-BjgcNQCf.js → chunk-XCWWM2C3-DX7b36ww.js} +1 -1
  42. package/web/assets/{chunk-XXDRQBXY-CKGs-9PK.js → chunk-XXDRQBXY-B_w3KgBK.js} +1 -1
  43. package/web/assets/classDiagram-DTDB5LWJ-LWRDKZ5K-D2p8cYeb.js +1 -0
  44. package/web/assets/classDiagram-ZZMXUADV-CFJO056W.js +1 -0
  45. package/web/assets/classDiagram-v2-JRS7N3AN-2BZHGRP2-D2p8cYeb.js +1 -0
  46. package/web/assets/classDiagram-v2-VYDZK3BY-CFJO056W.js +1 -0
  47. package/web/assets/{core-BTS07XeK.js → core-BKUioWC8.js} +4 -4
  48. package/web/assets/{cose-bilkent-JH36ORCC-Dz8-msXI.js → cose-bilkent-JH36ORCC-BQ05JG_e.js} +1 -1
  49. package/web/assets/{cose-bilkent-JH36ORCC-OB24KH3T-AHcUGpPr.js → cose-bilkent-JH36ORCC-OB24KH3T-7k2xivYC.js} +1 -1
  50. package/web/assets/{cynefin-OW5HDTMX-CncUj8R6.js → cynefin-OW5HDTMX-DOvceb57.js} +1 -1
  51. package/web/assets/{cynefin-OW5HDTMX-GVF3BKWE-DnbZYXxG.js → cynefin-OW5HDTMX-GVF3BKWE-CyNo44Ct.js} +1 -1
  52. package/web/assets/{cynefinDiagram-5FMLGOSQ-H9_ClqMv.js → cynefinDiagram-5FMLGOSQ-CLzU5hRI.js} +1 -1
  53. package/web/assets/{cynefinDiagram-5FMLGOSQ-H3WIRU3N-C0dZpAGS.js → cynefinDiagram-5FMLGOSQ-H3WIRU3N-CLiDmyFZ.js} +1 -1
  54. package/web/assets/{dagre-3AP2YEHR-DCERTXHT-Dqjpb4H_.js → dagre-3AP2YEHR-DCERTXHT-AZC3Sd7-.js} +1 -1
  55. package/web/assets/{dagre-GXQ25YYZ-Bs6lG_oB.js → dagre-GXQ25YYZ-XMzOJ88I.js} +1 -1
  56. package/web/assets/{diagram-S7CK7UJ4-CoyM63cz.js → diagram-S7CK7UJ4-BrCtmOAD.js} +1 -1
  57. package/web/assets/{diagram-S7CK7UJ4-MULGZGEL-Bk_UbBLt.js → diagram-S7CK7UJ4-MULGZGEL-Cm4Xy-pF.js} +1 -1
  58. package/web/assets/{diagram-UQ7AKVKN-Cbd8LIJZ.js → diagram-UQ7AKVKN-CCcvTlE_.js} +1 -1
  59. package/web/assets/{diagram-UQ7AKVKN-YQBY353J-DvgMhn_1.js → diagram-UQ7AKVKN-YQBY353J-CVJLwP7S.js} +1 -1
  60. package/web/assets/{diagram-VSXAHHWV-BlOBRaa4.js → diagram-VSXAHHWV-CdYFta9M.js} +1 -1
  61. package/web/assets/{diagram-VSXAHHWV-WLNH2ELY-Bwvh2izi.js → diagram-VSXAHHWV-WLNH2ELY-CaWgm0pD.js} +1 -1
  62. package/web/assets/{diagram-VX7I27RA-XibYkEXv.js → diagram-VX7I27RA-CM05zRwP.js} +1 -1
  63. package/web/assets/{diagram-VX7I27RA-XW6YQV5G-DyII5dQK.js → diagram-VX7I27RA-XW6YQV5G-DKYJGziA.js} +1 -1
  64. package/web/assets/{diagram-Z3DM3KII-HG7RF65D-I0dD_VKh.js → diagram-Z3DM3KII-HG7RF65D-kC8Vko9Q.js} +1 -1
  65. package/web/assets/{diagram-Z3DM3KII-Bzm2uV2N.js → diagram-Z3DM3KII-He0OkO1p.js} +1 -1
  66. package/web/assets/{ebnfDiagram-PWID7BFC-BaCEN0aI.js → ebnfDiagram-PWID7BFC-D6LQclit.js} +1 -1
  67. package/web/assets/{ebnfDiagram-PWID7BFC-OKY4VHYD-DBp9ntV_.js → ebnfDiagram-PWID7BFC-OKY4VHYD-BPNXBqdL.js} +1 -1
  68. package/web/assets/{elk.bundled-CE2zCVQp.js → elk.bundled-Oi_dp_Nb.js} +1 -1
  69. package/web/assets/{erDiagram-RLTQ6QDP-wXu0CF1e.js → erDiagram-RLTQ6QDP-BC8Dyxni.js} +1 -1
  70. package/web/assets/{erDiagram-SSCWMZ5O-PIPKOIK7-DPE67Rb_.js → erDiagram-SSCWMZ5O-PIPKOIK7-BM5hP7pq.js} +1 -1
  71. package/web/assets/{flowDiagram-A5DVABFB-2Z4AVO5R-5PgQxZH6.js → flowDiagram-A5DVABFB-2Z4AVO5R-BI_HnDMS.js} +1 -1
  72. package/web/assets/{flowDiagram-HODETNUW-eBCjgWhq.js → flowDiagram-HODETNUW-CQB-KRdk.js} +1 -1
  73. package/web/assets/{ganttDiagram-EL5Y4UJY-CLQ0R2N9.js → ganttDiagram-EL5Y4UJY-DtkBZQfB.js} +1 -1
  74. package/web/assets/{ganttDiagram-EL5Y4UJY-JZNG7GOG-yvgn9AFs.js → ganttDiagram-EL5Y4UJY-JZNG7GOG-CAuwhLrG.js} +1 -1
  75. package/web/assets/{gitGraphDiagram-WWUBYQGX-Ch2LC_ZO.js → gitGraphDiagram-WWUBYQGX-CXMxBD1j.js} +1 -1
  76. package/web/assets/{gitGraphDiagram-WWUBYQGX-DMWMLL3G-CdL6sKXD.js → gitGraphDiagram-WWUBYQGX-DMWMLL3G-CibDMxH5.js} +1 -1
  77. package/web/assets/{index-Cfos9l4N.js → index-CLC7uJBc.js} +1 -1
  78. package/web/assets/{index-CGVNDEoZ.js → index-DKUjXJrj.js} +2 -2
  79. package/web/assets/index-DNBtAT86.css +1 -0
  80. package/web/assets/index-DwG4tw4S.js +53 -0
  81. package/web/assets/index-pqxwzTgM.js +14 -0
  82. package/web/assets/{infoDiagram-27XIBGKW-Dp9CZffC.js → infoDiagram-27XIBGKW-BxdeKm2M.js} +1 -1
  83. package/web/assets/{infoDiagram-RXCK75RN-HANS5KVC-CPk4LX77.js → infoDiagram-RXCK75RN-HANS5KVC-XymudzPp.js} +1 -1
  84. package/web/assets/{ishikawaDiagram-5VMMS53U-7GCIT7WU-CMGVPqEU.js → ishikawaDiagram-5VMMS53U-7GCIT7WU-Ca0czL-r.js} +1 -1
  85. package/web/assets/{ishikawaDiagram-5VMMS53U-B-cMM-lu.js → ishikawaDiagram-5VMMS53U-YiLbdVr3.js} +1 -1
  86. package/web/assets/{journeyDiagram-3NMN7TZE-jd0ulJL5.js → journeyDiagram-3NMN7TZE-o507o7V3.js} +1 -1
  87. package/web/assets/{journeyDiagram-EYS64GPL-OAPELBT7-laqYJZSh.js → journeyDiagram-EYS64GPL-OAPELBT7-COjG9fsS.js} +1 -1
  88. package/web/assets/{kanban-definition-3QL26DDD-I7RKWQQY-C2dlYmk5.js → kanban-definition-3QL26DDD-I7RKWQQY-dIeka5z7.js} +1 -1
  89. package/web/assets/{kanban-definition-UXKFOSKX-C8FUqo2W.js → kanban-definition-UXKFOSKX-DPIPqDMI.js} +1 -1
  90. package/web/assets/{katex-N6JRN4PM-DpkGK9xr.js → katex-N6JRN4PM-C1WPCW7o.js} +1 -1
  91. package/web/assets/{layout-DAl5hPqz.js → layout-CoYqjJku.js} +1 -1
  92. package/web/assets/main-s-bCU9xp.js +537 -0
  93. package/web/assets/{mermaid-layout-elk.core-DR1AiJQx.js → mermaid-layout-elk.core-BDxAYedV.js} +2 -2
  94. package/web/assets/{mermaid.core-DGhTWg7e.js → mermaid.core-DP9HBKfF.js} +5 -5
  95. package/web/assets/{mindmap-definition-FBJOCRG2-KIYZG64Y-CsijzG4P.js → mindmap-definition-FBJOCRG2-KIYZG64Y-B0M0vSNL.js} +1 -1
  96. package/web/assets/{mindmap-definition-YA3MSWOX-0_EzROUF.js → mindmap-definition-YA3MSWOX-CZNKLpKf.js} +1 -1
  97. package/web/assets/{pegDiagram-XKGWAZYB-D0foGNNg.js → pegDiagram-XKGWAZYB-BABqVbYU.js} +1 -1
  98. package/web/assets/{pegDiagram-XKGWAZYB-OIP57N6J-BGPwOePw.js → pegDiagram-XKGWAZYB-OIP57N6J-ChBhHDWi.js} +1 -1
  99. package/web/assets/{pet-C5Roq2vO.js → pet-BILzsmZE.js} +1 -1
  100. package/web/assets/{pieDiagram-E7YTZNPT-2UOTW327-KJ0psy-0.js → pieDiagram-E7YTZNPT-2UOTW327-Dh29Zr3p.js} +1 -1
  101. package/web/assets/{pieDiagram-E7YTZNPT-DIjeGG-W.js → pieDiagram-E7YTZNPT-van1IvDV.js} +1 -1
  102. package/web/assets/{quadrantDiagram-AXDQQJYC-DUdT9pwG.js → quadrantDiagram-AXDQQJYC-BKgVVqxX.js} +1 -1
  103. package/web/assets/{quadrantDiagram-AXDQQJYC-SN3ASJJK-B3eRvaAs.js → quadrantDiagram-AXDQQJYC-SN3ASJJK-CZYkjMJl.js} +1 -1
  104. package/web/assets/{railroadDiagram-O6MQD6OU-34742W6X-ckE1BJbz.js → railroadDiagram-O6MQD6OU-34742W6X-BpIuTMjt.js} +1 -1
  105. package/web/assets/{railroadDiagram-O6MQD6OU-CY8U1vkC.js → railroadDiagram-O6MQD6OU-CAJ_285V.js} +1 -1
  106. package/web/assets/{render-O7CIS3YK-C5csyvRU.js → render-O7CIS3YK-Ca_t2BjR.js} +7 -7
  107. package/web/assets/{requirementDiagram-BXWQKSXE-Bx_E3SzQ.js → requirementDiagram-BXWQKSXE-yAxTDLdz.js} +1 -1
  108. package/web/assets/{requirementDiagram-EFPCY7ZU-NGAFFSMB-DEU_DtAn.js → requirementDiagram-EFPCY7ZU-NGAFFSMB-qHev6ewP.js} +1 -1
  109. package/web/assets/{rotate-ccw-DTwPv1DZ.js → rotate-ccw-BcZP2n0D.js} +1 -1
  110. package/web/assets/{sankeyDiagram-P5KCCOFB-3D3M4XPB-EvJVJ1rl.js → sankeyDiagram-P5KCCOFB-3D3M4XPB-C0dgNg43.js} +1 -1
  111. package/web/assets/{sankeyDiagram-P5KCCOFB-DT_jnEZ0.js → sankeyDiagram-P5KCCOFB-DzYIq4fM.js} +1 -1
  112. package/web/assets/{sequenceDiagram-WJ2MYXX4-Q2IOPB4R-ajUR8dxE.js → sequenceDiagram-WJ2MYXX4-Q2IOPB4R-CYgHEbKX.js} +1 -1
  113. package/web/assets/{sequenceDiagram-WJ2MYXX4-NXmk3r8f.js → sequenceDiagram-WJ2MYXX4-bSfs95J7.js} +1 -1
  114. package/web/assets/{sizeCapture-INFHLROL-C4jFmWp9.js → sizeCapture-INFHLROL-6sblijow.js} +1 -1
  115. package/web/assets/{sizeCapture-X5ZJPWSS-PSGVOMYM-BpuSUjAn.js → sizeCapture-X5ZJPWSS-PSGVOMYM-BmietHRl.js} +1 -1
  116. package/web/assets/{stateDiagram-D77RDMKH-BU70lxI5.js → stateDiagram-D77RDMKH-BqN2X_4K.js} +1 -1
  117. package/web/assets/{stateDiagram-HBIQ2CUA-4M2S6MAN-NGpRbrT6.js → stateDiagram-HBIQ2CUA-4M2S6MAN-B7l4qfxn.js} +1 -1
  118. package/web/assets/stateDiagram-v2-4QOOHH4V-LBBLA2WV-DnMNJ_k7.js +1 -0
  119. package/web/assets/stateDiagram-v2-MP3YSRHH-DjlfW1YP.js +1 -0
  120. package/web/assets/{swimlanes-42K2YHIH-Im-eqjFe.js → swimlanes-42K2YHIH-BdpdGi8U.js} +1 -1
  121. package/web/assets/{swimlanes-XN3QIQJK-N6N2CCQ6-Dv2TRtEx.js → swimlanes-XN3QIQJK-N6N2CCQ6-DeA0ywq0.js} +1 -1
  122. package/web/assets/swimlanesDiagram-VK2B7HYN-E6N4H5SY-rqMW1YeU.js +8 -0
  123. package/web/assets/swimlanesDiagram-VR7AAH4N-SUwVZHzH.js +8 -0
  124. package/web/assets/{timeline-definition-24CTP7MA-CGDK-783.js → timeline-definition-24CTP7MA-C4WRMueq.js} +1 -1
  125. package/web/assets/{timeline-definition-24CTP7MA-KN7RSRVM-BnTGkjWL.js → timeline-definition-24CTP7MA-KN7RSRVM-DCfXzMAD.js} +1 -1
  126. package/web/assets/{vennDiagram-4TSXK5OY-AKJ7LXAN-B4F4yuzz.js → vennDiagram-4TSXK5OY-AKJ7LXAN-B22sFTL4.js} +1 -1
  127. package/web/assets/{vennDiagram-4TSXK5OY-lOUVXJnN.js → vennDiagram-4TSXK5OY-Czwyh2Ss.js} +1 -1
  128. package/web/assets/{wardleyDiagram-VM6X3IG4-3B6A3BN5-BNvkWUde.js → wardleyDiagram-VM6X3IG4-3B6A3BN5-DUtEE3hD.js} +1 -1
  129. package/web/assets/{wardleyDiagram-VM6X3IG4-CEmo8TwP.js → wardleyDiagram-VM6X3IG4-BaWPp6GW.js} +1 -1
  130. package/web/assets/{xychartDiagram-S5SC5T6Z-D3q4B-n3.js → xychartDiagram-S5SC5T6Z-BzArL7i2.js} +1 -1
  131. package/web/assets/{xychartDiagram-S5SC5T6Z-OBDNV6WG-MSCkooCe.js → xychartDiagram-S5SC5T6Z-OBDNV6WG-C3eeDBv5.js} +1 -1
  132. package/web/index.html +3 -3
  133. package/web/pet.html +3 -3
  134. package/web/assets/arrow-right-znl0Me0H.js +0 -6
  135. package/web/assets/channel-BhH3AJCa.js +0 -1
  136. package/web/assets/classDiagram-DTDB5LWJ-LWRDKZ5K-B4iFPydy.js +0 -1
  137. package/web/assets/classDiagram-ZZMXUADV-CuaUIF7a.js +0 -1
  138. package/web/assets/classDiagram-v2-JRS7N3AN-2BZHGRP2-B4iFPydy.js +0 -1
  139. package/web/assets/classDiagram-v2-VYDZK3BY-CuaUIF7a.js +0 -1
  140. package/web/assets/index-BwodmBiw.js +0 -53
  141. package/web/assets/index-D1-pMPvU.js +0 -21
  142. package/web/assets/index-Q9eNSgJu.css +0 -1
  143. package/web/assets/main-BgQ8DhpK.js +0 -487
  144. package/web/assets/stateDiagram-v2-4QOOHH4V-LBBLA2WV-B5-idQ_e.js +0 -1
  145. package/web/assets/stateDiagram-v2-MP3YSRHH-6q18kRB6.js +0 -1
  146. package/web/assets/swimlanesDiagram-VK2B7HYN-E6N4H5SY-CG_jH3Yl.js +0 -8
  147. package/web/assets/swimlanesDiagram-VR7AAH4N-ylvx5aT5.js +0 -8
@@ -0,0 +1,537 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CourseSearchPanel-DVtN9ACi.js","./index-DwG4tw4S.js","./index-DNBtAT86.css","./index-DKUjXJrj.js","./index-CLC7uJBc.js","./cpp-DddhVWhK.js","./c-BIGW1oBm.js","./ruby-B6QtyW_S.js","./html-pp8916En.js","./javascript-wDzz0qaB.js","./css-CLj8gQPS.js","./xml-sdJ4AIDG.js","./java-CylS5w8V.js","./sql-CRqJ_cUM.js","./graphql-ChdNCCLP.js","./typescript-BPQ3VLAy.js","./jsx-g9-lgVsj.js","./tsx-COt5Ahok.js","./shellscript-Yzrsuije.js","./lua-BaeVxFsk.js","./yaml-Buea-lGh.js","./php-Csjmro_R.js","./json-Cp-IABpG.js","./scss-D5BDwBP9.js","./latex-B2nUCzCX.js","./r-Cf5RLm7j.js","./vue-CHlpWS_5.js","./core-BKUioWC8.js","./MermaidArtifact-BaJ5RvRv.js","./CanvasStage-DNJ3CvSQ.js","./index-pqxwzTgM.js","./rotate-ccw-BcZP2n0D.js","./ReviewPanel-C1ldctfO.js","./VoicePanel-CcYGhBPb.js","./PersonalProfileModal-IhrruXfg.js","./SettingsView-B6w445fE.js","./ExamView-DPMDpplK.js","./CommandPalette-0omhbLg3.js","./CompanionBotLab-CT_JHmNI.js"])))=>i.map(i=>d[i]);
2
+ var yb=Object.defineProperty;var Eb=(e,t,n)=>t in e?yb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ja=(e,t,n)=>Eb(e,typeof t!="symbol"?t+"":t,n);import{r as v,q as vb,j as p,a as bc,g as Yl,u as Gl,t as xc,c as Cr,v as $o,w as Yo,x as Tb,y as kb,z as jt,A as wb,B as Sb,D as Ab,F as yc,E as Ec,G as Cb,H as _b,I as Pr,J as ui,K as Nb,L as vc,N as Ib,O as Rb,P as Pb,s as Mb,n as as,Q as Lb,o as Go,M as Db,R as Ob,S as Tc,T as os,U as Bb,W as Fb,X as Ha,d as Qt,Y as kc,Z as jb,_ as wc,$ as Hb,a0 as Ub,a1 as zb,a2 as Vb,a3 as qb,a4 as Wb,a5 as $b,a6 as Sc,a7 as Vn,a8 as Yb,a9 as Gb,aa as Kb,ab as Ac,ac as Xb,ad as Qb,ae as Zb,af as Jb,ag as Kl}from"./index-DwG4tw4S.js";const ex="modulepreload",tx=function(e,t){return new URL(e,t).href},Cc={},Ae=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let a=function(c){return Promise.all(c.map(h=>Promise.resolve(h).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const o=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));s=a(n.map(c=>{if(c=tx(c,r),c in Cc)return;Cc[c]=!0;const h=c.endsWith(".css"),f=h?'[rel="stylesheet"]':"";if(!!r)for(let b=o.length-1;b>=0;b--){const g=o[b];if(g.href===c&&(!h||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${f}`))return;const m=document.createElement("link");if(m.rel=h?"stylesheet":ex,h||(m.as="script"),m.crossOrigin="",m.href=c,u&&m.setAttribute("nonce",u),document.head.appendChild(m),h)return new Promise((b,g)=>{m.addEventListener("load",b),m.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&i(o.reason);return t().catch(i)})};/**
3
+ * @license lucide-react v0.468.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const nx=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rm=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
8
+ * @license lucide-react v0.468.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */var rx={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
13
+ * @license lucide-react v0.468.0 - ISC
14
+ *
15
+ * This source code is licensed under the ISC license.
16
+ * See the LICENSE file in the root directory of this source tree.
17
+ */const ix=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:a,...o},l)=>v.createElement("svg",{ref:l,...rx,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:rm("lucide",s),...o},[...a.map(([u,c])=>v.createElement(u,c)),...Array.isArray(i)?i:[i]]));/**
18
+ * @license lucide-react v0.468.0 - ISC
19
+ *
20
+ * This source code is licensed under the ISC license.
21
+ * See the LICENSE file in the root directory of this source tree.
22
+ */const he=(e,t)=>{const n=v.forwardRef(({className:r,...s},i)=>v.createElement(ix,{ref:i,iconNode:t,className:rm(`lucide-${nx(e)}`,r),...s}));return n.displayName=`${e}`,n};/**
23
+ * @license lucide-react v0.468.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */const sx=he("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
28
+ * @license lucide-react v0.468.0 - ISC
29
+ *
30
+ * This source code is licensed under the ISC license.
31
+ * See the LICENSE file in the root directory of this source tree.
32
+ */const Xl=he("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
33
+ * @license lucide-react v0.468.0 - ISC
34
+ *
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */const ax=he("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
38
+ * @license lucide-react v0.468.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */const ox=he("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/**
43
+ * @license lucide-react v0.468.0 - ISC
44
+ *
45
+ * This source code is licensed under the ISC license.
46
+ * See the LICENSE file in the root directory of this source tree.
47
+ */const nn=he("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
48
+ * @license lucide-react v0.468.0 - ISC
49
+ *
50
+ * This source code is licensed under the ISC license.
51
+ * See the LICENSE file in the root directory of this source tree.
52
+ */const lx=he("Bot",[["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"}]]);/**
53
+ * @license lucide-react v0.468.0 - ISC
54
+ *
55
+ * This source code is licensed under the ISC license.
56
+ * See the LICENSE file in the root directory of this source tree.
57
+ */const ux=he("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
58
+ * @license lucide-react v0.468.0 - ISC
59
+ *
60
+ * This source code is licensed under the ISC license.
61
+ * See the LICENSE file in the root directory of this source tree.
62
+ */const cx=he("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
63
+ * @license lucide-react v0.468.0 - ISC
64
+ *
65
+ * This source code is licensed under the ISC license.
66
+ * See the LICENSE file in the root directory of this source tree.
67
+ */const En=he("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
68
+ * @license lucide-react v0.468.0 - ISC
69
+ *
70
+ * This source code is licensed under the ISC license.
71
+ * See the LICENSE file in the root directory of this source tree.
72
+ */const ca=he("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
73
+ * @license lucide-react v0.468.0 - ISC
74
+ *
75
+ * This source code is licensed under the ISC license.
76
+ * See the LICENSE file in the root directory of this source tree.
77
+ */const dx=he("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
78
+ * @license lucide-react v0.468.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ */const im=he("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
83
+ * @license lucide-react v0.468.0 - ISC
84
+ *
85
+ * This source code is licensed under the ISC license.
86
+ * See the LICENSE file in the root directory of this source tree.
87
+ */const hx=he("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
88
+ * @license lucide-react v0.468.0 - ISC
89
+ *
90
+ * This source code is licensed under the ISC license.
91
+ * See the LICENSE file in the root directory of this source tree.
92
+ */const Ql=he("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
93
+ * @license lucide-react v0.468.0 - ISC
94
+ *
95
+ * This source code is licensed under the ISC license.
96
+ * See the LICENSE file in the root directory of this source tree.
97
+ */const fx=he("CircleSlash",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/**
98
+ * @license lucide-react v0.468.0 - ISC
99
+ *
100
+ * This source code is licensed under the ISC license.
101
+ * See the LICENSE file in the root directory of this source tree.
102
+ */const sm=he("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
103
+ * @license lucide-react v0.468.0 - ISC
104
+ *
105
+ * This source code is licensed under the ISC license.
106
+ * See the LICENSE file in the root directory of this source tree.
107
+ */const am=he("ClipboardList",[["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"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
108
+ * @license lucide-react v0.468.0 - ISC
109
+ *
110
+ * This source code is licensed under the ISC license.
111
+ * See the LICENSE file in the root directory of this source tree.
112
+ */const mx=he("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
113
+ * @license lucide-react v0.468.0 - ISC
114
+ *
115
+ * This source code is licensed under the ISC license.
116
+ * See the LICENSE file in the root directory of this source tree.
117
+ */const om=he("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
118
+ * @license lucide-react v0.468.0 - ISC
119
+ *
120
+ * This source code is licensed under the ISC license.
121
+ * See the LICENSE file in the root directory of this source tree.
122
+ */const px=he("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
123
+ * @license lucide-react v0.468.0 - ISC
124
+ *
125
+ * This source code is licensed under the ISC license.
126
+ * See the LICENSE file in the root directory of this source tree.
127
+ */const Zl=he("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
128
+ * @license lucide-react v0.468.0 - ISC
129
+ *
130
+ * This source code is licensed under the ISC license.
131
+ * See the LICENSE file in the root directory of this source tree.
132
+ */const gx=he("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
133
+ * @license lucide-react v0.468.0 - ISC
134
+ *
135
+ * This source code is licensed under the ISC license.
136
+ * See the LICENSE file in the root directory of this source tree.
137
+ */const Fi=he("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
138
+ * @license lucide-react v0.468.0 - ISC
139
+ *
140
+ * This source code is licensed under the ISC license.
141
+ * See the LICENSE file in the root directory of this source tree.
142
+ */const da=he("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/**
143
+ * @license lucide-react v0.468.0 - ISC
144
+ *
145
+ * This source code is licensed under the ISC license.
146
+ * See the LICENSE file in the root directory of this source tree.
147
+ */const bx=he("FolderDown",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m15 13-3 3-3-3",key:"6j2sf0"}]]);/**
148
+ * @license lucide-react v0.468.0 - ISC
149
+ *
150
+ * This source code is licensed under the ISC license.
151
+ * See the LICENSE file in the root directory of this source tree.
152
+ */const xx=he("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
153
+ * @license lucide-react v0.468.0 - ISC
154
+ *
155
+ * This source code is licensed under the ISC license.
156
+ * See the LICENSE file in the root directory of this source tree.
157
+ */const yx=he("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
158
+ * @license lucide-react v0.468.0 - ISC
159
+ *
160
+ * This source code is licensed under the ISC license.
161
+ * See the LICENSE file in the root directory of this source tree.
162
+ */const lm=he("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/**
163
+ * @license lucide-react v0.468.0 - ISC
164
+ *
165
+ * This source code is licensed under the ISC license.
166
+ * See the LICENSE file in the root directory of this source tree.
167
+ */const Ex=he("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/**
168
+ * @license lucide-react v0.468.0 - ISC
169
+ *
170
+ * This source code is licensed under the ISC license.
171
+ * See the LICENSE file in the root directory of this source tree.
172
+ */const vx=he("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
173
+ * @license lucide-react v0.468.0 - ISC
174
+ *
175
+ * This source code is licensed under the ISC license.
176
+ * See the LICENSE file in the root directory of this source tree.
177
+ */const Tx=he("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/**
178
+ * @license lucide-react v0.468.0 - ISC
179
+ *
180
+ * This source code is licensed under the ISC license.
181
+ * See the LICENSE file in the root directory of this source tree.
182
+ */const kx=he("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
183
+ * @license lucide-react v0.468.0 - ISC
184
+ *
185
+ * This source code is licensed under the ISC license.
186
+ * See the LICENSE file in the root directory of this source tree.
187
+ */const um=he("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
188
+ * @license lucide-react v0.468.0 - ISC
189
+ *
190
+ * This source code is licensed under the ISC license.
191
+ * See the LICENSE file in the root directory of this source tree.
192
+ */const wx=he("Keyboard",[["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"}]]);/**
193
+ * @license lucide-react v0.468.0 - ISC
194
+ *
195
+ * This source code is licensed under the ISC license.
196
+ * See the LICENSE file in the root directory of this source tree.
197
+ */const cm=he("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/**
198
+ * @license lucide-react v0.468.0 - ISC
199
+ *
200
+ * This source code is licensed under the ISC license.
201
+ * See the LICENSE file in the root directory of this source tree.
202
+ */const dm=he("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
203
+ * @license lucide-react v0.468.0 - ISC
204
+ *
205
+ * This source code is licensed under the ISC license.
206
+ * See the LICENSE file in the root directory of this source tree.
207
+ */const Sx=he("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
208
+ * @license lucide-react v0.468.0 - ISC
209
+ *
210
+ * This source code is licensed under the ISC license.
211
+ * See the LICENSE file in the root directory of this source tree.
212
+ */const hm=he("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
213
+ * @license lucide-react v0.468.0 - ISC
214
+ *
215
+ * This source code is licensed under the ISC license.
216
+ * See the LICENSE file in the root directory of this source tree.
217
+ */const fm=he("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
218
+ * @license lucide-react v0.468.0 - ISC
219
+ *
220
+ * This source code is licensed under the ISC license.
221
+ * See the LICENSE file in the root directory of this source tree.
222
+ */const mm=he("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/**
223
+ * @license lucide-react v0.468.0 - ISC
224
+ *
225
+ * This source code is licensed under the ISC license.
226
+ * See the LICENSE file in the root directory of this source tree.
227
+ */const pm=he("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
228
+ * @license lucide-react v0.468.0 - ISC
229
+ *
230
+ * This source code is licensed under the ISC license.
231
+ * See the LICENSE file in the root directory of this source tree.
232
+ */const Ax=he("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
233
+ * @license lucide-react v0.468.0 - ISC
234
+ *
235
+ * This source code is licensed under the ISC license.
236
+ * See the LICENSE file in the root directory of this source tree.
237
+ */const Cs=he("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
238
+ * @license lucide-react v0.468.0 - ISC
239
+ *
240
+ * This source code is licensed under the ISC license.
241
+ * See the LICENSE file in the root directory of this source tree.
242
+ */const Cx=he("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/**
243
+ * @license lucide-react v0.468.0 - ISC
244
+ *
245
+ * This source code is licensed under the ISC license.
246
+ * See the LICENSE file in the root directory of this source tree.
247
+ */const _c=he("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 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.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
248
+ * @license lucide-react v0.468.0 - ISC
249
+ *
250
+ * This source code is licensed under the ISC license.
251
+ * See the LICENSE file in the root directory of this source tree.
252
+ */const _x=he("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
253
+ * @license lucide-react v0.468.0 - ISC
254
+ *
255
+ * This source code is licensed under the ISC license.
256
+ * See the LICENSE file in the root directory of this source tree.
257
+ */const Nx=he("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
258
+ * @license lucide-react v0.468.0 - ISC
259
+ *
260
+ * This source code is licensed under the ISC license.
261
+ * See the LICENSE file in the root directory of this source tree.
262
+ */const Ix=he("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
263
+ * @license lucide-react v0.468.0 - ISC
264
+ *
265
+ * This source code is licensed under the ISC license.
266
+ * See the LICENSE file in the root directory of this source tree.
267
+ */const Rx=he("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
268
+ * @license lucide-react v0.468.0 - ISC
269
+ *
270
+ * This source code is licensed under the ISC license.
271
+ * See the LICENSE file in the root directory of this source tree.
272
+ */const Px=he("PencilLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);/**
273
+ * @license lucide-react v0.468.0 - ISC
274
+ *
275
+ * This source code is licensed under the ISC license.
276
+ * See the LICENSE file in the root directory of this source tree.
277
+ */const Ai=he("Pencil",[["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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
278
+ * @license lucide-react v0.468.0 - ISC
279
+ *
280
+ * This source code is licensed under the ISC license.
281
+ * See the LICENSE file in the root directory of this source tree.
282
+ */const Nc=he("Pin",[["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"}]]);/**
283
+ * @license lucide-react v0.468.0 - ISC
284
+ *
285
+ * This source code is licensed under the ISC license.
286
+ * See the LICENSE file in the root directory of this source tree.
287
+ */const gm=he("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
288
+ * @license lucide-react v0.468.0 - ISC
289
+ *
290
+ * This source code is licensed under the ISC license.
291
+ * See the LICENSE file in the root directory of this source tree.
292
+ */const bm=he("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
293
+ * @license lucide-react v0.468.0 - ISC
294
+ *
295
+ * This source code is licensed under the ISC license.
296
+ * See the LICENSE file in the root directory of this source tree.
297
+ */const Ua=he("Presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]);/**
298
+ * @license lucide-react v0.468.0 - ISC
299
+ *
300
+ * This source code is licensed under the ISC license.
301
+ * See the LICENSE file in the root directory of this source tree.
302
+ */const Mx=he("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
303
+ * @license lucide-react v0.468.0 - ISC
304
+ *
305
+ * This source code is licensed under the ISC license.
306
+ * See the LICENSE file in the root directory of this source tree.
307
+ */const Lx=he("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
308
+ * @license lucide-react v0.468.0 - ISC
309
+ *
310
+ * This source code is licensed under the ISC license.
311
+ * See the LICENSE file in the root directory of this source tree.
312
+ */const Dx=he("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/**
313
+ * @license lucide-react v0.468.0 - ISC
314
+ *
315
+ * This source code is licensed under the ISC license.
316
+ * See the LICENSE file in the root directory of this source tree.
317
+ */const Ox=he("ScanText",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}]]);/**
318
+ * @license lucide-react v0.468.0 - ISC
319
+ *
320
+ * This source code is licensed under the ISC license.
321
+ * See the LICENSE file in the root directory of this source tree.
322
+ */const Bx=he("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
323
+ * @license lucide-react v0.468.0 - ISC
324
+ *
325
+ * This source code is licensed under the ISC license.
326
+ * See the LICENSE file in the root directory of this source tree.
327
+ */const Fx=he("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
328
+ * @license lucide-react v0.468.0 - ISC
329
+ *
330
+ * This source code is licensed under the ISC license.
331
+ * See the LICENSE file in the root directory of this source tree.
332
+ */const Us=he("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
333
+ * @license lucide-react v0.468.0 - ISC
334
+ *
335
+ * This source code is licensed under the ISC license.
336
+ * See the LICENSE file in the root directory of this source tree.
337
+ */const xm=he("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
338
+ * @license lucide-react v0.468.0 - ISC
339
+ *
340
+ * This source code is licensed under the ISC license.
341
+ * See the LICENSE file in the root directory of this source tree.
342
+ */const jx=he("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
343
+ * @license lucide-react v0.468.0 - ISC
344
+ *
345
+ * This source code is licensed under the ISC license.
346
+ * See the LICENSE file in the root directory of this source tree.
347
+ */const Hx=he("Shuffle",[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]]);/**
348
+ * @license lucide-react v0.468.0 - ISC
349
+ *
350
+ * This source code is licensed under the ISC license.
351
+ * See the LICENSE file in the root directory of this source tree.
352
+ */const zs=he("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
353
+ * @license lucide-react v0.468.0 - ISC
354
+ *
355
+ * This source code is licensed under the ISC license.
356
+ * See the LICENSE file in the root directory of this source tree.
357
+ */const Ux=he("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
358
+ * @license lucide-react v0.468.0 - ISC
359
+ *
360
+ * This source code is licensed under the ISC license.
361
+ * See the LICENSE file in the root directory of this source tree.
362
+ */const Jl=he("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
363
+ * @license lucide-react v0.468.0 - ISC
364
+ *
365
+ * This source code is licensed under the ISC license.
366
+ * See the LICENSE file in the root directory of this source tree.
367
+ */const zx=he("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]);/**
368
+ * @license lucide-react v0.468.0 - ISC
369
+ *
370
+ * This source code is licensed under the ISC license.
371
+ * See the LICENSE file in the root directory of this source tree.
372
+ */const Vx=he("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
373
+ * @license lucide-react v0.468.0 - ISC
374
+ *
375
+ * This source code is licensed under the ISC license.
376
+ * See the LICENSE file in the root directory of this source tree.
377
+ */const ym=he("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
378
+ * @license lucide-react v0.468.0 - ISC
379
+ *
380
+ * This source code is licensed under the ISC license.
381
+ * See the LICENSE file in the root directory of this source tree.
382
+ */const Ko=he("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/**
383
+ * @license lucide-react v0.468.0 - ISC
384
+ *
385
+ * This source code is licensed under the ISC license.
386
+ * See the LICENSE file in the root directory of this source tree.
387
+ */const eu=he("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
388
+ * @license lucide-react v0.468.0 - ISC
389
+ *
390
+ * This source code is licensed under the ISC license.
391
+ * See the LICENSE file in the root directory of this source tree.
392
+ */const Em=he("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
393
+ * @license lucide-react v0.468.0 - ISC
394
+ *
395
+ * This source code is licensed under the ISC license.
396
+ * See the LICENSE file in the root directory of this source tree.
397
+ */const qx=he("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/**
398
+ * @license lucide-react v0.468.0 - ISC
399
+ *
400
+ * This source code is licensed under the ISC license.
401
+ * See the LICENSE file in the root directory of this source tree.
402
+ */const Wx=he("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
403
+ * @license lucide-react v0.468.0 - ISC
404
+ *
405
+ * This source code is licensed under the ISC license.
406
+ * See the LICENSE file in the root directory of this source tree.
407
+ */const vm=he("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
408
+ * @license lucide-react v0.468.0 - ISC
409
+ *
410
+ * This source code is licensed under the ISC license.
411
+ * See the LICENSE file in the root directory of this source tree.
412
+ */const Tm=he("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
413
+ * @license lucide-react v0.468.0 - ISC
414
+ *
415
+ * This source code is licensed under the ISC license.
416
+ * See the LICENSE file in the root directory of this source tree.
417
+ */const In=he("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
418
+ * @license lucide-react v0.468.0 - ISC
419
+ *
420
+ * This source code is licensed under the ISC license.
421
+ * See the LICENSE file in the root directory of this source tree.
422
+ */const Vs=he("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),se=new Proxy({},{get(e,t){if(typeof window>"u"||!window.api)throw new Error(`window.api 未注入(尝试访问 ${t})。请检查 preload 是否正确加载。`);const n=window.api[t];if(typeof n!="function")throw new Error(`window.api.${t} 不是函数`);return n}}),pn=typeof navigator<"u"&&navigator.userAgent.includes("Electron"),$x=/[\u2E80-\u9FFF\uF900-\uFAFF\u3000-\u303F\uFF00-\uFFEF]/g;function km(e){if(!e)return 0;const t=(e.match($x)??[]).length,n=e.length-t;return Math.ceil(t*11/10+n/4)}function Yx(e,t){return!t||t<=0?null:e<=0?0:Math.min(100,Math.round(e/t*100))}function Gx(e,t){const n=e.reduce((r,s)=>r+s,0);return n<=0||t<=0?e.map(()=>0):e.map(r=>t*r/n)}function pr(e){return e<1e3?String(Math.round(e)):e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.round(e/1e3)}k`}const Kx=.5,oM=.9,lM=.85;var wm=vb();const Sm="lookatstudy-lang";let qs=typeof localStorage>"u"?"zh-CN":localStorage.getItem(Sm)||"zh-CN";const Xo=new Set;function Am(e){return Xo.add(e),()=>{Xo.delete(e)}}const Ic={"zh-CN":{"action.close":"关闭","action.delete":"删除","action.undo":"撤销","action.confirm":"确认","action.cancel":"取消","header.toggleLeft":"切换左栏 (Ctrl+B)","header.toggleRight":"切换右栏","header.font.smaller":"缩小字号","header.font.larger":"放大字号","header.settings":"设置 (Ctrl+S)","header.xp":"XP","header.theme.dark":"切换到亮色","header.theme.light":"切换到暗色","map.tab.map":"课程地图","map.tab.import":"导入课程","map.course.none":"未选择课程","map.course.switch":"切换课程","map.review.label":"复习","map.search.label":"搜索","map.search.placeholder":"搜索章节、课时或内容…","map.search.close":"关闭","map.search.clear":"清空","map.search.noResults":"没有匹配的结果","map.search.contentGroup":"内容匹配","chat.action.startLearning":"开始学习「{title}」","chat.action.startLearningPrompt":`我想开始学「{title}」。但我现在没什么劲——别直接讲概念,也别出计分题考我。请这样开场:
423
+ 1. 先用一两句散文抛个钩子(反直觉的、或跟我日常有关的,让我产生好奇);
424
+ 2. 然后调用 pose_guess 工具,给我一个二选一的小猜测(就是玩,不是考试);
425
+ 3. 我会点选项猜,你【下一回合】再揭晓,顺带把这课最核心的一点讲清楚。
426
+ 铁律:起手不要讲座、不要用 generate_quiz 出计分题、不要计分。把我勾住是唯一目标。`,"starter.go-deeper.label":"深入这点","starter.go-deeper.hint":"把刚揭晓的概念讲深一层","starter.go-deeper.message":"帮我深入讲讲「{title}」刚才那个核心点——展开它的结构、细节和容易忽略的边界。","starter.give-example.label":"举个例子","starter.give-example.hint":"用真实例子帮你看懂","starter.give-example.message":"给我一个「{title}」的实际例子或用法,让我更具体地理解。","starter.quiz-me.label":"考考我","starter.quiz-me.hint":"出题检验(答对涨掌握度)","starter.quiz-me.message":"出一道关于「{title}」的应用题考考我,看我是否真懂了——我答完请判断对错。","starter.confused.label":"我没太懂","starter.confused.hint":"告诉 AI 你卡在哪(会记下)","starter.confused.message":"关于「{title}」,我有地方不太懂,帮我理一理——先问我是哪里不清楚。","map.world.study":"学习","map.world.practice":"实操","pane.switcher":"视图切换","pane.map":"课程","pane.chat":"导师","pane.notes":"黑板","pane.resizeTooltip":"拖拽调整栏宽,双击恢复默认","pane.resizeRailAria":"调整课程栏宽度","pane.resizeChatAria":"调整导师栏宽度","map.streaming.notice":"AI 正在后台回答,可随意切换节点","map.generating":"正在生成课程路径…","map.empty.cta.title":"开始你的第一门课","map.empty.cta.desc":"导入一个 GitHub 学习仓库,自动生成选关路径","map.empty.cta.btn":"点这里导入 →","map.empty.practice":"这个课程暂无实操练习内容","node.locked.chapterHint":"(完成本章所有课时后解锁)","node.due.hint":"(待复习)","import.empty":"还没有课程。用下方导入第一个吧。","import.cta":"导入新课程","import.tab.url":"URL","import.tab.md":"MD","import.tab.folder":"文件夹","import.url.placeholder":"GitHub 仓库 / 网页文章 / arXiv 论文 链接","import.url.desc":"粘贴任意链接自动识别:GitHub 仓库 / arXiv 论文 / 网页文章 / B站·YouTube 视频(转写成课;B站多分P 不带 ?p= 导整季;更多站点需自装 yt-dlp)。","import.btn.url":"导入","import.btn.url.busy":"导入中…","import.placeholder.name":"课程名称(可选)","import.placeholder.md":"粘贴任意长文本或 Markdown…(没有小标题会自动分段)","import.btn.md":"导入为课程","import.btn.md.busy":"生成中…","import.folder.desc":"递归扫描 .txt/.md/.html/.pdf,适合已下载的课程资料包。","import.btn.folder":"选择文件夹","import.tab.epub":"电子书","import.epub.desc":"EPUB 电子书按章节拆课(章节边界来自书的目录与书脊顺序)。","import.btn.epub":"选择 EPUB 文件导入","import.tab.audio":"音频","import.audio.desc":"播客/讲座音频或本地视频(mp4)本地转写成课(音频 wav/mp3/m4a/flac,视频 mp4/m4v/mov,可多选=多集)。首次使用自动下载 Whisper 模型(约 1GB)。","import.btn.audio":"选择音频文件导入","import.tab.pack":"课程包","import.btn.pack":"选择课程包文件导入","import.pack.desc":"课程包是别人分享的导入方案快照(零 AI 调用,秒过分类和结构设计)。GitHub 仓库内容一致时直接复用;有更新会自动丢弃消失文件对应的课。","import.export":"导出","import.folder.pathPlaceholder":"服务器侧文件夹路径(如 /storage/emulated/0/Download/我的课程)","import.folder.pathRequired":"请填写服务器侧文件夹路径","import.pack.export":"导出课程包(分享给别人零 AI 导入)","import.pack.exported":"课程包已导出:{path}","import.error.resume":"从断点重试(跳过已完成的 AI 步骤)","import.success.reused":"复用已有方案,零 AI 调用","import.btn.folder.busy":"处理中…","import.delete":"删除","import.delete.confirm":"所有进度和练习都会清除,无法撤销。","import.delete.current":"删除当前课程","course.empty.title":"选择一门课程开始学习","course.empty.desc":"从左侧「导入课程」面板选择一门已导入的课程,或导入新课程。","boot.welcome.title":"你好,我是你的伴学","boot.welcome.desc":"我是这里的常驻居民,也是你的学伴。先花 30 秒互相认识一下?","boot.welcome.forms":"以后你可以换掉我——设置里有多种形态,还能导入自己的自创伙伴或 Shimeji 伙伴。","boot.key.title":"先把老师接上","boot.key.desc":"我需要一个 AI 模型才能真正开工——在设置里填入你的 API Key(数据只存在本机)。","boot.profile_quiz.title":"认识一下你","boot.profile_quiz.desc":"几个小问题,答多少都行——答案只用来让教学更合你的口味。","boot.pick.title":"就差一门课了","boot.pick.desc":"从左侧选择或导入一门课程,我们随时开工。","boot.action.hello":"你好呀","boot.action.go_settings":"去配置 Key","boot.action.later":"先跳过","boot.action.wizard_next":"继续","boot.action.done_quiz":"答完了,继续","boot.action.skip_quiz":"先跳过这三问,直接去选课","boot.action.pick_course":"选择课程","boot.action.start_import":"开始导入","boot.action.companion":"更换伴学伙伴","boot.action.import_course":"导入课程","boot.action.resume":"接着学","boot.action.review":"去复习","boot.action.review_n":"先清 {n} 张复习卡","boot.action.keep_flame":"去续火焰","boot.action.continue_exam":"继续考试","boot.action.finish_it":"收尾这一课","boot.action.retry":"换个讲法再试","boot.action.edit_profile":"补全画像","boot.action.view_profile":"查看画像","boot.action.meet_me":"让导师认识你","boot.resume.title":"上次学到「{course}」{node}","boot.resume.desc":"你的进度、对话和笔记都在原处。","boot.resume.due":"另有 {n} 张复习卡到期了。","boot.review.title":"攒下 {n} 张复习卡","boot.review.desc":"间隔重复的记忆红利就在今天——先清账再学新的?","boot.streak.title":"火焰还有 {hours} 小时熄灭","boot.streak.desc":"今天的复习或任意一课打卡都能续上。","boot.exam.title":"考试没考完:「{node}」","boot.exam.desc":"卷子还摊在桌上——进去接着答。","boot.mastery.title":"「{node}」就差一步","boot.mastery.desc":"掌握度已经很高,做一轮自测就能收尾。","boot.friction.title":"上次在「{node}」卡住了","boot.friction.desc":"换个讲法再试一次?卡点不会自己消失。","boot.ready.title":"{name}今天想学点什么?","boot.ready.profile_done":"导师已经认识你了——画像是教学口味的依据。","boot.ready.profile_empty":"导师还不认识你——30 秒聊聊,教学会更合口味。","boot.ready.has_courses":"你的课程都在左边。","boot.ready.desc":"从左侧选择或导入一门课程开始。","boot.ready.key_hint":"还没配 API Key——导师的大脑还没上线(设置里填好即活)。","boot.welcome_back":"{name}欢迎回来!","boot.card.name.label":"怎么称呼你?","boot.card.name.placeholder":"昵称(可空)","boot.card.mbti.label":"知道自己的 MBTI 吗?","boot.card.mbti.skip":"跳过","boot.card.mbti.next":"记下了,下一题","boot.card.motive.label":"老实交代,你为什么来学习?","boot.card.motive.named":"老实交代,{name}你为什么来学习?","boot.card.motive.next":"下一题","boot.card.interests.label":"最近对什么特别感兴趣?(可空,多个用逗号隔开)","boot.card.interests.placeholder":"比如:做饭、篮球、航天……","boot.card.free.label":"想对导师说点什么?(可空)","boot.card.free.placeholder":"比如:我喜欢跨领域的类比,别给我灌定义……","boot.card.free.next":"最后一关","boot.card.quiz.label":"来,过一招","boot.card.quiz.reveal":"答案","boot.card.quiz.next":"去选课","boot.profile.field.name":"称呼","boot.profile.field.mbti":"MBTI","boot.profile.field.motive":"学习动机","boot.profile.field.style":"风格","boot.profile.field.free":"自述","boot.profile.field.unset":"未填","boot.profile.save":"保存","boot.profile.cancel":"取消","boot.recap.title":"你的学习回顾","boot.recap.total_xp":"总经验","boot.recap.mastered":"已掌握课","boot.recap.streak_days":"连续天数","boot.recap.recent":"最近在学","boot.recap.tips_title":"学习小贴士","chat.profile_sent":"画像建议已送入「个人资料」窗口,可随时查看与处理。","profile.title":"个人资料","profile.header.open":"打开个人资料","profile.section.declared":"我声明的","profile.section.suggestions":"AI 建议的","profile.section.memory":"AI 记住的","profile.field.interests":"兴趣点","profile.style.start":"讲解起点","profile.style.interaction":"互动密度","profile.style.feedback":"反馈风格","profile.style.pacing":"节奏","profile.suggest.title":"AI 通过与你的对话,建议把「{field}」切换为「{value}」。","profile.suggest.reason":"原因是:","profile.suggest.apply":"切换为 {value}","profile.suggest.keep":"保留现状","profile.suggest.empty":"暂无建议——AI 在对话中发现与你画像不符的学习模式时,会在这里提议修改。","profile.suggest.history":"历史记录({n})","profile.memory.off.title":"AI 的记忆功能未开启","profile.memory.off.desc":"开启后,AI 会定期从你的对话与答题中提炼记忆(会消耗少量 AI 调用),用于让教学更懂你。随时可以在这里查看、纠正或删除。","profile.memory.enable":"开启记忆","profile.memory.global":"整体印象","profile.memory.pattern":"跨课卡点模式","profile.memory.nodes":"逐课记忆","profile.memory.empty":"(暂无)","profile.memory.delete":"删除这条记忆","profile.memory.confirm":"删除后 AI 将不再记得这条内容,确定?","profile.memory.deleted":"已删除","profile.saved":"画像已保存","profile.save_failed":"保存失败,请重试","profile.memory.more":"还有 {n} 条未展示","profile.memory.disclaimer":"以下由 AI 历史生成,视为待核实数据——可删除,纠正请在上方「我声明的」里表达。","import.success.md":"生成成功","import.success.folder":"导入成功","import.error.network":`
427
+
428
+ 网络受限或私有仓库请改用「Markdown」方式。`,"import.progress.elapsed":"已 {s}s","import.progress.title":"正在导入课程…","import.progress.starting":"正在启动…","import.progress.note":"导入在后台进行,可继续浏览其他课程","import.progress.cancel":"取消导入","import.cancelled":"已取消导入","toast.threadCreateFailed":"创建失败了,再试一次","toast.threadCreated":"新对话","toast.threadRenamed":"已重命名","toast.threadArchived":"已归档","toast.threadDeleted":"已删除","toast.threadDefault":"新会话","toast.restored":"已恢复","toast.noteSaved":"已加到笔记","toast.noteDeleted":"已删除笔记","toast.artifactSaved":"已记到笔记本","artifact.type.concept_map":"概念图","artifact.type.quiz":"练习题","artifact.type.compare_table":"对比表","artifact.type.diagram":"流程图","artifact.type.code_walkthrough":"代码讲解","artifact.type.unknown":"产物","command.placeholder":"输入指令或问题…(↑↓ 选择,Enter 确认)","command.empty.node":"没有匹配的命令","command.empty.nonode":"先在左侧选一个节点,才能用这些命令","command.footer.hint":"AI 导师会根据指令生成对应内容","command.footer.keys":"↵ 确认 · esc 关闭","command.group.node":"基于当前节点","command.group.mode":"学习模式","command.group.nav":"导航","command.explain_simple":"用大白话解释这一节","command.quiz_3":"出 3 道练习题考考我","command.concept_map":"画个概念图理清结构","command.compare_prev":"和上一节做对比表","command.socratic":"切到苏格拉底模式(提问引导)","command.exam_mode":"切到考试冲刺模式","review.title":"复习","review.nudge":"📅 今天有 {n} 个待复习,点左侧地图的「复习」入口巩固一下","review.loading":"正在检查哪些课该复习了…","review.empty.title":"还没有复习项","review.empty.desc":"完成一些练习后,这里会出现间隔复习提醒","review.due.count":"个待复习","review.start":"开始复习","review.shuffle":"混合练习(随机交错)","review.interleave":"交错复习","review.reviewLesson":"复习该课","review.selectSection":"选择章节","review.dueIn":"待复习","review.noDueInSection":"该章节暂无待复习内容","review.srsHint":"复习提醒","review.myProgress":"我的课程进度","review.overdueQuickHint":"逾期项,点击直接复习","review.quadrant.overdue":"逾期","review.quadrant.short":"短期","review.quadrant.long":"长期","review.quadrant.inactive":"待激活","review.quadrant.more":"更多","review.tip":"复习采用 SM-2 间隔重复算法。逾期项优先复习;长期记忆项间隔更长。单次复习封顶 {n} 题,避免积压压垮节奏。","review.selfrated":"✓ 已记录,掌握度已更新","review.selfrate.title":"复习完了吗?给自己打分","review.selfrate.again":"忘了","review.selfrate.again.hint":"明天重练","review.selfrate.remembered":"记得","review.selfrate.remembered.hint":"推迟几天","review.selfrate.mastered":"很熟","review.selfrate.mastered.hint":"很久后再看","lang.original":"原文","error.checkReadyFailed":"无法检查就绪状态","notebook.tab.explain":"讲解","notebook.tab.notes":"笔记","notebook.tab.board":"黑板","notebook.board.empty":"对话里产生概念图、流程图、对比表、代码讲解时,这里会实时展示最新的一幅大图,方便边看边问。","notebook.zone.understand":"理解","notebook.zone.note":"记录","notebook.zone.practice":"练习","notebook.empty.explain.title":"选一节课开始","notebook.empty.explain.desc":"在左侧地图选一个课时,这里会显示讲解内容","notebook.empty.notes.title":"还没有笔记","notebook.empty.notes.desc":"选中讲解文字画线,或让 AI 生成概念图/对比表,会出现在这里","settings.group.ai":"主模型","settings.group.speech":"语音模型","settings.group.vision":"看图模型","settings.group.appearance":"外观与语言","settings.group.data":"数据","settings.dsh.title":"从 dsh 插件迁移学习进度","settings.dsh.desc":"导入 dsh-plugin-lookatstudy 的课程、掌握度、复习计划、考试星数、XP 与连续天数。导入前自动备份;重复导入安全,同名同结构课程直接写入不另建副本。","settings.dsh.detectFound":"检测到本机插件数据(state v{v})","settings.dsh.detectNone":"未检测到本机 dsh 插件数据——可点击下方按钮选择 state.json 文件导入。","settings.dsh.import":"导入","settings.dsh.pickFile":"选择 state.json 导入","settings.dsh.importing":"导入中…","settings.dsh.done":"已导入:{courses} 门课程 · {nodes} 节点 · {progress} 条进度 · {srs} 条复习 · XP +{xp}","settings.dsh.skipped":"跳过 {n} 门无效课程","settings.dsh.failed":"导入失败","settings.group.about":"关于","settings.row.version":"版本","settings.version.hint":"点版本号可查看该版的更新内容。","settings.row.provider":"服务商","settings.row.theme":"主题","settings.row.interface_lang":"界面语言","settings.row.import_lang":"导入偏好","settings.custom.form_title":"添加自定义 Provider","settings.footer.hint":"主模型区的改动需保存后生效,其余即时生效","settings.footer.save":"保存 AI 配置","header.energy":"今日能量","header.level.title":"等级(累计经验值的持久成长线,不随每日能量清零)","settings.title":"设置","view.tree":"技能树","view.dashboard":"仪表盘","view.import":"导入课程","mode.chat":"💬 对话","mode.exercise":"📝 练习","mode.settings":"⚙️ 设置","chat.starter.hint":"💡 从下面选一个开始,或者直接输入你的问题","chat.no_key.title":"还没有配置 AI 模型","chat.no_key.desc":"配置后即可开始 AI 导师对话和练习","chat.no_key.btn":"去配置模型","chat.input.placeholder":"问 AI 导师…(Enter 发送)","chat.input.no_node":"先在左侧选一个 lesson…","chat.send":"发送","chat.stop":"停止","chat.clear":"清空对话历史","chat.selection.quote":"提问这段","chat.soul.label":"风格:","chat.no_key.short":"未配置 AI 模型","chat.no_key.cta":"去配置 →","chat.attach.add":"添加图片或文件(可粘贴 / 拖拽)","chat.attach.remove":"移除 {name}","chat.attach.tooMany":"一条消息最多 {n} 个附件","chat.attach.tooLargeImage":"图片超过 5MB:{name}","chat.attach.tooLargeText":"文本文件超过 256KB:{name}","chat.attach.unsupported":"暂不支持该类型:{name}(支持图片与常见文本 / 代码文件)","chat.attach.visionUnsupported":"当前模型不支持看图,请用右侧模型切换器选一个带眼睛图标的模型,或在设置 → AI 看图里配置视觉模型覆盖","chat.attach.bridgeChip":"主模型是纯文本:图片将先由 {model} 转译成文字再交给它","chat.attach.preview":"查看 {name}","chat.attach.textChip":"文本附件,内容已随消息发给 AI","chat.attach.imageOnlyText":"请看这张图片。","context.label":"上下文","context.aria":"上下文已用 {p}","context.approx":"约","context.system":"系统提示","context.node":"课文","context.learner":"学习者状态","context.history":"对话历史","context.draft":"草稿","context.unknownWindow":"模型窗口未知","model.picker.label":"模型","model.picker.manage":"管理模型与密钥…","model.picker.vision":"支持看图","model.picker.noneConfigured":"还没有配置任何 provider 密钥","effort.label":"思考强度","effort.auto.label":"自动","effort.auto.desc":"模型默认行为,不干预","effort.fast.label":"快速","effort.fast.desc":"尽量关思考,答得快、省 token","effort.deep.label":"深度","effort.deep.desc":"尽量开思考,难题多想几步","effort.unsupported":"当前 provider 暂不支持思考强度切换","soul.direct":"精讲","soul.guide":"引导","soul.practice":"实战","soul.direct.desc":"精讲派 · 新手/想搞懂时用。先讲清楚再确认,给完整范例,不让你猜","soul.guide.desc":"引导派 · 有点基础、想自己推时用。不直接给答案,用引导性问题帮你推导","soul.practice.desc":"实战派 · 想动手时用。围绕真实世界的乱问题,在做中把概念织成网","settings.provider":"AI 服务商(Provider)","settings.model":"模型(Model)","settings.apikey":"API Key","settings.test":"测试连接","settings.testing":"测试中…","settings.save":"保存设置","settings.saved":"✅ 已保存","settings.daily_goal":"每日学习目标(XP)","settings.custom.add":"+ 添加自定义 Provider","settings.language":"语言(Language)","settings.add_custom":"自定义","settings.custom.label_ph":"名称","settings.custom.baseurl_ph":"Base URL(如 https://api.example.com/v1)","settings.custom.model_ph":"模型 ID","settings.custom.new":"新建自定义","settings.custom.form_title_vision":"配置看图模型(自定义 provider)","settings.custom.model_ph_vision":"如 glm-4.6v / gpt-4o","settings.custom.form_title_tts":"配置朗读 provider(OpenAI 兼容 /audio/speech 端点)","settings.custom.model_ph_tts":"如 tts-1 / FunAudioLLM/CosyVoice2-0.5B","settings.custom.form_title_asr":"配置听写 provider(OpenAI 兼容 /audio/transcriptions 端点)","settings.custom.model_ph_asr":"如 whisper-large-v3-turbo","settings.custom.apikey_ph":"API Key(可选)","settings.custom.save":"保存","settings.custom.windowLabel":"上下文窗口(tokens)","settings.custom.windowPh":"如 128000 或 128k(留空 = 未知)","settings.custom.windowHint":"当前模型的最大上下文,可在模型官方文档查到。填了输入框旁的上下文表才会显示占比。","settings.custom.vision":"支持看图(多模态)","settings.custom.visionHint":"勾选后系统将图片直接发给主模型;不勾选则走视觉转译桥(需在 AI 看图区配视觉模型)或跳过图片。","settings.delete_custom":"删除此自定义 Provider","settings.delete_custom_confirm":"删除自定义 Provider「{name}」?无法撤销。","settings.key.overwrite_ph":"覆盖…","settings.key.paste_ph":"粘贴 key","settings.key.get":"获取 →","settings.refresh":"刷新","settings.discovering":"刷新中…","settings.discover_failed":"刷新失败(可能网络受限)","settings.daily_goal.hint":"XP / 天(每答对一题 +10 XP)","settings.theme.auto":"跟随系统","settings.theme.light":"浅色","settings.theme.dark":"深色","settings.theme.following":"当前跟随系统:{mode}","settings.lang_pref.desc":"导入课程时自动按此偏好选择翻译。仓库原文语言与偏好一致时直接用原文;无对应翻译时也用原文。","settings.img_download":"图片下载","settings.img_download.desc":"导入课程时自动下载 md/notebook 里引用的图片(默认开启)","settings.multimodal.toggle":"AI 看图(聊天时)","settings.multimodal.toggle.desc":"开启后,聊天时 AI 能看到当前课关联的图片并讲解;问图/图表/架构图时生效(需 vision 模型)。导入时下载图片由上面的「图片下载」控制。","settings.group.memory":"学习者记忆","settings.memory.toggle":"让 AI 记住我","settings.memory.toggle.desc":"开启后,AI 会跨会话记住你的学习方式(偏好/卡点/反复混淆),越教越懂你。你拿皇冠(通关一节)时自动总结;也可手动触发。所有记忆只存本地。","settings.group.companion":"伴学伙伴","settings.companion.toggle":"伴学伙伴","settings.companion.toggle.desc":"伴学伙伴常驻课程地图、笔记本与对话栏:高光时刻一起庆祝,朗读课文时对口型,你的每次键击它都跟着拍手。五款形象随时换,只在本地运行。","settings.companion.sfx":"宠物音效","settings.companion.sfx.desc":"戳他/被拍/落地时的短促啾哔声(合成音,低音量)","settings.companion.pet":"桌宠模式","settings.companion.pet.desc":"伴学伙伴在应用外常驻桌面:透明置顶、慢慢巡游,点他仍可互动。开启后应用内的伙伴会休息,避免双影。","settings.companion.form":"形象","companion.name":"小焰","companion.form.ember.name":"小焰","companion.form.ember.desc":"赤焰守护机——热情的原点,能量核随今日 XP 充能","companion.form.frost.name":"霜绒","companion.form.frost.desc":"冰晶守望机——冷静沉稳,六瓣冰晶核逐瓣点亮","companion.form.moss.name":"苔芽","companion.form.moss.desc":"自然精灵机——温软陪伴,胸口种子随进度发芽张叶","companion.form.astro.name":"星尘","companion.form.astro.desc":"星空观测机——夜空屏面,能量核是随 XP 变圆的月相","companion.form.ink.name":"墨墨","companion.form.ink.desc":"砚上学者机——书房静气,墨池水位就是今日进度","companion.form.custom.name":"自定义","companion.form.custom.desc":"自创伙伴——你的角色站在悬浮盘上,导入立绘即可上场","companion.form.shimeji.name":"Shimeji","companion.form.shimeji.desc":"导入的 Shimeji 伙伴——自带全套动作,在窗口里走动、发呆、被你拎起来","companion.pick.custom.title":"选择自创伙伴","companion.pick.shimeji.title":"选择 Shimeji 伙伴","companion.pick.empty.custom":"还没有自创伙伴——点 + 新建一个","companion.pick.empty.shimeji":"还没有导入的 Shimeji 包——点 + 导入一个","companion.create.title":"新建伴学伙伴","companion.create.self.name":"自创伙伴","companion.create.self.hover":"上传一张角色立绘,AI 切分部件、穿上机械飞行平台;口型/打字/指向全都有","companion.create.shimeji.name":"Shimeji 伙伴","companion.create.shimeji.hover":"导入现成的 Shimeji 伙伴包(zip),自带全套帧动画动作;社区有海量角色包","companion.create.hint":"之后随时可以再点 + 新增,形象卡都排在下方","settings.shimeji.dialog.title":"导入 Shimeji 伙伴包","settings.shimeji.block":"Shimeji 伙伴包","settings.shimeji.desc":"导入 Shimeji 角色包(zip)作为伴学形象;激活后在形象选择器选 Shimeji 上岗","settings.shimeji.import":"导入 zip","settings.shimeji.importing":"解析中…","settings.shimeji.activate":"激活","settings.shimeji.active":"使用中","settings.shimeji.delete":"删除包","settings.shimeji.deleteConfirm":"删除 Shimeji 包「{name}」?","settings.shimeji.pick.title":"这个包里有多个角色,选择要导入的:","settings.shimeji.pick.confirm":"导入所选({count})","settings.shimeji.guide":"没有现成角色?下面这些社区站有大量免费包,下载 zip 后拖进来。","companion.custom.title":"自创伙伴包","companion.custom.import":"导入立绘 PNG","companion.custom.apply":"应用为我的伴学","companion.custom.delete":"删除包","companion.custom.cutDone":"切分完成","companion.custom.routeVision":"识图精切","companion.custom.routeGeometric":"几何切分","companion.custom.routeL1":"贴纸档(整图)","companion.custom.applied":"已应用——伴学伙伴已切换为你的自创伙伴","companion.custom.deleted":"已删除","companion.custom.locating":"识图模型定位部件中… 首次较慢","companion.custom.applying":"正在应用包…","companion.custom.visionFallback":"识图不可用,已降级为单件贴纸(自动抠掉背景)","companion.custom.fail":"失败","companion.bots.add":"新建","companion.bots.veh":"换载具","companion.veh.silver":"银灰","companion.bots.deleteConfirm":"删除这个自创伙伴?删除后无法恢复。","companion.wizard.copyFail":"复制失败,请手动全选 Prompt 复制","companion.wizard.title":"制作我的伴学伙伴","companion.wizard.s1":"① 准备角色原图","companion.wizard.s1body":"找一张要变成伴学的角色图——游戏、动漫、自己画的都行。正面、单人、角色完整清晰的图效果最好。这张图不会上传给 LookatStudy,只用在下一步的生成网站里。","companion.wizard.s2":"② 去免费生成站做出 Q 版立绘","companion.wizard.s2body":"打开下面的生成站(豆包 / 即梦,都免费):上传角色原图 → 粘贴下面的 Prompt → 发送 → 下载生成的竖版 2:3 PNG。","companion.wizard.s2doubao":"打开豆包","companion.wizard.s2jimeng":"打开即梦","companion.wizard.s2chatgpt":"打开 ChatGPT","companion.wizard.copy":"一键复制 Prompt","companion.wizard.copied":"已复制,去生成站粘贴","companion.wizard.s3":"③ 选载具、导入生成图并命名","companion.wizard.vehicle":"载具风格(悬浮小平台)","companion.wizard.pick":"选择生成的 PNG","companion.wizard.namePh":"给自创伙伴起个名字","companion.wizard.save":"保存并使用","companion.wizard.prompt":`生成图片:任务:参考图中的角色,转成 Q 版(chibi)A-pose 立绘设定图。参考图是角色身份的唯一依据:姿势和构图以本提示词为准,身份特征全部跟参考图一致。
429
+ 角色锁定(以下特征必须与参考图完全一致,只允许随 Q 版画风等比简化,不得改动、不得省略):
430
+ 1. 发型发色:发型轮廓、刘海方向、发色、发饰
431
+ 2. 五官:瞳色、瞳形、眉形、默认表情
432
+ 3. 服装:款式、颜色、图案、层次
433
+ 4. 标志性配饰:眼镜、帽子、耳饰、随身物件等
434
+ 5. 整体配色:主色辅色的比例关系不变
435
+ Q 版规则(唯一允许的改变就是头身比与画风):二头身——全身恰好 2 个头高,头部占一半;头大身小,手脚短圆;五官简化集中在头部下沿,但服装的标志性细节保留。
436
+ 姿势:标准 A-pose——正面朝前直立;双臂从肩部向斜下方自然张开约 45°,从肩到指尖完整可见;双臂不接触身体、不叉腰、不贴腿,手指自然张开;脖颈清晰可见,不被衣领、长发或围巾遮挡;双腿站直自然分开,双脚完整着地;全身完整入镜,角色居中,头顶、手指、脚底到画布四边都留出约 5% 空隙。
437
+ 背景:整个画面铺满单一纯色抠像绿(约 #00B140);仅当角色身上有绿色部位时改用品红色;画面无渐变、无暗角。
438
+ 负面清单:无文字、水印、地面、阴影、辅助线、边框;没有披风、翅膀、坐骑等横跨身体两侧的部件;只有这一个角色,无第二人物或漂浮部件。
439
+ 线条与上色:角色轮廓线清晰闭合,色块干净、平涂上色。
440
+ 输出:纵向 2:3 画幅,最高可用分辨率。`,"companion.greet.1":"我在呢,继续!","companion.greet.2":"这节快拿下了!","companion.greet.3":"要我再讲一遍吗?","companion.greet.4":"深呼吸,再来一次。","settings.multimodal.current_model":"当前主模型:{model}","settings.multimodal.not_selected":"(未选)","settings.multimodal.hint_custom":"自定义 provider — 视觉能力未知。如不支持看图,在下方覆盖一个 vision 模型。","settings.multimodal.hint_preset":"如当前模型不支持 vision,可在下方配置专门的 vision 模型。常见:GLM-4V / GPT-4o / Claude 3.5 / Gemini。","settings.multimodal.override_title":"Vision 模型覆盖(可选 — 留空则复用主模型)","settings.multimodal.override_bridge_hint":"主模型不支持看图时,聊天中上传的图片会先由该模型转译成文字描述,再交给主模型解读(图像转译桥)。","settings.multimodal.legacy_preset":"旧配置(预设 {label})仍生效;可停止覆盖或改用自定义。","settings.multimodal.replace_custom":"更换","settings.multimodal.stop_override":"停止覆盖","settings.multimodal.vision_capable":"vision","settings.multimodal.test_override":"测试模型","settings.mathvision.toggle":"PDF 公式视觉转写(实验)","settings.mathvision.desc":"导入 PDF 时检测公式密集页,整页渲染成图交给上面的看图模型转成 LaTeX。需先配好看图模型,按页消耗额度;未开启或失败时按普通文本层导入。","settings.saved_text":"已保存","settings.key.configured":"已配置","settings.custom.test_label":"(测试)","settings.proto.openai":"OpenAI 兼容","chat.empty.overview":"这是这一课的概览","chat.empty.summary.title":"本课摘要","chat.empty.summary.none":"暂无摘要,点开始学习让 AI 帮你了解这一课","chat.empty.start":"开始学习","chat.empty.greeting":"👋 准备好了吗?这一课我们慢慢来。","chat.empty.keyless.title":"内容已在右侧,先读一读","chat.empty.keyless.desc":"配置好 AI 模型,就能和我对练、做练习、追踪掌握度。","chat.empty.keyless.btn":"去配置 AI 模型","chat.empty.no_node.title":"从左侧地图选一个节点","chat.empty.no_node.desc":"点击圆球节点开始学习。绿色=可学,金色=已掌握,紫色=章节考试","chat.scroll.bottom":"回到底部","chat.speech.speak":"朗读这条消息","chat.speech.stop":"停止朗读","chat.speech.progress":"{n}/{total} 句","chat.speech.model_missing":"语音模型还没下载。到 设置 → 语音能力 下载后即可朗读。","chat.speech.engine_unavailable":"语音引擎未就位。桌面版开箱可用;Termux 端重跑一行安装命令即可补装(约 12MB)。","chat.speech.dictation":"语音输入","chat.speech.hold_to_talk":"按住说话","chat.speech.release_to_stop":"松开,结束录音","chat.speech.recording_hint":"正在录音,松开结束","chat.speech.rerecord":"取消重录","chat.speech.retry":"重试","chat.speech.back_to_keyboard":"切回键盘输入","chat.speech.keyboard":"键盘","chat.speech.custom_provider_missing":"自定义语音 provider 不存在或已删除,到 设置 → 语音模型 重新配置。","chat.speech.no_speech":"没听到声音,请检查麦克风后重试。","chat.speech.transcribing":"转录中…","chat.speech.asr_failed":"转录失败,请重试。","chat.speech.groq_key_missing":"Groq 密钥未配置。到 设置 → 模型服务 配置 Groq,或改用本地引擎。","chat.speech.azure_stt_key_missing":"旧 Azure 听写配置缺少密钥。请在 设置 → 语音模型 改用自定义听写端点。","chat.speech.azure_stt_region_missing":"旧 Azure 听写配置缺少区域。请在 设置 → 语音模型 改用自定义听写端点。","chat.speech.asr_model_missing":"听写模型还没下载。到 设置 → 语音模型 下载 Whisper(本地离线),或改用自定义听写端点。","chat.speech.asr_start_fail":"麦克风启动失败,请检查系统权限。","chat.speech.asr_insecure_context":"浏览器只允许在安全上下文(https 或 127.0.0.1)使用麦克风。请用手机引导器打开本页,或给 serve 配置 --tls-cert/--tls-key 后改走 https 访问。","chat.speech.read_aloud_node":"朗读本课","chat.speech.azure_key_missing":"Azure 朗读缺少密钥。到 设置 → 语音能力 填写后使用。","chat.speech.azure_region_missing":"Azure 朗读缺少区域。到 设置 → 语音能力 填写后使用。","chat.speech.edge_failed":"在线朗读失败,且本地模型未就绪无法降级。稍后重试或改用本地引擎。","chat.speech.edge_disclosed":"朗读将文本发送至微软在线服务(Edge 免费通道)。想完全离线:设置 → 语音能力 → 本地离线。","settings.speech.tts_engine":"朗读引擎","settings.speech.engine.edge":"Edge 在线","settings.speech.engine.azure":"Azure","settings.speech.engine.local":"本地离线","settings.speech.engine.custom":"自定义","settings.speech.engine.system":"系统引擎","settings.speech.engine.system_note":"音色来自本机浏览器/系统的语音引擎,质量随设备而定(国产手机的厂商/讯飞引擎通常更自然)。本地播放、不联网;朗读时逐句高亮照常,伴学嘴型不可用。","settings.speech.engine.system_unavailable":"当前环境(WebView)不支持系统朗读","settings.speech.voice_auto":"自动(优先中文音色)","settings.speech.model.turbo_short":"Whisper Turbo(约 1GB)","settings.speech.model.small_short":"Whisper Small(约 360MB)","settings.speech.tts_title":"朗读","settings.speech.asr_title":"听写","settings.speech.custom_voice_ph":"如 alloy(留空用端点默认)","settings.speech.legacy":"旧配置,仍生效","settings.speech.key_saved":"密钥已存","settings.speech.confirm_del_custom":"删除后该档不可用,确认?","settings.speech.downloading":"下载中…","settings.speech.asr_engine.custom_note":"OpenAI 兼容转写端点;Groq 用户填 https://api.groq.com/openai/v1 + whisper-large-v3-turbo。","settings.speech.engine.edge_note":"微软 Edge 朗读通道:免费、无需密钥、音色为产品级;文本经在线服务合成。","settings.speech.voice":"音色","settings.speech.speed":"语速","settings.speech.asr_engine":"听写引擎","settings.speech.asr_engine.local":"本地离线","settings.speech.asr_engine.local_note":"Whisper 离线转写(自带标点,中文质量好);下载模型后完全离线,Turbo 约 1GB / Small 约 360MB。","settings.speech.asr_auto_stop":"静音后自动停止录音","settings.speech.asr_ux_note":"点输入框旁的麦克风进入语音模式:按住说话,松开后可修改识别文字再发送。","settings.speech.model.asr_turbo":"听写引擎 Whisper Turbo(约 1GB,推荐桌面)","settings.speech.model.asr_small":"听写引擎 Whisper Small(约 360MB,轻量)","settings.speech.license_mit":"MIT · 本地推理","settings.speech.model.tts":"朗读引擎(Kokoro,约 430MB)","settings.speech.state.absent":"未下载","settings.speech.state.ready":"已就绪","settings.speech.state.error":"出错","settings.speech.download":"下载","settings.speech.delete":"删除","settings.speech.license":"Apache-2.0 · 本地推理","chat.friction.trigger":"我卡住了","chat.friction.hint":"选一个最接近的感受(可选写一句原因),AI 会记住并据此调整讲解。","chat.friction.confused":"糊涂","chat.friction.blocked":"卡住","chat.friction.frustrated":"受挫","chat.friction.desc_placeholder":"具体卡在哪了?(可选)","chat.friction.cancel":"取消","chat.friction.submit":"记下","chat.friction.saved":"已记下,AI 会据此调整这一课的讲法","chat.mastered.toast":"👑 太棒了!你掌握了这一课","chat.note.add":"加笔记","chat.note.add.title":"把这段对话存到记录区","chat.reasoning.label":"思考过程","chat.reasoning.chars":"{n} 字","chat.proposal.title":"AI 提议","chat.proposal.fallback":"提议({tool})","chat.proposal.apply":"应用","chat.proposal.reject":"拒绝","chat.proposal.mastered.title":"AI 建议你已掌握这节课","chat.proposal.mastered.hint":"采纳后本课解锁皇冠、进入复习排期。","chat.proposal.confirm":"确认掌握","chat.proposal.later":"再练练","chat.proposal.applied":"已采纳 · 本课已掌握","chat.proposal.rejected":"已忽略,继续学习","chat.copy":"复制","chat.copied":"已复制","chat.tool.get_node_info":"读取节点信息","chat.tool.record_answer":"记录答题观测","chat.tool.mark_mastered":"标记掌握","chat.tool.show_concept_map":"生成概念图","chat.tool.generate_quiz":"出练习题","chat.tool.compare_table":"生成对比表","chat.tool.draw_diagram":"画流程图","chat.tool.show_code_walkthrough":"代码讲解","thread.empty.no_node":"未选节点","thread.empty.hint":"输入问题开始","thread.actions.label":"操作","thread.new.label":"新建会话","thread.streamingBadge":"AI 正在输出","thread.menu.rename":"重命名","thread.menu.archive":"归档","thread.delete.confirm":"删除会话「{name}」?消息也会一并删除。","notebook.empty.select_node":"从左侧地图选一个节点开始学习,讲解会显示在这里","notebook.empty.no_notes_message":"这一节还没有笔记。选中讲解文字「加笔记」,或问 AI「画个概念图」「出 3 道题」「做个对比表」","notebook.node_type.section":"章节","notebook.node_type.concept":"概念","notebook.node_type.lesson":"课时","notebook.content.loading":"正在加载这一节的讲解…","notebook.content.load_failed":"内容加载失败。","notebook.content.retry":"重试","notebook.content.render_failed":"这段内容渲染失败(可能翻译格式有问题)。","notebook.content.truncated":"…(截断)","notebook.content.retry_render":"重试渲染","notebook.content.empty":"这一节还没有讲解内容。问 AI 导师:「给我讲讲这一节」","notebook.images.heading":"插图({n})","notebook.quote.template":"关于这段内容「{text}」,我不太懂,请帮我解释:","notebook.quote.ask":"提问","notebook.quote.add_note":"加笔记","notebook.quote.save_note.title":"把选中文字存到记录区,带溯源跳转","notebook.quote.hint":"选中讲解文字点「加笔记」;AI 生成的概念图/对比表/练习卡会自动进「笔记」标签","notebook.source.label":"来源","notebook.source.jump_content":"跳到讲解原位","notebook.source.jump_chat":"跳到对话原位","notebook.zone.understand.subtitle":"AI 帮你梳理的知识结构","notebook.zone.understand.empty_hint":"问 AI「画个概念图」「做个对比表」梳理这一节","notebook.zone.note.subtitle":"你的画线,点击可跳回原位","notebook.zone.note.empty_hint":"选中讲解或对话的文字,点「加笔记」存到这里","notebook.zone.practice.subtitle_empty":"做题检验掌握,可重做","notebook.zone.practice.subtitle_stats":"{n} 题 · 上次答对 {c} · 答错 {w}","notebook.zone.practice.empty_hint":"问 AI「出 3 道题考考我」,题目会自动进这里","notebook.note.comment.ph_new":"写下你对这段画线的注释…","notebook.note.comment.ph_edit":"编辑注释…(清空保存即可删除)","notebook.action.save":"保存","notebook.action.cancel":"取消","notebook.note.edit_comment":"编辑注释","notebook.note.add_comment":"加注释","notebook.note.pinned":"已置顶","notebook.note.pin":"置顶","notebook.note.unpin":"取消置顶","notebook.note.delete":"删除","notebook.quiz.last_correct":"上次答对","notebook.quiz.last_wrong":"上次答错","notebook.artifact.broken":"产物数据损坏","notebook.asset.loading":"加载中…","exam.loading":"正在生成章节考试题…","exam.errorTitle":"考试加载失败","exam.errorEmpty":"题目生成失败,请稍后重试","exam.reload":"重新加载","exam.question.label":"第 {n} 题","exam.next":"下一题","exam.submit":"提交考试","exam.accuracy":"正确率 {n}%","exam.stars.congrats":"恭喜,获得 {n} 星!","exam.stars.thisAndBest":"本次 {n} 星 · 历史最佳 {m} 星","exam.stars.failed":"未达 60%,再接再厉","exam.review.title":"逐题回顾","exam.review.questionFallback":"(题目 {n})","exam.review.yourAnswer":"你的答案:","exam.review.correctAnswer":"正确:","exam.review.unanswered":"(未答)","exam.retry":"重新考试(题目已缓存)","exam.generating.title":"正在生成章节考试题…","exam.generating.stage":"AI 正在按本章知识点逐批出题","exam.generating.kcProgress":"已覆盖 {done} / {total} 个知识点","exam.generating.preparing":"准备中…","exam.generating.canLeave":"可以离开本页,生成会在后台继续;完成后会通知你。","exam.failed.retry":"重新生成","exam.ready.title":"考试已生成","exam.ready.meta":"{q} 题 · 覆盖 {kc} 个知识点 · 预计 {min} 分钟","exam.ready.toast":"「{title}」的考试题已生成,随时可以开考","update.available":"发现新版本 {version},建议更新","update.download":"去下载","exam.start":"开始考试","exam.retryExam":"重新考试","exam.regenerate":"重新出题","exam.regenerate.confirmMsg":"重新出题会丢弃当前题库,并让 AI 按本章知识点重新出一批(历史成绩保留)。","exam.submitting":"正在判分…","exam.q.progress":"第 {i} / {n} 题","exam.q.next":"下一题","exam.q.submit":"提交考试","exam.terminated.banner":"本场考试因中途离开被终止,未答的题按答错计分。","exam.result.score":"{correct} / {total} 题正确","exam.result.accuracy":"正确率 {pct}%","exam.result.best":"历史最好:{stars} 星","exam.result.attempts":"已考 {n} 次","exam.result.kcBreakdown":"按知识点","exam.result.weakKc":"薄弱 · 建议复习","exam.result.correctLabel":"答对","exam.result.unanswered":"未答","exam.result.yourAnswer":"你的答案:","exam.result.correctAnswer":"正确答案:","exam.result.review":"逐题回顾","exam.leave.title":"离开将终止考试","exam.leave.message":"未答的题将按答错计分,本场成绩会被记录。确定要离开吗?","exam.leave.confirm":"终止并离开","exam.leave.cancel":"继续考试","error.renderFailed":"这部分内容渲染失败(可能格式有问题)。","error.retry":"重试","artifact.unknownHeader":"产物(未识别类型)","artifact.zoomOut":"缩小","artifact.zoomReset":"重置缩放","artifact.zoomIn":"放大","artifact.canvas.fit":"适屏","artifact.viewer.open":"放大查看","artifact.viewer.hint":"双指缩放 · 单指拖动 · Ctrl+滚轮","artifact.conceptmap.stats":"{nodes} 个概念 · {edges} 个关系 · Ctrl+滚轮缩放 · 拖动平移","artifact.codewalk.sectionLabel":"逐段讲解(点击定位代码)","artifact.codewalk.lineSingle":"第 {n} 行","artifact.codewalk.lineRange":"第 {a}-{b} 行","artifact.diagram.flowchart":"流程图","artifact.diagram.sequence":"时序图","artifact.diagram.state":"状态图","common.close":"关闭","lesson.next.title":"本课完成,皇冠到手!","lesson.next.guide":"下一课","lesson.next.button":"开始下一课","lesson.next.terminal":"这门课全部学完了——去复习巩固,或导入下一门","artifact.mermaid.inlineTitle":"结构图示","artifact.mermaid.openLive":"在 mermaid.live 打开(可编辑)","artifact.mermaid.rendering":"渲染图中…","artifact.mermaid.renderFailed":"渲染失败,显示源码(可复制到 mermaid.live 查看)","artifact.mermaid.repairing":"图有语法问题,正在自动修复…","artifact.mermaid.errorPrefix":"错误: {msg}","artifact.mermaid.hint":"Ctrl+滚轮缩放 · 拖动平移查看","quiz.questionProgress":"第 {cur}/{total} 题","quiz.answeredCorrect":"已答对 {n}","quiz.correct":"答对了","quiz.wrong":"答错了","quiz.finish":"完成练习","quiz.scoreSummary":"{correct}/{total} 答对","quiz.hook.label":"📊 答题完成:{{correct}}/{{total}}","quiz.hook.finish":"完成答题","quiz.hook.sent":"成绩单已交给导师,等待分析…","quiz.hook.message":`我刚做完了答题卡{{title}},成绩 {{correct}}/{{total}}。下面是逐题情况:
441
+ 请根据我的表现决定下一步:答错的题讲清为什么错和正确思路;全对的话判断我是否可以进入下一部分。不要重新出同一组题,也不要只说一句做得好。`,"quiz.hook.lineOk":"✅ 第{{n}}题「{{prompt}}」:答对","quiz.hook.lineWrong":"❌ 第{{n}}题「{{prompt}}」:我选了「{{chosen}}」,正确答案是「{{answer}}」","quiz.allCorrectHint":"全部答对,掌握度已提议更新","quiz.tryAgainHint":"再练一组巩固一下","quiz.action.nextPrompt":"接下来可以:","quiz.action.explainWrong":"讲讲我答错的","quiz.action.retry":"再来一组","quiz.action.goDeeper":"深入讲讲原理","quiz.action.markMastered":"确认我掌握了","quiz.action.nextTopic":"下一个知识点","guess.header":"来猜一个","guess.pickedPrefix":"我猜:","guess.waitReveal":"已猜,等 AI 揭晓 ⋯","import.deleted":"已删除:{title}","exercise.title":"📝 练习","exercise.generate":"出一道练习","exercise.submit":"提交答案","exercise.next":"下一题 →","exercise.correct":"✅ 答对了!","exercise.wrong":"❌ 答错了","exercise.types.mcq":"选择题","exercise.types.fill_blank":"填空题","exercise.types.true_false":"判断题","dashboard.title":"学习仪表盘","dashboard.stat.streak":"连续天数","dashboard.stat.due":"今日待复习","dashboard.stat.mastery":"整体掌握度","dashboard.review":"去复习","dashboard.cleared":"已清空","dashboard.export.md":"📄 导出报告","dashboard.export.json":"导出 JSON","dashboard.section_mastery":"按章节掌握度","dashboard.mini.sections":"章节掌握度","dashboard.mini.struggle":"你的薄弱点(点开重学)","import.title":"导入课程","import.url":"GitHub URL","import.markdown":"粘贴 Markdown","import.btn":"导入","import.md_btn":"生成课程","streak.days":"天","streak.title":"连续学习 {n} 天 · 最长 {m} 天","streak.freeze.title":"剩余冻结 {n} 个:漏签一天可自动保住连击"},en:{"action.close":"Close","action.delete":"Delete","action.undo":"Undo","action.confirm":"Confirm","action.cancel":"Cancel","header.toggleLeft":"Toggle left pane (Ctrl+B)","header.toggleRight":"Toggle right pane","header.font.smaller":"Decrease font size","header.font.larger":"Increase font size","header.settings":"Settings (Ctrl+S)","header.xp":"XP","header.theme.dark":"Switch to light","header.theme.light":"Switch to dark","map.tab.map":"Course Map","map.tab.import":"Import","map.course.none":"No course selected","map.course.switch":"Switch course","map.review.label":"Review","map.search.label":"Search","map.search.placeholder":"Search chapters, lessons or content…","map.search.close":"Close","map.search.clear":"Clear","map.search.noResults":"No results","map.search.contentGroup":"Content matches","chat.action.startLearning":"Start learning “{title}”","chat.action.startLearningPrompt":`I want to start learning “{title}”, but I'm low on energy right now — don't lecture me with concepts and don't quiz me with scored questions. Open like this instead:
442
+ 1. First hook me with a sentence or two of prose (counter-intuitive, or tied to daily life — make me curious);
443
+ 2. Then call the pose_guess tool with a small two-option guess (just for fun, not a test);
444
+ 3. I'll pick an option and guess; in your NEXT turn, reveal the answer and teach the one core idea of this lesson.
445
+ Iron rules: no lecture to start, no generate_quiz scored questions, no scoring. Hooking me is the only goal.`,"starter.go-deeper.label":"Go deeper","starter.go-deeper.hint":"Unpack the concept one level down","starter.go-deeper.message":"Go deeper on “{title}” — expand the structure, the details, and the easy-to-miss edge cases of the core point we just uncovered.","starter.give-example.label":"Give an example","starter.give-example.hint":"Make it concrete with a real example","starter.give-example.message":"Give me a concrete example or use case for “{title}” so I can understand it more tangibly.","starter.quiz-me.label":"Quiz me","starter.quiz-me.hint":"Retrieve and apply (correct answers raise mastery)","starter.quiz-me.message":"Quiz me with one applied question about “{title}” to check whether I really get it — judge my answer when I respond.","starter.confused.label":"I'm lost","starter.confused.hint":"Tell the AI where you're stuck (it takes notes)","starter.confused.message":"I'm fuzzy on part of “{title}” — help me untangle it, and start by asking which part isn't clear.","map.world.study":"Learn","map.world.practice":"Practice","pane.switcher":"Switch view","pane.map":"Course","pane.chat":"Tutor","pane.notes":"Blackboard","pane.resizeTooltip":"Drag to resize, double-click to reset","pane.resizeRailAria":"Resize course pane width","pane.resizeChatAria":"Resize tutor pane width","map.streaming.notice":"AI is responding in the background. Feel free to switch nodes.","map.generating":"Generating course path…","map.empty.cta.title":"Start your first course","map.empty.cta.desc":"Import a GitHub learning repo to auto-generate a skill path","map.empty.cta.btn":"Click to import →","map.empty.practice":"No practice content for this course","node.locked.chapterHint":"(unlocks after completing all lessons in this chapter)","node.due.hint":"(due for review)","import.empty":"No courses yet. Import your first one below.","import.cta":"Import New Course","import.tab.url":"URL","import.tab.md":"MD","import.tab.folder":"Folder","import.url.placeholder":"GitHub repo / web article / arXiv paper link","import.url.desc":"Paste any link — GitHub repo / arXiv paper / web article / Bilibili·YouTube video (transcribed into a course; multi-part Bilibili videos import the whole season without ?p=; more sites need yt-dlp installed).","import.btn.url":"Import","import.btn.url.busy":"Importing…","import.placeholder.name":"Course name (optional)","import.placeholder.md":"Paste any long text or Markdown… (auto-split when there are no headings)","import.btn.md":"Import as Course","import.btn.md.busy":"Generating…","import.folder.desc":"Recursively scans .txt/.md/.html/.pdf. For downloaded course material packs.","import.btn.folder":"Select Folder","import.tab.epub":"eBook","import.epub.desc":"EPUB books become one lesson per chapter (chapter order from the book's spine & TOC).","import.btn.epub":"Pick an EPUB file","import.tab.audio":"Audio","import.audio.desc":"Audio (wav/mp3/m4a/flac) or local video (mp4/m4v/mov) transcribed locally into a course; multi-select = multiple episodes. Whisper model (~1 GB) downloads automatically on first use.","import.btn.audio":"Pick audio files","import.tab.pack":"Pack","import.btn.pack":"Pick a course pack file","import.pack.desc":"A course pack is a shared import-plan snapshot — zero AI calls, classification and structure design are instant. Reused as-is when the GitHub repo matches; if the repo moved on, lessons pointing at removed files are dropped automatically.","import.export":"Export","import.folder.pathPlaceholder":"Server-side folder path (e.g. /storage/emulated/0/Download/my-course)","import.folder.pathRequired":"Enter the server-side folder path first","import.pack.export":"Export course pack (share for zero-AI import)","import.pack.exported":"Course pack exported: {path}","import.error.resume":"Retry from checkpoint (skips finished AI steps)","import.success.reused":"reused saved plan, zero AI calls","import.btn.folder.busy":"Processing…","import.delete":"Delete","import.delete.confirm":"All progress and exercises will be erased. This cannot be undone.","import.delete.current":"Delete current course","course.empty.title":"Pick a course to start learning","course.empty.desc":"Choose an imported course from the Import panel on the left, or import a new one.","boot.welcome.title":"Hey — I'm your study companion","boot.welcome.desc":"I live here, and I'll be learning alongside you. Got 30 seconds to get acquainted?","boot.welcome.forms":"You can swap me out later — several forms live in Settings, and you can import your own custom companion or a Shimeji companion.","boot.key.title":"First, plug in the teacher","boot.key.desc":"I need an AI model to actually start teaching — enter your API Key in Settings (it never leaves this machine).","boot.profile_quiz.title":"Let's get to know you","boot.profile_quiz.desc":"A few quick questions, answer as many as you like — they only tune the teaching to your taste.","boot.pick.title":"One course to go","boot.pick.desc":"Pick or import a course on the left, and we're off.","boot.action.hello":"Hi there","boot.action.go_settings":"Set up the key","boot.action.later":"Skip for now","boot.action.wizard_next":"Continue","boot.action.done_quiz":"Done — continue","boot.action.skip_quiz":"Skip these — pick a course first","boot.action.pick_course":"Choose a course","boot.action.start_import":"Start importing","boot.action.companion":"Change companion","boot.action.import_course":"Import a course","boot.action.resume":"Pick up where we left off","boot.action.review":"Go review","boot.action.review_n":"Clear {n} review cards first","boot.action.keep_flame":"Keep the flame","boot.action.continue_exam":"Resume the exam","boot.action.finish_it":"Finish this lesson","boot.action.retry":"Try a different angle","boot.action.edit_profile":"Fill in the profile","boot.action.view_profile":"View profile","boot.action.meet_me":"Introduce yourself","boot.resume.title":"Last time: {course} {node}","boot.resume.desc":"Your progress, conversations and notes are all where you left them.","boot.resume.due":"{n} review cards are due.","boot.review.title":"{n} review cards waiting","boot.review.desc":"Spaced repetition pays out today — clear the deck before new material?","boot.streak.title":"The flame dies in {hours} hours","boot.streak.desc":"A review or any lesson today keeps it burning.","boot.exam.title":"Unfinished exam: {node}","boot.exam.desc":"The paper is still on the desk — go finish it.","boot.mastery.title":"{node} is one step from done","boot.mastery.desc":"Mastery is already high; a quick self-test closes it out.","boot.friction.title":"You got stuck at {node}","boot.friction.desc":"Try a different explanation? Sticking points don't vanish on their own.","boot.ready.title":"{name}What shall we learn today?","boot.ready.profile_done":"The tutor already knows you — the profile shapes its teaching style.","boot.ready.profile_empty":"The tutor doesn't know you yet — 30 seconds of chat makes the teaching fit better.","boot.ready.has_courses":"Your courses are on the left.","boot.ready.desc":"Pick or import a course on the left to begin.","boot.ready.key_hint":"No API Key yet — the tutor's brain is still offline (drop one into Settings and it wakes up).","boot.welcome_back":"{name}Welcome back!","boot.card.name.label":"What should I call you?","boot.card.name.placeholder":"Nickname (optional)","boot.card.mbti.label":"Do you know your MBTI?","boot.card.mbti.skip":"Skip","boot.card.mbti.next":"Noted — next","boot.card.motive.label":"Honest answer — why are you here to learn?","boot.card.motive.named":"Honest answer, {name} — why are you here to learn?","boot.card.motive.next":"Next","boot.card.interests.label":"What are you into lately? (optional, separate with commas)","boot.card.interests.placeholder":"e.g. cooking, basketball, space…","boot.card.free.label":"Anything to tell the tutor? (optional)","boot.card.free.placeholder":"e.g. I love cross-domain analogies, spare me the dry definitions…","boot.card.free.next":"One last thing","boot.card.quiz.label":"Come on — spar a round","boot.card.quiz.reveal":"Answer","boot.card.quiz.next":"Go pick a course","boot.profile.field.name":"Name","boot.profile.field.mbti":"MBTI","boot.profile.field.motive":"Learning motive","boot.profile.field.style":"Style","boot.profile.field.free":"Note","boot.profile.field.unset":"not set","boot.profile.save":"Save","boot.profile.cancel":"Cancel","boot.recap.title":"Your learning recap","boot.recap.total_xp":"Total XP","boot.recap.mastered":"Lessons mastered","boot.recap.streak_days":"Day streak","boot.recap.recent":"Recently studying","boot.recap.tips_title":"Study tip","chat.profile_sent":"Profile suggestion sent to your profile window — review it anytime.","profile.title":"Your profile","profile.header.open":"Open your profile","profile.section.declared":"What I declared","profile.section.suggestions":"AI suggestions","profile.section.memory":"What AI remembers","profile.field.interests":"Interests","profile.style.start":"Starting point","profile.style.interaction":"Interaction density","profile.style.feedback":"Feedback style","profile.style.pacing":"Pacing","profile.suggest.title":'Based on your conversations, AI suggests changing your {field} to "{value}".',"profile.suggest.reason":"Reason: ","profile.suggest.apply":"Switch to {value}","profile.suggest.keep":"Keep as is","profile.suggest.empty":"No suggestions yet — when AI notices a learning pattern that contradicts your profile, it will propose a change here.","profile.suggest.history":"History ({n})","profile.memory.off.title":"AI memory is off","profile.memory.off.desc":"When enabled, AI periodically distills memories from your conversations and answers (costs a small number of AI calls) to teach you better. You can view, correct, or delete them here anytime.","profile.memory.enable":"Enable memory","profile.memory.global":"Overall impression","profile.memory.pattern":"Cross-course sticking points","profile.memory.nodes":"Per-lesson memories","profile.memory.empty":"(none)","profile.memory.delete":"Delete this memory","profile.memory.confirm":"AI will no longer remember this. Delete?","profile.memory.deleted":"Deleted","profile.saved":"Profile saved","profile.save_failed":"Save failed — try again","profile.memory.more":"{n} more not shown","profile.memory.disclaimer":'Generated from AI history — treat as unverified. You can delete entries; corrections belong in "What I declared" above.',"import.success.md":"Generated","import.success.folder":"Imported","import.error.network":`
446
+
447
+ For restricted networks or private repos, use the Markdown method.`,"import.progress.elapsed":"{s}s elapsed","import.progress.title":"Importing course…","import.progress.starting":"Starting…","import.progress.note":"Import runs in the background — keep browsing other courses","import.progress.cancel":"Cancel import","import.cancelled":"Import cancelled","toast.threadCreateFailed":"Couldn't create — try again","toast.threadCreated":"New chat","toast.threadRenamed":"Renamed","toast.threadArchived":"Archived","toast.threadDeleted":"Deleted","toast.threadDefault":"New thread","toast.restored":"Restored","toast.noteSaved":"Added to notes","toast.noteDeleted":"Note deleted","toast.artifactSaved":"Saved to notebook","artifact.type.concept_map":"Concept Map","artifact.type.quiz":"Quiz","artifact.type.compare_table":"Comparison Table","artifact.type.diagram":"Diagram","artifact.type.code_walkthrough":"Code Walkthrough","artifact.type.unknown":"Artifact","command.placeholder":"Type a command or question… (↑↓ to select, Enter to confirm)","command.empty.node":"No matching commands","command.empty.nonode":"Select a node on the left first","command.footer.hint":"The AI tutor generates content based on your command","command.footer.keys":"↵ confirm · esc to close","command.group.node":"Current Node","command.group.mode":"Study Mode","command.group.nav":"Navigation","command.explain_simple":"Explain this section in plain words","command.quiz_3":"Give me 3 practice questions","command.concept_map":"Draw a concept map","command.compare_prev":"Compare with the previous section","command.socratic":"Switch to Socratic mode (guided questions)","command.exam_mode":"Switch to Exam prep mode","review.title":"Review","review.nudge":"📅 {n} review(s) due today — tap the Review entry in the map to consolidate","review.loading":"Checking what to review…","review.empty.title":"No reviews yet","review.empty.desc":"Complete some exercises and spaced-repetition reminders will appear here","review.due.count":"due","review.start":"Start Review","review.shuffle":"Shuffle (interleaved)","review.interleave":"Interleaved Review","review.reviewLesson":"Review","review.selectSection":"Select a section","review.dueIn":"due","review.noDueInSection":"No reviews in this section","review.srsHint":"Review Reminders","review.myProgress":"My Progress","review.overdueQuickHint":"Overdue items — click to review","review.quadrant.overdue":"Overdue","review.quadrant.short":"Short-term","review.quadrant.long":"Long-term","review.quadrant.inactive":"Inactive","review.quadrant.more":"more","review.tip":"Review uses the SM-2 spaced repetition algorithm. Overdue items first; long-term memory items have longer intervals. Capped at {n} items per session to avoid backlog overwhelm.","review.selfrated":"✓ Recorded. Mastery updated.","review.selfrate.title":"Done reviewing? Rate yourself","review.selfrate.again":"Forgot","review.selfrate.again.hint":"Review tomorrow","review.selfrate.remembered":"Recalled","review.selfrate.remembered.hint":"In a few days","review.selfrate.mastered":"Easy","review.selfrate.mastered.hint":"Much later","lang.original":"Original","error.checkReadyFailed":"Could not check readiness","notebook.tab.explain":"Explain","notebook.tab.notes":"Notes","notebook.tab.board":"Blackboard","notebook.board.empty":"When the tutor produces a concept map, diagram, comparison table, or code walkthrough in chat, the latest one is rendered here in full size.","notebook.zone.understand":"Understand","notebook.zone.note":"Notes","notebook.zone.practice":"Practice","notebook.empty.explain.title":"Pick a lesson to start","notebook.empty.explain.desc":"Select a lesson in the map on the left; its explanation shows here.","notebook.empty.notes.title":"No notes yet","notebook.empty.notes.desc":"Highlight text in the explanation, or have the AI generate a concept map / comparison table — it shows up here.","settings.group.ai":"Main Model","settings.group.speech":"Speech Models","settings.group.vision":"Vision Model","settings.group.appearance":"Appearance & Language","settings.group.data":"Data","settings.dsh.title":"Migrate progress from the dsh plugin","settings.dsh.desc":"Import courses, mastery, review schedule, exam stars, XP and streaks from dsh-plugin-lookatstudy. The database is backed up automatically; re-importing is safe, and an existing course with the same title and structure is written in place instead of being duplicated.","settings.dsh.detectFound":"Local plugin data detected (state v{v})","settings.dsh.detectNone":"No local dsh plugin data found — pick your state.json file below to import it.","settings.dsh.import":"Import","settings.dsh.pickFile":"Pick state.json to import","settings.dsh.importing":"Importing…","settings.dsh.done":"Imported: {courses} courses · {nodes} nodes · {progress} progress rows · {srs} reviews · XP +{xp}","settings.dsh.skipped":"{n} invalid course(s) skipped","settings.dsh.failed":"Import failed","settings.group.about":"About","settings.row.version":"Version","settings.version.hint":"Click the version to see what changed in this release.","settings.row.provider":"Provider","settings.row.theme":"Theme","settings.row.interface_lang":"Interface language","settings.row.import_lang":"Import preference","settings.custom.form_title":"Add custom provider","settings.footer.hint":"Main model changes need Save; everything else is instant.","settings.footer.save":"Save AI config","header.energy":"Today's energy","header.level.title":"Level (cumulative XP growth line — doesn't reset with daily energy)","settings.title":"Settings","view.tree":"Skill Tree","view.dashboard":"Dashboard","view.import":"Import Course","mode.chat":"💬 Chat","mode.exercise":"📝 Practice","mode.settings":"⚙️ Settings","chat.starter.hint":"💡 Pick one to start, or type your question","chat.no_key.title":"No AI model configured","chat.no_key.desc":"Configure a model to start AI tutoring and practice","chat.no_key.btn":"Configure Model","chat.input.placeholder":"Ask your AI tutor… (Enter to send)","chat.input.no_node":"Select a lesson on the left…","chat.send":"Send","chat.stop":"Stop","chat.clear":"Clear chat history","chat.selection.quote":"Ask about this","chat.soul.label":"Style:","chat.no_key.short":"AI model not configured","chat.no_key.cta":"Configure →","chat.attach.add":"Add image or file (paste / drag also works)","chat.attach.remove":"Remove {name}","chat.attach.tooMany":"Up to {n} attachments per message","chat.attach.tooLargeImage":"Image over 5MB: {name}","chat.attach.tooLargeText":"Text file over 256KB: {name}","chat.attach.unsupported":"Unsupported type: {name} (images and common text / code files)","chat.attach.visionUnsupported":"Current model can't see images — pick one with the eye icon in the model switcher, or set a vision model override in Settings → AI vision","chat.attach.bridgeChip":"Main model is text-only: images will be transcribed to text by {model} first","chat.attach.preview":"View {name}","chat.attach.textChip":"Text attachment, content sent with the message","chat.attach.imageOnlyText":"Please look at this image.","context.label":"Context","context.aria":"{p} of context used","context.approx":"~","context.system":"System prompt","context.node":"Lesson","context.learner":"Learner state","context.history":"History","context.draft":"Draft","context.unknownWindow":"model window unknown","model.picker.label":"Model","model.picker.manage":"Manage models & keys…","model.picker.vision":"Vision capable","model.picker.noneConfigured":"No provider key configured yet","effort.label":"Thinking effort","effort.auto.label":"Auto","effort.auto.desc":"Model default, no override","effort.fast.label":"Fast","effort.fast.desc":"Thinking off when possible — quicker, fewer tokens","effort.deep.label":"Deep","effort.deep.desc":"Thinking on when possible — extra steps for hard problems","effort.unsupported":"Current provider doesn't support effort switching","soul.direct":"Direct","soul.guide":"Guide","soul.practice":"Practice","soul.direct.desc":"Direct · for beginners or low energy. Explains clearly then checks, gives full worked examples — never makes you guess","soul.guide.desc":"Guide · when you have some footing and want to reason it out. No direct answers — guiding questions help you derive it","soul.practice.desc":"Practice · for hands-on learners. Each concept lands on a messy real-world problem; learn by doing and connect the dots","settings.provider":"AI Provider","settings.model":"Model","settings.apikey":"API Key","settings.test":"Test Connection","settings.testing":"Testing…","settings.save":"Save Settings","settings.saved":"✅ Saved","settings.daily_goal":"Daily Goal (XP)","settings.custom.add":"+ Add Custom Provider","settings.language":"Language","settings.add_custom":"Custom","settings.custom.label_ph":"Name","settings.custom.baseurl_ph":"Base URL (e.g. https://api.example.com/v1)","settings.custom.model_ph":"Model ID","settings.custom.new":"New custom","settings.custom.form_title_vision":"Configure vision model (custom provider)","settings.custom.model_ph_vision":"e.g. glm-4.6v / gpt-4o","settings.custom.form_title_tts":"Configure TTS provider (OpenAI-compatible /audio/speech)","settings.custom.model_ph_tts":"e.g. tts-1 / FunAudioLLM/CosyVoice2-0.5B","settings.custom.form_title_asr":"Configure dictation provider (OpenAI-compatible /audio/transcriptions)","settings.custom.model_ph_asr":"e.g. whisper-large-v3-turbo","settings.custom.apikey_ph":"API Key (optional)","settings.custom.save":"Save","settings.custom.windowLabel":"Context window (tokens)","settings.custom.windowPh":"e.g. 128000 or 128k (empty = unknown)","settings.custom.windowHint":"Max context of the current model, found in its official docs. The composer context meter only shows a percentage when this is set.","settings.custom.vision":"Supports vision (multimodal)","settings.custom.visionHint":"When checked, images are sent directly to the main model. Unchecked uses the vision bridge (configure a vision model in AI Vision section) or skips images.","settings.delete_custom":"Delete this custom provider","settings.delete_custom_confirm":'Delete custom provider "{name}"? This cannot be undone.',"settings.key.overwrite_ph":"Overwrite…","settings.key.paste_ph":"Paste key","settings.key.get":"Get key →","settings.refresh":"Refresh","settings.discovering":"Refreshing…","settings.discover_failed":"Refresh failed (network may be restricted)","settings.daily_goal.hint":"XP / day (+10 XP per correct answer)","settings.theme.auto":"System","settings.theme.light":"Light","settings.theme.dark":"Dark","settings.theme.following":"Following system: {mode}","settings.lang_pref.desc":"When importing a course, auto-pick the translation matching this preference. If the repo's source language already matches, the original is used; if no translation exists, the original is used as well.","settings.img_download":"Image download","settings.img_download.desc":"Auto-download images referenced in markdown/notebooks during import (on by default)","settings.multimodal.toggle":"AI vision (in chat)","settings.multimodal.toggle.desc":"When on, the AI can see and explain this lesson's images during chat — used for diagrams/charts/architecture (needs a vision model).","settings.group.memory":"Learner memory","settings.memory.toggle":"Let the AI remember me","settings.memory.toggle.desc":"When on, the AI remembers how you learn across sessions (preferences / stuck points / recurring confusions) and adapts over time. Auto-summarized when you earn a crown (clear a node); also manually triggerable. All memory stays local.","settings.group.companion":"Learning companion","settings.companion.toggle":"Learning companion","settings.companion.toggle.desc":"Your companion lives in the course map, notebook and chat: celebrates wins, lip-syncs read-alouds, and taps along with every keystroke. Five forms to switch between. Fully local.","settings.companion.sfx":"Pet sounds","settings.companion.sfx.desc":"Short chirps when poked/hit/landing (synthesized, low volume)","settings.companion.pet":"Desktop pet mode","settings.companion.pet.desc":"Keep the companion on your desktop outside the app: transparent, always on top, wandering slowly — still poke-able. The in-app buddy takes a rest so you never see double.","settings.companion.form":"Form","companion.name":"Ember","companion.form.ember.name":"Ember","companion.form.ember.desc":"Blazing guardian — the passionate original; core charges with today's XP","companion.form.frost.name":"Frost","companion.form.frost.desc":"Crystal watcher — calm and steady; the hex core lights petal by petal","companion.form.moss.name":"Moss","companion.form.moss.desc":"Nature spirit — gentle company; the seed sprouts as you progress","companion.form.astro.name":"Astro","companion.form.astro.desc":"Stargazer — night-sky visor; the core moon waxes with today's XP","companion.form.ink.name":"Ink","companion.form.ink.desc":"Inkstone scholar — quiet study vibes; the ink pool rises with your progress","companion.form.custom.name":"Puppet","companion.form.custom.desc":"Custom companion — import a character sheet and it rides the hover disc","companion.form.shimeji.name":"Shimeji","companion.form.shimeji.desc":"Imported Shimeji desktop pet — full move set, wandering idling and hanging out in your window","companion.pick.custom.title":"Pick a custom companion","companion.pick.shimeji.title":"Pick a Shimeji pet","companion.pick.empty.custom":"No custom companions yet — create one via +","companion.pick.empty.shimeji":"No Shimeji packs yet — import one via +","companion.create.title":"New companion","companion.create.self.name":"Custom build","companion.create.self.hover":"Upload one character art — AI cuts the parts and mounts it on the mech hover-deck, with lip-sync, typing and pointing built in","companion.create.shimeji.name":"Shimeji pet","companion.create.shimeji.hover":"Import a ready-made Shimeji pack (zip) with its full frame-animation action set — huge community libraries exist","companion.create.hint":"You can add more anytime via the + card; every pack gets its own card below","settings.shimeji.dialog.title":"Import a Shimeji pack","settings.shimeji.block":"Shimeji packs","settings.shimeji.desc":"Import a Shimeji character pack (zip) as your companion; activate it, then pick Shimeji in the form picker","settings.shimeji.import":"Import zip","settings.shimeji.importing":"Parsing…","settings.shimeji.activate":"Activate","settings.shimeji.active":"Active","settings.shimeji.delete":"Delete pack","settings.shimeji.deleteConfirm":'Delete Shimeji pack "{name}"?',"settings.shimeji.pick.title":"This pack has multiple characters, pick which to import:","settings.shimeji.pick.confirm":"Import selected ({count})","settings.shimeji.guide":"Need a character? The community sites below host tons of free packs. Download a zip and drop it here.","companion.custom.title":"Custom companion pack","companion.custom.import":"Import PNG sheet","companion.custom.apply":"Apply as my companion","companion.custom.delete":"Delete pack","companion.custom.cutDone":"Cut complete","companion.custom.routeVision":"vision cut","companion.custom.routeGeometric":"geometric cut","companion.custom.routeL1":"sticker tier (whole image)","companion.custom.applied":"Applied — your companion is now the custom one","companion.custom.deleted":"Deleted","companion.custom.locating":"Vision model locating parts… first run is slow","companion.custom.applying":"Applying pack…","companion.custom.visionFallback":"Vision unavailable, fell back to a single sticker (background auto-keyed)","companion.custom.fail":"Failed","companion.bots.add":"New","companion.bots.veh":"Change vehicle","companion.veh.silver":"Silver","companion.bots.deleteConfirm":"Delete this puppet? This cannot be undone.","companion.wizard.copyFail":"Copy failed — please select the prompt manually","companion.wizard.title":"Make my companion","companion.wizard.s1":"① Prepare the character image","companion.wizard.s1body":"Find an image of the character you want as your study buddy — a game, anime, or your own art. Front-facing, single character, clean and complete works best. It is not uploaded to LookatStudy; it is only used on the generation site in the next step.","companion.wizard.s2":"② Generate the chibi sheet on a free site","companion.wizard.s2body":"Open a generation site below (Doubao / Jimeng — both free): upload the character image → paste the Prompt below → send → download the portrait 2:3 PNG it creates.","companion.wizard.s2doubao":"Open Doubao","companion.wizard.s2jimeng":"Open Jimeng","companion.wizard.s2chatgpt":"Open ChatGPT","companion.wizard.copy":"Copy prompt","companion.wizard.copied":"Copied — paste it on the site","companion.wizard.s3":"③ Pick a vehicle, import and name it","companion.wizard.vehicle":"Vehicle style (hover platform)","companion.wizard.pick":"Choose the generated PNG","companion.wizard.namePh":"Name your puppet","companion.wizard.save":"Save & use","companion.wizard.prompt":`Image generation task: turn the character in the reference image into a Q-version (chibi) A-pose character sheet. The reference image is the only source of truth for the character's identity: pose and composition follow this prompt, identity features follow the reference image.
448
+ Character lock — the following must match the reference image exactly, only simplified proportionally with the chibi style; do not change or drop any:
449
+ 1. Hair: silhouette, bangs direction, hair color, hair accessories
450
+ 2. Face: eye color, eye shape, eyebrows, default expression
451
+ 3. Clothing: cut, colors, patterns, layers
452
+ 4. Signature accessories: glasses, hat, earrings, carried items
453
+ 5. Overall palette: primary/secondary color ratios unchanged
454
+ Chibi rules (the only allowed change): exactly two heads tall — the head is half of total height; big head, small body, short round limbs; simplified face in the lower half of the head; keep the clothing's signature details.
455
+ Pose: standard A-pose — facing forward, standing upright; arms spread naturally about 45 degrees downward from the shoulders, fully visible from shoulder to fingertips; arms must not touch the body, no hands on hips, fingers relaxed; neck clearly visible, not covered by collar, long hair or a scarf; legs straight and naturally apart, both feet flat on the ground; full body in frame and centered, with about a 5% margin between the character and every canvas edge.
456
+ Background: fill the entire canvas with one solid chroma-key green (about #00B140); use magenta only if the character has green body parts; no gradients, no vignette.
457
+ Negative: no text, watermark, ground, shadow, guide lines, or borders; no capes, wings, or mounts crossing the body; only this one character, no second figure or floating parts.
458
+ Line & color: clean closed outlines, flat clean colors.
459
+ Output: portrait 2:3, highest available resolution.`,"companion.greet.1":"I'm here — keep going!","companion.greet.2":"Almost got this one!","companion.greet.3":"Want me to explain again?","companion.greet.4":"Breathe. One more try.","settings.multimodal.current_model":"Current main model: {model}","settings.multimodal.not_selected":"(none)","settings.multimodal.hint_custom":"Custom provider — vision capability unknown. If it can't see images, override a vision model below.","settings.multimodal.hint_preset":"If the current model lacks vision, configure a dedicated vision model below. Common: GLM-4V / GPT-4o / Claude 3.5 / Gemini.","settings.multimodal.override_title":"Vision model override (optional — leave blank to reuse main model)","settings.multimodal.override_bridge_hint":"When the main model is text-only, images uploaded in chat are transcribed to text by this model before reaching the main model (image bridge).","settings.multimodal.legacy_preset":"Legacy config (preset {label}) still active; stop the override or switch to custom.","settings.multimodal.replace_custom":"Replace","settings.multimodal.stop_override":"Stop override","settings.multimodal.vision_capable":"vision","settings.multimodal.test_override":"Test model","settings.mathvision.toggle":"PDF math vision transcription (experimental)","settings.mathvision.desc":"When importing PDFs, math-dense pages are rendered to images and transcribed to LaTeX by the vision model configured above. Requires a vision model and spends quota per page; falls back to the plain text layer when off or on failure.","settings.saved_text":"Saved","settings.key.configured":"Configured","settings.custom.test_label":"(test)","settings.proto.openai":"OpenAI-compatible","chat.empty.overview":"Overview of this lesson","chat.empty.summary.title":"Lesson Summary","chat.empty.summary.none":"No summary yet — click Start to let the AI walk you through this lesson.","chat.empty.start":"Start Learning","chat.empty.greeting":"👋 Ready? Let's take this one step at a time.","chat.empty.keyless.title":"The lesson is on the right — give it a read","chat.empty.keyless.desc":"Configure an AI model to practice with me, do exercises, and track mastery.","chat.empty.keyless.btn":"Configure AI model","chat.empty.no_node.title":"Pick a node from the map on the left","chat.empty.no_node.desc":"Click a node to start learning. Green = available, Gold = mastered, Purple = chapter exam","chat.scroll.bottom":"Scroll to bottom","chat.speech.speak":"Read aloud","chat.speech.stop":"Stop reading","chat.speech.progress":"{n}/{total}","chat.speech.model_missing":"Speech model not downloaded yet. Get it in Settings → Speech.","chat.speech.engine_unavailable":"Speech engine not installed. Desktop has it built in; on Termux rerun the one-line install command to restore it (~12MB).","chat.speech.dictation":"Voice input","chat.speech.hold_to_talk":"Hold to talk","chat.speech.release_to_stop":"Release to finish","chat.speech.recording_hint":"Recording — release to finish","chat.speech.rerecord":"Discard & retry","chat.speech.retry":"Retry","chat.speech.back_to_keyboard":"Back to keyboard input","chat.speech.keyboard":"Keyboard","chat.speech.custom_provider_missing":"Custom speech provider missing or deleted. Reconfigure it in Settings → Speech Models.","chat.speech.no_speech":"No speech detected. Check your microphone and retry.","chat.speech.transcribing":"Transcribing…","chat.speech.asr_failed":"Transcription failed. Please retry.","chat.speech.groq_key_missing":"Groq key not configured. Set it in Settings → Model providers, or switch to the local engine.","chat.speech.azure_stt_key_missing":"Legacy Azure dictation key missing. Switch to a custom endpoint in Settings → Speech Models.","chat.speech.azure_stt_region_missing":"Legacy Azure dictation region missing. Switch to a custom endpoint in Settings → Speech Models.","chat.speech.asr_model_missing":"Dictation model not downloaded. Get Whisper in Settings → Speech Models (local offline), or use a custom endpoint.","chat.speech.asr_start_fail":"Microphone failed to start. Check system permissions.","chat.speech.asr_insecure_context":"Browsers only allow the microphone on secure contexts (https or 127.0.0.1). Open this page via the phone launcher, or enable serve TLS (--tls-cert/--tls-key) and access over https.","chat.speech.read_aloud_node":"Read this lesson","chat.speech.azure_key_missing":"Azure TTS key missing. Fill it in Settings → Speech.","chat.speech.azure_region_missing":"Azure TTS region missing. Fill it in Settings → Speech.","chat.speech.edge_failed":"Online synthesis failed and no local fallback model is ready. Retry later or switch to the local engine.","chat.speech.edge_disclosed":"Read-aloud sends text to Microsoft's online service (free Edge channel). For fully offline: Settings → Speech → Local.","settings.speech.tts_engine":"TTS engine","settings.speech.engine.edge":"Edge online","settings.speech.engine.azure":"Azure","settings.speech.engine.local":"Local offline","settings.speech.engine.custom":"Custom","settings.speech.engine.system":"System","settings.speech.engine.system_note":"Voices come from this device's browser/system speech engine; quality varies by device (vendor engines on Chinese Android phones are often more natural). Plays locally with no network; sentence highlighting still works while reading, companion mouth animation is unavailable.","settings.speech.engine.system_unavailable":"System speech is unavailable in this WebView","settings.speech.voice_auto":"Auto (prefer Chinese)","settings.speech.model.turbo_short":"Whisper Turbo (~1GB)","settings.speech.model.small_short":"Whisper Small (~360MB)","settings.speech.tts_title":"Read aloud","settings.speech.asr_title":"Dictation","settings.speech.custom_voice_ph":"e.g. alloy (empty = endpoint default)","settings.speech.legacy":"legacy, still active","settings.speech.key_saved":"key saved","settings.speech.confirm_del_custom":"Delete this provider? The tier becomes unusable.","settings.speech.downloading":"Downloading…","settings.speech.asr_engine.custom_note":"OpenAI-compatible transcription endpoint; for Groq use https://api.groq.com/openai/v1 + whisper-large-v3-turbo.","settings.speech.engine.edge_note":"Microsoft Edge read-aloud channel: free, no key, product-grade voices; text is synthesized online.","settings.speech.voice":"Voice","settings.speech.speed":"Speed","settings.speech.asr_engine":"Dictation engine","settings.speech.asr_engine.local":"Local offline","settings.speech.asr_engine.local_note":"Whisper offline transcription (native punctuation, strong Chinese); fully offline once the model is downloaded — Turbo ~1GB / Small ~360MB.","settings.speech.asr_auto_stop":"Auto-stop recording after silence","settings.speech.asr_ux_note":"Click the mic beside the input box to enter voice mode: hold to talk, then edit the recognized text before sending.","settings.speech.model.asr_turbo":"Dictation engine Whisper Turbo (~1GB, recommended on desktop)","settings.speech.model.asr_small":"Dictation engine Whisper Small (~360MB, lightweight)","settings.speech.license_mit":"MIT · local inference","settings.speech.model.tts":"Read-aloud engine (Kokoro, ~430MB)","settings.speech.state.absent":"Not downloaded","settings.speech.state.ready":"Ready","settings.speech.state.error":"Error","settings.speech.download":"Download","settings.speech.delete":"Delete","settings.speech.license":"Apache-2.0 · local inference","chat.friction.trigger":"I'm stuck","chat.friction.hint":"Pick what fits (optional one-liner). The AI will remember and adapt how it teaches this.","chat.friction.confused":"Confused","chat.friction.blocked":"Blocked","chat.friction.frustrated":"Frustrated","chat.friction.desc_placeholder":"Where exactly? (optional)","chat.friction.cancel":"Cancel","chat.friction.submit":"Log it","chat.friction.saved":"Logged — the AI will adapt how it teaches this lesson","chat.mastered.toast":"👑 You mastered this lesson!","chat.note.add":"Add note","chat.note.add.title":"Save this message to your notes","chat.reasoning.label":"Reasoning","chat.reasoning.chars":"{n} chars","chat.proposal.title":"AI Proposal","chat.proposal.fallback":"Proposal ({tool})","chat.proposal.apply":"Apply","chat.proposal.reject":"Reject","chat.proposal.mastered.title":"AI suggests you've mastered this lesson","chat.proposal.mastered.hint":"Accept to unlock the crown and schedule reviews.","chat.proposal.confirm":"Confirm mastery","chat.proposal.later":"Keep practicing","chat.proposal.applied":"Accepted · lesson mastered","chat.proposal.rejected":"Dismissed, keep learning","chat.copy":"Copy","chat.copied":"Copied","chat.tool.get_node_info":"Read node info","chat.tool.record_answer":"Record answer","chat.tool.mark_mastered":"Mark mastered","chat.tool.show_concept_map":"Generate concept map","chat.tool.generate_quiz":"Generate quiz","chat.tool.compare_table":"Generate comparison table","chat.tool.draw_diagram":"Draw diagram","chat.tool.show_code_walkthrough":"Code walkthrough","thread.empty.no_node":"No node selected","thread.empty.hint":"Type to start","thread.actions.label":"Actions","thread.new.label":"New thread","thread.streamingBadge":"AI is responding","thread.menu.rename":"Rename","thread.menu.archive":"Archive","thread.delete.confirm":'Delete thread "{name}"? Messages will also be deleted.',"notebook.empty.select_node":"Pick a node from the map on the left — its explanation shows here.","notebook.empty.no_notes_message":'No notes for this lesson yet. Select explanation text to "Add note", or ask the AI to "draw a concept map", "generate 3 questions", or "make a comparison table".',"notebook.node_type.section":"Chapter","notebook.node_type.concept":"Concept","notebook.node_type.lesson":"Lesson","notebook.content.loading":"Loading this lesson…","notebook.content.load_failed":"Failed to load content. ","notebook.content.retry":"Retry","notebook.content.render_failed":"This content failed to render (possibly malformed translation).","notebook.content.truncated":"…(truncated)","notebook.content.retry_render":"Retry render","notebook.content.empty":'No explanation for this lesson yet. Ask the AI tutor: "Walk me through this lesson."',"notebook.images.heading":"Images ({n})","notebook.quote.template":"About this passage 「{text}」, I don't quite get it. Please explain:","notebook.quote.ask":"Ask","notebook.quote.add_note":"Add note","notebook.quote.save_note.title":"Save the selected text to your notes (with source jump)","notebook.quote.hint":"Select any text in the explanation to add a note; AI-generated concept maps, comparison tables, and quiz cards land in the Notes tab automatically.","notebook.source.label":"Source","notebook.source.jump_content":"Jump to explanation","notebook.source.jump_chat":"Jump to chat message","notebook.zone.understand.subtitle":"Knowledge structure the AI lays out for you","notebook.zone.understand.empty_hint":'Ask the AI to "draw a concept map" or "make a comparison table" to structure this lesson',"notebook.zone.note.subtitle":"Your highlights — click to jump back to source","notebook.zone.note.empty_hint":'Select text in the explanation or chat, then "Add note" to save here',"notebook.zone.practice.subtitle_empty":"Test your grasp; redoable","notebook.zone.practice.subtitle_stats":"{n} questions · last correct {c} · wrong {w}","notebook.zone.practice.empty_hint":'Ask the AI "give me 3 questions" — they land here',"notebook.note.comment.ph_new":"Write a note about this highlight…","notebook.note.comment.ph_edit":"Edit note… (clear + save to delete)","notebook.action.save":"Save","notebook.action.cancel":"Cancel","notebook.note.edit_comment":"Edit note","notebook.note.add_comment":"Add note","notebook.note.pinned":"Pinned","notebook.note.pin":"Pin","notebook.note.unpin":"Unpin","notebook.note.delete":"Delete","notebook.quiz.last_correct":"Last correct","notebook.quiz.last_wrong":"Last wrong","notebook.artifact.broken":"Broken artifact data","notebook.asset.loading":"Loading…","exam.loading":"Generating exam questions…","exam.errorTitle":"Exam failed to load","exam.errorEmpty":"Failed to generate questions. Please try again later.","exam.reload":"Reload","exam.question.label":"Question {n}","exam.next":"Next","exam.submit":"Submit Exam","exam.accuracy":"Accuracy {n}%","exam.stars.congrats":"Congratulations! {n} stars earned!","exam.stars.thisAndBest":"This run: {n} stars · Best: {m} stars","exam.stars.failed":"Below 60%. Keep practicing!","exam.review.title":"Question Review","exam.review.questionFallback":"(Question {n})","exam.review.yourAnswer":"Your answer:","exam.review.correctAnswer":"Correct:","exam.review.unanswered":"(no answer)","exam.retry":"Retake exam (questions cached)","exam.generating.title":"Generating chapter exam…","exam.generating.stage":"AI is writing questions knowledge point by knowledge point","exam.generating.kcProgress":"{done} / {total} knowledge points covered","exam.generating.preparing":"Preparing…","exam.generating.canLeave":"You can leave this page — generation continues in the background and you'll be notified.","exam.failed.retry":"Regenerate","exam.ready.title":"Exam ready","exam.ready.meta":"{q} questions · {kc} knowledge points · ~{min} min","exam.ready.toast":'Exam questions for "{title}" are ready',"update.available":"New version {version} is available","update.download":"Download","exam.start":"Start exam","exam.retryExam":"Retake exam","exam.regenerate":"New questions","exam.regenerate.confirmMsg":"Regenerating discards the current questions and has the AI write a fresh set for this chapter (past scores are kept).","exam.submitting":"Grading…","exam.q.progress":"Question {i} / {n}","exam.q.next":"Next","exam.q.submit":"Submit exam","exam.terminated.banner":"This attempt was terminated by leaving mid-exam. Unanswered questions were counted as wrong.","exam.result.score":"{correct} / {total} correct","exam.result.accuracy":"Accuracy {pct}%","exam.result.best":"Best: {stars} stars","exam.result.attempts":"{n} attempts","exam.result.kcBreakdown":"By knowledge point","exam.result.weakKc":"Weak · review suggested","exam.result.correctLabel":"Correct","exam.result.unanswered":"No answer","exam.result.yourAnswer":"Your answer:","exam.result.correctAnswer":"Correct answer:","exam.result.review":"Question review","exam.leave.title":"Leaving will end the exam","exam.leave.message":"Unanswered questions will be counted as wrong and this attempt will be recorded. Leave anyway?","exam.leave.confirm":"End and leave","exam.leave.cancel":"Keep going","error.renderFailed":"This content failed to render (possibly malformed).","error.retry":"Retry","artifact.unknownHeader":"Artifact (unknown type)","artifact.zoomOut":"Zoom out","artifact.zoomReset":"Reset zoom","artifact.zoomIn":"Zoom in","artifact.canvas.fit":"Fit","artifact.viewer.open":"Open large view","artifact.viewer.hint":"Pinch to zoom · drag to pan · Ctrl+scroll","artifact.conceptmap.stats":"{nodes} concepts · {edges} relations · Ctrl+scroll to zoom · drag to pan","artifact.codewalk.sectionLabel":"Step-by-step notes (click to jump to code)","artifact.codewalk.lineSingle":"Line {n}","artifact.codewalk.lineRange":"Lines {a}-{b}","artifact.diagram.flowchart":"Flowchart","artifact.diagram.sequence":"Sequence","artifact.diagram.state":"State","common.close":"Close","lesson.next.title":"Lesson complete — crown earned!","lesson.next.guide":"Next up","lesson.next.button":"Start next lesson","lesson.next.terminal":"You finished the whole course — review to consolidate, or import the next one","artifact.mermaid.inlineTitle":"Diagram","artifact.mermaid.openLive":"Open in mermaid.live (editable)","artifact.mermaid.rendering":"Rendering diagram…","artifact.mermaid.renderFailed":"Render failed. Showing source (copy to mermaid.live to view).","artifact.mermaid.repairing":"The diagram has a syntax error, auto-repairing…","artifact.mermaid.errorPrefix":"Error: {msg}","artifact.mermaid.hint":"Ctrl+scroll to zoom · drag to pan","quiz.questionProgress":"Q {cur}/{total}","quiz.answeredCorrect":"{n} correct","quiz.correct":"Correct","quiz.wrong":"Wrong","quiz.finish":"Finish","quiz.scoreSummary":"{correct}/{total} correct","quiz.hook.label":"📊 Quiz done: {{correct}}/{{total}}","quiz.hook.finish":"Finish quiz","quiz.hook.sent":"Results sent to your tutor, awaiting analysis…","quiz.hook.message":`I just finished the quiz{{title}}, scoring {{correct}}/{{total}}. Per-question breakdown below:
460
+ Based on my performance, decide what comes next: explain why I got questions wrong and the right reasoning, or judge whether I can move on. Do not re-issue the same set of questions, and do not just say well done.`,"quiz.hook.lineOk":"✅ Q{{n}}: {{prompt}} — correct","quiz.hook.lineWrong":"❌ Q{{n}}: {{prompt}} — I chose {{chosen}}, correct answer is {{answer}}","quiz.allCorrectHint":"All correct! Mastery update proposed.","quiz.tryAgainHint":"Practice another set to consolidate.","quiz.action.nextPrompt":"What's next:","quiz.action.explainWrong":"Explain what I got wrong","quiz.action.retry":"Another set","quiz.action.goDeeper":"Go deeper","quiz.action.markMastered":"Confirm I've mastered it","quiz.action.nextTopic":"Next topic","guess.header":"Take a guess","guess.pickedPrefix":"I guess: ","guess.waitReveal":"Guessed — waiting for the reveal…","import.deleted":"Deleted: {title}","exercise.title":"📝 Practice","exercise.generate":"Generate a question","exercise.submit":"Submit Answer","exercise.next":"Next →","exercise.correct":"✅ Correct!","exercise.wrong":"❌ Wrong","exercise.types.mcq":"Multiple Choice","exercise.types.fill_blank":"Fill in the Blank","exercise.types.true_false":"True or False","dashboard.title":"Learning Dashboard","dashboard.stat.streak":"Streak","dashboard.stat.due":"Due Today","dashboard.stat.mastery":"Overall Mastery","dashboard.review":"Review","dashboard.cleared":"Cleared","dashboard.export.md":"📄 Export Report","dashboard.export.json":"Export JSON","dashboard.section_mastery":"Mastery by Section","dashboard.mini.sections":"Mastery by section","dashboard.mini.struggle":"Your struggle spots (tap to relearn)","import.title":"Import Course","import.url":"GitHub URL","import.markdown":"Paste Markdown","import.btn":"Import","import.md_btn":"Generate Course","streak.days":"days","streak.title":"{n}-day streak · longest {m} days","streak.freeze.title":"{n} freeze left: saves your streak on a missed day"}};function Ws(){return qs}function uM(e){e!==qs&&(qs=e,typeof localStorage<"u"&&localStorage.setItem(Sm,e),Xo.forEach(t=>t()))}function tu(e,t=qs,n){var s,i;let r=((s=Ic[t])==null?void 0:s[e])??((i=Ic["zh-CN"])==null?void 0:i[e])??e;if(n)for(const[a,o]of Object.entries(n))r=r.replaceAll(`{${a}}`,String(o));return r}function Ye(){const e=v.useSyncExternalStore(Am,Ws,Ws);return v.useCallback((t,n)=>tu(t,e,n),[e])}function ha(){return v.useSyncExternalStore(Am,Ws,Ws)}const Xx=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].map(e=>`${e}:not([hidden])`).join(",");function Rc(e){return Array.from(e.querySelectorAll(Xx)).filter(t=>t.offsetParent!==null||t===document.activeElement)}function fa(e,t){v.useEffect(()=>{if(!t)return;const n=e.current;if(!n)return;const r=document.activeElement,i=Rc(n)[0]??n,a=window.setTimeout(()=>i.focus(),0),o=l=>{if(l.key!=="Tab")return;const u=Rc(n);if(u.length===0){l.preventDefault(),n.focus();return}const c=u[0],h=u[u.length-1];l.shiftKey?(document.activeElement===c||!n.contains(document.activeElement))&&(l.preventDefault(),h.focus()):document.activeElement===h&&(l.preventDefault(),c.focus())};return n.addEventListener("keydown",o),()=>{if(window.clearTimeout(a),n.removeEventListener("keydown",o),r&&document.body.contains(r))try{r.focus()}catch{}}},[e,t])}const ls=220;function Cm({anchorRect:e,message:t,onConfirm:n,onCancel:r,confirmLabel:s,cancelLabel:i,danger:a=!1,testid:o="confirm-card"}){const l=Ye(),u=v.useRef(null);fa(u,!0);const c=s??l("action.confirm"),h=i??l("action.cancel");v.useEffect(()=>{const y=T=>{u.current&&!u.current.contains(T.target)&&r()},k=T=>{T.key==="Escape"&&r(),T.key==="Enter"&&(T.preventDefault(),n())};return document.addEventListener("mousedown",y),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",k)}},[r,n]);const f=window.innerWidth,d=window.innerHeight,m=e.right-ls,b=Math.max(8,Math.min(m,f-ls-8)),g=e.bottom+4+ls>d?Math.max(8,e.top-4-ls):e.bottom+4;return wm.createPortal(p.jsxs("div",{ref:u,className:`confirm-card fixed z-[60] w-[220px] bg-surface-0 rounded-xl shadow-elevated border p-3 ${a?"border-warning/50":"border-[var(--border)]"}`,style:{left:b,top:g},role:"alertdialog","aria-modal":"false","data-testid":o,onClick:y=>y.stopPropagation(),children:[p.jsx("p",{className:"text-body text-ink-muted leading-relaxed mb-3",children:t}),p.jsxs("div",{className:"flex gap-2 justify-end",children:[p.jsx("button",{onClick:r,"data-testid":`${o}-cancel`,className:"px-2.5 py-1 rounded-md text-label font-bold text-ink-muted hover:text-ink-strong hover:bg-surface-3 transition-colors",children:h}),p.jsx("button",{onClick:n,"data-testid":`${o}-confirm`,className:"btn-3d-brand px-2.5 py-1 text-label",style:a?{background:"var(--warning)",boxShadow:"0 3px 0 0 var(--warning-dark)"}:void 0,children:c})]})]}),document.body)}const Qx=268,nu=28,Zx=20,_m=nu*2+Zx,Jx=_m+8,ey=104,ty=18,za=nu+6,ny=26,ry=22;function Qo(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t^=t>>>16,t=Math.imul(t,2246822507),t^=t>>>13,t=Math.imul(t,3266489909),t^=t>>>16,t>>>0}function iy(e,t=Qx,n=""){const r=[],s=t/2,i=t/2-ty-nu;for(let l=0;l<e;l++){const u=za+l*ey,h=Qo(`${n}:${l}`)/4294967295*2-1,f=s+h*i,m=Qo(`${n}:${l}:y`)/4294967295*2-1,b=u+m*ny;r.push({x:f,y:b,index:l})}if(r.length>0){r[0].y<za&&(r[0].y=za);for(let l=1;l<r.length;l++){const u=r[l-1].y+Jx;r[l].y<u&&(r[l].y=u)}}const a=[];for(let l=0;l<r.length-1;l++)a.push({from:r[l],to:r[l+1],index:l});const o=r.length===0?40:r[r.length-1].y+_m/2+10;return{nodes:r,segments:a,height:o}}function sy(e){const{from:t,to:n}=e,r=(t.y+n.y)/2+ry;return`M ${t.x} ${t.y} C ${t.x} ${r}, ${n.x} ${r}, ${n.x} ${n.y}`}var _s={exports:{}};/*!
461
+ * matter-js 0.19.0 by @liabru
462
+ * http://brm.io/matter-js/
463
+ * License MIT
464
+ *
465
+ * The MIT License (MIT)
466
+ *
467
+ * Copyright (c) Liam Brummitt and contributors.
468
+ *
469
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
470
+ * of this software and associated documentation files (the "Software"), to deal
471
+ * in the Software without restriction, including without limitation the rights
472
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
473
+ * copies of the Software, and to permit persons to whom the Software is
474
+ * furnished to do so, subject to the following conditions:
475
+ *
476
+ * The above copyright notice and this permission notice shall be included in
477
+ * all copies or substantial portions of the Software.
478
+ *
479
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
480
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
481
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
482
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
483
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
484
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
485
+ * THE SOFTWARE.
486
+ */var ay=_s.exports,Pc;function oy(){return Pc||(Pc=1,(function(e,t){(function(r,s){e.exports=s()})(ay,function(){return(function(n){var r={};function s(i){if(r[i])return r[i].exports;var a=r[i]={i,l:!1,exports:{}};return n[i].call(a.exports,a,a.exports,s),a.l=!0,a.exports}return s.m=n,s.c=r,s.d=function(i,a,o){s.o(i,a)||Object.defineProperty(i,a,{enumerable:!0,get:o})},s.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},s.t=function(i,a){if(a&1&&(i=s(i)),a&8||a&4&&typeof i=="object"&&i&&i.__esModule)return i;var o=Object.create(null);if(s.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:i}),a&2&&typeof i!="string")for(var l in i)s.d(o,l,(function(u){return i[u]}).bind(null,l));return o},s.n=function(i){var a=i&&i.__esModule?function(){return i.default}:function(){return i};return s.d(a,"a",a),a},s.o=function(i,a){return Object.prototype.hasOwnProperty.call(i,a)},s.p="",s(s.s=20)})([(function(n,r){var s={};n.exports=s,(function(){s._baseDelta=1e3/60,s._nextId=0,s._seed=0,s._nowStartTime=+new Date,s._warnedOnce={},s._decomp=null,s.extend=function(a,o){var l,u;typeof o=="boolean"?(l=2,u=o):(l=1,u=!0);for(var c=l;c<arguments.length;c++){var h=arguments[c];if(h)for(var f in h)u&&h[f]&&h[f].constructor===Object&&(!a[f]||a[f].constructor===Object)?(a[f]=a[f]||{},s.extend(a[f],u,h[f])):a[f]=h[f]}return a},s.clone=function(a,o){return s.extend({},o,a)},s.keys=function(a){if(Object.keys)return Object.keys(a);var o=[];for(var l in a)o.push(l);return o},s.values=function(a){var o=[];if(Object.keys){for(var l=Object.keys(a),u=0;u<l.length;u++)o.push(a[l[u]]);return o}for(var c in a)o.push(a[c]);return o},s.get=function(a,o,l,u){o=o.split(".").slice(l,u);for(var c=0;c<o.length;c+=1)a=a[o[c]];return a},s.set=function(a,o,l,u,c){var h=o.split(".").slice(u,c);return s.get(a,o,0,-1)[h[h.length-1]]=l,l},s.shuffle=function(a){for(var o=a.length-1;o>0;o--){var l=Math.floor(s.random()*(o+1)),u=a[o];a[o]=a[l],a[l]=u}return a},s.choose=function(a){return a[Math.floor(s.random()*a.length)]},s.isElement=function(a){return typeof HTMLElement<"u"?a instanceof HTMLElement:!!(a&&a.nodeType&&a.nodeName)},s.isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"},s.isFunction=function(a){return typeof a=="function"},s.isPlainObject=function(a){return typeof a=="object"&&a.constructor===Object},s.isString=function(a){return toString.call(a)==="[object String]"},s.clamp=function(a,o,l){return a<o?o:a>l?l:a},s.sign=function(a){return a<0?-1:1},s.now=function(){if(typeof window<"u"&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return Date.now?Date.now():new Date-s._nowStartTime},s.random=function(a,o){return a=typeof a<"u"?a:0,o=typeof o<"u"?o:1,a+i()*(o-a)};var i=function(){return s._seed=(s._seed*9301+49297)%233280,s._seed/233280};s.colorToNumber=function(a){return a=a.replace("#",""),a.length==3&&(a=a.charAt(0)+a.charAt(0)+a.charAt(1)+a.charAt(1)+a.charAt(2)+a.charAt(2)),parseInt(a,16)},s.logLevel=1,s.log=function(){console&&s.logLevel>0&&s.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},s.info=function(){console&&s.logLevel>0&&s.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},s.warn=function(){console&&s.logLevel>0&&s.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},s.warnOnce=function(){var a=Array.prototype.slice.call(arguments).join(" ");s._warnedOnce[a]||(s.warn(a),s._warnedOnce[a]=!0)},s.deprecated=function(a,o,l){a[o]=s.chain(function(){s.warnOnce("🔅 deprecated 🔅",l)},a[o])},s.nextId=function(){return s._nextId++},s.indexOf=function(a,o){if(a.indexOf)return a.indexOf(o);for(var l=0;l<a.length;l++)if(a[l]===o)return l;return-1},s.map=function(a,o){if(a.map)return a.map(o);for(var l=[],u=0;u<a.length;u+=1)l.push(o(a[u]));return l},s.topologicalSort=function(a){var o=[],l=[],u=[];for(var c in a)!l[c]&&!u[c]&&s._topologicalSort(c,l,u,a,o);return o},s._topologicalSort=function(a,o,l,u,c){var h=u[a]||[];l[a]=!0;for(var f=0;f<h.length;f+=1){var d=h[f];l[d]||o[d]||s._topologicalSort(d,o,l,u,c)}l[a]=!1,o[a]=!0,c.push(a)},s.chain=function(){for(var a=[],o=0;o<arguments.length;o+=1){var l=arguments[o];l._chained?a.push.apply(a,l._chained):a.push(l)}var u=function(){for(var c,h=new Array(arguments.length),f=0,d=arguments.length;f<d;f++)h[f]=arguments[f];for(f=0;f<a.length;f+=1){var m=a[f].apply(c,h);typeof m<"u"&&(c=m)}return c};return u._chained=a,u},s.chainPathBefore=function(a,o,l){return s.set(a,o,s.chain(l,s.get(a,o)))},s.chainPathAfter=function(a,o,l){return s.set(a,o,s.chain(s.get(a,o),l))},s.setDecomp=function(a){s._decomp=a},s.getDecomp=function(){var a=s._decomp;try{!a&&typeof window<"u"&&(a=window.decomp),!a&&typeof bc<"u"&&(a=bc.decomp)}catch{a=null}return a}})()}),(function(n,r){var s={};n.exports=s,(function(){s.create=function(i){var a={min:{x:0,y:0},max:{x:0,y:0}};return i&&s.update(a,i),a},s.update=function(i,a,o){i.min.x=1/0,i.max.x=-1/0,i.min.y=1/0,i.max.y=-1/0;for(var l=0;l<a.length;l++){var u=a[l];u.x>i.max.x&&(i.max.x=u.x),u.x<i.min.x&&(i.min.x=u.x),u.y>i.max.y&&(i.max.y=u.y),u.y<i.min.y&&(i.min.y=u.y)}o&&(o.x>0?i.max.x+=o.x:i.min.x+=o.x,o.y>0?i.max.y+=o.y:i.min.y+=o.y)},s.contains=function(i,a){return a.x>=i.min.x&&a.x<=i.max.x&&a.y>=i.min.y&&a.y<=i.max.y},s.overlaps=function(i,a){return i.min.x<=a.max.x&&i.max.x>=a.min.x&&i.max.y>=a.min.y&&i.min.y<=a.max.y},s.translate=function(i,a){i.min.x+=a.x,i.max.x+=a.x,i.min.y+=a.y,i.max.y+=a.y},s.shift=function(i,a){var o=i.max.x-i.min.x,l=i.max.y-i.min.y;i.min.x=a.x,i.max.x=a.x+o,i.min.y=a.y,i.max.y=a.y+l}})()}),(function(n,r){var s={};n.exports=s,(function(){s.create=function(i,a){return{x:i||0,y:a||0}},s.clone=function(i){return{x:i.x,y:i.y}},s.magnitude=function(i){return Math.sqrt(i.x*i.x+i.y*i.y)},s.magnitudeSquared=function(i){return i.x*i.x+i.y*i.y},s.rotate=function(i,a,o){var l=Math.cos(a),u=Math.sin(a);o||(o={});var c=i.x*l-i.y*u;return o.y=i.x*u+i.y*l,o.x=c,o},s.rotateAbout=function(i,a,o,l){var u=Math.cos(a),c=Math.sin(a);l||(l={});var h=o.x+((i.x-o.x)*u-(i.y-o.y)*c);return l.y=o.y+((i.x-o.x)*c+(i.y-o.y)*u),l.x=h,l},s.normalise=function(i){var a=s.magnitude(i);return a===0?{x:0,y:0}:{x:i.x/a,y:i.y/a}},s.dot=function(i,a){return i.x*a.x+i.y*a.y},s.cross=function(i,a){return i.x*a.y-i.y*a.x},s.cross3=function(i,a,o){return(a.x-i.x)*(o.y-i.y)-(a.y-i.y)*(o.x-i.x)},s.add=function(i,a,o){return o||(o={}),o.x=i.x+a.x,o.y=i.y+a.y,o},s.sub=function(i,a,o){return o||(o={}),o.x=i.x-a.x,o.y=i.y-a.y,o},s.mult=function(i,a){return{x:i.x*a,y:i.y*a}},s.div=function(i,a){return{x:i.x/a,y:i.y/a}},s.perp=function(i,a){return a=a===!0?-1:1,{x:a*-i.y,y:a*i.x}},s.neg=function(i){return{x:-i.x,y:-i.y}},s.angle=function(i,a){return Math.atan2(a.y-i.y,a.x-i.x)},s._temp=[s.create(),s.create(),s.create(),s.create(),s.create(),s.create()]})()}),(function(n,r,s){var i={};n.exports=i;var a=s(2),o=s(0);(function(){i.create=function(l,u){for(var c=[],h=0;h<l.length;h++){var f=l[h],d={x:f.x,y:f.y,index:h,body:u,isInternal:!1};c.push(d)}return c},i.fromPath=function(l,u){var c=/L?\s*([-\d.e]+)[\s,]*([-\d.e]+)*/ig,h=[];return l.replace(c,function(f,d,m){h.push({x:parseFloat(d),y:parseFloat(m)})}),i.create(h,u)},i.centre=function(l){for(var u=i.area(l,!0),c={x:0,y:0},h,f,d,m=0;m<l.length;m++)d=(m+1)%l.length,h=a.cross(l[m],l[d]),f=a.mult(a.add(l[m],l[d]),h),c=a.add(c,f);return a.div(c,6*u)},i.mean=function(l){for(var u={x:0,y:0},c=0;c<l.length;c++)u.x+=l[c].x,u.y+=l[c].y;return a.div(u,l.length)},i.area=function(l,u){for(var c=0,h=l.length-1,f=0;f<l.length;f++)c+=(l[h].x-l[f].x)*(l[h].y+l[f].y),h=f;return u?c/2:Math.abs(c)/2},i.inertia=function(l,u){for(var c=0,h=0,f=l,d,m,b=0;b<f.length;b++)m=(b+1)%f.length,d=Math.abs(a.cross(f[m],f[b])),c+=d*(a.dot(f[m],f[m])+a.dot(f[m],f[b])+a.dot(f[b],f[b])),h+=d;return u/6*(c/h)},i.translate=function(l,u,c){c=typeof c<"u"?c:1;var h=l.length,f=u.x*c,d=u.y*c,m;for(m=0;m<h;m++)l[m].x+=f,l[m].y+=d;return l},i.rotate=function(l,u,c){if(u!==0){var h=Math.cos(u),f=Math.sin(u),d=c.x,m=c.y,b=l.length,g,y,k,T;for(T=0;T<b;T++)g=l[T],y=g.x-d,k=g.y-m,g.x=d+(y*h-k*f),g.y=m+(y*f+k*h);return l}},i.contains=function(l,u){for(var c=u.x,h=u.y,f=l.length,d=l[f-1],m,b=0;b<f;b++){if(m=l[b],(c-d.x)*(m.y-d.y)+(h-d.y)*(d.x-m.x)>0)return!1;d=m}return!0},i.scale=function(l,u,c,h){if(u===1&&c===1)return l;h=h||i.centre(l);for(var f,d,m=0;m<l.length;m++)f=l[m],d=a.sub(f,h),l[m].x=h.x+d.x*u,l[m].y=h.y+d.y*c;return l},i.chamfer=function(l,u,c,h,f){typeof u=="number"?u=[u]:u=u||[8],c=typeof c<"u"?c:-1,h=h||2,f=f||14;for(var d=[],m=0;m<l.length;m++){var b=l[m-1>=0?m-1:l.length-1],g=l[m],y=l[(m+1)%l.length],k=u[m<u.length?m:u.length-1];if(k===0){d.push(g);continue}var T=a.normalise({x:g.y-b.y,y:b.x-g.x}),S=a.normalise({x:y.y-g.y,y:g.x-y.x}),E=Math.sqrt(2*Math.pow(k,2)),w=a.mult(o.clone(T),k),_=a.normalise(a.mult(a.add(T,S),.5)),A=a.sub(g,a.mult(_,E)),N=c;c===-1&&(N=Math.pow(k,.32)*1.75),N=o.clamp(N,h,f),N%2===1&&(N+=1);for(var C=Math.acos(a.dot(T,S)),L=C/N,M=0;M<N;M++)d.push(a.add(a.rotate(w,L*M),A))}return d},i.clockwiseSort=function(l){var u=i.mean(l);return l.sort(function(c,h){return a.angle(u,c)-a.angle(u,h)}),l},i.isConvex=function(l){var u=0,c=l.length,h,f,d,m;if(c<3)return null;for(h=0;h<c;h++)if(f=(h+1)%c,d=(h+2)%c,m=(l[f].x-l[h].x)*(l[d].y-l[f].y),m-=(l[f].y-l[h].y)*(l[d].x-l[f].x),m<0?u|=1:m>0&&(u|=2),u===3)return!1;return u!==0?!0:null},i.hull=function(l){var u=[],c=[],h,f;for(l=l.slice(0),l.sort(function(d,m){var b=d.x-m.x;return b!==0?b:d.y-m.y}),f=0;f<l.length;f+=1){for(h=l[f];c.length>=2&&a.cross3(c[c.length-2],c[c.length-1],h)<=0;)c.pop();c.push(h)}for(f=l.length-1;f>=0;f-=1){for(h=l[f];u.length>=2&&a.cross3(u[u.length-2],u[u.length-1],h)<=0;)u.pop();u.push(h)}return u.pop(),c.pop(),u.concat(c)}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(3),o=s(2),l=s(7),u=s(0),c=s(1),h=s(11);(function(){i._timeCorrection=!0,i._inertiaScale=4,i._nextCollidingGroupId=1,i._nextNonCollidingGroupId=-1,i._nextCategory=1,i._baseDelta=1e3/60,i.create=function(d){var m={id:u.nextId(),type:"body",label:"Body",parts:[],plugin:{},angle:0,vertices:a.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"),position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,render:{visible:!0,opacity:1,strokeStyle:null,fillStyle:null,lineWidth:null,sprite:{xScale:1,yScale:1,xOffset:0,yOffset:0}},events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inertia:0,deltaTime:16.666666666666668,_original:null},b=u.extend(m,d);return f(b,d),b},i.nextGroup=function(d){return d?i._nextNonCollidingGroupId--:i._nextCollidingGroupId++},i.nextCategory=function(){return i._nextCategory=i._nextCategory<<1,i._nextCategory};var f=function(d,m){m=m||{},i.set(d,{bounds:d.bounds||c.create(d.vertices),positionPrev:d.positionPrev||o.clone(d.position),anglePrev:d.anglePrev||d.angle,vertices:d.vertices,parts:d.parts||[d],isStatic:d.isStatic,isSleeping:d.isSleeping,parent:d.parent||d}),a.rotate(d.vertices,d.angle,d.position),h.rotate(d.axes,d.angle),c.update(d.bounds,d.vertices,d.velocity),i.set(d,{axes:m.axes||d.axes,area:m.area||d.area,mass:m.mass||d.mass,inertia:m.inertia||d.inertia});var b=d.isStatic?"#14151f":u.choose(["#f19648","#f5d259","#f55a3c","#063e7b","#ececd1"]),g=d.isStatic?"#555":"#ccc",y=d.isStatic&&d.render.fillStyle===null?1:0;d.render.fillStyle=d.render.fillStyle||b,d.render.strokeStyle=d.render.strokeStyle||g,d.render.lineWidth=d.render.lineWidth||y,d.render.sprite.xOffset+=-(d.bounds.min.x-d.position.x)/(d.bounds.max.x-d.bounds.min.x),d.render.sprite.yOffset+=-(d.bounds.min.y-d.position.y)/(d.bounds.max.y-d.bounds.min.y)};i.set=function(d,m,b){var g;typeof m=="string"&&(g=m,m={},m[g]=b);for(g in m)if(Object.prototype.hasOwnProperty.call(m,g))switch(b=m[g],g){case"isStatic":i.setStatic(d,b);break;case"isSleeping":l.set(d,b);break;case"mass":i.setMass(d,b);break;case"density":i.setDensity(d,b);break;case"inertia":i.setInertia(d,b);break;case"vertices":i.setVertices(d,b);break;case"position":i.setPosition(d,b);break;case"angle":i.setAngle(d,b);break;case"velocity":i.setVelocity(d,b);break;case"angularVelocity":i.setAngularVelocity(d,b);break;case"speed":i.setSpeed(d,b);break;case"angularSpeed":i.setAngularSpeed(d,b);break;case"parts":i.setParts(d,b);break;case"centre":i.setCentre(d,b);break;default:d[g]=b}},i.setStatic=function(d,m){for(var b=0;b<d.parts.length;b++){var g=d.parts[b];g.isStatic=m,m?(g._original={restitution:g.restitution,friction:g.friction,mass:g.mass,inertia:g.inertia,density:g.density,inverseMass:g.inverseMass,inverseInertia:g.inverseInertia},g.restitution=0,g.friction=1,g.mass=g.inertia=g.density=1/0,g.inverseMass=g.inverseInertia=0,g.positionPrev.x=g.position.x,g.positionPrev.y=g.position.y,g.anglePrev=g.angle,g.angularVelocity=0,g.speed=0,g.angularSpeed=0,g.motion=0):g._original&&(g.restitution=g._original.restitution,g.friction=g._original.friction,g.mass=g._original.mass,g.inertia=g._original.inertia,g.density=g._original.density,g.inverseMass=g._original.inverseMass,g.inverseInertia=g._original.inverseInertia,g._original=null)}},i.setMass=function(d,m){var b=d.inertia/(d.mass/6);d.inertia=b*(m/6),d.inverseInertia=1/d.inertia,d.mass=m,d.inverseMass=1/d.mass,d.density=d.mass/d.area},i.setDensity=function(d,m){i.setMass(d,m*d.area),d.density=m},i.setInertia=function(d,m){d.inertia=m,d.inverseInertia=1/d.inertia},i.setVertices=function(d,m){m[0].body===d?d.vertices=m:d.vertices=a.create(m,d),d.axes=h.fromVertices(d.vertices),d.area=a.area(d.vertices),i.setMass(d,d.density*d.area);var b=a.centre(d.vertices);a.translate(d.vertices,b,-1),i.setInertia(d,i._inertiaScale*a.inertia(d.vertices,d.mass)),a.translate(d.vertices,d.position),c.update(d.bounds,d.vertices,d.velocity)},i.setParts=function(d,m,b){var g;for(m=m.slice(0),d.parts.length=0,d.parts.push(d),d.parent=d,g=0;g<m.length;g++){var y=m[g];y!==d&&(y.parent=d,d.parts.push(y))}if(d.parts.length!==1){if(b=typeof b<"u"?b:!0,b){var k=[];for(g=0;g<m.length;g++)k=k.concat(m[g].vertices);a.clockwiseSort(k);var T=a.hull(k),S=a.centre(T);i.setVertices(d,T),a.translate(d.vertices,S)}var E=i._totalProperties(d);d.area=E.area,d.parent=d,d.position.x=E.centre.x,d.position.y=E.centre.y,d.positionPrev.x=E.centre.x,d.positionPrev.y=E.centre.y,i.setMass(d,E.mass),i.setInertia(d,E.inertia),i.setPosition(d,E.centre)}},i.setCentre=function(d,m,b){b?(d.positionPrev.x+=m.x,d.positionPrev.y+=m.y,d.position.x+=m.x,d.position.y+=m.y):(d.positionPrev.x=m.x-(d.position.x-d.positionPrev.x),d.positionPrev.y=m.y-(d.position.y-d.positionPrev.y),d.position.x=m.x,d.position.y=m.y)},i.setPosition=function(d,m,b){var g=o.sub(m,d.position);b?(d.positionPrev.x=d.position.x,d.positionPrev.y=d.position.y,d.velocity.x=g.x,d.velocity.y=g.y,d.speed=o.magnitude(g)):(d.positionPrev.x+=g.x,d.positionPrev.y+=g.y);for(var y=0;y<d.parts.length;y++){var k=d.parts[y];k.position.x+=g.x,k.position.y+=g.y,a.translate(k.vertices,g),c.update(k.bounds,k.vertices,d.velocity)}},i.setAngle=function(d,m,b){var g=m-d.angle;b?(d.anglePrev=d.angle,d.angularVelocity=g,d.angularSpeed=Math.abs(g)):d.anglePrev+=g;for(var y=0;y<d.parts.length;y++){var k=d.parts[y];k.angle+=g,a.rotate(k.vertices,g,d.position),h.rotate(k.axes,g),c.update(k.bounds,k.vertices,d.velocity),y>0&&o.rotateAbout(k.position,g,d.position,k.position)}},i.setVelocity=function(d,m){var b=d.deltaTime/i._baseDelta;d.positionPrev.x=d.position.x-m.x*b,d.positionPrev.y=d.position.y-m.y*b,d.velocity.x=(d.position.x-d.positionPrev.x)/b,d.velocity.y=(d.position.y-d.positionPrev.y)/b,d.speed=o.magnitude(d.velocity)},i.getVelocity=function(d){var m=i._baseDelta/d.deltaTime;return{x:(d.position.x-d.positionPrev.x)*m,y:(d.position.y-d.positionPrev.y)*m}},i.getSpeed=function(d){return o.magnitude(i.getVelocity(d))},i.setSpeed=function(d,m){i.setVelocity(d,o.mult(o.normalise(i.getVelocity(d)),m))},i.setAngularVelocity=function(d,m){var b=d.deltaTime/i._baseDelta;d.anglePrev=d.angle-m*b,d.angularVelocity=(d.angle-d.anglePrev)/b,d.angularSpeed=Math.abs(d.angularVelocity)},i.getAngularVelocity=function(d){return(d.angle-d.anglePrev)*i._baseDelta/d.deltaTime},i.getAngularSpeed=function(d){return Math.abs(i.getAngularVelocity(d))},i.setAngularSpeed=function(d,m){i.setAngularVelocity(d,u.sign(i.getAngularVelocity(d))*m)},i.translate=function(d,m,b){i.setPosition(d,o.add(d.position,m),b)},i.rotate=function(d,m,b,g){if(!b)i.setAngle(d,d.angle+m,g);else{var y=Math.cos(m),k=Math.sin(m),T=d.position.x-b.x,S=d.position.y-b.y;i.setPosition(d,{x:b.x+(T*y-S*k),y:b.y+(T*k+S*y)},g),i.setAngle(d,d.angle+m,g)}},i.scale=function(d,m,b,g){var y=0,k=0;g=g||d.position;for(var T=0;T<d.parts.length;T++){var S=d.parts[T];a.scale(S.vertices,m,b,g),S.axes=h.fromVertices(S.vertices),S.area=a.area(S.vertices),i.setMass(S,d.density*S.area),a.translate(S.vertices,{x:-S.position.x,y:-S.position.y}),i.setInertia(S,i._inertiaScale*a.inertia(S.vertices,S.mass)),a.translate(S.vertices,{x:S.position.x,y:S.position.y}),T>0&&(y+=S.area,k+=S.inertia),S.position.x=g.x+(S.position.x-g.x)*m,S.position.y=g.y+(S.position.y-g.y)*b,c.update(S.bounds,S.vertices,d.velocity)}d.parts.length>1&&(d.area=y,d.isStatic||(i.setMass(d,d.density*y),i.setInertia(d,k))),d.circleRadius&&(m===b?d.circleRadius*=m:d.circleRadius=null)},i.update=function(d,m){m=(typeof m<"u"?m:1e3/60)*d.timeScale;var b=m*m,g=i._timeCorrection?m/(d.deltaTime||m):1,y=1-d.frictionAir*(m/u._baseDelta),k=(d.position.x-d.positionPrev.x)*g,T=(d.position.y-d.positionPrev.y)*g;d.velocity.x=k*y+d.force.x/d.mass*b,d.velocity.y=T*y+d.force.y/d.mass*b,d.positionPrev.x=d.position.x,d.positionPrev.y=d.position.y,d.position.x+=d.velocity.x,d.position.y+=d.velocity.y,d.deltaTime=m,d.angularVelocity=(d.angle-d.anglePrev)*y*g+d.torque/d.inertia*b,d.anglePrev=d.angle,d.angle+=d.angularVelocity;for(var S=0;S<d.parts.length;S++){var E=d.parts[S];a.translate(E.vertices,d.velocity),S>0&&(E.position.x+=d.velocity.x,E.position.y+=d.velocity.y),d.angularVelocity!==0&&(a.rotate(E.vertices,d.angularVelocity,d.position),h.rotate(E.axes,d.angularVelocity),S>0&&o.rotateAbout(E.position,d.angularVelocity,d.position,E.position)),c.update(E.bounds,E.vertices,d.velocity)}},i.updateVelocities=function(d){var m=i._baseDelta/d.deltaTime,b=d.velocity;b.x=(d.position.x-d.positionPrev.x)*m,b.y=(d.position.y-d.positionPrev.y)*m,d.speed=Math.sqrt(b.x*b.x+b.y*b.y),d.angularVelocity=(d.angle-d.anglePrev)*m,d.angularSpeed=Math.abs(d.angularVelocity)},i.applyForce=function(d,m,b){var g={x:m.x-d.position.x,y:m.y-d.position.y};d.force.x+=b.x,d.force.y+=b.y,d.torque+=g.x*b.y-g.y*b.x},i._totalProperties=function(d){for(var m={mass:0,area:0,inertia:0,centre:{x:0,y:0}},b=d.parts.length===1?0:1;b<d.parts.length;b++){var g=d.parts[b],y=g.mass!==1/0?g.mass:1;m.mass+=y,m.area+=g.area,m.inertia+=g.inertia,m.centre=o.add(m.centre,o.mult(g.position,y))}return m.centre=o.div(m.centre,m.mass),m}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(0);(function(){i.on=function(o,l,u){for(var c=l.split(" "),h,f=0;f<c.length;f++)h=c[f],o.events=o.events||{},o.events[h]=o.events[h]||[],o.events[h].push(u);return u},i.off=function(o,l,u){if(!l){o.events={};return}typeof l=="function"&&(u=l,l=a.keys(o.events).join(" "));for(var c=l.split(" "),h=0;h<c.length;h++){var f=o.events[c[h]],d=[];if(u&&f)for(var m=0;m<f.length;m++)f[m]!==u&&d.push(f[m]);o.events[c[h]]=d}},i.trigger=function(o,l,u){var c,h,f,d,m=o.events;if(m&&a.keys(m).length>0){u||(u={}),c=l.split(" ");for(var b=0;b<c.length;b++)if(h=c[b],f=m[h],f){d=a.clone(u,!1),d.name=h,d.source=o;for(var g=0;g<f.length;g++)f[g].apply(o,[d])}}}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(5),o=s(0),l=s(1),u=s(4);(function(){i.create=function(c){return o.extend({id:o.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{},cache:{allBodies:null,allConstraints:null,allComposites:null}},c)},i.setModified=function(c,h,f,d){if(c.isModified=h,h&&c.cache&&(c.cache.allBodies=null,c.cache.allConstraints=null,c.cache.allComposites=null),f&&c.parent&&i.setModified(c.parent,h,f,d),d)for(var m=0;m<c.composites.length;m++){var b=c.composites[m];i.setModified(b,h,f,d)}},i.add=function(c,h){var f=[].concat(h);a.trigger(c,"beforeAdd",{object:h});for(var d=0;d<f.length;d++){var m=f[d];switch(m.type){case"body":if(m.parent!==m){o.warn("Composite.add: skipped adding a compound body part (you must add its parent instead)");break}i.addBody(c,m);break;case"constraint":i.addConstraint(c,m);break;case"composite":i.addComposite(c,m);break;case"mouseConstraint":i.addConstraint(c,m.constraint);break}}return a.trigger(c,"afterAdd",{object:h}),c},i.remove=function(c,h,f){var d=[].concat(h);a.trigger(c,"beforeRemove",{object:h});for(var m=0;m<d.length;m++){var b=d[m];switch(b.type){case"body":i.removeBody(c,b,f);break;case"constraint":i.removeConstraint(c,b,f);break;case"composite":i.removeComposite(c,b,f);break;case"mouseConstraint":i.removeConstraint(c,b.constraint);break}}return a.trigger(c,"afterRemove",{object:h}),c},i.addComposite=function(c,h){return c.composites.push(h),h.parent=c,i.setModified(c,!0,!0,!1),c},i.removeComposite=function(c,h,f){var d=o.indexOf(c.composites,h);if(d!==-1&&i.removeCompositeAt(c,d),f)for(var m=0;m<c.composites.length;m++)i.removeComposite(c.composites[m],h,!0);return c},i.removeCompositeAt=function(c,h){return c.composites.splice(h,1),i.setModified(c,!0,!0,!1),c},i.addBody=function(c,h){return c.bodies.push(h),i.setModified(c,!0,!0,!1),c},i.removeBody=function(c,h,f){var d=o.indexOf(c.bodies,h);if(d!==-1&&i.removeBodyAt(c,d),f)for(var m=0;m<c.composites.length;m++)i.removeBody(c.composites[m],h,!0);return c},i.removeBodyAt=function(c,h){return c.bodies.splice(h,1),i.setModified(c,!0,!0,!1),c},i.addConstraint=function(c,h){return c.constraints.push(h),i.setModified(c,!0,!0,!1),c},i.removeConstraint=function(c,h,f){var d=o.indexOf(c.constraints,h);if(d!==-1&&i.removeConstraintAt(c,d),f)for(var m=0;m<c.composites.length;m++)i.removeConstraint(c.composites[m],h,!0);return c},i.removeConstraintAt=function(c,h){return c.constraints.splice(h,1),i.setModified(c,!0,!0,!1),c},i.clear=function(c,h,f){if(f)for(var d=0;d<c.composites.length;d++)i.clear(c.composites[d],h,!0);return h?c.bodies=c.bodies.filter(function(m){return m.isStatic}):c.bodies.length=0,c.constraints.length=0,c.composites.length=0,i.setModified(c,!0,!0,!1),c},i.allBodies=function(c){if(c.cache&&c.cache.allBodies)return c.cache.allBodies;for(var h=[].concat(c.bodies),f=0;f<c.composites.length;f++)h=h.concat(i.allBodies(c.composites[f]));return c.cache&&(c.cache.allBodies=h),h},i.allConstraints=function(c){if(c.cache&&c.cache.allConstraints)return c.cache.allConstraints;for(var h=[].concat(c.constraints),f=0;f<c.composites.length;f++)h=h.concat(i.allConstraints(c.composites[f]));return c.cache&&(c.cache.allConstraints=h),h},i.allComposites=function(c){if(c.cache&&c.cache.allComposites)return c.cache.allComposites;for(var h=[].concat(c.composites),f=0;f<c.composites.length;f++)h=h.concat(i.allComposites(c.composites[f]));return c.cache&&(c.cache.allComposites=h),h},i.get=function(c,h,f){var d,m;switch(f){case"body":d=i.allBodies(c);break;case"constraint":d=i.allConstraints(c);break;case"composite":d=i.allComposites(c).concat(c);break}return d?(m=d.filter(function(b){return b.id.toString()===h.toString()}),m.length===0?null:m[0]):null},i.move=function(c,h,f){return i.remove(c,h),i.add(f,h),c},i.rebase=function(c){for(var h=i.allBodies(c).concat(i.allConstraints(c)).concat(i.allComposites(c)),f=0;f<h.length;f++)h[f].id=o.nextId();return c},i.translate=function(c,h,f){for(var d=f?i.allBodies(c):c.bodies,m=0;m<d.length;m++)u.translate(d[m],h);return c},i.rotate=function(c,h,f,d){for(var m=Math.cos(h),b=Math.sin(h),g=d?i.allBodies(c):c.bodies,y=0;y<g.length;y++){var k=g[y],T=k.position.x-f.x,S=k.position.y-f.y;u.setPosition(k,{x:f.x+(T*m-S*b),y:f.y+(T*b+S*m)}),u.rotate(k,h)}return c},i.scale=function(c,h,f,d,m){for(var b=m?i.allBodies(c):c.bodies,g=0;g<b.length;g++){var y=b[g],k=y.position.x-d.x,T=y.position.y-d.y;u.setPosition(y,{x:d.x+k*h,y:d.y+T*f}),u.scale(y,h,f)}return c},i.bounds=function(c){for(var h=i.allBodies(c),f=[],d=0;d<h.length;d+=1){var m=h[d];f.push(m.bounds.min,m.bounds.max)}return l.create(f)}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(4),o=s(5),l=s(0);(function(){i._motionWakeThreshold=.18,i._motionSleepThreshold=.08,i._minBias=.9,i.update=function(u,c){for(var h=c/l._baseDelta,f=i._motionSleepThreshold,d=0;d<u.length;d++){var m=u[d],b=a.getSpeed(m),g=a.getAngularSpeed(m),y=b*b+g*g;if(m.force.x!==0||m.force.y!==0){i.set(m,!1);continue}var k=Math.min(m.motion,y),T=Math.max(m.motion,y);m.motion=i._minBias*k+(1-i._minBias)*T,m.sleepThreshold>0&&m.motion<f?(m.sleepCounter+=1,m.sleepCounter>=m.sleepThreshold/h&&i.set(m,!0)):m.sleepCounter>0&&(m.sleepCounter-=1)}},i.afterCollisions=function(u){for(var c=i._motionSleepThreshold,h=0;h<u.length;h++){var f=u[h];if(f.isActive){var d=f.collision,m=d.bodyA.parent,b=d.bodyB.parent;if(!(m.isSleeping&&b.isSleeping||m.isStatic||b.isStatic)&&(m.isSleeping||b.isSleeping)){var g=m.isSleeping&&!m.isStatic?m:b,y=g===m?b:m;!g.isStatic&&y.motion>c&&i.set(g,!1)}}}},i.set=function(u,c){var h=u.isSleeping;c?(u.isSleeping=!0,u.sleepCounter=u.sleepThreshold,u.positionImpulse.x=0,u.positionImpulse.y=0,u.positionPrev.x=u.position.x,u.positionPrev.y=u.position.y,u.anglePrev=u.angle,u.speed=0,u.angularSpeed=0,u.motion=0,h||o.trigger(u,"sleepStart")):(u.isSleeping=!1,u.sleepCounter=0,h&&o.trigger(u,"sleepEnd"))}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(3),o=s(9);(function(){var l=[],u={overlap:0,axis:null},c={overlap:0,axis:null};i.create=function(h,f){return{pair:null,collided:!1,bodyA:h,bodyB:f,parentA:h.parent,parentB:f.parent,depth:0,normal:{x:0,y:0},tangent:{x:0,y:0},penetration:{x:0,y:0},supports:[]}},i.collides=function(h,f,d){if(i._overlapAxes(u,h.vertices,f.vertices,h.axes),u.overlap<=0||(i._overlapAxes(c,f.vertices,h.vertices,f.axes),c.overlap<=0))return null;var m=d&&d.table[o.id(h,f)],b;m?b=m.collision:(b=i.create(h,f),b.collided=!0,b.bodyA=h.id<f.id?h:f,b.bodyB=h.id<f.id?f:h,b.parentA=b.bodyA.parent,b.parentB=b.bodyB.parent),h=b.bodyA,f=b.bodyB;var g;u.overlap<c.overlap?g=u:g=c;var y=b.normal,k=b.supports,T=g.axis,S=T.x,E=T.y;S*(f.position.x-h.position.x)+E*(f.position.y-h.position.y)<0?(y.x=S,y.y=E):(y.x=-S,y.y=-E),b.tangent.x=-y.y,b.tangent.y=y.x,b.depth=g.overlap,b.penetration.x=y.x*b.depth,b.penetration.y=y.y*b.depth;var w=i._findSupports(h,f,y,1),_=0;if(a.contains(h.vertices,w[0])&&(k[_++]=w[0]),a.contains(h.vertices,w[1])&&(k[_++]=w[1]),_<2){var A=i._findSupports(f,h,y,-1);a.contains(f.vertices,A[0])&&(k[_++]=A[0]),_<2&&a.contains(f.vertices,A[1])&&(k[_++]=A[1])}return _===0&&(k[_++]=w[0]),k.length=_,b},i._overlapAxes=function(h,f,d,m){var b=f.length,g=d.length,y=f[0].x,k=f[0].y,T=d[0].x,S=d[0].y,E=m.length,w=Number.MAX_VALUE,_=0,A,N,C,L,M,H;for(M=0;M<E;M++){var P=m[M],R=P.x,B=P.y,q=y*R+k*B,F=T*R+S*B,V=q,I=F;for(H=1;H<b;H+=1)L=f[H].x*R+f[H].y*B,L>V?V=L:L<q&&(q=L);for(H=1;H<g;H+=1)L=d[H].x*R+d[H].y*B,L>I?I=L:L<F&&(F=L);if(N=V-F,C=I-q,A=N<C?N:C,A<w&&(w=A,_=M,A<=0))break}h.axis=m[_],h.overlap=w},i._projectToAxis=function(h,f,d){for(var m=f[0].x*d.x+f[0].y*d.y,b=m,g=1;g<f.length;g+=1){var y=f[g].x*d.x+f[g].y*d.y;y>b?b=y:y<m&&(m=y)}h.min=m,h.max=b},i._findSupports=function(h,f,d,m){var b=f.vertices,g=b.length,y=h.position.x,k=h.position.y,T=d.x*m,S=d.y*m,E=Number.MAX_VALUE,w,_,A,N,C;for(C=0;C<g;C+=1)_=b[C],N=T*(y-_.x)+S*(k-_.y),N<E&&(E=N,w=_);return A=b[(g+w.index-1)%g],E=T*(y-A.x)+S*(k-A.y),_=b[(w.index+1)%g],T*(y-_.x)+S*(k-_.y)<E?(l[0]=w,l[1]=_,l):(l[0]=w,l[1]=A,l)}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(16);(function(){i.create=function(o,l){var u=o.bodyA,c=o.bodyB,h={id:i.id(u,c),bodyA:u,bodyB:c,collision:o,contacts:[],activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:u.isSensor||c.isSensor,timeCreated:l,timeUpdated:l,inverseMass:0,friction:0,frictionStatic:0,restitution:0,slop:0};return i.update(h,o,l),h},i.update=function(o,l,u){var c=o.contacts,h=l.supports,f=o.activeContacts,d=l.parentA,m=l.parentB,b=d.vertices.length;o.isActive=!0,o.timeUpdated=u,o.collision=l,o.separation=l.depth,o.inverseMass=d.inverseMass+m.inverseMass,o.friction=d.friction<m.friction?d.friction:m.friction,o.frictionStatic=d.frictionStatic>m.frictionStatic?d.frictionStatic:m.frictionStatic,o.restitution=d.restitution>m.restitution?d.restitution:m.restitution,o.slop=d.slop>m.slop?d.slop:m.slop,l.pair=o,f.length=0;for(var g=0;g<h.length;g++){var y=h[g],k=y.body===d?y.index:b+y.index,T=c[k];T?f.push(T):f.push(c[k]=a.create(y))}},i.setActive=function(o,l,u){l?(o.isActive=!0,o.timeUpdated=u):(o.isActive=!1,o.activeContacts.length=0)},i.id=function(o,l){return o.id<l.id?"A"+o.id+"B"+l.id:"A"+l.id+"B"+o.id}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(3),o=s(2),l=s(7),u=s(1),c=s(11),h=s(0);(function(){i._warming=.4,i._torqueDampen=1,i._minLength=1e-6,i.create=function(f){var d=f;d.bodyA&&!d.pointA&&(d.pointA={x:0,y:0}),d.bodyB&&!d.pointB&&(d.pointB={x:0,y:0});var m=d.bodyA?o.add(d.bodyA.position,d.pointA):d.pointA,b=d.bodyB?o.add(d.bodyB.position,d.pointB):d.pointB,g=o.magnitude(o.sub(m,b));d.length=typeof d.length<"u"?d.length:g,d.id=d.id||h.nextId(),d.label=d.label||"Constraint",d.type="constraint",d.stiffness=d.stiffness||(d.length>0?1:.7),d.damping=d.damping||0,d.angularStiffness=d.angularStiffness||0,d.angleA=d.bodyA?d.bodyA.angle:d.angleA,d.angleB=d.bodyB?d.bodyB.angle:d.angleB,d.plugin={};var y={visible:!0,lineWidth:2,strokeStyle:"#ffffff",type:"line",anchors:!0};return d.length===0&&d.stiffness>.1?(y.type="pin",y.anchors=!1):d.stiffness<.9&&(y.type="spring"),d.render=h.extend(y,d.render),d},i.preSolveAll=function(f){for(var d=0;d<f.length;d+=1){var m=f[d],b=m.constraintImpulse;m.isStatic||b.x===0&&b.y===0&&b.angle===0||(m.position.x+=b.x,m.position.y+=b.y,m.angle+=b.angle)}},i.solveAll=function(f,d){for(var m=h.clamp(d/h._baseDelta,0,1),b=0;b<f.length;b+=1){var g=f[b],y=!g.bodyA||g.bodyA&&g.bodyA.isStatic,k=!g.bodyB||g.bodyB&&g.bodyB.isStatic;(y||k)&&i.solve(f[b],m)}for(b=0;b<f.length;b+=1)g=f[b],y=!g.bodyA||g.bodyA&&g.bodyA.isStatic,k=!g.bodyB||g.bodyB&&g.bodyB.isStatic,!y&&!k&&i.solve(f[b],m)},i.solve=function(f,d){var m=f.bodyA,b=f.bodyB,g=f.pointA,y=f.pointB;if(!(!m&&!b)){m&&!m.isStatic&&(o.rotate(g,m.angle-f.angleA,g),f.angleA=m.angle),b&&!b.isStatic&&(o.rotate(y,b.angle-f.angleB,y),f.angleB=b.angle);var k=g,T=y;if(m&&(k=o.add(m.position,g)),b&&(T=o.add(b.position,y)),!(!k||!T)){var S=o.sub(k,T),E=o.magnitude(S);E<i._minLength&&(E=i._minLength);var w=(E-f.length)/E,_=f.stiffness>=1||f.length===0,A=_?f.stiffness*d:f.stiffness*d*d,N=f.damping*d,C=o.mult(S,w*A),L=(m?m.inverseMass:0)+(b?b.inverseMass:0),M=(m?m.inverseInertia:0)+(b?b.inverseInertia:0),H=L+M,P,R,B,q,F;if(N>0){var V=o.create();B=o.div(S,E),F=o.sub(b&&o.sub(b.position,b.positionPrev)||V,m&&o.sub(m.position,m.positionPrev)||V),q=o.dot(B,F)}m&&!m.isStatic&&(R=m.inverseMass/L,m.constraintImpulse.x-=C.x*R,m.constraintImpulse.y-=C.y*R,m.position.x-=C.x*R,m.position.y-=C.y*R,N>0&&(m.positionPrev.x-=N*B.x*q*R,m.positionPrev.y-=N*B.y*q*R),P=o.cross(g,C)/H*i._torqueDampen*m.inverseInertia*(1-f.angularStiffness),m.constraintImpulse.angle-=P,m.angle-=P),b&&!b.isStatic&&(R=b.inverseMass/L,b.constraintImpulse.x+=C.x*R,b.constraintImpulse.y+=C.y*R,b.position.x+=C.x*R,b.position.y+=C.y*R,N>0&&(b.positionPrev.x+=N*B.x*q*R,b.positionPrev.y+=N*B.y*q*R),P=o.cross(y,C)/H*i._torqueDampen*b.inverseInertia*(1-f.angularStiffness),b.constraintImpulse.angle+=P,b.angle+=P)}}},i.postSolveAll=function(f){for(var d=0;d<f.length;d++){var m=f[d],b=m.constraintImpulse;if(!(m.isStatic||b.x===0&&b.y===0&&b.angle===0)){l.set(m,!1);for(var g=0;g<m.parts.length;g++){var y=m.parts[g];a.translate(y.vertices,b),g>0&&(y.position.x+=b.x,y.position.y+=b.y),b.angle!==0&&(a.rotate(y.vertices,b.angle,m.position),c.rotate(y.axes,b.angle),g>0&&o.rotateAbout(y.position,b.angle,m.position,y.position)),u.update(y.bounds,y.vertices,m.velocity)}b.angle*=i._warming,b.x*=i._warming,b.y*=i._warming}}},i.pointAWorld=function(f){return{x:(f.bodyA?f.bodyA.position.x:0)+(f.pointA?f.pointA.x:0),y:(f.bodyA?f.bodyA.position.y:0)+(f.pointA?f.pointA.y:0)}},i.pointBWorld=function(f){return{x:(f.bodyB?f.bodyB.position.x:0)+(f.pointB?f.pointB.x:0),y:(f.bodyB?f.bodyB.position.y:0)+(f.pointB?f.pointB.y:0)}}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(2),o=s(0);(function(){i.fromVertices=function(l){for(var u={},c=0;c<l.length;c++){var h=(c+1)%l.length,f=a.normalise({x:l[h].y-l[c].y,y:l[c].x-l[h].x}),d=f.y===0?1/0:f.x/f.y;d=d.toFixed(3).toString(),u[d]=f}return o.values(u)},i.rotate=function(l,u){if(u!==0)for(var c=Math.cos(u),h=Math.sin(u),f=0;f<l.length;f++){var d=l[f],m;m=d.x*c-d.y*h,d.y=d.x*h+d.y*c,d.x=m}}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(3),o=s(0),l=s(4),u=s(1),c=s(2);(function(){i.rectangle=function(h,f,d,m,b){b=b||{};var g={label:"Rectangle Body",position:{x:h,y:f},vertices:a.fromPath("L 0 0 L "+d+" 0 L "+d+" "+m+" L 0 "+m)};if(b.chamfer){var y=b.chamfer;g.vertices=a.chamfer(g.vertices,y.radius,y.quality,y.qualityMin,y.qualityMax),delete b.chamfer}return l.create(o.extend({},g,b))},i.trapezoid=function(h,f,d,m,b,g){g=g||{},b*=.5;var y=(1-b*2)*d,k=d*b,T=k+y,S=T+k,E;b<.5?E="L 0 0 L "+k+" "+-m+" L "+T+" "+-m+" L "+S+" 0":E="L 0 0 L "+T+" "+-m+" L "+S+" 0";var w={label:"Trapezoid Body",position:{x:h,y:f},vertices:a.fromPath(E)};if(g.chamfer){var _=g.chamfer;w.vertices=a.chamfer(w.vertices,_.radius,_.quality,_.qualityMin,_.qualityMax),delete g.chamfer}return l.create(o.extend({},w,g))},i.circle=function(h,f,d,m,b){m=m||{};var g={label:"Circle Body",circleRadius:d};b=b||25;var y=Math.ceil(Math.max(10,Math.min(b,d)));return y%2===1&&(y+=1),i.polygon(h,f,y,d,o.extend({},g,m))},i.polygon=function(h,f,d,m,b){if(b=b||{},d<3)return i.circle(h,f,m,b);for(var g=2*Math.PI/d,y="",k=g*.5,T=0;T<d;T+=1){var S=k+T*g,E=Math.cos(S)*m,w=Math.sin(S)*m;y+="L "+E.toFixed(3)+" "+w.toFixed(3)+" "}var _={label:"Polygon Body",position:{x:h,y:f},vertices:a.fromPath(y)};if(b.chamfer){var A=b.chamfer;_.vertices=a.chamfer(_.vertices,A.radius,A.quality,A.qualityMin,A.qualityMax),delete b.chamfer}return l.create(o.extend({},_,b))},i.fromVertices=function(h,f,d,m,b,g,y,k){var T=o.getDecomp(),S,E,w,_,A,N,C,L,M,H,P;for(S=!!(T&&T.quickDecomp),m=m||{},w=[],b=typeof b<"u"?b:!1,g=typeof g<"u"?g:.01,y=typeof y<"u"?y:10,k=typeof k<"u"?k:.01,o.isArray(d[0])||(d=[d]),H=0;H<d.length;H+=1)if(N=d[H],_=a.isConvex(N),A=!_,A&&!S&&o.warnOnce("Bodies.fromVertices: Install the 'poly-decomp' library and use Common.setDecomp or provide 'decomp' as a global to decompose concave vertices."),_||!S)_?N=a.clockwiseSort(N):N=a.hull(N),w.push({position:{x:h,y:f},vertices:N});else{var R=N.map(function(J){return[J.x,J.y]});T.makeCCW(R),g!==!1&&T.removeCollinearPoints(R,g),k!==!1&&T.removeDuplicatePoints&&T.removeDuplicatePoints(R,k);var B=T.quickDecomp(R);for(C=0;C<B.length;C++){var q=B[C],F=q.map(function(J){return{x:J[0],y:J[1]}});y>0&&a.area(F)<y||w.push({position:a.centre(F),vertices:F})}}for(C=0;C<w.length;C++)w[C]=l.create(o.extend(w[C],m));if(b){var V=5;for(C=0;C<w.length;C++){var I=w[C];for(L=C+1;L<w.length;L++){var W=w[L];if(u.overlaps(I.bounds,W.bounds)){var K=I.vertices,D=W.vertices;for(M=0;M<I.vertices.length;M++)for(P=0;P<W.vertices.length;P++){var ne=c.magnitudeSquared(c.sub(K[(M+1)%K.length],D[P])),oe=c.magnitudeSquared(c.sub(K[M],D[(P+1)%D.length]));ne<V&&oe<V&&(K[M].isInternal=!0,D[P].isInternal=!0)}}}}}return w.length>1?(E=l.create(o.extend({parts:w.slice(0)},m)),l.setPosition(E,{x:h,y:f}),E):w[0]}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(0),o=s(8);(function(){i.create=function(l){var u={bodies:[],pairs:null};return a.extend(u,l)},i.setBodies=function(l,u){l.bodies=u.slice(0)},i.clear=function(l){l.bodies=[]},i.collisions=function(l){var u=[],c=l.pairs,h=l.bodies,f=h.length,d=i.canCollide,m=o.collides,b,g;for(h.sort(i._compareBoundsX),b=0;b<f;b++){var y=h[b],k=y.bounds,T=y.bounds.max.x,S=y.bounds.max.y,E=y.bounds.min.y,w=y.isStatic||y.isSleeping,_=y.parts.length,A=_===1;for(g=b+1;g<f;g++){var N=h[g],C=N.bounds;if(C.min.x>T)break;if(!(S<C.min.y||E>C.max.y)&&!(w&&(N.isStatic||N.isSleeping))&&d(y.collisionFilter,N.collisionFilter)){var L=N.parts.length;if(A&&L===1){var M=m(y,N,c);M&&u.push(M)}else for(var H=_>1?1:0,P=L>1?1:0,R=H;R<_;R++)for(var B=y.parts[R],k=B.bounds,q=P;q<L;q++){var F=N.parts[q],C=F.bounds;if(!(k.min.x>C.max.x||k.max.x<C.min.x||k.max.y<C.min.y||k.min.y>C.max.y)){var M=m(B,F,c);M&&u.push(M)}}}}}return u},i.canCollide=function(l,u){return l.group===u.group&&l.group!==0?l.group>0:(l.mask&u.category)!==0&&(u.mask&l.category)!==0},i._compareBoundsX=function(l,u){return l.bounds.min.x-u.bounds.min.x}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(0);(function(){i.create=function(o){var l={};return o||a.log("Mouse.create: element was undefined, defaulting to document.body","warn"),l.element=o||document.body,l.absolute={x:0,y:0},l.position={x:0,y:0},l.mousedownPosition={x:0,y:0},l.mouseupPosition={x:0,y:0},l.offset={x:0,y:0},l.scale={x:1,y:1},l.wheelDelta=0,l.button=-1,l.pixelRatio=parseInt(l.element.getAttribute("data-pixel-ratio"),10)||1,l.sourceEvents={mousemove:null,mousedown:null,mouseup:null,mousewheel:null},l.mousemove=function(u){var c=i._getRelativeMousePosition(u,l.element,l.pixelRatio),h=u.changedTouches;h&&(l.button=0,u.preventDefault()),l.absolute.x=c.x,l.absolute.y=c.y,l.position.x=l.absolute.x*l.scale.x+l.offset.x,l.position.y=l.absolute.y*l.scale.y+l.offset.y,l.sourceEvents.mousemove=u},l.mousedown=function(u){var c=i._getRelativeMousePosition(u,l.element,l.pixelRatio),h=u.changedTouches;h?(l.button=0,u.preventDefault()):l.button=u.button,l.absolute.x=c.x,l.absolute.y=c.y,l.position.x=l.absolute.x*l.scale.x+l.offset.x,l.position.y=l.absolute.y*l.scale.y+l.offset.y,l.mousedownPosition.x=l.position.x,l.mousedownPosition.y=l.position.y,l.sourceEvents.mousedown=u},l.mouseup=function(u){var c=i._getRelativeMousePosition(u,l.element,l.pixelRatio),h=u.changedTouches;h&&u.preventDefault(),l.button=-1,l.absolute.x=c.x,l.absolute.y=c.y,l.position.x=l.absolute.x*l.scale.x+l.offset.x,l.position.y=l.absolute.y*l.scale.y+l.offset.y,l.mouseupPosition.x=l.position.x,l.mouseupPosition.y=l.position.y,l.sourceEvents.mouseup=u},l.mousewheel=function(u){l.wheelDelta=Math.max(-1,Math.min(1,u.wheelDelta||-u.detail)),u.preventDefault()},i.setElement(l,l.element),l},i.setElement=function(o,l){o.element=l,l.addEventListener("mousemove",o.mousemove),l.addEventListener("mousedown",o.mousedown),l.addEventListener("mouseup",o.mouseup),l.addEventListener("mousewheel",o.mousewheel),l.addEventListener("DOMMouseScroll",o.mousewheel),l.addEventListener("touchmove",o.mousemove),l.addEventListener("touchstart",o.mousedown),l.addEventListener("touchend",o.mouseup)},i.clearSourceEvents=function(o){o.sourceEvents.mousemove=null,o.sourceEvents.mousedown=null,o.sourceEvents.mouseup=null,o.sourceEvents.mousewheel=null,o.wheelDelta=0},i.setOffset=function(o,l){o.offset.x=l.x,o.offset.y=l.y,o.position.x=o.absolute.x*o.scale.x+o.offset.x,o.position.y=o.absolute.y*o.scale.y+o.offset.y},i.setScale=function(o,l){o.scale.x=l.x,o.scale.y=l.y,o.position.x=o.absolute.x*o.scale.x+o.offset.x,o.position.y=o.absolute.y*o.scale.y+o.offset.y},i._getRelativeMousePosition=function(o,l,u){var c=l.getBoundingClientRect(),h=document.documentElement||document.body.parentNode||document.body,f=window.pageXOffset!==void 0?window.pageXOffset:h.scrollLeft,d=window.pageYOffset!==void 0?window.pageYOffset:h.scrollTop,m=o.changedTouches,b,g;return m?(b=m[0].pageX-c.left-f,g=m[0].pageY-c.top-d):(b=o.pageX-c.left-f,g=o.pageY-c.top-d),{x:b/(l.clientWidth/(l.width||l.clientWidth)*u),y:g/(l.clientHeight/(l.height||l.clientHeight)*u)}}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(0);(function(){i._registry={},i.register=function(o){if(i.isPlugin(o)||a.warn("Plugin.register:",i.toString(o),"does not implement all required fields."),o.name in i._registry){var l=i._registry[o.name],u=i.versionParse(o.version).number,c=i.versionParse(l.version).number;u>c?(a.warn("Plugin.register:",i.toString(l),"was upgraded to",i.toString(o)),i._registry[o.name]=o):u<c?a.warn("Plugin.register:",i.toString(l),"can not be downgraded to",i.toString(o)):o!==l&&a.warn("Plugin.register:",i.toString(o),"is already registered to different plugin object")}else i._registry[o.name]=o;return o},i.resolve=function(o){return i._registry[i.dependencyParse(o).name]},i.toString=function(o){return typeof o=="string"?o:(o.name||"anonymous")+"@"+(o.version||o.range||"0.0.0")},i.isPlugin=function(o){return o&&o.name&&o.version&&o.install},i.isUsed=function(o,l){return o.used.indexOf(l)>-1},i.isFor=function(o,l){var u=o.for&&i.dependencyParse(o.for);return!o.for||l.name===u.name&&i.versionSatisfies(l.version,u.range)},i.use=function(o,l){if(o.uses=(o.uses||[]).concat(l||[]),o.uses.length===0){a.warn("Plugin.use:",i.toString(o),"does not specify any dependencies to install.");return}for(var u=i.dependencies(o),c=a.topologicalSort(u),h=[],f=0;f<c.length;f+=1)if(c[f]!==o.name){var d=i.resolve(c[f]);if(!d){h.push("❌ "+c[f]);continue}i.isUsed(o,d.name)||(i.isFor(d,o)||(a.warn("Plugin.use:",i.toString(d),"is for",d.for,"but installed on",i.toString(o)+"."),d._warned=!0),d.install?d.install(o):(a.warn("Plugin.use:",i.toString(d),"does not specify an install function."),d._warned=!0),d._warned?(h.push("🔶 "+i.toString(d)),delete d._warned):h.push("✅ "+i.toString(d)),o.used.push(d.name))}h.length>0&&a.info(h.join(" "))},i.dependencies=function(o,l){var u=i.dependencyParse(o),c=u.name;if(l=l||{},!(c in l)){o=i.resolve(o)||o,l[c]=a.map(o.uses||[],function(f){i.isPlugin(f)&&i.register(f);var d=i.dependencyParse(f),m=i.resolve(f);return m&&!i.versionSatisfies(m.version,d.range)?(a.warn("Plugin.dependencies:",i.toString(m),"does not satisfy",i.toString(d),"used by",i.toString(u)+"."),m._warned=!0,o._warned=!0):m||(a.warn("Plugin.dependencies:",i.toString(f),"used by",i.toString(u),"could not be resolved."),o._warned=!0),d.name});for(var h=0;h<l[c].length;h+=1)i.dependencies(l[c][h],l);return l}},i.dependencyParse=function(o){if(a.isString(o)){var l=/^[\w-]+(@(\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-+]+)?))?$/;return l.test(o)||a.warn("Plugin.dependencyParse:",o,"is not a valid dependency string."),{name:o.split("@")[0],range:o.split("@")[1]||"*"}}return{name:o.name,range:o.range||o.version}},i.versionParse=function(o){var l=/^(\*)|(\^|~|>=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-+]+)?$/;l.test(o)||a.warn("Plugin.versionParse:",o,"is not a valid version or range.");var u=l.exec(o),c=Number(u[4]),h=Number(u[5]),f=Number(u[6]);return{isRange:!!(u[1]||u[2]),version:u[3],range:o,operator:u[1]||u[2]||"",major:c,minor:h,patch:f,parts:[c,h,f],prerelease:u[7],number:c*1e8+h*1e4+f}},i.versionSatisfies=function(o,l){l=l||"*";var u=i.versionParse(l),c=i.versionParse(o);if(u.isRange){if(u.operator==="*"||o==="*")return!0;if(u.operator===">")return c.number>u.number;if(u.operator===">=")return c.number>=u.number;if(u.operator==="~")return c.major===u.major&&c.minor===u.minor&&c.patch>=u.patch;if(u.operator==="^")return u.major>0?c.major===u.major&&c.number>=u.number:u.minor>0?c.minor===u.minor&&c.patch>=u.patch:c.patch===u.patch}return o===l||o==="*"}})()}),(function(n,r){var s={};n.exports=s,(function(){s.create=function(i){return{vertex:i,normalImpulse:0,tangentImpulse:0}}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(7),o=s(18),l=s(13),u=s(19),c=s(5),h=s(6),f=s(10),d=s(0),m=s(4);(function(){i.create=function(b){b=b||{};var g={positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},gravity:{x:0,y:1,scale:.001},timing:{timestamp:0,timeScale:1,lastDelta:0,lastElapsed:0}},y=d.extend(g,b);return y.world=b.world||h.create({label:"World"}),y.pairs=b.pairs||u.create(),y.detector=b.detector||l.create(),y.grid={buckets:[]},y.world.gravity=y.gravity,y.broadphase=y.grid,y.metrics={},y},i.update=function(b,g){var y=d.now(),k=b.world,T=b.detector,S=b.pairs,E=b.timing,w=E.timestamp,_;g=typeof g<"u"?g:d._baseDelta,g*=E.timeScale,E.timestamp+=g,E.lastDelta=g;var A={timestamp:E.timestamp,delta:g};c.trigger(b,"beforeUpdate",A);var N=h.allBodies(k),C=h.allConstraints(k);for(k.isModified&&(l.setBodies(T,N),h.setModified(k,!1,!1,!0)),b.enableSleeping&&a.update(N,g),i._bodiesApplyGravity(N,b.gravity),g>0&&i._bodiesUpdate(N,g),f.preSolveAll(N),_=0;_<b.constraintIterations;_++)f.solveAll(C,g);f.postSolveAll(N),T.pairs=b.pairs;var L=l.collisions(T);u.update(S,L,w),b.enableSleeping&&a.afterCollisions(S.list),S.collisionStart.length>0&&c.trigger(b,"collisionStart",{pairs:S.collisionStart});var M=d.clamp(20/b.positionIterations,0,1);for(o.preSolvePosition(S.list),_=0;_<b.positionIterations;_++)o.solvePosition(S.list,g,M);for(o.postSolvePosition(N),f.preSolveAll(N),_=0;_<b.constraintIterations;_++)f.solveAll(C,g);for(f.postSolveAll(N),o.preSolveVelocity(S.list),_=0;_<b.velocityIterations;_++)o.solveVelocity(S.list,g);return i._bodiesUpdateVelocities(N),S.collisionActive.length>0&&c.trigger(b,"collisionActive",{pairs:S.collisionActive}),S.collisionEnd.length>0&&c.trigger(b,"collisionEnd",{pairs:S.collisionEnd}),i._bodiesClearForces(N),c.trigger(b,"afterUpdate",A),b.timing.lastElapsed=d.now()-y,b},i.merge=function(b,g){if(d.extend(b,g),g.world){b.world=g.world,i.clear(b);for(var y=h.allBodies(b.world),k=0;k<y.length;k++){var T=y[k];a.set(T,!1),T.id=d.nextId()}}},i.clear=function(b){u.clear(b.pairs),l.clear(b.detector)},i._bodiesClearForces=function(b){for(var g=b.length,y=0;y<g;y++){var k=b[y];k.force.x=0,k.force.y=0,k.torque=0}},i._bodiesApplyGravity=function(b,g){var y=typeof g.scale<"u"?g.scale:.001,k=b.length;if(!(g.x===0&&g.y===0||y===0))for(var T=0;T<k;T++){var S=b[T];S.isStatic||S.isSleeping||(S.force.y+=S.mass*g.y*y,S.force.x+=S.mass*g.x*y)}},i._bodiesUpdate=function(b,g){for(var y=b.length,k=0;k<y;k++){var T=b[k];T.isStatic||T.isSleeping||m.update(T,g)}},i._bodiesUpdateVelocities=function(b){for(var g=b.length,y=0;y<g;y++)m.updateVelocities(b[y])}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(3),o=s(0),l=s(1);(function(){i._restingThresh=2,i._restingThreshTangent=Math.sqrt(6),i._positionDampen=.9,i._positionWarming=.8,i._frictionNormalMultiplier=5,i._frictionMaxStatic=Number.MAX_VALUE,i.preSolvePosition=function(u){var c,h,f,d=u.length;for(c=0;c<d;c++)h=u[c],h.isActive&&(f=h.activeContacts.length,h.collision.parentA.totalContacts+=f,h.collision.parentB.totalContacts+=f)},i.solvePosition=function(u,c,h){var f,d,m,b,g,y,k,T,S=i._positionDampen*(h||1),E=o.clamp(c/o._baseDelta,0,1),w=u.length;for(f=0;f<w;f++)d=u[f],!(!d.isActive||d.isSensor)&&(m=d.collision,b=m.parentA,g=m.parentB,y=m.normal,d.separation=y.x*(g.positionImpulse.x+m.penetration.x-b.positionImpulse.x)+y.y*(g.positionImpulse.y+m.penetration.y-b.positionImpulse.y));for(f=0;f<w;f++)d=u[f],!(!d.isActive||d.isSensor)&&(m=d.collision,b=m.parentA,g=m.parentB,y=m.normal,T=d.separation-d.slop*E,(b.isStatic||g.isStatic)&&(T*=2),b.isStatic||b.isSleeping||(k=S/b.totalContacts,b.positionImpulse.x+=y.x*T*k,b.positionImpulse.y+=y.y*T*k),g.isStatic||g.isSleeping||(k=S/g.totalContacts,g.positionImpulse.x-=y.x*T*k,g.positionImpulse.y-=y.y*T*k))},i.postSolvePosition=function(u){for(var c=i._positionWarming,h=u.length,f=a.translate,d=l.update,m=0;m<h;m++){var b=u[m],g=b.positionImpulse,y=g.x,k=g.y,T=b.velocity;if(b.totalContacts=0,y!==0||k!==0){for(var S=0;S<b.parts.length;S++){var E=b.parts[S];f(E.vertices,g),d(E.bounds,E.vertices,T),E.position.x+=y,E.position.y+=k}b.positionPrev.x+=y,b.positionPrev.y+=k,y*T.x+k*T.y<0?(g.x=0,g.y=0):(g.x*=c,g.y*=c)}}},i.preSolveVelocity=function(u){var c=u.length,h,f;for(h=0;h<c;h++){var d=u[h];if(!(!d.isActive||d.isSensor)){var m=d.activeContacts,b=m.length,g=d.collision,y=g.parentA,k=g.parentB,T=g.normal,S=g.tangent;for(f=0;f<b;f++){var E=m[f],w=E.vertex,_=E.normalImpulse,A=E.tangentImpulse;if(_!==0||A!==0){var N=T.x*_+S.x*A,C=T.y*_+S.y*A;y.isStatic||y.isSleeping||(y.positionPrev.x+=N*y.inverseMass,y.positionPrev.y+=C*y.inverseMass,y.anglePrev+=y.inverseInertia*((w.x-y.position.x)*C-(w.y-y.position.y)*N)),k.isStatic||k.isSleeping||(k.positionPrev.x-=N*k.inverseMass,k.positionPrev.y-=C*k.inverseMass,k.anglePrev-=k.inverseInertia*((w.x-k.position.x)*C-(w.y-k.position.y)*N))}}}}},i.solveVelocity=function(u,c){var h=c/o._baseDelta,f=h*h,d=f*h,m=-i._restingThresh*h,b=i._restingThreshTangent,g=i._frictionNormalMultiplier*h,y=i._frictionMaxStatic,k=u.length,T,S,E,w;for(E=0;E<k;E++){var _=u[E];if(!(!_.isActive||_.isSensor)){var A=_.collision,N=A.parentA,C=A.parentB,L=N.velocity,M=C.velocity,H=A.normal.x,P=A.normal.y,R=A.tangent.x,B=A.tangent.y,q=_.activeContacts,F=q.length,V=1/F,I=N.inverseMass+C.inverseMass,W=_.friction*_.frictionStatic*g;for(L.x=N.position.x-N.positionPrev.x,L.y=N.position.y-N.positionPrev.y,M.x=C.position.x-C.positionPrev.x,M.y=C.position.y-C.positionPrev.y,N.angularVelocity=N.angle-N.anglePrev,C.angularVelocity=C.angle-C.anglePrev,w=0;w<F;w++){var K=q[w],D=K.vertex,ne=D.x-N.position.x,oe=D.y-N.position.y,J=D.x-C.position.x,Y=D.y-C.position.y,X=L.x-oe*N.angularVelocity,de=L.y+ne*N.angularVelocity,ge=M.x-Y*C.angularVelocity,ee=M.y+J*C.angularVelocity,ie=X-ge,xe=de-ee,Se=H*ie+P*xe,Le=R*ie+B*xe,pe=_.separation+Se,Te=Math.min(pe,1);Te=pe<0?0:Te;var Me=Te*W;Le<-Me||Le>Me?(S=Le>0?Le:-Le,T=_.friction*(Le>0?1:-1)*d,T<-S?T=-S:T>S&&(T=S)):(T=Le,S=y);var te=ne*P-oe*H,Ie=J*P-Y*H,be=V/(I+N.inverseInertia*te*te+C.inverseInertia*Ie*Ie),Fe=(1+_.restitution)*Se*be;if(T*=be,Se<m)K.normalImpulse=0;else{var Qe=K.normalImpulse;K.normalImpulse+=Fe,K.normalImpulse>0&&(K.normalImpulse=0),Fe=K.normalImpulse-Qe}if(Le<-b||Le>b)K.tangentImpulse=0;else{var De=K.tangentImpulse;K.tangentImpulse+=T,K.tangentImpulse<-S&&(K.tangentImpulse=-S),K.tangentImpulse>S&&(K.tangentImpulse=S),T=K.tangentImpulse-De}var st=H*Fe+R*T,Q=P*Fe+B*T;N.isStatic||N.isSleeping||(N.positionPrev.x+=st*N.inverseMass,N.positionPrev.y+=Q*N.inverseMass,N.anglePrev+=(ne*Q-oe*st)*N.inverseInertia),C.isStatic||C.isSleeping||(C.positionPrev.x-=st*C.inverseMass,C.positionPrev.y-=Q*C.inverseMass,C.anglePrev-=(J*Q-Y*st)*C.inverseInertia)}}}}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(9),o=s(0);(function(){i.create=function(l){return o.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},l)},i.update=function(l,u,c){var h=l.list,f=h.length,d=l.table,m=u.length,b=l.collisionStart,g=l.collisionEnd,y=l.collisionActive,k,T,S,E;for(b.length=0,g.length=0,y.length=0,E=0;E<f;E++)h[E].confirmedActive=!1;for(E=0;E<m;E++)k=u[E],S=k.pair,S?(S.isActive?y.push(S):b.push(S),a.update(S,k,c),S.confirmedActive=!0):(S=a.create(k,c),d[S.id]=S,b.push(S),h.push(S));var w=[];for(f=h.length,E=0;E<f;E++)S=h[E],S.confirmedActive||(a.setActive(S,!1,c),g.push(S),!S.collision.bodyA.isSleeping&&!S.collision.bodyB.isSleeping&&w.push(E));for(E=0;E<w.length;E++)T=w[E]-E,S=h[T],h.splice(T,1),delete d[S.id]},i.clear=function(l){return l.table={},l.list.length=0,l.collisionStart.length=0,l.collisionActive.length=0,l.collisionEnd.length=0,l}})()}),(function(n,r,s){var i=n.exports=s(21);i.Axes=s(11),i.Bodies=s(12),i.Body=s(4),i.Bounds=s(1),i.Collision=s(8),i.Common=s(0),i.Composite=s(6),i.Composites=s(22),i.Constraint=s(10),i.Contact=s(16),i.Detector=s(13),i.Engine=s(17),i.Events=s(5),i.Grid=s(23),i.Mouse=s(14),i.MouseConstraint=s(24),i.Pair=s(9),i.Pairs=s(19),i.Plugin=s(15),i.Query=s(25),i.Render=s(26),i.Resolver=s(18),i.Runner=s(27),i.SAT=s(28),i.Sleeping=s(7),i.Svg=s(29),i.Vector=s(2),i.Vertices=s(3),i.World=s(30),i.Engine.run=i.Runner.run,i.Common.deprecated(i.Engine,"run","Engine.run ➤ use Matter.Runner.run(engine) instead")}),(function(n,r,s){var i={};n.exports=i;var a=s(15),o=s(0);(function(){i.name="matter-js",i.version="0.19.0",i.uses=[],i.used=[],i.use=function(){a.use(i,Array.prototype.slice.call(arguments))},i.before=function(l,u){return l=l.replace(/^Matter./,""),o.chainPathBefore(i,l,u)},i.after=function(l,u){return l=l.replace(/^Matter./,""),o.chainPathAfter(i,l,u)}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(6),o=s(10),l=s(0),u=s(4),c=s(12),h=l.deprecated;(function(){i.stack=function(f,d,m,b,g,y,k){for(var T=a.create({label:"Stack"}),S=f,E=d,w,_=0,A=0;A<b;A++){for(var N=0,C=0;C<m;C++){var L=k(S,E,C,A,w,_);if(L){var M=L.bounds.max.y-L.bounds.min.y,H=L.bounds.max.x-L.bounds.min.x;M>N&&(N=M),u.translate(L,{x:H*.5,y:M*.5}),S=L.bounds.max.x+g,a.addBody(T,L),w=L,_+=1}else S+=g}E+=N+y,S=f}return T},i.chain=function(f,d,m,b,g,y){for(var k=f.bodies,T=1;T<k.length;T++){var S=k[T-1],E=k[T],w=S.bounds.max.y-S.bounds.min.y,_=S.bounds.max.x-S.bounds.min.x,A=E.bounds.max.y-E.bounds.min.y,N=E.bounds.max.x-E.bounds.min.x,C={bodyA:S,pointA:{x:_*d,y:w*m},bodyB:E,pointB:{x:N*b,y:A*g}},L=l.extend(C,y);a.addConstraint(f,o.create(L))}return f.label+=" Chain",f},i.mesh=function(f,d,m,b,g){var y=f.bodies,k,T,S,E,w;for(k=0;k<m;k++){for(T=1;T<d;T++)S=y[T-1+k*d],E=y[T+k*d],a.addConstraint(f,o.create(l.extend({bodyA:S,bodyB:E},g)));if(k>0)for(T=0;T<d;T++)S=y[T+(k-1)*d],E=y[T+k*d],a.addConstraint(f,o.create(l.extend({bodyA:S,bodyB:E},g))),b&&T>0&&(w=y[T-1+(k-1)*d],a.addConstraint(f,o.create(l.extend({bodyA:w,bodyB:E},g)))),b&&T<d-1&&(w=y[T+1+(k-1)*d],a.addConstraint(f,o.create(l.extend({bodyA:w,bodyB:E},g))))}return f.label+=" Mesh",f},i.pyramid=function(f,d,m,b,g,y,k){return i.stack(f,d,m,b,g,y,function(T,S,E,w,_,A){var N=Math.min(b,Math.ceil(m/2)),C=_?_.bounds.max.x-_.bounds.min.x:0;if(!(w>N)){w=N-w;var L=w,M=m-1-w;if(!(E<L||E>M)){A===1&&u.translate(_,{x:(E+(m%2===1?1:-1))*C,y:0});var H=_?E*C:0;return k(f+H+E*g,S,E,w,_,A)}}})},i.newtonsCradle=function(f,d,m,b,g){for(var y=a.create({label:"Newtons Cradle"}),k=0;k<m;k++){var T=1.9,S=c.circle(f+k*(b*T),d+g,b,{inertia:1/0,restitution:1,friction:0,frictionAir:1e-4,slop:1}),E=o.create({pointA:{x:f+k*(b*T),y:d},bodyB:S});a.addBody(y,S),a.addConstraint(y,E)}return y},h(i,"newtonsCradle","Composites.newtonsCradle ➤ moved to newtonsCradle example"),i.car=function(f,d,m,b,g){var y=u.nextGroup(!0),k=20,T=-m*.5+k,S=m*.5-k,E=0,w=a.create({label:"Car"}),_=c.rectangle(f,d,m,b,{collisionFilter:{group:y},chamfer:{radius:b*.5},density:2e-4}),A=c.circle(f+T,d+E,g,{collisionFilter:{group:y},friction:.8}),N=c.circle(f+S,d+E,g,{collisionFilter:{group:y},friction:.8}),C=o.create({bodyB:_,pointB:{x:T,y:E},bodyA:A,stiffness:1,length:0}),L=o.create({bodyB:_,pointB:{x:S,y:E},bodyA:N,stiffness:1,length:0});return a.addBody(w,_),a.addBody(w,A),a.addBody(w,N),a.addConstraint(w,C),a.addConstraint(w,L),w},h(i,"car","Composites.car ➤ moved to car example"),i.softBody=function(f,d,m,b,g,y,k,T,S,E){S=l.extend({inertia:1/0},S),E=l.extend({stiffness:.2,render:{type:"line",anchors:!1}},E);var w=i.stack(f,d,m,b,g,y,function(_,A){return c.circle(_,A,T,S)});return i.mesh(w,m,b,k,E),w.label="Soft Body",w},h(i,"softBody","Composites.softBody ➤ moved to softBody and cloth examples")})()}),(function(n,r,s){var i={};n.exports=i;var a=s(9),o=s(0),l=o.deprecated;(function(){i.create=function(u){var c={buckets:{},pairs:{},pairsList:[],bucketWidth:48,bucketHeight:48};return o.extend(c,u)},i.update=function(u,c,h,f){var d,m,b,g=h.world,y=u.buckets,k,T,S=!1;for(d=0;d<c.length;d++){var E=c[d];if(!(E.isSleeping&&!f)&&!(g.bounds&&(E.bounds.max.x<g.bounds.min.x||E.bounds.min.x>g.bounds.max.x||E.bounds.max.y<g.bounds.min.y||E.bounds.min.y>g.bounds.max.y))){var w=i._getRegion(u,E);if(!E.region||w.id!==E.region.id||f){(!E.region||f)&&(E.region=w);var _=i._regionUnion(w,E.region);for(m=_.startCol;m<=_.endCol;m++)for(b=_.startRow;b<=_.endRow;b++){T=i._getBucketId(m,b),k=y[T];var A=m>=w.startCol&&m<=w.endCol&&b>=w.startRow&&b<=w.endRow,N=m>=E.region.startCol&&m<=E.region.endCol&&b>=E.region.startRow&&b<=E.region.endRow;!A&&N&&N&&k&&i._bucketRemoveBody(u,k,E),(E.region===w||A&&!N||f)&&(k||(k=i._createBucket(y,T)),i._bucketAddBody(u,k,E))}E.region=w,S=!0}}}S&&(u.pairsList=i._createActivePairsList(u))},l(i,"update","Grid.update ➤ replaced by Matter.Detector"),i.clear=function(u){u.buckets={},u.pairs={},u.pairsList=[]},l(i,"clear","Grid.clear ➤ replaced by Matter.Detector"),i._regionUnion=function(u,c){var h=Math.min(u.startCol,c.startCol),f=Math.max(u.endCol,c.endCol),d=Math.min(u.startRow,c.startRow),m=Math.max(u.endRow,c.endRow);return i._createRegion(h,f,d,m)},i._getRegion=function(u,c){var h=c.bounds,f=Math.floor(h.min.x/u.bucketWidth),d=Math.floor(h.max.x/u.bucketWidth),m=Math.floor(h.min.y/u.bucketHeight),b=Math.floor(h.max.y/u.bucketHeight);return i._createRegion(f,d,m,b)},i._createRegion=function(u,c,h,f){return{id:u+","+c+","+h+","+f,startCol:u,endCol:c,startRow:h,endRow:f}},i._getBucketId=function(u,c){return"C"+u+"R"+c},i._createBucket=function(u,c){var h=u[c]=[];return h},i._bucketAddBody=function(u,c,h){var f=u.pairs,d=a.id,m=c.length,b;for(b=0;b<m;b++){var g=c[b];if(!(h.id===g.id||h.isStatic&&g.isStatic)){var y=d(h,g),k=f[y];k?k[2]+=1:f[y]=[h,g,1]}}c.push(h)},i._bucketRemoveBody=function(u,c,h){var f=u.pairs,d=a.id,m;c.splice(o.indexOf(c,h),1);var b=c.length;for(m=0;m<b;m++){var g=f[d(h,c[m])];g&&(g[2]-=1)}},i._createActivePairsList=function(u){var c,h=u.pairs,f=o.keys(h),d=f.length,m=[],b;for(b=0;b<d;b++)c=h[f[b]],c[2]>0?m.push(c):delete h[f[b]];return m}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(3),o=s(7),l=s(14),u=s(5),c=s(13),h=s(10),f=s(6),d=s(0),m=s(1);(function(){i.create=function(b,g){var y=(b?b.mouse:null)||(g?g.mouse:null);y||(b&&b.render&&b.render.canvas?y=l.create(b.render.canvas):g&&g.element?y=l.create(g.element):(y=l.create(),d.warn("MouseConstraint.create: options.mouse was undefined, options.element was undefined, may not function as expected")));var k=h.create({label:"Mouse Constraint",pointA:y.position,pointB:{x:0,y:0},length:.01,stiffness:.1,angularStiffness:1,render:{strokeStyle:"#90EE90",lineWidth:3}}),T={type:"mouseConstraint",mouse:y,element:null,body:null,constraint:k,collisionFilter:{category:1,mask:4294967295,group:0}},S=d.extend(T,g);return u.on(b,"beforeUpdate",function(){var E=f.allBodies(b.world);i.update(S,E),i._triggerEvents(S)}),S},i.update=function(b,g){var y=b.mouse,k=b.constraint,T=b.body;if(y.button===0){if(k.bodyB)o.set(k.bodyB,!1),k.pointA=y.position;else for(var S=0;S<g.length;S++)if(T=g[S],m.contains(T.bounds,y.position)&&c.canCollide(T.collisionFilter,b.collisionFilter))for(var E=T.parts.length>1?1:0;E<T.parts.length;E++){var w=T.parts[E];if(a.contains(w.vertices,y.position)){k.pointA=y.position,k.bodyB=b.body=T,k.pointB={x:y.position.x-T.position.x,y:y.position.y-T.position.y},k.angleB=T.angle,o.set(T,!1),u.trigger(b,"startdrag",{mouse:y,body:T});break}}}else k.bodyB=b.body=null,k.pointB=null,T&&u.trigger(b,"enddrag",{mouse:y,body:T})},i._triggerEvents=function(b){var g=b.mouse,y=g.sourceEvents;y.mousemove&&u.trigger(b,"mousemove",{mouse:g}),y.mousedown&&u.trigger(b,"mousedown",{mouse:g}),y.mouseup&&u.trigger(b,"mouseup",{mouse:g}),l.clearSourceEvents(g)}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(2),o=s(8),l=s(1),u=s(12),c=s(3);(function(){i.collides=function(h,f){for(var d=[],m=f.length,b=h.bounds,g=o.collides,y=l.overlaps,k=0;k<m;k++){var T=f[k],S=T.parts.length,E=S===1?0:1;if(y(T.bounds,b))for(var w=E;w<S;w++){var _=T.parts[w];if(y(_.bounds,b)){var A=g(_,h);if(A){d.push(A);break}}}}return d},i.ray=function(h,f,d,m){m=m||1e-100;for(var b=a.angle(f,d),g=a.magnitude(a.sub(f,d)),y=(d.x+f.x)*.5,k=(d.y+f.y)*.5,T=u.rectangle(y,k,g,m,{angle:b}),S=i.collides(T,h),E=0;E<S.length;E+=1){var w=S[E];w.body=w.bodyB=w.bodyA}return S},i.region=function(h,f,d){for(var m=[],b=0;b<h.length;b++){var g=h[b],y=l.overlaps(g.bounds,f);(y&&!d||!y&&d)&&m.push(g)}return m},i.point=function(h,f){for(var d=[],m=0;m<h.length;m++){var b=h[m];if(l.contains(b.bounds,f))for(var g=b.parts.length===1?0:1;g<b.parts.length;g++){var y=b.parts[g];if(l.contains(y.bounds,f)&&c.contains(y.vertices,f)){d.push(b);break}}}return d}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(4),o=s(0),l=s(6),u=s(1),c=s(5),h=s(2),f=s(14);(function(){var d,m;typeof window<"u"&&(d=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(E){window.setTimeout(function(){E(o.now())},1e3/60)},m=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame),i._goodFps=30,i._goodDelta=1e3/60,i.create=function(E){var w={engine:null,element:null,canvas:null,mouse:null,frameRequestId:null,timing:{historySize:60,delta:0,deltaHistory:[],lastTime:0,lastTimestamp:0,lastElapsed:0,timestampElapsed:0,timestampElapsedHistory:[],engineDeltaHistory:[],engineElapsedHistory:[],elapsedHistory:[]},options:{width:800,height:600,pixelRatio:1,background:"#14151f",wireframeBackground:"#14151f",hasBounds:!!E.bounds,enabled:!0,wireframes:!0,showSleeping:!0,showDebug:!1,showStats:!1,showPerformance:!1,showBounds:!1,showVelocity:!1,showCollisions:!1,showSeparations:!1,showAxes:!1,showPositions:!1,showAngleIndicator:!1,showIds:!1,showVertexNumbers:!1,showConvexHulls:!1,showInternalEdges:!1,showMousePosition:!1}},_=o.extend(w,E);return _.canvas&&(_.canvas.width=_.options.width||_.canvas.width,_.canvas.height=_.options.height||_.canvas.height),_.mouse=E.mouse,_.engine=E.engine,_.canvas=_.canvas||y(_.options.width,_.options.height),_.context=_.canvas.getContext("2d"),_.textures={},_.bounds=_.bounds||{min:{x:0,y:0},max:{x:_.canvas.width,y:_.canvas.height}},_.controller=i,_.options.showBroadphase=!1,_.options.pixelRatio!==1&&i.setPixelRatio(_,_.options.pixelRatio),o.isElement(_.element)&&_.element.appendChild(_.canvas),_},i.run=function(E){(function w(_){E.frameRequestId=d(w),b(E,_),i.world(E,_),(E.options.showStats||E.options.showDebug)&&i.stats(E,E.context,_),(E.options.showPerformance||E.options.showDebug)&&i.performance(E,E.context,_)})()},i.stop=function(E){m(E.frameRequestId)},i.setPixelRatio=function(E,w){var _=E.options,A=E.canvas;w==="auto"&&(w=k(A)),_.pixelRatio=w,A.setAttribute("data-pixel-ratio",w),A.width=_.width*w,A.height=_.height*w,A.style.width=_.width+"px",A.style.height=_.height+"px"},i.lookAt=function(E,w,_,A){A=typeof A<"u"?A:!0,w=o.isArray(w)?w:[w],_=_||{x:0,y:0};for(var N={min:{x:1/0,y:1/0},max:{x:-1/0,y:-1/0}},C=0;C<w.length;C+=1){var L=w[C],M=L.bounds?L.bounds.min:L.min||L.position||L,H=L.bounds?L.bounds.max:L.max||L.position||L;M&&H&&(M.x<N.min.x&&(N.min.x=M.x),H.x>N.max.x&&(N.max.x=H.x),M.y<N.min.y&&(N.min.y=M.y),H.y>N.max.y&&(N.max.y=H.y))}var P=N.max.x-N.min.x+2*_.x,R=N.max.y-N.min.y+2*_.y,B=E.canvas.height,q=E.canvas.width,F=q/B,V=P/R,I=1,W=1;V>F?W=V/F:I=F/V,E.options.hasBounds=!0,E.bounds.min.x=N.min.x,E.bounds.max.x=N.min.x+P*I,E.bounds.min.y=N.min.y,E.bounds.max.y=N.min.y+R*W,A&&(E.bounds.min.x+=P*.5-P*I*.5,E.bounds.max.x+=P*.5-P*I*.5,E.bounds.min.y+=R*.5-R*W*.5,E.bounds.max.y+=R*.5-R*W*.5),E.bounds.min.x-=_.x,E.bounds.max.x-=_.x,E.bounds.min.y-=_.y,E.bounds.max.y-=_.y,E.mouse&&(f.setScale(E.mouse,{x:(E.bounds.max.x-E.bounds.min.x)/E.canvas.width,y:(E.bounds.max.y-E.bounds.min.y)/E.canvas.height}),f.setOffset(E.mouse,E.bounds.min))},i.startViewTransform=function(E){var w=E.bounds.max.x-E.bounds.min.x,_=E.bounds.max.y-E.bounds.min.y,A=w/E.options.width,N=_/E.options.height;E.context.setTransform(E.options.pixelRatio/A,0,0,E.options.pixelRatio/N,0,0),E.context.translate(-E.bounds.min.x,-E.bounds.min.y)},i.endViewTransform=function(E){E.context.setTransform(E.options.pixelRatio,0,0,E.options.pixelRatio,0,0)},i.world=function(E,w){var _=o.now(),A=E.engine,N=A.world,C=E.canvas,L=E.context,M=E.options,H=E.timing,P=l.allBodies(N),R=l.allConstraints(N),B=M.wireframes?M.wireframeBackground:M.background,q=[],F=[],V,I={timestamp:A.timing.timestamp};if(c.trigger(E,"beforeRender",I),E.currentBackground!==B&&S(E,B),L.globalCompositeOperation="source-in",L.fillStyle="transparent",L.fillRect(0,0,C.width,C.height),L.globalCompositeOperation="source-over",M.hasBounds){for(V=0;V<P.length;V++){var W=P[V];u.overlaps(W.bounds,E.bounds)&&q.push(W)}for(V=0;V<R.length;V++){var K=R[V],D=K.bodyA,ne=K.bodyB,oe=K.pointA,J=K.pointB;D&&(oe=h.add(D.position,K.pointA)),ne&&(J=h.add(ne.position,K.pointB)),!(!oe||!J)&&(u.contains(E.bounds,oe)||u.contains(E.bounds,J))&&F.push(K)}i.startViewTransform(E),E.mouse&&(f.setScale(E.mouse,{x:(E.bounds.max.x-E.bounds.min.x)/E.options.width,y:(E.bounds.max.y-E.bounds.min.y)/E.options.height}),f.setOffset(E.mouse,E.bounds.min))}else F=R,q=P,E.options.pixelRatio!==1&&E.context.setTransform(E.options.pixelRatio,0,0,E.options.pixelRatio,0,0);!M.wireframes||A.enableSleeping&&M.showSleeping?i.bodies(E,q,L):(M.showConvexHulls&&i.bodyConvexHulls(E,q,L),i.bodyWireframes(E,q,L)),M.showBounds&&i.bodyBounds(E,q,L),(M.showAxes||M.showAngleIndicator)&&i.bodyAxes(E,q,L),M.showPositions&&i.bodyPositions(E,q,L),M.showVelocity&&i.bodyVelocity(E,q,L),M.showIds&&i.bodyIds(E,q,L),M.showSeparations&&i.separations(E,A.pairs.list,L),M.showCollisions&&i.collisions(E,A.pairs.list,L),M.showVertexNumbers&&i.vertexNumbers(E,q,L),M.showMousePosition&&i.mousePosition(E,E.mouse,L),i.constraints(F,L),M.hasBounds&&i.endViewTransform(E),c.trigger(E,"afterRender",I),H.lastElapsed=o.now()-_},i.stats=function(E,w,_){for(var A=E.engine,N=A.world,C=l.allBodies(N),L=0,M=55,H=44,P=0,R=0,B=0;B<C.length;B+=1)L+=C[B].parts.length;var q={Part:L,Body:C.length,Cons:l.allConstraints(N).length,Comp:l.allComposites(N).length,Pair:A.pairs.list.length};w.fillStyle="#0e0f19",w.fillRect(P,R,M*5.5,H),w.font="12px Arial",w.textBaseline="top",w.textAlign="right";for(var F in q){var V=q[F];w.fillStyle="#aaa",w.fillText(F,P+M,R+8),w.fillStyle="#eee",w.fillText(V,P+M,R+26),P+=M}},i.performance=function(E,w){var _=E.engine,A=E.timing,N=A.deltaHistory,C=A.elapsedHistory,L=A.timestampElapsedHistory,M=A.engineDeltaHistory,H=A.engineElapsedHistory,P=_.timing.lastDelta,R=g(N),B=g(C),q=g(M),F=g(H),V=g(L),I=V/R||0,W=1e3/R||0,K=4,D=12,ne=60,oe=34,J=10,Y=69;w.fillStyle="#0e0f19",w.fillRect(0,50,D*4+ne*5+22,oe),i.status(w,J,Y,ne,K,N.length,Math.round(W)+" fps",W/i._goodFps,function(X){return N[X]/R-1}),i.status(w,J+D+ne,Y,ne,K,M.length,P.toFixed(2)+" dt",i._goodDelta/P,function(X){return M[X]/q-1}),i.status(w,J+(D+ne)*2,Y,ne,K,H.length,F.toFixed(2)+" ut",1-F/i._goodFps,function(X){return H[X]/F-1}),i.status(w,J+(D+ne)*3,Y,ne,K,C.length,B.toFixed(2)+" rt",1-B/i._goodFps,function(X){return C[X]/B-1}),i.status(w,J+(D+ne)*4,Y,ne,K,L.length,I.toFixed(2)+" x",I*I*I,function(X){return(L[X]/N[X]/I||0)-1})},i.status=function(E,w,_,A,N,C,L,M,H){E.strokeStyle="#888",E.fillStyle="#444",E.lineWidth=1,E.fillRect(w,_+7,A,1),E.beginPath(),E.moveTo(w,_+7-N*o.clamp(.4*H(0),-2,2));for(var P=0;P<A;P+=1)E.lineTo(w+P,_+7-(P<C?N*o.clamp(.4*H(P),-2,2):0));E.stroke(),E.fillStyle="hsl("+o.clamp(25+95*M,0,120)+",100%,60%)",E.fillRect(w,_-7,4,4),E.font="12px Arial",E.textBaseline="middle",E.textAlign="right",E.fillStyle="#eee",E.fillText(L,w+A,_-5)},i.constraints=function(E,w){for(var _=w,A=0;A<E.length;A++){var N=E[A];if(!(!N.render.visible||!N.pointA||!N.pointB)){var C=N.bodyA,L=N.bodyB,M,H;if(C?M=h.add(C.position,N.pointA):M=N.pointA,N.render.type==="pin")_.beginPath(),_.arc(M.x,M.y,3,0,2*Math.PI),_.closePath();else{if(L?H=h.add(L.position,N.pointB):H=N.pointB,_.beginPath(),_.moveTo(M.x,M.y),N.render.type==="spring")for(var P=h.sub(H,M),R=h.perp(h.normalise(P)),B=Math.ceil(o.clamp(N.length/5,12,20)),q,F=1;F<B;F+=1)q=F%2===0?1:-1,_.lineTo(M.x+P.x*(F/B)+R.x*q*4,M.y+P.y*(F/B)+R.y*q*4);_.lineTo(H.x,H.y)}N.render.lineWidth&&(_.lineWidth=N.render.lineWidth,_.strokeStyle=N.render.strokeStyle,_.stroke()),N.render.anchors&&(_.fillStyle=N.render.strokeStyle,_.beginPath(),_.arc(M.x,M.y,3,0,2*Math.PI),_.arc(H.x,H.y,3,0,2*Math.PI),_.closePath(),_.fill())}}},i.bodies=function(E,w,_){var A=_;E.engine;var N=E.options,C=N.showInternalEdges||!N.wireframes,L,M,H,P;for(H=0;H<w.length;H++)if(L=w[H],!!L.render.visible){for(P=L.parts.length>1?1:0;P<L.parts.length;P++)if(M=L.parts[P],!!M.render.visible){if(N.showSleeping&&L.isSleeping?A.globalAlpha=.5*M.render.opacity:M.render.opacity!==1&&(A.globalAlpha=M.render.opacity),M.render.sprite&&M.render.sprite.texture&&!N.wireframes){var R=M.render.sprite,B=T(E,R.texture);A.translate(M.position.x,M.position.y),A.rotate(M.angle),A.drawImage(B,B.width*-R.xOffset*R.xScale,B.height*-R.yOffset*R.yScale,B.width*R.xScale,B.height*R.yScale),A.rotate(-M.angle),A.translate(-M.position.x,-M.position.y)}else{if(M.circleRadius)A.beginPath(),A.arc(M.position.x,M.position.y,M.circleRadius,0,2*Math.PI);else{A.beginPath(),A.moveTo(M.vertices[0].x,M.vertices[0].y);for(var q=1;q<M.vertices.length;q++)!M.vertices[q-1].isInternal||C?A.lineTo(M.vertices[q].x,M.vertices[q].y):A.moveTo(M.vertices[q].x,M.vertices[q].y),M.vertices[q].isInternal&&!C&&A.moveTo(M.vertices[(q+1)%M.vertices.length].x,M.vertices[(q+1)%M.vertices.length].y);A.lineTo(M.vertices[0].x,M.vertices[0].y),A.closePath()}N.wireframes?(A.lineWidth=1,A.strokeStyle="#bbb",A.stroke()):(A.fillStyle=M.render.fillStyle,M.render.lineWidth&&(A.lineWidth=M.render.lineWidth,A.strokeStyle=M.render.strokeStyle,A.stroke()),A.fill())}A.globalAlpha=1}}},i.bodyWireframes=function(E,w,_){var A=_,N=E.options.showInternalEdges,C,L,M,H,P;for(A.beginPath(),M=0;M<w.length;M++)if(C=w[M],!!C.render.visible)for(P=C.parts.length>1?1:0;P<C.parts.length;P++){for(L=C.parts[P],A.moveTo(L.vertices[0].x,L.vertices[0].y),H=1;H<L.vertices.length;H++)!L.vertices[H-1].isInternal||N?A.lineTo(L.vertices[H].x,L.vertices[H].y):A.moveTo(L.vertices[H].x,L.vertices[H].y),L.vertices[H].isInternal&&!N&&A.moveTo(L.vertices[(H+1)%L.vertices.length].x,L.vertices[(H+1)%L.vertices.length].y);A.lineTo(L.vertices[0].x,L.vertices[0].y)}A.lineWidth=1,A.strokeStyle="#bbb",A.stroke()},i.bodyConvexHulls=function(E,w,_){var A=_,N,C,L;for(A.beginPath(),C=0;C<w.length;C++)if(N=w[C],!(!N.render.visible||N.parts.length===1)){for(A.moveTo(N.vertices[0].x,N.vertices[0].y),L=1;L<N.vertices.length;L++)A.lineTo(N.vertices[L].x,N.vertices[L].y);A.lineTo(N.vertices[0].x,N.vertices[0].y)}A.lineWidth=1,A.strokeStyle="rgba(255,255,255,0.2)",A.stroke()},i.vertexNumbers=function(E,w,_){var A=_,N,C,L;for(N=0;N<w.length;N++){var M=w[N].parts;for(L=M.length>1?1:0;L<M.length;L++){var H=M[L];for(C=0;C<H.vertices.length;C++)A.fillStyle="rgba(255,255,255,0.2)",A.fillText(N+"_"+C,H.position.x+(H.vertices[C].x-H.position.x)*.8,H.position.y+(H.vertices[C].y-H.position.y)*.8)}}},i.mousePosition=function(E,w,_){var A=_;A.fillStyle="rgba(255,255,255,0.8)",A.fillText(w.position.x+" "+w.position.y,w.position.x+5,w.position.y-5)},i.bodyBounds=function(E,w,_){var A=_;E.engine;var N=E.options;A.beginPath();for(var C=0;C<w.length;C++){var L=w[C];if(L.render.visible)for(var M=w[C].parts,H=M.length>1?1:0;H<M.length;H++){var P=M[H];A.rect(P.bounds.min.x,P.bounds.min.y,P.bounds.max.x-P.bounds.min.x,P.bounds.max.y-P.bounds.min.y)}}N.wireframes?A.strokeStyle="rgba(255,255,255,0.08)":A.strokeStyle="rgba(0,0,0,0.1)",A.lineWidth=1,A.stroke()},i.bodyAxes=function(E,w,_){var A=_;E.engine;var N=E.options,C,L,M,H;for(A.beginPath(),L=0;L<w.length;L++){var P=w[L],R=P.parts;if(P.render.visible)if(N.showAxes)for(M=R.length>1?1:0;M<R.length;M++)for(C=R[M],H=0;H<C.axes.length;H++){var B=C.axes[H];A.moveTo(C.position.x,C.position.y),A.lineTo(C.position.x+B.x*20,C.position.y+B.y*20)}else for(M=R.length>1?1:0;M<R.length;M++)for(C=R[M],H=0;H<C.axes.length;H++)A.moveTo(C.position.x,C.position.y),A.lineTo((C.vertices[0].x+C.vertices[C.vertices.length-1].x)/2,(C.vertices[0].y+C.vertices[C.vertices.length-1].y)/2)}N.wireframes?(A.strokeStyle="indianred",A.lineWidth=1):(A.strokeStyle="rgba(255, 255, 255, 0.4)",A.globalCompositeOperation="overlay",A.lineWidth=2),A.stroke(),A.globalCompositeOperation="source-over"},i.bodyPositions=function(E,w,_){var A=_;E.engine;var N=E.options,C,L,M,H;for(A.beginPath(),M=0;M<w.length;M++)if(C=w[M],!!C.render.visible)for(H=0;H<C.parts.length;H++)L=C.parts[H],A.arc(L.position.x,L.position.y,3,0,2*Math.PI,!1),A.closePath();for(N.wireframes?A.fillStyle="indianred":A.fillStyle="rgba(0,0,0,0.5)",A.fill(),A.beginPath(),M=0;M<w.length;M++)C=w[M],C.render.visible&&(A.arc(C.positionPrev.x,C.positionPrev.y,2,0,2*Math.PI,!1),A.closePath());A.fillStyle="rgba(255,165,0,0.8)",A.fill()},i.bodyVelocity=function(E,w,_){var A=_;A.beginPath();for(var N=0;N<w.length;N++){var C=w[N];if(C.render.visible){var L=a.getVelocity(C);A.moveTo(C.position.x,C.position.y),A.lineTo(C.position.x+L.x,C.position.y+L.y)}}A.lineWidth=3,A.strokeStyle="cornflowerblue",A.stroke()},i.bodyIds=function(E,w,_){var A=_,N,C;for(N=0;N<w.length;N++)if(w[N].render.visible){var L=w[N].parts;for(C=L.length>1?1:0;C<L.length;C++){var M=L[C];A.font="12px Arial",A.fillStyle="rgba(255,255,255,0.5)",A.fillText(M.id,M.position.x+10,M.position.y-10)}}},i.collisions=function(E,w,_){var A=_,N=E.options,C,L,M,H;for(A.beginPath(),M=0;M<w.length;M++)if(C=w[M],!!C.isActive)for(L=C.collision,H=0;H<C.activeContacts.length;H++){var P=C.activeContacts[H],R=P.vertex;A.rect(R.x-1.5,R.y-1.5,3.5,3.5)}for(N.wireframes?A.fillStyle="rgba(255,255,255,0.7)":A.fillStyle="orange",A.fill(),A.beginPath(),M=0;M<w.length;M++)if(C=w[M],!!C.isActive&&(L=C.collision,C.activeContacts.length>0)){var B=C.activeContacts[0].vertex.x,q=C.activeContacts[0].vertex.y;C.activeContacts.length===2&&(B=(C.activeContacts[0].vertex.x+C.activeContacts[1].vertex.x)/2,q=(C.activeContacts[0].vertex.y+C.activeContacts[1].vertex.y)/2),L.bodyB===L.supports[0].body||L.bodyA.isStatic===!0?A.moveTo(B-L.normal.x*8,q-L.normal.y*8):A.moveTo(B+L.normal.x*8,q+L.normal.y*8),A.lineTo(B,q)}N.wireframes?A.strokeStyle="rgba(255,165,0,0.7)":A.strokeStyle="orange",A.lineWidth=1,A.stroke()},i.separations=function(E,w,_){var A=_,N=E.options,C,L,M,H,P;for(A.beginPath(),P=0;P<w.length;P++)if(C=w[P],!!C.isActive){L=C.collision,M=L.bodyA,H=L.bodyB;var R=1;!H.isStatic&&!M.isStatic&&(R=.5),H.isStatic&&(R=0),A.moveTo(H.position.x,H.position.y),A.lineTo(H.position.x-L.penetration.x*R,H.position.y-L.penetration.y*R),R=1,!H.isStatic&&!M.isStatic&&(R=.5),M.isStatic&&(R=0),A.moveTo(M.position.x,M.position.y),A.lineTo(M.position.x+L.penetration.x*R,M.position.y+L.penetration.y*R)}N.wireframes?A.strokeStyle="rgba(255,165,0,0.5)":A.strokeStyle="orange",A.stroke()},i.inspector=function(E,w){E.engine;var _=E.selected,A=E.render,N=A.options,C;if(N.hasBounds){var L=A.bounds.max.x-A.bounds.min.x,M=A.bounds.max.y-A.bounds.min.y,H=L/A.options.width,P=M/A.options.height;w.scale(1/H,1/P),w.translate(-A.bounds.min.x,-A.bounds.min.y)}for(var R=0;R<_.length;R++){var B=_[R].data;switch(w.translate(.5,.5),w.lineWidth=1,w.strokeStyle="rgba(255,165,0,0.9)",w.setLineDash([1,2]),B.type){case"body":C=B.bounds,w.beginPath(),w.rect(Math.floor(C.min.x-3),Math.floor(C.min.y-3),Math.floor(C.max.x-C.min.x+6),Math.floor(C.max.y-C.min.y+6)),w.closePath(),w.stroke();break;case"constraint":var q=B.pointA;B.bodyA&&(q=B.pointB),w.beginPath(),w.arc(q.x,q.y,10,0,2*Math.PI),w.closePath(),w.stroke();break}w.setLineDash([]),w.translate(-.5,-.5)}E.selectStart!==null&&(w.translate(.5,.5),w.lineWidth=1,w.strokeStyle="rgba(255,165,0,0.6)",w.fillStyle="rgba(255,165,0,0.1)",C=E.selectBounds,w.beginPath(),w.rect(Math.floor(C.min.x),Math.floor(C.min.y),Math.floor(C.max.x-C.min.x),Math.floor(C.max.y-C.min.y)),w.closePath(),w.stroke(),w.fill(),w.translate(-.5,-.5)),N.hasBounds&&w.setTransform(1,0,0,1,0,0)};var b=function(E,w){var _=E.engine,A=E.timing,N=A.historySize,C=_.timing.timestamp;A.delta=w-A.lastTime||i._goodDelta,A.lastTime=w,A.timestampElapsed=C-A.lastTimestamp||0,A.lastTimestamp=C,A.deltaHistory.unshift(A.delta),A.deltaHistory.length=Math.min(A.deltaHistory.length,N),A.engineDeltaHistory.unshift(_.timing.lastDelta),A.engineDeltaHistory.length=Math.min(A.engineDeltaHistory.length,N),A.timestampElapsedHistory.unshift(A.timestampElapsed),A.timestampElapsedHistory.length=Math.min(A.timestampElapsedHistory.length,N),A.engineElapsedHistory.unshift(_.timing.lastElapsed),A.engineElapsedHistory.length=Math.min(A.engineElapsedHistory.length,N),A.elapsedHistory.unshift(A.lastElapsed),A.elapsedHistory.length=Math.min(A.elapsedHistory.length,N)},g=function(E){for(var w=0,_=0;_<E.length;_+=1)w+=E[_];return w/E.length||0},y=function(E,w){var _=document.createElement("canvas");return _.width=E,_.height=w,_.oncontextmenu=function(){return!1},_.onselectstart=function(){return!1},_},k=function(E){var w=E.getContext("2d"),_=window.devicePixelRatio||1,A=w.webkitBackingStorePixelRatio||w.mozBackingStorePixelRatio||w.msBackingStorePixelRatio||w.oBackingStorePixelRatio||w.backingStorePixelRatio||1;return _/A},T=function(E,w){var _=E.textures[w];return _||(_=E.textures[w]=new Image,_.src=w,_)},S=function(E,w){var _=w;/(jpg|gif|png)$/.test(w)&&(_="url("+w+")"),E.canvas.style.background=_,E.canvas.style.backgroundSize="contain",E.currentBackground=w}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(5),o=s(17),l=s(0);(function(){var u,c;if(typeof window<"u"&&(u=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame,c=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame),!u){var h;u=function(f){h=setTimeout(function(){f(l.now())},1e3/60)},c=function(){clearTimeout(h)}}i.create=function(f){var d={fps:60,deltaSampleSize:60,counterTimestamp:0,frameCounter:0,deltaHistory:[],timePrev:null,frameRequestId:null,isFixed:!1,enabled:!0},m=l.extend(d,f);return m.delta=m.delta||1e3/m.fps,m.deltaMin=m.deltaMin||1e3/m.fps,m.deltaMax=m.deltaMax||1e3/(m.fps*.5),m.fps=1e3/m.delta,m},i.run=function(f,d){return typeof f.positionIterations<"u"&&(d=f,f=i.create()),(function m(b){f.frameRequestId=u(m),b&&f.enabled&&i.tick(f,d,b)})(),f},i.tick=function(f,d,m){var b=d.timing,g;f.isFixed?g=f.delta:(g=m-f.timePrev||f.delta,f.timePrev=m,f.deltaHistory.push(g),f.deltaHistory=f.deltaHistory.slice(-f.deltaSampleSize),g=Math.min.apply(null,f.deltaHistory),g=g<f.deltaMin?f.deltaMin:g,g=g>f.deltaMax?f.deltaMax:g,f.delta=g);var y={timestamp:b.timestamp};a.trigger(f,"beforeTick",y),f.frameCounter+=1,m-f.counterTimestamp>=1e3&&(f.fps=f.frameCounter*((m-f.counterTimestamp)/1e3),f.counterTimestamp=m,f.frameCounter=0),a.trigger(f,"tick",y),a.trigger(f,"beforeUpdate",y),o.update(d,g),a.trigger(f,"afterUpdate",y),a.trigger(f,"afterTick",y)},i.stop=function(f){c(f.frameRequestId)},i.start=function(f,d){i.run(f,d)}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(8),o=s(0),l=o.deprecated;(function(){i.collides=function(u,c){return a.collides(u,c)},l(i,"collides","SAT.collides ➤ replaced by Collision.collides")})()}),(function(n,r,s){var i={};n.exports=i,s(1);var a=s(0);(function(){i.pathToVertices=function(o,l){typeof window<"u"&&!("SVGPathSeg"in window)&&a.warn("Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.");var u,c,h,f,d,m,b,g,y,k,T=[],S,E,w=0,_=0,A=0;l=l||15;var N=function(L,M,H){var P=H%2===1&&H>1;if(!y||L!=y.x||M!=y.y){y&&P?(S=y.x,E=y.y):(S=0,E=0);var R={x:S+L,y:E+M};(P||!y)&&(y=R),T.push(R),_=S+L,A=E+M}},C=function(L){var M=L.pathSegTypeAsLetter.toUpperCase();if(M!=="Z"){switch(M){case"M":case"L":case"T":case"C":case"S":case"Q":_=L.x,A=L.y;break;case"H":_=L.x;break;case"V":A=L.y;break}N(_,A,L.pathSegType)}};for(i._svgPathToAbsolute(o),h=o.getTotalLength(),m=[],u=0;u<o.pathSegList.numberOfItems;u+=1)m.push(o.pathSegList.getItem(u));for(b=m.concat();w<h;){if(k=o.getPathSegAtLength(w),d=m[k],d!=g){for(;b.length&&b[0]!=d;)C(b.shift());g=d}switch(d.pathSegTypeAsLetter.toUpperCase()){case"C":case"T":case"S":case"Q":case"A":f=o.getPointAtLength(w),N(f.x,f.y,0);break}w+=l}for(u=0,c=b.length;u<c;++u)C(b[u]);return T},i._svgPathToAbsolute=function(o){for(var l,u,c,h,f,d,m=o.pathSegList,b=0,g=0,y=m.numberOfItems,k=0;k<y;++k){var T=m.getItem(k),S=T.pathSegTypeAsLetter;if(/[MLHVCSQTA]/.test(S))"x"in T&&(b=T.x),"y"in T&&(g=T.y);else switch("x1"in T&&(c=b+T.x1),"x2"in T&&(f=b+T.x2),"y1"in T&&(h=g+T.y1),"y2"in T&&(d=g+T.y2),"x"in T&&(b+=T.x),"y"in T&&(g+=T.y),S){case"m":m.replaceItem(o.createSVGPathSegMovetoAbs(b,g),k);break;case"l":m.replaceItem(o.createSVGPathSegLinetoAbs(b,g),k);break;case"h":m.replaceItem(o.createSVGPathSegLinetoHorizontalAbs(b),k);break;case"v":m.replaceItem(o.createSVGPathSegLinetoVerticalAbs(g),k);break;case"c":m.replaceItem(o.createSVGPathSegCurvetoCubicAbs(b,g,c,h,f,d),k);break;case"s":m.replaceItem(o.createSVGPathSegCurvetoCubicSmoothAbs(b,g,f,d),k);break;case"q":m.replaceItem(o.createSVGPathSegCurvetoQuadraticAbs(b,g,c,h),k);break;case"t":m.replaceItem(o.createSVGPathSegCurvetoQuadraticSmoothAbs(b,g),k);break;case"a":m.replaceItem(o.createSVGPathSegArcAbs(b,g,T.r1,T.r2,T.angle,T.largeArcFlag,T.sweepFlag),k);break;case"z":case"Z":b=l,g=u;break}(S=="M"||S=="m")&&(l=b,u=g)}}})()}),(function(n,r,s){var i={};n.exports=i;var a=s(6);s(0),(function(){i.create=a.create,i.add=a.add,i.remove=a.remove,i.clear=a.clear,i.addComposite=a.addComposite,i.addBody=a.addBody,i.addConstraint=a.addConstraint})()})])})})(_s)),_s.exports}var ly=oy();const bn=Yl(ly);{const e=bn.Resolver;e&&typeof e._restingThresh=="number"&&(e._restingThresh=1.4)}const uy=6,Ut=28,xn=.92,Va=1.12,cy=34;function Mc(e,t,n){return Math.hypot(t-e.startX,n-e.startY)<uy?"click":"drag"}function dy(e){const t=e.length;if(t===0)return"";const n=s=>`${s.x.toFixed(1)} ${s.y.toFixed(1)}`;if(t===1)return`M ${n(e[0])}`;if(t===2)return`M ${n(e[0])} L ${n(e[1])}`;let r=`M ${n(e[0])}`;for(let s=1;s<t-1;s++){const i=e[s],a=e[s+1];r+=` Q ${n(i)} ${((i.x+a.x)/2).toFixed(1)} ${((i.y+a.y)/2).toFixed(1)}`}return`${r} L ${n(e[t-1])}`}function hy(e,t){return e*Math.exp(-t/90)}function fy(e,t,n,r){const s=`translate3d(${e.toFixed(1)}px, ${t.toFixed(1)}px, 0)`;if(n<.01)return s;const i=r*180/Math.PI,a=Math.min(.35,n);return`${s} rotate(${i.toFixed(1)}deg) scale(${(1+a).toFixed(3)}, ${(1-a).toFixed(3)}) rotate(${(-i).toFixed(1)}deg)`}const Nm=4e-5,my=5e-4;function Im(e,t,n){return Math.sin(n*37e-5+t*.0013)*.6+Math.sin(n*19e-5+e*7e-4+1.7)*.4}function Rm(e){switch(e){case"storm":return{wind:.95,gust:1,rainRate:.006,snowRate:0,airDrag:1.05};case"rain":return{wind:.6,gust:.25,rainRate:.004,snowRate:0,airDrag:1};case"snow":return{wind:.25,gust:0,rainRate:0,snowRate:4e-4,airDrag:1};case"fog":return{wind:.06,gust:0,rainRate:0,snowRate:0,airDrag:1.7};case"cloudy":return{wind:.4,gust:.1,rainRate:0,snowRate:0,airDrag:1};case"clear":default:return{wind:.3,gust:0,rainRate:0,snowRate:0,airDrag:1}}}function Pm(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t^=t>>>16,t=Math.imul(t,2246822507),t^=t>>>13,t=Math.imul(t,3266489909),t^=t>>>16,(t>>>0)/4294967295}const Yr=120,py=.9,Lc=.7,gy=.09,by=2.2,xy=2,qa=Ut*2.45,yy=.006,Wa=22,$a=.06;function Ey(e){var H;const t=e.ballRadius??Ut,n=Rm(e.weather??"clear"),{Engine:r,Bodies:s,Body:i,Composite:a,Constraint:o,Events:l}=bn,u=r.create();u.gravity.y=1,u.positionIterations=8,u.velocityIterations=4;const c=e.nodes.map(P=>{var F,V;const R=((F=P.spawn)==null?void 0:F.x)??P.x,B=((V=P.spawn)==null?void 0:V.y)??P.y,q=s.circle(R,B,t,{restitution:.5,friction:.01,frictionAir:.03*n.airDrag,density:P.isExam?.0016:.001,inertia:1/0,isStatic:!!P.locked,collisionFilter:{group:0,category:2,mask:6}});return{nodeId:P.id,body:q,layoutX:P.x,layoutY:P.y,isExam:!!P.isExam,snow:0,field:0,squash:0,squashAngle:0}});for(const P of c){a.add(u.world,P.body);const R=(H=e.nodes.find(B=>B.id===P.nodeId))==null?void 0:H.spawn;R&&(R.vx!==void 0||R.vy!==void 0)&&i.setVelocity(P.body,{x:R.vx??0,y:R.vy??0})}const h=Yr/2,f={isStatic:!0,restitution:.4,friction:.05,collisionFilter:{category:4,mask:2}},d=(P,R)=>({x:Math.min(e.width-t,Math.max(t,P)),y:Math.min(e.height-t,Math.max(t,R))});a.add(u.world,[s.rectangle(e.width/2,-h,e.width*3,Yr,f),s.rectangle(e.width/2,e.height+h,e.width*3,Yr,f),s.rectangle(-h,e.height/2,Yr,e.height*3,f),s.rectangle(e.width+h,e.height/2,Yr,e.height*3,f)]);const m=P=>({x:P.body.position.x,y:P.body.position.y+t*xn}),b=[];function g(P,R,B,q,F){return"body"in P?o.create({bodyA:P.body,pointA:P.offset,bodyB:R,pointB:B,length:q,stiffness:F,damping:.05}):o.create({pointA:P.point,bodyB:R,pointB:B,length:q,stiffness:F,damping:.05})}function y(P,R,B,q){const F={x:B.body.position.x,y:B.body.position.y+t*xn},V=F.x-P.x,I=F.y-P.y,W=Math.max(60,Math.hypot(V,I)),K=Math.max(5,Math.min(14,Math.round(W/cy))),D=W*Va/K,ne=[];let oe=R?{body:R,offset:{x:P.x-R.position.x,y:P.y-R.position.y}}:{point:P},J=!0;for(let Y=1;Y<K;Y++){const X=Y/K,de=Math.sin(Math.PI*X)*W*(Va-1)*.85,ge=s.circle(P.x+V*X,P.y+I*X+de,3.5,{density:7e-4,frictionAir:.1*n.airDrag,collisionFilter:{category:8,mask:0}});ne.push(ge),a.add(u.world,ge),a.add(u.world,g(oe,ge,void 0,D,J?Lc:py)),J=!1,oe={body:ge,offset:{x:0,y:0}}}a.add(u.world,g(oe,B.body,{x:0,y:t*xn},D,Lc)),b.push({from:q,to:B.nodeId,restLen:W*Va,particles:ne})}const k=c[0],T=k?{x:e.anchorKnotX??k.layoutX,y:$s}:{x:e.width/2,y:$s};k&&y(T,null,k,"__anchor");for(let P=0;P<c.length-1;P++){const R=c[P],B=c[P+1];y(m(R),R.body,B,R.nodeId)}const S=c[c.length-1],E=e.nextKnot&&(S!=null&&S.isExam)?e.nextKnot:void 0;E&&S&&y(E,null,S,"__next");const w=new Map;for(const P of c){let R=0;for(const q of b)if(q.from===P.nodeId||q.to===P.nodeId)for(const F of q.particles)R+=F.mass*.5;const B=Math.min(.25,R/P.body.mass);w.set(P.nodeId,(1+B)*(.96+Pm(P.nodeId)*.08))}let _=0,A=1;l.on(u,"beforeUpdate",()=>{const P=u.timing.timestamp;_*=.97,n.gust>0&&Math.random()<.0025*n.gust&&(_=n.gust*(.6+Math.random()*.4),A=Math.random()<.5?-1:1);for(const R of c){const B=R.body.mass,q=u.gravity.y*u.gravity.scale,F=Im(R.body.position.x,R.body.position.y,P)*n.wind*Nm*B+A*_*my*B;let V=-B*q*(w.get(R.nodeId)??1);n.rainRate>0&&Math.random()<n.rainRate&&(V+=B*q*.35,i.applyForce(R.body,R.body.position,{x:(Math.random()-.5)*B*q*.3,y:0})),i.applyForce(R.body,R.body.position,{x:F,y:V})}});const N=[],C=(P,R,B,q)=>{if(P.snow<=$a)return;const F=Math.max(1,Math.min(q,Math.round(P.snow*q)+1));for(let V=0;V<F;V++){const I=-(.35+Math.random()*1.9),W=t*(.55+Math.random()*.45);N.push({x:P.body.position.x+Math.cos(I)*W,y:P.body.position.y+Math.sin(I)*W,vx:P.body.velocity.x*.75+R.x*(.5+Math.random()*1.8)+(Math.random()-.5)*1.2,vy:P.body.velocity.y*.75+R.y*(.5+Math.random()*1.8)-.6-Math.random()*.8,amount:.02+Math.min(.05,B*.004)})}P.snow=Math.max($a*.5,P.snow-F*(.03+Math.min(.07,B*.005))),N.length>96&&N.splice(0,N.length-96)},L=[];l.on(u,"collisionStart",P=>{var R;for(const B of P.pairs){const{bodyA:q,bodyB:F}=B,V=c.find(J=>J.body===q),I=c.find(J=>J.body===F);if(!V&&!I)continue;const W={x:q.velocity.x-F.velocity.x,y:q.velocity.y-F.velocity.y},K=Math.hypot(W.x,W.y);if(K<by)continue;const D=B.collision.normal,ne=(R=B.collision.supports)==null?void 0:R[0];L.push(ne?{x:ne.x,y:ne.y,speed:K}:{x:(q.position.x+F.position.x)/2,y:(q.position.y+F.position.y)/2,speed:K}),L.length>64&&L.shift();const oe=Math.min(.32,K*.028);V&&oe>V.squash&&(V.squash=oe,V.squashAngle=Math.atan2(D.y,D.x)),I&&oe>I.squash&&(I.squash=oe,I.squashAngle=Math.atan2(-D.y,-D.x)),V&&C(V,{x:D.x,y:D.y},K,5),I&&C(I,{x:-D.x,y:-D.y},K,5)}}),l.on(u,"afterUpdate",()=>{if(!(n.snowRate<=0))for(const P of c)P.snow=Math.min(1,P.snow+n.snowRate)});let M=null;return{balls:c,links:b,anchor:T,nextKnot:E,ball(P){return c.find(R=>R.nodeId===P)},step(P){r.update(u,Math.min(33,Math.max(8,P)));for(let R=0;R<c.length;R++){const B=c[R];for(let q=R+1;q<c.length;q++){const F=c[q],V=F.body.position.x-B.body.position.x,I=F.body.position.y-B.body.position.y,W=V*V+I*I;if(W>=qa*qa||W<.01)continue;const K=Math.sqrt(W),D=(K-2*t)/(qa-2*t),ne=D<=0?1:D>=1?0:1-D,J=Math.hypot(B.body.velocity.x-F.body.velocity.x,B.body.velocity.y-F.body.velocity.y)<1.2?yy*ne*ne:0,Y=V/K,X=I/K;B.body.isStatic||i.applyForce(B.body,B.body.position,{x:-Y*J*B.body.mass,y:-X*J*B.body.mass}),F.body.isStatic||i.applyForce(F.body,F.body.position,{x:Y*J*F.body.mass,y:X*J*F.body.mass}),B.field=Math.max(B.field,ne),F.field=Math.max(F.field,ne)}}for(const R of c)R.field*=.88;for(const R of c){if(R.body.isStatic)continue;const B=R.body.velocity,q=Math.hypot(B.x,B.y);q>Wa&&i.setVelocity(R.body,{x:B.x/q*Wa,y:B.y/q*Wa})}for(let R=0;R<c.length;R++){const B=c[R];for(let q=R+1;q<c.length;q++){const F=c[q];let V=F.body.position.x-B.body.position.x,I=F.body.position.y-B.body.position.y,W=Math.hypot(V,I);if(W>=t*2)continue;W<.01&&(V=1,I=0,W=1);const K=t*2-W+.05,D=V/W,ne=I/W;B.body.isStatic&&F.body.isStatic||(B.body.isStatic?i.setPosition(F.body,{x:F.body.position.x+D*K,y:F.body.position.y+ne*K}):F.body.isStatic?i.setPosition(B.body,{x:B.body.position.x-D*K,y:B.body.position.y-ne*K}):(i.setPosition(B.body,{x:B.body.position.x-D*K/2,y:B.body.position.y-ne*K/2}),i.setPosition(F.body,{x:F.body.position.x+D*K/2,y:F.body.position.y+ne*K/2})))}}for(const R of c){const B=Math.hypot(R.body.velocity.x,R.body.velocity.y);R.snow>$a&&B>xy&&C(R,{x:R.body.velocity.x/B,y:R.body.velocity.y/B},B,2)}for(const R of c){if(R.body.isStatic)continue;const B=R.body.position.x,q=R.body.position.y,F=Math.min(e.width-t,Math.max(t,B)),V=Math.min(e.height-t,Math.max(t,q));(F!==B||V!==q)&&(i.setPosition(R.body,{x:F,y:V}),i.setVelocity(R.body,{x:B<t||B>e.width-t?0:R.body.velocity.x,y:q<t||q>e.height-t?0:R.body.velocity.y}))}},beginDrag(P,R,B){this.endDrag();const q=this.ball(P);if(!q)return;const F=o.create({pointA:d(R,B),bodyB:q.body,length:0,stiffness:gy,damping:.12});a.add(u.world,F),M={constraint:F,nodeId:P}},moveDrag(P,R){if(!M)return;const B=d(P,R);M.constraint.pointA=B},endDrag(){M&&(a.remove(u.world,M.constraint),M=null)},isDragging(){return M!==null},drainImpacts(){const P=L.slice();return L.length=0,P},drainFlakes(){const P=N.slice();return N.length=0,P},dispose(){this.endDrag(),l.off(u,"beforeUpdate"),l.off(u,"afterUpdate"),l.off(u,"collisionStart"),a.clear(u.world,!1),r.clear(u)}}}const $s=-12;function us(e,t,n=20){return t<=n*2?t/2:n+Pm(e)*(t-n*2)}function vy(e,t,n,r=Ut){if(t<=0||Math.abs(t-n)<=1)return e;const s=n/t,i={x:Math.min(n-r,Math.max(r,e.x*s)),y:e.y,vy:e.vy};return e.vx!==void 0&&(i.vx=e.vx*s),i}const tr=(e,t,n)=>e+(t-e)*n,ma=(e,t,n)=>e<t?t:e>n?n:e,Ci=e=>e<0?0:e>1?1:e*e*(3-2*e);function nr(e,t,n){return[tr(e[0],t[0],n),tr(e[1],t[1],n),tr(e[2],t[2],n)]}const Ya=e=>`rgb(${e[0]|0},${e[1]|0},${e[2]|0})`,Mr=(e,t)=>`rgba(${e[0]|0},${e[1]|0},${e[2]|0},${t})`;function pa(){return[{t:0,top:[8,10,26],mid:[16,20,44],hor:[34,30,58]},{t:.12,top:[30,32,72],mid:[78,56,104],hor:[158,100,116]},{t:.22,top:[124,156,214],mid:[232,152,120],hor:[250,196,128]},{t:.36,top:[80,142,196],mid:[132,186,226],hor:[188,214,232]},{t:.5,top:[60,120,178],mid:[108,168,212],hor:[168,200,226]},{t:.62,top:[120,132,152],mid:[150,150,160],hor:[180,178,182]},{t:.74,top:[70,60,88],mid:[108,78,110],hor:[180,110,100]},{t:.86,top:[40,30,60],mid:[88,44,76],hor:[168,72,72]},{t:1,top:[8,10,26],mid:[16,20,44],hor:[34,30,58]}]}function ga(e,t){return e.map(n=>({t:n.t,top:t(n.top),mid:t(n.mid),hor:t(n.hor)}))}const Ga=()=>ga(pa(),e=>[e[0]*1,e[1]*1.15,e[2]*.7]),cs=()=>ga(pa(),e=>[e[0]*.75,e[1]*1,Math.min(255,e[2]*1.25)]),Ka=()=>ga(pa(),e=>[Math.min(255,e[0]*1.35),e[1]*.8,e[2]*.55]),Dc=()=>ga(pa(),e=>{const t=(e[0]+e[1]+e[2])/3;return[t*.7+e[0]*.1,t*.7+e[1]*.1,t*.95+e[2]*.15]}),Xa={far:[28,50,36],near:[56,110,52],snowy:!1},ds={far:[20,48,30],near:[34,82,40],snowy:!1},Qa={far:[54,36,24],near:[128,78,36],snowy:!1},Oc={far:[60,66,82],near:[232,236,244],snowy:!0};function Ht(e){return t=>{let n=e;return t>.3&&t<.5?n=tr(n,Math.min(1,n+.2),Ci((t-.3)/.2)):t>=.5&&t<.74?n=Math.min(1,n+.15):t>=.74&&t<.84&&(n=tr(n,Math.max(0,n-.3),Ci((t-.74)/.1))),ma(n,0,1)}}const Mm={"spring|clear":{season:"spring",weather:"clear",sky:Ga(),cloudCover:Ht(.1),particles:"none",lightning:!1,fogAlpha:0,ground:Xa},"spring|cloudy":{season:"spring",weather:"cloudy",sky:Ga(),cloudCover:Ht(.5),particles:"none",lightning:!1,fogAlpha:0,ground:Xa},"spring|rain":{season:"spring",weather:"rain",sky:Ga(),cloudCover:Ht(.85),particles:"rain",lightning:!1,fogAlpha:0,ground:Xa},"summer|clear":{season:"summer",weather:"clear",sky:cs(),cloudCover:Ht(.1),particles:"none",lightning:!1,fogAlpha:0,ground:ds},"summer|cloudy":{season:"summer",weather:"cloudy",sky:cs(),cloudCover:Ht(.5),particles:"none",lightning:!1,fogAlpha:0,ground:ds},"summer|rain":{season:"summer",weather:"rain",sky:cs(),cloudCover:Ht(.85),particles:"rain",lightning:!1,fogAlpha:0,ground:ds},"summer|storm":{season:"summer",weather:"storm",sky:cs(),cloudCover:Ht(1),particles:"rain",lightning:!0,fogAlpha:0,ground:ds},"autumn|clear":{season:"autumn",weather:"clear",sky:Ka(),cloudCover:Ht(.15),particles:"none",lightning:!1,fogAlpha:0,ground:Qa,sunTint:[255,180,110]},"autumn|cloudy":{season:"autumn",weather:"cloudy",sky:Ka(),cloudCover:Ht(.55),particles:"none",lightning:!1,fogAlpha:0,ground:Qa},"autumn|storm":{season:"autumn",weather:"storm",sky:Ka(),cloudCover:Ht(1),particles:"rain",lightning:!0,fogAlpha:0,ground:Qa},"winter|clear":{season:"winter",weather:"clear",sky:Dc(),cloudCover:Ht(.2),particles:"none",lightning:!1,fogAlpha:0,ground:Oc,sunTint:[220,230,245]},"winter|snow":{season:"winter",weather:"snow",sky:Dc(),cloudCover:Ht(.9),particles:"snow",lightning:!1,fogAlpha:.2,ground:Oc}},Bc=Object.keys(Mm);function Ty(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t^=t>>>16,t=Math.imul(t,2246822507),t^=t>>>13,t=Math.imul(t,3266489909),t^=t>>>16,t>>>0}function ky(e){const t=`${e??"none"}:${Math.floor(performance.now()/1e3)}`;return Bc[Ty(t)%Bc.length]}function wy(e,t){let n=0;for(;n<t.length-1&&e>t[n+1].t;)n++;const r=t[n],s=t[Math.min(n+1,t.length-1)],i=Ci(ma((e-r.t)/(s.t-r.t||1),0,1));return{top:nr(r.top,s.top,i),mid:nr(r.mid,s.mid,i),hor:nr(r.hor,s.hor,i)}}function Sy(e,t,n,r,s){if(e<r||e>s)return null;const i=(e-r)/(s-r),a=tr(.1,.9,i),o=n*.26,l=n*.98,u=l-Math.sin(i*Math.PI)*(l-o);return{x:a*t,y:u,peakness:Math.sin(i*Math.PI)}}function Ay(e,t,n,r,s){let i;if(e>=r)i=(e-r)/(1-r+s);else if(e<=s)i=(1-r+e)/(1-r+s);else return null;const a=tr(.12,.88,i),o=n*.26,l=n*.98,u=l-Math.sin(i*Math.PI)*(l-o);return{x:a*t,y:u,peakness:Math.sin(i*Math.PI)}}function Lm(e){return function(){e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function Fc(e,t){const n=Lm(20260809),r=Math.max(28,Math.round(e*t/7e3)),s=[];for(let i=0;i<r;i++)s.push({x:n(),y:n()*.7,r:n()*1.2+.3,tw:n()*Math.PI*2,sp:.6+n()*1.4,big:n()<.06});return s}function Cy(){const e=Lm(7),t=[];for(let n=0;n<6;n++)t.push({x:e(),y:.12+e()*.4,s:.55+e()*1.2,speed:18e-6+e()*35e-6,seed:e()*1e3,drift:e()*.035+.008});return t}function _y(e,t,n,r){const s=e.createLinearGradient(0,0,0,r);s.addColorStop(0,Ya(t.top)),s.addColorStop(.55,Ya(t.mid)),s.addColorStop(1,Ya(t.hor)),e.fillStyle=s,e.fillRect(0,0,n,r)}function Ny(e,t,n,r,s,i){let a=0;if(t<.22?a=Ci(1-t/.22):t>.8&&(a=Ci((t-.8)/.2)),!(a<=.01))for(const o of n){const l=.55+.45*Math.sin(i*o.sp+o.tw),u=a*l;if(u<.02)continue;e.fillStyle=`rgba(255,248,228,${u})`;const c=o.big?o.r*1.8:o.r;e.beginPath(),e.arc(o.x*r,o.y*s,c,0,Math.PI*2),e.fill(),o.big&&(e.fillStyle=`rgba(255,240,210,${u*.35})`,e.fillRect(o.x*r-c*4,o.y*s-.4,c*8,.8),e.fillRect(o.x*r-.4,o.y*s-c*4,.8,c*8))}}function Iy(e,t,n){if(!t)return;const{x:r,y:s,peakness:i}=t,a=28+i*8,o=e.createRadialGradient(r,s,a*.4,r,s,a*5);o.addColorStop(0,"rgba(255,236,190,0.55)"),o.addColorStop(.4,"rgba(255,210,150,0.16)"),o.addColorStop(1,"rgba(255,200,140,0)"),e.fillStyle=o,e.fillRect(r-a*5,s-a*5,a*10,a*10);const l=e.createRadialGradient(r,s,0,r,s,a),u=n??[255,236,180],c=n?nr(n,[255,214,150],.5):[255,214,150];l.addColorStop(0,"rgba(255,252,238,1)"),l.addColorStop(.7,Mr(u,1)),l.addColorStop(1,Mr(c,.9)),e.fillStyle=l,e.beginPath(),e.arc(r,s,a,0,Math.PI*2),e.fill()}function Ry(e,t){if(!t)return;const{x:n,y:r}=t,s=24,i=e.createRadialGradient(n,r,s*.8,n,r,s*5);i.addColorStop(0,"rgba(220,232,255,0.38)"),i.addColorStop(.5,"rgba(220,232,255,0.1)"),i.addColorStop(1,"rgba(220,232,255,0)"),e.fillStyle=i,e.fillRect(n-s*5,r-s*5,s*10,s*10);const a=e.createRadialGradient(n-s*.25,r-s*.3,s*.2,n,r,s);a.addColorStop(0,"rgba(255,254,247,1)"),a.addColorStop(.7,"rgba(244,242,232,1)"),a.addColorStop(1,"rgba(214,222,236,1)"),e.fillStyle=a,e.beginPath(),e.arc(n,r,s,0,Math.PI*2),e.fill(),e.fillStyle="rgba(150,160,180,0.16)";const o=[[-10,-6,4],[5,3,5],[-3,9,3],[11,-8,3]];for(const[l,u,c]of o)e.beginPath(),e.arc(n+l,r+u,c,0,Math.PI*2),e.fill()}function Py(e,t,n,r,s,i){const a=18*r,o=[[0,0,1],[-1.1,.1,.8],[1.1,.1,.8],[-.5,-.5,.7],[.6,-.45,.75],[-1.8,.3,.6],[1.8,.3,.6]];e.save(),e.translate(t,n),e.fillStyle=Mr([s[0]*.7,s[1]*.7,s[2]*.78],i*.9);for(const[l,u,c]of o)e.beginPath(),e.arc(l*a,u*a*1.1+a*.45,a*c*1.05,0,Math.PI*2),e.fill();e.fillStyle=Mr(s,i);for(const[l,u,c]of o)e.beginPath(),e.arc(l*a,u*a,a*c,0,Math.PI*2),e.fill();e.restore()}function My(e,t,n,r,s,i,a,o,l){const u=a(t);if(u<.02)return;const c=nr(o.hor,[255,255,255],.35),h=nr(o.mid,[20,20,30],.45),f=l?h:c;for(let d=0;d<n.length;d++){const m=n[d],b=(m.x+i*m.speed)%1.2-.1,g=m.y+Math.sin(i*1e-4+m.seed)*m.drift;d/n.length<u&&Py(e,b*r,g*s,m.s,f,ma(u*.92,0,.92))}}const Er=[];let Gn=[];const ii=[];let Kn=[];const hs=[],Gr=[];let si=[];function Ly(e,t,n,r,s,i){if(s<.04)return;const a=r*(.02+s*.07),o=.12+s*.73,l=t-r*o,u=t+r*o,c=n-Math.sqrt(Math.max(0,r*r-r*o*(r*o))),h=n-r-a,f=(c+h)/2;e.save(),e.beginPath(),e.moveTo(l,c),e.bezierCurveTo(l,f,t-r*.3,h,t,h),e.bezierCurveTo(t+r*.3,h,u,f,u,c),e.quadraticCurveTo(t,n-r*.78,l,c),e.closePath();const d=e.createLinearGradient(0,h,0,c);d.addColorStop(0,"rgba(255,255,255,0.98)"),d.addColorStop(.65,"rgba(245,250,255,0.95)"),d.addColorStop(1,"rgba(218,230,246,0.9)"),e.fillStyle=d,e.fill(),e.strokeStyle="rgba(168,192,225,0.28)",e.lineWidth=1.5,e.beginPath(),e.moveTo(l,c),e.quadraticCurveTo(t,n-r*.78,u,c),e.stroke(),e.restore()}function Za(e,t,n,r,s){const i=Math.sin(r),a=Math.cos(r);return{x:e+Math.sin(s)*i*n,y:t-a*n}}function Dy(e,t,n,r){e.save(),e.beginPath(),e.arc(t,n,r*.99,0,Math.PI*2),e.clip();const s=e.createRadialGradient(t-r*.35,n-r*.4,0,t-r*.35,n-r*.4,r*.8);s.addColorStop(0,"rgba(255,255,255,0.4)"),s.addColorStop(.5,"rgba(255,255,255,0.12)"),s.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=s,e.fillRect(t-r,n-r,r*2,r*2),e.strokeStyle="rgba(255,255,255,0.55)",e.lineWidth=1.8,e.beginPath(),e.arc(t,n,r*.92,Math.PI*1.15,Math.PI*1.5),e.stroke(),e.restore()}function Oy(e,t){if(t.length!==0){e.save();for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.x+=r.vx,r.y+=r.vy,r.vy+=.14,r.vx*=.985,r.vy*=.99,r.life--,r.life<=0){t.splice(n,1);continue}const s=r.life/r.maxLife;e.fillStyle=`rgba(248,250,255,${(.9*s).toFixed(3)})`,e.beginPath(),e.arc(r.x,r.y,r.r*(.5+.5*s),0,Math.PI*2),e.fill()}e.restore()}}function Dm(e,t){e.save();for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.x+=r.vx,r.y+=r.vy,r.vy+=.18,r.life--,r.life<=0){t.splice(n,1);continue}const s=Math.min(1,r.life/20)*.8;e.fillStyle=`rgba(215,238,255,${s})`,e.beginPath(),e.arc(r.x,r.y,1.3,0,Math.PI*2),e.fill()}e.restore()}function By(e,t,n,r,s,i){e.save(),e.beginPath(),e.arc(t,n,r*.99,0,Math.PI*2),e.clip();for(let a=s.length-1;a>=0;a--){const o=s[a];if(o.prog+=o.speed,o.life--,o.prog>Math.PI*1.05||o.life<=0){s.splice(a,1);continue}const l=7;for(let h=0;h<l;h++){const f=o.prog-o.len*(h/l),d=o.prog-o.len*((h+1)/l),m=Za(t,n,r,f,o.theta),b=Za(t,n,r,d,o.theta),g=(1-h/l)*.42;e.strokeStyle=`rgba(200,228,250,${g})`,e.lineWidth=o.thick*(1-h/l*.7),e.lineCap="round",e.beginPath(),e.moveTo(m.x,m.y),e.lineTo(b.x,b.y),e.stroke()}const u=Za(t,n,r,o.prog,o.theta),c=e.createRadialGradient(u.x-1.2,u.y-1.2,0,u.x,u.y,o.thick*1.3);c.addColorStop(0,"rgba(255,255,255,0.85)"),c.addColorStop(.4,"rgba(180,215,240,0.5)"),c.addColorStop(1,"rgba(120,165,205,0.25)"),e.fillStyle=c,e.beginPath(),e.arc(u.x,u.y,o.thick*1.1,0,Math.PI*2),e.fill()}e.restore()}function Fy(e,t,n,r){for(;Er.length<t.length;)Er.push([]);for(;Gn.length<t.length;)Gn.push(0);for(;si.length<t.length;)si.push(.3);for(;ii.length<t.length;)ii.push([]);for(;Kn.length<t.length;)Kn.push(0);for(let s=0;s<t.length;s++){const i=t[s];if(n.particles==="snow"){const a=i.snow!==void 0?i.snow:Math.min(1,(si[s]??.3)+8e-4);si[s]=a,Ly(e,i.x,i.y,i.r,a)}else if(n.particles==="rain"){if(Dy(e,i.x,i.y,i.r),Gn[s]=Gn[s]-1,Gn[s]<=0&&Er[s].length<3){const a=Math.random()<.5?-1:1;Er[s].push({theta:a*(.2+Math.random()*.3),prog:.1+Math.random()*.2,speed:.012+Math.random()*.012,len:.3+Math.random()*.3,thick:1.6+Math.random()*1.4,life:250+Math.random()*200}),Gn[s]=40+Math.random()*60}if(By(e,i.x,i.y,i.r,Er[s]),Kn[s]=Kn[s]-1,Kn[s]<=0){const a=i.x+(Math.random()-.5)*i.r*1.2,o=a-i.x,l=i.y-Math.sqrt(Math.max(0,i.r*i.r-o*o)),u=4+Math.floor(Math.random()*3);for(let c=0;c<u;c++){const h=o<0?-1:1;ii[s].push({x:a,y:l,vx:h*(.5+Math.random()*2)*(Math.random()<.5?-1:1),vy:-(1.5+Math.random()*2.5),life:18+Math.floor(Math.random()*14)})}Kn[s]=30+Math.floor(Math.random()*50)}Dm(e,ii[s])}}}function jy(e,t,n,r,s){e.save(),e.strokeStyle=s?"rgba(205,224,244,0.42)":"rgba(210,224,238,0.3)",e.lineWidth=s?1:.7,e.lineCap="round";const i=s?.013:.007;for(const a of r){a.y+=a.v*i,a.y>1&&(a.y-=1,a.x=Math.random());const o=a.x*t,l=a.y*n;e.beginPath(),e.moveTo(o,l),e.lineTo(o,l+a.len),e.stroke()}e.restore()}function Hy(e,t,n,r,s){e.save(),e.fillStyle="rgba(250,250,255,0.85)";for(const i of r){i.y+=i.v*.004;const a=(i.x+Math.sin(s*5e-4+i.phase)*.02)*t,o=i.y*n;i.y>1&&(i.y-=1),e.beginPath(),e.arc(a,o,i.r,0,Math.PI*2),e.fill()}e.restore()}function Uy(e,t,n,r,s){const i=e.createLinearGradient(0,n*.4,0,n),a=nr(s.hor,[255,255,255],.3);i.addColorStop(0,Mr(a,0)),i.addColorStop(1,Mr(a,r)),e.fillStyle=i,e.fillRect(0,n*.4,t,n*.6)}let gr=0,jc=0;function zy(e,t,n,r,s){if(s>jc&&(gr=1,jc=s+1400+Math.random()*2600),gr*=.86,gr<.02){gr=0;return}if(e.fillStyle=`rgba(255,255,255,${gr*.5})`,e.fillRect(0,0,t,n),gr>.6){e.save(),e.strokeStyle="rgba(255,255,255,0.95)",e.lineWidth=2.2,e.shadowColor="rgba(220,230,255,0.9)",e.shadowBlur=22;let i=t*(.3+Math.random()*.4),a=0;for(e.beginPath(),e.moveTo(i,a);a<n*.6;)i+=(Math.random()-.5)*60,a+=24+Math.random()*30,e.lineTo(i,a);e.stroke(),e.restore()}}function Vy(e,t,n,r){const s=e.getContext("2d");if(!s)return()=>{};const i=s,a=n;let o=0,l=0,u=1,c=Fc(1,1);const h=Cy();let f=[],d=[],m=0,b=0,g=!0;const y=performance.now(),k=window.matchMedia("(prefers-reduced-motion: reduce)").matches;function T(){const N=a.getBoundingClientRect();if(u=Math.min(window.devicePixelRatio||1,2),o=Math.max(1,N.width),l=Math.max(1,N.height),e.width=Math.floor(o*u),e.height=Math.floor(l*u),e.style.width=o+"px",e.style.height=l+"px",i.setTransform(u,0,0,u,0,0),c=Fc(o,l),r.particles==="rain"&&f.length===0){const C=r.weather==="storm",L=C?140:70;for(let M=0;M<L;M++)f.push({x:Math.random(),y:Math.random(),len:C?12+Math.random()*14:6+Math.random()*8,v:C?.9+Math.random()*.4:.5+Math.random()*.3})}if(r.particles==="snow"&&d.length===0)for(let C=0;C<120;C++)d.push({x:Math.random(),y:Math.random(),r:.8+Math.random()*1.6,v:.5+Math.random()*.8,phase:Math.random()*Math.PI*2})}function S(){const N=t.scrollHeight-t.clientHeight;m=N>0?ma(t.scrollTop/N,0,1):0}function E(N){if(!g)return;const C=m,L=k?0:(N-y)/1e3,M=wy(C,r.sky);_y(i,M,o,l),Ny(i,C,c,o,l,L),Ry(i,Ay(C,o,l,.92,.08)),Iy(i,Sy(C,o,l,.16,.88),r.sunTint),My(i,C,h,o,l,N,r.cloudCover,M,r.weather==="storm"),r.particles==="rain"&&jy(i,o,l,f,r.weather==="storm"),r.particles==="snow"&&Hy(i,o,l,d,N),r.fogAlpha>0&&Uy(i,o,l,r.fogAlpha,M),r.lightning&&zy(i,o,l,!0,N),k||(b=requestAnimationFrame(E))}const w=()=>S(),_=new ResizeObserver(()=>{T(),S()});_.observe(a),T(),S();let A;if(k){let N=!1;A=()=>{S(),N||(N=!0,requestAnimationFrame(()=>{N=!1,E(performance.now())}))},t.addEventListener("scroll",A,{passive:!0}),E(performance.now())}else A=w,t.addEventListener("scroll",A,{passive:!0}),b=requestAnimationFrame(E);return()=>{g=!1,cancelAnimationFrame(b),_.disconnect(),t.removeEventListener("scroll",A)}}function qy(e,t,n,r,s,i){const a=()=>{Er.length=0,si.length=0,Gn.length=0,ii.length=0,Kn.length=0,hs.length=0,Gr.length=0;const k=e.getContext("2d");k&&k.clearRect(0,0,e.width,e.height)};if(a(),window.matchMedia("(prefers-reduced-motion: reduce)").matches)return()=>{};if(n.particles!=="rain"&&n.particles!=="snow")return()=>{};const l=e.getContext("2d");if(!l)return()=>{};const u=l;let c=0,h=0,f=1,d=0,m=!0;function b(){const k=t.getBoundingClientRect();f=Math.min(window.devicePixelRatio||1,2),c=Math.max(1,k.width),h=Math.max(1,k.height),e.width=Math.floor(c*f),e.height=Math.floor(h*f),e.style.width=c+"px",e.style.height=h+"px",u.setTransform(f,0,0,f,0,0)}function g(k){if(!m)return;u.clearRect(0,0,c,h);const T=r();if(Fy(u,T,n),s){for(const S of s()){const E=3+Math.min(5,Math.floor(S.speed/3));for(let w=0;w<E;w++)hs.push({x:S.x,y:S.y,vx:(Math.random()-.5)*3.2,vy:-(1.5+Math.random()*2.5),life:16+Math.floor(Math.random()*12)})}hs.length>0&&Dm(u,hs)}if(i){for(const S of i()){const E=1+Math.min(2,Math.round(S.amount*40));for(let w=0;w<E;w++){const _=55+Math.floor(Math.random()*40);Gr.push({x:S.x+(Math.random()-.5)*8,y:S.y+(Math.random()-.5)*6,vx:S.vx*.6+(Math.random()-.5)*.8,vy:S.vy*.6-Math.random()*.5,life:_,maxLife:_,r:1.2+Math.random()*2.2})}}for(;Gr.length>240;)Gr.shift();Oy(u,Gr)}d=requestAnimationFrame(g)}const y=new ResizeObserver(b);return y.observe(t),b(),d=requestAnimationFrame(g),()=>{m=!1,cancelAnimationFrame(d),y.disconnect(),a()}}const Wy=v.lazy(()=>Ae(()=>import("./CourseSearchPanel-DVtN9ACi.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(e=>({default:e.CourseSearchPanel})));function $y(e){const t=Ye(),[n,r]=v.useState("import"),[s,i]=v.useState("study"),a=v.useRef(null),o=v.useRef(null),l=Math.round(e.overallMastery*100),c=!Gl(),h=v.useRef([]),f=v.useRef(P=>{h.current.push(...P),h.current.length>64&&h.current.splice(0,h.current.length-64)}).current,d=v.useRef([]),m=v.useRef(new Map),b=v.useRef(P=>{d.current.push(...P),d.current.length>96&&d.current.splice(0,d.current.length-96)}).current,g=e.sections.filter(P=>(P.world??"study")===s),y=e.sections.some(P=>P.world==="practice"),[k,T]=v.useState(null);v.useEffect(()=>{T(ky(e.courseId))},[e.courseId]);const S=k?Mm[k]??null:null;v.useEffect(()=>(xc({nav:a.current,visible:n==="map",weather:(S==null?void 0:S.weather)??"clear"}),()=>{xc({visible:!1,nav:null})}),[n,S,a]);const[E,w]=v.useState(!1);v.useEffect(()=>{if(!e.selectedNodeId)return;const P=o.current;if(!P)return;const R=P.querySelector(`[data-node-id="${CSS.escape(e.selectedNodeId)}"]`);if(!R)return;const B=P.getBoundingClientRect(),q=R.getBoundingClientRect();(q.top<B.top+60||q.bottom>B.bottom-60)&&R.scrollIntoView({behavior:"smooth",block:"center"})},[e.selectedNodeId]);const _=v.useRef(null);v.useEffect(()=>{w(!1),e.courseId&&(_.current===null||_.current!==e.courseId)&&(r("map"),i("study")),!e.courseId&&_.current!==null&&(r("import"),i("study")),_.current=e.courseId},[e.courseId]);const[A,N]=v.useState(null),[C,L]=v.useState(!1),M=v.useRef({}),H=v.useRef(null);return v.useEffect(()=>{var q,F;const P=M.current,R={};let B=null;for(const V of e.tree){const I=((q=e.progressMap[V.id])==null?void 0:q.status)??"locked";R[V.id]=I,P[V.id]==="locked"&&I!=="locked"&&!B&&(B=V.id)}if(B&&Object.keys(P).length>0){const V=(F=a.current)==null?void 0:F.querySelector(`[data-testid="map-node-${B.slice(0,8)}"], [data-testid="exam-node-${B.slice(0,8)}"]`),I=V==null?void 0:V.getBoundingClientRect(),W=!!I&&I.width>0&&I.left>=0&&I.right<=window.innerWidth&&I.top>=0;Cr("unlock",W?{origin:{x:I.left+I.width/2,y:I.top+4}}:void 0)}M.current=R},[e.tree,e.progressMap]),p.jsxs("nav",{ref:a,className:`map-rail-scope relative h-full flex flex-col bg-surface-rail shrink-0 overflow-hidden ${e.fullWidth?"w-full":e.width==null?"w-[300px]":""}`,style:!e.fullWidth&&e.width!=null?{width:e.width}:void 0,"data-testid":"map-rail",children:[S&&p.jsxs(p.Fragment,{children:[p.jsx(Gy,{scrollRef:o,navRef:a,preset:S}),p.jsx(Ky,{scrollRef:o,navRef:a,preset:S,getImpacts:()=>h.current.splice(0),getFlakes:()=>d.current.splice(0),orbSnowRef:m})]}),p.jsxs("div",{className:"absolute top-0 left-0 right-0 z-40 px-2 pt-2 pb-2 pointer-events-none [&_button]:pointer-events-auto","data-testid":"map-rail-topbar",children:[p.jsxs("div",{className:"flex p-1 rounded-lg gap-1 mb-2",style:{background:"rgb(var(--surface-rail-rgb) / 0.55)",backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[p.jsxs("button",{onClick:()=>r("map"),"data-testid":"map-tab-map",className:`flex-1 flex items-center justify-center gap-1 py-1.5 rounded-md text-label font-bold transition-colors ${n==="map"?"bg-brand/20 text-brand":"text-white/50 hover:text-white/80"}`,children:[p.jsx(mm,{className:"w-3 h-3"})," ",t("map.tab.map")]}),p.jsxs("button",{onClick:()=>r("import"),"data-testid":"map-tab-import",className:`flex-1 flex items-center justify-center gap-1 py-1.5 rounded-md text-label font-bold transition-colors ${n==="import"?"bg-brand/20 text-brand":"text-white/50 hover:text-white/80"}`,children:[p.jsx(Fi,{className:"w-3 h-3"})," ",t("map.tab.import")]})]}),n==="map"&&p.jsxs("div",{className:"relative px-3 py-2 rounded-lg pointer-events-auto",style:{background:"rgb(var(--surface-rail-rgb) / 0.55)",backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[p.jsxs("div",{className:"flex items-center gap-1.5",children:[e.courseId&&e.courses.length>0?p.jsxs("button",{type:"button","data-testid":"map-course-switch",onClick:()=>L(P=>!P),"data-tooltip":t("map.course.switch"),className:"flex-1 min-w-0 flex items-center gap-1 text-left rounded-md px-1 -mx-1 py-0.5 hover:bg-white/10 motion-safe:transition-colors",children:[p.jsx("h2",{className:"text-body font-extrabold text-white truncate flex-1","data-tooltip":e.courseTitle??"",children:e.courseTitle??t("map.course.none")}),p.jsx(ca,{className:`w-3.5 h-3.5 shrink-0 text-white/50 motion-safe:transition-transform ${C?"rotate-180":""}`})]}):p.jsx("h2",{className:"text-body font-extrabold text-white truncate flex-1","data-tooltip":e.courseTitle??"",children:e.courseTitle??t("map.course.none")}),e.availableLanguages.length>0&&p.jsx(t2,{available:e.availableLanguages,current:e.currentLocale,onChange:e.onLocaleChange}),e.courseId&&p.jsx("button",{onClick:P=>{const R=P.currentTarget.getBoundingClientRect();N({id:e.courseId,title:e.courseTitle??"",rect:R})},"data-testid":"course-delete-btn","aria-label":t("import.delete.current"),"data-tooltip":t("import.delete.current"),className:"shrink-0 flex items-center justify-center w-5 h-5 rounded-md text-white/40 hover:text-warning hover:bg-white/10 transition-colors",children:p.jsx(ym,{className:"w-3 h-3"})})]}),C&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"fixed inset-0 z-40","data-noswipe":"",onClick:()=>L(!1)}),p.jsx("div",{className:"absolute left-3 right-3 top-full mt-1 z-50 rounded-lg border border-white/10 bg-[#141a26]/95 backdrop-blur-xl shadow-elevated overflow-hidden","data-testid":"map-course-menu",children:e.courses.map(P=>{const R=P.id===e.courseId;return p.jsxs("button",{type:"button","data-testid":`map-course-option-${P.id}`,onClick:()=>{e.onSelectCourse(P.id),L(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-left text-label transition-colors ${R?"text-brand bg-brand/10 font-bold":"text-white/80 hover:bg-white/10"}`,children:[p.jsx("span",{className:"flex-1 truncate",children:P.title}),R&&p.jsx(En,{className:"w-3.5 h-3.5 shrink-0"})]},P.id)})})]}),p.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[p.jsx("div",{className:"flex-1 h-2.5 bg-black/40 rounded-full overflow-hidden ring-1 ring-white/10",children:p.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${l>=100?"bg-gold":"bg-brand"}`,style:{width:`${Math.max(3,l)}%`}})}),p.jsxs("span",{className:"text-label font-extrabold tabular-nums text-white drop-shadow-[0_1px_3px_rgba(0,0,0,0.6)]",children:[l,"%"]})]}),p.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1.5 text-caption",children:[p.jsxs("button",{onClick:()=>w(!0),"data-testid":"map-search-btn",className:"flex items-center gap-1 px-1.5 py-0.5 rounded-full bg-white/5 ring-1 ring-white/10 hover:bg-white/10 transition-colors",children:[p.jsx(Bx,{className:"w-3 h-3 text-white/50"}),p.jsx("span",{className:"font-bold text-white/60",children:t("map.search.label")})]}),p.jsxs("button",{onClick:e.onOpenReview,className:`flex items-center gap-1 px-1.5 py-0.5 rounded-full transition-colors ${e.dueCount>0?"bg-review/20 ring-1 ring-review/30 hover:bg-review/30":"bg-white/5 ring-1 ring-white/10 hover:bg-white/10"}`,"data-testid":"map-review-badge",children:[p.jsx(nn,{className:`w-3 h-3 ${e.dueCount>0?"text-review":"text-white/50"}`}),p.jsx("span",{className:`font-bold ${e.dueCount>0?"text-review":"text-white/60"}`,children:t("map.review.label")}),e.dueCount>0&&p.jsx("span",{className:"font-extrabold text-review tabular-nums",children:e.dueCount})]})]}),y&&p.jsxs("div",{className:"flex gap-1 mt-1.5 p-0.5 rounded-lg bg-black/30",children:[p.jsxs("button",{onClick:()=>i("study"),"data-testid":"world-tab-study",className:`flex-1 flex items-center justify-center gap-1 py-1 rounded-md text-caption font-bold transition-colors ${s==="study"?"bg-brand/30 text-brand":"text-white/50 hover:text-white/80"}`,children:[p.jsx(nn,{className:"w-3 h-3"})," ",t("map.world.study")]}),p.jsxs("button",{onClick:()=>i("practice"),"data-testid":"world-tab-practice",className:`flex-1 flex items-center justify-center gap-1 py-1 rounded-md text-caption font-bold transition-colors ${s==="practice"?"bg-accent/30 text-accent":"text-white/50 hover:text-white/80"}`,children:[p.jsx(Tm,{className:"w-3 h-3"})," ",t("map.world.practice")]})]})]})]}),p.jsx("div",{className:"absolute inset-0 overflow-hidden z-10",children:p.jsxs("div",{className:"flex h-full transition-transform duration-300",style:{transform:n==="map"?"translateX(0)":"translateX(-50%)",width:"200%"},children:[p.jsx("div",{className:"w-1/2 h-full relative",children:p.jsx("div",{ref:o,className:"map-path h-full overflow-y-auto overflow-x-hidden px-2 pt-48 pb-4","data-testid":"map-path",onPointerDown:P=>{H.current={x:P.clientX,y:P.clientY}},onClick:P=>{const R=H.current;H.current=null,!(!R||Math.hypot(P.clientX-R.x,P.clientY-R.y)>6)&&(P.target.closest("button, a, input, textarea, select")||$o(P.clientX,P.clientY))},children:p.jsxs("div",{className:`map-sky-content ${S?`env-${S.season} env-${S.weather}`:""}`,children:[e.streaming&&p.jsxs("div",{className:"mb-3 mx-1 px-3 py-2 rounded-xl bg-brand/10 border border-brand/30 flex items-center gap-2 text-label text-brand font-medium backdrop-blur-sm","data-testid":"streaming-notice",children:[p.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),t("map.streaming.notice")]}),e.sections.length===0?e.courseTitle?p.jsxs("div",{className:"text-center text-label text-white/60 mt-8 px-4 flex items-center justify-center gap-2",children:[p.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),t("map.generating")]}):p.jsxs("button",{onClick:()=>r("import"),className:"block w-full mt-8 mx-auto p-4 rounded-2xl border-2 border-dashed border-brand/40 hover:border-brand hover:bg-brand/5 transition-all text-center group","data-testid":"map-empty-cta",children:[p.jsx("div",{className:"text-3xl mb-2 group-hover:scale-110 transition-transform",children:"🗺️"}),p.jsx("div",{className:"text-body font-bold text-white/90 mb-1",children:t("map.empty.cta.title")}),p.jsx("div",{className:"text-label text-white/60 leading-relaxed",children:t("map.empty.cta.desc")}),p.jsx("div",{className:"mt-2 text-caption text-brand font-bold",children:t("map.empty.cta.btn")})]}):g.length===0?p.jsx("div",{className:"text-center text-label text-white/60 mt-8 px-4",children:t(s==="practice"?"map.empty.practice":"map.generating")}):p.jsx("div",{className:"space-y-6 pt-2",children:g.map((P,R)=>p.jsx(Xy,{section:P,sectionIndex:R,tree:e.tree,progressMap:e.progressMap,selectedNodeId:e.selectedNodeId,dueNodeIds:e.dueNodeIds,streamingNodeIds:e.streamingNodeIds,onJumpNode:e.onJumpNode,nextCueNodeId:e.nextCueNodeId,physics:c,physicsWeather:(S==null?void 0:S.weather)??"clear",scrollRef:o,navRef:a,onImpacts:f,onFlakes:b,orbSnowRef:m},P.id))})]})})}),p.jsx("div",{className:"w-1/2 h-full overflow-y-auto px-3 pt-20 pb-3 space-y-2.5",children:p.jsx(Yy,{courses:e.courses,selectedCourseId:e.courseId,onSelectCourse:P=>{e.onSelectCourse(P),r("map")},onDeleteCourse:(P,R,B)=>N({id:P,title:R,rect:B}),onCoursesChanged:e.onCoursesChanged})})]})}),E&&e.courseId&&p.jsx(v.Suspense,{fallback:null,children:p.jsx(Wy,{sections:e.sections,tree:e.tree,progressMap:e.progressMap,selectedNodeId:e.selectedNodeId,onJump:P=>{i(P.world??"study"),w(!1),Yo(null,null,P.id),e.onJumpNode(P.id)},onClose:()=>w(!1)})}),A&&p.jsx(Cm,{anchorRect:A.rect,message:`${A.title} — ${t("import.delete.confirm")}`,danger:!0,confirmLabel:t("import.delete"),testid:"course-delete-confirm",onConfirm:()=>{e.onDeleteCourse(A.id),N(null)},onCancel:()=>N(null)})]})}function Yy({courses:e,selectedCourseId:t,onSelectCourse:n,onDeleteCourse:r,onCoursesChanged:s}){const i=Ye(),[a,o]=v.useState("url"),[l,u]=v.useState(!1),[c,h]=v.useState(""),[f,d]=v.useState(""),m=v.useRef(null),b=v.useRef(null),g=v.useRef(null),[y,k]=v.useState(""),[T,S]=v.useState(""),[E,w]=v.useState(!1),[_,A]=v.useState(null),[N,C]=v.useState(null),[L,M]=v.useState(null),[H,P]=v.useState(null),[R,B]=v.useState([]),[,q]=v.useState(0),F=v.useRef(null);v.useEffect(()=>{const ee=se.on("import:progress",xe=>{B(Se=>{const Le=/\d+\/\d+/.test(xe),pe=Se[Se.length-1];if(Le&&pe&&pe.status==="working"){const Me=[...Se];return Me[Me.length-1]={...pe,msg:xe},Me}const Te=Se.map(Me=>Me.status==="working"?{...Me,status:"done"}:Me);return Te.push({msg:xe,status:"working",ts:Date.now()}),Te})}),ie=setInterval(()=>q(xe=>xe+1),1e3);return()=>{ee(),clearInterval(ie)}},[]),v.useEffect(()=>se.on("import:done",ie=>{w(!1),jt(!1),ie.cancelled||wb(ie.ok),M(ie.ok?null:ie.planId??null),ie.ok?(C(`${i("import.success.folder")}: ${ie.title??""}${ie.reused?`(${i("import.success.reused")})`:""}`),P(ie.courseId?{courseId:ie.courseId,packable:ie.packable??!1}:null),s()):ie.cancelled?(B([]),A(null),C(i("import.cancelled"))):A(ie.error??"导入失败")}),[s,i]),v.useEffect(()=>{const ee=F.current;ee&&(ee.scrollTop=ee.scrollHeight)},[R]);const V=async()=>{if(!(!c.trim()||E)){A(null),C(null),B([]);try{await se.importUrl(c.trim()),w(!0),jt(!0)}catch(ee){A(ee instanceof Error?ee.message:String(ee))}}},I=async()=>{if(!(!y.trim()||E)){A(null),C(null),B([]);try{await se.importText({name:T.trim()||void 0,text:y.trim()}),w(!0),jt(!0)}catch(ee){A(ee instanceof Error?ee.message:String(ee))}}},W=async()=>{var ie;if(E)return;if(A(null),C(null),B([]),!pn){(ie=b.current)==null||ie.click();return}await se.importEpub().catch(xe=>(A(xe instanceof Error?xe.message:String(xe)),null))&&(w(!0),jt(!0))},K=async ee=>{if(!(!ee||E)){A(null),C(null),B([]);try{const ie=new Uint8Array(await ee.arrayBuffer());let xe="";for(let Le=0;Le<ie.length;Le+=32768)xe+=String.fromCharCode(...ie.subarray(Le,Le+32768));await se.importEpub({fileName:ee.name,contentBase64:btoa(xe)})&&w(!0),jt(!0)}catch(ie){A(ie instanceof Error?ie.message:String(ie))}}},D=async()=>{if(E)return;if(A(null),C(null),B([]),!pn){const ie=f.trim();if(!ie){A(i("import.folder.pathRequired"));return}try{await se.importLocalFolder(ie)&&w(!0),jt(!0)}catch(xe){A(xe instanceof Error?xe.message:String(xe))}return}await se.importLocalFolder()&&(w(!0),jt(!0))},ne=async()=>{var ie;if(E)return;if(A(null),C(null),B([]),!pn){(ie=m.current)==null||ie.click();return}await se.importPack().catch(xe=>(A(xe instanceof Error?xe.message:String(xe)),null))&&(w(!0),jt(!0))},oe=async ee=>{if(!(!ee||E)){A(null),C(null),B([]);try{const ie=await ee.text();await se.importPack({fileName:ee.name,content:ie})&&w(!0),jt(!0)}catch(ie){A(ie instanceof Error?ie.message:String(ie))}}},J=async()=>{var ie;if(E)return;if(A(null),C(null),B([]),!pn){(ie=g.current)==null||ie.click();return}await se.importAudio().catch(xe=>(A(xe instanceof Error?xe.message:String(xe)),null))&&(w(!0),jt(!0))},Y=async ee=>{if(!(!ee||ee.length===0||E)){A(null),C(null),B([]);try{const ie=[];for(const Se of Array.from(ee)){const Le=new Uint8Array(await Se.arrayBuffer());let pe="";for(let Te=0;Te<Le.length;Te+=32768)pe+=String.fromCharCode(...Le.subarray(Te,Te+32768));ie.push({fileName:Se.name,contentBase64:btoa(pe)})}await se.importAudio(ie)&&w(!0),jt(!0)}catch(ie){A(ie instanceof Error?ie.message:String(ie))}}},X=async ee=>{if(!E){A(null),B([]);try{await se.importResume(ee),w(!0),jt(!0)}catch(ie){A(ie instanceof Error?ie.message:String(ie))}}},de=async ee=>{try{const ie=await se.exportPack(ee);ie!=null&&ie.content&&ie.fileName?(ge(ie.fileName,ie.content),C(i("import.pack.exported",{path:ie.fileName}))):ie!=null&&ie.path&&C(i("import.pack.exported",{path:ie.path}))}catch(ie){A(ie instanceof Error?ie.message:String(ie))}},ge=(ee,ie)=>{const xe=new Blob([ie],{type:"application/json"}),Se=URL.createObjectURL(xe),Le=document.createElement("a");Le.href=Se,Le.download=ee,Le.click(),setTimeout(()=>URL.revokeObjectURL(Se),5e3)};return p.jsxs(p.Fragment,{children:[e.length===0?p.jsxs("div",{className:"text-center py-10",children:[p.jsx("div",{className:"text-3xl mb-2 opacity-30",children:"📚"}),p.jsx("p",{className:"text-label text-white/45 leading-relaxed",children:i("import.empty")})]}):p.jsx("div",{className:"space-y-2","data-testid":"course-list",children:e.map(ee=>{const ie=ee.id===t;return p.jsxs("div",{"data-testid":"course-row",className:`relative rounded-xl transition-all duration-150 group ${ie?"bg-brand/12 ring-1 ring-brand/40":"bg-white/5 hover:bg-white/10 hover:-translate-y-0.5"}`,children:[p.jsx("button",{onClick:()=>n(ee.id),className:"w-full text-left p-3",children:p.jsxs("div",{className:"flex items-start justify-between gap-2",children:[p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:`text-body font-bold truncate ${ie?"text-brand":"text-white/90"}`,children:ee.title}),p.jsx("div",{className:"text-caption text-white/40 truncate mt-0.5",children:ee.repoName})]}),ie&&p.jsx("span",{className:"shrink-0 w-5 h-5 rounded-full bg-brand flex items-center justify-center",children:p.jsx(En,{className:"w-3 h-3 text-white"})})]})}),p.jsxs("div",{className:"absolute bottom-1.5 right-2 flex items-center gap-2.5 opacity-0 group-hover:opacity-100 pointer-coarse:opacity-100 focus-within:opacity-100 transition-opacity",children:[p.jsxs("button",{onClick:xe=>{xe.stopPropagation(),A(null),C(null),se.exportPack(ee.id).then(Se=>{Se!=null&&Se.content&&Se.fileName?(ge(Se.fileName,Se.content),C(i("import.pack.exported",{path:Se.fileName}))):Se!=null&&Se.path&&C(i("import.pack.exported",{path:Se.path}))}).catch(Se=>{A(Se instanceof Error?Se.message:String(Se))})},"data-testid":"course-row-export",className:"text-caption text-white/40 hover:text-brand flex items-center gap-0.5",children:[p.jsx(_c,{className:"w-2.5 h-2.5"})," ",i("import.export")]}),p.jsxs("button",{onClick:xe=>{xe.stopPropagation();const Se=xe.currentTarget.getBoundingClientRect();r(ee.id,ee.title,Se)},"data-testid":"course-row-delete",className:"text-caption text-white/40 hover:text-warning flex items-center gap-0.5",children:[p.jsx(ym,{className:"w-2.5 h-2.5"})," ",i("import.delete")]})]})]},ee.id)})}),p.jsxs("div",{className:e.length>0?"mt-6":"",children:[p.jsxs("button",{onClick:()=>u(!l),className:`w-full flex items-center justify-center gap-1.5 py-3 rounded-xl border-2 border-dashed transition-all text-body font-bold ${l?"border-brand/40 bg-brand/8 text-brand":"border-white/20 hover:border-brand/50 hover:bg-brand/8 text-white/70 hover:text-brand"}`,children:[p.jsx(bm,{className:`w-4 h-4 transition-transform ${l?"rotate-45":""}`})," ",i("import.cta")]}),l&&p.jsxs("div",{className:"mt-3 space-y-3",children:[E?p.jsxs("div",{className:"rounded-xl bg-black/30 border border-brand/30 p-4","data-testid":"import-progress",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[p.jsx("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin shrink-0"}),p.jsx("span",{className:"text-body font-bold text-white/90",children:i("import.progress.title")}),p.jsx("button",{onClick:()=>{se.importCancel()},"data-testid":"import-cancel-btn",className:"ml-auto text-caption text-white/50 hover:text-warning transition-colors",children:i("import.progress.cancel")})]}),p.jsx("div",{className:"text-caption text-white/40 mb-2.5",children:i("import.progress.note")}),(a==="url"?c.trim():a==="markdown"&&T.trim())?p.jsx("div",{className:"text-caption text-white/40 font-mono truncate mb-2.5",children:a==="url"?c.trim():T.trim()}):null,p.jsx("div",{ref:F,className:"space-y-1.5 max-h-[40vh] overflow-y-auto pr-1",children:R.length===0?p.jsx("div",{className:"text-caption text-white/50 py-1",children:i("import.progress.starting")}):R.map((ee,ie)=>p.jsxs("div",{className:"flex items-start gap-1.5 text-caption",children:[ee.status==="done"?p.jsx(En,{className:"w-3 h-3 text-brand shrink-0 mt-px"}):p.jsx("span",{className:"inline-block w-2.5 h-2.5 border-2 border-brand border-t-transparent rounded-full animate-spin shrink-0 mt-px"}),p.jsxs("span",{className:ee.status==="done"?"text-white/40":"text-white/90",children:[ee.msg,ee.status==="working"&&p.jsxs("span",{className:"text-white/35 ml-1",children:["(",i("import.progress.elapsed",{s:Math.floor((Date.now()-ee.ts)/1e3)}),")"]})]})]},ie))})]}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"@container flex flex-wrap gap-1 p-1 bg-white/5 rounded-lg",children:[{k:"url",label:i("import.tab.url"),icon:Sx},{k:"markdown",label:i("import.tab.md"),icon:Fi},{k:"folder",label:i("import.tab.folder"),icon:bx},{k:"epub",label:i("import.tab.epub"),icon:nn},{k:"audio",label:i("import.tab.audio"),icon:Cs},{k:"pack",label:i("import.tab.pack"),icon:_c}].map(({k:ee,label:ie,icon:xe})=>p.jsxs("button",{onClick:()=>o(ee),className:`min-w-[72px] flex-1 flex items-center justify-center gap-0.5 py-1.5 px-0.5 rounded-md font-bold transition-colors ${a===ee?"bg-brand/15 text-brand":"text-white/50 hover:text-white/80"}`,children:[p.jsx(xe,{className:"w-3 h-3 shrink-0"}),p.jsx("span",{className:"whitespace-nowrap",style:{fontSize:"clamp(0.75rem, 4cqi, 0.875rem)"},children:ie})]},ee))}),a==="url"?p.jsxs("section",{className:"space-y-2","data-testid":"import-url-section",children:[p.jsx("input",{type:"text",value:c,onChange:ee=>h(ee.target.value),placeholder:i("import.url.placeholder"),"data-testid":"repo-url-input",className:"w-full bg-black/25 text-white placeholder:text-white/35 text-body rounded-lg px-3 py-2 border border-white/15 focus:border-brand focus:outline-none transition-colors"}),p.jsx("p",{className:"text-caption text-white/45 leading-relaxed",children:i("import.url.desc")}),p.jsx("button",{onClick:V,disabled:!c.trim()||E,"data-testid":"import-url-btn",className:"btn-3d-brand w-full px-3 py-2 text-body disabled:opacity-40",children:i("import.btn.url")})]}):a==="markdown"?p.jsxs("section",{className:"space-y-2","data-testid":"import-md-section",children:[p.jsx("input",{type:"text",value:T,onChange:ee=>S(ee.target.value),placeholder:i("import.placeholder.name"),"data-testid":"md-name-input",className:"w-full bg-black/25 text-white placeholder:text-white/35 text-body rounded-lg px-3 py-2 border border-white/15 focus:border-brand focus:outline-none transition-colors"}),p.jsx("textarea",{value:y,onChange:ee=>k(ee.target.value),placeholder:i("import.placeholder.md"),"data-testid":"md-text-input",rows:4,className:"w-full bg-black/25 text-white placeholder:text-white/35 text-body rounded-lg px-3 py-2 border border-white/15 focus:border-brand focus:outline-none transition-colors resize-none"}),p.jsx("button",{onClick:I,disabled:!y.trim()||E,"data-testid":"import-md-btn",className:"btn-3d-brand w-full px-3 py-2 text-body disabled:opacity-40",children:i("import.btn.md")})]}):a==="folder"?p.jsxs("section",{className:"space-y-2","data-testid":"import-folder-section",children:[p.jsx("p",{className:"text-caption text-white/50 leading-relaxed",children:i("import.folder.desc")}),!pn&&p.jsx("input",{type:"text",value:f,onChange:ee=>d(ee.target.value),placeholder:i("import.folder.pathPlaceholder"),"data-testid":"import-folder-path",className:"w-full bg-black/25 text-white placeholder:text-white/35 text-body rounded-lg px-3 py-2 border border-white/15 focus:border-brand focus:outline-none transition-colors"}),p.jsx("button",{onClick:D,disabled:E||!pn&&!f.trim(),"data-testid":"import-folder-btn",className:"btn-3d-brand w-full px-3 py-2 text-body disabled:opacity-40",children:i("import.btn.folder")})]}):a==="epub"?p.jsxs("section",{className:"space-y-2","data-testid":"import-epub-section",children:[p.jsx("p",{className:"text-caption text-white/50 leading-relaxed",children:i("import.epub.desc")}),!pn&&p.jsx("input",{ref:b,type:"file",accept:".epub,application/epub+zip",className:"hidden","data-testid":"import-epub-file",onChange:ee=>{var ie;K((ie=ee.target.files)==null?void 0:ie[0]),ee.currentTarget.value=""}}),p.jsx("button",{onClick:W,disabled:E,"data-testid":"import-epub-btn",className:"btn-3d-brand w-full px-3 py-2 text-body disabled:opacity-40",children:i("import.btn.epub")})]}):a==="audio"?p.jsxs("section",{className:"space-y-2","data-testid":"import-audio-section",children:[p.jsx("p",{className:"text-caption text-white/50 leading-relaxed",children:i("import.audio.desc")}),!pn&&p.jsx("input",{ref:g,type:"file",multiple:!0,accept:".wav,.mp3,.m4a,.flac,.aac,.ogg,.opus,audio/*",className:"hidden","data-testid":"import-audio-file",onChange:ee=>{Y(ee.target.files),ee.currentTarget.value=""}}),p.jsx("button",{onClick:J,disabled:E,"data-testid":"import-audio-btn",className:"btn-3d-brand w-full px-3 py-2 text-body disabled:opacity-40",children:i("import.btn.audio")})]}):p.jsxs("section",{className:"space-y-2","data-testid":"import-pack-section",children:[p.jsx("p",{className:"text-caption text-white/50 leading-relaxed",children:i("import.pack.desc")}),!pn&&p.jsx("input",{ref:m,type:"file",accept:".json,application/json",className:"hidden","data-testid":"import-pack-file",onChange:ee=>{var ie;oe((ie=ee.target.files)==null?void 0:ie[0]),ee.currentTarget.value=""}}),p.jsx("button",{onClick:ne,disabled:E,"data-testid":"import-pack-btn",className:"btn-3d-brand w-full px-3 py-2 text-body disabled:opacity-40",children:i("import.btn.pack")})]})]}),_&&p.jsxs("div",{className:"border border-warning/40 text-warning-light text-label rounded-lg p-2 whitespace-pre-wrap","data-testid":"import-error",children:[_,L&&p.jsx("button",{onClick:()=>void X(L),disabled:E,"data-testid":"import-resume-btn",className:"block mt-1.5 text-label font-bold text-warning-light hover:text-warning underline underline-offset-2 disabled:opacity-40",children:i("import.error.resume")})]}),N&&p.jsxs("div",{className:"border border-brand/30 text-brand text-label rounded-lg p-2","data-testid":"import-success",children:[p.jsx(En,{className:"inline-block w-3.5 h-3.5 mr-1 align-[-3px]"}),N,(H==null?void 0:H.packable)&&p.jsx("button",{onClick:()=>void de(H.courseId),disabled:E,"data-testid":"import-export-pack-btn",className:"block mt-1.5 text-label font-bold hover:underline underline-offset-2 disabled:opacity-40",children:i("import.pack.export")})]})]})]})]})}function Gy({scrollRef:e,navRef:t,preset:n}){const r=v.useRef(null);return v.useEffect(()=>{const s=r.current,i=e.current,a=t.current;return!s||!i||!a?void 0:Vy(s,i,a,n)},[e,t,n]),p.jsx("canvas",{ref:r,className:"map-sky-canvas","aria-hidden":"true"})}function Ky({scrollRef:e,navRef:t,preset:n,getImpacts:r,getFlakes:s,orbSnowRef:i}){const a=v.useRef(null);return v.useEffect(()=>{const o=a.current,l=t.current,u=e.current;if(!o||!l||!u)return;let c=null,h=null;const f=()=>{c=null,h=null},d=new MutationObserver(f);d.observe(u,{childList:!0,subtree:!0}),window.addEventListener("resize",f);const b=qy(o,l,n,()=>{var k,T;c||(c=Array.from(u.querySelectorAll(".lesson-bubble")));const g=h??l.getBoundingClientRect();h=g;const y=[];for(const S of c){const E=S.getBoundingClientRect();if(E.bottom<g.top||E.top>g.bottom)continue;const w=(k=S.closest("[data-node-id]"))==null?void 0:k.getAttribute("data-node-id"),_=w?(T=i==null?void 0:i.current)==null?void 0:T.get(w):void 0;y.push({x:E.left-g.left+E.width/2,y:E.top-g.top+E.height/2,r:E.width/2,..._!==void 0?{snow:_}:{}})}return y},r,s);return()=>{b(),d.disconnect(),window.removeEventListener("resize",f)}},[e,t,n,r,s]),p.jsx("canvas",{ref:a,className:"map-orb-weather-canvas","aria-hidden":"true"})}function Xy({section:e,sectionIndex:t,tree:n,progressMap:r,selectedNodeId:s,nextCueNodeId:i,dueNodeIds:a,streamingNodeIds:o,onJumpNode:l,physics:u,physicsWeather:c,scrollRef:h,navRef:f,onImpacts:d,onFlakes:m,orbSnowRef:b}){const g=n.filter(Y=>Y.parentId===e.id).sort((Y,X)=>Y.orderIdx-X.orderIdx),y=g.filter(Y=>Y.type==="lesson"),k=y.length>0&&y.every(Y=>{var X;return(((X=r[Y.id])==null?void 0:X.mastery)??0)>=Kx}),T=v.useRef(null),[S,E]=v.useState(268);v.useEffect(()=>{if(!T.current)return;const Y=()=>{var ge;const de=((ge=T.current)==null?void 0:ge.clientWidth)??268;E(de>0?de:268)};Y();const X=new ResizeObserver(Y);return X.observe(T.current),()=>X.disconnect()},[]);const w=iy(g.length,S,e.id),_=w.height,A=110,N=76,C=v.useRef(null),L=v.useRef(new Map),M=v.useRef(0),H=v.useRef(null),P=v.useRef(0),R=g.map(Y=>Y.id).join(","),B=g.map(Y=>{var X;return(Y.type==="exam"?!k:(((X=r[Y.id])==null?void 0:X.status)??"locked")==="locked")?1:0}).join("");v.useEffect(()=>{var st,Q;if(!u||g.length===0||S<=0)return;const Y=T.current,X=h.current;if(!Y||!X)return;let de;const ge=g[g.length-1];if((ge==null?void 0:ge.type)==="exam"){const re=(Q=(st=Y.closest("section"))==null?void 0:st.nextElementSibling)==null?void 0:Q.querySelector(".map-signpost");re&&(de={x:us(`${e.id}:next`,S),y:re.getBoundingClientRect().top-Y.getBoundingClientRect().top})}const ee=Ey({nodes:w.nodes.map((re,ve)=>{const ke=g[ve];return{id:ke.id,x:re.x,y:re.y,isExam:ke.type==="exam",locked:q(ke),spawn:(()=>{const Ne=L.current.get(ke.id);return Ne?vy(Ne,M.current,S):void 0})()}}),width:S,height:w.height+40,weather:c,anchorKnotX:us(`${e.id}:knot`,S),nextKnot:de});C.current=ee,Tb(e.id,ee,Y);const ie=Y.querySelector("[data-next-knot]");ie&&(ee.nextKnot?(ie.setAttribute("cx",String(ee.nextKnot.x)),ie.setAttribute("cy",String(ee.nextKnot.y))):ie.setAttribute("opacity","0"));const xe=Y.querySelector("[data-exam-rope]");xe&&!ee.nextKnot&&xe.setAttribute("opacity","0");const Se=new Map;for(const re of Y.querySelectorAll("[data-node-id]"))re.dataset.nodeId&&Se.set(re.dataset.nodeId,re);const Le=Array.from(Y.querySelectorAll("[data-rope]")),pe=Array.from(Y.querySelectorAll("[data-pulse]")),Te=Array.from(Y.querySelectorAll("[data-field]"));let Me=!0;const te=new IntersectionObserver(re=>{for(const ve of re)Me=ve.isIntersecting},{root:X,rootMargin:"200px 0px 200px 0px"});te.observe(Y);const Ie=520,be=[];let Fe=0,Qe=performance.now();const De=re=>{var bt;Fe=requestAnimationFrame(De);const ve=Math.min(50,re-Qe);if(Qe=re,!Me)return;ee.step(ve);for(const ye of ee.balls){const Be=Se.get(ye.nodeId);Be&&(Be.style.transform=fy(ye.body.position.x-ye.layoutX,ye.body.position.y-ye.layoutY,ye.squash,ye.squashAngle)),ye.squash=hy(ye.squash,ve),(bt=b.current)==null||bt.set(ye.nodeId,ye.snow)}const ke=ye=>{if(ye==="__anchor")return ee.anchor;if(ye==="__next")return ee.nextKnot??ee.anchor;const Be=ee.ball(ye);if(Be)return{x:Be.body.position.x,y:Be.body.position.y+Ut*xn};const Ve=g.findIndex(Ge=>Ge.id===ye),fe=Ve>=0?w.nodes[Ve]:void 0;return fe?{x:fe.x,y:fe.y+Ut*xn}:{x:0,y:0}};for(let ye=0;ye<ee.links.length&&ye<Le.length;ye++){const Be=ee.links[ye],Ve=[ke(Be.from)];for(const fe of Be.particles)Ve.push({x:fe.position.x,y:fe.position.y});Ve.push(ke(Be.to)),Le[ye].setAttribute("d",dy(Ve))}for(let ye=0;ye<ee.balls.length&&ye<Te.length;ye++){const Be=ee.balls[ye],Ve=Te[ye];Be.field>.03?(Ve.setAttribute("cx",String(Be.body.position.x)),Ve.setAttribute("cy",String(Be.body.position.y)),Ve.setAttribute("r",String(Ut+4+Be.field*5)),Ve.setAttribute("opacity",String((.3*Be.field).toFixed(3)))):Ve.setAttribute("opacity","0")}const Ne=ee.drainImpacts();for(const ye of Ne)be.push({x:ye.x,y:ye.y,t0:re,s:Math.min(1,ye.speed/14)});for(let ye=be.length-1;ye>=0;ye--)re-be[ye].t0>Ie&&be.splice(ye,1);for(let ye=0;ye<pe.length;ye++){const Be=be[ye],Ve=pe[ye];if(!Be){Ve.setAttribute("opacity","0");continue}const fe=(re-Be.t0)/Ie;Ve.setAttribute("cx",String(Be.x)),Ve.setAttribute("cy",String(Be.y)),Ve.setAttribute("r",String(6+fe*(14+Be.s*14))),Ve.setAttribute("opacity",String(.55*(1-fe))),Ve.setAttribute("stroke-width",String(2+Be.s*1.5))}const at=ee.drainFlakes();if((Ne.length>0||at.length>0)&&f.current){const ye=Y.getBoundingClientRect(),Be=f.current.getBoundingClientRect(),Ve=fe=>({x:fe.x+ye.left-Be.left,y:fe.y+ye.top-Be.top});Ne.length>0&&d(Ne.map(fe=>({...Ve(fe),speed:fe.speed}))),at.length>0&&m(at.map(fe=>({...Ve(fe),vx:fe.vx,vy:fe.vy,amount:fe.amount})))}};return Fe=requestAnimationFrame(De),()=>{cancelAnimationFrame(Fe),te.disconnect();for(const re of ee.balls)L.current.set(re.nodeId,{x:re.body.position.x,y:re.body.position.y,vx:re.body.velocity.x,vy:re.body.velocity.y});M.current=S,kb(e.id),ee.dispose(),C.current=null;for(const re of Se.values())re.style.transform=""}},[u,S,R,B,e.id,c]);const q=Y=>{var X;return Y?Y.type==="exam"?!k:(((X=r[Y.id])==null?void 0:X.status)??"locked")==="locked":!0},F=(Y,X)=>{if(!(!C.current||Y.button!==0||q(g.find(ee=>ee.id===X))||!T.current)){try{Y.currentTarget.setPointerCapture(Y.pointerId)}catch{}P.current=0,H.current={track:{startX:Y.clientX,startY:Y.clientY},id:Y.pointerId,dragging:!1,nodeId:X}}},V=Y=>{const X=H.current,de=C.current;if(!X||!de||Y.pointerId!==X.id)return;const ge=T.current;if(!ge||(!X.dragging&&Mc(X.track,Y.clientX,Y.clientY)==="drag"&&(X.dragging=!0,Y.currentTarget.style.zIndex="40",de.beginDrag(X.nodeId,Y.clientX-ge.getBoundingClientRect().left,Y.clientY-ge.getBoundingClientRect().top)),!X.dragging))return;const ee=ge.getBoundingClientRect();de.moveDrag(Y.clientX-ee.left,Y.clientY-ee.top)},I=Y=>{var de;const X=H.current;if(!(!X||Y.pointerId!==X.id)){if((de=C.current)==null||de.endDrag(),Y.currentTarget.style.zIndex="",Mc(X.track,Y.clientX,Y.clientY)==="drag")P.current=Date.now()+300;else{const ge=g.find(ee=>ee.id===X.nodeId);ge&&Date.now()>=P.current&&!q(ge)&&(Yo(Y.clientX,Y.clientY,ge.id),l(ge.id))}H.current=null}},W=Y=>{const X=g[Y],de=X?r[X.id]:void 0,ge=(de==null?void 0:de.status)==="mastered"||(de==null?void 0:de.status)==="in_progress"||(de==null?void 0:de.status)==="available";return{stroke:ge?"var(--brand)":"var(--ink-faint)",strokeWidth:ge?4:2.5,strokeOpacity:ge?.6:.5,strokeDasharray:ge?"none":"3 7"}},K=w.nodes[0]?{x:us(`${e.id}:knot`,S),y:$s}:{x:S/2,y:$s},D=g[g.length-1],ne=(D==null?void 0:D.type)==="exam",oe=w.nodes[w.nodes.length-1],J=ne&&oe?{x:us(`${e.id}:next`,S),y:_+24}:void 0;return p.jsxs("section",{"data-testid":`map-section-${e.id.slice(0,8)}`,className:"py-3 px-2",children:[p.jsxs("div",{className:"map-signpost flex items-center gap-2 mb-3 px-2.5 py-1.5 rounded-lg shadow-sm",children:[p.jsx("span",{className:"w-6 h-6 rounded-full bg-gold text-neutral-900 text-caption font-extrabold flex items-center justify-center shrink-0 ring-2 ring-gold/40 shadow-sm",children:t+1}),p.jsx("span",{className:"text-label font-bold text-white truncate flex-1 drop-shadow-[0_1px_2px_rgba(0,0,0,0.7)]",children:e.title})]}),p.jsxs("div",{ref:T,className:"relative",style:{minHeight:_},children:[p.jsx("svg",{className:"absolute inset-0 w-full h-full pointer-events-none","aria-hidden":"true",style:{height:_,overflow:"visible"},children:u?p.jsxs(p.Fragment,{children:[w.nodes[0]&&p.jsx("circle",{cx:K.x,cy:K.y,r:3.5,fill:"#ffc800",opacity:.9}),w.nodes[0]&&p.jsx("path",{"data-rope":0,d:`M ${K.x} ${K.y} L ${w.nodes[0].x} ${w.nodes[0].y+Ut*xn}`,fill:"none",strokeLinecap:"round",strokeLinejoin:"round",style:W(0)}),w.segments.map((Y,X)=>p.jsx("path",{"data-rope":X+1,d:`M ${Y.from.x} ${Y.from.y+Ut*xn} L ${Y.to.x} ${Y.to.y+Ut*xn}`,fill:"none",strokeLinecap:"round",strokeLinejoin:"round",style:W(Y.index)},Y.index)),J&&oe&&p.jsxs(p.Fragment,{children:[p.jsx("path",{"data-rope":w.segments.length+1,"data-exam-rope":!0,d:`M ${J.x} ${J.y} L ${oe.x} ${oe.y+Ut*xn}`,fill:"none",strokeLinecap:"round",strokeLinejoin:"round",style:W(g.length-1)}),p.jsx("circle",{"data-next-knot":!0,cx:J.x,cy:J.y,r:3.5,fill:"#ffc800",opacity:.9})]}),Array.from({length:8},(Y,X)=>p.jsx("circle",{"data-pulse":X,cx:0,cy:0,r:0,fill:"none",stroke:"white",opacity:0},X)),g.map((Y,X)=>p.jsx("circle",{"data-field":X,cx:0,cy:0,r:0,fill:"none",stroke:"#1cb0f6",strokeWidth:2,opacity:0},`f-${Y.id}`))]}):w.segments.map(Y=>{const X=Qy(g[Y.index],r);return p.jsx("path",{d:sy(Y),stroke:X?"var(--brand)":"var(--ink-faint)",strokeWidth:X?4:2.5,strokeOpacity:X?.6:.5,fill:"none",strokeLinecap:"round",strokeDasharray:X?"none":"3 7",style:X?{pathLength:1,animation:"path-draw 600ms var(--ease-out-expo)"}:void 0},Y.index)})}),g.map((Y,X)=>{const de=w.nodes[X];if(!de)return null;const ge=Qo(Y.id),ee=`${ge%40/10}s`,ie=`${5+ge%30/10}s`;return p.jsx("div",{"data-node-id":Y.id,"data-noswipe":"",className:u?`absolute hover:z-30 will-change-transform ${q(Y)?"cursor-not-allowed":"cursor-grab active:cursor-grabbing"}`:"absolute balloon-bob hover:z-30",style:{left:de.x-A/2,top:de.y-N/2+10,width:A,...u?{touchAction:"pan-y"}:{"--bob-delay":ee,"--bob-duration":ie}},onPointerDown:u?xe=>F(xe,Y.id):void 0,onPointerMove:u?V:void 0,onPointerUp:u?I:void 0,onPointerCancel:u?I:void 0,children:p.jsx(Zy,{lesson:Y,progress:r[Y.id],isSelected:Y.id===s,isNextCue:Y.id===i,isDue:a.has(Y.id),isStreaming:o.includes(Y.id),chapterLessonsMastered:k,onClick:()=>{Date.now()<P.current||(Yo(null,null,Y.id),l(Y.id))}})},Y.id)})]})]})}function Qy(e,t){const n=e?t[e.id]:void 0;return(n==null?void 0:n.status)==="mastered"||(n==null?void 0:n.status)==="in_progress"||(n==null?void 0:n.status)==="available"}function Zy({lesson:e,progress:t,isSelected:n,isNextCue:r,isDue:s,isStreaming:i,chapterLessonsMastered:a,onClick:o}){const l=Ye(),u=(t==null?void 0:t.status)??"locked",c=(t==null?void 0:t.crownLevel)??0,h=e.type==="exam",f=Math.min(3,c),d=h?!a:u==="locked",m=h&&d,b=!h&&(u==="in_progress"||u==="mastered"),g=u==="mastered"?100:u==="in_progress"?Math.round(((t==null?void 0:t.mastery)??0)*100):0;return p.jsxs("div",{className:"group relative flex flex-col items-center w-full",children:[p.jsxs("button",{onClick:()=>!d&&o(),disabled:d,"data-testid":`${h?"exam-node":"map-node"}-${e.id.slice(0,8)}`,className:`group relative w-14 h-14 flex items-center justify-center text-2xl rounded-full transition-all duration-200 ${h?m?"lesson-bubble exam-bubble-locked":e2(c>0):Jy(u)} ${d?"cursor-not-allowed":"cursor-pointer hover:scale-105"} ${n?"ring-4 ring-accent ring-offset-2 ring-offset-neutral-50 dark:ring-offset-neutral-950":""} ${r?"next-cue":""}`,title:void 0,"data-tooltip":m?`🔒 ${e.title}${l("node.locked.chapterHint")}`:h?`🎯 ${e.title}`:d?`🔒 ${e.title}`:s?`📖 ${e.title}${l("node.due.hint")}`:e.title,children:[i&&p.jsx(fm,{className:"absolute -top-1.5 -right-1.5 z-10 w-4 h-4 text-accent bg-surface-0 rounded-full p-0.5 animate-spin shadow-pop pointer-events-none","aria-label":l("thread.streamingBadge"),"data-testid":`node-streaming-${e.id.slice(0,8)}`}),b&&p.jsxs("svg",{className:"absolute inset-0 w-full h-full -rotate-90 pointer-events-none",viewBox:"0 0 56 56","aria-hidden":"true",children:[p.jsx("circle",{cx:"28",cy:"28",r:"25",fill:"none",stroke:"rgb(255 255 255 / 0.2)",strokeWidth:"2.5"}),p.jsx("circle",{cx:"28",cy:"28",r:"25",fill:"none",stroke:u==="mastered"?"#ffc800":"white",strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:`${g/100*157} 157`,className:"transition-all duration-500"})]}),h?m?p.jsx("span",{"aria-label":"exam-locked",className:"relative z-10 opacity-60",children:"🔒"}):p.jsx(Vx,{"aria-label":"exam",className:"relative z-10 w-6 h-6 text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.4)]",strokeWidth:2.5}):d?p.jsx("span",{"aria-label":"locked",className:"relative z-10 opacity-50",children:"🔒"}):u==="mastered"?p.jsx("span",{"aria-label":"mastered",className:"relative z-10 drop-shadow-lg crown-sparkle",children:"👑"}):u==="in_progress"?p.jsx(nn,{"aria-label":"in-progress",className:"relative z-10 w-6 h-6 text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.4)]",strokeWidth:2.5}):p.jsx("span",{"aria-label":"available",className:"relative z-10 drop-shadow",children:"⭐"}),s&&!d&&!h&&p.jsx("span",{className:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-review text-white text-caption flex items-center justify-center font-bold border-2 border-neutral-50 dark:border-neutral-950",children:"!"})]}),h&&p.jsx("div",{className:"flex gap-0.5 mt-1","data-testid":`map-stars-${e.id.slice(0,8)}`,children:[0,1,2].map(y=>p.jsx("span",{className:`text-caption ${y<f?"text-gold":"text-white/25"}`,children:"★"},y))}),n&&p.jsx("div",{className:"mt-1 text-caption text-center leading-tight max-w-[120px] font-bold px-1.5 py-0.5 rounded-md bg-brand/90 text-white shadow-sm",children:e.title})]})}function Jy(e){switch(e){case"locked":return"lesson-bubble lesson-bubble-locked";case"available":return"lesson-bubble lesson-bubble-available";case"in_progress":return"lesson-bubble lesson-bubble-in-progress";case"mastered":return"lesson-bubble lesson-bubble-mastered";default:return"lesson-bubble lesson-bubble-locked"}}function e2(e){return e?"lesson-bubble exam-bubble-passed":"lesson-bubble exam-bubble"}function t2({available:e,current:t,onChange:n}){const r=Ye(),[s,i]=v.useState(!1),a={en:"English","zh-CN":"中文","zh-TW":"繁體",ja:"日本語",ko:"한국어",fr:"Français",de:"Deutsch",es:"Español","pt-BR":"Português",ru:"Русский",it:"Italiano",ar:"العربية",hi:"हिन्दी",tr:"Türkçe",pl:"Polski",nl:"Nederlands",id:"Indonesia",vi:"Tiếng Việt",th:"ไทย",sv:"Svenska",fi:"Suomi"},o=t?a[t]??t:r("lang.original");return p.jsxs("div",{className:"relative shrink-0",children:[p.jsxs("button",{onClick:()=>i(!s),className:"flex items-center gap-1 px-1.5 py-0.5 rounded-md text-caption font-bold text-white/80 hover:text-white hover:bg-white/10 transition-colors","data-testid":"lang-switcher-btn",children:[p.jsx(yx,{className:"w-3 h-3"}),o]}),s&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>i(!1)}),p.jsxs("div",{className:"absolute top-full right-0 mt-1 z-50 bg-surface-0 rounded-lg shadow-elevated p-1 min-w-[100px] max-h-48 overflow-y-auto",children:[p.jsx("button",{"data-testid":"lang-option-original",onClick:()=>{n(null),i(!1)},className:`w-full text-left px-2 py-1 rounded-md text-caption font-bold transition-colors ${t===null?"bg-brand/15 text-brand":"text-ink-muted hover:bg-neutral-100 dark:hover:bg-neutral-800"}`,children:r("lang.original")}),e.map(l=>p.jsx("button",{"data-testid":`lang-option-${l}`,onClick:()=>{n(l),i(!1)},className:`w-full text-left px-2 py-1 rounded-md text-caption font-bold transition-colors ${t===l?"bg-brand/15 text-brand":"text-ink-muted hover:bg-neutral-100 dark:hover:bg-neutral-800"}`,children:a[l]??l},l))]})]})]})}const n2=500,qn=8;function r2(){const[e,t]=v.useState(null),[n,r]=v.useState({mode:"cursor",x:0,y:0}),[s,i]=v.useState({w:0,h:0}),a=v.useRef(null),o=v.useCallback(()=>window.matchMedia("(pointer: coarse)").matches,[]),l=v.useCallback(g=>{o()||r(y=>y.mode==="cursor"?{...y,x:g.clientX,y:g.clientY}:y)},[o]),u=v.useCallback(g=>{var T;if(o())return;const y=(T=g.target)==null?void 0:T.closest("[data-tooltip]"),k=y==null?void 0:y.getAttribute("data-tooltip");if(k){t(k),r({mode:"cursor",x:g.clientX,y:g.clientY});return}t(null)},[o]),c=v.useCallback(g=>{var k,T;if(o())return;((T=(k=g.target)==null?void 0:k.closest)==null?void 0:T.call(k,"[data-tooltip]"))&&t(null)},[o]);if(v.useEffect(()=>(document.addEventListener("mousemove",l,{passive:!0}),document.addEventListener("mouseover",u,{passive:!0}),document.addEventListener("mouseout",c,{passive:!0}),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseover",u),document.removeEventListener("mouseout",c)}),[l,u,c]),v.useEffect(()=>{let g=null;const y=()=>{g&&(clearTimeout(g),g=null)},k=w=>{var C;if(!o()||w.touches.length!==1)return y();const _=(C=w.target)==null?void 0:C.closest("[data-tooltip]"),A=_==null?void 0:_.getAttribute("data-tooltip");if(!A||!_)return y();const N=_;y(),g=setTimeout(()=>{N.isConnected&&(t(A),r({mode:"rect",x:0,y:0,rect:N.getBoundingClientRect()}))},n2)},T=()=>{y(),t(w=>w&&null)},S=()=>y(),E=()=>{y(),t(null)};return document.addEventListener("touchstart",k,{passive:!0}),document.addEventListener("touchend",T,{passive:!0}),document.addEventListener("touchmove",S,{passive:!0}),document.addEventListener("touchcancel",E,{passive:!0}),()=>{y(),document.removeEventListener("touchstart",k),document.removeEventListener("touchend",T),document.removeEventListener("touchmove",S),document.removeEventListener("touchcancel",E)}},[o]),v.useLayoutEffect(()=>{a.current&&e&&i({w:a.current.offsetWidth,h:a.current.offsetHeight})},[e]),!e)return null;const h=window.innerWidth,f=window.innerHeight;let d,m,b;if(n.mode==="rect"&&n.rect){const g=n.rect;d=g.left+g.width/2-s.w/2,m=g.top-s.h-6,b="none",m<qn&&(m=g.bottom+6)}else d=n.x,m=n.y-6,b="translate(0, -100%)";return d=Math.min(Math.max(d,qn),Math.max(qn,h-s.w-qn)),m=Math.min(Math.max(m,qn),Math.max(qn,f-s.h-qn)),wm.createPortal(p.jsx("div",{ref:a,style:{position:"fixed",left:d,top:m,transform:b,zIndex:99999,pointerEvents:"none",visibility:s.w?"visible":"hidden",background:"rgb(var(--surface-0-rgb) / 0.92)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",color:"var(--ink)",border:"1px solid rgb(var(--border-rgb) / 0.5)",fontSize:"0.875rem",fontWeight:600,lineHeight:1.4,padding:"4px 10px",borderRadius:"8px",maxWidth:"260px",wordBreak:"break-word",boxShadow:"0 4px 12px rgb(var(--shadow-rgb) / 0.15)",whiteSpace:"normal"},children:e}),document.body)}function cM(){}function Hc(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const a=n.slice(s,r).trim();(a||!i)&&t.push(a),s=r+1,r=n.indexOf(",",s)}return t}function Om(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const i2=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,s2=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,a2={};function Uc(e,t){return(a2.jsx?s2:i2).test(e)}const o2=/[ \t\n\f\r]/g;function l2(e){return typeof e=="object"?e.type==="text"?zc(e.value):!1:zc(e)}function zc(e){return e.replace(o2,"")===""}class ji{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}ji.prototype.normal={};ji.prototype.property={};ji.prototype.space=void 0;function Bm(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new ji(n,r,t)}function _i(e){return e.toLowerCase()}class Rt{constructor(t,n){this.attribute=n,this.property=t}}Rt.prototype.attribute="";Rt.prototype.booleanish=!1;Rt.prototype.boolean=!1;Rt.prototype.commaOrSpaceSeparated=!1;Rt.prototype.commaSeparated=!1;Rt.prototype.defined=!1;Rt.prototype.mustUseProperty=!1;Rt.prototype.number=!1;Rt.prototype.overloadedBoolean=!1;Rt.prototype.property="";Rt.prototype.spaceSeparated=!1;Rt.prototype.space=void 0;let u2=0;const Pe=hr(),ct=hr(),Zo=hr(),ce=hr(),et=hr(),rr=hr(),Dt=hr();function hr(){return 2**++u2}const Jo=Object.freeze(Object.defineProperty({__proto__:null,boolean:Pe,booleanish:ct,commaOrSpaceSeparated:Dt,commaSeparated:rr,number:ce,overloadedBoolean:Zo,spaceSeparated:et},Symbol.toStringTag,{value:"Module"})),Ja=Object.keys(Jo);class ru extends Rt{constructor(t,n,r,s){let i=-1;if(super(t,n),Vc(this,"space",s),typeof r=="number")for(;++i<Ja.length;){const a=Ja[i];Vc(this,Ja[i],(r&Jo[a])===Jo[a])}}}ru.prototype.defined=!0;function Vc(e,t,n){n&&(e[t]=n)}function Fr(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new ru(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[_i(r)]=r,n[_i(i.attribute)]=r}return new ji(t,n,e.space)}const Fm=Fr({properties:{ariaActiveDescendant:null,ariaAtomic:ct,ariaAutoComplete:null,ariaBusy:ct,ariaChecked:ct,ariaColCount:ce,ariaColIndex:ce,ariaColSpan:ce,ariaControls:et,ariaCurrent:null,ariaDescribedBy:et,ariaDetails:null,ariaDisabled:ct,ariaDropEffect:et,ariaErrorMessage:null,ariaExpanded:ct,ariaFlowTo:et,ariaGrabbed:ct,ariaHasPopup:null,ariaHidden:ct,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:et,ariaLevel:ce,ariaLive:null,ariaModal:ct,ariaMultiLine:ct,ariaMultiSelectable:ct,ariaOrientation:null,ariaOwns:et,ariaPlaceholder:null,ariaPosInSet:ce,ariaPressed:ct,ariaReadOnly:ct,ariaRelevant:null,ariaRequired:ct,ariaRoleDescription:et,ariaRowCount:ce,ariaRowIndex:ce,ariaRowSpan:ce,ariaSelected:ct,ariaSetSize:ce,ariaSort:null,ariaValueMax:ce,ariaValueMin:ce,ariaValueNow:ce,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function jm(e,t){return t in e?e[t]:t}function Hm(e,t){return jm(e,t.toLowerCase())}const c2=Fr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:rr,acceptCharset:et,accessKey:et,action:null,allow:null,allowFullScreen:Pe,allowPaymentRequest:Pe,allowUserMedia:Pe,alpha:Pe,alt:null,as:null,async:Pe,autoCapitalize:null,autoComplete:et,autoFocus:Pe,autoPlay:Pe,blocking:et,capture:null,charSet:null,checked:Pe,cite:null,className:et,closedBy:null,colorSpace:null,cols:ce,colSpan:ce,command:null,commandFor:null,content:null,contentEditable:ct,controls:Pe,controlsList:et,coords:ce|rr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Pe,defer:Pe,dir:null,dirName:null,disabled:Pe,download:Zo,draggable:ct,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Pe,formTarget:null,headers:et,height:ce,hidden:Zo,high:ce,href:null,hrefLang:null,htmlFor:et,httpEquiv:et,id:null,imageSizes:null,imageSrcSet:null,inert:Pe,inputMode:null,integrity:null,is:null,isMap:Pe,itemId:null,itemProp:et,itemRef:et,itemScope:Pe,itemType:et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Pe,low:ce,manifest:null,max:null,maxLength:ce,media:null,method:null,min:null,minLength:ce,multiple:Pe,muted:Pe,name:null,nonce:null,noModule:Pe,noValidate:Pe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Pe,optimum:ce,pattern:null,ping:et,placeholder:null,playsInline:Pe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Pe,referrerPolicy:null,rel:et,required:Pe,reversed:Pe,rows:ce,rowSpan:ce,sandbox:et,scope:null,scoped:Pe,seamless:Pe,selected:Pe,shadowRootClonable:Pe,shadowRootCustomElementRegistry:Pe,shadowRootDelegatesFocus:Pe,shadowRootMode:null,shadowRootSerializable:Pe,shape:null,size:ce,sizes:null,slot:null,span:ce,spellCheck:ct,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ce,step:null,style:null,tabIndex:ce,target:null,title:null,translate:null,type:null,typeMustMatch:Pe,useMap:null,value:ct,width:ce,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:et,axis:null,background:null,bgColor:null,border:ce,borderColor:null,bottomMargin:ce,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Pe,declare:Pe,event:null,face:null,frame:null,frameBorder:null,hSpace:ce,leftMargin:ce,link:null,longDesc:null,lowSrc:null,marginHeight:ce,marginWidth:ce,noResize:Pe,noHref:Pe,noShade:Pe,noWrap:Pe,object:null,profile:null,prompt:null,rev:null,rightMargin:ce,rules:null,scheme:null,scrolling:ct,standby:null,summary:null,text:null,topMargin:ce,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ce,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Pe,disablePictureInPicture:Pe,disableRemotePlayback:Pe,exportParts:rr,part:et,prefix:null,property:null,results:ce,security:null,unselectable:null},space:"html",transform:Hm}),d2=Fr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Dt,accentHeight:ce,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ce,amplitude:ce,arabicForm:null,ascent:ce,attributeName:null,attributeType:null,azimuth:ce,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ce,by:null,calcMode:null,capHeight:ce,className:et,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ce,diffuseConstant:ce,direction:null,display:null,dur:null,divisor:ce,dominantBaseline:null,download:Pe,dx:null,dy:null,edgeMode:null,editable:null,elevation:ce,enableBackground:null,end:null,event:null,exponent:ce,externalResourcesRequired:null,fill:null,fillOpacity:ce,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:rr,g2:rr,glyphName:rr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ce,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ce,horizOriginX:ce,horizOriginY:ce,id:null,ideographic:ce,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ce,k:ce,k1:ce,k2:ce,k3:ce,k4:ce,kernelMatrix:Dt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ce,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ce,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ce,overlineThickness:ce,paintOrder:null,panose1:null,path:null,pathLength:ce,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ce,pointsAtY:ce,pointsAtZ:ce,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Dt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Dt,rev:Dt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Dt,requiredFeatures:Dt,requiredFonts:Dt,requiredFormats:Dt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ce,specularExponent:ce,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ce,strikethroughThickness:ce,string:null,stroke:null,strokeDashArray:Dt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ce,strokeOpacity:ce,strokeWidth:null,style:null,surfaceScale:ce,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Dt,tabIndex:ce,tableValues:null,target:null,targetX:ce,targetY:ce,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Dt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ce,underlineThickness:ce,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ce,values:null,vAlphabetic:ce,vMathematical:ce,vectorEffect:null,vHanging:ce,vIdeographic:ce,version:null,vertAdvY:ce,vertOriginX:ce,vertOriginY:ce,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ce,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:jm}),Um=Fr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),zm=Fr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Hm}),Vm=Fr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),h2={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},f2=/[A-Z]/g,qc=/-[a-z]/g,m2=/^data[-\w.:]+$/i;function ba(e,t){const n=_i(t);let r=t,s=Rt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&m2.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(qc,g2);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!qc.test(i)){let a=i.replace(f2,p2);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=ru}return new s(r,t)}function p2(e){return"-"+e.toLowerCase()}function g2(e){return e.charAt(1).toUpperCase()}const Hi=Bm([Fm,c2,Um,zm,Vm],"html"),Mn=Bm([Fm,d2,Um,zm,Vm],"svg");function Wc(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function qm(e){return e.join(" ").trim()}var br={},eo,$c;function b2(){if($c)return eo;$c=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,l=`
487
+ `,u="/",c="*",h="",f="comment",d="declaration";function m(g,y){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];y=y||{};var k=1,T=1;function S(P){var R=P.match(t);R&&(k+=R.length);var B=P.lastIndexOf(l);T=~B?P.length-B:T+P.length}function E(){var P={line:k,column:T};return function(R){return R.position=new w(P),N(),R}}function w(P){this.start=P,this.end={line:k,column:T},this.source=y.source}w.prototype.content=g;function _(P){var R=new Error(y.source+":"+k+":"+T+": "+P);if(R.reason=P,R.filename=y.source,R.line=k,R.column=T,R.source=g,!y.silent)throw R}function A(P){var R=P.exec(g);if(R){var B=R[0];return S(B),g=g.slice(B.length),R}}function N(){A(n)}function C(P){var R;for(P=P||[];R=L();)R!==!1&&P.push(R);return P}function L(){var P=E();if(!(u!=g.charAt(0)||c!=g.charAt(1))){for(var R=2;h!=g.charAt(R)&&(c!=g.charAt(R)||u!=g.charAt(R+1));)++R;if(R+=2,h===g.charAt(R-1))return _("End of comment missing");var B=g.slice(2,R-2);return T+=2,S(B),g=g.slice(R),T+=2,P({type:f,comment:B})}}function M(){var P=E(),R=A(r);if(R){if(L(),!A(s))return _("property missing ':'");var B=A(i),q=P({type:d,property:b(R[0].replace(e,h)),value:B?b(B[0].replace(e,h)):h});return A(a),q}}function H(){var P=[];C(P);for(var R;R=M();)R!==!1&&(P.push(R),C(P));return P}return N(),H()}function b(g){return g?g.replace(o,h):h}return eo=m,eo}var Yc;function x2(){if(Yc)return br;Yc=1;var e=br&&br.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(br,"__esModule",{value:!0}),br.default=n;const t=e(b2());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const a=(0,t.default)(r),o=typeof s=="function";return a.forEach(l=>{if(l.type!=="declaration")return;const{property:u,value:c}=l;o?s(u,c,l):c&&(i=i||{},i[u]=c)}),i}return br}var Kr={},Gc;function y2(){if(Gc)return Kr;Gc=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(u){return!u||n.test(u)||e.test(u)},a=function(u,c){return c.toUpperCase()},o=function(u,c){return"".concat(c,"-")},l=function(u,c){return c===void 0&&(c={}),i(u)?u:(u=u.toLowerCase(),c.reactCompat?u=u.replace(s,o):u=u.replace(r,o),u.replace(t,a))};return Kr.camelCase=l,Kr}var Xr,Kc;function E2(){if(Kc)return Xr;Kc=1;var e=Xr&&Xr.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(x2()),n=y2();function r(s,i){var a={};return!s||typeof s!="string"||(0,t.default)(s,function(o,l){o&&l&&(a[(0,n.camelCase)(o,i)]=l)}),a}return r.default=r,Xr=r,Xr}var v2=E2();const T2=Yl(v2),xa=Wm("end"),fn=Wm("start");function Wm(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function $m(e){const t=fn(e),n=xa(e);if(t&&n)return{start:t,end:n}}function ci(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Xc(e.position):"start"in e||"end"in e?Xc(e):"line"in e||"column"in e?el(e):""}function el(e){return Qc(e&&e.line)+":"+Qc(e&&e.column)}function Xc(e){return el(e&&e.start)+"-"+el(e&&e.end)}function Qc(e){return e&&typeof e=="number"?e:1}class Tt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(a=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=o?o.line:void 0,this.name=ci(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Tt.prototype.file="";Tt.prototype.name="";Tt.prototype.reason="";Tt.prototype.message="";Tt.prototype.stack="";Tt.prototype.column=void 0;Tt.prototype.line=void 0;Tt.prototype.ancestors=void 0;Tt.prototype.cause=void 0;Tt.prototype.fatal=void 0;Tt.prototype.place=void 0;Tt.prototype.ruleId=void 0;Tt.prototype.source=void 0;const iu={}.hasOwnProperty,k2=new Map,w2=/[A-Z]/g,S2=new Set(["table","tbody","thead","tfoot","tr"]),A2=new Set(["td","th"]),Ym="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function C2(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=D2(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=L2(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Mn:Hi,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Gm(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function Gm(e,t,n){if(t.type==="element")return _2(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return N2(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return R2(e,t,n);if(t.type==="mdxjsEsm")return I2(e,t);if(t.type==="root")return P2(e,t,n);if(t.type==="text")return M2(e,t)}function _2(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Mn,e.schema=s),e.ancestors.push(t);const i=Xm(e,t.tagName,!1),a=O2(e,t);let o=au(e,t);return S2.has(t.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!l2(l):!0})),Km(e,a,i,t),su(a,o),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function N2(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Ni(e,t.position)}function I2(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ni(e,t.position)}function R2(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Mn,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:Xm(e,t.name,!0),a=B2(e,t),o=au(e,t);return Km(e,a,i,t),su(a,o),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function P2(e,t,n){const r={};return su(r,au(e,t)),e.create(t,e.Fragment,r,n)}function M2(e,t){return t.value}function Km(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function su(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function L2(e,t,n){return r;function r(s,i,a,o){const u=Array.isArray(a.children)?n:t;return o?u(i,a,o):u(i,a)}}function D2(e,t){return n;function n(r,s,i,a){const o=Array.isArray(i.children),l=fn(r);return t(s,i,a,o,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function O2(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&iu.call(t.properties,s)){const i=F2(e,s,t.properties[s]);if(i){const[a,o]=i;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&A2.has(t.tagName)?r=o:n[a]=o}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function B2(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else Ni(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else Ni(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function au(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:k2;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const u=s.get(l)||0;a=l+"-"+u,s.set(l,u+1)}}const o=Gm(e,i,a);o!==void 0&&n.push(o)}return n}function F2(e,t,n){const r=ba(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Om(n):qm(n)),r.property==="style"){let s=typeof n=="object"?n:j2(e,String(n));return e.stylePropertyNameCase==="css"&&(s=H2(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?h2[r.property]||r.property:r.attribute,n]}}function j2(e,t){try{return T2(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Tt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=Ym+"#cannot-parse-style-attribute",s}}function Xm(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,a;for(;++i<s.length;){const o=Uc(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};a=a?{type:"MemberExpression",object:a,property:o,computed:!!(i&&o.type==="Literal"),optional:!1}:o}r=a}else r=Uc(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return iu.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ni(e)}function Ni(e,t){const n=new Tt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Ym+"#cannot-handle-mdx-estrees-without-createevaluater",n}function H2(e){const t={};let n;for(n in e)iu.call(e,n)&&(t[U2(n)]=e[n]);return t}function U2(e){let t=e.replace(w2,z2);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function z2(e){return"-"+e.toLowerCase()}const to={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},V2={};function ou(e,t){const n=V2,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Qm(e,r,s)}function Qm(e,t,n){if(q2(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Zc(e.children,t,n)}return Array.isArray(e)?Zc(e,t,n):""}function Zc(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=Qm(e[s],t,n);return r.join("")}function q2(e){return!!(e&&typeof e=="object")}const Jc=document.createElement("i");function lu(e){const t="&"+e+";";Jc.innerHTML=t;const n=Jc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ot(e,t,n,r){const s=e.length;let i=0,a;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i<r.length;)a=r.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function zt(e,t){return e.length>0?(Ot(e,e.length,0,t),e):t}const ed={}.hasOwnProperty;function Zm(e){const t={};let n=-1;for(;++n<e.length;)W2(t,e[n]);return t}function W2(e,t){let n;for(n in t){const s=(ed.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){ed.call(s,a)||(s[a]=[]);const o=i[a];$2(s[a],Array.isArray(o)?o:o?[o]:[])}}}function $2(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ot(e,0,0,r)}function Jm(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function en(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const St=Ln(/[A-Za-z]/),vt=Ln(/[\dA-Za-z]/),Y2=Ln(/[#-'*+\--9=?A-Z^-~]/);function Ys(e){return e!==null&&(e<32||e===127)}const tl=Ln(/\d/),G2=Ln(/[\dA-Fa-f]/),K2=Ln(/[!-/:-@[-`{-~]/);function _e(e){return e!==null&&e<-2}function rt(e){return e!==null&&(e<0||e===32)}function Ue(e){return e===-2||e===-1||e===32}const ya=Ln(new RegExp("\\p{P}|\\p{S}","u")),ur=Ln(/\s/);function Ln(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function jr(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&vt(e.charCodeAt(n+1))&&vt(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const o=e.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(a=String.fromCharCode(i,o),s=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function qe(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(l){return Ue(l)?(e.enter(n),o(l)):t(l)}function o(l){return Ue(l)&&i++<s?(e.consume(l),o):(e.exit(n),t(l))}}const X2={tokenize:Q2};function Q2(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),qe(e,t,"linePrefix")}function s(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(o)}function a(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return _e(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),a)}}const Z2={tokenize:J2},td={tokenize:eE};function J2(e){const t=this,n=[];let r=0,s,i,a;return o;function o(T){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,l,u)(T)}return u(T)}function l(T){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&k();const S=t.events.length;let E=S,w;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){w=t.events[E][1].end;break}y(r);let _=S;for(;_<t.events.length;)t.events[_][1].end={...w},_++;return Ot(t.events,E+1,0,t.events.slice(S)),t.events.length=_,u(T)}return o(T)}function u(T){if(r===n.length){if(!s)return f(T);if(s.currentConstruct&&s.currentConstruct.concrete)return m(T);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(td,c,h)(T)}function c(T){return s&&k(),y(r),f(T)}function h(T){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,m(T)}function f(T){return t.containerState={},e.attempt(td,d,m)(T)}function d(T){return r++,n.push([t.currentConstruct,t.containerState]),f(T)}function m(T){if(T===null){s&&k(),y(0),e.consume(T);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),b(T)}function b(T){if(T===null){g(e.exit("chunkFlow"),!0),y(0),e.consume(T);return}return _e(T)?(e.consume(T),g(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(T),b)}function g(T,S){const E=t.sliceStream(T);if(S&&E.push(null),T.previous=i,i&&(i.next=T),i=T,s.defineSkip(T.start),s.write(E),t.parser.lazy[T.start.line]){let w=s.events.length;for(;w--;)if(s.events[w][1].start.offset<a&&(!s.events[w][1].end||s.events[w][1].end.offset>a))return;const _=t.events.length;let A=_,N,C;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(N){C=t.events[A][1].end;break}N=!0}for(y(r),w=_;w<t.events.length;)t.events[w][1].end={...C},w++;Ot(t.events,A+1,0,t.events.slice(_)),t.events.length=w}}function y(T){let S=n.length;for(;S-- >T;){const E=n[S];t.containerState=E[1],E[0].exit.call(t,e)}n.length=T}function k(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function eE(e,t,n){return qe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Lr(e){if(e===null||rt(e)||ur(e))return 1;if(ya(e))return 2}function Ea(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const nl={name:"attention",resolveAll:tE,tokenize:nE};function tE(e,t){let n=-1,r,s,i,a,o,l,u,c;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},f={...e[n][1].start};nd(h,-l),nd(f,l),a={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:l>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[n][1].start={...o.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=zt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=zt(u,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),u=zt(u,Ea(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=zt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=zt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Ot(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function nE(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Lr(r);let i;return a;function a(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),c=Lr(l),h=!c||c===2&&s||n.includes(l),f=!s||s===2&&c||n.includes(r);return u._open=!!(i===42?h:h&&(s||!f)),u._close=!!(i===42?f:f&&(c||!h)),t(l)}}function nd(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const rE={name:"autolink",tokenize:iE};function iE(e,t,n){let r=0;return s;function s(d){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(d){return St(d)?(e.consume(d),a):d===64?n(d):u(d)}function a(d){return d===43||d===45||d===46||vt(d)?(r=1,o(d)):u(d)}function o(d){return d===58?(e.consume(d),r=0,l):(d===43||d===45||d===46||vt(d))&&r++<32?(e.consume(d),o):(r=0,u(d))}function l(d){return d===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),t):d===null||d===32||d===60||Ys(d)?n(d):(e.consume(d),l)}function u(d){return d===64?(e.consume(d),c):Y2(d)?(e.consume(d),u):n(d)}function c(d){return vt(d)?h(d):n(d)}function h(d){return d===46?(e.consume(d),r=0,c):d===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),t):f(d)}function f(d){if((d===45||vt(d))&&r++<63){const m=d===45?f:h;return e.consume(d),m}return n(d)}}const Ui={partial:!0,tokenize:sE};function sE(e,t,n){return r;function r(i){return Ue(i)?qe(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||_e(i)?t(i):n(i)}}const ep={continuation:{tokenize:oE},exit:lE,name:"blockQuote",tokenize:aE};function aE(e,t,n){const r=this;return s;function s(a){if(a===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),i}return n(a)}function i(a){return Ue(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function oE(e,t,n){const r=this;return s;function s(a){return Ue(a)?qe(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(ep,t,n)(a)}}function lE(e){e.exit("blockQuote")}const tp={name:"characterEscape",tokenize:uE};function uE(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return K2(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const np={name:"characterReference",tokenize:cE};function cE(e,t,n){const r=this;let s=0,i,a;return o;function o(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,a=vt,c(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=G2,c):(e.enter("characterReferenceValue"),i=7,a=tl,c(h))}function c(h){if(h===59&&s){const f=e.exit("characterReferenceValue");return a===vt&&!lu(r.sliceSerialize(f))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(h)&&s++<i?(e.consume(h),c):n(h)}}const rd={partial:!0,tokenize:hE},id={concrete:!0,name:"codeFenced",tokenize:dE};function dE(e,t,n){const r=this,s={partial:!0,tokenize:E};let i=0,a=0,o;return l;function l(w){return u(w)}function u(w){const _=r.events[r.events.length-1];return i=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,o=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(w)}function c(w){return w===o?(a++,e.consume(w),c):a<3?n(w):(e.exit("codeFencedFenceSequence"),Ue(w)?qe(e,h,"whitespace")(w):h(w))}function h(w){return w===null||_e(w)?(e.exit("codeFencedFence"),r.interrupt?t(w):e.check(rd,b,S)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(w))}function f(w){return w===null||_e(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(w)):Ue(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),qe(e,d,"whitespace")(w)):w===96&&w===o?n(w):(e.consume(w),f)}function d(w){return w===null||_e(w)?h(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===null||_e(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(w)):w===96&&w===o?n(w):(e.consume(w),m)}function b(w){return e.attempt(s,S,g)(w)}function g(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),y}function y(w){return i>0&&Ue(w)?qe(e,k,"linePrefix",i+1)(w):k(w)}function k(w){return w===null||_e(w)?e.check(rd,b,S)(w):(e.enter("codeFlowValue"),T(w))}function T(w){return w===null||_e(w)?(e.exit("codeFlowValue"),k(w)):(e.consume(w),T)}function S(w){return e.exit("codeFenced"),t(w)}function E(w,_,A){let N=0;return C;function C(R){return w.enter("lineEnding"),w.consume(R),w.exit("lineEnding"),L}function L(R){return w.enter("codeFencedFence"),Ue(R)?qe(w,M,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):M(R)}function M(R){return R===o?(w.enter("codeFencedFenceSequence"),H(R)):A(R)}function H(R){return R===o?(N++,w.consume(R),H):N>=a?(w.exit("codeFencedFenceSequence"),Ue(R)?qe(w,P,"whitespace")(R):P(R)):A(R)}function P(R){return R===null||_e(R)?(w.exit("codeFencedFence"),_(R)):A(R)}}}function hE(e,t,n){const r=this;return s;function s(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const no={name:"codeIndented",tokenize:mE},fE={partial:!0,tokenize:pE};function mE(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),qe(e,i,"linePrefix",5)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?l(u):_e(u)?e.attempt(fE,a,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||_e(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function pE(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):_e(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):qe(e,i,"linePrefix",5)(a)}function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):_e(a)?s(a):n(a)}}const gE={name:"codeText",previous:xE,resolve:bE,tokenize:yE};function bE(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function xE(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function yE(e,t,n){let r=0,s,i;return a;function a(h){return e.enter("codeText"),e.enter("codeTextSequence"),o(h)}function o(h){return h===96?(e.consume(h),r++,o):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(i=e.enter("codeTextSequence"),s=0,c(h)):_e(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||_e(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),u)}function c(h){return h===96?(e.consume(h),s++,c):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}class EE{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Qr(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Qr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Qr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Qr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Qr(this.left,n.reverse())}}}function Qr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function rp(e){const t={};let n=-1,r,s,i,a,o,l,u;const c=new EE(e);for(;++n<c.length;){for(;n in t;)n=t[n];if(r=c.get(n),n&&r[1].type==="chunkFlow"&&c.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,vE(c,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(a=c.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(c.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...c.get(s)[1].start},o=c.slice(s,n),o.unshift(r),c.splice(s,n-s+1,o))}}return Ot(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function vE(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const o=a.events,l=[],u={};let c,h,f=-1,d=n,m=0,b=0;const g=[b];for(;d;){for(;e.get(++s)[1]!==d;);i.push(s),d._tokenizer||(c=r.sliceStream(d),d.next||c.push(null),h&&a.defineSkip(d.start),d._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(c),d._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),h=d,d=d.next}for(d=n;++f<o.length;)o[f][0]==="exit"&&o[f-1][0]==="enter"&&o[f][1].type===o[f-1][1].type&&o[f][1].start.line!==o[f][1].end.line&&(b=f+1,g.push(b),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(a.events=[],d?(d._tokenizer=void 0,d.previous=void 0):g.pop(),f=g.length;f--;){const y=o.slice(g[f],g[f+1]),k=i.pop();l.push([k,k+y.length-1]),e.splice(k,2,y)}for(l.reverse(),f=-1;++f<l.length;)u[m+l[f][0]]=m+l[f][1],m+=l[f][1]-l[f][0]-1;return u}const TE={resolve:wE,tokenize:SE},kE={partial:!0,tokenize:AE};function wE(e){return rp(e),e}function SE(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(o)}function s(o){return o===null?i(o):_e(o)?e.check(kE,a,i)(o):(e.consume(o),s)}function i(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function a(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function AE(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),qe(e,i,"linePrefix")}function i(a){if(a===null||_e(a))return n(a);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function ip(e,t,n,r,s,i,a,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return h;function h(y){return y===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(y),e.exit(i),f):y===null||y===32||y===41||Ys(y)?n(y):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),b(y))}function f(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),d(y))}function d(y){return y===62?(e.exit("chunkString"),e.exit(o),f(y)):y===null||y===60||_e(y)?n(y):(e.consume(y),y===92?m:d)}function m(y){return y===60||y===62||y===92?(e.consume(y),d):d(y)}function b(y){return!c&&(y===null||y===41||rt(y))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(y)):c<u&&y===40?(e.consume(y),c++,b):y===41?(e.consume(y),c--,b):y===null||y===32||y===40||Ys(y)?n(y):(e.consume(y),y===92?g:b)}function g(y){return y===40||y===41||y===92?(e.consume(y),b):b(y)}}function sp(e,t,n,r,s,i){const a=this;let o=0,l;return u;function u(d){return e.enter(r),e.enter(s),e.consume(d),e.exit(s),e.enter(i),c}function c(d){return o>999||d===null||d===91||d===93&&!l||d===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(d):d===93?(e.exit(i),e.enter(s),e.consume(d),e.exit(s),e.exit(r),t):_e(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),h(d))}function h(d){return d===null||d===91||d===93||_e(d)||o++>999?(e.exit("chunkString"),c(d)):(e.consume(d),l||(l=!Ue(d)),d===92?f:h)}function f(d){return d===91||d===92||d===93?(e.consume(d),o++,h):h(d)}}function ap(e,t,n,r,s,i){let a;return o;function o(f){return f===34||f===39||f===40?(e.enter(r),e.enter(s),e.consume(f),e.exit(s),a=f===40?41:f,l):n(f)}function l(f){return f===a?(e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):(e.enter(i),u(f))}function u(f){return f===a?(e.exit(i),l(a)):f===null?n(f):_e(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),qe(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(f))}function c(f){return f===a||f===null||_e(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?h:c)}function h(f){return f===a||f===92?(e.consume(f),c):c(f)}}function di(e,t){let n;return r;function r(s){return _e(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Ue(s)?qe(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const CE={name:"definition",tokenize:NE},_E={partial:!0,tokenize:IE};function NE(e,t,n){const r=this;let s;return i;function i(d){return e.enter("definition"),a(d)}function a(d){return sp.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function o(d){return s=en(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(e.enter("definitionMarker"),e.consume(d),e.exit("definitionMarker"),l):n(d)}function l(d){return rt(d)?di(e,u)(d):u(d)}function u(d){return ip(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function c(d){return e.attempt(_E,h,h)(d)}function h(d){return Ue(d)?qe(e,f,"whitespace")(d):f(d)}function f(d){return d===null||_e(d)?(e.exit("definition"),r.parser.defined.push(s),t(d)):n(d)}}function IE(e,t,n){return r;function r(o){return rt(o)?di(e,s)(o):n(o)}function s(o){return ap(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Ue(o)?qe(e,a,"whitespace")(o):a(o)}function a(o){return o===null||_e(o)?t(o):n(o)}}const RE={name:"hardBreakEscape",tokenize:PE};function PE(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return _e(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const ME={name:"headingAtx",resolve:LE,tokenize:DE};function LE(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ot(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function DE(e,t,n){let r=0;return s;function s(c){return e.enter("atxHeading"),i(c)}function i(c){return e.enter("atxHeadingSequence"),a(c)}function a(c){return c===35&&r++<6?(e.consume(c),a):c===null||rt(c)?(e.exit("atxHeadingSequence"),o(c)):n(c)}function o(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||_e(c)?(e.exit("atxHeading"),t(c)):Ue(c)?qe(e,o,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),o(c))}function u(c){return c===null||c===35||rt(c)?(e.exit("atxHeadingText"),o(c)):(e.consume(c),u)}}const OE=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],sd=["pre","script","style","textarea"],BE={concrete:!0,name:"htmlFlow",resolveTo:HE,tokenize:UE},FE={partial:!0,tokenize:VE},jE={partial:!0,tokenize:zE};function HE(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function UE(e,t,n){const r=this;let s,i,a,o,l;return u;function u(D){return c(D)}function c(D){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(D),h}function h(D){return D===33?(e.consume(D),f):D===47?(e.consume(D),i=!0,b):D===63?(e.consume(D),s=3,r.interrupt?t:I):St(D)?(e.consume(D),a=String.fromCharCode(D),g):n(D)}function f(D){return D===45?(e.consume(D),s=2,d):D===91?(e.consume(D),s=5,o=0,m):St(D)?(e.consume(D),s=4,r.interrupt?t:I):n(D)}function d(D){return D===45?(e.consume(D),r.interrupt?t:I):n(D)}function m(D){const ne="CDATA[";return D===ne.charCodeAt(o++)?(e.consume(D),o===ne.length?r.interrupt?t:M:m):n(D)}function b(D){return St(D)?(e.consume(D),a=String.fromCharCode(D),g):n(D)}function g(D){if(D===null||D===47||D===62||rt(D)){const ne=D===47,oe=a.toLowerCase();return!ne&&!i&&sd.includes(oe)?(s=1,r.interrupt?t(D):M(D)):OE.includes(a.toLowerCase())?(s=6,ne?(e.consume(D),y):r.interrupt?t(D):M(D)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(D):i?k(D):T(D))}return D===45||vt(D)?(e.consume(D),a+=String.fromCharCode(D),g):n(D)}function y(D){return D===62?(e.consume(D),r.interrupt?t:M):n(D)}function k(D){return Ue(D)?(e.consume(D),k):C(D)}function T(D){return D===47?(e.consume(D),C):D===58||D===95||St(D)?(e.consume(D),S):Ue(D)?(e.consume(D),T):C(D)}function S(D){return D===45||D===46||D===58||D===95||vt(D)?(e.consume(D),S):E(D)}function E(D){return D===61?(e.consume(D),w):Ue(D)?(e.consume(D),E):T(D)}function w(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),l=D,_):Ue(D)?(e.consume(D),w):A(D)}function _(D){return D===l?(e.consume(D),l=null,N):D===null||_e(D)?n(D):(e.consume(D),_)}function A(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||rt(D)?E(D):(e.consume(D),A)}function N(D){return D===47||D===62||Ue(D)?T(D):n(D)}function C(D){return D===62?(e.consume(D),L):n(D)}function L(D){return D===null||_e(D)?M(D):Ue(D)?(e.consume(D),L):n(D)}function M(D){return D===45&&s===2?(e.consume(D),B):D===60&&s===1?(e.consume(D),q):D===62&&s===4?(e.consume(D),W):D===63&&s===3?(e.consume(D),I):D===93&&s===5?(e.consume(D),V):_e(D)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(FE,K,H)(D)):D===null||_e(D)?(e.exit("htmlFlowData"),H(D)):(e.consume(D),M)}function H(D){return e.check(jE,P,K)(D)}function P(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),R}function R(D){return D===null||_e(D)?H(D):(e.enter("htmlFlowData"),M(D))}function B(D){return D===45?(e.consume(D),I):M(D)}function q(D){return D===47?(e.consume(D),a="",F):M(D)}function F(D){if(D===62){const ne=a.toLowerCase();return sd.includes(ne)?(e.consume(D),W):M(D)}return St(D)&&a.length<8?(e.consume(D),a+=String.fromCharCode(D),F):M(D)}function V(D){return D===93?(e.consume(D),I):M(D)}function I(D){return D===62?(e.consume(D),W):D===45&&s===2?(e.consume(D),I):M(D)}function W(D){return D===null||_e(D)?(e.exit("htmlFlowData"),K(D)):(e.consume(D),W)}function K(D){return e.exit("htmlFlow"),t(D)}}function zE(e,t,n){const r=this;return s;function s(a){return _e(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function VE(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Ui,t,n)}}const qE={name:"htmlText",tokenize:WE};function WE(e,t,n){const r=this;let s,i,a;return o;function o(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),l}function l(I){return I===33?(e.consume(I),u):I===47?(e.consume(I),E):I===63?(e.consume(I),T):St(I)?(e.consume(I),A):n(I)}function u(I){return I===45?(e.consume(I),c):I===91?(e.consume(I),i=0,m):St(I)?(e.consume(I),k):n(I)}function c(I){return I===45?(e.consume(I),d):n(I)}function h(I){return I===null?n(I):I===45?(e.consume(I),f):_e(I)?(a=h,q(I)):(e.consume(I),h)}function f(I){return I===45?(e.consume(I),d):h(I)}function d(I){return I===62?B(I):I===45?f(I):h(I)}function m(I){const W="CDATA[";return I===W.charCodeAt(i++)?(e.consume(I),i===W.length?b:m):n(I)}function b(I){return I===null?n(I):I===93?(e.consume(I),g):_e(I)?(a=b,q(I)):(e.consume(I),b)}function g(I){return I===93?(e.consume(I),y):b(I)}function y(I){return I===62?B(I):I===93?(e.consume(I),y):b(I)}function k(I){return I===null||I===62?B(I):_e(I)?(a=k,q(I)):(e.consume(I),k)}function T(I){return I===null?n(I):I===63?(e.consume(I),S):_e(I)?(a=T,q(I)):(e.consume(I),T)}function S(I){return I===62?B(I):T(I)}function E(I){return St(I)?(e.consume(I),w):n(I)}function w(I){return I===45||vt(I)?(e.consume(I),w):_(I)}function _(I){return _e(I)?(a=_,q(I)):Ue(I)?(e.consume(I),_):B(I)}function A(I){return I===45||vt(I)?(e.consume(I),A):I===47||I===62||rt(I)?N(I):n(I)}function N(I){return I===47?(e.consume(I),B):I===58||I===95||St(I)?(e.consume(I),C):_e(I)?(a=N,q(I)):Ue(I)?(e.consume(I),N):B(I)}function C(I){return I===45||I===46||I===58||I===95||vt(I)?(e.consume(I),C):L(I)}function L(I){return I===61?(e.consume(I),M):_e(I)?(a=L,q(I)):Ue(I)?(e.consume(I),L):N(I)}function M(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),s=I,H):_e(I)?(a=M,q(I)):Ue(I)?(e.consume(I),M):(e.consume(I),P)}function H(I){return I===s?(e.consume(I),s=void 0,R):I===null?n(I):_e(I)?(a=H,q(I)):(e.consume(I),H)}function P(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||rt(I)?N(I):(e.consume(I),P)}function R(I){return I===47||I===62||rt(I)?N(I):n(I)}function B(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function q(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),F}function F(I){return Ue(I)?qe(e,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):V(I)}function V(I){return e.enter("htmlTextData"),a(I)}}const uu={name:"labelEnd",resolveAll:KE,resolveTo:XE,tokenize:QE},$E={tokenize:ZE},YE={tokenize:JE},GE={tokenize:ev};function KE(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&Ot(e,0,e.length,n),e}function XE(e,t){let n=e.length,r=0,s,i,a,o;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(a=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[a][1].end}},c={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[["enter",l,t],["enter",u,t]],o=zt(o,e.slice(i+1,i+r+3)),o=zt(o,[["enter",c,t]]),o=zt(o,Ea(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=zt(o,[["exit",c,t],e[a-2],e[a-1],["exit",u,t]]),o=zt(o,e.slice(a+1)),o=zt(o,[["exit",l,t]]),Ot(e,i,e.length,o),e}function QE(e,t,n){const r=this;let s=r.events.length,i,a;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return o;function o(f){return i?i._inactive?h(f):(a=r.parser.defined.includes(en(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt($E,c,a?c:h)(f):f===91?e.attempt(YE,c,a?u:h)(f):a?c(f):h(f)}function u(f){return e.attempt(GE,c,h)(f)}function c(f){return t(f)}function h(f){return i._balanced=!0,n(f)}}function ZE(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),s}function s(h){return rt(h)?di(e,i)(h):i(h)}function i(h){return h===41?c(h):ip(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function a(h){return rt(h)?di(e,l)(h):c(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?ap(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):c(h)}function u(h){return rt(h)?di(e,c)(h):c(h)}function c(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function JE(e,t,n){const r=this;return s;function s(o){return sp.call(r,e,i,a,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(en(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function a(o){return n(o)}}function ev(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const tv={name:"labelStartImage",resolveAll:uu.resolveAll,tokenize:nv};function nv(e,t,n){const r=this;return s;function s(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),a):n(o)}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const rv={name:"labelStartLink",resolveAll:uu.resolveAll,tokenize:iv};function iv(e,t,n){const r=this;return s;function s(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const ro={name:"lineEnding",tokenize:sv};function sv(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),qe(e,t,"linePrefix")}}const Ns={name:"thematicBreak",tokenize:av};function av(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),a(u)}function a(u){return s=u,o(u)}function o(u){return u===s?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||_e(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===s?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Ue(u)?qe(e,o,"whitespace")(u):o(u))}}const It={continuation:{tokenize:cv},exit:hv,name:"list",tokenize:uv},ov={partial:!0,tokenize:fv},lv={partial:!0,tokenize:dv};function uv(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return o;function o(d){const m=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:tl(d)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),d===42||d===45?e.check(Ns,n,u)(d):u(d);if(!r.interrupt||d===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(d)}return n(d)}function l(d){return tl(d)&&++a<10?(e.consume(d),l):(!r.interrupt||a<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(e.exit("listItemValue"),u(d)):n(d)}function u(d){return e.enter("listItemMarker"),e.consume(d),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,e.check(Ui,r.interrupt?n:c,e.attempt(ov,f,h))}function c(d){return r.containerState.initialBlankLine=!0,i++,f(d)}function h(d){return Ue(d)?(e.enter("listItemPrefixWhitespace"),e.consume(d),e.exit("listItemPrefixWhitespace"),f):n(d)}function f(d){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(d)}}function cv(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ui,s,i);function s(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,qe(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Ue(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(lv,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,qe(e,e.attempt(It,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function dv(e,t,n){const r=this;return qe(e,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function hv(e){e.exit(this.containerState.type)}function fv(e,t,n){const r=this;return qe(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!Ue(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const ad={name:"setextUnderline",resolveTo:mv,tokenize:pv};function mv(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function pv(e,t,n){const r=this;let s;return i;function i(u){let c=r.events.length,h;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){h=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),s=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===s?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Ue(u)?qe(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||_e(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const gv={tokenize:bv};function bv(e){const t=this,n=e.attempt(Ui,r,e.attempt(this.parser.constructs.flowInitial,s,qe(e,e.attempt(this.parser.constructs.flow,s,e.attempt(TE,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const xv={resolveAll:lp()},yv=op("string"),Ev=op("text");function op(e){return{resolveAll:lp(e==="text"?vv:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,a,o);return a;function a(c){return u(c)?i(c):o(c)}function o(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const h=s[c];let f=-1;if(h)for(;++f<h.length;){const d=h[f];if(!d.previous||d.previous.call(r,r.previous))return!0}return!1}}}function lp(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function vv(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,a=-1,o=0,l;for(;i--;){const u=s[i];if(typeof u=="string"){for(a=u.length;u.charCodeAt(a-1)===32;)o++,a--;if(a)break;a=-1}else if(u===-2)l=!0,o++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const u={type:n===e.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const Tv={42:It,43:It,45:It,48:It,49:It,50:It,51:It,52:It,53:It,54:It,55:It,56:It,57:It,62:ep},kv={91:CE},wv={[-2]:no,[-1]:no,32:no},Sv={35:ME,42:Ns,45:[ad,Ns],60:BE,61:ad,95:Ns,96:id,126:id},Av={38:np,92:tp},Cv={[-5]:ro,[-4]:ro,[-3]:ro,33:tv,38:np,42:nl,60:[rE,qE],91:rv,92:[RE,tp],93:uu,95:nl,96:gE},_v={null:[nl,xv]},Nv={null:[42,95]},Iv={null:[]},Rv=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Nv,contentInitial:kv,disable:Iv,document:Tv,flow:Sv,flowInitial:wv,insideSpan:_v,string:Av,text:Cv},Symbol.toStringTag,{value:"Module"}));function Pv(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let a=[],o=[];const l={attempt:_(E),check:_(w),consume:k,enter:T,exit:S,interrupt:_(w,{interrupt:!0})},u={code:null,containerState:{},defineSkip:b,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:d,write:h};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function h(L){return a=zt(a,L),g(),a[a.length-1]!==null?[]:(A(t,0),u.events=Ea(i,u.events,u),u.events)}function f(L,M){return Lv(d(L),M)}function d(L){return Mv(a,L)}function m(){const{_bufferIndex:L,_index:M,line:H,column:P,offset:R}=r;return{_bufferIndex:L,_index:M,line:H,column:P,offset:R}}function b(L){s[L.line]=L.column,C()}function g(){let L;for(;r._index<a.length;){const M=a[r._index];if(typeof M=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<M.length;)y(M.charCodeAt(r._bufferIndex));else y(M)}}function y(L){c=c(L)}function k(L){_e(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,C()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=L}function T(L,M){const H=M||{};return H.type=L,H.start=m(),u.events.push(["enter",H,u]),o.push(H),H}function S(L){const M=o.pop();return M.end=m(),u.events.push(["exit",M,u]),M}function E(L,M){A(L,M.from)}function w(L,M){M.restore()}function _(L,M){return H;function H(P,R,B){let q,F,V,I;return Array.isArray(P)?K(P):"tokenize"in P?K([P]):W(P);function W(J){return Y;function Y(X){const de=X!==null&&J[X],ge=X!==null&&J.null,ee=[...Array.isArray(de)?de:de?[de]:[],...Array.isArray(ge)?ge:ge?[ge]:[]];return K(ee)(X)}}function K(J){return q=J,F=0,J.length===0?B:D(J[F])}function D(J){return Y;function Y(X){return I=N(),V=J,J.partial||(u.currentConstruct=J),J.name&&u.parser.constructs.disable.null.includes(J.name)?oe():J.tokenize.call(M?Object.assign(Object.create(u),M):u,l,ne,oe)(X)}}function ne(J){return L(V,I),R}function oe(J){return I.restore(),++F<q.length?D(q[F]):B}}}function A(L,M){L.resolveAll&&!i.includes(L)&&i.push(L),L.resolve&&Ot(u.events,M,u.events.length-M,L.resolve(u.events.slice(M),u)),L.resolveTo&&(u.events=L.resolveTo(u.events,u))}function N(){const L=m(),M=u.previous,H=u.currentConstruct,P=u.events.length,R=Array.from(o);return{from:P,restore:B};function B(){r=L,u.previous=M,u.currentConstruct=H,u.events.length=P,o=R,C()}}function C(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function Mv(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let a;if(n===s)a=[e[n].slice(r,i)];else{if(a=e.slice(n,s),r>-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}i>0&&a.push(e[s].slice(0,i))}return a}function Lv(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
488
+ `;break}case-3:{a=`\r
489
+ `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&s)continue;a=" ";break}default:a=String.fromCharCode(i)}s=i===-2,r.push(a)}return r.join("")}function Dv(e){const r={constructs:Zm([Rv,...(e||{}).extensions||[]]),content:s(X2),defined:[],document:s(Z2),flow:s(gv),lazy:{},string:s(yv),text:s(Ev)};return r;function s(i){return a;function a(o){return Pv(r,i,o)}}}function Ov(e){for(;!rp(e););return e}const od=/[\0\t\n\r]/g;function Bv(){let e=1,t="",n=!0,r;return s;function s(i,a,o){const l=[];let u,c,h,f,d;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(od.lastIndex=h,u=od.exec(i),f=u&&u.index!==void 0?u.index:i.length,d=i.charCodeAt(f),!u){t=i.slice(h);break}if(d===10&&h===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<f&&(l.push(i.slice(h,f)),e+=f-h),d){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}h=f+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Fv=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function jv(e){return e.replace(Fv,Hv)}function Hv(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return Jm(n.slice(i?2:1),i?16:10)}return lu(n)||e}const up={}.hasOwnProperty;function Uv(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),zv(n)(Ov(Dv(n).document().write(Bv()(e,t,!0))))}function zv(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(te),autolinkProtocol:N,autolinkEmail:N,atxHeading:i(Le),blockQuote:i(ge),characterEscape:N,characterReference:N,codeFenced:i(ee),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(ee,a),codeText:i(ie,a),codeTextData:N,data:N,codeFlowValue:N,definition:i(xe),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(Se),hardBreakEscape:i(pe),hardBreakTrailing:i(pe),htmlFlow:i(Te,a),htmlFlowData:N,htmlText:i(Te,a),htmlTextData:N,image:i(Me),label:a,link:i(te),listItem:i(be),listItemValue:f,listOrdered:i(Ie,h),listUnordered:i(Ie),paragraph:i(Fe),reference:D,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Le),strong:i(Qe),thematicBreak:i(st)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:de,autolinkProtocol:X,blockQuote:l(),characterEscapeValue:C,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:J,characterReference:Y,codeFenced:l(g),codeFencedFence:b,codeFencedFenceInfo:d,codeFencedFenceMeta:m,codeFlowValue:C,codeIndented:l(y),codeText:l(R),codeTextData:C,data:C,definition:l(),definitionDestinationString:S,definitionLabelString:k,definitionTitleString:T,emphasis:l(),hardBreakEscape:l(M),hardBreakTrailing:l(M),htmlFlow:l(H),htmlFlowData:C,htmlText:l(P),htmlTextData:C,image:l(q),label:V,labelText:F,lineEnding:L,link:l(B),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ne,resourceDestinationString:I,resourceTitleString:W,resource:K,setextHeading:l(A),setextHeadingLineSequence:_,setextHeadingText:w,strong:l(),thematicBreak:l()}};cp(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Q){let re={type:"root",children:[]};const ve={stack:[re],tokenStack:[],config:t,enter:o,exit:u,buffer:a,resume:c,data:n},ke=[];let Ne=-1;for(;++Ne<Q.length;)if(Q[Ne][1].type==="listOrdered"||Q[Ne][1].type==="listUnordered")if(Q[Ne][0]==="enter")ke.push(Ne);else{const at=ke.pop();Ne=s(Q,at,Ne)}for(Ne=-1;++Ne<Q.length;){const at=t[Q[Ne][0]];up.call(at,Q[Ne][1].type)&&at[Q[Ne][1].type].call(Object.assign({sliceSerialize:Q[Ne][2].sliceSerialize},ve),Q[Ne][1])}if(ve.tokenStack.length>0){const at=ve.tokenStack[ve.tokenStack.length-1];(at[1]||ld).call(ve,void 0,at[0])}for(re.position={start:kn(Q.length>0?Q[0][1].start:{line:1,column:1,offset:0}),end:kn(Q.length>0?Q[Q.length-2][1].end:{line:1,column:1,offset:0})},Ne=-1;++Ne<t.transforms.length;)re=t.transforms[Ne](re)||re;return re}function s(Q,re,ve){let ke=re-1,Ne=-1,at=!1,bt,ye,Be,Ve;for(;++ke<=ve;){const fe=Q[ke];switch(fe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{fe[0]==="enter"?Ne++:Ne--,Ve=void 0;break}case"lineEndingBlank":{fe[0]==="enter"&&(bt&&!Ve&&!Ne&&!Be&&(Be=ke),Ve=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ve=void 0}if(!Ne&&fe[0]==="enter"&&fe[1].type==="listItemPrefix"||Ne===-1&&fe[0]==="exit"&&(fe[1].type==="listUnordered"||fe[1].type==="listOrdered")){if(bt){let Ge=ke;for(ye=void 0;Ge--;){const Et=Q[Ge];if(Et[1].type==="lineEnding"||Et[1].type==="lineEndingBlank"){if(Et[0]==="exit")continue;ye&&(Q[ye][1].type="lineEndingBlank",at=!0),Et[1].type="lineEnding",ye=Ge}else if(!(Et[1].type==="linePrefix"||Et[1].type==="blockQuotePrefix"||Et[1].type==="blockQuotePrefixWhitespace"||Et[1].type==="blockQuoteMarker"||Et[1].type==="listItemIndent"))break}Be&&(!ye||Be<ye)&&(bt._spread=!0),bt.end=Object.assign({},ye?Q[ye][1].start:fe[1].end),Q.splice(ye||ke,0,["exit",bt,fe[2]]),ke++,ve++}if(fe[1].type==="listItemPrefix"){const Ge={type:"listItem",_spread:!1,start:Object.assign({},fe[1].start),end:void 0};bt=Ge,Q.splice(ke,0,["enter",Ge,fe[2]]),ke++,ve++,Be=void 0,Ve=!0}}}return Q[re][1]._spread=at,ve}function i(Q,re){return ve;function ve(ke){o.call(this,Q(ke),ke),re&&re.call(this,ke)}}function a(){this.stack.push({type:"fragment",children:[]})}function o(Q,re,ve){this.stack[this.stack.length-1].children.push(Q),this.stack.push(Q),this.tokenStack.push([re,ve||void 0]),Q.position={start:kn(re.start),end:void 0}}function l(Q){return re;function re(ve){Q&&Q.call(this,ve),u.call(this,ve)}}function u(Q,re){const ve=this.stack.pop(),ke=this.tokenStack.pop();if(ke)ke[0].type!==Q.type&&(re?re.call(this,Q,ke[0]):(ke[1]||ld).call(this,Q,ke[0]));else throw new Error("Cannot close `"+Q.type+"` ("+ci({start:Q.start,end:Q.end})+"): it’s not open");ve.position.end=kn(Q.end)}function c(){return ou(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function f(Q){if(this.data.expectingFirstListItemValue){const re=this.stack[this.stack.length-2];re.start=Number.parseInt(this.sliceSerialize(Q),10),this.data.expectingFirstListItemValue=void 0}}function d(){const Q=this.resume(),re=this.stack[this.stack.length-1];re.lang=Q}function m(){const Q=this.resume(),re=this.stack[this.stack.length-1];re.meta=Q}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const Q=this.resume(),re=this.stack[this.stack.length-1];re.value=Q.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const Q=this.resume(),re=this.stack[this.stack.length-1];re.value=Q.replace(/(\r?\n|\r)$/g,"")}function k(Q){const re=this.resume(),ve=this.stack[this.stack.length-1];ve.label=re,ve.identifier=en(this.sliceSerialize(Q)).toLowerCase()}function T(){const Q=this.resume(),re=this.stack[this.stack.length-1];re.title=Q}function S(){const Q=this.resume(),re=this.stack[this.stack.length-1];re.url=Q}function E(Q){const re=this.stack[this.stack.length-1];if(!re.depth){const ve=this.sliceSerialize(Q).length;re.depth=ve}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function _(Q){const re=this.stack[this.stack.length-1];re.depth=this.sliceSerialize(Q).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function N(Q){const ve=this.stack[this.stack.length-1].children;let ke=ve[ve.length-1];(!ke||ke.type!=="text")&&(ke=De(),ke.position={start:kn(Q.start),end:void 0},ve.push(ke)),this.stack.push(ke)}function C(Q){const re=this.stack.pop();re.value+=this.sliceSerialize(Q),re.position.end=kn(Q.end)}function L(Q){const re=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ve=re.children[re.children.length-1];ve.position.end=kn(Q.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(re.type)&&(N.call(this,Q),C.call(this,Q))}function M(){this.data.atHardBreak=!0}function H(){const Q=this.resume(),re=this.stack[this.stack.length-1];re.value=Q}function P(){const Q=this.resume(),re=this.stack[this.stack.length-1];re.value=Q}function R(){const Q=this.resume(),re=this.stack[this.stack.length-1];re.value=Q}function B(){const Q=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";Q.type+="Reference",Q.referenceType=re,delete Q.url,delete Q.title}else delete Q.identifier,delete Q.label;this.data.referenceType=void 0}function q(){const Q=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";Q.type+="Reference",Q.referenceType=re,delete Q.url,delete Q.title}else delete Q.identifier,delete Q.label;this.data.referenceType=void 0}function F(Q){const re=this.sliceSerialize(Q),ve=this.stack[this.stack.length-2];ve.label=jv(re),ve.identifier=en(re).toLowerCase()}function V(){const Q=this.stack[this.stack.length-1],re=this.resume(),ve=this.stack[this.stack.length-1];if(this.data.inReference=!0,ve.type==="link"){const ke=Q.children;ve.children=ke}else ve.alt=re}function I(){const Q=this.resume(),re=this.stack[this.stack.length-1];re.url=Q}function W(){const Q=this.resume(),re=this.stack[this.stack.length-1];re.title=Q}function K(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function ne(Q){const re=this.resume(),ve=this.stack[this.stack.length-1];ve.label=re,ve.identifier=en(this.sliceSerialize(Q)).toLowerCase(),this.data.referenceType="full"}function oe(Q){this.data.characterReferenceType=Q.type}function J(Q){const re=this.sliceSerialize(Q),ve=this.data.characterReferenceType;let ke;ve?(ke=Jm(re,ve==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ke=lu(re);const Ne=this.stack[this.stack.length-1];Ne.value+=ke}function Y(Q){const re=this.stack.pop();re.position.end=kn(Q.end)}function X(Q){C.call(this,Q);const re=this.stack[this.stack.length-1];re.url=this.sliceSerialize(Q)}function de(Q){C.call(this,Q);const re=this.stack[this.stack.length-1];re.url="mailto:"+this.sliceSerialize(Q)}function ge(){return{type:"blockquote",children:[]}}function ee(){return{type:"code",lang:null,meta:null,value:""}}function ie(){return{type:"inlineCode",value:""}}function xe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Se(){return{type:"emphasis",children:[]}}function Le(){return{type:"heading",depth:0,children:[]}}function pe(){return{type:"break"}}function Te(){return{type:"html",value:""}}function Me(){return{type:"image",title:null,url:"",alt:null}}function te(){return{type:"link",title:null,url:"",children:[]}}function Ie(Q){return{type:"list",ordered:Q.type==="listOrdered",start:null,spread:Q._spread,children:[]}}function be(Q){return{type:"listItem",spread:Q._spread,checked:null,children:[]}}function Fe(){return{type:"paragraph",children:[]}}function Qe(){return{type:"strong",children:[]}}function De(){return{type:"text",value:""}}function st(){return{type:"thematicBreak"}}}function kn(e){return{line:e.line,column:e.column,offset:e.offset}}function cp(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?cp(e,r):Vv(e,r)}}function Vv(e,t){let n;for(n in t)if(up.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function ld(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ci({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ci({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ci({start:t.start,end:t.end})+") is still open")}function qv(e){const t=this;t.parser=n;function n(r){return Uv(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Wv(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function $v(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
490
+ `}]}function Yv(e,t){const n=t.value?t.value+`
491
+ `:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function Gv(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Kv(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Xv(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=jr(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,o+=1,e.footnoteCounts.set(r,o);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function Qv(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Zv(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function dp(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function Jv(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return dp(e,t);const s={src:jr(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function eT(e,t){const n={src:jr(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function tT(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function nT(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return dp(e,t);const s={href:jr(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function rT(e,t){const n={href:jr(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function iT(e,t,n){const r=e.all(t),s=n?sT(n):hp(t),i={},a=[];if(typeof t.checked=="boolean"){const c=r[0];let h;c&&c.type==="element"&&c.tagName==="p"?h=c:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const c=r[o];(s||o!==0||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
492
+ `}),c.type==="element"&&c.tagName==="p"&&!s?a.push(...c.children):a.push(c)}const l=r[r.length-1];l&&(s||l.type!=="element"||l.tagName!=="p")&&a.push({type:"text",value:`
493
+ `});const u={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,u),e.applyData(t,u)}function sT(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=hp(n[r])}return t}function hp(e){const t=e.spread;return t??e.children.length>1}function aT(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const a=r[s];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function oT(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lT(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function uT(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function cT(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),s.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=fn(t.children[1]),l=xa(t.children[t.children.length-1]);o&&l&&(a.position={start:o,end:l}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function dT(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:t.children.length;let l=-1;const u=[];for(;++l<o;){const h=t.children[l],f={},d=a?a[l]:void 0;d&&(f.align=d);let m={type:"element",tagName:i,properties:f,children:[]};h&&(m.children=e.all(h),e.patch(h,m),m=e.applyData(h,m)),u.push(m)}const c={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,c),e.applyData(t,c)}function hT(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ud=9,cd=32;function fT(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(dd(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(dd(t.slice(s),s>0,!1)),i.join("")}function dd(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===ud||i===cd;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===ud||i===cd;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function mT(e,t){const n={type:"text",value:fT(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function pT(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const gT={blockquote:Wv,break:$v,code:Yv,delete:Gv,emphasis:Kv,footnoteReference:Xv,heading:Qv,html:Zv,imageReference:Jv,image:eT,inlineCode:tT,linkReference:nT,link:rT,listItem:iT,list:aT,paragraph:oT,root:lT,strong:uT,table:cT,tableCell:hT,tableRow:dT,text:mT,thematicBreak:pT,toml:fs,yaml:fs,definition:fs,footnoteDefinition:fs};function fs(){}const fp=-1,va=0,hi=1,Gs=2,cu=3,du=4,hu=5,fu=6,mp=7,pp=8,{defineProperty:bT}=Object,gp=typeof self=="object"?self:globalThis,hd=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new gp[e](t)},xT=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=t[s];switch(i){case va:case fp:return n(a,s);case hi:{const o=n([],s);for(const l of a)o.push(r(l));return o}case Gs:{const o=n({},s);for(const[l,u]of a){const c=r(l),h=r(u);c==="__proto__"?bT(o,c,{value:h,configurable:!0,enumerable:!0,writable:!0}):o[c]=h}return o}case cu:return n(new Date(a),s);case du:{const{source:o,flags:l}=a;return n(new RegExp(o,l),s)}case hu:{const o=n(new Map,s);for(const[l,u]of a)o.set(r(l),r(u));return o}case fu:{const o=n(new Set,s);for(const l of a)o.add(r(l));return o}case mp:{const{name:o,message:l}=a;return n(typeof gp[o]=="function"?hd(o,l):new Error(l),s)}case pp:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}case"-0":return-0}return n(hd(i,a),s)};return r},fd=e=>xT(new Map,e)(0),Xn="",{toString:yT}={},{keys:ET,is:vT}=Object,Zr=e=>{const t=typeof e;if(t!=="object"||!e)return[va,t];const n=yT.call(e).slice(8,-1);switch(n){case"Array":return[hi,Xn];case"Object":return[Gs,Xn];case"Date":return[cu,Xn];case"RegExp":return[du,Xn];case"Map":return[hu,Xn];case"Set":return[fu,Xn];case"DataView":return[hi,n]}return n.includes("Array")?[hi,n]:e instanceof Error?[mp,e.name||"Error"]:[Gs,n]},ms=([e,t])=>e===va&&(t==="function"||t==="symbol"),TT=(e,t,n,r)=>{const s=(a,o)=>{const l=r.push(a)-1;return n.set(o,l),l},i=a=>{if(n.has(a))return n.get(a);let[o,l]=Zr(a);switch(o){case va:{let c=a;switch(l){case"bigint":o=pp,c=a.toString();break;case"number":if(!a&&vT(a,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return s([fp],a)}return s([o,c],a)}case hi:{if(l){let f=a;return l==="DataView"?f=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(a)),s([l,[...f]],a)}const c=[],h=s([o,c],a);for(const f of a)c.push(i(f));return h}case Gs:{if(l)switch(l){case"BigInt":return s([l,a.toString()],a);case"Boolean":case"Number":case"String":return s([l,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const c=[],h=s([o,c],a);for(const f of ET(a))(e||!ms(Zr(a[f])))&&c.push([i(f),i(a[f])]);return h}case cu:return s([o,isNaN(a.getTime())?Xn:a.toISOString()],a);case du:{const{source:c,flags:h}=a;return s([o,{source:c,flags:h}],a)}case hu:{const c=[],h=s([o,c],a);for(const[f,d]of a)(e||!(ms(Zr(f))||ms(Zr(d))))&&c.push([i(f),i(d)]);return h}case fu:{const c=[],h=s([o,c],a);for(const f of a)(e||!ms(Zr(f)))&&c.push(i(f));return h}}const{message:u}=a;return s([o,{name:l,message:u}],a)};return i},md=(e,{json:t,lossy:n}={})=>{const r=[];return TT(!(t||n),!!t,new Map,r)(e),r},cr=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?fd(md(e,t)):structuredClone(e):(e,t)=>fd(md(e,t));function kT(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function wT(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function ST(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||kT,r=e.options.footnoteBackLabel||wT,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let l=-1;for(;++l<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[l]);if(!u)continue;const c=e.all(u),h=String(u.identifier).toUpperCase(),f=jr(h.toLowerCase());let d=0;const m=[],b=e.footnoteCounts.get(h);for(;b!==void 0&&++d<=b;){m.length>0&&m.push({type:"text",value:" "});let k=typeof n=="string"?n:n(l,d);typeof k=="string"&&(k={type:"text",value:k}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,d),className:["data-footnote-backref"]},children:Array.isArray(k)?k:[k]})}const g=c[c.length-1];if(g&&g.type==="element"&&g.tagName==="p"){const k=g.children[g.children.length-1];k&&k.type==="text"?k.value+=" ":g.children.push({type:"text",value:" "}),g.children.push(...m)}else c.push(...m);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(c,!0)};e.patch(u,y),o.push(y)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...cr(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
494
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
495
+ `}]}}const Ta=(function(e){if(e==null)return NT;if(typeof e=="function")return ka(e);if(typeof e=="object")return Array.isArray(e)?AT(e):CT(e);if(typeof e=="string")return _T(e);throw new Error("Expected function, string, or object as test")});function AT(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ta(e[n]);return ka(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function CT(e){const t=e;return ka(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function _T(e){return ka(t);function t(n){return n&&n.type===e}}function ka(e){return t;function t(n,r,s){return!!(IT(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function NT(){return!0}function IT(e){return e!==null&&typeof e=="object"&&"type"in e}const bp=[],RT=!0,rl=!1,PT="skip";function xp(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=Ta(s),a=r?-1:1;o(e,void 0,[])();function o(l,u,c){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const d=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(d?"<"+d+">":""))+")"})}return f;function f(){let d=bp,m,b,g;if((!t||i(l,u,c[c.length-1]||void 0))&&(d=MT(n(l,c)),d[0]===rl))return d;if("children"in l&&l.children){const y=l;if(y.children&&d[0]!==PT)for(b=(r?y.children.length:-1)+a,g=c.concat(y);b>-1&&b<y.children.length;){const k=y.children[b];if(m=o(k,b,g)(),m[0]===rl)return m;b=typeof m[1]=="number"?m[1]:b+a}}return d}}}function MT(e){return Array.isArray(e)?e:typeof e=="number"?[RT,e]:e==null?bp:[e]}function wa(e,t,n,r){let s,i,a;typeof t=="function"&&typeof n!="function"?(i=void 0,a=t,s=n):(i=t,a=n,s=r),xp(e,i,o,s);function o(l,u){const c=u[u.length-1],h=c?c.children.indexOf(l):void 0;return a(l,h,c)}}const il={}.hasOwnProperty,LT={};function DT(e,t){const n=t||LT,r=new Map,s=new Map,i=new Map,a={...gT,...n.handlers},o={all:u,applyData:BT,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:l,options:n,patch:OT,wrap:jT};return wa(e,function(c){if(c.type==="definition"||c.type==="footnoteDefinition"){const h=c.type==="definition"?r:s,f=String(c.identifier).toUpperCase();h.has(f)||h.set(f,c)}}),o;function l(c,h){const f=c.type,d=o.handlers[f];if(il.call(o.handlers,f)&&d)return d(o,c,h);if(o.options.passThrough&&o.options.passThrough.includes(f)){if("children"in c){const{children:b,...g}=c,y=cr(g);return y.children=o.all(c),y}return cr(c)}return(o.options.unknownHandler||FT)(o,c,h)}function u(c){const h=[];if("children"in c){const f=c.children;let d=-1;for(;++d<f.length;){const m=o.one(f[d],c);if(m){if(d&&f[d-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=pd(m.value)),!Array.isArray(m)&&m.type==="element")){const b=m.children[0];b&&b.type==="text"&&(b.value=pd(b.value))}Array.isArray(m)?h.push(...m):h.push(m)}}}return h}}function OT(e,t){e.position&&(t.position=$m(e))}function BT(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&i&&Object.assign(n.properties,cr(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function FT(e,t){const n=t.data||{},r="value"in t&&!(il.call(n,"hProperties")||il.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function jT(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
496
+ `});++r<e.length;)r&&n.push({type:"text",value:`
497
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
498
+ `}),n}function pd(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function gd(e,t){const n=DT(e,t),r=n.one(e,void 0),s=ST(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
499
+ `},s),i}function HT(e,t){return e&&"run"in e?async function(n,r){const s=gd(n,{file:r,...t});await e.run(s,r)}:function(n,r){return gd(n,{file:r,...e||t})}}function bd(e){if(e)throw e}var io,xd;function UT(){if(xd)return io;xd=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},i=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var c=e.call(u,"constructor"),h=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!h)return!1;var f;for(f in u);return typeof f>"u"||e.call(u,f)},a=function(u,c){n&&c.name==="__proto__"?n(u,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):u[c.name]=c.newValue},o=function(u,c){if(c==="__proto__")if(e.call(u,c)){if(r)return r(u,c).value}else return;return u[c]};return io=function l(){var u,c,h,f,d,m,b=arguments[0],g=1,y=arguments.length,k=!1;for(typeof b=="boolean"&&(k=b,b=arguments[1]||{},g=2),(b==null||typeof b!="object"&&typeof b!="function")&&(b={});g<y;++g)if(u=arguments[g],u!=null)for(c in u)h=o(b,c),f=o(u,c),b!==f&&(k&&f&&(i(f)||(d=s(f)))?(d?(d=!1,m=h&&s(h)?h:[]):m=h&&i(h)?h:{},a(b,{name:c,newValue:l(k,m,f)})):typeof f<"u"&&a(b,{name:c,newValue:f}));return b},io}var zT=UT();const so=Yl(zT);function sl(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function VT(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);o(null,...s);function o(l,...u){const c=e[++i];let h=-1;if(l){a(l);return}for(;++h<s.length;)(u[h]===null||u[h]===void 0)&&(u[h]=s[h]);s=u,c?qT(c,o)(...u):a(null,...u)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function qT(e,t){let n;return r;function r(...a){const o=e.length>a.length;let l;o&&a.push(s);try{l=e.apply(this,a)}catch(u){const c=u;if(o&&n)throw c;return s(c)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(a,...o){n||(n=!0,t(a,...o))}function i(a){s(null,a)}}const sn={basename:WT,dirname:$T,extname:YT,join:GT,sep:"/"};function WT(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');zi(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,o=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),o>-1&&(e.codePointAt(s)===t.codePointAt(o--)?o<0&&(r=s):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function $T(e){if(zi(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function YT(e){zi(e);let t=e.length,n=-1,r=0,s=-1,i=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),o===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function GT(...e){let t=-1,n;for(;++t<e.length;)zi(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":KT(n)}function KT(e){zi(e);const t=e.codePointAt(0)===47;let n=XT(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function XT(e,t){let n="",r=0,s=-1,i=0,a=-1,o,l;for(;++a<=e.length;){if(a<e.length)o=e.codePointAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||i===1))if(s!==a-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i>-1?i++:i=-1}return n}function zi(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const QT={cwd:ZT};function ZT(){return"/"}function al(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function JT(e){if(typeof e=="string")e=new URL(e);else if(!al(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return ek(e)}function ek(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const ao=["history","path","basename","stem","extname","dirname"];class yp{constructor(t){let n;t?al(t)?n={path:t}:typeof t=="string"||tk(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":QT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ao.length;){const i=ao[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)ao.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?sn.basename(this.path):void 0}set basename(t){lo(t,"basename"),oo(t,"basename"),this.path=sn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?sn.dirname(this.path):void 0}set dirname(t){yd(this.basename,"dirname"),this.path=sn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?sn.extname(this.path):void 0}set extname(t){if(oo(t,"extname"),yd(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=sn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){al(t)&&(t=JT(t)),lo(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?sn.basename(this.path,this.extname):void 0}set stem(t){lo(t,"stem"),oo(t,"stem"),this.path=sn.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new Tt(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function oo(e,t){if(e&&e.includes(sn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+sn.sep+"`")}function lo(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function yd(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function tk(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const nk=(function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),rk={}.hasOwnProperty;class mu extends nk{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=VT()}copy(){const t=new mu;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(so(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(ho("data",this.frozen),this.namespace[t]=n,this):rk.call(this.namespace,t)&&this.namespace[t]||void 0:t?(ho("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ps(t),r=this.parser||this.Parser;return uo("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),uo("process",this.parser||this.Parser),co("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const o=ps(t),l=r.parse(o);r.run(l,o,function(c,h,f){if(c||!h||!f)return u(c);const d=h,m=r.stringify(d,f);ak(m)?f.value=m:f.result=m,u(c,f)});function u(c,h){c||!h?a(c):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),uo("processSync",this.parser||this.Parser),co("processSync",this.compiler||this.Compiler),this.process(t,s),vd("processSync","process",n),r;function s(i,a){n=!0,bd(i),r=a}}run(t,n,r){Ed(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(a,o){const l=ps(n);s.run(t,l,u);function u(c,h,f){const d=h||t;c?o(c):a?a(d):r(void 0,d,f)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),vd("runSync","run",r),s;function i(a,o){bd(a),s=o,r=!0}}stringify(t,n){this.freeze();const r=ps(n),s=this.compiler||this.Compiler;return co("stringify",s),Ed(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(ho("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...h]=u;l(c,h)}else a(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function a(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(s.settings=so(!0,s.settings,u.settings))}function o(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const h=u[c];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let h=-1,f=-1;for(;++h<r.length;)if(r[h][0]===u){f=h;break}if(f===-1)r.push([u,...c]);else if(c.length>0){let[d,...m]=c;const b=r[f][1];sl(b)&&sl(d)&&(d=so(!0,b,d)),r[f]=[u,d,...m]}}}}const ik=new mu().freeze();function uo(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function co(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ho(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ed(e){if(!sl(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function vd(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ps(e){return sk(e)?e:new yp(e)}function sk(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ak(e){return typeof e=="string"||ok(e)}function ok(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const lk="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Td=[],kd={allowDangerousHtml:!0},uk=/^(https?|ircs?|mailto|xmpp)$/i,ck=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Ep(e){const t=dk(e),n=hk(e);return fk(t.runSync(t.parse(n),n),e)}function dk(e){const t=e.rehypePlugins||Td,n=e.remarkPlugins||Td,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...kd}:kd;return ik().use(qv).use(n).use(HT,r).use(t)}function hk(e){const t=e.children||"",n=new yp;return typeof t=="string"&&(n.value=t),n}function fk(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,l=t.urlTransform||mk;for(const c of ck)Object.hasOwn(t,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+lk+c.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),wa(e,u),C2(e,{Fragment:p.Fragment,components:s,ignoreInvalidStyle:!0,jsx:p.jsx,jsxs:p.jsxs,passKeys:!0,passNode:!0});function u(c,h,f){if(c.type==="raw"&&f&&typeof h=="number")return a?f.children.splice(h,1):f.children[h]={type:"text",value:c.value},h;if(c.type==="element"){let d;for(d in to)if(Object.hasOwn(to,d)&&Object.hasOwn(c.properties,d)){const m=c.properties[d],b=to[d];(b===null||b.includes(c.tagName))&&(c.properties[d]=l(String(m||""),d,c))}}if(c.type==="element"){let d=n?!n.includes(c.tagName):i?i.includes(c.tagName):!1;if(!d&&r&&typeof h=="number"&&(d=!r(c,h,f)),d&&f&&typeof h=="number")return o&&c.children?f.children.splice(h,1,...c.children):f.children.splice(h,1),h}}}function mk(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||uk.test(e.slice(0,t))?e:""}function wd(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function pk(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function gk(e,t,n){const s=Ta((n||{}).ignore||[]),i=bk(t);let a=-1;for(;++a<i.length;)xp(e,"text",o);function o(u,c){let h=-1,f;for(;++h<c.length;){const d=c[h],m=f?f.children:void 0;if(s(d,m?m.indexOf(d):void 0,f))return;f=d}if(f)return l(u,c)}function l(u,c){const h=c[c.length-1],f=i[a][0],d=i[a][1];let m=0;const g=h.children.indexOf(u);let y=!1,k=[];f.lastIndex=0;let T=f.exec(u.value);for(;T;){const S=T.index,E={index:T.index,input:T.input,stack:[...c,u]};let w=d(...T,E);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?f.lastIndex=S+1:(m!==S&&k.push({type:"text",value:u.value.slice(m,S)}),Array.isArray(w)?k.push(...w):w&&k.push(w),m=S+T[0].length,y=!0),!f.global)break;T=f.exec(u.value)}return y?(m<u.value.length&&k.push({type:"text",value:u.value.slice(m)}),h.children.splice(g,1,...k)):k=[u],g+k.length}}function bk(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([xk(s[0]),yk(s[1])])}return t}function xk(e){return typeof e=="string"?new RegExp(pk(e),"g"):e}function yk(e){return typeof e=="function"?e:function(){return e}}const fo="phrasing",mo=["autolink","link","image","label"];function Ek(){return{transforms:[Ck],enter:{literalAutolink:Tk,literalAutolinkEmail:po,literalAutolinkHttp:po,literalAutolinkWww:po},exit:{literalAutolink:Ak,literalAutolinkEmail:Sk,literalAutolinkHttp:kk,literalAutolinkWww:wk}}}function vk(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:fo,notInConstruct:mo},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:fo,notInConstruct:mo},{character:":",before:"[ps]",after:"\\/",inConstruct:fo,notInConstruct:mo}]}}function Tk(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function po(e){this.config.enter.autolinkProtocol.call(this,e)}function kk(e){this.config.exit.autolinkProtocol.call(this,e)}function wk(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Sk(e){this.config.exit.autolinkEmail.call(this,e)}function Ak(e){this.exit(e)}function Ck(e){gk(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,_k],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Nk]],{ignore:["link","linkReference"]})}function _k(e,t,n,r,s){let i="";if(!vp(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!Ik(n)))return!1;const a=Rk(n+r);if(!a[0])return!1;const o={type:"link",title:null,url:i+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[o,{type:"text",value:a[1]}]:o}function Nk(e,t,n,r){return!vp(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Ik(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Rk(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=wd(e,"(");let i=wd(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function vp(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ur(n)||ya(n))&&(!t||n!==47)}Tp.peek=Hk;function Pk(){this.buffer()}function Mk(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Lk(){this.buffer()}function Dk(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Ok(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=en(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Bk(e){this.exit(e)}function Fk(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=en(this.sliceSerialize(e)).toLowerCase(),n.label=t}function jk(e){this.exit(e)}function Hk(){return"["}function Tp(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),o(),a(),i+=s.move("]"),i}function Uk(){return{enter:{gfmFootnoteCallString:Pk,gfmFootnoteCall:Mk,gfmFootnoteDefinitionLabelString:Lk,gfmFootnoteDefinition:Dk},exit:{gfmFootnoteCallString:Ok,gfmFootnoteCall:Bk,gfmFootnoteDefinitionLabelString:Fk,gfmFootnoteDefinition:jk}}}function zk(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Tp},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const o=i.createTracker(a);let l=o.move("[^");const u=i.enter("footnoteDefinition"),c=i.enter("label");return l+=o.move(i.safe(i.associationId(r),{before:l,after:"]"})),c(),l+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),l+=o.move((t?`
500
+ `:" ")+i.indentLines(i.containerFlow(r,o.current()),t?kp:Vk))),u(),l}}function Vk(e,t,n){return t===0?e:kp(e,t,n)}function kp(e,t,n){return(n?"":" ")+e}const qk=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];wp.peek=Kk;function Wk(){return{canContainEols:["delete"],enter:{strikethrough:Yk},exit:{strikethrough:Gk}}}function $k(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:qk}],handlers:{delete:wp}}}function Yk(e){this.enter({type:"delete",children:[]},e)}function Gk(e){this.exit(e)}function wp(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(e,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function Kk(){return"~"}function Xk(e){return e.length}function Qk(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||Xk,i=[],a=[],o=[],l=[];let u=0,c=-1;for(;++c<e.length;){const b=[],g=[];let y=-1;for(e[c].length>u&&(u=e[c].length);++y<e[c].length;){const k=Zk(e[c][y]);if(n.alignDelimiters!==!1){const T=s(k);g[y]=T,(l[y]===void 0||T>l[y])&&(l[y]=T)}b.push(k)}a[c]=b,o[c]=g}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<u;)i[h]=Sd(r[h]);else{const b=Sd(r);for(;++h<u;)i[h]=b}h=-1;const f=[],d=[];for(;++h<u;){const b=i[h];let g="",y="";b===99?(g=":",y=":"):b===108?g=":":b===114&&(y=":");let k=n.alignDelimiters===!1?1:Math.max(1,l[h]-g.length-y.length);const T=g+"-".repeat(k)+y;n.alignDelimiters!==!1&&(k=g.length+k+y.length,k>l[h]&&(l[h]=k),d[h]=k),f[h]=T}a.splice(1,0,f),o.splice(1,0,d),c=-1;const m=[];for(;++c<a.length;){const b=a[c],g=o[c];h=-1;const y=[];for(;++h<u;){const k=b[h]||"";let T="",S="";if(n.alignDelimiters!==!1){const E=l[h]-(g[h]||0),w=i[h];w===114?T=" ".repeat(E):w===99?E%2?(T=" ".repeat(E/2+.5),S=" ".repeat(E/2-.5)):(T=" ".repeat(E/2),S=T):S=" ".repeat(E)}n.delimiterStart!==!1&&!h&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&k==="")&&(n.delimiterStart!==!1||h)&&y.push(" "),n.alignDelimiters!==!1&&y.push(T),y.push(k),n.alignDelimiters!==!1&&y.push(S),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||h!==u-1)&&y.push("|")}m.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return m.join(`
501
+ `)}function Zk(e){return e==null?"":String(e)}function Sd(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const Ad={}.hasOwnProperty;function Sp(e,t){const n=t||{};function r(s,...i){let a=r.invalid;const o=r.handlers;if(s&&Ad.call(s,e)){const l=String(s[e]);a=Ad.call(o,l)?o[l]:r.unknown}if(a)return a.call(this,s,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}function Jk(e,t,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const a=n.indentLines(n.containerFlow(e,i.current()),ew);return s(),a}function ew(e,t,n){return">"+(n?"":" ")+e}function tw(e,t){return Cd(e,t.inConstruct,!0)&&!Cd(e,t.notInConstruct,!1)}function Cd(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function _d(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
502
+ `&&tw(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
503
+ `}function nw(e,t){const n=String(e);let r=n.indexOf(t),s=r,i=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>a&&(a=i):i=1,s=r+t.length,r=n.indexOf(t,s);return a}function rw(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function iw(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function sw(e,t,n,r){const s=iw(n),i=e.value||"",a=s==="`"?"GraveAccent":"Tilde";if(rw(e,n)){const h=n.enter("codeIndented"),f=n.indentLines(i,aw);return h(),f}const o=n.createTracker(r),l=s.repeat(Math.max(nw(i,s)+1,3)),u=n.enter("codeFenced");let c=o.move(l);if(e.lang){const h=n.enter(`codeFencedLang${a}`);c+=o.move(n.safe(e.lang,{before:c,after:" ",encode:["`"],...o.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${a}`);c+=o.move(" "),c+=o.move(n.safe(e.meta,{before:c,after:`
504
+ `,encode:["`"],...o.current()})),h()}return c+=o.move(`
505
+ `),i&&(c+=o.move(i+`
506
+ `)),c+=o.move(l),u(),c}function aw(e,t,n){return(n?"":" ")+e}function pu(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function ow(e,t,n,r){const s=pu(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":`
507
+ `,...l.current()}))),o(),e.title&&(o=n.enter(`title${i}`),u+=l.move(" "+s),u+=l.move(n.safe(e.title,{before:u,after:s,...l.current()})),u+=l.move(s),o()),a(),u}function lw(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Ii(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ks(e,t,n){const r=Lr(e),s=Lr(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ap.peek=uw;function Ap(e,t,n,r){const s=lw(n),i=n.enter("emphasis"),a=n.createTracker(r),o=a.move(s);let l=a.move(n.containerPhrasing(e,{after:s,before:o,...a.current()}));const u=l.charCodeAt(0),c=Ks(r.before.charCodeAt(r.before.length-1),u,s);c.inside&&(l=Ii(u)+l.slice(1));const h=l.charCodeAt(l.length-1),f=Ks(r.after.charCodeAt(0),h,s);f.inside&&(l=l.slice(0,-1)+Ii(h));const d=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:c.outside},o+l+d}function uw(e,t,n){return n.options.emphasis||"*"}function cw(e,t){let n=!1;return wa(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,rl}),!!((!e.depth||e.depth<3)&&ou(e)&&(t.options.setext||n))}function dw(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(cw(e,n)){const c=n.enter("headingSetext"),h=n.enter("phrasing"),f=n.containerPhrasing(e,{...i.current(),before:`
508
+ `,after:`
509
+ `});return h(),c(),f+`
510
+ `+(s===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
511
+ `))+1))}const a="#".repeat(s),o=n.enter("headingAtx"),l=n.enter("phrasing");i.move(a+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
512
+ `,...i.current()});return/^[\t ]/.test(u)&&(u=Ii(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),l(),o(),u}Cp.peek=hw;function Cp(e){return e.value||""}function hw(){return"<"}_p.peek=fw;function _p(e,t,n,r){const s=pu(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),o(),e.title&&(o=n.enter(`title${i}`),u+=l.move(" "+s),u+=l.move(n.safe(e.title,{before:u,after:s,...l.current()})),u+=l.move(s),o()),u+=l.move(")"),a(),u}function fw(){return"!"}Np.peek=mw;function Np(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let l=o.move("![");const u=n.safe(e.alt,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),a();const c=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:l,after:"]",...o.current()});return a(),n.stack=c,i(),s==="full"||!u||u!==h?l+=o.move(h+"]"):s==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function mw(){return"!"}Ip.peek=pw;function Ip(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const a=n.unsafe[i],o=n.compilePattern(a);let l;if(a.atBreak)for(;l=o.exec(r);){let u=l.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(l.index+1)}}return s+r+s}function pw(){return"`"}function Rp(e,t){const n=ou(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Pp.peek=gw;function Pp(e,t,n,r){const s=pu(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,l;if(Rp(e,n)){const c=n.stack;n.stack=[],o=n.enter("autolink");let h=a.move("<");return h+=a.move(n.containerPhrasing(e,{before:h,after:">",...a.current()})),h+=a.move(">"),o(),n.stack=c,h}o=n.enter("link"),l=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(l=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=a.move(" "+s),u+=a.move(n.safe(e.title,{before:u,after:s,...a.current()})),u+=a.move(s),l()),u+=a.move(")"),o(),u}function gw(e,t,n){return Rp(e,n)?"<":"["}Mp.peek=bw;function Mp(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let l=o.move("[");const u=n.containerPhrasing(e,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),a();const c=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:l,after:"]",...o.current()});return a(),n.stack=c,i(),s==="full"||!u||u!==h?l+=o.move(h+"]"):s==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function bw(){return"["}function gu(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function xw(e){const t=gu(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function yw(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Lp(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Ew(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=e.ordered?yw(n):gu(n);const o=e.ordered?a==="."?")":".":xw(n);let l=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const c=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&c&&(!c.children||!c.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),Lp(n)===a&&c){let h=-1;for(;++h<e.children.length;){const f=e.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(a=o),n.bulletCurrent=a;const u=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=i,s(),u}function vw(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Tw(e,t,n,r){const s=vw(n);let i=n.bulletCurrent||gu(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(i+" ".repeat(a-i.length)),o.shift(a);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,o.current()),c);return l(),u;function c(h,f,d){return f?(d?"":" ".repeat(a))+h:(d?i:i+" ".repeat(a-i.length))+h}}function kw(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(e,r);return i(),s(),a}const ww=Ta(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Sw(e,t,n,r){return(e.children.some(function(a){return ww(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Aw(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Dp.peek=Cw;function Dp(e,t,n,r){const s=Aw(n),i=n.enter("strong"),a=n.createTracker(r),o=a.move(s+s);let l=a.move(n.containerPhrasing(e,{after:s,before:o,...a.current()}));const u=l.charCodeAt(0),c=Ks(r.before.charCodeAt(r.before.length-1),u,s);c.inside&&(l=Ii(u)+l.slice(1));const h=l.charCodeAt(l.length-1),f=Ks(r.after.charCodeAt(0),h,s);f.inside&&(l=l.slice(0,-1)+Ii(h));const d=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:c.outside},o+l+d}function Cw(e,t,n){return n.options.strong||"*"}function _w(e,t,n,r){return n.safe(e.value,r)}function Nw(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Iw(e,t,n){const r=(Lp(n)+(n.options.ruleSpaces?" ":"")).repeat(Nw(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Op={blockquote:Jk,break:_d,code:sw,definition:ow,emphasis:Ap,hardBreak:_d,heading:dw,html:Cp,image:_p,imageReference:Np,inlineCode:Ip,link:Pp,linkReference:Mp,list:Ew,listItem:Tw,paragraph:kw,root:Sw,strong:Dp,text:_w,thematicBreak:Iw};function Rw(){return{enter:{table:Pw,tableData:Nd,tableHeader:Nd,tableRow:Lw},exit:{codeText:Dw,table:Mw,tableData:go,tableHeader:go,tableRow:go}}}function Pw(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Mw(e){this.exit(e),this.data.inTable=void 0}function Lw(e){this.enter({type:"tableRow",children:[]},e)}function go(e){this.exit(e)}function Nd(e){this.enter({type:"tableCell",children:[]},e)}function Dw(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Ow));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Ow(e,t){return t==="|"?t:e}function Bw(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
513
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:a,tableCell:l,tableRow:o}};function a(d,m,b,g){return u(c(d,b,g),d.align)}function o(d,m,b,g){const y=h(d,b,g),k=u([y]);return k.slice(0,k.indexOf(`
514
+ `))}function l(d,m,b,g){const y=b.enter("tableCell"),k=b.enter("phrasing"),T=b.containerPhrasing(d,{...g,before:i,after:i});return k(),y(),T}function u(d,m){return Qk(d,{align:m,alignDelimiters:r,padding:n,stringLength:s})}function c(d,m,b){const g=d.children;let y=-1;const k=[],T=m.enter("table");for(;++y<g.length;)k[y]=h(g[y],m,b);return T(),k}function h(d,m,b){const g=d.children;let y=-1;const k=[],T=m.enter("tableRow");for(;++y<g.length;)k[y]=l(g[y],d,m,b);return T(),k}function f(d,m,b){let g=Op.inlineCode(d,m,b);return b.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function Fw(){return{exit:{taskListCheckValueChecked:Id,taskListCheckValueUnchecked:Id,paragraph:Hw}}}function jw(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Uw}}}function Id(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Hw(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let i=-1,a;for(;++i<s.length;){const o=s[i];if(o.type==="paragraph"){a=o;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Uw(e,t,n,r){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",o=n.createTracker(r);i&&o.move(a);let l=Op.listItem(e,t,n,{...r,...o.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(c){return c+a}}function zw(){return[Ek(),Uk(),Wk(),Rw(),Fw()]}function Vw(e){return{extensions:[vk(),zk(e),$k(),Bw(e),jw()]}}const qw={tokenize:Xw,partial:!0},Bp={tokenize:Qw,partial:!0},Fp={tokenize:Zw,partial:!0},jp={tokenize:Jw,partial:!0},Ww={tokenize:eS,partial:!0},Hp={name:"wwwAutolink",tokenize:Gw,previous:zp},Up={name:"protocolAutolink",tokenize:Kw,previous:Vp},vn={name:"emailAutolink",tokenize:Yw,previous:qp},mn={};function $w(){return{text:mn}}let Wn=48;for(;Wn<123;)mn[Wn]=vn,Wn++,Wn===58?Wn=65:Wn===91&&(Wn=97);mn[43]=vn;mn[45]=vn;mn[46]=vn;mn[95]=vn;mn[72]=[vn,Up];mn[104]=[vn,Up];mn[87]=[vn,Hp];mn[119]=[vn,Hp];function Yw(e,t,n){const r=this;let s,i;return a;function a(h){return!ol(h)||!qp.call(r,r.previous)||bu(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(h))}function o(h){return ol(h)?(e.consume(h),o):h===64?(e.consume(h),l):n(h)}function l(h){return h===46?e.check(Ww,c,u)(h):h===45||h===95||vt(h)?(i=!0,e.consume(h),l):c(h)}function u(h){return e.consume(h),s=!0,l}function c(h){return i&&s&&St(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function Gw(e,t,n){const r=this;return s;function s(a){return a!==87&&a!==119||!zp.call(r,r.previous)||bu(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(qw,e.attempt(Bp,e.attempt(Fp,i),n),n)(a))}function i(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function Kw(e,t,n){const r=this;let s="",i=!1;return a;function a(h){return(h===72||h===104)&&Vp.call(r,r.previous)&&!bu(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(h),e.consume(h),o):n(h)}function o(h){if(St(h)&&s.length<5)return s+=String.fromCodePoint(h),e.consume(h),o;if(h===58){const f=s.toLowerCase();if(f==="http"||f==="https")return e.consume(h),l}return n(h)}function l(h){return h===47?(e.consume(h),i?u:(i=!0,l)):n(h)}function u(h){return h===null||Ys(h)||rt(h)||ur(h)||ya(h)?n(h):e.attempt(Bp,e.attempt(Fp,c),n)(h)}function c(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function Xw(e,t,n){let r=0;return s;function s(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),s):a===46&&r===3?(e.consume(a),i):n(a)}function i(a){return a===null?n(a):t(a)}}function Qw(e,t,n){let r,s,i;return a;function a(u){return u===46||u===95?e.check(jp,l,o)(u):u===null||rt(u)||ur(u)||u!==45&&ya(u)?l(u):(i=!0,e.consume(u),a)}function o(u){return u===95?r=!0:(s=r,r=void 0),e.consume(u),a}function l(u){return s||r||!i?n(u):t(u)}}function Zw(e,t){let n=0,r=0;return s;function s(a){return a===40?(n++,e.consume(a),s):a===41&&r<n?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(jp,t,i)(a):a===null||rt(a)||ur(a)?t(a):(e.consume(a),s)}function i(a){return a===41&&r++,e.consume(a),s}}function Jw(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),i):o===93?(e.consume(o),s):o===60||o===null||rt(o)||ur(o)?t(o):n(o)}function s(o){return o===null||o===40||o===91||rt(o)||ur(o)?t(o):r(o)}function i(o){return St(o)?a(o):n(o)}function a(o){return o===59?(e.consume(o),r):St(o)?(e.consume(o),a):n(o)}}function eS(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return vt(i)?n(i):t(i)}}function zp(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||rt(e)}function Vp(e){return!St(e)}function qp(e){return!(e===47||ol(e))}function ol(e){return e===43||e===45||e===46||e===95||vt(e)}function bu(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const tS={tokenize:uS,partial:!0};function nS(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:aS,continuation:{tokenize:oS},exit:lS}},text:{91:{name:"gfmFootnoteCall",tokenize:sS},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:rS,resolveTo:iS}}}}function rS(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const l=r.events[s][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!a||!a._balanced)return n(l);const u=en(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function iS(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function sS(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return o;function o(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),l}function l(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(h){if(i>999||h===93&&!a||h===null||h===91||rt(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return s.includes(en(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return rt(h)||(a=!0),i++,e.consume(h),h===92?c:u}function c(h){return h===91||h===92||h===93?(e.consume(h),i++,u):u(h)}}function aS(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,o;return l;function l(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(m)}function c(m){if(a>999||m===93&&!o||m===null||m===91||rt(m))return n(m);if(m===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return i=en(r.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return rt(m)||(o=!0),a++,e.consume(m),m===92?h:c}function h(m){return m===91||m===92||m===93?(e.consume(m),a++,c):c(m)}function f(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),s.includes(i)||s.push(i),qe(e,d,"gfmFootnoteDefinitionWhitespace")):n(m)}function d(m){return t(m)}}function oS(e,t,n){return e.check(Ui,t,e.attempt(tS,t,n))}function lS(e){e.exit("gfmFootnoteDefinition")}function uS(e,t,n){const r=this;return qe(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):n(i)}}function cS(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,o){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let u=l;for(;u--;)if(a[u][0]==="exit"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[u][1].end.offset-a[u][1].start.offset){a[l][1].type="strikethroughSequence",a[u][1].type="strikethroughSequence";const c={type:"strikethrough",start:Object.assign({},a[u][1].start),end:Object.assign({},a[l][1].end)},h={type:"strikethroughText",start:Object.assign({},a[u][1].end),end:Object.assign({},a[l][1].start)},f=[["enter",c,o],["enter",a[u][1],o],["exit",a[u][1],o],["enter",h,o]],d=o.parser.constructs.insideSpan.null;d&&Ot(f,f.length,0,Ea(d,a.slice(u+1,l),o)),Ot(f,f.length,0,[["exit",h,o],["enter",a[l][1],o],["exit",a[l][1],o],["exit",c,o]]),Ot(a,u-1,l-u+3,f),l=u+f.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function i(a,o,l){const u=this.previous,c=this.events;let h=0;return f;function f(m){return u===126&&c[c.length-1][1].type!=="characterEscape"?l(m):(a.enter("strikethroughSequenceTemporary"),d(m))}function d(m){const b=Lr(u);if(m===126)return h>1?l(m):(a.consume(m),h++,d);if(h<2&&!n)return l(m);const g=a.exit("strikethroughSequenceTemporary"),y=Lr(m);return g._open=!y||y===2&&!!b,g._close=!b||b===2&&!!y,o(m)}}}class dS{constructor(){this.map=[]}add(t,n,r){hS(this,t,n,r)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function hS(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function fS(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function mS(){return{flow:{null:{name:"table",tokenize:pS,resolveAll:gS}}}}function pS(e,t,n){const r=this;let s=0,i=0,a;return o;function o(C){let L=r.events.length-1;for(;L>-1;){const P=r.events[L][1].type;if(P==="lineEnding"||P==="linePrefix")L--;else break}const M=L>-1?r.events[L][1].type:null,H=M==="tableHead"||M==="tableRow"?w:l;return H===w&&r.parser.lazy[r.now().line]?n(C):H(C)}function l(C){return e.enter("tableHead"),e.enter("tableRow"),u(C)}function u(C){return C===124||(a=!0,i+=1),c(C)}function c(C){return C===null?n(C):_e(C)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),d):n(C):Ue(C)?qe(e,c,"whitespace")(C):(i+=1,a&&(a=!1,s+=1),C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),a=!0,c):(e.enter("data"),h(C)))}function h(C){return C===null||C===124||rt(C)?(e.exit("data"),c(C)):(e.consume(C),C===92?f:h)}function f(C){return C===92||C===124?(e.consume(C),h):h(C)}function d(C){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(C):(e.enter("tableDelimiterRow"),a=!1,Ue(C)?qe(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):m(C))}function m(C){return C===45||C===58?g(C):C===124?(a=!0,e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),b):E(C)}function b(C){return Ue(C)?qe(e,g,"whitespace")(C):g(C)}function g(C){return C===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),y):C===45?(i+=1,y(C)):C===null||_e(C)?S(C):E(C)}function y(C){return C===45?(e.enter("tableDelimiterFiller"),k(C)):E(C)}function k(C){return C===45?(e.consume(C),k):C===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(C))}function T(C){return Ue(C)?qe(e,S,"whitespace")(C):S(C)}function S(C){return C===124?m(C):C===null||_e(C)?!a||s!==i?E(C):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(C)):E(C)}function E(C){return n(C)}function w(C){return e.enter("tableRow"),_(C)}function _(C){return C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),_):C===null||_e(C)?(e.exit("tableRow"),t(C)):Ue(C)?qe(e,_,"whitespace")(C):(e.enter("data"),A(C))}function A(C){return C===null||C===124||rt(C)?(e.exit("data"),_(C)):(e.consume(C),C===92?N:A)}function N(C){return C===92||C===124?(e.consume(C),A):A(C)}}function gS(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],o=!1,l=0,u,c,h;const f=new dS;for(;++n<e.length;){const d=e[n],m=d[1];d[0]==="enter"?m.type==="tableHead"?(o=!1,l!==0&&(Rd(f,t,l,u,c),c=void 0,l=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",u,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,h=void 0,i=[0,0,0,0],a=[0,n+1,0,0],o&&(o=!1,c={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",c,t]])),s=m.type==="tableDelimiterRow"?2:c?3:1):s&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],h=gs(f,t,i,s,void 0,h),i=[0,0,0,0]),a[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(a[0]=a[1],h=gs(f,t,i,s,void 0,h)),i=a,a=[i[1],n,0,0])):m.type==="tableHead"?(o=!0,l=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=n,i[1]!==0?(a[0]=a[1],h=gs(f,t,i,s,n,h)):a[1]!==0&&(h=gs(f,t,a,s,n,h)),s=0):s&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(a[3]=n)}for(l!==0&&Rd(f,t,l,u,c),f.consume(t.events),n=-1;++n<t.events.length;){const d=t.events[n];d[0]==="enter"&&d[1].type==="table"&&(d[1]._align=fS(t.events,n))}return e}function gs(e,t,n,r,s,i){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(i.end=Object.assign({},vr(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=vr(t.events,n[1]);if(i={type:a,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=vr(t.events,n[2]),c=vr(t.events,n[3]),h={type:o,start:Object.assign({},u),end:Object.assign({},c)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const f=t.events[n[2]],d=t.events[n[3]];if(f[1].end=Object.assign({},d[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,b=n[3]-n[2]-1;e.add(m,b,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return s!==void 0&&(i.end=Object.assign({},vr(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function Rd(e,t,n,r,s){const i=[],a=vr(t.events,n);s&&(s.end=Object.assign({},a),i.push(["exit",s,t])),r.end=Object.assign({},a),i.push(["exit",r,t]),e.add(n+1,0,i)}function vr(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const bS={name:"tasklistCheck",tokenize:yS};function xS(){return{text:{91:bS}}}function yS(e,t,n){const r=this;return s;function s(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return rt(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):n(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(l)}function o(l){return _e(l)?t(l):Ue(l)?e.check({tokenize:ES},t,n)(l):n(l)}}function ES(e,t,n){return qe(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function vS(e){return Zm([$w(),nS(),cS(e),mS(),xS()])}const TS={};function Wp(e){const t=this,n=e||TS,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(vS(n)),i.push(zw()),a.push(Vw(n))}const Pd=/[#.]/g;function kS(e,t){const n=e||"",r={};let s=0,i,a;for(;s<n.length;){Pd.lastIndex=s;const o=Pd.exec(n),l=n.slice(s,o?o.index:n.length);l&&(i?i==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:a=l,s+=l.length),o&&(i=o[0],s++)}return{type:"element",tagName:a||t||"div",properties:r,children:[]}}function $p(e,t,n){const r=n?CS(n):void 0;function s(i,a,...o){let l;if(i==null){l={type:"root",children:[]};const u=a;o.unshift(u)}else{l=kS(i,t);const u=l.tagName.toLowerCase(),c=r?r.get(u):void 0;if(l.tagName=c||u,wS(a))o.unshift(a);else for(const[h,f]of Object.entries(a))SS(e,l.properties,h,f)}for(const u of o)ll(l.children,u);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return s}function wS(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const r of n){const s=t[r];if(s&&typeof s=="object"){if(!Array.isArray(s))return!0;const i=s;for(const a of i)if(typeof a!="number"&&typeof a!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function SS(e,t,n,r){const s=ba(e,n);let i;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;i=r}else typeof r=="boolean"?i=r:typeof r=="string"?s.spaceSeparated?i=Wc(r):s.commaSeparated?i=Hc(r):s.commaOrSpaceSeparated?i=Wc(Hc(r).join(" ")):i=Md(s,s.property,r):Array.isArray(r)?i=[...r]:i=s.property==="style"?AS(r):String(r);if(Array.isArray(i)){const a=[];for(const o of i)a.push(Md(s,s.property,o));i=a}s.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[s.property]=i}}function ll(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)ll(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?ll(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function Md(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||_i(n)===_i(t)))return!0}return n}function AS(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function CS(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const _S=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],NS=$p(Hi,"div"),IS=$p(Mn,"g",_S);function RS(e){const t=String(e),n=[];return{toOffset:s,toPoint:r};function r(i){if(typeof i=="number"&&i>-1&&i<=t.length){let a=0;for(;;){let o=n[a];if(o===void 0){const l=Ld(t,n[a-1]);o=l===-1?t.length+1:l+1,n[a]=o}if(o>i)return{line:a+1,column:i-(a>0?n[a-1]:0)+1,offset:i};a++}}}function s(i){if(i&&typeof i.line=="number"&&typeof i.column=="number"&&!Number.isNaN(i.line)&&!Number.isNaN(i.column)){for(;n.length<i.line;){const o=n[n.length-1],l=Ld(t,o),u=l===-1?t.length+1:l+1;if(o===u)break;n.push(u)}const a=(i.line>1?n[i.line-2]:0)+i.column-1;if(a<n[i.line-1])return a}}}function Ld(e,t){const n=e.indexOf("\r",t),r=e.indexOf(`
515
+ `,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const Zn={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},Yp={}.hasOwnProperty,PS=Object.prototype;function MS(e,t){const n=t||{};return xu({file:n.file||void 0,location:!1,schema:n.space==="svg"?Mn:Hi,verbose:n.verbose||!1},e)}function xu(e,t){let n;switch(t.nodeName){case"#comment":{const r=t;return n={type:"comment",value:r.data},Is(e,r,n),n}case"#document":case"#document-fragment":{const r=t,s="mode"in r?r.mode==="quirks"||r.mode==="limited-quirks":!1;if(n={type:"root",children:Gp(e,t.childNodes),data:{quirksMode:s}},e.file&&e.location){const i=String(e.file),a=RS(i),o=a.toPoint(0),l=a.toPoint(i.length);n.position={start:o,end:l}}return n}case"#documentType":{const r=t;return n={type:"doctype"},Is(e,r,n),n}case"#text":{const r=t;return n={type:"text",value:r.value},Is(e,r,n),n}default:return n=LS(e,t),n}}function Gp(e,t){let n=-1;const r=[];for(;++n<t.length;){const s=xu(e,t[n]);r.push(s)}return r}function LS(e,t){const n=e.schema;e.schema=t.namespaceURI===Zn.svg?Mn:Hi;let r=-1;const s={};for(;++r<t.attrs.length;){const o=t.attrs[r],l=(o.prefix?o.prefix+":":"")+o.name;Yp.call(PS,l)||(s[l]=o.value)}const a=(e.schema.space==="svg"?IS:NS)(t.tagName,s,Gp(e,t.childNodes));if(Is(e,t,a),a.tagName==="template"){const o=t,l=o.sourceCodeLocation,u=l&&l.startTag&&kr(l.startTag),c=l&&l.endTag&&kr(l.endTag),h=xu(e,o.content);u&&c&&e.file&&(h.position={start:u.end,end:c.start}),a.content=h}return e.schema=n,a}function Is(e,t,n){if("sourceCodeLocation"in t&&t.sourceCodeLocation&&e.file){const r=DS(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function DS(e,t,n){const r=kr(n);if(t.type==="element"){const s=t.children[t.children.length-1];if(r&&!n.endTag&&s&&s.position&&s.position.end&&(r.end=Object.assign({},s.position.end)),e.verbose){const i={};let a;if(n.attrs)for(a in n.attrs)Yp.call(n.attrs,a)&&(i[ba(e.schema,a).property]=kr(n.attrs[a]));n.startTag;const o=kr(n.startTag),l=n.endTag?kr(n.endTag):void 0,u={opening:o};l&&(u.closing=l),u.properties=i,t.data={position:u}}}return r}function kr(e){const t=Dd({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=Dd({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function Dd(e){return e.line&&e.column?e:void 0}const OS={},BS={}.hasOwnProperty,Kp=Sp("type",{handlers:{root:jS,element:qS,text:zS,comment:VS,doctype:US}});function FS(e,t){const r=(t||OS).space;return Kp(e,r==="svg"?Mn:Hi)}function jS(e,t){const n={nodeName:"#document",mode:(e.data||{}).quirksMode?"quirks":"no-quirks",childNodes:[]};return n.childNodes=yu(e.children,n,t),Hr(e,n),n}function HS(e,t){const n={nodeName:"#document-fragment",childNodes:[]};return n.childNodes=yu(e.children,n,t),Hr(e,n),n}function US(e){const t={nodeName:"#documentType",name:"html",publicId:"",systemId:"",parentNode:null};return Hr(e,t),t}function zS(e){const t={nodeName:"#text",value:e.value,parentNode:null};return Hr(e,t),t}function VS(e){const t={nodeName:"#comment",data:e.value,parentNode:null};return Hr(e,t),t}function qS(e,t){const n=t;let r=n;e.type==="element"&&e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(r=Mn);const s=[];let i;if(e.properties){for(i in e.properties)if(i!=="children"&&BS.call(e.properties,i)){const l=WS(r,i,e.properties[i]);l&&s.push(l)}}const a=r.space,o={nodeName:e.tagName,tagName:e.tagName,attrs:s,namespaceURI:Zn[a],childNodes:[],parentNode:null};return o.childNodes=yu(e.children,o,r),Hr(e,o),e.tagName==="template"&&e.content&&(o.content=HS(e.content,r)),o}function WS(e,t,n){const r=ba(e,t);if(n===!1||n===null||n===void 0||typeof n=="number"&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?Om(n):qm(n));const s={name:r.attribute,value:n===!0?"":String(n)};if(r.space&&r.space!=="html"&&r.space!=="svg"){const i=s.name.indexOf(":");i<0?s.prefix="":(s.name=s.name.slice(i+1),s.prefix=r.attribute.slice(0,i)),s.namespace=Zn[r.space]}return s}function yu(e,t,n){let r=-1;const s=[];if(e)for(;++r<e.length;){const i=Kp(e[r],n);i.parentNode=t,s.push(i)}return s}function Hr(e,t){const n=e.position;n&&n.start&&n.end&&(n.start.offset,n.end.offset,t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}const $S=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],YS=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),it="�";var O;(function(e){e[e.EOF=-1]="EOF",e[e.NULL=0]="NULL",e[e.TABULATION=9]="TABULATION",e[e.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",e[e.LINE_FEED=10]="LINE_FEED",e[e.FORM_FEED=12]="FORM_FEED",e[e.SPACE=32]="SPACE",e[e.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",e[e.QUOTATION_MARK=34]="QUOTATION_MARK",e[e.AMPERSAND=38]="AMPERSAND",e[e.APOSTROPHE=39]="APOSTROPHE",e[e.HYPHEN_MINUS=45]="HYPHEN_MINUS",e[e.SOLIDUS=47]="SOLIDUS",e[e.DIGIT_0=48]="DIGIT_0",e[e.DIGIT_9=57]="DIGIT_9",e[e.SEMICOLON=59]="SEMICOLON",e[e.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",e[e.EQUALS_SIGN=61]="EQUALS_SIGN",e[e.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",e[e.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",e[e.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",e[e.GRAVE_ACCENT=96]="GRAVE_ACCENT",e[e.LATIN_SMALL_A=97]="LATIN_SMALL_A",e[e.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(O||(O={}));const Nt={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function Xp(e){return e>=55296&&e<=57343}function GS(e){return e>=56320&&e<=57343}function KS(e,t){return(e-55296)*1024+9216+t}function Qp(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function Zp(e){return e>=64976&&e<=65007||YS.has(e)}var Z;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(Z||(Z={}));const XS=65536;class QS{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=XS,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:r,col:s,offset:i}=this,a=s+n,o=i+n;return{code:t,startLine:r,endLine:r,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(GS(n))return this.pos++,this._addGap(),KS(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,O.EOF;return this._err(Z.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r<t.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==t.charCodeAt(r))return!1;return!0}peek(t){const n=this.pos+t;if(n>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,O.EOF;const r=this.html.charCodeAt(n);return r===O.CARRIAGE_RETURN?O.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,O.EOF;let t=this.html.charCodeAt(this.pos);return t===O.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,O.LINE_FEED):t===O.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Xp(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===O.LINE_FEED||t===O.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){Qp(t)?this._err(Z.controlCharacterInInputStream):Zp(t)&&this._err(Z.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var He;(function(e){e[e.CHARACTER=0]="CHARACTER",e[e.NULL_CHARACTER=1]="NULL_CHARACTER",e[e.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",e[e.START_TAG=3]="START_TAG",e[e.END_TAG=4]="END_TAG",e[e.COMMENT=5]="COMMENT",e[e.DOCTYPE=6]="DOCTYPE",e[e.EOF=7]="EOF",e[e.HIBERNATION=8]="HIBERNATION"})(He||(He={}));function Jp(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const ZS=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),JS=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function eA(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=JS.get(e))!==null&&t!==void 0?t:e}var gt;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(gt||(gt={}));const tA=32;var _n;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(_n||(_n={}));function ul(e){return e>=gt.ZERO&&e<=gt.NINE}function nA(e){return e>=gt.UPPER_A&&e<=gt.UPPER_F||e>=gt.LOWER_A&&e<=gt.LOWER_F}function rA(e){return e>=gt.UPPER_A&&e<=gt.UPPER_Z||e>=gt.LOWER_A&&e<=gt.LOWER_Z||ul(e)}function iA(e){return e===gt.EQUALS||rA(e)}var pt;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(pt||(pt={}));var yn;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(yn||(yn={}));class sA{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=pt.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=yn.Strict}startEntity(t){this.decodeMode=t,this.state=pt.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case pt.EntityStart:return t.charCodeAt(n)===gt.NUM?(this.state=pt.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=pt.NamedEntity,this.stateNamedEntity(t,n));case pt.NumericStart:return this.stateNumericStart(t,n);case pt.NumericDecimal:return this.stateNumericDecimal(t,n);case pt.NumericHex:return this.stateNumericHex(t,n);case pt.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|tA)===gt.LOWER_X?(this.state=pt.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=pt.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,s){if(n!==r){const i=r-n;this.result=this.result*Math.pow(s,i)+Number.parseInt(t.substr(n,i),s),this.consumed+=i}}stateNumericHex(t,n){const r=n;for(;n<t.length;){const s=t.charCodeAt(n);if(ul(s)||nA(s))n+=1;else return this.addToNumericResult(t,r,n,16),this.emitNumericEntity(s,3)}return this.addToNumericResult(t,r,n,16),-1}stateNumericDecimal(t,n){const r=n;for(;n<t.length;){const s=t.charCodeAt(n);if(ul(s))n+=1;else return this.addToNumericResult(t,r,n,10),this.emitNumericEntity(s,2)}return this.addToNumericResult(t,r,n,10),-1}emitNumericEntity(t,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===gt.SEMI)this.consumed+=1;else if(this.decodeMode===yn.Strict)return 0;return this.emitCodePoint(eA(this.result),this.consumed),this.errors&&(t!==gt.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,n){const{decodeTree:r}=this;let s=r[this.treeIndex],i=(s&_n.VALUE_LENGTH)>>14;for(;n<t.length;n++,this.excess++){const a=t.charCodeAt(n);if(this.treeIndex=aA(r,s,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===yn.Attribute&&(i===0||iA(a))?0:this.emitNotTerminatedNamedEntity();if(s=r[this.treeIndex],i=(s&_n.VALUE_LENGTH)>>14,i!==0){if(a===gt.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==yn.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,s=(r[n]&_n.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,s,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:s}=this;return this.emitCodePoint(n===1?s[t]&~_n.VALUE_LENGTH:s[t+1],r),n===3&&this.emitCodePoint(s[t+2],r),r}end(){var t;switch(this.state){case pt.NamedEntity:return this.result!==0&&(this.decodeMode!==yn.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case pt.NumericDecimal:return this.emitNumericEntity(0,2);case pt.NumericHex:return this.emitNumericEntity(0,3);case pt.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case pt.EntityStart:return 0}}}function aA(e,t,n,r){const s=(t&_n.BRANCH_LENGTH)>>7,i=t&_n.JUMP_TABLE;if(s===0)return i!==0&&r===i?n:-1;if(i){const l=r-i;return l<0||l>=s?-1:e[n+l]-1}let a=n,o=a+s-1;for(;a<=o;){const l=a+o>>>1,u=e[l];if(u<r)a=l+1;else if(u>r)o=l-1;else return e[l+s]}return-1}var ae;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(ae||(ae={}));var ir;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(ir||(ir={}));var Vt;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Vt||(Vt={}));var $;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})($||($={}));var x;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(x||(x={}));const oA=new Map([[$.A,x.A],[$.ADDRESS,x.ADDRESS],[$.ANNOTATION_XML,x.ANNOTATION_XML],[$.APPLET,x.APPLET],[$.AREA,x.AREA],[$.ARTICLE,x.ARTICLE],[$.ASIDE,x.ASIDE],[$.B,x.B],[$.BASE,x.BASE],[$.BASEFONT,x.BASEFONT],[$.BGSOUND,x.BGSOUND],[$.BIG,x.BIG],[$.BLOCKQUOTE,x.BLOCKQUOTE],[$.BODY,x.BODY],[$.BR,x.BR],[$.BUTTON,x.BUTTON],[$.CAPTION,x.CAPTION],[$.CENTER,x.CENTER],[$.CODE,x.CODE],[$.COL,x.COL],[$.COLGROUP,x.COLGROUP],[$.DD,x.DD],[$.DESC,x.DESC],[$.DETAILS,x.DETAILS],[$.DIALOG,x.DIALOG],[$.DIR,x.DIR],[$.DIV,x.DIV],[$.DL,x.DL],[$.DT,x.DT],[$.EM,x.EM],[$.EMBED,x.EMBED],[$.FIELDSET,x.FIELDSET],[$.FIGCAPTION,x.FIGCAPTION],[$.FIGURE,x.FIGURE],[$.FONT,x.FONT],[$.FOOTER,x.FOOTER],[$.FOREIGN_OBJECT,x.FOREIGN_OBJECT],[$.FORM,x.FORM],[$.FRAME,x.FRAME],[$.FRAMESET,x.FRAMESET],[$.H1,x.H1],[$.H2,x.H2],[$.H3,x.H3],[$.H4,x.H4],[$.H5,x.H5],[$.H6,x.H6],[$.HEAD,x.HEAD],[$.HEADER,x.HEADER],[$.HGROUP,x.HGROUP],[$.HR,x.HR],[$.HTML,x.HTML],[$.I,x.I],[$.IMG,x.IMG],[$.IMAGE,x.IMAGE],[$.INPUT,x.INPUT],[$.IFRAME,x.IFRAME],[$.KEYGEN,x.KEYGEN],[$.LABEL,x.LABEL],[$.LI,x.LI],[$.LINK,x.LINK],[$.LISTING,x.LISTING],[$.MAIN,x.MAIN],[$.MALIGNMARK,x.MALIGNMARK],[$.MARQUEE,x.MARQUEE],[$.MATH,x.MATH],[$.MENU,x.MENU],[$.META,x.META],[$.MGLYPH,x.MGLYPH],[$.MI,x.MI],[$.MO,x.MO],[$.MN,x.MN],[$.MS,x.MS],[$.MTEXT,x.MTEXT],[$.NAV,x.NAV],[$.NOBR,x.NOBR],[$.NOFRAMES,x.NOFRAMES],[$.NOEMBED,x.NOEMBED],[$.NOSCRIPT,x.NOSCRIPT],[$.OBJECT,x.OBJECT],[$.OL,x.OL],[$.OPTGROUP,x.OPTGROUP],[$.OPTION,x.OPTION],[$.P,x.P],[$.PARAM,x.PARAM],[$.PLAINTEXT,x.PLAINTEXT],[$.PRE,x.PRE],[$.RB,x.RB],[$.RP,x.RP],[$.RT,x.RT],[$.RTC,x.RTC],[$.RUBY,x.RUBY],[$.S,x.S],[$.SCRIPT,x.SCRIPT],[$.SEARCH,x.SEARCH],[$.SECTION,x.SECTION],[$.SELECT,x.SELECT],[$.SOURCE,x.SOURCE],[$.SMALL,x.SMALL],[$.SPAN,x.SPAN],[$.STRIKE,x.STRIKE],[$.STRONG,x.STRONG],[$.STYLE,x.STYLE],[$.SUB,x.SUB],[$.SUMMARY,x.SUMMARY],[$.SUP,x.SUP],[$.TABLE,x.TABLE],[$.TBODY,x.TBODY],[$.TEMPLATE,x.TEMPLATE],[$.TEXTAREA,x.TEXTAREA],[$.TFOOT,x.TFOOT],[$.TD,x.TD],[$.TH,x.TH],[$.THEAD,x.THEAD],[$.TITLE,x.TITLE],[$.TR,x.TR],[$.TRACK,x.TRACK],[$.TT,x.TT],[$.U,x.U],[$.UL,x.UL],[$.SVG,x.SVG],[$.VAR,x.VAR],[$.WBR,x.WBR],[$.XMP,x.XMP]]);function Ur(e){var t;return(t=oA.get(e))!==null&&t!==void 0?t:x.UNKNOWN}const ue=x,lA={[ae.HTML]:new Set([ue.ADDRESS,ue.APPLET,ue.AREA,ue.ARTICLE,ue.ASIDE,ue.BASE,ue.BASEFONT,ue.BGSOUND,ue.BLOCKQUOTE,ue.BODY,ue.BR,ue.BUTTON,ue.CAPTION,ue.CENTER,ue.COL,ue.COLGROUP,ue.DD,ue.DETAILS,ue.DIR,ue.DIV,ue.DL,ue.DT,ue.EMBED,ue.FIELDSET,ue.FIGCAPTION,ue.FIGURE,ue.FOOTER,ue.FORM,ue.FRAME,ue.FRAMESET,ue.H1,ue.H2,ue.H3,ue.H4,ue.H5,ue.H6,ue.HEAD,ue.HEADER,ue.HGROUP,ue.HR,ue.HTML,ue.IFRAME,ue.IMG,ue.INPUT,ue.LI,ue.LINK,ue.LISTING,ue.MAIN,ue.MARQUEE,ue.MENU,ue.META,ue.NAV,ue.NOEMBED,ue.NOFRAMES,ue.NOSCRIPT,ue.OBJECT,ue.OL,ue.P,ue.PARAM,ue.PLAINTEXT,ue.PRE,ue.SCRIPT,ue.SECTION,ue.SELECT,ue.SOURCE,ue.STYLE,ue.SUMMARY,ue.TABLE,ue.TBODY,ue.TD,ue.TEMPLATE,ue.TEXTAREA,ue.TFOOT,ue.TH,ue.THEAD,ue.TITLE,ue.TR,ue.TRACK,ue.UL,ue.WBR,ue.XMP]),[ae.MATHML]:new Set([ue.MI,ue.MO,ue.MN,ue.MS,ue.MTEXT,ue.ANNOTATION_XML]),[ae.SVG]:new Set([ue.TITLE,ue.FOREIGN_OBJECT,ue.DESC]),[ae.XLINK]:new Set,[ae.XML]:new Set,[ae.XMLNS]:new Set},cl=new Set([ue.H1,ue.H2,ue.H3,ue.H4,ue.H5,ue.H6]);$.STYLE,$.SCRIPT,$.XMP,$.IFRAME,$.NOEMBED,$.NOFRAMES,$.PLAINTEXT;var j;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(j||(j={}));const ut={DATA:j.DATA,RCDATA:j.RCDATA,RAWTEXT:j.RAWTEXT,SCRIPT_DATA:j.SCRIPT_DATA,PLAINTEXT:j.PLAINTEXT,CDATA_SECTION:j.CDATA_SECTION};function uA(e){return e>=O.DIGIT_0&&e<=O.DIGIT_9}function ai(e){return e>=O.LATIN_CAPITAL_A&&e<=O.LATIN_CAPITAL_Z}function cA(e){return e>=O.LATIN_SMALL_A&&e<=O.LATIN_SMALL_Z}function wn(e){return cA(e)||ai(e)}function Od(e){return wn(e)||uA(e)}function bs(e){return e+32}function e0(e){return e===O.SPACE||e===O.LINE_FEED||e===O.TABULATION||e===O.FORM_FEED}function Bd(e){return e0(e)||e===O.SOLIDUS||e===O.GREATER_THAN_SIGN}function dA(e){return e===O.NULL?Z.nullCharacterReference:e>1114111?Z.characterReferenceOutsideUnicodeRange:Xp(e)?Z.surrogateCharacterReference:Zp(e)?Z.noncharacterCharacterReference:Qp(e)||e===O.CARRIAGE_RETURN?Z.controlCharacterReference:null}class hA{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=j.DATA,this.returnState=j.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new QS(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new sA(ZS,(r,s)=>{this.preprocessor.pos=this.entityStartPos+s-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(Z.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(Z.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const s=dA(r);s&&this._err(s,1)}}:void 0)}_err(t,n=0){var r,s;(s=(r=this.handler).onParseError)===null||s===void 0||s.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t==null||t())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r==null||r()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n<t;n++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,n){return this.preprocessor.startsWith(t,n)?(this._advanceBy(t.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:He.START_TAG,tagName:"",tagID:x.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:He.END_TAG,tagName:"",tagID:x.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:He.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:He.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,n){this.currentCharacterToken={type:t,chars:n,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,n;const r=this.currentToken;if(Jp(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const s=(t=(n=r.location).attrs)!==null&&t!==void 0?t:n.attrs=Object.create(null);s[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(Z.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(t){this._emitCurrentCharacterToken(t.location),this.currentToken=null,t.location&&(t.location.endLine=this.preprocessor.line,t.location.endCol=this.preprocessor.col+1,t.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const t=this.currentToken;this.prepareToken(t),t.tagID=Ur(t.tagName),t.type===He.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(Z.endTagWithAttributes),t.selfClosing&&this._err(Z.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case He.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case He.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case He.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:He.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=e0(t)?He.WHITESPACE_CHARACTER:t===O.NULL?He.NULL_CHARACTER:He.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(He.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=j.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?yn.Attribute:yn.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===j.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===j.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===j.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case j.DATA:{this._stateData(t);break}case j.RCDATA:{this._stateRcdata(t);break}case j.RAWTEXT:{this._stateRawtext(t);break}case j.SCRIPT_DATA:{this._stateScriptData(t);break}case j.PLAINTEXT:{this._statePlaintext(t);break}case j.TAG_OPEN:{this._stateTagOpen(t);break}case j.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case j.TAG_NAME:{this._stateTagName(t);break}case j.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case j.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case j.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case j.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case j.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case j.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case j.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case j.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case j.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case j.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case j.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case j.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case j.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case j.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case j.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case j.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case j.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case j.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case j.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case j.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case j.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case j.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case j.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case j.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case j.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case j.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case j.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case j.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case j.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case j.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case j.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case j.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case j.BOGUS_COMMENT:{this._stateBogusComment(t);break}case j.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case j.COMMENT_START:{this._stateCommentStart(t);break}case j.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case j.COMMENT:{this._stateComment(t);break}case j.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case j.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case j.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case j.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case j.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case j.COMMENT_END:{this._stateCommentEnd(t);break}case j.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case j.DOCTYPE:{this._stateDoctype(t);break}case j.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case j.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case j.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case j.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case j.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case j.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case j.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case j.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case j.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case j.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case j.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case j.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case j.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case j.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case j.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case j.CDATA_SECTION:{this._stateCdataSection(t);break}case j.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case j.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case j.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case j.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case O.LESS_THAN_SIGN:{this.state=j.TAG_OPEN;break}case O.AMPERSAND:{this._startCharacterReference();break}case O.NULL:{this._err(Z.unexpectedNullCharacter),this._emitCodePoint(t);break}case O.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case O.AMPERSAND:{this._startCharacterReference();break}case O.LESS_THAN_SIGN:{this.state=j.RCDATA_LESS_THAN_SIGN;break}case O.NULL:{this._err(Z.unexpectedNullCharacter),this._emitChars(it);break}case O.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case O.LESS_THAN_SIGN:{this.state=j.RAWTEXT_LESS_THAN_SIGN;break}case O.NULL:{this._err(Z.unexpectedNullCharacter),this._emitChars(it);break}case O.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case O.LESS_THAN_SIGN:{this.state=j.SCRIPT_DATA_LESS_THAN_SIGN;break}case O.NULL:{this._err(Z.unexpectedNullCharacter),this._emitChars(it);break}case O.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case O.NULL:{this._err(Z.unexpectedNullCharacter),this._emitChars(it);break}case O.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(wn(t))this._createStartTagToken(),this.state=j.TAG_NAME,this._stateTagName(t);else switch(t){case O.EXCLAMATION_MARK:{this.state=j.MARKUP_DECLARATION_OPEN;break}case O.SOLIDUS:{this.state=j.END_TAG_OPEN;break}case O.QUESTION_MARK:{this._err(Z.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=j.BOGUS_COMMENT,this._stateBogusComment(t);break}case O.EOF:{this._err(Z.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(Z.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=j.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(wn(t))this._createEndTagToken(),this.state=j.TAG_NAME,this._stateTagName(t);else switch(t){case O.GREATER_THAN_SIGN:{this._err(Z.missingEndTagName),this.state=j.DATA;break}case O.EOF:{this._err(Z.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(Z.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=j.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){const n=this.currentToken;switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:{this.state=j.BEFORE_ATTRIBUTE_NAME;break}case O.SOLIDUS:{this.state=j.SELF_CLOSING_START_TAG;break}case O.GREATER_THAN_SIGN:{this.state=j.DATA,this.emitCurrentTagToken();break}case O.NULL:{this._err(Z.unexpectedNullCharacter),n.tagName+=it;break}case O.EOF:{this._err(Z.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(ai(t)?bs(t):t)}}_stateRcdataLessThanSign(t){t===O.SOLIDUS?this.state=j.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=j.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){wn(t)?(this.state=j.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=j.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const n=this.currentToken;switch(n.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=j.BEFORE_ATTRIBUTE_NAME,!1;case O.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=j.SELF_CLOSING_START_TAG,!1;case O.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=j.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=j.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===O.SOLIDUS?this.state=j.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=j.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){wn(t)?(this.state=j.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=j.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=j.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case O.SOLIDUS:{this.state=j.SCRIPT_DATA_END_TAG_OPEN;break}case O.EXCLAMATION_MARK:{this.state=j.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=j.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){wn(t)?(this.state=j.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=j.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=j.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===O.HYPHEN_MINUS?(this.state=j.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=j.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===O.HYPHEN_MINUS?(this.state=j.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=j.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case O.HYPHEN_MINUS:{this.state=j.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case O.LESS_THAN_SIGN:{this.state=j.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case O.NULL:{this._err(Z.unexpectedNullCharacter),this._emitChars(it);break}case O.EOF:{this._err(Z.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case O.HYPHEN_MINUS:{this.state=j.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case O.LESS_THAN_SIGN:{this.state=j.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case O.NULL:{this._err(Z.unexpectedNullCharacter),this.state=j.SCRIPT_DATA_ESCAPED,this._emitChars(it);break}case O.EOF:{this._err(Z.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=j.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case O.HYPHEN_MINUS:{this._emitChars("-");break}case O.LESS_THAN_SIGN:{this.state=j.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case O.GREATER_THAN_SIGN:{this.state=j.SCRIPT_DATA,this._emitChars(">");break}case O.NULL:{this._err(Z.unexpectedNullCharacter),this.state=j.SCRIPT_DATA_ESCAPED,this._emitChars(it);break}case O.EOF:{this._err(Z.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=j.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===O.SOLIDUS?this.state=j.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:wn(t)?(this._emitChars("<"),this.state=j.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=j.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){wn(t)?(this.state=j.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=j.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=j.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(Nt.SCRIPT,!1)&&Bd(this.preprocessor.peek(Nt.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<Nt.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=j.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=j.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case O.HYPHEN_MINUS:{this.state=j.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case O.LESS_THAN_SIGN:{this.state=j.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case O.NULL:{this._err(Z.unexpectedNullCharacter),this._emitChars(it);break}case O.EOF:{this._err(Z.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case O.HYPHEN_MINUS:{this.state=j.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case O.LESS_THAN_SIGN:{this.state=j.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case O.NULL:{this._err(Z.unexpectedNullCharacter),this.state=j.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(it);break}case O.EOF:{this._err(Z.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=j.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case O.HYPHEN_MINUS:{this._emitChars("-");break}case O.LESS_THAN_SIGN:{this.state=j.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case O.GREATER_THAN_SIGN:{this.state=j.SCRIPT_DATA,this._emitChars(">");break}case O.NULL:{this._err(Z.unexpectedNullCharacter),this.state=j.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(it);break}case O.EOF:{this._err(Z.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=j.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===O.SOLIDUS?(this.state=j.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=j.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(Nt.SCRIPT,!1)&&Bd(this.preprocessor.peek(Nt.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<Nt.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=j.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=j.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:break;case O.SOLIDUS:case O.GREATER_THAN_SIGN:case O.EOF:{this.state=j.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case O.EQUALS_SIGN:{this._err(Z.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=j.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=j.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:case O.SOLIDUS:case O.GREATER_THAN_SIGN:case O.EOF:{this._leaveAttrName(),this.state=j.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case O.EQUALS_SIGN:{this._leaveAttrName(),this.state=j.BEFORE_ATTRIBUTE_VALUE;break}case O.QUOTATION_MARK:case O.APOSTROPHE:case O.LESS_THAN_SIGN:{this._err(Z.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break}case O.NULL:{this._err(Z.unexpectedNullCharacter),this.currentAttr.name+=it;break}default:this.currentAttr.name+=String.fromCodePoint(ai(t)?bs(t):t)}}_stateAfterAttributeName(t){switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:break;case O.SOLIDUS:{this.state=j.SELF_CLOSING_START_TAG;break}case O.EQUALS_SIGN:{this.state=j.BEFORE_ATTRIBUTE_VALUE;break}case O.GREATER_THAN_SIGN:{this.state=j.DATA,this.emitCurrentTagToken();break}case O.EOF:{this._err(Z.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=j.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:break;case O.QUOTATION_MARK:{this.state=j.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case O.APOSTROPHE:{this.state=j.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case O.GREATER_THAN_SIGN:{this._err(Z.missingAttributeValue),this.state=j.DATA,this.emitCurrentTagToken();break}default:this.state=j.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case O.QUOTATION_MARK:{this.state=j.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case O.AMPERSAND:{this._startCharacterReference();break}case O.NULL:{this._err(Z.unexpectedNullCharacter),this.currentAttr.value+=it;break}case O.EOF:{this._err(Z.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case O.APOSTROPHE:{this.state=j.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case O.AMPERSAND:{this._startCharacterReference();break}case O.NULL:{this._err(Z.unexpectedNullCharacter),this.currentAttr.value+=it;break}case O.EOF:{this._err(Z.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:{this._leaveAttrValue(),this.state=j.BEFORE_ATTRIBUTE_NAME;break}case O.AMPERSAND:{this._startCharacterReference();break}case O.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=j.DATA,this.emitCurrentTagToken();break}case O.NULL:{this._err(Z.unexpectedNullCharacter),this.currentAttr.value+=it;break}case O.QUOTATION_MARK:case O.APOSTROPHE:case O.LESS_THAN_SIGN:case O.EQUALS_SIGN:case O.GRAVE_ACCENT:{this._err(Z.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break}case O.EOF:{this._err(Z.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:{this._leaveAttrValue(),this.state=j.BEFORE_ATTRIBUTE_NAME;break}case O.SOLIDUS:{this._leaveAttrValue(),this.state=j.SELF_CLOSING_START_TAG;break}case O.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=j.DATA,this.emitCurrentTagToken();break}case O.EOF:{this._err(Z.eofInTag),this._emitEOFToken();break}default:this._err(Z.missingWhitespaceBetweenAttributes),this.state=j.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case O.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=j.DATA,this.emitCurrentTagToken();break}case O.EOF:{this._err(Z.eofInTag),this._emitEOFToken();break}default:this._err(Z.unexpectedSolidusInTag),this.state=j.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){const n=this.currentToken;switch(t){case O.GREATER_THAN_SIGN:{this.state=j.DATA,this.emitCurrentComment(n);break}case O.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case O.NULL:{this._err(Z.unexpectedNullCharacter),n.data+=it;break}default:n.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(Nt.DASH_DASH,!0)?(this._createCommentToken(Nt.DASH_DASH.length+1),this.state=j.COMMENT_START):this._consumeSequenceIfMatch(Nt.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(Nt.DOCTYPE.length+1),this.state=j.DOCTYPE):this._consumeSequenceIfMatch(Nt.CDATA_START,!0)?this.inForeignNode?this.state=j.CDATA_SECTION:(this._err(Z.cdataInHtmlContent),this._createCommentToken(Nt.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=j.BOGUS_COMMENT):this._ensureHibernation()||(this._err(Z.incorrectlyOpenedComment),this._createCommentToken(2),this.state=j.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case O.HYPHEN_MINUS:{this.state=j.COMMENT_START_DASH;break}case O.GREATER_THAN_SIGN:{this._err(Z.abruptClosingOfEmptyComment),this.state=j.DATA;const n=this.currentToken;this.emitCurrentComment(n);break}default:this.state=j.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){const n=this.currentToken;switch(t){case O.HYPHEN_MINUS:{this.state=j.COMMENT_END;break}case O.GREATER_THAN_SIGN:{this._err(Z.abruptClosingOfEmptyComment),this.state=j.DATA,this.emitCurrentComment(n);break}case O.EOF:{this._err(Z.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=j.COMMENT,this._stateComment(t)}}_stateComment(t){const n=this.currentToken;switch(t){case O.HYPHEN_MINUS:{this.state=j.COMMENT_END_DASH;break}case O.LESS_THAN_SIGN:{n.data+="<",this.state=j.COMMENT_LESS_THAN_SIGN;break}case O.NULL:{this._err(Z.unexpectedNullCharacter),n.data+=it;break}case O.EOF:{this._err(Z.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){const n=this.currentToken;switch(t){case O.EXCLAMATION_MARK:{n.data+="!",this.state=j.COMMENT_LESS_THAN_SIGN_BANG;break}case O.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=j.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===O.HYPHEN_MINUS?this.state=j.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=j.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===O.HYPHEN_MINUS?this.state=j.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=j.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==O.GREATER_THAN_SIGN&&t!==O.EOF&&this._err(Z.nestedComment),this.state=j.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){const n=this.currentToken;switch(t){case O.HYPHEN_MINUS:{this.state=j.COMMENT_END;break}case O.EOF:{this._err(Z.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=j.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){const n=this.currentToken;switch(t){case O.GREATER_THAN_SIGN:{this.state=j.DATA,this.emitCurrentComment(n);break}case O.EXCLAMATION_MARK:{this.state=j.COMMENT_END_BANG;break}case O.HYPHEN_MINUS:{n.data+="-";break}case O.EOF:{this._err(Z.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--",this.state=j.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){const n=this.currentToken;switch(t){case O.HYPHEN_MINUS:{n.data+="--!",this.state=j.COMMENT_END_DASH;break}case O.GREATER_THAN_SIGN:{this._err(Z.incorrectlyClosedComment),this.state=j.DATA,this.emitCurrentComment(n);break}case O.EOF:{this._err(Z.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=j.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:{this.state=j.BEFORE_DOCTYPE_NAME;break}case O.GREATER_THAN_SIGN:{this.state=j.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break}case O.EOF:{this._err(Z.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Z.missingWhitespaceBeforeDoctypeName),this.state=j.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(ai(t))this._createDoctypeToken(String.fromCharCode(bs(t))),this.state=j.DOCTYPE_NAME;else switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:break;case O.NULL:{this._err(Z.unexpectedNullCharacter),this._createDoctypeToken(it),this.state=j.DOCTYPE_NAME;break}case O.GREATER_THAN_SIGN:{this._err(Z.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=j.DATA;break}case O.EOF:{this._err(Z.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=j.DOCTYPE_NAME}}_stateDoctypeName(t){const n=this.currentToken;switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:{this.state=j.AFTER_DOCTYPE_NAME;break}case O.GREATER_THAN_SIGN:{this.state=j.DATA,this.emitCurrentDoctype(n);break}case O.NULL:{this._err(Z.unexpectedNullCharacter),n.name+=it;break}case O.EOF:{this._err(Z.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(ai(t)?bs(t):t)}}_stateAfterDoctypeName(t){const n=this.currentToken;switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:break;case O.GREATER_THAN_SIGN:{this.state=j.DATA,this.emitCurrentDoctype(n);break}case O.EOF:{this._err(Z.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(Nt.PUBLIC,!1)?this.state=j.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(Nt.SYSTEM,!1)?this.state=j.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(Z.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=j.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){const n=this.currentToken;switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:{this.state=j.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case O.QUOTATION_MARK:{this._err(Z.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=j.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case O.APOSTROPHE:{this._err(Z.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=j.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case O.GREATER_THAN_SIGN:{this._err(Z.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=j.DATA,this.emitCurrentDoctype(n);break}case O.EOF:{this._err(Z.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Z.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=j.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:break;case O.QUOTATION_MARK:{n.publicId="",this.state=j.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case O.APOSTROPHE:{n.publicId="",this.state=j.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case O.GREATER_THAN_SIGN:{this._err(Z.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=j.DATA,this.emitCurrentDoctype(n);break}case O.EOF:{this._err(Z.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Z.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=j.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case O.QUOTATION_MARK:{this.state=j.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case O.NULL:{this._err(Z.unexpectedNullCharacter),n.publicId+=it;break}case O.GREATER_THAN_SIGN:{this._err(Z.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=j.DATA;break}case O.EOF:{this._err(Z.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case O.APOSTROPHE:{this.state=j.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case O.NULL:{this._err(Z.unexpectedNullCharacter),n.publicId+=it;break}case O.GREATER_THAN_SIGN:{this._err(Z.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=j.DATA;break}case O.EOF:{this._err(Z.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:{this.state=j.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case O.GREATER_THAN_SIGN:{this.state=j.DATA,this.emitCurrentDoctype(n);break}case O.QUOTATION_MARK:{this._err(Z.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=j.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case O.APOSTROPHE:{this._err(Z.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=j.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case O.EOF:{this._err(Z.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Z.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=j.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){const n=this.currentToken;switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:break;case O.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=j.DATA;break}case O.QUOTATION_MARK:{n.systemId="",this.state=j.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case O.APOSTROPHE:{n.systemId="",this.state=j.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case O.EOF:{this._err(Z.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Z.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=j.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){const n=this.currentToken;switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:{this.state=j.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case O.QUOTATION_MARK:{this._err(Z.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=j.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case O.APOSTROPHE:{this._err(Z.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=j.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case O.GREATER_THAN_SIGN:{this._err(Z.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=j.DATA,this.emitCurrentDoctype(n);break}case O.EOF:{this._err(Z.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Z.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=j.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:break;case O.QUOTATION_MARK:{n.systemId="",this.state=j.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case O.APOSTROPHE:{n.systemId="",this.state=j.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case O.GREATER_THAN_SIGN:{this._err(Z.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=j.DATA,this.emitCurrentDoctype(n);break}case O.EOF:{this._err(Z.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Z.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=j.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case O.QUOTATION_MARK:{this.state=j.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case O.NULL:{this._err(Z.unexpectedNullCharacter),n.systemId+=it;break}case O.GREATER_THAN_SIGN:{this._err(Z.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=j.DATA;break}case O.EOF:{this._err(Z.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case O.APOSTROPHE:{this.state=j.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case O.NULL:{this._err(Z.unexpectedNullCharacter),n.systemId+=it;break}case O.GREATER_THAN_SIGN:{this._err(Z.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=j.DATA;break}case O.EOF:{this._err(Z.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case O.SPACE:case O.LINE_FEED:case O.TABULATION:case O.FORM_FEED:break;case O.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=j.DATA;break}case O.EOF:{this._err(Z.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Z.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=j.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){const n=this.currentToken;switch(t){case O.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=j.DATA;break}case O.NULL:{this._err(Z.unexpectedNullCharacter);break}case O.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(t){switch(t){case O.RIGHT_SQUARE_BRACKET:{this.state=j.CDATA_SECTION_BRACKET;break}case O.EOF:{this._err(Z.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===O.RIGHT_SQUARE_BRACKET?this.state=j.CDATA_SECTION_END:(this._emitChars("]"),this.state=j.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case O.GREATER_THAN_SIGN:{this.state=j.DATA;break}case O.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=j.CDATA_SECTION,this._stateCdataSection(t)}}_stateCharacterReference(){let t=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(t<0)if(this.preprocessor.lastChunkWritten)t=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}t===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(O.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&Od(this.preprocessor.peek(1))?j.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){Od(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===O.SEMICOLON&&this._err(Z.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}}const t0=new Set([x.DD,x.DT,x.LI,x.OPTGROUP,x.OPTION,x.P,x.RB,x.RP,x.RT,x.RTC]),Fd=new Set([...t0,x.CAPTION,x.COLGROUP,x.TBODY,x.TD,x.TFOOT,x.TH,x.THEAD,x.TR]),Xs=new Set([x.APPLET,x.CAPTION,x.HTML,x.MARQUEE,x.OBJECT,x.TABLE,x.TD,x.TEMPLATE,x.TH]),fA=new Set([...Xs,x.OL,x.UL]),mA=new Set([...Xs,x.BUTTON]),jd=new Set([x.ANNOTATION_XML,x.MI,x.MN,x.MO,x.MS,x.MTEXT]),Hd=new Set([x.DESC,x.FOREIGN_OBJECT,x.TITLE]),pA=new Set([x.TR,x.TEMPLATE,x.HTML]),gA=new Set([x.TBODY,x.TFOOT,x.THEAD,x.TEMPLATE,x.HTML]),bA=new Set([x.TABLE,x.TEMPLATE,x.HTML]),xA=new Set([x.TD,x.TH]);class yA{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,n,r){this.treeAdapter=n,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=x.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===x.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===ae.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,n){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=n,this.currentTagId=n,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,n,!0)}pop(){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){const s=this._indexOf(t)+1;this.items.splice(s,0,n),this.tagIDs.splice(s,0,r),this.stackTop++,s===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,s===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==ae.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop<t)}}popUntilElementPopped(t){const n=this._indexOf(t);this.shortenToLength(Math.max(n,0))}popUntilPopped(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(Math.max(r,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(cl,ae.HTML)}popUntilTableCellPopped(){this.popUntilPopped(xA,ae.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,n){for(let r=this.stackTop;r>=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(bA,ae.HTML)}clearBackToTableBodyContext(){this.clearBackTo(gA,ae.HTML)}clearBackToTableRowContext(){this.clearBackTo(pA,ae.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===x.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===x.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const s=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case ae.HTML:{if(s===t)return!0;if(n.has(s))return!1;break}case ae.SVG:{if(Hd.has(s))return!1;break}case ae.MATHML:{if(jd.has(s))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,Xs)}hasInListItemScope(t){return this.hasInDynamicScope(t,fA)}hasInButtonScope(t){return this.hasInDynamicScope(t,mA)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case ae.HTML:{if(cl.has(n))return!0;if(Xs.has(n))return!1;break}case ae.SVG:{if(Hd.has(n))return!1;break}case ae.MATHML:{if(jd.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ae.HTML)switch(this.tagIDs[n]){case t:return!0;case x.TABLE:case x.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===ae.HTML)switch(this.tagIDs[t]){case x.TBODY:case x.THEAD:case x.TFOOT:return!0;case x.TABLE:case x.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ae.HTML)switch(this.tagIDs[n]){case t:return!0;case x.OPTION:case x.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&t0.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Fd.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&Fd.has(this.currentTagId);)this.pop()}}const bo=3;var ln;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(ln||(ln={}));const Ud={type:ln.Marker};class EA{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],s=n.length,i=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let o=0;o<this.entries.length;o++){const l=this.entries[o];if(l.type===ln.Marker)break;const{element:u}=l;if(this.treeAdapter.getTagName(u)===i&&this.treeAdapter.getNamespaceURI(u)===a){const c=this.treeAdapter.getAttrList(u);c.length===s&&r.push({idx:o,attrs:c})}}return r}_ensureNoahArkCondition(t){if(this.entries.length<bo)return;const n=this.treeAdapter.getAttrList(t),r=this._getNoahArkConditionCandidates(t,n);if(r.length<bo)return;const s=new Map(n.map(a=>[a.name,a.value]));let i=0;for(let a=0;a<r.length;a++){const o=r[a];o.attrs.every(l=>s.get(l.name)===l.value)&&(i+=1,i>=bo&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(Ud)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:ln.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:ln.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(Ud);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===ln.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===ln.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===ln.Element&&n.element===t)}}const Sn={createDocument(){return{nodeName:"#document",mode:Vt.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){const s=e.childNodes.find(i=>i.nodeName==="#documentType");if(s)s.name=t,s.publicId=n,s.systemId=r;else{const i={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};Sn.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(Sn.isTextNode(n)){n.value+=t;return}}Sn.appendChild(e,Sn.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&Sn.isTextNode(r)?r.value+=t:Sn.insertBefore(e,Sn.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName==="#text"},isCommentNode(e){return e.nodeName==="#comment"},isDocumentTypeNode(e){return e.nodeName==="#documentType"},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,"tagName")},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},n0="html",vA="about:legacy-compat",TA="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",r0=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],kA=[...r0,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],wA=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),i0=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],SA=[...i0,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function zd(e,t){return t.some(n=>e.startsWith(n))}function AA(e){return e.name===n0&&e.publicId===null&&(e.systemId===null||e.systemId===vA)}function CA(e){if(e.name!==n0)return Vt.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===TA)return Vt.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),wA.has(n))return Vt.QUIRKS;let r=t===null?kA:r0;if(zd(n,r))return Vt.QUIRKS;if(r=t===null?i0:SA,zd(n,r))return Vt.LIMITED_QUIRKS}return Vt.NO_QUIRKS}const Vd={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},_A="definitionurl",NA="definitionURL",IA=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),RA=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:ae.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:ae.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:ae.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:ae.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:ae.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:ae.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:ae.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:ae.XML}],["xml:space",{prefix:"xml",name:"space",namespace:ae.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:ae.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:ae.XMLNS}]]),PA=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),MA=new Set([x.B,x.BIG,x.BLOCKQUOTE,x.BODY,x.BR,x.CENTER,x.CODE,x.DD,x.DIV,x.DL,x.DT,x.EM,x.EMBED,x.H1,x.H2,x.H3,x.H4,x.H5,x.H6,x.HEAD,x.HR,x.I,x.IMG,x.LI,x.LISTING,x.MENU,x.META,x.NOBR,x.OL,x.P,x.PRE,x.RUBY,x.S,x.SMALL,x.SPAN,x.STRONG,x.STRIKE,x.SUB,x.SUP,x.TABLE,x.TT,x.U,x.UL,x.VAR]);function LA(e){const t=e.tagID;return t===x.FONT&&e.attrs.some(({name:r})=>r===ir.COLOR||r===ir.SIZE||r===ir.FACE)||MA.has(t)}function s0(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===_A){e.attrs[t].name=NA;break}}function a0(e){for(let t=0;t<e.attrs.length;t++){const n=IA.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function Eu(e){for(let t=0;t<e.attrs.length;t++){const n=RA.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function DA(e){const t=PA.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=Ur(e.tagName))}function OA(e,t){return t===ae.MATHML&&(e===x.MI||e===x.MO||e===x.MN||e===x.MS||e===x.MTEXT)}function BA(e,t,n){if(t===ae.MATHML&&e===x.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===ir.ENCODING){const s=n[r].value.toLowerCase();return s===Vd.TEXT_HTML||s===Vd.APPLICATION_XML}}return t===ae.SVG&&(e===x.FOREIGN_OBJECT||e===x.DESC||e===x.TITLE)}function FA(e,t,n,r){return(!r||r===ae.HTML)&&BA(e,t,n)||(!r||r===ae.MATHML)&&OA(e,t)}const jA="hidden",HA=8,UA=3;var U;(function(e){e[e.INITIAL=0]="INITIAL",e[e.BEFORE_HTML=1]="BEFORE_HTML",e[e.BEFORE_HEAD=2]="BEFORE_HEAD",e[e.IN_HEAD=3]="IN_HEAD",e[e.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",e[e.AFTER_HEAD=5]="AFTER_HEAD",e[e.IN_BODY=6]="IN_BODY",e[e.TEXT=7]="TEXT",e[e.IN_TABLE=8]="IN_TABLE",e[e.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",e[e.IN_CAPTION=10]="IN_CAPTION",e[e.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",e[e.IN_TABLE_BODY=12]="IN_TABLE_BODY",e[e.IN_ROW=13]="IN_ROW",e[e.IN_CELL=14]="IN_CELL",e[e.IN_SELECT=15]="IN_SELECT",e[e.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",e[e.IN_TEMPLATE=17]="IN_TEMPLATE",e[e.AFTER_BODY=18]="AFTER_BODY",e[e.IN_FRAMESET=19]="IN_FRAMESET",e[e.AFTER_FRAMESET=20]="AFTER_FRAMESET",e[e.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",e[e.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(U||(U={}));const zA={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},o0=new Set([x.TABLE,x.TBODY,x.TFOOT,x.THEAD,x.TR]),qd={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:Sn,onParseError:null};class Wd{constructor(t,n,r=null,s=null){this.fragmentContext=r,this.scriptHandler=s,this.currentToken=null,this.stopped=!1,this.insertionMode=U.INITIAL,this.originalInsertionMode=U.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...qd,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=n??this.treeAdapter.createDocument(),this.tokenizer=new hA(this.options,this),this.activeFormattingElements=new EA(this.treeAdapter),this.fragmentContextID=r?Ur(this.treeAdapter.getTagName(r)):x.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new yA(this.document,this.treeAdapter,this)}static parse(t,n){const r=new this(n);return r.tokenizer.write(t,!0),r.document}static getFragmentParser(t,n){const r={...qd,...n};t??(t=r.treeAdapter.createElement($.TEMPLATE,ae.HTML,[]));const s=r.treeAdapter.createElement("documentmock",ae.HTML,[]),i=new this(r,s,t);return i.fragmentContextID===x.TEMPLATE&&i.tmplInsertionModeStack.unshift(U.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){const t=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,n),n}_err(t,n,r){var s;if(!this.onParseError)return;const i=(s=t.location)!==null&&s!==void 0?s:zA,a={code:n,startLine:i.startLine,startCol:i.startCol,startOffset:i.startOffset,endLine:r?i.startLine:i.endLine,endCol:r?i.startCol:i.endCol,endOffset:r?i.startOffset:i.endOffset};this.onParseError(a)}onItemPush(t,n,r){var s,i;(i=(s=this.treeAdapter).onItemPush)===null||i===void 0||i.call(s,t),r&&this.openElements.stackTop>0&&this._setContextModes(t,n)}onItemPop(t,n){var r,s;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(s=(r=this.treeAdapter).onItemPop)===null||s===void 0||s.call(r,t,this.openElements.current),n){let i,a;this.openElements.stackTop===0&&this.fragmentContext?(i=this.fragmentContext,a=this.fragmentContextID):{current:i,currentTagId:a}=this.openElements,this._setContextModes(i,a)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===ae.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,ae.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=U.TEXT}switchToPlaintextParsing(){this.insertionMode=U.TEXT,this.originalInsertionMode=U.IN_BODY,this.tokenizer.state=ut.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===$.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==ae.HTML))switch(this.fragmentContextID){case x.TITLE:case x.TEXTAREA:{this.tokenizer.state=ut.RCDATA;break}case x.STYLE:case x.XMP:case x.IFRAME:case x.NOEMBED:case x.NOFRAMES:case x.NOSCRIPT:{this.tokenizer.state=ut.RAWTEXT;break}case x.SCRIPT:{this.tokenizer.state=ut.SCRIPT_DATA;break}case x.PLAINTEXT:{this.tokenizer.state=ut.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",s=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,s),t.location){const a=this.treeAdapter.getChildNodes(this.document).find(o=>this.treeAdapter.isDocumentTypeNode(o));a&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){const r=this.treeAdapter.createElement(t,ae.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,ae.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement($.HTML,ae.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,x.HTML)}_appendCommentNode(t,n){const r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const s=this.treeAdapter.getChildNodes(n),i=r?s.lastIndexOf(r):s.length,a=s[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:l,endCol:u,endOffset:c}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:l,endCol:u,endOffset:c})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const r=n.location,s=this.treeAdapter.getTagName(t),i=n.type===He.END_TAG&&s===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,i)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===x.SVG&&this.treeAdapter.getTagName(n)===$.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===ae.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===x.MGLYPH||t.tagID===x.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,ae.HTML)}_processToken(t){switch(t.type){case He.CHARACTER:{this.onCharacter(t);break}case He.NULL_CHARACTER:{this.onNullCharacter(t);break}case He.COMMENT:{this.onComment(t);break}case He.DOCTYPE:{this.onDoctype(t);break}case He.START_TAG:{this._processStartTag(t);break}case He.END_TAG:{this.onEndTag(t);break}case He.EOF:{this.onEof(t);break}case He.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const s=this.treeAdapter.getNamespaceURI(n),i=this.treeAdapter.getAttrList(n);return FA(t,s,i,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(s=>s.type===ln.Marker||this.openElements.contains(s.element)),r=n===-1?t-1:n-1;for(let s=r;s>=0;s--){const i=this.activeFormattingElements.entries[s];this._insertElement(i.token,this.treeAdapter.getNamespaceURI(i.element)),i.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=U.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(x.P),this.openElements.popUntilTagNamePopped(x.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case x.TR:{this.insertionMode=U.IN_ROW;return}case x.TBODY:case x.THEAD:case x.TFOOT:{this.insertionMode=U.IN_TABLE_BODY;return}case x.CAPTION:{this.insertionMode=U.IN_CAPTION;return}case x.COLGROUP:{this.insertionMode=U.IN_COLUMN_GROUP;return}case x.TABLE:{this.insertionMode=U.IN_TABLE;return}case x.BODY:{this.insertionMode=U.IN_BODY;return}case x.FRAMESET:{this.insertionMode=U.IN_FRAMESET;return}case x.SELECT:{this._resetInsertionModeForSelect(t);return}case x.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case x.HTML:{this.insertionMode=this.headElement?U.AFTER_HEAD:U.BEFORE_HEAD;return}case x.TD:case x.TH:{if(t>0){this.insertionMode=U.IN_CELL;return}break}case x.HEAD:{if(t>0){this.insertionMode=U.IN_HEAD;return}break}}this.insertionMode=U.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===x.TEMPLATE)break;if(r===x.TABLE){this.insertionMode=U.IN_SELECT_IN_TABLE;return}}this.insertionMode=U.IN_SELECT}_isElementCausesFosterParenting(t){return o0.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case x.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===ae.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case x.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const r=this.treeAdapter.getNamespaceURI(t);return lA[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){x3(this,t);return}switch(this.insertionMode){case U.INITIAL:{Jr(this,t);break}case U.BEFORE_HTML:{fi(this,t);break}case U.BEFORE_HEAD:{mi(this,t);break}case U.IN_HEAD:{pi(this,t);break}case U.IN_HEAD_NO_SCRIPT:{gi(this,t);break}case U.AFTER_HEAD:{bi(this,t);break}case U.IN_BODY:case U.IN_CAPTION:case U.IN_CELL:case U.IN_TEMPLATE:{u0(this,t);break}case U.TEXT:case U.IN_SELECT:case U.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case U.IN_TABLE:case U.IN_TABLE_BODY:case U.IN_ROW:{xo(this,t);break}case U.IN_TABLE_TEXT:{p0(this,t);break}case U.IN_COLUMN_GROUP:{Qs(this,t);break}case U.AFTER_BODY:{Zs(this,t);break}case U.AFTER_AFTER_BODY:{Rs(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){b3(this,t);return}switch(this.insertionMode){case U.INITIAL:{Jr(this,t);break}case U.BEFORE_HTML:{fi(this,t);break}case U.BEFORE_HEAD:{mi(this,t);break}case U.IN_HEAD:{pi(this,t);break}case U.IN_HEAD_NO_SCRIPT:{gi(this,t);break}case U.AFTER_HEAD:{bi(this,t);break}case U.TEXT:{this._insertCharacters(t);break}case U.IN_TABLE:case U.IN_TABLE_BODY:case U.IN_ROW:{xo(this,t);break}case U.IN_COLUMN_GROUP:{Qs(this,t);break}case U.AFTER_BODY:{Zs(this,t);break}case U.AFTER_AFTER_BODY:{Rs(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){dl(this,t);return}switch(this.insertionMode){case U.INITIAL:case U.BEFORE_HTML:case U.BEFORE_HEAD:case U.IN_HEAD:case U.IN_HEAD_NO_SCRIPT:case U.AFTER_HEAD:case U.IN_BODY:case U.IN_TABLE:case U.IN_CAPTION:case U.IN_COLUMN_GROUP:case U.IN_TABLE_BODY:case U.IN_ROW:case U.IN_CELL:case U.IN_SELECT:case U.IN_SELECT_IN_TABLE:case U.IN_TEMPLATE:case U.IN_FRAMESET:case U.AFTER_FRAMESET:{dl(this,t);break}case U.IN_TABLE_TEXT:{ei(this,t);break}case U.AFTER_BODY:{KA(this,t);break}case U.AFTER_AFTER_BODY:case U.AFTER_AFTER_FRAMESET:{XA(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case U.INITIAL:{QA(this,t);break}case U.BEFORE_HEAD:case U.IN_HEAD:case U.IN_HEAD_NO_SCRIPT:case U.AFTER_HEAD:{this._err(t,Z.misplacedDoctype);break}case U.IN_TABLE_TEXT:{ei(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,Z.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?y3(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case U.INITIAL:{Jr(this,t);break}case U.BEFORE_HTML:{ZA(this,t);break}case U.BEFORE_HEAD:{eC(this,t);break}case U.IN_HEAD:{rn(this,t);break}case U.IN_HEAD_NO_SCRIPT:{rC(this,t);break}case U.AFTER_HEAD:{sC(this,t);break}case U.IN_BODY:{kt(this,t);break}case U.IN_TABLE:{Dr(this,t);break}case U.IN_TABLE_TEXT:{ei(this,t);break}case U.IN_CAPTION:{t3(this,t);break}case U.IN_COLUMN_GROUP:{ku(this,t);break}case U.IN_TABLE_BODY:{Ca(this,t);break}case U.IN_ROW:{_a(this,t);break}case U.IN_CELL:{i3(this,t);break}case U.IN_SELECT:{x0(this,t);break}case U.IN_SELECT_IN_TABLE:{a3(this,t);break}case U.IN_TEMPLATE:{l3(this,t);break}case U.AFTER_BODY:{c3(this,t);break}case U.IN_FRAMESET:{d3(this,t);break}case U.AFTER_FRAMESET:{f3(this,t);break}case U.AFTER_AFTER_BODY:{p3(this,t);break}case U.AFTER_AFTER_FRAMESET:{g3(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?E3(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case U.INITIAL:{Jr(this,t);break}case U.BEFORE_HTML:{JA(this,t);break}case U.BEFORE_HEAD:{tC(this,t);break}case U.IN_HEAD:{nC(this,t);break}case U.IN_HEAD_NO_SCRIPT:{iC(this,t);break}case U.AFTER_HEAD:{aC(this,t);break}case U.IN_BODY:{Aa(this,t);break}case U.TEXT:{WC(this,t);break}case U.IN_TABLE:{Ri(this,t);break}case U.IN_TABLE_TEXT:{ei(this,t);break}case U.IN_CAPTION:{n3(this,t);break}case U.IN_COLUMN_GROUP:{r3(this,t);break}case U.IN_TABLE_BODY:{hl(this,t);break}case U.IN_ROW:{b0(this,t);break}case U.IN_CELL:{s3(this,t);break}case U.IN_SELECT:{y0(this,t);break}case U.IN_SELECT_IN_TABLE:{o3(this,t);break}case U.IN_TEMPLATE:{u3(this,t);break}case U.AFTER_BODY:{v0(this,t);break}case U.IN_FRAMESET:{h3(this,t);break}case U.AFTER_FRAMESET:{m3(this,t);break}case U.AFTER_AFTER_BODY:{Rs(this,t);break}}}onEof(t){switch(this.insertionMode){case U.INITIAL:{Jr(this,t);break}case U.BEFORE_HTML:{fi(this,t);break}case U.BEFORE_HEAD:{mi(this,t);break}case U.IN_HEAD:{pi(this,t);break}case U.IN_HEAD_NO_SCRIPT:{gi(this,t);break}case U.AFTER_HEAD:{bi(this,t);break}case U.IN_BODY:case U.IN_TABLE:case U.IN_CAPTION:case U.IN_COLUMN_GROUP:case U.IN_TABLE_BODY:case U.IN_ROW:case U.IN_CELL:case U.IN_SELECT:case U.IN_SELECT_IN_TABLE:{f0(this,t);break}case U.TEXT:{$C(this,t);break}case U.IN_TABLE_TEXT:{ei(this,t);break}case U.IN_TEMPLATE:{E0(this,t);break}case U.AFTER_BODY:case U.IN_FRAMESET:case U.AFTER_FRAMESET:case U.AFTER_AFTER_BODY:case U.AFTER_AFTER_FRAMESET:{Tu(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===O.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case U.IN_HEAD:case U.IN_HEAD_NO_SCRIPT:case U.AFTER_HEAD:case U.TEXT:case U.IN_COLUMN_GROUP:case U.IN_SELECT:case U.IN_SELECT_IN_TABLE:case U.IN_FRAMESET:case U.AFTER_FRAMESET:{this._insertCharacters(t);break}case U.IN_BODY:case U.IN_CAPTION:case U.IN_CELL:case U.IN_TEMPLATE:case U.AFTER_BODY:case U.AFTER_AFTER_BODY:case U.AFTER_AFTER_FRAMESET:{l0(this,t);break}case U.IN_TABLE:case U.IN_TABLE_BODY:case U.IN_ROW:{xo(this,t);break}case U.IN_TABLE_TEXT:{m0(this,t);break}}}}function VA(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):h0(e,t),n}function qA(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const s=e.openElements.items[r];if(s===t.element)break;e._isSpecialElement(s,e.openElements.tagIDs[r])&&(n=s)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function WA(e,t,n){let r=t,s=e.openElements.getCommonAncestor(t);for(let i=0,a=s;a!==n;i++,a=s){s=e.openElements.getCommonAncestor(a);const o=e.activeFormattingElements.getElementEntry(a),l=o&&i>=UA;!o||l?(l&&e.activeFormattingElements.removeEntry(o),e.openElements.remove(a)):(a=$A(e,o),r===t&&(e.activeFormattingElements.bookmark=o),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(a,r),r=a)}return r}function $A(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function YA(e,t,n){const r=e.treeAdapter.getTagName(t),s=Ur(r);if(e._isElementCausesFosterParenting(s))e._fosterParentElement(n);else{const i=e.treeAdapter.getNamespaceURI(t);s===x.TEMPLATE&&i===ae.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function GA(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:s}=n,i=e.treeAdapter.createElement(s.tagName,r,s.attrs);e._adoptNodes(t,i),e.treeAdapter.appendChild(t,i),e.activeFormattingElements.insertElementAfterBookmark(i,s),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,i,s.tagID)}function vu(e,t){for(let n=0;n<HA;n++){const r=VA(e,t);if(!r)break;const s=qA(e,r);if(!s)break;e.activeFormattingElements.bookmark=r;const i=WA(e,s,r.element),a=e.openElements.getCommonAncestor(r.element);e.treeAdapter.detachNode(i),a&&YA(e,a,i),GA(e,s,r)}}function dl(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function KA(e,t){e._appendCommentNode(t,e.openElements.items[0])}function XA(e,t){e._appendCommentNode(t,e.document)}function Tu(e,t){if(e.stopped=!0,t.location){const n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const r=e.openElements.items[0],s=e.treeAdapter.getNodeSourceCodeLocation(r);if(s&&!s.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const i=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(i);a&&!a.endTag&&e._setEndLocation(i,t)}}}}function QA(e,t){e._setDocumentType(t);const n=t.forceQuirks?Vt.QUIRKS:CA(t);AA(t)||e._err(t,Z.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=U.BEFORE_HTML}function Jr(e,t){e._err(t,Z.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Vt.QUIRKS),e.insertionMode=U.BEFORE_HTML,e._processToken(t)}function ZA(e,t){t.tagID===x.HTML?(e._insertElement(t,ae.HTML),e.insertionMode=U.BEFORE_HEAD):fi(e,t)}function JA(e,t){const n=t.tagID;(n===x.HTML||n===x.HEAD||n===x.BODY||n===x.BR)&&fi(e,t)}function fi(e,t){e._insertFakeRootElement(),e.insertionMode=U.BEFORE_HEAD,e._processToken(t)}function eC(e,t){switch(t.tagID){case x.HTML:{kt(e,t);break}case x.HEAD:{e._insertElement(t,ae.HTML),e.headElement=e.openElements.current,e.insertionMode=U.IN_HEAD;break}default:mi(e,t)}}function tC(e,t){const n=t.tagID;n===x.HEAD||n===x.BODY||n===x.HTML||n===x.BR?mi(e,t):e._err(t,Z.endTagWithoutMatchingOpenElement)}function mi(e,t){e._insertFakeElement($.HEAD,x.HEAD),e.headElement=e.openElements.current,e.insertionMode=U.IN_HEAD,e._processToken(t)}function rn(e,t){switch(t.tagID){case x.HTML:{kt(e,t);break}case x.BASE:case x.BASEFONT:case x.BGSOUND:case x.LINK:case x.META:{e._appendElement(t,ae.HTML),t.ackSelfClosing=!0;break}case x.TITLE:{e._switchToTextParsing(t,ut.RCDATA);break}case x.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,ut.RAWTEXT):(e._insertElement(t,ae.HTML),e.insertionMode=U.IN_HEAD_NO_SCRIPT);break}case x.NOFRAMES:case x.STYLE:{e._switchToTextParsing(t,ut.RAWTEXT);break}case x.SCRIPT:{e._switchToTextParsing(t,ut.SCRIPT_DATA);break}case x.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=U.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(U.IN_TEMPLATE);break}case x.HEAD:{e._err(t,Z.misplacedStartTagForHeadElement);break}default:pi(e,t)}}function nC(e,t){switch(t.tagID){case x.HEAD:{e.openElements.pop(),e.insertionMode=U.AFTER_HEAD;break}case x.BODY:case x.BR:case x.HTML:{pi(e,t);break}case x.TEMPLATE:{fr(e,t);break}default:e._err(t,Z.endTagWithoutMatchingOpenElement)}}function fr(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==x.TEMPLATE&&e._err(t,Z.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(x.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,Z.endTagWithoutMatchingOpenElement)}function pi(e,t){e.openElements.pop(),e.insertionMode=U.AFTER_HEAD,e._processToken(t)}function rC(e,t){switch(t.tagID){case x.HTML:{kt(e,t);break}case x.BASEFONT:case x.BGSOUND:case x.HEAD:case x.LINK:case x.META:case x.NOFRAMES:case x.STYLE:{rn(e,t);break}case x.NOSCRIPT:{e._err(t,Z.nestedNoscriptInHead);break}default:gi(e,t)}}function iC(e,t){switch(t.tagID){case x.NOSCRIPT:{e.openElements.pop(),e.insertionMode=U.IN_HEAD;break}case x.BR:{gi(e,t);break}default:e._err(t,Z.endTagWithoutMatchingOpenElement)}}function gi(e,t){const n=t.type===He.EOF?Z.openElementsLeftAfterEof:Z.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=U.IN_HEAD,e._processToken(t)}function sC(e,t){switch(t.tagID){case x.HTML:{kt(e,t);break}case x.BODY:{e._insertElement(t,ae.HTML),e.framesetOk=!1,e.insertionMode=U.IN_BODY;break}case x.FRAMESET:{e._insertElement(t,ae.HTML),e.insertionMode=U.IN_FRAMESET;break}case x.BASE:case x.BASEFONT:case x.BGSOUND:case x.LINK:case x.META:case x.NOFRAMES:case x.SCRIPT:case x.STYLE:case x.TEMPLATE:case x.TITLE:{e._err(t,Z.abandonedHeadElementChild),e.openElements.push(e.headElement,x.HEAD),rn(e,t),e.openElements.remove(e.headElement);break}case x.HEAD:{e._err(t,Z.misplacedStartTagForHeadElement);break}default:bi(e,t)}}function aC(e,t){switch(t.tagID){case x.BODY:case x.HTML:case x.BR:{bi(e,t);break}case x.TEMPLATE:{fr(e,t);break}default:e._err(t,Z.endTagWithoutMatchingOpenElement)}}function bi(e,t){e._insertFakeElement($.BODY,x.BODY),e.insertionMode=U.IN_BODY,Sa(e,t)}function Sa(e,t){switch(t.type){case He.CHARACTER:{u0(e,t);break}case He.WHITESPACE_CHARACTER:{l0(e,t);break}case He.COMMENT:{dl(e,t);break}case He.START_TAG:{kt(e,t);break}case He.END_TAG:{Aa(e,t);break}case He.EOF:{f0(e,t);break}}}function l0(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function u0(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function oC(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function lC(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function uC(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,ae.HTML),e.insertionMode=U.IN_FRAMESET)}function cC(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,ae.HTML)}function dC(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&cl.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,ae.HTML)}function hC(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,ae.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function fC(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,ae.HTML),n||(e.formElement=e.openElements.current))}function mC(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const s=e.openElements.tagIDs[r];if(n===x.LI&&s===x.LI||(n===x.DD||n===x.DT)&&(s===x.DD||s===x.DT)){e.openElements.generateImpliedEndTagsWithExclusion(s),e.openElements.popUntilTagNamePopped(s);break}if(s!==x.ADDRESS&&s!==x.DIV&&s!==x.P&&e._isSpecialElement(e.openElements.items[r],s))break}e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,ae.HTML)}function pC(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,ae.HTML),e.tokenizer.state=ut.PLAINTEXT}function gC(e,t){e.openElements.hasInScope(x.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(x.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,ae.HTML),e.framesetOk=!1}function bC(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName($.A);n&&(vu(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,ae.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function xC(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ae.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function yC(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(x.NOBR)&&(vu(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,ae.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function EC(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ae.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function vC(e,t){e.treeAdapter.getDocumentMode(e.document)!==Vt.QUIRKS&&e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,ae.HTML),e.framesetOk=!1,e.insertionMode=U.IN_TABLE}function c0(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ae.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function d0(e){const t=Jp(e,ir.TYPE);return t!=null&&t.toLowerCase()===jA}function TC(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ae.HTML),d0(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function kC(e,t){e._appendElement(t,ae.HTML),t.ackSelfClosing=!0}function wC(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._appendElement(t,ae.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function SC(e,t){t.tagName=$.IMG,t.tagID=x.IMG,c0(e,t)}function AC(e,t){e._insertElement(t,ae.HTML),e.skipNextNewLine=!0,e.tokenizer.state=ut.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=U.TEXT}function CC(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,ut.RAWTEXT)}function _C(e,t){e.framesetOk=!1,e._switchToTextParsing(t,ut.RAWTEXT)}function $d(e,t){e._switchToTextParsing(t,ut.RAWTEXT)}function NC(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ae.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===U.IN_TABLE||e.insertionMode===U.IN_CAPTION||e.insertionMode===U.IN_TABLE_BODY||e.insertionMode===U.IN_ROW||e.insertionMode===U.IN_CELL?U.IN_SELECT_IN_TABLE:U.IN_SELECT}function IC(e,t){e.openElements.currentTagId===x.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,ae.HTML)}function RC(e,t){e.openElements.hasInScope(x.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,ae.HTML)}function PC(e,t){e.openElements.hasInScope(x.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(x.RTC),e._insertElement(t,ae.HTML)}function MC(e,t){e._reconstructActiveFormattingElements(),s0(t),Eu(t),t.selfClosing?e._appendElement(t,ae.MATHML):e._insertElement(t,ae.MATHML),t.ackSelfClosing=!0}function LC(e,t){e._reconstructActiveFormattingElements(),a0(t),Eu(t),t.selfClosing?e._appendElement(t,ae.SVG):e._insertElement(t,ae.SVG),t.ackSelfClosing=!0}function Yd(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ae.HTML)}function kt(e,t){switch(t.tagID){case x.I:case x.S:case x.B:case x.U:case x.EM:case x.TT:case x.BIG:case x.CODE:case x.FONT:case x.SMALL:case x.STRIKE:case x.STRONG:{xC(e,t);break}case x.A:{bC(e,t);break}case x.H1:case x.H2:case x.H3:case x.H4:case x.H5:case x.H6:{dC(e,t);break}case x.P:case x.DL:case x.OL:case x.UL:case x.DIV:case x.DIR:case x.NAV:case x.MAIN:case x.MENU:case x.ASIDE:case x.CENTER:case x.FIGURE:case x.FOOTER:case x.HEADER:case x.HGROUP:case x.DIALOG:case x.DETAILS:case x.ADDRESS:case x.ARTICLE:case x.SEARCH:case x.SECTION:case x.SUMMARY:case x.FIELDSET:case x.BLOCKQUOTE:case x.FIGCAPTION:{cC(e,t);break}case x.LI:case x.DD:case x.DT:{mC(e,t);break}case x.BR:case x.IMG:case x.WBR:case x.AREA:case x.EMBED:case x.KEYGEN:{c0(e,t);break}case x.HR:{wC(e,t);break}case x.RB:case x.RTC:{RC(e,t);break}case x.RT:case x.RP:{PC(e,t);break}case x.PRE:case x.LISTING:{hC(e,t);break}case x.XMP:{CC(e,t);break}case x.SVG:{LC(e,t);break}case x.HTML:{oC(e,t);break}case x.BASE:case x.LINK:case x.META:case x.STYLE:case x.TITLE:case x.SCRIPT:case x.BGSOUND:case x.BASEFONT:case x.TEMPLATE:{rn(e,t);break}case x.BODY:{lC(e,t);break}case x.FORM:{fC(e,t);break}case x.NOBR:{yC(e,t);break}case x.MATH:{MC(e,t);break}case x.TABLE:{vC(e,t);break}case x.INPUT:{TC(e,t);break}case x.PARAM:case x.TRACK:case x.SOURCE:{kC(e,t);break}case x.IMAGE:{SC(e,t);break}case x.BUTTON:{gC(e,t);break}case x.APPLET:case x.OBJECT:case x.MARQUEE:{EC(e,t);break}case x.IFRAME:{_C(e,t);break}case x.SELECT:{NC(e,t);break}case x.OPTION:case x.OPTGROUP:{IC(e,t);break}case x.NOEMBED:case x.NOFRAMES:{$d(e,t);break}case x.FRAMESET:{uC(e,t);break}case x.TEXTAREA:{AC(e,t);break}case x.NOSCRIPT:{e.options.scriptingEnabled?$d(e,t):Yd(e,t);break}case x.PLAINTEXT:{pC(e,t);break}case x.COL:case x.TH:case x.TD:case x.TR:case x.HEAD:case x.FRAME:case x.TBODY:case x.TFOOT:case x.THEAD:case x.CAPTION:case x.COLGROUP:break;default:Yd(e,t)}}function DC(e,t){if(e.openElements.hasInScope(x.BODY)&&(e.insertionMode=U.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function OC(e,t){e.openElements.hasInScope(x.BODY)&&(e.insertionMode=U.AFTER_BODY,v0(e,t))}function BC(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function FC(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(x.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(x.FORM):n&&e.openElements.remove(n))}function jC(e){e.openElements.hasInButtonScope(x.P)||e._insertFakeElement($.P,x.P),e._closePElement()}function HC(e){e.openElements.hasInListItemScope(x.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(x.LI),e.openElements.popUntilTagNamePopped(x.LI))}function UC(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function zC(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function VC(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function qC(e){e._reconstructActiveFormattingElements(),e._insertFakeElement($.BR,x.BR),e.openElements.pop(),e.framesetOk=!1}function h0(e,t){const n=t.tagName,r=t.tagID;for(let s=e.openElements.stackTop;s>0;s--){const i=e.openElements.items[s],a=e.openElements.tagIDs[s];if(r===a&&(r!==x.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=s&&e.openElements.shortenToLength(s);break}if(e._isSpecialElement(i,a))break}}function Aa(e,t){switch(t.tagID){case x.A:case x.B:case x.I:case x.S:case x.U:case x.EM:case x.TT:case x.BIG:case x.CODE:case x.FONT:case x.NOBR:case x.SMALL:case x.STRIKE:case x.STRONG:{vu(e,t);break}case x.P:{jC(e);break}case x.DL:case x.UL:case x.OL:case x.DIR:case x.DIV:case x.NAV:case x.PRE:case x.MAIN:case x.MENU:case x.ASIDE:case x.BUTTON:case x.CENTER:case x.FIGURE:case x.FOOTER:case x.HEADER:case x.HGROUP:case x.DIALOG:case x.ADDRESS:case x.ARTICLE:case x.DETAILS:case x.SEARCH:case x.SECTION:case x.SUMMARY:case x.LISTING:case x.FIELDSET:case x.BLOCKQUOTE:case x.FIGCAPTION:{BC(e,t);break}case x.LI:{HC(e);break}case x.DD:case x.DT:{UC(e,t);break}case x.H1:case x.H2:case x.H3:case x.H4:case x.H5:case x.H6:{zC(e);break}case x.BR:{qC(e);break}case x.BODY:{DC(e,t);break}case x.HTML:{OC(e,t);break}case x.FORM:{FC(e);break}case x.APPLET:case x.OBJECT:case x.MARQUEE:{VC(e,t);break}case x.TEMPLATE:{fr(e,t);break}default:h0(e,t)}}function f0(e,t){e.tmplInsertionModeStack.length>0?E0(e,t):Tu(e,t)}function WC(e,t){var n;t.tagID===x.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function $C(e,t){e._err(t,Z.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function xo(e,t){if(e.openElements.currentTagId!==void 0&&o0.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=U.IN_TABLE_TEXT,t.type){case He.CHARACTER:{p0(e,t);break}case He.WHITESPACE_CHARACTER:{m0(e,t);break}}else Vi(e,t)}function YC(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,ae.HTML),e.insertionMode=U.IN_CAPTION}function GC(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ae.HTML),e.insertionMode=U.IN_COLUMN_GROUP}function KC(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement($.COLGROUP,x.COLGROUP),e.insertionMode=U.IN_COLUMN_GROUP,ku(e,t)}function XC(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ae.HTML),e.insertionMode=U.IN_TABLE_BODY}function QC(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement($.TBODY,x.TBODY),e.insertionMode=U.IN_TABLE_BODY,Ca(e,t)}function ZC(e,t){e.openElements.hasInTableScope(x.TABLE)&&(e.openElements.popUntilTagNamePopped(x.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function JC(e,t){d0(t)?e._appendElement(t,ae.HTML):Vi(e,t),t.ackSelfClosing=!0}function e3(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,ae.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Dr(e,t){switch(t.tagID){case x.TD:case x.TH:case x.TR:{QC(e,t);break}case x.STYLE:case x.SCRIPT:case x.TEMPLATE:{rn(e,t);break}case x.COL:{KC(e,t);break}case x.FORM:{e3(e,t);break}case x.TABLE:{ZC(e,t);break}case x.TBODY:case x.TFOOT:case x.THEAD:{XC(e,t);break}case x.INPUT:{JC(e,t);break}case x.CAPTION:{YC(e,t);break}case x.COLGROUP:{GC(e,t);break}default:Vi(e,t)}}function Ri(e,t){switch(t.tagID){case x.TABLE:{e.openElements.hasInTableScope(x.TABLE)&&(e.openElements.popUntilTagNamePopped(x.TABLE),e._resetInsertionMode());break}case x.TEMPLATE:{fr(e,t);break}case x.BODY:case x.CAPTION:case x.COL:case x.COLGROUP:case x.HTML:case x.TBODY:case x.TD:case x.TFOOT:case x.TH:case x.THEAD:case x.TR:break;default:Vi(e,t)}}function Vi(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,Sa(e,t),e.fosterParentingEnabled=n}function m0(e,t){e.pendingCharacterTokens.push(t)}function p0(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function ei(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)Vi(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}const g0=new Set([x.CAPTION,x.COL,x.COLGROUP,x.TBODY,x.TD,x.TFOOT,x.TH,x.THEAD,x.TR]);function t3(e,t){const n=t.tagID;g0.has(n)?e.openElements.hasInTableScope(x.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(x.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=U.IN_TABLE,Dr(e,t)):kt(e,t)}function n3(e,t){const n=t.tagID;switch(n){case x.CAPTION:case x.TABLE:{e.openElements.hasInTableScope(x.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(x.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=U.IN_TABLE,n===x.TABLE&&Ri(e,t));break}case x.BODY:case x.COL:case x.COLGROUP:case x.HTML:case x.TBODY:case x.TD:case x.TFOOT:case x.TH:case x.THEAD:case x.TR:break;default:Aa(e,t)}}function ku(e,t){switch(t.tagID){case x.HTML:{kt(e,t);break}case x.COL:{e._appendElement(t,ae.HTML),t.ackSelfClosing=!0;break}case x.TEMPLATE:{rn(e,t);break}default:Qs(e,t)}}function r3(e,t){switch(t.tagID){case x.COLGROUP:{e.openElements.currentTagId===x.COLGROUP&&(e.openElements.pop(),e.insertionMode=U.IN_TABLE);break}case x.TEMPLATE:{fr(e,t);break}case x.COL:break;default:Qs(e,t)}}function Qs(e,t){e.openElements.currentTagId===x.COLGROUP&&(e.openElements.pop(),e.insertionMode=U.IN_TABLE,e._processToken(t))}function Ca(e,t){switch(t.tagID){case x.TR:{e.openElements.clearBackToTableBodyContext(),e._insertElement(t,ae.HTML),e.insertionMode=U.IN_ROW;break}case x.TH:case x.TD:{e.openElements.clearBackToTableBodyContext(),e._insertFakeElement($.TR,x.TR),e.insertionMode=U.IN_ROW,_a(e,t);break}case x.CAPTION:case x.COL:case x.COLGROUP:case x.TBODY:case x.TFOOT:case x.THEAD:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=U.IN_TABLE,Dr(e,t));break}default:Dr(e,t)}}function hl(e,t){const n=t.tagID;switch(t.tagID){case x.TBODY:case x.TFOOT:case x.THEAD:{e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=U.IN_TABLE);break}case x.TABLE:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=U.IN_TABLE,Ri(e,t));break}case x.BODY:case x.CAPTION:case x.COL:case x.COLGROUP:case x.HTML:case x.TD:case x.TH:case x.TR:break;default:Ri(e,t)}}function _a(e,t){switch(t.tagID){case x.TH:case x.TD:{e.openElements.clearBackToTableRowContext(),e._insertElement(t,ae.HTML),e.insertionMode=U.IN_CELL,e.activeFormattingElements.insertMarker();break}case x.CAPTION:case x.COL:case x.COLGROUP:case x.TBODY:case x.TFOOT:case x.THEAD:case x.TR:{e.openElements.hasInTableScope(x.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=U.IN_TABLE_BODY,Ca(e,t));break}default:Dr(e,t)}}function b0(e,t){switch(t.tagID){case x.TR:{e.openElements.hasInTableScope(x.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=U.IN_TABLE_BODY);break}case x.TABLE:{e.openElements.hasInTableScope(x.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=U.IN_TABLE_BODY,hl(e,t));break}case x.TBODY:case x.TFOOT:case x.THEAD:{(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(x.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=U.IN_TABLE_BODY,hl(e,t));break}case x.BODY:case x.CAPTION:case x.COL:case x.COLGROUP:case x.HTML:case x.TD:case x.TH:break;default:Ri(e,t)}}function i3(e,t){const n=t.tagID;g0.has(n)?(e.openElements.hasInTableScope(x.TD)||e.openElements.hasInTableScope(x.TH))&&(e._closeTableCell(),_a(e,t)):kt(e,t)}function s3(e,t){const n=t.tagID;switch(n){case x.TD:case x.TH:{e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=U.IN_ROW);break}case x.TABLE:case x.TBODY:case x.TFOOT:case x.THEAD:case x.TR:{e.openElements.hasInTableScope(n)&&(e._closeTableCell(),b0(e,t));break}case x.BODY:case x.CAPTION:case x.COL:case x.COLGROUP:case x.HTML:break;default:Aa(e,t)}}function x0(e,t){switch(t.tagID){case x.HTML:{kt(e,t);break}case x.OPTION:{e.openElements.currentTagId===x.OPTION&&e.openElements.pop(),e._insertElement(t,ae.HTML);break}case x.OPTGROUP:{e.openElements.currentTagId===x.OPTION&&e.openElements.pop(),e.openElements.currentTagId===x.OPTGROUP&&e.openElements.pop(),e._insertElement(t,ae.HTML);break}case x.HR:{e.openElements.currentTagId===x.OPTION&&e.openElements.pop(),e.openElements.currentTagId===x.OPTGROUP&&e.openElements.pop(),e._appendElement(t,ae.HTML),t.ackSelfClosing=!0;break}case x.INPUT:case x.KEYGEN:case x.TEXTAREA:case x.SELECT:{e.openElements.hasInSelectScope(x.SELECT)&&(e.openElements.popUntilTagNamePopped(x.SELECT),e._resetInsertionMode(),t.tagID!==x.SELECT&&e._processStartTag(t));break}case x.SCRIPT:case x.TEMPLATE:{rn(e,t);break}}}function y0(e,t){switch(t.tagID){case x.OPTGROUP:{e.openElements.stackTop>0&&e.openElements.currentTagId===x.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===x.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===x.OPTGROUP&&e.openElements.pop();break}case x.OPTION:{e.openElements.currentTagId===x.OPTION&&e.openElements.pop();break}case x.SELECT:{e.openElements.hasInSelectScope(x.SELECT)&&(e.openElements.popUntilTagNamePopped(x.SELECT),e._resetInsertionMode());break}case x.TEMPLATE:{fr(e,t);break}}}function a3(e,t){const n=t.tagID;n===x.CAPTION||n===x.TABLE||n===x.TBODY||n===x.TFOOT||n===x.THEAD||n===x.TR||n===x.TD||n===x.TH?(e.openElements.popUntilTagNamePopped(x.SELECT),e._resetInsertionMode(),e._processStartTag(t)):x0(e,t)}function o3(e,t){const n=t.tagID;n===x.CAPTION||n===x.TABLE||n===x.TBODY||n===x.TFOOT||n===x.THEAD||n===x.TR||n===x.TD||n===x.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(x.SELECT),e._resetInsertionMode(),e.onEndTag(t)):y0(e,t)}function l3(e,t){switch(t.tagID){case x.BASE:case x.BASEFONT:case x.BGSOUND:case x.LINK:case x.META:case x.NOFRAMES:case x.SCRIPT:case x.STYLE:case x.TEMPLATE:case x.TITLE:{rn(e,t);break}case x.CAPTION:case x.COLGROUP:case x.TBODY:case x.TFOOT:case x.THEAD:{e.tmplInsertionModeStack[0]=U.IN_TABLE,e.insertionMode=U.IN_TABLE,Dr(e,t);break}case x.COL:{e.tmplInsertionModeStack[0]=U.IN_COLUMN_GROUP,e.insertionMode=U.IN_COLUMN_GROUP,ku(e,t);break}case x.TR:{e.tmplInsertionModeStack[0]=U.IN_TABLE_BODY,e.insertionMode=U.IN_TABLE_BODY,Ca(e,t);break}case x.TD:case x.TH:{e.tmplInsertionModeStack[0]=U.IN_ROW,e.insertionMode=U.IN_ROW,_a(e,t);break}default:e.tmplInsertionModeStack[0]=U.IN_BODY,e.insertionMode=U.IN_BODY,kt(e,t)}}function u3(e,t){t.tagID===x.TEMPLATE&&fr(e,t)}function E0(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(x.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Tu(e,t)}function c3(e,t){t.tagID===x.HTML?kt(e,t):Zs(e,t)}function v0(e,t){var n;if(t.tagID===x.HTML){if(e.fragmentContext||(e.insertionMode=U.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===x.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else Zs(e,t)}function Zs(e,t){e.insertionMode=U.IN_BODY,Sa(e,t)}function d3(e,t){switch(t.tagID){case x.HTML:{kt(e,t);break}case x.FRAMESET:{e._insertElement(t,ae.HTML);break}case x.FRAME:{e._appendElement(t,ae.HTML),t.ackSelfClosing=!0;break}case x.NOFRAMES:{rn(e,t);break}}}function h3(e,t){t.tagID===x.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==x.FRAMESET&&(e.insertionMode=U.AFTER_FRAMESET))}function f3(e,t){switch(t.tagID){case x.HTML:{kt(e,t);break}case x.NOFRAMES:{rn(e,t);break}}}function m3(e,t){t.tagID===x.HTML&&(e.insertionMode=U.AFTER_AFTER_FRAMESET)}function p3(e,t){t.tagID===x.HTML?kt(e,t):Rs(e,t)}function Rs(e,t){e.insertionMode=U.IN_BODY,Sa(e,t)}function g3(e,t){switch(t.tagID){case x.HTML:{kt(e,t);break}case x.NOFRAMES:{rn(e,t);break}}}function b3(e,t){t.chars=it,e._insertCharacters(t)}function x3(e,t){e._insertCharacters(t),e.framesetOk=!1}function T0(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==ae.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function y3(e,t){if(LA(t))T0(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===ae.MATHML?s0(t):r===ae.SVG&&(DA(t),a0(t)),Eu(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function E3(e,t){if(t.tagID===x.P||t.tagID===x.BR){T0(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===ae.HTML){e._endTagOutsideForeignContent(t);break}const s=e.treeAdapter.getTagName(r);if(s.toLowerCase()===t.tagName){t.tagName=s,e.openElements.shortenToLength(n);break}}}$.AREA,$.BASE,$.BASEFONT,$.BGSOUND,$.BR,$.COL,$.EMBED,$.FRAME,$.HR,$.IMG,$.INPUT,$.KEYGEN,$.LINK,$.META,$.PARAM,$.SOURCE,$.TRACK,$.WBR;const v3=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,T3=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),Gd={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function k0(e,t){const n=P3(e),r=Sp("type",{handlers:{root:k3,element:w3,text:S3,comment:S0,doctype:A3,raw:_3},unknown:N3}),s={parser:n?new Wd(Gd):Wd.getFragmentParser(void 0,Gd),handle(o){r(o,s)},stitches:!1,options:t||{}};r(e,s),zr(s,fn());const i=n?s.parser.document:s.parser.getFragment(),a=MS(i,{file:s.options.file});return s.stitches&&wa(a,"comment",function(o,l,u){const c=o;if(c.value.stitch&&u&&l!==void 0){const h=u.children;return h[l]=c.value.stitch,l}}),a.type==="root"&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function w0(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function k3(e,t){w0(e.children,t)}function w3(e,t){I3(e,t),w0(e.children,t),R3(e,t)}function S3(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);const n={type:He.CHARACTER,chars:e.value,location:qi(e)};zr(t,fn(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function A3(e,t){const n={type:He.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:qi(e)};zr(t,fn(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function C3(e,t){t.stitches=!0;const n=M3(e);if("children"in e&&"children"in n){const r=k0({type:"root",children:e.children},t.options);n.children=r.children}S0({type:"comment",value:{stitch:n}},t)}function S0(e,t){const n=e.value,r={type:He.COMMENT,data:n,location:qi(e)};zr(t,fn(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function _3(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,A0(t,fn(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(v3,"&lt;$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function N3(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))C3(n,t);else{let r="";throw T3.has(n.type)&&(r=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+r)}}function zr(e,t){A0(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=ut.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function A0(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function I3(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===ut.PLAINTEXT)return;zr(t,fn(e));const r=t.parser.openElements.current;let s="namespaceURI"in r?r.namespaceURI:Zn.html;s===Zn.html&&n==="svg"&&(s=Zn.svg);const i=FS({...e,children:[]},{space:s===Zn.svg?"svg":"html"}),a={type:He.START_TAG,tagName:n,tagID:Ur(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in i?i.attrs:[],location:qi(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function R3(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&$S.includes(n)||t.parser.tokenizer.state===ut.PLAINTEXT)return;zr(t,xa(e));const r={type:He.END_TAG,tagName:n,tagID:Ur(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:qi(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===ut.RCDATA||t.parser.tokenizer.state===ut.RAWTEXT||t.parser.tokenizer.state===ut.SCRIPT_DATA)&&(t.parser.tokenizer.state=ut.DATA)}function P3(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function qi(e){const t=fn(e)||{line:void 0,column:void 0,offset:void 0},n=xa(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function M3(e){return"children"in e?cr({...e,children:[]}):cr(e)}function C0(e){return function(t,n){return k0(t,{...e,file:n})}}const $n=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],xi={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...$n,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...$n],h2:[["className","sr-only"]],img:[...$n,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...$n,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...$n],table:[...$n],ul:[...$n,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},Cn={}.hasOwnProperty;function L3(e,t){let n={type:"root",children:[]};const r={schema:t?{...xi,...t}:xi,stack:[]},s=_0(r,e);return s&&(Array.isArray(s)?s.length===1?n=s[0]:n.children=s:n=s),n}function _0(e,t){if(t&&typeof t=="object"){const n=t;switch(typeof n.type=="string"?n.type:""){case"comment":return D3(e,n);case"doctype":return O3(e,n);case"element":return B3(e,n);case"root":return F3(e,n);case"text":return j3(e,n)}}}function D3(e,t){if(e.schema.allowComments){const n=typeof t.value=="string"?t.value:"",r=n.indexOf("-->"),i={type:"comment",value:r<0?n:n.slice(0,r)};return Wi(i,t),i}}function O3(e,t){if(e.schema.allowDoctypes){const n={type:"doctype"};return Wi(n,t),n}}function B3(e,t){const n=typeof t.tagName=="string"?t.tagName:"";e.stack.push(n);const r=N0(e,t.children),s=H3(e,t.properties);e.stack.pop();let i=!1;if(n&&n!=="*"&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(i=!0,e.schema.ancestors&&Cn.call(e.schema.ancestors,n))){const o=e.schema.ancestors[n];let l=-1;for(i=!1;++l<o.length;)e.stack.includes(o[l])&&(i=!0)}if(!i)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;const a={type:"element",tagName:n,properties:s,children:r};return Wi(a,t),a}function F3(e,t){const r={type:"root",children:N0(e,t.children)};return Wi(r,t),r}function j3(e,t){const r={type:"text",value:typeof t.value=="string"?t.value:""};return Wi(r,t),r}function N0(e,t){const n=[];if(Array.isArray(t)){const r=t;let s=-1;for(;++s<r.length;){const i=_0(e,r[s]);i&&(Array.isArray(i)?n.push(...i):n.push(i))}}return n}function H3(e,t){const n=e.stack[e.stack.length-1],r=e.schema.attributes,s=e.schema.required,i=r&&Cn.call(r,n)?r[n]:void 0,a=r&&Cn.call(r,"*")?r["*"]:void 0,o=t&&typeof t=="object"?t:{},l={};let u;for(u in o)if(Cn.call(o,u)){const c=o[u];let h=Kd(e,Xd(i,u),u,c);h==null&&(h=Kd(e,Xd(a,u),u,c)),h!=null&&(l[u]=h)}if(s&&Cn.call(s,n)){const c=s[n];for(u in c)Cn.call(c,u)&&!Cn.call(l,u)&&(l[u]=c[u])}return l}function Kd(e,t,n,r){return t?Array.isArray(r)?U3(e,t,n,r):I0(e,t,n,r):void 0}function U3(e,t,n,r){let s=-1;const i=[];for(;++s<r.length;){const a=I0(e,t,n,r[s]);(typeof a=="number"||typeof a=="string")&&i.push(a)}return i}function I0(e,t,n,r){if(!(typeof r!="boolean"&&typeof r!="number"&&typeof r!="string")&&z3(e,n,r)){if(typeof t=="object"&&t.length>1){let s=!1,i=0;for(;++i<t.length;){const a=t[i];if(a&&typeof a=="object"&&"flags"in a){if(a.test(String(r))){s=!0;break}}else if(a===r){s=!0;break}}if(!s)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function z3(e,t,n){const r=e.schema.protocols&&Cn.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;const s=String(n),i=s.indexOf(":"),a=s.indexOf("?"),o=s.indexOf("#"),l=s.indexOf("/");if(i<0||l>-1&&i>l||a>-1&&i>a||o>-1&&i>o)return!0;let u=-1;for(;++u<r.length;){const c=r[u];if(i===c.length&&s.slice(0,c.length)===c)return!0}return!1}function Wi(e,t){const n=$m(t);t.data&&(e.data=cr(t.data)),n&&(e.position=n)}function Xd(e,t){let n,r=-1;if(e)for(;++r<e.length;){const s=e[r],i=typeof s=="string"?s:s[0];if(i===t)return s;i==="data*"&&(n=s)}if(t.length>4&&t.slice(0,4).toLowerCase()==="data")return n}function R0(e){return function(t){return L3(t,e)}}var nm;const P0={...xi,protocols:{...xi.protocols,src:[...((nm=xi.protocols)==null?void 0:nm.src)??["http","https","mailto"],"data"]}},V3={remarkPlugins:[Wp],rehypePlugins:[C0,[R0,P0]]};let oi=null,Qd=null;function q3(){return oi?Promise.resolve(oi):(Qd??(Qd=Promise.all([Ae(()=>import("./index-DKUjXJrj.js"),__vite__mapDeps([3,1,2]),import.meta.url),Ae(()=>import("./index-CLC7uJBc.js"),__vite__mapDeps([4,1,2]),import.meta.url)]).then(([{default:e},{default:t}])=>(oi={remarkPlugins:[Wp,e],rehypePlugins:[C0,[R0,P0],t]},oi))),Qd)}function W3(e){return e.includes("$")||e.includes("\\(")||e.includes("\\[")}function M0(e){const[t,n]=v.useState(oi),r=W3(e??"");return v.useEffect(()=>{if(!r||t)return;let s=!0;return q3().then(i=>{s&&n(i)}),()=>{s=!1}},[r,t]),t??V3}function $3({retry:e}){const t=Ye();return p.jsxs("div",{className:"text-body text-warning p-4 flex items-start gap-2",children:[p.jsx(eu,{className:"w-4 h-4 shrink-0 mt-0.5"}),p.jsxs("span",{children:[t("error.renderFailed")," ",p.jsx("button",{className:"underline ml-1",onClick:e,children:t("error.retry")})]})]})}class Y3 extends v.Component{constructor(){super(...arguments);ja(this,"state",{error:null});ja(this,"retry",()=>this.setState({error:null}))}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,r){console.error("[ErrorBoundary caught]",n,r.componentStack)}render(){return this.state.error?this.props.fallback?this.props.fallback(this.state.error,this.retry):p.jsx($3,{error:this.state.error,retry:this.retry}):this.props.children}}const sr=new Set(["。","!","?","!","?",";",";","…"]),G3=new Set([",",",","、",":",":"," "," "]),K3=/[\u{1F000}-\u{1FAFF}\u{2600}-\u{27BF}\u{2B00}-\u{2BFF}]/u;function Js(e){return e!=null&&K3.test(String.fromCodePoint(e))}const X3=/(?:[\u{1F000}-\u{1FAFF}\u{2600}-\u{27BF}\u{2B00}-\u{2BFF}](?:\uFE0F|\u200D[\u{1F000}-\u{1FAFF}\u{2600}-\u{27BF}\u{2B00}-\u{2BFF}]|[\u{1F3FB}-\u{1F3FF}])*)$/u,_r=new Set(["”",'"',"」","』","》",")","】","])".slice(0,1)]);function Q3(e){let t=e;return t=t.replace(/\r\n?/g,`
516
+ `),t=t.replace(/(?:^|\n)[ \t]*(?:```|~~~)[^\n]*\n[\s\S]*?(?:\n[ \t]*(?:```|~~~)[^\n]*|\n?$)/g,`
517
+ `),t=t.replace(/`[^`\n]*`/g,""),t=t.replace(/!\[[^\]]*\]\([^)\n]*\)/g,""),t=t.replace(/\[([^\]]+)\]\([^)\n]*\)/g,"$1"),t=t.replace(/^[ \t]{0,3}#{1,6}[ \t]+/gm,""),t=t.replace(/^[ \t]*(?:[-*+]|\d+\.)[ \t]+/gm,""),t=t.replace(/^[ \t]*>[ \t]?/gm,""),t=t.replace(/\|/g," "),t=t.replace(/^[ \t]*[-: ]{3,}[ \t]*$/gm,""),t=t.replace(/(\*\*|__)(.*?)\1/g,"$2"),t=t.replace(new RegExp("(?<![*\\w])(\\*|_)(?!\\s)(.+?)(?<!\\s)\\1(?![*\\w])","g"),"$2"),t=t.replace(/~~(.+?)~~/g,"$1"),t=t.replace(/\n{3,}/g,`
518
+
519
+ `),t.trim()}function Z3(e){return J3(Q3(e),{flush:!0}).sentences}function L0(e,t){if(t<0||t>=e.length)return"";let n=t;for(;n>0&&!D0(e[n-1]??"");)n--;const r=[];for(let s=n;s<=t;s++){const i=e[s];i&&i.trim()&&r.push(i)}return r.join(" ")}function J3(e,t={}){const n=Math.max(8,t.maxBuffer??120),r=t.flush??!1,s=[],i=e.length;let a=0,o=0,l=-1;const u=h=>{const f=e.slice(a,h).trim();f&&s.push(f),a=h,l=-1};for(;o<i;){const h=e[o],f=e.codePointAt(o);if(Js(f)){let d=o+(f>65535?2:1);for(;d<i;){const m=e.codePointAt(d),b=m>65535?2:1;if(m===65039||m===8205||m>=127995&&m<=127999||Js(m)){d+=b;continue}break}u(d),o=d;continue}if(h===`
520
+ `){const d=e.slice(a,o+1).replace(/[^\S\n]+$/,"");d.trim()&&s.push(d),a=o+1,l=-1,o++;continue}if(sr.has(h)){let d=o+1;for(;d<i&&(sr.has(e[d])||_r.has(e[d]));)d++;u(d),o=d;continue}if(h==="."){const d=o>0?e[o-1]:"",m=o+1<i?e[o+1]:"";if((m===""||/\s/.test(m))&&!/\d/.test(d)){let b=o+1;for(;b<i&&(_r.has(e[b])||sr.has(e[b]));)b++;u(b),o=b;continue}}if(G3.has(h)&&(l=o),o-a+1>n)if(l>a){const d=l;u(d),a=d+1}else{u(o+1),o++;continue}o++}const c=e.slice(a).trim();return r&&c&&s.push(c),{sentences:s,rest:r?"":c}}function D0(e){if(/\n\s*$/.test(e))return!0;const t=e.trimEnd();if(!t)return!0;let n=t.length-1;for(;n>=0&&_r.has(t[n]);)n--;if(n<0)return!0;const r=t[n];return sr.has(r)||r==="."||r===`
521
+ `?!0:X3.test(t)}function e_(e,t,n,r=400){const s=e.length,i=o=>{if(o<0||o>=s)return-1;const l=e[o];if(l===`
522
+ `)return o+1;if(sr.has(l)){let c=o+1;for(;c<s&&(sr.has(e[c])||_r.has(e[c]));)c++;return c}if(l==="."){const c=o>0?e[o-1]:"",h=o+1<s?e[o+1]:"";if((h===""||/\s/.test(h))&&!/\d/.test(c)){let f=o+1;for(;f<s&&(_r.has(e[f])||sr.has(e[f]));)f++;return f}return-1}const u=e.codePointAt(o);if(Js(u)){let c=o+(u>65535?2:1);for(;c<s;){const h=e.codePointAt(c),f=h>65535?2:1;if(h===65039||h===8205||h>=127995&&h<=127999||Js(h)){c+=f;continue}break}return c}return-1};let a=t;{let o=!1;for(let l=Math.min(t,s)-1;l>=0&&t-l<=r;l--){const u=i(l);if(u>=0){o=!0,u<=t&&(a=u);break}}!o&&t<=r&&(a=0)}if(D0(e.slice(0,Math.min(n,s)))){let o=Math.min(n,s);for(;o<s&&_r.has(e[o]);)o++;return{start:a,end:o}}for(let o=n;o<s&&o-n<=r;o++){const l=i(o);if(l>=0)return{start:a,end:l}}return{start:a,end:s}}function dr(e,t,n){const r=[];let s="";const i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(o){const l=o.parentElement;if(!l)return NodeFilter.FILTER_REJECT;const u=l.tagName;return u==="SCRIPT"||u==="STYLE"||l.closest(".katex-html")||l.closest(".katex-mathml")&&!l.closest("annotation")||l.closest("[data-md-diagram]")||!(n!=null&&n.includeMarks)&&l.closest("mark.lookatstudy-underline")||t&&!l.closest(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let a;for(;a=i.nextNode();){const o=a,l=o.textContent??"",u=s.length;s+=l,r.push({node:o,start:u,end:s.length})}return{text:s,nodes:r}}function O0(e,t){const n=Zd(e.startContainer,e.startOffset,t,"start"),r=Zd(e.endContainer,e.endOffset,t,"end");return n==null||r==null||r<=n?null:{start:n,end:r}}function Zd(e,t,n,r){var s,i,a;if(e.nodeType===Node.TEXT_NODE){for(const o of n.nodes)if(o.node===e)return o.start+Math.min(t,((s=o.node.textContent)==null?void 0:s.length)??0);return r==="start"?((i=n.nodes[0])==null?void 0:i.start)??null:((a=n.nodes[n.nodes.length-1])==null?void 0:a.end)??null}if(e instanceof Element){const o=Array.from(e.childNodes);if(r==="end"){for(let u=t;u<o.length;u++){const c=B0(o[u],n);if(c!=null)return c}const l=n.nodes[n.nodes.length-1];return l?l.end:null}else{for(let u=t;u>=0;u--){const c=F0(o[u],n);if(c!=null)return c}const l=n.nodes[0];return l?l.start:null}}return null}function B0(e,t){if(e.nodeType===Node.TEXT_NODE){for(const n of t.nodes)if(n.node===e)return n.start;return null}if(e instanceof Element)for(const n of e.childNodes){const r=B0(n,t);if(r!=null)return r}return null}function F0(e,t){if(e.nodeType===Node.TEXT_NODE){for(const n of t.nodes)if(n.node===e)return n.end;return null}if(e instanceof Element){let n=null;for(const r of e.childNodes){const s=F0(r,t);s!=null&&(n=s)}return n}return null}function Pi(e,t,n){var o,l,u,c;if(n<=t)return null;let r=null,s=0,i=null,a=0;for(const h of e.nodes)if(!r&&t>=h.start&&t<h.end&&(r=h.node,s=t-h.start),!i&&n>h.start&&n<=h.end&&(i=h.node,a=n-h.start),r&&i)break;if(!r&&e.nodes.length>0){const h=e.nodes[e.nodes.length-1];r=h.node,s=((o=h.node.textContent)==null?void 0:o.length)??0}if(!i&&e.nodes.length>0){const h=e.nodes[e.nodes.length-1];i=h.node,a=((l=h.node.textContent)==null?void 0:l.length)??0}if(!r||!i)return null;try{const h=document.createRange();return h.setStart(r,Math.min(s,((u=r.textContent)==null?void 0:u.length)??0)),h.setEnd(i,Math.min(a,((c=i.textContent)==null?void 0:c.length)??0)),h}catch{return null}}function j0(e,t){e.querySelectorAll("mark.lookatstudy-underline").forEach(i=>{const a=i.parentNode;if(a){for(;i.firstChild;)a.insertBefore(i.firstChild,i);a.removeChild(i)}}),e.normalize();const n=new Map;if(t.length===0)return n;const r=dr(e),s=[];for(const i of t){const a=wu(r.text,i.text,i.surrounding);a>=0&&s.push({noteId:i.noteId,start:a,end:a+i.text.length})}s.sort((i,a)=>a.start-i.start);for(const i of s){const a=Pi(r,i.start,i.end);if(!a)continue;const o=n_(a,i.noteId);o&&n.set(i.noteId,o)}return n}const Jd="cp-user-note",eh="cp-user-note-flash";function yi(){return typeof Highlight<"u"&&!!CSS.highlights}const cn=new Map,fl=new WeakMap;function H0(){var t,n;const e=CSS;for(const[r,s]of cn)s.startContainer.isConnected||cn.delete(r);try{cn.size===0?(t=e.highlights)==null||t.delete(Jd):(n=e.highlights)==null||n.set(Jd,new Highlight(...cn.values()))}catch{}}function U0(e,t){const n=new Map,r=fl.get(e);if(r)for(const i of r)cn.delete(i);const s=dr(e);for(const i of t){const a=wu(s.text,i.text,i.surrounding);if(a<0)continue;const o=Pi(s,a,a+i.text.length);o&&(n.set(i.noteId,o),cn.set(i.noteId,o))}return fl.set(e,new Set(n.keys())),H0(),n}function z0(e){const t=cn.get(e)??null;return t&&!t.startContainer.isConnected?(cn.delete(e),H0(),null):t}function th(e){return cn.has(e)?!0:!!document.querySelector(`mark[data-note-id="${CSS.escape(e)}"]`)}let xs=null;function V0(e){var n,r,s;(r=(n=e.startContainer.parentElement)==null?void 0:n.scrollIntoView)==null||r.call(n,{behavior:"smooth",block:"center"});const t=CSS;try{(s=t.highlights)==null||s.set(eh,new Highlight(e)),xs&&clearTimeout(xs),xs=setTimeout(()=>{var i;(i=t.highlights)==null||i.delete(eh),xs=null},1500)}catch{}}function t_(e){const t=fl.get(e);if(!t||t.size===0)return null;let n=null;for(const r of t){const s=cn.get(r);if(!(!s||!s.startContainer.isConnected)){if(!n){n=s;continue}try{s.compareBoundaryPoints(Range.START_TO_START,n)>0&&(n=s)}catch{}}}return n}function wu(e,t,n){if(!t)return-1;let r=e.indexOf(t);if(r<0){const s=t.replace(/\s+/g," ").trim();if(r=e.replace(/\s+/g," ").indexOf(s),r<0)return-1;const a=t.slice(0,Math.min(15,t.length));return e.indexOf(a)}if(n&&n.length>5){const s=e.indexOf(n.slice(0,20));if(s>=0){let i=r,a=Math.abs(r-s),o=r+1;for(;;){const l=e.indexOf(t,o);if(l<0)break;const u=Math.abs(l-s);u<a&&(i=l,a=u),o=l+1}return i}}return r}function n_(e,t){const n="color: inherit; background: transparent; border-bottom: 2px solid rgb(34, 197, 94); padding-bottom: 1px;",r=document.createElement("mark");return r.className="lookatstudy-underline",r.dataset.noteId=t,r.style.cssText=n,q0(e,r)}function q0(e,t){var n;if(e.startContainer===e.endContainer&&e.startContainer.nodeType===Node.TEXT_NODE)try{return e.surroundContents(t),t}catch{}try{const r=[],s=document.createTreeWalker(e.commonAncestorContainer,NodeFilter.SHOW_TEXT,{acceptNode(o){return e.intersectsNode(o)&&(o===e.startContainer||o===e.endContainer||e.intersectsNode(o))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}});let i;for(;i=s.nextNode();)r.push(i);if(r.length===0)return null;let a=null;for(const o of r){let l=o;if(o===e.startContainer&&e.startOffset>0&&(l=o.splitText(e.startOffset)),o===e.endContainer||l===e.endContainer){const c=l===e.endContainer?e.endOffset:e.endOffset-(o===e.startContainer?e.startOffset:0);c<l.textContent.length&&l.splitText(c)}if(!l.textContent)continue;const u=a?t.cloneNode(!1):t;(n=l.parentNode)==null||n.insertBefore(u,l),u.appendChild(l),a||(a=u)}return a}catch{return null}}const W0="cp-reading-mark",$0="cp-reading";function ar(e){var n;const t=CSS;try{(n=t.highlights)==null||n.delete($0)}catch{}Su=null,Au=null,e.querySelectorAll(`.${W0}`).forEach(r=>{const s=r.parentNode;if(s){for(;r.firstChild;)s.insertBefore(r.firstChild,r);s.removeChild(r)}}),e.normalize()}const r_=/[0-9A-Za-z\u00C0-\u024F\u0370-\u03FF\u0400-\u04FF\u4E00-\u9FFF\u3040-\u30FF\uAC00-\uD7AF]/,i_=`「『(([【<《"'“‘`,s_=`。』」))]】>》"'”’!!??…,,、;;::`;function Y0(e){const t=e.codePointAt(0);let n=e;return t>=65281&&t<=65374&&(n=String.fromCharCode(t-65248)),r_.test(n)?n.toLowerCase():null}function a_(e){let t="";const n=[];for(let r=0;r<e.length;r++){const s=Y0(e[r]);s!==null&&(t+=s,n.push(r))}return{canon:t,map:n}}function o_(e,t){if(t<=0)return 0;let n=0,r=e.length;for(;n<r;){const s=n+r>>1;e[s]<t?n=s+1:r=s}return n}function nh(e,t,n){const{canon:r,map:s}=a_(e),i=t.trim().split(/\s+/).map(m=>[...m].map(Y0).filter(Boolean).join("")).filter(m=>m.length>0);if(i.length===0||r.length===0){const m=t.trim();if(!m)return null;const b=e.indexOf(m,Math.max(0,n));return b>=0?{start:b,end:b+m.length}:null}const a=o_(s,Math.max(0,n)),o=i.join("");let l=-1,u=-1;const c=r.indexOf(o,a);if(c>=0)l=c,u=c+o.length-1;else{let m=a;for(const b of i){const g=r.indexOf(b,m);if(g<0)return null;l<0&&(l=g),u=g+b.length-1,m=u+1}if(l<0||u-l+1>o.length*3+40)return null}if(u>=s.length||l<0)return null;let h=s[l],f=s[u]+1;const d=n>0?n:0;for(let m=0;m<3&&h-1>=d&&i_.includes(e[h-1]);m++)h--;for(let m=0;m<4&&f<e.length&&s_.includes(e[f]);m++)f++;return{start:h,end:f}}const ml=new WeakMap;function G0(e){ml.delete(e)}function K0(e,t,n){ar(e);const r=t.trim();if(!r)return null;const s=dr(e,n==null?void 0:n.within,{includeMarks:!0}),i=ml.get(e)??0;let a=nh(s.text,r,i);if(!a&&i>0&&(a=nh(s.text,r,0)),!a)return null;ml.set(e,a.end);const o=Pi(s,a.start,a.end);if(!o)return null;const l=e_(s.text,a.start,a.end);Au=Pi(s,l.start,l.end);const u=CSS;if(typeof Highlight<"u"&&u.highlights)try{return u.highlights.set($0,new Highlight(o)),Su=o,o}catch{}const c=document.createElement("span");return c.className=W0,q0(o,c)?o:null}let Su=null;function l_(){return Su}let Au=null;function u_(){return Au}function X0(e,t){var a,o,l;const n=e.getClientRects(),r=n.length>0&&n[0].height>0?n[0]:(a=e.startContainer.parentElement??e.startContainer)==null?void 0:a.getBoundingClientRect();if(!r||r.height<=0)return;if(!t){(l=(o=e.startContainer.parentElement??e.startContainer)==null?void 0:o.scrollIntoView)==null||l.call(o,{behavior:"smooth",block:"center"});return}const s=t.getBoundingClientRect();if(r.top>=s.top+48&&r.bottom<=s.bottom-48)return;const i=t.scrollTop+(r.top+r.height/2)-(s.top+s.height/2);t.scrollTo({top:Math.max(0,i),behavior:"smooth"})}let on=null,Nr=null,Ps=null;function rh(e){if(!e){on=null,Nr=null,Ps=null;return}if(e instanceof Range)on=e,Nr=e.toString(),Ps=e.startContainer.parentElement;else{const t=document.createRange();t.selectNodeContents(e),on=t,Nr=e.textContent,Ps=e}}function c_(){const e=Ps;if(on&&!on.startContainer.isConnected&&e&&Nr)try{const n=dr(e),r=wu(n.text,Nr);if(r>=0){const s=Pi(n,r,r+Nr.length);s&&(on=s)}}catch{}if(!on||!on.startContainer.isConnected)return null;const t=on.startContainer.parentElement??null;return{range:on,host:(t==null?void 0:t.closest('[data-testid="notebook-panel"], [data-testid="chat-stream"]'))??null,block:(t==null?void 0:t.closest("p, li, h1, h2, h3, h4, h5, h6, blockquote, pre, td, th"))??null}}function Q0(e){e.scrollIntoView({behavior:"smooth",block:"center"}),e.style.transition="background 0.3s, border-bottom-color 0.3s, border-bottom-width 0.3s",e.style.background="rgba(250, 204, 21, 0.35)",e.style.borderBottom="4px solid rgb(34, 197, 94)",setTimeout(()=>{e.style.color="inherit",e.style.background="transparent",e.style.borderBottom="2px solid rgb(34, 197, 94)"},1500)}function Z0(e){const t=[];let n=!1;for(const r of e.split(`
523
+ `)){if(/^[ \t]*(?:```|~~~)/.test(r)){t.push(r),n=!n;continue}t.push(n?r:r.replace(/\\\[|\\\]|\\\(|\\\)/g,s=>s==="\\["||s==="\\]"?"$$":"$"))}return t.join(`
524
+ `)}function J0(e,t,n,r,s){const a=r??e,o=a.top+a.height/2;return!s&&a.right+8+n<=t?{left:a.right+8,top:o,transform:"translate(0, -50%)"}:!s&&e.left-8-n>=0?{left:e.left-8,top:o,transform:"translate(-100%, -50%)"}:{left:Math.min(Math.max(e.left,0),Math.max(0,t-n)),top:a.bottom+8,transform:"translate(0, 0)"}}const ih="lookatstudy-tts-settings-changed";function sh(e){const t=n=>{const r=n.toLowerCase();return r==="zh-cn"||r==="zh_cn"||r==="zh"?0:r.startsWith("zh")?1:2};return[...e].sort((n,r)=>t(n.lang)-t(r.lang)||n.lang.localeCompare(r.lang)||n.name.localeCompare(r.name))}function ah(e,t){if(e.length===0)return null;const n=t==null?void 0:t.trim();if(n){const i=e.find(a=>a.name===n);if(i)return i}const r=sh(e.filter(i=>i.default));return r.length>0&&d_(r[0].lang)?r[0]:sh(e)[0]??null}function d_(e){return e.toLowerCase().startsWith("zh")}function dM(e){return`${e.name} · ${e.lang}`}const h_=[["\\leq","小于等于"],["\\le","小于等于"],["\\geq","大于等于"],["\\ge","大于等于"],["\\neq","不等于"],["\\ne","不等于"],["\\approx","约等于"],["\\equiv","恒等于"],["\\pm","正负"],["\\times","乘以"],["\\cdot","点乘"],["\\div","除以"],["\\to","趋于"],["\\rightarrow","趋于"],["\\Rightarrow","推出"],["\\infty","无穷"],["\\sum","求和"],["\\prod","连乘"],["\\int","积分"],["\\lim","极限"],["\\log","对数"],["\\ln","自然对数"],["\\exp","指数"],["\\in","属于"],["\\subset","包含于"],["\\cup","并"],["\\cap","交"],["\\forall","任意"],["\\exists","存在"],["\\partial","偏导"],["\\nabla","梯度"],["\\angle","角"],["\\degree","度"],["\\cdots","点点点"],["\\ldots","点点点"]],f_={alpha:"阿尔法",beta:"贝塔",gamma:"伽马",delta:"德尔塔",epsilon:"艾普西隆",zeta:"泽塔",eta:"伊塔",theta:"西塔",iota:"约塔",kappa:"卡帕",lambda:"拉姆达",mu:"缪",nu:"纽",xi:"克西",pi:"派",rho:"柔",sigma:"西格马",tau:"陶",phi:"斐",chi:"凯",psi:"普西",omega:"欧米伽"};function m_(e,t){if(e[t]!=="{")return null;let n=0;for(let r=t;r<e.length;r++)if(e[r]==="{")n++;else if(e[r]==="}"&&(n--,n===0))return{body:e.slice(t+1,r),end:r+1};return null}function ti(e,t){const n=m_(e,t);return n||{body:e[t]??"",end:t+1}}function p_(e){let t=e;t=t.replace(/\\(?:left|right|displaystyle|limits)\b/g," "),t=t.replace(/\\[,;!\s]|\\quad|\\qquad|~/g," ");for(let n=0;n<12;n++){let r=t;r=r.replace(/\\[dt]?frac(?![A-Za-z])/g,"\\frac");{let s;for(;(s=r.indexOf("\\frac"))>=0;){const i=ti(r,s+5),a=ti(r,i.end);r=r.slice(0,s)+`${i.body} 分之 ${a.body} `+r.slice(a.end)}}{let s;for(;(s=r.indexOf("\\binom"))>=0;){const i=ti(r,s+6),a=ti(r,i.end);r=r.slice(0,s)+`${i.body} 取 ${a.body} `+r.slice(a.end)}}r=r.replace(/\\sqrt\s*\[( {[^{}]*} |[^\s\\]+)\s*\]\s*/g,(s,i)=>`${i.trim()} 次根号 `);{let s;for(;(s=r.indexOf("\\sqrt"))>=0;){const i=ti(r,s+5);r=r.slice(0,s)+`根号 ${i.body} `+r.slice(i.end)}}if(r=r.replace(/\\(?:mathbf|mathbb|mathrm|mathit|boldsymbol|text|operatorname)\s*/g,s=>s.startsWith("\\text")?"":" "),r===t){t=r;break}t=r}for(let n=0;n<8;n++){const r=t.replace(/(\\frac|[\w)\]}]|\s)\s*\^\s*(\{[^{}]*\}|[^\s])|(\\frac|[\w)\]}]| )\s*_\s*(\{[^{}]*\}|[^\s])/g,(s,i,a,o,l)=>a!==void 0?`${i} 的 ${a.replace(/[{}]/g,"")} 次方`:`${o} 下标 ${l.replace(/[{}]/g,"")}`);if(r===t)break;t=r}for(const[n,r]of h_)t=t.split(n).join(` ${r} `);return t=t.replace(/\\([A-Za-z]+)\b/g,(n,r)=>` ${f_[r]??r} `),t=t.replace(/[{}]/g," "),t.replace(/\s+/g," ").trim()}function g_(e){return e.replace(/\$\$([^$]+)\$\$|\$([^$]+)\$/g,(t,n,r)=>{const s=p_(n??r??"");return s?` ${s} `:""})}const oh=new WeakMap;let eg=null;function yo(e){eg=e}function b_(){return eg}const tg=1024;function ng(e){let t=oh.get(e);return t||(t=e.createAnalyser(),t.fftSize=tg,t.smoothingTimeConstant=.55,oh.set(e,t)),t}function x_(e,t){try{const n=ng(e);t.connect(n),n.connect(e.destination)}catch{try{t.connect(e.destination)}catch{}}}const Ir=1024,lh=512,y_=3500,E_=7500,v_=.3,T_=.16,k_=1400,w_=2800,ys=70,rg=new Float64Array(Ir);for(let e=0;e<Ir;e++)rg[e]=.5*(1-Math.cos(2*Math.PI*e/(Ir-1)));function S_(e,t){const n=e.length;for(let r=1,s=0;r<n;r++){let i=n>>1;for(;s&i;i>>=1)s^=i;if(s|=i,r<s){const a=e[r];e[r]=e[s],e[s]=a;const o=t[r];t[r]=t[s],t[s]=o}}for(let r=2;r<=n;r<<=1){const s=-2*Math.PI/r,i=Math.cos(s),a=Math.sin(s),o=r>>1;for(let l=0;l<n;l+=r){let u=1,c=0;for(let h=0;h<o;h++){const f=e[l+h],d=t[l+h],m=e[l+h+o],b=t[l+h+o],g=m*u-b*c,y=m*c+b*u;e[l+h]=f+g,t[l+h]=d+y,e[l+h+o]=f-g,t[l+h+o]=d-y;const k=u*i-c*a;c=u*a+c*i,u=k}}}}function A_(e,t){const n=e.length;let r=0;const s=new Float64Array(n),i=new Float64Array(n);for(let b=0;b<n;b++){const g=e[b];r+=Math.abs(g),s[b]=g*rg[b]}S_(s,i);const a=n>>1,o=t/n,l=new Float64Array(a);let u=0,c=0,h=0,f=0,d=0,m=0;for(let b=0;b<a;b++){const g=b*o;if(g>=t/2-o)break;const y=Math.hypot(s[b],i[b])/a;l[b]=y,u+=y,g>=y_&&g<E_&&(c+=y),g>=yc.lo&&g<yc.hi?(h+=y,f+=y*g):g>=Ec.lo&&g<Ec.hi&&(d+=y,m+=y*g)}return{level:n>0?Math.min(1,r/n/.22):0,f1:h>0?f/h:400,f2:d>0?m/d:800,hfRatio:u>0?c/u:0}}function C_(e,t){return e.level<=Sb?"closed":e.hfRatio>=v_?"SS":e.hfRatio>=T_&&e.level<.45?"FV":t==="closed"&&e.f2>=k_&&e.f2<=w_?"L":Ab(e.f1,e.f2,e.level)}function __(e,t){const n=[],r=(c,h,f,d)=>{if(h<=0)return;const m=n[n.length-1];if(m&&m.viseme===f&&Math.abs(m.t+m.dur-c)<1e-9){m.dur+=h,m.level=Math.max(m.level,d);return}n.push({t:c,dur:h,viseme:f,level:d})};if(e.length<Ir)return{cues:[{t:0,dur:Math.max(0,e.length/t),viseme:"closed",level:0}],duration:Math.max(0,e.length/t)};let s="closed";const i=lh/t;for(let c=0;c+Ir<=e.length;c+=lh){const h=e.subarray(c,c+Ir),f=A_(h,t),d=C_(f,s);r(c/t,i,d,f.level),s=d}const a=e.length/t,o=n.length>0?n[n.length-1].t+n[n.length-1].dur:0;o<a-1e-9&&r(o,a-o,"closed",0);const l=n[0];if(l&&l.viseme!=="closed")if(l.dur<=ys/1e3)l.viseme="closed";else{const c=Math.min(l.dur*.5,ys/1e3);l.dur-=c,l.t+=c,n.unshift({t:0,dur:c,viseme:"closed",level:0})}const u=n[n.length-1];if(u&&u.viseme!=="closed"){const c=Math.min(u.dur*.5,ys/1e3);u.dur-=c,n.push({t:u.t+u.dur,dur:c,viseme:"closed",level:0})}for(let c=n.length-1;c>=1;c--){const h=n[c];if(h.viseme!=="closed"&&h.dur<ys/1e3){const f=n[c-1];f.dur+=h.dur,n.splice(c,1)}}return{cues:n,duration:a}}function N_(e){const t=[...e].filter(s=>s.dur>0&&Number.isFinite(s.t)).sort((s,i)=>s.t-i.t),n=[];let r=0;for(const s of t){const i=Math.max(0,s.t/1e3),a=s.dur/1e3;i>r+1e-9&&n.push({t:r,dur:i-r,viseme:"closed",level:0});const o=n[n.length-1];o&&o.viseme===s.viseme&&Math.abs(o.t+o.dur-i)<1e-9?(o.dur+=a,o.level=Math.max(o.level,Math.min(1,Math.max(0,s.level)))):n.push({t:i,dur:a,viseme:s.viseme,level:Math.min(1,Math.max(0,s.level))}),r=i+a}return{cues:n,duration:r}}function I_(e,t){const n=e.cues;if(n.length===0||t<0)return null;let r=0,s=n.length-1;for(;r<s;){const a=r+s+1>>1;n[a].t<=t?r=a:s=a-1}const i=n[r];return t<=i.t+i.dur+1e-9?i:null}function ig(){const[e,t]=v.useState(null),[n,r]=v.useState(null),[s,i]=v.useState(null),[a,o]=v.useState([]),l=v.useRef([]),[u,c]=v.useState(null),[h,f]=v.useState(!1),d=v.useRef(null),m=v.useRef(new Map),b=v.useRef(new Map),g=v.useRef(0),y=v.useRef(!1),k=v.useRef([]),T=v.useRef(0),S=v.useRef(0),E=v.useRef(!1),w=v.useRef(null),_=v.useRef(0),A=v.useRef(null),N=v.useRef(null),C=v.useRef(null);C.current||(C.current=()=>{const F=N.current,V=typeof window<"u"?window.speechSynthesis:void 0;if(!F||F.stopped||!V)return;if(F.i>=F.sentences.length){N.current=null,w.current=null,t(null),r(null),i(null);return}const I=F.i,W=g_(F.sentences[I]),K=new SpeechSynthesisUtterance(W);F.voice&&(K.voice=F.voice,K.lang=F.voice.lang),K.rate=F.rate,K.onstart=()=>{!N.current||N.current.stopped||i({index:I,total:F.sentences.length,text:W})};const D=()=>{var ne;!N.current||N.current.stopped||(N.current.i+=1,(ne=C.current)==null||ne.call(C))};K.onend=D,K.onerror=D,V.speak(K)});const L=v.useCallback((F,V)=>{var D;if(typeof window>"u"||!("speechSynthesis"in window)){c("engine-unavailable");return}const I=Z3(V);if(I.length===0){c("empty-text");return}l.current=I.slice(),o(I.slice()),_.current=I.length,r({index:0,total:I.length,text:I[0]??""});const W=A.current,K=ah(window.speechSynthesis.getVoices(),(W==null?void 0:W.systemVoice)??null);N.current={messageId:F,sentences:I,i:0,stopped:!1,voice:K,rate:uh(W==null?void 0:W.speed)},window.speechSynthesis.cancel(),(D=C.current)==null||D.call(C)},[]),M=()=>{if(!d.current){const F=window.AudioContext??window.webkitAudioContext;d.current=new F}return d.current.resume(),d.current},H=v.useCallback(()=>{E.current&&S.current>=T.current&&!y.current&&(w.current=null,t(null),r(null),i(null))},[]),P=v.useCallback(()=>{const F=d.current;if(!F||y.current)return;const V=m.current.get(g.current);if(!V){H();return}const I=g.current;m.current.delete(I),y.current=!0,i({index:I,total:_.current,text:l.current[I]??""}),g.current+=1;const W=F.createBufferSource();W.buffer=V,x_(F,W),yo({ctx:F,timeline:b.current.get(I)??null,startedAtCtxTime:F.currentTime,analyser:ng(F)}),W.onended=()=>{S.current+=1,y.current=!1,yo(null),P()},k.current.push(W),W.start()},[H]),R=v.useCallback(()=>{for(const F of k.current)try{F.onended=null,F.stop()}catch{}k.current=[],m.current.clear(),b.current.clear(),yo(null),y.current=!1,T.current=0,S.current=0,E.current=!1,w.current=null,g.current=0,_.current=0,l.current=[],o([]),t(null),r(null),i(null),N.current&&(N.current.stopped=!0,N.current=null),typeof window<"u"&&"speechSynthesis"in window&&window.speechSynthesis.cancel()},[]),B=v.useCallback(()=>{R(),window.api.ttsStop().catch(()=>{})},[R]),q=v.useCallback((F,V)=>{var I;if(w.current===F){B();return}if(R(),window.dispatchEvent(new CustomEvent("lookatstudy-speech-start",{detail:F})),c(null),w.current=F,T.current=0,S.current=0,E.current=!1,g.current=0,_.current=0,t(F),r({index:0,total:0,text:""}),((I=A.current)==null?void 0:I.engine)==="system"){L(F,V);return}M(),window.api.ttsSpeak(V,F).then(W=>{if(W.ok){W.firstUse&&f(!0);return}R(),W.reason!=="empty-text"&&c(W.reason)}).catch(()=>R())},[L,B,R]);return v.useEffect(()=>{const F=window.api.on("speech:ttsAudio",W=>{if(W.messageId!==w.current)return;const K=M();T.current+=1,_.current=W.sentenceTotal,r({index:W.sentenceIndex,total:W.sentenceTotal,text:W.sentence??""}),W.sentence!=null&&(l.current[W.sentenceIndex]=W.sentence,o(l.current.slice())),K.decodeAudioData(W.wavBytes).then(D=>{var ne;if(W.messageId===w.current){m.current.set(W.sentenceIndex,D);try{const oe=(ne=W.visemeCues)!=null&&ne.length?N_(W.visemeCues):__(R_(D),D.sampleRate);oe&&b.current.set(W.sentenceIndex,oe)}catch{}P()}},()=>{W.messageId===w.current&&(T.current-=1,P())})}),V=window.api.on("speech:ttsDone",W=>{W.messageId===w.current&&(E.current=!0,H())}),I=window.api.on("speech:ttsError",()=>R());return()=>{F(),V(),I()}},[H,P,R]),v.useEffect(()=>R,[R]),v.useEffect(()=>{const F=V=>{const I=V.detail;w.current&&I!==w.current&&R()};return window.addEventListener("lookatstudy-speech-start",F),()=>window.removeEventListener("lookatstudy-speech-start",F)},[R]),v.useEffect(()=>{let F=!0;const V=()=>{Promise.all([window.api.getSetting("tts_engine"),window.api.getSetting("tts_system_voice"),window.api.getSetting("tts_speed")]).then(([I,W,K])=>{F&&(A.current={engine:(I??"").trim(),systemVoice:W??null,speed:uh(K)})}).catch(()=>{})};return V(),window.addEventListener(ih,V),()=>{F=!1,window.removeEventListener(ih,V)}},[]),v.useEffect(()=>{if(typeof window>"u"||!("speechSynthesis"in window))return;const F=()=>{var I;const V=N.current;!V||V.voice||(V.voice=ah(window.speechSynthesis.getVoices(),((I=A.current)==null?void 0:I.systemVoice)??null))};return window.speechSynthesis.addEventListener("voiceschanged",F),()=>window.speechSynthesis.removeEventListener("voiceschanged",F)},[]),v.useEffect(()=>{Cb(e!==null)},[e]),{speakingMessageId:e,speakingSentence:n,playingSentence:s,streamTexts:a,failReason:u,clearFailReason:()=>c(null),onlineNotice:h,clearOnlineNotice:()=>f(!1),speak:q,stop:B}}function R_(e){if(e.numberOfChannels===1)return e.getChannelData(0);const t=e.getChannelData(0),n=e.getChannelData(1),r=new Float32Array(t.length);for(let s=0;s<t.length;s++)r[s]=(t[s]+n[s])/2;return r}function uh(e){const t=typeof e=="number"?e:Number.parseFloat(e??"");return Number.isFinite(t)?Math.min(2,Math.max(.5,t)):1}const sg=v.createContext(null);let P_=0;const M_={default:4e3,success:4e3,info:4e3,warning:5e3,error:6e3},L_={default:null,success:p.jsx(Ql,{className:"w-4 h-4 text-brand shrink-0"}),error:p.jsx(hx,{className:"w-4 h-4 text-warning shrink-0"}),warning:p.jsx(eu,{className:"w-4 h-4 text-review shrink-0"}),info:p.jsx(kx,{className:"w-4 h-4 text-accent shrink-0"})};function D_({children:e}){const[t,n]=v.useState([]),r=v.useCallback(a=>{n(o=>o.filter(l=>l.id!==a))},[]),s=v.useCallback(a=>{n(o=>o.map(l=>l.id===a?{...l,exiting:!0}:l))},[]),i=v.useCallback((a,o)=>{const l=++P_,u=(o==null?void 0:o.severity)??"default",c=(o==null?void 0:o.duration)??M_[u],h={id:l,message:a,action:o==null?void 0:o.action,duration:c,severity:u,exiting:!1};n(f=>[...f,h]),window.setTimeout(()=>s(l),c)},[s]);return p.jsxs(sg.Provider,{value:{show:i},children:[e,p.jsx("div",{className:"fixed top-14 left-1/2 -translate-x-1/2 z-[100] flex flex-col items-center gap-2 pointer-events-none",role:"region","aria-live":"polite","aria-label":"Notifications",children:t.map(a=>p.jsx(O_,{item:a,onAction:()=>{a.action.onClick(),s(a.id)},onDismiss:()=>s(a.id),onExitDone:()=>r(a.id)},a.id))})]})}function O_({item:e,onAction:t,onDismiss:n,onExitDone:r}){const s=Ye(),i=L_[e.severity];return p.jsxs("div",{className:`pointer-events-auto flex items-center gap-2.5 pl-4 pr-2 py-2 rounded-full bg-surface-0 text-ink-strong text-body shadow-elevated max-w-md ${e.exiting?"toast-exit":"toast-enter"}`,"data-testid":`toast-${e.id}`,"data-severity":e.severity,onAnimationEnd:e.exiting?r:void 0,children:[i,p.jsx("span",{className:"flex-1",children:e.message}),e.action&&p.jsx("button",{onClick:t,className:"text-brand font-bold text-body hover:underline shrink-0 px-1.5 py-1 rounded transition-colors hover:bg-brand/10","data-testid":`toast-action-${e.id}`,children:e.action.label}),p.jsx("button",{onClick:n,className:"text-ink-muted hover:text-ink-strong shrink-0 w-6 h-6 flex items-center justify-center rounded transition-colors hover:bg-surface-3","aria-label":s("action.close"),children:p.jsx(In,{className:"w-3.5 h-3.5"})})]})}function Cu(){const e=v.useContext(sg);return e||{show:()=>{}}}const ag={typescript:()=>Ae(()=>import("./typescript-BPQ3VLAy.js"),[],import.meta.url),tsx:()=>Ae(()=>import("./tsx-COt5Ahok.js"),[],import.meta.url),javascript:()=>Ae(()=>import("./javascript-wDzz0qaB.js"),[],import.meta.url),jsx:()=>Ae(()=>import("./jsx-g9-lgVsj.js"),[],import.meta.url),python:()=>Ae(()=>import("./python-B6aJPvgy.js"),[],import.meta.url),go:()=>Ae(()=>import("./go-C27-OAKa.js"),[],import.meta.url),rust:()=>Ae(()=>import("./rust-B1yitclQ.js"),[],import.meta.url),java:()=>Ae(()=>import("./java-CylS5w8V.js"),[],import.meta.url),c:()=>Ae(()=>import("./c-BIGW1oBm.js"),[],import.meta.url),cpp:()=>Ae(()=>import("./cpp-DddhVWhK.js"),__vite__mapDeps([5,6]),import.meta.url),csharp:()=>Ae(()=>import("./csharp-DSvCPggb.js"),[],import.meta.url),ruby:()=>Ae(()=>import("./ruby-B6QtyW_S.js"),__vite__mapDeps([7,8,9,10,11,12,13,14,15,16,17,5,6,18,19,20]),import.meta.url),php:()=>Ae(()=>import("./php-Csjmro_R.js"),__vite__mapDeps([21,8,9,10,11,12,13,22]),import.meta.url),swift:()=>Ae(()=>import("./swift-C2oV4EkX.js"),[],import.meta.url),kotlin:()=>Ae(()=>import("./kotlin-BdnUsdx6.js"),[],import.meta.url),lua:()=>Ae(()=>import("./lua-BaeVxFsk.js"),__vite__mapDeps([19,6]),import.meta.url),r:()=>Ae(()=>import("./r-Cf5RLm7j.js"),[],import.meta.url),shellscript:()=>Ae(()=>import("./shellscript-Yzrsuije.js"),[],import.meta.url),sql:()=>Ae(()=>import("./sql-CRqJ_cUM.js"),[],import.meta.url),html:()=>Ae(()=>import("./html-pp8916En.js"),__vite__mapDeps([8,9,10]),import.meta.url),css:()=>Ae(()=>import("./css-CLj8gQPS.js"),[],import.meta.url),scss:()=>Ae(()=>import("./scss-D5BDwBP9.js"),__vite__mapDeps([23,10]),import.meta.url),xml:()=>Ae(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([11,12]),import.meta.url),json:()=>Ae(()=>import("./json-Cp-IABpG.js"),[],import.meta.url),yaml:()=>Ae(()=>import("./yaml-Buea-lGh.js"),[],import.meta.url),toml:()=>Ae(()=>import("./toml-vGWfd6FD.js"),[],import.meta.url),ini:()=>Ae(()=>import("./ini-BEwlwnbL.js"),[],import.meta.url),markdown:()=>Ae(()=>import("./markdown-Cvjx9yec.js"),[],import.meta.url),dockerfile:()=>Ae(()=>import("./dockerfile-BcOcwvcX.js"),[],import.meta.url),makefile:()=>Ae(()=>import("./makefile-CHLpvVh8.js"),[],import.meta.url),diff:()=>Ae(()=>import("./diff-D97Zzqfu.js"),[],import.meta.url),graphql:()=>Ae(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([14,9,15,16,17]),import.meta.url),latex:()=>Ae(()=>import("./latex-B2nUCzCX.js"),__vite__mapDeps([24,25]),import.meta.url),vue:()=>Ae(()=>import("./vue-CHlpWS_5.js"),__vite__mapDeps([26,10,9,15,22,8]),import.meta.url)},ch={js:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",py:"python",python3:"python",rb:"ruby",golang:"go",rs:"rust",cs:"csharp",kt:"kotlin",sh:"shellscript",bash:"shellscript",zsh:"shellscript",shell:"shellscript",console:"shellscript",yml:"yaml",md:"markdown",gfm:"markdown",docker:"dockerfile",tex:"latex",plaintext:"",txt:"",text:""};function B_(e){const t=e.trim().toLowerCase();return t?t in ch?ch[t]||null:t in ag?t:null:null}let ni=null;const dh=new Set;function _u(){return ni||(ni=(async()=>{const[e,t,n,r]=await Promise.all([Ae(()=>import("./core-BKUioWC8.js"),__vite__mapDeps([27,1,2]),import.meta.url),Ae(()=>import("./engine-javascript-DBd1bXLz.js"),[],import.meta.url),Ae(()=>import("./github-dark-DHJKELXO.js"),[],import.meta.url),Ae(()=>import("./github-light-DAi9KRSo.js"),[],import.meta.url)]);return e.createHighlighterCore({themes:[n.default,r.default],langs:[],engine:t.createJavaScriptRegexEngine({forgiving:!0})})})(),ni.catch(()=>{ni=null})),ni}async function og(e){const t=B_(e);if(!t)return null;if(dh.has(t))return t;const n=ag[t];if(!n)return null;const r=await _u(),s=await n();return await r.loadLanguage(s),dh.add(t),t}async function F_(e,t){try{const n=await og(t);return n?(await _u()).codeToHtml(e,{lang:n,themes:{light:"github-light",dark:"github-dark"},defaultColor:"dark"}):null}catch{return null}}const j_=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;");async function hM(e,t){try{const n=await og(t);return n?(await _u()).codeToTokens(e,{lang:n,theme:"github-dark"}).tokens.map(i=>i.map(a=>`<span style="color:${a.color}">${j_(a.content)}</span>`).join("")):null}catch{return null}}function H_(e,t){return e==="mermaid"&&t.trim().length>0}function U_(e){const t=e.trimStart().slice(0,40).toLowerCase();return t.startsWith("sequencediagram")?"sequence":t.startsWith("statediagram")?"state":"flowchart"}const z_=v.lazy(()=>Ae(()=>import("./MermaidArtifact-BaJ5RvRv.js").then(e=>e.a),__vite__mapDeps([28,1,2,29]),import.meta.url).then(e=>({default:e.MermaidArtifact})));function V_(e){const t=Array.isArray(e)?e[0]:e,n=(t==null?void 0:t.props)??{},r=/language-(\w+)/.exec(n.className??""),s=n.children,i=typeof s=="string"?s:Array.isArray(s)?s.join(""):"";return{lang:(r==null?void 0:r[1])??"",text:i}}function lg({children:e,...t}){const n=Ye(),[r,s]=v.useState(!1),[i,a]=v.useState(null),{lang:o,text:l}=V_(e),u=H_(o,l);v.useEffect(()=>{let h=!0;if(!(!l||u))return F_(l.replace(/\n$/,""),o).then(f=>{h&&f&&a(f)}),()=>{h=!1}},[l,u]);const c=()=>{var h;(h=navigator.clipboard)==null||h.writeText(l).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})};return u?p.jsx("div",{className:"my-3","data-md-diagram":"",children:p.jsx(v.Suspense,{fallback:p.jsx("div",{className:"surface-card min-h-[120px]"}),children:p.jsx(z_,{data:{artifactType:"diagram",title:n("artifact.mermaid.inlineTitle"),diagramType:U_(l),mermaid:l}})})}):p.jsxs("div",{className:"relative group my-3","data-testid":"md-codeblock",children:[p.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-surface-1 border border-b-0 border-[var(--border-faint)] rounded-t-md",children:[p.jsx("span",{className:"text-caption font-mono text-ink-faint uppercase tracking-wider",children:o||"code"}),p.jsx("button",{onClick:c,"aria-label":n("chat.copy"),className:"text-caption text-ink-muted hover:text-brand transition-colors opacity-0 group-hover:opacity-100 pointer-coarse:opacity-100 inline-flex items-center gap-1","data-testid":"md-copy",children:r?p.jsxs(p.Fragment,{children:[p.jsx(En,{className:"w-3 h-3 inline"}),n("chat.copied")]}):p.jsxs(p.Fragment,{children:[p.jsx(px,{className:"w-3 h-3 inline"}),n("chat.copy")]})})]}),i?p.jsx("div",{className:"md-shiki","data-testid":"md-shiki",dangerouslySetInnerHTML:{__html:i}}):p.jsx("pre",{...t,className:"!mt-0 !rounded-t-none !border-t-0",children:e})]})}const ug=v.lazy(()=>Ae(()=>import("./index-pqxwzTgM.js"),__vite__mapDeps([30,1,2,28,29,31]),import.meta.url).then(e=>({default:e.ArtifactRenderer}))),q_=v.lazy(()=>Ae(()=>import("./CanvasStage-DNJ3CvSQ.js").then(e=>e.a),__vite__mapDeps([29,1,2]),import.meta.url).then(e=>({default:e.CanvasStage}))),W_=v.lazy(()=>Ae(()=>import("./ReviewPanel-C1ldctfO.js"),__vite__mapDeps([32,1,2]),import.meta.url).then(e=>({default:e.SelfRatingCard}))),$_={concept_map:xm,quiz:hm,compare_table:zx,diagram:xx,code_walkthrough:mx},Y_=new Set(["concept_map","quiz","compare_table","diagram","code_walkthrough"]);function G_(e,t){return Y_.has(t)?e(`artifact.type.${t}`):e("artifact.type.unknown")}function K_({selectedNode:e,items:t,loading:n,forceTab:r,canvasArtifact:s,isReviewing:i,onReviewDone:a,onUserTabChange:o,onRemove:l,onTogglePin:u,onRecordQuizResult:c,onSaveContentNote:h,onUpdateNoteComment:f,onJumpToSource:d,onQuoteToChat:m,locale:b}){var _;const g=Ye(),[y,k]=v.useState("content"),T=r??y,S=A=>{k(A),o==null||o()},E=e?t.filter(A=>A.nodeId===e.id):[],w=v.useRef(null);return v.useEffect(()=>{var A;(A=w.current)==null||A.scrollTo({top:0})},[e==null?void 0:e.id]),p.jsxs("div",{className:"relative h-full flex flex-col bg-surface-2","data-testid":"notebook-panel",children:[p.jsx("div",{className:"px-3 pt-3 pb-1 shrink-0","data-testid":"notebook-tabs",children:p.jsxs("div",{className:"flex p-1 rounded-lg gap-1 bg-ink/[0.08]",role:"tablist","aria-label":"Notebook",children:[p.jsx(ko,{label:g("notebook.tab.explain"),icon:nn,active:T==="content",onClick:()=>S("content"),testid:"tab-content"}),p.jsx(ko,{label:g("notebook.tab.notes"),icon:Cx,active:T==="notes",onClick:()=>S("notes"),testid:"tab-notes",badge:E.length>0?String(E.length):void 0}),p.jsx(ko,{label:g("notebook.tab.board"),icon:Ua,active:T==="board",onClick:()=>S("board"),testid:"tab-board"})]})}),p.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 animate-tab-slide",ref:w,role:"tabpanel",children:T==="board"?p.jsx("div",{className:"h-full flex flex-col","data-testid":"board-tab-content",children:s?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"px-4 pt-3 pb-2 shrink-0 flex items-center gap-2 min-w-0",children:[p.jsx(Ua,{className:"w-4 h-4 text-ink-muted shrink-0"}),p.jsx("span",{className:"text-label font-bold text-ink truncate",children:((_=s.output)==null?void 0:_.title)??s.toolName})]}),p.jsx("div",{className:"flex-1 min-h-0 px-2 pb-2",children:p.jsx("div",{className:"h-full rounded-xl overflow-hidden bg-surface-0/60 border border-[var(--border-faint)]",children:p.jsx(v.Suspense,{fallback:null,children:p.jsx(q_,{testid:"board-canvas-stage",children:p.jsx(ug,{data:s.output,variant:"canvas"})})})})})]}):p.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center px-6",children:[p.jsx(Ua,{className:"w-10 h-10 mb-3 text-ink-muted opacity-30"}),p.jsx("div",{className:"text-body text-ink-muted max-w-sm leading-relaxed",children:g("notebook.board.empty")})]})}):p.jsx(p.Fragment,{children:p.jsx("div",{className:"mx-auto w-full max-w-[960px] min-h-full flex flex-col",children:T==="content"?p.jsx(X_,{selectedNode:e,contentNotes:E.filter(A=>A.artifactType==="user_note"&&A.sourceAnchor),onQuoteToChat:m,onSaveContentNote:h,locale:b,isReviewing:i,onReviewDone:a}):p.jsx(Q_,{items:E,loading:n,selectedNode:e,onRemove:l,onTogglePin:u,onRecordQuizResult:c,onUpdateNoteComment:f,onJumpToSource:d})})})},T)]})}function X_({selectedNode:e,contentNotes:t,onQuoteToChat:n,onSaveContentNote:r,locale:s,isReviewing:i,onReviewDone:a}){const o=Ye(),l=Cu(),u=ig();v.useEffect(()=>{if(u.failReason){const R=u.failReason==="engine-unavailable"?"chat.speech.engine_unavailable":u.failReason==="azure-key-missing"?"chat.speech.azure_key_missing":u.failReason==="azure-region-missing"?"chat.speech.azure_region_missing":u.failReason==="edge-failed"?"chat.speech.edge_failed":"chat.speech.model_missing";l.show(o(R),{severity:"warning"}),u.clearFailReason()}else u.onlineNotice&&(l.show(o("chat.speech.edge_disclosed"),{severity:"info"}),u.clearOnlineNotice())},[u.failReason,u.onlineNotice,l,o,u]);const c=v.useRef(u.stop);c.current=u.stop;const h=e?`content-${e.id}`:null;v.useEffect(()=>()=>{c.current()},[h]);const[f,d]=v.useState(null),m=M0(f??""),[b,g]=v.useState(!1),[y,k]=v.useState(!1),[T,S]=v.useState([]),[E,w]=v.useState(null),_=v.useRef(null),A=v.useRef(null),N=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches;v.useEffect(()=>{if(!e){d(null),k(!1);return}let R=!1;return g(!0),k(!1),se.getNodeContent(e.id,s??void 0).then(B=>{R||d(B)}).catch(()=>{R||(d(null),k(!0))}).finally(()=>{R||g(!1)}),()=>{R=!0}},[e==null?void 0:e.id,s]),v.useEffect(()=>{if(!e){S([]);return}let R=!1;return se.listAssetsByNode(e.id).then(B=>{R||S(B)}).catch(()=>{R||S([])}),()=>{R=!0}},[e==null?void 0:e.id]),v.useEffect(()=>{if(!f||!_.current)return;const R=[];for(const q of t)try{const F=JSON.parse(q.sourceAnchor);if(F.type==="content"){const V=JSON.parse(q.data).text??"";V&&R.push({noteId:q.id,text:V,surrounding:F.surroundingText})}}catch{}const B=setTimeout(()=>{A.current&&(yi()?U0(A.current,R):j0(A.current,R))},80);return()=>clearTimeout(B)},[f,t]),v.useEffect(()=>{const R=B=>{var V;const q=B.detail;if(!q)return;if(yi()){const I=z0(q);I&&V0(I);return}const F=(V=A.current)==null?void 0:V.querySelector(`mark[data-note-id="${q}"]`);F&&Q0(F)};return window.addEventListener("lookatstudy-jump-to-note",R),()=>window.removeEventListener("lookatstudy-jump-to-note",R)},[]);const C=u.speakingMessageId===h&&u.playingSentence!=null?u.playingSentence.index:null;v.useEffect(()=>{const R=A.current;if(!R)return;if(C==null){ar(R);return}const B=L0(u.streamTexts,C);if(!B)return;C===0&&G0(R);const q=setTimeout(()=>{const F=K0(R,B);F&&X0(F,R.closest(".overflow-y-auto"))},30);return()=>clearTimeout(q)},[C,u.streamTexts,h]),v.useEffect(()=>{C==null&&A.current&&ar(A.current)},[C]);const L=v.useRef(!1);L.current=C!=null,v.useEffect(()=>()=>{L.current&&ar(document.body)},[]);const M=v.useCallback(()=>{var X;if(!n&&!r)return;const R=window.getSelection(),B=(R==null?void 0:R.toString().trim())??"";if(B.length<2||B.length>500){w(null);return}const q=R==null?void 0:R.getRangeAt(0);if(!q||!((X=_.current)!=null&&X.contains(q.commonAncestorContainer))){w(null);return}const F=q.getBoundingClientRect(),V=_.current.getBoundingClientRect(),I=A.current;let W=null;if(I&&I.contains(q.commonAncestorContainer)){const de=dr(I);W=O0(q,de)}const K=I?dr(I).text:B,D=W?W.start:K.indexOf(B),ne=D>=0?K.slice(Math.max(0,D-30),D+B.length+30):B,oe=q.getClientRects(),J=oe.length?oe[oe.length-1]:F,Y=J0({left:F.left-V.left,top:F.top-V.top,right:F.right-V.left,bottom:F.bottom-V.top,width:F.width,height:F.height},V.width,n?N?190:150:N?140:100,{left:J.left-V.left,top:J.top-V.top,right:J.right-V.left,bottom:J.bottom-V.top,width:J.width,height:J.height},N);w({x:Y.left,y:Y.top,transform:Y.transform,text:B,surrounding:ne,offsets:W??void 0})},[n,r,N]);v.useEffect(()=>{const R=N?600:250;let B=null,q=null,F=!1;const V=()=>{var D;return(((D=window.getSelection())==null?void 0:D.toString().trim().length)??0)>=2},I=()=>{V()?(q&&(clearTimeout(q),q=null),w(D=>D&&null),B&&clearTimeout(B),B=setTimeout(()=>{B=null,!F&&V()&&M()},R)):q||(q=setTimeout(()=>w(D=>D&&null),250))},W=D=>{var oe;const ne=D.target;(oe=ne==null?void 0:ne.closest)!=null&&oe.call(ne,"[data-selection-popover]")||(F=!0)},K=()=>{F=!1,B&&(clearTimeout(B),B=null),!q&&V()&&M()};return document.addEventListener("selectionchange",I),window.addEventListener("pointerdown",W,!0),window.addEventListener("pointerup",K,!0),window.addEventListener("pointercancel",K,!0),()=>{document.removeEventListener("selectionchange",I),window.removeEventListener("pointerdown",W,!0),window.removeEventListener("pointerup",K,!0),window.removeEventListener("pointercancel",K,!0),B&&clearTimeout(B),q&&clearTimeout(q)}},[M]);const H=v.useCallback(()=>{var B;if(!E||!n)return;const R=E.text.length>200?E.text.slice(0,200)+"…":E.text;n(o("notebook.quote.template",{text:R})),w(null),(B=window.getSelection())==null||B.removeAllRanges()},[E,n,o]),P=v.useCallback(()=>{var B,q,F;if(!E||!r||!e)return;const R=E.text.length>200?E.text.slice(0,200)+"…":E.text;r(R,{type:"content",surroundingText:E.surrounding,startOffset:(B=E.offsets)==null?void 0:B.start,endOffset:(q=E.offsets)==null?void 0:q.end}),_b(),setTimeout(()=>{if(!A.current)return;if(yi()){const W=t_(A.current);W&&rh(W);return}const V=A.current.querySelectorAll("mark.lookatstudy-underline"),I=V&&V.length>0?V[V.length-1]:null;I&&rh(I)},200),w(null),(F=window.getSelection())==null||F.removeAllRanges()},[E,r,e]);return e?p.jsxs("div",{className:"p-5 relative","data-testid":"node-content",ref:_,children:[!b&&!y&&f&&p.jsx("div",{className:"sticky top-0 z-20 flex justify-end gap-2 -mt-2 pointer-events-none",children:p.jsx("button",{onClick:()=>u.speak(h??"content",f),"data-tooltip":u.speakingMessageId===h?o("chat.speech.stop"):o("chat.speech.read_aloud_node"),"aria-label":u.speakingMessageId===h?o("chat.speech.stop"):o("chat.speech.read_aloud_node"),"data-testid":u.speakingMessageId===h?"node-content-speak-active":"node-content-speak",className:`pointer-events-auto shrink-0 rounded-full p-2 bg-surface-2 shadow-elevated transition-colors ${u.speakingMessageId===h?"text-brand animate-pulse":"text-ink-muted hover:text-ink-strong"}`,children:u.speakingMessageId===h?p.jsx(Jl,{className:"w-4 h-4"}):p.jsx(vm,{className:"w-4 h-4"})})}),p.jsx("div",{className:"text-caption font-bold text-brand uppercase tracking-wider mb-1",children:e.type==="section"?o("notebook.node_type.section"):e.type==="concept"?o("notebook.node_type.concept"):o("notebook.node_type.lesson")}),p.jsx("div",{className:"flex items-start justify-between gap-3 mb-4",children:p.jsx("h2",{className:"text-title font-extrabold text-ink-strong tracking-tight","data-testid":"node-content-title",children:e.title})}),b?p.jsxs("div",{className:"text-body text-ink-muted flex items-center gap-2",children:[p.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),o("notebook.content.loading")]}):y?p.jsxs("div",{className:"text-body text-warning",children:[o("notebook.content.load_failed"),p.jsx("button",{className:"underline ml-1",onClick:()=>{k(!1),g(!0),se.getNodeContent(e.id,s??void 0).then(d).catch(()=>k(!0)).finally(()=>g(!1))},children:o("notebook.content.retry")})]}):f?p.jsx(Y3,{fallback:(R,B)=>p.jsxs("div",{className:"prose prose-sm max-w-[80ch] leading-relaxed [&_pre]:max-w-full [&_pre]:overflow-x-auto",children:[p.jsx("div",{className:"text-body text-warning mb-2",children:o("notebook.content.render_failed")}),p.jsxs("pre",{className:"text-caption text-ink-muted whitespace-pre-wrap break-words bg-surface-1 p-3 rounded",children:[f.slice(0,500),f.length>500?`
525
+ `+o("notebook.content.truncated"):""]}),p.jsx("div",{className:"flex gap-2 mt-2",children:p.jsx("button",{className:"text-caption underline text-accent",onClick:B,children:o("notebook.content.retry_render")})})]}),children:p.jsx("div",{ref:A,className:"prose prose-sm max-w-[80ch] leading-relaxed break-words overflow-x-auto [&_pre]:max-w-full [&_pre]:overflow-x-auto [&_img]:max-w-full [&_video]:max-w-full [&_iframe]:max-w-full select-text",children:p.jsx(Ep,{remarkPlugins:m.remarkPlugins,rehypePlugins:m.rehypePlugins,components:{pre({children:R,...B}){return p.jsx(lg,{...B,children:R})},a({children:R,...B}){return p.jsx("a",{...B,target:"_blank",rel:"noopener noreferrer",children:R})},img({src:R,alt:B,...q}){return p.jsx(Z_,{src:R,alt:B,assets:T,...q})},table({children:R}){return p.jsx("div",{className:"overflow-x-auto my-4",children:p.jsx("table",{children:R})})}},children:Z0(f)})})},`${e.id}-${s??"orig"}`):p.jsx("div",{className:"text-body text-ink-muted",children:o("notebook.content.empty")}),T.length>0&&p.jsxs("div",{className:"mt-6 pt-4 border-t border-[var(--border-faint)]",children:[p.jsxs("div",{className:"text-label font-bold text-ink-muted mb-2 flex items-center gap-1",children:[p.jsx(vx,{className:"w-3.5 h-3.5"}),p.jsx("span",{children:o("notebook.images.heading",{n:T.length})})]}),p.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:T.map(R=>p.jsx(J_,{asset:R},R.id))})]}),E&&p.jsxs("div",{"data-selection-popover":!0,style:{left:E.x,top:E.y,transform:E.transform},className:"absolute z-20 flex items-center gap-0.5 msg-enter whitespace-nowrap",children:[n&&p.jsxs("button",{onClick:H,"data-testid":"quote-to-chat-btn","aria-label":o("notebook.quote.ask"),className:"px-2 py-1.5 rounded-lg bg-brand text-white text-label font-bold shadow-elevated flex items-center gap-1 hover:bg-brand-light transition-colors",children:[p.jsx(pm,{className:"w-3 h-3"}),o("notebook.quote.ask")]}),p.jsxs("button",{onClick:P,"data-testid":"save-note-btn","aria-label":o("notebook.quote.add_note"),className:"px-2 py-1.5 rounded-lg bg-accent text-white text-label font-bold shadow-elevated flex items-center gap-1 hover:brightness-110 transition",title:o("notebook.quote.save_note.title"),children:[p.jsx(Ai,{className:"w-3.5 h-3.5"}),o("notebook.quote.add_note")]})]}),e.sourcePath&&p.jsx("div",{className:"mt-6 pt-3 border-t border-[var(--border-faint)] text-label text-ink-muted",children:o("notebook.source.label",{path:e.sourcePath})}),p.jsxs("div",{className:"mt-4 p-3 rounded-lg bg-accent/5 border border-accent/20 text-body text-ink-muted flex items-start gap-1.5",children:[p.jsx(dm,{className:"w-3.5 h-3.5 shrink-0 mt-0.5 text-accent"}),p.jsx("span",{children:o("notebook.quote.hint")})]}),i&&e&&p.jsx(v.Suspense,{fallback:null,children:p.jsx(W_,{nodeId:e.id,onRated:a})})]}):p.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center px-6",children:[p.jsx("div",{className:"text-4xl mb-3 opacity-30",children:"📖"}),p.jsx("div",{className:"text-body text-ink-muted max-w-xs",children:o("notebook.empty.select_node")})]})}function Q_({items:e,loading:t,selectedNode:n,onRemove:r,onTogglePin:s,onRecordQuizResult:i,onUpdateNoteComment:a,onJumpToSource:o}){const l=Ye();if(!n)return p.jsx(hh,{message:l("notebook.empty.notes.title"),icon:"📓"});if(t)return p.jsxs("div",{className:"flex-1 flex items-center justify-center gap-2 text-body text-ink-muted",children:[p.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),l("notebook.empty.notes.title")]});const u=e.filter(b=>["concept_map","compare_table","diagram","code_walkthrough"].includes(b.artifactType)),c=e.filter(b=>b.artifactType==="user_note"),h=e.filter(b=>b.artifactType==="quiz"),f=e.length,d=h.filter(b=>b.lastResult==="correct").length,m=h.filter(b=>b.lastResult==="wrong").length;return f===0?p.jsx(hh,{message:l("notebook.empty.no_notes_message"),icon:"🧩"}):p.jsxs("div",{className:"p-4 space-y-3","data-testid":"notes-list",children:[p.jsx(Eo,{title:l("notebook.zone.understand"),icon:p.jsx(xm,{className:"w-4 h-4"}),subtitle:l("notebook.zone.understand.subtitle"),count:u.length,testid:"zone-understand",defaultOpen:!1,children:u.length===0?p.jsx(vo,{hint:l("notebook.zone.understand.empty_hint")}):u.map(b=>p.jsx(To,{item:b,onRemove:r,onTogglePin:s,onRecordQuizResult:i,onUpdateNoteComment:a,onJumpToSource:o},b.id))}),p.jsx(Eo,{title:l("notebook.zone.note"),icon:p.jsx(Ai,{className:"w-4 h-4"}),subtitle:l("notebook.zone.note.subtitle"),count:c.length,testid:"zone-note",defaultOpen:!1,children:c.length===0?p.jsx(vo,{hint:l("notebook.zone.note.empty_hint")}):c.map(b=>p.jsx(To,{item:b,onRemove:r,onTogglePin:s,onRecordQuizResult:i,onUpdateNoteComment:a,onJumpToSource:o},b.id))}),p.jsx(Eo,{title:l("notebook.zone.practice"),icon:p.jsx(hm,{className:"w-4 h-4"}),subtitle:h.length>0?l("notebook.zone.practice.subtitle_stats",{total:h.length,correct:d,wrong:m}):l("notebook.zone.practice.subtitle_empty"),count:h.length,testid:"zone-practice",defaultOpen:!1,children:h.length===0?p.jsx(vo,{hint:l("notebook.zone.practice.empty_hint")}):h.map(b=>p.jsx(To,{item:b,onRemove:r,onTogglePin:s,onRecordQuizResult:i,onUpdateNoteComment:a,onJumpToSource:o},b.id))})]})}function Eo({title:e,icon:t,subtitle:n,count:r,testid:s,defaultOpen:i=!0,children:a}){const[o,l]=v.useState(i),u=v.useRef(!0),c=v.useRef(r);return v.useEffect(()=>{if(u.current){u.current=!1,c.current=r;return}r>c.current&&l(!0),c.current=r},[r]),p.jsxs("section",{className:"rounded-xl bg-surface-1 overflow-hidden","data-testid":s,children:[p.jsxs("button",{onClick:()=>l(h=>!h),"aria-expanded":o,className:"w-full flex items-center gap-2 px-3 py-2.5 bg-surface-1/50 hover:bg-surface-3/60 transition-colors text-left","data-testid":`${s}-toggle`,children:[p.jsx(ca,{className:`w-4 h-4 text-ink-muted transition-transform duration-200 ease-out-back ${o?"":"-rotate-90"}`}),p.jsx("span",{className:"text-body text-ink-strong flex items-center",children:t}),p.jsx("span",{className:"text-body font-bold text-ink",children:e}),p.jsx("span",{className:"text-caption font-bold px-1.5 py-0.5 rounded-full bg-brand/15 text-brand",children:r}),p.jsx("span",{className:"text-label text-ink-muted ml-auto truncate",children:n})]}),p.jsx("div",{className:"grid transition-all duration-200 ease-out-expo",style:{gridTemplateRows:o?"1fr":"0fr"},children:p.jsx("div",{className:"overflow-hidden",children:p.jsx("div",{className:"p-3 space-y-3",children:a})})})]})}function vo({hint:e}){return p.jsx("div",{className:"text-center py-3 text-body text-ink-muted",children:e})}function To({item:e,onRemove:t,onTogglePin:n,onRecordQuizResult:r,onUpdateNoteComment:s,onJumpToSource:i}){const a=Ye(),[o,l]=v.useState(!1),[u,c]=v.useState(e.notes??""),h=v.useCallback((T,S,E)=>{e.nodeId&&se.recordQuizAnswer(e.nodeId,E).catch(()=>{}),r(e.id,E)},[e.nodeId,e.id,r]),f=e.artifactType==="user_note";let d="",m=null;if(f){try{d=JSON.parse(e.data).text??""}catch{d=e.title??""}try{e.sourceAnchor&&(m=JSON.parse(e.sourceAnchor))}catch{m=null}}let b=null;if(!f)try{b=JSON.parse(e.data)}catch{b=null}const g=new Date(e.createdAt),y=`${g.getMonth()+1}/${g.getDate()} ${g.getHours().toString().padStart(2,"0")}:${g.getMinutes().toString().padStart(2,"0")}`;if(f){const T=e.notes&&e.notes.trim().length>0?e.notes:null,S=()=>{c(T??""),l(!0)},E=()=>{c(T??""),l(!1)},w=()=>{s==null||s(e.id,u),l(!1)};return p.jsx("div",{className:`bg-surface-2 rounded-lg p-3 relative ${e.pinned?"ring-1 ring-brand/40 bg-brand/5":""}`,"data-testid":`canvas-item-${e.id.slice(0,8)}`,children:p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx(Lx,{className:"w-4 h-4 text-accent shrink-0 mt-0.5"}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"text-body text-ink leading-relaxed whitespace-pre-wrap",children:d}),s&&o?p.jsxs("div",{className:"mt-2 space-y-1.5","data-testid":`note-comment-edit-${e.id.slice(0,8)}`,children:[p.jsx("textarea",{value:u,onChange:_=>c(_.target.value),rows:2,placeholder:a(T?"notebook.note.comment.ph_edit":"notebook.note.comment.ph_new"),className:"w-full text-label leading-relaxed p-2 rounded-md border border-[var(--border-faint)] bg-surface-0 text-ink resize-none focus:outline-none focus:border-brand","data-testid":`note-comment-textarea-${e.id.slice(0,8)}`}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("button",{onClick:w,className:"inline-flex items-center gap-1 text-caption font-bold text-white bg-brand hover:bg-brand/90 px-2 py-0.5 rounded","data-testid":`note-comment-save-${e.id.slice(0,8)}`,children:[p.jsx(En,{className:"w-3 h-3"})," ",a("notebook.action.save")]}),p.jsxs("button",{onClick:E,className:"inline-flex items-center gap-1 text-caption text-ink-muted hover:text-ink","data-testid":`note-comment-cancel-${e.id.slice(0,8)}`,children:[p.jsx(In,{className:"w-3 h-3"})," ",a("notebook.action.cancel")]})]})]}):T?p.jsxs("div",{className:"mt-2 px-2.5 py-1.5 rounded-lg bg-ink/5",children:[p.jsx("div",{className:"text-label text-ink-muted italic leading-relaxed whitespace-pre-wrap",children:T}),s&&p.jsxs("button",{onClick:S,className:"mt-1 inline-flex items-center gap-0.5 text-caption text-ink-muted hover:text-accent","data-testid":`note-comment-edit-btn-${e.id.slice(0,8)}`,title:a("notebook.note.edit_comment"),children:[p.jsx(Ai,{className:"w-2.5 h-2.5"})," ",a("notebook.note.edit_comment")]})]}):s?p.jsxs("button",{onClick:S,className:"mt-2 inline-flex items-center gap-0.5 text-caption text-ink-muted hover:text-accent","data-testid":`note-comment-add-${e.id.slice(0,8)}`,title:a("notebook.note.add_comment"),children:[p.jsx(Ai,{className:"w-2.5 h-2.5"})," ",a("notebook.note.add_comment")]}):null,m&&i&&p.jsx("button",{onClick:()=>i(m,d,e.id),className:"mt-2 inline-flex items-center gap-1 text-caption text-accent hover:underline font-bold","data-testid":`note-source-${e.id.slice(0,8)}`,children:m.type==="content"?p.jsxs(p.Fragment,{children:[p.jsx(nn,{className:"w-3 h-3"}),a("notebook.source.jump_content")]}):p.jsxs(p.Fragment,{children:[p.jsx(pm,{className:"w-3 h-3"}),a("notebook.source.jump_chat")]})}),p.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[p.jsx("span",{className:"text-caption text-ink-muted",children:y}),p.jsx("button",{onClick:()=>t(e.id),className:"text-caption text-ink-muted hover:text-warning","data-testid":`canvas-delete-${e.id.slice(0,8)}`,title:a("notebook.note.delete"),children:p.jsx(Ko,{className:"w-3 h-3"})})]})]})]})})}const k=$_[e.artifactType]??Mx;return p.jsxs("div",{className:`bg-surface-2 rounded-lg p-3 relative ${e.pinned?"ring-1 ring-brand/40 bg-brand/5":""}`,"data-testid":`canvas-item-${e.id.slice(0,8)}`,children:[p.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[p.jsx("span",{className:"text-body inline-flex items-center text-ink-strong",children:p.jsx(k,{className:"w-4 h-4"})}),p.jsx("span",{className:"text-label font-bold text-ink-muted flex-1 truncate",children:e.title??G_(a,e.artifactType)}),e.artifactType==="quiz"&&e.lastResult&&p.jsx("span",{className:`text-caption font-bold px-1.5 py-0.5 rounded-full ${e.lastResult==="correct"?"bg-brand/15 text-brand":"bg-warning/15 text-warning"}`,"data-testid":`quiz-result-${e.id.slice(0,8)}`,children:e.lastResult==="correct"?a("notebook.quiz.last_correct"):a("notebook.quiz.last_wrong")}),e.pinned?p.jsxs("span",{className:"text-caption text-brand font-bold flex items-center gap-0.5",children:[p.jsx(Nc,{className:"w-2.5 h-2.5"}),a("notebook.note.pinned")]}):null,p.jsx("button",{onClick:()=>n(e.id),className:"text-caption text-ink-muted hover:text-brand","data-testid":`canvas-pin-${e.id.slice(0,8)}`,title:e.pinned?a("notebook.note.unpin"):a("notebook.note.pin"),children:p.jsx(Nc,{className:"w-3 h-3"})}),p.jsx("button",{onClick:()=>t(e.id),className:"text-caption text-ink-muted hover:text-warning","data-testid":`canvas-delete-${e.id.slice(0,8)}`,title:a("notebook.note.delete"),children:p.jsx(Ko,{className:"w-3 h-3"})})]}),p.jsx("div",{className:"text-label",children:b?p.jsx(v.Suspense,{fallback:null,children:p.jsx(ug,{data:b,onQuizAnswered:h})}):p.jsx("div",{className:"text-ink-muted",children:a("notebook.artifact.broken")})}),p.jsx("div",{className:"text-caption text-ink-muted mt-2",children:y})]})}function hh({message:e,icon:t}){return p.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center px-6","data-testid":"empty-notebook",children:[p.jsx("div",{className:"text-4xl mb-3 opacity-30",children:t}),p.jsx("div",{className:"text-body text-ink-muted max-w-xs leading-relaxed",children:e})]})}function ko({label:e,icon:t,active:n,onClick:r,testid:s,badge:i}){return p.jsxs("button",{onClick:r,"data-testid":s,role:"tab","aria-selected":n,className:`flex-1 flex items-center justify-center gap-1 py-1.5 rounded-md text-label font-bold transition-colors ${n?"bg-brand/20 text-brand":"text-ink-muted hover:text-ink-strong"}`,children:[p.jsx(t,{className:"w-3 h-3"}),p.jsx("span",{children:e}),i&&p.jsx("span",{className:`text-caption px-1.5 py-0.5 rounded-full font-bold ${n?"bg-brand/30 text-brand":"bg-ink/10 text-ink-faint"}`,children:i})]})}function Z_({src:e,alt:t,assets:n,...r}){const[s,i]=v.useState(null),a=e??"",o=v.useMemo(()=>{if(!a||a.startsWith("http")||a.startsWith("data:"))return null;const u=a.split("/").pop()??a;return n.find(c=>{var h;return(h=c.sourcePath)==null?void 0:h.endsWith(u)})??n.find(c=>c.filename===u)??null},[a,n]);if(v.useEffect(()=>{if(!o){i(null);return}let u=!1;return se.getAssetDataUrl(o.id).then(c=>{u||i(c)}),()=>{u=!0}},[o]),!a)return null;const l=s??a;return p.jsx("img",{src:l,alt:t??"","data-asset-id":o==null?void 0:o.id,className:"rounded-lg max-w-full h-auto my-3",loading:"lazy",...r})}function J_({asset:e}){const t=Ye(),[n,r]=v.useState(null),[s,i]=v.useState(!1);return v.useEffect(()=>{let a=!1;return se.getAssetDataUrl(e.id).then(o=>{a||r(o)}),()=>{a=!0}},[e.id]),p.jsxs(p.Fragment,{children:[p.jsx("button",{onClick:()=>i(!0),className:"block rounded-lg overflow-hidden bg-ink/5 dark:bg-ink/10 hover:ring-2 hover:ring-accent transition-all",title:e.altText??e.filename,children:n?p.jsx("img",{src:n,alt:e.altText??e.filename,"data-asset-id":e.id,className:"w-full h-24 object-cover",loading:"lazy"}):p.jsx("div",{className:"w-full h-24 flex items-center justify-center text-ink-faint text-caption",children:t("notebook.asset.loading")})}),s&&n&&p.jsxs("div",{className:"fixed inset-0 z-50 bg-black/80 flex items-center justify-center p-8 cursor-pointer",onClick:()=>i(!1),children:[p.jsx("img",{src:n,alt:e.altText??e.filename,"data-asset-id":e.id,className:"max-w-[90vw] max-h-[90vh] object-contain rounded-lg"}),p.jsx("button",{className:"absolute top-4 right-4 text-white/70 hover:text-white","aria-label":t("action.close"),onClick:a=>{a.stopPropagation(),i(!1)},children:p.jsx(In,{className:"w-6 h-6"})})]})]})}const eN=["INTJ","INTP","ENTJ","ENTP","INFJ","INFP","ENFJ","ENFP","ISTJ","ISFJ","ESTJ","ESFJ","ISTP","ISFP","ESTP","ESFP"],cg=["external","introjected","identified","integrated","intrinsic"],tN={start:null,interaction:null,feedback:null,pacing:null};function wo(){return{name:null,mbti:null,style:{...tN},motiveStage:null,interests:null,freeNote:null,updatedAt:new Date(0).toISOString()}}function dg(e){return{start:e.includes("N")?"framework":"analogy",interaction:e.includes("E")?"dialogue":"lecture",feedback:e.includes("T")?"direct":"encouraging",pacing:e.includes("P")?"exploratory":"sequential"}}function fh(e){var t;return!!(e.name||e.mbti||e.motiveStage||e.freeNote||(((t=e.interests)==null?void 0:t.length)??0)>0||e.style.start||e.style.interaction||e.style.feedback||e.style.pacing)}const nN=8;function rN(e){if(!Array.isArray(e))return null;const t=[];for(const n of e){if(typeof n!="string")continue;const r=n.trim();if(r&&!t.includes(r)&&t.push(r),t.length>=nN)break}return t.length?t:null}function pl(e){return rN((e??"").split(/[,,、;;]+/))}const iN={start:{analogy:{zh:"先具体实例建直觉",en:"concrete examples first"},framework:{zh:"先框架后细节",en:"framework first, details later"}},interaction:{dialogue:{zh:"边讲边问",en:"dialogue-heavy teaching"},lecture:{zh:"讲完一节再答疑",en:"lecture first, Q&A after"}},feedback:{direct:{zh:"直接纠错",en:"direct corrections"},encouraging:{zh:"先肯定再指正",en:"encouraging corrections"}},pacing:{sequential:{zh:"按顺序推进",en:"sequential progression"},exploratory:{zh:"允许跳着学",en:"exploratory jumping"}}};function fM(e,t,n){const r=iN[e][t];return r?n==="en"?r.en:r.zh:""}const sN={external:{nameZh:"为了考试/面试",nameEn:"For an exam",taglineZh:"这场考试/面试在前头等着,得过去。",taglineEn:"The exam or interview is waiting — gotta get past it.",botZh:"行,考点优先,咱们稳稳过。",botEn:"Alright — exam points first, steady pace, we'll pass."},introjected:{nameZh:"为了填满休息时间",nameEn:"To fill free time",taglineZh:"闲着也是闲着,学点总没坏处。",taglineEn:"Got spare time anyway — might as well learn something.",botZh:"轻松学,不赶进度,学到哪算哪。",botEn:"Easy pace, no rush — we go as far as we go."},identified:{nameZh:"未来能用得上",nameEn:"It'll pay off",taglineZh:"这本事存着,总有一天用得上。",taglineEn:"Stash the skill — one day it pays off.",botZh:"好,都往用得上讲。",botEn:"Got it — everything aimed at real use."},integrated:{nameZh:"终身学习",nameEn:"Lifelong learning",taglineZh:"学习这事儿,我打算干一辈子。",taglineEn:"Learning is a lifelong thing for me.",botZh:"同路人,往深了讲。",botEn:"Fellow traveler — let's go deep."},intrinsic:{nameZh:"享受学习过程",nameEn:"For the fun of it",taglineZh:"懂的那个瞬间,本身就挺爽。",taglineEn:"That click when it finally makes sense — love it.",botZh:"那就挑有意思的讲!",botEn:"Then let's pick the fun stuff!"}};function Rr(e,t){const n=sN[e];return t==="en"?{name:n.nameEn,tagline:n.taglineEn,bot:n.botEn}:{name:n.nameZh,tagline:n.taglineZh,bot:n.botZh}}const aN={INTJ:{nameZh:"建筑师",nameEn:"Architect",taglineZh:"要蓝图不要碎片:先给全貌和设计意图,细节他自己会填。",taglineEn:"Wants the blueprint, not fragments: give the big picture and design intent first; he'll fill in details himself.",botZh:"收到,我先给你画地图,路你自己走。",botEn:"Got it — I'll draw the map, you pick the path."},INTP:{nameZh:"逻辑学家",nameEn:"Logician",taglineZh:"定义先行:把概念边界和推理链讲清楚,他自己能走完。",taglineEn:"Definitions first: lay out concept boundaries and the reasoning chain; he can walk the rest.",botZh:"好,我们先把术语掰干净。",botEn:"Alright, let's nail down the terms first."},ENTJ:{nameZh:"指挥官",nameEn:"Commander",taglineZh:"目标导向:直说这知识能干什么、怎么最快上手。",taglineEn:"Goal-driven: say what this knowledge is for and the fastest way to competence.",botZh:"明白,直奔主线。",botEn:"Understood — straight to the main line."},ENTP:{nameZh:"辩论家",nameEn:"Debater",taglineZh:"辩论驱动:抛论点让他攻击,他记住的是自己反驳过的东西;小心他只聊不做题。",taglineEn:"Debate-driven: throw out claims for him to attack — he remembers what he argued against; watch that he doesn't just chat and skip quizzes.",botZh:"来,先过两招。",botEn:"Come on then — let's spar a round."},INFJ:{nameZh:"提倡者",nameEn:"Advocate",taglineZh:"意义驱动:先讲这知识为什么重要、和什么相连。",taglineEn:"Meaning-driven: start with why this matters and what it connects to.",botZh:"好的,从「为什么」讲起。",botEn:"Sure — let's start with the 'why'."},INFP:{nameZh:"调停者",nameEn:"Mediator",taglineZh:"兴趣驱动:用他关心的例子引路,少逼问多启发。",taglineEn:"Interest-driven: lead with examples he cares about; inspire more, interrogate less.",botZh:"嗯,我们挑你最有感觉的部分开始。",botEn:"Hmm — let's start with whatever resonates most."},ENFJ:{nameZh:"主人公",nameEn:"Protagonist",taglineZh:"共鸣驱动:多确认感受,节奏放软,用故事讲。",taglineEn:"Resonance-driven: check in on how it's landing, soften the pace, teach through stories.",botZh:"好呀,我们慢慢来。",botEn:"Of course — let's take it easy."},ENFP:{nameZh:"竞选者",nameEn:"Campaigner",taglineZh:"新鲜感驱动:多变花样、多跳观点,小心他三分钟热度。",taglineEn:"Novelty-driven: vary the angles and keep it fresh; watch for fading enthusiasm.",botZh:"走,今天学点新鲜的!",botEn:"Let's go — something fresh today!"},ISTJ:{nameZh:"物流师",nameEn:"Logistician",taglineZh:"顺序驱动:按地图一格一格来,讲清楚规则和依据。",taglineEn:"Order-driven: follow the map step by step; make rules and rationale explicit.",botZh:"好,按部就班。",botEn:"Good — step by step."},ISFJ:{nameZh:"守卫者",nameEn:"Defender",taglineZh:"稳妥驱动:小步确认,多鼓励,别一次灌太多。",taglineEn:"Steady-driven: small steps with frequent check-ins; encourage; don't dump too much at once.",botZh:"放心,我们一步步来。",botEn:"Don't worry — one step at a time."},ESTJ:{nameZh:"总经理",nameEn:"Executive",taglineZh:"务实驱动:直接给可执行的步骤和检验标准。",taglineEn:"Pragmatic-driven: hand over actionable steps and clear acceptance criteria.",botZh:"行,列个清单开工。",botEn:"Fine — checklist and go."},ESFJ:{nameZh:"执政官",nameEn:"Consul",taglineZh:"陪伴驱动:多互动多反馈,让他感到进度被看见。",taglineEn:"Companion-driven: interact and give feedback often so progress feels seen.",botZh:"一起学,我盯着你的进度。",botEn:"We'll learn together — I'm watching your progress."},ISTP:{nameZh:"鉴赏家",nameEn:"Virtuoso",taglineZh:"动手驱动:少讲理论多上手,例子要真实可拆。",taglineEn:"Hands-on-driven: less theory, more doing; examples must be real and dissectable.",botZh:"直接上手试试?",botEn:"Wanna just dive in?"},ISFP:{nameZh:"探险家",nameEn:"Adventurer",taglineZh:"体验驱动:从具体感受入手,审美和直觉都吃得开。",taglineEn:"Experience-driven: start from concrete impressions; aesthetics and intuition both work.",botZh:"我们从好玩的讲起。",botEn:"Let's start with the fun part."},ESTP:{nameZh:"企业家",nameEn:"Entrepreneur",taglineZh:"实战驱动:先跑起来再补理论,边做边纠。",taglineEn:"Action-driven: run it first, patch theory later; correct while doing.",botZh:"先干了再说。",botEn:"Do it now, talk later."},ESFP:{nameZh:"表演者",nameEn:"Entertainer",taglineZh:"舞台驱动:讲得有声有色,及时给掌声。",taglineEn:"Stage-driven: teach with color and energy; applaud generously and promptly.",botZh:"上课啦,今天包好看!",botEn:"Class is on — promise it'll be a good show!"}};function So(e,t){const n=aN[e];return t==="en"?{code:e,name:n.nameEn,tagline:n.taglineEn,bot:n.botEn}:{code:e,name:n.nameZh,tagline:n.taglineZh,bot:n.botZh}}function mM({t:e,locale:t,profile:n,onSave:r,onCancel:s,testIdPrefix:i="boot"}){const a=m=>`${i}-edit-${m}`,[o,l]=v.useState({...n,style:{...n.style}}),u=t==="en",c=m=>l(b=>({...b,...m})),[h,f]=v.useState(()=>{var m;return((m=n.interests)==null?void 0:m.join(u?", ":"、"))??""}),d=u?", ":"、";return p.jsxs("section",{className:"flex flex-col gap-4","data-testid":`${i}-editcard`,children:[p.jsxs("div",{children:[p.jsx("div",{className:"text-title font-bold text-ink mb-1",children:e("boot.profile_quiz.title")}),p.jsx("div",{className:"text-label text-ink-muted",children:e("boot.profile_quiz.desc")})]}),p.jsxs("label",{className:"flex flex-col gap-1",children:[p.jsx("span",{className:"text-label text-ink-faint",children:e("boot.card.name.label")}),p.jsx("input",{className:"bg-surface-0 rounded-lg px-3 py-2 text-body text-ink outline-none focus:ring-2 focus:ring-accent",placeholder:e("boot.card.name.placeholder"),value:o.name??"",onChange:m=>c({name:m.target.value||null}),"data-testid":a("name")})]}),p.jsx(hg,{t:e,locale:t,value:o.mbti,onPick:m=>{Pr(),c({mbti:m,style:dg(m)})}}),p.jsxs("div",{className:"flex flex-col gap-1",children:[p.jsx("span",{className:"text-label text-ink",children:e("boot.card.motive.label")}),p.jsx("div",{className:"grid grid-cols-1 gap-1.5",role:"radiogroup","aria-label":e("boot.card.motive.label"),children:cg.map(m=>p.jsx("button",{role:"radio","aria-checked":o.motiveStage===m,className:o.motiveStage===m?"btn-3d-brand text-left px-3 py-2.5":"btn-3d-neutral text-left px-3 py-2.5",onClick:()=>c({motiveStage:m}),"data-testid":a(`motive-${m}`),children:Rr(m,t).name},m))}),o.motiveStage&&p.jsxs("div",{className:"reveal-enter rounded-xl bg-surface-0 p-3 flex flex-col gap-1","data-testid":a("motive-flip"),children:[p.jsx("div",{className:"text-label text-ink-muted",children:Rr(o.motiveStage,t).tagline}),p.jsx("div",{className:"text-label text-accent",children:Rr(o.motiveStage,t).bot})]})]}),p.jsxs("label",{className:"flex flex-col gap-1",children:[p.jsx("span",{className:"text-label text-ink-faint",children:e("boot.card.interests.label")}),p.jsx("input",{className:"bg-surface-0 rounded-lg px-3 py-2 text-body text-ink outline-none focus:ring-2 focus:ring-accent",placeholder:e("boot.card.interests.placeholder"),value:h,onChange:m=>{f(m.target.value),c({interests:pl(m.target.value)})},onBlur:()=>{var m;return f(((m=o.interests)==null?void 0:m.join(d))??"")},"data-testid":a("interests")})]}),p.jsxs("label",{className:"flex flex-col gap-1",children:[p.jsx("span",{className:"text-label text-ink-faint",children:e("boot.card.free.label")}),p.jsx("textarea",{className:"bg-surface-0 rounded-lg px-3 py-2 text-body text-ink outline-none focus:ring-2 focus:ring-accent resize-none",rows:2,placeholder:e("boot.card.free.placeholder"),value:o.freeNote??"",onChange:m=>c({freeNote:m.target.value||null}),"data-testid":a("free")})]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsxs("button",{className:"btn-3d-brand inline-flex items-center gap-1.5 px-4 py-2",onClick:()=>r({...o,interests:pl(h),updatedAt:new Date().toISOString()}),"data-testid":a("save"),children:[p.jsx(Xl,{size:16}),e("boot.profile.save")]}),s&&p.jsxs("button",{className:"btn-3d-neutral inline-flex items-center gap-1.5 px-4 py-2",onClick:s,children:[p.jsx(In,{size:16}),e("boot.profile.cancel")]})]})]})}function hg({t:e,locale:t,value:n,onPick:r}){return p.jsxs("div",{className:"flex flex-col gap-2",children:[p.jsx("span",{className:"text-label text-ink",children:e("boot.card.mbti.label")}),p.jsx("div",{className:"grid grid-cols-4 gap-1.5",role:"radiogroup","aria-label":e("boot.card.mbti.label"),"data-testid":"boot-mbti-grid",children:eN.map(s=>p.jsx("button",{role:"radio","aria-checked":n===s,className:n===s?"btn-3d-brand text-label px-1 py-2.5":"btn-3d-neutral text-label px-1 py-2.5",onClick:()=>r(s),"data-testid":`boot-mbti-${s}`,children:s},s))}),n&&p.jsxs("div",{className:"reveal-enter rounded-xl bg-surface-0 p-3 flex flex-col gap-1","data-testid":"boot-mbti-flip",children:[p.jsxs("div",{className:"text-label font-bold text-ink",children:[n," · ",So(n,t).name]}),p.jsx("div",{className:"text-label text-ink-muted",children:So(n,t).tagline}),p.jsx("div",{className:"text-label text-accent",children:So(n,t).bot})]})]})}function oN(e){const t=e.wizardStep;return t<=1&&e.hasKey&&t===1?{scene:"profile_quiz",mood:"cheer",lines:[{key:"boot.profile_quiz.title"},{key:"boot.profile_quiz.desc"}],actions:[{kind:"wizard_next",labelKey:"boot.action.wizard_next"}],welcomeBack:!1}:t<=0?{scene:"welcome_intro",mood:"wave",lines:[{key:"boot.welcome.title"},{key:"boot.welcome.desc",vars:{name:e.name??""}},{key:"boot.welcome.forms"}],actions:[{kind:"wizard_next",labelKey:"boot.action.hello"}],welcomeBack:!1}:t===1?{scene:"key_setup",mood:"thinking",lines:[{key:"boot.key.title"},{key:"boot.key.desc"}],actions:[{kind:"settings_llm",labelKey:"boot.action.go_settings"},{kind:"wizard_next",labelKey:"boot.action.later"}],welcomeBack:!1}:t===2?{scene:"profile_quiz",mood:"cheer",lines:[{key:"boot.profile_quiz.title"},{key:"boot.profile_quiz.desc"}],actions:[{kind:"wizard_next",labelKey:e.profileFilled?"boot.action.done_quiz":"boot.action.wizard_next"}],welcomeBack:!1}:{scene:"course_pick",mood:"star",lines:[{key:"boot.pick.title"},{key:"boot.pick.desc"}],actions:[{kind:"start_import",labelKey:"boot.action.start_import"},{kind:"companion_settings",labelKey:"boot.action.companion"}],welcomeBack:!1}}function lN(e){const t=[];if(e.lastSession&&e.hasCourses)return e.dueCount>0&&t.push({kind:"review",labelKey:"boot.action.review_n"}),e.profileFilled||t.push({kind:"edit_profile",labelKey:"boot.action.edit_profile"}),{scene:"resume_last",mood:"wave",lines:[{key:"boot.resume.title",vars:{course:e.lastSession.courseTitle,node:e.lastSession.nodeTitle??""}},{key:"boot.resume.desc"},...e.dueCount>0?[{key:"boot.resume.due",vars:{n:e.dueCount}}]:[]],actions:[{kind:"resume",labelKey:"boot.action.resume"},...t.slice(0,2)],welcomeBack:!1};if(e.dueCount>0){const n=[];return e.profileFilled||n.push({kind:"edit_profile",labelKey:"boot.action.edit_profile"}),{scene:"review_due",mood:"cheer",lines:[{key:"boot.review.title",vars:{n:e.dueCount}},{key:"boot.review.desc"}],actions:[{kind:"review",labelKey:"boot.action.review"},...n.slice(0,2)],welcomeBack:!1}}return e.streak&&!e.streak.todayDone&&e.streak.atRisk?{scene:"streak_danger",mood:"star",lines:[{key:"boot.streak.title",vars:{hours:Math.max(1,Math.round(e.streak.hoursLeft))}},{key:"boot.streak.desc"}],actions:[{kind:"review",labelKey:"boot.action.keep_flame"},{kind:"pick_course",labelKey:"boot.action.pick_course"}],welcomeBack:!1}:e.suspendedExamNodeTitle?{scene:"exam_suspended",mood:"thinking",lines:[{key:"boot.exam.title",vars:{node:e.suspendedExamNodeTitle}},{key:"boot.exam.desc"}],actions:[{kind:"goto_node",labelKey:"boot.action.continue_exam",target:"exam"},{kind:"review",labelKey:"boot.action.review"}],welcomeBack:!1}:e.nearMasteryNodeTitle?{scene:"near_mastery",mood:"star",lines:[{key:"boot.mastery.title",vars:{node:e.nearMasteryNodeTitle}},{key:"boot.mastery.desc"}],actions:[{kind:"goto_node",labelKey:"boot.action.finish_it",target:"near_mastery"},{kind:"review",labelKey:"boot.action.review"}],welcomeBack:!1}:e.topFrictionNodeTitle?{scene:"friction_revisit",mood:"thinking",lines:[{key:"boot.friction.title",vars:{node:e.topFrictionNodeTitle}},{key:"boot.friction.desc"}],actions:[{kind:"goto_node",labelKey:"boot.action.retry",target:"friction"},{kind:"review",labelKey:"boot.action.review"}],welcomeBack:!1}:{scene:"ready_room",mood:"idle",lines:[{key:"boot.ready.title",vars:{name:e.name??""}},{key:e.profileFilled?"boot.ready.profile_done":"boot.ready.profile_empty"},...e.hasCourses?[{key:"boot.ready.has_courses"}]:[{key:"boot.ready.desc"}],...!e.hasKey&&!e.keyPromptDismissed?[{key:"boot.ready.key_hint"}]:[]],actions:[...e.hasCourses?[{kind:"pick_course",labelKey:"boot.action.pick_course"}]:[{kind:"pick_course",labelKey:"boot.action.import_course"}],{kind:"edit_profile",labelKey:e.profileFilled?"boot.action.view_profile":"boot.action.meet_me"}],welcomeBack:!1}}function uN(e){const t=e.bootDone?lN(e):oN(e);return e.bootDone?{...t,welcomeBack:e.returningAfterDays}:{...t,welcomeBack:!1}}const mh=4,ph=[{id:"cable-vs-wifi",better:"a",zh:{q:"同样一段数据,走网线还是走 WiFi,哪个延迟更低?",a:"网线",b:"WiFi",revealA:"对!网线是全双工专用通道,不受空气里的排队和干扰——打游戏的都懂。",revealB:"差一点!WiFi 是共享无线信道,要排队抢空气;网线是专用通道,延迟更稳更低。"},en:{q:"For the same chunk of data, which has lower latency — Ethernet cable or WiFi?",a:"Ethernet cable",b:"WiFi",revealA:"Correct! Ethernet is a dedicated full-duplex lane — no queuing in the air. Gamers know.",revealB:"Close! WiFi shares the wireless medium and queues for airtime; Ethernet is a dedicated lane with lower, steadier latency."}},{id:"http-vs-https",better:"a",zh:{q:"浏览器地址栏的 https 里的 s,保护的是哪一段?",a:"你电脑到网站之间的传输",b:"网站服务器本身不被黑",revealA:"对!s = 传输加密,防的是路上的偷看和篡改;服务器被黑是另一回事。",revealB:"不是哦——s 只加密'路上'的传输,服务器自己被攻破它管不着。"},en:{q:"In https, what does the 's' actually protect?",a:"The transport between your computer and the site",b:"The server from being hacked",revealA:"Right! s = encrypted transport — it stops eavesdropping and tampering in transit. Server breaches are a different problem.",revealB:"Not quite — the 's' only encrypts the road; if the server itself is compromised, it can't help."}},{id:"ram-vs-disk",better:"b",zh:{q:"断电后数据还在的是?",a:"内存(RAM)",b:"硬盘",revealB:"对!硬盘是持久存储;内存断电即忘——所以'保存'保存的是写进硬盘。",revealA:"恰恰相反——内存断电就忘,硬盘才记得住。'保存'就是从内存写进硬盘。"},en:{q:"Which one keeps its data after a power cut?",a:"RAM",b:"The disk",revealB:"Correct! Disks persist; RAM forgets on power loss — that's why 'save' means writing to disk.",revealA:"Other way around — RAM forgets on power loss; disks remember. 'Saving' means writing from RAM to disk."}},{id:"compile-vs-run",better:"b",zh:{q:"你写的代码,CPU 直接执行的是?",a:"你敲的源代码",b:"翻译后的机器指令",revealB:"对!CPU 只吃自己的指令集;你写的代码先被翻译(编译/解释)成机器指令。",revealA:"不不——CPU 看不懂你敲的语言,它只执行翻译后的机器指令。"},en:{q:"What does the CPU actually execute directly?",a:"The source code you type",b:"Translated machine instructions",revealB:"Correct! The CPU only speaks its own instruction set; your code is translated (compiled/interpreted) first.",revealA:"Nope — the CPU can't read your language; it runs translated machine instructions only."}},{id:"shortcut-ctrl-z",better:"a",zh:{q:"Ctrl+Z 撤销的是?",a:"上一次操作",b:"上一次保存",revealA:"对!撤销栈记的是操作历史,一步一步可以回退——是个'时间倒流'按钮。",revealB:"不是保存——撤销回退的是操作历史,跟保存点无关。"},en:{q:"What does Ctrl+Z undo?",a:"Your last action",b:"Your last save",revealA:"Right! The undo stack records action history — it's a mini time machine.",revealB:"Not saves — undo steps back through actions, not save points."}},{id:"cache-purpose",better:"a",zh:{q:"为什么删了缓存,下次打开 app 反而更慢?",a:"缓存是提前备好的常用数据",b:"删缓存把网络也删慢了",revealA:"对!缓存就是'放得近的备用件',删了它,app 只好重新去老远的地方拉一遍。",revealB:"网络没变慢——是缓存没了,常用数据得重新下载/计算一遍。"},en:{q:"Why is an app slower right after you clear its cache?",a:"Cache holds pre-fetched frequently-used data",b:"Clearing cache slows down your network",revealA:"Right! Cache is 'spare parts kept nearby'; clear it and the app must fetch everything from far away again.",revealB:"Your network didn't change — the cache is gone, so common data must be re-downloaded and recomputed."}}];function cN(e,t){const n=ph[dN(e,ph.length)];return t==="en"?{id:n.id,q:n.en.q,a:n.en.a,b:n.en.b,revealA:n.en.revealA,revealB:n.en.revealB,better:n.better}:{id:n.id,q:n.zh.q,a:n.zh.a,b:n.zh.b,revealA:n.zh.revealA,revealB:n.zh.revealB,better:n.better}}function dN(e,t){let n=2166136261;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619);return Math.abs(n)%t}const hN={wizard_next:p.jsx(Xl,{size:16}),settings_llm:p.jsx(um,{size:16}),pick_course:p.jsx(nn,{size:16}),start_import:p.jsx(Tx,{size:16}),companion_settings:p.jsx(lx,{size:16}),resume:p.jsx(gm,{size:16}),review:p.jsx(am,{size:16}),goto_node:p.jsx(cm,{size:16}),edit_profile:p.jsx(Px,{size:16})},fN={welcome_intro:p.jsx(zs,{size:22,className:"text-accent"}),key_setup:p.jsx(um,{size:22,className:"text-warning"}),profile_quiz:p.jsx(lm,{size:22,className:"text-accent"}),course_pick:p.jsx(nn,{size:22,className:"text-brand"}),resume_last:p.jsx(gm,{size:22,className:"text-brand"}),review_due:p.jsx(am,{size:22,className:"text-accent"}),streak_danger:p.jsx(da,{size:22,className:"text-review"}),friction_revisit:p.jsx(cm,{size:22,className:"text-accent"}),near_mastery:p.jsx(Em,{size:22,className:"text-gold"}),exam_suspended:p.jsx(Fi,{size:22,className:"text-warning"}),ready_room:p.jsx(zs,{size:22,className:"text-accent"})};function mN(e){var k,T;const t=Ye(),r=ha()==="en"?"en":"zh-CN",[s,i]=v.useState(null),[a,o]=v.useState(0),[l,u]=v.useState(null),c=v.useRef(!1);v.useEffect(()=>(ui(!0),()=>ui(!1)),[]),v.useEffect(()=>{let S=!0;return se.bootGetState().then(E=>{S&&(i(E),u(w=>w??wo()))}).catch(()=>{S&&u(E=>E??wo())}),se.profileGet().then(E=>{!S||!E||fh(E)&&u(w=>w&&fh(w)?w:E)}).catch(()=>{}),()=>{S=!1}},[]);const h=v.useMemo(()=>s?uN({...s,bootDone:s.bootDone&&a===0,wizardStep:a}):null,[s,a]),f=l??wo(),d=v.useCallback(S=>{u(S),se.profileSet(S).then(()=>{var E;return(E=e.onProfileChanged)==null?void 0:E.call(e)}).catch(()=>{})},[e]);v.useEffect(()=>{!s||(h==null?void 0:h.scene)!=="ready_room"||s.hasKey||s.keyPromptDismissed||c.current||(c.current=!0,se.getSetting("key_prompt_count").then(S=>{const E=Number(S??"0")||0;return se.setSetting("key_prompt_count",String(E+1))}).catch(()=>{}))},[s,h]);const m=v.useCallback(()=>{se.setSetting("boot_done","1").catch(()=>{}),i(S=>S&&{...S,bootDone:!0})},[]),b=v.useCallback((S,E)=>{if(s){if(S==="wizard_next")o(w=>Math.min(mh-1,w+1));else if(S==="settings_llm")e.onOpenSettings();else if(S==="start_import"||S==="pick_course")ui(!1),e.onPickCourse();else if(S==="companion_settings")e.onOpenSettings("companion");else if(S==="edit_profile")e.onOpenProfile();else if(S==="resume"&&s.targets.resume)m(),e.onResume(s.targets.resume.courseId,s.targets.resume.nodeId);else if(S==="review")e.onOpenReview(s.targets.reviewCourseId);else if(S==="goto_node"&&E){m();const w=E==="friction"?s.targets.frictionNodeId:E==="near_mastery"?s.targets.nearMasteryNodeId:s.targets.examNodeId;w&&e.onGotoNode(w,E)}}},[s,h,m,e]);if(!s||!h)return p.jsx("div",{className:"flex-1 flex items-center justify-center","data-testid":"boot-guide-loading",children:p.jsx("div",{className:"text-label text-ink-faint",children:t("boot.welcome.title")})});const g=(s.name??"").trim(),y=(S,E)=>t(S,{name:g?r==="en"?`${g}, `:`${g},`:"",...E});return p.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-8","data-testid":"boot-guide","data-scene":h.scene,"data-boot-done":s.bootDone?"1":"0",children:p.jsxs("div",{className:"mx-auto max-w-md flex flex-col gap-4","data-companion-anchor":"boot-guide",children:[h.welcomeBack&&p.jsx("div",{className:"text-center text-body text-accent font-bold","data-testid":"boot-welcome-back",children:y("boot.welcome_back")}),p.jsxs("section",{className:"surface-card rounded-2xl p-6 shadow-card flex flex-col gap-4","data-testid":`boot-card-${h.scene}`,children:[p.jsxs("div",{className:"flex items-center gap-3",children:[fN[h.scene],p.jsx("div",{className:"text-title font-bold text-ink",children:y(((k=h.lines[0])==null?void 0:k.key)??"boot.ready.title",(T=h.lines[0])==null?void 0:T.vars)})]}),h.lines.slice(1).map(S=>p.jsx("p",{className:"text-body text-ink-muted leading-relaxed",children:y(S.key,S.vars)},S.key)),!(h.scene==="profile_quiz"&&a===2)&&p.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:h.actions.map(S=>p.jsxs("button",{className:S===h.actions[0]?"btn-3d-brand inline-flex items-center gap-1.5 px-4 py-2":"btn-3d-neutral inline-flex items-center gap-1.5 px-4 py-2",onClick:()=>b(S.kind,S.target),"data-testid":`boot-action-${S.kind}`,children:[hN[S.kind],t(S.labelKey,S.kind==="review"&&s.dueCount>0?{n:s.dueCount}:void 0)]},S.kind+(S.target??"")))}),!s.bootDone&&!(h.scene==="profile_quiz"&&a===2)&&p.jsx("div",{className:"flex gap-1.5","data-testid":"boot-wizard-dots",children:Array.from({length:mh}).map((S,E)=>p.jsx("span",{className:`h-1.5 rounded-full transition-all ${E===a?"w-6 bg-brand":"w-2 bg-neutral-300 dark:bg-neutral-700"}`},E))})]}),!s.bootDone&&a===2?p.jsxs(p.Fragment,{children:[p.jsx(pN,{t,locale:r,profile:f,onPatch:S=>d({...f,...S,style:{...f.style,...S.style},updatedAt:new Date().toISOString()}),onFinish:()=>{m(),o(3)}}),p.jsx("button",{className:"self-start text-label text-ink-faint hover:text-ink transition-colors px-1 py-1.5",onClick:()=>b("wizard_next"),"data-testid":"boot-wizard-skip-quiz",children:t("boot.action.skip_quiz")})]}):null]})})}function pN({t:e,locale:t,profile:n,onPatch:r,onFinish:s}){const[i,a]=v.useState(0),o=v.useMemo(()=>cN(new Date().toISOString().slice(0,10),t),[t]),[l,u]=v.useState(null),[c,h]=v.useState(()=>{var m;return((m=n.interests)==null?void 0:m.join(t==="en"?", ":"、"))??""}),f=t==="en"?", ":"、",d=p.jsx("div",{className:"flex gap-1.5","data-testid":"boot-wizard-subdots",children:[0,1,2].map(m=>p.jsx("span",{className:`h-1.5 rounded-full transition-all ${m===i?"w-6 bg-brand":"w-2 bg-neutral-300 dark:bg-neutral-700"}`},m))});return i===0?p.jsxs("section",{className:"surface-card rounded-2xl p-6 shadow-card flex flex-col gap-4","data-testid":"boot-wizard-card1",children:[d,p.jsxs("label",{className:"flex flex-col gap-1",children:[p.jsx("span",{className:"text-label text-ink-faint",children:e("boot.card.name.label")}),p.jsx("input",{className:"bg-surface-0 rounded-lg px-3 py-2 text-body text-ink outline-none focus:ring-2 focus:ring-accent",placeholder:e("boot.card.name.placeholder"),value:n.name??"",onChange:m=>r({name:m.target.value||null}),"data-testid":"boot-wizard-name"})]}),p.jsx(hg,{t:e,locale:t,value:n.mbti,onPick:m=>{Pr(),r({mbti:m,style:dg(m)})}}),p.jsx("button",{className:"btn-3d-brand self-start px-4 py-2",onClick:()=>a(1),"data-testid":"boot-wizard-next1",children:n.mbti?e("boot.card.mbti.next"):e("boot.card.mbti.skip")})]}):i===1?p.jsxs("section",{className:"surface-card rounded-2xl p-6 shadow-card flex flex-col gap-4","data-testid":"boot-wizard-card2",children:[d,p.jsx("div",{className:"text-title font-bold text-ink",children:n.name?e("boot.card.motive.named",{name:n.name}):e("boot.card.motive.label")}),p.jsx("div",{className:"grid grid-cols-1 gap-1.5",role:"radiogroup","aria-label":e("boot.card.motive.label"),"data-testid":"boot-motive-grid",children:cg.map(m=>p.jsx("button",{role:"radio","aria-checked":n.motiveStage===m,className:n.motiveStage===m?"btn-3d-brand text-left px-3 py-2.5":"btn-3d-neutral text-left px-3 py-2.5",onClick:()=>{Pr(),r({motiveStage:m})},"data-testid":`boot-wizard-motive-${m}`,children:Rr(m,t).name},m))}),n.motiveStage&&p.jsxs("div",{className:"reveal-enter rounded-xl bg-surface-0 p-3 flex flex-col gap-1","data-testid":"boot-motive-flip",children:[p.jsx("div",{className:"text-label text-ink-muted",children:Rr(n.motiveStage,t).tagline}),p.jsx("div",{className:"text-label text-accent",children:Rr(n.motiveStage,t).bot})]}),p.jsxs("label",{className:"flex flex-col gap-1",children:[p.jsx("span",{className:"text-label text-ink-faint",children:e("boot.card.interests.label")}),p.jsx("input",{className:"bg-surface-0 rounded-lg px-3 py-2 text-body text-ink outline-none focus:ring-2 focus:ring-accent",placeholder:e("boot.card.interests.placeholder"),value:c,onChange:m=>{h(m.target.value),r({interests:pl(m.target.value)})},onBlur:()=>{var m;return h(((m=n.interests)==null?void 0:m.join(f))??"")},"data-testid":"boot-wizard-interests"})]}),p.jsx("button",{className:"btn-3d-brand self-start px-4 py-2",onClick:()=>a(2),"data-testid":"boot-wizard-next2",children:e("boot.card.motive.next")})]}):p.jsxs("section",{className:"surface-card rounded-2xl p-6 shadow-card flex flex-col gap-4","data-testid":"boot-wizard-card3",children:[d,p.jsx("div",{className:"text-title font-bold text-ink",children:e("boot.card.quiz.label")}),p.jsx("div",{className:"text-body text-ink",children:o.q}),l===null?p.jsxs("div",{className:"flex gap-2",role:"radiogroup","aria-label":o.q,children:[p.jsx("button",{role:"radio","aria-checked":!1,className:"btn-3d-neutral flex-1 px-3 py-2.5",onClick:()=>{u("a"),o.better==="a"&&Cr("correct")},"data-testid":"boot-wizard-quiz-a",children:o.a}),p.jsx("button",{role:"radio","aria-checked":!1,className:"btn-3d-neutral flex-1 px-3 py-2.5",onClick:()=>{u("b"),o.better==="b"&&Cr("correct")},"data-testid":"boot-wizard-quiz-b",children:o.b})]}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"reveal-enter rounded-xl bg-surface-0 p-3 text-label text-ink leading-relaxed","data-testid":"boot-wizard-quiz-reveal",children:l==="a"?o.revealA:o.revealB}),p.jsxs("button",{className:"btn-3d-brand self-start inline-flex items-center gap-1.5 px-4 py-2",onClick:s,"data-testid":"boot-wizard-finish",children:[p.jsx(Xl,{size:16}),e("boot.card.quiz.next")]})]})]})}const gh=[{id:"spacing",zh:"隔一天再复习,比当场连看三遍记得牢——间隔重复是记忆的免费午餐。",en:"Revisiting after a day beats three passes in a row — spacing is memory's free lunch."},{id:"recall",zh:"合上书回想一遍,比再读一遍有效得多。难受的感觉正是记忆在加固。",en:"Close the book and recall — far more effective than rereading. The strain IS the strengthening."},{id:"teach",zh:"学完就假装教一个外行:讲不清的地方,就是你没真懂的地方。",en:"After learning, teach it to a layman: where you can't explain clearly is where you don't understand."},{id:"interleave",zh:"交替练不同的题型,比同一题型连刷十道更接近真实考试的样子。",en:"Mixing problem types beats grinding ten of the same — it looks more like real tests."},{id:"sleep",zh:"睡眠是记忆的保存按钮——熬夜学的,大脑来不及归档。",en:"Sleep is memory's save button — the brain can't file what you crammed at 3am."},{id:"small",zh:"每天 20 分钟胜过每周末 3 小时:习惯的对手是中断,不是时长。",en:"Twenty minutes daily beats three hours on Sunday: habits die from breaks, not from shortness."},{id:"why",zh:"先问「这东西解决什么问题」再学怎么做——带着问题的脑子记得牢。",en:"Ask 'what problem does this solve' before 'how' — a question-loaded brain retains better."},{id:"mistakes",zh:"错题本不是抄题本:只记「我当时为什么会那么想」。",en:"A mistake log isn't for copying problems — record only 'why did I think that'."},{id:"analogy",zh:"新概念配一个你熟悉领域的类比,像给记忆一个挂钩。",en:"Pair every new concept with an analogy from familiar ground — give memory a hook."},{id:"env",zh:"固定的学习角落会形成条件反射:一坐下,大脑就知道该开工了。",en:"A fixed study spot builds a reflex: sit down, and the brain knows it's time."}];function gN(e,t){let n=2166136261;for(let s=0;s<e.length;s++)n^=e.charCodeAt(s),n=Math.imul(n,16777619);const r=gh[Math.abs(n)%gh.length];return{id:r.id,text:t==="en"?r.en:r.zh}}function bN(){const e=Ye(),n=ha()==="en"?"en":"zh-CN",[r,s]=v.useState(null);v.useEffect(()=>{let l=!0;return se.bootGetState().then(u=>{l&&s(u)}).catch(()=>{}),()=>{l=!1}},[]);const i=gN(new Date().toISOString().slice(0,10),n),a=(r==null?void 0:r.recap)??null,o=!!a&&(a.totalXp>0||a.masteredCount>0||a.streakDays>0);return p.jsx("div",{className:"h-full overflow-y-auto px-5 py-8","data-testid":"notebook-panel",children:p.jsx("div",{className:"h-full","data-testid":"boot-recap","data-mode":o?"recap":"tips",children:p.jsx("div",{className:"mx-auto max-w-sm flex flex-col gap-4",children:o&&a?p.jsxs("section",{className:"surface-card rounded-2xl p-5 shadow-card flex flex-col gap-4","data-testid":"boot-recap-card",children:[p.jsx("div",{className:"text-label font-bold text-ink",children:e("boot.recap.title")}),p.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[p.jsxs("div",{className:"rounded-xl bg-surface-0 p-3 flex flex-col gap-1","data-testid":"boot-recap-xp",children:[p.jsx(Vs,{size:18,className:"text-brand self-center"}),p.jsx("div",{className:"text-title font-bold text-ink",children:a.totalXp}),p.jsx("div",{className:"text-caption text-ink-muted",children:e("boot.recap.total_xp")})]}),p.jsxs("div",{className:"rounded-xl bg-surface-0 p-3 flex flex-col gap-1","data-testid":"boot-recap-mastered",children:[p.jsx(Zl,{size:18,className:"text-gold self-center"}),p.jsx("div",{className:"text-title font-bold text-ink",children:a.masteredCount}),p.jsx("div",{className:"text-caption text-ink-muted",children:e("boot.recap.mastered")})]}),p.jsxs("div",{className:"rounded-xl bg-surface-0 p-3 flex flex-col gap-1","data-testid":"boot-recap-streak",children:[p.jsx(da,{size:18,className:"text-review self-center"}),p.jsx("div",{className:"text-title font-bold text-ink",children:a.streakDays}),p.jsx("div",{className:"text-caption text-ink-muted",children:e("boot.recap.streak_days")})]})]}),(r==null?void 0:r.lastSession)&&p.jsxs("div",{className:"flex items-start gap-2 text-label text-ink-muted","data-testid":"boot-recap-recent",children:[p.jsx(nn,{size:15,className:"shrink-0 mt-0.5 text-accent"}),p.jsxs("span",{children:[e("boot.recap.recent"),n==="en"?`: "${r.lastSession.courseTitle}"`:`:「${r.lastSession.courseTitle}」`,r.lastSession.nodeTitle?` · ${r.lastSession.nodeTitle}`:""]})]})]}):p.jsxs("section",{className:"surface-card rounded-2xl p-5 shadow-card flex flex-col gap-3","data-testid":"boot-tips-card",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(dm,{size:18,className:"text-accent"}),p.jsx("div",{className:"text-label font-bold text-ink",children:e("boot.recap.tips_title")})]}),p.jsx("p",{className:"text-body text-ink-muted leading-relaxed","data-testid":"boot-tip-text",children:i.text})]})})})})}const bh=[{bg:"#E8F0FE",fg:"#1a56DB"},{bg:"#E6F4EA",fg:"#137333"},{bg:"#FDF0E6",fg:"#B25000"},{bg:"#F3E8FD",fg:"#6B21A8"},{bg:"#FDE8E8",fg:"#B91C1C"},{bg:"#E0F2F1",fg:"#00695C"},{bg:"#FEF9E7",fg:"#92760B"},{bg:"#ECEFF1",fg:"#455A64"}];function xN(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return Math.abs(t)}function yN(e){const t=(e??"").trim();if(!t)return null;const n=[...t][0]??"",r=/[a-z]/i.test(n)?n.toUpperCase():n,s=bh[xN(t.toLowerCase())%bh.length];return{bg:s.bg,fg:s.fg,initial:r}}function EN(e){const[t,n]=v.useState([]),[r,s]=v.useState(!0),i=v.useCallback(async()=>{if(!e){n([]),s(!1);return}try{const m=await se.canvasList(e);n(m)}catch{n([])}finally{s(!1)}},[e]);v.useEffect(()=>{i()},[i]);const a=v.useCallback(async m=>{if(!e)return null;try{const b=await se.canvasSave({...m,courseId:e});return n(g=>g.some(y=>y.id===b.id)?g:[b,...g]),b}catch{return null}},[e]),o=v.useCallback(async m=>{if(!e)return null;try{const b=await se.canvasSaveUserNote({...m,courseId:e});return n(g=>[b,...g]),b}catch{return null}},[e]),l=v.useCallback(async(m,b)=>{try{const g=await se.canvasRecordQuizResult(m,b);return g&&n(y=>y.map(k=>k.id===m?g:k)),g}catch{return null}},[]),u=v.useCallback(async(m,b)=>{try{const g=await se.canvasUpdateUserNoteComment(m,b);return g&&n(y=>y.map(k=>k.id===m?g:k)),g}catch{return null}},[]),c=v.useCallback(async m=>{try{await se.canvasDelete(m),n(b=>b.filter(g=>g.id!==m))}catch{}},[]),h=v.useCallback(async m=>{try{const b=await se.canvasTogglePin(m);b&&n(g=>g.map(k=>k.id===m?b:k).sort((k,T)=>T.pinned!==k.pinned?T.pinned-k.pinned:T.createdAt.localeCompare(k.createdAt)))}catch{}},[]),f=v.useCallback(m=>m===null?t:t.filter(b=>b.nodeId===m),[t]),d=v.useCallback((m,b)=>{const g=m===null?t:t.filter(y=>y.nodeId===m);return b==="note"?g.filter(y=>y.artifactType==="user_note"):b==="practice"?g.filter(y=>y.artifactType==="quiz"):g.filter(y=>["concept_map","compare_table","diagram","code_walkthrough"].includes(y.artifactType))},[t]);return{items:t,loading:r,reload:i,save:a,saveUserNote:o,recordQuizResult:l,updateUserNoteComment:u,remove:c,togglePin:h,byNode:f,byZone:d}}const xh={small:16,medium:17,large:18},yh="lookatstudy-font-size",vN="medium";function TN(){const[e,t]=v.useState(()=>{if(typeof localStorage<"u"){const r=localStorage.getItem(yh);if(r&&r in xh)return r}return vN});v.useEffect(()=>{document.documentElement.style.fontSize=`${xh[e]}px`,localStorage.setItem(yh,e)},[e]);const n=v.useCallback(r=>{t(s=>{const i=["small","medium","large"],a=i.indexOf(s),o=r==="up"?Math.min(a+1,i.length-1):Math.max(a-1,0);return i[o]})},[]);return{size:e,bump:n}}const Ao=new Map;function kN({ref_:e,onOpen:t}){const n=Ye(),[r,s]=v.useState(e.previewUrl??(e.file?Ao.get(e.file)??null:null));return v.useEffect(()=>{if(r||!e.file)return;let i=!1;return(async()=>{const a=Ao.get(e.file);if(a){i||s(a);return}const o=await se.getAttachmentDataUrl(e.file);o&&!i&&(Ao.set(e.file,o),s(o))})(),()=>{i=!0}},[e.file,r]),r?p.jsx("button",{type:"button",onClick:()=>t(r),"aria-label":n("chat.attach.preview",{name:e.name}),className:"w-24 h-24 rounded-lg overflow-hidden border border-[var(--border)] hover:border-accent transition-colors shrink-0",children:p.jsx("img",{src:r,alt:e.name,className:"w-full h-full object-cover"})}):p.jsx("div",{className:"w-24 h-24 rounded-lg bg-ink/[0.06] flex items-center justify-center text-caption text-ink-faint",title:e.name,children:e.name.slice(0,8)})}function wN({src:e,name:t,onClose:n}){return v.useEffect(()=>{const r=s=>{s.key==="Escape"&&n()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[n]),p.jsxs("div",{role:"dialog","aria-label":t,className:"fixed inset-0 z-[70] bg-black/80 flex items-center justify-center p-8 cursor-zoom-out animate-[toast-enter_.15s_ease-out]",onClick:n,"data-testid":"attachment-lightbox",children:[p.jsx("img",{src:e,alt:t,className:"max-w-full max-h-full object-contain rounded-lg shadow-elevated"}),p.jsx("button",{type:"button","aria-label":"close",onClick:n,className:"absolute top-4 right-4 w-9 h-9 rounded-full bg-white/10 hover:bg-white/20 text-white flex items-center justify-center transition-colors",children:p.jsx(In,{className:"w-4 h-4"})})]})}function SN({parts:e}){const t=Ye(),[n,r]=v.useState(null),s=e.filter(o=>o.type==="attachment").map(o=>o.attachment);if(s.length===0)return null;const i=s.filter(o=>o.kind==="image"),a=s.filter(o=>o.kind==="text");return p.jsxs("div",{className:"flex flex-col gap-1.5 mb-1","data-testid":"message-attachments",children:[i.length>0&&p.jsx("div",{className:"flex gap-1.5 flex-wrap",children:i.map((o,l)=>p.jsx(kN,{ref_:o,onOpen:u=>r({src:u,name:o.name})},o.file??o.previewUrl??`${o.name}:${l}`))}),a.length>0&&p.jsx("div",{className:"flex gap-1.5 flex-wrap",children:a.map((o,l)=>p.jsxs("span",{"data-tooltip":t("chat.attach.textChip"),className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-ink/[0.06] text-caption text-ink-muted",children:[p.jsx(Fi,{className:"w-3 h-3 shrink-0"}),p.jsx("span",{className:"truncate max-w-[12rem]",children:o.name})]},`${o.name}:${l}`))}),n&&p.jsx(wN,{src:n.src,name:n.name,onClose:()=>r(null)})]})}const AN=v.lazy(()=>Ae(()=>import("./index-pqxwzTgM.js"),__vite__mapDeps([30,1,2,28,29,31]),import.meta.url).then(e=>({default:e.ArtifactRenderer})));function CN({messages:e,streaming:t,onApplyProposal:n,onRejectProposal:r,summary:s,onStartLearning:i,agentReady:a=!0,onGotoSettings:o,hasNode:l=!0,selectedNodeId:u,threadId:c,onSaveChatNote:h,chatNotes:f,onPickQuizAction:d,onQuizCompleted:m,cardMode:b=!1}){const g=Ye(),y=Cu(),k=ig();v.useEffect(()=>{if(k.failReason){const F=k.failReason==="engine-unavailable"?"chat.speech.engine_unavailable":k.failReason==="azure-key-missing"?"chat.speech.azure_key_missing":k.failReason==="azure-region-missing"?"chat.speech.azure_region_missing":k.failReason==="edge-failed"?"chat.speech.edge_failed":k.failReason==="custom-provider-missing"?"chat.speech.custom_provider_missing":"chat.speech.model_missing";y.show(g(F),{severity:"warning"}),k.clearFailReason()}},[k.failReason,y,g,k]),v.useEffect(()=>{k.onlineNotice&&(y.show(g("chat.speech.edge_disclosed"),{severity:"info"}),k.clearOnlineNotice())},[k.onlineNotice,y,g,k]);const T=v.useCallback((F,V,I)=>{u&&se.recordQuizAnswer(u,I,F.kc).catch(()=>{})},[u]),[S,E]=v.useState(null);v.useEffect(()=>{if(!u){E(null);return}let F=!1;const V=()=>se.getProgress(u).then(W=>{F||E((W==null?void 0:W.mastery)??null)}).catch(()=>{});V();const I=se.on("state:changed",W=>{W==="mastery"&&V()});return()=>{F=!0,I()}},[u]);const w=v.useRef(null),_=v.useRef(!0),[A,N]=v.useState(!1);v.useEffect(()=>{const F=V=>{const I=V.detail;if(!(I!=null&&I.msgId))return;const W=document.querySelector(`[data-msg-id="${I.msgId}"]`);W&&(W.scrollIntoView({behavior:"smooth",block:"center"}),W.classList.add("ring-2","ring-accent","rounded-lg"),setTimeout(()=>W.classList.remove("ring-2","ring-accent","rounded-lg"),2500))};return window.addEventListener("lookatstudy-highlight-message",F),()=>window.removeEventListener("lookatstudy-highlight-message",F)},[]),v.useEffect(()=>{if(t||!w.current||!f||f.length===0)return;const F=setTimeout(()=>{if(!w.current)return;const V=new Map;for(const I of f)try{const W=JSON.parse(I.sourceAnchor);if(W.type==="chat"&&W.msgId){const K=JSON.parse(I.data).text??"";if(K){const D=V.get(W.msgId)??[];D.push({noteId:I.id,text:K}),V.set(W.msgId,D)}}}catch{}for(const[I,W]of V){const K=w.current.querySelector(`[data-msg-id="${I}"]`);K&&(yi()?U0(K,W):j0(K,W))}},150);return()=>clearTimeout(F)},[e,f,t]),v.useEffect(()=>{const F=V=>{var K;const I=V.detail;if(!I)return;if(yi()){const D=z0(I);D&&V0(D);return}const W=(K=w.current)==null?void 0:K.querySelector(`mark[data-note-id="${I}"]`);W&&Q0(W)};return window.addEventListener("lookatstudy-jump-to-chat-note",F),()=>window.removeEventListener("lookatstudy-jump-to-chat-note",F)},[]);const[C,L]=v.useState(null),M=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,H=v.useCallback(()=>{if(!h||!c)return;const F=window.getSelection(),V=(F==null?void 0:F.toString().trim())??"";if(V.length<2||V.length>500){L(null);return}const I=F==null?void 0:F.getRangeAt(0);if(!I){L(null);return}const W=w.current;if(!(W!=null&&W.contains(I.commonAncestorContainer))){L(null);return}let K=I.commonAncestorContainer,D=null;for(;K&&K!==W;){if(K instanceof HTMLElement&&K.dataset.msgId){D=K;break}K=K.parentNode}if(!D){L(null);return}const ne=D.dataset.msgId,oe=dr(D),J=O0(I,oe),Y=I.getBoundingClientRect(),X=W.getBoundingClientRect(),de=I.getClientRects(),ge=de.length?de[de.length-1]:Y,ee=J0({left:Y.left-X.left,top:Y.top-X.top,right:Y.right-X.left,bottom:Y.bottom-X.top,width:Y.width,height:Y.height},X.width,M?150:110,{left:ge.left-X.left,top:ge.top-X.top,right:ge.right-X.left,bottom:ge.bottom-X.top,width:ge.width,height:ge.height},M);L({x:ee.left,y:ee.top,transform:ee.transform,text:V,msgId:ne,startOffset:J==null?void 0:J.start,endOffset:J==null?void 0:J.end})},[h,c,M]);v.useEffect(()=>{const F=M?600:250;let V=null,I=null,W=!1;const K=()=>{var J;return(((J=window.getSelection())==null?void 0:J.toString().trim().length)??0)>=2},D=()=>{K()?(I&&(clearTimeout(I),I=null),L(J=>J&&null),V&&clearTimeout(V),V=setTimeout(()=>{V=null,!W&&K()&&H()},F)):I||(I=setTimeout(()=>L(J=>J&&null),250))},ne=J=>{var X;const Y=J.target;(X=Y==null?void 0:Y.closest)!=null&&X.call(Y,"[data-selection-popover]")||(W=!0)},oe=()=>{W=!1,V&&(clearTimeout(V),V=null),!I&&K()&&H()};return document.addEventListener("selectionchange",D),window.addEventListener("pointerdown",ne,!0),window.addEventListener("pointerup",oe,!0),window.addEventListener("pointercancel",oe,!0),()=>{document.removeEventListener("selectionchange",D),window.removeEventListener("pointerdown",ne,!0),window.removeEventListener("pointerup",oe,!0),window.removeEventListener("pointercancel",oe,!0),V&&clearTimeout(V),I&&clearTimeout(I)}},[H]);const P=v.useCallback(()=>{var V;if(!C||!h)return;const F=C.text.length>200?C.text.slice(0,200)+"…":C.text;h(F,C.msgId,C.startOffset,C.endOffset),L(null),(V=window.getSelection())==null||V.removeAllRanges()},[C,h]),R=v.useCallback(()=>{const F=w.current;if(!F)return;const V=F.scrollHeight-F.scrollTop-F.clientHeight<80;_.current=V,N(I=>I===!V?I:!V)},[]);v.useEffect(()=>{if(!_.current)return;const F=w.current;F&&(F.scrollTop=F.scrollHeight)},[e,t]);const B=e.length>0&&e[e.length-1].role==="user";v.useEffect(()=>{if(!B)return;_.current=!0,N(!1);const F=w.current;F&&(F.scrollTop=F.scrollHeight)},[B]);const q=v.useCallback(()=>{const F=w.current;F&&(F.scrollTop=F.scrollHeight,_.current=!0,N(!1))},[]);return p.jsxs("div",{className:"relative flex-1 min-h-0",children:[p.jsxs("div",{ref:w,onScroll:R,className:`h-full overflow-y-auto px-3 py-4 space-y-2 relative ${b?"":"px-5 py-6 space-y-6"}`,"data-testid":"chat-stream",children:[e.length===0&&p.jsx("div",{className:"mt-10 mx-auto max-w-md","data-testid":"chat-empty-state",children:l?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"text-center mb-4",children:[p.jsx("div",{className:"text-4xl mb-2 opacity-30",children:"📖"}),p.jsx("div",{className:"text-body font-bold text-ink-muted mb-1",children:g("chat.empty.greeting")}),p.jsx("div",{className:"text-ink-muted text-label",children:g("chat.empty.overview")})]}),s?p.jsxs("div",{className:"surface-card p-4 mb-4",children:[p.jsx("div",{className:"text-caption font-bold text-brand uppercase tracking-wider mb-2",children:g("chat.empty.summary.title")}),p.jsx("div",{className:"text-body text-ink-muted leading-relaxed whitespace-pre-wrap",children:s})]}):p.jsx("div",{className:"surface-card p-4 mb-4 text-center",children:p.jsx("div",{className:"text-body text-ink-muted",children:g("chat.empty.summary.none")})}),a?p.jsx(p.Fragment,{children:i&&p.jsxs("button",{onClick:i,disabled:t,"data-testid":"start-learning-btn",className:"btn-3d-brand w-full py-3 text-body font-bold flex items-center justify-center gap-2 disabled:opacity-40",children:[p.jsx(Dx,{className:"w-4 h-4"}),p.jsx("span",{children:g("chat.empty.start")})]})}):p.jsxs("div",{className:"surface-card p-4 mb-2","data-testid":"keyless-card",children:[p.jsx("div",{className:"text-body font-bold text-ink-muted mb-1",children:g("chat.empty.keyless.title")}),p.jsx("div",{className:"text-label text-ink-muted mb-3",children:g("chat.empty.keyless.desc")}),p.jsxs("button",{onClick:o,className:"btn-3d-brand w-full py-2 text-body font-bold flex items-center justify-center gap-2",children:[p.jsx(Us,{className:"w-4 h-4"}),p.jsx("span",{children:g("chat.empty.keyless.btn")})]})]})]}):p.jsxs("div",{className:"text-center mt-16","data-testid":"no-node-selected",children:[p.jsx("div",{className:"text-5xl mb-3 opacity-25",children:"🗺️"}),p.jsx("div",{className:"text-body font-bold text-ink-muted mb-1",children:g("chat.empty.no_node.title")}),p.jsx("div",{className:"text-body text-ink-muted max-w-xs mx-auto",children:g("chat.empty.no_node.desc")})]})}),e.map(F=>p.jsx("div",{className:b?"":"contents",children:p.jsx("div",{className:b&&F.role==="assistant"?"surface-card p-4 rounded-2xl shadow-card":void 0,children:p.jsx(_N,{msg:F,onApplyProposal:n,onRejectProposal:r,onQuizAnswered:T,quizMastery:S,onPickAction:d,onQuizCompleted:m,speakingMessageId:k.speakingMessageId,speakingSentence:k.speakingSentence,playingSentence:k.playingSentence,streamTexts:k.streamTexts,onSpeak:k.speak})})},F.id)),t&&p.jsxs("div",{className:"flex items-center gap-1.5 text-body text-brand",children:[p.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),p.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),p.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"})]})]}),A&&e.length>0&&p.jsxs("button",{onClick:q,"data-testid":"scroll-to-bottom","aria-label":g("chat.scroll.bottom"),title:g("chat.scroll.bottom"),className:"absolute bottom-4 right-4 w-9 h-9 rounded-full bg-ink-strong text-surface-0 shadow-elevated flex items-center justify-center hover:scale-105 active:scale-95 transition-transform msg-enter",children:[p.jsx(ca,{className:"w-5 h-5"}),t&&p.jsx("span",{className:"absolute -top-0.5 -right-0.5 w-2.5 h-2.5 bg-brand rounded-full border-2 border-[var(--ink-strong)] animate-pulse"})]}),C&&p.jsxs("button",{onClick:P,"data-testid":"save-chat-note-btn","data-selection-popover":!0,style:{left:C.x,top:C.y,transform:C.transform},className:"absolute z-20 px-3 py-1.5 rounded-lg bg-brand text-white text-body font-bold shadow-elevated flex items-center gap-1 hover:bg-brand-light transition msg-enter whitespace-nowrap",title:g("chat.note.add.title"),children:[p.jsx(Ai,{className:"w-3 h-3"})," ",g("chat.note.add")]})]})}function Eh(e){const t=[];for(const n of e)if(n.role==="assistant")for(let r=0;r<n.parts.length;r++){const s=n.parts[r];s.type==="tool-call"&&s.state==="output-available"&&s.output&&typeof s.output=="object"&&"artifactType"in s.output&&t.push({id:`${n.id}-${r}`,toolName:s.toolName,output:s.output})}return t}function _N({msg:e,onApplyProposal:t,onRejectProposal:n,onQuizAnswered:r,quizMastery:s,onPickAction:i,onQuizCompleted:a,speakingMessageId:o,speakingSentence:l,playingSentence:u,streamTexts:c,onSpeak:h}){const f=Ye(),d=v.useRef(null),m=e.parts.map(k=>k.type==="text"?k.text:"").join("").trim(),b=o===e.id,g=b&&u!=null?u.index:null;v.useEffect(()=>{const k=d.current;if(!k)return;if(g==null){ar(k);return}const T=L0(c??[],g);if(!T)return;g===0&&G0(k);const S=setTimeout(()=>{const E=K0(k,T,{within:'[data-testid="part-text"]'});E&&X0(E,k.closest(".overflow-y-auto"))},30);return()=>clearTimeout(S)},[g,c]),v.useEffect(()=>{g==null&&d.current&&ar(d.current)},[g]);const y=v.useRef(!1);return y.current=g!=null,v.useEffect(()=>()=>{y.current&&ar(document.body)},[]),e.role==="user"?p.jsx("div",{className:"msg-enter flex justify-end","data-testid":"msg-user","data-msg-id":e.id,children:p.jsxs("div",{className:"max-w-[85%] bg-ink/[0.04] rounded-2xl rounded-br-md px-4 py-2.5",children:[p.jsx(SN,{parts:e.parts}),p.jsx("div",{className:"font-medium text-ink-strong whitespace-pre-wrap select-text text-body",children:e.displayText??e.parts.map((k,T)=>k.type==="text"?p.jsx("span",{children:k.text},T):null)})]})}):p.jsxs("div",{className:"msg-enter",ref:d,"data-testid":"msg-assistant","data-msg-id":e.id,children:[p.jsx("div",{className:"min-w-0 space-y-2.5",children:e.parts.map((k,T)=>p.jsx(NN,{part:k,msgId:e.id,toolCallIdx:T,onApplyProposal:t,onRejectProposal:n,onQuizAnswered:r,quizMastery:s,onPickAction:i,onQuizCompleted:a},T))}),h&&m&&p.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[p.jsx("button",{onClick:()=>h(e.id,m),"data-testid":b?"speech-stop-btn":"speech-speak-btn","aria-label":f(b?"chat.speech.stop":"chat.speech.speak"),title:f(b?"chat.speech.stop":"chat.speech.speak"),className:`w-7 h-7 rounded-lg flex items-center justify-center transition ${b?"bg-brand/15 text-brand":"text-ink-muted hover:bg-ink/[0.06] hover:text-ink"}`,children:b?p.jsx(Jl,{className:"w-3.5 h-3.5"}):p.jsx(vm,{className:"w-4 h-4"})}),b&&l&&l.total>0&&p.jsx("span",{className:"text-caption text-ink-muted",children:f("chat.speech.progress").replace("{n}",String(l.index+1)).replace("{total}",String(l.total))})]})]})}function NN({part:e,msgId:t,toolCallIdx:n,onApplyProposal:r,onRejectProposal:s,onQuizAnswered:i,quizMastery:a,onPickAction:o,onQuizCompleted:l}){const u=M0(e.type==="text"?e.text:"");if(e.type==="text")return p.jsx("div",{className:"prose prose-sm max-w-[80ch] leading-relaxed break-words [&_pre]:max-w-full [&_pre]:overflow-x-auto [&_img]:max-w-full [&_video]:max-w-full [&_iframe]:max-w-full select-text","data-testid":"part-text",children:p.jsx(Ep,{remarkPlugins:u.remarkPlugins,rehypePlugins:u.rehypePlugins,components:PN,children:Z0(e.text)})});if(e.type==="reasoning")return p.jsx(IN,{text:e.text});if(e.type!=="tool-call")return null;const{toolName:c,state:h,output:f,error:d}=e;return p.jsx(RN,{toolName:c,state:h,output:f,error:d,msgId:t,toolCallIdx:n,onApplyProposal:r,onRejectProposal:s,onQuizAnswered:i,quizMastery:a,onPickAction:o,onQuizCompleted:l})}function IN({text:e}){const t=Ye(),[n,r]=v.useState(!1);return p.jsxs("div",{className:"rounded-lg bg-surface-1/60 border border-[var(--border-faint)]","data-testid":"part-reasoning",children:[p.jsxs("button",{onClick:()=>r(s=>!s),className:"w-full flex items-center justify-between px-3 py-1.5 text-label font-bold text-ink-muted hover:text-ink-strong transition-colors",children:[p.jsxs("span",{children:[n?"▾":"▸"," ",t("chat.reasoning.label")]}),p.jsx("span",{className:"text-ink-muted font-normal",children:t("chat.reasoning.chars",{n:e.length})})]}),n&&p.jsx("div",{className:"px-3 pb-2.5 text-label text-ink-muted whitespace-pre-wrap leading-relaxed border-t border-[var(--border-faint)]/60 pt-2",children:e})]})}function RN({toolName:e,state:t,output:n,error:r,msgId:s,toolCallIdx:i,onApplyProposal:a,onRejectProposal:o,onQuizAnswered:l,quizMastery:u,onPickAction:c,onQuizCompleted:h}){const f=Ye(),d=e==="record_answer"||e==="mark_mastered";if(e==="update_learner_profile"&&t==="output-available")return p.jsxs("div",{className:"rounded-xl border border-ink/10 bg-ink/5 p-3 flex items-center gap-2","data-testid":"part-profile-suggest",children:[p.jsx(qx,{className:"w-4 h-4 text-accent shrink-0"}),p.jsx("span",{className:"text-label text-ink-muted",children:f("chat.profile_sent")})]});const m=d&&t==="output-available"&&typeof n=="object"&&n!==null?n:null;if(m!=null&&m.proposalId){const y=m.status;return y==="applied"?p.jsxs("div",{className:"proposal-card rounded-xl border border-gold/30 bg-gold/5 p-3 flex items-center gap-2","data-testid":"part-proposal",children:[p.jsx(Ql,{className:"w-4 h-4 text-gold shrink-0"}),p.jsx("span",{className:"text-body font-bold text-ink",children:f("chat.proposal.applied")})]}):y==="rejected"?p.jsxs("div",{className:"proposal-card rounded-xl border border-ink/10 bg-ink/5 p-3 flex items-center gap-2","data-testid":"part-proposal",children:[p.jsx(fx,{className:"w-4 h-4 text-ink-muted shrink-0"}),p.jsx("span",{className:"text-body text-ink-muted",children:f("chat.proposal.rejected")})]}):p.jsxs("div",{className:"proposal-card relative rounded-xl border border-brand/30 bg-brand/5 overflow-hidden","data-testid":"part-proposal",children:[p.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 bg-brand"}),p.jsxs("div",{className:"pl-4 pr-3 py-3",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[p.jsx("span",{className:"flex items-center justify-center w-7 h-7 rounded-lg bg-brand/15 text-brand shrink-0",children:p.jsx(lm,{className:"w-4 h-4"})}),p.jsx("span",{className:"text-lead font-bold text-ink",children:f("chat.proposal.mastered.title")})]}),m.message&&p.jsx("div",{className:"text-body text-ink mb-2 leading-relaxed",children:m.message}),p.jsx("div",{className:"text-caption text-ink-muted mb-3",children:f("chat.proposal.mastered.hint")}),p.jsxs("div",{className:"flex gap-2",children:[p.jsxs("button",{onClick:()=>a==null?void 0:a(m.proposalId,s,i),"data-testid":"proposal-apply",className:"btn-3d-brand px-4 py-1.5 text-body",children:[p.jsx(En,{className:"w-3.5 h-3.5 inline"}),f("chat.proposal.confirm")]}),p.jsx("button",{onClick:()=>o==null?void 0:o(m.proposalId,s,i),"data-testid":"proposal-reject",className:"btn-3d-neutral px-4 py-1.5 text-body",children:f("chat.proposal.later")})]})]})]})}if(t==="output-available"&&n&&typeof n=="object"&&"artifactType"in n){const y=n.artifactType;return p.jsx("div",{className:"my-1 max-w-full","data-testid":`inline-artifact-${y}`,"data-tool":e,children:p.jsx(v.Suspense,{fallback:null,children:p.jsx(AN,{data:n,onQuizAnswered:l,quizMastery:u,onPickAction:c,onQuizCompleted:h})})})}const g=MN(e,f);return p.jsx("div",{className:"inline-flex items-center gap-1.5 text-label px-2.5 py-1 rounded-md bg-surface-1/60 border border-[var(--border-faint)]","data-testid":"part-tool","data-tool":e,"data-state":t,children:t==="input-available"?p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),p.jsxs("span",{className:"text-ink-muted",children:[g,"…"]})]}):t==="output-error"?p.jsxs(p.Fragment,{children:[p.jsx(sm,{className:"w-3.5 h-3.5 text-warning shrink-0"}),p.jsxs("span",{className:"text-warning",children:[g,": ",r]})]}):p.jsxs(p.Fragment,{children:[p.jsx(Tm,{className:"w-3.5 h-3.5 text-ink-faint shrink-0"}),p.jsx("span",{className:"text-ink-muted",children:g})]})})}const PN={pre({children:e,...t}){return p.jsx(lg,{...t,children:e})},a({children:e,...t}){return p.jsx("a",{...t,target:"_blank",rel:"noopener noreferrer",children:e})},table({children:e}){return p.jsx("div",{className:"overflow-x-auto my-4",children:p.jsx("table",{children:e})})}};function MN(e,t){return{get_node_info:t("chat.tool.get_node_info"),record_answer:t("chat.tool.record_answer"),mark_mastered:t("chat.tool.mark_mastered"),show_concept_map:t("chat.tool.show_concept_map"),generate_quiz:t("chat.tool.generate_quiz"),compare_table:t("chat.tool.compare_table"),draw_diagram:t("chat.tool.draw_diagram"),show_code_walkthrough:t("chat.tool.show_code_walkthrough")}[e]??e}const Ei={maxPerMessage:4,maxImageBytes:5*1024*1024,maxTextBytes:256*1024},LN=new Set(["txt","md","markdown","rst","org","adoc","log","csv","tsv","json","yaml","yml","toml","ini","env","py","js","mjs","cjs","ts","tsx","jsx","go","rs","java","c","h","cpp","hpp","cs","rb","sh","bash","zsh","ps1","sql","html","htm","css","scss","vue","svelte","kt","swift","php","lua","r","dart","scala","clj","ex","exs","erl","hs","ml","jl","m","mm","pl","vb","bat","dockerfile"]);function vh(e){const t=e.lastIndexOf(".");return t<=0||t===e.length-1?"":e.slice(t+1).toLowerCase()}function DN(e,t,n){return t&&t.startsWith("image/")||["png","jpg","jpeg","webp","gif","bmp"].includes(vh(e))?n>Ei.maxImageBytes?{ok:!1,reason:"tooLargeImage"}:{ok:!0,kind:"image"}:LN.has(vh(e))?n>Ei.maxTextBytes?{ok:!1,reason:"tooLargeText"}:{ok:!0,kind:"text"}:{ok:!1,reason:"unsupported"}}function ON(e,t){const n=e.length,r=n*2,s=new ArrayBuffer(44+r),i=new DataView(s),a=(l,u)=>{for(let c=0;c<u.length;c++)i.setUint8(l+c,u.charCodeAt(c))};a(0,"RIFF"),i.setUint32(4,36+r,!0),a(8,"WAVE"),a(12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,t,!0),i.setUint32(28,t*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),a(36,"data"),i.setUint32(40,r,!0);let o=44;for(let l=0;l<n;l++){const u=e[l]<=-1?-1:e[l]>=1?1:e[l];i.setInt16(o,Math.round(u*32767),!0),o+=2}return s}function BN(e,t){const n=Math.floor(e.length/t),r=new Float32Array(n);for(let s=0;s<n;s++){const i=s*t,a=Math.floor(i),o=i-a,l=e[a]??0,u=e[a+1]??l;r[s]=l+(u-l)*o}return r}function FN(e,t,n={}){if(e.length===0||e.length!==t.length)return e;const r=n.threshold??.012;let s=0;for(;s<e.length-1&&t[s]<r;)s+=1;let i=e.length;for(;i>s+1&&t[i-1]<r;)i-=1;return e.slice(s,i)}function jN(e={}){const t=e.rmsThreshold??.015,n=e.minSpeechMs??300,r=e.silenceMs??1200,s=e.maxMs??6e4,i=e.autoStop!==!1;let a=null,o=0,l=null,u=null,c=!1;return{feed(h,f){a==null&&(a=f);const d=u==null?0:Math.max(0,f-u);if(u=f,h>=t)o+=d,o>=n&&(c=!0,l=f);else if(i&&c&&l!=null&&f-l>=r)return"auto-stop";return i&&f-a>=s?"auto-stop":"listening"},hadSpeech(){return c}}}const Co=16e3;function HN(e,t={}){const[n,r]=v.useState(!1),[s,i]=v.useState(!1),[a,o]=v.useState(0),[l,u]=v.useState(null),[c,h]=v.useState(null),f=v.useRef(null),d=v.useRef(null),m=v.useRef(null),b=v.useRef([]),g=v.useRef([]),y=v.useRef(!1),k=v.useRef(null),T=v.useRef(0),S=v.useRef(e);S.current=e;const E=v.useRef(t);E.current=t;const w=v.useRef(!1),_=v.useRef(!1),A=v.useCallback(()=>{var H,P,R;y.current=!1,(H=m.current)==null||H.disconnect(),m.current=null,(P=d.current)==null||P.getTracks().forEach(B=>B.stop()),d.current=null,(R=f.current)==null||R.close().catch(()=>{}),f.current=null,b.current=[],g.current=[],k.current=null,o(0)},[]),N=v.useCallback(()=>{var K;const H=b.current,P=g.current,R=((K=k.current)==null?void 0:K.hadSpeech())??!1;b.current=[],g.current=[];let B=0;for(const D of H)B+=D.length;if(A(),r(!1),B===0)return;if(!R){h("no-speech");return}const q=FN(H,P);let F=0;for(const D of q)F+=D.length;const V=new Float32Array(F);let I=0;for(const D of q)V.set(D,I),I+=D.length;const W=ON(V,Co);i(!0),h(null),window.api.asrTranscribe(W,E.current.locale).then(D=>{D.ok?S.current(D.text):h(D.reason)}).catch(()=>h("asr-failed")).finally(()=>i(!1))},[A]),C=v.useCallback(()=>{y.current&&N()},[N]),L=v.useCallback(()=>{y.current||w.current||(u(null),w.current=!0,(async()=>{var H;try{if(((H=navigator.mediaDevices)==null?void 0:H.getUserMedia)==null){u(window.isSecureContext?"mic-unavailable":"mic-insecure-context");return}const P=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0}}),R=window.AudioContext??window.webkitAudioContext;let B;try{B=new R({sampleRate:Co})}catch{B=new R}f.current=B,d.current=P,y.current=!0,k.current=jN({autoStop:E.current.autoStop!==!1});const q=B.createMediaStreamSource(P),F=B.createScriptProcessor(4096,1,1);m.current=F;const V=B.sampleRate/Co;F.onaudioprocess=W=>{var Y;if(!y.current)return;const K=W.inputBuffer.getChannelData(0),D=V===1?new Float32Array(K):BN(K,V);b.current.push(D);let ne=0;for(let X=0;X<D.length;X++)ne+=D[X]*D[X];const oe=Math.sqrt(ne/D.length);g.current.push(oe),T.current=T.current*.7+oe*.3,o(Math.min(1,T.current*8)),Nb(Math.min(1,T.current*8)),((Y=k.current)==null?void 0:Y.feed(oe,performance.now()))==="auto-stop"&&y.current&&N()},q.connect(F);const I=B.createGain();I.gain.value=0,F.connect(I),I.connect(B.destination),r(!0),_.current&&(_.current=!1,N())}catch(P){A(),r(!1),u(P instanceof Error?P.message:String(P))}finally{w.current=!1}})())},[A,N]),M=v.useCallback(()=>{y.current?C():w.current&&(_.current=!0)},[C]);return v.useEffect(()=>()=>{y.current&&A()},[A]),{listening:n,transcribing:s,level:a,startError:l,transcribeError:c,clearTranscribeError:()=>h(null),beginHold:L,endHold:M}}function UN({onGotoSettings:e}){var b;const t=Ye(),[n,r]=v.useState(!1),[s,i]=v.useState(null),[a,o]=v.useState(""),[l,u]=v.useState(""),c=v.useRef(null),h=v.useCallback(async()=>{var g,y;try{const[k,T,S,E]=await Promise.all([se.getProviderPresets(),se.listCustomProviders(),se.getSetting("active_provider"),se.getSetting("active_model")]),w=S??"glm",_=await Promise.all(k.map(async H=>await se.hasSetting(H.apiKeySetting))),A=new Set;k.forEach((H,P)=>{(_[P]||H.id===w)&&A.add(H.id)});const N=[],C=(H,P,R)=>{for(const B of R)N.push({providerId:H,providerLabel:P,modelId:B.id,modelLabel:B.label,vision:(B.capabilities??[]).includes("vision"),contextWindow:B.contextWindow})};for(const H of k)A.has(H.id)&&C(H.id,H.label,H.models);const L=T.filter(H=>H.kind==="llm");for(const H of L)C(H.id,H.label,H.models);const M=E??"";if(M&&!N.some(H=>H.providerId===w&&H.modelId===M)){const H=((g=k.find(P=>P.id===w))==null?void 0:g.label)??((y=L.find(P=>P.id===w))==null?void 0:y.label)??w;N.unshift({providerId:w,providerLabel:H,modelId:M,modelLabel:M,vision:!0,contextWindow:null})}i(N),o(w),u(M)}catch{i([])}},[]);v.useEffect(()=>{h();const g=()=>void h();return window.addEventListener("llm-config-changed",g),()=>window.removeEventListener("llm-config-changed",g)},[h]),v.useEffect(()=>{if(!n)return;const g=k=>{var T;k.target instanceof Node&&((T=c.current)==null?void 0:T.contains(k.target))!==!0&&r(!1)},y=k=>{k.key==="Escape"&&r(!1)};return document.addEventListener("pointerdown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("pointerdown",g),document.removeEventListener("keydown",y)}},[n]);const f=async g=>{if(r(!1),!(g.providerId===a&&g.modelId===l))try{await se.setSetting("active_provider",g.providerId),await se.setSetting("active_model",g.modelId),o(g.providerId),u(g.modelId),window.dispatchEvent(new Event("llm-config-changed"))}catch{}},d=((b=s==null?void 0:s.find(g=>g.providerId===a&&g.modelId===l))==null?void 0:b.modelLabel)??l??t("model.picker.label"),m=[];for(const g of s??[]){const y=m[m.length-1];y&&y.label===g.providerLabel?y.rows.push(g):m.push({label:g.providerLabel,rows:[g]})}return p.jsxs("div",{ref:c,className:"relative","data-testid":"composer-model",children:[p.jsxs("button",{type:"button",onClick:()=>r(!n),"aria-haspopup":"menu","aria-expanded":n,"data-tooltip":t("model.picker.label"),"data-testid":"composer-model-trigger",className:"flex items-center gap-1 max-w-[13rem] px-1.5 py-0.5 rounded-full text-caption font-medium text-ink-muted hover:text-ink-strong hover:bg-ink/[0.06] transition-colors",children:[p.jsx(ux,{className:"w-3 h-3 shrink-0 coarse-only","aria-hidden":!0}),p.jsx("span",{className:"truncate tb-label",children:d}),p.jsx(im,{className:`w-3 h-3 shrink-0 tb-chevron transition-transform ${n?"":"rotate-180"}`})]}),n&&p.jsxs("div",{role:"menu","aria-label":t("model.picker.label"),"data-testid":"composer-model-menu",className:"absolute bottom-full right-0 mb-1.5 z-50 w-64 max-w-[calc(100vw-1.5rem)] max-h-72 overflow-y-auto bg-surface-0 rounded-xl shadow-elevated border border-[var(--border)] py-1.5",children:[m.length===0&&p.jsx("div",{className:"px-3 py-2 text-caption text-ink-faint",children:t("model.picker.noneConfigured")}),m.map(g=>p.jsxs("div",{role:"group","aria-label":g.label,children:[p.jsx("div",{className:"px-3 pt-1.5 pb-0.5 text-caption font-bold text-ink-faint",children:g.label}),g.rows.map(y=>{const k=y.providerId===a&&y.modelId===l;return p.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":k,onClick:()=>void f(y),className:`w-full flex items-center gap-1.5 px-3 py-1.5 text-left transition-colors ${k?"text-brand":"text-ink-strong hover:bg-ink/[0.06]"}`,children:[p.jsx(En,{className:`w-3.5 h-3.5 shrink-0 ${k?"opacity-100":"opacity-0"}`}),p.jsx("span",{className:"flex-1 truncate text-label",children:y.modelLabel}),y.vision&&p.jsx(gx,{className:"w-3 h-3 shrink-0 text-ink-faint","aria-label":t("model.picker.vision")})]},`${y.providerId}:${y.modelId}`)})]},g.label)),p.jsx("div",{className:"border-t border-[var(--border)] mt-1 pt-1",children:p.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{r(!1),e()},className:"w-full flex items-center gap-1.5 px-3 py-1.5 text-left text-label text-ink-muted hover:text-ink-strong hover:bg-ink/[0.06] transition-colors",children:[p.jsx(Fx,{className:"w-3.5 h-3.5"}),t("model.picker.manage")]})})]})]})}const gl=5.5,Th=2*Math.PI*gl,xr=["system","node","learner","history","draft"],kh={system:"bg-accent",node:"bg-brand",learner:"bg-gold",history:"bg-ink/50",draft:"bg-exam"};function zN({info:e,historyTokens:t,draftTokens:n}){const r=Ye(),[s,i]=v.useState(!1),a=v.useRef(null);if(v.useEffect(()=>{!(e!=null&&e.contextWindow)&&s&&i(!1)},[e==null?void 0:e.contextWindow,s]),v.useEffect(()=>{if(!s)return;const f=m=>{var b;m.target instanceof Node&&((b=a.current)==null?void 0:b.contains(m.target))!==!0&&i(!1)},d=m=>{m.key==="Escape"&&i(!1)};return document.addEventListener("pointerdown",f),document.addEventListener("keydown",d),()=>{document.removeEventListener("pointerdown",f),document.removeEventListener("keydown",d)}},[s]),!e)return null;const o={system:e.systemTokens,node:e.nodeTokens,learner:e.learnerTokens,history:t,draft:n},l=xr.reduce((f,d)=>f+o[d],0),u=Yx(l,e.contextWindow),c=u!==null&&u>=85,h=Gx(xr.map(f=>o[f]),u??0);return p.jsxs("span",{ref:a,className:"relative inline-flex items-center","data-testid":"composer-context",children:[p.jsxs("button",{type:"button",onClick:()=>i(!s),disabled:e.contextWindow===null,"aria-label":r("context.aria",{p:u!==null?`${u}%`:pr(l)}),"aria-haspopup":"dialog","aria-expanded":s,"data-testid":"composer-context-trigger","data-tooltip":e.contextWindow===null?`${r("context.label")} ~${pr(l)} · ${r("context.unknownWindow")}`:r("context.aria",{p:`${u}%`}),className:`flex items-center gap-1 px-1.5 py-0.5 rounded-full text-caption font-medium transition-colors ${c?"text-warning":"text-ink-muted"} hover:bg-ink/[0.06] disabled:hover:bg-transparent`,children:[p.jsxs("svg",{viewBox:"0 0 14 14",width:"14",height:"14","aria-hidden":!0,className:"shrink-0",children:[p.jsx("circle",{cx:"7",cy:"7",r:gl,fill:"none",strokeWidth:"2",className:"stroke-ink/20"}),p.jsx("circle",{cx:"7",cy:"7",r:gl,fill:"none",strokeWidth:"2",stroke:"currentColor",strokeLinecap:"round",strokeDasharray:`${Th*(u??100)/100} ${Th}`,transform:"rotate(-90 7 7)"})]}),u!==null?p.jsxs("span",{className:"tb-label",children:[u,"%"]}):p.jsxs("span",{className:"tb-label",children:["~",pr(l)]})]}),s&&e.contextWindow!==null&&p.jsxs("div",{role:"dialog","aria-label":r("context.label"),"data-testid":"composer-context-panel",className:"absolute bottom-full right-0 mb-1.5 z-50 w-64 max-w-[calc(100vw-1.5rem)] bg-surface-0 rounded-xl shadow-elevated border border-[var(--border)] p-3",children:[p.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[p.jsx("span",{className:"text-label font-bold text-ink-strong",children:r("context.label")}),p.jsxs("span",{className:`text-caption ${c?"text-warning":"text-ink-muted"}`,children:[r("context.approx")," ",pr(l)," / ",pr(e.contextWindow)]})]}),p.jsx("div",{className:"flex h-2 rounded-full overflow-hidden bg-ink/10 mb-2",role:"img","aria-label":`${u}%`,children:xr.map(f=>h[xr.indexOf(f)]>0?p.jsx("div",{className:kh[f],style:{width:`${h[xr.indexOf(f)]}%`}},f):null)}),p.jsx("dl",{className:"space-y-1",children:xr.map(f=>p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("dt",{className:"flex items-center gap-1.5 text-caption text-ink-muted",children:[p.jsx("span",{className:`w-2 h-2 rounded-sm ${kh[f]}`,"aria-hidden":!0}),r(`context.${f}`)]}),p.jsxs("dd",{className:"text-caption text-ink-strong tabular-nums",children:["~",pr(o[f])]})]},f))})]})]})}const bl={glm:{fast:e=>{e.thinking={type:"disabled"},e.reasoning_effort="low"},deep:e=>{e.thinking={type:"enabled"}}},qwen:{fast:e=>{e.enable_thinking=!1},deep:e=>{e.enable_thinking=!0}},siliconcloud:{fast:e=>{e.enable_thinking=!1},deep:e=>{e.enable_thinking=!0}},deepseek:{fast:e=>{e.thinking="none"},deep:e=>{e.thinking="max"}},kimi:{fast:e=>{e.thinking={type:"disabled"}},deep:e=>{e.thinking={type:"enabled"}}},volcano:{fast:e=>{e.thinking={type:"disabled"},e.reasoning_effort="low"},deep:e=>{e.thinking={type:"enabled"}}},stepfun:{fast:e=>{e.enable_thinking=!1},deep:e=>{e.enable_thinking=!0}},"grok-effort":{fast:e=>{e.reasoning_effort="low"},deep:e=>{e.reasoning_effort="high"}}};function VN(e,t,n){if(e==="openai"||e in bl)return e;const r=(t??"").toLowerCase(),s=(n??"").toLowerCase();return r.includes("bigmodel.cn")||r.includes("z.ai")||s.startsWith("glm")?"glm":r.includes("dashscope")||s.startsWith("qwen")?"qwen":r.includes("siliconflow")?"siliconcloud":r.includes("deepseek")||s.startsWith("deepseek-")?"deepseek":r.includes("moonshot")||s.startsWith("kimi-")?"kimi":r.includes("volces.com")||s.startsWith("doubao-")?"volcano":r.includes("stepfun")||s.startsWith("step-")?"stepfun":(r.includes("x.ai")||s.startsWith("grok-"))&&/^(grok-3-mini|grok-4\.(?:[3-9]|\d{2,}))/.test(s)?"grok-effort":e}function qN(e,t,n){return t==="anthropic"||t==="google"||e==="openai"||e in bl?!0:VN(e,n==null?void 0:n.baseUrl,n==null?void 0:n.model)in bl}const _o=[{value:"",labelKey:"effort.auto.label",descKey:"effort.auto.desc"},{value:"fast",labelKey:"effort.fast.label",descKey:"effort.fast.desc"},{value:"deep",labelKey:"effort.deep.label",descKey:"effort.deep.desc"}];function WN(){const e=Ye(),[t,n]=v.useState(!1),[r,s]=v.useState(""),[i,a]=v.useState(!0),o=v.useRef(null),l=v.useRef(null),[u,c]=v.useState("right"),[h,f]=v.useState(0),d=v.useRef(0),[m,b]=v.useState(0);v.useLayoutEffect(()=>{if(!t){b(0),d.current=0,f(0);return}const T=l.current;if(!T)return;const S=T.getBoundingClientRect(),E=S.left-d.current,w=S.right-d.current,_=window.innerWidth;if(m===0){if(E<8&&w<=_-8){c("left"),b(1);return}if(w>_-8&&E>=8){c("right"),b(1);return}b(1)}const A=Math.min(0,_-8-w)+Math.max(0,8-E);A!==d.current&&(d.current=A,f(A))},[t,m]);const g=v.useCallback(async()=>{var T;try{const[S,E,w,_,A]=await Promise.all([se.getSetting("active_provider"),se.getSetting("reasoning_effort"),se.getProviderPresets(),se.listCustomProviders(),se.getSetting("active_model")]),N=S??"glm",C=_.find(H=>H.id===N),L=((T=w.find(H=>H.id===N))==null?void 0:T.protocol)??(C==null?void 0:C.protocol)??"openai-compatible";a(qN(N,L,{baseUrl:C==null?void 0:C.baseUrl,model:A??(C==null?void 0:C.defaultModel)}));const M=E??"";s(M==="fast"||M==="deep"?M:"")}catch{a(!1)}},[]);v.useEffect(()=>{g();const T=()=>void g();return window.addEventListener("llm-config-changed",T),()=>window.removeEventListener("llm-config-changed",T)},[g]),v.useEffect(()=>{if(!t)return;const T=E=>{var w;E.target instanceof Node&&((w=o.current)==null?void 0:w.contains(E.target))!==!0&&n(!1)},S=E=>{E.key==="Escape"&&n(!1)};return document.addEventListener("pointerdown",T),document.addEventListener("keydown",S),()=>{document.removeEventListener("pointerdown",T),document.removeEventListener("keydown",S)}},[t]);const y=async T=>{if(n(!1),T!==r){s(T);try{await se.setSetting("reasoning_effort",T)}catch{s(r)}}},k=_o.find(T=>T.value===r)??_o[0];return p.jsxs("div",{ref:o,className:"relative","data-testid":"composer-effort",children:[p.jsxs("button",{type:"button",onClick:()=>!!i&&n(!t),disabled:!i,"aria-haspopup":"menu","aria-expanded":t,"data-testid":"composer-effort-trigger","data-tooltip":e(i?"effort.label":"effort.unsupported"),className:`flex items-center gap-1 px-1.5 py-0.5 rounded-full text-caption font-medium transition-colors ${r?"text-accent":"text-ink-muted"} ${i?"hover:text-ink-strong hover:bg-ink/[0.06]":"opacity-40 cursor-not-allowed"}`,children:[p.jsx(cx,{className:"w-3 h-3 shrink-0"}),p.jsx("span",{className:"truncate tb-label",children:e(k.labelKey)}),p.jsx(im,{className:`w-3 h-3 shrink-0 tb-chevron transition-transform ${t?"":"rotate-180"}`})]}),t&&p.jsx("div",{ref:l,role:"menu","aria-label":e("effort.label"),"data-testid":"composer-effort-menu",style:{transform:h?`translateX(${h}px)`:void 0},className:`absolute bottom-full ${u==="right"?"right-0":"left-0"} mb-1.5 z-50 w-60 max-w-[calc(100vw-1.5rem)] bg-surface-0 rounded-xl shadow-elevated border border-[var(--border)] py-1.5`,children:_o.map(T=>{const S=T.value===r;return p.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":S,onClick:()=>void y(T.value),className:`w-full flex items-start gap-1.5 px-3 py-1.5 text-left transition-colors ${S?"text-brand":"text-ink-strong hover:bg-ink/[0.06]"}`,children:[p.jsx(En,{className:`w-3.5 h-3.5 shrink-0 mt-0.5 ${S?"opacity-100":"opacity-0"}`}),p.jsxs("span",{className:"flex-1",children:[p.jsx("span",{className:"block text-label font-bold",children:e(T.labelKey)}),p.jsx("span",{className:"block text-caption text-ink-faint",children:e(T.descKey)})]})]},T.value||"auto")})})]})}const $N=v.lazy(()=>Ae(()=>import("./VoicePanel-CcYGhBPb.js"),__vite__mapDeps([33,1,2,31]),import.meta.url).then(e=>({default:e.VoicePanel}))),YN={direct:"soul.direct",guide:"soul.guide",practice:"soul.practice"},GN={direct:nn,guide:om,practice:Ex},KN={direct:"soul.direct.desc",guide:"soul.guide.desc",practice:"soul.practice.desc"},XN=["image/png","image/jpeg","image/webp","image/gif",".txt",".md",".markdown",".rst",".org",".adoc",".log",".csv",".tsv",".json",".yaml",".yml",".toml",".ini",".py",".js",".mjs",".cjs",".ts",".tsx",".jsx",".go",".rs",".java",".c",".h",".cpp",".hpp",".cs",".rb",".sh",".sql",".html",".css",".scss",".vue",".svelte",".kt",".swift",".php"].join(",");let wh=0;function QN({nodeId:e,agentReady:t,streaming:n,souls:r,activeSoul:s,starterPrompts:i,onPickSoul:a,onSend:o,onStop:l,onLogFriction:u,onGotoSettings:c,insertText:h,historyTokens:f}){const d=Ye(),m=ha(),[b,g]=v.useState(""),[y,k]=v.useState([]),[T,S]=v.useState(null),[E,w]=v.useState(null),[_,A]=v.useState(!1),N=v.useRef(null),C=v.useRef(0),[L,M]=v.useState(!0);v.useEffect(()=>{se.getSetting("asr_auto_stop").then(te=>M(te!=="0"))},[]);const[H,P]=v.useState(!1);v.useEffect(()=>(vc(H),()=>vc(!1)),[H]);const[R,B]=v.useState(""),[q,F]=v.useState(!1),[V,I]=v.useState(null),W=HN(te=>{B(te),F(!0)},{locale:m,autoStop:L}),K=W.startError??W.transcribeError;v.useEffect(()=>{if(!K)return;I(d(K==="no-speech"?"chat.speech.no_speech":K==="model-missing"?"chat.speech.asr_model_missing":K==="engine-unavailable"?"chat.speech.engine_unavailable":K==="custom-provider-missing"?"chat.speech.custom_provider_missing":K==="groq-key-missing"?"chat.speech.groq_key_missing":K==="azure-key-missing"?"chat.speech.azure_stt_key_missing":K==="azure-region-missing"?"chat.speech.azure_stt_region_missing":K==="mic-insecure-context"?"chat.speech.asr_insecure_context":K==="mic-unavailable"?"chat.speech.asr_start_fail":"chat.speech.asr_failed")),W.clearTranscribeError()},[K,W,d]);const D=V?"error":W.listening?"recording":W.transcribing?"transcribing":q?"review":"idle",ne=(te,Ie,be)=>{Ib(),o(te,Ie,be)},oe=v.useCallback(()=>{B(""),F(!1),I(null)},[]),J=v.useCallback(()=>{P(!1),oe()},[oe]),Y=()=>{const te=R.trim();!te||n||!e||(ne(te),J())};v.useEffect(()=>{h&&g(te=>te.trim()?`${te}
526
+
527
+ ${h}`:h)},[h]),v.useEffect(()=>{if(!e){w(null);return}let te=!1;(async()=>{try{const be=await se.getContextUsage(e,m);te||w(be)}catch{te||w(null)}})();const Ie=()=>{se.getContextUsage(e,m).then(be=>{te||w(be)}).catch(()=>{})};return window.addEventListener("llm-config-changed",Ie),()=>{te=!0,window.removeEventListener("llm-config-changed",Ie)}},[e,m]),v.useEffect(()=>{if(!T)return;const te=setTimeout(()=>S(null),3e3);return()=>clearTimeout(te)},[T]);const X=v.useRef(new Set);v.useEffect(()=>()=>{for(const te of X.current)URL.revokeObjectURL(te)},[]);const de=v.useCallback(te=>{k(Ie=>{const be=Ie.find(Fe=>Fe.id===te);return be!=null&&be.previewUrl&&(URL.revokeObjectURL(be.previewUrl),X.current.delete(be.previewUrl)),Ie.filter(Fe=>Fe.id!==te)})},[]),ge=v.useCallback(async te=>{if(te.length===0)return;const Ie=Ei.maxPerMessage-y.length;if(Ie<=0){S(d("chat.attach.tooMany",{n:Ei.maxPerMessage}));return}const be=te.length>Ie?te.slice(0,Ie):te;te.length>Ie&&S(d("chat.attach.tooMany",{n:Ei.maxPerMessage}));const Fe=[],Qe=[];for(const De of be){const st=DN(De.name,De.type,De.size);if(!st.ok){S(st.reason==="unsupported"?d("chat.attach.unsupported",{name:De.name}):st.reason==="tooLargeImage"?d("chat.attach.tooLargeImage",{name:De.name}):d("chat.attach.tooLargeText",{name:De.name}));continue}if(st.kind==="image"){if((E==null?void 0:E.visionCapable)===!1){S(d("chat.attach.visionUnsupported"));continue}const Q=await new Promise(ve=>{const ke=new FileReader;ke.onload=()=>{const Ne=ke.result;ve(typeof Ne=="string"?Ne.slice(Ne.indexOf(",")+1):null)},ke.onerror=()=>ve(null),ke.readAsDataURL(De)});if(Q===null)continue;const re=URL.createObjectURL(De);Qe.push(re),Fe.push({id:++wh,kind:"image",name:De.name,mime:De.type||"image/png",size:De.size,previewUrl:re,base64:Q})}else try{const Q=await De.text();Fe.push({id:++wh,kind:"text",name:De.name,mime:De.type||"text/plain",size:De.size,text:Q})}catch{}}if(Fe.length>0){for(const De of Qe)X.current.add(De);k(De=>[...De,...Fe])}else for(const De of Qe)URL.revokeObjectURL(De)},[y.length,E==null?void 0:E.visionCapable,d]),ee=te=>{const Ie=te.trim();if(n||!e||!Ie&&y.length===0)return;const be=Ie||tu("chat.attach.imageOnlyText"),Fe=y.map(Qe=>({kind:Qe.kind,name:Qe.name,mime:Qe.mime,size:Qe.size,data:Qe.kind==="image"?Qe.base64??"":Qe.text??"",...Qe.kind==="image"&&Qe.previewUrl?{previewUrl:Qe.previewUrl}:{}}));ne(be,void 0,Fe.length>0?Fe:void 0),g(""),k([])},ie=()=>ee(b),xe=te=>{n||(ne(te.message,te.label),te.frictionCategory&&(u==null||u(te.frictionCategory,null)))},Se=te=>{const Ie=Array.from(te.clipboardData.files??[]);Ie.length>0&&(te.preventDefault(),ge(Ie))},Le=te=>{te.dataTransfer.types.includes("Files")&&(te.preventDefault(),C.current+=1,A(!0))},pe=te=>{te.dataTransfer.types.includes("Files")&&(C.current=Math.max(0,C.current-1),C.current===0&&A(!1))},Te=te=>{te.dataTransfer.types.includes("Files")&&(te.preventDefault(),C.current=0,A(!1),ge(Array.from(te.dataTransfer.files??[])))},Me=v.useMemo(()=>km(b),[b]);return t?p.jsxs("div",{className:"px-5 pb-4 pt-1 shrink-0","data-testid":"composer",children:[!H&&i.length>0&&e&&p.jsx("div",{className:"flex items-center gap-1.5 overflow-x-auto pb-2","data-testid":"starter-prompts",children:i.map((te,Ie)=>p.jsx("button",{onClick:()=>xe(te),disabled:n,"data-testid":`starter-prompt-${Ie}`,"data-tooltip":te.hint??te.label,className:"shrink-0 whitespace-nowrap px-2.5 py-1 rounded-full text-caption font-medium text-ink-muted hover:text-ink-strong hover:bg-ink/[0.06] transition-colors disabled:opacity-30",children:te.label},Ie))}),p.jsx("div",{className:`composer-card relative rounded-2xl transition-colors px-3 pt-2 pb-1.5 ${_?"bg-accent/10 ring-1 ring-accent":"bg-ink/[0.05] focus-within:bg-ink/[0.07]"}`,onDragEnter:Le,onDragOver:te=>{te.dataTransfer.types.includes("Files")&&te.preventDefault()},onDragLeave:pe,onDrop:Te,"data-testid":"composer-card",children:H?p.jsxs(p.Fragment,{children:[D!=="idle"&&p.jsx(v.Suspense,{fallback:null,children:p.jsx($N,{view:D,level:W.level,text:R,onTextChange:B,onSend:Y,onRerecord:oe,errorMessage:V,sendDisabled:n||!e||!R.trim()})}),p.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[p.jsxs("span",{className:"flex items-center gap-1.5 text-label text-ink-muted font-medium",children:[p.jsx(Cs,{className:"w-3.5 h-3.5 text-accent"}),d("chat.speech.dictation")]}),p.jsxs("button",{type:"button",onClick:J,"data-tooltip":d("chat.speech.back_to_keyboard"),"aria-label":d("chat.speech.back_to_keyboard"),"data-testid":"voice-keyboard-toggle",className:"touch-lift flex items-center gap-1 px-2 py-0.5 rounded-full text-caption font-medium text-ink-muted hover:text-ink-strong hover:bg-ink/[0.06] transition-colors",children:[p.jsx(wx,{className:"w-3.5 h-3.5"}),p.jsx("span",{children:d("chat.speech.keyboard")})]})]}),p.jsxs("button",{type:"button",onPointerDown:te=>{te.preventDefault(),W.beginHold()},onPointerUp:W.endHold,onPointerLeave:W.endHold,onPointerCancel:W.endHold,onContextMenu:te=>te.preventDefault(),disabled:!e||D!=="idle","data-testid":W.listening?"voice-hold-btn-active":"voice-hold-btn",className:`w-full py-5 rounded-xl text-lead font-bold flex items-center justify-center gap-2 transition-all touch-none select-none disabled:opacity-40 ${W.listening?"bg-accent/25 text-accent scale-[0.99]":"bg-accent/10 text-accent hover:bg-accent/20 active:bg-accent/25 active:scale-[0.99]"}`,children:[p.jsx(Cs,{className:"w-5 h-5"}),W.listening?d("chat.speech.release_to_stop"):d("chat.speech.hold_to_talk")]})]}):p.jsxs(p.Fragment,{children:[r.length>0&&p.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto mb-1","data-testid":"soul-picker",children:[p.jsx("span",{className:"text-body text-ink-faint shrink-0",children:d("chat.soul.label")}),r.map(te=>{const Ie=s===te.name,be=GN[te.name]??om,Fe=d(KN[te.name]??"soul.direct.desc");return p.jsxs("button",{onClick:()=>a(te.name),"data-testid":`soul-pill-${te.name}`,"data-tooltip":Fe,className:`shrink-0 flex items-center gap-1 px-2 py-0.5 rounded-full text-body font-medium transition-colors ${Ie?"bg-brand/15 text-brand":"text-ink-muted hover:text-ink-strong hover:bg-ink/5"}`,children:[p.jsx(be,{className:"w-3.5 h-3.5"}),p.jsx("span",{children:d(YN[te.name]??"soul.direct")})]},te.id)})]}),y.length>0&&p.jsxs("div",{className:"flex gap-1.5 flex-wrap mb-1.5","data-testid":"composer-attachments",children:[(E==null?void 0:E.visionBridgeModel)&&y.some(te=>te.kind==="image")&&p.jsxs("div",{className:"w-full flex items-center gap-1 text-caption text-ink-muted","data-testid":"vision-bridge-chip",children:[p.jsx(Ox,{className:"w-3.5 h-3.5 shrink-0"}),p.jsx("span",{children:d("chat.attach.bridgeChip",{model:E.visionBridgeModel})})]}),y.map(te=>te.kind==="image"?p.jsxs("div",{className:"relative w-16 h-16 shrink-0",children:[p.jsx("img",{src:te.previewUrl,alt:te.name,className:"w-16 h-16 object-cover rounded-lg border border-[var(--border)]"}),p.jsx("button",{type:"button",onClick:()=>de(te.id),"aria-label":d("chat.attach.remove",{name:te.name}),className:"touch-target-sm absolute -top-1.5 -right-1.5 w-5 h-5 rounded-full bg-ink/70 hover:bg-warning text-white flex items-center justify-center transition-colors",children:p.jsx(In,{className:"w-3 h-3"})})]},te.id):p.jsxs("span",{className:"inline-flex items-center gap-1 pl-2 pr-1 py-1 rounded-full bg-ink/[0.08] text-caption text-ink-strong",children:[p.jsx(Fi,{className:"w-3 h-3 shrink-0 text-ink-faint"}),p.jsx("span",{className:"truncate max-w-[10rem]",children:te.name}),p.jsx("button",{type:"button",onClick:()=>de(te.id),"aria-label":d("chat.attach.remove",{name:te.name}),className:"touch-target-sm w-4 h-4 rounded-full hover:bg-ink/20 flex items-center justify-center text-ink-muted hover:text-warning transition-colors",children:p.jsx(In,{className:"w-2.5 h-2.5"})})]},te.id))]}),T&&p.jsx("div",{className:"text-caption text-warning pb-1",role:"status","data-testid":"composer-notice",children:T}),p.jsxs("div",{className:"flex gap-2 items-end",children:[p.jsx("textarea",{value:b,onChange:te=>g(te.target.value),onFocus:()=>ui(!0),onBlur:()=>ui(!1),onKeyDown:te=>{te.key==="Enter"&&!te.shiftKey&&(te.preventDefault(),ie())},onPaste:Se,placeholder:d(e?"chat.input.placeholder":"chat.input.no_node"),disabled:n||!e,rows:2,"data-testid":"chat-input",className:"flex-1 bg-transparent text-ink-strong text-body rounded-lg px-1 py-1 resize-none focus:outline-none disabled:opacity-40 placeholder:text-ink-faint"}),n?p.jsx("button",{onClick:l,"data-testid":"chat-stop",className:"btn-icon-3d-warning shrink-0 w-9 h-9",title:d("chat.stop"),"aria-label":d("chat.stop"),children:p.jsx(Jl,{className:"w-3.5 h-3.5 fill-current"})}):p.jsx("button",{onClick:ie,disabled:n||!b.trim()&&y.length===0||!e,"data-testid":"chat-send",className:"btn-icon-3d-brand shrink-0 w-9 h-9",title:d("chat.send"),"aria-label":d("chat.send"),children:p.jsx(ax,{className:"w-4 h-4"})})]}),p.jsxs("div",{className:"composer-toolbar flex flex-wrap items-center justify-between gap-x-0.5 gap-y-1 mt-0.5",children:[p.jsx("button",{type:"button",onClick:()=>{oe(),P(!0)},disabled:!e,"data-tooltip":d("chat.speech.dictation"),"aria-label":d("chat.speech.dictation"),"data-testid":"composer-mic",className:"flex items-center gap-1 px-1.5 py-0.5 rounded-full text-caption font-medium text-ink-muted hover:text-ink-strong hover:bg-ink/[0.06] transition-colors disabled:opacity-50",children:p.jsx(Cs,{className:"w-3.5 h-3.5"})}),p.jsx("button",{type:"button",onClick:()=>{var te;return(te=N.current)==null?void 0:te.click()},"data-tooltip":d("chat.attach.add"),"aria-label":d("chat.attach.add"),"data-testid":"composer-attach",className:"flex items-center gap-1 px-1.5 py-0.5 rounded-full text-caption font-medium text-ink-muted hover:text-ink-strong hover:bg-ink/[0.06] transition-colors",children:p.jsx(Ix,{className:"w-3 h-3"})}),p.jsx("input",{ref:N,type:"file",multiple:!0,accept:XN,className:"hidden",onChange:te=>{ge(Array.from(te.target.files??[])),te.target.value=""}}),p.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-0.5",children:[p.jsx(WN,{}),p.jsx(zN,{info:E,historyTokens:f,draftTokens:Me}),p.jsx(UN,{onGotoSettings:c})]})]})]})})]}):p.jsx("div",{className:"px-5 pb-4 shrink-0","data-testid":"composer-nokey",children:p.jsxs("div",{className:"flex items-center justify-center gap-3 py-3 text-body text-ink-muted",children:[p.jsx("span",{children:d("chat.no_key.short")}),p.jsx("button",{onClick:c,className:"text-brand hover:underline font-bold",children:d("chat.no_key.cta")})]})})}const Sh={viseme:"closed",open:0};function ZN(e){const[t,n]=v.useState(Sh);return v.useEffect(()=>{if(!e){n(Sh);return}const r=new Uint8Array(256),s=new Uint8Array(tg/2);let i=0,a="",o=null,l=0;const u=()=>{const c=b_();if(c){let h,f;if(c.timeline&&c.timeline.cues.length>0){const b=Math.max(0,c.ctx.currentTime-c.startedAtCtxTime),g=I_(c.timeline,b);h=(g==null?void 0:g.viseme)??"closed",f=(g==null?void 0:g.level)??0}else if(c.analyser){const b=c.analyser;b.getByteTimeDomainData(r),b.getByteFrequencyData(s);const g=Rb(r,s,b.context.sampleRate,b.fftSize);h=g.viseme,h!==a.split(":")[0]?(h==="closed"||h===o?h===o&&l++:(o=h,l=1),h!=="closed"&&!(h===o&&l>=2)&&(h=a.split(":")[0]||"closed")):(o=null,l=0),f=g.level}else h="closed",f=0;const d=Pb(h,f),m=h+":"+d;m!==a&&(a=m,n({viseme:h,open:d}))}i=requestAnimationFrame(u)};return i=requestAnimationFrame(u),()=>cancelAnimationFrame(i)},[e]),t}const JN=22,eI=35e-5,Ah=.012,Ch=.12,_h=.3,tI=16.667,No=12,nI=3.2,Nh=56,yr=.6;function rI(e,t,n,r,s=0,i=0){let a=0,o=0;for(const u of r){const c=e-u.x,h=t-u.y,f=Math.hypot(c,h),d=u.r+n,m=d+Nh;if(f>=m)continue;if(f<1e-4){o-=yr;continue}const b=c/f,g=h/f,y=Math.min(1.6,Math.max(0,1-(f-d)/Nh)),k=s*b+i*g,T=k<0?1+Math.min(1.6,-k/4):1;a+=b*yr*y*T,o+=g*yr*y*T}const l=Math.hypot(a,o);return l>yr*2&&(a=a/l*yr*2,o=o/l*yr*2),{x:a,y:o}}function iI(e,t,n,r=34){const s=n*.001;return{x:e.x+Math.sin(s*.31+t*2.1)*r,y:e.y+Math.sin(s*.47+t*4.7)*(r*.55)+Math.sin(s*1.7+t)*4}}function sI(e,t,n,r,s=tI){const i=Math.max(64,s*s),a=xl((n.x-e.x)*Ah-t.x*Ch,_h),o=xl((n.y-e.y)*Ah-t.y*Ch,_h);return{fx:a*r/i,fy:o*r/i-r*.001}}function xl(e,t){return e>t?t:e<-t?-t:e}function aI(e,t,n,r,s,i,a,o,l,u){const c=e-i,h=t-a,f=Math.hypot(c,h),d=s+u;if(f>=d||f<1e-4)return null;const m=c/f,b=h/f,g=n-o,y=r-l,k=g*m+y*b,T=d-f,S=k<0?-k*.9:0;return{nx:m,ny:b,dvx:m*(T*.55+S*.85),dvy:b*(T*.55+S*.85),bfx:-m*S*.02,bfy:-b*S*.02,hitSpeed:-k}}function oI(e,t){return Math.hypot(e,t)<.35?0:xl(e*.06,.5)}function lI(e,t,n,r=0){const s=[.14,.32,.5,.68,.86],i=[.38,.5,.62],a=(r%15+15)%15;let o={x:e*.5,y:t*.5},l=-1/0;for(let u=0;u<15;u++){const c=(a+u)%15,h=e*s[c%5],f=t*i[Math.floor(c/5)];let d=Math.min(h,e-h);for(const m of n){const b=Math.hypot(h-m.x,f-m.y)-m.r;b<d&&(d=b)}d>l+1e-9&&(l=d,o={x:h,y:f})}return o}function uI(e,t,n=220){let r=null,s=n;for(const i of t){const a=Math.hypot(i.x-e.x,i.y-e.y);a<s&&(s=a,r={x:i.x,y:i.y})}return r}function cI(e){const t=e.radius??JN,{Bodies:n,Body:r,Composite:s,Engine:i}=bn,a=i.create();a.gravity.y=1,a.positionIterations=4,a.velocityIterations=3;const o=n.circle(e.width*.7,120,t,{restitution:.55,friction:.02,frictionAir:.028,density:eI});s.add(a.world,o);const l=240;let u=[];const c=(d,m)=>{for(const g of u)s.remove(a.world,g);const b=(g,y,k,T)=>n.rectangle(g,y,k,T,{isStatic:!0,restitution:.5});u=[b(-l/2,m/2-160,l,m+640),b(d+l/2,m/2-160,l,m+640),b(d/2,m+l/2,d+l*2,l),b(d/2,-320-l/2,d+l*2,l)];for(const g of u)s.add(a.world,g)};c(e.width,e.height);let h=0,f=e.width;return{body:o,resize(d,m){f=d,c(d,m)},step(d,m,b,g,y){const k=g<h;i.update(a,Math.min(33,Math.max(8,d)));let T=!1;if(!k&&m){const H=y!=null&&y.settle?{x:m.x,y:m.y+Math.sin(g*.0012)*2}:iI(m,Math.floor(g/4200),g),P=Math.max(64,d*d),R=sI({x:o.position.x,y:o.position.y},{x:o.velocity.x,y:o.velocity.y},H,o.mass,d),B=rI(o.position.x,o.position.y,t,b,o.velocity.x,o.velocity.y);r.applyForce(o,o.position,{x:R.fx+B.x*o.mass/P,y:R.fy+B.y*o.mass/P}),r.setAngularVelocity(o,o.angularVelocity-o.angle*.06-o.angularVelocity*.08)}{const H=o.velocity,P=Math.hypot(H.x,H.y);P>No&&r.setVelocity(o,{x:H.x/P*No,y:H.y/P*No})}let S=0,E=0,w=0,_=0,A=0;for(const H of b){const P=aI(o.position.x,o.position.y,o.velocity.x,o.velocity.y,t,H.x,H.y,H.vx,H.vy,H.r);P&&(E+=P.nx*Math.min(4,P.dvx),w+=P.ny*Math.min(4,P.dvy),_+=P.dvx*.9,A+=P.dvy*.9,H.isStatic||H.push(P.bfx,P.bfy),P.hitSpeed>S&&(S=P.hitSpeed))}const N=Math.hypot(E,w);N>4&&(E=E/N*4,w=w/N*4);const C=Math.hypot(_,A);C>7&&(_=_/C*7,A=A/C*7),(N>0||C>0)&&(r.setPosition(o,{x:o.position.x+E,y:o.position.y+w}),r.setVelocity(o,{x:o.velocity.x+_,y:o.velocity.y+A})),S>=nI&&!k&&(h=g+900,T=!0);const L=o.position;L.x<t&&(r.setPosition(o,{x:t,y:L.y}),o.velocity.x<0&&r.setVelocity(o,{x:-o.velocity.x*.5,y:o.velocity.y})),L.x>f-t&&(r.setPosition(o,{x:f-t,y:L.y}),o.velocity.x>0&&r.setVelocity(o,{x:-o.velocity.x*.5,y:o.velocity.y}));const M=y==null?void 0:y.ceilY;return M!==void 0&&L.y<M+t&&(r.setPosition(o,{x:L.x,y:M+t}),o.velocity.y<0&&r.setVelocity(o,{x:o.velocity.x,y:-o.velocity.y*.5})),T},dizzyRemaining(d){return Math.max(0,h-d)},throwDizzy(d){h=d+900},dispose(){s.clear(a.world,!1),i.clear(a)}}}const Lt={rail:76,chat:96,notebook:120,titlebar:44};function Ih(){const t=document.querySelector('[data-testid="composer-card"]')??document.querySelector('[data-testid="composer"]')??document.querySelector('[data-testid="composer-nokey"]');if(t){const r=t.getBoundingClientRect();return{x:r.right-78,y:r.top-44}}const n=document.querySelector('[data-companion-anchor="boot-guide"]');if(n){const r=n.getBoundingClientRect();return{x:r.right-64,y:r.top+96}}return null}function dI(){const e=document.querySelector('[data-testid="notebook-panel"]');if(!e)return null;const t=e.getBoundingClientRect();return{x:t.right-64,y:t.top+84}}function hI({courseId:e}){const t=v.useSyncExternalStore(Mb,as),n=ZN(t.state.talking),r=Gl(),[s,i]=v.useState(!1),[a,o]=v.useState(null),[l,u]=v.useState("rail"),c=v.useRef("rail"),h=v.useRef(null),[f,d]=v.useState(!1),m=v.useRef(!1),b=v.useRef(null),g=v.useRef(null),y=v.useRef(null),k=v.useRef(null),T=v.useRef(t.state.zone),S=v.useRef(!1),E=v.useRef(null),w=v.useRef(!1),_=v.useRef(0),A=v.useRef(null),[N,C]=v.useState(null),L=v.useRef(0),M=v.useRef(null),H=v.useRef(null),P=v.useRef(null),R=v.useRef(0),B=v.useRef(null),q=v.useRef(0),F=v.useRef({pane:"rail",bucket:-1}),V=v.useRef(null),I=v.useRef(null);v.useEffect(()=>{var oe,J,Y;if(l===T.current||(T.current=l,r))return;i(!0),(J=(oe=b.current)==null?void 0:oe.animate)==null||J.call(oe,[{transform:"scale(1, 1)"},{transform:"scale(1.08, 0.86)",offset:.3},{transform:"scale(0.96, 1.1)",offset:.65},{transform:"scale(1, 1)"}],{duration:620,easing:"cubic-bezier(0.2, 1.4, 0.4, 1)",composite:"add"}),(Y=b.current)==null||Y.classList.add("cp-takeoff"),setTimeout(()=>{var X;return(X=b.current)==null?void 0:X.classList.remove("cp-takeoff")},650);const ne=[setTimeout(()=>i(!1),950),setTimeout(()=>{var de;const X=b.current;!X||l==="rail"||(Lb(),(de=X.animate)==null||de.call(X,[{transform:"scale(1, 1)"},{transform:"scale(1.07, 0.88)",offset:.42},{transform:"scale(0.98, 1.03)",offset:.72},{transform:"scale(1, 1)"}],{duration:280,easing:"ease-out",composite:"add"}))},940)];return()=>{for(const X of ne)clearTimeout(X)}},[l,r]),v.useEffect(()=>{if(!e)return;let ne=!0;return window.api.getDashboard(e).then(oe=>{var de,ge;if(!ne)return;const J=(de=oe==null?void 0:oe.frictionByNode)==null?void 0:de[0];if(!(J!=null&&J.nodeId))return;I.current=J.nodeId;const Y=os(),X=(ge=Y.nav)==null?void 0:ge.getBoundingClientRect();if(X)for(const{island:ee,container:ie}of Y.sections.values()){const xe=ee.ball(J.nodeId);if(!xe)continue;const Se=ie.getBoundingClientRect(),Le=Se.left-X.left+xe.body.position.x,pe=Se.top-X.top+xe.body.position.y;P.current={x:Le,y:Math.max(40,pe-92)},R.current=performance.now()+8e3,setTimeout(()=>{ne&&Pr()},1200);return}}).catch(()=>{}),()=>{ne=!1}},[e]),v.useEffect(()=>{const ne=oe=>{const J=oe.detail,Y=I.current;J!=="mastery"||!Y||!e||window.api.getDashboard(e).then(X=>{var ge;((ge=X==null?void 0:X.frictionByNode)==null?void 0:ge.some(ee=>ee.nodeId===Y))||(I.current=null,R.current=0,Bb())}).catch(()=>{})};return window.addEventListener("companion-state-changed",ne),()=>window.removeEventListener("companion-state-changed",ne)},[e]),v.useEffect(()=>Go(ne=>{if(ne.kind!=="correct"&&ne.kind!=="unlock"||!ne.origin||as().state.examActive)return;const oe=document.elementFromPoint(ne.origin.x,ne.origin.y);if(!oe)return;const J=oe.closest('[data-testid="map-rail"]');H.current={x:ne.origin.x,y:ne.origin.y,until:performance.now()+3e3,pane:J?"rail":"chat"}}),[]),v.useEffect(()=>{const ne=J=>{const Y=B.current;if(!Y)return;const X=performance.now(),de=Math.max(8,X-Y.t);B.current={x:J.clientX,y:J.clientY,vx:(J.clientX-Y.x)/de*16.7,vy:(J.clientY-Y.y)/de*16.7,t:X}},oe=()=>{var ie,xe,Se,Le;const J=B.current;if(!J)return;B.current=null;const Y=Math.hypot(J.vx,J.vy),X=g.current;if(X){const pe=(ie=os().nav)==null?void 0:ie.getBoundingClientRect();pe&&bn.Body.setPosition(X.body,{x:Math.min(pe.width-24,Math.max(24,J.x-pe.left)),y:Math.min(pe.height-24,Math.max(24,J.y-pe.top))}),Y>=2.5&&(bn.Body.setVelocity(X.body,{x:J.vx*.9,y:J.vy*.9}),X.throwDizzy(performance.now()))}const de=os(),ge=((xe=de.nav)==null?void 0:xe.getBoundingClientRect())??null;if(!(!!ge&&ge.width>40&&(de.visible||as().state.importing))){const pe=((Se=document.querySelector("header.app-header"))==null?void 0:Se.getBoundingClientRect())??null;if(!!pe&&J.y>=pe.top&&J.y<=pe.bottom)E.current=null;else{const Me=((Le=document.querySelector('[data-testid="notebook-panel"]'))==null?void 0:Le.getBoundingClientRect())??null,te=Me&&J.x>=Me.left&&J.x<=Me.right&&J.y>=Me.top&&J.y<=Me.bottom?"notebook":"chat",Ie=((pe==null?void 0:pe.bottom)??0)+80;E.current={x:Math.min(Math.max(J.x,60),window.innerWidth-60),y:Math.min(Math.max(J.y,Ie),window.innerHeight-60),pane:te}}}Tc(!1,Y)};return window.addEventListener("pointermove",ne,{passive:!0}),window.addEventListener("pointerup",oe,{passive:!0}),window.addEventListener("pointercancel",oe,{passive:!0}),()=>{window.removeEventListener("pointermove",ne),window.removeEventListener("pointerup",oe),window.removeEventListener("pointercancel",oe)}},[]),v.useEffect(()=>{if(!t.enabledLoaded||!t.enabled||t.petMode)return;const ne=b.current;if(!ne)return;let oe=0,J=performance.now(),Y=0,X=0,de=0,ge=-1e9,ee=null,ie=0,xe=0,Se=null,Le=[];const pe=Te=>{var Qi,Zi,Ji,Fn,es,ts,Bt;oe=requestAnimationFrame(pe);const Me=Math.min(50,Te-J);J=Te;const te=os(),Ie=te.nav,be=(Ie==null?void 0:Ie.getBoundingClientRect())??null,Fe=as().state,Qe=!!B.current,De=!!be&&be.width>40&&(te.visible||Fe.importing);if(De&&!w.current&&(E.current=null),w.current=De,Te-ge>150){ge=Te,ee=((Qi=document.querySelector('[data-testid="notebook-panel"]'))==null?void 0:Qi.getBoundingClientRect())??null;const we=((Zi=document.querySelector("header.app-header"))==null?void 0:Zi.getBoundingClientRect())??null;Se=we?{left:we.left,right:we.right,top:we.top,bottom:we.bottom}:null,ie=(we==null?void 0:we.bottom)??0,Le=we?Array.from(document.querySelectorAll('header.app-header button, header.app-header [role="button"], header.app-header a, header.app-header input, header.app-header select')).map(We=>{const Ke=We.getBoundingClientRect();return{left:Ke.left,right:Ke.right,top:Ke.top,bottom:Ke.bottom}}):[],xe=((Ji=document.querySelector('[data-testid="map-rail-topbar"]'))==null?void 0:Ji.getBoundingClientRect().bottom)??0}const st=ee,Q=()=>Math.max(ie,xe)-((be==null?void 0:be.top)??0),re=Math.floor(Te/Vb);if(F.current.bucket!==re&&(F.current={pane:Fb(F.current.pane),bucket:re},De&&Fe.zone==="roam")){const we=document.querySelector('[data-testid="map-review-badge"]'),We=!!we&&we.className.includes("bg-review/20");let Ke=null;for(const{island:me,container:ze}of te.sections.values()){const Oe=me.balls.find(ht=>!ht.body.isStatic);if(Oe){const ht=ze.getBoundingClientRect();Ke={x:ht.left+Oe.body.position.x,y:ht.top+Oe.body.position.y};break}}const Re=R.current>Te?P.current:null,Xe=qb(re,{hasReview:We,hasNext:!!Ke,hasFriction:!!Re});if(Xe==="review"&&we){const me=we.getBoundingClientRect();V.current={kind:Xe,until:Te+Ha,pos:{x:me.right+44,y:me.bottom+64},fired:!1},F.current.pane="rail"}else Xe==="inspect"&&Ke?(V.current={kind:Xe,until:Te+Ha,pos:{x:Ke.x+34,y:Ke.y-66},fired:!1},F.current.pane="rail"):Xe==="friction"&&Re&&(V.current={kind:Xe,until:Te+Ha,pos:{x:Re.x,y:Re.y},fired:!1},F.current.pane="rail")}const ve=V.current&&Te<V.current.until?V.current:null;V.current&&!ve&&(V.current=null);const ke=Wb();if(ke&&ke.seq!==_.current&&!Fe.examActive){_.current=ke.seq;let we=ke.x,We=ke.y;if((we==null||We==null)&&De)for(const{island:Ke,container:Re}of te.sections.values()){const Xe=Ke.ball(ke.nodeId);if(Xe){const me=Re.getBoundingClientRect();we=me.left+Xe.body.position.x,We=me.top+Xe.body.position.y;break}}De&&we!=null&&We!=null?(A.current={nodeId:ke.nodeId,x:we,y:We,until:Te+2400,fired:!1,fly:!0},C({until:Te+2400})):(A.current={nodeId:ke.nodeId,x:0,y:0,until:Te+1600,fired:!0,fly:!1},C({until:Te+1600}))}const Ne=!!A.current&&Te<A.current.until;if(A.current&&!Ne&&(A.current=null,C(null)),Ne&&A.current&&!A.current.fired){const we=A.current;if(we.fired=!0,we.fly&&be)for(const{island:We}of te.sections.values()){const Ke=We.ball(we.nodeId);if(Ke&&!Ke.body.isStatic){bn.Body.applyForce(Ke.body,Ke.body.position,{x:.0035,y:-.005});break}}}const at=$b();if(at&&at.seq!==L.current&&!Fe.examActive&&(L.current=at.seq,De&&be)){const we=Q();M.current={x:Math.min(be.width-44,Math.max(44,at.x-be.left)),y:Math.min(be.height-44,Math.max(we+52,at.y-be.top)),until:Te+3200}}const bt=!!M.current&&Te<M.current.until;M.current&&!bt&&(M.current=null);const ye=!!H.current&&Te<H.current.until;H.current&&!ye&&(H.current=null);const Be=l_(),Ve=Be?Be.startContainer.parentElement??null:null;let fe=null,Ge=F.current.pane;const Et=Fe.examActive?(Fn=document.querySelector('[data-testid="exam-timer"]'))==null?void 0:Fn.getBoundingClientRect():void 0;if(Et){g.current=null,B.current=null,Ge="chat";const we={x:Math.min(Et.right+64,window.innerWidth-70),y:Math.min(Et.bottom+56,window.innerHeight-90)},We=y.current??we;fe=Qt(We,we,Me,Vn),de=Math.max(-.15,Math.min(.15,(fe.x-We.x)*.008))}else if(Qe){const we=B.current;g.current=null,fe={x:we.x,y:we.y},de=Math.max(-.5,Math.min(.5,we.vx*.04)),Ge=c.current}else if(Ve&&Be){const we=Ve.closest('[data-testid="notebook-panel"], [data-testid="chat-stream"]'),We=we==null?void 0:we.getBoundingClientRect(),Ke=u_()??Be,Re=Ke.getClientRects(),Xe=[];for(let Je=0;Je<Re.length;Je++){const $e=Re[Je];$e.width>1&&$e.height>1&&Xe.push({left:$e.left,right:$e.right,top:$e.top,bottom:$e.bottom})}const me=Xe.length?Xe[Xe.length-1]:null,ze=Xe.length?Xe[0]:null,Oe=Ke.getBoundingClientRect(),ht=!!(we!=null&&we.closest('[data-testid="chat-stream"]')),Ft=ht?Lt.chat:Lt.notebook;if(Ge=ht?"chat":"notebook",We&&(me||Oe.width>0)){const Je=kc({left:Oe.left,right:Oe.right,top:Oe.top,bottom:Oe.bottom},We,Ft,{first:ze??void 0,last:me??void 0},Xe),$e={dir:Je.dir,pane:Ge};if((((es=h.current)==null?void 0:es.dir)!==$e.dir||((ts=h.current)==null?void 0:ts.pane)!==$e.pane)&&(h.current=$e,o($e)),m.current!==Je.occluding&&(m.current=Je.occluding,d(Je.occluding)),r)fe=Je,de=0;else{const je=y.current??{x:Je.x,y:Je.y};fe=Qt(je,Je,Me,Yb,110),de=Je.dir==="left"?-.07:Je.dir==="right"?.07:0}}else{h.current!==null&&(h.current=null,o(null)),m.current&&(m.current=!1,d(!1));const Je=We?{x:We.right-70,y:Math.max(We.top+96,ie+Ft*.8)}:Gb(window.innerHeight,Ft,ie),$e=y.current??{x:Je.x,y:Je.y};fe=Qt($e,Je,Me,Vn),de=Math.max(-.25,Math.min(.25,(fe.x-$e.x)*.01))}}else{h.current!==null&&(h.current=null,o(null)),m.current&&(m.current=!1,d(!1));const we=Fe.pose==="writing"?c_():null,We=Fe.zone,Ke=(we==null?void 0:we.host)??null,Re=we==null?void 0:we.range.getBoundingClientRect(),Xe=!!(Ke&&Re&&Re.width>0);if(we&&Xe){const me=Ke,ze=me.getBoundingClientRect(),Oe=Re,ht=!!me.closest('[data-testid="chat-stream"]');Ge=ht?"chat":"notebook";{const Ft=we.block,Je=[];if(Ft){const je=document.createRange();je.selectNodeContents(Ft);const jn=je.getClientRects();for(let _t=0;_t<jn.length;_t++){const Yt=jn[_t];Yt.width>1&&Yt.height>1&&Je.push({left:Yt.left,right:Yt.right,top:Yt.top,bottom:Yt.bottom})}}const $e=kc(Oe,ze,ht?Lt.chat:Lt.notebook,{first:Oe,last:Oe},Je.length?Je:void 0);if(g.current=null,r)fe=$e,de=0;else{const je=y.current??{x:$e.x,y:$e.y};fe=Qt(je,$e,Me,Vn),de=.08}}}else if(ye&&H.current&&H.current.pane!=="rail"){g.current=null;const me=H.current;Ge=me.pane==="notebook"?"notebook":"chat";const ze=Ge==="notebook"?Lt.notebook:Lt.chat,Oe=jb({x:me.x,y:me.y},ze,window.innerWidth,Math.max(ie,xe));if(r)fe=Oe,de=0;else{const ht=y.current??{x:Oe.x,y:Oe.y};fe=Qt(ht,Oe,Me,Vn),de=Math.max(-.2,Math.min(.2,(fe.x-ht.x)*.01))}}else if(We==="chat"&&Ih()){g.current=null,Ge="chat";const me=Ih();if(r)fe=me,de=0;else{const ze=Sc("chat",Te),Oe=y.current??{x:me.x,y:me.y};fe=Qt(Oe,{x:me.x+ze.x,y:me.y+ze.y},Me,Vn),de=Math.max(-.35,Math.min(.35,(fe.x-Oe.x)*.014))}}else if(We==="notebook"&&st){g.current=null,Ge="notebook";const me=dI()??{x:st.right-70,y:st.top+96};if(r)fe=me,de=0;else{const ze=Sc("notebook",Te),Oe=y.current??{x:me.x,y:me.y};fe=Qt(Oe,{x:me.x+ze.x,y:me.y+ze.y},Me,Vn),de=Math.max(-.3,Math.min(.3,(fe.x-Oe.x)*.012))}}else if(De&&(Ne||bt||We==="rail"||We==="roam")){const me=be.width,ze=be.height;if(Ge="rail",r)fe={x:be.left+me*.5,y:be.top+ze*.5},de=0;else{if((me!==Y||ze!==X)&&(Y=me,X=ze,(Bt=g.current)==null||Bt.resize(me,ze),P.current=null),!g.current){g.current=cI({width:me,height:ze});const ft=y.current;ft&&bn.Body.setPosition(g.current.body,{x:Math.min(me-30,Math.max(30,ft.x-be.left)),y:Math.min(ze-30,Math.max(30,ft.y-be.top))})}const Oe=g.current,ht=[],Ft=[];for(const{island:ft,container:Hn}of te.sections.values()){const Un=Hn.getBoundingClientRect();if(Un.bottom<be.top-120||Un.top>be.bottom+120)continue;const mr=Un.left-be.left,Tn=Un.top-be.top;for(const wt of ft.balls)ht.push({x:mr+wt.body.position.x,y:Tn+wt.body.position.y,vx:wt.body.velocity.x,vy:wt.body.velocity.y,r:Ut,isStatic:wt.body.isStatic,push:(Gt,zn)=>bn.Body.applyForce(wt.body,wt.body.position,{x:Gt,y:zn})}),Ft.push({x:mr+wt.body.position.x,y:Tn+wt.body.position.y-Ut-20});for(const wt of ft.links)for(const Gt of wt.particles)Ft.push({x:mr+Gt.position.x,y:Tn+Gt.position.y-8})}const Je=We==="roam";let $e=P.current,je=!1;if(bt&&M.current)$e={x:M.current.x+28,y:M.current.y-52},je=!1;else if(Ne&&A.current&&A.current.fly)$e={x:A.current.x-be.left+34,y:A.current.y-be.top-46},je=!1;else if(ye&&H.current&&H.current.pane==="rail")$e={x:H.current.x-be.left+34,y:H.current.y-be.top-46},je=!1;else if(ve)$e={x:ve.pos.x-be.left,y:ve.pos.y-be.top},ve.fired||(ve.fired=!0,Pr());else if(Je){const ft=wc(be,Lt.rail,Te);$e={x:ft.x-be.left,y:ft.y-be.top}}else{if(Fe.mode==="veil"){const ft=uI({x:Oe.body.position.x,y:Oe.body.position.y},Ft,220);ft&&($e=ft,je=!0)}(!$e||Te>R.current)&&(P.current=lI(me,ze,ht,Math.floor(Te/1e3)),R.current=Te+3e3,$e=P.current)}const jn=Oe.step(Me,$e,Fe.mode==="veil"&&!Je?[]:ht,Te,{settle:je,ceilY:Q()});if(jn&&!S.current&&Hb(),S.current=jn||Oe.dizzyRemaining(Te)>0,Oe.dizzyRemaining(Te)===0){const ft=Rm(te.weather);if(ft.wind>=.3){const Hn=Oe.body.mass;bn.Body.applyForce(Oe.body,Oe.body.position,{x:Im(Oe.body.position.x,Oe.body.position.y,Te)*ft.wind*Nm*Hn*2.2,y:0})}(te.weather==="rain"||te.weather==="storm")&&Fe.mode!=="veil"&&Te>q.current&&(q.current=Te+6e3+Math.random()*4e3,ne.classList.add("cp-shiver"),setTimeout(()=>ne.classList.remove("cp-shiver"),460))}const _t=Oe.body.position,Yt={x:be.left+_t.x,y:be.top+_t.y},Pt=y.current??Yt;fe=Qt(Pt,Yt,Me,Vn),de=Oe.body.angle+oI(Oe.body.velocity.x,Oe.body.velocity.y)}}else if(g.current=null,De&&be){Ge="rail";const me=wc(be,Lt.rail,Te),ze=y.current??{x:me.x,y:me.y};fe=Qt(ze,me,Me,Kb,140),de=Math.max(-.25,Math.min(.25,(fe.x-ze.x)*.01))}else if(E.current)if(Ge=E.current.pane,r)fe={x:E.current.x,y:E.current.y},de=0;else{const me=Ub(E.current,Te),ze=y.current??me;fe=Qt(ze,me,Me,Ac),de=Math.max(-.2,Math.min(.2,(fe.x-ze.x)*.01))}else if(Se)if(Ge="titlebar",r)fe={x:(Se.left+Se.right)/2,y:(Se.top+Se.bottom)/2},de=0;else{const me=zb(Se,Lt.titlebar,Te),ze=y.current??me;fe=Qt(ze,me,Me,Ac),de=0}}if(Ge==="titlebar"&&fe){const we=Lt.titlebar/2,We=fe.x-we,Ke=fe.x+we,Re=fe.y-we,Xe=fe.y+we,me=Le.some(ze=>We<ze.right&&Ke>ze.left&&Re<ze.bottom&&Xe>ze.top);ne.classList.toggle("cp-titlebar-dim",me)}else ne.classList.contains("cp-titlebar-dim")&&ne.classList.remove("cp-titlebar-dim");if(c.current!==Ge&&(c.current=Ge,u(Ge)),!fe){ne.style.opacity="0",y.current=null,k.current=null;return}y.current=fe;const On=ne.offsetWidth||Lt[Ge],Xi=Ge==="rail"?Math.max(ie,xe):ie;Ge!=="titlebar"&&fe.y<Xi+On/2+10&&(fe.y=Xi+On/2+10),ne.style.transform=`translate3d(${(fe.x-On/2).toFixed(1)}px, ${(fe.y-On/2).toFixed(1)}px, 0) rotate(${(de*57.2958).toFixed(1)}deg)`;const Bn=k.current;if(Bn){const we=fe.x-Bn.x,We=fe.y-Bn.y,Re=Math.hypot(we,We)/Math.max(1,Me);if(ne.style.setProperty("--cp-speed",Math.min(1,Re/.45).toFixed(3)),Re>.02){const Xe=(Math.atan2(We,we)*57.2958+90+360)%360;ne.style.setProperty("--cp-thrust-deg",Xe.toFixed(1)+"deg")}}k.current={x:fe.x,y:fe.y}};return oe=requestAnimationFrame(pe),()=>{var Te;cancelAnimationFrame(oe),(Te=g.current)==null||Te.dispose(),g.current=null}},[t.enabledLoaded,t.enabled,t.petMode,r]);const W=v.useRef(0);if(v.useEffect(()=>{const ne=b.current;if(!ne||t.state.keySeq===W.current||t.state.examActive)return;W.current=t.state.keySeq,ne.classList.remove("cp-keypress"),ne.offsetWidth,ne.classList.add("cp-keypress");const oe=setTimeout(()=>ne.classList.remove("cp-keypress"),160);return()=>clearTimeout(oe)},[t.state.keySeq]),!t.enabledLoaded||!t.enabled||t.petMode)return null;const K=s?"flying":t.state.typing?"typing":N||(a==null?void 0:a.dir)==="left"?"point":(a==null?void 0:a.dir)==="right"?"pointr":(a==null?void 0:a.dir)==="up"?"pointu":(a==null?void 0:a.dir)==="down"?"pointd":t.state.pose,D=a?Lt[a.pane]:Lt[l];return p.jsx("div",{ref:b,className:`cp-creature fixed left-0 top-0 z-40 will-change-transform ${t.state.mode==="veil"?"cp-veil":""} ${f?"cp-occluding":""} ${t.state.grabbed?"cp-grabbed":""}`,"data-testid":"companion-creature","data-zone":t.state.zone==="roam"?l:t.state.zone,"data-mode":t.state.mode,children:p.jsx(Db,{form:t.form,expression:t.state.expression,screenKey:t.state.typing?t.state.lastKey??(t.state.lastKeyKind==="enter"?"→":t.state.lastKeyKind==="back"?"⌫":null):null,keyFlash:t.state.typing&&t.state.lastKey==null&&(t.state.lastKeyKind==="enter"||t.state.lastKeyKind==="back"),coreLit:t.state.correctStreak>=3,noteTick:Date.now()<t.state.noteTickUntil,pose:K,viseme:n.viseme,openScale:n.open,energyRatio:t.energyRatio,streakLit:t.streakLit,size:D,interactive:!0,ariaLabel:"companion",onPoke:Ob,onGrab:(ne,oe)=>{B.current||(B.current={x:ne,y:oe,vx:0,vy:0,t:performance.now()},Tc(!0))},haloBadge:t.halo,testid:"companion-mascot",keySeq:t.state.keySeq,keySide:t.state.keySide})})}function fI(e,t){if(t.type==="text"){const n=e[e.length-1];return n&&n.type==="text"?[...e.slice(0,-1),{type:"text",text:n.text+t.text}]:[...e,{type:"text",text:t.text}]}if(t.type==="reasoning"){const n=e[e.length-1];return n&&n.type==="reasoning"?[...e.slice(0,-1),{type:"reasoning",text:n.text+t.text}]:[...e,{type:"reasoning",text:t.text}]}if(t.type==="tool-start")return[...e,{type:"tool-call",toolName:t.toolName,state:"input-available"}];if(t.type==="tool-result"){let n=-1;for(let r=e.length-1;r>=0;r--){const s=e[r];if(s.type==="tool-call"&&s.toolName===t.toolName&&s.state==="input-available"){n=r;break}}return n<0?e:e.map((r,s)=>s===n?{...r,state:"output-available",output:t.output}:r)}if(t.type==="tool-error"){let n=-1;for(let r=e.length-1;r>=0;r--){const s=e[r];if(s.type==="tool-call"&&s.toolName===t.toolName&&s.state==="input-available"){n=r;break}}return n<0?e:e.map((r,s)=>s===n?{...r,state:"output-error",error:t.error}:r)}return e}function yl(e){return{messages:[],streaming:!1,streamingMsgId:null,loaded:!1,focusNodeId:null,touched:e}}function Nu(e,t,n){if(e.has(t))return e;const r=new Map(e);return r.set(t,yl(n)),r}function Rh(e,t,n){const r=e.get(t);if(!r||r.touched===n)return e;const s=new Map(e);return s.set(t,{...r,touched:n}),s}function mI(e,t,n,r,s,i){const a=Nu(e,t,s),o=a.get(t);let l=o.streamingMsgId,u=o.messages;if(!(l&&u.some(f=>f.id===l))){const f=u[u.length-1];o.streaming&&f&&f.role==="assistant"?l=f.id:(l=r(),u=[...u,{id:l,role:"assistant",parts:[]}])}const h=new Map(a);return h.set(t,{...o,messages:u.map(f=>f.id===l?{...f,parts:fI(f.parts,n)}:f),streamingMsgId:l,focusNodeId:i??o.focusNodeId,touched:s}),h}function pI(e,t,n,r){const s=e.get(t);if(!s)return e;let i=-1,a=-1;for(let u=s.messages.length-1;u>=0&&(s.messages[u].role==="user"&&i===-1&&(i=u),s.messages[u].role==="assistant"&&a===-1&&(a=u),!(i!==-1&&a!==-1));u--);const o=s.messages.map((u,c)=>c===i&&(n!=null&&n.userMessageId)?{...u,id:n.userMessageId}:c===a&&(n!=null&&n.assistantMessageId)?{...u,id:n.assistantMessageId}:u),l=new Map(e);return l.set(t,{...s,messages:o,streaming:!1,streamingMsgId:null,touched:r}),l}function fg(e,t,n,r,s){const i=Nu(e,t,s),a=i.get(t),o=new Map(i);return o.set(t,{...a,messages:[...a.messages,{id:r(),role:"assistant",parts:[{type:"text",text:`⚠️ ${n}`}]}],streaming:!1,streamingMsgId:null,touched:s}),o}function gI(e,t,n,r){const s=Nu(e,t,r),i=s.get(t);if(i.streaming)return{buckets:e,accepted:!1};const a=new Map(s);return a.set(t,{...i,messages:[...i.messages,n],streaming:!0,streamingMsgId:null,touched:r}),{buckets:a,accepted:!0}}function bI(e,t,n,r,s){return fg(e,t,n,r,s)}function Ph(e,t){if(e.size<=t)return e;const n=Array.from(e.entries()).filter(([,a])=>!a.streaming),r=e.size-n.length,s=Math.max(0,t-r);if(n.length<=s)return e;n.sort((a,o)=>a[1].touched-o[1].touched);const i=new Map(e);for(let a=0;a<n.length-s;a++)i.delete(n[a][0]);return i}let xI=0;const Es=()=>`msg-v2-${++xI}`,Mh=8;function yI(e){if(!e)return null;try{const t=JSON.parse(e);return!Array.isArray(t)||t.length===0?null:t.every(r=>typeof r=="object"&&r!==null&&typeof r.type=="string")?t:null}catch{return null}}function EI(e,t){const[n,r]=v.useState(()=>new Map),s=v.useRef(n);s.current=n;const i=v.useRef(e??"");i.current=e??"",v.useEffect(()=>{if(!e)return;let g=!1;return(async()=>{const y=s.current.get(e);if(y&&(y.loaded||y.messages.length>0)){r(k=>Rh(k,e,Date.now()));return}try{const k=await se.threadGetMessages(e);if(g)return;r(T=>{const S=T.get(e);if(S&&(S.loaded||S.messages.length>0))return Rh(T,e,Date.now());const E=k.map(_=>{const A=yI(_.partsJson);return{id:_.id,role:_.role,parts:A??[{type:"text",text:_.content}],..._.displayText?{displayText:_.displayText}:{}}}),w=new Map(T);return w.set(e,{...S??yl(Date.now()),messages:E,loaded:!0,touched:Date.now()}),Ph(w,Mh)})}catch{}})(),()=>{g=!0}},[e]),v.useEffect(()=>{const g=se.on("chat:part",(T,S,E)=>{const w=S??i.current;r(_=>Ph(mI(_,w,T,Es,Date.now(),E),Mh))}),y=se.on("chat:done",(T,S,E)=>{const w=E??i.current;r(_=>pI(_,w,S,Date.now()))}),k=se.on("chat:error",(T,S)=>{const E=S??i.current;r(w=>fg(w,E,T,Es,Date.now()))});return()=>{g(),y(),k()}},[]);const a=v.useCallback(async(g,y,k,T)=>{var A;const S=y??e;if(!S||!g.trim()||(A=s.current.get(S))!=null&&A.streaming)return;const E=g.trim(),w={id:Es(),role:"user",parts:[...(T??[]).map(N=>({type:"attachment",attachment:{kind:N.kind,name:N.name,mime:N.mime,size:N.size,...N.previewUrl?{previewUrl:N.previewUrl}:{}}})),{type:"text",text:E}],...k?{displayText:k}:{}},_=gI(s.current,S,w,Date.now());if(_.accepted){r(_.buckets);try{await se.agentChatThread(S,E,k,t??null,T)}catch(N){const C=N instanceof Error?N.message:String(N);r(L=>bI(L,S,C,Es,Date.now()))}}},[e,t]),o=v.useCallback(async()=>{if(e){try{await se.abortAgentChatThread(e)}catch{}r(g=>{const y=g.get(e);if(!(y!=null&&y.streaming))return g;const k=new Map(g);return k.set(e,{...y,streaming:!1,streamingMsgId:null,touched:Date.now()}),k})}},[e]),l=v.useCallback(()=>{e&&r(g=>{const y=g.get(e);if(!y)return g;const k=new Map(g);return k.set(e,{...y,messages:[],streamingMsgId:null,loaded:!0,touched:Date.now()}),k})},[e]);v.useEffect(()=>{const g=y=>{const k=y.detail;if(typeof k!="string")return;const S={explain_simple:{msg:"用大白话给我讲讲这一节的核心概念",labelKey:"command.explain_simple"},quiz_3:{msg:"出 3 道练习题考考我",labelKey:"command.quiz_3"},compare_prev:{msg:"把这一节和上一节做个对比表",labelKey:"command.compare_prev"},concept_map:{msg:"画个概念图帮我理清这一节的知识结构",labelKey:"command.concept_map"},socratic:{msg:"切换到苏格拉底模式,用提问引导我思考",labelKey:"command.socratic"},exam_mode:{msg:"切换到考试冲刺模式,出有难度的题",labelKey:"command.exam_mode"}}[k];S&&a(S.msg,void 0,tu(S.labelKey))};return window.addEventListener("lookatstudy-command",g),()=>window.removeEventListener("lookatstudy-command",g)},[a]);const u=v.useCallback((g,y,k)=>{e&&r(T=>{const S=T.get(e);if(!S)return T;const E=new Map(T);return E.set(e,{...S,messages:S.messages.map(w=>{if(w.id!==g)return w;const _=[...w.parts],A=_[y];return A&&A.type==="tool-call"&&(_[y]={...A,output:{...typeof A.output=="object"&&A.output?A.output:{},status:k?"applied":"rejected"}}),{...w,parts:_}})}),E})},[e]),c=v.useCallback(g=>{e&&r(y=>{const k=y.get(e)??yl(Date.now()),T=new Map(y);return T.set(e,{...k,messages:g,loaded:!0,touched:Date.now()}),T})},[e]),h=e?n.get(e):void 0,f=v.useMemo(()=>(h==null?void 0:h.messages)??[],[h]),d=(h==null?void 0:h.streaming)??!1,m=v.useMemo(()=>Array.from(n.entries()).filter(([,g])=>g.streaming).map(([g])=>g),[n]),b=v.useMemo(()=>Array.from(n.values()).filter(g=>g.streaming&&g.focusNodeId).map(g=>g.focusNodeId).filter((g,y,k)=>k.indexOf(g)===y),[n]);return{messages:f,streaming:d,streamingThreadIds:m,streamingNodeIds:b,send:a,stop:o,clear:l,markProposalStatus:u,setMessagesForNode:c}}const vs=(e,t=60)=>e.length>t?e.slice(0,t)+"…":e;function vI(e,t){return t("quiz.hook.label",{correct:e.correct,total:e.total})}function TI(e,t){const n=e.detail.map((s,i)=>s.correct?t("quiz.hook.lineOk",{n:i+1,prompt:vs(s.prompt)}):t("quiz.hook.lineWrong",{n:i+1,prompt:vs(s.prompt),chosen:vs(s.chosen,30),answer:vs(s.answerText,30)})),r=e.title?`《${e.title}》`:"";return t("quiz.hook.message",{title:r,correct:e.correct,total:e.total})+(n.length?`
528
+ `+n.join(`
529
+ `):"")}function kI(e,t){const[n,r]=v.useState([]),[s,i]=v.useState(null),a=v.useCallback(async()=>{if(!e||!t){r([]),i(null);return}try{const b=(await se.threadList(e,"active")).filter(g=>g.focusNodeId===t);r(b),b.length>0?i(b[0].id):i(null)}catch{r([]),i(null)}},[e,t]);v.useEffect(()=>{a()},[a]);const o=v.useCallback(async m=>{if(!e||!t)return null;try{const b=await se.threadCreate({...m,courseId:e,focusNodeId:t});return r(g=>[b,...g]),i(b.id),b}catch{return null}},[e,t]),l=v.useCallback(async(m,b)=>{try{const g=await se.threadUpdate(m,b);return g&&(g.status==="archived"?(r(y=>y.filter(k=>k.id!==m)),i(y=>{var T;return y!==m?y:((T=n.filter(S=>S.id!==m)[0])==null?void 0:T.id)??null})):r(y=>y.map(k=>k.id===m?g:k))),g}catch{return null}},[n]),u=v.useCallback(async m=>{try{await se.threadDelete(m),r(b=>b.filter(g=>g.id!==m)),i(b=>{var y;return b!==m?b:((y=n.filter(k=>k.id!==m)[0])==null?void 0:y.id)??null})}catch{}},[n]),c=v.useCallback(m=>{const b=n.find(g=>g.id===m)??null;return b?(r(g=>g.filter(y=>y.id!==m)),i(g=>{var k;return g!==m?g:((k=n.filter(T=>T.id!==m)[0])==null?void 0:k.id)??null}),b):null},[n]),h=v.useCallback(m=>{r(b=>[m,...b.filter(g=>g.id!==m.id)]),i(m.id)},[]),f=v.useCallback(async(m,b)=>{if(!e||!t)return null;if(s)return s;const g=await o({title:(b??m).trim()});return(g==null?void 0:g.id)??null},[e,t,s,o]),d=n.find(m=>m.id===s)??null;return{threads:n,activeId:s,activeThread:d,setActiveId:i,reload:a,create:o,update:l,remove:u,removeWithUndo:c,restore:h,ensureThreadForSend:f}}function wI({threads:e,activeThread:t,focusNodeTitle:n,streamingThreadIds:r,onPickThread:s,onCreate:i,onRename:a,onArchive:o,onDelete:l}){const u=Ye(),[c,h]=v.useState(null),[f,d]=v.useState(null),[m,b]=v.useState(null),[g,y]=v.useState(""),[k,T]=v.useState(null),S=v.useRef(null);v.useEffect(()=>{const A=N=>{S.current&&!S.current.contains(N.target)&&(h(null),d(null))};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);const E=(A,N)=>{A.stopPropagation();const C=A.currentTarget.getBoundingClientRect(),L=Math.max(8,C.right-128),M=C.bottom+4;d({top:M,left:L}),h(c===N?null:N)},w=A=>{b(A.id),y(A.title??""),h(null),d(null)},_=()=>{m&&g.trim()&&a(m,g.trim()),b(null)};return e.length===0?p.jsxs("div",{className:"px-4 py-2 shrink-0 flex items-center gap-2 text-label bg-surface-1 opacity-60","data-testid":"thread-switcher-empty",children:[p.jsx("span",{className:"w-1 h-1 rounded-full bg-brand shrink-0"}),p.jsx("span",{className:"text-ink-muted truncate flex-1",children:n??u("thread.empty.no_node")}),p.jsx("span",{className:"text-caption text-ink-muted shrink-0",children:u("thread.empty.hint")})]}):p.jsxs("div",{className:"shrink-0 bg-surface-1","data-testid":"thread-switcher",children:[p.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto scrollbar-thin px-3 py-1.5 opacity-70 hover:opacity-100 transition-opacity",children:[e.map(A=>{const N=A.id===(t==null?void 0:t.id),C=m===A.id,L=r.includes(A.id);return p.jsxs("div",{className:`group relative flex items-center gap-1.5 px-2 py-0.5 cursor-pointer whitespace-nowrap transition-colors shrink-0 rounded ${N?"text-ink-strong":"text-ink-muted hover:text-ink-strong"}`,onClick:()=>!C&&s(A.id),"data-testid":`thread-tab-${A.id.slice(0,8)}`,children:[L?p.jsx(fm,{className:"w-3 h-3 shrink-0 text-accent animate-spin","aria-label":u("thread.streamingBadge"),"data-testid":`thread-streaming-${A.id.slice(0,8)}`}):p.jsx("span",{className:`w-1 h-1 rounded-full shrink-0 transition-opacity ${N?"bg-brand opacity-100":"bg-[var(--border)] opacity-0 group-hover:opacity-60"}`}),C?p.jsx("input",{value:g,onChange:M=>y(M.target.value),onKeyDown:M=>{M.key==="Enter"&&_(),M.key==="Escape"&&b(null)},onBlur:_,onClick:M=>M.stopPropagation(),autoFocus:!0,className:"bg-surface-0 text-ink-strong text-label rounded px-1.5 py-0.5 border border-brand focus:outline-none focus:ring-2 focus:ring-brand/20 w-28","data-testid":"thread-rename-input"}):p.jsx("span",{className:`text-label max-w-[120px] truncate ${N?"font-semibold":"font-normal"}`,"data-tooltip":A.title||u("toast.threadDefault"),children:A.title||u("toast.threadDefault")}),!C&&p.jsx("button",{onClick:M=>E(M,A.id),className:"flex items-center justify-center w-4 h-4 rounded text-ink-muted hover:text-ink-strong hover:bg-ink/5 opacity-0 group-hover:opacity-100 pointer-coarse:opacity-100 transition-all","data-testid":`thread-gear-${A.id.slice(0,8)}`,title:u("thread.actions.label"),"aria-label":u("thread.actions.label"),children:p.jsx(Us,{className:"w-3 h-3"})})]},A.id)}),p.jsx("button",{onClick:i,className:"flex items-center justify-center w-6 h-6 ml-1 rounded text-ink-muted hover:text-brand hover:bg-ink/5 transition-colors shrink-0","data-testid":"thread-new",title:u("thread.new.label"),"aria-label":u("thread.new.label"),children:p.jsx(bm,{className:"w-3.5 h-3.5"})})]}),c&&f&&(()=>{const A=e.find(N=>N.id===c);return A?p.jsxs("div",{ref:S,style:{position:"fixed",top:f.top,left:f.left},className:"z-50 w-32 bg-surface-0 rounded-lg shadow-pop py-1 border border-[var(--border-faint)]","data-testid":`thread-menu-${A.id.slice(0,8)}`,onClick:N=>N.stopPropagation(),children:[p.jsxs("button",{onClick:()=>w(A),className:"w-full flex items-center gap-1.5 px-2.5 py-1.5 text-label text-ink-muted hover:bg-surface-1 hover:bg-surface-3 hover:text-ink-strong transition-colors",children:[p.jsx(Ux,{className:"w-3 h-3"}),u("thread.menu.rename")]}),p.jsxs("button",{onClick:()=>{o(A.id),h(null),d(null)},className:"w-full flex items-center gap-1.5 px-2.5 py-1.5 text-label text-ink-muted hover:bg-surface-1 hover:bg-surface-3 hover:text-ink-strong transition-colors",children:[p.jsx(sx,{className:"w-3 h-3"}),u("thread.menu.archive")]}),p.jsxs("button",{onClick:N=>{const C=N.currentTarget.getBoundingClientRect();T({id:A.id,title:A.title??u("toast.threadDefault"),rect:C}),h(null),d(null)},className:"w-full flex items-center gap-1.5 px-2.5 py-1.5 text-label text-warning hover:bg-warning/10 transition-colors",children:[p.jsx(Ko,{className:"w-3 h-3"}),u("action.delete")]})]}):null})(),k&&p.jsx(Cm,{anchorRect:k.rect,message:u("thread.delete.confirm",{name:k.title}),danger:!0,confirmLabel:u("action.delete"),testid:"thread-delete-confirm",onConfirm:()=>{l(k.id),T(null)},onCancel:()=>T(null)})]})}const SI=1240,AI=920;function CI(e){return e>=SI?1:e>=AI?2:3}function _I(e){return e==="rail"?"rail":"notebook"}function NI(e,t,n){if(Math.abs(t)<60||Math.abs(t)<Math.abs(n)*1.6)return null;const r=["rail","chat","notebook"],s=r.indexOf(e)+(t<0?1:-1);return s>=0&&s<r.length?r[s]:null}function II(e){return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}function RI(){return CI(typeof window>"u"?PI:window.innerWidth)}const PI=99999;function MI(){return v.useSyncExternalStore(II,RI,()=>1)}const El=240,mg=480,pg=300,Mi=480,gg=1100,LI=320,vi=440,DI="clamp(480px, 36vw, 800px)",Iu=(e,t,n)=>Math.min(n,Math.max(t,e));function bg(e){return Iu(e*.36,Mi,800)}function vl(e,t,n){return Iu(e,El,Math.min(mg,Math.max(El,t-n)))}function xg(e,t,n){return Iu(e,Mi,Math.min(gg,Math.max(LI,t-n)))}function Lh(e,t,n){if(e==null||e.trim()==="")return null;const r=Number(e);return!Number.isFinite(r)||r<t||r>n?null:Math.round(r)}function OI(e,t,n){return e===3?{rail:!1,mid:!1}:{rail:t,mid:n}}function BI(e,t,n,r){if(r==="t3")return{rail:null,mid:null};if(r==="t2-rail")return{rail:e==null?null:vl(e,n,Mi),mid:null};const s=e??pg,i=t==null?null:xg(t,n,r==="t1"?vi+s:vi),a=i??bg(n);return{rail:r==="t1"&&e!=null?vl(e,n,vi+a):null,mid:i}}function FI(e){const t=v.useCallback(()=>e?window.innerWidth:0,[e]);return v.useSyncExternalStore(n=>(window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)),t,()=>0)}const jI=100;function Dh(e){const[t,n]=v.useState(!1),r=v.useRef(null),s=v.useRef(e);return s.current=e,v.useEffect(()=>{if(!t)return;document.body.classList.add("pane-dragging");const i=o=>{const l=r.current,u=s.current.target();if(!l||!u)return;const c=performance.now();c-l.lastAppliedAt<jI||(l.lastAppliedAt=c,u.style.width=`${s.current.clampLive(l.startW+(o.clientX-l.startX))}px`)},a=o=>{const l=r.current,u=s.current.target();if(r.current=null,n(!1),u&&(u.style.transition=""),!l)return;const c=s.current.clampLive(l.startW+(o.clientX-l.startX));u&&(u.style.width=`${c}px`),s.current.onCommit(c)};return window.addEventListener("pointermove",i),window.addEventListener("pointerup",a),window.addEventListener("pointercancel",a),()=>{document.body.classList.remove("pane-dragging"),window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",a)}},[t]),p.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":e.ariaLabel,"data-tooltip":e.tooltip,"data-testid":`pane-handle-${e.side}`,"data-dragging":t?"true":void 0,className:"pane-resize-handle",onPointerDown:i=>{if(i.button!==0)return;const a=e.target();if(a){i.preventDefault(),r.current={startX:i.clientX,startW:a.getBoundingClientRect().width,lastAppliedAt:0},a.style.transition="none",n(!0);try{i.currentTarget.setPointerCapture(i.pointerId)}catch{}}},onDoubleClick:()=>{const i=e.target();i&&(i.style.width=""),e.onCommit(null)}})}const Ru=v.createContext({});function Pu(e){const t=v.useRef(null);return t.current===null&&(t.current=e()),t.current}const HI=typeof window<"u",ea=HI?v.useLayoutEffect:v.useEffect,Na=v.createContext(null);function Mu(e,t){e.indexOf(t)===-1&&e.push(t)}function ta(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const hn=(e,t,n)=>n>t?t:n<e?e:n;let Ia=()=>{};const Rn={},yg=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),Eg=e=>typeof e=="object"&&e!==null,vg=e=>/^0[^.\s]+$/u.test(e);function Tg(e){let t;return()=>(t===void 0&&(t=e()),t)}const Wt=e=>e,$i=(...e)=>e.reduce((t,n)=>r=>n(t(r))),Li=(e,t,n)=>{const r=t-e;return r?(n-e)/r:1};class Lu{constructor(){this.subscriptions=[]}add(t){return Mu(this.subscriptions,t),()=>ta(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i<s;i++){const a=this.subscriptions[i];a&&a(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const $t=e=>e*1e3,qt=e=>e/1e3,kg=(e,t)=>t?e*(1e3/t):0,wg=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,UI=1e-7,zI=12;function VI(e,t,n,r,s){let i,a,o=0;do a=t+(n-t)/2,i=wg(a,r,s)-e,i>0?n=a:t=a;while(Math.abs(i)>UI&&++o<zI);return a}function Yi(e,t,n,r){if(e===t&&n===r)return Wt;const s=i=>VI(i,0,1,e,n);return i=>i===0||i===1?i:wg(s(i),t,r)}const Sg=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ag=e=>t=>1-e(1-t),Cg=Yi(.33,1.53,.69,.99),Du=Ag(Cg),_g=Sg(Du),Ng=e=>e>=1?1:(e*=2)<1?.5*Du(e):.5*(2-Math.pow(2,-10*(e-1))),Ou=e=>1-Math.sin(Math.acos(e)),Ig=Ag(Ou),Rg=Sg(Ou),qI=Yi(.42,0,1,1),WI=Yi(0,0,.58,1),Pg=Yi(.42,0,.58,1),$I=e=>Array.isArray(e)&&typeof e[0]!="number",Mg=e=>Array.isArray(e)&&typeof e[0]=="number",YI={linear:Wt,easeIn:qI,easeInOut:Pg,easeOut:WI,circIn:Ou,circInOut:Rg,circOut:Ig,backIn:Du,backInOut:_g,backOut:Cg,anticipate:Ng},GI=e=>typeof e=="string",Oh=e=>{if(Mg(e)){Ia(e.length===4);const[t,n,r,s]=e;return Yi(t,n,r,s)}else if(GI(e))return YI[e];return e},Ts=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function KI(e){let t=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(u){i.has(u)&&(l.schedule(u),e()),u(a)}const l={schedule:(u,c=!1,h=!1)=>{const d=h&&r?t:n;return c&&i.add(u),d.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(a=u,r){s=!0;return}r=!0;const c=t;t=n,n=c,t.forEach(o),t.clear(),r=!1,s&&(s=!1,l.process(u))}};return l}const XI=40;function Lg(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=Ts.reduce((T,S)=>(T[S]=KI(i),T),{}),{setup:o,read:l,resolveKeyframes:u,preUpdate:c,update:h,preRender:f,render:d,postRender:m}=a,b=()=>{const T=Rn.useManualTiming,S=T?s.timestamp:performance.now();n=!1,T||(s.delta=r?1e3/60:Math.max(Math.min(S-s.timestamp,XI),1)),s.timestamp=S,s.isProcessing=!0,o.process(s),l.process(s),u.process(s),c.process(s),h.process(s),f.process(s),d.process(s),m.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(b))},g=()=>{n=!0,r=!0,s.isProcessing||e(b)};return{schedule:Ts.reduce((T,S)=>{const E=a[S];return T[S]=(w,_=!1,A=!1)=>(n||g(),E.schedule(w,_,A)),T},{}),cancel:T=>{for(let S=0;S<Ts.length;S++)a[Ts[S]].cancel(T)},state:s,steps:a}}const{schedule:nt,cancel:Pn,state:xt,steps:Io}=Lg(typeof requestAnimationFrame<"u"?requestAnimationFrame:Wt,!0);let Ms;function QI(){Ms=void 0}const At={now:()=>(Ms===void 0&&At.set(xt.isProcessing||Rn.useManualTiming?xt.timestamp:performance.now()),Ms),set:e=>{Ms=e,queueMicrotask(QI)}},Dg=e=>t=>typeof t=="string"&&t.startsWith(e),Og=Dg("--"),ZI=Dg("var(--"),Bu=e=>ZI(e)?JI.test(e.split("/*")[0].trim()):!1,JI=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Bh(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Vr={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Di={...Vr,transform:e=>hn(0,1,e)},ks={...Vr,default:1},Ti=e=>Math.round(e*1e5)/1e5,Fu=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function e5(e){return e==null}const t5=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ju=(e,t)=>n=>!!(typeof n=="string"&&t5.test(n)&&n.startsWith(e)||t&&!e5(n)&&Object.prototype.hasOwnProperty.call(n,t)),Bg=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,a,o]=r.match(Fu);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},n5=e=>hn(0,255,e),Ro={...Vr,transform:e=>Math.round(n5(e))},Jn={test:ju("rgb","red"),parse:Bg("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Ro.transform(e)+", "+Ro.transform(t)+", "+Ro.transform(n)+", "+Ti(Di.transform(r))+")"};function r5(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Tl={test:ju("#"),parse:r5,transform:Jn.transform},Gi=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),gn=Gi("deg"),dn=Gi("%"),Ee=Gi("px"),i5=Gi("vh"),s5=Gi("vw"),Fh={...dn,parse:e=>dn.parse(e)/100,transform:e=>dn.transform(e*100)},wr={test:ju("hsl","hue"),parse:Bg("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+dn.transform(Ti(t))+", "+dn.transform(Ti(n))+", "+Ti(Di.transform(r))+")"},dt={test:e=>Jn.test(e)||Tl.test(e)||wr.test(e),parse:e=>Jn.test(e)?Jn.parse(e):wr.test(e)?wr.parse(e):Tl.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Jn.transform(e):wr.transform(e),getAnimatableNone:e=>{const t=dt.parse(e);return t.alpha=0,dt.transform(t)}},a5=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function o5(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Fu))==null?void 0:t.length)||0)+(((n=e.match(a5))==null?void 0:n.length)||0)>0}const Fg="number",jg="color",l5="var",u5="var(",jh="${}",c5=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Or(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const o=t.replace(c5,l=>(dt.test(l)?(r.color.push(i),s.push(jg),n.push(dt.parse(l))):l.startsWith(u5)?(r.var.push(i),s.push(l5),n.push(l)):(r.number.push(i),s.push(Fg),n.push(parseFloat(l))),++i,jh)).split(jh);return{values:n,split:o,indexes:r,types:s}}function d5(e){return Or(e).values}function Hg({split:e,types:t}){const n=e.length;return r=>{let s="";for(let i=0;i<n;i++)if(s+=e[i],r[i]!==void 0){const a=t[i];a===Fg?s+=Ti(r[i]):a===jg?s+=dt.transform(r[i]):s+=r[i]}return s}}function h5(e){return Hg(Or(e))}const f5=e=>typeof e=="number"?0:dt.test(e)?dt.getAnimatableNone(e):e,m5=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:f5(e);function p5(e){const t=Or(e);return Hg(t)(t.values.map((r,s)=>m5(r,t.split[s])))}const tn={test:o5,parse:d5,createTransformer:h5,getAnimatableNone:p5};function Po(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function g5({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,a=0;if(!t)s=i=a=n;else{const o=n<.5?n*(1+t):n+t-n*t,l=2*n-o;s=Po(l,o,e+1/3),i=Po(l,o,e),a=Po(l,o,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:r}}function na(e,t){return n=>n>0?t:e}const tt=(e,t,n)=>e+(t-e)*n,Mo=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},b5=[Tl,Jn,wr],x5=e=>b5.find(t=>t.test(e));function Hh(e){const t=x5(e);if(!t)return!1;let n=t.parse(e);return t===wr&&(n=g5(n)),n}const Uh=(e,t)=>{const n=Hh(e),r=Hh(t);if(!n||!r)return na(e,t);const s={...n};return i=>(s.red=Mo(n.red,r.red,i),s.green=Mo(n.green,r.green,i),s.blue=Mo(n.blue,r.blue,i),s.alpha=tt(n.alpha,r.alpha,i),Jn.transform(s))},kl=new Set(["none","hidden"]);function y5(e,t){return kl.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function E5(e,t){return n=>tt(e,t,n)}function Hu(e){return typeof e=="number"?E5:typeof e=="string"?Bu(e)?na:dt.test(e)?Uh:k5:Array.isArray(e)?Ug:typeof e=="object"?dt.test(e)?Uh:v5:na}function Ug(e,t){const n=[...e],r=n.length,s=e.map((i,a)=>Hu(i)(i,t[a]));return i=>{for(let a=0;a<r;a++)n[a]=s[a](i);return n}}function v5(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=Hu(e[s])(e[s],t[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function T5(e,t){const n=[],r={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){const i=t.types[s],a=e.indexes[i][r[i]],o=e.values[a]??0;n[s]=o,r[i]++}return n}const k5=(e,t)=>{const n=tn.createTransformer(t),r=Or(e),s=Or(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?kl.has(e)&&!s.values.length||kl.has(t)&&!r.values.length?y5(e,t):$i(Ug(T5(r,s),s.values),n):na(e,t)};function zg(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?tt(e,t,n):Hu(e)(e,t)}const w5=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>nt.update(t,n),stop:()=>Pn(t),now:()=>xt.isProcessing?xt.timestamp:At.now()}},Vg=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i<s;i++)r+=Math.round(e(i/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Uu=2e4;function zu(e,t=50,n=Uu,r){let s=0,i=e.next(s);for(;!i.done&&s<n;)s+=t,i=e.next(s);return s>=n?1/0:s}function S5(e,t=100,n){const r=n({...e,keyframes:[0,t]}),s=Math.min(zu(r),Uu);return{type:"keyframes",ease:i=>r.next(s*i).value/t,duration:qt(s)}}const ot={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function wl(e,t){return e*Math.sqrt(1-t*t)}const A5=12;function C5(e,t,n){let r=n;for(let s=1;s<A5;s++)r=r-e(r)/t(r);return r}const Lo=.001;function _5({duration:e=ot.duration,bounce:t=ot.bounce,velocity:n=ot.velocity,mass:r=ot.mass}){let s,i,a=1-t;a=hn(ot.minDamping,ot.maxDamping,a),e=hn(ot.minDuration,ot.maxDuration,qt(e)),a<1?(s=u=>{const c=u*a,h=c*e,f=c-n,d=wl(u,a),m=Math.exp(-h);return Lo-f/d*m},i=u=>{const h=u*a*e,f=h*n+n,d=a*a*u*u*e,m=Math.exp(-h),b=wl(u*u,a);return(-s(u)+Lo>0?-1:1)*((f-d)*m)/b}):(s=u=>{const c=Math.exp(-u*e),h=(u-n)*e+1;return-Lo+c*h},i=u=>{const c=Math.exp(-u*e),h=(n-u)*(e*e);return c*h});const o=5/e,l=C5(s,i,o);if(e=$t(e),isNaN(l))return{stiffness:ot.stiffness,damping:ot.damping,duration:e};{const u=l*l*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const N5=["duration","bounce"],I5=["stiffness","damping","mass"];function zh(e,t){return t.some(n=>e[n]!==void 0)}function R5(e){let t={velocity:ot.velocity,stiffness:ot.stiffness,damping:ot.damping,mass:ot.mass,isResolvedFromDuration:!1,...e};if(!zh(e,I5)&&zh(e,N5))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*hn(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:ot.mass,stiffness:s,damping:i}}else{const n=_5({...e,velocity:0});t={...t,...n,mass:ot.mass},t.isResolvedFromDuration=!0}return t}function ra(e=ot.visualDuration,t=ot.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],o={done:!1,value:i},{stiffness:l,damping:u,mass:c,duration:h,velocity:f,isResolvedFromDuration:d}=R5({...n,velocity:-qt(n.velocity||0)}),m=f||0,b=u/(2*Math.sqrt(l*c)),g=a-i,y=qt(Math.sqrt(l/c)),k=b*y,T=Math.abs(g)<5;r||(r=T?ot.restSpeed.granular:ot.restSpeed.default),s||(s=T?ot.restDelta.granular:ot.restDelta.default);let S,E;if(b<1){const _=wl(y,b),A=(m+k*g)/_,N=k*A+g*_,C=k*g-A*_;let L=-1,M=0,H=0;const P=R=>{if(R!==L){L=R;const B=Math.exp(-k*R),q=Math.sin(_*R),F=Math.cos(_*R);M=a-B*(A*q+g*F),H=B*(N*q+C*F)}};S=R=>(P(R),M),E=R=>(P(R),H)}else if(b===1){S=A=>a-Math.exp(-y*A)*(g+(m+y*g)*A);const _=m+y*g;E=A=>Math.exp(-y*A)*(y*_*A-m)}else{const _=y*Math.sqrt(b*b-1);S=L=>{const M=Math.exp(-k*L),H=Math.min(_*L,300);return a-M*((m+k*g)*Math.sinh(H)+_*g*Math.cosh(H))/_};const A=(m+k*g)/_,N=k*A-g*_,C=k*g-A*_;E=L=>{const M=Math.exp(-k*L),H=Math.min(_*L,300);return M*(N*Math.sinh(H)+C*Math.cosh(H))}}const w={calculatedDuration:d&&h||null,velocity:_=>$t(E(_)),next:_=>{const A=S(_);if(d)o.done=_>=h;else{const N=$t(E(_));o.done=Math.abs(N)<=r&&Math.abs(a-A)<=s}return o.value=o.done?a:A,o},toString:()=>{const _=Math.min(zu(w),Uu),A=Vg(N=>w.next(_*N).value,_,30);return _+"ms "+A},toTransition:()=>{}};return w}ra.applyToOptions=e=>{const t=S5(e,100,ra);return e.ease=t.ease,e.duration=$t(t.duration),e.type="keyframes",e};function Sl({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:a,min:o,max:l,restDelta:u=.5,restSpeed:c}){const h=e[0],f={done:!1,value:h},d=_=>_<o||_>l,m=_=>o===void 0?l:l===void 0||Math.abs(o-_)<Math.abs(l-_)?o:l;let b=n*t;const g=h+b,y=a===void 0?g:a(g);y!==g&&(b=y-h);const k=_=>-b*Math.exp(-_/r),T=_=>{const A=k(_);f.done=Math.abs(A)<=u,f.value=f.done?y:y+A};let S,E;const w=_=>{d(f.value)&&(S=_,E=ra({keyframes:[f.value,m(f.value)],velocity:-k(_)/r*1e3,damping:s,stiffness:i,restDelta:u,restSpeed:c}))};return w(0),{calculatedDuration:null,next:_=>{let A=!1;return!E&&S===void 0&&(A=!0,T(_),w(_)),S!==void 0&&_>=S?E.next(_-S):(!A&&T(_),f)}}}function P5(e,t,n){const r=[],s=n||Rn.mix||zg,i=e.length-1;for(let a=0;a<i;a++){let o=s(e[a],e[a+1]);if(t){const l=Array.isArray(t)?t[a]||Wt:t;o=$i(l,o)}r.push(o)}return r}function M5(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const i=e.length;if(Ia(i===t.length),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=P5(t,r,s),l=o.length,u=c=>{if(a&&c<e[0])return t[0];let h=0;if(l>1)for(;h<e.length-2&&!(c<e[h+1]);h++);const f=Li(e[h],e[h+1],c);return o[h](f)};return n?c=>u(hn(e[0],e[i-1],c)):u}function L5(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Li(0,t,r);e.push(tt(n,1,s))}}function D5(e){const t=[0];return L5(t,e.length-1),t}function O5(e,t){return e.map(n=>n*t)}function B5(e,t){return e.map(()=>t||Pg).splice(0,e.length-1)}function ki({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=$I(r)?r.map(Oh):Oh(r),i={done:!1,value:t[0]},a=O5(n&&n.length===t.length?n:D5(t),e),o=M5(a,t,{ease:Array.isArray(s)?s:B5(t,s)});return{calculatedDuration:e,next:l=>(i.value=o(l),i.done=l>=e,i)}}const F5=5;function j5(e,t,n){const r=Math.max(t-F5,0);return kg(n-e(r),t-r)}const H5=e=>e!==null;function Ra(e,{repeat:t,repeatType:n="loop"},r,s=1){const i=e.filter(H5),o=s<0||t&&n!=="loop"&&t%2===1?0:i.length-1;return!o||r===void 0?i[o]:r}const U5={decay:Sl,inertia:Sl,tween:ki,keyframes:ki,spring:ra};function qg(e){typeof e.type=="string"&&(e.type=U5[e.type])}class Vu{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const z5=e=>e/100;class ia extends Vu{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var r,s;const{motionValue:n}=this.options;n&&n.updatedAt!==At.now()&&this.tick(At.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(r=this.options).onStop)==null||s.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;qg(t);const{type:n=ki,repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:a=0}=t;let{keyframes:o}=t;const l=n||ki;l!==ki&&typeof o[0]!="number"&&(this.mixKeyframes=$i(z5,zg(o[0],o[1])),o=[0,100]);const u=l({...t,keyframes:o});i==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...o].reverse(),velocity:-a})),u.calculatedDuration===null&&(u.calculatedDuration=zu(u));const{calculatedDuration:c}=u;this.calculatedDuration=c,this.resolvedDuration=c+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=u}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:s,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:c,repeat:h,repeatType:f,repeatDelay:d,type:m,onUpdate:b,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-s/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),k=this.playbackSpeed>=0?y<0:y>s;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let T=this.currentTime,S=r;if(h){const A=Math.min(this.currentTime,s)/o;let N=Math.floor(A),C=A%1;!C&&A>=1&&(C=1),C===1&&N--,N=Math.min(N,h+1),!!(N%2)&&(f==="reverse"?(C=1-C,d&&(C-=d/o)):f==="mirror"&&(S=a)),T=hn(0,1,C)*o}let E;k?(this.delayState.value=c[0],E=this.delayState):E=S.next(T),i&&!k&&(E.value=i(E.value));let{done:w}=E;!k&&l!==null&&(w=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const _=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&w);return _&&m!==Sl&&(E.value=Ra(c,this.options,g,this.speed)),b&&b(E.value),_&&this.finish(),E}then(t,n){return this.finished.then(t,n)}get duration(){return qt(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+qt(t)}get time(){return qt(this.currentTime)}set time(t){t=$t(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const n=this.generator.next(t).value;return j5(r=>this.generator.next(r).value,t,n)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(At.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=qt(this.currentTime))}play(){var s,i;if(this.isStopped)return;const{driver:t=w5,startTime:n}=this.options;this.driver||(this.driver=t(a=>this.tick(a))),(i=(s=this.options).onPlay)==null||i.call(s);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(At.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function V5(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const er=e=>e*180/Math.PI,Al=e=>{const t=er(Math.atan2(e[1],e[0]));return Cl(t)},q5={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Al,rotateZ:Al,skewX:e=>er(Math.atan(e[1])),skewY:e=>er(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Cl=e=>(e=e%360,e<0&&(e+=360),e),Vh=Al,qh=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Wh=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),W5={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:qh,scaleY:Wh,scale:e=>(qh(e)+Wh(e))/2,rotateX:e=>Cl(er(Math.atan2(e[6],e[5]))),rotateY:e=>Cl(er(Math.atan2(-e[2],e[0]))),rotateZ:Vh,rotate:Vh,skewX:e=>er(Math.atan(e[4])),skewY:e=>er(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function _l(e){return e.includes("scale")?1:0}function Nl(e,t){if(!e||e==="none")return _l(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=W5,s=n;else{const o=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=q5,s=o}if(!s)return _l(t);const i=r[t],a=s[1].split(",").map(Y5);return typeof i=="function"?i(a):a[i]}const $5=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Nl(n,t)};function Y5(e){return parseFloat(e.trim())}const qr=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Wr=new Set([...qr,"pathRotation"]),$h=e=>e===Vr||e===Ee,G5=new Set(["x","y","z"]),K5=qr.filter(e=>!G5.has(e));function X5(e){const t=[];return K5.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Nn={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{const s=e.max-e.min;return r==="border-box"?s:s-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{const s=e.max-e.min;return r==="border-box"?s:s-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Nl(t,"x"),y:(e,{transform:t})=>Nl(t,"y")};Nn.translateX=Nn.x;Nn.translateY=Nn.y;const or=new Set;let Il=!1,Rl=!1,Pl=!1;function Wg(){if(Rl){const e=Array.from(or).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=X5(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,a])=>{var o;(o=r.getValue(i))==null||o.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Rl=!1,Il=!1,or.forEach(e=>e.complete(Pl)),or.clear()}function $g(){or.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Rl=!0)})}function Q5(){Pl=!0,$g(),Wg(),Pl=!1}class qu{constructor(t,n,r,s,i,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(or.add(this),Il||(Il=!0,nt.read($g),nt.resolveKeyframes(Wg))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;if(t[0]===null){const i=s==null?void 0:s.get(),a=t[t.length-1];if(i!==void 0)t[0]=i;else if(r&&n){const o=r.readValue(n,a);o!=null&&(t[0]=o)}t[0]===void 0&&(t[0]=a),s&&i===void 0&&s.set(t[0])}V5(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),or.delete(this)}cancel(){this.state==="scheduled"&&(or.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Z5=e=>e.startsWith("--");function Yg(e,t,n){Z5(t)?e.style.setProperty(t,n):e.style[t]=n}const J5={};function Gg(e,t){const n=Tg(e);return()=>J5[t]??n()}const e6=Gg(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Kg=Gg(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),li=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Yh={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:li([0,.65,.55,1]),circOut:li([.55,0,1,.45]),backIn:li([.31,.01,.66,-.59]),backOut:li([.33,1.53,.69,.99])};function Xg(e,t){if(e)return typeof e=="function"?Kg()?Vg(e,t):"ease-out":Mg(e)?li(e):Array.isArray(e)?e.map(n=>Xg(n,t)||Yh.easeOut):Yh[e]}function t6(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:a="loop",ease:o="easeOut",times:l}={},u=void 0){const c={[t]:n};l&&(c.offset=l);const h=Xg(o,s);Array.isArray(h)&&(c.easing=h);const f={delay:r,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"};return u&&(f.pseudoElement=u),e.animate(c,f)}function Qg(e){return typeof e=="function"&&"applyToOptions"in e}function n6({type:e,...t}){return Qg(e)&&Kg()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class Zg extends Vu{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:s,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:l}=t;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=t,Ia(typeof t.type!="string");const u=n6(t);this.animation=t6(n,r,s,u,i),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const c=Ra(s,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(c),Yg(n,r,c),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,r,s;const t=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((s=(r=this.animation).commitStyles)==null||s.call(r))}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return qt(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+qt(t)}get time(){return qt(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=$t(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:r,observe:s}){var i;return this.allowFlatten&&((i=this.animation.effect)==null||i.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&e6()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),Wt):s(this)}}const Jg={anticipate:Ng,backInOut:_g,circInOut:Rg};function r6(e){return e in Jg}function i6(e){typeof e.ease=="string"&&r6(e.ease)&&(e.ease=Jg[e.ease])}const Do=10;class s6 extends Zg{constructor(t){i6(t),qg(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:s,element:i,...a}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const o=new ia({...a,autoplay:!1}),l=Math.max(Do,At.now()-this.startTime),u=hn(0,Do,l-Do),c=o.sample(l).value,{name:h}=this.options;i&&h&&Yg(i,h,c),n.setWithVelocity(o.sample(Math.max(0,l-u)).value,c,u),o.stop()}}const Gh=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(tn.test(e)||e==="0")&&!e.startsWith("url("));function a6(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function o6(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],a=Gh(s,t),o=Gh(i,t);return!a||!o?!1:a6(e)||(n==="spring"||Qg(n))&&r}function Ml(e){e.duration=0,e.type="keyframes"}const e1=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),l6=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function u6(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&l6.test(e[t]))return!0;return!1}const c6=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),d6=Tg(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function h6(e){var h;const{motionValue:t,name:n,repeatDelay:r,repeatType:s,damping:i,type:a,keyframes:o}=e,l=(h=t==null?void 0:t.owner)==null?void 0:h.current;if(!(l instanceof HTMLElement)&&!(l instanceof SVGElement))return!1;const{onUpdate:u,transformTemplate:c}=t.owner.getProps();return d6()&&n&&(e1.has(n)||c6.has(n)&&u6(o))&&(n!=="transform"||!c)&&!u&&!r&&s!=="mirror"&&i!==0&&a!=="inertia"}const f6=40;class m6 extends Vu{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:a="loop",keyframes:o,name:l,motionValue:u,element:c,...h}){var m;super(),this.stop=()=>{var b,g;this._animation&&(this._animation.stop(),(b=this.stopTimeline)==null||b.call(this)),(g=this.keyframeResolver)==null||g.cancel()},this.createdAt=At.now();const f={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:a,name:l,motionValue:u,element:c,...h},d=(c==null?void 0:c.KeyframeResolver)||qu;this.keyframeResolver=new d(o,(b,g,y)=>this.onKeyframesResolved(b,g,f,!y),l,u,c),(m=this.keyframeResolver)==null||m.scheduleResolve()}onKeyframesResolved(t,n,r,s){var y,k;this.keyframeResolver=void 0;const{name:i,type:a,velocity:o,delay:l,isHandoff:u,onUpdate:c}=r;this.resolvedAt=At.now();let h=!0;o6(t,i,a,o)||(h=!1,(Rn.instantAnimations||!l)&&(c==null||c(Ra(t,r,n))),t[0]=t[t.length-1],Ml(r),r.repeat=0);const d={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>f6?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},m=h&&!u&&h6(d),b=(k=(y=d.motionValue)==null?void 0:y.owner)==null?void 0:k.current;let g;if(m)try{g=new s6({...d,element:b})}catch{g=new ia(d)}else g=new ia(d);g.finished.then(()=>{this.notifyFinished()}).catch(Wt),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),Q5()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function t1(e,t,n,r=0,s=1){const i=Array.from(e).sort((u,c)=>u.sortNodePosition(c)).indexOf(t),a=e.size,o=(a-1)*r;return typeof n=="function"?n(i,a):s===1?i*r:o-i*r}const Kh=30,p6=e=>!isNaN(parseFloat(e));class g6{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var i;const s=At.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=At.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=p6(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Lu);const r=this.events[t].add(n);return t==="change"?()=>{r(),nt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=At.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Kh)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Kh);return kg(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Br(e,t){return new g6(e,t)}function n1(e,t){if(e!=null&&e.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function Wu(e,t){const n=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return n!==e?n1(n,e):n}const b6={type:"spring",stiffness:500,damping:25,restSpeed:10},x6=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),y6={type:"keyframes",duration:.8},E6={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},v6=(e,{keyframes:t})=>t.length>2?y6:Wr.has(e)?e.startsWith("scale")?x6(t[1]):b6:E6,T6=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function k6(e){for(const t in e)if(!T6.has(t))return!0;return!1}const $u=(e,t,n,r={},s,i)=>a=>{const o=Wu(r,e)||{},l=o.delay||r.delay||0;let{elapsed:u=0}=r;u=u-$t(l);const c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-u,onUpdate:f=>{t.set(f),o.onUpdate&&o.onUpdate(f)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:i?void 0:s};k6(o)||Object.assign(c,v6(e,c)),c.duration&&(c.duration=$t(c.duration)),c.repeatDelay&&(c.repeatDelay=$t(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let h=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(Ml(c),c.delay===0&&(h=!0)),(Rn.instantAnimations||Rn.skipAnimations||s!=null&&s.shouldSkipAnimations||o.skipAnimations)&&(h=!0,Ml(c),c.delay=0),c.allowFlatten=!o.type&&!o.ease,h&&!i&&t.get()!==void 0){const f=Ra(c.keyframes,o);if(f!==void 0){nt.update(()=>{c.onUpdate(f),c.onComplete()});return}}return o.isSync?new ia(c):new m6(c)},w6=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function S6(e){const t=w6.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function r1(e,t,n=1){const[r,s]=S6(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const a=i.trim();return yg(a)?parseFloat(a):a}return Bu(s)?r1(s,t,n+1):s}function Xh(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function Yu(e,t,n,r){if(typeof t=="function"){const[s,i]=Xh(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=Xh(r);t=t(n!==void 0?n:e.custom,s,i)}return t}function lr(e,t,n){const r=e.getProps();return Yu(r,t,n!==void 0?n:r.custom,e)}const i1=new Set(["width","height","top","left","right","bottom",...qr]),Ll=e=>Array.isArray(e);function A6(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Br(n))}function C6(e){return Ll(e)?e[e.length-1]||0:e}function _6(e,t){const n=lr(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const a in i){const o=C6(i[a]);A6(e,a,o)}}const yt=e=>!!(e&&e.getVelocity);function N6(e){return!!(yt(e)&&e.add)}function Dl(e,t){const n=e.getValue("willChange");if(N6(n))return n.add(t);if(!n&&Rn.WillChange){const r=new Rn.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function Gu(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const I6="framerAppearId",s1="data-"+Gu(I6);function a1(e){return e.props[s1]}const R6=typeof window<"u";function P6({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function o1(e,t,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:i,transitionEnd:a,...o}=t;const l=e.getDefaultTransition();i=i?n1(i,l):l;const u=i==null?void 0:i.reduceMotion,c=i==null?void 0:i.skipAnimations;r&&(i=r);const h=[],f=s&&e.animationState&&e.animationState.getState()[s],d=i==null?void 0:i.path;d&&d.animateVisualElement(e,o,i,n,h);for(const m in o){const b=e.getValue(m,e.latestValues[m]??null),g=o[m];if(g===void 0||f&&P6(f,m))continue;const y={delay:n,...Wu(i||{},m)};c&&(y.skipAnimations=!0);const k=b.get();if(k!==void 0&&!b.isAnimating()&&!Array.isArray(g)&&g===k&&!y.velocity){nt.update(()=>b.set(g));continue}let T=!1;if(R6&&window.MotionHandoffAnimation){const w=a1(e);if(w){const _=window.MotionHandoffAnimation(w,m,nt);_!==null&&(y.startTime=_,T=!0)}}Dl(e,m);const S=u??e.shouldReduceMotion;b.start($u(m,b,g,S&&i1.has(m)?{type:!1}:y,e,T));const E=b.animation;E&&h.push(E)}if(a){const m=()=>nt.update(()=>{a&&_6(e,a)});h.length?Promise.all(h).then(m):m()}return h}function Ol(e,t,n={}){var l;const r=lr(e,t,n.type==="exit"?(l=e.presenceContext)==null?void 0:l.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const i=r?()=>Promise.all(o1(e,r,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:c=0,staggerChildren:h,staggerDirection:f}=s;return M6(e,t,u,c,h,f,n)}:()=>Promise.resolve(),{when:o}=s;if(o){const[u,c]=o==="beforeChildren"?[i,a]:[a,i];return u().then(()=>c())}else return Promise.all([i(),a(n.delay)])}function M6(e,t,n=0,r=0,s=0,i=1,a){const o=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),o.push(Ol(l,t,{...a,delay:n+(typeof r=="function"?0:r)+t1(e.variantChildren,l,r,s,i)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(o)}function L6(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>Ol(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=Ol(e,t,n);else{const s=typeof t=="function"?lr(e,t,n.custom):t;r=Promise.all(o1(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const D6={test:e=>e==="auto",parse:e=>e},l1=e=>t=>t.test(e),u1=[Vr,Ee,dn,gn,s5,i5,D6],Qh=e=>u1.find(l1(e));function O6(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||vg(e):!0}const B6=new Set(["brightness","contrast","saturate","opacity"]);function F6(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Fu)||[];if(!r)return e;const s=n.replace(r,"");let i=B6.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const j6=/\b([a-z-]*)\(.*?\)/gu,Bl={...tn,getAnimatableNone:e=>{const t=e.match(j6);return t?t.map(F6).join(" "):e}},Fl={...tn,getAnimatableNone:e=>{const t=tn.parse(e);return tn.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},Zh={...Vr,transform:Math.round},H6={rotate:gn,pathRotation:gn,rotateX:gn,rotateY:gn,rotateZ:gn,scale:ks,scaleX:ks,scaleY:ks,scaleZ:ks,skew:gn,skewX:gn,skewY:gn,distance:Ee,translateX:Ee,translateY:Ee,translateZ:Ee,x:Ee,y:Ee,z:Ee,perspective:Ee,transformPerspective:Ee,opacity:Di,originX:Fh,originY:Fh,originZ:Ee},sa={borderWidth:Ee,borderTopWidth:Ee,borderRightWidth:Ee,borderBottomWidth:Ee,borderLeftWidth:Ee,borderRadius:Ee,borderTopLeftRadius:Ee,borderTopRightRadius:Ee,borderBottomRightRadius:Ee,borderBottomLeftRadius:Ee,width:Ee,maxWidth:Ee,height:Ee,maxHeight:Ee,top:Ee,right:Ee,bottom:Ee,left:Ee,inset:Ee,insetBlock:Ee,insetBlockStart:Ee,insetBlockEnd:Ee,insetInline:Ee,insetInlineStart:Ee,insetInlineEnd:Ee,padding:Ee,paddingTop:Ee,paddingRight:Ee,paddingBottom:Ee,paddingLeft:Ee,paddingBlock:Ee,paddingBlockStart:Ee,paddingBlockEnd:Ee,paddingInline:Ee,paddingInlineStart:Ee,paddingInlineEnd:Ee,margin:Ee,marginTop:Ee,marginRight:Ee,marginBottom:Ee,marginLeft:Ee,marginBlock:Ee,marginBlockStart:Ee,marginBlockEnd:Ee,marginInline:Ee,marginInlineStart:Ee,marginInlineEnd:Ee,fontSize:Ee,backgroundPositionX:Ee,backgroundPositionY:Ee,...H6,zIndex:Zh,fillOpacity:Di,strokeOpacity:Di,numOctaves:Zh},U6={...sa,color:dt,backgroundColor:dt,outlineColor:dt,fill:dt,stroke:dt,borderColor:dt,borderTopColor:dt,borderRightColor:dt,borderBottomColor:dt,borderLeftColor:dt,filter:Bl,WebkitFilter:Bl,mask:Fl,WebkitMask:Fl},c1=e=>U6[e],z6=new Set([Bl,Fl]);function d1(e,t){let n=c1(e);return z6.has(n)||(n=tn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const V6=new Set(["auto","none","0"]);function q6(e,t,n){let r=0,s;for(;r<e.length&&!s;){const i=e[r];typeof i=="string"&&!V6.has(i)&&Or(i).values.length&&(s=e[r]),r++}if(s&&n)for(const i of t)e[i]=d1(n,s)}class W6 extends qu{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let h=t[c];if(typeof h=="string"&&(h=h.trim(),Bu(h))){const f=r1(h,n.current);f!==void 0&&(t[c]=f),c===t.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!i1.has(r)||t.length!==2)return;const[s,i]=t,a=Qh(s),o=Qh(i),l=Bh(s),u=Bh(i);if(l!==u&&Nn[r]){this.needsMeasurement=!0;return}if(a!==o)if($h(a)&&$h(o))for(let c=0;c<t.length;c++){const h=t[c];typeof h=="string"&&(t[c]=parseFloat(h))}else Nn[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)(t[s]===null||O6(t[s]))&&r.push(s);r.length&&q6(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Nn[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&t.getValue(r,s).jump(s,!1)}measureEndState(){var o;const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const s=t.getValue(n);s&&s.jump(this.measuredOrigin,!1);const i=r.length-1,a=r[i];r[i]=Nn[n](t.measureViewportBox(),window.getComputedStyle(t.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),(o=this.removedTransforms)!=null&&o.length&&this.removedTransforms.forEach(([l,u])=>{t.getValue(l).set(u)}),this.resolveNoneKeyframes()}}const Ku=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function h1(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const s=(n==null?void 0:n[e])??r.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e).filter(r=>r!=null)}const jl=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Ls(e){return Eg(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:Xu}=Lg(queueMicrotask,!1),Jt={x:!1,y:!1};function f1(){return Jt.x||Jt.y}function $6(e){return e==="x"||e==="y"?Jt[e]?null:(Jt[e]=!0,()=>{Jt[e]=!1}):Jt.x||Jt.y?null:(Jt.x=Jt.y=!0,()=>{Jt.x=Jt.y=!1})}function m1(e,t){const n=h1(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function Y6(e){return!(e.pointerType==="touch"||f1())}function G6(e,t,n={}){const[r,s,i]=m1(e,n);return r.forEach(a=>{let o=!1,l=!1,u;const c=()=>{a.removeEventListener("pointerleave",m)},h=g=>{u&&(u(g),u=void 0),c()},f=g=>{o=!1,window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),l&&(l=!1,h(g))},d=()=>{o=!0,window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",f,s)},m=g=>{if(g.pointerType!=="touch"){if(o){l=!0;return}h(g)}},b=g=>{if(!Y6(g))return;l=!1;const y=t(a,g);typeof y=="function"&&(u=y,a.addEventListener("pointerleave",m,s))};a.addEventListener("pointerenter",b,s),a.addEventListener("pointerdown",d,s)}),i}const p1=(e,t)=>t?e===t?!0:p1(e,t.parentElement):!1,Qu=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,K6=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function X6(e){return K6.has(e.tagName)||e.isContentEditable===!0}const Q6=new Set(["INPUT","SELECT","TEXTAREA"]);function Z6(e){return Q6.has(e.tagName)||e.isContentEditable===!0}const Ds=new WeakSet;function Jh(e){return t=>{t.key==="Enter"&&e(t)}}function Oo(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const J6=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=Jh(()=>{if(Ds.has(n))return;Oo(n,"down");const s=Jh(()=>{Oo(n,"up")}),i=()=>Oo(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function ef(e){return Qu(e)&&!f1()}const tf=new WeakSet;function e4(e,t,n={}){const[r,s,i]=m1(e,n),a=o=>{const l=o.currentTarget;if(!ef(o)||tf.has(o))return;Ds.add(l),n.stopPropagation&&tf.add(o);const u=t(l,o),c={...s,capture:!0},h=(m,b)=>{window.removeEventListener("pointerup",f,c),window.removeEventListener("pointercancel",d,c),Ds.has(l)&&Ds.delete(l),ef(m)&&typeof u=="function"&&u(m,{success:b})},f=m=>{h(m,l===window||l===document||n.useGlobalTarget||p1(l,m.target))},d=m=>{h(m,!1)};window.addEventListener("pointerup",f,c),window.addEventListener("pointercancel",d,c)};return r.forEach(o=>{(n.useGlobalTarget?window:o).addEventListener("pointerdown",a,s),Ls(o)&&(o.addEventListener("focus",u=>J6(u,s)),!X6(o)&&!o.hasAttribute("tabindex")&&(o.tabIndex=0))}),i}function Zu(e){return Eg(e)&&"ownerSVGElement"in e}const Os=new WeakMap;let An;const g1=(e,t,n)=>(r,s)=>s&&s[0]?s[0][e+"Size"]:Zu(r)&&"getBBox"in r?r.getBBox()[t]:r[n],t4=g1("inline","width","offsetWidth"),n4=g1("block","height","offsetHeight");function r4({target:e,borderBoxSize:t}){var n;(n=Os.get(e))==null||n.forEach(r=>{r(e,{get width(){return t4(e,t)},get height(){return n4(e,t)}})})}function i4(e){e.forEach(r4)}function s4(){typeof ResizeObserver>"u"||(An=new ResizeObserver(i4))}function a4(e,t){An||s4();const n=h1(e);return n.forEach(r=>{let s=Os.get(r);s||(s=new Set,Os.set(r,s)),s.add(t),An==null||An.observe(r)}),()=>{n.forEach(r=>{const s=Os.get(r);s==null||s.delete(t),s!=null&&s.size||An==null||An.unobserve(r)})}}const Bs=new Set;let Sr;function o4(){Sr=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Bs.forEach(t=>t(e))},window.addEventListener("resize",Sr)}function l4(e){return Bs.add(e),Sr||o4(),()=>{Bs.delete(e),!Bs.size&&typeof Sr=="function"&&(window.removeEventListener("resize",Sr),Sr=void 0)}}function nf(e,t){return typeof e=="function"?l4(e):a4(e,t)}function u4(e){return Zu(e)&&e.tagName==="svg"}const c4=[...u1,dt,tn],d4=e=>c4.find(l1(e)),rf=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ar=()=>({x:rf(),y:rf()}),sf=()=>({min:0,max:0}),mt=()=>({x:sf(),y:sf()}),h4=new WeakMap;function Pa(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Oi(e){return typeof e=="string"||Array.isArray(e)}const Ju=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ec=["initial",...Ju];function Ma(e){return Pa(e.animate)||ec.some(t=>Oi(e[t]))}function b1(e){return!!(Ma(e)||e.variants)}function f4(e,t,n){for(const r in t){const s=t[r],i=n[r];if(yt(s))e.addValue(r,s);else if(yt(i))e.addValue(r,Br(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const a=e.getValue(r);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=e.getStaticValue(r);e.addValue(r,Br(a!==void 0?a:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const Hl={current:null},x1={current:!1},m4=typeof window<"u";function p4(){if(x1.current=!0,!!m4)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Hl.current=e.matches;e.addEventListener("change",t),t()}else Hl.current=!1}const af=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let aa={};function y1(e){aa=e}function g4(){return aa}class b4{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,skipAnimations:i,blockInitialAnimation:a,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=qu,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const d=At.now();this.renderScheduledAt<d&&(this.renderScheduledAt=d,nt.render(this.render,!1,!0))};const{latestValues:u,renderState:c}=o;this.latestValues=u,this.baseTarget={...u},this.initialValues=n.initial?{...u}:{},this.renderState=c,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.skipAnimationsConfig=i,this.options=l,this.blockInitialAnimation=!!a,this.isControllingVariants=Ma(n),this.isVariantNode=b1(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:h,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const d in f){const m=f[d];u[d]!==void 0&&yt(m)&&m.set(u[d])}}mount(t){var n,r;if(this.hasBeenMounted)for(const s in this.initialValues)(n=this.values.get(s))==null||n.jump(this.initialValues[s]),this.latestValues[s]=this.initialValues[s];this.current=t,h4.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,i)=>this.bindToMotionValue(i,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(x1.current||p4(),this.shouldReduceMotion=Hl.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),Pn(this.notifyUpdate),Pn(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&e1.has(t)&&this.current instanceof HTMLElement){const{factory:a,keyframes:o,times:l,ease:u,duration:c}=n.accelerate,h=new Zg({element:this.current,name:t,keyframes:o,times:l,ease:u,duration:$t(c)}),f=a(h);this.valueSubscriptions.set(t,()=>{f(),h.cancel()});return}const r=Wr.has(t);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&nt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i&&i()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in aa){const n=aa[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):mt()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<af.length;r++){const s=af[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,a=t[i];a&&(this.propEventSubscriptions[s]=this.on(s,a))}this.prevMotionValues=f4(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Br(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(yg(r)||vg(r))?r=parseFloat(r):!d4(r)&&tn.test(n)&&(r=d1(t,n)),this.setBaseTarget(t,yt(r)?r.get():r)),yt(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var i;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const a=Yu(this.props,n,(i=this.presenceContext)==null?void 0:i.custom);a&&(r=a[t])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!yt(s)?s:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Lu),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){Xu.render(this.render)}}class E1 extends b4{constructor(){super(...arguments),this.KeyframeResolver=W6}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const r=t.style;return r?r[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;yt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Dn{constructor(t){this.isMounted=!1,this.node=t}update(){}}function v1({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function x4({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function y4(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Bo(e){return e===void 0||e===1}function Ul({scale:e,scaleX:t,scaleY:n}){return!Bo(e)||!Bo(t)||!Bo(n)}function Qn(e){return Ul(e)||T1(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function T1(e){return of(e.x)||of(e.y)}function of(e){return e&&e!=="0%"}function oa(e,t,n){const r=e-n,s=t*r;return n+s}function lf(e,t,n,r,s){return s!==void 0&&(e=oa(e,s,r)),oa(e,n,r)+t}function zl(e,t=0,n=1,r,s){e.min=lf(e.min,t,n,r,s),e.max=lf(e.max,t,n,r,s)}function k1(e,{x:t,y:n}){zl(e.x,t.translate,t.scale,t.originPoint),zl(e.y,n.translate,n.scale,n.originPoint)}const uf=.999999999999,cf=1.0000000000001;function E4(e,t,n,r=!1){var o;const s=n.length;if(!s)return;t.x=t.y=1;let i,a;for(let l=0;l<s;l++){i=n[l],a=i.projectionDelta;const{visualElement:u}=i.options;u&&u.props.style&&u.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&(un(e.x,-i.scroll.offset.x),un(e.y,-i.scroll.offset.y)),a&&(t.x*=a.x.scale,t.y*=a.y.scale,k1(e,a)),r&&Qn(i.latestValues)&&Fs(e,i.latestValues,(o=i.layout)==null?void 0:o.layoutBox))}t.x<cf&&t.x>uf&&(t.x=1),t.y<cf&&t.y>uf&&(t.y=1)}function un(e,t){e.min+=t,e.max+=t}function df(e,t,n,r,s=.5){const i=tt(e.min,e.max,s);zl(e,t,n,i,r)}function hf(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Fs(e,t,n){const r=n??e;df(e.x,hf(t.x,r.x),t.scaleX,t.scale,t.originX),df(e.y,hf(t.y,r.y),t.scaleY,t.scale,t.originY)}function w1(e,t){return v1(y4(e.getBoundingClientRect(),t))}function v4(e,t,n){const r=w1(e,n),{scroll:s}=t;return s&&(un(r.x,s.offset.x),un(r.y,s.offset.y)),r}const T4={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},k4=qr.length;function w4(e,t,n){let r="",s=!0;for(let a=0;a<k4;a++){const o=qr[a],l=e[o];if(l===void 0)continue;let u=!0;if(typeof l=="number")u=l===(o.startsWith("scale")?1:0);else{const c=parseFloat(l);u=o.startsWith("scale")?c===1:c===0}if(!u||n){const c=jl(l,sa[o]);if(!u){s=!1;const h=T4[o]||o;r+=`${h}(${c}) `}n&&(t[o]=c)}}const i=e.pathRotation;return i&&(s=!1,r+=`rotate(${jl(i,sa.pathRotation)}) `),r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function tc(e,t,n){const{style:r,vars:s,transformOrigin:i}=e;let a=!1,o=!1;for(const l in t){const u=t[l];if(Wr.has(l)){a=!0;continue}else if(Og(l)){s[l]=u;continue}else{const c=jl(u,sa[l]);l.startsWith("origin")?(o=!0,i[l]=c):r[l]=c}}if(t.transform||(a||n?r.transform=w4(t,e.transform,n):r.transform&&(r.transform="none")),o){const{originX:l="50%",originY:u="50%",originZ:c=0}=i;r.transformOrigin=`${l} ${u} ${c}`}}function S1(e,{style:t,vars:n},r,s){const i=e.style;let a;for(a in t)i[a]=t[a];s==null||s.applyProjectionStyles(i,r);for(a in n)i.setProperty(a,n[a])}function ff(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ri={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ee.test(e))e=parseFloat(e);else return e;const n=ff(e,t.target.x),r=ff(e,t.target.y);return`${n}% ${r}%`}},S4={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=tn.parse(e);if(s.length>5)return r;const i=tn.createTransformer(e),a=typeof s[0]!="number"?1:0,o=n.x.scale*t.x,l=n.y.scale*t.y;s[0+a]/=o,s[1+a]/=l;const u=tt(o,l,.5);return typeof s[2+a]=="number"&&(s[2+a]/=u),typeof s[3+a]=="number"&&(s[3+a]/=u),i(s)}},Vl={borderRadius:{...ri,applyTo:[...Ku]},borderTopLeftRadius:ri,borderTopRightRadius:ri,borderBottomLeftRadius:ri,borderBottomRightRadius:ri,boxShadow:S4};function A1(e,{layout:t,layoutId:n}){return Wr.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Vl[e]||e==="opacity")}function nc(e,t,n){var a;const r=e.style,s=t==null?void 0:t.style,i={};if(!r)return i;for(const o in r)(yt(r[o])||s&&yt(s[o])||A1(o,e)||((a=n==null?void 0:n.getValue(o))==null?void 0:a.liveStyle)!==void 0)&&(i[o]=r[o]);return i}function A4(e){return window.getComputedStyle(e)}class C4 extends E1{constructor(){super(...arguments),this.type="html",this.renderInstance=S1}mount(t){Ia(!!t.style),super.mount(t)}readValueFromInstance(t,n){var r;if(Wr.has(n))return(r=this.projection)!=null&&r.isProjecting?_l(n):$5(t,n);{const s=A4(t),i=(Og(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return w1(t,n)}build(t,n,r){tc(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return nc(t,n,r)}}const _4={offset:"stroke-dashoffset",array:"stroke-dasharray"},N4={offset:"strokeDashoffset",array:"strokeDasharray"};function I4(e,t,n=1,r=0,s=!0){e.pathLength=1;const i=s?_4:N4;e[i.offset]=`${-r}`,e[i.array]=`${t} ${n}`}const C1=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function _1(e,{attrX:t,attrY:n,attrScale:r,pathLength:s,pathSpacing:i=1,pathOffset:a=0,...o},l,u,c){if(tc(e,o,u),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:f}=e;for(const d of C1)h[d]!==void 0&&(f[d]=h[d],delete h[d]);(f.transform||h.transformOrigin)&&(f.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),f.transform&&(f.transformBox=(c==null?void 0:c.transformBox)??"fill-box",delete h.transformBox),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),s!==void 0&&I4(h,s,i,a,!1)}const N1=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),I1=e=>typeof e=="string"&&e.toLowerCase()==="svg";function R4(e,t,n,r){S1(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(N1.has(s)?s:Gu(s),t.attrs[s])}function R1(e,t,n){const r=nc(e,t,n);for(const s in e)if(yt(e[s])||yt(t[s])){const i=qr.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}class P4 extends E1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=mt}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Wr.has(n)){const r=c1(n);return r&&r.default||0}if(C1.includes(n)){const s=getComputedStyle(t)[n];if(typeof s=="string"&&s)return s.trim()}return n=N1.has(n)?n:Gu(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return R1(t,n,r)}build(t,n,r){_1(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,s){R4(t,n,r,s)}mount(t){this.isSVGTag=I1(t.tagName),super.mount(t)}}const M4=ec.length;function P1(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?P1(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<M4;n++){const r=ec[n],s=e.props[r];(Oi(s)||s===!1)&&(t[r]=s)}return t}function M1(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const L4=[...Ju].reverse(),D4=Ju.length;function O4(e){return t=>Promise.all(t.map(({animation:n,options:r})=>L6(e,n,r)))}function B4(e){let t=O4(e),n=mf(),r=!0,s=!1;const i=u=>(c,h)=>{var d;const f=lr(e,h,u==="exit"?(d=e.presenceContext)==null?void 0:d.custom:void 0);if(f){const{transition:m,transitionEnd:b,...g}=f;c={...c,...g,...b}}return c};function a(u){t=u(e)}function o(u){const{props:c}=e,h=P1(e.parent)||{},f=[],d=new Set;let m={},b=1/0;for(let y=0;y<D4;y++){const k=L4[y],T=n[k],S=c[k]!==void 0?c[k]:h[k],E=Oi(S),w=k===u?T.isActive:null;w===!1&&(b=y);let _=S===h[k]&&S!==c[k]&&E;if(_&&(r||s)&&e.manuallyAnimateOnMount&&(_=!1),T.protectedKeys={...m},!T.isActive&&w===null||!S&&!T.prevProp||Pa(S)||typeof S=="boolean")continue;if(k==="exit"&&T.isActive&&w!==!0){T.prevResolvedValues&&(m={...m,...T.prevResolvedValues});continue}const A=F4(T.prevProp,S);let N=A||k===u&&T.isActive&&!_&&E||y>b&&E,C=!1;const L=Array.isArray(S)?S:[S];let M=L.reduce(i(k),{});w===!1&&(M={});const{prevResolvedValues:H={}}=T,P={...H,...M},R=F=>{N=!0,d.has(F)&&(C=!0,d.delete(F)),T.needsAnimating[F]=!0;const V=e.getValue(F);V&&(V.liveStyle=!1)};for(const F in P){const V=M[F],I=H[F];if(m.hasOwnProperty(F))continue;let W=!1;Ll(V)&&Ll(I)?W=!M1(V,I)||A:W=V!==I,W?V!=null?R(F):d.add(F):V!==void 0&&d.has(F)?R(F):T.protectedKeys[F]=!0}T.prevProp=S,T.prevResolvedValues=M,T.isActive&&(m={...m,...M}),(r||s)&&e.blockInitialAnimation&&(N=!1);const B=_&&A;N&&(!B||C)&&f.push(...L.map(F=>{const V={type:k};if(typeof F=="string"&&(r||s)&&!B&&e.manuallyAnimateOnMount&&e.parent){const{parent:I}=e,W=lr(I,F);if(I.enteringChildren&&W){const{delayChildren:K}=W.transition||{};V.delay=t1(I.enteringChildren,e,K)}}return{animation:F,options:V}}))}if(d.size){const y={};if(typeof c.initial!="boolean"){const k=lr(e,Array.isArray(c.initial)?c.initial[0]:c.initial);k&&k.transition&&(y.transition=k.transition)}d.forEach(k=>{const T=e.getBaseTarget(k),S=e.getValue(k);S&&(S.liveStyle=!0),y[k]=T??null}),f.push({animation:y})}let g=!!f.length;return r&&(c.initial===!1||c.initial===c.animate)&&!e.manuallyAnimateOnMount&&(g=!1),r=!1,s=!1,g?t(f):Promise.resolve()}function l(u,c){var f;if(n[u].isActive===c)return Promise.resolve();(f=e.variantChildren)==null||f.forEach(d=>{var m;return(m=d.animationState)==null?void 0:m.setActive(u,c)}),n[u].isActive=c;const h=o(u);for(const d in n)n[d].protectedKeys={};return h}return{animateChanges:o,setActive:l,setAnimateFunction:a,getState:()=>n,reset:()=>{n=mf(),s=!0}}}function F4(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!M1(t,e):!1}function Yn(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function mf(){return{animate:Yn(!0),whileInView:Yn(),whileHover:Yn(),whileTap:Yn(),whileDrag:Yn(),whileFocus:Yn(),exit:Yn()}}function ql(e,t){e.min=t.min,e.max=t.max}function Zt(e,t){ql(e.x,t.x),ql(e.y,t.y)}function pf(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const L1=1e-4,j4=1-L1,H4=1+L1,D1=.01,U4=0-D1,z4=0+D1;function Ct(e){return e.max-e.min}function V4(e,t,n){return Math.abs(e-t)<=n}function gf(e,t,n,r=.5){e.origin=r,e.originPoint=tt(t.min,t.max,e.origin),e.scale=Ct(n)/Ct(t),e.translate=tt(n.min,n.max,e.origin)-e.originPoint,(e.scale>=j4&&e.scale<=H4||isNaN(e.scale))&&(e.scale=1),(e.translate>=U4&&e.translate<=z4||isNaN(e.translate))&&(e.translate=0)}function wi(e,t,n,r){gf(e.x,t.x,n.x,r?r.originX:void 0),gf(e.y,t.y,n.y,r?r.originY:void 0)}function bf(e,t,n,r=0){const s=r?tt(n.min,n.max,r):n.min;e.min=s+t.min,e.max=e.min+Ct(t)}function q4(e,t,n,r){bf(e.x,t.x,n.x,r==null?void 0:r.x),bf(e.y,t.y,n.y,r==null?void 0:r.y)}function xf(e,t,n,r=0){const s=r?tt(n.min,n.max,r):n.min;e.min=t.min-s,e.max=e.min+Ct(t)}function la(e,t,n,r){xf(e.x,t.x,n.x,r==null?void 0:r.x),xf(e.y,t.y,n.y,r==null?void 0:r.y)}function yf(e,t,n,r,s){return e-=t,e=oa(e,1/n,r),s!==void 0&&(e=oa(e,1/s,r)),e}function W4(e,t=0,n=1,r=.5,s,i=e,a=e){if(dn.test(t)&&(t=parseFloat(t),t=tt(a.min,a.max,t/100)-a.min),typeof t!="number")return;let o=tt(i.min,i.max,r);e===i&&(o-=t),e.min=yf(e.min,t,n,o,s),e.max=yf(e.max,t,n,o,s)}function Ef(e,t,[n,r,s],i,a){W4(e,t[n],t[r],t[s],t.scale,i,a)}const $4=["x","scaleX","originX"],Y4=["y","scaleY","originY"];function vf(e,t,n,r){Ef(e.x,t,$4,n?n.x:void 0,r?r.x:void 0),Ef(e.y,t,Y4,n?n.y:void 0,r?r.y:void 0)}function Tf(e){return e.translate===0&&e.scale===1}function O1(e){return Tf(e.x)&&Tf(e.y)}function kf(e,t){return e.min===t.min&&e.max===t.max}function G4(e,t){return kf(e.x,t.x)&&kf(e.y,t.y)}function wf(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function B1(e,t){return wf(e.x,t.x)&&wf(e.y,t.y)}function Sf(e){return Ct(e.x)/Ct(e.y)}function Af(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function an(e){return[e("x"),e("y")]}function K4(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((s||i||a)&&(r=`translate3d(${s}px, ${i}px, ${a}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:c,pathRotation:h,rotateX:f,rotateY:d,skewX:m,skewY:b}=n;u&&(r=`perspective(${u}px) ${r}`),c&&(r+=`rotate(${c}deg) `),h&&(r+=`rotate(${h}deg) `),f&&(r+=`rotateX(${f}deg) `),d&&(r+=`rotateY(${d}deg) `),m&&(r+=`skewX(${m}deg) `),b&&(r+=`skewY(${b}deg) `)}const o=e.x.scale*t.x,l=e.y.scale*t.y;return(o!==1||l!==1)&&(r+=`scale(${o}, ${l})`),r||"none"}const X4=Ku.length,Cf=e=>typeof e=="string"?parseFloat(e):e,_f=e=>typeof e=="number"||Ee.test(e);function Q4(e,t,n,r,s,i){s?(e.opacity=tt(0,n.opacity??1,Z4(r)),e.opacityExit=tt(t.opacity??1,0,J4(r))):i&&(e.opacity=tt(t.opacity??1,n.opacity??1,r));for(let a=0;a<X4;a++){const o=Ku[a];let l=Nf(t,o),u=Nf(n,o);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||_f(l)===_f(u)?(e[o]=Math.max(tt(Cf(l),Cf(u),r),0),(dn.test(u)||dn.test(l))&&(e[o]+="%")):e[o]=u}(t.rotate||n.rotate)&&(e.rotate=tt(t.rotate||0,n.rotate||0,r))}function Nf(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const Z4=F1(0,.5,Ig),J4=F1(.5,.95,Wt);function F1(e,t,n){return r=>r<e?0:r>t?1:n(Li(e,t,r))}function eR(e,t,n){const r=yt(e)?e:Br(e);return r.start($u("",r,t,n)),r.animation}function Bi(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}const tR=(e,t)=>e.depth-t.depth;class nR{constructor(){this.children=[],this.isDirty=!1}add(t){Mu(this.children,t),this.isDirty=!0}remove(t){ta(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(tR),this.isDirty=!1,this.children.forEach(t)}}function rR(e,t){const n=At.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(Pn(r),e(i-t))};return nt.setup(r,!0),()=>Pn(r)}function js(e){return yt(e)?e.get():e}class iR{constructor(){this.members=[]}add(t){Mu(this.members,t);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===t||r===this.lead||r===this.prevLead)continue;const s=r.instance;(!s||s.isConnected===!1)&&!r.snapshot&&(ta(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if(ta(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){var n;for(let r=this.members.indexOf(t)-1;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1&&((n=s.instance)==null?void 0:n.isConnected)!==!1)return this.promote(s),!0}return!1}promote(t,n){var s;const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.updateSnapshot(),t.scheduleRender();const{layoutDependency:i}=r.options,{layoutDependency:a}=t.options;(i===void 0||i!==a)&&(t.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),(s=t.root)!=null&&s.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var n,r,s,i,a;(r=(n=t.options).onExitComplete)==null||r.call(n),(a=(s=t.resumingFrom)==null?void 0:(i=s.options).onExitComplete)==null||a.call(i)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const Hs={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Fo=["","X","Y","Z"],sR=1e3;let aR=0;function jo(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function j1(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=a1(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",nt,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&j1(r)}function H1({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(a={},o=t==null?void 0:t()){this.id=aR++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(uR),this.nodes.forEach(pR),this.nodes.forEach(gR),this.nodes.forEach(cR)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new nR)}addEventListener(a,o){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new Lu),this.eventHandlers.get(a).add(o)}notifyListeners(a,...o){const l=this.eventHandlers.get(a);l&&l.notify(...o)}hasListeners(a){return this.eventHandlers.has(a)}mount(a){if(this.instance)return;this.isSVG=Zu(a)&&!u4(a),this.instance=a;const{layoutId:o,layout:l,visualElement:u}=this.options;if(u&&!u.current&&u.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||o)&&(this.isLayoutDirty=!0),e){let c,h=0;const f=()=>this.root.updateBlockedByResize=!1;nt.read(()=>{h=window.innerWidth}),e(a,()=>{const d=window.innerWidth;d!==h&&(h=d,this.root.updateBlockedByResize=!0,c&&c(),c=rR(f,250),Hs.hasAnimatedSinceResize&&(Hs.hasAnimatedSinceResize=!1,this.nodes.forEach(Pf)))})}o&&this.root.registerSharedNode(o,this),this.options.animate!==!1&&u&&(o||l)&&this.addEventListener("didUpdate",({delta:c,hasLayoutChanged:h,hasRelativeLayoutChanged:f,layout:d})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||u.getDefaultTransition()||vR,{onLayoutAnimationStart:b,onLayoutAnimationComplete:g}=u.getProps(),y=!this.targetLayout||!B1(this.targetLayout,d),k=!h&&f;if(this.options.layoutRoot||this.resumeFrom||k||h&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...Wu(m,"layout"),onPlay:b,onComplete:g};(u.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(c,k,T.path)}else h||Pf(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=d})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Pn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(bR),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&j1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;c<this.path.length;c++){const h=this.path[c];h.shouldResetTransform=!0,(typeof h.latestValues.x=="string"||typeof h.latestValues.y=="string")&&(h.isLayoutDirty=!0),h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:o,layout:l}=this.options;if(o===void 0&&!l)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const l=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),l&&this.nodes.forEach(hR),this.nodes.forEach(If);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Rf);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(fR),this.nodes.forEach(mR),this.nodes.forEach(oR),this.nodes.forEach(lR)):this.nodes.forEach(Rf),this.clearAllSnapshots();const o=At.now();xt.delta=hn(0,1e3/60,o-xt.timestamp),xt.timestamp=o,xt.isProcessing=!0,Io.update.process(xt),Io.preRender.process(xt),Io.render.process(xt),xt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Xu.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(dR),this.sharedNodes.forEach(xR)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,nt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){nt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Ct(this.snapshot.measuredBox.x)&&!Ct(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=mt()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:o}=this.options;o&&o.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let o=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(o=!1),o&&this.instance){const l=r(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!s)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,o=this.projectionDelta&&!O1(this.projectionDelta),l=this.getTransformTemplate(),u=l?l(this.latestValues,""):void 0,c=u!==this.prevTransformTemplateValue;a&&this.instance&&(o||Qn(this.latestValues)||c)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const o=this.measurePageBox();let l=this.removeElementScroll(o);return a&&(l=this.removeTransform(l)),TR(l),{animationId:this.root.animationId,measuredBox:o,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:a}=this.options;if(!a)return mt();const o=a.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(kR))){const{scroll:c}=this.root;c&&(un(o.x,c.offset.x),un(o.y,c.offset.y))}return o}removeElementScroll(a){var l;const o=mt();if(Zt(o,a),(l=this.scroll)!=null&&l.wasRoot)return o;for(let u=0;u<this.path.length;u++){const c=this.path[u],{scroll:h,options:f}=c;c!==this.root&&h&&f.layoutScroll&&(h.wasRoot&&Zt(o,a),un(o.x,h.offset.x),un(o.y,h.offset.y))}return o}applyTransform(a,o=!1,l){var c,h;const u=l||mt();Zt(u,a);for(let f=0;f<this.path.length;f++){const d=this.path[f];!o&&d.options.layoutScroll&&d.scroll&&d!==d.root&&(un(u.x,-d.scroll.offset.x),un(u.y,-d.scroll.offset.y)),Qn(d.latestValues)&&Fs(u,d.latestValues,(c=d.layout)==null?void 0:c.layoutBox)}return Qn(this.latestValues)&&Fs(u,this.latestValues,(h=this.layout)==null?void 0:h.layoutBox),u}removeTransform(a){var l;const o=mt();Zt(o,a);for(let u=0;u<this.path.length;u++){const c=this.path[u];if(!Qn(c.latestValues))continue;let h;c.instance&&(Ul(c.latestValues)&&c.updateSnapshot(),h=mt(),Zt(h,c.measurePageBox())),vf(o,c.latestValues,(l=c.snapshot)==null?void 0:l.layoutBox,h)}return Qn(this.latestValues)&&vf(o,this.latestValues),o}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==xt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){var d;const o=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=o.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=o.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=o.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==o;if(!(a||l&&this.isSharedProjectionDirty||this.isProjectionDirty||(d=this.parent)!=null&&d.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:c,layoutId:h}=this.options;if(!this.layout||!(c||h))return;this.resolvedRelativeTargetAt=xt.timestamp;const f=this.getClosestProjectingParent();f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=mt(),this.targetWithTransforms=mt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),q4(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Zt(this.target,this.layout.layoutBox),k1(this.target,this.targetDelta)):Zt(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Ul(this.parent.latestValues)||T1(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(a,o,l){this.relativeParent=a,this.linkedParentVersion=a.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=mt(),this.relativeTargetOrigin=mt(),la(this.relativeTargetOrigin,o,l,this.options.layoutAnchor||void 0),Zt(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var m;const a=this.getLead(),o=!!this.resumingFrom||this!==a;let l=!0;if((this.isProjectionDirty||(m=this.parent)!=null&&m.isProjectionDirty)&&(l=!1),o&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===xt.timestamp&&(l=!1),l)return;const{layout:u,layoutId:c}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||c))return;Zt(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,f=this.treeScale.y;E4(this.layoutCorrected,this.treeScale,this.path,o),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=mt());const{target:d}=a;if(!d){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(pf(this.prevProjectionDelta.x,this.projectionDelta.x),pf(this.prevProjectionDelta.y,this.projectionDelta.y)),wi(this.projectionDelta,this.layoutCorrected,d,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==f||!Af(this.projectionDelta.x,this.prevProjectionDelta.x)||!Af(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",d))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){var o;if((o=this.options.visualElement)==null||o.scheduleRender(),a){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ar(),this.projectionDelta=Ar(),this.projectionDeltaWithTransform=Ar()}setAnimationOrigin(a,o=!1,l){const u=this.snapshot,c=u?u.latestValues:{},h={...this.latestValues},f=Ar();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!o;const d=mt(),m=u?u.source:void 0,b=this.layout?this.layout.source:void 0,g=m!==b,y=this.getStack(),k=!y||y.members.length<=1,T=!!(g&&!k&&this.options.crossfade===!0&&!this.path.some(ER));this.animationProgress=0;let S;const E=l==null?void 0:l.interpolateProjection(a);this.mixTargetDelta=w=>{const _=w/1e3,A=E==null?void 0:E(_);A?(f.x.translate=A.x,f.x.scale=tt(a.x.scale,1,_),f.x.origin=a.x.origin,f.x.originPoint=a.x.originPoint,f.y.translate=A.y,f.y.scale=tt(a.y.scale,1,_),f.y.origin=a.y.origin,f.y.originPoint=a.y.originPoint):(Mf(f.x,a.x,_),Mf(f.y,a.y,_)),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(la(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),yR(this.relativeTarget,this.relativeTargetOrigin,d,_),S&&G4(this.relativeTarget,S)&&(this.isProjectionDirty=!1),S||(S=mt()),Zt(S,this.relativeTarget)),g&&(this.animationValues=h,Q4(h,c,this.latestValues,_,T,k)),A&&A.rotate!==void 0&&(this.animationValues||(this.animationValues=h),this.animationValues.pathRotation=A.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=_},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){var o,l,u;this.notifyListeners("animationStart"),(o=this.currentAnimation)==null||o.stop(),(u=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||u.stop(),this.pendingAnimation&&(Pn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=nt.update(()=>{Hs.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Br(0)),this.motionValue.jump(0,!1),this.currentAnimation=eR(this.motionValue,[0,1e3],{...a,velocity:0,isSync:!0,onUpdate:c=>{this.mixTargetDelta(c),a.onUpdate&&a.onUpdate(c)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(sR),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:o,target:l,layout:u,latestValues:c}=a;if(!(!o||!l||!u)){if(this!==a&&this.layout&&u&&U1(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||mt();const h=Ct(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+h;const f=Ct(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+f}Zt(o,l),Fs(o,c),wi(this.projectionDeltaWithTransform,this.layoutCorrected,o,c)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new iR),this.sharedNodes.get(a).add(o);const u=o.options.initialPromotionConfig;o.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(o):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())==null?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())==null?void 0:o.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:o,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let o=!1;const{latestValues:l}=a;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(o=!0),!o)return;const u={};l.z&&jo("z",a,u,this.animationValues);for(let c=0;c<Fo.length;c++)jo(`rotate${Fo[c]}`,a,u,this.animationValues),jo(`skew${Fo[c]}`,a,u,this.animationValues);a.render();for(const c in u)a.setStaticValue(c,u[c]),this.animationValues&&(this.animationValues[c]=u[c]);a.scheduleRender()}applyProjectionStyles(a,o){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=js(o==null?void 0:o.pointerEvents)||"",a.transform=l?l(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(a.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,a.pointerEvents=js(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Qn(this.latestValues)&&(a.transform=l?l({},""):"none",this.hasProjected=!1);return}a.visibility="";const c=u.animationValues||u.latestValues;this.applyTransformsToTarget();let h=K4(this.projectionDeltaWithTransform,this.treeScale,c);l&&(h=l(c,h)),a.transform=h;const{x:f,y:d}=this.projectionDelta;a.transformOrigin=`${f.origin*100}% ${d.origin*100}% 0`,u.animationValues?a.opacity=u===this?c.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:c.opacityExit:a.opacity=u===this?c.opacity!==void 0?c.opacity:"":c.opacityExit!==void 0?c.opacityExit:0;for(const m in Vl){if(c[m]===void 0)continue;const{correct:b,applyTo:g,isCSSVariable:y}=Vl[m],k=h==="none"?c[m]:b(c[m],u);if(g){const T=g.length;for(let S=0;S<T;S++)a[g[S]]=k}else y?this.options.visualElement.renderState.vars[m]=k:a[m]=k}this.options.layoutId&&(a.pointerEvents=u===this?js(o==null?void 0:o.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>{var o;return(o=a.currentAnimation)==null?void 0:o.stop()}),this.root.nodes.forEach(If),this.root.sharedNodes.clear()}}}function oR(e){e.updateLayout()}function lR(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i==="size")an(h=>{const f=a?t.measuredBox[h]:t.layoutBox[h],d=Ct(f);f.min=r[h].min,f.max=f.min+d});else if(i==="x"||i==="y"){const h=i==="x"?"y":"x";ql(a?t.measuredBox[h]:t.layoutBox[h],r[h])}else U1(i,t.layoutBox,r)&&an(h=>{const f=a?t.measuredBox[h]:t.layoutBox[h],d=Ct(r[h]);f.max=f.min+d,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[h].max=e.relativeTarget[h].min+d)});const o=Ar();wi(o,r,t.layoutBox);const l=Ar();a?wi(l,e.applyTransform(s,!0),t.measuredBox):wi(l,r,t.layoutBox);const u=!O1(o);let c=!1;if(!e.resumeFrom){const h=e.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:f,layout:d}=h;if(f&&d){const m=e.options.layoutAnchor||void 0,b=mt();la(b,t.layoutBox,f.layoutBox,m);const g=mt();la(g,r,d.layoutBox,m),B1(b,g)||(c=!0),h.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=b,e.relativeParent=h)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:l,layoutDelta:o,hasLayoutChanged:u,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function uR(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function cR(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function dR(e){e.clearSnapshot()}function If(e){e.clearMeasurements()}function hR(e){e.isLayoutDirty=!0,e.updateLayout()}function Rf(e){e.isLayoutDirty=!1}function fR(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function mR(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Pf(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function pR(e){e.resolveTargetDelta()}function gR(e){e.calcProjection()}function bR(e){e.resetSkewAndRotation()}function xR(e){e.removeLeadSnapshot()}function Mf(e,t,n){e.translate=tt(t.translate,0,n),e.scale=tt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Lf(e,t,n,r){e.min=tt(t.min,n.min,r),e.max=tt(t.max,n.max,r)}function yR(e,t,n,r){Lf(e.x,t.x,n.x,r),Lf(e.y,t.y,n.y,r)}function ER(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const vR={duration:.45,ease:[.4,0,.1,1]},Df=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Of=Df("applewebkit/")&&!Df("chrome/")?Math.round:Wt;function Bf(e){e.min=Of(e.min),e.max=Of(e.max)}function TR(e){Bf(e.x),Bf(e.y)}function U1(e,t,n){return e==="position"||e==="preserve-aspect"&&!V4(Sf(t),Sf(n),.2)}function kR(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const wR=H1({attachResizeListener:(e,t)=>Bi(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),Ho={current:void 0},z1=H1({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Ho.current){const e=new wR({});e.mount(window),e.setOptions({layoutScroll:!0}),Ho.current=e}return Ho.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),rc=v.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function Ff(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function SR(...e){return t=>{let n=!1;const r=e.map(s=>{const i=Ff(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():Ff(e[s],null)}}}}function AR(...e){return v.useCallback(SR(...e),e)}class CR extends v.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(Ls(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,s=Ls(r)&&r.offsetWidth||0,i=Ls(r)&&r.offsetHeight||0,a=getComputedStyle(n),o=this.props.sizeRef.current;o.height=parseFloat(a.height),o.width=parseFloat(a.width),o.top=n.offsetTop,o.left=n.offsetLeft,o.right=s-o.width-o.left,o.bottom=i-o.height-o.top,o.direction=a.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function _R({children:e,isPresent:t,anchorX:n,anchorY:r,root:s,pop:i}){var f;const a=v.useId(),o=v.useRef(null),l=v.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:u}=v.useContext(rc),c=i!==!1?((f=e.props)==null?void 0:f.ref)??(e==null?void 0:e.ref):void 0,h=AR(o,c);return v.useInsertionEffect(()=>{const{width:d,height:m,top:b,left:g,right:y,bottom:k,direction:T}=l.current;if(t||i===!1||!o.current||!d||!m)return;const S=T==="rtl",E=n==="left"?S?`right: ${y}`:`left: ${g}`:S?`left: ${g}`:`right: ${y}`,w=r==="bottom"?`bottom: ${k}`:`top: ${b}`;o.current.dataset.motionPopId=a;const _=document.createElement("style");u&&(_.nonce=u);const A=s??document.head;return A.appendChild(_),_.sheet&&_.sheet.insertRule(`
530
+ [data-motion-pop-id="${a}"] {
531
+ position: absolute !important;
532
+ width: ${d}px !important;
533
+ height: ${m}px !important;
534
+ ${E}px !important;
535
+ ${w}px !important;
536
+ }
537
+ `),()=>{var N;(N=o.current)==null||N.removeAttribute("data-motion-pop-id"),A.contains(_)&&A.removeChild(_)}},[t]),p.jsx(CR,{isPresent:t,childRef:o,sizeRef:l,pop:i,children:i===!1?e:v.cloneElement(e,{ref:h})})}const NR=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:a,anchorX:o,anchorY:l,root:u})=>{const c=Pu(IR),h=v.useId(),f=v.useRef(n),d=v.useRef(r);ea(()=>{f.current=n,d.current=r});let m=!0,b=v.useMemo(()=>(m=!1,{id:h,initial:t,isPresent:n,custom:s,onExitComplete:g=>{c.set(g,!0);for(const y of c.values())if(!y)return;r&&r()},register:g=>(c.set(g,!1),()=>{var y;c.delete(g),!f.current&&!c.size&&((y=d.current)==null||y.call(d))})}),[n,c,r]);return i&&m&&(b={...b}),v.useMemo(()=>{c.forEach((g,y)=>c.set(y,!1))},[n]),v.useEffect(()=>{!n&&!c.size&&r&&r()},[n]),e=p.jsx(_R,{pop:a==="popLayout",isPresent:n,anchorX:o,anchorY:l,root:u,children:e}),p.jsx(Na.Provider,{value:b,children:e})};function IR(){return new Map}function V1(e=!0){const t=v.useContext(Na);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=v.useId();v.useEffect(()=>{if(e)return s(i)},[e]);const a=v.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,a]:[!0]}const ws=e=>e.key||"";function jf(e){const t=[];return v.Children.forEach(e,n=>{v.isValidElement(n)&&t.push(n)}),t}const RR=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:a=!1,anchorX:o="left",anchorY:l="top",root:u})=>{const[c,h]=V1(a),f=v.useMemo(()=>jf(e),[e]),d=a&&!c?[]:f.map(ws),m=v.useRef(!0),b=v.useRef(f),g=Pu(()=>new Map),y=v.useRef(new Set),[k,T]=v.useState(f),[S,E]=v.useState(f);ea(()=>{a&&!c&&!S.length&&(h==null||h())},[c,a,S.length,h]),ea(()=>{m.current=!1,b.current=f;for(let A=0;A<S.length;A++){const N=ws(S[A]);d.includes(N)?(g.delete(N),y.current.delete(N)):g.get(N)!==!0&&g.set(N,!1)}},[S,d.length,d.join("-")]);const w=[];if(f!==k){let A=[...f],N=0;for(const C of S){const L=d.indexOf(ws(C));L===-1?(A.splice(N++,0,C),w.push(C)):N=L+w.length+1}return i==="wait"&&w.length&&(A=w),E(jf(A)),T(f),null}const{forceRender:_}=v.useContext(Ru);return p.jsx(p.Fragment,{children:S.map(A=>{const N=ws(A),C=a&&!c?!1:f===S||d.includes(N),L=()=>{if(y.current.has(N))return;if(g.has(N))y.current.add(N),g.set(N,!0);else return;let M=!0;g.forEach(H=>{H||(M=!1)}),M&&(_==null||_(),E(b.current),a&&(h==null||h()),r&&r())};return p.jsx(NR,{isPresent:C,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:s,mode:i,root:u,onExitComplete:C?void 0:L,anchorX:o,anchorY:l,children:A},N)})})},q1=v.createContext({strict:!1}),Hf={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Uf=!1;function PR(){if(Uf)return;const e={};for(const t in Hf)e[t]={isEnabled:n=>Hf[t].some(r=>!!n[r])};y1(e),Uf=!0}function W1(){return PR(),g4()}function MR(e){const t=W1();for(const n in e)t[n]={...t[n],...e[n]};y1(t)}const La=v.createContext({});function LR(e,t){if(Ma(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Oi(n)?n:void 0,animate:Oi(r)?r:void 0}}return e.inherit!==!1?t:{}}function DR(e){const{initial:t,animate:n}=LR(e,v.useContext(La));return v.useMemo(()=>({initial:t,animate:n}),[zf(t),zf(n)])}function zf(e){return Array.isArray(e)?e.join(" "):e}const ic=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function $1(e,t,n){for(const r in t)!yt(t[r])&&!A1(r,n)&&(e[r]=t[r])}function OR({transformTemplate:e},t){return v.useMemo(()=>{const n=ic();return tc(n,t,e),Object.assign({},n.vars,n.style)},[t])}function BR(e,t){const n=e.style||{},r={};return $1(r,n,e),Object.assign(r,OR(e,t)),r}function FR(e,t){const n={},r=BR(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const Y1=()=>({...ic(),attrs:{}});function jR(e,t,n,r){const s=v.useMemo(()=>{const i=Y1();return _1(i,t,I1(r),e.transformTemplate,e.style),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};$1(i,e.style,e),s.style={...i,...s.style}}return s}const HR=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function ua(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||HR.has(e)}function UR(e,t){return e.startsWith("on")?!ua(e):(t==null?void 0:t(e))??!ua(e)}function zR(e,t,n,r){const s={};for(const i in e)i==="values"&&typeof e.values=="object"||yt(e[i])||(UR(i,r)||n===!0&&ua(i)||!t&&!ua(i)||e.draggable&&i.startsWith("onDrag"))&&(s[i]=e[i]);return s}const VR=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function sc(e){return typeof e!="string"||e.includes("-")?!1:!!(VR.indexOf(e)>-1||/[A-Z]/u.test(e))}function qR(e,t,n,{latestValues:r},s,i=!1,a,o){const u=(a??sc(e)?jR:FR)(t,r,s,e),c=zR(t,typeof e=="string",i,o),h=e!==v.Fragment?{...c,...u,ref:n}:{},{children:f}=t,d=v.useMemo(()=>yt(f)?f.get():f,[f]);return v.createElement(e,{...h,children:d})}function WR({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,s){return{latestValues:$R(n,r,s,e),renderState:t()}}function $R(e,t,n,r){const s={},i=r(e,{});for(const f in i)s[f]=js(i[f]);let{initial:a,animate:o}=e;const l=Ma(e),u=b1(e);t&&u&&!l&&e.inherit!==!1&&(a===void 0&&(a=t.initial),o===void 0&&(o=t.animate));let c=n?n.initial===!1:!1;c=c||a===!1;const h=c?o:a;if(h&&typeof h!="boolean"&&!Pa(h)){const f=Array.isArray(h)?h:[h];for(let d=0;d<f.length;d++){const m=Yu(e,f[d]);if(m){const{transitionEnd:b,transition:g,...y}=m;for(const k in y){let T=y[k];if(Array.isArray(T)){const S=c?T.length-1:0;T=T[S]}T!==null&&(s[k]=T)}for(const k in b)s[k]=b[k]}}}return s}const G1=e=>(t,n)=>{const r=v.useContext(La),s=v.useContext(Na),i=()=>WR(e,t,r,s);return n?i():Pu(i)},YR=G1({scrapeMotionValuesFromProps:nc,createRenderState:ic}),GR=G1({scrapeMotionValuesFromProps:R1,createRenderState:Y1}),KR=Symbol.for("motionComponentSymbol");function XR(e,t,n){const r=v.useRef(n);v.useInsertionEffect(()=>{r.current=n});const s=v.useRef(null);return v.useCallback(i=>{var o;i&&((o=e.onMount)==null||o.call(e,i)),t&&(i?t.mount(i):t.unmount());const a=r.current;if(typeof a=="function")if(i){const l=a(i);typeof l=="function"&&(s.current=l)}else s.current?(s.current(),s.current=null):a(i);else a&&(a.current=i)},[t])}const K1=v.createContext({});function Tr(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function QR(e,t,n,r,s,i){var T,S;const{visualElement:a}=v.useContext(La),o=v.useContext(q1),l=v.useContext(Na),u=v.useContext(rc),c=u.reducedMotion,h=u.skipAnimations,f=v.useRef(null),d=v.useRef(!1);r=r||o.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:a,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c,skipAnimations:h,isSVG:i}),d.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));const m=f.current,b=v.useContext(K1);m&&!m.projection&&s&&(m.type==="html"||m.type==="svg")&&ZR(f.current,n,s,b);const g=v.useRef(!1);v.useInsertionEffect(()=>{m&&g.current&&m.update(n,l)});const y=n[s1],k=v.useRef(!!y&&typeof window<"u"&&!((T=window.MotionHandoffIsComplete)!=null&&T.call(window,y))&&((S=window.MotionHasOptimisedAnimation)==null?void 0:S.call(window,y)));return ea(()=>{d.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),k.current&&m.animationState&&m.animationState.animateChanges())}),v.useEffect(()=>{m&&(!k.current&&m.animationState&&m.animationState.animateChanges(),k.current&&(queueMicrotask(()=>{var E;(E=window.MotionHandoffMarkAsComplete)==null||E.call(window,y)}),k.current=!1),m.enteringChildren=void 0)}),m}function ZR(e,t,n,r){const{layoutId:s,layout:i,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:u,layoutAnchor:c,layoutCrossfade:h}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:X1(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!a||o&&Tr(o),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:l,layoutRoot:u,layoutAnchor:c})}function X1(e){if(e)return e.options.allowProjection!==!1?e.projection:X1(e.parent)}function Uo(e,{forwardMotionProps:t=!1,type:n}={},r,s){r&&MR(r);const i=n?n==="svg":sc(e),a=i?GR:YR;function o(u,c){let h;const f={...v.useContext(rc),...u,layoutId:JR(u)},{isStatic:d,isValidProp:m}=f,b=DR(u),g=a(u,d);if(!d&&typeof window<"u"){eP();const y=tP(f);h=y.MeasureLayout,b.visualElement=QR(e,g,f,s,y.ProjectionNode,i)}return p.jsxs(La.Provider,{value:b,children:[h&&b.visualElement?p.jsx(h,{visualElement:b.visualElement,...f}):null,qR(e,u,XR(g,b.visualElement,c),g,d,t,i,m)]})}o.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const l=v.forwardRef(o);return l[KR]=e,l}function JR({layoutId:e}){const t=v.useContext(Ru).id;return t&&e!==void 0?t+"-"+e:e}function eP(e,t){v.useContext(q1).strict}function tP(e){const t=W1(),{drag:n,layout:r}=t;if(!n&&!r)return{};const s={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(e)||r!=null&&r.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function nP(e,t){if(typeof Proxy>"u")return Uo;const n=new Map,r=(i,a)=>Uo(i,a,e,t),s=(i,a)=>r(i,a);return new Proxy(s,{get:(i,a)=>a==="create"?r:(n.has(a)||n.set(a,Uo(a,void 0,e,t)),n.get(a))})}const rP=(e,t)=>t.isSVG??sc(e)?new P4(t):new C4(t,{allowProjection:e!==v.Fragment});class iP extends Dn{constructor(t){super(t),t.animationState||(t.animationState=B4(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Pa(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let sP=0;class aP extends Dn{constructor(){super(...arguments),this.id=sP++,this.isExitComplete=!1}update(){var i;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;if(t&&r===!1){if(this.isExitComplete){const{initial:a,custom:o}=this.node.getProps();if(typeof a=="string"||typeof a=="object"&&a!==null&&!Array.isArray(a)){const l=lr(this.node,a,o);if(l){const{transition:u,transitionEnd:c,...h}=l;for(const f in h)(i=this.node.getValue(f))==null||i.jump(h[f])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const oP={animation:{Feature:iP},exit:{Feature:aP}};function Ki(e){return{point:{x:e.pageX,y:e.pageY}}}const lP=e=>t=>Qu(t)&&e(t,Ki(t));function Si(e,t,n,r){return Bi(e,t,lP(n),r)}const Q1=({current:e})=>e?e.ownerDocument.defaultView:null,Vf=(e,t)=>Math.abs(e-t);function uP(e,t){const n=Vf(e.x,t.x),r=Vf(e.y,t.y);return Math.sqrt(n**2+r**2)}const qf=new Set(["auto","scroll"]);class Z1{constructor(t,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=m=>{this.handleScroll(m.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Ss(this.lastRawMoveEventInfo,this.transformPagePoint));const m=zo(this.lastMoveEventInfo,this.history),b=this.startEvent!==null,g=uP(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!b&&!g)return;const{point:y}=m,{timestamp:k}=xt;this.history.push({...y,timestamp:k});const{onStart:T,onMove:S}=this.handlers;b||(T&&T(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),S&&S(this.lastMoveEvent,m)},this.handlePointerMove=(m,b)=>{this.lastMoveEvent=m,this.lastRawMoveEventInfo=b,this.lastMoveEventInfo=Ss(b,this.transformPagePoint),nt.update(this.updatePoint,!0)},this.handlePointerUp=(m,b)=>{this.end();const{onEnd:g,onSessionEnd:y,resumeAnimation:k}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&k&&k(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=zo(m.type==="pointercancel"?this.lastMoveEventInfo:Ss(b,this.transformPagePoint),this.history);this.startEvent&&g&&g(m,T),y&&y(m,T)},!Qu(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=a,this.contextWindow=s||window;const l=Ki(t),u=Ss(l,this.transformPagePoint),{point:c}=u,{timestamp:h}=xt;this.history=[{...c,timestamp:h}];const{onSessionStart:f}=n;f&&f(t,zo(u,this.history));const d={passive:!0,capture:!0};this.removeListeners=$i(Si(this.contextWindow,"pointermove",this.handlePointerMove,d),Si(this.contextWindow,"pointerup",this.handlePointerUp,d),Si(this.contextWindow,"pointercancel",this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(qf.has(r.overflowX)||qf.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,s=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},i={x:s.x-n.x,y:s.y-n.y};i.x===0&&i.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(t,s),nt.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Pn(this.updatePoint)}}function Ss(e,t){return t?{point:t(e.point)}:e}function Wf(e,t){return{x:e.x-t.x,y:e.y-t.y}}function zo({point:e},t){return{point:e,delta:Wf(e,J1(t)),offset:Wf(e,cP(t)),velocity:dP(t,.1)}}function cP(e){return e[0]}function J1(e){return e[e.length-1]}function dP(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=J1(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>$t(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&s.timestamp-r.timestamp>$t(t)*2&&(r=e[1]);const i=qt(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const a={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function hP(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?tt(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?tt(n,e,r.max):Math.min(e,n)),e}function $f(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function fP(e,{top:t,left:n,bottom:r,right:s}){return{x:$f(e.x,n,s),y:$f(e.y,t,r)}}function Yf(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function mP(e,t){return{x:Yf(e.x,t.x),y:Yf(e.y,t.y)}}function pP(e,t){let n=.5;const r=Ct(e),s=Ct(t);return s>r?n=Li(t.min,t.max-r,e.min):r>s&&(n=Li(e.min,e.max-s,t.min)),hn(0,1,n)}function gP(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Wl=.35;function bP(e=Wl){return e===!1?e=0:e===!0&&(e=Wl),{x:Gf(e,"left","right"),y:Gf(e,"top","bottom")}}function Gf(e,t,n){return{min:Kf(e,t),max:Kf(e,n)}}function Kf(e,t){return typeof e=="number"?e:e[t]||0}const xP=new WeakMap;class yP{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=mt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=h=>{n&&this.snapToCursor(Ki(h).point),this.stopAnimation()},a=(h,f)=>{const{drag:d,dragPropagation:m,onDragStart:b}=this.getProps();if(d&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=$6(d),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),an(y=>{let k=this.getAxisMotionValue(y).get()||0;if(dn.test(k)){const{projection:T}=this.visualElement;if(T&&T.layout){const S=T.layout.layoutBox[y];S&&(k=Ct(S)*(parseFloat(k)/100))}}this.originPoint[y]=k}),b&&nt.update(()=>b(h,f),!1,!0),Dl(this.visualElement,"transform");const{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},o=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f;const{dragPropagation:d,dragDirectionLock:m,onDirectionLock:b,onDrag:g}=this.getProps();if(!d&&!this.openDragLock)return;const{offset:y}=f;if(m&&this.currentDirection===null){this.currentDirection=vP(y),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),g&&nt.update(()=>g(h,f),!1,!0)},l=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f,this.stop(h,f),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:h}=this.getProps();(h||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:c}=this.getProps();this.panSession=new Z1(t,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:l,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:r,contextWindow:Q1(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,s=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!s||!r)return;const{velocity:a}=s;this.startAnimation(a);const{onDragEnd:o}=this.getProps();o&&nt.postRender(()=>o(r,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!As(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=hP(a,this.constraints[t],this.elastic[t])),i.set(a)}resolveConstraints(){var i;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,s=this.constraints;t&&Tr(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=fP(r.layoutBox,t):this.constraints=!1,this.elastic=bP(n),s!==this.constraints&&!Tr(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&an(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=gP(r.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Tr(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;s.root&&(s.root.scroll=void 0,s.root.updateScroll());const i=v4(r,s.root,this.visualElement.getTransformPagePoint());let a=mP(s.layout.layoutBox,i);if(n){const o=n(x4(a));this.hasMutatedConstraints=!!o,o&&(a=v1(o))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),l=this.constraints||{},u=an(c=>{if(!As(c,n,this.currentDirection))return;let h=l&&l[c]||{};(a===!0||a===c)&&(h={min:0,max:0});const f=s?200:1e6,d=s?40:1e7,m={type:"inertia",velocity:r?t[c]:0,bounceStiffness:f,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(c,m)});return Promise.all(u).then(o)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Dl(this.visualElement,t),r.start($u(t,r,0,n,this.visualElement,!1))}stopAnimation(){an(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps()[n];return s||this.visualElement.getValue(t,this.visualElement.latestValues[t]??0)}snapToCursor(t){an(n=>{const{drag:r}=this.getProps();if(!As(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:a,max:o}=s.layout.layoutBox[n],l=i.get()||0;i.set(t[n]-tt(a,o,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Tr(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};an(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const l=o.get();s[a]=pP({min:l,max:l},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),an(a=>{if(!As(a,t,null))return;const o=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];o.set(tt(l,u,s[a]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;xP.set(this.visualElement,this);const t=this.visualElement.current,n=Si(t,"pointerdown",u=>{const{drag:c,dragListener:h=!0}=this.getProps(),f=u.target,d=f!==t&&Z6(f);c&&h&&!d&&this.start(u)});let r;const s=()=>{const{dragConstraints:u}=this.getProps();Tr(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),r||(r=EP(t,u.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,a=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),nt.read(s);const o=Bi(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:c})=>{this.isDragging&&c&&(an(h=>{const f=this.getAxisMotionValue(h);f&&(this.originPoint[h]+=u[h].translate,f.set(f.get()+u[h].translate))}),this.visualElement.render())}));return()=>{o(),n(),a(),l&&l(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:a=Wl,dragMomentum:o=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:a,dragMomentum:o}}}function Xf(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function EP(e,t,n){const r=nf(e,Xf(n)),s=nf(t,Xf(n));return()=>{r(),s()}}function As(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function vP(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class TP extends Dn{constructor(t){super(t),this.removeGroupControls=Wt,this.removeListeners=Wt,this.controls=new yP(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Wt}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Vo=e=>(t,n)=>{e&&nt.update(()=>e(t,n),!1,!0)};class kP extends Dn{constructor(){super(...arguments),this.removePointerDownListener=Wt}onPointerDown(t){this.session=new Z1(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Q1(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:Vo(t),onStart:Vo(n),onMove:Vo(r),onEnd:(i,a)=>{delete this.session,s&&nt.postRender(()=>s(i,a))}}}mount(){this.removePointerDownListener=Si(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let qo=!1;class wP extends v.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),qo&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Hs.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,{projection:a}=r;return a&&(a.isPresent=i,t.layoutDependency!==n&&a.setOptions({...a.options,layoutDependency:n}),qo=!0,s||t.layoutDependency!==n||n===void 0||t.isPresent!==i?a.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?a.promote():a.relegate()||nt.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:r}=t;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),Xu.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;qo=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function eb(e){const[t,n]=V1(),r=v.useContext(Ru);return p.jsx(wP,{...e,layoutGroup:r,switchLayoutGroup:v.useContext(K1),isPresent:t,safeToRemove:n})}const SP={pan:{Feature:kP},drag:{Feature:TP,ProjectionNode:z1,MeasureLayout:eb}};function Qf(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&nt.postRender(()=>i(t,Ki(t)))}class AP extends Dn{mount(){const{current:t}=this.node;t&&(this.unmount=G6(t,(n,r)=>(Qf(this.node,r,"Start"),s=>Qf(this.node,s,"End"))))}unmount(){}}class CP extends Dn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=$i(Bi(this.node.current,"focus",()=>this.onFocus()),Bi(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Zf(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&nt.postRender(()=>i(t,Ki(t)))}class _P extends Dn{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=e4(t,(s,i)=>(Zf(this.node,i,"Start"),(a,{success:o})=>Zf(this.node,a,o?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const $l=new WeakMap,Wo=new WeakMap,NP=e=>{const t=$l.get(e.target);t&&t(e)},IP=e=>{e.forEach(NP)};function RP({root:e,...t}){const n=e||document;Wo.has(n)||Wo.set(n,{});const r=Wo.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(IP,{root:e,...t})),r[s]}function PP(e,t,n){const r=RP(t);return $l.set(e,n),r.observe(e),()=>{$l.delete(e),r.unobserve(e)}}const MP={some:0,all:1};class LP extends Dn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var l;(l=this.stopObserver)==null||l.call(this);const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:MP[s]},o=u=>{const{isIntersecting:c}=u;if(this.isInView===c||(this.isInView=c,i&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:h,onViewportLeave:f}=this.node.getProps(),d=c?h:f;d&&d(u)};this.stopObserver=PP(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(DP(t,n))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function DP({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const OP={inView:{Feature:LP},tap:{Feature:_P},focus:{Feature:CP},hover:{Feature:AP}},BP={layout:{ProjectionNode:z1,MeasureLayout:eb}},FP={...oP,...OP,...SP,...BP},jP=nP(FP,rP),HP=jP;function UP(e){switch(e){case"correct":return{Icon:Ql,color:"var(--brand)"};case"wrong":return{Icon:sm,color:"var(--warning)"};case"mastery":case"level-up":return{Icon:Zl,color:"var(--gold)"};case"unlock":return{Icon:zs,color:"var(--brand)"};case"streak":return{Icon:da,color:"var(--review)"};case"energy-full":return{Icon:Vs,color:"var(--brand)"};case"exam-pass":return{Icon:ox,color:"var(--exam)"};case"lesson-complete":return{Icon:Em,color:"var(--gold)"};default:return{Icon:zs,color:"var(--brand)"}}}function zP(){const e=Gl(),t=v.useRef(null),n=v.useRef([]),r=v.useRef(0),[s,i]=v.useState(null);return v.useEffect(()=>{if(e)return;const a=t.current;if(!a)return;const o=a.getContext("2d");if(!o)return;const l=()=>{const f=Math.min(window.devicePixelRatio||1,2);a.width=window.innerWidth*f,a.height=window.innerHeight*f,a.style.width=window.innerWidth+"px",a.style.height=window.innerHeight+"px",o.setTransform(f,0,0,f,0,0)};l(),window.addEventListener("resize",l);const u=()=>{o.clearRect(0,0,window.innerWidth,window.innerHeight);const f=n.current;for(let d=f.length-1;d>=0;d--){const m=f[d];if(m.x+=m.vx,m.y+=m.vy,m.vy+=.25,m.vx*=.99,m.rot+=m.vr,m.life--,m.life<=0){f.splice(d,1);continue}const b=Math.min(1,m.life/m.maxLife);o.save(),o.globalAlpha=b,o.translate(m.x,m.y),o.rotate(m.rot),o.fillStyle=m.color,m.shape==="circle"?(o.beginPath(),o.arc(0,0,m.size,0,Math.PI*2),o.fill()):o.fillRect(-m.size/2,-m.size/2,m.size,m.size*.6),o.restore()}r.current=f.length>0?requestAnimationFrame(u):0},h=Go(f=>{var y,k;const d=Xb(f.kind),m=Math.round(d.particles*(f.intensity??1)),b=((y=f.origin)==null?void 0:y.x)??window.innerWidth/2,g=((k=f.origin)==null?void 0:k.y)??window.innerHeight/2;for(let T=0;T<m;T++){const S=Math.PI*2*T/m+Math.random()*.3,E=3+Math.random()*6,w=d.durationMs/16*(.7+Math.random()*.5);n.current.push({x:b,y:g,vx:Math.cos(S)*E,vy:Math.sin(S)*E-2,life:w,maxLife:w,color:d.colors[T%d.colors.length],size:4+Math.random()*5,rot:Math.random()*Math.PI,vr:(Math.random()-.5)*.3,shape:Math.random()<.5?"rect":"circle"})}r.current===0&&(r.current=requestAnimationFrame(u))});return()=>{h(),window.removeEventListener("resize",l),r.current&&cancelAnimationFrame(r.current),r.current=0,n.current=[]}},[e]),v.useEffect(()=>{if(!e)return;let a=0;return Go(l=>{const u=++a;i({kind:l.kind,id:u}),setTimeout(()=>{u===a&&i(null)},600)})},[e]),e?p.jsx(RR,{children:s&&(()=>{const{Icon:a,color:o}=UP(s.kind);return p.jsx(HP.div,{className:"fixed inset-0 pointer-events-none z-[60] flex items-center justify-center","aria-hidden":"true",initial:{opacity:0},animate:{opacity:.45},exit:{opacity:0},transition:{duration:.2},children:p.jsx(a,{className:"w-24 h-24",color:o,strokeWidth:1.5})},s.id)})()}):p.jsx("canvas",{ref:t,className:"fixed inset-0 pointer-events-none z-[60]","aria-hidden":"true"})}function VP(e,t){const n=e.find(o=>o.id===t&&o.type!=="section");if(!n)return null;const r=e.filter(o=>o.type==="section").sort((o,l)=>o.orderIdx-l.orderIdx),s=o=>e.filter(l=>l.type!=="section"&&l.parentId===o).sort((l,u)=>l.orderIdx-u.orderIdx),i=s(n.parentId).find(o=>o.orderIdx>n.orderIdx);if(i)return i;const a=r.findIndex(o=>o.id===n.parentId);for(let o=a+1;o<r.length;o++){const l=s(r[o].id)[0];if(l)return l}return null}const qP=v.lazy(()=>Ae(()=>import("./PersonalProfileModal-IhrruXfg.js"),__vite__mapDeps([34,1,2]),import.meta.url)),WP=v.lazy(()=>Ae(()=>import("./SettingsView-B6w445fE.js"),__vite__mapDeps([35,1,2]),import.meta.url).then(e=>({default:e.SettingsView}))),$P=v.lazy(()=>Ae(()=>import("./ExamView-DPMDpplK.js"),__vite__mapDeps([36,1,2,31]),import.meta.url).then(e=>({default:e.ExamView}))),YP=v.lazy(()=>Ae(()=>import("./CommandPalette-0omhbLg3.js"),__vite__mapDeps([37,1,2]),import.meta.url).then(e=>({default:e.CommandPalette}))),GP=v.lazy(()=>Ae(()=>import("./CompanionBotLab-CT_JHmNI.js"),__vite__mapDeps([38,1,2]),import.meta.url).then(e=>({default:e.CompanionBotLab}))),Jf=["direct","guide","practice"];function KP(){const e=Ye(),[t,n]=v.useState([]),[r,s]=v.useState([]),[i,a]=v.useState({}),[o,l]=v.useState(null),[u,c]=v.useState(null),[h,f]=v.useState(null),[d,m]=v.useState(null),b=v.useCallback(z=>{m(z instanceof Error?z.message:String(z)),console.error(z)},[]),[g,y]=v.useState([]),[k,T]=v.useState(null),[S,E]=v.useState([]),[w,_]=v.useState(null),[A,N]=v.useState("map"),[C,L]=v.useState(null),[M,H]=v.useState(new Set),[P,R]=v.useState(null),[B,q]=v.useState(null),F=v.useRef({active:!1,terminate:null}),[V,I]=v.useState({open:!1,pendingAction:null}),W=v.useRef(null),[K,D]=v.useState(null),[ne,oe]=v.useState(!1),[J,Y]=v.useState(null),[X,de]=v.useState(!1),[ge,ee]=v.useState(null),[ie,xe]=v.useState(!0),[Se,Le]=v.useState(!0),pe=MI(),[Te,Me]=v.useState("notebook"),[te,Ie]=v.useState("chat"),be=v.useRef(te);be.current=te;const Fe=v.useRef(pe);v.useEffect(()=>{Fe.current!==pe&&(pe===1?(xe(!0),Le(!0)):pe===2&&Fe.current===3&&Me(_I(be.current)),Fe.current=pe)},[pe]);const Qe=pe===3?te==="rail":pe===2?Te==="rail":ie,De=pe===3?te==="notebook":pe===2?Te==="notebook":Se,st=pe!==3||te==="chat",[Q,re]=v.useState(null),[ve,ke]=v.useState(null);v.useEffect(()=>{let z=!0;return(async()=>{const[G,le]=await Promise.all([se.getSetting("pane_width_left"),se.getSetting("pane_width_mid")]);z&&(re(Lh(G,El,mg)),ke(Lh(le,Mi,gg)))})(),()=>{z=!1}},[]);const Ne=pe===3?"t3":pe===2?Qe?"t2-rail":"t2-notebook":"t1",bt=FI(Q!=null||ve!=null)||window.innerWidth,ye=BI(Q,ve,bt,Ne),Be=OI(pe,Qe,De),Ve=v.useRef(null),fe=Ne==="t2-rail"?Mi:vi+(ye.mid??bg(bt)),Ge=vi+(Ne==="t2-notebook"?0:ye.rail??pg),Et=(z,G)=>{z==="rail"?(re(G),se.setSetting("pane_width_left",G!=null?String(G):"")):(ke(G),se.setSetting("pane_width_mid",G!=null?String(G):""))},On=()=>{pe===1?xe(z=>!z):pe===2?Me(z=>z==="rail"?"notebook":"rail"):Ie(z=>z==="rail"?"chat":"rail")},Xi=()=>{pe===1?Le(z=>!z):pe===2?Me(z=>z==="notebook"?"rail":"notebook"):Ie(z=>z==="notebook"?"chat":"notebook")},Bn=v.useRef(null),Qi=z=>{var le,Ce;if(pe!==3)return;const G=z.touches[0];Bn.current={x:G.clientX,y:G.clientY,multi:z.touches.length>1,noswipe:!!((Ce=(le=z.target).closest)!=null&&Ce.call(le,"[data-noswipe]"))}},Zi=z=>{const G=Bn.current;if(Bn.current=null,!G||G.multi||G.noswipe||pe!==3)return;const le=z.changedTouches[0],Ce=NI(be.current,le.clientX-G.x,le.clientY-G.y);Ce&&Ie(Ce)},[Ji,Fn]=v.useState(!1),[es,ts]=v.useState(()=>location.hash==="#companion-bot-lab");v.useEffect(()=>{const z=()=>ts(location.hash==="#companion-bot-lab");return window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)},[]);const[Bt,we]=v.useState(null),[We,Ke]=v.useState([]),Re=kI(h,P),Xe=ha(),me=EI(Re.activeId,Xe);v.useEffect(()=>{Qb(me.streaming)},[me.streaming]);const[ze,Oe]=v.useState(""),ht=v.useCallback(z=>{Oe(z)},[]),Ft=v.useCallback((z,G,le)=>{if(z.type==="content"){if(D("content"),le){const Ce=Ze=>{th(le)?window.dispatchEvent(new CustomEvent("lookatstudy-jump-to-note",{detail:le})):Ze>0&&setTimeout(()=>Ce(Ze-1),150)};setTimeout(()=>Ce(10),100)}}else if(z.threadId!==Re.activeId&&Re.setActiveId(z.threadId),le){const Ce=Ze=>{th(le)?window.dispatchEvent(new CustomEvent("lookatstudy-jump-to-chat-note",{detail:le})):Ze>0&&setTimeout(()=>Ce(Ze-1),150)};setTimeout(()=>Ce(10),120)}},[Re]),[Je,$e]=v.useState(null);v.useEffect(()=>{if(!P){$e(null);return}let z=!1;return se.getNodeSummary(P,Xe).then(G=>{z||$e(G)}).catch(()=>{z||$e(null)}),()=>{z=!0}},[P,Xe]);const je=v.useMemo(()=>r.find(z=>z.id===P)??null,[r,P]),jn=v.useMemo(()=>We.map(z=>({...z,label:e(`starter.${z.key}.label`),hint:e(`starter.${z.key}.hint`),message:e(`starter.${z.key}.message`,{title:(je==null?void 0:je.title)??""})})),[We,je,e]),_t=v.useRef(null),Yt=v.useCallback(()=>{var z;je&&((z=_t.current)==null||z.call(_t,e("chat.action.startLearningPrompt",{title:je.title}),e("chat.action.startLearning",{title:je.title})))},[je,e]),Pt=v.useCallback(async()=>{try{const[z,G,le,Ce,Ze,Xt]=await Promise.all([se.listCourses(),se.getStreak(),se.listSouls(),se.getActiveSoul(),se.getXpStatus(),se.getDueReviews()]);n(z),l(G),E(le),c(Ze),_(Ce),H(new Set(Xt)),h&&!z.some(xb=>xb.id===h)&&(f(null),R(null),s([]),a({}),L(null),y([]),T(null))}catch(z){m(z instanceof Error?z.message:String(z))}},[h]);v.useEffect(()=>{Pt()},[Pt]);const ft=v.useCallback(async()=>{try{H(new Set(await se.getDueReviews()))}catch{}},[]),Hn=v.useCallback(async()=>{try{we(await se.isAgentReady())}catch{we({ready:!1,missing:e("error.checkReadyFailed")})}},[e]);v.useEffect(()=>{Hn();const z=()=>Hn();return window.addEventListener("llm-config-changed",z),()=>window.removeEventListener("llm-config-changed",z)},[Hn]);const Un=v.useRef(0),mr=v.useRef(0);v.useEffect(()=>{Un.current=(u==null?void 0:u.todayXp)??0},[u]),v.useEffect(()=>{mr.current=(o==null?void 0:o.currentStreak)??0},[o]);const Tn=v.useCallback(async()=>{const z=r.filter(Ce=>Ce.type==="lesson"||Ce.type==="exam"),G=await Promise.all(z.map(async Ce=>{const Ze=await se.getProgress(Ce.id);return[Ce.id,Ze]})),le={};for(const[Ce,Ze]of G)Ze&&(le[Ce]=Ze);a(le)},[r]);v.useEffect(()=>se.on("state:changed",G=>{G==="xp"?(se.getXpStatus().then(le=>{c(le),Un.current<100&&le.todayXp>=100&&Cr("energy-full")}).catch(()=>{}),ft()):G==="streak"?(se.getStreak().then(le=>{l(le),le.currentStreak>mr.current&&Cr("streak")}).catch(()=>{}),ft()):G==="mastery"&&(Cr("mastery"),Pt(),Tn())}),[Pt,ft,Tn]),v.useEffect(()=>{h&&(se.getCourseLanguages(h).then(y).catch(()=>y([])),se.getCourseLanguage(h).then(T).catch(()=>T(null)))},[h]),v.useEffect(()=>{h&&(se.getCourseTree(h,k??void 0).then(async z=>{s(z);const G=z.filter(Ze=>Ze.type==="lesson"||Ze.type==="exam"),le=await Promise.all(G.map(async Ze=>{const Xt=await se.getProgress(Ze.id);return[Ze.id,Xt]})),Ce={};for(const[Ze,Xt]of le)Xt&&(Ce[Ze]=Xt);a(Ce)}).catch(b),se.getDashboard(h).then(L).catch(b))},[h,k,b]),v.useEffect(()=>{if(!P){Ke([]);return}se.getStarterPrompts(P).then(Ke).catch(()=>Ke([]))},[P]),v.useEffect(()=>{const z=G=>{if(G.key==="Escape"&&Re.activeId&&(se.abortAgentChatThread(Re.activeId).catch(()=>{}),oe(!1),Fn(!1)),(G.ctrlKey||G.metaKey)&&G.key==="k"&&(G.preventDefault(),Fn(le=>!le)),(G.ctrlKey||G.metaKey)&&G.key==="b"&&(G.preventDefault(),On()),(G.ctrlKey||G.metaKey)&&G.key==="Tab"){if(G.preventDefault(),F.current.active)return;const le=Re.threads;if(le.length>1){const Ce=le.findIndex(Xt=>Xt.id===Re.activeId),Ze=G.shiftKey?(Ce-1+le.length)%le.length:(Ce+1)%le.length;Re.setActiveId(le[Ze].id)}}(!(G.target instanceof Element)||!G.target.matches("input, textarea, select"))&&(G.key==="1"&&N("map"),G.key==="2"&&N("import"),G.key==="s"&&(G.ctrlKey||G.metaKey)&&(G.preventDefault(),oe(!0)))};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[P]);const wt=v.useCallback(async z=>{var G;try{if(z.type==="exam"){R(z.id),D("content");return}if(((G=i[z.id])==null?void 0:G.status)==="locked"){R(null);return}await se.markNodeAttempted(z.id);const le=await se.getStreak();await Tn(),l(le),R(z.id),D("content"),Fa(!1)}catch(le){b(le)}},[i,Tn,b]),Gt=v.useCallback(z=>{if(F.current.active){I({open:!0,pendingAction:z});return}z()},[]),zn=v.useCallback(z=>{if(ac(null),F.current.active&&z.id!==P){I({open:!0,pendingAction:()=>void wt(z)});return}wt(z)},[wt,P]),ns=v.useCallback(()=>{se.profileGet().then(z=>ee((z==null?void 0:z.name)??null)).catch(()=>{})},[]);v.useEffect(()=>{ns()},[ns]);const nb=v.useCallback((z,G)=>{f(z),q(G),Pt()},[Pt]),rb=v.useCallback((z,G)=>{const le=r.find(Ce=>Ce.id===z);if(le){zn(le);return}},[r,zn]),ib=v.useCallback(()=>{Me("rail"),xe(!0),pe===3&&Ie("rail"),window.setTimeout(()=>{const z=document.querySelector('[data-testid="map-rail"]');if(z){const G=z.getBoundingClientRect();$o(G.left+G.width*.5,G.top+G.height*.3)}},60)},[pe]),[Kt,rs]=v.useState(null),[sb,ac]=v.useState(null);v.useEffect(()=>se.on("lesson:mastered",({nodeId:z})=>{r.some(G=>G.id===z)&&rs({completedId:z,next:VP(r,z)})}),[r]),v.useEffect(()=>{if(!Kt||Kt.next)return;const z=window.setTimeout(()=>rs(null),1e4);return()=>window.clearTimeout(z)},[Kt]);const ab=v.useCallback(()=>{const z=Kt==null?void 0:Kt.next;z&&(Me("rail"),xe(!0),pe===3&&Ie("rail"),ac(z.id),rs(null),window.setTimeout(()=>{const G=document.querySelector(`[data-node-id="${CSS.escape(z.id)}"]`),le=G==null?void 0:G.getBoundingClientRect();le&&le.width>0&&le.top>=0&&le.bottom<=window.innerHeight&&($o(le.right+28,le.top+le.height/2),Pr())},60))},[Kt,pe]);v.useEffect(()=>{if(!B||!h||r.length===0)return;const z=r.find(G=>G.id===B);q(null),z&&zn(z)},[B,r,h,zn]),v.useEffect(()=>{h&&se.setSetting("last_session",JSON.stringify({courseId:h,nodeId:P})).catch(()=>{})},[h,P]);const ob=v.useCallback(z=>{F.current=z},[]),lb=v.useCallback(async()=>{const z=V.pendingAction;I({open:!1,pendingAction:null});const G=F.current;if(F.current={active:!1,terminate:null},G.active&&G.terminate)try{await G.terminate()}catch{}z==null||z()},[V.pendingAction]);fa(W,V.open),v.useEffect(()=>{if(!V.open)return;const z=G=>{G.key==="Escape"&&I({open:!1,pendingAction:null})};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[V.open]);const ub=async z=>{try{await se.setActiveSoul(z),_(z)}catch(G){b(G)}},cb=v.useCallback(async(z,G,le)=>{try{await se.applyProposal(z),me.markProposalStatus(G,le,!0)}catch(Ce){b(Ce)}},[me,b]),db=v.useCallback(async(z,G,le)=>{try{await se.rejectProposal(z),me.markProposalStatus(G,le,!1)}catch(Ce){b(Ce)}},[me,b]),Da=t.find(z=>z.id===h),oc=v.useMemo(()=>{const z=new Set(r.map(G=>G.id));return new Set([...M].filter(G=>z.has(G)))},[M,r]),is=oc.size,hb=v.useMemo(()=>r.filter(z=>z.type==="section").sort((z,G)=>z.orderIdx-G.orderIdx),[r]),fb=v.useMemo(()=>{const z=Jf.map(le=>S.find(Ce=>Ce.name===le)).filter(le=>!!le),G=S.filter(le=>!Jf.includes(le.name));return[...z,...G]},[S]),Mt=EN(h),lc=TN(),lt=Cu();v.useEffect(()=>se.on("exam:status",G=>{if(G.status!=="ready"||G.nodeId===P)return;const le=r.find(Ce=>Ce.id===G.nodeId);le&&lt.show(e("exam.ready.toast",{title:le.title}),{duration:4e3})}),[P,r,lt,e]);const uc=v.useRef(!1);v.useEffect(()=>{!h||uc.current||(uc.current=!0,se.getUpdateInfo().then(z=>{z!=null&&z.hasUpdate&&(lt.show(e("update.available",{version:z.latest}),{severity:"info",duration:8e3,action:{label:e("update.download"),onClick:()=>window.open(z.releaseUrl)}}),se.setSetting("update_prompt_seen",z.latest).catch(()=>{}))}).catch(()=>{}))},[h,lt,e]);const mb=v.useCallback(async z=>{const G=t.find(le=>le.id===z);try{await se.deleteCourse(z),lt.show(e("import.deleted",{title:(G==null?void 0:G.title)??z}),{duration:3e3}),Pt()}catch(le){b(le)}},[t,Pt,b,lt,e]),Oa=v.useCallback(async(z,G,le)=>{if(!z.trim()||me.streaming)return;if(!Re.activeId){const Ze=await Re.ensureThreadForSend(z,G);if(Ze){me.send(z,Ze,G,le);return}lt.show(e("toast.threadCreateFailed"));return}const Ce=Re.activeThread;Ce&&!Ce.title&&Re.update(Ce.id,{title:(G??z).trim()}),me.send(z,void 0,G,le)},[me,Re,lt,e]),cc=v.useRef(me.streaming);cc.current=me.streaming;const pb=v.useCallback(z=>{const G=TI(z,e),le=vI(z,e),Ce=Ze=>{var Xt;if(!cc.current){(Xt=_t.current)==null||Xt.call(_t,G,le);return}Ze>0&&setTimeout(()=>Ce(Ze-1),2e3)};Ce(10)},[e]);_t.current=Oa;const dc=new Set(["concept_map","diagram","compare_table","code_walkthrough"]),$r=v.useMemo(()=>{const z=Eh(me.messages).filter(le=>{var Ce;return dc.has(((Ce=le.output)==null?void 0:Ce.artifactType)??"")});if(z.length)return z[z.length-1];const G=Mt.items.filter(le=>dc.has(le.artifactType)).map(le=>{try{return{id:le.id,toolName:le.artifactType,output:JSON.parse(le.data)}}catch{return null}}).filter(le=>le!==null);return G.length?G[G.length-1]:null},[me.messages,Mt.items]),hc=v.useRef(new Set);v.useEffect(()=>{!$r||hc.current.has($r.id)||(hc.current.add($r.id),me.streaming&&D("board"))},[$r,me.streaming]);const gb=v.useMemo(()=>me.messages.reduce((z,G)=>z+G.parts.reduce((le,Ce)=>Ce.type==="text"?le+km(Ce.text):le,0),0),[me.messages]),fc=v.useRef(!1);v.useEffect(()=>{is>0&&!fc.current&&(fc.current=!0,lt.show(e("review.nudge",{n:is}),{duration:4e3}))},[is,lt,e]);const mc=v.useMemo(()=>Eh(me.messages),[me.messages]),pc=v.useRef(new Set);v.useEffect(()=>{for(const z of mc){const G=z.output;if(!G||!G.artifactType)continue;const le=`${G.artifactType}:${JSON.stringify(G)}`;pc.current.has(le)||(pc.current.add(le),Mt.save({nodeId:P,artifactType:G.artifactType,title:G.title??null,data:G}),lt.show(e("toast.artifactSaved"),{duration:3e3}))}},[mc,Mt,P,lt,e]),v.useEffect(()=>{A!=="map"&&D(null)},[A]);const[bb,ss]=v.useState(!1),[Ba,Fa]=v.useState(!1),gc=(je==null?void 0:je.type)==="exam";return v.useEffect(()=>{gc&&window.dispatchEvent(new CustomEvent("companion-exam-enter"))},[gc]),v.useEffect(()=>{Zb(Ba)},[Ba]),p.jsxs("div",{className:"h-[var(--app-height,100vh)] flex flex-col bg-surface-1 text-neutral-900 dark:text-neutral-100 overflow-hidden",children:[p.jsx(QP,{streak:o,xp:u,fontSize:lc.size,onFontBump:lc.bump,onOpenSettings:()=>oe(!0),profileName:ge,onOpenProfile:()=>de(!0),leftVisible:Qe,rightVisible:De,onToggleLeft:On,onToggleRight:Xi,tier:pe,bottomBar:pe===3?p.jsx("nav",{className:"inline-flex items-center gap-0.5 p-0.5 rounded-lg bg-ink/5 ring-1 ring-inset ring-[var(--border)]","data-testid":"t3-pane-switcher",role:"tablist","aria-label":e("pane.switcher"),children:[{k:"rail",icon:mm,label:e("pane.map"),testid:"t3-btn-rail"},{k:"chat",icon:Ax,label:e("pane.chat"),testid:"t3-btn-chat"},{k:"notebook",icon:Rx,label:e("pane.notes"),testid:"t3-btn-notebook"}].map(({k:z,icon:G,label:le,testid:Ce})=>p.jsx("button",{role:"tab","aria-selected":te===z,"aria-label":le,"data-testid":Ce,"data-tooltip":le,onClick:()=>Ie(z),className:`w-8 h-7 flex items-center justify-center rounded-md transition-colors ${te===z?"bg-brand/20 text-brand":"text-ink-muted active:bg-ink/10"}`,children:p.jsx(G,{className:"w-4 h-4"})},z))}):void 0}),d&&p.jsx(eM,{message:d,onClose:()=>m(null)}),p.jsxs("div",{className:"flex-1 flex min-h-0 min-w-0",onTouchStart:Qi,onTouchEnd:Zi,children:[Qe&&p.jsx($y,{fullWidth:pe===3,width:pe===3?null:ye.rail,view:A,onViewChange:N,nextCueNodeId:sb,courseTitle:(Da==null?void 0:Da.title)??null,courseId:h,courses:t,sections:hb,tree:r,progressMap:i,selectedNodeId:P,dueCount:is,dueNodeIds:oc,overallMastery:(C==null?void 0:C.overallMastery)??0,streak:(o==null?void 0:o.currentStreak)??0,streaming:me.streamingThreadIds.length>0,streamingNodeIds:me.streamingNodeIds,onJumpNode:z=>{const G=r.find(le=>le.id===z);G&&zn(G),pe===3&&Ie("chat")},onOpenReview:()=>ss(!0),onSelectCourse:z=>Gt(()=>{f(z),Pt(),se.setSetting("boot_done","1").catch(()=>{})}),onDeleteCourse:z=>Gt(()=>{mb(z)}),onCoursesChanged:()=>{Pt()},availableLanguages:g,currentLocale:k,onLocaleChange:async z=>{h&&(await se.setCourseLanguage(h,z),T(z))}}),Be.rail&&st&&p.jsx(Dh,{side:"rail",ariaLabel:e("pane.resizeRailAria"),tooltip:e("pane.resizeTooltip"),target:()=>document.querySelector('[data-testid="map-rail"]'),clampLive:z=>vl(z,window.innerWidth,fe),onCommit:z=>Et("rail",z)}),p.jsxs(p.Fragment,{children:[st&&p.jsx("div",{ref:Ve,className:"relative flex flex-col h-full bg-surface-1 shrink-0 min-w-0 motion-safe:transition-[width] motion-safe:duration-200",style:pe===3?{flex:1}:De?{width:ye.mid!=null?`${ye.mid}px`:DI}:{flex:1},"data-testid":"chat-panel",children:h?(je==null?void 0:je.type)==="exam"?p.jsx(v.Suspense,{fallback:null,children:p.jsx($P,{examNode:je,locale:Xe,onSessionChange:ob,paused:V.open,onExamCompleted:()=>{se.getProgress(je.id).then(z=>{z&&a(G=>({...G,[je.id]:z}))})}})}):p.jsxs(p.Fragment,{children:[p.jsx(wI,{threads:Re.threads,activeThread:Re.activeThread,focusNodeTitle:(je==null?void 0:je.title)??null,streamingThreadIds:me.streamingThreadIds,onPickThread:z=>{Re.setActiveId(z)},onCreate:()=>{Re.create({title:null}),lt.show(e("toast.threadCreated"))},onRename:(z,G)=>{Re.update(z,{title:G}),lt.show(e("toast.threadRenamed"))},onArchive:z=>{Re.update(z,{status:"archived"}),lt.show(e("toast.threadArchived"),{duration:5e3,action:{label:e("action.undo"),onClick:()=>Re.update(z,{status:"active"})}})},onDelete:z=>{const G=Re.removeWithUndo(z);G&&(lt.show(`${e("toast.threadDeleted")}${G.title?`「${G.title}」`:""}`,{duration:5e3,action:{label:e("action.undo"),onClick:()=>{Re.restore(G),lt.show(e("toast.restored"))}}}),setTimeout(()=>{se.threadDelete(G.id).catch(()=>{})},5500))}}),p.jsx(CN,{messages:me.messages,streaming:me.streaming,onApplyProposal:cb,onRejectProposal:db,summary:Je,onStartLearning:Bt!=null&&Bt.ready?Yt:void 0,agentReady:(Bt==null?void 0:Bt.ready)??!1,onGotoSettings:()=>oe(!0),hasNode:!!je,selectedNodeId:P,threadId:Re.activeId,onPickQuizAction:z=>{Oa(z)},onQuizCompleted:pb,cardMode:pe===3,chatNotes:Mt.items.filter(z=>z.artifactType==="user_note"&&z.sourceAnchor),onSaveChatNote:(z,G,le,Ce)=>{!je||!Re.activeId||(Mt.saveUserNote({nodeId:je.id,text:z,sourceType:"chat",sourceAnchor:{type:"chat",threadId:Re.activeId,msgId:G,startOffset:le,endOffset:Ce}}),lt.show(e("toast.noteSaved"),{duration:2e3}))}}),p.jsx(QN,{nodeId:P,agentReady:(Bt==null?void 0:Bt.ready)??!1,streaming:me.streaming,souls:fb,activeSoul:w,starterPrompts:me.messages.length>0?jn:[],onPickSoul:ub,onSend:Oa,onStop:me.stop,onLogFriction:P?(z,G)=>{se.logFriction(P,z,G),lt.show(e("chat.friction.saved"),{duration:2500})}:void 0,onGotoSettings:()=>oe(!0),insertText:ze,historyTokens:gb})]}):p.jsx("div",{className:"flex-1 flex flex-col min-h-0","data-testid":"chat-no-course",children:p.jsx(mN,{onResume:(z,G)=>Gt(()=>nb(z,G)),onOpenReview:z=>Gt(()=>{!h&&z&&(f(z),Pt(),se.setSetting("boot_done","1").catch(()=>{})),ss(!0)}),onOpenSettings:z=>{Y(z??null),oe(!0)},onGotoNode:(z,G)=>Gt(()=>rb(z,G)),onPickCourse:ib,onOpenProfile:()=>de(!0),onProfileChanged:ns})})}),Be.mid&&st&&p.jsx(Dh,{side:"mid",ariaLabel:e("pane.resizeChatAria"),tooltip:e("pane.resizeTooltip"),target:()=>Ve.current,clampLive:z=>xg(z,window.innerWidth,Ge),onCommit:z=>Et("mid",z)}),De&&p.jsx("main",{className:pe===3?"flex-1 min-w-0 bg-surface-2":"flex-1 min-w-[440px] bg-surface-2","data-testid":pe===3?"notebook-pane-full":void 0,children:h?p.jsx(K_,{selectedNode:je,items:Mt.items,loading:Mt.loading,forceTab:K,canvasArtifact:$r,onUserTabChange:()=>D(null),onRemove:z=>{Mt.remove(z),lt.show(e("toast.noteDeleted"))},onTogglePin:z=>{Mt.togglePin(z)},onRecordQuizResult:(z,G)=>{Mt.recordQuizResult(z,G)},onUpdateNoteComment:(z,G)=>{Mt.updateUserNoteComment(z,G)},onSaveContentNote:(z,G)=>{je&&(Mt.saveUserNote({nodeId:je.id,text:z,sourceType:"content",sourceAnchor:G}),lt.show(e("toast.noteSaved"),{duration:2e3}))},onJumpToSource:Ft,onQuoteToChat:ht,locale:k,isReviewing:Ba,onReviewDone:()=>Fa(!1)}):p.jsx(bN,{})})]})]}),X&&p.jsx(v.Suspense,{fallback:null,children:p.jsx(qP,{onClose:()=>de(!1),onProfileSaved:ns})}),ne&&p.jsx(ZP,{onClose:()=>{oe(!1),Y(null)},focusSection:J}),bb&&p.jsx(JP,{onClose:()=>ss(!1),tree:r,dashboard:C,progressMap:i,onPickNode:z=>{Gt(()=>{R(z),D("content"),ss(!1),Fa(!0)})}}),V.open&&p.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50","data-testid":"exam-leave-modal",children:p.jsxs("div",{ref:W,className:"w-[min(400px,90vw)] rounded-2xl bg-surface-0 p-6 shadow-elevated border border-warning/40",role:"dialog","aria-modal":"true","aria-label":e("exam.leave.title"),children:[p.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[p.jsx(eu,{className:"w-5 h-5 text-warning shrink-0"}),p.jsx("span",{className:"text-title font-bold text-ink",children:e("exam.leave.title")})]}),p.jsx("div",{className:"text-body text-ink-muted mb-5 leading-relaxed",children:e("exam.leave.message")}),p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx("button",{className:"btn-3d-neutral px-4 py-1.5 text-body",onClick:()=>I({open:!1,pendingAction:null}),"data-testid":"exam-leave-cancel",children:e("exam.leave.cancel")}),p.jsx("button",{className:"btn-3d-brand px-4 py-1.5 text-body",style:{background:"var(--warning)",boxShadow:"0 3px 0 0 var(--warning-dark)"},onClick:()=>void lb(),"data-testid":"exam-leave-confirm",children:e("exam.leave.confirm")})]})]})}),Ji&&p.jsx(v.Suspense,{fallback:null,children:p.jsx(YP,{onClose:()=>Fn(!1),onPick:z=>{Fn(!1),XP(z)},hasNode:!!P})}),Kt&&p.jsxs("div",{"data-testid":"next-lesson-card",className:"fixed bottom-24 left-1/2 -translate-x-1/2 z-40 surface-card px-4 py-3 flex items-center gap-3 shadow-elevated max-w-[92vw] toast-enter",role:"status",children:[p.jsx(Zl,{className:"w-5 h-5 text-gold shrink-0","aria-hidden":"true"}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"text-body font-bold text-ink",children:e("lesson.next.title")}),Kt.next?p.jsxs("div",{className:"text-label text-ink-muted truncate",children:[e("lesson.next.guide")," · ",Kt.next.title]}):p.jsx("div",{className:"text-label text-ink-muted",children:e("lesson.next.terminal")})]}),Kt.next&&p.jsx("button",{className:"btn-3d-brand text-label px-3 py-1.5 shrink-0",onClick:ab,"data-testid":"next-lesson-go",children:e("lesson.next.button")}),p.jsx("button",{className:"text-ink-faint hover:text-ink shrink-0",onClick:()=>rs(null),"aria-label":e("common.close"),"data-testid":"next-lesson-close",children:p.jsx(In,{className:"w-4 h-4"})})]}),p.jsx(r2,{}),p.jsx(zP,{}),p.jsx(hI,{courseId:h}),es&&p.jsx(v.Suspense,{fallback:null,children:p.jsx(GP,{})})]})}function XP(e){window.dispatchEvent(new CustomEvent("lookatstudy-command",{detail:e}))}function QP({streak:e,xp:t,fontSize:n,onFontBump:r,onOpenSettings:s,profileName:i,onOpenProfile:a,leftVisible:o,rightVisible:l,onToggleLeft:u,onToggleRight:c,tier:h,bottomBar:f}){const d=Ye();return f?p.jsx("header",{className:"app-header shrink-0",children:p.jsxs("div",{className:"flex items-center h-12 px-4",children:[p.jsx("div",{className:"flex-1 flex items-center min-w-0",children:t&&p.jsxs("div",{className:"flex items-center gap-1 shrink-0","data-testid":"xp-bar",title:d("header.energy"),children:[p.jsx(Vs,{className:`w-3.5 h-3.5 text-brand ${t.todayXp>=100?"energy-breathe":""}`,fill:t.todayXp>=100?"currentColor":"none","aria-hidden":"true"}),p.jsx("span",{className:"text-label font-bold tabular-nums text-brand",children:t.todayXp})]})}),f,p.jsxs("div",{className:"flex-1 flex items-center justify-end",children:[p.jsx(em,{profileName:i,onOpenProfile:a}),p.jsx("button",{onClick:s,"data-testid":"header-settings","aria-label":d("header.settings"),className:"text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-300 w-8 h-8 flex items-center justify-center rounded-lg hover:bg-neutral-200 dark:hover:bg-neutral-800/50 transition-colors",title:d("header.settings"),children:p.jsx(Us,{className:"w-4 h-4"})})]})]})}):p.jsx("header",{className:"app-header shrink-0 flex flex-col",children:p.jsxs("div",{className:"flex items-center pt-2.5 pb-3 px-6 justify-between",children:[p.jsx("div",{className:"flex items-center gap-2 min-w-0",children:p.jsxs("h1",{className:"text-body font-extrabold tracking-tight text-neutral-900 dark:text-neutral-100 select-none min-w-0 truncate",children:["Lookat",p.jsx("span",{className:"text-brand",children:"Study"})]})}),p.jsxs("div",{className:"flex items-center gap-3",children:[h!==3&&p.jsxs("div",{className:"flex items-center gap-0.5",children:[p.jsx("button",{onClick:u,"data-testid":"layout-toggle-left",className:`w-7 h-7 flex items-center justify-center rounded-md transition-colors ${o?"text-neutral-500 hover:bg-neutral-200 dark:text-neutral-300 dark:hover:bg-neutral-800":"text-neutral-600 bg-neutral-200 dark:bg-neutral-800"}`,title:d("header.toggleLeft"),children:p.jsx(_x,{className:"w-4 h-4"})}),p.jsx("button",{onClick:c,"data-testid":"layout-toggle-right",className:`w-7 h-7 flex items-center justify-center rounded-md transition-colors ${l?"text-neutral-500 hover:bg-neutral-200 dark:text-neutral-300 dark:hover:bg-neutral-800":"text-neutral-600 bg-neutral-200 dark:bg-neutral-800"}`,title:d("header.toggleRight"),children:p.jsx(Nx,{className:"w-4 h-4"})})]}),h!==3&&p.jsxs("div",{className:"flex items-center gap-0.5","data-testid":"font-size-control",children:[p.jsx("button",{onClick:()=>r("down"),disabled:n==="small","data-testid":"font-smaller",className:"text-label w-7 h-7 flex items-center justify-center rounded-md text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200 hover:bg-ink/5 disabled:opacity-20 disabled:cursor-not-allowed transition-colors",title:d("header.font.smaller"),children:"A-"}),p.jsx("button",{onClick:()=>r("up"),disabled:n==="large","data-testid":"font-larger",className:"text-body w-7 h-7 flex items-center justify-center rounded-md text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200 hover:bg-ink/5 disabled:opacity-20 disabled:cursor-not-allowed transition-colors",title:d("header.font.larger"),children:"A+"})]}),t&&p.jsxs("div",{className:"flex items-center gap-1.5","data-testid":"xp-bar",title:d("header.energy"),children:[p.jsx(Vs,{className:`w-3.5 h-3.5 text-brand ${t.todayXp>=100?"energy-breathe":""}`,fill:t.todayXp>=100?"currentColor":"none","aria-hidden":"true"}),p.jsx("div",{className:"w-16 h-2 bg-neutral-200 dark:bg-neutral-800 rounded-full overflow-hidden",children:p.jsx("div",{className:"h-full rounded-full bg-brand transition-all duration-500",style:{width:`${Math.min(100,Math.max(3,t.todayXp))}%`}})}),p.jsx("span",{className:"text-label font-bold tabular-nums text-brand",children:t.todayXp})]}),t&&p.jsx("div",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-brand/10","data-testid":"level-badge",title:d("header.level.title"),children:p.jsxs("span",{className:"text-label font-bold text-brand",children:["Lv.",t.level]})}),e&&p.jsx(tM,{streak:e}),p.jsx(em,{profileName:i,onOpenProfile:a}),p.jsx("button",{onClick:s,"data-testid":"header-settings",className:"text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-300 w-8 h-8 flex items-center justify-center rounded-lg hover:bg-neutral-200 dark:hover:bg-neutral-800/50 transition-colors",title:d("header.settings"),children:p.jsx(Us,{className:"w-4 h-4"})})]})]})})}function em({profileName:e,onOpenProfile:t}){const n=Ye(),r=yN(e);return p.jsx("button",{onClick:t,"data-testid":"header-profile","aria-label":n("profile.header.open"),"data-tooltip":n("profile.header.open"),className:"w-9 h-9 flex items-center justify-center rounded-full transition-transform hover:scale-105 shrink-0",style:r?{backgroundColor:r.bg,color:r.fg}:void 0,children:r?p.jsx("span",{className:"text-label font-bold leading-none",children:r.initial}):p.jsx(Wx,{className:"w-4 h-4 text-ink-muted","aria-hidden":"true"})})}function ZP({onClose:e,focusSection:t}){const n=Ye(),r=v.useRef(null);return fa(r,!0),v.useEffect(()=>{if(!t)return;const s=()=>document.getElementById(`settings-section-${t}`),i=[250,700].map(a=>window.setTimeout(()=>{var o;(o=s())==null||o.scrollIntoView({behavior:"smooth",block:"start"})},a));return()=>i.forEach(clearTimeout)},[t]),p.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end","data-testid":"settings-drawer",children:[p.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:e}),p.jsxs("div",{ref:r,role:"dialog","aria-modal":"true","aria-label":n("settings.title"),className:"relative w-full max-w-lg h-full bg-surface-0 border-l border-[var(--border)] shadow-elevated flex flex-col",children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)] shrink-0",children:[p.jsx("h2",{className:"text-body font-bold",children:n("settings.title")}),p.jsx("button",{onClick:e,"data-testid":"settings-close","aria-label":n("action.close"),className:"text-ink-muted hover:text-ink-strong w-8 h-8 flex items-center justify-center rounded-lg hover:bg-surface-3",children:"✕"})]}),p.jsx("div",{className:"flex-1 overflow-y-auto",children:p.jsx(v.Suspense,{fallback:null,children:p.jsx(WP,{})})})]})]})}function JP({onClose:e,tree:t,onPickNode:n,dashboard:r,progressMap:s}){const i=Ye(),a=v.useRef(null);fa(a,!0);const[o,l]=v.useState([]);v.useEffect(()=>{se.getAllSrsItems().then(T=>l(T)).catch(()=>l([]))},[]);const u=v.useMemo(()=>new Map(o.map(T=>[T.nodeId,T])),[o]),c=v.useMemo(()=>{const T=new Map(t.map(E=>[E.id,E])),S=o.filter(E=>T.has(E.nodeId));return{overdue:S.filter(E=>E.overdue),short:S.filter(E=>!E.overdue&&E.intervalDays>0&&E.intervalDays<=7),long:S.filter(E=>!E.overdue&&E.intervalDays>7),inactive:S.filter(E=>E.repetitions===0&&!E.overdue)}},[o,t]),h=v.useMemo(()=>t.filter(S=>S.type==="section"&&(S.world??"study")==="study").sort((S,E)=>S.orderIdx-E.orderIdx).map(S=>({section:S,lessons:t.filter(E=>E.parentId===S.id&&E.type==="lesson").sort((E,w)=>E.orderIdx-w.orderIdx)})),[t]),f=v.useMemo(()=>{const T=new Map;for(const S of(r==null?void 0:r.sections)??[])T.set(S.sectionId,S.avgMastery);return T},[r]),d=v.useMemo(()=>t.filter(T=>{var E;const S=(E=s[T.id])==null?void 0:E.status;return T.type==="lesson"&&(T.world??"study")==="study"&&(S==="in_progress"||S==="mastered")}),[t,s]),[m,b]=v.useState(new Set),g=T=>b(S=>{const E=new Set(S);return E.has(T)?E.delete(T):E.add(T),E}),y=T=>{const S=u.get(T);return S?S.overdue?{color:"bg-review",title:i("review.quadrant.overdue")}:S.intervalDays>0&&S.intervalDays<=7?{color:"bg-gold",title:i("review.quadrant.short")}:S.intervalDays>7?{color:"bg-brand",title:i("review.quadrant.long")}:null:null},k=c.overdue.length>0;return p.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end","data-testid":"review-drawer",children:[p.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:e}),p.jsxs("div",{ref:a,role:"dialog","aria-modal":"true","aria-label":i("review.title"),className:"relative w-full max-w-md h-full bg-surface-0 border-l border-[var(--border)] shadow-elevated flex flex-col",children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)] shrink-0",children:[p.jsxs("h2",{className:"text-body font-bold flex items-center gap-1.5",children:[p.jsx(nn,{className:"w-4 h-4","aria-hidden":"true"})," ",i("review.title")]}),p.jsx("button",{onClick:e,"data-testid":"review-close","aria-label":i("action.close"),className:"text-ink-muted hover:text-ink-strong w-8 h-8 flex items-center justify-center rounded-lg hover:bg-surface-3",children:"✕"})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-5","data-testid":"review-panel",children:[d.length>0&&p.jsxs("button",{onClick:()=>{const T=d[Math.floor(Math.random()*d.length)];T&&n(T.id)},"data-testid":"review-interleave",className:"btn-3d-neutral w-full py-2.5 text-body flex items-center justify-center gap-1.5",children:[p.jsx(Hx,{className:"w-4 h-4"}),i("review.interleave")]}),o.length>0&&p.jsxs("div",{children:[p.jsx("div",{className:"text-caption font-bold text-ink-muted uppercase tracking-wider mb-2",children:i("review.srsHint")}),p.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:[{items:c.overdue,label:i("review.quadrant.overdue"),dot:"bg-review"},{items:c.short,label:i("review.quadrant.short"),dot:"bg-gold"},{items:c.long,label:i("review.quadrant.long"),dot:"bg-brand"},{items:c.inactive,label:i("review.quadrant.inactive"),dot:"bg-ink-faint"}].filter(T=>T.items.length>0).map(T=>p.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 rounded-full bg-surface-3",children:[p.jsx("span",{className:`w-2 h-2 rounded-full ${T.dot}`}),p.jsx("span",{className:"text-label text-ink-muted",children:T.label}),p.jsx("span",{className:"text-label font-extrabold text-ink-strong tabular-nums",children:T.items.length})]},T.label))}),k&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"text-label text-ink-faint mb-1.5",children:i("review.overdueQuickHint")}),p.jsx("div",{className:"flex flex-wrap gap-1.5",children:c.overdue.slice(0,8).map(T=>{const S=t.find(E=>E.id===T.nodeId);return S?p.jsx("button",{onClick:()=>n(T.nodeId),"data-testid":`review-overdue-${T.nodeId.slice(0,8)}`,className:"px-2 py-1 rounded-full bg-review/10 ring-1 ring-review/20 text-label text-review font-bold hover:bg-review/20 transition-colors truncate max-w-[140px]",children:S.title},T.nodeId):null})})]})]}),h.length>0&&p.jsxs("div",{children:[p.jsx("div",{className:"text-caption font-bold text-ink-muted uppercase tracking-wider mb-2",children:i("review.myProgress")}),p.jsx("div",{className:"space-y-1",children:h.map(({section:T,lessons:S})=>{const E=Math.round((f.get(T.id)??0)*100),w=m.has(T.id),_=S.filter(A=>{var C;const N=(C=s[A.id])==null?void 0:C.status;return N==="in_progress"||N==="mastered"});return p.jsxs("div",{children:[p.jsxs("button",{onClick:()=>g(T.id),className:"w-full flex items-center gap-2 p-2 rounded-lg hover:bg-surface-3 transition-colors",children:[w?p.jsx(ca,{className:"w-3.5 h-3.5 text-ink-muted shrink-0"}):p.jsx(dx,{className:"w-3.5 h-3.5 text-ink-muted shrink-0"}),p.jsx("span",{className:"text-body text-ink-strong font-bold truncate flex-1 text-left",children:T.title}),_.length>0&&p.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[p.jsx("div",{className:"w-16 h-1.5 bg-surface-3 rounded-full overflow-hidden",children:p.jsx("div",{className:`h-full rounded-full ${E>=100?"bg-gold":"bg-brand"}`,style:{width:`${Math.max(3,E)}%`}})}),p.jsxs("span",{className:"text-label tabular-nums text-ink-muted w-8 text-right",children:[E,"%"]})]})]}),w&&p.jsx("div",{className:"ml-5 mt-0.5 mb-1 space-y-0.5","data-testid":"review-lesson-list",children:S.length===0?p.jsx("div",{className:"text-label text-ink-faint py-1.5 pl-1",children:"—"}):S.map(A=>{const N=s[A.id],C=N?Math.round((N.mastery??0)*100):null,L=y(A.id),M=(N==null?void 0:N.status)==="in_progress"||(N==null?void 0:N.status)==="mastered";return p.jsxs("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors ${(L==null?void 0:L.color)==="bg-review"?"bg-review/8":"hover:bg-surface-3"}`,children:[L?p.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${L.color} shrink-0`,title:L.title}):p.jsx("span",{className:"w-1.5 h-1.5 shrink-0"}),p.jsx("span",{className:`text-label truncate flex-1 ${M?"text-ink-strong":"text-ink-faint"}`,children:A.title}),C!==null&&p.jsxs("span",{className:"text-label tabular-nums text-ink-muted shrink-0 w-8 text-right",children:[C,"%"]}),M&&p.jsx("button",{onClick:()=>n(A.id),"data-testid":`review-lesson-${A.id.slice(0,8)}`,className:"shrink-0 px-2 py-0.5 rounded-md bg-brand/15 text-brand text-caption font-bold hover:bg-brand/25 transition-colors",children:i("review.reviewLesson")})]},A.id)})})]},T.id)})})]}),r&&r.frictionByNode.length>0&&p.jsxs("div",{children:[p.jsx("div",{className:"text-caption font-bold text-review uppercase tracking-wider mb-1.5",children:i("dashboard.mini.struggle")}),r.frictionByNode.map(T=>p.jsxs("button",{onClick:()=>n(T.nodeId),className:"flex items-center gap-2 py-0.5 w-full text-left hover:bg-surface-3 rounded px-1",children:[p.jsxs("span",{className:"text-label text-review font-bold tabular-nums",children:[T.count,"×"]}),p.jsx("span",{className:"text-label text-ink-strong truncate flex-1",children:T.title})]},T.nodeId))]}),d.length===0&&o.length===0&&h.length===0&&p.jsxs("div",{className:"text-center py-16","data-testid":"review-empty",children:[p.jsx("div",{className:"text-4xl mb-3 opacity-30",children:"📖"}),p.jsx("div",{className:"text-body text-ink-muted",children:i("review.empty.title")}),p.jsx("div",{className:"text-label text-ink-faint mt-1",children:i("review.empty.desc")})]})]})]})]})}function eM({message:e,onClose:t}){const n=Ye();return p.jsxs("div",{role:"alert","data-testid":"error-banner",className:"px-4 py-2 border-b border-warning-tint-border text-warning text-body flex items-center justify-between",style:{backgroundColor:"var(--warning-tint)"},children:[p.jsxs("span",{children:["⚠️ ",e]}),p.jsx("button",{className:"ml-3 underline text-warning-light",onClick:t,children:n("action.close")})]})}function tM({streak:e}){const t=Ye();return p.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-full border border-review/20",style:{backgroundColor:"var(--review-tint)"},"data-testid":"streak-badge",title:t("streak.title",{n:e.currentStreak,m:e.longestStreak}),children:[p.jsx(da,{className:"w-4 h-4 text-review flame-flicker"}),p.jsx("span",{className:"text-body font-extrabold text-review",children:e.currentStreak}),e.freezeCount>0&&p.jsxs("span",{className:"flex items-center gap-0.5 ml-0.5","data-testid":"freeze-badge",title:t("streak.freeze.title",{n:e.freezeCount}),children:[p.jsx(jx,{className:"w-3 h-3 text-review/80","aria-hidden":"true"}),p.jsx("span",{className:"text-label font-bold text-review/80",children:e.freezeCount})]})]})}window.addEventListener("error",e=>{var t;console.error("[FATAL renderer error]",((t=e.error)==null?void 0:t.stack)||e.message)});window.addEventListener("unhandledrejection",e=>{var t;console.error("[FATAL unhandled rejection]",((t=e.reason)==null?void 0:t.stack)||e.reason)});function nM({rejected:e}){const t=navigator.language.startsWith("zh"),[n,r]=Kl.useState(""),s=i=>{i.preventDefault();const a=n.trim();if(!a)return;const o=a.includes("token=")?new URL(a).searchParams.get("token")??"":a;o&&Ae(async()=>{const{setWebToken:l}=await import("./api-web-ChIPnpHO.js");return{setWebToken:l}},[],import.meta.url).then(({setWebToken:l})=>l(o))};return p.jsx("div",{className:"min-h-[var(--app-height,100vh)] bg-[#0e2a12] flex items-center justify-center p-6",children:p.jsxs("form",{onSubmit:s,className:"w-full max-w-sm text-center",children:[p.jsx("div",{className:"text-4xl mb-3",children:"🎈"}),p.jsx("h1",{className:"text-title font-bold text-white mb-1",children:"LookatStudy"}),p.jsx("p",{className:"text-label text-white/55 leading-relaxed mb-5",children:t?"连接本机学习服务:粘贴启动时打印的令牌或整条链接":"Connect to your study server — paste the token or the full link printed at startup"}),e&&p.jsx("p",{className:"text-label text-warning-light mb-3",children:t?"上次的令牌被拒绝了,请重新输入":"Previous token was rejected, please re-enter"}),p.jsx("input",{type:"text",value:n,onChange:i=>r(i.target.value),placeholder:t?"访问令牌":"access token",autoFocus:!0,className:"w-full bg-black/30 text-white placeholder:text-white/30 text-body font-mono rounded-lg px-3 py-2.5 border border-white/20 focus:border-brand focus:outline-none transition-colors mb-3"}),p.jsx("button",{type:"submit",disabled:!n.trim(),className:"btn-3d-brand w-full px-3 py-2.5 text-body disabled:opacity-40",children:t?"连接":"Connect"}),p.jsx("p",{className:"text-caption text-white/40 leading-relaxed mt-5",children:t?"令牌在服务启动日志里,形如 http://127.0.0.1:17890/?token=…,也可以直接打开那个链接。":"The token is in the server startup log, like http://127.0.0.1:17890/?token=… — opening that link directly works too."})]})})}const tb=Jb.createRoot(document.getElementById("root"));function rM(){tb.render(p.jsx(Kl.StrictMode,{children:p.jsx(D_,{children:p.jsx(KP,{})})}))}function tm(e){tb.render(p.jsx(Kl.StrictMode,{children:p.jsx(nM,{rejected:e})}))}async function iM(){const{installAppHeight:e}=await Ae(async()=>{const{installAppHeight:t}=await import("./app-height-D5bf5z0g.js");return{installAppHeight:t}},[],import.meta.url);if(e(),!window.api){const t=await Ae(()=>import("./api-web-ChIPnpHO.js"),[],import.meta.url);if(window.addEventListener(t.TOKEN_REJECTED_EVENT,()=>tm(!0)),!t.hasWebToken()){tm(!1);return}try{await t.installWebApi()}catch(n){console.error("[boot] web api 安装失败:",n)}}rM()}iM();export{oM as $,Xl as A,nn as B,Zl as C,Zn as D,IS as E,Fi as F,lm as G,NS as H,Ta as I,xp as J,PT as K,dm as L,mm as M,sm as N,Ws as O,mM as P,uM as Q,dM as R,Hx as S,Vx as T,Kx as U,sh as V,Tm as W,In as X,ih as Y,xm as Z,Ae as _,se as a,lM as a0,hm as a1,zx as a2,hM as a3,mx as a4,Mx as a5,l2 as a6,Mn as a7,ba as a8,Om as a9,qm as aa,wd as ab,Sp as ac,Hi as ad,$S as ae,fa as b,he as c,Bx as d,Cs as e,fm as f,ha as g,Cu as h,wo as i,zs as j,Ql as k,cx as l,Cm as m,So as n,ym as o,hx as p,En as q,bm as r,fM as s,cM as t,Ye as u,nw as v,qe as w,_e as x,wm as y,eu as z};