@ensocode/server 0.3.10 → 0.3.12

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 (186) hide show
  1. package/LICENSE +679 -19
  2. package/out/phone/assets/{abnfDiagram-VCTEODGH-DEIRKSmB.js → abnfDiagram-VCTEODGH-D-9apHOZ.js} +1 -1
  3. package/out/phone/assets/architecture-7GRP2DOG-ihVIDRRt.js +1 -0
  4. package/out/phone/assets/{architectureDiagram-5GKGNRK7-CFZiReTQ.js → architectureDiagram-5GKGNRK7-B7ti5Yuy.js} +1 -1
  5. package/out/phone/assets/{blockDiagram-I7D4REHJ-CIBal5Ke.js → blockDiagram-I7D4REHJ-CMg6PHJB.js} +1 -1
  6. package/out/phone/assets/{c4Diagram-7LVT6UL2-Ce7SCOHL.js → c4Diagram-7LVT6UL2-YtDbC01g.js} +1 -1
  7. package/out/phone/assets/channel-BQsoblXW.js +1 -0
  8. package/out/phone/assets/{chunk-4HAMMTFA-COlQ1_VX.js → chunk-4HAMMTFA-Djg6ctlZ.js} +1 -1
  9. package/out/phone/assets/{chunk-75Z2AOVW-L2CSsdYQ.js → chunk-75Z2AOVW-Be2kq0FP.js} +1 -1
  10. package/out/phone/assets/{chunk-DU6HZSFF-juQC0nTX.js → chunk-DU6HZSFF-d5JZiOMy.js} +1 -1
  11. package/out/phone/assets/{chunk-F27PBJKO-CUQNf9_G.js → chunk-F27PBJKO-DHBQ6nrV.js} +1 -1
  12. package/out/phone/assets/{chunk-GMAD6QVW-BzsNlUWy.js → chunk-GMAD6QVW-BatU6uXC.js} +1 -1
  13. package/out/phone/assets/{chunk-GVQU2GXP-a7Sg14KC.js → chunk-GVQU2GXP-CiyvoRIy.js} +1 -1
  14. package/out/phone/assets/{chunk-IMKFNOWR-B86isBFr.js → chunk-IMKFNOWR-vOQaK90i.js} +1 -1
  15. package/out/phone/assets/{chunk-L3NEJ4N5-D9GQEj7C.js → chunk-L3NEJ4N5-CPykFzBy.js} +1 -1
  16. package/out/phone/assets/{chunk-OSK3NFVY-ZHLE_p8D.js → chunk-OSK3NFVY-q4NiGH59.js} +1 -1
  17. package/out/phone/assets/{chunk-P2QGCYS3-CIqiw4vs.js → chunk-P2QGCYS3-DUV9S_qP.js} +1 -1
  18. package/out/phone/assets/{chunk-POPQ4Y6H-pTX0vZo7.js → chunk-POPQ4Y6H-CjycswNE.js} +1 -1
  19. package/out/phone/assets/{chunk-PWAF6VOD-BXK9ou77.js → chunk-PWAF6VOD-Dben6plA.js} +1 -1
  20. package/out/phone/assets/{chunk-SHT3W25Y-BLZNPdt8.js → chunk-SHT3W25Y-D2hK_jmb.js} +1 -1
  21. package/out/phone/assets/{chunk-SVP7TREG-wR8iPcjt.js → chunk-SVP7TREG-DLtgLN89.js} +1 -1
  22. package/out/phone/assets/{chunk-TICWLB2K-CueyYenv.js → chunk-TICWLB2K-BeBB0_0w.js} +1 -1
  23. package/out/phone/assets/classDiagram-ZZMXUADV-rwnxFDXp.js +1 -0
  24. package/out/phone/assets/classDiagram-v2-VYDZK3BY-rwnxFDXp.js +1 -0
  25. package/out/phone/assets/{cynefin-OW5HDTMX-LV70kdIp.js → cynefin-OW5HDTMX-CsDdLZPP.js} +1 -1
  26. package/out/phone/assets/{cynefinDiagram-5FMLGOSQ-jSFJ3Ff1.js → cynefinDiagram-5FMLGOSQ-BcaPty-s.js} +1 -1
  27. package/out/phone/assets/{dagre-GXQ25YYZ-DnmK3Igj.js → dagre-GXQ25YYZ-o7dqm5ri.js} +1 -1
  28. package/out/phone/assets/desk-DNf6lCoq.js +2 -0
  29. package/out/phone/assets/{diagram-S7CK7UJ4-KdmyjPOb.js → diagram-S7CK7UJ4-B5m8q3yP.js} +1 -1
  30. package/out/phone/assets/{diagram-UQ7AKVKN-D1D-C9ty.js → diagram-UQ7AKVKN-_lP617OW.js} +1 -1
  31. package/out/phone/assets/{diagram-VSXAHHWV-CO_oZjy2.js → diagram-VSXAHHWV-D16twHR0.js} +1 -1
  32. package/out/phone/assets/{diagram-VX7I27RA-VLBWCwXT.js → diagram-VX7I27RA-BT8YSil1.js} +1 -1
  33. package/out/phone/assets/{diagram-Z3DM3KII-wXmAYt0S.js → diagram-Z3DM3KII-CiSuhrxd.js} +1 -1
  34. package/out/phone/assets/{ebnfDiagram-PWID7BFC-COmreC4F.js → ebnfDiagram-PWID7BFC-BbCXn4HA.js} +1 -1
  35. package/out/phone/assets/{erDiagram-RLTQ6QDP-YD40E3kV.js → erDiagram-RLTQ6QDP-5-xE_bP2.js} +1 -1
  36. package/out/phone/assets/eventmodeling-NTZA5JFV-BVS2RGt-.js +1 -0
  37. package/out/phone/assets/flowDiagram-HODETNUW-BSlxj9Uk.js +1 -0
  38. package/out/phone/assets/{ganttDiagram-EL5Y4UJY-CC0eW0wn.js → ganttDiagram-EL5Y4UJY-Rqgggqg_.js} +1 -1
  39. package/out/phone/assets/{gitGraph-4MIJSDKK-BpKZk8Hu.js → gitGraph-4MIJSDKK-Drt18ZKK.js} +1 -1
  40. package/out/phone/assets/{gitGraphDiagram-WWUBYQGX-BCK9rLLJ.js → gitGraphDiagram-WWUBYQGX-BQ5y4d2H.js} +1 -1
  41. package/out/phone/assets/{info-A6RAGUB7-BKUEMrSk.js → info-A6RAGUB7-CpPeSHE0.js} +1 -1
  42. package/out/phone/assets/{infoDiagram-27XIBGKW-6kVlxml9.js → infoDiagram-27XIBGKW-D3d9S0Y6.js} +1 -1
  43. package/out/phone/assets/{ishikawaDiagram-5VMMS53U-36KijlM2.js → ishikawaDiagram-5VMMS53U-plFMqx62.js} +1 -1
  44. package/out/phone/assets/{journeyDiagram-3NMN7TZE-B3r6-igU.js → journeyDiagram-3NMN7TZE-CX-n-XXx.js} +1 -1
  45. package/out/phone/assets/{kanban-definition-UXKFOSKX-DDJMJ3eD.js → kanban-definition-UXKFOSKX-DrdTzKIc.js} +1 -1
  46. package/out/phone/assets/{line-CRvTNHUs.js → line-CqyaArNm.js} +1 -1
  47. package/out/phone/assets/main-BGlFv7yA.js +1658 -0
  48. package/out/phone/assets/main-BS1SSCau.css +1 -0
  49. package/out/phone/assets/{mermaid-parser.core-vpmsl7OW.js → mermaid-parser.core-CERMa6fg.js} +3 -3
  50. package/out/phone/assets/{mermaid.core-P6wqHn79.js → mermaid.core-CbGP2wFn.js} +4 -4
  51. package/out/phone/assets/{mindmap-definition-YA3MSWOX-C1Qj4NCg.js → mindmap-definition-YA3MSWOX-BxaIrov6.js} +1 -1
  52. package/out/phone/assets/{packet-AYTQ26CC-dPa_bCkN.js → packet-AYTQ26CC-DguFQxPm.js} +1 -1
  53. package/out/phone/assets/{pegDiagram-XKGWAZYB-DP29zlwD.js → pegDiagram-XKGWAZYB-t3td03dz.js} +1 -1
  54. package/out/phone/assets/{pie-WAS4IAKB-B7gaGnZC.js → pie-WAS4IAKB-DoFu2rhu.js} +1 -1
  55. package/out/phone/assets/{pieDiagram-E7YTZNPT-BIv_DaLU.js → pieDiagram-E7YTZNPT-DctHLSL8.js} +1 -1
  56. package/out/phone/assets/{quadrantDiagram-AXDQQJYC-BRD0SxVe.js → quadrantDiagram-AXDQQJYC-Br7-ImNr.js} +1 -1
  57. package/out/phone/assets/{radar-RG4KPBEZ-DSXX0eGO.js → radar-RG4KPBEZ-BDjTOHD8.js} +1 -1
  58. package/out/phone/assets/{railroad-74A4TZTK-CyBIlVYV.js → railroad-74A4TZTK-v8vsrpxb.js} +1 -1
  59. package/out/phone/assets/railroad-abnf-HS5TGJTU-CUELjEtC.js +1 -0
  60. package/out/phone/assets/railroad-ebnf-LZEXJU2U-DdIokM4i.js +1 -0
  61. package/out/phone/assets/railroad-peg-WCYAUIDC-DYyy0B-_.js +1 -0
  62. package/out/phone/assets/{railroadDiagram-O6MQD6OU-DqLjIO9E.js → railroadDiagram-O6MQD6OU-DtH4qQrr.js} +1 -1
  63. package/out/phone/assets/{requirementDiagram-BXWQKSXE-DXMysPAW.js → requirementDiagram-BXWQKSXE-BSqejjZP.js} +1 -1
  64. package/out/phone/assets/{sankeyDiagram-P5KCCOFB-CvbRufzx.js → sankeyDiagram-P5KCCOFB-DsTWuNtL.js} +1 -1
  65. package/out/phone/assets/{sequenceDiagram-WJ2MYXX4-CFMJYkK9.js → sequenceDiagram-WJ2MYXX4-zLMvPyPC.js} +1 -1
  66. package/out/phone/assets/{stateDiagram-D77RDMKH-C--GDYGR.js → stateDiagram-D77RDMKH-DrBC05BN.js} +1 -1
  67. package/out/phone/assets/stateDiagram-v2-MP3YSRHH-DT7BlwvF.js +1 -0
  68. package/out/phone/assets/storage-BeJvYXAx.js +36 -0
  69. package/out/phone/assets/{swimlanes-42K2YHIH-C_L9ypxQ.js → swimlanes-42K2YHIH-B27-qSm5.js} +1 -1
  70. package/out/phone/assets/swimlanesDiagram-VR7AAH4N-CWnm4v0A.js +8 -0
  71. package/out/phone/assets/{timeline-definition-24CTP7MA-BEk-ED-p.js → timeline-definition-24CTP7MA-8NDkGf5U.js} +1 -1
  72. package/out/phone/assets/{treeView-Q6P3EWNA-rolWZTr4.js → treeView-Q6P3EWNA-B9BXwCDC.js} +1 -1
  73. package/out/phone/assets/{treemap-WGGIJYW6-CPWEaY39.js → treemap-WGGIJYW6-B0IqbwdT.js} +1 -1
  74. package/out/phone/assets/{vennDiagram-4TSXK5OY-CqImR0EN.js → vennDiagram-4TSXK5OY-Dp-aKgNa.js} +1 -1
  75. package/out/phone/assets/{wardley-WFR3VGLG-CvTGA92O.js → wardley-WFR3VGLG-B7FlADZf.js} +1 -1
  76. package/out/phone/assets/{wardleyDiagram-VM6X3IG4-D9eDqbbx.js → wardleyDiagram-VM6X3IG4-BVntjQNl.js} +1 -1
  77. package/out/phone/assets/{xychartDiagram-S5SC5T6Z-DSenC7kX.js → xychartDiagram-S5SC5T6Z-kgVJvkgO.js} +1 -1
  78. package/out/phone/desk.html +2 -2
  79. package/out/phone/index.html +3 -3
  80. package/out/renderer/assets/{abnfDiagram-VCTEODGH-D81xzDT1.js → abnfDiagram-VCTEODGH-Bp0r3dKm.js} +1 -1
  81. package/out/renderer/assets/{arc-ByHjKist.js → arc-BD5HnhIt.js} +1 -1
  82. package/out/renderer/assets/{architectureDiagram-5GKGNRK7-Bw7RgtuP.js → architectureDiagram-5GKGNRK7-CgJHjETB.js} +1 -1
  83. package/out/renderer/assets/{blockDiagram-I7D4REHJ-nNM7I115.js → blockDiagram-I7D4REHJ-5le9vk4G.js} +1 -1
  84. package/out/renderer/assets/{c4Diagram-7LVT6UL2-xixXJMhC.js → c4Diagram-7LVT6UL2-B4DCe-qN.js} +1 -1
  85. package/out/renderer/assets/channel-D-HltTAP.js +1 -0
  86. package/out/renderer/assets/{chunk-2Q5K7J3B-C0KzftkI.js → chunk-2Q5K7J3B-DIxWfJHE.js} +1 -1
  87. package/out/renderer/assets/{chunk-5VM5RSS4-CuqKTpNC.js → chunk-5VM5RSS4-D9j4om1l.js} +1 -1
  88. package/out/renderer/assets/{chunk-F27PBJKO-DyZs2_AC.js → chunk-F27PBJKO-B_tGbKyc.js} +1 -1
  89. package/out/renderer/assets/{chunk-IMKFNOWR-C7ktAo0J.js → chunk-IMKFNOWR-Cfffd1p9.js} +1 -1
  90. package/out/renderer/assets/{chunk-JWPE2WC7-CZpmOwpA.js → chunk-JWPE2WC7-BABZOPGb.js} +1 -1
  91. package/out/renderer/assets/{chunk-POPQ4Y6H-CVFNZRTi.js → chunk-POPQ4Y6H-D-QyVpSn.js} +1 -1
  92. package/out/renderer/assets/{chunk-SVP7TREG-DhMMCFNi.js → chunk-SVP7TREG-BghyPSd6.js} +1 -1
  93. package/out/renderer/assets/{chunk-TICWLB2K-BsceTDhj.js → chunk-TICWLB2K-CQmthy6z.js} +1 -1
  94. package/out/renderer/assets/{chunk-XXDRQBXY-C_grf3wS.js → chunk-XXDRQBXY-CDKsbyR7.js} +1 -1
  95. package/out/renderer/assets/classDiagram-ZZMXUADV-BCWhgMul.js +1 -0
  96. package/out/renderer/assets/classDiagram-v2-VYDZK3BY-BCWhgMul.js +1 -0
  97. package/out/renderer/assets/{cose-bilkent-JH36ORCC-wUQVmxx_.js → cose-bilkent-JH36ORCC-oajViFnN.js} +1 -1
  98. package/out/renderer/assets/{cynefin-OW5HDTMX-BR546Wt2.js → cynefin-OW5HDTMX-DMH1CUmI.js} +1 -1
  99. package/out/renderer/assets/{cynefinDiagram-5FMLGOSQ-Dp2jJhbH.js → cynefinDiagram-5FMLGOSQ-DVUJf9t0.js} +1 -1
  100. package/out/renderer/assets/{cytoscape-fcose-BJkAlKB8.js → cytoscape-fcose-adTZ191M.js} +1 -1
  101. package/out/renderer/assets/{dagre-GXQ25YYZ-XKFl5kxK.js → dagre-GXQ25YYZ-BXRWWNje.js} +1 -1
  102. package/out/renderer/assets/{diagram-S7CK7UJ4-BBFt2zKx.js → diagram-S7CK7UJ4-Dg7f2Dan.js} +1 -1
  103. package/out/renderer/assets/{diagram-UQ7AKVKN-DA2CgkM2.js → diagram-UQ7AKVKN-DsLRyZAt.js} +1 -1
  104. package/out/renderer/assets/{diagram-VSXAHHWV-BL96nDcT.js → diagram-VSXAHHWV-3_LoodSS.js} +1 -1
  105. package/out/renderer/assets/{diagram-VX7I27RA-BYbjhI9j.js → diagram-VX7I27RA-DQeZp2Cz.js} +1 -1
  106. package/out/renderer/assets/{diagram-Z3DM3KII-BShKaR0Y.js → diagram-Z3DM3KII-Dwil6g5m.js} +1 -1
  107. package/out/renderer/assets/{ebnfDiagram-PWID7BFC-CxCXjhNE.js → ebnfDiagram-PWID7BFC-DecVNxpu.js} +1 -1
  108. package/out/renderer/assets/{erDiagram-RLTQ6QDP-D6a85aJz.js → erDiagram-RLTQ6QDP-D2rmo2nP.js} +1 -1
  109. package/out/renderer/assets/{flowDiagram-HODETNUW-D7vxYWv_.js → flowDiagram-HODETNUW-_SF2dRBl.js} +1 -1
  110. package/out/renderer/assets/{ganttDiagram-EL5Y4UJY-D4bniC42.js → ganttDiagram-EL5Y4UJY-BoYWs5Ev.js} +1 -1
  111. package/out/renderer/assets/{gitGraphDiagram-WWUBYQGX-DREOVv8G.js → gitGraphDiagram-WWUBYQGX-BqRbZ3V0.js} +1 -1
  112. package/out/renderer/assets/globals-BEwCf508.css +1 -0
  113. package/out/renderer/assets/globals-C3zxoqqH.js +2603 -0
  114. package/out/renderer/assets/index-9vqh4wxi.js +133 -0
  115. package/out/renderer/assets/{infoDiagram-27XIBGKW-iQi9WT0H.js → infoDiagram-27XIBGKW-CFt6xyuD.js} +1 -1
  116. package/out/renderer/assets/{ishikawaDiagram-5VMMS53U-CqPXH73H.js → ishikawaDiagram-5VMMS53U-CZB8G4dD.js} +1 -1
  117. package/out/renderer/assets/{journeyDiagram-3NMN7TZE-DjEyHtge.js → journeyDiagram-3NMN7TZE-CO2VRmpx.js} +1 -1
  118. package/out/renderer/assets/{kanban-definition-UXKFOSKX-D-bxhvRO.js → kanban-definition-UXKFOSKX-DIqEnfMM.js} +1 -1
  119. package/out/renderer/assets/{layout-O4Dt9JSp.js → layout-DXRKfO_Y.js} +1 -1
  120. package/out/renderer/assets/{linear-B3fSR3zo.js → linear-Cdx1AdZJ.js} +1 -1
  121. package/out/renderer/assets/{mermaid.core-DKfKek0K.js → mermaid.core-DuIO2jsm.js} +5 -5
  122. package/out/renderer/assets/{mindmap-definition-YA3MSWOX-CgWelgTn.js → mindmap-definition-YA3MSWOX-B5lvxG2M.js} +1 -1
  123. package/out/renderer/assets/{pegDiagram-XKGWAZYB-6YROVnYK.js → pegDiagram-XKGWAZYB-DCwHp-K3.js} +1 -1
  124. package/out/renderer/assets/{pieDiagram-E7YTZNPT-BboI-zql.js → pieDiagram-E7YTZNPT-Dq048Wh7.js} +1 -1
  125. package/out/renderer/assets/{quadrantDiagram-AXDQQJYC-Ckl9-8_q.js → quadrantDiagram-AXDQQJYC-DwkFkAi_.js} +1 -1
  126. package/out/renderer/assets/{railroadDiagram-O6MQD6OU-CBmldUiO.js → railroadDiagram-O6MQD6OU-2NKvwLP-.js} +1 -1
  127. package/out/renderer/assets/{requirementDiagram-BXWQKSXE-BhCPsXeE.js → requirementDiagram-BXWQKSXE-Bp44tNQ0.js} +1 -1
  128. package/out/renderer/assets/{sankeyDiagram-P5KCCOFB-KCriZNRW.js → sankeyDiagram-P5KCCOFB-C3TFp1NK.js} +1 -1
  129. package/out/renderer/assets/{sequenceDiagram-WJ2MYXX4-BZRpmnqw.js → sequenceDiagram-WJ2MYXX4-BTPoYQeW.js} +1 -1
  130. package/out/renderer/assets/settings-DlDHkOe2.js +25 -0
  131. package/out/renderer/assets/{sizeCapture-INFHLROL-BHJ5WHSf.js → sizeCapture-INFHLROL-DvNj5TDT.js} +1 -1
  132. package/out/renderer/assets/{stateDiagram-D77RDMKH-DxHudD45.js → stateDiagram-D77RDMKH-DC8YykNp.js} +1 -1
  133. package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-B4rCEEYH.js +1 -0
  134. package/out/renderer/assets/{swimlanes-42K2YHIH-D2ZZdZPU.js → swimlanes-42K2YHIH-0yL1nNkg.js} +1 -1
  135. package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-zQqW8MJ5.js +8 -0
  136. package/out/renderer/assets/{timeline-definition-24CTP7MA-D4FtI5C_.js → timeline-definition-24CTP7MA-Pg-2roGv.js} +1 -1
  137. package/out/renderer/assets/{vennDiagram-4TSXK5OY-BVq6hKjH.js → vennDiagram-4TSXK5OY-D0af5K4E.js} +1 -1
  138. package/out/renderer/assets/{wardleyDiagram-VM6X3IG4-39qPSeSF.js → wardleyDiagram-VM6X3IG4-CB_nIy_l.js} +1 -1
  139. package/out/renderer/assets/{xychartDiagram-S5SC5T6Z-IjWUG31x.js → xychartDiagram-S5SC5T6Z-A26Yld8R.js} +1 -1
  140. package/out/renderer/index.html +3 -3
  141. package/out/renderer/settings.html +4 -4
  142. package/out/renderer/web-preload.js +36 -36
  143. package/out/server/agent.js +276 -506
  144. package/out/server/chunks/{agent-BbLTL3oo.js → agent-D33nI7fP.js} +176 -195
  145. package/out/server/chunks/dispatchModel-CsfmL396.js +20 -0
  146. package/out/server/chunks/gpuBackendInstall-CRzfB150.js +237 -0
  147. package/out/server/chunks/{loadProvider-BOW5-6B-.js → loadProvider-4Y15KP7W.js} +2 -2
  148. package/out/server/chunks/{manifest-DjsZzZuh.js → manifest-wlfh-NN5.js} +2 -2
  149. package/out/server/chunks/{resources-DmaKIeBc.js → resources-DzUshg1j.js} +3 -3
  150. package/out/server/chunks/{storageScanWorker-BQ1LXUu7.js → storageScanWorker-CX8O_DlF.js} +2 -2
  151. package/out/server/chunks/{storageScanWorker-Bebego8l.js → storageScanWorker-CuttDIGS.js} +2 -2
  152. package/out/server/chunks/{workflowPresets-BtFDIu9c.js → workflowPresets-CAA0AY6f.js} +1091 -287
  153. package/out/server/index.js +2405 -3362
  154. package/out/server/plugin-host.js +2 -2
  155. package/package.json +2 -3
  156. package/out/phone/assets/architecture-7GRP2DOG-BQkxfRkk.js +0 -1
  157. package/out/phone/assets/channel-DGPU3seL.js +0 -1
  158. package/out/phone/assets/classDiagram-ZZMXUADV-DgtztyWS.js +0 -1
  159. package/out/phone/assets/classDiagram-v2-VYDZK3BY-DgtztyWS.js +0 -1
  160. package/out/phone/assets/desk-BLXfa62y.js +0 -2
  161. package/out/phone/assets/eventmodeling-NTZA5JFV-DdkbB0R7.js +0 -1
  162. package/out/phone/assets/flowDiagram-HODETNUW-B86UG3OY.js +0 -1
  163. package/out/phone/assets/main-BU1pbfVw.css +0 -1
  164. package/out/phone/assets/main-C650ZDk2.js +0 -1658
  165. package/out/phone/assets/railroad-abnf-HS5TGJTU-Ea30PClf.js +0 -1
  166. package/out/phone/assets/railroad-ebnf-LZEXJU2U-BAOLVW4i.js +0 -1
  167. package/out/phone/assets/railroad-peg-WCYAUIDC-DiLa9rTe.js +0 -1
  168. package/out/phone/assets/stateDiagram-v2-MP3YSRHH-C87lzpXA.js +0 -1
  169. package/out/phone/assets/storage-dUWOZ2xo.js +0 -36
  170. package/out/phone/assets/swimlanesDiagram-VR7AAH4N-CPaJpMYE.js +0 -8
  171. package/out/renderer/assets/channel-C9jBFK-_.js +0 -1
  172. package/out/renderer/assets/classDiagram-ZZMXUADV-B_o-oRUo.js +0 -1
  173. package/out/renderer/assets/classDiagram-v2-VYDZK3BY-B_o-oRUo.js +0 -1
  174. package/out/renderer/assets/globals-1URrQWJU.js +0 -2603
  175. package/out/renderer/assets/globals-DoPyZAQo.css +0 -1
  176. package/out/renderer/assets/index-8xDwl1RO.js +0 -133
  177. package/out/renderer/assets/settings-DbHps6fb.js +0 -27
  178. package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-C0JE59RO.js +0 -1
  179. package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-DJJObg42.js +0 -8
  180. package/out/server/chunks/engine-IZbRceya.js +0 -70
  181. package/out/server/chunks/engineWorker-CQxNRdLD.js +0 -6
  182. package/out/server/chunks/engineWorker-CrUIcXCt.js +0 -73
  183. package/out/server/chunks/gpuBackendInstall-DdJZ_JTr.js +0 -158
  184. package/out/server/chunks/hanbao-_aDjow_f.js +0 -187
  185. package/out/server/chunks/speech-CqK6_tIR.js +0 -25
  186. package/out/server/chunks/wetype-CR0YLhHP.js +0 -677
@@ -0,0 +1,36 @@
1
+ import{i as e,r as t,t as n}from"./rolldown-runtime-Dd_uD5pT.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var r=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),i=n(((e,t)=>{t.exports=r()})),a=n(((e,t)=>{t.exports={}})),o=e(n(((e,n)=>{(function(e){var n=function(e){var t,n=new Float64Array(16);if(e)for(t=0;t<e.length;t++)n[t]=e[t];return n},r=function(){throw Error(`no PRNG`)},i=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var s=n(),c=n([1]),l=n([56129,1]),u=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),f=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),p=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),m=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function h(e,t,n,r){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=n&255,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=r&255}function g(e,t,n,r,i){var a,o=0;for(a=0;a<i;a++)o|=e[t+a]^n[r+a];return(1&o-1>>>8)-1}function _(e,t,n,r){return g(e,t,n,r,16)}function v(e,t,n,r){return g(e,t,n,r,32)}function y(e,t,n,r){for(var i=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,a=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,o=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,s=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,c=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,l=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,u=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,d=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,f=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,p=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,m=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,h=n[16]&255|(n[17]&255)<<8|(n[18]&255)<<16|(n[19]&255)<<24,g=n[20]&255|(n[21]&255)<<8|(n[22]&255)<<16|(n[23]&255)<<24,_=n[24]&255|(n[25]&255)<<8|(n[26]&255)<<16|(n[27]&255)<<24,v=n[28]&255|(n[29]&255)<<8|(n[30]&255)<<16|(n[31]&255)<<24,y=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,b=i,x=a,S=o,C=s,w=c,T=l,E=u,D=d,O=f,k=p,A=m,j=h,M=g,N=_,P=v,F=y,I,L=0;L<20;L+=2)I=b+M|0,w^=I<<7|I>>>25,I=w+b|0,O^=I<<9|I>>>23,I=O+w|0,M^=I<<13|I>>>19,I=M+O|0,b^=I<<18|I>>>14,I=T+x|0,k^=I<<7|I>>>25,I=k+T|0,N^=I<<9|I>>>23,I=N+k|0,x^=I<<13|I>>>19,I=x+N|0,T^=I<<18|I>>>14,I=A+E|0,P^=I<<7|I>>>25,I=P+A|0,S^=I<<9|I>>>23,I=S+P|0,E^=I<<13|I>>>19,I=E+S|0,A^=I<<18|I>>>14,I=F+j|0,C^=I<<7|I>>>25,I=C+F|0,D^=I<<9|I>>>23,I=D+C|0,j^=I<<13|I>>>19,I=j+D|0,F^=I<<18|I>>>14,I=b+C|0,x^=I<<7|I>>>25,I=x+b|0,S^=I<<9|I>>>23,I=S+x|0,C^=I<<13|I>>>19,I=C+S|0,b^=I<<18|I>>>14,I=T+w|0,E^=I<<7|I>>>25,I=E+T|0,D^=I<<9|I>>>23,I=D+E|0,w^=I<<13|I>>>19,I=w+D|0,T^=I<<18|I>>>14,I=A+k|0,j^=I<<7|I>>>25,I=j+A|0,O^=I<<9|I>>>23,I=O+j|0,k^=I<<13|I>>>19,I=k+O|0,A^=I<<18|I>>>14,I=F+P|0,M^=I<<7|I>>>25,I=M+F|0,N^=I<<9|I>>>23,I=N+M|0,P^=I<<13|I>>>19,I=P+N|0,F^=I<<18|I>>>14;b=b+i|0,x=x+a|0,S=S+o|0,C=C+s|0,w=w+c|0,T=T+l|0,E=E+u|0,D=D+d|0,O=O+f|0,k=k+p|0,A=A+m|0,j=j+h|0,M=M+g|0,N=N+_|0,P=P+v|0,F=F+y|0,e[0]=b>>>0&255,e[1]=b>>>8&255,e[2]=b>>>16&255,e[3]=b>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=S>>>0&255,e[9]=S>>>8&255,e[10]=S>>>16&255,e[11]=S>>>24&255,e[12]=C>>>0&255,e[13]=C>>>8&255,e[14]=C>>>16&255,e[15]=C>>>24&255,e[16]=w>>>0&255,e[17]=w>>>8&255,e[18]=w>>>16&255,e[19]=w>>>24&255,e[20]=T>>>0&255,e[21]=T>>>8&255,e[22]=T>>>16&255,e[23]=T>>>24&255,e[24]=E>>>0&255,e[25]=E>>>8&255,e[26]=E>>>16&255,e[27]=E>>>24&255,e[28]=D>>>0&255,e[29]=D>>>8&255,e[30]=D>>>16&255,e[31]=D>>>24&255,e[32]=O>>>0&255,e[33]=O>>>8&255,e[34]=O>>>16&255,e[35]=O>>>24&255,e[36]=k>>>0&255,e[37]=k>>>8&255,e[38]=k>>>16&255,e[39]=k>>>24&255,e[40]=A>>>0&255,e[41]=A>>>8&255,e[42]=A>>>16&255,e[43]=A>>>24&255,e[44]=j>>>0&255,e[45]=j>>>8&255,e[46]=j>>>16&255,e[47]=j>>>24&255,e[48]=M>>>0&255,e[49]=M>>>8&255,e[50]=M>>>16&255,e[51]=M>>>24&255,e[52]=N>>>0&255,e[53]=N>>>8&255,e[54]=N>>>16&255,e[55]=N>>>24&255,e[56]=P>>>0&255,e[57]=P>>>8&255,e[58]=P>>>16&255,e[59]=P>>>24&255,e[60]=F>>>0&255,e[61]=F>>>8&255,e[62]=F>>>16&255,e[63]=F>>>24&255}function b(e,t,n,r){for(var i=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,a=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,o=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,s=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,c=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,l=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,u=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,d=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,f=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,p=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,m=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,h=n[16]&255|(n[17]&255)<<8|(n[18]&255)<<16|(n[19]&255)<<24,g=n[20]&255|(n[21]&255)<<8|(n[22]&255)<<16|(n[23]&255)<<24,_=n[24]&255|(n[25]&255)<<8|(n[26]&255)<<16|(n[27]&255)<<24,v=n[28]&255|(n[29]&255)<<8|(n[30]&255)<<16|(n[31]&255)<<24,y=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,b=i,x=a,S=o,C=s,w=c,T=l,E=u,D=d,O=f,k=p,A=m,j=h,M=g,N=_,P=v,F=y,I,L=0;L<20;L+=2)I=b+M|0,w^=I<<7|I>>>25,I=w+b|0,O^=I<<9|I>>>23,I=O+w|0,M^=I<<13|I>>>19,I=M+O|0,b^=I<<18|I>>>14,I=T+x|0,k^=I<<7|I>>>25,I=k+T|0,N^=I<<9|I>>>23,I=N+k|0,x^=I<<13|I>>>19,I=x+N|0,T^=I<<18|I>>>14,I=A+E|0,P^=I<<7|I>>>25,I=P+A|0,S^=I<<9|I>>>23,I=S+P|0,E^=I<<13|I>>>19,I=E+S|0,A^=I<<18|I>>>14,I=F+j|0,C^=I<<7|I>>>25,I=C+F|0,D^=I<<9|I>>>23,I=D+C|0,j^=I<<13|I>>>19,I=j+D|0,F^=I<<18|I>>>14,I=b+C|0,x^=I<<7|I>>>25,I=x+b|0,S^=I<<9|I>>>23,I=S+x|0,C^=I<<13|I>>>19,I=C+S|0,b^=I<<18|I>>>14,I=T+w|0,E^=I<<7|I>>>25,I=E+T|0,D^=I<<9|I>>>23,I=D+E|0,w^=I<<13|I>>>19,I=w+D|0,T^=I<<18|I>>>14,I=A+k|0,j^=I<<7|I>>>25,I=j+A|0,O^=I<<9|I>>>23,I=O+j|0,k^=I<<13|I>>>19,I=k+O|0,A^=I<<18|I>>>14,I=F+P|0,M^=I<<7|I>>>25,I=M+F|0,N^=I<<9|I>>>23,I=N+M|0,P^=I<<13|I>>>19,I=P+N|0,F^=I<<18|I>>>14;e[0]=b>>>0&255,e[1]=b>>>8&255,e[2]=b>>>16&255,e[3]=b>>>24&255,e[4]=T>>>0&255,e[5]=T>>>8&255,e[6]=T>>>16&255,e[7]=T>>>24&255,e[8]=A>>>0&255,e[9]=A>>>8&255,e[10]=A>>>16&255,e[11]=A>>>24&255,e[12]=F>>>0&255,e[13]=F>>>8&255,e[14]=F>>>16&255,e[15]=F>>>24&255,e[16]=E>>>0&255,e[17]=E>>>8&255,e[18]=E>>>16&255,e[19]=E>>>24&255,e[20]=D>>>0&255,e[21]=D>>>8&255,e[22]=D>>>16&255,e[23]=D>>>24&255,e[24]=O>>>0&255,e[25]=O>>>8&255,e[26]=O>>>16&255,e[27]=O>>>24&255,e[28]=k>>>0&255,e[29]=k>>>8&255,e[30]=k>>>16&255,e[31]=k>>>24&255}function x(e,t,n,r){y(e,t,n,r)}function S(e,t,n,r){b(e,t,n,r)}var C=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function w(e,t,n,r,i,a,o){var s=new Uint8Array(16),c=new Uint8Array(64),l,u;for(u=0;u<16;u++)s[u]=0;for(u=0;u<8;u++)s[u]=a[u];for(;i>=64;){for(x(c,s,o,C),u=0;u<64;u++)e[t+u]=n[r+u]^c[u];for(l=1,u=8;u<16;u++)l=l+(s[u]&255)|0,s[u]=l&255,l>>>=8;i-=64,t+=64,r+=64}if(i>0)for(x(c,s,o,C),u=0;u<i;u++)e[t+u]=n[r+u]^c[u];return 0}function T(e,t,n,r,i){var a=new Uint8Array(16),o=new Uint8Array(64),s,c;for(c=0;c<16;c++)a[c]=0;for(c=0;c<8;c++)a[c]=r[c];for(;n>=64;){for(x(o,a,i,C),c=0;c<64;c++)e[t+c]=o[c];for(s=1,c=8;c<16;c++)s=s+(a[c]&255)|0,a[c]=s&255,s>>>=8;n-=64,t+=64}if(n>0)for(x(o,a,i,C),c=0;c<n;c++)e[t+c]=o[c];return 0}function E(e,t,n,r,i){var a=new Uint8Array(32);S(a,r,i,C);for(var o=new Uint8Array(8),s=0;s<8;s++)o[s]=r[s+16];return T(e,t,n,o,a)}function D(e,t,n,r,i,a,o){var s=new Uint8Array(32);S(s,a,o,C);for(var c=new Uint8Array(8),l=0;l<8;l++)c[l]=a[l+16];return w(e,t,n,r,i,c,s)}var O=function(e){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var t=e[0]&255|(e[1]&255)<<8,n,r,i,a,o,s,c;this.r[0]=t&8191,n=e[2]&255|(e[3]&255)<<8,this.r[1]=(t>>>13|n<<3)&8191,r=e[4]&255|(e[5]&255)<<8,this.r[2]=(n>>>10|r<<6)&7939,i=e[6]&255|(e[7]&255)<<8,this.r[3]=(r>>>7|i<<9)&8191,a=e[8]&255|(e[9]&255)<<8,this.r[4]=(i>>>4|a<<12)&255,this.r[5]=a>>>1&8190,o=e[10]&255|(e[11]&255)<<8,this.r[6]=(a>>>14|o<<2)&8191,s=e[12]&255|(e[13]&255)<<8,this.r[7]=(o>>>11|s<<5)&8065,c=e[14]&255|(e[15]&255)<<8,this.r[8]=(s>>>8|c<<8)&8191,this.r[9]=c>>>5&127,this.pad[0]=e[16]&255|(e[17]&255)<<8,this.pad[1]=e[18]&255|(e[19]&255)<<8,this.pad[2]=e[20]&255|(e[21]&255)<<8,this.pad[3]=e[22]&255|(e[23]&255)<<8,this.pad[4]=e[24]&255|(e[25]&255)<<8,this.pad[5]=e[26]&255|(e[27]&255)<<8,this.pad[6]=e[28]&255|(e[29]&255)<<8,this.pad[7]=e[30]&255|(e[31]&255)<<8};O.prototype.blocks=function(e,t,n){for(var r=this.fin?0:2048,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C=this.h[0],w=this.h[1],T=this.h[2],E=this.h[3],D=this.h[4],O=this.h[5],k=this.h[6],A=this.h[7],j=this.h[8],M=this.h[9],N=this.r[0],P=this.r[1],F=this.r[2],I=this.r[3],L=this.r[4],R=this.r[5],z=this.r[6],B=this.r[7],V=this.r[8],H=this.r[9];n>=16;)i=e[t+0]&255|(e[t+1]&255)<<8,C+=i&8191,a=e[t+2]&255|(e[t+3]&255)<<8,w+=(i>>>13|a<<3)&8191,o=e[t+4]&255|(e[t+5]&255)<<8,T+=(a>>>10|o<<6)&8191,s=e[t+6]&255|(e[t+7]&255)<<8,E+=(o>>>7|s<<9)&8191,c=e[t+8]&255|(e[t+9]&255)<<8,D+=(s>>>4|c<<12)&8191,O+=c>>>1&8191,l=e[t+10]&255|(e[t+11]&255)<<8,k+=(c>>>14|l<<2)&8191,u=e[t+12]&255|(e[t+13]&255)<<8,A+=(l>>>11|u<<5)&8191,d=e[t+14]&255|(e[t+15]&255)<<8,j+=(u>>>8|d<<8)&8191,M+=d>>>5|r,f=0,p=f,p+=C*N,p+=5*H*w,p+=5*V*T,p+=5*B*E,p+=5*z*D,f=p>>>13,p&=8191,p+=5*R*O,p+=5*L*k,p+=5*I*A,p+=5*F*j,p+=5*P*M,f+=p>>>13,p&=8191,m=f,m+=C*P,m+=w*N,m+=5*H*T,m+=5*V*E,m+=5*B*D,f=m>>>13,m&=8191,m+=5*z*O,m+=5*R*k,m+=5*L*A,m+=5*I*j,m+=5*F*M,f+=m>>>13,m&=8191,h=f,h+=C*F,h+=w*P,h+=T*N,h+=5*H*E,h+=5*V*D,f=h>>>13,h&=8191,h+=5*B*O,h+=5*z*k,h+=5*R*A,h+=5*L*j,h+=5*I*M,f+=h>>>13,h&=8191,g=f,g+=C*I,g+=w*F,g+=T*P,g+=E*N,g+=5*H*D,f=g>>>13,g&=8191,g+=5*V*O,g+=5*B*k,g+=5*z*A,g+=5*R*j,g+=5*L*M,f+=g>>>13,g&=8191,_=f,_+=C*L,_+=w*I,_+=T*F,_+=E*P,_+=D*N,f=_>>>13,_&=8191,_+=5*H*O,_+=5*V*k,_+=5*B*A,_+=5*z*j,_+=5*R*M,f+=_>>>13,_&=8191,v=f,v+=C*R,v+=w*L,v+=T*I,v+=E*F,v+=D*P,f=v>>>13,v&=8191,v+=O*N,v+=5*H*k,v+=5*V*A,v+=5*B*j,v+=5*z*M,f+=v>>>13,v&=8191,y=f,y+=C*z,y+=w*R,y+=T*L,y+=E*I,y+=D*F,f=y>>>13,y&=8191,y+=O*P,y+=k*N,y+=5*H*A,y+=5*V*j,y+=5*B*M,f+=y>>>13,y&=8191,b=f,b+=C*B,b+=w*z,b+=T*R,b+=E*L,b+=D*I,f=b>>>13,b&=8191,b+=O*F,b+=k*P,b+=A*N,b+=5*H*j,b+=5*V*M,f+=b>>>13,b&=8191,x=f,x+=C*V,x+=w*B,x+=T*z,x+=E*R,x+=D*L,f=x>>>13,x&=8191,x+=O*I,x+=k*F,x+=A*P,x+=j*N,x+=5*H*M,f+=x>>>13,x&=8191,S=f,S+=C*H,S+=w*V,S+=T*B,S+=E*z,S+=D*R,f=S>>>13,S&=8191,S+=O*L,S+=k*I,S+=A*F,S+=j*P,S+=M*N,f+=S>>>13,S&=8191,f=(f<<2)+f|0,f=f+p|0,p=f&8191,f>>>=13,m+=f,C=p,w=m,T=h,E=g,D=_,O=v,k=y,A=b,j=x,M=S,t+=16,n-=16;this.h[0]=C,this.h[1]=w,this.h[2]=T,this.h[3]=E,this.h[4]=D,this.h[5]=O,this.h[6]=k,this.h[7]=A,this.h[8]=j,this.h[9]=M},O.prototype.finish=function(e,t){var n=new Uint16Array(10),r,i,a,o;if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=r*5,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,n[0]=this.h[0]+5,r=n[0]>>>13,n[0]&=8191,o=1;o<10;o++)n[o]=this.h[o]+r,r=n[o]>>>13,n[o]&=8191;for(n[9]-=8192,i=(r^1)-1,o=0;o<10;o++)n[o]&=i;for(i=~i,o=0;o<10;o++)this.h[o]=this.h[o]&i|n[o];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,a=this.h[0]+this.pad[0],this.h[0]=a&65535,o=1;o<8;o++)a=(this.h[o]+this.pad[o]|0)+(a>>>16)|0,this.h[o]=a&65535;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},O.prototype.update=function(e,t,n){var r,i;if(this.leftover){for(i=16-this.leftover,i>n&&(i=n),r=0;r<i;r++)this.buffer[this.leftover+r]=e[t+r];if(n-=i,t+=i,this.leftover+=i,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(n>=16&&(i=n-n%16,this.blocks(e,t,i),t+=i,n-=i),n){for(r=0;r<n;r++)this.buffer[this.leftover+r]=e[t+r];this.leftover+=n}};function k(e,t,n,r,i,a){var o=new O(a);return o.update(n,r,i),o.finish(e,t),0}function A(e,t,n,r,i,a){var o=new Uint8Array(16);return k(o,0,n,r,i,a),_(e,t,o,0)}function j(e,t,n,r,i){var a;if(n<32)return-1;for(D(e,0,t,0,n,r,i),k(e,16,e,32,n-32,e),a=0;a<16;a++)e[a]=0;return 0}function M(e,t,n,r,i){var a,o=new Uint8Array(32);if(n<32||(E(o,0,32,r,i),A(t,16,t,32,n-32,o)!==0))return-1;for(D(e,0,t,0,n,r,i),a=0;a<32;a++)e[a]=0;return 0}function N(e,t){var n;for(n=0;n<16;n++)e[n]=t[n]|0}function P(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-r*65536;e[0]+=r-1+37*(r-1)}function F(e,t,n){for(var r,i=~(n-1),a=0;a<16;a++)r=i&(e[a]^t[a]),e[a]^=r,t[a]^=r}function I(e,t){var r,i,a,o=n(),s=n();for(r=0;r<16;r++)s[r]=t[r];for(P(s),P(s),P(s),i=0;i<2;i++){for(o[0]=s[0]-65517,r=1;r<15;r++)o[r]=s[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=s[15]-32767-(o[14]>>16&1),a=o[15]>>16&1,o[14]&=65535,F(s,o,1-a)}for(r=0;r<16;r++)e[2*r]=s[r]&255,e[2*r+1]=s[r]>>8}function L(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return I(n,e),I(r,t),v(n,0,r,0)}function R(e){var t=new Uint8Array(32);return I(t,e),t[0]&1}function z(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function B(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function V(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function H(e,t,n){var r,i,a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y=0,b=0,x=0,S=0,C=0,w=0,T=0,E=0,D=0,O=0,k=0,A=0,j=0,M=0,N=0,P=0,F=0,I=n[0],L=n[1],R=n[2],z=n[3],B=n[4],V=n[5],H=n[6],U=n[7],W=n[8],G=n[9],K=n[10],q=n[11],ee=n[12],te=n[13],J=n[14],ne=n[15];r=t[0],a+=r*I,o+=r*L,s+=r*R,c+=r*z,l+=r*B,u+=r*V,d+=r*H,f+=r*U,p+=r*W,m+=r*G,h+=r*K,g+=r*q,_+=r*ee,v+=r*te,y+=r*J,b+=r*ne,r=t[1],o+=r*I,s+=r*L,c+=r*R,l+=r*z,u+=r*B,d+=r*V,f+=r*H,p+=r*U,m+=r*W,h+=r*G,g+=r*K,_+=r*q,v+=r*ee,y+=r*te,b+=r*J,x+=r*ne,r=t[2],s+=r*I,c+=r*L,l+=r*R,u+=r*z,d+=r*B,f+=r*V,p+=r*H,m+=r*U,h+=r*W,g+=r*G,_+=r*K,v+=r*q,y+=r*ee,b+=r*te,x+=r*J,S+=r*ne,r=t[3],c+=r*I,l+=r*L,u+=r*R,d+=r*z,f+=r*B,p+=r*V,m+=r*H,h+=r*U,g+=r*W,_+=r*G,v+=r*K,y+=r*q,b+=r*ee,x+=r*te,S+=r*J,C+=r*ne,r=t[4],l+=r*I,u+=r*L,d+=r*R,f+=r*z,p+=r*B,m+=r*V,h+=r*H,g+=r*U,_+=r*W,v+=r*G,y+=r*K,b+=r*q,x+=r*ee,S+=r*te,C+=r*J,w+=r*ne,r=t[5],u+=r*I,d+=r*L,f+=r*R,p+=r*z,m+=r*B,h+=r*V,g+=r*H,_+=r*U,v+=r*W,y+=r*G,b+=r*K,x+=r*q,S+=r*ee,C+=r*te,w+=r*J,T+=r*ne,r=t[6],d+=r*I,f+=r*L,p+=r*R,m+=r*z,h+=r*B,g+=r*V,_+=r*H,v+=r*U,y+=r*W,b+=r*G,x+=r*K,S+=r*q,C+=r*ee,w+=r*te,T+=r*J,E+=r*ne,r=t[7],f+=r*I,p+=r*L,m+=r*R,h+=r*z,g+=r*B,_+=r*V,v+=r*H,y+=r*U,b+=r*W,x+=r*G,S+=r*K,C+=r*q,w+=r*ee,T+=r*te,E+=r*J,D+=r*ne,r=t[8],p+=r*I,m+=r*L,h+=r*R,g+=r*z,_+=r*B,v+=r*V,y+=r*H,b+=r*U,x+=r*W,S+=r*G,C+=r*K,w+=r*q,T+=r*ee,E+=r*te,D+=r*J,O+=r*ne,r=t[9],m+=r*I,h+=r*L,g+=r*R,_+=r*z,v+=r*B,y+=r*V,b+=r*H,x+=r*U,S+=r*W,C+=r*G,w+=r*K,T+=r*q,E+=r*ee,D+=r*te,O+=r*J,k+=r*ne,r=t[10],h+=r*I,g+=r*L,_+=r*R,v+=r*z,y+=r*B,b+=r*V,x+=r*H,S+=r*U,C+=r*W,w+=r*G,T+=r*K,E+=r*q,D+=r*ee,O+=r*te,k+=r*J,A+=r*ne,r=t[11],g+=r*I,_+=r*L,v+=r*R,y+=r*z,b+=r*B,x+=r*V,S+=r*H,C+=r*U,w+=r*W,T+=r*G,E+=r*K,D+=r*q,O+=r*ee,k+=r*te,A+=r*J,j+=r*ne,r=t[12],_+=r*I,v+=r*L,y+=r*R,b+=r*z,x+=r*B,S+=r*V,C+=r*H,w+=r*U,T+=r*W,E+=r*G,D+=r*K,O+=r*q,k+=r*ee,A+=r*te,j+=r*J,M+=r*ne,r=t[13],v+=r*I,y+=r*L,b+=r*R,x+=r*z,S+=r*B,C+=r*V,w+=r*H,T+=r*U,E+=r*W,D+=r*G,O+=r*K,k+=r*q,A+=r*ee,j+=r*te,M+=r*J,N+=r*ne,r=t[14],y+=r*I,b+=r*L,x+=r*R,S+=r*z,C+=r*B,w+=r*V,T+=r*H,E+=r*U,D+=r*W,O+=r*G,k+=r*K,A+=r*q,j+=r*ee,M+=r*te,N+=r*J,P+=r*ne,r=t[15],b+=r*I,x+=r*L,S+=r*R,C+=r*z,w+=r*B,T+=r*V,E+=r*H,D+=r*U,O+=r*W,k+=r*G,A+=r*K,j+=r*q,M+=r*ee,N+=r*te,P+=r*J,F+=r*ne,a+=38*x,o+=38*S,s+=38*C,c+=38*w,l+=38*T,u+=38*E,d+=38*D,f+=38*O,p+=38*k,m+=38*A,h+=38*j,g+=38*M,_+=38*N,v+=38*P,y+=38*F,i=1,r=a+i+65535,i=Math.floor(r/65536),a=r-i*65536,r=o+i+65535,i=Math.floor(r/65536),o=r-i*65536,r=s+i+65535,i=Math.floor(r/65536),s=r-i*65536,r=c+i+65535,i=Math.floor(r/65536),c=r-i*65536,r=l+i+65535,i=Math.floor(r/65536),l=r-i*65536,r=u+i+65535,i=Math.floor(r/65536),u=r-i*65536,r=d+i+65535,i=Math.floor(r/65536),d=r-i*65536,r=f+i+65535,i=Math.floor(r/65536),f=r-i*65536,r=p+i+65535,i=Math.floor(r/65536),p=r-i*65536,r=m+i+65535,i=Math.floor(r/65536),m=r-i*65536,r=h+i+65535,i=Math.floor(r/65536),h=r-i*65536,r=g+i+65535,i=Math.floor(r/65536),g=r-i*65536,r=_+i+65535,i=Math.floor(r/65536),_=r-i*65536,r=v+i+65535,i=Math.floor(r/65536),v=r-i*65536,r=y+i+65535,i=Math.floor(r/65536),y=r-i*65536,r=b+i+65535,i=Math.floor(r/65536),b=r-i*65536,a+=i-1+37*(i-1),i=1,r=a+i+65535,i=Math.floor(r/65536),a=r-i*65536,r=o+i+65535,i=Math.floor(r/65536),o=r-i*65536,r=s+i+65535,i=Math.floor(r/65536),s=r-i*65536,r=c+i+65535,i=Math.floor(r/65536),c=r-i*65536,r=l+i+65535,i=Math.floor(r/65536),l=r-i*65536,r=u+i+65535,i=Math.floor(r/65536),u=r-i*65536,r=d+i+65535,i=Math.floor(r/65536),d=r-i*65536,r=f+i+65535,i=Math.floor(r/65536),f=r-i*65536,r=p+i+65535,i=Math.floor(r/65536),p=r-i*65536,r=m+i+65535,i=Math.floor(r/65536),m=r-i*65536,r=h+i+65535,i=Math.floor(r/65536),h=r-i*65536,r=g+i+65535,i=Math.floor(r/65536),g=r-i*65536,r=_+i+65535,i=Math.floor(r/65536),_=r-i*65536,r=v+i+65535,i=Math.floor(r/65536),v=r-i*65536,r=y+i+65535,i=Math.floor(r/65536),y=r-i*65536,r=b+i+65535,i=Math.floor(r/65536),b=r-i*65536,a+=i-1+37*(i-1),e[0]=a,e[1]=o,e[2]=s,e[3]=c,e[4]=l,e[5]=u,e[6]=d,e[7]=f,e[8]=p,e[9]=m,e[10]=h,e[11]=g,e[12]=_,e[13]=v,e[14]=y,e[15]=b}function U(e,t){H(e,t,t)}function W(e,t){var r=n(),i;for(i=0;i<16;i++)r[i]=t[i];for(i=253;i>=0;i--)U(r,r),i!==2&&i!==4&&H(r,r,t);for(i=0;i<16;i++)e[i]=r[i]}function G(e,t){var r=n(),i;for(i=0;i<16;i++)r[i]=t[i];for(i=250;i>=0;i--)U(r,r),i!==1&&H(r,r,t);for(i=0;i<16;i++)e[i]=r[i]}function K(e,t,r){var i=new Uint8Array(32),a=new Float64Array(80),o,s,c=n(),u=n(),d=n(),f=n(),p=n(),m=n();for(s=0;s<31;s++)i[s]=t[s];for(i[31]=t[31]&127|64,i[0]&=248,z(a,r),s=0;s<16;s++)u[s]=a[s],f[s]=c[s]=d[s]=0;for(c[0]=f[0]=1,s=254;s>=0;--s)o=i[s>>>3]>>>(s&7)&1,F(c,u,o),F(d,f,o),B(p,c,d),V(c,c,d),B(d,u,f),V(u,u,f),U(f,p),U(m,c),H(c,d,c),H(d,u,p),B(p,c,d),V(c,c,d),U(u,c),V(d,f,m),H(c,d,l),B(c,c,f),H(d,d,c),H(c,f,m),H(f,u,a),U(u,p),F(c,u,o),F(d,f,o);for(s=0;s<16;s++)a[s+16]=c[s],a[s+32]=d[s],a[s+48]=u[s],a[s+64]=f[s];var h=a.subarray(32),g=a.subarray(16);return W(h,h),H(g,g,h),I(e,g),0}function q(e,t){return K(e,t,o)}function ee(e,t){return r(t,32),q(e,t)}function te(e,t,n){var r=new Uint8Array(32);return K(r,n,t),S(e,i,r,C)}var J=j,ne=M;function re(e,t,n,r,i,a){var o=new Uint8Array(32);return te(o,i,a),J(e,t,n,r,o)}function ie(e,t,n,r,i,a){var o=new Uint8Array(32);return te(o,i,a),ne(e,t,n,r,o)}var ae=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function oe(e,t,n,r){for(var i=new Int32Array(16),a=new Int32Array(16),o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=e[0],N=e[1],P=e[2],F=e[3],I=e[4],L=e[5],R=e[6],z=e[7],B=t[0],V=t[1],H=t[2],U=t[3],W=t[4],G=t[5],K=t[6],q=t[7],ee=0;r>=128;){for(w=0;w<16;w++)T=8*w+ee,i[w]=n[T+0]<<24|n[T+1]<<16|n[T+2]<<8|n[T+3],a[w]=n[T+4]<<24|n[T+5]<<16|n[T+6]<<8|n[T+7];for(w=0;w<80;w++)if(o=M,s=N,c=P,l=F,u=I,d=L,f=R,p=z,m=B,h=V,g=H,_=U,v=W,y=G,b=K,x=q,E=z,D=q,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=(I>>>14|W<<18)^(I>>>18|W<<14)^(W>>>9|I<<23),D=(W>>>14|I<<18)^(W>>>18|I<<14)^(I>>>9|W<<23),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=I&L^~I&R,D=W&G^~W&K,O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=ae[w*2],D=ae[w*2+1],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=i[w%16],D=a[w%16],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,S=A&65535|j<<16,C=O&65535|k<<16,E=S,D=C,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=(M>>>28|B<<4)^(B>>>2|M<<30)^(B>>>7|M<<25),D=(B>>>28|M<<4)^(M>>>2|B<<30)^(M>>>7|B<<25),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=M&N^M&P^N&P,D=B&V^B&H^V&H,O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,p=A&65535|j<<16,x=O&65535|k<<16,E=l,D=_,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=S,D=C,O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,l=A&65535|j<<16,_=O&65535|k<<16,N=o,P=s,F=c,I=l,L=u,R=d,z=f,M=p,V=m,H=h,U=g,W=_,G=v,K=y,q=b,B=x,w%16==15)for(T=0;T<16;T++)E=i[T],D=a[T],O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=i[(T+9)%16],D=a[(T+9)%16],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,S=i[(T+1)%16],C=a[(T+1)%16],E=(S>>>1|C<<31)^(S>>>8|C<<24)^S>>>7,D=(C>>>1|S<<31)^(C>>>8|S<<24)^(C>>>7|S<<25),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,S=i[(T+14)%16],C=a[(T+14)%16],E=(S>>>19|C<<13)^(C>>>29|S<<3)^S>>>6,D=(C>>>19|S<<13)^(S>>>29|C<<3)^(C>>>6|S<<26),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,i[T]=A&65535|j<<16,a[T]=O&65535|k<<16;E=M,D=B,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[0],D=t[0],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[0]=M=A&65535|j<<16,t[0]=B=O&65535|k<<16,E=N,D=V,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[1],D=t[1],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[1]=N=A&65535|j<<16,t[1]=V=O&65535|k<<16,E=P,D=H,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[2],D=t[2],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[2]=P=A&65535|j<<16,t[2]=H=O&65535|k<<16,E=F,D=U,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[3],D=t[3],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[3]=F=A&65535|j<<16,t[3]=U=O&65535|k<<16,E=I,D=W,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[4],D=t[4],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[4]=I=A&65535|j<<16,t[4]=W=O&65535|k<<16,E=L,D=G,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[5],D=t[5],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[5]=L=A&65535|j<<16,t[5]=G=O&65535|k<<16,E=R,D=K,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[6],D=t[6],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[6]=R=A&65535|j<<16,t[6]=K=O&65535|k<<16,E=z,D=q,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[7],D=t[7],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[7]=z=A&65535|j<<16,t[7]=q=O&65535|k<<16,ee+=128,r-=128}return r}function se(e,t,n){var r=new Int32Array(8),i=new Int32Array(8),a=new Uint8Array(256),o,s=n;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,oe(r,i,t,n),n%=128,o=0;o<n;o++)a[o]=t[s-n+o];for(a[n]=128,n=256-128*(n<112),a[n-9]=0,h(a,n-8,s/536870912|0,s<<3),oe(r,i,a,n),o=0;o<8;o++)h(e,8*o,r[o],i[o]);return 0}function ce(e,t){var r=n(),i=n(),a=n(),o=n(),s=n(),c=n(),l=n(),u=n(),f=n();V(r,e[1],e[0]),V(f,t[1],t[0]),H(r,r,f),B(i,e[0],e[1]),B(f,t[0],t[1]),H(i,i,f),H(a,e[3],t[3]),H(a,a,d),H(o,e[2],t[2]),B(o,o,o),V(s,i,r),V(c,o,a),B(l,o,a),B(u,i,r),H(e[0],s,c),H(e[1],u,l),H(e[2],l,c),H(e[3],s,u)}function le(e,t,n){var r;for(r=0;r<4;r++)F(e[r],t[r],n)}function ue(e,t){var r=n(),i=n(),a=n();W(a,t[2]),H(r,t[0],a),H(i,t[1],a),I(e,i),e[31]^=R(r)<<7}function de(e,t,n){var r,i;for(N(e[0],s),N(e[1],c),N(e[2],c),N(e[3],s),i=255;i>=0;--i)r=n[i/8|0]>>(i&7)&1,le(e,t,r),ce(t,e),ce(e,e),le(e,t,r)}function fe(e,t){var r=[n(),n(),n(),n()];N(r[0],f),N(r[1],p),N(r[2],c),H(r[3],f,p),de(e,r,t)}function pe(e,t,i){var a=new Uint8Array(64),o=[n(),n(),n(),n()],s;for(i||r(t,32),se(a,t,32),a[0]&=248,a[31]&=127,a[31]|=64,fe(o,a),ue(e,o),s=0;s<32;s++)t[s+32]=e[s];return 0}var me=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function he(e,t){var n,r,i,a;for(r=63;r>=32;--r){for(n=0,i=r-32,a=r-12;i<a;++i)t[i]+=n-16*t[r]*me[i-(r-32)],n=Math.floor((t[i]+128)/256),t[i]-=n*256;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*me[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*me[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=t[r]&255}function ge(e){var t=new Float64Array(64),n;for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;he(e,t)}function _e(e,t,r,i){var a=new Uint8Array(64),o=new Uint8Array(64),s=new Uint8Array(64),c,l,u=new Float64Array(64),d=[n(),n(),n(),n()];se(a,i,32),a[0]&=248,a[31]&=127,a[31]|=64;var f=r+64;for(c=0;c<r;c++)e[64+c]=t[c];for(c=0;c<32;c++)e[32+c]=a[32+c];for(se(s,e.subarray(32),r+32),ge(s),fe(d,s),ue(e,d),c=32;c<64;c++)e[c]=i[c];for(se(o,e,r+64),ge(o),c=0;c<64;c++)u[c]=0;for(c=0;c<32;c++)u[c]=s[c];for(c=0;c<32;c++)for(l=0;l<32;l++)u[c+l]+=o[c]*a[l];return he(e.subarray(32),u),f}function ve(e,t){var r=n(),i=n(),a=n(),o=n(),l=n(),d=n(),f=n();return N(e[2],c),z(e[1],t),U(a,e[1]),H(o,a,u),V(a,a,e[2]),B(o,e[2],o),U(l,o),U(d,l),H(f,d,l),H(r,f,a),H(r,r,o),G(r,r),H(r,r,a),H(r,r,o),H(r,r,o),H(e[0],r,o),U(i,e[0]),H(i,i,o),L(i,a)&&H(e[0],e[0],m),U(i,e[0]),H(i,i,o),L(i,a)?-1:(R(e[0])===t[31]>>7&&V(e[0],s,e[0]),H(e[3],e[0],e[1]),0)}function ye(e,t,r,i){var a,o=new Uint8Array(32),s=new Uint8Array(64),c=[n(),n(),n(),n()],l=[n(),n(),n(),n()];if(r<64||ve(l,i))return-1;for(a=0;a<r;a++)e[a]=t[a];for(a=0;a<32;a++)e[a+32]=i[a];if(se(s,e,r),ge(s),de(c,l,s),fe(l,t.subarray(32)),ce(c,l),ue(o,c),r-=64,v(t,0,o,0)){for(a=0;a<r;a++)e[a]=0;return-1}for(a=0;a<r;a++)e[a]=t[a+64];return r}var be=32,xe=24,Se=32,Ce=16,we=32,Te=32,Ee=32,De=32,Oe=32,ke=xe,Ae=Se,je=Ce,Me=64,Ne=32,Pe=64,Fe=32,Ie=64;e.lowlevel={crypto_core_hsalsa20:S,crypto_stream_xor:D,crypto_stream:E,crypto_stream_salsa20_xor:w,crypto_stream_salsa20:T,crypto_onetimeauth:k,crypto_onetimeauth_verify:A,crypto_verify_16:_,crypto_verify_32:v,crypto_secretbox:j,crypto_secretbox_open:M,crypto_scalarmult:K,crypto_scalarmult_base:q,crypto_box_beforenm:te,crypto_box_afternm:J,crypto_box:re,crypto_box_open:ie,crypto_box_keypair:ee,crypto_hash:se,crypto_sign:_e,crypto_sign_keypair:pe,crypto_sign_open:ye,crypto_secretbox_KEYBYTES:be,crypto_secretbox_NONCEBYTES:xe,crypto_secretbox_ZEROBYTES:Se,crypto_secretbox_BOXZEROBYTES:Ce,crypto_scalarmult_BYTES:we,crypto_scalarmult_SCALARBYTES:Te,crypto_box_PUBLICKEYBYTES:Ee,crypto_box_SECRETKEYBYTES:De,crypto_box_BEFORENMBYTES:Oe,crypto_box_NONCEBYTES:ke,crypto_box_ZEROBYTES:Ae,crypto_box_BOXZEROBYTES:je,crypto_sign_BYTES:Me,crypto_sign_PUBLICKEYBYTES:Ne,crypto_sign_SECRETKEYBYTES:Pe,crypto_sign_SEEDBYTES:Fe,crypto_hash_BYTES:Ie,gf:n,D:u,L:me,pack25519:I,unpack25519:z,M:H,A:B,S:U,Z:V,pow2523:G,add:ce,set25519:N,modL:he,scalarmult:de,scalarbase:fe};function Le(e,t){if(e.length!==be)throw Error(`bad key size`);if(t.length!==xe)throw Error(`bad nonce size`)}function Re(e,t){if(e.length!==Ee)throw Error(`bad public key size`);if(t.length!==De)throw Error(`bad secret key size`)}function ze(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw TypeError(`unexpected type, use Uint8Array`)}function Be(e){for(var t=0;t<e.length;t++)e[t]=0}e.randomBytes=function(e){var t=new Uint8Array(e);return r(t,e),t},e.secretbox=function(e,t,n){ze(e,t,n),Le(n,t);for(var r=new Uint8Array(Se+e.length),i=new Uint8Array(r.length),a=0;a<e.length;a++)r[a+Se]=e[a];return j(i,r,r.length,t,n),i.subarray(Ce)},e.secretbox.open=function(e,t,n){ze(e,t,n),Le(n,t);for(var r=new Uint8Array(Ce+e.length),i=new Uint8Array(r.length),a=0;a<e.length;a++)r[a+Ce]=e[a];return r.length<32||M(i,r,r.length,t,n)!==0?null:i.subarray(Se)},e.secretbox.keyLength=be,e.secretbox.nonceLength=xe,e.secretbox.overheadLength=Ce,e.scalarMult=function(e,t){if(ze(e,t),e.length!==Te)throw Error(`bad n size`);if(t.length!==we)throw Error(`bad p size`);var n=new Uint8Array(we);return K(n,e,t),n},e.scalarMult.base=function(e){if(ze(e),e.length!==Te)throw Error(`bad n size`);var t=new Uint8Array(we);return q(t,e),t},e.scalarMult.scalarLength=Te,e.scalarMult.groupElementLength=we,e.box=function(t,n,r,i){var a=e.box.before(r,i);return e.secretbox(t,n,a)},e.box.before=function(e,t){ze(e,t),Re(e,t);var n=new Uint8Array(Oe);return te(n,e,t),n},e.box.after=e.secretbox,e.box.open=function(t,n,r,i){var a=e.box.before(r,i);return e.secretbox.open(t,n,a)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var e=new Uint8Array(Ee),t=new Uint8Array(De);return ee(e,t),{publicKey:e,secretKey:t}},e.box.keyPair.fromSecretKey=function(e){if(ze(e),e.length!==De)throw Error(`bad secret key size`);var t=new Uint8Array(Ee);return q(t,e),{publicKey:t,secretKey:new Uint8Array(e)}},e.box.publicKeyLength=Ee,e.box.secretKeyLength=De,e.box.sharedKeyLength=Oe,e.box.nonceLength=ke,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(e,t){if(ze(e,t),t.length!==Pe)throw Error(`bad secret key size`);var n=new Uint8Array(Me+e.length);return _e(n,e,e.length,t),n},e.sign.open=function(e,t){if(ze(e,t),t.length!==Ne)throw Error(`bad public key size`);var n=new Uint8Array(e.length),r=ye(n,e,e.length,t);if(r<0)return null;for(var i=new Uint8Array(r),a=0;a<i.length;a++)i[a]=n[a];return i},e.sign.detached=function(t,n){for(var r=e.sign(t,n),i=new Uint8Array(Me),a=0;a<i.length;a++)i[a]=r[a];return i},e.sign.detached.verify=function(e,t,n){if(ze(e,t,n),t.length!==Me)throw Error(`bad signature size`);if(n.length!==Ne)throw Error(`bad public key size`);var r=new Uint8Array(Me+e.length),i=new Uint8Array(Me+e.length),a;for(a=0;a<Me;a++)r[a]=t[a];for(a=0;a<e.length;a++)r[a+Me]=e[a];return ye(i,r,r.length,n)>=0},e.sign.keyPair=function(){var e=new Uint8Array(Ne),t=new Uint8Array(Pe);return pe(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(ze(e),e.length!==Pe)throw Error(`bad secret key size`);for(var t=new Uint8Array(Ne),n=0;n<t.length;n++)t[n]=e[32+n];return{publicKey:t,secretKey:new Uint8Array(e)}},e.sign.keyPair.fromSeed=function(e){if(ze(e),e.length!==Fe)throw Error(`bad seed size`);for(var t=new Uint8Array(Ne),n=new Uint8Array(Pe),r=0;r<32;r++)n[r]=e[r];return pe(t,n,!0),{publicKey:t,secretKey:n}},e.sign.publicKeyLength=Ne,e.sign.secretKeyLength=Pe,e.sign.seedLength=Fe,e.sign.signatureLength=Me,e.hash=function(e){ze(e);var t=new Uint8Array(Ie);return se(t,e,e.length),t},e.hash.hashLength=Ie,e.verify=function(e,t){return ze(e,t),e.length===0||t.length===0||e.length!==t.length?!1:g(e,0,t,0,e.length)===0},e.setPRNG=function(e){r=e},(function(){var n=typeof self<`u`?self.crypto||self.msCrypto:null;if(n&&n.getRandomValues){var r=65536;e.setPRNG(function(e,t){var i,a=new Uint8Array(t);for(i=0;i<t;i+=r)n.getRandomValues(a.subarray(i,i+Math.min(t-i,r)));for(i=0;i<t;i++)e[i]=a[i];Be(a)})}else t!==void 0&&(n=a(),n&&n.randomBytes&&e.setPRNG(function(e,t){var r,i=n.randomBytes(t);for(r=0;r<t;r++)e[r]=i[r];Be(i)}))})()})(n!==void 0&&n.exports?n.exports:self.nacl=self.nacl||{})}))(),1),s=class extends Error{constructor(e){super(e),this.name=`PairCryptoError`}},c=1,l=12,u=32,d=new TextEncoder,f=new TextDecoder;function p(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function m(){return o.default.randomBytes(u)}function h(e,t){let n=o.default.box.keyPair(),r=o.default.randomBytes(o.default.box.nonceLength),i=o.default.box(e,r,t,n.secretKey);return{ephPublicKey:n.publicKey,nonce:r,boxed:i}}async function g(e){if(e.length!==u)throw new s(`contentKey must be ${u} bytes`);return crypto.subtle.importKey(`raw`,p(e),`AES-GCM`,!1,[`encrypt`,`decrypt`])}async function _(e,t,n=crypto.getRandomValues(new Uint8Array(l))){let r=await g(e);if(n.length!==l)throw new s(`nonce must be 12 bytes`);let i=d.encode(JSON.stringify(t)),a=new Uint8Array(await crypto.subtle.encrypt({name:`AES-GCM`,iv:p(n)},r,p(i))),o=new Uint8Array(13+a.length);return o[0]=c,o.set(n,1),o.set(a,13),o}async function v(e,t){if(t.length<29)throw new s(`frame too short`);if(t[0]!==c)throw new s(`unsupported frame version ${t[0]}`);let n=t.subarray(1,13),r=t.subarray(13),i=await g(e),a;try{a=await crypto.subtle.decrypt({name:`AES-GCM`,iv:p(n)},i,p(r))}catch{throw new s(`decrypt failed: wrong key or tampered frame`)}try{return JSON.parse(f.decode(new Uint8Array(a)))}catch{throw new s(`decrypt ok but payload is not valid JSON`)}}function y(){return typeof RTCPeerConnection>`u`?null:e=>b(e)}function b(e){let t=new RTCPeerConnection({iceServers:e,iceTransportPolicy:`all`}),n=null,r=!1,i=!1,a=!1,o=[],s=[],c=[],l=[],u=[],d=()=>{if(!(r||i)){i=!0;for(let e of u)e()}},f=e=>{n=e,e.binaryType=`arraybuffer`,e.onopen=()=>{if(!r)for(let e of c)e()},e.onmessage=e=>{if(r)return;let t=e.data,n=typeof t==`string`?new TextEncoder().encode(t):new Uint8Array(t);for(let e of l)e(n)},e.onclose=d,e.onerror=d};t.onicecandidate=e=>{if(!(r||!e.candidate?.candidate))for(let t of s)t({candidate:e.candidate.candidate,sdpMid:e.candidate.sdpMid})},t.onconnectionstatechange=()=>{let e=t.connectionState;(e===`disconnected`||e===`failed`||e===`closed`)&&d()},t.ondatachannel=e=>{r||f(e.channel)};let p=async()=>{a=!0;for(let e of o.splice(0))try{await t.addIceCandidate(e)}catch{}};return{async createOffer(){f(t.createDataChannel(`pair`,{ordered:!0}));let e=await t.createOffer();return await t.setLocalDescription(e),e.sdp??``},async acceptOffer(e){await t.setRemoteDescription({type:`offer`,sdp:e});let n=await t.createAnswer();return await t.setLocalDescription(n),await p(),n.sdp??``},async acceptAnswer(e){await t.setRemoteDescription({type:`answer`,sdp:e}),await p()},async addIceCandidate(e){if(!a){o.push(e);return}await t.addIceCandidate(e)},onIceCandidate(e){return s.push(e),()=>void s.splice(s.indexOf(e),1)},onOpen(e){return c.push(e),()=>void c.splice(c.indexOf(e),1)},onMessage(e){return l.push(e),()=>void l.splice(l.indexOf(e),1)},onClose(e){return u.push(e),()=>void u.splice(u.indexOf(e),1)},send(e){if(r||n?.readyState!==`open`||n.bufferedAmount>1048576)return!1;try{return n.send(e.slice().buffer),!0}catch{return!1}},buffered:()=>n&&!r?n.bufferedAmount:0,close(){if(!r){r=!0;try{n?.close()}catch{}try{t.close()}catch{}}}}}var x=16384,S=0,C=1;function w(e){let t=[],n=0;do{let r=Math.min(e.byteLength,n+x),i=new Uint8Array(1+r-n);i[0]=r>=e.byteLength?C:S,i.set(e.subarray(n,r),1),t.push(i),n=r}while(n<e.byteLength);return t}function T(){let e=[],t=0,n=!1,r=()=>{e=[],t=0};return{push(i){let a=i[0];if(a!==S&&a!==C)return r(),n=!1,null;if(n)return a===C&&(n=!1),null;let o=i.subarray(1);if(t+=o.byteLength,t>1048576)return r(),n=a===S,null;if(e.push(o),a===S)return null;let s=new Uint8Array(t),c=0;for(let t of e)s.set(t,c),c+=t.byteLength;return r(),s}}}var E=15e3;function D(e){return{role:e,phase:`idle`,gen:0,attempt:0,capable:!1,peerOnline:!1,preferRelay:!1}}var O=e=>({state:e,actions:[]});function k(e){if(e.phase===`idle`||e.phase===`cooldown`)return[];let t=[{type:`destroy-peer`}];return e.phase===`connected`&&t.push({type:`switch`,transport:`relay`},{type:`resync`}),t}function A(e){let t=e.gen+1;return{state:{...e,phase:`negotiating`,gen:t},actions:[{type:`create-offer`,gen:t},{type:`start-timeout`,gen:t}]}}function j(e,t){if(e.preferRelay)return{state:{...e,phase:`idle`},actions:t};if(e.capable&&e.peerOnline){let n=A(e);return{state:n.state,actions:[...t,...n.actions]}}return{state:{...e,phase:`idle`},actions:t}}function M(e,t){let n=t=>t===e.gen;switch(t.type){case`peer-capable`:{if(!t.capable)return{state:{...e,capable:!1,preferRelay:!1,phase:`idle`},actions:k(e)};let n={...e,capable:!0};return e.phase===`idle`?j(n,[]):O(n)}case`peer-online`:{let n={...e,peerOnline:t.online};return t.online&&e.phase===`idle`?j(n,[]):O(n)}case`answer`:return e.phase===`negotiating`&&n(t.gen)?{state:e,actions:[{type:`apply-answer`,gen:t.gen}]}:O(e);case`ice`:return(e.phase===`negotiating`||e.phase===`connected`)&&n(t.gen)?{state:e,actions:[{type:`apply-ice`,gen:t.gen}]}:O(e);case`dc-open`:return e.phase===`negotiating`&&n(t.gen)?{state:{...e,phase:`connected`,attempt:0},actions:[{type:`switch`,transport:`direct`},{type:`resync`}]}:O(e);case`negotiate-timeout`:{if(e.phase!==`negotiating`||!n(t.gen))return O(e);let r=e.attempt+1;return{state:{...e,phase:`cooldown`,attempt:r},actions:[{type:`send-close`,gen:t.gen},{type:`destroy-peer`},{type:`schedule-retry`,attempt:r}]}}case`dc-close`:{if(!n(t.gen))return O(e);let r=e.attempt+1;return e.phase===`connected`?{state:{...e,phase:`cooldown`,attempt:r},actions:[...k(e),{type:`schedule-retry`,attempt:r}]}:e.phase===`negotiating`?{state:{...e,phase:`cooldown`,attempt:r},actions:[{type:`send-close`,gen:t.gen},{type:`destroy-peer`},{type:`schedule-retry`,attempt:r}]}:O(e)}case`cooldown-elapsed`:return e.phase===`cooldown`?j(e,[]):O(e);case`network-change`:{let t=e.phase===`negotiating`||e.phase===`connected`?[{type:`send-close`,gen:e.gen},...k(e)]:[];return j({...e,attempt:0,preferRelay:!1},t)}case`peer-gone`:{let t=k(e).filter(e=>e.type!==`resync`);return{state:{...e,phase:`idle`,attempt:0,capable:!1,peerOnline:!1,preferRelay:!1},actions:t}}case`prefer-relay`:return e.phase===`idle`||e.phase===`cooldown`?{state:{...e,preferRelay:!0,phase:`idle`},actions:[]}:{state:{...e,phase:`idle`,preferRelay:!0,attempt:0},actions:[{type:`send-close`,gen:e.gen},...k(e)]};default:return O(e)}}function N(e,t){let n=t=>t===e.gen,r=()=>({state:{...e,phase:`idle`},actions:k(e)});switch(t.type){case`peer-online`:return O({...e,peerOnline:t.online});case`offer`:{let n=t.gen===1&&e.gen===1&&e.phase===`negotiating`;return!(t.gen===1&&e.gen>=1&&!n)&&t.gen<=e.gen?O(e):{state:{...e,phase:`negotiating`,gen:t.gen},actions:[...k(e),{type:`accept-offer`,gen:t.gen},{type:`start-timeout`,gen:t.gen}]}}case`ice`:return(e.phase===`negotiating`||e.phase===`connected`)&&n(t.gen)?{state:e,actions:[{type:`apply-ice`,gen:t.gen}]}:O(e);case`dc-open`:return e.phase===`negotiating`&&n(t.gen)?{state:{...e,phase:`connected`},actions:[{type:`switch`,transport:`direct`},{type:`resync`}]}:O(e);case`dc-close`:case`negotiate-timeout`:case`remote-close`:return n(t.gen)&&e.phase!==`idle`?r():O(e);case`network-change`:return r();case`peer-gone`:return{state:{...e,phase:`idle`,peerOnline:!1},actions:k(e)};default:return O(e)}}function P(e,t){return e.role===`guest`?M(e,t):N(e,t)}function F(e,t=Math.random){let n=Math.min(3e5,1e3*2**Math.max(0,e));return Math.round(n*(.7+t()*.6))}function I(e){return e.startsWith(`a=`)?e.slice(2):e}function L(e){let t=/\styp\s+(\S+)/.exec(I(e))?.[1];return t===`host`||t===`srflx`}function R(e){let t=I(e).split(/\s+/),n=t.indexOf(`typ`);if(n<5||!t[n+1])return null;let r=t.indexOf(`raddr`),i=t.indexOf(`rport`);return{typ:t[n+1],address:t[4],port:t[5],base:r>0&&i>0?`${t[r+1]}:${t[i+1]}`:null}}function z(e){let t=new Map;for(let n of e){let e=R(n);if(e?.typ!==`srflx`||!e.base)continue;let r=t.get(e.base)??new Set;r.add(`${e.address}:${e.port}`),t.set(e.base,r)}if(t.size===0)return`none`;for(let e of t.values())if(e.size>1)return`symmetric`;return`cone`}function B(e){let t=new Map,n=!1;for(let r of e){let e=R(r);e&&(t.set(e.typ,(t.get(e.typ)??0)+1),e.address.includes(`:`)&&(n=!0))}if(t.size===0)return`none`;let r=[...t].map(([e,t])=>`${e}×${t}`);return n&&r.push(`v6`),r.push(`nat=${z(e)}`),r.join(` `)}var V=40,H=1.25,U=1e3;function W(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<0||t<0?!1:e>=t+V&&e>=t*H}var G=2,K=3,q=25e3,ee=1e4,te=class{deps;state;peer=null;peerGen=0;dcOpen=!1;iceServers;reassembler=T();negotiateTimer=null;retryTimer=null;heartbeatTimer=null;heartbeatDeadline=null;pingSentAt=null;closed=!1;qualityGen=null;qualityTimer=null;lastDirectRtt=null;lastRelayRtt=null;constructor(e){this.deps=e,this.state=D(e.role),this.iceServers=e.iceServers??[]}hostInfo(e){e.iceServers&&(this.iceServers=e.iceServers);let t=this.deps.factory!==null&&(e.capabilities??[]).includes(`direct-v1`);this.dispatch({type:`peer-capable`,capable:t})}peerOnline(e){this.dispatch({type:`peer-online`,online:e})}handleSignal(e){switch(e.type){case`direct-offer`:this.pendingOffer=e.sdp,this.dispatch({type:`offer`,gen:e.gen});break;case`direct-answer`:this.pendingAnswer=e.sdp,this.dispatch({type:`answer`,gen:e.gen});break;case`direct-ice`:e.gen===this.state.gen&&this.remoteCandidates.push(e.candidate),this.pendingIce={candidate:e.candidate,sdpMid:e.sdpMid},this.dispatch({type:`ice`,gen:e.gen});break;case`direct-close`:this.dispatch({type:`remote-close`,gen:e.gen})}}networkChange(){this.dispatch({type:`network-change`})}noteRelayRtt(e){!Number.isFinite(e)||e<0||(this.lastRelayRtt=e,this.maybeFinishQuality())}peerGone(){this.dispatch({type:`peer-gone`})}close(){this.closed||(this.dispatch({type:`peer-gone`}),this.closed=!0,this.clearRetry(),this.destroyPeer())}transport(){return this.state.phase===`connected`&&this.dcOpen?`direct`:`relay`}send(e){if(this.transport()!==`direct`||!this.peer||(this.peer.buffered?.()??0)+e.byteLength>1048576)return!1;let t=w(e);for(let e=0;e<t.length;e++)if(!this.peer.send(t[e]))return e>0&&this.failGen(this.peerGen),!1;return!0}pendingOffer=``;pendingAnswer=``;pendingIce=null;localCandidates=[];remoteCandidates=[];dispatch(e){if(this.closed)return;let t=this.state,{state:n,actions:r}=P(this.state,e);this.state=n,this.diagnose(t,e);for(let e of r)this.run(e)}diagnose(e,t){if(!this.deps.onDiagnostic||e.phase!==`negotiating`)return;let n=this.state.phase===`connected`?`open`:t.type===`negotiate-timeout`||t.type===`dc-close`?`failed`:null;n&&this.deps.onDiagnostic(`direct ${n} gen=${e.gen} local[${B(this.localCandidates)}] remote[${B(this.remoteCandidates)}]`)}run(e){switch(e.type){case`create-offer`:this.spawnPeer(e.gen,t=>t.createOffer().then(t=>{this.peerGen===e.gen&&!this.closed&&this.deps.sendSignal({type:`direct-offer`,gen:e.gen,sdp:t})}));break;case`accept-offer`:{let t=this.pendingOffer;this.spawnPeer(e.gen,n=>n.acceptOffer(t).then(t=>{this.peerGen===e.gen&&!this.closed&&this.deps.sendSignal({type:`direct-answer`,gen:e.gen,sdp:t})}));break}case`apply-answer`:this.peer?.acceptAnswer(this.pendingAnswer).catch(()=>this.failGen(e.gen));break;case`apply-ice`:this.pendingIce&&this.peer?.addIceCandidate(this.pendingIce).catch(()=>{});break;case`start-timeout`:if(this.clearNegotiateTimer(),!this.peer)break;this.negotiateTimer=setTimeout(()=>{this.negotiateTimer=null,this.dispatch({type:`negotiate-timeout`,gen:e.gen})},E);break;case`destroy-peer`:this.destroyPeer();break;case`send-close`:this.deps.sendSignal({type:`direct-close`,gen:e.gen});break;case`switch`:this.deps.onTransportChange(e.transport);break;case`resync`:this.deps.onResync();break;case`schedule-retry`:this.clearRetry(),this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.dispatch({type:`cooldown-elapsed`})},F(e.attempt))}}spawnPeer(e,t){this.destroyPeer();let n=this.deps.factory?.(this.iceServers)??null;if(!n){this.deps.role===`guest`?this.dispatch({type:`peer-capable`,capable:!1}):this.dispatch({type:`dc-close`,gen:e});return}this.peer=n,this.peerGen=e,this.reassembler=T(),this.localCandidates=[],this.remoteCandidates=[],n.onIceCandidate(t=>{this.peerGen===e&&(this.localCandidates.push(t.candidate),L(t.candidate)&&this.deps.sendSignal({type:`direct-ice`,gen:e,candidate:I(t.candidate),sdpMid:t.sdpMid}))}),n.onOpen(()=>{if(this.peerGen===e){if(this.dcOpen=!0,this.clearNegotiateTimer(),this.startHeartbeat(n,e),this.deps.role===`guest`&&this.deps.onNeedRelayProbe){this.beginQuality(e);return}this.dispatch({type:`dc-open`,gen:e})}}),n.onMessage(t=>{if(this.peerGen!==e)return;if(this.alive(),t.byteLength===1&&t[0]===G){n.send(new Uint8Array([K]));return}if(t.byteLength===1&&t[0]===K){if(this.pingSentAt!==null){let e=Date.now()-this.pingSentAt;this.deps.onRtt?.(e),this.lastDirectRtt=e,this.pingSentAt=null,this.maybeFinishQuality()}return}let r=this.reassembler.push(t);r&&this.deps.onFrame(r)}),n.onClose(()=>{this.peerGen===e&&this.dispatch({type:`dc-close`,gen:e})}),t(n).catch(()=>this.failGen(e))}failGen(e){(this.peerGen===e||this.state.gen===e)&&this.dispatch({type:`dc-close`,gen:e})}destroyPeer(){this.clearNegotiateTimer(),this.clearQuality(),this.stopHeartbeat(),this.dcOpen=!1;let e=this.peer;this.peer=null,this.peerGen=-1;try{e?.close()}catch{}}startHeartbeat(e,t){this.stopHeartbeat();let n=()=>{this.peerGen===t&&(this.pingSentAt=Date.now(),e.send(new Uint8Array([G])),this.heartbeatDeadline??=setTimeout(()=>{this.heartbeatDeadline=null,this.peerGen===t&&this.dispatch({type:`dc-close`,gen:t})},ee))};n(),this.heartbeatTimer=setInterval(n,q)}alive(){this.heartbeatDeadline&&clearTimeout(this.heartbeatDeadline),this.heartbeatDeadline=null}stopHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=null,this.pingSentAt=null,this.alive()}clearNegotiateTimer(){this.negotiateTimer&&clearTimeout(this.negotiateTimer),this.negotiateTimer=null}clearRetry(){this.retryTimer&&clearTimeout(this.retryTimer),this.retryTimer=null}beginQuality(e){this.clearQuality(),this.qualityGen=e,this.lastDirectRtt=null,this.lastRelayRtt=null,this.deps.onNeedRelayProbe?.(),this.qualityTimer=setTimeout(()=>this.finishQuality(e),U)}maybeFinishQuality(){this.qualityGen!==null&&this.qualityGen===this.peerGen&&this.lastDirectRtt!==null&&this.lastRelayRtt!==null&&this.finishQuality(this.qualityGen)}finishQuality(e){if(this.qualityGen===e&&(this.clearQuality(),!(this.peerGen!==e||!this.dcOpen))){if(this.lastDirectRtt!==null&&this.lastRelayRtt!==null&&W(this.lastDirectRtt,this.lastRelayRtt)){this.deps.onDiagnostic?.(`direct slower than relay ${Math.round(this.lastDirectRtt)}ms>${Math.round(this.lastRelayRtt)}ms, stay relay`),this.dispatch({type:`prefer-relay`});return}this.dispatch({type:`dc-open`,gen:e})}}clearQuality(){this.qualityTimer&&clearTimeout(this.qualityTimer),this.qualityTimer=null,this.qualityGen=null}};function J(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function ne(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4==0?``:`=`.repeat(4-t.length%4),r=atob(t+n),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return i}function re(e){let t=e.trim(),n=/^enso:\/\/pair\?(.*)$/.exec(t);if(n)return ie(new URLSearchParams(n[1]));if(/^https?:\/\//i.test(t)){let e=new URL(t);return ie(new URLSearchParams(e.hash.replace(/^#/,``)||e.search),e.origin)}throw Error(`not an enso pair uri`)}function ie(e,t){let n=e.get(`relay`)??t,r=e.get(`pk`);if(!n||!r)throw Error(`pair uri missing relay or pk`);return{relay:n,publicKey:ne(r)}}function ae(e){return e.trim().replace(/\/+$/,``).replace(/^http/,`ws`)}function oe(e){return e.trim().replace(/\/+$/,``)}function se(e){if(e<=0)return 0;let t=Math.min(3e4,1e3*2**(e-1));return Math.round(t*(.7+Math.random()*.6))}function ce(e){return[J(e.ephPublicKey),J(e.nonce),J(e.boxed)].join(`.`)}async function le(e,t){let n;for(let r=0;r<2;r++)try{let n=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t),signal:AbortSignal.timeout(1e4)}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.error??`relay ${n.status}`);return r}catch(e){if(n=e,!(e instanceof TypeError||e?.name===`TimeoutError`))throw e}throw n}async function ue(e,t,n){let r=oe(e),i=m(),a=h(i,t),o=await le(`${r}/v1/pair/claim`,{publicKey:J(t),boxedKey:ce(a),deviceName:n});return{pairId:o.pairId,deviceToken:o.deviceToken,contentKey:i}}async function de(e,t,n){let r=`${oe(e)}/v1/pair/${encodeURIComponent(t)}?token=${encodeURIComponent(n)}`;await fetch(r,{method:`DELETE`})}var fe=15e3,pe=8e3;function me(e,t,n){let r=null,i=null,a=0,o=!1,s=()=>{r&&clearTimeout(r),r=null,a=0},c=(n,s)=>{if(!(o||e.readyState!==1)){i=Date.now();try{e.send(`ping`)}catch{}r&&clearTimeout(r),r=setTimeout(()=>{if(r=null,!o){if(a+=1,a<s){c(n,s);return}t()}},n)}},l=(e=pe)=>{c(e,1)},u=()=>{r||c(pe,2)},d=e=>{s(),e.data===`pong`&&i!==null&&(n?.(Date.now()-i),i=null)};e.addEventListener(`message`,d);let f=()=>u();e.addEventListener(`open`,f),e.readyState===1&&u();let p=setInterval(u,fe);return{probe:l,stop(){o=!0,clearInterval(p),s(),i=null,e.removeEventListener(`message`,d),e.removeEventListener(`open`,f)}}}var he=24e4,ge=1024;function _e(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var ve=_e;function ye(e,t,n=he){let r=JSON.stringify(e);if(r.length<=n)return[e];let i=Math.ceil(r.length/n);if(i>ge)throw Error(`remote frame too large: ${r.length} chars`);let a=t();return Array.from({length:i},(e,t)=>({type:`part`,pid:a,index:t,total:i,data:r.slice(t*n,(t+1)*n)}))}function be(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`part`&&typeof t.pid==`string`&&t.pid.length>0&&t.pid.length<=64&&Number.isInteger(t.index)&&Number.isInteger(t.total)&&t.total>0&&t.total<=ge&&t.index>=0&&t.index<t.total&&typeof t.data==`string`&&t.data.length<=24e4}var xe=new Set([`rpc-ready`,`rpc-result`,`rpc-event`,`asset`,`gzip`,`part`]);function Se(e){return xe.has(e.type)}async function Ce(e,t){let n=new Blob([e]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}async function we(e){try{let t=await Ce(_e(e.data),new DecompressionStream(`gzip`));return JSON.parse(new TextDecoder().decode(t))}catch{return null}}function Te(e={}){let t=e.ttlMs??12e4,n=e.maxPending??16,r=e.now??Date.now,i=new Map,a=()=>{let e=r();for(let[n,r]of i)e-r.at>t&&i.delete(n)};return{push(e){a();let t=i.get(e.pid);if(t&&t.total!==e.total)return i.delete(e.pid),null;if(!t){if(i.size>=n){let e=i.keys().next().value;e!==void 0&&i.delete(e)}t={total:e.total,parts:Array(e.total),got:0,at:r()},i.set(e.pid,t)}if(t.parts[e.index]===void 0&&(t.parts[e.index]=e.data,t.got++),t.at=r(),t.got<t.total)return null;i.delete(e.pid);try{return JSON.parse(t.parts.join(``))}catch{return null}},clear(){i.clear()}}}function Ee(e={}){let t=e.maxHeld??4096,n=new Map,r=0,i=!1;return{push(e,a){if(e===void 0)return[a];if(e<=r||n.has(e))return[];n.set(e,a),n.size>t&&(i=!0);let o=[];for(let e=n.get(r+1);e!==void 0;e=n.get(r+1))n.delete(r+1),r++,o.push(e);return o},get applied(){return r},get gap(){return n.size>0},get overflowed(){return i}}}var De=8,Oe=12,ke=64;function Ae(e){return typeof e==`object`&&!!e&&e.type===`replay-hello`}function je(e=_,t=v){let n=Re(De),r=0,i=Re(De),a=null,o=!1,c=!1,l=null,u=0,d=!1,f=0n;function p(){i=Re(De),a=null,o=!1,c=!1,l=null,u=0,d=!1,f=0n}function m(){let e={p:J(n),c:J(i)};return a&&(e.e=J(a)),e}function h(e){if(e<=0||e>4294967295)return!1;if(u===0)return u=e,f=1n,!0;if(e>u){let t=BigInt(e-u);return f=t>=BigInt(ke)?1n:(f<<t|1n)&(1n<<BigInt(ke))-1n,u=e,!0}let t=u-e;if(t>=ke)return!1;let n=1n<<BigInt(t);return f&n?!1:(f|=n,!0)}return{peerReset:p,async seal(t,i){let a=Me(i,m());if(!o)return e(t,a);if(r===4294967295)throw new s(`replay counter exhausted`);r+=1;let c=new Uint8Array(Oe);return c.set(n,0),c[8]=r>>>24,c[9]=r>>>16&255,c[10]=r>>>8&255,c[11]=r&255,e(t,a,c)},async open(e,n){let r=await t(e,n),s=Pe(r);s&&(!a||!Le(a,s.c))&&(a=s.c,o=!0,d=!0);let p=n.subarray(1,13);if(s?.e&&Le(s.e,i)&&Le(p.subarray(0,De),s.p))return(!c||!l||!Le(l,s.p))&&(c=!0,l=s.p,u=0,f=0n),h(Ie(p))?Ne(r):void 0;if(!c||l&&Le(p.subarray(0,De),l)&&h(Ie(p)))return Ne(r)},takeHello(){return d?(d=!1,!0):!1}}}function Me(e,t){return typeof e!=`object`||!e||Array.isArray(e)?e:{...e,replay:t}}function Ne(e){if(typeof e!=`object`||!e||!(`replay`in e))return e;let{replay:t,...n}=e;return n}function Pe(e){if(typeof e!=`object`||!e||!(`replay`in e))return null;let t=e.replay;if(typeof t!=`object`||!t)return null;let n=t,r=Fe(n.p),i=Fe(n.c);if(!r||!i)return null;if(n.e===void 0)return{p:r,c:i};let a=Fe(n.e);return a?{p:r,c:i,e:a}:null}function Fe(e){if(typeof e!=`string`)return null;try{let t=ne(e);return t.length===De?t:null}catch{return null}}function Ie(e){return(e[8]<<24|e[9]<<16|e[10]<<8|e[11])>>>0}function Le(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function Re(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}function ze(e,t,n=null){return!t||n!==null&&n!==1||e===`network-change`||e===`online`}var Be=2e3;function Ve(e,t=Be){return e>=t}var He=8e3;function Ue(e,t,n=He){return e===0&&t>=n}var We=512,Ge=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ke=e=>typeof e==`string`&&e.length>0&&e.length<=We,qe=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0,Je=(e,t)=>Object.keys(e).length===t.length&&Object.keys(e).every(e=>t.includes(e));function Ye(e){return Ge(e)&&Je(e,[`epoch`,`seq`])&&Ke(e.epoch)&&qe(e.seq)}function Xe(e,t){if(!Ge(e)||e.type!==`snapshot`||!Array.isArray(e.sessions)||e.sessions.length!==1)return!1;let n=e.sessions[0];return!(!Ge(n)||n.sessionId!==t||!Array.isArray(n.messages)||!qe(n.baseIndex)||n.identity!==void 0&&(!Ge(n.identity)||n.identity.sessionId!==t))}function Ze(e){return!Ge(e)||e.type!==`session-sync`||!Ke(e.sessionId)||!Ke(e.requestId)||!Ye(e.cursor)?null:e.mode===`snapshot`?Je(e,[`type`,`sessionId`,`requestId`,`cursor`,`mode`,`snapshot`])&&Xe(e.snapshot,e.sessionId)?e:null:e.mode!==`replay`||!Je(e,[`type`,`sessionId`,`requestId`,`cursor`,`mode`,`fromSeq`,`events`])||!qe(e.fromSeq)||!Array.isArray(e.events)||e.fromSeq>e.cursor.seq||e.events.length!==e.cursor.seq-e.fromSeq?null:e.events.every(t=>Ge(t)&&Ke(t.type)&&t.sessionId===e.sessionId)?e:null}function Qe(e,t,n=Date.now()){switch(t.type){case`turn-retry`:{let{attempt:r,maxAttempts:i,delayMs:a,error:o}=t;return typeof r!=`number`||typeof i!=`number`||typeof a!=`number`||typeof o!=`string`||o.length===0?e:{attempt:r,maxAttempts:i,delayMs:a,error:o,at:n}}case`status`:case`turn-completed`:case`turn-failed`:return;default:return e}}function $e(e,t){switch(t.type){case`task-started`:{let n=t.task;return!n||typeof n.taskId!=`string`?null:e.tasks.some(e=>e.taskId===n.taskId)?e:{...e,tasks:[...e.tasks,n]}}case`task-output`:{let n=t.taskId;return n?{...e,tasks:e.tasks.map(e=>e.taskId===n?{...e,tail:t.tail,status:t.status}:e)}:null}case`task-ended`:{let n=t.taskId;return n?{...e,tasks:e.tasks.map(e=>e.taskId===n?{...e,status:t.status,exitCode:t.exitCode}:e)}:null}case`background-tasks-level`:return Array.isArray(t.tasks)?{...e,tasks:t.tasks}:null;case`subagent-update`:{let n=t.agent;if(!n||typeof n.id!=`string`)return null;let r=e.subagents.some(e=>e.id===n.id);return{...e,subagents:r?e.subagents.map(e=>e.id===n.id?n:e):[...e.subagents,n]}}default:return null}}function et(e,t){if(t===void 0)return;let n=0;for(let r of e)r<t&&(n+=1);return n}function tt(){return{messages:new Map,status:`idle`,approvals:[],asks:[],tasks:[],subagents:[]}}var nt=e=>e.size?Math.max(...e.keys()):-1;function rt(e,t,n){let r={...e,messages:new Map(e.messages)};r.retry=Qe(r.retry,t,n?.now);let i=$e({tasks:r.tasks,subagents:r.subagents},t);if(i)return{view:{...r,...i}};switch(t.type){case`message-upsert`:{let e=t.index;return r.messages.set(e,t.message),{view:r,lastIndex:nt(r.messages)}}case`messages-truncated`:{let e=t.length;for(let t of r.messages.keys())t>=e&&r.messages.delete(t);return{view:r,lastIndex:e-1}}case`status`:r.status=t.status;break;case`turn-completed`:r.status=`idle`;break;case`turn-failed`:r.status=`failed`;break;case`approval-request`:{let e=t.request??t;r.approvals=[...r.approvals,e];break}case`approval-resolved`:r.approvals=r.approvals.filter(e=>e.requestId!==t.requestId);break;case`ask-request`:{let e=t.ask??t;r.asks=[...r.asks,e];break}case`ask-resolved`:r.asks=r.asks.filter(e=>e.requestId!==t.requestId);break;case`compaction`:{let e=t.state;r.compaction=e===`queued`?`queued`:e===`start`?`running`:void 0,e===`end`&&!t.error&&!t.abandoned&&(r.compactionNoticeAt=nt(r.messages)+1);break}}return{view:r}}function it(e,t){let n=[];for(let r of t.sessions??[]){let t=r.sessionId??r.identity?.sessionId;if(!t)continue;let i=r.baseIndex??0,a=e.get(t)?.messages,o=a?.size?Math.max(...a.keys()):-1,s=a&&i<=o+1?new Map(a):new Map,c=r.messages??[];for(let e of s.keys())e>=i+c.length&&s.delete(e);for(let[e,t]of c.entries())s.set(i+e,t);n.push({id:t,view:{messages:s,status:r.status??`idle`,approvals:r.pendingApprovals??[],asks:r.pendingAsks??[],tasks:r.backgroundTasks??[],subagents:r.subagents??[],compaction:r.compaction,compactionNoticeAt:r.compactionNoticeAt??e.get(t)?.compactionNoticeAt},lastIndex:i+c.length-1})}return n}function at(e,t){if(t.messages.length===0)return e;let n=new Map(e.messages);for(let[e,r]of t.messages.entries())n.set(t.baseIndex+e,r);return{...e,messages:n}}function ot(e){let t=new Map;for(let[n,r]of e)t.set(n,{...r,status:`failed`,messages:new Map(r.messages)});return t}function st(e){if(e.api===`typesafe-system-one`||e.catalogId===`typesafe`)return!0;try{let t=new URL(e.baseUrl??``).hostname.toLowerCase();return t===`api.typesafe.ai`||t.endsWith(`.api.typesafe.ai`)}catch{return!1}}var ct={"openai-completions":`https://api.openai.com/v1`,"openai-responses":`https://api.openai.com/v1`,"anthropic-messages":`https://api.anthropic.com`,"google-generative-ai":`https://generativelanguage.googleapis.com/v1beta`,ollama:`http://127.0.0.1:11434`,"typesafe-system-one":`https://api.typesafe.ai/v1/`};ct[`google-generative-ai`],ct[`typesafe-system-one`],ct.ollama;var lt=`local-image`,ut=`__ensoRemoteLocalImagePrefix`;function dt(e){let t=globalThis[ut];return typeof t==`string`?`${t}${encodeURIComponent(e)}`:e}var ft=`posix`,pt=`secretary-avatar`,mt=(e,t)=>dt(`${lt}://${pt}/avatar.png?v=${e}${t?`&h=${encodeURIComponent(t)}`:``}`),ht=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`svg`,`jfif`,`avif`],gt=[`mp4`,`webm`,`ogg`,`ogv`,`mov`];[...ht,...gt];function _t(e){let t=e.split(/[?#]/)[0]??``,n=t.lastIndexOf(`.`);return n<0?``:t.slice(n+1).toLowerCase()}function vt(e){let t=e.replace(/\\/g,`/`);if(t.startsWith(`//`)){let[e,...n]=t.slice(2).split(`/`).filter(Boolean);return dt(`${lt}://${e}/${n.map(encodeURIComponent).join(`/`)}`)}let n=/^([a-zA-Z]):\/(.*)$/.exec(t);if(n){let e=n[2].split(`/`).filter(Boolean).map(encodeURIComponent);return dt(`${lt}://${n[1].toLowerCase()}/${e.join(`/`)}`)}return dt(`${lt}://${ft}/${t.split(`/`).filter(Boolean).map(encodeURIComponent).join(`/`)}`)}new Set(ht);var yt=[`system`,`user`,`tool_result`,`tool_args`,`assistant`,`tools`],bt=class{hits=new Map;blocked=!1;restored=0;add(e,t=1){let n=`${e.kind}\0${e.rule}\0${e.action}\0${e.where}\0${e.token}`,r=this.hits.get(n);r?r.count+=t:this.hits.set(n,{...e,count:t})}get empty(){return this.hits.size===0&&this.restored===0}build(){return{hits:[...this.hits.values()].map(e=>({...e})),blocked:this.blocked,restored:this.restored}}};new Set(yt);function xt(e,t){if(!e)return t;let n=new bt;for(let r of[...e.hits,...t.hits])n.add(r,r.count);return n.blocked=e.blocked||t.blocked,n.restored=e.restored+t.restored,n.build()}function St(e){let t=new Map;for(let n of e){let e=`${n.action}\0${n.kind}\0${n.where}`,r=t.get(e);r?(r.tokens.add(n.token),r.count+=n.count):t.set(e,{action:n.action,kind:n.kind,where:n.where,values:0,count:n.count,preview:n.preview,tokens:new Set([n.token])})}return[...t.values()].map(({tokens:e,...t})=>({...t,values:e.size}))}var Ct={mask:1,warn:2,block:3};function wt(e){let t;for(let n of e.hits)(!t||Ct[n.action]>Ct[t])&&(t=n.action);return t}var Tt={enabled:!1,secrets:{enabled:!0,action:`mask`,shape:!1},personal:{enabled:!1,action:`mask`,kinds:[`email`,`phone`,`idCard`,`bankCard`]},custom:{words:[],rules:[],action:`mask`},allow:[]},Et=Symbol.for(`yaml.alias`),Dt=Symbol.for(`yaml.document`),Ot=Symbol.for(`yaml.map`),kt=Symbol.for(`yaml.pair`),At=Symbol.for(`yaml.scalar`),jt=Symbol.for(`yaml.seq`),Mt=Symbol.for(`yaml.node.type`),Nt=e=>!!e&&typeof e==`object`&&e[Mt]===Et,Pt=e=>!!e&&typeof e==`object`&&e[Mt]===Dt,Ft=e=>!!e&&typeof e==`object`&&e[Mt]===Ot,It=e=>!!e&&typeof e==`object`&&e[Mt]===kt,Lt=e=>!!e&&typeof e==`object`&&e[Mt]===At,Rt=e=>!!e&&typeof e==`object`&&e[Mt]===jt;function zt(e){if(e&&typeof e==`object`)switch(e[Mt]){case Ot:case jt:return!0}return!1}function Bt(e){if(e&&typeof e==`object`)switch(e[Mt]){case Et:case Ot:case At:case jt:return!0}return!1}var Vt=e=>(Lt(e)||zt(e))&&!!e.anchor,Ht=Symbol(`break visit`),Ut=Symbol(`skip children`),Wt=Symbol(`remove node`);function Gt(e,t){let n=qt(t);Pt(e)?Kt(null,e.contents,n,Object.freeze([e]))===Wt&&(e.contents=null):Kt(null,e,n,Object.freeze([]))}Gt.BREAK=Ht,Gt.SKIP=Ut,Gt.REMOVE=Wt;function Kt(e,t,n,r){let i=Jt(e,t,n,r);if(Bt(i)||It(i))return Yt(e,r,i),Kt(e,i,n,r);if(typeof i!=`symbol`){if(zt(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Kt(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Ht)return Ht;else i===Wt&&(t.items.splice(e,1),--e)}}else if(It(t)){r=Object.freeze(r.concat(t));let e=Kt(`key`,t.key,n,r);if(e===Ht)return Ht;e===Wt&&(t.key=null);let i=Kt(`value`,t.value,n,r);if(i===Ht)return Ht;i===Wt&&(t.value=null)}}return i}function qt(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Jt(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Ft(t))return n.Map?.(e,t,r);if(Rt(t))return n.Seq?.(e,t,r);if(It(t))return n.Pair?.(e,t,r);if(Lt(t))return n.Scalar?.(e,t,r);if(Nt(t))return n.Alias?.(e,t,r)}function Yt(e,t,n){let r=t[t.length-1];if(zt(r))r.items[e]=n;else if(It(r))e===`key`?r.key=n:r.value=n;else if(Pt(r))r.contents=n;else{let e=Nt(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function Xt(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function Zt(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=Zt(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=Zt(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=Zt(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=Zt(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function Qt(e,t,n){if(Array.isArray(e))return e.map((e,t)=>Qt(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Vt(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var $t=class{constructor(e){Object.defineProperty(this,Mt,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Pt(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=Qt(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Zt(i,{"":o},``,o):o}},en=class extends $t{constructor(e){super(Et),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Gt(e,{Node:(e,t)=>{(Nt(t)||Vt(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(Qt(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=tn(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Xt(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function tn(e,t,n){if(Nt(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(zt(t)){let r=0;for(let i of t.items){let t=tn(e,i,n);t>r&&(r=t)}return r}if(It(t)){let r=tn(e,t.key,n),i=tn(e,t.value,n);return Math.max(r,i)}return 1}var nn=e=>!e||typeof e!=`function`&&typeof e!=`object`,Y=class extends $t{constructor(e){super(At),this.value=e}toJSON(e,t){return t?.keep?this.value:Qt(this.value,e,t)}toString(){return String(this.value)}};Y.BLOCK_FOLDED=`BLOCK_FOLDED`,Y.BLOCK_LITERAL=`BLOCK_LITERAL`,Y.PLAIN=`PLAIN`,Y.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Y.QUOTE_SINGLE=`QUOTE_SINGLE`;var rn=`tag:yaml.org,2002:`;function an(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function on(e,t,n){if(Pt(e)&&(e=e.contents),Bt(e))return e;if(It(e)){let t=n.schema[Ot].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new en(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=rn+t.slice(2));let l=an(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new Y(e);return c&&(c.node=t),t}l=e instanceof Map?o[Ot]:Symbol.iterator in Object(e)?o[jt]:o[Ot]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new Y(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function sn(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return on(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var cn=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,ln=class extends $t{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>Bt(t)||It(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(cn(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(zt(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,sn(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(zt(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&Lt(i)?i.value:i:zt(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!It(t))return!1;let n=t.value;return n==null||e&&Lt(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return zt(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(zt(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,sn(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},un=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function dn(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var fn=(e,t,n)=>e.endsWith(`
2
+ `)?dn(n,t):n.includes(`
3
+ `)?`
4
+ `+dn(n,t):(e.endsWith(` `)?``:` `)+n,pn=`flow`,mn=`block`,hn=`quoted`;function gn(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=_n(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
5
+ `)n===`block`&&(h=_n(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
6
+ `&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
7
+ `&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function _n(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
8
+ `);r=t,i=t+1,a=e[i]}return r}var vn=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),yn=e=>/^(%|---|\.\.\.)/m.test(e);function bn(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
9
+ `){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function xn(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(yn(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
10
+
11
+ `;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
12
+ `,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:gn(o,a,hn,vn(t,!1))}function Sn(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
13
+ `)||/[ \t]\n|\n[ \t]/.test(e))return xn(e,t);let n=t.indent||(yn(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:gn(r,n,pn,vn(t,!1))}function Cn(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=xn;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?Sn:i&&!t?xn:n?Sn:xn}return r(e,t)}var wn;try{wn=RegExp(`(^|(?<!
14
+ ))
15
+ +(?!
16
+ |$)`,`g`)}catch{wn=/\n+(?!\n|$)/g}function Tn({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return Cn(n,r);let l=r.indent||(r.forceBlockIndent||yn(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===Y.BLOCK_FOLDED?!1:t===Y.BLOCK_LITERAL||!bn(n,c,l.length);if(!n)return u?`|
17
+ `:`>
18
+ `;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
19
+ `&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
20
+ `);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
21
+ `&&(p=p.slice(0,-1)),p.replace(wn,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
22
+ `)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
23
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=vn(r,!0);o!==`folded`&&t!==Y.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=gn(`${v}${e}${p}`,l,mn,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function En(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
24
+ `)||u&&/[[\]{},]/.test(a))return Cn(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
25
+ `)?Cn(a,t):Tn(e,t,n,r);if(!s&&!u&&i!==Y.PLAIN&&a.includes(`
26
+ `))return Tn(e,t,n,r);if(yn(a)){if(c===``)return t.forceBlockIndent=!0,Tn(e,t,n,r);if(s&&c===l)return Cn(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return Cn(a,t)}return s?d:gn(d,c,pn,vn(t,!1))}function Dn(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==Y.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=Y.QUOTE_DOUBLE);let c=e=>{switch(e){case Y.BLOCK_FOLDED:case Y.BLOCK_LITERAL:return i||a?Cn(o.value,t):Tn(o,t,n,r);case Y.QUOTE_DOUBLE:return xn(o.value,t);case Y.QUOTE_SINGLE:return Sn(o.value,t);case Y.PLAIN:return En(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function On(e,t){let n=Object.assign({blockQuote:!0,commentString:un,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function kn(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(Lt(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function An(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(Lt(e)||zt(e))&&e.anchor;a&&Xt(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function jn(e,t,n,r){if(It(e))return e.toString(t,n,r);if(Nt(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=Bt(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=kn(t.doc.schema.tags,a);let o=An(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):Lt(a)?Dn(a,t,n,r):a.toString(t,n,r);return o?Lt(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Mn({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=Bt(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(zt(e)||!Bt(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||zt(e)||(Lt(e)?e.type===Y.BLOCK_FOLDED||e.type===Y.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=jn(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=fn(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=fn(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=fn(g,n.indent,l(f))));let _,v,y;Bt(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&Lt(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Rt(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=jn(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
27
+ `:``,v){let e=l(v);S+=`\n${dn(e,n.indent)}`}x===``&&!n.inFlow?S===`
28
+ `&&y&&(S=`
29
+
30
+ `):S+=`\n${n.indent}`}else if(!p&&zt(t)){let e=x[0],r=x.indexOf(`
31
+ `),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
32
+ `)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=fn(g,n.indent,l(y)):h&&i&&i(),g}function Nn(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Pn=`<<`,Fn={identify:e=>e===Pn||typeof e==`symbol`&&e.description===Pn,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new Y(Symbol(Pn)),{addToJSMap:Ln}),stringify:()=>Pn},In=(e,t)=>(Fn.identify(t)||Lt(t)&&(!t.type||t.type===Y.PLAIN)&&Fn.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Fn.tag&&e.default);function Ln(e,t,n){let r=zn(e,n);if(Rt(r))for(let n of r.items)Rn(e,t,n);else if(Array.isArray(r))for(let n of r)Rn(e,t,n);else Rn(e,t,r)}function Rn(e,t,n){let r=zn(e,n);if(!Ft(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function zn(e,t){return e&&Nt(t)?t.resolve(e.doc,e):t}function Bn(e,t,{key:n,value:r}){if(Bt(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(In(e,n))Ln(e,t,r);else{let i=Qt(n,``,e);if(t instanceof Map)t.set(i,Qt(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Vn(n,i,e),o=Qt(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Vn(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(Bt(e)&&n?.doc){let t=On(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Nn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Hn(e,t,n){return new Un(on(e,void 0,n),on(t,void 0,n))}var Un=class e{constructor(e,t=null){Object.defineProperty(this,Mt,{value:kt}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return Bt(n)&&(n=n.clone(t)),Bt(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Bn(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Mn(this,e,t,n):JSON.stringify(this)}};function Wn(e,t,n){return(t.inFlow??e.flow?Kn:Gn)(e,t,n)}function Gn({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(Bt(i))!d&&i.spaceBefore&&f.push(``),qn(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(It(i)){let e=Bt(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),qn(n,f,e.commentBefore,d))}d=!1;let s=jn(i,u,()=>o=null,()=>d=!0);o&&(s+=fn(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
33
+ `}}return e?(p+=`
34
+ `+dn(l(e),c),s&&s()):d&&o&&o(),p}function Kn({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(Bt(i))i.spaceBefore&&d.push(``),qn(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(It(i)){let e=Bt(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),qn(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=Bt(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=jn(i,c,()=>a=null);l||=d.length>u||o.includes(`
35
+ `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=fn(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
36
+ `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function qn({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=dn(t(r),e);n.push(i.trimStart())}}function Jn(e,t){let n=Lt(t)?t.value:t;for(let r of e)if(It(r)&&(r.key===t||r.key===n||Lt(r.key)&&r.key.value===n))return r}var Yn=class extends ln{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Ot,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Hn(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=It(e)?e:!e||typeof e!=`object`||!(`key`in e)?new Un(e,e?.value):new Un(e.key,e.value);let r=Jn(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);Lt(r.value)&&nn(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=Jn(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Jn(this.items,e)?.value;return(!t&&Lt(n)?n.value:n)??void 0}has(e){return!!Jn(this.items,e)}set(e,t){this.add(new Un(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Bn(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!It(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Wn(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},Xn={collection:`map`,default:!0,nodeClass:Yn,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Ft(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Yn.from(e,t,n)},Zn=class extends ln{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(jt,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Qn(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=Qn(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&Lt(r)?r.value:r}has(e){let t=Qn(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Qn(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Lt(r)&&nn(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(Qt(e,String(r++),t));return n}toString(e,t,n){return e?Wn(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(on(a,void 0,n))}}return i}};function Qn(e){let t=Lt(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var $n={collection:`seq`,default:!0,nodeClass:Zn,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Rt(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Zn.from(e,t,n)};function er(e){return typeof e==`bigint`||Number.isInteger(e)}var tr=({value:e})=>JSON.stringify(e),nr=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:tr},{identify:e=>e==null,createNode:()=>new Y(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:tr},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:tr},{identify:er,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>er(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:tr}];[Xn,$n].concat(nr,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function rr(e,t,n){let{replacer:r}=n,i=new Zn(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Hn(o,s,n))}return i}var ir=class e extends Zn{constructor(){super(),this.add=Yn.prototype.add.bind(this),this.delete=Yn.prototype.delete.bind(this),this.get=Yn.prototype.get.bind(this),this.has=Yn.prototype.has.bind(this),this.set=Yn.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(It(e)?(r=Qt(e.key,``,t),i=Qt(e.value,r,t)):r=Qt(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=rr(e,t,n),i=new this;return i.items=r.items,i}};ir.tag=`tag:yaml.org,2002:omap`;var ar=class e extends Yn{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=It(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new Un(e.key,null):new Un(e,null),Jn(this.items,t.key)||this.items.push(t)}get(e,t){let n=Jn(this.items,e);return!t&&It(n)?Lt(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Jn(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Un(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Hn(e,null,n));return i}};ar.tag=`tag:yaml.org,2002:set`;var or=Symbol(`break visit`),sr=Symbol(`skip children`),cr=Symbol(`remove item`);function lr(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),ur(Object.freeze([]),e,t)}lr.BREAK=or,lr.SKIP=sr,lr.REMOVE=cr,lr.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},lr.parentCollection=(e,t)=>{let n=lr.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function ur(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=ur(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===or)return or;else r===cr&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}var dr=[{id:`image_generation`,name:`ImageGen`,description:`Generate images with the configured image model and save them to the session scratch directory`},{id:`subagent`,name:`Subagent`,description:`Unified agents: delegate one-shot tasks or keep persistent coworkers under Main control`},{id:`workflow`,name:`Workflow`,description:`Run a JavaScript workflow that fans work out across subagents. Live status appears in the side panel.`},{id:`todo`,name:`Todo`,description:`Task list: track progress on multi-step work`},{id:`plan`,name:`Plan mode`,description:`Plan mode: research read-only, submit a plan for approval, then carry it out after approval`},{id:`ask_user`,name:`Ask user`,description:`Ask the user a question and wait for an answer (options / timeout)`},{id:`browser`,name:`Browser`,description:`Built-in browser: open pages in Enso's own Chromium, read snapshots, click and type by ref`},{id:`web`,name:`Web search`,description:`Web search and fetch: search with the session model's built-in search (falls back to a keyless service) and read public pages as markdown`},{id:`background_tasks`,name:`Background tasks`,description:`Background shell task: run long commands in the background and notify on completion`},{id:`memory`,name:`Memory`,description:`Long-term memory: the agent can search, capture and consolidate durable decisions, preferences and lessons across sessions`},{id:`turn_discard`,name:`Turn discard`,description:`Let the agent drop an irrelevant automatic delivery or throwaway exchange from its context; the timeline keeps it and turn_recall can read it back`},{id:`isolated_sandbox`,name:`Isolated sandbox`,description:`Run JavaScript in an isolated sandbox that can call session tools. Intermediate reads and edits stay out of the chat; only the returned value is added to the conversation.`},{id:`computer`,name:`Computer`,description:`Host desktop: list windows, screenshot, accessibility tree, and input. Default off. Not the built-in browser.`}],fr=[`memory`,`computer`];function pr(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[...fr]}function mr(e,t){return Array.isArray(t?.disabledBuiltinTools)?pr(t.disabledBuiltinTools):pr(e)}function hr(e,t,n,r){return!mr(e,{disabledBuiltinTools:gr(t,n)}).includes(r)}function gr(e,t){if(!(!t||!Array.isArray(e)))for(let n of e){if(!n||typeof n!=`object`||Array.isArray(n))continue;let e=n;if(e.id===t)return e.disabledBuiltinTools}}var _r=`<secretary-silent/>`,vr=`silence_turn`;function yr(e){return/<session-updates>|<secretary-schedule>/.test(e)?e.replace(/<session-updates>[\s\S]*?<\/session-updates>/g,``).replace(/<secretary-schedule>[\s\S]*?<\/secretary-schedule>/g,``).trim().length===0:!1}function br(e){return e.trim()===_r}var xr=`project_list.project_info.repo_status.session_list.session_read.session_tasks.session_activity.session_create.session_send.session_queue_list.session_queue_cancel.session_stop.session_task_stop.session_archive.result_mark_done.result_mark_undo.session_answer.session_takeover_propose.image_view.contact_send_file.cleanup_list.cleanup_apply.todo_list.todo_item_add.todo_item_update.todo_item_dispatch.schedule_add.schedule_list.schedule_remove.secretary_profile_propose.skill_propose.tool_propose`.split(`.`);[...xr];var Sr=new Set([`ask_user`,`web`,`memory`]);[...dr.map(e=>e.id).filter(e=>!Sr.has(e))];var Cr=15e3;Object.freeze({yieldDefaultMs:45e3,yieldBuildMs:18e4,yieldServerMs:1e4,quietMs:Cr,taskWaitMaxMs:3e4,maxTasks:20,logMaxBytes:268435456,killGraceMs:5e3});var wr=e=>!!e&&typeof e==`object`&&!Array.isArray(e),Tr=e=>Number.isInteger(e)&&e>=0,Er=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0;function Dr(e){if(!wr(e)||!Tr(e.inputTokens)||!Tr(e.outputTokens))return;let t={inputTokens:e.inputTokens,outputTokens:e.outputTokens};for(let n of[`cacheHitPercent`,`ttftAvgMs`,`tokensPerSecond`]){let r=e[n];if(r!==void 0){if(!Er(r))return;t[n]=r}}return t}var Or=e(i(),1),kr=e=>typeof e==`string`&&e.length>0,Ar=e=>!!e&&typeof e==`object`&&kr(e.data)&&kr(e.mimeType);function jr(e){if(!Array.isArray(e))return[];let t=new Set,n=[];for(let r of e){if(!r||typeof r!=`object`)continue;let e=r;if(!kr(e.deliveryId)||!kr(e.chatId)||typeof e.text!=`string`||typeof e.createdAt!=`number`||t.has(e.deliveryId)||e.images!==void 0&&!(Array.isArray(e.images)&&e.images.every(Ar)))continue;t.add(e.deliveryId);let i=e.status===`failed`;n.push({deliveryId:e.deliveryId,chatId:e.chatId,text:e.text,...e.images?{images:e.images}:{},createdAt:e.createdAt,status:i?`failed`:`pending`,...i&&typeof e.error==`string`?{error:e.error}:{}})}return n}var Mr=class{storage;pairId;items=[];listeners=new Set;writing=Promise.resolve();newId;now;durable=new Set;sentAt=new Map;loadFailed=!1;loading;constructor(e,t,n={}){this.storage=e,this.pairId=t,this.newId=n.newId??(()=>crypto.randomUUID()),this.now=n.now??Date.now}async restore(){let e=this.loadExisting();this.loading=e;try{await e}finally{this.loading===e&&(this.loading=void 0)}}async loadExisting(){let e;try{e=jr(await this.storage.load(this.pairId)),this.loadFailed=!1}catch(e){throw this.loadFailed=!0,e}let t=new Set(this.items.map(e=>e.deliveryId)),n=e.filter(e=>!t.has(e.deliveryId));if(n.length!==0){this.items=[...n,...this.items];for(let e of n)this.durable.add(e.deliveryId);for(let e of this.listeners)e([...this.items])}}list(e){return e?this.items.filter(t=>t.chatId===e):[...this.items]}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}enqueue(e){let t={deliveryId:this.newId(),chatId:e.chatId,text:e.text,...e.images?.length?{images:e.images}:{},createdAt:this.now(),status:`pending`};return this.items=[...this.items,t],this.changed(),t}drain(){let e=this.items.filter(e=>e.status===`pending`&&this.durable.has(e.deliveryId));if(e.length===0)return[];let t=new Set(e.map(e=>e.deliveryId));for(let e of t)this.sentAt.set(e,this.now());return this.update(e=>t.has(e.deliveryId)?{...e,status:`sending`}:e),e}interrupted(){this.sentAt.clear(),this.items.some(e=>e.status===`sending`)&&this.update(e=>e.status===`sending`?{...e,status:`pending`}:e)}settle(e,t,n){if(this.sentAt.delete(e),this.items.some(t=>t.deliveryId===e)){if(t){this.durable.delete(e),this.items=this.items.filter(t=>t.deliveryId!==e),this.changed();return}this.update(t=>t.deliveryId===e?{...t,status:`failed`,...n?{error:n}:{}}:t)}}retry(e){this.durable.delete(e),this.update(t=>{if(t.deliveryId!==e||t.status!==`failed`)return t;let{error:n,...r}=t;return{...r,status:`pending`}})}async discard(e){if(!this.items.some(t=>t.deliveryId===e))return;this.durable.delete(e),this.sentAt.delete(e),this.items=this.items.map(t=>t.deliveryId===e?{...t,status:`failed`,error:`outbox-discarding`}:t);for(let e of this.listeners)e([...this.items]);let t=this.writing.then(async()=>{try{await this.loading,this.loadFailed&&await this.loadExisting(),await this.storage.save(this.pairId,this.items.filter(t=>t.deliveryId!==e)),this.items=this.items.filter(t=>t.deliveryId!==e)}catch{this.items=this.items.map(t=>t.deliveryId===e?{...t,status:`failed`,error:`outbox-discard`}:t),await this.storage.save(this.pairId,this.items).catch(()=>{})}for(let e of this.listeners)e([...this.items])});return this.writing=t,t}flushed(){return this.writing}expire(e=this.now()){for(let[t,n]of this.sentAt)e-n>=6e4&&this.settle(t,!1,`delivery-unconfirmed`)}update(e){this.items=this.items.map(e),this.changed()}changed(){for(let e of this.listeners)e([...this.items]);this.writing=this.writing.then(async()=>{let e=[...this.items];try{await this.loading,this.loadFailed&&await this.loadExisting(),e=[...this.items],await this.storage.save(this.pairId,e);let t=!1;for(let n of e){let e=this.items.find(e=>e.deliveryId===n.deliveryId);!e||this.durable.has(n.deliveryId)||(this.durable.add(n.deliveryId),e.status===`pending`&&(t=!0))}if(t)for(let e of this.listeners)e([...this.items])}catch{this.items=this.items.map(t=>t.status!==`pending`||!e.includes(t)?t:(this.durable.delete(t.deliveryId),{...t,status:`failed`,error:`outbox-storage`}));for(let e of this.listeners)e([...this.items])}})}},Nr=`enso-phone-outbox`,Pr=`outbox`;function Fr(e=globalThis.indexedDB){let t=null,n=()=>e?(t??=new Promise((t,n)=>{let r=e.open(Nr,1);r.onupgradeneeded=()=>{r.result.objectStoreNames.contains(Pr)||r.result.createObjectStore(Pr)},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error)}).catch(e=>{throw t=null,e}),t):Promise.reject(Error(`IndexedDB unavailable`)),r=async(e,t)=>{let r=await n();return new Promise((n,i)=>{let a=r.transaction(Pr,e),o=t(a.objectStore(Pr));a.oncomplete=()=>n(o.result),a.onabort=()=>i(a.error??Error(`Outbox transaction aborted`)),a.onerror=()=>i(a.error),o.onerror=()=>i(o.error)})};return{load:e=>r(`readonly`,t=>t.get(e)),save:async(e,t)=>{await r(`readwrite`,n=>t.length>0?n.put(t,e):n.delete(e))},remove:async e=>{await r(`readwrite`,t=>t.delete(e))}}}var Ir=Fr();function Lr(e){return{expandLiveReasoning:e.expandLiveReasoning!==!1,autoCollapseTurns:e.autoCollapseTurns===!0,collapseCompletedActivity:e.collapseCompletedActivity!==!1,collapseLiveActivity:e.collapseLiveActivity===!0,pinUnfinishedTodos:e.pinUnfinishedTodos!==!1}}var Rr={language:`system`,theme:`system`,terminalTheme:``,terminalFontFamily:``,syncTerminalTheme:!1,providers:[],projects:[],skills:[],presets:[],agentTypes:[],loadLocalSkills:!0,compactReadOnlyTools:!0,expandLiveEdits:!0,...Lr({}),keybindings:{},privacyMasking:Tt,contextMenuOpen:[]},zr=new Set;function Br(e){let t=Rr;Rr={...Rr,...e};for(let e of zr)e(Rr,t)}var Vr;function Hr(e,t){Vr=e,Br({terminalTheme:e?`host`:``,terminalFontFamily:t??``})}function Ur(e){Rr.compactReadOnlyTools!==e&&Br({compactReadOnlyTools:e})}function Wr(e){Rr.expandLiveEdits!==e&&Br({expandLiveEdits:e})}function Gr(e){Object.keys(e).some(t=>Rr[t]!==e[t])&&Br(e)}function Kr(e,t){(Rr.theme!==e||Rr.syncTerminalTheme!==t)&&Br({theme:e,syncTerminalTheme:t})}function qr(){return Vr}var Jr=e=>(zr.add(e),()=>{zr.delete(e)});function Yr(e){return(0,Or.useSyncExternalStore)(Jr,()=>e(Rr))}Yr.getState=()=>Rr,Yr.subscribe=Jr;var Xr={background:`#1e1e1e`,foreground:`#d4d4d4`,cursor:`#d4d4d4`,cursorAccent:`#1e1e1e`,selectionBackground:`#264f78`,selectionForeground:`#ffffff`,black:`#000000`,red:`#cd3131`,green:`#0dbc79`,yellow:`#e5e510`,blue:`#2472c8`,magenta:`#bc3fbc`,cyan:`#11a8cd`,white:`#e5e5e5`,brightBlack:`#666666`,brightRed:`#f14c4c`,brightGreen:`#23d18b`,brightYellow:`#f5f543`,brightBlue:`#3b8eea`,brightMagenta:`#d670d6`,brightCyan:`#29b8db`,brightWhite:`#ffffff`};function Zr(e){return qr()}function Qr(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})/i.exec(e.trim());return t?{r:Number.parseInt(t[1],16),g:Number.parseInt(t[2],16),b:Number.parseInt(t[3],16)}:null}function $r(e,t,n){return`#${[e,t,n].map(e=>Math.round(e).toString(16).padStart(2,`0`)).join(``)}`}function ei(e,t,n){let r=Qr(e),i=Qr(t);if(!r||!i)return e;let a=Math.max(0,Math.min(1,n));return $r(r.r*(1-a)+i.r*a,r.g*(1-a)+i.g*a,r.b*(1-a)+i.b*a)}function ti(e){let t=Qr(e);if(!t)return 0;let[n,r,i]=[t.r,t.g,t.b].map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*n+.7152*r+.0722*i}function ni(e){let t=Zr();return!t||ti(t.background)<.5}var ri=[`--background`,`--foreground`,`--card`,`--card-foreground`,`--popover`,`--popover-foreground`,`--primary`,`--primary-foreground`,`--secondary`,`--secondary-foreground`,`--muted`,`--muted-foreground`,`--accent`,`--accent-foreground`,`--destructive`,`--destructive-foreground`,`--success`,`--success-foreground`,`--warning`,`--warning-foreground`,`--info`,`--info-foreground`,`--border`,`--input`,`--ring`];function ii(e,t=!0){let n=Zr();if(!n)return;let r=document.documentElement,i=ti(n.background)<.5;t&&r.classList.toggle(`dark`,i),r.style.setProperty(`--background`,n.background),r.style.setProperty(`--foreground`,n.foreground),r.style.setProperty(`--card`,n.background),r.style.setProperty(`--card-foreground`,n.foreground),r.style.setProperty(`--popover`,n.background),r.style.setProperty(`--popover-foreground`,n.foreground),r.style.setProperty(`--primary`,n.foreground),r.style.setProperty(`--primary-foreground`,n.background);let a=i?ei(n.background,n.brightBlack,.5):ei(n.background,n.black,.1);r.style.setProperty(`--secondary`,a),r.style.setProperty(`--secondary-foreground`,n.foreground);let o=i?ei(n.background,n.brightBlack,.4):ei(n.background,n.black,.08),s=i?ei(n.foreground,n.background,.4):ei(n.foreground,n.background,.3);r.style.setProperty(`--muted`,o),r.style.setProperty(`--muted-foreground`,s);let c=i?n.brightBlue:n.blue,l=ei(n.background,c,.3);r.style.setProperty(`--accent`,l),r.style.setProperty(`--accent-foreground`,ti(l)<.5?`#ffffff`:`#000000`),r.style.setProperty(`--destructive`,n.red),r.style.setProperty(`--destructive-foreground`,`#ffffff`),r.style.setProperty(`--success`,n.green),r.style.setProperty(`--success-foreground`,`#ffffff`),r.style.setProperty(`--warning`,n.yellow),r.style.setProperty(`--warning-foreground`,i?n.background:`#000000`),r.style.setProperty(`--info`,n.blue),r.style.setProperty(`--info-foreground`,`#ffffff`);let u=i?ei(n.background,n.foreground,.15):ei(n.background,n.foreground,.12);r.style.setProperty(`--border`,u),r.style.setProperty(`--input`,u),r.style.setProperty(`--ring`,i?n.brightBlue:n.blue)}function ai(){for(let e of ri)document.documentElement.style.removeProperty(e)}var oi={state:`synced`,knownIds:new Set};function si(e,t,n){return{...e,state:t&&!n?.fresh?`syncing`:`synced`}}function ci(e,t,n){return!t||!n.includes(t)?e:{...e,state:`synced`}}function li(e,t,n){let r=t!==null&&e.knownIds.has(t)&&!n.includes(t);return{tracking:{state:r?`synced`:e.state,knownIds:new Set(n)},ghost:r}}var ui=1,di=`enso-phone-session-cache`,fi=`pairs`,pi=2,mi=8e3,hi={ttlMs:6048e5,maxSessions:5,maxMessages:200,maxDeviceBytes:4194304,maxRecords:8,maxTotalBytes:16777216},X=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Z=e=>typeof e==`string`,gi=e=>typeof e==`boolean`,Q=e=>typeof e==`number`&&Number.isFinite(e)&&Math.abs(e)<=2**53-1,_i=e=>Q(e)&&Number.isSafeInteger(e)&&e>=0,$=(e,t,n)=>e[t]===void 0||n(e[t]);function vi(e,t){if(!Array.isArray(e))return null;let n=[];for(let r of e){let e=t(r);if(e===null)return null;n.push(e)}return n}function yi(e,t){if(!Array.isArray(e))return null;let n=[];for(let r of e){let e=t(r);e&&n.push(e)}return n}function bi(e){let t=new Set,n=[];for(let r of e)t.has(r.id)||(t.add(r.id),n.push(r));return n}function xi(e){return new Set(e).size===e.length}function Si(e){if(!X(e)||!Z(e.id)||!Z(e.title)||!Z(e.projectId)||!Z(e.status)||!$(e,`projectName`,Z)||!$(e,`cwd`,Z)||!$(e,`unread`,gi)||!$(e,`pendingAskCount`,_i)||!$(e,`pendingApprovalCount`,_i)||!$(e,`parentId`,Z)||!$(e,`updatedAt`,_i)||!$(e,`pinned`,gi)||!$(e,`archived`,gi)||!$(e,`muted`,gi)||!$(e,`providerId`,Z)||!$(e,`modelId`,Z)||!$(e,`reasoningEnabled`,gi))return null;let t=e.queued===void 0?void 0:yi(e.queued,e=>!X(e)||!Z(e.id)||!Z(e.text)||!$(e,`hasImages`,gi)?null:{id:e.id,text:e.text,...typeof e.hasImages==`boolean`?{hasImages:e.hasImages}:{}}),n;if(e.goal!==void 0){if(!X(e.goal)||!Z(e.goal.text)||!_i(e.goal.autoTurns)||!$(e.goal,`note`,Z))return null;let t=e.goal.status;if(t!==`active`&&t!==`paused`&&t!==`completed`&&t!==`blocked`&&t!==`waiting`)return null;n={text:e.goal.text,status:t,autoTurns:e.goal.autoTurns,...typeof e.goal.note==`string`?{note:e.goal.note}:{}}}let r=e.slashCommands===void 0?void 0:yi(e.slashCommands,e=>X(e)&&Z(e.name)&&Z(e.description)?{name:e.name,description:e.description}:null),i={id:e.id,title:e.title,projectName:Z(e.projectName)?e.projectName:``,projectId:e.projectId,status:e.status};typeof e.cwd==`string`&&(i.cwd=e.cwd),typeof e.unread==`boolean`&&(i.unread=e.unread),typeof e.pendingAskCount==`number`&&(i.pendingAskCount=e.pendingAskCount),typeof e.pendingApprovalCount==`number`&&(i.pendingApprovalCount=e.pendingApprovalCount),typeof e.parentId==`string`&&(i.parentId=e.parentId),typeof e.updatedAt==`number`&&(i.updatedAt=e.updatedAt),typeof e.pinned==`boolean`&&(i.pinned=e.pinned),typeof e.archived==`boolean`&&(i.archived=e.archived),e.muted===!0&&(i.muted=!0),typeof e.providerId==`string`&&(i.providerId=e.providerId),typeof e.modelId==`string`&&(i.modelId=e.modelId),typeof e.reasoningEnabled==`boolean`&&(i.reasoningEnabled=e.reasoningEnabled),(e.thinkingLevel===`minimal`||e.thinkingLevel===`low`||e.thinkingLevel===`medium`||e.thinkingLevel===`high`||e.thinkingLevel===`xhigh`||e.thinkingLevel===`max`)&&(i.thinkingLevel=e.thinkingLevel),t&&(i.queued=t),n&&(i.goal=n),r&&(i.slashCommands=r);let a=Ci(e.context);a&&(i.context=a);let o=Dr(e.usageTotals);return o&&(i.usageTotals=o),i}function Ci(e){if(!(!X(e)||!_i(e.used)||!$(e,`window`,_i)))return typeof e.window==`number`?{used:e.used,window:e.window}:{used:e.used}}function wi(e){return!X(e)||!Z(e.id)||!Z(e.name)||!$(e,`path`,Z)||!$(e,`alias`,Z)||!$(e,`sshConnectionName`,Z)||!$(e,`sshHost`,Z)||!$(e,`groupId`,Z)||e.kind!==void 0&&e.kind!==`local`&&e.kind!==`ssh`||e.archived!==void 0&&e.archived!==!0?null:{id:e.id,name:e.name,path:Z(e.path)?e.path:``,...typeof e.alias==`string`?{alias:e.alias}:{},...e.kind===`local`||e.kind===`ssh`?{kind:e.kind}:{},...typeof e.sshConnectionName==`string`?{sshConnectionName:e.sshConnectionName}:{},...typeof e.sshHost==`string`?{sshHost:e.sshHost}:{},...e.archived===!0?{archived:!0}:{},...typeof e.groupId==`string`?{groupId:e.groupId}:{}}}function Ti(e){return!X(e)||!Z(e.id)||!Z(e.name)||!Q(e.order)||!$(e,`emoji`,Z)||!$(e,`color`,Z)?null:{id:e.id,name:e.name,order:e.order,...typeof e.emoji==`string`?{emoji:e.emoji}:{},...typeof e.color==`string`?{color:e.color}:{}}}function Ei(e){if(!X(e)||!Z(e.id)||!Z(e.name))return null;let t=yi(e.models,e=>!X(e)||!Z(e.id)||!$(e,`label`,Z)?null:{id:e.id,...typeof e.label==`string`?{label:e.label}:{}});return t?{id:e.id,name:e.name,models:bi(t)}:null}var Di={ok:!1};function Oi(e,t={nodes:0,seen:new WeakSet},n=0){if(t.nodes+=1,t.nodes>2e5||n>32)return Di;if(e===null||Z(e)||gi(e)||Q(e))return{ok:!0,value:e};if(Array.isArray(e)){if(t.seen.has(e))return Di;t.seen.add(e);let r=[];for(let i of e){let e=Oi(i,t,n+1);if(!e.ok)return Di;r.push(e.value)}return t.seen.delete(e),{ok:!0,value:r}}if(!X(e))return Di;let r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null||t.seen.has(e))return Di;t.seen.add(e);let i={};for(let[r,a]of Object.entries(e)){if(a===void 0)continue;let e=Oi(a,t,n+1);if(!e.ok)return Di;Object.defineProperty(i,r,{value:e.value,enumerable:!0,configurable:!0,writable:!0})}return t.seen.delete(e),{ok:!0,value:i}}function ki(e){if(!X(e))return null;switch(e.type){case`text`:return Z(e.text)?{type:`text`,text:e.text}:null;case`thinking`:return Z(e.text)?{type:`thinking`,text:e.text}:null;case`toolCall`:{if(!Z(e.id)||!Z(e.name))return null;if(e.arguments===void 0)return{type:`toolCall`,id:e.id,name:e.name};let t=Oi(e.arguments);return t.ok?{type:`toolCall`,id:e.id,name:e.name,arguments:t.value}:null}case`image`:return Z(e.data)&&Z(e.mimeType)?{type:`image`,data:e.data,mimeType:e.mimeType}:null;case`unknown`:return{type:`unknown`};default:return null}}function Ai(e){return!X(e)||!Q(e.input)||!Q(e.output)||!Q(e.cacheRead)||!Q(e.cacheWrite)?null:{input:e.input,output:e.output,cacheRead:e.cacheRead,cacheWrite:e.cacheWrite}}function ji(e){return!X(e)||!Q(e.stepStartMs)||!$(e,`firstTokenMs`,Q)||!$(e,`thinkingEndMs`,Q)||!$(e,`completedMs`,Q)?null:{stepStartMs:e.stepStartMs,...typeof e.firstTokenMs==`number`?{firstTokenMs:e.firstTokenMs}:{},...typeof e.thinkingEndMs==`number`?{thinkingEndMs:e.thinkingEndMs}:{},...typeof e.completedMs==`number`?{completedMs:e.completedMs}:{}}}function Mi(e){if(!X(e)||!Z(e.role))return null;let t=vi(e.content,ki);if(!t||!$(e,`toolName`,Z)||!$(e,`toolCallId`,Z)||!$(e,`isError`,gi)||!$(e,`stopReason`,Z)||!$(e,`errorMessage`,Z)||!$(e,`timestamp`,Q)||!$(e,`ttft`,Q)||!$(e,`duration`,Q)||!$(e,`toolDurationMs`,Q)||!$(e,`tokensBefore`,Q)||!$(e,`verified`,gi)||!$(e,`memory`,gi))return null;let n=e.usage===void 0?void 0:Ai(e.usage),r=e.timing===void 0?void 0:ji(e.timing);if(e.usage!==void 0&&!n||e.timing!==void 0&&!r)return null;let i=e.todos===void 0?void 0:vi(e.todos,e=>!X(e)||!Z(e.content)||e.status!==`pending`&&e.status!==`in_progress`&&e.status!==`completed`?null:{content:e.content,status:e.status});if(e.todos!==void 0&&!i)return null;let a;if(e.subagentMeta!==void 0){if(!X(e.subagentMeta)||!$(e.subagentMeta,`modelId`,Z)||!$(e.subagentMeta,`outputTokens`,Q)||!$(e.subagentMeta,`steps`,Q))return null;a={...typeof e.subagentMeta.modelId==`string`?{modelId:e.subagentMeta.modelId}:{},...typeof e.subagentMeta.outputTokens==`number`?{outputTokens:e.subagentMeta.outputTokens}:{},...typeof e.subagentMeta.steps==`number`?{steps:e.subagentMeta.steps}:{}}}let o;if(e.editDiff!==void 0){if(!X(e.editDiff)||!Z(e.editDiff.oldText)||!Z(e.editDiff.newText))return null;o={oldText:e.editDiff.oldText,newText:e.editDiff.newText}}let s=e.fileChanges===void 0?void 0:vi(e.fileChanges,e=>!X(e)||!Z(e.path)||!Z(e.oldText)||!Z(e.newText)||e.type!==`add`&&e.type!==`update`&&e.type!==`delete`||e.truncated!==void 0&&e.truncated!==!0?null:{path:e.path,oldText:e.oldText,newText:e.newText,type:e.type,...e.truncated===!0?{truncated:!0}:{}});if(e.fileChanges!==void 0&&!s)return null;let c;if(e.applyPatchOutcome!==void 0){let t=e.applyPatchOutcome;if(!X(t)||t.status!==`success`&&t.status!==`partial`&&t.status!==`failed`||!$(t,`error`,Z)||!$(t,`input`,Z)||t.errorTruncated!==void 0&&t.errorTruncated!==!0||t.inputTruncated!==void 0&&t.inputTruncated!==!0)return null;let n=vi(t.applied,e=>Z(e)?e:null),r=vi(t.failed,e=>Z(e)?e:null),i=vi(t.unattempted,e=>Z(e)?e:null),a=vi(t.uncertain,e=>Z(e)?e:null);if(!n||!r||!i||!a)return null;c={status:t.status,applied:n,failed:r,unattempted:i,uncertain:a,...typeof t.error==`string`?{error:t.error}:{},...t.errorTruncated===!0?{errorTruncated:!0}:{},...typeof t.input==`string`?{input:t.input}:{},...t.inputTruncated===!0?{inputTruncated:!0}:{}}}let l={role:e.role,content:t};return typeof e.toolName==`string`&&(l.toolName=e.toolName),typeof e.toolCallId==`string`&&(l.toolCallId=e.toolCallId),typeof e.isError==`boolean`&&(l.isError=e.isError),typeof e.stopReason==`string`&&(l.stopReason=e.stopReason),typeof e.errorMessage==`string`&&(l.errorMessage=e.errorMessage),typeof e.timestamp==`number`&&(l.timestamp=e.timestamp),n&&(l.usage=n),typeof e.ttft==`number`&&(l.ttft=e.ttft),typeof e.duration==`number`&&(l.duration=e.duration),r&&(l.timing=r),i&&(l.todos=i),typeof e.toolDurationMs==`number`&&(l.toolDurationMs=e.toolDurationMs),a&&(l.subagentMeta=a),o&&(l.editDiff=o),s&&(l.fileChanges=s),c&&(l.applyPatchOutcome=c),typeof e.tokensBefore==`number`&&(l.tokensBefore=e.tokensBefore),typeof e.verified==`boolean`&&(l.verified=e.verified),typeof e.memory==`boolean`&&(l.memory=e.memory),l}function Ni(e){return vi(e,e=>!X(e)||!Z(e.requestId)||!Z(e.tool)||!Z(e.summary)||!$(e,`toolCallId`,Z)||e.phase!==void 0&&e.phase!==`reviewing`||e.kind!==`command`&&e.kind!==`file-edit`&&e.kind!==`file-write`&&e.kind!==`mcp`?null:{requestId:e.requestId,tool:e.tool,kind:e.kind,summary:e.summary,...typeof e.toolCallId==`string`?{toolCallId:e.toolCallId}:{},...e.phase===`reviewing`?{phase:`reviewing`}:{},...typeof e.expiresAt==`number`?{expiresAt:e.expiresAt}:{}})}function Pi(e){return vi(e,e=>{if(!X(e)||!Z(e.requestId)||!Z(e.question))return null;let t=e.options===void 0?void 0:vi(e.options,e=>Z(e)?e:null);return e.options!==void 0&&!t?null:{requestId:e.requestId,question:e.question,...t?{options:t}:{},...typeof e.expiresAt==`number`?{expiresAt:e.expiresAt}:{}}})}function Fi(e){return vi(e,e=>!X(e)||!Z(e.taskId)||!Z(e.command)||!Z(e.tail)||!Q(e.startedAt)||!$(e,`exitCode`,Q)||e.status!==`running`&&e.status!==`done`&&e.status!==`failed`?null:{taskId:e.taskId,command:e.command,status:e.status,tail:e.tail,startedAt:e.startedAt,...typeof e.exitCode==`number`?{exitCode:e.exitCode}:{}})}function Ii(e){return vi(e,e=>{if(!X(e)||!Z(e.id)||!Z(e.description)||!Q(e.steps)||!Z(e.currentActivity)||!Q(e.startedAt)||!$(e,`detailsPruned`,gi)||!$(e,`resultText`,Z)||!$(e,`modelId`,Z)||!$(e,`agentType`,Z)||!$(e,`outputTokens`,Q)||e.status!==`running`&&e.status!==`done`&&e.status!==`failed`)return null;let t=e.activityLog===void 0?void 0:vi(e.activityLog,e=>Z(e)?e:null),n=e.activities===void 0?void 0:vi(e.activities,e=>!X(e)||!Z(e.id)?null:e.type===`assistant`&&Z(e.text)&&gi(e.streaming)?{id:e.id,type:`assistant`,text:e.text,streaming:e.streaming}:e.type===`tool`&&Z(e.toolName)&&Z(e.argumentsText)&&$(e,`outputText`,Z)&&(e.status===`running`||e.status===`done`||e.status===`failed`||e.status===`aborted`)?{id:e.id,type:`tool`,toolName:e.toolName,argumentsText:e.argumentsText,status:e.status,...typeof e.outputText==`string`?{outputText:e.outputText}:{}}:null);return e.activityLog!==void 0&&!t||e.activities!==void 0&&!n?null:{id:e.id,description:e.description,status:e.status,steps:e.steps,currentActivity:e.currentActivity,startedAt:e.startedAt,...t?{activityLog:t}:{},...n?{activities:n}:{},...typeof e.detailsPruned==`boolean`?{detailsPruned:e.detailsPruned}:{},...typeof e.resultText==`string`?{resultText:e.resultText}:{},...typeof e.modelId==`string`?{modelId:e.modelId}:{},...typeof e.agentType==`string`?{agentType:e.agentType}:{},...typeof e.outputTokens==`number`?{outputTokens:e.outputTokens}:{}}})}function Li(e,t){if(!X(e)||!Z(e.status))return null;let n=Ni(e.approvals),r=Pi(e.asks),i=Fi(e.tasks),a=Ii(e.subagents);if(!n||!r||!i||!a)return null;let o;if(e.retry!==void 0){if(!X(e.retry)||!_i(e.retry.attempt)||!_i(e.retry.maxAttempts)||!_i(e.retry.delayMs)||!Z(e.retry.error)||!Q(e.retry.at))return null;o={attempt:e.retry.attempt,maxAttempts:e.retry.maxAttempts,delayMs:e.retry.delayMs,error:e.retry.error,at:e.retry.at}}return e.compaction!==void 0&&e.compaction!==`queued`&&e.compaction!==`running`||!$(e,`compactionNoticeAt`,_i)?null:{messages:t,status:e.status,approvals:n,asks:r,tasks:i,subagents:a,...o?{retry:o}:{},...e.compaction===`queued`||e.compaction===`running`?{compaction:e.compaction}:{},...typeof e.compactionNoticeAt==`number`?{compactionNoticeAt:e.compactionNoticeAt}:{}}}function Ri(e){return X(e)&&Z(e.epoch)&&e.epoch.length>0&&_i(e.seq)?{epoch:e.epoch,seq:e.seq}:null}function zi(e,t){if(!X(e)||!Z(e.id)||!X(e.view)||!(e.view.messages instanceof Map))return null;let n=[...e.view.messages.entries()];if(n.some(([e])=>!_i(e)))return null;n.sort((e,t)=>e[0]-t[0]);let r=Math.max(0,n.length-1);for(;r>0&&n[r-1][0]===n[r][0]-1;)--r;let i=n.slice(Math.max(r,n.length-t));if(n.length>0&&i.length===0)return null;let a=[];for(let[e,t]of i){let n=Mi(t);n&&a.push([e,n])}let o=Li(e.view,new Map(a));if(!o)return null;let s=e.cursor===void 0?void 0:Ri(e.cursor);return e.cursor!==void 0&&!s?null:{id:e.id,view:{...o,messages:a},...s?{cursor:s}:{}}}function Bi(e,t){if(!X(e)||!Z(e.id)||!X(e.view))return null;let n=e.view.messages;if(!Array.isArray(n)||n.length>t.maxMessages)return null;let r=new Map,i;for(let e of n){if(!Array.isArray(e)||e.length!==2||!_i(e[0])||i!==void 0&&e[0]<=i)return null;let t=Mi(e[1]);if(!t||r.has(e[0]))return null;r.set(e[0],t),i=e[0]}let a=Li(e.view,r);if(!a)return null;let o=e.cursor===void 0?void 0:Ri(e.cursor);return e.cursor!==void 0&&!o?null:{id:e.id,view:a,...o?{cursor:o}:{}}}function Vi(e){if(!X(e))return null;let t=yi(e.catalog,Si)??[],n=yi(e.pinnedOrder,e=>Z(e)?e:null)??[],r=yi(e.projects,wi)??[],i=yi(e.projectGroups,Ti)??[],a=yi(e.providers,Ei)??[],o=[...new Set(n)];return{catalog:bi(t),pinnedOrder:o,projects:bi(r),projectGroups:bi(i),providers:bi(a)}}function Hi(e){try{let t=JSON.stringify(e);return t===void 0?null:new TextEncoder().encode(t).byteLength}catch{return null}}function Ui(e,t){if(!X(e)||!Array.isArray(e.sessions))return console.warn(`[pair] cache encode skipped`),null;let n=Vi(e)??{catalog:[],pinnedOrder:[],projects:[],projectGroups:[],providers:[]},r=[],i=t.maxSessions===0?[]:e.sessions.slice(-t.maxSessions);for(let e of i){let n=zi(e,t.maxMessages);n&&r.push(n)}if(!xi(r.map(e=>e.id)))return null;let a={...n,sessions:r},o=Hi(a);if(o===null)return null;for(;o>t.maxDeviceBytes&&a.sessions.length>1;)if(a.sessions.shift(),o=Hi(a),o===null)return null;if(o<=t.maxDeviceBytes)return a;let s=a.sessions[0];if(s?.view.messages.length){let e=s.view.messages,n=1,r=e.length-1,i=-1;for(;n<=r;){let o=Math.floor((n+r)/2);s.view.messages=e.slice(o);let c=Hi(a);c!==null&&c<=t.maxDeviceBytes?(i=o,r=o-1):n=o+1}if(i>=0)return s.view.messages=e.slice(i),a}return a.sessions=[],o=Hi(a),o!==null&&o<=t.maxDeviceBytes?a:null}function Wi(e,t){let n=Vi(e);if(!n||!X(e)||!Array.isArray(e.sessions)||e.sessions.length>t.maxSessions)return null;let r=vi(e.sessions,e=>Bi(e,t));return!r||!xi(r.map(e=>e.id))?null:{...n,sessions:r}}function Gi(e,t,n,r){if(!X(e)||!_i(r)||e.schema!==ui||e.pairId!==t||!_i(e.updatedAt)||!_i(e.accessedAt)||!_i(e.bytes)||r-e.updatedAt>n.ttlMs)return null;let i=Hi(e.data),a=Hi(e);if(i===null||i!==e.bytes||i>n.maxDeviceBytes||a===null||a>n.maxDeviceBytes)return null;let o=Wi(e.data,n);if(!o)return null;let s=Ki(t,e.updatedAt,n.maxDeviceBytes),c=Ui(o,{...n,maxDeviceBytes:s}),l=c?Hi(c):null;return!c||l===null?null:{data:o,record:{pairId:t,schema:ui,updatedAt:e.updatedAt,accessedAt:e.accessedAt,bytes:l,data:c}}}function Ki(e,t,n){let r=Hi({pairId:e,schema:ui,updatedAt:t,accessedAt:t,bytes:n,data:null});return r===null?0:Math.max(0,n-(r-4))}function qi(e,t,n){let r=[],i=[];for(let t of e){let e=t.value,n=Hi(e);if(!X(e)||e.schema!==ui||e.pairId!==t.key||!_i(e.accessedAt)||n===null){r.push(t.key);continue}i.push({key:t.key,accessedAt:e.accessedAt,bytes:n})}i.sort((e,t)=>t.accessedAt-e.accessedAt||Number(t.key===n)-Number(e.key===n)||e.key.localeCompare(t.key));let a=0,o=0;for(let e of i)o>=t.maxRecords||a+e.bytes>t.maxTotalBytes?r.push(e.key):(o+=1,a+=e.bytes);return[...new Set(r)]}var Ji=class{factory;timeoutMs;opening=null;constructor(e,t){this.factory=e,this.timeoutMs=t}database(){if(!this.opening){let e=this.open();this.opening=e,e.catch(()=>{this.opening===e&&(this.opening=null)})}return this.opening}open(){return new Promise((e,t)=>{let n;try{n=this.factory.open(di,pi)}catch(e){t(e);return}let r=!1,i=(n,i)=>{if(r){n?.close();return}r=!0,clearTimeout(a),n?e(n):t(i??Error(`IndexedDB unavailable`))},a=setTimeout(()=>i(null,Error(`IndexedDB open timeout`)),this.timeoutMs);n.onupgradeneeded=()=>{try{n.result.objectStoreNames.contains(fi)||n.result.createObjectStore(fi)}catch(e){try{n.transaction?.abort()}catch{}i(null,e)}},n.onsuccess=()=>{n.result.onversionchange=()=>n.result.close(),i(n.result)},n.onerror=()=>i(null,n.error),n.onblocked=()=>{}})}async read(e){let t=await this.database();return new Promise((n,r)=>{let i;try{i=t.transaction(fi,`readonly`)}catch(e){r(e);return}let a,o=!1,s=(e,t)=>{o||(o=!0,clearTimeout(c),t?r(t):n(e))},c=setTimeout(()=>{try{i.abort()}catch{}s(null,Error(`IndexedDB transaction timeout`))},this.timeoutMs),l=i.objectStore(fi).get(e);l.onsuccess=()=>{a=l.result},i.oncomplete=()=>s(a),i.onabort=()=>s(null,i.error??Error(`IndexedDB aborted`)),i.onerror=()=>{}})}async write(e,t,n){let r=await this.database();return new Promise((i,a)=>{let o;try{o=r.transaction(fi,`readwrite`)}catch(e){a(e);return}let s=!1,c=e=>{s||(s=!0,clearTimeout(l),e?a(e):i())},l=setTimeout(()=>{try{o.abort()}catch{}c(Error(`IndexedDB transaction timeout`))},this.timeoutMs),u=o.objectStore(fi),d=u.getAll(),f=u.getAllKeys(),p=!1,m=!1,h=()=>{if(!(!p||!m))try{let r=[];for(let t=0;t<f.result.length;t+=1){let n=f.result[t];typeof n==`string`&&n!==e&&r.push({key:n,value:d.result[t]})}r.push({key:e,value:t}),u.put(t,e);for(let e of n(r))u.delete(e)}catch(e){try{o.abort()}catch{}c(e)}};d.onsuccess=()=>{p=!0,h()},f.onsuccess=()=>{m=!0,h()},o.oncomplete=()=>c(),o.onabort=()=>c(o.error??Error(`IndexedDB aborted`)),o.onerror=()=>{}})}async remove(e){let t=await this.database();return new Promise((n,r)=>{let i;try{i=t.transaction(fi,`readwrite`),i.objectStore(fi).delete(e)}catch(e){r(e);return}let a=!1,o=e=>{a||(a=!0,clearTimeout(s),e?r(e):n())},s=setTimeout(()=>{try{i.abort()}catch{}o(Error(`IndexedDB transaction timeout`))},this.timeoutMs);i.oncomplete=()=>o(),i.onabort=()=>o(i.error??Error(`IndexedDB aborted`)),i.onerror=()=>{}})}};function Yi(e){let t={...hi};if(!e)return t;for(let n of Object.keys(t)){let r=e[n];typeof r==`number`&&Number.isSafeInteger(r)&&r>=0&&(t[n]=r)}return t}function Xi(e={}){let t=Yi(e.limits),n=typeof e.openTimeoutMs==`number`&&e.openTimeoutMs>0?e.openTimeoutMs:mi,r=`indexedDB`in e?e.indexedDB:`indexedDB`in globalThis?globalThis.indexedDB:void 0,i=e.backend??(r?new Ji(r,n):null),a=e.now??Date.now,o=new Map,s=(e,t,n)=>{if(!e||e.length>512)return Promise.resolve(t);let r=(o.get(e)??Promise.resolve()).then(n).catch(()=>t),i=r.then(()=>void 0,()=>void 0);return o.set(e,i),i.then(()=>{o.get(e)===i&&o.delete(e)}),r};return{load(e){return s(e,null,async()=>{if(!i)return null;let n=a(),r=await i.read(e);if(r===void 0)return null;let o=Gi(r,e,t,n);if(!o){try{await i.remove(e)}catch{}return null}if(o.record.accessedAt!==n&&_i(n)){let r=Ui(o.data,{...t,maxDeviceBytes:Ki(e,n,t.maxDeviceBytes)}),a=r?Hi(r):null;if(r&&a!==null){let s={...o.record,accessedAt:n,bytes:a,data:r};try{await i.write(e,s,n=>qi(n,t,e))}catch{}}}return o.data})},save(e,n){return s(e,void 0,async()=>{if(!i)return;let r=a(),o=_i(r)?Ui(n,{...t,maxDeviceBytes:Ki(e,r,t.maxDeviceBytes)}):null;if(!o||!_i(r))return;let s=Hi(o);if(s===null)return;let c={pairId:e,schema:ui,updatedAt:r,accessedAt:r,bytes:s,data:o};try{await i.write(e,c,n=>qi(n,t,e))}catch(e){console.warn(`[pair] cache write failed`,e)}})},clear(e){return s(e,void 0,async()=>{i&&await i.remove(e)})}}}var Zi=Xi();function Qi(e){let t=document.querySelector(`meta[name="theme-color"]`);if(t?.content===e&&!t.media)return;for(let e of document.querySelectorAll(`meta[name="theme-color"]`))e.remove();let n=document.createElement(`meta`);n.name=`theme-color`,n.content=e,document.head.prepend(n)}function $i(e){if(e.startsWith(`rgb`)||e.startsWith(`#`))return e;try{let t=document.createElement(`canvas`);t.width=1,t.height=1;let n=t.getContext(`2d`,{willReadFrequently:!0});if(!n)return e;n.fillStyle=e,n.fillRect(0,0,1,1);let[r,i,a]=n.getImageData(0,0,1,1).data;return`rgb(${r}, ${i}, ${a})`}catch{return e}}function ea(e,t){return e===`auto`?{theme:t,syncTerminalTheme:t===`sync-terminal`}:{theme:e,syncTerminalTheme:!1}}var ta=`enso-phone-theme`,na=`system`,ra=oa(),ia=window.matchMedia(`(prefers-color-scheme: dark)`),aa=new Set;function oa(){let e=localStorage.getItem(ta);return e===`light`||e===`dark`?e:`auto`}function sa(){requestAnimationFrame(()=>{let e=getComputedStyle(document.body).backgroundColor;e&&Qi($i(e))})}function ca(){if(ra!==`auto`)ai(),document.documentElement.classList.toggle(`dark`,ra===`dark`);else if(na===`sync-terminal`)ii(void 0,!0);else{ai();let e=na===`system`?ia.matches:na===`dark`;document.documentElement.classList.toggle(`dark`,e)}for(let e of aa)e();sa();let e=ea(ra,na);Kr(e.theme,e.syncTerminalTheme)}function la(e){na=e,ca()}function ua(){return ra}function da(e){ra=e,e===`auto`?localStorage.removeItem(ta):localStorage.setItem(ta,e),ca()}function fa(e){return aa.add(e),()=>aa.delete(e)}function pa(){ca(),ia.addEventListener(`change`,ca)}var ma=1e6,ha=class{device;events;cache;desk;ws=null;heartbeat=null;contentKey;replay=je(_,v);attempt=0;timer=null;closed=!1;revoked=!1;replaced=!1;subscribedId=null;sessions=new Map;historyPending=new Set;sync=oi;direct;cursors=new Map;baselines=new Set;pendingSync=null;freshSessionId=null;syncTimer=null;receiveQueue=Promise.resolve();sendQueue=Promise.resolve();cacheReady=!1;cacheLoading=!1;cacheTimer=null;cacheDirty=!1;roomPrimed=!1;roomStatusSeen=!1;hiddenAt=null;pendingDirectRestart=!1;probeNonce=0;probeSentAt=null;metadata={catalog:[],pinnedOrder:[],projects:[],projectGroups:[],providers:[]};constructor(e,t,n=y(),r=Zi,i=!1){this.device=e,this.events=t,this.cache=r,this.desk=i,this.contentKey=ne(e.contentKey),this.direct=new te({role:`guest`,factory:n,sendSignal:e=>this.sendViaRelay(e),onFrame:e=>this.enqueueFrame(e),onTransportChange:e=>{e===`relay`&&this.ws?.readyState!==1&&!this.revoked&&!this.closed&&this.events.onState(`offline`),this.events.onTransport?.(e)},onResync:()=>{this.roomPrimed=!1,this.primeRoom()},onDiagnostic:e=>console.info(`[pair] ${e}`),onRtt:e=>this.events.onRtt?.(e),onNeedRelayProbe:()=>this.sendRelayProbe()})}transport(){return this.direct.transport()}connect(){if(this.closed||this.revoked||this.replaced||this.cacheLoading||this.ws&&this.ws.readyState<2)return;if(!this.cacheReady){this.cacheLoading=!0,this.cache.load(this.device.pairId).then(e=>{if(!e||this.closed||this.revoked)return;let{sessions:t,...n}=e;this.metadata=n,this.sync={...this.sync,knownIds:new Set(n.catalog.map(e=>e.id))},this.events.onCatalog(n.catalog,n.pinnedOrder),this.events.onProjects(n.projects,n.projectGroups),this.events.onProviders(n.providers);for(let{id:e,view:n,cursor:r}of t)this.sessions.set(e,n),this.baselines.add(e),r&&this.cursors.set(e,r),this.events.onSession(e,{...n,messages:new Map(n.messages)})}).catch(()=>{}).finally(()=>{this.cacheReady=!0,this.cacheLoading=!1,this.connect()});return}this.events.onState(`connecting`);let e=`${ae(this.device.relayUrl)}/v1/pair/${encodeURIComponent(this.device.pairId)}?role=guest&token=${encodeURIComponent(this.device.token)}`,t;try{t=new WebSocket(e)}catch{this.scheduleReconnect();return}t.binaryType=`arraybuffer`,this.ws=t,this.roomPrimed=!1,this.roomStatusSeen=!1;let n=!1,r,i=(e,i=``)=>{if(!n&&(n=!0,r&&clearTimeout(r),this.ws===t)){if(this.heartbeat?.stop(),this.heartbeat=null,this.ws=null,this.roomPrimed=!1,e===4001||i===`replaced`){this.suspendReplaced();return}if(e===1008||this.revoked){this.revoke();return}this.closed||(this.direct.transport()!==`direct`&&this.events.onState(`offline`),this.scheduleReconnect())}};this.heartbeat=me(t,()=>{try{t.close()}catch{}i(null)},e=>{this.direct.transport()===`relay`&&this.events.onRtt?.(e)}),r=setTimeout(()=>{if(Ue(t.readyState,8e3)){try{t.close()}catch{}i(null)}},He),t.onopen=()=>{this.closed||this.revoked||this.ws!==t||(clearTimeout(r),this.attempt=0,this.primeRoom())},t.onmessage=e=>{if(!(this.closed||this.revoked||this.ws!==t)){if(typeof e.data==`string`){try{let t=JSON.parse(e.data);t.type===`host-online`?(this.roomStatusSeen&&(this.roomPrimed=!1),this.roomStatusSeen=!0,this.replay.peerReset(),this.events.onState(`online`),this.direct.peerOnline(!0),this.flushDirectRestart(),this.primeRoom()):t.type===`host-offline`?(this.roomStatusSeen=!0,this.events.onState(`host-offline`),this.direct.peerOnline(!1),this.roomPrimed=!1):t.type===`revoked`&&this.revoke()}catch{}return}this.enqueueFrame(new Uint8Array(e.data),t)}},t.onclose=e=>i(e.code,e.reason),t.onerror=()=>{try{t.close()}catch{}}}nudge(e=`visibility`){if(this.closed||this.revoked)return;if(this.ws?.readyState===0){(e===`online`||e===`network-change`)&&(this.pendingDirectRestart=!0);return}let t=this.hiddenAt===null?0:Date.now()-this.hiddenAt;this.hiddenAt=null;let n=(e===`visibility`||e===`resume`)&&Ve(t),r=n||ze(e,this.ws!==null,this.ws?.readyState??null);if((e===`online`||e===`network-change`||n)&&(r?this.pendingDirectRestart=!0:this.direct.networkChange()),r){this.replaceRelay();return}this.heartbeat?.probe(e===`visibility`||e===`resume`?500:void 0)}flushDirectRestart(){this.pendingDirectRestart&&(this.pendingDirectRestart=!1,this.direct.networkChange())}conceal(){this.hiddenAt??=Date.now()}close(){this.flushCache(),this.closed=!0,this.pendingDirectRestart=!1,this.stopSyncRetry(),this.timer&&clearTimeout(this.timer),this.direct.close(),this.heartbeat?.stop(),this.heartbeat=null;try{this.ws?.close()}catch{}}scheduleReconnect(){this.closed||this.revoked||(this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>this.connect(),se(this.attempt++)))}replaceRelay(){this.timer&&clearTimeout(this.timer),this.timer=null,this.attempt=0;let e=this.ws;if(e){this.heartbeat?.stop(),this.heartbeat=null,this.ws=null,this.roomPrimed=!1;try{e.close()}catch{}}this.connect()}enqueueFrame(e,t){this.receiveQueue=this.receiveQueue.then(async()=>{this.closed||this.revoked||t&&t!==this.ws||await this.handleFrame(e,t)}).catch(()=>{})}async handleFrame(e,t){let n;try{let t=await this.replay.open(this.contentKey,e);if(t===void 0)return;n=t}catch{return}if(!(this.closed||this.revoked||t&&t!==this.ws)&&(this.replay.takeHello()&&this.send({type:`replay-hello`}),!Ae(n))){if(Se(n)){this.events.onRemoteFrame?.(n);return}switch(n.type){case`catalog`:{let{tracking:e,ghost:t}=li(this.sync,this.subscribedId,n.entries.map(e=>e.id)),r=t?this.subscribedId:null,i=new Set(n.entries.map(e=>e.id));for(let e of this.sync.knownIds)i.has(e)||(this.sessions.delete(e),this.baselines.delete(e),this.cursors.delete(e));this.setSync(e),r&&this.subscribe(null),r&&this.events.onGhostSession?.(r),this.metadata.catalog=n.entries,this.metadata.pinnedOrder=n.pinnedOrder??[],this.events.onCatalog(n.entries,n.pinnedOrder),this.scheduleCache();break}case`projects`:this.metadata.projects=n.projects,this.metadata.projectGroups=n.groups??[],this.events.onProjects(n.projects,n.groups),this.scheduleCache();break;case`providers`:this.metadata.providers=n.providers,this.events.onProviders(n.providers),this.scheduleCache();break;case`appearance`:Hr(n.terminal,n.terminalFontFamily),la(n.theme),Ur(n.compactReadOnlyTools!==!1),Wr(n.expandLiveEdits!==!1),Gr(Lr(n));break;case`agent-event`:this.acceptAgentEvent(n.event,n.cursor);break;case`session-sync`:{let e=Ze(n);e?this.applySessionSync(e):console.warn(`[pair] dropped invalid session-sync`);break}case`push-config`:this.events.onPushConfig?.(n.vapidPublicKey);break;case`host-info`:this.direct.hostInfo(n),this.events.onReadOnly?.(n.readOnly===!0),this.events.onRemoteDesktop?.(n.remoteDesktop===!0);break;case`direct-answer`:case`direct-ice`:this.direct.handleSignal(n);break;case`probe-ack`:n.nonce===this.probeNonce&&this.probeSentAt!==null&&(this.direct.noteRelayRtt(Date.now()-this.probeSentAt),this.probeSentAt=null);break;case`history`:{if(!this.historyPending.has(n.sessionId))break;this.historyPending.delete(n.sessionId),this.events.onHistoryPending?.(n.sessionId,!1);let e=this.sessions.get(n.sessionId);if(!e)break;let t=at(e,n);if(t===e)break;this.sessions.set(n.sessionId,t),this.events.onSession(n.sessionId,{...t,messages:new Map(t.messages)}),this.scheduleCache();break}case`bot-catalog`:Array.isArray(n.bots)&&this.events.onBotCatalog?.(n.enabled===!0,n.bots,n.newSession===!0,n.threads===!0);break;case`bot-chats`:Array.isArray(n.chats)&&this.events.onBotChats?.(n.chats,Array.isArray(n.threads)?n.threads:[]);break;case`group-timeline`:typeof n.chatId==`string`&&Array.isArray(n.entries)&&this.events.onGroupTimeline?.(n);break;case`bot-event`:typeof n.event==`object`&&n.event!==null&&this.events.onBotEvent?.(n.event);break;case`bot-chat-state`:typeof n.chatId==`string`&&this.events.onBotChatState?.(n);break;case`bot-send-result`:typeof n.deliveryId==`string`&&this.events.onBotSendResult?.(n);break;case`bot-new-session-result`:typeof n.chatId==`string`&&typeof n.requestId==`string`&&typeof n.ok==`boolean`&&this.events.onBotNewSessionResult?.(n);break;case`bot-thread-result`:typeof n.chatId==`string`&&typeof n.requestId==`string`&&typeof n.ok==`boolean`&&this.events.onBotThreadResult?.(n);break;case`bot-retry-result`:typeof n.chatId==`string`&&typeof n.entryId==`string`&&this.events.onBotRetryResult?.(n);break;case`bot-inbox`:Array.isArray(n.items)&&this.events.onBotInbox?.(n.items);break;case`bot-activity`:Array.isArray(n.items)&&typeof n.now==`number`&&this.events.onBotActivity?.(n.items,Date.now()-n.now);break;case`bot-artifacts`:typeof n.target==`object`&&n.target!==null&&this.events.onBotArtifacts?.(n);break;case`bot-artifact-image`:typeof n.requestId==`string`&&this.events.onBotArtifactImage?.(n);break;case`command-rejected`:typeof n.command==`string`&&this.events.onCommandRejected?.(n.command,n.error)}}}applySessionSync(e){if(this.pendingSync?.requestId!==e.requestId||this.pendingSync.sessionId!==e.sessionId)return;let t=e.sessionId;this.stopSyncRetry();let n=this.sessions.get(t);if(e.mode===`snapshot`)n=it(this.cursors.get(t)?.epoch===e.cursor.epoch?this.sessions:new Map,e.snapshot)[0]?.view,n&&=this.keepCachedMessages(t,n);else{let r=this.cursors.get(t);if(!n||r?.epoch!==e.cursor.epoch||r.seq!==e.fromSeq){this.cursors.delete(t),this.subscribe(t);return}for(let r of e.events){let e=r;if(this.truncatesBeforeCache(n,e)){this.cursors.delete(t),this.subscribe(t);return}n=rt(n,e).view}}if(!n)return;this.sessions.set(t,n),this.baselines.add(t),this.cursors.set(t,e.cursor);let r=this.pendingSync.observed;this.pendingSync=null,r&&(r===`mixed`||r.epoch!==e.cursor.epoch||r.seq>e.cursor.seq)?this.subscribe(t):this.setSync({...this.sync,state:`synced`}),this.events.onSession(t,{...n,messages:new Map(n.messages)}),this.scheduleCache()}acceptAgentEvent(e,t){let n=typeof e.sessionId==`string`?e.sessionId:void 0;if(t!==void 0){if(!n||!Ye(t))return;if(this.pendingSync?.sessionId===n){let e=this.pendingSync.observed;this.pendingSync.observed=e?e===`mixed`||e.epoch!==t.epoch?`mixed`:{epoch:t.epoch,seq:Math.max(e.seq,t.seq)}:t;return}let r=this.cursors.get(n);if(r?.epoch===t.epoch&&t.seq<=r.seq)return;if(!r||t.epoch!==r.epoch||t.seq!==r.seq+1){n===this.subscribedId?(this.freshSessionId===n&&(this.freshSessionId=null),this.subscribe(n)):this.cursors.delete(n);return}let i=this.sessions.get(n);if(i&&this.truncatesBeforeCache(i,e)){this.cursors.delete(n),n===this.subscribedId&&this.subscribe(n);return}this.applyAgentEvent(e),this.cursors.set(n,t)}else n&&this.cursors.delete(n),this.applyAgentEvent(e);this.scheduleCache()}truncatesBeforeCache(e,t){return t.type===`messages-truncated`&&typeof t.length==`number`&&t.length>0&&(e.messages.size===0||Math.min(...e.messages.keys())>=t.length)}keepCachedMessages(e,t){if(t.messages.size>0)return t;let n=this.sessions.get(e);return!n||n.messages.size===0?t:{...t,messages:new Map(n.messages)}}applyAgentEvent(e){let t=e.sessionId,n=e.type;if(n===`worker-exited`){this.cursors.clear(),this.sessions=ot(this.sessions);for(let[e,t]of this.sessions)this.events.onSession(e,{...t,messages:new Map(t.messages)});return}if(n===`snapshot`){let t=(e.sessions??[]).map(e=>e.sessionId??e.identity?.sessionId).filter(e=>typeof e==`string`);this.setSync(ci(this.sync,this.subscribedId,t));for(let{id:t,view:n}of it(this.sessions,e)){let e=this.keepCachedMessages(t,n);this.cursors.delete(t),this.baselines.add(t),t===this.pendingSync?.sessionId&&(this.pendingSync=null,this.stopSyncRetry()),this.sessions.set(t,e),this.events.onSession(t,{...e,messages:new Map(e.messages)})}return}if(!t)return;let{view:r}=rt(this.sessions.get(t)??tt(),e);this.sessions.set(t,r),this.events.onSession(t,{...r,messages:new Map(r.messages)})}getSession(e){return this.sessions.get(e)}canSend(){return!this.closed&&!this.revoked&&(this.direct.transport()===`direct`||this.ws?.readyState===1)}send(e,t){if(this.canSend()){if(t?.bulk&&this.ws?.readyState===1){this.sendViaRelay(e);return}this.sendQueue=this.sendQueue.then(async()=>{if(this.closed||this.revoked)return;let t=await this.replay.seal(this.contentKey,e);this.closed||this.revoked||this.overRelayLimit(t,e)||this.direct.send(t)||this.sendFrameViaRelay(t)}).catch(()=>{})}}overRelayLimit(e,t){return e.byteLength<=ma?!1:(console.warn(`[pair] ${t.type} frame ${e.byteLength}B over relay limit, dropped`),this.events.onCommandRejected?.(t.type,`frame over relay limit`),!0)}sendFrameViaRelay(e){this.ws?.readyState===1&&this.ws.send(e.slice().buffer)}sendRelayProbe(){this.probeNonce=this.probeNonce+1>>>0,this.probeSentAt=Date.now(),this.sendViaRelay({type:`probe`,nonce:this.probeNonce})}sendViaRelay(e){this.sendQueue=this.sendQueue.then(async()=>{if(this.closed||this.revoked)return;let t=await this.replay.seal(this.contentKey,e);this.closed||this.revoked||this.overRelayLimit(t,e)||this.sendFrameViaRelay(t)}).catch(()=>{})}setSync(e){let t=e.state!==this.sync.state;this.sync=e,t&&this.events.onSync?.(e.state)}primeRoom(){this.closed||this.revoked||this.roomPrimed||this.ws?.readyState===1&&(this.roomPrimed=!0,this.send(this.desk?{type:`snapshot`,desk:!0}:{type:`snapshot`}),this.subscribedId&&this.subscribe(this.subscribedId))}subscribe(e,t){if(this.closed||this.revoked||(this.stopSyncRetry(),this.subscribedId=e,t?.fresh?this.freshSessionId=e:(e!==this.freshSessionId||e&&this.baselines.has(e))&&(this.freshSessionId=null),!this.cacheReady))return;let n=e!==null&&e===this.freshSessionId;if(this.pendingSync=e&&!n?{sessionId:e,requestId:crypto.randomUUID()}:null,this.historyPending.size>0){let e=[...this.historyPending];this.historyPending.clear();for(let t of e)this.events.onHistoryPending?.(t,!1)}if(this.setSync(si(this.sync,e,{fresh:n})),!e){this.send({type:`subscribe`,sessionId:null});return}let r=this.sessions.get(e),i=this.baselines.has(e)&&r?r.messages.size?Math.max(...r.messages.keys()):-1:void 0;r&&(this.sessions.delete(e),this.sessions.set(e,r));let a={type:`subscribe`,sessionId:e,...this.pendingSync?{sync:{requestId:this.pendingSync.requestId,cursor:this.cursors.get(e)}}:typeof i==`number`?{sinceIndex:i}:{}};this.send(a),this.pendingSync&&this.armSyncRetry(a,this.pendingSync.requestId)}armSyncRetry(e,t){this.syncTimer=setTimeout(()=>{this.closed||this.revoked||this.pendingSync?.requestId!==t||(this.send(e),this.armSyncRetry(e,t))},1e4)}stopSyncRetry(){this.syncTimer&&clearTimeout(this.syncTimer),this.syncTimer=null}scheduleCache(){this.closed||this.revoked||(this.cacheDirty=!0,!this.cacheTimer&&(this.cacheTimer=setTimeout(()=>this.flushCache(),500)))}flushCache(){if(this.cacheTimer&&clearTimeout(this.cacheTimer),this.cacheTimer=null,!this.cacheReady||!this.cacheDirty||this.closed||this.revoked)return;this.cacheDirty=!1;let e=[...this.sessions].filter(([e])=>this.baselines.has(e)).map(([e,t])=>({id:e,view:t,cursor:this.cursors.get(e)}));this.cache.save(this.device.pairId,{...this.metadata,sessions:e}).catch(()=>{})}suspendReplaced(){this.replaced=!0,this.pendingDirectRestart=!1,this.stopSyncRetry(),this.timer&&clearTimeout(this.timer),this.timer=null,this.direct.close(),this.heartbeat?.stop(),this.heartbeat=null,this.flushCache(),this.events.onState(`replaced`)}revoke(){this.revoked=!0,this.pendingDirectRestart=!1,this.stopSyncRetry(),this.timer&&clearTimeout(this.timer),this.cacheTimer&&clearTimeout(this.cacheTimer),this.cacheTimer=null,this.direct.close(),this.heartbeat?.stop(),this.sessions.clear(),this.cursors.clear(),this.baselines.clear(),this.cache.clear(this.device.pairId).catch(()=>{}),this.events.onState(`unauthorized`)}hasOlder(e){let t=this.sessions.get(e);return!t||t.messages.size===0?!1:Math.min(...t.messages.keys())>0}requestHistory(e){if(this.pendingSync||this.subscribedId!==e||this.historyPending.has(e)||!this.hasOlder(e))return;let t=this.sessions.get(e);t&&(this.historyPending.add(e),this.events.onHistoryPending?.(e,!0),this.send({type:`history`,sessionId:e,beforeIndex:Math.min(...t.messages.keys())}))}};function ga(e,t){if(e)try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}if(t)try{let e=JSON.parse(t);return e?.pairId?[{...e,label:_a([])}]:[]}catch{return[]}return[]}function _a(e){let t=new Set(e.map(e=>e.label));for(let e=1;;e++){let n=`电脑 ${e}`;if(!t.has(n))return n}}function va(e,t){return e.find(e=>e.pairId===t.pairId)?e.map(e=>e.pairId===t.pairId?{...t,label:e.label}:e):[...e,{...t,label:_a(e)}]}function ya(e,t){return e.filter(e=>e.pairId!==t)}function ba(e,t,n){let r=n.trim();return r?e.map(e=>e.pairId===t?{...e,label:r}:e):[...e]}function xa(e,t){return e.find(e=>e.pairId===t)??e[0]??null}var Sa=`enso-phone-launch`,Ca=`/__open-session`,wa=200,Ta=/^[\w.:-]+$/;function Ea(e){if(typeof e!=`string`)return null;let t=e.trim();return!t||t.length>wa||!Ta.test(t)?null:t}function Da(e){if(typeof e!=`string`||!e)return null;let t=e.startsWith(`?`)?e.slice(1):e;return Ea(new URLSearchParams(t).get(`session`))}async function Oa(e=typeof caches>`u`?void 0:caches){if(!e)return null;try{let t=await e.open(Sa),n=await t.match(Ca);return await t.delete(Ca),n?Ea(await n.text()):null}catch{return null}}var ka=`enso-phone-push`;function Aa(e){return e.matchMedia(`(display-mode: standalone)`).matches||e.navigator.standalone===!0}function ja(){if(Aa(window))return!0;try{return window.top!=null&&window.top!==window&&Aa(window.top)}catch{return!1}}function Ma(){return`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window}function Na(){return Ma()?`ok`:/iphone|ipad|ipod/i.test(navigator.userAgent)&&!ja()?`needs-install`:`unsupported`}async function Pa(){if(!(`serviceWorker`in navigator))return null;try{return await navigator.serviceWorker.register(`/sw.js`)}catch{return null}}function Fa(e){let t=e+`=`.repeat((4-e.length%4)%4),n=atob(t.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(n,e=>e.charCodeAt(0))}function Ia(e){return e===`AbortError`?`service-unreachable`:e===`NotAllowedError`?`permission-denied`:`subscribe-failed`}async function La(e){if(!Ma())return{ok:!1,reason:`unsupported`};if(await Notification.requestPermission()!==`granted`)return{ok:!1,reason:`permission-denied`};let t=await navigator.serviceWorker.ready;try{let n=(await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Fa(e)})).toJSON();return!n.endpoint||!n.keys?.p256dh||!n.keys?.auth?{ok:!1,reason:`subscribe-failed`}:{ok:!0,subscription:{endpoint:n.endpoint,keys:{p256dh:n.keys.p256dh,auth:n.keys.auth}}}}catch(e){return{ok:!1,reason:Ia(e instanceof Error?e.name:``)}}}async function Ra(){if(`serviceWorker`in navigator)try{await(await(await navigator.serviceWorker.ready).pushManager.getSubscription())?.unsubscribe()}catch{}}var za=`enso-phone-ui-mode`,Ba=`/?mode=phone`;function Va(){return localStorage.getItem(`enso-phone-ui-mode`)===`desk`?`desk`:`phone`}function Ha(e){localStorage.setItem(za,e)}function Ua(e){return`/desk?device=${encodeURIComponent(e)}`}function Wa(e,t,n,r){if(t!==`desk`)return null;let i=new URLSearchParams(e);if(i.get(`mode`)===`phone`)return null;let a=xa(n,r);if(!a||a.scope===`read`)return null;let o=Ea(i.get(`session`)),s=new URLSearchParams({device:a.pairId});return o&&s.set(`session`,o),`/desk?${s}`}var Ga=`enso-phone-pairing`,Ka=`enso-phone-devices`,qa=`enso-phone-active-device`,Ja=`enso-phone-cursors`,Ya=`enso-phone-last-session`,Xa=e=>`enso-phone-cursors:${e}`,Za=e=>`enso-phone-last-session:${e}`,Qa=e=>`enso-phone-last-bot-chat:${e}`;function $a(){let e=localStorage.getItem(Ga),t=ga(localStorage.getItem(Ka),e);if(e&&t.length>0){eo(t),localStorage.removeItem(Ga);let e=t[0].pairId,n=localStorage.getItem(Ja);n&&(localStorage.setItem(Xa(e),n),localStorage.removeItem(Ja));let r=localStorage.getItem(Ya);r&&(localStorage.setItem(Za(e),r),localStorage.removeItem(Ya)),localStorage.getItem(qa)||no(e)}return t}function eo(e){localStorage.setItem(Ka,JSON.stringify(e))}function to(){return localStorage.getItem(qa)}function no(e){e?localStorage.setItem(qa,e):localStorage.removeItem(qa)}function ro(e){Zi.clear(e),Ir.remove?.(e).catch(()=>{}),localStorage.removeItem(Xa(e)),localStorage.removeItem(Za(e)),localStorage.removeItem(Qa(e))}function io(e){return localStorage.getItem(Za(e))}function ao(e,t){t?localStorage.setItem(Za(e),t):localStorage.removeItem(Za(e))}function oo(e,t=null){return{activeId:t??(e?io(e):null),botChatId:!t&&e?Ea(localStorage.getItem(Qa(e))):null}}function so(e,t){ao(e,t.activeId),t.botChatId?localStorage.setItem(Qa(e),t.botChatId):localStorage.removeItem(Qa(e))}export{st as $,da as A,Cr as B,xa as C,ha as D,va as E,Zr as F,hr as G,vr as H,ni as I,wt as J,St as K,Yr as L,Qi as M,$i as N,ua as O,Xr as P,vt as Q,Mr as R,Oa as S,ba as T,yr as U,xr as V,br as W,_t as X,ht as Y,mt as Z,Pa as _,no as a,we as at,Da as b,Ba as c,ye as ct,Va as d,oe as dt,tt as et,Ha as f,re as ft,Na as g,ja as h,oo as i,ve as it,fa as j,pa as k,Ua as l,ue as lt,Ma as m,to as n,Ee as nt,eo as o,Se as ot,ka as p,i as pt,xt as q,$a as r,Te as rt,so as s,be as st,ro as t,et as tt,Wa as u,de as ut,La as v,ya as w,Ea as x,Ra as y,Ir as z};