@nanoporetech-digital/components 3.8.0 → 3.8.2

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 (234) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/{algolia-data-f495daf4.js → algolia-data-fb13160a.js} +2 -2
  3. package/dist/cjs/{algolia-data-f495daf4.js.map → algolia-data-fb13160a.js.map} +1 -1
  4. package/dist/cjs/{component-store-d2fdaecf.js → component-store-b80bdb26.js} +2 -2
  5. package/dist/cjs/{component-store-d2fdaecf.js.map → component-store-b80bdb26.js.map} +1 -1
  6. package/dist/cjs/{form-control-c24fbff3.js → form-control-845951ac.js} +2 -2
  7. package/dist/cjs/{form-control-c24fbff3.js.map → form-control-845951ac.js.map} +1 -1
  8. package/dist/cjs/{index-361e5114.js → index-5e11be36.js} +2 -2
  9. package/dist/cjs/{index-361e5114.js.map → index-5e11be36.js.map} +1 -1
  10. package/dist/cjs/{index-5c437a69.js → index-e1b5c3ea.js} +9 -7
  11. package/dist/cjs/index-e1b5c3ea.js.map +1 -0
  12. package/dist/cjs/loader.cjs.js +2 -2
  13. package/dist/cjs/loader.cjs.js.map +1 -1
  14. package/dist/cjs/nano-accordion.cjs.entry.js +1 -1
  15. package/dist/cjs/nano-alert.cjs.entry.js +1 -1
  16. package/dist/cjs/nano-algolia-filter.cjs.entry.js +3 -3
  17. package/dist/cjs/nano-algolia-input.cjs.entry.js +3 -3
  18. package/dist/cjs/nano-algolia-pagination.cjs.entry.js +2 -2
  19. package/dist/cjs/nano-algolia-results.cjs.entry.js +2 -2
  20. package/dist/cjs/nano-algolia.cjs.entry.js +3 -3
  21. package/dist/cjs/nano-aspect-ratio.cjs.entry.js +1 -1
  22. package/dist/cjs/nano-checkbox-group.cjs.entry.js +1 -1
  23. package/dist/cjs/nano-checkbox.cjs.entry.js +1 -1
  24. package/dist/cjs/nano-components.cjs.js +2 -2
  25. package/dist/cjs/nano-components.cjs.js.map +1 -1
  26. package/dist/cjs/nano-datalist_3.cjs.entry.js +1 -1
  27. package/dist/cjs/nano-date-input.cjs.entry.js +1 -1
  28. package/dist/cjs/nano-date-picker.cjs.entry.js +1 -1
  29. package/dist/cjs/nano-demo.cjs.entry.js +1 -1
  30. package/dist/cjs/nano-details.cjs.entry.js +1 -1
  31. package/dist/cjs/nano-dialog.cjs.entry.js +2 -2
  32. package/dist/cjs/nano-drawer.cjs.entry.js +1 -1
  33. package/dist/cjs/nano-dropdown.cjs.entry.js +1 -1
  34. package/dist/cjs/nano-field-validator.cjs.entry.js +2 -2
  35. package/dist/cjs/nano-file-upload.cjs.entry.js +1 -1
  36. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +2 -2
  37. package/dist/cjs/nano-global-nav.cjs.entry.js +2 -2
  38. package/dist/cjs/nano-global-search-results.cjs.entry.js +1 -1
  39. package/dist/cjs/nano-grid_3.cjs.entry.js +1 -1
  40. package/dist/cjs/nano-hero.cjs.entry.js +1 -1
  41. package/dist/cjs/nano-icon-button.cjs.entry.js +1 -1
  42. package/dist/cjs/nano-icon.cjs.entry.js +1 -1
  43. package/dist/cjs/nano-input.cjs.entry.js +2 -2
  44. package/dist/cjs/nano-menu-drawer.cjs.entry.js +1 -1
  45. package/dist/cjs/nano-progress-bar_2.cjs.entry.js +1 -1
  46. package/dist/cjs/nano-range.cjs.entry.js +1 -1
  47. package/dist/cjs/nano-rating.cjs.entry.js +1 -1
  48. package/dist/cjs/nano-resize-observe_2.cjs.entry.js +1 -1
  49. package/dist/cjs/nano-slide.cjs.entry.js +1 -1
  50. package/dist/cjs/nano-slides.cjs.entry.js +1 -1
  51. package/dist/cjs/nano-spinner.cjs.entry.js +1 -1
  52. package/dist/cjs/nano-split-pane.cjs.entry.js +1 -1
  53. package/dist/cjs/nano-sticker.cjs.entry.js +1 -1
  54. package/dist/cjs/nano-tab-content.cjs.entry.js +1 -1
  55. package/dist/cjs/nano-tab-group.cjs.entry.js +2 -2
  56. package/dist/cjs/nano-tab.cjs.entry.js +1 -1
  57. package/dist/cjs/{nano-table-860b9714.js → nano-table-cdc653d2.js} +4 -4
  58. package/dist/cjs/{nano-table-860b9714.js.map → nano-table-cdc653d2.js.map} +1 -1
  59. package/dist/cjs/nano-table.cjs.entry.js +3 -3
  60. package/dist/cjs/{table.worker-88f2cb15.js → table.worker-6a90641f.js} +4 -4
  61. package/dist/cjs/table.worker-6a90641f.js.map +1 -0
  62. package/dist/collection/collection-manifest.json +1 -1
  63. package/dist/esm/{algolia-data-213ed40c.js → algolia-data-c4ed188c.js} +2 -2
  64. package/dist/esm/{algolia-data-213ed40c.js.map → algolia-data-c4ed188c.js.map} +1 -1
  65. package/dist/esm/{component-store-df8af0e6.js → component-store-6eccd724.js} +2 -2
  66. package/dist/esm/{component-store-df8af0e6.js.map → component-store-6eccd724.js.map} +1 -1
  67. package/dist/esm/{form-control-445de741.js → form-control-3284c2c9.js} +2 -2
  68. package/dist/esm/{form-control-445de741.js.map → form-control-3284c2c9.js.map} +1 -1
  69. package/dist/esm/{index-d1b02919.js → index-38484737.js} +2 -2
  70. package/dist/esm/{index-d1b02919.js.map → index-38484737.js.map} +1 -1
  71. package/dist/esm/{index-44c85cc8.js → index-b4e277ad.js} +9 -7
  72. package/dist/esm/index-b4e277ad.js.map +1 -0
  73. package/dist/esm/loader.js +3 -3
  74. package/dist/esm/loader.js.map +1 -1
  75. package/dist/esm/nano-accordion.entry.js +1 -1
  76. package/dist/esm/nano-alert.entry.js +1 -1
  77. package/dist/esm/nano-algolia-filter.entry.js +3 -3
  78. package/dist/esm/nano-algolia-input.entry.js +3 -3
  79. package/dist/esm/nano-algolia-pagination.entry.js +2 -2
  80. package/dist/esm/nano-algolia-results.entry.js +2 -2
  81. package/dist/esm/nano-algolia.entry.js +3 -3
  82. package/dist/esm/nano-aspect-ratio.entry.js +1 -1
  83. package/dist/esm/nano-checkbox-group.entry.js +1 -1
  84. package/dist/esm/nano-checkbox.entry.js +1 -1
  85. package/dist/esm/nano-components.js +3 -3
  86. package/dist/esm/nano-components.js.map +1 -1
  87. package/dist/esm/nano-datalist_3.entry.js +1 -1
  88. package/dist/esm/nano-date-input.entry.js +1 -1
  89. package/dist/esm/nano-date-picker.entry.js +1 -1
  90. package/dist/esm/nano-demo.entry.js +1 -1
  91. package/dist/esm/nano-details.entry.js +1 -1
  92. package/dist/esm/nano-dialog.entry.js +2 -2
  93. package/dist/esm/nano-drawer.entry.js +1 -1
  94. package/dist/esm/nano-dropdown.entry.js +1 -1
  95. package/dist/esm/nano-field-validator.entry.js +2 -2
  96. package/dist/esm/nano-file-upload.entry.js +1 -1
  97. package/dist/esm/nano-global-nav-user-profile_3.entry.js +2 -2
  98. package/dist/esm/nano-global-nav.entry.js +2 -2
  99. package/dist/esm/nano-global-search-results.entry.js +1 -1
  100. package/dist/esm/nano-grid_3.entry.js +1 -1
  101. package/dist/esm/nano-hero.entry.js +1 -1
  102. package/dist/esm/nano-icon-button.entry.js +1 -1
  103. package/dist/esm/nano-icon.entry.js +1 -1
  104. package/dist/esm/nano-input.entry.js +2 -2
  105. package/dist/esm/nano-menu-drawer.entry.js +1 -1
  106. package/dist/esm/nano-progress-bar_2.entry.js +1 -1
  107. package/dist/esm/nano-range.entry.js +1 -1
  108. package/dist/esm/nano-rating.entry.js +1 -1
  109. package/dist/esm/nano-resize-observe_2.entry.js +1 -1
  110. package/dist/esm/nano-slide.entry.js +1 -1
  111. package/dist/esm/nano-slides.entry.js +1 -1
  112. package/dist/esm/nano-spinner.entry.js +1 -1
  113. package/dist/esm/nano-split-pane.entry.js +1 -1
  114. package/dist/esm/nano-sticker.entry.js +1 -1
  115. package/dist/esm/nano-tab-content.entry.js +1 -1
  116. package/dist/esm/nano-tab-group.entry.js +2 -2
  117. package/dist/esm/nano-tab.entry.js +1 -1
  118. package/dist/esm/{nano-table-331a0cad.js → nano-table-8c177e25.js} +4 -4
  119. package/dist/esm/{nano-table-331a0cad.js.map → nano-table-8c177e25.js.map} +1 -1
  120. package/dist/esm/nano-table.entry.js +3 -3
  121. package/dist/esm/{table.worker-682e581f.js → table.worker-1afa571a.js} +4 -4
  122. package/dist/esm/table.worker-1afa571a.js.map +1 -0
  123. package/dist/nano-components/nano-components.esm.js +1 -1
  124. package/dist/nano-components/nano-components.esm.js.map +1 -1
  125. package/dist/nano-components/{p-362d6a04.entry.js → p-0411f019.entry.js} +2 -2
  126. package/dist/nano-components/{p-362d6a04.entry.js.map → p-0411f019.entry.js.map} +0 -0
  127. package/dist/nano-components/{p-dc785fb7.entry.js → p-13b2d70c.entry.js} +2 -2
  128. package/dist/nano-components/{p-dc785fb7.entry.js.map → p-13b2d70c.entry.js.map} +0 -0
  129. package/dist/nano-components/{p-0eaa9a08.entry.js → p-1d21b2ce.entry.js} +2 -2
  130. package/dist/nano-components/{p-0eaa9a08.entry.js.map → p-1d21b2ce.entry.js.map} +0 -0
  131. package/dist/nano-components/{p-de72a35c.entry.js → p-264903b5.entry.js} +2 -2
  132. package/dist/nano-components/{p-de72a35c.entry.js.map → p-264903b5.entry.js.map} +0 -0
  133. package/dist/nano-components/{p-d49c5b2b.entry.js → p-320366a2.entry.js} +2 -2
  134. package/dist/nano-components/{p-d49c5b2b.entry.js.map → p-320366a2.entry.js.map} +0 -0
  135. package/dist/nano-components/{p-41f33a56.entry.js → p-364434b4.entry.js} +2 -2
  136. package/dist/nano-components/{p-41f33a56.entry.js.map → p-364434b4.entry.js.map} +0 -0
  137. package/dist/nano-components/{p-bd1ff3a4.entry.js → p-36d5a41d.entry.js} +2 -2
  138. package/dist/nano-components/{p-bd1ff3a4.entry.js.map → p-36d5a41d.entry.js.map} +0 -0
  139. package/dist/nano-components/{p-2113cc09.entry.js → p-371fe61d.entry.js} +2 -2
  140. package/dist/nano-components/{p-2113cc09.entry.js.map → p-371fe61d.entry.js.map} +0 -0
  141. package/dist/nano-components/{p-1416c06b.entry.js → p-3d658ce2.entry.js} +2 -2
  142. package/dist/nano-components/{p-1416c06b.entry.js.map → p-3d658ce2.entry.js.map} +0 -0
  143. package/dist/nano-components/{p-0f7c19fc.entry.js → p-400d698f.entry.js} +2 -2
  144. package/dist/nano-components/{p-0f7c19fc.entry.js.map → p-400d698f.entry.js.map} +0 -0
  145. package/dist/nano-components/{p-014872f7.entry.js → p-4b1d73e9.entry.js} +2 -2
  146. package/dist/nano-components/{p-014872f7.entry.js.map → p-4b1d73e9.entry.js.map} +0 -0
  147. package/dist/nano-components/{p-08c3ffaf.entry.js → p-4e104cb1.entry.js} +2 -2
  148. package/dist/nano-components/{p-08c3ffaf.entry.js.map → p-4e104cb1.entry.js.map} +0 -0
  149. package/dist/nano-components/{p-12beee2b.entry.js → p-5a466c9f.entry.js} +2 -2
  150. package/dist/nano-components/{p-12beee2b.entry.js.map → p-5a466c9f.entry.js.map} +0 -0
  151. package/dist/nano-components/{p-01c1f47a.entry.js → p-5f1b94f0.entry.js} +2 -2
  152. package/dist/nano-components/{p-01c1f47a.entry.js.map → p-5f1b94f0.entry.js.map} +0 -0
  153. package/dist/nano-components/p-601bd262.js +5 -0
  154. package/dist/nano-components/{p-1d0194af.entry.js.map → p-601bd262.js.map} +0 -0
  155. package/dist/nano-components/{p-6a2c2a7c.entry.js → p-60823325.entry.js} +2 -2
  156. package/dist/nano-components/{p-6a2c2a7c.entry.js.map → p-60823325.entry.js.map} +0 -0
  157. package/dist/nano-components/{p-91f23170.entry.js → p-6760e54a.entry.js} +2 -2
  158. package/dist/nano-components/{p-91f23170.entry.js.map → p-6760e54a.entry.js.map} +0 -0
  159. package/dist/nano-components/{p-73fc0adc.entry.js → p-69774e99.entry.js} +2 -2
  160. package/dist/nano-components/{p-73fc0adc.entry.js.map → p-69774e99.entry.js.map} +0 -0
  161. package/dist/nano-components/{p-ae2ce39b.entry.js → p-6bca2d00.entry.js} +2 -2
  162. package/dist/nano-components/{p-ae2ce39b.entry.js.map → p-6bca2d00.entry.js.map} +0 -0
  163. package/dist/nano-components/{p-71e545fe.entry.js → p-78169835.entry.js} +2 -2
  164. package/dist/nano-components/{p-71e545fe.entry.js.map → p-78169835.entry.js.map} +0 -0
  165. package/dist/nano-components/{p-f6d105c2.entry.js → p-817eda34.entry.js} +2 -2
  166. package/dist/nano-components/{p-f6d105c2.entry.js.map → p-817eda34.entry.js.map} +0 -0
  167. package/dist/nano-components/{p-4db34382.entry.js → p-866c73c0.entry.js} +2 -2
  168. package/dist/nano-components/{p-4db34382.entry.js.map → p-866c73c0.entry.js.map} +0 -0
  169. package/dist/nano-components/{p-e460753c.entry.js → p-87a76a81.entry.js} +2 -2
  170. package/dist/nano-components/{p-e460753c.entry.js.map → p-87a76a81.entry.js.map} +0 -0
  171. package/dist/nano-components/{p-4b12ba50.entry.js → p-8907dd24.entry.js} +2 -2
  172. package/dist/nano-components/{p-4b12ba50.entry.js.map → p-8907dd24.entry.js.map} +0 -0
  173. package/dist/nano-components/{p-9c57b61b.entry.js → p-90365d7b.entry.js} +2 -2
  174. package/dist/nano-components/{p-9c57b61b.entry.js.map → p-90365d7b.entry.js.map} +0 -0
  175. package/dist/nano-components/{p-7c23e950.js → p-909a424c.js} +2 -2
  176. package/dist/nano-components/{p-7c23e950.js.map → p-909a424c.js.map} +0 -0
  177. package/dist/nano-components/{p-a8db13db.entry.js → p-9cf5fda3.entry.js} +2 -2
  178. package/dist/nano-components/{p-a8db13db.entry.js.map → p-9cf5fda3.entry.js.map} +0 -0
  179. package/dist/nano-components/{p-14b7f2c7.entry.js → p-9fcd383f.entry.js} +2 -2
  180. package/dist/nano-components/{p-14b7f2c7.entry.js.map → p-9fcd383f.entry.js.map} +0 -0
  181. package/dist/nano-components/{p-61e22cad.entry.js → p-9fda481b.entry.js} +2 -2
  182. package/dist/nano-components/{p-61e22cad.entry.js.map → p-9fda481b.entry.js.map} +0 -0
  183. package/dist/nano-components/{p-b11c89f6.entry.js → p-abd6b774.entry.js} +2 -2
  184. package/dist/nano-components/{p-b11c89f6.entry.js.map → p-abd6b774.entry.js.map} +0 -0
  185. package/dist/nano-components/{p-67195231.js → p-bb6f7c39.js} +2 -2
  186. package/dist/nano-components/{p-67195231.js.map → p-bb6f7c39.js.map} +0 -0
  187. package/dist/nano-components/p-bf91c50e.js +6 -0
  188. package/dist/nano-components/p-bf91c50e.js.map +1 -0
  189. package/dist/nano-components/{p-34df2f17.entry.js → p-bfbfec85.entry.js} +2 -2
  190. package/dist/nano-components/{p-34df2f17.entry.js.map → p-bfbfec85.entry.js.map} +0 -0
  191. package/dist/nano-components/{p-63811de1.entry.js → p-c0681b2b.entry.js} +2 -2
  192. package/dist/nano-components/{p-63811de1.entry.js.map → p-c0681b2b.entry.js.map} +0 -0
  193. package/dist/nano-components/{p-cf0ce679.entry.js → p-c0ca353b.entry.js} +2 -2
  194. package/dist/nano-components/{p-cf0ce679.entry.js.map → p-c0ca353b.entry.js.map} +0 -0
  195. package/dist/nano-components/{p-578cc92e.entry.js → p-c4e8d584.entry.js} +2 -2
  196. package/dist/nano-components/{p-578cc92e.entry.js.map → p-c4e8d584.entry.js.map} +0 -0
  197. package/dist/nano-components/p-cfaa6cab.entry.js +5 -0
  198. package/dist/nano-components/{p-b8abd6a1.js.map → p-cfaa6cab.entry.js.map} +0 -0
  199. package/dist/nano-components/{p-0c3a5c44.entry.js → p-d753f35a.entry.js} +2 -2
  200. package/dist/nano-components/{p-0c3a5c44.entry.js.map → p-d753f35a.entry.js.map} +0 -0
  201. package/dist/nano-components/{p-8e39d4ee.js → p-d7ff8f12.js} +2 -2
  202. package/dist/nano-components/{p-8e39d4ee.js.map → p-d7ff8f12.js.map} +0 -0
  203. package/dist/nano-components/{p-f9d45db1.entry.js → p-de25ba80.entry.js} +2 -2
  204. package/dist/nano-components/{p-f9d45db1.entry.js.map → p-de25ba80.entry.js.map} +0 -0
  205. package/dist/nano-components/{p-70e718fe.entry.js → p-e19d6a92.entry.js} +2 -2
  206. package/dist/nano-components/{p-70e718fe.entry.js.map → p-e19d6a92.entry.js.map} +0 -0
  207. package/dist/nano-components/p-ed2e6f32.js +5 -0
  208. package/dist/nano-components/{p-5ec7263c.js.map → p-ed2e6f32.js.map} +0 -0
  209. package/dist/nano-components/{p-533db8ad.entry.js → p-ed69b27b.entry.js} +2 -2
  210. package/dist/nano-components/{p-533db8ad.entry.js.map → p-ed69b27b.entry.js.map} +0 -0
  211. package/dist/nano-components/{p-c12042c7.entry.js → p-f2875bf0.entry.js} +2 -2
  212. package/dist/nano-components/{p-c12042c7.entry.js.map → p-f2875bf0.entry.js.map} +0 -0
  213. package/dist/nano-components/{p-80e42c89.entry.js → p-f28c802d.entry.js} +2 -2
  214. package/dist/nano-components/{p-80e42c89.entry.js.map → p-f28c802d.entry.js.map} +0 -0
  215. package/dist/nano-components/{p-4971a1f1.entry.js → p-f47776fd.entry.js} +2 -2
  216. package/dist/nano-components/{p-4971a1f1.entry.js.map → p-f47776fd.entry.js.map} +0 -0
  217. package/dist/nano-components/{p-8a4f6a46.js → p-f6497e5a.js} +2 -2
  218. package/dist/nano-components/{p-8a4f6a46.js.map → p-f6497e5a.js.map} +0 -0
  219. package/dist/nano-components/{p-28874fdc.entry.js → p-fccd59e4.entry.js} +2 -2
  220. package/dist/nano-components/{p-28874fdc.entry.js.map → p-fccd59e4.entry.js.map} +0 -0
  221. package/dist/nano-components/{p-38268f3c.entry.js → p-fe1446cd.entry.js} +2 -2
  222. package/dist/nano-components/{p-38268f3c.entry.js.map → p-fe1446cd.entry.js.map} +0 -0
  223. package/docs-json.json +2 -2
  224. package/hydrate/index.js +5 -4
  225. package/package.json +4 -4
  226. package/dist/cjs/index-5c437a69.js.map +0 -1
  227. package/dist/cjs/table.worker-88f2cb15.js.map +0 -1
  228. package/dist/esm/index-44c85cc8.js.map +0 -1
  229. package/dist/esm/table.worker-682e581f.js.map +0 -1
  230. package/dist/nano-components/p-1d0194af.entry.js +0 -5
  231. package/dist/nano-components/p-5ec7263c.js +0 -5
  232. package/dist/nano-components/p-b8abd6a1.js +0 -5
  233. package/dist/nano-components/p-f84612d4.js +0 -6
  234. package/dist/nano-components/p-f84612d4.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import{r as t,c as i,h as s,a as n,g as h}from"./p-f84612d4.js";import{c as e,a as r}from"./p-69a3e911.js";var a=e((function(t){(function(i,s){if(t.exports){t.exports=s()}else{i.EvEmitter=s()}})(typeof window!="undefined"?window:r,(function(){function t(){}var i=t.prototype;i.on=function(t,i){if(!t||!i){return}var s=this._events=this._events||{};var n=s[t]=s[t]||[];if(n.indexOf(i)==-1){n.push(i)}return this};i.once=function(t,i){if(!t||!i){return}this.on(t,i);var s=this._onceEvents=this._onceEvents||{};var n=s[t]=s[t]||{};n[i]=true;return this};i.off=function(t,i){var s=this._events&&this._events[t];if(!s||!s.length){return}var n=s.indexOf(i);if(n!=-1){s.splice(n,1)}return this};i.emitEvent=function(t,i){var s=this._events&&this._events[t];if(!s||!s.length){return}s=s.slice(0);i=i||[];var n=this._onceEvents&&this._onceEvents[t];for(var h=0;h<s.length;h++){var e=s[h];var r=n&&n[e];if(r){this.off(t,e);delete n[e]}e.apply(this,i)}return this};i.allOff=function(){delete this._events;delete this._onceEvents};return t}))}));var o=e((function(t){
4
+ import{r as t,c as i,h as s,a as n,g as h}from"./p-bf91c50e.js";import{c as e,a as r}from"./p-69a3e911.js";var a=e((function(t){(function(i,s){if(t.exports){t.exports=s()}else{i.EvEmitter=s()}})(typeof window!="undefined"?window:r,(function(){function t(){}var i=t.prototype;i.on=function(t,i){if(!t||!i){return}var s=this._events=this._events||{};var n=s[t]=s[t]||[];if(n.indexOf(i)==-1){n.push(i)}return this};i.once=function(t,i){if(!t||!i){return}this.on(t,i);var s=this._onceEvents=this._onceEvents||{};var n=s[t]=s[t]||{};n[i]=true;return this};i.off=function(t,i){var s=this._events&&this._events[t];if(!s||!s.length){return}var n=s.indexOf(i);if(n!=-1){s.splice(n,1)}return this};i.emitEvent=function(t,i){var s=this._events&&this._events[t];if(!s||!s.length){return}s=s.slice(0);i=i||[];var n=this._onceEvents&&this._onceEvents[t];for(var h=0;h<s.length;h++){var e=s[h];var r=n&&n[e];if(r){this.off(t,e);delete n[e]}e.apply(this,i)}return this};i.allOff=function(){delete this._events;delete this._onceEvents};return t}))}));var o=e((function(t){
5
5
  /*!
6
6
  * getSize v2.0.3
7
7
  * measure size of elements
@@ -20,4 +20,4 @@ import{r as t,c as i,h as s,a as n,g as h}from"./p-f84612d4.js";import{c as e,a
20
20
  * MIT license
21
21
  */
22
22
  (function(i,s){if(t.exports){t.exports=s(i,M)}else{i.Unidragger=s(i,i.Unipointer)}})(window,(function t(i,s){function n(){}var h=n.prototype=Object.create(s.prototype);h.bindHandles=function(){this._bindHandles(true)};h.unbindHandles=function(){this._bindHandles(false)};h._bindHandles=function(t){t=t===undefined?true:t;var s=t?"addEventListener":"removeEventListener";var n=t?this._touchActionValue:"";for(var h=0;h<this.handles.length;h++){var e=this.handles[h];this._bindStartEvent(e,t);e[s]("click",this);if(i.PointerEvent){e.style.touchAction=n}}};h._touchActionValue="none";h.pointerDown=function(t,i){var s=this.okayPointerDown(t);if(!s){return}this.pointerDownPointer={pageX:i.pageX,pageY:i.pageY};t.preventDefault();this.pointerDownBlur();this._bindPostStartEvents(t);this.emitEvent("pointerDown",[t,i])};var e={TEXTAREA:true,INPUT:true,SELECT:true,OPTION:true};var r={radio:true,checkbox:true,button:true,submit:true,image:true,file:true};h.okayPointerDown=function(t){var i=e[t.target.nodeName];var s=r[t.target.type];var n=!i||s;if(!n){this._pointerReset()}return n};h.pointerDownBlur=function(){var t=document.activeElement;var i=t&&t.blur&&t!=document.body;if(i){t.blur()}};h.pointerMove=function(t,i){var s=this._dragPointerMove(t,i);this.emitEvent("pointerMove",[t,i,s]);this._dragMove(t,i,s)};h._dragPointerMove=function(t,i){var s={x:i.pageX-this.pointerDownPointer.pageX,y:i.pageY-this.pointerDownPointer.pageY};if(!this.isDragging&&this.hasDragStarted(s)){this._dragStart(t,i)}return s};h.hasDragStarted=function(t){return Math.abs(t.x)>3||Math.abs(t.y)>3};h.pointerUp=function(t,i){this.emitEvent("pointerUp",[t,i]);this._dragPointerUp(t,i)};h._dragPointerUp=function(t,i){if(this.isDragging){this._dragEnd(t,i)}else{this._staticClick(t,i)}};h._dragStart=function(t,i){this.isDragging=true;this.isPreventingClicks=true;this.dragStart(t,i)};h.dragStart=function(t,i){this.emitEvent("dragStart",[t,i])};h._dragMove=function(t,i,s){if(!this.isDragging){return}this.dragMove(t,i,s)};h.dragMove=function(t,i,s){t.preventDefault();this.emitEvent("dragMove",[t,i,s])};h._dragEnd=function(t,i){this.isDragging=false;setTimeout(function(){delete this.isPreventingClicks}.bind(this));this.dragEnd(t,i)};h.dragEnd=function(t,i){this.emitEvent("dragEnd",[t,i])};h.onclick=function(t){if(this.isPreventingClicks){t.preventDefault()}};h._staticClick=function(t,i){if(this.isIgnoringMouseUp&&t.type=="mouseup"){return}this.staticClick(t,i);if(t.type!="mouseup"){this.isIgnoringMouseUp=true;setTimeout(function(){delete this.isIgnoringMouseUp}.bind(this),400)}};h.staticClick=function(t,i){this.emitEvent("staticClick",[t,i])};n.getPointerPoint=s.getPointerPoint;return n}))}));u.extend(m.defaults,{draggable:">1",dragThreshold:3});m.createMethods.push("_createDrag");var S=m.prototype;u.extend(S,C.prototype);S._touchActionValue="pan-y";var L="createTouch"in document;var T=false;S._createDrag=function(){this.on("activate",this.onActivateDrag);this.on("uiChange",this._uiChangeDrag);this.on("deactivate",this.onDeactivateDrag);this.on("cellChange",this.updateDraggable);if(L&&!T){window.addEventListener("touchmove",(function(){}));T=true}};S.onActivateDrag=function(){this.handles=[this.viewport];this.bindHandles();this.updateDraggable()};S.onDeactivateDrag=function(){this.unbindHandles();this.element.classList.remove("is-draggable")};S.updateDraggable=function(){if(this.options.draggable==">1"){this.isDraggable=this.slides.length>1}else{this.isDraggable=this.options.draggable}if(this.isDraggable){this.element.classList.add("is-draggable")}else{this.element.classList.remove("is-draggable")}};S.bindDrag=function(){this.options.draggable=true;this.updateDraggable()};S.unbindDrag=function(){this.options.draggable=false;this.updateDraggable()};S._uiChangeDrag=function(){delete this.isFreeScrolling};S.pointerDown=function(t,i){if(!this.isDraggable){this._pointerDownDefault(t,i);return}var s=this.okayPointerDown(t);if(!s){return}this._pointerDownPreventDefault(t);this.pointerDownFocus(t);if(document.activeElement!=this.element){this.pointerDownBlur()}this.dragX=this.x;this.viewport.classList.add("is-pointer-down");this.pointerDownScroll=E();window.addEventListener("scroll",this);this._pointerDownDefault(t,i)};S._pointerDownDefault=function(t,i){this.pointerDownPointer={pageX:i.pageX,pageY:i.pageY};this._bindPostStartEvents(t);this.dispatchEvent("pointerDown",t,[i])};var P={INPUT:true,TEXTAREA:true,SELECT:true};S.pointerDownFocus=function(t){var i=P[t.target.nodeName];if(!i){this.focus()}};S._pointerDownPreventDefault=function(t){var i=t.type=="touchstart";var s=t.pointerType=="touch";var n=P[t.target.nodeName];if(!i&&!s&&!n){t.preventDefault()}};S.hasDragStarted=function(t){return Math.abs(t.x)>this.options.dragThreshold};S.pointerUp=function(t,i){delete this.isTouchScrolling;this.viewport.classList.remove("is-pointer-down");this.dispatchEvent("pointerUp",t,[i]);this._dragPointerUp(t,i)};S.pointerDone=function(){window.removeEventListener("scroll",this);delete this.pointerDownScroll};S.dragStart=function(t,i){if(!this.isDraggable){return}this.dragStartPosition=this.x;this.startAnimation();window.removeEventListener("scroll",this);this.dispatchEvent("dragStart",t,[i])};S.pointerMove=function(t,i){var s=this._dragPointerMove(t,i);this.dispatchEvent("pointerMove",t,[i,s]);this._dragMove(t,i,s)};S.dragMove=function(t,i,s){if(!this.isDraggable){return}t.preventDefault();this.previousDragX=this.dragX;var n=this.options.rightToLeft?-1:1;if(this.options.wrapAround){s.x=s.x%this.slideableWidth}var h=this.dragStartPosition+s.x*n;if(!this.options.wrapAround&&this.slides.length){var e=Math.max(-this.slides[0].target,this.dragStartPosition);h=h>e?(h+e)*.5:h;var r=Math.min(-this.getLastSlide().target,this.dragStartPosition);h=h<r?(h+r)*.5:h}this.dragX=h;this.dragMoveTime=new Date;this.dispatchEvent("dragMove",t,[i,s])};S.dragEnd=function(t,i){if(!this.isDraggable){return}if(this.options.freeScroll){this.isFreeScrolling=true}var s=this.dragEndRestingSelect();if(this.options.freeScroll&&!this.options.wrapAround){var n=this.getRestingPosition();this.isFreeScrolling=-n>this.slides[0].target&&-n<this.getLastSlide().target}else if(!this.options.freeScroll&&s==this.selectedIndex){s+=this.dragEndBoostSelect()}delete this.previousDragX;this.isDragSelect=this.options.wrapAround;this.select(s);delete this.isDragSelect;this.dispatchEvent("dragEnd",t,[i])};S.dragEndRestingSelect=function(){var t=this.getRestingPosition();var i=Math.abs(this.getSlideDistance(-t,this.selectedIndex));var s=this._getClosestResting(t,i,1);var n=this._getClosestResting(t,i,-1);var h=s.distance<n.distance?s.index:n.index;return h};S._getClosestResting=function(t,i,s){var n=this.selectedIndex;var h=Infinity;var e=this.options.contain&&!this.options.wrapAround?function(t,i){return t<=i}:function(t,i){return t<i};while(e(i,h)){n+=s;h=i;i=this.getSlideDistance(-t,n);if(i===null){break}i=Math.abs(i)}return{distance:h,index:n-s}};S.getSlideDistance=function(t,i){var s=this.slides.length;var n=this.options.wrapAround&&s>1;var h=n?u.modulo(i,s):i;var e=this.slides[h];if(!e){return null}var r=n?this.slideableWidth*Math.floor(i/s):0;return t-(e.target+r)};S.dragEndBoostSelect=function(){if(this.previousDragX===undefined||!this.dragMoveTime||new Date-this.dragMoveTime>100){return 0}var t=this.getSlideDistance(-this.dragX,this.selectedIndex);var i=this.previousDragX-this.dragX;if(t>0&&i>0){return 1}else if(t<0&&i<0){return-1}return 0};S.staticClick=function(t,i){var s=this.getParentCell(t.target);var n=s&&s.element;var h=s&&this.cells.indexOf(s);this.dispatchEvent("staticClick",t,[i,n,h])};S.onscroll=function(){var t=E();var i=this.pointerDownScroll.x-t.x;var s=this.pointerDownScroll.y-t.y;if(Math.abs(i)>3||Math.abs(s)>3){this._pointerDone()}};function E(){return{x:window.pageXOffset,y:window.pageYOffset}}var A="http://www.w3.org/2000/svg";function O(t,i){this.direction=t;this.parent=i;this.parentElement=this.parent.element.shadowRoot||this.parent.element;this._create()}O.prototype=Object.create(M.prototype);O.prototype._create=function(){this.isEnabled=true;this.isPrevious=this.direction==-1;var t=this.parent.options.rightToLeft?1:-1;this.isLeft=this.direction==t;var i=this.element=document.createElement("button");i.className="flickity-button flickity-prev-next-button";i.className+=this.isPrevious?" previous":" next";i.setAttribute("type","button");this.disable();i.setAttribute("aria-label",this.isPrevious?"Previous":"Next");var s=this.createSVG();i.appendChild(s);this.parent.on("select",this.update.bind(this));this.on("pointerDown",this.parent.childUIPointerDown.bind(this.parent))};O.prototype.activate=function(){this.bindStartEvent(this.element);this.element.addEventListener("click",this);this.parentElement.appendChild(this.element)};O.prototype.deactivate=function(){this.parentElement.removeChild(this.element);this.unbindStartEvent(this.element);this.element.removeEventListener("click",this)};O.prototype.createSVG=function(){var t=document.createElementNS(A,"svg");t.setAttribute("class","flickity-button-icon");t.setAttribute("viewBox","0 0 100 100");var i=document.createElementNS(A,"path");var s=D(this.parent.options.arrowShape);i.setAttribute("d",s);i.setAttribute("class","arrow");if(!this.isLeft){i.setAttribute("transform","translate(100, 100) rotate(180) ")}t.appendChild(i);return t};function D(t){if(typeof t=="string"){return t}return"M "+t.x0+",50"+" L "+t.x1+","+(t.y1+50)+" L "+t.x2+","+(t.y2+50)+" L "+t.x3+",50 "+" L "+t.x2+","+(50-t.y2)+" L "+t.x1+","+(50-t.y1)+" Z"}O.prototype.handleEvent=u.handleEvent;O.prototype.onclick=function(){if(!this.isEnabled){return}this.parent.uiChange();var t=this.isPrevious?"previous":"next";this.parent[t]()};O.prototype.enable=function(){if(this.isEnabled){return}this.element.disabled=false;this.isEnabled=true};O.prototype.disable=function(){if(!this.isEnabled){return}this.element.disabled=true;this.isEnabled=false};O.prototype.update=function(){var t=this.parent.slides;if(this.parent.options.wrapAround&&t.length>1){this.enable();return}var i=t.length?t.length-1:0;var s=this.isPrevious?0:i;var n=this.parent.selectedIndex==s?"disable":"enable";this[n]()};O.prototype.destroy=function(){this.deactivate();this.allOff()};u.extend(m.defaults,{prevNextButtons:true,arrowShape:{x0:10,x1:60,y1:50,x2:70,y2:40,x3:30}});m.createMethods.push("_createPrevNextButtons");var j=m.prototype;j._createPrevNextButtons=function(){if(!this.options.prevNextButtons){return}this.prevButton=new O(-1,this);this.nextButton=new O(1,this);this.on("activate",this.activatePrevNextButtons)};j.activatePrevNextButtons=function(){this.prevButton.activate();this.nextButton.activate();this.on("deactivate",this.deactivatePrevNextButtons)};j.deactivatePrevNextButtons=function(){this.prevButton.deactivate();this.nextButton.deactivate();this.off("deactivate",this.deactivatePrevNextButtons)};m.PrevNextButton=O;function R(t){this.parent=t;this.parentElement=this.parent.element.shadowRoot||this.parent.element;this._create()}R.prototype=Object.create(M.prototype);R.prototype._create=function(){this.holder=document.createElement("ol");this.holder.className="flickity-page-dots";this.dots=[];this.handleClick=this.onClick.bind(this);this.on("pointerDown",this.parent.childUIPointerDown.bind(this.parent))};R.prototype.activate=function(){this.setDots();this.holder.addEventListener("click",this.handleClick);this.bindStartEvent(this.holder);this.parentElement.appendChild(this.holder)};R.prototype.deactivate=function(){this.holder.removeEventListener("click",this.handleClick);this.unbindStartEvent(this.holder);this.parentElement.removeChild(this.holder)};R.prototype.setDots=function(){var t=this.parent.slides.length-this.dots.length;if(t>0){this.addDots(t)}else if(t<0){this.removeDots(-t)}};R.prototype.addDots=function(t){var i=document.createDocumentFragment();var s=[];var n=this.dots.length;var h=n+t;for(var e=n;e<h;e++){var r=document.createElement("li");r.classList.add("dot");r.setAttribute("aria-label","Page dot "+(e+1));i.appendChild(r);s.push(r)}this.holder.appendChild(i);this.dots=this.dots.concat(s)};R.prototype.removeDots=function(t){var i=this.dots.splice(this.dots.length-t,t);i.forEach((function(t){this.holder.removeChild(t)}),this)};R.prototype.updateSelected=function(){if(this.selectedDot){this.selectedDot.classList.remove("is-selected");this.selectedDot.removeAttribute("aria-current")}if(!this.dots.length){return}this.selectedDot=this.dots[this.parent.selectedIndex];this.selectedDot.classList.add("is-selected");this.selectedDot.setAttribute("aria-current","step")};R.prototype.onTap=R.prototype.onClick=function(t){var i=t.target;if(i.nodeName!="LI"){return}this.parent.uiChange();var s=this.dots.indexOf(i);this.parent.select(s)};R.prototype.destroy=function(){this.deactivate();this.allOff()};m.PageDots=R;u.extend(m.defaults,{pageDots:true});m.createMethods.push("_createPageDots");var I=m.prototype;I._createPageDots=function(){if(!this.options.pageDots){return}this.pageDots=new R(this);this.on("activate",this.activatePageDots);this.on("select",this.updateSelectedPageDots);this.on("cellChange",this.updatePageDots);this.on("resize",this.updatePageDots);this.on("deactivate",this.deactivatePageDots)};I.activatePageDots=function(){this.pageDots.activate()};I.updateSelectedPageDots=function(){this.pageDots.updateSelected()};I.updatePageDots=function(){this.pageDots.setDots()};I.deactivatePageDots=function(){this.pageDots.deactivate()};m.PageDots=R;function N(t){this.parent=t;this.state="stopped";this.onVisibilityChange=this.visibilityChange.bind(this);this.onVisibilityPlay=this.visibilityPlay.bind(this)}N.prototype=Object.create(a.prototype);N.prototype.play=function(){if(this.state=="playing"){return}var t=document.hidden;if(t){document.addEventListener("visibilitychange",this.onVisibilityPlay);return}this.state="playing";document.addEventListener("visibilitychange",this.onVisibilityChange);this.tick()};N.prototype.tick=function(){if(this.state!="playing"){return}var t=this.parent.options.autoPlay;t=typeof t=="number"?t:3e3;var i=this;this.clear();this.timeout=setTimeout((function(){i.parent.next(true);i.tick()}),t)};N.prototype.stop=function(){this.state="stopped";this.clear();document.removeEventListener("visibilitychange",this.onVisibilityChange)};N.prototype.clear=function(){clearTimeout(this.timeout)};N.prototype.pause=function(){if(this.state=="playing"){this.state="paused";this.clear()}};N.prototype.unpause=function(){if(this.state=="paused"){this.play()}};N.prototype.visibilityChange=function(){var t=document.hidden;this[t?"pause":"unpause"]()};N.prototype.visibilityPlay=function(){this.play();document.removeEventListener("visibilitychange",this.onVisibilityPlay)};u.extend(m.defaults,{pauseAutoPlayOnHover:true});m.createMethods.push("_createPlayer");var B=m.prototype;B._createPlayer=function(){this.player=new N(this);this.on("activate",this.activatePlayer);this.on("uiChange",this.stopPlayer);this.on("pointerDown",this.stopPlayer);this.on("deactivate",this.deactivatePlayer)};B.activatePlayer=function(){if(!this.options.autoPlay){return}this.player.play();this.element.addEventListener("mouseenter",this)};B.playPlayer=function(){this.player.play()};B.stopPlayer=function(){this.player.stop()};B.pausePlayer=function(){this.player.pause()};B.unpausePlayer=function(){this.player.unpause()};B.deactivatePlayer=function(){this.player.stop();this.element.removeEventListener("mouseenter",this)};B.onmouseenter=function(){if(!this.options.pauseAutoPlayOnHover){return}this.player.pause();this.element.addEventListener("mouseleave",this)};B.onmouseleave=function(){this.player.unpause();this.element.removeEventListener("mouseleave",this)};m.Player=N;function F(t){var i=document.createDocumentFragment();t.forEach((function(t){i.appendChild(t.element)}));return i}var H=m.prototype;H.insert=function(t,i){var s=this._makeCells(t);if(!s||!s.length){return}var n=this.cells.length;i=i===undefined?n:i;var h=F(s);var e=i==n;if(e){this.slider.appendChild(h)}else{var r=this.cells[i].element;this.slider.insertBefore(h,r)}if(i===0){this.cells=s.concat(this.cells)}else if(e){this.cells=this.cells.concat(s)}else{var a=this.cells.splice(i,n-i);this.cells=this.cells.concat(s).concat(a)}this._sizeCells(s);this.cellChange(i,true)};H.append=function(t){this.insert(t,this.cells.length)};H.prepend=function(t){this.insert(t,0)};H.remove=function(t){var i=this.getCells(t);if(!i||!i.length){return}var s=this.cells.length-1;i.forEach((function(t){t.remove();var i=this.cells.indexOf(t);s=Math.min(i,s);u.removeFrom(this.cells,t)}),this);this.cellChange(s,true)};H.cellSizeChange=function(t){var i=this.getCell(t);if(!i){return}i.getSize();var s=this.cells.indexOf(i);this.cellChange(s)};H.cellChange=function(t,i){var s=this.selectedElement;this._positionCells(t);this._getWrapShiftCells();this.setGallerySize();var n=this.getCell(s);if(n){this.selectedIndex=this.getCellSlideIndex(n)}this.selectedIndex=Math.min(this.slides.length-1,this.selectedIndex);this.emitEvent("cellChange",[t]);this.select(this.selectedIndex);if(i){this.positionSliderAtSelected()}};m.createMethods.push("_createLazyload");var _=m.prototype;_._createLazyload=function(){this.on("select",this.lazyLoad)};_.lazyLoad=function(){var t=this.options.lazyLoad;if(!t){return}var i=typeof t=="number"?t:0;var s=this.getAdjacentCellElements(i);var n=[];s.forEach((function(t){var i=W(t);n=n.concat(i)}));n.forEach((function(t){new V(t,this)}),this)};function W(t){if(t.nodeName=="IMG"){var i=t.getAttribute("data-flickity-lazyload");var s=t.getAttribute("data-flickity-lazyload-src");var n=t.getAttribute("data-flickity-lazyload-srcset");if(i||s||n){return[t]}}var h="img[data-flickity-lazyload], "+"img[data-flickity-lazyload-src], img[data-flickity-lazyload-srcset]";var e=t.querySelectorAll(h);return u.makeArray(e)}function V(t,i){this.img=t;this.flickity=i;this.load()}V.prototype.handleEvent=u.handleEvent;V.prototype.load=function(){this.img.addEventListener("load",this);this.img.addEventListener("error",this);var t=this.img.getAttribute("data-flickity-lazyload")||this.img.getAttribute("data-flickity-lazyload-src");var i=this.img.getAttribute("data-flickity-lazyload-srcset");this.img.src=t;if(i){this.img.setAttribute("srcset",i)}this.img.removeAttribute("data-flickity-lazyload");this.img.removeAttribute("data-flickity-lazyload-src");this.img.removeAttribute("data-flickity-lazyload-srcset")};V.prototype.onload=function(t){this.complete(t,"flickity-lazyloaded")};V.prototype.onerror=function(t){this.complete(t,"flickity-lazyerror")};V.prototype.complete=function(t,i){this.img.removeEventListener("load",this);this.img.removeEventListener("error",this);var s=this.flickity.getParentCell(this.img);var n=s&&s.element;this.flickity.cellSizeChange(n);this.img.classList.add(i);this.flickity.dispatchEvent("lazyLoad",t,n)};m.LazyLoader=V;m.createMethods.push("_createFullscreen");var X=m.prototype;X._createFullscreen=function(){this.isFullscreen=false;if(!this.options.fullscreen){return}this.viewFullscreenButton=new U("view",this);this.exitFullscreenButton=new U("exit",this);this.on("activate",this._changeFullscreenActive);this.on("deactivate",this._changeFullscreenActive)};X._changeFullscreenActive=function(){var t=this.isActive?"appendChild":"removeChild";this.element[t](this.viewFullscreenButton.element);this.element[t](this.exitFullscreenButton.element);var i=this.isActive?"activate":"deactivate";this.viewFullscreenButton[i]();this.exitFullscreenButton[i]()};X.viewFullscreen=function(){this._changeFullscreen(true);this.focus()};X.exitFullscreen=function(){this._changeFullscreen(false)};X._changeFullscreen=function(t){if(this.isFullscreen==t){return}this.isFullscreen=t;var i=t?"add":"remove";document.documentElement.classList[i]("is-flickity-fullscreen");this.element.classList[i]("is-fullscreen");this.resize();if(this.isFullscreen){this.reposition()}this.dispatchEvent("fullscreenChange",null,[t])};X.toggleFullscreen=function(){this._changeFullscreen(!this.isFullscreen)};var Z=X.setGallerySize;X.setGallerySize=function(){if(!this.options.setGallerySize){return}if(this.isFullscreen){this.viewport.style.height=""}else{Z.call(this)}};m.keyboardHandlers[27]=function(){this.exitFullscreen()};function U(t,i){this.name=t;this.createButton();this.createIcon();this.onClick=function(){i[t+"Fullscreen"]()};this.clickHandler=this.onClick.bind(this)}U.prototype.createButton=function(){var t=this.element=document.createElement("button");t.className="flickity-button flickity-fullscreen-button "+"flickity-fullscreen-button-"+this.name;t.setAttribute("type","button");var i=Y(this.name+" full-screen");t.setAttribute("aria-label",i);t.title=i};function Y(t){return t[0].toUpperCase()+t.slice(1)}var G="http://www.w3.org/2000/svg";var J={view:"M15,20,7,28h5v4H0V20H4v5l8-8Zm5-5,8-8v5h4V0H20V4h5l-8,8Z",exit:"M32,3l-7,7h5v4H18V2h4V7l7-7ZM3,32l7-7v5h4V18H2v4H7L0,29Z"};U.prototype.createIcon=function(){var t=document.createElementNS(G,"svg");t.setAttribute("class","flickity-button-icon");t.setAttribute("viewBox","0 0 32 32");var i=document.createElementNS(G,"path");var s=J[this.name];i.setAttribute("d",s);t.appendChild(i);this.element.appendChild(t)};U.prototype.activate=function(){this.element.addEventListener("click",this.clickHandler)};U.prototype.deactivate=function(){this.element.removeEventListener("click",this.clickHandler)};m.FullscreenButton=U;var q=m.Slide;var Q=q.prototype.updateTarget;q.prototype.updateTarget=function(){Q.apply(this,arguments);if(!this.parent.options.fade){return}var t=this.target-this.x;var i=this.cells[0].x;this.cells.forEach((function(s){var n=s.x-i-t;s.renderPosition(n)}))};q.prototype.setOpacity=function(t){this.cells.forEach((function(i){i.element.style.opacity=t}))};var $=m.prototype;m.createMethods.push("_createFade");$._createFade=function(){this.fadeIndex=this.selectedIndex;this.prevSelectedIndex=this.selectedIndex;this.on("select",this.onSelectFade);this.on("dragEnd",this.onDragEndFade);this.on("settle",this.onSettleFade);this.on("activate",this.onActivateFade);this.on("deactivate",this.onDeactivateFade)};var K=$.updateSlides;$.updateSlides=function(){K.apply(this,arguments);if(!this.options.fade){return}this.slides.forEach((function(t,i){var s=i==this.selectedIndex?1:0;t.setOpacity(s)}),this)};$.onSelectFade=function(){this.fadeIndex=Math.min(this.prevSelectedIndex,this.slides.length-1);this.prevSelectedIndex=this.selectedIndex};$.onSettleFade=function(){delete this.didDragEnd;if(!this.options.fade){return}this.selectedSlide.setOpacity(1);var t=this.slides[this.fadeIndex];if(t&&this.fadeIndex!=this.selectedIndex){this.slides[this.fadeIndex].setOpacity(0)}};$.onDragEndFade=function(){this.didDragEnd=true};$.onActivateFade=function(){if(this.options.fade){this.element.classList.add("is-fade")}};$.onDeactivateFade=function(){if(!this.options.fade){return}this.element.classList.remove("is-fade");this.slides.forEach((function(t){t.setOpacity("")}))};var tt=$.positionSlider;$.positionSlider=function(){if(!this.options.fade){tt.apply(this,arguments);return}this.fadeSlides();this.dispatchScrollEvent()};var it=$.positionSliderAtSelected;$.positionSliderAtSelected=function(){if(this.options.fade){this.setTranslateX(0)}it.apply(this,arguments)};$.fadeSlides=function(){if(this.slides.length<2){return}var t=this.getFadeIndexes();var i=this.slides[t.a];var s=this.slides[t.b];var n=this.wrapDifference(i.target,s.target);var h=this.wrapDifference(i.target,-this.x);h=h/n;i.setOpacity(1-h);s.setOpacity(h);var e=t.a;if(this.isDragging){e=h>.5?t.a:t.b}var r=this.fadeHideIndex!=undefined&&this.fadeHideIndex!=e&&this.fadeHideIndex!=t.a&&this.fadeHideIndex!=t.b;if(r){this.slides[this.fadeHideIndex].setOpacity(0)}this.fadeHideIndex=e};$.getFadeIndexes=function(){if(!this.isDragging&&!this.didDragEnd){return{a:this.fadeIndex,b:this.selectedIndex}}if(this.options.wrapAround){return this.getFadeDragWrapIndexes()}else{return this.getFadeDragLimitIndexes()}};$.getFadeDragWrapIndexes=function(){var t=this.slides.map((function(t,i){return this.getSlideDistance(-this.x,i)}),this);var i=t.map((function(t){return Math.abs(t)}));var s=Math.min.apply(Math,i);var n=i.indexOf(s);var h=t[n];var e=this.slides.length;var r=h>=0?1:-1;return{a:n,b:u.modulo(n+r,e)}};$.getFadeDragLimitIndexes=function(){var t=0;for(var i=0;i<this.slides.length-1;i++){var s=this.slides[i];if(-this.x<s.target){break}t=i}return{a:t,b:t+1}};$.wrapDifference=function(t,i){var s=i-t;if(!this.options.wrapAround){return s}var n=s+this.slideableWidth;var h=s-this.slideableWidth;if(Math.abs(n)<Math.abs(s)){s=n}if(Math.abs(h)<Math.abs(s)){s=h}return s};var st=$._getWrapShiftCells;$._getWrapShiftCells=function(){if(!this.options.fade){st.apply(this,arguments)}};var nt=$.shiftWrapCells;$.shiftWrapCells=function(){if(!this.options.fade){nt.apply(this,arguments)}};const ht=m;const et=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--dot-color:#ccc;--dot-color-active:var(--nano-color-primary, #007495);--navbtns-icon-color:var(--dot-color-active);--navbtns-bg-color:white;--navbtns-icon-color-disabled:var(--dot-color-active);--navbtns-bg-color-disabled:white;--fsbtn-icon-color:var(--dot-color-active);--fsbtn-bg-color:white;display:block;-webkit-user-select:none;user-select:none;overflow:hidden;transition:opacity 0.2s;opacity:0}:host([ready]){opacity:1}.slideshow{block-size:100%;position:relative}.flickity-container{block-size:0;opacity:0;transition:opacity 0.2s}.flickity-container.slides-ready{block-size:100%}[hidden]{display:none !important}.ui-extras{pointer-events:none;position:absolute;block-size:100%;inline-size:100%;inset-block-start:0;inset-inline-start:0}.ui-extras *{pointer-events:all}/*! Flickity v2.2.1\nhttps://flickity.metafizzy.co\n---------------------------------------------- */.flickity-enabled{position:relative;opacity:1}.flickity-enabled:focus{outline:none}.flickity-viewport{overflow:hidden;position:relative;block-size:100% !important}.flickity-slider{position:absolute;inline-size:100%;block-size:100%}.flickity-enabled.is-draggable{-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none}.flickity-enabled.is-draggable .flickity-viewport{cursor:move;cursor:grab;cursor:grab}.flickity-enabled.is-draggable .flickity-viewport.is-pointer-down{cursor:grabbing}.flickity-button{position:absolute;background:var(--navbtns-bg-color);border:none;color:#333;opacity:0.75}.flickity-button:hover{opacity:1;cursor:pointer}.flickity-button:focus{outline:none;box-shadow:0 0 0 5px #19f}.flickity-button:active{opacity:0.6}.flickity-button:disabled{opacity:0.3;cursor:auto;pointer-events:none;background:var(--navbtns-bg-color-disabled)}.flickity-button-icon{fill:var(--navbtns-icon-color)}.flickity-button:disabled .flickity-button-icon{fill:var(--navbtns-icon-color-disabled)}.flickity-prev-next-button{inset-block-start:50%;inline-size:44px;block-size:44px;border-radius:50%;transform:translateY(-50%)}.flickity-prev-next-button.previous{inset-inline-start:10px}.flickity-prev-next-button.next{inset-inline-end:10px}.flickity-rtl .flickity-prev-next-button.previous{inset-inline:auto 10px}.flickity-rtl .flickity-prev-next-button.next{inset-inline:10px auto}.flickity-prev-next-button .flickity-button-icon{position:absolute;inset-inline-start:20%;inset-block-start:20%;inline-size:60%;block-size:60%}.flickity-page-dots{position:absolute;inline-size:100%;inset-block-end:10px;padding:0;margin:0;list-style:none;text-align:center;line-height:1;z-index:4}.flickity-rtl .flickity-page-dots{direction:rtl}.flickity-page-dots .dot{display:inline-block;inline-size:10px;block-size:10px;margin-block:0;margin-inline:8px;border-radius:50%;cursor:pointer;background:var(--dot-color)}.flickity-page-dots .dot.is-selected{opacity:1;background:var(--dot-color-active)}.flickity-enabled.is-fullscreen{position:fixed;inset-inline-start:0;inset-block-start:0;inline-size:100%;block-size:100%;background:rgba(0, 0, 0, 0.9);-webkit-padding-after:35px;padding-block-end:35px;z-index:100}.flickity-enabled.is-fullscreen .flickity-page-dots{inset-block-end:45px}html.is-flickity-fullscreen{overflow:hidden}.flickity-fullscreen-button{display:block;inset-inline-end:10px;inset-block-start:10px;inline-size:24px;block-size:24px;border-radius:4px;background:var(--fsbtn-bg-color);fill:var(--fsbtn-icon-color)}.flickity-rtl .flickity-fullscreen-button{inset-inline:10px auto}.flickity-fullscreen-button-exit{display:none}.flickity-enabled.is-fullscreen .flickity-fullscreen-button-exit{display:block}.flickity-enabled.is-fullscreen .flickity-fullscreen-button-view{display:none}.flickity-fullscreen-button .flickity-button-icon{position:absolute;inline-size:16px;block-size:16px;inset-inline-start:4px;inset-block-start:4px}.flickity-enabled.is-fade .flickity-slider>*{pointer-events:none;z-index:0}.flickity-enabled.is-fade .flickity-slider ::slotted(.is-selected){pointer-events:auto;z-index:1}";const rt=class{constructor(s){t(this,s);this.nanoSlidesDidLoad=i(this,"nanoSlidesDidLoad",7);this.nanoSlidesReady=i(this,"nanoSlidesReady",7);this.nanoSlidesSelect=i(this,"nanoSlidesSelect",7);this.nanoSlidesChange=i(this,"nanoSlidesChange",7);this.nanoSlidesScroll=i(this,"nanoSlidesScroll",7);this.nanoSlidesTransitionEnd=i(this,"nanoSlidesTransitionEnd",7);this.nanoSlidesDragStart=i(this,"nanoSlidesDragStart",7);this.nanoSlidesDragMove=i(this,"nanoSlidesDragMove",7);this.nanoSlidesDragEnd=i(this,"nanoSlidesDragEnd",7);this.nanoSlidesTap=i(this,"nanoSlidesTap",7);this.nanoSlidesFullscreenChange=i(this,"nanoSlidesFullscreenChange",7);this.flickityReady=false;this.flickity=new Promise((t=>{this.readyflickity=t}));this.parralax=async()=>{const t=await this.flickity;t.slides.forEach(((i,s)=>{const n=this.childrenEles[s];const h=(i.target+t.x)*-1/3;n.style["transform"]="translateX("+h+"px)"}))};this.handleFullscreen=t=>{this.fullscreen=t;this.nanoSlidesFullscreenChange.emit(t)};this.handleSlideSelect=t=>{this.iCurrentSlide=t;this.nanoSlidesSelect.emit(t)};this.iCurrentSlide=undefined;this.slidesReady=undefined;this.didInit=false;this.options={};this.navbtns=false;this.pager=false;this.fullscreenbtn=false;this.fullscreen=false;this.animation="scroll";this.currentSlide=0;this.autoplay=false;this.ready=false}async optionsChanged(){if(this.flickityReady){const t=await this.getflickity();Object.assign(t.options,this.options);await this.update()}}async navbtnsChanged(){Array.from(this._getRoot().querySelectorAll(".flickity-prev-next-button")).forEach((t=>{t.hidden=!this.navbtns}))}async pagerChanged(){const t=this._getRoot().querySelector(".flickity-page-dots");t.hidden=!this.pager}async fullscreenBtnChanged(){const t=this._getRoot().querySelector(".flickity-fullscreen-button");t.hidden=!this.fullscreenbtn}async fullscreenChanged(t,i){const s=await this.getflickity();if(this.fullscreen)s.viewFullscreen();else if(typeof i!=="undefined")s.exitFullscreen()}async animationChange(t,i){const[s,n]=await Promise.all([this.getflickity(),at(this.host)]);n.forEach((t=>{t.style["left"]=undefined}));if(i==="parallax"){s.off("scroll",this.parralax);n.forEach(((t,i)=>{if(this.childrenEles&&this.childrenEles[i])this.childrenEles[i].style["transform"]=undefined}));this.update()}switch(this.animation){case"fade":this.options={fade:true,percentPosition:true};break;case"parallax":this.options={fade:false,percentPosition:false};s.on("scroll",this.parralax);break;default:this.options={fade:false,percentPosition:true};break}}currentSlideChange(){if(this.currentSlide!==this.iCurrentSlide)this.slideTo(this.currentSlide)}internalSlideChange(){this.currentSlide=this.iCurrentSlide}async autoPlayChange(){await this.stopAutoplay();if(this.autoplay){if(typeof this.autoplay==="string")this.autoplay=parseInt(this.autoplay);if(this.autoplay>0)this.startAutoplay(this.autoplay)}}async update(){const[t]=await Promise.all([this.getflickity(),at(this.host)]);this.childrenEles=this.host.querySelectorAll("nano-slide > *");t.reloadCells();t.resize();t.reposition()}async updateAutoHeight(t){const i=document.querySelector(".flickity-viewport");if(i)i.style.transition=t+"ms"}async slideTo(t,i){const s=await this.getflickity();s.select(t,i)}async slideNext(t,i){const s=await this.getflickity();s.next(i,t)}async slidePrev(t,i){const s=await this.getflickity();s.previous(t,i)}async getActiveIndex(){const t=await this.getflickity();return t.selectedIndex}async length(){const t=await this.getflickity();return t.slides.length}async isEnd(){const t=await this.getflickity();return t.selectedIndex===t.slides.length-1}async isBeginning(){const t=await this.getflickity();return t.selectedIndex===0}async startAutoplay(t){const i=await this.getflickity();if(t)this.options={autoPlay:t};setTimeout((()=>i.playPlayer()))}async stopAutoplay(){const t=await this.getflickity();t.stopPlayer()}async lockSwipes(t){const i=await this.getflickity();i.options.draggable=!t;i.updateDraggable()}async getflickity(){return this.flickity}async reload(){this.destroyflickity();setTimeout((()=>this.initflickity()),20)}_getRoot(){return this.host.shadowRoot?this.host.shadowRoot:this.host}destroyflickity(){const t=this.syncflickity;if(t!==undefined){t.destroy();this.flickity=new Promise((t=>{this.readyflickity=t}));this.flickityReady=false;this.syncflickity=undefined;this.ready=false}this.didInit=false}async initflickity(){const t=this.normalizeOptions();await at(this.host);this.slidesReady=true;this.flickityEl=this.flickityEl||this._getRoot().querySelector(".flickity-container");if(this.flickityEl&&this.flickityEl.classList.contains("flickity-enabled"))this.destroyflickity();setTimeout((()=>{const i=new ht(this.flickityEl,t);this.flickityReady=true;this.syncflickity=i;this.animationChange();this.navbtnsChanged();this.pagerChanged();this.fullscreenChanged();this.fullscreenBtnChanged();this.readyflickity(i);this.ready=true;if(!this.host.getBoundingClientRect().height){if(!window["ResizeObserver"])return;const t=this.resizeO=new ResizeObserver((()=>{i.resize();this.resizeO.disconnect()}));t.observe(this.host)}}),100)}normalizeOptions(){const t={cellSelector:"nano-slide",contain:true,prevNextButtons:true,fullscreen:true,accessibility:true,imagesLoaded:true,pageDots:true};if(this.animation==="fade"){t.fade=true}if(this.currentSlide>0){t.initialIndex=this.currentSlide}if(this.autoplay){if(typeof this.autoplay==="string")this.autoplay=parseInt(this.autoplay);if(this.autoplay>0)t.autoPlay=this.autoplay}const i={ready:()=>{setTimeout((()=>{this.nanoSlidesReady.emit()}),20)},select:this.handleSlideSelect,change:this.nanoSlidesChange.emit,scroll:this.nanoSlidesScroll.emit,settle:this.nanoSlidesTransitionEnd.emit,dragStart:this.nanoSlidesDragStart.emit,dragMove:this.nanoSlidesDragMove.emit,dragEnd:this.nanoSlidesDragEnd.emit,staticClick:this.nanoSlidesTap.emit,fullscreenChange:this.handleFullscreen};const s=!!this.options&&!!this.options.on?this.options.on:{};const n={on:Object.assign(Object.assign({},s),i)};return Object.assign(Object.assign(Object.assign({},t),n),this.options)}componentDidLoad(){if(typeof window!=="undefined"&&window.MutationObserver){const t=this.mutationO=new MutationObserver((t=>{if(t[0].addedNodes[0]&&t[0].addedNodes[0].nodeName.toLowerCase()==="nano-slide"&&this.flickityReady){this.update()}}));t.observe(this.host,{childList:true,subtree:true})}}componentWillLoad(){this.nanoSlidesDidLoad.emit();if(!this.didInit){this.didInit=true;this.initflickity()}}disconnectedCallback(){if(this.mutationO){this.mutationO.disconnect();this.mutationO=undefined}if(this.resizeO)this.resizeO.disconnect();this.destroyflickity()}render(){return s(n,null,s("div",{class:"slideshow"},s("div",{ref:t=>this.flickityEl=t,class:{"flickity-container":true,"slides-ready":this.slidesReady,"slides-not-ready":!this.slidesReady}},s("slot",null)),s("div",{class:"ui-extras"},s("slot",{name:"ui"}))))}get host(){return h(this)}static get watchers(){return{options:["optionsChanged"],navbtns:["navbtnsChanged"],pager:["pagerChanged"],fullscreenbtn:["fullscreenBtnChanged"],fullscreen:["fullscreenChanged"],animation:["animationChange"],currentSlide:["currentSlideChange"],iCurrentSlide:["internalSlideChange"],autoplay:["autoPlayChange"]}}};const at=t=>{const i=Array.from(t.querySelectorAll("nano-slide"));let s=i.filter((t=>!t.ready));if(!s.length)return Promise.resolve(i);return new Promise((n=>{const h=e=>{s=s.filter((t=>t!==e.target));if(!s.length){n(i);t.removeEventListener("nanoSlideReady",h)}};t.addEventListener("nanoSlideReady",h);t.addEventListener("nano-slide-ready",h)}))};rt.style=et;export{rt as nano_slides};
23
- //# sourceMappingURL=p-c12042c7.entry.js.map
23
+ //# sourceMappingURL=p-f2875bf0.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import{g as t,e as i,r as e,c as s,w as n,d as r,h as a,a as h}from"./p-f84612d4.js";import{a as o}from"./p-ed6adde2.js";import{g as l}from"./p-257432ff.js";import{C as u}from"./p-7c23e950.js";import{b as f,c,a as d}from"./p-69a3e911.js";import{d as p}from"./p-9746b0a5.js";import{S as v}from"./p-5ec7263c.js";var m=new Map;var g=function(t,i){var e=t.fields,s=t.updater;e.forEach((function(t){s(t,i[t])}))};var y={create:function(i,e){var s=t(i);var n=new Map;var r={wormholes:n,state:e};m.set(i,r);var a=i.connectedCallback;i.connectedCallback=function(){m.set(i,r);if(a){a.call(i)}};var h=i.disconnectedCallback;i.disconnectedCallback=function(){m.delete(i);if(h){h.call(i)}};s.addEventListener("openWormhole",(function(t){t.stopPropagation();var i=t.detail,e=i.consumer,s=i.onOpen;if(n.has(e))return;if(typeof e!=="symbol"){var a=e.connectedCallback,h=e.disconnectedCallback;e.connectedCallback=function(){n.set(e,t.detail);if(a){a.call(e)}};e.disconnectedCallback=function(){n.delete(e);if(h){h.call(e)}}}n.set(e,t.detail);g(t.detail,r.state);s===null||s===void 0?void 0:s.resolve((function(){n.delete(e)}))}));s.addEventListener("closeWormhole",(function(t){var i=t.detail;n.delete(i)}))},Provider:function(t,e){var s=t.state;var n=i();if(m.has(n)){var r=m.get(n);r.state=s;r.wormholes.forEach((function(t){g(t,s)}))}return e}};class w{constructor(){this.queue=[];this.workingOnPromise=false;this.stop=false;this.limit=null}enqueue(t){return new Promise(((i,e)=>{this.queue.push({promise:t,resolve:i,reject:e});this.dequeue()}))}dequeue(){if(this.workingOnPromise){return false}if(this.stop){this.queue=[];this.stop=false;return}const t=this.queue.shift();if(!t){return false}try{this.workingOnPromise=true;t.promise().then((i=>{this.workingOnPromise=false;t.resolve(i);this.dequeue()})).catch((i=>{this.workingOnPromise=false;t.reject(i);this.dequeue()}))}catch(i){this.workingOnPromise=false;t.reject(i);this.dequeue()}return true}}w.pendingPromise=false;var b=c((function(t,i){!function(t,e){e(i)}(d,(function(t){function i(t){var e,s,n=new Error(t);return e=n,s=i.prototype,Object.setPrototypeOf?Object.setPrototypeOf(e,s):e.__proto__=s,n}function e(t,e,s){var n=e.slice(0,s).split(/\n/),r=n.length,a=n[r-1].length+1;throw i(t+=" at line "+r+" col "+a+":\n\n "+e.split(/\n/)[r-1]+"\n "+Array(a).join(" ")+"^")}i.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var s=new Function("return this")().Promise,n=!1;try{n=new Function("return (async function(){}).constructor")()}catch(t){if(!(t instanceof SyntaxError))throw t}function r(t,i){return Object.prototype.hasOwnProperty.call(t,i)}function a(t,i,e){for(var s in i)r(i,s)&&(null==i[s]||"object"!=typeof i[s]||"storage"!==s&&"prefixes"!==s||e?t[s]=i[s]:t[s]=a({},i[s]));return t}var h=/^async +/,o=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,l=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,u=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,f=/[.*+\-?^${}()|[\]\\]/g;function c(t){return f.test(t)?t.replace(f,"\\$&"):t}function d(t,s){s.rmWhitespace&&(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),o.lastIndex=0,l.lastIndex=0,u.lastIndex=0;var n=s.prefixes,r=[n.h,n.b,n.i,n.r,n.c,n.e].reduce((function(t,i){return t&&i?t+"|"+c(i):i?c(i):t}),""),a=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+c(s.tags[1])+")","g"),f=new RegExp("([^]*?)"+c(s.tags[0])+"(-|_)?\\s*("+r+")?\\s*","g"),d=0,p=!1;function v(i,n){var r,c={f:[]},v=0,m="c";function g(i){var n=t.slice(d,i),r=n.trim();if("f"===m)"safe"===r?c.raw=!0:s.async&&h.test(r)?(r=r.replace(h,""),c.f.push([r,"",!0])):c.f.push([r,""]);else if("fp"===m)c.f[c.f.length-1][1]+=r;else if("err"===m){if(r){var a=n.search(/\S/);e("invalid syntax",t,d+a)}}else c[m]=r;d=i+1}for("h"===n||"b"===n||"c"===n?m="n":"r"===n&&(c.raw=!0,n="i"),a.lastIndex=d;null!==(r=a.exec(t));){var y=r[1],w=r[2],b=r[3],x=r[4],F=r[5],C=r.index;if(y)"("===y?(0===v&&("n"===m?(g(C),m="p"):"f"===m&&(g(C),m="fp")),v++):")"===y?0===--v&&"c"!==m&&(g(C),m="err"):0===v&&"|"===y?(g(C),m="f"):"=>"===y&&(g(C),d+=1,m="res");else if(w){if("/*"===w){var j=t.indexOf("*/",a.lastIndex);-1===j&&e("unclosed comment",t,r.index),a.lastIndex=j+2}else if("'"===w){l.lastIndex=r.index,l.exec(t)?a.lastIndex=l.lastIndex:e("unclosed string",t,r.index)}else if('"'===w){u.lastIndex=r.index,u.exec(t)?a.lastIndex=u.lastIndex:e("unclosed string",t,r.index)}else if("`"===w){o.lastIndex=r.index,o.exec(t)?a.lastIndex=o.lastIndex:e("unclosed string",t,r.index)}}else if(b)return g(C),d=C+r[0].length,f.lastIndex=d,p=F,x&&"h"===n&&(n="s"),c.t=n,c}return e("unclosed tag",t,i),c}var m=function r(a,o){a.b=[],a.d=[];var l,u=!1,c=[];function m(t,i){t&&(t=function(t,i,e,s){var n,r;return"string"==typeof i.autoTrim?n=r=i.autoTrim:Array.isArray(i.autoTrim)&&(n=i.autoTrim[1],r=i.autoTrim[0]),(e||!1===e)&&(n=e),(s||!1===s)&&(r=s),"slurp"===n&&"slurp"===r?t.trim():("_"===n||"slurp"===n?t=String.prototype.trimLeft?t.trimLeft():t.replace(/^[\s\uFEFF\xA0]+/,""):"-"!==n&&"nl"!==n||(t=t.replace(/^(?:\n|\r|\r\n)/,"")),"_"===r||"slurp"===r?t=String.prototype.trimRight?t.trimRight():t.replace(/[\s\uFEFF\xA0]+$/,""):"-"!==r&&"nl"!==r||(t=t.replace(/(?:\n|\r|\r\n)$/,"")),t)}(t,s,p,i))&&(t=t.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),c.push(t))}for(;null!==(l=f.exec(t));){var g,y=l[1],w=l[2],b=l[3]||"";for(var x in n)if(n[x]===b){g=x;break}m(y,w),d=l.index+l[0].length,g||e("unrecognized tag type: "+b,t,d);var F=v(l.index,g),C=F.t;if("h"===C){var j=F.n||"";s.async&&h.test(j)&&(F.a=!0,F.n=j.replace(h,"")),F=r(F),c.push(F)}else if("c"===C){if(a.n===F.n)return u?(u.d=c,a.b.push(u)):a.d=c,a;e("Helper start and end don't match",t,l.index+l[0].length)}else if("b"===C){u?(u.d=c,a.b.push(u)):a.d=c;var I=F.n||"";s.async&&h.test(I)&&(F.a=!0,F.n=I.replace(h,"")),u=F,c=[]}else if("s"===C){var S=F.n||"";s.async&&h.test(S)&&(F.a=!0,F.n=S.replace(h,"")),c.push(F)}else c.push(F)}if(!o)throw i('unclosed helper "'+a.n+'"');return m(t.slice(d,t.length),!1),a.d=c,a}({f:[]},!0);if(s.plugins)for(var g=0;g<s.plugins.length;g++){var y=s.plugins[g];y.processAST&&(m.d=y.processAST(m.d,s))}return m.d}function p(t,i){var e=d(t,i),s="var tR='';"+(i.useWith?"with("+i.varName+"||{}){":"")+w(e,i)+"if(cb){cb(null,tR)} return tR"+(i.useWith?"}":"");if(i.plugins)for(var n=0;n<i.plugins.length;n++){var r=i.plugins[n];r.processFnString&&(s=r.processFnString(s,i))}return s}function v(t,i){for(var e=0;e<i.length;e++){var s=i[e][0],n=i[e][1];t=(i[e][2]?"await ":"")+"c.l('F','"+s+"')("+t,n&&(t+=","+n),t+=")"}return t}function m(t,i,e,s,n,r){var a="{exec:"+(n?"async ":"")+y(e,i,t)+",params:["+s+"]";return r&&(a+=",name:'"+r+"'"),n&&(a+=",async:true"),a+="}"}function g(t,i){for(var e="[",s=0;s<t.length;s++){var n=t[s];e+=m(i,n.res||"",n.d,n.p||"",n.a,n.n),s<t.length&&(e+=",")}return e+="]"}function y(t,i,e){return"function("+i+"){var tR='';"+w(t,e)+"return tR}"}function w(t,i){for(var e=0,s=t.length,n="";e<s;e++){var r=t[e];if("string"==typeof r){n+="tR+='"+r+"';"}else{var a=r.t,h=r.c||"",o=r.f,l=r.n||"",u=r.p||"",f=r.res||"",c=r.b,d=!!r.a;if("i"===a){i.defaultFilter&&(h="c.l('F','"+i.defaultFilter+"')("+h+")");var p=v(h,o);!r.raw&&i.autoEscape&&(p="c.l('F','e')("+p+")"),n+="tR+="+p+";"}else if("h"===a)if(i.storage.nativeHelpers.get(l))n+=i.storage.nativeHelpers.get(l)(r,i);else{var y=(d?"await ":"")+"c.l('H','"+l+"')("+m(i,f,r.d,u,d);y+=c?","+g(c,i):",[]",n+="tR+="+v(y+=",c)",o)+";"}else"s"===a?n+="tR+="+v((d?"await ":"")+"c.l('H','"+l+"')({params:["+u+"]},[],c)",o)+";":"e"===a&&(n+=h+"\n")}}return n}var b=function(){function t(t){this.cache=t}return t.prototype.define=function(t,i){this.cache[t]=i},t.prototype.get=function(t){return this.cache[t]},t.prototype.remove=function(t){delete this.cache[t]},t.prototype.reset=function(){this.cache={}},t.prototype.load=function(t){a(this.cache,t,!0)},t}();function x(t,e,s,n){if(e&&e.length>0)throw i((n?"Native":"")+"Helper '"+t+"' doesn't accept blocks");if(s&&s.length>0)throw i((n?"Native":"")+"Helper '"+t+"' doesn't accept filters")}var F={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function C(t){return F[t]}var j=new b({}),I=new b({each:function(t,i){var e="",s=t.params[0];if(x("each",i,!1),t.async)return new Promise((function(i){!function t(i,e,s,n,r){s(i[e],e).then((function(a){n+=a,e===i.length-1?r(n):t(i,e+1,s,n,r)}))}(s,0,t.exec,e,i)}));for(var n=0;n<s.length;n++)e+=t.exec(s[n],n);return e},foreach:function(t,i){var e=t.params[0];if(x("foreach",i,!1),t.async)return new Promise((function(i){!function t(i,e,s,n,r,a){n(e[s],i[e[s]]).then((function(h){r+=h,s===e.length-1?a(r):t(i,e,s+1,n,r,a)}))}(e,Object.keys(e),0,t.exec,"",i)}));var s="";for(var n in e)r(e,n)&&(s+=t.exec(n,e[n]));return s},include:function(t,e,s){x("include",e,!1);var n=s.storage.templates.get(t.params[0]);if(!n)throw i('Could not fetch template "'+t.params[0]+'"');return n(t.params[1],s)},extends:function(t,e,s){var n=t.params[1]||{};n.content=t.exec();for(var r=0;r<e.length;r++){var a=e[r];n[a.name]=a.exec()}var h=s.storage.templates.get(t.params[0]);if(!h)throw i('Could not fetch template "'+t.params[0]+'"');return h(n,s)},useScope:function(t,i){return x("useScope",i,!1),t.exec(t.params[0])}}),S=new b({if:function(t,i){x("if",!1,t.f,!0);var e="if("+t.p+"){"+w(t.d,i)+"}";if(t.b)for(var s=0;s<t.b.length;s++){var n=t.b[s];"else"===n.n?e+="else{"+w(n.d,i)+"}":"elif"===n.n&&(e+="else if("+n.p+"){"+w(n.d,i)+"}")}return e},try:function(t,e){if(x("try",!1,t.f,!0),!t.b||1!==t.b.length||"catch"!==t.b[0].n)throw i("native helper 'try' only accepts 1 block, 'catch'");var s="try{"+w(t.d,e)+"}",n=t.b[0];return s+="catch"+(n.res?"("+n.res+")":"")+"{"+w(n.d,e)+"}"},block:function(t,i){return x("block",t.b,t.f,!0),"if(!"+i.varName+"["+t.p+"]){tR+=("+y(t.d,"",i)+")()}else{tR+="+i.varName+"["+t.p+"]}"}}),z=new b({e:function(t){var i=String(t);return/[&<>"']/.test(i)?i.replace(/[&<>"']/g,C):i}}),O={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(t,e){if("H"===t){var s=this.storage.helpers.get(e);if(s)return s;throw i("Can't find helper '"+e+"'")}if("F"===t){var n=this.storage.filters.get(e);if(n)return n;throw i("Can't find filter '"+e+"'")}},async:!1,storage:{helpers:I,nativeHelpers:S,filters:z,templates:j},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function R(t,i){var e={};return a(e,O),i&&a(e,i),t&&a(e,t),e.l.bind(e),e}function A(t,e){var s=R(e||{}),r=Function;if(s.async){if(!n)throw i("This environment doesn't support async/await");r=n}try{return new r(s.varName,"c","cb",p(t,s))}catch(e){throw e instanceof SyntaxError?i("Bad template syntax\n\n"+e.message+"\n"+Array(e.message.length+1).join("=")+"\n"+p(t,s)):e}}function k(t,i){var e;return i.cache&&i.name&&i.storage.templates.get(i.name)?i.storage.templates.get(i.name):(e="function"==typeof t?t:A(t,i),i.cache&&i.name&&i.storage.templates.define(i.name,e),e)}O.l.bind(O),t.compile=A,t.compileScope=w,t.compileScopeIntoFunction=y,t.compileToString=p,t.defaultConfig=O,t.filters=z,t.getConfig=R,t.helpers=I,t.nativeHelpers=S,t.parse=d,t.render=function(t,e,n,r){var a=R(n||{});if(!a.async)return k(t,a)(e,a);if(!r){if("function"==typeof s)return new s((function(i,s){try{i(k(t,a)(e,a))}catch(t){s(t)}}));throw i("Please provide a callback function, this env doesn't support Promises")}try{k(t,a)(e,a,r)}catch(t){return r(t)}},t.templates=j,Object.defineProperty(t,"__esModule",{value:!0})}))}));const x=f(b);const F=Object.freeze(Object.assign(Object.create(null),b,{default:x}));const C=F;C.filters.define("date_long",((t,i={year:"numeric",month:"long",day:"numeric"})=>{if(!t)return;const e=new Date(parseInt(t)*1e3);t=e.toLocaleDateString("en-GB",i);return t}));C.filters.define("date_short",((t,i="d/m/y")=>{if(!t)return;const e=new Date(parseInt(t)*1e3);t=i.replace(/(d)/,e.getDate().toString());t=t.replace(/(m)/,(e.getMonth()+1).toString());t=t.replace(/(y)/,e.getFullYear().toString());return t}));C.filters.define("public_name",(t=>{if(!t)return;t=t.split("_").map((t=>t.length<3?t.toUpperCase():t)).join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}));C.filters.define("trim_to",((t,i=100)=>{if(!t)return;if(t.length<=i)return t;return t.substr(0,i)+"..."}));C.filters.define("classname",(t=>{if(!t)return;return t.replace(/[\W]+/g,"")}));C.filters.define("abs_url",((t,i=null,e)=>{if(!i)return t;if(!t)return;let s=undefined;if(i.domains&&e&&e.origin){const t=i.domains.find((t=>t.origin===e.origin));s=t?t.domain:""}else if(i.domain)s=i.domain;if(!s)return t;return t.match(/^http/)?t:location.protocol+"//"+s+t}));C.filters.define("replace",((t,i,e)=>t.replace(i,e)));C.filters.define("remove_spaces",(t=>t.replace(/ /g,"_")));C.filters.define("add_spaces",(t=>t=t.replace(/[_\-]/g," ")));C.filters.define("capitalise",(t=>t=t.charAt(0).toUpperCase()+t.slice(1)));C.filters.define("lowercase",(t=>t=t.toLowerCase()));const j=C;const I=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{position:relative;display:block}:host ::slotted([slot=search-template]){display:none !important}.loader{opacity:0;position:fixed;block-size:100%;inline-size:100%;min-block-size:100%;max-block-size:100vh !important;max-inline-size:100vw !important;inset-inline-start:0;inset-block-start:0;z-index:-10;font-size:60px;display:flex;align-items:center;justify-content:center;transition:opacity 0.2s ease, z-index 0.01s ease 0.2s}.loader.loading{opacity:1;z-index:10;transition:z-index 0.01s ease, opacity 0.2s ease 0.01s}.default{block-size:100%}.default:focus{outline:none}.results{opacity:0;outline:none;overflow:auto;transition:transform 0.3s ease, opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s;transform:translate(0, 100px);visibility:hidden;z-index:-1;position:absolute;inset-block-start:0;inset-inline-start:0;display:none}.results-container{position:relative}.results.show{transition:z-index 0.01s ease, visibility 0.01s ease, transform 0.3s ease 0.01s, opacity 0.3s ease 0.01s, overflow 0.01s ease 0.31s;transform:translate(0, 0);visibility:visible;opacity:1;z-index:10;overflow:hidden}.results.shown{block-size:auto !important;inline-size:auto !important;display:block;position:static;transform:none;z-index:auto;visibility:inherit;opacity:initial;overflow:visible}";const S=class{constructor(t){e(this,t);this.nanoDidLoad=s(this,"nanoDidLoad",7);this.nanoResultsShown=s(this,"nanoResultsShown",3);this.nanoBeforeQuery=s(this,"nanoBeforeQuery",7);this.nanoAfterQuery=s(this,"nanoAfterQuery",7);this.nanoNewResults=s(this,"nanoNewResults",7);this.staticFacetFilters={};this.dynFacetFilters={};this.hasLoadSlot=false;this.placedAlgoliaEles=[];this.promiseQueue=new w;this.searchChange=async()=>{if(!this.algoliaIndex)return;if(!this.query||this.query.length<this.minChars){if(!this.browseIndex){if(!this.query||this.query.length===0){this.handleSearchReset();return}else return}else if(this.query!=="*"){this.query="*";return}}this.isLoading=true;setTimeout((async()=>{this.resetPage();await this.algoliaSearch(v.Init);await this.updateContent();setTimeout((t=>this.isLoading=false),800);this.showResults=true;this.nanoResultsShown.emit(this.indexResults)}),200)};this.makeAppliedFilters=()=>{const t=[];const i=i=>{Object.values(i).forEach((i=>{if(i.value&&i.value.length){const e=t.find((t=>t.name===i.facetName));if(!e)t.push({name:i.facetName,values:[...i.value]});else e.values=[...e.values,...i.value]}}))};i(this.dynFacetFilters);i(this.staticFacetFilters);if(t.length)return t;return null};this.algoliaSearch=async t=>this.promiseQueue.enqueue((()=>this.queueSearch(t)));this.queueSearch=async t=>{if(!this.algoliaIndex||!this.query||!this.searchIndex||!this.searchIndex.index)return;this.nanoBeforeQuery.emit(this.indexResults);if(v.Init===t)this.clearAllFacetFilters();const i={filters:this.algoliaFilterStr(),page:this.indexResults?this.indexResults.currentPage:0};if(this.searchIndex.filters)i.facets=this.searchIndex.filters;if(this.searchIndex.hitsPerPage)i.hitsPerPage=this.searchIndex.hitsPerPage;let e=await this.algoliaIndex.search(this.query,i);e=this.fixDomain(e);this.changeEvent=t;if(t===v.Init||!this.indexResults){this.indexResults={currentPage:0,totalHits:e.nbHits,hitsPerPage:null,origFilters:e.facets,query:this.query,domain:this.searchIndex.domain||null,totalHitsWithFilters:0,results:[],totalPages:0,appliedFilters:this.makeAppliedFilters(),indexName:this.searchIndex.name||null,index:this.searchIndex.index}}this.indexResults.dynFilters=e.facets;this.indexResults.results=e.hits;this.indexResults.totalHitsWithFilters=e.nbHits;this.indexResults.currentPage=e.page;this.indexResults.totalPages=e.nbPages;this.indexResults.hitsPerPage=e.hitsPerPage;this.indexResults.query=e.query;if(this.changeEvent!==v.Page&&this.changeEvent!==v.Replica){this.facets=e.facets}this.nanoAfterQuery.emit(this.indexResults);return new Promise((t=>{setTimeout((()=>t("tpl updated")),20)})).then((t=>{this.currentHits=this.indexResults.results;this.resultsPage=this.indexResults.currentPage}))};this.handleSearchReset=()=>{this.showResults=false;this.indexResults=null};this.onResultDisplay=()=>{n((()=>{this.resultsDiv.removeEventListener("transitionend",this.onResultDisplay);if(!this.showResults)this.resultsDiv.style.display="none";else{this.defaultDiv.style.display="none";this.resultsDiv.classList.add("shown");this.resultsDiv.style.minHeight="";this.resultsDiv.style.width=""}}))};this._dynFacetFilters={};this.inputField=undefined;this.algoliaIndex=undefined;this.indeces=[];this.resultsEmitterEle=undefined;this.indexResults=undefined;this.filterChanged="";this.currentHits=undefined;this.changeEvent=v.Init;this.isLoading=false;this.wormholeState=this;this.showResults=false;this.resultsPage=0;this.appId=undefined;this.apiKey=undefined;this.searchIndex={};this.searchIndexName="";this.listenTo=null;this.query="";this.operator="and";this.filters=[];this.tplEngine=j;this.tplRenderFn=j.render;this.replicaIndex="";this.browseIndex=false;this.minChars=2;this.storeId=undefined;this.storeMethod="session"}async removeFilters(t,i){if(!t&&!i)this.clearAllFacetFilters();else{Object.keys(this._dynFacetFilters).forEach((e=>{if(t&&this._dynFacetFilters[e].facetName===t){if(!i)this._dynFacetFilters[e].element.value="";else{this._dynFacetFilters[e].element.value=this._dynFacetFilters[e].value.filter((t=>t!==i))}}}))}}onAllTplUpdate(t){t.stopPropagation();if(t.target.tagName==="NANO-ALGOLIA-RESULTS"){requestAnimationFrame((()=>{this.nanoNewResults.emit(this.indexResults)}))}}async onPageChange(t){if(!this.indexResults)return;let i=this.resultsPage;if(t){t.stopPropagation();i=t.detail.page}i=Math.min(this.indexResults.totalPages-1,i);i=Math.max(i,0);if(this.indexResults.currentPage===i)return;this.indexResults.currentPage=i;await this.algoliaSearch(v.Page)}async onFilterChange(t){t.stopPropagation();const i={};const e=t.detail;e.element=t.target;if(this.indexResults){if(this.staticFacetFilters[e.filterId])this.staticFacetFilters[e.filterId]=e;else{i[e.filterId]=e;this._dynFacetFilters=Object.assign(Object.assign({},this._dynFacetFilters),i)}this.indexResults.appliedFilters=this.makeAppliedFilters()}else this.staticFacetFilters[e.filterId]=e;this.filterChanged=e.value&&e.value.length?e.filterId:"all";this.resetPage();this.algoliaSearch(v.Filter)}dynFacetFiltersChange(){Object.values(this._dynFacetFilters).forEach((t=>{if(this.host.ownerDocument===t.element.ownerDocument)this.dynFacetFilters[t.filterId]=t;else delete this.dynFacetFilters[t.filterId]}))}browseIndexChange(){if(this.browseIndex&&(!this.query||this.query.length<this.minChars)){this.query="*"}}inputFieldSet(){if(!this.inputField)return;if(this.query!=="*"&&this.inputField&&this.inputField.value!==this.query)this.inputField.value=this.query}queryChange(){this.searchChange()}async internalIndexSwitch(){if(!this.replicaIndex||!this.indexResults||this.indexResults.index===this.replicaIndex)return;this.indexResults.index=this.replicaIndex;this.algoliaIndex=this.algoliaClient.initIndex(this.indexResults.index);this.resetPage();this.algoliaSearch(v.Replica)}pageChange(){this.onPageChange()}searchIndexNameChange(){if(!this.searchIndexName||!this.searchIndexName.length||this.searchIndex&&this.searchIndex.index===this.searchIndexName)return;this.searchIndex={index:this.searchIndexName}}initAlgoliaClient(){if(!this.appId||!this.apiKey)return;this.algoliaClient=o(this.appId,this.apiKey)}initAlgoliaIndex(){if(!this.algoliaClient||!this.searchIndex)return;if(this.searchIndex.index){if(this.replicaIndex)this.searchIndex.index=this.replicaIndex;this.searchIndexName=this.searchIndex.index;this.algoliaIndex=this.algoliaClient.initIndex(this.searchIndex.index);this.searchChange()}}showResultsChange(){if(!this.resultsDiv||!this.defaultDiv)return;if(this.showResults){this.resultsDiv.style.width=this.host.scrollWidth+"px";this.resultsDiv.style.minHeight=this.host.scrollHeight+"px";n((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.style.display="block";setTimeout((()=>this.resultsDiv.classList.add("show")),50)}))}else{n((()=>{this.resultsDiv.classList.remove("shown");this.defaultDiv.style.display="block";setTimeout((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.classList.remove("show");if(!!this.slottedInput)this.slottedInput.focus({preventScroll:true});else this.defaultDiv.focus({preventScroll:true})}),50)}))}}handleFilterpropChange(){this.algoliaSearch(v.Init)}fixDomain(t){if(!this.searchIndex||!this.searchIndex.domain)return t;t.hits.map((t=>{if(t.url&&!t.url.match(/^http/))t.url=location.protocol+"//"+this.searchIndex.domain+t.url}));return t}resetPage(){if(!this.indexResults)return;this.indexResults.currentPage=0}clearAllFacetFilters(){Object.values(this._dynFacetFilters).forEach((t=>{t.element.value=""}));this._dynFacetFilters={}}algoliaFilterStr(){const t={};const i=i=>{let e;let s;Object.keys(i).forEach((n=>{e=i[n];t[n]=t[n]||{name:e.facetName,or:[],and:[],not:[]};s=t[n][e.operator];if(e.value&&e.value.length){t[n][e.operator]=[...s,...e.value]}}))};i(this.dynFacetFilters);i(this.staticFacetFilters);const e=(t,i)=>{if(i.indexOf(" ")>-1)return t+':"'+i+'"';else return t+":"+i};let s=[];let n;let r;Object.values(t).forEach((function(t){Object.keys(t).filter((t=>t.match(/(or|and|not)/))).forEach((i=>{n=t;r=t.name;if(i==="or"||i==="and"){if(n[i].length){s.push("( "+n[i].map((t=>{if(t.length)return e(r,t)})).join(" "+i.toLocaleUpperCase()+" ")+" )")}}else{if(n.not.length){s.push("( "+n[i].map((t=>{if(t.length)return"NOT "+e(r,t)})).join(" AND ")+" )")}}}))}));s=[...this.filters,...s];return s.join(" "+this.operator.toLocaleUpperCase()+" ")}handleInputChange(t){if(t.target!==this.inputField)return;this.query=this.inputField.value}async updateContent(){return this.promiseQueue.enqueue((()=>this.updateContentQueue()))}async updateContentQueue(){const t=this.outputSlot||this.resultsDiv;if(!t||!this.tpl)return"no tpl";const i=document.createElement("div");i.innerHTML=this.tpl;const e=[];this.placedAlgoliaEles=[];Array.from(i.querySelectorAll("nano-algolia, nano-algolia-filter, nano-algolia-results")).forEach(((t,i)=>{const s=document.createElement("div");s.dataset.placeholderId=i.toString();s.classList.add("nano-ele-placeholder");e.push(t);t.parentNode.replaceChild(s,t)}));t.innerHTML=this.tplRenderFn(i.innerHTML.replace(/&gt;/gm,">").replace(/&lt;/gm,"<").replace(/&amp;/gm,"&"),this.indexResults);Array.from(t.querySelectorAll("div.nano-ele-placeholder")).forEach((t=>{t.parentNode.replaceChild(e[parseInt(t.dataset.placeholderId)],t);this.placedAlgoliaEles.push(e[parseInt(t.dataset.placeholderId)])}));if(!this.placedAlgoliaEles.length)return Promise.resolve("algolia setup");return new Promise((i=>{const e=s=>{this.placedAlgoliaEles=this.placedAlgoliaEles.filter((t=>t!==s.detail));if(!this.placedAlgoliaEles.length){setTimeout((()=>i("tpl updated")),500);t.removeEventListener("nanoTplUpdated",e)}};t.addEventListener("nanoTplUpdated",e)}))}componentWillLoad(){r((t=>{this.tplSlot=l(this.host,'[slot="template"]')[0];this.outputSlot=l(this.host,'[slot="output"]')[0];this.slottedInput=l(this.host,'[slot="search-input"]')[0];this.hasLoadSlot=!!l(this.host,'[slot="loader"]')[0];if(!!this.tplSlot)this.tpl=this.tplSlot.innerHTML||this.tplSlot.innerText;if(this.slottedInput&&(this.slottedInput.tagName.toLocaleLowerCase()==="nano-input"||this.slottedInput instanceof HTMLInputElement)){this.inputField=this.slottedInput}else if(this.slottedInput){this.inputField=this.slottedInput.querySelector('nano-input, input:not([type="radio"]):not([type="checkbox"])')}n((t=>{if(this.showResults&&this.tpl)this.searchChange()}))}));this.searchIndexNameChange();this.initAlgoliaClient();this.initAlgoliaIndex();y.create(this,this.wormholeState);if(this.storeId){u.init(this,["query","replicaIndex"],this.storeMethod,this.storeId);u.init(this,["apiKey","appId","searchIndex"],"session",this.storeId+"_api")}this.internalIndexSwitch()}connectedCallback(){this.searchChange=p(this.searchChange,300);this.browseIndexChange();this.host.dispatchEvent(new CustomEvent("nanoDidLoad",{detail:this.host}))}render(){const t={indexResults:this.indexResults,results:this.currentHits,filterChanged:this.filterChanged,tplRenderFn:this.tplRenderFn,resultsPage:this.resultsPage,changeEvent:this.changeEvent,facets:this.facets,algoliaIndex:this.algoliaIndex,searchIndex:this.searchIndex,globalStoreMethod:this.storeMethod,isLoading:this.isLoading};return a(h,{class:{"show-results":this.showResults,"is-loading":this.isLoading},"aria-busy":this.isLoading},this.hasLoadSlot&&a("div",{hidden:!this.isLoading},a("slot",{name:"loader"})),!this.hasLoadSlot&&a("div",{class:{loader:true,loading:this.isLoading}},a("nano-spinner",{overlay:true,type:"circle"})),a(y.Provider,{state:t},a("slot",{name:"search-input"}),a("div",{class:"results-container","aria-live":"polite"},a("div",{ref:t=>this.resultsDiv=t,class:"results"},a("slot",{name:"output"})))),a("div",{ref:t=>this.defaultDiv=t,class:"default",tabindex:"-1"},a("slot",null)))}get host(){return t(this)}static get watchers(){return{_dynFacetFilters:["dynFacetFiltersChange"],browseIndex:["browseIndexChange"],inputField:["inputFieldSet"],query:["queryChange"],replicaIndex:["internalIndexSwitch"],resultsPage:["pageChange"],searchIndexName:["searchIndexNameChange"],apiKey:["initAlgoliaClient"],appId:["initAlgoliaClient"],searchIndex:["initAlgoliaIndex"],showResults:["showResultsChange"],filters:["handleFilterpropChange"]}}};S.style=I;export{S as nano_algolia};
5
- //# sourceMappingURL=p-80e42c89.entry.js.map
4
+ import{g as t,e as i,r as e,c as s,w as n,d as r,h as a,a as h}from"./p-bf91c50e.js";import{a as o}from"./p-ed6adde2.js";import{g as l}from"./p-257432ff.js";import{C as u}from"./p-909a424c.js";import{b as f,c,a as d}from"./p-69a3e911.js";import{d as p}from"./p-9746b0a5.js";import{S as v}from"./p-ed2e6f32.js";var m=new Map;var g=function(t,i){var e=t.fields,s=t.updater;e.forEach((function(t){s(t,i[t])}))};var y={create:function(i,e){var s=t(i);var n=new Map;var r={wormholes:n,state:e};m.set(i,r);var a=i.connectedCallback;i.connectedCallback=function(){m.set(i,r);if(a){a.call(i)}};var h=i.disconnectedCallback;i.disconnectedCallback=function(){m.delete(i);if(h){h.call(i)}};s.addEventListener("openWormhole",(function(t){t.stopPropagation();var i=t.detail,e=i.consumer,s=i.onOpen;if(n.has(e))return;if(typeof e!=="symbol"){var a=e.connectedCallback,h=e.disconnectedCallback;e.connectedCallback=function(){n.set(e,t.detail);if(a){a.call(e)}};e.disconnectedCallback=function(){n.delete(e);if(h){h.call(e)}}}n.set(e,t.detail);g(t.detail,r.state);s===null||s===void 0?void 0:s.resolve((function(){n.delete(e)}))}));s.addEventListener("closeWormhole",(function(t){var i=t.detail;n.delete(i)}))},Provider:function(t,e){var s=t.state;var n=i();if(m.has(n)){var r=m.get(n);r.state=s;r.wormholes.forEach((function(t){g(t,s)}))}return e}};class b{constructor(){this.queue=[];this.workingOnPromise=false;this.stop=false;this.limit=null}enqueue(t){return new Promise(((i,e)=>{this.queue.push({promise:t,resolve:i,reject:e});this.dequeue()}))}dequeue(){if(this.workingOnPromise){return false}if(this.stop){this.queue=[];this.stop=false;return}const t=this.queue.shift();if(!t){return false}try{this.workingOnPromise=true;t.promise().then((i=>{this.workingOnPromise=false;t.resolve(i);this.dequeue()})).catch((i=>{this.workingOnPromise=false;t.reject(i);this.dequeue()}))}catch(i){this.workingOnPromise=false;t.reject(i);this.dequeue()}return true}}b.pendingPromise=false;var w=c((function(t,i){!function(t,e){e(i)}(d,(function(t){function i(t){var e,s,n=new Error(t);return e=n,s=i.prototype,Object.setPrototypeOf?Object.setPrototypeOf(e,s):e.__proto__=s,n}function e(t,e,s){var n=e.slice(0,s).split(/\n/),r=n.length,a=n[r-1].length+1;throw i(t+=" at line "+r+" col "+a+":\n\n "+e.split(/\n/)[r-1]+"\n "+Array(a).join(" ")+"^")}i.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var s=new Function("return this")().Promise,n=!1;try{n=new Function("return (async function(){}).constructor")()}catch(t){if(!(t instanceof SyntaxError))throw t}function r(t,i){return Object.prototype.hasOwnProperty.call(t,i)}function a(t,i,e){for(var s in i)r(i,s)&&(null==i[s]||"object"!=typeof i[s]||"storage"!==s&&"prefixes"!==s||e?t[s]=i[s]:t[s]=a({},i[s]));return t}var h=/^async +/,o=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,l=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,u=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,f=/[.*+\-?^${}()|[\]\\]/g;function c(t){return f.test(t)?t.replace(f,"\\$&"):t}function d(t,s){s.rmWhitespace&&(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),o.lastIndex=0,l.lastIndex=0,u.lastIndex=0;var n=s.prefixes,r=[n.h,n.b,n.i,n.r,n.c,n.e].reduce((function(t,i){return t&&i?t+"|"+c(i):i?c(i):t}),""),a=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+c(s.tags[1])+")","g"),f=new RegExp("([^]*?)"+c(s.tags[0])+"(-|_)?\\s*("+r+")?\\s*","g"),d=0,p=!1;function v(i,n){var r,c={f:[]},v=0,m="c";function g(i){var n=t.slice(d,i),r=n.trim();if("f"===m)"safe"===r?c.raw=!0:s.async&&h.test(r)?(r=r.replace(h,""),c.f.push([r,"",!0])):c.f.push([r,""]);else if("fp"===m)c.f[c.f.length-1][1]+=r;else if("err"===m){if(r){var a=n.search(/\S/);e("invalid syntax",t,d+a)}}else c[m]=r;d=i+1}for("h"===n||"b"===n||"c"===n?m="n":"r"===n&&(c.raw=!0,n="i"),a.lastIndex=d;null!==(r=a.exec(t));){var y=r[1],b=r[2],w=r[3],x=r[4],F=r[5],C=r.index;if(y)"("===y?(0===v&&("n"===m?(g(C),m="p"):"f"===m&&(g(C),m="fp")),v++):")"===y?0===--v&&"c"!==m&&(g(C),m="err"):0===v&&"|"===y?(g(C),m="f"):"=>"===y&&(g(C),d+=1,m="res");else if(b){if("/*"===b){var j=t.indexOf("*/",a.lastIndex);-1===j&&e("unclosed comment",t,r.index),a.lastIndex=j+2}else if("'"===b){l.lastIndex=r.index,l.exec(t)?a.lastIndex=l.lastIndex:e("unclosed string",t,r.index)}else if('"'===b){u.lastIndex=r.index,u.exec(t)?a.lastIndex=u.lastIndex:e("unclosed string",t,r.index)}else if("`"===b){o.lastIndex=r.index,o.exec(t)?a.lastIndex=o.lastIndex:e("unclosed string",t,r.index)}}else if(w)return g(C),d=C+r[0].length,f.lastIndex=d,p=F,x&&"h"===n&&(n="s"),c.t=n,c}return e("unclosed tag",t,i),c}var m=function r(a,o){a.b=[],a.d=[];var l,u=!1,c=[];function m(t,i){t&&(t=function(t,i,e,s){var n,r;return"string"==typeof i.autoTrim?n=r=i.autoTrim:Array.isArray(i.autoTrim)&&(n=i.autoTrim[1],r=i.autoTrim[0]),(e||!1===e)&&(n=e),(s||!1===s)&&(r=s),"slurp"===n&&"slurp"===r?t.trim():("_"===n||"slurp"===n?t=String.prototype.trimLeft?t.trimLeft():t.replace(/^[\s\uFEFF\xA0]+/,""):"-"!==n&&"nl"!==n||(t=t.replace(/^(?:\n|\r|\r\n)/,"")),"_"===r||"slurp"===r?t=String.prototype.trimRight?t.trimRight():t.replace(/[\s\uFEFF\xA0]+$/,""):"-"!==r&&"nl"!==r||(t=t.replace(/(?:\n|\r|\r\n)$/,"")),t)}(t,s,p,i))&&(t=t.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),c.push(t))}for(;null!==(l=f.exec(t));){var g,y=l[1],b=l[2],w=l[3]||"";for(var x in n)if(n[x]===w){g=x;break}m(y,b),d=l.index+l[0].length,g||e("unrecognized tag type: "+w,t,d);var F=v(l.index,g),C=F.t;if("h"===C){var j=F.n||"";s.async&&h.test(j)&&(F.a=!0,F.n=j.replace(h,"")),F=r(F),c.push(F)}else if("c"===C){if(a.n===F.n)return u?(u.d=c,a.b.push(u)):a.d=c,a;e("Helper start and end don't match",t,l.index+l[0].length)}else if("b"===C){u?(u.d=c,a.b.push(u)):a.d=c;var I=F.n||"";s.async&&h.test(I)&&(F.a=!0,F.n=I.replace(h,"")),u=F,c=[]}else if("s"===C){var S=F.n||"";s.async&&h.test(S)&&(F.a=!0,F.n=S.replace(h,"")),c.push(F)}else c.push(F)}if(!o)throw i('unclosed helper "'+a.n+'"');return m(t.slice(d,t.length),!1),a.d=c,a}({f:[]},!0);if(s.plugins)for(var g=0;g<s.plugins.length;g++){var y=s.plugins[g];y.processAST&&(m.d=y.processAST(m.d,s))}return m.d}function p(t,i){var e=d(t,i),s="var tR='';"+(i.useWith?"with("+i.varName+"||{}){":"")+b(e,i)+"if(cb){cb(null,tR)} return tR"+(i.useWith?"}":"");if(i.plugins)for(var n=0;n<i.plugins.length;n++){var r=i.plugins[n];r.processFnString&&(s=r.processFnString(s,i))}return s}function v(t,i){for(var e=0;e<i.length;e++){var s=i[e][0],n=i[e][1];t=(i[e][2]?"await ":"")+"c.l('F','"+s+"')("+t,n&&(t+=","+n),t+=")"}return t}function m(t,i,e,s,n,r){var a="{exec:"+(n?"async ":"")+y(e,i,t)+",params:["+s+"]";return r&&(a+=",name:'"+r+"'"),n&&(a+=",async:true"),a+="}"}function g(t,i){for(var e="[",s=0;s<t.length;s++){var n=t[s];e+=m(i,n.res||"",n.d,n.p||"",n.a,n.n),s<t.length&&(e+=",")}return e+="]"}function y(t,i,e){return"function("+i+"){var tR='';"+b(t,e)+"return tR}"}function b(t,i){for(var e=0,s=t.length,n="";e<s;e++){var r=t[e];if("string"==typeof r){n+="tR+='"+r+"';"}else{var a=r.t,h=r.c||"",o=r.f,l=r.n||"",u=r.p||"",f=r.res||"",c=r.b,d=!!r.a;if("i"===a){i.defaultFilter&&(h="c.l('F','"+i.defaultFilter+"')("+h+")");var p=v(h,o);!r.raw&&i.autoEscape&&(p="c.l('F','e')("+p+")"),n+="tR+="+p+";"}else if("h"===a)if(i.storage.nativeHelpers.get(l))n+=i.storage.nativeHelpers.get(l)(r,i);else{var y=(d?"await ":"")+"c.l('H','"+l+"')("+m(i,f,r.d,u,d);y+=c?","+g(c,i):",[]",n+="tR+="+v(y+=",c)",o)+";"}else"s"===a?n+="tR+="+v((d?"await ":"")+"c.l('H','"+l+"')({params:["+u+"]},[],c)",o)+";":"e"===a&&(n+=h+"\n")}}return n}var w=function(){function t(t){this.cache=t}return t.prototype.define=function(t,i){this.cache[t]=i},t.prototype.get=function(t){return this.cache[t]},t.prototype.remove=function(t){delete this.cache[t]},t.prototype.reset=function(){this.cache={}},t.prototype.load=function(t){a(this.cache,t,!0)},t}();function x(t,e,s,n){if(e&&e.length>0)throw i((n?"Native":"")+"Helper '"+t+"' doesn't accept blocks");if(s&&s.length>0)throw i((n?"Native":"")+"Helper '"+t+"' doesn't accept filters")}var F={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function C(t){return F[t]}var j=new w({}),I=new w({each:function(t,i){var e="",s=t.params[0];if(x("each",i,!1),t.async)return new Promise((function(i){!function t(i,e,s,n,r){s(i[e],e).then((function(a){n+=a,e===i.length-1?r(n):t(i,e+1,s,n,r)}))}(s,0,t.exec,e,i)}));for(var n=0;n<s.length;n++)e+=t.exec(s[n],n);return e},foreach:function(t,i){var e=t.params[0];if(x("foreach",i,!1),t.async)return new Promise((function(i){!function t(i,e,s,n,r,a){n(e[s],i[e[s]]).then((function(h){r+=h,s===e.length-1?a(r):t(i,e,s+1,n,r,a)}))}(e,Object.keys(e),0,t.exec,"",i)}));var s="";for(var n in e)r(e,n)&&(s+=t.exec(n,e[n]));return s},include:function(t,e,s){x("include",e,!1);var n=s.storage.templates.get(t.params[0]);if(!n)throw i('Could not fetch template "'+t.params[0]+'"');return n(t.params[1],s)},extends:function(t,e,s){var n=t.params[1]||{};n.content=t.exec();for(var r=0;r<e.length;r++){var a=e[r];n[a.name]=a.exec()}var h=s.storage.templates.get(t.params[0]);if(!h)throw i('Could not fetch template "'+t.params[0]+'"');return h(n,s)},useScope:function(t,i){return x("useScope",i,!1),t.exec(t.params[0])}}),S=new w({if:function(t,i){x("if",!1,t.f,!0);var e="if("+t.p+"){"+b(t.d,i)+"}";if(t.b)for(var s=0;s<t.b.length;s++){var n=t.b[s];"else"===n.n?e+="else{"+b(n.d,i)+"}":"elif"===n.n&&(e+="else if("+n.p+"){"+b(n.d,i)+"}")}return e},try:function(t,e){if(x("try",!1,t.f,!0),!t.b||1!==t.b.length||"catch"!==t.b[0].n)throw i("native helper 'try' only accepts 1 block, 'catch'");var s="try{"+b(t.d,e)+"}",n=t.b[0];return s+="catch"+(n.res?"("+n.res+")":"")+"{"+b(n.d,e)+"}"},block:function(t,i){return x("block",t.b,t.f,!0),"if(!"+i.varName+"["+t.p+"]){tR+=("+y(t.d,"",i)+")()}else{tR+="+i.varName+"["+t.p+"]}"}}),z=new w({e:function(t){var i=String(t);return/[&<>"']/.test(i)?i.replace(/[&<>"']/g,C):i}}),O={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(t,e){if("H"===t){var s=this.storage.helpers.get(e);if(s)return s;throw i("Can't find helper '"+e+"'")}if("F"===t){var n=this.storage.filters.get(e);if(n)return n;throw i("Can't find filter '"+e+"'")}},async:!1,storage:{helpers:I,nativeHelpers:S,filters:z,templates:j},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function R(t,i){var e={};return a(e,O),i&&a(e,i),t&&a(e,t),e.l.bind(e),e}function A(t,e){var s=R(e||{}),r=Function;if(s.async){if(!n)throw i("This environment doesn't support async/await");r=n}try{return new r(s.varName,"c","cb",p(t,s))}catch(e){throw e instanceof SyntaxError?i("Bad template syntax\n\n"+e.message+"\n"+Array(e.message.length+1).join("=")+"\n"+p(t,s)):e}}function k(t,i){var e;return i.cache&&i.name&&i.storage.templates.get(i.name)?i.storage.templates.get(i.name):(e="function"==typeof t?t:A(t,i),i.cache&&i.name&&i.storage.templates.define(i.name,e),e)}O.l.bind(O),t.compile=A,t.compileScope=b,t.compileScopeIntoFunction=y,t.compileToString=p,t.defaultConfig=O,t.filters=z,t.getConfig=R,t.helpers=I,t.nativeHelpers=S,t.parse=d,t.render=function(t,e,n,r){var a=R(n||{});if(!a.async)return k(t,a)(e,a);if(!r){if("function"==typeof s)return new s((function(i,s){try{i(k(t,a)(e,a))}catch(t){s(t)}}));throw i("Please provide a callback function, this env doesn't support Promises")}try{k(t,a)(e,a,r)}catch(t){return r(t)}},t.templates=j,Object.defineProperty(t,"__esModule",{value:!0})}))}));const x=f(w);const F=Object.freeze(Object.assign(Object.create(null),w,{default:x}));const C=F;C.filters.define("date_long",((t,i={year:"numeric",month:"long",day:"numeric"})=>{if(!t)return;const e=new Date(parseInt(t)*1e3);t=e.toLocaleDateString("en-GB",i);return t}));C.filters.define("date_short",((t,i="d/m/y")=>{if(!t)return;const e=new Date(parseInt(t)*1e3);t=i.replace(/(d)/,e.getDate().toString());t=t.replace(/(m)/,(e.getMonth()+1).toString());t=t.replace(/(y)/,e.getFullYear().toString());return t}));C.filters.define("public_name",(t=>{if(!t)return;t=t.split("_").map((t=>t.length<3?t.toUpperCase():t)).join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}));C.filters.define("trim_to",((t,i=100)=>{if(!t)return;if(t.length<=i)return t;return t.substr(0,i)+"..."}));C.filters.define("classname",(t=>{if(!t)return;return t.replace(/[\W]+/g,"")}));C.filters.define("abs_url",((t,i=null,e)=>{if(!i)return t;if(!t)return;let s=undefined;if(i.domains&&e&&e.origin){const t=i.domains.find((t=>t.origin===e.origin));s=t?t.domain:""}else if(i.domain)s=i.domain;if(!s)return t;return t.match(/^http/)?t:location.protocol+"//"+s+t}));C.filters.define("replace",((t,i,e)=>t.replace(i,e)));C.filters.define("remove_spaces",(t=>t.replace(/ /g,"_")));C.filters.define("add_spaces",(t=>t=t.replace(/[_\-]/g," ")));C.filters.define("capitalise",(t=>t=t.charAt(0).toUpperCase()+t.slice(1)));C.filters.define("lowercase",(t=>t=t.toLowerCase()));const j=C;const I=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{position:relative;display:block}:host ::slotted([slot=search-template]){display:none !important}.loader{opacity:0;position:fixed;block-size:100%;inline-size:100%;min-block-size:100%;max-block-size:100vh !important;max-inline-size:100vw !important;inset-inline-start:0;inset-block-start:0;z-index:-10;font-size:60px;display:flex;align-items:center;justify-content:center;transition:opacity 0.2s ease, z-index 0.01s ease 0.2s}.loader.loading{opacity:1;z-index:10;transition:z-index 0.01s ease, opacity 0.2s ease 0.01s}.default{block-size:100%}.default:focus{outline:none}.results{opacity:0;outline:none;overflow:auto;transition:transform 0.3s ease, opacity 0.3s ease, visibility 0.01s ease 0.3s, z-index 0.01s ease 0.3s;transform:translate(0, 100px);visibility:hidden;z-index:-1;position:absolute;inset-block-start:0;inset-inline-start:0;display:none}.results-container{position:relative}.results.show{transition:z-index 0.01s ease, visibility 0.01s ease, transform 0.3s ease 0.01s, opacity 0.3s ease 0.01s, overflow 0.01s ease 0.31s;transform:translate(0, 0);visibility:visible;opacity:1;z-index:10;overflow:hidden}.results.shown{block-size:auto !important;inline-size:auto !important;display:block;position:static;transform:none;z-index:auto;visibility:inherit;opacity:initial;overflow:visible}";const S=class{constructor(t){e(this,t);this.nanoDidLoad=s(this,"nanoDidLoad",7);this.nanoResultsShown=s(this,"nanoResultsShown",3);this.nanoBeforeQuery=s(this,"nanoBeforeQuery",7);this.nanoAfterQuery=s(this,"nanoAfterQuery",7);this.nanoNewResults=s(this,"nanoNewResults",7);this.staticFacetFilters={};this.dynFacetFilters={};this.hasLoadSlot=false;this.placedAlgoliaEles=[];this.promiseQueue=new b;this.searchChange=async()=>{if(!this.algoliaIndex)return;if(!this.query||this.query.length<this.minChars){if(!this.browseIndex){if(!this.query||this.query.length===0){this.handleSearchReset();return}else return}else if(this.query!=="*"){this.query="*";return}}this.isLoading=true;setTimeout((async()=>{this.resetPage();await this.algoliaSearch(v.Init);await this.updateContent();setTimeout((t=>this.isLoading=false),800);this.showResults=true;this.nanoResultsShown.emit(this.indexResults)}),200)};this.makeAppliedFilters=()=>{const t=[];const i=i=>{Object.values(i).forEach((i=>{if(i.value&&i.value.length){const e=t.find((t=>t.name===i.facetName));if(!e)t.push({name:i.facetName,values:[...i.value]});else e.values=[...e.values,...i.value]}}))};i(this.dynFacetFilters);i(this.staticFacetFilters);if(t.length)return t;return null};this.algoliaSearch=async t=>this.promiseQueue.enqueue((()=>this.queueSearch(t)));this.queueSearch=async t=>{if(!this.algoliaIndex||!this.query||!this.searchIndex||!this.searchIndex.index)return;this.nanoBeforeQuery.emit(this.indexResults);if(v.Init===t)this.clearAllFacetFilters();const i={filters:this.algoliaFilterStr(),page:this.indexResults?this.indexResults.currentPage:0};if(this.searchIndex.filters)i.facets=this.searchIndex.filters;if(this.searchIndex.hitsPerPage)i.hitsPerPage=this.searchIndex.hitsPerPage;let e=await this.algoliaIndex.search(this.query,i);e=this.fixDomain(e);this.changeEvent=t;if(t===v.Init||!this.indexResults){this.indexResults={currentPage:0,totalHits:e.nbHits,hitsPerPage:null,origFilters:e.facets,query:this.query,domain:this.searchIndex.domain||null,totalHitsWithFilters:0,results:[],totalPages:0,appliedFilters:this.makeAppliedFilters(),indexName:this.searchIndex.name||null,index:this.searchIndex.index}}this.indexResults.dynFilters=e.facets;this.indexResults.results=e.hits;this.indexResults.totalHitsWithFilters=e.nbHits;this.indexResults.currentPage=e.page;this.indexResults.totalPages=e.nbPages;this.indexResults.hitsPerPage=e.hitsPerPage;this.indexResults.query=e.query;if(this.changeEvent!==v.Page&&this.changeEvent!==v.Replica){this.facets=e.facets}this.nanoAfterQuery.emit(this.indexResults);return new Promise((t=>{setTimeout((()=>t("tpl updated")),20)})).then((t=>{this.currentHits=this.indexResults.results;this.resultsPage=this.indexResults.currentPage}))};this.handleSearchReset=()=>{this.showResults=false;this.indexResults=null};this.onResultDisplay=()=>{n((()=>{this.resultsDiv.removeEventListener("transitionend",this.onResultDisplay);if(!this.showResults)this.resultsDiv.style.display="none";else{this.defaultDiv.style.display="none";this.resultsDiv.classList.add("shown");this.resultsDiv.style.minHeight="";this.resultsDiv.style.width=""}}))};this._dynFacetFilters={};this.inputField=undefined;this.algoliaIndex=undefined;this.indeces=[];this.resultsEmitterEle=undefined;this.indexResults=undefined;this.filterChanged="";this.currentHits=undefined;this.changeEvent=v.Init;this.isLoading=false;this.wormholeState=this;this.showResults=false;this.resultsPage=0;this.appId=undefined;this.apiKey=undefined;this.searchIndex={};this.searchIndexName="";this.listenTo=null;this.query="";this.operator="and";this.filters=[];this.tplEngine=j;this.tplRenderFn=j.render;this.replicaIndex="";this.browseIndex=false;this.minChars=2;this.storeId=undefined;this.storeMethod="session"}async removeFilters(t,i){if(!t&&!i)this.clearAllFacetFilters();else{Object.keys(this._dynFacetFilters).forEach((e=>{if(t&&this._dynFacetFilters[e].facetName===t){if(!i)this._dynFacetFilters[e].element.value="";else{this._dynFacetFilters[e].element.value=this._dynFacetFilters[e].value.filter((t=>t!==i))}}}))}}onAllTplUpdate(t){t.stopPropagation();if(t.target.tagName==="NANO-ALGOLIA-RESULTS"){requestAnimationFrame((()=>{this.nanoNewResults.emit(this.indexResults)}))}}async onPageChange(t){if(!this.indexResults)return;let i=this.resultsPage;if(t){t.stopPropagation();i=t.detail.page}i=Math.min(this.indexResults.totalPages-1,i);i=Math.max(i,0);if(this.indexResults.currentPage===i)return;this.indexResults.currentPage=i;await this.algoliaSearch(v.Page)}async onFilterChange(t){t.stopPropagation();const i={};const e=t.detail;e.element=t.target;if(this.indexResults){if(this.staticFacetFilters[e.filterId])this.staticFacetFilters[e.filterId]=e;else{i[e.filterId]=e;this._dynFacetFilters=Object.assign(Object.assign({},this._dynFacetFilters),i)}this.indexResults.appliedFilters=this.makeAppliedFilters()}else this.staticFacetFilters[e.filterId]=e;this.filterChanged=e.value&&e.value.length?e.filterId:"all";this.resetPage();this.algoliaSearch(v.Filter)}dynFacetFiltersChange(){Object.values(this._dynFacetFilters).forEach((t=>{if(this.host.ownerDocument===t.element.ownerDocument)this.dynFacetFilters[t.filterId]=t;else delete this.dynFacetFilters[t.filterId]}))}browseIndexChange(){if(this.browseIndex&&(!this.query||this.query.length<this.minChars)){this.query="*"}}inputFieldSet(){if(!this.inputField)return;if(this.query!=="*"&&this.inputField&&this.inputField.value!==this.query)this.inputField.value=this.query}queryChange(){this.searchChange()}async internalIndexSwitch(){if(!this.replicaIndex||!this.indexResults||this.indexResults.index===this.replicaIndex)return;this.indexResults.index=this.replicaIndex;this.algoliaIndex=this.algoliaClient.initIndex(this.indexResults.index);this.resetPage();this.algoliaSearch(v.Replica)}pageChange(){this.onPageChange()}searchIndexNameChange(){if(!this.searchIndexName||!this.searchIndexName.length||this.searchIndex&&this.searchIndex.index===this.searchIndexName)return;this.searchIndex={index:this.searchIndexName}}initAlgoliaClient(){if(!this.appId||!this.apiKey)return;this.algoliaClient=o(this.appId,this.apiKey)}initAlgoliaIndex(){if(!this.algoliaClient||!this.searchIndex)return;if(this.searchIndex.index){if(this.replicaIndex)this.searchIndex.index=this.replicaIndex;this.searchIndexName=this.searchIndex.index;this.algoliaIndex=this.algoliaClient.initIndex(this.searchIndex.index);this.searchChange()}}showResultsChange(){if(!this.resultsDiv||!this.defaultDiv)return;if(this.showResults){this.resultsDiv.style.width=this.host.scrollWidth+"px";this.resultsDiv.style.minHeight=this.host.scrollHeight+"px";n((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.style.display="block";setTimeout((()=>this.resultsDiv.classList.add("show")),50)}))}else{n((()=>{this.resultsDiv.classList.remove("shown");this.defaultDiv.style.display="block";setTimeout((()=>{this.resultsDiv.addEventListener("transitionend",this.onResultDisplay);this.resultsDiv.classList.remove("show");if(!!this.slottedInput)this.slottedInput.focus({preventScroll:true});else this.defaultDiv.focus({preventScroll:true})}),50)}))}}handleFilterpropChange(){this.algoliaSearch(v.Init)}fixDomain(t){if(!this.searchIndex||!this.searchIndex.domain)return t;t.hits.map((t=>{if(t.url&&!t.url.match(/^http/))t.url=location.protocol+"//"+this.searchIndex.domain+t.url}));return t}resetPage(){if(!this.indexResults)return;this.indexResults.currentPage=0}clearAllFacetFilters(){Object.values(this._dynFacetFilters).forEach((t=>{t.element.value=""}));this._dynFacetFilters={}}algoliaFilterStr(){const t={};const i=i=>{let e;let s;Object.keys(i).forEach((n=>{e=i[n];t[n]=t[n]||{name:e.facetName,or:[],and:[],not:[]};s=t[n][e.operator];if(e.value&&e.value.length){t[n][e.operator]=[...s,...e.value]}}))};i(this.dynFacetFilters);i(this.staticFacetFilters);const e=(t,i)=>{if(i.indexOf(" ")>-1)return t+':"'+i+'"';else return t+":"+i};let s=[];let n;let r;Object.values(t).forEach((function(t){Object.keys(t).filter((t=>t.match(/(or|and|not)/))).forEach((i=>{n=t;r=t.name;if(i==="or"||i==="and"){if(n[i].length){s.push("( "+n[i].map((t=>{if(t.length)return e(r,t)})).join(" "+i.toLocaleUpperCase()+" ")+" )")}}else{if(n.not.length){s.push("( "+n[i].map((t=>{if(t.length)return"NOT "+e(r,t)})).join(" AND ")+" )")}}}))}));s=[...this.filters,...s];return s.join(" "+this.operator.toLocaleUpperCase()+" ")}handleInputChange(t){if(t.target!==this.inputField)return;this.query=this.inputField.value}async updateContent(){return this.promiseQueue.enqueue((()=>this.updateContentQueue()))}async updateContentQueue(){const t=this.outputSlot||this.resultsDiv;if(!t||!this.tpl)return"no tpl";const i=document.createElement("div");i.innerHTML=this.tpl;const e=[];this.placedAlgoliaEles=[];Array.from(i.querySelectorAll("nano-algolia, nano-algolia-filter, nano-algolia-results")).forEach(((t,i)=>{const s=document.createElement("div");s.dataset.placeholderId=i.toString();s.classList.add("nano-ele-placeholder");e.push(t);t.parentNode.replaceChild(s,t)}));t.innerHTML=this.tplRenderFn(i.innerHTML.replace(/&gt;/gm,">").replace(/&lt;/gm,"<").replace(/&amp;/gm,"&"),this.indexResults);Array.from(t.querySelectorAll("div.nano-ele-placeholder")).forEach((t=>{t.parentNode.replaceChild(e[parseInt(t.dataset.placeholderId)],t);this.placedAlgoliaEles.push(e[parseInt(t.dataset.placeholderId)])}));if(!this.placedAlgoliaEles.length)return Promise.resolve("algolia setup");return new Promise((i=>{const e=s=>{this.placedAlgoliaEles=this.placedAlgoliaEles.filter((t=>t!==s.detail));if(!this.placedAlgoliaEles.length){setTimeout((()=>i("tpl updated")),500);t.removeEventListener("nanoTplUpdated",e)}};t.addEventListener("nanoTplUpdated",e)}))}componentWillLoad(){r((t=>{this.tplSlot=l(this.host,'[slot="template"]')[0];this.outputSlot=l(this.host,'[slot="output"]')[0];this.slottedInput=l(this.host,'[slot="search-input"]')[0];this.hasLoadSlot=!!l(this.host,'[slot="loader"]')[0];if(!!this.tplSlot)this.tpl=this.tplSlot.innerHTML||this.tplSlot.innerText;if(this.slottedInput&&(this.slottedInput.tagName.toLocaleLowerCase()==="nano-input"||this.slottedInput instanceof HTMLInputElement)){this.inputField=this.slottedInput}else if(this.slottedInput){this.inputField=this.slottedInput.querySelector('nano-input, input:not([type="radio"]):not([type="checkbox"])')}n((t=>{if(this.showResults&&this.tpl)this.searchChange()}))}));this.searchIndexNameChange();this.initAlgoliaClient();this.initAlgoliaIndex();y.create(this,this.wormholeState);if(this.storeId){u.init(this,["query","replicaIndex"],this.storeMethod,this.storeId);u.init(this,["apiKey","appId","searchIndex"],"session",this.storeId+"_api")}this.internalIndexSwitch()}connectedCallback(){this.searchChange=p(this.searchChange,300);this.browseIndexChange();this.host.dispatchEvent(new CustomEvent("nanoDidLoad",{detail:this.host}))}render(){const t={indexResults:this.indexResults,results:this.currentHits,filterChanged:this.filterChanged,tplRenderFn:this.tplRenderFn,resultsPage:this.resultsPage,changeEvent:this.changeEvent,facets:this.facets,algoliaIndex:this.algoliaIndex,searchIndex:this.searchIndex,globalStoreMethod:this.storeMethod,isLoading:this.isLoading};return a(h,{class:{"show-results":this.showResults,"is-loading":this.isLoading},"aria-busy":this.isLoading},this.hasLoadSlot&&a("div",{hidden:!this.isLoading},a("slot",{name:"loader"})),!this.hasLoadSlot&&a("div",{class:{loader:true,loading:this.isLoading}},a("nano-spinner",{overlay:true,type:"circle"})),a(y.Provider,{state:t},a("slot",{name:"search-input"}),a("div",{class:"results-container","aria-live":"polite"},a("div",{ref:t=>this.resultsDiv=t,class:"results"},a("slot",{name:"output"})))),a("div",{ref:t=>this.defaultDiv=t,class:"default",tabindex:"-1"},a("slot",null)))}get host(){return t(this)}static get watchers(){return{_dynFacetFilters:["dynFacetFiltersChange"],browseIndex:["browseIndexChange"],inputField:["inputFieldSet"],query:["queryChange"],replicaIndex:["internalIndexSwitch"],resultsPage:["pageChange"],searchIndexName:["searchIndexNameChange"],apiKey:["initAlgoliaClient"],appId:["initAlgoliaClient"],searchIndex:["initAlgoliaIndex"],showResults:["showResultsChange"],filters:["handleFilterpropChange"]}}};S.style=I;export{S as nano_algolia};
5
+ //# sourceMappingURL=p-f28c802d.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import{r as t,c as i,h as s,a as e,g as h}from"./p-f84612d4.js";import{c as r}from"./p-8e39d4ee.js";const a=class{constructor(s){t(this,s);this.nanoPayloadChange=i(this,"nanoPayloadChange",7);this.nanoSubmit=i(this,"nanoSubmit",7);this.nanoInvalid=i(this,"nanoInvalid",7);this.allFields=[];this.nanoFieldSelector=`\n nano-input,\n nano-select,\n nano-file-upload,\n nano-date-input,\n nano-checkbox\n `;this.hasSetStore=false;this.internalValidate=false;this.handleStoreChange=async(t,i)=>{const s=this.allFields.find((i=>this.getName(i)===t));if(s&&(s.tagName==="NANO-CHECKBOX"||["radio","checkbox"].includes(s.type))){this.storeToFields([s])}else if(s&&(s.tagName==="NANO-FILE-UPLOAD"&&!this.fileStateEqual(t,s)||s.tagName!=="NANO-FILE-UPLOAD"&&s.value!==i)){this.storeToFields([s])}if(this.validateOn==="dirty"&&this.dirty){this.internalValidate=true;await this.validateAllFields();this._valid=this.activeForm.checkValidity();this.internalValidate=false}this.nanoPayloadChange.emit(this._store.state)};this.handleFieldChange=t=>{if(!this.nanoFields.includes(t.target))return;this._dirty=true;this.fieldsToStore([t.target])};this.handlePlainFieldChange=t=>{if(!this.plainFields.includes(t.target))return;this.fieldsToStore([t.target])};this.handleFormInvalid=async t=>{if(!this.plainFields.includes(t.target)){t.preventDefault()}this._valid=false;if(this.internalValidate)return;if(this.validateOn==="submitThenDirty")this.validateOn="dirty";this.submitted=true;await this.validateAllFields();this.internalValidate=true;this._valid=this.activeForm.checkValidity();this.internalValidate=false;if(this.validateOn==="submit"){if(this._valid){this.submitForm();return}}this.scrollToFirstInvalid();this.nanoInvalid.emit()};this.handleSubmit=async t=>{t.preventDefault();if(this.validateOn==="submitThenDirty")this.validateOn="dirty";this.submitted=true;await this.validateAllFields();this.internalValidate=true;this._valid=this.activeForm.checkValidity();this.internalValidate=false;if(!this._valid){this.scrollToFirstInvalid();return}this.submitForm()};this.submitted=false;this.userForm=undefined;this.validateOn="submitThenDirty";this.scrollToInvalid=true;this._dirty=false;this._valid=undefined;this._store=undefined;this.extraFieldSelector="input, select, textarea";this.validation=undefined}userFormChange(){if(!!this.userForm)this.activeForm=this.userForm}get activeForm(){return this._activeForm}set activeForm(t){if(!t)return;if(this._activeForm){this._activeForm.removeEventListener("invalid",this.handleFormInvalid,true)}t.addEventListener("invalid",this.handleFormInvalid,true);this._activeForm=t}validateOnChange(){this.nanoFields.forEach((t=>{if(t.tagName==="NANO-CHECKBOX"){const i=t.closest("nano-checkbox-group");if(i)i.validateOn=this.validateOn}else{t.validateOn=this.validateOn}}))}get dirty(){return this._dirty}get valid(){return this._valid}get store(){return this._store}get payload(){return this._store.state}get showValidation(){return this.validateOn==="dirty"&&this.dirty||this.submitted}get validationState(){const t=[];this.allFields.forEach((async i=>{const s=t.find((t=>t.name===this.getName(i)));let e;let h;if(s){if(i.validationMessage){e=i;s.validityMessage=e.validationMessage.length?e.validationMessage:s.validityMessage;this.internalValidate=true;if(s.valid&&!e.checkValidity())s.valid=false;this.internalValidate=false}else if(i.validityMessage){h=i;s.validityMessage=h.validityMessage.length?h.validityMessage:h.validityMessage;if(s.valid&&h.invalid)s.valid=false}if(!s.fields.find((t=>t===i)))s.fields.push(i)}let r;let a;if(i.checkValidity){e=i;this.internalValidate=true;r=e.checkValidity();this.internalValidate=false;a=e.validationMessage}else{h=i;r=!h.invalid;a=h.validityMessage}t.push({fields:[i],name:this.getName(i),value:this._store.state[this.getName(i)],dirty:false,valid:r,validityMessage:a})}));return t}async setStore(t){this.hasSetStore=true;Object.entries(t).forEach((([t,i])=>{this.store.state[t]=i}))}async setCustomValidity(t){return await Promise.all(Object.entries(t).map((async([t,i])=>{const s=this.allFields.find((i=>this.getName(i)===t));if(!!s)await this.setFieldError(s,i)})))}async resetValidity(){return await Promise.all(this.allFields.map((async t=>await this.setFieldError(t,""))))}attachSlotObserver(){if(!!this.mo)return;const t=this.mo=new MutationObserver((t=>{const i=this.host.querySelector("form");if(i&&i!==this.activeForm)this.activeForm=i;this.setupFields()}));t.observe(this.host,{childList:true,attributes:true,attributeFilter:["name"],subtree:true})}getName(t){return t.name||t.getAttribute("name")}setupFields(){let t=Array.from(this.host.querySelectorAll(this.nanoFieldSelector));let i=Array.from(this.host.querySelectorAll(this.extraFieldSelector)).filter((t=>!t.closest(this.nanoFieldSelector)));t=t.filter((t=>!!this.getName(t)&&!!this.getName(t).length));i=i.filter((t=>!!this.getName(t)&&!!this.getName(t).length));if(![...t,...i].filter((t=>!this.allFields.includes(t))).length)return;this.nanoFields=t;this.plainFields=i;this.allFields=[...t,...i];this.storeToFields(this.allFields);this.validateOnChange();this.fieldsToStore(this.allFields,true);this.nanoPayloadChange.emit(this._store.state)}storeToFields(t){t.forEach((t=>{var i;const s=this.getName(t);if(!s.length||typeof this._store.state[s]==="undefined")return;if(t.tagName==="NANO-CHECKBOX"||["radio","checkbox"].includes(t.type)){const i=this.allFields.filter((i=>this.getName(t)===this.getName(i)));if(i[0].type==="radio"||i[0].type==="segment"||i[0].type==="segment-pill"){i.forEach((t=>{if(this._store.state[s]===t.value)t.checked=true;else t.checked=false}))}else if(Array.isArray(this._store.state[s])){i.forEach((t=>{if(this._store.state[s].includes(t.value))t.checked=true;else t.checked=false}))}else{i.forEach((t=>{if(this._store.state[s]===t.value)t.checked=true;else t.checked=false}))}return}if(t.tagName==="NANO-FILE-UPLOAD"){const e=t;if(!((i=e.files)===null||i===void 0?void 0:i.length))e.files=this._store.state[s];return}t.value=this._store.state[s]}))}fieldsToStore(t,i=false){t.forEach((t=>{const s=this.getName(t);if(!s.length)return;if(!!this._store.state[s]&&this.hasSetStore&&i){return}if(t.tagName==="NANO-CHECKBOX"||["radio","checkbox"].includes(t.type)){const i=t;if(i.type==="radio"||i.type==="segment"||i.type==="segment-pill"){if(i.checked)this._store.state[s]=i.value}else if(this.allFields.filter((t=>this.getName(t)===s&&(t.tagName==="NANO-CHECKBOX"||t.type==="checkbox"))).length>1){const t=Array.isArray(this._store.state[s])?this._store.state[s]:[];if(i.checked){if(!this._store.state[s].includes(i.value)){this._store.state[s]=[...t,i.value]}}else{this._store.state[s]=t.filter((t=>t!==i.value))}}else{if(i.checked)this._store.state[s]=i.value;else this._store.state[s]=""}return}if(t.tagName==="NANO-FILE-UPLOAD"){const i=t;if(!this.fileStateEqual(s,i))this._store.state[s]=i.files;return}this._store.state[s]=t.value}))}fileStateEqual(t,i){return JSON.stringify(this._store.state[t])===JSON.stringify(i.files)||this._store.state[t]==i.files}async validate(t,i){if(!this.validation)return;const s=this.validation(t,i,this._store.state);if(!s)return;await Promise.all(Object.entries(s).map((async([t,i])=>i.fields.map((async s=>{const e=this.allFields.find((t=>this.getName(t)===s));let h=e;if(e.tagName==="NANO-CHECKBOX"){const t=e.closest("nano-checkbox-group");h=t||e}if((h.validityMessage||h.validationMessage)===t&&i.valid){await this.setFieldError(h,"")}else if(!i.valid){await this.setFieldError(h,t)}})))))}async validateAllFields(){await Object.entries(this._store.state).reduce((async(t,[i,s])=>{await t;await this.validate(i,s)}),undefined)}async setFieldError(t,i){if(t["showError"]){await t.showError(i)}else if(t["setError"])await t.setError(i);else t.setCustomValidity(i)}scrollToFirstInvalid(){if(!this.scrollToInvalid)return;setTimeout((()=>{const t=this.validationState.find((t=>!t.valid));if(!t)return;t.fields[0].scrollIntoView({behavior:"smooth",block:"nearest"})}),200)}submitForm(){const t=this.nanoSubmit.emit();if(t.defaultPrevented)return;this.activeForm.submit()}connectedCallback(){this.userForm=this.host.querySelector("form");this._store=r({})}componentDidLoad(){requestAnimationFrame((()=>{this.setupFields();this.attachSlotObserver();this.host.addEventListener("nanoChange",this.handleFieldChange);this.host.addEventListener("input",this.handlePlainFieldChange);this.host.addEventListener("change",this.handlePlainFieldChange);this.host.addEventListener("submit",this.handleSubmit);this._store.on("set",this.handleStoreChange)}))}disconnectedCallback(){if(this.mo)this.mo.disconnect();this.host.removeEventListener("nanoChange",this.handleFieldChange);this.host.removeEventListener("input",this.handlePlainFieldChange);this.host.removeEventListener("change",this.handlePlainFieldChange);this.host.removeEventListener("submit",this.handleSubmit);this._store.reset();if(this.activeForm)this.activeForm.removeEventListener("invalid",this.handleFormInvalid,true)}render(){return s(e,null,this.userForm&&s("slot",null),!this.userForm&&s("form",{ref:t=>this.activeForm=t},s("slot",null)))}get host(){return h(this)}static get watchers(){return{userForm:["userFormChange"],validateOn:["validateOnChange"],extraFieldSelector:["attachSlotObserver"]}}};export{a as nano_field_validator};
5
- //# sourceMappingURL=p-4971a1f1.entry.js.map
4
+ import{r as t,c as i,h as s,a as e,g as h}from"./p-bf91c50e.js";import{c as r}from"./p-d7ff8f12.js";const a=class{constructor(s){t(this,s);this.nanoPayloadChange=i(this,"nanoPayloadChange",7);this.nanoSubmit=i(this,"nanoSubmit",7);this.nanoInvalid=i(this,"nanoInvalid",7);this.allFields=[];this.nanoFieldSelector=`\n nano-input,\n nano-select,\n nano-file-upload,\n nano-date-input,\n nano-checkbox\n `;this.hasSetStore=false;this.internalValidate=false;this.handleStoreChange=async(t,i)=>{const s=this.allFields.find((i=>this.getName(i)===t));if(s&&(s.tagName==="NANO-CHECKBOX"||["radio","checkbox"].includes(s.type))){this.storeToFields([s])}else if(s&&(s.tagName==="NANO-FILE-UPLOAD"&&!this.fileStateEqual(t,s)||s.tagName!=="NANO-FILE-UPLOAD"&&s.value!==i)){this.storeToFields([s])}if(this.validateOn==="dirty"&&this.dirty){this.internalValidate=true;await this.validateAllFields();this._valid=this.activeForm.checkValidity();this.internalValidate=false}this.nanoPayloadChange.emit(this._store.state)};this.handleFieldChange=t=>{if(!this.nanoFields.includes(t.target))return;this._dirty=true;this.fieldsToStore([t.target])};this.handlePlainFieldChange=t=>{if(!this.plainFields.includes(t.target))return;this.fieldsToStore([t.target])};this.handleFormInvalid=async t=>{if(!this.plainFields.includes(t.target)){t.preventDefault()}this._valid=false;if(this.internalValidate)return;if(this.validateOn==="submitThenDirty")this.validateOn="dirty";this.submitted=true;await this.validateAllFields();this.internalValidate=true;this._valid=this.activeForm.checkValidity();this.internalValidate=false;if(this.validateOn==="submit"){if(this._valid){this.submitForm();return}}this.scrollToFirstInvalid();this.nanoInvalid.emit()};this.handleSubmit=async t=>{t.preventDefault();if(this.validateOn==="submitThenDirty")this.validateOn="dirty";this.submitted=true;await this.validateAllFields();this.internalValidate=true;this._valid=this.activeForm.checkValidity();this.internalValidate=false;if(!this._valid){this.scrollToFirstInvalid();return}this.submitForm()};this.submitted=false;this.userForm=undefined;this.validateOn="submitThenDirty";this.scrollToInvalid=true;this._dirty=false;this._valid=undefined;this._store=undefined;this.extraFieldSelector="input, select, textarea";this.validation=undefined}userFormChange(){if(!!this.userForm)this.activeForm=this.userForm}get activeForm(){return this._activeForm}set activeForm(t){if(!t)return;if(this._activeForm){this._activeForm.removeEventListener("invalid",this.handleFormInvalid,true)}t.addEventListener("invalid",this.handleFormInvalid,true);this._activeForm=t}validateOnChange(){this.nanoFields.forEach((t=>{if(t.tagName==="NANO-CHECKBOX"){const i=t.closest("nano-checkbox-group");if(i)i.validateOn=this.validateOn}else{t.validateOn=this.validateOn}}))}get dirty(){return this._dirty}get valid(){return this._valid}get store(){return this._store}get payload(){return this._store.state}get showValidation(){return this.validateOn==="dirty"&&this.dirty||this.submitted}get validationState(){const t=[];this.allFields.forEach((async i=>{const s=t.find((t=>t.name===this.getName(i)));let e;let h;if(s){if(i.validationMessage){e=i;s.validityMessage=e.validationMessage.length?e.validationMessage:s.validityMessage;this.internalValidate=true;if(s.valid&&!e.checkValidity())s.valid=false;this.internalValidate=false}else if(i.validityMessage){h=i;s.validityMessage=h.validityMessage.length?h.validityMessage:h.validityMessage;if(s.valid&&h.invalid)s.valid=false}if(!s.fields.find((t=>t===i)))s.fields.push(i)}let r;let a;if(i.checkValidity){e=i;this.internalValidate=true;r=e.checkValidity();this.internalValidate=false;a=e.validationMessage}else{h=i;r=!h.invalid;a=h.validityMessage}t.push({fields:[i],name:this.getName(i),value:this._store.state[this.getName(i)],dirty:false,valid:r,validityMessage:a})}));return t}async setStore(t){this.hasSetStore=true;Object.entries(t).forEach((([t,i])=>{this.store.state[t]=i}))}async setCustomValidity(t){return await Promise.all(Object.entries(t).map((async([t,i])=>{const s=this.allFields.find((i=>this.getName(i)===t));if(!!s)await this.setFieldError(s,i)})))}async resetValidity(){return await Promise.all(this.allFields.map((async t=>await this.setFieldError(t,""))))}attachSlotObserver(){if(!!this.mo)return;const t=this.mo=new MutationObserver((t=>{const i=this.host.querySelector("form");if(i&&i!==this.activeForm)this.activeForm=i;this.setupFields()}));t.observe(this.host,{childList:true,attributes:true,attributeFilter:["name"],subtree:true})}getName(t){return t.name||t.getAttribute("name")}setupFields(){let t=Array.from(this.host.querySelectorAll(this.nanoFieldSelector));let i=Array.from(this.host.querySelectorAll(this.extraFieldSelector)).filter((t=>!t.closest(this.nanoFieldSelector)));t=t.filter((t=>!!this.getName(t)&&!!this.getName(t).length));i=i.filter((t=>!!this.getName(t)&&!!this.getName(t).length));if(![...t,...i].filter((t=>!this.allFields.includes(t))).length)return;this.nanoFields=t;this.plainFields=i;this.allFields=[...t,...i];this.storeToFields(this.allFields);this.validateOnChange();this.fieldsToStore(this.allFields,true);this.nanoPayloadChange.emit(this._store.state)}storeToFields(t){t.forEach((t=>{var i;const s=this.getName(t);if(!s.length||typeof this._store.state[s]==="undefined")return;if(t.tagName==="NANO-CHECKBOX"||["radio","checkbox"].includes(t.type)){const i=this.allFields.filter((i=>this.getName(t)===this.getName(i)));if(i[0].type==="radio"||i[0].type==="segment"||i[0].type==="segment-pill"){i.forEach((t=>{if(this._store.state[s]===t.value)t.checked=true;else t.checked=false}))}else if(Array.isArray(this._store.state[s])){i.forEach((t=>{if(this._store.state[s].includes(t.value))t.checked=true;else t.checked=false}))}else{i.forEach((t=>{if(this._store.state[s]===t.value)t.checked=true;else t.checked=false}))}return}if(t.tagName==="NANO-FILE-UPLOAD"){const e=t;if(!((i=e.files)===null||i===void 0?void 0:i.length))e.files=this._store.state[s];return}t.value=this._store.state[s]}))}fieldsToStore(t,i=false){t.forEach((t=>{const s=this.getName(t);if(!s.length)return;if(!!this._store.state[s]&&this.hasSetStore&&i){return}if(t.tagName==="NANO-CHECKBOX"||["radio","checkbox"].includes(t.type)){const i=t;if(i.type==="radio"||i.type==="segment"||i.type==="segment-pill"){if(i.checked)this._store.state[s]=i.value}else if(this.allFields.filter((t=>this.getName(t)===s&&(t.tagName==="NANO-CHECKBOX"||t.type==="checkbox"))).length>1){const t=Array.isArray(this._store.state[s])?this._store.state[s]:[];if(i.checked){if(!this._store.state[s].includes(i.value)){this._store.state[s]=[...t,i.value]}}else{this._store.state[s]=t.filter((t=>t!==i.value))}}else{if(i.checked)this._store.state[s]=i.value;else this._store.state[s]=""}return}if(t.tagName==="NANO-FILE-UPLOAD"){const i=t;if(!this.fileStateEqual(s,i))this._store.state[s]=i.files;return}this._store.state[s]=t.value}))}fileStateEqual(t,i){return JSON.stringify(this._store.state[t])===JSON.stringify(i.files)||this._store.state[t]==i.files}async validate(t,i){if(!this.validation)return;const s=this.validation(t,i,this._store.state);if(!s)return;await Promise.all(Object.entries(s).map((async([t,i])=>i.fields.map((async s=>{const e=this.allFields.find((t=>this.getName(t)===s));let h=e;if(e.tagName==="NANO-CHECKBOX"){const t=e.closest("nano-checkbox-group");h=t||e}if((h.validityMessage||h.validationMessage)===t&&i.valid){await this.setFieldError(h,"")}else if(!i.valid){await this.setFieldError(h,t)}})))))}async validateAllFields(){await Object.entries(this._store.state).reduce((async(t,[i,s])=>{await t;await this.validate(i,s)}),undefined)}async setFieldError(t,i){if(t["showError"]){await t.showError(i)}else if(t["setError"])await t.setError(i);else t.setCustomValidity(i)}scrollToFirstInvalid(){if(!this.scrollToInvalid)return;setTimeout((()=>{const t=this.validationState.find((t=>!t.valid));if(!t)return;t.fields[0].scrollIntoView({behavior:"smooth",block:"nearest"})}),200)}submitForm(){const t=this.nanoSubmit.emit();if(t.defaultPrevented)return;this.activeForm.submit()}connectedCallback(){this.userForm=this.host.querySelector("form");this._store=r({})}componentDidLoad(){requestAnimationFrame((()=>{this.setupFields();this.attachSlotObserver();this.host.addEventListener("nanoChange",this.handleFieldChange);this.host.addEventListener("input",this.handlePlainFieldChange);this.host.addEventListener("change",this.handlePlainFieldChange);this.host.addEventListener("submit",this.handleSubmit);this._store.on("set",this.handleStoreChange)}))}disconnectedCallback(){if(this.mo)this.mo.disconnect();this.host.removeEventListener("nanoChange",this.handleFieldChange);this.host.removeEventListener("input",this.handlePlainFieldChange);this.host.removeEventListener("change",this.handlePlainFieldChange);this.host.removeEventListener("submit",this.handleSubmit);this._store.reset();if(this.activeForm)this.activeForm.removeEventListener("invalid",this.handleFormInvalid,true)}render(){return s(e,null,this.userForm&&s("slot",null),!this.userForm&&s("form",{ref:t=>this.activeForm=t},s("slot",null)))}get host(){return h(this)}static get watchers(){return{userForm:["userFormChange"],validateOn:["validateOnChange"],extraFieldSelector:["attachSlotObserver"]}}};export{a as nano_field_validator};
5
+ //# sourceMappingURL=p-f47776fd.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import{j as t,g as n,e,h as o,F as i,r,c as s,d as a,a as l}from"./p-f84612d4.js";import{a as d}from"./p-ee045579.js";import{d as c}from"./p-9746b0a5.js";import{c as h}from"./p-8e39d4ee.js";const b="nano-tbl";const p=(t,n)=>{const e=globalThis[n];return e!=null&&t instanceof e};const _=t=>{if(t!=null){if(p(t,"ArrayBuffer")||p(t,"MessagePort")||p(t,"ImageBitmap")||p(t,"OffscreenCanvas")){return[t]}if(typeof t==="object"){if(t.constructor===Object){t=Object.values(t)}if(Array.isArray(t)){return t.flatMap(_)}return _(t.buffer)}}return[]};let f=0;let u=0;const g=new Map;const m=new Map;const v=(n,e,o)=>{const i=new Worker(n,{name:e});i.addEventListener("message",(({data:n})=>{if(n){const e=n[0];const i=n[1];const r=n[2];if(e===o){const e=n[3];const[o,s,a]=g.get(i);g.delete(i);if(e){const n=e.isError?Object.assign(new Error(e.value.message),e.value):e.value;t(n);s(n)}else{if(a){a.forEach((t=>m.delete(t)))}o(r)}}else if(e===o+".cb"){try{m.get(i)(...r)}catch(n){t(n)}}}}));return i};const w=(t,n,e)=>(...o)=>new Promise(((i,r)=>{let s=f++;let a=0;let l=o.length;let d=[i,r];g.set(s,d);for(;a<l;a++){if(typeof o[a]==="function"){const t=u++;m.set(t,o[a]);o[a]=[n+".cb",t];(d[2]=d[2]||[]).push(t)}}const c=t=>t.postMessage([n,s,e,o],_(o));if(t.then){t.then(c)}else{c(t)}}));const y=import("./p-b8abd6a1.js").then((t=>t.worker));const k=w(y,"stencil.table.worker","createWorkerStore");const x=w(y,"stencil.table.worker","syncConfigToWorker");const $=w(y,"stencil.table.worker","syncDataToWorker");const j=w(y,"stencil.table.worker","workerFilter");const O=w(y,"stencil.table.worker","workerSearch");const C=w(y,"stencil.table.worker","workerSort");function z(t){const n=JSON.parse(JSON.stringify(t));t.forEach((t=>{if(!!t.sortCompareFn){const e=n.find((n=>n.prop===t.prop));e.sortCompareFn=t.sortCompareFn.toString()}}));return n}const S=new WeakMap;async function I(t,n,e){const o={data:h({rows:[]}),config:h({columns:n}),general:h({workerId:null,scrollParent:e,host:t})};const i=await k(o.data.state.rows,z(o.config.state.columns));o.general.state.workerId=i;S.set(t,o);o.data.use({reset:()=>{if(o.general.state.workerId)$(o.general.state.workerId,null)},dispose:()=>{if(o.general.state.workerId)$(o.general.state.workerId,null)}});o.config.use({reset:()=>{if(o.general.state.workerId)x(o.general.state.workerId,null)},dispose:()=>{if(o.general.state.workerId)x(o.general.state.workerId,null)}});return o}function D(t){return S.get(t)}function T(t){if(t instanceof Date){return"date"}if(["number","string"].includes(typeof t)){return typeof t}return"unknown"}function R(t,n){const e=S.get(t);if(!e)return;const o=e.config.state.columns;const i=o.filter((t=>t.type==="date")).reduce(((t,n)=>[...t,n.prop]),[]);const r=o.filter((t=>!t.type));n=n.map(((t,n)=>{if(r.length&&n===0){e.config.state.columns=o.map((n=>{if(r.includes(n)&&t[n.prop]&&!n.type){n.type=T(t[n.prop]);if(n.type==="date")i.push(n.prop)}return n}))}i.forEach((n=>{var e;const o=(e=new Date(t[n]))!==null&&e!==void 0?e:null;if(!!o&&Number(o))t[n]=Number(o)}));t["__index"]=n;t["__uuid"]=d(o.map((n=>t[n.prop])).join());return t}));e.data.state.rows=n;if(e.general.state.workerId)return $(e.general.state.workerId,n)}function M(t,n){const e=S.get(t);if(!e)return;e.config.state.columns=n;if(e.general.state.workerId)return x(e.general.state.workerId,z(n))}async function N(t,n){const e=S.get(t);if(!e||!e.general.state.workerId)return;try{e.data.state.rows=await O(e.general.state.workerId,n)}catch(t){console.warn(t)}}async function B(t,n){const e=S.get(t);if(!e||!e.general.state.workerId)return;try{e.data.state.rows=await j(e.general.state.workerId,n)}catch(t){console.warn(t)}}async function F(t,n,e){const o=S.get(t);if(!o||!o.general.state.workerId)return;try{o.data.state.rows=await C(o.general.state.workerId,n,e)}catch(t){console.warn(t)}}function P(t,n){const e=E();const o=e.config.state.columns;const i=e.data.state.rows;const r=o[n];const s=r===null||r===void 0?void 0:r.prop;const a=i[t];const l=a?a[o[n].prop]:"";return{prop:s,cellModel:l,column:r,rowIndex:t,rowModel:a}}function A(t){const n=E();const e=n.data.state.rows;const o=e[t];return{rowModel:o,rowIndex:t}}function W(t,n){if(!n)return t;const e=Object.assign(Object.assign({},n),t);if(n.class){if(typeof n.class==="object"&&typeof e.class==="object"){e.class=Object.assign(Object.assign({},n.class),e.class)}else if(typeof n.class==="string"&&typeof e.class==="object"){e.class[n.class]=true}else if(typeof e.class==="string"){e.class+=" "+n.class}}if(n.style){e.style=Object.assign(Object.assign({},n.style),e.style)}return e}function E(){return D(n(e()))}function H(t,n,e){var o;const i=Object.assign({},e);const r=(o=E().config.state.columns[n])===null||o===void 0?void 0:o.cellProperties;if(!r)return i;const s=P(t,n);const a=r(s);if(!a)return i;return W(i,a)}function q(t){const n=t===null||t===void 0?void 0:t.columnTemplate;return n?n(o,t):o(i,null,t.title)}const J=new WeakMap;const L=new WeakMap;function Z(t,n,e){if(J.get(t))return;const o=E();const i=o.general.state.scrollParent;const r=new IntersectionObserver((([t])=>{const o=t.rootBounds||document.scrollingElement.getBoundingClientRect();const r={};if(n==="start"){r.start=t.boundingClientRect.x-(o.x+i.scrollLeft)<0&&!t.isIntersecting}if(n==="end"){r.end=t.boundingClientRect.right>t.boundingClientRect.width&&!t.isIntersecting}if(!!e)e(r)}),{threshold:[1],rootMargin:"1px 0px 100px 0px",root:i===document.scrollingElement?null:i});J.set(t,r);setTimeout((()=>r.observe(t)),300)}function U(t,n,e){if(L.get(t))return;const o=E();const i=o.general.state.scrollParent;const r=new IntersectionObserver((([t])=>{const o=t.rootBounds||document.scrollingElement.getBoundingClientRect();const r={};if(n==="top"){r.top=t.boundingClientRect.y-(o.y+i.scrollTop)<0&&!t.isIntersecting}if(n==="bottom"){const n=t.target.getBoundingClientRect();r.bottom=n.height+n.y>o.height&&!t.isIntersecting}if(!!e)e(r)}),{threshold:[1],rootMargin:"0px 100px 0px 100px",root:i===document.scrollingElement?null:i});L.set(t,r);requestAnimationFrame((()=>r.observe(t)))}function G(t,n,e=false){const o={[`${b}__${t}`]:true,[`${b}__pin`]:!!n,[`${b}__pin--top`]:n==="top",[`${b}__pin--bottom`]:n==="bottom"};if(e)return K(o);return o}function K(t){let n="";Object.entries(t).forEach((([t,e])=>{if(e)n+=t+" "}));return n}function Q(t){let n=getComputedStyle(t);const e=n.position==="absolute";const o=/(auto|scroll)/;if(n.position==="fixed")return document.documentElement;for(let i=t;i=i.parentElement;){n=getComputedStyle(i);if(e&&n.position==="static"){continue}if(o.test(n.overflow+n.overflowY+n.overflowX))return i}return document.documentElement}function V(t,n=100){const e=t.getBoundingClientRect();const o=window.innerHeight||document.documentElement.clientHeight;if(!e.bottom&&!e.top&&!e.left&&!e.right&&!e.height&&!e.width&&!e.x&&!e.y)return false;return!(Math.floor(100-(e.top>=0?0:e.top)/+-e.height*100)<n||Math.floor(100-(e.bottom-o)/e.height*100)<n)}function X(t,n,e){const o=[...e];const i=o.splice(t,1)[0];o.splice(n,0,i);return o}let Y;let tt;let nt;let et;const ot=({column:t,headRenderer:n,onColumnSortClick:e,onColumnPinned:r,onColumnDrag:s,onColumnDrop:a,defaults:l})=>{const d=E();function c(t,n){Y=n;tt=nt=t.target;et=tt.closest("."+`${b}__tr`);et.classList.add(`${b}__dragging`);tt.classList.add(`${b}__drag--start`);t.dataTransfer.effectAllowed="move";t.dataTransfer.setData("text/html",tt.innerHTML);s(n.prop,tt)}function h(){et.classList.remove(`${b}__dragging`);tt.classList.remove(`${b}__drag--start`);et.querySelectorAll(`.${b}__drag-mask--active`).forEach((t=>{t.classList.remove(`${b}__drag-mask--active`)}));tt=null;Y=null;et=null;nt=null}function p(t){if(nt===t.target)return;t.preventDefault();t.stopImmediatePropagation();t.dataTransfer.dropEffect="move";et.querySelectorAll(`.${b}__drag-mask--active`).forEach((t=>{t.classList.remove(`${b}__drag-mask--active`)}));nt=t.target;if(!nt.classList.contains(`${b}__drag-mask`)){t.dataTransfer.dropEffect="none";return}nt.classList.add(`${b}__drag-mask--active`)}function _(t){t.stopPropagation();const{colName:n}=this.dataset;if(n===Y.prop)return;const e=d.config.state.columns;let o=e.findIndex((t=>t.prop===n));const i=e.findIndex((t=>t===Y));if(o<i&&this.classList.contains(`${b}__drag-mask--end`))o++;if(o>i&&this.classList.contains(`${b}__drag-mask--start`))o--;if(o===i)return;a(Y.prop,d.config.state.columns[o].prop,tt)}function f(n){let o;switch(t.order){case"asc":o="desc";break;case"desc":o=null;break;default:o="asc"}e(o,t.prop,n.target.closest("th"))}function u(){return!!l.sortable&&t.sortable!==false||!l.sortable&&t.sortable===true}function g(){return!!l.draggable&&t.draggable!==false||!l.draggable&&t.draggable===true}let m={};if(t.columnProperties){m=t.columnProperties(t)||m}const v={class:Object.assign(Object.assign({},G("th",n===null||n===void 0?void 0:n.pinned)),{[`${b}__pin--start`]:t.pinned==="start",[`${b}__pin--end`]:t.pinned==="end",[`${b}__ordered`]:!!t.order,[`${b}__filtered`]:!!t.filter})};let w=m?W(v,m):v;const y=q(t);if(!y)return o(i,null);w=Number(w.colSpan)>1?Object.assign(Object.assign({},w),{scope:"colgroup"}):Object.assign(Object.assign({},w),{scope:"col"});if(u()){const n=t.order?t.order==="asc"?"ascending":"descending":"none";w=Object.assign(Object.assign({},w),{"aria-sort":n})}if(g()){w=Object.assign(Object.assign({},w),{draggable:true,onDragStart:n=>c(n,t),onDragOver:t=>t.preventDefault(),onDragEnd:()=>h()})}return o("th",Object.assign({},w,{ref:e=>{if(["end","start"].includes(t.pinned))Z(e,t.pinned,r);if(["top","bottom"].includes(n.pinned))U(e,n.pinned,r)},key:t.prop}),g()&&[o("div",{class:{[`${b}__drag-mask`]:true,[`${b}__drag-mask--start`]:true},"data-col-name":t.prop,onDragEnter:p,onDrop:_,onDragOver:t=>t.preventDefault()}),o("div",{class:{[`${b}__drag-mask`]:true,[`${b}__drag-mask--end`]:true},"data-col-name":t.prop,onDragEnter:p,onDrop:_,onDragOver:t=>t.preventDefault()})],u()?o("button",{class:{[`${b}__order-btn`]:true,[`${b}__cell-content`]:true},onClick:f},q(t),!!t.filter&&o("nano-icon",{name:"light/filter"}),!!t.order&&(t.order==="desc"?o("nano-icon",{name:"solid/long-arrow-down"}):o("nano-icon",{name:"solid/long-arrow-up"})),o("div",{class:`${b}__status-icons`},o("nano-icon",{name:"light/chevron-down"}))):o("div",{class:`${b}__cell-content`},q(t),!!t.filter&&o("nano-icon",{name:"light/bars-filter"})))};function it(t,n){var e,r;const s=E();const a=s.config.state.columns;const l=(e=a[n])===null||e===void 0?void 0:e.cellTemplate;const d=P(t,n);if(!!d.cellModel&&a[n].type==="date"){const t=new Date(d.cellModel);if(t instanceof Date&&!isNaN(t)){d.cellModel=!l?`${new Date(d.cellModel).toLocaleDateString()} ${new Date(d.cellModel).toLocaleTimeString()}`:t}}return l?l(o,d):d.cellModel?o(i,null,(r=d.cellModel)===null||r===void 0?void 0:r.toString()):""}const rt=(t,n=false)=>{const e=E();const o=e.config.state.columns[t];const i={[`${b}__td`]:true,[`${b}__ordered`]:!!o.order,[`${b}__pin`]:!!o.pinned,[`${b}__pin--start`]:o.pinned==="start",[`${b}__pin--end`]:o.pinned==="end"};if(n)return K(i);return i};const st=({rowIndex:t,colIndex:n,nestedContent:e})=>{const i=()=>e?e():it(t,n)||o("span",{class:"placeholder"}," ");let r="td";const s=E();const a=s.config.state.columns[n];let l=H(t,n,{class:rt(n)});if(a.rowHeader){l=Number(l.rowSpan)>1?Object.assign(Object.assign({},l),{scope:"rowgroup"}):Object.assign(Object.assign({},l),{scope:"row"});r="th"}const d=t=>o("div",Object.assign({},t,{class:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:!!a.wrap}}),o(i,null));return o(r,Object.assign({},l),a.autoTooltip&&!a.wrap?o("nano-resize-observe",{notifyContentFit:"x",onNanoResizeContentFitChange:t=>t.target.firstElementChild.disabled=t.detail.x},o("nano-tooltip",{disabled:true,placement:"top",onNanoShow:t=>t.target.closest(r).style.zIndex="100",onNanoHide:t=>t.target.closest(r).style.zIndex=""},o(d,null),o("span",{slot:"content"},o(i,null)))):o(d,null))};const at=({rowRenderer:t,rowIndex:n,rowModel:e,onColumnPinned:i},r,s)=>{let a={};const l=({header:t,wrap:n},e)=>{const i=o("div",{class:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:n}},e);return t?o("th",{scope:"row"},i):o("td",null,i)};if(!e){const t=A(n);e=t.rowModel}if(t===null||t===void 0?void 0:t.rowProperties){a=t.rowProperties({rowModel:e,rowIndex:n})||a}let d;if((t===null||t===void 0?void 0:t.pinned)&&typeof t.pinned==="function"){d=t.pinned()}const c={class:G("tr",d)};const h=a?W(c,a):c;const p=t===null||t===void 0?void 0:t.template;if(p){let t=p(o,{renderedRow:o("tr",Object.assign({},h,{key:e.__uuid}),r),rowModel:e,rowIndex:n},l);if(Array.isArray(t)){t=s.map(t,((t,n)=>{if(t.vtag==="tr"){if(!t.vkey)t.vkey=`${e.__uuid}_${n}`;t.vattrs=W({class:G("tr",d,true)},t.vattrs);if(!!t.vchildren){t.vchildren=s.map(t.vchildren,((t,n)=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=W({class:G(t.vtag.toString(),d,true)+rt(n,true),ref:t=>{if(!!t&&d==="top"||d==="bottom")U(t,d,i);if(!!t&&t.classList.contains("nano-tbl__pin--end"))Z(t,"end",i);if(!!t&&t.classList.contains("nano-tbl__pin--start"))Z(t,"start",i)}},t.vattrs)}return t}))}}return t}))}return t}return o("tr",Object.assign({},h,{key:e.__uuid}),r)};const lt=({rowRenderer:t,onColumnPinned:n},e,i)=>{let r={};if(t.rowProperties){r=t.rowProperties()||{}}const s=({header:t,wrap:n},e)=>{const i=o("div",{class:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:n}},e);return t!==false?o("th",{scope:"col"},i):o("td",null,i)};const a=t.pinned||null;const l={class:G("tr",null)};const d=r?W(l,r):l;const c=t===null||t===void 0?void 0:t.template;if(c){let t=c(o,{renderedRow:o("tr",Object.assign({},d),e)},s);if(Array.isArray(t)){t=i.map(t,(t=>{if(t.vtag==="tr"){t.vattrs=W({class:G("tr",a,true)},t.vattrs);if(!!t.vchildren){t.vchildren=i.map(t.vchildren,(t=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=W({class:G(t.vtag.toString(),a,true),ref:t=>{if(!!t&&a==="top"||a==="bottom")U(t,a,n);if(!!t&&t.classList.contains("nano-tbl__pin--end"))Z(t,"end",n);if(!!t&&t.classList.contains("nano-tbl__pin--start"))Z(t,"start",n)}},t.vattrs)}return t}))}}return t}))}return t}return o("tr",Object.assign({},d),e)};const dt=':host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}nano-table{display:block;width:100%;--max-col-width:clamp(200px, 500px, 50vw);--color:var(--nano-color-mediumgrey, #68767e);--font-size:0.87rem;--cell-line-height:1.5;--thead-font-size:0.95rem;--thead-color:#455560;--tfoot-color:#455560;--border-color:#dddbda;--border-style:thin solid var(--border-color);--border-tint-color:#0084a9;--border-tint-style:3px solid var(--border-tint-color);--cell-bg-rgb:var(--nano-color-white-rgb, 255 255 255);--head-bg-rgb:250, 250, 249;--foot-bg-rgb:var(--head-bg-rgb);--th-row-bg-rgb:var(--cell-bg-rgb);--ordered-bg-rgb:var(--nano-color-offwhite-rgb, 249 249 251);--td-padding-start:0.625rem;--td-padding-end:0.625rem;--td-padding-top:0.5rem;--td-padding-bottom:0.4125rem;--th-padding-start:0.625rem;--th-padding-end:0.625rem;--th-padding-top:0.875rem;--th-padding-bottom:0.6875rem;--td-padding-v:var(--td-padding-top) var(--td-padding-bottom);--td-padding-h:var(--td-padding-start) var(--td-padding-end);--th-padding-v:var(--th-padding-top) var(--th-padding-bottom);--th-padding-h:var(--th-padding-start) var(--th-padding-end);--foot-th-padding-v:var(--td-padding-top) var(--td-padding-bottom);--foot-th-padding-h:var(--td-padding-start) var(--td-padding-end);--head-th-padding-v:var(--th-padding-top) var(--th-padding-bottom);--head-th-padding-h:var(--th-padding-start) var(--th-padding-end);--bookend-col-padding:2rem}.nano-tbl{color:var(--color);text-align:start;width:100%;font-size:var(--font-size);border-spacing:0 0;border-collapse:separate;background:rgb(var(--cell-bg-rgb));-webkit-border-end:1px solid transparent;border-inline-end:1px solid transparent;-webkit-border-before:1px solid transparent;border-block-start:1px solid transparent;position:relative;z-index:1}.nano-tbl__wrap{display:table;min-width:100%}.nano-tbl__top-anchor{clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;position:relative}.nano-tbl__ordered{background-color:var(--ordered-bg);-webkit-border-start:var(--border-style);border-inline-start:var(--border-style);-webkit-border-end:var(--border-style);border-inline-end:var(--border-style)}.nano-tbl__drag-mask{display:none;position:absolute;inset-block:-2px -2px;z-index:10;opacity:0;transition:0.2s ease opacity}.nano-tbl__drag-mask--start{width:calc(50% + 2px);inset-inline-start:-2px;-webkit-border-start:2px dashed var(--border-tint-color);border-inline-start:2px dashed var(--border-tint-color)}.nano-tbl__drag-mask--end{width:50%;inset-inline-end:0;-webkit-border-end:2px dashed var(--border-tint-color);border-inline-end:2px dashed var(--border-tint-color)}.nano-tbl__drag-mask--active{opacity:1}.nano-tbl__dragging .nano-tbl__drag-mask{display:block}.nano-tbl__drag--start{opacity:0.4}.nano-tbl__dragging .nano-tbl__td,.nano-tbl__dragging .nano-tbl__th{cursor:no-drop}.nano-tbl__dragging .nano-tbl__td .nano-tbl__cell-content,.nano-tbl__dragging .nano-tbl__th .nano-tbl__cell-content{pointer-events:none}.nano-tbl__order-btn{padding:0;border:none;outline:none;font:inherit;background:none;-webkit-appearance:none;appearance:none;color:inherit;display:flex;gap:10px;align-items:center;width:100%}.nano-tbl__status-icons{margin-inline:auto 10px;display:flex;gap:10px}.nano-tbl__progress-bar{font-size:0.2rem;position:sticky;inset-block-start:0;inset-inline:0;z-index:10;transition:scale 0.25s;transform:scale(0);width:100%;height:0}.nano-tbl__progress-bar--show{transform:scale(1);height:auto}.nano-tbl__caption--hide{clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute}.nano-tbl__td,.nano-tbl__th{line-height:var(--cell-line-height);text-align:start;-webkit-border-before:var(--border-style);border-block-start:var(--border-style);max-width:var(--max-col-width);background-color:rgb(var(--cell-bg-rgb))}tbody:first-of-type tr:first-child .nano-tbl__td,tbody:first-of-type tr:first-child .nano-tbl__th{-webkit-border-before:none;border-block-start:none}tbody:last-of-type tr:last-child .nano-tbl__td,tbody:last-of-type tr:last-child .nano-tbl__th{-webkit-border-after:var(--border-style);border-block-end:var(--border-style)}.md .nano-tbl__td:first-child .nano-tbl__cell-content,.md .nano-tbl__th:first-child .nano-tbl__cell-content{-webkit-padding-start:var(--bookend-col-padding);padding-inline-start:var(--bookend-col-padding)}.md .nano-tbl__td:last-child .nano-tbl__cell-content,.md .nano-tbl__th:last-child .nano-tbl__cell-content{-webkit-padding-end:var(--bookend-col-padding);padding-inline-end:var(--bookend-col-padding)}@media (max-width: 768px){.nano-tbl__td:first-child .nano-tbl__cell-content,.nano-tbl__th:first-child .nano-tbl__cell-content{-webkit-padding-start:var(--td-padding-start) !important;padding-inline-start:var(--td-padding-start) !important}.nano-tbl__td:last-child .nano-tbl__cell-content,.nano-tbl__th:last-child .nano-tbl__cell-content{-webkit-padding-end:var(--td-padding-end) !important;padding-inline-end:var(--td-padding-end) !important}}thead .nano-tbl__td,thead .nano-tbl__th{color:var(--thead-color);font-weight:800;background:rgb(var(--head-bg-rgb)/90%);font-size:var(--thead-font-size);-webkit-border-before:none !important;border-block-start:none !important;transition:all 0.2s ease}thead .nano-tbl__td .nano-tbl__cell-content,thead .nano-tbl__th .nano-tbl__cell-content{padding-block:var(--head-th-padding-v);padding-inline:var(--head-th-padding-h)}tfoot .nano-tbl__td,tfoot .nano-tbl__th{color:var(--tfoot-color);font-weight:800;-webkit-border-before:none;border-block-start:none;background:rgb(var(--foot-bg-rgb)/90%);font-size:var(--thead-font-size)}tfoot .nano-tbl__td .nano-tbl__cell-content,tfoot .nano-tbl__th .nano-tbl__cell-content{padding-block:var(--foot-th-padding-v);padding-inline:var(--foot-th-padding-h)}.nano-tbl__td.nano-tbl__ordered,.nano-tbl__th.nano-tbl__ordered{background-color:rgb(var(--ordered-bg-rgb)/80%) !important}.nano-tbl__cell-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-block:var(--td-padding-v);padding-inline:var(--td-padding-h)}.nano-tbl__cell-content--no-result{padding-block:2rem}.nano-tbl__cell-content--wrap{white-space:normal;overflow:visible}.nano-tbl tbody{will-change:scroll-position;opacity:1;transition:0.1s ease opacity;transform:translateZ(0)}.nano-tbl tbody.nano-tbl__inactive{opacity:0}.nano-tbl th[scope=row]{font-weight:800;margin:0}.nano-tbl__pin{position:sticky;transform:translateZ(0)}.nano-tbl__pin--start{inset-inline:-1px auto;transition:max-width 0.25s ease}.nano-tbl__pin--start::after{content:"";position:absolute;inset:0;box-shadow:5px 1px 4px 0 rgba(0, 0, 0, 0.2);opacity:0;z-index:-1}.nano-tbl__pinned--start .nano-tbl__pin--start{z-index:2;max-width:125px !important}.sm .nano-tbl__pinned--start .nano-tbl__pin--start{max-width:var(--max-col-width) !important}.nano-tbl__pinned--start .nano-tbl__pin--start::after{opacity:1}.nano-tbl__pin--end{}.nano-tbl__pin--start+.nano-tbl__pin--end{inset-inline:auto auto}.nano-tbl__pin--start+.nano-tbl__pin--end::after{display:none}.sm .nano-tbl__pin--end{inset-inline:auto -1px !important;max-width:min(50vw, 200px)}.sm .nano-tbl__pin--end::after{display:block !important;content:"";position:absolute;inset:0;box-shadow:-5px 1px 4px 0 rgba(0, 0, 0, 0.2);opacity:0;z-index:-1}.sm .nano-tbl__pinned--end .nano-tbl__pin--end::after{opacity:1}.nano-tbl__pin--top{inset-block:-1px auto}.nano-tbl__pinned--top .nano-tbl__pin--top{z-index:4 !important}.nano-tbl__pin--bottom{inset-block:auto -1px}.nano-tbl__pinned--bottom .nano-tbl__pin--bottom{z-index:5 !important}.nano-tbl__pinned--start .nano-tbl__pin--top.nano-tbl__pin--start{z-index:5 !important}.nano-tbl__pinned--top.nano-tbl__pinned--start .nano-tbl__pin--top.nano-tbl__pin--start{z-index:6 !important}.nano-tbl__pinned--end .nano-tbl__pin--top.nano-tbl__pin--end{z-index:5 !important}.nano-tbl__pinned--top.nano-tbl__pinned--end .nano-tbl__pin--top.nano-tbl__pin--end{z-index:6 !important}.nano-tbl__pinned--start .nano-tbl__pin--bottom.nano-tbl__pin--start{z-index:5 !important}.nano-tbl__pinned--bottom.nano-tbl__pinned--start .nano-tbl__pin--bottom.nano-tbl__pin--start{z-index:6 !important}.nano-tbl__pinned--end .nano-tbl__pin--bottom.nano-tbl__pin--end{z-index:5 !important}.nano-tbl__pinned--bottom.nano-tbl__pinned--end .nano-tbl__pin--bottom.nano-tbl__pin--end{z-index:6 !important}.nano-tbl thead tr:last-of-type td,.nano-tbl thead tr:last-of-type th{-webkit-border-after:var(--border-tint-style);border-block-end:var(--border-tint-style)}.nano-tbl tfoot tr:first-of-type td,.nano-tbl tfoot tr:first-of-type th{-webkit-border-before:none;border-block-start:none}.nano-tbl tfoot tr:last-of-type td,.nano-tbl tfoot tr:last-of-type th{-webkit-border-after:var(--border-tint-style);border-block-end:var(--border-tint-style)}.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:first-of-type td,.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:first-of-type th{-webkit-border-before:var(--border-tint-style) !important;border-block-start:var(--border-tint-style) !important}.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:last-of-type td,.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:last-of-type th{-webkit-border-after:none !important;border-block-end:none !important}.nano-tbl .unlimited-width{max-width:none}.nano-tbl__spinner{font-size:1.5rem;transition:scale 0.25s;scale:0;padding:0.5rem;position:absolute;inset-block-end:0;inset-inline-start:calc(50% - 0.75rem);z-index:0}.nano-tbl__spinner--show{scale:1;position:sticky}.nano-tbl nano-skeleton{line-height:var(--cell-line-height)}';let ct=0;const ht=class{constructor(t){r(this,t);this.nanoTblReady=s(this,"nanoTblReady",7);this.nanoTblBlockRendered=s(this,"nanoTblBlockRendered",7);this.nanoTblBeforeSort=s(this,"nanoTblBeforeSort",7);this.nanoTblAfterSort=s(this,"nanoTblAfterSort",7);this.nanoTblColDrag=s(this,"nanoTblColDrag",7);this.nanoTblColDrop=s(this,"nanoTblColDrop",7);this.nanoTblBeforeFilter=s(this,"nanoTblBeforeFilter",7);this.nanoTblAfterFilter=s(this,"nanoTblAfterFilter",7);this.nanoTblBeforeSearch=s(this,"nanoTblBeforeSearch",7);this.nanoTblAfterSearch=s(this,"nanoTblAfterSearch",7);this.nanoTblBeforeEdit=s(this,"nanoTblBeforeEdit",7);this.renderId="tbl-"+ct++;this.filters=[];this.currentFilters="[]";this.currentSort="";this.cacheScrollPosition=0;this.measureHeight=0;this.blockHeights=[];this.unitHeight=0;this._isReady=false;this.colDrag=t=>{this.nanoTblColDrag.emit({column:t})};this.colDrop=(t,n)=>{const e=this.store.config.state.columns;const o=e.findIndex((t=>t.prop===n));const i=e.findIndex((n=>n.prop===t));const r=this.nanoTblColDrop.emit({fromCol:t,toCol:n,fromIndex:i,toIndex:o});if(r.defaultPrevented)return;this.columns=X(i,o,e)};this.sortStart=async(t,n,e)=>{if(this.currentSort===t+":"+n)return;this._loading=true;const o=this.nanoTblBeforeSort.emit({column:n,order:t});if(o.defaultPrevented)return;this.currentSort=t+":"+n;this.scrollToTop(e);if(this.customSortFn){try{const e=await this.customSortFn(n,t);if(e===true){this.sortComplete(t,n);this._loading=false;return}}catch(t){console.warn("custom sort failed",t);this.currentSort="";this._loading=false;return}}try{await F(this.host,n,t);this.sortComplete(t,n)}catch(t){console.warn("sort failed",t);this.currentSort=""}finally{if(this.blocks.length)this._loading=false}};this.scrollHandler=()=>{this.cacheScrollPosition=this.scrollParent.scrollTop||window.scrollY;requestAnimationFrame((()=>{let t=0;let n=0;const e=this.blocks.length;while(n<e&&this.cacheScrollPosition>=t){t+=this.getBlockHeight(n);if(this.cacheScrollPosition<t){const t=[n,n+1,Math.max(0,n-1)];if(t.toString()!==this.activeBlocks.toString()){this.activeBlocks=t;this.setBlockHeight()}this.primaryBlockIndex=n}n++}}))};this.handleColumnPinned=t=>{Object.entries(t).forEach((([t,n])=>{this.tableEle.classList.toggle(`${b}__pinned--${t}`,n)}))};this.handleResizeChange=t=>{var n;this.tableWrapperEle.className="";let e=[`${b}__wrap`];if((n=t.target)===null||n===void 0?void 0:n.className)e=[...t.target.className.split(" "),...e];this.tableWrapperEle.classList.add(...e.filter((t=>!!t)))};this.type="table";this.caption=undefined;this.showCaption=false;this.loading=undefined;this.internalLoading=false;this.placeholderSize=5;this.rows=undefined;this.columns=[];this.headRender={pinned:"top"};this.rowRender=undefined;this.footRender={pinned:"bottom"};this.showFooter=false;this.perBlock=40;this.searchTerm=undefined;this.customFilterFn=undefined;this.customSortFn=undefined;this.defaultSort=true;this.defaultColDraggable=false;this.virtualTotalItems=0;this.blocks=[];this.activeBlocks=[0,1,2];this.debounceSetLoading=c(this.debounceSetLoading.bind(this),50)}get _loading(){return this.loading!==undefined?this.loading:this.internalLoading}set _loading(t){if(this.loading!==undefined)return;this.debounceSetLoading(t)}debounceSetLoading(t){this.internalLoading=t}handleRowsChange(){if(!this.rows){this._loading=true;return}this._loading=true;Promise.resolve(this.rows).then((async t=>{await R(this.host,t);this.currentFilters="";this.currentSort="";await this.columnInit();if(!this.isReady)this.setInitialBlockDimension();this._loading=false}))}async handleColsChange(){await M(this.host,this.columns);if(this.isReady)this.columnInit()}get blocksLength(){return this.blocks.length}handleSearchTermChange(){this.searchStart()}virtualTotalItemsChangeHandler(){this.setBlocks()}async resetSorting(){const t=this.columns.find((t=>!!t.order));if(!t)return;return this.sortStart(null,t.prop)}async addSort(t,n){const e=this.columns.find((n=>n.prop===t));if(!e)throw"Cannot find column with "+t;return this.sortStart(n,e.prop)}async resetFilters(){this.filters=[];return this.filterStart()}async addFilters(t,n=true){if(!n)this.filters=[];return this.filterStart(t,n)}async removeFilters(t){this.filters=this.filters.filter((n=>!t.includes(n.prop)));return this.filterStart()}async updateRow(t,n){this.rows.splice(n,1,t);this.handleRowsChange()}set measureEle(t){var n;if(!t)return;const e=t.getBoundingClientRect().height;this.measureHeight=Math.abs(this.measureHeight-e)<5?this.measureHeight:e;this.unitHeight=((n=t.querySelector("tr"))===null||n===void 0?void 0:n.getBoundingClientRect().height)||this.unitHeight}get scrollParent(){return this._scrollParent}set scrollParent(t){if(t===this._scrollParent)return;if(this._scrollParent){(this._scrollParent===document.documentElement?document:this._scrollParent).removeEventListener("scroll",this.scrollHandler)}(t===document.documentElement?document:t).addEventListener("scroll",this.scrollHandler);this._scrollParent=t}get primaryBlockIndex(){return this._primaryBlockIndex}set primaryBlockIndex(t){if(this._primaryBlockIndex===t)return;this._primaryBlockIndex=t;this.nanoTblBlockRendered.emit({block:t,totalBlocks:this.blockElements.length})}get isReady(){return this._isReady}set isReady(t){if(t===this._isReady)return;this._isReady=t;if(this.isReady)requestAnimationFrame((()=>this.handleReady()))}handleReady(){const t=window.location.hash;if(t.length>1){try{const n=document.querySelector(t);if(n)n.scrollIntoView()}catch(t){}}this.nanoTblReady.emit()}sortComplete(t,n){this.columns=this.columns.map((e=>{if(e.prop===n)return Object.assign(Object.assign({},e),{order:t});return Object.assign(Object.assign({},e),{order:null})}));this.nanoTblAfterSort.emit({column:n,order:t})}async searchStart(){this._loading=true;const t=this.nanoTblBeforeSearch.emit({term:this.searchTerm});if(t.defaultPrevented)return;this.scrollToTop();try{await N(this.host,this.searchTerm);this.nanoTblAfterSearch.emit({term:this.searchTerm})}catch(t){console.warn("search failed",t)}finally{this._loading=false}}async filterStart(t,n=true){if(t){if(n){this.filters=[...this.filters.filter((n=>!t.find((t=>t.prop===n.prop)))),...t]}else{this.filters=t}}if(this.currentFilters===JSON.stringify(this.filters))return;this._loading=true;const e=this.nanoTblBeforeFilter.emit({filters:this.filters});if(e.defaultPrevented)return;this.currentFilters=JSON.stringify(this.filters);this.scrollToTop();if(this.customFilterFn){try{const t=await this.customFilterFn(this.filters);if(t===true){this.filterComplete();this._loading=false}}catch(t){console.warn("custom filter failed",t);this.currentFilters="";this._loading=false}return}try{await B(this.host,this.filters);this.filterComplete()}catch(t){console.warn("filter failed",t)}finally{this._loading=false}}filterComplete(){this.columns=this.columns.map((t=>{const n=this.filters.find((n=>n.prop===t.prop));if(n)t.filter=n.filter;return t}));this.nanoTblAfterFilter.emit({filters:this.filters})}scrollToTop(t){var n;const e=(n=this.scrollParent.style)===null||n===void 0?void 0:n.scrollBehavior;const o=this.scrollParent.scrollLeft;this.scrollParent.style.scrollBehavior="auto";if(this.topAnchorEle&&!V(this.topAnchorEle,.1)){this.host.scrollIntoView()}if(t&&!V(t,1))setTimeout((()=>t.scrollIntoView({block:"start"})),500);if(o)this.scrollParent.scrollLeft=o;if(e)this.scrollParent.style.scrollBehavior=e;this.scrollHandler()}setMeasureElement(){a((()=>{this.measureEle=this.blockElements.find((t=>{var n;return!((n=t===null||t===void 0?void 0:t.classList)===null||n===void 0?void 0:n.contains(`${b}__inactive`))}))}))}setInitialBlockDimension(){var t;if(!((t=this.blockElements)===null||t===void 0?void 0:t.length))return;const n=new Promise((t=>{a((()=>{this.setMeasureElement();if(!this.measureEle&&!this.unitHeight)t();this.blockElements.forEach(((n,e)=>{var o;if(!n||!((o=n.classList)===null||o===void 0?void 0:o.contains(`${b}__inactive`))){if(e===this.blockElements.length-1)t();return}if(e===this.blockElements.length-1)t()}))}))}));n.then((()=>{requestAnimationFrame((()=>{this.isReady=true}))}))}async columnInit(){this.filters=this.columns.filter((t=>!!t.filter)).map((t=>{const{filter:n,prop:e}=t;return{filter:n,prop:e}}));if(this.searchTerm){await this.searchStart()}if(this.filters.length){await this.filterStart()}const t=this.columns.find((t=>!!t.order));if(!!t){await this.sortStart(t.order,t.prop)}}setBlocks(){const t=this.store.data.state.rows;if(!t.length){this.blocks=[];return}let n=1;const e=this.virtualTotalItems>t.length?this.virtualTotalItems:t.length;let o=[];const i=[];this.blockHeights=[];for(n;n<=e;n++){o.push(this.store.data.state.rows[n-1]||{__uuid:""});if(n%this.perBlock===0){i.push({rows:o,__uuid:d(o.map((t=>t.__uuid)).join())});o=[]}}if(o.length){i.push({rows:o,__uuid:d(o.map((t=>t.__uuid)).join())})}this.blocks=i}getBlockHeight(t){if(this.blockHeights.length){const n=this.blockHeights.find((n=>n.blockIndex===t));if(n)return n.height}const n=this.blocks[t].rows.length;if(n===this.perBlock&&this.measureHeight){return this.measureHeight}return this.unitHeight?this.unitHeight*n:undefined}setBlockHeight(){this.activeBlocks.forEach((t=>{const n=this.blockElements[t];if(!n)return;a((()=>{const e=n.getBoundingClientRect().height;const o=this.blockHeights.findIndex((n=>n.blockIndex===t));if(o>0){this.blockHeights[o]={height:e,blockIndex:t}}else this.blockHeights.push({height:e,blockIndex:t})}))}))}processSlots(){if(!this.caption&&!this.host.querySelector('[slot="caption"]')){console.error("For accessibility you must set a `caption` prop or use the `caption` slot")}}async componentWillLoad(){this.scrollParent=Q(this.host);this.store=await I(this.host,this.columns,this.scrollParent);await this.handleRowsChange();this.processSlots();this.store.data.onChange("rows",(()=>this.setBlocks()));this.setBlocks()}connectedCallback(){this.scrollParent=Q(this.host)}componentDidLoad(){this.setInitialBlockDimension()}componentShouldUpdate(t,n,e){if(["rows","columns"].includes(e))return false}componentWillRender(){}componentDidRender(){this.setMeasureElement()}render(){this.blockElements=[];return o(l,null,o("div",{class:`${b}__top-anchor`,ref:t=>this.topAnchorEle=t}," "),o("nano-resize-observe",{"aria-labelledby":"table-caption-"+this.renderId,tabindex:this.type==="grid"?"0":undefined,states:"576w sm, 768w md",class:"sm md",onNanoResizeStateChange:this.handleResizeChange}),o("div",{class:`${b}__wrap sm md`,ref:t=>this.tableWrapperEle=t},o("nano-progress-bar",{indeterminate:true,class:{[`${b}__progress-bar`]:true,[`${b}__progress-bar--show`]:this._loading}}),o("table",{role:this.type==="grid"?"grid":undefined,"aria-readonly":this.type==="table"?"true":undefined,"aria-rowcount":this.store.data.state.rows.length,"aria-colcount":this.store.config.state.columns.length,class:`${b}`,ref:t=>this.tableEle=t},o("caption",{class:{[`${b}__caption`]:true,[`${b}__caption--hide`]:!this.showCaption},id:"table-caption-"+this.renderId},o("slot",{name:"caption"},this.caption)),o("thead",null,o(lt,{rowRenderer:this.headRender,onColumnPinned:this.handleColumnPinned},this.store.config.state.columns.map((t=>[o(ot,{column:t,headRenderer:this.headRender,onColumnSortClick:this.sortStart,onColumnPinned:this.handleColumnPinned,onColumnDrag:this.colDrag,onColumnDrop:this.colDrop,defaults:{sortable:this.defaultSort,draggable:this.defaultColDraggable}})])))),this._loading&&!this.blocks.length&&o("tbody",{class:`${b}__active`},[...Array(10).keys()].map((t=>o("tr",null,this.store.config.state.columns.map(((n,e)=>o(st,{rowIndex:t,colIndex:e,nestedContent:()=>o("nano-skeleton",null)}))))))),!this._loading&&!this.blocks.length&&o("tr",null,o("th",{class:`${b}__th`,colSpan:this.store.config.state.columns.length},o("div",{class:"nano-tbl__cell-content nano-tbl__cell-content--no-result"},o("slot",{name:"no-results"},"No results found")))),this.blocks.map(((t,n)=>o("tbody",{key:t.__uuid,id:`tbody-${this.renderId}-${n}`,ref:t=>{this.blockElements.push(t)},class:{[`${b}__inactive`]:!this.activeBlocks.includes(n),[`${b}__active`]:this.activeBlocks.includes(n)}},this.activeBlocks.includes(n)?t.rows.map(((t,e)=>{const i=n>0?n*this.perBlock+e:e;return o(at,{rowRenderer:this.rowRender,rowModel:t,rowIndex:i},this.store.config.state.columns.map(((t,n)=>o(st,{rowIndex:i,colIndex:n}))))})):o("tr",null,o("td",{colSpan:this.store.config.state.columns.length,style:{height:this.getBlockHeight(n)+"px"}}))))),this.showFooter&&o("tfoot",null,o(lt,{rowRenderer:this.footRender,onColumnPinned:this.handleColumnPinned},this.store.config.state.columns.map((t=>[o(ot,{column:t,headRenderer:this.footRender,onColumnPinned:this.handleColumnPinned,onColumnSortClick:this.sortStart,defaults:{sortable:this.defaultSort,draggable:this.defaultColDraggable}})]))))),!!this.blocks.length&&o("nano-spinner",{type:"circle",class:{[`${b}__spinner`]:true,[`${b}__spinner--show`]:this._loading}})))}get host(){return n(this)}static get watchers(){return{rows:["handleRowsChange"],columns:["handleColsChange"],searchTerm:["handleSearchTermChange"],virtualTotalItems:["virtualTotalItemsChangeHandler"]}}};ht.style=dt;export{ht as T,v as c};
5
- //# sourceMappingURL=p-8a4f6a46.js.map
4
+ import{j as t,g as n,e,h as o,F as i,r,c as s,d as a,a as l}from"./p-bf91c50e.js";import{a as d}from"./p-ee045579.js";import{d as c}from"./p-9746b0a5.js";import{c as h}from"./p-d7ff8f12.js";const b="nano-tbl";const p=(t,n)=>{const e=globalThis[n];return e!=null&&t instanceof e};const _=t=>{if(t!=null){if(p(t,"ArrayBuffer")||p(t,"MessagePort")||p(t,"ImageBitmap")||p(t,"OffscreenCanvas")){return[t]}if(typeof t==="object"){if(t.constructor===Object){t=Object.values(t)}if(Array.isArray(t)){return t.flatMap(_)}return _(t.buffer)}}return[]};let f=0;let u=0;const g=new Map;const m=new Map;const v=(n,e,o)=>{const i=new Worker(n,{name:e});i.addEventListener("message",(({data:n})=>{if(n){const e=n[0];const i=n[1];const r=n[2];if(e===o){const e=n[3];const[o,s,a]=g.get(i);g.delete(i);if(e){const n=e.isError?Object.assign(new Error(e.value.message),e.value):e.value;t(n);s(n)}else{if(a){a.forEach((t=>m.delete(t)))}o(r)}}else if(e===o+".cb"){try{m.get(i)(...r)}catch(n){t(n)}}}}));return i};const w=(t,n,e)=>(...o)=>new Promise(((i,r)=>{let s=f++;let a=0;let l=o.length;let d=[i,r];g.set(s,d);for(;a<l;a++){if(typeof o[a]==="function"){const t=u++;m.set(t,o[a]);o[a]=[n+".cb",t];(d[2]=d[2]||[]).push(t)}}const c=t=>t.postMessage([n,s,e,o],_(o));if(t.then){t.then(c)}else{c(t)}}));const y=import("./p-601bd262.js").then((t=>t.worker));const k=w(y,"stencil.table.worker","createWorkerStore");const x=w(y,"stencil.table.worker","syncConfigToWorker");const $=w(y,"stencil.table.worker","syncDataToWorker");const j=w(y,"stencil.table.worker","workerFilter");const O=w(y,"stencil.table.worker","workerSearch");const C=w(y,"stencil.table.worker","workerSort");function z(t){const n=JSON.parse(JSON.stringify(t));t.forEach((t=>{if(!!t.sortCompareFn){const e=n.find((n=>n.prop===t.prop));e.sortCompareFn=t.sortCompareFn.toString()}}));return n}const S=new WeakMap;async function I(t,n,e){const o={data:h({rows:[]}),config:h({columns:n}),general:h({workerId:null,scrollParent:e,host:t})};const i=await k(o.data.state.rows,z(o.config.state.columns));o.general.state.workerId=i;S.set(t,o);o.data.use({reset:()=>{if(o.general.state.workerId)$(o.general.state.workerId,null)},dispose:()=>{if(o.general.state.workerId)$(o.general.state.workerId,null)}});o.config.use({reset:()=>{if(o.general.state.workerId)x(o.general.state.workerId,null)},dispose:()=>{if(o.general.state.workerId)x(o.general.state.workerId,null)}});return o}function D(t){return S.get(t)}function T(t){if(t instanceof Date){return"date"}if(["number","string"].includes(typeof t)){return typeof t}return"unknown"}function R(t,n){const e=S.get(t);if(!e)return;const o=e.config.state.columns;const i=o.filter((t=>t.type==="date")).reduce(((t,n)=>[...t,n.prop]),[]);const r=o.filter((t=>!t.type));n=n.map(((t,n)=>{if(r.length&&n===0){e.config.state.columns=o.map((n=>{if(r.includes(n)&&t[n.prop]&&!n.type){n.type=T(t[n.prop]);if(n.type==="date")i.push(n.prop)}return n}))}i.forEach((n=>{var e;const o=(e=new Date(t[n]))!==null&&e!==void 0?e:null;if(!!o&&Number(o))t[n]=Number(o)}));t["__index"]=n;t["__uuid"]=d(o.map((n=>t[n.prop])).join());return t}));e.data.state.rows=n;if(e.general.state.workerId)return $(e.general.state.workerId,n)}function M(t,n){const e=S.get(t);if(!e)return;e.config.state.columns=n;if(e.general.state.workerId)return x(e.general.state.workerId,z(n))}async function N(t,n){const e=S.get(t);if(!e||!e.general.state.workerId)return;try{e.data.state.rows=await O(e.general.state.workerId,n)}catch(t){console.warn(t)}}async function B(t,n){const e=S.get(t);if(!e||!e.general.state.workerId)return;try{e.data.state.rows=await j(e.general.state.workerId,n)}catch(t){console.warn(t)}}async function F(t,n,e){const o=S.get(t);if(!o||!o.general.state.workerId)return;try{o.data.state.rows=await C(o.general.state.workerId,n,e)}catch(t){console.warn(t)}}function P(t,n){const e=E();const o=e.config.state.columns;const i=e.data.state.rows;const r=o[n];const s=r===null||r===void 0?void 0:r.prop;const a=i[t];const l=a?a[o[n].prop]:"";return{prop:s,cellModel:l,column:r,rowIndex:t,rowModel:a}}function A(t){const n=E();const e=n.data.state.rows;const o=e[t];return{rowModel:o,rowIndex:t}}function W(t,n){if(!n)return t;const e=Object.assign(Object.assign({},n),t);if(n.class){if(typeof n.class==="object"&&typeof e.class==="object"){e.class=Object.assign(Object.assign({},n.class),e.class)}else if(typeof n.class==="string"&&typeof e.class==="object"){e.class[n.class]=true}else if(typeof e.class==="string"){e.class+=" "+n.class}}if(n.style){e.style=Object.assign(Object.assign({},n.style),e.style)}return e}function E(){return D(n(e()))}function H(t,n,e){var o;const i=Object.assign({},e);const r=(o=E().config.state.columns[n])===null||o===void 0?void 0:o.cellProperties;if(!r)return i;const s=P(t,n);const a=r(s);if(!a)return i;return W(i,a)}function q(t){const n=t===null||t===void 0?void 0:t.columnTemplate;return n?n(o,t):o(i,null,t.title)}const J=new WeakMap;const L=new WeakMap;function Z(t,n,e){if(J.get(t))return;const o=E();const i=o.general.state.scrollParent;const r=new IntersectionObserver((([t])=>{const o=t.rootBounds||document.scrollingElement.getBoundingClientRect();const r={};if(n==="start"){r.start=t.boundingClientRect.x-(o.x+i.scrollLeft)<0&&!t.isIntersecting}if(n==="end"){r.end=t.boundingClientRect.right>t.boundingClientRect.width&&!t.isIntersecting}if(!!e)e(r)}),{threshold:[1],rootMargin:"1px 0px 100px 0px",root:i===document.scrollingElement?null:i});J.set(t,r);setTimeout((()=>r.observe(t)),300)}function U(t,n,e){if(L.get(t))return;const o=E();const i=o.general.state.scrollParent;const r=new IntersectionObserver((([t])=>{const o=t.rootBounds||document.scrollingElement.getBoundingClientRect();const r={};if(n==="top"){r.top=t.boundingClientRect.y-(o.y+i.scrollTop)<0&&!t.isIntersecting}if(n==="bottom"){const n=t.target.getBoundingClientRect();r.bottom=n.height+n.y>o.height&&!t.isIntersecting}if(!!e)e(r)}),{threshold:[1],rootMargin:"0px 100px 0px 100px",root:i===document.scrollingElement?null:i});L.set(t,r);requestAnimationFrame((()=>r.observe(t)))}function G(t,n,e=false){const o={[`${b}__${t}`]:true,[`${b}__pin`]:!!n,[`${b}__pin--top`]:n==="top",[`${b}__pin--bottom`]:n==="bottom"};if(e)return K(o);return o}function K(t){let n="";Object.entries(t).forEach((([t,e])=>{if(e)n+=t+" "}));return n}function Q(t){let n=getComputedStyle(t);const e=n.position==="absolute";const o=/(auto|scroll)/;if(n.position==="fixed")return document.documentElement;for(let i=t;i=i.parentElement;){n=getComputedStyle(i);if(e&&n.position==="static"){continue}if(o.test(n.overflow+n.overflowY+n.overflowX))return i}return document.documentElement}function V(t,n=100){const e=t.getBoundingClientRect();const o=window.innerHeight||document.documentElement.clientHeight;if(!e.bottom&&!e.top&&!e.left&&!e.right&&!e.height&&!e.width&&!e.x&&!e.y)return false;return!(Math.floor(100-(e.top>=0?0:e.top)/+-e.height*100)<n||Math.floor(100-(e.bottom-o)/e.height*100)<n)}function X(t,n,e){const o=[...e];const i=o.splice(t,1)[0];o.splice(n,0,i);return o}let Y;let tt;let nt;let et;const ot=({column:t,headRenderer:n,onColumnSortClick:e,onColumnPinned:r,onColumnDrag:s,onColumnDrop:a,defaults:l})=>{const d=E();function c(t,n){Y=n;tt=nt=t.target;et=tt.closest("."+`${b}__tr`);et.classList.add(`${b}__dragging`);tt.classList.add(`${b}__drag--start`);t.dataTransfer.effectAllowed="move";t.dataTransfer.setData("text/html",tt.innerHTML);s(n.prop,tt)}function h(){et.classList.remove(`${b}__dragging`);tt.classList.remove(`${b}__drag--start`);et.querySelectorAll(`.${b}__drag-mask--active`).forEach((t=>{t.classList.remove(`${b}__drag-mask--active`)}));tt=null;Y=null;et=null;nt=null}function p(t){if(nt===t.target)return;t.preventDefault();t.stopImmediatePropagation();t.dataTransfer.dropEffect="move";et.querySelectorAll(`.${b}__drag-mask--active`).forEach((t=>{t.classList.remove(`${b}__drag-mask--active`)}));nt=t.target;if(!nt.classList.contains(`${b}__drag-mask`)){t.dataTransfer.dropEffect="none";return}nt.classList.add(`${b}__drag-mask--active`)}function _(t){t.stopPropagation();const{colName:n}=this.dataset;if(n===Y.prop)return;const e=d.config.state.columns;let o=e.findIndex((t=>t.prop===n));const i=e.findIndex((t=>t===Y));if(o<i&&this.classList.contains(`${b}__drag-mask--end`))o++;if(o>i&&this.classList.contains(`${b}__drag-mask--start`))o--;if(o===i)return;a(Y.prop,d.config.state.columns[o].prop,tt)}function f(n){let o;switch(t.order){case"asc":o="desc";break;case"desc":o=null;break;default:o="asc"}e(o,t.prop,n.target.closest("th"))}function u(){return!!l.sortable&&t.sortable!==false||!l.sortable&&t.sortable===true}function g(){return!!l.draggable&&t.draggable!==false||!l.draggable&&t.draggable===true}let m={};if(t.columnProperties){m=t.columnProperties(t)||m}const v={class:Object.assign(Object.assign({},G("th",n===null||n===void 0?void 0:n.pinned)),{[`${b}__pin--start`]:t.pinned==="start",[`${b}__pin--end`]:t.pinned==="end",[`${b}__ordered`]:!!t.order,[`${b}__filtered`]:!!t.filter})};let w=m?W(v,m):v;const y=q(t);if(!y)return o(i,null);w=Number(w.colSpan)>1?Object.assign(Object.assign({},w),{scope:"colgroup"}):Object.assign(Object.assign({},w),{scope:"col"});if(u()){const n=t.order?t.order==="asc"?"ascending":"descending":"none";w=Object.assign(Object.assign({},w),{"aria-sort":n})}if(g()){w=Object.assign(Object.assign({},w),{draggable:true,onDragStart:n=>c(n,t),onDragOver:t=>t.preventDefault(),onDragEnd:()=>h()})}return o("th",Object.assign({},w,{ref:e=>{if(["end","start"].includes(t.pinned))Z(e,t.pinned,r);if(["top","bottom"].includes(n.pinned))U(e,n.pinned,r)},key:t.prop}),g()&&[o("div",{class:{[`${b}__drag-mask`]:true,[`${b}__drag-mask--start`]:true},"data-col-name":t.prop,onDragEnter:p,onDrop:_,onDragOver:t=>t.preventDefault()}),o("div",{class:{[`${b}__drag-mask`]:true,[`${b}__drag-mask--end`]:true},"data-col-name":t.prop,onDragEnter:p,onDrop:_,onDragOver:t=>t.preventDefault()})],u()?o("button",{class:{[`${b}__order-btn`]:true,[`${b}__cell-content`]:true},onClick:f},q(t),!!t.filter&&o("nano-icon",{name:"light/filter"}),!!t.order&&(t.order==="desc"?o("nano-icon",{name:"solid/long-arrow-down"}):o("nano-icon",{name:"solid/long-arrow-up"})),o("div",{class:`${b}__status-icons`},o("nano-icon",{name:"light/chevron-down"}))):o("div",{class:`${b}__cell-content`},q(t),!!t.filter&&o("nano-icon",{name:"light/bars-filter"})))};function it(t,n){var e,r;const s=E();const a=s.config.state.columns;const l=(e=a[n])===null||e===void 0?void 0:e.cellTemplate;const d=P(t,n);if(!!d.cellModel&&a[n].type==="date"){const t=new Date(d.cellModel);if(t instanceof Date&&!isNaN(t)){d.cellModel=!l?`${new Date(d.cellModel).toLocaleDateString()} ${new Date(d.cellModel).toLocaleTimeString()}`:t}}return l?l(o,d):d.cellModel?o(i,null,(r=d.cellModel)===null||r===void 0?void 0:r.toString()):""}const rt=(t,n=false)=>{const e=E();const o=e.config.state.columns[t];const i={[`${b}__td`]:true,[`${b}__ordered`]:!!o.order,[`${b}__pin`]:!!o.pinned,[`${b}__pin--start`]:o.pinned==="start",[`${b}__pin--end`]:o.pinned==="end"};if(n)return K(i);return i};const st=({rowIndex:t,colIndex:n,nestedContent:e})=>{const i=()=>e?e():it(t,n)||o("span",{class:"placeholder"}," ");let r="td";const s=E();const a=s.config.state.columns[n];let l=H(t,n,{class:rt(n)});if(a.rowHeader){l=Number(l.rowSpan)>1?Object.assign(Object.assign({},l),{scope:"rowgroup"}):Object.assign(Object.assign({},l),{scope:"row"});r="th"}const d=t=>o("div",Object.assign({},t,{class:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:!!a.wrap}}),o(i,null));return o(r,Object.assign({},l),a.autoTooltip&&!a.wrap?o("nano-resize-observe",{notifyContentFit:"x",onNanoResizeContentFitChange:t=>t.target.firstElementChild.disabled=t.detail.x},o("nano-tooltip",{disabled:true,placement:"top",onNanoShow:t=>t.target.closest(r).style.zIndex="100",onNanoHide:t=>t.target.closest(r).style.zIndex=""},o(d,null),o("span",{slot:"content"},o(i,null)))):o(d,null))};const at=({rowRenderer:t,rowIndex:n,rowModel:e,onColumnPinned:i},r,s)=>{let a={};const l=({header:t,wrap:n},e)=>{const i=o("div",{class:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:n}},e);return t?o("th",{scope:"row"},i):o("td",null,i)};if(!e){const t=A(n);e=t.rowModel}if(t===null||t===void 0?void 0:t.rowProperties){a=t.rowProperties({rowModel:e,rowIndex:n})||a}let d;if((t===null||t===void 0?void 0:t.pinned)&&typeof t.pinned==="function"){d=t.pinned()}const c={class:G("tr",d)};const h=a?W(c,a):c;const p=t===null||t===void 0?void 0:t.template;if(p){let t=p(o,{renderedRow:o("tr",Object.assign({},h,{key:e.__uuid}),r),rowModel:e,rowIndex:n},l);if(Array.isArray(t)){t=s.map(t,((t,n)=>{if(t.vtag==="tr"){if(!t.vkey)t.vkey=`${e.__uuid}_${n}`;t.vattrs=W({class:G("tr",d,true)},t.vattrs);if(!!t.vchildren){t.vchildren=s.map(t.vchildren,((t,n)=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=W({class:G(t.vtag.toString(),d,true)+rt(n,true),ref:t=>{if(!!t&&d==="top"||d==="bottom")U(t,d,i);if(!!t&&t.classList.contains("nano-tbl__pin--end"))Z(t,"end",i);if(!!t&&t.classList.contains("nano-tbl__pin--start"))Z(t,"start",i)}},t.vattrs)}return t}))}}return t}))}return t}return o("tr",Object.assign({},h,{key:e.__uuid}),r)};const lt=({rowRenderer:t,onColumnPinned:n},e,i)=>{let r={};if(t.rowProperties){r=t.rowProperties()||{}}const s=({header:t,wrap:n},e)=>{const i=o("div",{class:{[`${b}__cell-content`]:true,[`${b}__cell-content--wrap`]:n}},e);return t!==false?o("th",{scope:"col"},i):o("td",null,i)};const a=t.pinned||null;const l={class:G("tr",null)};const d=r?W(l,r):l;const c=t===null||t===void 0?void 0:t.template;if(c){let t=c(o,{renderedRow:o("tr",Object.assign({},d),e)},s);if(Array.isArray(t)){t=i.map(t,(t=>{if(t.vtag==="tr"){t.vattrs=W({class:G("tr",a,true)},t.vattrs);if(!!t.vchildren){t.vchildren=i.map(t.vchildren,(t=>{if(["td","th"].includes(t.vtag.toString())){t.vattrs=W({class:G(t.vtag.toString(),a,true),ref:t=>{if(!!t&&a==="top"||a==="bottom")U(t,a,n);if(!!t&&t.classList.contains("nano-tbl__pin--end"))Z(t,"end",n);if(!!t&&t.classList.contains("nano-tbl__pin--start"))Z(t,"start",n)}},t.vattrs)}return t}))}}return t}))}return t}return o("tr",Object.assign({},d),e)};const dt=':host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}nano-table{display:block;width:100%;--max-col-width:clamp(200px, 500px, 50vw);--color:var(--nano-color-mediumgrey, #68767e);--font-size:0.87rem;--cell-line-height:1.5;--thead-font-size:0.95rem;--thead-color:#455560;--tfoot-color:#455560;--border-color:#dddbda;--border-style:thin solid var(--border-color);--border-tint-color:#0084a9;--border-tint-style:3px solid var(--border-tint-color);--cell-bg-rgb:var(--nano-color-white-rgb, 255 255 255);--head-bg-rgb:250, 250, 249;--foot-bg-rgb:var(--head-bg-rgb);--th-row-bg-rgb:var(--cell-bg-rgb);--ordered-bg-rgb:var(--nano-color-offwhite-rgb, 249 249 251);--td-padding-start:0.625rem;--td-padding-end:0.625rem;--td-padding-top:0.5rem;--td-padding-bottom:0.4125rem;--th-padding-start:0.625rem;--th-padding-end:0.625rem;--th-padding-top:0.875rem;--th-padding-bottom:0.6875rem;--td-padding-v:var(--td-padding-top) var(--td-padding-bottom);--td-padding-h:var(--td-padding-start) var(--td-padding-end);--th-padding-v:var(--th-padding-top) var(--th-padding-bottom);--th-padding-h:var(--th-padding-start) var(--th-padding-end);--foot-th-padding-v:var(--td-padding-top) var(--td-padding-bottom);--foot-th-padding-h:var(--td-padding-start) var(--td-padding-end);--head-th-padding-v:var(--th-padding-top) var(--th-padding-bottom);--head-th-padding-h:var(--th-padding-start) var(--th-padding-end);--bookend-col-padding:2rem}.nano-tbl{color:var(--color);text-align:start;width:100%;font-size:var(--font-size);border-spacing:0 0;border-collapse:separate;background:rgb(var(--cell-bg-rgb));-webkit-border-end:1px solid transparent;border-inline-end:1px solid transparent;-webkit-border-before:1px solid transparent;border-block-start:1px solid transparent;position:relative;z-index:1}.nano-tbl__wrap{display:table;min-width:100%}.nano-tbl__top-anchor{clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;position:relative}.nano-tbl__ordered{background-color:var(--ordered-bg);-webkit-border-start:var(--border-style);border-inline-start:var(--border-style);-webkit-border-end:var(--border-style);border-inline-end:var(--border-style)}.nano-tbl__drag-mask{display:none;position:absolute;inset-block:-2px -2px;z-index:10;opacity:0;transition:0.2s ease opacity}.nano-tbl__drag-mask--start{width:calc(50% + 2px);inset-inline-start:-2px;-webkit-border-start:2px dashed var(--border-tint-color);border-inline-start:2px dashed var(--border-tint-color)}.nano-tbl__drag-mask--end{width:50%;inset-inline-end:0;-webkit-border-end:2px dashed var(--border-tint-color);border-inline-end:2px dashed var(--border-tint-color)}.nano-tbl__drag-mask--active{opacity:1}.nano-tbl__dragging .nano-tbl__drag-mask{display:block}.nano-tbl__drag--start{opacity:0.4}.nano-tbl__dragging .nano-tbl__td,.nano-tbl__dragging .nano-tbl__th{cursor:no-drop}.nano-tbl__dragging .nano-tbl__td .nano-tbl__cell-content,.nano-tbl__dragging .nano-tbl__th .nano-tbl__cell-content{pointer-events:none}.nano-tbl__order-btn{padding:0;border:none;outline:none;font:inherit;background:none;-webkit-appearance:none;appearance:none;color:inherit;display:flex;gap:10px;align-items:center;width:100%}.nano-tbl__status-icons{margin-inline:auto 10px;display:flex;gap:10px}.nano-tbl__progress-bar{font-size:0.2rem;position:sticky;inset-block-start:0;inset-inline:0;z-index:10;transition:scale 0.25s;transform:scale(0);width:100%;height:0}.nano-tbl__progress-bar--show{transform:scale(1);height:auto}.nano-tbl__caption--hide{clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute}.nano-tbl__td,.nano-tbl__th{line-height:var(--cell-line-height);text-align:start;-webkit-border-before:var(--border-style);border-block-start:var(--border-style);max-width:var(--max-col-width);background-color:rgb(var(--cell-bg-rgb))}tbody:first-of-type tr:first-child .nano-tbl__td,tbody:first-of-type tr:first-child .nano-tbl__th{-webkit-border-before:none;border-block-start:none}tbody:last-of-type tr:last-child .nano-tbl__td,tbody:last-of-type tr:last-child .nano-tbl__th{-webkit-border-after:var(--border-style);border-block-end:var(--border-style)}.md .nano-tbl__td:first-child .nano-tbl__cell-content,.md .nano-tbl__th:first-child .nano-tbl__cell-content{-webkit-padding-start:var(--bookend-col-padding);padding-inline-start:var(--bookend-col-padding)}.md .nano-tbl__td:last-child .nano-tbl__cell-content,.md .nano-tbl__th:last-child .nano-tbl__cell-content{-webkit-padding-end:var(--bookend-col-padding);padding-inline-end:var(--bookend-col-padding)}@media (max-width: 768px){.nano-tbl__td:first-child .nano-tbl__cell-content,.nano-tbl__th:first-child .nano-tbl__cell-content{-webkit-padding-start:var(--td-padding-start) !important;padding-inline-start:var(--td-padding-start) !important}.nano-tbl__td:last-child .nano-tbl__cell-content,.nano-tbl__th:last-child .nano-tbl__cell-content{-webkit-padding-end:var(--td-padding-end) !important;padding-inline-end:var(--td-padding-end) !important}}thead .nano-tbl__td,thead .nano-tbl__th{color:var(--thead-color);font-weight:800;background:rgb(var(--head-bg-rgb)/90%);font-size:var(--thead-font-size);-webkit-border-before:none !important;border-block-start:none !important;transition:all 0.2s ease}thead .nano-tbl__td .nano-tbl__cell-content,thead .nano-tbl__th .nano-tbl__cell-content{padding-block:var(--head-th-padding-v);padding-inline:var(--head-th-padding-h)}tfoot .nano-tbl__td,tfoot .nano-tbl__th{color:var(--tfoot-color);font-weight:800;-webkit-border-before:none;border-block-start:none;background:rgb(var(--foot-bg-rgb)/90%);font-size:var(--thead-font-size)}tfoot .nano-tbl__td .nano-tbl__cell-content,tfoot .nano-tbl__th .nano-tbl__cell-content{padding-block:var(--foot-th-padding-v);padding-inline:var(--foot-th-padding-h)}.nano-tbl__td.nano-tbl__ordered,.nano-tbl__th.nano-tbl__ordered{background-color:rgb(var(--ordered-bg-rgb)/80%) !important}.nano-tbl__cell-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-block:var(--td-padding-v);padding-inline:var(--td-padding-h)}.nano-tbl__cell-content--no-result{padding-block:2rem}.nano-tbl__cell-content--wrap{white-space:normal;overflow:visible}.nano-tbl tbody{will-change:scroll-position;opacity:1;transition:0.1s ease opacity;transform:translateZ(0)}.nano-tbl tbody.nano-tbl__inactive{opacity:0}.nano-tbl th[scope=row]{font-weight:800;margin:0}.nano-tbl__pin{position:sticky;transform:translateZ(0)}.nano-tbl__pin--start{inset-inline:-1px auto;transition:max-width 0.25s ease}.nano-tbl__pin--start::after{content:"";position:absolute;inset:0;box-shadow:5px 1px 4px 0 rgba(0, 0, 0, 0.2);opacity:0;z-index:-1}.nano-tbl__pinned--start .nano-tbl__pin--start{z-index:2;max-width:125px !important}.sm .nano-tbl__pinned--start .nano-tbl__pin--start{max-width:var(--max-col-width) !important}.nano-tbl__pinned--start .nano-tbl__pin--start::after{opacity:1}.nano-tbl__pin--end{}.nano-tbl__pin--start+.nano-tbl__pin--end{inset-inline:auto auto}.nano-tbl__pin--start+.nano-tbl__pin--end::after{display:none}.sm .nano-tbl__pin--end{inset-inline:auto -1px !important;max-width:min(50vw, 200px)}.sm .nano-tbl__pin--end::after{display:block !important;content:"";position:absolute;inset:0;box-shadow:-5px 1px 4px 0 rgba(0, 0, 0, 0.2);opacity:0;z-index:-1}.sm .nano-tbl__pinned--end .nano-tbl__pin--end::after{opacity:1}.nano-tbl__pin--top{inset-block:-1px auto}.nano-tbl__pinned--top .nano-tbl__pin--top{z-index:4 !important}.nano-tbl__pin--bottom{inset-block:auto -1px}.nano-tbl__pinned--bottom .nano-tbl__pin--bottom{z-index:5 !important}.nano-tbl__pinned--start .nano-tbl__pin--top.nano-tbl__pin--start{z-index:5 !important}.nano-tbl__pinned--top.nano-tbl__pinned--start .nano-tbl__pin--top.nano-tbl__pin--start{z-index:6 !important}.nano-tbl__pinned--end .nano-tbl__pin--top.nano-tbl__pin--end{z-index:5 !important}.nano-tbl__pinned--top.nano-tbl__pinned--end .nano-tbl__pin--top.nano-tbl__pin--end{z-index:6 !important}.nano-tbl__pinned--start .nano-tbl__pin--bottom.nano-tbl__pin--start{z-index:5 !important}.nano-tbl__pinned--bottom.nano-tbl__pinned--start .nano-tbl__pin--bottom.nano-tbl__pin--start{z-index:6 !important}.nano-tbl__pinned--end .nano-tbl__pin--bottom.nano-tbl__pin--end{z-index:5 !important}.nano-tbl__pinned--bottom.nano-tbl__pinned--end .nano-tbl__pin--bottom.nano-tbl__pin--end{z-index:6 !important}.nano-tbl thead tr:last-of-type td,.nano-tbl thead tr:last-of-type th{-webkit-border-after:var(--border-tint-style);border-block-end:var(--border-tint-style)}.nano-tbl tfoot tr:first-of-type td,.nano-tbl tfoot tr:first-of-type th{-webkit-border-before:none;border-block-start:none}.nano-tbl tfoot tr:last-of-type td,.nano-tbl tfoot tr:last-of-type th{-webkit-border-after:var(--border-tint-style);border-block-end:var(--border-tint-style)}.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:first-of-type td,.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:first-of-type th{-webkit-border-before:var(--border-tint-style) !important;border-block-start:var(--border-tint-style) !important}.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:last-of-type td,.nano-tbl__pinned--bottom .nano-tbl tfoot tr.nano-tbl__pin--bottom:last-of-type th{-webkit-border-after:none !important;border-block-end:none !important}.nano-tbl .unlimited-width{max-width:none}.nano-tbl__spinner{font-size:1.5rem;transition:scale 0.25s;scale:0;padding:0.5rem;position:absolute;inset-block-end:0;inset-inline-start:calc(50% - 0.75rem);z-index:0}.nano-tbl__spinner--show{scale:1;position:sticky}.nano-tbl nano-skeleton{line-height:var(--cell-line-height)}';let ct=0;const ht=class{constructor(t){r(this,t);this.nanoTblReady=s(this,"nanoTblReady",7);this.nanoTblBlockRendered=s(this,"nanoTblBlockRendered",7);this.nanoTblBeforeSort=s(this,"nanoTblBeforeSort",7);this.nanoTblAfterSort=s(this,"nanoTblAfterSort",7);this.nanoTblColDrag=s(this,"nanoTblColDrag",7);this.nanoTblColDrop=s(this,"nanoTblColDrop",7);this.nanoTblBeforeFilter=s(this,"nanoTblBeforeFilter",7);this.nanoTblAfterFilter=s(this,"nanoTblAfterFilter",7);this.nanoTblBeforeSearch=s(this,"nanoTblBeforeSearch",7);this.nanoTblAfterSearch=s(this,"nanoTblAfterSearch",7);this.nanoTblBeforeEdit=s(this,"nanoTblBeforeEdit",7);this.renderId="tbl-"+ct++;this.filters=[];this.currentFilters="[]";this.currentSort="";this.cacheScrollPosition=0;this.measureHeight=0;this.blockHeights=[];this.unitHeight=0;this._isReady=false;this.colDrag=t=>{this.nanoTblColDrag.emit({column:t})};this.colDrop=(t,n)=>{const e=this.store.config.state.columns;const o=e.findIndex((t=>t.prop===n));const i=e.findIndex((n=>n.prop===t));const r=this.nanoTblColDrop.emit({fromCol:t,toCol:n,fromIndex:i,toIndex:o});if(r.defaultPrevented)return;this.columns=X(i,o,e)};this.sortStart=async(t,n,e)=>{if(this.currentSort===t+":"+n)return;this._loading=true;const o=this.nanoTblBeforeSort.emit({column:n,order:t});if(o.defaultPrevented)return;this.currentSort=t+":"+n;this.scrollToTop(e);if(this.customSortFn){try{const e=await this.customSortFn(n,t);if(e===true){this.sortComplete(t,n);this._loading=false;return}}catch(t){console.warn("custom sort failed",t);this.currentSort="";this._loading=false;return}}try{await F(this.host,n,t);this.sortComplete(t,n)}catch(t){console.warn("sort failed",t);this.currentSort=""}finally{if(this.blocks.length)this._loading=false}};this.scrollHandler=()=>{this.cacheScrollPosition=this.scrollParent.scrollTop||window.scrollY;requestAnimationFrame((()=>{let t=0;let n=0;const e=this.blocks.length;while(n<e&&this.cacheScrollPosition>=t){t+=this.getBlockHeight(n);if(this.cacheScrollPosition<t){const t=[n,n+1,Math.max(0,n-1)];if(t.toString()!==this.activeBlocks.toString()){this.activeBlocks=t;this.setBlockHeight()}this.primaryBlockIndex=n}n++}}))};this.handleColumnPinned=t=>{Object.entries(t).forEach((([t,n])=>{this.tableEle.classList.toggle(`${b}__pinned--${t}`,n)}))};this.handleResizeChange=t=>{var n;this.tableWrapperEle.className="";let e=[`${b}__wrap`];if((n=t.target)===null||n===void 0?void 0:n.className)e=[...t.target.className.split(" "),...e];this.tableWrapperEle.classList.add(...e.filter((t=>!!t)))};this.type="table";this.caption=undefined;this.showCaption=false;this.loading=undefined;this.internalLoading=false;this.placeholderSize=5;this.rows=undefined;this.columns=[];this.headRender={pinned:"top"};this.rowRender=undefined;this.footRender={pinned:"bottom"};this.showFooter=false;this.perBlock=40;this.searchTerm=undefined;this.customFilterFn=undefined;this.customSortFn=undefined;this.defaultSort=true;this.defaultColDraggable=false;this.virtualTotalItems=0;this.blocks=[];this.activeBlocks=[0,1,2];this.debounceSetLoading=c(this.debounceSetLoading.bind(this),50)}get _loading(){return this.loading!==undefined?this.loading:this.internalLoading}set _loading(t){if(this.loading!==undefined)return;this.debounceSetLoading(t)}debounceSetLoading(t){this.internalLoading=t}handleRowsChange(){if(!this.rows){this._loading=true;return}this._loading=true;Promise.resolve(this.rows).then((async t=>{await R(this.host,t);this.currentFilters="";this.currentSort="";await this.columnInit();if(!this.isReady)this.setInitialBlockDimension();this._loading=false}))}async handleColsChange(){await M(this.host,this.columns);if(this.isReady)this.columnInit()}get blocksLength(){return this.blocks.length}handleSearchTermChange(){this.searchStart()}virtualTotalItemsChangeHandler(){this.setBlocks()}async resetSorting(){const t=this.columns.find((t=>!!t.order));if(!t)return;return this.sortStart(null,t.prop)}async addSort(t,n){const e=this.columns.find((n=>n.prop===t));if(!e)throw"Cannot find column with "+t;return this.sortStart(n,e.prop)}async resetFilters(){this.filters=[];return this.filterStart()}async addFilters(t,n=true){if(!n)this.filters=[];return this.filterStart(t,n)}async removeFilters(t){this.filters=this.filters.filter((n=>!t.includes(n.prop)));return this.filterStart()}async updateRow(t,n){this.rows.splice(n,1,t);this.handleRowsChange()}set measureEle(t){var n;if(!t)return;const e=t.getBoundingClientRect().height;this.measureHeight=Math.abs(this.measureHeight-e)<5?this.measureHeight:e;this.unitHeight=((n=t.querySelector("tr"))===null||n===void 0?void 0:n.getBoundingClientRect().height)||this.unitHeight}get scrollParent(){return this._scrollParent}set scrollParent(t){if(t===this._scrollParent)return;if(this._scrollParent){(this._scrollParent===document.documentElement?document:this._scrollParent).removeEventListener("scroll",this.scrollHandler)}(t===document.documentElement?document:t).addEventListener("scroll",this.scrollHandler);this._scrollParent=t}get primaryBlockIndex(){return this._primaryBlockIndex}set primaryBlockIndex(t){if(this._primaryBlockIndex===t)return;this._primaryBlockIndex=t;this.nanoTblBlockRendered.emit({block:t,totalBlocks:this.blockElements.length})}get isReady(){return this._isReady}set isReady(t){if(t===this._isReady)return;this._isReady=t;if(this.isReady)requestAnimationFrame((()=>this.handleReady()))}handleReady(){const t=window.location.hash;if(t.length>1){try{const n=document.querySelector(t);if(n)n.scrollIntoView()}catch(t){}}this.nanoTblReady.emit()}sortComplete(t,n){this.columns=this.columns.map((e=>{if(e.prop===n)return Object.assign(Object.assign({},e),{order:t});return Object.assign(Object.assign({},e),{order:null})}));this.nanoTblAfterSort.emit({column:n,order:t})}async searchStart(){this._loading=true;const t=this.nanoTblBeforeSearch.emit({term:this.searchTerm});if(t.defaultPrevented)return;this.scrollToTop();try{await N(this.host,this.searchTerm);this.nanoTblAfterSearch.emit({term:this.searchTerm})}catch(t){console.warn("search failed",t)}finally{this._loading=false}}async filterStart(t,n=true){if(t){if(n){this.filters=[...this.filters.filter((n=>!t.find((t=>t.prop===n.prop)))),...t]}else{this.filters=t}}if(this.currentFilters===JSON.stringify(this.filters))return;this._loading=true;const e=this.nanoTblBeforeFilter.emit({filters:this.filters});if(e.defaultPrevented)return;this.currentFilters=JSON.stringify(this.filters);this.scrollToTop();if(this.customFilterFn){try{const t=await this.customFilterFn(this.filters);if(t===true){this.filterComplete();this._loading=false}}catch(t){console.warn("custom filter failed",t);this.currentFilters="";this._loading=false}return}try{await B(this.host,this.filters);this.filterComplete()}catch(t){console.warn("filter failed",t)}finally{this._loading=false}}filterComplete(){this.columns=this.columns.map((t=>{const n=this.filters.find((n=>n.prop===t.prop));if(n)t.filter=n.filter;return t}));this.nanoTblAfterFilter.emit({filters:this.filters})}scrollToTop(t){var n;const e=(n=this.scrollParent.style)===null||n===void 0?void 0:n.scrollBehavior;const o=this.scrollParent.scrollLeft;this.scrollParent.style.scrollBehavior="auto";if(this.topAnchorEle&&!V(this.topAnchorEle,.1)){this.host.scrollIntoView()}if(t&&!V(t,1))setTimeout((()=>t.scrollIntoView({block:"start"})),500);if(o)this.scrollParent.scrollLeft=o;if(e)this.scrollParent.style.scrollBehavior=e;this.scrollHandler()}setMeasureElement(){a((()=>{this.measureEle=this.blockElements.find((t=>{var n;return!((n=t===null||t===void 0?void 0:t.classList)===null||n===void 0?void 0:n.contains(`${b}__inactive`))}))}))}setInitialBlockDimension(){var t;if(!((t=this.blockElements)===null||t===void 0?void 0:t.length))return;const n=new Promise((t=>{a((()=>{this.setMeasureElement();if(!this.measureEle&&!this.unitHeight)t();this.blockElements.forEach(((n,e)=>{var o;if(!n||!((o=n.classList)===null||o===void 0?void 0:o.contains(`${b}__inactive`))){if(e===this.blockElements.length-1)t();return}if(e===this.blockElements.length-1)t()}))}))}));n.then((()=>{requestAnimationFrame((()=>{this.isReady=true}))}))}async columnInit(){this.filters=this.columns.filter((t=>!!t.filter)).map((t=>{const{filter:n,prop:e}=t;return{filter:n,prop:e}}));if(this.searchTerm){await this.searchStart()}if(this.filters.length){await this.filterStart()}const t=this.columns.find((t=>!!t.order));if(!!t){await this.sortStart(t.order,t.prop)}}setBlocks(){const t=this.store.data.state.rows;if(!t.length){this.blocks=[];return}let n=1;const e=this.virtualTotalItems>t.length?this.virtualTotalItems:t.length;let o=[];const i=[];this.blockHeights=[];for(n;n<=e;n++){o.push(this.store.data.state.rows[n-1]||{__uuid:""});if(n%this.perBlock===0){i.push({rows:o,__uuid:d(o.map((t=>t.__uuid)).join())});o=[]}}if(o.length){i.push({rows:o,__uuid:d(o.map((t=>t.__uuid)).join())})}this.blocks=i}getBlockHeight(t){if(this.blockHeights.length){const n=this.blockHeights.find((n=>n.blockIndex===t));if(n)return n.height}const n=this.blocks[t].rows.length;if(n===this.perBlock&&this.measureHeight){return this.measureHeight}return this.unitHeight?this.unitHeight*n:undefined}setBlockHeight(){this.activeBlocks.forEach((t=>{const n=this.blockElements[t];if(!n)return;a((()=>{const e=n.getBoundingClientRect().height;const o=this.blockHeights.findIndex((n=>n.blockIndex===t));if(o>0){this.blockHeights[o]={height:e,blockIndex:t}}else this.blockHeights.push({height:e,blockIndex:t})}))}))}processSlots(){if(!this.caption&&!this.host.querySelector('[slot="caption"]')){console.error("For accessibility you must set a `caption` prop or use the `caption` slot")}}async componentWillLoad(){this.scrollParent=Q(this.host);this.store=await I(this.host,this.columns,this.scrollParent);await this.handleRowsChange();this.processSlots();this.store.data.onChange("rows",(()=>this.setBlocks()));this.setBlocks()}connectedCallback(){this.scrollParent=Q(this.host)}componentDidLoad(){this.setInitialBlockDimension()}componentShouldUpdate(t,n,e){if(["rows","columns"].includes(e))return false}componentWillRender(){}componentDidRender(){this.setMeasureElement()}render(){this.blockElements=[];return o(l,null,o("div",{class:`${b}__top-anchor`,ref:t=>this.topAnchorEle=t}," "),o("nano-resize-observe",{"aria-labelledby":"table-caption-"+this.renderId,tabindex:this.type==="grid"?"0":undefined,states:"576w sm, 768w md",class:"sm md",onNanoResizeStateChange:this.handleResizeChange}),o("div",{class:`${b}__wrap sm md`,ref:t=>this.tableWrapperEle=t},o("nano-progress-bar",{indeterminate:true,class:{[`${b}__progress-bar`]:true,[`${b}__progress-bar--show`]:this._loading}}),o("table",{role:this.type==="grid"?"grid":undefined,"aria-readonly":this.type==="table"?"true":undefined,"aria-rowcount":this.store.data.state.rows.length,"aria-colcount":this.store.config.state.columns.length,class:`${b}`,ref:t=>this.tableEle=t},o("caption",{class:{[`${b}__caption`]:true,[`${b}__caption--hide`]:!this.showCaption},id:"table-caption-"+this.renderId},o("slot",{name:"caption"},this.caption)),o("thead",null,o(lt,{rowRenderer:this.headRender,onColumnPinned:this.handleColumnPinned},this.store.config.state.columns.map((t=>[o(ot,{column:t,headRenderer:this.headRender,onColumnSortClick:this.sortStart,onColumnPinned:this.handleColumnPinned,onColumnDrag:this.colDrag,onColumnDrop:this.colDrop,defaults:{sortable:this.defaultSort,draggable:this.defaultColDraggable}})])))),this._loading&&!this.blocks.length&&o("tbody",{class:`${b}__active`},[...Array(10).keys()].map((t=>o("tr",null,this.store.config.state.columns.map(((n,e)=>o(st,{rowIndex:t,colIndex:e,nestedContent:()=>o("nano-skeleton",null)}))))))),!this._loading&&!this.blocks.length&&o("tr",null,o("th",{class:`${b}__th`,colSpan:this.store.config.state.columns.length},o("div",{class:"nano-tbl__cell-content nano-tbl__cell-content--no-result"},o("slot",{name:"no-results"},"No results found")))),this.blocks.map(((t,n)=>o("tbody",{key:t.__uuid,id:`tbody-${this.renderId}-${n}`,ref:t=>{this.blockElements.push(t)},class:{[`${b}__inactive`]:!this.activeBlocks.includes(n),[`${b}__active`]:this.activeBlocks.includes(n)}},this.activeBlocks.includes(n)?t.rows.map(((t,e)=>{const i=n>0?n*this.perBlock+e:e;return o(at,{rowRenderer:this.rowRender,rowModel:t,rowIndex:i},this.store.config.state.columns.map(((t,n)=>o(st,{rowIndex:i,colIndex:n}))))})):o("tr",null,o("td",{colSpan:this.store.config.state.columns.length,style:{height:this.getBlockHeight(n)+"px"}}))))),this.showFooter&&o("tfoot",null,o(lt,{rowRenderer:this.footRender,onColumnPinned:this.handleColumnPinned},this.store.config.state.columns.map((t=>[o(ot,{column:t,headRenderer:this.footRender,onColumnPinned:this.handleColumnPinned,onColumnSortClick:this.sortStart,defaults:{sortable:this.defaultSort,draggable:this.defaultColDraggable}})]))))),!!this.blocks.length&&o("nano-spinner",{type:"circle",class:{[`${b}__spinner`]:true,[`${b}__spinner--show`]:this._loading}})))}get host(){return n(this)}static get watchers(){return{rows:["handleRowsChange"],columns:["handleColsChange"],searchTerm:["handleSearchTermChange"],virtualTotalItems:["virtualTotalItemsChangeHandler"]}}};ht.style=dt;export{ht as T,v as c};
5
+ //# sourceMappingURL=p-f6497e5a.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import{r as i,c as a,h as o,a as t,g as e}from"./p-f84612d4.js";import{M as s}from"./p-e04f2333.js";import{l as n,u as r}from"./p-45b7682a.js";import{h as l}from"./p-b933f3c8.js";import{C as d}from"./p-7c23e950.js";import"./p-45abbbdd.js";import"./p-257432ff.js";import"./p-9746b0a5.js";import"./p-69a3e911.js";const h=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--border-radius:var(--nano-layer-border-radius, var(--nano-border-radius-medium, 4px));--content-background:#fafafa;--footer-content:#e4e6e8;--scrim-color:var(--nano-layer-overlay-dark, rgb(74 74 74 / 50%));--box-shadow:var(--nano-layer-shadow-large, 0 2px 8px rgba(0, 0, 0, 0.2));--close-button-color:#b5aea7;--width:60rem;--tint-color:#00607b;--body-padding-v:var(--nano-spacing-large, 20px);--body-padding-h:var(--nano-spacing-large, 20px);--header-padding-v:var(--nano-spacing-medium, 16px);--header-padding-h:var(--nano-spacing-large, 20px);--footer-padding-v:var(--nano-spacing-medium, 16px);--footer-padding-h:var(--nano-spacing-large, 20px)}.dialog{display:flex;align-items:center;justify-content:center;position:fixed;inset:0;z-index:var(--nano-layer-index-modal, 700)}.dialog:not(.dialog--visible){position:absolute;inline-size:1px;block-size:1px;clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%);overflow:hidden;pointer-events:none;visibility:hidden}.dialog__panel{display:flex;flex-direction:column;z-index:2;inline-size:var(--width);max-inline-size:calc(100% - var(--nano-spacing-xlarge, 24px));max-block-size:calc(92% - var(--nano-spacing-xlarge, 24px));background-color:var(--content-background);border-radius:var(--border-radius);box-shadow:var(--box-shadow);opacity:0;transform:scale(0.8);transition:var(--nano-transition-fast, 0.3s) opacity, var(--nano-transition-fast, 0.3s) transform}.dialog__panel:focus{outline:none}.dialog--with-ribbon .dialog__panel{-webkit-border-before:5px solid var(--tint-color);border-block-start:5px solid var(--tint-color)}.dialog--open .dialog__panel{display:flex;opacity:1;transform:none}.dialog--nodismiss .dialog__panel{animation:cannotClose 0.25s ease-in-out 1}@keyframes cannotClose{0%{transform:scale(1)}50%{transform:scale(1.08)}100%{transform:scale(1)}}.dialog__header{flex:0 0 auto;display:flex;min-inline-size:var(--width);inline-size:100%;background-color:var(--content-background);border-radius:var(--border-radius) var(--border-radius) 0 0;transition:var(--nano-transition-fast, 0.1s) box-shadow}.dialog--visible .dialog__header{min-inline-size:auto}[stuck] .dialog__header{box-shadow:var(--nano-layer-shadow-medium, 0 2px 4px rgba(0, 0, 0, 0.2))}.dialog__title{flex:1 1 auto;font-size:var(--nano-fontsize-large, 1.25rem);line-height:1.6;padding-block:var(--header-padding-v);padding-inline:var(--header-padding-h)}.dialog .dialog__close-icon{flex:0 0 auto;display:flex;align-items:center;font-size:var(--nano-fontsize-xlarge, 1.5rem);padding-block:0;padding-inline:var(--header-padding-h);--color:var(--close-button-color)}.dialog__body{padding-block:0 var(--body-padding-v);padding-inline:var(--body-padding-h)}.dialog:not(.dialog--has-header) .dialog__body{-webkit-padding-before:var(--body-padding-v);padding-block-start:var(--body-padding-v)}.dialog__body ::slotted(*){max-inline-size:100%}.dialog__body-wrap{flex:1 1 auto;overflow:auto;-webkit-overflow-scrolling:touch;border-radius:var(--border-radius)}.dialog:not(.dialog--has-header) .dialog__body-wrap{border-radius:0 0 inherit inherit}.dialog:not(.dialog--has-footer) .dialog__body-wrap{border-radius:inherit inherit 0 0}.dialog__footer{inline-size:100%;padding-block:var(--footer-padding-v);padding-inline:var(--footer-padding-h);background:var(--footer-content);border-radius:0 0 var(--border-radius) var(--border-radius);position:relative;inset-block-start:1px}.dialog--visible .dialog__footer{min-inline-size:auto}.dialog__footer ::slotted(button){-webkit-margin-end:var(--nano-spacing-small, 8px) !important;margin-inline-end:var(--nano-spacing-small, 8px) !important}.dialog:not(.dialog--has-footer) .dialog__footer{display:none}.dialog__close-txt{color:var(--tint-color);border:none;text-decoration:underline;margin:0;text-underline-offset:4px;background-color:transparent;font:inherit;-webkit-box-align:center;cursor:pointer;font-size:var(--nano-fontsize-small, 0.875rem);padding:0.5rem;border-radius:var(--nano-border-radius-small, 2px);transition:box-shadow 100ms ease-in-out}.dialog__close-txt:focus{outline:none;box-shadow:var(--nano-control-focus-shadow, 0 0 0 0.1875rem var(--nano-control-focus-color, rgba(144, 198, 231, 0.8)))}.dialog__overlay{position:fixed;inset:0;background-color:var(--scrim-color);opacity:0;transition:var(--nano-transition-fast, 0.3s) opacity;-webkit-backdrop-filter:blur(var(--nano-layer-overlay-blur, 3px));backdrop-filter:blur(var(--nano-layer-overlay-blur, 3px))}.dialog--open .dialog__overlay{opacity:1}";let c=0;const p=class{constructor(o){i(this,o);this.nanoShow=a(this,"nanoShow",7);this.nanoAfterShow=a(this,"nanoAfterShow",7);this.nanoHide=a(this,"nanoHide",7);this.nanoAfterHide=a(this,"nanoAfterHide",7);this.nanoInitialFocus=a(this,"nanoInitialFocus",7);this.nanoRequestClose=a(this,"nanoRequestClose",7);this.componentId=`dialog-${++c}`;this.willShow=false;this.willHide=false;this.addedTransEnd=false;this.handleKeyDown=i=>{if(i.key==="Escape"){this.requestClose()}};this.requestClose=()=>{const i=this.nanoRequestClose.emit();if(!i.defaultPrevented&&!this.noUserDismiss){this.hide()}else{this.noDismiss=true;setTimeout((i=>this.noDismiss=false),250)}};this.handleTransitionEnd=i=>{if(i.propertyName==="opacity"&&i.composedPath().find((i=>i===this.panel||i===this.overlay))){this.isVisible=this.open;this.willShow=false;this.willHide=false;this.open?this.nanoAfterShow.emit():this.nanoAfterHide.emit()}};this.handleSlotChange=()=>{this.hasFooter=l(this.host,"footer")};this.isVisible=false;this.noDismiss=false;this.hasFooter=false;this.showRibbon=true;this.open=false;this.label=undefined;this.noHeader=false;this.noFooter=false;this.noUserDismiss=false;this.storeId=undefined;this.storeMethod="url-hash";this.hoist=false}handleOpenChange(){this.open?this.show():this.hide()}handleHoistChange(){if(!this.hoist||document.body.children[0]===this.host)return;document.body.prepend(this.host)}async show(){if(this.willShow){return}const i=this.nanoShow.emit();if(i.defaultPrevented){this.open=false;return}this.originalTrigger=document.activeElement;this.willShow=true;this.isVisible=true;this.open=true;this.modal.activate();n(this.host);if(this.open){this.host.addEventListener("nanoAfterShow",(()=>{const i=this.nanoInitialFocus.emit();if(!i.defaultPrevented){this.panel.focus({preventScroll:true})}}),{once:true})}}async hide(){if(this.willHide){return}const i=this.nanoHide.emit();if(i.defaultPrevented){this.open=true;return}this.willHide=true;this.open=false;this.modal.deactivate();r(this.host);this.stopVideos();const a=this.originalTrigger;if(a&&typeof a.focus==="function"){setTimeout((()=>a.focus()))}}stopVideos(){const i=Array.from(this.host.querySelectorAll("iframe,video"));i.forEach((i=>{if(i.tagName.toLowerCase()==="video")i.pause();else{const a=i.src;i.src=a}}))}connectedCallback(){this.handleHoistChange();this.modal=new s(this.host);if(this.panel){this.addedTransEnd=true;this.panel.addEventListener("transitionend",this.handleTransitionEnd)}}componentWillLoad(){this.handleSlotChange();if(this.open)this.show();if(this.storeId)d.init(this,["open"],this.storeMethod,this.storeId)}componentDidLoad(){if(!this.addedTransEnd){this.panel.addEventListener("transitionend",this.handleTransitionEnd)}}disconnectedCallback(){if(!this.panel)return;r(this.host);this.addedTransEnd=false;this.panel.removeEventListener("transitionend",this.handleTransitionEnd)}render(){return o(t,{showing:this.isVisible?true:undefined},o("div",{part:"base",class:{dialog:true,"dialog--open":this.open,"dialog--visible":this.isVisible,"dialog--has-footer":!this.noFooter,"dialog--has-header":!this.noHeader,"dialog--nodismiss":this.noDismiss,"dialog--with-ribbon":this.showRibbon},onKeyDown:this.handleKeyDown},o("div",{part:"overlay",class:"dialog__overlay",ref:i=>this.overlay=i,onClick:this.requestClose}),o("div",{ref:i=>this.panel=i,part:"panel",class:"dialog__panel",role:"dialog","aria-modal":"true","aria-hidden":this.open?"false":"true","aria-label":this.noHeader?this.label:null,"aria-labelledby":!this.noHeader?`${this.componentId}-title`:null,tabIndex:0},o("div",{class:"dialog__body-wrap"},!this.noHeader&&o("nano-sticker",null,o("header",{part:"header",class:"dialog__header"},o("span",{part:"title",class:"dialog__title",id:`${this.componentId}-title`},o("slot",{name:"label"},this.label||String.fromCharCode(65279))),!this.noUserDismiss&&o("nano-icon-button",{exportparts:"base:close-button",class:"dialog__close-icon",label:"close dialog",onClick:this.requestClose,iconName:"light/times"}))),o("div",{part:"body",class:"dialog__body"},o("slot",null)),!this.noFooter&&(this.hasFooter||!this.noUserDismiss)&&o("nano-sticker",{position:"bottom"},o("footer",{part:"footer",class:"dialog__footer"},o("slot",{name:"footer",onSlotchange:this.handleSlotChange}),!this.noUserDismiss&&o("button",{class:"dialog__close-txt",onClick:this.requestClose},"Close")))))))}get host(){return e(this)}static get watchers(){return{open:["handleOpenChange"],hoist:["handleHoistChange"]}}};p.style=h;export{p as nano_dialog};
5
- //# sourceMappingURL=p-28874fdc.entry.js.map
4
+ import{r as i,c as a,h as o,a as t,g as e}from"./p-bf91c50e.js";import{M as s}from"./p-e04f2333.js";import{l as n,u as r}from"./p-45b7682a.js";import{h as l}from"./p-b933f3c8.js";import{C as d}from"./p-909a424c.js";import"./p-45abbbdd.js";import"./p-257432ff.js";import"./p-9746b0a5.js";import"./p-69a3e911.js";const h=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--border-radius:var(--nano-layer-border-radius, var(--nano-border-radius-medium, 4px));--content-background:#fafafa;--footer-content:#e4e6e8;--scrim-color:var(--nano-layer-overlay-dark, rgb(74 74 74 / 50%));--box-shadow:var(--nano-layer-shadow-large, 0 2px 8px rgba(0, 0, 0, 0.2));--close-button-color:#b5aea7;--width:60rem;--tint-color:#00607b;--body-padding-v:var(--nano-spacing-large, 20px);--body-padding-h:var(--nano-spacing-large, 20px);--header-padding-v:var(--nano-spacing-medium, 16px);--header-padding-h:var(--nano-spacing-large, 20px);--footer-padding-v:var(--nano-spacing-medium, 16px);--footer-padding-h:var(--nano-spacing-large, 20px)}.dialog{display:flex;align-items:center;justify-content:center;position:fixed;inset:0;z-index:var(--nano-layer-index-modal, 700)}.dialog:not(.dialog--visible){position:absolute;inline-size:1px;block-size:1px;clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%);overflow:hidden;pointer-events:none;visibility:hidden}.dialog__panel{display:flex;flex-direction:column;z-index:2;inline-size:var(--width);max-inline-size:calc(100% - var(--nano-spacing-xlarge, 24px));max-block-size:calc(92% - var(--nano-spacing-xlarge, 24px));background-color:var(--content-background);border-radius:var(--border-radius);box-shadow:var(--box-shadow);opacity:0;transform:scale(0.8);transition:var(--nano-transition-fast, 0.3s) opacity, var(--nano-transition-fast, 0.3s) transform}.dialog__panel:focus{outline:none}.dialog--with-ribbon .dialog__panel{-webkit-border-before:5px solid var(--tint-color);border-block-start:5px solid var(--tint-color)}.dialog--open .dialog__panel{display:flex;opacity:1;transform:none}.dialog--nodismiss .dialog__panel{animation:cannotClose 0.25s ease-in-out 1}@keyframes cannotClose{0%{transform:scale(1)}50%{transform:scale(1.08)}100%{transform:scale(1)}}.dialog__header{flex:0 0 auto;display:flex;min-inline-size:var(--width);inline-size:100%;background-color:var(--content-background);border-radius:var(--border-radius) var(--border-radius) 0 0;transition:var(--nano-transition-fast, 0.1s) box-shadow}.dialog--visible .dialog__header{min-inline-size:auto}[stuck] .dialog__header{box-shadow:var(--nano-layer-shadow-medium, 0 2px 4px rgba(0, 0, 0, 0.2))}.dialog__title{flex:1 1 auto;font-size:var(--nano-fontsize-large, 1.25rem);line-height:1.6;padding-block:var(--header-padding-v);padding-inline:var(--header-padding-h)}.dialog .dialog__close-icon{flex:0 0 auto;display:flex;align-items:center;font-size:var(--nano-fontsize-xlarge, 1.5rem);padding-block:0;padding-inline:var(--header-padding-h);--color:var(--close-button-color)}.dialog__body{padding-block:0 var(--body-padding-v);padding-inline:var(--body-padding-h)}.dialog:not(.dialog--has-header) .dialog__body{-webkit-padding-before:var(--body-padding-v);padding-block-start:var(--body-padding-v)}.dialog__body ::slotted(*){max-inline-size:100%}.dialog__body-wrap{flex:1 1 auto;overflow:auto;-webkit-overflow-scrolling:touch;border-radius:var(--border-radius)}.dialog:not(.dialog--has-header) .dialog__body-wrap{border-radius:0 0 inherit inherit}.dialog:not(.dialog--has-footer) .dialog__body-wrap{border-radius:inherit inherit 0 0}.dialog__footer{inline-size:100%;padding-block:var(--footer-padding-v);padding-inline:var(--footer-padding-h);background:var(--footer-content);border-radius:0 0 var(--border-radius) var(--border-radius);position:relative;inset-block-start:1px}.dialog--visible .dialog__footer{min-inline-size:auto}.dialog__footer ::slotted(button){-webkit-margin-end:var(--nano-spacing-small, 8px) !important;margin-inline-end:var(--nano-spacing-small, 8px) !important}.dialog:not(.dialog--has-footer) .dialog__footer{display:none}.dialog__close-txt{color:var(--tint-color);border:none;text-decoration:underline;margin:0;text-underline-offset:4px;background-color:transparent;font:inherit;-webkit-box-align:center;cursor:pointer;font-size:var(--nano-fontsize-small, 0.875rem);padding:0.5rem;border-radius:var(--nano-border-radius-small, 2px);transition:box-shadow 100ms ease-in-out}.dialog__close-txt:focus{outline:none;box-shadow:var(--nano-control-focus-shadow, 0 0 0 0.1875rem var(--nano-control-focus-color, rgba(144, 198, 231, 0.8)))}.dialog__overlay{position:fixed;inset:0;background-color:var(--scrim-color);opacity:0;transition:var(--nano-transition-fast, 0.3s) opacity;-webkit-backdrop-filter:blur(var(--nano-layer-overlay-blur, 3px));backdrop-filter:blur(var(--nano-layer-overlay-blur, 3px))}.dialog--open .dialog__overlay{opacity:1}";let c=0;const p=class{constructor(o){i(this,o);this.nanoShow=a(this,"nanoShow",7);this.nanoAfterShow=a(this,"nanoAfterShow",7);this.nanoHide=a(this,"nanoHide",7);this.nanoAfterHide=a(this,"nanoAfterHide",7);this.nanoInitialFocus=a(this,"nanoInitialFocus",7);this.nanoRequestClose=a(this,"nanoRequestClose",7);this.componentId=`dialog-${++c}`;this.willShow=false;this.willHide=false;this.addedTransEnd=false;this.handleKeyDown=i=>{if(i.key==="Escape"){this.requestClose()}};this.requestClose=()=>{const i=this.nanoRequestClose.emit();if(!i.defaultPrevented&&!this.noUserDismiss){this.hide()}else{this.noDismiss=true;setTimeout((i=>this.noDismiss=false),250)}};this.handleTransitionEnd=i=>{if(i.propertyName==="opacity"&&i.composedPath().find((i=>i===this.panel||i===this.overlay))){this.isVisible=this.open;this.willShow=false;this.willHide=false;this.open?this.nanoAfterShow.emit():this.nanoAfterHide.emit()}};this.handleSlotChange=()=>{this.hasFooter=l(this.host,"footer")};this.isVisible=false;this.noDismiss=false;this.hasFooter=false;this.showRibbon=true;this.open=false;this.label=undefined;this.noHeader=false;this.noFooter=false;this.noUserDismiss=false;this.storeId=undefined;this.storeMethod="url-hash";this.hoist=false}handleOpenChange(){this.open?this.show():this.hide()}handleHoistChange(){if(!this.hoist||document.body.children[0]===this.host)return;document.body.prepend(this.host)}async show(){if(this.willShow){return}const i=this.nanoShow.emit();if(i.defaultPrevented){this.open=false;return}this.originalTrigger=document.activeElement;this.willShow=true;this.isVisible=true;this.open=true;this.modal.activate();n(this.host);if(this.open){this.host.addEventListener("nanoAfterShow",(()=>{const i=this.nanoInitialFocus.emit();if(!i.defaultPrevented){this.panel.focus({preventScroll:true})}}),{once:true})}}async hide(){if(this.willHide){return}const i=this.nanoHide.emit();if(i.defaultPrevented){this.open=true;return}this.willHide=true;this.open=false;this.modal.deactivate();r(this.host);this.stopVideos();const a=this.originalTrigger;if(a&&typeof a.focus==="function"){setTimeout((()=>a.focus()))}}stopVideos(){const i=Array.from(this.host.querySelectorAll("iframe,video"));i.forEach((i=>{if(i.tagName.toLowerCase()==="video")i.pause();else{const a=i.src;i.src=a}}))}connectedCallback(){this.handleHoistChange();this.modal=new s(this.host);if(this.panel){this.addedTransEnd=true;this.panel.addEventListener("transitionend",this.handleTransitionEnd)}}componentWillLoad(){this.handleSlotChange();if(this.open)this.show();if(this.storeId)d.init(this,["open"],this.storeMethod,this.storeId)}componentDidLoad(){if(!this.addedTransEnd){this.panel.addEventListener("transitionend",this.handleTransitionEnd)}}disconnectedCallback(){if(!this.panel)return;r(this.host);this.addedTransEnd=false;this.panel.removeEventListener("transitionend",this.handleTransitionEnd)}render(){return o(t,{showing:this.isVisible?true:undefined},o("div",{part:"base",class:{dialog:true,"dialog--open":this.open,"dialog--visible":this.isVisible,"dialog--has-footer":!this.noFooter,"dialog--has-header":!this.noHeader,"dialog--nodismiss":this.noDismiss,"dialog--with-ribbon":this.showRibbon},onKeyDown:this.handleKeyDown},o("div",{part:"overlay",class:"dialog__overlay",ref:i=>this.overlay=i,onClick:this.requestClose}),o("div",{ref:i=>this.panel=i,part:"panel",class:"dialog__panel",role:"dialog","aria-modal":"true","aria-hidden":this.open?"false":"true","aria-label":this.noHeader?this.label:null,"aria-labelledby":!this.noHeader?`${this.componentId}-title`:null,tabIndex:0},o("div",{class:"dialog__body-wrap"},!this.noHeader&&o("nano-sticker",null,o("header",{part:"header",class:"dialog__header"},o("span",{part:"title",class:"dialog__title",id:`${this.componentId}-title`},o("slot",{name:"label"},this.label||String.fromCharCode(65279))),!this.noUserDismiss&&o("nano-icon-button",{exportparts:"base:close-button",class:"dialog__close-icon",label:"close dialog",onClick:this.requestClose,iconName:"light/times"}))),o("div",{part:"body",class:"dialog__body"},o("slot",null)),!this.noFooter&&(this.hasFooter||!this.noUserDismiss)&&o("nano-sticker",{position:"bottom"},o("footer",{part:"footer",class:"dialog__footer"},o("slot",{name:"footer",onSlotchange:this.handleSlotChange}),!this.noUserDismiss&&o("button",{class:"dialog__close-txt",onClick:this.requestClose},"Close")))))))}get host(){return e(this)}static get watchers(){return{open:["handleOpenChange"],hoist:["handleHoistChange"]}}};p.style=h;export{p as nano_dialog};
5
+ //# sourceMappingURL=p-fccd59e4.entry.js.map