@xwiki/cristal-electron-renderer 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/chunk.2FB5TK5H-DmNP_ew6.js +2 -0
  3. package/dist/chunk.2FB5TK5H-DmNP_ew6.js.map +1 -0
  4. package/dist/{chunk.2Y62WHSU-C8i5cHiy.js → chunk.2Y62WHSU-CtjxXyaN.js} +2 -2
  5. package/dist/chunk.2Y62WHSU-CtjxXyaN.js.map +1 -0
  6. package/dist/{chunk.6DH62NIS-CVBVc-bX.js → chunk.6DH62NIS-Dm8zuX7H.js} +2 -2
  7. package/dist/chunk.6DH62NIS-Dm8zuX7H.js.map +1 -0
  8. package/dist/chunk.CFNN54QE-CwH9z8le.js +22 -0
  9. package/dist/chunk.CFNN54QE-CwH9z8le.js.map +1 -0
  10. package/dist/chunk.DBG7W4GS-C1gixj8b.js +75 -0
  11. package/dist/chunk.DBG7W4GS-C1gixj8b.js.map +1 -0
  12. package/dist/chunk.F5JVBNK3-BFrgaGDl.js +2 -0
  13. package/dist/chunk.F5JVBNK3-BFrgaGDl.js.map +1 -0
  14. package/dist/{chunk.XX4STEEY-COEpspdZ.js → chunk.FX2KPKHF-DRH3dcmv.js} +9 -9
  15. package/dist/chunk.FX2KPKHF-DRH3dcmv.js.map +1 -0
  16. package/dist/{chunk.GAND2OKP-lICOl7JF.js → chunk.GAND2OKP-ByJceoyz.js} +3 -3
  17. package/dist/chunk.GAND2OKP-ByJceoyz.js.map +1 -0
  18. package/dist/chunk.GQSSKPMO-XeEX4TdL.js +273 -0
  19. package/dist/chunk.GQSSKPMO-XeEX4TdL.js.map +1 -0
  20. package/dist/{chunk.I6OQK3N3-BBclK2fM.js → chunk.I6OQK3N3-XuvDDN4C.js} +7 -7
  21. package/dist/chunk.I6OQK3N3-XuvDDN4C.js.map +1 -0
  22. package/dist/chunk.KWPBDQ6I-Bf3dc1GJ.js.map +1 -1
  23. package/dist/chunk.LHI6QEL2-DjjW-g1e.js +2 -0
  24. package/dist/chunk.LHI6QEL2-DjjW-g1e.js.map +1 -0
  25. package/dist/chunk.MGEAXYVX-o-WC3ZVc.js.map +1 -1
  26. package/dist/chunk.NYIIDP5N-AHr3eTN0.js.map +1 -1
  27. package/dist/chunk.TUZSOS6C-DxyWSdpL.js.map +1 -1
  28. package/dist/chunk.WJBFYL4X-Cbeo_gEa.js.map +1 -1
  29. package/dist/chunk.WYDJ5QAQ-BaRtgVmq.js +163 -0
  30. package/dist/chunk.WYDJ5QAQ-BaRtgVmq.js.map +1 -0
  31. package/dist/chunk.XX4STEEY-CnZz31HY.js +2 -0
  32. package/dist/chunk.XX4STEEY-CnZz31HY.js.map +1 -0
  33. package/dist/chunk.Z2C7OFLH-DXpTuERC.js +90 -0
  34. package/dist/chunk.Z2C7OFLH-DXpTuERC.js.map +1 -0
  35. package/dist/{chunk.Z6CYCANS-DF0ctyRp.js → chunk.Z6CYCANS-3ZX6gaKw.js} +2 -2
  36. package/dist/chunk.Z6CYCANS-3ZX6gaKw.js.map +1 -0
  37. package/dist/class-map-C3Xk0adH.js.map +1 -1
  38. package/dist/if-defined-DAvNwoU5.js.map +1 -1
  39. package/dist/index-BwWdPCLg.js +109 -0
  40. package/dist/index-BwWdPCLg.js.map +1 -0
  41. package/dist/{index-ScDkqPqn.css → index-Cqiv3gUG.css} +2 -25
  42. package/dist/index.html +2 -2
  43. package/dist/query-D1pSaKds.js.map +1 -1
  44. package/dist/static-CdL8EPVS.js.map +1 -1
  45. package/dist/staticBuild-DaVk8OhA.js +443 -0
  46. package/dist/staticBuild-DaVk8OhA.js.map +1 -0
  47. package/dist/staticBuild-ttxynnc3.css +1 -0
  48. package/dist/translations-LzwkxwEW.js +2 -0
  49. package/dist/translations-LzwkxwEW.js.map +1 -0
  50. package/dist/worker-CeXgpy1V.js +27 -0
  51. package/dist/worker-CeXgpy1V.js.map +1 -0
  52. package/dist/x-alert-BXrMLl_z.js +2 -0
  53. package/dist/x-alert-BXrMLl_z.js.map +1 -0
  54. package/dist/x-alert-BoZBHJTw.js +2 -0
  55. package/dist/x-alert-BoZBHJTw.js.map +1 -0
  56. package/dist/x-alert-DMLsu2fN.js +2 -0
  57. package/dist/x-alert-DMLsu2fN.js.map +1 -0
  58. package/dist/x-avatar-5PJmmbmb.js +2 -0
  59. package/dist/x-avatar-5PJmmbmb.js.map +1 -0
  60. package/dist/x-avatar-DMZRLeU4.css +1 -0
  61. package/dist/x-avatar-DXrOfuv4.js +2 -0
  62. package/dist/x-avatar-DXrOfuv4.js.map +1 -0
  63. package/dist/{x-avatar-rzw6K8Wc.js → x-avatar-bHnylPsU.js} +2 -2
  64. package/dist/x-avatar-bHnylPsU.js.map +1 -0
  65. package/dist/x-breadcrumb-ByeHAMZ3.js +2 -0
  66. package/dist/x-breadcrumb-ByeHAMZ3.js.map +1 -0
  67. package/dist/x-breadcrumb-UzKzkWEm.js +2 -0
  68. package/dist/x-breadcrumb-UzKzkWEm.js.map +1 -0
  69. package/dist/x-btn-BIQ8eFJy.js +2 -0
  70. package/dist/x-btn-BIQ8eFJy.js.map +1 -0
  71. package/dist/x-btn-Ek7j5MQJ.js +2 -0
  72. package/dist/x-btn-Ek7j5MQJ.js.map +1 -0
  73. package/dist/x-btn-Jy05lUMC.css +1 -0
  74. package/dist/x-btn-XPAPreXz.js +2 -0
  75. package/dist/x-btn-XPAPreXz.js.map +1 -0
  76. package/dist/x-card-CqrrEOda.js +2 -0
  77. package/dist/x-card-CqrrEOda.js.map +1 -0
  78. package/dist/x-card-DkMCK51C.js +2 -0
  79. package/dist/x-card-DkMCK51C.js.map +1 -0
  80. package/dist/x-card-mVVPCuVs.js +2 -0
  81. package/dist/x-card-mVVPCuVs.js.map +1 -0
  82. package/dist/x-col-BKCtabUF.js +2 -0
  83. package/dist/x-col-BKCtabUF.js.map +1 -0
  84. package/dist/x-col-CPix5n9C.js +2 -0
  85. package/dist/x-col-CPix5n9C.js.map +1 -0
  86. package/dist/x-container-B8usqdAt.js +2 -0
  87. package/dist/x-container-B8usqdAt.js.map +1 -0
  88. package/dist/x-container-C3VJF8Cs.js +2 -0
  89. package/dist/x-container-C3VJF8Cs.js.map +1 -0
  90. package/dist/x-dialog-DTbBEomU.js +2 -0
  91. package/dist/x-dialog-DTbBEomU.js.map +1 -0
  92. package/dist/x-dialog-Dmk1mNNm.js +2 -0
  93. package/dist/x-dialog-Dmk1mNNm.js.map +1 -0
  94. package/dist/x-dialog-Y6y28F7b.js +2 -0
  95. package/dist/x-dialog-Y6y28F7b.js.map +1 -0
  96. package/dist/x-divider-1De0d0_h.js +2 -0
  97. package/dist/x-divider-1De0d0_h.js.map +1 -0
  98. package/dist/x-divider-BOo7N7TG.js +2 -0
  99. package/dist/x-divider-BOo7N7TG.js.map +1 -0
  100. package/dist/{x-divider-BCwuNKpo.js → x-divider-DAdnWMFB.js} +2 -2
  101. package/dist/x-divider-DAdnWMFB.js.map +1 -0
  102. package/dist/x-file-input-CQcXcoHB.css +1 -0
  103. package/dist/x-file-input-D5fZFrts.js +2 -0
  104. package/dist/x-file-input-D5fZFrts.js.map +1 -0
  105. package/dist/x-file-input-Vq6SbhIt.js +2 -0
  106. package/dist/x-file-input-Vq6SbhIt.js.map +1 -0
  107. package/dist/x-form-2etnPUmf.js +2 -0
  108. package/dist/x-form-2etnPUmf.js.map +1 -0
  109. package/dist/x-form-6WjFitVZ.js +2 -0
  110. package/dist/x-form-6WjFitVZ.js.map +1 -0
  111. package/dist/x-img-C0VJnfz2.js +2 -0
  112. package/dist/x-img-C0VJnfz2.js.map +1 -0
  113. package/dist/x-img-CI94figY.js +2 -0
  114. package/dist/x-img-CI94figY.js.map +1 -0
  115. package/dist/x-img-ep-9amoQ.js +2 -0
  116. package/dist/x-img-ep-9amoQ.js.map +1 -0
  117. package/dist/x-load-5_-B9I0p.js +2 -0
  118. package/dist/x-load-5_-B9I0p.js.map +1 -0
  119. package/dist/x-load-BRJNFFsQ.js +2 -0
  120. package/dist/x-load-BRJNFFsQ.js.map +1 -0
  121. package/dist/x-load-CXyz5AZH.js +2 -0
  122. package/dist/x-load-CXyz5AZH.js.map +1 -0
  123. package/dist/x-load-CwU5Pjl2.css +5 -0
  124. package/dist/{x-load-DYuGRQQC.css → x-load-DLCnwiCB.css} +1 -1
  125. package/dist/{x-menu-BKquCdsX.js → x-menu-BPTY2_Pm.js} +164 -543
  126. package/dist/x-menu-BPTY2_Pm.js.map +1 -0
  127. package/dist/x-menu-CinyzodZ.js +2 -0
  128. package/dist/x-menu-CinyzodZ.js.map +1 -0
  129. package/dist/x-menu-MDCUArVg.js +2 -0
  130. package/dist/x-menu-MDCUArVg.js.map +1 -0
  131. package/dist/x-menu-item-DlEPAuVr.js +2 -0
  132. package/dist/x-menu-item-DlEPAuVr.js.map +1 -0
  133. package/dist/{x-menuitem-CVO0asxe.js → x-menuitem-C7L7TT_M.js} +2 -2
  134. package/dist/x-menuitem-C7L7TT_M.js.map +1 -0
  135. package/dist/x-menuitem-ChQ-MEzP.js +2 -0
  136. package/dist/x-menuitem-ChQ-MEzP.js.map +1 -0
  137. package/dist/x-row-BKCtabUF.js +2 -0
  138. package/dist/x-row-BKCtabUF.js.map +1 -0
  139. package/dist/x-row-CPix5n9C.js +2 -0
  140. package/dist/x-row-CPix5n9C.js.map +1 -0
  141. package/dist/x-search-BwzR-lic.js +2 -0
  142. package/dist/x-search-BwzR-lic.js.map +1 -0
  143. package/dist/{x-search-D_rjUBBL.js → x-search-DgB3g9qY.js} +2 -2
  144. package/dist/x-search-DgB3g9qY.js.map +1 -0
  145. package/dist/x-tab-D0Vw_ond.js +2 -0
  146. package/dist/x-tab-D0Vw_ond.js.map +1 -0
  147. package/dist/x-tab-DbIZPX0N.js +2 -0
  148. package/dist/x-tab-DbIZPX0N.js.map +1 -0
  149. package/dist/x-tab-group-C9tgQAMN.js +2 -0
  150. package/dist/x-tab-group-C9tgQAMN.js.map +1 -0
  151. package/dist/x-tab-group-D1vbKY6D.js +2 -0
  152. package/dist/x-tab-group-D1vbKY6D.js.map +1 -0
  153. package/dist/x-tab-panel--v10F4gh.js +2 -0
  154. package/dist/x-tab-panel--v10F4gh.js.map +1 -0
  155. package/dist/x-tab-panel-CbJsU5r0.js +2 -0
  156. package/dist/x-tab-panel-CbJsU5r0.js.map +1 -0
  157. package/dist/x-text-field-DcPqej4l.js +2 -0
  158. package/dist/x-text-field-DcPqej4l.js.map +1 -0
  159. package/dist/x-text-field-DpPHmzsd.js +2 -0
  160. package/dist/x-text-field-DpPHmzsd.js.map +1 -0
  161. package/dist/x-textfield-DM2JTrO7.js +2 -0
  162. package/dist/x-textfield-DM2JTrO7.js.map +1 -0
  163. package/dist/x-textfield-lI6PveRP.js +2 -0
  164. package/dist/x-textfield-lI6PveRP.js.map +1 -0
  165. package/package.json +13 -10
  166. package/src/index.ts +12 -9
  167. package/src/vite-env.d.ts +5 -10
  168. package/src/vue.d.ts +4 -9
  169. package/vite.config.js +4 -9
  170. package/dist/chunk.2Y62WHSU-C8i5cHiy.js.map +0 -1
  171. package/dist/chunk.6DH62NIS-CVBVc-bX.js.map +0 -1
  172. package/dist/chunk.GAND2OKP-lICOl7JF.js.map +0 -1
  173. package/dist/chunk.I6OQK3N3-BBclK2fM.js.map +0 -1
  174. package/dist/chunk.LHI6QEL2-DbpPiPxS.js +0 -75
  175. package/dist/chunk.LHI6QEL2-DbpPiPxS.js.map +0 -1
  176. package/dist/chunk.WYDJ5QAQ-C81Elw3D.js +0 -163
  177. package/dist/chunk.WYDJ5QAQ-C81Elw3D.js.map +0 -1
  178. package/dist/chunk.XX4STEEY-COEpspdZ.js.map +0 -1
  179. package/dist/chunk.Z6CYCANS-DF0ctyRp.js.map +0 -1
  180. package/dist/index-DK0YwuAW.js +0 -411
  181. package/dist/index-DK0YwuAW.js.map +0 -1
  182. package/dist/staticBuild-BlyaXHUF.css +0 -1
  183. package/dist/staticBuild-BoKVadnu.js +0 -1063
  184. package/dist/staticBuild-BoKVadnu.js.map +0 -1
  185. package/dist/worker-CybHddrE.js +0 -211
  186. package/dist/worker-CybHddrE.js.map +0 -1
  187. package/dist/x-alert-7r5rx0d7.js +0 -2
  188. package/dist/x-alert-7r5rx0d7.js.map +0 -1
  189. package/dist/x-alert-l0oP9PUN.js +0 -2
  190. package/dist/x-alert-l0oP9PUN.js.map +0 -1
  191. package/dist/x-alert-uqeGd1IW.js +0 -2
  192. package/dist/x-alert-uqeGd1IW.js.map +0 -1
  193. package/dist/x-avatar-BARZZcgr.js +0 -2
  194. package/dist/x-avatar-BARZZcgr.js.map +0 -1
  195. package/dist/x-avatar-CfnVd4CE.css +0 -1
  196. package/dist/x-avatar-DnbaVGNC.js +0 -2
  197. package/dist/x-avatar-DnbaVGNC.js.map +0 -1
  198. package/dist/x-avatar-rzw6K8Wc.js.map +0 -1
  199. package/dist/x-breadcrumb-CzKs24Jh.js +0 -2
  200. package/dist/x-breadcrumb-CzKs24Jh.js.map +0 -1
  201. package/dist/x-breadcrumb-VokcqVrB.js +0 -2
  202. package/dist/x-breadcrumb-VokcqVrB.js.map +0 -1
  203. package/dist/x-btn-BNO2Vh9q.js +0 -2
  204. package/dist/x-btn-BNO2Vh9q.js.map +0 -1
  205. package/dist/x-btn-BeE4ChBm.js +0 -2
  206. package/dist/x-btn-BeE4ChBm.js.map +0 -1
  207. package/dist/x-btn-D2HJcK1C.css +0 -1
  208. package/dist/x-btn-DOkDF37q.js +0 -2
  209. package/dist/x-btn-DOkDF37q.js.map +0 -1
  210. package/dist/x-card-BzquGj3n.js +0 -2
  211. package/dist/x-card-BzquGj3n.js.map +0 -1
  212. package/dist/x-card-D6loY5Bx.js +0 -2
  213. package/dist/x-card-D6loY5Bx.js.map +0 -1
  214. package/dist/x-card-D_W5kTzv.js +0 -2
  215. package/dist/x-card-D_W5kTzv.js.map +0 -1
  216. package/dist/x-col-B5OPXPr8.js +0 -2
  217. package/dist/x-col-B5OPXPr8.js.map +0 -1
  218. package/dist/x-col-KJDQojCc.js +0 -2
  219. package/dist/x-col-KJDQojCc.js.map +0 -1
  220. package/dist/x-container-e-eRQnv6.js +0 -2
  221. package/dist/x-container-e-eRQnv6.js.map +0 -1
  222. package/dist/x-container-e4wjA5VY.js +0 -2
  223. package/dist/x-container-e4wjA5VY.js.map +0 -1
  224. package/dist/x-dialog-D6r8mi6-.js +0 -2
  225. package/dist/x-dialog-D6r8mi6-.js.map +0 -1
  226. package/dist/x-dialog-DYWxApRD.js +0 -2
  227. package/dist/x-dialog-DYWxApRD.js.map +0 -1
  228. package/dist/x-dialog-oAn88o9T.js +0 -2
  229. package/dist/x-dialog-oAn88o9T.js.map +0 -1
  230. package/dist/x-divider-BCwuNKpo.js.map +0 -1
  231. package/dist/x-divider-BnEfygqi.js +0 -2
  232. package/dist/x-divider-BnEfygqi.js.map +0 -1
  233. package/dist/x-divider-rvXgbWfE.js +0 -2
  234. package/dist/x-divider-rvXgbWfE.js.map +0 -1
  235. package/dist/x-img-B2B5glWY.js +0 -2
  236. package/dist/x-img-B2B5glWY.js.map +0 -1
  237. package/dist/x-img-Bj_1ZxwL.js +0 -2
  238. package/dist/x-img-Bj_1ZxwL.js.map +0 -1
  239. package/dist/x-img-iz7nX54V.js +0 -2
  240. package/dist/x-img-iz7nX54V.js.map +0 -1
  241. package/dist/x-load-B-IMf3jW.js +0 -2
  242. package/dist/x-load-B-IMf3jW.js.map +0 -1
  243. package/dist/x-load-DKS8UJZy.js +0 -2
  244. package/dist/x-load-DKS8UJZy.js.map +0 -1
  245. package/dist/x-load-Diex9fJK.js +0 -2
  246. package/dist/x-load-Diex9fJK.js.map +0 -1
  247. package/dist/x-load-DyIF2nXd.css +0 -5
  248. package/dist/x-menu-BBb2QzOu.js +0 -2
  249. package/dist/x-menu-BBb2QzOu.js.map +0 -1
  250. package/dist/x-menu-BKquCdsX.js.map +0 -1
  251. package/dist/x-menu-Ce37WOnf.js +0 -2
  252. package/dist/x-menu-Ce37WOnf.js.map +0 -1
  253. package/dist/x-menu-item-JuTN7QVh.js +0 -2
  254. package/dist/x-menu-item-JuTN7QVh.js.map +0 -1
  255. package/dist/x-menuitem-CNKTVGiE.js +0 -2
  256. package/dist/x-menuitem-CNKTVGiE.js.map +0 -1
  257. package/dist/x-menuitem-CVO0asxe.js.map +0 -1
  258. package/dist/x-row-B5OPXPr8.js +0 -2
  259. package/dist/x-row-B5OPXPr8.js.map +0 -1
  260. package/dist/x-row-KJDQojCc.js +0 -2
  261. package/dist/x-row-KJDQojCc.js.map +0 -1
  262. package/dist/x-search-B0oJfSre.js +0 -2
  263. package/dist/x-search-B0oJfSre.js.map +0 -1
  264. package/dist/x-search-D_rjUBBL.js.map +0 -1
  265. package/dist/x-textfield-CRySrmrj.js +0 -2
  266. package/dist/x-textfield-CRySrmrj.js.map +0 -1
  267. package/dist/x-textfield-GtnNDOX1.js +0 -2
  268. package/dist/x-textfield-GtnNDOX1.js.map +0 -1
@@ -0,0 +1,27 @@
1
+ (function(){"use strict";/**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */const _i=Symbol("Comlink.proxy"),Wo=Symbol("Comlink.endpoint"),Uo=Symbol("Comlink.releaseProxy"),vr=Symbol("Comlink.finalizer"),pn=Symbol("Comlink.thrown"),Ai=n=>typeof n=="object"&&n!==null||typeof n=="function",qo={canHandle:n=>Ai(n)&&n[_i],serialize(n){const{port1:e,port2:r}=new MessageChannel;return mr(n,e),[r,[r]]},deserialize(n){return n.start(),zo(n)}},$o={canHandle:n=>Ai(n)&&pn in n,serialize({value:n}){let e;return n instanceof Error?e={isError:!0,value:{message:n.message,name:n.name,stack:n.stack}}:e={isError:!1,value:n},[e,[]]},deserialize(n){throw n.isError?Object.assign(new Error(n.value.message),n.value):n.value}},Ci=new Map([["proxy",qo],["throw",$o]]);function Vo(n,e){for(const r of n)if(e===r||r==="*"||r instanceof RegExp&&r.test(e))return!0;return!1}function mr(n,e=globalThis,r=["*"]){e.addEventListener("message",function a(s){if(!s||!s.data)return;if(!Vo(r,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}const{id:c,type:d,path:O}=Object.assign({path:[]},s.data),M=(s.data.argumentList||[]).map(gt);let y;try{const j=O.slice(0,-1).reduce((Y,pe)=>Y[pe],n),$=O.reduce((Y,pe)=>Y[pe],n);switch(d){case"GET":y=$;break;case"SET":j[O.slice(-1)[0]]=gt(s.data.value),y=!0;break;case"APPLY":y=$.apply(j,M);break;case"CONSTRUCT":{const Y=new $(...M);y=Jo(Y)}break;case"ENDPOINT":{const{port1:Y,port2:pe}=new MessageChannel;mr(n,pe),y=Xo(Y,[Y])}break;case"RELEASE":y=void 0;break;default:return}}catch(j){y={value:j,[pn]:0}}Promise.resolve(y).catch(j=>({value:j,[pn]:0})).then(j=>{const[$,Y]=mn(j);e.postMessage(Object.assign(Object.assign({},$),{id:c}),Y),d==="RELEASE"&&(e.removeEventListener("message",a),Si(e),vr in n&&typeof n[vr]=="function"&&n[vr]())}).catch(j=>{const[$,Y]=mn({value:new TypeError("Unserializable return value"),[pn]:0});e.postMessage(Object.assign(Object.assign({},$),{id:c}),Y)})}),e.start&&e.start()}function Go(n){return n.constructor.name==="MessagePort"}function Si(n){Go(n)&&n.close()}function zo(n,e){return br(n,[],e)}function gn(n){if(n)throw new Error("Proxy has been released and is not useable")}function xi(n){return kt(n,{type:"RELEASE"}).then(()=>{Si(n)})}const yn=new WeakMap,vn="FinalizationRegistry"in globalThis&&new FinalizationRegistry(n=>{const e=(yn.get(n)||0)-1;yn.set(n,e),e===0&&xi(n)});function Ho(n,e){const r=(yn.get(e)||0)+1;yn.set(e,r),vn&&vn.register(n,e,n)}function Yo(n){vn&&vn.unregister(n)}function br(n,e=[],r=function(){}){let a=!1;const s=new Proxy(r,{get(c,d){if(gn(a),d===Uo)return()=>{Yo(s),xi(n),a=!0};if(d==="then"){if(e.length===0)return{then:()=>s};const O=kt(n,{type:"GET",path:e.map(M=>M.toString())}).then(gt);return O.then.bind(O)}return br(n,[...e,d])},set(c,d,O){gn(a);const[M,y]=mn(O);return kt(n,{type:"SET",path:[...e,d].map(j=>j.toString()),value:M},y).then(gt)},apply(c,d,O){gn(a);const M=e[e.length-1];if(M===Wo)return kt(n,{type:"ENDPOINT"}).then(gt);if(M==="bind")return br(n,e.slice(0,-1));const[y,j]=Oi(O);return kt(n,{type:"APPLY",path:e.map($=>$.toString()),argumentList:y},j).then(gt)},construct(c,d){gn(a);const[O,M]=Oi(d);return kt(n,{type:"CONSTRUCT",path:e.map(y=>y.toString()),argumentList:O},M).then(gt)}});return Ho(s,n),s}function Qo(n){return Array.prototype.concat.apply([],n)}function Oi(n){const e=n.map(mn);return[e.map(r=>r[0]),Qo(e.map(r=>r[1]))]}const Pi=new WeakMap;function Xo(n,e){return Pi.set(n,e),n}function Jo(n){return Object.assign(n,{[_i]:!0})}function mn(n){for(const[e,r]of Ci)if(r.canHandle(n)){const[a,s]=r.serialize(n);return[{type:"HANDLER",name:e,value:a},s]}return[{type:"RAW",value:n},Pi.get(n)||[]]}function gt(n){switch(n.type){case"HANDLER":return Ci.get(n.name).deserialize(n.value);case"RAW":return n.value}}function kt(n,e,r){return new Promise(a=>{const s=Zo();n.addEventListener("message",function c(d){!d.data||!d.data.id||d.data.id!==s||(n.removeEventListener("message",c),a(d.data))}),n.start&&n.start(),n.postMessage(Object.assign({id:s},e),r)})}function Zo(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var Me="named",Ei="name",bn="unmanaged",Ti="optional",wn="inject",qt="multi_inject",ki="inversify:tagged",Ii="inversify:tagged_props",wr="inversify:paramtypes",ea="design:paramtypes",Di="post_construct",_r="pre_destroy";function ta(){return[wn,qt,Ei,bn,Me,Ti]}var Mi=ta(),ye={Request:"Request",Singleton:"Singleton",Transient:"Transient"},ce={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"},$t={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"},na=0;function Vt(){return na++}var ra=function(){function n(e,r){this.id=Vt(),this.activated=!1,this.serviceIdentifier=e,this.scope=r,this.type=ce.Invalid,this.constraint=function(a){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.onDeactivation=null,this.dynamicValue=null}return n.prototype.clone=function(){var e=new n(this.serviceIdentifier,this.scope);return e.activated=e.scope===ye.Singleton?this.activated:!1,e.implementationType=this.implementationType,e.dynamicValue=this.dynamicValue,e.scope=this.scope,e.type=this.type,e.factory=this.factory,e.provider=this.provider,e.constraint=this.constraint,e.onActivation=this.onActivation,e.onDeactivation=this.onDeactivation,e.cache=this.cache,e},n}(),ia="Cannot apply @injectable decorator multiple times.",Ri="Metadata key was used more than once in a parameter:",Gt="NULL argument",ji="Key Not Found",oa="Ambiguous match found for serviceIdentifier:",aa="Could not unbind serviceIdentifier:",sa="No matching bindings found for serviceIdentifier:",Ni="Missing required @injectable annotation in:",ua="Missing required @inject or @multiInject annotation in:",ca=function(n){return"@inject called with undefined this could mean that the class "+n+" has a circular dependency problem. You can use a LazyServiceIdentifier to overcome this limitation."},la="Circular dependency found:",fa="Invalid binding type:",ha="No snapshot available to restore.",da="Invalid return type in middleware. Middleware must return!",pa="Value provided to function binding must be a function!",ga=function(n){return"You are attempting to construct '"+n+`' in a synchronous way
6
+ but it has asynchronous dependencies.`},ya="The toSelf function can only be applied when a constructor is used as service identifier",Li="The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.",va=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return"The number of constructor arguments in the derived class "+(n[0]+" must be >= than the number of constructor arguments of its base class.")},ma="Invalid Container constructor argument. Container options must be an object.",ba='Invalid Container option. Default scope must be a string ("singleton" or "transient").',wa="Invalid Container option. Auto bind injectable must be a boolean",_a="Invalid Container option. Skip base check must be a boolean",Aa="Attempting to unbind dependency with asynchronous destruction (@preDestroy or onDeactivation)",Ca=function(n,e){return"@postConstruct error in class "+n+": "+e},Sa=function(n,e){return"@preDestroy error in class "+n+": "+e},Ar=function(n,e){return"onDeactivation() error in class "+n+": "+e},xa=function(n,e){return"It looks like there is a circular dependency in one of the '"+n+"' bindings. Please investigate bindings with "+("service identifier '"+e+"'.")},Oa="Maximum call stack size exceeded",Pa=function(){function n(){}return n.prototype.getConstructorMetadata=function(e){var r=Reflect.getMetadata(wr,e),a=Reflect.getMetadata(ki,e);return{compilerGeneratedMetadata:r,userGeneratedMetadata:a||{}}},n.prototype.getPropertiesMetadata=function(e){var r=Reflect.getMetadata(Ii,e)||[];return r},n}(),_n={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function Bi(n){return n instanceof RangeError||n.message===Oa}var Ea=function(n,e){try{return n()}catch(r){throw Bi(r)&&(r=e()),r}};function zt(n){if(typeof n=="function"){var e=n;return e.name}else{if(typeof n=="symbol")return n.toString();var e=n;return e}}function Fi(n,e,r){var a="",s=r(n,e);return s.length!==0&&(a=`
7
+ Registered bindings:`,s.forEach(function(c){var d="Object";c.implementationType!==null&&(d=An(c.implementationType)),a=a+`
8
+ `+d,c.constraint.metaData&&(a=a+" - "+c.constraint.metaData)})),a}function Ki(n,e){return n.parentRequest===null?!1:n.parentRequest.serviceIdentifier===e?!0:Ki(n.parentRequest,e)}function Ta(n){function e(a,s){s===void 0&&(s=[]);var c=zt(a.serviceIdentifier);return s.push(c),a.parentRequest!==null?e(a.parentRequest,s):s}var r=e(n);return r.reverse().join(" --> ")}function Wi(n){n.childRequests.forEach(function(e){if(Ki(e,e.serviceIdentifier)){var r=Ta(e);throw new Error(la+" "+r)}else Wi(e)})}function ka(n,e){if(e.isTagged()||e.isNamed()){var r="",a=e.getNamedTag(),s=e.getCustomTags();return a!==null&&(r+=a.toString()+`
9
+ `),s!==null&&s.forEach(function(c){r+=c.toString()+`
10
+ `})," "+n+`
11
+ `+n+" - "+r}else return" "+n}function An(n){if(n.name)return n.name;var e=n.toString(),r=e.match(/^function\s*([^\s(]+)/);return r?r[1]:"Anonymous function: "+e}function Ia(n){return n.toString().slice(7,-1)}var Ui=function(){function n(e){this.id=Vt(),this.container=e}return n.prototype.addPlan=function(e){this.plan=e},n.prototype.setCurrentRequest=function(e){this.currentRequest=e},n}(),Qe=function(){function n(e,r){this.key=e,this.value=r}return n.prototype.toString=function(){return this.key===Me?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},n}(),Da=function(){function n(e,r){this.parentContext=e,this.rootRequest=r}return n}(),Ma=function(){function n(e){this._cb=e}return n.prototype.unwrap=function(){return this._cb()},n}(),Ra=function(){function n(e){this.str=e}return n.prototype.startsWith=function(e){return this.str.indexOf(e)===0},n.prototype.endsWith=function(e){var r="",a=e.split("").reverse().join("");return r=this.str.split("").reverse().join(""),this.startsWith.call({str:r},a)},n.prototype.contains=function(e){return this.str.indexOf(e)!==-1},n.prototype.equals=function(e){return this.str===e},n.prototype.value=function(){return this.str},n}(),Cn=function(){function n(e,r,a,s){this.id=Vt(),this.type=e,this.serviceIdentifier=a;var c=typeof r=="symbol"?Ia(r):r;this.name=new Ra(c||""),this.identifier=r,this.metadata=new Array;var d=null;typeof s=="string"?d=new Qe(Me,s):s instanceof Qe&&(d=s),d!==null&&this.metadata.push(d)}return n.prototype.hasTag=function(e){for(var r=0,a=this.metadata;r<a.length;r++){var s=a[r];if(s.key===e)return!0}return!1},n.prototype.isArray=function(){return this.hasTag(qt)},n.prototype.matchesArray=function(e){return this.matchesTag(qt)(e)},n.prototype.isNamed=function(){return this.hasTag(Me)},n.prototype.isTagged=function(){return this.metadata.some(function(e){return Mi.every(function(r){return e.key!==r})})},n.prototype.isOptional=function(){return this.matchesTag(Ti)(!0)},n.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter(function(e){return e.key===Me})[0]:null},n.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter(function(e){return Mi.every(function(r){return e.key!==r})}):null},n.prototype.matchesNamedTag=function(e){return this.matchesTag(Me)(e)},n.prototype.matchesTag=function(e){var r=this;return function(a){for(var s=0,c=r.metadata;s<c.length;s++){var d=c[s];if(d.key===e&&d.value===a)return!0}return!1}},n}(),Sn=function(n,e,r){if(r||arguments.length===2)for(var a=0,s=e.length,c;a<s;a++)(c||!(a in e))&&(c||(c=Array.prototype.slice.call(e,0,a)),c[a]=e[a]);return n.concat(c||Array.prototype.slice.call(e))};function ja(n,e){var r=An(e);return qi(n,r,e,!1)}function qi(n,e,r,a){var s=n.getConstructorMetadata(r),c=s.compilerGeneratedMetadata;if(c===void 0){var d=Ni+" "+e+".";throw new Error(d)}var O=s.userGeneratedMetadata,M=Object.keys(O),y=r.length===0&&M.length>0,j=M.length>r.length,$=y||j?M.length:r.length,Y=La(a,e,c,O,$),pe=$i(n,r,e),ve=Sn(Sn([],Y,!0),pe,!0);return ve}function Na(n,e,r,a,s){var c=s[n.toString()]||[],d=Gi(c),O=d.unmanaged!==!0,M=a[n],y=d.inject||d.multiInject;if(M=y||M,M instanceof Ma&&(M=M.unwrap()),O){var j=M===Object,$=M===Function,Y=M===void 0,pe=j||$||Y;if(!e&&pe){var ve=ua+" argument "+n+" in class "+r+".";throw new Error(ve)}var _e=new Cn($t.ConstructorArgument,d.targetName,M);return _e.metadata=c,_e}return null}function La(n,e,r,a,s){for(var c=[],d=0;d<s;d++){var O=d,M=Na(O,n,e,r,a);M!==null&&c.push(M)}return c}function Ba(n,e,r,a){var s=n||e;if(s===void 0){var c=Ni+" for property "+String(r)+" in class "+a+".";throw new Error(c)}return s}function $i(n,e,r){for(var a=n.getPropertiesMetadata(e),s=[],c=Object.getOwnPropertySymbols(a),d=Object.keys(a),O=d.concat(c),M=0,y=O;M<y.length;M++){var j=y[M],$=a[j],Y=Gi($),pe=Y.targetName||j,ve=Ba(Y.inject,Y.multiInject,j,r),_e=new Cn($t.ClassProperty,pe,ve);_e.metadata=$,s.push(_e)}var Ze=Object.getPrototypeOf(e.prototype).constructor;if(Ze!==Object){var Mt=$i(n,Ze,r);s=Sn(Sn([],s,!0),Mt,!0)}return s}function Vi(n,e){var r=Object.getPrototypeOf(e.prototype).constructor;if(r!==Object){var a=An(r),s=qi(n,a,r,!0),c=s.map(function(M){return M.metadata.filter(function(y){return y.key===bn})}),d=[].concat.apply([],c).length,O=s.length-d;return O>0?O:Vi(n,r)}else return 0}function Gi(n){var e={};return n.forEach(function(r){e[r.key.toString()]=r.value}),{inject:e[wn],multiInject:e[qt],targetName:e[Ei],unmanaged:e[bn]}}var Cr=function(){function n(e,r,a,s,c){this.id=Vt(),this.serviceIdentifier=e,this.parentContext=r,this.parentRequest=a,this.target=c,this.childRequests=[],this.bindings=Array.isArray(s)?s:[s],this.requestScope=a===null?new Map:null}return n.prototype.addChildRequest=function(e,r,a){var s=new n(e,this.parentContext,this,r,a);return this.childRequests.push(s),s},n}();function xn(n){return n._bindingDictionary}function Fa(n,e,r,a,s,c){var d=n?qt:wn,O=new Qe(d,r),M=new Cn(e,a,r,O);if(s!==void 0){var y=new Qe(s,c);M.metadata.push(y)}return M}function zi(n,e,r,a,s){var c=Ht(r.container,s.serviceIdentifier),d=[];return c.length===_n.NoBindingsAvailable&&r.container.options.autoBindInjectable&&typeof s.serviceIdentifier=="function"&&n.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(r.container.bind(s.serviceIdentifier).toSelf(),c=Ht(r.container,s.serviceIdentifier)),e?d=c:d=c.filter(function(O){var M=new Cr(O.serviceIdentifier,r,a,O,s);return O.constraint(M)}),Ka(s.serviceIdentifier,d,s,r.container),d}function Ka(n,e,r,a){switch(e.length){case _n.NoBindingsAvailable:if(r.isOptional())return e;var s=zt(n),c=sa;throw c+=ka(s,r),c+=Fi(a,s,Ht),new Error(c);case _n.OnlyOneBindingAvailable:return e;case _n.MultipleBindingsAvailable:default:if(r.isArray())return e;var s=zt(n),c=oa+" "+s;throw c+=Fi(a,s,Ht),new Error(c)}}function Hi(n,e,r,a,s,c){var d,O;if(s===null){d=zi(n,e,a,null,c),O=new Cr(r,a,null,d,c);var M=new Da(a,O);a.addPlan(M)}else d=zi(n,e,a,s,c),O=s.addChildRequest(c.serviceIdentifier,d,c);d.forEach(function(y){var j=null;if(c.isArray())j=O.addChildRequest(y.serviceIdentifier,y,c);else{if(y.cache)return;j=O}if(y.type===ce.Instance&&y.implementationType!==null){var $=ja(n,y.implementationType);if(!a.container.options.skipBaseClassChecks){var Y=Vi(n,y.implementationType);if($.length<Y){var pe=va(An(y.implementationType));throw new Error(pe)}}$.forEach(function(ve){Hi(n,!1,ve.serviceIdentifier,a,j,ve)})}})}function Ht(n,e){var r=[],a=xn(n);return a.hasKey(e)?r=a.get(e):n.parent!==null&&(r=Ht(n.parent,e)),r}function Wa(n,e,r,a,s,c,d,O){O===void 0&&(O=!1);var M=new Ui(e),y=Fa(r,a,s,"",c,d);try{return Hi(n,O,s,M,null,y),M}catch(j){throw Bi(j)&&Wi(M.plan.rootRequest),j}}function Ua(n,e,r,a){var s=new Cn($t.Variable,"",e,new Qe(r,a)),c=new Ui(n),d=new Cr(e,c,null,[],s);return d}function Ie(n){var e=typeof n=="object"&&n!==null||typeof n=="function";return e&&typeof n.then=="function"}function Yi(n){return Ie(n)?!0:Array.isArray(n)&&n.some(Ie)}var qa=function(n,e,r,a){function s(c){return c instanceof r?c:new r(function(d){d(c)})}return new(r||(r=Promise))(function(c,d){function O(j){try{y(a.next(j))}catch($){d($)}}function M(j){try{y(a.throw(j))}catch($){d($)}}function y(j){j.done?c(j.value):s(j.value).then(O,M)}y((a=a.apply(n,e||[])).next())})},$a=function(n,e){var r={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},a,s,c,d;return d={next:O(0),throw:O(1),return:O(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function O(y){return function(j){return M([y,j])}}function M(y){if(a)throw new TypeError("Generator is already executing.");for(;r;)try{if(a=1,s&&(c=y[0]&2?s.return:y[0]?s.throw||((c=s.return)&&c.call(s),0):s.next)&&!(c=c.call(s,y[1])).done)return c;switch(s=0,c&&(y=[y[0]&2,c.value]),y[0]){case 0:case 1:c=y;break;case 4:return r.label++,{value:y[1],done:!1};case 5:r.label++,s=y[1],y=[0];continue;case 7:y=r.ops.pop(),r.trys.pop();continue;default:if(c=r.trys,!(c=c.length>0&&c[c.length-1])&&(y[0]===6||y[0]===2)){r=0;continue}if(y[0]===3&&(!c||y[1]>c[0]&&y[1]<c[3])){r.label=y[1];break}if(y[0]===6&&r.label<c[1]){r.label=c[1],c=y;break}if(c&&r.label<c[2]){r.label=c[2],r.ops.push(y);break}c[2]&&r.ops.pop(),r.trys.pop();continue}y=e.call(n,r)}catch(j){y=[6,j],s=0}finally{a=c=0}if(y[0]&5)throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}},Va=function(n,e){return e.scope===ye.Singleton&&e.activated?e.cache:e.scope===ye.Request&&n.has(e.id)?n.get(e.id):null},Ga=function(n,e,r){e.scope===ye.Singleton&&Ha(e,r),e.scope===ye.Request&&za(n,e,r)},za=function(n,e,r){n.has(e.id)||n.set(e.id,r)},Ha=function(n,e){n.cache=e,n.activated=!0,Ie(e)&&Ya(n,e)},Ya=function(n,e){return qa(void 0,void 0,void 0,function(){var r,a;return $a(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,e];case 1:return r=s.sent(),n.cache=r,[3,3];case 2:throw a=s.sent(),n.cache=null,n.activated=!1,a;case 3:return[2]}})})},Yt;(function(n){n.DynamicValue="toDynamicValue",n.Factory="toFactory",n.Provider="toProvider"})(Yt||(Yt={}));var Qa=function(n){var e=null;switch(n.type){case ce.ConstantValue:case ce.Function:e=n.cache;break;case ce.Constructor:case ce.Instance:e=n.implementationType;break;case ce.DynamicValue:e=n.dynamicValue;break;case ce.Provider:e=n.provider;break;case ce.Factory:e=n.factory;break}if(e===null){var r=zt(n.serviceIdentifier);throw new Error(fa+" "+r)}},Xa=function(n){switch(n.type){case ce.Factory:return{factory:n.factory,factoryType:Yt.Factory};case ce.Provider:return{factory:n.provider,factoryType:Yt.Provider};case ce.DynamicValue:return{factory:n.dynamicValue,factoryType:Yt.DynamicValue};default:throw new Error("Unexpected factory type "+n.type)}},It=function(){return It=Object.assign||function(n){for(var e,r=1,a=arguments.length;r<a;r++){e=arguments[r];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}return n},It.apply(this,arguments)},Qi=function(n,e,r,a){function s(c){return c instanceof r?c:new r(function(d){d(c)})}return new(r||(r=Promise))(function(c,d){function O(j){try{y(a.next(j))}catch($){d($)}}function M(j){try{y(a.throw(j))}catch($){d($)}}function y(j){j.done?c(j.value):s(j.value).then(O,M)}y((a=a.apply(n,e||[])).next())})},Xi=function(n,e){var r={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},a,s,c,d;return d={next:O(0),throw:O(1),return:O(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function O(y){return function(j){return M([y,j])}}function M(y){if(a)throw new TypeError("Generator is already executing.");for(;r;)try{if(a=1,s&&(c=y[0]&2?s.return:y[0]?s.throw||((c=s.return)&&c.call(s),0):s.next)&&!(c=c.call(s,y[1])).done)return c;switch(s=0,c&&(y=[y[0]&2,c.value]),y[0]){case 0:case 1:c=y;break;case 4:return r.label++,{value:y[1],done:!1};case 5:r.label++,s=y[1],y=[0];continue;case 7:y=r.ops.pop(),r.trys.pop();continue;default:if(c=r.trys,!(c=c.length>0&&c[c.length-1])&&(y[0]===6||y[0]===2)){r=0;continue}if(y[0]===3&&(!c||y[1]>c[0]&&y[1]<c[3])){r.label=y[1];break}if(y[0]===6&&r.label<c[1]){r.label=c[1],c=y;break}if(c&&r.label<c[2]){r.label=c[2],r.ops.push(y);break}c[2]&&r.ops.pop(),r.trys.pop();continue}y=e.call(n,r)}catch(j){y=[6,j],s=0}finally{a=c=0}if(y[0]&5)throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}},Ja=function(n,e,r){if(r||arguments.length===2)for(var a=0,s=e.length,c;a<s;a++)(c||!(a in e))&&(c||(c=Array.prototype.slice.call(e,0,a)),c[a]=e[a]);return n.concat(c||Array.prototype.slice.call(e))};function Za(n,e){return n.reduce(function(r,a){var s=e(a),c=a.target.type;return c===$t.ConstructorArgument?r.constructorInjections.push(s):(r.propertyRequests.push(a),r.propertyInjections.push(s)),r.isAsync||(r.isAsync=Yi(s)),r},{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}function es(n,e,r){var a;if(e.length>0){var s=Za(e,r),c=It(It({},s),{constr:n});s.isAsync?a=ts(c):a=Ji(c)}else a=new n;return a}function Ji(n){var e,r=new((e=n.constr).bind.apply(e,Ja([void 0],n.constructorInjections,!1)));return n.propertyRequests.forEach(function(a,s){var c=a.target.identifier,d=n.propertyInjections[s];(!a.target.isOptional()||d!==void 0)&&(r[c]=d)}),r}function ts(n){return Qi(this,void 0,void 0,function(){var e,r;return Xi(this,function(a){switch(a.label){case 0:return[4,Zi(n.constructorInjections)];case 1:return e=a.sent(),[4,Zi(n.propertyInjections)];case 2:return r=a.sent(),[2,Ji(It(It({},n),{constructorInjections:e,propertyInjections:r}))]}})})}function Zi(n){return Qi(this,void 0,void 0,function(){var e,r,a,s;return Xi(this,function(c){for(e=[],r=0,a=n;r<a.length;r++)s=a[r],Array.isArray(s)?e.push(Promise.all(s)):e.push(s);return[2,Promise.all(e)]})})}function eo(n,e){var r=ns(n,e);return Ie(r)?r.then(function(){return e}):e}function ns(n,e){var r,a;if(Reflect.hasMetadata(Di,n)){var s=Reflect.getMetadata(Di,n);try{return(a=(r=e)[s.value])===null||a===void 0?void 0:a.call(r)}catch(c){if(c instanceof Error)throw new Error(Ca(n.name,c.message))}}}function rs(n,e){n.scope!==ye.Singleton&&is(n,e)}function is(n,e){var r="Class cannot be instantiated in "+(n.scope===ye.Request?"request":"transient")+" scope.";if(typeof n.onDeactivation=="function")throw new Error(Ar(e.name,r));if(Reflect.hasMetadata(_r,e))throw new Error(Sa(e.name,r))}function os(n,e,r,a){rs(n,e);var s=es(e,r,a);return Ie(s)?s.then(function(c){return eo(e,c)}):eo(e,s)}var as=function(n,e,r,a){function s(c){return c instanceof r?c:new r(function(d){d(c)})}return new(r||(r=Promise))(function(c,d){function O(j){try{y(a.next(j))}catch($){d($)}}function M(j){try{y(a.throw(j))}catch($){d($)}}function y(j){j.done?c(j.value):s(j.value).then(O,M)}y((a=a.apply(n,e||[])).next())})},ss=function(n,e){var r={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},a,s,c,d;return d={next:O(0),throw:O(1),return:O(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function O(y){return function(j){return M([y,j])}}function M(y){if(a)throw new TypeError("Generator is already executing.");for(;r;)try{if(a=1,s&&(c=y[0]&2?s.return:y[0]?s.throw||((c=s.return)&&c.call(s),0):s.next)&&!(c=c.call(s,y[1])).done)return c;switch(s=0,c&&(y=[y[0]&2,c.value]),y[0]){case 0:case 1:c=y;break;case 4:return r.label++,{value:y[1],done:!1};case 5:r.label++,s=y[1],y=[0];continue;case 7:y=r.ops.pop(),r.trys.pop();continue;default:if(c=r.trys,!(c=c.length>0&&c[c.length-1])&&(y[0]===6||y[0]===2)){r=0;continue}if(y[0]===3&&(!c||y[1]>c[0]&&y[1]<c[3])){r.label=y[1];break}if(y[0]===6&&r.label<c[1]){r.label=c[1],c=y;break}if(c&&r.label<c[2]){r.label=c[2],r.ops.push(y);break}c[2]&&r.ops.pop(),r.trys.pop();continue}y=e.call(n,r)}catch(j){y=[6,j],s=0}finally{a=c=0}if(y[0]&5)throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}},Sr=function(n){return function(e){e.parentContext.setCurrentRequest(e);var r=e.bindings,a=e.childRequests,s=e.target&&e.target.isArray(),c=!e.parentRequest||!e.parentRequest.target||!e.target||!e.parentRequest.target.matchesArray(e.target.serviceIdentifier);if(s&&c)return a.map(function(O){var M=Sr(n);return M(O)});if(e.target.isOptional()&&r.length===0)return;var d=r[0];return fs(n,e,d)}},us=function(n,e){var r=Xa(n);return Ea(function(){return r.factory.bind(n)(e)},function(){return new Error(xa(r.factoryType,e.currentRequest.serviceIdentifier.toString()))})},cs=function(n,e,r){var a,s=e.childRequests;switch(Qa(r),r.type){case ce.ConstantValue:case ce.Function:a=r.cache;break;case ce.Constructor:a=r.implementationType;break;case ce.Instance:a=os(r,r.implementationType,s,Sr(n));break;default:a=us(r,e.parentContext)}return a},ls=function(n,e,r){var a=Va(n,e);return a!==null||(a=r(),Ga(n,e,a)),a},fs=function(n,e,r){return ls(n,r,function(){var a=cs(n,e,r);return Ie(a)?a=a.then(function(s){return to(e,r,s)}):a=to(e,r,a),a})};function to(n,e,r){var a=hs(n.parentContext,e,r),s=gs(n.parentContext.container),c,d=s.next();do{c=d.value;var O=n.parentContext,M=n.serviceIdentifier,y=ps(c,M);Ie(a)?a=no(y,O,a):a=ds(y,O,a),d=s.next()}while(d.done!==!0&&!xn(c).hasKey(n.serviceIdentifier));return a}var hs=function(n,e,r){var a;return typeof e.onActivation=="function"?a=e.onActivation(n,r):a=r,a},ds=function(n,e,r){for(var a=n.next();!a.done;){if(r=a.value(e,r),Ie(r))return no(n,e,r);a=n.next()}return r},no=function(n,e,r){return as(void 0,void 0,void 0,function(){var a,s;return ss(this,function(c){switch(c.label){case 0:return[4,r];case 1:a=c.sent(),s=n.next(),c.label=2;case 2:return s.done?[3,4]:[4,s.value(e,a)];case 3:return a=c.sent(),s=n.next(),[3,2];case 4:return[2,a]}})})},ps=function(n,e){var r=n._activations;return r.hasKey(e)?r.get(e).values():[].values()},gs=function(n){for(var e=[n],r=n.parent;r!==null;)e.push(r),r=r.parent;var a=function(){var c=e.pop();return c!==void 0?{done:!1,value:c}:{done:!0,value:void 0}},s={next:a};return s};function ys(n){var e=Sr(n.plan.rootRequest.requestScope);return e(n.plan.rootRequest)}var Xe=function(n,e){var r=n.parentRequest;return r!==null?e(r)?!0:Xe(r,e):!1},Qt=function(n){return function(e){var r=function(a){return a!==null&&a.target!==null&&a.target.matchesTag(n)(e)};return r.metaData=new Qe(n,e),r}},On=Qt(Me),xr=function(n){return function(e){var r=null;if(e!==null)if(r=e.bindings[0],typeof n=="string"){var a=r.serviceIdentifier;return a===n}else{var s=e.bindings[0].implementationType;return n===s}return!1}},Pn=function(){function n(e){this._binding=e}return n.prototype.when=function(e){return this._binding.constraint=e,new Se(this._binding)},n.prototype.whenTargetNamed=function(e){return this._binding.constraint=On(e),new Se(this._binding)},n.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(e){if(e===null)return!1;var r=e.target!==null&&!e.target.isNamed()&&!e.target.isTagged();return r},new Se(this._binding)},n.prototype.whenTargetTagged=function(e,r){return this._binding.constraint=Qt(e)(r),new Se(this._binding)},n.prototype.whenInjectedInto=function(e){return this._binding.constraint=function(r){return r!==null&&xr(e)(r.parentRequest)},new Se(this._binding)},n.prototype.whenParentNamed=function(e){return this._binding.constraint=function(r){return r!==null&&On(e)(r.parentRequest)},new Se(this._binding)},n.prototype.whenParentTagged=function(e,r){return this._binding.constraint=function(a){return a!==null&&Qt(e)(r)(a.parentRequest)},new Se(this._binding)},n.prototype.whenAnyAncestorIs=function(e){return this._binding.constraint=function(r){return r!==null&&Xe(r,xr(e))},new Se(this._binding)},n.prototype.whenNoAncestorIs=function(e){return this._binding.constraint=function(r){return r!==null&&!Xe(r,xr(e))},new Se(this._binding)},n.prototype.whenAnyAncestorNamed=function(e){return this._binding.constraint=function(r){return r!==null&&Xe(r,On(e))},new Se(this._binding)},n.prototype.whenNoAncestorNamed=function(e){return this._binding.constraint=function(r){return r!==null&&!Xe(r,On(e))},new Se(this._binding)},n.prototype.whenAnyAncestorTagged=function(e,r){return this._binding.constraint=function(a){return a!==null&&Xe(a,Qt(e)(r))},new Se(this._binding)},n.prototype.whenNoAncestorTagged=function(e,r){return this._binding.constraint=function(a){return a!==null&&!Xe(a,Qt(e)(r))},new Se(this._binding)},n.prototype.whenAnyAncestorMatches=function(e){return this._binding.constraint=function(r){return r!==null&&Xe(r,e)},new Se(this._binding)},n.prototype.whenNoAncestorMatches=function(e){return this._binding.constraint=function(r){return r!==null&&!Xe(r,e)},new Se(this._binding)},n}(),Se=function(){function n(e){this._binding=e}return n.prototype.onActivation=function(e){return this._binding.onActivation=e,new Pn(this._binding)},n.prototype.onDeactivation=function(e){return this._binding.onDeactivation=e,new Pn(this._binding)},n}(),Je=function(){function n(e){this._binding=e,this._bindingWhenSyntax=new Pn(this._binding),this._bindingOnSyntax=new Se(this._binding)}return n.prototype.when=function(e){return this._bindingWhenSyntax.when(e)},n.prototype.whenTargetNamed=function(e){return this._bindingWhenSyntax.whenTargetNamed(e)},n.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},n.prototype.whenTargetTagged=function(e,r){return this._bindingWhenSyntax.whenTargetTagged(e,r)},n.prototype.whenInjectedInto=function(e){return this._bindingWhenSyntax.whenInjectedInto(e)},n.prototype.whenParentNamed=function(e){return this._bindingWhenSyntax.whenParentNamed(e)},n.prototype.whenParentTagged=function(e,r){return this._bindingWhenSyntax.whenParentTagged(e,r)},n.prototype.whenAnyAncestorIs=function(e){return this._bindingWhenSyntax.whenAnyAncestorIs(e)},n.prototype.whenNoAncestorIs=function(e){return this._bindingWhenSyntax.whenNoAncestorIs(e)},n.prototype.whenAnyAncestorNamed=function(e){return this._bindingWhenSyntax.whenAnyAncestorNamed(e)},n.prototype.whenAnyAncestorTagged=function(e,r){return this._bindingWhenSyntax.whenAnyAncestorTagged(e,r)},n.prototype.whenNoAncestorNamed=function(e){return this._bindingWhenSyntax.whenNoAncestorNamed(e)},n.prototype.whenNoAncestorTagged=function(e,r){return this._bindingWhenSyntax.whenNoAncestorTagged(e,r)},n.prototype.whenAnyAncestorMatches=function(e){return this._bindingWhenSyntax.whenAnyAncestorMatches(e)},n.prototype.whenNoAncestorMatches=function(e){return this._bindingWhenSyntax.whenNoAncestorMatches(e)},n.prototype.onActivation=function(e){return this._bindingOnSyntax.onActivation(e)},n.prototype.onDeactivation=function(e){return this._bindingOnSyntax.onDeactivation(e)},n}(),vs=function(){function n(e){this._binding=e}return n.prototype.inRequestScope=function(){return this._binding.scope=ye.Request,new Je(this._binding)},n.prototype.inSingletonScope=function(){return this._binding.scope=ye.Singleton,new Je(this._binding)},n.prototype.inTransientScope=function(){return this._binding.scope=ye.Transient,new Je(this._binding)},n}(),ro=function(){function n(e){this._binding=e,this._bindingWhenSyntax=new Pn(this._binding),this._bindingOnSyntax=new Se(this._binding),this._bindingInSyntax=new vs(e)}return n.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},n.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},n.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},n.prototype.when=function(e){return this._bindingWhenSyntax.when(e)},n.prototype.whenTargetNamed=function(e){return this._bindingWhenSyntax.whenTargetNamed(e)},n.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},n.prototype.whenTargetTagged=function(e,r){return this._bindingWhenSyntax.whenTargetTagged(e,r)},n.prototype.whenInjectedInto=function(e){return this._bindingWhenSyntax.whenInjectedInto(e)},n.prototype.whenParentNamed=function(e){return this._bindingWhenSyntax.whenParentNamed(e)},n.prototype.whenParentTagged=function(e,r){return this._bindingWhenSyntax.whenParentTagged(e,r)},n.prototype.whenAnyAncestorIs=function(e){return this._bindingWhenSyntax.whenAnyAncestorIs(e)},n.prototype.whenNoAncestorIs=function(e){return this._bindingWhenSyntax.whenNoAncestorIs(e)},n.prototype.whenAnyAncestorNamed=function(e){return this._bindingWhenSyntax.whenAnyAncestorNamed(e)},n.prototype.whenAnyAncestorTagged=function(e,r){return this._bindingWhenSyntax.whenAnyAncestorTagged(e,r)},n.prototype.whenNoAncestorNamed=function(e){return this._bindingWhenSyntax.whenNoAncestorNamed(e)},n.prototype.whenNoAncestorTagged=function(e,r){return this._bindingWhenSyntax.whenNoAncestorTagged(e,r)},n.prototype.whenAnyAncestorMatches=function(e){return this._bindingWhenSyntax.whenAnyAncestorMatches(e)},n.prototype.whenNoAncestorMatches=function(e){return this._bindingWhenSyntax.whenNoAncestorMatches(e)},n.prototype.onActivation=function(e){return this._bindingOnSyntax.onActivation(e)},n.prototype.onDeactivation=function(e){return this._bindingOnSyntax.onDeactivation(e)},n}(),ms=function(){function n(e){this._binding=e}return n.prototype.to=function(e){return this._binding.type=ce.Instance,this._binding.implementationType=e,new ro(this._binding)},n.prototype.toSelf=function(){if(typeof this._binding.serviceIdentifier!="function")throw new Error(""+ya);var e=this._binding.serviceIdentifier;return this.to(e)},n.prototype.toConstantValue=function(e){return this._binding.type=ce.ConstantValue,this._binding.cache=e,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=ye.Singleton,new Je(this._binding)},n.prototype.toDynamicValue=function(e){return this._binding.type=ce.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=e,this._binding.implementationType=null,new ro(this._binding)},n.prototype.toConstructor=function(e){return this._binding.type=ce.Constructor,this._binding.implementationType=e,this._binding.scope=ye.Singleton,new Je(this._binding)},n.prototype.toFactory=function(e){return this._binding.type=ce.Factory,this._binding.factory=e,this._binding.scope=ye.Singleton,new Je(this._binding)},n.prototype.toFunction=function(e){if(typeof e!="function")throw new Error(pa);var r=this.toConstantValue(e);return this._binding.type=ce.Function,this._binding.scope=ye.Singleton,r},n.prototype.toAutoFactory=function(e){return this._binding.type=ce.Factory,this._binding.factory=function(r){var a=function(){return r.container.get(e)};return a},this._binding.scope=ye.Singleton,new Je(this._binding)},n.prototype.toAutoNamedFactory=function(e){return this._binding.type=ce.Factory,this._binding.factory=function(r){return function(a){return r.container.getNamed(e,a)}},new Je(this._binding)},n.prototype.toProvider=function(e){return this._binding.type=ce.Provider,this._binding.provider=e,this._binding.scope=ye.Singleton,new Je(this._binding)},n.prototype.toService=function(e){this.toDynamicValue(function(r){return r.container.get(e)})},n}(),bs=function(){function n(){}return n.of=function(e,r,a,s,c){var d=new n;return d.bindings=e,d.middleware=r,d.deactivations=s,d.activations=a,d.moduleActivationStore=c,d},n}();function ws(n){return typeof n=="object"&&n!==null&&"clone"in n&&typeof n.clone=="function"}var yt=function(){function n(){this._map=new Map}return n.prototype.getMap=function(){return this._map},n.prototype.add=function(e,r){if(e==null)throw new Error(Gt);if(r==null)throw new Error(Gt);var a=this._map.get(e);a!==void 0?a.push(r):this._map.set(e,[r])},n.prototype.get=function(e){if(e==null)throw new Error(Gt);var r=this._map.get(e);if(r!==void 0)return r;throw new Error(ji)},n.prototype.remove=function(e){if(e==null)throw new Error(Gt);if(!this._map.delete(e))throw new Error(ji)},n.prototype.removeIntersection=function(e){var r=this;this.traverse(function(a,s){var c=e.hasKey(a)?e.get(a):void 0;if(c!==void 0){var d=s.filter(function(O){return!c.some(function(M){return O===M})});r._setValue(a,d)}})},n.prototype.removeByCondition=function(e){var r=this,a=[];return this._map.forEach(function(s,c){for(var d=[],O=0,M=s;O<M.length;O++){var y=M[O],j=e(y);j?a.push(y):d.push(y)}r._setValue(c,d)}),a},n.prototype.hasKey=function(e){if(e==null)throw new Error(Gt);return this._map.has(e)},n.prototype.clone=function(){var e=new n;return this._map.forEach(function(r,a){r.forEach(function(s){return e.add(a,ws(s)?s.clone():s)})}),e},n.prototype.traverse=function(e){this._map.forEach(function(r,a){e(a,r)})},n.prototype._setValue=function(e,r){r.length>0?this._map.set(e,r):this._map.delete(e)},n}(),_s=function(){function n(){this._map=new Map}return n.prototype.remove=function(e){if(this._map.has(e)){var r=this._map.get(e);return this._map.delete(e),r}return this._getEmptyHandlersStore()},n.prototype.addDeactivation=function(e,r,a){this._getModuleActivationHandlers(e).onDeactivations.add(r,a)},n.prototype.addActivation=function(e,r,a){this._getModuleActivationHandlers(e).onActivations.add(r,a)},n.prototype.clone=function(){var e=new n;return this._map.forEach(function(r,a){e._map.set(a,{onActivations:r.onActivations.clone(),onDeactivations:r.onDeactivations.clone()})}),e},n.prototype._getModuleActivationHandlers=function(e){var r=this._map.get(e);return r===void 0&&(r=this._getEmptyHandlersStore(),this._map.set(e,r)),r},n.prototype._getEmptyHandlersStore=function(){var e={onActivations:new yt,onDeactivations:new yt};return e},n}(),En=function(){return En=Object.assign||function(n){for(var e,r=1,a=arguments.length;r<a;r++){e=arguments[r];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}return n},En.apply(this,arguments)},Be=function(n,e,r,a){function s(c){return c instanceof r?c:new r(function(d){d(c)})}return new(r||(r=Promise))(function(c,d){function O(j){try{y(a.next(j))}catch($){d($)}}function M(j){try{y(a.throw(j))}catch($){d($)}}function y(j){j.done?c(j.value):s(j.value).then(O,M)}y((a=a.apply(n,e||[])).next())})},Fe=function(n,e){var r={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},a,s,c,d;return d={next:O(0),throw:O(1),return:O(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function O(y){return function(j){return M([y,j])}}function M(y){if(a)throw new TypeError("Generator is already executing.");for(;r;)try{if(a=1,s&&(c=y[0]&2?s.return:y[0]?s.throw||((c=s.return)&&c.call(s),0):s.next)&&!(c=c.call(s,y[1])).done)return c;switch(s=0,c&&(y=[y[0]&2,c.value]),y[0]){case 0:case 1:c=y;break;case 4:return r.label++,{value:y[1],done:!1};case 5:r.label++,s=y[1],y=[0];continue;case 7:y=r.ops.pop(),r.trys.pop();continue;default:if(c=r.trys,!(c=c.length>0&&c[c.length-1])&&(y[0]===6||y[0]===2)){r=0;continue}if(y[0]===3&&(!c||y[1]>c[0]&&y[1]<c[3])){r.label=y[1];break}if(y[0]===6&&r.label<c[1]){r.label=c[1],c=y;break}if(c&&r.label<c[2]){r.label=c[2],r.ops.push(y);break}c[2]&&r.ops.pop(),r.trys.pop();continue}y=e.call(n,r)}catch(j){y=[6,j],s=0}finally{a=c=0}if(y[0]&5)throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}},As=function(n,e,r){if(r||arguments.length===2)for(var a=0,s=e.length,c;a<s;a++)(c||!(a in e))&&(c||(c=Array.prototype.slice.call(e,0,a)),c[a]=e[a]);return n.concat(c||Array.prototype.slice.call(e))},Cs=function(){function n(e){var r=e||{};if(typeof r!="object")throw new Error(""+ma);if(r.defaultScope===void 0)r.defaultScope=ye.Transient;else if(r.defaultScope!==ye.Singleton&&r.defaultScope!==ye.Transient&&r.defaultScope!==ye.Request)throw new Error(""+ba);if(r.autoBindInjectable===void 0)r.autoBindInjectable=!1;else if(typeof r.autoBindInjectable!="boolean")throw new Error(""+wa);if(r.skipBaseClassChecks===void 0)r.skipBaseClassChecks=!1;else if(typeof r.skipBaseClassChecks!="boolean")throw new Error(""+_a);this.options={autoBindInjectable:r.autoBindInjectable,defaultScope:r.defaultScope,skipBaseClassChecks:r.skipBaseClassChecks},this.id=Vt(),this._bindingDictionary=new yt,this._snapshots=[],this._middleware=null,this._activations=new yt,this._deactivations=new yt,this.parent=null,this._metadataReader=new Pa,this._moduleActivationStore=new _s}return n.merge=function(e,r){for(var a=[],s=2;s<arguments.length;s++)a[s-2]=arguments[s];var c=new n,d=As([e,r],a,!0).map(function(y){return xn(y)}),O=xn(c);function M(y,j){y.traverse(function($,Y){Y.forEach(function(pe){j.add(pe.serviceIdentifier,pe.clone())})})}return d.forEach(function(y){M(y,O)}),c},n.prototype.load=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];for(var a=this._getContainerModuleHelpersFactory(),s=0,c=e;s<c.length;s++){var d=c[s],O=a(d.id);d.registry(O.bindFunction,O.unbindFunction,O.isboundFunction,O.rebindFunction,O.unbindAsyncFunction,O.onActivationFunction,O.onDeactivationFunction)}},n.prototype.loadAsync=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Be(this,void 0,void 0,function(){var a,s,c,d,O;return Fe(this,function(M){switch(M.label){case 0:a=this._getContainerModuleHelpersFactory(),s=0,c=e,M.label=1;case 1:return s<c.length?(d=c[s],O=a(d.id),[4,d.registry(O.bindFunction,O.unbindFunction,O.isboundFunction,O.rebindFunction,O.unbindAsyncFunction,O.onActivationFunction,O.onDeactivationFunction)]):[3,4];case 2:M.sent(),M.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},n.prototype.unload=function(){for(var e=this,r=[],a=0;a<arguments.length;a++)r[a]=arguments[a];r.forEach(function(s){var c=e._removeModuleBindings(s.id);e._deactivateSingletons(c),e._removeModuleHandlers(s.id)})},n.prototype.unloadAsync=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Be(this,void 0,void 0,function(){var a,s,c,d;return Fe(this,function(O){switch(O.label){case 0:a=0,s=e,O.label=1;case 1:return a<s.length?(c=s[a],d=this._removeModuleBindings(c.id),[4,this._deactivateSingletonsAsync(d)]):[3,4];case 2:O.sent(),this._removeModuleHandlers(c.id),O.label=3;case 3:return a++,[3,1];case 4:return[2]}})})},n.prototype.bind=function(e){var r=this.options.defaultScope||ye.Transient,a=new ra(e,r);return this._bindingDictionary.add(e,a),new ms(a)},n.prototype.rebind=function(e){return this.unbind(e),this.bind(e)},n.prototype.rebindAsync=function(e){return Be(this,void 0,void 0,function(){return Fe(this,function(r){switch(r.label){case 0:return[4,this.unbindAsync(e)];case 1:return r.sent(),[2,this.bind(e)]}})})},n.prototype.unbind=function(e){if(this._bindingDictionary.hasKey(e)){var r=this._bindingDictionary.get(e);this._deactivateSingletons(r)}this._removeServiceFromDictionary(e)},n.prototype.unbindAsync=function(e){return Be(this,void 0,void 0,function(){var r;return Fe(this,function(a){switch(a.label){case 0:return this._bindingDictionary.hasKey(e)?(r=this._bindingDictionary.get(e),[4,this._deactivateSingletonsAsync(r)]):[3,2];case 1:a.sent(),a.label=2;case 2:return this._removeServiceFromDictionary(e),[2]}})})},n.prototype.unbindAll=function(){var e=this;this._bindingDictionary.traverse(function(r,a){e._deactivateSingletons(a)}),this._bindingDictionary=new yt},n.prototype.unbindAllAsync=function(){return Be(this,void 0,void 0,function(){var e,r=this;return Fe(this,function(a){switch(a.label){case 0:return e=[],this._bindingDictionary.traverse(function(s,c){e.push(r._deactivateSingletonsAsync(c))}),[4,Promise.all(e)];case 1:return a.sent(),this._bindingDictionary=new yt,[2]}})})},n.prototype.onActivation=function(e,r){this._activations.add(e,r)},n.prototype.onDeactivation=function(e,r){this._deactivations.add(e,r)},n.prototype.isBound=function(e){var r=this._bindingDictionary.hasKey(e);return!r&&this.parent&&(r=this.parent.isBound(e)),r},n.prototype.isCurrentBound=function(e){return this._bindingDictionary.hasKey(e)},n.prototype.isBoundNamed=function(e,r){return this.isBoundTagged(e,Me,r)},n.prototype.isBoundTagged=function(e,r,a){var s=!1;if(this._bindingDictionary.hasKey(e)){var c=this._bindingDictionary.get(e),d=Ua(this,e,r,a);s=c.some(function(O){return O.constraint(d)})}return!s&&this.parent&&(s=this.parent.isBoundTagged(e,r,a)),s},n.prototype.snapshot=function(){this._snapshots.push(bs.of(this._bindingDictionary.clone(),this._middleware,this._activations.clone(),this._deactivations.clone(),this._moduleActivationStore.clone()))},n.prototype.restore=function(){var e=this._snapshots.pop();if(e===void 0)throw new Error(ha);this._bindingDictionary=e.bindings,this._activations=e.activations,this._deactivations=e.deactivations,this._middleware=e.middleware,this._moduleActivationStore=e.moduleActivationStore},n.prototype.createChild=function(e){var r=new n(e||this.options);return r.parent=this,r},n.prototype.applyMiddleware=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var a=this._middleware?this._middleware:this._planAndResolve();this._middleware=e.reduce(function(s,c){return c(s)},a)},n.prototype.applyCustomMetadataReader=function(e){this._metadataReader=e},n.prototype.get=function(e){var r=this._getNotAllArgs(e,!1);return this._getButThrowIfAsync(r)},n.prototype.getAsync=function(e){return Be(this,void 0,void 0,function(){var r;return Fe(this,function(a){return r=this._getNotAllArgs(e,!1),[2,this._get(r)]})})},n.prototype.getTagged=function(e,r,a){var s=this._getNotAllArgs(e,!1,r,a);return this._getButThrowIfAsync(s)},n.prototype.getTaggedAsync=function(e,r,a){return Be(this,void 0,void 0,function(){var s;return Fe(this,function(c){return s=this._getNotAllArgs(e,!1,r,a),[2,this._get(s)]})})},n.prototype.getNamed=function(e,r){return this.getTagged(e,Me,r)},n.prototype.getNamedAsync=function(e,r){return this.getTaggedAsync(e,Me,r)},n.prototype.getAll=function(e){var r=this._getAllArgs(e);return this._getButThrowIfAsync(r)},n.prototype.getAllAsync=function(e){var r=this._getAllArgs(e);return this._getAll(r)},n.prototype.getAllTagged=function(e,r,a){var s=this._getNotAllArgs(e,!0,r,a);return this._getButThrowIfAsync(s)},n.prototype.getAllTaggedAsync=function(e,r,a){var s=this._getNotAllArgs(e,!0,r,a);return this._getAll(s)},n.prototype.getAllNamed=function(e,r){return this.getAllTagged(e,Me,r)},n.prototype.getAllNamedAsync=function(e,r){return this.getAllTaggedAsync(e,Me,r)},n.prototype.resolve=function(e){var r=this.isBound(e);r||this.bind(e).toSelf();var a=this.get(e);return r||this.unbind(e),a},n.prototype._preDestroy=function(e,r){var a,s;if(Reflect.hasMetadata(_r,e)){var c=Reflect.getMetadata(_r,e);return(s=(a=r)[c.value])===null||s===void 0?void 0:s.call(a)}},n.prototype._removeModuleHandlers=function(e){var r=this._moduleActivationStore.remove(e);this._activations.removeIntersection(r.onActivations),this._deactivations.removeIntersection(r.onDeactivations)},n.prototype._removeModuleBindings=function(e){return this._bindingDictionary.removeByCondition(function(r){return r.moduleId===e})},n.prototype._deactivate=function(e,r){var a=this,s=Object.getPrototypeOf(r).constructor;try{if(this._deactivations.hasKey(e.serviceIdentifier)){var c=this._deactivateContainer(r,this._deactivations.get(e.serviceIdentifier).values());if(Ie(c))return this._handleDeactivationError(c.then(function(){return a._propagateContainerDeactivationThenBindingAndPreDestroyAsync(e,r,s)}),s)}var d=this._propagateContainerDeactivationThenBindingAndPreDestroy(e,r,s);if(Ie(d))return this._handleDeactivationError(d,s)}catch(O){if(O instanceof Error)throw new Error(Ar(s.name,O.message))}},n.prototype._handleDeactivationError=function(e,r){return Be(this,void 0,void 0,function(){var a;return Fe(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,e];case 1:return s.sent(),[3,3];case 2:if(a=s.sent(),a instanceof Error)throw new Error(Ar(r.name,a.message));return[3,3];case 3:return[2]}})})},n.prototype._deactivateContainer=function(e,r){for(var a=this,s=r.next();s.value;){var c=s.value(e);if(Ie(c))return c.then(function(){return a._deactivateContainerAsync(e,r)});s=r.next()}},n.prototype._deactivateContainerAsync=function(e,r){return Be(this,void 0,void 0,function(){var a;return Fe(this,function(s){switch(s.label){case 0:a=r.next(),s.label=1;case 1:return a.value?[4,a.value(e)]:[3,3];case 2:return s.sent(),a=r.next(),[3,1];case 3:return[2]}})})},n.prototype._getContainerModuleHelpersFactory=function(){var e=this,r=function(j,$){j._binding.moduleId=$},a=function(j){return function($){var Y=e.bind($);return r(Y,j),Y}},s=function(){return function(j){return e.unbind(j)}},c=function(){return function(j){return e.unbindAsync(j)}},d=function(){return function(j){return e.isBound(j)}},O=function(j){return function($){var Y=e.rebind($);return r(Y,j),Y}},M=function(j){return function($,Y){e._moduleActivationStore.addActivation(j,$,Y),e.onActivation($,Y)}},y=function(j){return function($,Y){e._moduleActivationStore.addDeactivation(j,$,Y),e.onDeactivation($,Y)}};return function(j){return{bindFunction:a(j),isboundFunction:d(),onActivationFunction:M(j),onDeactivationFunction:y(j),rebindFunction:O(j),unbindFunction:s(),unbindAsyncFunction:c()}}},n.prototype._getAll=function(e){return Promise.all(this._get(e))},n.prototype._get=function(e){var r=En(En({},e),{contextInterceptor:function(s){return s},targetType:$t.Variable});if(this._middleware){var a=this._middleware(r);if(a==null)throw new Error(da);return a}return this._planAndResolve()(r)},n.prototype._getButThrowIfAsync=function(e){var r=this._get(e);if(Yi(r))throw new Error(ga(e.serviceIdentifier));return r},n.prototype._getAllArgs=function(e){var r={avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:e};return r},n.prototype._getNotAllArgs=function(e,r,a,s){var c={avoidConstraints:!1,isMultiInject:r,serviceIdentifier:e,key:a,value:s};return c},n.prototype._planAndResolve=function(){var e=this;return function(r){var a=Wa(e._metadataReader,e,r.isMultiInject,r.targetType,r.serviceIdentifier,r.key,r.value,r.avoidConstraints);a=r.contextInterceptor(a);var s=ys(a);return s}},n.prototype._deactivateIfSingleton=function(e){var r=this;if(e.activated)return Ie(e.cache)?e.cache.then(function(a){return r._deactivate(e,a)}):this._deactivate(e,e.cache)},n.prototype._deactivateSingletons=function(e){for(var r=0,a=e;r<a.length;r++){var s=a[r],c=this._deactivateIfSingleton(s);if(Ie(c))throw new Error(Aa)}},n.prototype._deactivateSingletonsAsync=function(e){return Be(this,void 0,void 0,function(){var r=this;return Fe(this,function(a){switch(a.label){case 0:return[4,Promise.all(e.map(function(s){return r._deactivateIfSingleton(s)}))];case 1:return a.sent(),[2]}})})},n.prototype._propagateContainerDeactivationThenBindingAndPreDestroy=function(e,r,a){return this.parent?this._deactivate.bind(this.parent)(e,r):this._bindingDeactivationAndPreDestroy(e,r,a)},n.prototype._propagateContainerDeactivationThenBindingAndPreDestroyAsync=function(e,r,a){return Be(this,void 0,void 0,function(){return Fe(this,function(s){switch(s.label){case 0:return this.parent?[4,this._deactivate.bind(this.parent)(e,r)]:[3,2];case 1:return s.sent(),[3,4];case 2:return[4,this._bindingDeactivationAndPreDestroyAsync(e,r,a)];case 3:s.sent(),s.label=4;case 4:return[2]}})})},n.prototype._removeServiceFromDictionary=function(e){try{this._bindingDictionary.remove(e)}catch{throw new Error(aa+" "+zt(e))}},n.prototype._bindingDeactivationAndPreDestroy=function(e,r,a){var s=this;if(typeof e.onDeactivation=="function"){var c=e.onDeactivation(r);if(Ie(c))return c.then(function(){return s._preDestroy(a,r)})}return this._preDestroy(a,r)},n.prototype._bindingDeactivationAndPreDestroyAsync=function(e,r,a){return Be(this,void 0,void 0,function(){return Fe(this,function(s){switch(s.label){case 0:return typeof e.onDeactivation!="function"?[3,2]:[4,e.onDeactivation(r)];case 1:s.sent(),s.label=2;case 2:return[4,this._preDestroy(a,r)];case 3:return s.sent(),[2]}})})},n}();function Ss(n){for(var e=new Set,r=0,a=n;r<a.length;r++){var s=a[r];if(e.has(s))return s;e.add(s)}}function xs(n){return n.prototype!==void 0}function Os(n){if(n!==void 0)throw new Error(Li)}function io(n,e,r,a){Os(e),oo(ki,n,r.toString(),a)}function Ps(n,e,r){if(xs(n))throw new Error(Li);oo(Ii,n.constructor,e,r)}function Es(n){var e=[];if(Array.isArray(n)){e=n;var r=Ss(e.map(function(a){return a.key}));if(r!==void 0)throw new Error(Ri+" "+r.toString())}else e=[n];return e}function oo(n,e,r,a){var s=Es(a),c={};Reflect.hasOwnMetadata(n,e)&&(c=Reflect.getMetadata(n,e));var d=c[r];if(d===void 0)d=[];else for(var O=function($){if(s.some(function(Y){return Y.key===$.key}))throw new Error(Ri+" "+$.key.toString())},M=0,y=d;M<y.length;M++){var j=y[M];O(j)}d.push.apply(d,s),c[r]=d,Reflect.defineMetadata(n,c,e)}function ao(n){return function(e,r,a){typeof a=="number"?io(e,r,a,n):Ps(e,r,n)}}function xe(){return function(n){if(Reflect.hasOwnMetadata(wr,n))throw new Error(ia);var e=Reflect.getMetadata(ea,n)||[];return Reflect.defineMetadata(wr,e,n),n}}function Or(n){return ao(new Qe(Me,n))}function Ts(n){return function(e){return function(r,a,s){if(e===void 0){var c=typeof r=="function"?r.name:r.constructor.name;throw new Error(ca(c))}return ao(new Qe(n,e))(r,a,s)}}}var we=Ts(wn);function ks(){return function(n,e,r){var a=new Qe(bn,!0);io(n,e,r,a)}}var Tn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Is(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}/*! *****************************************************************************
12
+ Copyright (C) Microsoft. All rights reserved.
13
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
14
+ this file except in compliance with the License. You may obtain a copy of the
15
+ License at http://www.apache.org/licenses/LICENSE-2.0
16
+
17
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
19
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
20
+ MERCHANTABLITY OR NON-INFRINGEMENT.
21
+
22
+ See the Apache Version 2.0 License for specific language governing permissions
23
+ and limitations under the License.
24
+ ***************************************************************************** */var so;(function(n){(function(e){var r=typeof globalThis=="object"?globalThis:typeof Tn=="object"?Tn:typeof self=="object"?self:typeof this=="object"?this:O(),a=s(n);typeof r.Reflect<"u"&&(a=s(r.Reflect,a)),e(a,r),typeof r.Reflect>"u"&&(r.Reflect=n);function s(M,y){return function(j,$){Object.defineProperty(M,j,{configurable:!0,writable:!0,value:$}),y&&y(j,$)}}function c(){try{return Function("return this;")()}catch{}}function d(){try{return(0,eval)("(function() { return this; })()")}catch{}}function O(){return c()||d()}})(function(e,r){var a=Object.prototype.hasOwnProperty,s=typeof Symbol=="function",c=s&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",d=s&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",O=typeof Object.create=="function",M={__proto__:[]}instanceof Array,y=!O&&!M,j={create:O?function(){return st(Object.create(null))}:M?function(){return st({__proto__:null})}:function(){return st({})},has:y?function(x,E){return a.call(x,E)}:function(x,E){return E in x},get:y?function(x,E){return a.call(x,E)?x[E]:void 0}:function(x,E){return x[E]}},$=Object.getPrototypeOf(Function),Y=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:tn(),pe=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Ct(),ve=typeof WeakMap=="function"?WeakMap:nn(),_e=s?Symbol.for("@reflect-metadata:registry"):void 0,Ze=_t(),Mt=zn(Ze);function Rt(x,E,R,F){if(Q(R)){if(!wt(x))throw new TypeError;if(!at(E))throw new TypeError;return mt(x,E)}else{if(!wt(x))throw new TypeError;if(!fe(E))throw new TypeError;if(!fe(F)&&!Q(F)&&!Re(F))throw new TypeError;return Re(F)&&(F=void 0),R=je(R),Ge(x,E,R,F)}}e("decorate",Rt);function Mn(x,E){function R(F,N){if(!fe(F))throw new TypeError;if(!Q(N)&&!Vr(N))throw new TypeError;ze(x,E,F,N)}return R}e("metadata",Mn);function vt(x,E,R,F){if(!fe(R))throw new TypeError;return Q(F)||(F=je(F)),ze(x,E,R,F)}e("defineMetadata",vt);function Rn(x,E,R){if(!fe(E))throw new TypeError;return Q(R)||(R=je(R)),Bn(x,E,R)}e("hasMetadata",Rn);function Ue(x,E,R){if(!fe(E))throw new TypeError;return Q(R)||(R=je(R)),bt(x,E,R)}e("hasOwnMetadata",Ue);function Te(x,E,R){if(!fe(E))throw new TypeError;return Q(R)||(R=je(R)),jt(x,E,R)}e("getMetadata",Te);function jn(x,E,R){if(!fe(E))throw new TypeError;return Q(R)||(R=je(R)),Fn(x,E,R)}e("getOwnMetadata",jn);function $r(x,E){if(!fe(x))throw new TypeError;return Q(E)||(E=je(E)),et(x,E)}e("getMetadataKeys",$r);function Nn(x,E){if(!fe(x))throw new TypeError;return Q(E)||(E=je(E)),Ke(x,E)}e("getOwnMetadataKeys",Nn);function Ln(x,E,R){if(!fe(E))throw new TypeError;if(Q(R)||(R=je(R)),!fe(E))throw new TypeError;Q(R)||(R=je(R));var F=$e(E,R,!1);return Q(F)?!1:F.OrdinaryDeleteMetadata(x,E,R)}e("deleteMetadata",Ln);function mt(x,E){for(var R=x.length-1;R>=0;--R){var F=x[R],N=F(E);if(!Q(N)&&!Re(N)){if(!at(N))throw new TypeError;E=N}}return E}function Ge(x,E,R,F){for(var N=x.length-1;N>=0;--N){var he=x[N],ue=he(E,R,F);if(!Q(ue)&&!Re(ue)){if(!fe(ue))throw new TypeError;F=ue}}return F}function Bn(x,E,R){var F=bt(x,E,R);if(F)return!0;var N=De(E);return Re(N)?!1:Bn(x,N,R)}function bt(x,E,R){var F=$e(E,R,!1);return Q(F)?!1:Wn(F.OrdinaryHasOwnMetadata(x,E,R))}function jt(x,E,R){var F=bt(x,E,R);if(F)return Fn(x,E,R);var N=De(E);if(!Re(N))return jt(x,N,R)}function Fn(x,E,R){var F=$e(E,R,!1);if(!Q(F))return F.OrdinaryGetOwnMetadata(x,E,R)}function ze(x,E,R,F){var N=$e(R,F,!0);N.OrdinaryDefineOwnMetadata(x,E,R,F)}function et(x,E){var R=Ke(x,E),F=De(x);if(F===null)return R;var N=et(F,E);if(N.length<=0)return R;if(R.length<=0)return N;for(var he=new pe,ue=[],J=0,T=R;J<T.length;J++){var V=T[J],G=he.has(V);G||(he.add(V),ue.push(V))}for(var z=0,ee=N;z<ee.length;z++){var V=ee[z],G=he.has(V);G||(he.add(V),ue.push(V))}return ue}function Ke(x,E){var R=$e(x,E,!1);return R?R.OrdinaryOwnMetadataKeys(x,E):[]}function Nt(x){if(x===null)return 1;switch(typeof x){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return x===null?1:6;default:return 6}}function Q(x){return x===void 0}function Re(x){return x===null}function Kn(x){return typeof x=="symbol"}function fe(x){return typeof x=="object"?x!==null:typeof x=="function"}function ot(x,E){switch(Nt(x)){case 0:return x;case 1:return x;case 2:return x;case 3:return x;case 4:return x;case 5:return x}var R="string",F=Un(x,c);if(F!==void 0){var N=F.call(x,R);if(fe(N))throw new TypeError;return N}return en(x)}function en(x,E){var R,F;{var N=x.toString;if(ie(N)){var F=N.call(x);if(!fe(F))return F}var R=x.valueOf;if(ie(R)){var F=R.call(x);if(!fe(F))return F}}throw new TypeError}function Wn(x){return!!x}function H(x){return""+x}function je(x){var E=ot(x);return Kn(E)?E:H(E)}function wt(x){return Array.isArray?Array.isArray(x):x instanceof Object?x instanceof Array:Object.prototype.toString.call(x)==="[object Array]"}function ie(x){return typeof x=="function"}function at(x){return typeof x=="function"}function Vr(x){switch(Nt(x)){case 3:return!0;case 4:return!0;default:return!1}}function qe(x,E){return x===E||x!==x&&E!==E}function Un(x,E){var R=x[E];if(R!=null){if(!ie(R))throw new TypeError;return R}}function qn(x){var E=Un(x,d);if(!ie(E))throw new TypeError;var R=E.call(x);if(!fe(R))throw new TypeError;return R}function $n(x){return x.value}function Vn(x){var E=x.next();return E.done?!1:E}function Lt(x){var E=x.return;E&&E.call(x)}function De(x){var E=Object.getPrototypeOf(x);if(typeof x!="function"||x===$||E!==$)return E;var R=x.prototype,F=R&&Object.getPrototypeOf(R);if(F==null||F===Object.prototype)return E;var N=F.constructor;return typeof N!="function"||N===x?E:N}function Gn(){var x;!Q(_e)&&typeof r.Reflect<"u"&&!(_e in r.Reflect)&&typeof r.Reflect.defineMetadata=="function"&&(x=At(r.Reflect));var E,R,F,N=new ve,he={registerProvider:ue,getProvider:T,setProvider:G};return he;function ue(z){if(!Object.isExtensible(he))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case x===z:break;case Q(E):E=z;break;case E===z:break;case Q(R):R=z;break;case R===z:break;default:F===void 0&&(F=new pe),F.add(z);break}}function J(z,ee){if(!Q(E)){if(E.isProviderFor(z,ee))return E;if(!Q(R)){if(R.isProviderFor(z,ee))return E;if(!Q(F))for(var se=qn(F);;){var ge=Vn(se);if(!ge)return;var Ne=$n(ge);if(Ne.isProviderFor(z,ee))return Lt(se),Ne}}}if(!Q(x)&&x.isProviderFor(z,ee))return x}function T(z,ee){var se=N.get(z),ge;return Q(se)||(ge=se.get(ee)),Q(ge)&&(ge=J(z,ee),Q(ge)||(Q(se)&&(se=new Y,N.set(z,se)),se.set(ee,ge))),ge}function V(z){if(Q(z))throw new TypeError;return E===z||R===z||!Q(F)&&F.has(z)}function G(z,ee,se){if(!V(se))throw new Error("Metadata provider not registered.");var ge=T(z,ee);if(ge!==se){if(!Q(ge))return!1;var Ne=N.get(z);Q(Ne)&&(Ne=new Y,N.set(z,Ne)),Ne.set(ee,se)}return!0}}function _t(){var x;return!Q(_e)&&fe(r.Reflect)&&Object.isExtensible(r.Reflect)&&(x=r.Reflect[_e]),Q(x)&&(x=Gn()),!Q(_e)&&fe(r.Reflect)&&Object.isExtensible(r.Reflect)&&Object.defineProperty(r.Reflect,_e,{enumerable:!1,configurable:!1,writable:!1,value:x}),x}function zn(x){var E=new ve,R={isProviderFor:function(V,G){var z=E.get(V);return Q(z)?!1:z.has(G)},OrdinaryDefineOwnMetadata:ue,OrdinaryHasOwnMetadata:N,OrdinaryGetOwnMetadata:he,OrdinaryOwnMetadataKeys:J,OrdinaryDeleteMetadata:T};return Ze.registerProvider(R),R;function F(V,G,z){var ee=E.get(V),se=!1;if(Q(ee)){if(!z)return;ee=new Y,E.set(V,ee),se=!0}var ge=ee.get(G);if(Q(ge)){if(!z)return;if(ge=new Y,ee.set(G,ge),!x.setProvider(V,G,R))throw ee.delete(G),se&&E.delete(V),new Error("Wrong provider for target.")}return ge}function N(V,G,z){var ee=F(G,z,!1);return Q(ee)?!1:Wn(ee.has(V))}function he(V,G,z){var ee=F(G,z,!1);if(!Q(ee))return ee.get(V)}function ue(V,G,z,ee){var se=F(z,ee,!0);se.set(V,G)}function J(V,G){var z=[],ee=F(V,G,!1);if(Q(ee))return z;for(var se=ee.keys(),ge=qn(se),Ne=0;;){var tt=Vn(ge);if(!tt)return z.length=Ne,z;var ut=$n(tt);try{z[Ne]=ut}catch(rn){try{Lt(ge)}finally{throw rn}}Ne++}}function T(V,G,z){var ee=F(G,z,!1);if(Q(ee)||!ee.delete(V))return!1;if(ee.size===0){var se=E.get(G);Q(se)||(se.delete(z),se.size===0&&E.delete(se))}return!0}}function At(x){var E=x.defineMetadata,R=x.hasOwnMetadata,F=x.getOwnMetadata,N=x.getOwnMetadataKeys,he=x.deleteMetadata,ue=new ve,J={isProviderFor:function(T,V){var G=ue.get(T);return!Q(G)&&G.has(V)?!0:N(T,V).length?(Q(G)&&(G=new pe,ue.set(T,G)),G.add(V),!0):!1},OrdinaryDefineOwnMetadata:E,OrdinaryHasOwnMetadata:R,OrdinaryGetOwnMetadata:F,OrdinaryOwnMetadataKeys:N,OrdinaryDeleteMetadata:he};return J}function $e(x,E,R){var F=Ze.getProvider(x,E);if(!Q(F))return F;if(R){if(Ze.setProvider(x,E,Mt))return Mt;throw new Error("Illegal state.")}}function tn(){var x={},E=[],R=function(){function J(T,V,G){this._index=0,this._keys=T,this._values=V,this._selector=G}return J.prototype["@@iterator"]=function(){return this},J.prototype[d]=function(){return this},J.prototype.next=function(){var T=this._index;if(T>=0&&T<this._keys.length){var V=this._selector(this._keys[T],this._values[T]);return T+1>=this._keys.length?(this._index=-1,this._keys=E,this._values=E):this._index++,{value:V,done:!1}}return{value:void 0,done:!0}},J.prototype.throw=function(T){throw this._index>=0&&(this._index=-1,this._keys=E,this._values=E),T},J.prototype.return=function(T){return this._index>=0&&(this._index=-1,this._keys=E,this._values=E),{value:T,done:!0}},J}(),F=function(){function J(){this._keys=[],this._values=[],this._cacheKey=x,this._cacheIndex=-2}return Object.defineProperty(J.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),J.prototype.has=function(T){return this._find(T,!1)>=0},J.prototype.get=function(T){var V=this._find(T,!1);return V>=0?this._values[V]:void 0},J.prototype.set=function(T,V){var G=this._find(T,!0);return this._values[G]=V,this},J.prototype.delete=function(T){var V=this._find(T,!1);if(V>=0){for(var G=this._keys.length,z=V+1;z<G;z++)this._keys[z-1]=this._keys[z],this._values[z-1]=this._values[z];return this._keys.length--,this._values.length--,qe(T,this._cacheKey)&&(this._cacheKey=x,this._cacheIndex=-2),!0}return!1},J.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=x,this._cacheIndex=-2},J.prototype.keys=function(){return new R(this._keys,this._values,N)},J.prototype.values=function(){return new R(this._keys,this._values,he)},J.prototype.entries=function(){return new R(this._keys,this._values,ue)},J.prototype["@@iterator"]=function(){return this.entries()},J.prototype[d]=function(){return this.entries()},J.prototype._find=function(T,V){if(!qe(this._cacheKey,T)){this._cacheIndex=-1;for(var G=0;G<this._keys.length;G++)if(qe(this._keys[G],T)){this._cacheIndex=G;break}}return this._cacheIndex<0&&V&&(this._cacheIndex=this._keys.length,this._keys.push(T),this._values.push(void 0)),this._cacheIndex},J}();return F;function N(J,T){return J}function he(J,T){return T}function ue(J,T){return[J,T]}}function Ct(){var x=function(){function E(){this._map=new Y}return Object.defineProperty(E.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),E.prototype.has=function(R){return this._map.has(R)},E.prototype.add=function(R){return this._map.set(R,R),this},E.prototype.delete=function(R){return this._map.delete(R)},E.prototype.clear=function(){this._map.clear()},E.prototype.keys=function(){return this._map.keys()},E.prototype.values=function(){return this._map.keys()},E.prototype.entries=function(){return this._map.entries()},E.prototype["@@iterator"]=function(){return this.keys()},E.prototype[d]=function(){return this.keys()},E}();return x}function nn(){var x=16,E=j.create(),R=F();return function(){function T(){this._key=F()}return T.prototype.has=function(V){var G=N(V,!1);return G!==void 0?j.has(G,this._key):!1},T.prototype.get=function(V){var G=N(V,!1);return G!==void 0?j.get(G,this._key):void 0},T.prototype.set=function(V,G){var z=N(V,!0);return z[this._key]=G,this},T.prototype.delete=function(V){var G=N(V,!1);return G!==void 0?delete G[this._key]:!1},T.prototype.clear=function(){this._key=F()},T}();function F(){var T;do T="@@WeakMap@@"+J();while(j.has(E,T));return E[T]=!0,T}function N(T,V){if(!a.call(T,R)){if(!V)return;Object.defineProperty(T,R,{value:j.create()})}return T[R]}function he(T,V){for(var G=0;G<V;++G)T[G]=Math.random()*255|0;return T}function ue(T){if(typeof Uint8Array=="function"){var V=new Uint8Array(T);return typeof crypto<"u"?crypto.getRandomValues(V):typeof msCrypto<"u"?msCrypto.getRandomValues(V):he(V,T),V}return he(new Array(T),T)}function J(){var T=ue(x);T[6]=T[6]&79|64,T[8]=T[8]&191|128;for(var V="",G=0;G<x;++G){var z=T[G];(G===4||G===6||G===8)&&(V+="-"),z<16&&(V+="0"),V+=z.toString(16).toLowerCase()}return V}}function st(x){return x.__=void 0,delete x.__,x}})})(so||(so={}));var Ds=Object.defineProperty,Ms=Object.getOwnPropertyDescriptor,Rs=(n,e,r,a)=>{for(var s=a>1?void 0:a?Ms(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&Ds(e,r,s),s};let Pr=class{constructor(){this.name="component.name",this.hint="default",this.priority=1e3,this.singleton=!1}getName(){return this.name}getHint(){return this.hint}getPriority(){return this.priority}isSingleton(){return this.singleton}};Pr=Rs([xe()],Pr);class js{constructor(e,r,a){this.name=e,this.entryFile=r,this.staticModule=a}}var Ns=Object.defineProperty,Ls=Object.getOwnPropertyDescriptor,Bs=(n,e,r,a)=>{for(var s=a>1?void 0:a?Ls(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&Ns(e,r,s),s},Fs=(n,e)=>(r,a)=>e(r,a,n);let Er=class extends Pr{constructor(n){super(),this.remoteExtensions=new Map,this.remoteExtensionDefaultURL="/apps/",this.remoteExtensionDefaultEntryFile="main.bundle.js",this.logger=n,this.logger.setModule("extensionmanager.components.defaultExtensionManager")}addRemoteExtension(n,e,r){this.remoteExtensions.set(n,new js(n,e,r))}setRemoteExtensionsConfig(n,e){this.remoteExtensionDefaultURL=n,this.remoteExtensionDefaultEntryFile=e}async loadExtension(n,e){try{const r=this.remoteExtensions.get(n),a=r&&r.entryFile?r.entryFile:this.remoteExtensionDefaultEntryFile,s=this.remoteExtensionDefaultURL+n+"/"+a,c=this.remoteExtensionDefaultURL+n+"/style.css";this.logger?.debug("Ready to import ",s);try{const O=await import(c);document.adoptedStyleSheets=[O.default]}catch{}const d=await import(s);if(d!=null){this.logger?.debug("Found components Init for ",n,d);const O=d.ComponentInit;new O(e),this.logger?.debug("Succesfull components Init for ",n)}else this.logger?.debug("No components to load for ",n);return}catch(r){this.logger?.error("Exception while loading components from ",n,r)}}async loadExtensions(n){for(const e of this.remoteExtensions.keys())await this.loadExtension(e,n)}};Er=Bs([xe(),Fs(0,we("Logger"))],Er);let Ks=class{constructor(e){this.logger=e.get("Logger"),this.logger.setModule("extensionmanager.components.componentsInit"),this.logger?.debug("Init Extension Manager components begin"),e.bind("ExtensionManager").to(Er),this.logger?.debug("Init Extension Manager components end")}};class Tr{constructor(e){this.jsonld=e}getIdentifier(){return this.jsonld.identifier}setIdentifier(e){this.jsonld.identifier=e}getName(){return this.jsonld.name}setName(e){this.jsonld.name=e}getText(){return this.jsonld.text}setText(e){this.jsonld.text=e}get(e){return this.jsonld[e]}set(e,r){this.jsonld[e]=r}getSource(){return this.jsonld}}class Dt{constructor(e="",r="",a="",s=""){this.document=new Tr({}),this.source=a,this.syntax=s,this.html="",this.name=r,this.id=e,this.css=[],this.js=[],this.version=""}toObject(){return{id:this.id,name:this.name,source:this.source,syntax:this.syntax,html:this.html,document:this.document.getSource(),css:this.css,js:this.js,version:this.version}}fromObject(e){this.id=e.id,this.name=e.name,this.source=e.source,this.syntax=e.syntax,this.html=e.html,this.document=new Tr(e.document),this.css=e.css,this.js=e.js,this.version=e.version}}var Ws=Object.defineProperty,Us=Object.getOwnPropertyDescriptor,qs=(n,e,r,a)=>{for(var s=a>1?void 0:a?Us(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&Ws(e,r,s),s},$s=(n,e)=>(r,a)=>e(r,a,n);let Xt=class{constructor(n){this.logger=n,this.logger.setModule("storage.components.defaultWikiStorage"),this.offlineSetup=!1}setConfig(n,e,r,a,s,c,d){this.name=n,this.baseURL=e,this.baseRestURL=r,this.homePage=a,this.serverRendering=s,this.designSystem=c,this.offline=d}setConfigFromObject(n){this.name=n.name,this.baseURL=n.baseURL,this.baseRestURL=n.baseRestURL,this.homePage=n.homePage,this.serverRendering=n.serverRendering,this.offline=n.offline,this.designSystem=n.designSystem}setupOfflineStorage(){if(this.logger.debug("Checking offline storage"),this.offline&&this.cristal){this.logger.debug("Looking for wrapping offline storage");const n=this.cristal.getContainer().get("WrappingStorage");n?(this.logger.debug("Offline local storage is ready"),n.setStorage(this.storage),n.setWikiConfig(this.storage.getWikiConfig()),this.storage=n):this.logger.debug("Failed Looking for wrapping offline storage")}else this.cristal||this.logger.debug("Cristal not initialized"),this.offline||this.logger.debug("Offline mode not activated")}isSupported(n){return n=="html"}initialize(){this.offline&&!this.offlineSetup&&(this.setupOfflineStorage(),this.offlineSetup=!0,this.storage.isStorageReady())}defaultPageName(){return"index"}getType(){return"Default"}};Xt=qs([xe(),$s(0,we("Logger"))],Xt);var Vs=Object.defineProperty,Gs=Object.getOwnPropertyDescriptor,uo=(n,e,r,a)=>{for(var s=a>1?void 0:a?Gs(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&Vs(e,r,s),s};let Jt=class{setModule(n){this.module=n}debug(...n){(!this.loggerConfig||this.loggerConfig.hasLevelId(this.module,4))&&n.unshift(this.module+":"),console.debug.apply(null,n)}info(...n){n.unshift(this.module+":"),console.info.apply(null,n)}warn(...n){n.unshift(this.module+":"),console.warn.apply(null,n)}error(...n){n.unshift(this.module+":"),console.error.apply(null,n)}};uo([we("LoggerConfig")],Jt.prototype,"loggerConfig",2),Jt=uo([xe()],Jt);var zs=Object.defineProperty,Hs=Object.getOwnPropertyDescriptor,Ys=(n,e,r,a)=>{for(var s=a>1?void 0:a?Hs(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&zs(e,r,s),s};let kr=class{constructor(n="error"){this.levels=new Map,this.config=new Map,this.defaultLevel=n,this.computedConfig=new Map,this.levels.set("error",1),this.levels.set("warn",2),this.levels.set("info",3),this.levels.set("debug",4)}addLevel(n,e){const r=this.levels.get(e);r!=null&&this.config.forEach(a=>{if(a.startsWith(n)){const s=this.computedConfig.get(a);(s==null||r&&r>s)&&r&&this.computedConfig.set(a,r)}})}getLevels(){return this.config}getLevel(n){let e=this.config.get(n);return e||(e=this.defaultLevel),e}getLevelId(n){const e=this.levels.get(n);return e||10}setDefaultLevel(n){this.defaultLevel=n,this.defaultLevelId=this.getLevelId(this.defaultLevel)}getDefaultLevel(){return this.defaultLevel}getDefaultLevelId(){return this.defaultLevelId?this.defaultLevelId:(this.defaultLevelId=this.getLevelId(this.defaultLevel),this.defaultLevelId)}hasLevel(n,e){let r=this.computedConfig.get(n);r||(r=this.getDefaultLevelId());const a=this.getLevelId(e);return!!(a&&r>=a)}hasLevelId(n,e){let r=this.computedConfig.get(n);r||(r=this.getDefaultLevelId());const a=e;return!!(a&&r>=a)}};kr=Ys([xe()],kr);class Qs{constructor(e){this.extensionList=e}getLogger(e){let r=this.container.get("Logger");return r||(r=new Jt),r.setModule(e),r}async loadExtensionManager(e){const r="extension-manager",a="/apps/"+r+"/main.bundle.dev.js";try{if(e)this.logger?.debug("Loading static extension Manager"),new Ks(this.container);else{this.logger?.debug("Dynamic extension Manager. Ready to import ",a);const s=await import(a);if(s!=null){this.logger?.debug("Found components Init for ",r,s);const c=s.ComponentInit;new c(this.container),this.logger?.debug("Succesfull components Init for ",r)}else this.logger?.debug("No components to load for ",r)}}catch(s){this.logger?.error("Exception while loading extension Manager from ",a,s)}}async loadExtensions(e,r){this.logger?.debug("Start app"),await this.loadExtensionManager(e);const a=this.container.get("ExtensionManager");if(this.logger?.debug("Extension Manager is ",a),a!=null){if(!r){a.setRemoteExtensionsConfig("/apps/","main.bundle.dev.js");for(const s in this.extensionList)a.addRemoteExtension(s,"",!0);await a.loadExtensions(this.container)}this.logger?.debug("After extensions loading")}else this.logger?.debug("Could not start extension Manager");return a}initializeContainer(){this.container=new Cs,this.container.bind("LoggerConfig").to(kr).inSingletonScope(),this.container.bind("Logger").to(Jt);const e=this.container.get("LoggerConfig");e&&e.setDefaultLevel("debug"),this.logger=this.getLogger("index.ts"),this.logger?.info("Logging initialized")}getConfigFromPathName(e){let r="";if(e.startsWith("/")){const a=e.indexOf("/",1);a!=-1&&(r=e.substring(1,a))}return(r==null||r=="")&&(r="XWiki"),r}}var co={exports:{}};(function(n,e){(function(r,a){n.exports=a()})(Tn,function(){var r=function(t,i){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,u){o.__proto__=u}||function(o,u){for(var l in u)Object.prototype.hasOwnProperty.call(u,l)&&(o[l]=u[l])})(t,i)},a=function(){return(a=Object.assign||function(t){for(var i,o=1,u=arguments.length;o<u;o++)for(var l in i=arguments[o])Object.prototype.hasOwnProperty.call(i,l)&&(t[l]=i[l]);return t}).apply(this,arguments)};function s(t,i,o){for(var u,l=0,f=i.length;l<f;l++)!u&&l in i||((u=u||Array.prototype.slice.call(i,0,l))[l]=i[l]);return t.concat(u||Array.prototype.slice.call(i))}var c=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Tn,d=Object.keys,O=Array.isArray;function M(t,i){return typeof i!="object"||d(i).forEach(function(o){t[o]=i[o]}),t}typeof Promise>"u"||c.Promise||(c.Promise=Promise);var y=Object.getPrototypeOf,j={}.hasOwnProperty;function $(t,i){return j.call(t,i)}function Y(t,i){typeof i=="function"&&(i=i(y(t))),(typeof Reflect>"u"?d:Reflect.ownKeys)(i).forEach(function(o){ve(t,o,i[o])})}var pe=Object.defineProperty;function ve(t,i,o,u){pe(t,i,M(o&&$(o,"get")&&typeof o.get=="function"?{get:o.get,set:o.set,configurable:!0}:{value:o,configurable:!0,writable:!0},u))}function _e(t){return{from:function(i){return t.prototype=Object.create(i.prototype),ve(t.prototype,"constructor",t),{extend:Y.bind(null,t.prototype)}}}}var Ze=Object.getOwnPropertyDescriptor,Mt=[].slice;function Rt(t,i,o){return Mt.call(t,i,o)}function Mn(t,i){return i(t)}function vt(t){if(!t)throw new Error("Assertion Failed")}function Rn(t){c.setImmediate?setImmediate(t):setTimeout(t,0)}function Ue(t,i){if(typeof i=="string"&&$(t,i))return t[i];if(!i)return t;if(typeof i!="string"){for(var o=[],u=0,l=i.length;u<l;++u){var f=Ue(t,i[u]);o.push(f)}return o}var h=i.indexOf(".");if(h!==-1){var p=t[i.substr(0,h)];return p==null?void 0:Ue(p,i.substr(h+1))}}function Te(t,i,o){if(t&&i!==void 0&&!("isFrozen"in Object&&Object.isFrozen(t)))if(typeof i!="string"&&"length"in i){vt(typeof o!="string"&&"length"in o);for(var u=0,l=i.length;u<l;++u)Te(t,i[u],o[u])}else{var f,h,p=i.indexOf(".");p!==-1?(f=i.substr(0,p),(h=i.substr(p+1))===""?o===void 0?O(t)&&!isNaN(parseInt(f))?t.splice(f,1):delete t[f]:t[f]=o:Te(p=!(p=t[f])||!$(t,f)?t[f]={}:p,h,o)):o===void 0?O(t)&&!isNaN(parseInt(i))?t.splice(i,1):delete t[i]:t[i]=o}}function jn(t){var i,o={};for(i in t)$(t,i)&&(o[i]=t[i]);return o}var $r=[].concat;function Nn(t){return $r.apply([],t)}var rt="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(Nn([8,16,32,64].map(function(t){return["Int","Uint","Float"].map(function(i){return i+t+"Array"})}))).filter(function(t){return c[t]}),Ln=new Set(rt.map(function(t){return c[t]})),mt=null;function Ge(t){return mt=new WeakMap,t=function i(o){if(!o||typeof o!="object")return o;var u=mt.get(o);if(u)return u;if(O(o)){u=[],mt.set(o,u);for(var l=0,f=o.length;l<f;++l)u.push(i(o[l]))}else if(Ln.has(o.constructor))u=o;else{var h,p=y(o);for(h in u=p===Object.prototype?{}:Object.create(p),mt.set(o,u),o)$(o,h)&&(u[h]=i(o[h]))}return u}(t),mt=null,t}var Bn={}.toString;function bt(t){return Bn.call(t).slice(8,-1)}var jt=typeof Symbol<"u"?Symbol.iterator:"@@iterator",Fn=typeof jt=="symbol"?function(t){var i;return t!=null&&(i=t[jt])&&i.apply(t)}:function(){return null};function ze(t,i){return i=t.indexOf(i),0<=i&&t.splice(i,1),0<=i}var et={};function Ke(t){var i,o,u,l;if(arguments.length===1){if(O(t))return t.slice();if(this===et&&typeof t=="string")return[t];if(l=Fn(t)){for(o=[];!(u=l.next()).done;)o.push(u.value);return o}if(t==null)return[t];if(typeof(i=t.length)!="number")return[t];for(o=new Array(i);i--;)o[i]=t[i];return o}for(i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return o}var Nt=typeof Symbol<"u"?function(t){return t[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},At=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],We=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(At),Q={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function Re(t,i){this.name=t,this.message=i}function Kn(t,i){return t+". Errors: "+Object.keys(i).map(function(o){return i[o].toString()}).filter(function(o,u,l){return l.indexOf(o)===u}).join(`
25
+ `)}function fe(t,i,o,u){this.failures=i,this.failedKeys=u,this.successCount=o,this.message=Kn(t,i)}function ot(t,i){this.name="BulkError",this.failures=Object.keys(i).map(function(o){return i[o]}),this.failuresByPos=i,this.message=Kn(t,this.failures)}_e(Re).from(Error).extend({toString:function(){return this.name+": "+this.message}}),_e(fe).from(Re),_e(ot).from(Re);var en=We.reduce(function(t,i){return t[i]=i+"Error",t},{}),Wn=Re,H=We.reduce(function(t,i){var o=i+"Error";function u(l,f){this.name=o,l?typeof l=="string"?(this.message="".concat(l).concat(f?`
26
+ `+f:""),this.inner=f||null):typeof l=="object"&&(this.message="".concat(l.name," ").concat(l.message),this.inner=l):(this.message=Q[i]||o,this.inner=null)}return _e(u).from(Wn),t[i]=u,t},{});H.Syntax=SyntaxError,H.Type=TypeError,H.Range=RangeError;var je=At.reduce(function(t,i){return t[i+"Error"]=H[i],t},{}),wt=We.reduce(function(t,i){return["Syntax","Type","Range"].indexOf(i)===-1&&(t[i+"Error"]=H[i]),t},{});function ie(){}function at(t){return t}function Vr(t,i){return t==null||t===at?i:function(o){return i(t(o))}}function qe(t,i){return function(){t.apply(this,arguments),i.apply(this,arguments)}}function Un(t,i){return t===ie?i:function(){var o=t.apply(this,arguments);o!==void 0&&(arguments[0]=o);var u=this.onsuccess,l=this.onerror;this.onsuccess=null,this.onerror=null;var f=i.apply(this,arguments);return u&&(this.onsuccess=this.onsuccess?qe(u,this.onsuccess):u),l&&(this.onerror=this.onerror?qe(l,this.onerror):l),f!==void 0?f:o}}function qn(t,i){return t===ie?i:function(){t.apply(this,arguments);var o=this.onsuccess,u=this.onerror;this.onsuccess=this.onerror=null,i.apply(this,arguments),o&&(this.onsuccess=this.onsuccess?qe(o,this.onsuccess):o),u&&(this.onerror=this.onerror?qe(u,this.onerror):u)}}function $n(t,i){return t===ie?i:function(o){var u=t.apply(this,arguments);M(o,u);var l=this.onsuccess,f=this.onerror;return this.onsuccess=null,this.onerror=null,o=i.apply(this,arguments),l&&(this.onsuccess=this.onsuccess?qe(l,this.onsuccess):l),f&&(this.onerror=this.onerror?qe(f,this.onerror):f),u===void 0?o===void 0?void 0:o:M(u,o)}}function Vn(t,i){return t===ie?i:function(){return i.apply(this,arguments)!==!1&&t.apply(this,arguments)}}function Lt(t,i){return t===ie?i:function(){var o=t.apply(this,arguments);if(o&&typeof o.then=="function"){for(var u=this,l=arguments.length,f=new Array(l);l--;)f[l]=arguments[l];return o.then(function(){return i.apply(u,f)})}return i.apply(this,arguments)}}wt.ModifyError=fe,wt.DexieError=Re,wt.BulkError=ot;var De=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Gn(t){De=t}var _t={},zn=100,rt=typeof Promise>"u"?[]:function(){var t=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[t,y(t),t];var i=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[i,y(i),t]}(),At=rt[0],We=rt[1],rt=rt[2],We=We&&We.then,$e=At&&At.constructor,tn=!!rt,Ct=function(t,i){he.push([t,i]),st&&(queueMicrotask(Ne),st=!1)},nn=!0,st=!0,x=[],E=[],R=at,F={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:ie,pgp:!1,env:{},finalize:ie},N=F,he=[],ue=0,J=[];function T(t){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var i=this._PSD=N;if(typeof t!="function"){if(t!==_t)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&z(this,this._value))}this._state=null,this._value=null,++i.ref,function o(u,l){try{l(function(f){if(u._state===null){if(f===u)throw new TypeError("A promise cannot be resolved with itself.");var h=u._lib&&tt();f&&typeof f.then=="function"?o(u,function(p,b){f instanceof T?f._then(p,b):f.then(p,b)}):(u._state=!0,u._value=f,ee(u)),h&&ut()}},z.bind(null,u))}catch(f){z(u,f)}}(this,t)}var V={get:function(){var t=N,i=Xn;function o(u,l){var f=this,h=!t.global&&(t!==N||i!==Xn),p=h&&!lt(),b=new T(function(v,A){se(f,new G(po(u,t,h,p),po(l,t,h,p),v,A,t))});return this._consoleTask&&(b._consoleTask=this._consoleTask),b}return o.prototype=_t,o},set:function(t){ve(this,"then",t&&t.prototype===_t?V:{get:function(){return t},set:V.set})}};function G(t,i,o,u,l){this.onFulfilled=typeof t=="function"?t:null,this.onRejected=typeof i=="function"?i:null,this.resolve=o,this.reject=u,this.psd=l}function z(t,i){var o,u;E.push(i),t._state===null&&(o=t._lib&&tt(),i=R(i),t._state=!1,t._value=i,u=t,x.some(function(l){return l._value===u._value})||x.push(u),ee(t),o&&ut())}function ee(t){var i=t._listeners;t._listeners=[];for(var o=0,u=i.length;o<u;++o)se(t,i[o]);var l=t._PSD;--l.ref||l.finalize(),ue===0&&(++ue,Ct(function(){--ue==0&&rn()},[]))}function se(t,i){if(t._state!==null){var o=t._state?i.onFulfilled:i.onRejected;if(o===null)return(t._state?i.resolve:i.reject)(t._value);++i.psd.ref,++ue,Ct(ge,[o,t,i])}else t._listeners.push(i)}function ge(t,i,o){try{var u,l=i._value;!i._state&&E.length&&(E=[]),u=De&&i._consoleTask?i._consoleTask.run(function(){return t(l)}):t(l),i._state||E.indexOf(l)!==-1||function(f){for(var h=x.length;h;)if(x[--h]._value===f._value)return x.splice(h,1)}(i),o.resolve(u)}catch(f){o.reject(f)}finally{--ue==0&&rn(),--o.psd.ref||o.psd.finalize()}}function Ne(){St(F,function(){tt()&&ut()})}function tt(){var t=nn;return st=nn=!1,t}function ut(){var t,i,o;do for(;0<he.length;)for(t=he,he=[],o=t.length,i=0;i<o;++i){var u=t[i];u[0].apply(null,u[1])}while(0<he.length);st=nn=!0}function rn(){var t=x;x=[],t.forEach(function(u){u._PSD.onunhandled.call(null,u._value,u)});for(var i=J.slice(0),o=i.length;o;)i[--o]()}function Hn(t){return new T(_t,!1,t)}function de(t,i){var o=N;return function(){var u=tt(),l=N;try{return ft(o,!0),t.apply(this,arguments)}catch(f){i&&i(f)}finally{ft(l,!1),u&&ut()}}}Y(T.prototype,{then:V,_then:function(t,i){se(this,new G(null,null,t,i,N))},catch:function(t){if(arguments.length===1)return this.then(null,t);var i=t,o=arguments[1];return typeof i=="function"?this.then(null,function(u){return(u instanceof i?o:Hn)(u)}):this.then(null,function(u){return(u&&u.name===i?o:Hn)(u)})},finally:function(t){return this.then(function(i){return T.resolve(t()).then(function(){return i})},function(i){return T.resolve(t()).then(function(){return Hn(i)})})},timeout:function(t,i){var o=this;return t<1/0?new T(function(u,l){var f=setTimeout(function(){return l(new H.Timeout(i))},t);o.then(u,l).finally(clearTimeout.bind(null,f))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&ve(T.prototype,Symbol.toStringTag,"Dexie.Promise"),F.env=ho(),Y(T,{all:function(){var t=Ke.apply(null,arguments).map(Jn);return new T(function(i,o){t.length===0&&i([]);var u=t.length;t.forEach(function(l,f){return T.resolve(l).then(function(h){t[f]=h,--u||i(t)},o)})})},resolve:function(t){return t instanceof T?t:t&&typeof t.then=="function"?new T(function(i,o){t.then(i,o)}):new T(_t,!0,t)},reject:Hn,race:function(){var t=Ke.apply(null,arguments).map(Jn);return new T(function(i,o){t.map(function(u){return T.resolve(u).then(i,o)})})},PSD:{get:function(){return N},set:function(t){return N=t}},totalEchoes:{get:function(){return Xn}},newPSD:ct,usePSD:St,scheduler:{get:function(){return Ct},set:function(t){Ct=t}},rejectionMapper:{get:function(){return R},set:function(t){R=t}},follow:function(t,i){return new T(function(o,u){return ct(function(l,f){var h=N;h.unhandleds=[],h.onunhandled=f,h.finalize=qe(function(){var p,b=this;p=function(){b.unhandleds.length===0?l():f(b.unhandleds[0])},J.push(function v(){p(),J.splice(J.indexOf(v),1)}),++ue,Ct(function(){--ue==0&&rn()},[])},h.finalize),t()},i,o,u)})}}),$e&&($e.allSettled&&ve(T,"allSettled",function(){var t=Ke.apply(null,arguments).map(Jn);return new T(function(i){t.length===0&&i([]);var o=t.length,u=new Array(o);t.forEach(function(l,f){return T.resolve(l).then(function(h){return u[f]={status:"fulfilled",value:h}},function(h){return u[f]={status:"rejected",reason:h}}).then(function(){return--o||i(u)})})})}),$e.any&&typeof AggregateError<"u"&&ve(T,"any",function(){var t=Ke.apply(null,arguments).map(Jn);return new T(function(i,o){t.length===0&&o(new AggregateError([]));var u=t.length,l=new Array(u);t.forEach(function(f,h){return T.resolve(f).then(function(p){return i(p)},function(p){l[h]=p,--u||o(new AggregateError(l))})})})}));var Ae={awaits:0,echoes:0,id:0},Uu=0,Yn=[],Qn=0,Xn=0,qu=0;function ct(t,i,o,u){var l=N,f=Object.create(l);return f.parent=l,f.ref=0,f.global=!1,f.id=++qu,F.env,f.env=tn?{Promise:T,PromiseProp:{value:T,configurable:!0,writable:!0},all:T.all,race:T.race,allSettled:T.allSettled,any:T.any,resolve:T.resolve,reject:T.reject}:{},i&&M(f,i),++l.ref,f.finalize=function(){--this.parent.ref||this.parent.finalize()},u=St(f,t,o,u),f.ref===0&&f.finalize(),u}function Bt(){return Ae.id||(Ae.id=++Uu),++Ae.awaits,Ae.echoes+=zn,Ae.id}function lt(){return!!Ae.awaits&&(--Ae.awaits==0&&(Ae.id=0),Ae.echoes=Ae.awaits*zn,!0)}function Jn(t){return Ae.echoes&&t&&t.constructor===$e?(Bt(),t.then(function(i){return lt(),i},function(i){return lt(),me(i)})):t}function $u(){var t=Yn[Yn.length-1];Yn.pop(),ft(t,!1)}function ft(t,i){var o,u=N;(i?!Ae.echoes||Qn++&&t===N:!Qn||--Qn&&t===N)||queueMicrotask(i?function(l){++Xn,Ae.echoes&&--Ae.echoes!=0||(Ae.echoes=Ae.awaits=Ae.id=0),Yn.push(N),ft(l,!0)}.bind(null,t):$u),t!==N&&(N=t,u===F&&(F.env=ho()),tn&&(o=F.env.Promise,i=t.env,(u.global||t.global)&&(Object.defineProperty(c,"Promise",i.PromiseProp),o.all=i.all,o.race=i.race,o.resolve=i.resolve,o.reject=i.reject,i.allSettled&&(o.allSettled=i.allSettled),i.any&&(o.any=i.any))))}function ho(){var t=c.Promise;return tn?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(c,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject}:{}}function St(t,i,o,u,l){var f=N;try{return ft(t,!0),i(o,u,l)}finally{ft(f,!1)}}function po(t,i,o,u){return typeof t!="function"?t:function(){var l=N;o&&Bt(),ft(i,!0);try{return t.apply(this,arguments)}finally{ft(l,!1),u&&queueMicrotask(lt)}}}function Gr(t){Promise===$e&&Ae.echoes===0?Qn===0?t():enqueueNativeMicroTask(t):setTimeout(t,0)}(""+We).indexOf("[native code]")===-1&&(Bt=lt=ie);var me=T.reject,xt="￿",nt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",go="String expected.",Ft=[],Zn="__dbnames",zr="readonly",Hr="readwrite";function Ot(t,i){return t?i?function(){return t.apply(this,arguments)&&i.apply(this,arguments)}:t:i}var yo={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function er(t){return typeof t!="string"||/\./.test(t)?function(i){return i}:function(i){return i[t]===void 0&&t in i&&delete(i=Ge(i))[t],i}}function vo(){throw H.Type()}function ae(t,i){try{var o=mo(t),u=mo(i);if(o!==u)return o==="Array"?1:u==="Array"?-1:o==="binary"?1:u==="binary"?-1:o==="string"?1:u==="string"?-1:o==="Date"?1:u!=="Date"?NaN:-1;switch(o){case"number":case"Date":case"string":return i<t?1:t<i?-1:0;case"binary":return function(l,f){for(var h=l.length,p=f.length,b=h<p?h:p,v=0;v<b;++v)if(l[v]!==f[v])return l[v]<f[v]?-1:1;return h===p?0:h<p?-1:1}(bo(t),bo(i));case"Array":return function(l,f){for(var h=l.length,p=f.length,b=h<p?h:p,v=0;v<b;++v){var A=ae(l[v],f[v]);if(A!==0)return A}return h===p?0:h<p?-1:1}(t,i)}}catch{}return NaN}function mo(t){var i=typeof t;return i!="object"?i:ArrayBuffer.isView(t)?"binary":(t=bt(t),t==="ArrayBuffer"?"binary":t)}function bo(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)}var wo=(le.prototype._trans=function(t,i,o){var u=this._tx||N.trans,l=this.name,f=De&&typeof console<"u"&&console.createTask&&console.createTask("Dexie: ".concat(t==="readonly"?"read":"write"," ").concat(this.name));function h(v,A,g){if(!g.schema[l])throw new H.NotFound("Table "+l+" not part of transaction");return i(g.idbtrans,g)}var p=tt();try{var b=u&&u.db._novip===this.db._novip?u===N.trans?u._promise(t,h,o):ct(function(){return u._promise(t,h,o)},{trans:u,transless:N.transless||N}):function v(A,g,C,m){if(A.idbdb&&(A._state.openComplete||N.letThrough||A._vip)){var _=A._createTransaction(g,C,A._dbSchema);try{_.create(),A._state.PR1398_maxLoop=3}catch(S){return S.name===en.InvalidState&&A.isOpen()&&0<--A._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),A.close({disableAutoOpen:!1}),A.open().then(function(){return v(A,g,C,m)})):me(S)}return _._promise(g,function(S,w){return ct(function(){return N.trans=_,m(S,w,_)})}).then(function(S){if(g==="readwrite")try{_.idbtrans.commit()}catch{}return g==="readonly"?S:_._completion.then(function(){return S})})}if(A._state.openComplete)return me(new H.DatabaseClosed(A._state.dbOpenError));if(!A._state.isBeingOpened){if(!A._state.autoOpen)return me(new H.DatabaseClosed);A.open().catch(ie)}return A._state.dbReadyPromise.then(function(){return v(A,g,C,m)})}(this.db,t,[this.name],h);return f&&(b._consoleTask=f,b=b.catch(function(v){return console.trace(v),me(v)})),b}finally{p&&ut()}},le.prototype.get=function(t,i){var o=this;return t&&t.constructor===Object?this.where(t).first(i):t==null?me(new H.Type("Invalid argument to Table.get()")):this._trans("readonly",function(u){return o.core.get({trans:u,key:t}).then(function(l){return o.hook.reading.fire(l)})}).then(i)},le.prototype.where=function(t){if(typeof t=="string")return new this.db.WhereClause(this,t);if(O(t))return new this.db.WhereClause(this,"[".concat(t.join("+"),"]"));var i=d(t);if(i.length===1)return this.where(i[0]).equals(t[i[0]]);var o=this.schema.indexes.concat(this.schema.primKey).filter(function(b){if(b.compound&&i.every(function(A){return 0<=b.keyPath.indexOf(A)})){for(var v=0;v<i.length;++v)if(i.indexOf(b.keyPath[v])===-1)return!1;return!0}return!1}).sort(function(b,v){return b.keyPath.length-v.keyPath.length})[0];if(o&&this.db._maxKey!==xt){var h=o.keyPath.slice(0,i.length);return this.where(h).equals(h.map(function(v){return t[v]}))}!o&&De&&console.warn("The query ".concat(JSON.stringify(t)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(i.join("+"),"]"));var u=this.schema.idxByName,l=this.db._deps.indexedDB;function f(b,v){return l.cmp(b,v)===0}var p=i.reduce(function(C,v){var A=C[0],g=C[1],C=u[v],m=t[v];return[A||C,A||!C?Ot(g,C&&C.multi?function(_){return _=Ue(_,v),O(_)&&_.some(function(S){return f(m,S)})}:function(_){return f(m,Ue(_,v))}):g]},[null,null]),h=p[0],p=p[1];return h?this.where(h.name).equals(t[h.keyPath]).filter(p):o?this.filter(p):this.where(i).equals("")},le.prototype.filter=function(t){return this.toCollection().and(t)},le.prototype.count=function(t){return this.toCollection().count(t)},le.prototype.offset=function(t){return this.toCollection().offset(t)},le.prototype.limit=function(t){return this.toCollection().limit(t)},le.prototype.each=function(t){return this.toCollection().each(t)},le.prototype.toArray=function(t){return this.toCollection().toArray(t)},le.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},le.prototype.orderBy=function(t){return new this.db.Collection(new this.db.WhereClause(this,O(t)?"[".concat(t.join("+"),"]"):t))},le.prototype.reverse=function(){return this.toCollection().reverse()},le.prototype.mapToClass=function(t){var i,o=this.db,u=this.name;function l(){return i!==null&&i.apply(this,arguments)||this}(this.schema.mappedClass=t).prototype instanceof vo&&(function(b,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");function A(){this.constructor=b}r(b,v),b.prototype=v===null?Object.create(v):(A.prototype=v.prototype,new A)}(l,i=t),Object.defineProperty(l.prototype,"db",{get:function(){return o},enumerable:!1,configurable:!0}),l.prototype.table=function(){return u},t=l);for(var f=new Set,h=t.prototype;h;h=y(h))Object.getOwnPropertyNames(h).forEach(function(b){return f.add(b)});function p(b){if(!b)return b;var v,A=Object.create(t.prototype);for(v in b)if(!f.has(v))try{A[v]=b[v]}catch{}return A}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=p,this.hook("reading",p),t},le.prototype.defineClass=function(){return this.mapToClass(function(t){M(this,t)})},le.prototype.add=function(t,i){var o=this,u=this.schema.primKey,l=u.auto,f=u.keyPath,h=t;return f&&l&&(h=er(f)(t)),this._trans("readwrite",function(p){return o.core.mutate({trans:p,type:"add",keys:i!=null?[i]:null,values:[h]})}).then(function(p){return p.numFailures?T.reject(p.failures[0]):p.lastResult}).then(function(p){if(f)try{Te(t,f,p)}catch{}return p})},le.prototype.update=function(t,i){return typeof t!="object"||O(t)?this.where(":id").equals(t).modify(i):(t=Ue(t,this.schema.primKey.keyPath),t===void 0?me(new H.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(t).modify(i))},le.prototype.put=function(t,i){var o=this,u=this.schema.primKey,l=u.auto,f=u.keyPath,h=t;return f&&l&&(h=er(f)(t)),this._trans("readwrite",function(p){return o.core.mutate({trans:p,type:"put",values:[h],keys:i!=null?[i]:null})}).then(function(p){return p.numFailures?T.reject(p.failures[0]):p.lastResult}).then(function(p){if(f)try{Te(t,f,p)}catch{}return p})},le.prototype.delete=function(t){var i=this;return this._trans("readwrite",function(o){return i.core.mutate({trans:o,type:"delete",keys:[t]})}).then(function(o){return o.numFailures?T.reject(o.failures[0]):void 0})},le.prototype.clear=function(){var t=this;return this._trans("readwrite",function(i){return t.core.mutate({trans:i,type:"deleteRange",range:yo})}).then(function(i){return i.numFailures?T.reject(i.failures[0]):void 0})},le.prototype.bulkGet=function(t){var i=this;return this._trans("readonly",function(o){return i.core.getMany({keys:t,trans:o}).then(function(u){return u.map(function(l){return i.hook.reading.fire(l)})})})},le.prototype.bulkAdd=function(t,i,o){var u=this,l=Array.isArray(i)?i:void 0,f=(o=o||(l?void 0:i))?o.allKeys:void 0;return this._trans("readwrite",function(h){var v=u.schema.primKey,p=v.auto,v=v.keyPath;if(v&&l)throw new H.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(l&&l.length!==t.length)throw new H.InvalidArgument("Arguments objects and keys must have the same length");var b=t.length,v=v&&p?t.map(er(v)):t;return u.core.mutate({trans:h,type:"add",keys:l,values:v,wantResults:f}).then(function(_){var g=_.numFailures,C=_.results,m=_.lastResult,_=_.failures;if(g===0)return f?C:m;throw new ot("".concat(u.name,".bulkAdd(): ").concat(g," of ").concat(b," operations failed"),_)})})},le.prototype.bulkPut=function(t,i,o){var u=this,l=Array.isArray(i)?i:void 0,f=(o=o||(l?void 0:i))?o.allKeys:void 0;return this._trans("readwrite",function(h){var v=u.schema.primKey,p=v.auto,v=v.keyPath;if(v&&l)throw new H.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(l&&l.length!==t.length)throw new H.InvalidArgument("Arguments objects and keys must have the same length");var b=t.length,v=v&&p?t.map(er(v)):t;return u.core.mutate({trans:h,type:"put",keys:l,values:v,wantResults:f}).then(function(_){var g=_.numFailures,C=_.results,m=_.lastResult,_=_.failures;if(g===0)return f?C:m;throw new ot("".concat(u.name,".bulkPut(): ").concat(g," of ").concat(b," operations failed"),_)})})},le.prototype.bulkUpdate=function(t){var i=this,o=this.core,u=t.map(function(h){return h.key}),l=t.map(function(h){return h.changes}),f=[];return this._trans("readwrite",function(h){return o.getMany({trans:h,keys:u,cache:"clone"}).then(function(p){var b=[],v=[];t.forEach(function(g,C){var m=g.key,_=g.changes,S=p[C];if(S){for(var w=0,P=Object.keys(_);w<P.length;w++){var k=P[w],I=_[k];if(k===i.schema.primKey.keyPath){if(ae(I,m)!==0)throw new H.Constraint("Cannot update primary key in bulkUpdate()")}else Te(S,k,I)}f.push(C),b.push(m),v.push(S)}});var A=b.length;return o.mutate({trans:h,type:"put",keys:b,values:v,updates:{keys:u,changeSpecs:l}}).then(function(g){var C=g.numFailures,m=g.failures;if(C===0)return A;for(var _=0,S=Object.keys(m);_<S.length;_++){var w,P=S[_],k=f[Number(P)];k!=null&&(w=m[P],delete m[P],m[k]=w)}throw new ot("".concat(i.name,".bulkUpdate(): ").concat(C," of ").concat(A," operations failed"),m)})})})},le.prototype.bulkDelete=function(t){var i=this,o=t.length;return this._trans("readwrite",function(u){return i.core.mutate({trans:u,type:"delete",keys:t})}).then(function(h){var l=h.numFailures,f=h.lastResult,h=h.failures;if(l===0)return f;throw new ot("".concat(i.name,".bulkDelete(): ").concat(l," of ").concat(o," operations failed"),h)})},le);function le(){}function on(t){function i(h,p){if(p){for(var b=arguments.length,v=new Array(b-1);--b;)v[b-1]=arguments[b];return o[h].subscribe.apply(null,v),t}if(typeof h=="string")return o[h]}var o={};i.addEventType=f;for(var u=1,l=arguments.length;u<l;++u)f(arguments[u]);return i;function f(h,p,b){if(typeof h!="object"){var v;p=p||Vn;var A={subscribers:[],fire:b=b||ie,subscribe:function(g){A.subscribers.indexOf(g)===-1&&(A.subscribers.push(g),A.fire=p(A.fire,g))},unsubscribe:function(g){A.subscribers=A.subscribers.filter(function(C){return C!==g}),A.fire=A.subscribers.reduce(p,b)}};return o[h]=i[h]=A}d(v=h).forEach(function(g){var C=v[g];if(O(C))f(g,v[g][0],v[g][1]);else{if(C!=="asap")throw new H.InvalidArgument("Invalid event config");var m=f(g,at,function(){for(var _=arguments.length,S=new Array(_);_--;)S[_]=arguments[_];m.subscribers.forEach(function(w){Rn(function(){w.apply(null,S)})})})}})}}function an(t,i){return _e(i).from({prototype:t}),i}function Kt(t,i){return!(t.filter||t.algorithm||t.or)&&(i?t.justLimit:!t.replayFilter)}function Yr(t,i){t.filter=Ot(t.filter,i)}function Qr(t,i,o){var u=t.replayFilter;t.replayFilter=u?function(){return Ot(u(),i())}:i,t.justLimit=o&&!u}function tr(t,i){if(t.isPrimKey)return i.primaryKey;var o=i.getIndexByKeyPath(t.index);if(!o)throw new H.Schema("KeyPath "+t.index+" on object store "+i.name+" is not indexed");return o}function _o(t,i,o){var u=tr(t,i.schema);return i.openCursor({trans:o,values:!t.keysOnly,reverse:t.dir==="prev",unique:!!t.unique,query:{index:u,range:t.range}})}function nr(t,i,o,u){var l=t.replayFilter?Ot(t.filter,t.replayFilter()):t.filter;if(t.or){var f={},h=function(p,b,v){var A,g;l&&!l(b,v,function(C){return b.stop(C)},function(C){return b.fail(C)})||((g=""+(A=b.primaryKey))=="[object ArrayBuffer]"&&(g=""+new Uint8Array(A)),$(f,g)||(f[g]=!0,i(p,b,v)))};return Promise.all([t.or._iterate(h,o),Ao(_o(t,u,o),t.algorithm,h,!t.keysOnly&&t.valueMapper)])}return Ao(_o(t,u,o),Ot(t.algorithm,l),i,!t.keysOnly&&t.valueMapper)}function Ao(t,i,o,u){var l=de(u?function(f,h,p){return o(u(f),h,p)}:o);return t.then(function(f){if(f)return f.start(function(){var h=function(){return f.continue()};i&&!i(f,function(p){return h=p},function(p){f.stop(p),h=ie},function(p){f.fail(p),h=ie})||l(f.value,f,function(p){return h=p}),h()})})}var rt=Symbol(),sn=(Co.prototype.execute=function(t){if(this.add!==void 0){var i=this.add;if(O(i))return s(s([],O(t)?t:[],!0),i).sort();if(typeof i=="number")return(Number(t)||0)+i;if(typeof i=="bigint")try{return BigInt(t)+i}catch{return BigInt(0)+i}throw new TypeError("Invalid term ".concat(i))}if(this.remove!==void 0){var o=this.remove;if(O(o))return O(t)?t.filter(function(u){return!o.includes(u)}).sort():[];if(typeof o=="number")return Number(t)-o;if(typeof o=="bigint")try{return BigInt(t)-o}catch{return BigInt(0)-o}throw new TypeError("Invalid subtrahend ".concat(o))}return i=(i=this.replacePrefix)===null||i===void 0?void 0:i[0],i&&typeof t=="string"&&t.startsWith(i)?this.replacePrefix[1]+t.substring(i.length):t},Co);function Co(t){Object.assign(this,t)}var Vu=(oe.prototype._read=function(t,i){var o=this._ctx;return o.error?o.table._trans(null,me.bind(null,o.error)):o.table._trans("readonly",t).then(i)},oe.prototype._write=function(t){var i=this._ctx;return i.error?i.table._trans(null,me.bind(null,i.error)):i.table._trans("readwrite",t,"locked")},oe.prototype._addAlgorithm=function(t){var i=this._ctx;i.algorithm=Ot(i.algorithm,t)},oe.prototype._iterate=function(t,i){return nr(this._ctx,t,i,this._ctx.table.core)},oe.prototype.clone=function(t){var i=Object.create(this.constructor.prototype),o=Object.create(this._ctx);return t&&M(o,t),i._ctx=o,i},oe.prototype.raw=function(){return this._ctx.valueMapper=null,this},oe.prototype.each=function(t){var i=this._ctx;return this._read(function(o){return nr(i,t,o,i.table.core)})},oe.prototype.count=function(t){var i=this;return this._read(function(o){var u=i._ctx,l=u.table.core;if(Kt(u,!0))return l.count({trans:o,query:{index:tr(u,l.schema),range:u.range}}).then(function(h){return Math.min(h,u.limit)});var f=0;return nr(u,function(){return++f,!1},o,l).then(function(){return f})}).then(t)},oe.prototype.sortBy=function(t,i){var o=t.split(".").reverse(),u=o[0],l=o.length-1;function f(b,v){return v?f(b[o[v]],v-1):b[u]}var h=this._ctx.dir==="next"?1:-1;function p(b,v){return b=f(b,l),v=f(v,l),b<v?-h:v<b?h:0}return this.toArray(function(b){return b.sort(p)}).then(i)},oe.prototype.toArray=function(t){var i=this;return this._read(function(o){var u=i._ctx;if(u.dir==="next"&&Kt(u,!0)&&0<u.limit){var l=u.valueMapper,f=tr(u,u.table.core.schema);return u.table.core.query({trans:o,limit:u.limit,values:!0,query:{index:f,range:u.range}}).then(function(p){return p=p.result,l?p.map(l):p})}var h=[];return nr(u,function(p){return h.push(p)},o,u.table.core).then(function(){return h})},t)},oe.prototype.offset=function(t){var i=this._ctx;return t<=0||(i.offset+=t,Kt(i)?Qr(i,function(){var o=t;return function(u,l){return o===0||(o===1?--o:l(function(){u.advance(o),o=0}),!1)}}):Qr(i,function(){var o=t;return function(){return--o<0}})),this},oe.prototype.limit=function(t){return this._ctx.limit=Math.min(this._ctx.limit,t),Qr(this._ctx,function(){var i=t;return function(o,u,l){return--i<=0&&u(l),0<=i}},!0),this},oe.prototype.until=function(t,i){return Yr(this._ctx,function(o,u,l){return!t(o.value)||(u(l),i)}),this},oe.prototype.first=function(t){return this.limit(1).toArray(function(i){return i[0]}).then(t)},oe.prototype.last=function(t){return this.reverse().first(t)},oe.prototype.filter=function(t){var i;return Yr(this._ctx,function(o){return t(o.value)}),(i=this._ctx).isMatch=Ot(i.isMatch,t),this},oe.prototype.and=function(t){return this.filter(t)},oe.prototype.or=function(t){return new this.db.WhereClause(this._ctx.table,t,this)},oe.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},oe.prototype.desc=function(){return this.reverse()},oe.prototype.eachKey=function(t){var i=this._ctx;return i.keysOnly=!i.isMatch,this.each(function(o,u){t(u.key,u)})},oe.prototype.eachUniqueKey=function(t){return this._ctx.unique="unique",this.eachKey(t)},oe.prototype.eachPrimaryKey=function(t){var i=this._ctx;return i.keysOnly=!i.isMatch,this.each(function(o,u){t(u.primaryKey,u)})},oe.prototype.keys=function(t){var i=this._ctx;i.keysOnly=!i.isMatch;var o=[];return this.each(function(u,l){o.push(l.key)}).then(function(){return o}).then(t)},oe.prototype.primaryKeys=function(t){var i=this._ctx;if(i.dir==="next"&&Kt(i,!0)&&0<i.limit)return this._read(function(u){var l=tr(i,i.table.core.schema);return i.table.core.query({trans:u,values:!1,limit:i.limit,query:{index:l,range:i.range}})}).then(function(u){return u.result}).then(t);i.keysOnly=!i.isMatch;var o=[];return this.each(function(u,l){o.push(l.primaryKey)}).then(function(){return o}).then(t)},oe.prototype.uniqueKeys=function(t){return this._ctx.unique="unique",this.keys(t)},oe.prototype.firstKey=function(t){return this.limit(1).keys(function(i){return i[0]}).then(t)},oe.prototype.lastKey=function(t){return this.reverse().firstKey(t)},oe.prototype.distinct=function(){var t=this._ctx,t=t.index&&t.table.schema.idxByName[t.index];if(!t||!t.multi)return this;var i={};return Yr(this._ctx,function(l){var u=l.primaryKey.toString(),l=$(i,u);return i[u]=!0,!l}),this},oe.prototype.modify=function(t){var i=this,o=this._ctx;return this._write(function(u){var l,f,h;h=typeof t=="function"?t:(l=d(t),f=l.length,function(w){for(var P=!1,k=0;k<f;++k){var I=l[k],D=t[I],L=Ue(w,I);D instanceof sn?(Te(w,I,D.execute(L)),P=!0):L!==D&&(Te(w,I,D),P=!0)}return P});function p(w,I){var k=I.failures,I=I.numFailures;_+=w-I;for(var D=0,L=d(k);D<L.length;D++){var U=L[D];m.push(k[U])}}var b=o.table.core,v=b.schema.primaryKey,A=v.outbound,g=v.extractKey,C=i.db._options.modifyChunkSize||200,m=[],_=0,S=[];return i.clone().primaryKeys().then(function(w){function P(I){var D=Math.min(C,w.length-I);return b.getMany({trans:u,keys:w.slice(I,I+D),cache:"immutable"}).then(function(L){for(var U=[],B=[],W=A?[]:null,q=[],K=0;K<D;++K){var X=L[K],Z={value:Ge(X),primKey:w[I+K]};h.call(Z,Z.value,Z)!==!1&&(Z.value==null?q.push(w[I+K]):A||ae(g(X),g(Z.value))===0?(B.push(Z.value),A&&W.push(w[I+K])):(q.push(w[I+K]),U.push(Z.value)))}return Promise.resolve(0<U.length&&b.mutate({trans:u,type:"add",values:U}).then(function(re){for(var te in re.failures)q.splice(parseInt(te),1);p(U.length,re)})).then(function(){return(0<B.length||k&&typeof t=="object")&&b.mutate({trans:u,type:"put",keys:W,values:B,criteria:k,changeSpec:typeof t!="function"&&t,isAdditionalChunk:0<I}).then(function(re){return p(B.length,re)})}).then(function(){return(0<q.length||k&&t===Xr)&&b.mutate({trans:u,type:"delete",keys:q,criteria:k,isAdditionalChunk:0<I}).then(function(re){return p(q.length,re)})}).then(function(){return w.length>I+D&&P(I+C)})})}var k=Kt(o)&&o.limit===1/0&&(typeof t!="function"||t===Xr)&&{index:o.index,range:o.range};return P(0).then(function(){if(0<m.length)throw new fe("Error modifying one or more objects",m,_,S);return w.length})})})},oe.prototype.delete=function(){var t=this._ctx,i=t.range;return Kt(t)&&(t.isPrimKey||i.type===3)?this._write(function(o){var u=t.table.core.schema.primaryKey,l=i;return t.table.core.count({trans:o,query:{index:u,range:l}}).then(function(f){return t.table.core.mutate({trans:o,type:"deleteRange",range:l}).then(function(h){var p=h.failures;if(h.lastResult,h.results,h=h.numFailures,h)throw new fe("Could not delete some values",Object.keys(p).map(function(b){return p[b]}),f-h);return f-h})})}):this.modify(Xr)},oe);function oe(){}var Xr=function(t,i){return i.value=null};function Gu(t,i){return t<i?-1:t===i?0:1}function zu(t,i){return i<t?-1:t===i?0:1}function Le(t,i,o){return t=t instanceof xo?new t.Collection(t):t,t._ctx.error=new(o||TypeError)(i),t}function Wt(t){return new t.Collection(t,function(){return So("")}).limit(0)}function rr(t,i,o,u){var l,f,h,p,b,v,A,g=o.length;if(!o.every(function(_){return typeof _=="string"}))return Le(t,go);function C(_){l=_==="next"?function(w){return w.toUpperCase()}:function(w){return w.toLowerCase()},f=_==="next"?function(w){return w.toLowerCase()}:function(w){return w.toUpperCase()},h=_==="next"?Gu:zu;var S=o.map(function(w){return{lower:f(w),upper:l(w)}}).sort(function(w,P){return h(w.lower,P.lower)});p=S.map(function(w){return w.upper}),b=S.map(function(w){return w.lower}),A=(v=_)==="next"?"":u}C("next"),t=new t.Collection(t,function(){return ht(p[0],b[g-1]+u)}),t._ondirectionchange=function(_){C(_)};var m=0;return t._addAlgorithm(function(_,S,w){var P=_.key;if(typeof P!="string")return!1;var k=f(P);if(i(k,b,m))return!0;for(var I=null,D=m;D<g;++D){var L=function(U,B,W,q,K,X){for(var Z=Math.min(U.length,q.length),re=-1,te=0;te<Z;++te){var Ve=B[te];if(Ve!==q[te])return K(U[te],W[te])<0?U.substr(0,te)+W[te]+W.substr(te+1):K(U[te],q[te])<0?U.substr(0,te)+q[te]+W.substr(te+1):0<=re?U.substr(0,re)+B[re]+W.substr(re+1):null;K(U[te],Ve)<0&&(re=te)}return Z<q.length&&X==="next"?U+W.substr(U.length):Z<U.length&&X==="prev"?U.substr(0,W.length):re<0?null:U.substr(0,re)+q[re]+W.substr(re+1)}(P,k,p[D],b[D],h,v);L===null&&I===null?m=D+1:(I===null||0<h(I,L))&&(I=L)}return S(I!==null?function(){_.continue(I+A)}:w),!1}),t}function ht(t,i,o,u){return{type:2,lower:t,upper:i,lowerOpen:o,upperOpen:u}}function So(t){return{type:1,lower:t,upper:t}}var xo=(Object.defineProperty(Ce.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),Ce.prototype.between=function(t,i,o,u){o=o!==!1,u=u===!0;try{return 0<this._cmp(t,i)||this._cmp(t,i)===0&&(o||u)&&(!o||!u)?Wt(this):new this.Collection(this,function(){return ht(t,i,!o,!u)})}catch{return Le(this,nt)}},Ce.prototype.equals=function(t){return t==null?Le(this,nt):new this.Collection(this,function(){return So(t)})},Ce.prototype.above=function(t){return t==null?Le(this,nt):new this.Collection(this,function(){return ht(t,void 0,!0)})},Ce.prototype.aboveOrEqual=function(t){return t==null?Le(this,nt):new this.Collection(this,function(){return ht(t,void 0,!1)})},Ce.prototype.below=function(t){return t==null?Le(this,nt):new this.Collection(this,function(){return ht(void 0,t,!1,!0)})},Ce.prototype.belowOrEqual=function(t){return t==null?Le(this,nt):new this.Collection(this,function(){return ht(void 0,t)})},Ce.prototype.startsWith=function(t){return typeof t!="string"?Le(this,go):this.between(t,t+xt,!0,!0)},Ce.prototype.startsWithIgnoreCase=function(t){return t===""?this.startsWith(t):rr(this,function(i,o){return i.indexOf(o[0])===0},[t],xt)},Ce.prototype.equalsIgnoreCase=function(t){return rr(this,function(i,o){return i===o[0]},[t],"")},Ce.prototype.anyOfIgnoreCase=function(){var t=Ke.apply(et,arguments);return t.length===0?Wt(this):rr(this,function(i,o){return o.indexOf(i)!==-1},t,"")},Ce.prototype.startsWithAnyOfIgnoreCase=function(){var t=Ke.apply(et,arguments);return t.length===0?Wt(this):rr(this,function(i,o){return o.some(function(u){return i.indexOf(u)===0})},t,xt)},Ce.prototype.anyOf=function(){var t=this,i=Ke.apply(et,arguments),o=this._cmp;try{i.sort(o)}catch{return Le(this,nt)}if(i.length===0)return Wt(this);var u=new this.Collection(this,function(){return ht(i[0],i[i.length-1])});u._ondirectionchange=function(f){o=f==="next"?t._ascending:t._descending,i.sort(o)};var l=0;return u._addAlgorithm(function(f,h,p){for(var b=f.key;0<o(b,i[l]);)if(++l===i.length)return h(p),!1;return o(b,i[l])===0||(h(function(){f.continue(i[l])}),!1)}),u},Ce.prototype.notEqual=function(t){return this.inAnyRange([[-1/0,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},Ce.prototype.noneOf=function(){var t=Ke.apply(et,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return Le(this,nt)}var i=t.reduce(function(o,u){return o?o.concat([[o[o.length-1][1],u]]):[[-1/0,u]]},null);return i.push([t[t.length-1],this.db._maxKey]),this.inAnyRange(i,{includeLowers:!1,includeUppers:!1})},Ce.prototype.inAnyRange=function(P,i){var o=this,u=this._cmp,l=this._ascending,f=this._descending,h=this._min,p=this._max;if(P.length===0)return Wt(this);if(!P.every(function(k){return k[0]!==void 0&&k[1]!==void 0&&l(k[0],k[1])<=0}))return Le(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",H.InvalidArgument);var b=!i||i.includeLowers!==!1,v=i&&i.includeUppers===!0,A,g=l;function C(k,I){return g(k[0],I[0])}try{(A=P.reduce(function(k,I){for(var D=0,L=k.length;D<L;++D){var U=k[D];if(u(I[0],U[1])<0&&0<u(I[1],U[0])){U[0]=h(U[0],I[0]),U[1]=p(U[1],I[1]);break}}return D===L&&k.push(I),k},[])).sort(C)}catch{return Le(this,nt)}var m=0,_=v?function(k){return 0<l(k,A[m][1])}:function(k){return 0<=l(k,A[m][1])},S=b?function(k){return 0<f(k,A[m][0])}:function(k){return 0<=f(k,A[m][0])},w=_,P=new this.Collection(this,function(){return ht(A[0][0],A[A.length-1][1],!b,!v)});return P._ondirectionchange=function(k){g=k==="next"?(w=_,l):(w=S,f),A.sort(C)},P._addAlgorithm(function(k,I,D){for(var L,U=k.key;w(U);)if(++m===A.length)return I(D),!1;return!_(L=U)&&!S(L)||(o._cmp(U,A[m][1])===0||o._cmp(U,A[m][0])===0||I(function(){g===l?k.continue(A[m][0]):k.continue(A[m][1])}),!1)}),P},Ce.prototype.startsWithAnyOf=function(){var t=Ke.apply(et,arguments);return t.every(function(i){return typeof i=="string"})?t.length===0?Wt(this):this.inAnyRange(t.map(function(i){return[i,i+xt]})):Le(this,"startsWithAnyOf() only works with strings")},Ce);function Ce(){}function He(t){return de(function(i){return un(i),t(i.target.error),!1})}function un(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}var cn="storagemutated",Jr="x-storagemutated-1",dt=on(null,cn),Hu=(Ye.prototype._lock=function(){return vt(!N.global),++this._reculock,this._reculock!==1||N.global||(N.lockOwnerFor=this),this},Ye.prototype._unlock=function(){if(vt(!N.global),--this._reculock==0)for(N.global||(N.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var t=this._blockedFuncs.shift();try{St(t[1],t[0])}catch{}}return this},Ye.prototype._locked=function(){return this._reculock&&N.lockOwnerFor!==this},Ye.prototype.create=function(t){var i=this;if(!this.mode)return this;var o=this.db.idbdb,u=this.db._state.dbOpenError;if(vt(!this.idbtrans),!t&&!o)switch(u&&u.name){case"DatabaseClosedError":throw new H.DatabaseClosed(u);case"MissingAPIError":throw new H.MissingAPI(u.message,u);default:throw new H.OpenFailed(u)}if(!this.active)throw new H.TransactionInactive;return vt(this._completion._state===null),(t=this.idbtrans=t||(this.db.core||o).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=de(function(l){un(l),i._reject(t.error)}),t.onabort=de(function(l){un(l),i.active&&i._reject(new H.Abort(t.error)),i.active=!1,i.on("abort").fire(l)}),t.oncomplete=de(function(){i.active=!1,i._resolve(),"mutatedParts"in t&&dt.storagemutated.fire(t.mutatedParts)}),this},Ye.prototype._promise=function(t,i,o){var u=this;if(t==="readwrite"&&this.mode!=="readwrite")return me(new H.ReadOnly("Transaction is readonly"));if(!this.active)return me(new H.TransactionInactive);if(this._locked())return new T(function(f,h){u._blockedFuncs.push([function(){u._promise(t,i,o).then(f,h)},N])});if(o)return ct(function(){var f=new T(function(h,p){u._lock();var b=i(h,p,u);b&&b.then&&b.then(h,p)});return f.finally(function(){return u._unlock()}),f._lib=!0,f});var l=new T(function(f,h){var p=i(f,h,u);p&&p.then&&p.then(f,h)});return l._lib=!0,l},Ye.prototype._root=function(){return this.parent?this.parent._root():this},Ye.prototype.waitFor=function(t){var i,o=this._root(),u=T.resolve(t);o._waitingFor?o._waitingFor=o._waitingFor.then(function(){return u}):(o._waitingFor=u,o._waitingQueue=[],i=o.idbtrans.objectStore(o.storeNames[0]),function f(){for(++o._spinCount;o._waitingQueue.length;)o._waitingQueue.shift()();o._waitingFor&&(i.get(-1/0).onsuccess=f)}());var l=o._waitingFor;return new T(function(f,h){u.then(function(p){return o._waitingQueue.push(de(f.bind(null,p)))},function(p){return o._waitingQueue.push(de(h.bind(null,p)))}).finally(function(){o._waitingFor===l&&(o._waitingFor=null)})})},Ye.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new H.Abort))},Ye.prototype.table=function(t){var i=this._memoizedTables||(this._memoizedTables={});if($(i,t))return i[t];var o=this.schema[t];if(!o)throw new H.NotFound("Table "+t+" not part of transaction");return o=new this.db.Table(t,o,this),o.core=this.db.core.table(t),i[t]=o},Ye);function Ye(){}function Zr(t,i,o,u,l,f,h){return{name:t,keyPath:i,unique:o,multi:u,auto:l,compound:f,src:(o&&!h?"&":"")+(u?"*":"")+(l?"++":"")+Oo(i)}}function Oo(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function ei(t,i,o){return{name:t,primKey:i,indexes:o,mappedClass:null,idxByName:(u=function(l){return[l.name,l]},o.reduce(function(l,f,h){return h=u(f,h),h&&(l[h[0]]=h[1]),l},{}))};var u}var ln=function(t){try{return t.only([[]]),ln=function(){return[[]]},[[]]}catch{return ln=function(){return xt},xt}};function ti(t){return t==null?function(){}:typeof t=="string"?(i=t).split(".").length===1?function(o){return o[i]}:function(o){return Ue(o,i)}:function(o){return Ue(o,t)};var i}function Po(t){return[].slice.call(t)}var Yu=0;function fn(t){return t==null?":id":typeof t=="string"?t:"[".concat(t.join("+"),"]")}function Qu(t,i,b){function u(w){if(w.type===3)return null;if(w.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var m=w.lower,_=w.upper,S=w.lowerOpen,w=w.upperOpen;return m===void 0?_===void 0?null:i.upperBound(_,!!w):_===void 0?i.lowerBound(m,!!S):i.bound(m,_,!!S,!!w)}function l(C){var m,_=C.name;return{name:_,schema:C,mutate:function(S){var w=S.trans,P=S.type,k=S.keys,I=S.values,D=S.range;return new Promise(function(L,U){L=de(L);var B=w.objectStore(_),W=B.keyPath==null,q=P==="put"||P==="add";if(!q&&P!=="delete"&&P!=="deleteRange")throw new Error("Invalid operation type: "+P);var K,X=(k||I||{length:1}).length;if(k&&I&&k.length!==I.length)throw new Error("Given keys array must have same length as given values array.");if(X===0)return L({numFailures:0,failures:{},results:[],lastResult:void 0});function Z(ke){++Ve,un(ke)}var re=[],te=[],Ve=0;if(P==="deleteRange"){if(D.type===4)return L({numFailures:Ve,failures:te,results:[],lastResult:void 0});D.type===3?re.push(K=B.clear()):re.push(K=B.delete(u(D)))}else{var W=q?W?[I,k]:[I,null]:[k,null],ne=W[0],Pe=W[1];if(q)for(var Ee=0;Ee<X;++Ee)re.push(K=Pe&&Pe[Ee]!==void 0?B[P](ne[Ee],Pe[Ee]):B[P](ne[Ee])),K.onerror=Z;else for(Ee=0;Ee<X;++Ee)re.push(K=B[P](ne[Ee])),K.onerror=Z}function yr(ke){ke=ke.target.result,re.forEach(function(Tt,wi){return Tt.error!=null&&(te[wi]=Tt.error)}),L({numFailures:Ve,failures:te,results:P==="delete"?k:re.map(function(Tt){return Tt.result}),lastResult:ke})}K.onerror=function(ke){Z(ke),yr(ke)},K.onsuccess=yr})},getMany:function(S){var w=S.trans,P=S.keys;return new Promise(function(k,I){k=de(k);for(var D,L=w.objectStore(_),U=P.length,B=new Array(U),W=0,q=0,K=function(re){re=re.target,B[re._pos]=re.result,++q===W&&k(B)},X=He(I),Z=0;Z<U;++Z)P[Z]!=null&&((D=L.get(P[Z]))._pos=Z,D.onsuccess=K,D.onerror=X,++W);W===0&&k(B)})},get:function(S){var w=S.trans,P=S.key;return new Promise(function(k,I){k=de(k);var D=w.objectStore(_).get(P);D.onsuccess=function(L){return k(L.target.result)},D.onerror=He(I)})},query:(m=v,function(S){return new Promise(function(w,P){w=de(w);var k,I,D,W=S.trans,L=S.values,U=S.limit,K=S.query,B=U===1/0?void 0:U,q=K.index,K=K.range,W=W.objectStore(_),q=q.isPrimaryKey?W:W.index(q.name),K=u(K);if(U===0)return w({result:[]});m?((B=L?q.getAll(K,B):q.getAllKeys(K,B)).onsuccess=function(X){return w({result:X.target.result})},B.onerror=He(P)):(k=0,I=!L&&"openKeyCursor"in q?q.openKeyCursor(K):q.openCursor(K),D=[],I.onsuccess=function(X){var Z=I.result;return Z?(D.push(L?Z.value:Z.primaryKey),++k===U?w({result:D}):void Z.continue()):w({result:D})},I.onerror=He(P))})}),openCursor:function(S){var w=S.trans,P=S.values,k=S.query,I=S.reverse,D=S.unique;return new Promise(function(L,U){L=de(L);var q=k.index,B=k.range,W=w.objectStore(_),W=q.isPrimaryKey?W:W.index(q.name),q=I?D?"prevunique":"prev":D?"nextunique":"next",K=!P&&"openKeyCursor"in W?W.openKeyCursor(u(B),q):W.openCursor(u(B),q);K.onerror=He(U),K.onsuccess=de(function(X){var Z,re,te,Ve,ne=K.result;ne?(ne.___id=++Yu,ne.done=!1,Z=ne.continue.bind(ne),re=(re=ne.continuePrimaryKey)&&re.bind(ne),te=ne.advance.bind(ne),Ve=function(){throw new Error("Cursor not stopped")},ne.trans=w,ne.stop=ne.continue=ne.continuePrimaryKey=ne.advance=function(){throw new Error("Cursor not started")},ne.fail=de(U),ne.next=function(){var Pe=this,Ee=1;return this.start(function(){return Ee--?Pe.continue():Pe.stop()}).then(function(){return Pe})},ne.start=function(Pe){function Ee(){if(K.result)try{Pe()}catch(ke){ne.fail(ke)}else ne.done=!0,ne.start=function(){throw new Error("Cursor behind last entry")},ne.stop()}var yr=new Promise(function(ke,Tt){ke=de(ke),K.onerror=He(Tt),ne.fail=Tt,ne.stop=function(wi){ne.stop=ne.continue=ne.continuePrimaryKey=ne.advance=Ve,ke(wi)}});return K.onsuccess=de(function(ke){K.onsuccess=Ee,Ee()}),ne.continue=Z,ne.continuePrimaryKey=re,ne.advance=te,Ee(),yr},L(ne)):L(null)},U)})},count:function(S){var w=S.query,P=S.trans,k=w.index,I=w.range;return new Promise(function(D,L){var U=P.objectStore(_),B=k.isPrimaryKey?U:U.index(k.name),U=u(I),B=U?B.count(U):B.count();B.onsuccess=de(function(W){return D(W.target.result)}),B.onerror=He(L)})}}}var f,h,p,A=(h=b,p=Po((f=t).objectStoreNames),{schema:{name:f.name,tables:p.map(function(C){return h.objectStore(C)}).map(function(C){var m=C.keyPath,w=C.autoIncrement,_=O(m),S={},w={name:C.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:m==null,compound:_,keyPath:m,autoIncrement:w,unique:!0,extractKey:ti(m)},indexes:Po(C.indexNames).map(function(P){return C.index(P)}).map(function(D){var k=D.name,I=D.unique,L=D.multiEntry,D=D.keyPath,L={name:k,compound:O(D),keyPath:D,unique:I,multiEntry:L,extractKey:ti(D)};return S[fn(D)]=L}),getIndexByKeyPath:function(P){return S[fn(P)]}};return S[":id"]=w.primaryKey,m!=null&&(S[fn(m)]=w.primaryKey),w})},hasGetAll:0<p.length&&"getAll"in h.objectStore(p[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),b=A.schema,v=A.hasGetAll,A=b.tables.map(l),g={};return A.forEach(function(C){return g[C.name]=C}),{stack:"dbcore",transaction:t.transaction.bind(t),table:function(C){if(!g[C])throw new Error("Table '".concat(C,"' not found"));return g[C]},MIN_KEY:-1/0,MAX_KEY:ln(i),schema:b}}function Xu(t,i,o,u){var l=o.IDBKeyRange;return o.indexedDB,{dbcore:(u=Qu(i,l,u),t.dbcore.reduce(function(f,h){return h=h.create,a(a({},f),h(f))},u))}}function ir(t,u){var o=u.db,u=Xu(t._middlewares,o,t._deps,u);t.core=u.dbcore,t.tables.forEach(function(l){var f=l.name;t.core.schema.tables.some(function(h){return h.name===f})&&(l.core=t.core.table(f),t[f]instanceof t.Table&&(t[f].core=l.core))})}function or(t,i,o,u){o.forEach(function(l){var f=u[l];i.forEach(function(h){var p=function b(v,A){return Ze(v,A)||(v=y(v))&&b(v,A)}(h,l);(!p||"value"in p&&p.value===void 0)&&(h===t.Transaction.prototype||h instanceof t.Transaction?ve(h,l,{get:function(){return this.table(l)},set:function(b){pe(this,l,{value:b,writable:!0,configurable:!0,enumerable:!0})}}):h[l]=new t.Table(l,f))})})}function ni(t,i){i.forEach(function(o){for(var u in o)o[u]instanceof t.Table&&delete o[u]})}function Ju(t,i){return t._cfg.version-i._cfg.version}function Zu(t,i,o,u){var l=t._dbSchema;o.objectStoreNames.contains("$meta")&&!l.$meta&&(l.$meta=ei("$meta",To("")[0],[]),t._storeNames.push("$meta"));var f=t._createTransaction("readwrite",t._storeNames,l);f.create(o),f._completion.catch(u);var h=f._reject.bind(f),p=N.transless||N;ct(function(){return N.trans=f,N.transless=p,i!==0?(ir(t,o),v=i,((b=f).storeNames.includes("$meta")?b.table("$meta").get("version").then(function(A){return A??v}):T.resolve(v)).then(function(A){return C=A,m=f,_=o,S=[],A=(g=t)._versions,w=g._dbSchema=sr(0,g.idbdb,_),(A=A.filter(function(P){return P._cfg.version>=C})).length!==0?(A.forEach(function(P){S.push(function(){var k=w,I=P._cfg.dbschema;ur(g,k,_),ur(g,I,_),w=g._dbSchema=I;var D=ri(k,I);D.add.forEach(function(q){ii(_,q[0],q[1].primKey,q[1].indexes)}),D.change.forEach(function(q){if(q.recreate)throw new H.Upgrade("Not yet support for changing primary key");var K=_.objectStore(q.name);q.add.forEach(function(X){return ar(K,X)}),q.change.forEach(function(X){K.deleteIndex(X.name),ar(K,X)}),q.del.forEach(function(X){return K.deleteIndex(X)})});var L=P._cfg.contentUpgrade;if(L&&P._cfg.version>C){ir(g,_),m._memoizedTables={};var U=jn(I);D.del.forEach(function(q){U[q]=k[q]}),ni(g,[g.Transaction.prototype]),or(g,[g.Transaction.prototype],d(U),U),m.schema=U;var B,W=Nt(L);return W&&Bt(),D=T.follow(function(){var q;(B=L(m))&&W&&(q=lt.bind(null,null),B.then(q,q))}),B&&typeof B.then=="function"?T.resolve(B):D.then(function(){return B})}}),S.push(function(k){var I,D,L=P._cfg.dbschema;I=L,D=k,[].slice.call(D.db.objectStoreNames).forEach(function(U){return I[U]==null&&D.db.deleteObjectStore(U)}),ni(g,[g.Transaction.prototype]),or(g,[g.Transaction.prototype],g._storeNames,g._dbSchema),m.schema=g._dbSchema}),S.push(function(k){g.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(g.idbdb.version/10)===P._cfg.version?(g.idbdb.deleteObjectStore("$meta"),delete g._dbSchema.$meta,g._storeNames=g._storeNames.filter(function(I){return I!=="$meta"})):k.objectStore("$meta").put(P._cfg.version,"version"))})}),function P(){return S.length?T.resolve(S.shift()(m.idbtrans)).then(P):T.resolve()}().then(function(){Eo(w,_)})):T.resolve();var g,C,m,_,S,w}).catch(h)):(d(l).forEach(function(A){ii(o,A,l[A].primKey,l[A].indexes)}),ir(t,o),void T.follow(function(){return t.on.populate.fire(f)}).catch(h));var b,v})}function ec(t,i){Eo(t._dbSchema,i),i.db.version%10!=0||i.objectStoreNames.contains("$meta")||i.db.createObjectStore("$meta").add(Math.ceil(i.db.version/10-1),"version");var o=sr(0,t.idbdb,i);ur(t,t._dbSchema,i);for(var u=0,l=ri(o,t._dbSchema).change;u<l.length;u++){var f=function(h){if(h.change.length||h.recreate)return console.warn("Unable to patch indexes of table ".concat(h.name," because it has changes on the type of index or primary key.")),{value:void 0};var p=i.objectStore(h.name);h.add.forEach(function(b){De&&console.debug("Dexie upgrade patch: Creating missing index ".concat(h.name,".").concat(b.src)),ar(p,b)})}(l[u]);if(typeof f=="object")return f.value}}function ri(t,i){var o,u={del:[],add:[],change:[]};for(o in t)i[o]||u.del.push(o);for(o in i){var l=t[o],f=i[o];if(l){var h={name:o,def:f,recreate:!1,del:[],add:[],change:[]};if(""+(l.primKey.keyPath||"")!=""+(f.primKey.keyPath||"")||l.primKey.auto!==f.primKey.auto)h.recreate=!0,u.change.push(h);else{var p=l.idxByName,b=f.idxByName,v=void 0;for(v in p)b[v]||h.del.push(v);for(v in b){var A=p[v],g=b[v];A?A.src!==g.src&&h.change.push(g):h.add.push(g)}(0<h.del.length||0<h.add.length||0<h.change.length)&&u.change.push(h)}}else u.add.push([o,f])}return u}function ii(t,i,o,u){var l=t.db.createObjectStore(i,o.keyPath?{keyPath:o.keyPath,autoIncrement:o.auto}:{autoIncrement:o.auto});return u.forEach(function(f){return ar(l,f)}),l}function Eo(t,i){d(t).forEach(function(o){i.db.objectStoreNames.contains(o)||(De&&console.debug("Dexie: Creating missing table",o),ii(i,o,t[o].primKey,t[o].indexes))})}function ar(t,i){t.createIndex(i.name,i.keyPath,{unique:i.unique,multiEntry:i.multi})}function sr(t,i,o){var u={};return Rt(i.objectStoreNames,0).forEach(function(l){for(var f=o.objectStore(l),h=Zr(Oo(v=f.keyPath),v||"",!0,!1,!!f.autoIncrement,v&&typeof v!="string",!0),p=[],b=0;b<f.indexNames.length;++b){var A=f.index(f.indexNames[b]),v=A.keyPath,A=Zr(A.name,v,!!A.unique,!!A.multiEntry,!1,v&&typeof v!="string",!1);p.push(A)}u[l]=ei(l,h,p)}),u}function ur(t,i,o){for(var u=o.db.objectStoreNames,l=0;l<u.length;++l){var f=u[l],h=o.objectStore(f);t._hasGetAll="getAll"in h;for(var p=0;p<h.indexNames.length;++p){var b=h.indexNames[p],v=h.index(b).keyPath,A=typeof v=="string"?v:"["+Rt(v).join("+")+"]";!i[f]||(v=i[f].idxByName[A])&&(v.name=b,delete i[f].idxByName[A],i[f].idxByName[b]=v)}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&c.WorkerGlobalScope&&c instanceof c.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(t._hasGetAll=!1)}function To(t){return t.split(",").map(function(i,o){var u=(i=i.trim()).replace(/([&*]|\+\+)/g,""),l=/^\[/.test(u)?u.match(/^\[(.*)\]$/)[1].split("+"):u;return Zr(u,l||null,/\&/.test(i),/\*/.test(i),/\+\+/.test(i),O(l),o===0)})}var tc=(cr.prototype._parseStoresSpec=function(t,i){d(t).forEach(function(o){if(t[o]!==null){var u=To(t[o]),l=u.shift();if(l.unique=!0,l.multi)throw new H.Schema("Primary key cannot be multi-valued");u.forEach(function(f){if(f.auto)throw new H.Schema("Only primary key can be marked as autoIncrement (++)");if(!f.keyPath)throw new H.Schema("Index must have a name and cannot be an empty string")}),i[o]=ei(o,l,u)}})},cr.prototype.stores=function(o){var i=this.db;this._cfg.storesSource=this._cfg.storesSource?M(this._cfg.storesSource,o):o;var o=i._versions,u={},l={};return o.forEach(function(f){M(u,f._cfg.storesSource),l=f._cfg.dbschema={},f._parseStoresSpec(u,l)}),i._dbSchema=l,ni(i,[i._allTables,i,i.Transaction.prototype]),or(i,[i._allTables,i,i.Transaction.prototype,this._cfg.tables],d(l),l),i._storeNames=d(l),this},cr.prototype.upgrade=function(t){return this._cfg.contentUpgrade=Lt(this._cfg.contentUpgrade||ie,t),this},cr);function cr(){}function oi(t,i){var o=t._dbNamesDB;return o||(o=t._dbNamesDB=new it(Zn,{addons:[],indexedDB:t,IDBKeyRange:i})).version(1).stores({dbnames:"name"}),o.table("dbnames")}function ai(t){return t&&typeof t.databases=="function"}function si(t){return ct(function(){return N.letThrough=!0,t()})}function ui(t){return!("from"in t)}var Oe=function(t,i){if(!this){var o=new Oe;return t&&"d"in t&&M(o,t),o}M(this,arguments.length?{d:1,from:t,to:1<arguments.length?i:t}:{d:0})};function hn(t,i,o){var u=ae(i,o);if(!isNaN(u)){if(0<u)throw RangeError();if(ui(t))return M(t,{from:i,to:o,d:1});var l=t.l,u=t.r;if(ae(o,t.from)<0)return l?hn(l,i,o):t.l={from:i,to:o,d:1,l:null,r:null},ko(t);if(0<ae(i,t.to))return u?hn(u,i,o):t.r={from:i,to:o,d:1,l:null,r:null},ko(t);ae(i,t.from)<0&&(t.from=i,t.l=null,t.d=u?u.d+1:1),0<ae(o,t.to)&&(t.to=o,t.r=null,t.d=t.l?t.l.d+1:1),o=!t.r,l&&!t.l&&dn(t,l),u&&o&&dn(t,u)}}function dn(t,i){ui(i)||function o(u,b){var f=b.from,h=b.to,p=b.l,b=b.r;hn(u,f,h),p&&o(u,p),b&&o(u,b)}(t,i)}function lr(t,i){var o=ci(i),u=o.next();if(u.done)return!1;for(var l=u.value,f=ci(t),h=f.next(l.from),p=h.value;!u.done&&!h.done;){if(ae(p.from,l.to)<=0&&0<=ae(p.to,l.from))return!0;ae(l.from,p.from)<0?l=(u=o.next(p.from)).value:p=(h=f.next(l.from)).value}return!1}function ci(t){var i=ui(t)?null:{s:0,n:t};return{next:function(o){for(var u=0<arguments.length;i;)switch(i.s){case 0:if(i.s=1,u)for(;i.n.l&&ae(o,i.n.from)<0;)i={up:i,n:i.n.l,s:1};else for(;i.n.l;)i={up:i,n:i.n.l,s:1};case 1:if(i.s=2,!u||ae(o,i.n.to)<=0)return{value:i.n,done:!1};case 2:if(i.n.r){i.s=3,i={up:i,n:i.n.r,s:0};continue}case 3:i=i.up}return{done:!0}}}}function ko(t){var i,o,u=(((i=t.r)===null||i===void 0?void 0:i.d)||0)-(((o=t.l)===null||o===void 0?void 0:o.d)||0),l=1<u?"r":u<-1?"l":"";l&&(i=l=="r"?"l":"r",o=a({},t),u=t[l],t.from=u.from,t.to=u.to,t[l]=u[l],o[l]=u[i],(t[i]=o).d=Io(o)),t.d=Io(t)}function Io(o){var i=o.r,o=o.l;return(i?o?Math.max(i.d,o.d):i.d:o?o.d:0)+1}function fr(t,i){return d(i).forEach(function(o){t[o]?dn(t[o],i[o]):t[o]=function u(l){var f,h,p={};for(f in l)$(l,f)&&(h=l[f],p[f]=!h||typeof h!="object"||Ln.has(h.constructor)?h:u(h));return p}(i[o])}),t}function li(t,i){return t.all||i.all||Object.keys(t).some(function(o){return i[o]&&lr(i[o],t[o])})}Y(Oe.prototype,((We={add:function(t){return dn(this,t),this},addKey:function(t){return hn(this,t,t),this},addKeys:function(t){var i=this;return t.forEach(function(o){return hn(i,o,o)}),this}})[jt]=function(){return ci(this)},We));var Pt={},fi={},hi=!1;function hr(t){fr(fi,t),hi||(hi=!0,setTimeout(function(){hi=!1,di(fi,!(fi={}))},0))}function di(t,i){i===void 0&&(i=!1);var o=new Set;if(t.all)for(var u=0,l=Object.values(Pt);u<l.length;u++)Do(h=l[u],t,o,i);else for(var f in t){var h,p=/^idb\:\/\/(.*)\/(.*)\//.exec(f);p&&(f=p[1],p=p[2],(h=Pt["idb://".concat(f,"/").concat(p)])&&Do(h,t,o,i))}o.forEach(function(b){return b()})}function Do(t,i,o,u){for(var l=[],f=0,h=Object.entries(t.queries.query);f<h.length;f++){for(var p=h[f],b=p[0],v=[],A=0,g=p[1];A<g.length;A++){var C=g[A];li(i,C.obsSet)?C.subscribers.forEach(function(w){return o.add(w)}):u&&v.push(C)}u&&l.push([b,v])}if(u)for(var m=0,_=l;m<_.length;m++){var S=_[m],b=S[0],v=S[1];t.queries.query[b]=v}}function nc(t){var i=t._state,o=t._deps.indexedDB;if(i.isBeingOpened||t.idbdb)return i.dbReadyPromise.then(function(){return i.dbOpenError?me(i.dbOpenError):t});i.isBeingOpened=!0,i.dbOpenError=null,i.openComplete=!1;var u=i.openCanceller,l=Math.round(10*t.verno),f=!1;function h(){if(i.openCanceller!==u)throw new H.DatabaseClosed("db.open() was cancelled")}function p(){return new T(function(C,m){if(h(),!o)throw new H.MissingAPI;var _=t.name,S=i.autoSchema||!l?o.open(_):o.open(_,l);if(!S)throw new H.MissingAPI;S.onerror=He(m),S.onblocked=de(t._fireOnBlocked),S.onupgradeneeded=de(function(w){var P;A=S.transaction,i.autoSchema&&!t._options.allowEmptyDB?(S.onerror=un,A.abort(),S.result.close(),(P=o.deleteDatabase(_)).onsuccess=P.onerror=de(function(){m(new H.NoSuchDatabase("Database ".concat(_," doesnt exist")))})):(A.onerror=He(m),w=w.oldVersion>Math.pow(2,62)?0:w.oldVersion,g=w<1,t.idbdb=S.result,f&&ec(t,A),Zu(t,w/10,A,m))},m),S.onsuccess=de(function(){A=null;var w,P,k,I,D,L=t.idbdb=S.result,U=Rt(L.objectStoreNames);if(0<U.length)try{var B=L.transaction((I=U).length===1?I[0]:I,"readonly");if(i.autoSchema)P=L,k=B,(w=t).verno=P.version/10,k=w._dbSchema=sr(0,P,k),w._storeNames=Rt(P.objectStoreNames,0),or(w,[w._allTables],d(k),k);else if(ur(t,t._dbSchema,B),((D=ri(sr(0,(D=t).idbdb,B),D._dbSchema)).add.length||D.change.some(function(W){return W.add.length||W.change.length}))&&!f)return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),L.close(),l=L.version+1,f=!0,C(p());ir(t,B)}catch{}Ft.push(t),L.onversionchange=de(function(W){i.vcFired=!0,t.on("versionchange").fire(W)}),L.onclose=de(function(W){t.on("close").fire(W)}),g&&(D=t._deps,B=_,L=D.indexedDB,D=D.IDBKeyRange,ai(L)||B===Zn||oi(L,D).put({name:B}).catch(ie)),C()},m)}).catch(function(C){switch(C?.name){case"UnknownError":if(0<i.PR1398_maxLoop)return i.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),p();break;case"VersionError":if(0<l)return l=0,p()}return T.reject(C)})}var b,v=i.dbReadyResolve,A=null,g=!1;return T.race([u,(typeof navigator>"u"?T.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(C){function m(){return indexedDB.databases().finally(C)}b=setInterval(m,100),m()}).finally(function(){return clearInterval(b)}):Promise.resolve()).then(p)]).then(function(){return h(),i.onReadyBeingFired=[],T.resolve(si(function(){return t.on.ready.fire(t.vip)})).then(function C(){if(0<i.onReadyBeingFired.length){var m=i.onReadyBeingFired.reduce(Lt,ie);return i.onReadyBeingFired=[],T.resolve(si(function(){return m(t.vip)})).then(C)}})}).finally(function(){i.openCanceller===u&&(i.onReadyBeingFired=null,i.isBeingOpened=!1)}).catch(function(C){i.dbOpenError=C;try{A&&A.abort()}catch{}return u===i.openCanceller&&t._close(),me(C)}).finally(function(){i.openComplete=!0,v()}).then(function(){var C;return g&&(C={},t.tables.forEach(function(m){m.schema.indexes.forEach(function(_){_.name&&(C["idb://".concat(t.name,"/").concat(m.name,"/").concat(_.name)]=new Oe(-1/0,[[[]]]))}),C["idb://".concat(t.name,"/").concat(m.name,"/")]=C["idb://".concat(t.name,"/").concat(m.name,"/:dels")]=new Oe(-1/0,[[[]]])}),dt(cn).fire(C),di(C,!0)),t})}function pi(t){function i(f){return t.next(f)}var o=l(i),u=l(function(f){return t.throw(f)});function l(f){return function(b){var p=f(b),b=p.value;return p.done?b:b&&typeof b.then=="function"?b.then(o,u):O(b)?Promise.all(b).then(o,u):o(b)}}return l(i)()}function dr(t,i,o){for(var u=O(t)?t.slice():[t],l=0;l<o;++l)u.push(i);return u}var rc={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(t){return a(a({},t),{table:function(i){var o=t.table(i),u=o.schema,l={},f=[];function h(g,C,m){var _=fn(g),S=l[_]=l[_]||[],w=g==null?0:typeof g=="string"?1:g.length,P=0<C,P=a(a({},m),{name:P?"".concat(_,"(virtual-from:").concat(m.name,")"):m.name,lowLevelIndex:m,isVirtual:P,keyTail:C,keyLength:w,extractKey:ti(g),unique:!P&&m.unique});return S.push(P),P.isPrimaryKey||f.push(P),1<w&&h(w===2?g[0]:g.slice(0,w-1),C+1,m),S.sort(function(k,I){return k.keyTail-I.keyTail}),P}i=h(u.primaryKey.keyPath,0,u.primaryKey),l[":id"]=[i];for(var p=0,b=u.indexes;p<b.length;p++){var v=b[p];h(v.keyPath,0,v)}function A(g){var C,m=g.query.index;return m.isVirtual?a(a({},g),{query:{index:m.lowLevelIndex,range:(C=g.query.range,m=m.keyTail,{type:C.type===1?2:C.type,lower:dr(C.lower,C.lowerOpen?t.MAX_KEY:t.MIN_KEY,m),lowerOpen:!0,upper:dr(C.upper,C.upperOpen?t.MIN_KEY:t.MAX_KEY,m),upperOpen:!0})}}):g}return a(a({},o),{schema:a(a({},u),{primaryKey:i,indexes:f,getIndexByKeyPath:function(g){return(g=l[fn(g)])&&g[0]}}),count:function(g){return o.count(A(g))},query:function(g){return o.query(A(g))},openCursor:function(g){var C=g.query.index,m=C.keyTail,_=C.isVirtual,S=C.keyLength;return _?o.openCursor(A(g)).then(function(P){return P&&w(P)}):o.openCursor(g);function w(P){return Object.create(P,{continue:{value:function(k){k!=null?P.continue(dr(k,g.reverse?t.MAX_KEY:t.MIN_KEY,m)):g.unique?P.continue(P.key.slice(0,S).concat(g.reverse?t.MIN_KEY:t.MAX_KEY,m)):P.continue()}},continuePrimaryKey:{value:function(k,I){P.continuePrimaryKey(dr(k,t.MAX_KEY,m),I)}},primaryKey:{get:function(){return P.primaryKey}},key:{get:function(){var k=P.key;return S===1?k[0]:k.slice(0,S)}},value:{get:function(){return P.value}}})}}})}})}};function gi(t,i,o,u){return o=o||{},u=u||"",d(t).forEach(function(l){var f,h,p;$(i,l)?(f=t[l],h=i[l],typeof f=="object"&&typeof h=="object"&&f&&h?(p=bt(f))!==bt(h)?o[u+l]=i[l]:p==="Object"?gi(f,h,o,u+l+"."):f!==h&&(o[u+l]=i[l]):f!==h&&(o[u+l]=i[l])):o[u+l]=void 0}),d(i).forEach(function(l){$(t,l)||(o[u+l]=i[l])}),o}function yi(t,i){return i.type==="delete"?i.keys:i.keys||i.values.map(t.extractKey)}var ic={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(t){return a(a({},t),{table:function(i){var o=t.table(i),u=o.schema.primaryKey;return a(a({},o),{mutate:function(l){var f=N.trans,h=f.table(i).hook,p=h.deleting,b=h.creating,v=h.updating;switch(l.type){case"add":if(b.fire===ie)break;return f._promise("readwrite",function(){return A(l)},!0);case"put":if(b.fire===ie&&v.fire===ie)break;return f._promise("readwrite",function(){return A(l)},!0);case"delete":if(p.fire===ie)break;return f._promise("readwrite",function(){return A(l)},!0);case"deleteRange":if(p.fire===ie)break;return f._promise("readwrite",function(){return function g(C,m,_){return o.query({trans:C,values:!1,query:{index:u,range:m},limit:_}).then(function(S){var w=S.result;return A({type:"delete",keys:w,trans:C}).then(function(P){return 0<P.numFailures?Promise.reject(P.failures[0]):w.length<_?{failures:[],numFailures:0,lastResult:void 0}:g(C,a(a({},m),{lower:w[w.length-1],lowerOpen:!0}),_)})})}(l.trans,l.range,1e4)},!0)}return o.mutate(l);function A(g){var C,m,_,S=N.trans,w=g.keys||yi(u,g);if(!w)throw new Error("Keys missing");return(g=g.type==="add"||g.type==="put"?a(a({},g),{keys:w}):a({},g)).type!=="delete"&&(g.values=s([],g.values)),g.keys&&(g.keys=s([],g.keys)),C=o,_=w,((m=g).type==="add"?Promise.resolve([]):C.getMany({trans:m.trans,keys:_,cache:"immutable"})).then(function(P){var k=w.map(function(I,D){var L,U,B,W=P[D],q={onerror:null,onsuccess:null};return g.type==="delete"?p.fire.call(q,I,W,S):g.type==="add"||W===void 0?(L=b.fire.call(q,I,g.values[D],S),I==null&&L!=null&&(g.keys[D]=I=L,u.outbound||Te(g.values[D],u.keyPath,I))):(L=gi(W,g.values[D]),(U=v.fire.call(q,L,I,W,S))&&(B=g.values[D],Object.keys(U).forEach(function(K){$(B,K)?B[K]=U[K]:Te(B,K,U[K])}))),q});return o.mutate(g).then(function(I){for(var D=I.failures,L=I.results,U=I.numFailures,I=I.lastResult,B=0;B<w.length;++B){var W=(L||w)[B],q=k[B];W==null?q.onerror&&q.onerror(D[B]):q.onsuccess&&q.onsuccess(g.type==="put"&&P[B]?g.values[B]:W)}return{failures:D,results:L,numFailures:U,lastResult:I}}).catch(function(I){return k.forEach(function(D){return D.onerror&&D.onerror(I)}),Promise.reject(I)})})}}})}})}};function Mo(t,i,o){try{if(!i||i.keys.length<t.length)return null;for(var u=[],l=0,f=0;l<i.keys.length&&f<t.length;++l)ae(i.keys[l],t[f])===0&&(u.push(o?Ge(i.values[l]):i.values[l]),++f);return u.length===t.length?u:null}catch{return null}}var oc={stack:"dbcore",level:-1,create:function(t){return{table:function(i){var o=t.table(i);return a(a({},o),{getMany:function(u){if(!u.cache)return o.getMany(u);var l=Mo(u.keys,u.trans._cache,u.cache==="clone");return l?T.resolve(l):o.getMany(u).then(function(f){return u.trans._cache={keys:u.keys,values:u.cache==="clone"?Ge(f):f},f})},mutate:function(u){return u.type!=="add"&&(u.trans._cache=null),o.mutate(u)}})}}}};function Ro(t,i){return t.trans.mode==="readonly"&&!!t.subscr&&!t.trans.explicit&&t.trans.db._options.cache!=="disabled"&&!i.schema.primaryKey.outbound}function jo(t,i){switch(t){case"query":return i.values&&!i.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var ac={stack:"dbcore",level:0,name:"Observability",create:function(t){var i=t.schema.name,o=new Oe(t.MIN_KEY,t.MAX_KEY);return a(a({},t),{transaction:function(u,l,f){if(N.subscr&&l!=="readonly")throw new H.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(N.querier));return t.transaction(u,l,f)},table:function(u){var l=t.table(u),f=l.schema,h=f.primaryKey,g=f.indexes,p=h.extractKey,b=h.outbound,v=h.autoIncrement&&g.filter(function(m){return m.compound&&m.keyPath.includes(h.keyPath)}),A=a(a({},l),{mutate:function(m){function _(K){return K="idb://".concat(i,"/").concat(u,"/").concat(K),I[K]||(I[K]=new Oe)}var S,w,P,k=m.trans,I=m.mutatedParts||(m.mutatedParts={}),D=_(""),L=_(":dels"),U=m.type,q=m.type==="deleteRange"?[m.range]:m.type==="delete"?[m.keys]:m.values.length<50?[yi(h,m).filter(function(K){return K}),m.values]:[],B=q[0],W=q[1],q=m.trans._cache;return O(B)?(D.addKeys(B),(q=U==="delete"||B.length===W.length?Mo(B,q):null)||L.addKeys(B),(q||W)&&(S=_,w=q,P=W,f.indexes.forEach(function(K){var X=S(K.name||"");function Z(te){return te!=null?K.extractKey(te):null}function re(te){return K.multiEntry&&O(te)?te.forEach(function(Ve){return X.addKey(Ve)}):X.addKey(te)}(w||P).forEach(function(te,Pe){var ne=w&&Z(w[Pe]),Pe=P&&Z(P[Pe]);ae(ne,Pe)!==0&&(ne!=null&&re(ne),Pe!=null&&re(Pe))})}))):B?(W={from:B.lower,to:B.upper},L.add(W),D.add(W)):(D.add(o),L.add(o),f.indexes.forEach(function(K){return _(K.name).add(o)})),l.mutate(m).then(function(K){return!B||m.type!=="add"&&m.type!=="put"||(D.addKeys(K.results),v&&v.forEach(function(X){var Z=m.values.map(function(te){return X.extractKey(te)}),re=X.keyPath.findIndex(function(te){return te===h.keyPath});K.results.forEach(function(te){return Z[re]=te}),_(X.name).addKeys(Z)})),k.mutatedParts=fr(k.mutatedParts||{},I),K})}}),g=function(_){var S=_.query,_=S.index,S=S.range;return[_,new Oe((_=S.lower)!==null&&_!==void 0?_:t.MIN_KEY,(S=S.upper)!==null&&S!==void 0?S:t.MAX_KEY)]},C={get:function(m){return[h,new Oe(m.key)]},getMany:function(m){return[h,new Oe().addKeys(m.keys)]},count:g,query:g,openCursor:g};return d(C).forEach(function(m){A[m]=function(_){var S=N.subscr,w=!!S,P=Ro(N,l)&&jo(m,_)?_.obsSet={}:S;if(w){var k=function(W){return W="idb://".concat(i,"/").concat(u,"/").concat(W),P[W]||(P[W]=new Oe)},I=k(""),D=k(":dels"),S=C[m](_),w=S[0],S=S[1];if((m==="query"&&w.isPrimaryKey&&!_.values?D:k(w.name||"")).add(S),!w.isPrimaryKey){if(m!=="count"){var L=m==="query"&&b&&_.values&&l.query(a(a({},_),{values:!1}));return l[m].apply(this,arguments).then(function(W){if(m==="query"){if(b&&_.values)return L.then(function(Z){return Z=Z.result,I.addKeys(Z),W});var q=_.values?W.result.map(p):W.result;(_.values?I:D).addKeys(q)}else if(m==="openCursor"){var K=W,X=_.values;return K&&Object.create(K,{key:{get:function(){return D.addKey(K.primaryKey),K.key}},primaryKey:{get:function(){var Z=K.primaryKey;return D.addKey(Z),Z}},value:{get:function(){return X&&I.addKey(K.primaryKey),K.value}}})}return W})}D.add(o)}}return l[m].apply(this,arguments)}}),A}})}};function No(t,i,o){if(o.numFailures===0)return i;if(i.type==="deleteRange")return null;var u=i.keys?i.keys.length:"values"in i&&i.values?i.values.length:1;return o.numFailures===u?null:(i=a({},i),O(i.keys)&&(i.keys=i.keys.filter(function(l,f){return!(f in o.failures)})),"values"in i&&O(i.values)&&(i.values=i.values.filter(function(l,f){return!(f in o.failures)})),i)}function vi(t,i){return o=t,((u=i).lower===void 0||(u.lowerOpen?0<ae(o,u.lower):0<=ae(o,u.lower)))&&(t=t,(i=i).upper===void 0||(i.upperOpen?ae(t,i.upper)<0:ae(t,i.upper)<=0));var o,u}function Lo(t,i,C,u,l,f){if(!C||C.length===0)return t;var h=i.query.index,p=h.multiEntry,b=i.query.range,v=u.schema.primaryKey.extractKey,A=h.extractKey,g=(h.lowLevelIndex||h).extractKey,C=C.reduce(function(m,_){var S=m,w=_.type==="add"||_.type==="put"?_.values.filter(function(D){return D=A(D),p&&O(D)?D.some(function(L){return vi(L,b)}):vi(D,b)}).map(function(D){return D=Ge(D),f&&Object.freeze(D),D}):[];switch(_.type){case"add":S=m.concat(i.values?w:w.map(function(L){return v(L)}));break;case"put":var P=new Oe().addKeys(_.values.map(function(L){return v(L)})),S=m.filter(function(L){return L=i.values?v(L):L,!lr(new Oe(L),P)}).concat(i.values?w:w.map(function(L){return v(L)}));break;case"delete":var k=new Oe().addKeys(_.keys);S=m.filter(function(L){return L=i.values?v(L):L,!lr(new Oe(L),k)});break;case"deleteRange":var I=_.range;S=m.filter(function(L){return!vi(v(L),I)})}return S},t);return C===t?t:(C.sort(function(m,_){return ae(g(m),g(_))||ae(v(m),v(_))}),i.limit&&i.limit<1/0&&(C.length>i.limit?C.length=i.limit:t.length===i.limit&&C.length<i.limit&&(l.dirty=!0)),f?Object.freeze(C):C)}function Bo(t,i){return ae(t.lower,i.lower)===0&&ae(t.upper,i.upper)===0&&!!t.lowerOpen==!!i.lowerOpen&&!!t.upperOpen==!!i.upperOpen}function sc(t,i){return function(o,u,l,f){if(o===void 0)return u!==void 0?-1:0;if(u===void 0)return 1;if((u=ae(o,u))===0){if(l&&f)return 0;if(l)return 1;if(f)return-1}return u}(t.lower,i.lower,t.lowerOpen,i.lowerOpen)<=0&&0<=function(o,u,l,f){if(o===void 0)return u!==void 0?1:0;if(u===void 0)return-1;if((u=ae(o,u))===0){if(l&&f)return 0;if(l)return-1;if(f)return 1}return u}(t.upper,i.upper,t.upperOpen,i.upperOpen)}function uc(t,i,o,u){t.subscribers.add(o),u.addEventListener("abort",function(){var l,f;t.subscribers.delete(o),t.subscribers.size===0&&(l=t,f=i,setTimeout(function(){l.subscribers.size===0&&ze(f,l)},3e3))})}var cc={stack:"dbcore",level:0,name:"Cache",create:function(t){var i=t.schema.name;return a(a({},t),{transaction:function(o,u,l){var f,h,p=t.transaction(o,u,l);return u==="readwrite"&&(h=(f=new AbortController).signal,l=function(b){return function(){if(f.abort(),u==="readwrite"){for(var v=new Set,A=0,g=o;A<g.length;A++){var C=g[A],m=Pt["idb://".concat(i,"/").concat(C)];if(m){var _=t.table(C),S=m.optimisticOps.filter(function(X){return X.trans===p});if(p._explicit&&b&&p.mutatedParts)for(var w=0,P=Object.values(m.queries.query);w<P.length;w++)for(var k=0,I=(U=P[w]).slice();k<I.length;k++)li((B=I[k]).obsSet,p.mutatedParts)&&(ze(U,B),B.subscribers.forEach(function(X){return v.add(X)}));else if(0<S.length){m.optimisticOps=m.optimisticOps.filter(function(X){return X.trans!==p});for(var D=0,L=Object.values(m.queries.query);D<L.length;D++)for(var U,B,W,q=0,K=(U=L[D]).slice();q<K.length;q++)(B=K[q]).res!=null&&p.mutatedParts&&(b&&!B.dirty?(W=Object.isFrozen(B.res),W=Lo(B.res,B.req,S,_,B,W),B.dirty?(ze(U,B),B.subscribers.forEach(function(X){return v.add(X)})):W!==B.res&&(B.res=W,B.promise=T.resolve({result:W}))):(B.dirty&&ze(U,B),B.subscribers.forEach(function(X){return v.add(X)})))}}}v.forEach(function(X){return X()})}}},p.addEventListener("abort",l(!1),{signal:h}),p.addEventListener("error",l(!1),{signal:h}),p.addEventListener("complete",l(!0),{signal:h})),p},table:function(o){var u=t.table(o),l=u.schema.primaryKey;return a(a({},u),{mutate:function(f){var h=N.trans;if(l.outbound||h.db._options.cache==="disabled"||h.explicit)return u.mutate(f);var p=Pt["idb://".concat(i,"/").concat(o)];return p?(h=u.mutate(f),f.type!=="add"&&f.type!=="put"||!(50<=f.values.length||yi(l,f).some(function(b){return b==null}))?(p.optimisticOps.push(f),f.mutatedParts&&hr(f.mutatedParts),h.then(function(b){0<b.numFailures&&(ze(p.optimisticOps,f),(b=No(0,f,b))&&p.optimisticOps.push(b),f.mutatedParts&&hr(f.mutatedParts))}),h.catch(function(){ze(p.optimisticOps,f),f.mutatedParts&&hr(f.mutatedParts)})):h.then(function(b){var v=No(0,a(a({},f),{values:f.values.map(function(m,g){var C,m=(C=l.keyPath)!==null&&C!==void 0&&C.includes(".")?Ge(m):a({},m);return Te(m,l.keyPath,b.results[g]),m})}),b);p.optimisticOps.push(v),queueMicrotask(function(){return f.mutatedParts&&hr(f.mutatedParts)})}),h):u.mutate(f)},query:function(f){if(!Ro(N,u)||!jo("query",f))return u.query(f);var h=((v=N.trans)===null||v===void 0?void 0:v.db._options.cache)==="immutable",g=N,p=g.requery,b=g.signal,v=function(_,S,w,P){var k=Pt["idb://".concat(_,"/").concat(S)];if(!k)return[];if(!(S=k.queries[w]))return[null,!1,k,null];var I=S[(P.query?P.query.index.name:null)||""];if(!I)return[null,!1,k,null];switch(w){case"query":var D=I.find(function(L){return L.req.limit===P.limit&&L.req.values===P.values&&Bo(L.req.query.range,P.query.range)});return D?[D,!0,k,I]:[I.find(function(L){return("limit"in L.req?L.req.limit:1/0)>=P.limit&&(!P.values||L.req.values)&&sc(L.req.query.range,P.query.range)}),!1,k,I];case"count":return D=I.find(function(L){return Bo(L.req.query.range,P.query.range)}),[D,!!D,k,I]}}(i,o,"query",f),A=v[0],g=v[1],C=v[2],m=v[3];return A&&g?A.obsSet=f.obsSet:(g=u.query(f).then(function(_){var S=_.result;if(A&&(A.res=S),h){for(var w=0,P=S.length;w<P;++w)Object.freeze(S[w]);Object.freeze(S)}else _.result=Ge(S);return _}).catch(function(_){return m&&A&&ze(m,A),Promise.reject(_)}),A={obsSet:f.obsSet,promise:g,subscribers:new Set,type:"query",req:f,dirty:!1},m?m.push(A):(m=[A],(C=C||(Pt["idb://".concat(i,"/").concat(o)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[f.query.index.name||""]=m)),uc(A,m,p,b),A.promise.then(function(_){return{result:Lo(_.result,f,C?.optimisticOps,u,A,h)}})}})}})}};function pr(t,i){return new Proxy(t,{get:function(o,u,l){return u==="db"?i:Reflect.get(o,u,l)}})}var it=(be.prototype.version=function(t){if(isNaN(t)||t<.1)throw new H.Type("Given version is not a positive number");if(t=Math.round(10*t)/10,this.idbdb||this._state.isBeingOpened)throw new H.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,t);var i=this._versions,o=i.filter(function(u){return u._cfg.version===t})[0];return o||(o=new this.Version(t),i.push(o),i.sort(Ju),o.stores({}),this._state.autoSchema=!1,o)},be.prototype._whenReady=function(t){var i=this;return this.idbdb&&(this._state.openComplete||N.letThrough||this._vip)?t():new T(function(o,u){if(i._state.openComplete)return u(new H.DatabaseClosed(i._state.dbOpenError));if(!i._state.isBeingOpened){if(!i._state.autoOpen)return void u(new H.DatabaseClosed);i.open().catch(ie)}i._state.dbReadyPromise.then(o,u)}).then(t)},be.prototype.use=function(t){var i=t.stack,o=t.create,u=t.level,l=t.name;return l&&this.unuse({stack:i,name:l}),t=this._middlewares[i]||(this._middlewares[i]=[]),t.push({stack:i,create:o,level:u??10,name:l}),t.sort(function(f,h){return f.level-h.level}),this},be.prototype.unuse=function(t){var i=t.stack,o=t.name,u=t.create;return i&&this._middlewares[i]&&(this._middlewares[i]=this._middlewares[i].filter(function(l){return u?l.create!==u:!!o&&l.name!==o})),this},be.prototype.open=function(){var t=this;return St(F,function(){return nc(t)})},be.prototype._close=function(){var t=this._state,i=Ft.indexOf(this);if(0<=i&&Ft.splice(i,1),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}t.isBeingOpened||(t.dbReadyPromise=new T(function(o){t.dbReadyResolve=o}),t.openCanceller=new T(function(o,u){t.cancelOpen=u}))},be.prototype.close=function(o){var i=(o===void 0?{disableAutoOpen:!0}:o).disableAutoOpen,o=this._state;i?(o.isBeingOpened&&o.cancelOpen(new H.DatabaseClosed),this._close(),o.autoOpen=!1,o.dbOpenError=new H.DatabaseClosed):(this._close(),o.autoOpen=this._options.autoOpen||o.isBeingOpened,o.openComplete=!1,o.dbOpenError=null)},be.prototype.delete=function(t){var i=this;t===void 0&&(t={disableAutoOpen:!0});var o=0<arguments.length&&typeof arguments[0]!="object",u=this._state;return new T(function(l,f){function h(){i.close(t);var p=i._deps.indexedDB.deleteDatabase(i.name);p.onsuccess=de(function(){var b,v,A;b=i._deps,v=i.name,A=b.indexedDB,b=b.IDBKeyRange,ai(A)||v===Zn||oi(A,b).delete(v).catch(ie),l()}),p.onerror=He(f),p.onblocked=i._fireOnBlocked}if(o)throw new H.InvalidArgument("Invalid closeOptions argument to db.delete()");u.isBeingOpened?u.dbReadyPromise.then(h):h()})},be.prototype.backendDB=function(){return this.idbdb},be.prototype.isOpen=function(){return this.idbdb!==null},be.prototype.hasBeenClosed=function(){var t=this._state.dbOpenError;return t&&t.name==="DatabaseClosed"},be.prototype.hasFailed=function(){return this._state.dbOpenError!==null},be.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(be.prototype,"tables",{get:function(){var t=this;return d(this._allTables).map(function(i){return t._allTables[i]})},enumerable:!1,configurable:!0}),be.prototype.transaction=function(){var t=function(i,o,u){var l=arguments.length;if(l<2)throw new H.InvalidArgument("Too few arguments");for(var f=new Array(l-1);--l;)f[l-1]=arguments[l];return u=f.pop(),[i,Nn(f),u]}.apply(this,arguments);return this._transaction.apply(this,t)},be.prototype._transaction=function(t,i,o){var u=this,l=N.trans;l&&l.db===this&&t.indexOf("!")===-1||(l=null);var f,h,p=t.indexOf("?")!==-1;t=t.replace("!","").replace("?","");try{if(h=i.map(function(v){if(v=v instanceof u.Table?v.name:v,typeof v!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return v}),t=="r"||t===zr)f=zr;else{if(t!="rw"&&t!=Hr)throw new H.InvalidArgument("Invalid transaction mode: "+t);f=Hr}if(l){if(l.mode===zr&&f===Hr){if(!p)throw new H.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");l=null}l&&h.forEach(function(v){if(l&&l.storeNames.indexOf(v)===-1){if(!p)throw new H.SubTransaction("Table "+v+" not included in parent transaction.");l=null}}),p&&l&&!l.active&&(l=null)}}catch(v){return l?l._promise(null,function(A,g){g(v)}):me(v)}var b=function v(A,g,C,m,_){return T.resolve().then(function(){var S=N.transless||N,w=A._createTransaction(g,C,A._dbSchema,m);if(w.explicit=!0,S={trans:w,transless:S},m)w.idbtrans=m.idbtrans;else try{w.create(),w.idbtrans._explicit=!0,A._state.PR1398_maxLoop=3}catch(I){return I.name===en.InvalidState&&A.isOpen()&&0<--A._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),A.close({disableAutoOpen:!1}),A.open().then(function(){return v(A,g,C,null,_)})):me(I)}var P,k=Nt(_);return k&&Bt(),S=T.follow(function(){var I;(P=_.call(w,w))&&(k?(I=lt.bind(null,null),P.then(I,I)):typeof P.next=="function"&&typeof P.throw=="function"&&(P=pi(P)))},S),(P&&typeof P.then=="function"?T.resolve(P).then(function(I){return w.active?I:me(new H.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):S.then(function(){return P})).then(function(I){return m&&w._resolve(),w._completion.then(function(){return I})}).catch(function(I){return w._reject(I),me(I)})})}.bind(null,this,f,h,l,o);return l?l._promise(f,b,"lock"):N.trans?St(N.transless,function(){return u._whenReady(b)}):this._whenReady(b)},be.prototype.table=function(t){if(!$(this._allTables,t))throw new H.InvalidTable("Table ".concat(t," does not exist"));return this._allTables[t]},be);function be(t,i){var o=this;this._middlewares={},this.verno=0;var u=be.dependencies;this._options=i=a({addons:be.addons,autoOpen:!0,indexedDB:u.indexedDB,IDBKeyRange:u.IDBKeyRange,cache:"cloned"},i),this._deps={indexedDB:i.indexedDB,IDBKeyRange:i.IDBKeyRange},u=i.addons,this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var l,f,h,p,b,v={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:ie,dbReadyPromise:null,cancelOpen:ie,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:i.autoOpen};v.dbReadyPromise=new T(function(g){v.dbReadyResolve=g}),v.openCanceller=new T(function(g,C){v.cancelOpen=C}),this._state=v,this.name=t,this.on=on(this,"populate","blocked","versionchange","close",{ready:[Lt,ie]}),this.on.ready.subscribe=Mn(this.on.ready.subscribe,function(g){return function(C,m){be.vip(function(){var _,S=o._state;S.openComplete?(S.dbOpenError||T.resolve().then(C),m&&g(C)):S.onReadyBeingFired?(S.onReadyBeingFired.push(C),m&&g(C)):(g(C),_=o,m||g(function w(){_.on.ready.unsubscribe(C),_.on.ready.unsubscribe(w)}))})}}),this.Collection=(l=this,an(Vu.prototype,function(P,w){this.db=l;var m=yo,_=null;if(w)try{m=w()}catch(k){_=k}var S=P._ctx,w=S.table,P=w.hook.reading.fire;this._ctx={table:w,index:S.index,isPrimKey:!S.index||w.schema.primKey.keyPath&&S.index===w.schema.primKey.name,range:m,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:_,or:S.or,valueMapper:P!==at?P:null}})),this.Table=(f=this,an(wo.prototype,function(g,C,m){this.db=f,this._tx=m,this.name=g,this.schema=C,this.hook=f._allTables[g]?f._allTables[g].hook:on(null,{creating:[Un,ie],reading:[Vr,at],updating:[$n,ie],deleting:[qn,ie]})})),this.Transaction=(h=this,an(Hu.prototype,function(g,C,m,_,S){var w=this;this.db=h,this.mode=g,this.storeNames=C,this.schema=m,this.chromeTransactionDurability=_,this.idbtrans=null,this.on=on(this,"complete","error","abort"),this.parent=S||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new T(function(P,k){w._resolve=P,w._reject=k}),this._completion.then(function(){w.active=!1,w.on.complete.fire()},function(P){var k=w.active;return w.active=!1,w.on.error.fire(P),w.parent?w.parent._reject(P):k&&w.idbtrans&&w.idbtrans.abort(),me(P)})})),this.Version=(p=this,an(tc.prototype,function(g){this.db=p,this._cfg={version:g,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})),this.WhereClause=(b=this,an(xo.prototype,function(g,C,m){if(this.db=b,this._ctx={table:g,index:C===":id"?null:C,or:m},this._cmp=this._ascending=ae,this._descending=function(_,S){return ae(S,_)},this._max=function(_,S){return 0<ae(_,S)?_:S},this._min=function(_,S){return ae(_,S)<0?_:S},this._IDBKeyRange=b._deps.IDBKeyRange,!this._IDBKeyRange)throw new H.MissingAPI})),this.on("versionchange",function(g){0<g.newVersion?console.warn("Another connection wants to upgrade database '".concat(o.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(o.name,"'. Closing db now to resume the delete request.")),o.close({disableAutoOpen:!1})}),this.on("blocked",function(g){!g.newVersion||g.newVersion<g.oldVersion?console.warn("Dexie.delete('".concat(o.name,"') was blocked")):console.warn("Upgrade '".concat(o.name,"' blocked by other connection holding version ").concat(g.oldVersion/10))}),this._maxKey=ln(i.IDBKeyRange),this._createTransaction=function(g,C,m,_){return new o.Transaction(g,C,m,o._options.chromeTransactionDurability,_)},this._fireOnBlocked=function(g){o.on("blocked").fire(g),Ft.filter(function(C){return C.name===o.name&&C!==o&&!C._state.vcFired}).map(function(C){return C.on("versionchange").fire(g)})},this.use(oc),this.use(cc),this.use(ac),this.use(rc),this.use(ic);var A=new Proxy(this,{get:function(g,C,m){if(C==="_vip")return!0;if(C==="table")return function(S){return pr(o.table(S),A)};var _=Reflect.get(g,C,m);return _ instanceof wo?pr(_,A):C==="tables"?_.map(function(S){return pr(S,A)}):C==="_createTransaction"?function(){return pr(_.apply(this,arguments),A)}:_}});this.vip=A,u.forEach(function(g){return g(o)})}var gr,We=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",lc=(mi.prototype.subscribe=function(t,i,o){return this._subscribe(t&&typeof t!="function"?t:{next:t,error:i,complete:o})},mi.prototype[We]=function(){return this},mi);function mi(t){this._subscribe=t}try{gr={indexedDB:c.indexedDB||c.mozIndexedDB||c.webkitIndexedDB||c.msIndexedDB,IDBKeyRange:c.IDBKeyRange||c.webkitIDBKeyRange}}catch{gr={indexedDB:null,IDBKeyRange:null}}function Fo(t){var i,o=!1,u=new lc(function(l){var f=Nt(t),h,p=!1,b={},v={},A={get closed(){return p},unsubscribe:function(){p||(p=!0,h&&h.abort(),g&&dt.storagemutated.unsubscribe(m))}};l.start&&l.start(A);var g=!1,C=function(){return Gr(_)},m=function(S){fr(b,S),li(v,b)&&C()},_=function(){var S,w,P;!p&&gr.indexedDB&&(b={},S={},h&&h.abort(),h=new AbortController,P=function(k){var I=tt();try{f&&Bt();var D=ct(t,k);return D=f?D.finally(lt):D}finally{I&&ut()}}(w={subscr:S,signal:h.signal,requery:C,querier:t,trans:null}),Promise.resolve(P).then(function(k){o=!0,i=k,p||w.signal.aborted||(b={},function(I){for(var D in I)if($(I,D))return;return 1}(v=S)||g||(dt(cn,m),g=!0),Gr(function(){return!p&&l.next&&l.next(k)}))},function(k){o=!1,["DatabaseClosedError","AbortError"].includes(k?.name)||p||Gr(function(){p||l.error&&l.error(k)})}))};return setTimeout(C,0),A});return u.hasValue=function(){return o},u.getValue=function(){return i},u}var Et=it;function bi(t){var i=pt;try{pt=!0,dt.storagemutated.fire(t),di(t,!0)}finally{pt=i}}Y(Et,a(a({},wt),{delete:function(t){return new Et(t,{addons:[]}).delete()},exists:function(t){return new Et(t,{addons:[]}).open().then(function(i){return i.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(t){try{return i=Et.dependencies,o=i.indexedDB,i=i.IDBKeyRange,(ai(o)?Promise.resolve(o.databases()).then(function(u){return u.map(function(l){return l.name}).filter(function(l){return l!==Zn})}):oi(o,i).toCollection().primaryKeys()).then(t)}catch{return me(new H.MissingAPI)}var i,o},defineClass:function(){return function(t){M(this,t)}},ignoreTransaction:function(t){return N.trans?St(N.transless,t):t()},vip:si,async:function(t){return function(){try{var i=pi(t.apply(this,arguments));return i&&typeof i.then=="function"?i:T.resolve(i)}catch(o){return me(o)}}},spawn:function(t,i,o){try{var u=pi(t.apply(o,i||[]));return u&&typeof u.then=="function"?u:T.resolve(u)}catch(l){return me(l)}},currentTransaction:{get:function(){return N.trans||null}},waitFor:function(t,i){return i=T.resolve(typeof t=="function"?Et.ignoreTransaction(t):t).timeout(i||6e4),N.trans?N.trans.waitFor(i):i},Promise:T,debug:{get:function(){return De},set:function(t){Gn(t)}},derive:_e,extend:M,props:Y,override:Mn,Events:on,on:dt,liveQuery:Fo,extendObservabilitySet:fr,getByKeyPath:Ue,setByKeyPath:Te,delByKeyPath:function(t,i){typeof i=="string"?Te(t,i,void 0):"length"in i&&[].map.call(i,function(o){Te(t,o,void 0)})},shallowClone:jn,deepClone:Ge,getObjectDiff:gi,cmp:ae,asap:Rn,minKey:-1/0,addons:[],connections:Ft,errnames:en,dependencies:gr,cache:Pt,semVer:"4.0.7",version:"4.0.7".split(".").map(function(t){return parseInt(t)}).reduce(function(t,i,o){return t+i/Math.pow(10,2*o)})})),Et.maxKey=ln(Et.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(dt(cn,function(t){pt||(t=new CustomEvent(Jr,{detail:t}),pt=!0,dispatchEvent(t),pt=!1)}),addEventListener(Jr,function(t){t=t.detail,pt||bi(t)}));var Ut,pt=!1,Ko=function(){};return typeof BroadcastChannel<"u"&&((Ko=function(){(Ut=new BroadcastChannel(Jr)).onmessage=function(t){return t.data&&bi(t.data)}})(),typeof Ut.unref=="function"&&Ut.unref(),dt(cn,function(t){pt||Ut.postMessage(t)})),typeof addEventListener<"u"&&(addEventListener("pagehide",function(t){if(!it.disableBfCache&&t.persisted){De&&console.debug("Dexie: handling persisted pagehide"),Ut?.close();for(var i=0,o=Ft;i<o.length;i++)o[i].close({disableAutoOpen:!1})}}),addEventListener("pageshow",function(t){!it.disableBfCache&&t.persisted&&(De&&console.debug("Dexie: handling persisted pageshow"),Ko(),bi({all:new Oe(-1/0,[[]])}))})),T.rejectionMapper=function(t,i){return!t||t instanceof Re||t instanceof TypeError||t instanceof SyntaxError||!t.name||!je[t.name]?t:(i=new je[t.name](i||t.message,t),"stack"in t&&ve(i,"stack",{get:function(){return this.inner.stack}}),i)},Gn(De),a(it,Object.freeze({__proto__:null,Dexie:it,liveQuery:Fo,Entity:vo,cmp:ae,PropModSymbol:rt,PropModification:sn,replacePrefix:function(t,i){return new sn({replacePrefix:[t,i]})},add:function(t){return new sn({add:t})},remove:function(t){return new sn({remove:t})},default:it,RangeSet:Oe,mergeRanges:dn,rangesOverlap:lr}),{default:it}),it})})(co);var Xs=co.exports,Ir=Is(Xs);const lo=Symbol.for("Dexie"),Dr=globalThis[lo]||(globalThis[lo]=Ir);if(Ir.semVer!==Dr.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${Ir.semVer} and ${Dr.semVer}`);class Js extends Dr{constructor(e){super("pages_"+e),this.version(2).stores({pages:"id, name, content, document, css, js, document.name, document.headline, document.creator"})}}var Zs=Object.defineProperty,eu=Object.getOwnPropertyDescriptor,tu=(n,e,r,a)=>{for(var s=a>1?void 0:a?eu(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&Zs(e,r,s),s},nu=(n,e)=>(r,a)=>e(r,a,n);let Mr=class{constructor(n){this.pageStorageMap=new Map,this.logger=n,this.logger.setModule("storage.components.dexieOfflineStorage")}getPageStorage(n){let e=this.pageStorageMap.get(n);return e==null&&(e=new Js(n),this.pageStorageMap.set(n,e)),e}async getPage(n,e){try{this.logger.debug("Ready to load page from local storage",e);const r=this.getPageStorage(n);this.logger.debug("pageStorage is ready, asking for page");const a=await r.pages.get(e),s=new Dt;return s.fromObject(a),s}catch(r){this.logger.debug("Exception while trying to read from local storage",r);return}}async savePage(n,e,r){try{await this.getPageStorage(n).pages.put(r.toObject(),e)}catch(a){this.logger.debug("Exception while trying to store in local storage",n,e,r,a)}}async updatePage(n,e,r){try{const a=this.getPageStorage(n);this.logger.debug("Ready to store",r),await a.pages.update(e,r.toObject())}catch(a){this.logger.debug("Exception while trying to store in local storage",n,e,r,a)}}};Mr=tu([xe(),nu(0,we("Logger"))],Mr);var ru=Object.defineProperty,iu=Object.getOwnPropertyDescriptor,ou=(n,e,r,a)=>{for(var s=a>1?void 0:a?iu(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&ru(e,r,s),s},Rr=(n,e)=>(r,a)=>e(r,a,n);let jr=class{constructor(n,e,r){this.logger=n,this.logger.setModule("storage.components.wrappingOfflineStorage"),this.offlineStorage=e,this.queueWorker=r}setStorage(n){this.storage=n}getStorage(){return this.storage}setWikiConfig(n){return this.storage.setWikiConfig(n)}getWikiConfig(){return this.storage.getWikiConfig()}async isStorageReady(){return this.storage.isStorageReady()}getPageRestURL(n,e){return this.storage.getPageRestURL(n,e)}getPageFromViewURL(n){return this.storage.getPageFromViewURL(n)}getImageURL(n,e){return this.storage.getImageURL(n,e)}async getPageContent(n,e,r){if(this.logger.debug("Trying to get data for page ",n),this.offlineStorage){this.logger.debug("Asking offline storage for ",n);const a=await this.offlineStorage.getPage(this.getWikiConfig().name,n+"_"+e);return a!=null&&a!=null?(this.logger.debug("Loading data from local storage for page",n),(r==null||r)&&this.queueWorker.addToQueue(this.getWikiConfig().name+":"+n+"_"+e),a):(this.logger.debug("Could not find data in local storage for page",n),this.savePageContent(n,e))}else return this.logger.debug("No offline local storage available"),this.storage.getPageContent(n,e)}getAttachments(n){return this.storage.getAttachments(n)}async savePageContent(n,e){const r=await this.storage.getPageContent(n,e);if(r)return r.id=n+"_"+e,this.logger.debug("Saving page to offline storage",n),this.offlineStorage.savePage(this.getWikiConfig().name,n+"_"+e,r),r;throw new Error("Can't save missing page.")}async updatePageContent(n,e){const r=await this.offlineStorage.getPage(this.getWikiConfig().name,n+"_"+e),a=await this.storage.getPageContent(n,e);return r&&a?(a.id=n+"_"+e,this.logger.debug("Saving page to offline storage",n),this.offlineStorage.savePage(this.getWikiConfig().name,n+"_"+e,a),!0):r?.version!=a?.version&&a?(a.id=n+"_"+e,this.logger.debug("Updating page to offline storage",n),this.offlineStorage.updatePage(this.getWikiConfig().name,n+"_"+e,a),!0):(this.logger.debug("Local storage not updated, because version are identical"),!1)}async getPanelContent(n,e,r){return this.storage.getPanelContent(n,e,r)}async getEditField(n,e){return await this.storage.getEditField(n,e)}save(n,e,r,a){return this.storage.save(n,e,r,a)}async saveAttachments(n,e){return this.storage.saveAttachments(n,e)}};jr=ou([xe(),Rr(0,we("Logger")),Rr(1,we("OfflineStorage")),Rr(2,we("QueueWorker"))],jr);let au=class{constructor(e){e.bind("WrappingStorage").to(jr).inSingletonScope(),e.bind("OfflineStorage").to(Mr).inSingletonScope()}};var su=Object.defineProperty,uu=Object.getOwnPropertyDescriptor,cu=(n,e,r,a)=>{for(var s=a>1?void 0:a?uu(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&su(e,r,s),s},kn=(n,e)=>(r,a)=>e(r,a,n);let Nr=class extends Xt{constructor(n,e,r){super(n),this.storage=e,this.cristal=r,this.storage.setWikiConfig(this),this.homePage==""&&(this.homePage="README.md")}defaultPageName(){return"README"}getType(){return"GitHub"}};Nr=cu([xe(),kn(0,we("Logger")),kn(1,we("Storage")),kn(1,Or("GitHub")),kn(2,we("CristalApp"))],Nr);var lu=Object.defineProperty,fu=Object.getOwnPropertyDescriptor,hu=(n,e,r,a)=>{for(var s=a>1?void 0:a?fu(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&lu(e,r,s),s},du=(n,e)=>(r,a)=>e(r,a,n);let Zt=class{constructor(n,e){this.logger=n,this.logger.setModule(e)}setWikiConfig(n){this.logger.debug("Setting wiki Config: ",n),this.wikiConfig=n}getWikiConfig(){return this.wikiConfig}};Zt=hu([xe(),du(0,ks())],Zt);var pu=Object.defineProperty,gu=Object.getOwnPropertyDescriptor,yu=(n,e,r,a)=>{for(var s=a>1?void 0:a?gu(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&pu(e,r,s),s},vu=(n,e)=>(r,a)=>e(r,a,n);let Lr=class extends Zt{constructor(n){super(n,"storage.components.githubStorage"),this.hashCode=function(e){let r=0,a,s;if(e.length===0)return""+r;for(a=0;a<e.length;a++)s=e.charCodeAt(a),r=(r<<5)-r+s,r|=0;return""+r}}async isStorageReady(){return!0}getPageRestURL(n,e){return this.logger?.debug("GitHub Loading page",n),this.wikiConfig.baseRestURL+n}getPageFromViewURL(n){let e=null;return n.startsWith(this.wikiConfig.baseURL)&&(e=n.replace(this.wikiConfig.baseURL,"")),e}getImageURL(n,e){return this.wikiConfig.baseRestURL+decodeURIComponent(e)}async getPageContent(n,e){this.logger?.debug("GitHub Loading page",n);const r=decodeURIComponent(n),a=this.getPageRestURL(r,e),c=await(await fetch(a,{cache:"no-store"})).text();let d="";e=="json"?d="":e=="md"||e=="html"?d=c:d="";const O=new Dt;return O.id=r,O.name=r.split("/").pop(),O.source=d,O.syntax="md",O.css=[],O.version=this.hashCode(d),O}getAttachments(){throw new Error("unsupported")}async getPanelContent(){return new Dt}async getEditField(){return""}save(){throw new Error("Save not supported")}async saveAttachments(){throw new Error("unsupported")}};Lr=yu([xe(),vu(0,we("Logger"))],Lr);let mu=class{constructor(e){e.bind("WikiConfig").to(Nr).whenTargetNamed("GitHub"),e.bind("Storage").to(Lr).whenTargetNamed("GitHub")}};var bu=Object.defineProperty,wu=Object.getOwnPropertyDescriptor,_u=(n,e,r,a)=>{for(var s=a>1?void 0:a?wu(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&bu(e,r,s),s},In=(n,e)=>(r,a)=>e(r,a,n);let Br=class extends Xt{constructor(n,e,r){super(n),this.cristal=r,this.storage=e,this.storage.setWikiConfig(this)}isSupported(n){return n=="html"}defaultPageName(){return"home"}};Br=_u([xe(),In(0,we("Logger")),In(1,we("Storage")),In(1,Or("Nextcloud")),In(2,we("CristalApp"))],Br);var Au=Object.defineProperty,Cu=Object.getOwnPropertyDescriptor,Su=(n,e,r,a)=>{for(var s=a>1?void 0:a?Cu(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&Au(e,r,s),s},xu=(n,e)=>(r,a)=>e(r,a,n);let Fr=class extends Zt{constructor(n){super(n,"storage.components.nextcloudStorage"),this.ATTACHMENTS="attachments"}async getEditField(){return""}getImageURL(){return""}async getPageContent(n){const e=this.getWikiConfig().baseRestURL,r=this.getBaseHeaders();try{const a=await fetch(`${e}/.cristal/${n}/page.json`,{method:"GET",headers:r});if(a.status>=200&&a.status<300){const s=await a.json();return{...s,headline:s.name,headlineRaw:s.name}}else return}catch{return}}async getAttachments(n){const e=await fetch(this.getAttachmentsBasePath(n),{method:"PROPFIND",headers:{...this.getBaseHeaders(),Depth:"1",Accept:"application/json"}});if(e.status>=200&&e.status<300){const r=await e.text(),s=new window.DOMParser().parseFromString(r,"text/xml").getElementsByTagName("d:response"),c=[];for(let d=0;d<s.length;d++){const O=s[d];if(O.getElementsByTagName("d:getcontenttype").length>0){const M=O.getElementsByTagName("d:href")[0].textContent,y=O.getElementsByTagName("d:getcontenttype")[0].textContent,j=M.split("/"),$=`${this.getWikiConfig().baseRestURL}/${j.slice(5).join("/")}`,Y=j[j.length-1];c.push({mimetype:y,reference:Y,id:M,href:$})}}return{attachments:c}}else return}getAttachmentsBasePath(n){return`${this.getWikiConfig().baseRestURL}/.cristal/${n}/${this.ATTACHMENTS}`}async save(n,e,r){const a=n.split("/"),s=`${this.getWikiConfig().baseRestURL}/.cristal`;await this.createIntermediateDirectories(s,a),await fetch(`${s}/${a.join("/")}/page.json`,{method:"PUT",headers:this.getBaseHeaders(),body:JSON.stringify({source:e,name:r,syntax:"markdown/1.2"})})}async createIntermediateDirectories(n,e){await this.createDirectory(n);for(let r=0;r<e.length;r++)await this.createDirectory(`${n}/${e.slice(0,r+1).join("/")}`)}async saveAttachments(n,e){return Promise.all(e.map(r=>this.saveAttachment(n,r)))}async saveAttachment(n,e){const r=n.split("/"),a=`${this.getWikiConfig().baseRestURL}/.cristal`;await this.createIntermediateDirectories(a,[...r,this.ATTACHMENTS]);const s=this.getAttachmentsBasePath(n)+"/"+e.name,c=new FormData;c.append(e.name,e),await fetch(s,{method:"PUT",headers:this.getBaseHeaders(),body:c})}getPageFromViewURL(){return null}getPageRestURL(){return""}async getPanelContent(){return new Dt}async isStorageReady(){return!0}async createDirectory(n){await fetch(n,{method:"MKCOL",headers:this.getBaseHeaders()})}getBaseHeaders(){return{Authorization:`Basic ${btoa("test:test")}`}}};Fr=Su([xe(),xu(0,we("Logger"))],Fr);let Ou=class{constructor(e){e.bind("WikiConfig").to(Br).whenTargetNamed("Nextcloud"),e.bind("Storage").to(Fr).whenTargetNamed("Nextcloud")}};var Pu=Object.defineProperty,Eu=Object.getOwnPropertyDescriptor,Tu=(n,e,r,a)=>{for(var s=a>1?void 0:a?Eu(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&Pu(e,r,s),s},Dn=(n,e)=>(r,a)=>e(r,a,n);let Kr=class extends Xt{constructor(n,e,r){super(n),this.cristal=r,this.storage=e,this.storage.setWikiConfig(this),this.homePage==""&&(this.homePage="Main.WebHome")}isSupported(n){return n=="html"||n=="jsonld"}defaultPageName(){return"Main.WebHome"}getType(){return"XWiki"}};Kr=Tu([xe(),Dn(0,we("Logger")),Dn(1,we("Storage")),Dn(1,Or("XWiki")),Dn(2,we("CristalApp"))],Kr);var ku=Object.defineProperty,Iu=Object.getOwnPropertyDescriptor,Du=(n,e,r,a)=>{for(var s=a>1?void 0:a?Iu(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&ku(e,r,s),s},Mu=(n,e)=>(r,a)=>e(r,a,n);let Wr=class extends Zt{constructor(n){super(n,"storage.components.xwikiStorage")}async isStorageReady(){return!0}getPageRestURL(n,e){return this.logger?.debug("XWiki Loading page",n),this.wikiConfig.baseURL+this.wikiConfig.baseRestURL+"&page="+n+"&format="+e}getPageFromViewURL(n){let e;return n.startsWith(this.wikiConfig.baseURL)?(e=n.replace(this.wikiConfig.baseURL,"").replace("/bin","").replace("/view/","").replaceAll("%5C","%5C%5C").replaceAll(".","%5C.").replaceAll("/","."),e.endsWith(".")&&(e+="WebHome")):e=null,e}getImageURL(n,e){n==""&&(n="Main.WebHome");const r=this.wikiConfig.baseURL+"/bin/download/"+n.replace(".","/")+"/"+e;return this.logger?.debug("final image url ",r),r}async getPageContent(n,e){this.logger?.debug("XWiki Loading page",n),n==""&&(n="Main.WebHome");const r=this.getPageRestURL(n,e);this.logger?.debug("XWiki Loading url",r);const s=await(await fetch(r,{cache:"no-store"})).json();let c="",d="",O={};e=="jsonld"?(O=s,this.wikiConfig.serverRendering?(this.logger?.debug("Using server side rendering for jsonld"),c=s.source,d=s.html):(this.logger?.debug("Using client side rendering for jsonld"),c=s.source,d="")):e=="html"?this.wikiConfig.serverRendering?(this.logger?.debug("Using server side rendering for html"),c=s.source,d=""):(this.logger?.debug("Using client side rendering for html"),c=s.source,d=""):(c="",d="");const M=new Dt;return M.source=c,M.syntax="xwiki",M.html=d,M.document=new Tr(O),M.css=s.css,M.js=s.js,M.version=M.document.get("version"),M.headlineRaw=s.headlineRaw,M.headline=s.headline,M.name=s.name,M}async getAttachments(n){return{attachments:(await(await fetch(this.buildAttachmentsURL(n),{headers:{Accept:"application/json",...this.getCredentials()}})).json()).attachments.map(({id:s,name:c,mimeType:d,xwikiAbsoluteUrl:O})=>({id:s,reference:c,mimetype:d,href:O}))}}async getPanelContent(n,e){const r=this.wikiConfig.baseURL+"/rest/cristal/panel?media=json&page="+e+"&panel="+n;this.logger?.debug("XWiki Loading url",r);const s=await(await fetch(r,{cache:"no-store"})).json(),c=new Dt;return c.source=s.source,c.syntax="xwiki",c.html=s.content,c.css=s.css,c.js=s.js,c}async getEditField(n,e){try{const r=n.get("xwikiMapping")[e];let a=r.type,s=r.fieldName;a==null&&(a="document"),s==null&&(s=e);const c=this.wikiConfig.baseURL+"/bin/get/"+n.getIdentifier().replaceAll(".","/")+"?xpage=display&mode=edit&type="+a+"&property="+n.get("className")+"."+s;return this.logger?.debug("XWiki Loading Field url",c),await(await fetch(c,{cache:"no-store"})).text()}catch(r){return this.logger?.error("Exception looking for edit field for field",e,r),""}}async save(n,e,r){const a=this.buildSavePageURL(n,["rest","wikis","xwiki"]);await fetch(a,{method:"PUT",headers:{"Content-Type":"application/json",...this.getCredentials()},body:JSON.stringify({content:e,title:r,syntax:"markdown/1.2"})})}async saveAttachments(n,e){return Promise.all(e.map(r=>this.saveAttachment(n,r)))}async saveAttachment(n,e){const r=new FormData;r.append(e.name,e),await fetch(this.buildAttachmentsURL(n)+"/"+e.name,{method:"PUT",body:r,headers:{...this.getCredentials(),"Content-Type":e.type}})}getCredentials(){return{Authorization:`Basic ${btoa("Admin:admin")}`}}buildSavePageURL(n,e){const r=this.wikiConfig.baseURL,a=n.split(".");for(let s=0;s<a.length;s++){const c=s<a.length-1?"spaces":"pages";e.push(c),e.push(a[s])}return`${r}/${e.join("/")}`}buildAttachmentsURL(n){const e=n.split("."),r=e.length-1,a=e.splice(0,r).join("/spaces/"),s=e[r]||"WebHome";return`${this.wikiConfig.baseURL}/rest/wikis/xwiki/spaces/${a}/pages/${s}/attachments`}};Wr=Du([xe(),Mu(0,we("Logger"))],Wr);class Ru{constructor(e){e.bind("WikiConfig").to(Kr).whenTargetNamed("XWiki"),e.bind("Storage").to(Wr).whenTargetNamed("XWiki")}}var ju=Object.defineProperty,Nu=Object.getOwnPropertyDescriptor,Lu=(n,e,r,a)=>{for(var s=a>1?void 0:a?Nu(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&ju(e,r,s),s};let Ur=class{constructor(){this.availableConfigurations=new Map}getApp(){throw new Error("Method not implemented.")}getRouter(){throw new Error("Method not implemented.")}getContainer(){return this.container}setContainer(n){this.container=n}getWikiConfig(){return this.wikiConfig}setWikiConfig(n){this.wikiConfig=n}getSkinManager(){throw new Error("Method not implemented.")}switchConfig(){}setAvailableConfigurations(n){console.log(n),n.forEach((e,r)=>{const a=e?.configType;if(e){const s=this.container.getNamed("WikiConfig",a);s.setConfigFromObject(e),this.availableConfigurations.set(r,s)}})}getAvailableConfigurations(){return this.availableConfigurations}run(){throw new Error("Method not implemented.")}getUIXTemplates(){throw new Error("Method not implemented.")}getMenuEntries(){throw new Error("Method not implemented.")}getCurrentPage(){throw new Error("Method not implemented.")}getCurrentContent(){throw new Error("Method not implemented.")}getCurrentSource(){throw new Error("Method not implemented.")}getCurrentSyntax(){throw new Error("Method not implemented.")}setCurrentPage(){throw new Error("Method not implemented.")}setContentRef(){throw new Error("Method not implemented.")}loadPageFromURL(){throw new Error("Method not implemented.")}loadPage(){throw new Error("Method not implemented.")}getPage(){throw new Error("Method not implemented.")}getLogger(){throw new Error("Method not implemented.")}getLoggerConfig(){throw new Error("Method not implemented.")}renderContent(){throw new Error("Method not implemented.")}};Ur=Lu([xe()],Ur);var Bu=Object.defineProperty,Fu=Object.getOwnPropertyDescriptor,Ku=(n,e,r,a)=>{for(var s=a>1?void 0:a?Fu(e,r):e,c=n.length-1,d;c>=0;c--)(d=n[c])&&(s=(a?d(e,r,s):d(s))||s);return a&&s&&Bu(e,r,s),s};let qr=class{constructor(){this.initialize()}initialize(){}getStatus(){return!0}async increment(){return 0}async addToQueue(){}async getQueueSize(){return 0}};qr=Ku([xe()],qr);class Wu{constructor(){this.currentNumber=0,this.queue=[],this.initialized=!1}async start(){for(console.log("Starting worker thread"),this.initialize();;)await this.sleep(1e3),this.checkQueue()}setPageLoadedCallback(e){this.fct=e}sleep(e){return new Promise(r=>setTimeout(r,e))}async checkQueue(){if(this.getQueueSize()>0)if(this.initialized){const r=this.queue.pop();r&&await this.handleQueueItem(r),await this.checkQueue()}else console.log("Worker cristal code not initialized yet. Cannot process queue items.")}async handleQueueItem(e){console.log("Handling queue item code ready to process",e);try{let r=null,a=null,s=null;const c=e.indexOf(":"),d=e.lastIndexOf("_");if(c!=-1&&d!=-1){r=e.substring(0,c),a=e.substring(c+1,d),s=e.substring(d+1);const O=this.getWikiConfig(r);O==null?console.log("Could not find config for page",e):(console.log("Updating page ",a,s),await O.storage.updatePageContent(a,s)&&(console.log("Page updated. Calling back to main thread"),this.fct(e)))}else console.log("Could not process page",e)}catch(r){console.log("Exception while trying to load",e,r)}}add(e){return console.log("Worker in add"),this.currentNumber+=e,this.currentNumber}addToQueue(e){console.log("Worker in addToQueue",e),this.queue.includes(e)||this.queue.push(e)}getQueueSize(){return console.log("Worker in getQueueSize"),this.queue.length}getWikiConfig(e){const r=this.configMap.get(e);if(r==null){console.error("Failed to find wikiConfig for configName",e);return}const s=new Map(Object.entries(r)).get("configType");console.log("Looking for wikiConfig for name",e,"and type",s);let c;try{return c=this.container.getNamed("WikiConfig",s),this.cristal.setWikiConfig(c),c.setConfigFromObject(r),c.initialize(),console.debug("Found wikiConfig for",e,"and type",s,":",c),c}catch(d){console.error("Failed to find wikiConfig for name",e,"and type",s,d);return}}async initialize(){console.log("Starting initialize");const e=["storage"],a=await(await fetch("/config.json")).json();this.configMap=new Map(Object.entries(a)),console.log("Loaded json config",this.configMap);const s=new Qs(e);s.initializeContainer(),this.container=s.container,console.log("Container status",this.container),this.container.bind("CristalApp").to(Ur).inSingletonScope(),this.container.bind("QueueWorker").to(qr).inSingletonScope(),this.cristal=this.container.get("CristalApp"),this.cristal.setContainer(this.container),console.log("Container status",this.container),new au(s.container),new mu(s.container),new Ou(s.container),new Ru(s.container),console.log("Loading storage components"),this.initialized=!0,console.log("Finished initialize")}}const fo=new Wu;fo.start(),onconnect=n=>{mr(fo,n.ports[0])},console.log("Worker code loaded")})();
27
+ //# sourceMappingURL=worker-CeXgpy1V.js.map