@nylas/web-elements 1.4.5 → 2.0.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 (165) hide show
  1. package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +179 -146
  2. package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +4998 -4993
  3. package/dist/cjs/calendar-agenda-fill-icon_36.cjs.entry.js +4 -4
  4. package/dist/cjs/checkmark-icon_15.cjs.entry.js +4 -4
  5. package/dist/cjs/checkmark-icon_15.cjs.entry.js.map +1 -1
  6. package/dist/cjs/{constants-3b9fb535.js → constants-27331d2d.js} +1 -5
  7. package/dist/cjs/constants-27331d2d.js.map +1 -0
  8. package/dist/cjs/{customParseFormat-4dbd51f6.js → customParseFormat-22da9017.js} +2 -2
  9. package/dist/cjs/{customParseFormat-4dbd51f6.js.map → customParseFormat-22da9017.js.map} +1 -1
  10. package/dist/cjs/{feedbackSync-670798db.js → feedbackSync-adabe7d6.js} +2 -2
  11. package/dist/cjs/{feedbackSync-670798db.js.map → feedbackSync-adabe7d6.js.map} +1 -1
  12. package/dist/cjs/globe-icon_2.cjs.entry.js +3 -3
  13. package/dist/cjs/google-logo-icon_6.cjs.entry.js +49 -25
  14. package/dist/cjs/google-logo-icon_6.cjs.entry.js.map +1 -1
  15. package/dist/cjs/index.cjs.js +2 -2
  16. package/dist/cjs/{index.es-cbc1ecb6.js → index.es-7848228a.js} +2 -2
  17. package/dist/cjs/{index.es-cbc1ecb6.js.map → index.es-7848228a.js.map} +1 -1
  18. package/dist/cjs/input-component.cjs.entry.js +1 -1
  19. package/dist/cjs/input-dropdown_2.cjs.entry.js +2 -2
  20. package/dist/cjs/loader.cjs.js +1 -1
  21. package/dist/cjs/multi-select-dropdown_2.cjs.entry.js +1 -1
  22. package/dist/cjs/{nylas-api-request-af6121b4.js → nylas-api-request-976db0f4.js} +2 -2
  23. package/dist/cjs/{nylas-api-request-af6121b4.js.map → nylas-api-request-976db0f4.js.map} +1 -1
  24. package/dist/cjs/nylas-booked-event-card_12.cjs.entry.js +3 -3
  25. package/dist/cjs/nylas-event-calendar_3.cjs.entry.js +4 -4
  26. package/dist/cjs/nylas-form-card.cjs.entry.js +2 -2
  27. package/dist/cjs/nylas-scheduler-editor.cjs.entry.js +22 -16
  28. package/dist/cjs/nylas-scheduler-editor.cjs.entry.js.map +1 -1
  29. package/dist/cjs/nylas-scheduling.cjs.entry.js +7 -7
  30. package/dist/cjs/nylas-web-elements.cjs.js +1 -1
  31. package/dist/cjs/{register-component-5e87c463.js → register-component-d2f37e40.js} +2 -2
  32. package/dist/cjs/{register-component-5e87c463.js.map → register-component-d2f37e40.js.map} +1 -1
  33. package/dist/cjs/textarea-component.cjs.entry.js +1 -1
  34. package/dist/cjs/{utils-0dfca9ec.js → utils-d522ef01.js} +10 -1
  35. package/dist/cjs/utils-d522ef01.js.map +1 -0
  36. package/dist/collection/common/constants.js +0 -1
  37. package/dist/collection/common/constants.js.map +1 -1
  38. package/dist/collection/components/scheduler/nylas-scheduling/nylas-scheduling.js +1 -1
  39. package/dist/collection/components/scheduler-editor/nylas-editor-tabs-group/nylas-editor-tabs-group.js +6 -7
  40. package/dist/collection/components/scheduler-editor/nylas-editor-tabs-group/nylas-editor-tabs-group.js.map +1 -1
  41. package/dist/collection/components/scheduler-editor/nylas-event-description/nylas-event-description.js +1 -1
  42. package/dist/collection/components/scheduler-editor/nylas-event-description/nylas-event-description.js.map +1 -1
  43. package/dist/collection/components/scheduler-editor/nylas-list-configurations/nylas-list-configurations.js +6 -3
  44. package/dist/collection/components/scheduler-editor/nylas-list-configurations/nylas-list-configurations.js.map +1 -1
  45. package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/ExpressFlow.js +4 -5
  46. package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/ExpressFlow.js.map +1 -1
  47. package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/nylas-scheduler-editor.css +0 -8
  48. package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/nylas-scheduler-editor.js +43 -10
  49. package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/nylas-scheduler-editor.js.map +1 -1
  50. package/dist/collection/components/scheduler-editor/nylas-select-event-type/nylas-select-event-type.js +52 -7
  51. package/dist/collection/components/scheduler-editor/nylas-select-event-type/nylas-select-event-type.js.map +1 -1
  52. package/dist/collection/components/scheduler-editor/nylas-timeslot-interval/nylas-timeslot-interval.js +1 -1
  53. package/dist/collection/stores/scheduler-config-store.js.map +1 -1
  54. package/dist/components/constants.js +1 -5
  55. package/dist/components/constants.js.map +1 -1
  56. package/dist/components/nylas-editor-tabs-group2.js +8 -9
  57. package/dist/components/nylas-editor-tabs-group2.js.map +1 -1
  58. package/dist/components/nylas-editor-tabs2.js +2 -2
  59. package/dist/components/nylas-event-description2.js +1 -1
  60. package/dist/components/nylas-event-description2.js.map +1 -1
  61. package/dist/components/nylas-list-configurations2.js +6 -3
  62. package/dist/components/nylas-list-configurations2.js.map +1 -1
  63. package/dist/components/nylas-scheduler-editor.js +22 -14
  64. package/dist/components/nylas-scheduler-editor.js.map +1 -1
  65. package/dist/components/nylas-scheduling.js +3 -3
  66. package/dist/components/nylas-select-event-type2.js +32 -8
  67. package/dist/components/nylas-select-event-type2.js.map +1 -1
  68. package/dist/components/nylas-timeslot-interval2.js +1 -1
  69. package/dist/components/utils.js +9 -0
  70. package/dist/components/utils.js.map +1 -1
  71. package/dist/esm/calendar-agenda-fill-icon_36.entry.js +4 -4
  72. package/dist/esm/checkmark-icon_15.entry.js +4 -4
  73. package/dist/esm/checkmark-icon_15.entry.js.map +1 -1
  74. package/dist/esm/{constants-3d8016e3.js → constants-f51538ef.js} +2 -6
  75. package/dist/esm/constants-f51538ef.js.map +1 -0
  76. package/dist/esm/{customParseFormat-129be926.js → customParseFormat-d1de5ed0.js} +2 -2
  77. package/dist/esm/{customParseFormat-129be926.js.map → customParseFormat-d1de5ed0.js.map} +1 -1
  78. package/dist/esm/{feedbackSync-d943ffc7.js → feedbackSync-172f942c.js} +2 -2
  79. package/dist/esm/{feedbackSync-d943ffc7.js.map → feedbackSync-172f942c.js.map} +1 -1
  80. package/dist/esm/globe-icon_2.entry.js +3 -3
  81. package/dist/esm/google-logo-icon_6.entry.js +49 -25
  82. package/dist/esm/google-logo-icon_6.entry.js.map +1 -1
  83. package/dist/esm/{index.es-4615d47c.js → index.es-fc8588de.js} +2 -2
  84. package/dist/esm/{index.es-4615d47c.js.map → index.es-fc8588de.js.map} +1 -1
  85. package/dist/esm/index.js +2 -2
  86. package/dist/esm/input-component.entry.js +1 -1
  87. package/dist/esm/input-dropdown_2.entry.js +2 -2
  88. package/dist/esm/loader.js +1 -1
  89. package/dist/esm/multi-select-dropdown_2.entry.js +1 -1
  90. package/dist/esm/{nylas-api-request-acf12b47.js → nylas-api-request-3d7ced61.js} +2 -2
  91. package/dist/esm/{nylas-api-request-acf12b47.js.map → nylas-api-request-3d7ced61.js.map} +1 -1
  92. package/dist/esm/nylas-booked-event-card_12.entry.js +3 -3
  93. package/dist/esm/nylas-event-calendar_3.entry.js +4 -4
  94. package/dist/esm/nylas-form-card.entry.js +2 -2
  95. package/dist/esm/nylas-scheduler-editor.entry.js +22 -16
  96. package/dist/esm/nylas-scheduler-editor.entry.js.map +1 -1
  97. package/dist/esm/nylas-scheduling.entry.js +7 -7
  98. package/dist/esm/nylas-web-elements.js +1 -1
  99. package/dist/esm/{register-component-083eb961.js → register-component-62d792d4.js} +2 -2
  100. package/dist/esm/{register-component-083eb961.js.map → register-component-62d792d4.js.map} +1 -1
  101. package/dist/esm/textarea-component.entry.js +1 -1
  102. package/dist/esm/{utils-6c05ecaf.js → utils-bb88dd4d.js} +10 -1
  103. package/dist/esm/utils-bb88dd4d.js.map +1 -0
  104. package/dist/nylas-web-elements/index.esm.js +1 -1
  105. package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
  106. package/dist/nylas-web-elements/nylas-web-elements.esm.js.map +1 -1
  107. package/dist/nylas-web-elements/{p-865721fd.entry.js → p-05204c68.entry.js} +2 -2
  108. package/dist/nylas-web-elements/{p-2b38054f.entry.js → p-0d422938.entry.js} +2 -2
  109. package/dist/nylas-web-elements/{p-c59787f4.js → p-0d6ecada.js} +2 -2
  110. package/dist/nylas-web-elements/{p-e2632a60.js → p-198f05a6.js} +2 -2
  111. package/dist/nylas-web-elements/p-1d8c55c6.entry.js +11 -0
  112. package/dist/nylas-web-elements/p-1d8c55c6.entry.js.map +1 -0
  113. package/dist/nylas-web-elements/{p-4e1e01e4.entry.js → p-29f601d9.entry.js} +2 -2
  114. package/dist/nylas-web-elements/{p-60b48bf7.js → p-3a3c5e17.js} +2 -2
  115. package/dist/nylas-web-elements/{p-6bb6a0b8.entry.js → p-447837c2.entry.js} +2 -2
  116. package/dist/nylas-web-elements/{p-faa723fc.entry.js → p-49c8d4d9.entry.js} +2 -2
  117. package/dist/nylas-web-elements/p-49c8d4d9.entry.js.map +1 -0
  118. package/dist/nylas-web-elements/p-7e885253.js +2 -0
  119. package/dist/nylas-web-elements/p-7e885253.js.map +1 -0
  120. package/dist/nylas-web-elements/{p-3cc1072e.js → p-84109239.js} +2 -2
  121. package/dist/nylas-web-elements/{p-d16cd88b.entry.js → p-a7d2a211.entry.js} +2 -2
  122. package/dist/nylas-web-elements/{p-bea31f39.entry.js → p-a9107606.entry.js} +2 -2
  123. package/dist/nylas-web-elements/p-a9107606.entry.js.map +1 -0
  124. package/dist/nylas-web-elements/{p-a9a0dd64.entry.js → p-ab96941e.entry.js} +2 -2
  125. package/dist/nylas-web-elements/{p-6fc7d11b.entry.js → p-af94512e.entry.js} +3 -3
  126. package/dist/nylas-web-elements/{p-bfe2bdbd.js → p-b3ca5d4d.js} +2 -2
  127. package/dist/nylas-web-elements/{p-80d57b5a.entry.js → p-cd24a45e.entry.js} +2 -2
  128. package/dist/nylas-web-elements/{p-6364eb02.entry.js → p-e9369c76.entry.js} +2 -2
  129. package/dist/nylas-web-elements/{p-b2241c3c.entry.js → p-f00d1bb3.entry.js} +2 -2
  130. package/dist/nylas-web-elements/p-f73e34dd.js +14 -0
  131. package/dist/nylas-web-elements/{p-2b97a896.js.map → p-f73e34dd.js.map} +1 -1
  132. package/dist/types/common/constants.d.ts +216 -1
  133. package/dist/types/components/scheduler-editor/nylas-editor-tabs-group/nylas-editor-tabs-group.d.ts +0 -2
  134. package/dist/types/components/scheduler-editor/nylas-scheduler-editor/ExpressFlow.d.ts +1 -2
  135. package/dist/types/components/scheduler-editor/nylas-scheduler-editor/nylas-scheduler-editor.d.ts +3 -1
  136. package/dist/types/components/scheduler-editor/nylas-select-event-type/nylas-select-event-type.d.ts +2 -1
  137. package/dist/types/components.d.ts +18 -2
  138. package/dist/types/stores/scheduler-config-store.d.ts +2 -1
  139. package/package.json +1 -1
  140. package/dist/cjs/constants-3b9fb535.js.map +0 -1
  141. package/dist/cjs/utils-0dfca9ec.js.map +0 -1
  142. package/dist/esm/constants-3d8016e3.js.map +0 -1
  143. package/dist/esm/utils-6c05ecaf.js.map +0 -1
  144. package/dist/nylas-web-elements/p-2b97a896.js +0 -14
  145. package/dist/nylas-web-elements/p-35b7d082.entry.js +0 -11
  146. package/dist/nylas-web-elements/p-35b7d082.entry.js.map +0 -1
  147. package/dist/nylas-web-elements/p-6f7cb609.js +0 -2
  148. package/dist/nylas-web-elements/p-6f7cb609.js.map +0 -1
  149. package/dist/nylas-web-elements/p-bea31f39.entry.js.map +0 -1
  150. package/dist/nylas-web-elements/p-faa723fc.entry.js.map +0 -1
  151. /package/dist/nylas-web-elements/{p-865721fd.entry.js.map → p-05204c68.entry.js.map} +0 -0
  152. /package/dist/nylas-web-elements/{p-2b38054f.entry.js.map → p-0d422938.entry.js.map} +0 -0
  153. /package/dist/nylas-web-elements/{p-c59787f4.js.map → p-0d6ecada.js.map} +0 -0
  154. /package/dist/nylas-web-elements/{p-e2632a60.js.map → p-198f05a6.js.map} +0 -0
  155. /package/dist/nylas-web-elements/{p-4e1e01e4.entry.js.map → p-29f601d9.entry.js.map} +0 -0
  156. /package/dist/nylas-web-elements/{p-60b48bf7.js.map → p-3a3c5e17.js.map} +0 -0
  157. /package/dist/nylas-web-elements/{p-6bb6a0b8.entry.js.map → p-447837c2.entry.js.map} +0 -0
  158. /package/dist/nylas-web-elements/{p-3cc1072e.js.map → p-84109239.js.map} +0 -0
  159. /package/dist/nylas-web-elements/{p-d16cd88b.entry.js.map → p-a7d2a211.entry.js.map} +0 -0
  160. /package/dist/nylas-web-elements/{p-a9a0dd64.entry.js.map → p-ab96941e.entry.js.map} +0 -0
  161. /package/dist/nylas-web-elements/{p-6fc7d11b.entry.js.map → p-af94512e.entry.js.map} +0 -0
  162. /package/dist/nylas-web-elements/{p-bfe2bdbd.js.map → p-b3ca5d4d.js.map} +0 -0
  163. /package/dist/nylas-web-elements/{p-80d57b5a.entry.js.map → p-cd24a45e.entry.js.map} +0 -0
  164. /package/dist/nylas-web-elements/{p-6364eb02.entry.js.map → p-e9369c76.entry.js.map} +0 -0
  165. /package/dist/nylas-web-elements/{p-b2241c3c.entry.js.map → p-f00d1bb3.entry.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{b as t,e as n,f as e,h as r}from"./p-2b97a896.js";class i{constructor(n,e,r=true,i){this.automaticComponentRegistration=true;this.registeredComponents={};this.propStateRegistrations=new Map;this.eventListenerRegistrations=new Map;this.host=n;this.stores=e;this.automaticComponentRegistration=r;this.eventOverrides=i;t(`[${this.hostTagName}] Initializing (abstract) provider.`,{eventOverrides:i});this.registerComponent=this.registerComponent.bind(this);this.getStore=this.getStore.bind(this);Object.keys(this.stores).forEach((t=>{this.propStateRegistrations.set(t,new Map)}))}async componentWillLoad(n){t(`[${this.hostTagName}] Will load`);this.setupStoreListeners();this.nylasConnector=n;const e=Array.from(this.host.querySelectorAll("*")).filter((t=>t.tagName.toLowerCase().startsWith("nylas-")));t(`[${this.hostTagName}] Found ${e.length} child component(s).`,{childComponents:e});const r=e.map((async n=>{const e=n;if(!e){t(`[~${this.hostTagName}] (componentWillLoad) Component ${e.tagName} does not have a name. Skipping.`);return}if(!e.registerNylasComponent){t(`[~${this.hostTagName}] (componentWillLoad) Component ${e.tagName} is not a component that can be registered. Skipping.`,{component:e});return}const r={element:e,name:e.tagName.toLowerCase(),getStoresToProp:e.getStoresToProp,storeToProps:e.storeToProps,stateToProps:e.stateToProps,authToProp:e.authToProp,eventToProps:e.eventToProps,connectorToProp:e.connectorToProp,localPropsToProp:e.localPropsToProp};await this.registerComponent(r)}));await Promise.all(r)}async componentDidLoad(){t(`[~${this.hostTagName}] (componentDidLoad) Did load`)}async componentDisconnected(){Object.values(this.stores).forEach((t=>{t.dispose()}))}async registerComponentHandler(n){n.stopPropagation();if(!this.automaticComponentRegistration){t(`~[${this.hostTagName}] (registerComponentHandler) Automatic component registration disabled. Skipping registration of ${n.detail.name}.`);return}await this.registerComponent(n.detail)}async unregisterComponentHandler(n){n.stopPropagation();if(!this.automaticComponentRegistration){t(`~[${this.hostTagName}] (unregisterComponentHandler) Automatic component registration disabled. Skipping unregistration of ${n.detail.name}.`);return}this.unregisterComponent(n.detail)}async registerComponent(r){t(`~[${this.hostTagName}] (registerComponent) Registering component ${r.name}.`);const i=r.element.dataset.nylasId;const s=i&&this.registeredComponents[i];if(s){t(`[${this.hostTagName}] (registerComponent) Component ${r.name} already registered. Updating registration.`);this.cleanupComponentRegistration(i,false)}else{r.element.dataset.nylasId=i||n()}const o=r.element.dataset.nylasId;if(o){this.registeredComponents[o]=r}t(`[${this.hostTagName}] (registerComponent) Waiting for "${r.element.localName}" component to be defined`,{component:r});try{await customElements.whenDefined(r.element.tagName.toLowerCase());t(`[${this.hostTagName}] (registerComponent) Component "${r.element.localName}" is now defined`)}catch(n){t(`[${this.hostTagName}] (registerComponent) Error waiting for component "${r.element.localName}" to be defined:`,n)}const u=this.eventOverrides;const{stateToProps:a,getStoresToProp:c,eventToProps:l,storeToProps:h,connectorToProp:f,localPropsToProp:d,element:p}=r;l?.forEach(((n,i)=>{const s=this.nylasConnector;const o=async e=>{t(`[${this.hostTagName}] (registerComponent) Handling "${r.name}" prop "${String(i)}" event.`,{event:e});if(i in u){t(`[${this.hostTagName}] (registerComponent) Found event override for "${String(i)}" event. Calling override.`);await u[i](e,s)}if(!e.defaultPrevented){await n(e,s)}return};const a=r.element.dataset.nylasId;if(a&&!this.eventListenerRegistrations.has(a)){this.eventListenerRegistrations.set(a,[])}if(a){this.eventListenerRegistrations.get(a)?.push([p,i,o])}t(`[${this.hostTagName}] (registerComponent) Setting "${r.name}" event "${String(i)}" to automcially call NylasConnector method.`);const c=e(i.toString());t(`[${this.hostTagName}] (registerComponent) Adding event listener for "${c}" on "${p.tagName}"`);p.addEventListener(c,o)}));a?.forEach(((n,e)=>{const[i,s]=e.split(".");const o=this.getStore(i);const u=o.state[s];if(!p.dataset.nylasId){t(`[${this.hostTagName}] (registerComponent) Component "${r.name}" not registered. Skipping.`,{component:r});return}if(!this.propStateRegistrations.has(i)){this.propStateRegistrations.set(i,new Map)}if(!this.propStateRegistrations.get(i)?.has(s)){this.propStateRegistrations.get(i)?.set(s,[{elementId:p.dataset.nylasId,propKey:n}])}else{this.propStateRegistrations.get(i)?.get(s)?.push({elementId:p.dataset.nylasId,propKey:n})}p[n.toString()]=u;t(`[${this.hostTagName}] Setting "${r.name}" prop "${n.toString()}" to "${e}" value.`,{stateValue:u})}));d?.forEach(((n,e)=>{const i=this.host[e];p[n.toString()]=i;t(`[${this.hostTagName}] Setting "${r.name}" prop "${n.toString()}" to the value of "${e}" value.`,{value:e,mappedPropValue:i})}));if(c){p[c?.toString()]=this.getStore;t(`[${this.hostTagName}] Setting "${r.name}" prop "${c.toString()}" to "getStore" method.`)}h?.forEach(((n,e)=>{const i=this.getStore(e);p[n.toString()]=i;t(`[${this.hostTagName}] Setting "${r.name}" prop "${n.toString()}" to "${e}" store.`,{store:i})}));if(f){p[f?.toString()]=this.nylasConnector;t(`[${this.hostTagName}] Setting "${r.name}" prop "${f.toString()}" to "nylasConnector" value.`,{connectorToProp:f})}if(typeof p.registerCallback==="function"){t(`[${this.hostTagName}] (registerComponent) Calling registerCallback method for "${r.name}".`);await p.registerCallback()}t(`[${this.hostTagName}] (registerComponent) Component ${r.name} registered.`)}cleanupComponentRegistration(n,r=true){const i=this.eventListenerRegistrations.get(n);if(i){i.forEach((([n,r,i])=>{const s=e(r.toString());t(`[${this.hostTagName}] (cleanupComponentRegistration) Removing event listener for "${s}" on "${n.tagName}"`);n.removeEventListener(s,i)}));this.eventListenerRegistrations.delete(n)}this.propStateRegistrations.forEach(((t,e)=>{t.forEach(((t,r)=>{const i=t.filter((t=>t.elementId!==n));if(i.length!==t.length){this.propStateRegistrations.get(e)?.set(r,i)}}))}));if(r){delete this.registeredComponents[n]}}unregisterComponent(n){t(`[${this.hostTagName}] Unregistering component ${n.name}.`);const r=n.element.dataset.nylasId;if(!r){t(`[${this.hostTagName}] (unregisterComponent) Unregistering component ${n.name}.`);return}if(this.registeredComponents[r]){t(`[${this.hostTagName}] (unregisterComponent) Component ${n.name} not registered. Skipping.`);return}this.propStateRegistrations.forEach(((t,n)=>{t.forEach(((t,e)=>{const i=this.propStateRegistrations.get(n)?.get(e);const s=i?.filter((t=>t.elementId!==r));if(s){this.propStateRegistrations.get(n)?.set(e,s)}}))}));const i=this.eventListenerRegistrations.get(r);i?.forEach((([n,r,i])=>{const s=e(r.toString());t(`[${this.hostTagName}] (unregisterComponent) Removing event listener for "${s}" on "${n.tagName}"`);n.removeEventListener(s,i)}));delete this.registeredComponents[r]}getStore(t){const n=this.stores[t];if(!n){throw new Error(`[${this.hostTagName}] Store "${t.toString()}" not found.`)}return n}async setupStoreListeners(){const n=this;Object.entries(this.stores).forEach((([e,r])=>{t(`[${n.hostTagName}] (setupStoreListeners) Listening for changes in "${e}" store.`);r.use({set(r,i,s){t(`[${n.hostTagName}] (setupStoreListeners) Store "${e}" state "${r.toString()}" changed`,{newValue:i,oldValue:s});if(i===s){t(`[${n.hostTagName}] (setupStoreListeners) Store "${e}" state "${r.toString()}" unchanged. Skipping.`);return}const o=n.registeredComponents;if(!o){t(`[${n.hostTagName}] (setupStoreListeners) No registered components found. Skipping.`);return}const u=n.propStateRegistrations.get(e)?.get(r.toString())||[];t(`[${n.hostTagName}] (setupStoreListeners) Found ${u.length} prop(s) registered for "${r.toString()}" store.`,{props:u,propStateRegistrations:n.propStateRegistrations});u.forEach((({elementId:i,propKey:s})=>{const u=o[i];if(!u){t(`[${n.hostTagName}] (setupStoreListeners) Component "${i}" not found. Skipping.`,{component:u});return}const a=n.getStore(e);const c=a.state[r];u.element[s.toString()]=c;t(`[${n.hostTagName}] (setupStoreListeners) Setting "${u.name}" prop "${s.toString()}" to "${r.toString()}" value.`,{stateValue:c})}))}})}))}get hostTagName(){return this.host?.tagName?.toLowerCase()??"nylas-provider"}}class s extends i{}var o=(t=>(t.Error="error",t.Warning="warning",t.Info="info",t.Success="success",t))(o||{});const u=t=>t!==null&&typeof t=="object"&&"error"in t;const a=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:r,c=Object.keys,l=Array.isArray;function h(t,n){return typeof n!="object"||c(n).forEach((function(e){t[e]=n[e]})),t}typeof Promise>"u"||a.Promise||(a.Promise=Promise);const f=Object.getPrototypeOf,d={}.hasOwnProperty;function p(t,n){return d.call(t,n)}function y(t,n){typeof n=="function"&&(n=n(f(t))),(typeof Reflect>"u"?c:Reflect.ownKeys)(n).forEach((e=>{m(t,e,n[e])}))}const v=Object.defineProperty;function m(t,n,e,r){v(t,n,h(e&&p(e,"get")&&typeof e.get=="function"?{get:e.get,set:e.set,configurable:!0}:{value:e,configurable:!0,writable:!0},r))}function g(t){return{from:function(n){return t.prototype=Object.create(n.prototype),m(t.prototype,"constructor",t),{extend:y.bind(null,t.prototype)}}}}const w=Object.getOwnPropertyDescriptor;function b(t,n){let e;return w(t,n)||(e=f(t))&&b(e,n)}const $=[].slice;function k(t,n,e){return $.call(t,n,e)}function S(t,n){return n(t)}function P(t){if(!t)throw new Error("Assertion Failed")}function x(t){a.setImmediate?setImmediate(t):setTimeout(t,0)}function C(t,n){return t.reduce(((t,e,r)=>{var i=n(e,r);return i&&(t[i[0]]=i[1]),t}),{})}function A(t,n){if(p(t,n))return t[n];if(!n)return t;if(typeof n!="string"){for(var e=[],r=0,i=n.length;r<i;++r){var s=A(t,n[r]);e.push(s)}return e}var o=n.indexOf(".");if(o!==-1){var u=t[n.substr(0,o)];return u===void 0?void 0:A(u,n.substr(o+1))}}function E(t,n,e){if(t&&n!==void 0&&(!("isFrozen"in Object)||!Object.isFrozen(t)))if(typeof n!="string"&&"length"in n){P(typeof e!="string"&&"length"in e);for(var r=0,i=n.length;r<i;++r)E(t,n[r],e[r])}else{var s=n.indexOf(".");if(s!==-1){var o=n.substr(0,s),u=n.substr(s+1);if(u==="")e===void 0?l(t)&&!isNaN(parseInt(o))?t.splice(o,1):delete t[o]:t[o]=e;else{var a=t[o];a&&p(t,o)||(a=t[o]={}),E(a,u,e)}}else e===void 0?l(t)&&!isNaN(parseInt(n))?t.splice(n,1):delete t[n]:t[n]=e}}function D(t){var n={};for(var e in t)p(t,e)&&(n[e]=t[e]);return n}const O=[].concat;function j(t){return O.apply([],t)}const I="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(j([8,16,32,64].map((t=>["Int","Uint","Float"].map((n=>n+t+"Array")))))).filter((t=>a[t])),K=I.map((t=>a[t]));C(I,(t=>[t,!0]));let T=null;function R(t){T=typeof WeakMap<"u"&&new WeakMap;const n=B(t);return T=null,n}function B(t){if(!t||typeof t!="object")return t;let n=T&&T.get(t);if(n)return n;if(l(t)){n=[],T&&T.set(t,n);for(var e=0,r=t.length;e<r;++e)n.push(B(t[e]))}else if(K.indexOf(t.constructor)>=0)n=t;else{const e=f(t);for(var i in n=e===Object.prototype?{}:Object.create(e),T&&T.set(t,n),t)p(t,i)&&(n[i]=B(t[i]))}return n}const{toString:q}={};function M(t){return q.call(t).slice(8,-1)}const F=typeof Symbol<"u"?Symbol.iterator:"@@iterator",N=typeof F=="symbol"?function(t){var n;return t!=null&&(n=t[F])&&n.apply(t)}:function(){return null},_={};function L(t){var n,e,r,i;if(arguments.length===1){if(l(t))return t.slice();if(this===_&&typeof t=="string")return[t];if(i=N(t)){for(e=[];!(r=i.next()).done;)e.push(r.value);return e}if(t==null)return[t];if(typeof(n=t.length)=="number"){for(e=new Array(n);n--;)e[n]=t[n];return e}return[t]}for(n=arguments.length,e=new Array(n);n--;)e[n]=arguments[n];return e}const U=typeof Symbol<"u"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1;var V=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function W(t,n){V=t,H=n}var H=()=>!0;const G=!new Error("").stack;function z(){if(G)try{throw new Error}catch(t){return t}return new Error}function J(t,n){var e=t.stack;return e?(n=n||0,e.indexOf(t.name)===0&&(n+=(t.name+t.message).split(`\n`).length),e.split(`\n`).slice(n).filter(H).map((t=>`\n`+t)).join("")):""}var Y=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Q=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(Y),X={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 Z(t,n){this._e=z(),this.name=t,this.message=n}function tt(t,n){return t+". Errors: "+Object.keys(n).map((t=>n[t].toString())).filter(((t,n,e)=>e.indexOf(t)===n)).join(`\n`)}function nt(t,n,e,r){this._e=z(),this.failures=n,this.failedKeys=r,this.successCount=e,this.message=tt(t,n)}function et(t,n){this._e=z(),this.name="BulkError",this.failures=Object.keys(n).map((t=>n[t])),this.failuresByPos=n,this.message=tt(t,n)}g(Z).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+J(this._e,2))}},toString:function(){return this.name+": "+this.message}}),g(nt).from(Z),g(et).from(Z);var rt=Q.reduce(((t,n)=>(t[n]=n+"Error",t)),{});const it=Z;var st=Q.reduce(((t,n)=>{var e=n+"Error";function r(t,r){this._e=z(),this.name=e,t?typeof t=="string"?(this.message=`${t}${r?`\n `+r:""}`,this.inner=r||null):typeof t=="object"&&(this.message=`${t.name} ${t.message}`,this.inner=t):(this.message=X[n]||e,this.inner=null)}return g(r).from(it),t[n]=r,t}),{});st.Syntax=SyntaxError,st.Type=TypeError,st.Range=RangeError;var ot=Y.reduce(((t,n)=>(t[n+"Error"]=st[n],t)),{}),ut=Q.reduce(((t,n)=>(["Syntax","Type","Range"].indexOf(n)===-1&&(t[n+"Error"]=st[n]),t)),{});function at(){}function ct(t){return t}function lt(t,n){return t==null||t===ct?n:function(e){return n(t(e))}}function ht(t,n){return function(){t.apply(this,arguments),n.apply(this,arguments)}}function ft(t,n){return t===at?n:function(){var e=t.apply(this,arguments);e!==void 0&&(arguments[0]=e);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var s=n.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?ht(r,this.onsuccess):r),i&&(this.onerror=this.onerror?ht(i,this.onerror):i),s!==void 0?s:e}}function dt(t,n){return t===at?n:function(){t.apply(this,arguments);var e=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,n.apply(this,arguments),e&&(this.onsuccess=this.onsuccess?ht(e,this.onsuccess):e),r&&(this.onerror=this.onerror?ht(r,this.onerror):r)}}function pt(t,n){return t===at?n:function(e){var r=t.apply(this,arguments);h(e,r);var i=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var o=n.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?ht(i,this.onsuccess):i),s&&(this.onerror=this.onerror?ht(s,this.onerror):s),r===void 0?o===void 0?void 0:o:h(r,o)}}function yt(t,n){return t===at?n:function(){return n.apply(this,arguments)!==!1&&t.apply(this,arguments)}}function vt(t,n){return t===at?n:function(){var e=t.apply(this,arguments);if(e&&typeof e.then=="function"){for(var r=this,i=arguments.length,s=new Array(i);i--;)s[i]=arguments[i];return e.then((function(){return n.apply(r,s)}))}return n.apply(this,arguments)}}ut.ModifyError=nt,ut.DexieError=Z,ut.BulkError=et;var mt={};const gt=100,[wt,bt,$t]=typeof Promise>"u"?[]:(()=>{let t=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[t,f(t),t];const n=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[n,f(n),t]})(),kt=bt&&bt.then,St=wt&&wt.constructor,Pt=!!$t;var xt=!1,Ct=$t?()=>{$t.then(Jt)}:a.setImmediate?setImmediate.bind(null,Jt):a.MutationObserver?()=>{var t=document.createElement("div");new MutationObserver((()=>{Jt(),t=null})).observe(t,{attributes:!0}),t.setAttribute("i","1")}:()=>{setTimeout(Jt,0)},At=function(t,n){Bt.push([t,n]),Dt&&(Ct(),Dt=!1)},Et=!0,Dt=!0,Ot=[],jt=[],It=null,Kt=ct,Tt={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:$n,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((t=>{try{$n(t[0],t[1])}catch{}}))}},Rt=Tt,Bt=[],qt=0,Mt=[];function Ft(t){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=at,this._lib=!1;var n=this._PSD=Rt;if(V&&(this._stackHolder=z(),this._prev=null,this._numPrev=0),typeof t!="function"){if(t!==mt)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&Ut(this,this._value))}this._state=null,this._value=null,++n.ref,Lt(this,t)}const Nt={get:function(){var t=Rt,n=on;function e(e,r){var i=!t.global&&(t!==Rt||n!==on);const s=i&&!ln();var o=new Ft(((n,o)=>{Wt(this,new _t(gn(e,t,i,s),gn(r,t,i,s),n,o,t))}));return V&&zt(o,this),o}return e.prototype=mt,e},set:function(t){m(this,"then",t&&t.prototype===mt?Nt:{get:function(){return t},set:Nt.set})}};function _t(t,n,e,r,i){this.onFulfilled=typeof t=="function"?t:null,this.onRejected=typeof n=="function"?n:null,this.resolve=e,this.reject=r,this.psd=i}function Lt(t,n){try{n((n=>{if(t._state===null){if(n===t)throw new TypeError("A promise cannot be resolved with itself.");var e=t._lib&&Yt();n&&typeof n.then=="function"?Lt(t,((t,e)=>{n instanceof Ft?n._then(t,e):n.then(t,e)})):(t._state=!0,t._value=n,Vt(t)),e&&Qt()}}),Ut.bind(null,t))}catch(n){Ut(t,n)}}function Ut(t,n){if(jt.push(n),t._state===null){var e=t._lib&&Yt();n=Kt(n),t._state=!1,t._value=n,V&&n!==null&&typeof n=="object"&&!n._promise&&function(t,n,e){try{t.apply(null,e)}catch(t){n&&n(t)}}((()=>{var e=b(n,"stack");n._promise=t,m(n,"stack",{get:()=>xt?e&&(e.get?e.get.apply(n):e.value):t.stack})})),function(t){Ot.some((n=>n._value===t._value))||Ot.push(t)}(t),Vt(t),e&&Qt()}}function Vt(t){var n=t._listeners;t._listeners=[];for(var e=0,r=n.length;e<r;++e)Wt(t,n[e]);var i=t._PSD;--i.ref||i.finalize(),qt===0&&(++qt,At((()=>{--qt==0&&Xt()}),[]))}function Wt(t,n){if(t._state!==null){var e=t._state?n.onFulfilled:n.onRejected;if(e===null)return(t._state?n.resolve:n.reject)(t._value);++n.psd.ref,++qt,At(Ht,[e,t,n])}else t._listeners.push(n)}function Ht(t,n,e){try{It=n;var r,i=n._value;n._state?r=t(i):(jt.length&&(jt=[]),r=t(i),jt.indexOf(i)===-1&&function(t){for(var n=Ot.length;n;)if(Ot[--n]._value===t._value)return void Ot.splice(n,1)}(n)),e.resolve(r)}catch(t){e.reject(t)}finally{It=null,--qt==0&&Xt(),--e.psd.ref||e.psd.finalize()}}function Gt(t,n,e){if(n.length===e)return n;var r="";if(t._state===!1){var i,s,o=t._value;o!=null?(i=o.name||"Error",s=o.message||o,r=J(o,0)):(i=o,s=""),n.push(i+(s?": "+s:"")+r)}return V&&((r=J(t._stackHolder,2))&&n.indexOf(r)===-1&&n.push(r),t._prev&&Gt(t._prev,n,e)),n}function zt(t,n){var e=n?n._numPrev+1:0;e<100&&(t._prev=n,t._numPrev=e)}function Jt(){Yt()&&Qt()}function Yt(){var t=Et;return Et=!1,Dt=!1,t}function Qt(){var t,n,e;do{for(;Bt.length>0;)for(t=Bt,Bt=[],e=t.length,n=0;n<e;++n){var r=t[n];r[0].apply(null,r[1])}}while(Bt.length>0);Et=!0,Dt=!0}function Xt(){var t=Ot;Ot=[],t.forEach((t=>{t._PSD.onunhandled.call(null,t._value,t)}));for(var n=Mt.slice(0),e=n.length;e;)n[--e]()}function Zt(t){return new Ft(mt,!1,t)}function tn(t,n){var e=Rt;return function(){var r=Yt(),i=Rt;try{return pn(e,!0),t.apply(this,arguments)}catch(t){n&&n(t)}finally{pn(i,!1),r&&Qt()}}}y(Ft.prototype,{then:Nt,_then:function(t,n){Wt(this,new _t(null,null,t,n,Rt))},catch:function(t){if(arguments.length===1)return this.then(null,t);var n=arguments[0],e=arguments[1];return typeof n=="function"?this.then(null,(t=>t instanceof n?e(t):Zt(t))):this.then(null,(t=>t&&t.name===n?e(t):Zt(t)))},finally:function(t){return this.then((n=>(t(),n)),(n=>(t(),Zt(n))))},stack:{get:function(){if(this._stack)return this._stack;try{xt=!0;var t=Gt(this,[],20).join(`\nFrom previous: `);return this._state!==null&&(this._stack=t),t}finally{xt=!1}}},timeout:function(t,n){return t<1/0?new Ft(((e,r)=>{var i=setTimeout((()=>r(new st.Timeout(n))),t);this.then(e,r).finally(clearTimeout.bind(null,i))})):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&m(Ft.prototype,Symbol.toStringTag,"Dexie.Promise"),Tt.env=yn(),y(Ft,{all:function(){var t=L.apply(null,arguments).map(hn);return new Ft((function(n,e){t.length===0&&n([]);var r=t.length;t.forEach(((i,s)=>Ft.resolve(i).then((e=>{t[s]=e,--r||n(t)}),e)))}))},resolve:t=>{if(t instanceof Ft)return t;if(t&&typeof t.then=="function")return new Ft(((n,e)=>{t.then(n,e)}));var n=new Ft(mt,!0,t);return zt(n,It),n},reject:Zt,race:function(){var t=L.apply(null,arguments).map(hn);return new Ft(((n,e)=>{t.map((t=>Ft.resolve(t).then(n,e)))}))},PSD:{get:()=>Rt,set:t=>Rt=t},totalEchoes:{get:()=>on},newPSD:an,usePSD:vn,scheduler:{get:()=>At,set:t=>{At=t}},rejectionMapper:{get:()=>Kt,set:t=>{Kt=t}},follow:(t,n)=>new Ft(((e,r)=>an(((n,e)=>{var r=Rt;r.unhandleds=[],r.onunhandled=e,r.finalize=ht((function(){(function(t){function n(){t(),Mt.splice(Mt.indexOf(n),1)}Mt.push(n),++qt,At((()=>{--qt==0&&Xt()}),[])})((()=>{this.unhandleds.length===0?n():e(this.unhandleds[0])}))}),r.finalize),t()}),n,e,r)))}),St&&(St.allSettled&&m(Ft,"allSettled",(function(){const t=L.apply(null,arguments).map(hn);return new Ft((n=>{t.length===0&&n([]);let e=t.length;const r=new Array(e);t.forEach(((t,i)=>Ft.resolve(t).then((t=>r[i]={status:"fulfilled",value:t}),(t=>r[i]={status:"rejected",reason:t})).then((()=>--e||n(r)))))}))})),St.any&&typeof AggregateError<"u"&&m(Ft,"any",(function(){const t=L.apply(null,arguments).map(hn);return new Ft(((n,e)=>{t.length===0&&e(new AggregateError([]));let r=t.length;const i=new Array(r);t.forEach(((t,s)=>Ft.resolve(t).then((t=>n(t)),(t=>{i[s]=t,--r||e(new AggregateError(i))}))))}))})));const nn={awaits:0,echoes:0,id:0};var en=0,rn=[],sn=0,on=0,un=0;function an(t,n,e,r){var i=Rt,s=Object.create(i);s.parent=i,s.ref=0,s.global=!1,s.id=++un;var o=Tt.env;s.env=Pt?{Promise:Ft,PromiseProp:{value:Ft,configurable:!0,writable:!0},all:Ft.all,race:Ft.race,allSettled:Ft.allSettled,any:Ft.any,resolve:Ft.resolve,reject:Ft.reject,nthen:wn(o.nthen,s),gthen:wn(o.gthen,s)}:{},n&&h(s,n),++i.ref,s.finalize=function(){--this.parent.ref||this.parent.finalize()};var u=vn(s,t,e,r);return s.ref===0&&s.finalize(),u}function cn(){return nn.id||(nn.id=++en),++nn.awaits,nn.echoes+=gt,nn.id}function ln(){return!!nn.awaits&&(--nn.awaits==0&&(nn.id=0),nn.echoes=nn.awaits*gt,!0)}function hn(t){return nn.echoes&&t&&t.constructor===St?(cn(),t.then((t=>(ln(),t)),(t=>(ln(),kn(t))))):t}function fn(t){++on,nn.echoes&&--nn.echoes!=0||(nn.echoes=nn.id=0),rn.push(Rt),pn(t,!0)}function dn(){var t=rn[rn.length-1];rn.pop(),pn(t,!1)}function pn(t,n){var e=Rt;if((n?!nn.echoes||sn++&&t===Rt:!sn||--sn&&t===Rt)||mn(n?fn.bind(null,t):dn),t!==Rt&&(Rt=t,e===Tt&&(Tt.env=yn()),Pt)){var r=Tt.env.Promise,i=t.env;bt.then=i.nthen,r.prototype.then=i.gthen,(e.global||t.global)&&(Object.defineProperty(a,"Promise",i.PromiseProp),r.all=i.all,r.race=i.race,r.resolve=i.resolve,r.reject=i.reject,i.allSettled&&(r.allSettled=i.allSettled),i.any&&(r.any=i.any))}}function yn(){var t=a.Promise;return Pt?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(a,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:bt.then,gthen:t.prototype.then}:{}}function vn(t,n,e,r,i){var s=Rt;try{return pn(t,!0),n(e,r,i)}finally{pn(s,!1)}}function mn(t){kt.call(wt,t)}function gn(t,n,e,r){return typeof t!="function"?t:function(){var i=Rt;e&&cn(),pn(n,!0);try{return t.apply(this,arguments)}finally{pn(i,!1),r&&mn(ln)}}}function wn(t,n){return function(e,r){return t.call(this,gn(e,n),gn(r,n))}}(""+kt).indexOf("[native code]")===-1&&(cn=ln=at);const bn="unhandledrejection";function $n(t,n){var e;try{e=n.onuncatched(t)}catch{}if(e!==!1)try{var r,i={promise:n,reason:t};if(a.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(bn,!0,!0),h(r,i)):a.CustomEvent&&h(r=new CustomEvent(bn,{detail:i}),i),r&&a.dispatchEvent&&(dispatchEvent(r),!a.PromiseRejectionEvent&&a.onunhandledrejection))try{a.onunhandledrejection(r)}catch{}V&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${t.stack||t}`)}catch{}}var kn=Ft.reject;function Sn(t,n,e,r){if(t.idbdb&&(t._state.openComplete||Rt.letThrough||t._vip)){var i=t._createTransaction(n,e,t._dbSchema);try{i.create(),t._state.PR1398_maxLoop=3}catch(i){return i.name===rt.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then((()=>Sn(t,n,e,r)))):kn(i)}return i._promise(n,((t,n)=>an((()=>(Rt.trans=i,r(t,n,i)))))).then((t=>i._completion.then((()=>t))))}if(t._state.openComplete)return kn(new st.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return kn(new st.DatabaseClosed);t.open().catch(at)}return t._state.dbReadyPromise.then((()=>Sn(t,n,e,r)))}const Pn="3.2.4",xn=String.fromCharCode(65535),Cn=-1/0,An="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",En="String expected.",Dn=[],On=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),jn=On,In=On,Kn=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),Tn="__dbnames",Rn="readonly",Bn="readwrite";function qn(t,n){return t?n?function(){return t.apply(this,arguments)&&n.apply(this,arguments)}:t:n}const Mn={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Fn(t){return typeof t!="string"||/\./.test(t)?t=>t:n=>(n[t]===void 0&&t in n&&delete(n=R(n))[t],n)}class Nn{_trans(t,n,e){const r=this._tx||Rt.trans,i=this.name;function s(t,e,r){if(!r.schema[i])throw new st.NotFound("Table "+i+" not part of transaction");return n(r.idbtrans,r)}const o=Yt();try{return r&&r.db===this.db?r===Rt.trans?r._promise(t,s,e):an((()=>r._promise(t,s,e)),{trans:r,transless:Rt.transless||Rt}):Sn(this.db,t,[this.name],s)}finally{o&&Qt()}}get(t,n){return t&&t.constructor===Object?this.where(t).first(n):this._trans("readonly",(n=>this.core.get({trans:n,key:t}).then((t=>this.hook.reading.fire(t))))).then(n)}where(t){if(typeof t=="string")return new this.db.WhereClause(this,t);if(l(t))return new this.db.WhereClause(this,`[${t.join("+")}]`);const n=c(t);if(n.length===1)return this.where(n[0]).equals(t[n[0]]);const e=this.schema.indexes.concat(this.schema.primKey).filter((t=>t.compound&&n.every((n=>t.keyPath.indexOf(n)>=0))&&t.keyPath.every((t=>n.indexOf(t)>=0))))[0];if(e&&this.db._maxKey!==xn)return this.where(e.name).equals(e.keyPath.map((n=>t[n])));!e&&V&&console.warn(`The query ${JSON.stringify(t)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);const{idxByName:r}=this.schema,i=this.db._deps.indexedDB;function s(t,n){try{return i.cmp(t,n)===0}catch{return!1}}const[o,u]=n.reduce((([n,e],i)=>{const o=r[i],u=t[i];return[n||o,n||!o?qn(e,o&&o.multi?t=>{const n=A(t,i);return l(n)&&n.some((t=>s(u,t)))}:t=>s(u,A(t,i))):e]}),[null,null]);return o?this.where(o.name).equals(t[o.keyPath]).filter(u):e?this.filter(u):this.where(n).equals("")}filter(t){return this.toCollection().and(t)}count(t){return this.toCollection().count(t)}offset(t){return this.toCollection().offset(t)}limit(t){return this.toCollection().limit(t)}each(t){return this.toCollection().each(t)}toArray(t){return this.toCollection().toArray(t)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(t){return new this.db.Collection(new this.db.WhereClause(this,l(t)?`[${t.join("+")}]`:t))}reverse(){return this.toCollection().reverse()}mapToClass(t){this.schema.mappedClass=t;const n=n=>{if(!n)return n;const e=Object.create(t.prototype);for(var r in n)if(p(n,r))try{e[r]=n[r]}catch{}return e};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=n,this.hook("reading",n),t}defineClass(){return this.mapToClass((function(t){h(this,t)}))}add(t,n){const{auto:e,keyPath:r}=this.schema.primKey;let i=t;return r&&e&&(i=Fn(r)(t)),this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"add",keys:n!=null?[n]:null,values:[i]}))).then((t=>t.numFailures?Ft.reject(t.failures[0]):t.lastResult)).then((n=>{if(r)try{E(t,r,n)}catch{}return n}))}update(t,n){if(typeof t!="object"||l(t))return this.where(":id").equals(t).modify(n);{const e=A(t,this.schema.primKey.keyPath);if(e===void 0)return kn(new st.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?c(n).forEach((e=>{E(t,e,n[e])})):n(t,{value:t,primKey:e})}catch{}return this.where(":id").equals(e).modify(n)}}put(t,n){const{auto:e,keyPath:r}=this.schema.primKey;let i=t;return r&&e&&(i=Fn(r)(t)),this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"put",values:[i],keys:n!=null?[n]:null}))).then((t=>t.numFailures?Ft.reject(t.failures[0]):t.lastResult)).then((n=>{if(r)try{E(t,r,n)}catch{}return n}))}delete(t){return this._trans("readwrite",(n=>this.core.mutate({trans:n,type:"delete",keys:[t]}))).then((t=>t.numFailures?Ft.reject(t.failures[0]):void 0))}clear(){return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"deleteRange",range:Mn}))).then((t=>t.numFailures?Ft.reject(t.failures[0]):void 0))}bulkGet(t){return this._trans("readonly",(n=>this.core.getMany({keys:t,trans:n}).then((t=>t.map((t=>this.hook.reading.fire(t)))))))}bulkAdd(t,n,e){const r=Array.isArray(n)?n:void 0,i=(e=e||(r?void 0:n))?e.allKeys:void 0;return this._trans("readwrite",(n=>{const{auto:e,keyPath:s}=this.schema.primKey;if(s&&r)throw new st.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==t.length)throw new st.InvalidArgument("Arguments objects and keys must have the same length");const o=t.length;let u=s&&e?t.map(Fn(s)):t;return this.core.mutate({trans:n,type:"add",keys:r,values:u,wantResults:i}).then((({numFailures:t,results:n,lastResult:e,failures:r})=>{if(t===0)return i?n:e;throw new et(`${this.name}.bulkAdd(): ${t} of ${o} operations failed`,r)}))}))}bulkPut(t,n,e){const r=Array.isArray(n)?n:void 0,i=(e=e||(r?void 0:n))?e.allKeys:void 0;return this._trans("readwrite",(n=>{const{auto:e,keyPath:s}=this.schema.primKey;if(s&&r)throw new st.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==t.length)throw new st.InvalidArgument("Arguments objects and keys must have the same length");const o=t.length;let u=s&&e?t.map(Fn(s)):t;return this.core.mutate({trans:n,type:"put",keys:r,values:u,wantResults:i}).then((({numFailures:t,results:n,lastResult:e,failures:r})=>{if(t===0)return i?n:e;throw new et(`${this.name}.bulkPut(): ${t} of ${o} operations failed`,r)}))}))}bulkDelete(t){const n=t.length;return this._trans("readwrite",(n=>this.core.mutate({trans:n,type:"delete",keys:t}))).then((({numFailures:t,lastResult:e,failures:r})=>{if(t===0)return e;throw new et(`${this.name}.bulkDelete(): ${t} of ${n} operations failed`,r)}))}}function _n(t){var n={},e=function(e,r){if(r){for(var i=arguments.length,s=new Array(i-1);--i;)s[i-1]=arguments[i];return n[e].subscribe.apply(null,s),t}if(typeof e=="string")return n[e]};e.addEventType=s;for(var r=1,i=arguments.length;r<i;++r)s(arguments[r]);return e;function s(t,r,i){if(typeof t!="object"){var o;r||(r=yt),i||(i=at);var u={subscribers:[],fire:i,subscribe:function(t){u.subscribers.indexOf(t)===-1&&(u.subscribers.push(t),u.fire=r(u.fire,t))},unsubscribe:function(t){u.subscribers=u.subscribers.filter((function(n){return n!==t})),u.fire=u.subscribers.reduce(r,i)}};return n[t]=e[t]=u,u}c(o=t).forEach((function(t){var n=o[t];if(l(n))s(t,o[t][0],o[t][1]);else{if(n!=="asap")throw new st.InvalidArgument("Invalid event config");var e=s(t,ct,(function(){for(var t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];e.subscribers.forEach((function(t){x((function(){t.apply(null,n)}))}))}))}}))}}function Ln(t,n){return g(n).from({prototype:t}),n}function Un(t,n){return!(t.filter||t.algorithm||t.or)&&(n?t.justLimit:!t.replayFilter)}function Vn(t,n){t.filter=qn(t.filter,n)}function Wn(t,n,e){var r=t.replayFilter;t.replayFilter=r?()=>qn(r(),n()):n,t.justLimit=e&&!r}function Hn(t,n){if(t.isPrimKey)return n.primaryKey;const e=n.getIndexByKeyPath(t.index);if(!e)throw new st.Schema("KeyPath "+t.index+" on object store "+n.name+" is not indexed");return e}function Gn(t,n,e){const r=Hn(t,n.schema);return n.openCursor({trans:e,values:!t.keysOnly,reverse:t.dir==="prev",unique:!!t.unique,query:{index:r,range:t.range}})}function zn(t,n,e,r){const i=t.replayFilter?qn(t.filter,t.replayFilter()):t.filter;if(t.or){const s={},o=(t,e,r)=>{if(!i||i(e,r,(t=>e.stop(t)),(t=>e.fail(t)))){var o=e.primaryKey,u=""+o;u==="[object ArrayBuffer]"&&(u=""+new Uint8Array(o)),p(s,u)||(s[u]=!0,n(t,e,r))}};return Promise.all([t.or._iterate(o,e),Jn(Gn(t,r,e),t.algorithm,o,!t.keysOnly&&t.valueMapper)])}return Jn(Gn(t,r,e),qn(t.algorithm,i),n,!t.keysOnly&&t.valueMapper)}function Jn(t,n,e,r){var i=tn(r?(t,n,i)=>e(r(t),n,i):e);return t.then((t=>{if(t)return t.start((()=>{var e=()=>t.continue();n&&!n(t,(t=>e=t),(n=>{t.stop(n),e=at}),(n=>{t.fail(n),e=at}))||i(t.value,t,(t=>e=t)),e()}))}))}function Yn(t,n){try{const e=Qn(t),r=Qn(n);if(e!==r)return e==="Array"?1:r==="Array"?-1:e==="binary"?1:r==="binary"?-1:e==="string"?1:r==="string"?-1:e==="Date"?1:r!=="Date"?NaN:-1;switch(e){case"number":case"Date":case"string":return t>n?1:t<n?-1:0;case"binary":return function(t,n){const e=t.length,r=n.length,i=e<r?e:r;for(let e=0;e<i;++e)if(t[e]!==n[e])return t[e]<n[e]?-1:1;return e===r?0:e<r?-1:1}(Xn(t),Xn(n));case"Array":return function(t,n){const e=t.length,r=n.length,i=e<r?e:r;for(let e=0;e<i;++e){const r=Yn(t[e],n[e]);if(r!==0)return r}return e===r?0:e<r?-1:1}(t,n)}}catch{}return NaN}function Qn(t){const n=typeof t;if(n!=="object")return n;if(ArrayBuffer.isView(t))return"binary";const e=M(t);return e==="ArrayBuffer"?"binary":e}function Xn(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)}class Zn{_read(t,n){var e=this._ctx;return e.error?e.table._trans(null,kn.bind(null,e.error)):e.table._trans("readonly",t).then(n)}_write(t){var n=this._ctx;return n.error?n.table._trans(null,kn.bind(null,n.error)):n.table._trans("readwrite",t,"locked")}_addAlgorithm(t){var n=this._ctx;n.algorithm=qn(n.algorithm,t)}_iterate(t,n){return zn(this._ctx,t,n,this._ctx.table.core)}clone(t){var n=Object.create(this.constructor.prototype),e=Object.create(this._ctx);return t&&h(e,t),n._ctx=e,n}raw(){return this._ctx.valueMapper=null,this}each(t){var n=this._ctx;return this._read((e=>zn(n,t,e,n.table.core)))}count(t){return this._read((t=>{const n=this._ctx,e=n.table.core;if(Un(n,!0))return e.count({trans:t,query:{index:Hn(n,e.schema),range:n.range}}).then((t=>Math.min(t,n.limit)));var r=0;return zn(n,(()=>(++r,!1)),t,e).then((()=>r))})).then(t)}sortBy(t,n){const e=t.split(".").reverse(),r=e[0],i=e.length-1;function s(t,n){return n?s(t[e[n]],n-1):t[r]}var o=this._ctx.dir==="next"?1:-1;function u(t,n){var e=s(t,i),r=s(n,i);return e<r?-o:e>r?o:0}return this.toArray((function(t){return t.sort(u)})).then(n)}toArray(t){return this._read((t=>{var n=this._ctx;if(n.dir==="next"&&Un(n,!0)&&n.limit>0){const{valueMapper:e}=n,r=Hn(n,n.table.core.schema);return n.table.core.query({trans:t,limit:n.limit,values:!0,query:{index:r,range:n.range}}).then((({result:t})=>e?t.map(e):t))}{const e=[];return zn(n,(t=>e.push(t)),t,n.table.core).then((()=>e))}}),t)}offset(t){var n=this._ctx;return t<=0||(n.offset+=t,Un(n)?Wn(n,(()=>{var n=t;return(t,e)=>n===0||(n===1?(--n,!1):(e((()=>{t.advance(n),n=0})),!1))})):Wn(n,(()=>{var n=t;return()=>--n<0}))),this}limit(t){return this._ctx.limit=Math.min(this._ctx.limit,t),Wn(this._ctx,(()=>{var n=t;return function(t,e,r){return--n<=0&&e(r),n>=0}}),!0),this}until(t,n){return Vn(this._ctx,(function(e,r,i){return!t(e.value)||(r(i),n)})),this}first(t){return this.limit(1).toArray((function(t){return t[0]})).then(t)}last(t){return this.reverse().first(t)}filter(t){var n,e;return Vn(this._ctx,(function(n){return t(n.value)})),n=this._ctx,e=t,n.isMatch=qn(n.isMatch,e),this}and(t){return this.filter(t)}or(t){return new this.db.WhereClause(this._ctx.table,t,this)}reverse(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(t){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each((function(n,e){t(e.key,e)}))}eachUniqueKey(t){return this._ctx.unique="unique",this.eachKey(t)}eachPrimaryKey(t){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each((function(n,e){t(e.primaryKey,e)}))}keys(t){var n=this._ctx;n.keysOnly=!n.isMatch;var e=[];return this.each((function(t,n){e.push(n.key)})).then((function(){return e})).then(t)}primaryKeys(t){var n=this._ctx;if(n.dir==="next"&&Un(n,!0)&&n.limit>0)return this._read((t=>{var e=Hn(n,n.table.core.schema);return n.table.core.query({trans:t,values:!1,limit:n.limit,query:{index:e,range:n.range}})})).then((({result:t})=>t)).then(t);n.keysOnly=!n.isMatch;var e=[];return this.each((function(t,n){e.push(n.primaryKey)})).then((function(){return e})).then(t)}uniqueKeys(t){return this._ctx.unique="unique",this.keys(t)}firstKey(t){return this.limit(1).keys((function(t){return t[0]})).then(t)}lastKey(t){return this.reverse().firstKey(t)}distinct(){var t=this._ctx,n=t.index&&t.table.schema.idxByName[t.index];if(!n||!n.multi)return this;var e={};return Vn(this._ctx,(function(t){var n=t.primaryKey.toString(),r=p(e,n);return e[n]=!0,!r})),this}modify(t){var n=this._ctx;return this._write((e=>{var r;if(typeof t=="function")r=t;else{var i=c(t),s=i.length;r=function(n){for(var e=!1,r=0;r<s;++r){var o=i[r],u=t[o];A(n,o)!==u&&(E(n,o,u),e=!0)}return e}}const o=n.table.core,{outbound:u,extractKey:a}=o.schema.primaryKey,l=this.db._options.modifyChunkSize||200,h=[];let f=0;const d=[],p=(t,n)=>{const{failures:e,numFailures:r}=n;f+=t-r;for(let t of c(e))h.push(e[t])};return this.clone().primaryKeys().then((i=>{const s=c=>{const h=Math.min(l,i.length-c);return o.getMany({trans:e,keys:i.slice(c,c+h),cache:"immutable"}).then((f=>{const d=[],y=[],v=u?[]:null,m=[];for(let t=0;t<h;++t){const n=f[t],e={value:R(n),primKey:i[c+t]};r.call(e,e.value,e)!==!1&&(e.value==null?m.push(i[c+t]):u||Yn(a(n),a(e.value))===0?(y.push(e.value),u&&v.push(i[c+t])):(m.push(i[c+t]),d.push(e.value)))}const g=Un(n)&&n.limit===1/0&&(typeof t!="function"||t===te)&&{index:n.index,range:n.range};return Promise.resolve(d.length>0&&o.mutate({trans:e,type:"add",values:d}).then((t=>{for(let n in t.failures)m.splice(parseInt(n),1);p(d.length,t)}))).then((()=>(y.length>0||g&&typeof t=="object")&&o.mutate({trans:e,type:"put",keys:v,values:y,criteria:g,changeSpec:typeof t!="function"&&t}).then((t=>p(y.length,t))))).then((()=>(m.length>0||g&&t===te)&&o.mutate({trans:e,type:"delete",keys:m,criteria:g}).then((t=>p(m.length,t))))).then((()=>i.length>c+h&&s(c+l)))}))};return s(0).then((()=>{if(h.length>0)throw new nt("Error modifying one or more objects",h,f,d);return i.length}))}))}))}delete(){var t=this._ctx,n=t.range;return Un(t)&&(t.isPrimKey&&!In||n.type===3)?this._write((e=>{const{primaryKey:r}=t.table.core.schema,i=n;return t.table.core.count({trans:e,query:{index:r,range:i}}).then((n=>t.table.core.mutate({trans:e,type:"deleteRange",range:i}).then((({failures:t,lastResult:e,results:r,numFailures:i})=>{if(i)throw new nt("Could not delete some values",Object.keys(t).map((n=>t[n])),n-i);return n-i}))))})):this.modify(te)}}const te=(t,n)=>n.value=null;function ne(t,n){return t<n?-1:t===n?0:1}function ee(t,n){return t>n?-1:t===n?0:1}function re(t,n,e){var r=t instanceof ce?new t.Collection(t):t;return r._ctx.error=e?new e(n):new TypeError(n),r}function ie(t){return new t.Collection(t,(()=>ae(""))).limit(0)}function se(t,n,e,r,i,s){for(var o=Math.min(t.length,r.length),u=-1,a=0;a<o;++a){var c=n[a];if(c!==r[a])return i(t[a],e[a])<0?t.substr(0,a)+e[a]+e.substr(a+1):i(t[a],r[a])<0?t.substr(0,a)+r[a]+e.substr(a+1):u>=0?t.substr(0,u)+n[u]+e.substr(u+1):null;i(t[a],c)<0&&(u=a)}return o<r.length&&s==="next"?t+e.substr(t.length):o<t.length&&s==="prev"?t.substr(0,e.length):u<0?null:t.substr(0,u)+r[u]+e.substr(u+1)}function oe(t,n,e,r){var i,s,o,u,a,c,l,h=e.length;if(!e.every((t=>typeof t=="string")))return re(t,En);function f(t){i=function(t){return t==="next"?t=>t.toUpperCase():t=>t.toLowerCase()}(t),s=function(t){return t==="next"?t=>t.toLowerCase():t=>t.toUpperCase()}(t),o=t==="next"?ne:ee;var n=e.map((function(t){return{lower:s(t),upper:i(t)}})).sort((function(t,n){return o(t.lower,n.lower)}));u=n.map((function(t){return t.upper})),a=n.map((function(t){return t.lower})),c=t,l=t==="next"?"":r}f("next");var d=new t.Collection(t,(()=>ue(u[0],a[h-1]+r)));d._ondirectionchange=function(t){f(t)};var p=0;return d._addAlgorithm((function(t,e,r){var i=t.key;if(typeof i!="string")return!1;var f=s(i);if(n(f,a,p))return!0;for(var d=null,y=p;y<h;++y){var v=se(i,f,u[y],a[y],o,c);v===null&&d===null?p=y+1:(d===null||o(d,v)>0)&&(d=v)}return e(d!==null?function(){t.continue(d+l)}:r),!1})),d}function ue(t,n,e,r){return{type:2,lower:t,upper:n,lowerOpen:e,upperOpen:r}}function ae(t){return{type:1,lower:t,upper:t}}class ce{get Collection(){return this._ctx.table.db.Collection}between(t,n,e,r){e=e!==!1,r=r===!0;try{return this._cmp(t,n)>0||this._cmp(t,n)===0&&(e||r)&&(!e||!r)?ie(this):new this.Collection(this,(()=>ue(t,n,!e,!r)))}catch{return re(this,An)}}equals(t){return t==null?re(this,An):new this.Collection(this,(()=>ae(t)))}above(t){return t==null?re(this,An):new this.Collection(this,(()=>ue(t,void 0,!0)))}aboveOrEqual(t){return t==null?re(this,An):new this.Collection(this,(()=>ue(t,void 0,!1)))}below(t){return t==null?re(this,An):new this.Collection(this,(()=>ue(void 0,t,!1,!0)))}belowOrEqual(t){return t==null?re(this,An):new this.Collection(this,(()=>ue(void 0,t)))}startsWith(t){return typeof t!="string"?re(this,En):this.between(t,t+xn,!0,!0)}startsWithIgnoreCase(t){return t===""?this.startsWith(t):oe(this,((t,n)=>t.indexOf(n[0])===0),[t],xn)}equalsIgnoreCase(t){return oe(this,((t,n)=>t===n[0]),[t],"")}anyOfIgnoreCase(){var t=L.apply(_,arguments);return t.length===0?ie(this):oe(this,((t,n)=>n.indexOf(t)!==-1),t,"")}startsWithAnyOfIgnoreCase(){var t=L.apply(_,arguments);return t.length===0?ie(this):oe(this,((t,n)=>n.some((n=>t.indexOf(n)===0))),t,xn)}anyOf(){const t=L.apply(_,arguments);let n=this._cmp;try{t.sort(n)}catch{return re(this,An)}if(t.length===0)return ie(this);const e=new this.Collection(this,(()=>ue(t[0],t[t.length-1])));e._ondirectionchange=e=>{n=e==="next"?this._ascending:this._descending,t.sort(n)};let r=0;return e._addAlgorithm(((e,i,s)=>{const o=e.key;for(;n(o,t[r])>0;)if(++r,r===t.length)return i(s),!1;return n(o,t[r])===0||(i((()=>{e.continue(t[r])})),!1)})),e}notEqual(t){return this.inAnyRange([[Cn,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const t=L.apply(_,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return re(this,An)}const n=t.reduce(((t,n)=>t?t.concat([[t[t.length-1][1],n]]):[[Cn,n]]),null);return n.push([t[t.length-1],this.db._maxKey]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})}inAnyRange(t,n){const e=this._cmp,r=this._ascending,i=this._descending,s=this._min,o=this._max;if(t.length===0)return ie(this);if(!t.every((t=>t[0]!==void 0&&t[1]!==void 0&&r(t[0],t[1])<=0)))return re(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",st.InvalidArgument);const u=!n||n.includeLowers!==!1,a=n&&n.includeUppers===!0;let c,l=r;function h(t,n){return l(t[0],n[0])}try{c=t.reduce((function(t,n){let r=0,i=t.length;for(;r<i;++r){const i=t[r];if(e(n[0],i[1])<0&&e(n[1],i[0])>0){i[0]=s(i[0],n[0]),i[1]=o(i[1],n[1]);break}}return r===i&&t.push(n),t}),[]),c.sort(h)}catch{return re(this,An)}let f=0;const d=a?t=>r(t,c[f][1])>0:t=>r(t,c[f][1])>=0,p=u?t=>i(t,c[f][0])>0:t=>i(t,c[f][0])>=0;let y=d;const v=new this.Collection(this,(()=>ue(c[0][0],c[c.length-1][1],!u,!a)));return v._ondirectionchange=t=>{t==="next"?(y=d,l=r):(y=p,l=i),c.sort(h)},v._addAlgorithm(((t,n,e)=>{for(var i=t.key;y(i);)if(++f,f===c.length)return n(e),!1;return!!function(t){return!d(t)&&!p(t)}(i)||(this._cmp(i,c[f][1])===0||this._cmp(i,c[f][0])===0||n((()=>{l===r?t.continue(c[f][0]):t.continue(c[f][1])})),!1)})),v}startsWithAnyOf(){const t=L.apply(_,arguments);return t.every((t=>typeof t=="string"))?t.length===0?ie(this):this.inAnyRange(t.map((t=>[t,t+xn]))):re(this,"startsWithAnyOf() only works with strings")}}function le(t){return tn((function(n){return he(n),t(n.target.error),!1}))}function he(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}const fe="storagemutated",de="x-storagemutated-1",pe=_n(null,fe);class ye{_lock(){return P(!Rt.global),++this._reculock,this._reculock!==1||Rt.global||(Rt.lockOwnerFor=this),this}_unlock(){if(P(!Rt.global),--this._reculock==0)for(Rt.global||(Rt.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{vn(t[1],t[0])}catch{}}return this}_locked(){return this._reculock&&Rt.lockOwnerFor!==this}create(t){if(!this.mode)return this;const n=this.db.idbdb,e=this.db._state.dbOpenError;if(P(!this.idbtrans),!t&&!n)switch(e&&e.name){case"DatabaseClosedError":throw new st.DatabaseClosed(e);case"MissingAPIError":throw new st.MissingAPI(e.message,e);default:throw new st.OpenFailed(e)}if(!this.active)throw new st.TransactionInactive;return P(this._completion._state===null),(t=this.idbtrans=t||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):n.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=tn((n=>{he(n),this._reject(t.error)})),t.onabort=tn((n=>{he(n),this.active&&this._reject(new st.Abort(t.error)),this.active=!1,this.on("abort").fire(n)})),t.oncomplete=tn((()=>{this.active=!1,this._resolve(),"mutatedParts"in t&&pe.storagemutated.fire(t.mutatedParts)})),this}_promise(t,n,e){if(t==="readwrite"&&this.mode!=="readwrite")return kn(new st.ReadOnly("Transaction is readonly"));if(!this.active)return kn(new st.TransactionInactive);if(this._locked())return new Ft(((r,i)=>{this._blockedFuncs.push([()=>{this._promise(t,n,e).then(r,i)},Rt])}));if(e)return an((()=>{var t=new Ft(((t,e)=>{this._lock();const r=n(t,e,this);r&&r.then&&r.then(t,e)}));return t.finally((()=>this._unlock())),t._lib=!0,t}));var r=new Ft(((t,e)=>{var r=n(t,e,this);r&&r.then&&r.then(t,e)}));return r._lib=!0,r}_root(){return this.parent?this.parent._root():this}waitFor(t){var n=this._root();const e=Ft.resolve(t);if(n._waitingFor)n._waitingFor=n._waitingFor.then((()=>e));else{n._waitingFor=e,n._waitingQueue=[];var r=n.idbtrans.objectStore(n.storeNames[0]);(function t(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(r.get(-1/0).onsuccess=t)})()}var i=n._waitingFor;return new Ft(((t,r)=>{e.then((e=>n._waitingQueue.push(tn(t.bind(null,e)))),(t=>n._waitingQueue.push(tn(r.bind(null,t))))).finally((()=>{n._waitingFor===i&&(n._waitingFor=null)}))}))}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new st.Abort))}table(t){const n=this._memoizedTables||(this._memoizedTables={});if(p(n,t))return n[t];const e=this.schema[t];if(!e)throw new st.NotFound("Table "+t+" not part of transaction");const r=new this.db.Table(t,e,this);return r.core=this.db.core.table(t),n[t]=r,r}}function ve(t,n,e,r,i,s,o){return{name:t,keyPath:n,unique:e,multi:r,auto:i,compound:s,src:(e&&!o?"&":"")+(r?"*":"")+(i?"++":"")+me(n)}}function me(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function ge(t,n,e){return{name:t,primKey:n,indexes:e,mappedClass:null,idxByName:C(e,(t=>[t.name,t]))}}let we=t=>{try{return t.only([[]]),we=()=>[[]],[[]]}catch{return we=()=>xn,xn}};function be(t){return t==null?()=>{}:typeof t=="string"?function(t){return t.split(".").length===1?n=>n[t]:n=>A(n,t)}(t):n=>A(n,t)}function $e(t){return[].slice.call(t)}let ke=0;function Se(t){return t==null?":id":typeof t=="string"?t:`[${t.join("+")}]`}function Pe(t,n,e){function r(t){if(t.type===3)return null;if(t.type===4)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:e,upper:r,lowerOpen:i,upperOpen:s}=t;return e===void 0?r===void 0?null:n.upperBound(r,!!s):r===void 0?n.lowerBound(e,!!i):n.bound(e,r,!!i,!!s)}const{schema:i,hasGetAll:s}=function(t,n){const e=$e(t.objectStoreNames);return{schema:{name:t.name,tables:e.map((t=>n.objectStore(t))).map((t=>{const{keyPath:n,autoIncrement:e}=t,r=l(n),i=n==null,s={},o={name:t.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:i,compound:r,keyPath:n,autoIncrement:e,unique:!0,extractKey:be(n)},indexes:$e(t.indexNames).map((n=>t.index(n))).map((t=>{const{name:n,unique:e,multiEntry:r,keyPath:i}=t,o={name:n,compound:l(i),keyPath:i,unique:e,multiEntry:r,extractKey:be(i)};return s[Se(i)]=o,o})),getIndexByKeyPath:t=>s[Se(t)]};return s[":id"]=o.primaryKey,n!=null&&(s[Se(n)]=o.primaryKey),o}))},hasGetAll:e.length>0&&"getAll"in n.objectStore(e[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(t,e),o=i.tables.map((t=>function(t){const n=t.name;return{name:n,schema:t,mutate:function({trans:t,type:e,keys:i,values:s,range:o}){return new Promise(((u,a)=>{u=tn(u);const c=t.objectStore(n),l=c.keyPath==null,h=e==="put"||e==="add";if(!h&&e!=="delete"&&e!=="deleteRange")throw new Error("Invalid operation type: "+e);const{length:f}=i||s||{length:1};if(i&&s&&i.length!==s.length)throw new Error("Given keys array must have same length as given values array.");if(f===0)return u({numFailures:0,failures:{},results:[],lastResult:void 0});let d;const p=[],y=[];let v=0;const m=t=>{++v,he(t)};if(e==="deleteRange"){if(o.type===4)return u({numFailures:v,failures:y,results:[],lastResult:void 0});o.type===3?p.push(d=c.clear()):p.push(d=c.delete(r(o)))}else{const[t,n]=h?l?[s,i]:[s,null]:[i,null];if(h)for(let r=0;r<f;++r)p.push(d=n&&n[r]!==void 0?c[e](t[r],n[r]):c[e](t[r])),d.onerror=m;else for(let n=0;n<f;++n)p.push(d=c[e](t[n])),d.onerror=m}const g=t=>{const n=t.target.result;p.forEach(((t,n)=>t.error!=null&&(y[n]=t.error))),u({numFailures:v,failures:y,results:e==="delete"?i:p.map((t=>t.result)),lastResult:n})};d.onerror=t=>{m(t),g(t)},d.onsuccess=g}))},getMany:({trans:t,keys:e})=>new Promise(((r,i)=>{r=tn(r);const s=t.objectStore(n),o=e.length,u=new Array(o);let a,c=0,l=0;const h=t=>{const n=t.target;u[n._pos]=n.result,++l===c&&r(u)},f=le(i);for(let t=0;t<o;++t)e[t]!=null&&(a=s.get(e[t]),a._pos=t,a.onsuccess=h,a.onerror=f,++c);c===0&&r(u)})),get:({trans:t,key:e})=>new Promise(((r,i)=>{r=tn(r);const s=t.objectStore(n).get(e);s.onsuccess=t=>r(t.target.result),s.onerror=le(i)})),query:function(t){return e=>new Promise(((i,s)=>{i=tn(i);const{trans:o,values:u,limit:a,query:c}=e,l=a===1/0?void 0:a,{index:h,range:f}=c,d=o.objectStore(n),p=h.isPrimaryKey?d:d.index(h.name),y=r(f);if(a===0)return i({result:[]});if(t){const t=u?p.getAll(y,l):p.getAllKeys(y,l);t.onsuccess=t=>i({result:t.target.result}),t.onerror=le(s)}else{let t=0;const n=u||!("openKeyCursor"in p)?p.openCursor(y):p.openKeyCursor(y),e=[];n.onsuccess=r=>{const s=n.result;return s?(e.push(u?s.value:s.primaryKey),++t===a?i({result:e}):void s.continue()):i({result:e})},n.onerror=le(s)}}))}(s),openCursor:function({trans:t,values:e,query:i,reverse:s,unique:o}){return new Promise(((u,a)=>{u=tn(u);const{index:c,range:l}=i,h=t.objectStore(n),f=c.isPrimaryKey?h:h.index(c.name),d=s?o?"prevunique":"prev":o?"nextunique":"next",p=e||!("openKeyCursor"in f)?f.openCursor(r(l),d):f.openKeyCursor(r(l),d);p.onerror=le(a),p.onsuccess=tn((n=>{const e=p.result;if(!e)return void u(null);e.___id=++ke,e.done=!1;const r=e.continue.bind(e);let i=e.continuePrimaryKey;i&&(i=i.bind(e));const s=e.advance.bind(e),o=()=>{throw new Error("Cursor not stopped")};e.trans=t,e.stop=e.continue=e.continuePrimaryKey=e.advance=()=>{throw new Error("Cursor not started")},e.fail=tn(a),e.next=function(){let t=1;return this.start((()=>t--?this.continue():this.stop())).then((()=>this))},e.start=t=>{const n=new Promise(((t,n)=>{t=tn(t),p.onerror=le(n),e.fail=n,e.stop=n=>{e.stop=e.continue=e.continuePrimaryKey=e.advance=o,t(n)}})),u=()=>{if(p.result)try{t()}catch(t){e.fail(t)}else e.done=!0,e.start=()=>{throw new Error("Cursor behind last entry")},e.stop()};return p.onsuccess=tn((t=>{p.onsuccess=u,u()})),e.continue=r,e.continuePrimaryKey=i,e.advance=s,u(),n},u(e)}),a)}))},count({query:t,trans:e}){const{index:i,range:s}=t;return new Promise(((t,o)=>{const u=e.objectStore(n),a=i.isPrimaryKey?u:u.index(i.name),c=r(s),l=c?a.count(c):a.count();l.onsuccess=tn((n=>t(n.target.result))),l.onerror=le(o)}))}}}(t))),u={};return o.forEach((t=>u[t.name]=t)),{stack:"dbcore",transaction:t.transaction.bind(t),table(t){if(!u[t])throw new Error(`Table '${t}' not found`);return u[t]},MIN_KEY:-1/0,MAX_KEY:we(n),schema:i}}function xe({_novip:t},n){const e=n.db,r=function(t,n,{IDBKeyRange:e,indexedDB:r},i){return{dbcore:function(t,n){return n.reduce(((t,{create:n})=>({...t,...n(t)})),t)}(Pe(n,e,i),t.dbcore)}}(t._middlewares,e,t._deps,n);t.core=r.dbcore,t.tables.forEach((n=>{const e=n.name;t.core.schema.tables.some((t=>t.name===e))&&(n.core=t.core.table(e),t[e]instanceof t.Table&&(t[e].core=n.core))}))}function Ce({_novip:t},n,e,r){e.forEach((e=>{const i=r[e];n.forEach((n=>{const r=b(n,e);(!r||"value"in r&&r.value===void 0)&&(n===t.Transaction.prototype||n instanceof t.Transaction?m(n,e,{get(){return this.table(e)},set(t){v(this,e,{value:t,writable:!0,configurable:!0,enumerable:!0})}}):n[e]=new t.Table(e,i))}))}))}function Ae({_novip:t},n){n.forEach((n=>{for(let e in n)n[e]instanceof t.Table&&delete n[e]}))}function Ee(t,n){return t._cfg.version-n._cfg.version}function De(t,n,e,r){const i=t._dbSchema,s=t._createTransaction("readwrite",t._storeNames,i);s.create(e),s._completion.catch(r);const o=s._reject.bind(s),u=Rt.transless||Rt;an((()=>{Rt.trans=s,Rt.transless=u,n===0?(c(i).forEach((t=>{je(e,t,i[t].primKey,i[t].indexes)})),xe(t,e),Ft.follow((()=>t.on.populate.fire(s))).catch(o)):function({_novip:t},n,e,r){const i=[],s=t._versions;let o=t._dbSchema=Ke(t,t.idbdb,r),u=!1;const a=s.filter((t=>t._cfg.version>=n));function l(){return i.length?Ft.resolve(i.shift()(e.idbtrans)).then(l):Ft.resolve()}return a.forEach((s=>{i.push((()=>{const i=o,a=s._cfg.dbschema;Te(t,i,r),Te(t,a,r),o=t._dbSchema=a;const l=Oe(i,a);l.add.forEach((t=>{je(r,t[0],t[1].primKey,t[1].indexes)})),l.change.forEach((t=>{if(t.recreate)throw new st.Upgrade("Not yet support for changing primary key");{const n=r.objectStore(t.name);t.add.forEach((t=>Ie(n,t))),t.change.forEach((t=>{n.deleteIndex(t.name),Ie(n,t)})),t.del.forEach((t=>n.deleteIndex(t)))}}));const h=s._cfg.contentUpgrade;if(h&&s._cfg.version>n){xe(t,r),e._memoizedTables={},u=!0;let n=D(a);l.del.forEach((t=>{n[t]=i[t]})),Ae(t,[t.Transaction.prototype]),Ce(t,[t.Transaction.prototype],c(n),n),e.schema=n;const s=U(h);let o;s&&cn();const f=Ft.follow((()=>{if(o=h(e),o&&s){var t=ln.bind(null,null);o.then(t,t)}}));return o&&typeof o.then=="function"?Ft.resolve(o):f.then((()=>o))}})),i.push((n=>{(!u||!jn)&&function(t,n){[].slice.call(n.db.objectStoreNames).forEach((e=>t[e]==null&&n.db.deleteObjectStore(e)))}(s._cfg.dbschema,n),Ae(t,[t.Transaction.prototype]),Ce(t,[t.Transaction.prototype],t._storeNames,t._dbSchema),e.schema=t._dbSchema}))})),l().then((()=>{var t,n;n=r,c(t=o).forEach((e=>{n.db.objectStoreNames.contains(e)||je(n,e,t[e].primKey,t[e].indexes)}))}))}(t,n,s,e).catch(o)}))}function Oe(t,n){const e={del:[],add:[],change:[]};let r;for(r in t)n[r]||e.del.push(r);for(r in n){const i=t[r],s=n[r];if(i){const t={name:r,def:s,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(s.primKey.keyPath||"")||i.primKey.auto!==s.primKey.auto&&!On)t.recreate=!0,e.change.push(t);else{const n=i.idxByName,r=s.idxByName;let o;for(o in n)r[o]||t.del.push(o);for(o in r){const e=n[o],i=r[o];e?e.src!==i.src&&t.change.push(i):t.add.push(i)}(t.del.length>0||t.add.length>0||t.change.length>0)&&e.change.push(t)}}else e.add.push([r,s])}return e}function je(t,n,e,r){const i=t.db.createObjectStore(n,e.keyPath?{keyPath:e.keyPath,autoIncrement:e.auto}:{autoIncrement:e.auto});return r.forEach((t=>Ie(i,t))),i}function Ie(t,n){t.createIndex(n.name,n.keyPath,{unique:n.unique,multiEntry:n.multi})}function Ke(t,n,e){const r={};return k(n.objectStoreNames,0).forEach((t=>{const n=e.objectStore(t);let i=n.keyPath;const s=ve(me(i),i||"",!1,!1,!!n.autoIncrement,i&&typeof i!="string",!0),o=[];for(let t=0;t<n.indexNames.length;++t){const e=n.index(n.indexNames[t]);i=e.keyPath;var u=ve(e.name,i,!!e.unique,!!e.multiEntry,!1,i&&typeof i!="string",!1);o.push(u)}r[t]=ge(t,s,o)})),r}function Te({_novip:t},n,e){const r=e.db.objectStoreNames;for(let i=0;i<r.length;++i){const s=r[i],o=e.objectStore(s);t._hasGetAll="getAll"in o;for(let t=0;t<o.indexNames.length;++t){const e=o.indexNames[t],r=o.index(e).keyPath,i=typeof r=="string"?r:"["+k(r).join("+")+"]";if(n[s]){const t=n[s].idxByName[i];t&&(t.name=e,delete n[s].idxByName[i],n[s].idxByName[e]=t)}}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&a.WorkerGlobalScope&&a instanceof a.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(t._hasGetAll=!1)}class Re{_parseStoresSpec(t,n){c(t).forEach((e=>{if(t[e]!==null){var r=t[e].split(",").map(((t,n)=>{const e=(t=t.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(e)?e.match(/^\[(.*)\]$/)[1].split("+"):e;return ve(e,r||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),l(r),n===0)})),i=r.shift();if(i.multi)throw new st.Schema("Primary key cannot be multi-valued");r.forEach((t=>{if(t.auto)throw new st.Schema("Only primary key can be marked as autoIncrement (++)");if(!t.keyPath)throw new st.Schema("Index must have a name and cannot be an empty string")})),n[e]=ge(e,i,r)}}))}stores(t){const n=this.db;this._cfg.storesSource=this._cfg.storesSource?h(this._cfg.storesSource,t):t;const e=n._versions,r={};let i={};return e.forEach((t=>{h(r,t._cfg.storesSource),i=t._cfg.dbschema={},t._parseStoresSpec(r,i)})),n._dbSchema=i,Ae(n,[n._allTables,n,n.Transaction.prototype]),Ce(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],c(i),i),n._storeNames=c(i),this}upgrade(t){return this._cfg.contentUpgrade=vt(this._cfg.contentUpgrade||at,t),this}}function Be(t,n){let e=t._dbNamesDB;return e||(e=t._dbNamesDB=new sr(Tn,{addons:[],indexedDB:t,IDBKeyRange:n}),e.version(1).stores({dbnames:"name"})),e.table("dbnames")}function qe(t){return t&&typeof t.databases=="function"}function Me(t){return an((function(){return Rt.letThrough=!0,t()}))}function Fe(){var t;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise((function(n){var e=function(){return indexedDB.databases().finally(n)};t=setInterval(e,100),e()})).finally((function(){return clearInterval(t)})):Promise.resolve()}function Ne(t){const n=t._state,{indexedDB:e}=t._deps;if(n.isBeingOpened||t.idbdb)return n.dbReadyPromise.then((()=>n.dbOpenError?kn(n.dbOpenError):t));V&&(n.openCanceller._stackHolder=z()),n.isBeingOpened=!0,n.dbOpenError=null,n.openComplete=!1;const r=n.openCanceller;function i(){if(n.openCanceller!==r)throw new st.DatabaseClosed("db.open() was cancelled")}let s=n.dbReadyResolve,o=null,u=!1;return Ft.race([r,(typeof navigator>"u"?Ft.resolve():Fe()).then((()=>new Ft(((r,s)=>{if(i(),!e)throw new st.MissingAPI;const a=t.name,l=n.autoSchema?e.open(a):e.open(a,Math.round(10*t.verno));if(!l)throw new st.MissingAPI;l.onerror=le(s),l.onblocked=tn(t._fireOnBlocked),l.onupgradeneeded=tn((r=>{if(o=l.transaction,n.autoSchema&&!t._options.allowEmptyDB){l.onerror=he,o.abort(),l.result.close();const t=e.deleteDatabase(a);t.onsuccess=t.onerror=tn((()=>{s(new st.NoSuchDatabase(`Database ${a} doesnt exist`))}))}else{o.onerror=le(s);var i=r.oldVersion>Math.pow(2,62)?0:r.oldVersion;u=i<1,t._novip.idbdb=l.result,De(t,i/10,o,s)}}),s),l.onsuccess=tn((()=>{o=null;const e=t._novip.idbdb=l.result,i=k(e.objectStoreNames);if(i.length>0)try{const r=e.transaction((s=i).length===1?s[0]:s,"readonly");n.autoSchema?function({_novip:t},n,e){t.verno=n.version/10;const r=t._dbSchema=Ke(0,n,e);t._storeNames=k(n.objectStoreNames,0),Ce(t,[t._allTables],c(r),r)}(t,e,r):(Te(t,t._dbSchema,r),function(t,n){const e=Oe(Ke(0,t.idbdb,n),t._dbSchema);return!(e.add.length||e.change.some((t=>t.add.length||t.change.length)))}(t,r)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),xe(t,r)}catch{}var s;Dn.push(t),e.onversionchange=tn((e=>{n.vcFired=!0,t.on("versionchange").fire(e)})),e.onclose=tn((n=>{t.on("close").fire(n)})),u&&function({indexedDB:t,IDBKeyRange:n},e){!qe(t)&&e!==Tn&&Be(t,n).put({name:e}).catch(at)}(t._deps,a),r()}),s)}))))]).then((()=>(i(),n.onReadyBeingFired=[],Ft.resolve(Me((()=>t.on.ready.fire(t.vip)))).then((function e(){if(n.onReadyBeingFired.length>0){let r=n.onReadyBeingFired.reduce(vt,at);return n.onReadyBeingFired=[],Ft.resolve(Me((()=>r(t.vip)))).then(e)}}))))).finally((()=>{n.onReadyBeingFired=null,n.isBeingOpened=!1})).then((()=>t)).catch((e=>{n.dbOpenError=e;try{o&&o.abort()}catch{}return r===n.openCanceller&&t._close(),kn(e)})).finally((()=>{n.openComplete=!0,s()}))}function _e(t){var n=n=>t.next(n),e=i(n),r=i((n=>t.throw(n)));function i(t){return n=>{var i=t(n),s=i.value;return i.done?s:s&&typeof s.then=="function"?s.then(e,r):l(s)?Promise.all(s).then(e,r):e(s)}}return i(n)()}function Le(t,n,e){var r=arguments.length;if(r<2)throw new st.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];return e=i.pop(),[t,j(i),e]}function Ue(t,n,e,r,i){return Ft.resolve().then((()=>{const s=Rt.transless||Rt,o=t._createTransaction(n,e,t._dbSchema,r),u={trans:o,transless:s};if(r)o.idbtrans=r.idbtrans;else try{o.create(),t._state.PR1398_maxLoop=3}catch(r){return r.name===rt.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then((()=>Ue(t,n,e,null,i)))):kn(r)}const a=U(i);let c;a&&cn();const l=Ft.follow((()=>{if(c=i.call(o,o),c)if(a){var t=ln.bind(null,null);c.then(t,t)}else typeof c.next=="function"&&typeof c.throw=="function"&&(c=_e(c))}),u);return(c&&typeof c.then=="function"?Ft.resolve(c).then((t=>o.active?t:kn(new st.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")))):l.then((()=>c))).then((t=>(r&&o._resolve(),o._completion.then((()=>t))))).catch((t=>(o._reject(t),kn(t))))}))}function Ve(t,n,e){const r=l(t)?t.slice():[t];for(let t=0;t<e;++t)r.push(n);return r}const We={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(t){return{...t,table(n){const e=t.table(n),{schema:r}=e,i={},s=[];function o(t,n,e){const r=Se(t),u=i[r]=i[r]||[],a=t==null?0:typeof t=="string"?1:t.length,c=n>0,l={...e,isVirtual:c,keyTail:n,keyLength:a,extractKey:be(t),unique:!c&&e.unique};return u.push(l),l.isPrimaryKey||s.push(l),a>1&&o(a===2?t[0]:t.slice(0,a-1),n+1,e),u.sort(((t,n)=>t.keyTail-n.keyTail)),l}const u=o(r.primaryKey.keyPath,0,r.primaryKey);i[":id"]=[u];for(const t of r.indexes)o(t.keyPath,0,t);function a(n){const e=n.query.index;return e.isVirtual?{...n,query:{index:e,range:(r=n.query.range,i=e.keyTail,{type:r.type===1?2:r.type,lower:Ve(r.lower,r.lowerOpen?t.MAX_KEY:t.MIN_KEY,i),lowerOpen:!0,upper:Ve(r.upper,r.upperOpen?t.MIN_KEY:t.MAX_KEY,i),upperOpen:!0})}}:n;var r,i}return{...e,schema:{...r,primaryKey:u,indexes:s,getIndexByKeyPath:function(t){const n=i[Se(t)];return n&&n[0]}},count:t=>e.count(a(t)),query:t=>e.query(a(t)),openCursor(n){const{keyTail:r,isVirtual:i,keyLength:s}=n.query.index;return i?e.openCursor(a(n)).then((e=>e&&function(e){return Object.create(e,{continue:{value:function(i){i!=null?e.continue(Ve(i,n.reverse?t.MAX_KEY:t.MIN_KEY,r)):n.unique?e.continue(e.key.slice(0,s).concat(n.reverse?t.MIN_KEY:t.MAX_KEY,r)):e.continue()}},continuePrimaryKey:{value(n,i){e.continuePrimaryKey(Ve(n,t.MAX_KEY,r),i)}},primaryKey:{get:()=>e.primaryKey},key:{get(){const t=e.key;return s===1?t[0]:t.slice(0,s)}},value:{get:()=>e.value}})}(e))):e.openCursor(n)}}}}}};function He(t,n,e,r){return e=e||{},r=r||"",c(t).forEach((i=>{if(p(n,i)){var s=t[i],o=n[i];if(typeof s=="object"&&typeof o=="object"&&s&&o){const t=M(s);t!==M(o)?e[r+i]=n[i]:t==="Object"?He(s,o,e,r+i+"."):s!==o&&(e[r+i]=n[i])}else s!==o&&(e[r+i]=n[i])}else e[r+i]=void 0})),c(n).forEach((i=>{p(t,i)||(e[r+i]=n[i])})),e}const Ge={stack:"dbcore",name:"HooksMiddleware",level:2,create:t=>({...t,table(n){const e=t.table(n),{primaryKey:r}=e.schema;return{...e,mutate(t){const i=Rt.trans,{deleting:s,creating:o,updating:u}=i.table(n).hook;switch(t.type){case"add":if(o.fire===at)break;return i._promise("readwrite",(()=>a(t)),!0);case"put":if(o.fire===at&&u.fire===at)break;return i._promise("readwrite",(()=>a(t)),!0);case"delete":if(s.fire===at)break;return i._promise("readwrite",(()=>a(t)),!0);case"deleteRange":if(s.fire===at)break;return i._promise("readwrite",(()=>function(t){return c(t.trans,t.range,1e4)}(t)),!0)}return e.mutate(t);function a(t){const n=Rt.trans,i=t.keys||function(t,n){return n.type==="delete"?n.keys:n.keys||n.values.map(t.extractKey)}(r,t);if(!i)throw new Error("Keys missing");return(t=t.type==="add"||t.type==="put"?{...t,keys:i}:{...t}).type!=="delete"&&(t.values=[...t.values]),t.keys&&(t.keys=[...t.keys]),function(t,n,e){return n.type==="add"?Promise.resolve([]):t.getMany({trans:n.trans,keys:e,cache:"immutable"})}(e,t,i).then((a=>{const c=i.map(((e,i)=>{const c=a[i],l={onerror:null,onsuccess:null};if(t.type==="delete")s.fire.call(l,e,c,n);else if(t.type==="add"||c===void 0){const s=o.fire.call(l,e,t.values[i],n);e==null&&s!=null&&(e=s,t.keys[i]=e,r.outbound||E(t.values[i],r.keyPath,e))}else{const r=He(c,t.values[i]),s=u.fire.call(l,r,e,c,n);if(s){const n=t.values[i];Object.keys(s).forEach((t=>{p(n,t)?n[t]=s[t]:E(n,t,s[t])}))}}return l}));return e.mutate(t).then((({failures:n,results:e,numFailures:r,lastResult:s})=>{for(let r=0;r<i.length;++r){const s=e?e[r]:i[r],o=c[r];s==null?o.onerror&&o.onerror(n[r]):o.onsuccess&&o.onsuccess(t.type==="put"&&a[r]?t.values[r]:s)}return{failures:n,results:e,numFailures:r,lastResult:s}})).catch((t=>(c.forEach((n=>n.onerror&&n.onerror(t))),Promise.reject(t))))}))}function c(t,n,i){return e.query({trans:t,values:!1,query:{index:r,range:n},limit:i}).then((({result:e})=>a({type:"delete",keys:e,trans:t}).then((r=>r.numFailures>0?Promise.reject(r.failures[0]):e.length<i?{failures:[],numFailures:0,lastResult:void 0}:c(t,{...n,lower:e[e.length-1],lowerOpen:!0},i)))))}}}}})};function ze(t,n,e){try{if(!n||n.keys.length<t.length)return null;const r=[];for(let i=0,s=0;i<n.keys.length&&s<t.length;++i)Yn(n.keys[i],t[s])===0&&(r.push(e?R(n.values[i]):n.values[i]),++s);return r.length===t.length?r:null}catch{return null}}const Je={stack:"dbcore",level:-1,create:t=>({table:n=>{const e=t.table(n);return{...e,getMany:t=>{if(!t.cache)return e.getMany(t);const n=ze(t.keys,t.trans._cache,t.cache==="clone");return n?Ft.resolve(n):e.getMany(t).then((n=>(t.trans._cache={keys:t.keys,values:t.cache==="clone"?R(n):n},n)))},mutate:t=>(t.type!=="add"&&(t.trans._cache=null),e.mutate(t))}}})};function Ye(t){return!("from"in t)}const Qe=function(t,n){if(!this){const n=new Qe;return t&&"d"in t&&h(n,t),n}h(this,arguments.length?{d:1,from:t,to:arguments.length>1?n:t}:{d:0})};function Xe(t,n,e){const r=Yn(n,e);if(isNaN(r))return;if(r>0)throw RangeError();if(Ye(t))return h(t,{from:n,to:e,d:1});const i=t.l,s=t.r;if(Yn(e,t.from)<0)return i?Xe(i,n,e):t.l={from:n,to:e,d:1,l:null,r:null},er(t);if(Yn(n,t.to)>0)return s?Xe(s,n,e):t.r={from:n,to:e,d:1,l:null,r:null},er(t);Yn(n,t.from)<0&&(t.from=n,t.l=null,t.d=s?s.d+1:1),Yn(e,t.to)>0&&(t.to=e,t.r=null,t.d=t.l?t.l.d+1:1);const o=!t.r;i&&!t.l&&Ze(t,i),s&&o&&Ze(t,s)}function Ze(t,n){Ye(n)||function t(n,{from:e,to:r,l:i,r:s}){Xe(n,e,r),i&&t(n,i),s&&t(n,s)}(t,n)}function tr(t,n){const e=nr(n);let r=e.next();if(r.done)return!1;let i=r.value;const s=nr(t);let o=s.next(i.from),u=o.value;for(;!r.done&&!o.done;){if(Yn(u.from,i.to)<=0&&Yn(u.to,i.from)>=0)return!0;Yn(i.from,u.from)<0?i=(r=e.next(u.from)).value:u=(o=s.next(i.from)).value}return!1}function nr(t){let n=Ye(t)?null:{s:0,n:t};return{next(t){const e=arguments.length>0;for(;n;)switch(n.s){case 0:if(n.s=1,e)for(;n.n.l&&Yn(t,n.n.from)<0;)n={up:n,n:n.n.l,s:1};else for(;n.n.l;)n={up:n,n:n.n.l,s:1};case 1:if(n.s=2,!e||Yn(t,n.n.to)<=0)return{value:n.n,done:!1};case 2:if(n.n.r){n.s=3,n={up:n,n:n.n.r,s:0};continue}case 3:n=n.up}return{done:!0}}}}function er(t){var n,e;const r=(((n=t.r)===null||n===void 0?void 0:n.d)||0)-(((e=t.l)===null||e===void 0?void 0:e.d)||0),i=r>1?"r":r<-1?"l":"";if(i){const n=i==="r"?"l":"r",e={...t},r=t[i];t.from=r.from,t.to=r.to,t[i]=r[i],e[i]=r[n],t[n]=e,e.d=rr(e)}t.d=rr(t)}function rr({r:t,l:n}){return(t?n?Math.max(t.d,n.d):t.d:n?n.d:0)+1}y(Qe.prototype,{add(t){return Ze(this,t),this},addKey(t){return Xe(this,t,t),this},addKeys(t){return t.forEach((t=>Xe(this,t,t))),this},[F](){return nr(this)}});const ir={stack:"dbcore",level:0,create:t=>{const n=t.schema.name,e=new Qe(t.MIN_KEY,t.MAX_KEY);return{...t,table:r=>{const i=t.table(r),{schema:s}=i,{primaryKey:o}=s,{extractKey:u,outbound:a}=o,h={...i,mutate:t=>{const o=t.trans,u=o.mutatedParts||(o.mutatedParts={}),a=t=>{const e=`idb://${n}/${r}/${t}`;return u[e]||(u[e]=new Qe)},c=a(""),h=a(":dels"),{type:f}=t;let[d,p]=t.type==="deleteRange"?[t.range]:t.type==="delete"?[t.keys]:t.values.length<50?[[],t.values]:[];const y=t.trans._cache;return i.mutate(t).then((t=>{if(l(d)){f!=="delete"&&(d=t.results),c.addKeys(d);const n=ze(d,y);n||f==="add"||h.addKeys(d),(n||p)&&function(t,n,e,r){function i(n){const i=t(n.name||"");function s(t){return t!=null?n.extractKey(t):null}const o=t=>n.multiEntry&&l(t)?t.forEach((t=>i.addKey(t))):i.addKey(t);(e||r).forEach(((t,n)=>{const i=e&&s(e[n]),u=r&&s(r[n]);Yn(i,u)!==0&&(i!=null&&o(i),u!=null&&o(u))}))}n.indexes.forEach(i)}(a,s,n,p)}else if(d){const t={from:d.lower,to:d.upper};h.add(t),c.add(t)}else c.add(e),h.add(e),s.indexes.forEach((t=>a(t.name).add(e)));return t}))}},f=({query:{index:n,range:e}})=>{var r,i;return[n,new Qe((r=e.lower)!==null&&r!==void 0?r:t.MIN_KEY,(i=e.upper)!==null&&i!==void 0?i:t.MAX_KEY)]},d={get:t=>[o,new Qe(t.key)],getMany:t=>[o,(new Qe).addKeys(t.keys)],count:f,query:f,openCursor:f};return c(d).forEach((t=>{h[t]=function(s){const{subscr:o}=Rt;if(o){const c=t=>{const e=`idb://${n}/${r}/${t}`;return o[e]||(o[e]=new Qe)},l=c(""),h=c(":dels"),[f,p]=d[t](s);if(c(f.name||"").add(p),!f.isPrimaryKey){if(t!=="count"){const n=t==="query"&&a&&s.values&&i.query({...s,values:!1});return i[t].apply(this,arguments).then((e=>{if(t==="query"){if(a&&s.values)return n.then((({result:t})=>(l.addKeys(t),e)));const t=s.values?e.result.map(u):e.result;s.values?l.addKeys(t):h.addKeys(t)}else if(t==="openCursor"){const t=e,n=s.values;return t&&Object.create(t,{key:{get:()=>(h.addKey(t.primaryKey),t.key)},primaryKey:{get(){const n=t.primaryKey;return h.addKey(n),n}},value:{get:()=>(n&&l.addKey(t.primaryKey),t.value)}})}return e}))}h.add(e)}}return i[t].apply(this,arguments)}})),h}}}};class sr{constructor(t,n){this._middlewares={},this.verno=0;const e=sr.dependencies;this._options=n={addons:sr.addons,autoOpen:!0,indexedDB:e.indexedDB,IDBKeyRange:e.IDBKeyRange,...n},this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};const{addons:r}=n;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const i={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:at,dbReadyPromise:null,cancelOpen:at,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var s;i.dbReadyPromise=new Ft((t=>{i.dbReadyResolve=t})),i.openCanceller=new Ft(((t,n)=>{i.cancelOpen=n})),this._state=i,this.name=t,this.on=_n(this,"populate","blocked","versionchange","close",{ready:[vt,at]}),this.on.ready.subscribe=S(this.on.ready.subscribe,(t=>(n,e)=>{sr.vip((()=>{const r=this._state;if(r.openComplete)r.dbOpenError||Ft.resolve().then(n),e&&t(n);else if(r.onReadyBeingFired)r.onReadyBeingFired.push(n),e&&t(n);else{t(n);const r=this;e||t((function t(){r.on.ready.unsubscribe(n),r.on.ready.unsubscribe(t)}))}}))})),this.Collection=(s=this,Ln(Zn.prototype,(function(t,n){this.db=s;let e=Mn,r=null;if(n)try{e=n()}catch(t){r=t}const i=t._ctx,o=i.table,u=o.hook.reading.fire;this._ctx={table:o,index:i.index,isPrimKey:!i.index||o.schema.primKey.keyPath&&i.index===o.schema.primKey.name,range:e,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:i.or,valueMapper:u!==ct?u:null}}))),this.Table=function(t){return Ln(Nn.prototype,(function(n,e,r){this.db=t,this._tx=r,this.name=n,this.schema=e,this.hook=t._allTables[n]?t._allTables[n].hook:_n(null,{creating:[ft,at],reading:[lt,ct],updating:[pt,at],deleting:[dt,at]})}))}(this),this.Transaction=function(t){return Ln(ye.prototype,(function(n,e,r,i,s){this.db=t,this.mode=n,this.storeNames=e,this.schema=r,this.chromeTransactionDurability=i,this.idbtrans=null,this.on=_n(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 Ft(((t,n)=>{this._resolve=t,this._reject=n})),this._completion.then((()=>{this.active=!1,this.on.complete.fire()}),(t=>{var n=this.active;return this.active=!1,this.on.error.fire(t),this.parent?this.parent._reject(t):n&&this.idbtrans&&this.idbtrans.abort(),kn(t)}))}))}(this),this.Version=function(t){return Ln(Re.prototype,(function(n){this.db=t,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}(this),this.WhereClause=function(t){return Ln(ce.prototype,(function(n,e,r){this.db=t,this._ctx={table:n,index:e===":id"?null:e,or:r};const i=t._deps.indexedDB;if(!i)throw new st.MissingAPI;this._cmp=this._ascending=i.cmp.bind(i),this._descending=(t,n)=>i.cmp(n,t),this._max=(t,n)=>i.cmp(t,n)>0?t:n,this._min=(t,n)=>i.cmp(t,n)<0?t:n,this._IDBKeyRange=t._deps.IDBKeyRange}))}(this),this.on("versionchange",(t=>{t.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()})),this.on("blocked",(t=>{!t.newVersion||t.newVersion<t.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${t.oldVersion/10}`)})),this._maxKey=we(n.IDBKeyRange),this._createTransaction=(t,n,e,r)=>new this.Transaction(t,n,e,this._options.chromeTransactionDurability,r),this._fireOnBlocked=t=>{this.on("blocked").fire(t),Dn.filter((t=>t.name===this.name&&t!==this&&!t._state.vcFired)).map((n=>n.on("versionchange").fire(t)))},this.use(We),this.use(Ge),this.use(ir),this.use(Je),this.vip=Object.create(this,{_vip:{value:!0}}),r.forEach((t=>t(this)))}version(t){if(isNaN(t)||t<.1)throw new st.Type("Given version is not a positive number");if(t=Math.round(10*t)/10,this.idbdb||this._state.isBeingOpened)throw new st.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,t);const n=this._versions;var e=n.filter((n=>n._cfg.version===t))[0];return e||(e=new this.Version(t),n.push(e),n.sort(Ee),e.stores({}),this._state.autoSchema=!1,e)}_whenReady(t){return this.idbdb&&(this._state.openComplete||Rt.letThrough||this._vip)?t():new Ft(((t,n)=>{if(this._state.openComplete)return n(new st.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void n(new st.DatabaseClosed);this.open().catch(at)}this._state.dbReadyPromise.then(t,n)})).then(t)}use({stack:t,create:n,level:e,name:r}){r&&this.unuse({stack:t,name:r});const i=this._middlewares[t]||(this._middlewares[t]=[]);return i.push({stack:t,create:n,level:e??10,name:r}),i.sort(((t,n)=>t.level-n.level)),this}unuse({stack:t,name:n,create:e}){return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter((t=>e?t.create!==e:!!n&&t.name!==n))),this}open(){return Ne(this)}_close(){const t=this._state,n=Dn.indexOf(this);if(n>=0&&Dn.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}t.dbReadyPromise=new Ft((n=>{t.dbReadyResolve=n})),t.openCanceller=new Ft(((n,e)=>{t.cancelOpen=e}))}close(){this._close();const t=this._state;this._options.autoOpen=!1,t.dbOpenError=new st.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError)}delete(){const t=arguments.length>0,n=this._state;return new Ft(((e,r)=>{const i=()=>{this.close();var t=this._deps.indexedDB.deleteDatabase(this.name);t.onsuccess=tn((()=>{(function({indexedDB:t,IDBKeyRange:n},e){!qe(t)&&e!==Tn&&Be(t,n).delete(e).catch(at)})(this._deps,this.name),e()})),t.onerror=le(r),t.onblocked=this._fireOnBlocked};if(t)throw new st.InvalidArgument("Arguments not allowed in db.delete()");n.isBeingOpened?n.dbReadyPromise.then(i):i()}))}backendDB(){return this.idbdb}isOpen(){return this.idbdb!==null}hasBeenClosed(){const t=this._state.dbOpenError;return t&&t.name==="DatabaseClosed"}hasFailed(){return this._state.dbOpenError!==null}dynamicallyOpened(){return this._state.autoSchema}get tables(){return c(this._allTables).map((t=>this._allTables[t]))}transaction(){const t=Le.apply(this,arguments);return this._transaction.apply(this,t)}_transaction(t,n,e){let r=Rt.trans;r&&r.db===this&&t.indexOf("!")===-1||(r=null);const i=t.indexOf("?")!==-1;let s,o;t=t.replace("!","").replace("?","");try{if(o=n.map((t=>{var n=t instanceof this.Table?t.name:t;if(typeof n!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return n})),t=="r"||t===Rn)s=Rn;else{if(t!="rw"&&t!=Bn)throw new st.InvalidArgument("Invalid transaction mode: "+t);s=Bn}if(r){if(r.mode===Rn&&s===Bn){if(!i)throw new st.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");r=null}r&&o.forEach((t=>{if(r&&r.storeNames.indexOf(t)===-1){if(!i)throw new st.SubTransaction("Table "+t+" not included in parent transaction.");r=null}})),i&&r&&!r.active&&(r=null)}}catch(t){return r?r._promise(null,((n,e)=>{e(t)})):kn(t)}const u=Ue.bind(null,this,s,o,r,e);return r?r._promise(s,u,"lock"):Rt.trans?vn(Rt.transless,(()=>this._whenReady(u))):this._whenReady(u)}table(t){if(!p(this._allTables,t))throw new st.InvalidTable(`Table ${t} does not exist`);return this._allTables[t]}}const or=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable";class ur{constructor(t){this._subscribe=t}subscribe(t,n,e){return this._subscribe(t&&typeof t!="function"?t:{next:t,error:n,complete:e})}[or](){return this}}function ar(t,n){return c(n).forEach((e=>{Ze(t[e]||(t[e]=new Qe),n[e])})),t}function cr(t){let n,e=!1;const r=new ur((r=>{const i=U(t);let s=!1,o={},u={};const a={get closed(){return s},unsubscribe:()=>{s=!0,pe.storagemutated.unsubscribe(d)}};r.start&&r.start(a);let l=!1,h=!1;function f(){return c(u).some((t=>o[t]&&tr(o[t],u[t])))}const d=t=>{ar(o,t),f()&&p()},p=()=>{if(l||s)return;o={};const c={},y=function(n){i&&cn();const e=()=>an(t,{subscr:n,trans:null}),r=Rt.trans?vn(Rt.transless,e):e();return i&&r.then(ln,ln),r}(c);h||(pe(fe,d),h=!0),l=!0,Promise.resolve(y).then((t=>{e=!0,n=t,l=!1,s||(f()?p():(o={},u=c,r.next&&r.next(t)))}),(t=>{l=!1,e=!1,r.error&&r.error(t),a.unsubscribe()}))};return p(),a}));return r.hasValue=()=>e,r.getValue=()=>n,r}let lr;try{lr={indexedDB:a.indexedDB||a.mozIndexedDB||a.webkitIndexedDB||a.msIndexedDB,IDBKeyRange:a.IDBKeyRange||a.webkitIDBKeyRange}}catch{lr={indexedDB:null,IDBKeyRange:null}}const hr=sr;function fr(t){let n=dr;try{dr=!0,pe.storagemutated.fire(t)}finally{dr=n}}y(hr,{...ut,delete:t=>new hr(t,{addons:[]}).delete(),exists:t=>new hr(t,{addons:[]}).open().then((t=>(t.close(),!0))).catch("NoSuchDatabaseError",(()=>!1)),getDatabaseNames(t){try{return function({indexedDB:t,IDBKeyRange:n}){return qe(t)?Promise.resolve(t.databases()).then((t=>t.map((t=>t.name)).filter((t=>t!==Tn)))):Be(t,n).toCollection().primaryKeys()}(hr.dependencies).then(t)}catch{return kn(new st.MissingAPI)}},defineClass:()=>function(t){h(this,t)},ignoreTransaction:t=>Rt.trans?vn(Rt.transless,t):t(),vip:Me,async:function(t){return function(){try{var n=_e(t.apply(this,arguments));return n&&typeof n.then=="function"?n:Ft.resolve(n)}catch(t){return kn(t)}}},spawn:function(t,n,e){try{var r=_e(t.apply(e,n||[]));return r&&typeof r.then=="function"?r:Ft.resolve(r)}catch(t){return kn(t)}},currentTransaction:{get:()=>Rt.trans||null},waitFor:function(t,n){const e=Ft.resolve(typeof t=="function"?hr.ignoreTransaction(t):t).timeout(n||6e4);return Rt.trans?Rt.trans.waitFor(e):e},Promise:Ft,debug:{get:()=>V,set:t=>{W(t,t==="dexie"?()=>!0:Kn)}},derive:g,extend:h,props:y,override:S,Events:_n,on:pe,liveQuery:cr,extendObservabilitySet:ar,getByKeyPath:A,setByKeyPath:E,delByKeyPath:function(t,n){typeof n=="string"?E(t,n,void 0):"length"in n&&[].map.call(n,(function(n){E(t,n,void 0)}))},shallowClone:D,deepClone:R,getObjectDiff:He,cmp:Yn,asap:x,minKey:Cn,addons:[],connections:Dn,errnames:rt,dependencies:lr,semVer:Pn,version:Pn.split(".").map((t=>parseInt(t))).reduce(((t,n,e)=>t+n/Math.pow(10,2*e)))}),hr.maxKey=we(hr.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(pe(fe,(t=>{if(!dr){let n;On?(n=document.createEvent("CustomEvent"),n.initCustomEvent(de,!0,!0,t)):n=new CustomEvent(de,{detail:t}),dr=!0,dispatchEvent(n),dr=!1}})),addEventListener(de,(({detail:t})=>{dr||fr(t)})));let dr=!1;if(typeof BroadcastChannel<"u"){const t=new BroadcastChannel(de);typeof t.unref=="function"&&t.unref(),pe(fe,(n=>{dr||t.postMessage(n)})),t.onmessage=t=>{t.data&&fr(t.data)}}else if(typeof self<"u"&&typeof navigator<"u"){pe(fe,(t=>{try{dr||(typeof localStorage<"u"&&localStorage.setItem(de,JSON.stringify({trig:Math.random(),changedParts:t})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach((n=>n.postMessage({type:de,changedParts:t}))))}catch{}})),typeof addEventListener<"u"&&addEventListener("storage",(t=>{if(t.key===de){const n=JSON.parse(t.newValue);n&&fr(n.changedParts)}}));const t=self.document&&navigator.serviceWorker;t&&t.addEventListener("message",(function({data:t}){t&&t.type===de&&fr(t.changedParts)}))}Ft.rejectionMapper=function(t,n){if(!t||t instanceof Z||t instanceof TypeError||t instanceof SyntaxError||!t.name||!ot[t.name])return t;var e=new ot[t.name](n||t.message,t);return"stack"in t&&m(e,"stack",{get:function(){return this.inner.stack}}),e},W(V,Kn);export{s as N,u as X,o as n};
2
- //# sourceMappingURL=p-3cc1072e.js.map
1
+ import{b as t,e as n,f as e,h as r}from"./p-f73e34dd.js";class i{constructor(n,e,r=true,i){this.automaticComponentRegistration=true;this.registeredComponents={};this.propStateRegistrations=new Map;this.eventListenerRegistrations=new Map;this.host=n;this.stores=e;this.automaticComponentRegistration=r;this.eventOverrides=i;t(`[${this.hostTagName}] Initializing (abstract) provider.`,{eventOverrides:i});this.registerComponent=this.registerComponent.bind(this);this.getStore=this.getStore.bind(this);Object.keys(this.stores).forEach((t=>{this.propStateRegistrations.set(t,new Map)}))}async componentWillLoad(n){t(`[${this.hostTagName}] Will load`);this.setupStoreListeners();this.nylasConnector=n;const e=Array.from(this.host.querySelectorAll("*")).filter((t=>t.tagName.toLowerCase().startsWith("nylas-")));t(`[${this.hostTagName}] Found ${e.length} child component(s).`,{childComponents:e});const r=e.map((async n=>{const e=n;if(!e){t(`[~${this.hostTagName}] (componentWillLoad) Component ${e.tagName} does not have a name. Skipping.`);return}if(!e.registerNylasComponent){t(`[~${this.hostTagName}] (componentWillLoad) Component ${e.tagName} is not a component that can be registered. Skipping.`,{component:e});return}const r={element:e,name:e.tagName.toLowerCase(),getStoresToProp:e.getStoresToProp,storeToProps:e.storeToProps,stateToProps:e.stateToProps,authToProp:e.authToProp,eventToProps:e.eventToProps,connectorToProp:e.connectorToProp,localPropsToProp:e.localPropsToProp};await this.registerComponent(r)}));await Promise.all(r)}async componentDidLoad(){t(`[~${this.hostTagName}] (componentDidLoad) Did load`)}async componentDisconnected(){Object.values(this.stores).forEach((t=>{t.dispose()}))}async registerComponentHandler(n){n.stopPropagation();if(!this.automaticComponentRegistration){t(`~[${this.hostTagName}] (registerComponentHandler) Automatic component registration disabled. Skipping registration of ${n.detail.name}.`);return}await this.registerComponent(n.detail)}async unregisterComponentHandler(n){n.stopPropagation();if(!this.automaticComponentRegistration){t(`~[${this.hostTagName}] (unregisterComponentHandler) Automatic component registration disabled. Skipping unregistration of ${n.detail.name}.`);return}this.unregisterComponent(n.detail)}async registerComponent(r){t(`~[${this.hostTagName}] (registerComponent) Registering component ${r.name}.`);const i=r.element.dataset.nylasId;const s=i&&this.registeredComponents[i];if(s){t(`[${this.hostTagName}] (registerComponent) Component ${r.name} already registered. Updating registration.`);this.cleanupComponentRegistration(i,false)}else{r.element.dataset.nylasId=i||n()}const o=r.element.dataset.nylasId;if(o){this.registeredComponents[o]=r}t(`[${this.hostTagName}] (registerComponent) Waiting for "${r.element.localName}" component to be defined`,{component:r});try{await customElements.whenDefined(r.element.tagName.toLowerCase());t(`[${this.hostTagName}] (registerComponent) Component "${r.element.localName}" is now defined`)}catch(n){t(`[${this.hostTagName}] (registerComponent) Error waiting for component "${r.element.localName}" to be defined:`,n)}const u=this.eventOverrides;const{stateToProps:a,getStoresToProp:c,eventToProps:l,storeToProps:h,connectorToProp:f,localPropsToProp:d,element:p}=r;l?.forEach(((n,i)=>{const s=this.nylasConnector;const o=async e=>{t(`[${this.hostTagName}] (registerComponent) Handling "${r.name}" prop "${String(i)}" event.`,{event:e});if(i in u){t(`[${this.hostTagName}] (registerComponent) Found event override for "${String(i)}" event. Calling override.`);await u[i](e,s)}if(!e.defaultPrevented){await n(e,s)}return};const a=r.element.dataset.nylasId;if(a&&!this.eventListenerRegistrations.has(a)){this.eventListenerRegistrations.set(a,[])}if(a){this.eventListenerRegistrations.get(a)?.push([p,i,o])}t(`[${this.hostTagName}] (registerComponent) Setting "${r.name}" event "${String(i)}" to automcially call NylasConnector method.`);const c=e(i.toString());t(`[${this.hostTagName}] (registerComponent) Adding event listener for "${c}" on "${p.tagName}"`);p.addEventListener(c,o)}));a?.forEach(((n,e)=>{const[i,s]=e.split(".");const o=this.getStore(i);const u=o.state[s];if(!p.dataset.nylasId){t(`[${this.hostTagName}] (registerComponent) Component "${r.name}" not registered. Skipping.`,{component:r});return}if(!this.propStateRegistrations.has(i)){this.propStateRegistrations.set(i,new Map)}if(!this.propStateRegistrations.get(i)?.has(s)){this.propStateRegistrations.get(i)?.set(s,[{elementId:p.dataset.nylasId,propKey:n}])}else{this.propStateRegistrations.get(i)?.get(s)?.push({elementId:p.dataset.nylasId,propKey:n})}p[n.toString()]=u;t(`[${this.hostTagName}] Setting "${r.name}" prop "${n.toString()}" to "${e}" value.`,{stateValue:u})}));d?.forEach(((n,e)=>{const i=this.host[e];p[n.toString()]=i;t(`[${this.hostTagName}] Setting "${r.name}" prop "${n.toString()}" to the value of "${e}" value.`,{value:e,mappedPropValue:i})}));if(c){p[c?.toString()]=this.getStore;t(`[${this.hostTagName}] Setting "${r.name}" prop "${c.toString()}" to "getStore" method.`)}h?.forEach(((n,e)=>{const i=this.getStore(e);p[n.toString()]=i;t(`[${this.hostTagName}] Setting "${r.name}" prop "${n.toString()}" to "${e}" store.`,{store:i})}));if(f){p[f?.toString()]=this.nylasConnector;t(`[${this.hostTagName}] Setting "${r.name}" prop "${f.toString()}" to "nylasConnector" value.`,{connectorToProp:f})}if(typeof p.registerCallback==="function"){t(`[${this.hostTagName}] (registerComponent) Calling registerCallback method for "${r.name}".`);await p.registerCallback()}t(`[${this.hostTagName}] (registerComponent) Component ${r.name} registered.`)}cleanupComponentRegistration(n,r=true){const i=this.eventListenerRegistrations.get(n);if(i){i.forEach((([n,r,i])=>{const s=e(r.toString());t(`[${this.hostTagName}] (cleanupComponentRegistration) Removing event listener for "${s}" on "${n.tagName}"`);n.removeEventListener(s,i)}));this.eventListenerRegistrations.delete(n)}this.propStateRegistrations.forEach(((t,e)=>{t.forEach(((t,r)=>{const i=t.filter((t=>t.elementId!==n));if(i.length!==t.length){this.propStateRegistrations.get(e)?.set(r,i)}}))}));if(r){delete this.registeredComponents[n]}}unregisterComponent(n){t(`[${this.hostTagName}] Unregistering component ${n.name}.`);const r=n.element.dataset.nylasId;if(!r){t(`[${this.hostTagName}] (unregisterComponent) Unregistering component ${n.name}.`);return}if(this.registeredComponents[r]){t(`[${this.hostTagName}] (unregisterComponent) Component ${n.name} not registered. Skipping.`);return}this.propStateRegistrations.forEach(((t,n)=>{t.forEach(((t,e)=>{const i=this.propStateRegistrations.get(n)?.get(e);const s=i?.filter((t=>t.elementId!==r));if(s){this.propStateRegistrations.get(n)?.set(e,s)}}))}));const i=this.eventListenerRegistrations.get(r);i?.forEach((([n,r,i])=>{const s=e(r.toString());t(`[${this.hostTagName}] (unregisterComponent) Removing event listener for "${s}" on "${n.tagName}"`);n.removeEventListener(s,i)}));delete this.registeredComponents[r]}getStore(t){const n=this.stores[t];if(!n){throw new Error(`[${this.hostTagName}] Store "${t.toString()}" not found.`)}return n}async setupStoreListeners(){const n=this;Object.entries(this.stores).forEach((([e,r])=>{t(`[${n.hostTagName}] (setupStoreListeners) Listening for changes in "${e}" store.`);r.use({set(r,i,s){t(`[${n.hostTagName}] (setupStoreListeners) Store "${e}" state "${r.toString()}" changed`,{newValue:i,oldValue:s});if(i===s){t(`[${n.hostTagName}] (setupStoreListeners) Store "${e}" state "${r.toString()}" unchanged. Skipping.`);return}const o=n.registeredComponents;if(!o){t(`[${n.hostTagName}] (setupStoreListeners) No registered components found. Skipping.`);return}const u=n.propStateRegistrations.get(e)?.get(r.toString())||[];t(`[${n.hostTagName}] (setupStoreListeners) Found ${u.length} prop(s) registered for "${r.toString()}" store.`,{props:u,propStateRegistrations:n.propStateRegistrations});u.forEach((({elementId:i,propKey:s})=>{const u=o[i];if(!u){t(`[${n.hostTagName}] (setupStoreListeners) Component "${i}" not found. Skipping.`,{component:u});return}const a=n.getStore(e);const c=a.state[r];u.element[s.toString()]=c;t(`[${n.hostTagName}] (setupStoreListeners) Setting "${u.name}" prop "${s.toString()}" to "${r.toString()}" value.`,{stateValue:c})}))}})}))}get hostTagName(){return this.host?.tagName?.toLowerCase()??"nylas-provider"}}class s extends i{}var o=(t=>(t.Error="error",t.Warning="warning",t.Info="info",t.Success="success",t))(o||{});const u=t=>t!==null&&typeof t=="object"&&"error"in t;const a=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:r,c=Object.keys,l=Array.isArray;function h(t,n){return typeof n!="object"||c(n).forEach((function(e){t[e]=n[e]})),t}typeof Promise>"u"||a.Promise||(a.Promise=Promise);const f=Object.getPrototypeOf,d={}.hasOwnProperty;function p(t,n){return d.call(t,n)}function y(t,n){typeof n=="function"&&(n=n(f(t))),(typeof Reflect>"u"?c:Reflect.ownKeys)(n).forEach((e=>{m(t,e,n[e])}))}const v=Object.defineProperty;function m(t,n,e,r){v(t,n,h(e&&p(e,"get")&&typeof e.get=="function"?{get:e.get,set:e.set,configurable:!0}:{value:e,configurable:!0,writable:!0},r))}function g(t){return{from:function(n){return t.prototype=Object.create(n.prototype),m(t.prototype,"constructor",t),{extend:y.bind(null,t.prototype)}}}}const w=Object.getOwnPropertyDescriptor;function b(t,n){let e;return w(t,n)||(e=f(t))&&b(e,n)}const $=[].slice;function k(t,n,e){return $.call(t,n,e)}function S(t,n){return n(t)}function P(t){if(!t)throw new Error("Assertion Failed")}function x(t){a.setImmediate?setImmediate(t):setTimeout(t,0)}function C(t,n){return t.reduce(((t,e,r)=>{var i=n(e,r);return i&&(t[i[0]]=i[1]),t}),{})}function A(t,n){if(p(t,n))return t[n];if(!n)return t;if(typeof n!="string"){for(var e=[],r=0,i=n.length;r<i;++r){var s=A(t,n[r]);e.push(s)}return e}var o=n.indexOf(".");if(o!==-1){var u=t[n.substr(0,o)];return u===void 0?void 0:A(u,n.substr(o+1))}}function E(t,n,e){if(t&&n!==void 0&&(!("isFrozen"in Object)||!Object.isFrozen(t)))if(typeof n!="string"&&"length"in n){P(typeof e!="string"&&"length"in e);for(var r=0,i=n.length;r<i;++r)E(t,n[r],e[r])}else{var s=n.indexOf(".");if(s!==-1){var o=n.substr(0,s),u=n.substr(s+1);if(u==="")e===void 0?l(t)&&!isNaN(parseInt(o))?t.splice(o,1):delete t[o]:t[o]=e;else{var a=t[o];a&&p(t,o)||(a=t[o]={}),E(a,u,e)}}else e===void 0?l(t)&&!isNaN(parseInt(n))?t.splice(n,1):delete t[n]:t[n]=e}}function D(t){var n={};for(var e in t)p(t,e)&&(n[e]=t[e]);return n}const O=[].concat;function j(t){return O.apply([],t)}const I="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(j([8,16,32,64].map((t=>["Int","Uint","Float"].map((n=>n+t+"Array")))))).filter((t=>a[t])),K=I.map((t=>a[t]));C(I,(t=>[t,!0]));let T=null;function R(t){T=typeof WeakMap<"u"&&new WeakMap;const n=B(t);return T=null,n}function B(t){if(!t||typeof t!="object")return t;let n=T&&T.get(t);if(n)return n;if(l(t)){n=[],T&&T.set(t,n);for(var e=0,r=t.length;e<r;++e)n.push(B(t[e]))}else if(K.indexOf(t.constructor)>=0)n=t;else{const e=f(t);for(var i in n=e===Object.prototype?{}:Object.create(e),T&&T.set(t,n),t)p(t,i)&&(n[i]=B(t[i]))}return n}const{toString:q}={};function M(t){return q.call(t).slice(8,-1)}const F=typeof Symbol<"u"?Symbol.iterator:"@@iterator",N=typeof F=="symbol"?function(t){var n;return t!=null&&(n=t[F])&&n.apply(t)}:function(){return null},_={};function L(t){var n,e,r,i;if(arguments.length===1){if(l(t))return t.slice();if(this===_&&typeof t=="string")return[t];if(i=N(t)){for(e=[];!(r=i.next()).done;)e.push(r.value);return e}if(t==null)return[t];if(typeof(n=t.length)=="number"){for(e=new Array(n);n--;)e[n]=t[n];return e}return[t]}for(n=arguments.length,e=new Array(n);n--;)e[n]=arguments[n];return e}const U=typeof Symbol<"u"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1;var V=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function W(t,n){V=t,H=n}var H=()=>!0;const G=!new Error("").stack;function z(){if(G)try{throw new Error}catch(t){return t}return new Error}function J(t,n){var e=t.stack;return e?(n=n||0,e.indexOf(t.name)===0&&(n+=(t.name+t.message).split(`\n`).length),e.split(`\n`).slice(n).filter(H).map((t=>`\n`+t)).join("")):""}var Y=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Q=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(Y),X={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 Z(t,n){this._e=z(),this.name=t,this.message=n}function tt(t,n){return t+". Errors: "+Object.keys(n).map((t=>n[t].toString())).filter(((t,n,e)=>e.indexOf(t)===n)).join(`\n`)}function nt(t,n,e,r){this._e=z(),this.failures=n,this.failedKeys=r,this.successCount=e,this.message=tt(t,n)}function et(t,n){this._e=z(),this.name="BulkError",this.failures=Object.keys(n).map((t=>n[t])),this.failuresByPos=n,this.message=tt(t,n)}g(Z).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+J(this._e,2))}},toString:function(){return this.name+": "+this.message}}),g(nt).from(Z),g(et).from(Z);var rt=Q.reduce(((t,n)=>(t[n]=n+"Error",t)),{});const it=Z;var st=Q.reduce(((t,n)=>{var e=n+"Error";function r(t,r){this._e=z(),this.name=e,t?typeof t=="string"?(this.message=`${t}${r?`\n `+r:""}`,this.inner=r||null):typeof t=="object"&&(this.message=`${t.name} ${t.message}`,this.inner=t):(this.message=X[n]||e,this.inner=null)}return g(r).from(it),t[n]=r,t}),{});st.Syntax=SyntaxError,st.Type=TypeError,st.Range=RangeError;var ot=Y.reduce(((t,n)=>(t[n+"Error"]=st[n],t)),{}),ut=Q.reduce(((t,n)=>(["Syntax","Type","Range"].indexOf(n)===-1&&(t[n+"Error"]=st[n]),t)),{});function at(){}function ct(t){return t}function lt(t,n){return t==null||t===ct?n:function(e){return n(t(e))}}function ht(t,n){return function(){t.apply(this,arguments),n.apply(this,arguments)}}function ft(t,n){return t===at?n:function(){var e=t.apply(this,arguments);e!==void 0&&(arguments[0]=e);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var s=n.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?ht(r,this.onsuccess):r),i&&(this.onerror=this.onerror?ht(i,this.onerror):i),s!==void 0?s:e}}function dt(t,n){return t===at?n:function(){t.apply(this,arguments);var e=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,n.apply(this,arguments),e&&(this.onsuccess=this.onsuccess?ht(e,this.onsuccess):e),r&&(this.onerror=this.onerror?ht(r,this.onerror):r)}}function pt(t,n){return t===at?n:function(e){var r=t.apply(this,arguments);h(e,r);var i=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var o=n.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?ht(i,this.onsuccess):i),s&&(this.onerror=this.onerror?ht(s,this.onerror):s),r===void 0?o===void 0?void 0:o:h(r,o)}}function yt(t,n){return t===at?n:function(){return n.apply(this,arguments)!==!1&&t.apply(this,arguments)}}function vt(t,n){return t===at?n:function(){var e=t.apply(this,arguments);if(e&&typeof e.then=="function"){for(var r=this,i=arguments.length,s=new Array(i);i--;)s[i]=arguments[i];return e.then((function(){return n.apply(r,s)}))}return n.apply(this,arguments)}}ut.ModifyError=nt,ut.DexieError=Z,ut.BulkError=et;var mt={};const gt=100,[wt,bt,$t]=typeof Promise>"u"?[]:(()=>{let t=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[t,f(t),t];const n=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[n,f(n),t]})(),kt=bt&&bt.then,St=wt&&wt.constructor,Pt=!!$t;var xt=!1,Ct=$t?()=>{$t.then(Jt)}:a.setImmediate?setImmediate.bind(null,Jt):a.MutationObserver?()=>{var t=document.createElement("div");new MutationObserver((()=>{Jt(),t=null})).observe(t,{attributes:!0}),t.setAttribute("i","1")}:()=>{setTimeout(Jt,0)},At=function(t,n){Bt.push([t,n]),Dt&&(Ct(),Dt=!1)},Et=!0,Dt=!0,Ot=[],jt=[],It=null,Kt=ct,Tt={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:$n,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((t=>{try{$n(t[0],t[1])}catch{}}))}},Rt=Tt,Bt=[],qt=0,Mt=[];function Ft(t){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=at,this._lib=!1;var n=this._PSD=Rt;if(V&&(this._stackHolder=z(),this._prev=null,this._numPrev=0),typeof t!="function"){if(t!==mt)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&Ut(this,this._value))}this._state=null,this._value=null,++n.ref,Lt(this,t)}const Nt={get:function(){var t=Rt,n=on;function e(e,r){var i=!t.global&&(t!==Rt||n!==on);const s=i&&!ln();var o=new Ft(((n,o)=>{Wt(this,new _t(gn(e,t,i,s),gn(r,t,i,s),n,o,t))}));return V&&zt(o,this),o}return e.prototype=mt,e},set:function(t){m(this,"then",t&&t.prototype===mt?Nt:{get:function(){return t},set:Nt.set})}};function _t(t,n,e,r,i){this.onFulfilled=typeof t=="function"?t:null,this.onRejected=typeof n=="function"?n:null,this.resolve=e,this.reject=r,this.psd=i}function Lt(t,n){try{n((n=>{if(t._state===null){if(n===t)throw new TypeError("A promise cannot be resolved with itself.");var e=t._lib&&Yt();n&&typeof n.then=="function"?Lt(t,((t,e)=>{n instanceof Ft?n._then(t,e):n.then(t,e)})):(t._state=!0,t._value=n,Vt(t)),e&&Qt()}}),Ut.bind(null,t))}catch(n){Ut(t,n)}}function Ut(t,n){if(jt.push(n),t._state===null){var e=t._lib&&Yt();n=Kt(n),t._state=!1,t._value=n,V&&n!==null&&typeof n=="object"&&!n._promise&&function(t,n,e){try{t.apply(null,e)}catch(t){n&&n(t)}}((()=>{var e=b(n,"stack");n._promise=t,m(n,"stack",{get:()=>xt?e&&(e.get?e.get.apply(n):e.value):t.stack})})),function(t){Ot.some((n=>n._value===t._value))||Ot.push(t)}(t),Vt(t),e&&Qt()}}function Vt(t){var n=t._listeners;t._listeners=[];for(var e=0,r=n.length;e<r;++e)Wt(t,n[e]);var i=t._PSD;--i.ref||i.finalize(),qt===0&&(++qt,At((()=>{--qt==0&&Xt()}),[]))}function Wt(t,n){if(t._state!==null){var e=t._state?n.onFulfilled:n.onRejected;if(e===null)return(t._state?n.resolve:n.reject)(t._value);++n.psd.ref,++qt,At(Ht,[e,t,n])}else t._listeners.push(n)}function Ht(t,n,e){try{It=n;var r,i=n._value;n._state?r=t(i):(jt.length&&(jt=[]),r=t(i),jt.indexOf(i)===-1&&function(t){for(var n=Ot.length;n;)if(Ot[--n]._value===t._value)return void Ot.splice(n,1)}(n)),e.resolve(r)}catch(t){e.reject(t)}finally{It=null,--qt==0&&Xt(),--e.psd.ref||e.psd.finalize()}}function Gt(t,n,e){if(n.length===e)return n;var r="";if(t._state===!1){var i,s,o=t._value;o!=null?(i=o.name||"Error",s=o.message||o,r=J(o,0)):(i=o,s=""),n.push(i+(s?": "+s:"")+r)}return V&&((r=J(t._stackHolder,2))&&n.indexOf(r)===-1&&n.push(r),t._prev&&Gt(t._prev,n,e)),n}function zt(t,n){var e=n?n._numPrev+1:0;e<100&&(t._prev=n,t._numPrev=e)}function Jt(){Yt()&&Qt()}function Yt(){var t=Et;return Et=!1,Dt=!1,t}function Qt(){var t,n,e;do{for(;Bt.length>0;)for(t=Bt,Bt=[],e=t.length,n=0;n<e;++n){var r=t[n];r[0].apply(null,r[1])}}while(Bt.length>0);Et=!0,Dt=!0}function Xt(){var t=Ot;Ot=[],t.forEach((t=>{t._PSD.onunhandled.call(null,t._value,t)}));for(var n=Mt.slice(0),e=n.length;e;)n[--e]()}function Zt(t){return new Ft(mt,!1,t)}function tn(t,n){var e=Rt;return function(){var r=Yt(),i=Rt;try{return pn(e,!0),t.apply(this,arguments)}catch(t){n&&n(t)}finally{pn(i,!1),r&&Qt()}}}y(Ft.prototype,{then:Nt,_then:function(t,n){Wt(this,new _t(null,null,t,n,Rt))},catch:function(t){if(arguments.length===1)return this.then(null,t);var n=arguments[0],e=arguments[1];return typeof n=="function"?this.then(null,(t=>t instanceof n?e(t):Zt(t))):this.then(null,(t=>t&&t.name===n?e(t):Zt(t)))},finally:function(t){return this.then((n=>(t(),n)),(n=>(t(),Zt(n))))},stack:{get:function(){if(this._stack)return this._stack;try{xt=!0;var t=Gt(this,[],20).join(`\nFrom previous: `);return this._state!==null&&(this._stack=t),t}finally{xt=!1}}},timeout:function(t,n){return t<1/0?new Ft(((e,r)=>{var i=setTimeout((()=>r(new st.Timeout(n))),t);this.then(e,r).finally(clearTimeout.bind(null,i))})):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&m(Ft.prototype,Symbol.toStringTag,"Dexie.Promise"),Tt.env=yn(),y(Ft,{all:function(){var t=L.apply(null,arguments).map(hn);return new Ft((function(n,e){t.length===0&&n([]);var r=t.length;t.forEach(((i,s)=>Ft.resolve(i).then((e=>{t[s]=e,--r||n(t)}),e)))}))},resolve:t=>{if(t instanceof Ft)return t;if(t&&typeof t.then=="function")return new Ft(((n,e)=>{t.then(n,e)}));var n=new Ft(mt,!0,t);return zt(n,It),n},reject:Zt,race:function(){var t=L.apply(null,arguments).map(hn);return new Ft(((n,e)=>{t.map((t=>Ft.resolve(t).then(n,e)))}))},PSD:{get:()=>Rt,set:t=>Rt=t},totalEchoes:{get:()=>on},newPSD:an,usePSD:vn,scheduler:{get:()=>At,set:t=>{At=t}},rejectionMapper:{get:()=>Kt,set:t=>{Kt=t}},follow:(t,n)=>new Ft(((e,r)=>an(((n,e)=>{var r=Rt;r.unhandleds=[],r.onunhandled=e,r.finalize=ht((function(){(function(t){function n(){t(),Mt.splice(Mt.indexOf(n),1)}Mt.push(n),++qt,At((()=>{--qt==0&&Xt()}),[])})((()=>{this.unhandleds.length===0?n():e(this.unhandleds[0])}))}),r.finalize),t()}),n,e,r)))}),St&&(St.allSettled&&m(Ft,"allSettled",(function(){const t=L.apply(null,arguments).map(hn);return new Ft((n=>{t.length===0&&n([]);let e=t.length;const r=new Array(e);t.forEach(((t,i)=>Ft.resolve(t).then((t=>r[i]={status:"fulfilled",value:t}),(t=>r[i]={status:"rejected",reason:t})).then((()=>--e||n(r)))))}))})),St.any&&typeof AggregateError<"u"&&m(Ft,"any",(function(){const t=L.apply(null,arguments).map(hn);return new Ft(((n,e)=>{t.length===0&&e(new AggregateError([]));let r=t.length;const i=new Array(r);t.forEach(((t,s)=>Ft.resolve(t).then((t=>n(t)),(t=>{i[s]=t,--r||e(new AggregateError(i))}))))}))})));const nn={awaits:0,echoes:0,id:0};var en=0,rn=[],sn=0,on=0,un=0;function an(t,n,e,r){var i=Rt,s=Object.create(i);s.parent=i,s.ref=0,s.global=!1,s.id=++un;var o=Tt.env;s.env=Pt?{Promise:Ft,PromiseProp:{value:Ft,configurable:!0,writable:!0},all:Ft.all,race:Ft.race,allSettled:Ft.allSettled,any:Ft.any,resolve:Ft.resolve,reject:Ft.reject,nthen:wn(o.nthen,s),gthen:wn(o.gthen,s)}:{},n&&h(s,n),++i.ref,s.finalize=function(){--this.parent.ref||this.parent.finalize()};var u=vn(s,t,e,r);return s.ref===0&&s.finalize(),u}function cn(){return nn.id||(nn.id=++en),++nn.awaits,nn.echoes+=gt,nn.id}function ln(){return!!nn.awaits&&(--nn.awaits==0&&(nn.id=0),nn.echoes=nn.awaits*gt,!0)}function hn(t){return nn.echoes&&t&&t.constructor===St?(cn(),t.then((t=>(ln(),t)),(t=>(ln(),kn(t))))):t}function fn(t){++on,nn.echoes&&--nn.echoes!=0||(nn.echoes=nn.id=0),rn.push(Rt),pn(t,!0)}function dn(){var t=rn[rn.length-1];rn.pop(),pn(t,!1)}function pn(t,n){var e=Rt;if((n?!nn.echoes||sn++&&t===Rt:!sn||--sn&&t===Rt)||mn(n?fn.bind(null,t):dn),t!==Rt&&(Rt=t,e===Tt&&(Tt.env=yn()),Pt)){var r=Tt.env.Promise,i=t.env;bt.then=i.nthen,r.prototype.then=i.gthen,(e.global||t.global)&&(Object.defineProperty(a,"Promise",i.PromiseProp),r.all=i.all,r.race=i.race,r.resolve=i.resolve,r.reject=i.reject,i.allSettled&&(r.allSettled=i.allSettled),i.any&&(r.any=i.any))}}function yn(){var t=a.Promise;return Pt?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(a,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:bt.then,gthen:t.prototype.then}:{}}function vn(t,n,e,r,i){var s=Rt;try{return pn(t,!0),n(e,r,i)}finally{pn(s,!1)}}function mn(t){kt.call(wt,t)}function gn(t,n,e,r){return typeof t!="function"?t:function(){var i=Rt;e&&cn(),pn(n,!0);try{return t.apply(this,arguments)}finally{pn(i,!1),r&&mn(ln)}}}function wn(t,n){return function(e,r){return t.call(this,gn(e,n),gn(r,n))}}(""+kt).indexOf("[native code]")===-1&&(cn=ln=at);const bn="unhandledrejection";function $n(t,n){var e;try{e=n.onuncatched(t)}catch{}if(e!==!1)try{var r,i={promise:n,reason:t};if(a.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(bn,!0,!0),h(r,i)):a.CustomEvent&&h(r=new CustomEvent(bn,{detail:i}),i),r&&a.dispatchEvent&&(dispatchEvent(r),!a.PromiseRejectionEvent&&a.onunhandledrejection))try{a.onunhandledrejection(r)}catch{}V&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${t.stack||t}`)}catch{}}var kn=Ft.reject;function Sn(t,n,e,r){if(t.idbdb&&(t._state.openComplete||Rt.letThrough||t._vip)){var i=t._createTransaction(n,e,t._dbSchema);try{i.create(),t._state.PR1398_maxLoop=3}catch(i){return i.name===rt.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then((()=>Sn(t,n,e,r)))):kn(i)}return i._promise(n,((t,n)=>an((()=>(Rt.trans=i,r(t,n,i)))))).then((t=>i._completion.then((()=>t))))}if(t._state.openComplete)return kn(new st.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return kn(new st.DatabaseClosed);t.open().catch(at)}return t._state.dbReadyPromise.then((()=>Sn(t,n,e,r)))}const Pn="3.2.4",xn=String.fromCharCode(65535),Cn=-1/0,An="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",En="String expected.",Dn=[],On=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),jn=On,In=On,Kn=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),Tn="__dbnames",Rn="readonly",Bn="readwrite";function qn(t,n){return t?n?function(){return t.apply(this,arguments)&&n.apply(this,arguments)}:t:n}const Mn={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Fn(t){return typeof t!="string"||/\./.test(t)?t=>t:n=>(n[t]===void 0&&t in n&&delete(n=R(n))[t],n)}class Nn{_trans(t,n,e){const r=this._tx||Rt.trans,i=this.name;function s(t,e,r){if(!r.schema[i])throw new st.NotFound("Table "+i+" not part of transaction");return n(r.idbtrans,r)}const o=Yt();try{return r&&r.db===this.db?r===Rt.trans?r._promise(t,s,e):an((()=>r._promise(t,s,e)),{trans:r,transless:Rt.transless||Rt}):Sn(this.db,t,[this.name],s)}finally{o&&Qt()}}get(t,n){return t&&t.constructor===Object?this.where(t).first(n):this._trans("readonly",(n=>this.core.get({trans:n,key:t}).then((t=>this.hook.reading.fire(t))))).then(n)}where(t){if(typeof t=="string")return new this.db.WhereClause(this,t);if(l(t))return new this.db.WhereClause(this,`[${t.join("+")}]`);const n=c(t);if(n.length===1)return this.where(n[0]).equals(t[n[0]]);const e=this.schema.indexes.concat(this.schema.primKey).filter((t=>t.compound&&n.every((n=>t.keyPath.indexOf(n)>=0))&&t.keyPath.every((t=>n.indexOf(t)>=0))))[0];if(e&&this.db._maxKey!==xn)return this.where(e.name).equals(e.keyPath.map((n=>t[n])));!e&&V&&console.warn(`The query ${JSON.stringify(t)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);const{idxByName:r}=this.schema,i=this.db._deps.indexedDB;function s(t,n){try{return i.cmp(t,n)===0}catch{return!1}}const[o,u]=n.reduce((([n,e],i)=>{const o=r[i],u=t[i];return[n||o,n||!o?qn(e,o&&o.multi?t=>{const n=A(t,i);return l(n)&&n.some((t=>s(u,t)))}:t=>s(u,A(t,i))):e]}),[null,null]);return o?this.where(o.name).equals(t[o.keyPath]).filter(u):e?this.filter(u):this.where(n).equals("")}filter(t){return this.toCollection().and(t)}count(t){return this.toCollection().count(t)}offset(t){return this.toCollection().offset(t)}limit(t){return this.toCollection().limit(t)}each(t){return this.toCollection().each(t)}toArray(t){return this.toCollection().toArray(t)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(t){return new this.db.Collection(new this.db.WhereClause(this,l(t)?`[${t.join("+")}]`:t))}reverse(){return this.toCollection().reverse()}mapToClass(t){this.schema.mappedClass=t;const n=n=>{if(!n)return n;const e=Object.create(t.prototype);for(var r in n)if(p(n,r))try{e[r]=n[r]}catch{}return e};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=n,this.hook("reading",n),t}defineClass(){return this.mapToClass((function(t){h(this,t)}))}add(t,n){const{auto:e,keyPath:r}=this.schema.primKey;let i=t;return r&&e&&(i=Fn(r)(t)),this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"add",keys:n!=null?[n]:null,values:[i]}))).then((t=>t.numFailures?Ft.reject(t.failures[0]):t.lastResult)).then((n=>{if(r)try{E(t,r,n)}catch{}return n}))}update(t,n){if(typeof t!="object"||l(t))return this.where(":id").equals(t).modify(n);{const e=A(t,this.schema.primKey.keyPath);if(e===void 0)return kn(new st.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?c(n).forEach((e=>{E(t,e,n[e])})):n(t,{value:t,primKey:e})}catch{}return this.where(":id").equals(e).modify(n)}}put(t,n){const{auto:e,keyPath:r}=this.schema.primKey;let i=t;return r&&e&&(i=Fn(r)(t)),this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"put",values:[i],keys:n!=null?[n]:null}))).then((t=>t.numFailures?Ft.reject(t.failures[0]):t.lastResult)).then((n=>{if(r)try{E(t,r,n)}catch{}return n}))}delete(t){return this._trans("readwrite",(n=>this.core.mutate({trans:n,type:"delete",keys:[t]}))).then((t=>t.numFailures?Ft.reject(t.failures[0]):void 0))}clear(){return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"deleteRange",range:Mn}))).then((t=>t.numFailures?Ft.reject(t.failures[0]):void 0))}bulkGet(t){return this._trans("readonly",(n=>this.core.getMany({keys:t,trans:n}).then((t=>t.map((t=>this.hook.reading.fire(t)))))))}bulkAdd(t,n,e){const r=Array.isArray(n)?n:void 0,i=(e=e||(r?void 0:n))?e.allKeys:void 0;return this._trans("readwrite",(n=>{const{auto:e,keyPath:s}=this.schema.primKey;if(s&&r)throw new st.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==t.length)throw new st.InvalidArgument("Arguments objects and keys must have the same length");const o=t.length;let u=s&&e?t.map(Fn(s)):t;return this.core.mutate({trans:n,type:"add",keys:r,values:u,wantResults:i}).then((({numFailures:t,results:n,lastResult:e,failures:r})=>{if(t===0)return i?n:e;throw new et(`${this.name}.bulkAdd(): ${t} of ${o} operations failed`,r)}))}))}bulkPut(t,n,e){const r=Array.isArray(n)?n:void 0,i=(e=e||(r?void 0:n))?e.allKeys:void 0;return this._trans("readwrite",(n=>{const{auto:e,keyPath:s}=this.schema.primKey;if(s&&r)throw new st.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==t.length)throw new st.InvalidArgument("Arguments objects and keys must have the same length");const o=t.length;let u=s&&e?t.map(Fn(s)):t;return this.core.mutate({trans:n,type:"put",keys:r,values:u,wantResults:i}).then((({numFailures:t,results:n,lastResult:e,failures:r})=>{if(t===0)return i?n:e;throw new et(`${this.name}.bulkPut(): ${t} of ${o} operations failed`,r)}))}))}bulkDelete(t){const n=t.length;return this._trans("readwrite",(n=>this.core.mutate({trans:n,type:"delete",keys:t}))).then((({numFailures:t,lastResult:e,failures:r})=>{if(t===0)return e;throw new et(`${this.name}.bulkDelete(): ${t} of ${n} operations failed`,r)}))}}function _n(t){var n={},e=function(e,r){if(r){for(var i=arguments.length,s=new Array(i-1);--i;)s[i-1]=arguments[i];return n[e].subscribe.apply(null,s),t}if(typeof e=="string")return n[e]};e.addEventType=s;for(var r=1,i=arguments.length;r<i;++r)s(arguments[r]);return e;function s(t,r,i){if(typeof t!="object"){var o;r||(r=yt),i||(i=at);var u={subscribers:[],fire:i,subscribe:function(t){u.subscribers.indexOf(t)===-1&&(u.subscribers.push(t),u.fire=r(u.fire,t))},unsubscribe:function(t){u.subscribers=u.subscribers.filter((function(n){return n!==t})),u.fire=u.subscribers.reduce(r,i)}};return n[t]=e[t]=u,u}c(o=t).forEach((function(t){var n=o[t];if(l(n))s(t,o[t][0],o[t][1]);else{if(n!=="asap")throw new st.InvalidArgument("Invalid event config");var e=s(t,ct,(function(){for(var t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];e.subscribers.forEach((function(t){x((function(){t.apply(null,n)}))}))}))}}))}}function Ln(t,n){return g(n).from({prototype:t}),n}function Un(t,n){return!(t.filter||t.algorithm||t.or)&&(n?t.justLimit:!t.replayFilter)}function Vn(t,n){t.filter=qn(t.filter,n)}function Wn(t,n,e){var r=t.replayFilter;t.replayFilter=r?()=>qn(r(),n()):n,t.justLimit=e&&!r}function Hn(t,n){if(t.isPrimKey)return n.primaryKey;const e=n.getIndexByKeyPath(t.index);if(!e)throw new st.Schema("KeyPath "+t.index+" on object store "+n.name+" is not indexed");return e}function Gn(t,n,e){const r=Hn(t,n.schema);return n.openCursor({trans:e,values:!t.keysOnly,reverse:t.dir==="prev",unique:!!t.unique,query:{index:r,range:t.range}})}function zn(t,n,e,r){const i=t.replayFilter?qn(t.filter,t.replayFilter()):t.filter;if(t.or){const s={},o=(t,e,r)=>{if(!i||i(e,r,(t=>e.stop(t)),(t=>e.fail(t)))){var o=e.primaryKey,u=""+o;u==="[object ArrayBuffer]"&&(u=""+new Uint8Array(o)),p(s,u)||(s[u]=!0,n(t,e,r))}};return Promise.all([t.or._iterate(o,e),Jn(Gn(t,r,e),t.algorithm,o,!t.keysOnly&&t.valueMapper)])}return Jn(Gn(t,r,e),qn(t.algorithm,i),n,!t.keysOnly&&t.valueMapper)}function Jn(t,n,e,r){var i=tn(r?(t,n,i)=>e(r(t),n,i):e);return t.then((t=>{if(t)return t.start((()=>{var e=()=>t.continue();n&&!n(t,(t=>e=t),(n=>{t.stop(n),e=at}),(n=>{t.fail(n),e=at}))||i(t.value,t,(t=>e=t)),e()}))}))}function Yn(t,n){try{const e=Qn(t),r=Qn(n);if(e!==r)return e==="Array"?1:r==="Array"?-1:e==="binary"?1:r==="binary"?-1:e==="string"?1:r==="string"?-1:e==="Date"?1:r!=="Date"?NaN:-1;switch(e){case"number":case"Date":case"string":return t>n?1:t<n?-1:0;case"binary":return function(t,n){const e=t.length,r=n.length,i=e<r?e:r;for(let e=0;e<i;++e)if(t[e]!==n[e])return t[e]<n[e]?-1:1;return e===r?0:e<r?-1:1}(Xn(t),Xn(n));case"Array":return function(t,n){const e=t.length,r=n.length,i=e<r?e:r;for(let e=0;e<i;++e){const r=Yn(t[e],n[e]);if(r!==0)return r}return e===r?0:e<r?-1:1}(t,n)}}catch{}return NaN}function Qn(t){const n=typeof t;if(n!=="object")return n;if(ArrayBuffer.isView(t))return"binary";const e=M(t);return e==="ArrayBuffer"?"binary":e}function Xn(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)}class Zn{_read(t,n){var e=this._ctx;return e.error?e.table._trans(null,kn.bind(null,e.error)):e.table._trans("readonly",t).then(n)}_write(t){var n=this._ctx;return n.error?n.table._trans(null,kn.bind(null,n.error)):n.table._trans("readwrite",t,"locked")}_addAlgorithm(t){var n=this._ctx;n.algorithm=qn(n.algorithm,t)}_iterate(t,n){return zn(this._ctx,t,n,this._ctx.table.core)}clone(t){var n=Object.create(this.constructor.prototype),e=Object.create(this._ctx);return t&&h(e,t),n._ctx=e,n}raw(){return this._ctx.valueMapper=null,this}each(t){var n=this._ctx;return this._read((e=>zn(n,t,e,n.table.core)))}count(t){return this._read((t=>{const n=this._ctx,e=n.table.core;if(Un(n,!0))return e.count({trans:t,query:{index:Hn(n,e.schema),range:n.range}}).then((t=>Math.min(t,n.limit)));var r=0;return zn(n,(()=>(++r,!1)),t,e).then((()=>r))})).then(t)}sortBy(t,n){const e=t.split(".").reverse(),r=e[0],i=e.length-1;function s(t,n){return n?s(t[e[n]],n-1):t[r]}var o=this._ctx.dir==="next"?1:-1;function u(t,n){var e=s(t,i),r=s(n,i);return e<r?-o:e>r?o:0}return this.toArray((function(t){return t.sort(u)})).then(n)}toArray(t){return this._read((t=>{var n=this._ctx;if(n.dir==="next"&&Un(n,!0)&&n.limit>0){const{valueMapper:e}=n,r=Hn(n,n.table.core.schema);return n.table.core.query({trans:t,limit:n.limit,values:!0,query:{index:r,range:n.range}}).then((({result:t})=>e?t.map(e):t))}{const e=[];return zn(n,(t=>e.push(t)),t,n.table.core).then((()=>e))}}),t)}offset(t){var n=this._ctx;return t<=0||(n.offset+=t,Un(n)?Wn(n,(()=>{var n=t;return(t,e)=>n===0||(n===1?(--n,!1):(e((()=>{t.advance(n),n=0})),!1))})):Wn(n,(()=>{var n=t;return()=>--n<0}))),this}limit(t){return this._ctx.limit=Math.min(this._ctx.limit,t),Wn(this._ctx,(()=>{var n=t;return function(t,e,r){return--n<=0&&e(r),n>=0}}),!0),this}until(t,n){return Vn(this._ctx,(function(e,r,i){return!t(e.value)||(r(i),n)})),this}first(t){return this.limit(1).toArray((function(t){return t[0]})).then(t)}last(t){return this.reverse().first(t)}filter(t){var n,e;return Vn(this._ctx,(function(n){return t(n.value)})),n=this._ctx,e=t,n.isMatch=qn(n.isMatch,e),this}and(t){return this.filter(t)}or(t){return new this.db.WhereClause(this._ctx.table,t,this)}reverse(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(t){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each((function(n,e){t(e.key,e)}))}eachUniqueKey(t){return this._ctx.unique="unique",this.eachKey(t)}eachPrimaryKey(t){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each((function(n,e){t(e.primaryKey,e)}))}keys(t){var n=this._ctx;n.keysOnly=!n.isMatch;var e=[];return this.each((function(t,n){e.push(n.key)})).then((function(){return e})).then(t)}primaryKeys(t){var n=this._ctx;if(n.dir==="next"&&Un(n,!0)&&n.limit>0)return this._read((t=>{var e=Hn(n,n.table.core.schema);return n.table.core.query({trans:t,values:!1,limit:n.limit,query:{index:e,range:n.range}})})).then((({result:t})=>t)).then(t);n.keysOnly=!n.isMatch;var e=[];return this.each((function(t,n){e.push(n.primaryKey)})).then((function(){return e})).then(t)}uniqueKeys(t){return this._ctx.unique="unique",this.keys(t)}firstKey(t){return this.limit(1).keys((function(t){return t[0]})).then(t)}lastKey(t){return this.reverse().firstKey(t)}distinct(){var t=this._ctx,n=t.index&&t.table.schema.idxByName[t.index];if(!n||!n.multi)return this;var e={};return Vn(this._ctx,(function(t){var n=t.primaryKey.toString(),r=p(e,n);return e[n]=!0,!r})),this}modify(t){var n=this._ctx;return this._write((e=>{var r;if(typeof t=="function")r=t;else{var i=c(t),s=i.length;r=function(n){for(var e=!1,r=0;r<s;++r){var o=i[r],u=t[o];A(n,o)!==u&&(E(n,o,u),e=!0)}return e}}const o=n.table.core,{outbound:u,extractKey:a}=o.schema.primaryKey,l=this.db._options.modifyChunkSize||200,h=[];let f=0;const d=[],p=(t,n)=>{const{failures:e,numFailures:r}=n;f+=t-r;for(let t of c(e))h.push(e[t])};return this.clone().primaryKeys().then((i=>{const s=c=>{const h=Math.min(l,i.length-c);return o.getMany({trans:e,keys:i.slice(c,c+h),cache:"immutable"}).then((f=>{const d=[],y=[],v=u?[]:null,m=[];for(let t=0;t<h;++t){const n=f[t],e={value:R(n),primKey:i[c+t]};r.call(e,e.value,e)!==!1&&(e.value==null?m.push(i[c+t]):u||Yn(a(n),a(e.value))===0?(y.push(e.value),u&&v.push(i[c+t])):(m.push(i[c+t]),d.push(e.value)))}const g=Un(n)&&n.limit===1/0&&(typeof t!="function"||t===te)&&{index:n.index,range:n.range};return Promise.resolve(d.length>0&&o.mutate({trans:e,type:"add",values:d}).then((t=>{for(let n in t.failures)m.splice(parseInt(n),1);p(d.length,t)}))).then((()=>(y.length>0||g&&typeof t=="object")&&o.mutate({trans:e,type:"put",keys:v,values:y,criteria:g,changeSpec:typeof t!="function"&&t}).then((t=>p(y.length,t))))).then((()=>(m.length>0||g&&t===te)&&o.mutate({trans:e,type:"delete",keys:m,criteria:g}).then((t=>p(m.length,t))))).then((()=>i.length>c+h&&s(c+l)))}))};return s(0).then((()=>{if(h.length>0)throw new nt("Error modifying one or more objects",h,f,d);return i.length}))}))}))}delete(){var t=this._ctx,n=t.range;return Un(t)&&(t.isPrimKey&&!In||n.type===3)?this._write((e=>{const{primaryKey:r}=t.table.core.schema,i=n;return t.table.core.count({trans:e,query:{index:r,range:i}}).then((n=>t.table.core.mutate({trans:e,type:"deleteRange",range:i}).then((({failures:t,lastResult:e,results:r,numFailures:i})=>{if(i)throw new nt("Could not delete some values",Object.keys(t).map((n=>t[n])),n-i);return n-i}))))})):this.modify(te)}}const te=(t,n)=>n.value=null;function ne(t,n){return t<n?-1:t===n?0:1}function ee(t,n){return t>n?-1:t===n?0:1}function re(t,n,e){var r=t instanceof ce?new t.Collection(t):t;return r._ctx.error=e?new e(n):new TypeError(n),r}function ie(t){return new t.Collection(t,(()=>ae(""))).limit(0)}function se(t,n,e,r,i,s){for(var o=Math.min(t.length,r.length),u=-1,a=0;a<o;++a){var c=n[a];if(c!==r[a])return i(t[a],e[a])<0?t.substr(0,a)+e[a]+e.substr(a+1):i(t[a],r[a])<0?t.substr(0,a)+r[a]+e.substr(a+1):u>=0?t.substr(0,u)+n[u]+e.substr(u+1):null;i(t[a],c)<0&&(u=a)}return o<r.length&&s==="next"?t+e.substr(t.length):o<t.length&&s==="prev"?t.substr(0,e.length):u<0?null:t.substr(0,u)+r[u]+e.substr(u+1)}function oe(t,n,e,r){var i,s,o,u,a,c,l,h=e.length;if(!e.every((t=>typeof t=="string")))return re(t,En);function f(t){i=function(t){return t==="next"?t=>t.toUpperCase():t=>t.toLowerCase()}(t),s=function(t){return t==="next"?t=>t.toLowerCase():t=>t.toUpperCase()}(t),o=t==="next"?ne:ee;var n=e.map((function(t){return{lower:s(t),upper:i(t)}})).sort((function(t,n){return o(t.lower,n.lower)}));u=n.map((function(t){return t.upper})),a=n.map((function(t){return t.lower})),c=t,l=t==="next"?"":r}f("next");var d=new t.Collection(t,(()=>ue(u[0],a[h-1]+r)));d._ondirectionchange=function(t){f(t)};var p=0;return d._addAlgorithm((function(t,e,r){var i=t.key;if(typeof i!="string")return!1;var f=s(i);if(n(f,a,p))return!0;for(var d=null,y=p;y<h;++y){var v=se(i,f,u[y],a[y],o,c);v===null&&d===null?p=y+1:(d===null||o(d,v)>0)&&(d=v)}return e(d!==null?function(){t.continue(d+l)}:r),!1})),d}function ue(t,n,e,r){return{type:2,lower:t,upper:n,lowerOpen:e,upperOpen:r}}function ae(t){return{type:1,lower:t,upper:t}}class ce{get Collection(){return this._ctx.table.db.Collection}between(t,n,e,r){e=e!==!1,r=r===!0;try{return this._cmp(t,n)>0||this._cmp(t,n)===0&&(e||r)&&(!e||!r)?ie(this):new this.Collection(this,(()=>ue(t,n,!e,!r)))}catch{return re(this,An)}}equals(t){return t==null?re(this,An):new this.Collection(this,(()=>ae(t)))}above(t){return t==null?re(this,An):new this.Collection(this,(()=>ue(t,void 0,!0)))}aboveOrEqual(t){return t==null?re(this,An):new this.Collection(this,(()=>ue(t,void 0,!1)))}below(t){return t==null?re(this,An):new this.Collection(this,(()=>ue(void 0,t,!1,!0)))}belowOrEqual(t){return t==null?re(this,An):new this.Collection(this,(()=>ue(void 0,t)))}startsWith(t){return typeof t!="string"?re(this,En):this.between(t,t+xn,!0,!0)}startsWithIgnoreCase(t){return t===""?this.startsWith(t):oe(this,((t,n)=>t.indexOf(n[0])===0),[t],xn)}equalsIgnoreCase(t){return oe(this,((t,n)=>t===n[0]),[t],"")}anyOfIgnoreCase(){var t=L.apply(_,arguments);return t.length===0?ie(this):oe(this,((t,n)=>n.indexOf(t)!==-1),t,"")}startsWithAnyOfIgnoreCase(){var t=L.apply(_,arguments);return t.length===0?ie(this):oe(this,((t,n)=>n.some((n=>t.indexOf(n)===0))),t,xn)}anyOf(){const t=L.apply(_,arguments);let n=this._cmp;try{t.sort(n)}catch{return re(this,An)}if(t.length===0)return ie(this);const e=new this.Collection(this,(()=>ue(t[0],t[t.length-1])));e._ondirectionchange=e=>{n=e==="next"?this._ascending:this._descending,t.sort(n)};let r=0;return e._addAlgorithm(((e,i,s)=>{const o=e.key;for(;n(o,t[r])>0;)if(++r,r===t.length)return i(s),!1;return n(o,t[r])===0||(i((()=>{e.continue(t[r])})),!1)})),e}notEqual(t){return this.inAnyRange([[Cn,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const t=L.apply(_,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return re(this,An)}const n=t.reduce(((t,n)=>t?t.concat([[t[t.length-1][1],n]]):[[Cn,n]]),null);return n.push([t[t.length-1],this.db._maxKey]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})}inAnyRange(t,n){const e=this._cmp,r=this._ascending,i=this._descending,s=this._min,o=this._max;if(t.length===0)return ie(this);if(!t.every((t=>t[0]!==void 0&&t[1]!==void 0&&r(t[0],t[1])<=0)))return re(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",st.InvalidArgument);const u=!n||n.includeLowers!==!1,a=n&&n.includeUppers===!0;let c,l=r;function h(t,n){return l(t[0],n[0])}try{c=t.reduce((function(t,n){let r=0,i=t.length;for(;r<i;++r){const i=t[r];if(e(n[0],i[1])<0&&e(n[1],i[0])>0){i[0]=s(i[0],n[0]),i[1]=o(i[1],n[1]);break}}return r===i&&t.push(n),t}),[]),c.sort(h)}catch{return re(this,An)}let f=0;const d=a?t=>r(t,c[f][1])>0:t=>r(t,c[f][1])>=0,p=u?t=>i(t,c[f][0])>0:t=>i(t,c[f][0])>=0;let y=d;const v=new this.Collection(this,(()=>ue(c[0][0],c[c.length-1][1],!u,!a)));return v._ondirectionchange=t=>{t==="next"?(y=d,l=r):(y=p,l=i),c.sort(h)},v._addAlgorithm(((t,n,e)=>{for(var i=t.key;y(i);)if(++f,f===c.length)return n(e),!1;return!!function(t){return!d(t)&&!p(t)}(i)||(this._cmp(i,c[f][1])===0||this._cmp(i,c[f][0])===0||n((()=>{l===r?t.continue(c[f][0]):t.continue(c[f][1])})),!1)})),v}startsWithAnyOf(){const t=L.apply(_,arguments);return t.every((t=>typeof t=="string"))?t.length===0?ie(this):this.inAnyRange(t.map((t=>[t,t+xn]))):re(this,"startsWithAnyOf() only works with strings")}}function le(t){return tn((function(n){return he(n),t(n.target.error),!1}))}function he(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}const fe="storagemutated",de="x-storagemutated-1",pe=_n(null,fe);class ye{_lock(){return P(!Rt.global),++this._reculock,this._reculock!==1||Rt.global||(Rt.lockOwnerFor=this),this}_unlock(){if(P(!Rt.global),--this._reculock==0)for(Rt.global||(Rt.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{vn(t[1],t[0])}catch{}}return this}_locked(){return this._reculock&&Rt.lockOwnerFor!==this}create(t){if(!this.mode)return this;const n=this.db.idbdb,e=this.db._state.dbOpenError;if(P(!this.idbtrans),!t&&!n)switch(e&&e.name){case"DatabaseClosedError":throw new st.DatabaseClosed(e);case"MissingAPIError":throw new st.MissingAPI(e.message,e);default:throw new st.OpenFailed(e)}if(!this.active)throw new st.TransactionInactive;return P(this._completion._state===null),(t=this.idbtrans=t||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):n.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=tn((n=>{he(n),this._reject(t.error)})),t.onabort=tn((n=>{he(n),this.active&&this._reject(new st.Abort(t.error)),this.active=!1,this.on("abort").fire(n)})),t.oncomplete=tn((()=>{this.active=!1,this._resolve(),"mutatedParts"in t&&pe.storagemutated.fire(t.mutatedParts)})),this}_promise(t,n,e){if(t==="readwrite"&&this.mode!=="readwrite")return kn(new st.ReadOnly("Transaction is readonly"));if(!this.active)return kn(new st.TransactionInactive);if(this._locked())return new Ft(((r,i)=>{this._blockedFuncs.push([()=>{this._promise(t,n,e).then(r,i)},Rt])}));if(e)return an((()=>{var t=new Ft(((t,e)=>{this._lock();const r=n(t,e,this);r&&r.then&&r.then(t,e)}));return t.finally((()=>this._unlock())),t._lib=!0,t}));var r=new Ft(((t,e)=>{var r=n(t,e,this);r&&r.then&&r.then(t,e)}));return r._lib=!0,r}_root(){return this.parent?this.parent._root():this}waitFor(t){var n=this._root();const e=Ft.resolve(t);if(n._waitingFor)n._waitingFor=n._waitingFor.then((()=>e));else{n._waitingFor=e,n._waitingQueue=[];var r=n.idbtrans.objectStore(n.storeNames[0]);(function t(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(r.get(-1/0).onsuccess=t)})()}var i=n._waitingFor;return new Ft(((t,r)=>{e.then((e=>n._waitingQueue.push(tn(t.bind(null,e)))),(t=>n._waitingQueue.push(tn(r.bind(null,t))))).finally((()=>{n._waitingFor===i&&(n._waitingFor=null)}))}))}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new st.Abort))}table(t){const n=this._memoizedTables||(this._memoizedTables={});if(p(n,t))return n[t];const e=this.schema[t];if(!e)throw new st.NotFound("Table "+t+" not part of transaction");const r=new this.db.Table(t,e,this);return r.core=this.db.core.table(t),n[t]=r,r}}function ve(t,n,e,r,i,s,o){return{name:t,keyPath:n,unique:e,multi:r,auto:i,compound:s,src:(e&&!o?"&":"")+(r?"*":"")+(i?"++":"")+me(n)}}function me(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function ge(t,n,e){return{name:t,primKey:n,indexes:e,mappedClass:null,idxByName:C(e,(t=>[t.name,t]))}}let we=t=>{try{return t.only([[]]),we=()=>[[]],[[]]}catch{return we=()=>xn,xn}};function be(t){return t==null?()=>{}:typeof t=="string"?function(t){return t.split(".").length===1?n=>n[t]:n=>A(n,t)}(t):n=>A(n,t)}function $e(t){return[].slice.call(t)}let ke=0;function Se(t){return t==null?":id":typeof t=="string"?t:`[${t.join("+")}]`}function Pe(t,n,e){function r(t){if(t.type===3)return null;if(t.type===4)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:e,upper:r,lowerOpen:i,upperOpen:s}=t;return e===void 0?r===void 0?null:n.upperBound(r,!!s):r===void 0?n.lowerBound(e,!!i):n.bound(e,r,!!i,!!s)}const{schema:i,hasGetAll:s}=function(t,n){const e=$e(t.objectStoreNames);return{schema:{name:t.name,tables:e.map((t=>n.objectStore(t))).map((t=>{const{keyPath:n,autoIncrement:e}=t,r=l(n),i=n==null,s={},o={name:t.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:i,compound:r,keyPath:n,autoIncrement:e,unique:!0,extractKey:be(n)},indexes:$e(t.indexNames).map((n=>t.index(n))).map((t=>{const{name:n,unique:e,multiEntry:r,keyPath:i}=t,o={name:n,compound:l(i),keyPath:i,unique:e,multiEntry:r,extractKey:be(i)};return s[Se(i)]=o,o})),getIndexByKeyPath:t=>s[Se(t)]};return s[":id"]=o.primaryKey,n!=null&&(s[Se(n)]=o.primaryKey),o}))},hasGetAll:e.length>0&&"getAll"in n.objectStore(e[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(t,e),o=i.tables.map((t=>function(t){const n=t.name;return{name:n,schema:t,mutate:function({trans:t,type:e,keys:i,values:s,range:o}){return new Promise(((u,a)=>{u=tn(u);const c=t.objectStore(n),l=c.keyPath==null,h=e==="put"||e==="add";if(!h&&e!=="delete"&&e!=="deleteRange")throw new Error("Invalid operation type: "+e);const{length:f}=i||s||{length:1};if(i&&s&&i.length!==s.length)throw new Error("Given keys array must have same length as given values array.");if(f===0)return u({numFailures:0,failures:{},results:[],lastResult:void 0});let d;const p=[],y=[];let v=0;const m=t=>{++v,he(t)};if(e==="deleteRange"){if(o.type===4)return u({numFailures:v,failures:y,results:[],lastResult:void 0});o.type===3?p.push(d=c.clear()):p.push(d=c.delete(r(o)))}else{const[t,n]=h?l?[s,i]:[s,null]:[i,null];if(h)for(let r=0;r<f;++r)p.push(d=n&&n[r]!==void 0?c[e](t[r],n[r]):c[e](t[r])),d.onerror=m;else for(let n=0;n<f;++n)p.push(d=c[e](t[n])),d.onerror=m}const g=t=>{const n=t.target.result;p.forEach(((t,n)=>t.error!=null&&(y[n]=t.error))),u({numFailures:v,failures:y,results:e==="delete"?i:p.map((t=>t.result)),lastResult:n})};d.onerror=t=>{m(t),g(t)},d.onsuccess=g}))},getMany:({trans:t,keys:e})=>new Promise(((r,i)=>{r=tn(r);const s=t.objectStore(n),o=e.length,u=new Array(o);let a,c=0,l=0;const h=t=>{const n=t.target;u[n._pos]=n.result,++l===c&&r(u)},f=le(i);for(let t=0;t<o;++t)e[t]!=null&&(a=s.get(e[t]),a._pos=t,a.onsuccess=h,a.onerror=f,++c);c===0&&r(u)})),get:({trans:t,key:e})=>new Promise(((r,i)=>{r=tn(r);const s=t.objectStore(n).get(e);s.onsuccess=t=>r(t.target.result),s.onerror=le(i)})),query:function(t){return e=>new Promise(((i,s)=>{i=tn(i);const{trans:o,values:u,limit:a,query:c}=e,l=a===1/0?void 0:a,{index:h,range:f}=c,d=o.objectStore(n),p=h.isPrimaryKey?d:d.index(h.name),y=r(f);if(a===0)return i({result:[]});if(t){const t=u?p.getAll(y,l):p.getAllKeys(y,l);t.onsuccess=t=>i({result:t.target.result}),t.onerror=le(s)}else{let t=0;const n=u||!("openKeyCursor"in p)?p.openCursor(y):p.openKeyCursor(y),e=[];n.onsuccess=r=>{const s=n.result;return s?(e.push(u?s.value:s.primaryKey),++t===a?i({result:e}):void s.continue()):i({result:e})},n.onerror=le(s)}}))}(s),openCursor:function({trans:t,values:e,query:i,reverse:s,unique:o}){return new Promise(((u,a)=>{u=tn(u);const{index:c,range:l}=i,h=t.objectStore(n),f=c.isPrimaryKey?h:h.index(c.name),d=s?o?"prevunique":"prev":o?"nextunique":"next",p=e||!("openKeyCursor"in f)?f.openCursor(r(l),d):f.openKeyCursor(r(l),d);p.onerror=le(a),p.onsuccess=tn((n=>{const e=p.result;if(!e)return void u(null);e.___id=++ke,e.done=!1;const r=e.continue.bind(e);let i=e.continuePrimaryKey;i&&(i=i.bind(e));const s=e.advance.bind(e),o=()=>{throw new Error("Cursor not stopped")};e.trans=t,e.stop=e.continue=e.continuePrimaryKey=e.advance=()=>{throw new Error("Cursor not started")},e.fail=tn(a),e.next=function(){let t=1;return this.start((()=>t--?this.continue():this.stop())).then((()=>this))},e.start=t=>{const n=new Promise(((t,n)=>{t=tn(t),p.onerror=le(n),e.fail=n,e.stop=n=>{e.stop=e.continue=e.continuePrimaryKey=e.advance=o,t(n)}})),u=()=>{if(p.result)try{t()}catch(t){e.fail(t)}else e.done=!0,e.start=()=>{throw new Error("Cursor behind last entry")},e.stop()};return p.onsuccess=tn((t=>{p.onsuccess=u,u()})),e.continue=r,e.continuePrimaryKey=i,e.advance=s,u(),n},u(e)}),a)}))},count({query:t,trans:e}){const{index:i,range:s}=t;return new Promise(((t,o)=>{const u=e.objectStore(n),a=i.isPrimaryKey?u:u.index(i.name),c=r(s),l=c?a.count(c):a.count();l.onsuccess=tn((n=>t(n.target.result))),l.onerror=le(o)}))}}}(t))),u={};return o.forEach((t=>u[t.name]=t)),{stack:"dbcore",transaction:t.transaction.bind(t),table(t){if(!u[t])throw new Error(`Table '${t}' not found`);return u[t]},MIN_KEY:-1/0,MAX_KEY:we(n),schema:i}}function xe({_novip:t},n){const e=n.db,r=function(t,n,{IDBKeyRange:e,indexedDB:r},i){return{dbcore:function(t,n){return n.reduce(((t,{create:n})=>({...t,...n(t)})),t)}(Pe(n,e,i),t.dbcore)}}(t._middlewares,e,t._deps,n);t.core=r.dbcore,t.tables.forEach((n=>{const e=n.name;t.core.schema.tables.some((t=>t.name===e))&&(n.core=t.core.table(e),t[e]instanceof t.Table&&(t[e].core=n.core))}))}function Ce({_novip:t},n,e,r){e.forEach((e=>{const i=r[e];n.forEach((n=>{const r=b(n,e);(!r||"value"in r&&r.value===void 0)&&(n===t.Transaction.prototype||n instanceof t.Transaction?m(n,e,{get(){return this.table(e)},set(t){v(this,e,{value:t,writable:!0,configurable:!0,enumerable:!0})}}):n[e]=new t.Table(e,i))}))}))}function Ae({_novip:t},n){n.forEach((n=>{for(let e in n)n[e]instanceof t.Table&&delete n[e]}))}function Ee(t,n){return t._cfg.version-n._cfg.version}function De(t,n,e,r){const i=t._dbSchema,s=t._createTransaction("readwrite",t._storeNames,i);s.create(e),s._completion.catch(r);const o=s._reject.bind(s),u=Rt.transless||Rt;an((()=>{Rt.trans=s,Rt.transless=u,n===0?(c(i).forEach((t=>{je(e,t,i[t].primKey,i[t].indexes)})),xe(t,e),Ft.follow((()=>t.on.populate.fire(s))).catch(o)):function({_novip:t},n,e,r){const i=[],s=t._versions;let o=t._dbSchema=Ke(t,t.idbdb,r),u=!1;const a=s.filter((t=>t._cfg.version>=n));function l(){return i.length?Ft.resolve(i.shift()(e.idbtrans)).then(l):Ft.resolve()}return a.forEach((s=>{i.push((()=>{const i=o,a=s._cfg.dbschema;Te(t,i,r),Te(t,a,r),o=t._dbSchema=a;const l=Oe(i,a);l.add.forEach((t=>{je(r,t[0],t[1].primKey,t[1].indexes)})),l.change.forEach((t=>{if(t.recreate)throw new st.Upgrade("Not yet support for changing primary key");{const n=r.objectStore(t.name);t.add.forEach((t=>Ie(n,t))),t.change.forEach((t=>{n.deleteIndex(t.name),Ie(n,t)})),t.del.forEach((t=>n.deleteIndex(t)))}}));const h=s._cfg.contentUpgrade;if(h&&s._cfg.version>n){xe(t,r),e._memoizedTables={},u=!0;let n=D(a);l.del.forEach((t=>{n[t]=i[t]})),Ae(t,[t.Transaction.prototype]),Ce(t,[t.Transaction.prototype],c(n),n),e.schema=n;const s=U(h);let o;s&&cn();const f=Ft.follow((()=>{if(o=h(e),o&&s){var t=ln.bind(null,null);o.then(t,t)}}));return o&&typeof o.then=="function"?Ft.resolve(o):f.then((()=>o))}})),i.push((n=>{(!u||!jn)&&function(t,n){[].slice.call(n.db.objectStoreNames).forEach((e=>t[e]==null&&n.db.deleteObjectStore(e)))}(s._cfg.dbschema,n),Ae(t,[t.Transaction.prototype]),Ce(t,[t.Transaction.prototype],t._storeNames,t._dbSchema),e.schema=t._dbSchema}))})),l().then((()=>{var t,n;n=r,c(t=o).forEach((e=>{n.db.objectStoreNames.contains(e)||je(n,e,t[e].primKey,t[e].indexes)}))}))}(t,n,s,e).catch(o)}))}function Oe(t,n){const e={del:[],add:[],change:[]};let r;for(r in t)n[r]||e.del.push(r);for(r in n){const i=t[r],s=n[r];if(i){const t={name:r,def:s,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(s.primKey.keyPath||"")||i.primKey.auto!==s.primKey.auto&&!On)t.recreate=!0,e.change.push(t);else{const n=i.idxByName,r=s.idxByName;let o;for(o in n)r[o]||t.del.push(o);for(o in r){const e=n[o],i=r[o];e?e.src!==i.src&&t.change.push(i):t.add.push(i)}(t.del.length>0||t.add.length>0||t.change.length>0)&&e.change.push(t)}}else e.add.push([r,s])}return e}function je(t,n,e,r){const i=t.db.createObjectStore(n,e.keyPath?{keyPath:e.keyPath,autoIncrement:e.auto}:{autoIncrement:e.auto});return r.forEach((t=>Ie(i,t))),i}function Ie(t,n){t.createIndex(n.name,n.keyPath,{unique:n.unique,multiEntry:n.multi})}function Ke(t,n,e){const r={};return k(n.objectStoreNames,0).forEach((t=>{const n=e.objectStore(t);let i=n.keyPath;const s=ve(me(i),i||"",!1,!1,!!n.autoIncrement,i&&typeof i!="string",!0),o=[];for(let t=0;t<n.indexNames.length;++t){const e=n.index(n.indexNames[t]);i=e.keyPath;var u=ve(e.name,i,!!e.unique,!!e.multiEntry,!1,i&&typeof i!="string",!1);o.push(u)}r[t]=ge(t,s,o)})),r}function Te({_novip:t},n,e){const r=e.db.objectStoreNames;for(let i=0;i<r.length;++i){const s=r[i],o=e.objectStore(s);t._hasGetAll="getAll"in o;for(let t=0;t<o.indexNames.length;++t){const e=o.indexNames[t],r=o.index(e).keyPath,i=typeof r=="string"?r:"["+k(r).join("+")+"]";if(n[s]){const t=n[s].idxByName[i];t&&(t.name=e,delete n[s].idxByName[i],n[s].idxByName[e]=t)}}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&a.WorkerGlobalScope&&a instanceof a.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(t._hasGetAll=!1)}class Re{_parseStoresSpec(t,n){c(t).forEach((e=>{if(t[e]!==null){var r=t[e].split(",").map(((t,n)=>{const e=(t=t.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(e)?e.match(/^\[(.*)\]$/)[1].split("+"):e;return ve(e,r||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),l(r),n===0)})),i=r.shift();if(i.multi)throw new st.Schema("Primary key cannot be multi-valued");r.forEach((t=>{if(t.auto)throw new st.Schema("Only primary key can be marked as autoIncrement (++)");if(!t.keyPath)throw new st.Schema("Index must have a name and cannot be an empty string")})),n[e]=ge(e,i,r)}}))}stores(t){const n=this.db;this._cfg.storesSource=this._cfg.storesSource?h(this._cfg.storesSource,t):t;const e=n._versions,r={};let i={};return e.forEach((t=>{h(r,t._cfg.storesSource),i=t._cfg.dbschema={},t._parseStoresSpec(r,i)})),n._dbSchema=i,Ae(n,[n._allTables,n,n.Transaction.prototype]),Ce(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],c(i),i),n._storeNames=c(i),this}upgrade(t){return this._cfg.contentUpgrade=vt(this._cfg.contentUpgrade||at,t),this}}function Be(t,n){let e=t._dbNamesDB;return e||(e=t._dbNamesDB=new sr(Tn,{addons:[],indexedDB:t,IDBKeyRange:n}),e.version(1).stores({dbnames:"name"})),e.table("dbnames")}function qe(t){return t&&typeof t.databases=="function"}function Me(t){return an((function(){return Rt.letThrough=!0,t()}))}function Fe(){var t;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise((function(n){var e=function(){return indexedDB.databases().finally(n)};t=setInterval(e,100),e()})).finally((function(){return clearInterval(t)})):Promise.resolve()}function Ne(t){const n=t._state,{indexedDB:e}=t._deps;if(n.isBeingOpened||t.idbdb)return n.dbReadyPromise.then((()=>n.dbOpenError?kn(n.dbOpenError):t));V&&(n.openCanceller._stackHolder=z()),n.isBeingOpened=!0,n.dbOpenError=null,n.openComplete=!1;const r=n.openCanceller;function i(){if(n.openCanceller!==r)throw new st.DatabaseClosed("db.open() was cancelled")}let s=n.dbReadyResolve,o=null,u=!1;return Ft.race([r,(typeof navigator>"u"?Ft.resolve():Fe()).then((()=>new Ft(((r,s)=>{if(i(),!e)throw new st.MissingAPI;const a=t.name,l=n.autoSchema?e.open(a):e.open(a,Math.round(10*t.verno));if(!l)throw new st.MissingAPI;l.onerror=le(s),l.onblocked=tn(t._fireOnBlocked),l.onupgradeneeded=tn((r=>{if(o=l.transaction,n.autoSchema&&!t._options.allowEmptyDB){l.onerror=he,o.abort(),l.result.close();const t=e.deleteDatabase(a);t.onsuccess=t.onerror=tn((()=>{s(new st.NoSuchDatabase(`Database ${a} doesnt exist`))}))}else{o.onerror=le(s);var i=r.oldVersion>Math.pow(2,62)?0:r.oldVersion;u=i<1,t._novip.idbdb=l.result,De(t,i/10,o,s)}}),s),l.onsuccess=tn((()=>{o=null;const e=t._novip.idbdb=l.result,i=k(e.objectStoreNames);if(i.length>0)try{const r=e.transaction((s=i).length===1?s[0]:s,"readonly");n.autoSchema?function({_novip:t},n,e){t.verno=n.version/10;const r=t._dbSchema=Ke(0,n,e);t._storeNames=k(n.objectStoreNames,0),Ce(t,[t._allTables],c(r),r)}(t,e,r):(Te(t,t._dbSchema,r),function(t,n){const e=Oe(Ke(0,t.idbdb,n),t._dbSchema);return!(e.add.length||e.change.some((t=>t.add.length||t.change.length)))}(t,r)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),xe(t,r)}catch{}var s;Dn.push(t),e.onversionchange=tn((e=>{n.vcFired=!0,t.on("versionchange").fire(e)})),e.onclose=tn((n=>{t.on("close").fire(n)})),u&&function({indexedDB:t,IDBKeyRange:n},e){!qe(t)&&e!==Tn&&Be(t,n).put({name:e}).catch(at)}(t._deps,a),r()}),s)}))))]).then((()=>(i(),n.onReadyBeingFired=[],Ft.resolve(Me((()=>t.on.ready.fire(t.vip)))).then((function e(){if(n.onReadyBeingFired.length>0){let r=n.onReadyBeingFired.reduce(vt,at);return n.onReadyBeingFired=[],Ft.resolve(Me((()=>r(t.vip)))).then(e)}}))))).finally((()=>{n.onReadyBeingFired=null,n.isBeingOpened=!1})).then((()=>t)).catch((e=>{n.dbOpenError=e;try{o&&o.abort()}catch{}return r===n.openCanceller&&t._close(),kn(e)})).finally((()=>{n.openComplete=!0,s()}))}function _e(t){var n=n=>t.next(n),e=i(n),r=i((n=>t.throw(n)));function i(t){return n=>{var i=t(n),s=i.value;return i.done?s:s&&typeof s.then=="function"?s.then(e,r):l(s)?Promise.all(s).then(e,r):e(s)}}return i(n)()}function Le(t,n,e){var r=arguments.length;if(r<2)throw new st.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];return e=i.pop(),[t,j(i),e]}function Ue(t,n,e,r,i){return Ft.resolve().then((()=>{const s=Rt.transless||Rt,o=t._createTransaction(n,e,t._dbSchema,r),u={trans:o,transless:s};if(r)o.idbtrans=r.idbtrans;else try{o.create(),t._state.PR1398_maxLoop=3}catch(r){return r.name===rt.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then((()=>Ue(t,n,e,null,i)))):kn(r)}const a=U(i);let c;a&&cn();const l=Ft.follow((()=>{if(c=i.call(o,o),c)if(a){var t=ln.bind(null,null);c.then(t,t)}else typeof c.next=="function"&&typeof c.throw=="function"&&(c=_e(c))}),u);return(c&&typeof c.then=="function"?Ft.resolve(c).then((t=>o.active?t:kn(new st.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")))):l.then((()=>c))).then((t=>(r&&o._resolve(),o._completion.then((()=>t))))).catch((t=>(o._reject(t),kn(t))))}))}function Ve(t,n,e){const r=l(t)?t.slice():[t];for(let t=0;t<e;++t)r.push(n);return r}const We={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(t){return{...t,table(n){const e=t.table(n),{schema:r}=e,i={},s=[];function o(t,n,e){const r=Se(t),u=i[r]=i[r]||[],a=t==null?0:typeof t=="string"?1:t.length,c=n>0,l={...e,isVirtual:c,keyTail:n,keyLength:a,extractKey:be(t),unique:!c&&e.unique};return u.push(l),l.isPrimaryKey||s.push(l),a>1&&o(a===2?t[0]:t.slice(0,a-1),n+1,e),u.sort(((t,n)=>t.keyTail-n.keyTail)),l}const u=o(r.primaryKey.keyPath,0,r.primaryKey);i[":id"]=[u];for(const t of r.indexes)o(t.keyPath,0,t);function a(n){const e=n.query.index;return e.isVirtual?{...n,query:{index:e,range:(r=n.query.range,i=e.keyTail,{type:r.type===1?2:r.type,lower:Ve(r.lower,r.lowerOpen?t.MAX_KEY:t.MIN_KEY,i),lowerOpen:!0,upper:Ve(r.upper,r.upperOpen?t.MIN_KEY:t.MAX_KEY,i),upperOpen:!0})}}:n;var r,i}return{...e,schema:{...r,primaryKey:u,indexes:s,getIndexByKeyPath:function(t){const n=i[Se(t)];return n&&n[0]}},count:t=>e.count(a(t)),query:t=>e.query(a(t)),openCursor(n){const{keyTail:r,isVirtual:i,keyLength:s}=n.query.index;return i?e.openCursor(a(n)).then((e=>e&&function(e){return Object.create(e,{continue:{value:function(i){i!=null?e.continue(Ve(i,n.reverse?t.MAX_KEY:t.MIN_KEY,r)):n.unique?e.continue(e.key.slice(0,s).concat(n.reverse?t.MIN_KEY:t.MAX_KEY,r)):e.continue()}},continuePrimaryKey:{value(n,i){e.continuePrimaryKey(Ve(n,t.MAX_KEY,r),i)}},primaryKey:{get:()=>e.primaryKey},key:{get(){const t=e.key;return s===1?t[0]:t.slice(0,s)}},value:{get:()=>e.value}})}(e))):e.openCursor(n)}}}}}};function He(t,n,e,r){return e=e||{},r=r||"",c(t).forEach((i=>{if(p(n,i)){var s=t[i],o=n[i];if(typeof s=="object"&&typeof o=="object"&&s&&o){const t=M(s);t!==M(o)?e[r+i]=n[i]:t==="Object"?He(s,o,e,r+i+"."):s!==o&&(e[r+i]=n[i])}else s!==o&&(e[r+i]=n[i])}else e[r+i]=void 0})),c(n).forEach((i=>{p(t,i)||(e[r+i]=n[i])})),e}const Ge={stack:"dbcore",name:"HooksMiddleware",level:2,create:t=>({...t,table(n){const e=t.table(n),{primaryKey:r}=e.schema;return{...e,mutate(t){const i=Rt.trans,{deleting:s,creating:o,updating:u}=i.table(n).hook;switch(t.type){case"add":if(o.fire===at)break;return i._promise("readwrite",(()=>a(t)),!0);case"put":if(o.fire===at&&u.fire===at)break;return i._promise("readwrite",(()=>a(t)),!0);case"delete":if(s.fire===at)break;return i._promise("readwrite",(()=>a(t)),!0);case"deleteRange":if(s.fire===at)break;return i._promise("readwrite",(()=>function(t){return c(t.trans,t.range,1e4)}(t)),!0)}return e.mutate(t);function a(t){const n=Rt.trans,i=t.keys||function(t,n){return n.type==="delete"?n.keys:n.keys||n.values.map(t.extractKey)}(r,t);if(!i)throw new Error("Keys missing");return(t=t.type==="add"||t.type==="put"?{...t,keys:i}:{...t}).type!=="delete"&&(t.values=[...t.values]),t.keys&&(t.keys=[...t.keys]),function(t,n,e){return n.type==="add"?Promise.resolve([]):t.getMany({trans:n.trans,keys:e,cache:"immutable"})}(e,t,i).then((a=>{const c=i.map(((e,i)=>{const c=a[i],l={onerror:null,onsuccess:null};if(t.type==="delete")s.fire.call(l,e,c,n);else if(t.type==="add"||c===void 0){const s=o.fire.call(l,e,t.values[i],n);e==null&&s!=null&&(e=s,t.keys[i]=e,r.outbound||E(t.values[i],r.keyPath,e))}else{const r=He(c,t.values[i]),s=u.fire.call(l,r,e,c,n);if(s){const n=t.values[i];Object.keys(s).forEach((t=>{p(n,t)?n[t]=s[t]:E(n,t,s[t])}))}}return l}));return e.mutate(t).then((({failures:n,results:e,numFailures:r,lastResult:s})=>{for(let r=0;r<i.length;++r){const s=e?e[r]:i[r],o=c[r];s==null?o.onerror&&o.onerror(n[r]):o.onsuccess&&o.onsuccess(t.type==="put"&&a[r]?t.values[r]:s)}return{failures:n,results:e,numFailures:r,lastResult:s}})).catch((t=>(c.forEach((n=>n.onerror&&n.onerror(t))),Promise.reject(t))))}))}function c(t,n,i){return e.query({trans:t,values:!1,query:{index:r,range:n},limit:i}).then((({result:e})=>a({type:"delete",keys:e,trans:t}).then((r=>r.numFailures>0?Promise.reject(r.failures[0]):e.length<i?{failures:[],numFailures:0,lastResult:void 0}:c(t,{...n,lower:e[e.length-1],lowerOpen:!0},i)))))}}}}})};function ze(t,n,e){try{if(!n||n.keys.length<t.length)return null;const r=[];for(let i=0,s=0;i<n.keys.length&&s<t.length;++i)Yn(n.keys[i],t[s])===0&&(r.push(e?R(n.values[i]):n.values[i]),++s);return r.length===t.length?r:null}catch{return null}}const Je={stack:"dbcore",level:-1,create:t=>({table:n=>{const e=t.table(n);return{...e,getMany:t=>{if(!t.cache)return e.getMany(t);const n=ze(t.keys,t.trans._cache,t.cache==="clone");return n?Ft.resolve(n):e.getMany(t).then((n=>(t.trans._cache={keys:t.keys,values:t.cache==="clone"?R(n):n},n)))},mutate:t=>(t.type!=="add"&&(t.trans._cache=null),e.mutate(t))}}})};function Ye(t){return!("from"in t)}const Qe=function(t,n){if(!this){const n=new Qe;return t&&"d"in t&&h(n,t),n}h(this,arguments.length?{d:1,from:t,to:arguments.length>1?n:t}:{d:0})};function Xe(t,n,e){const r=Yn(n,e);if(isNaN(r))return;if(r>0)throw RangeError();if(Ye(t))return h(t,{from:n,to:e,d:1});const i=t.l,s=t.r;if(Yn(e,t.from)<0)return i?Xe(i,n,e):t.l={from:n,to:e,d:1,l:null,r:null},er(t);if(Yn(n,t.to)>0)return s?Xe(s,n,e):t.r={from:n,to:e,d:1,l:null,r:null},er(t);Yn(n,t.from)<0&&(t.from=n,t.l=null,t.d=s?s.d+1:1),Yn(e,t.to)>0&&(t.to=e,t.r=null,t.d=t.l?t.l.d+1:1);const o=!t.r;i&&!t.l&&Ze(t,i),s&&o&&Ze(t,s)}function Ze(t,n){Ye(n)||function t(n,{from:e,to:r,l:i,r:s}){Xe(n,e,r),i&&t(n,i),s&&t(n,s)}(t,n)}function tr(t,n){const e=nr(n);let r=e.next();if(r.done)return!1;let i=r.value;const s=nr(t);let o=s.next(i.from),u=o.value;for(;!r.done&&!o.done;){if(Yn(u.from,i.to)<=0&&Yn(u.to,i.from)>=0)return!0;Yn(i.from,u.from)<0?i=(r=e.next(u.from)).value:u=(o=s.next(i.from)).value}return!1}function nr(t){let n=Ye(t)?null:{s:0,n:t};return{next(t){const e=arguments.length>0;for(;n;)switch(n.s){case 0:if(n.s=1,e)for(;n.n.l&&Yn(t,n.n.from)<0;)n={up:n,n:n.n.l,s:1};else for(;n.n.l;)n={up:n,n:n.n.l,s:1};case 1:if(n.s=2,!e||Yn(t,n.n.to)<=0)return{value:n.n,done:!1};case 2:if(n.n.r){n.s=3,n={up:n,n:n.n.r,s:0};continue}case 3:n=n.up}return{done:!0}}}}function er(t){var n,e;const r=(((n=t.r)===null||n===void 0?void 0:n.d)||0)-(((e=t.l)===null||e===void 0?void 0:e.d)||0),i=r>1?"r":r<-1?"l":"";if(i){const n=i==="r"?"l":"r",e={...t},r=t[i];t.from=r.from,t.to=r.to,t[i]=r[i],e[i]=r[n],t[n]=e,e.d=rr(e)}t.d=rr(t)}function rr({r:t,l:n}){return(t?n?Math.max(t.d,n.d):t.d:n?n.d:0)+1}y(Qe.prototype,{add(t){return Ze(this,t),this},addKey(t){return Xe(this,t,t),this},addKeys(t){return t.forEach((t=>Xe(this,t,t))),this},[F](){return nr(this)}});const ir={stack:"dbcore",level:0,create:t=>{const n=t.schema.name,e=new Qe(t.MIN_KEY,t.MAX_KEY);return{...t,table:r=>{const i=t.table(r),{schema:s}=i,{primaryKey:o}=s,{extractKey:u,outbound:a}=o,h={...i,mutate:t=>{const o=t.trans,u=o.mutatedParts||(o.mutatedParts={}),a=t=>{const e=`idb://${n}/${r}/${t}`;return u[e]||(u[e]=new Qe)},c=a(""),h=a(":dels"),{type:f}=t;let[d,p]=t.type==="deleteRange"?[t.range]:t.type==="delete"?[t.keys]:t.values.length<50?[[],t.values]:[];const y=t.trans._cache;return i.mutate(t).then((t=>{if(l(d)){f!=="delete"&&(d=t.results),c.addKeys(d);const n=ze(d,y);n||f==="add"||h.addKeys(d),(n||p)&&function(t,n,e,r){function i(n){const i=t(n.name||"");function s(t){return t!=null?n.extractKey(t):null}const o=t=>n.multiEntry&&l(t)?t.forEach((t=>i.addKey(t))):i.addKey(t);(e||r).forEach(((t,n)=>{const i=e&&s(e[n]),u=r&&s(r[n]);Yn(i,u)!==0&&(i!=null&&o(i),u!=null&&o(u))}))}n.indexes.forEach(i)}(a,s,n,p)}else if(d){const t={from:d.lower,to:d.upper};h.add(t),c.add(t)}else c.add(e),h.add(e),s.indexes.forEach((t=>a(t.name).add(e)));return t}))}},f=({query:{index:n,range:e}})=>{var r,i;return[n,new Qe((r=e.lower)!==null&&r!==void 0?r:t.MIN_KEY,(i=e.upper)!==null&&i!==void 0?i:t.MAX_KEY)]},d={get:t=>[o,new Qe(t.key)],getMany:t=>[o,(new Qe).addKeys(t.keys)],count:f,query:f,openCursor:f};return c(d).forEach((t=>{h[t]=function(s){const{subscr:o}=Rt;if(o){const c=t=>{const e=`idb://${n}/${r}/${t}`;return o[e]||(o[e]=new Qe)},l=c(""),h=c(":dels"),[f,p]=d[t](s);if(c(f.name||"").add(p),!f.isPrimaryKey){if(t!=="count"){const n=t==="query"&&a&&s.values&&i.query({...s,values:!1});return i[t].apply(this,arguments).then((e=>{if(t==="query"){if(a&&s.values)return n.then((({result:t})=>(l.addKeys(t),e)));const t=s.values?e.result.map(u):e.result;s.values?l.addKeys(t):h.addKeys(t)}else if(t==="openCursor"){const t=e,n=s.values;return t&&Object.create(t,{key:{get:()=>(h.addKey(t.primaryKey),t.key)},primaryKey:{get(){const n=t.primaryKey;return h.addKey(n),n}},value:{get:()=>(n&&l.addKey(t.primaryKey),t.value)}})}return e}))}h.add(e)}}return i[t].apply(this,arguments)}})),h}}}};class sr{constructor(t,n){this._middlewares={},this.verno=0;const e=sr.dependencies;this._options=n={addons:sr.addons,autoOpen:!0,indexedDB:e.indexedDB,IDBKeyRange:e.IDBKeyRange,...n},this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};const{addons:r}=n;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const i={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:at,dbReadyPromise:null,cancelOpen:at,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var s;i.dbReadyPromise=new Ft((t=>{i.dbReadyResolve=t})),i.openCanceller=new Ft(((t,n)=>{i.cancelOpen=n})),this._state=i,this.name=t,this.on=_n(this,"populate","blocked","versionchange","close",{ready:[vt,at]}),this.on.ready.subscribe=S(this.on.ready.subscribe,(t=>(n,e)=>{sr.vip((()=>{const r=this._state;if(r.openComplete)r.dbOpenError||Ft.resolve().then(n),e&&t(n);else if(r.onReadyBeingFired)r.onReadyBeingFired.push(n),e&&t(n);else{t(n);const r=this;e||t((function t(){r.on.ready.unsubscribe(n),r.on.ready.unsubscribe(t)}))}}))})),this.Collection=(s=this,Ln(Zn.prototype,(function(t,n){this.db=s;let e=Mn,r=null;if(n)try{e=n()}catch(t){r=t}const i=t._ctx,o=i.table,u=o.hook.reading.fire;this._ctx={table:o,index:i.index,isPrimKey:!i.index||o.schema.primKey.keyPath&&i.index===o.schema.primKey.name,range:e,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:i.or,valueMapper:u!==ct?u:null}}))),this.Table=function(t){return Ln(Nn.prototype,(function(n,e,r){this.db=t,this._tx=r,this.name=n,this.schema=e,this.hook=t._allTables[n]?t._allTables[n].hook:_n(null,{creating:[ft,at],reading:[lt,ct],updating:[pt,at],deleting:[dt,at]})}))}(this),this.Transaction=function(t){return Ln(ye.prototype,(function(n,e,r,i,s){this.db=t,this.mode=n,this.storeNames=e,this.schema=r,this.chromeTransactionDurability=i,this.idbtrans=null,this.on=_n(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 Ft(((t,n)=>{this._resolve=t,this._reject=n})),this._completion.then((()=>{this.active=!1,this.on.complete.fire()}),(t=>{var n=this.active;return this.active=!1,this.on.error.fire(t),this.parent?this.parent._reject(t):n&&this.idbtrans&&this.idbtrans.abort(),kn(t)}))}))}(this),this.Version=function(t){return Ln(Re.prototype,(function(n){this.db=t,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}(this),this.WhereClause=function(t){return Ln(ce.prototype,(function(n,e,r){this.db=t,this._ctx={table:n,index:e===":id"?null:e,or:r};const i=t._deps.indexedDB;if(!i)throw new st.MissingAPI;this._cmp=this._ascending=i.cmp.bind(i),this._descending=(t,n)=>i.cmp(n,t),this._max=(t,n)=>i.cmp(t,n)>0?t:n,this._min=(t,n)=>i.cmp(t,n)<0?t:n,this._IDBKeyRange=t._deps.IDBKeyRange}))}(this),this.on("versionchange",(t=>{t.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()})),this.on("blocked",(t=>{!t.newVersion||t.newVersion<t.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${t.oldVersion/10}`)})),this._maxKey=we(n.IDBKeyRange),this._createTransaction=(t,n,e,r)=>new this.Transaction(t,n,e,this._options.chromeTransactionDurability,r),this._fireOnBlocked=t=>{this.on("blocked").fire(t),Dn.filter((t=>t.name===this.name&&t!==this&&!t._state.vcFired)).map((n=>n.on("versionchange").fire(t)))},this.use(We),this.use(Ge),this.use(ir),this.use(Je),this.vip=Object.create(this,{_vip:{value:!0}}),r.forEach((t=>t(this)))}version(t){if(isNaN(t)||t<.1)throw new st.Type("Given version is not a positive number");if(t=Math.round(10*t)/10,this.idbdb||this._state.isBeingOpened)throw new st.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,t);const n=this._versions;var e=n.filter((n=>n._cfg.version===t))[0];return e||(e=new this.Version(t),n.push(e),n.sort(Ee),e.stores({}),this._state.autoSchema=!1,e)}_whenReady(t){return this.idbdb&&(this._state.openComplete||Rt.letThrough||this._vip)?t():new Ft(((t,n)=>{if(this._state.openComplete)return n(new st.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void n(new st.DatabaseClosed);this.open().catch(at)}this._state.dbReadyPromise.then(t,n)})).then(t)}use({stack:t,create:n,level:e,name:r}){r&&this.unuse({stack:t,name:r});const i=this._middlewares[t]||(this._middlewares[t]=[]);return i.push({stack:t,create:n,level:e??10,name:r}),i.sort(((t,n)=>t.level-n.level)),this}unuse({stack:t,name:n,create:e}){return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter((t=>e?t.create!==e:!!n&&t.name!==n))),this}open(){return Ne(this)}_close(){const t=this._state,n=Dn.indexOf(this);if(n>=0&&Dn.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}t.dbReadyPromise=new Ft((n=>{t.dbReadyResolve=n})),t.openCanceller=new Ft(((n,e)=>{t.cancelOpen=e}))}close(){this._close();const t=this._state;this._options.autoOpen=!1,t.dbOpenError=new st.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError)}delete(){const t=arguments.length>0,n=this._state;return new Ft(((e,r)=>{const i=()=>{this.close();var t=this._deps.indexedDB.deleteDatabase(this.name);t.onsuccess=tn((()=>{(function({indexedDB:t,IDBKeyRange:n},e){!qe(t)&&e!==Tn&&Be(t,n).delete(e).catch(at)})(this._deps,this.name),e()})),t.onerror=le(r),t.onblocked=this._fireOnBlocked};if(t)throw new st.InvalidArgument("Arguments not allowed in db.delete()");n.isBeingOpened?n.dbReadyPromise.then(i):i()}))}backendDB(){return this.idbdb}isOpen(){return this.idbdb!==null}hasBeenClosed(){const t=this._state.dbOpenError;return t&&t.name==="DatabaseClosed"}hasFailed(){return this._state.dbOpenError!==null}dynamicallyOpened(){return this._state.autoSchema}get tables(){return c(this._allTables).map((t=>this._allTables[t]))}transaction(){const t=Le.apply(this,arguments);return this._transaction.apply(this,t)}_transaction(t,n,e){let r=Rt.trans;r&&r.db===this&&t.indexOf("!")===-1||(r=null);const i=t.indexOf("?")!==-1;let s,o;t=t.replace("!","").replace("?","");try{if(o=n.map((t=>{var n=t instanceof this.Table?t.name:t;if(typeof n!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return n})),t=="r"||t===Rn)s=Rn;else{if(t!="rw"&&t!=Bn)throw new st.InvalidArgument("Invalid transaction mode: "+t);s=Bn}if(r){if(r.mode===Rn&&s===Bn){if(!i)throw new st.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");r=null}r&&o.forEach((t=>{if(r&&r.storeNames.indexOf(t)===-1){if(!i)throw new st.SubTransaction("Table "+t+" not included in parent transaction.");r=null}})),i&&r&&!r.active&&(r=null)}}catch(t){return r?r._promise(null,((n,e)=>{e(t)})):kn(t)}const u=Ue.bind(null,this,s,o,r,e);return r?r._promise(s,u,"lock"):Rt.trans?vn(Rt.transless,(()=>this._whenReady(u))):this._whenReady(u)}table(t){if(!p(this._allTables,t))throw new st.InvalidTable(`Table ${t} does not exist`);return this._allTables[t]}}const or=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable";class ur{constructor(t){this._subscribe=t}subscribe(t,n,e){return this._subscribe(t&&typeof t!="function"?t:{next:t,error:n,complete:e})}[or](){return this}}function ar(t,n){return c(n).forEach((e=>{Ze(t[e]||(t[e]=new Qe),n[e])})),t}function cr(t){let n,e=!1;const r=new ur((r=>{const i=U(t);let s=!1,o={},u={};const a={get closed(){return s},unsubscribe:()=>{s=!0,pe.storagemutated.unsubscribe(d)}};r.start&&r.start(a);let l=!1,h=!1;function f(){return c(u).some((t=>o[t]&&tr(o[t],u[t])))}const d=t=>{ar(o,t),f()&&p()},p=()=>{if(l||s)return;o={};const c={},y=function(n){i&&cn();const e=()=>an(t,{subscr:n,trans:null}),r=Rt.trans?vn(Rt.transless,e):e();return i&&r.then(ln,ln),r}(c);h||(pe(fe,d),h=!0),l=!0,Promise.resolve(y).then((t=>{e=!0,n=t,l=!1,s||(f()?p():(o={},u=c,r.next&&r.next(t)))}),(t=>{l=!1,e=!1,r.error&&r.error(t),a.unsubscribe()}))};return p(),a}));return r.hasValue=()=>e,r.getValue=()=>n,r}let lr;try{lr={indexedDB:a.indexedDB||a.mozIndexedDB||a.webkitIndexedDB||a.msIndexedDB,IDBKeyRange:a.IDBKeyRange||a.webkitIDBKeyRange}}catch{lr={indexedDB:null,IDBKeyRange:null}}const hr=sr;function fr(t){let n=dr;try{dr=!0,pe.storagemutated.fire(t)}finally{dr=n}}y(hr,{...ut,delete:t=>new hr(t,{addons:[]}).delete(),exists:t=>new hr(t,{addons:[]}).open().then((t=>(t.close(),!0))).catch("NoSuchDatabaseError",(()=>!1)),getDatabaseNames(t){try{return function({indexedDB:t,IDBKeyRange:n}){return qe(t)?Promise.resolve(t.databases()).then((t=>t.map((t=>t.name)).filter((t=>t!==Tn)))):Be(t,n).toCollection().primaryKeys()}(hr.dependencies).then(t)}catch{return kn(new st.MissingAPI)}},defineClass:()=>function(t){h(this,t)},ignoreTransaction:t=>Rt.trans?vn(Rt.transless,t):t(),vip:Me,async:function(t){return function(){try{var n=_e(t.apply(this,arguments));return n&&typeof n.then=="function"?n:Ft.resolve(n)}catch(t){return kn(t)}}},spawn:function(t,n,e){try{var r=_e(t.apply(e,n||[]));return r&&typeof r.then=="function"?r:Ft.resolve(r)}catch(t){return kn(t)}},currentTransaction:{get:()=>Rt.trans||null},waitFor:function(t,n){const e=Ft.resolve(typeof t=="function"?hr.ignoreTransaction(t):t).timeout(n||6e4);return Rt.trans?Rt.trans.waitFor(e):e},Promise:Ft,debug:{get:()=>V,set:t=>{W(t,t==="dexie"?()=>!0:Kn)}},derive:g,extend:h,props:y,override:S,Events:_n,on:pe,liveQuery:cr,extendObservabilitySet:ar,getByKeyPath:A,setByKeyPath:E,delByKeyPath:function(t,n){typeof n=="string"?E(t,n,void 0):"length"in n&&[].map.call(n,(function(n){E(t,n,void 0)}))},shallowClone:D,deepClone:R,getObjectDiff:He,cmp:Yn,asap:x,minKey:Cn,addons:[],connections:Dn,errnames:rt,dependencies:lr,semVer:Pn,version:Pn.split(".").map((t=>parseInt(t))).reduce(((t,n,e)=>t+n/Math.pow(10,2*e)))}),hr.maxKey=we(hr.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(pe(fe,(t=>{if(!dr){let n;On?(n=document.createEvent("CustomEvent"),n.initCustomEvent(de,!0,!0,t)):n=new CustomEvent(de,{detail:t}),dr=!0,dispatchEvent(n),dr=!1}})),addEventListener(de,(({detail:t})=>{dr||fr(t)})));let dr=!1;if(typeof BroadcastChannel<"u"){const t=new BroadcastChannel(de);typeof t.unref=="function"&&t.unref(),pe(fe,(n=>{dr||t.postMessage(n)})),t.onmessage=t=>{t.data&&fr(t.data)}}else if(typeof self<"u"&&typeof navigator<"u"){pe(fe,(t=>{try{dr||(typeof localStorage<"u"&&localStorage.setItem(de,JSON.stringify({trig:Math.random(),changedParts:t})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach((n=>n.postMessage({type:de,changedParts:t}))))}catch{}})),typeof addEventListener<"u"&&addEventListener("storage",(t=>{if(t.key===de){const n=JSON.parse(t.newValue);n&&fr(n.changedParts)}}));const t=self.document&&navigator.serviceWorker;t&&t.addEventListener("message",(function({data:t}){t&&t.type===de&&fr(t.changedParts)}))}Ft.rejectionMapper=function(t,n){if(!t||t instanceof Z||t instanceof TypeError||t instanceof SyntaxError||!t.name||!ot[t.name])return t;var e=new ot[t.name](n||t.message,t);return"stack"in t&&m(e,"stack",{get:function(){return this.inner.stack}}),e},W(V,Kn);export{s as N,u as X,o as n};
2
+ //# sourceMappingURL=p-84109239.js.map