@ghostlytools/cli 1.11.3 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/README.md +52 -30
  2. package/SKILL.md +4 -2
  3. package/dist/assets/{api-DBlaoz8i.js → api-DLzCtePC.js} +533 -195
  4. package/dist/assets/api-DLzCtePC.js.map +1 -0
  5. package/dist/assets/{api-DgU4MZPD.js → api-DYMKyb1k.js} +2 -2
  6. package/dist/assets/{apiKit-DesObIDf.js → apiKit-CVaEzKWQ.js} +104 -21
  7. package/dist/assets/apiKit-CVaEzKWQ.js.map +1 -0
  8. package/dist/assets/appFetch-D56GsYuq.js +602 -0
  9. package/dist/assets/appFetch-D56GsYuq.js.map +1 -0
  10. package/dist/assets/apps-BPFW19Wc.js +1 -0
  11. package/dist/assets/{apps-DkMjDHML.js → apps-XnZ8VEuj.js} +66 -38
  12. package/dist/assets/apps-XnZ8VEuj.js.map +1 -0
  13. package/dist/assets/{argon2id-088uQfnH.js → argon2id-B9wFdSj6.js} +2 -3
  14. package/dist/assets/{argon2id-088uQfnH.js.map → argon2id-B9wFdSj6.js.map} +1 -1
  15. package/dist/assets/{arkade-CarKONmH.js → arkade-DryM-q5n.js} +6 -7
  16. package/dist/assets/arkade-DryM-q5n.js.map +1 -0
  17. package/dist/assets/backup-COX6j1_W.js +1 -0
  18. package/dist/assets/{backup-C0OJCJlM.js → backup-DpyvT9Z6.js} +108 -50
  19. package/dist/assets/backup-DpyvT9Z6.js.map +1 -0
  20. package/dist/assets/bark_ffi_wasm_bg-CcafsJla.js +5 -0
  21. package/dist/assets/{bark_ffi_wasm_bg-EY2uc0Bx.js.map → bark_ffi_wasm_bg-CcafsJla.js.map} +1 -1
  22. package/dist/assets/{bark_ffi_wasm_bg-Bxru_BVW.wasm → bark_ffi_wasm_bg-VNmaJsc9.wasm} +0 -0
  23. package/dist/assets/{bitcoind-CdSmvy2y.js → bitcoind-DTsrd7TF.js} +4 -5
  24. package/dist/assets/{bitcoind-CdSmvy2y.js.map → bitcoind-DTsrd7TF.js.map} +1 -1
  25. package/dist/assets/bitcoindevkit_bg-BWQHx7vd.js +5 -0
  26. package/dist/assets/{bitcoindevkit_bg-B-iLWrmX.js.map → bitcoindevkit_bg-BWQHx7vd.js.map} +1 -1
  27. package/dist/assets/bitcoindevkit_bg-DXil67yS.wasm +0 -0
  28. package/dist/assets/{blobFiles-BmsrvZc3.js → blobFiles-DDs34n0r.js} +4 -5
  29. package/dist/assets/{blobFiles-BmsrvZc3.js.map → blobFiles-DDs34n0r.js.map} +1 -1
  30. package/dist/assets/breez_sdk_spark_wasm_bg.wasm +0 -0
  31. package/dist/assets/buttons-Bq7pTXqF.js +1 -0
  32. package/dist/assets/{buttons-fZTEa_2i.js → buttons-BvWqHJeh.js} +46 -23
  33. package/dist/assets/buttons-BvWqHJeh.js.map +1 -0
  34. package/dist/assets/bytes-C1DNGY18.js +132 -0
  35. package/dist/assets/bytes-C1DNGY18.js.map +1 -0
  36. package/dist/assets/{childEnv-K_IzUqQx.js → childEnv-C-99hdbL.js} +2 -3
  37. package/dist/assets/{childEnv-K_IzUqQx.js.map → childEnv-C-99hdbL.js.map} +1 -1
  38. package/dist/assets/{client-Ibk3-e60.js → client-kGZ3ZdUW.js} +30 -13
  39. package/dist/assets/client-kGZ3ZdUW.js.map +1 -0
  40. package/dist/assets/{codec-DMpQqVSt.js → codec-B2rH1mfx.js} +2 -4
  41. package/dist/assets/{codec-DMpQqVSt.js.map → codec-B2rH1mfx.js.map} +1 -1
  42. package/dist/assets/domainProofs-BDNP1dIy.js +280 -0
  43. package/dist/assets/domainProofs-BDNP1dIy.js.map +1 -0
  44. package/dist/assets/{endpoint-DarqblYE.js → endpoint-B0vE5ojY.js} +421 -420
  45. package/dist/assets/endpoint-B0vE5ojY.js.map +1 -0
  46. package/dist/assets/engineErrors--9hfgKlK.js +150 -0
  47. package/dist/assets/engineErrors--9hfgKlK.js.map +1 -0
  48. package/dist/assets/{envelope-CvQVCGdf.js → envelope-Bi2kMqbp.js} +3 -4
  49. package/dist/assets/{envelope-CvQVCGdf.js.map → envelope-Bi2kMqbp.js.map} +1 -1
  50. package/dist/assets/{errors-Dt-ZnyOX.js → errors-DDLFO4Gf.js} +31 -5
  51. package/dist/assets/errors-DDLFO4Gf.js.map +1 -0
  52. package/dist/assets/{fedimintSdk-zV_5Qdqz.js → fedimintSdk-D-6H9Pe7.js} +4 -5
  53. package/dist/assets/{fedimintSdk-zV_5Qdqz.js.map → fedimintSdk-D-6H9Pe7.js.map} +1 -1
  54. package/dist/assets/fedimint_client_wasm_bg-Cr5xGD-w.js +5 -0
  55. package/dist/assets/{fedimint_client_wasm_bg-BtHHlFpp.js.map → fedimint_client_wasm_bg-Cr5xGD-w.js.map} +1 -1
  56. package/dist/assets/fileBytes-CCKbwqG_.js +1 -0
  57. package/dist/assets/{fileBytes-BLPZq9YU.js → fileBytes-CfvUXdSy.js} +5 -7
  58. package/dist/assets/fileBytes-CfvUXdSy.js.map +1 -0
  59. package/dist/assets/{fileBytes-B0z9A6Le.js → fileBytes-tj6-VZcB.js} +3 -4
  60. package/dist/assets/{fileBytes-B0z9A6Le.js.map → fileBytes-tj6-VZcB.js.map} +1 -1
  61. package/dist/assets/fileBytesIdb-B0zzJ6p7.js +1 -0
  62. package/dist/assets/{fileBytesIdb-Bmlrl9EO.js → fileBytesIdb-BJirUAjI.js} +4 -5
  63. package/dist/assets/{fileBytesIdb-Bmlrl9EO.js.map → fileBytesIdb-BJirUAjI.js.map} +1 -1
  64. package/dist/assets/{fileBytesOpfs-DBS0kbPT.js → fileBytesOpfs-DRUYLER4.js} +4 -5
  65. package/dist/assets/{fileBytesOpfs-DBS0kbPT.js.map → fileBytesOpfs-DRUYLER4.js.map} +1 -1
  66. package/dist/assets/{fixedHosts-6gKn8dp2.js → fixedHosts-CPSsGOI2.js} +4 -5
  67. package/dist/assets/{fixedHosts-6gKn8dp2.js.map → fixedHosts-CPSsGOI2.js.map} +1 -1
  68. package/dist/assets/{ghostly_iroh_web-BzAXJUYH.js → ghostly_iroh_web-DIj5xGmR.js} +2 -3
  69. package/dist/assets/{ghostly_iroh_web-BzAXJUYH.js.map → ghostly_iroh_web-DIj5xGmR.js.map} +1 -1
  70. package/dist/assets/{src-DjVj2ynY.js → groupMeta-DTQAJG50.js} +4879 -23799
  71. package/dist/assets/groupMeta-DTQAJG50.js.map +1 -0
  72. package/dist/assets/{host-CYlIiY3r.js → host-z0FAHP9Z.js} +750 -245
  73. package/dist/assets/host-z0FAHP9Z.js.map +1 -0
  74. package/dist/assets/{hyperdhtRelay-CdsLcAhY.js → hyperdhtRelay-CvsAfQRQ.js} +5 -6
  75. package/dist/assets/hyperdhtRelay-CvsAfQRQ.js.map +1 -0
  76. package/dist/assets/hyperdhtRelay-bjNGacf5.js +32 -0
  77. package/dist/assets/hyperdhtRelay-bjNGacf5.js.map +1 -0
  78. package/dist/assets/{idb-CEuoNsTv.js → idb-ewvbqyDI.js} +2 -3
  79. package/dist/assets/{idb-CEuoNsTv.js.map → idb-ewvbqyDI.js.map} +1 -1
  80. package/dist/assets/identityProofs-Cksc_K7_.js +940 -0
  81. package/dist/assets/identityProofs-Cksc_K7_.js.map +1 -0
  82. package/dist/assets/{irohWeb-D2IuloLL.js → irohWeb-CLBx5MIv.js} +3061 -86
  83. package/dist/assets/irohWeb-CLBx5MIv.js.map +1 -0
  84. package/dist/assets/joinTrace-CBr1jbch.js +1 -0
  85. package/dist/assets/{joinTrace-CjRDFy85.js → joinTrace-xKBe73j9.js} +2 -3
  86. package/dist/assets/{joinTrace-CjRDFy85.js.map → joinTrace-xKBe73j9.js.map} +1 -1
  87. package/dist/assets/{legacy_ciphers-JJOu0JXL.js → legacy_ciphers-BnYATjxo.js} +2 -3
  88. package/dist/assets/{legacy_ciphers-JJOu0JXL.js.map → legacy_ciphers-BnYATjxo.js.map} +1 -1
  89. package/dist/assets/linkPreview-DdMf-YAc.js +252 -0
  90. package/dist/assets/linkPreview-DdMf-YAc.js.map +1 -0
  91. package/dist/assets/{main-C0PfjKTe.js → main-CVqkvuIo.js} +536 -173
  92. package/dist/assets/main-CVqkvuIo.js.map +1 -0
  93. package/dist/assets/{mainline-Cu61qcPS.js → mainline-CVrd0C1n.js} +72 -18
  94. package/dist/assets/mainline-CVrd0C1n.js.map +1 -0
  95. package/dist/assets/mints-BcBODVVW.js +1 -0
  96. package/dist/assets/{mints-j5XAOk4f.js → mints-CMDLbMeH.js} +8 -6
  97. package/dist/assets/mints-CMDLbMeH.js.map +1 -0
  98. package/dist/assets/{nacl-fast-CDhNCYHs.js → nacl-fast-B1ThWvuM.js} +2 -3
  99. package/dist/assets/{nacl-fast-CDhNCYHs.js.map → nacl-fast-B1ThWvuM.js.map} +1 -1
  100. package/dist/assets/{networkReason-Dt7Yx_n4.js → networkReason-Be-hMghr.js} +10 -14
  101. package/dist/assets/{networkReason-Dt7Yx_n4.js.map → networkReason-Be-hMghr.js.map} +1 -1
  102. package/dist/assets/{noble_curves-DDWn5AH0.js → noble_curves-DqpNlhAU.js} +3 -4
  103. package/dist/assets/{noble_curves-DDWn5AH0.js.map → noble_curves-DqpNlhAU.js.map} +1 -1
  104. package/dist/assets/{noble_hashes-B7AZyFyS.js → noble_hashes-LFe1N2xt.js} +3 -4
  105. package/dist/assets/{noble_hashes-B7AZyFyS.js.map → noble_hashes-LFe1N2xt.js.map} +1 -1
  106. package/dist/assets/{nwc-CtZypDcv.js → nwc-DKE2FXr6.js} +5 -6
  107. package/dist/assets/{nwc-CtZypDcv.js.map → nwc-DKE2FXr6.js.map} +1 -1
  108. package/dist/assets/nwcProvider-pL2XqSbW.js +208 -0
  109. package/dist/assets/nwcProvider-pL2XqSbW.js.map +1 -0
  110. package/dist/assets/{openpgp-BBFr-zHQ.js → openpgp-LkR_Zof0.js} +14 -15
  111. package/dist/assets/{openpgp-BBFr-zHQ.js.map → openpgp-LkR_Zof0.js.map} +1 -1
  112. package/dist/assets/ownDid-DY3rYqDI.js +862 -0
  113. package/dist/assets/ownDid-DY3rYqDI.js.map +1 -0
  114. package/dist/assets/{ownStatus-D4HC6tNR.js → ownStatus-DMEhrpkd.js} +81 -19
  115. package/dist/assets/ownStatus-DMEhrpkd.js.map +1 -0
  116. package/dist/assets/pairedTransports-BKmvlKz1.js +581 -0
  117. package/dist/assets/pairedTransports-BKmvlKz1.js.map +1 -0
  118. package/dist/assets/paymentIntent-DySU3Ajm.js +349 -0
  119. package/dist/assets/paymentIntent-DySU3Ajm.js.map +1 -0
  120. package/dist/assets/pkarr-BQo4PcCg.js +367 -0
  121. package/dist/assets/pkarr-BQo4PcCg.js.map +1 -0
  122. package/dist/assets/{profiles-Ccdq6Xf6.js → profiles-BFSGqDFC.js} +30 -16
  123. package/dist/assets/profiles-BFSGqDFC.js.map +1 -0
  124. package/dist/assets/registry-B15Yg_1C.js +1 -0
  125. package/dist/assets/{registry-LvxsLJ5S.js → registry-rXgaZeNn.js} +1273 -58
  126. package/dist/assets/registry-rXgaZeNn.js.map +1 -0
  127. package/dist/assets/relay-Cjfmdec0.js +2219 -0
  128. package/dist/assets/relay-Cjfmdec0.js.map +1 -0
  129. package/dist/assets/resolve-CIc3KZMV.js +970 -0
  130. package/dist/assets/resolve-CIc3KZMV.js.map +1 -0
  131. package/dist/assets/{restoredRows-C3LcxmOw.js → restoredRows-D_WSHE7H.js} +3 -4
  132. package/dist/assets/{restoredRows-C3LcxmOw.js.map → restoredRows-D_WSHE7H.js.map} +1 -1
  133. package/dist/assets/{secretGuard-B7Hj0Kvz.js → secretGuard-B4-LlMjv.js} +75 -16
  134. package/dist/assets/{secretGuard-B7Hj0Kvz.js.map → secretGuard-B4-LlMjv.js.map} +1 -1
  135. package/dist/assets/secretGuard-BmmnEbYf.js +1 -0
  136. package/dist/assets/{server-Q3VcNqGt.js → server-CQR7NLCz.js} +10200 -625
  137. package/dist/assets/server-CQR7NLCz.js.map +1 -0
  138. package/dist/assets/{sha512-BYId-G-T.js → sha512-DST9fbWH.js} +2 -3
  139. package/dist/assets/{sha512-BYId-G-T.js.map → sha512-DST9fbWH.js.map} +1 -1
  140. package/dist/assets/sshForges-BnvwmNj-.js +539 -0
  141. package/dist/assets/sshForges-BnvwmNj-.js.map +1 -0
  142. package/dist/assets/{storage-Bya5b2Xt.js → storage-BpjdxvO2.js} +243 -34
  143. package/dist/assets/storage-BpjdxvO2.js.map +1 -0
  144. package/dist/assets/text-li76pThX.js +106 -0
  145. package/dist/assets/text-li76pThX.js.map +1 -0
  146. package/dist/assets/{translate-iQZq4TnY.js → translate-BcbSWkuq.js} +21 -26
  147. package/dist/assets/{translate-iQZq4TnY.js.map → translate-BcbSWkuq.js.map} +1 -1
  148. package/dist/assets/{tree-store-N362nuzZ.js → tree-store-CAchkO_l.js} +22 -6
  149. package/dist/assets/tree-store-CAchkO_l.js.map +1 -0
  150. package/dist/assets/{types-Clyb52K2.js → types-CdWwgvyt.js} +2 -3
  151. package/dist/assets/{types-Clyb52K2.js.map → types-CdWwgvyt.js.map} +1 -1
  152. package/dist/assets/{unbzip2-stream-B1C-JX9L.js → unbzip2-stream-BtkYGpC5.js} +2 -3
  153. package/dist/assets/{unbzip2-stream-B1C-JX9L.js.map → unbzip2-stream-BtkYGpC5.js.map} +1 -1
  154. package/dist/assets/{usdt-DnyTGdTX.js → usdt-CBJ4Q5Ji.js} +7 -7
  155. package/dist/assets/usdt-CBJ4Q5Ji.js.map +1 -0
  156. package/dist/assets/{waitNotice-Cn0WJ-He.js → waitNotice-BGM0QOS2.js} +27 -4
  157. package/dist/assets/waitNotice-BGM0QOS2.js.map +1 -0
  158. package/dist/assets/{web-DwgdhfcY.js → web-68CYFCl9.js} +314 -91
  159. package/dist/assets/web-68CYFCl9.js.map +1 -0
  160. package/dist/ghostly.mjs +3 -5
  161. package/dist/ghostly.mjs.map +1 -1
  162. package/npm-shrinkwrap.json +225 -200
  163. package/package.json +16 -16
  164. package/dist/assets/api-DBlaoz8i.js.map +0 -1
  165. package/dist/assets/apiKit-DesObIDf.js.map +0 -1
  166. package/dist/assets/appFetch-C8yZIq1e.js +0 -194
  167. package/dist/assets/appFetch-C8yZIq1e.js.map +0 -1
  168. package/dist/assets/apps-DkMjDHML.js.map +0 -1
  169. package/dist/assets/apps-rzxsjfBV.js +0 -2
  170. package/dist/assets/arkade-CarKONmH.js.map +0 -1
  171. package/dist/assets/backup-C0OJCJlM.js.map +0 -1
  172. package/dist/assets/backup-CgWU7x0T.js +0 -2
  173. package/dist/assets/bark_ffi_wasm_bg-EY2uc0Bx.js +0 -6
  174. package/dist/assets/bitcoindProvider-BvoRh0D5.js +0 -97
  175. package/dist/assets/bitcoindProvider-BvoRh0D5.js.map +0 -1
  176. package/dist/assets/bitcoindevkit_bg-B-iLWrmX.js +0 -6
  177. package/dist/assets/bitcoindevkit_bg-CRkZTSbO.wasm +0 -0
  178. package/dist/assets/buttons-Cco0Agfa.js +0 -2
  179. package/dist/assets/buttons-fZTEa_2i.js.map +0 -1
  180. package/dist/assets/client-Ibk3-e60.js.map +0 -1
  181. package/dist/assets/endpoint-DarqblYE.js.map +0 -1
  182. package/dist/assets/errors-Dt-ZnyOX.js.map +0 -1
  183. package/dist/assets/fedimint_client_wasm_bg-BtHHlFpp.js +0 -6
  184. package/dist/assets/fileBytes-BLPZq9YU.js.map +0 -1
  185. package/dist/assets/fileBytes-BtIyoDF2.js +0 -2
  186. package/dist/assets/fileBytesIdb-D8mAK4pF.js +0 -2
  187. package/dist/assets/host-CYlIiY3r.js.map +0 -1
  188. package/dist/assets/hyperdhtRelay-1wzya_0L.js +0 -25
  189. package/dist/assets/hyperdhtRelay-1wzya_0L.js.map +0 -1
  190. package/dist/assets/hyperdhtRelay-CdsLcAhY.js.map +0 -1
  191. package/dist/assets/irohWeb-D2IuloLL.js.map +0 -1
  192. package/dist/assets/joinTrace-D-fnt2p3.js +0 -2
  193. package/dist/assets/jsonOut-POtMBS_V.js +0 -16
  194. package/dist/assets/jsonOut-POtMBS_V.js.map +0 -1
  195. package/dist/assets/main-C0PfjKTe.js.map +0 -1
  196. package/dist/assets/mainline-Cu61qcPS.js.map +0 -1
  197. package/dist/assets/mints-BaOmx517.js +0 -2
  198. package/dist/assets/mints-j5XAOk4f.js.map +0 -1
  199. package/dist/assets/nwcProvider-DYHkd0iu.js +0 -88
  200. package/dist/assets/nwcProvider-DYHkd0iu.js.map +0 -1
  201. package/dist/assets/ownDid-CJ0ta8CL.js +0 -282
  202. package/dist/assets/ownDid-CJ0ta8CL.js.map +0 -1
  203. package/dist/assets/ownStatus-D4HC6tNR.js.map +0 -1
  204. package/dist/assets/profiles-Ccdq6Xf6.js.map +0 -1
  205. package/dist/assets/registry-CE0PpQAE.js +0 -2
  206. package/dist/assets/registry-LvxsLJ5S.js.map +0 -1
  207. package/dist/assets/resolve-6kVu2DE5.js +0 -400
  208. package/dist/assets/resolve-6kVu2DE5.js.map +0 -1
  209. package/dist/assets/secretGuard-DUr6bgKc.js +0 -2
  210. package/dist/assets/server-Q3VcNqGt.js.map +0 -1
  211. package/dist/assets/src-DjVj2ynY.js.map +0 -1
  212. package/dist/assets/sshForges-DeZ9cN9Q.js +0 -261
  213. package/dist/assets/sshForges-DeZ9cN9Q.js.map +0 -1
  214. package/dist/assets/storage-Bya5b2Xt.js.map +0 -1
  215. package/dist/assets/tree-store-N362nuzZ.js.map +0 -1
  216. package/dist/assets/usdt-DnyTGdTX.js.map +0 -1
  217. package/dist/assets/waitNotice-Cn0WJ-He.js.map +0 -1
  218. package/dist/assets/web-DwgdhfcY.js.map +0 -1
@@ -1,3 +1,3 @@
1
- import { M as startNamedChats, l as findGroup, s as findChat } from "./apiKit-DesObIDf.js";
2
- import { a as hideStateSecrets, c as settingsInEffect, i as groupSendRefused, n as SETTABLE, o as mentionsFor, r as callApi, s as redactSettings, t as API_METHODS } from "./api-DBlaoz8i.js";
1
+ import { F as startNamedChats, l as findGroup, s as findChat } from "./apiKit-CVaEzKWQ.js";
2
+ import { a as hideStateSecrets, c as settingsInEffect, i as groupSendRefused, n as SETTABLE, o as mentionsFor, r as callApi, s as redactSettings, t as API_METHODS } from "./api-DLzCtePC.js";
3
3
  export { API_METHODS, SETTABLE, callApi, findChat, findGroup, groupSendRefused, hideStateSecrets, mentionsFor, redactSettings, settingsInEffect, startNamedChats };
@@ -1,8 +1,40 @@
1
- import { $ as groupName, Zn as INVITE_TAKEN, _d as sanitizeDisplayText, xd as isZ32Key } from "./src-DjVj2ynY.js";
2
- import { t as CliError } from "./errors-Dt-ZnyOX.js";
3
- //#region src/apiKit.ts
1
+ import { u as groupName, x as INVITE_TAKEN } from "./groupMeta-DTQAJG50.js";
2
+ import { o as isZ32Key } from "./bytes-C1DNGY18.js";
3
+ import { r as sanitizeDisplayText } from "./text-li76pThX.js";
4
+ import { t as CliError } from "./errors-DDLFO4Gf.js";
5
+ // src/jsonOut.ts
6
+ /**
7
+ * What `JSON.stringify` leaves raw and a terminal may act on: DEL and the C1 controls (CSI, OSC, ST, NEL... in UTF-8),
8
+ * the line and paragraph separators, and the bidi marks, embeddings, overrides and isolates that reorder a line. Only
9
+ * a string holds them, and a peer writes some of those strings (a message's text), so the CLI's output writes them as
10
+ * `\uXXXX`: the same JSON value for every reader, nothing a terminal acts on. What is stored stays whole.
11
+ */
12
+ var RAW = /[\u007f-\u009f\u061c\u200e\u200f\u2028\u2029\u202a-\u202e\u2066-\u2069]/g;
13
+ /** `value` as the JSON the CLI prints: `JSON.stringify`, with `RAW` escaped. */
14
+ function jsonOut(value, space) {
15
+ return JSON.stringify(value, null, space)?.replace(RAW, (char) => "\\u" + char.charCodeAt(0).toString(16).padStart(4, "0"));
16
+ }
17
+ // src/shellWord.ts
18
+ /**
19
+ * A word as a hint offers it to be pasted into a shell: as it is when plain, else single-quoted. JSON's double quotes
20
+ * are no shell quoting: `"$5 lunch"` pasted names ` lunch`, and a backtick in it runs a command. A leading `=` stays
21
+ * quoted too (zsh expands `=word` to a command's path). Every "<name> (2)" a keep-both hint names has a `(` in it, a
22
+ * syntax error in bash and zsh unquoted.
23
+ *
24
+ * The CLI prints every answer, an error too, as JSON, and a hint is pasted as the terminal shows it: a `'` quoted as
25
+ * `'\''` read `'\\''` there, which ended the quote, and the rest of the word ran as commands (a group's name is its
26
+ * inviter's, a kept-both file's its sender's). A `"` or a `\` came out doubled the same way. No shell quoting survives
27
+ * that, so such a word is not offered: `instead` is said, an id that names the same thing or where the details hold it.
28
+ */
29
+ function shellWord(word, instead) {
30
+ if (/^[\w@%+:,./-][\w@%+=:,./-]*$/.test(word)) return word;
31
+ return word.includes("'") || jsonOut(word) !== `"${word}"` ? instead : `'${word}'`;
32
+ }
33
+ // src/apiKit.ts
4
34
  var node = (ctx) => ctx.runtime.server.node;
5
35
  var state = (ctx) => node(ctx).getState();
36
+ /** The engine's settings, without building `state` (a view of every chat). */
37
+ var settingsOf = (ctx) => node(ctx).getSettings();
6
38
  /**
7
39
  * The time of a send the engine names its row after (`me_<timestamp>`: a file, a payment, a request), its own even
8
40
  * within one millisecond (a bot paying or sending several times at once over the socket, `file send` run in
@@ -157,21 +189,21 @@ function noChat(ref, groups) {
157
189
  if (group) return new CliError("not_found", `${JSON.stringify(ref)} is a group, not a chat (ghostly chat list)`, { group: group.id });
158
190
  return new CliError("not_found", `No chat ${JSON.stringify(ref)} (ghostly chat list)`);
159
191
  }
160
- /** A chat or group ref as a next step shows it: as given, quoted only when it holds more than a word. */
161
- var shownRef = (ref) => /^[\w.:-]+$/.test(ref) ? ref : JSON.stringify(ref);
192
+ /** A chat or group ref as a next step shows it: as given, quoted only when it holds more than a word (see `shellWord`). */
193
+ var shownRef = (place) => shellWord(place.ref, place.group ? "<group>" : "<chat>");
162
194
  /**
163
195
  * No message by `id` in a chat or a group, said one way by every command that takes one, as `noChat` says a chat: the id
164
196
  * quoted as given, and where the ids are. `whose` ("of yours", "from someone else") is what it had to be; `tail` what
165
197
  * else it may have failed for (", or it takes no reaction", ": only your own messages are sent again").
166
198
  */
167
199
  function noMessage(id, place, { whose, tail } = {}) {
168
- const history = `ghostly ${place.group ? "group" : "chat"} history ${shownRef(place.ref)}`;
200
+ const history = `ghostly ${place.group ? "group" : "chat"} history ${shownRef(place)}`;
169
201
  return new CliError("not_found", `No message ${JSON.stringify(id)}${whose ? ` ${whose}` : ""} in this ${place.group ? "group" : "chat"}${tail ?? ""} (${history})`);
170
202
  }
171
203
  /** No file by `id`, as `noMessage` says a message: in the chat or group named (`place`), or in none when none was. */
172
204
  function noFile(id, place) {
173
205
  const where = place ? ` in this ${place.group ? "group" : "chat"}` : "";
174
- return new CliError("not_found", `No file ${JSON.stringify(id)}${where} (ghostly file list ${place ? shownRef(place.ref) : "<chat|group>"})`);
206
+ return new CliError("not_found", `No file ${JSON.stringify(id)}${where} (ghostly file list ${place ? shownRef(place) : "<chat|group>"})`);
175
207
  }
176
208
  /** The one group `ref` names, if any (none, or more than one: undefined). */
177
209
  function groupNamed(ref, groups) {
@@ -297,8 +329,9 @@ function findChatOrGroup(links, groups, ref) {
297
329
  return { link: chat.link };
298
330
  }
299
331
  /**
300
- * Starts the chats a call names (its `chat`, a forward's `to`) in a runtime that left the saved chats unstarted
301
- * (`RuntimeOptions.deferChats`). A ref that names no chat, or names a group, starts nothing: the call says so itself.
332
+ * Starts the chats and groups a call names (its `chat`, a forward's `to`, its `group`) in a runtime that left the saved
333
+ * chats and the groups' edges unstarted (`RuntimeOptions.deferChats`). A ref that names nothing starts nothing: the
334
+ * call says so itself.
302
335
  */
303
336
  async function startNamedChats(ctx, params) {
304
337
  const { links, groups } = state(ctx);
@@ -311,14 +344,49 @@ async function startNamedChats(ctx, params) {
311
344
  continue;
312
345
  }
313
346
  if ("link" in found) await node(ctx).startDeferredChat(found.link.id);
347
+ else node(ctx).startDeferredGroup(found.group.id);
348
+ }
349
+ if (typeof params.group === "string") try {
350
+ node(ctx).startDeferredGroup(findGroup(groups, params.group).id);
351
+ } catch {}
352
+ }
353
+ /**
354
+ * The chat a call names. `s`: a state the call built already. Each build is a view of every chat (about 15-20 µs a
355
+ * chat, on the daemon's one thread): one lookup builds one, never one per list it reads.
356
+ */
357
+ function chatOf(ctx, params, s) {
358
+ const ref = str(params, "chat", true);
359
+ if (!s) {
360
+ const chat = byId(ctx, ref);
361
+ if (chat) return chat;
314
362
  }
363
+ const { links, groups } = s ?? state(ctx);
364
+ return findChat(links, ref, groups);
315
365
  }
316
- var chatOf = (ctx, params) => findChat(state(ctx).links, str(params, "chat", true), state(ctx).groups);
366
+ /** `findOwnNamedChat` for the chat a call names, as `chatOf`. */
367
+ function ownChatOf(ctx, params, s) {
368
+ const ref = str(params, "chat", true);
369
+ if (!s) {
370
+ const chat = byId(ctx, ref);
371
+ if (chat) return chat;
372
+ }
373
+ const { links, groups } = s ?? state(ctx);
374
+ return findOwnNamedChat(links, ref, groups);
375
+ }
376
+ /**
377
+ * The chat whose id `ref` is, built alone: a chat's own id names it before anything else does (`chatBy`), and a bot
378
+ * names its chats by the ids its events give. Undefined for any other ref, which the whole list is read for.
379
+ */
380
+ var byId = (ctx, ref) => node(ctx).chatView(ref);
317
381
  /** A chat of mine whose invite nobody took yet: no contact's key, so nothing goes out until they join. */
318
382
  var nobodyJoined = (link) => !!(link.profile && link.inviteCode && !link.peerParticipationKey);
319
- /** `nobodyJoined` by the chat's id: a group's (`group:<id>`) is never one. */
383
+ /**
384
+ * `nobodyJoined` by the chat's id: a group's (`group:<id>`) is never one. That chat's view alone: every card send or
385
+ * update, `file send` and unconfirmed edit asks it, and built every chat for it (once in a daemon, up to three times
386
+ * in a one-shot `usage send`).
387
+ */
320
388
  var nobodyJoinedChat = (ctx, chat) => {
321
- const link = state(ctx).links.find((l) => l.id === chat);
389
+ const link = byId(ctx, chat);
322
390
  return !!link && nobodyJoined(link);
323
391
  };
324
392
  /**
@@ -379,9 +447,16 @@ function transportOffered(link, transport) {
379
447
  transport
380
448
  });
381
449
  }
382
- /** A chat or a group as `findChatOrGroup` reads it. `linkId` is what the engine calls it. */
383
- function chatOrGroup(ctx, ref) {
384
- const found = findChatOrGroup(state(ctx).links, state(ctx).groups, ref);
450
+ /** A chat or a group as `findChatOrGroup` reads it. `linkId` is what the engine calls it. `s`: as for `chatOf`. */
451
+ function chatOrGroup(ctx, ref, s) {
452
+ const chat = s ? void 0 : byId(ctx, ref);
453
+ if (chat) return {
454
+ id: chat.id,
455
+ linkId: chat.id,
456
+ group: false
457
+ };
458
+ const { links, groups } = s ?? state(ctx);
459
+ const found = findChatOrGroup(links, groups, ref);
385
460
  return "group" in found ? {
386
461
  id: found.group.id,
387
462
  linkId: `group:${found.group.id}`,
@@ -399,21 +474,30 @@ function chatOrGroup(ctx, ref) {
399
474
  */
400
475
  function groupOf(ctx, params, twin) {
401
476
  const ref = str(params, "group", true);
477
+ const byId = groupById(ctx, groupPrefixed(ref) ?? ref);
478
+ if (byId) return byId;
479
+ const { links, groups } = state(ctx);
402
480
  try {
403
- return findGroup(state(ctx).groups, ref);
481
+ return findGroup(groups, ref);
404
482
  } catch (error) {
405
483
  if (!(error instanceof CliError) || error.code !== "not_found" || groupPrefixed(ref) !== null) throw error;
406
484
  let chat;
407
485
  try {
408
- chat = findChat(state(ctx).links, ref);
486
+ chat = findChat(links, ref);
409
487
  } catch {
410
488
  throw error;
411
489
  }
412
- const shown = /^[\w.:-]+$/.test(ref) ? ref : JSON.stringify(ref);
490
+ const shown = shellWord(ref, chat.id);
413
491
  throw new CliError("not_found", `${JSON.stringify(ref)} is a chat, not a group${twin ? `: ghostly ${twin.replace("<chat>", shown)}` : " (ghostly group list)"}`, { chat: chat.id });
414
492
  }
415
493
  }
416
494
  /**
495
+ * The group whose id `id` is, built alone with its members' edges, as `byId` builds a chat: a group's own id names it
496
+ * before anything else does (`findGroup`), and a bot names a group by the id its events give. Undefined for any other
497
+ * ref, which the whole list is read for.
498
+ */
499
+ var groupById = (ctx, id) => node(ctx).groupView(id);
500
+ /**
417
501
  * A message of a chat or a group (`group:<id>`) named by its id here, read as one row; only a name that is no such
418
502
  * row's key (the id both sides know, `wireId`) reads the whole history. `keep`: only a message it accepts (mine, or
419
503
  * someone else's). The history is synchronous work on the daemon's one thread, about 120 ms at 10,000 messages.
@@ -460,7 +544,6 @@ function waitForState(ctx, check, ms, what, stopping) {
460
544
  else stopping?.addEventListener("abort", stopped, { once: true });
461
545
  });
462
546
  }
463
- //#endregion
464
- export { sinceSeq as A, nobodyJoinedChat as C, oneShotWaits as D, oneOf as E, transportOffered as F, waitForState as I, startNamedChats as M, state as N, sentAt as O, str as P, nobodyJoined as S, num as T, messageOf as _, contactKeyOf as a, noFile as b, findChatOrGroup as c, groupNameOf as d, groupOf as f, list as g, keptForJoin as h, cleanName as i, somebodyJoined as j, shownName as k, findGroup as l, inviteTaken as m, chatOf as n, dhtOnly as o, groupPrefixed as p, chatOrGroup as r, findChat as s, bool as t, findOwnNamedChat as u, nameKey as v, node as w, noMessage as x, namedByThem as y };
547
+ export { sentAt as A, shellWord as B, nobodyJoined as C, oneOf as D, num as E, startNamedChats as F, state as I, str as L, shownName as M, sinceSeq as N, oneShotWaits as O, somebodyJoined as P, transportOffered as R, noMessage as S, node as T, jsonOut as V, list as _, contactKeyOf as a, namedByThem as b, findChatOrGroup as c, groupById as d, groupNameOf as f, keptForJoin as g, inviteTaken as h, cleanName as i, settingsOf as j, ownChatOf as k, findGroup as l, groupPrefixed as m, chatOf as n, dhtOnly as o, groupOf as p, chatOrGroup as r, findChat as s, bool as t, findOwnNamedChat as u, messageOf as v, nobodyJoinedChat as w, noFile as x, nameKey as y, waitForState as z };
465
548
 
466
- //# sourceMappingURL=apiKit-DesObIDf.js.map
549
+ //# sourceMappingURL=apiKit-CVaEzKWQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiKit-CVaEzKWQ.js","names":[],"sources":["../../src/jsonOut.ts","../../src/shellWord.ts","../../src/apiKit.ts"],"sourcesContent":["/**\n * What `JSON.stringify` leaves raw and a terminal may act on: DEL and the C1 controls (CSI, OSC, ST, NEL... in UTF-8),\n * the line and paragraph separators, and the bidi marks, embeddings, overrides and isolates that reorder a line. Only\n * a string holds them, and a peer writes some of those strings (a message's text), so the CLI's output writes them as\n * `\\uXXXX`: the same JSON value for every reader, nothing a terminal acts on. What is stored stays whole.\n */\nconst RAW = /[\\u007f-\\u009f\\u061c\\u200e\\u200f\\u2028\\u2029\\u202a-\\u202e\\u2066-\\u2069]/g;\n\n/** `value` as the JSON the CLI prints: `JSON.stringify`, with `RAW` escaped. */\nexport function jsonOut(value: unknown, space?: number): string {\n return JSON.stringify(value, null, space)?.replace(RAW, (char) => \"\\\\u\" + char.charCodeAt(0).toString(16).padStart(4, \"0\"));\n}\n","import { jsonOut } from \"./jsonOut\";\n\n/**\n * A word as a hint offers it to be pasted into a shell: as it is when plain, else single-quoted. JSON's double quotes\n * are no shell quoting: `\"$5 lunch\"` pasted names ` lunch`, and a backtick in it runs a command. A leading `=` stays\n * quoted too (zsh expands `=word` to a command's path). Every \"<name> (2)\" a keep-both hint names has a `(` in it, a\n * syntax error in bash and zsh unquoted.\n *\n * The CLI prints every answer, an error too, as JSON, and a hint is pasted as the terminal shows it: a `'` quoted as\n * `'\\''` read `'\\\\''` there, which ended the quote, and the rest of the word ran as commands (a group's name is its\n * inviter's, a kept-both file's its sender's). A `\"` or a `\\` came out doubled the same way. No shell quoting survives\n * that, so such a word is not offered: `instead` is said, an id that names the same thing or where the details hold it.\n */\nexport function shellWord(word: string, instead: string): string {\n if (/^[\\w@%+:,./-][\\w@%+=:,./-]*$/.test(word)) return word;\n return word.includes(\"'\") || jsonOut(word) !== `\"${word}\"` ? instead : `'${word}'`;\n}\n","import { groupName, INVITE_TAKEN, isZ32Key, MAX_GROUP_NAME_BYTES, MAX_GROUP_NAME_LENGTH, sanitizeDisplayText, type PairedTransport } from \"@ghostly/core\";\nimport type { GhostlyNode } from \"@ghostly/browser/engine/node\";\nimport type { EngineState, GroupView, LinkView, Settings, StoredMessage } from \"@ghostly/browser/shared/types\";\nimport { CliError } from \"./errors\";\nimport { shellWord } from \"./shellWord\";\nimport type { CallManager } from \"./calls/manager\";\nimport type { EventHub } from \"./events\";\nimport type { GroupAutoJoin } from \"./groupAuto\";\nimport type { Runtime } from \"./runtime/engine\";\n\n/**\n * The methods of the local control API (WISP 1100): the daemon answers them over its socket, and a one-shot\n * command calls them in its own process. Parameters come from JSON: every one is checked here.\n */\nexport interface ApiContext {\n runtime: Runtime;\n hub: EventHub;\n /** Voice calls (WISP 1100 § Calls). */\n calls: CallManager;\n /** Group invitations accepted by themselves (`group auto`). */\n groupAuto: GroupAutoJoin;\n /** How the host runs: a daemon stays; a one-shot leaves when its command is done. */\n mode: \"daemon\" | \"one-shot\";\n version: string;\n /** The daemon asks to stop (answered first). */\n stop?: () => void;\n /**\n * Aborted when the daemon stops (`serve().close`): a wait still open answers with what it knows (`waits.ts`), as a\n * timeout with `details.reason: \"daemon-stopped\"`, before the connections end.\n */\n stopping?: AbortSignal;\n /** The daemon is a `listen` that found none and runs the profile itself: a stop ends that listen too. */\n listen?: true;\n}\n\nexport type Params = Record<string, unknown>;\n/** What a call knows of who asked it. */\nexport interface CallScope {\n /**\n * Aborted when the daemon's connection the call came on closes (Ctrl-C on the command, its process gone): nobody\n * reads the answer any more. A call that leaves something behind for its answer (`profile.backup`) stops on it.\n */\n gone?: AbortSignal;\n}\n\nexport type Method = (ctx: ApiContext, params: Params, call?: CallScope) => Promise<unknown>;\n\nexport const node = (ctx: ApiContext): GhostlyNode => ctx.runtime.server.node;\nexport const state = (ctx: ApiContext): EngineState => node(ctx).getState();\n/** The engine's settings, without building `state` (a view of every chat). */\nexport const settingsOf = (ctx: ApiContext): Settings => node(ctx).getSettings();\n\n/**\n * The time of a send the engine names its row after (`me_<timestamp>`: a file, a payment, a request), its own even\n * within one millisecond (a bot paying or sending several times at once over the socket, `file send` run in\n * parallel), or the chat keeps only one. One clock for all of them: they share the row names. A file's resend after a\n * drop finds its row by it, as a forward does.\n */\nlet lastSentAt = 0;\nexport const sentAt = () => (lastSentAt = Math.max(Date.now(), lastSentAt + 1));\n\n// ---------- parameters ----------\n\nexport function str(params: Params, name: string, required: true): string;\nexport function str(params: Params, name: string, required?: false): string | undefined;\nexport function str(params: Params, name: string, required = false): string | undefined {\n const value = params[name];\n if (value === undefined || value === null || value === \"\") {\n if (required) throw new CliError(\"bad_request\", `${name} is required`);\n return undefined;\n }\n if (typeof value !== \"string\") throw new CliError(\"bad_request\", `${name} must be a string`);\n return value;\n}\n/** A number in `[min, max]`; `whole` takes only whole ones (a count of messages), as the engine needs them. */\nexport function num(params: Params, name: string, fallback: number, { min = 0, max = Number.MAX_SAFE_INTEGER, whole = false } = {}): number {\n const value = params[name];\n if (value === undefined || value === null) return fallback;\n if (typeof value !== \"number\" || !Number.isFinite(value) || value < min || value > max) throw new CliError(\"bad_request\", `${name} must be a ${whole ? \"whole \" : \"\"}number from ${min} to ${max}`);\n if (whole && !Number.isSafeInteger(value)) throw new CliError(\"bad_request\", `${name} must be a whole number from ${min} to ${max}`);\n return value;\n}\n/**\n * The seq `events.replay` and `events.subscribe` start after: whole, from 0; `fallback` when left out. A cursor sent as\n * text (\"412\") was a stream from now on the socket with no error, and a negative one a gap of seqs that never were.\n */\nexport function sinceSeq(params: Params, fallback: number): number {\n return num(params, \"since\", fallback, { whole: true });\n}\nexport function bool(params: Params, name: string): boolean {\n const value = params[name];\n if (value === undefined || value === null) return false;\n if (typeof value !== \"boolean\") throw new CliError(\"bad_request\", `${name} must be true or false`);\n return value;\n}\nexport function list(params: Params, name: string): string[] {\n const value = params[name];\n if (value === undefined || value === null) return [];\n if (!Array.isArray(value) || value.some((item) => typeof item !== \"string\")) throw new CliError(\"bad_request\", `${name} must be a list of strings`);\n return value as string[];\n}\n/**\n * One of `values`; `fallback` when it was left out. Given empty (an unset variable in a script: `wallet remove \"\"`), it\n * is refused like any other wrong choice, never read as left out: that acted on the default (the Cashu wallet).\n */\nexport function oneOf<T extends string>(params: Params, name: string, values: readonly T[], fallback: T): T {\n const value = params[name] === \"\" ? \"\" : str(params, name) ?? fallback;\n if (!values.includes(value as T)) throw new CliError(\"bad_request\", `${name} must be one of ${values.join(\", \")}`);\n return value as T;\n}\n\n// ---------- finding things ----------\n\nconst KEY_SHAPED = /^[ybndrfg8ejkmcpqxot1uwisza345h769]{52}$/;\n/**\n * A chat's id as the engine makes it (the first 16 characters of a z-base-32 key) and the CLI prints it as `chat`. A ref\n * so shaped is only ever an id: tested on its `nameKey`, so that a case, a space or an invisible character more is too.\n */\nconst CHAT_ID_SHAPED = /^[ybndrfg8ejkmcpqxot1uwisza345h769]{16}$/;\n/**\n * A contact key as chats show it (`peer`): 52 characters of z-base-32, in its one canonical spelling. The same 52\n * characters with the last one respelled decode to the same bytes but are no key (WISP 02): refused here, so that\n * they never fall through to a chat's name, which its contact chooses.\n */\nexport const CONTACT_KEY = {\n test(ref: string): boolean {\n if (isZ32Key(ref)) return true;\n if (KEY_SHAPED.test(ref)) throw new CliError(\"bad_request\", `${JSON.stringify(ref)} is not a contact key: a key has one spelling, and its last character is not this one`);\n return false;\n },\n};\n\n/**\n * The contact key `ref` is once read as a name is (`nameKey`: trimmed, invisible characters dropped, one case), or\n * undefined for a ref not shaped as one. A key a script or a paste left a line break, a space or capitals on is still\n * that key, and only ever names by key: never a chat, a group or a member by a name someone else chose. Every ref that\n * may be a key is read here, so no caller tests the raw string.\n */\nexport function contactKeyOf(ref: string): string | undefined {\n const key = nameKey(ref);\n return CONTACT_KEY.test(key) ? key : undefined;\n}\n\n/**\n * A chat's label, its contact's name or a group's name as a ref is compared with it: cleaned as the engine cleans a name\n * it stores (`renameLink`, `groupName`: any run of whitespace one space, invisible and direction-changing characters\n * dropped, trimmed), in one Unicode form (NFC) and one case. The string given to `chat rename` or `group create` finds\n * what it named, though what was stored is the cleaned one. Empty when nothing visible is left: that names nothing.\n */\nexport function nameKey(name: string | null | undefined): string {\n if (!name) return \"\";\n return (sanitizeDisplayText(name.replace(/\\s+/gu, \" \"), Infinity)?.replace(/ {2,}/g, \" \") ?? \"\").normalize(\"NFC\").toLowerCase();\n}\n\n/**\n * A name this side writes (a chat's label, the profile's name, a group's name) cleaned as the engine stores a name\n * (`renameLink`, `groupName`): any run of whitespace (a tab, a line break) one space, invisible and direction-changing\n * characters dropped, trimmed, in NFC: `nameKey` without the case. Counted after that, in code points as the engine\n * counts: undefined past `max`, \"\" when nothing visible is left. Every command that writes a name checks it here, so a\n * tab is a space and not a second line, and a name is never refused at a length it does not have once stored.\n */\nexport function cleanName(name: string, max: number): string | undefined {\n const clean = (sanitizeDisplayText(name.replace(/\\s+/gu, \" \"), Infinity)?.replace(/ {2,}/g, \" \") ?? \"\").normalize(\"NFC\");\n return [...clean].length > max ? undefined : clean;\n}\n\n/**\n * `name` as `cleanName` stores it, or the one refusal every name kind gives (`bad_request`), so a chat's, the profile's\n * and a group's name read alike. `subject` starts the sentence (\"A chat's name\", \"nick\"); `empty` follows \"needs a\n * character that shows\" (what an empty name does instead, when it does something). Too long says the count as stored,\n * in code points as the engine counts, and the largest character of several code points in it (a joined emoji or a\n * flag counts as several): the person sees what to cut, and a bot reads `details.length` and `details.max`.\n */\nexport function shownName(name: string, max: number, subject: string, empty = \"\"): string {\n const clean = cleanName(name, Infinity) ?? \"\";\n const length = [...clean].length;\n if (length > max) {\n const widest = [...new Intl.Segmenter(undefined, { granularity: \"grapheme\" }).segment(clean)]\n .map(({ segment }) => segment).reduce((a, b) => ([...b].length > [...a].length ? b : a), \"\");\n const several = [...widest].length > 1 ? `: ${widest} counts as ${[...widest].length}` : \"\";\n throw new CliError(\"bad_request\", `${subject} is up to ${max} characters as stored (this one is ${length}${several})`, { length, max });\n }\n if (!clean) throw new CliError(\"bad_request\", `${subject} needs a character that shows${empty}`);\n return clean;\n}\n\n/**\n * The `name` param of `group create` and `group rename`, refused as a chat's or the profile's name is (`shownName`),\n * then as the engine takes it (`groupName`: the same cleaning, 64 code points, 256 bytes; 64 code points never pass\n * 256 bytes, so its refusal is only a guard). Said here, before anything is made.\n */\nexport function groupNameOf(params: Params): string {\n const name = groupName(shownName(str(params, \"name\", true), MAX_GROUP_NAME_LENGTH, \"A group's name\"));\n if (!name) throw new CliError(\"bad_request\", `A group's name is up to ${MAX_GROUP_NAME_BYTES} bytes as stored`);\n return name;\n}\n\n/** Whether `name` is the one `key` (a ref's `nameKey`) names. */\nconst namedAs = (key: string, name: string | null | undefined) => key !== \"\" && nameKey(name) === key;\n\n/**\n * A chat by its id; by its contact's key (only by the key: a name is never taken for one); by the label this side gave\n * it; and only when no label matches, by a unique prefix of its id or the name the contact gave itself. The contact\n * controls both of those (a joiner's chat id is made from the inviter's code), so neither wins over a label, and a ref\n * that fits one chat's prefix and another's name is refused. A ref shaped as a chat's id is only ever an id, or a label\n * given here. `group:<ref>` is never a chat (a group, as everywhere). A ref\n * that names no chat but one of `groups` says it is a group (see `noChat`).\n */\nexport function findChat(links: readonly LinkView[], ref: string, groups: readonly GroupView[] = []): LinkView {\n return chatBy(links, ref, groups).link;\n}\n\n/**\n * No chat by `ref`. A group's id, prefix or name (or `group:<id>`) says it is a group, as `groupOf` says a chat is one:\n * `chat connect`, `identity share`, `call start` and the other commands that take only a 1:1 chat read `No chat \"Crew\"`,\n * as if nothing had that name.\n */\nfunction noChat(ref: string, groups: readonly GroupView[]): CliError {\n const group = groupNamed(ref, groups);\n if (group) return new CliError(\"not_found\", `${JSON.stringify(ref)} is a group, not a chat (ghostly chat list)`, { group: group.id });\n return new CliError(\"not_found\", `No chat ${JSON.stringify(ref)} (ghostly chat list)`);\n}\n\n/** A chat or group ref as a next step shows it: as given, quoted only when it holds more than a word (see `shellWord`). */\nconst shownRef = (place: RefPlace) => shellWord(place.ref, place.group ? \"<group>\" : \"<chat>\");\n\n/** The chat or the group a message or a file was looked for in, as the command was given it (`ref`). */\nexport type RefPlace = { group: boolean; ref: string };\n\n/**\n * No message by `id` in a chat or a group, said one way by every command that takes one, as `noChat` says a chat: the id\n * quoted as given, and where the ids are. `whose` (\"of yours\", \"from someone else\") is what it had to be; `tail` what\n * else it may have failed for (\", or it takes no reaction\", \": only your own messages are sent again\").\n */\nexport function noMessage(id: string, place: RefPlace, { whose, tail }: { whose?: string; tail?: string } = {}): CliError {\n const history = `ghostly ${place.group ? \"group\" : \"chat\"} history ${shownRef(place)}`;\n return new CliError(\"not_found\", `No message ${JSON.stringify(id)}${whose ? ` ${whose}` : \"\"} in this ${place.group ? \"group\" : \"chat\"}${tail ?? \"\"} (${history})`);\n}\n\n/** No file by `id`, as `noMessage` says a message: in the chat or group named (`place`), or in none when none was. */\nexport function noFile(id: string, place?: RefPlace): CliError {\n const where = place ? ` in this ${place.group ? \"group\" : \"chat\"}` : \"\";\n return new CliError(\"not_found\", `No file ${JSON.stringify(id)}${where} (ghostly file list ${place ? shownRef(place) : \"<chat|group>\"})`);\n}\n\n/** The one group `ref` names, if any (none, or more than one: undefined). */\nfunction groupNamed(ref: string, groups: readonly GroupView[]): GroupView | undefined {\n try { return findGroup(groups, ref); } catch { return undefined; }\n}\n\n/** `findChat`, and whether only what the contact controls (`theirName`: a prefix of the id, its own name) found the chat. */\nfunction chatBy(links: readonly LinkView[], ref: string, groups: readonly GroupView[] = []): { link: LinkView; theirName: boolean } {\n // \"\" (an unset variable in a script) is a prefix of every id: it took the only chat.\n if (!ref.trim()) throw new CliError(\"bad_request\", `${JSON.stringify(ref)} names no chat`);\n const exact = links.find((link) => link.id === ref);\n if (exact) return { link: exact, theirName: false };\n const contact = contactKeyOf(ref);\n if (contact !== undefined) {\n const byKey = links.filter((link) => link.peerPubKeyZ32 === contact);\n if (byKey.length === 1) return { link: byKey[0], theirName: false };\n if (byKey.length > 1) throw new CliError(\"bad_request\", `${JSON.stringify(ref)} names more than one chat: use its id`, { matches: byKey.map((link) => link.id) });\n throw new CliError(\"not_found\", `No chat with ${JSON.stringify(ref)} (ghostly chat list)`);\n }\n const key = nameKey(ref);\n const named = (name: string | null | undefined) => namedAs(key, name);\n const byLabel = links.filter((link) => named(link.label));\n // `group:<ref>` names a group (`groupPrefixed`), never a chat: not by a name its contact chose, nor by a label given\n // here (a chat labelled `group:Crew` was that chat for `chat show` and the group Crew for `send`). A chat labelled so\n // before labels were refused (`chatName`) is named by its id.\n if (groupPrefixed(ref) !== null) {\n if (byLabel.length && !groupNamed(ref, groups)) throw new CliError(\"not_found\", `${JSON.stringify(ref)} names a group, never a chat: name the chat labelled so by its id, and give it another name (ghostly chat rename <chat> <name>)`, { matches: byLabel.map((link) => link.id) });\n throw noChat(ref, groups);\n }\n // A chat's id no chat has (one removed since: a bot kept it from an event) is no chat. Its contact and whoever saw its\n // invite know it, so another contact could call itself that and take every later command sent by it. A label given\n // here still names the chat: only this side chooses it.\n if (!byLabel.length && CHAT_ID_SHAPED.test(key)) throw noChat(ref, groups);\n const found = byLabel.length ? byLabel : [...new Set([...links.filter((link) => link.id.startsWith(ref)), ...links.filter((link) => named(link.peerNick))])];\n if (found.length === 1) return { link: found[0], theirName: !byLabel.length };\n if (found.length > 1) throw new CliError(\"bad_request\", `${JSON.stringify(ref)} names more than one chat: use its id`, { matches: found.map((link) => link.id) });\n throw noChat(ref, groups);\n}\n\n/**\n * `findChat` for a grant the daemon keeps acting on (`call auto on --from`): only the chat's id, its contact's key or the\n * label this side gave it name the chat. A prefix of its id or the name its contact gave itself is refused, with the\n * chat it found: the contact chose those, so another contact could take the grant by calling itself that name.\n */\nexport function findOwnNamedChat(links: readonly LinkView[], ref: string, groups: readonly GroupView[] = []): LinkView {\n const chat = chatBy(links, ref, groups);\n if (chat.theirName) throw namedByThem(ref, { chat: chat.link.id, name: chat.link.peerNick ?? null, contact: chat.link.peerPubKeyZ32 });\n return chat.link;\n}\n\n/** `findOwnNamedChat`'s refusal: `ref` found `chat` only by what its contact chose. */\nexport function namedByThem(ref: string, chat: { chat: string; name: string | null; contact: string | undefined }): CliError {\n return new CliError(\"bad_request\", `${JSON.stringify(ref)} names a chat only by what its contact chose (a prefix of its id, its own name): use the chat's id, its contact's key or a label given here (ghostly chat rename <chat> <name>)`, chat);\n}\n\n/**\n * `group:<ref>`, the form that names a group wherever a group is taken (docs/CLI.md § What it does): `<ref>`, read as any\n * other ref (`findGroup`: an id, a prefix of it or a name). Null for a ref without it. `findGroup` and `findChatOrGroup`\n * both read the prefix here, so a group command and a command that takes a chat or a group never read it apart.\n */\nexport const groupPrefixed = (ref: string): string | null => (ref.startsWith(\"group:\") ? ref.slice(\"group:\".length) : null);\n\n/** Only an invitation so far: this profile is not in the group (yet), and whoever invited chose its name. */\nconst invitedOnly = (group: GroupView) => group.status === undefined && !!group.invitation;\n\n/**\n * A group by its id, by its name, or by a unique prefix of its id. Whoever created a group chose its id and its admin\n * chooses its name, so neither wins over the other: a ref that is one group's name and another's prefix is refused,\n * with both ids, as `chatBy` does for chats. A group this profile is in wins over an invitation with the same name or\n * prefix (the one who invites chooses those); an invitation is still found by its id, and by name or prefix where no\n * group of this profile has it. `group:<ref>` is `<ref>` (`groupPrefixed`); before, only the commands that take a chat\n * or a group read it, and every group command and `listen --group` answered it `No group`.\n */\nexport function findGroup(groups: readonly GroupView[], given: string): GroupView {\n const ref = groupPrefixed(given) ?? given;\n // Each refusal echoes the ref as given (`\"group:k86q\"`), not the part after `group:`: what the person typed.\n if (!ref.trim()) throw new CliError(\"bad_request\", `${JSON.stringify(given)} names no group`);\n const exact = groups.find((group) => group.id === ref);\n if (exact) return exact;\n const key = nameKey(ref);\n for (const among of [groups.filter((group) => !invitedOnly(group)), groups.filter(invitedOnly)]) {\n const found = among.filter((group) => namedAs(key, group.name) || group.id.startsWith(ref));\n if (found.length === 1) return found[0];\n if (found.length > 1) throw new CliError(\"bad_request\", `${JSON.stringify(given)} names more than one group: use its id`, { matches: found.map((group) => group.id) });\n }\n throw new CliError(\"not_found\", `No group ${JSON.stringify(given)} (ghostly group list)`);\n}\n\n/**\n * A chat or a group, where a command takes either: `group:<id>` is a group; anything else a chat first (`findChat`),\n * then a group. A chat found only by what its contact chose (a prefix of its id, its own name) never takes what also\n * names a group: a group's\n * own id is that group, and a prefix or the name of a group this profile is in is refused, with both ids. With neither,\n * one `not_found` names both and where to look (a contact's key: no chat with it); a name that matches more than one\n * chat or group stays that error.\n */\nexport function findChatOrGroup(links: readonly LinkView[], groups: readonly GroupView[], ref: string): { link: LinkView } | { group: GroupView } {\n if (groupPrefixed(ref) !== null) return { group: findGroup(groups, ref) };\n let chat: ReturnType<typeof chatBy>;\n try {\n chat = chatBy(links, ref);\n } catch (error) {\n if (!(error instanceof CliError) || error.code !== \"not_found\") throw error;\n // Nor is it a group's name or a prefix of a group's id (its admin and its creator chose those; a group's own id is\n // longer), nor is a contact's key with no chat: `group:<ref>` names a group.\n if (CHAT_ID_SHAPED.test(nameKey(ref)) || contactKeyOf(ref) !== undefined) throw error;\n try { return { group: findGroup(groups, ref) }; } catch (inner) {\n if (!(inner instanceof CliError) || inner.code !== \"not_found\") throw inner;\n throw new CliError(\"not_found\", `No chat or group ${JSON.stringify(ref)} (ghostly chat list, ghostly group list)`);\n }\n }\n if (!chat.theirName) return { link: chat.link };\n const exact = groups.find((group) => group.id === ref);\n if (exact) return { group: exact };\n const key = nameKey(ref);\n const also = groups.filter((group) => !invitedOnly(group) && (group.id.startsWith(ref) || namedAs(key, group.name)));\n if (also.length) throw new CliError(\"bad_request\", `${JSON.stringify(ref)} names a chat (by what its contact chose) and a group: use the chat's id or group:<id>`, { chat: chat.link.id, groups: also.map((group) => group.id) });\n return { link: chat.link };\n}\n\n/**\n * Starts the chats and groups a call names (its `chat`, a forward's `to`, its `group`) in a runtime that left the saved\n * chats and the groups' edges unstarted (`RuntimeOptions.deferChats`). A ref that names nothing starts nothing: the\n * call says so itself.\n */\nexport async function startNamedChats(ctx: ApiContext, params: Params): Promise<void> {\n const { links, groups } = state(ctx);\n for (const ref of [params.chat, ...(Array.isArray(params.to) ? params.to : [])]) {\n if (typeof ref !== \"string\") continue;\n let found: ReturnType<typeof findChatOrGroup>;\n try { found = findChatOrGroup(links, groups, ref); } catch { continue; }\n if (\"link\" in found) await node(ctx).startDeferredChat(found.link.id);\n else node(ctx).startDeferredGroup(found.group.id);\n }\n if (typeof params.group === \"string\") {\n try { node(ctx).startDeferredGroup(findGroup(groups, params.group).id); } catch { /* the call says so itself */ }\n }\n}\n\n/**\n * The chat a call names. `s`: a state the call built already. Each build is a view of every chat (about 15-20 µs a\n * chat, on the daemon's one thread): one lookup builds one, never one per list it reads.\n */\nexport function chatOf(ctx: ApiContext, params: Params, s?: EngineState): LinkView {\n const ref = str(params, \"chat\", true);\n if (!s) { const chat = byId(ctx, ref); if (chat) return chat; }\n const { links, groups } = s ?? state(ctx);\n return findChat(links, ref, groups);\n}\n/** `findOwnNamedChat` for the chat a call names, as `chatOf`. */\nexport function ownChatOf(ctx: ApiContext, params: Params, s?: EngineState): LinkView {\n const ref = str(params, \"chat\", true);\n if (!s) { const chat = byId(ctx, ref); if (chat) return chat; }\n const { links, groups } = s ?? state(ctx);\n return findOwnNamedChat(links, ref, groups);\n}\n/**\n * The chat whose id `ref` is, built alone: a chat's own id names it before anything else does (`chatBy`), and a bot\n * names its chats by the ids its events give. Undefined for any other ref, which the whole list is read for.\n */\nconst byId = (ctx: ApiContext, ref: string): LinkView | undefined => node(ctx).chatView(ref);\n\n/** A chat of mine whose invite nobody took yet: no contact's key, so nothing goes out until they join. */\nexport const nobodyJoined = (link: LinkView): boolean => !!(link.profile && link.inviteCode && !link.peerParticipationKey);\n\n/**\n * `nobodyJoined` by the chat's id: a group's (`group:<id>`) is never one. That chat's view alone: every card send or\n * update, `file send` and unconfirmed edit asks it, and built every chat for it (once in a daemon, up to three times\n * in a one-shot `usage send`).\n */\nexport const nobodyJoinedChat = (ctx: ApiContext, chat: string): boolean => {\n const link = byId(ctx, chat);\n return !!link && nobodyJoined(link);\n};\n\n/**\n * Whether a one-shot waits by default on what it did in a 1:1 chat: it leaves with its process, so it stays until that\n * went out or the contact confirmed it. Not on a chat nobody joined yet: there is no one to wait for, and `edit`, `react`,\n * `pin`, a card or a file sat their whole wait (a file 300 s), then failed `timeout`, exit 4, which a bot retries: one\n * more card or file each time. What was done is kept and goes once they join; the answer says so (`keptForJoin`).\n */\nexport const oneShotWaits = (ctx: ApiContext, chat: string): boolean => ctx.mode === \"one-shot\" && !nobodyJoinedChat(ctx, chat);\n\n/** An answer's `note` on a chat nobody joined yet: `what` is kept and goes once they join. Nothing on any other chat. */\nexport const keptForJoin = (ctx: ApiContext, chat: string, what: string): { note?: string } => nobodyJoinedChat(ctx, chat)\n ? { note: `Nobody joined this chat yet: ${what} goes once they join${ctx.mode === \"one-shot\" ? \" while this profile is online (`ghostly daemon --detach`)\" : \"\"}` }\n : {};\n\n/**\n * A chat whose invite nobody took yet has no session to close either: `chat disconnect` answered done with the chat at\n * `connecting`, and `--hold` put the waiting invite on DHT only (a one-shot answered `pairing: error`).\n */\nexport function somebodyJoined(link: LinkView): void {\n if (nobodyJoined(link)) throw new CliError(\"unavailable\", \"Nobody joined this chat yet: its invite is still waiting to be taken\");\n}\n\n/**\n * A chat whose invite nobody took yet: nobody is there to pay or to dial, and its stage says so. Before, `chat pay`\n * waited 15 s and `chat connect` 25 s for the contact, then answered `engine`. A chat whose invite someone else used\n * first is refused too, with the sentence `send` gives: its contact seals everything to them (`connect` waited 120 s,\n * then answered `timeout`, a code a bot retries).\n */\nexport function inviteTaken(link: LinkView): void {\n somebodyJoined(link);\n if (link.dhtDelivery?.inviteTaken && link.textDelivery !== \"stream\") throw new CliError(\"refused\", INVITE_TAKEN);\n}\n\n/**\n * A chat on DHT only opens no live session: the engine refused `chat connect` as `engine`, \"Both peers must choose a\n * live method first\", which read as if this side had to change something. Refused instead, naming whose choice it is\n * (`details.reason`): the contact's (`peer-dht-only`, nothing to do here but wait), or this side's (`dht-only`).\n */\nexport function dhtOnly(link: LinkView): void {\n if (link.deliveryMode === \"dht\") throw new CliError(\"refused\", \"This chat is on DHT only on this side: choose a live method first (chat transport auto)\", { reason: \"dht-only\" });\n if (link.dhtDelivery?.peerMode === \"dht\") throw new CliError(\"refused\", \"Your contact keeps this chat on DHT only: it goes live once they choose a live method. Short texts still go on the DHT\", { reason: \"peer-dht-only\" });\n}\n\nconst TRANSPORT_TITLES: Record<PairedTransport, string> = { \"webrtc/1\": \"WebRTC\", \"iroh/1\": \"Iroh\", \"hyperdht/1\": \"HyperDHT\" };\n\n/**\n * A transport the chat's Connection menu offers: one this app runs (on DHT only, one it can start), and the contact's\n * app too, by its last word. `chat transport` took any: toward a contact with no WebRTC (`GHOSTLY_WEBRTC=0`) the choice\n * was kept and the chat stayed where it was, saying nothing; for one this app lacks, the engine answered `engine`,\n * \"Transport unavailable\". Refused instead, saying whose app lacks it (`details.reason`, as a chat's wait says it).\n */\nexport function transportOffered(link: LinkView, transport: PairedTransport): void {\n const mine = (link.deliveryMode === \"dht\" ? link.runnableTransports : undefined) ?? link.availableTransports;\n const title = TRANSPORT_TITLES[transport], error = link.transportErrors?.[transport];\n if (mine && !mine.includes(transport)) throw new CliError(\"refused\", `This app has no ${title} running${error ? `: ${error}` : \"\"}`, { reason: \"app-lacks\", transport });\n if (link.peerTransports?.length && !link.peerTransports.includes(transport)) throw new CliError(\"refused\", `Your contact's app doesn't have ${title}: choose another, or auto`, { reason: \"contact-lacks\", transport });\n}\n\n/** A chat or a group as `findChatOrGroup` reads it. `linkId` is what the engine calls it. `s`: as for `chatOf`. */\nexport function chatOrGroup(ctx: ApiContext, ref: string, s?: EngineState): { id: string; linkId: string; group: boolean } {\n const chat = s ? undefined : byId(ctx, ref);\n if (chat) return { id: chat.id, linkId: chat.id, group: false };\n const { links, groups } = s ?? state(ctx);\n const found = findChatOrGroup(links, groups, ref);\n return \"group\" in found ? { id: found.group.id, linkId: `group:${found.group.id}`, group: true } : { id: found.link.id, linkId: found.link.id, group: false };\n}\n\n/**\n * The group a group command names. A chat's id, key or name says it is a chat, with `twin`, the chat command that takes\n * it (`group send` on a chat, where `send` is meant; `<chat>` stands for the ref), else where the groups are listed.\n * It read \"No group\" before. A name nothing has stays that error.\n */\nexport function groupOf(ctx: ApiContext, params: Params, twin?: string): GroupView {\n const ref = str(params, \"group\", true);\n const byId = groupById(ctx, groupPrefixed(ref) ?? ref);\n if (byId) return byId;\n const { links, groups } = state(ctx);\n try { return findGroup(groups, ref); } catch (error) {\n // `group:<ref>` names a group only: never a chat, as in `findChatOrGroup`.\n if (!(error instanceof CliError) || error.code !== \"not_found\" || groupPrefixed(ref) !== null) throw error;\n let chat: LinkView;\n try { chat = findChat(links, ref); } catch { throw error; }\n const shown = shellWord(ref, chat.id);\n throw new CliError(\"not_found\", `${JSON.stringify(ref)} is a chat, not a group${twin ? `: ghostly ${twin.replace(\"<chat>\", shown)}` : \" (ghostly group list)\"}`, { chat: chat.id });\n }\n}\n\n/**\n * The group whose id `id` is, built alone with its members' edges, as `byId` builds a chat: a group's own id names it\n * before anything else does (`findGroup`), and a bot names a group by the id its events give. Undefined for any other\n * ref, which the whole list is read for.\n */\nexport const groupById = (ctx: ApiContext, id: string): GroupView | undefined => node(ctx).groupView(id);\n\n/**\n * A message of a chat or a group (`group:<id>`) named by its id here, read as one row; only a name that is no such\n * row's key (the id both sides know, `wireId`) reads the whole history. `keep`: only a message it accepts (mine, or\n * someone else's). The history is synchronous work on the daemon's one thread, about 120 ms at 10,000 messages.\n */\nexport async function messageOf(ctx: ApiContext, linkId: string, ref: string, keep: (message: StoredMessage) => boolean = () => true): Promise<StoredMessage | undefined> {\n const found = await node(ctx).getMessage(linkId, ref);\n if (found && keep(found)) return found;\n const all = linkId.startsWith(\"group:\") ? await node(ctx).groupMessages({ groupId: linkId.slice(\"group:\".length) }) : await node(ctx).getMessages(linkId);\n return all.find((m) => keep(m) && m.wireId === ref);\n}\n\n// ---------- waiting ----------\n\n/**\n * Resolves with `check`'s first defined answer: now, or on a later state; `timeout` error after `ms`. A check that\n * throws on a later state (`chat wait`'s chat removed) ends the wait with its error: the hub swallows what its\n * listeners throw, and the wait went on to its timeout.\n *\n * `stopping` (a daemon's `ctx.stopping`): the daemon's stop ends it too, as a timeout with `details.reason:\n * \"daemon-stopped\"`, for a wait whose command did something (`file send --wait`) and answers with what it knows. A\n * wait that changes nothing is left to its connection's end, and its client asks it again (main.ts `READ_WAITS`).\n */\nexport function waitForState<T>(ctx: ApiContext, check: (state: EngineState) => T | undefined, ms: number, what: string, stopping?: AbortSignal): Promise<T> {\n const now = check(state(ctx));\n if (now !== undefined) return Promise.resolve(now);\n return new Promise<T>((resolve, reject) => {\n const end = (error: unknown) => { clearTimeout(timer); off(); stopping?.removeEventListener(\"abort\", stopped); if (error) reject(error); };\n const stopped = () => end(new CliError(\"timeout\", `The daemon stopped before the wait ended, waiting for ${what}`, { reason: \"daemon-stopped\" }));\n const timer = setTimeout(() => end(new CliError(\"timeout\", `Timed out after ${Math.round(ms / 1000)} s waiting for ${what}`)), ms);\n const off = ctx.hub.onState((next) => {\n let value: T | undefined;\n try { value = check(next); } catch (error) { end(error); return; }\n if (value === undefined) return;\n end(null);\n resolve(value);\n });\n if (stopping?.aborted) stopped();\n else stopping?.addEventListener(\"abort\", stopped, { once: true });\n });\n}\n\n"],"mappings":";;;;;;;;;;;AAMA,IAAM,MAAM;;AAGZ,SAAgB,QAAQ,OAAgB,OAAwB;CAC9D,OAAO,KAAK,UAAU,OAAO,MAAM,KAAK,CAAC,EAAE,QAAQ,MAAM,SAAS,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC;AAC5H;;;;;;;;;;;;;ACEA,SAAgB,UAAU,MAAc,SAAyB;CAC/D,IAAI,+BAA+B,KAAK,IAAI,GAAG,OAAO;CACtD,OAAO,KAAK,SAAS,GAAG,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,KAAK,UAAU,IAAI,KAAK;AAClF;;AC+BA,IAAa,QAAQ,QAAiC,IAAI,QAAQ,OAAO;AACzE,IAAa,SAAS,QAAiC,KAAK,GAAG,CAAC,CAAC,SAAS;;AAE1E,IAAa,cAAc,QAA8B,KAAK,GAAG,CAAC,CAAC,YAAY;;;;;;;AAQ/E,IAAI,aAAa;AACjB,IAAa,eAAgB,aAAa,KAAK,IAAI,KAAK,IAAI,GA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