@caspian2026/agent-sdk 0.0.19 → 0.0.20

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 (426) hide show
  1. package/dist/{chunk-ggg97179.js → chunk-09nzqj0f.js} +2927 -764
  2. package/dist/{chunk-c073acgz.js → chunk-0a8jb5c8.js} +9 -9
  3. package/dist/{chunk-b9t57m67.js → chunk-0b85d7q0.js} +7 -7
  4. package/dist/{chunk-py5ytxp4.js → chunk-0dwdg9bz.js} +9 -9
  5. package/dist/{chunk-yvvgfb9f.js → chunk-0f84wjjc.js} +79 -79
  6. package/dist/chunk-0fw1mz8s.js +27 -0
  7. package/dist/{chunk-kwekc97v.js → chunk-0pbwcm8b.js} +1 -1
  8. package/dist/chunk-0pqv68xt.js +133 -0
  9. package/dist/chunk-0pv13fxq.js +1684 -0
  10. package/dist/chunk-0tgn1431.js +38 -0
  11. package/dist/{chunk-bg4x9ex0.js → chunk-0tja7d1y.js} +6 -6
  12. package/dist/{chunk-t5jqejqk.js → chunk-0w2ntzwz.js} +92 -92
  13. package/dist/chunk-0yshjsxt.js +122 -0
  14. package/dist/chunk-0z9s957c.js +94 -0
  15. package/dist/{chunk-fyc5fepv.js → chunk-0zscb6c7.js} +1 -1
  16. package/dist/{chunk-x8d2ehd7.js → chunk-13pmg16e.js} +1 -1
  17. package/dist/{chunk-v4t6dyyh.js → chunk-15f7ee0j.js} +245 -158
  18. package/dist/{chunk-7yp1ra14.js → chunk-1ehn6qdp.js} +13 -13
  19. package/dist/chunk-1gt45dyg.js +101 -0
  20. package/dist/{chunk-bdb81673.js → chunk-1s9jxpjm.js} +7 -7
  21. package/dist/{chunk-3c25bcsw.js → chunk-1t3cyn1k.js} +1 -1
  22. package/dist/{chunk-v8twrmnw.js → chunk-1ycd7t0f.js} +88 -88
  23. package/dist/{chunk-t300xs2e.js → chunk-1ytng03p.js} +12 -12
  24. package/dist/{chunk-jqn60wdn.js → chunk-25jhz0br.js} +16 -16
  25. package/dist/{chunk-j03zh8dy.js → chunk-26kp0k1t.js} +79 -79
  26. package/dist/{chunk-6mqmk16a.js → chunk-2b00k9ep.js} +78 -78
  27. package/dist/{chunk-ywhmg8xp.js → chunk-2bh7f2wa.js} +13 -13
  28. package/dist/{chunk-eady4fzn.js → chunk-2bk4jvse.js} +7 -7
  29. package/dist/{chunk-0vkfrmqm.js → chunk-2mfzqkzn.js} +69 -29
  30. package/dist/{chunk-szj5wvdy.js → chunk-2qpy8kne.js} +1 -1
  31. package/dist/{chunk-pwwa7s62.js → chunk-2vc3fyp9.js} +2 -2
  32. package/dist/{chunk-c2nnhgr2.js → chunk-37j24srh.js} +6 -6
  33. package/dist/{chunk-5gjwp5bc.js → chunk-39r7sh1h.js} +90 -90
  34. package/dist/{chunk-t4khqff1.js → chunk-3hcfwedh.js} +5 -5
  35. package/dist/{chunk-w6m6trzq.js → chunk-3hxr3x9d.js} +2 -2
  36. package/dist/{chunk-4xwfsejb.js → chunk-3jbxhytz.js} +8 -8
  37. package/dist/{chunk-qwa7xy95.js → chunk-3k8ecscj.js} +78 -78
  38. package/dist/chunk-3kx7brrn.js +55 -0
  39. package/dist/{chunk-gg55fns0.js → chunk-3w4xq6cv.js} +92 -92
  40. package/dist/{chunk-pywnxth6.js → chunk-3xamk0n1.js} +25 -25
  41. package/dist/{chunk-89vrm4ae.js → chunk-41wn5eqw.js} +10 -10
  42. package/dist/{chunk-cxrktb5g.js → chunk-44bqv91d.js} +3 -3
  43. package/dist/{chunk-cgfdkzhb.js → chunk-4bcx2a3p.js} +1 -1
  44. package/dist/{chunk-mswx2nma.js → chunk-4e1j46k0.js} +3 -3
  45. package/dist/{chunk-rshp5b43.js → chunk-4fwzreqj.js} +6 -6
  46. package/dist/{chunk-txn11vtv.js → chunk-4kfhh3aw.js} +4 -4
  47. package/dist/chunk-4kfs8ymb.js +92 -0
  48. package/dist/{chunk-t29a6zb5.js → chunk-4nqm22j3.js} +6 -4
  49. package/dist/{chunk-hz31bs21.js → chunk-4v1mr2x2.js} +41 -41
  50. package/dist/{chunk-a2hq2yt9.js → chunk-4yq5zz3m.js} +9 -9
  51. package/dist/{chunk-0r04e4ap.js → chunk-52pp0dbk.js} +4 -4
  52. package/dist/{chunk-3nk79af8.js → chunk-568q88qz.js} +1 -1
  53. package/dist/{chunk-ase86y73.js → chunk-5f57qtf9.js} +1 -1
  54. package/dist/{chunk-07069jq1.js → chunk-5gr6ekgm.js} +4 -4
  55. package/dist/{chunk-ppwjyveh.js → chunk-5nqrdqz5.js} +1 -1
  56. package/dist/chunk-5rhmrt2j.js +121 -0
  57. package/dist/{chunk-1e1rjstz.js → chunk-5sd5fz78.js} +78 -78
  58. package/dist/{chunk-5n1jc02d.js → chunk-5v6wr1z4.js} +2 -2
  59. package/dist/{chunk-69n11zng.js → chunk-5vavvf6y.js} +5 -5
  60. package/dist/{chunk-kwp6116t.js → chunk-60a647ty.js} +81 -81
  61. package/dist/{chunk-zxh62ved.js → chunk-61x3akfa.js} +2 -2
  62. package/dist/chunk-626watky.js +50 -0
  63. package/dist/{chunk-6s68m1dg.js → chunk-62jrhytw.js} +10 -10
  64. package/dist/{chunk-fkr3tfcs.js → chunk-638qz5y7.js} +5 -5
  65. package/dist/{chunk-tz9r44d9.js → chunk-657k4mef.js} +78 -78
  66. package/dist/chunk-6aqa0ec5.js +145 -0
  67. package/dist/{chunk-7d24zw5w.js → chunk-6c22q39e.js} +78 -78
  68. package/dist/{chunk-b0kf00ff.js → chunk-6d05fvxz.js} +2 -2
  69. package/dist/{chunk-q9t2n7d1.js → chunk-6fe0an4e.js} +79 -79
  70. package/dist/{chunk-vc12yftf.js → chunk-6fx36a3s.js} +5 -5
  71. package/dist/{chunk-qzf23s30.js → chunk-6hs3wed5.js} +7 -7
  72. package/dist/{chunk-1hg8ktay.js → chunk-6qb753r5.js} +79 -79
  73. package/dist/{chunk-0xjaqda8.js → chunk-6rcf54zd.js} +48 -27
  74. package/dist/{chunk-bamjc1k5.js → chunk-6twsw69m.js} +7 -7
  75. package/dist/{chunk-arhmkw0v.js → chunk-6vp8zen2.js} +79 -79
  76. package/dist/chunk-6zfb4n08.js +91 -0
  77. package/dist/chunk-73bgy356.js +90 -0
  78. package/dist/{chunk-f9wnty9x.js → chunk-7ba45tqg.js} +5 -5
  79. package/dist/{chunk-f98yad99.js → chunk-7dc9d8fy.js} +7 -7
  80. package/dist/{chunk-ngc2r6jc.js → chunk-7deqmrby.js} +5 -5
  81. package/dist/{chunk-9x5zgy22.js → chunk-7e9xcw77.js} +1 -1
  82. package/dist/{chunk-w2qjc4dy.js → chunk-7gbe6ftc.js} +9 -9
  83. package/dist/{chunk-xhfmdq1y.js → chunk-7gte8zc4.js} +1 -1
  84. package/dist/{chunk-6nsd9606.js → chunk-7kp42hzq.js} +2 -2
  85. package/dist/{chunk-hakdhagh.js → chunk-7njkaxjp.js} +39 -120
  86. package/dist/chunk-7nphjzve.js +105 -0
  87. package/dist/chunk-7sp9dk6d.js +20 -0
  88. package/dist/{chunk-wgk9sxk7.js → chunk-7tdk9ypw.js} +10 -10
  89. package/dist/{chunk-6dj5t602.js → chunk-7wegz81g.js} +1 -1
  90. package/dist/{chunk-7wm5s02e.js → chunk-7yexhdjs.js} +1 -1
  91. package/dist/{chunk-eert2day.js → chunk-88k0rgdp.js} +11 -11
  92. package/dist/{chunk-fcynwjpm.js → chunk-8a1jee0e.js} +2 -2
  93. package/dist/{chunk-3vy1jt9p.js → chunk-8ady2sm4.js} +8 -8
  94. package/dist/chunk-8jmkpx1h.js +123 -0
  95. package/dist/{chunk-mccjtnrw.js → chunk-8m1gfrme.js} +14 -14
  96. package/dist/{chunk-7sgtxrsc.js → chunk-8q5fzyem.js} +10 -8
  97. package/dist/{chunk-zzm33q8x.js → chunk-8r1napm7.js} +1 -1
  98. package/dist/{chunk-cdz5yb0r.js → chunk-9029sbq1.js} +1 -1
  99. package/dist/{chunk-y1784krc.js → chunk-92wwx9vf.js} +2 -2
  100. package/dist/{chunk-0zprysa2.js → chunk-93hxjnkb.js} +78 -78
  101. package/dist/{chunk-qh5p43j4.js → chunk-93kvs6fh.js} +6 -6
  102. package/dist/{chunk-gw9291xk.js → chunk-9b71sn2g.js} +41 -41
  103. package/dist/{chunk-zt86q6j5.js → chunk-9drwsb3g.js} +80 -80
  104. package/dist/{chunk-0075f5sb.js → chunk-9p62r6he.js} +6 -6
  105. package/dist/{chunk-5c980jax.js → chunk-9re786wa.js} +40 -40
  106. package/dist/{chunk-s7x8ajv3.js → chunk-9rhy5vt7.js} +9 -9
  107. package/dist/chunk-9xq7ef8y.js +100 -0
  108. package/dist/chunk-9ydxqdhe.js +121 -0
  109. package/dist/{chunk-rmbbmd3s.js → chunk-a00gfn8e.js} +2 -2
  110. package/dist/{chunk-2vj1ta7d.js → chunk-a1mewckj.js} +78 -78
  111. package/dist/{chunk-k8vp0atq.js → chunk-a3qtafgw.js} +79 -79
  112. package/dist/chunk-ab6apbd2.js +140 -0
  113. package/dist/{chunk-d4mdda98.js → chunk-apjnwens.js} +8 -8
  114. package/dist/{chunk-ddsjkqs4.js → chunk-b1hygym1.js} +8 -8
  115. package/dist/{chunk-qatfdxvd.js → chunk-b610qrvk.js} +3 -3
  116. package/dist/{chunk-qpaeatmf.js → chunk-bbhg7m1a.js} +79 -79
  117. package/dist/{chunk-83hfzbx3.js → chunk-bdhdmkya.js} +1 -1
  118. package/dist/chunk-bdrsheny.js +35 -0
  119. package/dist/{chunk-vyjeh50y.js → chunk-bktmgb4n.js} +68 -39
  120. package/dist/{chunk-feyzykye.js → chunk-bq0wp28e.js} +1 -1
  121. package/dist/{chunk-0vp3wfab.js → chunk-bs9rn85s.js} +1 -1
  122. package/dist/{chunk-ft4dxnwq.js → chunk-bstyysxw.js} +3 -3
  123. package/dist/{chunk-yyex5gsf.js → chunk-bta8w8ge.js} +10 -10
  124. package/dist/chunk-bvfqg3cg.js +131 -0
  125. package/dist/{chunk-p1sn36ax.js → chunk-bw8y1msy.js} +5 -5
  126. package/dist/{chunk-7n6tk7rw.js → chunk-c2k1n6yb.js} +13 -13
  127. package/dist/{chunk-rtbar3a1.js → chunk-c6gpdd2c.js} +78 -78
  128. package/dist/{chunk-f84vvk41.js → chunk-cajjdb7j.js} +4 -4
  129. package/dist/{chunk-8svj497n.js → chunk-ccdh8eh2.js} +38 -38
  130. package/dist/{chunk-mys37bb4.js → chunk-cfpnb7x4.js} +78 -78
  131. package/dist/{chunk-21jaw3mt.js → chunk-cgzq4zww.js} +4 -4
  132. package/dist/chunk-cj0j4n23.js +71 -0
  133. package/dist/{chunk-0731m51q.js → chunk-ckrs789w.js} +1 -1
  134. package/dist/{chunk-rnxctq9p.js → chunk-cqb31tfg.js} +6 -6
  135. package/dist/{chunk-v6qvcajp.js → chunk-cx21etb2.js} +2 -2
  136. package/dist/chunk-cynnhyy3.js +103 -0
  137. package/dist/chunk-d0zx5hba.js +85 -0
  138. package/dist/{chunk-rn7w9k0a.js → chunk-d2cypdsx.js} +23 -23
  139. package/dist/{chunk-1h2famwb.js → chunk-d99k9r9g.js} +1 -1
  140. package/dist/{chunk-qatqd4rk.js → chunk-dg2k597k.js} +9 -9
  141. package/dist/{chunk-ewadzrm8.js → chunk-dh01e4bp.js} +2 -2
  142. package/dist/{chunk-d564dtpq.js → chunk-dmp3nd67.js} +90 -90
  143. package/dist/{chunk-1j0n05rf.js → chunk-dv38yqdn.js} +3 -3
  144. package/dist/{chunk-fqak69ft.js → chunk-dy8278wt.js} +7 -7
  145. package/dist/{chunk-36akc07b.js → chunk-dzcb2ekz.js} +4 -4
  146. package/dist/{chunk-z2npjf0h.js → chunk-e01rphq3.js} +108 -109
  147. package/dist/{chunk-dfszv6kn.js → chunk-e22at2jn.js} +4 -4
  148. package/dist/chunk-e6s584g7.js +77 -0
  149. package/dist/{chunk-v4162e76.js → chunk-e7j6g62d.js} +9 -9
  150. package/dist/chunk-e90dyenj.js +127 -0
  151. package/dist/{chunk-z0pmdn8s.js → chunk-eb4t4ehh.js} +6 -6
  152. package/dist/{chunk-5h1wfdk2.js → chunk-ej882sb5.js} +26 -26
  153. package/dist/{chunk-fvm8gehr.js → chunk-ekewg3tj.js} +4 -4
  154. package/dist/chunk-em5s71j6.js +89 -0
  155. package/dist/chunk-eqcgr89w.js +646 -0
  156. package/dist/{chunk-4ce75svs.js → chunk-et3jfht8.js} +13 -13
  157. package/dist/{chunk-qp2qdcda.js → chunk-eta5aekm.js} +9 -30
  158. package/dist/{chunk-f3ychkjd.js → chunk-ewsvbzhz.js} +3 -3
  159. package/dist/{chunk-7wg82yq4.js → chunk-eynfddhq.js} +143 -144
  160. package/dist/{chunk-66zry909.js → chunk-f517h74h.js} +1 -1
  161. package/dist/{chunk-4pbx3g7s.js → chunk-f79jyxwd.js} +4 -4
  162. package/dist/{chunk-hwfknpxv.js → chunk-f9ybfyyp.js} +2 -2
  163. package/dist/chunk-f9zvs66e.js +105 -0
  164. package/dist/{chunk-7aw745vx.js → chunk-fdwtd6s9.js} +3 -3
  165. package/dist/{chunk-gmdt7w5d.js → chunk-fefs2xby.js} +25 -25
  166. package/dist/{chunk-jzthz1bx.js → chunk-fpq87r80.js} +1 -1
  167. package/dist/{chunk-s8gy4ky9.js → chunk-fqr6n9z6.js} +3 -3
  168. package/dist/{chunk-s8kj6ajy.js → chunk-fr5s5ceq.js} +2 -2
  169. package/dist/chunk-gaf31961.js +81 -0
  170. package/dist/{chunk-64c1avct.js → chunk-gbvmks09.js} +1 -1
  171. package/dist/{chunk-y4ca9kqz.js → chunk-ggk84sc5.js} +4 -4
  172. package/dist/chunk-gkz2djp0.js +121 -0
  173. package/dist/{chunk-rjsfkzty.js → chunk-gm8ht8g9.js} +6 -6
  174. package/dist/{chunk-wn3zb71r.js → chunk-gt43z5zd.js} +81 -81
  175. package/dist/chunk-gwktnbeg.js +90 -0
  176. package/dist/{chunk-xv3era3s.js → chunk-gxsrvxjn.js} +1 -1
  177. package/dist/chunk-h0bgwz9v.js +55 -0
  178. package/dist/{chunk-gy4se0z5.js → chunk-h1tv19q0.js} +80 -80
  179. package/dist/chunk-h3v46eky.js +105 -0
  180. package/dist/{chunk-e8s2e141.js → chunk-h4tnp6dw.js} +7 -7
  181. package/dist/{chunk-5bs3xf11.js → chunk-h8n0a991.js} +79 -79
  182. package/dist/{chunk-nc0ve25x.js → chunk-hbz8xggv.js} +11 -11
  183. package/dist/{chunk-v78fj8by.js → chunk-he9zw1gh.js} +2 -2
  184. package/dist/{chunk-1cpeddhv.js → chunk-hgb8024k.js} +8 -8
  185. package/dist/{chunk-m2yqqry6.js → chunk-hhvf84fa.js} +183 -185
  186. package/dist/chunk-hycm92ss.js +52 -0
  187. package/dist/{chunk-670trxyg.js → chunk-j0bfbce5.js} +36 -36
  188. package/dist/{chunk-srkc8pwp.js → chunk-j15xyew5.js} +4 -4
  189. package/dist/chunk-j3c5r08n.js +87 -0
  190. package/dist/chunk-j3q2sbhc.js +107 -0
  191. package/dist/{chunk-dhfag5m0.js → chunk-j77g2v22.js} +5 -5
  192. package/dist/{chunk-ps49ymvj.js → chunk-ja1nqz5q.js} +2 -2
  193. package/dist/{chunk-3t7kecay.js → chunk-ja23mty8.js} +83 -83
  194. package/dist/{chunk-e83tfqyt.js → chunk-jrqjxhxj.js} +2 -2
  195. package/dist/{chunk-x47h283a.js → chunk-jsvsnqkn.js} +2 -2
  196. package/dist/{chunk-rs4yayw6.js → chunk-jw9zwgea.js} +4 -4
  197. package/dist/{chunk-xq0q4bky.js → chunk-jwqveqpr.js} +9 -9
  198. package/dist/{chunk-844zmnw6.js → chunk-k0dprbnn.js} +78 -78
  199. package/dist/{chunk-e0abab5b.js → chunk-k3gvjjm9.js} +5 -5
  200. package/dist/{chunk-2fwze72g.js → chunk-k6cq3j7z.js} +1 -1
  201. package/dist/{chunk-x7fdwq3d.js → chunk-k6wmp81y.js} +1 -1
  202. package/dist/{chunk-xtanrzac.js → chunk-k8by1vfd.js} +19 -19
  203. package/dist/chunk-k9h7kjf6.js +8 -0
  204. package/dist/chunk-karea2z2.js +89 -0
  205. package/dist/{chunk-wa8yn2p0.js → chunk-kcp41jcn.js} +2 -2
  206. package/dist/{chunk-a5cj5yk1.js → chunk-khwhppzs.js} +2 -2
  207. package/dist/{chunk-68ffk5qa.js → chunk-kjx9a9p4.js} +2 -2
  208. package/dist/chunk-kra9y8qb.js +97 -0
  209. package/dist/{chunk-j5bth84e.js → chunk-kt25n52f.js} +4 -4
  210. package/dist/{chunk-eqj42wkk.js → chunk-m12e2wq3.js} +80 -80
  211. package/dist/{chunk-h9n54swm.js → chunk-m13ptmf2.js} +2 -2
  212. package/dist/{chunk-4jm600zv.js → chunk-m6vs965c.js} +1 -1
  213. package/dist/{chunk-03jc62cq.js → chunk-m82ketm1.js} +78 -78
  214. package/dist/{chunk-y9bhjjdz.js → chunk-m8qvkabg.js} +4 -4
  215. package/dist/{chunk-d9e7ndag.js → chunk-ma6x4ws8.js} +46 -46
  216. package/dist/{chunk-rtbrh4ac.js → chunk-mbfzfg56.js} +85 -85
  217. package/dist/{chunk-8457y05z.js → chunk-mtstpt1e.js} +43 -43
  218. package/dist/chunk-mwzwm2z2.js +60 -0
  219. package/dist/{chunk-vkhrrvfq.js → chunk-myac8yfs.js} +5 -5
  220. package/dist/{chunk-110c7hek.js → chunk-n3vmrzcy.js} +5 -5
  221. package/dist/chunk-n535j168.js +131 -0
  222. package/dist/{chunk-v9smspw2.js → chunk-n9ne98cj.js} +5 -4
  223. package/dist/{chunk-c0vhnnct.js → chunk-n9xhrzxs.js} +78 -78
  224. package/dist/{chunk-sqckd5nx.js → chunk-ngde5k9k.js} +79 -79
  225. package/dist/{chunk-ksq6zjys.js → chunk-nsxw4b3j.js} +8 -8
  226. package/dist/{chunk-d4q90j1w.js → chunk-nwdpjkrw.js} +78 -78
  227. package/dist/{chunk-sd36yzx8.js → chunk-nztayqyx.js} +1 -1
  228. package/dist/{chunk-byfawrfx.js → chunk-p0n9ew4x.js} +4 -4
  229. package/dist/{chunk-ehtwnxpg.js → chunk-p4e5ymdw.js} +1 -1
  230. package/dist/{chunk-cnsj3vq2.js → chunk-p8hn07q2.js} +1 -1
  231. package/dist/chunk-p9nkqgej.js +19 -0
  232. package/dist/{chunk-pe3rkfp2.js → chunk-pg4fbhbm.js} +11 -11
  233. package/dist/{chunk-e9w9zc0g.js → chunk-pg8asjpk.js} +20 -20
  234. package/dist/chunk-pgptefy1.js +114 -0
  235. package/dist/chunk-pjn0s3j1.js +111 -0
  236. package/dist/chunk-pkwv0q5q.js +91 -0
  237. package/dist/{chunk-netzwgv1.js → chunk-pnc7q9rt.js} +1 -1
  238. package/dist/{chunk-xeb6075z.js → chunk-pnrdvxhy.js} +2 -2
  239. package/dist/{chunk-9ed7v1qq.js → chunk-pp5zbnpr.js} +80 -80
  240. package/dist/{chunk-dmahh26f.js → chunk-pqf2bjy1.js} +4 -4
  241. package/dist/{chunk-hgdxffqr.js → chunk-pqxyft7d.js} +8 -8
  242. package/dist/{chunk-v8kjswxt.js → chunk-pt1jzmkv.js} +2 -2
  243. package/dist/{chunk-a1s9n17m.js → chunk-pt6vj628.js} +9 -9
  244. package/dist/{chunk-c7jwbe76.js → chunk-pyn4ry36.js} +103 -57
  245. package/dist/{chunk-2ewarpza.js → chunk-q53kkzhr.js} +80 -80
  246. package/dist/chunk-q6m9qgaa.js +88 -0
  247. package/dist/{chunk-p8na2wwp.js → chunk-q74fcthe.js} +2 -2
  248. package/dist/{chunk-v311af96.js → chunk-q8t0ym9s.js} +83 -83
  249. package/dist/{chunk-mcws22k3.js → chunk-q9y73cmh.js} +1 -1
  250. package/dist/{chunk-fajg8x36.js → chunk-qbbf7rr5.js} +1818 -727
  251. package/dist/{chunk-qb6k2afy.js → chunk-qka6pqrq.js} +11 -11
  252. package/dist/{chunk-0paqc2yw.js → chunk-qqc3b97c.js} +1 -1
  253. package/dist/{chunk-t9p85zff.js → chunk-qrdbqeve.js} +2 -2
  254. package/dist/{chunk-p81gg65v.js → chunk-qrgxbrs9.js} +930 -1057
  255. package/dist/{chunk-ky1z78ve.js → chunk-qs4stpt5.js} +14 -14
  256. package/dist/{chunk-b1kcd3ss.js → chunk-r055z03k.js} +1 -1
  257. package/dist/{chunk-ns7x6xam.js → chunk-r1q9s5hs.js} +13 -10
  258. package/dist/{chunk-drqk484j.js → chunk-r27tskss.js} +11 -9
  259. package/dist/{chunk-etdt1xz3.js → chunk-r4pq77kb.js} +3 -3
  260. package/dist/{chunk-5z28bqne.js → chunk-r585pc0g.js} +4 -3
  261. package/dist/chunk-r82c7gfc.js +58 -0
  262. package/dist/{chunk-0rs4m3ya.js → chunk-ra9hbfyz.js} +3 -3
  263. package/dist/{chunk-xk89d6vy.js → chunk-rfj6gjwh.js} +14 -14
  264. package/dist/{chunk-qkczt8cr.js → chunk-rgaedd84.js} +5 -5
  265. package/dist/chunk-rgshryeb.js +93 -0
  266. package/dist/chunk-rk2kb2ec.js +101 -0
  267. package/dist/{chunk-x6r4v44b.js → chunk-rpta0rqz.js} +1 -1
  268. package/dist/{chunk-2gzv8nrw.js → chunk-rrtpbztr.js} +4 -3
  269. package/dist/{chunk-dfzkwynj.js → chunk-rx9ypbjy.js} +8 -8
  270. package/dist/{chunk-hpd100ja.js → chunk-rzk001ay.js} +85 -85
  271. package/dist/{chunk-c33r7wby.js → chunk-rzn9w8p2.js} +3 -3
  272. package/dist/chunk-s0p653k2.js +93 -0
  273. package/dist/{chunk-2e8ybf05.js → chunk-s13y3w7e.js} +36 -36
  274. package/dist/{chunk-vj9segre.js → chunk-s201s689.js} +18 -18
  275. package/dist/{chunk-a5ry85ct.js → chunk-s5arr49c.js} +11 -200
  276. package/dist/{chunk-3jh2z27c.js → chunk-s7tq4e5g.js} +78 -78
  277. package/dist/{chunk-brqy29g9.js → chunk-s9906sac.js} +83 -83
  278. package/dist/{chunk-302xme7e.js → chunk-s9jxtj04.js} +92 -92
  279. package/dist/{chunk-pgtnj1mt.js → chunk-sbe9zd56.js} +6 -6
  280. package/dist/chunk-skypjdyc.js +147 -0
  281. package/dist/{chunk-fbv4apne.js → chunk-snd4pbkp.js} +1 -1
  282. package/dist/{chunk-nc7kjfxk.js → chunk-sthmb4xf.js} +78 -78
  283. package/dist/{chunk-1gx78081.js → chunk-t3yc7m07.js} +1 -1
  284. package/dist/{chunk-0r5bb9j4.js → chunk-t83amzhd.js} +12 -12
  285. package/dist/{chunk-5h5kx2jd.js → chunk-t8chhacb.js} +2 -2
  286. package/dist/{chunk-k0p9w03v.js → chunk-taqr0qw1.js} +3 -3
  287. package/dist/{chunk-nzdz8raj.js → chunk-tdf3ha9b.js} +79 -79
  288. package/dist/{chunk-8g5pe1gr.js → chunk-tevzn1xp.js} +1 -1
  289. package/dist/chunk-tgayhxvz.js +41 -0
  290. package/dist/{chunk-j64ga6ta.js → chunk-tkbwrjte.js} +325 -284
  291. package/dist/{chunk-4wx02mba.js → chunk-tmye4d2k.js} +15 -15
  292. package/dist/{chunk-55raexh7.js → chunk-tnpk0ne1.js} +2458 -1002
  293. package/dist/{chunk-sa1pvh58.js → chunk-tnv92c5m.js} +80 -80
  294. package/dist/{chunk-jd32zbps.js → chunk-trm02xde.js} +2 -2
  295. package/dist/{chunk-y6x9kgba.js → chunk-tyc5c0q4.js} +8 -8
  296. package/dist/{chunk-4k9d7gxv.js → chunk-v2szqm5g.js} +5 -5
  297. package/dist/{chunk-bbc9f5q9.js → chunk-v8k67zfz.js} +1123 -388
  298. package/dist/{chunk-hr9c2w99.js → chunk-v9sy0cj3.js} +10 -10
  299. package/dist/{chunk-p7vkh4wx.js → chunk-vbe1ersf.js} +1 -1
  300. package/dist/{chunk-ntztbz5t.js → chunk-vd5dh925.js} +78 -78
  301. package/dist/{chunk-6dngjwkh.js → chunk-vnrevqdf.js} +4 -4
  302. package/dist/{chunk-7s3g2nbw.js → chunk-vq4k182g.js} +5 -5
  303. package/dist/chunk-vr5vyt2h.js +107 -0
  304. package/dist/{chunk-a2v77s0p.js → chunk-vv84k232.js} +5 -5
  305. package/dist/chunk-vvjhax8n.js +114 -0
  306. package/dist/chunk-vvsts2t9.js +30 -0
  307. package/dist/{chunk-mq451b1k.js → chunk-vwkb146r.js} +90 -90
  308. package/dist/{chunk-a6328ts5.js → chunk-vwt2fv6j.js} +3 -3
  309. package/dist/{chunk-6fes9049.js → chunk-vx28ztc7.js} +20 -20
  310. package/dist/{chunk-g9f19ttm.js → chunk-vxsad4bw.js} +2 -2
  311. package/dist/chunk-w287mz4p.js +146 -0
  312. package/dist/{chunk-1ts9qapj.js → chunk-w2bff8pq.js} +12 -12
  313. package/dist/{chunk-q3w82drt.js → chunk-w60c0dkw.js} +5 -5
  314. package/dist/chunk-wa852b5b.js +113 -0
  315. package/dist/{chunk-7xyswgjh.js → chunk-wfh12nzh.js} +1 -1
  316. package/dist/{chunk-vf612n57.js → chunk-wt799fvk.js} +34 -34
  317. package/dist/{chunk-qajrkk97.js → chunk-wwrswxg1.js} +1 -1
  318. package/dist/{chunk-1fb0jqty.js → chunk-wyyd1qfn.js} +81 -81
  319. package/dist/{chunk-40gj4vgn.js → chunk-x09aacvx.js} +5 -5
  320. package/dist/{chunk-m8wxbjg3.js → chunk-x4x3691j.js} +12 -12
  321. package/dist/chunk-xbpt4dv8.js +155 -0
  322. package/dist/{chunk-rn0v1hk8.js → chunk-xdxdztxa.js} +1 -1
  323. package/dist/{chunk-wc67aegv.js → chunk-xggbj4j9.js} +3 -3
  324. package/dist/chunk-xj72jfpd.js +33 -0
  325. package/dist/{chunk-8yhf030a.js → chunk-xj8tk3d7.js} +3 -3
  326. package/dist/{chunk-5cj7yfg1.js → chunk-xkra2684.js} +85 -86
  327. package/dist/{chunk-hav5hw2k.js → chunk-xm9zf0tv.js} +78 -78
  328. package/dist/chunk-xwbh3j1x.js +107 -0
  329. package/dist/chunk-xwrar1c5.js +97 -0
  330. package/dist/{chunk-nsbtda9y.js → chunk-xygy5v97.js} +27 -27
  331. package/dist/{chunk-3jp8zgek.js → chunk-xyzbgjpv.js} +2 -2
  332. package/dist/{chunk-1ae3nt9j.js → chunk-y83gxqvc.js} +3 -3
  333. package/dist/{chunk-64r16v22.js → chunk-y8b45mt2.js} +4 -4
  334. package/dist/{chunk-65j4q40b.js → chunk-ycpdfeya.js} +79 -79
  335. package/dist/{chunk-k6bpr2zz.js → chunk-yh46f77t.js} +78 -78
  336. package/dist/{chunk-6g0hnb1k.js → chunk-ykvf93ft.js} +79 -79
  337. package/dist/{chunk-26wtxbdc.js → chunk-ynx3fetd.js} +1222 -463
  338. package/dist/{chunk-d5eckc42.js → chunk-yp64t9je.js} +8 -8
  339. package/dist/{chunk-eqp1rfft.js → chunk-ysfam81t.js} +2 -2
  340. package/dist/chunk-yt9mady7.js +36 -0
  341. package/dist/{chunk-bpkpy613.js → chunk-yteprw63.js} +26 -26
  342. package/dist/{chunk-8bxm9bv1.js → chunk-ytt8da3v.js} +81 -81
  343. package/dist/{chunk-hnwg3k83.js → chunk-yvm9t98e.js} +7 -18
  344. package/dist/{chunk-3f2ryn4p.js → chunk-z7yj7dfh.js} +10 -10
  345. package/dist/{chunk-d6eym4sa.js → chunk-z8b8f2n3.js} +79 -79
  346. package/dist/{chunk-1vyfr81c.js → chunk-z8n8cjhz.js} +2 -2
  347. package/dist/{chunk-5ccdsxgy.js → chunk-z9v4bxrj.js} +3 -3
  348. package/dist/{chunk-k737m0z6.js → chunk-zat7q2e0.js} +79 -79
  349. package/dist/chunk-zfxp82tk.js +24 -0
  350. package/dist/chunk-zgkngrp4.js +54 -0
  351. package/dist/{chunk-brjd9zmk.js → chunk-zhnnzkzm.js} +14 -14
  352. package/dist/{chunk-7hfzfe98.js → chunk-zp5nvg44.js} +2 -2
  353. package/dist/{chunk-5ekyhb1w.js → chunk-zqajmq38.js} +6 -6
  354. package/dist/{chunk-v1kzp02e.js → chunk-zx9r7a23.js} +1 -1
  355. package/dist/cli.js +11 -11
  356. package/dist/gateway/worker.js +17902 -12387
  357. package/dist/sdk/query.cjs +8 -18
  358. package/dist/sdk/query.js +1 -1
  359. package/package.json +128 -128
  360. package/dist/chunk-0e495v4y.js +0 -103
  361. package/dist/chunk-0n4n14c1.js +0 -55
  362. package/dist/chunk-0t81d427.js +0 -41
  363. package/dist/chunk-1pjgxfeq.js +0 -105
  364. package/dist/chunk-2tb0e476.js +0 -121
  365. package/dist/chunk-3dx4h9pq.js +0 -114
  366. package/dist/chunk-3kf30xba.js +0 -121
  367. package/dist/chunk-3mgywd32.js +0 -8
  368. package/dist/chunk-3t2pkmek.js +0 -77
  369. package/dist/chunk-4e708nwk.js +0 -50
  370. package/dist/chunk-5h4berfm.js +0 -30
  371. package/dist/chunk-5xkp0tnb.js +0 -97
  372. package/dist/chunk-6rvr3wwq.js +0 -55
  373. package/dist/chunk-7eb2qp91.js +0 -90
  374. package/dist/chunk-7m3a6kb8.js +0 -93
  375. package/dist/chunk-9hd3p970.js +0 -88
  376. package/dist/chunk-a1gwg4fx.js +0 -87
  377. package/dist/chunk-adtgferq.js +0 -107
  378. package/dist/chunk-ahxpxdqg.js +0 -105
  379. package/dist/chunk-ajrrg4t1.js +0 -131
  380. package/dist/chunk-b3q5g3x5.js +0 -71
  381. package/dist/chunk-bh5zqvyc.js +0 -36
  382. package/dist/chunk-bjwdqabf.js +0 -113
  383. package/dist/chunk-by2e46kd.js +0 -92
  384. package/dist/chunk-c6sjhj89.js +0 -1284
  385. package/dist/chunk-cdef9v7b.js +0 -27
  386. package/dist/chunk-czsjnagp.js +0 -114
  387. package/dist/chunk-dn00fcy7.js +0 -54
  388. package/dist/chunk-dnb45dhp.js +0 -97
  389. package/dist/chunk-e2nwdr09.js +0 -127
  390. package/dist/chunk-e4vx828d.js +0 -91
  391. package/dist/chunk-f0eqte4j.js +0 -105
  392. package/dist/chunk-f6xzr8q2.js +0 -101
  393. package/dist/chunk-g0x0gksg.js +0 -91
  394. package/dist/chunk-gdwdqewd.js +0 -19
  395. package/dist/chunk-gz1e8y1w.js +0 -33
  396. package/dist/chunk-hca6b2e5.js +0 -133
  397. package/dist/chunk-hszdxe8f.js +0 -146
  398. package/dist/chunk-k2p273gs.js +0 -107
  399. package/dist/chunk-kc8am0nn.js +0 -111
  400. package/dist/chunk-kde61fqf.js +0 -148
  401. package/dist/chunk-knbjqnc7.js +0 -52
  402. package/dist/chunk-m626yecd.js +0 -107
  403. package/dist/chunk-m86p6rs2.js +0 -121
  404. package/dist/chunk-nmgj86tt.js +0 -24
  405. package/dist/chunk-pd0yqtm8.js +0 -122
  406. package/dist/chunk-pgs47kqs.js +0 -155
  407. package/dist/chunk-py7pm42n.js +0 -60
  408. package/dist/chunk-pzxz2an7.js +0 -145
  409. package/dist/chunk-q0kafg58.js +0 -89
  410. package/dist/chunk-qnfx3qtx.js +0 -617
  411. package/dist/chunk-qs3g8f9e.js +0 -20
  412. package/dist/chunk-readr4t2.js +0 -89
  413. package/dist/chunk-rnajq3vk.js +0 -140
  414. package/dist/chunk-s6cxke3j.js +0 -100
  415. package/dist/chunk-sgpmpn90.js +0 -35
  416. package/dist/chunk-sh02d2qn.js +0 -38
  417. package/dist/chunk-t04tpqda.js +0 -130
  418. package/dist/chunk-t3se5crr.js +0 -85
  419. package/dist/chunk-vffwxpad.js +0 -101
  420. package/dist/chunk-vtjgsgyf.js +0 -123
  421. package/dist/chunk-w022zpyz.js +0 -81
  422. package/dist/chunk-w28zrffk.js +0 -94
  423. package/dist/chunk-w328d3yn.js +0 -71
  424. package/dist/chunk-xrb6mn8j.js +0 -93
  425. package/dist/chunk-ypsecc1v.js +0 -90
  426. package/dist/chunk-yrr23vr1.js +0 -58
@@ -1,9 +1,9 @@
1
1
  // @bun
2
2
  import {
3
3
  __commonJS
4
- } from "./chunk-qp2qdcda.js";
4
+ } from "./chunk-eta5aekm.js";
5
5
 
6
- // node_modules/.bun/@xmldom+xmldom@0.8.12/node_modules/@xmldom/xmldom/lib/conventions.js
6
+ // node_modules/.bun/@xmldom+xmldom@0.9.10/node_modules/@xmldom/xmldom/lib/conventions.js
7
7
  var require_conventions = __commonJS((exports) => {
8
8
  function find(list, predicate, ac) {
9
9
  if (ac === undefined) {
@@ -13,7 +13,7 @@ var require_conventions = __commonJS((exports) => {
13
13
  return ac.find.call(list, predicate);
14
14
  }
15
15
  for (var i = 0;i < list.length; i++) {
16
- if (Object.prototype.hasOwnProperty.call(list, i)) {
16
+ if (hasOwn(list, i)) {
17
17
  var item = list[i];
18
18
  if (predicate.call(undefined, item, i, list)) {
19
19
  return item;
@@ -25,34 +25,108 @@ var require_conventions = __commonJS((exports) => {
25
25
  if (oc === undefined) {
26
26
  oc = Object;
27
27
  }
28
+ if (oc && typeof oc.getOwnPropertyDescriptors === "function") {
29
+ object = oc.create(null, oc.getOwnPropertyDescriptors(object));
30
+ }
28
31
  return oc && typeof oc.freeze === "function" ? oc.freeze(object) : object;
29
32
  }
33
+ function hasOwn(object, key) {
34
+ return Object.prototype.hasOwnProperty.call(object, key);
35
+ }
30
36
  function assign(target, source) {
31
37
  if (target === null || typeof target !== "object") {
32
38
  throw new TypeError("target is not an object");
33
39
  }
34
40
  for (var key in source) {
35
- if (Object.prototype.hasOwnProperty.call(source, key)) {
41
+ if (hasOwn(source, key)) {
36
42
  target[key] = source[key];
37
43
  }
38
44
  }
39
45
  return target;
40
46
  }
47
+ var HTML_BOOLEAN_ATTRIBUTES = freeze({
48
+ allowfullscreen: true,
49
+ async: true,
50
+ autofocus: true,
51
+ autoplay: true,
52
+ checked: true,
53
+ controls: true,
54
+ default: true,
55
+ defer: true,
56
+ disabled: true,
57
+ formnovalidate: true,
58
+ hidden: true,
59
+ ismap: true,
60
+ itemscope: true,
61
+ loop: true,
62
+ multiple: true,
63
+ muted: true,
64
+ nomodule: true,
65
+ novalidate: true,
66
+ open: true,
67
+ playsinline: true,
68
+ readonly: true,
69
+ required: true,
70
+ reversed: true,
71
+ selected: true
72
+ });
73
+ function isHTMLBooleanAttribute(name) {
74
+ return hasOwn(HTML_BOOLEAN_ATTRIBUTES, name.toLowerCase());
75
+ }
76
+ var HTML_VOID_ELEMENTS = freeze({
77
+ area: true,
78
+ base: true,
79
+ br: true,
80
+ col: true,
81
+ embed: true,
82
+ hr: true,
83
+ img: true,
84
+ input: true,
85
+ link: true,
86
+ meta: true,
87
+ param: true,
88
+ source: true,
89
+ track: true,
90
+ wbr: true
91
+ });
92
+ function isHTMLVoidElement(tagName) {
93
+ return hasOwn(HTML_VOID_ELEMENTS, tagName.toLowerCase());
94
+ }
95
+ var HTML_RAW_TEXT_ELEMENTS = freeze({
96
+ script: false,
97
+ style: false,
98
+ textarea: true,
99
+ title: true
100
+ });
101
+ function isHTMLRawTextElement(tagName) {
102
+ var key = tagName.toLowerCase();
103
+ return hasOwn(HTML_RAW_TEXT_ELEMENTS, key) && !HTML_RAW_TEXT_ELEMENTS[key];
104
+ }
105
+ function isHTMLEscapableRawTextElement(tagName) {
106
+ var key = tagName.toLowerCase();
107
+ return hasOwn(HTML_RAW_TEXT_ELEMENTS, key) && HTML_RAW_TEXT_ELEMENTS[key];
108
+ }
109
+ function isHTMLMimeType(mimeType) {
110
+ return mimeType === MIME_TYPE.HTML;
111
+ }
112
+ function hasDefaultHTMLNamespace(mimeType) {
113
+ return isHTMLMimeType(mimeType) || mimeType === MIME_TYPE.XML_XHTML_APPLICATION;
114
+ }
41
115
  var MIME_TYPE = freeze({
42
116
  HTML: "text/html",
43
- isHTML: function(value) {
44
- return value === MIME_TYPE.HTML;
45
- },
46
117
  XML_APPLICATION: "application/xml",
47
118
  XML_TEXT: "text/xml",
48
119
  XML_XHTML_APPLICATION: "application/xhtml+xml",
49
120
  XML_SVG_IMAGE: "image/svg+xml"
50
121
  });
122
+ var _MIME_TYPES = Object.keys(MIME_TYPE).map(function(key) {
123
+ return MIME_TYPE[key];
124
+ });
125
+ function isValidMimeType(mimeType) {
126
+ return _MIME_TYPES.indexOf(mimeType) > -1;
127
+ }
51
128
  var NAMESPACE = freeze({
52
129
  HTML: "http://www.w3.org/1999/xhtml",
53
- isHTML: function(uri) {
54
- return uri === NAMESPACE.HTML;
55
- },
56
130
  SVG: "http://www.w3.org/2000/svg",
57
131
  XML: "http://www.w3.org/XML/1998/namespace",
58
132
  XMLNS: "http://www.w3.org/2000/xmlns/"
@@ -60,15 +134,344 @@ var require_conventions = __commonJS((exports) => {
60
134
  exports.assign = assign;
61
135
  exports.find = find;
62
136
  exports.freeze = freeze;
137
+ exports.HTML_BOOLEAN_ATTRIBUTES = HTML_BOOLEAN_ATTRIBUTES;
138
+ exports.HTML_RAW_TEXT_ELEMENTS = HTML_RAW_TEXT_ELEMENTS;
139
+ exports.HTML_VOID_ELEMENTS = HTML_VOID_ELEMENTS;
140
+ exports.hasDefaultHTMLNamespace = hasDefaultHTMLNamespace;
141
+ exports.hasOwn = hasOwn;
142
+ exports.isHTMLBooleanAttribute = isHTMLBooleanAttribute;
143
+ exports.isHTMLRawTextElement = isHTMLRawTextElement;
144
+ exports.isHTMLEscapableRawTextElement = isHTMLEscapableRawTextElement;
145
+ exports.isHTMLMimeType = isHTMLMimeType;
146
+ exports.isHTMLVoidElement = isHTMLVoidElement;
147
+ exports.isValidMimeType = isValidMimeType;
63
148
  exports.MIME_TYPE = MIME_TYPE;
64
149
  exports.NAMESPACE = NAMESPACE;
65
150
  });
66
151
 
67
- // node_modules/.bun/@xmldom+xmldom@0.8.12/node_modules/@xmldom/xmldom/lib/dom.js
152
+ // node_modules/.bun/@xmldom+xmldom@0.9.10/node_modules/@xmldom/xmldom/lib/errors.js
153
+ var require_errors = __commonJS((exports) => {
154
+ var conventions = require_conventions();
155
+ function extendError(constructor, writableName) {
156
+ constructor.prototype = Object.create(Error.prototype, {
157
+ constructor: { value: constructor },
158
+ name: { value: constructor.name, enumerable: true, writable: writableName }
159
+ });
160
+ }
161
+ var DOMExceptionName = conventions.freeze({
162
+ Error: "Error",
163
+ IndexSizeError: "IndexSizeError",
164
+ DomstringSizeError: "DomstringSizeError",
165
+ HierarchyRequestError: "HierarchyRequestError",
166
+ WrongDocumentError: "WrongDocumentError",
167
+ InvalidCharacterError: "InvalidCharacterError",
168
+ NoDataAllowedError: "NoDataAllowedError",
169
+ NoModificationAllowedError: "NoModificationAllowedError",
170
+ NotFoundError: "NotFoundError",
171
+ NotSupportedError: "NotSupportedError",
172
+ InUseAttributeError: "InUseAttributeError",
173
+ InvalidStateError: "InvalidStateError",
174
+ SyntaxError: "SyntaxError",
175
+ InvalidModificationError: "InvalidModificationError",
176
+ NamespaceError: "NamespaceError",
177
+ InvalidAccessError: "InvalidAccessError",
178
+ ValidationError: "ValidationError",
179
+ TypeMismatchError: "TypeMismatchError",
180
+ SecurityError: "SecurityError",
181
+ NetworkError: "NetworkError",
182
+ AbortError: "AbortError",
183
+ URLMismatchError: "URLMismatchError",
184
+ QuotaExceededError: "QuotaExceededError",
185
+ TimeoutError: "TimeoutError",
186
+ InvalidNodeTypeError: "InvalidNodeTypeError",
187
+ DataCloneError: "DataCloneError",
188
+ EncodingError: "EncodingError",
189
+ NotReadableError: "NotReadableError",
190
+ UnknownError: "UnknownError",
191
+ ConstraintError: "ConstraintError",
192
+ DataError: "DataError",
193
+ TransactionInactiveError: "TransactionInactiveError",
194
+ ReadOnlyError: "ReadOnlyError",
195
+ VersionError: "VersionError",
196
+ OperationError: "OperationError",
197
+ NotAllowedError: "NotAllowedError",
198
+ OptOutError: "OptOutError"
199
+ });
200
+ var DOMExceptionNames = Object.keys(DOMExceptionName);
201
+ function isValidDomExceptionCode(value) {
202
+ return typeof value === "number" && value >= 1 && value <= 25;
203
+ }
204
+ function endsWithError(value) {
205
+ return typeof value === "string" && value.substring(value.length - DOMExceptionName.Error.length) === DOMExceptionName.Error;
206
+ }
207
+ function DOMException(messageOrCode, nameOrMessage) {
208
+ if (isValidDomExceptionCode(messageOrCode)) {
209
+ this.name = DOMExceptionNames[messageOrCode];
210
+ this.message = nameOrMessage || "";
211
+ } else {
212
+ this.message = messageOrCode;
213
+ this.name = endsWithError(nameOrMessage) ? nameOrMessage : DOMExceptionName.Error;
214
+ }
215
+ if (Error.captureStackTrace)
216
+ Error.captureStackTrace(this, DOMException);
217
+ }
218
+ extendError(DOMException, true);
219
+ Object.defineProperties(DOMException.prototype, {
220
+ code: {
221
+ enumerable: true,
222
+ get: function() {
223
+ var code = DOMExceptionNames.indexOf(this.name);
224
+ if (isValidDomExceptionCode(code))
225
+ return code;
226
+ return 0;
227
+ }
228
+ }
229
+ });
230
+ var ExceptionCode = {
231
+ INDEX_SIZE_ERR: 1,
232
+ DOMSTRING_SIZE_ERR: 2,
233
+ HIERARCHY_REQUEST_ERR: 3,
234
+ WRONG_DOCUMENT_ERR: 4,
235
+ INVALID_CHARACTER_ERR: 5,
236
+ NO_DATA_ALLOWED_ERR: 6,
237
+ NO_MODIFICATION_ALLOWED_ERR: 7,
238
+ NOT_FOUND_ERR: 8,
239
+ NOT_SUPPORTED_ERR: 9,
240
+ INUSE_ATTRIBUTE_ERR: 10,
241
+ INVALID_STATE_ERR: 11,
242
+ SYNTAX_ERR: 12,
243
+ INVALID_MODIFICATION_ERR: 13,
244
+ NAMESPACE_ERR: 14,
245
+ INVALID_ACCESS_ERR: 15,
246
+ VALIDATION_ERR: 16,
247
+ TYPE_MISMATCH_ERR: 17,
248
+ SECURITY_ERR: 18,
249
+ NETWORK_ERR: 19,
250
+ ABORT_ERR: 20,
251
+ URL_MISMATCH_ERR: 21,
252
+ QUOTA_EXCEEDED_ERR: 22,
253
+ TIMEOUT_ERR: 23,
254
+ INVALID_NODE_TYPE_ERR: 24,
255
+ DATA_CLONE_ERR: 25
256
+ };
257
+ var entries = Object.entries(ExceptionCode);
258
+ for (i = 0;i < entries.length; i++) {
259
+ key = entries[i][0];
260
+ DOMException[key] = entries[i][1];
261
+ }
262
+ var key;
263
+ var i;
264
+ function ParseError(message, locator) {
265
+ this.message = message;
266
+ this.locator = locator;
267
+ if (Error.captureStackTrace)
268
+ Error.captureStackTrace(this, ParseError);
269
+ }
270
+ extendError(ParseError);
271
+ exports.DOMException = DOMException;
272
+ exports.DOMExceptionName = DOMExceptionName;
273
+ exports.ExceptionCode = ExceptionCode;
274
+ exports.ParseError = ParseError;
275
+ });
276
+
277
+ // node_modules/.bun/@xmldom+xmldom@0.9.10/node_modules/@xmldom/xmldom/lib/grammar.js
278
+ var require_grammar = __commonJS((exports) => {
279
+ function detectUnicodeSupport(RegExpImpl) {
280
+ try {
281
+ if (typeof RegExpImpl !== "function") {
282
+ RegExpImpl = RegExp;
283
+ }
284
+ var match = new RegExpImpl("\uD834\uDF06", "u").exec("\uD834\uDF06");
285
+ return !!match && match[0].length === 2;
286
+ } catch (error) {}
287
+ return false;
288
+ }
289
+ var UNICODE_SUPPORT = detectUnicodeSupport();
290
+ function chars(regexp) {
291
+ if (regexp.source[0] !== "[") {
292
+ throw new Error(regexp + " can not be used with chars");
293
+ }
294
+ return regexp.source.slice(1, regexp.source.lastIndexOf("]"));
295
+ }
296
+ function chars_without(regexp, search) {
297
+ if (regexp.source[0] !== "[") {
298
+ throw new Error("/" + regexp.source + "/ can not be used with chars_without");
299
+ }
300
+ if (!search || typeof search !== "string") {
301
+ throw new Error(JSON.stringify(search) + " is not a valid search");
302
+ }
303
+ if (regexp.source.indexOf(search) === -1) {
304
+ throw new Error('"' + search + '" is not is /' + regexp.source + "/");
305
+ }
306
+ if (search === "-" && regexp.source.indexOf(search) !== 1) {
307
+ throw new Error('"' + search + '" is not at the first postion of /' + regexp.source + "/");
308
+ }
309
+ return new RegExp(regexp.source.replace(search, ""), UNICODE_SUPPORT ? "u" : "");
310
+ }
311
+ function reg(args) {
312
+ var self = this;
313
+ return new RegExp(Array.prototype.slice.call(arguments).map(function(part) {
314
+ var isStr = typeof part === "string";
315
+ if (isStr && self === undefined && part === "|") {
316
+ throw new Error("use regg instead of reg to wrap expressions with `|`!");
317
+ }
318
+ return isStr ? part : part.source;
319
+ }).join(""), UNICODE_SUPPORT ? "mu" : "m");
320
+ }
321
+ function regg(args) {
322
+ if (arguments.length === 0) {
323
+ throw new Error("no parameters provided");
324
+ }
325
+ return reg.apply(regg, ["(?:"].concat(Array.prototype.slice.call(arguments), [")"]));
326
+ }
327
+ var UNICODE_REPLACEMENT_CHARACTER = "\uFFFD";
328
+ var Char = /[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;
329
+ if (UNICODE_SUPPORT) {
330
+ Char = reg("[", chars(Char), "\\u{10000}-\\u{10FFFF}", "]");
331
+ }
332
+ var InvalidChar = new RegExp("[^" + chars(Char) + "]", UNICODE_SUPPORT ? "u" : "");
333
+ var _SChar = /[\x20\x09\x0D\x0A]/;
334
+ var SChar_s = chars(_SChar);
335
+ var S = reg(_SChar, "+");
336
+ var S_OPT = reg(_SChar, "*");
337
+ var NameStartChar = /[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
338
+ if (UNICODE_SUPPORT) {
339
+ NameStartChar = reg("[", chars(NameStartChar), "\\u{10000}-\\u{10FFFF}", "]");
340
+ }
341
+ var NameStartChar_s = chars(NameStartChar);
342
+ var NameChar = reg("[", NameStartChar_s, chars(/[-.0-9\xB7]/), chars(/[\u0300-\u036F\u203F-\u2040]/), "]");
343
+ var Name = reg(NameStartChar, NameChar, "*");
344
+ var Nmtoken = reg(NameChar, "+");
345
+ var EntityRef = reg("&", Name, ";");
346
+ var CharRef = regg(/&#[0-9]+;|&#x[0-9a-fA-F]+;/);
347
+ var Reference = regg(EntityRef, "|", CharRef);
348
+ var PEReference = reg("%", Name, ";");
349
+ var EntityValue = regg(reg('"', regg(/[^%&"]/, "|", PEReference, "|", Reference), "*", '"'), "|", reg("'", regg(/[^%&']/, "|", PEReference, "|", Reference), "*", "'"));
350
+ var AttValue = regg('"', regg(/[^<&"]/, "|", Reference), "*", '"', "|", "'", regg(/[^<&']/, "|", Reference), "*", "'");
351
+ var NCNameStartChar = chars_without(NameStartChar, ":");
352
+ var NCNameChar = chars_without(NameChar, ":");
353
+ var NCName = reg(NCNameStartChar, NCNameChar, "*");
354
+ var QName = reg(NCName, regg(":", NCName), "?");
355
+ var QName_exact = reg("^", QName, "$");
356
+ var QName_group = reg("(", QName, ")");
357
+ var SystemLiteral = regg(/"[^"]*"|'[^']*'/);
358
+ var PI = reg(/^<\?/, "(", Name, ")", regg(S, "(", Char, "*?)"), "?", /\?>/);
359
+ var PubidChar = /[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/;
360
+ var PubidLiteral = regg('"', PubidChar, '*"', "|", "'", chars_without(PubidChar, "'"), "*'");
361
+ var COMMENT_START = "<!--";
362
+ var COMMENT_END = "-->";
363
+ var Comment = reg(COMMENT_START, regg(chars_without(Char, "-"), "|", reg("-", chars_without(Char, "-"))), "*", COMMENT_END);
364
+ var PCDATA = "#PCDATA";
365
+ var Mixed = regg(reg(/\(/, S_OPT, PCDATA, regg(S_OPT, /\|/, S_OPT, QName), "*", S_OPT, /\)\*/), "|", reg(/\(/, S_OPT, PCDATA, S_OPT, /\)/));
366
+ var _children_quantity = /[?*+]?/;
367
+ var children2 = reg(/\([^>]+\)/, _children_quantity);
368
+ var contentspec = regg("EMPTY", "|", "ANY", "|", Mixed, "|", children2);
369
+ var ELEMENTDECL_START = "<!ELEMENT";
370
+ var elementdecl = reg(ELEMENTDECL_START, S, regg(QName, "|", PEReference), S, regg(contentspec, "|", PEReference), S_OPT, ">");
371
+ var NotationType = reg("NOTATION", S, /\(/, S_OPT, Name, regg(S_OPT, /\|/, S_OPT, Name), "*", S_OPT, /\)/);
372
+ var Enumeration = reg(/\(/, S_OPT, Nmtoken, regg(S_OPT, /\|/, S_OPT, Nmtoken), "*", S_OPT, /\)/);
373
+ var EnumeratedType = regg(NotationType, "|", Enumeration);
374
+ var AttType = regg(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/, "|", EnumeratedType);
375
+ var DefaultDecl = regg(/#REQUIRED|#IMPLIED/, "|", regg(regg("#FIXED", S), "?", AttValue));
376
+ var AttDef = regg(S, Name, S, AttType, S, DefaultDecl);
377
+ var ATTLIST_DECL_START = "<!ATTLIST";
378
+ var AttlistDecl = reg(ATTLIST_DECL_START, S, Name, AttDef, "*", S_OPT, ">");
379
+ var ABOUT_LEGACY_COMPAT = "about:legacy-compat";
380
+ var ABOUT_LEGACY_COMPAT_SystemLiteral = regg('"' + ABOUT_LEGACY_COMPAT + '"', "|", "'" + ABOUT_LEGACY_COMPAT + "'");
381
+ var SYSTEM = "SYSTEM";
382
+ var PUBLIC = "PUBLIC";
383
+ var ExternalID = regg(regg(SYSTEM, S, SystemLiteral), "|", regg(PUBLIC, S, PubidLiteral, S, SystemLiteral));
384
+ var ExternalID_match = reg("^", regg(regg(SYSTEM, S, "(?<SystemLiteralOnly>", SystemLiteral, ")"), "|", regg(PUBLIC, S, "(?<PubidLiteral>", PubidLiteral, ")", S, "(?<SystemLiteral>", SystemLiteral, ")")));
385
+ var PubidLiteral_match = reg("^", PubidLiteral, "$");
386
+ var SystemLiteral_match = reg("^", SystemLiteral, "$");
387
+ var NDataDecl = regg(S, "NDATA", S, Name);
388
+ var EntityDef = regg(EntityValue, "|", regg(ExternalID, NDataDecl, "?"));
389
+ var ENTITY_DECL_START = "<!ENTITY";
390
+ var GEDecl = reg(ENTITY_DECL_START, S, Name, S, EntityDef, S_OPT, ">");
391
+ var PEDef = regg(EntityValue, "|", ExternalID);
392
+ var PEDecl = reg(ENTITY_DECL_START, S, "%", S, Name, S, PEDef, S_OPT, ">");
393
+ var EntityDecl = regg(GEDecl, "|", PEDecl);
394
+ var PublicID = reg(PUBLIC, S, PubidLiteral);
395
+ var NotationDecl = reg("<!NOTATION", S, Name, S, regg(ExternalID, "|", PublicID), S_OPT, ">");
396
+ var Eq = reg(S_OPT, "=", S_OPT);
397
+ var VersionNum = /1[.]\d+/;
398
+ var VersionInfo = reg(S, "version", Eq, regg("'", VersionNum, "'", "|", '"', VersionNum, '"'));
399
+ var EncName = /[A-Za-z][-A-Za-z0-9._]*/;
400
+ var EncodingDecl = regg(S, "encoding", Eq, regg('"', EncName, '"', "|", "'", EncName, "'"));
401
+ var SDDecl = regg(S, "standalone", Eq, regg("'", regg("yes", "|", "no"), "'", "|", '"', regg("yes", "|", "no"), '"'));
402
+ var XMLDecl = reg(/^<\?xml/, VersionInfo, EncodingDecl, "?", SDDecl, "?", S_OPT, /\?>/);
403
+ var DOCTYPE_DECL_START = "<!DOCTYPE";
404
+ var CDATA_START = "<![CDATA[";
405
+ var CDATA_END = "]]>";
406
+ var CDStart = /<!\[CDATA\[/;
407
+ var CDEnd = /\]\]>/;
408
+ var CData = reg(Char, "*?", CDEnd);
409
+ var CDSect = reg(CDStart, CData);
410
+ exports.chars = chars;
411
+ exports.chars_without = chars_without;
412
+ exports.detectUnicodeSupport = detectUnicodeSupport;
413
+ exports.reg = reg;
414
+ exports.regg = regg;
415
+ exports.ABOUT_LEGACY_COMPAT = ABOUT_LEGACY_COMPAT;
416
+ exports.ABOUT_LEGACY_COMPAT_SystemLiteral = ABOUT_LEGACY_COMPAT_SystemLiteral;
417
+ exports.AttlistDecl = AttlistDecl;
418
+ exports.CDATA_START = CDATA_START;
419
+ exports.CDATA_END = CDATA_END;
420
+ exports.CDSect = CDSect;
421
+ exports.Char = Char;
422
+ exports.Comment = Comment;
423
+ exports.COMMENT_START = COMMENT_START;
424
+ exports.COMMENT_END = COMMENT_END;
425
+ exports.DOCTYPE_DECL_START = DOCTYPE_DECL_START;
426
+ exports.elementdecl = elementdecl;
427
+ exports.EntityDecl = EntityDecl;
428
+ exports.EntityValue = EntityValue;
429
+ exports.ExternalID = ExternalID;
430
+ exports.ExternalID_match = ExternalID_match;
431
+ exports.Name = Name;
432
+ exports.NotationDecl = NotationDecl;
433
+ exports.Reference = Reference;
434
+ exports.PEReference = PEReference;
435
+ exports.PI = PI;
436
+ exports.PUBLIC = PUBLIC;
437
+ exports.PubidLiteral = PubidLiteral;
438
+ exports.PubidLiteral_match = PubidLiteral_match;
439
+ exports.QName = QName;
440
+ exports.QName_exact = QName_exact;
441
+ exports.QName_group = QName_group;
442
+ exports.S = S;
443
+ exports.SChar_s = SChar_s;
444
+ exports.S_OPT = S_OPT;
445
+ exports.SYSTEM = SYSTEM;
446
+ exports.SystemLiteral = SystemLiteral;
447
+ exports.SystemLiteral_match = SystemLiteral_match;
448
+ exports.InvalidChar = InvalidChar;
449
+ exports.UNICODE_REPLACEMENT_CHARACTER = UNICODE_REPLACEMENT_CHARACTER;
450
+ exports.UNICODE_SUPPORT = UNICODE_SUPPORT;
451
+ exports.XMLDecl = XMLDecl;
452
+ });
453
+
454
+ // node_modules/.bun/@xmldom+xmldom@0.9.10/node_modules/@xmldom/xmldom/lib/dom.js
68
455
  var require_dom = __commonJS((exports) => {
69
456
  var conventions = require_conventions();
70
457
  var find = conventions.find;
458
+ var hasDefaultHTMLNamespace = conventions.hasDefaultHTMLNamespace;
459
+ var hasOwn = conventions.hasOwn;
460
+ var isHTMLMimeType = conventions.isHTMLMimeType;
461
+ var isHTMLRawTextElement = conventions.isHTMLRawTextElement;
462
+ var isHTMLVoidElement = conventions.isHTMLVoidElement;
463
+ var MIME_TYPE = conventions.MIME_TYPE;
71
464
  var NAMESPACE = conventions.NAMESPACE;
465
+ var PDC = Symbol();
466
+ var errors = require_errors();
467
+ var DOMException = errors.DOMException;
468
+ var DOMExceptionName = errors.DOMExceptionName;
469
+ var g = require_grammar();
470
+ function checkSymbol(symbol) {
471
+ if (symbol !== PDC) {
472
+ throw new TypeError("Illegal constructor");
473
+ }
474
+ }
72
475
  function notEmptyString(input) {
73
476
  return input !== "";
74
477
  }
@@ -76,7 +479,7 @@ var require_dom = __commonJS((exports) => {
76
479
  return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : [];
77
480
  }
78
481
  function orderedSetReducer(current, element) {
79
- if (!current.hasOwnProperty(element)) {
482
+ if (!hasOwn(current, element)) {
80
483
  current[element] = true;
81
484
  }
82
485
  return current;
@@ -92,9 +495,38 @@ var require_dom = __commonJS((exports) => {
92
495
  return list && list.indexOf(element) !== -1;
93
496
  };
94
497
  }
498
+ function validateQualifiedName(qualifiedName) {
499
+ if (!g.QName_exact.test(qualifiedName)) {
500
+ throw new DOMException(DOMException.INVALID_CHARACTER_ERR, 'invalid character in qualified name "' + qualifiedName + '"');
501
+ }
502
+ }
503
+ function validateAndExtract(namespace, qualifiedName) {
504
+ validateQualifiedName(qualifiedName);
505
+ namespace = namespace || null;
506
+ var prefix = null;
507
+ var localName = qualifiedName;
508
+ if (qualifiedName.indexOf(":") >= 0) {
509
+ var splitResult = qualifiedName.split(":");
510
+ prefix = splitResult[0];
511
+ localName = splitResult[1];
512
+ }
513
+ if (prefix !== null && namespace === null) {
514
+ throw new DOMException(DOMException.NAMESPACE_ERR, "prefix is non-null and namespace is null");
515
+ }
516
+ if (prefix === "xml" && namespace !== conventions.NAMESPACE.XML) {
517
+ throw new DOMException(DOMException.NAMESPACE_ERR, 'prefix is "xml" and namespace is not the XML namespace');
518
+ }
519
+ if ((prefix === "xmlns" || qualifiedName === "xmlns") && namespace !== conventions.NAMESPACE.XMLNS) {
520
+ throw new DOMException(DOMException.NAMESPACE_ERR, 'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');
521
+ }
522
+ if (namespace === conventions.NAMESPACE.XMLNS && prefix !== "xmlns" && qualifiedName !== "xmlns") {
523
+ throw new DOMException(DOMException.NAMESPACE_ERR, 'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');
524
+ }
525
+ return [namespace, prefix, localName];
526
+ }
95
527
  function copy(src, dest) {
96
528
  for (var p in src) {
97
- if (Object.prototype.hasOwnProperty.call(src, p)) {
529
+ if (hasOwn(src, p)) {
98
530
  dest[p] = src[p];
99
531
  }
100
532
  }
@@ -102,12 +534,11 @@ var require_dom = __commonJS((exports) => {
102
534
  function _extends(Class, Super) {
103
535
  var pt = Class.prototype;
104
536
  if (!(pt instanceof Super)) {
105
- let t2 = function() {};
106
- var t = t2;
107
- t2.prototype = Super.prototype;
108
- t2 = new t2;
109
- copy(pt, t2);
110
- Class.prototype = pt = t2;
537
+ let t = function() {};
538
+ t.prototype = Super.prototype;
539
+ t = new t;
540
+ copy(pt, t);
541
+ Class.prototype = pt = t;
111
542
  }
112
543
  if (pt.constructor != Class) {
113
544
  if (typeof Class != "function") {
@@ -129,49 +560,51 @@ var require_dom = __commonJS((exports) => {
129
560
  var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;
130
561
  var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;
131
562
  var NOTATION_NODE = NodeType.NOTATION_NODE = 12;
132
- var ExceptionCode = {};
133
- var ExceptionMessage = {};
134
- var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = (ExceptionMessage[1] = "Index size error", 1);
135
- var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = (ExceptionMessage[2] = "DOMString size error", 2);
136
- var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = (ExceptionMessage[3] = "Hierarchy request error", 3);
137
- var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = (ExceptionMessage[4] = "Wrong document", 4);
138
- var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = (ExceptionMessage[5] = "Invalid character", 5);
139
- var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = (ExceptionMessage[6] = "No data allowed", 6);
140
- var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = (ExceptionMessage[7] = "No modification allowed", 7);
141
- var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = (ExceptionMessage[8] = "Not found", 8);
142
- var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = (ExceptionMessage[9] = "Not supported", 9);
143
- var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = (ExceptionMessage[10] = "Attribute in use", 10);
144
- var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = (ExceptionMessage[11] = "Invalid state", 11);
145
- var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = (ExceptionMessage[12] = "Syntax error", 12);
146
- var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = "Invalid modification", 13);
147
- var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = "Invalid namespace", 14);
148
- var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = "Invalid access", 15);
149
- function DOMException(code, message) {
150
- if (message instanceof Error) {
151
- var error = message;
152
- } else {
153
- error = this;
154
- Error.call(this, ExceptionMessage[code]);
155
- this.message = ExceptionMessage[code];
156
- if (Error.captureStackTrace)
157
- Error.captureStackTrace(this, DOMException);
563
+ var DocumentPosition = conventions.freeze({
564
+ DOCUMENT_POSITION_DISCONNECTED: 1,
565
+ DOCUMENT_POSITION_PRECEDING: 2,
566
+ DOCUMENT_POSITION_FOLLOWING: 4,
567
+ DOCUMENT_POSITION_CONTAINS: 8,
568
+ DOCUMENT_POSITION_CONTAINED_BY: 16,
569
+ DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32
570
+ });
571
+ function commonAncestor(a, b) {
572
+ if (b.length < a.length)
573
+ return commonAncestor(b, a);
574
+ var c = null;
575
+ for (var n in a) {
576
+ if (a[n] !== b[n])
577
+ return c;
578
+ c = a[n];
158
579
  }
159
- error.code = code;
160
- if (message)
161
- this.message = this.message + ": " + message;
162
- return error;
580
+ return c;
581
+ }
582
+ function docGUID(doc) {
583
+ if (!doc.guid)
584
+ doc.guid = Math.random();
585
+ return doc.guid;
163
586
  }
164
- DOMException.prototype = Error.prototype;
165
- copy(ExceptionCode, DOMException);
166
587
  function NodeList() {}
167
588
  NodeList.prototype = {
168
589
  length: 0,
169
590
  item: function(index) {
170
591
  return index >= 0 && index < this.length ? this[index] : null;
171
592
  },
172
- toString: function(isHTML, nodeFilter) {
593
+ toString: function(options) {
594
+ var opts;
595
+ if (typeof options === "function") {
596
+ opts = { requireWellFormed: false, splitCDATASections: true, nodeFilter: options };
597
+ } else if (!!options) {
598
+ opts = {
599
+ requireWellFormed: !!options.requireWellFormed,
600
+ splitCDATASections: options.splitCDATASections !== false,
601
+ nodeFilter: options.nodeFilter || null
602
+ };
603
+ } else {
604
+ opts = { requireWellFormed: false, splitCDATASections: true, nodeFilter: null };
605
+ }
173
606
  for (var buf = [], i = 0;i < this.length; i++) {
174
- serializeToString(this[i], buf, isHTML, nodeFilter);
607
+ serializeToString(this[i], buf, null, opts);
175
608
  }
176
609
  return buf.join("");
177
610
  },
@@ -182,6 +615,29 @@ var require_dom = __commonJS((exports) => {
182
615
  return Array.prototype.indexOf.call(this, item);
183
616
  }
184
617
  };
618
+ NodeList.prototype[Symbol.iterator] = function() {
619
+ var me = this;
620
+ var index = 0;
621
+ return {
622
+ next: function() {
623
+ if (index < me.length) {
624
+ return {
625
+ value: me[index++],
626
+ done: false
627
+ };
628
+ } else {
629
+ return {
630
+ done: true
631
+ };
632
+ }
633
+ },
634
+ return: function() {
635
+ return {
636
+ done: true
637
+ };
638
+ }
639
+ };
640
+ };
185
641
  function LiveNodeList(node, refresh) {
186
642
  this._node = node;
187
643
  this._refresh = refresh;
@@ -194,7 +650,7 @@ var require_dom = __commonJS((exports) => {
194
650
  __set__(list, "length", ls.length);
195
651
  if (!list.$$length || ls.length < list.$$length) {
196
652
  for (var i = ls.length;i in list; i++) {
197
- if (Object.prototype.hasOwnProperty.call(list, i)) {
653
+ if (hasOwn(list, i)) {
198
654
  delete list[i];
199
655
  }
200
656
  }
@@ -210,18 +666,20 @@ var require_dom = __commonJS((exports) => {
210
666
  _extends(LiveNodeList, NodeList);
211
667
  function NamedNodeMap() {}
212
668
  function _findNodeIndex(list, node) {
213
- var i = list.length;
214
- while (i--) {
669
+ var i = 0;
670
+ while (i < list.length) {
215
671
  if (list[i] === node) {
216
672
  return i;
217
673
  }
674
+ i++;
218
675
  }
219
676
  }
220
677
  function _addNamedNode(el, list, newAttr, oldAttr) {
221
678
  if (oldAttr) {
222
679
  list[_findNodeIndex(list, oldAttr)] = newAttr;
223
680
  } else {
224
- list[list.length++] = newAttr;
681
+ list[list.length] = newAttr;
682
+ list.length++;
225
683
  }
226
684
  if (el) {
227
685
  newAttr.ownerElement = el;
@@ -236,7 +694,7 @@ var require_dom = __commonJS((exports) => {
236
694
  var i = _findNodeIndex(list, attr);
237
695
  if (i >= 0) {
238
696
  var lastIndex = list.length - 1;
239
- while (i < lastIndex) {
697
+ while (i <= lastIndex) {
240
698
  list[i] = list[++i];
241
699
  }
242
700
  list.length = lastIndex;
@@ -244,71 +702,110 @@ var require_dom = __commonJS((exports) => {
244
702
  var doc = el.ownerDocument;
245
703
  if (doc) {
246
704
  _onRemoveAttribute(doc, el, attr);
247
- attr.ownerElement = null;
248
705
  }
706
+ attr.ownerElement = null;
249
707
  }
250
- } else {
251
- throw new DOMException(NOT_FOUND_ERR, new Error(el.tagName + "@" + attr));
252
708
  }
253
709
  }
254
710
  NamedNodeMap.prototype = {
255
711
  length: 0,
256
712
  item: NodeList.prototype.item,
257
- getNamedItem: function(key) {
258
- var i = this.length;
259
- while (i--) {
713
+ getNamedItem: function(localName) {
714
+ if (this._ownerElement && this._ownerElement._isInHTMLDocumentAndNamespace()) {
715
+ localName = localName.toLowerCase();
716
+ }
717
+ var i = 0;
718
+ while (i < this.length) {
260
719
  var attr = this[i];
261
- if (attr.nodeName == key) {
720
+ if (attr.nodeName === localName) {
262
721
  return attr;
263
722
  }
723
+ i++;
264
724
  }
725
+ return null;
265
726
  },
266
727
  setNamedItem: function(attr) {
267
728
  var el = attr.ownerElement;
268
- if (el && el != this._ownerElement) {
269
- throw new DOMException(INUSE_ATTRIBUTE_ERR);
729
+ if (el && el !== this._ownerElement) {
730
+ throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR);
731
+ }
732
+ var oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);
733
+ if (oldAttr === attr) {
734
+ return attr;
270
735
  }
271
- var oldAttr = this.getNamedItem(attr.nodeName);
272
736
  _addNamedNode(this._ownerElement, this, attr, oldAttr);
273
737
  return oldAttr;
274
738
  },
275
739
  setNamedItemNS: function(attr) {
276
- var el = attr.ownerElement, oldAttr;
277
- if (el && el != this._ownerElement) {
278
- throw new DOMException(INUSE_ATTRIBUTE_ERR);
279
- }
280
- oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);
281
- _addNamedNode(this._ownerElement, this, attr, oldAttr);
282
- return oldAttr;
740
+ return this.setNamedItem(attr);
283
741
  },
284
- removeNamedItem: function(key) {
285
- var attr = this.getNamedItem(key);
742
+ removeNamedItem: function(localName) {
743
+ var attr = this.getNamedItem(localName);
744
+ if (!attr) {
745
+ throw new DOMException(DOMException.NOT_FOUND_ERR, localName);
746
+ }
286
747
  _removeNamedNode(this._ownerElement, this, attr);
287
748
  return attr;
288
749
  },
289
750
  removeNamedItemNS: function(namespaceURI, localName) {
290
751
  var attr = this.getNamedItemNS(namespaceURI, localName);
752
+ if (!attr) {
753
+ throw new DOMException(DOMException.NOT_FOUND_ERR, namespaceURI ? namespaceURI + " : " + localName : localName);
754
+ }
291
755
  _removeNamedNode(this._ownerElement, this, attr);
292
756
  return attr;
293
757
  },
294
758
  getNamedItemNS: function(namespaceURI, localName) {
295
- var i = this.length;
296
- while (i--) {
759
+ if (!namespaceURI) {
760
+ namespaceURI = null;
761
+ }
762
+ var i = 0;
763
+ while (i < this.length) {
297
764
  var node = this[i];
298
- if (node.localName == localName && node.namespaceURI == namespaceURI) {
765
+ if (node.localName === localName && node.namespaceURI === namespaceURI) {
299
766
  return node;
300
767
  }
768
+ i++;
301
769
  }
302
770
  return null;
303
771
  }
304
772
  };
773
+ NamedNodeMap.prototype[Symbol.iterator] = function() {
774
+ var me = this;
775
+ var index = 0;
776
+ return {
777
+ next: function() {
778
+ if (index < me.length) {
779
+ return {
780
+ value: me[index++],
781
+ done: false
782
+ };
783
+ } else {
784
+ return {
785
+ done: true
786
+ };
787
+ }
788
+ },
789
+ return: function() {
790
+ return {
791
+ done: true
792
+ };
793
+ }
794
+ };
795
+ };
305
796
  function DOMImplementation() {}
306
797
  DOMImplementation.prototype = {
307
798
  hasFeature: function(feature, version) {
308
799
  return true;
309
800
  },
310
801
  createDocument: function(namespaceURI, qualifiedName, doctype) {
311
- var doc = new Document;
802
+ var contentType = MIME_TYPE.XML_APPLICATION;
803
+ if (namespaceURI === NAMESPACE.HTML) {
804
+ contentType = MIME_TYPE.XML_XHTML_APPLICATION;
805
+ } else if (namespaceURI === NAMESPACE.SVG) {
806
+ contentType = MIME_TYPE.XML_SVG_IMAGE;
807
+ }
808
+ var doc = new Document(PDC, { contentType });
312
809
  doc.implementation = this;
313
810
  doc.childNodes = new NodeList;
314
811
  doc.doctype = doctype || null;
@@ -321,29 +818,148 @@ var require_dom = __commonJS((exports) => {
321
818
  }
322
819
  return doc;
323
820
  },
324
- createDocumentType: function(qualifiedName, publicId, systemId) {
325
- var node = new DocumentType;
821
+ createDocumentType: function(qualifiedName, publicId, systemId, internalSubset) {
822
+ validateQualifiedName(qualifiedName);
823
+ var node = new DocumentType(PDC);
326
824
  node.name = qualifiedName;
327
825
  node.nodeName = qualifiedName;
328
826
  node.publicId = publicId || "";
329
827
  node.systemId = systemId || "";
828
+ node.internalSubset = internalSubset || "";
829
+ node.childNodes = new NodeList;
330
830
  return node;
831
+ },
832
+ createHTMLDocument: function(title) {
833
+ var doc = new Document(PDC, { contentType: MIME_TYPE.HTML });
834
+ doc.implementation = this;
835
+ doc.childNodes = new NodeList;
836
+ if (title !== false) {
837
+ doc.doctype = this.createDocumentType("html");
838
+ doc.doctype.ownerDocument = doc;
839
+ doc.appendChild(doc.doctype);
840
+ var htmlNode = doc.createElement("html");
841
+ doc.appendChild(htmlNode);
842
+ var headNode = doc.createElement("head");
843
+ htmlNode.appendChild(headNode);
844
+ if (typeof title === "string") {
845
+ var titleNode = doc.createElement("title");
846
+ titleNode.appendChild(doc.createTextNode(title));
847
+ headNode.appendChild(titleNode);
848
+ }
849
+ htmlNode.appendChild(doc.createElement("body"));
850
+ }
851
+ return doc;
331
852
  }
332
853
  };
333
- function Node() {}
854
+ function Node(symbol) {
855
+ checkSymbol(symbol);
856
+ }
334
857
  Node.prototype = {
335
858
  firstChild: null,
336
859
  lastChild: null,
337
860
  previousSibling: null,
338
861
  nextSibling: null,
339
- attributes: null,
340
862
  parentNode: null,
863
+ get parentElement() {
864
+ return this.parentNode && this.parentNode.nodeType === this.ELEMENT_NODE ? this.parentNode : null;
865
+ },
341
866
  childNodes: null,
342
867
  ownerDocument: null,
343
868
  nodeValue: null,
344
869
  namespaceURI: null,
345
870
  prefix: null,
346
871
  localName: null,
872
+ baseURI: "about:blank",
873
+ get isConnected() {
874
+ var rootNode = this.getRootNode();
875
+ return rootNode && rootNode.nodeType === rootNode.DOCUMENT_NODE;
876
+ },
877
+ contains: function(other) {
878
+ if (!other)
879
+ return false;
880
+ var parent = other;
881
+ do {
882
+ if (this === parent)
883
+ return true;
884
+ parent = parent.parentNode;
885
+ } while (parent);
886
+ return false;
887
+ },
888
+ getRootNode: function(options) {
889
+ var parent = this;
890
+ do {
891
+ if (!parent.parentNode) {
892
+ return parent;
893
+ }
894
+ parent = parent.parentNode;
895
+ } while (parent);
896
+ },
897
+ isEqualNode: function(otherNode) {
898
+ if (!otherNode)
899
+ return false;
900
+ var stack = [{ node: this, other: otherNode }];
901
+ while (stack.length > 0) {
902
+ var pair = stack.pop();
903
+ var node = pair.node;
904
+ var other = pair.other;
905
+ if (node.nodeType !== other.nodeType)
906
+ return false;
907
+ switch (node.nodeType) {
908
+ case node.DOCUMENT_TYPE_NODE:
909
+ if (node.name !== other.name)
910
+ return false;
911
+ if (node.publicId !== other.publicId)
912
+ return false;
913
+ if (node.systemId !== other.systemId)
914
+ return false;
915
+ break;
916
+ case node.ELEMENT_NODE:
917
+ if (node.namespaceURI !== other.namespaceURI)
918
+ return false;
919
+ if (node.prefix !== other.prefix)
920
+ return false;
921
+ if (node.localName !== other.localName)
922
+ return false;
923
+ if (node.attributes.length !== other.attributes.length)
924
+ return false;
925
+ for (var i = 0;i < node.attributes.length; i++) {
926
+ var attr = node.attributes.item(i);
927
+ var otherAttr = other.getAttributeNodeNS(attr.namespaceURI, attr.localName);
928
+ if (!otherAttr)
929
+ return false;
930
+ stack.push({ node: attr, other: otherAttr });
931
+ }
932
+ break;
933
+ case node.ATTRIBUTE_NODE:
934
+ if (node.namespaceURI !== other.namespaceURI)
935
+ return false;
936
+ if (node.localName !== other.localName)
937
+ return false;
938
+ if (node.value !== other.value)
939
+ return false;
940
+ break;
941
+ case node.PROCESSING_INSTRUCTION_NODE:
942
+ if (node.target !== other.target || node.data !== other.data)
943
+ return false;
944
+ break;
945
+ case node.TEXT_NODE:
946
+ case node.CDATA_SECTION_NODE:
947
+ case node.COMMENT_NODE:
948
+ if (node.data !== other.data)
949
+ return false;
950
+ break;
951
+ }
952
+ if (node.childNodes.length !== other.childNodes.length)
953
+ return false;
954
+ for (var i = node.childNodes.length - 1;i >= 0; i--) {
955
+ stack.push({ node: node.childNodes[i], other: other.childNodes[i] });
956
+ }
957
+ }
958
+ return true;
959
+ },
960
+ isSameNode: function(otherNode) {
961
+ return this === otherNode;
962
+ },
347
963
  insertBefore: function(newChild, refChild) {
348
964
  return _insertBefore(this, newChild, refChild);
349
965
  },
@@ -366,31 +982,32 @@ var require_dom = __commonJS((exports) => {
366
982
  return cloneNode(this.ownerDocument || this, this, deep);
367
983
  },
368
984
  normalize: function() {
369
- var child = this.firstChild;
370
- while (child) {
371
- var next = child.nextSibling;
372
- if (next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE) {
373
- this.removeChild(next);
374
- child.appendData(next.data);
375
- } else {
376
- child.normalize();
377
- child = next;
985
+ walkDOM(this, null, {
986
+ enter: function(node) {
987
+ var child = node.firstChild;
988
+ while (child) {
989
+ var next = child.nextSibling;
990
+ if (next !== null && next.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE) {
991
+ node.removeChild(next);
992
+ child.appendData(next.data);
993
+ } else {
994
+ child = next;
995
+ }
996
+ }
997
+ return true;
378
998
  }
379
- }
999
+ });
380
1000
  },
381
1001
  isSupported: function(feature, version) {
382
1002
  return this.ownerDocument.implementation.hasFeature(feature, version);
383
1003
  },
384
- hasAttributes: function() {
385
- return this.attributes.length > 0;
386
- },
387
1004
  lookupPrefix: function(namespaceURI) {
388
1005
  var el = this;
389
1006
  while (el) {
390
1007
  var map = el._nsMap;
391
1008
  if (map) {
392
1009
  for (var n in map) {
393
- if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) {
1010
+ if (hasOwn(map, n) && map[n] === namespaceURI) {
394
1011
  return n;
395
1012
  }
396
1013
  }
@@ -404,7 +1021,7 @@ var require_dom = __commonJS((exports) => {
404
1021
  while (el) {
405
1022
  var map = el._nsMap;
406
1023
  if (map) {
407
- if (Object.prototype.hasOwnProperty.call(map, prefix)) {
1024
+ if (hasOwn(map, prefix)) {
408
1025
  return map[prefix];
409
1026
  }
410
1027
  }
@@ -415,6 +1032,72 @@ var require_dom = __commonJS((exports) => {
415
1032
  isDefaultNamespace: function(namespaceURI) {
416
1033
  var prefix = this.lookupPrefix(namespaceURI);
417
1034
  return prefix == null;
1035
+ },
1036
+ compareDocumentPosition: function(other) {
1037
+ if (this === other)
1038
+ return 0;
1039
+ var node1 = other;
1040
+ var node2 = this;
1041
+ var attr1 = null;
1042
+ var attr2 = null;
1043
+ if (node1 instanceof Attr) {
1044
+ attr1 = node1;
1045
+ node1 = attr1.ownerElement;
1046
+ }
1047
+ if (node2 instanceof Attr) {
1048
+ attr2 = node2;
1049
+ node2 = attr2.ownerElement;
1050
+ if (attr1 && node1 && node2 === node1) {
1051
+ for (var i = 0, attr;attr = node2.attributes[i]; i++) {
1052
+ if (attr === attr1)
1053
+ return DocumentPosition.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + DocumentPosition.DOCUMENT_POSITION_PRECEDING;
1054
+ if (attr === attr2)
1055
+ return DocumentPosition.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + DocumentPosition.DOCUMENT_POSITION_FOLLOWING;
1056
+ }
1057
+ }
1058
+ }
1059
+ if (!node1 || !node2 || node2.ownerDocument !== node1.ownerDocument) {
1060
+ return DocumentPosition.DOCUMENT_POSITION_DISCONNECTED + DocumentPosition.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + (docGUID(node2.ownerDocument) > docGUID(node1.ownerDocument) ? DocumentPosition.DOCUMENT_POSITION_FOLLOWING : DocumentPosition.DOCUMENT_POSITION_PRECEDING);
1061
+ }
1062
+ if (attr2 && node1 === node2) {
1063
+ return DocumentPosition.DOCUMENT_POSITION_CONTAINS + DocumentPosition.DOCUMENT_POSITION_PRECEDING;
1064
+ }
1065
+ if (attr1 && node1 === node2) {
1066
+ return DocumentPosition.DOCUMENT_POSITION_CONTAINED_BY + DocumentPosition.DOCUMENT_POSITION_FOLLOWING;
1067
+ }
1068
+ var chain1 = [];
1069
+ var ancestor1 = node1.parentNode;
1070
+ while (ancestor1) {
1071
+ if (!attr2 && ancestor1 === node2) {
1072
+ return DocumentPosition.DOCUMENT_POSITION_CONTAINED_BY + DocumentPosition.DOCUMENT_POSITION_FOLLOWING;
1073
+ }
1074
+ chain1.push(ancestor1);
1075
+ ancestor1 = ancestor1.parentNode;
1076
+ }
1077
+ chain1.reverse();
1078
+ var chain2 = [];
1079
+ var ancestor2 = node2.parentNode;
1080
+ while (ancestor2) {
1081
+ if (!attr1 && ancestor2 === node1) {
1082
+ return DocumentPosition.DOCUMENT_POSITION_CONTAINS + DocumentPosition.DOCUMENT_POSITION_PRECEDING;
1083
+ }
1084
+ chain2.push(ancestor2);
1085
+ ancestor2 = ancestor2.parentNode;
1086
+ }
1087
+ chain2.reverse();
1088
+ var ca = commonAncestor(chain1, chain2);
1089
+ for (var n in ca.childNodes) {
1090
+ var child = ca.childNodes[n];
1091
+ if (child === node2)
1092
+ return DocumentPosition.DOCUMENT_POSITION_FOLLOWING;
1093
+ if (child === node1)
1094
+ return DocumentPosition.DOCUMENT_POSITION_PRECEDING;
1095
+ if (chain2.indexOf(child) >= 0)
1096
+ return DocumentPosition.DOCUMENT_POSITION_FOLLOWING;
1097
+ if (chain1.indexOf(child) >= 0)
1098
+ return DocumentPosition.DOCUMENT_POSITION_PRECEDING;
1099
+ }
1100
+ return 0;
418
1101
  }
419
1102
  };
420
1103
  function _xmlEncoder(c) {
@@ -422,20 +1105,49 @@ var require_dom = __commonJS((exports) => {
422
1105
  }
423
1106
  copy(NodeType, Node);
424
1107
  copy(NodeType, Node.prototype);
1108
+ copy(DocumentPosition, Node);
1109
+ copy(DocumentPosition, Node.prototype);
425
1110
  function _visitNode(node, callback) {
426
- if (callback(node)) {
427
- return true;
428
- }
429
- if (node = node.firstChild) {
430
- do {
431
- if (_visitNode(node, callback)) {
432
- return true;
1111
+ walkDOM(node, null, {
1112
+ enter: function(n) {
1113
+ return callback(n) ? walkDOM.STOP : true;
1114
+ }
1115
+ });
1116
+ }
1117
+ function walkDOM(node, context, callbacks) {
1118
+ var stack = [{ node, context, phase: walkDOM.ENTER }];
1119
+ while (stack.length > 0) {
1120
+ var frame = stack.pop();
1121
+ if (frame.phase === walkDOM.ENTER) {
1122
+ var childContext = callbacks.enter(frame.node, frame.context);
1123
+ if (childContext === walkDOM.STOP) {
1124
+ return walkDOM.STOP;
1125
+ }
1126
+ stack.push({ node: frame.node, context: childContext, phase: walkDOM.EXIT });
1127
+ if (childContext === null || childContext === undefined) {
1128
+ continue;
433
1129
  }
434
- } while (node = node.nextSibling);
1130
+ var child = frame.node.lastChild;
1131
+ while (child) {
1132
+ stack.push({ node: child, context: childContext, phase: walkDOM.ENTER });
1133
+ child = child.previousSibling;
1134
+ }
1135
+ } else {
1136
+ if (callbacks.exit) {
1137
+ callbacks.exit(frame.node, frame.context);
1138
+ }
1139
+ }
435
1140
  }
436
1141
  }
437
- function Document() {
1142
+ walkDOM.STOP = Symbol("walkDOM.STOP");
1143
+ walkDOM.ENTER = 0;
1144
+ walkDOM.EXIT = 1;
1145
+ function Document(symbol, options) {
1146
+ checkSymbol(symbol);
1147
+ var opt = options || {};
438
1148
  this.ownerDocument = this;
1149
+ this.contentType = opt.contentType || MIME_TYPE.XML_APPLICATION;
1150
+ this.type = isHTMLMimeType(this.contentType) ? "html" : "xml";
439
1151
  }
440
1152
  function _onAddAttribute(doc, el, newAttr) {
441
1153
  doc && doc._inc++;
@@ -451,48 +1163,51 @@ var require_dom = __commonJS((exports) => {
451
1163
  delete el._nsMap[newAttr.prefix ? newAttr.localName : ""];
452
1164
  }
453
1165
  }
454
- function _onUpdateChild(doc, el, newChild) {
1166
+ function _onUpdateChild(doc, parent, newChild) {
455
1167
  if (doc && doc._inc) {
456
1168
  doc._inc++;
457
- var cs = el.childNodes;
458
- if (newChild) {
459
- cs[cs.length++] = newChild;
1169
+ var childNodes = parent.childNodes;
1170
+ if (newChild && !newChild.nextSibling) {
1171
+ childNodes[childNodes.length++] = newChild;
460
1172
  } else {
461
- var child = el.firstChild;
1173
+ var child = parent.firstChild;
462
1174
  var i = 0;
463
1175
  while (child) {
464
- cs[i++] = child;
1176
+ childNodes[i++] = child;
465
1177
  child = child.nextSibling;
466
1178
  }
467
- cs.length = i;
468
- delete cs[cs.length];
1179
+ childNodes.length = i;
1180
+ delete childNodes[childNodes.length];
469
1181
  }
470
1182
  }
471
1183
  }
472
1184
  function _removeChild(parentNode, child) {
473
- var previous = child.previousSibling;
474
- var next = child.nextSibling;
475
- if (previous) {
476
- previous.nextSibling = next;
1185
+ if (parentNode !== child.parentNode) {
1186
+ throw new DOMException(DOMException.NOT_FOUND_ERR, "child's parent is not parent");
1187
+ }
1188
+ var oldPreviousSibling = child.previousSibling;
1189
+ var oldNextSibling = child.nextSibling;
1190
+ if (oldPreviousSibling) {
1191
+ oldPreviousSibling.nextSibling = oldNextSibling;
477
1192
  } else {
478
- parentNode.firstChild = next;
1193
+ parentNode.firstChild = oldNextSibling;
479
1194
  }
480
- if (next) {
481
- next.previousSibling = previous;
1195
+ if (oldNextSibling) {
1196
+ oldNextSibling.previousSibling = oldPreviousSibling;
482
1197
  } else {
483
- parentNode.lastChild = previous;
1198
+ parentNode.lastChild = oldPreviousSibling;
484
1199
  }
1200
+ _onUpdateChild(parentNode.ownerDocument, parentNode);
485
1201
  child.parentNode = null;
486
1202
  child.previousSibling = null;
487
1203
  child.nextSibling = null;
488
- _onUpdateChild(parentNode.ownerDocument, parentNode);
489
1204
  return child;
490
1205
  }
491
1206
  function hasValidParentNodeType(node) {
492
1207
  return node && (node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE);
493
1208
  }
494
1209
  function hasInsertableNodeType(node) {
495
- return node && (isElementNode(node) || isTextNode(node) || isDocTypeNode(node) || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.COMMENT_NODE || node.nodeType === Node.PROCESSING_INSTRUCTION_NODE);
1210
+ return node && (node.nodeType === Node.CDATA_SECTION_NODE || node.nodeType === Node.COMMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.DOCUMENT_TYPE_NODE || node.nodeType === Node.ELEMENT_NODE || node.nodeType === Node.PROCESSING_INSTRUCTION_NODE || node.nodeType === Node.TEXT_NODE);
496
1211
  }
497
1212
  function isDocTypeNode(node) {
498
1213
  return node && node.nodeType === Node.DOCUMENT_TYPE_NODE;
@@ -524,13 +1239,13 @@ var require_dom = __commonJS((exports) => {
524
1239
  }
525
1240
  function assertPreInsertionValidity1to5(parent, node, child) {
526
1241
  if (!hasValidParentNodeType(parent)) {
527
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Unexpected parent node type " + parent.nodeType);
1242
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Unexpected parent node type " + parent.nodeType);
528
1243
  }
529
1244
  if (child && child.parentNode !== parent) {
530
- throw new DOMException(NOT_FOUND_ERR, "child not in parent");
1245
+ throw new DOMException(DOMException.NOT_FOUND_ERR, "child not in parent");
531
1246
  }
532
1247
  if (!hasInsertableNodeType(node) || isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE) {
533
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Unexpected node type " + node.nodeType + " for parent node type " + parent.nodeType);
1248
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Unexpected node type " + node.nodeType + " for parent node type " + parent.nodeType);
534
1249
  }
535
1250
  }
536
1251
  function assertPreInsertionValidityInDocument(parent, node, child) {
@@ -539,27 +1254,27 @@ var require_dom = __commonJS((exports) => {
539
1254
  if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
540
1255
  var nodeChildElements = nodeChildNodes.filter(isElementNode);
541
1256
  if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {
542
- throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
1257
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
543
1258
  }
544
1259
  if (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) {
545
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
1260
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
546
1261
  }
547
1262
  }
548
1263
  if (isElementNode(node)) {
549
1264
  if (!isElementInsertionPossible(parent, child)) {
550
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
1265
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
551
1266
  }
552
1267
  }
553
1268
  if (isDocTypeNode(node)) {
554
1269
  if (find(parentChildNodes, isDocTypeNode)) {
555
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
1270
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
556
1271
  }
557
1272
  var parentElementChild = find(parentChildNodes, isElementNode);
558
1273
  if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
559
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
1274
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
560
1275
  }
561
1276
  if (!child && parentElementChild) {
562
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can not be appended since element is present");
1277
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Doctype can not be appended since element is present");
563
1278
  }
564
1279
  }
565
1280
  }
@@ -569,28 +1284,27 @@ var require_dom = __commonJS((exports) => {
569
1284
  if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
570
1285
  var nodeChildElements = nodeChildNodes.filter(isElementNode);
571
1286
  if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {
572
- throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
1287
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
573
1288
  }
574
1289
  if (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) {
575
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
1290
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
576
1291
  }
577
1292
  }
578
1293
  if (isElementNode(node)) {
579
1294
  if (!isElementReplacementPossible(parent, child)) {
580
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
1295
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
581
1296
  }
582
1297
  }
583
1298
  if (isDocTypeNode(node)) {
584
- let hasDoctypeChildThatIsNotChild2 = function(node2) {
1299
+ let hasDoctypeChildThatIsNotChild = function(node2) {
585
1300
  return isDocTypeNode(node2) && node2 !== child;
586
1301
  };
587
- var hasDoctypeChildThatIsNotChild = hasDoctypeChildThatIsNotChild2;
588
- if (find(parentChildNodes, hasDoctypeChildThatIsNotChild2)) {
589
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
1302
+ if (find(parentChildNodes, hasDoctypeChildThatIsNotChild)) {
1303
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
590
1304
  }
591
1305
  var parentElementChild = find(parentChildNodes, isElementNode);
592
1306
  if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
593
- throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
1307
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
594
1308
  }
595
1309
  }
596
1310
  }
@@ -627,60 +1341,22 @@ var require_dom = __commonJS((exports) => {
627
1341
  }
628
1342
  do {
629
1343
  newFirst.parentNode = parent;
630
- var targetDoc = parent.ownerDocument || parent;
631
- _updateOwnerDocument(newFirst, targetDoc);
632
1344
  } while (newFirst !== newLast && (newFirst = newFirst.nextSibling));
633
- _onUpdateChild(parent.ownerDocument || parent, parent);
1345
+ _onUpdateChild(parent.ownerDocument || parent, parent, node);
634
1346
  if (node.nodeType == DOCUMENT_FRAGMENT_NODE) {
635
1347
  node.firstChild = node.lastChild = null;
636
1348
  }
637
1349
  return node;
638
1350
  }
639
- function _updateOwnerDocument(node, newOwnerDocument) {
640
- if (node.ownerDocument === newOwnerDocument) {
641
- return;
642
- }
643
- node.ownerDocument = newOwnerDocument;
644
- if (node.nodeType === ELEMENT_NODE && node.attributes) {
645
- for (var i = 0;i < node.attributes.length; i++) {
646
- var attr = node.attributes.item(i);
647
- if (attr) {
648
- attr.ownerDocument = newOwnerDocument;
649
- }
650
- }
651
- }
652
- var child = node.firstChild;
653
- while (child) {
654
- _updateOwnerDocument(child, newOwnerDocument);
655
- child = child.nextSibling;
656
- }
657
- }
658
- function _appendSingleChild(parentNode, newChild) {
659
- if (newChild.parentNode) {
660
- newChild.parentNode.removeChild(newChild);
661
- }
662
- newChild.parentNode = parentNode;
663
- newChild.previousSibling = parentNode.lastChild;
664
- newChild.nextSibling = null;
665
- if (newChild.previousSibling) {
666
- newChild.previousSibling.nextSibling = newChild;
667
- } else {
668
- parentNode.firstChild = newChild;
669
- }
670
- parentNode.lastChild = newChild;
671
- _onUpdateChild(parentNode.ownerDocument, parentNode, newChild);
672
- var targetDoc = parentNode.ownerDocument || parentNode;
673
- _updateOwnerDocument(newChild, targetDoc);
674
- return newChild;
675
- }
676
1351
  Document.prototype = {
1352
+ implementation: null,
677
1353
  nodeName: "#document",
678
1354
  nodeType: DOCUMENT_NODE,
679
1355
  doctype: null,
680
1356
  documentElement: null,
681
1357
  _inc: 1,
682
1358
  insertBefore: function(newChild, refChild) {
683
- if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) {
1359
+ if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) {
684
1360
  var child = newChild.firstChild;
685
1361
  while (child) {
686
1362
  var next = child.nextSibling;
@@ -690,21 +1366,22 @@ var require_dom = __commonJS((exports) => {
690
1366
  return newChild;
691
1367
  }
692
1368
  _insertBefore(this, newChild, refChild);
693
- _updateOwnerDocument(newChild, this);
1369
+ newChild.ownerDocument = this;
694
1370
  if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) {
695
1371
  this.documentElement = newChild;
696
1372
  }
697
1373
  return newChild;
698
1374
  },
699
1375
  removeChild: function(oldChild) {
700
- if (this.documentElement == oldChild) {
1376
+ var removed = _removeChild(this, oldChild);
1377
+ if (removed === this.documentElement) {
701
1378
  this.documentElement = null;
702
1379
  }
703
- return _removeChild(this, oldChild);
1380
+ return removed;
704
1381
  },
705
1382
  replaceChild: function(newChild, oldChild) {
706
1383
  _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
707
- _updateOwnerDocument(newChild, this);
1384
+ newChild.ownerDocument = this;
708
1385
  if (oldChild) {
709
1386
  this.removeChild(oldChild);
710
1387
  }
@@ -727,33 +1404,15 @@ var require_dom = __commonJS((exports) => {
727
1404
  });
728
1405
  return rtv;
729
1406
  },
730
- getElementsByClassName: function(classNames) {
731
- var classNamesSet = toOrderedSet(classNames);
732
- return new LiveNodeList(this, function(base) {
733
- var ls = [];
734
- if (classNamesSet.length > 0) {
735
- _visitNode(base.documentElement, function(node) {
736
- if (node !== base && node.nodeType === ELEMENT_NODE) {
737
- var nodeClassNames = node.getAttribute("class");
738
- if (nodeClassNames) {
739
- var matches = classNames === nodeClassNames;
740
- if (!matches) {
741
- var nodeClassNamesSet = toOrderedSet(nodeClassNames);
742
- matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet));
743
- }
744
- if (matches) {
745
- ls.push(node);
746
- }
747
- }
748
- }
749
- });
750
- }
751
- return ls;
752
- });
753
- },
754
1407
  createElement: function(tagName) {
755
- var node = new Element;
1408
+ var node = new Element(PDC);
756
1409
  node.ownerDocument = this;
1410
+ if (this.type === "html") {
1411
+ tagName = tagName.toLowerCase();
1412
+ }
1413
+ if (hasDefaultHTMLNamespace(this.contentType)) {
1414
+ node.namespaceURI = NAMESPACE.HTML;
1415
+ }
757
1416
  node.nodeName = tagName;
758
1417
  node.tagName = tagName;
759
1418
  node.localName = tagName;
@@ -763,42 +1422,56 @@ var require_dom = __commonJS((exports) => {
763
1422
  return node;
764
1423
  },
765
1424
  createDocumentFragment: function() {
766
- var node = new DocumentFragment;
1425
+ var node = new DocumentFragment(PDC);
767
1426
  node.ownerDocument = this;
768
1427
  node.childNodes = new NodeList;
769
1428
  return node;
770
1429
  },
771
1430
  createTextNode: function(data) {
772
- var node = new Text;
1431
+ var node = new Text(PDC);
773
1432
  node.ownerDocument = this;
1433
+ node.childNodes = new NodeList;
774
1434
  node.appendData(data);
775
1435
  return node;
776
1436
  },
777
1437
  createComment: function(data) {
778
- var node = new Comment;
1438
+ var node = new Comment(PDC);
779
1439
  node.ownerDocument = this;
1440
+ node.childNodes = new NodeList;
780
1441
  node.appendData(data);
781
1442
  return node;
782
1443
  },
783
1444
  createCDATASection: function(data) {
784
1445
  if (data.indexOf("]]>") !== -1) {
785
- throw new DOMException(INVALID_CHARACTER_ERR, 'data contains "]]>"');
1446
+ throw new DOMException(DOMException.INVALID_CHARACTER_ERR, 'data contains "]]>"');
786
1447
  }
787
- var node = new CDATASection;
1448
+ var node = new CDATASection(PDC);
788
1449
  node.ownerDocument = this;
1450
+ node.childNodes = new NodeList;
789
1451
  node.appendData(data);
790
1452
  return node;
791
1453
  },
792
1454
  createProcessingInstruction: function(target, data) {
793
- var node = new ProcessingInstruction;
1455
+ var node = new ProcessingInstruction(PDC);
794
1456
  node.ownerDocument = this;
795
- node.tagName = node.nodeName = node.target = target;
1457
+ node.childNodes = new NodeList;
1458
+ node.nodeName = node.target = target;
796
1459
  node.nodeValue = node.data = data;
797
1460
  return node;
798
1461
  },
799
1462
  createAttribute: function(name) {
800
- var node = new Attr;
1463
+ if (!g.QName_exact.test(name)) {
1464
+ throw new DOMException(DOMException.INVALID_CHARACTER_ERR, 'invalid character in name "' + name + '"');
1465
+ }
1466
+ if (this.type === "html") {
1467
+ name = name.toLowerCase();
1468
+ }
1469
+ return this._createAttribute(name);
1470
+ },
1471
+ _createAttribute: function(name) {
1472
+ var node = new Attr(PDC);
801
1473
  node.ownerDocument = this;
1474
+ node.childNodes = new NodeList;
802
1475
  node.name = name;
803
1476
  node.nodeName = name;
804
1477
  node.localName = name;
@@ -806,78 +1479,93 @@ var require_dom = __commonJS((exports) => {
806
1479
  return node;
807
1480
  },
808
1481
  createEntityReference: function(name) {
809
- var node = new EntityReference;
1482
+ if (!g.Name.test(name)) {
1483
+ throw new DOMException(DOMException.INVALID_CHARACTER_ERR, 'not a valid xml name "' + name + '"');
1484
+ }
1485
+ if (this.type === "html") {
1486
+ throw new DOMException("document is an html document", DOMExceptionName.NotSupportedError);
1487
+ }
1488
+ var node = new EntityReference(PDC);
810
1489
  node.ownerDocument = this;
1490
+ node.childNodes = new NodeList;
811
1491
  node.nodeName = name;
812
1492
  return node;
813
1493
  },
814
1494
  createElementNS: function(namespaceURI, qualifiedName) {
815
- var node = new Element;
816
- var pl = qualifiedName.split(":");
1495
+ var validated = validateAndExtract(namespaceURI, qualifiedName);
1496
+ var node = new Element(PDC);
817
1497
  var attrs = node.attributes = new NamedNodeMap;
818
1498
  node.childNodes = new NodeList;
819
1499
  node.ownerDocument = this;
820
1500
  node.nodeName = qualifiedName;
821
1501
  node.tagName = qualifiedName;
822
- node.namespaceURI = namespaceURI;
823
- if (pl.length == 2) {
824
- node.prefix = pl[0];
825
- node.localName = pl[1];
826
- } else {
827
- node.localName = qualifiedName;
828
- }
1502
+ node.namespaceURI = validated[0];
1503
+ node.prefix = validated[1];
1504
+ node.localName = validated[2];
829
1505
  attrs._ownerElement = node;
830
1506
  return node;
831
1507
  },
832
1508
  createAttributeNS: function(namespaceURI, qualifiedName) {
833
- var node = new Attr;
834
- var pl = qualifiedName.split(":");
1509
+ var validated = validateAndExtract(namespaceURI, qualifiedName);
1510
+ var node = new Attr(PDC);
835
1511
  node.ownerDocument = this;
1512
+ node.childNodes = new NodeList;
836
1513
  node.nodeName = qualifiedName;
837
1514
  node.name = qualifiedName;
838
- node.namespaceURI = namespaceURI;
839
1515
  node.specified = true;
840
- if (pl.length == 2) {
841
- node.prefix = pl[0];
842
- node.localName = pl[1];
843
- } else {
844
- node.localName = qualifiedName;
845
- }
1516
+ node.namespaceURI = validated[0];
1517
+ node.prefix = validated[1];
1518
+ node.localName = validated[2];
846
1519
  return node;
847
1520
  }
848
1521
  };
849
1522
  _extends(Document, Node);
850
- function Element() {
851
- this._nsMap = {};
1523
+ function Element(symbol) {
1524
+ checkSymbol(symbol);
1525
+ this._nsMap = Object.create(null);
852
1526
  }
853
1527
  Element.prototype = {
854
1528
  nodeType: ELEMENT_NODE,
1529
+ attributes: null,
1530
+ getQualifiedName: function() {
1531
+ return this.prefix ? this.prefix + ":" + this.localName : this.localName;
1532
+ },
1533
+ _isInHTMLDocumentAndNamespace: function() {
1534
+ return this.ownerDocument.type === "html" && this.namespaceURI === NAMESPACE.HTML;
1535
+ },
1536
+ hasAttributes: function() {
1537
+ return !!(this.attributes && this.attributes.length);
1538
+ },
855
1539
  hasAttribute: function(name) {
856
- return this.getAttributeNode(name) != null;
1540
+ return !!this.getAttributeNode(name);
857
1541
  },
858
1542
  getAttribute: function(name) {
859
1543
  var attr = this.getAttributeNode(name);
860
- return attr && attr.value || "";
1544
+ return attr ? attr.value : null;
861
1545
  },
862
1546
  getAttributeNode: function(name) {
1547
+ if (this._isInHTMLDocumentAndNamespace()) {
1548
+ name = name.toLowerCase();
1549
+ }
863
1550
  return this.attributes.getNamedItem(name);
864
1551
  },
865
1552
  setAttribute: function(name, value) {
866
- var attr = this.ownerDocument.createAttribute(name);
867
- attr.value = attr.nodeValue = "" + value;
868
- this.setAttributeNode(attr);
1553
+ if (this._isInHTMLDocumentAndNamespace()) {
1554
+ name = name.toLowerCase();
1555
+ }
1556
+ var attr = this.getAttributeNode(name);
1557
+ if (attr) {
1558
+ attr.value = attr.nodeValue = "" + value;
1559
+ } else {
1560
+ attr = this.ownerDocument._createAttribute(name);
1561
+ attr.value = attr.nodeValue = "" + value;
1562
+ this.setAttributeNode(attr);
1563
+ }
869
1564
  },
870
1565
  removeAttribute: function(name) {
871
1566
  var attr = this.getAttributeNode(name);
872
1567
  attr && this.removeAttributeNode(attr);
873
1568
  },
874
- appendChild: function(newChild) {
875
- if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) {
876
- return this.insertBefore(newChild, null);
877
- } else {
878
- return _appendSingleChild(this, newChild);
879
- }
880
- },
881
1569
  setAttributeNode: function(newAttr) {
882
1570
  return this.attributes.setNamedItem(newAttr);
883
1571
  },
@@ -896,22 +1584,64 @@ var require_dom = __commonJS((exports) => {
896
1584
  },
897
1585
  getAttributeNS: function(namespaceURI, localName) {
898
1586
  var attr = this.getAttributeNodeNS(namespaceURI, localName);
899
- return attr && attr.value || "";
1587
+ return attr ? attr.value : null;
900
1588
  },
901
1589
  setAttributeNS: function(namespaceURI, qualifiedName, value) {
902
- var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
903
- attr.value = attr.nodeValue = "" + value;
904
- this.setAttributeNode(attr);
1590
+ var validated = validateAndExtract(namespaceURI, qualifiedName);
1591
+ var localName = validated[2];
1592
+ var attr = this.getAttributeNodeNS(namespaceURI, localName);
1593
+ if (attr) {
1594
+ attr.value = attr.nodeValue = "" + value;
1595
+ } else {
1596
+ attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
1597
+ attr.value = attr.nodeValue = "" + value;
1598
+ this.setAttributeNode(attr);
1599
+ }
905
1600
  },
906
1601
  getAttributeNodeNS: function(namespaceURI, localName) {
907
1602
  return this.attributes.getNamedItemNS(namespaceURI, localName);
908
1603
  },
909
- getElementsByTagName: function(tagName) {
1604
+ getElementsByClassName: function(classNames) {
1605
+ var classNamesSet = toOrderedSet(classNames);
1606
+ return new LiveNodeList(this, function(base) {
1607
+ var ls = [];
1608
+ if (classNamesSet.length > 0) {
1609
+ _visitNode(base, function(node) {
1610
+ if (node !== base && node.nodeType === ELEMENT_NODE) {
1611
+ var nodeClassNames = node.getAttribute("class");
1612
+ if (nodeClassNames) {
1613
+ var matches = classNames === nodeClassNames;
1614
+ if (!matches) {
1615
+ var nodeClassNamesSet = toOrderedSet(nodeClassNames);
1616
+ matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet));
1617
+ }
1618
+ if (matches) {
1619
+ ls.push(node);
1620
+ }
1621
+ }
1622
+ }
1623
+ });
1624
+ }
1625
+ return ls;
1626
+ });
1627
+ },
1628
+ getElementsByTagName: function(qualifiedName) {
1629
+ var isHTMLDocument = (this.nodeType === DOCUMENT_NODE ? this : this.ownerDocument).type === "html";
1630
+ var lowerQualifiedName = qualifiedName.toLowerCase();
910
1631
  return new LiveNodeList(this, function(base) {
911
1632
  var ls = [];
912
1633
  _visitNode(base, function(node) {
913
- if (node !== base && node.nodeType == ELEMENT_NODE && (tagName === "*" || node.tagName == tagName)) {
1634
+ if (node === base || node.nodeType !== ELEMENT_NODE) {
1635
+ return;
1636
+ }
1637
+ if (qualifiedName === "*") {
914
1638
  ls.push(node);
1639
+ } else {
1640
+ var nodeQualifiedName = node.getQualifiedName();
1641
+ var matchingQName = isHTMLDocument && node.namespaceURI === NAMESPACE.HTML ? lowerQualifiedName : qualifiedName;
1642
+ if (nodeQualifiedName === matchingQName) {
1643
+ ls.push(node);
1644
+ }
915
1645
  }
916
1646
  });
917
1647
  return ls;
@@ -929,13 +1659,21 @@ var require_dom = __commonJS((exports) => {
929
1659
  });
930
1660
  }
931
1661
  };
1662
+ Document.prototype.getElementsByClassName = Element.prototype.getElementsByClassName;
932
1663
  Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;
933
1664
  Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;
934
1665
  _extends(Element, Node);
935
- function Attr() {}
1666
+ function Attr(symbol) {
1667
+ checkSymbol(symbol);
1668
+ this.namespaceURI = null;
1669
+ this.prefix = null;
1670
+ this.ownerElement = null;
1671
+ }
936
1672
  Attr.prototype.nodeType = ATTRIBUTE_NODE;
937
1673
  _extends(Attr, Node);
938
- function CharacterData() {}
1674
+ function CharacterData(symbol) {
1675
+ checkSymbol(symbol);
1676
+ }
939
1677
  CharacterData.prototype = {
940
1678
  data: "",
941
1679
  substringData: function(offset, count) {
@@ -949,9 +1687,6 @@ var require_dom = __commonJS((exports) => {
949
1687
  insertData: function(offset, text) {
950
1688
  this.replaceData(offset, 0, text);
951
1689
  },
952
- appendChild: function(newChild) {
953
- throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]);
954
- },
955
1690
  deleteData: function(offset, count) {
956
1691
  this.replaceData(offset, count, "");
957
1692
  },
@@ -964,7 +1699,9 @@ var require_dom = __commonJS((exports) => {
964
1699
  }
965
1700
  };
966
1701
  _extends(CharacterData, Node);
967
- function Text() {}
1702
+ function Text(symbol) {
1703
+ checkSymbol(symbol);
1704
+ }
968
1705
  Text.prototype = {
969
1706
  nodeName: "#text",
970
1707
  nodeType: TEXT_NODE,
@@ -982,45 +1719,73 @@ var require_dom = __commonJS((exports) => {
982
1719
  }
983
1720
  };
984
1721
  _extends(Text, CharacterData);
985
- function Comment() {}
1722
+ function Comment(symbol) {
1723
+ checkSymbol(symbol);
1724
+ }
986
1725
  Comment.prototype = {
987
1726
  nodeName: "#comment",
988
1727
  nodeType: COMMENT_NODE
989
1728
  };
990
1729
  _extends(Comment, CharacterData);
991
- function CDATASection() {}
1730
+ function CDATASection(symbol) {
1731
+ checkSymbol(symbol);
1732
+ }
992
1733
  CDATASection.prototype = {
993
1734
  nodeName: "#cdata-section",
994
1735
  nodeType: CDATA_SECTION_NODE
995
1736
  };
996
- _extends(CDATASection, CharacterData);
997
- function DocumentType() {}
1737
+ _extends(CDATASection, Text);
1738
+ function DocumentType(symbol) {
1739
+ checkSymbol(symbol);
1740
+ }
998
1741
  DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
999
1742
  _extends(DocumentType, Node);
1000
- function Notation() {}
1743
+ function Notation(symbol) {
1744
+ checkSymbol(symbol);
1745
+ }
1001
1746
  Notation.prototype.nodeType = NOTATION_NODE;
1002
1747
  _extends(Notation, Node);
1003
- function Entity() {}
1748
+ function Entity(symbol) {
1749
+ checkSymbol(symbol);
1750
+ }
1004
1751
  Entity.prototype.nodeType = ENTITY_NODE;
1005
1752
  _extends(Entity, Node);
1006
- function EntityReference() {}
1753
+ function EntityReference(symbol) {
1754
+ checkSymbol(symbol);
1755
+ }
1007
1756
  EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
1008
1757
  _extends(EntityReference, Node);
1009
- function DocumentFragment() {}
1758
+ function DocumentFragment(symbol) {
1759
+ checkSymbol(symbol);
1760
+ }
1010
1761
  DocumentFragment.prototype.nodeName = "#document-fragment";
1011
1762
  DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;
1012
1763
  _extends(DocumentFragment, Node);
1013
- function ProcessingInstruction() {}
1764
+ function ProcessingInstruction(symbol) {
1765
+ checkSymbol(symbol);
1766
+ }
1014
1767
  ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
1015
- _extends(ProcessingInstruction, Node);
1768
+ _extends(ProcessingInstruction, CharacterData);
1016
1769
  function XMLSerializer() {}
1017
- XMLSerializer.prototype.serializeToString = function(node, isHtml, nodeFilter) {
1018
- return nodeSerializeToString.call(node, isHtml, nodeFilter);
1770
+ XMLSerializer.prototype.serializeToString = function(node, options) {
1771
+ return nodeSerializeToString.call(node, options);
1019
1772
  };
1020
1773
  Node.prototype.toString = nodeSerializeToString;
1021
- function nodeSerializeToString(isHtml, nodeFilter) {
1774
+ function nodeSerializeToString(options) {
1775
+ var opts;
1776
+ if (typeof options === "function") {
1777
+ opts = { requireWellFormed: false, splitCDATASections: true, nodeFilter: options };
1778
+ } else if (options != null) {
1779
+ opts = {
1780
+ requireWellFormed: !!options.requireWellFormed,
1781
+ splitCDATASections: options.splitCDATASections !== false,
1782
+ nodeFilter: options.nodeFilter || null
1783
+ };
1784
+ } else {
1785
+ opts = { requireWellFormed: false, splitCDATASections: true, nodeFilter: null };
1786
+ }
1022
1787
  var buf = [];
1023
- var refNode = this.nodeType == 9 && this.documentElement || this;
1788
+ var refNode = this.nodeType === DOCUMENT_NODE && this.documentElement || this;
1024
1789
  var prefix = refNode.prefix;
1025
1790
  var uri = refNode.namespaceURI;
1026
1791
  if (uri && prefix == null) {
@@ -1031,7 +1796,7 @@ var require_dom = __commonJS((exports) => {
1031
1796
  ];
1032
1797
  }
1033
1798
  }
1034
- serializeToString(this, buf, isHtml, nodeFilter, visibleNamespaces);
1799
+ serializeToString(this, buf, visibleNamespaces, opts);
1035
1800
  return buf.join("");
1036
1801
  }
1037
1802
  function needNamespaceDefine(node, isHTML, visibleNamespaces) {
@@ -1055,237 +1820,293 @@ var require_dom = __commonJS((exports) => {
1055
1820
  function addSerializedAttribute(buf, qualifiedName, value) {
1056
1821
  buf.push(" ", qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
1057
1822
  }
1058
- function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces) {
1823
+ function serializeToString(node, buf, visibleNamespaces, opts) {
1059
1824
  if (!visibleNamespaces) {
1060
1825
  visibleNamespaces = [];
1061
1826
  }
1062
- if (nodeFilter) {
1063
- node = nodeFilter(node);
1064
- if (node) {
1065
- if (typeof node == "string") {
1066
- buf.push(node);
1067
- return;
1068
- }
1069
- } else {
1070
- return;
1071
- }
1072
- }
1073
- switch (node.nodeType) {
1074
- case ELEMENT_NODE:
1075
- var attrs = node.attributes;
1076
- var len = attrs.length;
1077
- var child = node.firstChild;
1078
- var nodeName = node.tagName;
1079
- isHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML;
1080
- var prefixedNodeName = nodeName;
1081
- if (!isHTML && !node.prefix && node.namespaceURI) {
1082
- var defaultNS;
1083
- for (var ai = 0;ai < attrs.length; ai++) {
1084
- if (attrs.item(ai).name === "xmlns") {
1085
- defaultNS = attrs.item(ai).value;
1086
- break;
1827
+ var nodeFilter = opts.nodeFilter;
1828
+ var requireWellFormed = opts.requireWellFormed;
1829
+ var splitCDATASections = opts.splitCDATASections;
1830
+ var doc = node.nodeType === DOCUMENT_NODE ? node : node.ownerDocument;
1831
+ var isHTML = doc.type === "html";
1832
+ walkDOM(node, { ns: visibleNamespaces }, {
1833
+ enter: function(n, ctx) {
1834
+ var namespaces = ctx.ns;
1835
+ if (nodeFilter) {
1836
+ n = nodeFilter(n);
1837
+ if (n) {
1838
+ if (typeof n == "string") {
1839
+ buf.push(n);
1840
+ return null;
1087
1841
  }
1842
+ } else {
1843
+ return null;
1088
1844
  }
1089
- if (!defaultNS) {
1090
- for (var nsi = visibleNamespaces.length - 1;nsi >= 0; nsi--) {
1091
- var namespace = visibleNamespaces[nsi];
1092
- if (namespace.prefix === "" && namespace.namespace === node.namespaceURI) {
1093
- defaultNS = namespace.namespace;
1094
- break;
1845
+ }
1846
+ switch (n.nodeType) {
1847
+ case ELEMENT_NODE:
1848
+ var attrs = n.attributes;
1849
+ var len = attrs.length;
1850
+ var nodeName = n.tagName;
1851
+ var prefixedNodeName = nodeName;
1852
+ if (!isHTML && !n.prefix && n.namespaceURI) {
1853
+ var defaultNS;
1854
+ for (var ai = 0;ai < attrs.length; ai++) {
1855
+ if (attrs.item(ai).name === "xmlns") {
1856
+ defaultNS = attrs.item(ai).value;
1857
+ break;
1858
+ }
1859
+ }
1860
+ if (!defaultNS) {
1861
+ for (var nsi = namespaces.length - 1;nsi >= 0; nsi--) {
1862
+ var nsEntry = namespaces[nsi];
1863
+ if (nsEntry.prefix === "" && nsEntry.namespace === n.namespaceURI) {
1864
+ defaultNS = nsEntry.namespace;
1865
+ break;
1866
+ }
1867
+ }
1868
+ }
1869
+ if (defaultNS !== n.namespaceURI) {
1870
+ for (var nsi = namespaces.length - 1;nsi >= 0; nsi--) {
1871
+ var nsEntry = namespaces[nsi];
1872
+ if (nsEntry.namespace === n.namespaceURI) {
1873
+ if (nsEntry.prefix) {
1874
+ prefixedNodeName = nsEntry.prefix + ":" + nodeName;
1875
+ }
1876
+ break;
1877
+ }
1878
+ }
1095
1879
  }
1096
1880
  }
1097
- }
1098
- if (defaultNS !== node.namespaceURI) {
1099
- for (var nsi = visibleNamespaces.length - 1;nsi >= 0; nsi--) {
1100
- var namespace = visibleNamespaces[nsi];
1101
- if (namespace.namespace === node.namespaceURI) {
1102
- if (namespace.prefix) {
1103
- prefixedNodeName = namespace.prefix + ":" + nodeName;
1881
+ buf.push("<", prefixedNodeName);
1882
+ var childNamespaces = namespaces.slice();
1883
+ for (var i = 0;i < len; i++) {
1884
+ var attr = attrs.item(i);
1885
+ if (attr.prefix == "xmlns") {
1886
+ childNamespaces.push({
1887
+ prefix: attr.localName,
1888
+ namespace: attr.value
1889
+ });
1890
+ } else if (attr.nodeName == "xmlns") {
1891
+ childNamespaces.push({ prefix: "", namespace: attr.value });
1892
+ }
1893
+ }
1894
+ for (var i = 0;i < len; i++) {
1895
+ var attr = attrs.item(i);
1896
+ if (needNamespaceDefine(attr, isHTML, childNamespaces)) {
1897
+ var attrPrefix = attr.prefix || "";
1898
+ var uri = attr.namespaceURI;
1899
+ addSerializedAttribute(buf, attrPrefix ? "xmlns:" + attrPrefix : "xmlns", uri);
1900
+ childNamespaces.push({ prefix: attrPrefix, namespace: uri });
1901
+ }
1902
+ var filteredAttr = nodeFilter ? nodeFilter(attr) : attr;
1903
+ if (filteredAttr) {
1904
+ if (typeof filteredAttr === "string") {
1905
+ buf.push(filteredAttr);
1906
+ } else {
1907
+ addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value);
1104
1908
  }
1105
- break;
1106
1909
  }
1107
1910
  }
1108
- }
1109
- }
1110
- buf.push("<", prefixedNodeName);
1111
- for (var i = 0;i < len; i++) {
1112
- var attr = attrs.item(i);
1113
- if (attr.prefix == "xmlns") {
1114
- visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value });
1115
- } else if (attr.nodeName == "xmlns") {
1116
- visibleNamespaces.push({ prefix: "", namespace: attr.value });
1117
- }
1118
- }
1119
- for (var i = 0;i < len; i++) {
1120
- var attr = attrs.item(i);
1121
- if (needNamespaceDefine(attr, isHTML, visibleNamespaces)) {
1122
- var prefix = attr.prefix || "";
1123
- var uri = attr.namespaceURI;
1124
- addSerializedAttribute(buf, prefix ? "xmlns:" + prefix : "xmlns", uri);
1125
- visibleNamespaces.push({ prefix, namespace: uri });
1126
- }
1127
- serializeToString(attr, buf, isHTML, nodeFilter, visibleNamespaces);
1128
- }
1129
- if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {
1130
- var prefix = node.prefix || "";
1131
- var uri = node.namespaceURI;
1132
- addSerializedAttribute(buf, prefix ? "xmlns:" + prefix : "xmlns", uri);
1133
- visibleNamespaces.push({ prefix, namespace: uri });
1134
- }
1135
- if (child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
1136
- buf.push(">");
1137
- if (isHTML && /^script$/i.test(nodeName)) {
1138
- while (child) {
1139
- if (child.data) {
1140
- buf.push(child.data);
1141
- } else {
1142
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
1911
+ if (nodeName === prefixedNodeName && needNamespaceDefine(n, isHTML, childNamespaces)) {
1912
+ var nodePrefix = n.prefix || "";
1913
+ var uri = n.namespaceURI;
1914
+ addSerializedAttribute(buf, nodePrefix ? "xmlns:" + nodePrefix : "xmlns", uri);
1915
+ childNamespaces.push({ prefix: nodePrefix, namespace: uri });
1916
+ }
1917
+ var canCloseTag = !n.firstChild;
1918
+ if (canCloseTag && (isHTML || n.namespaceURI === NAMESPACE.HTML)) {
1919
+ canCloseTag = isHTMLVoidElement(nodeName);
1920
+ }
1921
+ if (canCloseTag) {
1922
+ buf.push("/>");
1923
+ return null;
1924
+ }
1925
+ buf.push(">");
1926
+ if (isHTML && isHTMLRawTextElement(nodeName)) {
1927
+ var child = n.firstChild;
1928
+ while (child) {
1929
+ if (child.data) {
1930
+ buf.push(child.data);
1931
+ } else {
1932
+ serializeToString(child, buf, childNamespaces.slice(), opts);
1933
+ }
1934
+ child = child.nextSibling;
1143
1935
  }
1144
- child = child.nextSibling;
1936
+ buf.push("</", prefixedNodeName, ">");
1937
+ return null;
1145
1938
  }
1146
- } else {
1147
- while (child) {
1148
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
1149
- child = child.nextSibling;
1939
+ return { ns: childNamespaces, tag: prefixedNodeName };
1940
+ case DOCUMENT_NODE:
1941
+ case DOCUMENT_FRAGMENT_NODE:
1942
+ if (requireWellFormed && n.nodeType === DOCUMENT_NODE && n.documentElement == null) {
1943
+ throw new DOMException("The Document has no documentElement", DOMExceptionName.InvalidStateError);
1150
1944
  }
1151
- }
1152
- buf.push("</", prefixedNodeName, ">");
1153
- } else {
1154
- buf.push("/>");
1155
- }
1156
- return;
1157
- case DOCUMENT_NODE:
1158
- case DOCUMENT_FRAGMENT_NODE:
1159
- var child = node.firstChild;
1160
- while (child) {
1161
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
1162
- child = child.nextSibling;
1945
+ return { ns: namespaces };
1946
+ case ATTRIBUTE_NODE:
1947
+ addSerializedAttribute(buf, n.name, n.value);
1948
+ return null;
1949
+ case TEXT_NODE:
1950
+ if (requireWellFormed && g.InvalidChar.test(n.data)) {
1951
+ throw new DOMException("The Text node data contains characters outside the XML Char production", DOMExceptionName.InvalidStateError);
1952
+ }
1953
+ buf.push(n.data.replace(/[<&>]/g, _xmlEncoder));
1954
+ return null;
1955
+ case CDATA_SECTION_NODE:
1956
+ if (requireWellFormed && n.data.indexOf("]]>") !== -1) {
1957
+ throw new DOMException('The CDATASection data contains "]]>"', DOMExceptionName.InvalidStateError);
1958
+ }
1959
+ if (splitCDATASections) {
1960
+ buf.push(g.CDATA_START, n.data.replace(/]]>/g, "]]]]><![CDATA[>"), g.CDATA_END);
1961
+ } else {
1962
+ buf.push(g.CDATA_START, n.data, g.CDATA_END);
1963
+ }
1964
+ return null;
1965
+ case COMMENT_NODE:
1966
+ if (requireWellFormed) {
1967
+ if (g.InvalidChar.test(n.data)) {
1968
+ throw new DOMException("The comment node data contains characters outside the XML Char production", DOMExceptionName.InvalidStateError);
1969
+ }
1970
+ if (n.data.indexOf("--") !== -1 || n.data[n.data.length - 1] === "-") {
1971
+ throw new DOMException('The comment node data contains "--" or ends with "-"', DOMExceptionName.InvalidStateError);
1972
+ }
1973
+ }
1974
+ buf.push(g.COMMENT_START, n.data, g.COMMENT_END);
1975
+ return null;
1976
+ case DOCUMENT_TYPE_NODE:
1977
+ var pubid = n.publicId;
1978
+ var sysid = n.systemId;
1979
+ if (requireWellFormed) {
1980
+ if (pubid && !g.PubidLiteral_match.test(pubid)) {
1981
+ throw new DOMException("DocumentType publicId is not a valid PubidLiteral", DOMExceptionName.InvalidStateError);
1982
+ }
1983
+ if (sysid && sysid !== "." && !g.SystemLiteral_match.test(sysid)) {
1984
+ throw new DOMException("DocumentType systemId is not a valid SystemLiteral", DOMExceptionName.InvalidStateError);
1985
+ }
1986
+ if (n.internalSubset && n.internalSubset.indexOf("]>") !== -1) {
1987
+ throw new DOMException('DocumentType internalSubset contains "]>"', DOMExceptionName.InvalidStateError);
1988
+ }
1989
+ }
1990
+ buf.push(g.DOCTYPE_DECL_START, " ", n.name);
1991
+ if (pubid) {
1992
+ buf.push(" ", g.PUBLIC, " ", pubid);
1993
+ if (sysid && sysid !== ".") {
1994
+ buf.push(" ", sysid);
1995
+ }
1996
+ } else if (sysid && sysid !== ".") {
1997
+ buf.push(" ", g.SYSTEM, " ", sysid);
1998
+ }
1999
+ if (n.internalSubset) {
2000
+ buf.push(" [", n.internalSubset, "]");
2001
+ }
2002
+ buf.push(">");
2003
+ return null;
2004
+ case PROCESSING_INSTRUCTION_NODE:
2005
+ if (requireWellFormed) {
2006
+ if (n.target.indexOf(":") !== -1 || n.target.toLowerCase() === "xml") {
2007
+ throw new DOMException("The ProcessingInstruction target is not well-formed", DOMExceptionName.InvalidStateError);
2008
+ }
2009
+ if (g.InvalidChar.test(n.data)) {
2010
+ throw new DOMException("The ProcessingInstruction data contains characters outside the XML Char production", DOMExceptionName.InvalidStateError);
2011
+ }
2012
+ if (n.data.indexOf("?>") !== -1) {
2013
+ throw new DOMException('The ProcessingInstruction data contains "?>"', DOMExceptionName.InvalidStateError);
2014
+ }
2015
+ }
2016
+ buf.push("<?", n.target, " ", n.data, "?>");
2017
+ return null;
2018
+ case ENTITY_REFERENCE_NODE:
2019
+ buf.push("&", n.nodeName, ";");
2020
+ return null;
2021
+ default:
2022
+ buf.push("??", n.nodeName);
2023
+ return null;
1163
2024
  }
1164
- return;
1165
- case ATTRIBUTE_NODE:
1166
- return addSerializedAttribute(buf, node.name, node.value);
1167
- case TEXT_NODE:
1168
- return buf.push(node.data.replace(/[<&>]/g, _xmlEncoder));
1169
- case CDATA_SECTION_NODE:
1170
- return buf.push("<![CDATA[", node.data.replace(/]]>/g, "]]]]><![CDATA[>"), "]]>");
1171
- case COMMENT_NODE:
1172
- return buf.push("<!--", node.data, "-->");
1173
- case DOCUMENT_TYPE_NODE:
1174
- var pubid = node.publicId;
1175
- var sysid = node.systemId;
1176
- buf.push("<!DOCTYPE ", node.name);
1177
- if (pubid) {
1178
- buf.push(" PUBLIC ", pubid);
1179
- if (sysid && sysid != ".") {
1180
- buf.push(" ", sysid);
1181
- }
1182
- buf.push(">");
1183
- } else if (sysid && sysid != ".") {
1184
- buf.push(" SYSTEM ", sysid, ">");
1185
- } else {
1186
- var sub = node.internalSubset;
1187
- if (sub) {
1188
- buf.push(" [", sub, "]");
1189
- }
1190
- buf.push(">");
2025
+ },
2026
+ exit: function(n, childCtx) {
2027
+ if (childCtx && childCtx.tag) {
2028
+ buf.push("</", childCtx.tag, ">");
1191
2029
  }
1192
- return;
1193
- case PROCESSING_INSTRUCTION_NODE:
1194
- return buf.push("<?", node.target, " ", node.data, "?>");
1195
- case ENTITY_REFERENCE_NODE:
1196
- return buf.push("&", node.nodeName, ";");
1197
- default:
1198
- buf.push("??", node.nodeName);
1199
- }
2030
+ }
2031
+ });
1200
2032
  }
1201
2033
  function importNode(doc, node, deep) {
1202
- var node2;
1203
- switch (node.nodeType) {
1204
- case ELEMENT_NODE:
1205
- node2 = node.cloneNode(false);
1206
- node2.ownerDocument = doc;
1207
- case DOCUMENT_FRAGMENT_NODE:
1208
- break;
1209
- case ATTRIBUTE_NODE:
1210
- deep = true;
1211
- break;
1212
- }
1213
- if (!node2) {
1214
- node2 = node.cloneNode(false);
1215
- }
1216
- node2.ownerDocument = doc;
1217
- node2.parentNode = null;
1218
- if (deep) {
1219
- var child = node.firstChild;
1220
- while (child) {
1221
- node2.appendChild(importNode(doc, child, deep));
1222
- child = child.nextSibling;
2034
+ var destRoot;
2035
+ walkDOM(node, null, {
2036
+ enter: function(srcNode, destParent) {
2037
+ var destNode = srcNode.cloneNode(false);
2038
+ destNode.ownerDocument = doc;
2039
+ destNode.parentNode = null;
2040
+ if (destParent === null) {
2041
+ destRoot = destNode;
2042
+ } else {
2043
+ destParent.appendChild(destNode);
2044
+ }
2045
+ var shouldDeep = srcNode.nodeType === ATTRIBUTE_NODE || deep;
2046
+ return shouldDeep ? destNode : null;
1223
2047
  }
1224
- }
1225
- return node2;
2048
+ });
2049
+ return destRoot;
1226
2050
  }
1227
2051
  function cloneNode(doc, node, deep) {
1228
- var node2 = new node.constructor;
1229
- for (var n in node) {
1230
- if (Object.prototype.hasOwnProperty.call(node, n)) {
1231
- var v = node[n];
1232
- if (typeof v != "object") {
1233
- if (v != node2[n]) {
1234
- node2[n] = v;
2052
+ var destRoot;
2053
+ walkDOM(node, null, {
2054
+ enter: function(srcNode, destParent) {
2055
+ var destNode = new srcNode.constructor(PDC);
2056
+ for (var n in srcNode) {
2057
+ if (hasOwn(srcNode, n)) {
2058
+ var v = srcNode[n];
2059
+ if (typeof v != "object") {
2060
+ if (v != destNode[n]) {
2061
+ destNode[n] = v;
2062
+ }
2063
+ }
1235
2064
  }
1236
2065
  }
2066
+ if (srcNode.childNodes) {
2067
+ destNode.childNodes = new NodeList;
2068
+ }
2069
+ destNode.ownerDocument = doc;
2070
+ var shouldDeep = deep;
2071
+ switch (destNode.nodeType) {
2072
+ case ELEMENT_NODE:
2073
+ var attrs = srcNode.attributes;
2074
+ var attrs2 = destNode.attributes = new NamedNodeMap;
2075
+ var len = attrs.length;
2076
+ attrs2._ownerElement = destNode;
2077
+ for (var i = 0;i < len; i++) {
2078
+ destNode.setAttributeNode(cloneNode(doc, attrs.item(i), true));
2079
+ }
2080
+ break;
2081
+ case ATTRIBUTE_NODE:
2082
+ shouldDeep = true;
2083
+ }
2084
+ if (destParent !== null) {
2085
+ destParent.appendChild(destNode);
2086
+ } else {
2087
+ destRoot = destNode;
2088
+ }
2089
+ return shouldDeep ? destNode : null;
1237
2090
  }
1238
- }
1239
- if (node.childNodes) {
1240
- node2.childNodes = new NodeList;
1241
- }
1242
- node2.ownerDocument = doc;
1243
- switch (node2.nodeType) {
1244
- case ELEMENT_NODE:
1245
- var attrs = node.attributes;
1246
- var attrs2 = node2.attributes = new NamedNodeMap;
1247
- var len = attrs.length;
1248
- attrs2._ownerElement = node2;
1249
- for (var i = 0;i < len; i++) {
1250
- node2.setAttributeNode(cloneNode(doc, attrs.item(i), true));
1251
- }
1252
- break;
1253
- ;
1254
- case ATTRIBUTE_NODE:
1255
- deep = true;
1256
- }
1257
- if (deep) {
1258
- var child = node.firstChild;
1259
- while (child) {
1260
- node2.appendChild(cloneNode(doc, child, deep));
1261
- child = child.nextSibling;
1262
- }
1263
- }
1264
- return node2;
2091
+ });
2092
+ return destRoot;
1265
2093
  }
1266
2094
  function __set__(object, key, value) {
1267
2095
  object[key] = value;
1268
2096
  }
2097
+ function childrenRefresh(node) {
2098
+ var ls = [];
2099
+ var child = node.firstChild;
2100
+ while (child) {
2101
+ if (child.nodeType === ELEMENT_NODE) {
2102
+ ls.push(child);
2103
+ }
2104
+ child = child.nextSibling;
2105
+ }
2106
+ return ls;
2107
+ }
1269
2108
  try {
1270
2109
  if (Object.defineProperty) {
1271
- let getTextContent2 = function(node) {
1272
- switch (node.nodeType) {
1273
- case ELEMENT_NODE:
1274
- case DOCUMENT_FRAGMENT_NODE:
1275
- var buf = [];
1276
- node = node.firstChild;
1277
- while (node) {
1278
- if (node.nodeType !== 7 && node.nodeType !== 8) {
1279
- buf.push(getTextContent2(node));
1280
- }
1281
- node = node.nextSibling;
1282
- }
1283
- return buf.join("");
1284
- default:
1285
- return node.nodeValue;
1286
- }
1287
- };
1288
- getTextContent = getTextContent2;
1289
2110
  Object.defineProperty(LiveNodeList.prototype, "length", {
1290
2111
  get: function() {
1291
2112
  _updateLiveList(this);
@@ -1294,7 +2115,22 @@ var require_dom = __commonJS((exports) => {
1294
2115
  });
1295
2116
  Object.defineProperty(Node.prototype, "textContent", {
1296
2117
  get: function() {
1297
- return getTextContent2(this);
2118
+ if (this.nodeType === ELEMENT_NODE || this.nodeType === DOCUMENT_FRAGMENT_NODE) {
2119
+ var buf = [];
2120
+ walkDOM(this, null, {
2121
+ enter: function(n) {
2122
+ if (n.nodeType === ELEMENT_NODE || n.nodeType === DOCUMENT_FRAGMENT_NODE) {
2123
+ return true;
2124
+ }
2125
+ if (n.nodeType === PROCESSING_INSTRUCTION_NODE || n.nodeType === COMMENT_NODE) {
2126
+ return null;
2127
+ }
2128
+ buf.push(n.nodeValue);
2129
+ }
2130
+ });
2131
+ return buf.join("");
2132
+ }
2133
+ return this.nodeValue;
1298
2134
  },
1299
2135
  set: function(data) {
1300
2136
  switch (this.nodeType) {
@@ -1314,22 +2150,50 @@ var require_dom = __commonJS((exports) => {
1314
2150
  }
1315
2151
  }
1316
2152
  });
2153
+ Object.defineProperty(Element.prototype, "children", {
2154
+ get: function() {
2155
+ return new LiveNodeList(this, childrenRefresh);
2156
+ }
2157
+ });
2158
+ Object.defineProperty(Document.prototype, "children", {
2159
+ get: function() {
2160
+ return new LiveNodeList(this, childrenRefresh);
2161
+ }
2162
+ });
2163
+ Object.defineProperty(DocumentFragment.prototype, "children", {
2164
+ get: function() {
2165
+ return new LiveNodeList(this, childrenRefresh);
2166
+ }
2167
+ });
1317
2168
  __set__ = function(object, key, value) {
1318
2169
  object["$$" + key] = value;
1319
2170
  };
1320
2171
  }
1321
2172
  } catch (e) {}
1322
- var getTextContent;
2173
+ exports._updateLiveList = _updateLiveList;
2174
+ exports.Attr = Attr;
2175
+ exports.CDATASection = CDATASection;
2176
+ exports.CharacterData = CharacterData;
2177
+ exports.Comment = Comment;
2178
+ exports.Document = Document;
2179
+ exports.DocumentFragment = DocumentFragment;
1323
2180
  exports.DocumentType = DocumentType;
1324
- exports.DOMException = DOMException;
1325
2181
  exports.DOMImplementation = DOMImplementation;
1326
2182
  exports.Element = Element;
2183
+ exports.Entity = Entity;
2184
+ exports.EntityReference = EntityReference;
2185
+ exports.LiveNodeList = LiveNodeList;
2186
+ exports.NamedNodeMap = NamedNodeMap;
1327
2187
  exports.Node = Node;
1328
2188
  exports.NodeList = NodeList;
2189
+ exports.Notation = Notation;
2190
+ exports.Text = Text;
2191
+ exports.ProcessingInstruction = ProcessingInstruction;
2192
+ exports.walkDOM = walkDOM;
1329
2193
  exports.XMLSerializer = XMLSerializer;
1330
2194
  });
1331
2195
 
1332
- // node_modules/.bun/@xmldom+xmldom@0.8.12/node_modules/@xmldom/xmldom/lib/entities.js
2196
+ // node_modules/.bun/@xmldom+xmldom@0.9.10/node_modules/@xmldom/xmldom/lib/entities.js
1333
2197
  var require_entities = __commonJS((exports) => {
1334
2198
  var freeze = require_conventions().freeze;
1335
2199
  exports.XML_ENTITIES = freeze({
@@ -3470,12 +4334,18 @@ var require_entities = __commonJS((exports) => {
3470
4334
  exports.entityMap = exports.HTML_ENTITIES;
3471
4335
  });
3472
4336
 
3473
- // node_modules/.bun/@xmldom+xmldom@0.8.12/node_modules/@xmldom/xmldom/lib/sax.js
4337
+ // node_modules/.bun/@xmldom+xmldom@0.9.10/node_modules/@xmldom/xmldom/lib/sax.js
3474
4338
  var require_sax = __commonJS((exports) => {
3475
- var NAMESPACE = require_conventions().NAMESPACE;
3476
- var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
3477
- var nameChar = new RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
3478
- var tagNamePattern = new RegExp("^" + nameStartChar.source + nameChar.source + "*(?::" + nameStartChar.source + nameChar.source + "*)?$");
4339
+ var conventions = require_conventions();
4340
+ var g = require_grammar();
4341
+ var errors = require_errors();
4342
+ var isHTMLEscapableRawTextElement = conventions.isHTMLEscapableRawTextElement;
4343
+ var isHTMLMimeType = conventions.isHTMLMimeType;
4344
+ var isHTMLRawTextElement = conventions.isHTMLRawTextElement;
4345
+ var hasOwn = conventions.hasOwn;
4346
+ var NAMESPACE = conventions.NAMESPACE;
4347
+ var ParseError = errors.ParseError;
4348
+ var DOMException = errors.DOMException;
3479
4349
  var S_TAG = 0;
3480
4350
  var S_ATTR = 1;
3481
4351
  var S_ATTR_SPACE = 2;
@@ -3484,25 +4354,22 @@ var require_sax = __commonJS((exports) => {
3484
4354
  var S_ATTR_END = 5;
3485
4355
  var S_TAG_SPACE = 6;
3486
4356
  var S_TAG_CLOSE = 7;
3487
- function ParseError(message, locator) {
3488
- this.message = message;
3489
- this.locator = locator;
3490
- if (Error.captureStackTrace)
3491
- Error.captureStackTrace(this, ParseError);
3492
- }
3493
- ParseError.prototype = new Error;
3494
- ParseError.prototype.name = ParseError.name;
3495
4357
  function XMLReader() {}
3496
4358
  XMLReader.prototype = {
3497
4359
  parse: function(source, defaultNSMap, entityMap) {
3498
4360
  var domBuilder = this.domBuilder;
3499
4361
  domBuilder.startDocument();
3500
- _copy(defaultNSMap, defaultNSMap = {});
4362
+ _copy(defaultNSMap, defaultNSMap = Object.create(null));
3501
4363
  parse(source, defaultNSMap, entityMap, domBuilder, this.errorHandler);
3502
4364
  domBuilder.endDocument();
3503
4365
  }
3504
4366
  };
4367
+ var ENTITY_REG = /&#?\w+;?/g;
3505
4368
  function parse(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) {
4369
+ var isHTML = isHTMLMimeType(domBuilder.mimeType);
4370
+ if (source.indexOf(g.UNICODE_REPLACEMENT_CHARACTER) >= 0) {
4371
+ errorHandler.warning("Unicode replacement character detected, source encoding issues?");
4372
+ }
3506
4373
  function fixedFromCharCode(code) {
3507
4374
  if (code > 65535) {
3508
4375
  code -= 65536;
@@ -3513,11 +4380,21 @@ var require_sax = __commonJS((exports) => {
3513
4380
  }
3514
4381
  }
3515
4382
  function entityReplacer(a2) {
3516
- var k = a2.slice(1, -1);
3517
- if (Object.hasOwnProperty.call(entityMap, k)) {
4383
+ var complete = a2[a2.length - 1] === ";" ? a2 : a2 + ";";
4384
+ if (!isHTML && complete !== a2) {
4385
+ errorHandler.error("EntityRef: expecting ;");
4386
+ return a2;
4387
+ }
4388
+ var match = g.Reference.exec(complete);
4389
+ if (!match || match[0].length !== complete.length) {
4390
+ errorHandler.error("entity not matching Reference production: " + a2);
4391
+ return a2;
4392
+ }
4393
+ var k = complete.slice(1, -1);
4394
+ if (hasOwn(entityMap, k)) {
3518
4395
  return entityMap[k];
3519
4396
  } else if (k.charAt(0) === "#") {
3520
- return fixedFromCharCode(parseInt(k.substr(1).replace("x", "0x")));
4397
+ return fixedFromCharCode(parseInt(k.substring(1).replace("x", "0x")));
3521
4398
  } else {
3522
4399
  errorHandler.error("entity not found:" + a2);
3523
4400
  return a2;
@@ -3525,94 +4402,106 @@ var require_sax = __commonJS((exports) => {
3525
4402
  }
3526
4403
  function appendText(end2) {
3527
4404
  if (end2 > start) {
3528
- var xt = source.substring(start, end2).replace(/&#?\w+;/g, entityReplacer);
4405
+ var xt = source.substring(start, end2).replace(ENTITY_REG, entityReplacer);
3529
4406
  locator && position(start);
3530
4407
  domBuilder.characters(xt, 0, end2 - start);
3531
4408
  start = end2;
3532
4409
  }
3533
4410
  }
4411
+ var lineStart = 0;
4412
+ var lineEnd = 0;
4413
+ var linePattern = /\r\n?|\n|$/g;
4414
+ var locator = domBuilder.locator;
3534
4415
  function position(p, m) {
3535
4416
  while (p >= lineEnd && (m = linePattern.exec(source))) {
3536
- lineStart = m.index;
3537
- lineEnd = lineStart + m[0].length;
4417
+ lineStart = lineEnd;
4418
+ lineEnd = m.index + m[0].length;
3538
4419
  locator.lineNumber++;
3539
4420
  }
3540
4421
  locator.columnNumber = p - lineStart + 1;
3541
4422
  }
3542
- var lineStart = 0;
3543
- var lineEnd = 0;
3544
- var linePattern = /.*(?:\r\n?|\n)|.*$/g;
3545
- var locator = domBuilder.locator;
3546
4423
  var parseStack = [{ currentNSMap: defaultNSMapCopy }];
3547
- var closeMap = {};
4424
+ var unclosedTags = [];
3548
4425
  var start = 0;
3549
4426
  while (true) {
3550
4427
  try {
3551
4428
  var tagStart = source.indexOf("<", start);
3552
4429
  if (tagStart < 0) {
3553
- if (!source.substr(start).match(/^\s*$/)) {
4430
+ if (!isHTML && unclosedTags.length > 0) {
4431
+ return errorHandler.fatalError("unclosed xml tag(s): " + unclosedTags.join(", "));
4432
+ }
4433
+ if (!source.substring(start).match(/^\s*$/)) {
3554
4434
  var doc = domBuilder.doc;
3555
- var text = doc.createTextNode(source.substr(start));
4435
+ var text = doc.createTextNode(source.substring(start));
4436
+ if (doc.documentElement) {
4437
+ return errorHandler.error("Extra content at the end of the document");
4438
+ }
3556
4439
  doc.appendChild(text);
3557
4440
  domBuilder.currentElement = text;
3558
4441
  }
3559
4442
  return;
3560
4443
  }
3561
4444
  if (tagStart > start) {
4445
+ var fromSource = source.substring(start, tagStart);
4446
+ if (!isHTML && unclosedTags.length === 0) {
4447
+ fromSource = fromSource.replace(new RegExp(g.S_OPT.source, "g"), "");
4448
+ fromSource && errorHandler.error("Unexpected content outside root element: '" + fromSource + "'");
4449
+ }
3562
4450
  appendText(tagStart);
3563
4451
  }
3564
4452
  switch (source.charAt(tagStart + 1)) {
3565
4453
  case "/":
3566
- var end = source.indexOf(">", tagStart + 3);
3567
- var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, "");
3568
- var config = parseStack.pop();
3569
- if (end < 0) {
3570
- tagName = source.substring(tagStart + 2).replace(/[\s<].*/, "");
3571
- errorHandler.error("end tag name: " + tagName + " is not complete:" + config.tagName);
3572
- end = tagStart + 1 + tagName.length;
3573
- } else if (tagName.match(/\s</)) {
3574
- tagName = tagName.replace(/[\s<].*/, "");
3575
- errorHandler.error("end tag name: " + tagName + " maybe not complete");
3576
- end = tagStart + 1 + tagName.length;
4454
+ var end = source.indexOf(">", tagStart + 2);
4455
+ var tagNameRaw = source.substring(tagStart + 2, end > 0 ? end : undefined);
4456
+ if (!tagNameRaw) {
4457
+ return errorHandler.fatalError("end tag name missing");
4458
+ }
4459
+ var tagNameMatch = end > 0 && g.reg("^", g.QName_group, g.S_OPT, "$").exec(tagNameRaw);
4460
+ if (!tagNameMatch) {
4461
+ return errorHandler.fatalError('end tag name contains invalid characters: "' + tagNameRaw + '"');
4462
+ }
4463
+ if (!domBuilder.currentElement && !domBuilder.doc.documentElement) {
4464
+ return;
3577
4465
  }
4466
+ var currentTagName = unclosedTags[unclosedTags.length - 1] || domBuilder.currentElement.tagName || domBuilder.doc.documentElement.tagName || "";
4467
+ if (currentTagName !== tagNameMatch[1]) {
4468
+ var tagNameLower = tagNameMatch[1].toLowerCase();
4469
+ if (!isHTML || currentTagName.toLowerCase() !== tagNameLower) {
4470
+ return errorHandler.fatalError('Opening and ending tag mismatch: "' + currentTagName + '" != "' + tagNameRaw + '"');
4471
+ }
4472
+ }
4473
+ var config = parseStack.pop();
4474
+ unclosedTags.pop();
3578
4475
  var localNSMap = config.localNSMap;
3579
- var endMatch = config.tagName == tagName;
3580
- var endIgnoreCaseMach = endMatch || config.tagName && config.tagName.toLowerCase() == tagName.toLowerCase();
3581
- if (endIgnoreCaseMach) {
3582
- domBuilder.endElement(config.uri, config.localName, tagName);
3583
- if (localNSMap) {
3584
- for (var prefix in localNSMap) {
3585
- if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
3586
- domBuilder.endPrefixMapping(prefix);
3587
- }
4476
+ domBuilder.endElement(config.uri, config.localName, currentTagName);
4477
+ if (localNSMap) {
4478
+ for (var prefix in localNSMap) {
4479
+ if (hasOwn(localNSMap, prefix)) {
4480
+ domBuilder.endPrefixMapping(prefix);
3588
4481
  }
3589
4482
  }
3590
- if (!endMatch) {
3591
- errorHandler.fatalError("end tag name: " + tagName + " is not match the current start tagName:" + config.tagName);
3592
- }
3593
- } else {
3594
- parseStack.push(config);
3595
4483
  }
3596
4484
  end++;
3597
4485
  break;
3598
4486
  case "?":
3599
4487
  locator && position(tagStart);
3600
- end = parseInstruction(source, tagStart, domBuilder);
4488
+ end = parseProcessingInstruction(source, tagStart, domBuilder, errorHandler);
3601
4489
  break;
3602
4490
  case "!":
3603
4491
  locator && position(tagStart);
3604
- end = parseDCC(source, tagStart, domBuilder, errorHandler);
4492
+ end = parseDoctypeCommentOrCData(source, tagStart, domBuilder, errorHandler, isHTML);
3605
4493
  break;
3606
4494
  default:
3607
4495
  locator && position(tagStart);
3608
4496
  var el = new ElementAttributes;
3609
4497
  var currentNSMap = parseStack[parseStack.length - 1].currentNSMap;
3610
- var end = parseElementStartPart(source, tagStart, el, currentNSMap, entityReplacer, errorHandler);
4498
+ var end = parseElementStartPart(source, tagStart, el, currentNSMap, entityReplacer, errorHandler, isHTML);
3611
4499
  var len = el.length;
3612
- if (!el.closed && fixSelfClosed(source, end, el.tagName, closeMap)) {
3613
- el.closed = true;
3614
- if (!entityMap.nbsp) {
3615
- errorHandler.warning("unclosed xml attribute");
4500
+ if (!el.closed) {
4501
+ if (isHTML && conventions.isHTMLVoidElement(el.tagName)) {
4502
+ el.closed = true;
4503
+ } else {
4504
+ unclosedTags.push(el.tagName);
3616
4505
  }
3617
4506
  }
3618
4507
  if (locator && len) {
@@ -3632,7 +4521,7 @@ var require_sax = __commonJS((exports) => {
3632
4521
  parseStack.push(el);
3633
4522
  }
3634
4523
  }
3635
- if (NAMESPACE.isHTML(el.uri) && !el.closed) {
4524
+ if (isHTML && !el.closed) {
3636
4525
  end = parseHtmlSpecialContent(source, end, el.tagName, entityReplacer, domBuilder);
3637
4526
  } else {
3638
4527
  end++;
@@ -3641,6 +4530,8 @@ var require_sax = __commonJS((exports) => {
3641
4530
  } catch (e) {
3642
4531
  if (e instanceof ParseError) {
3643
4532
  throw e;
4533
+ } else if (e instanceof DOMException) {
4534
+ throw new ParseError(e.name + ": " + e.message, domBuilder.locator, e);
3644
4535
  }
3645
4536
  errorHandler.error("element parse error: " + e);
3646
4537
  end = -1;
@@ -3657,12 +4548,15 @@ var require_sax = __commonJS((exports) => {
3657
4548
  t.columnNumber = f.columnNumber;
3658
4549
  return t;
3659
4550
  }
3660
- function parseElementStartPart(source, start, el, currentNSMap, entityReplacer, errorHandler) {
4551
+ function parseElementStartPart(source, start, el, currentNSMap, entityReplacer, errorHandler, isHTML) {
3661
4552
  function addAttribute(qname, value2, startIndex) {
3662
- if (el.attributeNames.hasOwnProperty(qname)) {
3663
- errorHandler.fatalError("Attribute " + qname + " redefined");
4553
+ if (hasOwn(el.attributeNames, qname)) {
4554
+ return errorHandler.fatalError("Attribute " + qname + " redefined");
4555
+ }
4556
+ if (!isHTML && value2.indexOf("<") >= 0) {
4557
+ return errorHandler.fatalError("Unescaped '<' not allowed in attributes values");
3664
4558
  }
3665
- el.addValue(qname, value2.replace(/[\t\n\r]/g, " ").replace(/&#?\w+;/g, entityReplacer), startIndex);
4559
+ el.addValue(qname, value2.replace(/[\t\n\r]/g, " ").replace(ENTITY_REG, entityReplacer), startIndex);
3666
4560
  }
3667
4561
  var attrName;
3668
4562
  var value;
@@ -3755,14 +4649,16 @@ var require_sax = __commonJS((exports) => {
3755
4649
  errorHandler.warning('attribute "' + value + '" missed quot(")!');
3756
4650
  addAttribute(attrName, value, start);
3757
4651
  } else {
3758
- if (!NAMESPACE.isHTML(currentNSMap[""]) || !value.match(/^(?:disabled|checked|selected)$/i)) {
4652
+ if (!isHTML) {
3759
4653
  errorHandler.warning('attribute "' + value + '" missed value!! "' + value + '" instead!!');
3760
4654
  }
3761
4655
  addAttribute(value, value, start);
3762
4656
  }
3763
4657
  break;
3764
4658
  case S_EQ:
3765
- throw new Error("attribute value missed!!");
4659
+ if (!isHTML) {
4660
+ return errorHandler.fatalError(`AttValue: ' or " expected`);
4661
+ }
3766
4662
  }
3767
4663
  return p;
3768
4664
  case "\x80":
@@ -3789,8 +4685,7 @@ var require_sax = __commonJS((exports) => {
3789
4685
  } else {
3790
4686
  switch (s) {
3791
4687
  case S_ATTR_SPACE:
3792
- var tagName = el.tagName;
3793
- if (!NAMESPACE.isHTML(currentNSMap[""]) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {
4688
+ if (!isHTML) {
3794
4689
  errorHandler.warning('attribute "' + attrName + '" missed value!! "' + attrName + '" instead2!!');
3795
4690
  }
3796
4691
  addAttribute(attrName, attrName, start);
@@ -3836,8 +4731,8 @@ var require_sax = __commonJS((exports) => {
3836
4731
  a.localName = localName;
3837
4732
  if (nsPrefix !== false) {
3838
4733
  if (localNSMap == null) {
3839
- localNSMap = {};
3840
- _copy(currentNSMap, currentNSMap = {});
4734
+ localNSMap = Object.create(null);
4735
+ _copy(currentNSMap, currentNSMap = Object.create(null));
3841
4736
  }
3842
4737
  currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
3843
4738
  a.uri = NAMESPACE.XMLNS;
@@ -3847,13 +4742,12 @@ var require_sax = __commonJS((exports) => {
3847
4742
  var i = el.length;
3848
4743
  while (i--) {
3849
4744
  a = el[i];
3850
- var prefix = a.prefix;
3851
- if (prefix) {
3852
- if (prefix === "xml") {
4745
+ if (a.prefix) {
4746
+ if (a.prefix === "xml") {
3853
4747
  a.uri = NAMESPACE.XML;
3854
4748
  }
3855
- if (prefix !== "xmlns") {
3856
- a.uri = currentNSMap[prefix || ""];
4749
+ if (a.prefix !== "xmlns") {
4750
+ a.uri = currentNSMap[a.prefix];
3857
4751
  }
3858
4752
  }
3859
4753
  }
@@ -3871,7 +4765,7 @@ var require_sax = __commonJS((exports) => {
3871
4765
  domBuilder.endElement(ns, localName, tagName);
3872
4766
  if (localNSMap) {
3873
4767
  for (prefix in localNSMap) {
3874
- if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
4768
+ if (hasOwn(localNSMap, prefix)) {
3875
4769
  domBuilder.endPrefixMapping(prefix);
3876
4770
  }
3877
4771
  }
@@ -3883,111 +4777,257 @@ var require_sax = __commonJS((exports) => {
3883
4777
  }
3884
4778
  }
3885
4779
  function parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) {
3886
- if (/^(?:script|textarea)$/i.test(tagName)) {
4780
+ var isEscapableRaw = isHTMLEscapableRawTextElement(tagName);
4781
+ if (isEscapableRaw || isHTMLRawTextElement(tagName)) {
3887
4782
  var elEndStart = source.indexOf("</" + tagName + ">", elStartEnd);
3888
4783
  var text = source.substring(elStartEnd + 1, elEndStart);
3889
- if (/[&<]/.test(text)) {
3890
- if (/^script$/i.test(tagName)) {
3891
- domBuilder.characters(text, 0, text.length);
3892
- return elEndStart;
3893
- }
3894
- text = text.replace(/&#?\w+;/g, entityReplacer);
3895
- domBuilder.characters(text, 0, text.length);
3896
- return elEndStart;
4784
+ if (isEscapableRaw) {
4785
+ text = text.replace(ENTITY_REG, entityReplacer);
3897
4786
  }
4787
+ domBuilder.characters(text, 0, text.length);
4788
+ return elEndStart;
3898
4789
  }
3899
4790
  return elStartEnd + 1;
3900
4791
  }
3901
- function fixSelfClosed(source, elStartEnd, tagName, closeMap) {
3902
- var pos = closeMap[tagName];
3903
- if (pos == null) {
3904
- pos = source.lastIndexOf("</" + tagName + ">");
3905
- if (pos < elStartEnd) {
3906
- pos = source.lastIndexOf("</" + tagName);
3907
- }
3908
- closeMap[tagName] = pos;
3909
- }
3910
- return pos < elStartEnd;
3911
- }
3912
4792
  function _copy(source, target) {
3913
4793
  for (var n in source) {
3914
- if (Object.prototype.hasOwnProperty.call(source, n)) {
4794
+ if (hasOwn(source, n)) {
3915
4795
  target[n] = source[n];
3916
4796
  }
3917
4797
  }
3918
4798
  }
3919
- function parseDCC(source, start, domBuilder, errorHandler) {
3920
- var next = source.charAt(start + 2);
3921
- switch (next) {
3922
- case "-":
3923
- if (source.charAt(start + 3) === "-") {
3924
- var end = source.indexOf("-->", start + 4);
3925
- if (end > start) {
3926
- domBuilder.comment(source, start + 4, end - start - 4);
3927
- return end + 3;
3928
- } else {
3929
- errorHandler.error("Unclosed comment");
3930
- return -1;
4799
+ function parseUtils(source, start) {
4800
+ var index = start;
4801
+ function char(n) {
4802
+ n = n || 0;
4803
+ return source.charAt(index + n);
4804
+ }
4805
+ function skip(n) {
4806
+ n = n || 1;
4807
+ index += n;
4808
+ }
4809
+ function skipBlanks() {
4810
+ var blanks = 0;
4811
+ while (index < source.length) {
4812
+ var c = char();
4813
+ if (c !== " " && c !== `
4814
+ ` && c !== "\t" && c !== "\r") {
4815
+ return blanks;
4816
+ }
4817
+ blanks++;
4818
+ skip();
4819
+ }
4820
+ return -1;
4821
+ }
4822
+ function substringFromIndex() {
4823
+ return source.substring(index);
4824
+ }
4825
+ function substringStartsWith(text) {
4826
+ return source.substring(index, index + text.length) === text;
4827
+ }
4828
+ function substringStartsWithCaseInsensitive(text) {
4829
+ return source.substring(index, index + text.length).toUpperCase() === text.toUpperCase();
4830
+ }
4831
+ function getMatch(args) {
4832
+ var expr = g.reg("^", args);
4833
+ var match = expr.exec(substringFromIndex());
4834
+ if (match) {
4835
+ skip(match[0].length);
4836
+ return match[0];
4837
+ }
4838
+ return null;
4839
+ }
4840
+ return {
4841
+ char,
4842
+ getIndex: function() {
4843
+ return index;
4844
+ },
4845
+ getMatch,
4846
+ getSource: function() {
4847
+ return source;
4848
+ },
4849
+ skip,
4850
+ skipBlanks,
4851
+ substringFromIndex,
4852
+ substringStartsWith,
4853
+ substringStartsWithCaseInsensitive
4854
+ };
4855
+ }
4856
+ function parseDoctypeInternalSubset(p, errorHandler) {
4857
+ function parsePI(p2, errorHandler2) {
4858
+ var match = g.PI.exec(p2.substringFromIndex());
4859
+ if (!match) {
4860
+ return errorHandler2.fatalError("processing instruction is not well-formed at position " + p2.getIndex());
4861
+ }
4862
+ if (match[1].toLowerCase() === "xml") {
4863
+ return errorHandler2.fatalError("xml declaration is only allowed at the start of the document, but found at position " + p2.getIndex());
4864
+ }
4865
+ p2.skip(match[0].length);
4866
+ return match[0];
4867
+ }
4868
+ var source = p.getSource();
4869
+ if (p.char() === "[") {
4870
+ p.skip(1);
4871
+ var intSubsetStart = p.getIndex();
4872
+ while (p.getIndex() < source.length) {
4873
+ p.skipBlanks();
4874
+ if (p.char() === "]") {
4875
+ var internalSubset = source.substring(intSubsetStart, p.getIndex());
4876
+ p.skip(1);
4877
+ return internalSubset;
4878
+ }
4879
+ var current = null;
4880
+ if (p.char() === "<" && p.char(1) === "!") {
4881
+ switch (p.char(2)) {
4882
+ case "E":
4883
+ if (p.char(3) === "L") {
4884
+ current = p.getMatch(g.elementdecl);
4885
+ } else if (p.char(3) === "N") {
4886
+ current = p.getMatch(g.EntityDecl);
4887
+ }
4888
+ break;
4889
+ case "A":
4890
+ current = p.getMatch(g.AttlistDecl);
4891
+ break;
4892
+ case "N":
4893
+ current = p.getMatch(g.NotationDecl);
4894
+ break;
4895
+ case "-":
4896
+ current = p.getMatch(g.Comment);
4897
+ break;
3931
4898
  }
4899
+ } else if (p.char() === "<" && p.char(1) === "?") {
4900
+ current = parsePI(p, errorHandler);
4901
+ } else if (p.char() === "%") {
4902
+ current = p.getMatch(g.PEReference);
3932
4903
  } else {
3933
- return -1;
4904
+ return errorHandler.fatalError("Error detected in Markup declaration");
3934
4905
  }
3935
- default:
3936
- if (source.substr(start + 3, 6) == "CDATA[") {
3937
- var end = source.indexOf("]]>", start + 9);
4906
+ if (!current) {
4907
+ return errorHandler.fatalError("Error in internal subset at position " + p.getIndex());
4908
+ }
4909
+ }
4910
+ return errorHandler.fatalError("doctype internal subset is not well-formed, missing ]");
4911
+ }
4912
+ }
4913
+ function parseDoctypeCommentOrCData(source, start, domBuilder, errorHandler, isHTML) {
4914
+ var p = parseUtils(source, start);
4915
+ switch (isHTML ? p.char(2).toUpperCase() : p.char(2)) {
4916
+ case "-":
4917
+ var comment = p.getMatch(g.Comment);
4918
+ if (comment) {
4919
+ domBuilder.comment(comment, g.COMMENT_START.length, comment.length - g.COMMENT_START.length - g.COMMENT_END.length);
4920
+ return p.getIndex();
4921
+ } else {
4922
+ return errorHandler.fatalError("comment is not well-formed at position " + p.getIndex());
4923
+ }
4924
+ case "[":
4925
+ var cdata = p.getMatch(g.CDSect);
4926
+ if (cdata) {
4927
+ if (!isHTML && !domBuilder.currentElement) {
4928
+ return errorHandler.fatalError("CDATA outside of element");
4929
+ }
3938
4930
  domBuilder.startCDATA();
3939
- domBuilder.characters(source, start + 9, end - start - 9);
4931
+ domBuilder.characters(cdata, g.CDATA_START.length, cdata.length - g.CDATA_START.length - g.CDATA_END.length);
3940
4932
  domBuilder.endCDATA();
3941
- return end + 3;
3942
- }
3943
- var matchs = split(source, start);
3944
- var len = matchs.length;
3945
- if (len > 1 && /!doctype/i.test(matchs[0][0])) {
3946
- var name = matchs[1][0];
3947
- var pubid = false;
3948
- var sysid = false;
3949
- if (len > 3) {
3950
- if (/^public$/i.test(matchs[2][0])) {
3951
- pubid = matchs[3][0];
3952
- sysid = len > 4 && matchs[4][0];
3953
- } else if (/^system$/i.test(matchs[2][0])) {
3954
- sysid = matchs[3][0];
3955
- }
4933
+ return p.getIndex();
4934
+ } else {
4935
+ return errorHandler.fatalError("Invalid CDATA starting at position " + start);
4936
+ }
4937
+ case "D": {
4938
+ if (domBuilder.doc && domBuilder.doc.documentElement) {
4939
+ return errorHandler.fatalError("Doctype not allowed inside or after documentElement at position " + p.getIndex());
4940
+ }
4941
+ if (isHTML ? !p.substringStartsWithCaseInsensitive(g.DOCTYPE_DECL_START) : !p.substringStartsWith(g.DOCTYPE_DECL_START)) {
4942
+ return errorHandler.fatalError("Expected " + g.DOCTYPE_DECL_START + " at position " + p.getIndex());
4943
+ }
4944
+ p.skip(g.DOCTYPE_DECL_START.length);
4945
+ if (p.skipBlanks() < 1) {
4946
+ return errorHandler.fatalError("Expected whitespace after " + g.DOCTYPE_DECL_START + " at position " + p.getIndex());
4947
+ }
4948
+ var doctype = {
4949
+ name: undefined,
4950
+ publicId: undefined,
4951
+ systemId: undefined,
4952
+ internalSubset: undefined
4953
+ };
4954
+ doctype.name = p.getMatch(g.Name);
4955
+ if (!doctype.name)
4956
+ return errorHandler.fatalError("doctype name missing or contains unexpected characters at position " + p.getIndex());
4957
+ if (isHTML && doctype.name.toLowerCase() !== "html") {
4958
+ errorHandler.warning("Unexpected DOCTYPE in HTML document at position " + p.getIndex());
4959
+ }
4960
+ p.skipBlanks();
4961
+ if (p.substringStartsWith(g.PUBLIC) || p.substringStartsWith(g.SYSTEM)) {
4962
+ var match = g.ExternalID_match.exec(p.substringFromIndex());
4963
+ if (!match) {
4964
+ return errorHandler.fatalError("doctype external id is not well-formed at position " + p.getIndex());
4965
+ }
4966
+ if (match.groups.SystemLiteralOnly !== undefined) {
4967
+ doctype.systemId = match.groups.SystemLiteralOnly;
4968
+ } else {
4969
+ doctype.systemId = match.groups.SystemLiteral;
4970
+ doctype.publicId = match.groups.PubidLiteral;
4971
+ }
4972
+ p.skip(match[0].length);
4973
+ } else if (isHTML && p.substringStartsWithCaseInsensitive(g.SYSTEM)) {
4974
+ p.skip(g.SYSTEM.length);
4975
+ if (p.skipBlanks() < 1) {
4976
+ return errorHandler.fatalError("Expected whitespace after " + g.SYSTEM + " at position " + p.getIndex());
4977
+ }
4978
+ doctype.systemId = p.getMatch(g.ABOUT_LEGACY_COMPAT_SystemLiteral);
4979
+ if (!doctype.systemId) {
4980
+ return errorHandler.fatalError("Expected " + g.ABOUT_LEGACY_COMPAT + " in single or double quotes after " + g.SYSTEM + " at position " + p.getIndex());
3956
4981
  }
3957
- var lastMatch = matchs[len - 1];
3958
- domBuilder.startDTD(name, pubid, sysid);
3959
- domBuilder.endDTD();
3960
- return lastMatch.index + lastMatch[0].length;
3961
4982
  }
4983
+ if (isHTML && doctype.systemId && !g.ABOUT_LEGACY_COMPAT_SystemLiteral.test(doctype.systemId)) {
4984
+ errorHandler.warning("Unexpected doctype.systemId in HTML document at position " + p.getIndex());
4985
+ }
4986
+ if (!isHTML) {
4987
+ p.skipBlanks();
4988
+ doctype.internalSubset = parseDoctypeInternalSubset(p, errorHandler);
4989
+ }
4990
+ p.skipBlanks();
4991
+ if (p.char() !== ">") {
4992
+ return errorHandler.fatalError("doctype not terminated with > at position " + p.getIndex());
4993
+ }
4994
+ p.skip(1);
4995
+ domBuilder.startDTD(doctype.name, doctype.publicId, doctype.systemId, doctype.internalSubset);
4996
+ domBuilder.endDTD();
4997
+ return p.getIndex();
4998
+ }
4999
+ default:
5000
+ return errorHandler.fatalError('Not well-formed XML starting with "<!" at position ' + start);
3962
5001
  }
3963
- return -1;
3964
5002
  }
3965
- function parseInstruction(source, start, domBuilder) {
3966
- var end = source.indexOf("?>", start);
3967
- if (end) {
3968
- var match = source.substring(start, end).match(/^<\?(\S*)\s*([\s\S]*?)$/);
3969
- if (match) {
3970
- var len = match[0].length;
3971
- domBuilder.processingInstruction(match[1], match[2]);
3972
- return end + 2;
3973
- } else {
3974
- return -1;
5003
+ function parseProcessingInstruction(source, start, domBuilder, errorHandler) {
5004
+ var match = source.substring(start).match(g.PI);
5005
+ if (!match) {
5006
+ return errorHandler.fatalError("Invalid processing instruction starting at position " + start);
5007
+ }
5008
+ if (match[1].toLowerCase() === "xml") {
5009
+ if (start > 0) {
5010
+ return errorHandler.fatalError("processing instruction at position " + start + " is an xml declaration which is only at the start of the document");
5011
+ }
5012
+ if (!g.XMLDecl.test(source.substring(start))) {
5013
+ return errorHandler.fatalError("xml declaration is not well-formed");
3975
5014
  }
3976
5015
  }
3977
- return -1;
5016
+ domBuilder.processingInstruction(match[1], match[2]);
5017
+ return start + match[0].length;
3978
5018
  }
3979
5019
  function ElementAttributes() {
3980
- this.attributeNames = {};
5020
+ this.attributeNames = Object.create(null);
3981
5021
  }
3982
5022
  ElementAttributes.prototype = {
3983
5023
  setTagName: function(tagName) {
3984
- if (!tagNamePattern.test(tagName)) {
5024
+ if (!g.QName_exact.test(tagName)) {
3985
5025
  throw new Error("invalid tagName:" + tagName);
3986
5026
  }
3987
5027
  this.tagName = tagName;
3988
5028
  },
3989
5029
  addValue: function(qName, value, offset) {
3990
- if (!tagNamePattern.test(qName)) {
5030
+ if (!g.QName_exact.test(qName)) {
3991
5031
  throw new Error("invalid attribute:" + qName);
3992
5032
  }
3993
5033
  this.attributeNames[qName] = this.length;
@@ -4010,94 +5050,94 @@ var require_sax = __commonJS((exports) => {
4010
5050
  return this[i].value;
4011
5051
  }
4012
5052
  };
4013
- function split(source, start) {
4014
- var match;
4015
- var buf = [];
4016
- var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
4017
- reg.lastIndex = start;
4018
- reg.exec(source);
4019
- while (match = reg.exec(source)) {
4020
- buf.push(match);
4021
- if (match[1])
4022
- return buf;
4023
- }
4024
- }
4025
5053
  exports.XMLReader = XMLReader;
4026
- exports.ParseError = ParseError;
5054
+ exports.parseUtils = parseUtils;
5055
+ exports.parseDoctypeCommentOrCData = parseDoctypeCommentOrCData;
4027
5056
  });
4028
5057
 
4029
- // node_modules/.bun/@xmldom+xmldom@0.8.12/node_modules/@xmldom/xmldom/lib/dom-parser.js
5058
+ // node_modules/.bun/@xmldom+xmldom@0.9.10/node_modules/@xmldom/xmldom/lib/dom-parser.js
4030
5059
  var require_dom_parser = __commonJS((exports) => {
4031
5060
  var conventions = require_conventions();
4032
5061
  var dom = require_dom();
5062
+ var errors = require_errors();
4033
5063
  var entities = require_entities();
4034
5064
  var sax = require_sax();
4035
5065
  var DOMImplementation = dom.DOMImplementation;
5066
+ var hasDefaultHTMLNamespace = conventions.hasDefaultHTMLNamespace;
5067
+ var isHTMLMimeType = conventions.isHTMLMimeType;
5068
+ var isValidMimeType = conventions.isValidMimeType;
5069
+ var MIME_TYPE = conventions.MIME_TYPE;
4036
5070
  var NAMESPACE = conventions.NAMESPACE;
4037
- var ParseError = sax.ParseError;
5071
+ var ParseError = errors.ParseError;
4038
5072
  var XMLReader = sax.XMLReader;
4039
5073
  function normalizeLineEndings(input) {
4040
5074
  return input.replace(/\r[\n\u0085]/g, `
4041
- `).replace(/[\r\u0085\u2028]/g, `
5075
+ `).replace(/[\r\u0085\u2028\u2029]/g, `
4042
5076
  `);
4043
5077
  }
4044
5078
  function DOMParser(options) {
4045
- this.options = options || { locator: {} };
5079
+ options = options || {};
5080
+ if (options.locator === undefined) {
5081
+ options.locator = true;
5082
+ }
5083
+ this.assign = options.assign || conventions.assign;
5084
+ this.domHandler = options.domHandler || DOMHandler;
5085
+ this.onError = options.onError || options.errorHandler;
5086
+ if (options.errorHandler && typeof options.errorHandler !== "function") {
5087
+ throw new TypeError("errorHandler object is no longer supported, switch to onError!");
5088
+ } else if (options.errorHandler) {
5089
+ options.errorHandler("warning", "The `errorHandler` option has been deprecated, use `onError` instead!", this);
5090
+ }
5091
+ this.normalizeLineEndings = options.normalizeLineEndings || normalizeLineEndings;
5092
+ this.locator = !!options.locator;
5093
+ this.xmlns = this.assign(Object.create(null), options.xmlns);
4046
5094
  }
4047
5095
  DOMParser.prototype.parseFromString = function(source, mimeType) {
4048
- var options = this.options;
4049
- var sax2 = new XMLReader;
4050
- var domBuilder = options.domBuilder || new DOMHandler;
4051
- var errorHandler = options.errorHandler;
4052
- var locator = options.locator;
4053
- var defaultNSMap = options.xmlns || {};
4054
- var isHTML = /\/x?html?$/.test(mimeType);
4055
- var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;
4056
- if (locator) {
4057
- domBuilder.setDocumentLocator(locator);
5096
+ if (!isValidMimeType(mimeType)) {
5097
+ throw new TypeError('DOMParser.parseFromString: the provided mimeType "' + mimeType + '" is not valid.');
4058
5098
  }
4059
- sax2.errorHandler = buildErrorHandler(errorHandler, domBuilder, locator);
4060
- sax2.domBuilder = options.domBuilder || domBuilder;
4061
- if (isHTML) {
4062
- defaultNSMap[""] = NAMESPACE.HTML;
5099
+ var defaultNSMap = this.assign(Object.create(null), this.xmlns);
5100
+ var entityMap = entities.XML_ENTITIES;
5101
+ var defaultNamespace = defaultNSMap[""] || null;
5102
+ if (hasDefaultHTMLNamespace(mimeType)) {
5103
+ entityMap = entities.HTML_ENTITIES;
5104
+ defaultNamespace = NAMESPACE.HTML;
5105
+ } else if (mimeType === MIME_TYPE.XML_SVG_IMAGE) {
5106
+ defaultNamespace = NAMESPACE.SVG;
4063
5107
  }
5108
+ defaultNSMap[""] = defaultNamespace;
4064
5109
  defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
4065
- var normalize = options.normalizeLineEndings || normalizeLineEndings;
4066
- if (source && typeof source === "string") {
4067
- sax2.parse(normalize(source), defaultNSMap, entityMap);
4068
- } else {
4069
- sax2.errorHandler.error("invalid doc source");
5110
+ var domBuilder = new this.domHandler({
5111
+ mimeType,
5112
+ defaultNamespace,
5113
+ onError: this.onError
5114
+ });
5115
+ var locator = this.locator ? {} : undefined;
5116
+ if (this.locator) {
5117
+ domBuilder.setDocumentLocator(locator);
4070
5118
  }
4071
- return domBuilder.doc;
4072
- };
4073
- function buildErrorHandler(errorImpl, domBuilder, locator) {
4074
- if (!errorImpl) {
4075
- if (domBuilder instanceof DOMHandler) {
4076
- return domBuilder;
4077
- }
4078
- errorImpl = domBuilder;
5119
+ var sax2 = new XMLReader;
5120
+ sax2.errorHandler = domBuilder;
5121
+ sax2.domBuilder = domBuilder;
5122
+ var isXml = !conventions.isHTMLMimeType(mimeType);
5123
+ if (isXml && typeof source !== "string") {
5124
+ sax2.errorHandler.fatalError("source is not a string");
4079
5125
  }
4080
- var errorHandler = {};
4081
- var isCallback = errorImpl instanceof Function;
4082
- locator = locator || {};
4083
- function build(key) {
4084
- var fn = errorImpl[key];
4085
- if (!fn && isCallback) {
4086
- fn = errorImpl.length == 2 ? function(msg) {
4087
- errorImpl(key, msg);
4088
- } : errorImpl;
4089
- }
4090
- errorHandler[key] = fn && function(msg) {
4091
- fn("[xmldom " + key + "]\t" + msg + _locator(locator));
4092
- } || function() {};
5126
+ sax2.parse(this.normalizeLineEndings(String(source)), defaultNSMap, entityMap);
5127
+ if (!domBuilder.doc.documentElement) {
5128
+ sax2.errorHandler.fatalError("missing root element");
4093
5129
  }
4094
- build("warning");
4095
- build("error");
4096
- build("fatalError");
4097
- return errorHandler;
4098
- }
4099
- function DOMHandler() {
5130
+ return domBuilder.doc;
5131
+ };
5132
+ function DOMHandler(options) {
5133
+ var opt = options || {};
5134
+ this.mimeType = opt.mimeType || MIME_TYPE.XML_APPLICATION;
5135
+ this.defaultNamespace = opt.defaultNamespace || null;
4100
5136
  this.cdata = false;
5137
+ this.currentElement = undefined;
5138
+ this.doc = undefined;
5139
+ this.locator = undefined;
5140
+ this.onError = opt.onError;
4101
5141
  }
4102
5142
  function position(locator, node) {
4103
5143
  node.lineNumber = locator.lineNumber;
@@ -4105,10 +5145,8 @@ var require_dom_parser = __commonJS((exports) => {
4105
5145
  }
4106
5146
  DOMHandler.prototype = {
4107
5147
  startDocument: function() {
4108
- this.doc = new DOMImplementation().createDocument(null, null, null);
4109
- if (this.locator) {
4110
- this.doc.documentURI = this.locator.systemId;
4111
- }
5148
+ var impl = new DOMImplementation;
5149
+ this.doc = isHTMLMimeType(this.mimeType) ? impl.createHTMLDocument(false) : impl.createDocument(this.defaultNamespace, "");
4112
5150
  },
4113
5151
  startElement: function(namespaceURI, localName, qName, attrs) {
4114
5152
  var doc = this.doc;
@@ -4128,9 +5166,7 @@ var require_dom_parser = __commonJS((exports) => {
4128
5166
  }
4129
5167
  },
4130
5168
  endElement: function(namespaceURI, localName, qName) {
4131
- var current = this.currentElement;
4132
- var tagName = current.tagName;
4133
- this.currentElement = current.parentNode;
5169
+ this.currentElement = this.currentElement.parentNode;
4134
5170
  },
4135
5171
  startPrefixMapping: function(prefix, uri) {},
4136
5172
  endPrefixMapping: function(prefix) {},
@@ -4161,9 +5197,10 @@ var require_dom_parser = __commonJS((exports) => {
4161
5197
  this.doc.normalize();
4162
5198
  },
4163
5199
  setDocumentLocator: function(locator) {
4164
- if (this.locator = locator) {
5200
+ if (locator) {
4165
5201
  locator.lineNumber = 0;
4166
5202
  }
5203
+ this.locator = locator;
4167
5204
  },
4168
5205
  comment: function(chars, start, length) {
4169
5206
  chars = _toString.apply(this, arguments);
@@ -4177,29 +5214,41 @@ var require_dom_parser = __commonJS((exports) => {
4177
5214
  endCDATA: function() {
4178
5215
  this.cdata = false;
4179
5216
  },
4180
- startDTD: function(name, publicId, systemId) {
5217
+ startDTD: function(name, publicId, systemId, internalSubset) {
4181
5218
  var impl = this.doc.implementation;
4182
5219
  if (impl && impl.createDocumentType) {
4183
- var dt = impl.createDocumentType(name, publicId, systemId);
5220
+ var dt = impl.createDocumentType(name, publicId, systemId, internalSubset);
4184
5221
  this.locator && position(this.locator, dt);
4185
5222
  appendElement(this, dt);
4186
5223
  this.doc.doctype = dt;
4187
5224
  }
4188
5225
  },
4189
- warning: function(error) {
4190
- console.warn("[xmldom warning]\t" + error, _locator(this.locator));
5226
+ reportError: function(level, message) {
5227
+ if (typeof this.onError === "function") {
5228
+ try {
5229
+ this.onError(level, message, this);
5230
+ } catch (e) {
5231
+ throw new ParseError("Reporting " + level + ' "' + message + '" caused ' + e, this.locator);
5232
+ }
5233
+ } else {
5234
+ console.error("[xmldom " + level + "]\t" + message, _locator(this.locator));
5235
+ }
5236
+ },
5237
+ warning: function(message) {
5238
+ this.reportError("warning", message);
4191
5239
  },
4192
- error: function(error) {
4193
- console.error("[xmldom error]\t" + error, _locator(this.locator));
5240
+ error: function(message) {
5241
+ this.reportError("error", message);
4194
5242
  },
4195
- fatalError: function(error) {
4196
- throw new ParseError(error, this.locator);
5243
+ fatalError: function(message) {
5244
+ this.reportError("fatalError", message);
5245
+ throw new ParseError(message, this.locator);
4197
5246
  }
4198
5247
  };
4199
5248
  function _locator(l) {
4200
5249
  if (l) {
4201
5250
  return `
4202
- @` + (l.systemId || "") + "#[line:" + l.lineNumber + ",col:" + l.columnNumber + "]";
5251
+ @#[line:` + l.lineNumber + ",col:" + l.columnNumber + "]";
4203
5252
  }
4204
5253
  }
4205
5254
  function _toString(chars, start, length) {
@@ -4217,27 +5266,69 @@ var require_dom_parser = __commonJS((exports) => {
4217
5266
  return null;
4218
5267
  };
4219
5268
  });
4220
- function appendElement(hander, node) {
4221
- if (!hander.currentElement) {
4222
- hander.doc.appendChild(node);
5269
+ function appendElement(handler, node) {
5270
+ if (!handler.currentElement) {
5271
+ handler.doc.appendChild(node);
4223
5272
  } else {
4224
- hander.currentElement.appendChild(node);
5273
+ handler.currentElement.appendChild(node);
4225
5274
  }
4226
5275
  }
5276
+ function onErrorStopParsing(level) {
5277
+ if (level === "error")
5278
+ throw "onErrorStopParsing";
5279
+ }
5280
+ function onWarningStopParsing() {
5281
+ throw "onWarningStopParsing";
5282
+ }
4227
5283
  exports.__DOMHandler = DOMHandler;
4228
- exports.normalizeLineEndings = normalizeLineEndings;
4229
5284
  exports.DOMParser = DOMParser;
5285
+ exports.normalizeLineEndings = normalizeLineEndings;
5286
+ exports.onErrorStopParsing = onErrorStopParsing;
5287
+ exports.onWarningStopParsing = onWarningStopParsing;
4230
5288
  });
4231
5289
 
4232
- // node_modules/.bun/@xmldom+xmldom@0.8.12/node_modules/@xmldom/xmldom/lib/index.js
5290
+ // node_modules/.bun/@xmldom+xmldom@0.9.10/node_modules/@xmldom/xmldom/lib/index.js
4233
5291
  var require_lib = __commonJS((exports) => {
5292
+ var conventions = require_conventions();
5293
+ exports.assign = conventions.assign;
5294
+ exports.hasDefaultHTMLNamespace = conventions.hasDefaultHTMLNamespace;
5295
+ exports.isHTMLMimeType = conventions.isHTMLMimeType;
5296
+ exports.isValidMimeType = conventions.isValidMimeType;
5297
+ exports.MIME_TYPE = conventions.MIME_TYPE;
5298
+ exports.NAMESPACE = conventions.NAMESPACE;
5299
+ var errors = require_errors();
5300
+ exports.DOMException = errors.DOMException;
5301
+ exports.DOMExceptionName = errors.DOMExceptionName;
5302
+ exports.ExceptionCode = errors.ExceptionCode;
5303
+ exports.ParseError = errors.ParseError;
4234
5304
  var dom = require_dom();
5305
+ exports.Attr = dom.Attr;
5306
+ exports.CDATASection = dom.CDATASection;
5307
+ exports.CharacterData = dom.CharacterData;
5308
+ exports.Comment = dom.Comment;
5309
+ exports.Document = dom.Document;
5310
+ exports.DocumentFragment = dom.DocumentFragment;
5311
+ exports.DocumentType = dom.DocumentType;
4235
5312
  exports.DOMImplementation = dom.DOMImplementation;
5313
+ exports.Element = dom.Element;
5314
+ exports.Entity = dom.Entity;
5315
+ exports.EntityReference = dom.EntityReference;
5316
+ exports.LiveNodeList = dom.LiveNodeList;
5317
+ exports.NamedNodeMap = dom.NamedNodeMap;
5318
+ exports.Node = dom.Node;
5319
+ exports.NodeList = dom.NodeList;
5320
+ exports.Notation = dom.Notation;
5321
+ exports.ProcessingInstruction = dom.ProcessingInstruction;
5322
+ exports.Text = dom.Text;
4236
5323
  exports.XMLSerializer = dom.XMLSerializer;
4237
- exports.DOMParser = require_dom_parser().DOMParser;
5324
+ var domParser = require_dom_parser();
5325
+ exports.DOMParser = domParser.DOMParser;
5326
+ exports.normalizeLineEndings = domParser.normalizeLineEndings;
5327
+ exports.onErrorStopParsing = domParser.onErrorStopParsing;
5328
+ exports.onWarningStopParsing = domParser.onWarningStopParsing;
4238
5329
  });
4239
5330
 
4240
- // node_modules/.bun/plist@3.1.0/node_modules/plist/lib/parse.js
5331
+ // node_modules/.bun/plist@3.1.1/node_modules/plist/lib/parse.js
4241
5332
  var require_parse = __commonJS((exports) => {
4242
5333
  var { DOMParser } = require_lib();
4243
5334
  exports.parse = parse;
@@ -4260,7 +5351,7 @@ var require_parse = __commonJS((exports) => {
4260
5351
  }
4261
5352
  }
4262
5353
  function parse(xml) {
4263
- var doc = new DOMParser().parseFromString(xml);
5354
+ var doc = new DOMParser().parseFromString(xml, "text/xml");
4264
5355
  invariant(doc.documentElement.nodeName === "plist", "malformed document. First element should be <plist>");
4265
5356
  var plist = parsePlistXML(doc.documentElement);
4266
5357
  if (plist.length == 1)
@@ -8068,7 +9159,7 @@ var require_lib2 = __commonJS((exports, module) => {
8068
9159
  }).call(exports);
8069
9160
  });
8070
9161
 
8071
- // node_modules/.bun/plist@3.1.0/node_modules/plist/lib/build.js
9162
+ // node_modules/.bun/plist@3.1.1/node_modules/plist/lib/build.js
8072
9163
  var require_build = __commonJS((exports) => {
8073
9164
  var base64 = require_base64_js();
8074
9165
  var xmlbuilder = require_lib2();
@@ -8144,7 +9235,7 @@ var require_build = __commonJS((exports) => {
8144
9235
  }
8145
9236
  });
8146
9237
 
8147
- // node_modules/.bun/plist@3.1.0/node_modules/plist/index.js
9238
+ // node_modules/.bun/plist@3.1.1/node_modules/plist/index.js
8148
9239
  var require_plist = __commonJS((exports) => {
8149
9240
  var parserFunctions = require_parse();
8150
9241
  Object.keys(parserFunctions).forEach(function(k) {