@rindo/core 1.8.12

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 (463) hide show
  1. package/LICENSE.md +27 -0
  2. package/bin/rindo +22 -0
  3. package/build-conditionals/index.d.ts +2 -0
  4. package/build-conditionals/index.mjs +66 -0
  5. package/build-conditionals/package.json +6 -0
  6. package/compiler/index.js +2 -0
  7. package/compiler/package.json +6 -0
  8. package/compiler/rindo.js +6765 -0
  9. package/dist/cli/index.js +6068 -0
  10. package/dist/client/css-shim-14a9812e.js +656 -0
  11. package/dist/client/css-shim-69821662.js +658 -0
  12. package/dist/client/declarations/rindo.core.d.ts +1347 -0
  13. package/dist/client/dom-68c8fe31.js +139 -0
  14. package/dist/client/dom-af01458a.js +137 -0
  15. package/dist/client/index.js +2937 -0
  16. package/dist/client/index.mjs +2820 -0
  17. package/dist/client/polyfills/core-js.js +10 -0
  18. package/dist/client/polyfills/css-shim.js +656 -0
  19. package/dist/client/polyfills/dom.js +146 -0
  20. package/dist/client/polyfills/es5-html-element.js +18 -0
  21. package/dist/client/polyfills/index.js +35 -0
  22. package/dist/client/polyfills/promise.js +9 -0
  23. package/dist/client/polyfills/system.js +6 -0
  24. package/dist/client/shadow-css-6ef31c68.js +386 -0
  25. package/dist/client/shadow-css-8fd1a9e4.js +388 -0
  26. package/dist/compiler/app-core/app-es5-disabled.d.ts +2 -0
  27. package/dist/compiler/app-core/app-polyfills.d.ts +3 -0
  28. package/dist/compiler/app-core/build-conditionals.d.ts +6 -0
  29. package/dist/compiler/app-core/bundle-app-core.d.ts +6 -0
  30. package/dist/compiler/app-core/component-styles.d.ts +4 -0
  31. package/dist/compiler/app-core/format-component-runtime-meta.d.ts +4 -0
  32. package/dist/compiler/app-core/optimize-module.d.ts +7 -0
  33. package/dist/compiler/browser/build-conditionals-client.d.ts +3 -0
  34. package/dist/compiler/browser/compile-options.d.ts +12 -0
  35. package/dist/compiler/browser/compile.d.ts +2 -0
  36. package/dist/compiler/browser/create-compiler.d.ts +14 -0
  37. package/dist/compiler/browser/index.d.ts +11 -0
  38. package/dist/compiler/build/build-ctx.d.ts +74 -0
  39. package/dist/compiler/build/build-finish.d.ts +3 -0
  40. package/dist/compiler/build/build-hmr.d.ts +2 -0
  41. package/dist/compiler/build/build-results.d.ts +2 -0
  42. package/dist/compiler/build/build-stats.d.ts +3 -0
  43. package/dist/compiler/build/build.d.ts +2 -0
  44. package/dist/compiler/build/cache-stats.d.ts +4 -0
  45. package/dist/compiler/build/compiler-build-id.d.ts +6 -0
  46. package/dist/compiler/build/compiler-ctx.d.ts +44 -0
  47. package/dist/compiler/build/init-index-html.d.ts +2 -0
  48. package/dist/compiler/build/validate-files.d.ts +2 -0
  49. package/dist/compiler/build/write-build.d.ts +2 -0
  50. package/dist/compiler/cache.d.ts +22 -0
  51. package/dist/compiler/compiler.d.ts +27 -0
  52. package/dist/compiler/component-hydrate/bundle-hydrate-factory.d.ts +3 -0
  53. package/dist/compiler/component-hydrate/generate-hydrate-app.d.ts +2 -0
  54. package/dist/compiler/component-hydrate/hydrate-factory-closure.d.ts +2 -0
  55. package/dist/compiler/component-hydrate/update-to-hydrate-components.d.ts +2 -0
  56. package/dist/compiler/component-hydrate/write-hydrate-outputs.d.ts +3 -0
  57. package/dist/compiler/component-lazy/generate-cjs.d.ts +3 -0
  58. package/dist/compiler/component-lazy/generate-esm-browser.d.ts +3 -0
  59. package/dist/compiler/component-lazy/generate-esm.d.ts +3 -0
  60. package/dist/compiler/component-lazy/generate-lazy-app.d.ts +3 -0
  61. package/dist/compiler/component-lazy/generate-lazy-module.d.ts +4 -0
  62. package/dist/compiler/component-lazy/generate-system.d.ts +3 -0
  63. package/dist/compiler/component-lazy/update-to-lazy-component.d.ts +2 -0
  64. package/dist/compiler/component-lazy/write-lazy-entry-module.d.ts +2 -0
  65. package/dist/compiler/component-native/update-to-native-component.d.ts +2 -0
  66. package/dist/compiler/config/config-reload.d.ts +3 -0
  67. package/dist/compiler/config/config-utils.d.ts +4 -0
  68. package/dist/compiler/config/validate-config.d.ts +4 -0
  69. package/dist/compiler/config/validate-copy.d.ts +2 -0
  70. package/dist/compiler/config/validate-dev-server.d.ts +2 -0
  71. package/dist/compiler/config/validate-docs.d.ts +2 -0
  72. package/dist/compiler/config/validate-namespace.d.ts +3 -0
  73. package/dist/compiler/config/validate-output-stats.d.ts +2 -0
  74. package/dist/compiler/config/validate-outputs-angular.d.ts +2 -0
  75. package/dist/compiler/config/validate-outputs-custom.d.ts +2 -0
  76. package/dist/compiler/config/validate-outputs-dist-module.d.ts +2 -0
  77. package/dist/compiler/config/validate-outputs-dist.d.ts +2 -0
  78. package/dist/compiler/config/validate-outputs-hydrate-script.d.ts +2 -0
  79. package/dist/compiler/config/validate-outputs-www.d.ts +2 -0
  80. package/dist/compiler/config/validate-outputs.d.ts +2 -0
  81. package/dist/compiler/config/validate-paths.d.ts +2 -0
  82. package/dist/compiler/config/validate-plugins.d.ts +2 -0
  83. package/dist/compiler/config/validate-prerender.d.ts +2 -0
  84. package/dist/compiler/config/validate-rollup-config.d.ts +2 -0
  85. package/dist/compiler/config/validate-service-worker.d.ts +2 -0
  86. package/dist/compiler/config/validate-testing.d.ts +2 -0
  87. package/dist/compiler/config/validate-workers.d.ts +2 -0
  88. package/dist/compiler/copy/assets-copy-tasks.d.ts +3 -0
  89. package/dist/compiler/copy/hashed-copy.d.ts +2 -0
  90. package/dist/compiler/copy/local-copy-tasks.d.ts +3 -0
  91. package/dist/compiler/docs/constants.d.ts +2 -0
  92. package/dist/compiler/docs/custom/index.d.ts +2 -0
  93. package/dist/compiler/docs/docs.d.ts +2 -0
  94. package/dist/compiler/docs/generate-doc-data.d.ts +3 -0
  95. package/dist/compiler/docs/json/index.d.ts +3 -0
  96. package/dist/compiler/docs/readme/docs-util.d.ts +13 -0
  97. package/dist/compiler/docs/readme/index.d.ts +3 -0
  98. package/dist/compiler/docs/readme/markdown-css-props.d.ts +2 -0
  99. package/dist/compiler/docs/readme/markdown-dependencies.d.ts +2 -0
  100. package/dist/compiler/docs/readme/markdown-events.d.ts +2 -0
  101. package/dist/compiler/docs/readme/markdown-methods.d.ts +2 -0
  102. package/dist/compiler/docs/readme/markdown-props.d.ts +2 -0
  103. package/dist/compiler/docs/readme/markdown-slots.d.ts +2 -0
  104. package/dist/compiler/docs/readme/markdown-usage.d.ts +6 -0
  105. package/dist/compiler/docs/readme/output-docs.d.ts +3 -0
  106. package/dist/compiler/docs/style-docs.d.ts +2 -0
  107. package/dist/compiler/docs/vscode/index.d.ts +2 -0
  108. package/dist/compiler/entries/component-bundles.d.ts +3 -0
  109. package/dist/compiler/entries/component-graph.d.ts +2 -0
  110. package/dist/compiler/entries/default-bundles.d.ts +3 -0
  111. package/dist/compiler/entries/entry-modules.d.ts +6 -0
  112. package/dist/compiler/entries/resolve-component-dependencies.d.ts +2 -0
  113. package/dist/compiler/events.d.ts +15 -0
  114. package/dist/compiler/fs-watch/fs-watch-init.d.ts +2 -0
  115. package/dist/compiler/fs-watch/fs-watch-log.d.ts +2 -0
  116. package/dist/compiler/fs-watch/fs-watch-rebuild.d.ts +7 -0
  117. package/dist/compiler/html/inject-module-preloads.d.ts +3 -0
  118. package/dist/compiler/html/inject-sw-script.d.ts +4 -0
  119. package/dist/compiler/html/inline-esm-import.d.ts +2 -0
  120. package/dist/compiler/html/inline-style-sheets.d.ts +2 -0
  121. package/dist/compiler/html/update-global-styles-link.d.ts +2 -0
  122. package/dist/compiler/html/used-components.d.ts +2 -0
  123. package/dist/compiler/html/utils.d.ts +2 -0
  124. package/dist/compiler/html/validate-manifest-json.d.ts +2 -0
  125. package/dist/compiler/index.d.ts +10 -0
  126. package/dist/compiler/index.js +18008 -0
  127. package/dist/compiler/output-targets/empty-dir.d.ts +6 -0
  128. package/dist/compiler/output-targets/index.d.ts +2 -0
  129. package/dist/compiler/output-targets/output-angular.d.ts +4 -0
  130. package/dist/compiler/output-targets/output-app.d.ts +4 -0
  131. package/dist/compiler/output-targets/output-collection.d.ts +3 -0
  132. package/dist/compiler/output-targets/output-copy.d.ts +2 -0
  133. package/dist/compiler/output-targets/output-custom.d.ts +2 -0
  134. package/dist/compiler/output-targets/output-docs.d.ts +2 -0
  135. package/dist/compiler/output-targets/output-hydrate.d.ts +2 -0
  136. package/dist/compiler/output-targets/output-lazy-loader.d.ts +2 -0
  137. package/dist/compiler/output-targets/output-module.d.ts +4 -0
  138. package/dist/compiler/output-targets/output-prerender.d.ts +2 -0
  139. package/dist/compiler/output-targets/output-service-workers.d.ts +2 -0
  140. package/dist/compiler/output-targets/output-types.d.ts +2 -0
  141. package/dist/compiler/output-targets/output-utils.d.ts +54 -0
  142. package/dist/compiler/output-targets/output-www.d.ts +2 -0
  143. package/dist/compiler/plugin/plugin.d.ts +6 -0
  144. package/dist/compiler/polyfills.d.ts +0 -0
  145. package/dist/compiler/prerender/crawl-urls.d.ts +3 -0
  146. package/dist/compiler/prerender/host-config.d.ts +12 -0
  147. package/dist/compiler/prerender/prerender-config.d.ts +2 -0
  148. package/dist/compiler/prerender/prerender-main.d.ts +2 -0
  149. package/dist/compiler/prerender/prerender-queue.d.ts +3 -0
  150. package/dist/compiler/prerender/prerender-template-html.d.ts +2 -0
  151. package/dist/compiler/prerender/prerendered-write-path.d.ts +2 -0
  152. package/dist/compiler/prerender/robots-txt.d.ts +2 -0
  153. package/dist/compiler/prerender/sitemap-xml.d.ts +3 -0
  154. package/dist/compiler/rollup-plugins/component-entry.d.ts +3 -0
  155. package/dist/compiler/rollup-plugins/css-transformer.d.ts +3 -0
  156. package/dist/compiler/rollup-plugins/global-scripts.d.ts +4 -0
  157. package/dist/compiler/rollup-plugins/image-plugin.d.ts +3 -0
  158. package/dist/compiler/rollup-plugins/in-memory-fs-read.d.ts +3 -0
  159. package/dist/compiler/rollup-plugins/loader.d.ts +4 -0
  160. package/dist/compiler/rollup-plugins/plugin-helper.d.ts +5 -0
  161. package/dist/compiler/rollup-plugins/rindo-build-conditionals.d.ts +7 -0
  162. package/dist/compiler/rollup-plugins/rindo-client.d.ts +3 -0
  163. package/dist/compiler/rollup-plugins/rindo-external-runtime.d.ts +2 -0
  164. package/dist/compiler/rollup-plugins/rindo-hydrate.d.ts +3 -0
  165. package/dist/compiler/rollup-plugins/rindo-public-plugin.d.ts +2 -0
  166. package/dist/compiler/service-worker/generate-sw.d.ts +7 -0
  167. package/dist/compiler/service-worker/service-worker-util.d.ts +2 -0
  168. package/dist/compiler/style/cached-styles.d.ts +5 -0
  169. package/dist/compiler/style/component-styles.d.ts +2 -0
  170. package/dist/compiler/style/css-imports.d.ts +9 -0
  171. package/dist/compiler/style/css-to-esm.d.ts +5 -0
  172. package/dist/compiler/style/generate-styles.d.ts +2 -0
  173. package/dist/compiler/style/global-styles.d.ts +3 -0
  174. package/dist/compiler/style/normalize-styles.d.ts +2 -0
  175. package/dist/compiler/style/optimize-css.d.ts +2 -0
  176. package/dist/compiler/style/scope-css.d.ts +3 -0
  177. package/dist/compiler/style/style-utils.d.ts +10 -0
  178. package/dist/compiler/transformers/add-component-meta-proxy.d.ts +3 -0
  179. package/dist/compiler/transformers/add-component-meta-static.d.ts +4 -0
  180. package/dist/compiler/transformers/add-imports.d.ts +3 -0
  181. package/dist/compiler/transformers/collections/add-external-import.d.ts +2 -0
  182. package/dist/compiler/transformers/collections/parse-collection-components.d.ts +2 -0
  183. package/dist/compiler/transformers/collections/parse-collection-deprecated.d.ts +2 -0
  184. package/dist/compiler/transformers/collections/parse-collection-manifest.d.ts +7 -0
  185. package/dist/compiler/transformers/collections/parse-collection-module.d.ts +2 -0
  186. package/dist/compiler/transformers/component-build-conditionals.d.ts +2 -0
  187. package/dist/compiler/transformers/component-hydrate/hydrate-component.d.ts +3 -0
  188. package/dist/compiler/transformers/component-hydrate/hydrate-runtime-cmp-meta.d.ts +3 -0
  189. package/dist/compiler/transformers/component-hydrate/tranform-to-hydrate-component.d.ts +2 -0
  190. package/dist/compiler/transformers/component-lazy/lazy-component.d.ts +3 -0
  191. package/dist/compiler/transformers/component-lazy/lazy-constructor.d.ts +3 -0
  192. package/dist/compiler/transformers/component-lazy/lazy-element-getter.d.ts +3 -0
  193. package/dist/compiler/transformers/component-lazy/transform-lazy-component.d.ts +4 -0
  194. package/dist/compiler/transformers/component-native/native-component.d.ts +3 -0
  195. package/dist/compiler/transformers/component-native/native-connected-callback.d.ts +3 -0
  196. package/dist/compiler/transformers/component-native/native-constructor.d.ts +3 -0
  197. package/dist/compiler/transformers/component-native/native-element-getter.d.ts +3 -0
  198. package/dist/compiler/transformers/component-native/native-static-style.d.ts +3 -0
  199. package/dist/compiler/transformers/component-native/tranform-to-native-component.d.ts +4 -0
  200. package/dist/compiler/transformers/core-runtime-apis.d.ts +30 -0
  201. package/dist/compiler/transformers/create-event.d.ts +3 -0
  202. package/dist/compiler/transformers/decorators-to-static/component-decorator.d.ts +3 -0
  203. package/dist/compiler/transformers/decorators-to-static/convert-decorators.d.ts +3 -0
  204. package/dist/compiler/transformers/decorators-to-static/decorator-utils.d.ts +10 -0
  205. package/dist/compiler/transformers/decorators-to-static/element-decorator.d.ts +3 -0
  206. package/dist/compiler/transformers/decorators-to-static/event-decorator.d.ts +4 -0
  207. package/dist/compiler/transformers/decorators-to-static/listen-decorator.d.ts +6 -0
  208. package/dist/compiler/transformers/decorators-to-static/method-decorator.d.ts +3 -0
  209. package/dist/compiler/transformers/decorators-to-static/prop-decorator.d.ts +4 -0
  210. package/dist/compiler/transformers/decorators-to-static/state-decorator.d.ts +3 -0
  211. package/dist/compiler/transformers/decorators-to-static/style-to-static.d.ts +3 -0
  212. package/dist/compiler/transformers/decorators-to-static/watch-decorator.d.ts +3 -0
  213. package/dist/compiler/transformers/define-custom-element.d.ts +3 -0
  214. package/dist/compiler/transformers/host-data-transform.d.ts +3 -0
  215. package/dist/compiler/transformers/legacy-props.d.ts +3 -0
  216. package/dist/compiler/transformers/remove-static-meta-properties.d.ts +2 -0
  217. package/dist/compiler/transformers/reserved-public-members.d.ts +3 -0
  218. package/dist/compiler/transformers/rindo-import-path.d.ts +3 -0
  219. package/dist/compiler/transformers/static-to-meta/call-expression.d.ts +3 -0
  220. package/dist/compiler/transformers/static-to-meta/class-methods.d.ts +3 -0
  221. package/dist/compiler/transformers/static-to-meta/component.d.ts +3 -0
  222. package/dist/compiler/transformers/static-to-meta/element-ref.d.ts +2 -0
  223. package/dist/compiler/transformers/static-to-meta/encapsulation.d.ts +3 -0
  224. package/dist/compiler/transformers/static-to-meta/events.d.ts +3 -0
  225. package/dist/compiler/transformers/static-to-meta/import.d.ts +3 -0
  226. package/dist/compiler/transformers/static-to-meta/listeners.d.ts +3 -0
  227. package/dist/compiler/transformers/static-to-meta/methods.d.ts +3 -0
  228. package/dist/compiler/transformers/static-to-meta/props.d.ts +3 -0
  229. package/dist/compiler/transformers/static-to-meta/states.d.ts +3 -0
  230. package/dist/compiler/transformers/static-to-meta/string-literal.d.ts +3 -0
  231. package/dist/compiler/transformers/static-to-meta/styles.d.ts +3 -0
  232. package/dist/compiler/transformers/static-to-meta/vdom.d.ts +3 -0
  233. package/dist/compiler/transformers/static-to-meta/visitor.d.ts +3 -0
  234. package/dist/compiler/transformers/static-to-meta/watchers.d.ts +3 -0
  235. package/dist/compiler/transformers/style-imports.d.ts +3 -0
  236. package/dist/compiler/transformers/transform-utils.d.ts +31 -0
  237. package/dist/compiler/transformers/update-component-class.d.ts +3 -0
  238. package/dist/compiler/transformers/update-rindo-core-import.d.ts +3 -0
  239. package/dist/compiler/transformers/watcher-meta-transform.d.ts +3 -0
  240. package/dist/compiler/transpile/compiler-options.d.ts +4 -0
  241. package/dist/compiler/transpile/transpile-app.d.ts +2 -0
  242. package/dist/compiler/transpile/transpile-module.d.ts +5 -0
  243. package/dist/compiler/transpile/transpile-service.d.ts +3 -0
  244. package/dist/compiler/transpile/transpile-to-es5-main.d.ts +2 -0
  245. package/dist/compiler/transpile/validate-types-main.d.ts +2 -0
  246. package/dist/compiler/types/generate-app-types.d.ts +2 -0
  247. package/dist/compiler/types/generate-component-types.d.ts +8 -0
  248. package/dist/compiler/types/generate-event-types.d.ts +2 -0
  249. package/dist/compiler/types/generate-method-types.d.ts +2 -0
  250. package/dist/compiler/types/generate-prop-types.d.ts +2 -0
  251. package/dist/compiler/types/generate-types.d.ts +2 -0
  252. package/dist/compiler/types/rindo-types.d.ts +3 -0
  253. package/dist/compiler/types/types-utils.d.ts +4 -0
  254. package/dist/compiler/types/update-import-refs.d.ts +11 -0
  255. package/dist/compiler/types/validate-package-json.d.ts +9 -0
  256. package/dist/declarations/assets.d.ts +17 -0
  257. package/dist/declarations/browser-compile.d.ts +47 -0
  258. package/dist/declarations/build-conditionals.d.ts +91 -0
  259. package/dist/declarations/build-events.d.ts +19 -0
  260. package/dist/declarations/build.d.ts +247 -0
  261. package/dist/declarations/cache.d.ts +11 -0
  262. package/dist/declarations/collection-manifest.d.ts +106 -0
  263. package/dist/declarations/collection.d.ts +139 -0
  264. package/dist/declarations/compiler.d.ts +53 -0
  265. package/dist/declarations/component-compiler-meta.d.ts +198 -0
  266. package/dist/declarations/component-constructor.d.ts +61 -0
  267. package/dist/declarations/component-interfaces.d.ts +123 -0
  268. package/dist/declarations/config.d.ts +409 -0
  269. package/dist/declarations/css-var-shim.d.ts +9 -0
  270. package/dist/declarations/decorators.d.ts +150 -0
  271. package/dist/declarations/dev-server.d.ts +135 -0
  272. package/dist/declarations/diagnostics.d.ts +21 -0
  273. package/dist/declarations/docs.d.ts +101 -0
  274. package/dist/declarations/entry.d.ts +28 -0
  275. package/dist/declarations/events.d.ts +13 -0
  276. package/dist/declarations/file-system.d.ts +91 -0
  277. package/dist/declarations/fs-watch.d.ts +15 -0
  278. package/dist/declarations/host-element.d.ts +53 -0
  279. package/dist/declarations/hydrate.d.ts +99 -0
  280. package/dist/declarations/in-memory-fs.d.ts +59 -0
  281. package/dist/declarations/index.d.ts +45 -0
  282. package/dist/declarations/jsdoc.d.ts +16 -0
  283. package/dist/declarations/jsx.d.ts +1050 -0
  284. package/dist/declarations/logger.d.ts +25 -0
  285. package/dist/declarations/minify-js.d.ts +11 -0
  286. package/dist/declarations/module.d.ts +35 -0
  287. package/dist/declarations/optimize-css.d.ts +12 -0
  288. package/dist/declarations/output-targets.d.ts +189 -0
  289. package/dist/declarations/plugin.d.ts +23 -0
  290. package/dist/declarations/prerender.d.ts +79 -0
  291. package/dist/declarations/render.d.ts +62 -0
  292. package/dist/declarations/runtime.d.ts +92 -0
  293. package/dist/declarations/screenshots.d.ts +192 -0
  294. package/dist/declarations/server.d.ts +19 -0
  295. package/dist/declarations/style.d.ts +35 -0
  296. package/dist/declarations/system.d.ts +174 -0
  297. package/dist/declarations/testing.d.ts +523 -0
  298. package/dist/declarations/transpile.d.ts +24 -0
  299. package/dist/declarations/types.d.ts +24 -0
  300. package/dist/declarations/vdom.d.ts +55 -0
  301. package/dist/declarations/worker.d.ts +33 -0
  302. package/dist/dev-server/content-type-db.json +1 -0
  303. package/dist/dev-server/index.js +887 -0
  304. package/dist/dev-server/static/app-error.css +257 -0
  305. package/dist/dev-server/static/dev-server-client.html +13 -0
  306. package/dist/dev-server/static/favicon.ico +0 -0
  307. package/dist/dev-server/templates/directory-index.html +132 -0
  308. package/dist/dev-server/templates/initial-load.html +160 -0
  309. package/dist/hydrate/index.d.ts +101 -0
  310. package/dist/hydrate/index.mjs +1281 -0
  311. package/dist/hydrate/platform.mjs +347 -0
  312. package/dist/index.d.ts +99 -0
  313. package/dist/index.js +1 -0
  314. package/dist/mock-doc/index.d.ts +851 -0
  315. package/dist/mock-doc/index.js +3982 -0
  316. package/dist/mock-doc/index.mjs +3954 -0
  317. package/dist/runtime/index.js +2576 -0
  318. package/dist/runtime/index.mjs +2521 -0
  319. package/dist/runtime/shadow-css-6ef31c68.js +386 -0
  320. package/dist/runtime/shadow-css-8fd1a9e4.js +388 -0
  321. package/dist/screenshot/connector-base.d.ts +42 -0
  322. package/dist/screenshot/connector-local.d.ts +7 -0
  323. package/dist/screenshot/index.d.ts +3 -0
  324. package/dist/screenshot/index.js +520 -0
  325. package/dist/screenshot/pixel-match.d.ts +1 -0
  326. package/dist/screenshot/screenshot-fs.d.ts +15 -0
  327. package/dist/sys/node/graceful-fs.js +975 -0
  328. package/dist/sys/node/index.js +33545 -0
  329. package/dist/sys/node/node-fetch.js +1779 -0
  330. package/dist/sys/node/open-in-editor.js +734 -0
  331. package/dist/sys/node/sys-worker.js +67035 -0
  332. package/dist/sys/node/visualstudio.vbs +82 -0
  333. package/dist/sys/node/websocket.js +3728 -0
  334. package/dist/sys/node/xdg-open +1066 -0
  335. package/dist/testing/build-conditionals.d.ts +4 -0
  336. package/dist/testing/build-conditionals.js +43 -0
  337. package/dist/testing/core.d.ts +35 -0
  338. package/dist/testing/core.js +52 -0
  339. package/dist/testing/index.d.ts +13 -0
  340. package/dist/testing/index.js +40511 -0
  341. package/dist/testing/jest/jest-config.d.ts +4 -0
  342. package/dist/testing/jest/jest-environment.d.ts +12 -0
  343. package/dist/testing/jest/jest-preprocessor.d.ts +10 -0
  344. package/dist/testing/jest/jest-runner.d.ts +5 -0
  345. package/dist/testing/jest/jest-screenshot.d.ts +2 -0
  346. package/dist/testing/jest/jest-serializer.d.ts +5 -0
  347. package/dist/testing/jest/jest-setup-test-framework.d.ts +1 -0
  348. package/dist/testing/matchers/attributes.d.ts +14 -0
  349. package/dist/testing/matchers/class-list.d.ts +12 -0
  350. package/dist/testing/matchers/events.d.ts +13 -0
  351. package/dist/testing/matchers/html.d.ts +12 -0
  352. package/dist/testing/matchers/index.d.ts +21 -0
  353. package/dist/testing/matchers/screenshot.d.ts +5 -0
  354. package/dist/testing/matchers/text.d.ts +4 -0
  355. package/dist/testing/mock-fetch.d.ts +46 -0
  356. package/dist/testing/mocks.d.ts +12 -0
  357. package/dist/testing/platform.d.ts +23 -0
  358. package/dist/testing/platform.js +321 -0
  359. package/dist/testing/puppeteer/puppeteer-browser.d.ts +6 -0
  360. package/dist/testing/puppeteer/puppeteer-declarations.d.ts +396 -0
  361. package/dist/testing/puppeteer/puppeteer-element.d.ts +65 -0
  362. package/dist/testing/puppeteer/puppeteer-emulate.d.ts +2 -0
  363. package/dist/testing/puppeteer/puppeteer-events.d.ts +21 -0
  364. package/dist/testing/puppeteer/puppeteer-find.d.ts +5 -0
  365. package/dist/testing/puppeteer/puppeteer-page.d.ts +2 -0
  366. package/dist/testing/puppeteer/puppeteer-screenshot.d.ts +4 -0
  367. package/dist/testing/spec-page.d.ts +5 -0
  368. package/dist/testing/task-queue.d.ts +15 -0
  369. package/dist/testing/test-transpile.d.ts +5 -0
  370. package/dist/testing/testing-fs.d.ts +31 -0
  371. package/dist/testing/testing-logger.d.ts +23 -0
  372. package/dist/testing/testing-sys.d.ts +19 -0
  373. package/dist/testing/testing-utils.d.ts +5 -0
  374. package/dist/testing/testing.d.ts +12 -0
  375. package/dist/utils/index.js +1575 -0
  376. package/dist/utils/index.mjs +1511 -0
  377. package/internal/client/build-conditionals.mjs +82 -0
  378. package/internal/client/css-shim.rindo-client.mjs +656 -0
  379. package/internal/client/dom.rindo-client.mjs +137 -0
  380. package/internal/client/index.mjs +2859 -0
  381. package/internal/client/polyfills/core-js.js +10 -0
  382. package/internal/client/polyfills/css-shim.js +656 -0
  383. package/internal/client/polyfills/dom.js +146 -0
  384. package/internal/client/polyfills/es5-html-element.js +18 -0
  385. package/internal/client/polyfills/index.js +35 -0
  386. package/internal/client/polyfills/promise.js +9 -0
  387. package/internal/client/polyfills/system.js +6 -0
  388. package/internal/client/shadow-css.rindo-client.mjs +386 -0
  389. package/internal/images.d.ts +5 -0
  390. package/internal/index.d.ts +18 -0
  391. package/internal/index.js +1 -0
  392. package/internal/package.json +6 -0
  393. package/mock-doc/index.js +2 -0
  394. package/mock-doc/package.json +10 -0
  395. package/package.json +186 -0
  396. package/readme.md +174 -0
  397. package/runtime/package.json +5 -0
  398. package/screenshot/compare/assets/favicon.ico +0 -0
  399. package/screenshot/compare/assets/logo.png +0 -0
  400. package/screenshot/compare/build/app.css +1 -0
  401. package/screenshot/compare/build/app.esm.js +1 -0
  402. package/screenshot/compare/build/app.js +818 -0
  403. package/screenshot/compare/build/p-020f8d73.js +1 -0
  404. package/screenshot/compare/build/p-09qdknbg.system.entry.js +1 -0
  405. package/screenshot/compare/build/p-0a13mpsc.system.entry.js +1 -0
  406. package/screenshot/compare/build/p-113f7459.js +1 -0
  407. package/screenshot/compare/build/p-168ec2c4.system.js +1 -0
  408. package/screenshot/compare/build/p-2ab1fdf1.system.js +1 -0
  409. package/screenshot/compare/build/p-2pxcsgrj.entry.js +1 -0
  410. package/screenshot/compare/build/p-42fb7034.system.js +1 -0
  411. package/screenshot/compare/build/p-54d9d7c2.system.js +1 -0
  412. package/screenshot/compare/build/p-67c1f911.js +1 -0
  413. package/screenshot/compare/build/p-68613371.system.js +1 -0
  414. package/screenshot/compare/build/p-7dvsjpu0.entry.js +1 -0
  415. package/screenshot/compare/build/p-aa67fb06.js +1 -0
  416. package/screenshot/compare/build/p-aeb3cec1.system.js +1 -0
  417. package/screenshot/compare/build/p-b6e44a24.js +1 -0
  418. package/screenshot/compare/build/p-c1c25b8a.js +1 -0
  419. package/screenshot/compare/build/p-c9bopbjy.system.entry.js +1 -0
  420. package/screenshot/compare/build/p-c9iqz1pp.system.entry.js +1 -0
  421. package/screenshot/compare/build/p-dizjz8rg.entry.js +1 -0
  422. package/screenshot/compare/build/p-dnta0rwp.system.entry.js +1 -0
  423. package/screenshot/compare/build/p-e9670d22.system.js +1 -0
  424. package/screenshot/compare/build/p-efb0eac6.js +1 -0
  425. package/screenshot/compare/build/p-ei9jkpd0.system.entry.js +1 -0
  426. package/screenshot/compare/build/p-ejpsp3kx.js +1 -0
  427. package/screenshot/compare/build/p-ejwcppol.entry.js +1 -0
  428. package/screenshot/compare/build/p-f6612d5d.system.js +1 -0
  429. package/screenshot/compare/build/p-foiivsfc.css +1 -0
  430. package/screenshot/compare/build/p-gpjjyogx.entry.js +1 -0
  431. package/screenshot/compare/build/p-howklem2.system.entry.js +1 -0
  432. package/screenshot/compare/build/p-knv9wvoc.entry.js +1 -0
  433. package/screenshot/compare/build/p-nsqsfhhy.entry.js +1 -0
  434. package/screenshot/compare/build/p-ojt278pp.entry.js +1 -0
  435. package/screenshot/compare/build/p-oywass99.entry.js +1 -0
  436. package/screenshot/compare/build/p-q3ujhub6.entry.js +1 -0
  437. package/screenshot/compare/build/p-qw4xnmxv.entry.js +1 -0
  438. package/screenshot/compare/build/p-t1wvevhc.system.entry.js +1 -0
  439. package/screenshot/compare/build/p-tnjarrex.system.entry.js +1 -0
  440. package/screenshot/compare/build/p-vhfpd6kk.system.entry.js +1 -0
  441. package/screenshot/compare/build/p-vk6rhemd.system.entry.js +1 -0
  442. package/screenshot/compare/build/p-w6bnm16k.entry.js +1 -0
  443. package/screenshot/compare/build/p-xje6d7zl.system.entry.js +1 -0
  444. package/screenshot/compare/build/p-y5jlrcha.system.entry.js +1 -0
  445. package/screenshot/compare/build/p-yh170wkt.entry.js +1 -0
  446. package/screenshot/compare/host.config.json +15 -0
  447. package/screenshot/compare/index.html +1 -0
  448. package/screenshot/compare/manifest.json +13 -0
  449. package/screenshot/connector.js +3 -0
  450. package/screenshot/index.js +2 -0
  451. package/screenshot/local-connector.js +3 -0
  452. package/screenshot/package.json +13 -0
  453. package/screenshot/pixel-match.js +2660 -0
  454. package/sys/node/index.js +2 -0
  455. package/sys/node/package.json +5 -0
  456. package/testing/index.js +2 -0
  457. package/testing/jest-environment.js +3 -0
  458. package/testing/jest-preprocessor.js +3 -0
  459. package/testing/jest-preset.js +40 -0
  460. package/testing/jest-runner.js +3 -0
  461. package/testing/jest-setuptestframework.js +3 -0
  462. package/testing/jest.preprocessor.js +7 -0
  463. package/testing/package.json +6 -0
@@ -0,0 +1,2820 @@
1
+ import { BUILD, NAMESPACE } from '@rindo/core/build-conditionals';
2
+ let queueCongestion = 0;
3
+ let queuePending = false;
4
+ let i = 0;
5
+ let scopeId;
6
+ let contentRef;
7
+ let hostTagName;
8
+ let useNativeShadowDom = false;
9
+ let checkSlotFallbackVisibility = false;
10
+ let checkSlotRelocate = false;
11
+ let isSvgMode = false;
12
+ let renderingElement = null;
13
+ const win = typeof window !== 'undefined' ? window : {};
14
+ const CSS = BUILD.cssVarShim ? win.CSS : null;
15
+ const doc = win.document || { head: {} };
16
+ const H = (win.HTMLElement || class {
17
+ });
18
+ const plt = {
19
+ $flags$: 0,
20
+ $resourcesUrl$: '',
21
+ jmp: (h) => h(),
22
+ raf: (h) => requestAnimationFrame(h),
23
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
24
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
25
+ };
26
+ const supportsShadowDom = BUILD.shadowDomShim ? (BUILD.shadowDom) ? /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)() : false : true;
27
+ const supportsListenerOptions = /*@__PURE__*/ (() => {
28
+ let supportsListenerOptions = false;
29
+ try {
30
+ doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
31
+ get() { supportsListenerOptions = true; }
32
+ }));
33
+ }
34
+ catch (e) { }
35
+ return supportsListenerOptions;
36
+ })();
37
+ const promiseResolve = (v) => Promise.resolve(v);
38
+ const supportsConstructibleStylesheets = BUILD.constructableCSS ? /*@__PURE__*/ (() => {
39
+ try {
40
+ new CSSStyleSheet();
41
+ return true;
42
+ }
43
+ catch (e) { }
44
+ return false;
45
+ })() : false;
46
+ const Context = {};
47
+ const hostRefs = new WeakMap();
48
+ const getHostRef = (ref) => hostRefs.get(ref);
49
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
50
+ const registerHost = (elm) => {
51
+ const hostRef = {
52
+ $flags$: 0,
53
+ $hostElement$: elm,
54
+ $instanceValues$: new Map()
55
+ };
56
+ if (BUILD.isDev) {
57
+ hostRef.$renderCount$ = 0;
58
+ }
59
+ if (BUILD.method && BUILD.lazyLoad) {
60
+ hostRef.$onInstancePromise$ = new Promise(r => hostRef.$onInstanceResolve$ = r);
61
+ }
62
+ if (BUILD.asyncLoading) {
63
+ hostRef.$onReadyPromise$ = new Promise(r => hostRef.$onReadyResolve$ = r);
64
+ elm['s-p'] = [];
65
+ elm['s-rc'] = [];
66
+ }
67
+ return hostRefs.set(elm, hostRef);
68
+ };
69
+ const isMemberInElement = (elm, memberName) => memberName in elm;
70
+ const RINDO_DEV_MODE = ['%c[RINDO-DEV-MODE]', 'color:#4c47ff;font-weight: bold'];
71
+ const consoleDevError = (...m) => console.error(...RINDO_DEV_MODE, ...m);
72
+ const consoleDevWarn = (...m) => console.warn(...RINDO_DEV_MODE, ...m);
73
+ const consoleDevInfo = (...m) => console.info(...RINDO_DEV_MODE, ...m);
74
+ const consoleError = (e) => console.error(e);
75
+ const moduleCache = /*@__PURE__*/ new Map();
76
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
77
+ // loadModuleImport
78
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
79
+ const bundleId = ((BUILD.mode && typeof cmpMeta.$lazyBundleIds$ !== 'string')
80
+ ? cmpMeta.$lazyBundleIds$[hostRef.$modeName$]
81
+ : cmpMeta.$lazyBundleIds$);
82
+ const module = !BUILD.hotModuleReplacement ? moduleCache.get(bundleId) : false;
83
+ if (module) {
84
+ return module[exportName];
85
+ }
86
+ return import(
87
+ /* webpackInclude: /\.entry\.js$/ */
88
+ /* webpackExclude: /\.system\.entry\.js$/ */
89
+ /* webpackMode: "lazy" */
90
+ `./${bundleId}.entry.js${BUILD.hotModuleReplacement && hmrVersionId ? '?s-hmr=' + hmrVersionId : ''}`).then(importedModule => {
91
+ if (!BUILD.hotModuleReplacement) {
92
+ moduleCache.set(bundleId, importedModule);
93
+ }
94
+ return importedModule[exportName];
95
+ }, consoleError);
96
+ };
97
+ const styles = new Map();
98
+ const queueDomReads = [];
99
+ const queueDomWrites = [];
100
+ const queueDomWritesLow = [];
101
+ const queueTask = (queue, write) => (cb) => {
102
+ queue.push(cb);
103
+ if (!queuePending) {
104
+ queuePending = true;
105
+ if (write && plt.$flags$ & 4 /* queueSync */) {
106
+ nextTick(flush);
107
+ }
108
+ else {
109
+ plt.raf(flush);
110
+ }
111
+ }
112
+ };
113
+ const consume = (queue) => {
114
+ for (let i = 0; i < queue.length; i++) {
115
+ try {
116
+ queue[i](performance.now());
117
+ }
118
+ catch (e) {
119
+ consoleError(e);
120
+ }
121
+ }
122
+ queue.length = 0;
123
+ };
124
+ const consumeTimeout = (queue, timeout) => {
125
+ let i = 0;
126
+ let ts = 0;
127
+ while (i < queue.length && (ts = performance.now()) < timeout) {
128
+ try {
129
+ queue[i++](ts);
130
+ }
131
+ catch (e) {
132
+ consoleError(e);
133
+ }
134
+ }
135
+ if (i === queue.length) {
136
+ queue.length = 0;
137
+ }
138
+ else if (i !== 0) {
139
+ queue.splice(0, i);
140
+ }
141
+ };
142
+ const flush = () => {
143
+ queueCongestion++;
144
+ // always force a bunch of medium callbacks to run, but still have
145
+ // a throttle on how many can run in a certain time
146
+ // DOM READS!!!
147
+ consume(queueDomReads);
148
+ const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */
149
+ ? performance.now() + (10 * Math.ceil(queueCongestion * (1.0 / 22.0)))
150
+ : Infinity;
151
+ // DOM WRITES!!!
152
+ consumeTimeout(queueDomWrites, timeout);
153
+ consumeTimeout(queueDomWritesLow, timeout);
154
+ if (queueDomWrites.length > 0) {
155
+ queueDomWritesLow.push(...queueDomWrites);
156
+ queueDomWrites.length = 0;
157
+ }
158
+ if (queuePending = ((queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length) > 0)) {
159
+ // still more to do yet, but we've run out of time
160
+ // let's let this thing cool off and try again in the next tick
161
+ plt.raf(flush);
162
+ }
163
+ else {
164
+ queueCongestion = 0;
165
+ }
166
+ };
167
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
168
+ const readTask = /*@__PURE__*/ queueTask(queueDomReads, false);
169
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
170
+ const Build = {
171
+ isDev: BUILD.isDev ? true : false,
172
+ isBrowser: true
173
+ };
174
+ /**
175
+ * Default style mode id
176
+ */
177
+ /**
178
+ * Reusable empty obj/array
179
+ * Don't add values to these!!
180
+ */
181
+ const EMPTY_OBJ = {};
182
+ /**
183
+ * Namespaces
184
+ */
185
+ const SVG_NS = 'http://www.w3.org/2000/svg';
186
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
187
+ const isDef = (v) => v != null;
188
+ const isComplexType = (o) => {
189
+ // https://jsperf.com/typeof-fn-object/5
190
+ o = typeof o;
191
+ return o === 'object' || o === 'function';
192
+ };
193
+ const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
194
+ const patchEsm = () => {
195
+ // @ts-ignore
196
+ if (BUILD.cssVarShim && !(CSS && CSS.supports && CSS.supports('color', 'var(--c)'))) {
197
+ // @ts-ignore
198
+ return import(/* webpackChunkName: "rindo-polyfills-css-shim" */ './css-shim-14a9812e.js').then(() => {
199
+ if (plt.$cssShim$ = win.__cssshim) {
200
+ return plt.$cssShim$.i();
201
+ }
202
+ else {
203
+ // for better minification
204
+ return 0;
205
+ }
206
+ });
207
+ }
208
+ return promiseResolve();
209
+ };
210
+ const patchBrowser = () => {
211
+ // NOTE!! This fn cannot use async/await!
212
+ if (BUILD.isDev) {
213
+ consoleDevInfo('Rindo is running in the development mode.');
214
+ }
215
+ if (BUILD.cssVarShim) {
216
+ // shim css vars
217
+ plt.$cssShim$ = win.__cssshim;
218
+ }
219
+ if (BUILD.cloneNodeFix) {
220
+ // opted-in to polyfill cloneNode() for slot polyfilled components
221
+ patchCloneNodeFix(H.prototype);
222
+ }
223
+ if (BUILD.profile && !performance.mark) {
224
+ // not all browsers support performance.mark/measure (Safari 10)
225
+ performance.mark = performance.measure = () => { };
226
+ performance.getEntriesByName = () => [];
227
+ }
228
+ // @ts-ignore
229
+ const scriptElm = (BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim) ?
230
+ Array.from(doc.querySelectorAll('script')).find(s => (new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) ||
231
+ s.getAttribute('data-rindo-namespace') === NAMESPACE)) : null;
232
+ const importMeta = import.meta.url;
233
+ const opts = BUILD.scriptDataOpts ? scriptElm['data-opts'] || {} : {};
234
+ if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {
235
+ // Safari < v11 support: This IF is true if it's Safari below v11.
236
+ // This fn cannot use async/await since Safari didn't support it until v11,
237
+ // however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
238
+ // so both the ESM file and nomodule file would get downloaded. Only Safari
239
+ // has 'onbeforeload' in the script, and "history.scrollRestoration" was added
240
+ // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
241
+ // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
242
+ return { then() { } };
243
+ }
244
+ if (!BUILD.safari10 && importMeta !== '') {
245
+ opts.resourcesUrl = new URL('.', importMeta).href;
246
+ }
247
+ else if (BUILD.dynamicImportShim || BUILD.safari10) {
248
+ opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
249
+ patchDynamicImport(opts.resourcesUrl, scriptElm);
250
+ if (BUILD.dynamicImportShim && !win.customElements) {
251
+ // module support, but no custom elements support (Old Edge)
252
+ // @ts-ignore
253
+ return import(/* webpackChunkName: "rindo-polyfills-dom" */ './dom-af01458a.js').then(() => opts);
254
+ }
255
+ }
256
+ return promiseResolve(opts);
257
+ };
258
+ const patchDynamicImport = (base, orgScriptElm) => {
259
+ const importFunctionName = getDynamicImportFunction(NAMESPACE);
260
+ try {
261
+ // test if this browser supports dynamic imports
262
+ // There is a caching issue in V8, that breaks using import() in Function
263
+ // By generating a random string, we can workaround it
264
+ // Check https://bugs.chromium.org/p/v8/issues/detail?id=9558 for more info
265
+ win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
266
+ }
267
+ catch (e) {
268
+ // this shim is specifically for browsers that do support "esm" imports
269
+ // however, they do NOT support "dynamic" imports
270
+ // basically this code is for old Edge, v18 and below
271
+ const moduleMap = new Map();
272
+ win[importFunctionName] = (src) => {
273
+ const url = new URL(src, base).href;
274
+ let mod = moduleMap.get(url);
275
+ if (!mod) {
276
+ const script = doc.createElement('script');
277
+ script.type = 'module';
278
+ script.crossOrigin = orgScriptElm.crossOrigin;
279
+ script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], { type: 'application/javascript' }));
280
+ mod = new Promise(resolve => {
281
+ script.onload = () => {
282
+ resolve(win[importFunctionName].m);
283
+ script.remove();
284
+ };
285
+ });
286
+ moduleMap.set(url, mod);
287
+ doc.head.appendChild(script);
288
+ }
289
+ return mod;
290
+ };
291
+ }
292
+ };
293
+ const patchCloneNodeFix = (HTMLElementPrototype) => {
294
+ const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;
295
+ HTMLElementPrototype.cloneNode = function (deep) {
296
+ if (this.nodeName === 'TEMPLATE') {
297
+ return nativeCloneNodeFn.call(this, deep);
298
+ }
299
+ const clonedNode = nativeCloneNodeFn.call(this, false);
300
+ const srcChildNodes = this.childNodes;
301
+ if (deep) {
302
+ for (let i = 0; i < srcChildNodes.length; i++) {
303
+ // Node.ATTRIBUTE_NODE === 2, and checking because IE11
304
+ if (srcChildNodes[i].nodeType !== 2) {
305
+ clonedNode.appendChild(srcChildNodes[i].cloneNode(true));
306
+ }
307
+ }
308
+ }
309
+ return clonedNode;
310
+ };
311
+ };
312
+ const CONTENT_REF_ID = 'r';
313
+ const ORG_LOCATION_ID = 'o';
314
+ const SLOT_NODE_ID = 's';
315
+ const TEXT_NODE_ID = 't';
316
+ const HYDRATE_ID = 's-id';
317
+ const HYDRATED_STYLE_ID = 'sty-id';
318
+ const HYDRATE_CHILD_ID = 'c-id';
319
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
320
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
321
+ const createTime = (fnName, tagName = '') => {
322
+ if (BUILD.profile) {
323
+ const key = `st:${fnName}:${tagName}:${i++}`;
324
+ // Start
325
+ performance.mark(key);
326
+ // End
327
+ return () => performance.measure(`[Rindo] ${fnName}() <${tagName}>`, key);
328
+ }
329
+ else {
330
+ return () => { return; };
331
+ }
332
+ };
333
+ const uniqueTime = (key, measureText) => {
334
+ if (BUILD.profile) {
335
+ if (performance.getEntriesByName(key).length === 0) {
336
+ performance.mark(key);
337
+ }
338
+ return () => {
339
+ if (performance.getEntriesByName(measureText).length === 0) {
340
+ performance.measure(measureText, key);
341
+ }
342
+ };
343
+ }
344
+ else {
345
+ return () => { return; };
346
+ }
347
+ };
348
+ const inspect = (ref) => {
349
+ const hostRef = getHostRef(ref);
350
+ if (!hostRef) {
351
+ return undefined;
352
+ }
353
+ const flags = hostRef.$flags$;
354
+ const hostElement = hostRef.$hostElement$;
355
+ return {
356
+ renderCount: hostRef.$renderCount$,
357
+ flags: {
358
+ hasRendered: !!(flags & 2 /* hasRendered */),
359
+ hasConnected: !!(flags & 1 /* hasConnected */),
360
+ isWaitingForChildren: !!(flags & 4 /* isWaitingForChildren */),
361
+ isConstructingInstance: !!(flags & 8 /* isConstructingInstance */),
362
+ isQueuedForUpdate: !!(flags & 16 /* isQueuedForUpdate */),
363
+ hasInitializedComponent: !!(flags & 32 /* hasInitializedComponent */),
364
+ hasLoadedComponent: !!(flags & 64 /* hasLoadedComponent */),
365
+ isWatchReady: !!(flags & 128 /* isWatchReady */),
366
+ isListenReady: !!(flags & 256 /* isListenReady */),
367
+ needsRerender: !!(flags & 512 /* needsRerender */),
368
+ },
369
+ instanceValues: hostRef.$instanceValues$,
370
+ ancestorComponent: hostRef.$ancestorComponent$,
371
+ hostElement,
372
+ lazyInstance: hostRef.$lazyInstance$,
373
+ vnode: hostRef.$vnode$,
374
+ modeName: hostRef.$modeName$,
375
+ onReadyPromise: hostRef.$onReadyPromise$,
376
+ onReadyResolve: hostRef.$onReadyResolve$,
377
+ onInstancePromise: hostRef.$onInstancePromise$,
378
+ onInstanceResolve: hostRef.$onInstanceResolve$,
379
+ onRenderResolve: hostRef.$onRenderResolve$,
380
+ queuedListeners: hostRef.$queuedListeners$,
381
+ rmListeners: hostRef.$rmListeners$,
382
+ ['s-id']: hostElement['s-id'],
383
+ ['s-cr']: hostElement['s-cr'],
384
+ ['s-lr']: hostElement['s-lr'],
385
+ ['s-p']: hostElement['s-p'],
386
+ ['s-rc']: hostElement['s-rc'],
387
+ ['s-sc']: hostElement['s-sc'],
388
+ };
389
+ };
390
+ const installDevTools = () => {
391
+ if (BUILD.devTools) {
392
+ const rindo = win.rindo = win.rindo || {};
393
+ const originalInspect = rindo.inspect;
394
+ rindo.inspect = (ref) => {
395
+ let result = inspect(ref);
396
+ if (!result && typeof originalInspect === 'function') {
397
+ result = originalInspect(ref);
398
+ }
399
+ return result;
400
+ };
401
+ }
402
+ };
403
+ const rootAppliedStyles = new WeakMap();
404
+ const registerStyle = (scopeId, cssText, allowCS) => {
405
+ let style = styles.get(scopeId);
406
+ if (supportsConstructibleStylesheets && allowCS) {
407
+ style = (style || new CSSStyleSheet());
408
+ style.replace(cssText);
409
+ }
410
+ else {
411
+ style = cssText;
412
+ }
413
+ styles.set(scopeId, style);
414
+ };
415
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
416
+ let scopeId = BUILD.mode ? getScopeId(cmpMeta.$tagName$, mode) : getScopeId(cmpMeta.$tagName$);
417
+ let style = styles.get(scopeId);
418
+ // if an element is NOT connected then getRootNode() will return the wrong root node
419
+ // so the fallback is to always use the document for the root node in those cases
420
+ styleContainerNode = (styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc);
421
+ if (BUILD.mode && !style) {
422
+ scopeId = getScopeId(cmpMeta.$tagName$);
423
+ style = styles.get(scopeId);
424
+ }
425
+ if (style) {
426
+ if (typeof style === 'string') {
427
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
428
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
429
+ let styleElm;
430
+ if (!appliedStyles) {
431
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = new Set());
432
+ }
433
+ if (!appliedStyles.has(scopeId)) {
434
+ if (BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
435
+ // This is only happening on native shadow-dom, do not needs CSS var shim
436
+ styleElm.innerHTML = style;
437
+ }
438
+ else {
439
+ if (BUILD.cssVarShim && plt.$cssShim$) {
440
+ styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
441
+ const newScopeId = styleElm['s-sc'];
442
+ if (newScopeId) {
443
+ scopeId = newScopeId;
444
+ // we don't want to add this styleID to the appliedStyles Set
445
+ // since the cssVarShim might need to apply several different
446
+ // stylesheets for the same component
447
+ appliedStyles = null;
448
+ }
449
+ }
450
+ else {
451
+ styleElm = doc.createElement('style');
452
+ styleElm.innerHTML = style;
453
+ }
454
+ if (BUILD.hydrateServerSide || BUILD.hotModuleReplacement) {
455
+ styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId);
456
+ }
457
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
458
+ }
459
+ if (appliedStyles) {
460
+ appliedStyles.add(scopeId);
461
+ }
462
+ }
463
+ }
464
+ else if (BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
465
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
466
+ }
467
+ }
468
+ return scopeId;
469
+ };
470
+ const attachStyles = (elm, cmpMeta, mode) => {
471
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
472
+ const scopeId = addStyle((BUILD.shadowDom && supportsShadowDom && elm.shadowRoot)
473
+ ? elm.shadowRoot
474
+ : elm.getRootNode(), cmpMeta, mode, elm);
475
+ if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */) {
476
+ // only required when we're NOT using native shadow dom (slot)
477
+ // or this browser doesn't support native shadow dom
478
+ // and this host element was NOT created with SSR
479
+ // let's pick out the inner content for slot projection
480
+ // create a node to represent where the original
481
+ // content was first placed, which is useful later on
482
+ // DOM WRITE!!
483
+ elm['s-sc'] = scopeId;
484
+ elm.classList.add(scopeId + '-h');
485
+ if (BUILD.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
486
+ elm.classList.add(scopeId + '-s');
487
+ }
488
+ }
489
+ endAttachStyles();
490
+ };
491
+ const getScopeId = (tagName, mode) => 'sc-' + ((BUILD.mode && mode) ? tagName + '-' + mode : tagName);
492
+ const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
493
+ /**
494
+ * Production h() function based on Preact by
495
+ * Jason Miller (@developit)
496
+ * Licensed under the MIT License
497
+ * https://github.com/developit/preact/blob/master/LICENSE
498
+ *
499
+ * Modified for Rindo's compiler and vdom
500
+ */
501
+ // const stack: any[] = [];
502
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
503
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
504
+ const h = (nodeName, vnodeData, ...children) => {
505
+ let child = null;
506
+ let key = null;
507
+ let slotName = null;
508
+ let simple = false;
509
+ let lastSimple = false;
510
+ let vNodeChildren = [];
511
+ const walk = (c) => {
512
+ for (let i = 0; i < c.length; i++) {
513
+ child = c[i];
514
+ if (Array.isArray(child)) {
515
+ walk(child);
516
+ }
517
+ else if (child != null && typeof child !== 'boolean') {
518
+ if (simple = typeof nodeName !== 'function' && !isComplexType(child)) {
519
+ child = String(child);
520
+ }
521
+ else if (BUILD.isDev && child.$flags$ === undefined) {
522
+ consoleDevError(`vNode passed as children has unexpected type.
523
+ Make sure it's using the correct h() function.
524
+ Empty objects can also be the cause, look for JSX comments that became objects.`);
525
+ }
526
+ if (simple && lastSimple) {
527
+ // If the previous child was simple (string), we merge both
528
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
529
+ }
530
+ else {
531
+ // Append a new vNode, if it's text, we create a text vNode
532
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
533
+ }
534
+ lastSimple = simple;
535
+ }
536
+ }
537
+ };
538
+ walk(children);
539
+ if (vnodeData) {
540
+ if (BUILD.isDev && nodeName === 'input') {
541
+ validateInputProperties(vnodeData);
542
+ }
543
+ // normalize class / classname attributes
544
+ if (BUILD.vdomKey && vnodeData.key) {
545
+ key = vnodeData.key;
546
+ }
547
+ if (BUILD.slotRelocation && vnodeData.name) {
548
+ slotName = vnodeData.name;
549
+ }
550
+ if (BUILD.vdomClass) {
551
+ const classData = vnodeData.className || vnodeData.class;
552
+ if (classData) {
553
+ vnodeData.class = typeof classData !== 'object'
554
+ ? classData
555
+ : Object.keys(classData)
556
+ .filter(k => classData[k])
557
+ .join(' ');
558
+ }
559
+ }
560
+ }
561
+ if (BUILD.isDev && vNodeChildren.some(isHost)) {
562
+ consoleDevError(`The <Host> must be the single root component. Make sure:
563
+ - You are NOT using hostData() and <Host> in the same component.
564
+ - <Host> is used once, and it's the single root component of the render() function.`);
565
+ }
566
+ if (BUILD.vdomFunctional && typeof nodeName === 'function') {
567
+ // nodeName is a functional component
568
+ return nodeName(vnodeData, vNodeChildren, vdomFnUtils);
569
+ }
570
+ const vnode = newVNode(nodeName, null);
571
+ vnode.$attrs$ = vnodeData;
572
+ if (vNodeChildren.length > 0) {
573
+ vnode.$children$ = vNodeChildren;
574
+ }
575
+ if (BUILD.vdomKey) {
576
+ vnode.$key$ = key;
577
+ }
578
+ if (BUILD.slotRelocation) {
579
+ vnode.$name$ = slotName;
580
+ }
581
+ return vnode;
582
+ };
583
+ const newVNode = (tag, text) => {
584
+ const vnode = {
585
+ $flags$: 0,
586
+ $tag$: tag,
587
+ $text$: text,
588
+ $elm$: null,
589
+ $children$: null
590
+ };
591
+ if (BUILD.vdomAttribute) {
592
+ vnode.$attrs$ = null;
593
+ }
594
+ if (BUILD.vdomKey) {
595
+ vnode.$key$ = null;
596
+ }
597
+ if (BUILD.slotRelocation) {
598
+ vnode.$name$ = null;
599
+ }
600
+ return vnode;
601
+ };
602
+ const Host = {};
603
+ const isHost = (node) => node && node.$tag$ === Host;
604
+ const vdomFnUtils = {
605
+ 'forEach': (children, cb) => children.map(convertToPublic).forEach(cb),
606
+ 'map': (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
607
+ };
608
+ const convertToPublic = (node) => {
609
+ return {
610
+ vattrs: node.$attrs$,
611
+ vchildren: node.$children$,
612
+ vkey: node.$key$,
613
+ vname: node.$name$,
614
+ vtag: node.$tag$,
615
+ vtext: node.$text$
616
+ };
617
+ };
618
+ const convertToPrivate = (node) => {
619
+ const vnode = newVNode(node.vtag, node.vtext);
620
+ vnode.$attrs$ = node.vattrs;
621
+ vnode.$children$ = node.vchildren;
622
+ vnode.$key$ = node.vkey;
623
+ vnode.$name$ = node.vname;
624
+ return vnode;
625
+ };
626
+ const validateInputProperties = (vnodeData) => {
627
+ const props = Object.keys(vnodeData);
628
+ const typeIndex = props.indexOf('type');
629
+ const minIndex = props.indexOf('min');
630
+ const maxIndex = props.indexOf('max');
631
+ const stepIndex = props.indexOf('min');
632
+ const value = props.indexOf('value');
633
+ if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
634
+ consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
635
+ }
636
+ };
637
+ /**
638
+ * Production setAccessor() function based on Preact by
639
+ * Jason Miller (@developit)
640
+ * Licensed under the MIT License
641
+ * https://github.com/developit/preact/blob/master/LICENSE
642
+ *
643
+ * Modified for Rindo's compiler and vdom
644
+ */
645
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
646
+ if (oldValue !== newValue) {
647
+ let isProp = isMemberInElement(elm, memberName);
648
+ let ln = memberName.toLowerCase();
649
+ if (BUILD.vdomClass && memberName === 'class') {
650
+ const classList = elm.classList;
651
+ const oldClasses = parseClassList(oldValue);
652
+ const newClasses = parseClassList(newValue);
653
+ classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
654
+ classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
655
+ }
656
+ else if (BUILD.vdomStyle && memberName === 'style') {
657
+ // update style attribute, css properties and values
658
+ if (BUILD.updatable) {
659
+ for (const prop in oldValue) {
660
+ if (!newValue || newValue[prop] == null) {
661
+ if (!BUILD.hydrateServerSide && prop.includes('-')) {
662
+ elm.style.removeProperty(prop);
663
+ }
664
+ else {
665
+ elm.style[prop] = '';
666
+ }
667
+ }
668
+ }
669
+ }
670
+ for (const prop in newValue) {
671
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
672
+ if (!BUILD.hydrateServerSide && prop.includes('-')) {
673
+ elm.style.setProperty(prop, newValue[prop]);
674
+ }
675
+ else {
676
+ elm.style[prop] = newValue[prop];
677
+ }
678
+ }
679
+ }
680
+ }
681
+ else if (BUILD.vdomKey && memberName === 'key')
682
+ ;
683
+ else if (BUILD.vdomRef && memberName === 'ref') {
684
+ // minifier will clean this up
685
+ if (newValue) {
686
+ newValue(elm);
687
+ }
688
+ }
689
+ else if (BUILD.vdomListener &&
690
+ (BUILD.lazyLoad
691
+ ? !isProp
692
+ : !elm.__lookupSetter__(memberName)) &&
693
+ memberName[0] === 'o' && memberName[1] === 'n') {
694
+ // Event Handlers
695
+ // so if the member name starts with "on" and the 3rd characters is
696
+ // a capital letter, and it's not already a member on the element,
697
+ // then we're assuming it's an event listener
698
+ if (memberName[2] === '-') {
699
+ // on- prefixed events
700
+ // allows to be explicit about the dom event to listen without any magic
701
+ // under the hood:
702
+ // <my-cmp on-click> // listens for "click"
703
+ // <my-cmp on-Click> // listens for "Click"
704
+ // <my-cmp on-ionChange> // listens for "ionChange"
705
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
706
+ memberName = memberName.slice(3);
707
+ }
708
+ else if (isMemberInElement(win, ln)) {
709
+ // standard event
710
+ // the JSX attribute could have been "onMouseOver" and the
711
+ // member name "onmouseover" is on the window's prototype
712
+ // so let's add the listener "mouseover", which is all lowercased
713
+ memberName = ln.slice(2);
714
+ }
715
+ else {
716
+ // custom event
717
+ // the JSX attribute could have been "onMyCustomEvent"
718
+ // so let's trim off the "on" prefix and lowercase the first character
719
+ // and add the listener "myCustomEvent"
720
+ // except for the first character, we keep the event name case
721
+ memberName = ln[2] + memberName.slice(3);
722
+ }
723
+ if (oldValue) {
724
+ plt.rel(elm, memberName, oldValue, false);
725
+ }
726
+ if (newValue) {
727
+ plt.ael(elm, memberName, newValue, false);
728
+ }
729
+ }
730
+ else if (BUILD.vdomPropOrAttr) {
731
+ // Set property if it exists and it's not a SVG
732
+ const isComplex = isComplexType(newValue);
733
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
734
+ try {
735
+ if (!elm.tagName.includes('-')) {
736
+ let n = newValue == null ? '' : newValue;
737
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
738
+ if (memberName === 'list') {
739
+ isProp = false;
740
+ // tslint:disable-next-line: triple-equals
741
+ }
742
+ else if (oldValue == null || elm[memberName] != n) {
743
+ elm[memberName] = n;
744
+ }
745
+ }
746
+ else {
747
+ elm[memberName] = newValue;
748
+ }
749
+ }
750
+ catch (e) { }
751
+ }
752
+ /**
753
+ * Need to manually update attribute if:
754
+ * - memberName is not an attribute
755
+ * - if we are rendering the host element in order to reflect attribute
756
+ * - if it's a SVG, since properties might not work in <svg>
757
+ * - if the newValue is null/undefined or 'false'.
758
+ */
759
+ let xlink = false;
760
+ if (BUILD.vdomXlink) {
761
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
762
+ memberName = ln;
763
+ xlink = true;
764
+ }
765
+ }
766
+ if (newValue == null || newValue === false) {
767
+ if (BUILD.vdomXlink && xlink) {
768
+ elm.removeAttributeNS(XLINK_NS, memberName);
769
+ }
770
+ else {
771
+ elm.removeAttribute(memberName);
772
+ }
773
+ }
774
+ else if ((!isProp || (flags & 4 /* isHost */) || isSvg) && !isComplex) {
775
+ newValue = newValue === true ? '' : newValue;
776
+ if (BUILD.vdomXlink && xlink) {
777
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
778
+ }
779
+ else {
780
+ elm.setAttribute(memberName, newValue);
781
+ }
782
+ }
783
+ }
784
+ }
785
+ };
786
+ const parseClassListRegex = /\s/;
787
+ const parseClassList = (value) => (!value) ? [] : value.split(parseClassListRegex);
788
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
789
+ // if the element passed in is a shadow root, which is a document fragment
790
+ // then we want to be adding attrs/props to the shadow root's "host" element
791
+ // if it's not a shadow root, then we add attrs/props to the same element
792
+ const elm = (newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host) ? newVnode.$elm$.host : newVnode.$elm$;
793
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
794
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
795
+ if (BUILD.updatable) {
796
+ // remove attributes no longer present on the vnode by setting them to undefined
797
+ for (memberName in oldVnodeAttrs) {
798
+ if (!(memberName in newVnodeAttrs)) {
799
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
800
+ }
801
+ }
802
+ }
803
+ // add new & update changed attributes
804
+ for (memberName in newVnodeAttrs) {
805
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
806
+ }
807
+ };
808
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
809
+ // tslint:disable-next-line: prefer-const
810
+ let newVNode = newParentVNode.$children$[childIndex];
811
+ let i = 0;
812
+ let elm;
813
+ let childNode;
814
+ let oldVNode;
815
+ if (BUILD.slotRelocation && !useNativeShadowDom) {
816
+ // remember for later we need to check to relocate nodes
817
+ checkSlotRelocate = true;
818
+ if (newVNode.$tag$ === 'slot') {
819
+ if (scopeId) {
820
+ // scoped css needs to add its scoped id to the parent element
821
+ parentElm.classList.add(scopeId + '-s');
822
+ }
823
+ newVNode.$flags$ |= (newVNode.$children$)
824
+ // slot element has fallback content
825
+ // still create an element that "mocks" the slot element
826
+ ? 2 /* isSlotFallback */
827
+ // slot element does not have fallback content
828
+ // create an html comment we'll use to always reference
829
+ // where actual slot content should sit next to
830
+ : 1 /* isSlotReference */;
831
+ }
832
+ }
833
+ if (BUILD.isDev && newVNode.$elm$) {
834
+ consoleError(`The JSX ${newVNode.$text$ !== null ? `"${newVNode.$text$}" text` : `"${newVNode.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://rindojs.web.app/docs/templating-jsx#avoid-shared-jsx-nodes`);
835
+ }
836
+ if (BUILD.vdomText && newVNode.$text$ !== null) {
837
+ // create text node
838
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
839
+ }
840
+ else if (BUILD.slotRelocation && newVNode.$flags$ & 1 /* isSlotReference */) {
841
+ // create a slot reference node
842
+ elm = newVNode.$elm$ = (BUILD.isDebug || BUILD.hydrateServerSide) ? slotReferenceDebugNode(newVNode) : doc.createTextNode('');
843
+ }
844
+ else {
845
+ if (BUILD.svg && !isSvgMode) {
846
+ isSvgMode = newVNode.$tag$ === 'svg';
847
+ }
848
+ // create element
849
+ elm = newVNode.$elm$ = ((BUILD.svg)
850
+ ? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, (BUILD.slotRelocation && newVNode.$flags$ & 2 /* isSlotFallback */) ? 'slot-fb' : newVNode.$tag$)
851
+ : doc.createElement((BUILD.slotRelocation && newVNode.$flags$ & 2 /* isSlotFallback */) ? 'slot-fb' : newVNode.$tag$));
852
+ if (BUILD.svg && isSvgMode && newVNode.$tag$ === 'foreignObject') {
853
+ isSvgMode = false;
854
+ }
855
+ // add css classes, attrs, props, listeners, etc.
856
+ if (BUILD.vdomAttribute) {
857
+ updateElement(null, newVNode, isSvgMode);
858
+ }
859
+ if ((BUILD.shadowDom || BUILD.scoped) && isDef(scopeId) && elm['s-si'] !== scopeId) {
860
+ // if there is a scopeId and this is the initial render
861
+ // then let's add the scopeId as a css class
862
+ elm.classList.add((elm['s-si'] = scopeId));
863
+ }
864
+ if (newVNode.$children$) {
865
+ for (i = 0; i < newVNode.$children$.length; ++i) {
866
+ // create the node
867
+ childNode = createElm(oldParentVNode, newVNode, i, elm);
868
+ // return node could have been null
869
+ if (childNode) {
870
+ // append our new node
871
+ elm.appendChild(childNode);
872
+ }
873
+ }
874
+ }
875
+ if (BUILD.svg) {
876
+ if (newVNode.$tag$ === 'svg') {
877
+ // Only reset the SVG context when we're exiting <svg> element
878
+ isSvgMode = false;
879
+ }
880
+ else if (elm.tagName === 'foreignObject') {
881
+ // Reenter SVG context when we're exiting <foreignObject> element
882
+ isSvgMode = true;
883
+ }
884
+ }
885
+ }
886
+ if (BUILD.slotRelocation) {
887
+ elm['s-hn'] = hostTagName;
888
+ if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
889
+ // remember the content reference comment
890
+ elm['s-sr'] = true;
891
+ // remember the content reference comment
892
+ elm['s-cr'] = contentRef;
893
+ // remember the slot name, or empty string for default slot
894
+ elm['s-sn'] = newVNode.$name$ || '';
895
+ // check if we've got an old vnode for this slot
896
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
897
+ if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
898
+ // we've got an old slot vnode and the wrapper is being replaced
899
+ // so let's move the old slot content back to it's original location
900
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
901
+ }
902
+ }
903
+ }
904
+ return elm;
905
+ };
906
+ const putBackInOriginalLocation = (parentElm, recursive) => {
907
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
908
+ const oldSlotChildNodes = parentElm.childNodes;
909
+ for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
910
+ const childNode = oldSlotChildNodes[i];
911
+ if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
912
+ // // this child node in the old element is from another component
913
+ // // remove this node from the old slot's parent
914
+ // childNode.remove();
915
+ // and relocate it back to it's original location
916
+ parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
917
+ // remove the old original location comment entirely
918
+ // later on the patch function will know what to do
919
+ // and move this to the correct spot in need be
920
+ childNode['s-ol'].remove();
921
+ childNode['s-ol'] = undefined;
922
+ checkSlotRelocate = true;
923
+ }
924
+ if (recursive) {
925
+ putBackInOriginalLocation(childNode, recursive);
926
+ }
927
+ }
928
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
929
+ };
930
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
931
+ let containerElm = ((BUILD.slotRelocation && parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
932
+ let childNode;
933
+ if (BUILD.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
934
+ containerElm = containerElm.shadowRoot;
935
+ }
936
+ for (; startIdx <= endIdx; ++startIdx) {
937
+ if (vnodes[startIdx]) {
938
+ childNode = createElm(null, parentVNode, startIdx, parentElm);
939
+ if (childNode) {
940
+ vnodes[startIdx].$elm$ = childNode;
941
+ containerElm.insertBefore(childNode, BUILD.slotRelocation ? referenceNode(before) : before);
942
+ }
943
+ }
944
+ }
945
+ };
946
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
947
+ for (; startIdx <= endIdx; ++startIdx) {
948
+ if (vnode = vnodes[startIdx]) {
949
+ elm = vnode.$elm$;
950
+ callNodeRefs(vnode);
951
+ if (BUILD.slotRelocation) {
952
+ // we're removing this element
953
+ // so it's possible we need to show slot fallback content now
954
+ checkSlotFallbackVisibility = true;
955
+ if (elm['s-ol']) {
956
+ // remove the original location comment
957
+ elm['s-ol'].remove();
958
+ }
959
+ else {
960
+ // it's possible that child nodes of the node
961
+ // that's being removed are slot nodes
962
+ putBackInOriginalLocation(elm, true);
963
+ }
964
+ }
965
+ // remove the vnode's element from the dom
966
+ elm.remove();
967
+ }
968
+ }
969
+ };
970
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
971
+ let oldStartIdx = 0;
972
+ let newStartIdx = 0;
973
+ let idxInOld = 0;
974
+ let i = 0;
975
+ let oldEndIdx = oldCh.length - 1;
976
+ let oldStartVnode = oldCh[0];
977
+ let oldEndVnode = oldCh[oldEndIdx];
978
+ let newEndIdx = newCh.length - 1;
979
+ let newStartVnode = newCh[0];
980
+ let newEndVnode = newCh[newEndIdx];
981
+ let node;
982
+ let elmToMove;
983
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
984
+ if (oldStartVnode == null) {
985
+ // Vnode might have been moved left
986
+ oldStartVnode = oldCh[++oldStartIdx];
987
+ }
988
+ else if (oldEndVnode == null) {
989
+ oldEndVnode = oldCh[--oldEndIdx];
990
+ }
991
+ else if (newStartVnode == null) {
992
+ newStartVnode = newCh[++newStartIdx];
993
+ }
994
+ else if (newEndVnode == null) {
995
+ newEndVnode = newCh[--newEndIdx];
996
+ }
997
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
998
+ patch(oldStartVnode, newStartVnode);
999
+ oldStartVnode = oldCh[++oldStartIdx];
1000
+ newStartVnode = newCh[++newStartIdx];
1001
+ }
1002
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
1003
+ patch(oldEndVnode, newEndVnode);
1004
+ oldEndVnode = oldCh[--oldEndIdx];
1005
+ newEndVnode = newCh[--newEndIdx];
1006
+ }
1007
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
1008
+ // Vnode moved right
1009
+ if (BUILD.slotRelocation && (oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1010
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
1011
+ }
1012
+ patch(oldStartVnode, newEndVnode);
1013
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1014
+ oldStartVnode = oldCh[++oldStartIdx];
1015
+ newEndVnode = newCh[--newEndIdx];
1016
+ }
1017
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
1018
+ // Vnode moved left
1019
+ if (BUILD.slotRelocation && (oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1020
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1021
+ }
1022
+ patch(oldEndVnode, newStartVnode);
1023
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
1024
+ oldEndVnode = oldCh[--oldEndIdx];
1025
+ newStartVnode = newCh[++newStartIdx];
1026
+ }
1027
+ else {
1028
+ // createKeyToOldIdx
1029
+ idxInOld = -1;
1030
+ if (BUILD.vdomKey) {
1031
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
1032
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
1033
+ idxInOld = i;
1034
+ break;
1035
+ }
1036
+ }
1037
+ }
1038
+ if (BUILD.vdomKey && idxInOld >= 0) {
1039
+ elmToMove = oldCh[idxInOld];
1040
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1041
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
1042
+ }
1043
+ else {
1044
+ patch(elmToMove, newStartVnode);
1045
+ oldCh[idxInOld] = undefined;
1046
+ node = elmToMove.$elm$;
1047
+ }
1048
+ newStartVnode = newCh[++newStartIdx];
1049
+ }
1050
+ else {
1051
+ // new element
1052
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
1053
+ newStartVnode = newCh[++newStartIdx];
1054
+ }
1055
+ if (node) {
1056
+ if (BUILD.slotRelocation) {
1057
+ parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
1058
+ }
1059
+ else {
1060
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
1061
+ }
1062
+ }
1063
+ }
1064
+ }
1065
+ if (oldStartIdx > oldEndIdx) {
1066
+ addVnodes(parentElm, (newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$), newVNode, newCh, newStartIdx, newEndIdx);
1067
+ }
1068
+ else if (BUILD.updatable && newStartIdx > newEndIdx) {
1069
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1070
+ }
1071
+ };
1072
+ const isSameVnode = (vnode1, vnode2) => {
1073
+ // compare if two vnode to see if they're "technically" the same
1074
+ // need to have the same element tag, and same key to be the same
1075
+ if (vnode1.$tag$ === vnode2.$tag$) {
1076
+ if (BUILD.slotRelocation && vnode1.$tag$ === 'slot') {
1077
+ return vnode1.$name$ === vnode2.$name$;
1078
+ }
1079
+ if (BUILD.vdomKey) {
1080
+ return vnode1.$key$ === vnode2.$key$;
1081
+ }
1082
+ return true;
1083
+ }
1084
+ return false;
1085
+ };
1086
+ const referenceNode = (node) => {
1087
+ // this node was relocated to a new location in the dom
1088
+ // because of some other component's slot
1089
+ // but we still have an html comment in place of where
1090
+ // it's original location was according to it's original vdom
1091
+ return (node && node['s-ol']) || node;
1092
+ };
1093
+ const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
1094
+ const patch = (oldVNode, newVNode) => {
1095
+ const elm = newVNode.$elm$ = oldVNode.$elm$;
1096
+ const oldChildren = oldVNode.$children$;
1097
+ const newChildren = newVNode.$children$;
1098
+ const tag = newVNode.$tag$;
1099
+ const text = newVNode.$text$;
1100
+ let defaultHolder;
1101
+ if (!BUILD.vdomText || text === null) {
1102
+ if (BUILD.svg) {
1103
+ // test if we're rendering an svg element, or still rendering nodes inside of one
1104
+ // only add this to the when the compiler sees we're using an svg somewhere
1105
+ isSvgMode = (tag === 'svg')
1106
+ ? true
1107
+ : (tag === 'foreignObject')
1108
+ ? false
1109
+ : isSvgMode;
1110
+ }
1111
+ // element node
1112
+ if (BUILD.vdomAttribute || BUILD.reflect) {
1113
+ if (BUILD.slot && tag === 'slot')
1114
+ ;
1115
+ else {
1116
+ // either this is the first render of an element OR it's an update
1117
+ // AND we already know it's possible it could have changed
1118
+ // this updates the element's css classes, attrs, props, listeners, etc.
1119
+ updateElement(oldVNode, newVNode, isSvgMode);
1120
+ }
1121
+ }
1122
+ if (BUILD.updatable && oldChildren !== null && newChildren !== null) {
1123
+ // looks like there's child vnodes for both the old and new vnodes
1124
+ updateChildren(elm, oldChildren, newVNode, newChildren);
1125
+ }
1126
+ else if (newChildren !== null) {
1127
+ // no old child vnodes, but there are new child vnodes to add
1128
+ if (BUILD.updatable && BUILD.vdomText && oldVNode.$text$ !== null) {
1129
+ // the old vnode was text, so be sure to clear it out
1130
+ elm.textContent = '';
1131
+ }
1132
+ // add the new vnode children
1133
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
1134
+ }
1135
+ else if (BUILD.updatable && oldChildren !== null) {
1136
+ // no new child vnodes, but there are old child vnodes to remove
1137
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
1138
+ }
1139
+ if (BUILD.svg && isSvgMode && tag === 'svg') {
1140
+ isSvgMode = false;
1141
+ }
1142
+ }
1143
+ else if (BUILD.vdomText && BUILD.slotRelocation && (defaultHolder = elm['s-cr'])) {
1144
+ // this element has slotted content
1145
+ defaultHolder.parentNode.textContent = text;
1146
+ }
1147
+ else if (BUILD.vdomText && oldVNode.$text$ !== text) {
1148
+ // update the text content for the text only vnode
1149
+ // and also only if the text is different than before
1150
+ elm.data = text;
1151
+ }
1152
+ };
1153
+ const updateFallbackSlotVisibility = (elm) => {
1154
+ // tslint:disable-next-line: prefer-const
1155
+ let childNodes = elm.childNodes;
1156
+ let childNode;
1157
+ let i;
1158
+ let ilen;
1159
+ let j;
1160
+ let slotNameAttr;
1161
+ let nodeType;
1162
+ for (i = 0, ilen = childNodes.length; i < ilen; i++) {
1163
+ childNode = childNodes[i];
1164
+ if (childNode.nodeType === 1 /* ElementNode */) {
1165
+ if (childNode['s-sr']) {
1166
+ // this is a slot fallback node
1167
+ // get the slot name for this slot reference node
1168
+ slotNameAttr = childNode['s-sn'];
1169
+ // by default always show a fallback slot node
1170
+ // then hide it if there are other slots in the light dom
1171
+ childNode.hidden = false;
1172
+ for (j = 0; j < ilen; j++) {
1173
+ if (childNodes[j]['s-hn'] !== childNode['s-hn']) {
1174
+ // this sibling node is from a different component
1175
+ nodeType = childNodes[j].nodeType;
1176
+ if (slotNameAttr !== '') {
1177
+ // this is a named fallback slot node
1178
+ if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
1179
+ childNode.hidden = true;
1180
+ break;
1181
+ }
1182
+ }
1183
+ else {
1184
+ // this is a default fallback slot node
1185
+ // any element or text node (with content)
1186
+ // should hide the default fallback slot node
1187
+ if (nodeType === 1 /* ElementNode */ || (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
1188
+ childNode.hidden = true;
1189
+ break;
1190
+ }
1191
+ }
1192
+ }
1193
+ }
1194
+ }
1195
+ // keep drilling down
1196
+ updateFallbackSlotVisibility(childNode);
1197
+ }
1198
+ }
1199
+ };
1200
+ const relocateNodes = [];
1201
+ const relocateSlotContent = (elm) => {
1202
+ // tslint:disable-next-line: prefer-const
1203
+ let childNode;
1204
+ let node;
1205
+ let hostContentNodes;
1206
+ let slotNameAttr;
1207
+ let relocateNodeData;
1208
+ let j;
1209
+ let i = 0;
1210
+ let childNodes = elm.childNodes;
1211
+ let ilen = childNodes.length;
1212
+ for (; i < ilen; i++) {
1213
+ childNode = childNodes[i];
1214
+ if (childNode['s-sr'] && (node = childNode['s-cr'])) {
1215
+ // first got the content reference comment node
1216
+ // then we got it's parent, which is where all the host content is in now
1217
+ hostContentNodes = node.parentNode.childNodes;
1218
+ slotNameAttr = childNode['s-sn'];
1219
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
1220
+ node = hostContentNodes[j];
1221
+ if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
1222
+ // let's do some relocating to its new home
1223
+ // but never relocate a content reference node
1224
+ // that is suppose to always represent the original content location
1225
+ if (isNodeLocatedInSlot(node, slotNameAttr)) {
1226
+ // it's possible we've already decided to relocate this node
1227
+ relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
1228
+ // made some changes to slots
1229
+ // let's make sure we also double check
1230
+ // fallbacks are correctly hidden or shown
1231
+ checkSlotFallbackVisibility = true;
1232
+ node['s-sn'] = node['s-sn'] || slotNameAttr;
1233
+ if (relocateNodeData) {
1234
+ // previously we never found a slot home for this node
1235
+ // but turns out we did, so let's remember it now
1236
+ relocateNodeData.$slotRefNode$ = childNode;
1237
+ }
1238
+ else {
1239
+ // add to our list of nodes to relocate
1240
+ relocateNodes.push({
1241
+ $slotRefNode$: childNode,
1242
+ $nodeToRelocate$: node,
1243
+ });
1244
+ }
1245
+ if (node['s-sr']) {
1246
+ relocateNodes.forEach(relocateNode => {
1247
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
1248
+ relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
1249
+ if (relocateNodeData) {
1250
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1251
+ }
1252
+ }
1253
+ });
1254
+ }
1255
+ }
1256
+ else if (!relocateNodes.some(r => r.$nodeToRelocate$ === node)) {
1257
+ // so far this element does not have a slot home, not setting slotRefNode on purpose
1258
+ // if we never find a home for this element then we'll need to hide it
1259
+ relocateNodes.push({
1260
+ $nodeToRelocate$: node,
1261
+ });
1262
+ }
1263
+ }
1264
+ }
1265
+ }
1266
+ if (childNode.nodeType === 1 /* ElementNode */) {
1267
+ relocateSlotContent(childNode);
1268
+ }
1269
+ }
1270
+ };
1271
+ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
1272
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1273
+ if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
1274
+ return true;
1275
+ }
1276
+ if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
1277
+ return true;
1278
+ }
1279
+ return false;
1280
+ }
1281
+ if (nodeToRelocate['s-sn'] === slotNameAttr) {
1282
+ return true;
1283
+ }
1284
+ return slotNameAttr === '';
1285
+ };
1286
+ const callNodeRefs = (vNode) => {
1287
+ if (BUILD.vdomRef) {
1288
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1289
+ vNode.$children$ && vNode.$children$.forEach(callNodeRefs);
1290
+ }
1291
+ };
1292
+ const renderVdom = (hostElm, hostRef, cmpMeta, renderFnResults) => {
1293
+ hostTagName = hostElm.tagName;
1294
+ // <Host> runtime check
1295
+ if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
1296
+ throw new Error(`The <Host> must be the single root component.
1297
+ Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
1298
+
1299
+ The render() function should look like this instead:
1300
+
1301
+ render() {
1302
+ // Do not return an array
1303
+ return (
1304
+ <Host>{content}</Host>
1305
+ );
1306
+ }
1307
+ `);
1308
+ }
1309
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1310
+ const rootVnode = isHost(renderFnResults)
1311
+ ? renderFnResults
1312
+ : h(null, null, renderFnResults);
1313
+ if (BUILD.reflect && cmpMeta.$attrsToReflect$) {
1314
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1315
+ cmpMeta.$attrsToReflect$.forEach(([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]);
1316
+ }
1317
+ rootVnode.$tag$ = null;
1318
+ rootVnode.$flags$ |= 4 /* isHost */;
1319
+ hostRef.$vnode$ = rootVnode;
1320
+ rootVnode.$elm$ = oldVNode.$elm$ = (BUILD.shadowDom ? hostElm.shadowRoot || hostElm : hostElm);
1321
+ if (BUILD.scoped || BUILD.shadowDom) {
1322
+ scopeId = hostElm['s-sc'];
1323
+ }
1324
+ if (BUILD.slotRelocation) {
1325
+ contentRef = hostElm['s-cr'];
1326
+ useNativeShadowDom = supportsShadowDom && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1327
+ // always reset
1328
+ checkSlotFallbackVisibility = false;
1329
+ }
1330
+ // synchronous patch
1331
+ patch(oldVNode, rootVnode);
1332
+ if (BUILD.slotRelocation) {
1333
+ if (checkSlotRelocate) {
1334
+ relocateSlotContent(rootVnode.$elm$);
1335
+ let relocateData;
1336
+ let nodeToRelocate;
1337
+ let orgLocationNode;
1338
+ let parentNodeRef;
1339
+ let insertBeforeNode;
1340
+ let refNode;
1341
+ let i = 0;
1342
+ for (; i < relocateNodes.length; i++) {
1343
+ relocateData = relocateNodes[i];
1344
+ nodeToRelocate = relocateData.$nodeToRelocate$;
1345
+ if (!nodeToRelocate['s-ol']) {
1346
+ // add a reference node marking this node's original location
1347
+ // keep a reference to this node for later lookups
1348
+ orgLocationNode = (BUILD.isDebug || BUILD.hydrateServerSide)
1349
+ ? originalLocationDebugNode(nodeToRelocate)
1350
+ : doc.createTextNode('');
1351
+ orgLocationNode['s-nr'] = nodeToRelocate;
1352
+ nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1353
+ }
1354
+ }
1355
+ // while we're moving nodes around existing nodes, temporarily disable
1356
+ // the disconnectCallback from working
1357
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
1358
+ for (i = 0; i < relocateNodes.length; i++) {
1359
+ relocateData = relocateNodes[i];
1360
+ nodeToRelocate = relocateData.$nodeToRelocate$;
1361
+ if (relocateData.$slotRefNode$) {
1362
+ // by default we're just going to insert it directly
1363
+ // after the slot reference node
1364
+ parentNodeRef = relocateData.$slotRefNode$.parentNode;
1365
+ insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
1366
+ orgLocationNode = nodeToRelocate['s-ol'];
1367
+ while (orgLocationNode = orgLocationNode.previousSibling) {
1368
+ refNode = orgLocationNode['s-nr'];
1369
+ if (refNode &&
1370
+ refNode['s-sn'] === nodeToRelocate['s-sn'] &&
1371
+ parentNodeRef === refNode.parentNode) {
1372
+ refNode = refNode.nextSibling;
1373
+ if (!refNode || !refNode['s-nr']) {
1374
+ insertBeforeNode = refNode;
1375
+ break;
1376
+ }
1377
+ }
1378
+ }
1379
+ if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
1380
+ (nodeToRelocate.nextSibling !== insertBeforeNode)) {
1381
+ // we've checked that it's worth while to relocate
1382
+ // since that the node to relocate
1383
+ // has a different next sibling or parent relocated
1384
+ if (nodeToRelocate !== insertBeforeNode) {
1385
+ if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
1386
+ // probably a component in the index.html that doesn't have it's hostname set
1387
+ nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
1388
+ }
1389
+ // add it back to the dom but in its new home
1390
+ parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1391
+ }
1392
+ }
1393
+ }
1394
+ else {
1395
+ // this node doesn't have a slot home to go to, so let's hide it
1396
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1397
+ nodeToRelocate.hidden = true;
1398
+ }
1399
+ }
1400
+ }
1401
+ // done moving nodes around
1402
+ // allow the disconnect callback to work again
1403
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
1404
+ }
1405
+ if (checkSlotFallbackVisibility) {
1406
+ updateFallbackSlotVisibility(rootVnode.$elm$);
1407
+ }
1408
+ // always reset
1409
+ relocateNodes.length = 0;
1410
+ }
1411
+ };
1412
+ // slot comment debug nodes only created with the `--debug` flag
1413
+ // otherwise these nodes are text nodes w/out content
1414
+ const slotReferenceDebugNode = (slotVNode) => doc.createComment(`<slot${slotVNode.$name$ ?
1415
+ (' name="' + slotVNode.$name$) + '"' :
1416
+ ''}> (host=${hostTagName.toLowerCase()})`);
1417
+ const originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` +
1418
+ (nodeToRelocate.localName ?
1419
+ `<${nodeToRelocate.localName}> (host=${nodeToRelocate['s-hn']})` :
1420
+ `[${nodeToRelocate.textContent}]`));
1421
+ const attachToAncestor = (hostRef, ancestorComponent) => {
1422
+ if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$) {
1423
+ ancestorComponent['s-p'].push(new Promise(r => hostRef.$onRenderResolve$ = r));
1424
+ }
1425
+ };
1426
+ const scheduleUpdate = (elm, hostRef, cmpMeta, isInitialLoad) => {
1427
+ if (BUILD.taskQueue && BUILD.updatable) {
1428
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1429
+ }
1430
+ if (BUILD.asyncLoading && hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1431
+ hostRef.$flags$ |= 512 /* needsRerender */;
1432
+ return;
1433
+ }
1434
+ const endSchedule = createTime('scheduleUpdate', cmpMeta.$tagName$);
1435
+ const ancestorComponent = hostRef.$ancestorComponent$;
1436
+ const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
1437
+ const update = () => updateComponent(elm, hostRef, cmpMeta, instance, isInitialLoad);
1438
+ attachToAncestor(hostRef, ancestorComponent);
1439
+ let promise;
1440
+ if (isInitialLoad) {
1441
+ if (BUILD.lazyLoad && BUILD.hostListener) {
1442
+ hostRef.$flags$ |= 256 /* isListenReady */;
1443
+ if (hostRef.$queuedListeners$) {
1444
+ hostRef.$queuedListeners$.forEach(([methodName, event]) => safeCall(instance, methodName, event));
1445
+ hostRef.$queuedListeners$ = null;
1446
+ }
1447
+ }
1448
+ emitLifecycleEvent(elm, 'componentWillLoad');
1449
+ if (BUILD.cmpWillLoad) {
1450
+ promise = safeCall(instance, 'componentWillLoad');
1451
+ }
1452
+ }
1453
+ else {
1454
+ emitLifecycleEvent(elm, 'componentWillUpdate');
1455
+ if (BUILD.cmpWillUpdate) {
1456
+ promise = safeCall(instance, 'componentWillUpdate');
1457
+ }
1458
+ }
1459
+ emitLifecycleEvent(elm, 'componentWillRender');
1460
+ if (BUILD.cmpWillRender) {
1461
+ promise = then(promise, () => safeCall(instance, 'componentWillRender'));
1462
+ }
1463
+ endSchedule();
1464
+ // there is no ancestorc omponent or the ancestor component
1465
+ // has already fired off its lifecycle update then
1466
+ // fire off the initial update
1467
+ return then(promise, BUILD.taskQueue
1468
+ ? () => writeTask(update)
1469
+ : update);
1470
+ };
1471
+ const updateComponent = (elm, hostRef, cmpMeta, instance, isInitialLoad) => {
1472
+ // updateComponent
1473
+ const endUpdate = createTime('update', cmpMeta.$tagName$);
1474
+ const rc = elm['s-rc'];
1475
+ if (BUILD.style && isInitialLoad) {
1476
+ // DOM WRITE!
1477
+ attachStyles(elm, cmpMeta, hostRef.$modeName$);
1478
+ }
1479
+ const endRender = createTime('render', cmpMeta.$tagName$);
1480
+ if (BUILD.isDev) {
1481
+ hostRef.$flags$ |= 1024 /* devOnRender */;
1482
+ }
1483
+ if (BUILD.hasRenderFn || BUILD.reflect) {
1484
+ if (BUILD.vdomRender || BUILD.reflect) {
1485
+ // looks like we've got child nodes to render into this host element
1486
+ // or we need to update the css class/attrs on the host element
1487
+ // DOM WRITE!
1488
+ renderVdom(elm, hostRef, cmpMeta, callRender(instance, elm));
1489
+ }
1490
+ else {
1491
+ elm.textContent = callRender(instance, elm);
1492
+ }
1493
+ }
1494
+ if (BUILD.cssVarShim && plt.$cssShim$) {
1495
+ plt.$cssShim$.updateHost(elm);
1496
+ }
1497
+ if (BUILD.isDev) {
1498
+ hostRef.$renderCount$++;
1499
+ hostRef.$flags$ &= ~1024 /* devOnRender */;
1500
+ }
1501
+ if (BUILD.updatable && BUILD.taskQueue) {
1502
+ hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1503
+ }
1504
+ if (BUILD.hydrateServerSide) {
1505
+ try {
1506
+ // manually connected child components during server-side hydrate
1507
+ serverSideConnected(elm);
1508
+ if (isInitialLoad) {
1509
+ // using only during server-side hydrate
1510
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1511
+ elm['s-en'] = '';
1512
+ }
1513
+ else if (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1514
+ elm['s-en'] = 'c';
1515
+ }
1516
+ }
1517
+ }
1518
+ catch (e) {
1519
+ consoleError(e);
1520
+ }
1521
+ }
1522
+ if (BUILD.updatable || BUILD.lazyLoad) {
1523
+ hostRef.$flags$ |= 2 /* hasRendered */;
1524
+ }
1525
+ if (BUILD.asyncLoading && rc) {
1526
+ // ok, so turns out there are some child host elements
1527
+ // waiting on this parent element to load
1528
+ // let's fire off all update callbacks waiting
1529
+ rc.forEach(cb => cb());
1530
+ elm['s-rc'] = undefined;
1531
+ }
1532
+ endRender();
1533
+ endUpdate();
1534
+ if (BUILD.asyncLoading) {
1535
+ const childrenPromises = elm['s-p'];
1536
+ const postUpdate = () => postUpdateComponent(elm, hostRef, cmpMeta);
1537
+ if (childrenPromises.length === 0) {
1538
+ postUpdate();
1539
+ }
1540
+ else {
1541
+ Promise.all(childrenPromises).then(postUpdate);
1542
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1543
+ childrenPromises.length = 0;
1544
+ }
1545
+ }
1546
+ else {
1547
+ postUpdateComponent(elm, hostRef, cmpMeta);
1548
+ }
1549
+ };
1550
+ const callRender = (instance, elm) => {
1551
+ try {
1552
+ renderingElement = elm;
1553
+ instance = (BUILD.allRenderFn) ? instance.render() : (instance.render && instance.render());
1554
+ }
1555
+ catch (e) {
1556
+ consoleError(e);
1557
+ }
1558
+ renderingElement = null;
1559
+ return instance;
1560
+ };
1561
+ const getRenderingElement = () => renderingElement;
1562
+ const postUpdateComponent = (elm, hostRef, cmpMeta) => {
1563
+ const endPostUpdate = createTime('postUpdate', cmpMeta.$tagName$);
1564
+ const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
1565
+ const ancestorComponent = hostRef.$ancestorComponent$;
1566
+ if (BUILD.cmpDidRender) {
1567
+ if (BUILD.isDev) {
1568
+ hostRef.$flags$ |= 1024 /* devOnRender */;
1569
+ }
1570
+ safeCall(instance, 'componentDidRender');
1571
+ if (BUILD.isDev) {
1572
+ hostRef.$flags$ &= ~1024 /* devOnRender */;
1573
+ }
1574
+ }
1575
+ emitLifecycleEvent(elm, 'componentDidRender');
1576
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1577
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1578
+ if (BUILD.asyncLoading && BUILD.cssAnnotations) {
1579
+ // DOM WRITE!
1580
+ addHydratedFlag(elm);
1581
+ }
1582
+ if (BUILD.cmpDidLoad) {
1583
+ if (BUILD.isDev) {
1584
+ hostRef.$flags$ |= 2048 /* devOnDidLoad */;
1585
+ }
1586
+ safeCall(instance, 'componentDidLoad');
1587
+ if (BUILD.isDev) {
1588
+ hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
1589
+ }
1590
+ }
1591
+ emitLifecycleEvent(elm, 'componentDidLoad');
1592
+ endPostUpdate();
1593
+ if (BUILD.asyncLoading) {
1594
+ hostRef.$onReadyResolve$(elm);
1595
+ if (!ancestorComponent) {
1596
+ appDidLoad(cmpMeta.$tagName$);
1597
+ }
1598
+ }
1599
+ }
1600
+ else {
1601
+ if (BUILD.cmpDidUpdate) {
1602
+ // we've already loaded this component
1603
+ // fire off the user's componentDidUpdate method (if one was provided)
1604
+ // componentDidUpdate runs AFTER render() has been called
1605
+ // and all child components have finished updating
1606
+ if (BUILD.isDev) {
1607
+ hostRef.$flags$ |= 1024 /* devOnRender */;
1608
+ }
1609
+ safeCall(instance, 'componentDidUpdate');
1610
+ if (BUILD.isDev) {
1611
+ hostRef.$flags$ &= ~1024 /* devOnRender */;
1612
+ }
1613
+ }
1614
+ emitLifecycleEvent(elm, 'componentDidUpdate');
1615
+ endPostUpdate();
1616
+ }
1617
+ if (BUILD.hotModuleReplacement) {
1618
+ elm['s-hmr-load'] && elm['s-hmr-load']();
1619
+ }
1620
+ if (BUILD.method && BUILD.lazyLoad) {
1621
+ hostRef.$onInstanceResolve$(elm);
1622
+ }
1623
+ // load events fire from bottom to top
1624
+ // the deepest elements load first then bubbles up
1625
+ if (BUILD.asyncLoading) {
1626
+ if (hostRef.$onRenderResolve$) {
1627
+ hostRef.$onRenderResolve$();
1628
+ hostRef.$onRenderResolve$ = undefined;
1629
+ }
1630
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
1631
+ nextTick(() => scheduleUpdate(elm, hostRef, cmpMeta, false));
1632
+ }
1633
+ hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1634
+ }
1635
+ // ( •_•)
1636
+ // ( •_•)>⌐■-■
1637
+ // (⌐■_■)
1638
+ };
1639
+ const forceUpdate = (elm, cmpMeta) => {
1640
+ if (BUILD.updatable) {
1641
+ const hostRef = getHostRef(elm);
1642
+ const isConnected = hostRef.$hostElement$.isConnected;
1643
+ if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1644
+ scheduleUpdate(elm, hostRef, cmpMeta, false);
1645
+ }
1646
+ // Returns "true" when the forced update was successfully scheduled
1647
+ return isConnected;
1648
+ }
1649
+ return false;
1650
+ };
1651
+ const appDidLoad = (who) => {
1652
+ // on appload
1653
+ // we have finish the first big initial render
1654
+ if (BUILD.cssAnnotations) {
1655
+ addHydratedFlag(doc.documentElement);
1656
+ }
1657
+ if (!BUILD.hydrateServerSide) {
1658
+ plt.$flags$ |= 2 /* appLoaded */;
1659
+ }
1660
+ emitLifecycleEvent(doc, 'appload');
1661
+ if (BUILD.profile) {
1662
+ performance.measure(`[Rindo] ${NAMESPACE} initial load (by ${who})`, 'st:app:start');
1663
+ }
1664
+ };
1665
+ const safeCall = (instance, method, arg) => {
1666
+ if (instance && instance[method]) {
1667
+ try {
1668
+ return instance[method](arg);
1669
+ }
1670
+ catch (e) {
1671
+ consoleError(e);
1672
+ }
1673
+ }
1674
+ return undefined;
1675
+ };
1676
+ const then = (promise, thenFn) => {
1677
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
1678
+ };
1679
+ const emitLifecycleEvent = (elm, lifecycleName) => {
1680
+ if (BUILD.lifecycleDOMEvents) {
1681
+ elm.dispatchEvent(new CustomEvent('rindo_' + lifecycleName, { 'bubbles': true, 'composed': true }));
1682
+ }
1683
+ };
1684
+ const addHydratedFlag = (elm) => BUILD.hydratedClass ?
1685
+ elm.classList.add('hydrated') :
1686
+ BUILD.hydratedAttribute ?
1687
+ elm.setAttribute('hydrated', '') :
1688
+ undefined;
1689
+ const serverSideConnected = (elm) => {
1690
+ const children = elm.children;
1691
+ if (children != null) {
1692
+ for (let i = 0, ii = children.length; i < ii; i++) {
1693
+ const childElm = children[i];
1694
+ if (typeof childElm.connectedCallback === 'function') {
1695
+ childElm.connectedCallback();
1696
+ }
1697
+ serverSideConnected(childElm);
1698
+ }
1699
+ }
1700
+ };
1701
+ const cloneNodeFix = (HostElementPrototype) => {
1702
+ const orgCloneNode = HostElementPrototype.cloneNode;
1703
+ HostElementPrototype.cloneNode = function (deep) {
1704
+ const srcNode = this;
1705
+ const isShadowDom = BUILD.shadowDom ? srcNode.shadowRoot && supportsShadowDom : false;
1706
+ const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
1707
+ if (BUILD.slot && !isShadowDom && deep) {
1708
+ let i = 0;
1709
+ let slotted, nonRindoNode;
1710
+ let rindoPrivates = ['s-id', 's-cr', 's-lr', 's-rc', 's-sc', 's-p', 's-cn', 's-sr', 's-sn', 's-hn', 's-ol', 's-nr', 's-si'];
1711
+ for (; i < srcNode.childNodes.length; i++) {
1712
+ slotted = srcNode.childNodes[i]['s-nr'];
1713
+ nonRindoNode = rindoPrivates.every((privateField) => !srcNode.childNodes[i][privateField]);
1714
+ if (slotted) {
1715
+ if (BUILD.appendChildSlotFix && clonedNode.__appendChild) {
1716
+ clonedNode.__appendChild(slotted.cloneNode(true));
1717
+ }
1718
+ else {
1719
+ clonedNode.appendChild(slotted.cloneNode(true));
1720
+ }
1721
+ }
1722
+ if (nonRindoNode) {
1723
+ clonedNode.appendChild(srcNode.childNodes[i].cloneNode(true));
1724
+ }
1725
+ }
1726
+ }
1727
+ return clonedNode;
1728
+ };
1729
+ };
1730
+ const appendChildSlotFix = (HostElementPrototype) => {
1731
+ HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
1732
+ HostElementPrototype.appendChild = function (newChild) {
1733
+ const slotName = newChild['s-sn'] = getSlotName(newChild);
1734
+ const slotNode = getHostSlotNode(this, slotName);
1735
+ if (slotNode) {
1736
+ const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
1737
+ const appendAfter = slotChildNodes[slotChildNodes.length - 1];
1738
+ return appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
1739
+ }
1740
+ return this.__appendChild(newChild);
1741
+ };
1742
+ };
1743
+ const getSlotName = (node) => (node['s-sn']) ||
1744
+ (node.nodeType === 1 && node.getAttribute('slot')) || '';
1745
+ const getHostSlotNode = (elm, slotName) => {
1746
+ let childNodes = elm.childNodes;
1747
+ let i = 0;
1748
+ let childNode;
1749
+ for (; i < childNodes.length; i++) {
1750
+ childNode = childNodes[i];
1751
+ if (childNode['s-sr'] && childNode['s-sn'] === slotName) {
1752
+ return childNode;
1753
+ }
1754
+ childNode = getHostSlotNode(childNode, slotName);
1755
+ if (childNode) {
1756
+ return childNode;
1757
+ }
1758
+ }
1759
+ return null;
1760
+ };
1761
+ const getHostSlotChildNodes = (n, slotName) => {
1762
+ const childNodes = [n];
1763
+ while ((n = n.nextSibling) && n['s-sn'] === slotName) {
1764
+ childNodes.push(n);
1765
+ }
1766
+ return childNodes;
1767
+ };
1768
+ const addEventListeners = (elm, hostRef, listeners) => {
1769
+ hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || [];
1770
+ const removeFns = listeners.map(([flags, name, method]) => {
1771
+ const target = (BUILD.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm);
1772
+ const handler = hostListenerProxy(hostRef, method);
1773
+ const opts = hostListenerOpts(flags);
1774
+ plt.ael(target, name, handler, opts);
1775
+ return () => plt.rel(target, name, handler, opts);
1776
+ });
1777
+ return () => removeFns.forEach(fn => fn());
1778
+ };
1779
+ const hostListenerProxy = (hostRef, methodName) => {
1780
+ return (ev) => {
1781
+ if (BUILD.lazyLoad) {
1782
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
1783
+ // instance is ready, let's call it's member method for this event
1784
+ hostRef.$lazyInstance$[methodName](ev);
1785
+ }
1786
+ else {
1787
+ hostRef.$queuedListeners$.push([methodName, ev]);
1788
+ }
1789
+ }
1790
+ else {
1791
+ hostRef.$hostElement$[methodName](ev);
1792
+ }
1793
+ };
1794
+ };
1795
+ const getHostListenerTarget = (elm, flags) => {
1796
+ if (BUILD.hostListenerTargetDocument && flags & 4 /* TargetDocument */)
1797
+ return doc;
1798
+ if (BUILD.hostListenerTargetWindow && flags & 8 /* TargetWindow */)
1799
+ return win;
1800
+ if (BUILD.hostListenerTargetBody && flags & 32 /* TargetBody */)
1801
+ return doc.body;
1802
+ if (BUILD.hostListenerTargetParent && flags & 16 /* TargetParent */)
1803
+ return elm.parentElement;
1804
+ return elm;
1805
+ };
1806
+ const hostListenerOpts = (flags) => supportsListenerOptions ?
1807
+ {
1808
+ 'passive': (flags & 1 /* Passive */) !== 0,
1809
+ 'capture': (flags & 2 /* Capture */) !== 0,
1810
+ }
1811
+ : (flags & 2 /* Capture */) !== 0;
1812
+ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1813
+ const endHydrate = createTime('hydrateClient', tagName);
1814
+ const shadowRoot = hostElm.shadowRoot;
1815
+ const childRenderNodes = [];
1816
+ const slotNodes = [];
1817
+ const shadowRootNodes = (BUILD.shadowDom && shadowRoot ? [] : null);
1818
+ const vnode = hostRef.$vnode$ = newVNode(tagName, null);
1819
+ if (!plt.$orgLocNodes$) {
1820
+ initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = new Map());
1821
+ }
1822
+ hostElm[HYDRATE_ID] = hostId;
1823
+ hostElm.removeAttribute(HYDRATE_ID);
1824
+ clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
1825
+ childRenderNodes.forEach(c => {
1826
+ const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
1827
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1828
+ const node = c.$elm$;
1829
+ if (orgLocationNode && (supportsShadowDom && orgLocationNode['s-en'] === '')) {
1830
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1831
+ }
1832
+ if (!shadowRoot) {
1833
+ node['s-hn'] = tagName;
1834
+ if (orgLocationNode) {
1835
+ node['s-ol'] = orgLocationNode;
1836
+ node['s-ol']['s-nr'] = node;
1837
+ }
1838
+ }
1839
+ plt.$orgLocNodes$.delete(orgLocationId);
1840
+ });
1841
+ if (BUILD.shadowDom && shadowRoot) {
1842
+ shadowRootNodes.forEach(shadowRootNode => {
1843
+ if (shadowRootNode) {
1844
+ shadowRoot.appendChild(shadowRootNode);
1845
+ }
1846
+ });
1847
+ }
1848
+ endHydrate();
1849
+ };
1850
+ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
1851
+ let childNodeType;
1852
+ let childIdSplt;
1853
+ let childVNode;
1854
+ let i;
1855
+ if (node.nodeType === 1 /* ElementNode */) {
1856
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
1857
+ if (childNodeType) {
1858
+ // got the node data from the element's attribute
1859
+ // `${hostId}.${nodeId}.${depth}.${index}`
1860
+ childIdSplt = childNodeType.split('.');
1861
+ if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
1862
+ childVNode = {
1863
+ $flags$: 0,
1864
+ $hostId$: childIdSplt[0],
1865
+ $nodeId$: childIdSplt[1],
1866
+ $depth$: childIdSplt[2],
1867
+ $index$: childIdSplt[3],
1868
+ $tag$: node.tagName.toLowerCase(),
1869
+ $elm$: node,
1870
+ $attrs$: null,
1871
+ $children$: null,
1872
+ $key$: null,
1873
+ $name$: null,
1874
+ $text$: null
1875
+ };
1876
+ childRenderNodes.push(childVNode);
1877
+ node.removeAttribute(HYDRATE_CHILD_ID);
1878
+ // this is a new child vnode
1879
+ // so ensure its parent vnode has the vchildren array
1880
+ if (!parentVNode.$children$) {
1881
+ parentVNode.$children$ = [];
1882
+ }
1883
+ // add our child vnode to a specific index of the vnode's children
1884
+ parentVNode.$children$[childVNode.$index$] = childVNode;
1885
+ // this is now the new parent vnode for all the next child checks
1886
+ parentVNode = childVNode;
1887
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
1888
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1889
+ }
1890
+ }
1891
+ }
1892
+ // recursively drill down, end to start so we can remove nodes
1893
+ for (i = node.childNodes.length - 1; i >= 0; i--) {
1894
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
1895
+ }
1896
+ if (node.shadowRoot) {
1897
+ // keep drilling down through the shadow root nodes
1898
+ for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
1899
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
1900
+ }
1901
+ }
1902
+ }
1903
+ else if (node.nodeType === 8 /* CommentNode */) {
1904
+ // `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
1905
+ childIdSplt = node.nodeValue.split('.');
1906
+ if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
1907
+ // comment node for either the host id or a 0 host id
1908
+ childNodeType = childIdSplt[0];
1909
+ childVNode = {
1910
+ $flags$: 0,
1911
+ $hostId$: childIdSplt[1],
1912
+ $nodeId$: childIdSplt[2],
1913
+ $depth$: childIdSplt[3],
1914
+ $index$: childIdSplt[4],
1915
+ $elm$: node,
1916
+ $attrs$: null,
1917
+ $children$: null,
1918
+ $key$: null,
1919
+ $name$: null,
1920
+ $tag$: null,
1921
+ $text$: null
1922
+ };
1923
+ if (childNodeType === TEXT_NODE_ID) {
1924
+ childVNode.$elm$ = node.nextSibling;
1925
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
1926
+ childVNode.$text$ = childVNode.$elm$.textContent;
1927
+ childRenderNodes.push(childVNode);
1928
+ // remove the text comment since it's no longer needed
1929
+ node.remove();
1930
+ if (!parentVNode.$children$) {
1931
+ parentVNode.$children$ = [];
1932
+ }
1933
+ parentVNode.$children$[childVNode.$index$] = childVNode;
1934
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
1935
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1936
+ }
1937
+ }
1938
+ }
1939
+ else if (childVNode.$hostId$ === hostId) {
1940
+ // this comment node is specifcally for this host id
1941
+ if (childNodeType === SLOT_NODE_ID) {
1942
+ // `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
1943
+ childVNode.$tag$ = 'slot';
1944
+ if (childIdSplt[5]) {
1945
+ node['s-sn'] = childVNode.$name$ = childIdSplt[5];
1946
+ }
1947
+ else {
1948
+ node['s-sn'] = '';
1949
+ }
1950
+ node['s-sr'] = true;
1951
+ if (BUILD.shadowDom && shadowRootNodes) {
1952
+ // browser support shadowRoot and this is a shadow dom component
1953
+ // create an actual slot element
1954
+ childVNode.$elm$ = doc.createElement(childVNode.$tag$);
1955
+ if (childVNode.$name$) {
1956
+ // add the slot name attribute
1957
+ childVNode.$elm$.setAttribute('name', childVNode.$name$);
1958
+ }
1959
+ // insert the new slot element before the slot comment
1960
+ node.parentNode.insertBefore(childVNode.$elm$, node);
1961
+ // remove the slot comment since it's not needed for shadow
1962
+ node.remove();
1963
+ if (childVNode.$depth$ === '0') {
1964
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1965
+ }
1966
+ }
1967
+ slotNodes.push(childVNode);
1968
+ if (!parentVNode.$children$) {
1969
+ parentVNode.$children$ = [];
1970
+ }
1971
+ parentVNode.$children$[childVNode.$index$] = childVNode;
1972
+ }
1973
+ else if (childNodeType === CONTENT_REF_ID) {
1974
+ // `${CONTENT_REF_ID}.${hostId}`;
1975
+ if (BUILD.shadowDom && shadowRootNodes) {
1976
+ // remove the content ref comment since it's not needed for shadow
1977
+ node.remove();
1978
+ }
1979
+ else if (BUILD.slotRelocation) {
1980
+ hostElm['s-cr'] = node;
1981
+ node['s-cn'] = true;
1982
+ }
1983
+ }
1984
+ }
1985
+ }
1986
+ }
1987
+ else if (parentVNode && parentVNode.$tag$ === 'style') {
1988
+ const vnode = newVNode(null, node.textContent);
1989
+ vnode.$elm$ = node;
1990
+ vnode.$index$ = '0';
1991
+ parentVNode.$children$ = [vnode];
1992
+ }
1993
+ };
1994
+ const initializeDocumentHydrate = (node, orgLocNodes) => {
1995
+ if (node.nodeType === 1 /* ElementNode */) {
1996
+ let i = 0;
1997
+ for (; i < node.childNodes.length; i++) {
1998
+ initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
1999
+ }
2000
+ if (node.shadowRoot) {
2001
+ for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
2002
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
2003
+ }
2004
+ }
2005
+ }
2006
+ else if (node.nodeType === 8 /* CommentNode */) {
2007
+ const childIdSplt = node.nodeValue.split('.');
2008
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
2009
+ orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
2010
+ node.nodeValue = '';
2011
+ // useful to know if the original location is
2012
+ // the root light-dom of a shadow dom component
2013
+ node['s-en'] = childIdSplt[3];
2014
+ }
2015
+ }
2016
+ };
2017
+ const parsePropertyValue = (propValue, propType) => {
2018
+ // ensure this value is of the correct prop type
2019
+ if (propValue != null && !isComplexType(propValue)) {
2020
+ if (BUILD.propBoolean && propType & 4 /* Boolean */) {
2021
+ // per the HTML spec, any string value means it is a boolean true value
2022
+ // but we'll cheat here and say that the string "false" is the boolean false
2023
+ return (propValue === 'false' ? false : propValue === '' || !!propValue);
2024
+ }
2025
+ if (BUILD.propNumber && propType & 2 /* Number */) {
2026
+ // force it to be a number
2027
+ return parseFloat(propValue);
2028
+ }
2029
+ if (BUILD.propString && propType & 1 /* String */) {
2030
+ // could have been passed as a number or boolean
2031
+ // but we still want it as a string
2032
+ return String(propValue);
2033
+ }
2034
+ // redundant return here for better minification
2035
+ return propValue;
2036
+ }
2037
+ // not sure exactly what type we want
2038
+ // so no need to change to a different type
2039
+ return propValue;
2040
+ };
2041
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
2042
+ const setValue = (ref, propName, newVal, cmpMeta) => {
2043
+ // check our new property value against our internal value
2044
+ const hostRef = getHostRef(ref);
2045
+ const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
2046
+ const oldVal = hostRef.$instanceValues$.get(propName);
2047
+ const flags = hostRef.$flags$;
2048
+ const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2049
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
2050
+ if (newVal !== oldVal && (!BUILD.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === undefined)) {
2051
+ // gadzooks! the property's value has changed!!
2052
+ // set our new value!
2053
+ hostRef.$instanceValues$.set(propName, newVal);
2054
+ if (BUILD.isDev) {
2055
+ if (hostRef.$flags$ & 1024 /* devOnRender */) {
2056
+ consoleDevWarn(`The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`, '\nElement', elm, '\nNew value', newVal, '\nOld value', oldVal);
2057
+ }
2058
+ else if (hostRef.$flags$ & 2048 /* devOnDidLoad */) {
2059
+ consoleDevWarn(`The state/prop "${propName}" changed during "componentDidLoad()", this triggers extra re-renders, try to setup on "componentWillLoad()"`, '\nElement', elm, '\nNew value', newVal, '\nOld value', oldVal);
2060
+ }
2061
+ }
2062
+ if (!BUILD.lazyLoad || instance) {
2063
+ // get an array of method names of watch functions to call
2064
+ if (BUILD.watchCallback && cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
2065
+ const watchMethods = cmpMeta.$watchers$[propName];
2066
+ if (watchMethods) {
2067
+ // this instance is watching for when this property changed
2068
+ watchMethods.forEach(watchMethodName => {
2069
+ try {
2070
+ // fire off each of the watch methods that are watching this property
2071
+ instance[watchMethodName](newVal, oldVal, propName);
2072
+ }
2073
+ catch (e) {
2074
+ consoleError(e);
2075
+ }
2076
+ });
2077
+ }
2078
+ }
2079
+ if (BUILD.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
2080
+ if (BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
2081
+ if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
2082
+ return;
2083
+ }
2084
+ }
2085
+ // looks like this value actually changed, so we've got work to do!
2086
+ // but only if we've already rendered, otherwise just chill out
2087
+ // queue that we need to do an update, but don't worry about queuing
2088
+ // up millions cuz this function ensures it only runs once
2089
+ scheduleUpdate(elm, hostRef, cmpMeta, false);
2090
+ }
2091
+ }
2092
+ }
2093
+ };
2094
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
2095
+ if (BUILD.member && cmpMeta.$members$) {
2096
+ if (BUILD.watchCallback && Cstr.watchers) {
2097
+ cmpMeta.$watchers$ = Cstr.watchers;
2098
+ }
2099
+ // It's better to have a const than two Object.entries()
2100
+ const members = Object.entries(cmpMeta.$members$);
2101
+ const prototype = Cstr.prototype;
2102
+ members.forEach(([memberName, [memberFlags]]) => {
2103
+ if ((BUILD.prop || BUILD.state) && ((memberFlags & 31 /* Prop */) ||
2104
+ ((!BUILD.lazyLoad || flags & 2 /* proxyState */) &&
2105
+ (memberFlags & 32 /* State */)))) {
2106
+ // proxyComponent - prop
2107
+ Object.defineProperty(prototype, memberName, {
2108
+ get() {
2109
+ // proxyComponent, get value
2110
+ return getValue(this, memberName);
2111
+ },
2112
+ set(newValue) {
2113
+ if (
2114
+ // only during dev time
2115
+ (BUILD.isDev) &&
2116
+ // we are proxing the instance (not element)
2117
+ (flags & 1 /* isElementConstructor */) === 0 &&
2118
+ // the member is a non-mutable prop
2119
+ (memberFlags & (31 /* Prop */ | 1024 /* Mutable */)) === 31 /* Prop */) {
2120
+ consoleDevWarn(`@Prop() "${memberName}" on "${cmpMeta.$tagName$}" cannot be modified.\nFurther information: https://rindojs.web.app/docs/properties#prop-mutability`);
2121
+ }
2122
+ // proxyComponent, set value
2123
+ setValue(this, memberName, newValue, cmpMeta);
2124
+ },
2125
+ configurable: true,
2126
+ enumerable: true
2127
+ });
2128
+ }
2129
+ else if (BUILD.lazyLoad && BUILD.method && (flags & 1 /* isElementConstructor */) && (memberFlags & 64 /* Method */)) {
2130
+ // proxyComponent - method
2131
+ Object.defineProperty(prototype, memberName, {
2132
+ value(...args) {
2133
+ const ref = getHostRef(this);
2134
+ return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
2135
+ }
2136
+ });
2137
+ }
2138
+ });
2139
+ if (BUILD.observeAttribute && (!BUILD.lazyLoad || flags & 1 /* isElementConstructor */)) {
2140
+ const attrNameToPropName = new Map();
2141
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
2142
+ plt.jmp(() => {
2143
+ const propName = attrNameToPropName.get(attrName);
2144
+ this[propName] = newValue === null && typeof this[propName] === 'boolean'
2145
+ ? false
2146
+ : newValue;
2147
+ });
2148
+ };
2149
+ // create an array of attributes to observe
2150
+ // and also create a map of html attribute name to js property name
2151
+ Cstr.observedAttributes = members
2152
+ .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
2153
+ .map(([propName, m]) => {
2154
+ const attrName = m[1] || propName;
2155
+ attrNameToPropName.set(attrName, propName);
2156
+ if (BUILD.reflect && m[0] & 512 /* ReflectAttr */) {
2157
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
2158
+ }
2159
+ return attrName;
2160
+ });
2161
+ }
2162
+ }
2163
+ return Cstr;
2164
+ };
2165
+ const modeResolutionChain = [];
2166
+ const computeMode = (elm) => modeResolutionChain.map(h => h(elm)).find(m => !!m);
2167
+ // Public
2168
+ const setMode = (handler) => modeResolutionChain.push(handler);
2169
+ const getMode = (ref) => getHostRef(ref).$modeName$;
2170
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
2171
+ // initializeComponent
2172
+ if ((BUILD.lazyLoad || BUILD.style) && (hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
2173
+ // we haven't initialized this element yet
2174
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
2175
+ if (BUILD.mode && hostRef.$modeName$ == null) {
2176
+ // initializeComponent
2177
+ // looks like mode wasn't set as a property directly yet
2178
+ // first check if there's an attribute
2179
+ // next check the app's global
2180
+ hostRef.$modeName$ = typeof cmpMeta.$lazyBundleIds$ !== 'string' ? computeMode(elm) : '';
2181
+ }
2182
+ if (BUILD.hydrateServerSide && hostRef.$modeName$) {
2183
+ elm.setAttribute('s-mode', hostRef.$modeName$);
2184
+ }
2185
+ if (BUILD.lazyLoad) {
2186
+ // lazy loaded components
2187
+ // request the component's implementation to be
2188
+ // wired up with the host element
2189
+ Cstr = loadModule(cmpMeta, hostRef, hmrVersionId);
2190
+ if (Cstr.then) {
2191
+ // Await creates a micro-task avoid if possible
2192
+ const endLoad = uniqueTime(`st:load:${cmpMeta.$tagName$}:${hostRef.$modeName$}`, `[Rindo] Load module for <${cmpMeta.$tagName$}>`);
2193
+ Cstr = await Cstr;
2194
+ endLoad();
2195
+ }
2196
+ if ((BUILD.isDev || BUILD.isDebug) && !Cstr) {
2197
+ throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
2198
+ }
2199
+ if (BUILD.member && !Cstr.isProxied) {
2200
+ // we'eve never proxied this Constructor before
2201
+ // let's add the getters/setters to its prototype before
2202
+ // the first time we create an instance of the implementation
2203
+ if (BUILD.watchCallback) {
2204
+ cmpMeta.$watchers$ = Cstr.watchers;
2205
+ }
2206
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
2207
+ Cstr.isProxied = true;
2208
+ }
2209
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
2210
+ // ok, time to construct the instance
2211
+ // but let's keep track of when we start and stop
2212
+ // so that the getters/setters don't incorrectly step on data
2213
+ if (BUILD.member) {
2214
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
2215
+ }
2216
+ // construct the lazy-loaded component implementation
2217
+ // passing the hostRef is very important during
2218
+ // construction in order to directly wire together the
2219
+ // host element and the lazy-loaded instance
2220
+ try {
2221
+ new Cstr(hostRef);
2222
+ }
2223
+ catch (e) {
2224
+ consoleError(e);
2225
+ }
2226
+ if (BUILD.member) {
2227
+ hostRef.$flags$ &= ~8 /* isConstructingInstance */;
2228
+ }
2229
+ if (BUILD.watchCallback) {
2230
+ hostRef.$flags$ |= 128 /* isWatchReady */;
2231
+ }
2232
+ endNewInstance();
2233
+ fireConnectedCallback(hostRef.$lazyInstance$);
2234
+ }
2235
+ else {
2236
+ Cstr = elm.constructor;
2237
+ }
2238
+ const scopeId = BUILD.mode ? getScopeId(cmpMeta.$tagName$, hostRef.$modeName$) : getScopeId(cmpMeta.$tagName$);
2239
+ if (BUILD.style && !styles.has(scopeId) && Cstr.style) {
2240
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
2241
+ // this component has styles but we haven't registered them yet
2242
+ let style = Cstr.style;
2243
+ if (BUILD.mode && typeof style !== 'string') {
2244
+ style = style[hostRef.$modeName$];
2245
+ }
2246
+ if (!BUILD.hydrateServerSide && BUILD.shadowDom && BUILD.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
2247
+ style = await import('./shadow-css-6ef31c68.js').then(m => m.scopeCss(style, scopeId, false));
2248
+ }
2249
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
2250
+ endRegisterStyles();
2251
+ }
2252
+ }
2253
+ // we've successfully created a lazy instance
2254
+ const ancestorComponent = hostRef.$ancestorComponent$;
2255
+ const schedule = () => scheduleUpdate(elm, hostRef, cmpMeta, true);
2256
+ if (BUILD.asyncLoading && ancestorComponent && ancestorComponent['s-rc']) {
2257
+ // this is the intial load and this component it has an ancestor component
2258
+ // but the ancestor component has NOT fired its will update lifecycle yet
2259
+ // so let's just cool our jets and wait for the ancestor to continue first
2260
+ // this will get fired off when the ancestor component
2261
+ // finally gets around to rendering its lazy self
2262
+ // fire off the initial update
2263
+ ancestorComponent['s-rc'].push(schedule);
2264
+ }
2265
+ else {
2266
+ schedule();
2267
+ }
2268
+ };
2269
+ const fireConnectedCallback = (instance) => {
2270
+ if (BUILD.lazyLoad && BUILD.connectedCallback) {
2271
+ safeCall(instance, 'connectedCallback');
2272
+ }
2273
+ };
2274
+ const connectedCallback = (elm, cmpMeta) => {
2275
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
2276
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
2277
+ // connectedCallback
2278
+ const hostRef = getHostRef(elm);
2279
+ if (BUILD.hostListener && cmpMeta.$listeners$) {
2280
+ // initialize our event listeners on the host element
2281
+ // we do this now so that we can listening to events that may
2282
+ // have fired even before the instance is ready
2283
+ hostRef.$rmListeners$ = addEventListeners(elm, hostRef, cmpMeta.$listeners$);
2284
+ }
2285
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
2286
+ // first time this component has connected
2287
+ hostRef.$flags$ |= 1 /* hasConnected */;
2288
+ let hostId;
2289
+ if (BUILD.hydrateClientSide) {
2290
+ hostId = elm.getAttribute(HYDRATE_ID);
2291
+ if (hostId) {
2292
+ if (BUILD.shadowDom && supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2293
+ const scopeId = BUILD.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute('s-mode')) : addStyle(elm.shadowRoot, cmpMeta);
2294
+ elm.classList.remove(scopeId + '-h', scopeId + '-s');
2295
+ }
2296
+ initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
2297
+ }
2298
+ }
2299
+ if (BUILD.slotRelocation && !hostId) {
2300
+ // initUpdate
2301
+ // if the slot polyfill is required we'll need to put some nodes
2302
+ // in here to act as original content anchors as we move nodes around
2303
+ // host element has been connected to the DOM
2304
+ if ((BUILD.hydrateServerSide) ||
2305
+ (BUILD.slot && cmpMeta.$flags$ & 4 /* hasSlotRelocation */) ||
2306
+ (BUILD.shadowDom && cmpMeta.$flags$ & 8 /* needsShadowDomShim */)) {
2307
+ setContentReference(elm);
2308
+ }
2309
+ }
2310
+ if (BUILD.asyncLoading) {
2311
+ // find the first ancestor component (if there is one) and register
2312
+ // this component as one of the actively loading child components for its ancestor
2313
+ let ancestorComponent = elm;
2314
+ while ((ancestorComponent = (ancestorComponent.parentNode || ancestorComponent.host))) {
2315
+ // climb up the ancestors looking for the first
2316
+ // component that hasn't finished its lifecycle update yet
2317
+ if ((BUILD.hydrateClientSide && ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute('s-id')) ||
2318
+ (ancestorComponent['s-p'])) {
2319
+ // we found this components first ancestor component
2320
+ // keep a reference to this component's ancestor component
2321
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
2322
+ break;
2323
+ }
2324
+ }
2325
+ }
2326
+ // Lazy properties
2327
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
2328
+ if (BUILD.prop && BUILD.lazyLoad && !BUILD.hydrateServerSide && cmpMeta.$members$) {
2329
+ Object.entries(cmpMeta.$members$).forEach(([memberName, [memberFlags]]) => {
2330
+ if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
2331
+ const value = elm[memberName];
2332
+ delete elm[memberName];
2333
+ elm[memberName] = value;
2334
+ }
2335
+ });
2336
+ }
2337
+ if (BUILD.initializeNextTick) {
2338
+ // connectedCallback, taskQueue, initialLoad
2339
+ // angular sets attribute AFTER connectCallback
2340
+ // https://github.com/angular/angular/issues/18909
2341
+ // https://github.com/angular/angular/issues/19940
2342
+ nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
2343
+ }
2344
+ else {
2345
+ initializeComponent(elm, hostRef, cmpMeta);
2346
+ }
2347
+ }
2348
+ fireConnectedCallback(hostRef.$lazyInstance$);
2349
+ endConnected();
2350
+ }
2351
+ };
2352
+ const setContentReference = (elm) => {
2353
+ // only required when we're NOT using native shadow dom (slot)
2354
+ // or this browser doesn't support native shadow dom
2355
+ // and this host element was NOT created with SSR
2356
+ // let's pick out the inner content for slot projection
2357
+ // create a node to represent where the original
2358
+ // content was first placed, which is useful later on
2359
+ const contentRefElm = elm['s-cr'] = doc.createComment(BUILD.isDebug
2360
+ ? `content-ref (host=${elm.localName})`
2361
+ : '');
2362
+ contentRefElm['s-cn'] = true;
2363
+ elm.insertBefore(contentRefElm, elm.firstChild);
2364
+ };
2365
+ const disconnectedCallback = (elm) => {
2366
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
2367
+ const hostRef = getHostRef(elm);
2368
+ const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2369
+ if (BUILD.hostListener) {
2370
+ if (hostRef.$rmListeners$) {
2371
+ hostRef.$rmListeners$();
2372
+ hostRef.$rmListeners$ = undefined;
2373
+ }
2374
+ }
2375
+ // clear CSS var-shim tracking
2376
+ if (BUILD.cssVarShim && plt.$cssShim$) {
2377
+ plt.$cssShim$.removeHost(elm);
2378
+ }
2379
+ if (BUILD.lazyLoad && BUILD.disconnectedCallback) {
2380
+ safeCall(instance, 'disconnectedCallback');
2381
+ }
2382
+ if (BUILD.cmpDidUnload) {
2383
+ safeCall(instance, 'componentDidUnload');
2384
+ }
2385
+ }
2386
+ };
2387
+ function hmrStart(elm, cmpMeta, hmrVersionId) {
2388
+ // ¯\_(ツ)_/¯
2389
+ const hostRef = getHostRef(elm);
2390
+ // reset state flags to only have been connected
2391
+ hostRef.$flags$ = 1 /* hasConnected */;
2392
+ // TODO
2393
+ // detatch any event listeners that may have been added
2394
+ // because we're not passing an exact event name it'll
2395
+ // remove all of this element's event, which is good
2396
+ // create a callback for when this component finishes hmr
2397
+ elm['s-hmr-load'] = () => {
2398
+ // finished hmr for this element
2399
+ delete elm['s-hmr-load'];
2400
+ };
2401
+ // re-initialize the component
2402
+ initializeComponent(elm, hostRef, cmpMeta, hmrVersionId);
2403
+ }
2404
+ const bootstrapLazy = (lazyBundles, options = {}) => {
2405
+ if (BUILD.profile) {
2406
+ performance.mark('st:app:start');
2407
+ }
2408
+ installDevTools();
2409
+ const endBootstrap = createTime('bootstrapLazy');
2410
+ const cmpTags = [];
2411
+ const exclude = options.exclude || [];
2412
+ const customElements = win.customElements;
2413
+ const head = doc.head;
2414
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
2415
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
2416
+ const deferredConnectedCallbacks = [];
2417
+ const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2418
+ let appLoadFallback;
2419
+ let isBootstrapping = true;
2420
+ let i = 0;
2421
+ Object.assign(plt, options);
2422
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
2423
+ if (options.syncQueue) {
2424
+ plt.$flags$ |= 4 /* queueSync */;
2425
+ }
2426
+ if (BUILD.hydrateClientSide) {
2427
+ // If the app is already hydrated there is not point to disable the
2428
+ // async queue. This will improve the first input delay
2429
+ plt.$flags$ |= 2 /* appLoaded */;
2430
+ }
2431
+ if (BUILD.hydrateClientSide && BUILD.shadowDom) {
2432
+ for (; i < styles.length; i++) {
2433
+ registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
2434
+ }
2435
+ }
2436
+ lazyBundles.forEach(lazyBundle => lazyBundle[1].forEach(compactMeta => {
2437
+ const cmpMeta = {
2438
+ $flags$: compactMeta[0],
2439
+ $tagName$: compactMeta[1],
2440
+ $members$: compactMeta[2],
2441
+ $listeners$: compactMeta[3],
2442
+ };
2443
+ if (BUILD.member) {
2444
+ cmpMeta.$members$ = compactMeta[2];
2445
+ }
2446
+ if (BUILD.hostListener) {
2447
+ cmpMeta.$listeners$ = compactMeta[3];
2448
+ }
2449
+ if (BUILD.reflect) {
2450
+ cmpMeta.$attrsToReflect$ = [];
2451
+ }
2452
+ if (BUILD.watchCallback) {
2453
+ cmpMeta.$watchers$ = {};
2454
+ }
2455
+ if (BUILD.shadowDom && !supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2456
+ cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
2457
+ }
2458
+ const tagName = cmpMeta.$tagName$;
2459
+ const HostElement = class extends HTMLElement {
2460
+ // RindoLazyHost
2461
+ constructor(self) {
2462
+ // @ts-ignore
2463
+ super(self);
2464
+ self = this;
2465
+ registerHost(self);
2466
+ if (BUILD.shadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2467
+ // this component is using shadow dom
2468
+ // and this browser supports shadow dom
2469
+ // add the read-only property "shadowRoot" to the host element
2470
+ // adding the shadow root build conditionals to minimize runtime
2471
+ if (supportsShadowDom) {
2472
+ if (BUILD.shadowDelegatesFocus) {
2473
+ self.attachShadow({
2474
+ mode: 'open',
2475
+ delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */),
2476
+ });
2477
+ }
2478
+ else {
2479
+ self.attachShadow({ mode: 'open' });
2480
+ }
2481
+ }
2482
+ else if (!BUILD.hydrateServerSide && !('shadowRoot' in self)) {
2483
+ self.shadowRoot = self;
2484
+ }
2485
+ }
2486
+ }
2487
+ connectedCallback() {
2488
+ if (appLoadFallback) {
2489
+ clearTimeout(appLoadFallback);
2490
+ appLoadFallback = null;
2491
+ }
2492
+ if (isBootstrapping) {
2493
+ // connectedCallback will be processed once all components have been registered
2494
+ deferredConnectedCallbacks.push(this);
2495
+ }
2496
+ else {
2497
+ plt.jmp(() => connectedCallback(this, cmpMeta));
2498
+ }
2499
+ }
2500
+ disconnectedCallback() {
2501
+ plt.jmp(() => disconnectedCallback(this));
2502
+ }
2503
+ forceUpdate() {
2504
+ forceUpdate(this, cmpMeta);
2505
+ }
2506
+ componentOnReady() {
2507
+ return getHostRef(this).$onReadyPromise$;
2508
+ }
2509
+ };
2510
+ if (BUILD.cloneNodeFix) {
2511
+ cloneNodeFix(HostElement.prototype);
2512
+ }
2513
+ if (BUILD.appendChildSlotFix) {
2514
+ appendChildSlotFix(HostElement.prototype);
2515
+ }
2516
+ if (BUILD.hotModuleReplacement) {
2517
+ HostElement.prototype['s-hmr'] = function (hmrVersionId) {
2518
+ hmrStart(this, cmpMeta, hmrVersionId);
2519
+ };
2520
+ }
2521
+ cmpMeta.$lazyBundleIds$ = lazyBundle[0];
2522
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
2523
+ cmpTags.push(tagName);
2524
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
2525
+ }
2526
+ }));
2527
+ if (BUILD.hydratedClass || BUILD.hydratedAttribute) {
2528
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
2529
+ visibilityStyle.setAttribute('data-styles', '');
2530
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
2531
+ }
2532
+ // Process deferred connectedCallbacks now all components have been registered
2533
+ isBootstrapping = false;
2534
+ if (deferredConnectedCallbacks.length > 0) {
2535
+ deferredConnectedCallbacks.forEach(host => host.connectedCallback());
2536
+ }
2537
+ else {
2538
+ if (BUILD.profile) {
2539
+ plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30, 'timeout'));
2540
+ }
2541
+ else {
2542
+ plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30));
2543
+ }
2544
+ }
2545
+ // Fallback appLoad event
2546
+ endBootstrap();
2547
+ };
2548
+ const defineCustomElement = (Cstr, compactMeta) => {
2549
+ customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
2550
+ };
2551
+ const proxyCustomElement = (Cstr, compactMeta) => {
2552
+ const cmpMeta = {
2553
+ $flags$: compactMeta[0],
2554
+ $tagName$: compactMeta[1],
2555
+ };
2556
+ if (BUILD.member) {
2557
+ cmpMeta.$members$ = compactMeta[2];
2558
+ }
2559
+ if (BUILD.hostListener) {
2560
+ cmpMeta.$listeners$ = compactMeta[3];
2561
+ }
2562
+ if (BUILD.watchCallback) {
2563
+ cmpMeta.$watchers$ = Cstr.$watchers$;
2564
+ }
2565
+ if (BUILD.reflect) {
2566
+ cmpMeta.$attrsToReflect$ = [];
2567
+ }
2568
+ if (BUILD.shadowDom && !supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2569
+ cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
2570
+ }
2571
+ Object.assign(Cstr.prototype, {
2572
+ forceUpdate() {
2573
+ forceUpdate(this, cmpMeta);
2574
+ },
2575
+ connectedCallback() {
2576
+ connectedCallback(this, cmpMeta);
2577
+ },
2578
+ disconnectedCallback() {
2579
+ disconnectedCallback(this);
2580
+ }
2581
+ });
2582
+ return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
2583
+ };
2584
+ const attachShadow = (el) => {
2585
+ if (supportsShadowDom) {
2586
+ el.attachShadow({ mode: 'open' });
2587
+ }
2588
+ else {
2589
+ el.shadowRoot = el;
2590
+ }
2591
+ };
2592
+ const proxyNative = (Cstr, compactMeta) => {
2593
+ const cmpMeta = {
2594
+ $flags$: compactMeta[0],
2595
+ $tagName$: compactMeta[1],
2596
+ $members$: compactMeta[2],
2597
+ $listeners$: compactMeta[3],
2598
+ $watchers$: Cstr.$watchers$
2599
+ };
2600
+ if (BUILD.reflect) {
2601
+ cmpMeta.$attrsToReflect$ = [];
2602
+ }
2603
+ if (BUILD.shadowDom && !supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2604
+ cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
2605
+ }
2606
+ Object.assign(Cstr.prototype, {
2607
+ forceUpdate() {
2608
+ forceUpdate(this, cmpMeta);
2609
+ },
2610
+ connectedCallback() {
2611
+ connectedCallback(this, cmpMeta);
2612
+ },
2613
+ disconnectedCallback() {
2614
+ disconnectedCallback(this);
2615
+ }
2616
+ });
2617
+ return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
2618
+ };
2619
+ const createEvent = (ref, name, flags) => {
2620
+ const elm = getElement(ref);
2621
+ return {
2622
+ emit: (detail) => {
2623
+ if (BUILD.isDev && !elm.isConnected) {
2624
+ consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
2625
+ }
2626
+ const ev = new (BUILD.hydrateServerSide ? win.CustomEvent : CustomEvent)(name, {
2627
+ bubbles: !!(flags & 4 /* Bubbles */),
2628
+ composed: !!(flags & 2 /* Composed */),
2629
+ cancelable: !!(flags & 1 /* Cancellable */),
2630
+ detail
2631
+ });
2632
+ elm.dispatchEvent(ev);
2633
+ return ev;
2634
+ }
2635
+ };
2636
+ };
2637
+ const getAssetPath = (path) => {
2638
+ const assetUrl = new URL(path, plt.$resourcesUrl$);
2639
+ return (assetUrl.origin !== win.location.origin)
2640
+ ? assetUrl.href
2641
+ : assetUrl.pathname;
2642
+ };
2643
+ const getConnect = (_ref, tagName) => {
2644
+ const componentOnReady = () => {
2645
+ let elm = doc.querySelector(tagName);
2646
+ if (!elm) {
2647
+ elm = doc.createElement(tagName);
2648
+ doc.body.appendChild(elm);
2649
+ }
2650
+ return typeof elm.componentOnReady === 'function' ? elm.componentOnReady() : Promise.resolve(elm);
2651
+ };
2652
+ const create = (...args) => {
2653
+ return componentOnReady()
2654
+ .then(el => el.create(...args));
2655
+ };
2656
+ return {
2657
+ create,
2658
+ componentOnReady,
2659
+ };
2660
+ };
2661
+ const getContext = (_elm, context) => {
2662
+ if (context in Context) {
2663
+ return Context[context];
2664
+ }
2665
+ else if (context === 'window') {
2666
+ return win;
2667
+ }
2668
+ else if (context === 'document') {
2669
+ return doc;
2670
+ }
2671
+ else if (context === 'isServer' || context === 'isPrerender') {
2672
+ return BUILD.hydrateServerSide ? true : false;
2673
+ }
2674
+ else if (context === 'isClient') {
2675
+ return BUILD.hydrateServerSide ? false : true;
2676
+ }
2677
+ else if (context === 'resourcesUrl' || context === 'publicPath') {
2678
+ return getAssetPath('.');
2679
+ }
2680
+ else if (context === 'queue') {
2681
+ return {
2682
+ write: writeTask,
2683
+ read: readTask,
2684
+ tick: {
2685
+ then(cb) {
2686
+ return nextTick(cb);
2687
+ }
2688
+ }
2689
+ };
2690
+ }
2691
+ return undefined;
2692
+ };
2693
+ const getElement = (ref) => BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2694
+ const insertVdomAnnotations = (doc) => {
2695
+ if (doc != null) {
2696
+ const docData = {
2697
+ hostIds: 0,
2698
+ rootLevelIds: 0
2699
+ };
2700
+ const orgLocationNodes = [];
2701
+ parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
2702
+ orgLocationNodes.forEach(orgLocationNode => {
2703
+ if (orgLocationNode != null) {
2704
+ const nodeRef = orgLocationNode['s-nr'];
2705
+ let hostId = nodeRef['s-host-id'];
2706
+ let nodeId = nodeRef['s-node-id'];
2707
+ let childId = `${hostId}.${nodeId}`;
2708
+ if (hostId == null) {
2709
+ hostId = 0;
2710
+ docData.rootLevelIds++;
2711
+ nodeId = docData.rootLevelIds;
2712
+ childId = `${hostId}.${nodeId}`;
2713
+ if (nodeRef.nodeType === 1 /* ElementNode */) {
2714
+ nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
2715
+ }
2716
+ else if (nodeRef.nodeType === 3 /* TextNode */) {
2717
+ if (hostId === 0) {
2718
+ const textContent = nodeRef.nodeValue.trim();
2719
+ if (textContent === '') {
2720
+ // useless whitespace node at the document root
2721
+ orgLocationNode.remove();
2722
+ return;
2723
+ }
2724
+ }
2725
+ const commentBeforeTextNode = doc.createComment(childId);
2726
+ commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
2727
+ nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
2728
+ }
2729
+ }
2730
+ let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
2731
+ const orgLocationParentNode = orgLocationNode.parentElement;
2732
+ if (orgLocationParentNode) {
2733
+ if (orgLocationParentNode['s-en'] === '') {
2734
+ // ending with a "." means that the parent element
2735
+ // of this node's original location is a SHADOW dom element
2736
+ // and this node is apart of the root level light dom
2737
+ orgLocationNodeId += `.`;
2738
+ }
2739
+ else if (orgLocationParentNode['s-en'] === 'c') {
2740
+ // ending with a ".c" means that the parent element
2741
+ // of this node's original location is a SCOPED element
2742
+ // and this node is apart of the root level light dom
2743
+ orgLocationNodeId += `.c`;
2744
+ }
2745
+ }
2746
+ orgLocationNode.nodeValue = orgLocationNodeId;
2747
+ }
2748
+ });
2749
+ }
2750
+ };
2751
+ const parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
2752
+ if (node == null) {
2753
+ return;
2754
+ }
2755
+ if (node['s-nr'] != null) {
2756
+ orgLocationNodes.push(node);
2757
+ }
2758
+ if (node.nodeType === 1 /* ElementNode */) {
2759
+ node.childNodes.forEach(childNode => {
2760
+ const hostRef = getHostRef(childNode);
2761
+ if (hostRef != null) {
2762
+ const cmpData = {
2763
+ nodeIds: 0
2764
+ };
2765
+ insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
2766
+ }
2767
+ parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
2768
+ });
2769
+ }
2770
+ };
2771
+ const insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
2772
+ if (vnode != null) {
2773
+ const hostId = ++docData.hostIds;
2774
+ hostElm.setAttribute(HYDRATE_ID, hostId);
2775
+ if (hostElm['s-cr'] != null) {
2776
+ hostElm['s-cr'].nodeValue = `${CONTENT_REF_ID}.${hostId}`;
2777
+ }
2778
+ if (vnode.$children$ != null) {
2779
+ const depth = 0;
2780
+ vnode.$children$.forEach((vnodeChild, index) => {
2781
+ insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
2782
+ });
2783
+ }
2784
+ }
2785
+ };
2786
+ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
2787
+ const childElm = vnodeChild.$elm$;
2788
+ if (childElm == null) {
2789
+ return;
2790
+ }
2791
+ const nodeId = cmpData.nodeIds++;
2792
+ const childId = `${hostId}.${nodeId}.${depth}.${index}`;
2793
+ childElm['s-host-id'] = hostId;
2794
+ childElm['s-node-id'] = nodeId;
2795
+ if (childElm.nodeType === 1 /* ElementNode */) {
2796
+ childElm.setAttribute(HYDRATE_CHILD_ID, childId);
2797
+ }
2798
+ else if (childElm.nodeType === 3 /* TextNode */) {
2799
+ const parentNode = childElm.parentNode;
2800
+ if (parentNode.nodeName !== 'STYLE') {
2801
+ const textNodeId = `${TEXT_NODE_ID}.${childId}`;
2802
+ const commentBeforeTextNode = doc.createComment(textNodeId);
2803
+ parentNode.insertBefore(commentBeforeTextNode, childElm);
2804
+ }
2805
+ }
2806
+ else if (childElm.nodeType === 8 /* CommentNode */) {
2807
+ if (childElm['s-sr']) {
2808
+ const slotName = (childElm['s-sn'] || '');
2809
+ const slotNodeId = `${SLOT_NODE_ID}.${childId}.${slotName}`;
2810
+ childElm.nodeValue = slotNodeId;
2811
+ }
2812
+ }
2813
+ if (vnodeChild.$children$ != null) {
2814
+ const childDepth = depth + 1;
2815
+ vnodeChild.$children$.forEach((vnode, index) => {
2816
+ insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, index);
2817
+ });
2818
+ }
2819
+ };
2820
+ export { Build, CSS, Context, H, H as HTMLElement, Host, RINDO_DEV_MODE, attachShadow, bootstrapLazy, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, doc, forceUpdate, getAssetPath, getConnect, getContext, getElement, getHostRef, getMode, getRenderingElement, getValue, h, insertVdomAnnotations, isMemberInElement, loadModule, moduleCache, nextTick, parsePropertyValue, patchBrowser, patchCloneNodeFix, patchDynamicImport, patchEsm, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, proxyNative, readTask, registerHost, registerInstance, renderVdom, setMode, setValue, styles, supportsConstructibleStylesheets, supportsListenerOptions, supportsShadowDom, win, writeTask };