@thebase/ui 0.0.4 → 0.0.6

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 (214) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +49 -8
  3. package/bin/create-baseui-app.mjs +268 -0
  4. package/dist/baseui.esm.js +2 -2
  5. package/dist/baseui.min.css +1 -1
  6. package/dist/baseui.min.js +2 -2
  7. package/dist/baseui.registry.json +6 -7
  8. package/dist/icons/lucide.json +2 -2
  9. package/dist/runtime/marked/marked.min.js +69 -0
  10. package/dist/runtime/mermaid/mermaid.esm.min.mjs +3593 -0
  11. package/dist/runtime/milkdown/apl-2VCEVXBO.js +1 -0
  12. package/dist/runtime/milkdown/asciiarmor-ND4TKJ2V.js +1 -0
  13. package/dist/runtime/milkdown/asn1-5NCC72L6.js +1 -0
  14. package/dist/runtime/milkdown/asterisk-V3QQOGYS.js +1 -0
  15. package/dist/runtime/milkdown/block-B3H3PJID.js +1 -0
  16. package/dist/runtime/milkdown/brainfuck-SETQDLAI.js +1 -0
  17. package/dist/runtime/milkdown/chunk-23NN352E.js +1 -0
  18. package/dist/runtime/milkdown/chunk-373V6XMI.js +1 -0
  19. package/dist/runtime/milkdown/chunk-37CATSBM.js +1 -0
  20. package/dist/runtime/milkdown/chunk-3EORQGKQ.js +1 -0
  21. package/dist/runtime/milkdown/chunk-6HASM4ZR.js +1 -0
  22. package/dist/runtime/milkdown/chunk-6RGD2KUU.js +1 -0
  23. package/dist/runtime/milkdown/chunk-7CVS4AGG.js +3 -0
  24. package/dist/runtime/milkdown/chunk-BV6CAHIM.js +4 -0
  25. package/dist/runtime/milkdown/chunk-CS3PHHYU.js +0 -0
  26. package/dist/runtime/milkdown/chunk-E5R7FPWA.js +5 -0
  27. package/dist/runtime/milkdown/chunk-E6JE25ZM.js +0 -0
  28. package/dist/runtime/milkdown/chunk-FGZNEC46.js +1 -0
  29. package/dist/runtime/milkdown/chunk-FOZORPFE.js +1 -0
  30. package/dist/runtime/milkdown/chunk-GAWLLGNO.js +5 -0
  31. package/dist/runtime/milkdown/chunk-GHRUWTEV.js +1 -0
  32. package/dist/runtime/milkdown/chunk-GVZW4OO4.js +1 -0
  33. package/dist/runtime/milkdown/chunk-HDKYYBRG.js +0 -0
  34. package/dist/runtime/milkdown/chunk-KJCZ4UN6.js +1 -0
  35. package/dist/runtime/milkdown/chunk-KOCVWYBK.js +1 -0
  36. package/dist/runtime/milkdown/chunk-KXKDEYCC.js +1 -0
  37. package/dist/runtime/milkdown/chunk-LIY3GISO.js +13 -0
  38. package/dist/runtime/milkdown/chunk-MSEQNMGN.js +0 -0
  39. package/dist/runtime/milkdown/chunk-PSGXCQNW.js +1 -0
  40. package/dist/runtime/milkdown/chunk-Q5FF4VKZ.js +1 -0
  41. package/dist/runtime/milkdown/chunk-R7FZKCAV.js +1 -0
  42. package/dist/runtime/milkdown/chunk-SFCQEU26.js +1 -0
  43. package/dist/runtime/milkdown/chunk-SMRDMV2Q.js +1 -0
  44. package/dist/runtime/milkdown/chunk-TTCZLSO2.js +1 -0
  45. package/dist/runtime/milkdown/chunk-UBIXYWAI.js +13 -0
  46. package/dist/runtime/milkdown/chunk-UPNN5QP4.js +3 -0
  47. package/dist/runtime/milkdown/chunk-VBVMNS5A.js +3 -0
  48. package/dist/runtime/milkdown/chunk-VKELS2FZ.js +41 -0
  49. package/dist/runtime/milkdown/chunk-VPKKXG6L.js +1 -0
  50. package/dist/runtime/milkdown/chunk-VYL5RGSY.js +0 -0
  51. package/dist/runtime/milkdown/chunk-WGUKYDQQ.js +1 -0
  52. package/dist/runtime/milkdown/chunk-XOIKFU3P.js +4 -0
  53. package/dist/runtime/milkdown/chunk-XOU65PX7.js +1 -0
  54. package/dist/runtime/milkdown/clike-WKR6QU6G.js +1 -0
  55. package/dist/runtime/milkdown/clipboard-SGEGWVIL.js +1 -0
  56. package/dist/runtime/milkdown/clojure-7C5XMSLE.js +1 -0
  57. package/dist/runtime/milkdown/cmake-VX6UCCMV.js +1 -0
  58. package/dist/runtime/milkdown/cobol-IUBDOVSU.js +1 -0
  59. package/dist/runtime/milkdown/coffeescript-OEAM3K5M.js +1 -0
  60. package/dist/runtime/milkdown/commonlisp-LRFHKBQZ.js +1 -0
  61. package/dist/runtime/milkdown/commonmark-KYRQSFY7.js +1 -0
  62. package/dist/runtime/milkdown/core-SZ3VAN2E.js +1 -0
  63. package/dist/runtime/milkdown/crystal-7XKMI75H.js +1 -0
  64. package/dist/runtime/milkdown/css-DTJ74K4A.js +1 -0
  65. package/dist/runtime/milkdown/cursor-4RIJS7XF.js +1 -0
  66. package/dist/runtime/milkdown/cypher-Y7ZMLKQ4.js +1 -0
  67. package/dist/runtime/milkdown/d-NSEMXQMQ.js +1 -0
  68. package/dist/runtime/milkdown/diff-BO3JC62N.js +1 -0
  69. package/dist/runtime/milkdown/diff-WJOHA5PX.js +1 -0
  70. package/dist/runtime/milkdown/dist-5HJGMMBO.js +1 -0
  71. package/dist/runtime/milkdown/dist-63GMFB3D.js +1 -0
  72. package/dist/runtime/milkdown/dist-6JDVYEX3.js +1 -0
  73. package/dist/runtime/milkdown/dist-7277C2KF.js +1 -0
  74. package/dist/runtime/milkdown/dist-EG2OA4VS.js +7 -0
  75. package/dist/runtime/milkdown/dist-EHUNF6M5.js +1 -0
  76. package/dist/runtime/milkdown/dist-I3JGQGWS.js +3 -0
  77. package/dist/runtime/milkdown/dist-I3LMG6JF.js +1 -0
  78. package/dist/runtime/milkdown/dist-IIRHY5PY.js +6 -0
  79. package/dist/runtime/milkdown/dist-J2KSREXK.js +1 -0
  80. package/dist/runtime/milkdown/dist-KY7AL6FL.js +1 -0
  81. package/dist/runtime/milkdown/dist-QB3U2COU.js +1 -0
  82. package/dist/runtime/milkdown/dist-QMASZW6X.js +1 -0
  83. package/dist/runtime/milkdown/dist-RS6ERIZS.js +1 -0
  84. package/dist/runtime/milkdown/dist-TKSPPVS4.js +1 -0
  85. package/dist/runtime/milkdown/dist-U6ZG6DV6.js +1 -0
  86. package/dist/runtime/milkdown/dist-UHXLU77N.js +1 -0
  87. package/dist/runtime/milkdown/dist-WNQ5J4WR.js +2 -0
  88. package/dist/runtime/milkdown/dist-WWUPY2DM.js +1 -0
  89. package/dist/runtime/milkdown/dist-X2CT5LDV.js +1 -0
  90. package/dist/runtime/milkdown/dist-ZBCFN6O5.js +1 -0
  91. package/dist/runtime/milkdown/dockerfile-NAEEVAQU.js +1 -0
  92. package/dist/runtime/milkdown/dtd-3HSCMPBI.js +1 -0
  93. package/dist/runtime/milkdown/dylan-UCUZF6KU.js +1 -0
  94. package/dist/runtime/milkdown/ebnf-3LHOCFAJ.js +1 -0
  95. package/dist/runtime/milkdown/ecl-5R3NXF6N.js +1 -0
  96. package/dist/runtime/milkdown/eiffel-CQ4L5MSH.js +1 -0
  97. package/dist/runtime/milkdown/elm-6QYNGBQ3.js +1 -0
  98. package/dist/runtime/milkdown/erlang-6NH23EDV.js +1 -0
  99. package/dist/runtime/milkdown/esm-W3C6FIFD.js +997 -0
  100. package/dist/runtime/milkdown/factor-MYKNDQPQ.js +1 -0
  101. package/dist/runtime/milkdown/fcl-ACRUXLOI.js +1 -0
  102. package/dist/runtime/milkdown/forth-MGVKD22I.js +1 -0
  103. package/dist/runtime/milkdown/fortran-Y2LH5YJY.js +1 -0
  104. package/dist/runtime/milkdown/gas-DGW2BQT5.js +1 -0
  105. package/dist/runtime/milkdown/gfm-E3RPWLDM.js +1 -0
  106. package/dist/runtime/milkdown/gherkin-YE56IVZ5.js +1 -0
  107. package/dist/runtime/milkdown/groovy-ACMNYCLF.js +1 -0
  108. package/dist/runtime/milkdown/haskell-MIB6HZSL.js +1 -0
  109. package/dist/runtime/milkdown/haxe-TANQRBYK.js +1 -0
  110. package/dist/runtime/milkdown/history-MXXSC4BB.js +1 -0
  111. package/dist/runtime/milkdown/http-QUK2BL6J.js +1 -0
  112. package/dist/runtime/milkdown/idl-54U6ONEE.js +1 -0
  113. package/dist/runtime/milkdown/indent-DPZPSW7O.js +1 -0
  114. package/dist/runtime/milkdown/javascript-43PROIAY.js +1 -0
  115. package/dist/runtime/milkdown/julia-7E2ZIO2U.js +1 -0
  116. package/dist/runtime/milkdown/lib-OHEPSUTR.js +1 -0
  117. package/dist/runtime/milkdown/lib-ULUU3LBY.js +1 -0
  118. package/dist/runtime/milkdown/listener-YERMSFXE.js +1 -0
  119. package/dist/runtime/milkdown/livescript-SUEXR7PK.js +1 -0
  120. package/dist/runtime/milkdown/lua-QNGITPQK.js +1 -0
  121. package/dist/runtime/milkdown/mathematica-HJQQXVFC.js +1 -0
  122. package/dist/runtime/milkdown/mbox-F6SUCJVD.js +1 -0
  123. package/dist/runtime/milkdown/milkdown-editor.js +1 -0
  124. package/dist/runtime/milkdown/milkdown-text-editor.js +1 -0
  125. package/dist/runtime/milkdown/mirc-7S5H76VB.js +1 -0
  126. package/dist/runtime/milkdown/mllike-TTW7I7W4.js +1 -0
  127. package/dist/runtime/milkdown/model-YUHBWZ3A.js +1 -0
  128. package/dist/runtime/milkdown/modelica-3POMKZFY.js +1 -0
  129. package/dist/runtime/milkdown/mscgen-IKAT43RT.js +1 -0
  130. package/dist/runtime/milkdown/mumps-XZE3RMGJ.js +1 -0
  131. package/dist/runtime/milkdown/nginx-QCVWU6DV.js +1 -0
  132. package/dist/runtime/milkdown/nsis-2G5LLGBI.js +1 -0
  133. package/dist/runtime/milkdown/ntriples-T6AMEY2C.js +1 -0
  134. package/dist/runtime/milkdown/octave-64EAJHKR.js +1 -0
  135. package/dist/runtime/milkdown/oz-7QHCZG72.js +1 -0
  136. package/dist/runtime/milkdown/pascal-KWNZTZKE.js +1 -0
  137. package/dist/runtime/milkdown/perl-KX75FRG7.js +1 -0
  138. package/dist/runtime/milkdown/pig-YA2LFBUW.js +1 -0
  139. package/dist/runtime/milkdown/powershell-SONNWKJG.js +1 -0
  140. package/dist/runtime/milkdown/properties-MEUWSNZY.js +1 -0
  141. package/dist/runtime/milkdown/protobuf-RKCPHWGY.js +1 -0
  142. package/dist/runtime/milkdown/pug-VWTHDU4H.js +1 -0
  143. package/dist/runtime/milkdown/puppet-JMZDB2TG.js +1 -0
  144. package/dist/runtime/milkdown/python-GVEPBHD7.js +1 -0
  145. package/dist/runtime/milkdown/q-QBK3FAEX.js +1 -0
  146. package/dist/runtime/milkdown/r-QZYPZHNL.js +1 -0
  147. package/dist/runtime/milkdown/rpm-DU7TLFAI.js +1 -0
  148. package/dist/runtime/milkdown/ruby-DMEPZV6P.js +1 -0
  149. package/dist/runtime/milkdown/sas-UQCOIXSD.js +1 -0
  150. package/dist/runtime/milkdown/scheme-ABXYL6GU.js +1 -0
  151. package/dist/runtime/milkdown/shell-M3XELTMZ.js +1 -0
  152. package/dist/runtime/milkdown/sieve-MUKKCDBZ.js +1 -0
  153. package/dist/runtime/milkdown/slash-WRZAFLVA.js +1 -0
  154. package/dist/runtime/milkdown/smalltalk-P4FKOVAU.js +1 -0
  155. package/dist/runtime/milkdown/solr-HHKG4NNK.js +1 -0
  156. package/dist/runtime/milkdown/sparql-5YJAIBWN.js +1 -0
  157. package/dist/runtime/milkdown/spreadsheet-M3SEYOFV.js +1 -0
  158. package/dist/runtime/milkdown/sql-Z6C3KTS5.js +1 -0
  159. package/dist/runtime/milkdown/stex-MO67FBMF.js +1 -0
  160. package/dist/runtime/milkdown/streaming-ODT2C2AX.js +1 -0
  161. package/dist/runtime/milkdown/stylus-JEMVT3OU.js +1 -0
  162. package/dist/runtime/milkdown/swift-HP7RYRJA.js +1 -0
  163. package/dist/runtime/milkdown/tcl-WPHRLNQC.js +1 -0
  164. package/dist/runtime/milkdown/textile-3LZDM6IW.js +1 -0
  165. package/dist/runtime/milkdown/theme/common/@milkdown/kit/prose/gapcursor/style/gapcursor.css +25 -0
  166. package/dist/runtime/milkdown/theme/common/@milkdown/kit/prose/tables/style/tables.css +48 -0
  167. package/dist/runtime/milkdown/theme/common/@milkdown/kit/prose/view/style/prosemirror.css +54 -0
  168. package/dist/runtime/milkdown/theme/common/ai.css +446 -0
  169. package/dist/runtime/milkdown/theme/common/block-edit.css +131 -0
  170. package/dist/runtime/milkdown/theme/common/code-mirror.css +347 -0
  171. package/dist/runtime/milkdown/theme/common/cursor.css +22 -0
  172. package/dist/runtime/milkdown/theme/common/diff.css +177 -0
  173. package/dist/runtime/milkdown/theme/common/image-block.css +384 -0
  174. package/dist/runtime/milkdown/theme/common/latex.css +42 -0
  175. package/dist/runtime/milkdown/theme/common/link-tooltip.css +107 -0
  176. package/dist/runtime/milkdown/theme/common/list-item.css +50 -0
  177. package/dist/runtime/milkdown/theme/common/placeholder.css +11 -0
  178. package/dist/runtime/milkdown/theme/common/prosemirror-virtual-cursor/style/virtual-cursor.css +51 -0
  179. package/dist/runtime/milkdown/theme/common/prosemirror.css +1 -0
  180. package/dist/runtime/milkdown/theme/common/reset.css +289 -0
  181. package/dist/runtime/milkdown/theme/common/style.css +15 -0
  182. package/dist/runtime/milkdown/theme/common/table.css +219 -0
  183. package/dist/runtime/milkdown/theme/common/toolbar.css +50 -0
  184. package/dist/runtime/milkdown/theme/common/top-bar.css +152 -0
  185. package/dist/runtime/milkdown/tiddlywiki-LMGAXCWG.js +1 -0
  186. package/dist/runtime/milkdown/tiki-SC7NYLRG.js +1 -0
  187. package/dist/runtime/milkdown/toml-VBRI3ILD.js +1 -0
  188. package/dist/runtime/milkdown/tooltip-MQR7E3GN.js +1 -0
  189. package/dist/runtime/milkdown/troff-MZNIC3MS.js +1 -0
  190. package/dist/runtime/milkdown/ttcn-ZUOU74GM.js +1 -0
  191. package/dist/runtime/milkdown/ttcn-cfg-2JJUM5CY.js +1 -0
  192. package/dist/runtime/milkdown/turtle-SNBPEJHA.js +1 -0
  193. package/dist/runtime/milkdown/upload-4DLRUKG7.js +1 -0
  194. package/dist/runtime/milkdown/utils-RGFMAFOI.js +1 -0
  195. package/dist/runtime/milkdown/vb-U45Y75DV.js +1 -0
  196. package/dist/runtime/milkdown/vbscript-XTRRB36U.js +1 -0
  197. package/dist/runtime/milkdown/velocity-Y7TX26SP.js +1 -0
  198. package/dist/runtime/milkdown/verilog-IFT4S6MZ.js +1 -0
  199. package/dist/runtime/milkdown/vhdl-CK4X465M.js +1 -0
  200. package/dist/runtime/milkdown/webidl-N7XOMHHB.js +1 -0
  201. package/dist/runtime/milkdown/xquery-EPMIEXTW.js +1 -0
  202. package/dist/runtime/milkdown/y-webrtc-MVXVFPYO.js +2 -0
  203. package/dist/runtime/milkdown/yacas-A74LVH45.js +1 -0
  204. package/dist/runtime/milkdown/yjs-L4ZX4CJ5.js +1 -0
  205. package/dist/runtime/milkdown/z80-NVBCD5FV.js +1 -0
  206. package/docs/blocks.md +4 -2
  207. package/docs/components/markdown.md +2 -2
  208. package/docs/components/text-editor.md +37 -3
  209. package/docs/icons.md +4 -2
  210. package/docs/installation.md +36 -28
  211. package/docs/owl-components.md +7 -5
  212. package/docs/theming.md +2 -2
  213. package/docs/usage-guide.md +64 -60
  214. package/package.json +8 -2
@@ -0,0 +1,2 @@
1
+ import{a as It,b as Dt,c as Xe,d as Ue,e as Pt}from"./chunk-FGZNEC46.js";import{A as Ct,C as St,D as Be,E as Rt,F as xe,G as Tt,H as At,I as kt,N as Ot,O as Fe,P as je,T as ae,U as Ee,V as $e,W as Je,X as Lt,b as ve,c as pt,d as gt,e as yt,f as mt,g as bt,h as _t,j as Ge,k as Z,l as re,la as xt,m as Ke,n as Q,na as Ut,o as Oe,p as ie,pa as Nt,q as wt,r as De,u as Le,v as fe,w as vt,x as Pe,y as Me,z as Et}from"./chunk-E5R7FPWA.js";import{a as ke,b as sr,d as or}from"./chunk-23NN352E.js";var Vt=sr((qt,tt)=>{(function(S){if(typeof qt=="object"&&typeof tt<"u")tt.exports=S();else if(typeof define=="function"&&define.amd)define([],S);else{var O;O=typeof window>"u"?typeof global>"u"?typeof self>"u"?this:self:global:window,O.SimplePeer=S()}})(function(){var S=Math.floor,O=Math.abs,x=Math.pow;return(function(){function m(T,p,s){function v(l,d){if(!p[l]){if(!T[l]){var o=typeof ke=="function"&&ke;if(!d&&o)return o(l,!0);if(L)return L(l,!0);var _=new Error("Cannot find module '"+l+"'");throw _.code="MODULE_NOT_FOUND",_}var C=p[l]={exports:{}};T[l][0].call(C.exports,function(A){var U=T[l][1][A];return v(U||A)},C,C.exports,m,T,p,s)}return p[l].exports}for(var L=typeof ke=="function"&&ke,n=0;n<s.length;n++)v(s[n]);return v}return m})()({1:[function(m,T,p){"use strict";function s(c){var u=c.length;if(0<u%4)throw new Error("Invalid string. Length must be a multiple of 4");var g=c.indexOf("=");g===-1&&(g=u);var h=g===u?0:4-g%4;return[g,h]}function v(c,u,g){return 3*(u+g)/4-g}function L(c){var u,g,h=s(c),w=h[0],N=h[1],f=new C(v(c,w,N)),y=0,I=0<N?w-4:w;for(g=0;g<I;g+=4)u=_[c.charCodeAt(g)]<<18|_[c.charCodeAt(g+1)]<<12|_[c.charCodeAt(g+2)]<<6|_[c.charCodeAt(g+3)],f[y++]=255&u>>16,f[y++]=255&u>>8,f[y++]=255&u;return N===2&&(u=_[c.charCodeAt(g)]<<2|_[c.charCodeAt(g+1)]>>4,f[y++]=255&u),N===1&&(u=_[c.charCodeAt(g)]<<10|_[c.charCodeAt(g+1)]<<4|_[c.charCodeAt(g+2)]>>2,f[y++]=255&u>>8,f[y++]=255&u),f}function n(c){return o[63&c>>18]+o[63&c>>12]+o[63&c>>6]+o[63&c]}function l(c,u,g){for(var h,w=[],N=u;N<g;N+=3)h=(16711680&c[N]<<16)+(65280&c[N+1]<<8)+(255&c[N+2]),w.push(n(h));return w.join("")}function d(c){for(var u,g=c.length,h=g%3,w=[],N=16383,f=0,y=g-h;f<y;f+=N)w.push(l(c,f,f+N>y?y:f+N));return h===1?(u=c[g-1],w.push(o[u>>2]+o[63&u<<4]+"==")):h===2&&(u=(c[g-2]<<8)+c[g-1],w.push(o[u>>10]+o[63&u>>4]+o[63&u<<2]+"=")),w.join("")}p.byteLength=function(c){var u=s(c),g=u[0],h=u[1];return 3*(g+h)/4-h},p.toByteArray=L,p.fromByteArray=d;for(var o=[],_=[],C=typeof Uint8Array>"u"?Array:Uint8Array,A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",U=0,i=A.length;U<i;++U)o[U]=A[U],_[A.charCodeAt(U)]=U;_[45]=62,_[95]=63},{}],2:[function(){},{}],3:[function(m,T,p){(function(){(function(){"use strict";var s=String.fromCharCode,v=Math.min;function L(e){if(2147483647<e)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=n.prototype,t}function n(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _(e)}return l(e,t,r)}function l(e,t,r){if(typeof e=="string")return C(e,t);if(ArrayBuffer.isView(e))return A(e);if(e==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(b(e,ArrayBuffer)||e&&b(e.buffer,ArrayBuffer))return U(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var a=e.valueOf&&e.valueOf();if(a!=null&&a!==e)return n.from(a,t,r);var E=i(e);if(E)return E;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return n.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function d(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(0>e)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function o(e,t,r){return d(e),0>=e||t===void 0?L(e):typeof r=="string"?L(e).fill(t,r):L(e).fill(t)}function _(e){return d(e),L(0>e?0:0|c(e))}function C(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!n.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|u(e,t),a=L(r),E=a.write(e,t);return E!==r&&(a=a.slice(0,E)),a}function A(e){for(var t=0>e.length?0:0|c(e.length),r=L(t),a=0;a<t;a+=1)r[a]=255&e[a];return r}function U(e,t,r){if(0>t||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var a;return a=t===void 0&&r===void 0?new Uint8Array(e):r===void 0?new Uint8Array(e,t):new Uint8Array(e,t,r),a.__proto__=n.prototype,a}function i(e){if(n.isBuffer(e)){var t=0|c(e.length),r=L(t);return r.length===0||e.copy(r,0,0,t),r}return e.length===void 0?e.type==="Buffer"&&Array.isArray(e.data)?A(e.data):void 0:typeof e.length!="number"||k(e.length)?L(0):A(e)}function c(e){if(e>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function u(e,t){if(n.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||b(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,a=2<arguments.length&&arguments[2]===!0;if(!a&&r===0)return 0;for(var E=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return ue(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return te(e).length;default:if(E)return a?-1:ue(e).length;t=(""+t).toLowerCase(),E=!0}}function g(e,t,r){var a=!1;if((t===void 0||0>t)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),0>=r)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return le(this,t,r);case"utf8":case"utf-8":return X(this,t,r);case"ascii":return F(this,t,r);case"latin1":case"binary":return Ie(this,t,r);case"base64":return H(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ce(this,t,r);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function h(e,t,r){var a=e[t];e[t]=e[r],e[r]=a}function w(e,t,r,a,E){if(e.length===0)return-1;if(typeof r=="string"?(a=r,r=0):2147483647<r?r=2147483647:-2147483648>r&&(r=-2147483648),r=+r,k(r)&&(r=E?0:e.length-1),0>r&&(r=e.length+r),r>=e.length){if(E)return-1;r=e.length-1}else if(0>r)if(E)r=0;else return-1;if(typeof t=="string"&&(t=n.from(t,a)),n.isBuffer(t))return t.length===0?-1:N(e,t,r,a,E);if(typeof t=="number")return t&=255,typeof Uint8Array.prototype.indexOf=="function"?E?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):N(e,[t],r,a,E);throw new TypeError("val must be string, number or Buffer")}function N(e,t,r,a,E){function R(Ae,be){return P===1?Ae[be]:Ae.readUInt16BE(be*P)}var P=1,W=e.length,J=t.length;if(a!==void 0&&(a=(a+"").toLowerCase(),a==="ucs2"||a==="ucs-2"||a==="utf16le"||a==="utf-16le")){if(2>e.length||2>t.length)return-1;P=2,W/=2,J/=2,r/=2}var G;if(E){var Y=-1;for(G=r;G<W;G++)if(R(e,G)!==R(t,Y===-1?0:G-Y))Y!==-1&&(G-=G-Y),Y=-1;else if(Y===-1&&(Y=G),G-Y+1===J)return Y*P}else for(r+J>W&&(r=W-J),G=r;0<=G;G--){for(var z=!0,me=0;me<J;me++)if(R(e,G+me)!==R(t,me)){z=!1;break}if(z)return G}return-1}function f(e,t,r,a){r=+r||0;var E=e.length-r;a?(a=+a,a>E&&(a=E)):a=E;var R=t.length;a>R/2&&(a=R/2);for(var P,W=0;W<a;++W){if(P=parseInt(t.substr(2*W,2),16),k(P))return W;e[r+W]=P}return W}function y(e,t,r,a){return oe(ue(t,e.length-r),e,r,a)}function I(e,t,r,a){return oe(Re(t),e,r,a)}function M(e,t,r,a){return I(e,t,r,a)}function j(e,t,r,a){return oe(te(t),e,r,a)}function q(e,t,r,a){return oe(Te(t,e.length-r),e,r,a)}function H(e,t,r){return t===0&&r===e.length?D.fromByteArray(e):D.fromByteArray(e.slice(t,r))}function X(e,t,r){r=v(e.length,r);for(var a=[],E=t;E<r;){var R=e[E],P=null,W=239<R?4:223<R?3:191<R?2:1;if(E+W<=r){var J,G,Y,z;W===1?128>R&&(P=R):W===2?(J=e[E+1],(192&J)==128&&(z=(31&R)<<6|63&J,127<z&&(P=z))):W===3?(J=e[E+1],G=e[E+2],(192&J)==128&&(192&G)==128&&(z=(15&R)<<12|(63&J)<<6|63&G,2047<z&&(55296>z||57343<z)&&(P=z))):W===4&&(J=e[E+1],G=e[E+2],Y=e[E+3],(192&J)==128&&(192&G)==128&&(192&Y)==128&&(z=(15&R)<<18|(63&J)<<12|(63&G)<<6|63&Y,65535<z&&1114112>z&&(P=z)))}P===null?(P=65533,W=1):65535<P&&(P-=65536,a.push(55296|1023&P>>>10),P=56320|1023&P),a.push(P),E+=W}return ee(a)}function ee(e){var t=e.length;if(t<=4096)return s.apply(String,e);for(var r="",a=0;a<t;)r+=s.apply(String,e.slice(a,a+=4096));return r}function F(e,t,r){var a="";r=v(e.length,r);for(var E=t;E<r;++E)a+=s(127&e[E]);return a}function Ie(e,t,r){var a="";r=v(e.length,r);for(var E=t;E<r;++E)a+=s(e[E]);return a}function le(e,t,r){var a=e.length;(!t||0>t)&&(t=0),(!r||0>r||r>a)&&(r=a);for(var E="",R=t;R<r;++R)E+=Se(e[R]);return E}function ce(e,t,r){for(var a=e.slice(t,r),E="",R=0;R<a.length;R+=2)E+=s(a[R]+256*a[R+1]);return E}function K(e,t,r){if(e%1!=0||0>e)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function $(e,t,r,a,E,R){if(!n.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>E||t<R)throw new RangeError('"value" argument is out of bounds');if(r+a>e.length)throw new RangeError("Index out of range")}function he(e,t,r,a){if(r+a>e.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("Index out of range")}function se(e,t,r,a,E){return t=+t,r>>>=0,E||he(e,t,r,4,34028234663852886e22,-34028234663852886e22),B.write(e,t,r,a,23,4),r+4}function de(e,t,r,a,E){return t=+t,r>>>=0,E||he(e,t,r,8,17976931348623157e292,-17976931348623157e292),B.write(e,t,r,a,52,8),r+8}function ge(e){if(e=e.split("=")[0],e=e.trim().replace(V,""),2>e.length)return"";for(;e.length%4!=0;)e+="=";return e}function Se(e){return 16>e?"0"+e.toString(16):e.toString(16)}function ue(e,t){t=t||1/0;for(var r,a=e.length,E=null,R=[],P=0;P<a;++P){if(r=e.charCodeAt(P),55295<r&&57344>r){if(!E){if(56319<r){-1<(t-=3)&&R.push(239,191,189);continue}else if(P+1===a){-1<(t-=3)&&R.push(239,191,189);continue}E=r;continue}if(56320>r){-1<(t-=3)&&R.push(239,191,189),E=r;continue}r=(E-55296<<10|r-56320)+65536}else E&&-1<(t-=3)&&R.push(239,191,189);if(E=null,128>r){if(0>(t-=1))break;R.push(r)}else if(2048>r){if(0>(t-=2))break;R.push(192|r>>6,128|63&r)}else if(65536>r){if(0>(t-=3))break;R.push(224|r>>12,128|63&r>>6,128|63&r)}else if(1114112>r){if(0>(t-=4))break;R.push(240|r>>18,128|63&r>>12,128|63&r>>6,128|63&r)}else throw new Error("Invalid code point")}return R}function Re(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function Te(e,t){for(var r,a,E,R=[],P=0;P<e.length&&!(0>(t-=2));++P)r=e.charCodeAt(P),a=r>>8,E=r%256,R.push(E),R.push(a);return R}function te(e){return D.toByteArray(ge(e))}function oe(e,t,r,a){for(var E=0;E<a&&!(E+r>=t.length||E>=e.length);++E)t[E+r]=e[E];return E}function b(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function k(e){return e!==e}var D=m("base64-js"),B=m("ieee754");p.Buffer=n,p.SlowBuffer=function(e){return+e!=e&&(e=0),n.alloc(+e)},p.INSPECT_MAX_BYTES=50,p.kMaxLength=2147483647,n.TYPED_ARRAY_SUPPORT=(function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},e.foo()===42}catch{return!1}})(),n.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(n.prototype,"parent",{enumerable:!0,get:function(){return n.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(n.prototype,"offset",{enumerable:!0,get:function(){return n.isBuffer(this)?this.byteOffset:void 0}}),typeof Symbol<"u"&&Symbol.species!=null&&n[Symbol.species]===n&&Object.defineProperty(n,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),n.poolSize=8192,n.from=function(e,t,r){return l(e,t,r)},n.prototype.__proto__=Uint8Array.prototype,n.__proto__=Uint8Array,n.alloc=function(e,t,r){return o(e,t,r)},n.allocUnsafe=function(e){return _(e)},n.allocUnsafeSlow=function(e){return _(e)},n.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==n.prototype},n.compare=function(e,t){if(b(e,Uint8Array)&&(e=n.from(e,e.offset,e.byteLength)),b(t,Uint8Array)&&(t=n.from(t,t.offset,t.byteLength)),!n.isBuffer(e)||!n.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,a=t.length,E=0,R=v(r,a);E<R;++E)if(e[E]!==t[E]){r=e[E],a=t[E];break}return r<a?-1:a<r?1:0},n.isEncoding=function(e){switch((e+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},n.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return n.alloc(0);var r;if(t===void 0)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var a=n.allocUnsafe(t),E=0;for(r=0;r<e.length;++r){var R=e[r];if(b(R,Uint8Array)&&(R=n.from(R)),!n.isBuffer(R))throw new TypeError('"list" argument must be an Array of Buffers');R.copy(a,E),E+=R.length}return a},n.byteLength=u,n.prototype._isBuffer=!0,n.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)h(this,t,t+1);return this},n.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},n.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},n.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?X(this,0,e):g.apply(this,arguments)},n.prototype.toLocaleString=n.prototype.toString,n.prototype.equals=function(e){if(!n.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||n.compare(this,e)===0},n.prototype.inspect=function(){var e="",t=p.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},n.prototype.compare=function(e,t,r,a,E){if(b(e,Uint8Array)&&(e=n.from(e,e.offset,e.byteLength)),!n.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),r===void 0&&(r=e?e.length:0),a===void 0&&(a=0),E===void 0&&(E=this.length),0>t||r>e.length||0>a||E>this.length)throw new RangeError("out of range index");if(a>=E&&t>=r)return 0;if(a>=E)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,a>>>=0,E>>>=0,this===e)return 0;for(var R=E-a,P=r-t,W=v(R,P),J=this.slice(a,E),G=e.slice(t,r),Y=0;Y<W;++Y)if(J[Y]!==G[Y]){R=J[Y],P=G[Y];break}return R<P?-1:P<R?1:0},n.prototype.includes=function(e,t,r){return this.indexOf(e,t,r)!==-1},n.prototype.indexOf=function(e,t,r){return w(this,e,t,r,!0)},n.prototype.lastIndexOf=function(e,t,r){return w(this,e,t,r,!1)},n.prototype.write=function(e,t,r,a){if(t===void 0)a="utf8",r=this.length,t=0;else if(r===void 0&&typeof t=="string")a=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,a===void 0&&(a="utf8")):(a=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var E=this.length-t;if((r===void 0||r>E)&&(r=E),0<e.length&&(0>r||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var R=!1;;)switch(a){case"hex":return f(this,e,t,r);case"utf8":case"utf-8":return y(this,e,t,r);case"ascii":return I(this,e,t,r);case"latin1":case"binary":return M(this,e,t,r);case"base64":return j(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,e,t,r);default:if(R)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),R=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},n.prototype.slice=function(e,t){var r=this.length;e=~~e,t=t===void 0?r:~~t,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),t<e&&(t=e);var a=this.subarray(e,t);return a.__proto__=n.prototype,a},n.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||K(e,t,this.length);for(var a=this[e],E=1,R=0;++R<t&&(E*=256);)a+=this[e+R]*E;return a},n.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||K(e,t,this.length);for(var a=this[e+--t],E=1;0<t&&(E*=256);)a+=this[e+--t]*E;return a},n.prototype.readUInt8=function(e,t){return e>>>=0,t||K(e,1,this.length),this[e]},n.prototype.readUInt16LE=function(e,t){return e>>>=0,t||K(e,2,this.length),this[e]|this[e+1]<<8},n.prototype.readUInt16BE=function(e,t){return e>>>=0,t||K(e,2,this.length),this[e]<<8|this[e+1]},n.prototype.readUInt32LE=function(e,t){return e>>>=0,t||K(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},n.prototype.readUInt32BE=function(e,t){return e>>>=0,t||K(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},n.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||K(e,t,this.length);for(var a=this[e],E=1,R=0;++R<t&&(E*=256);)a+=this[e+R]*E;return E*=128,a>=E&&(a-=x(2,8*t)),a},n.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||K(e,t,this.length);for(var a=t,E=1,R=this[e+--a];0<a&&(E*=256);)R+=this[e+--a]*E;return E*=128,R>=E&&(R-=x(2,8*t)),R},n.prototype.readInt8=function(e,t){return e>>>=0,t||K(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},n.prototype.readInt16LE=function(e,t){e>>>=0,t||K(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},n.prototype.readInt16BE=function(e,t){e>>>=0,t||K(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},n.prototype.readInt32LE=function(e,t){return e>>>=0,t||K(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},n.prototype.readInt32BE=function(e,t){return e>>>=0,t||K(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},n.prototype.readFloatLE=function(e,t){return e>>>=0,t||K(e,4,this.length),B.read(this,e,!0,23,4)},n.prototype.readFloatBE=function(e,t){return e>>>=0,t||K(e,4,this.length),B.read(this,e,!1,23,4)},n.prototype.readDoubleLE=function(e,t){return e>>>=0,t||K(e,8,this.length),B.read(this,e,!0,52,8)},n.prototype.readDoubleBE=function(e,t){return e>>>=0,t||K(e,8,this.length),B.read(this,e,!1,52,8)},n.prototype.writeUIntLE=function(e,t,r,a){if(e=+e,t>>>=0,r>>>=0,!a){var E=x(2,8*r)-1;$(this,e,t,r,E,0)}var R=1,P=0;for(this[t]=255&e;++P<r&&(R*=256);)this[t+P]=255&e/R;return t+r},n.prototype.writeUIntBE=function(e,t,r,a){if(e=+e,t>>>=0,r>>>=0,!a){var E=x(2,8*r)-1;$(this,e,t,r,E,0)}var R=r-1,P=1;for(this[t+R]=255&e;0<=--R&&(P*=256);)this[t+R]=255&e/P;return t+r},n.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,1,255,0),this[t]=255&e,t+1},n.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},n.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},n.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},n.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},n.prototype.writeIntLE=function(e,t,r,a){if(e=+e,t>>>=0,!a){var E=x(2,8*r-1);$(this,e,t,r,E-1,-E)}var R=0,P=1,W=0;for(this[t]=255&e;++R<r&&(P*=256);)0>e&&W===0&&this[t+R-1]!==0&&(W=1),this[t+R]=255&(e/P>>0)-W;return t+r},n.prototype.writeIntBE=function(e,t,r,a){if(e=+e,t>>>=0,!a){var E=x(2,8*r-1);$(this,e,t,r,E-1,-E)}var R=r-1,P=1,W=0;for(this[t+R]=255&e;0<=--R&&(P*=256);)0>e&&W===0&&this[t+R+1]!==0&&(W=1),this[t+R]=255&(e/P>>0)-W;return t+r},n.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,1,127,-128),0>e&&(e=255+e+1),this[t]=255&e,t+1},n.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},n.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},n.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},n.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},n.prototype.writeFloatLE=function(e,t,r){return se(this,e,t,!0,r)},n.prototype.writeFloatBE=function(e,t,r){return se(this,e,t,!1,r)},n.prototype.writeDoubleLE=function(e,t,r){return de(this,e,t,!0,r)},n.prototype.writeDoubleBE=function(e,t,r){return de(this,e,t,!1,r)},n.prototype.copy=function(e,t,r,a){if(!n.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),a||a===0||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),0<a&&a<r&&(a=r),a===r||e.length===0||this.length===0)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("Index out of range");if(0>a)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t<a-r&&(a=e.length-t+r);var E=a-r;if(this===e&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(t,r,a);else if(this===e&&r<t&&t<a)for(var R=E-1;0<=R;--R)e[R+t]=this[R+r];else Uint8Array.prototype.set.call(e,this.subarray(r,a),t);return E},n.prototype.fill=function(e,t,r,a){if(typeof e=="string"){if(typeof t=="string"?(a=t,t=0,r=this.length):typeof r=="string"&&(a=r,r=this.length),a!==void 0&&typeof a!="string")throw new TypeError("encoding must be a string");if(typeof a=="string"&&!n.isEncoding(a))throw new TypeError("Unknown encoding: "+a);if(e.length===1){var E=e.charCodeAt(0);(a==="utf8"&&128>E||a==="latin1")&&(e=E)}}else typeof e=="number"&&(e&=255);if(0>t||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;t>>>=0,r=r===void 0?this.length:r>>>0,e||(e=0);var R;if(typeof e=="number")for(R=t;R<r;++R)this[R]=e;else{var P=n.isBuffer(e)?e:n.from(e,a),W=P.length;if(W===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(R=0;R<r-t;++R)this[R+t]=P[R%W]}return this};var V=/[^+/0-9A-Za-z-_]/g}).call(this)}).call(this,m("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:9}],4:[function(m,T,p){(function(s){(function(){function v(){let n;try{n=p.storage.getItem("debug")}catch{}return!n&&typeof s<"u"&&"env"in s&&(n=s.env.DEBUG),n}p.formatArgs=function(n){if(n[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+n[0]+(this.useColors?"%c ":" ")+"+"+T.exports.humanize(this.diff),!this.useColors)return;let l="color: "+this.color;n.splice(1,0,l,"color: inherit");let d=0,o=0;n[0].replace(/%[a-zA-Z%]/g,_=>{_==="%%"||(d++,_==="%c"&&(o=d))}),n.splice(o,0,l)},p.save=function(n){try{n?p.storage.setItem("debug",n):p.storage.removeItem("debug")}catch{}},p.load=v,p.useColors=function(){return!!(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))||!(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},p.storage=(function(){try{return localStorage}catch{}})(),p.destroy=(()=>{let n=!1;return()=>{n||(n=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),p.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],p.log=console.debug||console.log||(()=>{}),T.exports=m("./common")(p);let{formatters:L}=T.exports;L.j=function(n){try{return JSON.stringify(n)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}}).call(this)}).call(this,m("_process"))},{"./common":5,_process:12}],5:[function(m,T){T.exports=function(p){function s(n){function l(..._){if(!l.enabled)return;let C=l,A=+new Date,U=A-(d||A);C.diff=U,C.prev=d,C.curr=A,d=A,_[0]=s.coerce(_[0]),typeof _[0]!="string"&&_.unshift("%O");let i=0;_[0]=_[0].replace(/%([a-zA-Z%])/g,(u,g)=>{if(u==="%%")return"%";i++;let h=s.formatters[g];if(typeof h=="function"){let w=_[i];u=h.call(C,w),_.splice(i,1),i--}return u}),s.formatArgs.call(C,_),(C.log||s.log).apply(C,_)}let d,o=null;return l.namespace=n,l.useColors=s.useColors(),l.color=s.selectColor(n),l.extend=v,l.destroy=s.destroy,Object.defineProperty(l,"enabled",{enumerable:!0,configurable:!1,get:()=>o===null?s.enabled(n):o,set:_=>{o=_}}),typeof s.init=="function"&&s.init(l),l}function v(n,l){let d=s(this.namespace+(typeof l>"u"?":":l)+n);return d.log=this.log,d}function L(n){return n.toString().substring(2,n.toString().length-2).replace(/\.\*\?$/,"*")}return s.debug=s,s.default=s,s.coerce=function(n){return n instanceof Error?n.stack||n.message:n},s.disable=function(){let n=[...s.names.map(L),...s.skips.map(L).map(l=>"-"+l)].join(",");return s.enable(""),n},s.enable=function(n){s.save(n),s.names=[],s.skips=[];let l,d=(typeof n=="string"?n:"").split(/[\s,]+/),o=d.length;for(l=0;l<o;l++)d[l]&&(n=d[l].replace(/\*/g,".*?"),n[0]==="-"?s.skips.push(new RegExp("^"+n.substr(1)+"$")):s.names.push(new RegExp("^"+n+"$")))},s.enabled=function(n){if(n[n.length-1]==="*")return!0;let l,d;for(l=0,d=s.skips.length;l<d;l++)if(s.skips[l].test(n))return!1;for(l=0,d=s.names.length;l<d;l++)if(s.names[l].test(n))return!0;return!1},s.humanize=m("ms"),s.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(p).forEach(n=>{s[n]=p[n]}),s.names=[],s.skips=[],s.formatters={},s.selectColor=function(n){let l=0;for(let d=0;d<n.length;d++)l=(l<<5)-l+n.charCodeAt(d),l|=0;return s.colors[O(l)%s.colors.length]},s.enable(s.load()),s}},{ms:11}],6:[function(m,T){"use strict";function p(s,v){for(let L in v)Object.defineProperty(s,L,{value:v[L],enumerable:!0,configurable:!0});return s}T.exports=function(s,v,L){if(!s||typeof s=="string")throw new TypeError("Please pass an Error to err-code");L||(L={}),typeof v=="object"&&(L=v,v=""),v&&(L.code=v);try{return p(s,L)}catch{L.message=s.message,L.stack=s.stack;let l=function(){};return l.prototype=Object.create(Object.getPrototypeOf(s)),p(new l,L)}}},{}],7:[function(m,T){"use strict";function p(f){console&&console.warn&&console.warn(f)}function s(){s.init.call(this)}function v(f){if(typeof f!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof f)}function L(f){return f._maxListeners===void 0?s.defaultMaxListeners:f._maxListeners}function n(f,y,I,M){var j,q,H;if(v(I),q=f._events,q===void 0?(q=f._events=Object.create(null),f._eventsCount=0):(q.newListener!==void 0&&(f.emit("newListener",y,I.listener?I.listener:I),q=f._events),H=q[y]),H===void 0)H=q[y]=I,++f._eventsCount;else if(typeof H=="function"?H=q[y]=M?[I,H]:[H,I]:M?H.unshift(I):H.push(I),j=L(f),0<j&&H.length>j&&!H.warned){H.warned=!0;var X=new Error("Possible EventEmitter memory leak detected. "+H.length+" "+(y+" listeners added. Use emitter.setMaxListeners() to increase limit"));X.name="MaxListenersExceededWarning",X.emitter=f,X.type=y,X.count=H.length,p(X)}return f}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(f,y,I){var M={fired:!1,wrapFn:void 0,target:f,type:y,listener:I},j=l.bind(M);return j.listener=I,M.wrapFn=j,j}function o(f,y,I){var M=f._events;if(M===void 0)return[];var j=M[y];return j===void 0?[]:typeof j=="function"?I?[j.listener||j]:[j]:I?U(j):C(j,j.length)}function _(f){var y=this._events;if(y!==void 0){var I=y[f];if(typeof I=="function")return 1;if(I!==void 0)return I.length}return 0}function C(f,y){for(var I=Array(y),M=0;M<y;++M)I[M]=f[M];return I}function A(f,y){for(;y+1<f.length;y++)f[y]=f[y+1];f.pop()}function U(f){for(var y=Array(f.length),I=0;I<y.length;++I)y[I]=f[I].listener||f[I];return y}function i(f,y,I){typeof f.on=="function"&&c(f,"error",y,I)}function c(f,y,I,M){if(typeof f.on=="function")M.once?f.once(y,I):f.on(y,I);else if(typeof f.addEventListener=="function")f.addEventListener(y,function j(q){M.once&&f.removeEventListener(y,j),I(q)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof f)}var u,g=typeof Reflect=="object"?Reflect:null,h=g&&typeof g.apply=="function"?g.apply:function(f,y,I){return Function.prototype.apply.call(f,y,I)};u=g&&typeof g.ownKeys=="function"?g.ownKeys:Object.getOwnPropertySymbols?function(f){return Object.getOwnPropertyNames(f).concat(Object.getOwnPropertySymbols(f))}:function(f){return Object.getOwnPropertyNames(f)};var w=Number.isNaN||function(f){return f!==f};T.exports=s,T.exports.once=function(f,y){return new Promise(function(I,M){function j(H){f.removeListener(y,q),M(H)}function q(){typeof f.removeListener=="function"&&f.removeListener("error",j),I([].slice.call(arguments))}c(f,y,q,{once:!0}),y!=="error"&&i(f,j,{once:!0})})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var N=10;Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return N},set:function(f){if(typeof f!="number"||0>f||w(f))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+f+".");N=f}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(f){if(typeof f!="number"||0>f||w(f))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+f+".");return this._maxListeners=f,this},s.prototype.getMaxListeners=function(){return L(this)},s.prototype.emit=function(f){for(var y=[],I=1;I<arguments.length;I++)y.push(arguments[I]);var M=f==="error",j=this._events;if(j!==void 0)M=M&&j.error===void 0;else if(!M)return!1;if(M){var q;if(0<y.length&&(q=y[0]),q instanceof Error)throw q;var H=new Error("Unhandled error."+(q?" ("+q.message+")":""));throw H.context=q,H}var X=j[f];if(X===void 0)return!1;if(typeof X=="function")h(X,this,y);else for(var ee=X.length,F=C(X,ee),I=0;I<ee;++I)h(F[I],this,y);return!0},s.prototype.addListener=function(f,y){return n(this,f,y,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(f,y){return n(this,f,y,!0)},s.prototype.once=function(f,y){return v(y),this.on(f,d(this,f,y)),this},s.prototype.prependOnceListener=function(f,y){return v(y),this.prependListener(f,d(this,f,y)),this},s.prototype.removeListener=function(f,y){var I,M,j,q,H;if(v(y),M=this._events,M===void 0)return this;if(I=M[f],I===void 0)return this;if(I===y||I.listener===y)--this._eventsCount==0?this._events=Object.create(null):(delete M[f],M.removeListener&&this.emit("removeListener",f,I.listener||y));else if(typeof I!="function"){for(j=-1,q=I.length-1;0<=q;q--)if(I[q]===y||I[q].listener===y){H=I[q].listener,j=q;break}if(0>j)return this;j===0?I.shift():A(I,j),I.length===1&&(M[f]=I[0]),M.removeListener!==void 0&&this.emit("removeListener",f,H||y)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(f){var y,I,M;if(I=this._events,I===void 0)return this;if(I.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):I[f]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete I[f]),this;if(arguments.length===0){var j,q=Object.keys(I);for(M=0;M<q.length;++M)j=q[M],j!=="removeListener"&&this.removeAllListeners(j);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(y=I[f],typeof y=="function")this.removeListener(f,y);else if(y!==void 0)for(M=y.length-1;0<=M;M--)this.removeListener(f,y[M]);return this},s.prototype.listeners=function(f){return o(this,f,!0)},s.prototype.rawListeners=function(f){return o(this,f,!1)},s.listenerCount=function(f,y){return typeof f.listenerCount=="function"?f.listenerCount(y):_.call(f,y)},s.prototype.listenerCount=_,s.prototype.eventNames=function(){return 0<this._eventsCount?u(this._events):[]}},{}],8:[function(m,T){T.exports=function(){if(typeof globalThis>"u")return null;var p={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return p.RTCPeerConnection?p:null}},{}],9:[function(m,T,p){p.read=function(s,v,L,n,l){var d,o,_=8*l-n-1,C=(1<<_)-1,A=C>>1,U=-7,i=L?l-1:0,c=L?-1:1,u=s[v+i];for(i+=c,d=u&(1<<-U)-1,u>>=-U,U+=_;0<U;d=256*d+s[v+i],i+=c,U-=8);for(o=d&(1<<-U)-1,d>>=-U,U+=n;0<U;o=256*o+s[v+i],i+=c,U-=8);if(d===0)d=1-A;else{if(d===C)return o?NaN:(u?-1:1)*(1/0);o+=x(2,n),d-=A}return(u?-1:1)*o*x(2,d-n)},p.write=function(s,v,L,n,l,d){var o,_,C,A=Math.LN2,U=Math.log,i=8*d-l-1,c=(1<<i)-1,u=c>>1,g=l===23?x(2,-24)-x(2,-77):0,h=n?0:d-1,w=n?1:-1,N=0>v||v===0&&0>1/v?1:0;for(v=O(v),isNaN(v)||v===1/0?(_=isNaN(v)?1:0,o=c):(o=S(U(v)/A),1>v*(C=x(2,-o))&&(o--,C*=2),v+=1<=o+u?g/C:g*x(2,1-u),2<=v*C&&(o++,C/=2),o+u>=c?(_=0,o=c):1<=o+u?(_=(v*C-1)*x(2,l),o+=u):(_=v*x(2,u-1)*x(2,l),o=0));8<=l;s[L+h]=255&_,h+=w,_/=256,l-=8);for(o=o<<l|_,i+=l;0<i;s[L+h]=255&o,h+=w,o/=256,i-=8);s[L+h-w]|=128*N}},{}],10:[function(m,T){T.exports=typeof Object.create=="function"?function(p,s){s&&(p.super_=s,p.prototype=Object.create(s.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}))}:function(p,s){if(s){p.super_=s;var v=function(){};v.prototype=s.prototype,p.prototype=new v,p.prototype.constructor=p}}},{}],11:[function(m,T){var p=Math.round;function s(d){if(d+="",!(100<d.length)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(o){var _=parseFloat(o[1]),C=(o[2]||"ms").toLowerCase();return C==="years"||C==="year"||C==="yrs"||C==="yr"||C==="y"?315576e5*_:C==="weeks"||C==="week"||C==="w"?6048e5*_:C==="days"||C==="day"||C==="d"?864e5*_:C==="hours"||C==="hour"||C==="hrs"||C==="hr"||C==="h"?36e5*_:C==="minutes"||C==="minute"||C==="mins"||C==="min"||C==="m"?6e4*_:C==="seconds"||C==="second"||C==="secs"||C==="sec"||C==="s"?1e3*_:C==="milliseconds"||C==="millisecond"||C==="msecs"||C==="msec"||C==="ms"?_:void 0}}}function v(d){var o=O(d);return 864e5<=o?p(d/864e5)+"d":36e5<=o?p(d/36e5)+"h":6e4<=o?p(d/6e4)+"m":1e3<=o?p(d/1e3)+"s":d+"ms"}function L(d){var o=O(d);return 864e5<=o?n(d,o,864e5,"day"):36e5<=o?n(d,o,36e5,"hour"):6e4<=o?n(d,o,6e4,"minute"):1e3<=o?n(d,o,1e3,"second"):d+" ms"}function n(d,o,_,C){return p(d/_)+" "+C+(o>=1.5*_?"s":"")}var l=24*(60*6e4);T.exports=function(d,o){o=o||{};var _=typeof d;if(_=="string"&&0<d.length)return s(d);if(_==="number"&&isFinite(d))return o.long?L(d):v(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))}},{}],12:[function(m,T){function p(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function v(g){if(_===setTimeout)return setTimeout(g,0);if((_===p||!_)&&setTimeout)return _=setTimeout,setTimeout(g,0);try{return _(g,0)}catch{try{return _.call(null,g,0)}catch{return _.call(this,g,0)}}}function L(g){if(C===clearTimeout)return clearTimeout(g);if((C===s||!C)&&clearTimeout)return C=clearTimeout,clearTimeout(g);try{return C(g)}catch{try{return C.call(null,g)}catch{return C.call(this,g)}}}function n(){c&&U&&(c=!1,U.length?i=U.concat(i):u=-1,i.length&&l())}function l(){if(!c){var g=v(n);c=!0;for(var h=i.length;h;){for(U=i,i=[];++u<h;)U&&U[u].run();u=-1,h=i.length}U=null,c=!1,L(g)}}function d(g,h){this.fun=g,this.array=h}function o(){}var _,C,A=T.exports={};(function(){try{_=typeof setTimeout=="function"?setTimeout:p}catch{_=p}try{C=typeof clearTimeout=="function"?clearTimeout:s}catch{C=s}})();var U,i=[],c=!1,u=-1;A.nextTick=function(g){var h=Array(arguments.length-1);if(1<arguments.length)for(var w=1;w<arguments.length;w++)h[w-1]=arguments[w];i.push(new d(g,h)),i.length!==1||c||v(l)},d.prototype.run=function(){this.fun.apply(null,this.array)},A.title="browser",A.browser=!0,A.env={},A.argv=[],A.version="",A.versions={},A.on=o,A.addListener=o,A.once=o,A.off=o,A.removeListener=o,A.removeAllListeners=o,A.emit=o,A.prependListener=o,A.prependOnceListener=o,A.listeners=function(){return[]},A.binding=function(){throw new Error("process.binding is not supported")},A.cwd=function(){return"/"},A.chdir=function(){throw new Error("process.chdir is not supported")},A.umask=function(){return 0}},{}],13:[function(m,T){(function(p){(function(){let s;T.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window>"u"?p:window):v=>(s||(s=Promise.resolve())).then(v).catch(L=>setTimeout(()=>{throw L},0))}).call(this)}).call(this,typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],14:[function(m,T){(function(p,s){(function(){"use strict";var v=m("safe-buffer").Buffer,L=s.crypto||s.msCrypto;T.exports=L&&L.getRandomValues?function(n,l){if(n>4294967295)throw new RangeError("requested too many random bytes");var d=v.allocUnsafe(n);if(0<n)if(65536<n)for(var o=0;o<n;o+=65536)L.getRandomValues(d.slice(o,o+65536));else L.getRandomValues(d);return typeof l=="function"?p.nextTick(function(){l(null,d)}):d}:function(){throw new Error(`Secure random number generation is not supported by this browser.
2
+ Use Chrome, Firefox or Internet Explorer 11`)}}).call(this)}).call(this,m("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{_process:12,"safe-buffer":30}],15:[function(m,T){"use strict";function p(o,_){o.prototype=Object.create(_.prototype),o.prototype.constructor=o,o.__proto__=_}function s(o,_,C){function A(i,c,u){return typeof _=="string"?_:_(i,c,u)}C||(C=Error);var U=(function(i){function c(u,g,h){return i.call(this,A(u,g,h))||this}return p(c,i),c})(C);U.prototype.name=C.name,U.prototype.code=o,d[o]=U}function v(o,_){if(Array.isArray(o)){var C=o.length;return o=o.map(function(A){return A+""}),2<C?"one of ".concat(_," ").concat(o.slice(0,C-1).join(", "),", or ")+o[C-1]:C===2?"one of ".concat(_," ").concat(o[0]," or ").concat(o[1]):"of ".concat(_," ").concat(o[0])}return"of ".concat(_," ").concat(o+"")}function L(o,_,C){return o.substr(!C||0>C?0:+C,_.length)===_}function n(o,_,C){return(C===void 0||C>o.length)&&(C=o.length),o.substring(C-_.length,C)===_}function l(o,_,C){return typeof C!="number"&&(C=0),!(C+_.length>o.length)&&o.indexOf(_,C)!==-1}var d={};s("ERR_INVALID_OPT_VALUE",function(o,_){return'The value "'+_+'" is invalid for option "'+o+'"'},TypeError),s("ERR_INVALID_ARG_TYPE",function(o,_,C){var A;typeof _=="string"&&L(_,"not ")?(A="must not be",_=_.replace(/^not /,"")):A="must be";var U;if(n(o," argument"))U="The ".concat(o," ").concat(A," ").concat(v(_,"type"));else{var i=l(o,".")?"property":"argument";U='The "'.concat(o,'" ').concat(i," ").concat(A," ").concat(v(_,"type"))}return U+=". Received type ".concat(typeof C),U},TypeError),s("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),s("ERR_METHOD_NOT_IMPLEMENTED",function(o){return"The "+o+" method is not implemented"}),s("ERR_STREAM_PREMATURE_CLOSE","Premature close"),s("ERR_STREAM_DESTROYED",function(o){return"Cannot call "+o+" after a stream was destroyed"}),s("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),s("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),s("ERR_STREAM_WRITE_AFTER_END","write after end"),s("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),s("ERR_UNKNOWN_ENCODING",function(o){return"Unknown encoding: "+o},TypeError),s("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),T.exports.codes=d},{}],16:[function(m,T){(function(p){(function(){"use strict";function s(A){return this instanceof s?(l.call(this,A),d.call(this,A),this.allowHalfOpen=!0,void(A&&(A.readable===!1&&(this.readable=!1),A.writable===!1&&(this.writable=!1),A.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",v))))):new s(A)}function v(){this._writableState.ended||p.nextTick(L,this)}function L(A){A.end()}var n=Object.keys||function(A){var U=[];for(var i in A)U.push(i);return U};T.exports=s;var l=m("./_stream_readable"),d=m("./_stream_writable");m("inherits")(s,l);for(var o,_=n(d.prototype),C=0;C<_.length;C++)o=_[C],s.prototype[o]||(s.prototype[o]=d.prototype[o]);Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(A){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=A,this._writableState.destroyed=A)}})}).call(this)}).call(this,m("_process"))},{"./_stream_readable":18,"./_stream_writable":20,_process:12,inherits:10}],17:[function(m,T){"use strict";function p(v){return this instanceof p?void s.call(this,v):new p(v)}T.exports=p;var s=m("./_stream_transform");m("inherits")(p,s),p.prototype._transform=function(v,L,n){n(null,v)}},{"./_stream_transform":19,inherits:10}],18:[function(m,T){(function(p,s){(function(){"use strict";function v(e){return K.from(e)}function L(e){return K.isBuffer(e)||e instanceof $}function n(e,t,r){return typeof e.prependListener=="function"?e.prependListener(t,r):void(e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r))}function l(e,t,r){ee=ee||m("./_stream_duplex"),e=e||{},typeof r!="boolean"&&(r=t instanceof ee),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=Te(this,e,"readableHighWaterMark",r),this.buffer=new Se,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(!se&&(se=m("string_decoder/").StringDecoder),this.decoder=new se(e.encoding),this.encoding=e.encoding)}function d(e){if(ee=ee||m("./_stream_duplex"),!(this instanceof d))return new d(e);var t=this instanceof ee;this._readableState=new l(e,this,t),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),ce.call(this)}function o(e,t,r,a,E){F("readableAddChunk",t);var R=e._readableState;if(t===null)R.reading=!1,i(e,R);else{var P;if(E||(P=C(R,t)),P)B(e,P);else if(!(R.objectMode||t&&0<t.length))a||(R.reading=!1,g(e,R));else if(typeof t=="string"||R.objectMode||Object.getPrototypeOf(t)===K.prototype||(t=v(t)),a)R.endEmitted?B(e,new D):_(e,R,t,!0);else if(R.ended)B(e,new b);else{if(R.destroyed)return!1;R.reading=!1,R.decoder&&!r?(t=R.decoder.write(t),R.objectMode||t.length!==0?_(e,R,t,!1):g(e,R)):_(e,R,t,!1)}}return!R.ended&&(R.length<R.highWaterMark||R.length===0)}function _(e,t,r,a){t.flowing&&t.length===0&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,a?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&c(e)),g(e,t)}function C(e,t){var r;return L(t)||typeof t=="string"||t===void 0||e.objectMode||(r=new oe("chunk",["string","Buffer","Uint8Array"],t)),r}function A(e){return 1073741824<=e?e=1073741824:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function U(e,t){return 0>=e||t.length===0&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=A(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}function i(e,t){if(F("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?c(e):(t.needReadable=!1,!t.emittedReadable&&(t.emittedReadable=!0,u(e)))}}function c(e){var t=e._readableState;F("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(F("emitReadable",t.flowing),t.emittedReadable=!0,p.nextTick(u,e))}function u(e){var t=e._readableState;F("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function g(e,t){t.readingMore||(t.readingMore=!0,p.nextTick(h,e,t))}function h(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var r=t.length;if(F("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function w(e){return function(){var t=e._readableState;F("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&le(e,"data")&&(t.flowing=!0,M(e))}}function N(e){var t=e._readableState;t.readableListening=0<e.listenerCount("readable"),t.resumeScheduled&&!t.paused?t.flowing=!0:0<e.listenerCount("data")&&e.resume()}function f(e){F("readable nexttick read 0"),e.read(0)}function y(e,t){t.resumeScheduled||(t.resumeScheduled=!0,p.nextTick(I,e,t))}function I(e,t){F("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),M(e),t.flowing&&!t.reading&&e.read(0)}function M(e){var t=e._readableState;for(F("flow",t.flowing);t.flowing&&e.read()!==null;);}function j(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):t.buffer.length===1?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function q(e){var t=e._readableState;F("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,p.nextTick(H,t,e))}function H(e,t){if(F("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function X(e,t){for(var r=0,a=e.length;r<a;r++)if(e[r]===t)return r;return-1}T.exports=d;var ee;d.ReadableState=l;var F,Ie=m("events").EventEmitter,le=function(e,t){return e.listeners(t).length},ce=m("./internal/streams/stream"),K=m("buffer").Buffer,$=s.Uint8Array||function(){},he=m("util");F=he&&he.debuglog?he.debuglog("stream"):function(){};var se,de,ge,Se=m("./internal/streams/buffer_list"),ue=m("./internal/streams/destroy"),Re=m("./internal/streams/state"),Te=Re.getHighWaterMark,te=m("../errors").codes,oe=te.ERR_INVALID_ARG_TYPE,b=te.ERR_STREAM_PUSH_AFTER_EOF,k=te.ERR_METHOD_NOT_IMPLEMENTED,D=te.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;m("inherits")(d,ce);var B=ue.errorOrDestroy,V=["error","close","destroy","pause","resume"];Object.defineProperty(d.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),d.prototype.destroy=ue.destroy,d.prototype._undestroy=ue.undestroy,d.prototype._destroy=function(e,t){t(e)},d.prototype.push=function(e,t){var r,a=this._readableState;return a.objectMode?r=!0:typeof e=="string"&&(t=t||a.defaultEncoding,t!==a.encoding&&(e=K.from(e,t),t=""),r=!0),o(this,e,t,!1,r)},d.prototype.unshift=function(e){return o(this,e,null,!0,!1)},d.prototype.isPaused=function(){return this._readableState.flowing===!1},d.prototype.setEncoding=function(e){se||(se=m("string_decoder/").StringDecoder);var t=new se(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,a="";r!==null;)a+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),a!==""&&this._readableState.buffer.push(a),this._readableState.length=a.length,this},d.prototype.read=function(e){F("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&((t.highWaterMark===0?0<t.length:t.length>=t.highWaterMark)||t.ended))return F("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?q(this):c(this),null;if(e=U(e,t),e===0&&t.ended)return t.length===0&&q(this),null;var a=t.needReadable;F("need readable",a),(t.length===0||t.length-e<t.highWaterMark)&&(a=!0,F("length less than watermark",a)),t.ended||t.reading?(a=!1,F("reading or ended",a)):a&&(F("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,!t.reading&&(e=U(r,t)));var E;return E=0<e?j(e,t):null,E===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),t.length===0&&(!t.ended&&(t.needReadable=!0),r!==e&&t.ended&&q(this)),E!==null&&this.emit("data",E),E},d.prototype._read=function(){B(this,new k("_read()"))},d.prototype.pipe=function(e,t){function r(_e,we){F("onunpipe"),_e===Y&&we&&we.hasUnpiped===!1&&(we.hasUnpiped=!0,E())}function a(){F("onend"),e.end()}function E(){F("cleanup"),e.removeListener("close",W),e.removeListener("finish",J),e.removeListener("drain",be),e.removeListener("error",P),e.removeListener("unpipe",r),Y.removeListener("end",a),Y.removeListener("end",G),Y.removeListener("data",R),ft=!0,z.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&be()}function R(_e){F("ondata");var we=e.write(_e);F("dest.write",we),we===!1&&((z.pipesCount===1&&z.pipes===e||1<z.pipesCount&&X(z.pipes,e)!==-1)&&!ft&&(F("false write response, pause",z.awaitDrain),z.awaitDrain++),Y.pause())}function P(_e){F("onerror",_e),G(),e.removeListener("error",P),le(e,"error")===0&&B(e,_e)}function W(){e.removeListener("finish",J),G()}function J(){F("onfinish"),e.removeListener("close",W),G()}function G(){F("unpipe"),Y.unpipe(e)}var Y=this,z=this._readableState;switch(z.pipesCount){case 0:z.pipes=e;break;case 1:z.pipes=[z.pipes,e];break;default:z.pipes.push(e)}z.pipesCount+=1,F("pipe count=%d opts=%j",z.pipesCount,t);var me=(!t||t.end!==!1)&&e!==p.stdout&&e!==p.stderr,Ae=me?a:G;z.endEmitted?p.nextTick(Ae):Y.once("end",Ae),e.on("unpipe",r);var be=w(Y);e.on("drain",be);var ft=!1;return Y.on("data",R),n(e,"error",P),e.once("close",W),e.once("finish",J),e.emit("pipe",Y),z.flowing||(F("pipe resume"),Y.resume()),e},d.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var a=t.pipes,E=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var R=0;R<E;R++)a[R].emit("unpipe",this,{hasUnpiped:!1});return this}var P=X(t.pipes,e);return P===-1?this:(t.pipes.splice(P,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)},d.prototype.on=function(e,t){var r=ce.prototype.on.call(this,e,t),a=this._readableState;return e==="data"?(a.readableListening=0<this.listenerCount("readable"),a.flowing!==!1&&this.resume()):e=="readable"&&!a.endEmitted&&!a.readableListening&&(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,F("on readable",a.length,a.reading),a.length?c(this):!a.reading&&p.nextTick(f,this)),r},d.prototype.addListener=d.prototype.on,d.prototype.removeListener=function(e,t){var r=ce.prototype.removeListener.call(this,e,t);return e==="readable"&&p.nextTick(N,this),r},d.prototype.removeAllListeners=function(e){var t=ce.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&p.nextTick(N,this),t},d.prototype.resume=function(){var e=this._readableState;return e.flowing||(F("resume"),e.flowing=!e.readableListening,y(this,e)),e.paused=!1,this},d.prototype.pause=function(){return F("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(F("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},d.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var E in e.on("end",function(){if(F("wrapped end"),r.decoder&&!r.ended){var P=r.decoder.end();P&&P.length&&t.push(P)}t.push(null)}),e.on("data",function(P){if(F("wrapped data"),r.decoder&&(P=r.decoder.write(P)),!(r.objectMode&&P==null)&&(r.objectMode||P&&P.length)){var W=t.push(P);W||(a=!0,e.pause())}}),e)this[E]===void 0&&typeof e[E]=="function"&&(this[E]=(function(P){return function(){return e[P].apply(e,arguments)}})(E));for(var R=0;R<V.length;R++)e.on(V[R],this.emit.bind(this,V[R]));return this._read=function(P){F("wrapped _read",P),a&&(a=!1,e.resume())},this},typeof Symbol=="function"&&(d.prototype[Symbol.asyncIterator]=function(){return de===void 0&&(de=m("./internal/streams/async_iterator")),de(this)}),Object.defineProperty(d.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(d.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(d.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),d._fromList=j,Object.defineProperty(d.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(d.from=function(e,t){return ge===void 0&&(ge=m("./internal/streams/from")),ge(d,e,t)})}).call(this)}).call(this,m("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/async_iterator":21,"./internal/streams/buffer_list":22,"./internal/streams/destroy":23,"./internal/streams/from":25,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,events:7,inherits:10,"string_decoder/":31,util:2}],19:[function(m,T){"use strict";function p(A,U){var i=this._transformState;i.transforming=!1;var c=i.writecb;if(c===null)return this.emit("error",new d);i.writechunk=null,i.writecb=null,U!=null&&this.push(U),c(A);var u=this._readableState;u.reading=!1,(u.needReadable||u.length<u.highWaterMark)&&this._read(u.highWaterMark)}function s(A){return this instanceof s?(C.call(this,A),this._transformState={afterTransform:p.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,A&&(typeof A.transform=="function"&&(this._transform=A.transform),typeof A.flush=="function"&&(this._flush=A.flush)),void this.on("prefinish",v)):new s(A)}function v(){var A=this;typeof this._flush!="function"||this._readableState.destroyed?L(this,null,null):this._flush(function(U,i){L(A,U,i)})}function L(A,U,i){if(U)return A.emit("error",U);if(i!=null&&A.push(i),A._writableState.length)throw new _;if(A._transformState.transforming)throw new o;return A.push(null)}T.exports=s;var n=m("../errors").codes,l=n.ERR_METHOD_NOT_IMPLEMENTED,d=n.ERR_MULTIPLE_CALLBACK,o=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,_=n.ERR_TRANSFORM_WITH_LENGTH_0,C=m("./_stream_duplex");m("inherits")(s,C),s.prototype.push=function(A,U){return this._transformState.needTransform=!1,C.prototype.push.call(this,A,U)},s.prototype._transform=function(A,U,i){i(new l("_transform()"))},s.prototype._write=function(A,U,i){var c=this._transformState;if(c.writecb=i,c.writechunk=A,c.writeencoding=U,!c.transforming){var u=this._readableState;(c.needTransform||u.needReadable||u.length<u.highWaterMark)&&this._read(u.highWaterMark)}},s.prototype._read=function(){var A=this._transformState;A.writechunk===null||A.transforming?A.needTransform=!0:(A.transforming=!0,this._transform(A.writechunk,A.writeencoding,A.afterTransform))},s.prototype._destroy=function(A,U){C.prototype._destroy.call(this,A,function(i){U(i)})}},{"../errors":15,"./_stream_duplex":16,inherits:10}],20:[function(m,T){(function(p,s){(function(){"use strict";function v(b){var k=this;this.next=null,this.entry=null,this.finish=function(){q(k,b)}}function L(b){return F.from(b)}function n(b){return F.isBuffer(b)||b instanceof Ie}function l(){}function d(b,k,D){H=H||m("./_stream_duplex"),b=b||{},typeof D!="boolean"&&(D=k instanceof H),this.objectMode=!!b.objectMode,D&&(this.objectMode=this.objectMode||!!b.writableObjectMode),this.highWaterMark=K(this,b,"writableHighWaterMark",D),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var B=b.decodeStrings===!1;this.decodeStrings=!B,this.defaultEncoding=b.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(V){g(k,V)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=b.emitClose!==!1,this.autoDestroy=!!b.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new v(this)}function o(b){H=H||m("./_stream_duplex");var k=this instanceof H;return k||oe.call(o,this)?(this._writableState=new d(b,this,k),this.writable=!0,b&&(typeof b.write=="function"&&(this._write=b.write),typeof b.writev=="function"&&(this._writev=b.writev),typeof b.destroy=="function"&&(this._destroy=b.destroy),typeof b.final=="function"&&(this._final=b.final)),void ee.call(this)):new o(b)}function _(b,k){var D=new Re;te(b,D),p.nextTick(k,D)}function C(b,k,D,B){var V;return D===null?V=new ue:typeof D!="string"&&!k.objectMode&&(V=new he("chunk",["string","Buffer"],D)),!V||(te(b,V),p.nextTick(B,V),!1)}function A(b,k,D){return b.objectMode||b.decodeStrings===!1||typeof k!="string"||(k=F.from(k,D)),k}function U(b,k,D,B,V,e){if(!D){var t=A(k,B,V);B!==t&&(D=!0,V="buffer",B=t)}var r=k.objectMode?1:B.length;k.length+=r;var a=k.length<k.highWaterMark;if(a||(k.needDrain=!0),k.writing||k.corked){var E=k.lastBufferedRequest;k.lastBufferedRequest={chunk:B,encoding:V,isBuf:D,callback:e,next:null},E?E.next=k.lastBufferedRequest:k.bufferedRequest=k.lastBufferedRequest,k.bufferedRequestCount+=1}else i(b,k,!1,r,B,V,e);return a}function i(b,k,D,B,V,e,t){k.writelen=B,k.writecb=t,k.writing=!0,k.sync=!0,k.destroyed?k.onwrite(new Se("write")):D?b._writev(V,k.onwrite):b._write(V,e,k.onwrite),k.sync=!1}function c(b,k,D,B,V){--k.pendingcb,D?(p.nextTick(V,B),p.nextTick(M,b,k),b._writableState.errorEmitted=!0,te(b,B)):(V(B),b._writableState.errorEmitted=!0,te(b,B),M(b,k))}function u(b){b.writing=!1,b.writecb=null,b.length-=b.writelen,b.writelen=0}function g(b,k){var D=b._writableState,B=D.sync,V=D.writecb;if(typeof V!="function")throw new de;if(u(D),k)c(b,D,B,k,V);else{var e=f(D)||b.destroyed;e||D.corked||D.bufferProcessing||!D.bufferedRequest||N(b,D),B?p.nextTick(h,b,D,e,V):h(b,D,e,V)}}function h(b,k,D,B){D||w(b,k),k.pendingcb--,B(),M(b,k)}function w(b,k){k.length===0&&k.needDrain&&(k.needDrain=!1,b.emit("drain"))}function N(b,k){k.bufferProcessing=!0;var D=k.bufferedRequest;if(b._writev&&D&&D.next){var B=k.bufferedRequestCount,V=Array(B),e=k.corkedRequestsFree;e.entry=D;for(var t=0,r=!0;D;)V[t]=D,D.isBuf||(r=!1),D=D.next,t+=1;V.allBuffers=r,i(b,k,!0,k.length,V,"",e.finish),k.pendingcb++,k.lastBufferedRequest=null,e.next?(k.corkedRequestsFree=e.next,e.next=null):k.corkedRequestsFree=new v(k),k.bufferedRequestCount=0}else{for(;D;){var a=D.chunk,E=D.encoding,R=D.callback,P=k.objectMode?1:a.length;if(i(b,k,!1,P,a,E,R),D=D.next,k.bufferedRequestCount--,k.writing)break}D===null&&(k.lastBufferedRequest=null)}k.bufferedRequest=D,k.bufferProcessing=!1}function f(b){return b.ending&&b.length===0&&b.bufferedRequest===null&&!b.finished&&!b.writing}function y(b,k){b._final(function(D){k.pendingcb--,D&&te(b,D),k.prefinished=!0,b.emit("prefinish"),M(b,k)})}function I(b,k){k.prefinished||k.finalCalled||(typeof b._final!="function"||k.destroyed?(k.prefinished=!0,b.emit("prefinish")):(k.pendingcb++,k.finalCalled=!0,p.nextTick(y,b,k)))}function M(b,k){var D=f(k);if(D&&(I(b,k),k.pendingcb===0&&(k.finished=!0,b.emit("finish"),k.autoDestroy))){var B=b._readableState;(!B||B.autoDestroy&&B.endEmitted)&&b.destroy()}return D}function j(b,k,D){k.ending=!0,M(b,k),D&&(k.finished?p.nextTick(D):b.once("finish",D)),k.ended=!0,b.writable=!1}function q(b,k,D){var B=b.entry;for(b.entry=null;B;){var V=B.callback;k.pendingcb--,V(D),B=B.next}k.corkedRequestsFree.next=b}T.exports=o;var H;o.WritableState=d;var X={deprecate:m("util-deprecate")},ee=m("./internal/streams/stream"),F=m("buffer").Buffer,Ie=s.Uint8Array||function(){},le=m("./internal/streams/destroy"),ce=m("./internal/streams/state"),K=ce.getHighWaterMark,$=m("../errors").codes,he=$.ERR_INVALID_ARG_TYPE,se=$.ERR_METHOD_NOT_IMPLEMENTED,de=$.ERR_MULTIPLE_CALLBACK,ge=$.ERR_STREAM_CANNOT_PIPE,Se=$.ERR_STREAM_DESTROYED,ue=$.ERR_STREAM_NULL_VALUES,Re=$.ERR_STREAM_WRITE_AFTER_END,Te=$.ERR_UNKNOWN_ENCODING,te=le.errorOrDestroy;m("inherits")(o,ee),d.prototype.getBuffer=function(){for(var b=this.bufferedRequest,k=[];b;)k.push(b),b=b.next;return k},(function(){try{Object.defineProperty(d.prototype,"buffer",{get:X.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var oe;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(oe=Function.prototype[Symbol.hasInstance],Object.defineProperty(o,Symbol.hasInstance,{value:function(b){return!!oe.call(this,b)||this===o&&b&&b._writableState instanceof d}})):oe=function(b){return b instanceof this},o.prototype.pipe=function(){te(this,new ge)},o.prototype.write=function(b,k,D){var B=this._writableState,V=!1,e=!B.objectMode&&n(b);return e&&!F.isBuffer(b)&&(b=L(b)),typeof k=="function"&&(D=k,k=null),e?k="buffer":!k&&(k=B.defaultEncoding),typeof D!="function"&&(D=l),B.ending?_(this,D):(e||C(this,B,b,D))&&(B.pendingcb++,V=U(this,B,e,b,k,D)),V},o.prototype.cork=function(){this._writableState.corked++},o.prototype.uncork=function(){var b=this._writableState;b.corked&&(b.corked--,!b.writing&&!b.corked&&!b.bufferProcessing&&b.bufferedRequest&&N(this,b))},o.prototype.setDefaultEncoding=function(b){if(typeof b=="string"&&(b=b.toLowerCase()),!(-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((b+"").toLowerCase())))throw new Te(b);return this._writableState.defaultEncoding=b,this},Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),o.prototype._write=function(b,k,D){D(new se("_write()"))},o.prototype._writev=null,o.prototype.end=function(b,k,D){var B=this._writableState;return typeof b=="function"?(D=b,b=null,k=null):typeof k=="function"&&(D=k,k=null),b!=null&&this.write(b,k),B.corked&&(B.corked=1,this.uncork()),B.ending||j(this,B,D),this},Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(b){this._writableState&&(this._writableState.destroyed=b)}}),o.prototype.destroy=le.destroy,o.prototype._undestroy=le.undestroy,o.prototype._destroy=function(b,k){k(b)}}).call(this)}).call(this,m("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/destroy":23,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,inherits:10,"util-deprecate":32}],21:[function(m,T){(function(p){(function(){"use strict";function s(w,N,f){return N in w?Object.defineProperty(w,N,{value:f,enumerable:!0,configurable:!0,writable:!0}):w[N]=f,w}function v(w,N){return{value:w,done:N}}function L(w){var N=w[_];if(N!==null){var f=w[u].read();f!==null&&(w[i]=null,w[_]=null,w[C]=null,N(v(f,!1)))}}function n(w){p.nextTick(L,w)}function l(w,N){return function(f,y){w.then(function(){return N[U]?void f(v(void 0,!0)):void N[c](f,y)},y)}}var d,o=m("./end-of-stream"),_=Symbol("lastResolve"),C=Symbol("lastReject"),A=Symbol("error"),U=Symbol("ended"),i=Symbol("lastPromise"),c=Symbol("handlePromise"),u=Symbol("stream"),g=Object.getPrototypeOf(function(){}),h=Object.setPrototypeOf((d={get stream(){return this[u]},next:function(){var w=this,N=this[A];if(N!==null)return Promise.reject(N);if(this[U])return Promise.resolve(v(void 0,!0));if(this[u].destroyed)return new Promise(function(M,j){p.nextTick(function(){w[A]?j(w[A]):M(v(void 0,!0))})});var f,y=this[i];if(y)f=new Promise(l(y,this));else{var I=this[u].read();if(I!==null)return Promise.resolve(v(I,!1));f=new Promise(this[c])}return this[i]=f,f}},s(d,Symbol.asyncIterator,function(){return this}),s(d,"return",function(){var w=this;return new Promise(function(N,f){w[u].destroy(null,function(y){return y?void f(y):void N(v(void 0,!0))})})}),d),g);T.exports=function(w){var N,f=Object.create(h,(N={},s(N,u,{value:w,writable:!0}),s(N,_,{value:null,writable:!0}),s(N,C,{value:null,writable:!0}),s(N,A,{value:null,writable:!0}),s(N,U,{value:w._readableState.endEmitted,writable:!0}),s(N,c,{value:function(y,I){var M=f[u].read();M?(f[i]=null,f[_]=null,f[C]=null,y(v(M,!1))):(f[_]=y,f[C]=I)},writable:!0}),N));return f[i]=null,o(w,function(y){if(y&&y.code!=="ERR_STREAM_PREMATURE_CLOSE"){var I=f[C];return I!==null&&(f[i]=null,f[_]=null,f[C]=null,I(y)),void(f[A]=y)}var M=f[_];M!==null&&(f[i]=null,f[_]=null,f[C]=null,M(v(void 0,!0))),f[U]=!0}),w.on("readable",n.bind(null,f)),f}}).call(this)}).call(this,m("_process"))},{"./end-of-stream":24,_process:12}],22:[function(m,T){"use strict";function p(i,c){var u=Object.keys(i);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(i);c&&(g=g.filter(function(h){return Object.getOwnPropertyDescriptor(i,h).enumerable})),u.push.apply(u,g)}return u}function s(i){for(var c,u=1;u<arguments.length;u++)c=arguments[u]==null?{}:arguments[u],u%2?p(Object(c),!0).forEach(function(g){v(i,g,c[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(c)):p(Object(c)).forEach(function(g){Object.defineProperty(i,g,Object.getOwnPropertyDescriptor(c,g))});return i}function v(i,c,u){return c in i?Object.defineProperty(i,c,{value:u,enumerable:!0,configurable:!0,writable:!0}):i[c]=u,i}function L(i,c){if(!(i instanceof c))throw new TypeError("Cannot call a class as a function")}function n(i,c){for(var u,g=0;g<c.length;g++)u=c[g],u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(i,u.key,u)}function l(i,c,u){return c&&n(i.prototype,c),u&&n(i,u),i}function d(i,c,u){_.prototype.copy.call(i,c,u)}var o=m("buffer"),_=o.Buffer,C=m("util"),A=C.inspect,U=A&&A.custom||"inspect";T.exports=(function(){function i(){L(this,i),this.head=null,this.tail=null,this.length=0}return l(i,[{key:"push",value:function(c){var u={data:c,next:null};0<this.length?this.tail.next=u:this.head=u,this.tail=u,++this.length}},{key:"unshift",value:function(c){var u={data:c,next:this.head};this.length===0&&(this.tail=u),this.head=u,++this.length}},{key:"shift",value:function(){if(this.length!==0){var c=this.head.data;return this.head=this.length===1?this.tail=null:this.head.next,--this.length,c}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(c){if(this.length===0)return"";for(var u=this.head,g=""+u.data;u=u.next;)g+=c+u.data;return g}},{key:"concat",value:function(c){if(this.length===0)return _.alloc(0);for(var u=_.allocUnsafe(c>>>0),g=this.head,h=0;g;)d(g.data,u,h),h+=g.data.length,g=g.next;return u}},{key:"consume",value:function(c,u){var g;return c<this.head.data.length?(g=this.head.data.slice(0,c),this.head.data=this.head.data.slice(c)):c===this.head.data.length?g=this.shift():g=u?this._getString(c):this._getBuffer(c),g}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(c){var u=this.head,g=1,h=u.data;for(c-=h.length;u=u.next;){var w=u.data,N=c>w.length?w.length:c;if(h+=N===w.length?w:w.slice(0,c),c-=N,c===0){N===w.length?(++g,this.head=u.next?u.next:this.tail=null):(this.head=u,u.data=w.slice(N));break}++g}return this.length-=g,h}},{key:"_getBuffer",value:function(c){var u=_.allocUnsafe(c),g=this.head,h=1;for(g.data.copy(u),c-=g.data.length;g=g.next;){var w=g.data,N=c>w.length?w.length:c;if(w.copy(u,u.length-c,0,N),c-=N,c===0){N===w.length?(++h,this.head=g.next?g.next:this.tail=null):(this.head=g,g.data=w.slice(N));break}++h}return this.length-=h,u}},{key:U,value:function(c,u){return A(this,s({},u,{depth:0,customInspect:!1}))}}]),i})()},{buffer:3,util:2}],23:[function(m,T){(function(p){(function(){"use strict";function s(n,l){L(n,l),v(n)}function v(n){n._writableState&&!n._writableState.emitClose||n._readableState&&!n._readableState.emitClose||n.emit("close")}function L(n,l){n.emit("error",l)}T.exports={destroy:function(n,l){var d=this,o=this._readableState&&this._readableState.destroyed,_=this._writableState&&this._writableState.destroyed;return o||_?(l?l(n):n&&(this._writableState?!this._writableState.errorEmitted&&(this._writableState.errorEmitted=!0,p.nextTick(L,this,n)):p.nextTick(L,this,n)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(n||null,function(C){!l&&C?d._writableState?d._writableState.errorEmitted?p.nextTick(v,d):(d._writableState.errorEmitted=!0,p.nextTick(s,d,C)):p.nextTick(s,d,C):l?(p.nextTick(v,d),l(C)):p.nextTick(v,d)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(n,l){var d=n._readableState,o=n._writableState;d&&d.autoDestroy||o&&o.autoDestroy?n.destroy(l):n.emit("error",l)}}}).call(this)}).call(this,m("_process"))},{_process:12}],24:[function(m,T){"use strict";function p(l){var d=!1;return function(){if(!d){d=!0;for(var o=arguments.length,_=Array(o),C=0;C<o;C++)_[C]=arguments[C];l.apply(this,_)}}}function s(){}function v(l){return l.setHeader&&typeof l.abort=="function"}function L(l,d,o){if(typeof d=="function")return L(l,null,d);d||(d={}),o=p(o||s);var _=d.readable||d.readable!==!1&&l.readable,C=d.writable||d.writable!==!1&&l.writable,A=function(){l.writable||i()},U=l._writableState&&l._writableState.finished,i=function(){C=!1,U=!0,_||o.call(l)},c=l._readableState&&l._readableState.endEmitted,u=function(){_=!1,c=!0,C||o.call(l)},g=function(N){o.call(l,N)},h=function(){var N;return _&&!c?(l._readableState&&l._readableState.ended||(N=new n),o.call(l,N)):C&&!U?(l._writableState&&l._writableState.ended||(N=new n),o.call(l,N)):void 0},w=function(){l.req.on("finish",i)};return v(l)?(l.on("complete",i),l.on("abort",h),l.req?w():l.on("request",w)):C&&!l._writableState&&(l.on("end",A),l.on("close",A)),l.on("end",u),l.on("finish",i),d.error!==!1&&l.on("error",g),l.on("close",h),function(){l.removeListener("complete",i),l.removeListener("abort",h),l.removeListener("request",w),l.req&&l.req.removeListener("finish",i),l.removeListener("end",A),l.removeListener("close",A),l.removeListener("finish",i),l.removeListener("end",u),l.removeListener("error",g),l.removeListener("close",h)}}var n=m("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;T.exports=L},{"../../../errors":15}],25:[function(m,T){T.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],26:[function(m,T){"use strict";function p(U){var i=!1;return function(){i||(i=!0,U.apply(void 0,arguments))}}function s(U){if(U)throw U}function v(U){return U.setHeader&&typeof U.abort=="function"}function L(U,i,c,u){u=p(u);var g=!1;U.on("close",function(){g=!0}),o===void 0&&(o=m("./end-of-stream")),o(U,{readable:i,writable:c},function(w){return w?u(w):(g=!0,void u())});var h=!1;return function(w){if(!g)return h?void 0:(h=!0,v(U)?U.abort():typeof U.destroy=="function"?U.destroy():void u(w||new A("pipe")))}}function n(U){U()}function l(U,i){return U.pipe(i)}function d(U){return U.length&&typeof U[U.length-1]=="function"?U.pop():s}var o,_=m("../../../errors").codes,C=_.ERR_MISSING_ARGS,A=_.ERR_STREAM_DESTROYED;T.exports=function(){for(var U=arguments.length,i=Array(U),c=0;c<U;c++)i[c]=arguments[c];var u=d(i);if(Array.isArray(i[0])&&(i=i[0]),2>i.length)throw new C("streams");var g,h=i.map(function(w,N){var f=N<i.length-1;return L(w,f,0<N,function(y){g||(g=y),y&&h.forEach(n),f||(h.forEach(n),u(g))})});return i.reduce(l)}},{"../../../errors":15,"./end-of-stream":24}],27:[function(m,T){"use strict";function p(v,L,n){return v.highWaterMark==null?L?v[n]:null:v.highWaterMark}var s=m("../../../errors").codes.ERR_INVALID_OPT_VALUE;T.exports={getHighWaterMark:function(v,L,n,l){var d=p(L,l,n);if(d!=null){if(!(isFinite(d)&&S(d)===d)||0>d){var o=l?n:"highWaterMark";throw new s(o,d)}return S(d)}return v.objectMode?16:16384}}},{"../../../errors":15}],28:[function(m,T){T.exports=m("events").EventEmitter},{events:7}],29:[function(m,T,p){p=T.exports=m("./lib/_stream_readable.js"),p.Stream=p,p.Readable=p,p.Writable=m("./lib/_stream_writable.js"),p.Duplex=m("./lib/_stream_duplex.js"),p.Transform=m("./lib/_stream_transform.js"),p.PassThrough=m("./lib/_stream_passthrough.js"),p.finished=m("./lib/internal/streams/end-of-stream.js"),p.pipeline=m("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":16,"./lib/_stream_passthrough.js":17,"./lib/_stream_readable.js":18,"./lib/_stream_transform.js":19,"./lib/_stream_writable.js":20,"./lib/internal/streams/end-of-stream.js":24,"./lib/internal/streams/pipeline.js":26}],30:[function(m,T,p){function s(l,d){for(var o in l)d[o]=l[o]}function v(l,d,o){return n(l,d,o)}var L=m("buffer"),n=L.Buffer;n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?T.exports=L:(s(L,p),p.Buffer=v),v.prototype=Object.create(n.prototype),s(n,v),v.from=function(l,d,o){if(typeof l=="number")throw new TypeError("Argument must not be a number");return n(l,d,o)},v.alloc=function(l,d,o){if(typeof l!="number")throw new TypeError("Argument must be a number");var _=n(l);return d===void 0?_.fill(0):typeof o=="string"?_.fill(d,o):_.fill(d),_},v.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return n(l)},v.allocUnsafeSlow=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return L.SlowBuffer(l)}},{buffer:3}],31:[function(m,T,p){"use strict";function s(h){if(!h)return"utf8";for(var w;;)switch(h){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return h;default:if(w)return;h=(""+h).toLowerCase(),w=!0}}function v(h){var w=s(h);if(typeof w!="string"&&(u.isEncoding===g||!g(h)))throw new Error("Unknown encoding: "+h);return w||h}function L(h){this.encoding=v(h);var w;switch(this.encoding){case"utf16le":this.text=_,this.end=C,w=4;break;case"utf8":this.fillLast=o,w=4;break;case"base64":this.text=A,this.end=U,w=3;break;default:return this.write=i,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=u.allocUnsafe(w)}function n(h){return 127>=h?0:h>>5==6?2:h>>4==14?3:h>>3==30?4:h>>6==2?-1:-2}function l(h,w,N){var f=w.length-1;if(f<N)return 0;var y=n(w[f]);return 0<=y?(0<y&&(h.lastNeed=y-1),y):--f<N||y===-2?0:(y=n(w[f]),0<=y?(0<y&&(h.lastNeed=y-2),y):--f<N||y===-2?0:(y=n(w[f]),0<=y?(0<y&&(y===2?y=0:h.lastNeed=y-3),y):0))}function d(h,w){if((192&w[0])!=128)return h.lastNeed=0,"\uFFFD";if(1<h.lastNeed&&1<w.length){if((192&w[1])!=128)return h.lastNeed=1,"\uFFFD";if(2<h.lastNeed&&2<w.length&&(192&w[2])!=128)return h.lastNeed=2,"\uFFFD"}}function o(h){var w=this.lastTotal-this.lastNeed,N=d(this,h,w);return N===void 0?this.lastNeed<=h.length?(h.copy(this.lastChar,w,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(h.copy(this.lastChar,w,0,h.length),void(this.lastNeed-=h.length)):N}function _(h,w){if((h.length-w)%2==0){var N=h.toString("utf16le",w);if(N){var f=N.charCodeAt(N.length-1);if(55296<=f&&56319>=f)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=h[h.length-2],this.lastChar[1]=h[h.length-1],N.slice(0,-1)}return N}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=h[h.length-1],h.toString("utf16le",w,h.length-1)}function C(h){var w=h&&h.length?this.write(h):"";if(this.lastNeed){var N=this.lastTotal-this.lastNeed;return w+this.lastChar.toString("utf16le",0,N)}return w}function A(h,w){var N=(h.length-w)%3;return N==0?h.toString("base64",w):(this.lastNeed=3-N,this.lastTotal=3,N==1?this.lastChar[0]=h[h.length-1]:(this.lastChar[0]=h[h.length-2],this.lastChar[1]=h[h.length-1]),h.toString("base64",w,h.length-N))}function U(h){var w=h&&h.length?this.write(h):"";return this.lastNeed?w+this.lastChar.toString("base64",0,3-this.lastNeed):w}function i(h){return h.toString(this.encoding)}function c(h){return h&&h.length?this.write(h):""}var u=m("safe-buffer").Buffer,g=u.isEncoding||function(h){switch(h=""+h,h&&h.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};p.StringDecoder=L,L.prototype.write=function(h){if(h.length===0)return"";var w,N;if(this.lastNeed){if(w=this.fillLast(h),w===void 0)return"";N=this.lastNeed,this.lastNeed=0}else N=0;return N<h.length?w?w+this.text(h,N):this.text(h,N):w||""},L.prototype.end=function(h){var w=h&&h.length?this.write(h):"";return this.lastNeed?w+"\uFFFD":w},L.prototype.text=function(h,w){var N=l(this,h,w);if(!this.lastNeed)return h.toString("utf8",w);this.lastTotal=N;var f=h.length-(N-this.lastNeed);return h.copy(this.lastChar,0,f),h.toString("utf8",w,f)},L.prototype.fillLast=function(h){return this.lastNeed<=h.length?(h.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(h.copy(this.lastChar,this.lastTotal-this.lastNeed,0,h.length),void(this.lastNeed-=h.length))}},{"safe-buffer":30}],32:[function(m,T){(function(p){(function(){function s(v){try{if(!p.localStorage)return!1}catch{return!1}var L=p.localStorage[v];return L!=null&&(L+"").toLowerCase()==="true"}T.exports=function(v,L){function n(){if(!l){if(s("throwDeprecation"))throw new Error(L);s("traceDeprecation")?console.trace(L):console.warn(L),l=!0}return v.apply(this,arguments)}if(s("noDeprecation"))return v;var l=!1;return n}}).call(this)}).call(this,typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],"/":[function(m,T){function p(U){return U.replace(/a=ice-options:trickle\s\n/g,"")}function s(U){console.warn(U)}let v=m("debug")("simple-peer"),L=m("get-browser-rtc"),n=m("randombytes"),l=m("readable-stream"),d=m("queue-microtask"),o=m("err-code"),{Buffer:_}=m("buffer"),C=65536;class A extends l.Duplex{constructor(i){if(i=Object.assign({allowHalfOpen:!1},i),super(i),this._id=n(4).toString("hex").slice(0,7),this._debug("new peer %o",i),this.channelName=i.initiator?i.channelName||n(20).toString("hex"):null,this.initiator=i.initiator||!1,this.channelConfig=i.channelConfig||A.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},A.config,i.config),this.offerOptions=i.offerOptions||{},this.answerOptions=i.answerOptions||{},this.sdpTransform=i.sdpTransform||(c=>c),this.streams=i.streams||(i.stream?[i.stream]:[]),this.trickle=i.trickle===void 0||i.trickle,this.allowHalfTrickle=i.allowHalfTrickle!==void 0&&i.allowHalfTrickle,this.iceCompleteTimeout=i.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=i.wrtc&&typeof i.wrtc=="object"?i.wrtc:L(),!this._wrtc)throw o(typeof window>"u"?new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(c){return void this.destroy(o(c,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc=typeof this._pc._peerConnectionId=="number",this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=c=>{this._onIceCandidate(c)},typeof this._pc.peerIdentity=="object"&&this._pc.peerIdentity.catch(c=>{this.destroy(o(c,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=c=>{this._setupData(c)},this.streams&&this.streams.forEach(c=>{this.addStream(c)}),this._pc.ontrack=c=>{this._onTrack(c)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&this._channel.readyState==="open"}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(i){if(!this.destroying){if(this.destroyed)throw o(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if(typeof i=="string")try{i=JSON.parse(i)}catch{i={}}this._debug("signal()"),i.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),i.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(i.transceiverRequest.kind,i.transceiverRequest.init)),i.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(i.candidate):this._pendingCandidates.push(i.candidate)),i.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(i)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(c=>{this._addIceCandidate(c)}),this._pendingCandidates=[],this._pc.remoteDescription.type==="offer"&&this._createAnswer())}).catch(c=>{this.destroy(o(c,"ERR_SET_REMOTE_DESCRIPTION"))}),i.sdp||i.candidate||i.renegotiate||i.transceiverRequest||this.destroy(o(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(i){let c=new this._wrtc.RTCIceCandidate(i);this._pc.addIceCandidate(c).catch(u=>{!c.address||c.address.endsWith(".local")?s("Ignoring unsupported ICE candidate."):this.destroy(o(u,"ERR_ADD_ICE_CANDIDATE"))})}send(i){if(!this.destroying){if(this.destroyed)throw o(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(i)}}addTransceiver(i,c){if(!this.destroying){if(this.destroyed)throw o(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(i,c),this._needsNegotiation()}catch(u){this.destroy(o(u,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:i,init:c}})}}addStream(i){if(!this.destroying){if(this.destroyed)throw o(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),i.getTracks().forEach(c=>{this.addTrack(c,i)})}}addTrack(i,c){if(this.destroying)return;if(this.destroyed)throw o(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");let u=this._senderMap.get(i)||new Map,g=u.get(c);if(!g)g=this._pc.addTrack(i,c),u.set(c,g),this._senderMap.set(i,u),this._needsNegotiation();else throw g.removed?o(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):o(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED")}replaceTrack(i,c,u){if(this.destroying)return;if(this.destroyed)throw o(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");let g=this._senderMap.get(i),h=g?g.get(u):null;if(!h)throw o(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");c&&this._senderMap.set(c,g),h.replaceTrack==null?this.destroy(o(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK")):h.replaceTrack(c)}removeTrack(i,c){if(this.destroying)return;if(this.destroyed)throw o(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");let u=this._senderMap.get(i),g=u?u.get(c):null;if(!g)throw o(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{g.removed=!0,this._pc.removeTrack(g)}catch(h){h.name==="NS_ERROR_UNEXPECTED"?this._sendersAwaitingStable.push(g):this.destroy(o(h,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(i){if(!this.destroying){if(this.destroyed)throw o(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),i.getTracks().forEach(c=>{this.removeTrack(c,i)})}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,d(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw o(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(i){this._destroy(i,()=>{})}_destroy(i,c){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",i&&(i.message||i)),d(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",i&&(i.message||i)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch{}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch{}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,i&&this.emit("error",i),this.emit("close"),c()}))}_setupData(i){if(!i.channel)return this.destroy(o(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=i.channel,this._channel.binaryType="arraybuffer",typeof this._channel.bufferedAmountLowThreshold=="number"&&(this._channel.bufferedAmountLowThreshold=C),this.channelName=this._channel.label,this._channel.onmessage=u=>{this._onChannelMessage(u)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=u=>{let g=u.error instanceof Error?u.error:new Error(`Datachannel error: ${u.message} ${u.filename}:${u.lineno}:${u.colno}`);this.destroy(o(g,"ERR_DATA_CHANNEL"))};let c=!1;this._closingInterval=setInterval(()=>{this._channel&&this._channel.readyState==="closing"?(c&&this._onChannelClose(),c=!0):c=!1},5e3)}_read(){}_write(i,c,u){if(this.destroyed)return u(o(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(i)}catch(g){return this.destroy(o(g,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>C?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=u):u(null)}else this._debug("write before connect"),this._chunk=i,this._cb=u}_onFinish(){if(!this.destroyed){let i=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?i():this.once("connect",i)}}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(i=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(i.sdp=p(i.sdp)),i.sdp=this.sdpTransform(i.sdp);let c=()=>{if(!this.destroyed){let u=this._pc.localDescription||i;this._debug("signal"),this.emit("signal",{type:u.type,sdp:u.sdp})}};this._pc.setLocalDescription(i).then(()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?c():this.once("_iceComplete",c))}).catch(u=>{this.destroy(o(u,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(i=>{this.destroy(o(i,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(i=>{i.mid||!i.sender.track||i.requested||(i.requested=!0,this.addTransceiver(i.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(i=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(i.sdp=p(i.sdp)),i.sdp=this.sdpTransform(i.sdp);let c=()=>{if(!this.destroyed){let u=this._pc.localDescription||i;this._debug("signal"),this.emit("signal",{type:u.type,sdp:u.sdp}),this.initiator||this._requestMissingTransceivers()}};this._pc.setLocalDescription(i).then(()=>{this.destroyed||(this.trickle||this._iceComplete?c():this.once("_iceComplete",c))}).catch(u=>{this.destroy(o(u,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(i=>{this.destroy(o(i,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||this._pc.connectionState==="failed"&&this.destroy(o(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;let i=this._pc.iceConnectionState,c=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",i,c),this.emit("iceStateChange",i,c),(i==="connected"||i==="completed")&&(this._pcReady=!0,this._maybeReady()),i==="failed"&&this.destroy(o(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),i==="closed"&&this.destroy(o(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(i){let c=u=>(Object.prototype.toString.call(u.values)==="[object Array]"&&u.values.forEach(g=>{Object.assign(u,g)}),u);this._pc.getStats.length===0||this._isReactNativeWebrtc?this._pc.getStats().then(u=>{let g=[];u.forEach(h=>{g.push(c(h))}),i(null,g)},u=>i(u)):0<this._pc.getStats.length?this._pc.getStats(u=>{if(this.destroyed)return;let g=[];u.result().forEach(h=>{let w={};h.names().forEach(N=>{w[N]=h.stat(N)}),w.id=h.id,w.type=h.type,w.timestamp=h.timestamp,g.push(c(w))}),i(null,g)},u=>i(u)):i(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;let i=()=>{this.destroyed||this.getStats((c,u)=>{if(this.destroyed)return;c&&(u=[]);let g={},h={},w={},N=!1;u.forEach(y=>{(y.type==="remotecandidate"||y.type==="remote-candidate")&&(g[y.id]=y),(y.type==="localcandidate"||y.type==="local-candidate")&&(h[y.id]=y),(y.type==="candidatepair"||y.type==="candidate-pair")&&(w[y.id]=y)});let f=y=>{N=!0;let I=h[y.localCandidateId];I&&(I.ip||I.address)?(this.localAddress=I.ip||I.address,this.localPort=+I.port):I&&I.ipAddress?(this.localAddress=I.ipAddress,this.localPort=+I.portNumber):typeof y.googLocalAddress=="string"&&(I=y.googLocalAddress.split(":"),this.localAddress=I[0],this.localPort=+I[1]),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let M=g[y.remoteCandidateId];M&&(M.ip||M.address)?(this.remoteAddress=M.ip||M.address,this.remotePort=+M.port):M&&M.ipAddress?(this.remoteAddress=M.ipAddress,this.remotePort=+M.portNumber):typeof y.googRemoteAddress=="string"&&(M=y.googRemoteAddress.split(":"),this.remoteAddress=M[0],this.remotePort=+M[1]),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(u.forEach(y=>{y.type==="transport"&&y.selectedCandidatePairId&&f(w[y.selectedCandidatePairId]),(y.type==="googCandidatePair"&&y.googActiveConnection==="true"||(y.type==="candidatepair"||y.type==="candidate-pair")&&y.selected)&&f(y)}),!N&&(!Object.keys(w).length||Object.keys(h).length))return void setTimeout(i,100);if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(I){return this.destroy(o(I,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');let y=this._cb;this._cb=null,y(null)}typeof this._channel.bufferedAmountLowThreshold!="number"&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")})};i()}_onInterval(){this._cb&&this._channel&&!(this._channel.bufferedAmount>C)&&this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(this._pc.signalingState==="stable"&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(i=>{this._pc.removeTrack(i),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(i){this.destroyed||(i.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:i.candidate.candidate,sdpMLineIndex:i.candidate.sdpMLineIndex,sdpMid:i.candidate.sdpMid}}):!i.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),i.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(i){if(this.destroyed)return;let c=i.data;c instanceof ArrayBuffer&&(c=_.from(c)),this.push(c)}_onChannelBufferedAmountLow(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);let i=this._cb;this._cb=null,i(null)}}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(i){this.destroyed||i.streams.forEach(c=>{this._debug("on track"),this.emit("track",i.track,c),this._remoteTracks.push({track:i.track,stream:c}),this._remoteStreams.some(u=>u.id===c.id)||(this._remoteStreams.push(c),d(()=>{this._debug("on stream"),this.emit("stream",c)}))})}_debug(){let i=[].slice.call(arguments);i[0]="["+this._id+"] "+i[0],v.apply(null,i)}}A.WEBRTC_SUPPORT=!!L(),A.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},A.channelConfig={},T.exports=A},{buffer:3,debug:4,"err-code":6,"get-browser-rtc":8,"queue-microtask":13,randombytes:14,"readable-stream":29}]},{},[])("/")})});var cr=1200,ur=2500,qe=3e4,Qe=S=>{if(S.shouldConnect&&S.ws===null){let O=new WebSocket(S.url),x=S.binaryType,m=null;x&&(O.binaryType=x),S.ws=O,S.connecting=!0,S.connected=!1,O.onmessage=s=>{S.lastMessageReceived=Be();let v=s.data,L=typeof v=="string"?JSON.parse(v):v;L&&L.type==="pong"&&(clearTimeout(m),m=setTimeout(p,qe/2)),S.emit("message",[L,S])};let T=s=>{S.ws!==null&&(S.ws=null,S.connecting=!1,S.connected?(S.connected=!1,S.emit("disconnect",[{type:"disconnect",error:s},S])):S.unsuccessfulReconnects++,setTimeout(Qe,_t(bt(S.unsuccessfulReconnects+1)*cr,ur),S)),clearTimeout(m)},p=()=>{S.ws===O&&S.send({type:"ping"})};O.onclose=()=>T(null),O.onerror=s=>T(s),O.onopen=()=>{S.lastMessageReceived=Be(),S.connecting=!1,S.connected=!0,S.unsuccessfulReconnects=0,S.emit("connect",[{type:"connect"},S]),m=setTimeout(p,qe/2)}}},Ve=class extends yt{constructor(O,{binaryType:x}={}){super(),this.url=O,this.ws=null,this.binaryType=x||null,this.connected=!1,this.connecting=!1,this.unsuccessfulReconnects=0,this.lastMessageReceived=0,this.shouldConnect=!0,this._checkInterval=setInterval(()=>{this.connected&&qe<Be()-this.lastMessageReceived&&this.ws.close()},qe/2),Qe(this)}send(O){this.ws&&this.ws.send(JSON.stringify(O))}destroy(){clearInterval(this._checkInterval),this.disconnect(),super.destroy()}disconnect(){this.shouldConnect=!1,this.ws!==null&&this.ws.close()}connect(){this.shouldConnect=!0,!this.connected&&this.ws===null&&Qe(this)}};var Mt=new Map,Ze=class{constructor(O){this.room=O,this.onmessage=null,this._onChange=x=>x.key===O&&this.onmessage!==null&&this.onmessage({data:je(x.newValue||"")}),At(this._onChange)}postMessage(O){Tt.setItem(this.room,Fe(Ot(O)))}close(){kt(this._onChange)}},fr=typeof BroadcastChannel>"u"?Ze:BroadcastChannel,et=S=>ve(Mt,S,()=>{let O=pt(),x=new fr(S);return x.onmessage=m=>O.forEach(T=>T(m.data,"broadcastchannel")),{bc:x,subs:O}}),Bt=(S,O)=>(et(S).subs.add(O),O),Ft=(S,O)=>{let x=et(S),m=x.subs.delete(O);return m&&x.subs.size===0&&(x.bc.close(),Mt.delete(S)),m},jt=(S,O,x=null)=>{let m=et(S);m.bc.postMessage(O),m.subs.forEach(T=>T(O,x))};var er=or(Vt(),1);var We=0,He=1,Yt=2,rt=(S,O)=>{Q(S,We);let x=Nt(O);ie(S,x)},nt=(S,O,x)=>{Q(S,He),ie(S,Ut(O,x))},gr=(S,O,x)=>nt(O,x,fe(S)),zt=(S,O,x,m)=>{try{xt(O,fe(S),x)}catch(T){m?.(T),console.error("Caught error while handling a Yjs update",T)}},Gt=(S,O)=>{Q(S,Yt),ie(S,O)},yr=zt,Kt=(S,O,x,m,T)=>{let p=Pe(S);switch(p){case We:gr(S,O,x);break;case He:zt(S,x,m,T);break;case Yt:yr(S,x,m,T);break;default:throw new Error("Unknown message type")}return p};var $t=(S,O)=>{let x=Ge(S).buffer,m=Ge(O).buffer;return crypto.subtle.importKey("raw",x,"PBKDF2",!1,["deriveKey"]).then(T=>crypto.subtle.deriveKey({name:"PBKDF2",salt:m,iterations:1e5,hash:"SHA-256"},T,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]))},it=(S,O)=>{if(!O)return xe(S);let x=crypto.getRandomValues(new Uint8Array(12));return crypto.subtle.encrypt({name:"AES-GCM",iv:x},O,S).then(m=>{let T=Z();return Oe(T,"AES-GCM"),ie(T,x),ie(T,new Uint8Array(m)),re(T)})},Jt=(S,O)=>{let x=Z();return wt(x,S),it(re(x),O)},st=(S,O)=>{if(!O)return xe(S);let x=Le(S);Me(x)!=="AES-GCM"&&Rt(De("Unknown encryption algorithm"));let T=fe(x),p=fe(x);return crypto.subtle.decrypt({name:"AES-GCM",iv:T},O,p).then(s=>new Uint8Array(s))},Xt=(S,O)=>st(S,O).then(x=>Et(Le(new Uint8Array(x))));var ne=Lt("y-webrtc"),Ce=0,tr=3,Ne=1,ht=4,Ye=new Map,ye=new Map,rr=S=>{let O=!0;S.webrtcConns.forEach(x=>{x.synced||(O=!1)}),(!O&&S.synced||O&&!S.synced)&&(S.synced=O,S.provider.emit("synced",[{synced:O}]),ne("synced ",ae,S.name,Ee," with all peers"))},nr=(S,O,x)=>{let m=Le(O),T=Z(),p=Pe(m);if(S===void 0)return null;let s=S.awareness,v=S.doc,L=!1;switch(p){case Ce:{Q(T,Ce);let n=Kt(m,T,v,S);n===He&&!S.synced&&x(),n===We&&(L=!0);break}case tr:Q(T,Ne),ie(T,Ue(s,Array.from(s.getStates().keys()))),L=!0;break;case Ne:Pt(s,fe(m),S);break;case ht:{let n=vt(m)===1,l=Me(m);if(l!==S.peerId&&(S.bcConns.has(l)&&!n||!S.bcConns.has(l)&&n)){let d=[],o=[];n?(S.bcConns.add(l),o.push(l)):(S.bcConns.delete(l),d.push(l)),S.provider.emit("peers",[{added:o,removed:d,webrtcPeers:Array.from(S.webrtcConns.keys()),bcPeers:Array.from(S.bcConns)}]),ir(S)}break}default:return console.error("Unable to compute message"),T}return L?T:null},vr=(S,O)=>{let x=S.room;return ne("received message from ",ae,S.remotePeerId,$e," (",x.name,")",Ee,Je),nr(x,O,()=>{S.synced=!0,ne("synced ",ae,x.name,Ee," with ",ae,S.remotePeerId),rr(x)})},ot=(S,O)=>{ne("send message to ",ae,S.remotePeerId,Ee,$e," (",S.room.name,")",Je);try{S.peer.send(re(O))}catch{}},Er=(S,O)=>{ne("broadcast message in ",ae,S.name,Ee),S.webrtcConns.forEach(x=>{try{x.peer.send(O)}catch{}})},ze=class{constructor(O,x,m,T){ne("establishing connection to ",ae,m),this.room=T,this.remotePeerId=m,this.glareToken=void 0,this.closed=!1,this.connected=!1,this.synced=!1,this.peer=new er.default({initiator:x,...T.provider.peerOpts}),this.peer.on("signal",p=>{this.glareToken===void 0&&(this.glareToken=Date.now()+Math.random()),dt(O,T,{to:m,from:T.peerId,type:"signal",token:this.glareToken,signal:p})}),this.peer.on("connect",()=>{ne("connected to ",ae,m),this.connected=!0;let s=T.provider.doc,v=T.awareness,L=Z();Q(L,Ce),rt(L,s),ot(this,L);let n=v.getStates();if(n.size>0){let l=Z();Q(l,Ne),ie(l,Ue(v,Array.from(n.keys()))),ot(this,l)}}),this.peer.on("close",()=>{this.connected=!1,this.closed=!0,T.webrtcConns.has(this.remotePeerId)&&(T.webrtcConns.delete(this.remotePeerId),T.provider.emit("peers",[{removed:[this.remotePeerId],added:[],webrtcPeers:Array.from(T.webrtcConns.keys()),bcPeers:Array.from(T.bcConns)}])),rr(T),this.peer.destroy(),ne("closed connection to ",ae,m),ct(T)}),this.peer.on("error",p=>{ne("Error in connection to ",ae,m,": ",p),ct(T)}),this.peer.on("data",p=>{let s=vr(this,p);s!==null&&ot(this,s)})}destroy(){this.peer.destroy()}},pe=(S,O)=>it(O,S.key).then(x=>S.mux(()=>jt(S.name,x))),Qt=(S,O)=>{S.bcconnected&&pe(S,O),Er(S,O)},ct=S=>{Ye.forEach(O=>{O.connected&&(O.send({type:"subscribe",topics:[S.name]}),S.webrtcConns.size<S.provider.maxConns&&dt(O,S,{type:"announce",from:S.peerId}))})},ir=S=>{if(S.provider.filterBcConns){let O=Z();Q(O,ht),Ke(O,1),Oe(O,S.peerId),pe(S,re(O))}},ut=class{constructor(O,x,m,T){this.peerId=St(),this.doc=O,this.awareness=x.awareness,this.provider=x,this.synced=!1,this.name=m,this.key=T,this.webrtcConns=new Map,this.bcConns=new Set,this.mux=It(),this.bcconnected=!1,this._bcSubscriber=p=>st(new Uint8Array(p),T).then(s=>this.mux(()=>{let v=nr(this,s,()=>{});v&&pe(this,re(v))})),this._docUpdateHandler=(p,s)=>{let v=Z();Q(v,Ce),Gt(v,p),Qt(this,re(v))},this._awarenessUpdateHandler=({added:p,updated:s,removed:v},L)=>{let n=p.concat(s).concat(v),l=Z();Q(l,Ne),ie(l,Ue(this.awareness,n)),Qt(this,re(l))},this._beforeUnloadHandler=()=>{Xe(this.awareness,[O.clientID],"window unload"),ye.forEach(p=>{p.disconnect()})},typeof window<"u"?window.addEventListener("beforeunload",this._beforeUnloadHandler):typeof process<"u"&&process.on("exit",this._beforeUnloadHandler)}connect(){this.doc.on("update",this._docUpdateHandler),this.awareness.on("update",this._awarenessUpdateHandler),ct(this);let O=this.name;Bt(O,this._bcSubscriber),this.bcconnected=!0,ir(this);let x=Z();Q(x,Ce),rt(x,this.doc),pe(this,re(x));let m=Z();Q(m,Ce),nt(m,this.doc),pe(this,re(m));let T=Z();Q(T,tr),pe(this,re(T));let p=Z();Q(p,Ne),ie(p,Ue(this.awareness,[this.doc.clientID])),pe(this,re(p))}disconnect(){Ye.forEach(x=>{x.connected&&x.send({type:"unsubscribe",topics:[this.name]})}),Xe(this.awareness,[this.doc.clientID],"disconnect");let O=Z();Q(O,ht),Ke(O,0),Oe(O,this.peerId),pe(this,re(O)),Ft(this.name,this._bcSubscriber),this.bcconnected=!1,this.doc.off("update",this._docUpdateHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.webrtcConns.forEach(x=>x.destroy())}destroy(){this.disconnect(),typeof window<"u"?window.removeEventListener("beforeunload",this._beforeUnloadHandler):typeof process<"u"&&process.off("exit",this._beforeUnloadHandler)}},Cr=(S,O,x,m)=>{if(ye.has(x))throw De(`A Yjs Doc connected to room "${x}" already exists!`);let T=new ut(S,O,x,m);return ye.set(x,T),T},dt=(S,O,x)=>{O.key?Jt(x,O.key).then(m=>{S.send({type:"publish",topic:O.name,data:Fe(m)})}):S.send({type:"publish",topic:O.name,data:x})},lt=class extends Ve{constructor(O){super(O),this.providers=new Set,this.on("connect",()=>{ne(`connected (${O})`);let x=Array.from(ye.keys());this.send({type:"subscribe",topics:x}),ye.forEach(m=>dt(this,m,{type:"announce",from:m.peerId}))}),this.on("message",x=>{switch(x.type){case"publish":{let m=x.topic,T=ye.get(m);if(T==null||typeof m!="string")return;let p=s=>{let v=T.webrtcConns,L=T.peerId;if(s==null||s.from===L||s.to!==void 0&&s.to!==L||T.bcConns.has(s.from))return;let n=v.has(s.from)?()=>{}:()=>T.provider.emit("peers",[{removed:[],added:[s.from],webrtcPeers:Array.from(T.webrtcConns.keys()),bcPeers:Array.from(T.bcConns)}]);switch(s.type){case"announce":v.size<T.provider.maxConns&&(ve(v,s.from,()=>new ze(this,!0,s.from,T)),n());break;case"signal":if(s.signal.type==="offer"){let l=v.get(s.from);if(l){let d=s.token,o=l.glareToken;if(o&&o>d){ne("offer rejected: ",s.from);return}l.glareToken=void 0}}if(s.signal.type==="answer"){ne("offer answered by: ",s.from);let l=v.get(s.from);l.glareToken=void 0}s.to===L&&(ve(v,s.from,()=>new ze(this,!1,s.from,T)).peer.signal(s.signal),n());break}};T.key?typeof x.data=="string"&&Xt(je(x.data),T.key).then(p):p(x.data)}}}),this.on("disconnect",()=>ne(`disconnect (${O})`))}},at=S=>{S.emit("status",[{connected:S.connected}])},Zt=class extends gt{constructor(O,x,{signaling:m=["wss://y-webrtc-eu.fly.dev"],password:T=null,awareness:p=new Dt(x),maxConns:s=20+mt(Ct()*15),filterBcConns:v=!0,peerOpts:L={}}={}){super(),this.roomName=O,this.doc=x,this.filterBcConns=v,this.awareness=p,this.shouldConnect=!1,this.signalingUrls=m,this.signalingConns=[],this.maxConns=s,this.peerOpts=L,this.key=T?$t(T,O):xe(null),this.room=null,this.key.then(n=>{this.room=Cr(x,this,O,n),this.shouldConnect?this.room.connect():this.room.disconnect(),at(this)}),this.connect(),this.destroy=this.destroy.bind(this),x.on("destroy",this.destroy)}get connected(){return this.room!==null&&this.shouldConnect}connect(){this.shouldConnect=!0,this.signalingUrls.forEach(O=>{let x=ve(Ye,O,()=>new lt(O));this.signalingConns.push(x),x.providers.add(this)}),this.room&&(this.room.connect(),at(this))}disconnect(){this.shouldConnect=!1,this.signalingConns.forEach(O=>{O.providers.delete(this),O.providers.size===0&&(O.destroy(),Ye.delete(O.url))}),this.room&&(this.room.disconnect(),at(this))}destroy(){this.doc.off("destroy",this.destroy),this.key.then(()=>{this.room.destroy(),ye.delete(this.roomName)}),super.destroy()}};export{ut as Room,lt as SignalingConn,ze as WebrtcConn,Zt as WebrtcProvider};
@@ -0,0 +1 @@
1
+ import"./chunk-23NN352E.js";function t(e){for(var n={},r=e.split(" "),o=0;o<r.length;++o)n[r[o]]=!0;return n}var a=t("Assert BackQuote D Defun Deriv For ForEach FromFile FromString Function Integrate InverseTaylor Limit LocalSymbols Macro MacroRule MacroRulePattern NIntegrate Rule RulePattern Subst TD TExplicitSum TSum Taylor Taylor1 Taylor2 Taylor3 ToFile ToStdout ToString TraceRule Until While"),f="(?:(?:\\.\\d+|\\d+\\.\\d*|\\d+)(?:[eE][+-]?\\d+)?)",u="(?:[a-zA-Z\\$'][a-zA-Z0-9\\$']*)",p=new RegExp(f),d=new RegExp(u),k=new RegExp(u+"?_"+u),s=new RegExp(u+"\\s*\\(");function l(e,n){var r;if(r=e.next(),r==='"')return n.tokenize=v,n.tokenize(e,n);if(r==="/"){if(e.eat("*"))return n.tokenize=h,n.tokenize(e,n);if(e.eat("/"))return e.skipToEnd(),"comment"}e.backUp(1);var o=e.match(/^(\w+)\s*\(/,!1);o!==null&&a.hasOwnProperty(o[1])&&n.scopes.push("bodied");var i=c(n);if(i==="bodied"&&r==="["&&n.scopes.pop(),(r==="["||r==="{"||r==="(")&&n.scopes.push(r),i=c(n),(i==="["&&r==="]"||i==="{"&&r==="}"||i==="("&&r===")")&&n.scopes.pop(),r===";")for(;i==="bodied";)n.scopes.pop(),i=c(n);return e.match(/\d+ *#/,!0,!1)?"qualifier":e.match(p,!0,!1)?"number":e.match(k,!0,!1)?"variableName.special":e.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":e.match(s,!0,!1)?(e.backUp(1),"variableName.function"):e.match(d,!0,!1)?"variable":e.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%|#)/,!0,!1)?"operator":"error"}function v(e,n){for(var r,o=!1,i=!1;(r=e.next())!=null;){if(r==='"'&&!i){o=!0;break}i=!i&&r==="\\"}return o&&!i&&(n.tokenize=l),"string"}function h(e,n){for(var r,o;(o=e.next())!=null;){if(r==="*"&&o==="/"){n.tokenize=l;break}r=o}return"comment"}function c(e){var n=null;return e.scopes.length>0&&(n=e.scopes[e.scopes.length-1]),n}var b={name:"yacas",startState:function(){return{tokenize:l,scopes:[]}},token:function(e,n){return e.eatSpace()?null:n.tokenize(e,n)},indent:function(e,n,r){if(e.tokenize!==l&&e.tokenize!==null)return null;var o=0;return(n==="]"||n==="];"||n==="}"||n==="};"||n===");")&&(o=-1),(e.scopes.length+o)*r.unit},languageData:{electricInput:/[{}\[\]()\;]/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}}}};export{b as yacas};
@@ -0,0 +1 @@
1
+ import{$ as d,$a as da,Aa as E,Ab as Ea,Ba as F,Bb as Fa,Ca as G,Cb as Ga,Da as H,Db as Ha,Ea as I,Eb as Ia,Fa as J,Fb as Ja,Ga as K,Gb as Ka,Ha as L,Hb as La,Ia as M,Ib as Ma,Ja as N,Jb as Na,Ka as O,Kb as Oa,La as P,Lb as Pa,Ma as Q,Mb as Qa,Na as R,Nb as Ra,Oa as S,Ob as Sa,Pa as T,Pb as Ta,Qa as U,Qb as Ua,Ra as V,Rb as Va,Sa as W,Sb as Wa,Ta as X,Ua as Y,Va as Z,Wa as _,Xa as $,Y as a,Ya as aa,Z as b,Za as ba,_ as c,_a as ca,aa as e,ab as ea,ba as f,bb as fa,ca as g,cb as ga,da as h,db as ha,ea as i,eb as ia,fa as j,fb as ja,ga as k,gb as ka,ha as l,hb as la,ia as m,ib as ma,ja as n,jb as na,ka as o,kb as oa,la as p,lb as pa,ma as q,mb as qa,na as r,nb as ra,oa as s,ob as sa,pa as t,pb as ta,qa as u,qb as ua,ra as v,rb as va,sa as w,sb as wa,ta as x,tb as xa,ua as y,ub as ya,va as z,vb as za,wa as A,wb as Aa,xa as B,xb as Ba,ya as C,yb as Ca,za as D,zb as Da}from"./chunk-E5R7FPWA.js";import"./chunk-23NN352E.js";export{E as AbsolutePosition,a as AbstractConnector,Ka as AbstractStruct,ua as AbstractType,za as Array,Sa as ContentAny,Ma as ContentBinary,Na as ContentDeleted,Oa as ContentDoc,Pa as ContentEmbed,Qa as ContentFormat,Ra as ContentJSON,Ta as ContentString,Ua as ContentType,h as Doc,La as GC,u as ID,Va as Item,Ba as Map,A as PermanentUserData,B as RelativePosition,Wa as Skip,K as Snapshot,Ea as Text,_ as Transaction,ba as UndoManager,i as UpdateDecoderV1,j as UpdateDecoderV2,k as UpdateEncoderV1,l as UpdateEncoderV2,Ga as XmlElement,Fa as XmlFragment,Ia as XmlHook,Ja as XmlText,ya as YArrayEvent,sa as YEvent,Aa as YMapEvent,Da as YTextEvent,Ha as YXmlEvent,p as applyUpdate,o as applyUpdateV2,Ca as cleanupYTextFormatting,v as compareIDs,J as compareRelativePositions,qa as convertUpdateFormatV1ToV2,ra as convertUpdateFormatV2ToV1,I as createAbsolutePositionFromRelativePosition,e as createDeleteSet,f as createDeleteSetFromStructStore,T as createDocFromSnapshot,w as createID,D as createRelativePositionFromJSON,F as createRelativePositionFromTypeIndex,Q as createSnapshot,H as decodeRelativePosition,P as decodeSnapshot,O as decodeSnapshotV2,s as decodeStateVector,ea as decodeUpdate,fa as decodeUpdateV2,na as diffUpdate,ma as diffUpdateV2,R as emptySnapshot,G as encodeRelativePosition,N as encodeSnapshot,M as encodeSnapshotV2,r as encodeStateAsUpdate,q as encodeStateAsUpdateV2,t as encodeStateVector,ia as encodeStateVectorFromUpdate,ha as encodeStateVectorFromUpdateV2,g as equalDeleteSets,L as equalSnapshots,W as findIndexSS,x as findRootTypeKey,X as getItem,Z as getItemCleanEnd,Y as getItemCleanStart,V as getState,ta as getTypeChildren,c as isDeleted,y as isParentOf,b as iterateDeletedStructs,z as logType,ca as logUpdate,da as logUpdateV2,d as mergeDeleteSets,ga as mergeUpdates,la as mergeUpdatesV2,oa as obfuscateUpdate,pa as obfuscateUpdateV2,ka as parseUpdateMeta,ja as parseUpdateMetaV2,n as readUpdate,m as readUpdateV2,C as relativePositionToJSON,S as snapshot,U as snapshotContainsUpdate,aa as transact,$ as tryGc,va as typeListToArraySnapshot,xa as typeMapGetAllSnapshot,wa as typeMapGetSnapshot};
@@ -0,0 +1 @@
1
+ import"./chunk-23NN352E.js";function o(t){var n,l;t?(n=/^(exx?|(ld|cp)([di]r?)?|[lp]ea|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|[de]i|halt|im|in([di]mr?|ir?|irx|2r?)|ot(dmr?|[id]rx|imr?)|out(0?|[di]r?|[di]2r?)|tst(io)?|slp)(\.([sl]?i)?[sl])?\b/i,l=/^(((call|j[pr]|rst|ret[in]?)(\.([sl]?i)?[sl])?)|(rs|st)mix)\b/i):(n=/^(exx?|(ld|cp|in)([di]r?)?|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|rst|[de]i|halt|im|ot[di]r|out[di]?)\b/i,l=/^(call|j[pr]|ret[in]?|b_?(call|jump))\b/i);var u=/^(af?|bc?|c|de?|e|hl?|l|i[xy]?|r|sp)\b/i,d=/^(n?[zc]|p[oe]?|m)\b/i,f=/^([hl][xy]|i[xy][hl]|slia|sll)\b/i,c=/^([\da-f]+h|[0-7]+o|[01]+b|\d+d?)\b/i;return{name:"z80",startState:function(){return{context:0}},token:function(e,r){if(e.column()||(r.context=0),e.eatSpace())return null;var i;if(e.eatWhile(/\w/))if(t&&e.eat(".")&&e.eatWhile(/\w/),i=e.current(),e.indentation()){if((r.context==1||r.context==4)&&u.test(i))return r.context=4,"variable";if(r.context==2&&d.test(i))return r.context=4,"variableName.special";if(n.test(i))return r.context=1,"keyword";if(l.test(i))return r.context=2,"keyword";if(r.context==4&&c.test(i))return"number";if(f.test(i))return"error"}else return e.match(c)?"number":null;else{if(e.eat(";"))return e.skipToEnd(),"comment";if(e.eat('"')){for(;(i=e.next())&&i!='"';)i=="\\"&&e.next();return"string"}else if(e.eat("'")){if(e.match(/\\?.'/))return"number"}else if(e.eat(".")||e.sol()&&e.eat("#")){if(r.context=5,e.eatWhile(/\w/))return"def"}else if(e.eat("$")){if(e.eatWhile(/[\da-f]/i))return"number"}else if(e.eat("%")){if(e.eatWhile(/[01]/))return"number"}else e.next()}return null}}}var a=o(!1),s=o(!0);export{s as ez80,a as z80};
package/docs/blocks.md CHANGED
@@ -9,10 +9,12 @@ Block navigation icons must use BaseUI's built-in Lucide icon component, for exa
9
9
  Blocks are not standalone runtime components. Paste the markup and load the normal BaseUI assets:
10
10
 
11
11
  ```html
12
- <link rel="stylesheet" href="/dist/baseui.min.css">
13
- <script src="/dist/baseui.min.js" defer></script>
12
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.min.css">
13
+ <script src="https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.min.js" defer></script>
14
14
  ```
15
15
 
16
+ `https://unpkg.com/@thebase/ui@latest/dist/...` mirrors the same files as an alternative CDN if jsDelivr is unreachable. Pin an exact version (e.g. `@0.0.4`) instead of `@latest` for production. Blocks are static markup, so they only need the static `b-ui` runtime above — see [Usage Guide](usage-guide.md) if the surrounding page is itself an Owl app and you'd rather compose the equivalent layout from [Pure Owl Components](owl-components.md).
17
+
16
18
  Use `b-block` to select the block style:
17
19
 
18
20
  ```html
@@ -1,8 +1,8 @@
1
1
  # Markdown
2
2
 
3
- Use `b-ui="markdown"` (or the pure Owl `Markdown` component) to render Markdown or mount an editable Markdown document. Read-only parsing uses the vendored `src/runtime/marked.min.js` (marked v15). Fenced ` ```mermaid ` code blocks render as inline SVG via `src/runtime/mermaid.esm.min.mjs`. Fenced ` ```base-ui ` code blocks render as a live BaseUI preview through the page's global static runtime (`window.BaseUI`, e.g. `dist/baseui.min.js`).
3
+ Use `b-ui="markdown"` (or the pure Owl `Markdown` component) to render Markdown or mount an editable Markdown document. Read-only parsing uses the vendored `src/runtime/marked/marked.min.js` (marked v15). Fenced ` ```mermaid ` code blocks render as inline SVG via `src/runtime/mermaid/mermaid.esm.min.mjs`. Fenced ` ```base-ui ` code blocks render as a live BaseUI preview through the page's global static runtime (`window.BaseUI`, e.g. `dist/baseui.min.js`).
4
4
 
5
- Editable mode lazy-loads `dist/runtime/milkdown-editor.js`, which bundles Milkdown, Yjs, and y-webrtc only when `b-att-editable="true"` / `editable="true"` is used. The editor runtime enables CommonMark, GFM, history, clipboard, cursor, listener, indent, upload, block handle, tooltip, slash, streaming, and diff plugins. Collaborative mode uses Milkdown's Yjs-aware collab undo/redo instead of the plain history stack.
5
+ Editable mode lazy-loads `dist/runtime/milkdown/milkdown-editor.js`, which bundles Milkdown, Yjs, and y-webrtc only when `b-att-editable="true"` / `editable="true"` is used. The editor runtime enables CommonMark, GFM, history, clipboard, cursor, listener, indent, upload, block handle, tooltip, slash, streaming, and diff plugins. Collaborative mode uses Milkdown's Yjs-aware collab undo/redo instead of the plain history stack.
6
6
 
7
7
  ## CDN install requirements
8
8
 
@@ -1,8 +1,8 @@
1
1
  # Text Editor
2
2
 
3
- Use `b-ui="text-editor"` (or the pure Owl `TextEditor` component) for WYSIWYG rich-text editing backed by ProseMirror. The editor runtime is lazy-loaded from `dist/runtime/prosemirror-text-editor.js`, so the default BaseUI bundle stays small until an editor is actually mounted.
3
+ Use `b-ui="text-editor"` (or the pure Owl `TextEditor` component) for WYSIWYG rich-text editing backed by [Milkdown](https://milkdown.dev/) (ProseMirror + a Markdown-aware schema, via `@milkdown/kit`). The editor runtime is lazy-loaded from `dist/runtime/milkdown/milkdown-text-editor.js`, so the default BaseUI bundle stays small until an editor is actually mounted. `content`/`onChange` still deal in HTML — Milkdown's document is converted to/from HTML at the boundary, so nothing in this contract changes even though the engine now understands Markdown natively (e.g. typing a leading `#`, `**bold**`, or `1.` auto-formats as you type).
4
4
 
5
- Collaborative mode uses Yjs, y-prosemirror, and y-webrtc. Use `room` / `b-att-room` to put editors in the same peer-to-peer document, `password` / `b-att-password` for y-webrtc room encryption, and `signaling` / `b-att-signaling` to override signaling servers.
5
+ Collaborative mode uses Yjs, `@milkdown/plugin-collab`, and y-webrtc. Use `room` / `b-att-room` to put editors in the same peer-to-peer document, `password` / `b-att-password` for y-webrtc room encryption, and `signaling` / `b-att-signaling` to override signaling servers.
6
6
 
7
7
  ## Pure Owl Component
8
8
 
@@ -61,10 +61,44 @@ Enable peer-to-peer collaborative editing with Yjs + y-webrtc:
61
61
 
62
62
  ## Events
63
63
 
64
- - `baseui:text-editor-ready` — fired after ProseMirror mounts (`detail.collaborative`, `detail.room`).
64
+ - `baseui:text-editor-ready` — fired after the Milkdown editor mounts (`detail.collaborative`, `detail.room`).
65
65
  - `baseui:text-editor-change` — fired whenever the rich-text document emits a new HTML string (`detail.html`, `detail.previousHtml`).
66
66
  - `baseui:text-editor-error` — fired when fetching or editor mounting fails (`detail.error`).
67
67
 
68
68
  ## Methods
69
69
 
70
70
  Use the global runtime methods: `BaseUI.mount()`, `BaseUI.mountAll()`, and `BaseUI.destroy()`.
71
+
72
+ ## Milkdown plugins included
73
+
74
+ Every editor instance registers the full set of official Milkdown plugins (`src/runtime/milkdown/milkdown-text-editor.js`), on top of the `preset-commonmark`/`preset-gfm` schema:
75
+
76
+ - `plugin-clipboard`, `plugin-cursor` (gap/drop cursor), `plugin-trailing` (always-present trailing paragraph), `plugin-listener` — editing-quality-of-life, no visible UI of their own.
77
+ - `plugin-history` (single-user undo/redo) or `plugin-collab` (Yjs-backed collaborative undo/redo, see below) — whichever applies to the current mode.
78
+ - `plugin-upload` — drag-and-drop or paste an image file and it's inserted inline as a base64 `data:` URL. No server/uploader configuration needed.
79
+ - `plugin-prism` — syntax highlighting for fenced code blocks (`refractor`, self-contained — JS/TS, Python, Go, Rust, SQL, YAML, JSON, Bash, and more out of the box).
80
+ - `@milkdown/plugin-emoji` — type `:smile:` and it's replaced with an inline Twemoji image (fetched from `cdn.jsdelivr.net` — requires network access for the glyph images).
81
+ - `plugin-tooltip` — a small floating hint appears on text selection (minimal placeholder today, matching the same level of integration already used by the `Markdown` component).
82
+ - `plugin-slash` — type `/` at the start of a line to open a filterable command menu (Paragraph, Heading 1/2, Quote, Bullet/Numbered list). Keep typing to filter, navigate with ArrowUp/ArrowDown, and pick with Enter/Tab/click; Escape dismisses it.
83
+ - `plugin-block` — hover a block to reveal a `::` drag handle at its left edge.
84
+ - `plugin-diff` / `plugin-streaming` — headless: no built-in UI, exposed on the mounted handle as `handle.diff` / `handle.streaming` (see below) for a host app to build review/AI-streaming UX on top of.
85
+
86
+ `@milkdown/plugin-indent` is intentionally **not** included — its Tab shortcut for inserting literal indentation conflicts with `preset-commonmark`'s own Tab/Shift-Tab list sink/lift keymap.
87
+
88
+ ## Programmatic diff review and streaming
89
+
90
+ The object returned by `mountTextEditorRuntime()` (and stored as `editorHandle` in `text-editor.component.js`/`text-editor.js`) exposes two extra namespaces beyond `focus()`/`getHTML()`/`setHTML()`/`destroy()`:
91
+
92
+ ```js
93
+ // Stage a suggested revision (e.g. from an LLM) and let the user accept/reject it.
94
+ await editorHandle.diff.startFromHTML("<p>Revised paragraph.</p>");
95
+ const pending = editorHandle.diff.getPendingChanges(); // render your own accept/reject UI from this
96
+ editorHandle.diff.acceptChunk(0); // or .rejectChunk(0), .acceptAll(), .clear()
97
+
98
+ // Type streamed tokens into the doc live (e.g. as an LLM response arrives).
99
+ editorHandle.streaming.start({ insertAt: "cursor" });
100
+ editorHandle.streaming.pushChunk("...next token...");
101
+ editorHandle.streaming.end(); // or .abort()
102
+ ```
103
+
104
+ Both plugins ship with no visual decoration of their own — `getPendingChanges()` returns plain data for you to render, and `streaming` just mutates the document as chunks arrive. `diff.startFromMarkdown(markdown)` is also available if you already have a Markdown string instead of HTML.
package/docs/icons.md CHANGED
@@ -18,10 +18,12 @@ BaseUI ships the full Lucide icon set as a built-in CDN-ready icon library. Icon
18
18
  Load the normal BaseUI assets. No separate icon script is required.
19
19
 
20
20
  ```html
21
- <link rel="stylesheet" href="/dist/baseui.min.css">
22
- <script src="/dist/baseui.min.js" defer></script>
21
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.min.css">
22
+ <script src="https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.min.js" defer></script>
23
23
  ```
24
24
 
25
+ `https://unpkg.com/@thebase/ui@latest/dist/...` mirrors the same files as an alternative CDN if jsDelivr is unreachable. Pin an exact version (e.g. `@0.0.4`) instead of `@latest` for production. `b-icon` also works with the [pure Owl `Icon` component](components/icon.md) — the recommended API in an Owl app; the classic script above is for pages using the static `b-ui` API.
26
+
25
27
  The build publishes every Lucide SVG to `dist/icons/lucide/` and writes the generated icon manifest to `dist/icons/lucide.json`.
26
28
 
27
29
  ## Markup
@@ -2,16 +2,48 @@
2
2
 
3
3
  See the [Usage Guide](usage-guide.md) for the end-to-end integration path (choosing an API, install, theming, verification). This page covers install mechanics only.
4
4
 
5
- BaseUI is distributed as one CSS file and one JavaScript file for browser use. `dist/baseui.min.js` is fully self-contained: Bootstrap's JS bundle (Popper.js included) and the Owl runtime are embedded ahead of BaseUI's own code, in load order (Bootstrap, then Owl, then BaseUI) — nothing else needs to load first.
5
+ BaseUI is distributed as one CSS file and one JavaScript file for browser use. `dist/baseui.min.js` is fully self-contained: Bootstrap's JS bundle (Popper.js included) and the Owl runtime are embedded ahead of BaseUI's own code, in load order (Bootstrap, then Owl, then BaseUI) — nothing else needs to load first. Both install paths below load this same file; the pure Owl component API is the recommended way to consume BaseUI in an Owl app, with the static `b-ui` markup API available as a lighter-weight alternative for non-Owl pages.
6
+
7
+ The snippets below use the `@latest` tag for readability. Pin an exact version instead (e.g. `@0.0.4`) for any production page — `@latest` can silently change what your page loads the moment a new version is published.
8
+
9
+ ## Pure Owl component install (recommended)
10
+
11
+ If you're building your own Owl app and want to import BaseUI components as real Owl component classes (`<Button/>`, `<Card/>`, `<Tabs/>`, ...) instead of `b-ui` markup, it's the same one file as the static install, just accessed through an import map:
12
+
13
+ ```html
14
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.min.css">
15
+ <script type="importmap">
16
+ {
17
+ "imports": {
18
+ "@base/owl": "https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.esm.js",
19
+ "@base/component": "https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.esm.js",
20
+ "@base/theme": "https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.esm.js",
21
+ "@base/templates": "https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.templates.xml"
22
+ }
23
+ }
24
+ </script>
25
+ ```
26
+
27
+ `https://unpkg.com/@thebase/ui@latest/dist/...` mirrors the same files if jsDelivr is unreachable — swap the host in each URL above.
28
+
29
+ `@base/owl`, `@base/component`, and `@base/theme` all resolve to the exact same `dist/baseui.esm.js` module — the browser fetches and evaluates it once, so `Component`/`mount`/`xml` from `@base/owl` and `Button`/`Card`/... from `@base/component` are guaranteed to be the same runtime identity (no separate script needs to load first to set up a shared global). Your own app code should still import Owl from `@base/owl`, never install or import `@odoo/owl` directly — that's what keeps a `class Root extends Component` you write instanceof-compatible with BaseUI's own components. `@base/templates` maps to the templates XML — not a JS module, so resolve it with `import.meta.resolve("@base/templates")` and `fetch()` the result rather than `import`ing it.
30
+
31
+ For npm/bundler usage, everything (Owl framework, component classes, theme helper) is exported from the one `@thebase/ui` package entry: `import { Component, mount, xml, Button, Card, createThemeController } from "@thebase/ui";` — plus `@thebase/ui/dist/baseui.templates.xml` (component templates — fetch or load them before mounting). Note that importing the main entry always runs its `autoMount()` side effect (it scans the DOM for `[b-ui]`/`[b-icon]` markers on `DOMContentLoaded`) — harmless if your page has none, but worth knowing if you specifically wanted a side-effect-free import.
32
+
33
+ See [Pure Owl Components](owl-components.md) for the full loading contract, a worked example, and common mistakes.
34
+
35
+ ## Static `b-ui` install (alternative)
36
+
37
+ For static HTML, a server-rendered page, or a Base HUB website page that has no Owl runtime of its own, load the same bundle as plain CSS + a classic `<script>` tag instead of an import map:
6
38
 
7
39
  ```html
8
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@thebase/ui@0.0.1/dist/baseui.min.css">
9
- <script src="https://cdn.jsdelivr.net/npm/@thebase/ui@0.0.1/dist/baseui.min.js" defer></script>
40
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.min.css">
41
+ <script src="https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.min.js" defer></script>
10
42
  ```
11
43
 
12
44
  Bootstrap 5 is the bundled baseline CSS framework, and its JS bundle now drives BaseUI's interactive components directly.
13
45
 
14
- `@thebase/ui` is published on npm, so [unpkg](https://unpkg.com/@thebase/ui@0.0.1/) mirrors the same files as an alternative CDN (`https://unpkg.com/@thebase/ui@0.0.1/dist/baseui.min.css` / `baseui.min.js`) if jsDelivr is unreachable in your environment.
46
+ `@thebase/ui` is published on npm, so [unpkg](https://unpkg.com/@thebase/ui@latest/) mirrors the same files as an alternative CDN (`https://unpkg.com/@thebase/ui@latest/dist/baseui.min.css` / `baseui.min.js`) if jsDelivr is unreachable in your environment. Pin an exact version (e.g. `@0.0.4`) instead of `@latest` for production.
15
47
 
16
48
  For npm/self-hosted usage:
17
49
 
@@ -52,27 +84,3 @@ Production pages should use pinned version URLs. `latest` is for demos and exper
52
84
  BaseUI intentionally keeps Bootstrap bundled for the browser build, both CSS and JS. Bootstrap's JS bundle and the Owl runtime are embedded directly into `dist/baseui.min.js`/`baseui.esm.js` — in that load order — along with every pure Owl component class and the theme helper, so both the static API and the pure Owl API install with one stylesheet and one script/import: there is no more separate `baseui.owl.*`/`baseui.components.esm.js`/`baseui.theme.esm.js` file to keep in load order. Bootstrap's JS instances (`bootstrap.Modal`, `Dropdown`, `Collapse`, `Tab`, `Toast`, `Carousel`, `Tooltip`, `Popover`, `Alert`) drive the components that map to them, wrapped by BaseUI's own `.behavior.js`/`runtime/*.js` helpers so both the static and pure-Owl APIs share identical ARIA/keyboard/event behavior.
53
85
 
54
86
  Release checks enforce runtime dependency, peer dependency, scoped CSS selector, and CDN file-size budgets through `npm run lint` and `npm run build`.
55
-
56
- ## Pure Owl component install
57
-
58
- If you're building your own Owl app and want to import BaseUI components as real Owl component classes (`<Button/>`, `<Card/>`, `<Tabs/>`, ...) instead of `b-ui` markup, it's the same one file as the static install, just accessed through an import map:
59
-
60
- ```html
61
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@thebase/ui@0.0.1/dist/baseui.min.css">
62
- <script type="importmap">
63
- {
64
- "imports": {
65
- "@base/owl": "https://cdn.jsdelivr.net/npm/@thebase/ui@0.0.1/dist/baseui.esm.js",
66
- "@base/component": "https://cdn.jsdelivr.net/npm/@thebase/ui@0.0.1/dist/baseui.esm.js",
67
- "@base/theme": "https://cdn.jsdelivr.net/npm/@thebase/ui@0.0.1/dist/baseui.esm.js",
68
- "@base/templates": "https://cdn.jsdelivr.net/npm/@thebase/ui@0.0.1/dist/baseui.templates.xml"
69
- }
70
- }
71
- </script>
72
- ```
73
-
74
- `@base/owl`, `@base/component`, and `@base/theme` all resolve to the exact same `dist/baseui.esm.js` module — the browser fetches and evaluates it once, so `Component`/`mount`/`xml` from `@base/owl` and `Button`/`Card`/... from `@base/component` are guaranteed to be the same runtime identity (no separate script needs to load first to set up a shared global). Your own app code should still import Owl from `@base/owl`, never install or import `@odoo/owl` directly — that's what keeps a `class Root extends Component` you write instanceof-compatible with BaseUI's own components. `@base/templates` maps to the templates XML — not a JS module, so resolve it with `import.meta.resolve("@base/templates")` and `fetch()` the result rather than `import`ing it.
75
-
76
- For npm/bundler usage, everything (Owl framework, component classes, theme helper) is exported from the one `@thebase/ui` package entry: `import { Component, mount, xml, Button, Card, createThemeController } from "@thebase/ui";` — plus `@thebase/ui/dist/baseui.templates.xml` (component templates — fetch or load them before mounting). Note that importing the main entry always runs its `autoMount()` side effect (it scans the DOM for `[b-ui]`/`[b-icon]` markers on `DOMContentLoaded`) — harmless if your page has none, but worth knowing if you specifically wanted a side-effect-free import.
77
-
78
- See [Pure Owl Components](owl-components.md) for the full loading contract, a worked example, and common mistakes.
@@ -21,14 +21,14 @@ Everything — the static `b-ui` runtime, the Owl framework, every pure Owl comp
21
21
  ## Browser (import map) usage
22
22
 
23
23
  ```html
24
- <link rel="stylesheet" href="/dist/baseui.min.css">
24
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.min.css">
25
25
  <script type="importmap">
26
26
  {
27
27
  "imports": {
28
- "@base/owl": "/dist/baseui.esm.js",
29
- "@base/component": "/dist/baseui.esm.js",
30
- "@base/theme": "/dist/baseui.esm.js",
31
- "@base/templates": "/dist/baseui.templates.xml"
28
+ "@base/owl": "https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.esm.js",
29
+ "@base/component": "https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.esm.js",
30
+ "@base/theme": "https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.esm.js",
31
+ "@base/templates": "https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.templates.xml"
32
32
  }
33
33
  }
34
34
  </script>
@@ -55,6 +55,8 @@ Everything — the static `b-ui` runtime, the Owl framework, every pure Owl comp
55
55
  </script>
56
56
  ```
57
57
 
58
+ `https://unpkg.com/@thebase/ui@latest/dist/...` mirrors the same files as an alternative CDN if jsDelivr is unreachable — swap the host in each URL above. For a self-hosted build, replace the CDN host with your own served path (e.g. `/dist/baseui.esm.js`). These snippets use `@latest` for readability; pin an exact version (e.g. `@0.0.4`) in production so a new release can't change what your page loads.
59
+
58
60
  No `@odoo/owl` import appears anywhere in that snippet — `@base/owl` is the only Owl entry point BaseUI components and consumer apps need. Because `@base/owl`, `@base/component`, and `@base/theme` all point at the exact same `dist/baseui.esm.js` URL, the browser fetches and evaluates it once and every key shares the same module instance — no separate classic `<script>` needs to load first to set up a shared global.
59
61
 
60
62
  ## npm / bundler usage
package/docs/theming.md CHANGED
@@ -21,7 +21,7 @@ For a reusable theme toggle with persistence, URL override, button-label sync, a
21
21
  <script type="importmap">
22
22
  {
23
23
  "imports": {
24
- "@base/theme": "/dist/baseui.esm.js"
24
+ "@base/theme": "https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.esm.js"
25
25
  }
26
26
  }
27
27
  </script>
@@ -38,7 +38,7 @@ For a reusable theme toggle with persistence, URL override, button-label sync, a
38
38
  </script>
39
39
  ```
40
40
 
41
- Npm/bundler consumers can import the same API from `@thebase/ui`.
41
+ `https://unpkg.com/@thebase/ui@latest/dist/baseui.esm.js` mirrors the same file as an alternative CDN if jsDelivr is unreachable. Pin an exact version (e.g. `@0.0.4`) instead of `@latest` for production. Npm/bundler consumers can import the same API from `@thebase/ui`.
42
42
 
43
43
  For a ready-made icon button, use the BaseUI component instead of wiring your own click handler:
44
44