roxxie-proxy-u-prod 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (481) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +123 -0
  3. package/SOURCE.md +29 -0
  4. package/THIRD_PARTY_NOTICES.md +24 -0
  5. package/dist/assets/filters-Bu_3nHVy.bin +0 -0
  6. package/dist/assets/index-BdRlQ7d_.css +1 -0
  7. package/dist/assets/index-DcvPYWS3.js +3621 -0
  8. package/dist/assets/inject-BnVzMVpl.js +40 -0
  9. package/dist/assets/scramjet-C9HLwI-y.wasm +0 -0
  10. package/dist/defaultfavicon.png +0 -0
  11. package/dist/icon.png +0 -0
  12. package/dist/roxxie-icon.svg +12 -0
  13. package/embed.js +70 -0
  14. package/examples/single-page.html +25 -0
  15. package/package.json +42 -0
  16. package/runtime/controller.sw.js +273 -0
  17. package/runtime/index.html +18 -0
  18. package/runtime/localcontrollersw.js +7 -0
  19. package/runtime/roxxie-network.json +13 -0
  20. package/runtime/sw.js +6 -0
  21. package/scripts/build.mjs +344 -0
  22. package/scripts/smoke.mjs +123 -0
  23. package/scripts/verify.mjs +122 -0
  24. package/source/external/dreamlandjs/LICENSE +21 -0
  25. package/source/external/dreamlandjs/README.md +22 -0
  26. package/source/external/dreamlandjs/dist/core.d.ts +167 -0
  27. package/source/external/dreamlandjs/dist/core.js +2 -0
  28. package/source/external/dreamlandjs/dist/core.js.map +1 -0
  29. package/source/external/dreamlandjs/dist/core.size.html +4950 -0
  30. package/source/external/dreamlandjs/dist/js-runtime.d.ts +3 -0
  31. package/source/external/dreamlandjs/dist/js-runtime.js +2 -0
  32. package/source/external/dreamlandjs/dist/js-runtime.js.map +1 -0
  33. package/source/external/dreamlandjs/dist/jsx-runtime.d.ts +1 -0
  34. package/source/external/dreamlandjs/dist/jsx-runtime.js +2 -0
  35. package/source/external/dreamlandjs/dist/jsx-runtime.js.map +1 -0
  36. package/source/external/dreamlandjs/dist/motion.d.ts +19 -0
  37. package/source/external/dreamlandjs/dist/motion.js +2 -0
  38. package/source/external/dreamlandjs/dist/motion.js.map +1 -0
  39. package/source/external/dreamlandjs/dist/router.d.ts +48 -0
  40. package/source/external/dreamlandjs/dist/router.js +2 -0
  41. package/source/external/dreamlandjs/dist/router.js.map +1 -0
  42. package/source/external/dreamlandjs/dist/ssr.client.d.ts +3 -0
  43. package/source/external/dreamlandjs/dist/ssr.client.js +2 -0
  44. package/source/external/dreamlandjs/dist/ssr.client.js.map +1 -0
  45. package/source/external/dreamlandjs/dist/ssr.client.size.html +4950 -0
  46. package/source/external/dreamlandjs/dist/ssr.hybrid.d.ts +7 -0
  47. package/source/external/dreamlandjs/dist/ssr.hybrid.js +2 -0
  48. package/source/external/dreamlandjs/dist/ssr.hybrid.js.map +1 -0
  49. package/source/external/dreamlandjs/dist/ssr.hybrid.size.html +4950 -0
  50. package/source/external/dreamlandjs/dist/ssr.server.d.ts +11 -0
  51. package/source/external/dreamlandjs/dist/ssr.server.js +2373 -0
  52. package/source/external/dreamlandjs/dist/ssr.server.js.map +1 -0
  53. package/source/external/dreamlandjs/dist/types/core/consts.d.ts +16 -0
  54. package/source/external/dreamlandjs/dist/types/core/css/index.d.ts +11 -0
  55. package/source/external/dreamlandjs/dist/types/core/css/selectorParser.d.ts +50 -0
  56. package/source/external/dreamlandjs/dist/types/core/delegate.d.ts +10 -0
  57. package/source/external/dreamlandjs/dist/types/core/index.d.ts +9 -0
  58. package/source/external/dreamlandjs/dist/types/core/jsx/child.d.ts +2 -0
  59. package/source/external/dreamlandjs/dist/types/core/jsx/definitions.d.ts +76 -0
  60. package/source/external/dreamlandjs/dist/types/core/jsx/dom.d.ts +28 -0
  61. package/source/external/dreamlandjs/dist/types/core/jsx/index.d.ts +14 -0
  62. package/source/external/dreamlandjs/dist/types/core/state/index.d.ts +1 -0
  63. package/source/external/dreamlandjs/dist/types/core/state/pointers.d.ts +37 -0
  64. package/source/external/dreamlandjs/dist/types/core/state/state.d.ts +13 -0
  65. package/source/external/dreamlandjs/dist/types/core/state/use.d.ts +11 -0
  66. package/source/external/dreamlandjs/dist/types/core/utils.d.ts +4 -0
  67. package/source/external/dreamlandjs/dist/types/js-runtime/index.d.ts +1 -0
  68. package/source/external/dreamlandjs/dist/types/jsx-runtime/index.d.ts +2 -0
  69. package/source/external/dreamlandjs/dist/types/motion/index.d.ts +15 -0
  70. package/source/external/dreamlandjs/dist/types/router/index.d.ts +45 -0
  71. package/source/external/dreamlandjs/dist/types/ssr/client/index.d.ts +1 -0
  72. package/source/external/dreamlandjs/dist/types/ssr/common/consts.d.ts +4 -0
  73. package/source/external/dreamlandjs/dist/types/ssr/common/serialize.d.ts +4 -0
  74. package/source/external/dreamlandjs/dist/types/ssr/common/types.d.ts +21 -0
  75. package/source/external/dreamlandjs/dist/types/ssr/hybrid/index.d.ts +4 -0
  76. package/source/external/dreamlandjs/dist/types/ssr/server/index.d.ts +7 -0
  77. package/source/external/dreamlandjs/dist/types/ssr/server/vdom.d.ts +71 -0
  78. package/source/external/dreamlandjs/dist/types/util/index.d.ts +1 -0
  79. package/source/external/dreamlandjs/dist/types/util/store.d.ts +26 -0
  80. package/source/external/dreamlandjs/dist/types/vite/css-minifier.d.ts +7 -0
  81. package/source/external/dreamlandjs/dist/types/vite/index.d.ts +11 -0
  82. package/source/external/dreamlandjs/dist/util.d.ts +29 -0
  83. package/source/external/dreamlandjs/dist/util.js +2 -0
  84. package/source/external/dreamlandjs/dist/util.js.map +1 -0
  85. package/source/external/dreamlandjs/dist/vite.d.ts +19 -0
  86. package/source/external/dreamlandjs/dist/vite.js +2 -0
  87. package/source/external/dreamlandjs/dist/vite.js.map +1 -0
  88. package/source/external/dreamlandjs/package.json +101 -0
  89. package/source/external/dreamlandjs/rollup.config.ts +302 -0
  90. package/source/external/dreamlandjs/rollup.plugins.ts +1134 -0
  91. package/source/external/dreamlandjs/src/core/consts.d.ts +16 -0
  92. package/source/external/dreamlandjs/src/core/consts.js +18 -0
  93. package/source/external/dreamlandjs/src/core/css/index.ts +111 -0
  94. package/source/external/dreamlandjs/src/core/css/selectorParser.ts +313 -0
  95. package/source/external/dreamlandjs/src/core/delegate.ts +28 -0
  96. package/source/external/dreamlandjs/src/core/index.ts +31 -0
  97. package/source/external/dreamlandjs/src/core/jsx/child.ts +91 -0
  98. package/source/external/dreamlandjs/src/core/jsx/definitions.ts +125 -0
  99. package/source/external/dreamlandjs/src/core/jsx/dom.ts +49 -0
  100. package/source/external/dreamlandjs/src/core/jsx/index.ts +289 -0
  101. package/source/external/dreamlandjs/src/core/state/index.ts +1 -0
  102. package/source/external/dreamlandjs/src/core/state/pointers.ts +310 -0
  103. package/source/external/dreamlandjs/src/core/state/state.ts +112 -0
  104. package/source/external/dreamlandjs/src/core/state/use.ts +82 -0
  105. package/source/external/dreamlandjs/src/core/utils.ts +48 -0
  106. package/source/external/dreamlandjs/src/js-runtime/index.ts +4 -0
  107. package/source/external/dreamlandjs/src/jsx-runtime/index.ts +3 -0
  108. package/source/external/dreamlandjs/src/motion/index.ts +156 -0
  109. package/source/external/dreamlandjs/src/router/index.tsx +394 -0
  110. package/source/external/dreamlandjs/src/router/tsconfig.json +9 -0
  111. package/source/external/dreamlandjs/src/ssr/client/index.ts +193 -0
  112. package/source/external/dreamlandjs/src/ssr/common/consts.ts +5 -0
  113. package/source/external/dreamlandjs/src/ssr/common/serialize.ts +115 -0
  114. package/source/external/dreamlandjs/src/ssr/common/types.ts +28 -0
  115. package/source/external/dreamlandjs/src/ssr/hybrid/index.ts +144 -0
  116. package/source/external/dreamlandjs/src/ssr/server/index.ts +157 -0
  117. package/source/external/dreamlandjs/src/ssr/server/tsconfig.json +7 -0
  118. package/source/external/dreamlandjs/src/ssr/server/vdom.ts +285 -0
  119. package/source/external/dreamlandjs/src/util/index.ts +10 -0
  120. package/source/external/dreamlandjs/src/util/store.ts +134 -0
  121. package/source/external/dreamlandjs/src/vite/css-minifier.ts +222 -0
  122. package/source/external/dreamlandjs/src/vite/index.ts +60 -0
  123. package/source/external/dreamlandjs/src/vite/tsconfig.json +7 -0
  124. package/source/external/dreamlandjs/tsconfig.json +15 -0
  125. package/source/package.json +48 -0
  126. package/source/packages/adrift-protocol/package.json +31 -0
  127. package/source/packages/adrift-protocol/src/index.ts +348 -0
  128. package/source/packages/adrift-protocol/tsconfig.json +18 -0
  129. package/source/packages/cdp/LICENSE +21 -0
  130. package/source/packages/cdp/README.md +47 -0
  131. package/source/packages/cdp/dist/chobitsu.js +2 -0
  132. package/source/packages/cdp/dist/chobitsu.js.map +1 -0
  133. package/source/packages/cdp/package.json +73 -0
  134. package/source/packages/cdp/script/build.js +15 -0
  135. package/source/packages/cdp/src/Chobitsu.ts +110 -0
  136. package/source/packages/cdp/src/domains/CSS.ts +378 -0
  137. package/source/packages/cdp/src/domains/CacheStorage.ts +8 -0
  138. package/source/packages/cdp/src/domains/DOM.ts +487 -0
  139. package/source/packages/cdp/src/domains/DOMDebugger.ts +109 -0
  140. package/source/packages/cdp/src/domains/DOMStorage.ts +122 -0
  141. package/source/packages/cdp/src/domains/Debugger.ts +25 -0
  142. package/source/packages/cdp/src/domains/IndexedDB.ts +207 -0
  143. package/source/packages/cdp/src/domains/Input.ts +177 -0
  144. package/source/packages/cdp/src/domains/Network.ts +251 -0
  145. package/source/packages/cdp/src/domains/Overlay.ts +230 -0
  146. package/source/packages/cdp/src/domains/Page.ts +296 -0
  147. package/source/packages/cdp/src/domains/Runtime.ts +273 -0
  148. package/source/packages/cdp/src/domains/Storage.ts +71 -0
  149. package/source/packages/cdp/src/index.d.ts +8 -0
  150. package/source/packages/cdp/src/index.ts +153 -0
  151. package/source/packages/cdp/src/lib/connector.ts +15 -0
  152. package/source/packages/cdp/src/lib/constants.ts +1 -0
  153. package/source/packages/cdp/src/lib/evaluate.ts +59 -0
  154. package/source/packages/cdp/src/lib/mutationObserver.ts +39 -0
  155. package/source/packages/cdp/src/lib/nodeManager.ts +142 -0
  156. package/source/packages/cdp/src/lib/objManager.ts +422 -0
  157. package/source/packages/cdp/src/lib/request.ts +313 -0
  158. package/source/packages/cdp/src/lib/resources.ts +59 -0
  159. package/source/packages/cdp/src/lib/scriptMananger.ts +62 -0
  160. package/source/packages/cdp/src/lib/stylesheet.ts +146 -0
  161. package/source/packages/cdp/src/lib/util.ts +105 -0
  162. package/source/packages/cdp/tsconfig.json +16 -0
  163. package/source/packages/cdp/webpack.config.js +48 -0
  164. package/source/packages/chrome/index.html +17 -0
  165. package/source/packages/chrome/package.json +41 -0
  166. package/source/packages/chrome/public/ROXXIE_NETWORK.md +22 -0
  167. package/source/packages/chrome/public/controller.sw.js +273 -0
  168. package/source/packages/chrome/public/defaultfavicon.png +0 -0
  169. package/source/packages/chrome/public/icon.png +0 -0
  170. package/source/packages/chrome/public/localcontrollersw.js +7 -0
  171. package/source/packages/chrome/public/roxxie-icon.svg +12 -0
  172. package/source/packages/chrome/public/roxxie-network.json +13 -0
  173. package/source/packages/chrome/public/sw.js +6 -0
  174. package/source/packages/chrome/src/App.tsx +269 -0
  175. package/source/packages/chrome/src/CDP.ts +285 -0
  176. package/source/packages/chrome/src/Tab/History.ts +186 -0
  177. package/source/packages/chrome/src/Tab/Tab.tsx +219 -0
  178. package/source/packages/chrome/src/Tab/screenshot.ts +66 -0
  179. package/source/packages/chrome/src/Tab/serialize.ts +221 -0
  180. package/source/packages/chrome/src/adblock/AdBlockPlugin.test.ts +159 -0
  181. package/source/packages/chrome/src/adblock/AdBlockPlugin.ts +232 -0
  182. package/source/packages/chrome/src/adblock/AdBlockService.test.ts +148 -0
  183. package/source/packages/chrome/src/adblock/AdBlockService.ts +166 -0
  184. package/source/packages/chrome/src/adblock/NOTICE.md +14 -0
  185. package/source/packages/chrome/src/adblock/assets/filters.bin +0 -0
  186. package/source/packages/chrome/src/adblock/index.ts +18 -0
  187. package/source/packages/chrome/src/assets/favicon.ts +4 -0
  188. package/source/packages/chrome/src/components/BookmarkPopup.tsx +101 -0
  189. package/source/packages/chrome/src/components/BookmarksStrip.tsx +150 -0
  190. package/source/packages/chrome/src/components/Button.tsx +99 -0
  191. package/source/packages/chrome/src/components/Checkbox.tsx +89 -0
  192. package/source/packages/chrome/src/components/DownloadsPopup.tsx +230 -0
  193. package/source/packages/chrome/src/components/Favicon.tsx +65 -0
  194. package/source/packages/chrome/src/components/Icon.tsx +29 -0
  195. package/source/packages/chrome/src/components/Input.tsx +82 -0
  196. package/source/packages/chrome/src/components/Menu.tsx +287 -0
  197. package/source/packages/chrome/src/components/Omnibar/BookmarkButton.tsx +73 -0
  198. package/source/packages/chrome/src/components/Omnibar/CircularProgress.tsx +83 -0
  199. package/source/packages/chrome/src/components/Omnibar/Omnibar.tsx +455 -0
  200. package/source/packages/chrome/src/components/Omnibar/OmnibarButton.tsx +48 -0
  201. package/source/packages/chrome/src/components/Omnibar/Omnibox.tsx +466 -0
  202. package/source/packages/chrome/src/components/Omnibar/SiteOptionsButton.tsx +52 -0
  203. package/source/packages/chrome/src/components/Omnibar/Suggestion.tsx +186 -0
  204. package/source/packages/chrome/src/components/Omnibar/UrlInput.tsx +198 -0
  205. package/source/packages/chrome/src/components/Omnibar/suggestions.ts +468 -0
  206. package/source/packages/chrome/src/components/Omnibar/utils.ts +11 -0
  207. package/source/packages/chrome/src/components/ReportBrokenSiteModal.tsx +279 -0
  208. package/source/packages/chrome/src/components/Shell.tsx +191 -0
  209. package/source/packages/chrome/src/components/SiteInformationPopup.tsx +96 -0
  210. package/source/packages/chrome/src/components/SmallIconButton.tsx +36 -0
  211. package/source/packages/chrome/src/components/StartScreen.tsx +386 -0
  212. package/source/packages/chrome/src/components/TabStrip/DragTab.tsx +546 -0
  213. package/source/packages/chrome/src/components/TabStrip/Sidebar.tsx +820 -0
  214. package/source/packages/chrome/src/components/TabStrip/TabHoverCard.tsx +87 -0
  215. package/source/packages/chrome/src/components/TabStrip/TabStrip.tsx +510 -0
  216. package/source/packages/chrome/src/components/TopSiteButton.tsx +234 -0
  217. package/source/packages/chrome/src/consts.ts +3 -0
  218. package/source/packages/chrome/src/icons.ts +70 -0
  219. package/source/packages/chrome/src/index.ts +168 -0
  220. package/source/packages/chrome/src/migrations/0-from-legacy.ts +6 -0
  221. package/source/packages/chrome/src/migrations/1-vertical-tab-settings.ts +15 -0
  222. package/source/packages/chrome/src/migrations/index.ts +42 -0
  223. package/source/packages/chrome/src/pages/AboutPage.tsx +37 -0
  224. package/source/packages/chrome/src/pages/DownloadsPage.tsx +133 -0
  225. package/source/packages/chrome/src/pages/HistoryPage.tsx +99 -0
  226. package/source/packages/chrome/src/pages/NewTabPage.tsx +264 -0
  227. package/source/packages/chrome/src/pages/PlaygroundPage.tsx +43 -0
  228. package/source/packages/chrome/src/pages/SettingsPage.tsx +1931 -0
  229. package/source/packages/chrome/src/proxy/Controller.ts +331 -0
  230. package/source/packages/chrome/src/proxy/ProxyFrame.ts +26 -0
  231. package/source/packages/chrome/src/proxy/cache.ts +487 -0
  232. package/source/packages/chrome/src/proxy/codec.ts +11 -0
  233. package/source/packages/chrome/src/proxy/contextitems.ts +180 -0
  234. package/source/packages/chrome/src/proxy/index.ts +5 -0
  235. package/source/packages/chrome/src/proxy/roxxie.ts +85 -0
  236. package/source/packages/chrome/src/proxy/scramjet.ts +642 -0
  237. package/source/packages/chrome/src/reset.css +124 -0
  238. package/source/packages/chrome/src/runtime-base.ts +16 -0
  239. package/source/packages/chrome/src/sentry.tsx +45 -0
  240. package/source/packages/chrome/src/services/DownloadsService.ts +136 -0
  241. package/source/packages/chrome/src/services/FaviconService.ts +161 -0
  242. package/source/packages/chrome/src/services/KVWrapper.ts +169 -0
  243. package/source/packages/chrome/src/services/ProfileService.ts +94 -0
  244. package/source/packages/chrome/src/services/Service.ts +10 -0
  245. package/source/packages/chrome/src/services/SettingsService.ts +108 -0
  246. package/source/packages/chrome/src/services/TabsService.ts +161 -0
  247. package/source/packages/chrome/src/startup.test.ts +129 -0
  248. package/source/packages/chrome/src/startup.ts +161 -0
  249. package/source/packages/chrome/src/style.css +229 -0
  250. package/source/packages/chrome/src/themes.ts +756 -0
  251. package/source/packages/chrome/src/util/StatefulClass.ts +31 -0
  252. package/source/packages/chrome/src/util/index.ts +74 -0
  253. package/source/packages/chrome/src/util/memoize.ts +13 -0
  254. package/source/packages/chrome/src/vite-env.d.ts +16 -0
  255. package/source/packages/chrome/tsconfig.json +30 -0
  256. package/source/packages/chrome/vite.config.ts +47 -0
  257. package/source/packages/inject/package.json +20 -0
  258. package/source/packages/inject/src/context.ts +194 -0
  259. package/source/packages/inject/src/emulators/alwaysLastBubble.ts +168 -0
  260. package/source/packages/inject/src/emulators/anchors.ts +55 -0
  261. package/source/packages/inject/src/emulators/contextmenu.ts +46 -0
  262. package/source/packages/inject/src/emulators/history.ts +51 -0
  263. package/source/packages/inject/src/emulators/titlewatcher.ts +42 -0
  264. package/source/packages/inject/src/emulators/windowopen.ts +134 -0
  265. package/source/packages/inject/src/errorpage/errorpage.css +234 -0
  266. package/source/packages/inject/src/errorpage/errorpage.html +29 -0
  267. package/source/packages/inject/src/errorpage/errorpage.ts +76 -0
  268. package/source/packages/inject/src/index.ts +62 -0
  269. package/source/packages/inject/src/transport.ts +97 -0
  270. package/source/packages/inject/src/types.d.ts +136 -0
  271. package/source/packages/roxxie-transport/package.json +36 -0
  272. package/source/packages/roxxie-transport/src/binary.ts +398 -0
  273. package/source/packages/roxxie-transport/src/config.ts +254 -0
  274. package/source/packages/roxxie-transport/src/connection.ts +767 -0
  275. package/source/packages/roxxie-transport/src/index.ts +5 -0
  276. package/source/packages/roxxie-transport/src/tracker.ts +651 -0
  277. package/source/packages/roxxie-transport/src/transport.ts +414 -0
  278. package/source/packages/roxxie-transport/tsconfig.json +18 -0
  279. package/source/packages/scramjet/packages/controller/package.json +37 -0
  280. package/source/packages/scramjet/packages/controller/src/index.ts +861 -0
  281. package/source/packages/scramjet/packages/controller/src/inject.ts +365 -0
  282. package/source/packages/scramjet/packages/controller/src/sw.ts +231 -0
  283. package/source/packages/scramjet/packages/controller/src/symbols.ts +1 -0
  284. package/source/packages/scramjet/packages/controller/src/types.d.ts +140 -0
  285. package/source/packages/scramjet/packages/controller/src/typesEntry.ts +6 -0
  286. package/source/packages/scramjet/packages/controller/src/version.ts +30 -0
  287. package/source/packages/scramjet/packages/controller/tsconfig.json +24 -0
  288. package/source/packages/scramjet/packages/core/dist/scramjet-external.mjs +57 -0
  289. package/source/packages/scramjet/packages/core/dist/scramjet.js +13599 -0
  290. package/source/packages/scramjet/packages/core/dist/scramjet.js.map +1 -0
  291. package/source/packages/scramjet/packages/core/dist/scramjet.mjs +13649 -0
  292. package/source/packages/scramjet/packages/core/dist/scramjet.mjs.map +1 -0
  293. package/source/packages/scramjet/packages/core/dist/scramjet.wasm +0 -0
  294. package/source/packages/scramjet/packages/core/dist/scramjet_bundled.js +13601 -0
  295. package/source/packages/scramjet/packages/core/dist/scramjet_bundled.js.map +1 -0
  296. package/source/packages/scramjet/packages/core/dist/scramjet_bundled.mjs +13651 -0
  297. package/source/packages/scramjet/packages/core/dist/scramjet_bundled.mjs.map +1 -0
  298. package/source/packages/scramjet/packages/core/dist/temp-types-build/index.js +23 -0
  299. package/source/packages/scramjet/packages/core/dist/temp-types-build/index.js.map +1 -0
  300. package/source/packages/scramjet/packages/core/dist/types/Tap.d.ts +39 -0
  301. package/source/packages/scramjet/packages/core/dist/types/client/client.d.ts +115 -0
  302. package/source/packages/scramjet/packages/core/dist/types/client/entry.d.ts +5 -0
  303. package/source/packages/scramjet/packages/core/dist/types/client/events.d.ts +10 -0
  304. package/source/packages/scramjet/packages/core/dist/types/client/helpers.d.ts +1 -0
  305. package/source/packages/scramjet/packages/core/dist/types/client/index.d.ts +7 -0
  306. package/source/packages/scramjet/packages/core/dist/types/client/location.d.ts +2 -0
  307. package/source/packages/scramjet/packages/core/dist/types/client/shared/eval.d.ts +3 -0
  308. package/source/packages/scramjet/packages/core/dist/types/client/shared/sourcemaps.d.ts +19 -0
  309. package/source/packages/scramjet/packages/core/dist/types/client/shared/wrap.d.ts +4 -0
  310. package/source/packages/scramjet/packages/core/dist/types/client/singletonbox.d.ts +18 -0
  311. package/source/packages/scramjet/packages/core/dist/types/fetch/body.d.ts +3 -0
  312. package/source/packages/scramjet/packages/core/dist/types/fetch/fetch.d.ts +7 -0
  313. package/source/packages/scramjet/packages/core/dist/types/fetch/headers.d.ts +19 -0
  314. package/source/packages/scramjet/packages/core/dist/types/fetch/index.d.ts +128 -0
  315. package/source/packages/scramjet/packages/core/dist/types/fetch/parse.d.ts +23 -0
  316. package/source/packages/scramjet/packages/core/dist/types/fetch/util.d.ts +7 -0
  317. package/source/packages/scramjet/packages/core/dist/types/index.d.ts +12 -0
  318. package/source/packages/scramjet/packages/core/dist/types/shared/cookie.d.ts +26 -0
  319. package/source/packages/scramjet/packages/core/dist/types/shared/headers.d.ts +13 -0
  320. package/source/packages/scramjet/packages/core/dist/types/shared/htmlRules.d.ts +6 -0
  321. package/source/packages/scramjet/packages/core/dist/types/shared/index.d.ts +50 -0
  322. package/source/packages/scramjet/packages/core/dist/types/shared/mime.d.ts +53 -0
  323. package/source/packages/scramjet/packages/core/dist/types/shared/refresh.d.ts +7 -0
  324. package/source/packages/scramjet/packages/core/dist/types/shared/rewriters/css.d.ts +4 -0
  325. package/source/packages/scramjet/packages/core/dist/types/shared/rewriters/html.d.ts +33 -0
  326. package/source/packages/scramjet/packages/core/dist/types/shared/rewriters/index.d.ts +6 -0
  327. package/source/packages/scramjet/packages/core/dist/types/shared/rewriters/js.d.ts +11 -0
  328. package/source/packages/scramjet/packages/core/dist/types/shared/rewriters/url.d.ts +24 -0
  329. package/source/packages/scramjet/packages/core/dist/types/shared/rewriters/wasm.d.ts +7 -0
  330. package/source/packages/scramjet/packages/core/dist/types/shared/rewriters/worker.d.ts +3 -0
  331. package/source/packages/scramjet/packages/core/dist/types/shared/set-cookie-parser.d.ts +20 -0
  332. package/source/packages/scramjet/packages/core/dist/types/shared/snapshot.d.ts +186 -0
  333. package/source/packages/scramjet/packages/core/dist/types/shared/sniffEncoding.d.ts +65 -0
  334. package/source/packages/scramjet/packages/core/dist/types/shared/util.d.ts +2 -0
  335. package/source/packages/scramjet/packages/core/dist/types/symbols.d.ts +6 -0
  336. package/source/packages/scramjet/packages/core/dist/types/types.d.ts +60 -0
  337. package/source/packages/scramjet/packages/core/dist/types/typesEntry.d.ts +5 -0
  338. package/source/packages/scramjet/packages/core/lib/index.cjs +7 -0
  339. package/source/packages/scramjet/packages/core/lib/index.d.ts +8 -0
  340. package/source/packages/scramjet/packages/core/package.json +69 -0
  341. package/source/packages/scramjet/packages/core/rewriter/Cargo.lock +1985 -0
  342. package/source/packages/scramjet/packages/core/rewriter/Cargo.toml +20 -0
  343. package/source/packages/scramjet/packages/core/rewriter/coverage-macro/Cargo.toml +15 -0
  344. package/source/packages/scramjet/packages/core/rewriter/coverage-macro/src/analyze.rs +1118 -0
  345. package/source/packages/scramjet/packages/core/rewriter/coverage-macro/src/ast_table.rs +927 -0
  346. package/source/packages/scramjet/packages/core/rewriter/coverage-macro/src/helper_index.rs +556 -0
  347. package/source/packages/scramjet/packages/core/rewriter/coverage-macro/src/lib.rs +455 -0
  348. package/source/packages/scramjet/packages/core/rewriter/coverage-macro/src/reachability.rs +85 -0
  349. package/source/packages/scramjet/packages/core/rewriter/coverage-macro/src/templates.rs +192 -0
  350. package/source/packages/scramjet/packages/core/rewriter/coverage-macro/src/witness.rs +597 -0
  351. package/source/packages/scramjet/packages/core/rewriter/js/Cargo.toml +18 -0
  352. package/source/packages/scramjet/packages/core/rewriter/js/src/cfg.rs +45 -0
  353. package/source/packages/scramjet/packages/core/rewriter/js/src/changes.rs +379 -0
  354. package/source/packages/scramjet/packages/core/rewriter/js/src/lib.rs +171 -0
  355. package/source/packages/scramjet/packages/core/rewriter/js/src/rewrite.rs +290 -0
  356. package/source/packages/scramjet/packages/core/rewriter/js/src/visitor.rs +967 -0
  357. package/source/packages/scramjet/packages/core/rewriter/native/Cargo.toml +22 -0
  358. package/source/packages/scramjet/packages/core/rewriter/native/src/main.rs +166 -0
  359. package/source/packages/scramjet/packages/core/rewriter/native/src/rewriter.rs +161 -0
  360. package/source/packages/scramjet/packages/core/rewriter/native/src/test_runner.rs +156 -0
  361. package/source/packages/scramjet/packages/core/rewriter/rust-toolchain.toml +5 -0
  362. package/source/packages/scramjet/packages/core/rewriter/rustfmt.toml +2 -0
  363. package/source/packages/scramjet/packages/core/rewriter/transform/Cargo.toml +16 -0
  364. package/source/packages/scramjet/packages/core/rewriter/transform/src/lib.rs +242 -0
  365. package/source/packages/scramjet/packages/core/rewriter/transform/src/transform.rs +123 -0
  366. package/source/packages/scramjet/packages/core/rewriter/wasm/Cargo.toml +22 -0
  367. package/source/packages/scramjet/packages/core/rewriter/wasm/build.sh +128 -0
  368. package/source/packages/scramjet/packages/core/rewriter/wasm/src/error.rs +56 -0
  369. package/source/packages/scramjet/packages/core/rewriter/wasm/src/jsr.rs +125 -0
  370. package/source/packages/scramjet/packages/core/rewriter/wasm/src/lib.rs +144 -0
  371. package/source/packages/scramjet/packages/core/src/Tap.ts +166 -0
  372. package/source/packages/scramjet/packages/core/src/client/client.ts +916 -0
  373. package/source/packages/scramjet/packages/core/src/client/dom/attr.ts +94 -0
  374. package/source/packages/scramjet/packages/core/src/client/dom/beacon.ts +11 -0
  375. package/source/packages/scramjet/packages/core/src/client/dom/cookie.ts +21 -0
  376. package/source/packages/scramjet/packages/core/src/client/dom/css.ts +106 -0
  377. package/source/packages/scramjet/packages/core/src/client/dom/document.ts +140 -0
  378. package/source/packages/scramjet/packages/core/src/client/dom/element.ts +783 -0
  379. package/source/packages/scramjet/packages/core/src/client/dom/fontface.ts +11 -0
  380. package/source/packages/scramjet/packages/core/src/client/dom/fragments.ts +32 -0
  381. package/source/packages/scramjet/packages/core/src/client/dom/history.ts +35 -0
  382. package/source/packages/scramjet/packages/core/src/client/dom/open.ts +59 -0
  383. package/source/packages/scramjet/packages/core/src/client/dom/origin.ts +13 -0
  384. package/source/packages/scramjet/packages/core/src/client/dom/performance.ts +50 -0
  385. package/source/packages/scramjet/packages/core/src/client/dom/protocol.ts +17 -0
  386. package/source/packages/scramjet/packages/core/src/client/dom/storage.ts +107 -0
  387. package/source/packages/scramjet/packages/core/src/client/entry.ts +12 -0
  388. package/source/packages/scramjet/packages/core/src/client/events.ts +10 -0
  389. package/source/packages/scramjet/packages/core/src/client/helpers.ts +7 -0
  390. package/source/packages/scramjet/packages/core/src/client/index.ts +7 -0
  391. package/source/packages/scramjet/packages/core/src/client/location.ts +139 -0
  392. package/source/packages/scramjet/packages/core/src/client/shared/antiantidebugger.ts +20 -0
  393. package/source/packages/scramjet/packages/core/src/client/shared/blob.ts +35 -0
  394. package/source/packages/scramjet/packages/core/src/client/shared/caches.ts +31 -0
  395. package/source/packages/scramjet/packages/core/src/client/shared/chrome.ts +90 -0
  396. package/source/packages/scramjet/packages/core/src/client/shared/err.ts +55 -0
  397. package/source/packages/scramjet/packages/core/src/client/shared/error.ts +42 -0
  398. package/source/packages/scramjet/packages/core/src/client/shared/eval.ts +40 -0
  399. package/source/packages/scramjet/packages/core/src/client/shared/event.ts +215 -0
  400. package/source/packages/scramjet/packages/core/src/client/shared/function.ts +59 -0
  401. package/source/packages/scramjet/packages/core/src/client/shared/import.ts +46 -0
  402. package/source/packages/scramjet/packages/core/src/client/shared/indexeddb.ts +18 -0
  403. package/source/packages/scramjet/packages/core/src/client/shared/opfs.ts +27 -0
  404. package/source/packages/scramjet/packages/core/src/client/shared/postmessage.ts +113 -0
  405. package/source/packages/scramjet/packages/core/src/client/shared/realm.ts +26 -0
  406. package/source/packages/scramjet/packages/core/src/client/shared/requests/eventsource.ts +17 -0
  407. package/source/packages/scramjet/packages/core/src/client/shared/requests/fetch.ts +67 -0
  408. package/source/packages/scramjet/packages/core/src/client/shared/requests/websocket.ts +389 -0
  409. package/source/packages/scramjet/packages/core/src/client/shared/requests/xmlhttprequest.ts +163 -0
  410. package/source/packages/scramjet/packages/core/src/client/shared/settimeout.ts +20 -0
  411. package/source/packages/scramjet/packages/core/src/client/shared/sourcemaps.ts +203 -0
  412. package/source/packages/scramjet/packages/core/src/client/shared/worker.ts +72 -0
  413. package/source/packages/scramjet/packages/core/src/client/shared/wrap.ts +197 -0
  414. package/source/packages/scramjet/packages/core/src/client/singletonbox.ts +52 -0
  415. package/source/packages/scramjet/packages/core/src/client/worker/importScripts.ts +13 -0
  416. package/source/packages/scramjet/packages/core/src/fetch/body.ts +93 -0
  417. package/source/packages/scramjet/packages/core/src/fetch/fetch.ts +323 -0
  418. package/source/packages/scramjet/packages/core/src/fetch/headers.ts +528 -0
  419. package/source/packages/scramjet/packages/core/src/fetch/index.ts +198 -0
  420. package/source/packages/scramjet/packages/core/src/fetch/parse.ts +149 -0
  421. package/source/packages/scramjet/packages/core/src/fetch/util.ts +81 -0
  422. package/source/packages/scramjet/packages/core/src/global.d.ts +32 -0
  423. package/source/packages/scramjet/packages/core/src/index.ts +78 -0
  424. package/source/packages/scramjet/packages/core/src/log.ts +117 -0
  425. package/source/packages/scramjet/packages/core/src/shared/cookie.ts +199 -0
  426. package/source/packages/scramjet/packages/core/src/shared/headers.ts +76 -0
  427. package/source/packages/scramjet/packages/core/src/shared/htmlRules.ts +154 -0
  428. package/source/packages/scramjet/packages/core/src/shared/index.ts +79 -0
  429. package/source/packages/scramjet/packages/core/src/shared/mime.ts +234 -0
  430. package/source/packages/scramjet/packages/core/src/shared/refresh.ts +164 -0
  431. package/source/packages/scramjet/packages/core/src/shared/rewriters/css.ts +67 -0
  432. package/source/packages/scramjet/packages/core/src/shared/rewriters/html.ts +603 -0
  433. package/source/packages/scramjet/packages/core/src/shared/rewriters/index.ts +6 -0
  434. package/source/packages/scramjet/packages/core/src/shared/rewriters/js.ts +158 -0
  435. package/source/packages/scramjet/packages/core/src/shared/rewriters/url.ts +248 -0
  436. package/source/packages/scramjet/packages/core/src/shared/rewriters/wasm.ts +58 -0
  437. package/source/packages/scramjet/packages/core/src/shared/rewriters/worker.ts +37 -0
  438. package/source/packages/scramjet/packages/core/src/shared/set-cookie-parser.ts +195 -0
  439. package/source/packages/scramjet/packages/core/src/shared/snapshot.ts +245 -0
  440. package/source/packages/scramjet/packages/core/src/shared/sniffEncoding.ts +1061 -0
  441. package/source/packages/scramjet/packages/core/src/shared/util.ts +35 -0
  442. package/source/packages/scramjet/packages/core/src/symbols.ts +9 -0
  443. package/source/packages/scramjet/packages/core/src/sync.ts +63 -0
  444. package/source/packages/scramjet/packages/core/src/types.ts +66 -0
  445. package/source/packages/scramjet/packages/core/src/typesEntry.ts +6 -0
  446. package/source/packages/scramjet/packages/core/tsconfig.json +21 -0
  447. package/source/packages/scramjet/packages/rpc/index.ts +100 -0
  448. package/source/packages/scramjet/packages/rpc/package.json +7 -0
  449. package/source/packages/scramjet/packages/utils/package.json +39 -0
  450. package/source/packages/scramjet/packages/utils/src/alwaysLastBubble.ts +172 -0
  451. package/source/packages/scramjet/packages/utils/src/catch-escaped-links.ts +34 -0
  452. package/source/packages/scramjet/packages/utils/src/event-handler-plugin.ts +86 -0
  453. package/source/packages/scramjet/packages/utils/src/global.d.ts +8 -0
  454. package/source/packages/scramjet/packages/utils/src/http-cache-plugin.ts +475 -0
  455. package/source/packages/scramjet/packages/utils/src/index.ts +26 -0
  456. package/source/packages/scramjet/packages/utils/src/link-handler-plugin.ts +75 -0
  457. package/source/packages/scramjet/packages/utils/src/typesEntry.ts +5 -0
  458. package/source/packages/scramjet/packages/utils/src/url-watcher.ts +37 -0
  459. package/source/packages/scramjet/packages/utils/src/version.ts +40 -0
  460. package/source/packages/scramjet/packages/utils/tsconfig.json +11 -0
  461. package/source/packages/scramjet/patches/htmlparser2@12.0.0.patch +124 -0
  462. package/source/packages/scramjet/rspack.config.ts +613 -0
  463. package/source/packages/scramjet/tsconfig.json +11 -0
  464. package/source/packages/tracker-protocol/package.json +31 -0
  465. package/source/packages/tracker-protocol/src/index.ts +745 -0
  466. package/source/packages/tracker-protocol/tsconfig.json +18 -0
  467. package/source/pnpm-lock.yaml +12018 -0
  468. package/source/pnpm-workspace.yaml +31 -0
  469. package/source/rspack.config.ts +103 -0
  470. package/source/scripts/update-adblock-assets.mjs +164 -0
  471. package/third_party/filter-lists/LICENSE-CC-BY-SA-3.0.txt +359 -0
  472. package/third_party/filter-lists/LICENSE-GPL-3.0.txt +674 -0
  473. package/third_party/filter-lists/LICENSE-MPL-2.0.txt +375 -0
  474. package/third_party/filter-lists/README.md +24 -0
  475. package/third_party/filter-lists/easylist.txt +83088 -0
  476. package/third_party/filter-lists/easyprivacy.txt +56361 -0
  477. package/third_party/filter-lists/manifest.json +56 -0
  478. package/third_party/filter-lists/ublock-filters.txt +10937 -0
  479. package/third_party/filter-lists/ublock-privacy.txt +3209 -0
  480. package/third_party/filter-lists/ublock-resources.json +1852 -0
  481. package/third_party/filter-lists/ublock-unbreak.txt +6026 -0
@@ -0,0 +1,2373 @@
1
+ import { Element as Element$1, Comment as Comment$1, Text as Text$1 } from 'domhandler';
2
+ import { NO_CHANGE, Pointer, DREAMLAND, setDomImpl, domImpl } from 'dreamland/core';
3
+ import { parseDocument } from 'htmlparser2';
4
+ import renderToString from 'dom-serializer';
5
+ import { AsyncLocalStorage } from 'node:async_hooks';
6
+
7
+ var CSSOM = {};
8
+
9
+
10
+ /**
11
+ * @constructor
12
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration
13
+ */
14
+ CSSOM.CSSStyleDeclaration = function CSSStyleDeclaration(){
15
+ this.length = 0;
16
+ this.parentRule = null;
17
+
18
+ // NON-STANDARD
19
+ this._importants = {};
20
+ };
21
+
22
+
23
+ CSSOM.CSSStyleDeclaration.prototype = {
24
+
25
+ constructor: CSSOM.CSSStyleDeclaration,
26
+
27
+ /**
28
+ *
29
+ * @param {string} name
30
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-getPropertyValue
31
+ * @return {string} the value of the property if it has been explicitly set for this declaration block.
32
+ * Returns the empty string if the property has not been set.
33
+ */
34
+ getPropertyValue: function(name) {
35
+ return this[name] || "";
36
+ },
37
+
38
+ /**
39
+ *
40
+ * @param {string} name
41
+ * @param {string} value
42
+ * @param {string} [priority=null] "important" or null
43
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-setProperty
44
+ */
45
+ setProperty: function(name, value, priority) {
46
+ if (this[name]) {
47
+ // Property already exist. Overwrite it.
48
+ var index = Array.prototype.indexOf.call(this, name);
49
+ if (index < 0) {
50
+ this[this.length] = name;
51
+ this.length++;
52
+ }
53
+ } else {
54
+ // New property.
55
+ this[this.length] = name;
56
+ this.length++;
57
+ }
58
+ this[name] = value + "";
59
+ this._importants[name] = priority;
60
+ },
61
+
62
+ /**
63
+ *
64
+ * @param {string} name
65
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-removeProperty
66
+ * @return {string} the value of the property if it has been explicitly set for this declaration block.
67
+ * Returns the empty string if the property has not been set or the property name does not correspond to a known CSS property.
68
+ */
69
+ removeProperty: function(name) {
70
+ if (!(name in this)) {
71
+ return "";
72
+ }
73
+ var index = Array.prototype.indexOf.call(this, name);
74
+ if (index < 0) {
75
+ return "";
76
+ }
77
+ var prevValue = this[name];
78
+ this[name] = "";
79
+
80
+ // That's what WebKit and Opera do
81
+ Array.prototype.splice.call(this, index, 1);
82
+
83
+ // That's what Firefox does
84
+ //this[index] = ""
85
+
86
+ return prevValue;
87
+ },
88
+
89
+ getPropertyCSSValue: function() {
90
+ //FIXME
91
+ },
92
+
93
+ /**
94
+ *
95
+ * @param {String} name
96
+ */
97
+ getPropertyPriority: function(name) {
98
+ return this._importants[name] || "";
99
+ },
100
+
101
+
102
+ /**
103
+ * element.style.overflow = "auto"
104
+ * element.style.getPropertyShorthand("overflow-x")
105
+ * -> "overflow"
106
+ */
107
+ getPropertyShorthand: function() {
108
+ //FIXME
109
+ },
110
+
111
+ isPropertyImplicit: function() {
112
+ //FIXME
113
+ },
114
+
115
+ // Doesn't work in IE < 9
116
+ get cssText(){
117
+ var properties = [];
118
+ for (var i=0, length=this.length; i < length; ++i) {
119
+ var name = this[i];
120
+ var value = this.getPropertyValue(name);
121
+ var priority = this.getPropertyPriority(name);
122
+ if (priority) {
123
+ priority = " !" + priority;
124
+ }
125
+ properties[i] = name + ": " + value + priority + ";";
126
+ }
127
+ return properties.join(" ");
128
+ },
129
+
130
+ set cssText(text){
131
+ var i, name;
132
+ for (i = this.length; i--;) {
133
+ name = this[i];
134
+ this[name] = "";
135
+ }
136
+ Array.prototype.splice.call(this, 0, this.length);
137
+ this._importants = {};
138
+
139
+ var dummyRule = CSSOM.parse('#bogus{' + text + '}').cssRules[0].style;
140
+ var length = dummyRule.length;
141
+ for (i = 0; i < length; ++i) {
142
+ name = dummyRule[i];
143
+ this.setProperty(dummyRule[i], dummyRule.getPropertyValue(name), dummyRule.getPropertyPriority(name));
144
+ }
145
+ }
146
+ };
147
+
148
+
149
+
150
+ /**
151
+ * @constructor
152
+ * @see http://dev.w3.org/csswg/cssom/#the-cssrule-interface
153
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSRule
154
+ */
155
+ CSSOM.CSSRule = function CSSRule() {
156
+ this.parentRule = null;
157
+ this.parentStyleSheet = null;
158
+ };
159
+
160
+ CSSOM.CSSRule.UNKNOWN_RULE = 0; // obsolete
161
+ CSSOM.CSSRule.STYLE_RULE = 1;
162
+ CSSOM.CSSRule.CHARSET_RULE = 2; // obsolete
163
+ CSSOM.CSSRule.IMPORT_RULE = 3;
164
+ CSSOM.CSSRule.MEDIA_RULE = 4;
165
+ CSSOM.CSSRule.FONT_FACE_RULE = 5;
166
+ CSSOM.CSSRule.PAGE_RULE = 6;
167
+ CSSOM.CSSRule.KEYFRAMES_RULE = 7;
168
+ CSSOM.CSSRule.KEYFRAME_RULE = 8;
169
+ CSSOM.CSSRule.MARGIN_RULE = 9;
170
+ CSSOM.CSSRule.NAMESPACE_RULE = 10;
171
+ CSSOM.CSSRule.COUNTER_STYLE_RULE = 11;
172
+ CSSOM.CSSRule.SUPPORTS_RULE = 12;
173
+ CSSOM.CSSRule.DOCUMENT_RULE = 13;
174
+ CSSOM.CSSRule.FONT_FEATURE_VALUES_RULE = 14;
175
+ CSSOM.CSSRule.VIEWPORT_RULE = 15;
176
+ CSSOM.CSSRule.REGION_STYLE_RULE = 16;
177
+ CSSOM.CSSRule.CONTAINER_RULE = 17;
178
+ CSSOM.CSSRule.LAYER_BLOCK_RULE = 18;
179
+ CSSOM.CSSRule.STARTING_STYLE_RULE = 1002;
180
+
181
+ CSSOM.CSSRule.prototype = {
182
+ constructor: CSSOM.CSSRule,
183
+ //FIXME
184
+ };
185
+
186
+ CSSOM.CSSRule;
187
+ ///CommonJS
188
+ /**
189
+ * @constructor
190
+ * @see https://drafts.csswg.org/cssom/#the-cssgroupingrule-interface
191
+ */
192
+ CSSOM.CSSGroupingRule = function CSSGroupingRule() {
193
+ CSSOM.CSSRule.call(this);
194
+ this.cssRules = [];
195
+ };
196
+
197
+ CSSOM.CSSGroupingRule.prototype = new CSSOM.CSSRule();
198
+ CSSOM.CSSGroupingRule.prototype.constructor = CSSOM.CSSGroupingRule;
199
+
200
+
201
+ /**
202
+ * Used to insert a new CSS rule to a list of CSS rules.
203
+ *
204
+ * @example
205
+ * cssGroupingRule.cssText
206
+ * -> "body{margin:0;}"
207
+ * cssGroupingRule.insertRule("img{border:none;}", 1)
208
+ * -> 1
209
+ * cssGroupingRule.cssText
210
+ * -> "body{margin:0;}img{border:none;}"
211
+ *
212
+ * @param {string} rule
213
+ * @param {number} [index]
214
+ * @see https://www.w3.org/TR/cssom-1/#dom-cssgroupingrule-insertrule
215
+ * @return {number} The index within the grouping rule's collection of the newly inserted rule.
216
+ */
217
+ CSSOM.CSSGroupingRule.prototype.insertRule = function insertRule(rule, index) {
218
+ if (index < 0 || index > this.cssRules.length) {
219
+ throw new RangeError("INDEX_SIZE_ERR");
220
+ }
221
+ var cssRule = CSSOM.parse(rule).cssRules[0];
222
+ cssRule.parentRule = this;
223
+ this.cssRules.splice(index, 0, cssRule);
224
+ return index;
225
+ };
226
+
227
+ /**
228
+ * Used to delete a rule from the grouping rule.
229
+ *
230
+ * cssGroupingRule.cssText
231
+ * -> "img{border:none;}body{margin:0;}"
232
+ * cssGroupingRule.deleteRule(0)
233
+ * cssGroupingRule.cssText
234
+ * -> "body{margin:0;}"
235
+ *
236
+ * @param {number} index within the grouping rule's rule list of the rule to remove.
237
+ * @see https://www.w3.org/TR/cssom-1/#dom-cssgroupingrule-deleterule
238
+ */
239
+ CSSOM.CSSGroupingRule.prototype.deleteRule = function deleteRule(index) {
240
+ if (index < 0 || index >= this.cssRules.length) {
241
+ throw new RangeError("INDEX_SIZE_ERR");
242
+ }
243
+ this.cssRules.splice(index, 1)[0].parentRule = null;
244
+ };
245
+
246
+
247
+ /**
248
+ * @constructor
249
+ * @see https://www.w3.org/TR/css-conditional-3/#the-cssconditionrule-interface
250
+ */
251
+ CSSOM.CSSConditionRule = function CSSConditionRule() {
252
+ CSSOM.CSSGroupingRule.call(this);
253
+ this.cssRules = [];
254
+ };
255
+
256
+ CSSOM.CSSConditionRule.prototype = new CSSOM.CSSGroupingRule();
257
+ CSSOM.CSSConditionRule.prototype.constructor = CSSOM.CSSConditionRule;
258
+ CSSOM.CSSConditionRule.prototype.conditionText = '';
259
+ CSSOM.CSSConditionRule.prototype.cssText = '';
260
+
261
+
262
+ /**
263
+ * @constructor
264
+ * @see http://dev.w3.org/csswg/cssom/#cssstylerule
265
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleRule
266
+ */
267
+ CSSOM.CSSStyleRule = function CSSStyleRule() {
268
+ CSSOM.CSSRule.call(this);
269
+ this.selectorText = "";
270
+ this.style = new CSSOM.CSSStyleDeclaration();
271
+ this.style.parentRule = this;
272
+ };
273
+
274
+ CSSOM.CSSStyleRule.prototype = new CSSOM.CSSRule();
275
+ CSSOM.CSSStyleRule.prototype.constructor = CSSOM.CSSStyleRule;
276
+ CSSOM.CSSStyleRule.prototype.type = 1;
277
+
278
+ Object.defineProperty(CSSOM.CSSStyleRule.prototype, "cssText", {
279
+ get: function() {
280
+ var text;
281
+ if (this.selectorText) {
282
+ text = this.selectorText + " {" + this.style.cssText + "}";
283
+ } else {
284
+ text = "";
285
+ }
286
+ return text;
287
+ },
288
+ set: function(cssText) {
289
+ var rule = CSSOM.CSSStyleRule.parse(cssText);
290
+ this.style = rule.style;
291
+ this.selectorText = rule.selectorText;
292
+ }
293
+ });
294
+
295
+
296
+ /**
297
+ * NON-STANDARD
298
+ * lightweight version of parse.js.
299
+ * @param {string} ruleText
300
+ * @return CSSStyleRule
301
+ */
302
+ CSSOM.CSSStyleRule.parse = function(ruleText) {
303
+ var i = 0;
304
+ var state = "selector";
305
+ var index;
306
+ var j = i;
307
+ var buffer = "";
308
+
309
+ var SIGNIFICANT_WHITESPACE = {
310
+ "selector": true,
311
+ "value": true
312
+ };
313
+
314
+ var styleRule = new CSSOM.CSSStyleRule();
315
+ var name, priority="";
316
+
317
+ for (var character; (character = ruleText.charAt(i)); i++) {
318
+
319
+ switch (character) {
320
+
321
+ case " ":
322
+ case "\t":
323
+ case "\r":
324
+ case "\n":
325
+ case "\f":
326
+ if (SIGNIFICANT_WHITESPACE[state]) {
327
+ // Squash 2 or more white-spaces in the row into 1
328
+ switch (ruleText.charAt(i - 1)) {
329
+ case " ":
330
+ case "\t":
331
+ case "\r":
332
+ case "\n":
333
+ case "\f":
334
+ break;
335
+ default:
336
+ buffer += " ";
337
+ break;
338
+ }
339
+ }
340
+ break;
341
+
342
+ // String
343
+ case '"':
344
+ j = i + 1;
345
+ index = ruleText.indexOf('"', j) + 1;
346
+ if (!index) {
347
+ throw '" is missing';
348
+ }
349
+ buffer += ruleText.slice(i, index);
350
+ i = index - 1;
351
+ break;
352
+
353
+ case "'":
354
+ j = i + 1;
355
+ index = ruleText.indexOf("'", j) + 1;
356
+ if (!index) {
357
+ throw "' is missing";
358
+ }
359
+ buffer += ruleText.slice(i, index);
360
+ i = index - 1;
361
+ break;
362
+
363
+ // Comment
364
+ case "/":
365
+ if (ruleText.charAt(i + 1) === "*") {
366
+ i += 2;
367
+ index = ruleText.indexOf("*/", i);
368
+ if (index === -1) {
369
+ throw new SyntaxError("Missing */");
370
+ } else {
371
+ i = index + 1;
372
+ }
373
+ } else {
374
+ buffer += character;
375
+ }
376
+ break;
377
+
378
+ case "{":
379
+ if (state === "selector") {
380
+ styleRule.selectorText = buffer.trim();
381
+ buffer = "";
382
+ state = "name";
383
+ }
384
+ break;
385
+
386
+ case ":":
387
+ if (state === "name") {
388
+ name = buffer.trim();
389
+ buffer = "";
390
+ state = "value";
391
+ } else {
392
+ buffer += character;
393
+ }
394
+ break;
395
+
396
+ case "!":
397
+ if (state === "value" && ruleText.indexOf("!important", i) === i) {
398
+ priority = "important";
399
+ i += "important".length;
400
+ } else {
401
+ buffer += character;
402
+ }
403
+ break;
404
+
405
+ case ";":
406
+ if (state === "value") {
407
+ styleRule.style.setProperty(name, buffer.trim(), priority);
408
+ priority = "";
409
+ buffer = "";
410
+ state = "name";
411
+ } else {
412
+ buffer += character;
413
+ }
414
+ break;
415
+
416
+ case "}":
417
+ if (state === "value") {
418
+ styleRule.style.setProperty(name, buffer.trim(), priority);
419
+ priority = "";
420
+ buffer = "";
421
+ } else if (state === "name") {
422
+ break;
423
+ } else {
424
+ buffer += character;
425
+ }
426
+ state = "selector";
427
+ break;
428
+
429
+ default:
430
+ buffer += character;
431
+ break;
432
+
433
+ }
434
+ }
435
+
436
+ return styleRule;
437
+
438
+ };
439
+
440
+
441
+
442
+ /**
443
+ * @constructor
444
+ * @see http://dev.w3.org/csswg/cssom/#the-medialist-interface
445
+ */
446
+ CSSOM.MediaList = function MediaList(){
447
+ this.length = 0;
448
+ };
449
+
450
+ CSSOM.MediaList.prototype = {
451
+
452
+ constructor: CSSOM.MediaList,
453
+
454
+ /**
455
+ * @return {string}
456
+ */
457
+ get mediaText() {
458
+ return Array.prototype.join.call(this, ", ");
459
+ },
460
+
461
+ /**
462
+ * @param {string} value
463
+ */
464
+ set mediaText(value) {
465
+ var values = value.split(",");
466
+ var length = this.length = values.length;
467
+ for (var i=0; i<length; i++) {
468
+ this[i] = values[i].trim();
469
+ }
470
+ },
471
+
472
+ /**
473
+ * @param {string} medium
474
+ */
475
+ appendMedium: function(medium) {
476
+ if (Array.prototype.indexOf.call(this, medium) === -1) {
477
+ this[this.length] = medium;
478
+ this.length++;
479
+ }
480
+ },
481
+
482
+ /**
483
+ * @param {string} medium
484
+ */
485
+ deleteMedium: function(medium) {
486
+ var index = Array.prototype.indexOf.call(this, medium);
487
+ if (index !== -1) {
488
+ Array.prototype.splice.call(this, index, 1);
489
+ }
490
+ }
491
+
492
+ };
493
+
494
+
495
+
496
+ /**
497
+ * @constructor
498
+ * @see http://dev.w3.org/csswg/cssom/#cssmediarule
499
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSMediaRule
500
+ */
501
+ CSSOM.CSSMediaRule = function CSSMediaRule() {
502
+ CSSOM.CSSConditionRule.call(this);
503
+ this.media = new CSSOM.MediaList();
504
+ };
505
+
506
+ CSSOM.CSSMediaRule.prototype = new CSSOM.CSSConditionRule();
507
+ CSSOM.CSSMediaRule.prototype.constructor = CSSOM.CSSMediaRule;
508
+ CSSOM.CSSMediaRule.prototype.type = 4;
509
+
510
+ // https://opensource.apple.com/source/WebCore/WebCore-7611.1.21.161.3/css/CSSMediaRule.cpp
511
+ Object.defineProperties(CSSOM.CSSMediaRule.prototype, {
512
+ "conditionText": {
513
+ get: function() {
514
+ return this.media.mediaText;
515
+ },
516
+ set: function(value) {
517
+ this.media.mediaText = value;
518
+ },
519
+ configurable: true,
520
+ enumerable: true
521
+ },
522
+ "cssText": {
523
+ get: function() {
524
+ var cssTexts = [];
525
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
526
+ cssTexts.push(this.cssRules[i].cssText);
527
+ }
528
+ return "@media " + this.media.mediaText + " {" + cssTexts.join("") + "}";
529
+ },
530
+ configurable: true,
531
+ enumerable: true
532
+ }
533
+ });
534
+
535
+
536
+
537
+ /**
538
+ * @constructor
539
+ * @see https://drafts.csswg.org/css-contain-3/
540
+ * @see https://www.w3.org/TR/css-contain-3/
541
+ */
542
+ CSSOM.CSSContainerRule = function CSSContainerRule() {
543
+ CSSOM.CSSConditionRule.call(this);
544
+ };
545
+
546
+ CSSOM.CSSContainerRule.prototype = new CSSOM.CSSConditionRule();
547
+ CSSOM.CSSContainerRule.prototype.constructor = CSSOM.CSSContainerRule;
548
+ CSSOM.CSSContainerRule.prototype.type = 17;
549
+
550
+ Object.defineProperties(CSSOM.CSSContainerRule.prototype, {
551
+ "conditionText": {
552
+ get: function() {
553
+ return this.containerText;
554
+ },
555
+ set: function(value) {
556
+ this.containerText = value;
557
+ },
558
+ configurable: true,
559
+ enumerable: true
560
+ },
561
+ "cssText": {
562
+ get: function() {
563
+ var cssTexts = [];
564
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
565
+ cssTexts.push(this.cssRules[i].cssText);
566
+ }
567
+ return "@container " + this.containerText + " {" + cssTexts.join("") + "}";
568
+ },
569
+ configurable: true,
570
+ enumerable: true
571
+ }
572
+ });
573
+
574
+
575
+
576
+ /**
577
+ * @constructor
578
+ * @see https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface
579
+ */
580
+ CSSOM.CSSSupportsRule = function CSSSupportsRule() {
581
+ CSSOM.CSSConditionRule.call(this);
582
+ };
583
+
584
+ CSSOM.CSSSupportsRule.prototype = new CSSOM.CSSConditionRule();
585
+ CSSOM.CSSSupportsRule.prototype.constructor = CSSOM.CSSSupportsRule;
586
+ CSSOM.CSSSupportsRule.prototype.type = 12;
587
+
588
+ Object.defineProperty(CSSOM.CSSSupportsRule.prototype, "cssText", {
589
+ get: function() {
590
+ var cssTexts = [];
591
+
592
+ for (var i = 0, length = this.cssRules.length; i < length; i++) {
593
+ cssTexts.push(this.cssRules[i].cssText);
594
+ }
595
+
596
+ return "@supports " + this.conditionText + " {" + cssTexts.join("") + "}";
597
+ }
598
+ });
599
+
600
+
601
+ /**
602
+ * @constructor
603
+ * @see http://dev.w3.org/csswg/cssom/#cssimportrule
604
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSImportRule
605
+ */
606
+ CSSOM.CSSImportRule = function CSSImportRule() {
607
+ CSSOM.CSSRule.call(this);
608
+ this.href = "";
609
+ this.media = new CSSOM.MediaList();
610
+ this.styleSheet = new CSSOM.CSSStyleSheet();
611
+ };
612
+
613
+ CSSOM.CSSImportRule.prototype = new CSSOM.CSSRule();
614
+ CSSOM.CSSImportRule.prototype.constructor = CSSOM.CSSImportRule;
615
+ CSSOM.CSSImportRule.prototype.type = 3;
616
+
617
+ Object.defineProperty(CSSOM.CSSImportRule.prototype, "cssText", {
618
+ get: function() {
619
+ var mediaText = this.media.mediaText;
620
+ return "@import url(" + this.href + ")" + (mediaText ? " " + mediaText : "") + ";";
621
+ },
622
+ set: function(cssText) {
623
+ var i = 0;
624
+
625
+ /**
626
+ * @import url(partial.css) screen, handheld;
627
+ * || |
628
+ * after-import media
629
+ * |
630
+ * url
631
+ */
632
+ var state = '';
633
+
634
+ var buffer = '';
635
+ var index;
636
+ for (var character; (character = cssText.charAt(i)); i++) {
637
+
638
+ switch (character) {
639
+ case ' ':
640
+ case '\t':
641
+ case '\r':
642
+ case '\n':
643
+ case '\f':
644
+ if (state === 'after-import') {
645
+ state = 'url';
646
+ } else {
647
+ buffer += character;
648
+ }
649
+ break;
650
+
651
+ case '@':
652
+ if (!state && cssText.indexOf('@import', i) === i) {
653
+ state = 'after-import';
654
+ i += 'import'.length;
655
+ buffer = '';
656
+ }
657
+ break;
658
+
659
+ case 'u':
660
+ if (state === 'url' && cssText.indexOf('url(', i) === i) {
661
+ index = cssText.indexOf(')', i + 1);
662
+ if (index === -1) {
663
+ throw i + ': ")" not found';
664
+ }
665
+ i += 'url('.length;
666
+ var url = cssText.slice(i, index);
667
+ if (url[0] === url[url.length - 1]) {
668
+ if (url[0] === '"' || url[0] === "'") {
669
+ url = url.slice(1, -1);
670
+ }
671
+ }
672
+ this.href = url;
673
+ i = index;
674
+ state = 'media';
675
+ }
676
+ break;
677
+
678
+ case '"':
679
+ if (state === 'url') {
680
+ index = cssText.indexOf('"', i + 1);
681
+ if (!index) {
682
+ throw i + ": '\"' not found";
683
+ }
684
+ this.href = cssText.slice(i + 1, index);
685
+ i = index;
686
+ state = 'media';
687
+ }
688
+ break;
689
+
690
+ case "'":
691
+ if (state === 'url') {
692
+ index = cssText.indexOf("'", i + 1);
693
+ if (!index) {
694
+ throw i + ': "\'" not found';
695
+ }
696
+ this.href = cssText.slice(i + 1, index);
697
+ i = index;
698
+ state = 'media';
699
+ }
700
+ break;
701
+
702
+ case ';':
703
+ if (state === 'media') {
704
+ if (buffer) {
705
+ this.media.mediaText = buffer.trim();
706
+ }
707
+ }
708
+ break;
709
+
710
+ default:
711
+ if (state === 'media') {
712
+ buffer += character;
713
+ }
714
+ break;
715
+ }
716
+ }
717
+ }
718
+ });
719
+
720
+
721
+
722
+ /**
723
+ * @constructor
724
+ * @see http://dev.w3.org/csswg/cssom/#css-font-face-rule
725
+ */
726
+ CSSOM.CSSFontFaceRule = function CSSFontFaceRule() {
727
+ CSSOM.CSSRule.call(this);
728
+ this.style = new CSSOM.CSSStyleDeclaration();
729
+ this.style.parentRule = this;
730
+ };
731
+
732
+ CSSOM.CSSFontFaceRule.prototype = new CSSOM.CSSRule();
733
+ CSSOM.CSSFontFaceRule.prototype.constructor = CSSOM.CSSFontFaceRule;
734
+ CSSOM.CSSFontFaceRule.prototype.type = 5;
735
+ //FIXME
736
+ //CSSOM.CSSFontFaceRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
737
+ //CSSOM.CSSFontFaceRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
738
+
739
+ // http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSFontFaceRule.cpp
740
+ Object.defineProperty(CSSOM.CSSFontFaceRule.prototype, "cssText", {
741
+ get: function() {
742
+ return "@font-face {" + this.style.cssText + "}";
743
+ }
744
+ });
745
+
746
+
747
+
748
+ /**
749
+ * @constructor
750
+ * @see http://www.w3.org/TR/shadow-dom/#host-at-rule
751
+ */
752
+ CSSOM.CSSHostRule = function CSSHostRule() {
753
+ CSSOM.CSSRule.call(this);
754
+ this.cssRules = [];
755
+ };
756
+
757
+ CSSOM.CSSHostRule.prototype = new CSSOM.CSSRule();
758
+ CSSOM.CSSHostRule.prototype.constructor = CSSOM.CSSHostRule;
759
+ CSSOM.CSSHostRule.prototype.type = 1001;
760
+ //FIXME
761
+ //CSSOM.CSSHostRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
762
+ //CSSOM.CSSHostRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
763
+
764
+ Object.defineProperty(CSSOM.CSSHostRule.prototype, "cssText", {
765
+ get: function() {
766
+ var cssTexts = [];
767
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
768
+ cssTexts.push(this.cssRules[i].cssText);
769
+ }
770
+ return "@host {" + cssTexts.join("") + "}";
771
+ }
772
+ });
773
+
774
+
775
+
776
+ /**
777
+ * @constructor
778
+ * @see http://www.w3.org/TR/shadow-dom/#host-at-rule
779
+ */
780
+ CSSOM.CSSStartingStyleRule = function CSSStartingStyleRule() {
781
+ CSSOM.CSSRule.call(this);
782
+ this.cssRules = [];
783
+ };
784
+
785
+ CSSOM.CSSStartingStyleRule.prototype = new CSSOM.CSSRule();
786
+ CSSOM.CSSStartingStyleRule.prototype.constructor = CSSOM.CSSStartingStyleRule;
787
+ CSSOM.CSSStartingStyleRule.prototype.type = 1002;
788
+ //FIXME
789
+ //CSSOM.CSSStartingStyleRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
790
+ //CSSOM.CSSStartingStyleRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
791
+
792
+ Object.defineProperty(CSSOM.CSSStartingStyleRule.prototype, "cssText", {
793
+ get: function() {
794
+ var cssTexts = [];
795
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
796
+ cssTexts.push(this.cssRules[i].cssText);
797
+ }
798
+ return "@starting-style {" + cssTexts.join("") + "}";
799
+ }
800
+ });
801
+
802
+
803
+
804
+ /**
805
+ * @constructor
806
+ * @see http://dev.w3.org/csswg/cssom/#the-stylesheet-interface
807
+ */
808
+ CSSOM.StyleSheet = function StyleSheet() {
809
+ this.parentStyleSheet = null;
810
+ };
811
+
812
+
813
+
814
+ /**
815
+ * @constructor
816
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet
817
+ */
818
+ CSSOM.CSSStyleSheet = function CSSStyleSheet() {
819
+ CSSOM.StyleSheet.call(this);
820
+ this.cssRules = [];
821
+ };
822
+
823
+
824
+ CSSOM.CSSStyleSheet.prototype = new CSSOM.StyleSheet();
825
+ CSSOM.CSSStyleSheet.prototype.constructor = CSSOM.CSSStyleSheet;
826
+
827
+
828
+ /**
829
+ * Used to insert a new rule into the style sheet. The new rule now becomes part of the cascade.
830
+ *
831
+ * sheet = new Sheet("body {margin: 0}")
832
+ * sheet.toString()
833
+ * -> "body{margin:0;}"
834
+ * sheet.insertRule("img {border: none}", 0)
835
+ * -> 0
836
+ * sheet.toString()
837
+ * -> "img{border:none;}body{margin:0;}"
838
+ *
839
+ * @param {string} rule
840
+ * @param {number} index
841
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet-insertRule
842
+ * @return {number} The index within the style sheet's rule collection of the newly inserted rule.
843
+ */
844
+ CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) {
845
+ if (index < 0 || index > this.cssRules.length) {
846
+ throw new RangeError("INDEX_SIZE_ERR");
847
+ }
848
+ var cssRule = CSSOM.parse(rule).cssRules[0];
849
+ cssRule.parentStyleSheet = this;
850
+ this.cssRules.splice(index, 0, cssRule);
851
+ return index;
852
+ };
853
+
854
+
855
+ /**
856
+ * Used to delete a rule from the style sheet.
857
+ *
858
+ * sheet = new Sheet("img{border:none} body{margin:0}")
859
+ * sheet.toString()
860
+ * -> "img{border:none;}body{margin:0;}"
861
+ * sheet.deleteRule(0)
862
+ * sheet.toString()
863
+ * -> "body{margin:0;}"
864
+ *
865
+ * @param {number} index within the style sheet's rule list of the rule to remove.
866
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet-deleteRule
867
+ */
868
+ CSSOM.CSSStyleSheet.prototype.deleteRule = function(index) {
869
+ if (index < 0 || index >= this.cssRules.length) {
870
+ throw new RangeError("INDEX_SIZE_ERR");
871
+ }
872
+ this.cssRules.splice(index, 1);
873
+ };
874
+
875
+
876
+ /**
877
+ * NON-STANDARD
878
+ * @return {string} serialize stylesheet
879
+ */
880
+ CSSOM.CSSStyleSheet.prototype.toString = function() {
881
+ var result = "";
882
+ var rules = this.cssRules;
883
+ for (var i=0; i<rules.length; i++) {
884
+ result += rules[i].cssText + "\n";
885
+ }
886
+ return result;
887
+ };
888
+
889
+
890
+
891
+ /**
892
+ * @constructor
893
+ * @see http://www.w3.org/TR/css3-animations/#DOM-CSSKeyframesRule
894
+ */
895
+ CSSOM.CSSKeyframesRule = function CSSKeyframesRule() {
896
+ CSSOM.CSSRule.call(this);
897
+ this.name = '';
898
+ this.cssRules = [];
899
+ };
900
+
901
+ CSSOM.CSSKeyframesRule.prototype = new CSSOM.CSSRule();
902
+ CSSOM.CSSKeyframesRule.prototype.constructor = CSSOM.CSSKeyframesRule;
903
+ CSSOM.CSSKeyframesRule.prototype.type = 7;
904
+ //FIXME
905
+ //CSSOM.CSSKeyframesRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
906
+ //CSSOM.CSSKeyframesRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
907
+
908
+ // http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSKeyframesRule.cpp
909
+ Object.defineProperty(CSSOM.CSSKeyframesRule.prototype, "cssText", {
910
+ get: function() {
911
+ var cssTexts = [];
912
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
913
+ cssTexts.push(" " + this.cssRules[i].cssText);
914
+ }
915
+ return "@" + (this._vendorPrefix || '') + "keyframes " + this.name + " { \n" + cssTexts.join("\n") + "\n}";
916
+ }
917
+ });
918
+
919
+
920
+
921
+ /**
922
+ * @constructor
923
+ * @see http://www.w3.org/TR/css3-animations/#DOM-CSSKeyframeRule
924
+ */
925
+ CSSOM.CSSKeyframeRule = function CSSKeyframeRule() {
926
+ CSSOM.CSSRule.call(this);
927
+ this.keyText = '';
928
+ this.style = new CSSOM.CSSStyleDeclaration();
929
+ this.style.parentRule = this;
930
+ };
931
+
932
+ CSSOM.CSSKeyframeRule.prototype = new CSSOM.CSSRule();
933
+ CSSOM.CSSKeyframeRule.prototype.constructor = CSSOM.CSSKeyframeRule;
934
+ CSSOM.CSSKeyframeRule.prototype.type = 8;
935
+ //FIXME
936
+ //CSSOM.CSSKeyframeRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
937
+ //CSSOM.CSSKeyframeRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
938
+
939
+ // http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSKeyframeRule.cpp
940
+ Object.defineProperty(CSSOM.CSSKeyframeRule.prototype, "cssText", {
941
+ get: function() {
942
+ return this.keyText + " {" + this.style.cssText + "} ";
943
+ }
944
+ });
945
+
946
+
947
+
948
+ /**
949
+ * @constructor
950
+ * @see https://developer.mozilla.org/en/CSS/@-moz-document
951
+ */
952
+ CSSOM.MatcherList = function MatcherList(){
953
+ this.length = 0;
954
+ };
955
+
956
+ CSSOM.MatcherList.prototype = {
957
+
958
+ constructor: CSSOM.MatcherList,
959
+
960
+ /**
961
+ * @return {string}
962
+ */
963
+ get matcherText() {
964
+ return Array.prototype.join.call(this, ", ");
965
+ },
966
+
967
+ /**
968
+ * @param {string} value
969
+ */
970
+ set matcherText(value) {
971
+ // just a temporary solution, actually it may be wrong by just split the value with ',', because a url can include ','.
972
+ var values = value.split(",");
973
+ var length = this.length = values.length;
974
+ for (var i=0; i<length; i++) {
975
+ this[i] = values[i].trim();
976
+ }
977
+ },
978
+
979
+ /**
980
+ * @param {string} matcher
981
+ */
982
+ appendMatcher: function(matcher) {
983
+ if (Array.prototype.indexOf.call(this, matcher) === -1) {
984
+ this[this.length] = matcher;
985
+ this.length++;
986
+ }
987
+ },
988
+
989
+ /**
990
+ * @param {string} matcher
991
+ */
992
+ deleteMatcher: function(matcher) {
993
+ var index = Array.prototype.indexOf.call(this, matcher);
994
+ if (index !== -1) {
995
+ Array.prototype.splice.call(this, index, 1);
996
+ }
997
+ }
998
+
999
+ };
1000
+
1001
+
1002
+
1003
+ /**
1004
+ * @constructor
1005
+ * @see https://developer.mozilla.org/en/CSS/@-moz-document
1006
+ */
1007
+ CSSOM.CSSDocumentRule = function CSSDocumentRule() {
1008
+ CSSOM.CSSRule.call(this);
1009
+ this.matcher = new CSSOM.MatcherList();
1010
+ this.cssRules = [];
1011
+ };
1012
+
1013
+ CSSOM.CSSDocumentRule.prototype = new CSSOM.CSSRule();
1014
+ CSSOM.CSSDocumentRule.prototype.constructor = CSSOM.CSSDocumentRule;
1015
+ CSSOM.CSSDocumentRule.prototype.type = 10;
1016
+ //FIXME
1017
+ //CSSOM.CSSDocumentRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
1018
+ //CSSOM.CSSDocumentRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
1019
+
1020
+ Object.defineProperty(CSSOM.CSSDocumentRule.prototype, "cssText", {
1021
+ get: function() {
1022
+ var cssTexts = [];
1023
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
1024
+ cssTexts.push(this.cssRules[i].cssText);
1025
+ }
1026
+ return "@-moz-document " + this.matcher.matcherText + " {" + cssTexts.join("") + "}";
1027
+ }
1028
+ });
1029
+
1030
+
1031
+
1032
+ /**
1033
+ * @constructor
1034
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSValue
1035
+ *
1036
+ * TODO: add if needed
1037
+ */
1038
+ CSSOM.CSSValue = function CSSValue() {
1039
+ };
1040
+
1041
+ CSSOM.CSSValue.prototype = {
1042
+ constructor: CSSOM.CSSValue,
1043
+
1044
+ // @see: http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSValue
1045
+ set cssText(text) {
1046
+ var name = this._getConstructorName();
1047
+
1048
+ throw new Error('DOMException: property "cssText" of "' + name + '" is readonly and can not be replaced with "' + text + '"!');
1049
+ },
1050
+
1051
+ get cssText() {
1052
+ var name = this._getConstructorName();
1053
+
1054
+ throw new Error('getter "cssText" of "' + name + '" is not implemented!');
1055
+ },
1056
+
1057
+ _getConstructorName: function() {
1058
+ var s = this.constructor.toString(),
1059
+ c = s.match(/function\s([^\(]+)/),
1060
+ name = c[1];
1061
+
1062
+ return name;
1063
+ }
1064
+ };
1065
+
1066
+
1067
+
1068
+ /**
1069
+ * @constructor
1070
+ * @see http://msdn.microsoft.com/en-us/library/ms537634(v=vs.85).aspx
1071
+ *
1072
+ */
1073
+ CSSOM.CSSValueExpression = function CSSValueExpression(token, idx) {
1074
+ this._token = token;
1075
+ this._idx = idx;
1076
+ };
1077
+
1078
+ CSSOM.CSSValueExpression.prototype = new CSSOM.CSSValue();
1079
+ CSSOM.CSSValueExpression.prototype.constructor = CSSOM.CSSValueExpression;
1080
+
1081
+ /**
1082
+ * parse css expression() value
1083
+ *
1084
+ * @return {Object}
1085
+ * - error:
1086
+ * or
1087
+ * - idx:
1088
+ * - expression:
1089
+ *
1090
+ * Example:
1091
+ *
1092
+ * .selector {
1093
+ * zoom: expression(documentElement.clientWidth > 1000 ? '1000px' : 'auto');
1094
+ * }
1095
+ */
1096
+ CSSOM.CSSValueExpression.prototype.parse = function() {
1097
+ var token = this._token,
1098
+ idx = this._idx;
1099
+
1100
+ var character = '',
1101
+ expression = '',
1102
+ error = '',
1103
+ info,
1104
+ paren = [];
1105
+
1106
+
1107
+ for (; ; ++idx) {
1108
+ character = token.charAt(idx);
1109
+
1110
+ // end of token
1111
+ if (character === '') {
1112
+ error = 'css expression error: unfinished expression!';
1113
+ break;
1114
+ }
1115
+
1116
+ switch(character) {
1117
+ case '(':
1118
+ paren.push(character);
1119
+ expression += character;
1120
+ break;
1121
+
1122
+ case ')':
1123
+ paren.pop(character);
1124
+ expression += character;
1125
+ break;
1126
+
1127
+ case '/':
1128
+ if ((info = this._parseJSComment(token, idx))) { // comment?
1129
+ if (info.error) {
1130
+ error = 'css expression error: unfinished comment in expression!';
1131
+ } else {
1132
+ idx = info.idx;
1133
+ // ignore the comment
1134
+ }
1135
+ } else if ((info = this._parseJSRexExp(token, idx))) { // regexp
1136
+ idx = info.idx;
1137
+ expression += info.text;
1138
+ } else { // other
1139
+ expression += character;
1140
+ }
1141
+ break;
1142
+
1143
+ case "'":
1144
+ case '"':
1145
+ info = this._parseJSString(token, idx, character);
1146
+ if (info) { // string
1147
+ idx = info.idx;
1148
+ expression += info.text;
1149
+ } else {
1150
+ expression += character;
1151
+ }
1152
+ break;
1153
+
1154
+ default:
1155
+ expression += character;
1156
+ break;
1157
+ }
1158
+
1159
+ if (error) {
1160
+ break;
1161
+ }
1162
+
1163
+ // end of expression
1164
+ if (paren.length === 0) {
1165
+ break;
1166
+ }
1167
+ }
1168
+
1169
+ var ret;
1170
+ if (error) {
1171
+ ret = {
1172
+ error: error
1173
+ };
1174
+ } else {
1175
+ ret = {
1176
+ idx: idx,
1177
+ expression: expression
1178
+ };
1179
+ }
1180
+
1181
+ return ret;
1182
+ };
1183
+
1184
+
1185
+ /**
1186
+ *
1187
+ * @return {Object|false}
1188
+ * - idx:
1189
+ * - text:
1190
+ * or
1191
+ * - error:
1192
+ * or
1193
+ * false
1194
+ *
1195
+ */
1196
+ CSSOM.CSSValueExpression.prototype._parseJSComment = function(token, idx) {
1197
+ var nextChar = token.charAt(idx + 1),
1198
+ text;
1199
+
1200
+ if (nextChar === '/' || nextChar === '*') {
1201
+ var startIdx = idx,
1202
+ endIdx,
1203
+ commentEndChar;
1204
+
1205
+ if (nextChar === '/') { // line comment
1206
+ commentEndChar = '\n';
1207
+ } else if (nextChar === '*') { // block comment
1208
+ commentEndChar = '*/';
1209
+ }
1210
+
1211
+ endIdx = token.indexOf(commentEndChar, startIdx + 1 + 1);
1212
+ if (endIdx !== -1) {
1213
+ endIdx = endIdx + commentEndChar.length - 1;
1214
+ text = token.substring(idx, endIdx + 1);
1215
+ return {
1216
+ idx: endIdx,
1217
+ text: text
1218
+ };
1219
+ } else {
1220
+ var error = 'css expression error: unfinished comment in expression!';
1221
+ return {
1222
+ error: error
1223
+ };
1224
+ }
1225
+ } else {
1226
+ return false;
1227
+ }
1228
+ };
1229
+
1230
+
1231
+ /**
1232
+ *
1233
+ * @return {Object|false}
1234
+ * - idx:
1235
+ * - text:
1236
+ * or
1237
+ * false
1238
+ *
1239
+ */
1240
+ CSSOM.CSSValueExpression.prototype._parseJSString = function(token, idx, sep) {
1241
+ var endIdx = this._findMatchedIdx(token, idx, sep),
1242
+ text;
1243
+
1244
+ if (endIdx === -1) {
1245
+ return false;
1246
+ } else {
1247
+ text = token.substring(idx, endIdx + sep.length);
1248
+
1249
+ return {
1250
+ idx: endIdx,
1251
+ text: text
1252
+ };
1253
+ }
1254
+ };
1255
+
1256
+
1257
+ /**
1258
+ * parse regexp in css expression
1259
+ *
1260
+ * @return {Object|false}
1261
+ * - idx:
1262
+ * - regExp:
1263
+ * or
1264
+ * false
1265
+ */
1266
+
1267
+ /*
1268
+
1269
+ all legal RegExp
1270
+
1271
+ /a/
1272
+ (/a/)
1273
+ [/a/]
1274
+ [12, /a/]
1275
+
1276
+ !/a/
1277
+
1278
+ +/a/
1279
+ -/a/
1280
+ * /a/
1281
+ / /a/
1282
+ %/a/
1283
+
1284
+ ===/a/
1285
+ !==/a/
1286
+ ==/a/
1287
+ !=/a/
1288
+ >/a/
1289
+ >=/a/
1290
+ </a/
1291
+ <=/a/
1292
+
1293
+ &/a/
1294
+ |/a/
1295
+ ^/a/
1296
+ ~/a/
1297
+ <</a/
1298
+ >>/a/
1299
+ >>>/a/
1300
+
1301
+ &&/a/
1302
+ ||/a/
1303
+ ?/a/
1304
+ =/a/
1305
+ ,/a/
1306
+
1307
+ delete /a/
1308
+ in /a/
1309
+ instanceof /a/
1310
+ new /a/
1311
+ typeof /a/
1312
+ void /a/
1313
+
1314
+ */
1315
+ CSSOM.CSSValueExpression.prototype._parseJSRexExp = function(token, idx) {
1316
+ var before = token.substring(0, idx).replace(/\s+$/, ""),
1317
+ legalRegx = [
1318
+ /^$/,
1319
+ /\($/,
1320
+ /\[$/,
1321
+ /\!$/,
1322
+ /\+$/,
1323
+ /\-$/,
1324
+ /\*$/,
1325
+ /\/\s+/,
1326
+ /\%$/,
1327
+ /\=$/,
1328
+ /\>$/,
1329
+ /<$/,
1330
+ /\&$/,
1331
+ /\|$/,
1332
+ /\^$/,
1333
+ /\~$/,
1334
+ /\?$/,
1335
+ /\,$/,
1336
+ /delete$/,
1337
+ /in$/,
1338
+ /instanceof$/,
1339
+ /new$/,
1340
+ /typeof$/,
1341
+ /void$/
1342
+ ];
1343
+
1344
+ var isLegal = legalRegx.some(function(reg) {
1345
+ return reg.test(before);
1346
+ });
1347
+
1348
+ if (!isLegal) {
1349
+ return false;
1350
+ } else {
1351
+ var sep = '/';
1352
+
1353
+ // same logic as string
1354
+ return this._parseJSString(token, idx, sep);
1355
+ }
1356
+ };
1357
+
1358
+
1359
+ /**
1360
+ *
1361
+ * find next sep(same line) index in `token`
1362
+ *
1363
+ * @return {Number}
1364
+ *
1365
+ */
1366
+ CSSOM.CSSValueExpression.prototype._findMatchedIdx = function(token, idx, sep) {
1367
+ var startIdx = idx,
1368
+ endIdx;
1369
+
1370
+ var NOT_FOUND = -1;
1371
+
1372
+ while(true) {
1373
+ endIdx = token.indexOf(sep, startIdx + 1);
1374
+
1375
+ if (endIdx === -1) { // not found
1376
+ endIdx = NOT_FOUND;
1377
+ break;
1378
+ } else {
1379
+ var text = token.substring(idx + 1, endIdx),
1380
+ matched = text.match(/\\+$/);
1381
+ if (!matched || matched[0] % 2 === 0) { // not escaped
1382
+ break;
1383
+ } else {
1384
+ startIdx = endIdx;
1385
+ }
1386
+ }
1387
+ }
1388
+
1389
+ // boundary must be in the same line(js sting or regexp)
1390
+ var nextNewLineIdx = token.indexOf('\n', idx + 1);
1391
+ if (nextNewLineIdx < endIdx) {
1392
+ endIdx = NOT_FOUND;
1393
+ }
1394
+
1395
+
1396
+ return endIdx;
1397
+ };
1398
+
1399
+
1400
+
1401
+
1402
+
1403
+ /**
1404
+ * @constructor
1405
+ * @see https://drafts.csswg.org/css-cascade-5/#csslayerblockrule
1406
+ */
1407
+ CSSOM.CSSLayerBlockRule = function CSSLayerBlockRule() {
1408
+ CSSOM.CSSGroupingRule.call(this);
1409
+ this.layerName = "";
1410
+ this.cssRules = [];
1411
+ };
1412
+
1413
+ CSSOM.CSSLayerBlockRule.prototype = new CSSOM.CSSGroupingRule();
1414
+ CSSOM.CSSLayerBlockRule.prototype.constructor = CSSOM.CSSLayerBlockRule;
1415
+ CSSOM.CSSLayerBlockRule.prototype.type = 18;
1416
+
1417
+ Object.defineProperties(CSSOM.CSSLayerBlockRule.prototype, {
1418
+ layerNameText: {
1419
+ get: function () {
1420
+ return this.layerName;
1421
+ },
1422
+ set: function (value) {
1423
+ this.layerName = value;
1424
+ },
1425
+ configurable: true,
1426
+ enumerable: true,
1427
+ },
1428
+ cssText: {
1429
+ get: function () {
1430
+ var cssTexts = [];
1431
+ for (var i = 0, length = this.cssRules.length; i < length; i++) {
1432
+ cssTexts.push(this.cssRules[i].cssText);
1433
+ }
1434
+ return "@layer " + this.layerNameText + " {" + cssTexts.join("") + "}";
1435
+ },
1436
+ configurable: true,
1437
+ enumerable: true,
1438
+ },
1439
+ });
1440
+
1441
+
1442
+ /**
1443
+ * @param {string} token
1444
+ */
1445
+ CSSOM.parse = function parse(token) {
1446
+
1447
+ var i = 0;
1448
+
1449
+ /**
1450
+ "before-selector" or
1451
+ "selector" or
1452
+ "atRule" or
1453
+ "atBlock" or
1454
+ "conditionBlock" or
1455
+ "before-name" or
1456
+ "name" or
1457
+ "before-value" or
1458
+ "value"
1459
+ */
1460
+ var state = "before-selector";
1461
+
1462
+ var index;
1463
+ var buffer = "";
1464
+ var valueParenthesisDepth = 0;
1465
+
1466
+ var SIGNIFICANT_WHITESPACE = {
1467
+ "selector": true,
1468
+ "value": true,
1469
+ "value-parenthesis": true,
1470
+ "atRule": true,
1471
+ "importRule-begin": true,
1472
+ "importRule": true,
1473
+ "atBlock": true,
1474
+ "containerBlock": true,
1475
+ "conditionBlock": true,
1476
+ 'documentRule-begin': true,
1477
+ "layerBlock": true
1478
+ };
1479
+
1480
+ var styleSheet = new CSSOM.CSSStyleSheet();
1481
+
1482
+ // @type CSSStyleSheet|CSSMediaRule|CSSContainerRule|CSSSupportsRule|CSSFontFaceRule|CSSKeyframesRule|CSSDocumentRule
1483
+ var currentScope = styleSheet;
1484
+
1485
+ // @type CSSMediaRule|CSSContainerRule|CSSSupportsRule|CSSKeyframesRule|CSSDocumentRule
1486
+ var parentRule;
1487
+
1488
+ var ancestorRules = [];
1489
+ var hasAncestors = false;
1490
+ var prevScope;
1491
+
1492
+ var name, priority="", styleRule, mediaRule, containerRule, supportsRule, importRule, fontFaceRule, keyframesRule, documentRule, hostRule, startingStyleRule, layerBlockRule;
1493
+
1494
+ var atKeyframesRegExp = /@(-(?:\w+-)+)?keyframes/g;
1495
+
1496
+ var parseError = function(message) {
1497
+ var lines = token.substring(0, i).split('\n');
1498
+ var lineCount = lines.length;
1499
+ var charCount = lines.pop().length + 1;
1500
+ var error = new Error(message + ' (line ' + lineCount + ', char ' + charCount + ')');
1501
+ error.line = lineCount;
1502
+ /* jshint sub : true */
1503
+ error['char'] = charCount;
1504
+ error.styleSheet = styleSheet;
1505
+ throw error;
1506
+ };
1507
+
1508
+ for (var character; (character = token.charAt(i)); i++) {
1509
+
1510
+ switch (character) {
1511
+
1512
+ case " ":
1513
+ case "\t":
1514
+ case "\r":
1515
+ case "\n":
1516
+ case "\f":
1517
+ if (SIGNIFICANT_WHITESPACE[state]) {
1518
+ buffer += character;
1519
+ }
1520
+ break;
1521
+
1522
+ // String
1523
+ case '"':
1524
+ index = i + 1;
1525
+ do {
1526
+ index = token.indexOf('"', index) + 1;
1527
+ if (!index) {
1528
+ parseError('Unmatched "');
1529
+ }
1530
+ } while (token[index - 2] === '\\');
1531
+ buffer += token.slice(i, index);
1532
+ i = index - 1;
1533
+ switch (state) {
1534
+ case 'before-value':
1535
+ state = 'value';
1536
+ break;
1537
+ case 'importRule-begin':
1538
+ state = 'importRule';
1539
+ break;
1540
+ }
1541
+ break;
1542
+
1543
+ case "'":
1544
+ index = i + 1;
1545
+ do {
1546
+ index = token.indexOf("'", index) + 1;
1547
+ if (!index) {
1548
+ parseError("Unmatched '");
1549
+ }
1550
+ } while (token[index - 2] === '\\');
1551
+ buffer += token.slice(i, index);
1552
+ i = index - 1;
1553
+ switch (state) {
1554
+ case 'before-value':
1555
+ state = 'value';
1556
+ break;
1557
+ case 'importRule-begin':
1558
+ state = 'importRule';
1559
+ break;
1560
+ }
1561
+ break;
1562
+
1563
+ // Comment
1564
+ case "/":
1565
+ if (token.charAt(i + 1) === "*") {
1566
+ i += 2;
1567
+ index = token.indexOf("*/", i);
1568
+ if (index === -1) {
1569
+ parseError("Missing */");
1570
+ } else {
1571
+ i = index + 1;
1572
+ }
1573
+ } else {
1574
+ buffer += character;
1575
+ }
1576
+ if (state === "importRule-begin") {
1577
+ buffer += " ";
1578
+ state = "importRule";
1579
+ }
1580
+ break;
1581
+
1582
+ // At-rule
1583
+ case "@":
1584
+ if (token.indexOf("@-moz-document", i) === i) {
1585
+ state = "documentRule-begin";
1586
+ documentRule = new CSSOM.CSSDocumentRule();
1587
+ documentRule.__starts = i;
1588
+ i += "-moz-document".length;
1589
+ buffer = "";
1590
+ break;
1591
+ } else if (token.indexOf("@media", i) === i) {
1592
+ state = "atBlock";
1593
+ mediaRule = new CSSOM.CSSMediaRule();
1594
+ mediaRule.__starts = i;
1595
+ i += "media".length;
1596
+ buffer = "";
1597
+ break;
1598
+ } else if (token.indexOf("@container", i) === i) {
1599
+ state = "containerBlock";
1600
+ containerRule = new CSSOM.CSSContainerRule();
1601
+ containerRule.__starts = i;
1602
+ i += "container".length;
1603
+ buffer = "";
1604
+ break;
1605
+ } else if (token.indexOf("@layer", i) === i) {
1606
+ state = "layerBlock";
1607
+ layerBlockRule = new CSSOM.CSSLayerBlockRule();
1608
+ layerBlockRule.__starts = i;
1609
+ i += "layer".length;
1610
+ buffer = "";
1611
+ break;
1612
+ } else if (token.indexOf("@supports", i) === i) {
1613
+ state = "conditionBlock";
1614
+ supportsRule = new CSSOM.CSSSupportsRule();
1615
+ supportsRule.__starts = i;
1616
+ i += "supports".length;
1617
+ buffer = "";
1618
+ break;
1619
+ } else if (token.indexOf("@host", i) === i) {
1620
+ state = "hostRule-begin";
1621
+ i += "host".length;
1622
+ hostRule = new CSSOM.CSSHostRule();
1623
+ hostRule.__starts = i;
1624
+ buffer = "";
1625
+ break;
1626
+ } else if (token.indexOf("@starting-style", i) === i) {
1627
+ state = "startingStyleRule-begin";
1628
+ i += "starting-style".length;
1629
+ startingStyleRule = new CSSOM.CSSStartingStyleRule();
1630
+ startingStyleRule.__starts = i;
1631
+ buffer = "";
1632
+ break;
1633
+ } else if (token.indexOf("@import", i) === i) {
1634
+ state = "importRule-begin";
1635
+ i += "import".length;
1636
+ buffer += "@import";
1637
+ break;
1638
+ } else if (token.indexOf("@font-face", i) === i) {
1639
+ state = "fontFaceRule-begin";
1640
+ i += "font-face".length;
1641
+ fontFaceRule = new CSSOM.CSSFontFaceRule();
1642
+ fontFaceRule.__starts = i;
1643
+ buffer = "";
1644
+ break;
1645
+ } else {
1646
+ atKeyframesRegExp.lastIndex = i;
1647
+ var matchKeyframes = atKeyframesRegExp.exec(token);
1648
+ if (matchKeyframes && matchKeyframes.index === i) {
1649
+ state = "keyframesRule-begin";
1650
+ keyframesRule = new CSSOM.CSSKeyframesRule();
1651
+ keyframesRule.__starts = i;
1652
+ keyframesRule._vendorPrefix = matchKeyframes[1]; // Will come out as undefined if no prefix was found
1653
+ i += matchKeyframes[0].length - 1;
1654
+ buffer = "";
1655
+ break;
1656
+ } else if (state === "selector") {
1657
+ state = "atRule";
1658
+ }
1659
+ }
1660
+ buffer += character;
1661
+ break;
1662
+
1663
+ case "{":
1664
+ if (state === "selector" || state === "atRule") {
1665
+ styleRule.selectorText = buffer.trim();
1666
+ styleRule.style.__starts = i;
1667
+ buffer = "";
1668
+ state = "before-name";
1669
+ } else if (state === "atBlock") {
1670
+ mediaRule.media.mediaText = buffer.trim();
1671
+
1672
+ if (parentRule) {
1673
+ ancestorRules.push(parentRule);
1674
+ }
1675
+
1676
+ currentScope = parentRule = mediaRule;
1677
+ mediaRule.parentStyleSheet = styleSheet;
1678
+ buffer = "";
1679
+ state = "before-selector";
1680
+ } else if (state === "containerBlock") {
1681
+ containerRule.containerText = buffer.trim();
1682
+
1683
+ if (parentRule) {
1684
+ ancestorRules.push(parentRule);
1685
+ }
1686
+ currentScope = parentRule = containerRule;
1687
+ containerRule.parentStyleSheet = styleSheet;
1688
+ buffer = "";
1689
+ state = "before-selector";
1690
+ } else if (state === "conditionBlock") {
1691
+ supportsRule.conditionText = buffer.trim();
1692
+
1693
+ if (parentRule) {
1694
+ ancestorRules.push(parentRule);
1695
+ }
1696
+
1697
+ currentScope = parentRule = supportsRule;
1698
+ supportsRule.parentStyleSheet = styleSheet;
1699
+ buffer = "";
1700
+ state = "before-selector";
1701
+ } else if (state === "layerBlock") {
1702
+ layerBlockRule.layerNameText = buffer.trim();
1703
+
1704
+ if (parentRule) {
1705
+ ancestorRules.push(parentRule);
1706
+ }
1707
+
1708
+ currentScope = parentRule = layerBlockRule;
1709
+ layerBlockRule.parentStyleSheet = styleSheet;
1710
+ buffer = "";
1711
+ state = "before-selector";
1712
+ } else if (state === "hostRule-begin") {
1713
+ if (parentRule) {
1714
+ ancestorRules.push(parentRule);
1715
+ }
1716
+
1717
+ currentScope = parentRule = hostRule;
1718
+ hostRule.parentStyleSheet = styleSheet;
1719
+ buffer = "";
1720
+ state = "before-selector";
1721
+ } else if (state === "startingStyleRule-begin") {
1722
+ if (parentRule) {
1723
+ ancestorRules.push(parentRule);
1724
+ }
1725
+
1726
+ currentScope = parentRule = startingStyleRule;
1727
+ startingStyleRule.parentStyleSheet = styleSheet;
1728
+ buffer = "";
1729
+ state = "before-selector";
1730
+
1731
+ } else if (state === "fontFaceRule-begin") {
1732
+ if (parentRule) {
1733
+ fontFaceRule.parentRule = parentRule;
1734
+ }
1735
+ fontFaceRule.parentStyleSheet = styleSheet;
1736
+ styleRule = fontFaceRule;
1737
+ buffer = "";
1738
+ state = "before-name";
1739
+ } else if (state === "keyframesRule-begin") {
1740
+ keyframesRule.name = buffer.trim();
1741
+ if (parentRule) {
1742
+ ancestorRules.push(parentRule);
1743
+ keyframesRule.parentRule = parentRule;
1744
+ }
1745
+ keyframesRule.parentStyleSheet = styleSheet;
1746
+ currentScope = parentRule = keyframesRule;
1747
+ buffer = "";
1748
+ state = "keyframeRule-begin";
1749
+ } else if (state === "keyframeRule-begin") {
1750
+ styleRule = new CSSOM.CSSKeyframeRule();
1751
+ styleRule.keyText = buffer.trim();
1752
+ styleRule.__starts = i;
1753
+ buffer = "";
1754
+ state = "before-name";
1755
+ } else if (state === "documentRule-begin") {
1756
+ // FIXME: what if this '{' is in the url text of the match function?
1757
+ documentRule.matcher.matcherText = buffer.trim();
1758
+ if (parentRule) {
1759
+ ancestorRules.push(parentRule);
1760
+ documentRule.parentRule = parentRule;
1761
+ }
1762
+ currentScope = parentRule = documentRule;
1763
+ documentRule.parentStyleSheet = styleSheet;
1764
+ buffer = "";
1765
+ state = "before-selector";
1766
+ }
1767
+ break;
1768
+
1769
+ case ":":
1770
+ if (state === "name") {
1771
+ name = buffer.trim();
1772
+ buffer = "";
1773
+ state = "before-value";
1774
+ } else {
1775
+ buffer += character;
1776
+ }
1777
+ break;
1778
+
1779
+ case "(":
1780
+ if (state === 'value') {
1781
+ // ie css expression mode
1782
+ if (buffer.trim() === 'expression') {
1783
+ var info = (new CSSOM.CSSValueExpression(token, i)).parse();
1784
+
1785
+ if (info.error) {
1786
+ parseError(info.error);
1787
+ } else {
1788
+ buffer += info.expression;
1789
+ i = info.idx;
1790
+ }
1791
+ } else {
1792
+ state = 'value-parenthesis';
1793
+ //always ensure this is reset to 1 on transition
1794
+ //from value to value-parenthesis
1795
+ valueParenthesisDepth = 1;
1796
+ buffer += character;
1797
+ }
1798
+ } else if (state === 'value-parenthesis') {
1799
+ valueParenthesisDepth++;
1800
+ buffer += character;
1801
+ } else {
1802
+ buffer += character;
1803
+ }
1804
+ break;
1805
+
1806
+ case ")":
1807
+ if (state === 'value-parenthesis') {
1808
+ valueParenthesisDepth--;
1809
+ if (valueParenthesisDepth === 0) state = 'value';
1810
+ }
1811
+ buffer += character;
1812
+ break;
1813
+
1814
+ case "!":
1815
+ if (state === "value" && token.indexOf("!important", i) === i) {
1816
+ priority = "important";
1817
+ i += "important".length;
1818
+ } else {
1819
+ buffer += character;
1820
+ }
1821
+ break;
1822
+
1823
+ case ";":
1824
+ switch (state) {
1825
+ case "value":
1826
+ styleRule.style.setProperty(name, buffer.trim(), priority);
1827
+ priority = "";
1828
+ buffer = "";
1829
+ state = "before-name";
1830
+ break;
1831
+ case "atRule":
1832
+ buffer = "";
1833
+ state = "before-selector";
1834
+ break;
1835
+ case "importRule":
1836
+ importRule = new CSSOM.CSSImportRule();
1837
+ importRule.parentStyleSheet = importRule.styleSheet.parentStyleSheet = styleSheet;
1838
+ importRule.cssText = buffer + character;
1839
+ styleSheet.cssRules.push(importRule);
1840
+ buffer = "";
1841
+ state = "before-selector";
1842
+ break;
1843
+ default:
1844
+ buffer += character;
1845
+ break;
1846
+ }
1847
+ break;
1848
+
1849
+ case "}":
1850
+ switch (state) {
1851
+ case "value":
1852
+ styleRule.style.setProperty(name, buffer.trim(), priority);
1853
+ priority = "";
1854
+ /* falls through */
1855
+ case "before-name":
1856
+ case "name":
1857
+ styleRule.__ends = i + 1;
1858
+ if (parentRule) {
1859
+ styleRule.parentRule = parentRule;
1860
+ }
1861
+ styleRule.parentStyleSheet = styleSheet;
1862
+ currentScope.cssRules.push(styleRule);
1863
+ buffer = "";
1864
+ if (currentScope.constructor === CSSOM.CSSKeyframesRule) {
1865
+ state = "keyframeRule-begin";
1866
+ } else {
1867
+ state = "before-selector";
1868
+ }
1869
+ break;
1870
+ case "keyframeRule-begin":
1871
+ case "before-selector":
1872
+ case "selector":
1873
+ // End of media/supports/document rule.
1874
+ if (!parentRule) {
1875
+ parseError("Unexpected }");
1876
+ }
1877
+
1878
+ // Handle rules nested in @media or @supports
1879
+ hasAncestors = ancestorRules.length > 0;
1880
+
1881
+ while (ancestorRules.length > 0) {
1882
+ parentRule = ancestorRules.pop();
1883
+
1884
+ if (
1885
+ parentRule.constructor.name === "CSSMediaRule"
1886
+ || parentRule.constructor.name === "CSSSupportsRule"
1887
+ || parentRule.constructor.name === "CSSContainerRule"
1888
+ || parentRule.constructor.name === "CSSLayerBlockRule"
1889
+ || parentRule.constructor.name === "CSSStartingStyleRule"
1890
+ ) {
1891
+ prevScope = currentScope;
1892
+ currentScope = parentRule;
1893
+ currentScope.cssRules.push(prevScope);
1894
+ break;
1895
+ }
1896
+
1897
+ if (ancestorRules.length === 0) {
1898
+ hasAncestors = false;
1899
+ }
1900
+ }
1901
+
1902
+ if (!hasAncestors) {
1903
+ currentScope.__ends = i + 1;
1904
+ styleSheet.cssRules.push(currentScope);
1905
+ currentScope = styleSheet;
1906
+ parentRule = null;
1907
+ }
1908
+
1909
+ buffer = "";
1910
+ state = "before-selector";
1911
+ break;
1912
+ }
1913
+ break;
1914
+
1915
+ default:
1916
+ switch (state) {
1917
+ case "before-selector":
1918
+ state = "selector";
1919
+ styleRule = new CSSOM.CSSStyleRule();
1920
+ styleRule.__starts = i;
1921
+ break;
1922
+ case "before-name":
1923
+ state = "name";
1924
+ break;
1925
+ case "before-value":
1926
+ state = "value";
1927
+ break;
1928
+ case "importRule-begin":
1929
+ state = "importRule";
1930
+ break;
1931
+ }
1932
+ buffer += character;
1933
+ break;
1934
+ }
1935
+ }
1936
+
1937
+ return styleSheet;
1938
+ };
1939
+
1940
+
1941
+
1942
+ /**
1943
+ * Produces a deep copy of stylesheet — the instance variables of stylesheet are copied recursively.
1944
+ * @param {CSSStyleSheet|CSSOM.CSSStyleSheet} stylesheet
1945
+ * @nosideeffects
1946
+ * @return {CSSOM.CSSStyleSheet}
1947
+ */
1948
+ CSSOM.clone = function clone(stylesheet) {
1949
+
1950
+ var cloned = new CSSOM.CSSStyleSheet();
1951
+
1952
+ var rules = stylesheet.cssRules;
1953
+ if (!rules) {
1954
+ return cloned;
1955
+ }
1956
+
1957
+ for (var i = 0, rulesLength = rules.length; i < rulesLength; i++) {
1958
+ var rule = rules[i];
1959
+ var ruleClone = cloned.cssRules[i] = new rule.constructor();
1960
+
1961
+ var style = rule.style;
1962
+ if (style) {
1963
+ var styleClone = ruleClone.style = new CSSOM.CSSStyleDeclaration();
1964
+ for (var j = 0, styleLength = style.length; j < styleLength; j++) {
1965
+ var name = styleClone[j] = style[j];
1966
+ styleClone[name] = style[name];
1967
+ styleClone._importants[name] = style.getPropertyPriority(name);
1968
+ }
1969
+ styleClone.length = style.length;
1970
+ }
1971
+
1972
+ if (rule.hasOwnProperty('keyText')) {
1973
+ ruleClone.keyText = rule.keyText;
1974
+ }
1975
+
1976
+ if (rule.hasOwnProperty('selectorText')) {
1977
+ ruleClone.selectorText = rule.selectorText;
1978
+ }
1979
+
1980
+ if (rule.hasOwnProperty('mediaText')) {
1981
+ ruleClone.mediaText = rule.mediaText;
1982
+ }
1983
+
1984
+ if (rule.hasOwnProperty('conditionText')) {
1985
+ ruleClone.conditionText = rule.conditionText;
1986
+ }
1987
+
1988
+ if (rule.hasOwnProperty('layerName')) {
1989
+ ruleClone.layerName = rule.layerName;
1990
+ }
1991
+
1992
+ if (rule.hasOwnProperty('cssRules')) {
1993
+ ruleClone.cssRules = clone(rule).cssRules;
1994
+ }
1995
+ }
1996
+
1997
+ return cloned;
1998
+
1999
+ };
2000
+
2001
+ let SSR = "dlssr";
2002
+ let SSR_DATA = SSR + "-d";
2003
+ let SSR_ID = SSR + "i";
2004
+ let CSS_IDENT = "dlcss-";
2005
+
2006
+ // @ts-expect-error rrweb-cssom doesn't have types
2007
+ class Node {
2008
+ _id;
2009
+ nodeType;
2010
+ parent;
2011
+ childNodes = [];
2012
+ appendChild(node) {
2013
+ node.parent = this;
2014
+ if (!this.childNodes.includes(node))
2015
+ this.childNodes.push(node);
2016
+ return node;
2017
+ }
2018
+ append(node) {
2019
+ return this.appendChild(node);
2020
+ }
2021
+ removeChild(node) {
2022
+ node.parent = undefined;
2023
+ this.childNodes = this.childNodes.filter((x) => x !== node);
2024
+ }
2025
+ insertBefore(node, anchor) {
2026
+ this.removeChild(node);
2027
+ node.parent = this;
2028
+ this.childNodes.splice(this.childNodes.findIndex((x) => x === anchor), 0, node);
2029
+ }
2030
+ toStandard() {
2031
+ return null;
2032
+ }
2033
+ get parentNode() {
2034
+ return this.parent;
2035
+ }
2036
+ get firstChild() {
2037
+ return this.childNodes[0];
2038
+ }
2039
+ get nextSibling() {
2040
+ let self = this.parent?.childNodes?.findIndex((x) => x === this);
2041
+ return this.parent?.childNodes[self + 1];
2042
+ }
2043
+ }
2044
+ class ClassList extends Array {
2045
+ constructor() {
2046
+ super();
2047
+ }
2048
+ add(...classes) {
2049
+ this.push(...classes.filter((x) => !this.includes(x)));
2050
+ }
2051
+ remove(...classes) {
2052
+ for (let cls of classes) {
2053
+ let idx = this.findIndex((x) => x === cls);
2054
+ if (idx !== -1)
2055
+ this.splice(idx, 1);
2056
+ }
2057
+ }
2058
+ empty() {
2059
+ return this.length == 0;
2060
+ }
2061
+ toString() {
2062
+ return this.join(" ");
2063
+ }
2064
+ _replace(classes) {
2065
+ this.splice(0, this.length, ...classes);
2066
+ }
2067
+ }
2068
+ class Element extends Node {
2069
+ nodeType = 1;
2070
+ namespace;
2071
+ type;
2072
+ attributes = new Map();
2073
+ classList = new ClassList();
2074
+ component;
2075
+ style = new CSSOM.CSSStyleDeclaration();
2076
+ constructor(type, namespace) {
2077
+ super();
2078
+ this.type = type;
2079
+ this.namespace = namespace;
2080
+ }
2081
+ addEventListener() { }
2082
+ setAttribute(key, value) {
2083
+ if (key === "class")
2084
+ this.classList._replace(value.split(" "));
2085
+ this.attributes.set(key, "" + value);
2086
+ }
2087
+ removeAttribute(key) {
2088
+ if (key === "class")
2089
+ this.classList._replace([]);
2090
+ this.attributes.delete(key);
2091
+ }
2092
+ replaceWith(el) {
2093
+ if (!this.parent)
2094
+ throw new Error("element has no parent");
2095
+ let idx = this.parent.childNodes.findIndex((x) => x === this);
2096
+ this.parent.childNodes[idx] = el;
2097
+ }
2098
+ get $() {
2099
+ return this.component;
2100
+ }
2101
+ set $(value) {
2102
+ this.component = value;
2103
+ }
2104
+ get innerHTML() {
2105
+ return renderToString(this.childNodes.map((x) => x.toStandard()));
2106
+ }
2107
+ set innerHTML(value) {
2108
+ let parsed = parseDocument(value);
2109
+ this.childNodes = parsed.childNodes.map((node) => fromDomhandler(node, this));
2110
+ }
2111
+ set innerText(value) {
2112
+ this.childNodes = [new Text(value)];
2113
+ }
2114
+ toStandard() {
2115
+ if (this.style.cssText) {
2116
+ this.attributes.set("style", this.style.cssText);
2117
+ }
2118
+ let el = new Element$1(this.type, {
2119
+ ...Object.fromEntries(this.attributes.entries()),
2120
+ ...(this.classList.empty() ? {} : { class: this.classList.toString() }),
2121
+ });
2122
+ el.namespace = this.namespace;
2123
+ el.children = this.childNodes.map((x) => {
2124
+ let child = x.toStandard();
2125
+ child.parent = el;
2126
+ return child;
2127
+ });
2128
+ return el;
2129
+ }
2130
+ }
2131
+ function fromDomhandler(node, parent) {
2132
+ let newNode;
2133
+ if (node.type === "text") {
2134
+ newNode = new Text(node.data);
2135
+ }
2136
+ else if (node.type === "comment") {
2137
+ newNode = new Comment(node.data);
2138
+ }
2139
+ else if (node.type === "tag") {
2140
+ const element = new Element(node.name);
2141
+ for (const key in node.attribs) {
2142
+ element.setAttribute(key, node.attribs[key]);
2143
+ }
2144
+ for (const child of node.childNodes) {
2145
+ element.appendChild(fromDomhandler(child, element));
2146
+ }
2147
+ newNode = element;
2148
+ }
2149
+ else {
2150
+ newNode = new Node();
2151
+ }
2152
+ newNode.parent = parent;
2153
+ return newNode;
2154
+ }
2155
+ class Style extends Element {
2156
+ constructor() {
2157
+ super("style");
2158
+ }
2159
+ sheet = new CSSOM.CSSStyleSheet();
2160
+ set innerText(value) {
2161
+ this.sheet = CSSOM.parse(value);
2162
+ }
2163
+ toStandard() {
2164
+ this.childNodes = [new Text(this.sheet.toString())];
2165
+ return super.toStandard();
2166
+ }
2167
+ }
2168
+ class Comment extends Node {
2169
+ nodeType = 8;
2170
+ data;
2171
+ constructor(text) {
2172
+ super();
2173
+ this.data = text;
2174
+ }
2175
+ toStandard() {
2176
+ return new Comment$1(this.data);
2177
+ }
2178
+ }
2179
+ class Text extends Node {
2180
+ nodeType = 3;
2181
+ data;
2182
+ constructor(text) {
2183
+ super();
2184
+ this.data = text;
2185
+ }
2186
+ toStandard() {
2187
+ return new Text$1(this.data);
2188
+ }
2189
+ }
2190
+ let newVDom = () => {
2191
+ let elArr = [];
2192
+ let push = (el) => {
2193
+ let i = elArr.push(el) - 1;
2194
+ el._id = i;
2195
+ if (el instanceof Element)
2196
+ el.setAttribute(SSR_ID, "" + i);
2197
+ return el;
2198
+ };
2199
+ let identArr = new Map();
2200
+ let promises = [];
2201
+ return [
2202
+ {
2203
+ createElement(type) {
2204
+ return push(type === "style" ? new Style() : new Element(type));
2205
+ },
2206
+ createElementNS(ns, type) {
2207
+ return push(new Element(type, ns));
2208
+ },
2209
+ elArr,
2210
+ identArr,
2211
+ promises,
2212
+ head: new Element("head"),
2213
+ },
2214
+ Node,
2215
+ (text) => push(new Text("" + text)),
2216
+ (text) => push(new Comment("" + text)),
2217
+ () => {
2218
+ let ret = "" + identArr.size;
2219
+ identArr.set(elArr.length, ret);
2220
+ return ret;
2221
+ },
2222
+ new Map(),
2223
+ undefined, // enables "ssr mode"
2224
+ undefined,
2225
+ undefined,
2226
+ promises,
2227
+ promises,
2228
+ ];
2229
+ };
2230
+
2231
+ let serializeState = (data, object, isNode) => {
2232
+ let push = (arr, val) => {
2233
+ let idx = arr.indexOf(val);
2234
+ if (idx != -1)
2235
+ return idx;
2236
+ else
2237
+ return arr.push(val) - 1;
2238
+ };
2239
+ let exportPtr = (ptr) => {
2240
+ let zipped = ptr[DREAMLAND]();
2241
+ return zipped ? zipped.map(exportPtr) : { v: _val(ptr.value) };
2242
+ };
2243
+ let isUndefined = (x) => typeof x == "undefined";
2244
+ let _val = (val) => {
2245
+ if (!["bigint", "function", "object"].includes(typeof val)) {
2246
+ return push(data.v, val);
2247
+ }
2248
+ else if (val instanceof Pointer) {
2249
+ return [4, exportPtr(val)];
2250
+ }
2251
+ else if (val instanceof Map) {
2252
+ let entries = Object.fromEntries(val.entries());
2253
+ return [0, _serialize(entries)];
2254
+ }
2255
+ else if (val instanceof Set) {
2256
+ let vals = [...val.values()].map((x) => _val(x));
2257
+ if (vals.some(isUndefined))
2258
+ return;
2259
+ return [2, vals];
2260
+ }
2261
+ else if (val instanceof Array) {
2262
+ let vals = val.map((x) => _val(x));
2263
+ if (vals.some(isUndefined))
2264
+ return;
2265
+ return [3, vals];
2266
+ }
2267
+ else if (typeof val === "object" &&
2268
+ [undefined, Object].includes(val.constructor)) {
2269
+ return [1, _serialize(val)];
2270
+ }
2271
+ else if (!isNode(val)) ;
2272
+ };
2273
+ let _serialize = (object, root) => {
2274
+ let out = [];
2275
+ if (!object[NO_CHANGE])
2276
+ for (let k in object) {
2277
+ if (root && ["cx", "root"].includes(k))
2278
+ continue;
2279
+ let v = object[k];
2280
+ let val = _val(v);
2281
+ if (!isUndefined(val))
2282
+ out.push([push(data.k, k), val]);
2283
+ }
2284
+ return out;
2285
+ };
2286
+ return _serialize(object, true);
2287
+ };
2288
+
2289
+ let storage = new AsyncLocalStorage();
2290
+ let dom = domImpl;
2291
+ setDomImpl(() => storage.getStore() || dom());
2292
+ async function render(component) {
2293
+ let vdom = newVDom();
2294
+ return storage.run(vdom, async () => {
2295
+ let ret;
2296
+ ret = await component();
2297
+ while (vdom[0].promises.length) {
2298
+ await Promise.all(vdom[0].promises.splice(0));
2299
+ }
2300
+ let root, extraHead = [];
2301
+ if (ret instanceof Array) {
2302
+ root = ret[0];
2303
+ extraHead = ret[1];
2304
+ }
2305
+ else {
2306
+ root = ret;
2307
+ }
2308
+ let domIds = new Set();
2309
+ let domCssIdents = new Set();
2310
+ let walk = (el) => {
2311
+ domIds.add(el._id);
2312
+ if (el instanceof Element && el.component) {
2313
+ if (el.component.id)
2314
+ domCssIdents.add(el.component.id);
2315
+ }
2316
+ for (let node of el.childNodes) {
2317
+ walk(node);
2318
+ }
2319
+ };
2320
+ walk(root);
2321
+ let data = {
2322
+ k: [],
2323
+ v: [],
2324
+ n: {},
2325
+ i: Object.fromEntries([...vdom[0].identArr.entries()].filter(([_, i]) => domCssIdents.has(CSS_IDENT + i))),
2326
+ t: [],
2327
+ };
2328
+ for (let el of vdom[0].elArr) {
2329
+ if (!domIds.has(el._id))
2330
+ continue;
2331
+ let node;
2332
+ if (el instanceof Element && el.component) {
2333
+ node = serializeState(data, el.component.state, (x) => x instanceof vdom[1]);
2334
+ }
2335
+ else if ((el instanceof Comment || el instanceof Text) && el.parent) {
2336
+ node = [el.parent._id, el.parent.childNodes.indexOf(el)];
2337
+ }
2338
+ data.n[el._id] = node;
2339
+ }
2340
+ let seen = new Set();
2341
+ for (let el of vdom[0].elArr) {
2342
+ if (!(el instanceof Text) || !el.parent || seen.has(el))
2343
+ continue;
2344
+ let siblings = el.parent.childNodes;
2345
+ let start = siblings.indexOf(el);
2346
+ let run = [];
2347
+ for (let j = start; j < siblings.length && siblings[j] instanceof Text; j++) {
2348
+ run.push(siblings[j]);
2349
+ seen.add(siblings[j]);
2350
+ }
2351
+ if (run.length < 2)
2352
+ continue;
2353
+ for (let j = 0; j < run.length; j++) {
2354
+ if (domIds.has(run[j]._id)) {
2355
+ data.t.push([el.parent._id, start + j, run[j].data.length]);
2356
+ }
2357
+ }
2358
+ }
2359
+ let head = [
2360
+ ...extraHead,
2361
+ ...vdom[0].head.childNodes.filter((x) => x instanceof Element &&
2362
+ domCssIdents.has(x.attributes.get(CSS_IDENT + "id"))),
2363
+ ].map((x) => x.toStandard());
2364
+ return {
2365
+ head,
2366
+ data: new Element$1("script", { type: "application/json", [SSR_DATA]: ":3" }, [new Text$1(JSON.stringify(data))]),
2367
+ component: root.toStandard(),
2368
+ };
2369
+ });
2370
+ }
2371
+
2372
+ export { render };
2373
+ //# sourceMappingURL=ssr.server.js.map