@wabot-dev/framework 0.0.12 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. package/dist/src/_virtual/XMLHttpRequest.js +7 -0
  2. package/dist/src/_virtual/_commonjsHelpers.js +32 -0
  3. package/dist/src/_virtual/base64id.js +3 -0
  4. package/dist/src/_virtual/binary.js +3 -0
  5. package/dist/src/_virtual/bom-handling.js +3 -0
  6. package/dist/src/_virtual/broadcast-operator.js +3 -0
  7. package/dist/src/_virtual/browser.js +3 -0
  8. package/dist/src/_virtual/browser2.js +3 -0
  9. package/dist/src/_virtual/browser3.js +3 -0
  10. package/dist/src/_virtual/browser4.js +3 -0
  11. package/dist/src/_virtual/browser5.js +3 -0
  12. package/dist/src/_virtual/buffer-util.js +3 -0
  13. package/dist/src/_virtual/buffer-util2.js +3 -0
  14. package/dist/src/_virtual/buffer-util3.js +3 -0
  15. package/dist/src/_virtual/charset.js +3 -0
  16. package/dist/src/_virtual/charset2.js +3 -0
  17. package/dist/src/_virtual/client.js +3 -0
  18. package/dist/src/_virtual/cluster-adapter.js +3 -0
  19. package/dist/src/_virtual/commons.js +3 -0
  20. package/dist/src/_virtual/dbcs-codec.js +3 -0
  21. package/dist/src/_virtual/decodePacket.js +3 -0
  22. package/dist/src/_virtual/encodePacket.js +3 -0
  23. package/dist/src/_virtual/encoding.js +3 -0
  24. package/dist/src/_virtual/encoding2.js +3 -0
  25. package/dist/src/_virtual/engine.io.js +3 -0
  26. package/dist/src/_virtual/in-memory-adapter.js +3 -0
  27. package/dist/src/_virtual/index.js +7 -0
  28. package/dist/src/_virtual/index10.js +3 -0
  29. package/dist/src/_virtual/index11.js +3 -0
  30. package/dist/src/_virtual/index12.js +3 -0
  31. package/dist/src/_virtual/index13.js +3 -0
  32. package/dist/src/_virtual/index14.js +3 -0
  33. package/dist/src/_virtual/index15.js +3 -0
  34. package/dist/src/_virtual/index16.js +3 -0
  35. package/dist/src/_virtual/index17.js +3 -0
  36. package/dist/src/_virtual/index18.js +3 -0
  37. package/dist/src/_virtual/index19.js +3 -0
  38. package/dist/src/_virtual/index2.js +7 -0
  39. package/dist/src/_virtual/index20.js +3 -0
  40. package/dist/src/_virtual/index21.js +3 -0
  41. package/dist/src/_virtual/index22.js +3 -0
  42. package/dist/src/_virtual/index23.js +3 -0
  43. package/dist/src/_virtual/index24.js +3 -0
  44. package/dist/src/_virtual/index25.js +3 -0
  45. package/dist/src/_virtual/index26.js +3 -0
  46. package/dist/src/_virtual/index27.js +3 -0
  47. package/dist/src/_virtual/index28.js +3 -0
  48. package/dist/src/_virtual/index29.js +3 -0
  49. package/dist/src/_virtual/index3.js +7 -0
  50. package/dist/src/_virtual/index30.js +3 -0
  51. package/dist/src/_virtual/index31.js +3 -0
  52. package/dist/src/_virtual/index32.js +3 -0
  53. package/dist/src/_virtual/index33.js +3 -0
  54. package/dist/src/_virtual/index4.js +3 -0
  55. package/dist/src/_virtual/index5.js +3 -0
  56. package/dist/src/_virtual/index6.js +3 -0
  57. package/dist/src/_virtual/index7.js +3 -0
  58. package/dist/src/_virtual/index8.js +6 -0
  59. package/dist/src/_virtual/index9.js +3 -0
  60. package/dist/src/_virtual/inherits.js +3 -0
  61. package/dist/src/_virtual/inherits_browser.js +3 -0
  62. package/dist/src/_virtual/is-binary.js +3 -0
  63. package/dist/src/_virtual/language.js +3 -0
  64. package/dist/src/_virtual/language2.js +3 -0
  65. package/dist/src/_virtual/mediaType.js +3 -0
  66. package/dist/src/_virtual/mediaType2.js +3 -0
  67. package/dist/src/_virtual/namespace.js +3 -0
  68. package/dist/src/_virtual/node.js +3 -0
  69. package/dist/src/_virtual/node2.js +3 -0
  70. package/dist/src/_virtual/node3.js +3 -0
  71. package/dist/src/_virtual/node4.js +3 -0
  72. package/dist/src/_virtual/node5.js +3 -0
  73. package/dist/src/_virtual/parent-namespace.js +3 -0
  74. package/dist/src/_virtual/polling-jsonp.js +3 -0
  75. package/dist/src/_virtual/polling.js +3 -0
  76. package/dist/src/_virtual/polling2.js +3 -0
  77. package/dist/src/_virtual/receiver.js +3 -0
  78. package/dist/src/_virtual/sbcs-codec.js +3 -0
  79. package/dist/src/_virtual/sender.js +3 -0
  80. package/dist/src/_virtual/server.js +3 -0
  81. package/dist/src/_virtual/socket-types.js +3 -0
  82. package/dist/src/_virtual/socket.js +3 -0
  83. package/dist/src/_virtual/socket2.js +3 -0
  84. package/dist/src/_virtual/stream.js +3 -0
  85. package/dist/src/_virtual/transport.js +3 -0
  86. package/dist/src/_virtual/typed-events.js +3 -0
  87. package/dist/src/_virtual/userver.js +3 -0
  88. package/dist/src/_virtual/utf16.js +3 -0
  89. package/dist/src/_virtual/utf32.js +3 -0
  90. package/dist/src/_virtual/utf7.js +3 -0
  91. package/dist/src/_virtual/uws.js +3 -0
  92. package/dist/src/_virtual/validation.js +3 -0
  93. package/dist/src/_virtual/validation2.js +3 -0
  94. package/dist/src/_virtual/validation3.js +3 -0
  95. package/dist/src/_virtual/websocket-server.js +3 -0
  96. package/dist/src/_virtual/websocket.js +7 -0
  97. package/dist/src/_virtual/websocket2.js +3 -0
  98. package/dist/src/_virtual/websocket3.js +3 -0
  99. package/dist/src/_virtual/webtransport.js +3 -0
  100. package/dist/src/_virtual/yeast.js +3 -0
  101. package/dist/src/channels/cmd/@cmd.js +2 -0
  102. package/dist/src/channels/cmd/CmdChannel.js +2 -0
  103. package/dist/src/channels/telegram/@telegram.js +2 -0
  104. package/dist/src/channels/telegram/TelegramChannel.js +2 -0
  105. package/dist/src/channels/whatsapp/@whatsapp.js +24 -0
  106. package/dist/src/channels/whatsapp/WhatsAppChannel.js +63 -0
  107. package/dist/src/channels/whatsapp/WhatsAppChannelConfig.js +8 -0
  108. package/dist/src/channels/whatsapp/WhatsAppConnection.js +61 -0
  109. package/dist/src/channels/whatsapp/WhatsAppDevConnection.js +61 -0
  110. package/dist/src/channels/whatsapp/WhatsAppProdConnection.js +36 -0
  111. package/dist/src/channels/whatsapp/whatsAppDevSocketContracts.js +9 -0
  112. package/dist/src/controller/express/Express.js +5 -0
  113. package/dist/src/controller/socket.io/SocketIO.js +5 -0
  114. package/dist/src/env/WabotEnv.js +21 -0
  115. package/dist/src/index.d.ts +168 -1
  116. package/dist/src/index.js +12 -0
  117. package/dist/src/logger/Logger.js +65 -0
  118. package/dist/src/node_modules/@socket.io/component-emitter/lib/esm/index.js +171 -0
  119. package/dist/src/node_modules/base64id/lib/base64id.js +117 -0
  120. package/dist/src/node_modules/body-parser/index.js +96 -0
  121. package/dist/src/node_modules/body-parser/lib/read.js +225 -0
  122. package/dist/src/node_modules/body-parser/lib/types/json.js +222 -0
  123. package/dist/src/node_modules/body-parser/lib/types/raw.js +90 -0
  124. package/dist/src/node_modules/body-parser/lib/types/text.js +95 -0
  125. package/dist/src/node_modules/body-parser/lib/types/urlencoded.js +194 -0
  126. package/dist/src/node_modules/body-parser/lib/utils.js +96 -0
  127. package/dist/src/node_modules/bytes/index.js +180 -0
  128. package/dist/src/node_modules/call-bind-apply-helpers/actualApply.js +24 -0
  129. package/dist/src/node_modules/call-bind-apply-helpers/functionApply.js +13 -0
  130. package/dist/src/node_modules/call-bind-apply-helpers/functionCall.js +13 -0
  131. package/dist/src/node_modules/call-bind-apply-helpers/index.js +29 -0
  132. package/dist/src/node_modules/call-bind-apply-helpers/reflectApply.js +13 -0
  133. package/dist/src/node_modules/call-bound/index.js +31 -0
  134. package/dist/src/node_modules/content-type/index.js +235 -0
  135. package/dist/src/node_modules/cookie/index.js +345 -0
  136. package/dist/src/node_modules/cors/lib/index.js +249 -0
  137. package/dist/src/node_modules/debug/src/browser.js +286 -0
  138. package/dist/src/node_modules/debug/src/common.js +303 -0
  139. package/dist/src/node_modules/debug/src/index.js +23 -0
  140. package/dist/src/node_modules/debug/src/node.js +279 -0
  141. package/dist/src/node_modules/depd/index.js +550 -0
  142. package/dist/src/node_modules/dunder-proto/get.js +42 -0
  143. package/dist/src/node_modules/ee-first/index.js +104 -0
  144. package/dist/src/node_modules/engine.io/build/engine.io.js +73 -0
  145. package/dist/src/node_modules/engine.io/build/parser-v3/index.js +429 -0
  146. package/dist/src/node_modules/engine.io/build/parser-v3/utf8.js +198 -0
  147. package/dist/src/node_modules/engine.io/build/server.js +808 -0
  148. package/dist/src/node_modules/engine.io/build/socket.js +469 -0
  149. package/dist/src/node_modules/engine.io/build/transport.js +131 -0
  150. package/dist/src/node_modules/engine.io/build/transports/index.js +37 -0
  151. package/dist/src/node_modules/engine.io/build/transports/polling-jsonp.js +53 -0
  152. package/dist/src/node_modules/engine.io/build/transports/polling.js +346 -0
  153. package/dist/src/node_modules/engine.io/build/transports/websocket.js +106 -0
  154. package/dist/src/node_modules/engine.io/build/transports/webtransport.js +76 -0
  155. package/dist/src/node_modules/engine.io/build/transports-uws/index.js +20 -0
  156. package/dist/src/node_modules/engine.io/build/transports-uws/polling.js +378 -0
  157. package/dist/src/node_modules/engine.io/build/transports-uws/websocket.js +85 -0
  158. package/dist/src/node_modules/engine.io/build/userver.js +292 -0
  159. package/dist/src/node_modules/engine.io/node_modules/accepts/index.js +250 -0
  160. package/dist/src/node_modules/engine.io/node_modules/debug/src/browser.js +285 -0
  161. package/dist/src/node_modules/engine.io/node_modules/debug/src/common.js +285 -0
  162. package/dist/src/node_modules/engine.io/node_modules/debug/src/index.js +23 -0
  163. package/dist/src/node_modules/engine.io/node_modules/debug/src/node.js +279 -0
  164. package/dist/src/node_modules/engine.io/node_modules/mime-db/db.json.js +10704 -0
  165. package/dist/src/node_modules/engine.io/node_modules/mime-db/index.js +24 -0
  166. package/dist/src/node_modules/engine.io/node_modules/mime-types/index.js +202 -0
  167. package/dist/src/node_modules/engine.io/node_modules/negotiator/index.js +96 -0
  168. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/charset.js +179 -0
  169. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/encoding.js +193 -0
  170. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/language.js +188 -0
  171. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/mediaType.js +304 -0
  172. package/dist/src/node_modules/engine.io/node_modules/ws/index.js +28 -0
  173. package/dist/src/node_modules/engine.io/node_modules/ws/lib/buffer-util.js +142 -0
  174. package/dist/src/node_modules/engine.io/node_modules/ws/lib/constants.js +21 -0
  175. package/dist/src/node_modules/engine.io/node_modules/ws/lib/event-target.js +303 -0
  176. package/dist/src/node_modules/engine.io/node_modules/ws/lib/extension.js +214 -0
  177. package/dist/src/node_modules/engine.io/node_modules/ws/lib/limiter.js +64 -0
  178. package/dist/src/node_modules/engine.io/node_modules/ws/lib/permessage-deflate.js +528 -0
  179. package/dist/src/node_modules/engine.io/node_modules/ws/lib/receiver.js +719 -0
  180. package/dist/src/node_modules/engine.io/node_modules/ws/lib/sender.js +513 -0
  181. package/dist/src/node_modules/engine.io/node_modules/ws/lib/stream.js +170 -0
  182. package/dist/src/node_modules/engine.io/node_modules/ws/lib/subprotocol.js +73 -0
  183. package/dist/src/node_modules/engine.io/node_modules/ws/lib/validation.js +141 -0
  184. package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket-server.js +559 -0
  185. package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket.js +1363 -0
  186. package/dist/src/node_modules/engine.io-client/build/esm/contrib/has-cors.js +13 -0
  187. package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseqs.js +36 -0
  188. package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseuri.js +66 -0
  189. package/dist/src/node_modules/engine.io-client/build/esm/globals.node.js +92 -0
  190. package/dist/src/node_modules/engine.io-client/build/esm/index.js +17 -0
  191. package/dist/src/node_modules/engine.io-client/build/esm/socket.js +728 -0
  192. package/dist/src/node_modules/engine.io-client/build/esm/transport.js +143 -0
  193. package/dist/src/node_modules/engine.io-client/build/esm/transports/index.js +11 -0
  194. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +256 -0
  195. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.js +21 -0
  196. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling.js +146 -0
  197. package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.js +107 -0
  198. package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.node.js +48 -0
  199. package/dist/src/node_modules/engine.io-client/build/esm/transports/webtransport.js +83 -0
  200. package/dist/src/node_modules/engine.io-client/build/esm/util.js +62 -0
  201. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js +142 -0
  202. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/constants.js +21 -0
  203. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/event-target.js +303 -0
  204. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/extension.js +214 -0
  205. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/limiter.js +64 -0
  206. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js +528 -0
  207. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/receiver.js +719 -0
  208. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/sender.js +513 -0
  209. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/stream.js +170 -0
  210. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/subprotocol.js +73 -0
  211. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/validation.js +141 -0
  212. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket-server.js +559 -0
  213. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket.js +1363 -0
  214. package/dist/src/node_modules/engine.io-parser/build/cjs/commons.js +29 -0
  215. package/dist/src/node_modules/engine.io-parser/build/cjs/decodePacket.js +70 -0
  216. package/dist/src/node_modules/engine.io-parser/build/cjs/encodePacket.js +51 -0
  217. package/dist/src/node_modules/engine.io-parser/build/cjs/index.js +179 -0
  218. package/dist/src/node_modules/engine.io-parser/build/esm/commons.js +15 -0
  219. package/dist/src/node_modules/engine.io-parser/build/esm/decodePacket.js +58 -0
  220. package/dist/src/node_modules/engine.io-parser/build/esm/encodePacket.js +36 -0
  221. package/dist/src/node_modules/engine.io-parser/build/esm/index.js +158 -0
  222. package/dist/src/node_modules/es-define-property/index.js +23 -0
  223. package/dist/src/node_modules/es-errors/eval.js +13 -0
  224. package/dist/src/node_modules/es-errors/index.js +13 -0
  225. package/dist/src/node_modules/es-errors/range.js +13 -0
  226. package/dist/src/node_modules/es-errors/ref.js +13 -0
  227. package/dist/src/node_modules/es-errors/syntax.js +13 -0
  228. package/dist/src/node_modules/es-errors/type.js +13 -0
  229. package/dist/src/node_modules/es-errors/uri.js +13 -0
  230. package/dist/src/node_modules/es-object-atoms/index.js +13 -0
  231. package/dist/src/node_modules/function-bind/implementation.js +93 -0
  232. package/dist/src/node_modules/function-bind/index.js +16 -0
  233. package/dist/src/node_modules/get-intrinsic/index.js +413 -0
  234. package/dist/src/node_modules/get-proto/Object.getPrototypeOf.js +17 -0
  235. package/dist/src/node_modules/get-proto/Reflect.getPrototypeOf.js +13 -0
  236. package/dist/src/node_modules/get-proto/index.js +40 -0
  237. package/dist/src/node_modules/gopd/gOPD.js +13 -0
  238. package/dist/src/node_modules/gopd/index.js +26 -0
  239. package/dist/src/node_modules/has-symbols/index.js +25 -0
  240. package/dist/src/node_modules/has-symbols/shams.js +54 -0
  241. package/dist/src/node_modules/hasown/index.js +19 -0
  242. package/dist/src/node_modules/http-errors/index.js +306 -0
  243. package/dist/src/node_modules/iconv-lite/encodings/dbcs-codec.js +598 -0
  244. package/dist/src/node_modules/iconv-lite/encodings/dbcs-data.js +206 -0
  245. package/dist/src/node_modules/iconv-lite/encodings/index.js +44 -0
  246. package/dist/src/node_modules/iconv-lite/encodings/internal.js +210 -0
  247. package/dist/src/node_modules/iconv-lite/encodings/sbcs-codec.js +83 -0
  248. package/dist/src/node_modules/iconv-lite/encodings/sbcs-data-generated.js +460 -0
  249. package/dist/src/node_modules/iconv-lite/encodings/sbcs-data.js +187 -0
  250. package/dist/src/node_modules/iconv-lite/encodings/tables/big5-added.json.js +506 -0
  251. package/dist/src/node_modules/iconv-lite/encodings/tables/cp936.json.js +2621 -0
  252. package/dist/src/node_modules/iconv-lite/encodings/tables/cp949.json.js +2380 -0
  253. package/dist/src/node_modules/iconv-lite/encodings/tables/cp950.json.js +729 -0
  254. package/dist/src/node_modules/iconv-lite/encodings/tables/eucjp.json.js +822 -0
  255. package/dist/src/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json.js +424 -0
  256. package/dist/src/node_modules/iconv-lite/encodings/tables/gbk-added.json.js +264 -0
  257. package/dist/src/node_modules/iconv-lite/encodings/tables/shiftjis.json.js +548 -0
  258. package/dist/src/node_modules/iconv-lite/encodings/utf16.js +206 -0
  259. package/dist/src/node_modules/iconv-lite/encodings/utf32.js +329 -0
  260. package/dist/src/node_modules/iconv-lite/encodings/utf7.js +297 -0
  261. package/dist/src/node_modules/iconv-lite/lib/bom-handling.js +61 -0
  262. package/dist/src/node_modules/iconv-lite/lib/index.js +192 -0
  263. package/dist/src/node_modules/iconv-lite/lib/streams.js +120 -0
  264. package/dist/src/node_modules/inherits/inherits.js +21 -0
  265. package/dist/src/node_modules/inherits/inherits_browser.js +38 -0
  266. package/dist/src/node_modules/math-intrinsics/abs.js +13 -0
  267. package/dist/src/node_modules/math-intrinsics/floor.js +13 -0
  268. package/dist/src/node_modules/math-intrinsics/isNaN.js +15 -0
  269. package/dist/src/node_modules/math-intrinsics/max.js +13 -0
  270. package/dist/src/node_modules/math-intrinsics/min.js +13 -0
  271. package/dist/src/node_modules/math-intrinsics/pow.js +13 -0
  272. package/dist/src/node_modules/math-intrinsics/round.js +13 -0
  273. package/dist/src/node_modules/math-intrinsics/sign.js +22 -0
  274. package/dist/src/node_modules/media-typer/index.js +153 -0
  275. package/dist/src/node_modules/mime-db/db.json.js +11656 -0
  276. package/dist/src/node_modules/mime-db/index.js +24 -0
  277. package/dist/src/node_modules/mime-types/index.js +226 -0
  278. package/dist/src/node_modules/mime-types/mimeScore.js +62 -0
  279. package/dist/src/node_modules/ms/index.js +172 -0
  280. package/dist/src/node_modules/object-assign/index.js +99 -0
  281. package/dist/src/node_modules/object-inspect/index.js +557 -0
  282. package/dist/src/node_modules/object-inspect/util.inspect.js +13 -0
  283. package/dist/src/node_modules/on-finished/index.js +245 -0
  284. package/dist/src/node_modules/qs/lib/formats.js +32 -0
  285. package/dist/src/node_modules/qs/lib/index.js +24 -0
  286. package/dist/src/node_modules/qs/lib/parse.js +339 -0
  287. package/dist/src/node_modules/qs/lib/stringify.js +369 -0
  288. package/dist/src/node_modules/qs/lib/utils.js +279 -0
  289. package/dist/src/node_modules/raw-body/index.js +351 -0
  290. package/dist/src/node_modules/safer-buffer/safer.js +88 -0
  291. package/dist/src/node_modules/setprototypeof/index.js +26 -0
  292. package/dist/src/node_modules/side-channel/index.js +58 -0
  293. package/dist/src/node_modules/side-channel-list/index.js +125 -0
  294. package/dist/src/node_modules/side-channel-map/index.js +82 -0
  295. package/dist/src/node_modules/side-channel-weakmap/index.js +99 -0
  296. package/dist/src/node_modules/socket.io/dist/broadcast-operator.js +448 -0
  297. package/dist/src/node_modules/socket.io/dist/client.js +281 -0
  298. package/dist/src/node_modules/socket.io/dist/index.js +837 -0
  299. package/dist/src/node_modules/socket.io/dist/namespace.js +597 -0
  300. package/dist/src/node_modules/socket.io/dist/parent-namespace.js +101 -0
  301. package/dist/src/node_modules/socket.io/dist/socket-types.js +21 -0
  302. package/dist/src/node_modules/socket.io/dist/socket.js +993 -0
  303. package/dist/src/node_modules/socket.io/dist/typed-events.js +92 -0
  304. package/dist/src/node_modules/socket.io/dist/uws.js +149 -0
  305. package/dist/src/node_modules/socket.io/node_modules/accepts/index.js +250 -0
  306. package/dist/src/node_modules/socket.io/node_modules/debug/src/browser.js +285 -0
  307. package/dist/src/node_modules/socket.io/node_modules/debug/src/common.js +285 -0
  308. package/dist/src/node_modules/socket.io/node_modules/debug/src/index.js +23 -0
  309. package/dist/src/node_modules/socket.io/node_modules/debug/src/node.js +279 -0
  310. package/dist/src/node_modules/socket.io/node_modules/mime-db/db.json.js +10704 -0
  311. package/dist/src/node_modules/socket.io/node_modules/mime-db/index.js +24 -0
  312. package/dist/src/node_modules/socket.io/node_modules/mime-types/index.js +202 -0
  313. package/dist/src/node_modules/socket.io/node_modules/negotiator/index.js +96 -0
  314. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/charset.js +179 -0
  315. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/encoding.js +193 -0
  316. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/language.js +188 -0
  317. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/mediaType.js +304 -0
  318. package/dist/src/node_modules/socket.io/package.json.js +5 -0
  319. package/dist/src/node_modules/socket.io/wrapper.js +5 -0
  320. package/dist/src/node_modules/socket.io-adapter/dist/cluster-adapter.js +689 -0
  321. package/dist/src/node_modules/socket.io-adapter/dist/contrib/yeast.js +64 -0
  322. package/dist/src/node_modules/socket.io-adapter/dist/in-memory-adapter.js +407 -0
  323. package/dist/src/node_modules/socket.io-adapter/dist/index.js +24 -0
  324. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/browser.js +285 -0
  325. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/common.js +285 -0
  326. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/index.js +23 -0
  327. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/node.js +279 -0
  328. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/index.js +28 -0
  329. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/buffer-util.js +142 -0
  330. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/constants.js +21 -0
  331. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/event-target.js +303 -0
  332. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/extension.js +214 -0
  333. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/limiter.js +64 -0
  334. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/permessage-deflate.js +528 -0
  335. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/receiver.js +719 -0
  336. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/sender.js +513 -0
  337. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/stream.js +170 -0
  338. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/subprotocol.js +73 -0
  339. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/validation.js +141 -0
  340. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket-server.js +559 -0
  341. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket.js +1363 -0
  342. package/dist/src/node_modules/socket.io-client/build/esm/contrib/backo2.js +68 -0
  343. package/dist/src/node_modules/socket.io-client/build/esm/index.js +50 -0
  344. package/dist/src/node_modules/socket.io-client/build/esm/manager.js +373 -0
  345. package/dist/src/node_modules/socket.io-client/build/esm/on.js +8 -0
  346. package/dist/src/node_modules/socket.io-client/build/esm/socket.js +884 -0
  347. package/dist/src/node_modules/socket.io-client/build/esm/url.js +63 -0
  348. package/dist/src/node_modules/socket.io-parser/build/cjs/binary.js +99 -0
  349. package/dist/src/node_modules/socket.io-parser/build/cjs/index.js +337 -0
  350. package/dist/src/node_modules/socket.io-parser/build/cjs/is-binary.js +65 -0
  351. package/dist/src/node_modules/socket.io-parser/build/esm/binary.js +86 -0
  352. package/dist/src/node_modules/socket.io-parser/build/esm/index.js +314 -0
  353. package/dist/src/node_modules/socket.io-parser/build/esm/is-binary.js +52 -0
  354. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/browser.js +285 -0
  355. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/common.js +285 -0
  356. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/index.js +23 -0
  357. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/node.js +279 -0
  358. package/dist/src/node_modules/statuses/codes.json.js +67 -0
  359. package/dist/src/node_modules/statuses/index.js +157 -0
  360. package/dist/src/node_modules/toidentifier/index.js +41 -0
  361. package/dist/src/node_modules/type-is/index.js +263 -0
  362. package/dist/src/node_modules/unpipe/index.js +78 -0
  363. package/dist/src/node_modules/vary/index.js +159 -0
  364. package/dist/src/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js +702 -0
  365. package/dist/src/server/runChannel.js +8 -8
  366. package/dist/src/server/runServer.js +41 -2
  367. package/package.json +7 -3
@@ -0,0 +1,73 @@
1
+ import { __exports as engine_io } from '../../../_virtual/engine.io.js';
2
+ import require$$2 from 'http';
3
+ import { __require as requireServer } from './server.js';
4
+ import { __require as requireTransports } from './transports/index.js';
5
+ import { __require as requireCjs } from '../../engine.io-parser/build/cjs/index.js';
6
+ import { __require as requireUserver } from './userver.js';
7
+ import { __require as requireSocket } from './socket.js';
8
+ import { __require as requireTransport } from './transport.js';
9
+
10
+ var hasRequiredEngine_io;
11
+
12
+ function requireEngine_io () {
13
+ if (hasRequiredEngine_io) return engine_io;
14
+ hasRequiredEngine_io = 1;
15
+ (function (exports) {
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.protocol = exports.Transport = exports.Socket = exports.uServer = exports.parser = exports.transports = exports.Server = void 0;
18
+ exports.listen = listen;
19
+ exports.attach = attach;
20
+ const http_1 = require$$2;
21
+ const server_1 = requireServer();
22
+ Object.defineProperty(exports, "Server", { enumerable: true, get: function () { return server_1.Server; } });
23
+ const index_1 = requireTransports();
24
+ exports.transports = index_1.default;
25
+ const parser = requireCjs();
26
+ exports.parser = parser;
27
+ var userver_1 = requireUserver();
28
+ Object.defineProperty(exports, "uServer", { enumerable: true, get: function () { return userver_1.uServer; } });
29
+ var socket_1 = requireSocket();
30
+ Object.defineProperty(exports, "Socket", { enumerable: true, get: function () { return socket_1.Socket; } });
31
+ var transport_1 = requireTransport();
32
+ Object.defineProperty(exports, "Transport", { enumerable: true, get: function () { return transport_1.Transport; } });
33
+ exports.protocol = parser.protocol;
34
+ /**
35
+ * Creates an http.Server exclusively used for WS upgrades.
36
+ *
37
+ * @param {Number} port
38
+ * @param {Function} callback
39
+ * @param {Object} options
40
+ * @return {Server} websocket.io server
41
+ */
42
+ function listen(port, options, fn) {
43
+ if ("function" === typeof options) {
44
+ fn = options;
45
+ options = {};
46
+ }
47
+ const server = (0, http_1.createServer)(function (req, res) {
48
+ res.writeHead(501);
49
+ res.end("Not Implemented");
50
+ });
51
+ // create engine server
52
+ const engine = attach(server, options);
53
+ engine.httpServer = server;
54
+ server.listen(port, fn);
55
+ return engine;
56
+ }
57
+ /**
58
+ * Captures upgrade requests for a http.Server.
59
+ *
60
+ * @param {http.Server} server
61
+ * @param {Object} options
62
+ * @return {Server} engine server
63
+ */
64
+ function attach(server, options) {
65
+ const engine = new server_1.Server(options);
66
+ engine.attach(server, options);
67
+ return engine;
68
+ }
69
+ } (engine_io));
70
+ return engine_io;
71
+ }
72
+
73
+ export { requireEngine_io as __require };
@@ -0,0 +1,429 @@
1
+ import { __exports as parserV3 } from '../../../../_virtual/index21.js';
2
+ import { __require as requireUtf8 } from './utf8.js';
3
+
4
+ var hasRequiredParserV3;
5
+
6
+ function requireParserV3 () {
7
+ if (hasRequiredParserV3) return parserV3;
8
+ hasRequiredParserV3 = 1;
9
+ (function (exports) {
10
+ // imported from https://github.com/socketio/engine.io-parser/tree/2.2.x
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.packets = exports.protocol = void 0;
13
+ exports.encodePacket = encodePacket;
14
+ exports.encodeBase64Packet = encodeBase64Packet;
15
+ exports.decodePacket = decodePacket;
16
+ exports.decodeBase64Packet = decodeBase64Packet;
17
+ exports.encodePayload = encodePayload;
18
+ exports.decodePayload = decodePayload;
19
+ exports.encodePayloadAsBinary = encodePayloadAsBinary;
20
+ exports.decodePayloadAsBinary = decodePayloadAsBinary;
21
+ /**
22
+ * Module dependencies.
23
+ */
24
+ var utf8 = requireUtf8();
25
+ /**
26
+ * Current protocol version.
27
+ */
28
+ exports.protocol = 3;
29
+ const hasBinary = (packets) => {
30
+ for (const packet of packets) {
31
+ if (packet.data instanceof ArrayBuffer || ArrayBuffer.isView(packet.data)) {
32
+ return true;
33
+ }
34
+ }
35
+ return false;
36
+ };
37
+ /**
38
+ * Packet types.
39
+ */
40
+ exports.packets = {
41
+ open: 0 // non-ws
42
+ ,
43
+ close: 1 // non-ws
44
+ ,
45
+ ping: 2,
46
+ pong: 3,
47
+ message: 4,
48
+ upgrade: 5,
49
+ noop: 6
50
+ };
51
+ var packetslist = Object.keys(exports.packets);
52
+ /**
53
+ * Premade error packet.
54
+ */
55
+ var err = { type: 'error', data: 'parser error' };
56
+ const EMPTY_BUFFER = Buffer.concat([]);
57
+ /**
58
+ * Encodes a packet.
59
+ *
60
+ * <packet type id> [ <data> ]
61
+ *
62
+ * Example:
63
+ *
64
+ * 5hello world
65
+ * 3
66
+ * 4
67
+ *
68
+ * Binary is encoded in an identical principle
69
+ *
70
+ * @api private
71
+ */
72
+ function encodePacket(packet, supportsBinary, utf8encode, callback) {
73
+ if (typeof supportsBinary === 'function') {
74
+ callback = supportsBinary;
75
+ supportsBinary = null;
76
+ }
77
+ if (typeof utf8encode === 'function') {
78
+ callback = utf8encode;
79
+ utf8encode = null;
80
+ }
81
+ if (Buffer.isBuffer(packet.data)) {
82
+ return encodeBuffer(packet, supportsBinary, callback);
83
+ }
84
+ else if (packet.data && (packet.data.buffer || packet.data) instanceof ArrayBuffer) {
85
+ return encodeBuffer({ type: packet.type, data: arrayBufferToBuffer(packet.data) }, supportsBinary, callback);
86
+ }
87
+ // Sending data as a utf-8 string
88
+ var encoded = exports.packets[packet.type];
89
+ // data fragment is optional
90
+ if (undefined !== packet.data) {
91
+ encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data);
92
+ }
93
+ return callback('' + encoded);
94
+ }
95
+ /**
96
+ * Encode Buffer data
97
+ */
98
+ function encodeBuffer(packet, supportsBinary, callback) {
99
+ if (!supportsBinary) {
100
+ return encodeBase64Packet(packet, callback);
101
+ }
102
+ var data = packet.data;
103
+ var typeBuffer = Buffer.allocUnsafe(1);
104
+ typeBuffer[0] = exports.packets[packet.type];
105
+ return callback(Buffer.concat([typeBuffer, data]));
106
+ }
107
+ /**
108
+ * Encodes a packet with binary data in a base64 string
109
+ *
110
+ * @param {Object} packet, has `type` and `data`
111
+ * @return {String} base64 encoded message
112
+ */
113
+ function encodeBase64Packet(packet, callback) {
114
+ var data = Buffer.isBuffer(packet.data) ? packet.data : arrayBufferToBuffer(packet.data);
115
+ var message = 'b' + exports.packets[packet.type];
116
+ message += data.toString('base64');
117
+ return callback(message);
118
+ }
119
+ /**
120
+ * Decodes a packet. Data also available as an ArrayBuffer if requested.
121
+ *
122
+ * @return {Object} with `type` and `data` (if any)
123
+ * @api private
124
+ */
125
+ function decodePacket(data, binaryType, utf8decode) {
126
+ if (data === undefined) {
127
+ return err;
128
+ }
129
+ var type;
130
+ // String data
131
+ if (typeof data === 'string') {
132
+ type = data.charAt(0);
133
+ if (type === 'b') {
134
+ return decodeBase64Packet(data.slice(1), binaryType);
135
+ }
136
+ if (utf8decode) {
137
+ data = tryDecode(data);
138
+ if (data === false) {
139
+ return err;
140
+ }
141
+ }
142
+ if (Number(type) != type || !packetslist[type]) {
143
+ return err;
144
+ }
145
+ if (data.length > 1) {
146
+ return { type: packetslist[type], data: data.slice(1) };
147
+ }
148
+ else {
149
+ return { type: packetslist[type] };
150
+ }
151
+ }
152
+ // Binary data
153
+ if (binaryType === 'arraybuffer') {
154
+ // wrap Buffer/ArrayBuffer data into an Uint8Array
155
+ var intArray = new Uint8Array(data);
156
+ type = intArray[0];
157
+ return { type: packetslist[type], data: intArray.buffer.slice(1) };
158
+ }
159
+ if (data instanceof ArrayBuffer) {
160
+ data = arrayBufferToBuffer(data);
161
+ }
162
+ type = data[0];
163
+ return { type: packetslist[type], data: data.slice(1) };
164
+ }
165
+ function tryDecode(data) {
166
+ try {
167
+ data = utf8.decode(data, { strict: false });
168
+ }
169
+ catch (e) {
170
+ return false;
171
+ }
172
+ return data;
173
+ }
174
+ /**
175
+ * Decodes a packet encoded in a base64 string.
176
+ *
177
+ * @param {String} base64 encoded message
178
+ * @return {Object} with `type` and `data` (if any)
179
+ */
180
+ function decodeBase64Packet(msg, binaryType) {
181
+ var type = packetslist[msg.charAt(0)];
182
+ var data = Buffer.from(msg.slice(1), 'base64');
183
+ if (binaryType === 'arraybuffer') {
184
+ var abv = new Uint8Array(data.length);
185
+ for (var i = 0; i < abv.length; i++) {
186
+ abv[i] = data[i];
187
+ }
188
+ // @ts-ignore
189
+ data = abv.buffer;
190
+ }
191
+ return { type: type, data: data };
192
+ }
193
+ /**
194
+ * Encodes multiple messages (payload).
195
+ *
196
+ * <length>:data
197
+ *
198
+ * Example:
199
+ *
200
+ * 11:hello world2:hi
201
+ *
202
+ * If any contents are binary, they will be encoded as base64 strings. Base64
203
+ * encoded strings are marked with a b before the length specifier
204
+ *
205
+ * @param {Array} packets
206
+ * @api private
207
+ */
208
+ function encodePayload(packets, supportsBinary, callback) {
209
+ if (typeof supportsBinary === 'function') {
210
+ callback = supportsBinary;
211
+ supportsBinary = null;
212
+ }
213
+ if (supportsBinary && hasBinary(packets)) {
214
+ return encodePayloadAsBinary(packets, callback);
215
+ }
216
+ if (!packets.length) {
217
+ return callback('0:');
218
+ }
219
+ function encodeOne(packet, doneCallback) {
220
+ encodePacket(packet, supportsBinary, false, function (message) {
221
+ doneCallback(null, setLengthHeader(message));
222
+ });
223
+ }
224
+ map(packets, encodeOne, function (err, results) {
225
+ return callback(results.join(''));
226
+ });
227
+ }
228
+ function setLengthHeader(message) {
229
+ return message.length + ':' + message;
230
+ }
231
+ /**
232
+ * Async array map using after
233
+ */
234
+ function map(ary, each, done) {
235
+ const results = new Array(ary.length);
236
+ let count = 0;
237
+ for (let i = 0; i < ary.length; i++) {
238
+ each(ary[i], (error, msg) => {
239
+ results[i] = msg;
240
+ if (++count === ary.length) {
241
+ done(null, results);
242
+ }
243
+ });
244
+ }
245
+ }
246
+ /*
247
+ * Decodes data when a payload is maybe expected. Possible binary contents are
248
+ * decoded from their base64 representation
249
+ *
250
+ * @param {String} data, callback method
251
+ * @api public
252
+ */
253
+ function decodePayload(data, binaryType, callback) {
254
+ if (typeof data !== 'string') {
255
+ return decodePayloadAsBinary(data, binaryType, callback);
256
+ }
257
+ if (typeof binaryType === 'function') {
258
+ callback = binaryType;
259
+ binaryType = null;
260
+ }
261
+ if (data === '') {
262
+ // parser error - ignoring payload
263
+ return callback(err, 0, 1);
264
+ }
265
+ var length = '', n, msg, packet;
266
+ for (var i = 0, l = data.length; i < l; i++) {
267
+ var chr = data.charAt(i);
268
+ if (chr !== ':') {
269
+ length += chr;
270
+ continue;
271
+ }
272
+ // @ts-ignore
273
+ if (length === '' || (length != (n = Number(length)))) {
274
+ // parser error - ignoring payload
275
+ return callback(err, 0, 1);
276
+ }
277
+ msg = data.slice(i + 1, i + 1 + n);
278
+ if (length != msg.length) {
279
+ // parser error - ignoring payload
280
+ return callback(err, 0, 1);
281
+ }
282
+ if (msg.length) {
283
+ packet = decodePacket(msg, binaryType, false);
284
+ if (err.type === packet.type && err.data === packet.data) {
285
+ // parser error in individual packet - ignoring payload
286
+ return callback(err, 0, 1);
287
+ }
288
+ var more = callback(packet, i + n, l);
289
+ if (false === more)
290
+ return;
291
+ }
292
+ // advance cursor
293
+ i += n;
294
+ length = '';
295
+ }
296
+ if (length !== '') {
297
+ // parser error - ignoring payload
298
+ return callback(err, 0, 1);
299
+ }
300
+ }
301
+ /**
302
+ *
303
+ * Converts a buffer to a utf8.js encoded string
304
+ *
305
+ * @api private
306
+ */
307
+ function bufferToString(buffer) {
308
+ var str = '';
309
+ for (var i = 0, l = buffer.length; i < l; i++) {
310
+ str += String.fromCharCode(buffer[i]);
311
+ }
312
+ return str;
313
+ }
314
+ /**
315
+ *
316
+ * Converts a utf8.js encoded string to a buffer
317
+ *
318
+ * @api private
319
+ */
320
+ function stringToBuffer(string) {
321
+ var buf = Buffer.allocUnsafe(string.length);
322
+ for (var i = 0, l = string.length; i < l; i++) {
323
+ buf.writeUInt8(string.charCodeAt(i), i);
324
+ }
325
+ return buf;
326
+ }
327
+ /**
328
+ *
329
+ * Converts an ArrayBuffer to a Buffer
330
+ *
331
+ * @api private
332
+ */
333
+ function arrayBufferToBuffer(data) {
334
+ // data is either an ArrayBuffer or ArrayBufferView.
335
+ var length = data.byteLength || data.length;
336
+ var offset = data.byteOffset || 0;
337
+ return Buffer.from(data.buffer || data, offset, length);
338
+ }
339
+ /**
340
+ * Encodes multiple messages (payload) as binary.
341
+ *
342
+ * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number
343
+ * 255><data>
344
+ *
345
+ * Example:
346
+ * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers
347
+ *
348
+ * @param {Array} packets
349
+ * @return {Buffer} encoded payload
350
+ * @api private
351
+ */
352
+ function encodePayloadAsBinary(packets, callback) {
353
+ if (!packets.length) {
354
+ return callback(EMPTY_BUFFER);
355
+ }
356
+ map(packets, encodeOneBinaryPacket, function (err, results) {
357
+ return callback(Buffer.concat(results));
358
+ });
359
+ }
360
+ function encodeOneBinaryPacket(p, doneCallback) {
361
+ function onBinaryPacketEncode(packet) {
362
+ var encodingLength = '' + packet.length;
363
+ var sizeBuffer;
364
+ if (typeof packet === 'string') {
365
+ sizeBuffer = Buffer.allocUnsafe(encodingLength.length + 2);
366
+ sizeBuffer[0] = 0; // is a string (not true binary = 0)
367
+ for (var i = 0; i < encodingLength.length; i++) {
368
+ sizeBuffer[i + 1] = parseInt(encodingLength[i], 10);
369
+ }
370
+ sizeBuffer[sizeBuffer.length - 1] = 255;
371
+ return doneCallback(null, Buffer.concat([sizeBuffer, stringToBuffer(packet)]));
372
+ }
373
+ sizeBuffer = Buffer.allocUnsafe(encodingLength.length + 2);
374
+ sizeBuffer[0] = 1; // is binary (true binary = 1)
375
+ for (var i = 0; i < encodingLength.length; i++) {
376
+ sizeBuffer[i + 1] = parseInt(encodingLength[i], 10);
377
+ }
378
+ sizeBuffer[sizeBuffer.length - 1] = 255;
379
+ doneCallback(null, Buffer.concat([sizeBuffer, packet]));
380
+ }
381
+ encodePacket(p, true, true, onBinaryPacketEncode);
382
+ }
383
+ /*
384
+ * Decodes data when a payload is maybe expected. Strings are decoded by
385
+ * interpreting each byte as a key code for entries marked to start with 0. See
386
+ * description of encodePayloadAsBinary
387
+
388
+ * @param {Buffer} data, callback method
389
+ * @api public
390
+ */
391
+ function decodePayloadAsBinary(data, binaryType, callback) {
392
+ if (typeof binaryType === 'function') {
393
+ callback = binaryType;
394
+ binaryType = null;
395
+ }
396
+ var bufferTail = data;
397
+ var buffers = [];
398
+ var i;
399
+ while (bufferTail.length > 0) {
400
+ var strLen = '';
401
+ var isString = bufferTail[0] === 0;
402
+ for (i = 1;; i++) {
403
+ if (bufferTail[i] === 255)
404
+ break;
405
+ // 310 = char length of Number.MAX_VALUE
406
+ if (strLen.length > 310) {
407
+ return callback(err, 0, 1);
408
+ }
409
+ strLen += '' + bufferTail[i];
410
+ }
411
+ bufferTail = bufferTail.slice(strLen.length + 1);
412
+ var msgLength = parseInt(strLen, 10);
413
+ var msg = bufferTail.slice(1, msgLength + 1);
414
+ if (isString)
415
+ msg = bufferToString(msg);
416
+ buffers.push(msg);
417
+ bufferTail = bufferTail.slice(msgLength + 1);
418
+ }
419
+ var total = buffers.length;
420
+ for (i = 0; i < total; i++) {
421
+ var buffer = buffers[i];
422
+ callback(decodePacket(buffer, binaryType, true), i, total);
423
+ }
424
+ }
425
+ } (parserV3));
426
+ return parserV3;
427
+ }
428
+
429
+ export { requireParserV3 as __require };
@@ -0,0 +1,198 @@
1
+ /*! https://mths.be/utf8js v2.1.2 by @mathias */
2
+
3
+ var utf8;
4
+ var hasRequiredUtf8;
5
+
6
+ function requireUtf8 () {
7
+ if (hasRequiredUtf8) return utf8;
8
+ hasRequiredUtf8 = 1;
9
+ var stringFromCharCode = String.fromCharCode;
10
+ // Taken from https://mths.be/punycode
11
+ function ucs2decode(string) {
12
+ var output = [];
13
+ var counter = 0;
14
+ var length = string.length;
15
+ var value;
16
+ var extra;
17
+ while (counter < length) {
18
+ value = string.charCodeAt(counter++);
19
+ if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
20
+ // high surrogate, and there is a next character
21
+ extra = string.charCodeAt(counter++);
22
+ if ((extra & 0xFC00) == 0xDC00) { // low surrogate
23
+ output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
24
+ }
25
+ else {
26
+ // unmatched surrogate; only append this code unit, in case the next
27
+ // code unit is the high surrogate of a surrogate pair
28
+ output.push(value);
29
+ counter--;
30
+ }
31
+ }
32
+ else {
33
+ output.push(value);
34
+ }
35
+ }
36
+ return output;
37
+ }
38
+ // Taken from https://mths.be/punycode
39
+ function ucs2encode(array) {
40
+ var length = array.length;
41
+ var index = -1;
42
+ var value;
43
+ var output = '';
44
+ while (++index < length) {
45
+ value = array[index];
46
+ if (value > 0xFFFF) {
47
+ value -= 0x10000;
48
+ output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
49
+ value = 0xDC00 | value & 0x3FF;
50
+ }
51
+ output += stringFromCharCode(value);
52
+ }
53
+ return output;
54
+ }
55
+ function checkScalarValue(codePoint, strict) {
56
+ if (codePoint >= 0xD800 && codePoint <= 0xDFFF) {
57
+ if (strict) {
58
+ throw Error('Lone surrogate U+' + codePoint.toString(16).toUpperCase() +
59
+ ' is not a scalar value');
60
+ }
61
+ return false;
62
+ }
63
+ return true;
64
+ }
65
+ /*--------------------------------------------------------------------------*/
66
+ function createByte(codePoint, shift) {
67
+ return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);
68
+ }
69
+ function encodeCodePoint(codePoint, strict) {
70
+ if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence
71
+ return stringFromCharCode(codePoint);
72
+ }
73
+ var symbol = '';
74
+ if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence
75
+ symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);
76
+ }
77
+ else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence
78
+ if (!checkScalarValue(codePoint, strict)) {
79
+ codePoint = 0xFFFD;
80
+ }
81
+ symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);
82
+ symbol += createByte(codePoint, 6);
83
+ }
84
+ else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence
85
+ symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);
86
+ symbol += createByte(codePoint, 12);
87
+ symbol += createByte(codePoint, 6);
88
+ }
89
+ symbol += stringFromCharCode((codePoint & 0x3F) | 0x80);
90
+ return symbol;
91
+ }
92
+ function utf8encode(string, opts) {
93
+ opts = opts || {};
94
+ var strict = false !== opts.strict;
95
+ var codePoints = ucs2decode(string);
96
+ var length = codePoints.length;
97
+ var index = -1;
98
+ var codePoint;
99
+ var byteString = '';
100
+ while (++index < length) {
101
+ codePoint = codePoints[index];
102
+ byteString += encodeCodePoint(codePoint, strict);
103
+ }
104
+ return byteString;
105
+ }
106
+ /*--------------------------------------------------------------------------*/
107
+ function readContinuationByte() {
108
+ if (byteIndex >= byteCount) {
109
+ throw Error('Invalid byte index');
110
+ }
111
+ var continuationByte = byteArray[byteIndex] & 0xFF;
112
+ byteIndex++;
113
+ if ((continuationByte & 0xC0) == 0x80) {
114
+ return continuationByte & 0x3F;
115
+ }
116
+ // If we end up here, it’s not a continuation byte
117
+ throw Error('Invalid continuation byte');
118
+ }
119
+ function decodeSymbol(strict) {
120
+ var byte1;
121
+ var byte2;
122
+ var byte3;
123
+ var byte4;
124
+ var codePoint;
125
+ if (byteIndex > byteCount) {
126
+ throw Error('Invalid byte index');
127
+ }
128
+ if (byteIndex == byteCount) {
129
+ return false;
130
+ }
131
+ // Read first byte
132
+ byte1 = byteArray[byteIndex] & 0xFF;
133
+ byteIndex++;
134
+ // 1-byte sequence (no continuation bytes)
135
+ if ((byte1 & 0x80) == 0) {
136
+ return byte1;
137
+ }
138
+ // 2-byte sequence
139
+ if ((byte1 & 0xE0) == 0xC0) {
140
+ byte2 = readContinuationByte();
141
+ codePoint = ((byte1 & 0x1F) << 6) | byte2;
142
+ if (codePoint >= 0x80) {
143
+ return codePoint;
144
+ }
145
+ else {
146
+ throw Error('Invalid continuation byte');
147
+ }
148
+ }
149
+ // 3-byte sequence (may include unpaired surrogates)
150
+ if ((byte1 & 0xF0) == 0xE0) {
151
+ byte2 = readContinuationByte();
152
+ byte3 = readContinuationByte();
153
+ codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;
154
+ if (codePoint >= 0x0800) {
155
+ return checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD;
156
+ }
157
+ else {
158
+ throw Error('Invalid continuation byte');
159
+ }
160
+ }
161
+ // 4-byte sequence
162
+ if ((byte1 & 0xF8) == 0xF0) {
163
+ byte2 = readContinuationByte();
164
+ byte3 = readContinuationByte();
165
+ byte4 = readContinuationByte();
166
+ codePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) |
167
+ (byte3 << 0x06) | byte4;
168
+ if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
169
+ return codePoint;
170
+ }
171
+ }
172
+ throw Error('Invalid UTF-8 detected');
173
+ }
174
+ var byteArray;
175
+ var byteCount;
176
+ var byteIndex;
177
+ function utf8decode(byteString, opts) {
178
+ opts = opts || {};
179
+ var strict = false !== opts.strict;
180
+ byteArray = ucs2decode(byteString);
181
+ byteCount = byteArray.length;
182
+ byteIndex = 0;
183
+ var codePoints = [];
184
+ var tmp;
185
+ while ((tmp = decodeSymbol(strict)) !== false) {
186
+ codePoints.push(tmp);
187
+ }
188
+ return ucs2encode(codePoints);
189
+ }
190
+ utf8 = {
191
+ version: '2.1.2',
192
+ encode: utf8encode,
193
+ decode: utf8decode
194
+ };
195
+ return utf8;
196
+ }
197
+
198
+ export { requireUtf8 as __require };