@nylas/web-elements 1.4.2 → 1.4.4

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 (147) hide show
  1. package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +56 -27
  2. package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +4842 -4822
  3. package/dist/cjs/checkmark-icon_15.cjs.entry.js +3 -3
  4. package/dist/cjs/checkmark-icon_15.cjs.entry.js.map +1 -1
  5. package/dist/cjs/google-logo-icon_6.cjs.entry.js +4 -4
  6. package/dist/cjs/input-component.cjs.entry.js +13 -2
  7. package/dist/cjs/input-component.cjs.entry.js.map +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/nylas-booked-event-card_12.cjs.entry.js +40 -11
  10. package/dist/cjs/nylas-booked-event-card_12.cjs.entry.js.map +1 -1
  11. package/dist/cjs/nylas-event-calendar_3.cjs.entry.js +53 -24
  12. package/dist/cjs/nylas-event-calendar_3.cjs.entry.js.map +1 -1
  13. package/dist/cjs/nylas-provider.cjs.entry.js +1 -1
  14. package/dist/cjs/nylas-scheduling.cjs.entry.js +3 -3
  15. package/dist/cjs/nylas-web-elements.cjs.js +1 -1
  16. package/dist/cjs/{scheduler-store-d6f5cff3.js → scheduler-store-5dcefe7e.js} +2 -2
  17. package/dist/cjs/{scheduler-store-d6f5cff3.js.map → scheduler-store-5dcefe7e.js.map} +1 -1
  18. package/dist/collection/components/design-system/input-component/input-component.js +13 -2
  19. package/dist/collection/components/design-system/input-component/input-component.js.map +1 -1
  20. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js +40 -6
  21. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js.map +1 -1
  22. package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js +8 -5
  23. package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js.map +1 -1
  24. package/dist/collection/components/scheduler-editor/nylas-event-calendar/nylas-event-calendar.js +28 -17
  25. package/dist/collection/components/scheduler-editor/nylas-event-calendar/nylas-event-calendar.js.map +1 -1
  26. package/dist/collection/components/scheduler-editor/nylas-event-capacity/nylas-event-capacity.css +15 -0
  27. package/dist/collection/components/scheduler-editor/nylas-event-capacity/nylas-event-capacity.js +13 -2
  28. package/dist/collection/components/scheduler-editor/nylas-event-capacity/nylas-event-capacity.js.map +1 -1
  29. package/dist/collection/components/scheduler-editor/nylas-event-timeslot/nylas-event-timeslot.css +1 -1
  30. package/dist/collection/components/scheduler-editor/nylas-event-timeslot/nylas-event-timeslot.js +12 -4
  31. package/dist/collection/components/scheduler-editor/nylas-event-timeslot/nylas-event-timeslot.js.map +1 -1
  32. package/dist/collection/components/scheduler-editor/nylas-event-title/nylas-event-title.js +3 -3
  33. package/dist/collection/components/scheduler-editor/nylas-event-title/nylas-event-title.js.map +1 -1
  34. package/dist/components/index.es.js +1 -1
  35. package/dist/components/input-component2.js +13 -2
  36. package/dist/components/input-component2.js.map +1 -1
  37. package/dist/components/nylas-date-picker2.js +38 -8
  38. package/dist/components/nylas-date-picker2.js.map +1 -1
  39. package/dist/components/nylas-editor-tabs-group2.js +2 -2
  40. package/dist/components/nylas-editor-tabs2.js +2 -2
  41. package/dist/components/nylas-event-calendar2.js +29 -18
  42. package/dist/components/nylas-event-calendar2.js.map +1 -1
  43. package/dist/components/nylas-event-capacity2.js +14 -3
  44. package/dist/components/nylas-event-capacity2.js.map +1 -1
  45. package/dist/components/nylas-event-timeslot2.js +14 -6
  46. package/dist/components/nylas-event-timeslot2.js.map +1 -1
  47. package/dist/components/nylas-event-title2.js +3 -3
  48. package/dist/components/nylas-event-title2.js.map +1 -1
  49. package/dist/components/nylas-list-configurations2.js +1 -1
  50. package/dist/components/nylas-locale-switch2.js +1 -1
  51. package/dist/components/nylas-scheduler-editor.js +1 -1
  52. package/dist/components/nylas-scheduling.js +3 -3
  53. package/dist/components/nylas-timeslot-picker2.js +9 -6
  54. package/dist/components/nylas-timeslot-picker2.js.map +1 -1
  55. package/dist/components/scheduler-store.js +2 -2
  56. package/dist/components/utils.js +1 -1
  57. package/dist/esm/calendar-agenda-fill-icon_36.entry.js +2 -2
  58. package/dist/esm/checkmark-icon_15.entry.js +5 -5
  59. package/dist/esm/checkmark-icon_15.entry.js.map +1 -1
  60. package/dist/esm/{feedbackSync-aa8d23d1.js → feedbackSync-57bb471a.js} +2 -2
  61. package/dist/esm/{feedbackSync-aa8d23d1.js.map → feedbackSync-57bb471a.js.map} +1 -1
  62. package/dist/esm/globe-icon_2.entry.js +1 -1
  63. package/dist/esm/google-logo-icon_6.entry.js +7 -7
  64. package/dist/esm/{index.es-6d4b50d5.js → index.es-13ff6710.js} +2 -2
  65. package/dist/esm/{index.es-6d4b50d5.js.map → index.es-13ff6710.js.map} +1 -1
  66. package/dist/esm/index.js +2 -2
  67. package/dist/esm/input-component.entry.js +14 -3
  68. package/dist/esm/input-component.entry.js.map +1 -1
  69. package/dist/esm/input-dropdown_2.entry.js +1 -1
  70. package/dist/esm/loader.js +1 -1
  71. package/dist/esm/multi-select-dropdown_2.entry.js +1 -1
  72. package/dist/esm/{nylas-api-request-c5400df5.js → nylas-api-request-2e5f4c7f.js} +2 -2
  73. package/dist/esm/{nylas-api-request-c5400df5.js.map → nylas-api-request-2e5f4c7f.js.map} +1 -1
  74. package/dist/esm/nylas-booked-event-card_12.entry.js +42 -13
  75. package/dist/esm/nylas-booked-event-card_12.entry.js.map +1 -1
  76. package/dist/esm/nylas-event-calendar_3.entry.js +55 -26
  77. package/dist/esm/nylas-event-calendar_3.entry.js.map +1 -1
  78. package/dist/esm/nylas-form-card.entry.js +2 -2
  79. package/dist/esm/nylas-if-state.entry.js +2 -2
  80. package/dist/esm/nylas-login.entry.js +2 -2
  81. package/dist/esm/nylas-provider.entry.js +3 -3
  82. package/dist/esm/nylas-scheduler-editor.entry.js +3 -3
  83. package/dist/esm/nylas-scheduling.entry.js +6 -6
  84. package/dist/esm/nylas-web-elements.js +1 -1
  85. package/dist/esm/{register-component-238f28de.js → register-component-02a05665.js} +2 -2
  86. package/dist/esm/{register-component-238f28de.js.map → register-component-02a05665.js.map} +1 -1
  87. package/dist/esm/{scheduler-store-82bb212a.js → scheduler-store-fe9e85a4.js} +3 -3
  88. package/dist/esm/{scheduler-store-82bb212a.js.map → scheduler-store-fe9e85a4.js.map} +1 -1
  89. package/dist/esm/textarea-component.entry.js +1 -1
  90. package/dist/esm/{utils-7d962146.js → utils-e27d0e4b.js} +2 -2
  91. package/dist/esm/{utils-7d962146.js.map → utils-e27d0e4b.js.map} +1 -1
  92. package/dist/nylas-web-elements/index.esm.js +1 -1
  93. package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
  94. package/dist/nylas-web-elements/nylas-web-elements.esm.js.map +1 -1
  95. package/dist/nylas-web-elements/{p-12bf5148.js → p-189b24e6.js} +2 -2
  96. package/dist/nylas-web-elements/p-1cbe8a56.entry.js +2 -0
  97. package/dist/nylas-web-elements/{p-d132fbaa.entry.js.map → p-1cbe8a56.entry.js.map} +1 -1
  98. package/dist/nylas-web-elements/{p-fdc35ad8.entry.js → p-23971057.entry.js} +2 -2
  99. package/dist/nylas-web-elements/{p-ba831977.entry.js → p-2dd05606.entry.js} +2 -2
  100. package/dist/nylas-web-elements/{p-797578de.js → p-388c456c.js} +2 -2
  101. package/dist/nylas-web-elements/{p-cf650f4f.js → p-3ea1c7c9.js} +2 -2
  102. package/dist/nylas-web-elements/{p-de9d8218.entry.js → p-5f683e34.entry.js} +2 -2
  103. package/dist/nylas-web-elements/{p-c2b6e0ca.entry.js → p-68ab7563.entry.js} +2 -2
  104. package/dist/nylas-web-elements/p-68ab7563.entry.js.map +1 -0
  105. package/dist/nylas-web-elements/{p-ec2c12a9.js → p-6b7fb948.js} +2 -2
  106. package/dist/nylas-web-elements/{p-cfd42146.js → p-7477410d.js} +2 -2
  107. package/dist/nylas-web-elements/{p-b62ef1be.js → p-7d9cdd23.js} +2 -2
  108. package/dist/nylas-web-elements/{p-00577fba.entry.js → p-8a7a6947.entry.js} +2 -2
  109. package/dist/nylas-web-elements/p-97f87422.entry.js +2 -0
  110. package/dist/nylas-web-elements/p-97f87422.entry.js.map +1 -0
  111. package/dist/nylas-web-elements/{p-9999c233.entry.js → p-aaf12216.entry.js} +2 -2
  112. package/dist/nylas-web-elements/{p-a452d4ea.entry.js → p-b55a87fa.entry.js} +2 -2
  113. package/dist/nylas-web-elements/p-b55a87fa.entry.js.map +1 -0
  114. package/dist/nylas-web-elements/{p-888d0c66.entry.js → p-c5f86111.entry.js} +2 -2
  115. package/dist/nylas-web-elements/{p-dd98c443.entry.js → p-cc6dbd73.entry.js} +2 -2
  116. package/dist/nylas-web-elements/{p-b59288fd.entry.js → p-d5a2cec8.entry.js} +2 -2
  117. package/dist/nylas-web-elements/{p-83216795.entry.js → p-deb33dfb.entry.js} +2 -2
  118. package/dist/nylas-web-elements/{p-83216795.entry.js.map → p-deb33dfb.entry.js.map} +1 -1
  119. package/dist/nylas-web-elements/{p-2531d4fa.entry.js → p-e2dc32d9.entry.js} +2 -2
  120. package/dist/nylas-web-elements/{p-a263330c.entry.js → p-eedabd6a.entry.js} +2 -2
  121. package/dist/nylas-web-elements/{p-355b34cb.entry.js → p-f57e68b1.entry.js} +2 -2
  122. package/dist/types/components/scheduler/nylas-date-picker/nylas-date-picker.d.ts +4 -0
  123. package/dist/types/components/scheduler-editor/nylas-event-capacity/nylas-event-capacity.d.ts +1 -0
  124. package/package.json +4 -5
  125. package/CHANGELOG.md +0 -878
  126. package/dist/nylas-web-elements/p-203beca4.entry.js +0 -2
  127. package/dist/nylas-web-elements/p-203beca4.entry.js.map +0 -1
  128. package/dist/nylas-web-elements/p-a452d4ea.entry.js.map +0 -1
  129. package/dist/nylas-web-elements/p-c2b6e0ca.entry.js.map +0 -1
  130. package/dist/nylas-web-elements/p-d132fbaa.entry.js +0 -2
  131. /package/dist/nylas-web-elements/{p-12bf5148.js.map → p-189b24e6.js.map} +0 -0
  132. /package/dist/nylas-web-elements/{p-fdc35ad8.entry.js.map → p-23971057.entry.js.map} +0 -0
  133. /package/dist/nylas-web-elements/{p-ba831977.entry.js.map → p-2dd05606.entry.js.map} +0 -0
  134. /package/dist/nylas-web-elements/{p-797578de.js.map → p-388c456c.js.map} +0 -0
  135. /package/dist/nylas-web-elements/{p-cf650f4f.js.map → p-3ea1c7c9.js.map} +0 -0
  136. /package/dist/nylas-web-elements/{p-de9d8218.entry.js.map → p-5f683e34.entry.js.map} +0 -0
  137. /package/dist/nylas-web-elements/{p-ec2c12a9.js.map → p-6b7fb948.js.map} +0 -0
  138. /package/dist/nylas-web-elements/{p-cfd42146.js.map → p-7477410d.js.map} +0 -0
  139. /package/dist/nylas-web-elements/{p-b62ef1be.js.map → p-7d9cdd23.js.map} +0 -0
  140. /package/dist/nylas-web-elements/{p-00577fba.entry.js.map → p-8a7a6947.entry.js.map} +0 -0
  141. /package/dist/nylas-web-elements/{p-9999c233.entry.js.map → p-aaf12216.entry.js.map} +0 -0
  142. /package/dist/nylas-web-elements/{p-888d0c66.entry.js.map → p-c5f86111.entry.js.map} +0 -0
  143. /package/dist/nylas-web-elements/{p-dd98c443.entry.js.map → p-cc6dbd73.entry.js.map} +0 -0
  144. /package/dist/nylas-web-elements/{p-b59288fd.entry.js.map → p-d5a2cec8.entry.js.map} +0 -0
  145. /package/dist/nylas-web-elements/{p-2531d4fa.entry.js.map → p-e2dc32d9.entry.js.map} +0 -0
  146. /package/dist/nylas-web-elements/{p-a263330c.entry.js.map → p-eedabd6a.entry.js.map} +0 -0
  147. /package/dist/nylas-web-elements/{p-355b34cb.entry.js.map → p-f57e68b1.entry.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as t,u as n,f as e,g as r}from"./p-ec2c12a9.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=Object.defineProperty;var u=(t,n,e)=>n in t?o(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var a=(t,n,e)=>(u(t,typeof n!="symbol"?n+"":n,e),e);var c=(t=>(t.Error="error",t.Warning="warning",t.Info="info",t.Success="success",t))(c||{});const l=t=>t!==null&&typeof t=="object"&&"error"in t;async function h(t){const n=(new TextEncoder).encode(t),e=await crypto.subtle.digest("SHA-256",n),r=Array.from(new Uint8Array(e)).map((t=>t.toString(16).padStart(2,"0"))).join("");return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}const f=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:r,d=Object.keys,p=Array.isArray;function y(t,n){return typeof n!="object"||d(n).forEach((function(e){t[e]=n[e]})),t}typeof Promise>"u"||f.Promise||(f.Promise=Promise);const v=Object.getPrototypeOf,w={}.hasOwnProperty;function g(t,n){return w.call(t,n)}function m(t,n){typeof n=="function"&&(n=n(v(t))),(typeof Reflect>"u"?d:Reflect.ownKeys)(n).forEach((e=>{k(t,e,n[e])}))}const b=Object.defineProperty;function k(t,n,e,r){b(t,n,y(e&&g(e,"get")&&typeof e.get=="function"?{get:e.get,set:e.set,configurable:!0}:{value:e,configurable:!0,writable:!0},r))}function $(t){return{from:function(n){return t.prototype=Object.create(n.prototype),k(t.prototype,"constructor",t),{extend:m.bind(null,t.prototype)}}}}const S=Object.getOwnPropertyDescriptor;function A(t,n){let e;return S(t,n)||(e=v(t))&&A(e,n)}const P=[].slice;function x(t,n,e){return P.call(t,n,e)}function C(t,n){return n(t)}function E(t){if(!t)throw new Error("Assertion Failed")}function O(t){f.setImmediate?setImmediate(t):setTimeout(t,0)}function T(t,n){return t.reduce(((t,e,r)=>{var i=n(e,r);return i&&(t[i[0]]=i[1]),t}),{})}function D(t,n){if(g(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=D(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:D(u,n.substr(o+1))}}function j(t,n,e){if(t&&n!==void 0&&(!("isFrozen"in Object)||!Object.isFrozen(t)))if(typeof n!="string"&&"length"in n){E(typeof e!="string"&&"length"in e);for(var r=0,i=n.length;r<i;++r)j(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?p(t)&&!isNaN(parseInt(o))?t.splice(o,1):delete t[o]:t[o]=e;else{var a=t[o];a&&g(t,o)||(a=t[o]={}),j(a,u,e)}}else e===void 0?p(t)&&!isNaN(parseInt(n))?t.splice(n,1):delete t[n]:t[n]=e}}function I(t){var n={};for(var e in t)g(t,e)&&(n[e]=t[e]);return n}const R=[].concat;function K(t){return R.apply([],t)}const B="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(K([8,16,32,64].map((t=>["Int","Uint","Float"].map((n=>n+t+"Array")))))).filter((t=>f[t])),_=B.map((t=>f[t]));T(B,(t=>[t,!0]));let q=null;function M(t){q=typeof WeakMap<"u"&&new WeakMap;const n=N(t);return q=null,n}function N(t){if(!t||typeof t!="object")return t;let n=q&&q.get(t);if(n)return n;if(p(t)){n=[],q&&q.set(t,n);for(var e=0,r=t.length;e<r;++e)n.push(N(t[e]))}else if(_.indexOf(t.constructor)>=0)n=t;else{const e=v(t);for(var i in n=e===Object.prototype?{}:Object.create(e),q&&q.set(t,n),t)g(t,i)&&(n[i]=N(t[i]))}return n}const{toString:F}={};function L(t){return F.call(t).slice(8,-1)}const U=typeof Symbol<"u"?Symbol.iterator:"@@iterator",V=typeof U=="symbol"?function(t){var n;return t!=null&&(n=t[U])&&n.apply(t)}:function(){return null},W={};function H(t){var n,e,r,i;if(arguments.length===1){if(p(t))return t.slice();if(this===W&&typeof t=="string")return[t];if(i=V(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 G=typeof Symbol<"u"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1;var z=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function J(t,n){z=t,Y=n}var Y=()=>!0;const Q=!new Error("").stack;function X(){if(Q)try{throw new Error}catch(t){return t}return new Error}function Z(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(Y).map((t=>`\n`+t)).join("")):""}var tt=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],nt=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(tt),et={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 rt(t,n){this._e=X(),this.name=t,this.message=n}function it(t,n){return t+". Errors: "+Object.keys(n).map((t=>n[t].toString())).filter(((t,n,e)=>e.indexOf(t)===n)).join(`\n`)}function st(t,n,e,r){this._e=X(),this.failures=n,this.failedKeys=r,this.successCount=e,this.message=it(t,n)}function ot(t,n){this._e=X(),this.name="BulkError",this.failures=Object.keys(n).map((t=>n[t])),this.failuresByPos=n,this.message=it(t,n)}$(rt).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+Z(this._e,2))}},toString:function(){return this.name+": "+this.message}}),$(st).from(rt),$(ot).from(rt);var ut=nt.reduce(((t,n)=>(t[n]=n+"Error",t)),{});const at=rt;var ct=nt.reduce(((t,n)=>{var e=n+"Error";function r(t,r){this._e=X(),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=et[n]||e,this.inner=null)}return $(r).from(at),t[n]=r,t}),{});ct.Syntax=SyntaxError,ct.Type=TypeError,ct.Range=RangeError;var lt=tt.reduce(((t,n)=>(t[n+"Error"]=ct[n],t)),{}),ht=nt.reduce(((t,n)=>(["Syntax","Type","Range"].indexOf(n)===-1&&(t[n+"Error"]=ct[n]),t)),{});function ft(){}function dt(t){return t}function pt(t,n){return t==null||t===dt?n:function(e){return n(t(e))}}function yt(t,n){return function(){t.apply(this,arguments),n.apply(this,arguments)}}function vt(t,n){return t===ft?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?yt(r,this.onsuccess):r),i&&(this.onerror=this.onerror?yt(i,this.onerror):i),s!==void 0?s:e}}function wt(t,n){return t===ft?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?yt(e,this.onsuccess):e),r&&(this.onerror=this.onerror?yt(r,this.onerror):r)}}function gt(t,n){return t===ft?n:function(e){var r=t.apply(this,arguments);y(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?yt(i,this.onsuccess):i),s&&(this.onerror=this.onerror?yt(s,this.onerror):s),r===void 0?o===void 0?void 0:o:y(r,o)}}function mt(t,n){return t===ft?n:function(){return n.apply(this,arguments)!==!1&&t.apply(this,arguments)}}function bt(t,n){return t===ft?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)}}ht.ModifyError=st,ht.DexieError=rt,ht.BulkError=ot;var kt={};const $t=100,[St,At,Pt]=typeof Promise>"u"?[]:(()=>{let t=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[t,v(t),t];const n=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[n,v(n),t]})(),xt=At&&At.then,Ct=St&&St.constructor,Et=!!Pt;var Ot=!1,Tt=Pt?()=>{Pt.then(Zt)}:f.setImmediate?setImmediate.bind(null,Zt):f.MutationObserver?()=>{var t=document.createElement("div");new MutationObserver((()=>{Zt(),t=null})).observe(t,{attributes:!0}),t.setAttribute("i","1")}:()=>{setTimeout(Zt,0)},Dt=function(t,n){Nt.push([t,n]),It&&(Tt(),It=!1)},jt=!0,It=!0,Rt=[],Kt=[],Bt=null,_t=dt,qt={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Pn,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((t=>{try{Pn(t[0],t[1])}catch{}}))}},Mt=qt,Nt=[],Ft=0,Lt=[];function Ut(t){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ft,this._lib=!1;var n=this._PSD=Mt;if(z&&(this._stackHolder=X(),this._prev=null,this._numPrev=0),typeof t!="function"){if(t!==kt)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&Gt(this,this._value))}this._state=null,this._value=null,++n.ref,Ht(this,t)}const Vt={get:function(){var t=Mt,n=ln;function e(e,r){var i=!t.global&&(t!==Mt||n!==ln);const s=i&&!pn();var o=new Ut(((n,o)=>{Jt(this,new Wt($n(e,t,i,s),$n(r,t,i,s),n,o,t))}));return z&&Xt(o,this),o}return e.prototype=kt,e},set:function(t){k(this,"then",t&&t.prototype===kt?Vt:{get:function(){return t},set:Vt.set})}};function Wt(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 Ht(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&&tn();n&&typeof n.then=="function"?Ht(t,((t,e)=>{n instanceof Ut?n._then(t,e):n.then(t,e)})):(t._state=!0,t._value=n,zt(t)),e&&nn()}}),Gt.bind(null,t))}catch(n){Gt(t,n)}}function Gt(t,n){if(Kt.push(n),t._state===null){var e=t._lib&&tn();n=_t(n),t._state=!1,t._value=n,z&&n!==null&&typeof n=="object"&&!n._promise&&function(t,n,e){try{t.apply(null,e)}catch(t){n&&n(t)}}((()=>{var e=A(n,"stack");n._promise=t,k(n,"stack",{get:()=>Ot?e&&(e.get?e.get.apply(n):e.value):t.stack})})),function(t){Rt.some((n=>n._value===t._value))||Rt.push(t)}(t),zt(t),e&&nn()}}function zt(t){var n=t._listeners;t._listeners=[];for(var e=0,r=n.length;e<r;++e)Jt(t,n[e]);var i=t._PSD;--i.ref||i.finalize(),Ft===0&&(++Ft,Dt((()=>{--Ft==0&&en()}),[]))}function Jt(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,++Ft,Dt(Yt,[e,t,n])}else t._listeners.push(n)}function Yt(t,n,e){try{Bt=n;var r,i=n._value;n._state?r=t(i):(Kt.length&&(Kt=[]),r=t(i),Kt.indexOf(i)===-1&&function(t){for(var n=Rt.length;n;)if(Rt[--n]._value===t._value)return void Rt.splice(n,1)}(n)),e.resolve(r)}catch(t){e.reject(t)}finally{Bt=null,--Ft==0&&en(),--e.psd.ref||e.psd.finalize()}}function Qt(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=Z(o,0)):(i=o,s=""),n.push(i+(s?": "+s:"")+r)}return z&&((r=Z(t._stackHolder,2))&&n.indexOf(r)===-1&&n.push(r),t._prev&&Qt(t._prev,n,e)),n}function Xt(t,n){var e=n?n._numPrev+1:0;e<100&&(t._prev=n,t._numPrev=e)}function Zt(){tn()&&nn()}function tn(){var t=jt;return jt=!1,It=!1,t}function nn(){var t,n,e;do{for(;Nt.length>0;)for(t=Nt,Nt=[],e=t.length,n=0;n<e;++n){var r=t[n];r[0].apply(null,r[1])}}while(Nt.length>0);jt=!0,It=!0}function en(){var t=Rt;Rt=[],t.forEach((t=>{t._PSD.onunhandled.call(null,t._value,t)}));for(var n=Lt.slice(0),e=n.length;e;)n[--e]()}function rn(t){return new Ut(kt,!1,t)}function sn(t,n){var e=Mt;return function(){var r=tn(),i=Mt;try{return gn(e,!0),t.apply(this,arguments)}catch(t){n&&n(t)}finally{gn(i,!1),r&&nn()}}}m(Ut.prototype,{then:Vt,_then:function(t,n){Jt(this,new Wt(null,null,t,n,Mt))},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):rn(t))):this.then(null,(t=>t&&t.name===n?e(t):rn(t)))},finally:function(t){return this.then((n=>(t(),n)),(n=>(t(),rn(n))))},stack:{get:function(){if(this._stack)return this._stack;try{Ot=!0;var t=Qt(this,[],20).join(`\nFrom previous: `);return this._state!==null&&(this._stack=t),t}finally{Ot=!1}}},timeout:function(t,n){return t<1/0?new Ut(((e,r)=>{var i=setTimeout((()=>r(new ct.Timeout(n))),t);this.then(e,r).finally(clearTimeout.bind(null,i))})):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&k(Ut.prototype,Symbol.toStringTag,"Dexie.Promise"),qt.env=mn(),m(Ut,{all:function(){var t=H.apply(null,arguments).map(yn);return new Ut((function(n,e){t.length===0&&n([]);var r=t.length;t.forEach(((i,s)=>Ut.resolve(i).then((e=>{t[s]=e,--r||n(t)}),e)))}))},resolve:t=>{if(t instanceof Ut)return t;if(t&&typeof t.then=="function")return new Ut(((n,e)=>{t.then(n,e)}));var n=new Ut(kt,!0,t);return Xt(n,Bt),n},reject:rn,race:function(){var t=H.apply(null,arguments).map(yn);return new Ut(((n,e)=>{t.map((t=>Ut.resolve(t).then(n,e)))}))},PSD:{get:()=>Mt,set:t=>Mt=t},totalEchoes:{get:()=>ln},newPSD:fn,usePSD:bn,scheduler:{get:()=>Dt,set:t=>{Dt=t}},rejectionMapper:{get:()=>_t,set:t=>{_t=t}},follow:(t,n)=>new Ut(((e,r)=>fn(((n,e)=>{var r=Mt;r.unhandleds=[],r.onunhandled=e,r.finalize=yt((function(){(function(t){function n(){t(),Lt.splice(Lt.indexOf(n),1)}Lt.push(n),++Ft,Dt((()=>{--Ft==0&&en()}),[])})((()=>{this.unhandleds.length===0?n():e(this.unhandleds[0])}))}),r.finalize),t()}),n,e,r)))}),Ct&&(Ct.allSettled&&k(Ut,"allSettled",(function(){const t=H.apply(null,arguments).map(yn);return new Ut((n=>{t.length===0&&n([]);let e=t.length;const r=new Array(e);t.forEach(((t,i)=>Ut.resolve(t).then((t=>r[i]={status:"fulfilled",value:t}),(t=>r[i]={status:"rejected",reason:t})).then((()=>--e||n(r)))))}))})),Ct.any&&typeof AggregateError<"u"&&k(Ut,"any",(function(){const t=H.apply(null,arguments).map(yn);return new Ut(((n,e)=>{t.length===0&&e(new AggregateError([]));let r=t.length;const i=new Array(r);t.forEach(((t,s)=>Ut.resolve(t).then((t=>n(t)),(t=>{i[s]=t,--r||e(new AggregateError(i))}))))}))})));const on={awaits:0,echoes:0,id:0};var un=0,an=[],cn=0,ln=0,hn=0;function fn(t,n,e,r){var i=Mt,s=Object.create(i);s.parent=i,s.ref=0,s.global=!1,s.id=++hn;var o=qt.env;s.env=Et?{Promise:Ut,PromiseProp:{value:Ut,configurable:!0,writable:!0},all:Ut.all,race:Ut.race,allSettled:Ut.allSettled,any:Ut.any,resolve:Ut.resolve,reject:Ut.reject,nthen:Sn(o.nthen,s),gthen:Sn(o.gthen,s)}:{},n&&y(s,n),++i.ref,s.finalize=function(){--this.parent.ref||this.parent.finalize()};var u=bn(s,t,e,r);return s.ref===0&&s.finalize(),u}function dn(){return on.id||(on.id=++un),++on.awaits,on.echoes+=$t,on.id}function pn(){return!!on.awaits&&(--on.awaits==0&&(on.id=0),on.echoes=on.awaits*$t,!0)}function yn(t){return on.echoes&&t&&t.constructor===Ct?(dn(),t.then((t=>(pn(),t)),(t=>(pn(),xn(t))))):t}function vn(t){++ln,on.echoes&&--on.echoes!=0||(on.echoes=on.id=0),an.push(Mt),gn(t,!0)}function wn(){var t=an[an.length-1];an.pop(),gn(t,!1)}function gn(t,n){var e=Mt;if((n?!on.echoes||cn++&&t===Mt:!cn||--cn&&t===Mt)||kn(n?vn.bind(null,t):wn),t!==Mt&&(Mt=t,e===qt&&(qt.env=mn()),Et)){var r=qt.env.Promise,i=t.env;At.then=i.nthen,r.prototype.then=i.gthen,(e.global||t.global)&&(Object.defineProperty(f,"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 mn(){var t=f.Promise;return Et?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(f,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:At.then,gthen:t.prototype.then}:{}}function bn(t,n,e,r,i){var s=Mt;try{return gn(t,!0),n(e,r,i)}finally{gn(s,!1)}}function kn(t){xt.call(St,t)}function $n(t,n,e,r){return typeof t!="function"?t:function(){var i=Mt;e&&dn(),gn(n,!0);try{return t.apply(this,arguments)}finally{gn(i,!1),r&&kn(pn)}}}function Sn(t,n){return function(e,r){return t.call(this,$n(e,n),$n(r,n))}}(""+xt).indexOf("[native code]")===-1&&(dn=pn=ft);const An="unhandledrejection";function Pn(t,n){var e;try{e=n.onuncatched(t)}catch{}if(e!==!1)try{var r,i={promise:n,reason:t};if(f.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(An,!0,!0),y(r,i)):f.CustomEvent&&y(r=new CustomEvent(An,{detail:i}),i),r&&f.dispatchEvent&&(dispatchEvent(r),!f.PromiseRejectionEvent&&f.onunhandledrejection))try{f.onunhandledrejection(r)}catch{}z&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${t.stack||t}`)}catch{}}var xn=Ut.reject;function Cn(t,n,e,r){if(t.idbdb&&(t._state.openComplete||Mt.letThrough||t._vip)){var i=t._createTransaction(n,e,t._dbSchema);try{i.create(),t._state.PR1398_maxLoop=3}catch(i){return i.name===ut.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then((()=>Cn(t,n,e,r)))):xn(i)}return i._promise(n,((t,n)=>fn((()=>(Mt.trans=i,r(t,n,i)))))).then((t=>i._completion.then((()=>t))))}if(t._state.openComplete)return xn(new ct.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return xn(new ct.DatabaseClosed);t.open().catch(ft)}return t._state.dbReadyPromise.then((()=>Cn(t,n,e,r)))}const En="3.2.4",On=String.fromCharCode(65535),Tn=-1/0,Dn="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",jn="String expected.",In=[],Rn=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Kn=Rn,Bn=Rn,_n=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),qn="__dbnames",Mn="readonly",Nn="readwrite";function Fn(t,n){return t?n?function(){return t.apply(this,arguments)&&n.apply(this,arguments)}:t:n}const Ln={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Un(t){return typeof t!="string"||/\./.test(t)?t=>t:n=>(n[t]===void 0&&t in n&&delete(n=M(n))[t],n)}class Vn{_trans(t,n,e){const r=this._tx||Mt.trans,i=this.name;function s(t,e,r){if(!r.schema[i])throw new ct.NotFound("Table "+i+" not part of transaction");return n(r.idbtrans,r)}const o=tn();try{return r&&r.db===this.db?r===Mt.trans?r._promise(t,s,e):fn((()=>r._promise(t,s,e)),{trans:r,transless:Mt.transless||Mt}):Cn(this.db,t,[this.name],s)}finally{o&&nn()}}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(p(t))return new this.db.WhereClause(this,`[${t.join("+")}]`);const n=d(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!==On)return this.where(e.name).equals(e.keyPath.map((n=>t[n])));!e&&z&&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?Fn(e,o&&o.multi?t=>{const n=D(t,i);return p(n)&&n.some((t=>s(u,t)))}:t=>s(u,D(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,p(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(g(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){y(this,t)}))}add(t,n){const{auto:e,keyPath:r}=this.schema.primKey;let i=t;return r&&e&&(i=Un(r)(t)),this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"add",keys:n!=null?[n]:null,values:[i]}))).then((t=>t.numFailures?Ut.reject(t.failures[0]):t.lastResult)).then((n=>{if(r)try{j(t,r,n)}catch{}return n}))}update(t,n){if(typeof t!="object"||p(t))return this.where(":id").equals(t).modify(n);{const e=D(t,this.schema.primKey.keyPath);if(e===void 0)return xn(new ct.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?d(n).forEach((e=>{j(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=Un(r)(t)),this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"put",values:[i],keys:n!=null?[n]:null}))).then((t=>t.numFailures?Ut.reject(t.failures[0]):t.lastResult)).then((n=>{if(r)try{j(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?Ut.reject(t.failures[0]):void 0))}clear(){return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"deleteRange",range:Ln}))).then((t=>t.numFailures?Ut.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 ct.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==t.length)throw new ct.InvalidArgument("Arguments objects and keys must have the same length");const o=t.length;let u=s&&e?t.map(Un(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 ot(`${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 ct.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==t.length)throw new ct.InvalidArgument("Arguments objects and keys must have the same length");const o=t.length;let u=s&&e?t.map(Un(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 ot(`${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 ot(`${this.name}.bulkDelete(): ${t} of ${n} operations failed`,r)}))}}function Wn(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=mt),i||(i=ft);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}d(o=t).forEach((function(t){var n=o[t];if(p(n))s(t,o[t][0],o[t][1]);else{if(n!=="asap")throw new ct.InvalidArgument("Invalid event config");var e=s(t,dt,(function(){for(var t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];e.subscribers.forEach((function(t){O((function(){t.apply(null,n)}))}))}))}}))}}function Hn(t,n){return $(n).from({prototype:t}),n}function Gn(t,n){return!(t.filter||t.algorithm||t.or)&&(n?t.justLimit:!t.replayFilter)}function zn(t,n){t.filter=Fn(t.filter,n)}function Jn(t,n,e){var r=t.replayFilter;t.replayFilter=r?()=>Fn(r(),n()):n,t.justLimit=e&&!r}function Yn(t,n){if(t.isPrimKey)return n.primaryKey;const e=n.getIndexByKeyPath(t.index);if(!e)throw new ct.Schema("KeyPath "+t.index+" on object store "+n.name+" is not indexed");return e}function Qn(t,n,e){const r=Yn(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 Xn(t,n,e,r){const i=t.replayFilter?Fn(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)),g(s,u)||(s[u]=!0,n(t,e,r))}};return Promise.all([t.or._iterate(o,e),Zn(Qn(t,r,e),t.algorithm,o,!t.keysOnly&&t.valueMapper)])}return Zn(Qn(t,r,e),Fn(t.algorithm,i),n,!t.keysOnly&&t.valueMapper)}function Zn(t,n,e,r){var i=sn(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=ft}),(n=>{t.fail(n),e=ft}))||i(t.value,t,(t=>e=t)),e()}))}))}function te(t,n){try{const e=ne(t),r=ne(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}(ee(t),ee(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=te(t[e],n[e]);if(r!==0)return r}return e===r?0:e<r?-1:1}(t,n)}}catch{}return NaN}function ne(t){const n=typeof t;if(n!=="object")return n;if(ArrayBuffer.isView(t))return"binary";const e=L(t);return e==="ArrayBuffer"?"binary":e}function ee(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)}class re{_read(t,n){var e=this._ctx;return e.error?e.table._trans(null,xn.bind(null,e.error)):e.table._trans("readonly",t).then(n)}_write(t){var n=this._ctx;return n.error?n.table._trans(null,xn.bind(null,n.error)):n.table._trans("readwrite",t,"locked")}_addAlgorithm(t){var n=this._ctx;n.algorithm=Fn(n.algorithm,t)}_iterate(t,n){return Xn(this._ctx,t,n,this._ctx.table.core)}clone(t){var n=Object.create(this.constructor.prototype),e=Object.create(this._ctx);return t&&y(e,t),n._ctx=e,n}raw(){return this._ctx.valueMapper=null,this}each(t){var n=this._ctx;return this._read((e=>Xn(n,t,e,n.table.core)))}count(t){return this._read((t=>{const n=this._ctx,e=n.table.core;if(Gn(n,!0))return e.count({trans:t,query:{index:Yn(n,e.schema),range:n.range}}).then((t=>Math.min(t,n.limit)));var r=0;return Xn(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"&&Gn(n,!0)&&n.limit>0){const{valueMapper:e}=n,r=Yn(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 Xn(n,(t=>e.push(t)),t,n.table.core).then((()=>e))}}),t)}offset(t){var n=this._ctx;return t<=0||(n.offset+=t,Gn(n)?Jn(n,(()=>{var n=t;return(t,e)=>n===0||(n===1?(--n,!1):(e((()=>{t.advance(n),n=0})),!1))})):Jn(n,(()=>{var n=t;return()=>--n<0}))),this}limit(t){return this._ctx.limit=Math.min(this._ctx.limit,t),Jn(this._ctx,(()=>{var n=t;return function(t,e,r){return--n<=0&&e(r),n>=0}}),!0),this}until(t,n){return zn(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 zn(this._ctx,(function(n){return t(n.value)})),n=this._ctx,e=t,n.isMatch=Fn(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"&&Gn(n,!0)&&n.limit>0)return this._read((t=>{var e=Yn(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 zn(this._ctx,(function(t){var n=t.primaryKey.toString(),r=g(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=d(t),s=i.length;r=function(n){for(var e=!1,r=0;r<s;++r){var o=i[r],u=t[o];D(n,o)!==u&&(j(n,o,u),e=!0)}return e}}const o=n.table.core,{outbound:u,extractKey:a}=o.schema.primaryKey,c=this.db._options.modifyChunkSize||200,l=[];let h=0;const f=[],p=(t,n)=>{const{failures:e,numFailures:r}=n;h+=t-r;for(let t of d(e))l.push(e[t])};return this.clone().primaryKeys().then((i=>{const s=l=>{const h=Math.min(c,i.length-l);return o.getMany({trans:e,keys:i.slice(l,l+h),cache:"immutable"}).then((f=>{const d=[],y=[],v=u?[]:null,w=[];for(let t=0;t<h;++t){const n=f[t],e={value:M(n),primKey:i[l+t]};r.call(e,e.value,e)!==!1&&(e.value==null?w.push(i[l+t]):u||te(a(n),a(e.value))===0?(y.push(e.value),u&&v.push(i[l+t])):(w.push(i[l+t]),d.push(e.value)))}const g=Gn(n)&&n.limit===1/0&&(typeof t!="function"||t===ie)&&{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)w.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((()=>(w.length>0||g&&t===ie)&&o.mutate({trans:e,type:"delete",keys:w,criteria:g}).then((t=>p(w.length,t))))).then((()=>i.length>l+h&&s(l+c)))}))};return s(0).then((()=>{if(l.length>0)throw new st("Error modifying one or more objects",l,h,f);return i.length}))}))}))}delete(){var t=this._ctx,n=t.range;return Gn(t)&&(t.isPrimKey&&!Bn||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 st("Could not delete some values",Object.keys(t).map((n=>t[n])),n-i);return n-i}))))})):this.modify(ie)}}const ie=(t,n)=>n.value=null;function se(t,n){return t<n?-1:t===n?0:1}function oe(t,n){return t>n?-1:t===n?0:1}function ue(t,n,e){var r=t instanceof de?new t.Collection(t):t;return r._ctx.error=e?new e(n):new TypeError(n),r}function ae(t){return new t.Collection(t,(()=>fe(""))).limit(0)}function ce(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 le(t,n,e,r){var i,s,o,u,a,c,l,h=e.length;if(!e.every((t=>typeof t=="string")))return ue(t,jn);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"?se:oe;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,(()=>he(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=ce(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 he(t,n,e,r){return{type:2,lower:t,upper:n,lowerOpen:e,upperOpen:r}}function fe(t){return{type:1,lower:t,upper:t}}class de{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)?ae(this):new this.Collection(this,(()=>he(t,n,!e,!r)))}catch{return ue(this,Dn)}}equals(t){return t==null?ue(this,Dn):new this.Collection(this,(()=>fe(t)))}above(t){return t==null?ue(this,Dn):new this.Collection(this,(()=>he(t,void 0,!0)))}aboveOrEqual(t){return t==null?ue(this,Dn):new this.Collection(this,(()=>he(t,void 0,!1)))}below(t){return t==null?ue(this,Dn):new this.Collection(this,(()=>he(void 0,t,!1,!0)))}belowOrEqual(t){return t==null?ue(this,Dn):new this.Collection(this,(()=>he(void 0,t)))}startsWith(t){return typeof t!="string"?ue(this,jn):this.between(t,t+On,!0,!0)}startsWithIgnoreCase(t){return t===""?this.startsWith(t):le(this,((t,n)=>t.indexOf(n[0])===0),[t],On)}equalsIgnoreCase(t){return le(this,((t,n)=>t===n[0]),[t],"")}anyOfIgnoreCase(){var t=H.apply(W,arguments);return t.length===0?ae(this):le(this,((t,n)=>n.indexOf(t)!==-1),t,"")}startsWithAnyOfIgnoreCase(){var t=H.apply(W,arguments);return t.length===0?ae(this):le(this,((t,n)=>n.some((n=>t.indexOf(n)===0))),t,On)}anyOf(){const t=H.apply(W,arguments);let n=this._cmp;try{t.sort(n)}catch{return ue(this,Dn)}if(t.length===0)return ae(this);const e=new this.Collection(this,(()=>he(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([[Tn,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const t=H.apply(W,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return ue(this,Dn)}const n=t.reduce(((t,n)=>t?t.concat([[t[t.length-1][1],n]]):[[Tn,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 ae(this);if(!t.every((t=>t[0]!==void 0&&t[1]!==void 0&&r(t[0],t[1])<=0)))return ue(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",ct.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 ue(this,Dn)}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,(()=>he(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=H.apply(W,arguments);return t.every((t=>typeof t=="string"))?t.length===0?ae(this):this.inAnyRange(t.map((t=>[t,t+On]))):ue(this,"startsWithAnyOf() only works with strings")}}function pe(t){return sn((function(n){return ye(n),t(n.target.error),!1}))}function ye(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}const ve="storagemutated",we="x-storagemutated-1",ge=Wn(null,ve);class me{_lock(){return E(!Mt.global),++this._reculock,this._reculock!==1||Mt.global||(Mt.lockOwnerFor=this),this}_unlock(){if(E(!Mt.global),--this._reculock==0)for(Mt.global||(Mt.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{bn(t[1],t[0])}catch{}}return this}_locked(){return this._reculock&&Mt.lockOwnerFor!==this}create(t){if(!this.mode)return this;const n=this.db.idbdb,e=this.db._state.dbOpenError;if(E(!this.idbtrans),!t&&!n)switch(e&&e.name){case"DatabaseClosedError":throw new ct.DatabaseClosed(e);case"MissingAPIError":throw new ct.MissingAPI(e.message,e);default:throw new ct.OpenFailed(e)}if(!this.active)throw new ct.TransactionInactive;return E(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=sn((n=>{ye(n),this._reject(t.error)})),t.onabort=sn((n=>{ye(n),this.active&&this._reject(new ct.Abort(t.error)),this.active=!1,this.on("abort").fire(n)})),t.oncomplete=sn((()=>{this.active=!1,this._resolve(),"mutatedParts"in t&&ge.storagemutated.fire(t.mutatedParts)})),this}_promise(t,n,e){if(t==="readwrite"&&this.mode!=="readwrite")return xn(new ct.ReadOnly("Transaction is readonly"));if(!this.active)return xn(new ct.TransactionInactive);if(this._locked())return new Ut(((r,i)=>{this._blockedFuncs.push([()=>{this._promise(t,n,e).then(r,i)},Mt])}));if(e)return fn((()=>{var t=new Ut(((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 Ut(((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=Ut.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 Ut(((t,r)=>{e.then((e=>n._waitingQueue.push(sn(t.bind(null,e)))),(t=>n._waitingQueue.push(sn(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 ct.Abort))}table(t){const n=this._memoizedTables||(this._memoizedTables={});if(g(n,t))return n[t];const e=this.schema[t];if(!e)throw new ct.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 be(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?"++":"")+ke(n)}}function ke(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function $e(t,n,e){return{name:t,primKey:n,indexes:e,mappedClass:null,idxByName:T(e,(t=>[t.name,t]))}}let Se=t=>{try{return t.only([[]]),Se=()=>[[]],[[]]}catch{return Se=()=>On,On}};function Ae(t){return t==null?()=>{}:typeof t=="string"?function(t){return t.split(".").length===1?n=>n[t]:n=>D(n,t)}(t):n=>D(n,t)}function Pe(t){return[].slice.call(t)}let xe=0;function Ce(t){return t==null?":id":typeof t=="string"?t:`[${t.join("+")}]`}function Ee(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=Pe(t.objectStoreNames);return{schema:{name:t.name,tables:e.map((t=>n.objectStore(t))).map((t=>{const{keyPath:n,autoIncrement:e}=t,r=p(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:Ae(n)},indexes:Pe(t.indexNames).map((n=>t.index(n))).map((t=>{const{name:n,unique:e,multiEntry:r,keyPath:i}=t,o={name:n,compound:p(i),keyPath:i,unique:e,multiEntry:r,extractKey:Ae(i)};return s[Ce(i)]=o,o})),getIndexByKeyPath:t=>s[Ce(t)]};return s[":id"]=o.primaryKey,n!=null&&(s[Ce(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=sn(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 w=t=>{++v,ye(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=w;else for(let n=0;n<f;++n)p.push(d=c[e](t[n])),d.onerror=w}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=>{w(t),g(t)},d.onsuccess=g}))},getMany:({trans:t,keys:e})=>new Promise(((r,i)=>{r=sn(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=pe(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=sn(r);const s=t.objectStore(n).get(e);s.onsuccess=t=>r(t.target.result),s.onerror=pe(i)})),query:function(t){return e=>new Promise(((i,s)=>{i=sn(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=pe(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=pe(s)}}))}(s),openCursor:function({trans:t,values:e,query:i,reverse:s,unique:o}){return new Promise(((u,a)=>{u=sn(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=pe(a),p.onsuccess=sn((n=>{const e=p.result;if(!e)return void u(null);e.___id=++xe,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=sn(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=sn(t),p.onerror=pe(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=sn((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=sn((n=>t(n.target.result))),l.onerror=pe(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:Se(n),schema:i}}function Oe({_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)}(Ee(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 Te({_novip:t},n,e,r){e.forEach((e=>{const i=r[e];n.forEach((n=>{const r=A(n,e);(!r||"value"in r&&r.value===void 0)&&(n===t.Transaction.prototype||n instanceof t.Transaction?k(n,e,{get(){return this.table(e)},set(t){b(this,e,{value:t,writable:!0,configurable:!0,enumerable:!0})}}):n[e]=new t.Table(e,i))}))}))}function De({_novip:t},n){n.forEach((n=>{for(let e in n)n[e]instanceof t.Table&&delete n[e]}))}function je(t,n){return t._cfg.version-n._cfg.version}function Ie(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=Mt.transless||Mt;fn((()=>{Mt.trans=s,Mt.transless=u,n===0?(d(i).forEach((t=>{Ke(e,t,i[t].primKey,i[t].indexes)})),Oe(t,e),Ut.follow((()=>t.on.populate.fire(s))).catch(o)):function({_novip:t},n,e,r){const i=[],s=t._versions;let o=t._dbSchema=_e(t,t.idbdb,r),u=!1;const a=s.filter((t=>t._cfg.version>=n));function c(){return i.length?Ut.resolve(i.shift()(e.idbtrans)).then(c):Ut.resolve()}return a.forEach((s=>{i.push((()=>{const i=o,a=s._cfg.dbschema;qe(t,i,r),qe(t,a,r),o=t._dbSchema=a;const c=Re(i,a);c.add.forEach((t=>{Ke(r,t[0],t[1].primKey,t[1].indexes)})),c.change.forEach((t=>{if(t.recreate)throw new ct.Upgrade("Not yet support for changing primary key");{const n=r.objectStore(t.name);t.add.forEach((t=>Be(n,t))),t.change.forEach((t=>{n.deleteIndex(t.name),Be(n,t)})),t.del.forEach((t=>n.deleteIndex(t)))}}));const l=s._cfg.contentUpgrade;if(l&&s._cfg.version>n){Oe(t,r),e._memoizedTables={},u=!0;let n=I(a);c.del.forEach((t=>{n[t]=i[t]})),De(t,[t.Transaction.prototype]),Te(t,[t.Transaction.prototype],d(n),n),e.schema=n;const s=G(l);let o;s&&dn();const h=Ut.follow((()=>{if(o=l(e),o&&s){var t=pn.bind(null,null);o.then(t,t)}}));return o&&typeof o.then=="function"?Ut.resolve(o):h.then((()=>o))}})),i.push((n=>{(!u||!Kn)&&function(t,n){[].slice.call(n.db.objectStoreNames).forEach((e=>t[e]==null&&n.db.deleteObjectStore(e)))}(s._cfg.dbschema,n),De(t,[t.Transaction.prototype]),Te(t,[t.Transaction.prototype],t._storeNames,t._dbSchema),e.schema=t._dbSchema}))})),c().then((()=>{var t,n;n=r,d(t=o).forEach((e=>{n.db.objectStoreNames.contains(e)||Ke(n,e,t[e].primKey,t[e].indexes)}))}))}(t,n,s,e).catch(o)}))}function Re(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&&!Rn)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 Ke(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=>Be(i,t))),i}function Be(t,n){t.createIndex(n.name,n.keyPath,{unique:n.unique,multiEntry:n.multi})}function _e(t,n,e){const r={};return x(n.objectStoreNames,0).forEach((t=>{const n=e.objectStore(t);let i=n.keyPath;const s=be(ke(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=be(e.name,i,!!e.unique,!!e.multiEntry,!1,i&&typeof i!="string",!1);o.push(u)}r[t]=$e(t,s,o)})),r}function qe({_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:"["+x(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)&&f.WorkerGlobalScope&&f instanceof f.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(t._hasGetAll=!1)}class Me{_parseStoresSpec(t,n){d(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 be(e,r||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),p(r),n===0)})),i=r.shift();if(i.multi)throw new ct.Schema("Primary key cannot be multi-valued");r.forEach((t=>{if(t.auto)throw new ct.Schema("Only primary key can be marked as autoIncrement (++)");if(!t.keyPath)throw new ct.Schema("Index must have a name and cannot be an empty string")})),n[e]=$e(e,i,r)}}))}stores(t){const n=this.db;this._cfg.storesSource=this._cfg.storesSource?y(this._cfg.storesSource,t):t;const e=n._versions,r={};let i={};return e.forEach((t=>{y(r,t._cfg.storesSource),i=t._cfg.dbschema={},t._parseStoresSpec(r,i)})),n._dbSchema=i,De(n,[n._allTables,n,n.Transaction.prototype]),Te(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],d(i),i),n._storeNames=d(i),this}upgrade(t){return this._cfg.contentUpgrade=bt(this._cfg.contentUpgrade||ft,t),this}}function Ne(t,n){let e=t._dbNamesDB;return e||(e=t._dbNamesDB=new cr(qn,{addons:[],indexedDB:t,IDBKeyRange:n}),e.version(1).stores({dbnames:"name"})),e.table("dbnames")}function Fe(t){return t&&typeof t.databases=="function"}function Le(t){return fn((function(){return Mt.letThrough=!0,t()}))}function Ue(){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 Ve(t){const n=t._state,{indexedDB:e}=t._deps;if(n.isBeingOpened||t.idbdb)return n.dbReadyPromise.then((()=>n.dbOpenError?xn(n.dbOpenError):t));z&&(n.openCanceller._stackHolder=X()),n.isBeingOpened=!0,n.dbOpenError=null,n.openComplete=!1;const r=n.openCanceller;function i(){if(n.openCanceller!==r)throw new ct.DatabaseClosed("db.open() was cancelled")}let s=n.dbReadyResolve,o=null,u=!1;return Ut.race([r,(typeof navigator>"u"?Ut.resolve():Ue()).then((()=>new Ut(((r,s)=>{if(i(),!e)throw new ct.MissingAPI;const a=t.name,c=n.autoSchema?e.open(a):e.open(a,Math.round(10*t.verno));if(!c)throw new ct.MissingAPI;c.onerror=pe(s),c.onblocked=sn(t._fireOnBlocked),c.onupgradeneeded=sn((r=>{if(o=c.transaction,n.autoSchema&&!t._options.allowEmptyDB){c.onerror=ye,o.abort(),c.result.close();const t=e.deleteDatabase(a);t.onsuccess=t.onerror=sn((()=>{s(new ct.NoSuchDatabase(`Database ${a} doesnt exist`))}))}else{o.onerror=pe(s);var i=r.oldVersion>Math.pow(2,62)?0:r.oldVersion;u=i<1,t._novip.idbdb=c.result,Ie(t,i/10,o,s)}}),s),c.onsuccess=sn((()=>{o=null;const e=t._novip.idbdb=c.result,i=x(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=_e(0,n,e);t._storeNames=x(n.objectStoreNames,0),Te(t,[t._allTables],d(r),r)}(t,e,r):(qe(t,t._dbSchema,r),function(t,n){const e=Re(_e(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.")),Oe(t,r)}catch{}var s;In.push(t),e.onversionchange=sn((e=>{n.vcFired=!0,t.on("versionchange").fire(e)})),e.onclose=sn((n=>{t.on("close").fire(n)})),u&&function({indexedDB:t,IDBKeyRange:n},e){!Fe(t)&&e!==qn&&Ne(t,n).put({name:e}).catch(ft)}(t._deps,a),r()}),s)}))))]).then((()=>(i(),n.onReadyBeingFired=[],Ut.resolve(Le((()=>t.on.ready.fire(t.vip)))).then((function e(){if(n.onReadyBeingFired.length>0){let r=n.onReadyBeingFired.reduce(bt,ft);return n.onReadyBeingFired=[],Ut.resolve(Le((()=>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(),xn(e)})).finally((()=>{n.openComplete=!0,s()}))}function We(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):p(s)?Promise.all(s).then(e,r):e(s)}}return i(n)()}function He(t,n,e){var r=arguments.length;if(r<2)throw new ct.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];return e=i.pop(),[t,K(i),e]}function Ge(t,n,e,r,i){return Ut.resolve().then((()=>{const s=Mt.transless||Mt,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===ut.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then((()=>Ge(t,n,e,null,i)))):xn(r)}const a=G(i);let c;a&&dn();const l=Ut.follow((()=>{if(c=i.call(o,o),c)if(a){var t=pn.bind(null,null);c.then(t,t)}else typeof c.next=="function"&&typeof c.throw=="function"&&(c=We(c))}),u);return(c&&typeof c.then=="function"?Ut.resolve(c).then((t=>o.active?t:xn(new ct.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),xn(t))))}))}function ze(t,n,e){const r=p(t)?t.slice():[t];for(let t=0;t<e;++t)r.push(n);return r}const Je={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=Ce(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:Ae(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:ze(r.lower,r.lowerOpen?t.MAX_KEY:t.MIN_KEY,i),lowerOpen:!0,upper:ze(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[Ce(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(ze(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(ze(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 Ye(t,n,e,r){return e=e||{},r=r||"",d(t).forEach((i=>{if(g(n,i)){var s=t[i],o=n[i];if(typeof s=="object"&&typeof o=="object"&&s&&o){const t=L(s);t!==L(o)?e[r+i]=n[i]:t==="Object"?Ye(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})),d(n).forEach((i=>{g(t,i)||(e[r+i]=n[i])})),e}const Qe={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=Mt.trans,{deleting:s,creating:o,updating:u}=i.table(n).hook;switch(t.type){case"add":if(o.fire===ft)break;return i._promise("readwrite",(()=>a(t)),!0);case"put":if(o.fire===ft&&u.fire===ft)break;return i._promise("readwrite",(()=>a(t)),!0);case"delete":if(s.fire===ft)break;return i._promise("readwrite",(()=>a(t)),!0);case"deleteRange":if(s.fire===ft)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=Mt.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||j(t.values[i],r.keyPath,e))}else{const r=Ye(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=>{g(n,t)?n[t]=s[t]:j(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 Xe(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)te(n.keys[i],t[s])===0&&(r.push(e?M(n.values[i]):n.values[i]),++s);return r.length===t.length?r:null}catch{return null}}const Ze={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=Xe(t.keys,t.trans._cache,t.cache==="clone");return n?Ut.resolve(n):e.getMany(t).then((n=>(t.trans._cache={keys:t.keys,values:t.cache==="clone"?M(n):n},n)))},mutate:t=>(t.type!=="add"&&(t.trans._cache=null),e.mutate(t))}}})};function tr(t){return!("from"in t)}const nr=function(t,n){if(!this){const n=new nr;return t&&"d"in t&&y(n,t),n}y(this,arguments.length?{d:1,from:t,to:arguments.length>1?n:t}:{d:0})};function er(t,n,e){const r=te(n,e);if(isNaN(r))return;if(r>0)throw RangeError();if(tr(t))return y(t,{from:n,to:e,d:1});const i=t.l,s=t.r;if(te(e,t.from)<0)return i?er(i,n,e):t.l={from:n,to:e,d:1,l:null,r:null},or(t);if(te(n,t.to)>0)return s?er(s,n,e):t.r={from:n,to:e,d:1,l:null,r:null},or(t);te(n,t.from)<0&&(t.from=n,t.l=null,t.d=s?s.d+1:1),te(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&&rr(t,i),s&&o&&rr(t,s)}function rr(t,n){tr(n)||function t(n,{from:e,to:r,l:i,r:s}){er(n,e,r),i&&t(n,i),s&&t(n,s)}(t,n)}function ir(t,n){const e=sr(n);let r=e.next();if(r.done)return!1;let i=r.value;const s=sr(t);let o=s.next(i.from),u=o.value;for(;!r.done&&!o.done;){if(te(u.from,i.to)<=0&&te(u.to,i.from)>=0)return!0;te(i.from,u.from)<0?i=(r=e.next(u.from)).value:u=(o=s.next(i.from)).value}return!1}function sr(t){let n=tr(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&&te(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||te(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 or(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=ur(e)}t.d=ur(t)}function ur({r:t,l:n}){return(t?n?Math.max(t.d,n.d):t.d:n?n.d:0)+1}m(nr.prototype,{add(t){return rr(this,t),this},addKey(t){return er(this,t,t),this},addKeys(t){return t.forEach((t=>er(this,t,t))),this},[U](){return sr(this)}});const ar={stack:"dbcore",level:0,create:t=>{const n=t.schema.name,e=new nr(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,c={...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 nr)},c=a(""),l=a(":dels"),{type:h}=t;let[f,d]=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(p(f)){h!=="delete"&&(f=t.results),c.addKeys(f);const n=Xe(f,y);n||h==="add"||l.addKeys(f),(n||d)&&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&&p(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]);te(i,u)!==0&&(i!=null&&o(i),u!=null&&o(u))}))}n.indexes.forEach(i)}(a,s,n,d)}else if(f){const t={from:f.lower,to:f.upper};l.add(t),c.add(t)}else c.add(e),l.add(e),s.indexes.forEach((t=>a(t.name).add(e)));return t}))}},l=({query:{index:n,range:e}})=>{var r,i;return[n,new nr((r=e.lower)!==null&&r!==void 0?r:t.MIN_KEY,(i=e.upper)!==null&&i!==void 0?i:t.MAX_KEY)]},h={get:t=>[o,new nr(t.key)],getMany:t=>[o,(new nr).addKeys(t.keys)],count:l,query:l,openCursor:l};return d(h).forEach((t=>{c[t]=function(s){const{subscr:o}=Mt;if(o){const c=t=>{const e=`idb://${n}/${r}/${t}`;return o[e]||(o[e]=new nr)},l=c(""),f=c(":dels"),[d,p]=h[t](s);if(c(d.name||"").add(p),!d.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):f.addKeys(t)}else if(t==="openCursor"){const t=e,n=s.values;return t&&Object.create(t,{key:{get:()=>(f.addKey(t.primaryKey),t.key)},primaryKey:{get(){const n=t.primaryKey;return f.addKey(n),n}},value:{get:()=>(n&&l.addKey(t.primaryKey),t.value)}})}return e}))}f.add(e)}}return i[t].apply(this,arguments)}})),c}}}};class cr{constructor(t,n){this._middlewares={},this.verno=0;const e=cr.dependencies;this._options=n={addons:cr.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:ft,dbReadyPromise:null,cancelOpen:ft,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var s;i.dbReadyPromise=new Ut((t=>{i.dbReadyResolve=t})),i.openCanceller=new Ut(((t,n)=>{i.cancelOpen=n})),this._state=i,this.name=t,this.on=Wn(this,"populate","blocked","versionchange","close",{ready:[bt,ft]}),this.on.ready.subscribe=C(this.on.ready.subscribe,(t=>(n,e)=>{cr.vip((()=>{const r=this._state;if(r.openComplete)r.dbOpenError||Ut.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,Hn(re.prototype,(function(t,n){this.db=s;let e=Ln,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!==dt?u:null}}))),this.Table=function(t){return Hn(Vn.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:Wn(null,{creating:[vt,ft],reading:[pt,dt],updating:[gt,ft],deleting:[wt,ft]})}))}(this),this.Transaction=function(t){return Hn(me.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=Wn(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 Ut(((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(),xn(t)}))}))}(this),this.Version=function(t){return Hn(Me.prototype,(function(n){this.db=t,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}(this),this.WhereClause=function(t){return Hn(de.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 ct.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=Se(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),In.filter((t=>t.name===this.name&&t!==this&&!t._state.vcFired)).map((n=>n.on("versionchange").fire(t)))},this.use(Je),this.use(Qe),this.use(ar),this.use(Ze),this.vip=Object.create(this,{_vip:{value:!0}}),r.forEach((t=>t(this)))}version(t){if(isNaN(t)||t<.1)throw new ct.Type("Given version is not a positive number");if(t=Math.round(10*t)/10,this.idbdb||this._state.isBeingOpened)throw new ct.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(je),e.stores({}),this._state.autoSchema=!1,e)}_whenReady(t){return this.idbdb&&(this._state.openComplete||Mt.letThrough||this._vip)?t():new Ut(((t,n)=>{if(this._state.openComplete)return n(new ct.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void n(new ct.DatabaseClosed);this.open().catch(ft)}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 Ve(this)}_close(){const t=this._state,n=In.indexOf(this);if(n>=0&&In.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}t.dbReadyPromise=new Ut((n=>{t.dbReadyResolve=n})),t.openCanceller=new Ut(((n,e)=>{t.cancelOpen=e}))}close(){this._close();const t=this._state;this._options.autoOpen=!1,t.dbOpenError=new ct.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError)}delete(){const t=arguments.length>0,n=this._state;return new Ut(((e,r)=>{const i=()=>{this.close();var t=this._deps.indexedDB.deleteDatabase(this.name);t.onsuccess=sn((()=>{(function({indexedDB:t,IDBKeyRange:n},e){!Fe(t)&&e!==qn&&Ne(t,n).delete(e).catch(ft)})(this._deps,this.name),e()})),t.onerror=pe(r),t.onblocked=this._fireOnBlocked};if(t)throw new ct.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 d(this._allTables).map((t=>this._allTables[t]))}transaction(){const t=He.apply(this,arguments);return this._transaction.apply(this,t)}_transaction(t,n,e){let r=Mt.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===Mn)s=Mn;else{if(t!="rw"&&t!=Nn)throw new ct.InvalidArgument("Invalid transaction mode: "+t);s=Nn}if(r){if(r.mode===Mn&&s===Nn){if(!i)throw new ct.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 ct.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)})):xn(t)}const u=Ge.bind(null,this,s,o,r,e);return r?r._promise(s,u,"lock"):Mt.trans?bn(Mt.transless,(()=>this._whenReady(u))):this._whenReady(u)}table(t){if(!g(this._allTables,t))throw new ct.InvalidTable(`Table ${t} does not exist`);return this._allTables[t]}}const lr=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable";class hr{constructor(t){this._subscribe=t}subscribe(t,n,e){return this._subscribe(t&&typeof t!="function"?t:{next:t,error:n,complete:e})}[lr](){return this}}function fr(t,n){return d(n).forEach((e=>{rr(t[e]||(t[e]=new nr),n[e])})),t}function dr(t){let n,e=!1;const r=new hr((r=>{const i=G(t);let s=!1,o={},u={};const a={get closed(){return s},unsubscribe:()=>{s=!0,ge.storagemutated.unsubscribe(f)}};r.start&&r.start(a);let c=!1,l=!1;function h(){return d(u).some((t=>o[t]&&ir(o[t],u[t])))}const f=t=>{fr(o,t),h()&&p()},p=()=>{if(c||s)return;o={};const d={},y=function(n){i&&dn();const e=()=>fn(t,{subscr:n,trans:null}),r=Mt.trans?bn(Mt.transless,e):e();return i&&r.then(pn,pn),r}(d);l||(ge(ve,f),l=!0),c=!0,Promise.resolve(y).then((t=>{e=!0,n=t,c=!1,s||(h()?p():(o={},u=d,r.next&&r.next(t)))}),(t=>{c=!1,e=!1,r.error&&r.error(t),a.unsubscribe()}))};return p(),a}));return r.hasValue=()=>e,r.getValue=()=>n,r}let pr;try{pr={indexedDB:f.indexedDB||f.mozIndexedDB||f.webkitIndexedDB||f.msIndexedDB,IDBKeyRange:f.IDBKeyRange||f.webkitIDBKeyRange}}catch{pr={indexedDB:null,IDBKeyRange:null}}const yr=cr;function vr(t){let n=wr;try{wr=!0,ge.storagemutated.fire(t)}finally{wr=n}}m(yr,{...ht,delete:t=>new yr(t,{addons:[]}).delete(),exists:t=>new yr(t,{addons:[]}).open().then((t=>(t.close(),!0))).catch("NoSuchDatabaseError",(()=>!1)),getDatabaseNames(t){try{return function({indexedDB:t,IDBKeyRange:n}){return Fe(t)?Promise.resolve(t.databases()).then((t=>t.map((t=>t.name)).filter((t=>t!==qn)))):Ne(t,n).toCollection().primaryKeys()}(yr.dependencies).then(t)}catch{return xn(new ct.MissingAPI)}},defineClass:()=>function(t){y(this,t)},ignoreTransaction:t=>Mt.trans?bn(Mt.transless,t):t(),vip:Le,async:function(t){return function(){try{var n=We(t.apply(this,arguments));return n&&typeof n.then=="function"?n:Ut.resolve(n)}catch(t){return xn(t)}}},spawn:function(t,n,e){try{var r=We(t.apply(e,n||[]));return r&&typeof r.then=="function"?r:Ut.resolve(r)}catch(t){return xn(t)}},currentTransaction:{get:()=>Mt.trans||null},waitFor:function(t,n){const e=Ut.resolve(typeof t=="function"?yr.ignoreTransaction(t):t).timeout(n||6e4);return Mt.trans?Mt.trans.waitFor(e):e},Promise:Ut,debug:{get:()=>z,set:t=>{J(t,t==="dexie"?()=>!0:_n)}},derive:$,extend:y,props:m,override:C,Events:Wn,on:ge,liveQuery:dr,extendObservabilitySet:fr,getByKeyPath:D,setByKeyPath:j,delByKeyPath:function(t,n){typeof n=="string"?j(t,n,void 0):"length"in n&&[].map.call(n,(function(n){j(t,n,void 0)}))},shallowClone:I,deepClone:M,getObjectDiff:Ye,cmp:te,asap:O,minKey:Tn,addons:[],connections:In,errnames:ut,dependencies:pr,semVer:En,version:En.split(".").map((t=>parseInt(t))).reduce(((t,n,e)=>t+n/Math.pow(10,2*e)))}),yr.maxKey=Se(yr.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(ge(ve,(t=>{if(!wr){let n;Rn?(n=document.createEvent("CustomEvent"),n.initCustomEvent(we,!0,!0,t)):n=new CustomEvent(we,{detail:t}),wr=!0,dispatchEvent(n),wr=!1}})),addEventListener(we,(({detail:t})=>{wr||vr(t)})));let wr=!1;if(typeof BroadcastChannel<"u"){const t=new BroadcastChannel(we);typeof t.unref=="function"&&t.unref(),ge(ve,(n=>{wr||t.postMessage(n)})),t.onmessage=t=>{t.data&&vr(t.data)}}else if(typeof self<"u"&&typeof navigator<"u"){ge(ve,(t=>{try{wr||(typeof localStorage<"u"&&localStorage.setItem(we,JSON.stringify({trig:Math.random(),changedParts:t})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach((n=>n.postMessage({type:we,changedParts:t}))))}catch{}})),typeof addEventListener<"u"&&addEventListener("storage",(t=>{if(t.key===we){const n=JSON.parse(t.newValue);n&&vr(n.changedParts)}}));const t=self.document&&navigator.serviceWorker;t&&t.addEventListener("message",(function({data:t}){t&&t.type===we&&vr(t.changedParts)}))}Ut.rejectionMapper=function(t,n){if(!t||t instanceof rt||t instanceof TypeError||t instanceof SyntaxError||!t.name||!lt[t.name])return t;var e=new lt[t.name](n||t.message,t);return"stack"in t&&k(e,"stack",{get:function(){return this.inner.stack}}),e},J(z,_n);class gr extends cr{constructor(){super("NylasAuthDatabase");a(this,"grant");a(this,"pkce");this.version(1).stores({grant:"++id,token",pkce:"++id,codeVerifier"}),this.grant=this.table("grant"),this.pkce=this.table("pkce")}}class mr{constructor(){a(this,"theDB");this.theDB=new gr}async setCodeVerifier(t){await this.theDB.pkce.put({id:1,codeVerifier:t},1)}async getCodeVerifier(){const[t]=await this.theDB.pkce.toArray();return t?t.codeVerifier:null}async getTokenInfo(){const t=await this.theDB.grant.get(1);return t?t.token:null}async setTokenInfo(t){await this.theDB.grant.put({id:1,token:t},1)}async reset(){await this.theDB.grant.clear()}}function br(t){const n="NylasAuth";if(!t)throw new Error("NylasAuth requires a config object");let e=null;if(t.storageType==="indexeddb"&&(e=new mr),!e)throw new Error("NylasAuth requires a storage object");const r=[{type:"read-only",value:"https://www.googleapis.com/auth/gmail.readonly"},{type:"modify",value:"https://www.googleapis.com/auth/gmail.modify"},{type:"compose",value:"https://www.googleapis.com/auth/gmail.compose"},{type:"insert",value:"https://www.googleapis.com/auth/gmail.insert"},{type:"labels",value:"https://www.googleapis.com/auth/gmail.labels"},{type:"metadata",value:"https://www.googleapis.com/auth/gmail.metadata"},{type:"settings.basic",value:"https://www.googleapis.com/auth/gmail.settings.basic"},{type:"settings.sharing",value:"https://www.googleapis.com/auth/gmail.settings.sharing"}],i=[{type:"read-only",value:"https://outlook.office.com/mail.read"},{type:"modify",value:"https://outlook.office.com/mail.readwrite"},{type:"send",value:"https://outlook.office.com/mail.send"},{type:"offline",value:"offline_access"}];async function s(r,i,s,o=!0,u,a){const c=await(e==null?void 0:e.getTokenInfo()),l=new URL(r,u??t.apiUri),h=new Headers;h.append("Accept","application/json"),h.append("Content-Type","application/json"),h.append("User-Agent",n),c&&h.append("Authorization",`Bearer ${c.access_token}`);const f=await fetch(l.toString(),{method:i||"GET",headers:h,mode:"cors",referrer:location.origin,body:s?JSON.stringify(s):void 0,...a||{}});return o?await f.json():f.body}return{config:t,async getHostedAuthRedirectURL(n=t.defaultScopes,r,i){const s=await h(Math.random().toString()),o=await h(s);await(e==null?void 0:e.setCodeVerifier(s));const u=new URL(`${t.apiUri}/v3/connect/auth`);return u.searchParams.set("client_id",t.clientId),u.searchParams.set("response_type","code"),u.searchParams.set("scope",n.join(" ")),u.searchParams.set("redirect_uri",t.redirectURI),u.searchParams.set("access_type","offline"),u.searchParams.set("code_challenge",o),u.searchParams.set("code_challenge_method","S256"),u.searchParams.set("options","rotate_refresh_token"),i&&u.searchParams.set("provider",i),r&&u.searchParams.set("login_hint",r),u.toString()},nylasAPIRequest:s,async exchangeAuthCodeForTokenInfo(n){if(!n)return null;const r=await(e==null?void 0:e.getCodeVerifier()),i=await this.nylasAPIRequest("/v3/connect/token","POST",{code:n,client_id:t.clientId,grant_type:"authorization_code",redirect_uri:t.redirectURI,code_verifier:r});return"error"in i||await(e==null?void 0:e.setTokenInfo(i)),i},async nylasDownloadFileRequest(r,i="GET",s){const o=await(e==null?void 0:e.getTokenInfo()),u=new URL(r,t.apiUri),a=new Headers;return a.append("Accept","application/json"),a.append("Content-Type","application/octet-stream"),a.append("User-Agent",n),o&&a.append("Authorization",`Bearer ${o.access_token}`),(await fetch(u.toString(),{method:i,headers:a,mode:"cors",referrer:location.origin,body:s?JSON.stringify(s):void 0})).blob()},async logout(){const t=await(e==null?void 0:e.getTokenInfo());t&&await this.nylasAPIRequest(`/v3/connect/revoke?token=${t.access_token}`,"POST"),await(e==null?void 0:e.reset())},async isAuthenticated(){return!!await(e==null?void 0:e.getTokenInfo())},async getTokenInfo(){const t=await(e==null?void 0:e.getTokenInfo());if(!t)return null;const{access_token:n,...r}=t;return r},async isAccessTokenValid(){const t=await(e==null?void 0:e.getTokenInfo());return t?"data"in await this.nylasAPIRequest(`/v3/connect/tokeninfo?id_token=${t.id_token}`,"GET"):!1},async refreshAccessToken(){const n=await(e==null?void 0:e.getTokenInfo());if(!n)return null;const r=await this.nylasAPIRequest("/v3/connect/token","POST",{client_id:t.clientId,grant_type:"refresh_token",refresh_token:n.refresh_token});return"error"in r||await(e==null?void 0:e.setTokenInfo(r)),r},async hasScopeByType(t="email",n){const s=await(e==null?void 0:e.getTokenInfo());if(!s)return!1;const o=s.scope.toLowerCase().split(" ");let u=[];const a=Array.isArray(n)?n:[n];return t==="email"&&(u=[...i,...r].filter((t=>a.includes(t.type)))),u.every((t=>o.includes(t.value)))},async hasScope(t){const n=await(e==null?void 0:e.getTokenInfo());if(!n)return!1;const r=n.scope.toLowerCase().split(" ");return(Array.isArray(t)?t:[t]).some((t=>r.includes(t.toLowerCase())))}}}export{s as N,l as X,br as e,c as n};
2
- //# sourceMappingURL=p-12bf5148.js.map
1
+ import{a as t,u as n,f as e,g as r}from"./p-6b7fb948.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=Object.defineProperty;var u=(t,n,e)=>n in t?o(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var a=(t,n,e)=>(u(t,typeof n!="symbol"?n+"":n,e),e);var c=(t=>(t.Error="error",t.Warning="warning",t.Info="info",t.Success="success",t))(c||{});const l=t=>t!==null&&typeof t=="object"&&"error"in t;async function h(t){const n=(new TextEncoder).encode(t),e=await crypto.subtle.digest("SHA-256",n),r=Array.from(new Uint8Array(e)).map((t=>t.toString(16).padStart(2,"0"))).join("");return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}const f=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:r,d=Object.keys,p=Array.isArray;function y(t,n){return typeof n!="object"||d(n).forEach((function(e){t[e]=n[e]})),t}typeof Promise>"u"||f.Promise||(f.Promise=Promise);const v=Object.getPrototypeOf,w={}.hasOwnProperty;function g(t,n){return w.call(t,n)}function m(t,n){typeof n=="function"&&(n=n(v(t))),(typeof Reflect>"u"?d:Reflect.ownKeys)(n).forEach((e=>{k(t,e,n[e])}))}const b=Object.defineProperty;function k(t,n,e,r){b(t,n,y(e&&g(e,"get")&&typeof e.get=="function"?{get:e.get,set:e.set,configurable:!0}:{value:e,configurable:!0,writable:!0},r))}function $(t){return{from:function(n){return t.prototype=Object.create(n.prototype),k(t.prototype,"constructor",t),{extend:m.bind(null,t.prototype)}}}}const S=Object.getOwnPropertyDescriptor;function A(t,n){let e;return S(t,n)||(e=v(t))&&A(e,n)}const P=[].slice;function x(t,n,e){return P.call(t,n,e)}function C(t,n){return n(t)}function E(t){if(!t)throw new Error("Assertion Failed")}function O(t){f.setImmediate?setImmediate(t):setTimeout(t,0)}function T(t,n){return t.reduce(((t,e,r)=>{var i=n(e,r);return i&&(t[i[0]]=i[1]),t}),{})}function D(t,n){if(g(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=D(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:D(u,n.substr(o+1))}}function j(t,n,e){if(t&&n!==void 0&&(!("isFrozen"in Object)||!Object.isFrozen(t)))if(typeof n!="string"&&"length"in n){E(typeof e!="string"&&"length"in e);for(var r=0,i=n.length;r<i;++r)j(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?p(t)&&!isNaN(parseInt(o))?t.splice(o,1):delete t[o]:t[o]=e;else{var a=t[o];a&&g(t,o)||(a=t[o]={}),j(a,u,e)}}else e===void 0?p(t)&&!isNaN(parseInt(n))?t.splice(n,1):delete t[n]:t[n]=e}}function I(t){var n={};for(var e in t)g(t,e)&&(n[e]=t[e]);return n}const R=[].concat;function K(t){return R.apply([],t)}const B="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(K([8,16,32,64].map((t=>["Int","Uint","Float"].map((n=>n+t+"Array")))))).filter((t=>f[t])),_=B.map((t=>f[t]));T(B,(t=>[t,!0]));let q=null;function M(t){q=typeof WeakMap<"u"&&new WeakMap;const n=N(t);return q=null,n}function N(t){if(!t||typeof t!="object")return t;let n=q&&q.get(t);if(n)return n;if(p(t)){n=[],q&&q.set(t,n);for(var e=0,r=t.length;e<r;++e)n.push(N(t[e]))}else if(_.indexOf(t.constructor)>=0)n=t;else{const e=v(t);for(var i in n=e===Object.prototype?{}:Object.create(e),q&&q.set(t,n),t)g(t,i)&&(n[i]=N(t[i]))}return n}const{toString:F}={};function L(t){return F.call(t).slice(8,-1)}const U=typeof Symbol<"u"?Symbol.iterator:"@@iterator",V=typeof U=="symbol"?function(t){var n;return t!=null&&(n=t[U])&&n.apply(t)}:function(){return null},W={};function H(t){var n,e,r,i;if(arguments.length===1){if(p(t))return t.slice();if(this===W&&typeof t=="string")return[t];if(i=V(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 G=typeof Symbol<"u"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1;var z=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function J(t,n){z=t,Y=n}var Y=()=>!0;const Q=!new Error("").stack;function X(){if(Q)try{throw new Error}catch(t){return t}return new Error}function Z(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(Y).map((t=>`\n`+t)).join("")):""}var tt=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],nt=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(tt),et={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 rt(t,n){this._e=X(),this.name=t,this.message=n}function it(t,n){return t+". Errors: "+Object.keys(n).map((t=>n[t].toString())).filter(((t,n,e)=>e.indexOf(t)===n)).join(`\n`)}function st(t,n,e,r){this._e=X(),this.failures=n,this.failedKeys=r,this.successCount=e,this.message=it(t,n)}function ot(t,n){this._e=X(),this.name="BulkError",this.failures=Object.keys(n).map((t=>n[t])),this.failuresByPos=n,this.message=it(t,n)}$(rt).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+Z(this._e,2))}},toString:function(){return this.name+": "+this.message}}),$(st).from(rt),$(ot).from(rt);var ut=nt.reduce(((t,n)=>(t[n]=n+"Error",t)),{});const at=rt;var ct=nt.reduce(((t,n)=>{var e=n+"Error";function r(t,r){this._e=X(),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=et[n]||e,this.inner=null)}return $(r).from(at),t[n]=r,t}),{});ct.Syntax=SyntaxError,ct.Type=TypeError,ct.Range=RangeError;var lt=tt.reduce(((t,n)=>(t[n+"Error"]=ct[n],t)),{}),ht=nt.reduce(((t,n)=>(["Syntax","Type","Range"].indexOf(n)===-1&&(t[n+"Error"]=ct[n]),t)),{});function ft(){}function dt(t){return t}function pt(t,n){return t==null||t===dt?n:function(e){return n(t(e))}}function yt(t,n){return function(){t.apply(this,arguments),n.apply(this,arguments)}}function vt(t,n){return t===ft?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?yt(r,this.onsuccess):r),i&&(this.onerror=this.onerror?yt(i,this.onerror):i),s!==void 0?s:e}}function wt(t,n){return t===ft?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?yt(e,this.onsuccess):e),r&&(this.onerror=this.onerror?yt(r,this.onerror):r)}}function gt(t,n){return t===ft?n:function(e){var r=t.apply(this,arguments);y(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?yt(i,this.onsuccess):i),s&&(this.onerror=this.onerror?yt(s,this.onerror):s),r===void 0?o===void 0?void 0:o:y(r,o)}}function mt(t,n){return t===ft?n:function(){return n.apply(this,arguments)!==!1&&t.apply(this,arguments)}}function bt(t,n){return t===ft?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)}}ht.ModifyError=st,ht.DexieError=rt,ht.BulkError=ot;var kt={};const $t=100,[St,At,Pt]=typeof Promise>"u"?[]:(()=>{let t=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[t,v(t),t];const n=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[n,v(n),t]})(),xt=At&&At.then,Ct=St&&St.constructor,Et=!!Pt;var Ot=!1,Tt=Pt?()=>{Pt.then(Zt)}:f.setImmediate?setImmediate.bind(null,Zt):f.MutationObserver?()=>{var t=document.createElement("div");new MutationObserver((()=>{Zt(),t=null})).observe(t,{attributes:!0}),t.setAttribute("i","1")}:()=>{setTimeout(Zt,0)},Dt=function(t,n){Nt.push([t,n]),It&&(Tt(),It=!1)},jt=!0,It=!0,Rt=[],Kt=[],Bt=null,_t=dt,qt={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Pn,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((t=>{try{Pn(t[0],t[1])}catch{}}))}},Mt=qt,Nt=[],Ft=0,Lt=[];function Ut(t){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ft,this._lib=!1;var n=this._PSD=Mt;if(z&&(this._stackHolder=X(),this._prev=null,this._numPrev=0),typeof t!="function"){if(t!==kt)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&Gt(this,this._value))}this._state=null,this._value=null,++n.ref,Ht(this,t)}const Vt={get:function(){var t=Mt,n=ln;function e(e,r){var i=!t.global&&(t!==Mt||n!==ln);const s=i&&!pn();var o=new Ut(((n,o)=>{Jt(this,new Wt($n(e,t,i,s),$n(r,t,i,s),n,o,t))}));return z&&Xt(o,this),o}return e.prototype=kt,e},set:function(t){k(this,"then",t&&t.prototype===kt?Vt:{get:function(){return t},set:Vt.set})}};function Wt(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 Ht(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&&tn();n&&typeof n.then=="function"?Ht(t,((t,e)=>{n instanceof Ut?n._then(t,e):n.then(t,e)})):(t._state=!0,t._value=n,zt(t)),e&&nn()}}),Gt.bind(null,t))}catch(n){Gt(t,n)}}function Gt(t,n){if(Kt.push(n),t._state===null){var e=t._lib&&tn();n=_t(n),t._state=!1,t._value=n,z&&n!==null&&typeof n=="object"&&!n._promise&&function(t,n,e){try{t.apply(null,e)}catch(t){n&&n(t)}}((()=>{var e=A(n,"stack");n._promise=t,k(n,"stack",{get:()=>Ot?e&&(e.get?e.get.apply(n):e.value):t.stack})})),function(t){Rt.some((n=>n._value===t._value))||Rt.push(t)}(t),zt(t),e&&nn()}}function zt(t){var n=t._listeners;t._listeners=[];for(var e=0,r=n.length;e<r;++e)Jt(t,n[e]);var i=t._PSD;--i.ref||i.finalize(),Ft===0&&(++Ft,Dt((()=>{--Ft==0&&en()}),[]))}function Jt(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,++Ft,Dt(Yt,[e,t,n])}else t._listeners.push(n)}function Yt(t,n,e){try{Bt=n;var r,i=n._value;n._state?r=t(i):(Kt.length&&(Kt=[]),r=t(i),Kt.indexOf(i)===-1&&function(t){for(var n=Rt.length;n;)if(Rt[--n]._value===t._value)return void Rt.splice(n,1)}(n)),e.resolve(r)}catch(t){e.reject(t)}finally{Bt=null,--Ft==0&&en(),--e.psd.ref||e.psd.finalize()}}function Qt(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=Z(o,0)):(i=o,s=""),n.push(i+(s?": "+s:"")+r)}return z&&((r=Z(t._stackHolder,2))&&n.indexOf(r)===-1&&n.push(r),t._prev&&Qt(t._prev,n,e)),n}function Xt(t,n){var e=n?n._numPrev+1:0;e<100&&(t._prev=n,t._numPrev=e)}function Zt(){tn()&&nn()}function tn(){var t=jt;return jt=!1,It=!1,t}function nn(){var t,n,e;do{for(;Nt.length>0;)for(t=Nt,Nt=[],e=t.length,n=0;n<e;++n){var r=t[n];r[0].apply(null,r[1])}}while(Nt.length>0);jt=!0,It=!0}function en(){var t=Rt;Rt=[],t.forEach((t=>{t._PSD.onunhandled.call(null,t._value,t)}));for(var n=Lt.slice(0),e=n.length;e;)n[--e]()}function rn(t){return new Ut(kt,!1,t)}function sn(t,n){var e=Mt;return function(){var r=tn(),i=Mt;try{return gn(e,!0),t.apply(this,arguments)}catch(t){n&&n(t)}finally{gn(i,!1),r&&nn()}}}m(Ut.prototype,{then:Vt,_then:function(t,n){Jt(this,new Wt(null,null,t,n,Mt))},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):rn(t))):this.then(null,(t=>t&&t.name===n?e(t):rn(t)))},finally:function(t){return this.then((n=>(t(),n)),(n=>(t(),rn(n))))},stack:{get:function(){if(this._stack)return this._stack;try{Ot=!0;var t=Qt(this,[],20).join(`\nFrom previous: `);return this._state!==null&&(this._stack=t),t}finally{Ot=!1}}},timeout:function(t,n){return t<1/0?new Ut(((e,r)=>{var i=setTimeout((()=>r(new ct.Timeout(n))),t);this.then(e,r).finally(clearTimeout.bind(null,i))})):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&k(Ut.prototype,Symbol.toStringTag,"Dexie.Promise"),qt.env=mn(),m(Ut,{all:function(){var t=H.apply(null,arguments).map(yn);return new Ut((function(n,e){t.length===0&&n([]);var r=t.length;t.forEach(((i,s)=>Ut.resolve(i).then((e=>{t[s]=e,--r||n(t)}),e)))}))},resolve:t=>{if(t instanceof Ut)return t;if(t&&typeof t.then=="function")return new Ut(((n,e)=>{t.then(n,e)}));var n=new Ut(kt,!0,t);return Xt(n,Bt),n},reject:rn,race:function(){var t=H.apply(null,arguments).map(yn);return new Ut(((n,e)=>{t.map((t=>Ut.resolve(t).then(n,e)))}))},PSD:{get:()=>Mt,set:t=>Mt=t},totalEchoes:{get:()=>ln},newPSD:fn,usePSD:bn,scheduler:{get:()=>Dt,set:t=>{Dt=t}},rejectionMapper:{get:()=>_t,set:t=>{_t=t}},follow:(t,n)=>new Ut(((e,r)=>fn(((n,e)=>{var r=Mt;r.unhandleds=[],r.onunhandled=e,r.finalize=yt((function(){(function(t){function n(){t(),Lt.splice(Lt.indexOf(n),1)}Lt.push(n),++Ft,Dt((()=>{--Ft==0&&en()}),[])})((()=>{this.unhandleds.length===0?n():e(this.unhandleds[0])}))}),r.finalize),t()}),n,e,r)))}),Ct&&(Ct.allSettled&&k(Ut,"allSettled",(function(){const t=H.apply(null,arguments).map(yn);return new Ut((n=>{t.length===0&&n([]);let e=t.length;const r=new Array(e);t.forEach(((t,i)=>Ut.resolve(t).then((t=>r[i]={status:"fulfilled",value:t}),(t=>r[i]={status:"rejected",reason:t})).then((()=>--e||n(r)))))}))})),Ct.any&&typeof AggregateError<"u"&&k(Ut,"any",(function(){const t=H.apply(null,arguments).map(yn);return new Ut(((n,e)=>{t.length===0&&e(new AggregateError([]));let r=t.length;const i=new Array(r);t.forEach(((t,s)=>Ut.resolve(t).then((t=>n(t)),(t=>{i[s]=t,--r||e(new AggregateError(i))}))))}))})));const on={awaits:0,echoes:0,id:0};var un=0,an=[],cn=0,ln=0,hn=0;function fn(t,n,e,r){var i=Mt,s=Object.create(i);s.parent=i,s.ref=0,s.global=!1,s.id=++hn;var o=qt.env;s.env=Et?{Promise:Ut,PromiseProp:{value:Ut,configurable:!0,writable:!0},all:Ut.all,race:Ut.race,allSettled:Ut.allSettled,any:Ut.any,resolve:Ut.resolve,reject:Ut.reject,nthen:Sn(o.nthen,s),gthen:Sn(o.gthen,s)}:{},n&&y(s,n),++i.ref,s.finalize=function(){--this.parent.ref||this.parent.finalize()};var u=bn(s,t,e,r);return s.ref===0&&s.finalize(),u}function dn(){return on.id||(on.id=++un),++on.awaits,on.echoes+=$t,on.id}function pn(){return!!on.awaits&&(--on.awaits==0&&(on.id=0),on.echoes=on.awaits*$t,!0)}function yn(t){return on.echoes&&t&&t.constructor===Ct?(dn(),t.then((t=>(pn(),t)),(t=>(pn(),xn(t))))):t}function vn(t){++ln,on.echoes&&--on.echoes!=0||(on.echoes=on.id=0),an.push(Mt),gn(t,!0)}function wn(){var t=an[an.length-1];an.pop(),gn(t,!1)}function gn(t,n){var e=Mt;if((n?!on.echoes||cn++&&t===Mt:!cn||--cn&&t===Mt)||kn(n?vn.bind(null,t):wn),t!==Mt&&(Mt=t,e===qt&&(qt.env=mn()),Et)){var r=qt.env.Promise,i=t.env;At.then=i.nthen,r.prototype.then=i.gthen,(e.global||t.global)&&(Object.defineProperty(f,"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 mn(){var t=f.Promise;return Et?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(f,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:At.then,gthen:t.prototype.then}:{}}function bn(t,n,e,r,i){var s=Mt;try{return gn(t,!0),n(e,r,i)}finally{gn(s,!1)}}function kn(t){xt.call(St,t)}function $n(t,n,e,r){return typeof t!="function"?t:function(){var i=Mt;e&&dn(),gn(n,!0);try{return t.apply(this,arguments)}finally{gn(i,!1),r&&kn(pn)}}}function Sn(t,n){return function(e,r){return t.call(this,$n(e,n),$n(r,n))}}(""+xt).indexOf("[native code]")===-1&&(dn=pn=ft);const An="unhandledrejection";function Pn(t,n){var e;try{e=n.onuncatched(t)}catch{}if(e!==!1)try{var r,i={promise:n,reason:t};if(f.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(An,!0,!0),y(r,i)):f.CustomEvent&&y(r=new CustomEvent(An,{detail:i}),i),r&&f.dispatchEvent&&(dispatchEvent(r),!f.PromiseRejectionEvent&&f.onunhandledrejection))try{f.onunhandledrejection(r)}catch{}z&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${t.stack||t}`)}catch{}}var xn=Ut.reject;function Cn(t,n,e,r){if(t.idbdb&&(t._state.openComplete||Mt.letThrough||t._vip)){var i=t._createTransaction(n,e,t._dbSchema);try{i.create(),t._state.PR1398_maxLoop=3}catch(i){return i.name===ut.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then((()=>Cn(t,n,e,r)))):xn(i)}return i._promise(n,((t,n)=>fn((()=>(Mt.trans=i,r(t,n,i)))))).then((t=>i._completion.then((()=>t))))}if(t._state.openComplete)return xn(new ct.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return xn(new ct.DatabaseClosed);t.open().catch(ft)}return t._state.dbReadyPromise.then((()=>Cn(t,n,e,r)))}const En="3.2.4",On=String.fromCharCode(65535),Tn=-1/0,Dn="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",jn="String expected.",In=[],Rn=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Kn=Rn,Bn=Rn,_n=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),qn="__dbnames",Mn="readonly",Nn="readwrite";function Fn(t,n){return t?n?function(){return t.apply(this,arguments)&&n.apply(this,arguments)}:t:n}const Ln={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Un(t){return typeof t!="string"||/\./.test(t)?t=>t:n=>(n[t]===void 0&&t in n&&delete(n=M(n))[t],n)}class Vn{_trans(t,n,e){const r=this._tx||Mt.trans,i=this.name;function s(t,e,r){if(!r.schema[i])throw new ct.NotFound("Table "+i+" not part of transaction");return n(r.idbtrans,r)}const o=tn();try{return r&&r.db===this.db?r===Mt.trans?r._promise(t,s,e):fn((()=>r._promise(t,s,e)),{trans:r,transless:Mt.transless||Mt}):Cn(this.db,t,[this.name],s)}finally{o&&nn()}}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(p(t))return new this.db.WhereClause(this,`[${t.join("+")}]`);const n=d(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!==On)return this.where(e.name).equals(e.keyPath.map((n=>t[n])));!e&&z&&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?Fn(e,o&&o.multi?t=>{const n=D(t,i);return p(n)&&n.some((t=>s(u,t)))}:t=>s(u,D(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,p(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(g(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){y(this,t)}))}add(t,n){const{auto:e,keyPath:r}=this.schema.primKey;let i=t;return r&&e&&(i=Un(r)(t)),this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"add",keys:n!=null?[n]:null,values:[i]}))).then((t=>t.numFailures?Ut.reject(t.failures[0]):t.lastResult)).then((n=>{if(r)try{j(t,r,n)}catch{}return n}))}update(t,n){if(typeof t!="object"||p(t))return this.where(":id").equals(t).modify(n);{const e=D(t,this.schema.primKey.keyPath);if(e===void 0)return xn(new ct.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?d(n).forEach((e=>{j(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=Un(r)(t)),this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"put",values:[i],keys:n!=null?[n]:null}))).then((t=>t.numFailures?Ut.reject(t.failures[0]):t.lastResult)).then((n=>{if(r)try{j(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?Ut.reject(t.failures[0]):void 0))}clear(){return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"deleteRange",range:Ln}))).then((t=>t.numFailures?Ut.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 ct.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==t.length)throw new ct.InvalidArgument("Arguments objects and keys must have the same length");const o=t.length;let u=s&&e?t.map(Un(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 ot(`${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 ct.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==t.length)throw new ct.InvalidArgument("Arguments objects and keys must have the same length");const o=t.length;let u=s&&e?t.map(Un(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 ot(`${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 ot(`${this.name}.bulkDelete(): ${t} of ${n} operations failed`,r)}))}}function Wn(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=mt),i||(i=ft);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}d(o=t).forEach((function(t){var n=o[t];if(p(n))s(t,o[t][0],o[t][1]);else{if(n!=="asap")throw new ct.InvalidArgument("Invalid event config");var e=s(t,dt,(function(){for(var t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];e.subscribers.forEach((function(t){O((function(){t.apply(null,n)}))}))}))}}))}}function Hn(t,n){return $(n).from({prototype:t}),n}function Gn(t,n){return!(t.filter||t.algorithm||t.or)&&(n?t.justLimit:!t.replayFilter)}function zn(t,n){t.filter=Fn(t.filter,n)}function Jn(t,n,e){var r=t.replayFilter;t.replayFilter=r?()=>Fn(r(),n()):n,t.justLimit=e&&!r}function Yn(t,n){if(t.isPrimKey)return n.primaryKey;const e=n.getIndexByKeyPath(t.index);if(!e)throw new ct.Schema("KeyPath "+t.index+" on object store "+n.name+" is not indexed");return e}function Qn(t,n,e){const r=Yn(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 Xn(t,n,e,r){const i=t.replayFilter?Fn(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)),g(s,u)||(s[u]=!0,n(t,e,r))}};return Promise.all([t.or._iterate(o,e),Zn(Qn(t,r,e),t.algorithm,o,!t.keysOnly&&t.valueMapper)])}return Zn(Qn(t,r,e),Fn(t.algorithm,i),n,!t.keysOnly&&t.valueMapper)}function Zn(t,n,e,r){var i=sn(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=ft}),(n=>{t.fail(n),e=ft}))||i(t.value,t,(t=>e=t)),e()}))}))}function te(t,n){try{const e=ne(t),r=ne(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}(ee(t),ee(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=te(t[e],n[e]);if(r!==0)return r}return e===r?0:e<r?-1:1}(t,n)}}catch{}return NaN}function ne(t){const n=typeof t;if(n!=="object")return n;if(ArrayBuffer.isView(t))return"binary";const e=L(t);return e==="ArrayBuffer"?"binary":e}function ee(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)}class re{_read(t,n){var e=this._ctx;return e.error?e.table._trans(null,xn.bind(null,e.error)):e.table._trans("readonly",t).then(n)}_write(t){var n=this._ctx;return n.error?n.table._trans(null,xn.bind(null,n.error)):n.table._trans("readwrite",t,"locked")}_addAlgorithm(t){var n=this._ctx;n.algorithm=Fn(n.algorithm,t)}_iterate(t,n){return Xn(this._ctx,t,n,this._ctx.table.core)}clone(t){var n=Object.create(this.constructor.prototype),e=Object.create(this._ctx);return t&&y(e,t),n._ctx=e,n}raw(){return this._ctx.valueMapper=null,this}each(t){var n=this._ctx;return this._read((e=>Xn(n,t,e,n.table.core)))}count(t){return this._read((t=>{const n=this._ctx,e=n.table.core;if(Gn(n,!0))return e.count({trans:t,query:{index:Yn(n,e.schema),range:n.range}}).then((t=>Math.min(t,n.limit)));var r=0;return Xn(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"&&Gn(n,!0)&&n.limit>0){const{valueMapper:e}=n,r=Yn(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 Xn(n,(t=>e.push(t)),t,n.table.core).then((()=>e))}}),t)}offset(t){var n=this._ctx;return t<=0||(n.offset+=t,Gn(n)?Jn(n,(()=>{var n=t;return(t,e)=>n===0||(n===1?(--n,!1):(e((()=>{t.advance(n),n=0})),!1))})):Jn(n,(()=>{var n=t;return()=>--n<0}))),this}limit(t){return this._ctx.limit=Math.min(this._ctx.limit,t),Jn(this._ctx,(()=>{var n=t;return function(t,e,r){return--n<=0&&e(r),n>=0}}),!0),this}until(t,n){return zn(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 zn(this._ctx,(function(n){return t(n.value)})),n=this._ctx,e=t,n.isMatch=Fn(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"&&Gn(n,!0)&&n.limit>0)return this._read((t=>{var e=Yn(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 zn(this._ctx,(function(t){var n=t.primaryKey.toString(),r=g(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=d(t),s=i.length;r=function(n){for(var e=!1,r=0;r<s;++r){var o=i[r],u=t[o];D(n,o)!==u&&(j(n,o,u),e=!0)}return e}}const o=n.table.core,{outbound:u,extractKey:a}=o.schema.primaryKey,c=this.db._options.modifyChunkSize||200,l=[];let h=0;const f=[],p=(t,n)=>{const{failures:e,numFailures:r}=n;h+=t-r;for(let t of d(e))l.push(e[t])};return this.clone().primaryKeys().then((i=>{const s=l=>{const h=Math.min(c,i.length-l);return o.getMany({trans:e,keys:i.slice(l,l+h),cache:"immutable"}).then((f=>{const d=[],y=[],v=u?[]:null,w=[];for(let t=0;t<h;++t){const n=f[t],e={value:M(n),primKey:i[l+t]};r.call(e,e.value,e)!==!1&&(e.value==null?w.push(i[l+t]):u||te(a(n),a(e.value))===0?(y.push(e.value),u&&v.push(i[l+t])):(w.push(i[l+t]),d.push(e.value)))}const g=Gn(n)&&n.limit===1/0&&(typeof t!="function"||t===ie)&&{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)w.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((()=>(w.length>0||g&&t===ie)&&o.mutate({trans:e,type:"delete",keys:w,criteria:g}).then((t=>p(w.length,t))))).then((()=>i.length>l+h&&s(l+c)))}))};return s(0).then((()=>{if(l.length>0)throw new st("Error modifying one or more objects",l,h,f);return i.length}))}))}))}delete(){var t=this._ctx,n=t.range;return Gn(t)&&(t.isPrimKey&&!Bn||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 st("Could not delete some values",Object.keys(t).map((n=>t[n])),n-i);return n-i}))))})):this.modify(ie)}}const ie=(t,n)=>n.value=null;function se(t,n){return t<n?-1:t===n?0:1}function oe(t,n){return t>n?-1:t===n?0:1}function ue(t,n,e){var r=t instanceof de?new t.Collection(t):t;return r._ctx.error=e?new e(n):new TypeError(n),r}function ae(t){return new t.Collection(t,(()=>fe(""))).limit(0)}function ce(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 le(t,n,e,r){var i,s,o,u,a,c,l,h=e.length;if(!e.every((t=>typeof t=="string")))return ue(t,jn);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"?se:oe;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,(()=>he(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=ce(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 he(t,n,e,r){return{type:2,lower:t,upper:n,lowerOpen:e,upperOpen:r}}function fe(t){return{type:1,lower:t,upper:t}}class de{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)?ae(this):new this.Collection(this,(()=>he(t,n,!e,!r)))}catch{return ue(this,Dn)}}equals(t){return t==null?ue(this,Dn):new this.Collection(this,(()=>fe(t)))}above(t){return t==null?ue(this,Dn):new this.Collection(this,(()=>he(t,void 0,!0)))}aboveOrEqual(t){return t==null?ue(this,Dn):new this.Collection(this,(()=>he(t,void 0,!1)))}below(t){return t==null?ue(this,Dn):new this.Collection(this,(()=>he(void 0,t,!1,!0)))}belowOrEqual(t){return t==null?ue(this,Dn):new this.Collection(this,(()=>he(void 0,t)))}startsWith(t){return typeof t!="string"?ue(this,jn):this.between(t,t+On,!0,!0)}startsWithIgnoreCase(t){return t===""?this.startsWith(t):le(this,((t,n)=>t.indexOf(n[0])===0),[t],On)}equalsIgnoreCase(t){return le(this,((t,n)=>t===n[0]),[t],"")}anyOfIgnoreCase(){var t=H.apply(W,arguments);return t.length===0?ae(this):le(this,((t,n)=>n.indexOf(t)!==-1),t,"")}startsWithAnyOfIgnoreCase(){var t=H.apply(W,arguments);return t.length===0?ae(this):le(this,((t,n)=>n.some((n=>t.indexOf(n)===0))),t,On)}anyOf(){const t=H.apply(W,arguments);let n=this._cmp;try{t.sort(n)}catch{return ue(this,Dn)}if(t.length===0)return ae(this);const e=new this.Collection(this,(()=>he(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([[Tn,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const t=H.apply(W,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return ue(this,Dn)}const n=t.reduce(((t,n)=>t?t.concat([[t[t.length-1][1],n]]):[[Tn,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 ae(this);if(!t.every((t=>t[0]!==void 0&&t[1]!==void 0&&r(t[0],t[1])<=0)))return ue(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",ct.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 ue(this,Dn)}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,(()=>he(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=H.apply(W,arguments);return t.every((t=>typeof t=="string"))?t.length===0?ae(this):this.inAnyRange(t.map((t=>[t,t+On]))):ue(this,"startsWithAnyOf() only works with strings")}}function pe(t){return sn((function(n){return ye(n),t(n.target.error),!1}))}function ye(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}const ve="storagemutated",we="x-storagemutated-1",ge=Wn(null,ve);class me{_lock(){return E(!Mt.global),++this._reculock,this._reculock!==1||Mt.global||(Mt.lockOwnerFor=this),this}_unlock(){if(E(!Mt.global),--this._reculock==0)for(Mt.global||(Mt.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{bn(t[1],t[0])}catch{}}return this}_locked(){return this._reculock&&Mt.lockOwnerFor!==this}create(t){if(!this.mode)return this;const n=this.db.idbdb,e=this.db._state.dbOpenError;if(E(!this.idbtrans),!t&&!n)switch(e&&e.name){case"DatabaseClosedError":throw new ct.DatabaseClosed(e);case"MissingAPIError":throw new ct.MissingAPI(e.message,e);default:throw new ct.OpenFailed(e)}if(!this.active)throw new ct.TransactionInactive;return E(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=sn((n=>{ye(n),this._reject(t.error)})),t.onabort=sn((n=>{ye(n),this.active&&this._reject(new ct.Abort(t.error)),this.active=!1,this.on("abort").fire(n)})),t.oncomplete=sn((()=>{this.active=!1,this._resolve(),"mutatedParts"in t&&ge.storagemutated.fire(t.mutatedParts)})),this}_promise(t,n,e){if(t==="readwrite"&&this.mode!=="readwrite")return xn(new ct.ReadOnly("Transaction is readonly"));if(!this.active)return xn(new ct.TransactionInactive);if(this._locked())return new Ut(((r,i)=>{this._blockedFuncs.push([()=>{this._promise(t,n,e).then(r,i)},Mt])}));if(e)return fn((()=>{var t=new Ut(((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 Ut(((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=Ut.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 Ut(((t,r)=>{e.then((e=>n._waitingQueue.push(sn(t.bind(null,e)))),(t=>n._waitingQueue.push(sn(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 ct.Abort))}table(t){const n=this._memoizedTables||(this._memoizedTables={});if(g(n,t))return n[t];const e=this.schema[t];if(!e)throw new ct.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 be(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?"++":"")+ke(n)}}function ke(t){return typeof t=="string"?t:t?"["+[].join.call(t,"+")+"]":""}function $e(t,n,e){return{name:t,primKey:n,indexes:e,mappedClass:null,idxByName:T(e,(t=>[t.name,t]))}}let Se=t=>{try{return t.only([[]]),Se=()=>[[]],[[]]}catch{return Se=()=>On,On}};function Ae(t){return t==null?()=>{}:typeof t=="string"?function(t){return t.split(".").length===1?n=>n[t]:n=>D(n,t)}(t):n=>D(n,t)}function Pe(t){return[].slice.call(t)}let xe=0;function Ce(t){return t==null?":id":typeof t=="string"?t:`[${t.join("+")}]`}function Ee(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=Pe(t.objectStoreNames);return{schema:{name:t.name,tables:e.map((t=>n.objectStore(t))).map((t=>{const{keyPath:n,autoIncrement:e}=t,r=p(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:Ae(n)},indexes:Pe(t.indexNames).map((n=>t.index(n))).map((t=>{const{name:n,unique:e,multiEntry:r,keyPath:i}=t,o={name:n,compound:p(i),keyPath:i,unique:e,multiEntry:r,extractKey:Ae(i)};return s[Ce(i)]=o,o})),getIndexByKeyPath:t=>s[Ce(t)]};return s[":id"]=o.primaryKey,n!=null&&(s[Ce(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=sn(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 w=t=>{++v,ye(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=w;else for(let n=0;n<f;++n)p.push(d=c[e](t[n])),d.onerror=w}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=>{w(t),g(t)},d.onsuccess=g}))},getMany:({trans:t,keys:e})=>new Promise(((r,i)=>{r=sn(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=pe(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=sn(r);const s=t.objectStore(n).get(e);s.onsuccess=t=>r(t.target.result),s.onerror=pe(i)})),query:function(t){return e=>new Promise(((i,s)=>{i=sn(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=pe(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=pe(s)}}))}(s),openCursor:function({trans:t,values:e,query:i,reverse:s,unique:o}){return new Promise(((u,a)=>{u=sn(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=pe(a),p.onsuccess=sn((n=>{const e=p.result;if(!e)return void u(null);e.___id=++xe,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=sn(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=sn(t),p.onerror=pe(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=sn((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=sn((n=>t(n.target.result))),l.onerror=pe(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:Se(n),schema:i}}function Oe({_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)}(Ee(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 Te({_novip:t},n,e,r){e.forEach((e=>{const i=r[e];n.forEach((n=>{const r=A(n,e);(!r||"value"in r&&r.value===void 0)&&(n===t.Transaction.prototype||n instanceof t.Transaction?k(n,e,{get(){return this.table(e)},set(t){b(this,e,{value:t,writable:!0,configurable:!0,enumerable:!0})}}):n[e]=new t.Table(e,i))}))}))}function De({_novip:t},n){n.forEach((n=>{for(let e in n)n[e]instanceof t.Table&&delete n[e]}))}function je(t,n){return t._cfg.version-n._cfg.version}function Ie(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=Mt.transless||Mt;fn((()=>{Mt.trans=s,Mt.transless=u,n===0?(d(i).forEach((t=>{Ke(e,t,i[t].primKey,i[t].indexes)})),Oe(t,e),Ut.follow((()=>t.on.populate.fire(s))).catch(o)):function({_novip:t},n,e,r){const i=[],s=t._versions;let o=t._dbSchema=_e(t,t.idbdb,r),u=!1;const a=s.filter((t=>t._cfg.version>=n));function c(){return i.length?Ut.resolve(i.shift()(e.idbtrans)).then(c):Ut.resolve()}return a.forEach((s=>{i.push((()=>{const i=o,a=s._cfg.dbschema;qe(t,i,r),qe(t,a,r),o=t._dbSchema=a;const c=Re(i,a);c.add.forEach((t=>{Ke(r,t[0],t[1].primKey,t[1].indexes)})),c.change.forEach((t=>{if(t.recreate)throw new ct.Upgrade("Not yet support for changing primary key");{const n=r.objectStore(t.name);t.add.forEach((t=>Be(n,t))),t.change.forEach((t=>{n.deleteIndex(t.name),Be(n,t)})),t.del.forEach((t=>n.deleteIndex(t)))}}));const l=s._cfg.contentUpgrade;if(l&&s._cfg.version>n){Oe(t,r),e._memoizedTables={},u=!0;let n=I(a);c.del.forEach((t=>{n[t]=i[t]})),De(t,[t.Transaction.prototype]),Te(t,[t.Transaction.prototype],d(n),n),e.schema=n;const s=G(l);let o;s&&dn();const h=Ut.follow((()=>{if(o=l(e),o&&s){var t=pn.bind(null,null);o.then(t,t)}}));return o&&typeof o.then=="function"?Ut.resolve(o):h.then((()=>o))}})),i.push((n=>{(!u||!Kn)&&function(t,n){[].slice.call(n.db.objectStoreNames).forEach((e=>t[e]==null&&n.db.deleteObjectStore(e)))}(s._cfg.dbschema,n),De(t,[t.Transaction.prototype]),Te(t,[t.Transaction.prototype],t._storeNames,t._dbSchema),e.schema=t._dbSchema}))})),c().then((()=>{var t,n;n=r,d(t=o).forEach((e=>{n.db.objectStoreNames.contains(e)||Ke(n,e,t[e].primKey,t[e].indexes)}))}))}(t,n,s,e).catch(o)}))}function Re(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&&!Rn)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 Ke(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=>Be(i,t))),i}function Be(t,n){t.createIndex(n.name,n.keyPath,{unique:n.unique,multiEntry:n.multi})}function _e(t,n,e){const r={};return x(n.objectStoreNames,0).forEach((t=>{const n=e.objectStore(t);let i=n.keyPath;const s=be(ke(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=be(e.name,i,!!e.unique,!!e.multiEntry,!1,i&&typeof i!="string",!1);o.push(u)}r[t]=$e(t,s,o)})),r}function qe({_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:"["+x(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)&&f.WorkerGlobalScope&&f instanceof f.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(t._hasGetAll=!1)}class Me{_parseStoresSpec(t,n){d(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 be(e,r||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),p(r),n===0)})),i=r.shift();if(i.multi)throw new ct.Schema("Primary key cannot be multi-valued");r.forEach((t=>{if(t.auto)throw new ct.Schema("Only primary key can be marked as autoIncrement (++)");if(!t.keyPath)throw new ct.Schema("Index must have a name and cannot be an empty string")})),n[e]=$e(e,i,r)}}))}stores(t){const n=this.db;this._cfg.storesSource=this._cfg.storesSource?y(this._cfg.storesSource,t):t;const e=n._versions,r={};let i={};return e.forEach((t=>{y(r,t._cfg.storesSource),i=t._cfg.dbschema={},t._parseStoresSpec(r,i)})),n._dbSchema=i,De(n,[n._allTables,n,n.Transaction.prototype]),Te(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],d(i),i),n._storeNames=d(i),this}upgrade(t){return this._cfg.contentUpgrade=bt(this._cfg.contentUpgrade||ft,t),this}}function Ne(t,n){let e=t._dbNamesDB;return e||(e=t._dbNamesDB=new cr(qn,{addons:[],indexedDB:t,IDBKeyRange:n}),e.version(1).stores({dbnames:"name"})),e.table("dbnames")}function Fe(t){return t&&typeof t.databases=="function"}function Le(t){return fn((function(){return Mt.letThrough=!0,t()}))}function Ue(){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 Ve(t){const n=t._state,{indexedDB:e}=t._deps;if(n.isBeingOpened||t.idbdb)return n.dbReadyPromise.then((()=>n.dbOpenError?xn(n.dbOpenError):t));z&&(n.openCanceller._stackHolder=X()),n.isBeingOpened=!0,n.dbOpenError=null,n.openComplete=!1;const r=n.openCanceller;function i(){if(n.openCanceller!==r)throw new ct.DatabaseClosed("db.open() was cancelled")}let s=n.dbReadyResolve,o=null,u=!1;return Ut.race([r,(typeof navigator>"u"?Ut.resolve():Ue()).then((()=>new Ut(((r,s)=>{if(i(),!e)throw new ct.MissingAPI;const a=t.name,c=n.autoSchema?e.open(a):e.open(a,Math.round(10*t.verno));if(!c)throw new ct.MissingAPI;c.onerror=pe(s),c.onblocked=sn(t._fireOnBlocked),c.onupgradeneeded=sn((r=>{if(o=c.transaction,n.autoSchema&&!t._options.allowEmptyDB){c.onerror=ye,o.abort(),c.result.close();const t=e.deleteDatabase(a);t.onsuccess=t.onerror=sn((()=>{s(new ct.NoSuchDatabase(`Database ${a} doesnt exist`))}))}else{o.onerror=pe(s);var i=r.oldVersion>Math.pow(2,62)?0:r.oldVersion;u=i<1,t._novip.idbdb=c.result,Ie(t,i/10,o,s)}}),s),c.onsuccess=sn((()=>{o=null;const e=t._novip.idbdb=c.result,i=x(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=_e(0,n,e);t._storeNames=x(n.objectStoreNames,0),Te(t,[t._allTables],d(r),r)}(t,e,r):(qe(t,t._dbSchema,r),function(t,n){const e=Re(_e(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.")),Oe(t,r)}catch{}var s;In.push(t),e.onversionchange=sn((e=>{n.vcFired=!0,t.on("versionchange").fire(e)})),e.onclose=sn((n=>{t.on("close").fire(n)})),u&&function({indexedDB:t,IDBKeyRange:n},e){!Fe(t)&&e!==qn&&Ne(t,n).put({name:e}).catch(ft)}(t._deps,a),r()}),s)}))))]).then((()=>(i(),n.onReadyBeingFired=[],Ut.resolve(Le((()=>t.on.ready.fire(t.vip)))).then((function e(){if(n.onReadyBeingFired.length>0){let r=n.onReadyBeingFired.reduce(bt,ft);return n.onReadyBeingFired=[],Ut.resolve(Le((()=>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(),xn(e)})).finally((()=>{n.openComplete=!0,s()}))}function We(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):p(s)?Promise.all(s).then(e,r):e(s)}}return i(n)()}function He(t,n,e){var r=arguments.length;if(r<2)throw new ct.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];return e=i.pop(),[t,K(i),e]}function Ge(t,n,e,r,i){return Ut.resolve().then((()=>{const s=Mt.transless||Mt,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===ut.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then((()=>Ge(t,n,e,null,i)))):xn(r)}const a=G(i);let c;a&&dn();const l=Ut.follow((()=>{if(c=i.call(o,o),c)if(a){var t=pn.bind(null,null);c.then(t,t)}else typeof c.next=="function"&&typeof c.throw=="function"&&(c=We(c))}),u);return(c&&typeof c.then=="function"?Ut.resolve(c).then((t=>o.active?t:xn(new ct.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),xn(t))))}))}function ze(t,n,e){const r=p(t)?t.slice():[t];for(let t=0;t<e;++t)r.push(n);return r}const Je={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=Ce(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:Ae(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:ze(r.lower,r.lowerOpen?t.MAX_KEY:t.MIN_KEY,i),lowerOpen:!0,upper:ze(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[Ce(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(ze(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(ze(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 Ye(t,n,e,r){return e=e||{},r=r||"",d(t).forEach((i=>{if(g(n,i)){var s=t[i],o=n[i];if(typeof s=="object"&&typeof o=="object"&&s&&o){const t=L(s);t!==L(o)?e[r+i]=n[i]:t==="Object"?Ye(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})),d(n).forEach((i=>{g(t,i)||(e[r+i]=n[i])})),e}const Qe={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=Mt.trans,{deleting:s,creating:o,updating:u}=i.table(n).hook;switch(t.type){case"add":if(o.fire===ft)break;return i._promise("readwrite",(()=>a(t)),!0);case"put":if(o.fire===ft&&u.fire===ft)break;return i._promise("readwrite",(()=>a(t)),!0);case"delete":if(s.fire===ft)break;return i._promise("readwrite",(()=>a(t)),!0);case"deleteRange":if(s.fire===ft)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=Mt.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||j(t.values[i],r.keyPath,e))}else{const r=Ye(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=>{g(n,t)?n[t]=s[t]:j(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 Xe(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)te(n.keys[i],t[s])===0&&(r.push(e?M(n.values[i]):n.values[i]),++s);return r.length===t.length?r:null}catch{return null}}const Ze={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=Xe(t.keys,t.trans._cache,t.cache==="clone");return n?Ut.resolve(n):e.getMany(t).then((n=>(t.trans._cache={keys:t.keys,values:t.cache==="clone"?M(n):n},n)))},mutate:t=>(t.type!=="add"&&(t.trans._cache=null),e.mutate(t))}}})};function tr(t){return!("from"in t)}const nr=function(t,n){if(!this){const n=new nr;return t&&"d"in t&&y(n,t),n}y(this,arguments.length?{d:1,from:t,to:arguments.length>1?n:t}:{d:0})};function er(t,n,e){const r=te(n,e);if(isNaN(r))return;if(r>0)throw RangeError();if(tr(t))return y(t,{from:n,to:e,d:1});const i=t.l,s=t.r;if(te(e,t.from)<0)return i?er(i,n,e):t.l={from:n,to:e,d:1,l:null,r:null},or(t);if(te(n,t.to)>0)return s?er(s,n,e):t.r={from:n,to:e,d:1,l:null,r:null},or(t);te(n,t.from)<0&&(t.from=n,t.l=null,t.d=s?s.d+1:1),te(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&&rr(t,i),s&&o&&rr(t,s)}function rr(t,n){tr(n)||function t(n,{from:e,to:r,l:i,r:s}){er(n,e,r),i&&t(n,i),s&&t(n,s)}(t,n)}function ir(t,n){const e=sr(n);let r=e.next();if(r.done)return!1;let i=r.value;const s=sr(t);let o=s.next(i.from),u=o.value;for(;!r.done&&!o.done;){if(te(u.from,i.to)<=0&&te(u.to,i.from)>=0)return!0;te(i.from,u.from)<0?i=(r=e.next(u.from)).value:u=(o=s.next(i.from)).value}return!1}function sr(t){let n=tr(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&&te(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||te(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 or(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=ur(e)}t.d=ur(t)}function ur({r:t,l:n}){return(t?n?Math.max(t.d,n.d):t.d:n?n.d:0)+1}m(nr.prototype,{add(t){return rr(this,t),this},addKey(t){return er(this,t,t),this},addKeys(t){return t.forEach((t=>er(this,t,t))),this},[U](){return sr(this)}});const ar={stack:"dbcore",level:0,create:t=>{const n=t.schema.name,e=new nr(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,c={...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 nr)},c=a(""),l=a(":dels"),{type:h}=t;let[f,d]=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(p(f)){h!=="delete"&&(f=t.results),c.addKeys(f);const n=Xe(f,y);n||h==="add"||l.addKeys(f),(n||d)&&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&&p(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]);te(i,u)!==0&&(i!=null&&o(i),u!=null&&o(u))}))}n.indexes.forEach(i)}(a,s,n,d)}else if(f){const t={from:f.lower,to:f.upper};l.add(t),c.add(t)}else c.add(e),l.add(e),s.indexes.forEach((t=>a(t.name).add(e)));return t}))}},l=({query:{index:n,range:e}})=>{var r,i;return[n,new nr((r=e.lower)!==null&&r!==void 0?r:t.MIN_KEY,(i=e.upper)!==null&&i!==void 0?i:t.MAX_KEY)]},h={get:t=>[o,new nr(t.key)],getMany:t=>[o,(new nr).addKeys(t.keys)],count:l,query:l,openCursor:l};return d(h).forEach((t=>{c[t]=function(s){const{subscr:o}=Mt;if(o){const c=t=>{const e=`idb://${n}/${r}/${t}`;return o[e]||(o[e]=new nr)},l=c(""),f=c(":dels"),[d,p]=h[t](s);if(c(d.name||"").add(p),!d.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):f.addKeys(t)}else if(t==="openCursor"){const t=e,n=s.values;return t&&Object.create(t,{key:{get:()=>(f.addKey(t.primaryKey),t.key)},primaryKey:{get(){const n=t.primaryKey;return f.addKey(n),n}},value:{get:()=>(n&&l.addKey(t.primaryKey),t.value)}})}return e}))}f.add(e)}}return i[t].apply(this,arguments)}})),c}}}};class cr{constructor(t,n){this._middlewares={},this.verno=0;const e=cr.dependencies;this._options=n={addons:cr.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:ft,dbReadyPromise:null,cancelOpen:ft,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var s;i.dbReadyPromise=new Ut((t=>{i.dbReadyResolve=t})),i.openCanceller=new Ut(((t,n)=>{i.cancelOpen=n})),this._state=i,this.name=t,this.on=Wn(this,"populate","blocked","versionchange","close",{ready:[bt,ft]}),this.on.ready.subscribe=C(this.on.ready.subscribe,(t=>(n,e)=>{cr.vip((()=>{const r=this._state;if(r.openComplete)r.dbOpenError||Ut.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,Hn(re.prototype,(function(t,n){this.db=s;let e=Ln,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!==dt?u:null}}))),this.Table=function(t){return Hn(Vn.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:Wn(null,{creating:[vt,ft],reading:[pt,dt],updating:[gt,ft],deleting:[wt,ft]})}))}(this),this.Transaction=function(t){return Hn(me.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=Wn(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 Ut(((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(),xn(t)}))}))}(this),this.Version=function(t){return Hn(Me.prototype,(function(n){this.db=t,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}(this),this.WhereClause=function(t){return Hn(de.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 ct.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=Se(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),In.filter((t=>t.name===this.name&&t!==this&&!t._state.vcFired)).map((n=>n.on("versionchange").fire(t)))},this.use(Je),this.use(Qe),this.use(ar),this.use(Ze),this.vip=Object.create(this,{_vip:{value:!0}}),r.forEach((t=>t(this)))}version(t){if(isNaN(t)||t<.1)throw new ct.Type("Given version is not a positive number");if(t=Math.round(10*t)/10,this.idbdb||this._state.isBeingOpened)throw new ct.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(je),e.stores({}),this._state.autoSchema=!1,e)}_whenReady(t){return this.idbdb&&(this._state.openComplete||Mt.letThrough||this._vip)?t():new Ut(((t,n)=>{if(this._state.openComplete)return n(new ct.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void n(new ct.DatabaseClosed);this.open().catch(ft)}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 Ve(this)}_close(){const t=this._state,n=In.indexOf(this);if(n>=0&&In.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}t.dbReadyPromise=new Ut((n=>{t.dbReadyResolve=n})),t.openCanceller=new Ut(((n,e)=>{t.cancelOpen=e}))}close(){this._close();const t=this._state;this._options.autoOpen=!1,t.dbOpenError=new ct.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError)}delete(){const t=arguments.length>0,n=this._state;return new Ut(((e,r)=>{const i=()=>{this.close();var t=this._deps.indexedDB.deleteDatabase(this.name);t.onsuccess=sn((()=>{(function({indexedDB:t,IDBKeyRange:n},e){!Fe(t)&&e!==qn&&Ne(t,n).delete(e).catch(ft)})(this._deps,this.name),e()})),t.onerror=pe(r),t.onblocked=this._fireOnBlocked};if(t)throw new ct.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 d(this._allTables).map((t=>this._allTables[t]))}transaction(){const t=He.apply(this,arguments);return this._transaction.apply(this,t)}_transaction(t,n,e){let r=Mt.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===Mn)s=Mn;else{if(t!="rw"&&t!=Nn)throw new ct.InvalidArgument("Invalid transaction mode: "+t);s=Nn}if(r){if(r.mode===Mn&&s===Nn){if(!i)throw new ct.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 ct.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)})):xn(t)}const u=Ge.bind(null,this,s,o,r,e);return r?r._promise(s,u,"lock"):Mt.trans?bn(Mt.transless,(()=>this._whenReady(u))):this._whenReady(u)}table(t){if(!g(this._allTables,t))throw new ct.InvalidTable(`Table ${t} does not exist`);return this._allTables[t]}}const lr=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable";class hr{constructor(t){this._subscribe=t}subscribe(t,n,e){return this._subscribe(t&&typeof t!="function"?t:{next:t,error:n,complete:e})}[lr](){return this}}function fr(t,n){return d(n).forEach((e=>{rr(t[e]||(t[e]=new nr),n[e])})),t}function dr(t){let n,e=!1;const r=new hr((r=>{const i=G(t);let s=!1,o={},u={};const a={get closed(){return s},unsubscribe:()=>{s=!0,ge.storagemutated.unsubscribe(f)}};r.start&&r.start(a);let c=!1,l=!1;function h(){return d(u).some((t=>o[t]&&ir(o[t],u[t])))}const f=t=>{fr(o,t),h()&&p()},p=()=>{if(c||s)return;o={};const d={},y=function(n){i&&dn();const e=()=>fn(t,{subscr:n,trans:null}),r=Mt.trans?bn(Mt.transless,e):e();return i&&r.then(pn,pn),r}(d);l||(ge(ve,f),l=!0),c=!0,Promise.resolve(y).then((t=>{e=!0,n=t,c=!1,s||(h()?p():(o={},u=d,r.next&&r.next(t)))}),(t=>{c=!1,e=!1,r.error&&r.error(t),a.unsubscribe()}))};return p(),a}));return r.hasValue=()=>e,r.getValue=()=>n,r}let pr;try{pr={indexedDB:f.indexedDB||f.mozIndexedDB||f.webkitIndexedDB||f.msIndexedDB,IDBKeyRange:f.IDBKeyRange||f.webkitIDBKeyRange}}catch{pr={indexedDB:null,IDBKeyRange:null}}const yr=cr;function vr(t){let n=wr;try{wr=!0,ge.storagemutated.fire(t)}finally{wr=n}}m(yr,{...ht,delete:t=>new yr(t,{addons:[]}).delete(),exists:t=>new yr(t,{addons:[]}).open().then((t=>(t.close(),!0))).catch("NoSuchDatabaseError",(()=>!1)),getDatabaseNames(t){try{return function({indexedDB:t,IDBKeyRange:n}){return Fe(t)?Promise.resolve(t.databases()).then((t=>t.map((t=>t.name)).filter((t=>t!==qn)))):Ne(t,n).toCollection().primaryKeys()}(yr.dependencies).then(t)}catch{return xn(new ct.MissingAPI)}},defineClass:()=>function(t){y(this,t)},ignoreTransaction:t=>Mt.trans?bn(Mt.transless,t):t(),vip:Le,async:function(t){return function(){try{var n=We(t.apply(this,arguments));return n&&typeof n.then=="function"?n:Ut.resolve(n)}catch(t){return xn(t)}}},spawn:function(t,n,e){try{var r=We(t.apply(e,n||[]));return r&&typeof r.then=="function"?r:Ut.resolve(r)}catch(t){return xn(t)}},currentTransaction:{get:()=>Mt.trans||null},waitFor:function(t,n){const e=Ut.resolve(typeof t=="function"?yr.ignoreTransaction(t):t).timeout(n||6e4);return Mt.trans?Mt.trans.waitFor(e):e},Promise:Ut,debug:{get:()=>z,set:t=>{J(t,t==="dexie"?()=>!0:_n)}},derive:$,extend:y,props:m,override:C,Events:Wn,on:ge,liveQuery:dr,extendObservabilitySet:fr,getByKeyPath:D,setByKeyPath:j,delByKeyPath:function(t,n){typeof n=="string"?j(t,n,void 0):"length"in n&&[].map.call(n,(function(n){j(t,n,void 0)}))},shallowClone:I,deepClone:M,getObjectDiff:Ye,cmp:te,asap:O,minKey:Tn,addons:[],connections:In,errnames:ut,dependencies:pr,semVer:En,version:En.split(".").map((t=>parseInt(t))).reduce(((t,n,e)=>t+n/Math.pow(10,2*e)))}),yr.maxKey=Se(yr.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(ge(ve,(t=>{if(!wr){let n;Rn?(n=document.createEvent("CustomEvent"),n.initCustomEvent(we,!0,!0,t)):n=new CustomEvent(we,{detail:t}),wr=!0,dispatchEvent(n),wr=!1}})),addEventListener(we,(({detail:t})=>{wr||vr(t)})));let wr=!1;if(typeof BroadcastChannel<"u"){const t=new BroadcastChannel(we);typeof t.unref=="function"&&t.unref(),ge(ve,(n=>{wr||t.postMessage(n)})),t.onmessage=t=>{t.data&&vr(t.data)}}else if(typeof self<"u"&&typeof navigator<"u"){ge(ve,(t=>{try{wr||(typeof localStorage<"u"&&localStorage.setItem(we,JSON.stringify({trig:Math.random(),changedParts:t})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach((n=>n.postMessage({type:we,changedParts:t}))))}catch{}})),typeof addEventListener<"u"&&addEventListener("storage",(t=>{if(t.key===we){const n=JSON.parse(t.newValue);n&&vr(n.changedParts)}}));const t=self.document&&navigator.serviceWorker;t&&t.addEventListener("message",(function({data:t}){t&&t.type===we&&vr(t.changedParts)}))}Ut.rejectionMapper=function(t,n){if(!t||t instanceof rt||t instanceof TypeError||t instanceof SyntaxError||!t.name||!lt[t.name])return t;var e=new lt[t.name](n||t.message,t);return"stack"in t&&k(e,"stack",{get:function(){return this.inner.stack}}),e},J(z,_n);class gr extends cr{constructor(){super("NylasAuthDatabase");a(this,"grant");a(this,"pkce");this.version(1).stores({grant:"++id,token",pkce:"++id,codeVerifier"}),this.grant=this.table("grant"),this.pkce=this.table("pkce")}}class mr{constructor(){a(this,"theDB");this.theDB=new gr}async setCodeVerifier(t){await this.theDB.pkce.put({id:1,codeVerifier:t},1)}async getCodeVerifier(){const[t]=await this.theDB.pkce.toArray();return t?t.codeVerifier:null}async getTokenInfo(){const t=await this.theDB.grant.get(1);return t?t.token:null}async setTokenInfo(t){await this.theDB.grant.put({id:1,token:t},1)}async reset(){await this.theDB.grant.clear()}}function br(t){const n="NylasAuth";if(!t)throw new Error("NylasAuth requires a config object");let e=null;if(t.storageType==="indexeddb"&&(e=new mr),!e)throw new Error("NylasAuth requires a storage object");const r=[{type:"read-only",value:"https://www.googleapis.com/auth/gmail.readonly"},{type:"modify",value:"https://www.googleapis.com/auth/gmail.modify"},{type:"compose",value:"https://www.googleapis.com/auth/gmail.compose"},{type:"insert",value:"https://www.googleapis.com/auth/gmail.insert"},{type:"labels",value:"https://www.googleapis.com/auth/gmail.labels"},{type:"metadata",value:"https://www.googleapis.com/auth/gmail.metadata"},{type:"settings.basic",value:"https://www.googleapis.com/auth/gmail.settings.basic"},{type:"settings.sharing",value:"https://www.googleapis.com/auth/gmail.settings.sharing"}],i=[{type:"read-only",value:"https://outlook.office.com/mail.read"},{type:"modify",value:"https://outlook.office.com/mail.readwrite"},{type:"send",value:"https://outlook.office.com/mail.send"},{type:"offline",value:"offline_access"}];async function s(r,i,s,o=!0,u,a){const c=await(e==null?void 0:e.getTokenInfo()),l=new URL(r,u??t.apiUri),h=new Headers;h.append("Accept","application/json"),h.append("Content-Type","application/json"),h.append("User-Agent",n),c&&h.append("Authorization",`Bearer ${c.access_token}`);const f=await fetch(l.toString(),{method:i||"GET",headers:h,mode:"cors",referrer:location.origin,body:s?JSON.stringify(s):void 0,...a||{}});return o?await f.json():f.body}return{config:t,async getHostedAuthRedirectURL(n=t.defaultScopes,r,i){const s=await h(Math.random().toString()),o=await h(s);await(e==null?void 0:e.setCodeVerifier(s));const u=new URL(`${t.apiUri}/v3/connect/auth`);return u.searchParams.set("client_id",t.clientId),u.searchParams.set("response_type","code"),u.searchParams.set("scope",n.join(" ")),u.searchParams.set("redirect_uri",t.redirectURI),u.searchParams.set("access_type","offline"),u.searchParams.set("code_challenge",o),u.searchParams.set("code_challenge_method","S256"),u.searchParams.set("options","rotate_refresh_token"),i&&u.searchParams.set("provider",i),r&&u.searchParams.set("login_hint",r),u.toString()},nylasAPIRequest:s,async exchangeAuthCodeForTokenInfo(n){if(!n)return null;const r=await(e==null?void 0:e.getCodeVerifier()),i=await this.nylasAPIRequest("/v3/connect/token","POST",{code:n,client_id:t.clientId,grant_type:"authorization_code",redirect_uri:t.redirectURI,code_verifier:r});return"error"in i||await(e==null?void 0:e.setTokenInfo(i)),i},async nylasDownloadFileRequest(r,i="GET",s){const o=await(e==null?void 0:e.getTokenInfo()),u=new URL(r,t.apiUri),a=new Headers;return a.append("Accept","application/json"),a.append("Content-Type","application/octet-stream"),a.append("User-Agent",n),o&&a.append("Authorization",`Bearer ${o.access_token}`),(await fetch(u.toString(),{method:i,headers:a,mode:"cors",referrer:location.origin,body:s?JSON.stringify(s):void 0})).blob()},async logout(){const t=await(e==null?void 0:e.getTokenInfo());t&&await this.nylasAPIRequest(`/v3/connect/revoke?token=${t.access_token}`,"POST"),await(e==null?void 0:e.reset())},async isAuthenticated(){return!!await(e==null?void 0:e.getTokenInfo())},async getTokenInfo(){const t=await(e==null?void 0:e.getTokenInfo());if(!t)return null;const{access_token:n,...r}=t;return r},async isAccessTokenValid(){const t=await(e==null?void 0:e.getTokenInfo());return t?"data"in await this.nylasAPIRequest(`/v3/connect/tokeninfo?id_token=${t.id_token}`,"GET"):!1},async refreshAccessToken(){const n=await(e==null?void 0:e.getTokenInfo());if(!n)return null;const r=await this.nylasAPIRequest("/v3/connect/token","POST",{client_id:t.clientId,grant_type:"refresh_token",refresh_token:n.refresh_token});return"error"in r||await(e==null?void 0:e.setTokenInfo(r)),r},async hasScopeByType(t="email",n){const s=await(e==null?void 0:e.getTokenInfo());if(!s)return!1;const o=s.scope.toLowerCase().split(" ");let u=[];const a=Array.isArray(n)?n:[n];return t==="email"&&(u=[...i,...r].filter((t=>a.includes(t.type)))),u.every((t=>o.includes(t.value)))},async hasScope(t){const n=await(e==null?void 0:e.getTokenInfo());if(!n)return!1;const r=n.scope.toLowerCase().split(" ");return(Array.isArray(t)?t:[t]).some((t=>r.includes(t.toLowerCase())))}}}export{s as N,l as X,br as e,c as n};
2
+ //# sourceMappingURL=p-189b24e6.js.map
@@ -0,0 +1,2 @@
1
+ import{r as e,h as t,H as n}from"./p-6f5a3998.js";import{R as s}from"./p-388c456c.js";import{a as i}from"./p-6b7fb948.js";import"./p-c79dcb59.js";const a=":host{display:block}div{height:inherit}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}.fade-in{animation:fadeIn 1.5s}.fade-out{animation:fadeOut 1.5s}@keyframes slideIn{0%{transform:translateY(100%)}100%{transform:translateY(0)}}@keyframes slideOut{0%{transform:translateY(0)}100%{transform:translateY(100%)}}.slide-in{animation:slideIn 1.5s}.slide-out{animation:slideOut 1.5s}@keyframes swipeIn{0%{transform:translateX(100%)}100%{transform:translateX(0)}}@keyframes swipeOut{0%{transform:translateX(0)}100%{transform:translateX(100%)}}.swipe-in{animation:swipeIn 1.5s}.swipe-out{animation:swipeOut 1.5s}";const o=a;var r=undefined&&undefined.__decorate||function(e,t,n,s){var i=arguments.length,a=i<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,n):s,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")a=Reflect.decorate(e,t,n,s);else for(var r=e.length-1;r>=0;r--)if(o=e[r])a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a;return i>3&&a&&Object.defineProperty(t,n,a),a};var f=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};const d=class{constructor(t){e(this,t);this.state=undefined;this.isStateSet=undefined;this.isBoolean=undefined;this.getStore=undefined;this.transition="none";this.show=false;this.classes={};this.initTransition=this.initTransition.bind(this)}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){i(`[nylas-if-state] Component will load`);this.watchStore(true)}async componentDidLoad(){i(`[nylas-if-state] Component did load`)}shouldRender(){const[e,t]=this.state?this.state.split("."):["",""];const n=this.getStore;if(typeof n==="undefined"){i(`[nylas-if-state] Store name: ${e} | State name: ${t}`,{getStore:n});return false}const s=n(e);if(typeof s==="undefined"){i(`[nylas-if-state] Store name: ${e} | State name: ${t}`,{store:s});return false}const a=s.state[t];if(typeof this.isStateSet==="boolean"){return this.isStateSet===false&&(typeof a==="undefined"||a===null||a.length===0)||this.isStateSet===true&&typeof a!=="undefined"&&a!==null}if(typeof this.isBoolean==="boolean"){return this.isBoolean===true&&typeof a!=="undefined"&&a===true||this.isBoolean===false&&typeof a!=="undefined"&&a===false}return false}onGetStoreChange(){this.watchStore(true)}watchStore(e=false){const[t,n]=this.state?this.state.split("."):["",""];const s=this.getStore;if(typeof s==="undefined"){i(`[nylas-if-state] Store name: ${t} | State name: ${n}`,{getStore:s});return null}const a=s(t);if(typeof a==="undefined"){i(`[nylas-if-state] Store name: ${t} | State name: ${n}`,{store:a});return null}if(e===true){this.initTransition()}a.onChange(n,this.initTransition)}initTransition(){const e=this.shouldRender();switch(this.transition){case"fade":case"slide":case"swipe":this.classes={[`${this.transition}-in`]:e,[`${this.transition}-out`]:!e};setTimeout((()=>{this.show=e}),150);break;default:this.show=this.shouldRender();break}}render(){return t(n,{key:"38321c4fa1d8c27d1d212c23d1a30b3c03be33a4"},t("div",{key:"eeaddfba88d99a7542cfaff75be7e279b456b812",class:this.classes},this.show&&t("slot",null)))}static get watchers(){return{getStore:["onGetStoreChange"]}}};r([s({name:"nylas-if-state",getStoresToProp:"getStore",fireRegisterEvent:true}),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",void 0)],d.prototype,"render",null);d.style=o;export{d as nylas_if_state};
2
+ //# sourceMappingURL=p-1cbe8a56.entry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["nylasIfStateCss","NylasIfStateStyle0","NylasIfState","constructor","hostRef","this","initTransition","bind","connectedCallback","disconnectedCallback","componentWillLoad","debug","watchStore","componentDidLoad","shouldRender","storeName","stateName","state","split","getStore","store","isStateSet","length","isBoolean","onGetStoreChange","immediate","onChange","show","transition","classes","setTimeout","render","h","Host","key","class","__decorate","RegisterComponent","name","getStoresToProp","fireRegisterEvent"],"sources":["src/components/nylas-if-state/nylas-if-state.css?tag=nylas-if-state&encapsulation=shadow","src/components/nylas-if-state/nylas-if-state.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\ndiv {\n height: inherit;\n}\n\n@keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n@keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n}\n.fade-in {\n animation: fadeIn 1.5s;\n}\n\n.fade-out {\n animation: fadeOut 1.5s;\n}\n\n@keyframes slideIn {\n 0% {\n transform: translateY(100%);\n }\n 100% {\n transform: translateY(0);\n }\n}\n\n@keyframes slideOut {\n 0% {\n transform: translateY(0);\n }\n 100% {\n transform: translateY(100%);\n }\n}\n\n.slide-in {\n animation: slideIn 1.5s;\n}\n\n.slide-out {\n animation: slideOut 1.5s;\n}\n\n@keyframes swipeIn {\n 0% {\n transform: translateX(100%);\n }\n 100% {\n transform: translateX(0);\n }\n}\n\n@keyframes swipeOut {\n 0% {\n transform: translateX(0);\n }\n 100% {\n transform: translateX(100%);\n }\n}\n\n.swipe-in {\n animation: swipeIn 1.5s;\n}\n\n.swipe-out {\n animation: swipeOut 1.5s;\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { debug } from '@/utils/utils';\nimport { Component, Host, Prop, State, Watch, h } from '@stencil/core';\nimport { ObservableMap } from '@stencil/store';\n\nexport type Stores = Record<string, ObservableMap<any>>;\n\nexport type Transitions = 'none' | 'fade' | 'slide' | 'swipe';\n\n@Component({\n tag: 'nylas-if-state',\n styleUrl: 'nylas-if-state.css',\n shadow: true,\n})\nexport class NylasIfState {\n /**\n * The name of the state to watch.\n */\n @Prop() readonly state?: string;\n /**\n * If true, then the component will render if the state is set (empty or not set).\n * This prop is used with the `state` prop.\n */\n @Prop() readonly isStateSet?: boolean;\n /**\n * If true, then the component will render if the state is true.\n * This prop is used with the `state` prop.\n */\n @Prop() readonly isBoolean?: boolean;\n @Prop() readonly getStore?: <K extends keyof Stores>(name: K) => Stores[K];\n @Prop() readonly transition: Transitions = 'none';\n\n @State() show: boolean = false;\n @State() classes: Record<string, boolean> = {};\n\n constructor() {\n this.initTransition = this.initTransition.bind(this);\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {}\n\n async componentWillLoad() {\n debug(`[nylas-if-state] Component will load`);\n this.watchStore(true);\n }\n\n async componentDidLoad() {\n debug(`[nylas-if-state] Component did load`);\n }\n\n private shouldRender() {\n // If a period exists in the state name, then we need to split the state name into the store name and the state name.\n // For example, if the state name is `nylas.scheduler.selectableDates`, then the store name is `nylas` and the state name is `scheduler.selectableDates`.\n const [storeName, stateName] = this.state ? this.state.split('.') : ['', ''];\n const getStore = this.getStore;\n if (typeof getStore === 'undefined') {\n debug(`[nylas-if-state] Store name: ${storeName} | State name: ${stateName}`, { getStore });\n return false;\n }\n\n const store = getStore(storeName as keyof Stores);\n if (typeof store === 'undefined') {\n debug(`[nylas-if-state] Store name: ${storeName} | State name: ${stateName}`, { store });\n return false;\n }\n\n const state = store.state[stateName as string];\n\n if (typeof this.isStateSet === 'boolean') {\n return (\n (this.isStateSet === false && (typeof state === 'undefined' || state === null || state.length === 0)) ||\n (this.isStateSet === true && typeof state !== 'undefined' && state !== null)\n );\n }\n\n if (typeof this.isBoolean === 'boolean') {\n return (this.isBoolean === true && typeof state !== 'undefined' && state === true) || (this.isBoolean === false && typeof state !== 'undefined' && state === false);\n }\n\n return false;\n }\n\n @Watch('getStore')\n onGetStoreChange() {\n this.watchStore(true);\n }\n\n private watchStore(immediate: boolean = false) {\n // If a period exists in the state name, then we need to split the state name into the store name and the state name.\n // For example, if the state name is `nylas.scheduler.selectableDates`, then the store name is `nylas` and the state name is `scheduler.selectableDates`.\n const [storeName, stateName] = this.state ? this.state.split('.') : ['', ''];\n const getStore = this.getStore;\n if (typeof getStore === 'undefined') {\n debug(`[nylas-if-state] Store name: ${storeName} | State name: ${stateName}`, { getStore });\n return null;\n }\n\n const store = getStore(storeName as keyof Stores);\n if (typeof store === 'undefined') {\n debug(`[nylas-if-state] Store name: ${storeName} | State name: ${stateName}`, { store });\n return null;\n }\n\n if (immediate === true) {\n this.initTransition();\n }\n\n store.onChange(stateName as string, this.initTransition);\n }\n\n private initTransition() {\n const show = this.shouldRender();\n switch (this.transition) {\n case 'fade':\n case 'slide':\n case 'swipe':\n this.classes = {\n [`${this.transition}-in`]: show,\n [`${this.transition}-out`]: !show,\n };\n setTimeout(() => {\n this.show = show;\n }, 150);\n break;\n default:\n this.show = this.shouldRender();\n break;\n }\n }\n\n @RegisterComponent({\n name: 'nylas-if-state',\n getStoresToProp: 'getStore',\n fireRegisterEvent: true,\n })\n render() {\n return (\n <Host>\n <div class={this.classes}>{this.show && <slot></slot>}</div>\n </Host>\n );\n }\n}\n"],"mappings":"6IAAA,MAAMA,EAAkB,+oBACxB,MAAAC,EAAeD,E,ugBCaFE,EAAY,MAqBvB,WAAAC,CAAAC,G,0HAL2C,O,UAElB,M,aACmB,GAG1CC,KAAKC,eAAiBD,KAAKC,eAAeC,KAAKF,K,CAGjD,iBAAAG,GAAiB,CAEjB,oBAAAC,GAAoB,CAEpB,uBAAMC,GACJC,EAAM,wCACNN,KAAKO,WAAW,K,CAGlB,sBAAMC,GACJF,EAAM,sC,CAGA,YAAAG,GAGN,MAAOC,EAAWC,GAAaX,KAAKY,MAAQZ,KAAKY,MAAMC,MAAM,KAAO,CAAC,GAAI,IACzE,MAAMC,EAAWd,KAAKc,SACtB,UAAWA,IAAa,YAAa,CACnCR,EAAM,gCAAgCI,mBAA2BC,IAAa,CAAEG,aAChF,OAAO,K,CAGT,MAAMC,EAAQD,EAASJ,GACvB,UAAWK,IAAU,YAAa,CAChCT,EAAM,gCAAgCI,mBAA2BC,IAAa,CAAEI,UAChF,OAAO,K,CAGT,MAAMH,EAAQG,EAAMH,MAAMD,GAE1B,UAAWX,KAAKgB,aAAe,UAAW,CACxC,OACGhB,KAAKgB,aAAe,eAAiBJ,IAAU,aAAeA,IAAU,MAAQA,EAAMK,SAAW,IACjGjB,KAAKgB,aAAe,aAAeJ,IAAU,aAAeA,IAAU,I,CAI3E,UAAWZ,KAAKkB,YAAc,UAAW,CACvC,OAAQlB,KAAKkB,YAAc,aAAeN,IAAU,aAAeA,IAAU,MAAUZ,KAAKkB,YAAc,cAAgBN,IAAU,aAAeA,IAAU,K,CAG/J,OAAO,K,CAIT,gBAAAO,GACEnB,KAAKO,WAAW,K,CAGV,UAAAA,CAAWa,EAAqB,OAGtC,MAAOV,EAAWC,GAAaX,KAAKY,MAAQZ,KAAKY,MAAMC,MAAM,KAAO,CAAC,GAAI,IACzE,MAAMC,EAAWd,KAAKc,SACtB,UAAWA,IAAa,YAAa,CACnCR,EAAM,gCAAgCI,mBAA2BC,IAAa,CAAEG,aAChF,OAAO,I,CAGT,MAAMC,EAAQD,EAASJ,GACvB,UAAWK,IAAU,YAAa,CAChCT,EAAM,gCAAgCI,mBAA2BC,IAAa,CAAEI,UAChF,OAAO,I,CAGT,GAAIK,IAAc,KAAM,CACtBpB,KAAKC,gB,CAGPc,EAAMM,SAASV,EAAqBX,KAAKC,e,CAGnC,cAAAA,GACN,MAAMqB,EAAOtB,KAAKS,eAClB,OAAQT,KAAKuB,YACX,IAAK,OACL,IAAK,QACL,IAAK,QACHvB,KAAKwB,QAAU,CACb,CAAC,GAAGxB,KAAKuB,iBAAkBD,EAC3B,CAAC,GAAGtB,KAAKuB,mBAAoBD,GAE/BG,YAAW,KACTzB,KAAKsB,KAAOA,CAAI,GACf,KACH,MACF,QACEtB,KAAKsB,KAAOtB,KAAKS,eACjB,M,CASN,MAAAiB,GACE,OACEC,EAACC,EAAI,CAAAC,IAAA,4CACHF,EAAA,OAAAE,IAAA,2CAAKC,MAAO9B,KAAKwB,SAAUxB,KAAKsB,MAAQK,EAAA,c,+DAH9CI,EAAA,CALCC,EAAkB,CACjBC,KAAM,iBACNC,gBAAiB,WACjBC,kBAAmB,O"}
1
+ {"version":3,"names":["nylasIfStateCss","NylasIfStateStyle0","NylasIfState","constructor","hostRef","this","initTransition","bind","connectedCallback","disconnectedCallback","componentWillLoad","debug","watchStore","componentDidLoad","shouldRender","storeName","stateName","state","split","getStore","store","isStateSet","length","isBoolean","onGetStoreChange","immediate","onChange","show","transition","classes","setTimeout","render","h","Host","key","class","__decorate","RegisterComponent","name","getStoresToProp","fireRegisterEvent"],"sources":["src/components/nylas-if-state/nylas-if-state.css?tag=nylas-if-state&encapsulation=shadow","src/components/nylas-if-state/nylas-if-state.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\ndiv {\n height: inherit;\n}\n\n@keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n@keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n}\n.fade-in {\n animation: fadeIn 1.5s;\n}\n\n.fade-out {\n animation: fadeOut 1.5s;\n}\n\n@keyframes slideIn {\n 0% {\n transform: translateY(100%);\n }\n 100% {\n transform: translateY(0);\n }\n}\n\n@keyframes slideOut {\n 0% {\n transform: translateY(0);\n }\n 100% {\n transform: translateY(100%);\n }\n}\n\n.slide-in {\n animation: slideIn 1.5s;\n}\n\n.slide-out {\n animation: slideOut 1.5s;\n}\n\n@keyframes swipeIn {\n 0% {\n transform: translateX(100%);\n }\n 100% {\n transform: translateX(0);\n }\n}\n\n@keyframes swipeOut {\n 0% {\n transform: translateX(0);\n }\n 100% {\n transform: translateX(100%);\n }\n}\n\n.swipe-in {\n animation: swipeIn 1.5s;\n}\n\n.swipe-out {\n animation: swipeOut 1.5s;\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { debug } from '@/utils/utils';\nimport { Component, Host, Prop, State, Watch, h } from '@stencil/core';\nimport { ObservableMap } from '@stencil/store';\n\nexport type Stores = Record<string, ObservableMap<any>>;\n\nexport type Transitions = 'none' | 'fade' | 'slide' | 'swipe';\n\n@Component({\n tag: 'nylas-if-state',\n styleUrl: 'nylas-if-state.css',\n shadow: true,\n})\nexport class NylasIfState {\n /**\n * The name of the state to watch.\n */\n @Prop() readonly state?: string;\n /**\n * If true, then the component will render if the state is set (empty or not set).\n * This prop is used with the `state` prop.\n */\n @Prop() readonly isStateSet?: boolean;\n /**\n * If true, then the component will render if the state is true.\n * This prop is used with the `state` prop.\n */\n @Prop() readonly isBoolean?: boolean;\n @Prop() readonly getStore?: <K extends keyof Stores>(name: K) => Stores[K];\n @Prop() readonly transition: Transitions = 'none';\n\n @State() show: boolean = false;\n @State() classes: Record<string, boolean> = {};\n\n constructor() {\n this.initTransition = this.initTransition.bind(this);\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {}\n\n async componentWillLoad() {\n debug(`[nylas-if-state] Component will load`);\n this.watchStore(true);\n }\n\n async componentDidLoad() {\n debug(`[nylas-if-state] Component did load`);\n }\n\n private shouldRender() {\n // If a period exists in the state name, then we need to split the state name into the store name and the state name.\n // For example, if the state name is `nylas.scheduler.selectableDates`, then the store name is `nylas` and the state name is `scheduler.selectableDates`.\n const [storeName, stateName] = this.state ? this.state.split('.') : ['', ''];\n const getStore = this.getStore;\n if (typeof getStore === 'undefined') {\n debug(`[nylas-if-state] Store name: ${storeName} | State name: ${stateName}`, { getStore });\n return false;\n }\n\n const store = getStore(storeName as keyof Stores);\n if (typeof store === 'undefined') {\n debug(`[nylas-if-state] Store name: ${storeName} | State name: ${stateName}`, { store });\n return false;\n }\n\n const state = store.state[stateName as string];\n\n if (typeof this.isStateSet === 'boolean') {\n return (\n (this.isStateSet === false && (typeof state === 'undefined' || state === null || state.length === 0)) ||\n (this.isStateSet === true && typeof state !== 'undefined' && state !== null)\n );\n }\n\n if (typeof this.isBoolean === 'boolean') {\n return (this.isBoolean === true && typeof state !== 'undefined' && state === true) || (this.isBoolean === false && typeof state !== 'undefined' && state === false);\n }\n\n return false;\n }\n\n @Watch('getStore')\n onGetStoreChange() {\n this.watchStore(true);\n }\n\n private watchStore(immediate: boolean = false) {\n // If a period exists in the state name, then we need to split the state name into the store name and the state name.\n // For example, if the state name is `nylas.scheduler.selectableDates`, then the store name is `nylas` and the state name is `scheduler.selectableDates`.\n const [storeName, stateName] = this.state ? this.state.split('.') : ['', ''];\n const getStore = this.getStore;\n if (typeof getStore === 'undefined') {\n debug(`[nylas-if-state] Store name: ${storeName} | State name: ${stateName}`, { getStore });\n return null;\n }\n\n const store = getStore(storeName as keyof Stores);\n if (typeof store === 'undefined') {\n debug(`[nylas-if-state] Store name: ${storeName} | State name: ${stateName}`, { store });\n return null;\n }\n\n if (immediate === true) {\n this.initTransition();\n }\n\n store.onChange(stateName as string, this.initTransition);\n }\n\n private initTransition() {\n const show = this.shouldRender();\n switch (this.transition) {\n case 'fade':\n case 'slide':\n case 'swipe':\n this.classes = {\n [`${this.transition}-in`]: show,\n [`${this.transition}-out`]: !show,\n };\n setTimeout(() => {\n this.show = show;\n }, 150);\n break;\n default:\n this.show = this.shouldRender();\n break;\n }\n }\n\n @RegisterComponent({\n name: 'nylas-if-state',\n getStoresToProp: 'getStore',\n fireRegisterEvent: true,\n })\n render() {\n return (\n <Host>\n <div class={this.classes}>{this.show && <slot></slot>}</div>\n </Host>\n );\n }\n}\n"],"mappings":"kJAAA,MAAMA,EAAkB,+oBACxB,MAAAC,EAAeD,E,ugBCaFE,EAAY,MAqBvB,WAAAC,CAAAC,G,0HAL2C,O,UAElB,M,aACmB,GAG1CC,KAAKC,eAAiBD,KAAKC,eAAeC,KAAKF,K,CAGjD,iBAAAG,GAAiB,CAEjB,oBAAAC,GAAoB,CAEpB,uBAAMC,GACJC,EAAM,wCACNN,KAAKO,WAAW,K,CAGlB,sBAAMC,GACJF,EAAM,sC,CAGA,YAAAG,GAGN,MAAOC,EAAWC,GAAaX,KAAKY,MAAQZ,KAAKY,MAAMC,MAAM,KAAO,CAAC,GAAI,IACzE,MAAMC,EAAWd,KAAKc,SACtB,UAAWA,IAAa,YAAa,CACnCR,EAAM,gCAAgCI,mBAA2BC,IAAa,CAAEG,aAChF,OAAO,K,CAGT,MAAMC,EAAQD,EAASJ,GACvB,UAAWK,IAAU,YAAa,CAChCT,EAAM,gCAAgCI,mBAA2BC,IAAa,CAAEI,UAChF,OAAO,K,CAGT,MAAMH,EAAQG,EAAMH,MAAMD,GAE1B,UAAWX,KAAKgB,aAAe,UAAW,CACxC,OACGhB,KAAKgB,aAAe,eAAiBJ,IAAU,aAAeA,IAAU,MAAQA,EAAMK,SAAW,IACjGjB,KAAKgB,aAAe,aAAeJ,IAAU,aAAeA,IAAU,I,CAI3E,UAAWZ,KAAKkB,YAAc,UAAW,CACvC,OAAQlB,KAAKkB,YAAc,aAAeN,IAAU,aAAeA,IAAU,MAAUZ,KAAKkB,YAAc,cAAgBN,IAAU,aAAeA,IAAU,K,CAG/J,OAAO,K,CAIT,gBAAAO,GACEnB,KAAKO,WAAW,K,CAGV,UAAAA,CAAWa,EAAqB,OAGtC,MAAOV,EAAWC,GAAaX,KAAKY,MAAQZ,KAAKY,MAAMC,MAAM,KAAO,CAAC,GAAI,IACzE,MAAMC,EAAWd,KAAKc,SACtB,UAAWA,IAAa,YAAa,CACnCR,EAAM,gCAAgCI,mBAA2BC,IAAa,CAAEG,aAChF,OAAO,I,CAGT,MAAMC,EAAQD,EAASJ,GACvB,UAAWK,IAAU,YAAa,CAChCT,EAAM,gCAAgCI,mBAA2BC,IAAa,CAAEI,UAChF,OAAO,I,CAGT,GAAIK,IAAc,KAAM,CACtBpB,KAAKC,gB,CAGPc,EAAMM,SAASV,EAAqBX,KAAKC,e,CAGnC,cAAAA,GACN,MAAMqB,EAAOtB,KAAKS,eAClB,OAAQT,KAAKuB,YACX,IAAK,OACL,IAAK,QACL,IAAK,QACHvB,KAAKwB,QAAU,CACb,CAAC,GAAGxB,KAAKuB,iBAAkBD,EAC3B,CAAC,GAAGtB,KAAKuB,mBAAoBD,GAE/BG,YAAW,KACTzB,KAAKsB,KAAOA,CAAI,GACf,KACH,MACF,QACEtB,KAAKsB,KAAOtB,KAAKS,eACjB,M,CASN,MAAAiB,GACE,OACEC,EAACC,EAAI,CAAAC,IAAA,4CACHF,EAAA,OAAAE,IAAA,2CAAKC,MAAO9B,KAAKwB,SAAUxB,KAAKsB,MAAQK,EAAA,c,+DAH9CI,EAAA,CALCC,EAAkB,CACjBC,KAAM,iBACNC,gBAAiB,WACjBC,kBAAmB,O"}