@archipelagolab/lobi 1.0.1 → 1.0.5
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.
- package/dist/APEv2Parser-6EMKXRZS.js +15 -0
- package/dist/APEv2Parser-6EMKXRZS.js.map +7 -0
- package/dist/AiffParser-E6XWRTXM.js +194 -0
- package/dist/AiffParser-E6XWRTXM.js.map +7 -0
- package/dist/AsfParser-WSOH2JQY.js +620 -0
- package/dist/AsfParser-WSOH2JQY.js.map +7 -0
- package/dist/DsdiffParser-EUWJ4YAR.js +192 -0
- package/dist/DsdiffParser-EUWJ4YAR.js.map +7 -0
- package/dist/DsfParser-R6TPBJIY.js +114 -0
- package/dist/DsfParser-R6TPBJIY.js.map +7 -0
- package/dist/FlacParser-VDASGZ3E.js +16 -0
- package/dist/FlacParser-VDASGZ3E.js.map +7 -0
- package/dist/MP4Parser-64RGJLUM.js +1145 -0
- package/dist/MP4Parser-64RGJLUM.js.map +7 -0
- package/dist/MatroskaParser-O6RXAKYA.js +662 -0
- package/dist/MatroskaParser-O6RXAKYA.js.map +7 -0
- package/dist/MpegParser-B6NX6DS3.js +652 -0
- package/dist/MpegParser-B6NX6DS3.js.map +7 -0
- package/dist/MusepackParser-WUBT63DS.js +331 -0
- package/dist/MusepackParser-WUBT63DS.js.map +7 -0
- package/dist/OggParser-ZY6E5C2P.js +448 -0
- package/dist/OggParser-ZY6E5C2P.js.map +7 -0
- package/dist/WavPackParser-5KTCSQEU.js +209 -0
- package/dist/WavPackParser-5KTCSQEU.js.map +7 -0
- package/dist/WaveParser-RZSHVQPZ.js +300 -0
- package/dist/WaveParser-RZSHVQPZ.js.map +7 -0
- package/dist/auth-presence.js +46 -0
- package/dist/auth-presence.js.map +7 -0
- package/dist/channel-plugin-api.js +79 -0
- package/dist/channel-plugin-api.js.map +7 -0
- package/dist/chunk-22WAAZ6I.js +114 -0
- package/dist/chunk-22WAAZ6I.js.map +7 -0
- package/dist/chunk-2A6HEFSO.js +676 -0
- package/dist/chunk-2A6HEFSO.js.map +7 -0
- package/dist/chunk-2KGHUHKU.js +169 -0
- package/dist/chunk-2KGHUHKU.js.map +7 -0
- package/dist/chunk-2NEQI4K6.js +171 -0
- package/dist/chunk-2NEQI4K6.js.map +7 -0
- package/dist/chunk-2OSJ3MTW.js +175 -0
- package/dist/chunk-2OSJ3MTW.js.map +7 -0
- package/dist/chunk-2Q626TDO.js +27 -0
- package/dist/chunk-2Q626TDO.js.map +7 -0
- package/dist/chunk-2U6OZ7N2.js +155 -0
- package/dist/chunk-2U6OZ7N2.js.map +7 -0
- package/dist/chunk-2Z4IOUDZ.js +129 -0
- package/dist/chunk-2Z4IOUDZ.js.map +7 -0
- package/dist/chunk-2ZEPAW7U.js +154 -0
- package/dist/chunk-2ZEPAW7U.js.map +7 -0
- package/dist/chunk-2ZI6JK5O.js +63 -0
- package/dist/chunk-2ZI6JK5O.js.map +7 -0
- package/dist/chunk-34UY6D6X.js +36 -0
- package/dist/chunk-34UY6D6X.js.map +7 -0
- package/dist/chunk-3JD6JSJD.js +111 -0
- package/dist/chunk-3JD6JSJD.js.map +7 -0
- package/dist/chunk-3TOEIHG5.js +314 -0
- package/dist/chunk-3TOEIHG5.js.map +7 -0
- package/dist/chunk-3TRKKAVT.js +130 -0
- package/dist/chunk-3TRKKAVT.js.map +7 -0
- package/dist/chunk-3UFTTK7C.js +418 -0
- package/dist/chunk-3UFTTK7C.js.map +7 -0
- package/dist/chunk-3XO6AAIC.js +25 -0
- package/dist/chunk-3XO6AAIC.js.map +7 -0
- package/dist/chunk-427SAQME.js +321 -0
- package/dist/chunk-427SAQME.js.map +7 -0
- package/dist/chunk-4JVNTZAI.js +80 -0
- package/dist/chunk-4JVNTZAI.js.map +7 -0
- package/dist/chunk-4O3BEYYM.js +187 -0
- package/dist/chunk-4O3BEYYM.js.map +7 -0
- package/dist/chunk-4Z2N4GW6.js +247 -0
- package/dist/chunk-4Z2N4GW6.js.map +7 -0
- package/dist/chunk-56HN4SH6.js +46 -0
- package/dist/chunk-56HN4SH6.js.map +7 -0
- package/dist/chunk-5APBBTGW.js +7 -0
- package/dist/chunk-5APBBTGW.js.map +7 -0
- package/dist/chunk-5LNGMBWW.js +93 -0
- package/dist/chunk-5LNGMBWW.js.map +7 -0
- package/dist/chunk-5XFQSYZ4.js +52 -0
- package/dist/chunk-5XFQSYZ4.js.map +7 -0
- package/dist/chunk-62N5N4AC.js +241 -0
- package/dist/chunk-62N5N4AC.js.map +7 -0
- package/dist/chunk-6HX3DEXK.js +178 -0
- package/dist/chunk-6HX3DEXK.js.map +7 -0
- package/dist/chunk-6NO5VEVV.js +18 -0
- package/dist/chunk-6NO5VEVV.js.map +7 -0
- package/dist/chunk-6PZGDVLR.js +465 -0
- package/dist/chunk-6PZGDVLR.js.map +7 -0
- package/dist/chunk-6SOGH3TW.js +163 -0
- package/dist/chunk-6SOGH3TW.js.map +7 -0
- package/dist/chunk-72TGY3LX.js +104 -0
- package/dist/chunk-72TGY3LX.js.map +7 -0
- package/dist/chunk-76IE55K7.js +392 -0
- package/dist/chunk-76IE55K7.js.map +7 -0
- package/dist/chunk-7F3242AO.js +86 -0
- package/dist/chunk-7F3242AO.js.map +7 -0
- package/dist/chunk-7FLQSTPG.js +57 -0
- package/dist/chunk-7FLQSTPG.js.map +7 -0
- package/dist/chunk-7MP46JBP.js +177 -0
- package/dist/chunk-7MP46JBP.js.map +7 -0
- package/dist/chunk-7MVZYR2T.js +87 -0
- package/dist/chunk-7MVZYR2T.js.map +7 -0
- package/dist/chunk-7N7ISMPG.js +50 -0
- package/dist/chunk-7N7ISMPG.js.map +7 -0
- package/dist/chunk-7S7LQQPX.js +127 -0
- package/dist/chunk-7S7LQQPX.js.map +7 -0
- package/dist/chunk-7TTNY5FK.js +21 -0
- package/dist/chunk-7TTNY5FK.js.map +7 -0
- package/dist/chunk-7W73QCTR.js +244 -0
- package/dist/chunk-7W73QCTR.js.map +7 -0
- package/dist/chunk-7XXLU33Y.js +76 -0
- package/dist/chunk-7XXLU33Y.js.map +7 -0
- package/dist/chunk-AAO7BQEV.js +258 -0
- package/dist/chunk-AAO7BQEV.js.map +7 -0
- package/dist/chunk-AH4MLRYT.js +91 -0
- package/dist/chunk-AH4MLRYT.js.map +7 -0
- package/dist/chunk-AHKR32FH.js +7 -0
- package/dist/chunk-AHKR32FH.js.map +7 -0
- package/dist/chunk-ALKRFDAW.js +94 -0
- package/dist/chunk-ALKRFDAW.js.map +7 -0
- package/dist/chunk-AQQGAE7N.js +12 -0
- package/dist/chunk-AQQGAE7N.js.map +7 -0
- package/dist/chunk-AWW3YUGJ.js +193 -0
- package/dist/chunk-AWW3YUGJ.js.map +7 -0
- package/dist/chunk-AX7VEEWJ.js +158 -0
- package/dist/chunk-AX7VEEWJ.js.map +7 -0
- package/dist/chunk-BAX7Q6GR.js +55 -0
- package/dist/chunk-BAX7Q6GR.js.map +7 -0
- package/dist/chunk-BBM6BR3Z.js +28 -0
- package/dist/chunk-BBM6BR3Z.js.map +7 -0
- package/dist/chunk-BHXZMHSX.js +109 -0
- package/dist/chunk-BHXZMHSX.js.map +7 -0
- package/dist/chunk-BIUXDLVY.js +62 -0
- package/dist/chunk-BIUXDLVY.js.map +7 -0
- package/dist/chunk-BMFZL2P4.js +97 -0
- package/dist/chunk-BMFZL2P4.js.map +7 -0
- package/dist/chunk-BQXEXK4H.js +114 -0
- package/dist/chunk-BQXEXK4H.js.map +7 -0
- package/dist/chunk-BU2CTWBG.js +30 -0
- package/dist/chunk-BU2CTWBG.js.map +7 -0
- package/dist/chunk-BVKSCLF7.js +195 -0
- package/dist/chunk-BVKSCLF7.js.map +7 -0
- package/dist/chunk-BWA3D22L.js +88 -0
- package/dist/chunk-BWA3D22L.js.map +7 -0
- package/dist/chunk-CE24RSPL.js +506 -0
- package/dist/chunk-CE24RSPL.js.map +7 -0
- package/dist/chunk-CETZGSCP.js +71 -0
- package/dist/chunk-CETZGSCP.js.map +7 -0
- package/dist/chunk-CGBWMONK.js +412 -0
- package/dist/chunk-CGBWMONK.js.map +7 -0
- package/dist/chunk-CPNIXMGX.js +127 -0
- package/dist/chunk-CPNIXMGX.js.map +7 -0
- package/dist/chunk-CSJO73LD.js +84 -0
- package/dist/chunk-CSJO73LD.js.map +7 -0
- package/dist/chunk-CTKBDSL6.js +81 -0
- package/dist/chunk-CTKBDSL6.js.map +7 -0
- package/dist/chunk-CY6WHUCW.js +54 -0
- package/dist/chunk-CY6WHUCW.js.map +7 -0
- package/dist/chunk-D7Q6Z74D.js +123 -0
- package/dist/chunk-D7Q6Z74D.js.map +7 -0
- package/dist/chunk-DZIM4OWK.js +17 -0
- package/dist/chunk-DZIM4OWK.js.map +7 -0
- package/dist/chunk-E3GC4V5V.js +30 -0
- package/dist/chunk-E3GC4V5V.js.map +7 -0
- package/dist/chunk-E5HPDHCW.js +34 -0
- package/dist/chunk-E5HPDHCW.js.map +7 -0
- package/dist/chunk-E75BJJZ2.js +635 -0
- package/dist/chunk-E75BJJZ2.js.map +7 -0
- package/dist/chunk-EE4DHUUZ.js +472 -0
- package/dist/chunk-EE4DHUUZ.js.map +7 -0
- package/dist/chunk-EHELTAAD.js +198 -0
- package/dist/chunk-EHELTAAD.js.map +7 -0
- package/dist/chunk-EKXPSI7Z.js +135 -0
- package/dist/chunk-EKXPSI7Z.js.map +7 -0
- package/dist/chunk-ERCH75SH.js +292 -0
- package/dist/chunk-ERCH75SH.js.map +7 -0
- package/dist/chunk-EVFWZGFL.js +235 -0
- package/dist/chunk-EVFWZGFL.js.map +7 -0
- package/dist/chunk-EVPBRKMZ.js +45 -0
- package/dist/chunk-EVPBRKMZ.js.map +7 -0
- package/dist/chunk-F6AFJHWV.js +45 -0
- package/dist/chunk-F6AFJHWV.js.map +7 -0
- package/dist/chunk-FG4NVFKM.js +455 -0
- package/dist/chunk-FG4NVFKM.js.map +7 -0
- package/dist/chunk-FHNEN6IR.js +14 -0
- package/dist/chunk-FHNEN6IR.js.map +7 -0
- package/dist/chunk-FQ4R7IOX.js +32 -0
- package/dist/chunk-FQ4R7IOX.js.map +7 -0
- package/dist/chunk-FQPYAPJJ.js +124 -0
- package/dist/chunk-FQPYAPJJ.js.map +7 -0
- package/dist/chunk-FQTLJO4W.js +335 -0
- package/dist/chunk-FQTLJO4W.js.map +7 -0
- package/dist/chunk-FVLJSB2W.js +124 -0
- package/dist/chunk-FVLJSB2W.js.map +7 -0
- package/dist/chunk-FYRKBNTI.js +18 -0
- package/dist/chunk-FYRKBNTI.js.map +7 -0
- package/dist/chunk-GD6L3SLC.js +30 -0
- package/dist/chunk-GD6L3SLC.js.map +7 -0
- package/dist/chunk-GI2ZANRY.js +24 -0
- package/dist/chunk-GI2ZANRY.js.map +7 -0
- package/dist/chunk-GK3XVKXT.js +737 -0
- package/dist/chunk-GK3XVKXT.js.map +7 -0
- package/dist/chunk-GKOWCDQV.js +699 -0
- package/dist/chunk-GKOWCDQV.js.map +7 -0
- package/dist/chunk-GLLRCKKE.js +26 -0
- package/dist/chunk-GLLRCKKE.js.map +7 -0
- package/dist/chunk-GNYG6I36.js +175 -0
- package/dist/chunk-GNYG6I36.js.map +7 -0
- package/dist/chunk-GVYGUH2V.js +7 -0
- package/dist/chunk-GVYGUH2V.js.map +7 -0
- package/dist/chunk-GZAGAWSU.js +28 -0
- package/dist/chunk-GZAGAWSU.js.map +7 -0
- package/dist/chunk-H23E72SB.js +163 -0
- package/dist/chunk-H23E72SB.js.map +7 -0
- package/dist/chunk-H6YVV7GE.js +22 -0
- package/dist/chunk-H6YVV7GE.js.map +7 -0
- package/dist/chunk-HDPICD3P.js +4890 -0
- package/dist/chunk-HDPICD3P.js.map +7 -0
- package/dist/chunk-HP5HMWOM.js +123 -0
- package/dist/chunk-HP5HMWOM.js.map +7 -0
- package/dist/chunk-HQSHS6IB.js +88 -0
- package/dist/chunk-HQSHS6IB.js.map +7 -0
- package/dist/chunk-HTV3R73W.js +51 -0
- package/dist/chunk-HTV3R73W.js.map +7 -0
- package/dist/chunk-IJCMYMZB.js +239 -0
- package/dist/chunk-IJCMYMZB.js.map +7 -0
- package/dist/chunk-INNENDEE.js +472 -0
- package/dist/chunk-INNENDEE.js.map +7 -0
- package/dist/chunk-IOTLSMEQ.js +177 -0
- package/dist/chunk-IOTLSMEQ.js.map +7 -0
- package/dist/chunk-IQYYEHSM.js +300 -0
- package/dist/chunk-IQYYEHSM.js.map +7 -0
- package/dist/chunk-IRA5NJ4Q.js +21 -0
- package/dist/chunk-IRA5NJ4Q.js.map +7 -0
- package/dist/chunk-IU7EXXK7.js +1662 -0
- package/dist/chunk-IU7EXXK7.js.map +7 -0
- package/dist/chunk-IUXAKDAY.js +102 -0
- package/dist/chunk-IUXAKDAY.js.map +7 -0
- package/dist/chunk-JMYIFYY5.js +233 -0
- package/dist/chunk-JMYIFYY5.js.map +7 -0
- package/dist/chunk-JSZBX2TA.js +5853 -0
- package/dist/chunk-JSZBX2TA.js.map +7 -0
- package/dist/chunk-KHFWQ334.js +138 -0
- package/dist/chunk-KHFWQ334.js.map +7 -0
- package/dist/chunk-KJW6JLM6.js +95 -0
- package/dist/chunk-KJW6JLM6.js.map +7 -0
- package/dist/chunk-KSEANSJE.js +40 -0
- package/dist/chunk-KSEANSJE.js.map +7 -0
- package/dist/chunk-KVU54E6W.js +63 -0
- package/dist/chunk-KVU54E6W.js.map +7 -0
- package/dist/chunk-L5OUVMHK.js +174 -0
- package/dist/chunk-L5OUVMHK.js.map +7 -0
- package/dist/chunk-LIVQ7GIO.js +86 -0
- package/dist/chunk-LIVQ7GIO.js.map +7 -0
- package/dist/chunk-LO4F6E3N.js +163 -0
- package/dist/chunk-LO4F6E3N.js.map +7 -0
- package/dist/chunk-LSVKDUNM.js +151 -0
- package/dist/chunk-LSVKDUNM.js.map +7 -0
- package/dist/chunk-LVMK2GPM.js +18 -0
- package/dist/chunk-LVMK2GPM.js.map +7 -0
- package/dist/chunk-LXVPETLK.js +1405 -0
- package/dist/chunk-LXVPETLK.js.map +7 -0
- package/dist/chunk-LZNW24OB.js +78 -0
- package/dist/chunk-LZNW24OB.js.map +7 -0
- package/dist/chunk-MAF6PSCJ.js +44 -0
- package/dist/chunk-MAF6PSCJ.js.map +7 -0
- package/dist/chunk-MBIX6Z7U.js +80 -0
- package/dist/chunk-MBIX6Z7U.js.map +7 -0
- package/dist/chunk-MDLLXMC3.js +183 -0
- package/dist/chunk-MDLLXMC3.js.map +7 -0
- package/dist/chunk-MEI5HTWV.js +127 -0
- package/dist/chunk-MEI5HTWV.js.map +7 -0
- package/dist/chunk-MH74AJ3A.js +82 -0
- package/dist/chunk-MH74AJ3A.js.map +7 -0
- package/dist/chunk-MIFIM4PI.js +163 -0
- package/dist/chunk-MIFIM4PI.js.map +7 -0
- package/dist/chunk-MISZB5QJ.js +22 -0
- package/dist/chunk-MISZB5QJ.js.map +7 -0
- package/dist/chunk-MJ27XQYG.js +125 -0
- package/dist/chunk-MJ27XQYG.js.map +7 -0
- package/dist/chunk-MLQY5SKR.js +52 -0
- package/dist/chunk-MLQY5SKR.js.map +7 -0
- package/dist/chunk-MTMHGC3G.js +39 -0
- package/dist/chunk-MTMHGC3G.js.map +7 -0
- package/dist/chunk-MWBAW3YV.js +244 -0
- package/dist/chunk-MWBAW3YV.js.map +7 -0
- package/dist/chunk-MZGGB2YT.js +50 -0
- package/dist/chunk-MZGGB2YT.js.map +7 -0
- package/dist/chunk-N5SNGZJV.js +217 -0
- package/dist/chunk-N5SNGZJV.js.map +7 -0
- package/dist/chunk-NGCTBYQ3.js +181 -0
- package/dist/chunk-NGCTBYQ3.js.map +7 -0
- package/dist/chunk-NMUX7SGU.js +676 -0
- package/dist/chunk-NMUX7SGU.js.map +7 -0
- package/dist/chunk-NO7GMLNU.js +292 -0
- package/dist/chunk-NO7GMLNU.js.map +7 -0
- package/dist/chunk-NTOGVX2Y.js +92 -0
- package/dist/chunk-NTOGVX2Y.js.map +7 -0
- package/dist/chunk-O5IVKDX7.js +30 -0
- package/dist/chunk-O5IVKDX7.js.map +7 -0
- package/dist/chunk-OFWMLQMU.js +7287 -0
- package/dist/chunk-OFWMLQMU.js.map +7 -0
- package/dist/chunk-OJ3ZUKBI.js +73 -0
- package/dist/chunk-OJ3ZUKBI.js.map +7 -0
- package/dist/chunk-OJTHE4B7.js +50 -0
- package/dist/chunk-OJTHE4B7.js.map +7 -0
- package/dist/chunk-OOYPYBTA.js +446 -0
- package/dist/chunk-OOYPYBTA.js.map +7 -0
- package/dist/chunk-OQP4W4AR.js +105 -0
- package/dist/chunk-OQP4W4AR.js.map +7 -0
- package/dist/chunk-OVTT2EKA.js +516 -0
- package/dist/chunk-OVTT2EKA.js.map +7 -0
- package/dist/chunk-P5N63LBS.js +94 -0
- package/dist/chunk-P5N63LBS.js.map +7 -0
- package/dist/chunk-PARITZ7F.js +28 -0
- package/dist/chunk-PARITZ7F.js.map +7 -0
- package/dist/chunk-PBQK4KY4.js +195 -0
- package/dist/chunk-PBQK4KY4.js.map +7 -0
- package/dist/chunk-PSL2AHIA.js +27 -0
- package/dist/chunk-PSL2AHIA.js.map +7 -0
- package/dist/chunk-Q5QT7JBM.js +92 -0
- package/dist/chunk-Q5QT7JBM.js.map +7 -0
- package/dist/chunk-Q7WA5DCR.js +62 -0
- package/dist/chunk-Q7WA5DCR.js.map +7 -0
- package/dist/chunk-QATEENP2.js +7 -0
- package/dist/chunk-QATEENP2.js.map +7 -0
- package/dist/chunk-QDT24CIA.js +485 -0
- package/dist/chunk-QDT24CIA.js.map +7 -0
- package/dist/chunk-QI3NB7D5.js +455 -0
- package/dist/chunk-QI3NB7D5.js.map +7 -0
- package/dist/chunk-QIDAVXSX.js +106 -0
- package/dist/chunk-QIDAVXSX.js.map +7 -0
- package/dist/chunk-QKIGQVP2.js +104 -0
- package/dist/chunk-QKIGQVP2.js.map +7 -0
- package/dist/chunk-QNJENPK2.js +81 -0
- package/dist/chunk-QNJENPK2.js.map +7 -0
- package/dist/chunk-REVXXWAS.js +31 -0
- package/dist/chunk-REVXXWAS.js.map +7 -0
- package/dist/chunk-RFH4HRZP.js +94 -0
- package/dist/chunk-RFH4HRZP.js.map +7 -0
- package/dist/chunk-RNGAGYCL.js +49 -0
- package/dist/chunk-RNGAGYCL.js.map +7 -0
- package/dist/chunk-RPCVN3JA.js +261 -0
- package/dist/chunk-RPCVN3JA.js.map +7 -0
- package/dist/chunk-RQQE5DDT.js +193 -0
- package/dist/chunk-RQQE5DDT.js.map +7 -0
- package/dist/chunk-RVOD3ESA.js +38 -0
- package/dist/chunk-RVOD3ESA.js.map +7 -0
- package/dist/chunk-SAOUP24A.js +70 -0
- package/dist/chunk-SAOUP24A.js.map +7 -0
- package/dist/chunk-SFZL2TCV.js +55 -0
- package/dist/chunk-SFZL2TCV.js.map +7 -0
- package/dist/chunk-SJPFUXBV.js +45 -0
- package/dist/chunk-SJPFUXBV.js.map +7 -0
- package/dist/chunk-SLIUQWAR.js +58 -0
- package/dist/chunk-SLIUQWAR.js.map +7 -0
- package/dist/chunk-SSEX66OL.js +39 -0
- package/dist/chunk-SSEX66OL.js.map +7 -0
- package/dist/chunk-SX2LOHOX.js +251 -0
- package/dist/chunk-SX2LOHOX.js.map +7 -0
- package/dist/chunk-T72EMFTX.js +74 -0
- package/dist/chunk-T72EMFTX.js.map +7 -0
- package/dist/chunk-TA2QJPPG.js +169 -0
- package/dist/chunk-TA2QJPPG.js.map +7 -0
- package/dist/chunk-TFEETDNY.js +78 -0
- package/dist/chunk-TFEETDNY.js.map +7 -0
- package/dist/chunk-THM2QV25.js +108 -0
- package/dist/chunk-THM2QV25.js.map +7 -0
- package/dist/chunk-TRWT2N6Z.js +15 -0
- package/dist/chunk-TRWT2N6Z.js.map +7 -0
- package/dist/chunk-TTXEM54Y.js +76 -0
- package/dist/chunk-TTXEM54Y.js.map +7 -0
- package/dist/chunk-U4LVIY5F.js +1405 -0
- package/dist/chunk-U4LVIY5F.js.map +7 -0
- package/dist/chunk-U767LCSG.js +78 -0
- package/dist/chunk-U767LCSG.js.map +7 -0
- package/dist/chunk-U7GKLHU6.js +120 -0
- package/dist/chunk-U7GKLHU6.js.map +7 -0
- package/dist/chunk-UAB5P5QO.js +60 -0
- package/dist/chunk-UAB5P5QO.js.map +7 -0
- package/dist/chunk-UEHPJQBL.js +38 -0
- package/dist/chunk-UEHPJQBL.js.map +7 -0
- package/dist/chunk-UIBV6IGR.js +31 -0
- package/dist/chunk-UIBV6IGR.js.map +7 -0
- package/dist/chunk-UIYFRUET.js +16352 -0
- package/dist/chunk-UIYFRUET.js.map +7 -0
- package/dist/chunk-UJS3TIVS.js +52 -0
- package/dist/chunk-UJS3TIVS.js.map +7 -0
- package/dist/chunk-UU5PSBSI.js +176 -0
- package/dist/chunk-UU5PSBSI.js.map +7 -0
- package/dist/chunk-UV63XYFU.js +173 -0
- package/dist/chunk-UV63XYFU.js.map +7 -0
- package/dist/chunk-UWPHOAOC.js +29 -0
- package/dist/chunk-UWPHOAOC.js.map +7 -0
- package/dist/chunk-UXDDOSJC.js +52 -0
- package/dist/chunk-UXDDOSJC.js.map +7 -0
- package/dist/chunk-V3VAOMCO.js +465 -0
- package/dist/chunk-V3VAOMCO.js.map +7 -0
- package/dist/chunk-VA7ENH2S.js +38 -0
- package/dist/chunk-VA7ENH2S.js.map +7 -0
- package/dist/chunk-VFPDFLVE.js +516 -0
- package/dist/chunk-VFPDFLVE.js.map +7 -0
- package/dist/chunk-VHG4FNIJ.js +93 -0
- package/dist/chunk-VHG4FNIJ.js.map +7 -0
- package/dist/chunk-VKOO6MIZ.js +51 -0
- package/dist/chunk-VKOO6MIZ.js.map +7 -0
- package/dist/chunk-VKXKRZG7.js +62 -0
- package/dist/chunk-VKXKRZG7.js.map +7 -0
- package/dist/chunk-VUOLPEUZ.js +7 -0
- package/dist/chunk-VUOLPEUZ.js.map +7 -0
- package/dist/chunk-W6SOBS7M.js +138 -0
- package/dist/chunk-W6SOBS7M.js.map +7 -0
- package/dist/chunk-WDOKKRTE.js +7 -0
- package/dist/chunk-WDOKKRTE.js.map +7 -0
- package/dist/chunk-WGXXKFN5.js +7 -0
- package/dist/chunk-WGXXKFN5.js.map +7 -0
- package/dist/chunk-WHPUUP3J.js +25 -0
- package/dist/chunk-WHPUUP3J.js.map +7 -0
- package/dist/chunk-XF7LD6VV.js +122 -0
- package/dist/chunk-XF7LD6VV.js.map +7 -0
- package/dist/chunk-XFTXM3RE.js +64 -0
- package/dist/chunk-XFTXM3RE.js.map +7 -0
- package/dist/chunk-XJABPO2T.js +235 -0
- package/dist/chunk-XJABPO2T.js.map +7 -0
- package/dist/chunk-XK6VF3H7.js +3586 -0
- package/dist/chunk-XK6VF3H7.js.map +7 -0
- package/dist/chunk-XQYIIPOJ.js +266 -0
- package/dist/chunk-XQYIIPOJ.js.map +7 -0
- package/dist/chunk-XZSAN55E.js +58 -0
- package/dist/chunk-XZSAN55E.js.map +7 -0
- package/dist/chunk-Y3KJR4OG.js +64 -0
- package/dist/chunk-Y3KJR4OG.js.map +7 -0
- package/dist/chunk-Y4JKH7FF.js +45 -0
- package/dist/chunk-Y4JKH7FF.js.map +7 -0
- package/dist/chunk-Y6CJN4ID.js +31 -0
- package/dist/chunk-Y6CJN4ID.js.map +7 -0
- package/dist/chunk-YABGJU5M.js +271 -0
- package/dist/chunk-YABGJU5M.js.map +7 -0
- package/dist/chunk-YEJH7ZC2.js +34 -0
- package/dist/chunk-YEJH7ZC2.js.map +7 -0
- package/dist/chunk-YFTE4H54.js +44117 -0
- package/dist/chunk-YFTE4H54.js.map +7 -0
- package/dist/chunk-YNJYMD43.js +392 -0
- package/dist/chunk-YNJYMD43.js.map +7 -0
- package/dist/chunk-YNYEQGVN.js +251 -0
- package/dist/chunk-YNYEQGVN.js.map +7 -0
- package/dist/chunk-YUPBD27Z.js +70 -0
- package/dist/chunk-YUPBD27Z.js.map +7 -0
- package/dist/chunk-YXJ52FD5.js +271 -0
- package/dist/chunk-YXJ52FD5.js.map +7 -0
- package/dist/chunk-YZGORRQN.js +3101 -0
- package/dist/chunk-YZGORRQN.js.map +7 -0
- package/dist/chunk-Z6IVJ6ZW.js +30 -0
- package/dist/chunk-Z6IVJ6ZW.js.map +7 -0
- package/dist/chunk-ZFC44XJJ.js +86 -0
- package/dist/chunk-ZFC44XJJ.js.map +7 -0
- package/dist/chunk-ZJDJC5TP.js +82 -0
- package/dist/chunk-ZJDJC5TP.js.map +7 -0
- package/dist/chunk-ZJGZNPDK.js +171 -0
- package/dist/chunk-ZJGZNPDK.js.map +7 -0
- package/dist/chunk-ZJHBJWZX.js +699 -0
- package/dist/chunk-ZJHBJWZX.js.map +7 -0
- package/dist/chunk-ZNOTD65D.js +95 -0
- package/dist/chunk-ZNOTD65D.js.map +7 -0
- package/dist/chunk-ZQ2QIFXW.js +122 -0
- package/dist/chunk-ZQ2QIFXW.js.map +7 -0
- package/dist/chunk-ZRMXPQGY.js +241 -0
- package/dist/chunk-ZRMXPQGY.js.map +7 -0
- package/dist/chunk-ZVEE5IDC.js +3101 -0
- package/dist/chunk-ZVEE5IDC.js.map +7 -0
- package/dist/cli-metadata.js +12 -0
- package/dist/cli-metadata.js.map +7 -0
- package/dist/contract-api.js +104 -0
- package/dist/contract-api.js.map +7 -0
- package/dist/dist-F3K7S5SS.js +549 -0
- package/dist/dist-F3K7S5SS.js.map +7 -0
- package/dist/helper-api.js +51 -0
- package/dist/helper-api.js.map +7 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +7 -0
- package/dist/magic-string.es-V5NOGTUV.js +1315 -0
- package/dist/magic-string.es-V5NOGTUV.js.map +7 -0
- package/dist/openclaw.plugin.json +23 -0
- package/dist/package.json +59 -0
- package/dist/plugin-entry.handlers.runtime-POD4CSHM.js +20 -0
- package/dist/plugin-entry.handlers.runtime-POD4CSHM.js.map +7 -0
- package/dist/plugin-entry.handlers.runtime-YOSG6V6U.js +20 -0
- package/dist/plugin-entry.handlers.runtime-YOSG6V6U.js.map +7 -0
- package/dist/runtime-api.js +104 -0
- package/dist/runtime-api.js.map +7 -0
- package/dist/rust-crypto-H35BXWUU.js +5323 -0
- package/dist/rust-crypto-H35BXWUU.js.map +7 -0
- package/dist/secret-contract-api.js +18 -0
- package/dist/secret-contract-api.js.map +7 -0
- package/dist/setup-entry.js +23 -0
- package/dist/setup-entry.js.map +7 -0
- package/dist/src/account-selection.js +19 -0
- package/dist/src/account-selection.js.map +7 -0
- package/dist/src/actions.js +24 -0
- package/dist/src/actions.js.map +7 -0
- package/dist/src/approval-auth.js +27 -0
- package/dist/src/approval-auth.js.map +7 -0
- package/dist/src/approval-handler.runtime.js +378 -0
- package/dist/src/approval-handler.runtime.js.map +7 -0
- package/dist/src/approval-ids.js +9 -0
- package/dist/src/approval-ids.js.map +7 -0
- package/dist/src/approval-native.js +28 -0
- package/dist/src/approval-native.js.map +7 -0
- package/dist/src/approval-reactions.js +20 -0
- package/dist/src/approval-reactions.js.map +7 -0
- package/dist/src/auth-precedence.js +8 -0
- package/dist/src/auth-precedence.js.map +7 -0
- package/dist/src/channel-account-paths.js +11 -0
- package/dist/src/channel-account-paths.js.map +7 -0
- package/dist/src/channel.js +74 -0
- package/dist/src/channel.js.map +7 -0
- package/dist/src/channel.runtime.js +82 -0
- package/dist/src/channel.runtime.js.map +7 -0
- package/dist/src/cli-metadata.js +8 -0
- package/dist/src/cli-metadata.js.map +7 -0
- package/dist/src/cli.js +936 -0
- package/dist/src/cli.js.map +7 -0
- package/dist/src/config-adapter.js +26 -0
- package/dist/src/config-adapter.js.map +7 -0
- package/dist/src/config-schema.js +8 -0
- package/dist/src/config-schema.js.map +7 -0
- package/dist/src/directory-live.js +35 -0
- package/dist/src/directory-live.js.map +7 -0
- package/dist/src/doctor-contract.js +11 -0
- package/dist/src/doctor-contract.js.map +7 -0
- package/dist/src/doctor.js +42 -0
- package/dist/src/doctor.js.map +7 -0
- package/dist/src/env-vars.js +12 -0
- package/dist/src/env-vars.js.map +7 -0
- package/dist/src/exec-approval-resolver.js +10 -0
- package/dist/src/exec-approval-resolver.js.map +7 -0
- package/dist/src/exec-approvals.js +51 -0
- package/dist/src/exec-approvals.js.map +7 -0
- package/dist/src/group-mentions.js +28 -0
- package/dist/src/group-mentions.js.map +7 -0
- package/dist/src/legacy-crypto-inspector-availability.js +8 -0
- package/dist/src/legacy-crypto-inspector-availability.js.map +7 -0
- package/dist/src/legacy-crypto.js +26 -0
- package/dist/src/legacy-crypto.js.map +7 -0
- package/dist/src/legacy-state.js +24 -0
- package/dist/src/legacy-state.js.map +7 -0
- package/dist/src/matrix/account-config.js +16 -0
- package/dist/src/matrix/account-config.js.map +7 -0
- package/dist/src/matrix/accounts.js +31 -0
- package/dist/src/matrix/accounts.js.map +7 -0
- package/dist/src/matrix/actions/client.js +40 -0
- package/dist/src/matrix/actions/client.js.map +7 -0
- package/dist/src/matrix/actions/devices.js +42 -0
- package/dist/src/matrix/actions/devices.js.map +7 -0
- package/dist/src/matrix/actions/limits.js +8 -0
- package/dist/src/matrix/actions/limits.js.map +7 -0
- package/dist/src/matrix/actions/messages.js +49 -0
- package/dist/src/matrix/actions/messages.js.map +7 -0
- package/dist/src/matrix/actions/pins.js +46 -0
- package/dist/src/matrix/actions/pins.js.map +7 -0
- package/dist/src/matrix/actions/polls.js +37 -0
- package/dist/src/matrix/actions/polls.js.map +7 -0
- package/dist/src/matrix/actions/profile.js +38 -0
- package/dist/src/matrix/actions/profile.js.map +7 -0
- package/dist/src/matrix/actions/reactions.js +40 -0
- package/dist/src/matrix/actions/reactions.js.map +7 -0
- package/dist/src/matrix/actions/room.js +40 -0
- package/dist/src/matrix/actions/room.js.map +7 -0
- package/dist/src/matrix/actions/summary.js +19 -0
- package/dist/src/matrix/actions/summary.js.map +7 -0
- package/dist/src/matrix/actions/types.js +13 -0
- package/dist/src/matrix/actions/types.js.map +7 -0
- package/dist/src/matrix/actions/verification.js +77 -0
- package/dist/src/matrix/actions/verification.js.map +7 -0
- package/dist/src/matrix/actions.js +126 -0
- package/dist/src/matrix/actions.js.map +7 -0
- package/dist/src/matrix/active-client.js +10 -0
- package/dist/src/matrix/active-client.js.map +7 -0
- package/dist/src/matrix/async-lock.js +8 -0
- package/dist/src/matrix/async-lock.js.map +7 -0
- package/dist/src/matrix/backup-health.js +10 -0
- package/dist/src/matrix/backup-health.js.map +7 -0
- package/dist/src/matrix/client/config-runtime-api.js +24 -0
- package/dist/src/matrix/client/config-runtime-api.js.map +7 -0
- package/dist/src/matrix/client/config-secret-input.runtime.js +11 -0
- package/dist/src/matrix/client/config-secret-input.runtime.js.map +7 -0
- package/dist/src/matrix/client/config.js +42 -0
- package/dist/src/matrix/client/config.js.map +7 -0
- package/dist/src/matrix/client/create-client.js +20 -0
- package/dist/src/matrix/client/create-client.js.map +7 -0
- package/dist/src/matrix/client/env-auth.js +26 -0
- package/dist/src/matrix/client/env-auth.js.map +7 -0
- package/dist/src/matrix/client/file-sync-store.js +23 -0
- package/dist/src/matrix/client/file-sync-store.js.map +7 -0
- package/dist/src/matrix/client/logging.js +17 -0
- package/dist/src/matrix/client/logging.js.map +7 -0
- package/dist/src/matrix/client/migration-snapshot.runtime.js +13 -0
- package/dist/src/matrix/client/migration-snapshot.runtime.js.map +7 -0
- package/dist/src/matrix/client/private-network-host.js +8 -0
- package/dist/src/matrix/client/private-network-host.js.map +7 -0
- package/dist/src/matrix/client/runtime.js +8 -0
- package/dist/src/matrix/client/runtime.js.map +7 -0
- package/dist/src/matrix/client/shared.js +34 -0
- package/dist/src/matrix/client/shared.js.map +7 -0
- package/dist/src/matrix/client/storage.js +26 -0
- package/dist/src/matrix/client/storage.js.map +7 -0
- package/dist/src/matrix/client/types.js +7 -0
- package/dist/src/matrix/client/types.js.map +7 -0
- package/dist/src/matrix/client-bootstrap.js +15 -0
- package/dist/src/matrix/client-bootstrap.js.map +7 -0
- package/dist/src/matrix/client-resolver.test-helpers.js +122 -0
- package/dist/src/matrix/client-resolver.test-helpers.js.map +7 -0
- package/dist/src/matrix/client.js +63 -0
- package/dist/src/matrix/client.js.map +7 -0
- package/dist/src/matrix/config-paths.js +12 -0
- package/dist/src/matrix/config-paths.js.map +7 -0
- package/dist/src/matrix/config-update.js +17 -0
- package/dist/src/matrix/config-update.js.map +7 -0
- package/dist/src/matrix/credentials-read.js +22 -0
- package/dist/src/matrix/credentials-read.js.map +7 -0
- package/dist/src/matrix/credentials-write.runtime.js +24 -0
- package/dist/src/matrix/credentials-write.runtime.js.map +7 -0
- package/dist/src/matrix/credentials.js +90 -0
- package/dist/src/matrix/credentials.js.map +7 -0
- package/dist/src/matrix/deps.js +12 -0
- package/dist/src/matrix/deps.js.map +7 -0
- package/dist/src/matrix/device-health.js +10 -0
- package/dist/src/matrix/device-health.js.map +7 -0
- package/dist/src/matrix/direct-management.js +18 -0
- package/dist/src/matrix/direct-management.js.map +7 -0
- package/dist/src/matrix/direct-room.js +18 -0
- package/dist/src/matrix/direct-room.js.map +7 -0
- package/dist/src/matrix/draft-stream.js +33 -0
- package/dist/src/matrix/draft-stream.js.map +7 -0
- package/dist/src/matrix/encryption-guidance.js +17 -0
- package/dist/src/matrix/encryption-guidance.js.map +7 -0
- package/dist/src/matrix/errors.js +12 -0
- package/dist/src/matrix/errors.js.map +7 -0
- package/dist/src/matrix/format.js +13 -0
- package/dist/src/matrix/format.js.map +7 -0
- package/dist/src/matrix/legacy-crypto-inspector.js +73 -0
- package/dist/src/matrix/legacy-crypto-inspector.js.map +7 -0
- package/dist/src/matrix/media-errors.js +12 -0
- package/dist/src/matrix/media-errors.js.map +7 -0
- package/dist/src/matrix/media-text.js +22 -0
- package/dist/src/matrix/media-text.js.map +7 -0
- package/dist/src/matrix/monitor/access-state.js +9 -0
- package/dist/src/matrix/monitor/access-state.js.map +7 -0
- package/dist/src/matrix/monitor/ack-config.js +10 -0
- package/dist/src/matrix/monitor/ack-config.js.map +7 -0
- package/dist/src/matrix/monitor/allowlist.js +12 -0
- package/dist/src/matrix/monitor/allowlist.js.map +7 -0
- package/dist/src/matrix/monitor/auto-join.js +9 -0
- package/dist/src/matrix/monitor/auto-join.js.map +7 -0
- package/dist/src/matrix/monitor/config.js +37 -0
- package/dist/src/matrix/monitor/config.js.map +7 -0
- package/dist/src/matrix/monitor/context-summary.js +13 -0
- package/dist/src/matrix/monitor/context-summary.js.map +7 -0
- package/dist/src/matrix/monitor/direct.js +13 -0
- package/dist/src/matrix/monitor/direct.js.map +7 -0
- package/dist/src/matrix/monitor/events.js +20 -0
- package/dist/src/matrix/monitor/events.js.map +7 -0
- package/dist/src/matrix/monitor/handler.js +76 -0
- package/dist/src/matrix/monitor/handler.js.map +7 -0
- package/dist/src/matrix/monitor/handler.test-helpers.js +268 -0
- package/dist/src/matrix/monitor/handler.test-helpers.js.map +7 -0
- package/dist/src/matrix/monitor/inbound-dedupe.js +17 -0
- package/dist/src/matrix/monitor/inbound-dedupe.js.map +7 -0
- package/dist/src/matrix/monitor/index.js +502 -0
- package/dist/src/matrix/monitor/index.js.map +7 -0
- package/dist/src/matrix/monitor/legacy-crypto-restore.js +99 -0
- package/dist/src/matrix/monitor/legacy-crypto-restore.js.map +7 -0
- package/dist/src/matrix/monitor/location.js +11 -0
- package/dist/src/matrix/monitor/location.js.map +7 -0
- package/dist/src/matrix/monitor/media.js +10 -0
- package/dist/src/matrix/monitor/media.js.map +7 -0
- package/dist/src/matrix/monitor/mentions.js +9 -0
- package/dist/src/matrix/monitor/mentions.js.map +7 -0
- package/dist/src/matrix/monitor/reaction-events.js +38 -0
- package/dist/src/matrix/monitor/reaction-events.js.map +7 -0
- package/dist/src/matrix/monitor/recent-invite.js +10 -0
- package/dist/src/matrix/monitor/recent-invite.js.map +7 -0
- package/dist/src/matrix/monitor/replies.js +33 -0
- package/dist/src/matrix/monitor/replies.js.map +7 -0
- package/dist/src/matrix/monitor/reply-context.js +14 -0
- package/dist/src/matrix/monitor/reply-context.js.map +7 -0
- package/dist/src/matrix/monitor/room-history.js +10 -0
- package/dist/src/matrix/monitor/room-history.js.map +7 -0
- package/dist/src/matrix/monitor/room-info.js +9 -0
- package/dist/src/matrix/monitor/room-info.js.map +7 -0
- package/dist/src/matrix/monitor/rooms.js +9 -0
- package/dist/src/matrix/monitor/rooms.js.map +7 -0
- package/dist/src/matrix/monitor/route.js +12 -0
- package/dist/src/matrix/monitor/route.js.map +7 -0
- package/dist/src/matrix/monitor/runtime-api.js +40 -0
- package/dist/src/matrix/monitor/runtime-api.js.map +7 -0
- package/dist/src/matrix/monitor/startup-verification.js +174 -0
- package/dist/src/matrix/monitor/startup-verification.js.map +7 -0
- package/dist/src/matrix/monitor/startup.js +9 -0
- package/dist/src/matrix/monitor/startup.js.map +7 -0
- package/dist/src/matrix/monitor/status.js +10 -0
- package/dist/src/matrix/monitor/status.js.map +7 -0
- package/dist/src/matrix/monitor/sync-lifecycle.js +9 -0
- package/dist/src/matrix/monitor/sync-lifecycle.js.map +7 -0
- package/dist/src/matrix/monitor/task-runner.js +8 -0
- package/dist/src/matrix/monitor/task-runner.js.map +7 -0
- package/dist/src/matrix/monitor/thread-context.js +14 -0
- package/dist/src/matrix/monitor/thread-context.js.map +7 -0
- package/dist/src/matrix/monitor/threads.js +16 -0
- package/dist/src/matrix/monitor/threads.js.map +7 -0
- package/dist/src/matrix/monitor/types.js +11 -0
- package/dist/src/matrix/monitor/types.js.map +7 -0
- package/dist/src/matrix/monitor/verification-events.js +13 -0
- package/dist/src/matrix/monitor/verification-events.js.map +7 -0
- package/dist/src/matrix/monitor/verification-utils.js +16 -0
- package/dist/src/matrix/monitor/verification-utils.js.map +7 -0
- package/dist/src/matrix/outbound-media-runtime.js +9 -0
- package/dist/src/matrix/outbound-media-runtime.js.map +7 -0
- package/dist/src/matrix/poll-summary.js +14 -0
- package/dist/src/matrix/poll-summary.js.map +7 -0
- package/dist/src/matrix/poll-types.js +55 -0
- package/dist/src/matrix/poll-types.js.map +7 -0
- package/dist/src/matrix/probe.js +9 -0
- package/dist/src/matrix/probe.js.map +7 -0
- package/dist/src/matrix/probe.runtime.js +30 -0
- package/dist/src/matrix/probe.runtime.js.map +7 -0
- package/dist/src/matrix/profile.js +16 -0
- package/dist/src/matrix/profile.js.map +7 -0
- package/dist/src/matrix/reaction-common.js +26 -0
- package/dist/src/matrix/reaction-common.js.map +7 -0
- package/dist/src/matrix/sdk/crypto-bootstrap.js +15 -0
- package/dist/src/matrix/sdk/crypto-bootstrap.js.map +7 -0
- package/dist/src/matrix/sdk/crypto-facade.js +8 -0
- package/dist/src/matrix/sdk/crypto-facade.js.map +7 -0
- package/dist/src/matrix/sdk/crypto-node.runtime.js +15 -0
- package/dist/src/matrix/sdk/crypto-node.runtime.js.map +7 -0
- package/dist/src/matrix/sdk/crypto-runtime.js +84 -0
- package/dist/src/matrix/sdk/crypto-runtime.js.map +7 -0
- package/dist/src/matrix/sdk/decrypt-bridge.js +11 -0
- package/dist/src/matrix/sdk/decrypt-bridge.js.map +7 -0
- package/dist/src/matrix/sdk/event-helpers.js +12 -0
- package/dist/src/matrix/sdk/event-helpers.js.map +7 -0
- package/dist/src/matrix/sdk/http-client.js +13 -0
- package/dist/src/matrix/sdk/http-client.js.map +7 -0
- package/dist/src/matrix/sdk/idb-persistence-lock.js +12 -0
- package/dist/src/matrix/sdk/idb-persistence-lock.js.map +7 -0
- package/dist/src/matrix/sdk/idb-persistence.js +13 -0
- package/dist/src/matrix/sdk/idb-persistence.js.map +7 -0
- package/dist/src/matrix/sdk/idb-persistence.test-helpers.js +83 -0
- package/dist/src/matrix/sdk/idb-persistence.test-helpers.js.map +7 -0
- package/dist/src/matrix/sdk/logger.js +15 -0
- package/dist/src/matrix/sdk/logger.js.map +7 -0
- package/dist/src/matrix/sdk/read-response-with-limit.js +8 -0
- package/dist/src/matrix/sdk/read-response-with-limit.js.map +7 -0
- package/dist/src/matrix/sdk/recovery-key-store.js +14 -0
- package/dist/src/matrix/sdk/recovery-key-store.js.map +7 -0
- package/dist/src/matrix/sdk/transport.js +13 -0
- package/dist/src/matrix/sdk/transport.js.map +7 -0
- package/dist/src/matrix/sdk/types.js +7 -0
- package/dist/src/matrix/sdk/types.js.map +7 -0
- package/dist/src/matrix/sdk/verification-manager.js +11 -0
- package/dist/src/matrix/sdk/verification-manager.js.map +7 -0
- package/dist/src/matrix/sdk/verification-status.js +12 -0
- package/dist/src/matrix/sdk/verification-status.js.map +7 -0
- package/dist/src/matrix/sdk.js +1375 -0
- package/dist/src/matrix/sdk.js.map +7 -0
- package/dist/src/matrix/send/client.js +14 -0
- package/dist/src/matrix/send/client.js.map +7 -0
- package/dist/src/matrix/send/formatting.js +29 -0
- package/dist/src/matrix/send/formatting.js.map +7 -0
- package/dist/src/matrix/send/media.js +26 -0
- package/dist/src/matrix/send/media.js.map +7 -0
- package/dist/src/matrix/send/targets.js +15 -0
- package/dist/src/matrix/send/targets.js.map +7 -0
- package/dist/src/matrix/send/types.js +17 -0
- package/dist/src/matrix/send/types.js.map +7 -0
- package/dist/src/matrix/send.js +51 -0
- package/dist/src/matrix/send.js.map +7 -0
- package/dist/src/matrix/session-store-metadata.js +15 -0
- package/dist/src/matrix/session-store-metadata.js.map +7 -0
- package/dist/src/matrix/startup-abort.js +14 -0
- package/dist/src/matrix/startup-abort.js.map +7 -0
- package/dist/src/matrix/sync-state.js +12 -0
- package/dist/src/matrix/sync-state.js.map +7 -0
- package/dist/src/matrix/target-ids.js +20 -0
- package/dist/src/matrix/target-ids.js.map +7 -0
- package/dist/src/matrix/thread-bindings-shared.js +34 -0
- package/dist/src/matrix/thread-bindings-shared.js.map +7 -0
- package/dist/src/matrix/thread-bindings.js +49 -0
- package/dist/src/matrix/thread-bindings.js.map +7 -0
- package/dist/src/matrix-migration.runtime.js +45 -0
- package/dist/src/matrix-migration.runtime.js.map +7 -0
- package/dist/src/migration-config.js +29 -0
- package/dist/src/migration-config.js.map +7 -0
- package/dist/src/migration-snapshot-backup.js +12 -0
- package/dist/src/migration-snapshot-backup.js.map +7 -0
- package/dist/src/migration-snapshot.js +38 -0
- package/dist/src/migration-snapshot.js.map +7 -0
- package/dist/src/onboarding.js +43 -0
- package/dist/src/onboarding.js.map +7 -0
- package/dist/src/onboarding.test-harness.js +124 -0
- package/dist/src/onboarding.test-harness.js.map +7 -0
- package/dist/src/outbound.js +33 -0
- package/dist/src/outbound.js.map +7 -0
- package/dist/src/plugin-entry.runtime.js +15 -0
- package/dist/src/plugin-entry.runtime.js.map +7 -0
- package/dist/src/profile-update.js +41 -0
- package/dist/src/profile-update.js.map +7 -0
- package/dist/src/record-shared.js +8 -0
- package/dist/src/record-shared.js.map +7 -0
- package/dist/src/resolve-targets.js +34 -0
- package/dist/src/resolve-targets.js.map +7 -0
- package/dist/src/resolver.js +8 -0
- package/dist/src/resolver.js.map +7 -0
- package/dist/src/runtime-api.js +120 -0
- package/dist/src/runtime-api.js.map +7 -0
- package/dist/src/runtime.js +10 -0
- package/dist/src/runtime.js.map +7 -0
- package/dist/src/secret-contract.js +13 -0
- package/dist/src/secret-contract.js.map +7 -0
- package/dist/src/session-route.js +25 -0
- package/dist/src/session-route.js.map +7 -0
- package/dist/src/setup-bootstrap.js +124 -0
- package/dist/src/setup-bootstrap.js.map +7 -0
- package/dist/src/setup-config.js +28 -0
- package/dist/src/setup-config.js.map +7 -0
- package/dist/src/setup-contract.js +16 -0
- package/dist/src/setup-contract.js.map +7 -0
- package/dist/src/setup-core.js +25 -0
- package/dist/src/setup-core.js.map +7 -0
- package/dist/src/setup-surface.js +45 -0
- package/dist/src/setup-surface.js.map +7 -0
- package/dist/src/startup-maintenance.js +29 -0
- package/dist/src/startup-maintenance.js.map +7 -0
- package/dist/src/storage-paths.js +24 -0
- package/dist/src/storage-paths.js.map +7 -0
- package/dist/src/test-helpers.js +49 -0
- package/dist/src/test-helpers.js.map +7 -0
- package/dist/src/test-mocks.js +40 -0
- package/dist/src/test-mocks.js.map +7 -0
- package/dist/src/test-runtime.js +65 -0
- package/dist/src/test-runtime.js.map +7 -0
- package/dist/src/tool-actions.js +68 -0
- package/dist/src/tool-actions.js.map +7 -0
- package/dist/src/tool-actions.runtime.js +73 -0
- package/dist/src/tool-actions.runtime.js.map +7 -0
- package/dist/src/types.js +7 -0
- package/dist/src/types.js.map +7 -0
- package/dist/test-api.js +82 -0
- package/dist/test-api.js.map +7 -0
- package/dist/thread-bindings-runtime.js +15 -0
- package/dist/thread-bindings-runtime.js.map +7 -0
- package/package.json +12 -6
- package/CHANGELOG.md +0 -164
- package/ENDOFFILE +0 -0
- package/EOF +0 -0
- package/SPEC-SUPPORT.md +0 -116
- package/YAMLEND +0 -0
- package/api.ts +0 -18
- package/archipelagolab-lobi-1.0.0.tgz +0 -0
- package/archipelagolab-lobi-1.0.1.tgz +0 -0
- package/auth-presence.ts +0 -56
- package/channel-plugin-api.ts +0 -3
- package/cli-metadata.ts +0 -11
- package/contract-api.ts +0 -17
- package/docs/CHECKLIST.md +0 -83
- package/docs/FORK_SDK_GUIDE.md +0 -279
- package/helper-api.ts +0 -3
- package/index.test.ts +0 -61
- package/index.ts +0 -65
- package/plugin-entry.handlers.runtime.ts +0 -1
- package/runtime-api.ts +0 -54
- package/runtime-heavy-api.ts +0 -1
- package/scripts/migrate-to-lobi.sh +0 -72
- package/secret-contract-api.ts +0 -5
- package/setup-entry.ts +0 -13
- package/src/account-selection.test.ts +0 -124
- package/src/account-selection.ts +0 -226
- package/src/actions.account-propagation.test.ts +0 -251
- package/src/actions.test.ts +0 -251
- package/src/actions.ts +0 -336
- package/src/approval-auth.test.ts +0 -23
- package/src/approval-auth.ts +0 -25
- package/src/approval-handler.runtime.test.ts +0 -46
- package/src/approval-handler.runtime.ts +0 -400
- package/src/approval-ids.ts +0 -6
- package/src/approval-native.test.ts +0 -329
- package/src/approval-native.ts +0 -336
- package/src/approval-reactions.test.ts +0 -107
- package/src/approval-reactions.ts +0 -158
- package/src/auth-precedence.ts +0 -61
- package/src/channel-account-paths.ts +0 -92
- package/src/channel.account-paths.test.ts +0 -102
- package/src/channel.directory.test.ts +0 -601
- package/src/channel.resolve.test.ts +0 -38
- package/src/channel.runtime.ts +0 -16
- package/src/channel.setup.test.ts +0 -269
- package/src/channel.ts +0 -570
- package/src/cli-metadata.ts +0 -19
- package/src/cli.test.ts +0 -1015
- package/src/cli.ts +0 -1198
- package/src/config-adapter.ts +0 -41
- package/src/config-schema.test.ts +0 -90
- package/src/config-schema.ts +0 -114
- package/src/directory-live.test.ts +0 -200
- package/src/directory-live.ts +0 -238
- package/src/doctor-contract.ts +0 -287
- package/src/doctor.test.ts +0 -440
- package/src/doctor.ts +0 -262
- package/src/env-vars.ts +0 -92
- package/src/exec-approval-resolver.test.ts +0 -68
- package/src/exec-approval-resolver.ts +0 -23
- package/src/exec-approvals.test.ts +0 -483
- package/src/exec-approvals.ts +0 -290
- package/src/group-mentions.ts +0 -41
- package/src/legacy-crypto-inspector-availability.test.ts +0 -81
- package/src/legacy-crypto-inspector-availability.ts +0 -60
- package/src/legacy-crypto.test.ts +0 -234
- package/src/legacy-crypto.ts +0 -549
- package/src/legacy-state.test.ts +0 -86
- package/src/legacy-state.ts +0 -156
- package/src/matrix/account-config.ts +0 -150
- package/src/matrix/accounts.readiness.test.ts +0 -27
- package/src/matrix/accounts.test.ts +0 -757
- package/src/matrix/accounts.ts +0 -194
- package/src/matrix/actions/client.test.ts +0 -215
- package/src/matrix/actions/client.ts +0 -31
- package/src/matrix/actions/devices.test.ts +0 -114
- package/src/matrix/actions/devices.ts +0 -34
- package/src/matrix/actions/limits.test.ts +0 -15
- package/src/matrix/actions/limits.ts +0 -6
- package/src/matrix/actions/messages.test.ts +0 -289
- package/src/matrix/actions/messages.ts +0 -123
- package/src/matrix/actions/pins.test.ts +0 -74
- package/src/matrix/actions/pins.ts +0 -64
- package/src/matrix/actions/polls.test.ts +0 -71
- package/src/matrix/actions/polls.ts +0 -109
- package/src/matrix/actions/profile.test.ts +0 -109
- package/src/matrix/actions/profile.ts +0 -37
- package/src/matrix/actions/reactions.test.ts +0 -135
- package/src/matrix/actions/reactions.ts +0 -59
- package/src/matrix/actions/room.test.ts +0 -79
- package/src/matrix/actions/room.ts +0 -71
- package/src/matrix/actions/summary.test.ts +0 -87
- package/src/matrix/actions/summary.ts +0 -88
- package/src/matrix/actions/types.ts +0 -82
- package/src/matrix/actions/verification.test.ts +0 -105
- package/src/matrix/actions/verification.ts +0 -237
- package/src/matrix/actions.ts +0 -37
- package/src/matrix/active-client.ts +0 -26
- package/src/matrix/async-lock.ts +0 -18
- package/src/matrix/backup-health.ts +0 -115
- package/src/matrix/client/config-runtime-api.ts +0 -14
- package/src/matrix/client/config-secret-input.runtime.ts +0 -1
- package/src/matrix/client/config.ts +0 -982
- package/src/matrix/client/create-client.test.ts +0 -115
- package/src/matrix/client/create-client.ts +0 -101
- package/src/matrix/client/env-auth.ts +0 -6
- package/src/matrix/client/file-sync-store.test.ts +0 -265
- package/src/matrix/client/file-sync-store.ts +0 -289
- package/src/matrix/client/logging.ts +0 -123
- package/src/matrix/client/migration-snapshot.runtime.ts +0 -1
- package/src/matrix/client/private-network-host.ts +0 -56
- package/src/matrix/client/runtime.ts +0 -4
- package/src/matrix/client/shared.test.ts +0 -344
- package/src/matrix/client/shared.ts +0 -306
- package/src/matrix/client/storage.test.ts +0 -634
- package/src/matrix/client/storage.ts +0 -544
- package/src/matrix/client/types.ts +0 -50
- package/src/matrix/client-bootstrap.test.ts +0 -84
- package/src/matrix/client-bootstrap.ts +0 -164
- package/src/matrix/client-resolver.test-helpers.ts +0 -147
- package/src/matrix/client.test.ts +0 -1521
- package/src/matrix/client.ts +0 -23
- package/src/matrix/config-paths.ts +0 -31
- package/src/matrix/config-update.test.ts +0 -237
- package/src/matrix/config-update.ts +0 -291
- package/src/matrix/credentials-read.ts +0 -206
- package/src/matrix/credentials-write.runtime.ts +0 -26
- package/src/matrix/credentials.test.ts +0 -501
- package/src/matrix/credentials.ts +0 -95
- package/src/matrix/deps.test.ts +0 -74
- package/src/matrix/deps.ts +0 -225
- package/src/matrix/device-health.test.ts +0 -45
- package/src/matrix/device-health.ts +0 -31
- package/src/matrix/direct-management.test.ts +0 -350
- package/src/matrix/direct-management.ts +0 -347
- package/src/matrix/direct-room.test.ts +0 -61
- package/src/matrix/direct-room.ts +0 -128
- package/src/matrix/draft-stream.test.ts +0 -406
- package/src/matrix/draft-stream.ts +0 -216
- package/src/matrix/encryption-guidance.ts +0 -27
- package/src/matrix/errors.ts +0 -21
- package/src/matrix/format.test.ts +0 -340
- package/src/matrix/format.ts +0 -428
- package/src/matrix/legacy-crypto-inspector.ts +0 -95
- package/src/matrix/media-errors.ts +0 -20
- package/src/matrix/media-text.ts +0 -169
- package/src/matrix/monitor/access-state.test.ts +0 -45
- package/src/matrix/monitor/access-state.ts +0 -77
- package/src/matrix/monitor/ack-config.test.ts +0 -57
- package/src/matrix/monitor/ack-config.ts +0 -26
- package/src/matrix/monitor/allowlist.test.ts +0 -45
- package/src/matrix/monitor/allowlist.ts +0 -94
- package/src/matrix/monitor/auto-join.test.ts +0 -203
- package/src/matrix/monitor/auto-join.ts +0 -86
- package/src/matrix/monitor/config.test.ts +0 -197
- package/src/matrix/monitor/config.ts +0 -303
- package/src/matrix/monitor/context-summary.ts +0 -43
- package/src/matrix/monitor/direct.test.ts +0 -529
- package/src/matrix/monitor/direct.ts +0 -270
- package/src/matrix/monitor/events.test.ts +0 -1524
- package/src/matrix/monitor/events.ts +0 -213
- package/src/matrix/monitor/handler.body-for-agent.test.ts +0 -396
- package/src/matrix/monitor/handler.group-history.test.ts +0 -648
- package/src/matrix/monitor/handler.media-failure.test.ts +0 -267
- package/src/matrix/monitor/handler.test-helpers.ts +0 -308
- package/src/matrix/monitor/handler.test.ts +0 -2952
- package/src/matrix/monitor/handler.thread-root-media.test.ts +0 -82
- package/src/matrix/monitor/handler.ts +0 -1679
- package/src/matrix/monitor/inbound-dedupe.test.ts +0 -146
- package/src/matrix/monitor/inbound-dedupe.ts +0 -267
- package/src/matrix/monitor/index.test.ts +0 -920
- package/src/matrix/monitor/index.ts +0 -434
- package/src/matrix/monitor/legacy-crypto-restore.test.ts +0 -206
- package/src/matrix/monitor/legacy-crypto-restore.ts +0 -139
- package/src/matrix/monitor/location.ts +0 -100
- package/src/matrix/monitor/media.test.ts +0 -159
- package/src/matrix/monitor/media.ts +0 -119
- package/src/matrix/monitor/mentions.test.ts +0 -289
- package/src/matrix/monitor/mentions.ts +0 -177
- package/src/matrix/monitor/reaction-events.test.ts +0 -326
- package/src/matrix/monitor/reaction-events.ts +0 -187
- package/src/matrix/monitor/recent-invite.test.ts +0 -92
- package/src/matrix/monitor/recent-invite.ts +0 -30
- package/src/matrix/monitor/replies.test.ts +0 -265
- package/src/matrix/monitor/replies.ts +0 -136
- package/src/matrix/monitor/reply-context.test.ts +0 -276
- package/src/matrix/monitor/reply-context.ts +0 -92
- package/src/matrix/monitor/room-history.test.ts +0 -258
- package/src/matrix/monitor/room-history.ts +0 -301
- package/src/matrix/monitor/room-info.test.ts +0 -201
- package/src/matrix/monitor/room-info.ts +0 -126
- package/src/matrix/monitor/rooms.test.ts +0 -121
- package/src/matrix/monitor/rooms.ts +0 -52
- package/src/matrix/monitor/route.test.ts +0 -255
- package/src/matrix/monitor/route.ts +0 -178
- package/src/matrix/monitor/runtime-api.ts +0 -31
- package/src/matrix/monitor/startup-verification.test.ts +0 -294
- package/src/matrix/monitor/startup-verification.ts +0 -237
- package/src/matrix/monitor/startup.test.ts +0 -257
- package/src/matrix/monitor/startup.ts +0 -218
- package/src/matrix/monitor/status.ts +0 -111
- package/src/matrix/monitor/sync-lifecycle.test.ts +0 -224
- package/src/matrix/monitor/sync-lifecycle.ts +0 -91
- package/src/matrix/monitor/task-runner.ts +0 -38
- package/src/matrix/monitor/thread-context.test.ts +0 -149
- package/src/matrix/monitor/thread-context.ts +0 -108
- package/src/matrix/monitor/threads.test.ts +0 -68
- package/src/matrix/monitor/threads.ts +0 -85
- package/src/matrix/monitor/types.ts +0 -30
- package/src/matrix/monitor/verification-events.ts +0 -627
- package/src/matrix/monitor/verification-utils.test.ts +0 -47
- package/src/matrix/monitor/verification-utils.ts +0 -46
- package/src/matrix/outbound-media-runtime.ts +0 -1
- package/src/matrix/poll-summary.ts +0 -110
- package/src/matrix/poll-types.test.ts +0 -205
- package/src/matrix/poll-types.ts +0 -433
- package/src/matrix/probe.runtime.ts +0 -4
- package/src/matrix/probe.test.ts +0 -154
- package/src/matrix/probe.ts +0 -96
- package/src/matrix/profile.test.ts +0 -154
- package/src/matrix/profile.ts +0 -184
- package/src/matrix/reaction-common.test.ts +0 -96
- package/src/matrix/reaction-common.ts +0 -147
- package/src/matrix/sdk/crypto-bootstrap.test.ts +0 -505
- package/src/matrix/sdk/crypto-bootstrap.ts +0 -341
- package/src/matrix/sdk/crypto-facade.test.ts +0 -197
- package/src/matrix/sdk/crypto-facade.ts +0 -207
- package/src/matrix/sdk/crypto-node.runtime.test.ts +0 -27
- package/src/matrix/sdk/crypto-node.runtime.ts +0 -9
- package/src/matrix/sdk/crypto-runtime.ts +0 -11
- package/src/matrix/sdk/decrypt-bridge.ts +0 -356
- package/src/matrix/sdk/event-helpers.test.ts +0 -60
- package/src/matrix/sdk/event-helpers.ts +0 -71
- package/src/matrix/sdk/http-client.test.ts +0 -134
- package/src/matrix/sdk/http-client.ts +0 -87
- package/src/matrix/sdk/idb-persistence-lock.ts +0 -51
- package/src/matrix/sdk/idb-persistence.lock-order.test.ts +0 -108
- package/src/matrix/sdk/idb-persistence.test-helpers.ts +0 -88
- package/src/matrix/sdk/idb-persistence.test.ts +0 -149
- package/src/matrix/sdk/idb-persistence.ts +0 -283
- package/src/matrix/sdk/logger.test.ts +0 -25
- package/src/matrix/sdk/logger.ts +0 -108
- package/src/matrix/sdk/read-response-with-limit.ts +0 -19
- package/src/matrix/sdk/recovery-key-store.test.ts +0 -385
- package/src/matrix/sdk/recovery-key-store.ts +0 -430
- package/src/matrix/sdk/transport.test.ts +0 -161
- package/src/matrix/sdk/transport.ts +0 -344
- package/src/matrix/sdk/types.ts +0 -236
- package/src/matrix/sdk/verification-manager.test.ts +0 -509
- package/src/matrix/sdk/verification-manager.ts +0 -694
- package/src/matrix/sdk/verification-status.ts +0 -23
- package/src/matrix/sdk.test.ts +0 -2568
- package/src/matrix/sdk.ts +0 -1789
- package/src/matrix/send/client.test.ts +0 -174
- package/src/matrix/send/client.ts +0 -90
- package/src/matrix/send/formatting.ts +0 -189
- package/src/matrix/send/media.ts +0 -244
- package/src/matrix/send/targets.test.ts +0 -254
- package/src/matrix/send/targets.ts +0 -104
- package/src/matrix/send/types.ts +0 -134
- package/src/matrix/send.test.ts +0 -958
- package/src/matrix/send.ts +0 -609
- package/src/matrix/session-store-metadata.ts +0 -108
- package/src/matrix/startup-abort.ts +0 -44
- package/src/matrix/sync-state.ts +0 -27
- package/src/matrix/target-ids.ts +0 -102
- package/src/matrix/thread-bindings-shared.ts +0 -201
- package/src/matrix/thread-bindings.test.ts +0 -673
- package/src/matrix/thread-bindings.ts +0 -577
- package/src/matrix-migration.runtime.ts +0 -9
- package/src/migration-config.test.ts +0 -228
- package/src/migration-config.ts +0 -243
- package/src/migration-snapshot-backup.ts +0 -117
- package/src/migration-snapshot.test.ts +0 -184
- package/src/migration-snapshot.ts +0 -55
- package/src/onboarding.resolve.test.ts +0 -55
- package/src/onboarding.test-harness.ts +0 -158
- package/src/onboarding.test.ts +0 -665
- package/src/onboarding.ts +0 -773
- package/src/outbound.test.ts +0 -173
- package/src/outbound.ts +0 -78
- package/src/plugin-entry.runtime.js +0 -159
- package/src/plugin-entry.runtime.test.ts +0 -108
- package/src/plugin-entry.runtime.ts +0 -68
- package/src/profile-update.ts +0 -68
- package/src/record-shared.ts +0 -3
- package/src/resolve-targets.test.ts +0 -178
- package/src/resolve-targets.ts +0 -175
- package/src/resolver.ts +0 -21
- package/src/runtime-api.ts +0 -144
- package/src/runtime.ts +0 -7
- package/src/secret-contract.ts +0 -174
- package/src/session-route.test.ts +0 -315
- package/src/session-route.ts +0 -113
- package/src/setup-bootstrap.ts +0 -94
- package/src/setup-config.ts +0 -222
- package/src/setup-contract.ts +0 -89
- package/src/setup-core.test.ts +0 -326
- package/src/setup-core.ts +0 -50
- package/src/setup-surface.ts +0 -4
- package/src/startup-maintenance.test.ts +0 -227
- package/src/startup-maintenance.ts +0 -114
- package/src/storage-paths.ts +0 -92
- package/src/test-helpers.ts +0 -42
- package/src/test-mocks.ts +0 -55
- package/src/test-runtime.ts +0 -72
- package/src/test-support/monitor-route-test-support.ts +0 -8
- package/src/tool-actions.runtime.ts +0 -1
- package/src/tool-actions.test.ts +0 -422
- package/src/tool-actions.ts +0 -498
- package/src/types.ts +0 -230
- package/test-api.ts +0 -2
- package/thread-bindings-runtime.ts +0 -4
- package/tsconfig.json +0 -16
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../node_modules/matrix-widget-api/src/interfaces/WidgetApiDirection.ts", "../../../node_modules/matrix-widget-api/src/interfaces/ApiVersion.ts", "../../../node_modules/matrix-widget-api/src/transport/PostmessageTransport.ts", "../../../node_modules/matrix-widget-api/src/interfaces/WidgetApiAction.ts", "../../../node_modules/matrix-widget-api/src/interfaces/GetOpenIDAction.ts", "../../../node_modules/matrix-widget-api/src/interfaces/WidgetType.ts", "../../../node_modules/matrix-widget-api/src/interfaces/ModalWidgetActions.ts", "../../../node_modules/matrix-widget-api/src/models/WidgetEventCapability.ts", "../../../node_modules/matrix-widget-api/src/Symbols.ts", "../../../node_modules/matrix-widget-api/src/interfaces/UpdateDelayedEventAction.ts", "../../../node_modules/matrix-widget-api/src/WidgetApi.ts", "../../../node_modules/matrix-widget-api/src/interfaces/Capabilities.ts", "../../../node_modules/matrix-widget-api/src/util/SimpleObservable.ts", "../../../node_modules/matrix-widget-api/src/ClientWidgetApi.ts", "../../../node_modules/matrix-widget-api/src/interfaces/IWidgetApiErrorResponse.ts", "../../../node_modules/matrix-widget-api/src/interfaces/WidgetKind.ts", "../../../node_modules/matrix-widget-api/src/interfaces/ModalButtonKind.ts", "../../../node_modules/matrix-widget-api/src/models/validation/url.ts", "../../../node_modules/matrix-widget-api/src/models/validation/utils.ts", "../../../node_modules/matrix-widget-api/src/models/Widget.ts", "../../../node_modules/matrix-widget-api/src/models/WidgetParser.ts", "../../../node_modules/matrix-widget-api/src/templating/url-template.ts", "../../../node_modules/matrix-widget-api/src/driver/WidgetDriver.ts", "../../../node_modules/matrix-widget-api/src/index.ts", "../src/matrix/client/file-sync-store.ts", "../../../node_modules/@archipelagolab/lobi-js-sdk/src/lobi.ts", "../../../node_modules/@archipelagolab/lobi-js-sdk/src/store/memory.ts", "../../../node_modules/@archipelagolab/lobi-js-sdk/src/embedded.ts", "../../../node_modules/@archipelagolab/lobi-js-sdk/src/receipt-accumulator.ts", "../../../node_modules/@archipelagolab/lobi-js-sdk/src/sync-accumulator.ts", "../../../node_modules/@archipelagolab/lobi-js-sdk/src/timeline-window.ts", "../../../node_modules/@archipelagolab/lobi-js-sdk/src/store/indexeddb-local-backend.ts", "../../../node_modules/@archipelagolab/lobi-js-sdk/src/store/indexeddb.ts", "../../../node_modules/@archipelagolab/lobi-js-sdk/src/@types/threepids.ts", "../../../node_modules/@archipelagolab/lobi-js-sdk/src/@types/auth.ts", "../../../node_modules/@archipelagolab/lobi-js-sdk/src/models/profile-keys.ts", "../../../node_modules/@archipelagolab/lobi-js-sdk/src/store/local-storage-events-emitter.ts"],
|
|
4
|
+
"sourcesContent": ["/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum WidgetApiDirection {\n ToWidget = \"toWidget\",\n FromWidget = \"fromWidget\",\n}\n\nexport function invertedDirection(dir: WidgetApiDirection): WidgetApiDirection {\n if (dir === WidgetApiDirection.ToWidget) {\n return WidgetApiDirection.FromWidget;\n } else if (dir === WidgetApiDirection.FromWidget) {\n return WidgetApiDirection.ToWidget;\n } else {\n throw new Error(\"Invalid direction\");\n }\n}\n", "/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum MatrixApiVersion {\n Prerelease1 = \"0.0.1\",\n Prerelease2 = \"0.0.2\",\n //V010 = \"0.1.0\", // first release\n}\n\nexport enum UnstableApiVersion {\n MSC2762 = \"org.matrix.msc2762\",\n MSC2762_UPDATE_STATE = \"org.matrix.msc2762_update_state\",\n MSC2871 = \"org.matrix.msc2871\",\n MSC2873 = \"org.matrix.msc2873\",\n MSC2931 = \"org.matrix.msc2931\",\n MSC2974 = \"org.matrix.msc2974\",\n MSC2876 = \"org.matrix.msc2876\",\n MSC3819 = \"org.matrix.msc3819\",\n MSC3846 = \"town.robin.msc3846\",\n MSC3869 = \"org.matrix.msc3869\",\n MSC3973 = \"org.matrix.msc3973\",\n MSC4039 = \"org.matrix.msc4039\",\n}\n\nexport type ApiVersion = MatrixApiVersion | UnstableApiVersion | string;\n\nexport const CurrentApiVersions: ApiVersion[] = [\n MatrixApiVersion.Prerelease1,\n MatrixApiVersion.Prerelease2,\n //MatrixApiVersion.V010,\n UnstableApiVersion.MSC2762,\n UnstableApiVersion.MSC2762_UPDATE_STATE,\n UnstableApiVersion.MSC2871,\n UnstableApiVersion.MSC2873,\n UnstableApiVersion.MSC2931,\n UnstableApiVersion.MSC2974,\n UnstableApiVersion.MSC2876,\n UnstableApiVersion.MSC3819,\n UnstableApiVersion.MSC3846,\n UnstableApiVersion.MSC3869,\n UnstableApiVersion.MSC3973,\n UnstableApiVersion.MSC4039,\n];\n", "/*\n * Copyright 2020 - 2024 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { EventEmitter } from \"events\";\n\nimport { ITransport } from \"./ITransport\";\nimport {\n invertedDirection,\n isErrorResponse,\n IWidgetApiRequest,\n IWidgetApiRequestData,\n IWidgetApiResponse,\n IWidgetApiResponseData,\n WidgetApiResponseError,\n WidgetApiAction,\n WidgetApiDirection,\n WidgetApiToWidgetAction,\n} from \"..\";\n\ninterface IOutboundRequest {\n request: IWidgetApiRequest;\n resolve: (response: IWidgetApiResponse) => void;\n reject: (err: Error) => void;\n}\n\n/**\n * Transport for the Widget API over postMessage.\n */\nexport class PostmessageTransport extends EventEmitter implements ITransport {\n public strictOriginCheck = false;\n public targetOrigin = \"*\";\n public timeoutSeconds = 10;\n\n private _ready = false;\n private _widgetId: string | null;\n private readonly outboundRequests = new Map<string, IOutboundRequest | null>();\n private readonly stopController = new AbortController();\n\n public get ready(): boolean {\n return this._ready;\n }\n\n public get widgetId(): string | null {\n return this._widgetId || null;\n }\n\n public constructor(\n private readonly sendDirection: WidgetApiDirection,\n initialWidgetId: string | null,\n private readonly transportWindow: Window | typeof globalThis,\n private readonly inboundWindow: Window | typeof globalThis,\n ) {\n super();\n this._widgetId = initialWidgetId;\n }\n\n private get nextRequestId(): string {\n const idBase = `widgetapi-${Date.now()}`;\n let index = 0;\n let id = idBase;\n while (this.outboundRequests.has(id)) {\n id = `${idBase}-${index++}`;\n }\n\n // reserve the ID\n this.outboundRequests.set(id, null);\n\n return id;\n }\n\n private sendInternal(message: IWidgetApiRequest | IWidgetApiResponse): void {\n console.log(`[PostmessageTransport] Sending object to ${this.targetOrigin}: `, message);\n this.transportWindow.postMessage(message, this.targetOrigin);\n }\n\n public reply<T extends IWidgetApiResponseData>(request: IWidgetApiRequest, responseData: T): void {\n return this.sendInternal(<IWidgetApiResponse>{\n ...request,\n response: responseData,\n });\n }\n\n public send<T extends IWidgetApiRequestData, R extends IWidgetApiResponseData>(\n action: WidgetApiAction,\n data: T,\n ): Promise<R> {\n return this.sendComplete(action, data).then((r) => <R>r.response);\n }\n\n public sendComplete<T extends IWidgetApiRequestData, R extends IWidgetApiResponse>(\n action: WidgetApiAction,\n data: T,\n ): Promise<R> {\n if (!this.ready || !this.widgetId) {\n return Promise.reject(new Error(\"Not ready or unknown widget ID\"));\n }\n const request: IWidgetApiRequest = {\n api: this.sendDirection,\n widgetId: this.widgetId,\n requestId: this.nextRequestId,\n action: action,\n data: data,\n };\n if (action === WidgetApiToWidgetAction.UpdateVisibility) {\n request[\"visible\"] = data[\"visible\"];\n }\n return new Promise<R>((prResolve, prReject) => {\n const resolve = (response: IWidgetApiResponse): void => {\n cleanUp();\n prResolve(<R>response);\n };\n const reject = (err: Error): void => {\n cleanUp();\n prReject(err);\n };\n\n const timerId = setTimeout(() => reject(new Error(\"Request timed out\")), (this.timeoutSeconds || 1) * 1000);\n\n const onStop = (): void => reject(new Error(\"Transport stopped\"));\n this.stopController.signal.addEventListener(\"abort\", onStop);\n\n const cleanUp = (): void => {\n this.outboundRequests.delete(request.requestId);\n clearTimeout(timerId);\n this.stopController.signal.removeEventListener(\"abort\", onStop);\n };\n\n this.outboundRequests.set(request.requestId, { request, resolve, reject });\n this.sendInternal(request);\n });\n }\n\n public start(): void {\n this.inboundWindow.addEventListener(\"message\", this.handleMessage);\n this._ready = true;\n }\n\n public stop(): void {\n this._ready = false;\n this.stopController.abort();\n this.inboundWindow.removeEventListener(\"message\", this.handleMessage);\n }\n\n private readonly handleMessage = (ev: MessageEvent): void => {\n if (this.stopController.signal.aborted) return;\n if (!ev.data) return; // invalid event\n\n if (this.strictOriginCheck && ev.origin !== globalThis.origin) return; // bad origin\n\n // treat the message as a response first, then downgrade to a request\n const response = <IWidgetApiResponse>ev.data;\n if (!response.action || !response.requestId || !response.widgetId) return; // invalid request/response\n\n if (response.response) {\n if (response.api !== this.sendDirection) return; // wrong direction\n this.handleResponse(response);\n } else {\n const request = <IWidgetApiRequest>response;\n if (request.api !== invertedDirection(this.sendDirection)) return; // wrong direction\n this.handleRequest(request);\n }\n };\n\n private handleRequest(request: IWidgetApiRequest): void {\n if (this.widgetId) {\n if (this.widgetId !== request.widgetId) return; // wrong widget\n } else {\n this._widgetId = request.widgetId;\n }\n\n this.emit(\"message\", new CustomEvent(\"message\", { detail: request }));\n }\n\n private handleResponse(response: IWidgetApiResponse): void {\n if (response.widgetId !== this.widgetId) return; // wrong widget\n\n const req = this.outboundRequests.get(response.requestId);\n if (!req) return; // response to an unknown request\n\n if (isErrorResponse(response.response)) {\n const { message, ...data } = response.response.error;\n req.reject(new WidgetApiResponseError(message, data));\n } else {\n req.resolve(response);\n }\n }\n}\n", "/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum WidgetApiToWidgetAction {\n SupportedApiVersions = \"supported_api_versions\",\n Capabilities = \"capabilities\",\n NotifyCapabilities = \"notify_capabilities\",\n ThemeChange = \"theme_change\",\n LanguageChange = \"language_change\",\n TakeScreenshot = \"screenshot\",\n UpdateVisibility = \"visibility\",\n OpenIDCredentials = \"openid_credentials\",\n WidgetConfig = \"widget_config\",\n CloseModalWidget = \"close_modal\",\n ButtonClicked = \"button_clicked\",\n SendEvent = \"send_event\",\n SendToDevice = \"send_to_device\",\n UpdateState = \"update_state\",\n UpdateTurnServers = \"update_turn_servers\",\n}\n\nexport enum WidgetApiFromWidgetAction {\n SupportedApiVersions = \"supported_api_versions\",\n ContentLoaded = \"content_loaded\",\n SendSticker = \"m.sticker\",\n UpdateAlwaysOnScreen = \"set_always_on_screen\",\n GetOpenIDCredentials = \"get_openid\",\n CloseModalWidget = \"close_modal\",\n OpenModalWidget = \"open_modal\",\n SetModalButtonEnabled = \"set_button_enabled\",\n SendEvent = \"send_event\",\n SendToDevice = \"send_to_device\",\n WatchTurnServers = \"watch_turn_servers\",\n UnwatchTurnServers = \"unwatch_turn_servers\",\n\n BeeperReadRoomAccountData = \"com.beeper.read_room_account_data\",\n\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC2876ReadEvents = \"org.matrix.msc2876.read_events\",\n\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC2931Navigate = \"org.matrix.msc2931.navigate\",\n\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC2974RenegotiateCapabilities = \"org.matrix.msc2974.request_capabilities\",\n\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC3869ReadRelations = \"org.matrix.msc3869.read_relations\",\n\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC3973UserDirectorySearch = \"org.matrix.msc3973.user_directory_search\",\n\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC4039GetMediaConfigAction = \"org.matrix.msc4039.get_media_config\",\n\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC4039UploadFileAction = \"org.matrix.msc4039.upload_file\",\n\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC4039DownloadFileAction = \"org.matrix.msc4039.download_file\",\n\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC4157UpdateDelayedEvent = \"org.matrix.msc4157.update_delayed_event\",\n}\n\nexport type WidgetApiAction = WidgetApiToWidgetAction | WidgetApiFromWidgetAction | string;\n", "/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IWidgetApiRequest, IWidgetApiRequestData } from \"./IWidgetApiRequest\";\nimport { WidgetApiFromWidgetAction } from \"./WidgetApiAction\";\nimport { IWidgetApiResponseData } from \"./IWidgetApiResponse\";\n\nexport enum OpenIDRequestState {\n Allowed = \"allowed\",\n Blocked = \"blocked\",\n PendingUserConfirmation = \"request\",\n}\n\nexport interface IOpenIDCredentials {\n access_token?: string; // eslint-disable-line camelcase\n expires_in?: number; // eslint-disable-line camelcase\n matrix_server_name?: string; // eslint-disable-line camelcase\n token_type?: \"Bearer\" | string; // eslint-disable-line camelcase\n}\n\nexport interface IGetOpenIDActionRequestData extends IWidgetApiRequestData {\n // nothing\n}\n\nexport interface IGetOpenIDActionRequest extends IWidgetApiRequest {\n action: WidgetApiFromWidgetAction.GetOpenIDCredentials;\n data: IGetOpenIDActionRequestData;\n}\n\nexport interface IGetOpenIDActionResponseData extends IWidgetApiResponseData, IOpenIDCredentials {\n state: OpenIDRequestState;\n}\n\nexport interface IGetOpenIDActionResponse extends IGetOpenIDActionRequest {\n response: IGetOpenIDActionResponseData;\n}\n", "/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum MatrixWidgetType {\n Custom = \"m.custom\",\n JitsiMeet = \"m.jitsi\",\n Stickerpicker = \"m.stickerpicker\",\n}\n\nexport type WidgetType = MatrixWidgetType | string;\n", "/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IWidgetApiRequest, IWidgetApiRequestData } from \"./IWidgetApiRequest\";\nimport { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from \"./WidgetApiAction\";\nimport { IWidgetApiAcknowledgeResponseData, IWidgetApiResponse } from \"./IWidgetApiResponse\";\nimport { IWidget } from \"./IWidget\";\nimport { ModalButtonKind } from \"./ModalButtonKind\";\n\nexport enum BuiltInModalButtonID {\n Close = \"m.close\",\n}\nexport type ModalButtonID = BuiltInModalButtonID | string;\n\nexport interface IModalWidgetCreateData extends IWidgetApiRequestData {\n [key: string]: unknown;\n}\n\nexport interface IModalWidgetReturnData {\n [key: string]: unknown;\n}\n\n// Types for a normal modal requesting the opening a modal widget\nexport interface IModalWidgetOpenRequestDataButton {\n id: ModalButtonID;\n label: string;\n kind: ModalButtonKind | string;\n disabled?: boolean;\n}\n\nexport interface IModalWidgetOpenRequestData extends IModalWidgetCreateData, Omit<IWidget, \"id\" | \"creatorUserId\"> {\n buttons?: IModalWidgetOpenRequestDataButton[];\n}\n\nexport interface IModalWidgetOpenRequest extends IWidgetApiRequest {\n action: WidgetApiFromWidgetAction.OpenModalWidget;\n data: IModalWidgetOpenRequestData;\n}\n\nexport interface IModalWidgetOpenResponse extends IWidgetApiResponse {\n response: IWidgetApiAcknowledgeResponseData;\n}\n\n// Types for a modal widget receiving notifications that its buttons have been pressed\nexport interface IModalWidgetButtonClickedRequestData extends IWidgetApiRequestData {\n id: IModalWidgetOpenRequestDataButton[\"id\"];\n}\n\nexport interface IModalWidgetButtonClickedRequest extends IWidgetApiRequest {\n action: WidgetApiToWidgetAction.ButtonClicked;\n data: IModalWidgetButtonClickedRequestData;\n}\n\nexport interface IModalWidgetButtonClickedResponse extends IWidgetApiResponse {\n response: IWidgetApiAcknowledgeResponseData;\n}\n\n// Types for a modal widget requesting close\nexport interface IModalWidgetCloseRequest extends IWidgetApiRequest {\n action: WidgetApiFromWidgetAction.CloseModalWidget;\n data: IModalWidgetReturnData;\n}\n\nexport interface IModalWidgetCloseResponse extends IWidgetApiResponse {\n response: IWidgetApiAcknowledgeResponseData;\n}\n\n// Types for a normal widget being notified that the modal widget it opened has been closed\nexport interface IModalWidgetCloseNotificationRequest extends IWidgetApiRequest {\n action: WidgetApiToWidgetAction.CloseModalWidget;\n data: IModalWidgetReturnData;\n}\n\nexport interface IModalWidgetCloseNotificationResponse extends IWidgetApiResponse {\n response: IWidgetApiAcknowledgeResponseData;\n}\n", "/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Capability } from \"..\";\n\nexport enum EventKind {\n Event = \"event\",\n State = \"state_event\",\n ToDevice = \"to_device\",\n RoomAccount = \"room_account\",\n}\n\nexport enum EventDirection {\n Send = \"send\",\n Receive = \"receive\",\n}\n\nexport class WidgetEventCapability {\n private constructor(\n public readonly direction: EventDirection,\n public readonly eventType: string,\n public readonly kind: EventKind,\n public readonly keyStr: string | null,\n public readonly raw: string,\n ) {}\n\n public matchesAsStateEvent(direction: EventDirection, eventType: string, stateKey: string | null): boolean {\n if (this.kind !== EventKind.State) return false; // not a state event\n if (this.direction !== direction) return false; // direction mismatch\n if (this.eventType !== eventType) return false; // event type mismatch\n if (this.keyStr === null) return true; // all state keys are allowed\n if (this.keyStr === stateKey) return true; // this state key is allowed\n\n // Default not allowed\n return false;\n }\n\n public matchesAsToDeviceEvent(direction: EventDirection, eventType: string): boolean {\n if (this.kind !== EventKind.ToDevice) return false; // not a to-device event\n if (this.direction !== direction) return false; // direction mismatch\n if (this.eventType !== eventType) return false; // event type mismatch\n\n // Checks passed, the event is allowed\n return true;\n }\n\n public matchesAsRoomEvent(direction: EventDirection, eventType: string, msgtype: string | null = null): boolean {\n if (this.kind !== EventKind.Event) return false; // not a room event\n if (this.direction !== direction) return false; // direction mismatch\n if (this.eventType !== eventType) return false; // event type mismatch\n\n if (this.eventType === \"m.room.message\") {\n if (this.keyStr === null) return true; // all message types are allowed\n if (this.keyStr === msgtype) return true; // this message type is allowed\n } else {\n return true; // already passed the check for if the event is allowed\n }\n\n // Default not allowed\n return false;\n }\n\n public matchesAsRoomAccountData(direction: EventDirection, eventType: string): boolean {\n if (this.kind !== EventKind.RoomAccount) return false; // not room account data\n if (this.direction !== direction) return false; // direction mismatch\n if (this.eventType !== eventType) return false; // event type mismatch\n\n // Checks passed, the event is allowed\n return true;\n }\n\n public static forStateEvent(\n direction: EventDirection,\n eventType: string,\n stateKey?: string,\n ): WidgetEventCapability {\n // TODO: Enable support for m.* namespace once the MSC lands.\n // https://github.com/matrix-org/matrix-widget-api/issues/22\n eventType = eventType.replace(/#/g, \"\\\\#\");\n stateKey = stateKey !== null && stateKey !== undefined ? `#${stateKey}` : \"\";\n const str = `org.matrix.msc2762.${direction}.state_event:${eventType}${stateKey}`;\n\n // cheat by sending it through the processor\n return WidgetEventCapability.findEventCapabilities([str])[0];\n }\n\n public static forToDeviceEvent(direction: EventDirection, eventType: string): WidgetEventCapability {\n // TODO: Enable support for m.* namespace once the MSC lands.\n // https://github.com/matrix-org/matrix-widget-api/issues/56\n const str = `org.matrix.msc3819.${direction}.to_device:${eventType}`;\n\n // cheat by sending it through the processor\n return WidgetEventCapability.findEventCapabilities([str])[0];\n }\n\n public static forRoomEvent(direction: EventDirection, eventType: string): WidgetEventCapability {\n // TODO: Enable support for m.* namespace once the MSC lands.\n // https://github.com/matrix-org/matrix-widget-api/issues/22\n const str = `org.matrix.msc2762.${direction}.event:${eventType}`;\n\n // cheat by sending it through the processor\n return WidgetEventCapability.findEventCapabilities([str])[0];\n }\n\n public static forRoomMessageEvent(direction: EventDirection, msgtype?: string): WidgetEventCapability {\n // TODO: Enable support for m.* namespace once the MSC lands.\n // https://github.com/matrix-org/matrix-widget-api/issues/22\n msgtype = msgtype === null || msgtype === undefined ? \"\" : msgtype;\n const str = `org.matrix.msc2762.${direction}.event:m.room.message#${msgtype}`;\n\n // cheat by sending it through the processor\n return WidgetEventCapability.findEventCapabilities([str])[0];\n }\n\n public static forRoomAccountData(direction: EventDirection, eventType: string): WidgetEventCapability {\n const str = `com.beeper.capabilities.${direction}.room_account_data:${eventType}`;\n\n return WidgetEventCapability.findEventCapabilities([str])[0];\n }\n\n /**\n * Parses a capabilities request to find all the event capability requests.\n * @param {Iterable<Capability>} capabilities The capabilities requested/to parse.\n * @returns {WidgetEventCapability[]} An array of event capability requests. May be empty, but never null.\n */\n public static findEventCapabilities(capabilities: Iterable<Capability>): WidgetEventCapability[] {\n const parsed: WidgetEventCapability[] = [];\n for (const cap of capabilities) {\n let direction: EventDirection | null = null;\n let eventSegment: string | undefined;\n let kind: EventKind | null = null;\n\n // TODO: Enable support for m.* namespace once the MSCs land.\n // https://github.com/matrix-org/matrix-widget-api/issues/22\n // https://github.com/matrix-org/matrix-widget-api/issues/56\n\n if (cap.startsWith(\"org.matrix.msc2762.send.event:\")) {\n direction = EventDirection.Send;\n kind = EventKind.Event;\n eventSegment = cap.substring(\"org.matrix.msc2762.send.event:\".length);\n } else if (cap.startsWith(\"org.matrix.msc2762.send.state_event:\")) {\n direction = EventDirection.Send;\n kind = EventKind.State;\n eventSegment = cap.substring(\"org.matrix.msc2762.send.state_event:\".length);\n } else if (cap.startsWith(\"org.matrix.msc3819.send.to_device:\")) {\n direction = EventDirection.Send;\n kind = EventKind.ToDevice;\n eventSegment = cap.substring(\"org.matrix.msc3819.send.to_device:\".length);\n } else if (cap.startsWith(\"org.matrix.msc2762.receive.event:\")) {\n direction = EventDirection.Receive;\n kind = EventKind.Event;\n eventSegment = cap.substring(\"org.matrix.msc2762.receive.event:\".length);\n } else if (cap.startsWith(\"org.matrix.msc2762.receive.state_event:\")) {\n direction = EventDirection.Receive;\n kind = EventKind.State;\n eventSegment = cap.substring(\"org.matrix.msc2762.receive.state_event:\".length);\n } else if (cap.startsWith(\"org.matrix.msc3819.receive.to_device:\")) {\n direction = EventDirection.Receive;\n kind = EventKind.ToDevice;\n eventSegment = cap.substring(\"org.matrix.msc3819.receive.to_device:\".length);\n } else if (cap.startsWith(\"com.beeper.capabilities.receive.room_account_data:\")) {\n direction = EventDirection.Receive;\n kind = EventKind.RoomAccount;\n eventSegment = cap.substring(\"com.beeper.capabilities.receive.room_account_data:\".length);\n }\n\n if (direction === null || kind === null || eventSegment === undefined) continue;\n\n // The capability uses `#` as a separator between event type and state key/msgtype,\n // so we split on that. However, a # is also valid in either one of those so we\n // join accordingly.\n // Eg: `m.room.message##m.text` is \"m.room.message\" event with msgtype \"#m.text\".\n const expectingKeyStr = eventSegment.startsWith(\"m.room.message#\") || kind === EventKind.State;\n let keyStr: string | null = null;\n if (eventSegment.includes(\"#\") && expectingKeyStr) {\n // Dev note: regex is difficult to write, so instead the rules are manually written\n // out. This is probably just as understandable as a boring regex though, so win-win?\n\n // Test cases:\n // str eventSegment keyStr\n // -------------------------------------------------------------\n // m.room.message# m.room.message <empty string>\n // m.room.message#test m.room.message test\n // m.room.message\\# m.room.message# test\n // m.room.message##test m.room.message #test\n // m.room.message\\##test m.room.message# test\n // m.room.message\\\\##test m.room.message\\# test\n // m.room.message\\\\###test m.room.message\\# #test\n\n // First step: explode the string\n const parts = eventSegment.split(\"#\");\n\n // To form the eventSegment, we'll keep finding parts of the exploded string until\n // there's one that doesn't end with the escape character (\\). We'll then join those\n // segments together with the exploding character. We have to remember to consume the\n // escape character as well.\n const idx = parts.findIndex((p) => !p.endsWith(\"\\\\\"));\n eventSegment = parts\n .slice(0, idx + 1)\n .map((p) => (p.endsWith(\"\\\\\") ? p.substring(0, p.length - 1) : p))\n .join(\"#\");\n\n // The keyStr is whatever is left over.\n keyStr = parts.slice(idx + 1).join(\"#\");\n }\n\n parsed.push(new WidgetEventCapability(direction, eventSegment, kind, keyStr, cap));\n }\n return parsed;\n }\n}\n", "/*\n * Copyright 2021 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum Symbols {\n AnyRoom = \"*\",\n}\n", "/*\n * Copyright 2020 - 2024 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IWidgetApiRequest, IWidgetApiRequestData } from \"./IWidgetApiRequest\";\nimport { WidgetApiFromWidgetAction } from \"./WidgetApiAction\";\nimport { IWidgetApiResponseData } from \"./IWidgetApiResponse\";\n\nexport enum UpdateDelayedEventAction {\n Cancel = \"cancel\",\n Restart = \"restart\",\n Send = \"send\",\n}\n\nexport interface IUpdateDelayedEventFromWidgetRequestData extends IWidgetApiRequestData {\n delay_id: string; // eslint-disable-line camelcase\n action: UpdateDelayedEventAction;\n}\n\nexport interface IUpdateDelayedEventFromWidgetActionRequest extends IWidgetApiRequest {\n action: WidgetApiFromWidgetAction.MSC4157UpdateDelayedEvent;\n data: IUpdateDelayedEventFromWidgetRequestData;\n}\n\nexport interface IUpdateDelayedEventFromWidgetResponseData extends IWidgetApiResponseData {\n // nothing\n}\n\nexport interface IUpdateDelayedEventFromWidgetActionResponse extends IUpdateDelayedEventFromWidgetActionRequest {\n response: IUpdateDelayedEventFromWidgetResponseData;\n}\n", "/*\n * Copyright 2020 - 2024 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { EventEmitter } from \"events\";\n\nimport { Capability } from \"./interfaces/Capabilities\";\nimport { IWidgetApiRequest, IWidgetApiRequestEmptyData } from \"./interfaces/IWidgetApiRequest\";\nimport { IWidgetApiAcknowledgeResponseData } from \"./interfaces/IWidgetApiResponse\";\nimport { WidgetApiDirection } from \"./interfaces/WidgetApiDirection\";\nimport {\n ISupportedVersionsActionRequest,\n ISupportedVersionsActionResponseData,\n} from \"./interfaces/SupportedVersionsAction\";\nimport { ApiVersion, CurrentApiVersions, UnstableApiVersion } from \"./interfaces/ApiVersion\";\nimport {\n ICapabilitiesActionRequest,\n ICapabilitiesActionResponseData,\n INotifyCapabilitiesActionRequest,\n IRenegotiateCapabilitiesRequestData,\n} from \"./interfaces/CapabilitiesAction\";\nimport { ITransport } from \"./transport/ITransport\";\nimport { PostmessageTransport } from \"./transport/PostmessageTransport\";\nimport { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from \"./interfaces/WidgetApiAction\";\nimport { IWidgetApiErrorResponseData, IWidgetApiErrorResponseDataDetails } from \"./interfaces/IWidgetApiErrorResponse\";\nimport { IStickerActionRequestData } from \"./interfaces/StickerAction\";\nimport { IStickyActionRequestData, IStickyActionResponseData } from \"./interfaces/StickyAction\";\nimport {\n IGetOpenIDActionRequestData,\n IGetOpenIDActionResponse,\n IOpenIDCredentials,\n OpenIDRequestState,\n} from \"./interfaces/GetOpenIDAction\";\nimport { IOpenIDCredentialsActionRequest } from \"./interfaces/OpenIDCredentialsAction\";\nimport { MatrixWidgetType, WidgetType } from \"./interfaces/WidgetType\";\nimport {\n BuiltInModalButtonID,\n IModalWidgetCreateData,\n IModalWidgetOpenRequestData,\n IModalWidgetOpenRequestDataButton,\n IModalWidgetReturnData,\n ModalButtonID,\n} from \"./interfaces/ModalWidgetActions\";\nimport { ISetModalButtonEnabledActionRequestData } from \"./interfaces/SetModalButtonEnabledAction\";\nimport { ISendEventFromWidgetRequestData, ISendEventFromWidgetResponseData } from \"./interfaces/SendEventAction\";\nimport {\n ISendToDeviceFromWidgetRequestData,\n ISendToDeviceFromWidgetResponseData,\n} from \"./interfaces/SendToDeviceAction\";\nimport { EventDirection, WidgetEventCapability } from \"./models/WidgetEventCapability\";\nimport { INavigateActionRequestData } from \"./interfaces/NavigateAction\";\nimport { IReadEventFromWidgetRequestData, IReadEventFromWidgetResponseData } from \"./interfaces/ReadEventAction\";\nimport {\n IReadRoomAccountDataFromWidgetRequestData,\n IReadRoomAccountDataFromWidgetResponseData,\n} from \"./interfaces/ReadRoomAccountDataAction\";\nimport { IRoomEvent } from \"./interfaces/IRoomEvent\";\nimport { IRoomAccountData } from \"./interfaces/IRoomAccountData\";\nimport { ITurnServer, IUpdateTurnServersRequest } from \"./interfaces/TurnServerActions\";\nimport { Symbols } from \"./Symbols\";\nimport {\n IReadRelationsFromWidgetRequestData,\n IReadRelationsFromWidgetResponseData,\n} from \"./interfaces/ReadRelationsAction\";\nimport {\n IUserDirectorySearchFromWidgetRequestData,\n IUserDirectorySearchFromWidgetResponseData,\n} from \"./interfaces/UserDirectorySearchAction\";\nimport {\n IGetMediaConfigActionFromWidgetRequestData,\n IGetMediaConfigActionFromWidgetResponseData,\n} from \"./interfaces/GetMediaConfigAction\";\nimport {\n IUploadFileActionFromWidgetRequestData,\n IUploadFileActionFromWidgetResponseData,\n} from \"./interfaces/UploadFileAction\";\nimport {\n IDownloadFileActionFromWidgetRequestData,\n IDownloadFileActionFromWidgetResponseData,\n} from \"./interfaces/DownloadFileAction\";\nimport {\n IUpdateDelayedEventFromWidgetRequestData,\n IUpdateDelayedEventFromWidgetResponseData,\n UpdateDelayedEventAction,\n} from \"./interfaces/UpdateDelayedEventAction\";\n\nexport class WidgetApiResponseError extends Error {\n static {\n this.prototype.name = this.name;\n }\n\n public constructor(\n message: string,\n public readonly data: IWidgetApiErrorResponseDataDetails,\n ) {\n super(message);\n }\n}\n\n/**\n * API handler for widgets. This raises events for each action\n * received as `action:${action}` (eg: \"action:screenshot\").\n * Default handling can be prevented by using preventDefault()\n * on the raised event. The default handling varies for each\n * action: ones which the SDK can handle safely are acknowledged\n * appropriately and ones which are unhandled (custom or require\n * the widget to do something) are rejected with an error.\n *\n * Events which are preventDefault()ed must reply using the\n * transport. The events raised will have a detail of an\n * IWidgetApiRequest interface.\n *\n * When the WidgetApi is ready to start sending requests, it will\n * raise a \"ready\" CustomEvent. After the ready event fires, actions\n * can be sent and the transport will be ready.\n */\nexport class WidgetApi extends EventEmitter {\n public readonly transport: ITransport;\n\n private capabilitiesFinished = false;\n private supportsMSC2974Renegotiate = false;\n private readonly requestedCapabilities: Capability[] = [];\n private approvedCapabilities?: Capability[];\n private cachedClientVersions?: ApiVersion[];\n private turnServerWatchers = 0;\n\n /**\n * Creates a new API handler for the given widget.\n * @param {string} widgetId The widget ID to listen for. If not supplied then\n * the API will use the widget ID from the first valid request it receives.\n * @param {string} clientOrigin The origin of the client, or null if not known.\n */\n public constructor(widgetId: string | null = null, clientOrigin: string | null = null) {\n super();\n if (!globalThis.parent) {\n throw new Error(\"No parent window. This widget doesn't appear to be embedded properly.\");\n }\n this.transport = new PostmessageTransport(\n WidgetApiDirection.FromWidget,\n widgetId,\n globalThis.parent,\n globalThis,\n );\n this.transport.targetOrigin = clientOrigin;\n this.transport.on(\"message\", this.handleMessage.bind(this));\n }\n\n /**\n * Determines if the widget was granted a particular capability. Note that on\n * clients where the capabilities are not fed back to the widget this function\n * will rely on requested capabilities instead.\n * @param {Capability} capability The capability to check for approval of.\n * @returns {boolean} True if the widget has approval for the given capability.\n */\n public hasCapability(capability: Capability): boolean {\n if (Array.isArray(this.approvedCapabilities)) {\n return this.approvedCapabilities.includes(capability);\n }\n return this.requestedCapabilities.includes(capability);\n }\n\n /**\n * Request a capability from the client. It is not guaranteed to be allowed,\n * but will be asked for.\n * @param {Capability} capability The capability to request.\n * @throws Throws if the capabilities negotiation has already started and the\n * widget is unable to request additional capabilities.\n */\n public requestCapability(capability: Capability): void {\n if (this.capabilitiesFinished && !this.supportsMSC2974Renegotiate) {\n throw new Error(\"Capabilities have already been negotiated\");\n }\n\n this.requestedCapabilities.push(capability);\n }\n\n /**\n * Request capabilities from the client. They are not guaranteed to be allowed,\n * but will be asked for if the negotiation has not already happened.\n * @param {Capability[]} capabilities The capabilities to request.\n * @throws Throws if the capabilities negotiation has already started.\n */\n public requestCapabilities(capabilities: Capability[]): void {\n for (const cap of capabilities) {\n this.requestCapability(cap);\n }\n }\n\n /**\n * Requests the capability to interact with rooms other than the user's currently\n * viewed room. Applies to event receiving and sending.\n * @param {string | Symbols.AnyRoom} roomId The room ID, or `Symbols.AnyRoom` to\n * denote all known rooms.\n */\n public requestCapabilityForRoomTimeline(roomId: string | Symbols.AnyRoom): void {\n this.requestCapability(`org.matrix.msc2762.timeline:${roomId}`);\n }\n\n /**\n * Requests the capability to send a given state event with optional explicit\n * state key. It is not guaranteed to be allowed, but will be asked for if the\n * negotiation has not already happened.\n * @param {string} eventType The state event type to ask for.\n * @param {string} stateKey If specified, the specific state key to request.\n * Otherwise all state keys will be requested.\n */\n public requestCapabilityToSendState(eventType: string, stateKey?: string): void {\n this.requestCapability(WidgetEventCapability.forStateEvent(EventDirection.Send, eventType, stateKey).raw);\n }\n\n /**\n * Requests the capability to receive a given state event with optional explicit\n * state key. It is not guaranteed to be allowed, but will be asked for if the\n * negotiation has not already happened.\n * @param {string} eventType The state event type to ask for.\n * @param {string} stateKey If specified, the specific state key to request.\n * Otherwise all state keys will be requested.\n */\n public requestCapabilityToReceiveState(eventType: string, stateKey?: string): void {\n this.requestCapability(WidgetEventCapability.forStateEvent(EventDirection.Receive, eventType, stateKey).raw);\n }\n\n /**\n * Requests the capability to send a given to-device event. It is not\n * guaranteed to be allowed, but will be asked for if the negotiation has\n * not already happened.\n * @param {string} eventType The room event type to ask for.\n */\n public requestCapabilityToSendToDevice(eventType: string): void {\n this.requestCapability(WidgetEventCapability.forToDeviceEvent(EventDirection.Send, eventType).raw);\n }\n\n /**\n * Requests the capability to receive a given to-device event. It is not\n * guaranteed to be allowed, but will be asked for if the negotiation has\n * not already happened.\n * @param {string} eventType The room event type to ask for.\n */\n public requestCapabilityToReceiveToDevice(eventType: string): void {\n this.requestCapability(WidgetEventCapability.forToDeviceEvent(EventDirection.Receive, eventType).raw);\n }\n\n /**\n * Requests the capability to send a given room event. It is not guaranteed to be\n * allowed, but will be asked for if the negotiation has not already happened.\n * @param {string} eventType The room event type to ask for.\n */\n public requestCapabilityToSendEvent(eventType: string): void {\n this.requestCapability(WidgetEventCapability.forRoomEvent(EventDirection.Send, eventType).raw);\n }\n\n /**\n * Requests the capability to receive a given room event. It is not guaranteed to be\n * allowed, but will be asked for if the negotiation has not already happened.\n * @param {string} eventType The room event type to ask for.\n */\n public requestCapabilityToReceiveEvent(eventType: string): void {\n this.requestCapability(WidgetEventCapability.forRoomEvent(EventDirection.Receive, eventType).raw);\n }\n\n /**\n * Requests the capability to send a given message event with optional explicit\n * `msgtype`. It is not guaranteed to be allowed, but will be asked for if the\n * negotiation has not already happened.\n * @param {string} msgtype If specified, the specific msgtype to request.\n * Otherwise all message types will be requested.\n */\n public requestCapabilityToSendMessage(msgtype?: string): void {\n this.requestCapability(WidgetEventCapability.forRoomMessageEvent(EventDirection.Send, msgtype).raw);\n }\n\n /**\n * Requests the capability to receive a given message event with optional explicit\n * `msgtype`. It is not guaranteed to be allowed, but will be asked for if the\n * negotiation has not already happened.\n * @param {string} msgtype If specified, the specific msgtype to request.\n * Otherwise all message types will be requested.\n */\n public requestCapabilityToReceiveMessage(msgtype?: string): void {\n this.requestCapability(WidgetEventCapability.forRoomMessageEvent(EventDirection.Receive, msgtype).raw);\n }\n\n /**\n * Requests the capability to receive a given item in room account data. It is not guaranteed to be\n * allowed, but will be asked for if the negotiation has not already happened.\n * @param {string} eventType The state event type to ask for.\n */\n public requestCapabilityToReceiveRoomAccountData(eventType: string): void {\n this.requestCapability(WidgetEventCapability.forRoomAccountData(EventDirection.Receive, eventType).raw);\n }\n\n /**\n * Requests an OpenID Connect token from the client for the currently logged in\n * user. This token can be validated server-side with the federation API. Note\n * that the widget is responsible for validating the token and caching any results\n * it needs.\n * @returns {Promise<IOpenIDCredentials>} Resolves to a token for verification.\n * @throws Throws if the user rejected the request or the request failed.\n */\n public requestOpenIDConnectToken(): Promise<IOpenIDCredentials> {\n return new Promise<IOpenIDCredentials>((resolve, reject) => {\n this.transport\n .sendComplete<IGetOpenIDActionRequestData, IGetOpenIDActionResponse>(\n WidgetApiFromWidgetAction.GetOpenIDCredentials,\n {},\n )\n .then((response) => {\n const rdata = response.response;\n if (rdata.state === OpenIDRequestState.Allowed) {\n resolve(rdata);\n } else if (rdata.state === OpenIDRequestState.Blocked) {\n reject(new Error(\"User declined to verify their identity\"));\n } else if (rdata.state === OpenIDRequestState.PendingUserConfirmation) {\n const handlerFn = (ev: CustomEvent<IOpenIDCredentialsActionRequest>): void => {\n ev.preventDefault();\n const request = ev.detail;\n if (request.data.original_request_id !== response.requestId) return;\n if (request.data.state === OpenIDRequestState.Allowed) {\n resolve(request.data);\n this.transport.reply(request, <IWidgetApiRequestEmptyData>{}); // ack\n } else if (request.data.state === OpenIDRequestState.Blocked) {\n reject(new Error(\"User declined to verify their identity\"));\n this.transport.reply(request, <IWidgetApiRequestEmptyData>{}); // ack\n } else {\n reject(new Error(\"Invalid state on reply: \" + rdata.state));\n this.transport.reply(request, <IWidgetApiErrorResponseData>{\n error: {\n message: \"Invalid state\",\n },\n });\n }\n this.off(`action:${WidgetApiToWidgetAction.OpenIDCredentials}`, handlerFn);\n };\n this.on(`action:${WidgetApiToWidgetAction.OpenIDCredentials}`, handlerFn);\n } else {\n reject(new Error(\"Invalid state: \" + rdata.state));\n }\n })\n .catch(reject);\n });\n }\n\n /**\n * Asks the client for additional capabilities. Capabilities can be queued for this\n * request with the requestCapability() functions.\n * @returns {Promise<void>} Resolves when complete. Note that the promise resolves when\n * the capabilities request has gone through, not when the capabilities are approved/denied.\n * Use the WidgetApiToWidgetAction.NotifyCapabilities action to detect changes.\n */\n public updateRequestedCapabilities(): Promise<void> {\n return this.transport\n .send(WidgetApiFromWidgetAction.MSC2974RenegotiateCapabilities, <IRenegotiateCapabilitiesRequestData>{\n capabilities: this.requestedCapabilities,\n })\n .then();\n }\n\n /**\n * Tell the client that the content has been loaded.\n * @returns {Promise} Resolves when the client acknowledges the request.\n */\n public sendContentLoaded(): Promise<void> {\n return this.transport.send(WidgetApiFromWidgetAction.ContentLoaded, <IWidgetApiRequestEmptyData>{}).then();\n }\n\n /**\n * Sends a sticker to the client.\n * @param {IStickerActionRequestData} sticker The sticker to send.\n * @returns {Promise} Resolves when the client acknowledges the request.\n */\n public sendSticker(sticker: IStickerActionRequestData): Promise<void> {\n return this.transport.send(WidgetApiFromWidgetAction.SendSticker, sticker).then();\n }\n\n /**\n * Asks the client to set the always-on-screen status for this widget.\n * @param {boolean} value The new state to request.\n * @returns {Promise<boolean>} Resolve with true if the client was able to fulfill\n * the request, resolves to false otherwise. Rejects if an error occurred.\n */\n public setAlwaysOnScreen(value: boolean): Promise<boolean> {\n return this.transport\n .send<\n IStickyActionRequestData,\n IStickyActionResponseData\n >(WidgetApiFromWidgetAction.UpdateAlwaysOnScreen, { value })\n .then((res) => res.success);\n }\n\n /**\n * Opens a modal widget.\n * @param {string} url The URL to the modal widget.\n * @param {string} name The name of the widget.\n * @param {IModalWidgetOpenRequestDataButton[]} buttons The buttons to have on the widget.\n * @param {IModalWidgetCreateData} data Data to supply to the modal widget.\n * @param {WidgetType} type The type of modal widget.\n * @returns {Promise<void>} Resolves when the modal widget has been opened.\n */\n public openModalWidget(\n url: string,\n name: string,\n buttons: IModalWidgetOpenRequestDataButton[] = [],\n data: IModalWidgetCreateData = {},\n type: WidgetType = MatrixWidgetType.Custom,\n ): Promise<void> {\n return this.transport\n .send<IModalWidgetOpenRequestData>(WidgetApiFromWidgetAction.OpenModalWidget, {\n type,\n url,\n name,\n buttons,\n data,\n })\n .then();\n }\n\n /**\n * Closes the modal widget. The widget's session will be terminated shortly after.\n * @param {IModalWidgetReturnData} data Optional data to close the modal widget with.\n * @returns {Promise<void>} Resolves when complete.\n */\n public closeModalWidget(data: IModalWidgetReturnData = {}): Promise<void> {\n return this.transport.send<IModalWidgetReturnData>(WidgetApiFromWidgetAction.CloseModalWidget, data).then();\n }\n\n public sendRoomEvent(\n eventType: string,\n content: unknown,\n roomId?: string,\n delay?: number,\n parentDelayId?: string,\n stickyDurationMs?: number,\n ): Promise<ISendEventFromWidgetResponseData> {\n return this.sendEvent(eventType, undefined, content, roomId, delay, parentDelayId, stickyDurationMs);\n }\n\n public sendStateEvent(\n eventType: string,\n stateKey: string,\n content: unknown,\n roomId?: string,\n delay?: number,\n parentDelayId?: string,\n ): Promise<ISendEventFromWidgetResponseData> {\n return this.sendEvent(eventType, stateKey, content, roomId, delay, parentDelayId);\n }\n\n private sendEvent(\n eventType: string,\n stateKey: string | undefined,\n content: unknown,\n roomId?: string,\n delay?: number,\n parentDelayId?: string,\n stickyDurationMs?: number,\n ): Promise<ISendEventFromWidgetResponseData> {\n return this.transport.send<ISendEventFromWidgetRequestData, ISendEventFromWidgetResponseData>(\n WidgetApiFromWidgetAction.SendEvent,\n {\n type: eventType,\n content,\n ...(stateKey !== undefined && { state_key: stateKey }),\n ...(roomId !== undefined && { room_id: roomId }),\n ...(delay !== undefined && { delay }),\n ...(parentDelayId !== undefined && { parent_delay_id: parentDelayId }),\n ...(stickyDurationMs !== undefined && { sticky_duration_ms: stickyDurationMs }),\n },\n );\n }\n\n /**\n * @experimental This currently relies on an unstable MSC (MSC4157).\n */\n public cancelScheduledDelayedEvent(delayId: string): Promise<IUpdateDelayedEventFromWidgetResponseData> {\n return this.transport.send<IUpdateDelayedEventFromWidgetRequestData, IUpdateDelayedEventFromWidgetResponseData>(\n WidgetApiFromWidgetAction.MSC4157UpdateDelayedEvent,\n {\n delay_id: delayId,\n action: UpdateDelayedEventAction.Cancel,\n },\n );\n }\n\n /**\n * @experimental This currently relies on an unstable MSC (MSC4157).\n */\n public restartScheduledDelayedEvent(delayId: string): Promise<IUpdateDelayedEventFromWidgetResponseData> {\n return this.transport.send<IUpdateDelayedEventFromWidgetRequestData, IUpdateDelayedEventFromWidgetResponseData>(\n WidgetApiFromWidgetAction.MSC4157UpdateDelayedEvent,\n {\n delay_id: delayId,\n action: UpdateDelayedEventAction.Restart,\n },\n );\n }\n\n /**\n * @experimental This currently relies on an unstable MSC (MSC4157).\n */\n public sendScheduledDelayedEvent(delayId: string): Promise<IUpdateDelayedEventFromWidgetResponseData> {\n return this.transport.send<IUpdateDelayedEventFromWidgetRequestData, IUpdateDelayedEventFromWidgetResponseData>(\n WidgetApiFromWidgetAction.MSC4157UpdateDelayedEvent,\n {\n delay_id: delayId,\n action: UpdateDelayedEventAction.Send,\n },\n );\n }\n\n /**\n * Sends a to-device event.\n * @param {string} eventType The type of events being sent.\n * @param {boolean} encrypted Whether to encrypt the message contents.\n * @param {Object} contentMap A map from user IDs to device IDs to message contents.\n * @returns {Promise<ISendToDeviceFromWidgetResponseData>} Resolves when complete.\n */\n public sendToDevice(\n eventType: string,\n encrypted: boolean,\n contentMap: { [userId: string]: { [deviceId: string]: object } },\n ): Promise<ISendToDeviceFromWidgetResponseData> {\n return this.transport.send<ISendToDeviceFromWidgetRequestData, ISendToDeviceFromWidgetResponseData>(\n WidgetApiFromWidgetAction.SendToDevice,\n { type: eventType, encrypted, messages: contentMap },\n );\n }\n\n public readRoomAccountData(eventType: string, roomIds?: (string | Symbols.AnyRoom)[]): Promise<IRoomAccountData[]> {\n const data: IReadEventFromWidgetRequestData = { type: eventType };\n\n if (roomIds) {\n if (roomIds.includes(Symbols.AnyRoom)) {\n data.room_ids = Symbols.AnyRoom;\n } else {\n data.room_ids = roomIds;\n }\n }\n return this.transport\n .send<\n IReadRoomAccountDataFromWidgetRequestData,\n IReadRoomAccountDataFromWidgetResponseData\n >(WidgetApiFromWidgetAction.BeeperReadRoomAccountData, data)\n .then((r) => r.events);\n }\n\n public readRoomEvents(\n eventType: string,\n limit?: number,\n msgtype?: string,\n roomIds?: (string | Symbols.AnyRoom)[],\n since?: string | undefined,\n ): Promise<IRoomEvent[]> {\n const data: IReadEventFromWidgetRequestData = { type: eventType, msgtype: msgtype };\n if (limit !== undefined) {\n data.limit = limit;\n }\n if (roomIds) {\n if (roomIds.includes(Symbols.AnyRoom)) {\n data.room_ids = Symbols.AnyRoom;\n } else {\n data.room_ids = roomIds;\n }\n }\n if (since) {\n data.since = since;\n }\n return this.transport\n .send<\n IReadEventFromWidgetRequestData,\n IReadEventFromWidgetResponseData\n >(WidgetApiFromWidgetAction.MSC2876ReadEvents, data)\n .then((r) => r.events);\n }\n\n /**\n * Reads all related events given a known eventId.\n * @param eventId The id of the parent event to be read.\n * @param roomId The room to look within. When undefined, the user's currently\n * viewed room.\n * @param relationType The relationship type of child events to search for.\n * When undefined, all relations are returned.\n * @param eventType The event type of child events to search for. When undefined,\n * all related events are returned.\n * @param limit The maximum number of events to retrieve per room. If not\n * supplied, the server will apply a default limit.\n * @param from The pagination token to start returning results from, as\n * received from a previous call. If not supplied, results start at the most\n * recent topological event known to the server.\n * @param to The pagination token to stop returning results at. If not\n * supplied, results continue up to limit or until there are no more events.\n * @param direction The direction to search for according to MSC3715.\n * @returns Resolves to the room relations.\n */\n public async readEventRelations(\n eventId: string,\n roomId?: string,\n relationType?: string,\n eventType?: string,\n limit?: number,\n from?: string,\n to?: string,\n direction?: \"f\" | \"b\",\n ): Promise<IReadRelationsFromWidgetResponseData> {\n const versions = await this.getClientVersions();\n if (!versions.includes(UnstableApiVersion.MSC3869)) {\n throw new Error(\"The read_relations action is not supported by the client.\");\n }\n\n const data: IReadRelationsFromWidgetRequestData = {\n event_id: eventId,\n rel_type: relationType,\n event_type: eventType,\n room_id: roomId,\n to,\n from,\n limit,\n direction,\n };\n\n return this.transport.send<IReadRelationsFromWidgetRequestData, IReadRelationsFromWidgetResponseData>(\n WidgetApiFromWidgetAction.MSC3869ReadRelations,\n data,\n );\n }\n\n public readStateEvents(\n eventType: string,\n limit?: number,\n stateKey?: string,\n roomIds?: (string | Symbols.AnyRoom)[],\n ): Promise<IRoomEvent[]> {\n const data: IReadEventFromWidgetRequestData = {\n type: eventType,\n state_key: stateKey === undefined ? true : stateKey,\n };\n if (limit !== undefined) {\n data.limit = limit;\n }\n if (roomIds) {\n if (roomIds.includes(Symbols.AnyRoom)) {\n data.room_ids = Symbols.AnyRoom;\n } else {\n data.room_ids = roomIds;\n }\n }\n return this.transport\n .send<\n IReadEventFromWidgetRequestData,\n IReadEventFromWidgetResponseData\n >(WidgetApiFromWidgetAction.MSC2876ReadEvents, data)\n .then((r) => r.events);\n }\n\n /**\n * Sets a button as disabled or enabled on the modal widget. Buttons are enabled by default.\n * @param {ModalButtonID} buttonId The button ID to enable/disable.\n * @param {boolean} isEnabled Whether or not the button is enabled.\n * @returns {Promise<void>} Resolves when complete.\n * @throws Throws if the button cannot be disabled, or the client refuses to disable the button.\n */\n public setModalButtonEnabled(buttonId: ModalButtonID, isEnabled: boolean): Promise<void> {\n if (buttonId === BuiltInModalButtonID.Close) {\n throw new Error(\"The close button cannot be disabled\");\n }\n return this.transport\n .send<ISetModalButtonEnabledActionRequestData>(WidgetApiFromWidgetAction.SetModalButtonEnabled, {\n button: buttonId,\n enabled: isEnabled,\n })\n .then();\n }\n\n /**\n * Attempts to navigate the client to the given URI. This can only be called with Matrix URIs\n * (currently only matrix.to, but in future a Matrix URI scheme will be defined).\n * @param {string} uri The URI to navigate to.\n * @returns {Promise<void>} Resolves when complete.\n * @throws Throws if the URI is invalid or cannot be processed.\n * @experimental This currently relies on an unstable MSC (MSC2931).\n */\n public navigateTo(uri: string): Promise<void> {\n if (!uri || !uri.startsWith(\"https://matrix.to/#\")) {\n throw new Error(\"Invalid matrix.to URI\");\n }\n\n return this.transport\n .send<INavigateActionRequestData>(WidgetApiFromWidgetAction.MSC2931Navigate, { uri })\n .then();\n }\n\n /**\n * Starts watching for TURN servers, yielding an initial set of credentials as soon as possible,\n * and thereafter yielding new credentials whenever the previous ones expire.\n * @yields {ITurnServer} The TURN server URIs and credentials currently available to the widget.\n */\n public async *getTurnServers(): AsyncGenerator<ITurnServer> {\n let setTurnServer: (server: ITurnServer) => void;\n\n const onUpdateTurnServers = async (ev: CustomEvent<IUpdateTurnServersRequest>): Promise<void> => {\n ev.preventDefault();\n setTurnServer(ev.detail.data);\n this.transport.reply<IWidgetApiAcknowledgeResponseData>(ev.detail, {});\n };\n\n // Start listening for updates before we even start watching, to catch\n // TURN data that is sent immediately\n this.on(`action:${WidgetApiToWidgetAction.UpdateTurnServers}`, onUpdateTurnServers);\n\n // Only send the 'watch' action if we aren't already watching\n if (this.turnServerWatchers === 0) {\n try {\n await this.transport.send<IWidgetApiRequestEmptyData>(WidgetApiFromWidgetAction.WatchTurnServers, {});\n } catch (e) {\n this.off(`action:${WidgetApiToWidgetAction.UpdateTurnServers}`, onUpdateTurnServers);\n throw e;\n }\n }\n this.turnServerWatchers++;\n\n try {\n // Watch for new data indefinitely (until this generator's return method is called)\n while (true) {\n yield await new Promise<ITurnServer>((resolve) => (setTurnServer = resolve));\n }\n } finally {\n // The loop was broken by the caller - clean up\n this.off(`action:${WidgetApiToWidgetAction.UpdateTurnServers}`, onUpdateTurnServers);\n\n // Since sending the 'unwatch' action will end updates for all other\n // consumers, only send it if we're the only consumer remaining\n this.turnServerWatchers--;\n if (this.turnServerWatchers === 0) {\n await this.transport.send<IWidgetApiRequestEmptyData>(WidgetApiFromWidgetAction.UnwatchTurnServers, {});\n }\n }\n }\n\n /**\n * Search for users in the user directory.\n * @param searchTerm The term to search for.\n * @param limit The maximum number of results to return. If not supplied, the\n * @returns Resolves to the search results.\n */\n public async searchUserDirectory(\n searchTerm: string,\n limit?: number,\n ): Promise<IUserDirectorySearchFromWidgetResponseData> {\n const versions = await this.getClientVersions();\n if (!versions.includes(UnstableApiVersion.MSC3973)) {\n throw new Error(\"The user_directory_search action is not supported by the client.\");\n }\n\n const data: IUserDirectorySearchFromWidgetRequestData = {\n search_term: searchTerm,\n limit,\n };\n\n return this.transport.send<\n IUserDirectorySearchFromWidgetRequestData,\n IUserDirectorySearchFromWidgetResponseData\n >(WidgetApiFromWidgetAction.MSC3973UserDirectorySearch, data);\n }\n\n /**\n * Get the config for the media repository.\n * @returns Promise which resolves with an object containing the config.\n */\n public async getMediaConfig(): Promise<IGetMediaConfigActionFromWidgetResponseData> {\n const versions = await this.getClientVersions();\n if (!versions.includes(UnstableApiVersion.MSC4039)) {\n throw new Error(\"The get_media_config action is not supported by the client.\");\n }\n\n const data: IGetMediaConfigActionFromWidgetRequestData = {};\n\n return this.transport.send<\n IGetMediaConfigActionFromWidgetRequestData,\n IGetMediaConfigActionFromWidgetResponseData\n >(WidgetApiFromWidgetAction.MSC4039GetMediaConfigAction, data);\n }\n\n /**\n * Upload a file to the media repository on the homeserver.\n * @param file - The object to upload. Something that can be sent to\n * XMLHttpRequest.send (typically a File).\n * @returns Resolves to the location of the uploaded file.\n */\n public async uploadFile(file: XMLHttpRequestBodyInit): Promise<IUploadFileActionFromWidgetResponseData> {\n const versions = await this.getClientVersions();\n if (!versions.includes(UnstableApiVersion.MSC4039)) {\n throw new Error(\"The upload_file action is not supported by the client.\");\n }\n\n const data: IUploadFileActionFromWidgetRequestData = {\n file,\n };\n\n return this.transport.send<IUploadFileActionFromWidgetRequestData, IUploadFileActionFromWidgetResponseData>(\n WidgetApiFromWidgetAction.MSC4039UploadFileAction,\n data,\n );\n }\n\n /**\n * Download a file from the media repository on the homeserver.\n * @param contentUri - MXC URI of the file to download.\n * @returns Resolves to the contents of the file.\n */\n public async downloadFile(contentUri: string): Promise<IDownloadFileActionFromWidgetResponseData> {\n const versions = await this.getClientVersions();\n if (!versions.includes(UnstableApiVersion.MSC4039)) {\n throw new Error(\"The download_file action is not supported by the client.\");\n }\n\n const data: IDownloadFileActionFromWidgetRequestData = {\n content_uri: contentUri,\n };\n\n return this.transport.send<IDownloadFileActionFromWidgetRequestData, IDownloadFileActionFromWidgetResponseData>(\n WidgetApiFromWidgetAction.MSC4039DownloadFileAction,\n data,\n );\n }\n\n /**\n * Starts the communication channel. This should be done early to ensure\n * that messages are not missed. Communication can only be stopped by the client.\n */\n public start(): void {\n this.transport.start();\n this.getClientVersions().then((v) => {\n if (v.includes(UnstableApiVersion.MSC2974)) {\n this.supportsMSC2974Renegotiate = true;\n }\n });\n }\n\n private handleMessage(ev: CustomEvent<IWidgetApiRequest>): void | Promise<void> {\n const actionEv = new CustomEvent(`action:${ev.detail.action}`, {\n detail: ev.detail,\n cancelable: true,\n });\n this.emit(`action:${ev.detail.action}`, actionEv);\n if (!actionEv.defaultPrevented) {\n switch (ev.detail.action) {\n case WidgetApiToWidgetAction.SupportedApiVersions:\n return this.replyVersions(<ISupportedVersionsActionRequest>ev.detail);\n case WidgetApiToWidgetAction.Capabilities:\n return this.handleCapabilities(<ICapabilitiesActionRequest>ev.detail);\n case WidgetApiToWidgetAction.UpdateVisibility:\n return this.transport.reply(ev.detail, <IWidgetApiRequestEmptyData>{}); // ack to avoid error spam\n case WidgetApiToWidgetAction.NotifyCapabilities:\n return this.transport.reply(ev.detail, <IWidgetApiRequestEmptyData>{}); // ack to avoid error spam\n default:\n return this.transport.reply(ev.detail, <IWidgetApiErrorResponseData>{\n error: {\n message: \"Unknown or unsupported to-widget action: \" + ev.detail.action,\n },\n });\n }\n }\n }\n\n private replyVersions(request: ISupportedVersionsActionRequest): void {\n this.transport.reply<ISupportedVersionsActionResponseData>(request, {\n supported_versions: CurrentApiVersions,\n });\n }\n\n public getClientVersions(): Promise<ApiVersion[]> {\n if (Array.isArray(this.cachedClientVersions)) {\n return Promise.resolve(this.cachedClientVersions);\n }\n\n return this.transport\n .send<IWidgetApiRequestEmptyData, ISupportedVersionsActionResponseData>(\n WidgetApiFromWidgetAction.SupportedApiVersions,\n {},\n )\n .then((r) => {\n this.cachedClientVersions = r.supported_versions;\n return r.supported_versions;\n })\n .catch((e) => {\n console.warn(\"non-fatal error getting supported client versions: \", e);\n return [];\n });\n }\n\n private handleCapabilities(request: ICapabilitiesActionRequest): void | Promise<void> {\n if (this.capabilitiesFinished) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: {\n message: \"Capability negotiation already completed\",\n },\n });\n }\n\n // See if we can expect a capabilities notification or not\n return this.getClientVersions().then((v) => {\n if (v.includes(UnstableApiVersion.MSC2871)) {\n this.once(\n `action:${WidgetApiToWidgetAction.NotifyCapabilities}`,\n (ev: CustomEvent<INotifyCapabilitiesActionRequest>) => {\n this.approvedCapabilities = ev.detail.data.approved;\n this.emit(\"ready\");\n },\n );\n } else {\n // if we can't expect notification, we're as done as we can be\n this.emit(\"ready\");\n }\n\n // in either case, reply to that capabilities request\n this.capabilitiesFinished = true;\n return this.transport.reply<ICapabilitiesActionResponseData>(request, {\n capabilities: this.requestedCapabilities,\n });\n });\n }\n}\n", "/*\n * Copyright 2020 - 2021 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Symbols } from \"../Symbols\";\n\nexport enum MatrixCapabilities {\n Screenshots = \"m.capability.screenshot\",\n StickerSending = \"m.sticker\",\n AlwaysOnScreen = \"m.always_on_screen\",\n /**\n * @deprecated It is not recommended to rely on this existing - it can be removed without notice.\n * Ask Element to not give the option to move the widget into a separate tab.\n */\n RequiresClient = \"io.element.requires_client\",\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC2931Navigate = \"org.matrix.msc2931.navigate\",\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC3846TurnServers = \"town.robin.msc3846.turn_servers\",\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC3973UserDirectorySearch = \"org.matrix.msc3973.user_directory_search\",\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC4039UploadFile = \"org.matrix.msc4039.upload_file\",\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC4039DownloadFile = \"org.matrix.msc4039.download_file\",\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC4157SendDelayedEvent = \"org.matrix.msc4157.send.delayed_event\",\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC4157UpdateDelayedEvent = \"org.matrix.msc4157.update_delayed_event\",\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC4407SendStickyEvent = \"org.matrix.msc4407.send.sticky_event\",\n /**\n * @experimental It is not recommended to rely on this existing - it can be removed without notice.\n */\n MSC4407ReceiveStickyEvent = \"org.matrix.msc4407.receive.sticky_event\",\n}\n\nexport type Capability = MatrixCapabilities | string;\n\nexport const StickerpickerCapabilities: Capability[] = [MatrixCapabilities.StickerSending];\nexport const VideoConferenceCapabilities: Capability[] = [MatrixCapabilities.AlwaysOnScreen];\n\n/**\n * Determines if a capability is a capability for a timeline.\n * @param {Capability} capability The capability to test.\n * @returns {boolean} True if a timeline capability, false otherwise.\n */\nexport function isTimelineCapability(capability: Capability): boolean {\n // TODO: Change when MSC2762 becomes stable.\n return capability?.startsWith(\"org.matrix.msc2762.timeline:\");\n}\n\n/**\n * Determines if a capability is a timeline capability for the given room.\n * @param {Capability} capability The capability to test.\n * @param {string | Symbols.AnyRoom} roomId The room ID, or `Symbols.AnyRoom` for that designation.\n * @returns {boolean} True if a matching capability, false otherwise.\n */\nexport function isTimelineCapabilityFor(capability: Capability, roomId: string | Symbols.AnyRoom): boolean {\n return capability === `org.matrix.msc2762.timeline:${roomId}`;\n}\n\n/**\n * Gets the room ID described by a timeline capability.\n * @param {string} capability The capability to parse.\n * @returns {string} The room ID.\n */\nexport function getTimelineRoomIDFromCapability(capability: Capability): string {\n return capability.substring(capability.indexOf(\":\") + 1);\n}\n", "/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type ObservableFunction<T> = (val: T) => void;\n\nexport class SimpleObservable<T> {\n private listeners: ObservableFunction<T>[] = [];\n\n public constructor(initialFn?: ObservableFunction<T>) {\n if (initialFn) this.listeners.push(initialFn);\n }\n\n public onUpdate(fn: ObservableFunction<T>): void {\n this.listeners.push(fn);\n }\n\n public update(val: T): void {\n for (const listener of this.listeners) {\n listener(val);\n }\n }\n\n public close(): void {\n this.listeners = []; // reset\n }\n}\n", "/*\n * Copyright 2020 - 2024 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { EventEmitter } from \"events\";\n\nimport { ITransport } from \"./transport/ITransport\";\nimport { Widget } from \"./models/Widget\";\nimport { PostmessageTransport } from \"./transport/PostmessageTransport\";\nimport { WidgetApiDirection } from \"./interfaces/WidgetApiDirection\";\nimport { IWidgetApiRequest, IWidgetApiRequestEmptyData } from \"./interfaces/IWidgetApiRequest\";\nimport { IContentLoadedActionRequest } from \"./interfaces/ContentLoadedAction\";\nimport { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from \"./interfaces/WidgetApiAction\";\nimport { IWidgetApiErrorResponseData } from \"./interfaces/IWidgetApiErrorResponse\";\nimport {\n Capability,\n MatrixCapabilities,\n getTimelineRoomIDFromCapability,\n isTimelineCapability,\n} from \"./interfaces/Capabilities\";\nimport { IOpenIDUpdate, ISendEventDetails, ISendDelayedEventDetails, WidgetDriver } from \"./driver/WidgetDriver\";\nimport {\n ICapabilitiesActionResponseData,\n INotifyCapabilitiesActionRequestData,\n IRenegotiateCapabilitiesActionRequest,\n} from \"./interfaces/CapabilitiesAction\";\nimport {\n ISupportedVersionsActionRequest,\n ISupportedVersionsActionResponseData,\n} from \"./interfaces/SupportedVersionsAction\";\nimport { ApiVersion, CurrentApiVersions, UnstableApiVersion } from \"./interfaces/ApiVersion\";\nimport { IScreenshotActionResponseData } from \"./interfaces/ScreenshotAction\";\nimport { IVisibilityActionRequestData } from \"./interfaces/VisibilityAction\";\nimport { IWidgetApiAcknowledgeResponseData, IWidgetApiResponseData } from \"./interfaces/IWidgetApiResponse\";\nimport {\n IModalWidgetButtonClickedRequestData,\n IModalWidgetOpenRequestData,\n IModalWidgetOpenRequestDataButton,\n IModalWidgetReturnData,\n} from \"./interfaces/ModalWidgetActions\";\nimport {\n ISendEventFromWidgetActionRequest,\n ISendEventFromWidgetResponseData,\n ISendEventToWidgetRequestData,\n} from \"./interfaces/SendEventAction\";\nimport {\n ISendToDeviceFromWidgetActionRequest,\n ISendToDeviceFromWidgetResponseData,\n ISendToDeviceToWidgetRequestData,\n} from \"./interfaces/SendToDeviceAction\";\nimport { EventDirection, EventKind, WidgetEventCapability } from \"./models/WidgetEventCapability\";\nimport { IRoomEvent } from \"./interfaces/IRoomEvent\";\nimport {\n IGetOpenIDActionRequest,\n IGetOpenIDActionResponseData,\n IOpenIDCredentials,\n OpenIDRequestState,\n} from \"./interfaces/GetOpenIDAction\";\nimport { SimpleObservable } from \"./util/SimpleObservable\";\nimport { IOpenIDCredentialsActionRequestData } from \"./interfaces/OpenIDCredentialsAction\";\nimport { INavigateActionRequest } from \"./interfaces/NavigateAction\";\nimport { IReadEventFromWidgetActionRequest, IReadEventFromWidgetResponseData } from \"./interfaces/ReadEventAction\";\nimport {\n ITurnServer,\n IWatchTurnServersRequest,\n IUnwatchTurnServersRequest,\n IUpdateTurnServersRequestData,\n} from \"./interfaces/TurnServerActions\";\nimport { Symbols } from \"./Symbols\";\nimport {\n IReadRelationsFromWidgetActionRequest,\n IReadRelationsFromWidgetResponseData,\n} from \"./interfaces/ReadRelationsAction\";\nimport {\n IUserDirectorySearchFromWidgetActionRequest,\n IUserDirectorySearchFromWidgetResponseData,\n} from \"./interfaces/UserDirectorySearchAction\";\nimport {\n IReadRoomAccountDataFromWidgetActionRequest,\n IReadRoomAccountDataFromWidgetResponseData,\n} from \"./interfaces/ReadRoomAccountDataAction\";\nimport {\n IGetMediaConfigActionFromWidgetActionRequest,\n IGetMediaConfigActionFromWidgetResponseData,\n} from \"./interfaces/GetMediaConfigAction\";\nimport {\n IUpdateDelayedEventFromWidgetActionRequest,\n UpdateDelayedEventAction,\n} from \"./interfaces/UpdateDelayedEventAction\";\nimport {\n IUploadFileActionFromWidgetActionRequest,\n IUploadFileActionFromWidgetResponseData,\n} from \"./interfaces/UploadFileAction\";\nimport {\n IDownloadFileActionFromWidgetActionRequest,\n IDownloadFileActionFromWidgetResponseData,\n} from \"./interfaces/DownloadFileAction\";\nimport { IThemeChangeActionRequestData } from \"./interfaces/ThemeChangeAction\";\nimport { IUpdateStateToWidgetRequestData } from \"./interfaces/UpdateStateAction\";\nimport { IToDeviceMessage } from \"./interfaces/IToDeviceMessage\";\n\n/**\n * API handler for the client side of widgets. This raises events\n * for each action received as `action:${action}` (eg: \"action:screenshot\").\n * Default handling can be prevented by using preventDefault() on the\n * raised event. The default handling varies for each action: ones\n * which the SDK can handle safely are acknowledged appropriately and\n * ones which are unhandled (custom or require the client to do something)\n * are rejected with an error.\n *\n * Events which are preventDefault()ed must reply using the transport.\n * The events raised will have a default of an IWidgetApiRequest\n * interface.\n *\n * When the ClientWidgetApi is ready to start sending requests, it will\n * raise a \"ready\" CustomEvent. After the ready event fires, actions can\n * be sent and the transport will be ready.\n *\n * When the widget has indicated it has loaded, this class raises a\n * \"preparing\" CustomEvent. The preparing event does not indicate that\n * the widget is ready to receive communications - that is signified by\n * the ready event exclusively.\n *\n * This class only handles one widget at a time.\n */\nexport class ClientWidgetApi extends EventEmitter {\n public readonly transport: ITransport;\n\n private cachedWidgetVersions: ApiVersion[] | null = null;\n // contentLoadedActionSent is used to check that only one ContentLoaded request is send.\n private contentLoadedActionSent = false;\n private readonly allowedCapabilities = new Set<Capability>();\n private readonly allowedEvents: WidgetEventCapability[] = [];\n private isStopped = false;\n private turnServers: AsyncGenerator<ITurnServer> | null = null;\n private contentLoadedWaitTimer?: ReturnType<typeof setTimeout>;\n // Stores pending requests to push a room's state to the widget\n private readonly pushRoomStateTasks = new Set<Promise<void>>();\n // Room ID → event type → state key → events to be pushed\n private readonly pushRoomStateResult = new Map<string, Map<string, Map<string, IRoomEvent>>>();\n private flushRoomStateTask: Promise<void> | null = null;\n\n /**\n * Creates a new client widget API. This will instantiate the transport\n * and start everything. When the iframe is loaded under the widget's\n * conditions, a \"ready\" event will be raised.\n * @param {Widget} widget The widget to communicate with.\n * @param {HTMLIFrameElement} iframe The iframe the widget is in.\n * @param {WidgetDriver} driver The driver for this widget/client.\n */\n public constructor(\n public readonly widget: Widget,\n iframe: HTMLIFrameElement,\n private readonly driver: WidgetDriver,\n ) {\n super();\n if (!iframe?.contentWindow) {\n throw new Error(\"No iframe supplied\");\n }\n if (!widget) {\n throw new Error(\"Invalid widget\");\n }\n if (!driver) {\n throw new Error(\"Invalid driver\");\n }\n this.transport = new PostmessageTransport(\n WidgetApiDirection.ToWidget,\n widget.id,\n iframe.contentWindow,\n globalThis,\n );\n this.transport.targetOrigin = widget.origin;\n this.transport.on(\"message\", this.handleMessage.bind(this));\n\n iframe.addEventListener(\"load\", this.onIframeLoad.bind(this));\n\n this.transport.start();\n }\n\n public hasCapability(capability: Capability): boolean {\n return this.allowedCapabilities.has(capability);\n }\n\n public canUseRoomTimeline(roomId: string | Symbols.AnyRoom): boolean {\n return (\n this.hasCapability(`org.matrix.msc2762.timeline:${Symbols.AnyRoom}`) ||\n this.hasCapability(`org.matrix.msc2762.timeline:${roomId}`)\n );\n }\n\n public canSendRoomEvent(eventType: string, msgtype: string | null = null): boolean {\n return this.allowedEvents.some((e) => e.matchesAsRoomEvent(EventDirection.Send, eventType, msgtype));\n }\n\n public canSendStateEvent(eventType: string, stateKey: string): boolean {\n return this.allowedEvents.some((e) => e.matchesAsStateEvent(EventDirection.Send, eventType, stateKey));\n }\n\n public canSendToDeviceEvent(eventType: string): boolean {\n return this.allowedEvents.some((e) => e.matchesAsToDeviceEvent(EventDirection.Send, eventType));\n }\n\n public canReceiveRoomEvent(eventType: string, msgtype: string | null = null): boolean {\n return this.allowedEvents.some((e) => e.matchesAsRoomEvent(EventDirection.Receive, eventType, msgtype));\n }\n\n public canReceiveStateEvent(eventType: string, stateKey: string | null): boolean {\n return this.allowedEvents.some((e) => e.matchesAsStateEvent(EventDirection.Receive, eventType, stateKey));\n }\n\n public canReceiveToDeviceEvent(eventType: string): boolean {\n return this.allowedEvents.some((e) => e.matchesAsToDeviceEvent(EventDirection.Receive, eventType));\n }\n\n public canReceiveRoomAccountData(eventType: string): boolean {\n return this.allowedEvents.some((e) => e.matchesAsRoomAccountData(EventDirection.Receive, eventType));\n }\n\n public stop(): void {\n this.isStopped = true;\n this.transport.stop();\n }\n\n public async getWidgetVersions(): Promise<ApiVersion[]> {\n if (Array.isArray(this.cachedWidgetVersions)) {\n return this.cachedWidgetVersions;\n }\n\n try {\n const r = await this.transport.send<IWidgetApiRequestEmptyData, ISupportedVersionsActionResponseData>(\n WidgetApiToWidgetAction.SupportedApiVersions,\n {},\n );\n this.cachedWidgetVersions = r.supported_versions;\n return r.supported_versions;\n } catch (e) {\n console.warn(\"non-fatal error getting supported widget versions: \", e);\n return [];\n }\n }\n\n private beginCapabilities(): void {\n // widget has loaded - tell all the listeners that\n this.emit(\"preparing\");\n\n let requestedCaps: Capability[];\n this.transport\n .send<IWidgetApiRequestEmptyData, ICapabilitiesActionResponseData>(WidgetApiToWidgetAction.Capabilities, {})\n .then((caps) => {\n requestedCaps = caps.capabilities;\n return this.driver.validateCapabilities(new Set(caps.capabilities));\n })\n .then((allowedCaps) => {\n this.allowCapabilities([...allowedCaps], requestedCaps);\n this.emit(\"ready\");\n })\n .catch((e) => {\n this.emit(\"error:preparing\", e);\n });\n }\n\n private allowCapabilities(allowed: string[], requested: string[]): void {\n console.log(`Widget ${this.widget.id} is allowed capabilities:`, allowed);\n\n for (const c of allowed) this.allowedCapabilities.add(c);\n const allowedEvents = WidgetEventCapability.findEventCapabilities(allowed);\n this.allowedEvents.push(...allowedEvents);\n\n this.transport\n .send(WidgetApiToWidgetAction.NotifyCapabilities, <INotifyCapabilitiesActionRequestData>{\n requested,\n approved: Array.from(this.allowedCapabilities),\n })\n .catch((e) => {\n console.warn(\"non-fatal error notifying widget of approved capabilities:\", e);\n })\n .then(() => {\n this.emit(\"capabilitiesNotified\");\n });\n\n // Push the initial room state for all rooms with a timeline capability\n for (const c of allowed) {\n if (isTimelineCapability(c)) {\n const roomId = getTimelineRoomIDFromCapability(c);\n if (roomId === Symbols.AnyRoom) {\n for (const roomId of this.driver.getKnownRooms()) {\n this.pushRoomState(roomId);\n }\n } else {\n this.pushRoomState(roomId);\n }\n }\n }\n\n if (allowed.includes(MatrixCapabilities.MSC4407ReceiveStickyEvent)) {\n console.debug(`Widget ${this.widget.id} is allowed to receive sticky events, check current sticky state.`);\n // If the widget can receive sticky events, push all sticky events in known rooms now.\n // Sticky events are like a state, and passed history is needed to get the full state.\n const roomIds = allowed\n .filter((capability) => isTimelineCapability(capability))\n .map((timelineCapability) => getTimelineRoomIDFromCapability(timelineCapability))\n .flatMap((roomIdOrWildcard) => {\n if (roomIdOrWildcard === Symbols.AnyRoom) {\n // Do we support getting sticky state for any room?\n return this.driver.getKnownRooms();\n } else {\n return roomIdOrWildcard;\n }\n });\n console.debug(`Widget ${this.widget.id} is allowed to receive sticky events in rooms:`, roomIds);\n\n for (const roomId of roomIds) {\n this.pushStickyState(roomId).catch((err) => {\n console.error(`Failed to push sticky events to widget ${this.widget.id} for room ${roomId}:`, err);\n });\n }\n }\n\n // If new events are allowed and the currently viewed room isn't covered\n // by a timeline capability, then we know that there could be some state\n // in the viewed room that the widget hasn't learned about yet- push it.\n if (allowedEvents.length > 0 && this.viewedRoomId !== null && !this.canUseRoomTimeline(this.viewedRoomId)) {\n this.pushRoomState(this.viewedRoomId);\n }\n }\n\n private onIframeLoad(ev: Event): void {\n if (this.widget.waitForIframeLoad) {\n // If the widget is set to waitForIframeLoad the capabilities immediately get setup after load.\n // The client does not wait for the ContentLoaded action.\n this.beginCapabilities();\n } else {\n // Reaching this means, that the Iframe got reloaded/loaded and\n // the clientApi is awaiting the FIRST ContentLoaded action.\n console.log(\"waitForIframeLoad is false: waiting for widget to send contentLoaded\");\n this.contentLoadedWaitTimer = setTimeout(() => {\n console.error(\n \"Widget specified waitForIframeLoad=false but timed out waiting for contentLoaded event!\",\n );\n }, 10000);\n this.contentLoadedActionSent = false;\n }\n }\n\n private handleContentLoadedAction(action: IContentLoadedActionRequest): void {\n if (this.contentLoadedWaitTimer !== undefined) {\n clearTimeout(this.contentLoadedWaitTimer);\n this.contentLoadedWaitTimer = undefined;\n }\n if (this.contentLoadedActionSent) {\n throw new Error(\n \"Improper sequence: ContentLoaded Action can only be sent once after the widget loaded \" +\n \"and should only be used if waitForIframeLoad is false (default=true)\",\n );\n }\n if (this.widget.waitForIframeLoad) {\n this.transport.reply(action, <IWidgetApiErrorResponseData>{\n error: {\n message:\n \"Improper sequence: not expecting ContentLoaded event if \" +\n \"waitForIframeLoad is true (default=true)\",\n },\n });\n } else {\n this.transport.reply(action, <IWidgetApiRequestEmptyData>{});\n this.beginCapabilities();\n }\n this.contentLoadedActionSent = true;\n }\n\n private replyVersions(request: ISupportedVersionsActionRequest): void {\n this.transport.reply<ISupportedVersionsActionResponseData>(request, {\n supported_versions: CurrentApiVersions,\n });\n }\n\n private async supportsUpdateState(): Promise<boolean> {\n return (await this.getWidgetVersions()).includes(UnstableApiVersion.MSC2762_UPDATE_STATE);\n }\n\n private handleCapabilitiesRenegotiate(request: IRenegotiateCapabilitiesActionRequest): void {\n // acknowledge first\n this.transport.reply<IWidgetApiAcknowledgeResponseData>(request, {});\n\n const requested = request.data?.capabilities || [];\n const newlyRequested = new Set(requested.filter((r) => !this.hasCapability(r)));\n if (newlyRequested.size === 0) {\n // Nothing to do - skip validation\n this.allowCapabilities([], []);\n }\n\n this.driver\n .validateCapabilities(newlyRequested)\n .then((allowed) => this.allowCapabilities([...allowed], [...newlyRequested]));\n }\n\n private handleNavigate(request: INavigateActionRequest): void {\n if (!this.hasCapability(MatrixCapabilities.MSC2931Navigate)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Missing capability\" },\n });\n }\n\n if (!request.data?.uri.startsWith(\"https://matrix.to/#\")) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Invalid matrix.to URI\" },\n });\n }\n\n const onErr = (e: unknown): void => {\n console.error(\"[ClientWidgetApi] Failed to handle navigation: \", e);\n this.handleDriverError(e, request, \"Error handling navigation\");\n };\n\n try {\n this.driver\n .navigate(request.data.uri.toString())\n .catch((e: unknown) => onErr(e))\n .then(() => {\n return this.transport.reply<IWidgetApiAcknowledgeResponseData>(request, {});\n });\n } catch (e) {\n return onErr(e);\n }\n }\n\n private handleOIDC(request: IGetOpenIDActionRequest): void {\n let phase = 1; // 1 = initial request, 2 = after user manual confirmation\n\n const replyState = (\n state: OpenIDRequestState,\n credential?: IOpenIDCredentials,\n ): void | Promise<IWidgetApiAcknowledgeResponseData> => {\n credential = credential || {};\n if (phase > 1) {\n return this.transport.send<IOpenIDCredentialsActionRequestData>(\n WidgetApiToWidgetAction.OpenIDCredentials,\n {\n state: state,\n original_request_id: request.requestId,\n ...credential,\n },\n );\n } else {\n return this.transport.reply<IGetOpenIDActionResponseData>(request, {\n state: state,\n ...credential,\n });\n }\n };\n\n const replyError = (msg: string): void | Promise<IWidgetApiAcknowledgeResponseData> => {\n console.error(\"[ClientWidgetApi] Failed to handle OIDC: \", msg);\n if (phase > 1) {\n // We don't have a way to indicate that a random error happened in this flow, so\n // just block the attempt.\n return replyState(OpenIDRequestState.Blocked);\n } else {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: msg },\n });\n }\n };\n\n const observer = new SimpleObservable<IOpenIDUpdate>((update) => {\n if (update.state === OpenIDRequestState.PendingUserConfirmation && phase > 1) {\n observer.close();\n return replyError(\"client provided out-of-phase response to OIDC flow\");\n }\n\n if (update.state === OpenIDRequestState.PendingUserConfirmation) {\n replyState(update.state);\n phase++;\n return;\n }\n\n if (update.state === OpenIDRequestState.Allowed && !update.token) {\n return replyError(\"client provided invalid OIDC token for an allowed request\");\n }\n if (update.state === OpenIDRequestState.Blocked) {\n update.token = undefined; // just in case the client did something weird\n }\n\n observer.close();\n return replyState(update.state, update.token);\n });\n\n this.driver.askOpenID(observer);\n }\n\n private handleReadRoomAccountData(request: IReadRoomAccountDataFromWidgetActionRequest): void | Promise<void> {\n const events = this.driver.readRoomAccountData(request.data.type);\n\n if (!this.canReceiveRoomAccountData(request.data.type)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Cannot read room account data of this type\" },\n });\n }\n\n return events.then((evs) => {\n this.transport.reply<IReadRoomAccountDataFromWidgetResponseData>(request, { events: evs });\n });\n }\n\n private async handleReadEvents(request: IReadEventFromWidgetActionRequest): Promise<void> {\n if (!request.data.type) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Invalid request - missing event type\" },\n });\n }\n if (request.data.limit !== undefined && (!request.data.limit || request.data.limit < 0)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Invalid request - limit out of range\" },\n });\n }\n\n let askRoomIds: string[];\n if (request.data.room_ids === undefined) {\n askRoomIds = this.viewedRoomId === null ? [] : [this.viewedRoomId];\n } else if (request.data.room_ids === Symbols.AnyRoom) {\n askRoomIds = this.driver.getKnownRooms().filter((roomId) => this.canUseRoomTimeline(roomId));\n } else {\n askRoomIds = request.data.room_ids;\n for (const roomId of askRoomIds) {\n if (!this.canUseRoomTimeline(roomId)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: `Unable to access room timeline: ${roomId}` },\n });\n }\n }\n }\n\n const limit = request.data.limit || 0;\n const since = request.data.since;\n\n let stateKey: string | undefined = undefined;\n let msgtype: string | undefined = undefined;\n if (request.data.state_key !== undefined) {\n stateKey = request.data.state_key === true ? undefined : request.data.state_key.toString();\n if (!this.canReceiveStateEvent(request.data.type, stateKey ?? null)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Cannot read state events of this type\" },\n });\n }\n } else {\n msgtype = request.data.msgtype;\n if (!this.canReceiveRoomEvent(request.data.type, msgtype)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Cannot read room events of this type\" },\n });\n }\n }\n\n let events: IRoomEvent[];\n\n if (request.data.room_ids === undefined && askRoomIds.length === 0) {\n // For backwards compatibility we still call the deprecated\n // readRoomEvents and readStateEvents methods in case the client isn't\n // letting us know the currently viewed room via setViewedRoomId\n //\n // This can be considered as a deprecated implementation.\n // A driver should call `setViewedRoomId` on the widget messaging and implement the new readRoomState and readRoomTimeline\n // Methods.\n // This block makes sure that it is also possible to not use setViewedRoomId.\n // readRoomTimeline and readRoomState are required however! Otherwise widget requests that include\n // `room_ids` will fail.\n console.warn(\n \"The widgetDriver uses deprecated behaviour:\\n It does not set the viewedRoomId using `setViewedRoomId`\",\n );\n events = await // This returns [] with the current driver of Element Web.\n // Add default implementations of the `readRoomEvents` and `readStateEvents`\n // methods to use `readRoomTimeline` and `readRoomState` if they are not overwritten.\n (request.data.state_key === undefined\n ? this.driver.readRoomEvents(request.data.type, msgtype, limit, null, since)\n : this.driver.readStateEvents(request.data.type, stateKey, limit, null));\n } else if (await this.supportsUpdateState()) {\n // Calling read_events with a stateKey still reads from the rooms timeline (not the room state).\n events = (\n await Promise.all(\n askRoomIds.map((roomId) =>\n this.driver.readRoomTimeline(roomId, request.data.type, msgtype, stateKey, limit, since),\n ),\n )\n ).flat(1);\n } else {\n // TODO: remove this once `UnstableApiVersion.MSC2762_UPDATE_STATE` becomes stable.\n // Before version `MSC2762_UPDATE_STATE` we used readRoomState for read_events actions.\n events = (\n request.data.state_key === undefined\n ? await Promise.all(\n askRoomIds.map((roomId) =>\n this.driver.readRoomTimeline(roomId, request.data.type, msgtype, stateKey, limit, since),\n ),\n )\n : await Promise.all(\n askRoomIds.map((roomId) => this.driver.readRoomState(roomId, request.data.type, stateKey)),\n )\n ).flat(1);\n }\n\n this.transport.reply<IReadEventFromWidgetResponseData>(request, { events });\n }\n\n private handleSendEvent(request: ISendEventFromWidgetActionRequest): void {\n if (!request.data.type) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Invalid request - missing event type\" },\n });\n }\n\n if (!!request.data.room_id && !this.canUseRoomTimeline(request.data.room_id)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: `Unable to access room timeline: ${request.data.room_id}` },\n });\n }\n\n const isDelayedEvent = request.data.delay !== undefined || request.data.parent_delay_id !== undefined;\n if (isDelayedEvent && !this.hasCapability(MatrixCapabilities.MSC4157SendDelayedEvent)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: `Missing capability for ${MatrixCapabilities.MSC4157SendDelayedEvent}` },\n });\n }\n\n const isStickyEvent = request.data.sticky_duration_ms !== undefined;\n if (isStickyEvent && !this.hasCapability(MatrixCapabilities.MSC4407SendStickyEvent)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: `Missing capability for ${MatrixCapabilities.MSC4407SendStickyEvent}` },\n });\n }\n\n let sendEventPromise: Promise<ISendEventDetails | ISendDelayedEventDetails>;\n if (request.data.state_key !== undefined) {\n if (!this.canSendStateEvent(request.data.type, request.data.state_key)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Cannot send state events of this type\" },\n });\n }\n if (isStickyEvent) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Cannot send a state event with a sticky duration\" },\n });\n }\n\n if (isDelayedEvent) {\n sendEventPromise = this.driver.sendDelayedEvent(\n request.data.delay ?? null,\n request.data.parent_delay_id ?? null,\n request.data.type,\n request.data.content || {},\n request.data.state_key,\n request.data.room_id,\n );\n } else {\n sendEventPromise = this.driver.sendEvent(\n request.data.type,\n request.data.content || {},\n request.data.state_key,\n request.data.room_id,\n );\n }\n } else {\n const content = (request.data.content as { msgtype?: string }) || {};\n const msgtype = content[\"msgtype\"];\n if (!this.canSendRoomEvent(request.data.type, msgtype)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Cannot send room events of this type\" },\n });\n }\n\n // Events can be sticky, delayed, both, or neither. The following\n // section of code takes the common parameters and uses the correct\n // function depending on the request type.\n\n const params: Parameters<WidgetDriver[\"sendEvent\"]> = [\n request.data.type,\n content,\n null, // not sending a state event\n request.data.room_id,\n ];\n\n if (isDelayedEvent && request.data.sticky_duration_ms) {\n sendEventPromise = this.driver.sendDelayedStickyEvent(\n request.data.delay ?? null,\n request.data.parent_delay_id ?? null,\n request.data.sticky_duration_ms,\n request.data.type,\n content,\n request.data.room_id,\n );\n } else if (isDelayedEvent) {\n sendEventPromise = this.driver.sendDelayedEvent(\n request.data.delay ?? null,\n request.data.parent_delay_id ?? null,\n ...params,\n );\n } else if (request.data.sticky_duration_ms) {\n sendEventPromise = this.driver.sendStickyEvent(\n request.data.sticky_duration_ms,\n request.data.type,\n content,\n request.data.room_id,\n );\n } else {\n sendEventPromise = this.driver.sendEvent(...params);\n }\n }\n\n sendEventPromise\n .then((sentEvent) => {\n return this.transport.reply<ISendEventFromWidgetResponseData>(request, {\n room_id: sentEvent.roomId,\n ...(\"eventId\" in sentEvent\n ? {\n event_id: sentEvent.eventId,\n }\n : {\n delay_id: sentEvent.delayId,\n }),\n });\n })\n .catch((e: unknown) => {\n console.error(\"error sending event: \", e);\n this.handleDriverError(e, request, \"Error sending event\");\n });\n }\n\n private handleUpdateDelayedEvent(request: IUpdateDelayedEventFromWidgetActionRequest): void {\n if (!request.data.delay_id) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Invalid request - missing delay_id\" },\n });\n }\n\n if (!this.hasCapability(MatrixCapabilities.MSC4157UpdateDelayedEvent)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Missing capability\" },\n });\n }\n\n let updateDelayedEvent: (delayId: string) => Promise<void>;\n switch (request.data.action) {\n case UpdateDelayedEventAction.Cancel:\n updateDelayedEvent = this.driver.cancelScheduledDelayedEvent;\n break;\n case UpdateDelayedEventAction.Restart:\n updateDelayedEvent = this.driver.restartScheduledDelayedEvent;\n break;\n case UpdateDelayedEventAction.Send:\n updateDelayedEvent = this.driver.sendScheduledDelayedEvent;\n break;\n default:\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Invalid request - unsupported action\" },\n });\n }\n updateDelayedEvent\n .call(this.driver, request.data.delay_id)\n .then(() => {\n return this.transport.reply<IWidgetApiAcknowledgeResponseData>(request, {});\n })\n .catch((e: unknown) => {\n console.error(\"error updating delayed event: \", e);\n this.handleDriverError(e, request, \"Error updating delayed event\");\n });\n }\n\n private async handleSendToDevice(request: ISendToDeviceFromWidgetActionRequest): Promise<void> {\n if (!request.data.type) {\n this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Invalid request - missing event type\" },\n });\n } else if (!request.data.messages) {\n this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Invalid request - missing event contents\" },\n });\n } else if (typeof request.data.encrypted !== \"boolean\") {\n this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Invalid request - missing encryption flag\" },\n });\n } else if (!this.canSendToDeviceEvent(request.data.type)) {\n this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Cannot send to-device events of this type\" },\n });\n } else {\n try {\n await this.driver.sendToDevice(request.data.type, request.data.encrypted, request.data.messages);\n this.transport.reply<ISendToDeviceFromWidgetResponseData>(request, {});\n } catch (e) {\n console.error(\"error sending to-device event\", e);\n this.handleDriverError(e, request, \"Error sending event\");\n }\n }\n }\n\n private async pollTurnServers(turnServers: AsyncGenerator<ITurnServer>, initialServer: ITurnServer): Promise<void> {\n try {\n await this.transport.send<IUpdateTurnServersRequestData>(\n WidgetApiToWidgetAction.UpdateTurnServers,\n initialServer as IUpdateTurnServersRequestData, // it's compatible, but missing the index signature\n );\n\n // Pick the generator up where we left off\n for await (const server of turnServers) {\n await this.transport.send<IUpdateTurnServersRequestData>(\n WidgetApiToWidgetAction.UpdateTurnServers,\n server as IUpdateTurnServersRequestData, // it's compatible, but missing the index signature\n );\n }\n } catch (e) {\n console.error(\"error polling for TURN servers\", e);\n }\n }\n\n private async handleWatchTurnServers(request: IWatchTurnServersRequest): Promise<void> {\n if (!this.hasCapability(MatrixCapabilities.MSC3846TurnServers)) {\n this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Missing capability\" },\n });\n } else if (this.turnServers) {\n // We're already polling, so this is a no-op\n this.transport.reply<IWidgetApiAcknowledgeResponseData>(request, {});\n } else {\n try {\n const turnServers = this.driver.getTurnServers();\n\n // Peek at the first result, so we can at least verify that the\n // client isn't banned from getting TURN servers entirely\n const { done, value } = await turnServers.next();\n if (done) throw new Error(\"Client refuses to provide any TURN servers\");\n this.transport.reply<IWidgetApiAcknowledgeResponseData>(request, {});\n\n // Start the poll loop, sending the widget the initial result\n this.pollTurnServers(turnServers, value);\n this.turnServers = turnServers;\n } catch (e) {\n console.error(\"error getting first TURN server results\", e);\n this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"TURN servers not available\" },\n });\n }\n }\n }\n\n private async handleUnwatchTurnServers(request: IUnwatchTurnServersRequest): Promise<void> {\n if (!this.hasCapability(MatrixCapabilities.MSC3846TurnServers)) {\n this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Missing capability\" },\n });\n } else if (!this.turnServers) {\n // We weren't polling anyways, so this is a no-op\n this.transport.reply<IWidgetApiAcknowledgeResponseData>(request, {});\n } else {\n // Stop the generator, allowing it to clean up\n await this.turnServers.return(undefined);\n this.turnServers = null;\n this.transport.reply<IWidgetApiAcknowledgeResponseData>(request, {});\n }\n }\n\n private async handleReadRelations(request: IReadRelationsFromWidgetActionRequest): Promise<void> {\n if (!request.data.event_id) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Invalid request - missing event ID\" },\n });\n }\n\n if (request.data.limit !== undefined && request.data.limit < 0) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Invalid request - limit out of range\" },\n });\n }\n\n if (request.data.room_id !== undefined && !this.canUseRoomTimeline(request.data.room_id)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: `Unable to access room timeline: ${request.data.room_id}` },\n });\n }\n\n try {\n const result = await this.driver.readEventRelations(\n request.data.event_id,\n request.data.room_id,\n request.data.rel_type,\n request.data.event_type,\n request.data.from,\n request.data.to,\n request.data.limit,\n request.data.direction,\n );\n\n // only return events that the user has the permission to receive\n const chunk = result.chunk.filter((e) => {\n if (e.state_key !== undefined) {\n return this.canReceiveStateEvent(e.type, e.state_key);\n } else {\n return this.canReceiveRoomEvent(e.type, (e.content as { msgtype?: string })[\"msgtype\"]);\n }\n });\n\n return this.transport.reply<IReadRelationsFromWidgetResponseData>(request, {\n chunk,\n prev_batch: result.prevBatch,\n next_batch: result.nextBatch,\n });\n } catch (e) {\n console.error(\"error getting the relations\", e);\n this.handleDriverError(e, request, \"Unexpected error while reading relations\");\n }\n }\n\n private async handleUserDirectorySearch(request: IUserDirectorySearchFromWidgetActionRequest): Promise<void> {\n if (!this.hasCapability(MatrixCapabilities.MSC3973UserDirectorySearch)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Missing capability\" },\n });\n }\n\n if (typeof request.data.search_term !== \"string\") {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Invalid request - missing search term\" },\n });\n }\n\n if (request.data.limit !== undefined && request.data.limit < 0) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Invalid request - limit out of range\" },\n });\n }\n\n try {\n const result = await this.driver.searchUserDirectory(request.data.search_term, request.data.limit);\n\n return this.transport.reply<IUserDirectorySearchFromWidgetResponseData>(request, {\n limited: result.limited,\n results: result.results.map((r) => ({\n user_id: r.userId,\n display_name: r.displayName,\n avatar_url: r.avatarUrl,\n })),\n });\n } catch (e) {\n console.error(\"error searching in the user directory\", e);\n this.handleDriverError(e, request, \"Unexpected error while searching in the user directory\");\n }\n }\n\n private async handleGetMediaConfig(request: IGetMediaConfigActionFromWidgetActionRequest): Promise<void> {\n if (!this.hasCapability(MatrixCapabilities.MSC4039UploadFile)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Missing capability\" },\n });\n }\n\n try {\n const result = await this.driver.getMediaConfig();\n\n return this.transport.reply<IGetMediaConfigActionFromWidgetResponseData>(request, result);\n } catch (e) {\n console.error(\"error while getting the media configuration\", e);\n this.handleDriverError(e, request, \"Unexpected error while getting the media configuration\");\n }\n }\n\n private async handleUploadFile(request: IUploadFileActionFromWidgetActionRequest): Promise<void> {\n if (!this.hasCapability(MatrixCapabilities.MSC4039UploadFile)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Missing capability\" },\n });\n }\n\n try {\n const result = await this.driver.uploadFile(request.data.file);\n\n return this.transport.reply<IUploadFileActionFromWidgetResponseData>(request, {\n content_uri: result.contentUri,\n });\n } catch (e) {\n console.error(\"error while uploading a file\", e);\n this.handleDriverError(e, request, \"Unexpected error while uploading a file\");\n }\n }\n\n private async handleDownloadFile(request: IDownloadFileActionFromWidgetActionRequest): Promise<void> {\n if (!this.hasCapability(MatrixCapabilities.MSC4039DownloadFile)) {\n return this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: { message: \"Missing capability\" },\n });\n }\n\n try {\n const result = await this.driver.downloadFile(request.data.content_uri);\n\n return this.transport.reply<IDownloadFileActionFromWidgetResponseData>(request, { file: result.file });\n } catch (e) {\n console.error(\"error while downloading a file\", e);\n this.handleDriverError(e, request, \"Unexpected error while downloading a file\");\n }\n }\n\n private handleDriverError(e: unknown, request: IWidgetApiRequest, message: string): void {\n const data = this.driver.processError(e);\n this.transport.reply<IWidgetApiErrorResponseData>(request, {\n error: {\n message,\n ...data,\n },\n });\n }\n\n private handleMessage(ev: CustomEvent<IWidgetApiRequest>): void | Promise<void> {\n if (this.isStopped) return;\n const actionEv = new CustomEvent(`action:${ev.detail.action}`, {\n detail: ev.detail,\n cancelable: true,\n });\n this.emit(`action:${ev.detail.action}`, actionEv);\n if (!actionEv.defaultPrevented) {\n switch (ev.detail.action) {\n case WidgetApiFromWidgetAction.ContentLoaded:\n return this.handleContentLoadedAction(<IContentLoadedActionRequest>ev.detail);\n case WidgetApiFromWidgetAction.SupportedApiVersions:\n return this.replyVersions(<ISupportedVersionsActionRequest>ev.detail);\n case WidgetApiFromWidgetAction.SendEvent:\n return this.handleSendEvent(<ISendEventFromWidgetActionRequest>ev.detail);\n case WidgetApiFromWidgetAction.SendToDevice:\n return this.handleSendToDevice(<ISendToDeviceFromWidgetActionRequest>ev.detail);\n case WidgetApiFromWidgetAction.GetOpenIDCredentials:\n return this.handleOIDC(<IGetOpenIDActionRequest>ev.detail);\n case WidgetApiFromWidgetAction.MSC2931Navigate:\n return this.handleNavigate(<INavigateActionRequest>ev.detail);\n case WidgetApiFromWidgetAction.MSC2974RenegotiateCapabilities:\n return this.handleCapabilitiesRenegotiate(<IRenegotiateCapabilitiesActionRequest>ev.detail);\n case WidgetApiFromWidgetAction.MSC2876ReadEvents:\n return this.handleReadEvents(<IReadEventFromWidgetActionRequest>ev.detail);\n case WidgetApiFromWidgetAction.WatchTurnServers:\n return this.handleWatchTurnServers(<IWatchTurnServersRequest>ev.detail);\n case WidgetApiFromWidgetAction.UnwatchTurnServers:\n return this.handleUnwatchTurnServers(<IUnwatchTurnServersRequest>ev.detail);\n case WidgetApiFromWidgetAction.MSC3869ReadRelations:\n return this.handleReadRelations(<IReadRelationsFromWidgetActionRequest>ev.detail);\n case WidgetApiFromWidgetAction.MSC3973UserDirectorySearch:\n return this.handleUserDirectorySearch(<IUserDirectorySearchFromWidgetActionRequest>ev.detail);\n case WidgetApiFromWidgetAction.BeeperReadRoomAccountData:\n return this.handleReadRoomAccountData(<IReadRoomAccountDataFromWidgetActionRequest>ev.detail);\n case WidgetApiFromWidgetAction.MSC4039GetMediaConfigAction:\n return this.handleGetMediaConfig(<IGetMediaConfigActionFromWidgetActionRequest>ev.detail);\n case WidgetApiFromWidgetAction.MSC4039UploadFileAction:\n return this.handleUploadFile(<IUploadFileActionFromWidgetActionRequest>ev.detail);\n case WidgetApiFromWidgetAction.MSC4039DownloadFileAction:\n return this.handleDownloadFile(<IDownloadFileActionFromWidgetActionRequest>ev.detail);\n case WidgetApiFromWidgetAction.MSC4157UpdateDelayedEvent:\n return this.handleUpdateDelayedEvent(<IUpdateDelayedEventFromWidgetActionRequest>ev.detail);\n\n default:\n return this.transport.reply(ev.detail, <IWidgetApiErrorResponseData>{\n error: {\n message: \"Unknown or unsupported from-widget action: \" + ev.detail.action,\n },\n });\n }\n }\n }\n\n /**\n * Informs the widget that the client's theme has changed.\n * @param theme The theme data, as an object with arbitrary contents.\n */\n public updateTheme(theme: IThemeChangeActionRequestData): Promise<IWidgetApiResponseData> {\n return this.transport.send(WidgetApiToWidgetAction.ThemeChange, theme);\n }\n\n /**\n * Informs the widget that the client's language has changed.\n * @param lang The BCP 47 identifier representing the client's current language.\n */\n public updateLanguage(lang: string): Promise<IWidgetApiResponseData> {\n return this.transport.send(WidgetApiToWidgetAction.LanguageChange, { lang });\n }\n\n /**\n * Takes a screenshot of the widget.\n * @returns Resolves to the widget's screenshot.\n * @throws Throws if there is a problem.\n */\n public takeScreenshot(): Promise<IScreenshotActionResponseData> {\n return this.transport.send(WidgetApiToWidgetAction.TakeScreenshot, <IWidgetApiRequestEmptyData>{});\n }\n\n /**\n * Alerts the widget to whether or not it is currently visible.\n * @param {boolean} isVisible Whether the widget is visible or not.\n * @returns {Promise<IWidgetApiResponseData>} Resolves when the widget acknowledges the update.\n */\n public updateVisibility(isVisible: boolean): Promise<IWidgetApiResponseData> {\n return this.transport.send(WidgetApiToWidgetAction.UpdateVisibility, <IVisibilityActionRequestData>{\n visible: isVisible,\n });\n }\n\n public sendWidgetConfig(data: IModalWidgetOpenRequestData): Promise<void> {\n return this.transport.send<IModalWidgetOpenRequestData>(WidgetApiToWidgetAction.WidgetConfig, data).then();\n }\n\n public notifyModalWidgetButtonClicked(id: IModalWidgetOpenRequestDataButton[\"id\"]): Promise<void> {\n return this.transport\n .send<IModalWidgetButtonClickedRequestData>(WidgetApiToWidgetAction.ButtonClicked, { id })\n .then();\n }\n\n public notifyModalWidgetClose(data: IModalWidgetReturnData): Promise<void> {\n return this.transport.send<IModalWidgetReturnData>(WidgetApiToWidgetAction.CloseModalWidget, data).then();\n }\n\n /**\n * Feeds an event to the widget. As a client you are expected to call this\n * for every new event in every room to which you are joined or invited.\n * @param {IRoomEvent} rawEvent The event to (try to) send to the widget.\n * @param {string} currentViewedRoomId The room ID the user is currently\n * interacting with. Not the room ID of the event.\n * @returns {Promise<void>} Resolves when delivered or if the widget is not\n * able to read the event due to permissions, rejects if the widget failed\n * to handle the event.\n * @deprecated It is recommended to communicate the viewed room ID by calling\n * {@link ClientWidgetApi.setViewedRoomId} rather than passing it to this\n * method.\n */\n public async feedEvent(rawEvent: IRoomEvent, currentViewedRoomId: string): Promise<void>;\n /**\n * Feeds an event to the widget. As a client you are expected to call this\n * for every new event (including state events) in every room to which you are joined or invited.\n * @param {IRoomEvent} rawEvent The event to (try to) send to the widget.\n * @returns {Promise<void>} Resolves when delivered or if the widget is not\n * able to read the event due to permissions, rejects if the widget failed\n * to handle the event.\n */\n public async feedEvent(rawEvent: IRoomEvent): Promise<void>;\n public async feedEvent(rawEvent: IRoomEvent, currentViewedRoomId?: string): Promise<void> {\n if (currentViewedRoomId !== undefined) this.setViewedRoomId(currentViewedRoomId);\n if (rawEvent.room_id !== this.viewedRoomId && !this.canUseRoomTimeline(rawEvent.room_id)) {\n return; // no-op\n }\n\n if (rawEvent.state_key !== undefined && rawEvent.state_key !== null) {\n // state event\n if (!this.canReceiveStateEvent(rawEvent.type, rawEvent.state_key)) {\n return; // no-op\n }\n } else {\n // message event\n if (!this.canReceiveRoomEvent(rawEvent.type, (rawEvent.content as { msgtype?: string })?.[\"msgtype\"])) {\n return; // no-op\n }\n }\n\n // Feed the event into the widget\n await this.transport.send<ISendEventToWidgetRequestData>(\n WidgetApiToWidgetAction.SendEvent,\n // it's compatible, but missing the index signature\n rawEvent as ISendEventToWidgetRequestData,\n );\n }\n\n /**\n * Feeds a to-device event to the widget. As a client you are expected to\n * call this for every to-device event you receive.\n * @param {IRoomEvent} rawEvent The event to (try to) send to the widget.\n * @param {boolean} encrypted Whether the event contents were encrypted.\n * @returns {Promise<void>} Resolves when delivered or if the widget is not\n * able to receive the event due to permissions, rejects if the widget\n * failed to handle the event.\n */\n public async feedToDevice(message: IToDeviceMessage, encrypted: boolean): Promise<void> {\n if (this.canReceiveToDeviceEvent(message.type)) {\n await this.transport.send<ISendToDeviceToWidgetRequestData>(WidgetApiToWidgetAction.SendToDevice, {\n ...message,\n encrypted,\n });\n }\n }\n\n private viewedRoomId: string | null = null;\n\n /**\n * Indicate that a room is being viewed (making it possible for the widget\n * to interact with it).\n */\n public setViewedRoomId(roomId: string | null): void {\n this.viewedRoomId = roomId;\n // If the widget doesn't have timeline permissions for the room then\n // this is its opportunity to learn the room state. We push the entire\n // room state, which could be redundant if this room had been viewed\n // once before, but it's easier than selectively pushing just the bits\n // of state that changed while the room was in the background.\n if (roomId !== null && !this.canUseRoomTimeline(roomId)) this.pushRoomState(roomId);\n }\n\n private async flushRoomState(): Promise<void> {\n try {\n // Only send a single action once all concurrent tasks have completed\n do await Promise.all(this.pushRoomStateTasks);\n while (this.pushRoomStateTasks.size > 0);\n\n const events: IRoomEvent[] = [];\n for (const eventTypeMap of this.pushRoomStateResult.values()) {\n for (const stateKeyMap of eventTypeMap.values()) {\n events.push(...stateKeyMap.values());\n }\n }\n if ((await this.getWidgetVersions()).includes(UnstableApiVersion.MSC2762_UPDATE_STATE)) {\n // Only send state updates when using UpdateState. Otherwise the SendEvent action will be responsible for state updates.\n await this.transport.send<IUpdateStateToWidgetRequestData>(WidgetApiToWidgetAction.UpdateState, {\n state: events,\n });\n }\n } finally {\n this.flushRoomStateTask = null;\n }\n }\n\n /**\n * Reads the current sticky state of the room and pushes it to the widget.\n *\n * It will only push events that the widget is allowed to receive.\n * @param roomId\n * @private\n */\n private async pushStickyState(roomId: string): Promise<void> {\n console.debug(\"Pushing sticky state to widget for room\", roomId);\n return this.driver\n .readStickyEvents(roomId)\n .then((events) => {\n // filter to the allowed sticky events\n const filtered = events.filter((e) => {\n return this.canReceiveRoomEvent(\n e.type,\n typeof e.content?.msgtype === \"string\" ? e.content.msgtype : null,\n );\n });\n return { roomId, stickyEvents: filtered };\n })\n .then(async ({ roomId, stickyEvents }) => {\n console.debug(\"Pushing\", stickyEvents.length, \"sticky events to widget for room\", roomId);\n const promises = stickyEvents.map((rawEvent) => {\n return this.transport.send<ISendEventToWidgetRequestData>(\n WidgetApiToWidgetAction.SendEvent,\n // copied from feedEvent; it's compatible, but missing the index signature\n rawEvent as ISendEventToWidgetRequestData,\n );\n });\n await Promise.all(promises);\n });\n }\n\n /**\n * Read the room's state and push all entries that the widget is allowed to\n * read through to the widget.\n */\n private pushRoomState(roomId: string): void {\n for (const cap of this.allowedEvents) {\n if (cap.kind === EventKind.State && cap.direction === EventDirection.Receive) {\n // Initiate the task\n const events = this.driver.readRoomState(roomId, cap.eventType, cap.keyStr ?? undefined);\n const task = events\n .then(\n (events) => {\n // When complete, queue the resulting events to be\n // pushed to the widget\n for (const event of events) {\n let eventTypeMap = this.pushRoomStateResult.get(roomId);\n if (eventTypeMap === undefined) {\n eventTypeMap = new Map();\n this.pushRoomStateResult.set(roomId, eventTypeMap);\n }\n let stateKeyMap = eventTypeMap.get(cap.eventType);\n if (stateKeyMap === undefined) {\n stateKeyMap = new Map();\n eventTypeMap.set(cap.eventType, stateKeyMap);\n }\n if (!stateKeyMap.has(event.state_key!)) stateKeyMap.set(event.state_key!, event);\n }\n },\n (e) =>\n console.error(\n `Failed to read room state for ${roomId} (${cap.eventType}, ${cap.keyStr})`,\n e,\n ),\n )\n .then(() => {\n // Mark request as no longer pending\n this.pushRoomStateTasks.delete(task);\n });\n\n // Mark task as pending\n this.pushRoomStateTasks.add(task);\n // Assuming no other tasks are already happening concurrently,\n // schedule the widget action that actually pushes the events\n this.flushRoomStateTask ??= this.flushRoomState();\n this.flushRoomStateTask.catch((e) => console.error(\"Failed to push room state\", e));\n }\n }\n }\n\n /**\n * Feeds a room state update to the widget. As a client you are expected to\n * call this for every state update in every room to which you are joined or\n * invited.\n * @param {IRoomEvent} rawEvent The state event corresponding to the updated\n * room state entry.\n * @returns {Promise<void>} Resolves when delivered or if the widget is not\n * able to receive the room state due to permissions, rejects if the\n * widget failed to handle the update.\n */\n public async feedStateUpdate(rawEvent: IRoomEvent): Promise<void> {\n if (rawEvent.state_key === undefined) throw new Error(\"Not a state event\");\n if (\n (rawEvent.room_id === this.viewedRoomId || this.canUseRoomTimeline(rawEvent.room_id)) &&\n this.canReceiveStateEvent(rawEvent.type, rawEvent.state_key)\n ) {\n // Updates could race with the initial push of the room's state\n if (this.pushRoomStateTasks.size === 0) {\n // No initial push tasks are pending; safe to send immediately\n if ((await this.getWidgetVersions()).includes(UnstableApiVersion.MSC2762_UPDATE_STATE)) {\n // Only send state updates when using UpdateState. Otherwise the SendEvent action will be responsible for state updates.\n await this.transport.send<IUpdateStateToWidgetRequestData>(WidgetApiToWidgetAction.UpdateState, {\n state: [rawEvent],\n });\n }\n } else {\n // Lump the update in with whatever data will be sent in the\n // initial push later. Even if we set it to an \"outdated\" entry\n // here, we can count on any newer entries being passed to this\n // same method eventually; this won't cause stuck state.\n let eventTypeMap = this.pushRoomStateResult.get(rawEvent.room_id);\n if (eventTypeMap === undefined) {\n eventTypeMap = new Map();\n this.pushRoomStateResult.set(rawEvent.room_id, eventTypeMap);\n }\n let stateKeyMap = eventTypeMap.get(rawEvent.type);\n if (stateKeyMap === undefined) {\n stateKeyMap = new Map();\n eventTypeMap.set(rawEvent.type, stateKeyMap);\n }\n if (!stateKeyMap.has(rawEvent.type)) stateKeyMap.set(rawEvent.state_key, rawEvent);\n do await Promise.all(this.pushRoomStateTasks);\n while (this.pushRoomStateTasks.size > 0);\n await this.flushRoomStateTask;\n }\n }\n }\n}\n", "/*\n * Copyright 2020 - 2024 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IWidgetApiResponse, IWidgetApiResponseData } from \"./IWidgetApiResponse\";\n\n/**\n * The format of errors returned by Matrix API requests\n * made by a WidgetDriver.\n */\nexport interface IMatrixApiError {\n /** The HTTP status code of the associated request. */\n http_status: number; // eslint-disable-line camelcase\n /** Any HTTP response headers that are relevant to the error. */\n http_headers: { [name: string]: string }; // eslint-disable-line camelcase\n /** The URL of the failed request. */\n url: string;\n /** @see {@link https://spec.matrix.org/latest/client-server-api/#standard-error-response} */\n response: {\n errcode: string;\n error: string;\n } & IWidgetApiResponseData; // extensible\n}\n\nexport interface IWidgetApiErrorResponseDataDetails {\n /** Set if the error came from a Matrix API request made by a widget driver */\n matrix_api_error?: IMatrixApiError; // eslint-disable-line camelcase\n}\n\nexport interface IWidgetApiErrorResponseData extends IWidgetApiResponseData {\n error: {\n /** A user-friendly string describing the error */\n message: string;\n } & IWidgetApiErrorResponseDataDetails;\n}\n\nexport interface IWidgetApiErrorResponse extends IWidgetApiResponse {\n response: IWidgetApiErrorResponseData;\n}\n\nexport function isErrorResponse(responseData: IWidgetApiResponseData): responseData is IWidgetApiErrorResponseData {\n const error = responseData.error;\n return typeof error === \"object\" && error !== null && \"message\" in error && typeof error.message === \"string\";\n}\n", "/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum WidgetKind {\n Room = \"room\",\n Account = \"account\",\n Modal = \"modal\",\n}\n", "/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum ModalButtonKind {\n Primary = \"m.primary\",\n Secondary = \"m.secondary\",\n Warning = \"m.warning\",\n Danger = \"m.danger\",\n Link = \"m.link\",\n}\n", "/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function isValidUrl(val: string): boolean {\n if (!val) return false; // easy: not valid if not present\n\n try {\n const parsed = new URL(val);\n if (parsed.protocol !== \"http\" && parsed.protocol !== \"https\") {\n return false;\n }\n return true;\n } catch (e) {\n if (e instanceof TypeError) {\n return false;\n }\n throw e;\n }\n}\n", "/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function assertPresent<O extends Record<any, any>>(obj: O, key: keyof O): void {\n if (!obj[key]) {\n throw new Error(`${String(key)} is required`);\n }\n}\n", "/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ITemplateParams, IWidget, IWidgetData, runTemplate, WidgetType } from \"..\";\nimport { assertPresent } from \"./validation/utils\";\n\n/**\n * Represents the barest form of widget.\n */\nexport class Widget {\n public constructor(private readonly definition: IWidget) {\n if (!this.definition) throw new Error(\"Definition is required\");\n\n assertPresent(definition, \"id\");\n assertPresent(definition, \"creatorUserId\");\n assertPresent(definition, \"type\");\n assertPresent(definition, \"url\");\n }\n\n /**\n * The user ID who created the widget.\n */\n public get creatorUserId(): string {\n return this.definition.creatorUserId;\n }\n\n /**\n * The type of widget.\n */\n public get type(): WidgetType {\n return this.definition.type;\n }\n\n /**\n * The ID of the widget.\n */\n public get id(): string {\n return this.definition.id;\n }\n\n /**\n * The name of the widget, or null if not set.\n */\n public get name(): string | null {\n return this.definition.name || null;\n }\n\n /**\n * The title for the widget, or null if not set.\n */\n public get title(): string | null {\n return this.rawData.title || null;\n }\n\n /**\n * The templated URL for the widget.\n */\n public get templateUrl(): string {\n return this.definition.url;\n }\n\n /**\n * The origin for this widget.\n */\n public get origin(): string {\n return new URL(this.templateUrl).origin;\n }\n\n /**\n * Whether or not the client should wait for the iframe to load. Defaults\n * to true.\n */\n public get waitForIframeLoad(): boolean {\n if (this.definition.waitForIframeLoad === false) return false;\n if (this.definition.waitForIframeLoad === true) return true;\n return true; // default true\n }\n\n /**\n * The raw data for the widget. This will always be defined, though\n * may be empty.\n */\n public get rawData(): IWidgetData {\n return this.definition.data || {};\n }\n\n /**\n * Gets a complete widget URL for the client to render.\n * @param {ITemplateParams} params The template parameters.\n * @returns {string} A templated URL.\n */\n public getCompleteUrl(params: ITemplateParams): string {\n return runTemplate(this.templateUrl, this.definition, params);\n }\n}\n", "/*\n * Copyright 2020 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Widget } from \"./Widget\";\nimport { IWidget } from \"..\";\nimport { isValidUrl } from \"./validation/url\";\n\nexport interface IStateEvent {\n event_id: string; // eslint-disable-line camelcase\n room_id: string; // eslint-disable-line camelcase\n type: string;\n sender: string;\n origin_server_ts: number; // eslint-disable-line camelcase\n unsigned?: unknown;\n content: unknown;\n state_key: string; // eslint-disable-line camelcase\n}\n\nexport interface IAccountDataWidgets {\n [widgetId: string]: {\n type: \"m.widget\";\n // the state_key is also the widget's ID\n state_key: string; // eslint-disable-line camelcase\n sender: string; // current user's ID\n content: IWidget;\n id?: string; // off-spec, but possible\n };\n}\n\nexport class WidgetParser {\n private constructor() {\n // private constructor because this is a util class\n }\n\n /**\n * Parses widgets from the \"m.widgets\" account data event. This will always\n * return an array, though may be empty if no valid widgets were found.\n * @param {IAccountDataWidgets} content The content of the \"m.widgets\" account data.\n * @returns {Widget[]} The widgets in account data, or an empty array.\n */\n public static parseAccountData(content: IAccountDataWidgets): Widget[] {\n if (!content) return [];\n\n const result: Widget[] = [];\n for (const widgetId of Object.keys(content)) {\n const roughWidget = content[widgetId];\n if (!roughWidget) continue;\n if (roughWidget.type !== \"m.widget\" && roughWidget.type !== \"im.vector.modular.widgets\") continue;\n if (!roughWidget.sender) continue;\n\n const probableWidgetId = roughWidget.state_key || roughWidget.id;\n if (probableWidgetId !== widgetId) continue;\n\n const asStateEvent: IStateEvent = {\n content: roughWidget.content,\n sender: roughWidget.sender,\n type: \"m.widget\",\n state_key: widgetId,\n event_id: \"$example\",\n room_id: \"!example\",\n origin_server_ts: 1,\n };\n\n const widget = WidgetParser.parseRoomWidget(asStateEvent);\n if (widget) result.push(widget);\n }\n\n return result;\n }\n\n /**\n * Parses all the widgets possible in the given array. This will always return\n * an array, though may be empty if no widgets could be parsed.\n * @param {IStateEvent[]} currentState The room state to parse.\n * @returns {Widget[]} The widgets in the state, or an empty array.\n */\n public static parseWidgetsFromRoomState(currentState: IStateEvent[]): Widget[] {\n if (!currentState) return [];\n const result: Widget[] = [];\n for (const state of currentState) {\n const widget = WidgetParser.parseRoomWidget(state);\n if (widget) result.push(widget);\n }\n return result;\n }\n\n /**\n * Parses a state event into a widget. If the state event does not represent\n * a widget (wrong event type, invalid widget, etc) then null is returned.\n * @param {IStateEvent} stateEvent The state event.\n * @returns {Widget|null} The widget, or null if invalid\n */\n public static parseRoomWidget(stateEvent: IStateEvent): Widget | null {\n if (!stateEvent) return null;\n\n // TODO: [Legacy] Remove legacy support\n if (stateEvent.type !== \"m.widget\" && stateEvent.type !== \"im.vector.modular.widgets\") {\n return null;\n }\n\n // Dev note: Throughout this function we have null safety to ensure that\n // if the caller did not supply something useful that we don't error. This\n // is done against the requirements of the interface because not everyone\n // will have an interface to validate against.\n\n const content = (stateEvent.content as IWidget) || {};\n\n // Form our best approximation of a widget with the information we have\n const estimatedWidget: IWidget = {\n id: stateEvent.state_key,\n creatorUserId: content[\"creatorUserId\"] || stateEvent.sender,\n name: content[\"name\"],\n type: content[\"type\"],\n url: content[\"url\"],\n waitForIframeLoad: content[\"waitForIframeLoad\"],\n data: content[\"data\"],\n };\n\n // Finally, process that widget\n return WidgetParser.processEstimatedWidget(estimatedWidget);\n }\n\n private static processEstimatedWidget(widget: IWidget): Widget | null {\n // Validate that the widget has the best chance of passing as a widget\n if (!widget.id || !widget.creatorUserId || !widget.type) {\n return null;\n }\n if (!isValidUrl(widget.url)) {\n return null;\n }\n // TODO: Validate data for known widget types\n return new Widget(widget);\n }\n}\n", "/*\n * Copyright 2020, 2021 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IWidget } from \"..\";\n\nexport interface ITemplateParams {\n widgetRoomId?: string;\n currentUserId: string;\n userDisplayName?: string;\n userHttpAvatarUrl?: string;\n clientId?: string;\n clientTheme?: string;\n clientLanguage?: string;\n deviceId?: string;\n baseUrl?: string;\n}\n\nexport function runTemplate(url: string, widget: IWidget, params: ITemplateParams): string {\n // Always apply the supplied params over top of data to ensure the data can't lie about them.\n const variables = Object.assign({}, widget.data, {\n \"matrix_room_id\": params.widgetRoomId || \"\",\n \"matrix_user_id\": params.currentUserId,\n \"matrix_display_name\": params.userDisplayName || params.currentUserId,\n \"matrix_avatar_url\": params.userHttpAvatarUrl || \"\",\n \"matrix_widget_id\": widget.id,\n\n // TODO: Convert to stable (https://github.com/matrix-org/matrix-doc/pull/2873)\n \"org.matrix.msc2873.client_id\": params.clientId || \"\",\n \"org.matrix.msc2873.client_theme\": params.clientTheme || \"\",\n \"org.matrix.msc2873.client_language\": params.clientLanguage || \"\",\n\n // TODO: Convert to stable (https://github.com/matrix-org/matrix-spec-proposals/pull/3819)\n \"org.matrix.msc3819.matrix_device_id\": params.deviceId || \"\",\n\n // TODO: Convert to stable (https://github.com/matrix-org/matrix-spec-proposals/pull/4039)\n \"org.matrix.msc4039.matrix_base_url\": params.baseUrl || \"\",\n });\n let result = url;\n for (const key of Object.keys(variables)) {\n // Regex escape from https://stackoverflow.com/a/6969486/7037379\n const pattern = `$${key}`.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\"); // $& means the whole matched string\n const rexp = new RegExp(pattern, \"g\");\n\n // This is technically not what we're supposed to do for a couple of reasons:\n // 1. We are assuming that there won't later be a $key match after we replace a variable.\n // 2. We are assuming that the variable is in a place where it can be escaped (eg: path or query string).\n result = result.replace(rexp, encodeURIComponent(toString(variables[key])));\n }\n return result;\n}\n\nexport function toString(a: unknown): string {\n if (a === null || a === undefined) {\n return `${a}`;\n }\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n return String(a);\n}\n", "/*\n * Copyright 2020 - 2024 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Capability,\n IOpenIDCredentials,\n OpenIDRequestState,\n SimpleObservable,\n IRoomEvent,\n IRoomAccountData,\n ITurnServer,\n IWidgetApiErrorResponseDataDetails,\n} from \"..\";\n\nexport interface ISendEventDetails {\n roomId: string;\n eventId: string;\n}\n\nexport interface ISendDelayedEventDetails {\n roomId: string;\n delayId: string;\n}\n\nexport interface IOpenIDUpdate {\n state: OpenIDRequestState;\n token?: IOpenIDCredentials;\n}\n\nexport interface IReadEventRelationsResult {\n chunk: IRoomEvent[];\n nextBatch?: string;\n prevBatch?: string;\n}\n\nexport interface ISearchUserDirectoryResult {\n limited: boolean;\n results: Array<{\n userId: string;\n displayName?: string;\n avatarUrl?: string;\n }>;\n}\n\nexport interface IGetMediaConfigResult {\n [key: string]: unknown;\n\n \"m.upload.size\"?: number;\n}\n\n/**\n * Represents the functions and behaviour the widget-api is unable to\n * do, such as prompting the user for information or interacting with\n * the UI. Clients are expected to implement this class and override\n * any functions they need/want to support.\n *\n * This class assumes the client will have a context of a Widget\n * instance already.\n */\nexport abstract class WidgetDriver {\n /**\n * Verifies the widget's requested capabilities, returning the ones\n * it is approved to use. Mutating the requested capabilities will\n * have no effect.\n *\n * This SHOULD result in the user being prompted to approve/deny\n * capabilities.\n *\n * By default this rejects all capabilities (returns an empty set).\n * @param {Set<Capability>} requested The set of requested capabilities.\n * @returns {Promise<Set<Capability>>} Resolves to the allowed capabilities.\n */\n public validateCapabilities(requested: Set<Capability>): Promise<Set<Capability>> {\n return Promise.resolve(new Set());\n }\n\n /**\n * Sends an event into a room. If `roomId` is falsy, the client should send the event\n * into the room the user is currently looking at. The widget API will have already\n * verified that the widget is capable of sending the event to that room.\n * @param {string} eventType The event type to be sent.\n * @param {*} content The content for the event.\n * @param {string|null} stateKey The state key if this is a state event, otherwise null.\n * May be an empty string.\n * @param {string|null} roomId The room ID to send the event to. If falsy, the room the\n * user is currently looking at.\n * @returns {Promise<ISendEventDetails>} Resolves when the event has been sent with\n * details of that event.\n * @throws Rejected when the event could not be sent.\n */\n public sendEvent(\n eventType: string,\n content: unknown,\n stateKey: string | null = null,\n roomId: string | null = null,\n ): Promise<ISendEventDetails> {\n return Promise.reject(new Error(\"Failed to override function\"));\n }\n\n /**\n * @experimental Part of MSC4407\n * Sends a sticky event into a room. If `roomId` is falsy, the client should send the event\n * into the room the user is currently looking at. The widget API will have already\n * verified that the widget is capable of sending the event to that room.\n * @param {number} stickyDurationMs The length of time a sticky event may remain sticky, in milliseconds.\n * @param {string} eventType The event type to be sent.\n * @param {*} content The content for the event.\n * @param {string|null} roomId The room ID to send the event to. If falsy, the room the\n * user is currently looking at.\n * @returns {Promise<ISendEventDetails>} Resolves when the event has been sent with\n * details of that event.\n * @throws Rejected when the event could not be sent.\n */\n public sendStickyEvent(\n stickyDurationMs: number,\n eventType: string,\n content: unknown,\n roomId: string | null = null,\n ): Promise<ISendEventDetails> {\n throw new Error(\"Method not implemented.\");\n }\n\n /**\n * @experimental Part of MSC4140 & MSC4157\n * Sends a delayed event into a room. If `roomId` is falsy, the client should send it\n * into the room the user is currently looking at. The widget API will have already\n * verified that the widget is capable of sending the event to that room.\n * @param {number|null} delay How much later to send the event, or null to not send the\n * event automatically. May not be null if {@link parentDelayId} is null.\n * @param {string|null} parentDelayId The ID of the delayed event this one is grouped with,\n * or null if it will be put in a new group. May not be null if {@link delay} is null.\n * @param {string} eventType The event type of the event to be sent.\n * @param {*} content The content for the event to be sent.\n * @param {string|null} stateKey The state key if the event to be sent a state event,\n * otherwise null. May be an empty string.\n * @param {string|null} roomId The room ID to send the event to. If falsy, the room the\n * user is currently looking at.\n * @returns {Promise<ISendDelayedEventDetails>} Resolves when the delayed event has been\n * prepared with details of how to refer to it for updating/sending/canceling it later.\n * @throws Rejected when the delayed event could not be sent.\n */\n public sendDelayedEvent(\n delay: number | null,\n parentDelayId: string | null,\n eventType: string,\n content: unknown,\n stateKey: string | null = null,\n roomId: string | null = null,\n ): Promise<ISendDelayedEventDetails> {\n return Promise.reject(new Error(\"Failed to override function\"));\n }\n\n /**\n * @experimental Part of MSC4140, MSC4157 and MSC4407\n * Sends a delayed sticky event into a room. If `roomId` is falsy, the client should send the event\n * into the room the user is currently looking at. The widget API will have already\n * verified that the widget is capable of sending the event to that room.\n * @param {number} stickyDurationMs The length of time a sticky event may remain sticky, in milliseconds.\n * @param {number|null} delay How much later to send the event, or null to not send the\n * event automatically. May not be null if {@link parentDelayId} is null.\n * @param {string|null} parentDelayId The ID of the delayed event this one is grouped with,\n * or null if it will be put in a new group. May not be null if {@link delay} is null.\n * @param {string} eventType The event type to be sent.\n * @param {*} content The content for the event.\n * @param {string|null} roomId The room ID to send the event to. If falsy, the room the\n * user is currently looking at.\n * @returns {Promise<ISendDelayedEventDetails>} Resolves when the event has been sent with\n * details of that event.\n * @throws Rejected when the event could not be sent.\n */\n public sendDelayedStickyEvent(\n delay: number | null,\n parentDelayId: string | null,\n stickyDurationMs: number,\n eventType: string,\n content: unknown,\n roomId: string | null = null,\n ): Promise<ISendDelayedEventDetails> {\n throw new Error(\"Method not implemented.\");\n }\n\n /**\n * @experimental Part of MSC4140 & MSC4157\n * Cancel the scheduled delivery of the delayed event matching the provided {@link delayId}.\n * @throws Rejected when there is no matching delayed event,\n * or when the delayed event failed to be cancelled.\n */\n public cancelScheduledDelayedEvent(delayId: string): Promise<void> {\n return Promise.reject(new Error(\"Failed to override function\"));\n }\n\n /**\n * @experimental Part of MSC4140 & MSC4157\n * Restart the scheduled delivery of the delayed event matching the provided {@link delayId}.\n * @throws Rejected when there is no matching delayed event,\n * or when the delayed event failed to be restarted.\n */\n public restartScheduledDelayedEvent(delayId: string): Promise<void> {\n return Promise.reject(new Error(\"Failed to override function\"));\n }\n\n /**\n * @experimental Part of MSC4140 & MSC4157\n * Immediately send the delayed event matching the provided {@link delayId},\n * instead of waiting for its scheduled delivery.\n * @throws Rejected when there is no matching delayed event,\n * or when the delayed event failed to be sent.\n */\n public sendScheduledDelayedEvent(delayId: string): Promise<void> {\n return Promise.reject(new Error(\"Failed to override function\"));\n }\n\n /**\n * Sends a to-device event. The widget API will have already verified that the widget\n * is capable of sending the event.\n * @param {string} eventType The event type to be sent.\n * @param {boolean} encrypted Whether to encrypt the message contents.\n * @param {Object} contentMap A map from user ID and device ID to event content.\n * @returns {Promise<void>} Resolves when the event has been sent.\n * @throws Rejected when the event could not be sent.\n */\n public sendToDevice(\n eventType: string,\n encrypted: boolean,\n contentMap: { [userId: string]: { [deviceId: string]: object } },\n ): Promise<void> {\n return Promise.reject(new Error(\"Failed to override function\"));\n }\n\n /**\n * Reads an element of room account data. The widget API will have already verified that the widget is\n * capable of receiving the `eventType` of the requested information. If `roomIds` is supplied, it may\n * contain `Symbols.AnyRoom` to denote that the piece of room account data in each of the client's known\n * rooms should be returned. When `null`, only the room the user is currently looking at should be considered.\n * @param eventType The event type to be read.\n * @param roomIds When null, the user's currently viewed room. Otherwise, the list of room IDs\n * to look within, possibly containing Symbols.AnyRoom to denote all known rooms.\n * @returns {Promise<IRoomAccountData[]>} Resolves to the element of room account data, or an empty array.\n */\n public readRoomAccountData(eventType: string, roomIds: string[] | null = null): Promise<IRoomAccountData[]> {\n return Promise.resolve([]);\n }\n\n /**\n * Reads all events of the given type, and optionally `msgtype` (if applicable/defined),\n * the user has access to. The widget API will have already verified that the widget is\n * capable of receiving the events. Less events than the limit are allowed to be returned,\n * but not more. If `roomIds` is supplied, it may contain `Symbols.AnyRoom` to denote that\n * `limit` in each of the client's known rooms should be returned. When `null`, only the\n * room the user is currently looking at should be considered. If `since` is specified but\n * the event ID isn't present in the number of events fetched by the client due to `limit`,\n * the client will return all the events.\n * @param eventType The event type to be read.\n * @param msgtype The msgtype of the events to be read, if applicable/defined.\n * @param stateKey The state key of the events to be read, if applicable/defined.\n * @param limit The maximum number of events to retrieve per room. Will be zero to denote \"as many\n * as possible\".\n * @param roomIds When null, the user's currently viewed room. Otherwise, the list of room IDs\n * to look within, possibly containing Symbols.AnyRoom to denote all known rooms.\n * @param since When null, retrieves the number of events specified by the \"limit\" parameter.\n * Otherwise, the event ID at which only subsequent events will be returned, as many as specified\n * in \"limit\".\n * @returns {Promise<IRoomEvent[]>} Resolves to the room events, or an empty array.\n * @deprecated Clients are advised to implement {@link WidgetDriver.readRoomTimeline} instead.\n */\n public readRoomEvents(\n eventType: string,\n msgtype: string | undefined,\n limit: number,\n roomIds: string[] | null = null,\n since?: string,\n ): Promise<IRoomEvent[]> {\n return Promise.resolve([]);\n }\n\n /**\n * Reads all events of the given type, and optionally state key (if applicable/defined),\n * the user has access to. The widget API will have already verified that the widget is\n * capable of receiving the events. Less events than the limit are allowed to be returned,\n * but not more. If `roomIds` is supplied, it may contain `Symbols.AnyRoom` to denote that\n * `limit` in each of the client's known rooms should be returned. When `null`, only the\n * room the user is currently looking at should be considered.\n * @param eventType The event type to be read.\n * @param stateKey The state key of the events to be read, if applicable/defined.\n * @param limit The maximum number of events to retrieve. Will be zero to denote \"as many\n * as possible\".\n * @param roomIds When null, the user's currently viewed room. Otherwise, the list of room IDs\n * to look within, possibly containing Symbols.AnyRoom to denote all known rooms.\n * @returns {Promise<IRoomEvent[]>} Resolves to the state events, or an empty array.\n * @deprecated Clients are advised to implement {@link WidgetDriver.readRoomTimeline} instead.\n */\n public readStateEvents(\n eventType: string,\n stateKey: string | undefined,\n limit: number,\n roomIds: string[] | null = null,\n ): Promise<IRoomEvent[]> {\n return Promise.resolve([]);\n }\n\n /**\n * Gets all sticky events of the given type the user has access to.\n * The widget API will have already verified that the widget is capable of receiving the events.\n *\n * This is needed because widgets will get only live messages as they appear in the timeline.\n * However, sticky events act like a state, and the current state is made by events that may have been\n * sent before the widget was loaded.\n * Events are sticky for 1h maximum, so the widget has access to the past hour of sticky events maximum.\n *\n * @experimental Part of MSC4407 - Sticky Events (Widget API)\n * @param roomId - The ID of the room.\n */\n public readStickyEvents(roomId: string): Promise<IRoomEvent[]> {\n throw new Error(\"readStickyEvents is not implemented\");\n }\n\n /**\n * Reads all events of the given type, and optionally `msgtype` (if applicable/defined),\n * the user has access to. The widget API will have already verified that the widget is\n * capable of receiving the events. Less events than the limit are allowed to be returned,\n * but not more.\n * @param roomId The ID of the room to look within.\n * @param eventType The event type to be read.\n * @param msgtype The msgtype of the events to be read, if applicable/defined.\n * @param stateKey The state key of the events to be read, if applicable/defined.\n * @param limit The maximum number of events to retrieve. Will be zero to denote \"as many as\n * possible\".\n * @param since When null, retrieves the number of events specified by the \"limit\" parameter.\n * Otherwise, the event ID at which only subsequent events will be returned, as many as specified\n * in \"limit\".\n * @returns {Promise<IRoomEvent[]>} Resolves to the room events, or an empty array.\n */\n public readRoomTimeline(\n roomId: string,\n eventType: string,\n msgtype: string | undefined,\n stateKey: string | undefined,\n limit: number,\n since: string | undefined,\n ): Promise<IRoomEvent[]> {\n // For backward compatibility we try the deprecated methods, in case\n // they're implemented\n if (stateKey === undefined) return this.readRoomEvents(eventType, msgtype, limit, [roomId], since);\n else return this.readStateEvents(eventType, stateKey, limit, [roomId]);\n }\n\n /**\n * Reads the current values of all matching room state entries.\n * @param roomId The ID of the room.\n * @param eventType The event type of the entries to be read.\n * @param stateKey The state key of the entry to be read. If undefined,\n * all room state entries with a matching event type should be returned.\n * @returns {Promise<IRoomEvent[]>} Resolves to the events representing the\n * current values of the room state entries.\n */\n public readRoomState(roomId: string, eventType: string, stateKey: string | undefined): Promise<IRoomEvent[]> {\n return this.readStateEvents(eventType, stateKey, Number.MAX_SAFE_INTEGER, [roomId]);\n }\n\n /**\n * Reads all events that are related to a given event. The widget API will\n * have already verified that the widget is capable of receiving the event,\n * or will make sure to reject access to events which are returned from this\n * function, but are not capable of receiving. If `relationType` or `eventType`\n * are set, the returned events should already be filtered. Less events than\n * the limit are allowed to be returned, but not more.\n * @param eventId The id of the parent event to be read.\n * @param roomId The room to look within. When undefined, the user's\n * currently viewed room.\n * @param relationType The relationship type of child events to search for.\n * When undefined, all relations are returned.\n * @param eventType The event type of child events to search for. When undefined,\n * all related events are returned.\n * @param from The pagination token to start returning results from, as\n * received from a previous call. If not supplied, results start at the most\n * recent topological event known to the server.\n * @param to The pagination token to stop returning results at. If not\n * supplied, results continue up to limit or until there are no more events.\n * @param limit The maximum number of events to retrieve per room. If not\n * supplied, the server will apply a default limit.\n * @param direction The direction to search for according to MSC3715\n * @returns Resolves to the room relations.\n */\n public readEventRelations(\n eventId: string,\n roomId?: string,\n relationType?: string,\n eventType?: string,\n from?: string,\n to?: string,\n limit?: number,\n direction?: \"f\" | \"b\",\n ): Promise<IReadEventRelationsResult> {\n return Promise.resolve({ chunk: [] });\n }\n\n /**\n * Asks the user for permission to validate their identity through OpenID Connect. The\n * interface for this function is an observable which accepts the state machine of the\n * OIDC exchange flow. For example, if the client/user blocks the request then it would\n * feed back a `{state: Blocked}` into the observable. Similarly, if the user already\n * approved the widget then a `{state: Allowed}` would be fed into the observable alongside\n * the token itself. If the client is asking for permission, it should feed in a\n * `{state: PendingUserConfirmation}` followed by the relevant Allowed or Blocked state.\n *\n * The widget API will reject the widget's request with an error if this contract is not\n * met properly. By default, the widget driver will block all OIDC requests.\n * @param {SimpleObservable<IOpenIDUpdate>} observer The observable to feed updates into.\n */\n public askOpenID(observer: SimpleObservable<IOpenIDUpdate>): void {\n observer.update({ state: OpenIDRequestState.Blocked });\n }\n\n /**\n * Navigates the client with a matrix.to URI. In future this function will also be provided\n * with the Matrix URIs once matrix.to is replaced. The given URI will have already been\n * lightly checked to ensure it looks like a valid URI, though the implementation is recommended\n * to do further checks on the URI.\n * @param {string} uri The URI to navigate to.\n * @returns {Promise<void>} Resolves when complete.\n * @throws Throws if there's a problem with the navigation, such as invalid format.\n */\n public navigate(uri: string): Promise<void> {\n throw new Error(\"Navigation is not implemented\");\n }\n\n /**\n * Polls for TURN server data, yielding an initial set of credentials as soon as possible, and\n * thereafter yielding new credentials whenever the previous ones expire. The widget API will\n * have already verified that the widget has permission to access TURN servers.\n * @yields {ITurnServer} The TURN server URIs and credentials currently available to the client.\n */\n public getTurnServers(): AsyncGenerator<ITurnServer> {\n throw new Error(\"TURN server support is not implemented\");\n }\n\n /**\n * Search for users in the user directory.\n * @param searchTerm The term to search for.\n * @param limit The maximum number of results to return. If not supplied, the\n * @returns Resolves to the search results.\n */\n public searchUserDirectory(searchTerm: string, limit?: number): Promise<ISearchUserDirectoryResult> {\n return Promise.resolve({ limited: false, results: [] });\n }\n\n /**\n * Get the config for the media repository.\n * @returns Promise which resolves with an object containing the config.\n */\n public getMediaConfig(): Promise<IGetMediaConfigResult> {\n throw new Error(\"Get media config is not implemented\");\n }\n\n /**\n * Upload a file to the media repository on the homeserver.\n * @param file - The object to upload. Something that can be sent to\n * XMLHttpRequest.send (typically a File).\n * @returns Resolves to the location of the uploaded file.\n */\n public uploadFile(file: XMLHttpRequestBodyInit): Promise<{ contentUri: string }> {\n throw new Error(\"Upload file is not implemented\");\n }\n\n /**\n * Download a file from the media repository on the homeserver.\n * @param contentUri - MXC URI of the file to download.\n * @returns Resolves to the contents of the file.\n */\n public downloadFile(contentUri: string): Promise<{ file: XMLHttpRequestBodyInit }> {\n throw new Error(\"Download file is not implemented\");\n }\n\n /**\n * Gets the IDs of all joined or invited rooms currently known to the\n * client.\n * @returns The room IDs.\n */\n public getKnownRooms(): string[] {\n throw new Error(\"Querying known rooms is not implemented\");\n }\n\n /**\n * Expresses an error thrown by this driver in a format compatible with the Widget API.\n * @param error The error to handle.\n * @returns The error expressed as a {@link IWidgetApiErrorResponseDataDetails},\n * or undefined if it cannot be expressed as one.\n */\n public processError(error: unknown): IWidgetApiErrorResponseDataDetails | undefined {\n return undefined;\n }\n}\n", "/*\nCopyright 2020 - 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n// Primary structures\nexport * from \"./WidgetApi\";\nexport * from \"./ClientWidgetApi\";\nexport * from \"./Symbols\";\n\n// Transports (not sure why you'd use these directly, but might as well export all the things)\nexport type * from \"./transport/ITransport\";\nexport * from \"./transport/PostmessageTransport\";\n\n// Interfaces and simple models\nexport type * from \"./interfaces/ICustomWidgetData\";\nexport type * from \"./interfaces/IJitsiWidgetData\";\nexport type * from \"./interfaces/IStickerpickerWidgetData\";\nexport type * from \"./interfaces/IWidget\";\nexport * from \"./interfaces/WidgetType\";\nexport * from \"./interfaces/IWidgetApiErrorResponse\";\nexport type * from \"./interfaces/IWidgetApiRequest\";\nexport type * from \"./interfaces/IWidgetApiResponse\";\nexport * from \"./interfaces/WidgetApiAction\";\nexport * from \"./interfaces/WidgetApiDirection\";\nexport * from \"./interfaces/ApiVersion\";\nexport * from \"./interfaces/Capabilities\";\nexport type * from \"./interfaces/CapabilitiesAction\";\nexport type * from \"./interfaces/ContentLoadedAction\";\nexport type * from \"./interfaces/ScreenshotAction\";\nexport type * from \"./interfaces/StickerAction\";\nexport type * from \"./interfaces/StickyAction\";\nexport type * from \"./interfaces/SupportedVersionsAction\";\nexport type * from \"./interfaces/VisibilityAction\";\nexport * from \"./interfaces/GetOpenIDAction\";\nexport type * from \"./interfaces/OpenIDCredentialsAction\";\nexport * from \"./interfaces/WidgetKind\";\nexport * from \"./interfaces/ModalButtonKind\";\nexport * from \"./interfaces/ModalWidgetActions\";\nexport type * from \"./interfaces/SetModalButtonEnabledAction\";\nexport type * from \"./interfaces/WidgetConfigAction\";\nexport type * from \"./interfaces/SendEventAction\";\nexport type * from \"./interfaces/SendToDeviceAction\";\nexport type * from \"./interfaces/ReadEventAction\";\nexport type * from \"./interfaces/IRoomEvent\";\nexport type * from \"./interfaces/IRoomAccountData\";\nexport type * from \"./interfaces/NavigateAction\";\nexport type * from \"./interfaces/TurnServerActions\";\nexport type * from \"./interfaces/ReadRelationsAction\";\nexport type * from \"./interfaces/GetMediaConfigAction\";\nexport * from \"./interfaces/UpdateDelayedEventAction\";\nexport type * from \"./interfaces/UpdateStateAction\";\nexport type * from \"./interfaces/UploadFileAction\";\nexport type * from \"./interfaces/DownloadFileAction\";\nexport type * from \"./interfaces/ThemeChangeAction\";\nexport type * from \"./interfaces/LanguageChangeAction\";\n\n// Complex models\nexport * from \"./models/WidgetEventCapability\";\nexport * from \"./models/validation/url\";\nexport * from \"./models/validation/utils\";\nexport * from \"./models/Widget\";\nexport * from \"./models/WidgetParser\";\n\n// Utilities\nexport * from \"./templating/url-template\";\nexport * from \"./util/SimpleObservable\";\n\n// Drivers\nexport * from \"./driver/WidgetDriver\";\n", "import { readFileSync } from \"node:fs\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n Category,\n MemoryStore,\n SyncAccumulator,\n type ISyncData,\n type IRooms,\n type ISyncResponse,\n type IStoredClientOpts,\n} from \"@archipelagolab/lobi-js-sdk/lib/lobi.js\";\nimport { writeJsonFileAtomically } from \"openclaw/plugin-sdk/json-store\";\nimport { isRecord } from \"../../record-shared.js\";\nimport { createAsyncLock } from \"../async-lock.js\";\nimport { LogService } from \"../sdk/logger.js\";\nimport { claimCurrentTokenStorageState } from \"./storage.js\";\n\nconst STORE_VERSION = 1;\nconst PERSIST_DEBOUNCE_MS = 250;\n\ntype PersistedMatrixSyncStore = {\n version: number;\n savedSync: ISyncData | null;\n clientOptions?: IStoredClientOpts;\n cleanShutdown?: boolean;\n};\n\nfunction normalizeRoomsData(value: unknown): IRooms | null {\n if (!isRecord(value)) {\n return null;\n }\n return {\n [Category.Join]: isRecord(value[Category.Join]) ? (value[Category.Join] as IRooms[\"join\"]) : {},\n [Category.Invite]: isRecord(value[Category.Invite])\n ? (value[Category.Invite] as IRooms[\"invite\"])\n : {},\n [Category.Leave]: isRecord(value[Category.Leave])\n ? (value[Category.Leave] as IRooms[\"leave\"])\n : {},\n [Category.Knock]: isRecord(value[Category.Knock])\n ? (value[Category.Knock] as IRooms[\"knock\"])\n : {},\n };\n}\n\nfunction toPersistedSyncData(value: unknown): ISyncData | null {\n if (!isRecord(value)) {\n return null;\n }\n if (typeof value.nextBatch === \"string\" && value.nextBatch.trim()) {\n const roomsData = normalizeRoomsData(value.roomsData);\n if (!Array.isArray(value.accountData) || !roomsData) {\n return null;\n }\n return {\n nextBatch: value.nextBatch,\n accountData: value.accountData,\n roomsData,\n };\n }\n\n // Older Matrix state files stored the raw /sync-shaped payload directly.\n if (typeof value.next_batch === \"string\" && value.next_batch.trim()) {\n const roomsData = normalizeRoomsData(value.rooms);\n if (!roomsData) {\n return null;\n }\n return {\n nextBatch: value.next_batch,\n accountData:\n isRecord(value.account_data) && Array.isArray(value.account_data.events)\n ? value.account_data.events\n : [],\n roomsData,\n };\n }\n\n return null;\n}\n\nfunction readPersistedStore(raw: string): PersistedMatrixSyncStore | null {\n try {\n const parsed = JSON.parse(raw) as {\n version?: unknown;\n savedSync?: unknown;\n clientOptions?: unknown;\n cleanShutdown?: unknown;\n };\n const savedSync = toPersistedSyncData(parsed.savedSync);\n if (parsed.version === STORE_VERSION) {\n return {\n version: STORE_VERSION,\n savedSync,\n clientOptions: isRecord(parsed.clientOptions)\n ? (parsed.clientOptions as IStoredClientOpts)\n : undefined,\n cleanShutdown: parsed.cleanShutdown === true,\n };\n }\n\n // Backward-compat: prior Matrix state files stored the raw sync blob at the\n // top level without versioning or wrapped metadata.\n return {\n version: STORE_VERSION,\n savedSync: toPersistedSyncData(parsed),\n cleanShutdown: false,\n };\n } catch {\n return null;\n }\n}\n\nfunction cloneJson<T>(value: T): T {\n return structuredClone(value);\n}\n\nfunction syncDataToSyncResponse(syncData: ISyncData): ISyncResponse {\n return {\n next_batch: syncData.nextBatch,\n rooms: syncData.roomsData,\n account_data: {\n events: syncData.accountData,\n },\n };\n}\n\nexport class FileBackedMatrixSyncStore extends MemoryStore {\n private readonly persistLock = createAsyncLock();\n private readonly accumulator = new SyncAccumulator();\n private savedSync: ISyncData | null = null;\n private savedClientOptions: IStoredClientOpts | undefined;\n private readonly hadSavedSyncOnLoad: boolean;\n private readonly hadCleanShutdownOnLoad: boolean;\n private cleanShutdown = false;\n private dirty = false;\n private persistTimer: NodeJS.Timeout | null = null;\n private persistPromise: Promise<void> | null = null;\n\n constructor(private readonly storagePath: string) {\n super();\n\n let restoredSavedSync: ISyncData | null = null;\n let restoredClientOptions: IStoredClientOpts | undefined;\n let restoredCleanShutdown = false;\n try {\n const raw = readFileSync(this.storagePath, \"utf8\");\n const persisted = readPersistedStore(raw);\n restoredSavedSync = persisted?.savedSync ?? null;\n restoredClientOptions = persisted?.clientOptions;\n restoredCleanShutdown = persisted?.cleanShutdown === true;\n } catch {\n // Missing or unreadable sync cache should not block startup.\n }\n\n this.savedSync = restoredSavedSync;\n this.savedClientOptions = restoredClientOptions;\n this.hadSavedSyncOnLoad = restoredSavedSync !== null;\n this.hadCleanShutdownOnLoad = this.hadSavedSyncOnLoad && restoredCleanShutdown;\n this.cleanShutdown = this.hadCleanShutdownOnLoad;\n\n if (this.savedSync) {\n this.accumulator.accumulate(syncDataToSyncResponse(this.savedSync), true);\n super.setSyncToken(this.savedSync.nextBatch);\n }\n if (this.savedClientOptions) {\n void super.storeClientOptions(this.savedClientOptions);\n }\n }\n\n hasSavedSync(): boolean {\n return this.hadSavedSyncOnLoad;\n }\n\n hasSavedSyncFromCleanShutdown(): boolean {\n return this.hadCleanShutdownOnLoad;\n }\n\n override getSavedSync(): Promise<ISyncData | null> {\n return Promise.resolve(this.savedSync ? cloneJson(this.savedSync) : null);\n }\n\n override getSavedSyncToken(): Promise<string | null> {\n return Promise.resolve(this.savedSync?.nextBatch ?? null);\n }\n\n override setSyncData(syncData: ISyncResponse): Promise<void> {\n this.accumulator.accumulate(syncData);\n this.savedSync = this.accumulator.getJSON();\n this.markDirtyAndSchedulePersist();\n return Promise.resolve();\n }\n\n override getClientOptions() {\n return Promise.resolve(\n this.savedClientOptions ? cloneJson(this.savedClientOptions) : undefined,\n );\n }\n\n override storeClientOptions(options: IStoredClientOpts) {\n this.savedClientOptions = cloneJson(options);\n void super.storeClientOptions(options);\n this.markDirtyAndSchedulePersist();\n return Promise.resolve();\n }\n\n override save(force = false) {\n if (force) {\n return this.flush();\n }\n return Promise.resolve();\n }\n\n override wantsSave(): boolean {\n // We persist directly from setSyncData/storeClientOptions so the SDK's\n // periodic save hook stays disabled. Shutdown uses flush() for a final sync.\n return false;\n }\n\n override async deleteAllData(): Promise<void> {\n if (this.persistTimer) {\n clearTimeout(this.persistTimer);\n this.persistTimer = null;\n }\n this.dirty = false;\n await this.persistPromise?.catch(() => undefined);\n await super.deleteAllData();\n this.savedSync = null;\n this.savedClientOptions = undefined;\n this.cleanShutdown = false;\n await fs.rm(this.storagePath, { force: true }).catch(() => undefined);\n }\n\n markCleanShutdown(): void {\n this.cleanShutdown = true;\n this.dirty = true;\n }\n\n async flush(): Promise<void> {\n if (this.persistTimer) {\n clearTimeout(this.persistTimer);\n this.persistTimer = null;\n }\n while (this.dirty || this.persistPromise) {\n if (this.dirty && !this.persistPromise) {\n this.persistPromise = this.persist().finally(() => {\n this.persistPromise = null;\n });\n }\n await this.persistPromise;\n }\n }\n\n private markDirtyAndSchedulePersist(): void {\n this.cleanShutdown = false;\n this.dirty = true;\n if (this.persistTimer) {\n return;\n }\n this.persistTimer = setTimeout(() => {\n this.persistTimer = null;\n void this.flush().catch((err) => {\n LogService.warn(\"MatrixFileSyncStore\", \"Failed to persist Matrix sync store:\", err);\n });\n }, PERSIST_DEBOUNCE_MS);\n this.persistTimer.unref?.();\n }\n\n private async persist(): Promise<void> {\n this.dirty = false;\n const payload: PersistedMatrixSyncStore = {\n version: STORE_VERSION,\n savedSync: this.savedSync ? cloneJson(this.savedSync) : null,\n cleanShutdown: this.cleanShutdown,\n ...(this.savedClientOptions ? { clientOptions: cloneJson(this.savedClientOptions) } : {}),\n };\n try {\n await this.persistLock(async () => {\n await writeJsonFileAtomically(this.storagePath, payload);\n claimCurrentTokenStorageState({\n rootDir: path.dirname(this.storagePath),\n });\n });\n } catch (err) {\n this.dirty = true;\n throw err;\n }\n }\n}\n", "/*\nCopyright 2015-2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type WidgetApi } from \"matrix-widget-api\";\n\nimport { MemoryCryptoStore } from \"./crypto/store/memory-crypto-store.ts\";\nimport { MemoryStore } from \"./store/memory.ts\";\nimport { LobiScheduler } from \"./scheduler.ts\";\nimport { LobiClient, type ICreateClientOpts } from \"./client.ts\";\nimport { RoomLobiClient, type ICapabilities } from \"./embedded.ts\";\nimport { type CryptoStore } from \"./crypto/store/base.ts\";\n\nexport * from \"./client.ts\";\nexport * from \"./serverCapabilities.ts\";\nexport * from \"./embedded.ts\";\nexport * from \"./http-api/index.ts\";\nexport * from \"./autodiscovery.ts\";\nexport * from \"./sync-accumulator.ts\";\nexport * from \"./errors.ts\";\nexport * from \"./base64.ts\";\nexport * from \"./models/beacon.ts\";\nexport * from \"./models/event.ts\";\nexport * from \"./models/room.ts\";\nexport * from \"./models/event-timeline.ts\";\nexport * from \"./models/event-timeline-set.ts\";\nexport * from \"./models/poll.ts\";\nexport * from \"./models/room-member.ts\";\nexport * from \"./models/room-state.ts\";\nexport * from \"./models/thread.ts\";\nexport * from \"./models/typed-event-emitter.ts\";\nexport * from \"./models/user.ts\";\nexport * from \"./models/device.ts\";\nexport * from \"./models/search-result.ts\";\nexport * from \"./oidc/index.ts\";\nexport * from \"./scheduler.ts\";\nexport * from \"./filter.ts\";\nexport * from \"./timeline-window.ts\";\nexport * from \"./interactive-auth.ts\";\nexport * from \"./version-support.ts\";\nexport * from \"./service-types.ts\";\nexport * from \"./store/memory.ts\";\nexport * from \"./store/indexeddb.ts\";\nexport * from \"./crypto/store/memory-crypto-store.ts\";\nexport * from \"./crypto/store/localStorage-crypto-store.ts\";\nexport * from \"./crypto/store/indexeddb-crypto-store.ts\";\nexport type { OutgoingRoomKeyRequest } from \"./crypto/store/base.ts\";\nexport * from \"./content-repo.ts\";\nexport type * from \"./@types/common.ts\";\nexport type * from \"./@types/uia.ts\";\nexport * from \"./@types/event.ts\";\nexport * from \"./@types/PushRules.ts\";\nexport * from \"./@types/partials.ts\";\nexport * from \"./@types/requests.ts\";\nexport * from \"./@types/search.ts\";\nexport * from \"./@types/beacon.ts\";\nexport * from \"./@types/topic.ts\";\nexport * from \"./@types/location.ts\";\nexport * from \"./@types/threepids.ts\";\nexport * from \"./@types/auth.ts\";\nexport * from \"./@types/polls.ts\";\nexport type * from \"./@types/local_notifications.ts\";\nexport type * from \"./@types/registration.ts\";\nexport * from \"./@types/read_receipts.ts\";\nexport type * from \"./@types/crypto.ts\";\nexport * from \"./@types/extensible_events.ts\";\nexport type * from \"./@types/IIdentityServerProvider.ts\";\nexport * from \"./@types/membership.ts\";\nexport * from \"./models/room-summary.ts\";\nexport * from \"./models/event-status.ts\";\nexport * from \"./models/profile-keys.ts\";\nexport * from \"./models/related-relations.ts\";\nexport { type StickyLobiEvent, RoomStickyEventsEvent } from \"./models/room-sticky-events.ts\";\nexport type { RoomSummary } from \"./client.ts\";\nexport * as ContentHelpers from \"./content-helpers.ts\";\nexport * as SecretStorage from \"./secret-storage.ts\";\nexport { createNewLobiCall, CallEvent } from \"./webrtc/call.ts\";\nexport type { LobiCall } from \"./webrtc/call.ts\";\nexport {\n GroupCall,\n GroupCallEvent,\n GroupCallIntent,\n GroupCallState,\n GroupCallType,\n GroupCallStatsReportEvent,\n} from \"./webrtc/groupCall.ts\";\n\nexport { SyncState, SetPresence } from \"./sync.ts\";\nexport type { ISyncStateData as SyncStateData } from \"./sync.ts\";\nexport { SlidingSyncEvent } from \"./sliding-sync.ts\";\nexport { MediaHandlerEvent } from \"./webrtc/mediaHandler.ts\";\nexport { CallFeedEvent } from \"./webrtc/callFeed.ts\";\nexport { StatsReport } from \"./webrtc/stats/statsReport.ts\";\nexport { Relations, RelationsEvent } from \"./models/relations.ts\";\nexport { TypedEventEmitter } from \"./models/typed-event-emitter.ts\";\nexport { LocalStorageErrors, localStorageErrorsEventsEmitter } from \"./store/local-storage-events-emitter.ts\";\nexport { IdentityProviderBrand, SSOAction } from \"./@types/auth.ts\";\nexport type { ISSOFlow as SSOFlow, LoginFlow } from \"./@types/auth.ts\";\nexport type { IHierarchyRelation as HierarchyRelation, IHierarchyRoom as HierarchyRoom } from \"./@types/spaces.ts\";\nexport { LocationAssetType } from \"./@types/location.ts\";\nexport { DebugLogger } from \"./logger.ts\";\n\nlet cryptoStoreFactory = (): CryptoStore => new MemoryCryptoStore();\n\n/**\n * Configure a different factory to be used for creating crypto stores\n *\n * @param fac - a function which will return a new `CryptoStore`\n */\nexport function setCryptoStoreFactory(fac: () => CryptoStore): void {\n cryptoStoreFactory = fac;\n}\n\nfunction amendClientOpts(opts: ICreateClientOpts): ICreateClientOpts {\n opts.store =\n opts.store ??\n new MemoryStore({\n localStorage: globalThis.localStorage,\n });\n opts.scheduler = opts.scheduler ?? new LobiScheduler();\n opts.cryptoStore = opts.cryptoStore ?? cryptoStoreFactory();\n\n return opts;\n}\n\n/**\n * Construct a Matrix Client. Similar to {@link LobiClient}\n * except that the 'request', 'store' and 'scheduler' dependencies are satisfied.\n * @param opts - The configuration options for this client. These configuration\n * options will be passed directly to {@link LobiClient}.\n *\n * @returns A new matrix client.\n * @see {@link LobiClient} for the full list of options for\n * `opts`.\n */\nexport function createClient(opts: ICreateClientOpts): LobiClient {\n return new LobiClient(amendClientOpts(opts));\n}\n\n/**\n * Construct a Matrix Client that works in a widget.\n * This client has a subset of features compared to a full client.\n * It uses the widget-api to communicate with matrix. (widget \\<-\\> client \\<-\\> homeserver)\n * @returns A new matrix client with a subset of features.\n * @param opts - The configuration options for this client. These configuration\n * options will be passed directly to {@link LobiClient}.\n * @param widgetApi - The widget api to use for communication.\n * @param capabilities - The capabilities the widget client will request.\n * @param roomId - The room id the widget is associated with.\n * @param sendContentLoaded - Whether to send a content loaded widget action immediately after initial setup.\n * Set to `false` if the widget uses `waitForIFrameLoad=true` (in this case the client does not expect a content loaded action at all),\n * or if the the widget wants to send the `ContentLoaded` action at a later point in time after the initial setup.\n */\nexport function createRoomLobiClient(\n widgetApi: WidgetApi,\n capabilities: ICapabilities,\n roomId: string,\n opts: ICreateClientOpts,\n sendContentLoaded = true,\n): LobiClient {\n return new RoomLobiClient(widgetApi, capabilities, roomId, amendClientOpts(opts), sendContentLoaded);\n}\n", "/*\nCopyright 2015 - 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * This is an internal module. See {@link MemoryStore} for the public class.\n */\n\nimport { type EventType } from \"../@types/event.ts\";\nimport { type Room } from \"../models/room.ts\";\nimport { type User } from \"../models/user.ts\";\nimport { type IEvent, type LobiEvent } from \"../models/event.ts\";\nimport { type RoomState, RoomStateEvent } from \"../models/room-state.ts\";\nimport { type RoomMember } from \"../models/room-member.ts\";\nimport { type Filter } from \"../filter.ts\";\nimport { type ISavedSync, type IStore, type UserCreator } from \"./index.ts\";\nimport { type RoomSummary } from \"../models/room-summary.ts\";\nimport { type ISyncResponse } from \"../sync-accumulator.ts\";\nimport { type IStateEventWithRoomId } from \"../@types/search.ts\";\nimport { type IndexedToDeviceBatch, type ToDeviceBatchWithTxnId } from \"../models/ToDeviceMessage.ts\";\nimport { type IStoredClientOpts } from \"../client.ts\";\nimport { MapWithDefault } from \"../utils.ts\";\nimport { KnownMembership } from \"../@types/membership.ts\";\n\nfunction isValidFilterId(filterId?: string | number | null): boolean {\n const isValidStr =\n typeof filterId === \"string\" &&\n !!filterId &&\n filterId !== \"undefined\" && // exclude these as we've serialized undefined in localStorage before\n filterId !== \"null\";\n\n return isValidStr || typeof filterId === \"number\";\n}\n\nexport interface IOpts {\n /** The local storage instance to persist some forms of data such as tokens. Rooms will NOT be stored. */\n localStorage?: Storage;\n}\n\nexport class MemoryStore implements IStore {\n private rooms: Record<string, Room> = {}; // roomId: Room\n private users: Record<string, User> = {}; // userId: User\n private syncToken: string | null = null;\n // userId: {\n // filterId: Filter\n // }\n private filters: MapWithDefault<string, Map<string, Filter>> = new MapWithDefault(() => new Map());\n public accountData: Map<string, LobiEvent> = new Map(); // type: content\n protected readonly localStorage?: Storage;\n private oobMembers: Map<string, IStateEventWithRoomId[]> = new Map(); // roomId: [member events]\n private pendingEvents: { [roomId: string]: Partial<IEvent>[] } = {};\n private clientOptions?: IStoredClientOpts;\n private pendingToDeviceBatches: IndexedToDeviceBatch[] = [];\n private nextToDeviceBatchId = 0;\n protected createUser?: UserCreator;\n\n /**\n * Construct a new in-memory data store for the Matrix Client.\n * @param opts - Config options\n */\n public constructor(opts: IOpts = {}) {\n this.localStorage = opts.localStorage;\n }\n\n /**\n * Retrieve the token to stream from.\n * @returns The token or null.\n */\n public getSyncToken(): string | null {\n return this.syncToken;\n }\n\n /** @returns whether or not the database was newly created in this session. */\n public isNewlyCreated(): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n /**\n * Set the token to stream from.\n * @param token - The token to stream from.\n */\n public setSyncToken(token: string): void {\n this.syncToken = token;\n }\n\n /**\n * Store the given room.\n * @param room - The room to be stored. All properties must be stored.\n */\n public storeRoom(room: Room): void {\n this.rooms[room.roomId] = room;\n // add listeners for room member changes so we can keep the room member\n // map up-to-date.\n room.currentState.on(RoomStateEvent.Members, this.onRoomMember);\n // add existing members\n room.currentState.getMembers().forEach((m) => {\n this.onRoomMember(null, room.currentState, m);\n });\n }\n\n public setUserCreator(creator: UserCreator): void {\n this.createUser = creator;\n }\n\n /**\n * Called when a room member in a room being tracked by this store has been\n * updated.\n */\n private onRoomMember = (event: LobiEvent | null, state: RoomState, member: RoomMember): void => {\n if (member.membership === KnownMembership.Invite) {\n // We do NOT add invited members because people love to typo user IDs\n // which would then show up in these lists (!)\n return;\n }\n\n const user = this.users[member.userId] || this.createUser?.(member.userId);\n if (member.name) {\n user.setDisplayName(member.name);\n if (member.events.member) {\n user.setRawDisplayName(member.events.member.getDirectionalContent().displayname);\n }\n }\n if (member.events.member && member.events.member.getContent().avatar_url) {\n user.setAvatarUrl(member.events.member.getContent().avatar_url);\n }\n this.users[user.userId] = user;\n };\n\n /**\n * Retrieve a room by its' room ID.\n * @param roomId - The room ID.\n * @returns The room or null.\n */\n public getRoom(roomId: string): Room | null {\n return this.rooms[roomId] || null;\n }\n\n /**\n * Retrieve all known rooms.\n * @returns A list of rooms, which may be empty.\n */\n public getRooms(): Room[] {\n return Object.values(this.rooms);\n }\n\n /**\n * Permanently delete a room.\n */\n public removeRoom(roomId: string): void {\n if (this.rooms[roomId]) {\n this.rooms[roomId].currentState.removeListener(RoomStateEvent.Members, this.onRoomMember);\n }\n delete this.rooms[roomId];\n }\n\n /**\n * Retrieve a summary of all the rooms.\n * @returns A summary of each room.\n */\n public getRoomSummaries(): RoomSummary[] {\n return Object.values(this.rooms).map(function (room) {\n return room.summary!;\n });\n }\n\n /**\n * Store a User.\n * @param user - The user to store.\n */\n public storeUser(user: User): void {\n this.users[user.userId] = user;\n }\n\n /**\n * Retrieve a User by its' user ID.\n * @param userId - The user ID.\n * @returns The user or null.\n */\n public getUser(userId: string): User | null {\n return this.users[userId] || null;\n }\n\n /**\n * Retrieve all known users.\n * @returns A list of users, which may be empty.\n */\n public getUsers(): User[] {\n return Object.values(this.users);\n }\n\n /**\n * Retrieve scrollback for this room.\n * @param room - The matrix room\n * @param limit - The max number of old events to retrieve.\n * @returns An array of objects which will be at most 'limit'\n * length and at least 0. The objects are the raw event JSON.\n */\n public scrollback(room: Room, limit: number): LobiEvent[] {\n return [];\n }\n\n /**\n * Store events for a room. The events have already been added to the timeline\n * @param room - The room to store events for.\n * @param events - The events to store.\n * @param token - The token associated with these events.\n * @param toStart - True if these are paginated results.\n */\n public storeEvents(room: Room, events: LobiEvent[], token: string | null, toStart: boolean): void {\n // no-op because they've already been added to the room instance.\n }\n\n /**\n * Store a filter.\n */\n public storeFilter(filter: Filter): void {\n if (!filter?.userId || !filter?.filterId) return;\n this.filters.getOrCreate(filter.userId).set(filter.filterId, filter);\n }\n\n /**\n * Retrieve a filter.\n * @returns A filter or null.\n */\n public getFilter(userId: string, filterId: string): Filter | null {\n return this.filters.get(userId)?.get(filterId) || null;\n }\n\n /**\n * Retrieve a filter ID with the given name.\n * @param filterName - The filter name.\n * @returns The filter ID or null.\n */\n public getFilterIdByName(filterName: string): string | null {\n if (!this.localStorage) {\n return null;\n }\n const key = \"mxjssdk_memory_filter_\" + filterName;\n // XXX Storage.getItem doesn't throw ...\n // or are we using something different\n // than window.localStorage in some cases\n // that does throw?\n // that would be very naughty\n try {\n const value = this.localStorage.getItem(key);\n if (isValidFilterId(value)) {\n return value;\n }\n } catch {}\n return null;\n }\n\n /**\n * Set a filter name to ID mapping.\n */\n public setFilterIdByName(filterName: string, filterId?: string): void {\n if (!this.localStorage) {\n return;\n }\n const key = \"mxjssdk_memory_filter_\" + filterName;\n try {\n if (isValidFilterId(filterId)) {\n this.localStorage.setItem(key, filterId!);\n } else {\n this.localStorage.removeItem(key);\n }\n } catch {}\n }\n\n /**\n * Store user-scoped account data events.\n * N.B. that account data only allows a single event per type, so multiple\n * events with the same type will replace each other.\n * @param events - The events to store.\n */\n public storeAccountDataEvents(events: LobiEvent[]): void {\n events.forEach((event) => {\n // MSC3391: an event with content of {} should be interpreted as deleted\n const isDeleted = !Object.keys(event.getContent()).length;\n if (isDeleted) {\n this.accountData.delete(event.getType());\n } else {\n this.accountData.set(event.getType(), event);\n }\n });\n }\n\n /**\n * Get account data event by event type\n * @param eventType - The event type being queried\n * @returns the user account_data event of given type, if any\n */\n public getAccountData(eventType: EventType | string): LobiEvent | undefined {\n return this.accountData.get(eventType);\n }\n\n /**\n * setSyncData does nothing as there is no backing data store.\n *\n * @param syncData - The sync data\n * @returns An immediately resolved promise.\n */\n public setSyncData(syncData: ISyncResponse): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * We never want to save becase we have nothing to save to.\n *\n * @returns If the store wants to save\n */\n public wantsSave(): boolean {\n return false;\n }\n\n /**\n * Save does nothing as there is no backing data store.\n * @param force - True to force a save (but the memory\n * store still can't save anything)\n */\n public save(force: boolean): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Startup does nothing as this store doesn't require starting up.\n * @returns An immediately resolved promise.\n */\n public startup(): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * @returns Promise which resolves with a sync response to restore the\n * client state to where it was at the last save, or null if there\n * is no saved sync data.\n */\n public getSavedSync(): Promise<ISavedSync | null> {\n return Promise.resolve(null);\n }\n\n /**\n * @returns If there is a saved sync, the nextBatch token\n * for this sync, otherwise null.\n */\n public getSavedSyncToken(): Promise<string | null> {\n return Promise.resolve(null);\n }\n\n /**\n * Delete all data from this store.\n * @returns An immediately resolved promise.\n */\n public deleteAllData(): Promise<void> {\n this.rooms = {\n // roomId: Room\n };\n this.users = {\n // userId: User\n };\n this.syncToken = null;\n this.filters = new MapWithDefault(() => new Map());\n this.accountData = new Map(); // type : content\n return Promise.resolve();\n }\n\n /**\n * Returns the out-of-band membership events for this room that\n * were previously loaded.\n * @returns the events, potentially an empty array if OOB loading didn't yield any new members\n * @returns in case the members for this room haven't been stored yet\n */\n public getOutOfBandMembers(roomId: string): Promise<IStateEventWithRoomId[] | null> {\n return Promise.resolve(this.oobMembers.get(roomId) || null);\n }\n\n /**\n * Stores the out-of-band membership events for this room. Note that\n * it still makes sense to store an empty array as the OOB status for the room is\n * marked as fetched, and getOutOfBandMembers will return an empty array instead of null\n * @param membershipEvents - the membership events to store\n * @returns when all members have been stored\n */\n public setOutOfBandMembers(roomId: string, membershipEvents: IStateEventWithRoomId[]): Promise<void> {\n this.oobMembers.set(roomId, membershipEvents);\n return Promise.resolve();\n }\n\n public clearOutOfBandMembers(roomId: string): Promise<void> {\n this.oobMembers.delete(roomId);\n return Promise.resolve();\n }\n\n public getClientOptions(): Promise<IStoredClientOpts | undefined> {\n return Promise.resolve(this.clientOptions);\n }\n\n public storeClientOptions(options: IStoredClientOpts): Promise<void> {\n this.clientOptions = Object.assign({}, options);\n return Promise.resolve();\n }\n\n public async getPendingEvents(roomId: string): Promise<Partial<IEvent>[]> {\n return this.pendingEvents[roomId] ?? [];\n }\n\n public async setPendingEvents(roomId: string, events: Partial<IEvent>[]): Promise<void> {\n this.pendingEvents[roomId] = events;\n }\n\n public saveToDeviceBatches(batches: ToDeviceBatchWithTxnId[]): Promise<void> {\n for (const batch of batches) {\n this.pendingToDeviceBatches.push({\n id: this.nextToDeviceBatchId++,\n eventType: batch.eventType,\n txnId: batch.txnId,\n batch: batch.batch,\n });\n }\n return Promise.resolve();\n }\n\n public async getOldestToDeviceBatch(): Promise<IndexedToDeviceBatch | null> {\n if (this.pendingToDeviceBatches.length === 0) return null;\n return this.pendingToDeviceBatches[0];\n }\n\n public removeToDeviceBatch(id: number): Promise<void> {\n this.pendingToDeviceBatches = this.pendingToDeviceBatches.filter((batch) => batch.id !== id);\n return Promise.resolve();\n }\n\n public async destroy(): Promise<void> {\n // Nothing to do\n }\n}\n", "/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport {\n type WidgetApi,\n WidgetApiToWidgetAction,\n WidgetApiResponseError,\n MatrixCapabilities,\n type IWidgetApiRequest,\n type IWidgetApiAcknowledgeResponseData,\n type ISendEventToWidgetActionRequest,\n type ISendToDeviceToWidgetActionRequest,\n type ISendEventFromWidgetResponseData,\n type IWidgetApiRequestData,\n type WidgetApiAction,\n type IWidgetApiResponse,\n type IWidgetApiResponseData,\n type IUpdateStateToWidgetActionRequest,\n UnstableApiVersion,\n} from \"matrix-widget-api\";\n\nimport { LobiEvent, type IEvent, type IContent, EventStatus } from \"./models/event.ts\";\nimport {\n type ISendEventResponse,\n type SendDelayedEventRequestOpts,\n type SendDelayedEventResponse,\n UpdateDelayedEventAction,\n isSendDelayedEventRequestOpts,\n} from \"./@types/requests.ts\";\nimport { EventType, type StateEvents } from \"./@types/event.ts\";\nimport { logger } from \"./logger.ts\";\nimport {\n LobiClient,\n ClientEvent,\n type ILobiClientCreateOpts,\n type IStartClientOpts,\n type SendToDeviceContentMap,\n type IOpenIDToken,\n UNSTABLE_MSC4140_DELAYED_EVENTS,\n} from \"./client.ts\";\nimport { SyncApi, SyncState } from \"./sync.ts\";\nimport { SlidingSyncSdk } from \"./sliding-sync-sdk.ts\";\nimport { ConnectionError, LobiError } from \"./http-api/errors.ts\";\nimport { User } from \"./models/user.ts\";\nimport { type Room } from \"./models/room.ts\";\nimport { type ToDeviceBatch, type ToDevicePayload } from \"./models/ToDeviceMessage.ts\";\nimport { MapWithDefault, type QueryDict, recursiveMapToObject } from \"./utils.ts\";\nimport { type EmptyObject, TypedEventEmitter, UnsupportedDelayedEventsEndpointError } from \"./lobi.ts\";\n\ninterface IStateEventRequest {\n eventType: string;\n stateKey?: string;\n}\n\nexport interface ICapabilities {\n /**\n * Event types that this client expects to send.\n */\n sendEvent?: string[];\n /**\n * Event types that this client expects to receive.\n */\n receiveEvent?: string[];\n\n /**\n * Message types that this client expects to send, or true for all message\n * types.\n */\n sendMessage?: string[] | true;\n /**\n * Message types that this client expects to receive, or true for all\n * message types.\n */\n receiveMessage?: string[] | true;\n\n /**\n * Types of state events that this client expects to send.\n */\n sendState?: IStateEventRequest[];\n /**\n * Types of state events that this client expects to receive.\n */\n receiveState?: IStateEventRequest[];\n\n /**\n * To-device event types that this client expects to send.\n */\n sendToDevice?: string[];\n /**\n * To-device event types that this client expects to receive.\n */\n receiveToDevice?: string[];\n\n /**\n * Whether this client needs access to TURN servers.\n * @defaultValue false\n */\n turnServers?: boolean;\n\n /**\n * Whether this client needs to be able to send delayed events.\n * @experimental Part of MSC4140 & MSC4157\n * @defaultValue false\n */\n sendDelayedEvents?: boolean;\n\n /**\n * Whether this client needs to be able to update delayed events.\n * @experimental Part of MSC4140 & MSC4157\n * @defaultValue false\n */\n updateDelayedEvents?: boolean;\n\n /**\n * Whether this client needs to be able to send sticky events.\n * @experimental Part of MSC4354 & MSC4407\n * @defaultValue false\n */\n sendSticky?: boolean;\n\n /**\n * Whether this client needs to be able to receive sticky events.\n * @experimental Part of MSC4354 & MSC4407\n * @defaultValue false\n */\n receiveSticky?: boolean;\n}\n\nexport enum RoomLobiClientEvent {\n PendingEventsChanged = \"PendingEvent.pendingEventsChanged\",\n}\nexport type EventHandlerMap = { [RoomLobiClientEvent.PendingEventsChanged]: () => void };\n\n/**\n * A LobiClient that routes its requests through the widget API instead of the\n * real CS API.\n * @experimental This class is considered unstable!\n */\nexport class RoomLobiClient extends LobiClient {\n private room?: Room;\n private readonly widgetApiReady: Promise<void>;\n private readonly roomStateSynced: Promise<void>;\n private lifecycle?: AbortController;\n private syncState: SyncState | null = null;\n\n private pendingSendingEventsTxId: { type: string; id: string | undefined; txId: string }[] = [];\n private eventEmitter = new TypedEventEmitter<keyof EventHandlerMap, EventHandlerMap>();\n\n /**\n *\n * @param widgetApi - The widget api to use for communication.\n * @param capabilities - The capabilities the widget client will request.\n * @param roomId - The room id the widget is associated with.\n * @param opts - The configuration options for this client.\n * @param sendContentLoaded - Whether to send a content loaded widget action immediately after initial setup.\n * Set to `false` if the widget uses `waitForIFrameLoad=true` (in this case the client does not expect a content loaded action at all),\n * or if the the widget wants to send the `ContentLoaded` action at a later point in time after the initial setup.\n */\n public constructor(\n private readonly widgetApi: WidgetApi,\n private readonly capabilities: ICapabilities,\n private readonly roomId: string,\n opts: ILobiClientCreateOpts,\n sendContentLoaded: boolean,\n ) {\n super(opts);\n\n const transportSend = this.widgetApi.transport.send.bind(this.widgetApi.transport);\n this.widgetApi.transport.send = async <\n T extends IWidgetApiRequestData,\n R extends IWidgetApiResponseData = IWidgetApiAcknowledgeResponseData,\n >(\n action: WidgetApiAction,\n data: T,\n ): Promise<R> => {\n try {\n return await transportSend(action, data);\n } catch (error) {\n processAndThrow(error);\n }\n };\n\n const transportSendComplete = this.widgetApi.transport.sendComplete.bind(this.widgetApi.transport);\n this.widgetApi.transport.sendComplete = async <T extends IWidgetApiRequestData, R extends IWidgetApiResponse>(\n action: WidgetApiAction,\n data: T,\n ): Promise<R> => {\n try {\n return await transportSendComplete(action, data);\n } catch (error) {\n processAndThrow(error);\n }\n };\n\n this.widgetApiReady = new Promise<void>((resolve) => this.widgetApi.once(\"ready\", resolve));\n this.roomStateSynced = capabilities.receiveState?.length\n ? new Promise<void>((resolve) =>\n this.widgetApi.once(`action:${WidgetApiToWidgetAction.UpdateState}`, resolve),\n )\n : Promise.resolve();\n\n this.requestInitialCapabilities(capabilities, roomId);\n\n widgetApi.on(`action:${WidgetApiToWidgetAction.SendEvent}`, this.onEvent);\n widgetApi.on(`action:${WidgetApiToWidgetAction.SendToDevice}`, this.onToDevice);\n widgetApi.on(`action:${WidgetApiToWidgetAction.UpdateState}`, this.onStateUpdate);\n\n // Open communication with the host\n widgetApi.start();\n // Send a content loaded event now we've started the widget API\n // Note that element-web currently does not use waitForIFrameLoad=false and so\n // does *not* (yes, that is the right way around) wait for this event. Let's\n // start sending this, then once this has rolled out, we can change element-web to\n // use waitForIFrameLoad=false and have a widget API that's less racy.\n if (sendContentLoaded) widgetApi.sendContentLoaded();\n }\n\n private requestInitialCapabilities(capabilities: ICapabilities, roomId: string): void {\n // Request capabilities for the functionality this client needs to support\n if (\n capabilities.sendEvent?.length ||\n capabilities.receiveEvent?.length ||\n capabilities.sendMessage === true ||\n (Array.isArray(capabilities.sendMessage) && capabilities.sendMessage.length) ||\n capabilities.receiveMessage === true ||\n (Array.isArray(capabilities.receiveMessage) && capabilities.receiveMessage.length) ||\n capabilities.sendState?.length ||\n capabilities.receiveState?.length\n ) {\n this.widgetApi.requestCapabilityForRoomTimeline(roomId);\n }\n capabilities.sendEvent?.forEach((eventType) => this.widgetApi.requestCapabilityToSendEvent(eventType));\n capabilities.receiveEvent?.forEach((eventType) => this.widgetApi.requestCapabilityToReceiveEvent(eventType));\n if (capabilities.sendMessage === true) {\n this.widgetApi.requestCapabilityToSendMessage();\n } else if (Array.isArray(capabilities.sendMessage)) {\n capabilities.sendMessage.forEach((msgType) => this.widgetApi.requestCapabilityToSendMessage(msgType));\n }\n if (capabilities.receiveMessage === true) {\n this.widgetApi.requestCapabilityToReceiveMessage();\n } else if (Array.isArray(capabilities.receiveMessage)) {\n capabilities.receiveMessage.forEach((msgType) => this.widgetApi.requestCapabilityToReceiveMessage(msgType));\n }\n capabilities.sendState?.forEach(({ eventType, stateKey }) =>\n this.widgetApi.requestCapabilityToSendState(eventType, stateKey),\n );\n capabilities.receiveState?.forEach(({ eventType, stateKey }) =>\n this.widgetApi.requestCapabilityToReceiveState(eventType, stateKey),\n );\n capabilities.sendToDevice?.forEach((eventType) => this.widgetApi.requestCapabilityToSendToDevice(eventType));\n capabilities.receiveToDevice?.forEach((eventType) =>\n this.widgetApi.requestCapabilityToReceiveToDevice(eventType),\n );\n if (\n capabilities.sendDelayedEvents &&\n (capabilities.sendEvent?.length ||\n capabilities.sendMessage === true ||\n (Array.isArray(capabilities.sendMessage) && capabilities.sendMessage.length) ||\n capabilities.sendState?.length)\n ) {\n this.widgetApi.requestCapability(MatrixCapabilities.MSC4157SendDelayedEvent);\n }\n if (capabilities.updateDelayedEvents) {\n this.widgetApi.requestCapability(MatrixCapabilities.MSC4157UpdateDelayedEvent);\n }\n if (capabilities.sendSticky) {\n this.widgetApi.requestCapability(MatrixCapabilities.MSC4407SendStickyEvent);\n }\n if (capabilities.receiveSticky) {\n this.widgetApi.requestCapability(MatrixCapabilities.MSC4407ReceiveStickyEvent);\n }\n if (capabilities.turnServers) {\n this.widgetApi.requestCapability(MatrixCapabilities.MSC3846TurnServers);\n }\n }\n\n public async supportUpdateState(): Promise<boolean> {\n return (await this.widgetApi.getClientVersions()).includes(UnstableApiVersion.MSC2762_UPDATE_STATE);\n }\n\n private readonly syncApiResolver = Promise.withResolvers<void>();\n public async startClient(opts: IStartClientOpts = {}): Promise<void> {\n this.lifecycle = new AbortController();\n\n // Create our own user object artificially (instead of waiting for sync)\n // so it's always available, even if the user is not in any rooms etc.\n const userId = this.getUserId();\n if (userId) {\n this.store.storeUser(new User(userId));\n }\n\n // Even though we have no access token and cannot sync, the sync class\n // still has some valuable helper methods that we make use of, so we\n // instantiate it anyways\n if (opts.slidingSync) {\n this.syncApi = new SlidingSyncSdk(opts.slidingSync, this, opts, this.buildSyncApiOptions());\n } else {\n this.syncApi = new SyncApi(this, opts, this.buildSyncApiOptions());\n }\n this.syncApiResolver.resolve();\n\n this.room = this.syncApi.createRoom(this.roomId);\n this.store.storeRoom(this.room);\n\n await this.widgetApiReady;\n\n // sync room state:\n if (await this.supportUpdateState()) {\n // This will resolve once the client driver has sent us all the allowed room state.\n await this.roomStateSynced;\n } else {\n // Backfill the requested events\n // We only get the most recent event for every type + state key combo,\n // so it doesn't really matter what order we inject them in\n await Promise.all(\n this.capabilities.receiveState?.map(async ({ eventType, stateKey }) => {\n const rawEvents = await this.widgetApi.readStateEvents(eventType, undefined, stateKey, [\n this.roomId,\n ]);\n const events = rawEvents.map((rawEvent) => new LobiEvent(rawEvent as Partial<IEvent>));\n\n if (this.syncApi instanceof SyncApi) {\n // Passing events as `stateAfterEventList` will update the state.\n await this.syncApi.injectRoomEvents(this.room!, undefined, events);\n } else {\n await this.syncApi!.injectRoomEvents(this.room!, events); // Sliding Sync\n }\n events.forEach((event) => {\n this.emit(ClientEvent.Event, event);\n logger.info(`Backfilled event ${event.getId()} ${event.getType()} ${event.getStateKey()}`);\n });\n }) ?? [],\n );\n }\n\n if (opts.clientWellKnownPollPeriod !== undefined) {\n this.clientWellKnownIntervalID = setInterval(() => {\n this.fetchClientWellKnown();\n }, 1000 * opts.clientWellKnownPollPeriod);\n this.fetchClientWellKnown();\n }\n this.setSyncState(SyncState.Syncing);\n logger.info(\"Finished initial sync\");\n\n this.matrixRTC.start();\n\n // Watch for TURN servers, if requested\n if (this.capabilities.turnServers) this.watchTurnServers();\n }\n\n public stopClient(): void {\n this.widgetApi.off(`action:${WidgetApiToWidgetAction.SendEvent}`, this.onEvent);\n this.widgetApi.off(`action:${WidgetApiToWidgetAction.SendToDevice}`, this.onToDevice);\n this.widgetApi.off(`action:${WidgetApiToWidgetAction.UpdateState}`, this.onStateUpdate);\n\n super.stopClient();\n this.lifecycle!.abort(); // Signal to other async tasks that the client has stopped\n }\n\n public async joinRoom(roomIdOrAlias: string): Promise<Room> {\n if (roomIdOrAlias === this.roomId) return this.room!;\n throw new Error(`Unknown room: ${roomIdOrAlias}`);\n }\n\n protected async encryptAndSendEvent(\n room: Room,\n event: LobiEvent,\n queryDict?: QueryDict,\n ): Promise<ISendEventResponse>;\n protected async encryptAndSendEvent(\n room: Room,\n event: LobiEvent,\n delayOpts: SendDelayedEventRequestOpts,\n queryDict?: QueryDict,\n ): Promise<ISendEventResponse>;\n protected async encryptAndSendEvent(\n room: Room,\n event: LobiEvent,\n delayOptsOrQuery?: SendDelayedEventRequestOpts | QueryDict,\n queryDict?: QueryDict,\n ): Promise<ISendEventResponse | SendDelayedEventResponse> {\n let queryOpts = queryDict;\n let delayOpts: SendDelayedEventRequestOpts | undefined;\n if (delayOptsOrQuery && isSendDelayedEventRequestOpts(delayOptsOrQuery)) {\n delayOpts = delayOptsOrQuery;\n } else if (!queryOpts) {\n queryOpts = delayOptsOrQuery;\n }\n\n const stickyDurationMs = queryOpts?.[\"org.matrix.msc4354.sticky_duration_ms\"];\n if (stickyDurationMs !== undefined && typeof stickyDurationMs !== \"number\") {\n throw new Error(\"Sticky duration must be a number when defined\");\n }\n // This is save since we just checked that above\n // We need the additional as assertion for the EW linter to be happy.\n // It is not capable of implying the type based on the throw if `stickyDurationMs !== undefined && typeof stickyDurationMs !== \"number\"`\n // above\n const stickyDurationMsAsNumber: number | undefined = stickyDurationMs as number | undefined;\n\n // We need to extend the content with the redacts parameter\n // The js sdk uses event.redacts but the widget api uses event.content.redacts\n // This will be converted back to event.redacts in the widget driver.\n const content = event.event.redacts\n ? { ...event.getContent(), redacts: event.event.redacts }\n : event.getContent();\n\n // Delayed event special case.\n if (delayOpts) {\n // TODO: updatePendingEvent for delayed events?\n const response = await this.widgetApi\n .sendRoomEvent(\n event.getType(),\n content,\n room.roomId,\n \"delay\" in delayOpts ? delayOpts.delay : undefined,\n \"parent_delay_id\" in delayOpts ? delayOpts.parent_delay_id : undefined,\n stickyDurationMsAsNumber,\n )\n .catch(timeoutToConnectionError);\n return this.validateSendDelayedEventResponse(response);\n }\n\n const txId = event.getTxnId();\n // Add the txnId to the pending list (still with unknown evID)\n if (txId) this.pendingSendingEventsTxId.push({ type: event.getType(), id: undefined, txId });\n\n let response: ISendEventFromWidgetResponseData;\n try {\n response = await this.widgetApi\n .sendRoomEvent(event.getType(), content, room.roomId, undefined, undefined, stickyDurationMsAsNumber)\n .catch(timeoutToConnectionError);\n } catch (e) {\n this.updatePendingEventStatus(room, event, EventStatus.NOT_SENT);\n throw e;\n }\n // This also checks for an event id on the response\n room.updatePendingEvent(event, EventStatus.SENT, response.event_id);\n\n // Update the pending events list with the eventId\n this.pendingSendingEventsTxId.forEach((p) => {\n if (p.txId === txId) p.id = response.event_id;\n });\n this.eventEmitter.emit(RoomLobiClientEvent.PendingEventsChanged);\n\n return { event_id: response.event_id! };\n }\n\n public async sendStateEvent(\n roomId: string,\n eventType: string,\n content: any,\n stateKey = \"\",\n ): Promise<ISendEventResponse> {\n const response = await this.widgetApi\n .sendStateEvent(eventType, stateKey, content, roomId)\n .catch(timeoutToConnectionError);\n if (response.event_id === undefined) {\n throw new Error(\"'event_id' absent from response to an event request\");\n }\n return { event_id: response.event_id };\n }\n\n /**\n * @experimental This currently relies on an unstable MSC (MSC4140).\n */\n // eslint-disable-next-line\n public async _unstable_sendDelayedStateEvent<K extends keyof StateEvents>(\n roomId: string,\n delayOpts: SendDelayedEventRequestOpts,\n eventType: K,\n content: StateEvents[K],\n stateKey = \"\",\n ): Promise<SendDelayedEventResponse> {\n if (!(await this.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {\n throw new UnsupportedDelayedEventsEndpointError(\n \"Server does not support the delayed events API\",\n \"sendDelayedStateEvent\",\n );\n }\n\n const response = await this.widgetApi\n .sendStateEvent(\n eventType,\n stateKey,\n content,\n roomId,\n \"delay\" in delayOpts ? delayOpts.delay : undefined,\n \"parent_delay_id\" in delayOpts ? delayOpts.parent_delay_id : undefined,\n )\n .catch(timeoutToConnectionError);\n return this.validateSendDelayedEventResponse(response);\n }\n\n private validateSendDelayedEventResponse(response: ISendEventFromWidgetResponseData): SendDelayedEventResponse {\n if (response.delay_id === undefined) {\n throw new Error(\"'delay_id' absent from response to a delayed event request\");\n }\n return { delay_id: response.delay_id };\n }\n\n /**\n * @experimental This currently relies on an unstable MSC (MSC4140).\n * @deprecated Instead use one of:\n * - {@link _unstable_cancelScheduledDelayedEvent}\n * - {@link _unstable_restartScheduledDelayedEvent}\n * - {@link _unstable_sendScheduledDelayedEvent}\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public async _unstable_updateDelayedEvent(delayId: string, action: UpdateDelayedEventAction): Promise<EmptyObject> {\n if (!(await this.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {\n throw new UnsupportedDelayedEventsEndpointError(\n \"Server does not support the delayed events API\",\n \"updateDelayedEvent\",\n );\n }\n\n let updateDelayedEvent: (delayId: string) => Promise<unknown>;\n switch (action) {\n case UpdateDelayedEventAction.Cancel:\n updateDelayedEvent = this.widgetApi.cancelScheduledDelayedEvent;\n break;\n case UpdateDelayedEventAction.Restart:\n updateDelayedEvent = this.widgetApi.cancelScheduledDelayedEvent;\n break;\n case UpdateDelayedEventAction.Send:\n updateDelayedEvent = this.widgetApi.sendScheduledDelayedEvent;\n break;\n }\n await updateDelayedEvent.call(this.widgetApi, delayId).catch(timeoutToConnectionError);\n return {};\n }\n\n /**\n * @experimental This currently relies on an unstable MSC (MSC4140).\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public async _unstable_cancelScheduledDelayedEvent(delayId: string): Promise<EmptyObject> {\n if (!(await this.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {\n throw new UnsupportedDelayedEventsEndpointError(\n \"Server does not support the delayed events API\",\n \"cancelScheduledDelayedEvent\",\n );\n }\n\n await this.widgetApi.cancelScheduledDelayedEvent(delayId).catch(timeoutToConnectionError);\n return {};\n }\n\n /**\n * @experimental This currently relies on an unstable MSC (MSC4140).\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public async _unstable_restartScheduledDelayedEvent(delayId: string): Promise<EmptyObject> {\n if (!(await this.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {\n throw new UnsupportedDelayedEventsEndpointError(\n \"Server does not support the delayed events API\",\n \"restartScheduledDelayedEvent\",\n );\n }\n\n await this.widgetApi.restartScheduledDelayedEvent(delayId).catch(timeoutToConnectionError);\n return {};\n }\n\n /**\n * @experimental This currently relies on an unstable MSC (MSC4140).\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public async _unstable_sendScheduledDelayedEvent(delayId: string): Promise<EmptyObject> {\n if (!(await this.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {\n throw new UnsupportedDelayedEventsEndpointError(\n \"Server does not support the delayed events API\",\n \"sendScheduledDelayedEvent\",\n );\n }\n\n await this.widgetApi.sendScheduledDelayedEvent(delayId).catch(timeoutToConnectionError);\n return {};\n }\n\n /**\n * by {@link LobiClient.encryptAndSendToDevice}.\n */\n public async encryptAndSendToDevice(\n eventType: string,\n devices: { userId: string; deviceId: string }[],\n payload: ToDevicePayload,\n ): Promise<void> {\n // map: user Id → device Id → payload\n const contentMap: MapWithDefault<string, Map<string, ToDevicePayload>> = new MapWithDefault(() => new Map());\n for (const { userId, deviceId } of devices) {\n contentMap.getOrCreate(userId).set(deviceId, payload);\n }\n\n await this.widgetApi\n .sendToDevice(eventType, true, recursiveMapToObject(contentMap))\n .catch(timeoutToConnectionError);\n }\n\n public async sendToDevice(eventType: string, contentMap: SendToDeviceContentMap): Promise<EmptyObject> {\n await this.widgetApi\n .sendToDevice(eventType, false, recursiveMapToObject(contentMap))\n .catch(timeoutToConnectionError);\n return {};\n }\n\n public async getOpenIdToken(): Promise<IOpenIDToken> {\n const token = await this.widgetApi.requestOpenIDConnectToken().catch(timeoutToConnectionError);\n // the IOpenIDCredentials from the widget-api and IOpenIDToken form the lobi-js-sdk are compatible.\n // we still recreate the token to make this transparent and catch'able by the linter in case the types change in the future.\n return <IOpenIDToken>{\n access_token: token.access_token,\n expires_in: token.expires_in,\n matrix_server_name: token.matrix_server_name,\n token_type: token.token_type,\n };\n }\n\n public async queueToDevice({ eventType, batch }: ToDeviceBatch): Promise<void> {\n // map: user Id → device Id → payload\n const contentMap: MapWithDefault<string, Map<string, ToDevicePayload>> = new MapWithDefault(() => new Map());\n for (const { userId, deviceId, payload } of batch) {\n contentMap.getOrCreate(userId).set(deviceId, payload);\n }\n\n await this.widgetApi\n .sendToDevice(eventType, false, recursiveMapToObject(contentMap))\n .catch(timeoutToConnectionError);\n }\n\n /**\n * Send an event to a specific list of devices via the widget API. Optionally encrypts the event.\n *\n * If you are using a full LobiClient you would be calling {@link LobiClient.getCrypto().encryptToDeviceMessages()} followed\n * by {@link LobiClient.queueToDevice}.\n *\n * However, this is combined into a single step when running as an embedded widget client. So, we expose this method for those\n * that need it.\n *\n * @param eventType - Type of the event to send.\n * @param encrypted - Whether the event should be encrypted.\n * @param contentMap - The content to send. Map from user_id to device_id to content object.\n */\n public async sendToDeviceViaWidgetApi(\n eventType: string,\n encrypted: boolean,\n contentMap: SendToDeviceContentMap,\n ): Promise<void> {\n await this.widgetApi\n .sendToDevice(eventType, encrypted, recursiveMapToObject(contentMap))\n .catch(timeoutToConnectionError);\n }\n\n // Overridden since we get TURN servers automatically over the widget API,\n // and this method would otherwise complain about missing an access token\n public async checkTurnServers(): Promise<boolean> {\n return this.turnServers.length > 0;\n }\n\n // Overridden since we 'sync' manually without the sync API\n public getSyncState(): SyncState | null {\n return this.syncState;\n }\n\n private setSyncState(state: SyncState): void {\n const oldState = this.syncState;\n this.syncState = state;\n this.emit(ClientEvent.Sync, state, oldState);\n }\n\n private async ack(ev: CustomEvent<IWidgetApiRequest>): Promise<void> {\n await this.widgetApi.transport.reply<IWidgetApiAcknowledgeResponseData>(ev.detail, {});\n }\n\n private updateTxId = async (event: LobiEvent): Promise<void> => {\n // We update the txId for remote echos that originate from this client.\n // This happens with the help of `pendingSendingEventsTxId` where we store all events that are currently sending\n // with their widget txId and once ready the final evId.\n if (\n // This could theoretically be an event send by this device\n // In that case we need to update the txId of the event because the embedded client/widget\n // knows this event with a different transaction Id than what was used by the host client.\n event.getSender() === this.getUserId() &&\n // We optimize by not blocking events from types that we have not send\n // with this client.\n this.pendingSendingEventsTxId.some((p) => event.getType() === p.type)\n ) {\n // Compare by event Id if we have a matching pending event where we know the txId.\n let matchingTxId = this.pendingSendingEventsTxId.find((p) => p.id === event.getId())?.txId;\n // Block any further processing of this event until we have received the sending response.\n // -> until we know the event id.\n // -> until we have not pending events anymore.\n while (!matchingTxId && this.pendingSendingEventsTxId.length > 0) {\n // Recheck whenever the PendingEventsChanged\n await new Promise<void>((resolve) =>\n this.eventEmitter.once(RoomLobiClientEvent.PendingEventsChanged, () => resolve()),\n );\n matchingTxId = this.pendingSendingEventsTxId.find((p) => p.id === event.getId())?.txId;\n }\n\n // We found the correct txId: we update the event and delete the entry of the pending events.\n if (matchingTxId) {\n event.setTxnId(matchingTxId);\n event.setUnsigned({ ...event.getUnsigned(), transaction_id: matchingTxId });\n }\n this.pendingSendingEventsTxId = this.pendingSendingEventsTxId.filter((p) => p.id !== event.getId());\n\n // Emit once there are no pending events anymore to release all other events that got\n // awaited in the `while (!matchingTxId && this.pendingSendingEventsTxId.length > 0)` loop\n // but are not send by this client.\n if (this.pendingSendingEventsTxId.length === 0) {\n this.eventEmitter.emit(RoomLobiClientEvent.PendingEventsChanged);\n }\n }\n };\n\n private onEvent = async (ev: CustomEvent<ISendEventToWidgetActionRequest>): Promise<void> => {\n ev.preventDefault();\n\n // Verify the room ID matches, since it's possible for the client to\n // send us events from other rooms if this widget is always on screen\n if (ev.detail.data.room_id === this.roomId) {\n const event = new LobiEvent(ev.detail.data as Partial<IEvent>);\n\n // Only inject once we have update the txId\n await this.updateTxId(event);\n await this.syncApiResolver.promise;\n if (this.syncApi instanceof SyncApi) {\n if (await this.supportUpdateState()) {\n await this.syncApi.injectRoomEvents(this.room!, undefined, [], [event]);\n } else {\n // Passing undefined for `stateAfterEventList` will make `injectRoomEvents` run in legacy mode\n // -> state events in `timelineEventList` will update the state.\n await this.syncApi.injectRoomEvents(this.room!, [], undefined, [event]);\n }\n } else {\n // Sliding Sync\n if (await this.supportUpdateState()) {\n await this.syncApi!.injectRoomEvents(this.room!, [], [event]);\n } else {\n logger.error(\n \"slididng sync cannot be used in widget mode if the client widget driver does not support the version: 'org.matrix.msc2762_update_state'\",\n );\n }\n }\n\n this.emit(ClientEvent.Event, event);\n if (event.unstableStickyInfo !== undefined) this.room!._unstable_addStickyEvents([event]);\n this.setSyncState(SyncState.Syncing);\n logger.info(`Received event ${event.getId()} ${event.getType()}`);\n } else {\n const { event_id: eventId, room_id: roomId } = ev.detail.data;\n logger.info(`Received event ${eventId} for a different room ${roomId}; discarding`);\n }\n\n await this.ack(ev);\n };\n\n private onToDevice = async (ev: CustomEvent<ISendToDeviceToWidgetActionRequest>): Promise<void> => {\n ev.preventDefault();\n\n const event = new LobiEvent({\n type: ev.detail.data.type,\n sender: ev.detail.data.sender,\n content: ev.detail.data.content as IContent,\n });\n // Mark the event as encrypted if it was, using fake contents and keys since those are unknown to us\n if (ev.detail.data.encrypted) event.makeEncrypted(EventType.RoomMessageEncrypted, {}, \"\", \"\");\n\n this.emit(ClientEvent.ToDeviceEvent, event);\n this.setSyncState(SyncState.Syncing);\n await this.ack(ev);\n };\n\n private onStateUpdate = async (ev: CustomEvent<IUpdateStateToWidgetActionRequest>): Promise<void> => {\n ev.preventDefault();\n if (!(await this.supportUpdateState())) {\n logger.warn(\n \"received update_state widget action but the widget driver did not claim to support 'org.matrix.msc2762_update_state'\",\n );\n }\n await this.syncApiResolver.promise;\n for (const rawEvent of ev.detail.data.state) {\n // Verify the room ID matches, since it's possible for the client to\n // send us state updates from other rooms if this widget is always\n // on screen\n if (rawEvent.room_id === this.roomId) {\n const event = new LobiEvent(rawEvent as Partial<IEvent>);\n\n if (this.syncApi instanceof SyncApi) {\n await this.syncApi.injectRoomEvents(this.room!, undefined, [event]);\n } else {\n // Sliding Sync\n await this.syncApi!.injectRoomEvents(this.room!, [event]);\n }\n logger.debug(`Updated state entry ${event.getType()} ${event.getStateKey()} to ${event.getId()}`);\n } else {\n const { event_id: eventId, room_id: roomId } = ev.detail.data;\n logger.info(`Received state entry ${eventId} for a different room ${roomId}; discarding`);\n }\n }\n\n await this.ack(ev);\n };\n\n private async watchTurnServers(): Promise<void> {\n const servers = this.widgetApi.getTurnServers();\n const onClientStopped = (): void => {\n servers.return(undefined);\n };\n this.lifecycle!.signal.addEventListener(\"abort\", onClientStopped);\n\n try {\n for await (const server of servers) {\n this.turnServers = [\n {\n urls: server.uris,\n username: server.username,\n credential: server.password,\n },\n ];\n this.emit(ClientEvent.TurnServers, this.turnServers);\n logger.log(`Received TURN server: ${server.uris}`);\n }\n } catch (e) {\n logger.warn(\"Error watching TURN servers\", e);\n } finally {\n this.lifecycle!.signal.removeEventListener(\"abort\", onClientStopped);\n }\n }\n}\n\nfunction processAndThrow(error: unknown): never {\n if (error instanceof WidgetApiResponseError && error.data.matrix_api_error) {\n throw LobiError.fromWidgetApiErrorData(error.data.matrix_api_error);\n } else {\n throw error;\n }\n}\n\n/**\n * This converts an \"Request timed out\" error from the PostmessageTransport into a ConnectionError.\n * It either throws the original error or a new ConnectionError.\n **/\nfunction timeoutToConnectionError(error: unknown): never {\n // TODO: this should not check on error.message but instead it should be a specific type\n // error instanceof WidgetTimeoutError\n if (error instanceof Error && error.message === \"Request timed out\") {\n throw new ConnectionError(\"widget api timeout\");\n }\n throw error;\n}\n", "/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type IMinimalEvent } from \"./sync-accumulator.ts\";\nimport { EventType } from \"./@types/event.ts\";\nimport { isSupportedReceiptType, MapWithDefault, recursiveMapToObject } from \"./utils.ts\";\nimport { type IContent } from \"./models/event.ts\";\nimport { type ReceiptContent, type ReceiptType } from \"./@types/read_receipts.ts\";\n\ninterface AccumulatedReceipt {\n data: IMinimalEvent;\n type: ReceiptType;\n eventId: string;\n}\n\n/**\n * Summarises the read receipts within a room. Used by the sync accumulator.\n *\n * Given receipts for users, picks the most recently-received one and provides\n * the results in a new fake receipt event returned from\n * buildAccumulatedReceiptEvent().\n *\n * Handles unthreaded receipts and receipts in each thread separately, so the\n * returned event contains the most recently received unthreaded receipt, and\n * the most recently received receipt in each thread.\n */\nexport class ReceiptAccumulator {\n /** user_id -\\> most-recently-received unthreaded receipt */\n private unthreadedReadReceipts: Map<string, AccumulatedReceipt> = new Map();\n\n /** thread_id -\\> user_id -\\> most-recently-received receipt for this thread */\n private threadedReadReceipts: MapWithDefault<string, Map<string, AccumulatedReceipt>> = new MapWithDefault(\n () => new Map(),\n );\n\n /**\n * Provide an unthreaded receipt for this user. Overwrites any other\n * unthreaded receipt we have for this user.\n */\n private setUnthreaded(userId: string, receipt: AccumulatedReceipt): void {\n this.unthreadedReadReceipts.set(userId, receipt);\n }\n\n /**\n * Provide a receipt for this user in this thread. Overwrites any other\n * receipt we have for this user in this thread.\n */\n private setThreaded(threadId: string, userId: string, receipt: AccumulatedReceipt): void {\n this.threadedReadReceipts.getOrCreate(threadId).set(userId, receipt);\n }\n\n /**\n * @returns an iterator of pairs of [userId, AccumulatedReceipt] - all the\n * most recently-received unthreaded receipts for each user.\n */\n private allUnthreaded(): IterableIterator<[string, AccumulatedReceipt]> {\n return this.unthreadedReadReceipts.entries();\n }\n\n /**\n * @returns an iterator of pairs of [userId, AccumulatedReceipt] - all the\n * most recently-received threaded receipts for each user, in all\n * threads.\n */\n private *allThreaded(): IterableIterator<[string, AccumulatedReceipt]> {\n for (const receiptsForThread of this.threadedReadReceipts.values()) {\n for (const e of receiptsForThread.entries()) {\n yield e;\n }\n }\n }\n\n /**\n * Given a list of ephemeral events, find the receipts and store the\n * relevant ones to be returned later from buildAccumulatedReceiptEvent().\n */\n public consumeEphemeralEvents(events: IMinimalEvent[] | undefined): void {\n events?.forEach((e) => {\n if (e.type !== EventType.Receipt || !e.content) {\n // This means we'll drop unknown ephemeral events but that\n // seems okay.\n return;\n }\n\n // Handle m.receipt events. They clobber based on:\n // (user_id, receipt_type)\n // but they are keyed in the event as:\n // content:{ $event_id: { $receipt_type: { $user_id: {json} }}}\n // so store them in the former so we can accumulate receipt deltas\n // quickly and efficiently (we expect a lot of them). Fold the\n // receipt type into the key name since we only have 1 at the\n // moment (m.read) and nested JSON objects are slower and more\n // of a hassle to work with. We'll inflate this back out when\n // getJSON() is called.\n Object.keys(e.content).forEach((eventId) => {\n Object.entries<ReceiptContent>(e.content[eventId]).forEach(([key, value]) => {\n if (!isSupportedReceiptType(key)) return;\n\n for (const userId of Object.keys(value)) {\n const data = e.content[eventId][key][userId];\n\n const receipt = {\n data: e.content[eventId][key][userId],\n type: key as ReceiptType,\n eventId,\n };\n\n // In a world that supports threads, read receipts normally have\n // a `thread_id` which is either the thread they belong in or\n // `MAIN_ROOM_TIMELINE`, so we normally use `setThreaded(...)`\n // here. The `MAIN_ROOM_TIMELINE` is just treated as another\n // thread.\n //\n // We still encounter read receipts that are \"unthreaded\"\n // (missing the `thread_id` property). These come from clients\n // that don't support threads, and from threaded clients that\n // are doing a \"Mark room as read\" operation. Unthreaded\n // receipts mark everything \"before\" them as read, in all\n // threads, where \"before\" means in Sync Order i.e. the order\n // the events were received from the homeserver in a sync.\n // [Note: we have some bugs where we use timestamp order instead\n // of Sync Order, because we don't correctly remember the Sync\n // Order. See #3325.]\n //\n // Calling the wrong method will cause incorrect behavior like\n // messages re-appearing as \"new\" when you already read them\n // previously.\n if (!data.thread_id) {\n this.setUnthreaded(userId, receipt);\n } else {\n this.setThreaded(data.thread_id, userId, receipt);\n }\n }\n });\n });\n });\n }\n\n /**\n * Build a receipt event that contains all relevant information for this\n * room, taking the most recently received receipt for each user in an\n * unthreaded context, and in each thread.\n */\n public buildAccumulatedReceiptEvent(roomId: string): IMinimalEvent | null {\n const receiptEvent: IMinimalEvent = {\n type: EventType.Receipt,\n room_id: roomId,\n content: {\n // $event_id: { \"m.read\": { $user_id: $json } }\n } as IContent,\n };\n\n const receiptEventContent: MapWithDefault<\n string,\n MapWithDefault<ReceiptType, Map<string, object>>\n > = new MapWithDefault(() => new MapWithDefault(() => new Map()));\n\n for (const [userId, receiptData] of this.allUnthreaded()) {\n receiptEventContent\n .getOrCreate(receiptData.eventId)\n .getOrCreate(receiptData.type)\n .set(userId, receiptData.data);\n }\n\n for (const [userId, receiptData] of this.allThreaded()) {\n receiptEventContent\n .getOrCreate(receiptData.eventId)\n .getOrCreate(receiptData.type)\n .set(userId, receiptData.data);\n }\n\n receiptEvent.content = recursiveMapToObject(receiptEventContent);\n\n return receiptEventContent.size > 0 ? receiptEvent : null;\n }\n}\n", "/*\nCopyright 2017 - 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * This is an internal module. See {@link SyncAccumulator} for the public class.\n */\n\nimport { logger } from \"./logger.ts\";\nimport { deepCopy } from \"./utils.ts\";\nimport { MAX_STICKY_DURATION_MS, type IContent, type IUnsigned } from \"./models/event.ts\";\nimport { type IRoomSummary } from \"./models/room-summary.ts\";\nimport { type EventType } from \"./@types/event.ts\";\nimport { UNREAD_THREAD_NOTIFICATIONS } from \"./@types/sync.ts\";\nimport { ReceiptAccumulator } from \"./receipt-accumulator.ts\";\nimport { type OlmEncryptionInfo } from \"./crypto-api/index.ts\";\n\ninterface IOpts {\n /**\n * The ideal maximum number of timeline entries to keep in the sync response.\n * This is best-effort, as clients do not always have a back-pagination token for each event,\n * so it's possible there may be slightly *less* than this value. There will never be more.\n * This cannot be 0 or else it makes it impossible to scroll back in a room.\n * Default: 50.\n */\n maxTimelineEntries?: number;\n}\n\nexport interface IMinimalEvent {\n content: IContent;\n type: EventType | string;\n room_id?: string;\n unsigned?: IUnsigned;\n}\n\nexport interface IEphemeral {\n events: IMinimalEvent[];\n}\n\n/* eslint-disable camelcase */\ninterface UnreadNotificationCounts {\n highlight_count?: number;\n notification_count?: number;\n}\n\nexport interface IRoomEvent extends IMinimalEvent {\n event_id: string;\n sender: string;\n origin_server_ts: number;\n}\n\nexport interface IStateEvent extends IRoomEvent {\n prev_content?: IContent;\n state_key: string;\n}\n\ninterface IState {\n events: IStateEvent[];\n}\n\nexport interface ITimeline {\n events: Array<IRoomEvent | IStateEvent>;\n limited?: boolean;\n prev_batch: string | null;\n}\n\ntype StickyEventFields = {\n msc4354_sticky: { duration_ms: number };\n content: { msc4354_sticky_key?: string };\n};\n\nexport type IStickyEvent = IRoomEvent & StickyEventFields;\n\nexport type IStickyStateEvent = IStateEvent & StickyEventFields;\n\nexport interface ISticky {\n events: Array<IStickyEvent | IStickyStateEvent>;\n}\n\nexport interface IJoinedRoom {\n \"summary\": IRoomSummary;\n // One of `state` or `state_after` is required.\n \"state\"?: IState;\n \"org.matrix.msc4222.state_after\"?: IState; // https://github.com/matrix-org/matrix-spec-proposals/pull/4222\n \"msc4354_sticky\"?: ISticky; // https://github.com/matrix-org/matrix-spec-proposals/pull/4354\n \"timeline\": ITimeline;\n \"ephemeral\": IEphemeral;\n \"account_data\": IAccountData;\n \"unread_notifications\": UnreadNotificationCounts;\n \"unread_thread_notifications\"?: Record<string, UnreadNotificationCounts>;\n \"org.matrix.msc3773.unread_thread_notifications\"?: Record<string, UnreadNotificationCounts>;\n}\n\nexport interface IStrippedState {\n content: IContent;\n state_key: string;\n type: EventType | string;\n sender: string;\n}\n\nexport interface IInviteState {\n events: IStrippedState[];\n}\n\nexport interface IKnockState {\n events: IStrippedState[];\n}\n\nexport interface IInvitedRoom {\n invite_state: IInviteState;\n}\n\nexport interface ILeftRoom {\n // One of `state` or `state_after` is required.\n \"state\"?: IState;\n \"org.matrix.msc4222.state_after\"?: IState;\n \"timeline\": ITimeline;\n \"account_data\": IAccountData;\n}\n\nexport interface IKnockedRoom {\n knock_state: IKnockState;\n}\n\nexport interface IRooms {\n [Category.Join]: Record<string, IJoinedRoom>;\n [Category.Invite]: Record<string, IInvitedRoom>;\n [Category.Leave]: Record<string, ILeftRoom>;\n [Category.Knock]: Record<string, IKnockedRoom>;\n}\n\ninterface IPresence {\n events: IMinimalEvent[];\n}\n\ninterface IAccountData {\n events: IMinimalEvent[];\n}\n\n/** A to-device message as received from the sync. */\nexport interface IToDeviceEvent {\n content: IContent;\n sender: string;\n type: string;\n}\n\n/**\n * A (possibly decrypted) to-device message after it has been successfully processed by the sdk.\n *\n * If the message was encrypted, the `encryptionInfo` field will contain the encryption information.\n * If the message was sent in clear, this field will be null.\n *\n * The `message` field contains the message `type`, `content`, and `sender` as if the message was sent in clear.\n */\nexport interface ReceivedToDeviceMessage {\n /** The message type, content, and sender as if the message was sent in clear. */\n message: IToDeviceEvent;\n /**\n * Information about the encryption of the message.\n * Will be null if the message was sent in clear\n */\n encryptionInfo: OlmEncryptionInfo | null;\n}\n\ninterface IToDevice {\n events: IToDeviceEvent[];\n}\n\nexport interface IDeviceLists {\n changed?: string[];\n left?: string[];\n}\n\nexport interface ISyncResponse {\n \"next_batch\": string;\n \"rooms\": IRooms;\n \"presence\"?: IPresence;\n \"account_data\": IAccountData;\n \"to_device\"?: IToDevice;\n \"device_lists\"?: IDeviceLists;\n \"device_one_time_keys_count\"?: Record<string, number>;\n\n \"device_unused_fallback_key_types\"?: string[];\n \"org.matrix.msc2732.device_unused_fallback_key_types\"?: string[];\n}\n/* eslint-enable camelcase */\n\nexport enum Category {\n Invite = \"invite\",\n Leave = \"leave\",\n Join = \"join\",\n Knock = \"knock\",\n}\n\ninterface IRoom {\n _currentState: { [eventType: string]: { [stateKey: string]: IStateEvent } };\n _timeline: {\n event: IRoomEvent | IStateEvent;\n token: string | null;\n }[];\n _summary: Partial<IRoomSummary>;\n _accountData: { [eventType: string]: IMinimalEvent };\n _unreadNotifications: Partial<UnreadNotificationCounts>;\n _unreadThreadNotifications?: Record<string, Partial<UnreadNotificationCounts>>;\n _receipts: ReceiptAccumulator;\n _stickyEvents: {\n readonly event: IStickyEvent | IStickyStateEvent;\n /**\n * This is the timestamp at which point it is safe to remove this event from the store.\n * This value is immutable\n */\n readonly expiresTs: number;\n }[];\n}\n\nexport interface ISyncData {\n nextBatch: string;\n accountData: IMinimalEvent[];\n roomsData: IRooms;\n}\n\ntype TaggedEvent = IRoomEvent & { _localTs?: number };\n\nfunction isTaggedEvent(event: IRoomEvent): event is TaggedEvent {\n return \"_localTs\" in event && event[\"_localTs\"] !== undefined;\n}\n\n/**\n * The purpose of this class is to accumulate /sync responses such that a\n * complete \"initial\" JSON response can be returned which accurately represents\n * the sum total of the /sync responses accumulated to date. It only handles\n * room data: that is, everything under the \"rooms\" top-level key.\n *\n * This class is used when persisting room data so a complete /sync response can\n * be loaded from disk and incremental syncs can be performed on the server,\n * rather than asking the server to do an initial sync on startup.\n */\nexport class SyncAccumulator {\n private accountData: Record<string, IMinimalEvent> = {}; // $event_type: Object\n private inviteRooms: Record<string, IInvitedRoom> = {}; // $roomId: { ... sync 'invite' json data ... }\n private knockRooms: Record<string, IKnockedRoom> = {}; // $roomId: { ... sync 'knock' json data ... }\n private joinRooms: { [roomId: string]: IRoom } = {};\n // the /sync token which corresponds to the last time rooms were\n // accumulated. We remember this so that any caller can obtain a\n // coherent /sync response and know at what point they should be\n // streaming from without losing events.\n private nextBatch: string | null = null;\n\n public constructor(private readonly opts: IOpts = {}) {\n this.opts.maxTimelineEntries = this.opts.maxTimelineEntries || 50;\n }\n\n public accumulate(syncResponse: ISyncResponse, fromDatabase = false): void {\n this.accumulateRooms(syncResponse, fromDatabase);\n this.accumulateAccountData(syncResponse);\n this.nextBatch = syncResponse.next_batch;\n }\n\n private accumulateAccountData(syncResponse: ISyncResponse): void {\n if (!syncResponse.account_data || !syncResponse.account_data.events) {\n return;\n }\n // Clobbers based on event type.\n syncResponse.account_data.events.forEach((e) => {\n this.accountData[e.type] = e;\n });\n }\n\n /**\n * Accumulate incremental /sync room data.\n * @param syncResponse - the complete /sync JSON\n * @param fromDatabase - True if the sync response is one saved to the database\n */\n private accumulateRooms(syncResponse: ISyncResponse, fromDatabase = false): void {\n if (!syncResponse.rooms) {\n return;\n }\n if (syncResponse.rooms.invite) {\n Object.keys(syncResponse.rooms.invite).forEach((roomId) => {\n this.accumulateRoom(roomId, Category.Invite, syncResponse.rooms.invite[roomId], fromDatabase);\n });\n }\n if (syncResponse.rooms.join) {\n Object.keys(syncResponse.rooms.join).forEach((roomId) => {\n this.accumulateRoom(roomId, Category.Join, syncResponse.rooms.join[roomId], fromDatabase);\n });\n }\n if (syncResponse.rooms.leave) {\n Object.keys(syncResponse.rooms.leave).forEach((roomId) => {\n this.accumulateRoom(roomId, Category.Leave, syncResponse.rooms.leave[roomId], fromDatabase);\n });\n }\n if (syncResponse.rooms.knock) {\n Object.keys(syncResponse.rooms.knock).forEach((roomId) => {\n this.accumulateRoom(roomId, Category.Knock, syncResponse.rooms.knock[roomId], fromDatabase);\n });\n }\n }\n\n private accumulateRoom(roomId: string, category: Category.Invite, data: IInvitedRoom, fromDatabase: boolean): void;\n private accumulateRoom(roomId: string, category: Category.Join, data: IJoinedRoom, fromDatabase: boolean): void;\n private accumulateRoom(roomId: string, category: Category.Leave, data: ILeftRoom, fromDatabase: boolean): void;\n private accumulateRoom(roomId: string, category: Category.Knock, data: IKnockedRoom, fromDatabase: boolean): void;\n private accumulateRoom(roomId: string, category: Category, data: any, fromDatabase = false): void {\n // Valid /sync state transitions\n // +--------+ <======+ 1: Accept an invite\n // +== | INVITE | | (5) 2: Leave a room\n // | +--------+ =====+ | 3: Join a public room previously\n // |(1) (4) | | left (handle as if new room)\n // V (2) V | 4: Reject an invite\n // +------+ ========> +--------+ 5: Invite to a room previously\n // | JOIN | (3) | LEAVE* | left (handle as if new room)\n // +------+ <======== +--------+\n //\n // * equivalent to \"no state\"\n switch (category) {\n case Category.Invite: // (5)\n if (this.knockRooms[roomId]) {\n // was previously knock, now invite, need to delete knock state\n delete this.knockRooms[roomId];\n }\n this.accumulateInviteState(roomId, data as IInvitedRoom);\n break;\n\n case Category.Knock:\n this.accumulateKnockState(roomId, data as IKnockedRoom);\n break;\n\n case Category.Join:\n if (this.knockRooms[roomId]) {\n // delete knock state on join\n delete this.knockRooms[roomId];\n } else if (this.inviteRooms[roomId]) {\n // (1)\n // was previously invite, now join. We expect /sync to give\n // the entire state and timeline on 'join', so delete previous\n // invite state\n delete this.inviteRooms[roomId];\n }\n // (3)\n this.accumulateJoinState(roomId, data as IJoinedRoom, fromDatabase);\n break;\n\n case Category.Leave:\n if (this.knockRooms[roomId]) {\n // delete knock state on leave\n delete this.knockRooms[roomId];\n } else if (this.inviteRooms[roomId]) {\n // (4)\n delete this.inviteRooms[roomId];\n } else {\n // (2)\n delete this.joinRooms[roomId];\n }\n break;\n\n default:\n logger.error(\"Unknown cateogory: \", category);\n }\n }\n\n private accumulateInviteState(roomId: string, data: IInvitedRoom): void {\n if (!data.invite_state || !data.invite_state.events) {\n // no new data\n return;\n }\n if (!this.inviteRooms[roomId]) {\n this.inviteRooms[roomId] = {\n invite_state: data.invite_state,\n };\n return;\n }\n // accumulate extra keys for invite->invite transitions\n // clobber based on event type / state key\n // We expect invite_state to be small, so just loop over the events\n const currentData = this.inviteRooms[roomId];\n data.invite_state.events.forEach((e) => {\n let hasAdded = false;\n for (let i = 0; i < currentData.invite_state.events.length; i++) {\n const current = currentData.invite_state.events[i];\n if (current.type === e.type && current.state_key == e.state_key) {\n currentData.invite_state.events[i] = e; // update\n hasAdded = true;\n }\n }\n if (!hasAdded) {\n currentData.invite_state.events.push(e);\n }\n });\n }\n\n private accumulateKnockState(roomId: string, data: IKnockedRoom): void {\n if (!data.knock_state || !data.knock_state.events) {\n // no new data\n return;\n }\n if (!this.knockRooms[roomId]) {\n this.knockRooms[roomId] = {\n knock_state: data.knock_state,\n };\n return;\n }\n // accumulate extra keys\n // clobber based on event type / state key\n // We expect knock_state to be small, so just loop over the events\n const currentData = this.knockRooms[roomId];\n data.knock_state.events.forEach((e) => {\n let hasAdded = false;\n for (let i = 0; i < currentData.knock_state.events.length; i++) {\n const current = currentData.knock_state.events[i];\n if (current.type === e.type && current.state_key == e.state_key) {\n currentData.knock_state.events[i] = e; // update\n hasAdded = true;\n }\n }\n if (!hasAdded) {\n currentData.knock_state.events.push(e);\n }\n });\n }\n\n // Accumulate timeline and state events in a room.\n private accumulateJoinState(roomId: string, data: IJoinedRoom, fromDatabase = false): void {\n const now = Date.now();\n // We expect this function to be called a lot (every /sync) so we want\n // this to be fast. /sync stores events in an array but we often want\n // to clobber based on type/state_key. Rather than convert arrays to\n // maps all the time, just keep private maps which contain\n // the actual current accumulated sync state, and array-ify it when\n // getJSON() is called.\n\n // State resolution:\n // The 'state' key is the delta from the previous sync (or start of time\n // if no token was supplied), to the START of the timeline. To obtain\n // the current state, we need to \"roll forward\" state by reading the\n // timeline. We want to store the current state so we can drop events\n // out the end of the timeline based on opts.maxTimelineEntries.\n //\n // 'state' 'timeline' current state\n // |-------x<======================>x\n // T I M E\n //\n // When getJSON() is called, we 'roll back' the current state by the\n // number of entries in the timeline to work out what 'state' should be.\n\n // Back-pagination:\n // On an initial /sync, the server provides a back-pagination token for\n // the start of the timeline. When /sync deltas come down, they also\n // include back-pagination tokens for the start of the timeline. This\n // means not all events in the timeline have back-pagination tokens, as\n // it is only the ones at the START of the timeline which have them.\n // In order for us to have a valid timeline (and back-pagination token\n // to match), we need to make sure that when we remove old timeline\n // events, that we roll forward to an event which has a back-pagination\n // token. This means we can't keep a strict sliding-window based on\n // opts.maxTimelineEntries, and we may have a few less. We should never\n // have more though, provided that the /sync limit is less than or equal\n // to opts.maxTimelineEntries.\n\n if (!this.joinRooms[roomId]) {\n // Create truly empty objects so event types of 'hasOwnProperty' and co\n // don't cause this code to break.\n this.joinRooms[roomId] = {\n _currentState: Object.create(null),\n _timeline: [],\n _accountData: Object.create(null),\n _unreadNotifications: {},\n _unreadThreadNotifications: {},\n _summary: {},\n _receipts: new ReceiptAccumulator(),\n _stickyEvents: [],\n };\n }\n const currentData = this.joinRooms[roomId];\n\n if (data.account_data && data.account_data.events) {\n // clobber based on type\n data.account_data.events.forEach((e) => {\n currentData._accountData[e.type] = e;\n });\n }\n\n // these probably clobber, spec is unclear.\n if (data.unread_notifications) {\n currentData._unreadNotifications = data.unread_notifications;\n }\n currentData._unreadThreadNotifications =\n data[UNREAD_THREAD_NOTIFICATIONS.stable!] ?? data[UNREAD_THREAD_NOTIFICATIONS.unstable!] ?? undefined;\n\n if (data.summary) {\n const HEROES_KEY = \"m.heroes\";\n const INVITED_COUNT_KEY = \"m.invited_member_count\";\n const JOINED_COUNT_KEY = \"m.joined_member_count\";\n\n const acc = currentData._summary;\n const sum = data.summary;\n acc[HEROES_KEY] = sum[HEROES_KEY] ?? acc[HEROES_KEY];\n acc[JOINED_COUNT_KEY] = sum[JOINED_COUNT_KEY] ?? acc[JOINED_COUNT_KEY];\n acc[INVITED_COUNT_KEY] = sum[INVITED_COUNT_KEY] ?? acc[INVITED_COUNT_KEY];\n }\n\n // We purposefully do not persist m.typing events.\n // Technically you could refresh a browser before the timer on a\n // typing event is up, so it'll look like you aren't typing when\n // you really still are. However, the alternative is worse. If\n // we do persist typing events, it will look like people are\n // typing forever until someone really does start typing (which\n // will prompt Synapse to send down an actual m.typing event to\n // clobber the one we persisted).\n\n // Persist the receipts\n currentData._receipts.consumeEphemeralEvents(data.ephemeral?.events);\n\n // if we got a limited sync, we need to remove all timeline entries or else\n // we will have gaps in the timeline.\n if (data.timeline && data.timeline.limited) {\n currentData._timeline = [];\n }\n\n // Work out the current state. The deltas need to be applied in the order:\n // - existing state which didn't come down /sync.\n // - State events under the 'state' key.\n // - State events under the 'state_after' key OR state events in the 'timeline' if 'state_after' is not present.\n data.state?.events?.forEach((e) => {\n setState(currentData._currentState, e);\n });\n data[\"org.matrix.msc4222.state_after\"]?.events?.forEach((e) => {\n setState(currentData._currentState, e);\n });\n data.timeline?.events?.forEach((e, index) => {\n if (!data[\"org.matrix.msc4222.state_after\"]) {\n // this nops if 'e' isn't a state event\n setState(currentData._currentState, e);\n }\n // append the event to the timeline. The back-pagination token\n // corresponds to the first event in the timeline\n let transformedEvent: TaggedEvent;\n if (!fromDatabase) {\n transformedEvent = Object.assign({}, e);\n if (transformedEvent.unsigned !== undefined) {\n transformedEvent.unsigned = Object.assign({}, transformedEvent.unsigned);\n }\n const age = e.unsigned?.age;\n if (age !== undefined) transformedEvent._localTs = Date.now() - age;\n } else {\n transformedEvent = e;\n }\n\n currentData._timeline.push({\n event: transformedEvent,\n token: index === 0 ? (data.timeline.prev_batch ?? null) : null,\n });\n });\n\n // Prune out any events in our stores that have since expired, do this before we\n // insert new events.\n currentData._stickyEvents = currentData._stickyEvents.filter(({ expiresTs }) => expiresTs > now);\n\n // We want this to be fast, so don't worry about duplicate events here. The RoomStickyEventsStore will\n // process these events into the correct mapped order.\n if (data.msc4354_sticky?.events) {\n currentData._stickyEvents = currentData._stickyEvents.concat(\n data.msc4354_sticky.events.map((event) => {\n // If `duration_ms` exceeds the spec limit of a hour, we cap it.\n const cappedDuration = Math.min(event.msc4354_sticky.duration_ms, MAX_STICKY_DURATION_MS);\n // If `origin_server_ts` claims to have been from the future, we still bound it to now.\n const createdTs = Math.min(event.origin_server_ts, now);\n return {\n event,\n expiresTs: cappedDuration + createdTs,\n };\n }),\n );\n }\n\n // attempt to prune the timeline by jumping between events which have\n // pagination tokens.\n if (currentData._timeline.length > this.opts.maxTimelineEntries!) {\n const startIndex = currentData._timeline.length - this.opts.maxTimelineEntries!;\n for (let i = startIndex; i < currentData._timeline.length; i++) {\n if (currentData._timeline[i].token) {\n // keep all events after this, including this one\n currentData._timeline = currentData._timeline.slice(i, currentData._timeline.length);\n break;\n }\n }\n }\n }\n\n /**\n * Return everything under the 'rooms' key from a /sync response which\n * represents all room data that should be stored. This should be paired\n * with the sync token which represents the most recent /sync response\n * provided to accumulate().\n * @param forDatabase - True to generate a sync to be saved to storage\n * @returns An object with a \"nextBatch\", \"roomsData\" and \"accountData\"\n * keys.\n * The \"nextBatch\" key is a string which represents at what point in the\n * /sync stream the accumulator reached. This token should be used when\n * restarting a /sync stream at startup. Failure to do so can lead to missing\n * events. The \"roomsData\" key is an Object which represents the entire\n * /sync response from the 'rooms' key onwards. The \"accountData\" key is\n * a list of raw events which represent global account data.\n */\n public getJSON(forDatabase = false): ISyncData {\n const data: IRooms = {\n join: {},\n invite: {},\n knock: {},\n // always empty. This is set by /sync when a room was previously\n // in 'invite' or 'join'. On fresh startup, the client won't know\n // about any previous room being in 'invite' or 'join' so we can\n // just omit mentioning it at all, even if it has previously come\n // down /sync.\n // The notable exception is when a client is kicked or banned:\n // we may want to hold onto that room so the client can clearly see\n // why their room has disappeared. We don't persist it though because\n // it is unclear *when* we can safely remove the room from the DB.\n // Instead, we assume that if you're loading from the DB, you've\n // refreshed the page, which means you've seen the kick/ban already.\n leave: {},\n };\n Object.keys(this.inviteRooms).forEach((roomId) => {\n data.invite[roomId] = this.inviteRooms[roomId];\n });\n Object.keys(this.knockRooms).forEach((roomId) => {\n data.knock[roomId] = this.knockRooms[roomId];\n });\n Object.keys(this.joinRooms).forEach((roomId) => {\n const roomData = this.joinRooms[roomId];\n const roomJson: IJoinedRoom & {\n // We track both `state` and `state_after` for downgrade compatibility\n \"state\": IState;\n \"org.matrix.msc4222.state_after\": IState;\n } = {\n \"ephemeral\": { events: [] },\n \"account_data\": { events: [] },\n \"state\": { events: [] },\n \"org.matrix.msc4222.state_after\": { events: [] },\n \"timeline\": {\n events: [],\n prev_batch: null,\n },\n \"unread_notifications\": roomData._unreadNotifications,\n \"unread_thread_notifications\": roomData._unreadThreadNotifications,\n \"summary\": roomData._summary as IRoomSummary,\n \"msc4354_sticky\": roomData._stickyEvents?.length\n ? {\n events: roomData._stickyEvents.map((e) => e.event),\n }\n : undefined,\n };\n // Add account data\n Object.keys(roomData._accountData).forEach((evType) => {\n roomJson.account_data.events.push(roomData._accountData[evType]);\n });\n\n const receiptEvent = roomData._receipts.buildAccumulatedReceiptEvent(roomId);\n\n // add only if we have some receipt data\n if (receiptEvent) {\n roomJson.ephemeral.events.push(receiptEvent);\n }\n\n // Add timeline data\n roomData._timeline.forEach((msgData) => {\n if (!roomJson.timeline.prev_batch) {\n // the first event we add to the timeline MUST match up to\n // the prev_batch token.\n if (!msgData.token) {\n return; // this shouldn't happen as we prune constantly.\n }\n roomJson.timeline.prev_batch = msgData.token;\n }\n\n let transformedEvent: (IRoomEvent | IStateEvent) & { _localTs?: number };\n if (!forDatabase && isTaggedEvent(msgData.event)) {\n // This means we have to copy each event, so we can fix it up to\n // set a correct 'age' parameter whilst keeping the local timestamp\n // on our stored event. If this turns out to be a bottleneck, it could\n // be optimised either by doing this in the main process after the data\n // has been structured-cloned to go between the worker & main process,\n // or special-casing data from saved syncs to read the local timestamp\n // directly rather than turning it into age to then immediately be\n // transformed back again into a local timestamp.\n transformedEvent = Object.assign({}, msgData.event);\n if (transformedEvent.unsigned !== undefined) {\n transformedEvent.unsigned = Object.assign({}, transformedEvent.unsigned);\n }\n delete transformedEvent._localTs;\n transformedEvent.unsigned = transformedEvent.unsigned || {};\n transformedEvent.unsigned.age = Date.now() - msgData.event._localTs!;\n } else {\n transformedEvent = msgData.event;\n }\n roomJson.timeline.events.push(transformedEvent);\n });\n\n // Add state data: roll back current state to the start of timeline,\n // by \"reverse clobbering\" from the end of the timeline to the start.\n // Convert maps back into arrays.\n const rollBackState = Object.create(null);\n for (let i = roomJson.timeline.events.length - 1; i >= 0; i--) {\n const timelineEvent = roomJson.timeline.events[i];\n if (\n (timelineEvent as IStateEvent).state_key === null ||\n (timelineEvent as IStateEvent).state_key === undefined\n ) {\n continue; // not a state event\n }\n // since we're going back in time, we need to use the previous\n // state value else we'll break causality. We don't have the\n // complete previous state event, so we need to create one.\n const prevStateEvent = deepCopy(timelineEvent);\n if (prevStateEvent.unsigned) {\n if (prevStateEvent.unsigned.prev_content) {\n prevStateEvent.content = prevStateEvent.unsigned.prev_content;\n }\n if (prevStateEvent.unsigned.prev_sender) {\n prevStateEvent.sender = prevStateEvent.unsigned.prev_sender;\n }\n }\n setState(rollBackState, prevStateEvent);\n }\n Object.keys(roomData._currentState).forEach((evType) => {\n Object.keys(roomData._currentState[evType]).forEach((stateKey) => {\n let ev = roomData._currentState[evType][stateKey];\n // Push to both fields to provide downgrade compatibility in the sync accumulator db\n // the code will prefer `state_after` if it is present\n roomJson[\"org.matrix.msc4222.state_after\"].events.push(ev);\n // Roll the state back to the value at the start of the timeline if it was changed\n if (rollBackState[evType] && rollBackState[evType][stateKey]) {\n ev = rollBackState[evType][stateKey];\n }\n roomJson.state.events.push(ev);\n });\n });\n data.join[roomId] = roomJson;\n });\n\n // Add account data\n const accData: IMinimalEvent[] = [];\n Object.keys(this.accountData).forEach((evType) => {\n accData.push(this.accountData[evType]);\n });\n\n return {\n nextBatch: this.nextBatch!,\n roomsData: data,\n accountData: accData,\n };\n }\n\n public getNextBatchToken(): string {\n return this.nextBatch!;\n }\n}\n\nfunction setState(eventMap: Record<string, Record<string, IStateEvent>>, event: IRoomEvent | IStateEvent): void {\n if ((event as IStateEvent).state_key === null || (event as IStateEvent).state_key === undefined || !event.type) {\n return;\n }\n if (!eventMap[event.type]) {\n eventMap[event.type] = Object.create(null);\n }\n eventMap[event.type][(event as IStateEvent).state_key] = event as IStateEvent;\n}\n", "/*\nCopyright 2016 - 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type Direction, EventTimeline } from \"./models/event-timeline.ts\";\nimport { logger } from \"./logger.ts\";\nimport { type LobiClient } from \"./client.ts\";\nimport { type EventTimelineSet } from \"./models/event-timeline-set.ts\";\nimport { type LobiEvent } from \"./models/event.ts\";\nimport { type Room, RoomEvent } from \"./models/room.ts\";\n\n/**\n * @internal\n */\nconst DEBUG = false;\n\n/**\n * @internal\n */\n/* istanbul ignore next */\nconst debuglog = DEBUG ? logger.log.bind(logger) : function (): void {};\n\n/**\n * the number of times we ask the server for more events before giving up\n * this is currently higher than it needs to be to workaround lack of a filter\n * for excluding thread responses from main timeline pagination which can cause\n * giving up incorrectly - https://github.com/matrix-org/matrix-spec-proposals/pull/3874\n *\n * @internal\n */\nconst DEFAULT_PAGINATE_LOOP_LIMIT = 10;\n\ninterface IOpts {\n /**\n * Maximum number of events to keep in the window. If more events are retrieved via pagination requests,\n * excess events will be dropped from the other end of the window.\n */\n windowLimit?: number;\n}\n\nexport class TimelineWindow {\n private readonly windowLimit: number;\n // these will be TimelineIndex objects; they delineate the 'start' and\n // 'end' of the window.\n //\n // start.index is inclusive; end.index is exclusive.\n private start?: TimelineIndex;\n private end?: TimelineIndex;\n private eventCount = 0;\n\n /**\n * Construct a TimelineWindow.\n *\n * <p>This abstracts the separate timelines in a Matrix {@link Room} into a single iterable thing.\n * It keeps track of the start and endpoints of the window, which can be advanced with the help\n * of pagination requests.\n *\n * <p>Before the window is useful, it must be initialised by calling {@link TimelineWindow#load}.\n *\n * <p>Note that the window will not automatically extend itself when new events\n * are received from /sync; you should arrange to call {@link TimelineWindow#paginate}\n * on {@link RoomEvent.Timeline} events.\n *\n * <p>Note that constructing an instance of this class for a room adds a\n * listener for RoomEvent.Timeline events which is never removed. In theory\n * this should not cause a leak since the EventEmitter uses weak mappings.\n *\n * @param client - LobiClient to be used for context/pagination\n * requests.\n *\n * @param timelineSet - The timelineSet to track\n *\n * @param opts - Configuration options for this window\n */\n public constructor(\n private readonly client: LobiClient,\n private readonly timelineSet: EventTimelineSet,\n opts: IOpts = {},\n ) {\n this.windowLimit = opts.windowLimit || 1000;\n timelineSet.room?.on(RoomEvent.Timeline, this.onTimelineEvent.bind(this));\n }\n\n /**\n * Initialise the window to point at a given event, or the live timeline\n *\n * @param initialEventId - If given, the window will contain the\n * given event\n * @param initialWindowSize - Size of the initial window\n */\n public load(initialEventId?: string, initialWindowSize = 20): Promise<void> {\n // given an EventTimeline, find the event we were looking for, and initialise our\n // fields so that the event in question is in the middle of the window.\n const initFields = (timeline: EventTimeline | null): void => {\n if (!timeline) {\n throw new Error(\"No timeline given to initFields\");\n }\n\n let eventIndex: number;\n\n const events = timeline.getEvents();\n\n if (!initialEventId) {\n // we were looking for the live timeline: initialise to the end\n eventIndex = events.length;\n } else {\n eventIndex = events.findIndex((e) => e.getId() === initialEventId);\n\n if (eventIndex < 0) {\n throw new Error(\"getEventTimeline result didn't include requested event\");\n }\n }\n\n const endIndex = Math.min(events.length, eventIndex + Math.ceil(initialWindowSize / 2));\n const startIndex = Math.max(0, endIndex - initialWindowSize);\n this.start = new TimelineIndex(timeline, startIndex - timeline.getBaseIndex());\n this.end = new TimelineIndex(timeline, endIndex - timeline.getBaseIndex());\n this.eventCount = endIndex - startIndex;\n };\n\n // We avoid delaying the resolution of the promise by a reactor tick if we already have the data we need,\n // which is important to keep room-switching feeling snappy.\n if (this.timelineSet.getTimelineForEvent(initialEventId)) {\n initFields(this.timelineSet.getTimelineForEvent(initialEventId));\n return Promise.resolve();\n } else if (initialEventId) {\n return this.client.getEventTimeline(this.timelineSet, initialEventId).then(initFields);\n } else {\n initFields(this.timelineSet.getLiveTimeline());\n return Promise.resolve();\n }\n }\n\n /**\n * Get the TimelineIndex of the window in the given direction.\n *\n * @param direction - EventTimeline.BACKWARDS to get the TimelineIndex\n * at the start of the window; EventTimeline.FORWARDS to get the TimelineIndex at\n * the end.\n *\n * @returns The requested timeline index if one exists, null\n * otherwise.\n */\n public getTimelineIndex(direction: Direction): TimelineIndex | null {\n if (direction == EventTimeline.BACKWARDS) {\n return this.start ?? null;\n } else if (direction == EventTimeline.FORWARDS) {\n return this.end ?? null;\n } else {\n throw new Error(\"Invalid direction '\" + direction + \"'\");\n }\n }\n\n /**\n * Try to extend the window using events that are already in the underlying\n * TimelineIndex.\n *\n * @param direction - EventTimeline.BACKWARDS to try extending it\n * backwards; EventTimeline.FORWARDS to try extending it forwards.\n * @param size - number of events to try to extend by.\n *\n * @returns true if the window was extended, false otherwise.\n */\n public extend(direction: Direction, size: number): boolean {\n const tl = this.getTimelineIndex(direction);\n\n if (!tl) {\n debuglog(\"TimelineWindow: no timeline yet\");\n return false;\n }\n\n const count = direction == EventTimeline.BACKWARDS ? tl.retreat(size) : tl.advance(size);\n\n if (count) {\n this.eventCount += count;\n debuglog(\"TimelineWindow: increased cap by \" + count + \" (now \" + this.eventCount + \")\");\n // remove some events from the other end, if necessary\n const excess = this.eventCount - this.windowLimit;\n if (excess > 0) {\n this.unpaginate(excess, direction != EventTimeline.BACKWARDS);\n }\n return true;\n }\n\n return false;\n }\n\n private onTimelineEvent(_event?: LobiEvent, _room?: Room, _atStart?: boolean, removed?: boolean): void {\n if (removed) {\n this.onEventRemoved();\n }\n }\n\n /**\n * If an event was removed, meaning this window is longer than the timeline,\n * shorten the window.\n */\n private onEventRemoved(): void {\n const events = this.getEvents();\n if (events.length > 0 && events[events.length - 1] === undefined && this.end) {\n this.end.index--;\n }\n }\n\n /**\n * Check if this window can be extended\n *\n * <p>This returns true if we either have more events, or if we have a\n * pagination token which means we can paginate in that direction. It does not\n * necessarily mean that there are more events available in that direction at\n * this time.\n *\n * @param direction - EventTimeline.BACKWARDS to check if we can\n * paginate backwards; EventTimeline.FORWARDS to check if we can go forwards\n *\n * @returns true if we can paginate in the given direction\n */\n public canPaginate(direction: Direction): boolean {\n const tl = this.getTimelineIndex(direction);\n\n if (!tl) {\n debuglog(\"TimelineWindow: no timeline yet\");\n return false;\n }\n\n if (direction == EventTimeline.BACKWARDS) {\n if (tl.index > tl.minIndex()) {\n return true;\n }\n } else {\n if (tl.index < tl.maxIndex()) {\n return true;\n }\n }\n\n const hasNeighbouringTimeline = tl.timeline.getNeighbouringTimeline(direction);\n const paginationToken = tl.timeline.getPaginationToken(direction);\n return Boolean(hasNeighbouringTimeline) || Boolean(paginationToken);\n }\n\n /**\n * Attempt to extend the window\n *\n * @param direction - EventTimeline.BACKWARDS to extend the window\n * backwards (towards older events); EventTimeline.FORWARDS to go forwards.\n *\n * @param size - number of events to try to extend by. If fewer than this\n * number are immediately available, then we return immediately rather than\n * making an API call.\n *\n * @param makeRequest - whether we should make API calls to\n * fetch further events if we don't have any at all. (This has no effect if\n * the room already knows about additional events in the relevant direction,\n * even if there are fewer than 'size' of them, as we will just return those\n * we already know about.)\n *\n * @param requestLimit - limit for the number of API requests we\n * should make.\n *\n * @returns Promise which resolves to a boolean which is true if more events\n * were successfully retrieved.\n */\n public async paginate(\n direction: Direction,\n size: number,\n makeRequest = true,\n requestLimit = DEFAULT_PAGINATE_LOOP_LIMIT,\n ): Promise<boolean> {\n // Either wind back the message cap (if there are enough events in the\n // timeline to do so), or fire off a pagination request.\n const tl = this.getTimelineIndex(direction);\n\n if (!tl) {\n debuglog(\"TimelineWindow: no timeline yet\");\n return false;\n }\n\n if (tl.pendingPaginate) {\n return tl.pendingPaginate;\n }\n\n // try moving the cap\n if (this.extend(direction, size)) {\n return true;\n }\n\n if (!makeRequest || requestLimit === 0) {\n // todo: should we return something different to indicate that there\n // might be more events out there, but we haven't found them yet?\n return false;\n }\n\n // try making a pagination request\n const token = tl.timeline.getPaginationToken(direction);\n if (!token) {\n debuglog(\"TimelineWindow: no token\");\n return false;\n }\n\n debuglog(\"TimelineWindow: starting request\");\n\n const prom = this.client\n .paginateEventTimeline(tl.timeline, {\n backwards: direction == EventTimeline.BACKWARDS,\n limit: size,\n })\n .finally(function () {\n tl.pendingPaginate = undefined;\n })\n .then((r) => {\n debuglog(\"TimelineWindow: request completed with result \" + r);\n if (!r) {\n return this.paginate(direction, size, false, 0);\n }\n\n // recurse to advance the index into the results.\n //\n // If we don't get any new events, we want to make sure we keep asking\n // the server for events for as long as we have a valid pagination\n // token. In particular, we want to know if we've actually hit the\n // start of the timeline, or if we just happened to know about all of\n // the events thanks to https://matrix.org/jira/browse/SYN-645.\n //\n // On the other hand, we necessarily want to wait forever for the\n // server to make its mind up about whether there are other events,\n // because it gives a bad user experience\n // (https://github.com/vector-im/vector-web/issues/1204).\n return this.paginate(direction, size, true, requestLimit - 1);\n });\n tl.pendingPaginate = prom;\n return prom;\n }\n\n /**\n * Remove `delta` events from the start or end of the timeline.\n *\n * @param delta - number of events to remove from the timeline\n * @param startOfTimeline - if events should be removed from the start\n * of the timeline.\n */\n public unpaginate(delta: number, startOfTimeline: boolean): void {\n const tl = startOfTimeline ? this.start : this.end;\n if (!tl) {\n throw new Error(\n `Attempting to unpaginate startOfTimeline=${startOfTimeline} but don't have this direction`,\n );\n }\n\n // sanity-check the delta\n if (delta > this.eventCount || delta < 0) {\n throw new Error(\n `Attemting to unpaginate ${delta} events, but only have ${this.eventCount} in the timeline`,\n );\n }\n\n while (delta > 0) {\n const count = startOfTimeline ? tl.advance(delta) : tl.retreat(delta);\n if (count <= 0) {\n // sadness. This shouldn't be possible.\n throw new Error(\"Unable to unpaginate any further, but still have \" + this.eventCount + \" events\");\n }\n\n delta -= count;\n this.eventCount -= count;\n debuglog(\"TimelineWindow.unpaginate: dropped \" + count + \" (now \" + this.eventCount + \")\");\n }\n }\n\n /**\n * Get a list of the events currently in the window\n *\n * @returns the events in the window\n */\n public getEvents(): LobiEvent[] {\n if (!this.start) {\n // not yet loaded\n return [];\n }\n\n const result: LobiEvent[] = [];\n\n // iterate through each timeline between this.start and this.end\n // (inclusive).\n let timeline: EventTimeline | null = this.start.timeline;\n // eslint-disable-next-line no-constant-condition\n while (timeline) {\n const events = timeline.getEvents();\n\n // For the first timeline in the chain, we want to start at\n // this.start.index. For the last timeline in the chain, we want to\n // stop before this.end.index. Otherwise, we want to copy all of the\n // events in the timeline.\n //\n // (Note that both this.start.index and this.end.index are relative\n // to their respective timelines' BaseIndex).\n //\n let startIndex = 0;\n let endIndex = events.length;\n if (timeline === this.start.timeline) {\n startIndex = this.start.index + timeline.getBaseIndex();\n }\n if (timeline === this.end?.timeline) {\n endIndex = this.end.index + timeline.getBaseIndex();\n }\n\n for (let i = startIndex; i < endIndex; i++) {\n result.push(events[i]);\n }\n\n // if we're not done, iterate to the next timeline.\n if (timeline === this.end?.timeline) {\n break;\n } else {\n timeline = timeline.getNeighbouringTimeline(EventTimeline.FORWARDS);\n }\n }\n\n return result;\n }\n}\n\n/**\n * A thing which contains a timeline reference, and an index into it.\n * @internal\n */\nexport class TimelineIndex {\n public pendingPaginate?: Promise<boolean>;\n\n // index: the indexes are relative to BaseIndex, so could well be negative.\n public constructor(\n public timeline: EventTimeline,\n public index: number,\n ) {}\n\n /**\n * @returns the minimum possible value for the index in the current\n * timeline\n */\n public minIndex(): number {\n return this.timeline.getBaseIndex() * -1;\n }\n\n /**\n * @returns the maximum possible value for the index in the current\n * timeline (exclusive - ie, it actually returns one more than the index\n * of the last element).\n */\n public maxIndex(): number {\n return this.timeline.getEvents().length - this.timeline.getBaseIndex();\n }\n\n /**\n * Try move the index forward, or into the neighbouring timeline\n *\n * @param delta - number of events to advance by\n * @returns number of events successfully advanced by\n */\n public advance(delta: number): number {\n if (!delta) {\n return 0;\n }\n\n // first try moving the index in the current timeline. See if there is room\n // to do so.\n let cappedDelta;\n if (delta < 0) {\n // we want to wind the index backwards.\n //\n // (this.minIndex() - this.index) is a negative number whose magnitude\n // is the amount of room we have to wind back the index in the current\n // timeline. We cap delta to this quantity.\n cappedDelta = Math.max(delta, this.minIndex() - this.index);\n if (cappedDelta < 0) {\n this.index += cappedDelta;\n return cappedDelta;\n }\n } else {\n // we want to wind the index forwards.\n //\n // (this.maxIndex() - this.index) is a (positive) number whose magnitude\n // is the amount of room we have to wind forward the index in the current\n // timeline. We cap delta to this quantity.\n cappedDelta = Math.min(delta, this.maxIndex() - this.index);\n if (cappedDelta > 0) {\n this.index += cappedDelta;\n return cappedDelta;\n }\n }\n\n // the index is already at the start/end of the current timeline.\n //\n // next see if there is a neighbouring timeline to switch to.\n const neighbour = this.timeline.getNeighbouringTimeline(\n delta < 0 ? EventTimeline.BACKWARDS : EventTimeline.FORWARDS,\n );\n if (neighbour) {\n this.timeline = neighbour;\n if (delta < 0) {\n this.index = this.maxIndex();\n } else {\n this.index = this.minIndex();\n }\n\n debuglog(\"paginate: switched to new neighbour\");\n\n // recurse, using the next timeline\n return this.advance(delta);\n }\n\n return 0;\n }\n\n /**\n * Try move the index backwards, or into the neighbouring timeline\n *\n * @param delta - number of events to retreat by\n * @returns number of events successfully retreated by\n */\n public retreat(delta: number): number {\n return this.advance(delta * -1) * -1;\n }\n}\n", "/*\nCopyright 2017 - 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type IMinimalEvent, type ISyncData, type ISyncResponse, SyncAccumulator } from \"../sync-accumulator.ts\";\nimport { deepCopy, promiseTry } from \"../utils.ts\";\nimport { exists as idbExists } from \"../indexeddb-helpers.ts\";\nimport { logger } from \"../logger.ts\";\nimport { type IStateEventWithRoomId, type IStoredClientOpts } from \"../lobi.ts\";\nimport { type ISavedSync } from \"./index.ts\";\nimport { type IIndexedDBBackend, type UserTuple } from \"./indexeddb-backend.ts\";\nimport { type IndexedToDeviceBatch, type ToDeviceBatchWithTxnId } from \"../models/ToDeviceMessage.ts\";\n\ntype DbMigration = (db: IDBDatabase) => void;\nconst DB_MIGRATIONS: DbMigration[] = [\n (db): void => {\n // Make user store, clobber based on user ID. (userId property of User objects)\n db.createObjectStore(\"users\", { keyPath: [\"userId\"] });\n\n // Make account data store, clobber based on event type.\n // (event.type property of LobiEvent objects)\n db.createObjectStore(\"accountData\", { keyPath: [\"type\"] });\n\n // Make /sync store (sync tokens, room data, etc), always clobber (const key).\n db.createObjectStore(\"sync\", { keyPath: [\"clobber\"] });\n },\n (db): void => {\n const oobMembersStore = db.createObjectStore(\"oob_membership_events\", {\n keyPath: [\"room_id\", \"state_key\"],\n });\n oobMembersStore.createIndex(\"room\", \"room_id\");\n },\n (db): void => {\n db.createObjectStore(\"client_options\", { keyPath: [\"clobber\"] });\n },\n (db): void => {\n db.createObjectStore(\"to_device_queue\", { autoIncrement: true });\n },\n // Expand as needed.\n];\nconst VERSION = DB_MIGRATIONS.length;\n\n/**\n * Helper method to collect results from a Cursor and promiseify it.\n * @param store - The store to perform openCursor on.\n * @param keyRange - Optional key range to apply on the cursor.\n * @param resultMapper - A function which is repeatedly called with a\n * Cursor.\n * Return the data you want to keep.\n * @returns Promise which resolves to an array of whatever you returned from\n * resultMapper.\n */\nfunction selectQuery<T>(\n store: IDBObjectStore,\n keyRange: IDBKeyRange | IDBValidKey | undefined,\n resultMapper: (cursor: IDBCursorWithValue) => T,\n): Promise<T[]> {\n const query = store.openCursor(keyRange);\n return new Promise((resolve, reject) => {\n const results: T[] = [];\n query.onerror = (): void => {\n reject(new Error(\"Query failed: \" + query.error?.name));\n };\n // collect results\n query.onsuccess = (): void => {\n const cursor = query.result;\n if (!cursor) {\n resolve(results);\n return; // end of results\n }\n results.push(resultMapper(cursor));\n cursor.continue();\n };\n });\n}\n\nfunction txnAsPromise(txn: IDBTransaction): Promise<Event> {\n return new Promise((resolve, reject) => {\n txn.oncomplete = function (event): void {\n resolve(event);\n };\n txn.onerror = function (): void {\n reject(txn.error);\n };\n });\n}\n\nfunction reqAsEventPromise(req: IDBRequest): Promise<Event> {\n return new Promise((resolve, reject) => {\n req.onsuccess = function (event): void {\n resolve(event);\n };\n req.onerror = function (): void {\n reject(req.error);\n };\n });\n}\n\nfunction reqAsPromise(req: IDBRequest): Promise<IDBRequest> {\n return new Promise((resolve, reject) => {\n req.onsuccess = (): void => resolve(req);\n req.onerror = (err): void => reject(err);\n });\n}\n\nfunction reqAsCursorPromise<T>(req: IDBRequest<T>): Promise<T> {\n return reqAsEventPromise(req).then((event) => req.result);\n}\n\nexport class LocalIndexedDBStoreBackend implements IIndexedDBBackend {\n public static exists(indexedDB: IDBFactory, dbName: string): Promise<boolean> {\n dbName = \"lobi-js-sdk:\" + (dbName || \"default\");\n return idbExists(indexedDB, dbName);\n }\n\n private readonly dbName: string;\n private readonly syncAccumulator: SyncAccumulator;\n private db?: IDBDatabase;\n private disconnected = true;\n private _isNewlyCreated = false;\n private syncToDatabasePromise?: Promise<void>;\n private pendingUserPresenceData: UserTuple[] = [];\n\n /**\n * Does the actual reading from and writing to the indexeddb\n *\n * Construct a new Indexed Database store backend. This requires a call to\n * `connect()` before this store can be used.\n * @param indexedDB - The Indexed DB interface e.g\n * `window.indexedDB`\n * @param dbName - Optional database name. The same name must be used\n * to open the same database.\n */\n public constructor(\n private readonly indexedDB: IDBFactory,\n dbName = \"default\",\n ) {\n this.dbName = \"lobi-js-sdk:\" + dbName;\n this.syncAccumulator = new SyncAccumulator();\n }\n\n /**\n * Attempt to connect to the database. This can fail if the user does not\n * grant permission.\n * @returns Promise which resolves if successfully connected.\n */\n public connect(onClose?: () => void): Promise<void> {\n if (!this.disconnected) {\n logger.log(`LocalIndexedDBStoreBackend.connect: already connected or connecting`);\n return Promise.resolve();\n }\n\n this.disconnected = false;\n\n logger.log(`LocalIndexedDBStoreBackend.connect: connecting...`);\n const req = this.indexedDB.open(this.dbName, VERSION);\n req.onupgradeneeded = (ev): void => {\n const db = req.result;\n const oldVersion = ev.oldVersion;\n logger.log(`LocalIndexedDBStoreBackend.connect: upgrading from ${oldVersion}`);\n if (oldVersion < 1) {\n // The database did not previously exist\n this._isNewlyCreated = true;\n }\n DB_MIGRATIONS.forEach((migration, index) => {\n if (oldVersion <= index) migration(db);\n });\n };\n\n req.onblocked = (): void => {\n logger.log(`can't yet open LocalIndexedDBStoreBackend because it is open elsewhere`);\n };\n\n logger.log(`LocalIndexedDBStoreBackend.connect: awaiting connection...`);\n return reqAsEventPromise(req).then(async () => {\n logger.log(`LocalIndexedDBStoreBackend.connect: connected`);\n this.db = req.result;\n\n // add a poorly-named listener for when deleteDatabase is called\n // so we can close our db connections.\n this.db.onversionchange = (): void => {\n this.db?.close(); // this does not call onclose\n this.disconnected = true;\n this.db = undefined;\n };\n this.db.onclose = (): void => {\n this.disconnected = true;\n this.db = undefined;\n onClose?.();\n };\n\n await this.init();\n });\n }\n\n /** @returns whether or not the database was newly created in this session. */\n public isNewlyCreated(): Promise<boolean> {\n return Promise.resolve(this._isNewlyCreated);\n }\n\n /**\n * Having connected, load initial data from the database and prepare for use\n * @returns Promise which resolves on success\n */\n private init(): Promise<unknown> {\n return Promise.all([this.loadAccountData(), this.loadSyncData()]).then(([accountData, syncData]) => {\n logger.log(`LocalIndexedDBStoreBackend: loaded initial data`);\n this.syncAccumulator.accumulate(\n {\n next_batch: syncData.nextBatch,\n rooms: syncData.roomsData,\n account_data: {\n events: accountData,\n },\n },\n true,\n );\n });\n }\n\n /**\n * Returns the out-of-band membership events for this room that\n * were previously loaded.\n * @returns the events, potentially an empty array if OOB loading didn't yield any new members\n * @returns in case the members for this room haven't been stored yet\n */\n public getOutOfBandMembers(roomId: string): Promise<IStateEventWithRoomId[] | null> {\n return new Promise<IStateEventWithRoomId[] | null>((resolve, reject) => {\n const tx = this.db!.transaction([\"oob_membership_events\"], \"readonly\");\n const store = tx.objectStore(\"oob_membership_events\");\n const roomIndex = store.index(\"room\");\n const range = IDBKeyRange.only(roomId);\n const request = roomIndex.openCursor(range);\n\n const membershipEvents: IStateEventWithRoomId[] = [];\n // did we encounter the oob_written marker object\n // amongst the results? That means OOB member\n // loading already happened for this room\n // but there were no members to persist as they\n // were all known already\n let oobWritten = false;\n\n request.onsuccess = (): void => {\n const cursor = request.result;\n if (!cursor) {\n // Unknown room\n if (!membershipEvents.length && !oobWritten) {\n return resolve(null);\n }\n return resolve(membershipEvents);\n }\n const record = cursor.value;\n if (record.oob_written) {\n oobWritten = true;\n } else {\n membershipEvents.push(record);\n }\n cursor.continue();\n };\n request.onerror = (err): void => {\n reject(err);\n };\n }).then((events) => {\n logger.log(`LL: got ${events?.length} membershipEvents from storage for room ${roomId} ...`);\n return events;\n });\n }\n\n /**\n * Stores the out-of-band membership events for this room. Note that\n * it still makes sense to store an empty array as the OOB status for the room is\n * marked as fetched, and getOutOfBandMembers will return an empty array instead of null\n * @param membershipEvents - the membership events to store\n */\n public async setOutOfBandMembers(roomId: string, membershipEvents: IStateEventWithRoomId[]): Promise<void> {\n logger.log(`LL: backend about to store ${membershipEvents.length}` + ` members for ${roomId}`);\n const tx = this.db!.transaction([\"oob_membership_events\"], \"readwrite\");\n const store = tx.objectStore(\"oob_membership_events\");\n membershipEvents.forEach((e) => {\n store.put(e);\n });\n // aside from all the events, we also write a marker object to the store\n // to mark the fact that OOB members have been written for this room.\n // It's possible that 0 members need to be written as all where previously know\n // but we still need to know whether to return null or [] from getOutOfBandMembers\n // where null means out of band members haven't been stored yet for this room\n const markerObject = {\n room_id: roomId,\n oob_written: true,\n state_key: 0,\n };\n store.put(markerObject);\n await txnAsPromise(tx);\n logger.log(`LL: backend done storing for ${roomId}!`);\n }\n\n public async clearOutOfBandMembers(roomId: string): Promise<void> {\n // the approach to delete all members for a room\n // is to get the min and max state key from the index\n // for that room, and then delete between those\n // keys in the store.\n // this should be way faster than deleting every member\n // individually for a large room.\n const readTx = this.db!.transaction([\"oob_membership_events\"], \"readonly\");\n const store = readTx.objectStore(\"oob_membership_events\");\n const roomIndex = store.index(\"room\");\n const roomRange = IDBKeyRange.only(roomId);\n\n const minStateKeyProm = reqAsCursorPromise(roomIndex.openKeyCursor(roomRange, \"next\")).then(\n (cursor) => (<IDBValidKey[]>cursor?.primaryKey)[1],\n );\n const maxStateKeyProm = reqAsCursorPromise(roomIndex.openKeyCursor(roomRange, \"prev\")).then(\n (cursor) => (<IDBValidKey[]>cursor?.primaryKey)[1],\n );\n const [minStateKey, maxStateKey] = await Promise.all([minStateKeyProm, maxStateKeyProm]);\n\n const writeTx = this.db!.transaction([\"oob_membership_events\"], \"readwrite\");\n const writeStore = writeTx.objectStore(\"oob_membership_events\");\n const membersKeyRange = IDBKeyRange.bound([roomId, minStateKey], [roomId, maxStateKey]);\n\n logger.log(\n `LL: Deleting all users + marker in storage for room ${roomId}, with key range:`,\n [roomId, minStateKey],\n [roomId, maxStateKey],\n );\n await reqAsPromise(writeStore.delete(membersKeyRange));\n }\n\n /**\n * Clear the entire database. This should be used when logging out of a client\n * to prevent mixing data between accounts. Closes the database.\n * @returns Resolved when the database is cleared.\n */\n public clearDatabase(): Promise<void> {\n return new Promise((resolve) => {\n logger.log(`Removing indexeddb instance: ${this.dbName}`);\n\n // Close the database first to avoid firing unexpected close events\n this.db?.close();\n\n const req = this.indexedDB.deleteDatabase(this.dbName);\n\n req.onblocked = (): void => {\n logger.log(`can't yet delete indexeddb ${this.dbName} because it is open elsewhere`);\n };\n\n req.onerror = (): void => {\n // in firefox, with indexedDB disabled, this fails with a\n // DOMError. We treat this as non-fatal, so that we can still\n // use the app.\n logger.warn(`unable to delete js-sdk store indexeddb: ${req.error?.name}`);\n resolve();\n };\n\n req.onsuccess = (): void => {\n logger.log(`Removed indexeddb instance: ${this.dbName}`);\n resolve();\n };\n });\n }\n\n /**\n * @param copy - If false, the data returned is from internal\n * buffers and must not be mutated. Otherwise, a copy is made before\n * returning such that the data can be safely mutated. Default: true.\n *\n * @returns Promise which resolves with a sync response to restore the\n * client state to where it was at the last save, or null if there\n * is no saved sync data.\n */\n public getSavedSync(copy = true): Promise<ISavedSync | null> {\n const data = this.syncAccumulator.getJSON();\n if (!data.nextBatch) return Promise.resolve(null);\n if (copy) {\n // We must deep copy the stored data so that the /sync processing code doesn't\n // corrupt the internal state of the sync accumulator (it adds non-clonable keys)\n return Promise.resolve(deepCopy(data));\n } else {\n return Promise.resolve(data);\n }\n }\n\n public getNextBatchToken(): Promise<string> {\n return Promise.resolve(this.syncAccumulator.getNextBatchToken());\n }\n\n public setSyncData(syncData: ISyncResponse): Promise<void> {\n return Promise.resolve().then(() => {\n this.syncAccumulator.accumulate(syncData);\n });\n }\n\n /**\n * Sync users and all accumulated sync data to the database.\n * If a previous sync is in flight, the new data will be added to the\n * next sync and the current sync's promise will be returned.\n * @param userTuples - The user tuples\n * @returns Promise which resolves if the data was persisted.\n */\n public async syncToDatabase(userTuples: UserTuple[]): Promise<void> {\n if (this.syncToDatabasePromise) {\n logger.warn(\"Skipping syncToDatabase() as persist already in flight\");\n this.pendingUserPresenceData.push(...userTuples);\n return this.syncToDatabasePromise;\n }\n userTuples.unshift(...this.pendingUserPresenceData);\n this.syncToDatabasePromise = this.doSyncToDatabase(userTuples);\n return this.syncToDatabasePromise;\n }\n\n private async doSyncToDatabase(userTuples: UserTuple[]): Promise<void> {\n try {\n const syncData = this.syncAccumulator.getJSON(true);\n await Promise.all([\n this.persistUserPresenceEvents(userTuples),\n this.persistAccountData(syncData.accountData),\n this.persistSyncData(syncData.nextBatch, syncData.roomsData),\n ]);\n } finally {\n this.syncToDatabasePromise = undefined;\n }\n }\n\n /**\n * Persist rooms /sync data along with the next batch token.\n * @param nextBatch - The next_batch /sync value.\n * @param roomsData - The 'rooms' /sync data from a SyncAccumulator\n * @returns Promise which resolves if the data was persisted.\n */\n private persistSyncData(nextBatch: string, roomsData: ISyncResponse[\"rooms\"]): Promise<void> {\n logger.log(\"Persisting sync data up to\", nextBatch);\n return promiseTry<void>(() => {\n const txn = this.db!.transaction([\"sync\"], \"readwrite\");\n const store = txn.objectStore(\"sync\");\n store.put({\n clobber: \"-\", // constant key so will always clobber\n nextBatch,\n roomsData,\n }); // put == UPSERT\n return txnAsPromise(txn).then(() => {\n logger.log(\"Persisted sync data up to\", nextBatch);\n });\n });\n }\n\n /**\n * Persist a list of account data events. Events with the same 'type' will\n * be replaced.\n * @param accountData - An array of raw user-scoped account data events\n * @returns Promise which resolves if the events were persisted.\n */\n private persistAccountData(accountData: IMinimalEvent[]): Promise<void> {\n return promiseTry<void>(() => {\n const txn = this.db!.transaction([\"accountData\"], \"readwrite\");\n const store = txn.objectStore(\"accountData\");\n for (const event of accountData) {\n store.put(event); // put == UPSERT\n }\n return txnAsPromise(txn).then();\n });\n }\n\n /**\n * Persist a list of [user id, presence event] they are for.\n * Users with the same 'userId' will be replaced.\n * Presence events should be the event in its raw form (not the Event\n * object)\n * @param tuples - An array of [userid, event] tuples\n * @returns Promise which resolves if the users were persisted.\n */\n private persistUserPresenceEvents(tuples: UserTuple[]): Promise<void> {\n return promiseTry<void>(() => {\n const txn = this.db!.transaction([\"users\"], \"readwrite\");\n const store = txn.objectStore(\"users\");\n for (const tuple of tuples) {\n store.put({\n userId: tuple[0],\n event: tuple[1],\n }); // put == UPSERT\n }\n return txnAsPromise(txn).then();\n });\n }\n\n /**\n * Load all user presence events from the database. This is not cached.\n * FIXME: It would probably be more sensible to store the events in the\n * sync.\n * @returns A list of presence events in their raw form.\n */\n public getUserPresenceEvents(): Promise<UserTuple[]> {\n return promiseTry<UserTuple[]>(() => {\n const txn = this.db!.transaction([\"users\"], \"readonly\");\n const store = txn.objectStore(\"users\");\n return selectQuery(store, undefined, (cursor) => {\n return [cursor.value.userId, cursor.value.event];\n });\n });\n }\n\n /**\n * Load all the account data events from the database. This is not cached.\n * @returns A list of raw global account events.\n */\n private loadAccountData(): Promise<IMinimalEvent[]> {\n logger.log(`LocalIndexedDBStoreBackend: loading account data...`);\n return promiseTry<IMinimalEvent[]>(() => {\n const txn = this.db!.transaction([\"accountData\"], \"readonly\");\n const store = txn.objectStore(\"accountData\");\n return selectQuery(store, undefined, (cursor) => {\n return cursor.value;\n }).then((result: IMinimalEvent[]) => {\n logger.log(`LocalIndexedDBStoreBackend: loaded account data`);\n return result;\n });\n });\n }\n\n /**\n * Load the sync data from the database.\n * @returns An object with \"roomsData\" and \"nextBatch\" keys.\n */\n private loadSyncData(): Promise<ISyncData> {\n logger.log(`LocalIndexedDBStoreBackend: loading sync data...`);\n return promiseTry<ISyncData>(() => {\n const txn = this.db!.transaction([\"sync\"], \"readonly\");\n const store = txn.objectStore(\"sync\");\n return selectQuery(store, undefined, (cursor) => {\n return cursor.value;\n }).then((results: ISyncData[]) => {\n logger.log(`LocalIndexedDBStoreBackend: loaded sync data`);\n if (results.length > 1) {\n logger.warn(\"loadSyncData: More than 1 sync row found.\");\n }\n return results.length > 0 ? results[0] : ({} as ISyncData);\n });\n });\n }\n\n public getClientOptions(): Promise<IStoredClientOpts | undefined> {\n return Promise.resolve().then(() => {\n const txn = this.db!.transaction([\"client_options\"], \"readonly\");\n const store = txn.objectStore(\"client_options\");\n return selectQuery(store, undefined, (cursor) => {\n return cursor.value?.options;\n }).then((results) => results[0]);\n });\n }\n\n public async storeClientOptions(options: IStoredClientOpts): Promise<void> {\n const txn = this.db!.transaction([\"client_options\"], \"readwrite\");\n const store = txn.objectStore(\"client_options\");\n store.put({\n clobber: \"-\", // constant key so will always clobber\n options: options,\n }); // put == UPSERT\n await txnAsPromise(txn);\n }\n\n public async saveToDeviceBatches(batches: ToDeviceBatchWithTxnId[]): Promise<void> {\n const txn = this.db!.transaction([\"to_device_queue\"], \"readwrite\");\n const store = txn.objectStore(\"to_device_queue\");\n for (const batch of batches) {\n store.add(batch);\n }\n await txnAsPromise(txn);\n }\n\n public async getOldestToDeviceBatch(): Promise<IndexedToDeviceBatch | null> {\n const txn = this.db!.transaction([\"to_device_queue\"], \"readonly\");\n const store = txn.objectStore(\"to_device_queue\");\n const cursor = await reqAsCursorPromise(store.openCursor());\n if (!cursor) return null;\n\n const resultBatch = cursor.value as ToDeviceBatchWithTxnId;\n\n return {\n id: cursor.key as number,\n txnId: resultBatch.txnId,\n eventType: resultBatch.eventType,\n batch: resultBatch.batch,\n };\n }\n\n public async removeToDeviceBatch(id: number): Promise<void> {\n const txn = this.db!.transaction([\"to_device_queue\"], \"readwrite\");\n const store = txn.objectStore(\"to_device_queue\");\n store.delete(id);\n await txnAsPromise(txn);\n }\n\n /*\n * Close the database\n */\n public async destroy(): Promise<void> {\n this.db?.close();\n }\n}\n", "/*\nCopyright 2017 - 2021 Vector Creations Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/* eslint-disable @babel/no-invalid-this */\n\nimport { MemoryStore, type IOpts as IBaseOpts } from \"./memory.ts\";\nimport { LocalIndexedDBStoreBackend } from \"./indexeddb-local-backend.ts\";\nimport { RemoteIndexedDBStoreBackend } from \"./indexeddb-remote-backend.ts\";\nimport { type IEvent, LobiEvent } from \"../models/event.ts\";\nimport { logger } from \"../logger.ts\";\nimport { type ISavedSync } from \"./index.ts\";\nimport { type IIndexedDBBackend } from \"./indexeddb-backend.ts\";\nimport { type ISyncResponse } from \"../sync-accumulator.ts\";\nimport { type EventEmitterEvents, TypedEventEmitter } from \"../models/typed-event-emitter.ts\";\nimport { type IStateEventWithRoomId } from \"../@types/search.ts\";\nimport { type IndexedToDeviceBatch, type ToDeviceBatchWithTxnId } from \"../models/ToDeviceMessage.ts\";\nimport { type IStoredClientOpts } from \"../client.ts\";\n\n/**\n * This is an internal module. See {@link IndexedDBStore} for the public class.\n */\n\n// If this value is too small we'll be writing very often which will cause\n// noticeable stop-the-world pauses. If this value is too big we'll be writing\n// so infrequently that the /sync size gets bigger on reload. Writing more\n// often does not affect the length of the pause since the entire /sync\n// response is persisted each time.\nconst WRITE_DELAY_MS = 1000 * 60 * 5; // once every 5 minutes\n\ninterface IOpts extends IBaseOpts {\n /** The Indexed DB interface e.g. `window.indexedDB` */\n indexedDB?: IDBFactory;\n /** Optional database name. The same name must be used to open the same database. */\n dbName?: string;\n /** Optional factory to spin up a Worker to execute the IDB transactions within. */\n workerFactory?: () => Worker;\n}\n\ntype EventHandlerMap = {\n // Fired when an IDB command fails on a degradable path, and the store falls back to MemoryStore\n // This signals the potential for data volatility.\n degraded: (e: Error) => void;\n // Fired when the IndexedDB gets closed unexpectedly, for example, if the underlying storage is removed or\n // if the user clears the database in the browser's history preferences.\n closed: () => void;\n};\n\nexport class IndexedDBStore extends MemoryStore {\n public static exists(indexedDB: IDBFactory, dbName: string): Promise<boolean> {\n return LocalIndexedDBStoreBackend.exists(indexedDB, dbName);\n }\n\n /**\n * The backend instance.\n * Call through to this API if you need to perform specific indexeddb actions like deleting the database.\n */\n public readonly backend: IIndexedDBBackend;\n\n private startedUp = false;\n private syncTs = 0;\n // Records the last-modified-time of each user at the last point we saved\n // the database, such that we can derive the set if users that have been\n // modified since we last saved.\n private userModifiedMap: Record<string, number> = {}; // user_id : timestamp\n private emitter = new TypedEventEmitter<keyof EventHandlerMap, EventHandlerMap>();\n\n /**\n * Construct a new Indexed Database store, which extends MemoryStore.\n *\n * This store functions like a MemoryStore except it periodically persists\n * the contents of the store to an IndexedDB backend.\n *\n * All data is still kept in-memory but can be loaded from disk by calling\n * `startup()`. This can make startup times quicker as a complete\n * sync from the server is not required. This does not reduce memory usage as all\n * the data is eagerly fetched when `startup()` is called.\n * ```\n * let opts = { indexedDB: window.indexedDB, localStorage: window.localStorage };\n * let store = new IndexedDBStore(opts);\n * let client = sdk.createClient({\n * store: store,\n * });\n * await store.startup(); // load from indexed db, must be called after createClient\n * client.startClient();\n * client.on(\"sync\", function(state, prevState, data) {\n * if (state === \"PREPARED\") {\n * console.log(\"Started up, now with go faster stripes!\");\n * }\n * });\n * ```\n *\n * @param opts - Options object.\n */\n public constructor(opts: IOpts) {\n super(opts);\n\n if (!opts.indexedDB) {\n throw new Error(\"Missing required option: indexedDB\");\n }\n\n if (opts.workerFactory) {\n this.backend = new RemoteIndexedDBStoreBackend(opts.workerFactory, opts.dbName);\n } else {\n this.backend = new LocalIndexedDBStoreBackend(opts.indexedDB, opts.dbName);\n }\n }\n\n /** Re-exports `TypedEventEmitter.on` */\n public on(event: EventEmitterEvents | \"degraded\" | \"closed\", handler: (...args: any[]) => void): void {\n this.emitter.on(event, handler);\n }\n\n /**\n * @returns Resolved when loaded from indexed db.\n */\n public startup(): Promise<void> {\n if (this.startedUp) {\n logger.log(`IndexedDBStore.startup: already started`);\n return Promise.resolve();\n }\n\n logger.log(`IndexedDBStore.startup: connecting to backend`);\n return this.backend\n .connect(this.onClose)\n .then(() => {\n logger.log(`IndexedDBStore.startup: loading presence events`);\n return this.backend.getUserPresenceEvents();\n })\n .then((userPresenceEvents) => {\n logger.log(`IndexedDBStore.startup: processing presence events`);\n userPresenceEvents.forEach(([userId, rawEvent]) => {\n if (!this.createUser) {\n throw new Error(\n \"`IndexedDBStore.startup` must be called after assigning it to the client, not before!\",\n );\n }\n const u = this.createUser(userId);\n if (rawEvent) {\n u.setPresenceEvent(new LobiEvent(rawEvent));\n }\n this.userModifiedMap[u.userId] = u.getLastModifiedTime();\n this.storeUser(u);\n });\n this.startedUp = true;\n });\n }\n\n /*\n * Close the database and destroy any associated workers\n */\n public destroy(): Promise<void> {\n return this.backend.destroy();\n }\n\n private onClose = (): void => {\n this.emitter.emit(\"closed\");\n };\n\n /**\n * @returns Promise which resolves with a sync response to restore the\n * client state to where it was at the last save, or null if there\n * is no saved sync data.\n */\n public getSavedSync = this.degradable((): Promise<ISavedSync | null> => {\n return this.backend.getSavedSync();\n }, \"getSavedSync\");\n\n /** @returns whether or not the database was newly created in this session. */\n public isNewlyCreated = this.degradable((): Promise<boolean> => {\n return this.backend.isNewlyCreated();\n }, \"isNewlyCreated\");\n\n /**\n * @returns If there is a saved sync, the nextBatch token\n * for this sync, otherwise null.\n */\n public getSavedSyncToken = this.degradable((): Promise<string | null> => {\n return this.backend.getNextBatchToken();\n }, \"getSavedSyncToken\");\n\n /**\n * Delete all data from this store.\n * @returns Promise which resolves if the data was deleted from the database.\n */\n public deleteAllData = this.degradable((): Promise<void> => {\n super.deleteAllData();\n return this.backend.clearDatabase().then(\n () => {\n logger.log(\"Deleted indexeddb data.\");\n },\n (err) => {\n logger.error(`Failed to delete indexeddb data: ${err}`);\n throw err;\n },\n );\n }, null);\n\n /**\n * Whether this store would like to save its data\n * Note that obviously whether the store wants to save or\n * not could change between calling this function and calling\n * save().\n *\n * @returns True if calling save() will actually save\n * (at the time this function is called).\n */\n public wantsSave(): boolean {\n const now = Date.now();\n return now - this.syncTs > WRITE_DELAY_MS;\n }\n\n /**\n * Possibly write data to the database.\n *\n * @param force - True to force a save to happen\n * @returns Promise resolves after the write completes\n * (or immediately if no write is performed)\n */\n public save(force = false): Promise<void> {\n if (force || this.wantsSave()) {\n return this.reallySave();\n }\n return Promise.resolve();\n }\n\n private reallySave = this.degradable((): Promise<void> => {\n this.syncTs = Date.now(); // set now to guard against multi-writes\n\n // work out changed users (this doesn't handle deletions but you\n // can't 'delete' users as they are just presence events).\n const userTuples: [userId: string, presenceEvent: Partial<IEvent>][] = [];\n for (const u of this.getUsers()) {\n if (this.userModifiedMap[u.userId] === u.getLastModifiedTime()) continue;\n if (!u.events.presence) continue;\n\n userTuples.push([u.userId, u.events.presence.event]);\n\n // note that we've saved this version of the user\n this.userModifiedMap[u.userId] = u.getLastModifiedTime();\n }\n\n return this.backend.syncToDatabase(userTuples);\n }, null);\n\n public setSyncData = this.degradable((syncData: ISyncResponse): Promise<void> => {\n return this.backend.setSyncData(syncData);\n }, \"setSyncData\");\n\n /**\n * Returns the out-of-band membership events for this room that\n * were previously loaded.\n * @returns the events, potentially an empty array if OOB loading didn't yield any new members\n * @returns in case the members for this room haven't been stored yet\n */\n public getOutOfBandMembers = this.degradable((roomId: string): Promise<IStateEventWithRoomId[] | null> => {\n return this.backend.getOutOfBandMembers(roomId);\n }, \"getOutOfBandMembers\");\n\n /**\n * Stores the out-of-band membership events for this room. Note that\n * it still makes sense to store an empty array as the OOB status for the room is\n * marked as fetched, and getOutOfBandMembers will return an empty array instead of null\n * @param membershipEvents - the membership events to store\n * @returns when all members have been stored\n */\n public setOutOfBandMembers = this.degradable(\n (roomId: string, membershipEvents: IStateEventWithRoomId[]): Promise<void> => {\n super.setOutOfBandMembers(roomId, membershipEvents);\n return this.backend.setOutOfBandMembers(roomId, membershipEvents);\n },\n \"setOutOfBandMembers\",\n );\n\n public clearOutOfBandMembers = this.degradable((roomId: string) => {\n super.clearOutOfBandMembers(roomId);\n return this.backend.clearOutOfBandMembers(roomId);\n }, \"clearOutOfBandMembers\");\n\n public getClientOptions = this.degradable((): Promise<IStoredClientOpts | undefined> => {\n return this.backend.getClientOptions();\n }, \"getClientOptions\");\n\n public storeClientOptions = this.degradable((options: IStoredClientOpts): Promise<void> => {\n super.storeClientOptions(options);\n return this.backend.storeClientOptions(options);\n }, \"storeClientOptions\");\n\n /**\n * All member functions of `IndexedDBStore` that access the backend use this wrapper to\n * watch for failures after initial store startup, including `QuotaExceededError` as\n * free disk space changes, etc.\n *\n * When IndexedDB fails via any of these paths, we degrade this back to a `MemoryStore`\n * in place so that the current operation and all future ones are in-memory only.\n *\n * @param func - The degradable work to do.\n * @param fallback - The method name for fallback.\n * @returns A wrapped member function.\n */\n private degradable<A extends Array<any>, F extends keyof MemoryStore | null, R = void>(\n func: DegradableFn<A, R>,\n fallback: F,\n ): DegradableFn<A, F extends string ? R : void> {\n const fallbackFn = fallback ? (super[fallback] as (...args: A) => Promise<R>) : null;\n\n return (async (...args) => {\n try {\n return await func.call(this, ...args);\n } catch (e) {\n logger.error(\"IndexedDBStore failure, degrading to MemoryStore\", e);\n this.emitter.emit(\"degraded\", e as Error);\n try {\n // We try to delete IndexedDB after degrading since this store is only a\n // cache (the app will still function correctly without the data).\n // It's possible that deleting repair IndexedDB for the next app load,\n // potentially by making a little more space available.\n logger.log(\"IndexedDBStore trying to delete degraded data\");\n await this.backend.clearDatabase();\n logger.log(\"IndexedDBStore delete after degrading succeeded\");\n } catch (e) {\n logger.warn(\"IndexedDBStore delete after degrading failed\", e);\n }\n // Degrade the store from being an instance of `IndexedDBStore` to instead be\n // an instance of `MemoryStore` so that future API calls use the memory path\n // directly and skip IndexedDB entirely. This should be safe as\n // `IndexedDBStore` already extends from `MemoryStore`, so we are making the\n // store become its parent type in a way. The mutator methods of\n // `IndexedDBStore` also maintain the state that `MemoryStore` uses (many are\n // not overridden at all).\n if (fallbackFn) {\n return fallbackFn.call(this, ...args);\n }\n }\n }) as DegradableFn<A, F extends string ? R : void>;\n }\n\n // XXX: ideally these would be stored in indexeddb as part of the room but,\n // we don't store rooms as such and instead accumulate entire sync responses atm.\n public async getPendingEvents(roomId: string): Promise<Partial<IEvent>[]> {\n if (!this.localStorage) return super.getPendingEvents(roomId);\n\n const serialized = this.localStorage.getItem(pendingEventsKey(roomId));\n if (serialized) {\n try {\n return JSON.parse(serialized);\n } catch (e) {\n logger.error(\"Could not parse persisted pending events\", e);\n }\n }\n return [];\n }\n\n public async setPendingEvents(roomId: string, events: Partial<IEvent>[]): Promise<void> {\n if (!this.localStorage) return super.setPendingEvents(roomId, events);\n\n if (events.length > 0) {\n this.localStorage.setItem(pendingEventsKey(roomId), JSON.stringify(events));\n } else {\n this.localStorage.removeItem(pendingEventsKey(roomId));\n }\n }\n\n public saveToDeviceBatches(batches: ToDeviceBatchWithTxnId[]): Promise<void> {\n return this.backend.saveToDeviceBatches(batches);\n }\n\n public getOldestToDeviceBatch(): Promise<IndexedToDeviceBatch | null> {\n return this.backend.getOldestToDeviceBatch();\n }\n\n public removeToDeviceBatch(id: number): Promise<void> {\n return this.backend.removeToDeviceBatch(id);\n }\n}\n\n/**\n * @param roomId - ID of the current room\n * @returns Storage key to retrieve pending events\n */\nfunction pendingEventsKey(roomId: string): string {\n return `mx_pending_events_${roomId}`;\n}\n\ntype DegradableFn<A extends Array<any>, T> = (...args: A) => Promise<T>;\n", "/*\nCopyright 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nexport enum ThreepidMedium {\n Email = \"email\",\n Phone = \"msisdn\",\n}\n\n// TODO: Are these types universal, or specific to just /account/3pid?\nexport interface IThreepid {\n medium: ThreepidMedium;\n address: string;\n validated_at: number; // eslint-disable-line camelcase\n added_at: number; // eslint-disable-line camelcase\n bound?: boolean;\n}\n", "/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { UnstableValue } from \"../NamespacedValue.ts\";\nimport { type IClientWellKnown } from \"../client.ts\";\n\n// disable lint because these are wire responses\n/* eslint-disable camelcase */\n\n/**\n * Represents a response to the CSAPI `/refresh` endpoint.\n */\nexport interface IRefreshTokenResponse {\n access_token: string;\n expires_in_ms: number;\n refresh_token: string;\n}\n\n/* eslint-enable camelcase */\n\n/**\n * Response to GET login flows as per https://spec.matrix.org/v1.3/client-server-api/#get_matrixclientv3login\n */\nexport interface ILoginFlowsResponse {\n flows: LoginFlow[];\n}\n\nexport type LoginFlow = ISSOFlow | IPasswordFlow | ILoginFlow;\n\nexport interface ILoginFlow {\n type: string;\n}\n\nexport interface IPasswordFlow extends ILoginFlow {\n type: \"m.login.password\";\n}\n\nexport const OAUTH_AWARE_PREFERRED_FLOW_FIELD = new UnstableValue(\n \"oauth_aware_preferred\",\n \"org.matrix.msc3824.delegated_oidc_compatibility\",\n);\n\n/**\n * @alias\n * @deprecated use `OAUTH_AWARE_PREFERRED_FLOW_FIELD` instead.\n */\nexport const DELEGATED_OIDC_COMPATIBILITY = OAUTH_AWARE_PREFERRED_FLOW_FIELD;\n\n/**\n * Representation of SSO flow as per https://spec.matrix.org/v1.3/client-server-api/#client-login-via-sso\n */\nexport interface ISSOFlow extends ILoginFlow {\n type: \"m.login.sso\" | \"m.login.cas\";\n // eslint-disable-next-line camelcase\n identity_providers?: IIdentityProvider[];\n [OAUTH_AWARE_PREFERRED_FLOW_FIELD.name]?: boolean;\n [OAUTH_AWARE_PREFERRED_FLOW_FIELD.altName]?: boolean;\n}\n\nexport enum IdentityProviderBrand {\n Gitlab = \"gitlab\",\n Github = \"github\",\n Apple = \"apple\",\n Google = \"google\",\n Facebook = \"facebook\",\n Twitter = \"twitter\",\n}\n\nexport interface IIdentityProvider {\n id: string;\n name: string;\n icon?: string;\n brand?: IdentityProviderBrand | string;\n}\n\nexport enum SSOAction {\n /** The user intends to login to an existing account */\n LOGIN = \"login\",\n\n /** The user intends to register for a new account */\n REGISTER = \"register\",\n}\n\n/**\n * A client can identify a user using their Matrix ID.\n * This can either be the fully qualified Matrix user ID, or just the localpart of the user ID.\n * @see https://spec.matrix.org/v1.7/client-server-api/#matrix-user-id\n */\ntype UserLoginIdentifier = {\n type: \"m.id.user\";\n user: string;\n};\n\n/**\n * A client can identify a user using a 3PID associated with the user’s account on the homeserver,\n * where the 3PID was previously associated using the /account/3pid API.\n * See the 3PID Types Appendix for a list of Third-party ID media.\n * @see https://spec.matrix.org/v1.7/client-server-api/#third-party-id\n */\ntype ThirdPartyLoginIdentifier = {\n type: \"m.id.thirdparty\";\n medium: string;\n address: string;\n};\n\n/**\n * A client can identify a user using a phone number associated with the user’s account,\n * where the phone number was previously associated using the /account/3pid API.\n * The phone number can be passed in as entered by the user; the homeserver will be responsible for canonicalising it.\n * If the client wishes to canonicalise the phone number,\n * then it can use the m.id.thirdparty identifier type with a medium of msisdn instead.\n *\n * The country is the two-letter uppercase ISO-3166-1 alpha-2 country code that the number in phone should be parsed as if it were dialled from.\n *\n * @see https://spec.matrix.org/v1.7/client-server-api/#phone-number\n */\ntype PhoneLoginIdentifier = {\n type: \"m.id.phone\";\n country: string;\n phone: string;\n};\n\ntype SpecUserIdentifier = UserLoginIdentifier | ThirdPartyLoginIdentifier | PhoneLoginIdentifier;\n\n/**\n * User Identifiers usable for login & user-interactive authentication.\n *\n * Extensibly allows more than Matrix specified identifiers.\n */\nexport type UserIdentifier =\n | SpecUserIdentifier\n | { type: Exclude<string, SpecUserIdentifier[\"type\"]>; [key: string]: any };\n\n/**\n * Request body for POST /login request\n * @see https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv3login\n */\nexport interface LoginRequest {\n /**\n * The login type being used.\n */\n type: \"m.login.password\" | \"m.login.token\" | string;\n /**\n * ID of the client device.\n * If this does not correspond to a known client device, a new device will be created.\n * The given device ID must not be the same as a cross-signing key ID.\n * The server will auto-generate a device_id if this is not specified.\n */\n device_id?: string;\n /**\n * Identification information for a user\n */\n identifier?: UserIdentifier;\n /**\n * A display name to assign to the newly-created device.\n * Ignored if device_id corresponds to a known device.\n */\n initial_device_display_name?: string;\n /**\n * When logging in using a third-party identifier, the medium of the identifier.\n * Must be `email`.\n * @deprecated in favour of `identifier`.\n */\n medium?: \"email\";\n /**\n * Required when type is `m.login.password`. The user’s password.\n */\n password?: string;\n /**\n * If true, the client supports refresh tokens.\n */\n refresh_token?: boolean;\n /**\n * Required when type is `m.login.token`. Part of Token-based login.\n */\n token?: string;\n /**\n * The fully qualified user ID or just local part of the user ID, to log in.\n * @deprecated in favour of identifier.\n */\n user?: string;\n // Extensible\n [key: string]: any;\n}\n\n// Export for backwards compatibility\nexport type ILoginParams = LoginRequest;\n\n/**\n * Response body for POST /login request\n * @see https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv3login\n */\nexport interface LoginResponse {\n /**\n * An access token for the account.\n * This access token can then be used to authorize other requests.\n */\n access_token: string;\n /**\n * ID of the logged-in device.\n * Will be the same as the corresponding parameter in the request, if one was specified.\n */\n device_id: string;\n /**\n * The fully-qualified Matrix ID for the account.\n */\n user_id: string;\n /**\n * The lifetime of the access token, in milliseconds.\n * Once the access token has expired a new access token can be obtained by using the provided refresh token.\n * If no refresh token is provided, the client will need to re-log in to obtain a new access token.\n * If not given, the client can assume that the access token will not expire.\n */\n expires_in_ms?: number;\n /**\n * A refresh token for the account.\n * This token can be used to obtain a new access token when it expires by calling the /refresh endpoint.\n */\n refresh_token?: string;\n /**\n * Optional client configuration provided by the server.\n * If present, clients SHOULD use the provided object to reconfigure themselves, optionally validating the URLs within.\n * This object takes the same form as the one returned from .well-known autodiscovery.\n */\n well_known?: IClientWellKnown;\n /**\n * The server_name of the homeserver on which the account has been registered.\n * @deprecated Clients should extract the server_name from user_id (by splitting at the first colon) if they require it.\n */\n home_server?: string;\n}\n\n/**\n * The result of a successful `m.login.token` issuance request as per https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv1loginget_token\n */\nexport interface LoginTokenPostResponse {\n /**\n * The token to use with `m.login.token` to authenticate.\n */\n login_token: string;\n /**\n * Expiration in milliseconds.\n */\n expires_in_ms: number;\n}\n", "/*\nCopyright 2025 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * The timezone the user is currently in. The value of this property should\n * match a timezone provided in https://www.iana.org/time-zones.\n *\n * This key was introduced in Matrix v1.16.\n */\nexport const ProfileKeyTimezone = \"m.tz\";\n\n/**\n * The timezone the user is currently in. The value of this property should\n * match a timezone provided in https://www.iana.org/time-zones.\n *\n * @see https://github.com/matrix-org/matrix-spec-proposals/blob/clokep/profile-tz/proposals/4175-profile-field-time-zone.md\n * @experimental\n * @deprecated Unstable MSC field - Use `ProfileKeyTimezone`\n */\nexport const ProfileKeyMSC4175Timezone = \"us.cloke.msc4175.tz\";\n", "/*\nCopyright 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { TypedEventEmitter } from \"../models/typed-event-emitter.ts\";\n\nexport enum LocalStorageErrors {\n Global = \"Global\",\n SetItemError = \"setItem\",\n GetItemError = \"getItem\",\n RemoveItemError = \"removeItem\",\n ClearError = \"clear\",\n QuotaExceededError = \"QuotaExceededError\",\n}\n\ntype EventHandlerMap = {\n [LocalStorageErrors.Global]: (error: Error) => void;\n [LocalStorageErrors.SetItemError]: (error: Error) => void;\n [LocalStorageErrors.GetItemError]: (error: Error) => void;\n [LocalStorageErrors.RemoveItemError]: (error: Error) => void;\n [LocalStorageErrors.ClearError]: (error: Error) => void;\n [LocalStorageErrors.QuotaExceededError]: (error: Error) => void;\n};\n\n/**\n * Used in element-web as a temporary hack to handle all the localStorage errors on the highest level possible\n * As of 15.11.2021 (DD/MM/YYYY) we're not properly handling local storage exceptions anywhere.\n * This store, as an event emitter, is used to re-emit local storage exceptions so that we can handle them\n * and show some kind of a \"It's dead Jim\" modal to the users, telling them that hey,\n * maybe you should check out your disk, as it's probably dying and your session may die with it.\n * See: https://github.com/vector-im/element-web/issues/18423\n */\nclass LocalStorageErrorsEventsEmitter extends TypedEventEmitter<LocalStorageErrors, EventHandlerMap> {}\nexport const localStorageErrorsEventsEmitter = new LocalStorageErrorsEventsEmitter();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,QAgBYA,qBAAkB,0BAAlBA,qBAAkB;AAAlBA,MAAAA,oBAAkB,UAAA,IAAA;AAAlBA,MAAAA,oBAAkB,YAAA,IAAA;AAAA,aAAlBA;IAAkB,GAAA,CAAA,CAAA;AAAAC,YAAAD,qBAAAA;AAKvB,aAASE,kBAAkBC,KAA6C;AAC3E,UAAIA,QAAQH,mBAAmBI,UAAU;AACrC,eAAOJ,mBAAmBK;MAC9B,WAAWF,QAAQH,mBAAmBK,YAAY;AAC9C,eAAOL,mBAAmBI;MAC9B,OAAO;AACH,cAAM,IAAIE,MAAM,mBAAmB;MACvC;IACJ;;;;;;;;;;;;;AC7BA,QAgBYC,mBAAgB,0BAAhBA,mBAAgB;AAAhBA,MAAAA,kBAAgB,aAAA,IAAA;AAAhBA,MAAAA,kBAAgB,aAAA,IAAA;AAAA,aAAhBA;IAAgB,GAAA,CAAA,CAAA;AAGxBC,YAAAD,mBAAAA;AAAA,QAGQE,sBAAkB,0BAAlBA,qBAAkB;AAAlBA,MAAAA,oBAAkB,SAAA,IAAA;AAAlBA,MAAAA,oBAAkB,sBAAA,IAAA;AAAlBA,MAAAA,oBAAkB,SAAA,IAAA;AAAlBA,MAAAA,oBAAkB,SAAA,IAAA;AAAlBA,MAAAA,oBAAkB,SAAA,IAAA;AAAlBA,MAAAA,oBAAkB,SAAA,IAAA;AAAlBA,MAAAA,oBAAkB,SAAA,IAAA;AAAlBA,MAAAA,oBAAkB,SAAA,IAAA;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AAK,SAAS,KAAK,gBAAgB;AACxC,UAAI,KAAK,SAAS,CAAC,KAAK,gBAAgB;AACtC,aAAK,iBAAiB,KAAK,QAAQ,EAAE,QAAQ,MAAM;AACjD,eAAK,iBAAiB;AAAA,QACxB,CAAC;AAAA,MACH;AACA,YAAM,KAAK;AAAA,IACb;AAAA,EACF;AAAA,EAEQ,8BAAoC;AAC1C,SAAK,gBAAgB;AACrB,SAAK,QAAQ;AACb,QAAI,KAAK,cAAc;AACrB;AAAA,IACF;AACA,SAAK,eAAe,WAAW,MAAM;AACnC,WAAK,eAAe;AACpB,WAAK,KAAK,MAAM,EAAE,MAAM,CAAC,QAAQ;AAC/B,mBAAW,KAAK,uBAAuB,wCAAwC,GAAG;AAAA,MACpF,CAAC;AAAA,IACH,GAAG,mBAAmB;AACtB,SAAK,aAAa,QAAQ;AAAA,EAC5B;AAAA,EAEA,MAAc,UAAyB;AACrC,SAAK,QAAQ;AACb,UAAM,UAAoC;AAAA,MACxC,SAAS;AAAA,MACT,WAAW,KAAK,YAAY,UAAU,KAAK,SAAS,IAAI;AAAA,MACxD,eAAe,KAAK;AAAA,MACpB,GAAI,KAAK,qBAAqB,EAAE,eAAe,UAAU,KAAK,kBAAkB,EAAE,IAAI,CAAC;AAAA,IACzF;AACA,QAAI;AACF,YAAM,KAAK,YAAY,YAAY;AACjC,cAAM,wBAAwB,KAAK,aAAa,OAAO;AACvD,sCAA8B;AAAA,UAC5B,SAAS,KAAK,QAAQ,KAAK,WAAW;AAAA,QACxC,CAAC;AAAA,MACH,CAAC;AAAA,IACH,SAAS,KAAK;AACZ,WAAK,QAAQ;AACb,YAAM;AAAA,IACR;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["WidgetApiDirection", "exports", "invertedDirection", "dir", "ToWidget", "FromWidget", "Error", "MatrixApiVersion", "exports", "UnstableApiVersion", "CurrentApiVersions", "Prerelease1", "Prerelease2", "MSC2762", "MSC2762_UPDATE_STATE", "MSC2871", "MSC2873", "MSC2931", "MSC2974", "MSC2876", "MSC3819", "MSC3846", "MSC3869", "MSC3973", "MSC4039", "_events", "require", "_", "_excluded", "_typeof", "obj", "Symbol", "iterator", "constructor", "prototype", "_objectWithoutProperties", "source", "excluded", "target", "_objectWithoutPropertiesLoose", "key", "i", "Object", "getOwnPropertySymbols", "sourceSymbolKeys", "length", "indexOf", "propertyIsEnumerable", "call", "sourceKeys", "keys", "ownKeys", "object", "enumerableOnly", "symbols", "filter", "sym", "getOwnPropertyDescriptor", "enumerable", "push", "apply", "_objectSpread", "arguments", "forEach", "_defineProperty", "getOwnPropertyDescriptors", "defineProperties", "defineProperty", "_classCallCheck", "instance", "Constructor", "TypeError", "_defineProperties", "props", "descriptor", "configurable", "writable", "_toPropertyKey", "_createClass", "protoProps", "staticProps", "_inherits", "subClass", "superClass", "create", "value", "_setPrototypeOf", "o", "p", "setPrototypeOf", "bind", "__proto__", "_createSuper", "Derived", "hasNativeReflectConstruct", "_isNativeReflectConstruct", "_createSuperInternal", "Super", "_getPrototypeOf", "result", "NewTarget", "Reflect", "construct", "_possibleConstructorReturn", "self", "_assertThisInitialized", "ReferenceError", "sham", "Proxy", "Boolean", "valueOf", "e", "getPrototypeOf", "arg", "_toPrimitive", "String", "input", "hint", "prim", "toPrimitive", "undefined", "res", "Number", "PostmessageTransport", "_EventEmitter", "_super", "sendDirection", "initialWidgetId", "transportWindow", "inboundWindow", "_this", "Map", "AbortController", "ev", "stopController", "signal", "aborted", "data", "strictOriginCheck", "origin", "globalThis", "response", "action", "requestId", "widgetId", "api", "handleResponse", "request", "invertedDirection", "handleRequest", "_widgetId", "get", "_ready", "idBase", "concat", "Date", "now", "index", "id", "outboundRequests", "has", "set", "sendInternal", "message", "console", "log", "targetOrigin", "postMessage", "reply", "responseData", "send", "sendComplete", "then", "r", "_this2", "ready", "Promise", "reject", "Error", "nextRequestId", "WidgetApiToWidgetAction", "UpdateVisibility", "prResolve", "prReject", "resolve", "cleanUp", "err", "timerId", "setTimeout", "timeoutSeconds", "onStop", "addEventListener", "clearTimeout", "removeEventListener", "start", "handleMessage", "stop", "abort", "emit", "CustomEvent", "detail", "req", "isErrorResponse", "_response$response$er", "error", "WidgetApiResponseError", "EventEmitter", "exports", "WidgetApiToWidgetAction", "exports", "WidgetApiFromWidgetAction", "OpenIDRequestState", "exports", "MatrixWidgetType", "exports", "BuiltInModalButtonID", "exports", "EventKind", "exports", "EventDirection", "WidgetEventCapability", "direction", "eventType", "kind", "keyStr", "raw", "_classCallCheck", "_createClass", "key", "value", "matchesAsStateEvent", "stateKey", "State", "matchesAsToDeviceEvent", "ToDevice", "matchesAsRoomEvent", "msgtype", "arguments", "length", "undefined", "Event", "matchesAsRoomAccountData", "RoomAccount", "forStateEvent", "replace", "concat", "str", "findEventCapabilities", "forToDeviceEvent", "forRoomEvent", "forRoomMessageEvent", "forRoomAccountData", "capabilities", "parsed", "_iterator", "_createForOfIteratorHelper", "_step", "s", "n", "done", "cap", "eventSegment", "startsWith", "Send", "substring", "Receive", "expectingKeyStr", "includes", "parts", "split", "idx", "findIndex", "p", "endsWith", "slice", "map", "join", "push", "err", "e", "f", "Symbols", "exports", "UpdateDelayedEventAction", "exports", "_events", "require", "_WidgetApiDirection", "_ApiVersion", "_PostmessageTransport", "_WidgetApiAction", "_GetOpenIDAction", "_WidgetType", "_ModalWidgetActions", "_WidgetEventCapability", "_Symbols", "_UpdateDelayedEventAction", "_regeneratorRuntime", "exports", "Op", "Object", "prototype", "hasOwn", "hasOwnProperty", "defineProperty", "obj", "key", "desc", "value", "$Symbol", "Symbol", "iteratorSymbol", "iterator", "asyncIteratorSymbol", "asyncIterator", "toStringTagSymbol", "toStringTag", "define", "enumerable", "configurable", "writable", "err", "wrap", "innerFn", "outerFn", "self", "tryLocsList", "protoGenerator", "Generator", "generator", "create", "context", "Context", "makeInvokeMethod", "tryCatch", "fn", "arg", "type", "call", "ContinueSentinel", "GeneratorFunction", "GeneratorFunctionPrototype", "IteratorPrototype", "getProto", "getPrototypeOf", "NativeIteratorPrototype", "values", "Gp", "defineIteratorMethods", "forEach", "method", "_invoke", "AsyncIterator", "PromiseImpl", "invoke", "resolve", "reject", "record", "result", "_typeof", "__await", "then", "unwrapped", "error", "previousPromise", "callInvokeWithMethodAndArg", "state", "Error", "doneResult", "delegate", "delegateResult", "maybeInvokeDelegate", "sent", "_sent", "dispatchException", "abrupt", "done", "methodName", "undefined", "TypeError", "info", "resultName", "next", "nextLoc", "pushTryEntry", "locs", "entry", "tryLoc", "catchLoc", "finallyLoc", "afterLoc", "tryEntries", "push", "resetTryEntry", "completion", "reset", "iterable", "iteratorMethod", "isNaN", "length", "i", "displayName", "isGeneratorFunction", "genFun", "ctor", "constructor", "name", "mark", "setPrototypeOf", "__proto__", "awrap", "async", "Promise", "iter", "keys", "val", "object", "reverse", "pop", "skipTempReset", "prev", "charAt", "slice", "stop", "rootRecord", "rval", "exception", "handle", "loc", "caught", "hasCatch", "hasFinally", "finallyEntry", "complete", "finish", "_catch", "thrown", "delegateYield", "asyncGeneratorStep", "gen", "_next", "_throw", "_asyncToGenerator", "args", "arguments", "apply", "ownKeys", "enumerableOnly", "getOwnPropertySymbols", "symbols", "filter", "sym", "getOwnPropertyDescriptor", "_objectSpread", "target", "source", "_defineProperty", "getOwnPropertyDescriptors", "defineProperties", "_createForOfIteratorHelper", "o", "allowArrayLike", "it", "Array", "isArray", "_unsupportedIterableToArray", "F", "s", "n", "e", "_e", "f", "normalCompletion", "didErr", "step", "_e2", "minLen", "_arrayLikeToArray", "toString", "from", "test", "arr", "len", "arr2", "_toPropertyKey", "_defineProperties", "props", "descriptor", "_createClass", "Constructor", "protoProps", "staticProps", "_toPrimitive", "String", "input", "hint", "prim", "toPrimitive", "res", "Number", "_classCallCheck", "instance", "_inherits", "subClass", "superClass", "_setPrototypeOf", "_createSuper", "Derived", "hasNativeReflectConstruct", "_isNativeReflectConstruct", "_createSuperInternal", "Super", "_getPrototypeOf", "NewTarget", "Reflect", "construct", "_possibleConstructorReturn", "_assertThisInitialized", "ReferenceError", "_wrapNativeSuper", "Class", "_cache", "Map", "_isNativeFunction", "has", "get", "set", "Wrapper", "_construct", "Parent", "bind", "a", "Function", "sham", "Proxy", "Boolean", "valueOf", "indexOf", "p", "_awaitAsyncGenerator", "_OverloadYield", "_wrapAsyncGenerator", "_AsyncGenerator", "front", "back", "resume", "overloaded", "v", "nextKey", "k", "settle", "request", "kind", "WidgetApiResponseError", "_Error", "_super", "message", "data", "_this2", "WidgetApi", "_EventEmitter", "_super2", "_this3", "widgetId", "clientOrigin", "globalThis", "parent", "transport", "PostmessageTransport", "WidgetApiDirection", "FromWidget", "targetOrigin", "on", "handleMessage", "hasCapability", "capability", "approvedCapabilities", "includes", "requestedCapabilities", "requestCapability", "capabilitiesFinished", "supportsMSC2974Renegotiate", "requestCapabilities", "capabilities", "_iterator", "_step", "cap", "requestCapabilityForRoomTimeline", "roomId", "concat", "requestCapabilityToSendState", "eventType", "stateKey", "WidgetEventCapability", "forStateEvent", "EventDirection", "Send", "raw", "requestCapabilityToReceiveState", "Receive", "requestCapabilityToSendToDevice", "forToDeviceEvent", "requestCapabilityToReceiveToDevice", "requestCapabilityToSendEvent", "forRoomEvent", "requestCapabilityToReceiveEvent", "requestCapabilityToSendMessage", "msgtype", "forRoomMessageEvent", "requestCapabilityToReceiveMessage", "requestCapabilityToReceiveRoomAccountData", "forRoomAccountData", "requestOpenIDConnectToken", "_this4", "sendComplete", "WidgetApiFromWidgetAction", "GetOpenIDCredentials", "response", "rdata", "OpenIDRequestState", "Allowed", "Blocked", "PendingUserConfirmation", "handlerFn", "ev", "preventDefault", "detail", "original_request_id", "requestId", "reply", "off", "WidgetApiToWidgetAction", "OpenIDCredentials", "updateRequestedCapabilities", "send", "MSC2974RenegotiateCapabilities", "sendContentLoaded", "ContentLoaded", "sendSticker", "sticker", "SendSticker", "setAlwaysOnScreen", "UpdateAlwaysOnScreen", "success", "openModalWidget", "url", "buttons", "MatrixWidgetType", "Custom", "OpenModalWidget", "closeModalWidget", "CloseModalWidget", "sendRoomEvent", "content", "delay", "parentDelayId", "stickyDurationMs", "sendEvent", "sendStateEvent", "SendEvent", "state_key", "room_id", "parent_delay_id", "sticky_duration_ms", "cancelScheduledDelayedEvent", "delayId", "MSC4157UpdateDelayedEvent", "delay_id", "action", "UpdateDelayedEventAction", "Cancel", "restartScheduledDelayedEvent", "Restart", "sendScheduledDelayedEvent", "sendToDevice", "encrypted", "contentMap", "SendToDevice", "messages", "readRoomAccountData", "roomIds", "Symbols", "AnyRoom", "room_ids", "BeeperReadRoomAccountData", "r", "events", "readRoomEvents", "limit", "since", "MSC2876ReadEvents", "_readEventRelations", "_callee", "eventId", "relationType", "to", "direction", "versions", "_callee$", "_context", "getClientVersions", "UnstableApiVersion", "MSC3869", "event_id", "rel_type", "event_type", "MSC3869ReadRelations", "readEventRelations", "_x", "_x2", "_x3", "_x4", "_x5", "_x6", "_x7", "_x8", "readStateEvents", "setModalButtonEnabled", "buttonId", "isEnabled", "BuiltInModalButtonID", "Close", "SetModalButtonEnabled", "button", "enabled", "navigateTo", "uri", "startsWith", "MSC2931Navigate", "getTurnServers", "_this", "_callee3", "setTurnServer", "onUpdateTurnServers", "_callee3$", "_context3", "_ref", "_callee2", "_callee2$", "_context2", "_x9", "UpdateTurnServers", "turnServerWatchers", "WatchTurnServers", "t0", "UnwatchTurnServers", "_searchUserDirectory", "_callee4", "searchTerm", "_callee4$", "_context4", "MSC3973", "search_term", "MSC3973UserDirectorySearch", "searchUserDirectory", "_x10", "_x11", "_getMediaConfig", "_callee5", "_callee5$", "_context5", "MSC4039", "MSC4039GetMediaConfigAction", "getMediaConfig", "_uploadFile", "_callee6", "file", "_callee6$", "_context6", "MSC4039UploadFileAction", "uploadFile", "_x12", "_downloadFile", "_callee7", "contentUri", "_callee7$", "_context7", "content_uri", "MSC4039DownloadFileAction", "downloadFile", "_x13", "start", "_this5", "MSC2974", "actionEv", "CustomEvent", "cancelable", "emit", "defaultPrevented", "SupportedApiVersions", "replyVersions", "Capabilities", "handleCapabilities", "UpdateVisibility", "NotifyCapabilities", "supported_versions", "CurrentApiVersions", "_this6", "cachedClientVersions", "console", "warn", "_this7", "MSC2871", "once", "approved", "EventEmitter", "MatrixCapabilities", "exports", "StickerpickerCapabilities", "StickerSending", "VideoConferenceCapabilities", "AlwaysOnScreen", "isTimelineCapability", "capability", "startsWith", "isTimelineCapabilityFor", "roomId", "concat", "getTimelineRoomIDFromCapability", "substring", "indexOf", "SimpleObservable", "initialFn", "_classCallCheck", "_defineProperty", "listeners", "push", "_createClass", "key", "value", "onUpdate", "fn", "update", "val", "_iterator", "_createForOfIteratorHelper", "_step", "s", "n", "done", "listener", "err", "e", "f", "close", "exports", "_events", "require", "_PostmessageTransport", "_WidgetApiDirection", "_WidgetApiAction", "_Capabilities", "_ApiVersion", "_WidgetEventCapability", "_GetOpenIDAction", "_SimpleObservable", "_Symbols", "_UpdateDelayedEventAction", "_typeof", "obj", "Symbol", "iterator", "constructor", "prototype", "ownKeys", "object", "enumerableOnly", "keys", "Object", "getOwnPropertySymbols", "symbols", "filter", "sym", "getOwnPropertyDescriptor", "enumerable", "push", "apply", "_objectSpread", "target", "i", "arguments", "length", "source", "forEach", "key", "_defineProperty", "getOwnPropertyDescriptors", "defineProperties", "defineProperty", "_createForOfIteratorHelper", "o", "allowArrayLike", "it", "Array", "isArray", "_unsupportedIterableToArray", "F", "s", "n", "done", "value", "e", "_e", "f", "TypeError", "normalCompletion", "didErr", "err", "call", "step", "next", "_e2", "_toConsumableArray", "arr", "_arrayWithoutHoles", "_iterableToArray", "_nonIterableSpread", "minLen", "_arrayLikeToArray", "toString", "slice", "name", "from", "test", "iter", "len", "arr2", "_regeneratorRuntime", "exports", "Op", "hasOwn", "hasOwnProperty", "desc", "$Symbol", "iteratorSymbol", "asyncIteratorSymbol", "asyncIterator", "toStringTagSymbol", "toStringTag", "define", "configurable", "writable", "wrap", "innerFn", "outerFn", "self", "tryLocsList", "protoGenerator", "Generator", "generator", "create", "context", "Context", "makeInvokeMethod", "tryCatch", "fn", "arg", "type", "ContinueSentinel", "GeneratorFunction", "GeneratorFunctionPrototype", "IteratorPrototype", "getProto", "getPrototypeOf", "NativeIteratorPrototype", "values", "Gp", "defineIteratorMethods", "method", "_invoke", "AsyncIterator", "PromiseImpl", "invoke", "resolve", "reject", "record", "result", "__await", "then", "unwrapped", "error", "previousPromise", "callInvokeWithMethodAndArg", "state", "Error", "doneResult", "delegate", "delegateResult", "maybeInvokeDelegate", "sent", "_sent", "dispatchException", "abrupt", "methodName", "undefined", "info", "resultName", "nextLoc", "pushTryEntry", "locs", "entry", "tryLoc", "catchLoc", "finallyLoc", "afterLoc", "tryEntries", "resetTryEntry", "completion", "reset", "iterable", "iteratorMethod", "isNaN", "displayName", "isGeneratorFunction", "genFun", "ctor", "mark", "setPrototypeOf", "__proto__", "awrap", "async", "Promise", "val", "reverse", "pop", "skipTempReset", "prev", "charAt", "stop", "rootRecord", "rval", "exception", "handle", "loc", "caught", "hasCatch", "hasFinally", "finallyEntry", "complete", "finish", "_catch", "thrown", "delegateYield", "asyncGeneratorStep", "gen", "_next", "_throw", "_asyncToGenerator", "args", "_classCallCheck", "instance", "Constructor", "_defineProperties", "props", "descriptor", "_toPropertyKey", "_createClass", "protoProps", "staticProps", "_inherits", "subClass", "superClass", "_setPrototypeOf", "p", "bind", "_createSuper", "Derived", "hasNativeReflectConstruct", "_isNativeReflectConstruct", "_createSuperInternal", "Super", "_getPrototypeOf", "NewTarget", "Reflect", "construct", "_possibleConstructorReturn", "_assertThisInitialized", "ReferenceError", "sham", "Proxy", "Boolean", "valueOf", "_toPrimitive", "String", "input", "hint", "prim", "toPrimitive", "res", "Number", "_asyncIterator", "sync", "retry", "AsyncFromSyncIterator", "AsyncFromSyncIteratorContinuation", "r", "_return", "ret", "thr", "ClientWidgetApi", "_EventEmitter", "_super", "widget", "iframe", "driver", "_this", "Set", "Map", "contentWindow", "transport", "PostmessageTransport", "WidgetApiDirection", "ToWidget", "id", "globalThis", "targetOrigin", "origin", "on", "handleMessage", "addEventListener", "onIframeLoad", "start", "hasCapability", "capability", "allowedCapabilities", "has", "canUseRoomTimeline", "roomId", "concat", "Symbols", "AnyRoom", "canSendRoomEvent", "eventType", "msgtype", "allowedEvents", "some", "matchesAsRoomEvent", "EventDirection", "Send", "canSendStateEvent", "stateKey", "matchesAsStateEvent", "canSendToDeviceEvent", "matchesAsToDeviceEvent", "canReceiveRoomEvent", "Receive", "canReceiveStateEvent", "canReceiveToDeviceEvent", "canReceiveRoomAccountData", "matchesAsRoomAccountData", "isStopped", "_getWidgetVersions", "_callee", "_callee$", "_context", "cachedWidgetVersions", "send", "WidgetApiToWidgetAction", "SupportedApiVersions", "supported_versions", "t0", "console", "warn", "getWidgetVersions", "beginCapabilities", "_this2", "emit", "requestedCaps", "Capabilities", "caps", "capabilities", "validateCapabilities", "allowedCaps", "allowCapabilities", "allowed", "requested", "_this$allowedEvents", "_this3", "log", "_iterator2", "_step2", "c", "add", "WidgetEventCapability", "findEventCapabilities", "NotifyCapabilities", "approved", "_iterator3", "_step3", "isTimelineCapability", "getTimelineRoomIDFromCapability", "_iterator5", "getKnownRooms", "_step5", "pushRoomState", "includes", "MatrixCapabilities", "MSC4407ReceiveStickyEvent", "debug", "roomIds", "map", "timelineCapability", "flatMap", "roomIdOrWildcard", "_iterator4", "_step4", "_loop", "pushStickyState", "viewedRoomId", "ev", "waitForIframeLoad", "contentLoadedWaitTimer", "setTimeout", "contentLoadedActionSent", "handleContentLoadedAction", "action", "clearTimeout", "reply", "message", "replyVersions", "request", "CurrentApiVersions", "_supportsUpdateState", "_callee2", "_callee2$", "_context2", "UnstableApiVersion", "MSC2762_UPDATE_STATE", "supportsUpdateState", "handleCapabilitiesRenegotiate", "_request$data", "_this4", "data", "newlyRequested", "size", "handleNavigate", "_request$data2", "_this5", "MSC2931Navigate", "uri", "startsWith", "onErr", "handleDriverError", "navigate", "handleOIDC", "_this6", "phase", "replyState", "credential", "OpenIDCredentials", "original_request_id", "requestId", "replyError", "msg", "OpenIDRequestState", "Blocked", "observer", "SimpleObservable", "update", "PendingUserConfirmation", "close", "Allowed", "token", "askOpenID", "handleReadRoomAccountData", "_this7", "events", "readRoomAccountData", "evs", "_handleReadEvents", "_callee3", "_this8", "askRoomIds", "_iterator6", "_step6", "limit", "since", "_stateKey", "_callee3$", "_context3", "room_ids", "state_key", "readRoomEvents", "readStateEvents", "all", "readRoomTimeline", "flat", "t1", "readRoomState", "handleReadEvents", "_x", "handleSendEvent", "_this9", "room_id", "isDelayedEvent", "delay", "parent_delay_id", "MSC4157SendDelayedEvent", "isStickyEvent", "sticky_duration_ms", "MSC4407SendStickyEvent", "sendEventPromise", "_request$data$delay", "_request$data$parent_", "sendDelayedEvent", "content", "sendEvent", "params", "_request$data$delay2", "_request$data$parent_2", "sendDelayedStickyEvent", "_this$driver", "_request$data$delay3", "_request$data$parent_3", "sendStickyEvent", "_this$driver2", "sentEvent", "event_id", "eventId", "delay_id", "delayId", "handleUpdateDelayedEvent", "_this10", "MSC4157UpdateDelayedEvent", "updateDelayedEvent", "UpdateDelayedEventAction", "Cancel", "cancelScheduledDelayedEvent", "Restart", "restartScheduledDelayedEvent", "sendScheduledDelayedEvent", "_handleSendToDevice", "_callee4", "_callee4$", "_context4", "messages", "encrypted", "sendToDevice", "handleSendToDevice", "_x2", "_pollTurnServers", "_callee5", "turnServers", "initialServer", "_iteratorAbruptCompletion", "_didIteratorError", "_iteratorError", "_iterator", "_step", "server", "_callee5$", "_context5", "UpdateTurnServers", "pollTurnServers", "_x3", "_x4", "_handleWatchTurnServers", "_callee6", "_yield$turnServers$ne", "_callee6$", "_context6", "MSC3846TurnServers", "getTurnServers", "handleWatchTurnServers", "_x5", "_handleUnwatchTurnServers", "_callee7", "_callee7$", "_context7", "handleUnwatchTurnServers", "_x6", "_handleReadRelations", "_callee8", "_this11", "chunk", "_callee8$", "_context8", "readEventRelations", "rel_type", "event_type", "to", "direction", "prev_batch", "prevBatch", "next_batch", "nextBatch", "handleReadRelations", "_x7", "_handleUserDirectorySearch", "_callee9", "_callee9$", "_context9", "MSC3973UserDirectorySearch", "search_term", "searchUserDirectory", "limited", "results", "user_id", "userId", "display_name", "avatar_url", "avatarUrl", "handleUserDirectorySearch", "_x8", "_handleGetMediaConfig", "_callee10", "_callee10$", "_context10", "MSC4039UploadFile", "getMediaConfig", "handleGetMediaConfig", "_x9", "_handleUploadFile", "_callee11", "_callee11$", "_context11", "uploadFile", "file", "content_uri", "contentUri", "handleUploadFile", "_x10", "_handleDownloadFile", "_callee12", "_callee12$", "_context12", "MSC4039DownloadFile", "downloadFile", "handleDownloadFile", "_x11", "processError", "actionEv", "CustomEvent", "detail", "cancelable", "defaultPrevented", "WidgetApiFromWidgetAction", "ContentLoaded", "SendEvent", "SendToDevice", "GetOpenIDCredentials", "MSC2974RenegotiateCapabilities", "MSC2876ReadEvents", "WatchTurnServers", "UnwatchTurnServers", "MSC3869ReadRelations", "BeeperReadRoomAccountData", "MSC4039GetMediaConfigAction", "MSC4039UploadFileAction", "MSC4039DownloadFileAction", "updateTheme", "theme", "ThemeChange", "updateLanguage", "lang", "LanguageChange", "takeScreenshot", "TakeScreenshot", "updateVisibility", "isVisible", "UpdateVisibility", "visible", "sendWidgetConfig", "WidgetConfig", "notifyModalWidgetButtonClicked", "ButtonClicked", "notifyModalWidgetClose", "CloseModalWidget", "_feedEvent", "_callee13", "rawEvent", "currentViewedRoomId", "_rawEvent$content", "_callee13$", "_context13", "setViewedRoomId", "feedEvent", "_x12", "_x13", "_feedToDevice", "_callee14", "_callee14$", "_context14", "feedToDevice", "_x14", "_x15", "_flushRoomState", "_callee15", "_iterator7", "_step7", "eventTypeMap", "_iterator8", "_step8", "stateKeyMap", "_callee15$", "_context15", "pushRoomStateTasks", "pushRoomStateResult", "UpdateState", "flushRoomStateTask", "flushRoomState", "_pushStickyState", "_callee17", "_this12", "_callee17$", "_context17", "readStickyEvents", "filtered", "_e$content", "stickyEvents", "_ref2", "_callee16", "_ref", "promises", "_callee16$", "_context16", "_x17", "_x16", "_this13", "_iterator9", "_step9", "_loop2", "cap", "kind", "EventKind", "State", "_cap$keyStr", "_this13$flushRoomStat", "keyStr", "task", "_iterator10", "_step10", "event", "get", "set", "_feedStateUpdate", "_callee18", "_callee18$", "_context18", "feedStateUpdate", "_x18", "EventEmitter", "isErrorResponse", "responseData", "error", "_typeof", "message", "WidgetKind", "exports", "ModalButtonKind", "exports", "isValidUrl", "val", "parsed", "URL", "protocol", "e", "TypeError", "assertPresent", "obj", "key", "Error", "concat", "String", "_", "require", "_utils", "_typeof", "obj", "Symbol", "iterator", "constructor", "prototype", "_classCallCheck", "instance", "Constructor", "TypeError", "_defineProperties", "target", "props", "i", "length", "descriptor", "enumerable", "configurable", "writable", "Object", "defineProperty", "_toPropertyKey", "key", "_createClass", "protoProps", "staticProps", "arg", "_toPrimitive", "String", "input", "hint", "prim", "toPrimitive", "undefined", "res", "call", "Number", "Widget", "definition", "Error", "assertPresent", "get", "creatorUserId", "type", "id", "name", "rawData", "title", "url", "URL", "templateUrl", "origin", "waitForIframeLoad", "data", "value", "getCompleteUrl", "params", "runTemplate", "exports", "_Widget", "require", "_url", "_typeof", "obj", "Symbol", "iterator", "constructor", "prototype", "_createForOfIteratorHelper", "o", "allowArrayLike", "it", "Array", "isArray", "_unsupportedIterableToArray", "length", "i", "F", "s", "n", "done", "value", "e", "_e", "f", "TypeError", "normalCompletion", "didErr", "err", "call", "step", "next", "_e2", "minLen", "_arrayLikeToArray", "Object", "toString", "slice", "name", "from", "test", "arr", "len", "arr2", "_classCallCheck", "instance", "Constructor", "_defineProperties", "target", "props", "descriptor", "enumerable", "configurable", "writable", "defineProperty", "_toPropertyKey", "key", "_createClass", "protoProps", "staticProps", "arg", "_toPrimitive", "String", "input", "hint", "prim", "toPrimitive", "undefined", "res", "Number", "WidgetParser", "parseAccountData", "content", "result", "_i", "_Object$keys", "keys", "widgetId", "roughWidget", "type", "sender", "probableWidgetId", "state_key", "id", "asStateEvent", "event_id", "room_id", "origin_server_ts", "widget", "parseRoomWidget", "push", "parseWidgetsFromRoomState", "currentState", "_iterator", "_step", "state", "stateEvent", "estimatedWidget", "creatorUserId", "url", "waitForIframeLoad", "data", "processEstimatedWidget", "isValidUrl", "Widget", "exports", "runTemplate", "url", "widget", "params", "variables", "Object", "assign", "data", "widgetRoomId", "currentUserId", "userDisplayName", "userHttpAvatarUrl", "id", "clientId", "clientTheme", "clientLanguage", "deviceId", "baseUrl", "result", "_i", "_Object$keys", "keys", "length", "key", "pattern", "concat", "replace", "rexp", "RegExp", "encodeURIComponent", "toString", "a", "undefined", "String", "_", "require", "_typeof", "obj", "Symbol", "iterator", "constructor", "prototype", "_classCallCheck", "instance", "Constructor", "TypeError", "_defineProperties", "target", "props", "i", "length", "descriptor", "enumerable", "configurable", "writable", "Object", "defineProperty", "_toPropertyKey", "key", "_createClass", "protoProps", "staticProps", "arg", "_toPrimitive", "String", "input", "hint", "prim", "toPrimitive", "undefined", "res", "call", "Number", "WidgetDriver", "value", "validateCapabilities", "requested", "Promise", "resolve", "Set", "sendEvent", "eventType", "content", "stateKey", "arguments", "roomId", "reject", "Error", "sendStickyEvent", "stickyDurationMs", "sendDelayedEvent", "delay", "parentDelayId", "sendDelayedStickyEvent", "cancelScheduledDelayedEvent", "delayId", "restartScheduledDelayedEvent", "sendScheduledDelayedEvent", "sendToDevice", "encrypted", "contentMap", "readRoomAccountData", "roomIds", "readRoomEvents", "msgtype", "limit", "since", "readStateEvents", "readStickyEvents", "readRoomTimeline", "readRoomState", "MAX_SAFE_INTEGER", "readEventRelations", "eventId", "relationType", "from", "to", "direction", "chunk", "askOpenID", "observer", "update", "state", "OpenIDRequestState", "Blocked", "navigate", "uri", "getTurnServers", "searchUserDirectory", "searchTerm", "limited", "results", "getMediaConfig", "uploadFile", "file", "downloadFile", "contentUri", "getKnownRooms", "processError", "error", "exports", "_WidgetApi", "require", "Object", "keys", "forEach", "key", "exports", "defineProperty", "enumerable", "get", "_ClientWidgetApi", "_Symbols", "_PostmessageTransport", "_WidgetType", "_IWidgetApiErrorResponse", "_WidgetApiAction", "_WidgetApiDirection", "_ApiVersion", "_Capabilities", "_GetOpenIDAction", "_WidgetKind", "_ModalButtonKind", "_ModalWidgetActions", "_UpdateDelayedEventAction", "_WidgetEventCapability", "_url", "_utils", "_Widget", "_WidgetParser", "_urlTemplate", "_SimpleObservable", "_WidgetDriver", "isValidFilterId", "filterId", "isValidStr", "MemoryStore", "constructor", "opts", "arguments", "length", "undefined", "_defineProperty", "MapWithDefault", "Map", "event", "state", "member", "_this$createUser", "membership", "KnownMembership", "Invite", "user", "users", "userId", "createUser", "call", "name", "setDisplayName", "events", "setRawDisplayName", "getDirectionalContent", "displayname", "getContent", "avatar_url", "setAvatarUrl", "localStorage", "getSyncToken", "syncToken", "isNewlyCreated", "Promise", "resolve", "setSyncToken", "token", "storeRoom", "room", "rooms", "roomId", "currentState", "on", "RoomStateEvent", "Members", "onRoomMember", "getMembers", "forEach", "m", "setUserCreator", "creator", "getRoom", "getRooms", "Object", "values", "removeRoom", "removeListener", "getRoomSummaries", "map", "summary", "storeUser", "getUser", "getUsers", "scrollback", "limit", "storeEvents", "toStart", "storeFilter", "filter", "filters", "getOrCreate", "set", "getFilter", "_this$filters$get", "get", "getFilterIdByName", "filterName", "key", "value", "getItem", "_unused", "setFilterIdByName", "setItem", "removeItem", "_unused2", "storeAccountDataEvents", "isDeleted", "keys", "accountData", "delete", "getType", "getAccountData", "eventType", "setSyncData", "syncData", "wantsSave", "save", "force", "startup", "getSavedSync", "getSavedSyncToken", "deleteAllData", "getOutOfBandMembers", "oobMembers", "setOutOfBandMembers", "membershipEvents", "clearOutOfBandMembers", "getClientOptions", "clientOptions", "storeClientOptions", "options", "assign", "getPendingEvents", "_this", "_asyncToGenerator", "_this$pendingEvents$r", "pendingEvents", "setPendingEvents", "_this2", "saveToDeviceBatches", "batches", "batch", "pendingToDeviceBatches", "push", "id", "nextToDeviceBatchId", "txnId", "getOldestToDeviceBatch", "_this3", "removeToDeviceBatch", "destroy", "ReceiptAccumulator", "constructor", "_defineProperty", "Map", "MapWithDefault", "setUnthreaded", "userId", "receipt", "unthreadedReadReceipts", "set", "setThreaded", "threadId", "threadedReadReceipts", "getOrCreate", "allUnthreaded", "entries", "allThreaded", "receiptsForThread", "values", "e", "consumeEphemeralEvents", "events", "forEach", "type", "EventType", "Receipt", "content", "Object", "keys", "eventId", "_ref", "key", "value", "isSupportedReceiptType", "data", "thread_id", "buildAccumulatedReceiptEvent", "roomId", "receiptEvent", "room_id", "receiptEventContent", "receiptData", "recursiveMapToObject", "size", "Category", "isTaggedEvent", "event", "undefined", "SyncAccumulator", "constructor", "opts", "arguments", "length", "_defineProperty", "maxTimelineEntries", "accumulate", "syncResponse", "fromDatabase", "accumulateRooms", "accumulateAccountData", "nextBatch", "next_batch", "account_data", "events", "forEach", "e", "accountData", "type", "rooms", "invite", "Object", "keys", "roomId", "accumulateRoom", "Invite", "join", "Join", "leave", "Leave", "knock", "Knock", "category", "data", "knockRooms", "accumulateInviteState", "accumulateKnockState", "inviteRooms", "accumulateJoinState", "joinRooms", "logger", "error", "invite_state", "currentData", "hasAdded", "i", "current", "state_key", "push", "knock_state", "_ref", "_data", "_data$ephemeral", "_data$state", "_data$orgMatrixMsc", "_data$timeline", "_data$msc4354_sticky", "now", "Date", "_currentState", "create", "_timeline", "_accountData", "_unreadNotifications", "_unreadThreadNotifications", "_summary", "_receipts", "ReceiptAccumulator", "_stickyEvents", "unread_notifications", "UNREAD_THREAD_NOTIFICATIONS", "stable", "unstable", "summary", "_sum$HEROES_KEY", "_sum$JOINED_COUNT_KEY", "_sum$INVITED_COUNT_KE", "HEROES_KEY", "INVITED_COUNT_KEY", "JOINED_COUNT_KEY", "acc", "sum", "consumeEphemeralEvents", "ephemeral", "timeline", "limited", "state", "setState", "index", "_data$timeline$prev_b", "transformedEvent", "_e$unsigned", "assign", "unsigned", "age", "_localTs", "token", "prev_batch", "filter", "_ref2", "expiresTs", "msc4354_sticky", "concat", "map", "cappedDuration", "Math", "min", "duration_ms", "MAX_STICKY_DURATION_MS", "createdTs", "origin_server_ts", "startIndex", "slice", "getJSON", "forDatabase", "_roomData$_stickyEven", "roomData", "roomJson", "evType", "receiptEvent", "buildAccumulatedReceiptEvent", "msgData", "rollBackState", "timelineEvent", "prevStateEvent", "deepCopy", "prev_content", "content", "prev_sender", "sender", "stateKey", "ev", "accData", "roomsData", "getNextBatchToken", "eventMap", "DEBUG", "debuglog", "logger", "log", "bind", "DB_MIGRATIONS", "db", "createObjectStore", "keyPath", "oobMembersStore", "createIndex", "autoIncrement", "VERSION", "length", "WRITE_DELAY_MS", "OAUTH_AWARE_PREFERRED_FLOW_FIELD", "UnstableValue", "LocalStorageErrorsEventsEmitter", "TypedEventEmitter", "localStorageErrorsEventsEmitter", "cryptoStoreFactory", "MemoryCryptoStore", "amendClientOpts", "opts", "_opts$store", "_opts$scheduler", "_opts$cryptoStore", "store", "MemoryStore", "localStorage", "globalThis", "scheduler", "LobiScheduler", "cryptoStore", "cryptoStoreFactory", "createClient", "LobiClient"]
|
|
7
|
+
}
|