camera.ui3 0.0.30-alpha.1 → 0.0.30-alpha.3

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 (119) hide show
  1. package/dist/interface/@camera.ui.DuwfK59t.0.0.30-alpha.3.js +3 -0
  2. package/dist/interface/{@tanstack.CTzdjGxD.0.0.30-alpha.0.js → @tanstack.DBBaUHTS.0.0.30-alpha.3.js} +1 -1
  3. package/dist/interface/{@vee-validate.BJKTyKHK.0.0.30-alpha.0.js → @vee-validate.BRR3_tWq.0.0.30-alpha.3.js} +1 -1
  4. package/dist/interface/{@vueform.DIw88mcs.0.0.30-alpha.0.js → @vueform.Dcx-RQUw.0.0.30-alpha.3.js} +1 -1
  5. package/dist/interface/{@vueuse.DK7Mz0BT.0.0.30-alpha.0.js → @vueuse.Sz46sDez.0.0.30-alpha.3.js} +1 -1
  6. package/dist/interface/{Account.D23CSQgK.0.0.30-alpha.0.js → Account.hmetZWTc.0.0.30-alpha.3.js} +1 -1
  7. package/dist/interface/{Adminpanel.CbDtQWxn.0.0.30-alpha.0.js → Adminpanel.DxC80W0K.0.0.30-alpha.3.js} +2 -2
  8. package/dist/interface/{Appearance.az1S-8rV.0.0.30-alpha.0.js → Appearance.BHZdWQlZ.0.0.30-alpha.3.js} +1 -1
  9. package/dist/interface/{Backup.BxjbY7JO.0.0.30-alpha.0.js → Backup.petPSq60.0.0.30-alpha.3.js} +1 -1
  10. package/dist/interface/{Camera.CWxxie6C.0.0.30-alpha.0.js → Camera.DS7gbgwV.0.0.30-alpha.3.js} +1 -1
  11. package/dist/interface/{Cameras.Cs1dXd-W.0.0.30-alpha.0.js → Cameras.eqceAkdR.0.0.30-alpha.3.js} +1 -1
  12. package/dist/interface/{Camview.uyIq-pxm.0.0.30-alpha.0.js → Camview.DumV6nmv.0.0.30-alpha.3.js} +1 -1
  13. package/dist/interface/{Config.DnuL5NIv.0.0.30-alpha.0.js → Config.DQ5vyHcx.0.0.30-alpha.3.js} +1 -1
  14. package/dist/interface/{Console.C1dI5f9x.0.0.30-alpha.0.js → Console.CWp-LL5w.0.0.30-alpha.3.js} +1 -1
  15. package/dist/interface/{FirstSteps.C_TTm4lX.0.0.30-alpha.0.js → FirstSteps.DR2B1Gmx.0.0.30-alpha.3.js} +1 -1
  16. package/dist/interface/{NewCamera.DjMFd-OB.0.0.30-alpha.0.js → NewCamera.CpENkWIP.0.0.30-alpha.3.js} +1 -1
  17. package/dist/interface/{Plugin.rLO6u13g.0.0.30-alpha.0.js → Plugin.KK2gWYUL.0.0.30-alpha.3.js} +1 -1
  18. package/dist/interface/{Plugins.Dr-sUa9o.0.0.30-alpha.0.js → Plugins.Dy1rL-Pc.0.0.30-alpha.3.js} +1 -1
  19. package/dist/interface/Recordings.Bny11D38.0.0.30-alpha.3.js +1 -0
  20. package/dist/interface/Recordings.IdGxswmI.0.0.30-alpha.3.js +1 -0
  21. package/dist/interface/{Settings.DAletWZO.0.0.30-alpha.0.js → Settings.D6l7BlOF.0.0.30-alpha.3.js} +1 -1
  22. package/dist/interface/{System.Pv01yz8u.0.0.30-alpha.0.js → System.FIkCpF0A.0.0.30-alpha.3.js} +1 -1
  23. package/dist/interface/{User.VLcbTFm_.0.0.30-alpha.0.js → User.By9sAd8k.0.0.30-alpha.3.js} +1 -1
  24. package/dist/interface/{VConfigEditor.vue_vue_type_script_setup_true_lang.pXHIBxVl.0.0.30-alpha.0.js → VConfigEditor.vue_vue_type_script_setup_true_lang.C7ZcC7dX.0.0.30-alpha.3.js} +2 -2
  25. package/dist/interface/{VConsole.BUZLhyeb.0.0.30-alpha.0.js → VConsole.BG4nEIk8.0.0.30-alpha.3.js} +1 -1
  26. package/dist/interface/{VPlayer.DW5rNren.0.0.30-alpha.0.js → VPlayer.CZqXCM-i.0.0.30-alpha.3.js} +1 -1
  27. package/dist/interface/{VPluginCard.D5f85QIk.0.0.30-alpha.0.js → VPluginCard.B_M3puzM.0.0.30-alpha.3.js} +1 -1
  28. package/dist/interface/{ace-builds.SRW0xGs1.0.0.30-alpha.0.js → ace-builds.D4S-MJ6b.0.0.30-alpha.3.js} +1 -1
  29. package/dist/interface/{apexcharts.BV8prH5x.0.0.30-alpha.0.js → apexcharts.u0duws01.0.0.30-alpha.3.js} +1 -1
  30. package/dist/interface/{dnd-core.BdsXoke-.0.0.30-alpha.0.js → dnd-core.C4232Xyz.0.0.30-alpha.3.js} +1 -1
  31. package/dist/interface/{draggabilly.D9j4BYFu.0.0.30-alpha.0.js → draggabilly.Xgwn1bT3.0.0.30-alpha.3.js} +1 -1
  32. package/dist/interface/{engine.io-client.di4Pt8W8.0.0.30-alpha.0.js → engine.io-client.CUastNh3.0.0.30-alpha.3.js} +1 -1
  33. package/dist/interface/{ev-emitter.Dxl4QoSg.0.0.30-alpha.0.js → ev-emitter.BYRnnQXb.0.0.30-alpha.3.js} +1 -1
  34. package/dist/interface/{fast-deep-equal.BUna8KlC.0.0.30-alpha.0.js → fast-deep-equal.CqwdqDxW.0.0.30-alpha.3.js} +1 -1
  35. package/dist/interface/{highlight.js.CMosnU3p.0.0.30-alpha.0.js → highlight.js.sNLmnsuC.0.0.30-alpha.3.js} +1 -1
  36. package/dist/interface/index.html +34 -34
  37. package/dist/interface/{linkify-it.B9RFwlcp.0.0.30-alpha.0.js → linkify-it.8PrPWg7W.0.0.30-alpha.3.js} +1 -1
  38. package/dist/interface/{main.CNzh1Rg5.0.0.30-alpha.0.js → main.gxLiydtV.0.0.30-alpha.3.js} +2 -2
  39. package/dist/interface/{markdown-it.DAiultxC.0.0.30-alpha.0.js → markdown-it.Q4_2MGLy.0.0.30-alpha.3.js} +1 -1
  40. package/dist/interface/{nprogress.C2KbBHcZ.0.0.30-alpha.0.js → nprogress.DQYtKLt9.0.0.30-alpha.3.js} +1 -1
  41. package/dist/interface/{pinia.BPnxDxQ3.0.0.30-alpha.0.js → pinia.DcgsdRJU.0.0.30-alpha.3.js} +1 -1
  42. package/dist/interface/{plugins.DIEspWyc.0.0.30-alpha.0.js → plugins.DZjXmoDp.0.0.30-alpha.3.js} +1 -1
  43. package/dist/interface/{qrcode.DrYVb5am.0.0.30-alpha.0.js → qrcode.XqSuoGPb.0.0.30-alpha.3.js} +1 -1
  44. package/dist/interface/{react-dnd-touch-backend.ByHGbrKq.0.0.30-alpha.0.js → react-dnd-touch-backend.VzlzWkdX.0.0.30-alpha.3.js} +1 -1
  45. package/dist/interface/{rxjs.Dl5P76vZ.0.0.30-alpha.0.js → rxjs.CXnJywSk.0.0.30-alpha.3.js} +1 -1
  46. package/dist/interface/{socket.io-client.Cf7ABgrO.0.0.30-alpha.0.js → socket.io-client.DiiooL5k.0.0.30-alpha.3.js} +1 -1
  47. package/dist/interface/{socket.io-parser.DHnwqfTj.0.0.30-alpha.0.js → socket.io-parser.Dsh2ZviN.0.0.30-alpha.3.js} +1 -1
  48. package/dist/interface/sw.js +1 -1
  49. package/dist/interface/{system.23ZKsQ9W.0.0.30-alpha.0.js → system.Bh4wNIkr.0.0.30-alpha.3.js} +1 -1
  50. package/dist/interface/{ui.9t-Av5-L.0.0.30-alpha.0.js → ui.B0YwbqBU.0.0.30-alpha.3.js} +1 -1
  51. package/dist/interface/{unidragger.zHlf1Df_.0.0.30-alpha.0.js → unidragger.DDL70rPA.0.0.30-alpha.3.js} +1 -1
  52. package/dist/interface/utils.mAKpSMLY.0.0.30-alpha.3.js +1 -0
  53. package/dist/interface/{v-calendar.u5cKUC4g.0.0.30-alpha.0.js → v-calendar.C8Yj7x1Q.0.0.30-alpha.3.js} +1 -1
  54. package/dist/interface/{vee-validate.DLoDjJ2f.0.0.30-alpha.0.js → vee-validate.BbcoErf-.0.0.30-alpha.3.js} +1 -1
  55. package/dist/interface/{vue-i18n.1W5jhc7l.0.0.30-alpha.0.js → vue-i18n.B7m8y9GA.0.0.30-alpha.3.js} +1 -1
  56. package/dist/interface/{vue-inline-svg.Cc6uL4nI.0.0.30-alpha.0.js → vue-inline-svg.DC2U7Qim.0.0.30-alpha.3.js} +1 -1
  57. package/dist/interface/{vue-router.CgUDt9kL.0.0.30-alpha.0.js → vue-router.B3QeItm5.0.0.30-alpha.3.js} +1 -1
  58. package/dist/interface/{vue3-apexcharts.D8ONfVUq.0.0.30-alpha.0.js → vue3-apexcharts.DVzl7xGy.0.0.30-alpha.3.js} +1 -1
  59. package/dist/interface/{vue3-dnd.V9l5pvP2.0.0.30-alpha.0.js → vue3-dnd.76cFMD9V.0.0.30-alpha.3.js} +1 -1
  60. package/dist/interface/{vue3-toastify.CjNgo6aC.0.0.30-alpha.0.js → vue3-toastify.B-AJ7WuP.0.0.30-alpha.3.js} +1 -1
  61. package/dist/interface/{vuetify.Box3fVLm.0.0.30-alpha.0.js → vuetify.CYln2r6g.0.0.30-alpha.3.js} +1 -1
  62. package/dist/server/package.json +2 -2
  63. package/package.json +2 -2
  64. package/dist/interface/@camera.ui.KA9bRSoR.0.0.30-alpha.0.js +0 -3
  65. package/dist/interface/Recordings.4iG-hK8g.0.0.30-alpha.0.js +0 -1
  66. package/dist/interface/Recordings.Dxh2d-IQ.0.0.30-alpha.0.js +0 -1
  67. package/dist/interface/utils.BvINh1mj.0.0.30-alpha.0.js +0 -1
  68. /package/dist/interface/{@babel.l0sNRNKZ.0.0.30-alpha.0.js → @babel.l0sNRNKZ.0.0.30-alpha.3.js} +0 -0
  69. /package/dist/interface/{@intlify.YW_pt133.0.0.30-alpha.0.js → @intlify.YW_pt133.0.0.30-alpha.3.js} +0 -0
  70. /package/dist/interface/{@mdi.DnMbZhUH.0.0.30-alpha.0.js → @mdi.DnMbZhUH.0.0.30-alpha.3.js} +0 -0
  71. /package/dist/interface/{@popperjs.BQBsAJpH.0.0.30-alpha.0.js → @popperjs.BQBsAJpH.0.0.30-alpha.3.js} +0 -0
  72. /package/dist/interface/{@react-dnd.CcwRs9xb.0.0.30-alpha.0.js → @react-dnd.CcwRs9xb.0.0.30-alpha.3.js} +0 -0
  73. /package/dist/interface/{@socket.io.Dkula2eQ.0.0.30-alpha.0.js → @socket.io.Dkula2eQ.0.0.30-alpha.3.js} +0 -0
  74. /package/dist/interface/{@vue.BeJw0wEm.0.0.30-alpha.0.js → @vue.BeJw0wEm.0.0.30-alpha.3.js} +0 -0
  75. /package/dist/interface/{@xterm.CnserxUX.0.0.30-alpha.0.js → @xterm.-WsTvn6n.0.0.30-alpha.3.js} +0 -0
  76. /package/dist/interface/assets/{@vueform.0.0.30-alpha.0.h7tNX9p6.css → @vueform.0.0.30-alpha.3.h7tNX9p6.css} +0 -0
  77. /package/dist/interface/assets/{@xterm.0.0.30-alpha.0.CGrrDQr5.css → @xterm.0.0.30-alpha.3.CGrrDQr5.css} +0 -0
  78. /package/dist/interface/assets/{Account.0.0.30-alpha.0.Ce3OmKrC.css → Account.0.0.30-alpha.3.Ce3OmKrC.css} +0 -0
  79. /package/dist/interface/assets/{Adminpanel.0.0.30-alpha.0.CXsTAXPL.css → Adminpanel.0.0.30-alpha.3.CXsTAXPL.css} +0 -0
  80. /package/dist/interface/assets/{Backup.0.0.30-alpha.0.BIwaSlv3.css → Backup.0.0.30-alpha.3.BIwaSlv3.css} +0 -0
  81. /package/dist/interface/assets/{Camera.0.0.30-alpha.0.BDtUJ-lA.css → Camera.0.0.30-alpha.3.BDtUJ-lA.css} +0 -0
  82. /package/dist/interface/assets/{Cameras.0.0.30-alpha.0.Djx0F2MM.css → Cameras.0.0.30-alpha.3.Djx0F2MM.css} +0 -0
  83. /package/dist/interface/assets/{Camview.0.0.30-alpha.0.Ce_V-Nxj.css → Camview.0.0.30-alpha.3.Ce_V-Nxj.css} +0 -0
  84. /package/dist/interface/assets/{Config.0.0.30-alpha.0.k4QpWumg.css → Config.0.0.30-alpha.3.k4QpWumg.css} +0 -0
  85. /package/dist/interface/assets/{Console.0.0.30-alpha.0.DWrfRWs9.css → Console.0.0.30-alpha.3.DWrfRWs9.css} +0 -0
  86. /package/dist/interface/assets/{FirstSteps.0.0.30-alpha.0.B3-pv8-a.css → FirstSteps.0.0.30-alpha.3.B3-pv8-a.css} +0 -0
  87. /package/dist/interface/assets/{NewCamera.0.0.30-alpha.0.DJ3tUBT_.css → NewCamera.0.0.30-alpha.3.DJ3tUBT_.css} +0 -0
  88. /package/dist/interface/assets/{Plugin.0.0.30-alpha.0.BtRA6zDt.css → Plugin.0.0.30-alpha.3.BtRA6zDt.css} +0 -0
  89. /package/dist/interface/assets/{Plugins.0.0.30-alpha.0.Cwu0aGUO.css → Plugins.0.0.30-alpha.3.Cwu0aGUO.css} +0 -0
  90. /package/dist/interface/assets/{Settings.0.0.30-alpha.0.DC_-E3CR.css → Settings.0.0.30-alpha.3.DC_-E3CR.css} +0 -0
  91. /package/dist/interface/assets/{User.0.0.30-alpha.0.DPDcJbx8.css → User.0.0.30-alpha.3.DPDcJbx8.css} +0 -0
  92. /package/dist/interface/assets/{VConsole.0.0.30-alpha.0.BZT1WyS-.css → VConsole.0.0.30-alpha.3.BZT1WyS-.css} +0 -0
  93. /package/dist/interface/assets/{VPlayer.0.0.30-alpha.0.CZXlTn4I.css → VPlayer.0.0.30-alpha.3.CZXlTn4I.css} +0 -0
  94. /package/dist/interface/assets/{VPluginCard.0.0.30-alpha.0.CIL48ca_.css → VPluginCard.0.0.30-alpha.3.CIL48ca_.css} +0 -0
  95. /package/dist/interface/assets/{highlight.0.0.30-alpha.0.DgoK_Xib.css → highlight.0.0.30-alpha.3.DgoK_Xib.css} +0 -0
  96. /package/dist/interface/assets/{logo-256.0.0.30-alpha.0.BCQk9H1-.png → logo-256.0.0.30-alpha.3.BCQk9H1-.png} +0 -0
  97. /package/dist/interface/assets/{logo-512.0.0.30-alpha.0.DLKVOU2S.png → logo-512.0.0.30-alpha.3.DLKVOU2S.png} +0 -0
  98. /package/dist/interface/assets/{logo.0.0.30-alpha.0.DmEiRk0z.png → logo.0.0.30-alpha.3.DmEiRk0z.png} +0 -0
  99. /package/dist/interface/assets/{main.0.0.30-alpha.0.BOf8IWhK.css → main.0.0.30-alpha.3.BOf8IWhK.css} +0 -0
  100. /package/dist/interface/assets/{mode-json.0.0.30-alpha.0.Br7xisR1.js → mode-json.0.0.30-alpha.3.Br7xisR1.js} +0 -0
  101. /package/dist/interface/assets/{mode-yaml.0.0.30-alpha.0.CIYL8U3d.js → mode-yaml.0.0.30-alpha.3.CIYL8U3d.js} +0 -0
  102. /package/dist/interface/assets/{v-calendar.0.0.30-alpha.0.CtSuDYZU.css → v-calendar.0.0.30-alpha.3.CtSuDYZU.css} +0 -0
  103. /package/dist/interface/assets/{vue3-toastify.0.0.30-alpha.0.DTY1DMRs.css → vue3-toastify.0.0.30-alpha.3.DTY1DMRs.css} +0 -0
  104. /package/dist/interface/assets/{vuetify.0.0.30-alpha.0.Cd1awv3t.css → vuetify.0.0.30-alpha.3.Cd1awv3t.css} +0 -0
  105. /package/dist/interface/{axios.C-n2IhIP.0.0.30-alpha.0.js → axios.C-n2IhIP.0.0.30-alpha.3.js} +0 -0
  106. /package/dist/interface/{compare-versions.DqEOhma6.0.0.30-alpha.0.js → compare-versions.DqEOhma6.0.0.30-alpha.3.js} +0 -0
  107. /package/dist/interface/{dijkstrajs.D_NXgYpA.0.0.30-alpha.0.js → dijkstrajs.D_NXgYpA.0.0.30-alpha.3.js} +0 -0
  108. /package/dist/interface/{engine.io-parser.BiEtp6m2.0.0.30-alpha.0.js → engine.io-parser.BiEtp6m2.0.0.30-alpha.3.js} +0 -0
  109. /package/dist/interface/{entities.C20TfXL6.0.0.30-alpha.0.js → entities.C20TfXL6.0.0.30-alpha.3.js} +0 -0
  110. /package/dist/interface/{get-size.D1dS-IaP.0.0.30-alpha.0.js → get-size.D1dS-IaP.0.0.30-alpha.3.js} +0 -0
  111. /package/dist/interface/{mdurl.k9Sl0PQj.0.0.30-alpha.0.js → mdurl.k9Sl0PQj.0.0.30-alpha.3.js} +0 -0
  112. /package/dist/interface/{punycode.js.Dj65hjkv.0.0.30-alpha.0.js → punycode.js.Dj65hjkv.0.0.30-alpha.3.js} +0 -0
  113. /package/dist/interface/{react-dnd-html5-backend.1HQjlkwI.0.0.30-alpha.0.js → react-dnd-html5-backend.1HQjlkwI.0.0.30-alpha.3.js} +0 -0
  114. /package/dist/interface/{redux.CuxFRhX_.0.0.30-alpha.0.js → redux.CuxFRhX_.0.0.30-alpha.3.js} +0 -0
  115. /package/dist/interface/{tslib.9k7AwCpt.0.0.30-alpha.0.js → tslib.9k7AwCpt.0.0.30-alpha.3.js} +0 -0
  116. /package/dist/interface/{uc.micro.kMc2yuuw.0.0.30-alpha.0.js → uc.micro.kMc2yuuw.0.0.30-alpha.3.js} +0 -0
  117. /package/dist/interface/{uuid.DvF23Exx.0.0.30-alpha.0.js → uuid.DvF23Exx.0.0.30-alpha.3.js} +0 -0
  118. /package/dist/interface/{vue.l0sNRNKZ.0.0.30-alpha.0.js → vue.l0sNRNKZ.0.0.30-alpha.3.js} +0 -0
  119. /package/dist/interface/{zod.DnW1_kUe.0.0.30-alpha.0.js → zod.DnW1_kUe.0.0.30-alpha.3.js} +0 -0
@@ -0,0 +1,3 @@
1
+ var qs=Object.defineProperty;var Ft=i=>{throw TypeError(i)};var Ns=(i,t,e)=>t in i?qs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var d=(i,t,e)=>Ns(i,typeof t!="symbol"?t+"":t,e),at=(i,t,e)=>t.has(i)||Ft("Cannot "+e);var c=(i,t,e)=>(at(i,t,"read from private field"),e?e.call(i):t.get(i)),C=(i,t,e)=>t.has(i)?Ft("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,e),k=(i,t,e,s)=>(at(i,t,"write to private field"),s?s.call(i,e):t.set(i,e),e),y=(i,t,e)=>(at(i,t,"access private method"),e);var Fe=(i,t,e,s)=>({set _(n){k(i,t,n,e)},get _(){return c(i,t,s)}});var Le={d:(i,t)=>{for(var e in t)Le.o(t,e)&&!Le.o(i,e)&&Object.defineProperty(i,e,{enumerable:!0,get:t[e]})},o:(i,t)=>Object.prototype.hasOwnProperty.call(i,t),r:i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})}},ds={};Le.d(ds,{j:()=>Li});var bt={};Le.r(bt),Le.d(bt,{Decoder:()=>qt,Encoder:()=>Ti,PacketType:()=>O,protocol:()=>Ci});class Fs{constructor(t){d(this,"baseURL");d(this,"abortControllers",new Set);this.baseURL=`${t}/api`}async request(t,e,s,n={}){const r=new AbortController;this.abortControllers.add(r);const o=setTimeout(()=>{r.abort(),this.abortControllers.delete(r)},15e3);try{const a=await fetch(`${this.baseURL}${e}`,{method:t,headers:{"Content-Type":"application/json",...n.headers},body:s?JSON.stringify(s):void 0,signal:r.signal,...n});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return a}finally{clearTimeout(o),this.abortControllers.delete(r)}}get(t,e){return this.request("GET",t,void 0,e)}post(t,e,s){return this.request("POST",t,e,s)}}class Us{constructor(){d(this,"subscriptions",[]);d(this,"additionalSubscriptions",[])}addSubscriptions(...t){this.subscriptions.push(...t)}addAdditionalSubscriptions(...t){this.additionalSubscriptions.push(...t)}unsubscribe(){this.subscriptions.forEach(t=>t.unsubscribe())}unsubscribeAdditional(){this.additionalSubscriptions.forEach(t=>t.unsubscribe())}}function Ee(i,t,e=!1){if(i===t)return!0;if((i===void 0||t===void 0||i===null||t===null)&&(i||t))return!1;const s=i==null?void 0:i.constructor.name,n=t==null?void 0:t.constructor.name;if(s!==n)return!1;if(s==="Array"&&n==="Array"){if(i.length!==t.length)return!1;if(e){const r=[...t];return i.every(o=>{const a=r.findIndex(h=>Ee(o,h,e));return a!==-1&&(r.splice(a,1),!0)})}{let r=!0;for(let o=0;o<i.length;o++)if(!Ee(i[o],t[o],e)){r=!1;break}return r}}if(s==="Object"&&n==="Object"){let r=!0;const o=Object.keys(i),a=Object.keys(t);if(o.length!==a.length)return!1;for(let h=0;h<o.length;h++)if(i[o[h]]&&t[o[h]]){if(i[o[h]]===t[o[h]])continue;if(!i[o[h]]||i[o[h]].constructor.name!=="Array"&&i[o[h]].constructor.name!=="Object"){if(i[o[h]]!==t[o[h]]){r=!1;break}}else if(r=Ee(i[o[h]],t[o[h]],e),!r)break}else if(i[o[h]]&&!t[o[h]]||!i[o[h]]&&t[o[h]]){r=!1;break}return r}return i===t}function G(i){return JSON.parse(JSON.stringify(i))}const Se=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ut=new Set,vt=typeof process=="object"&&process?process:{},ps=(i,t,e,s)=>{typeof vt.emitWarning=="function"?vt.emitWarning(i,t,e,s):console.error(`[${e}] ${t}: ${i}`)};let Qe=globalThis.AbortController,zt=globalThis.AbortSignal;var us;if(Qe===void 0){zt=class{constructor(){d(this,"onabort");d(this,"_onabort",[]);d(this,"reason");d(this,"aborted",!1)}addEventListener(e,s){this._onabort.push(s)}},Qe=class{constructor(){d(this,"signal",new zt);t()}abort(e){var s,n;if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(const r of this.signal._onabort)r(e);(n=(s=this.signal).onabort)==null||n.call(s,e)}}};let i=((us=vt.env)==null?void 0:us.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const t=()=>{i&&(i=!1,ps("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}const he=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),gs=i=>he(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?$e:null:null;class $e extends Array{constructor(t){super(t),this.fill(0)}}var xe;const me=class me{constructor(t,e){d(this,"heap");d(this,"length");if(!c(me,xe))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}static create(t){const e=gs(t);if(!e)return[];k(me,xe,!0);const s=new me(t,e);return k(me,xe,!1),s}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}};xe=new WeakMap,C(me,xe,!1);let wt=me;var ls,fs,Y,V,K,X,Oe,Ae,P,Q,L,B,E,U,W,F,M,Z,I,ee,te,H,se,ge,z,g,kt,ye,ae,Ie,$,ms,be,Ce,qe,ue,le,_t,Ge,Je,j,Et,je,fe,xt;const Nt=class Nt{constructor(t){C(this,g);C(this,Y);C(this,V);C(this,K);C(this,X);C(this,Oe);C(this,Ae);d(this,"ttl");d(this,"ttlResolution");d(this,"ttlAutopurge");d(this,"updateAgeOnGet");d(this,"updateAgeOnHas");d(this,"allowStale");d(this,"noDisposeOnSet");d(this,"noUpdateTTL");d(this,"maxEntrySize");d(this,"sizeCalculation");d(this,"noDeleteOnFetchRejection");d(this,"noDeleteOnStaleGet");d(this,"allowStaleOnFetchAbort");d(this,"allowStaleOnFetchRejection");d(this,"ignoreFetchAbort");C(this,P);C(this,Q);C(this,L);C(this,B);C(this,E);C(this,U);C(this,W);C(this,F);C(this,M);C(this,Z);C(this,I);C(this,ee);C(this,te);C(this,H);C(this,se);C(this,ge);C(this,z);C(this,ye,()=>{});C(this,ae,()=>{});C(this,Ie,()=>{});C(this,$,()=>!1);C(this,be,t=>{});C(this,Ce,(t,e,s)=>{});C(this,qe,(t,e,s,n)=>{if(s||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});d(this,ls,"LRUCache");const{max:e=0,ttl:s,ttlResolution:n=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:h,dispose:l,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:w,maxSize:v=0,maxEntrySize:m=0,sizeCalculation:S,fetchMethod:_,memoMethod:p,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:x,allowStaleOnFetchRejection:T,allowStaleOnFetchAbort:R,ignoreFetchAbort:A}=t;if(e!==0&&!he(e))throw new TypeError("max option must be a nonnegative integer");const q=e?gs(e):Array;if(!q)throw new Error("invalid max value: "+e);if(k(this,Y,e),k(this,V,v),this.maxEntrySize=m||c(this,V),this.sizeCalculation=S,this.sizeCalculation){if(!c(this,V)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(p!==void 0&&typeof p!="function")throw new TypeError("memoMethod must be a function if defined");if(k(this,Ae,p),_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(k(this,Oe,_),k(this,ge,!!_),k(this,L,new Map),k(this,B,new Array(e).fill(void 0)),k(this,E,new Array(e).fill(void 0)),k(this,U,new q(e)),k(this,W,new q(e)),k(this,F,0),k(this,M,0),k(this,Z,wt.create(e)),k(this,P,0),k(this,Q,0),typeof l=="function"&&k(this,K,l),typeof u=="function"?(k(this,X,u),k(this,I,[])):(k(this,X,void 0),k(this,I,void 0)),k(this,se,!!c(this,K)),k(this,z,!!c(this,X)),this.noDisposeOnSet=!!f,this.noUpdateTTL=!!w,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!T,this.allowStaleOnFetchAbort=!!R,this.ignoreFetchAbort=!!A,this.maxEntrySize!==0){if(c(this,V)!==0&&!he(c(this,V)))throw new TypeError("maxSize must be a positive integer if specified");if(!he(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");y(this,g,ms).call(this)}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=he(n)||n===0?n:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!he(this.ttl))throw new TypeError("ttl must be a positive integer if specified");y(this,g,kt).call(this)}if(c(this,Y)===0&&this.ttl===0&&c(this,V)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!c(this,Y)&&!c(this,V)){const ce="LRU_CACHE_UNBOUNDED";(we=>!Ut.has(we))(ce)&&(Ut.add(ce),ps("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ce,Nt))}}static unsafeExposeInternals(t){return{starts:c(t,te),ttls:c(t,H),sizes:c(t,ee),keyMap:c(t,L),keyList:c(t,B),valList:c(t,E),next:c(t,U),prev:c(t,W),get head(){return c(t,F)},get tail(){return c(t,M)},free:c(t,Z),isBackgroundFetch:e=>{var s;return y(s=t,g,j).call(s,e)},backgroundFetch:(e,s,n,r)=>{var o;return y(o=t,g,Je).call(o,e,s,n,r)},moveToTail:e=>{var s;return y(s=t,g,je).call(s,e)},indexes:e=>{var s;return y(s=t,g,ue).call(s,e)},rindexes:e=>{var s;return y(s=t,g,le).call(s,e)},isStale:e=>{var s;return c(s=t,$).call(s,e)}}}get max(){return c(this,Y)}get maxSize(){return c(this,V)}get calculatedSize(){return c(this,Q)}get size(){return c(this,P)}get fetchMethod(){return c(this,Oe)}get memoMethod(){return c(this,Ae)}get dispose(){return c(this,K)}get disposeAfter(){return c(this,X)}getRemainingTTL(t){return c(this,L).has(t)?1/0:0}*entries(){for(const t of y(this,g,ue).call(this))c(this,E)[t]===void 0||c(this,B)[t]===void 0||y(this,g,j).call(this,c(this,E)[t])||(yield[c(this,B)[t],c(this,E)[t]])}*rentries(){for(const t of y(this,g,le).call(this))c(this,E)[t]===void 0||c(this,B)[t]===void 0||y(this,g,j).call(this,c(this,E)[t])||(yield[c(this,B)[t],c(this,E)[t]])}*keys(){for(const t of y(this,g,ue).call(this)){const e=c(this,B)[t];e===void 0||y(this,g,j).call(this,c(this,E)[t])||(yield e)}}*rkeys(){for(const t of y(this,g,le).call(this)){const e=c(this,B)[t];e===void 0||y(this,g,j).call(this,c(this,E)[t])||(yield e)}}*values(){for(const t of y(this,g,ue).call(this))c(this,E)[t]===void 0||y(this,g,j).call(this,c(this,E)[t])||(yield c(this,E)[t])}*rvalues(){for(const t of y(this,g,le).call(this))c(this,E)[t]===void 0||y(this,g,j).call(this,c(this,E)[t])||(yield c(this,E)[t])}[(fs=Symbol.iterator,ls=Symbol.toStringTag,fs)](){return this.entries()}find(t,e={}){for(const s of y(this,g,ue).call(this)){const n=c(this,E)[s],r=y(this,g,j).call(this,n)?n.__staleWhileFetching:n;if(r!==void 0&&t(r,c(this,B)[s],this))return this.get(c(this,B)[s],e)}}forEach(t,e=this){for(const s of y(this,g,ue).call(this)){const n=c(this,E)[s],r=y(this,g,j).call(this,n)?n.__staleWhileFetching:n;r!==void 0&&t.call(e,r,c(this,B)[s],this)}}rforEach(t,e=this){for(const s of y(this,g,le).call(this)){const n=c(this,E)[s],r=y(this,g,j).call(this,n)?n.__staleWhileFetching:n;r!==void 0&&t.call(e,r,c(this,B)[s],this)}}purgeStale(){let t=!1;for(const e of y(this,g,le).call(this,{allowStale:!0}))c(this,$).call(this,e)&&(y(this,g,fe).call(this,c(this,B)[e],"expire"),t=!0);return t}info(t){const e=c(this,L).get(t);if(e===void 0)return;const s=c(this,E)[e],n=y(this,g,j).call(this,s)?s.__staleWhileFetching:s;if(n===void 0)return;const r={value:n};if(c(this,H)&&c(this,te)){const o=c(this,H)[e],a=c(this,te)[e];if(o&&a){const h=o-(Se.now()-a);r.ttl=h,r.start=Date.now()}}return c(this,ee)&&(r.size=c(this,ee)[e]),r}dump(){const t=[];for(const e of y(this,g,ue).call(this,{allowStale:!0})){const s=c(this,B)[e],n=c(this,E)[e],r=y(this,g,j).call(this,n)?n.__staleWhileFetching:n;if(r===void 0||s===void 0)continue;const o={value:r};if(c(this,H)&&c(this,te)){o.ttl=c(this,H)[e];const a=Se.now()-c(this,te)[e];o.start=Math.floor(Date.now()-a)}c(this,ee)&&(o.size=c(this,ee)[e]),t.unshift([s,o])}return t}load(t){this.clear();for(const[e,s]of t){if(s.start){const n=Date.now()-s.start;s.start=Se.now()-n}this.set(e,s.value,s)}}set(t,e,s={}){var w,v,m,S,_;if(e===void 0)return this.delete(t),this;const{ttl:n=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=s;let{noUpdateTTL:l=this.noUpdateTTL}=s;const u=c(this,qe).call(this,t,e,s.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),y(this,g,fe).call(this,t,"set"),this;let f=c(this,P)===0?void 0:c(this,L).get(t);if(f===void 0)f=c(this,P)===0?c(this,M):c(this,Z).length!==0?c(this,Z).pop():c(this,P)===c(this,Y)?y(this,g,Ge).call(this,!1):c(this,P),c(this,B)[f]=t,c(this,E)[f]=e,c(this,L).set(t,f),c(this,U)[c(this,M)]=f,c(this,W)[f]=c(this,M),k(this,M,f),Fe(this,P)._++,c(this,Ce).call(this,f,u,h),h&&(h.set="add"),l=!1;else{y(this,g,je).call(this,f);const p=c(this,E)[f];if(e!==p){if(c(this,ge)&&y(this,g,j).call(this,p)){p.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:b}=p;b===void 0||o||(c(this,se)&&((w=c(this,K))==null||w.call(this,b,t,"set")),c(this,z)&&((v=c(this,I))==null||v.push([b,t,"set"])))}else o||(c(this,se)&&((m=c(this,K))==null||m.call(this,p,t,"set")),c(this,z)&&((S=c(this,I))==null||S.push([p,t,"set"])));if(c(this,be).call(this,f),c(this,Ce).call(this,f,u,h),c(this,E)[f]=e,h){h.set="replace";const b=p&&y(this,g,j).call(this,p)?p.__staleWhileFetching:p;b!==void 0&&(h.oldValue=b)}}else h&&(h.set="update")}if(n===0||c(this,H)||y(this,g,kt).call(this),c(this,H)&&(l||c(this,Ie).call(this,f,n,r),h&&c(this,ae).call(this,h,f)),!o&&c(this,z)&&c(this,I)){const p=c(this,I);let b;for(;b=p==null?void 0:p.shift();)(_=c(this,X))==null||_.call(this,...b)}return this}pop(){var t;try{for(;c(this,P);){const e=c(this,E)[c(this,F)];if(y(this,g,Ge).call(this,!0),y(this,g,j).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(c(this,z)&&c(this,I)){const e=c(this,I);let s;for(;s=e==null?void 0:e.shift();)(t=c(this,X))==null||t.call(this,...s)}}}has(t,e={}){const{updateAgeOnHas:s=this.updateAgeOnHas,status:n}=e,r=c(this,L).get(t);if(r!==void 0){const o=c(this,E)[r];if(y(this,g,j).call(this,o)&&o.__staleWhileFetching===void 0)return!1;if(!c(this,$).call(this,r))return s&&c(this,ye).call(this,r),n&&(n.has="hit",c(this,ae).call(this,n,r)),!0;n&&(n.has="stale",c(this,ae).call(this,n,r))}else n&&(n.has="miss");return!1}peek(t,e={}){const{allowStale:s=this.allowStale}=e,n=c(this,L).get(t);if(n===void 0||!s&&c(this,$).call(this,n))return;const r=c(this,E)[n];return y(this,g,j).call(this,r)?r.__staleWhileFetching:r}async fetch(t,e={}){const{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:w=this.allowStaleOnFetchRejection,ignoreFetchAbort:v=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:S,forceRefresh:_=!1,status:p,signal:b}=e;if(!c(this,ge))return p&&(p.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:r,status:p});const x={allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:a,size:h,sizeCalculation:l,noUpdateTTL:u,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:m,ignoreFetchAbort:v,status:p,signal:b};let T=c(this,L).get(t);if(T===void 0){p&&(p.fetch="miss");const R=y(this,g,Je).call(this,t,T,x,S);return R.__returned=R}{const R=c(this,E)[T];if(y(this,g,j).call(this,R)){const we=s&&R.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",we&&(p.returnedStale=!0)),we?R.__staleWhileFetching:R.__returned=R}const A=c(this,$).call(this,T);if(!_&&!A)return p&&(p.fetch="hit"),y(this,g,je).call(this,T),n&&c(this,ye).call(this,T),p&&c(this,ae).call(this,p,T),R;const q=y(this,g,Je).call(this,t,T,x,S),ce=q.__staleWhileFetching!==void 0&&s;return p&&(p.fetch=A?"stale":"refresh",ce&&A&&(p.returnedStale=!0)),ce?q.__staleWhileFetching:q.__returned=q}}async forceFetch(t,e={}){const s=await this.fetch(t,e);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,e={}){const s=c(this,Ae);if(!s)throw new Error("no memoMethod provided to constructor");const{context:n,forceRefresh:r,...o}=e,a=this.get(t,o);if(!r&&a!==void 0)return a;const h=s(t,a,{options:o,context:n});return this.set(t,h,o),h}get(t,e={}){const{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=e,a=c(this,L).get(t);if(a!==void 0){const h=c(this,E)[a],l=y(this,g,j).call(this,h);return o&&c(this,ae).call(this,o,a),c(this,$).call(this,a)?(o&&(o.get="stale"),l?(o&&s&&h.__staleWhileFetching!==void 0&&(o.returnedStale=!0),s?h.__staleWhileFetching:void 0):(r||y(this,g,fe).call(this,t,"expire"),o&&s&&(o.returnedStale=!0),s?h:void 0)):(o&&(o.get="hit"),l?h.__staleWhileFetching:(y(this,g,je).call(this,a),n&&c(this,ye).call(this,a),h))}o&&(o.get="miss")}delete(t){return y(this,g,fe).call(this,t,"delete")}clear(){return y(this,g,xt).call(this,"delete")}};Y=new WeakMap,V=new WeakMap,K=new WeakMap,X=new WeakMap,Oe=new WeakMap,Ae=new WeakMap,P=new WeakMap,Q=new WeakMap,L=new WeakMap,B=new WeakMap,E=new WeakMap,U=new WeakMap,W=new WeakMap,F=new WeakMap,M=new WeakMap,Z=new WeakMap,I=new WeakMap,ee=new WeakMap,te=new WeakMap,H=new WeakMap,se=new WeakMap,ge=new WeakMap,z=new WeakMap,g=new WeakSet,kt=function(){const t=new $e(c(this,Y)),e=new $e(c(this,Y));k(this,H,t),k(this,te,e),k(this,Ie,(r,o,a=Se.now())=>{if(e[r]=o!==0?a:0,t[r]=o,o!==0&&this.ttlAutopurge){const h=setTimeout(()=>{c(this,$).call(this,r)&&y(this,g,fe).call(this,c(this,B)[r],"expire")},o+1);h.unref&&h.unref()}}),k(this,ye,r=>{e[r]=t[r]!==0?Se.now():0}),k(this,ae,(r,o)=>{if(t[o]){const a=t[o],h=e[o];if(!a||!h)return;r.ttl=a,r.start=h,r.now=s||n();const l=r.now-h;r.remainingTTL=a-l}});let s=0;const n=()=>{const r=Se.now();if(this.ttlResolution>0){s=r;const o=setTimeout(()=>s=0,this.ttlResolution);o.unref&&o.unref()}return r};this.getRemainingTTL=r=>{const o=c(this,L).get(r);if(o===void 0)return 0;const a=t[o],h=e[o];return a&&h?a-((s||n())-h):1/0},k(this,$,r=>{const o=e[r],a=t[r];return!!a&&!!o&&(s||n())-o>a})},ye=new WeakMap,ae=new WeakMap,Ie=new WeakMap,$=new WeakMap,ms=function(){const t=new $e(c(this,Y));k(this,Q,0),k(this,ee,t),k(this,be,e=>{k(this,Q,c(this,Q)-t[e]),t[e]=0}),k(this,qe,(e,s,n,r)=>{if(y(this,g,j).call(this,s))return 0;if(!he(n)){if(!r)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(n=r(s,e),!he(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return n}),k(this,Ce,(e,s,n)=>{if(t[e]=s,c(this,V)){const r=c(this,V)-t[e];for(;c(this,Q)>r;)y(this,g,Ge).call(this,!0)}k(this,Q,c(this,Q)+t[e]),n&&(n.entrySize=s,n.totalCalculatedSize=c(this,Q))})},be=new WeakMap,Ce=new WeakMap,qe=new WeakMap,ue=function*({allowStale:t=this.allowStale}={}){if(c(this,P))for(let e=c(this,M);y(this,g,_t).call(this,e)&&(!t&&c(this,$).call(this,e)||(yield e),e!==c(this,F));)e=c(this,W)[e]},le=function*({allowStale:t=this.allowStale}={}){if(c(this,P))for(let e=c(this,F);y(this,g,_t).call(this,e)&&(!t&&c(this,$).call(this,e)||(yield e),e!==c(this,M));)e=c(this,U)[e]},_t=function(t){return t!==void 0&&c(this,L).get(c(this,B)[t])===t},Ge=function(t){var r,o;const e=c(this,F),s=c(this,B)[e],n=c(this,E)[e];return c(this,ge)&&y(this,g,j).call(this,n)?n.__abortController.abort(new Error("evicted")):(c(this,se)||c(this,z))&&(c(this,se)&&((r=c(this,K))==null||r.call(this,n,s,"evict")),c(this,z)&&((o=c(this,I))==null||o.push([n,s,"evict"]))),c(this,be).call(this,e),t&&(c(this,B)[e]=void 0,c(this,E)[e]=void 0,c(this,Z).push(e)),c(this,P)===1?(k(this,F,k(this,M,0)),c(this,Z).length=0):k(this,F,c(this,U)[e]),c(this,L).delete(s),Fe(this,P)._--,e},Je=function(t,e,s,n){const r=e===void 0?void 0:c(this,E)[e];if(y(this,g,j).call(this,r))return r;const o=new Qe,{signal:a}=s;a==null||a.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});const h={signal:o.signal,options:s,context:n},l=(v,m=!1)=>{const{aborted:S}=o.signal,_=s.ignoreFetchAbort&&v!==void 0;if(s.status&&(S&&!m?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,_&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),S&&!_&&!m)return u(o.signal.reason);const p=f;return c(this,E)[e]===f&&(v===void 0?p.__staleWhileFetching?c(this,E)[e]=p.__staleWhileFetching:y(this,g,fe).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(t,v,h.options))),v},u=v=>{const{aborted:m}=o.signal,S=m&&s.allowStaleOnFetchAbort,_=S||s.allowStaleOnFetchRejection,p=_||s.noDeleteOnFetchRejection,b=f;if(c(this,E)[e]===f&&(p&&b.__staleWhileFetching!==void 0?S||(c(this,E)[e]=b.__staleWhileFetching):y(this,g,fe).call(this,t,"fetch")),_)return s.status&&b.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),b.__staleWhileFetching;if(b.__returned===b)throw v};s.status&&(s.status.fetchDispatched=!0);const f=new Promise((v,m)=>{var _;const S=(_=c(this,Oe))==null?void 0:_.call(this,t,r,h);S&&S instanceof Promise&&S.then(p=>v(p===void 0?void 0:p),m),o.signal.addEventListener("abort",()=>{s.ignoreFetchAbort&&!s.allowStaleOnFetchAbort||(v(void 0),s.allowStaleOnFetchAbort&&(v=p=>l(p,!0)))})}).then(l,v=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=v),u(v))),w=Object.assign(f,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return e===void 0?(this.set(t,w,{...h.options,status:void 0}),e=c(this,L).get(t)):c(this,E)[e]=w,w},j=function(t){if(!c(this,ge))return!1;const e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Qe},Et=function(t,e){c(this,W)[e]=t,c(this,U)[t]=e},je=function(t){t!==c(this,M)&&(t===c(this,F)?k(this,F,c(this,U)[t]):y(this,g,Et).call(this,c(this,W)[t],c(this,U)[t]),y(this,g,Et).call(this,c(this,M),t),k(this,M,t))},fe=function(t,e){var n,r,o,a;let s=!1;if(c(this,P)!==0){const h=c(this,L).get(t);if(h!==void 0)if(s=!0,c(this,P)===1)y(this,g,xt).call(this,e);else{c(this,be).call(this,h);const l=c(this,E)[h];if(y(this,g,j).call(this,l)?l.__abortController.abort(new Error("deleted")):(c(this,se)||c(this,z))&&(c(this,se)&&((n=c(this,K))==null||n.call(this,l,t,e)),c(this,z)&&((r=c(this,I))==null||r.push([l,t,e]))),c(this,L).delete(t),c(this,B)[h]=void 0,c(this,E)[h]=void 0,h===c(this,M))k(this,M,c(this,W)[h]);else if(h===c(this,F))k(this,F,c(this,U)[h]);else{const u=c(this,W)[h];c(this,U)[u]=c(this,U)[h];const f=c(this,U)[h];c(this,W)[f]=c(this,W)[h]}Fe(this,P)._--,c(this,Z).push(h)}}if(c(this,z)&&((o=c(this,I))!=null&&o.length)){const h=c(this,I);let l;for(;l=h==null?void 0:h.shift();)(a=c(this,X))==null||a.call(this,...l)}return s},xt=function(t){var e,s,n;for(const r of y(this,g,le).call(this,{allowStale:!0})){const o=c(this,E)[r];if(y(this,g,j).call(this,o))o.__abortController.abort(new Error("deleted"));else{const a=c(this,B)[r];c(this,se)&&((e=c(this,K))==null||e.call(this,o,a,t)),c(this,z)&&((s=c(this,I))==null||s.push([o,a,t]))}}if(c(this,L).clear(),c(this,E).fill(void 0),c(this,B).fill(void 0),c(this,H)&&c(this,te)&&(c(this,H).fill(0),c(this,te).fill(0)),c(this,ee)&&c(this,ee).fill(0),k(this,F,0),k(this,M,0),c(this,Z).length=0,k(this,Q,0),k(this,P,0),c(this,z)&&c(this,I)){const r=c(this,I);let o;for(;o=r==null?void 0:r.shift();)(n=c(this,X))==null||n.call(this,...o)}};let St=Nt;var Ot=function(i,t){return Ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,s){e.__proto__=s}||function(e,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])},Ot(i,t)};function ve(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}Ot(i,t),i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function ys(i,t){var e,s,n,r={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(l){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(r=0)),r;)try{if(e=1,s&&(n=2&u[0]?s.return:u[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,u[1])).done)return n;switch(s=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,s=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(!((n=(n=r.trys).length>0&&n[n.length-1])||u[0]!==6&&u[0]!==2)){r=0;continue}if(u[0]===3&&(!n||u[1]>n[0]&&u[1]<n[3])){r.label=u[1];break}if(u[0]===6&&r.label<n[1]){r.label=n[1],n=u;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(u);break}n[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(i,r)}catch(f){u=[6,f],s=0}finally{e=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([h,l])}}}function De(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],s=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&s>=i.length&&(i=void 0),{value:i&&i[s++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ze(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var s,n,r=e.call(i),o=[];try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){n={error:a}}finally{try{s&&!s.done&&(e=r.return)&&e.call(r)}finally{if(n)throw n.error}}return o}function et(i,t,e){if(arguments.length===2)for(var s,n=0,r=t.length;n<r;n++)!s&&n in t||(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))}function _e(i){return this instanceof _e?(this.v=i,this):new _e(i)}function N(i){return typeof i=="function"}function bs(i){var t=i(function(e){Error.call(e),e.stack=new Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var ct=bs(function(i){return function(t){i(this),this.message=t?t.length+` errors occurred during unsubscription:
2
+ `+t.map(function(e,s){return s+1+") "+e.toString()}).join(`
3
+ `):"",this.name="UnsubscriptionError",this.errors=t}});function At(i,t){if(i){var e=i.indexOf(t);0<=e&&i.splice(e,1)}}var it=function(){function i(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i.prototype.unsubscribe=function(){var t,e,s,n,r;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=De(o),h=a.next();!h.done;h=a.next())h.value.remove(this)}catch(m){t={error:m}}finally{try{h&&!h.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else o.remove(this);var l=this.initialTeardown;if(N(l))try{l()}catch(m){r=m instanceof ct?m.errors:[m]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var f=De(u),w=f.next();!w.done;w=f.next()){var v=w.value;try{Vt(v)}catch(m){r=r??[],m instanceof ct?r=et(et([],Ze(r)),Ze(m.errors)):r.push(m)}}}catch(m){s={error:m}}finally{try{w&&!w.done&&(n=f.return)&&n.call(f)}finally{if(s)throw s.error}}}if(r)throw new ct(r)}},i.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)Vt(t);else{if(t instanceof i){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},i.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},i.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},i.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&At(e,t)},i.prototype.remove=function(t){var e=this._finalizers;e&&At(e,t),t instanceof i&&t._removeParent(this)},i.EMPTY=function(){var t=new i;return t.closed=!0,t}(),i}(),vs=it.EMPTY;function ws(i){return i instanceof it||i&&"closed"in i&&N(i.remove)&&N(i.add)&&N(i.unsubscribe)}function Vt(i){N(i)?i():i.unsubscribe()}var Ss={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},zs={setTimeout:function(i,t){for(var e=[],s=2;s<arguments.length;s++)e[s-2]=arguments[s];return setTimeout.apply(void 0,et([i,t],Ze(e)))},clearTimeout:function(i){return clearTimeout(i)},delegate:void 0};function ks(i){zs.setTimeout(function(){throw i})}function Wt(){}function Ye(i){i()}var Mt=function(i){function t(e){var s=i.call(this)||this;return s.isStopped=!1,e?(s.destination=e,ws(e)&&e.add(s)):s.destination=Hs,s}return ve(t,i),t.create=function(e,s,n){return new Pe(e,s,n)},t.prototype.next=function(e){this.isStopped?void 0:this._next(e)},t.prototype.error=function(e){this.isStopped?void 0:(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?void 0:(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,i.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(it),Vs=Function.prototype.bind;function ht(i,t){return Vs.call(i,t)}var Ws=function(){function i(t){this.partialObserver=t}return i.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(s){Ue(s)}},i.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(s){Ue(s)}else Ue(t)},i.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){Ue(e)}},i}(),Pe=function(i){function t(e,s,n){var r,o,a=i.call(this)||this;return N(e)||!e?r={next:e??void 0,error:s??void 0,complete:n??void 0}:a&&Ss.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return a.unsubscribe()},r={next:e.next&&ht(e.next,o),error:e.error&&ht(e.error,o),complete:e.complete&&ht(e.complete,o)}):r=e,a.destination=new Ws(r),a}return ve(t,i),t}(Mt);function Ue(i){ks(i)}var Hs={closed:!0,next:Wt,error:function(i){throw i},complete:Wt},Ct=typeof Symbol=="function"&&Symbol.observable||"@@observable";function $s(i){return i}var de=function(){function i(t){t&&(this._subscribe=t)}return i.prototype.lift=function(t){var e=new i;return e.source=this,e.operator=t,e},i.prototype.subscribe=function(t,e,s){var n=this,r=function(o){return o&&o instanceof Mt||function(a){return a&&N(a.next)&&N(a.error)&&N(a.complete)}(o)&&ws(o)}(t)?t:new Pe(t,e,s);return Ye(function(){var o=n,a=o.operator,h=o.source;r.add(a?a.call(r,h):h?n._subscribe(r):n._trySubscribe(r))}),r},i.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},i.prototype.forEach=function(t,e){var s=this;return new(e=Ht(e))(function(n,r){var o=new Pe({next:function(a){try{t(a)}catch(h){r(h),o.unsubscribe()}},error:r,complete:n});s.subscribe(o)})},i.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},i.prototype[Ct]=function(){return this},i.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return((s=t).length===0?$s:s.length===1?s[0]:function(n){return s.reduce(function(r,o){return o(r)},n)})(this);var s},i.prototype.toPromise=function(t){var e=this;return new(t=Ht(t))(function(s,n){var r;e.subscribe(function(o){return r=o},function(o){return n(o)},function(){return s(r)})})},i.create=function(t){return new i(t)},i}();function Ht(i){var t;return(t=i??Ss.Promise)!==null&&t!==void 0?t:Promise}var Gs=bs(function(i){return function(){i(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),nt=function(i){function t(){var e=i.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return ve(t,i),t.prototype.lift=function(e){var s=new $t(this,this);return s.operator=e,s},t.prototype._throwIfClosed=function(){if(this.closed)throw new Gs},t.prototype.next=function(e){var s=this;Ye(function(){var n,r;if(s._throwIfClosed(),!s.isStopped){s.currentObservers||(s.currentObservers=Array.from(s.observers));try{for(var o=De(s.currentObservers),a=o.next();!a.done;a=o.next())a.value.next(e)}catch(h){n={error:h}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var s=this;Ye(function(){if(s._throwIfClosed(),!s.isStopped){s.hasError=s.isStopped=!0,s.thrownError=e;for(var n=s.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;Ye(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var s=e.observers;s.length;)s.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return((e=this.observers)===null||e===void 0?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),i.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var s=this,n=this,r=n.hasError,o=n.isStopped,a=n.observers;return r||o?vs:(this.currentObservers=null,a.push(e),new it(function(){s.currentObservers=null,At(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var s=this,n=s.hasError,r=s.thrownError,o=s.isStopped;n?e.error(r):o&&e.complete()},t.prototype.asObservable=function(){var e=new de;return e.source=this,e},t.create=function(e,s){return new $t(e,s)},t}(de),$t=function(i){function t(e,s){var n=i.call(this)||this;return n.destination=e,n.source=s,n}return ve(t,i),t.prototype.next=function(e){var s,n;(n=(s=this.destination)===null||s===void 0?void 0:s.next)===null||n===void 0||n.call(s,e)},t.prototype.error=function(e){var s,n;(n=(s=this.destination)===null||s===void 0?void 0:s.error)===null||n===void 0||n.call(s,e)},t.prototype.complete=function(){var e,s;(s=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||s===void 0||s.call(e)},t.prototype._subscribe=function(e){var s,n;return(n=(s=this.source)===null||s===void 0?void 0:s.subscribe(e))!==null&&n!==void 0?n:vs},t}(nt),oe=function(i){function t(e){var s=i.call(this)||this;return s._value=e,s}return ve(t,i),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(e){var s=i.prototype._subscribe.call(this,e);return!s.closed&&e.next(this._value),s},t.prototype.getValue=function(){var e=this,s=e.hasError,n=e.thrownError,r=e._value;if(s)throw n;return this._throwIfClosed(),r},t.prototype.next=function(e){i.prototype.next.call(this,this._value=e)},t}(nt),_s={now:function(){return(_s.delegate||Date).now()},delegate:void 0},ut=function(i){function t(e,s,n){e===void 0&&(e=1/0),s===void 0&&(s=1/0),n===void 0&&(n=_s);var r=i.call(this)||this;return r._bufferSize=e,r._windowTime=s,r._timestampProvider=n,r._buffer=[],r._infiniteTimeWindow=!0,r._infiniteTimeWindow=s===1/0,r._bufferSize=Math.max(1,e),r._windowTime=Math.max(1,s),r}return ve(t,i),t.prototype.next=function(e){var s=this,n=s.isStopped,r=s._buffer,o=s._infiniteTimeWindow,a=s._timestampProvider,h=s._windowTime;n||(r.push(e),!o&&r.push(a.now()+h)),this._trimBuffer(),i.prototype.next.call(this,e)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var s=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),o=0;o<r.length&&!e.closed;o+=n?1:2)e.next(r[o]);return this._checkFinalizedStatuses(e),s},t.prototype._trimBuffer=function(){var e=this,s=e._bufferSize,n=e._timestampProvider,r=e._buffer,o=e._infiniteTimeWindow,a=(o?1:2)*s;if(s<1/0&&a<r.length&&r.splice(0,r.length-a),!o){for(var h=n.now(),l=0,u=1;u<r.length&&r[u]<=h;u+=2)l=u;l&&r.splice(0,l+1)}},t}(nt);function Ne(i){return function(t){if(function(e){return N(e==null?void 0:e.lift)}(t))return t.lift(function(e){try{return i(e,this)}catch(s){this.error(s)}});throw new TypeError("Unable to lift unknown Observable type")}}function Me(i,t,e,s,n){return new Js(i,t,e,s,n)}var Js=function(i){function t(e,s,n,r,o,a){var h=i.call(this,e)||this;return h.onFinalize=o,h.shouldUnsubscribe=a,h._next=s?function(l){try{s(l)}catch(u){e.error(u)}}:i.prototype._next,h._error=r?function(l){try{r(l)}catch(u){e.error(u)}finally{this.unsubscribe()}}:i.prototype._error,h._complete=n?function(){try{n()}catch(l){e.error(l)}finally{this.unsubscribe()}}:i.prototype._complete,h}return ve(t,i),t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var s=this.closed;i.prototype.unsubscribe.call(this),!s&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t}(Mt);function Gt(){return Ne(function(i,t){var e,s=!1;i.subscribe(Me(t,function(n){var r=e;e=n,s&&t.next([r,n]),s=!0}))})}function Jt(i,t){return Ne(function(e,s){var n=0;e.subscribe(Me(s,function(r){return i.call(t,r,n++)&&s.next(r)}))})}function Es(i,t){return Ne(function(e,s){var n=0;e.subscribe(Me(s,function(r){s.next(i.call(t,r,n++))}))})}var Ys=function(i){return i&&typeof i.length=="number"&&typeof i!="function"},Ks=typeof Symbol=="function"&&Symbol.iterator?Symbol.iterator:"@@iterator";function tt(i){if(i instanceof de)return i;if(i!=null){if(function(r){return N(r[Ct])}(i))return n=i,new de(function(r){var o=n[Ct]();if(N(o.subscribe))return o.subscribe(r);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(Ys(i))return s=i,new de(function(r){for(var o=0;o<s.length&&!r.closed;o++)r.next(s[o]);r.complete()});if(function(r){return N(r==null?void 0:r.then)}(i))return e=i,new de(function(r){e.then(function(o){r.closed||(r.next(o),r.complete())},function(o){return r.error(o)}).then(null,ks)});if(function(r){return Symbol.asyncIterator&&N(r==null?void 0:r[Symbol.asyncIterator])}(i))return Yt(i);if(function(r){return N(r==null?void 0:r[Ks])}(i))return t=i,new de(function(r){var o,a;try{for(var h=De(t),l=h.next();!l.done;l=h.next()){var u=l.value;if(r.next(u),r.closed)return}}catch(f){o={error:f}}finally{try{l&&!l.done&&(a=h.return)&&a.call(h)}finally{if(o)throw o.error}}r.complete()});if(function(r){return N(r==null?void 0:r.getReader)}(i))return Yt(function(r){return function(o,a,h){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var l,u=h.apply(o,a||[]),f=[];return l=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),w("next"),w("throw"),w("return",function(p){return function(b){return Promise.resolve(b).then(p,S)}}),l[Symbol.asyncIterator]=function(){return this},l;function w(p,b){u[p]&&(l[p]=function(x){return new Promise(function(T,R){f.push([p,x,T,R])>1||v(p,x)})},b&&(l[p]=b(l[p])))}function v(p,b){try{(x=u[p](b)).value instanceof _e?Promise.resolve(x.value.v).then(m,S):_(f[0][2],x)}catch(T){_(f[0][3],T)}var x}function m(p){v("next",p)}function S(p){v("throw",p)}function _(p,b){p(b),f.shift(),f.length&&v(f[0][0],f[0][1])}}(this,arguments,function(){var o,a,h;return ys(this,function(l){switch(l.label){case 0:o=r.getReader(),l.label=1;case 1:l.trys.push([1,,9,10]),l.label=2;case 2:return[4,_e(o.read())];case 3:return a=l.sent(),h=a.value,a.done?[4,_e(void 0)]:[3,5];case 4:return[2,l.sent()];case 5:return[4,_e(h)];case 6:return[4,l.sent()];case 7:return l.sent(),[3,2];case 8:return[3,10];case 9:return o.releaseLock(),[7];case 10:return[2]}})})}(i))}var t,e,s,n;throw function(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}(i)}function Yt(i){return new de(function(t){(function(e,s){var n,r,o,a,h,l,u,f;return h=this,l=void 0,f=function(){var w,v;return ys(this,function(m){switch(m.label){case 0:m.trys.push([0,5,6,11]),n=function(S){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var _,p=S[Symbol.asyncIterator];return p?p.call(S):(S=De(S),_={},b("next"),b("throw"),b("return"),_[Symbol.asyncIterator]=function(){return this},_);function b(x){_[x]=S[x]&&function(T){return new Promise(function(R,A){(function(q,ce,we,Ms){Promise.resolve(Ms).then(function(Is){q({value:Is,done:we})},ce)})(R,A,(T=S[x](T)).done,T.value)})}}}(e),m.label=1;case 1:return[4,n.next()];case 2:if((r=m.sent()).done)return[3,4];if(w=r.value,s.next(w),s.closed)return[2];m.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return v=m.sent(),o={error:v},[3,11];case 6:return m.trys.push([6,,9,10]),r&&!r.done&&(a=n.return)?[4,a.call(n)]:[3,8];case 7:m.sent(),m.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return s.complete(),[2]}})},new((u=void 0)||(u=Promise))(function(w,v){function m(p){try{_(f.next(p))}catch(b){v(b)}}function S(p){try{_(f.throw(p))}catch(b){v(b)}}function _(p){p.done?w(p.value):function(b){return b instanceof u?b:new u(function(x){x(b)})}(p.value).then(m,S)}_((f=f.apply(h,l||[])).next())})})(i,t).catch(function(e){return t.error(e)})})}function lt(i){i===void 0&&(i={});var t=i.connector,e=t===void 0?function(){return new nt}:t,s=i.resetOnError,n=s===void 0||s,r=i.resetOnComplete,o=r===void 0||r,a=i.resetOnRefCountZero,h=a===void 0||a;return function(l){var u,f,w,v=0,m=!1,S=!1,_=function(){f==null||f.unsubscribe(),f=void 0},p=function(){_(),u=w=void 0,m=S=!1},b=function(){var x=u;p(),x==null||x.unsubscribe()};return Ne(function(x,T){v++,S||m||_();var R=w=w??e();T.add(function(){--v!=0||S||m||(f=ft(b,h))}),R.subscribe(T),!u&&v>0&&(u=new Pe({next:function(A){return R.next(A)},error:function(A){S=!0,_(),f=ft(p,n,A),R.error(A)},complete:function(){m=!0,_(),f=ft(p,o),R.complete()}}),tt(x).subscribe(u))})(l)}}function ft(i,t){for(var e=[],s=2;s<arguments.length;s++)e[s-2]=arguments[s];if(t!==!0){if(t!==!1){var n=new Pe({next:function(){n.unsubscribe(),i()}});return tt(t.apply(void 0,et([],Ze(e)))).subscribe(n)}}else i()}function xs(i,t,e){return e===void 0&&(e=1/0),N(t)?xs(function(s,n){return Es(function(r,o){return t(s,r,n,o)})(tt(i(s,n)))},e):(typeof t=="number"&&(e=t),Ne(function(s,n){return function(r,o,a,h,l,u,f,w){var v=[],m=0,S=0,_=!1,p=function(){!_||v.length||m||o.complete()},b=function(T){return m<h?x(T):v.push(T)},x=function(T){m++;var R=!1;tt(a(T,S++)).subscribe(Me(o,function(A){o.next(A)},function(){R=!0},void 0,function(){if(R)try{m--;for(var A=function(){var q=v.shift();x(q)};v.length&&m<h;)A();p()}catch(q){o.error(q)}}))};return r.subscribe(Me(o,b,function(){_=!0,p()})),function(){}}(s,n,i,e)}))}const Xs=(i,t)=>{const[e,s,n,r]=i,[o,a,h,l]=t,u=Math.max(e,o),f=Math.max(s,a),w=Math.min(n,h),v=Math.min(r,l),m=Math.max(0,w-u)*Math.max(0,v-f);return m/((n-e)*(r-s)+(h-o)*(l-a)-m)},Qs=(i,t)=>{const{origWidth:e,origHeight:s}=t,n=i.points.map(([r,o])=>[r*e/100,o*s/100]);return{...i,points:n}},Kt=i=>{const{origWidth:t,origHeight:e,inputWidth:s,inputHeight:n}=i,[r,o,a,h]=i.boundingBox,l=r*t/s,u=o*e/n,f=a*t/s,w=h*e/n;return{...i,boundingBox:[l,u,f,w]}},Xt=(i,t,e)=>{if(i.confidence<e.object.confidence)return!1;if(t.length===0)return!0;const[s,n,r,o]=i.boundingBox,a={xmin:s,ymin:n,xmax:r,ymax:o};let h=!1;for(const l of t){const u=Qs(l,i);if(u.isPrivacyMask){if(Te(a,u.points)){h=!1;break}}else u.filter==="include"?u.type==="contain"?Te(a,u.points)&&(h=!0):u.type==="intersect"&&(Qt(a,u.points)||Te(a,u.points))&&(h=!0):u.filter==="exclude"&&(u.type==="contain"?Te(a,u.points)||(h=!0):u.type==="intersect"&&(Qt(a,u.points)||Te(a,u.points)||(h=!0)))}return h},Qt=(i,t)=>{const e=Zs(i);for(const s of e)for(let n=0;n<t.length;n++){const r=[t[n],t[(n+1)%t.length]];if(ei(s,r))return!0}return!1},Te=(i,t)=>[[i.xmin,i.ymin],[i.xmax,i.ymin],[i.xmax,i.ymax],[i.xmin,i.ymax]].every(e=>ti(e,t)),Zs=i=>{const{xmin:t,ymin:e,xmax:s,ymax:n}=i;return[[[t,e],[s,e]],[[s,e],[s,n]],[[s,n],[t,n]],[[t,n],[t,e]]]},ei=(i,t)=>{const e=(a,h,l)=>(l[1]-a[1])*(h[0]-a[0])>(h[1]-a[1])*(l[0]-a[0]);return s=i[0],n=i[1],e(s,r=t[0],o=t[1])!==e(n,r,o)&&e(s,n,r)!==e(s,n,o);var s,n,r,o},ti=(i,t)=>{const[e,s]=i;let n=!1,[r,o]=t[t.length-1];for(const[a,h]of t)h>s!=o>s&&e<(r-a)*(s-h)/(o-h)+a&&(n=!n),[r,o]=[a,h];return n};class si extends Us{constructor(e,s){super();d(this,"logger");d(this,"snapshotCache",new St({max:100,ttl:3e5}));d(this,"cameraSubject");d(this,"cameraState",new oe(!1));d(this,"lightState",new oe(this.getLightState({state:!1},!0)));d(this,"motionState",new oe(this.getMotionState({detections:[],state:!1},!0)));d(this,"audioState",new oe(this.getAudioState({state:!1,db:0},!0)));d(this,"objectState",new oe(this.getObjectState({detections:[]},!0)));d(this,"doorbellState",new oe(this.getDoorbellState({state:!1},!0)));d(this,"sirenState",new oe(this.getSirenState({state:!1,level:0},!0)));d(this,"batteryState",new oe(this.getBatteryState({level:100,charging:!1,lowBattery:!1},!0)));d(this,"onConnected",this.createStateObservable(this.cameraState));d(this,"onLightSwitched",this.createStateObservable(this.lightState));d(this,"onMotionDetected",this.createStateObservable(this.motionState));d(this,"onAudioDetected",this.createStateObservable(this.audioState));d(this,"onObjectDetected",this.createStateObservable(this.objectState));d(this,"onDoorbellPressed",this.createStateObservable(this.doorbellState));d(this,"onSirenDetected",this.createStateObservable(this.sirenState));d(this,"onBatteryChanged",this.createStateObservable(this.batteryState));this.logger=s,this.cameraSubject=new oe(e),this.updateCamera(e),e.pluginId==="native"&&this.cameraState.next(!0)}get cameraObject(){return G(this.cameraSubject.getValue())}get id(){return this.cameraSubject.getValue()._id}get nativeId(){return this.cameraSubject.getValue().nativeId}get pluginId(){return this.cameraSubject.getValue().pluginId}get connected(){return this.cameraState.getValue()}get disabled(){return this.cameraSubject.getValue().disabled}get name(){return this.cameraSubject.getValue().name}get type(){return this.cameraSubject.getValue().type}get info(){return G(this.cameraSubject.getValue().info)}get isCloud(){return this.cameraSubject.getValue().isCloud}get hasLight(){return this.cameraSubject.getValue().hasLight}get hasSiren(){return this.cameraSubject.getValue().hasSiren}get hasBinarySensor(){return this.cameraSubject.getValue().hasBinarySensor}get hasBattery(){return this.cameraSubject.getValue().hasBattery}get hasMotionDetector(){return this.cameraSubject.getValue().hasMotionDetector}get hasAudioDetector(){return this.cameraSubject.getValue().hasAudioDetector}get hasObjectDetector(){return this.cameraSubject.getValue().hasObjectDetector}get hasPtz(){return this.cameraSubject.getValue().hasPtz}get hasPrebuffer(){return this.cameraSubject.getValue().hasPrebuffer}get activityZones(){return G(this.cameraSubject.getValue().activityZones)}get activitySettings(){return G(this.cameraSubject.getValue().activitySettings)}get frameWorkerSettings(){return G(this.cameraSubject.getValue().frameWorkerSettings)}get streamSource(){return this.highResolutionSource||this.midResolutionSource||this.lowResolutionSource}get snapshotSource(){return this.sources.find(e=>e.roles.includes("snapshot"))}get highResolutionSource(){return this.sources.find(e=>e.roles.includes("high-resolution"))}get midResolutionSource(){return this.sources.find(e=>e.roles.includes("mid-resolution"))}get lowResolutionSource(){return this.sources.find(e=>e.roles.includes("low-resolution"))}get ptz(){return this.ptzDelegate}getValue(e){switch(e){case"light":return G(this.lightState.getValue());case"motion":return G(this.motionState.getValue());case"audio":return G(this.audioState.getValue());case"object":return G(this.objectState.getValue());case"doorbell":return G(this.doorbellState.getValue());case"siren":return G(this.sirenState.getValue());case"battery":return G(this.batteryState.getValue());default:throw new Error(`Unknown state: ${e}`)}}async snapshot(e){const s=this.snapshotSource||this.streamSource,n=s.urls.www.jpegSnapshot,r=this.snapshotCache.get(s._id);if(!e&&r)return r;if(!s.roles.includes("snapshot")&&this.cameraObject.pluginId!=="native"){const h=await this.cameraDelegate.snapshot();return h&&h.byteLength>0&&this.snapshotCache.set(s._id,h),h}const o=await fetch(n);if(!o.ok)throw new Error("Status Code: "+o.status);const a=await o.arrayBuffer();return a.byteLength>0&&this.snapshotCache.set(s._id,a),a}onStateChange(e){return this[`${e}State`].pipe(Gt(),Jt(([s,n])=>typeof s=="boolean"||typeof n=="boolean"?s!==n:this.stateChanged(s,n,e)),Es(([s,n])=>({oldState:s,newState:n})),lt({connector:()=>new ut(1)}))}onPropertyChange(e){return this.cameraSubject.pipe(Gt(),xs(([s,n])=>(Array.isArray(e)?e:[e]).map(r=>({property:r,oldData:s[r],newData:n[r]}))),Jt(({oldData:s,newData:n})=>!Ee(s,n,!0)),lt({connector:()=>new ut(1)}))}removeAllListeners(){this.lightState.complete(),this.motionState.complete(),this.audioState.complete(),this.objectState.complete(),this.doorbellState.complete(),this.sirenState.complete(),this.batteryState.complete(),this.cameraSubject.complete(),this.cameraState.complete()}updateCamera(e){this.cameraSubject.next(e)}updateCameraState(e){this.cameraState.next(e)}updateStateInternal(e,s,n){let r,o=!1;if(n)o=!0,r=s;else{const a=this.checkStateInternal(e,s);o=a.changed,r=a.event}if(o)switch(e){case"light":this.lightState.next(this.getLightState(r));break;case"motion":this.motionState.next(this.getMotionState(r));break;case"audio":this.audioState.next(this.getAudioState(r));break;case"object":this.objectState.next(this.getObjectState(r));break;case"doorbell":this.doorbellState.next(this.getDoorbellState(r));break;case"siren":this.sirenState.next(this.getSirenState(r));break;case"battery":this.batteryState.next(this.getBatteryState(r));break;default:throw new Error(`Unknown state: ${e}`)}}checkStateInternal(e,s){let n,r=!1;switch(e){case"audio":const o=s;n=this.getAudioState(o),r=this.stateChanged(this.getValue("audio"),n,"audio");break;case"light":const a=s;n=this.getLightState(a),r=this.stateChanged(this.getValue("light"),n,"light");break;case"motion":const h=s;h.state!==void 0&&(h.detections=[]),h.detections=((v,m=.2)=>{if(v.length===0)return[];const S=[...v].sort((p,b)=>{const x=(p.boundingBox[2]-p.boundingBox[0])*(p.boundingBox[3]-p.boundingBox[1]);return(b.boundingBox[2]-b.boundingBox[0])*(b.boundingBox[3]-b.boundingBox[1])-x}),_=[];for(;S.length>0;){let p={...S[0]};S.shift();const b=[];for(let x=0;x<S.length;x++)Xs(p.boundingBox,S[x].boundingBox)>m&&b.push(x);if(b.length>0){const x=[p,...b.map(A=>S[A])],T=[Math.min(...x.map(A=>A.boundingBox[0])),Math.min(...x.map(A=>A.boundingBox[1])),Math.max(...x.map(A=>A.boundingBox[2])),Math.max(...x.map(A=>A.boundingBox[3]))],R=x.reduce((A,q)=>A.confidence>q.confidence?A:q);p={...R,boundingBox:T,id:R.id||p.id};for(let A=b.length-1;A>=0;A--)S.splice(b[A],1)}_.push(p)}return _})(h.detections),h.detections=((v,m,S)=>{const _=[];for(const p of v)Xt(Kt(p),m,S)&&m.some(b=>!b.classes.length||b.classes.includes(p.label))&&_.push(p);return _})(h.detections,this.activityZones,this.activitySettings),n=this.getMotionState(h),r=this.stateChanged(this.getValue("motion"),n,"motion");break;case"object":const l=s;l.detections=((v,m,S)=>{const _=[];for(const p of v)Xt(Kt(p),m,S)&&m.some(b=>!b.classes.length||b.classes.includes(p.label))&&_.push(p);return _})(l.detections,this.activityZones,this.activitySettings),n=this.getObjectState(l),r=this.stateChanged(this.getValue("object"),n,"object");break;case"doorbell":const u=s;n=this.getDoorbellState(u),r=this.stateChanged(this.getValue("doorbell"),n,"doorbell");break;case"siren":const f=s;n=this.getSirenState(f),r=this.stateChanged(this.getValue("siren"),n,"siren");break;case"battery":const w=s;n=this.getBatteryState(w),r=this.stateChanged(this.getValue("battery"),n,"battery");break;default:throw new Error(`Unknown state: ${e}`)}return{changed:r,event:n}}stateChanged(e,s,n){if(!e||!s||!n)return!1;if(n=="audio"){if(!this.hasAudioDetector)return!1;const r=e,o=s;return r.state!==o.state||r.db!==o.db}if(n=="motion"){if(!this.hasMotionDetector)return!1;const r=e,o=s;return o.state!==void 0?r.state!==o.state:!Ee(r.detections,o.detections,!0)}if(n=="object"){if(!this.hasObjectDetector)return!1;const r=s;return!Ee(e.detections,r.detections,!0)}if(n=="siren"){if(!this.hasSiren)return!1;const r=e,o=s;return r.state!==o.state||r.level!==o.level}if(n=="battery"){if(!this.hasBattery)return!1;const r=e,o=s;return r.level!==o.level||r.lowBattery!==o.lowBattery||r.charging!==o.charging}if(n=="doorbell"){if(!this.hasBinarySensor)return!1;const r=s;return e.state!==r.state}if(n=="light"){if(!this.hasLight)return!1;const r=s;return e.state!==r.state}return!1}getAudioState(e,s=!1){var o;let n,r;if(!s){const a=this.getValue("audio");a.state?n=a:(o=a.lastEvent)!=null&&o.state&&(n=a.lastEvent),n&&delete n.lastEvent}if(this.isStateEvent(e))r=e;else{const a={...e,timestamp:Date.now()};r={...a,db:a.db||(n==null?void 0:n.db)||0,lastEvent:n||(a.state?a:void 0)}}return r}getMotionState(e,s=!1){var o;let n,r;if(!s){const a=this.getValue("motion");a.detections.length?n=a:(o=a.lastEvent)!=null&&o.detections.length&&(n=a.lastEvent),n&&delete n.lastEvent}if(this.isStateEvent(e))r=e;else{const a={...e,timestamp:Date.now()};r={...a,lastEvent:n||(a.detections.length?a:void 0)}}return r}getObjectState(e,s=!1){var o;let n,r;if(!s){const a=this.getValue("object");a.detections.length?n=a:(o=a.lastEvent)!=null&&o.detections.length&&(n=a.lastEvent),n&&delete n.lastEvent}if(this.isStateEvent(e))r=e;else{const a={...e,timestamp:Date.now()};r={...a,lastEvent:n||(a.detections.length?a:void 0)}}return r}getDoorbellState(e,s=!1){var o;let n,r;if(!s){const a=this.getValue("doorbell");a.state?n=a:(o=a.lastEvent)!=null&&o.state&&(n=a.lastEvent),n&&delete n.lastEvent}if(this.isStateEvent(e))r=e;else{const a={...e,timestamp:Date.now()};r={...a,lastEvent:n||(a.state?a:void 0)}}return r}getLightState(e,s=!1){var o;let n,r;if(!s){const a=this.getValue("light");a.state?n=a:(o=a.lastEvent)!=null&&o.state&&(n=a.lastEvent),n&&delete n.lastEvent}if(this.isStateEvent(e))r=e;else{const a={...e,timestamp:Date.now()};r={...a,lastEvent:n||(a.state?a:void 0)}}return r}getSirenState(e,s=!1){var o;let n,r;if(!s){const a=this.getValue("siren");a.state?n=a:(o=a.lastEvent)!=null&&o.state&&(n=a.lastEvent),n&&delete n.lastEvent}if(this.isStateEvent(e))r=e;else{const a={...e,timestamp:Date.now()};r={...a,level:a.level||(n==null?void 0:n.level)||0,lastEvent:n||(a.state?a:void 0)}}return r}getBatteryState(e,s=!1){let n,r;if(!s){const o=this.getValue("battery");this.stateChanged(o,e,"battery")?n=o:o.lastEvent&&this.stateChanged(o.lastEvent,e,"battery")&&(n=o.lastEvent),n&&delete n.lastEvent}if(this.isStateEvent(e))r=e;else{const o={...e,timestamp:Date.now()};r={...o,charging:e.charging||(n==null?void 0:n.charging)||!1,lowBattery:e.lowBattery||(n==null?void 0:n.lowBattery)||!1,lastEvent:n||o}}return r}isStateEvent(e){return"timestamp"in e}createStateObservable(e){return e.pipe(lt({connector:()=>new ut(1)}))}}class ii{constructor(t){d(this,"delegate");d(this,"onRequest");this.onRequest=t}async snapshot(){return this.delegate?this.delegate.snapshot():this._onRequest("snapshot")}_onRequest(t,e,s){return this.onRequest("cameraDelegate",t,e,s)}}class ni{constructor(t){d(this,"delegate");d(this,"onRequest");this.onRequest=t}async getStreamInfo(t){return this.delegate?this.delegate.getStreamInfo(t):this._onRequest("prebufferDelegate","getStreamInfo",[t])}async getPrebufferingState(t,e){return this.delegate?this.delegate.getPrebufferingState(t,e):this._onRequest("prebufferDelegate","getPrebufferingState",[t,e])}_onRequest(t,e,s,n){return this.onRequest(t,e,s,n)}}class ri{constructor(t){d(this,"delegate");d(this,"onRequest");this.onRequest=t}async moveAbsolute(t,e,s){return this.delegate?this.delegate.moveAbsolute(t,e,s):this._onRequest("moveAbsolute",[t,e,s])}async moveRelative(t,e,s){return this.delegate?this.delegate.moveRelative(t,e,s):this._onRequest("moveRelative",[t,e,s])}async moveContinuous(t,e,s){return this.delegate?this.delegate.moveContinuous(t,e,s):this._onRequest("moveContinuous",[t,e,s])}async stop(){return this.delegate?this.delegate.stop():this._onRequest("stop",[])}_onRequest(t,e,s){return this.onRequest("ptzDelegate",t,e,s)}}const rt=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const t=16*Math.random()|0;return(i==="x"?t:3&t|8).toString(16)});class oi extends EventTarget{constructor(e,s,n,r){super();d(this,"cameraDevice");d(this,"socketService");d(this,"logger");d(this,"options");d(this,"videoPlayer");d(this,"socket");d(this,"streamId");d(this,"hasBackchannel",!1);d(this,"closed",!1);d(this,"micTransceiver",null);d(this,"pc",null);d(this,"buf",new Uint8Array(2097152));d(this,"mediaSource",null);d(this,"sourceBuffer",null);d(this,"bufLen",0);d(this,"mseCodecs","");d(this,"videoPlayerMp4");d(this,"media",["video","audio","microphone"]);d(this,"codecList",[]);d(this,"reconnectTimeout");d(this,"_finishLoading",!1);d(this,"webrtcReconnectTimeout");this.options=r,this.videoPlayer=r.videoElement,this.cameraDevice=e,this.socketService=s,this.logger=n;const{socket:o}=this.socketService.getSocket(`${e.id}-go2rtcSession`,!0);this.socket=o,this.socket.connect(),this.streamId=rt(),this.createCodecsList()}get mode(){return this.options.mode}connect(e){e&&(this.options.mode=e),console.log(this.cameraDevice.name,`Connecting... (${this.options.mode})`),this.socket.on("ws-open",this.onWsOpen.bind(this)),this.socket.on("ws-close",this.onWsClose.bind(this)),this.socket.on("ws-message",this.onWsMessage.bind(this)),this.socket.emit("ws-open",{id:this.streamId,cameraSource:this.options.sourceName,mode:this.options.mode})}disconnect(){console.log(this.cameraDevice.name,"Disconnecting..."),this.socket.removeListener("ws-open",this.onWsOpen.bind(this)),this.socket.removeListener("ws-close",this.onWsClose.bind(this)),this.socket.removeListener("ws-message",this.onWsMessage.bind(this)),this.socket.emit("ws-close",{id:this.streamId})}async reconnect(e){console.log(this.cameraDevice.name,"Reconnecting..."),this.dispatchEvent(new Event("reconnect")),this.close(),await new Promise(s=>setTimeout(s,100)),this.connect(e)}reset(){var e,s,n;this._finishLoading=!1,(e=this.pc)==null||e.getTransceivers().forEach(r=>{var o,a;return(a=(o=r.sender)==null?void 0:o.track)==null?void 0:a.stop()}),(s=this.pc)==null||s.close(),this.pc=null,(n=this.videoPlayerMp4)==null||n.remove(),this.videoPlayerMp4=void 0,this.videoPlayer.srcObject=null,this.videoPlayer.src="",this.videoPlayer.poster=""}close(){console.log(this.cameraDevice.name,"Closing..."),this.closed=!0,this.reset(),this.disconnect(),this.socket.emit("end"),this.socket.removeAllListeners()}onWsOpen({id:e}){if(e===this.streamId)switch(console.log(this.cameraDevice.name,"Connected"),this.options.mode){case"webrtc":case"webrtc/tcp":console.log(this.cameraDevice.name,"Requesting WebRTC session..."),this.requestWebrtc();break;case"mse":console.log(this.cameraDevice.name,"Requesting MSE session..."),this.requestMse();break;case"hls":console.log(this.cameraDevice.name,"Requesting HLS session..."),this.requestHls();break;case"mp4":console.log(this.cameraDevice.name,"Requesting MP4 session..."),this.requestMp4();break;case"mjpeg":console.log(this.cameraDevice.name,"Requesting MJPEG session..."),this.requestMjpeg();break;default:console.log(this.cameraDevice.name,"Unknown mode:",this.options.mode),this.dispatchEvent(new ErrorEvent("error",{message:"Unknown mode: "+this.options.mode}))}}onWsClose({id:e}){e===this.streamId&&(this.closed||this.options.reconnectInterval===void 0||(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=setTimeout(()=>{this.reconnect()},this.options.reconnectInterval)))}onWsMessage({id:e,data:s}){if(e===this.streamId&&s.type)switch(s.type){case"mse":this.onMseData(s);break;case"hls":this.onHlsData(s);break;case"webrtc/candidate":case"webrtc/answer":this.onWebrtcData(s);break;case"mse-binary":this.onMseBuffer(s);break;case"mjpeg-binary":this.onMjpegBuffer(s);break;case"mp4-binary":this.onMp4Buffer(s);break;case"stream-info":this.onStreamInfo(s);break;case"error":this.dispatchEvent(new ErrorEvent("error",{error:s,message:s.value}))}}async requestWebrtc(){this.reset(),this.pc=new RTCPeerConnection({bundlePolicy:"max-bundle",iceServers:[{urls:"stun:stun.l.google.com:19302"}],sdpSemantics:"unified-plan"}),this.pc.addEventListener("icecandidate",s=>{var r,o;if(this.options.mode==="webrtc/tcp"&&((r=s.candidate)==null?void 0:r.protocol)==="udp")return;const n=((o=s.candidate)==null?void 0:o.toJSON().candidate)||"";this.socket.emit("stream-payload",{id:this.streamId,data:{type:"webrtc/candidate",value:n}})}),this.pc.addEventListener("connectionstatechange",()=>{var s,n,r,o,a;if(console.log(this.cameraDevice.name,"Connection state:",(s=this.pc)==null?void 0:s.connectionState),((n=this.pc)==null?void 0:n.connectionState)==="connected"){const h=(r=this.pc)==null?void 0:r.getTransceivers().filter(l=>l.currentDirection==="recvonly").map(l=>l.receiver.track);this.videoPlayer.srcObject=new MediaStream(h),this.finishLoading(),this.play(),this.disconnect()}else((o=this.pc)==null?void 0:o.connectionState)!=="failed"&&((a=this.pc)==null?void 0:a.connectionState)!=="disconnected"||(clearTimeout(this.webrtcReconnectTimeout),this.webrtcReconnectTimeout=setTimeout(()=>{var h,l;((h=this.pc)==null?void 0:h.connectionState)!=="failed"&&((l=this.pc)==null?void 0:l.connectionState)!=="disconnected"||this.reconnect()},1e3))}),this.pc.addTransceiver("video",{direction:"recvonly"}),this.pc.addTransceiver("audio",{direction:"recvonly"}),this.micTransceiver=this.pc.addTransceiver("audio",{direction:"sendonly"});const e=await this.pc.createOffer();await this.pc.setLocalDescription(e),console.log(this.cameraDevice.name,"Offer:",e.sdp),this.socket.emit("stream-payload",{id:this.streamId,data:{type:"webrtc/offer",value:e.sdp}})}async onWebrtcData(e){var s,n,r;try{switch(e.type){case"webrtc/candidate":if(this.options.mode==="webrtc/tcp"&&e.value.indexOf(" udp ")>0)return;await((s=this.pc)==null?void 0:s.addIceCandidate({candidate:e.value,sdpMid:"0"}));break;case"webrtc/answer":console.log(this.cameraDevice.name,"Answer:",e.value),await((n=this.pc)==null?void 0:n.setRemoteDescription({type:"answer",sdp:e.value}));break;case"error":if(console.log(this.cameraDevice.name,"WebRTC Error:",e.value),e.value.indexOf("webrtc/offer")<0)return;(r=this.pc)==null||r.close()}}catch(o){this.dispatchEvent(new ErrorEvent("error",{error:o,message:o.message}))}}requestMse(){if(this.reset(),"ManagedMediaSource"in window){console.log(this.cameraDevice.name,"Using ManagedMediaSource");const e=window.ManagedMediaSource;this.mediaSource=new e,this.mediaSource.addEventListener("sourceopen",()=>{this.socket.emit("stream-payload",{id:this.streamId,data:{type:"mse",value:this.parseCodecs(e.isTypeSupported)}})},{once:!0}),this.videoPlayer.disableRemotePlayback=!0,this.videoPlayer.srcObject=this.mediaSource}else console.log(this.cameraDevice.name,"Using MediaSource"),this.mediaSource=new MediaSource,this.mediaSource.addEventListener("sourceopen",()=>{URL.revokeObjectURL(this.videoPlayer.src),this.socket.emit("stream-payload",{id:this.streamId,data:{type:"mse",value:this.parseCodecs(MediaSource.isTypeSupported)}})},{once:!0}),this.videoPlayer.src=URL.createObjectURL(this.mediaSource),this.videoPlayer.srcObject=null;this.play(),this.mseCodecs=""}onMseData(e){this.mediaSource&&(this.mseCodecs=e.value,this.bufLen=0,this.buf=new Uint8Array(2097152),this.sourceBuffer=this.mediaSource.addSourceBuffer(e.value),this.sourceBuffer.mode="segments",this.sourceBuffer.addEventListener("updateend",()=>{var s,n,r,o,a;if(!((s=this.sourceBuffer)!=null&&s.updating))try{if(this.bufLen>0){const h=this.buf.slice(0,this.bufLen);this.bufLen=0,(n=this.sourceBuffer)==null||n.appendBuffer(h)}else if((o=(r=this.sourceBuffer)==null?void 0:r.buffered)!=null&&o.length){const h=this.sourceBuffer.buffered.end(this.sourceBuffer.buffered.length-1)-15,l=this.sourceBuffer.buffered.start(0);h>l&&(this.sourceBuffer.remove(l,h),(a=this.mediaSource)==null||a.setLiveSeekableRange(h,h+15))}}catch{}}))}async onMseBuffer(e){var s,n,r;if(((s=this.mediaSource)==null?void 0:s.readyState)!=="closed")if(this.finishLoading(),((n=this.sourceBuffer)==null?void 0:n.updating)||this.bufLen>0){const o=new Uint8Array(e.value);this.buf.set(o,this.bufLen),this.bufLen+=o.byteLength}else try{(r=this.sourceBuffer)==null||r.appendBuffer(e.value)}catch{}else this.closed||(this.closed=!0,this.dispatchEvent(new ErrorEvent("error",{message:"MediaSource closed"})),this.options.mode="webrtc",this.requestWebrtc())}requestMjpeg(){this.reset(),this.socket.emit("stream-payload",{id:this.streamId,data:{type:"mjpeg"}})}onMjpegBuffer(e){this.videoPlayer.controls=!1,this.videoPlayer.poster="data:image/jpeg;base64,"+this.btoaBinary(e.value),this.finishLoading()}requestMp4(){this.reset();const e=document.createElement("canvas");let s=null;this.videoPlayerMp4=document.createElement("video"),this.videoPlayerMp4.autoplay=!0,this.videoPlayerMp4.playsInline=!0,this.videoPlayerMp4.muted=!0,this.videoPlayerMp4.addEventListener("loadeddata",()=>{this.videoPlayerMp4&&(s||(e.width=this.videoPlayerMp4.videoWidth,e.height=this.videoPlayerMp4.videoHeight,s=e.getContext("2d")),s==null||s.drawImage(this.videoPlayerMp4,0,0,e.width,e.height),this.videoPlayer.controls=!1,this.videoPlayer.poster=e.toDataURL("image/jpeg"))});const n=this.codecList.filter(r=>this.media.includes(r.indexOf("vc1")>0?"video":"audio")).filter(r=>this.videoPlayer.canPlayType(`video/mp4; codecs="${r}"`)).join();console.log(this.cameraDevice.name,"Playable codecs (MP4):",n),this.socket.emit("stream-payload",{id:this.streamId,data:{type:"mp4",value:n}})}onMp4Buffer(e){this.finishLoading(),this.videoPlayerMp4&&(this.videoPlayerMp4.src="data:video/mp4;base64,"+this.btoaBinary(e.value))}requestHls(){this.reset();const e=this.parseCodecs(s=>this.videoPlayer.canPlayType(s));console.log(this.cameraDevice.name,"Playable codecs (HLS):",e),this.socket.emit("stream-payload",{id:this.streamId,data:{type:"hls",value:e}})}onHlsData(e){const s="http"+e.wsURL.substring(2,e.wsURL.indexOf("/ws"))+"/hls/",n=e.value.replace("hls/",s),r="data:application/vnd.apple.mpegurl;base64,"+btoa(n.toString());this.videoPlayer.src=r,this.finishLoading(),this.play()}onStreamInfo(e){var n;const s=e.value;(n=s==null?void 0:s.producers)!=null&&n.length&&(this.hasBackchannel=s.producers.some(r=>{var o;return(o=r.senders)==null?void 0:o.length}))}async play(){try{await this.videoPlayer.play()}catch(e){if(!this.videoPlayer.muted)return this.videoPlayer.muted=!0,this.play();this.logger.warn(this.cameraDevice.name,e)}}finishLoading(){this._finishLoading||(this._finishLoading=!0,this.dispatchEvent(new Event("finishLoading")))}createCodecsList(){const e=["avc1.640029","avc1.64002A","avc1.640033","hvc1.1.6.L153.B0","mp4a.40.2","mp4a.40.5","flac","opus"],s=typeof window>"u"?null:navigator.userAgent.match(/Version\/(\d+).+Safari/);if(s!=null&&s[1]){const n=s[1]<"13"?"mp4a.40.2":s[1]<"14"?"flac":"opus";e.splice(e.indexOf(n))}this.codecList=e}parseCodecs(e){return this.codecList.filter(s=>this.media.includes(s.indexOf("vc1")>0?"video":"audio")).filter(s=>e(`video/mp4; codecs="${s}"`)).join()}btoaBinary(e){const s=new Uint8Array(e),n=s.byteLength;let r="";for(let o=0;o<n;o++)r+=String.fromCharCode(s[o]);return window.btoa(r)}}class Zt extends si{constructor(e,s,n){super(e,n);d(this,"socketService");d(this,"socket");d(this,"pluginName","@camera.ui/client");d(this,"subject");d(this,"_started",!1);d(this,"cameraDelegate",new ii(this.onRequest.bind(this)));d(this,"ptzDelegate",new ri(this.onRequest.bind(this)));d(this,"prebufferDelegate",new ni(this.onRequest.bind(this)));this.socketService=s;const{socket:r}=this.socketService.getSocket(this.id,!0);this.socket=r,this.socket.connect(),this.subject=`${this.pluginName}.camera.${this.id}`,this.listenToMessages()}get started(){return this._started}get sources(){return JSON.parse(JSON.stringify(this.cameraSubject.getValue().sources)).map(e=>({...e,getPrebufferingState:s=>this.prebufferDelegate.getPrebufferingState(e.name,s),getStreamInfo:async()=>this.prebufferDelegate.getStreamInfo(e.name)}))}async start(){this._started||(this._started=!0,await this.refreshStates(),this.socket.emit("joinRoomStates",this.id))}stop(){this._started=!1,this.socket.emit("leaveRoomStates",this.id)}close(){this.cleanup()}connect(){return this.onRequest("cameraFn","connect")}disconnect(){return this.onRequest("cameraFn","disconnect")}createSession(e){return new oi(this,this.socketService,this.logger,e)}async refreshStates(){const e=await this.onRequest("cameraFn","refreshStates");super.updateCamera(e.camera),super.updateCameraState(e.cameraState);for(const[s,n]of Object.entries(e.states))super.updateStateInternal(s,n,!0)}async cleanup(){this.stop(),this.removeAllListeners(),this.unsubscribe(),this.socket.removeAllListeners()}listenToMessages(){this.socket.emit("joinRoomDevice",this.id),this.socket.on("updateState",e=>{e.cameraId===this.id&&super.updateStateInternal(e.stateName,e.data.newEvent,!0)}),this.socket.on("updateDevice",e=>{if(e.cameraId===this.id)switch(e.type){case"removed":this.cleanup();break;case"updated":super.updateCamera(e.data);break;case"cameraState":super.updateCameraState(e.data)}})}onRequest(e,s,n=[]){const r={requestId:rt(),targetId:this.subject,targetName:this.name,pluginId:this.pluginName,cameraId:this.id,type:"request",proxy:"camera",client:e,fn:s,args:n,timestamp:Date.now(),timeout:5e3};return new Promise((o,a)=>{this.socket.emit("request",r,h=>{h.error?a(h.error):o(h.response)})})}}class ai{constructor(t,e){d(this,"socketService");d(this,"socket");d(this,"logger");d(this,"pluginName","@camera.ui/client");d(this,"subject");this.socketService=t,this.socket=t.socket,this.logger=e,this.subject=`${this.pluginName}.coreManager`}async getFFmpegPath(){return this.onRequest("getFFmpegPath")}async getHwaccelInfo(){return this.onRequest("getHwaccelInfo")}async getServerAddresses(){return this.onRequest("getServerAddresses")}async getIceServers(){return this.onRequest("getIceServers")}onRequest(t,e){const s={requestId:rt(),targetId:this.subject,targetName:this.pluginName,pluginId:this.pluginName,type:"request",proxy:"core",client:"coreFn",fn:t,args:e||[],timestamp:Date.now(),timeout:5e3};return new Promise((n,r)=>{this.socket.emit("request",s,o=>{o.error?r(o.error):n(o.response)})})}}class ci{constructor(t,e){d(this,"socketService");d(this,"socket");d(this,"logger");d(this,"pluginName","@camera.ui/client");d(this,"subject");this.socketService=t,this.socket=t.socket,this.logger=e,this.subject=`${this.pluginName}.deviceManager`}async getCameraById(t){const e=await this.onRequest("getCameraById",[t]);if(e){const s=new Zt(e,this.socketService,this.logger);return await s.refreshStates(),s}}async getCameraByName(t){const e=await this.onRequest("getCameraByName",[t]);if(e){const s=new Zt(e,this.socketService,this.logger);return await s.refreshStates(),s}}onRequest(t,e){const s={requestId:rt(),targetId:this.subject,targetName:this.pluginName,pluginId:this.pluginName,type:"request",proxy:"device",client:"deviceFn",fn:t,args:e||[],timestamp:Date.now(),timeout:5e3};return new Promise((n,r)=>{this.socket.emit("request",s,o=>{o.error?r(o.error):n(o.response)})})}}const ne=Object.create(null);ne.open="0",ne.close="1",ne.ping="2",ne.pong="3",ne.message="4",ne.upgrade="5",ne.noop="6";const Ke=Object.create(null);Object.keys(ne).forEach(i=>{Ke[ne[i]]=i});const Tt={type:"error",data:"parser error"},Os=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",As=typeof ArrayBuffer=="function",Cs=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,dt=({type:i,data:t},e,s)=>Os&&t instanceof Blob?e?s(t):es(t,s):As&&(t instanceof ArrayBuffer||Cs(t))?e?s(t):es(new Blob([t]),s):s(ne[i]+(t||"")),es=(i,t)=>{const e=new FileReader;return e.onload=function(){const s=e.result.split(",")[1];t("b"+(s||""))},e.readAsDataURL(i)};function ts(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let pt;const Be=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<64;i++)Be["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(i)]=i;const hi=typeof ArrayBuffer=="function",Rt=(i,t)=>{if(typeof i!="string")return{type:"message",data:Ts(i,t)};const e=i.charAt(0);return e==="b"?{type:"message",data:ui(i.substring(1),t)}:Ke[e]?i.length>1?{type:Ke[e],data:i.substring(1)}:{type:Ke[e]}:Tt},ui=(i,t)=>{if(hi){const e=(s=>{let n,r,o,a,h,l=.75*s.length,u=s.length,f=0;s[s.length-1]==="="&&(l--,s[s.length-2]==="="&&l--);const w=new ArrayBuffer(l),v=new Uint8Array(w);for(n=0;n<u;n+=4)r=Be[s.charCodeAt(n)],o=Be[s.charCodeAt(n+1)],a=Be[s.charCodeAt(n+2)],h=Be[s.charCodeAt(n+3)],v[f++]=r<<2|o>>4,v[f++]=(15&o)<<4|a>>2,v[f++]=(3&a)<<6|63&h;return w})(i);return Ts(e,t)}return{base64:!0,data:i}},Ts=(i,t)=>t==="blob"?i instanceof Blob?i:new Blob([i]):i instanceof ArrayBuffer?i:i.buffer,ss="";let gt;function ze(i){return i.reduce((t,e)=>t+e.length,0)}function Ve(i,t){if(i[0].length===t)return i.shift();const e=new Uint8Array(t);let s=0;for(let n=0;n<t;n++)e[n]=i[0][s++],s===i[0].length&&(i.shift(),s=0);return i.length&&s<i[0].length&&(i[0]=i[0].slice(s)),e}function D(i){if(i)return function(t){for(var e in D.prototype)t[e]=D.prototype[e];return t}(i)}D.prototype.on=D.prototype.addEventListener=function(i,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(t),this},D.prototype.once=function(i,t){function e(){this.off(i,e),t.apply(this,arguments)}return e.fn=t,this.on(i,e),this},D.prototype.off=D.prototype.removeListener=D.prototype.removeAllListeners=D.prototype.removeEventListener=function(i,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var e,s=this._callbacks["$"+i];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var n=0;n<s.length;n++)if((e=s[n])===t||e.fn===t){s.splice(n,1);break}return s.length===0&&delete this._callbacks["$"+i],this},D.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),e=this._callbacks["$"+i],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(e){s=0;for(var n=(e=e.slice(0)).length;s<n;++s)e[s].apply(this,t)}return this},D.prototype.emitReserved=D.prototype.emit,D.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]},D.prototype.hasListeners=function(i){return!!this.listeners(i).length};const J=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function Rs(i,...t){return t.reduce((e,s)=>(i.hasOwnProperty(s)&&(e[s]=i[s]),e),{})}const li=J.setTimeout,fi=J.clearTimeout;function ot(i,t){t.useNativeTimers?(i.setTimeoutFn=li.bind(J),i.clearTimeoutFn=fi.bind(J)):(i.setTimeoutFn=J.setTimeout.bind(J),i.clearTimeoutFn=J.clearTimeout.bind(J))}class di extends Error{constructor(t,e,s){super(t),this.description=e,this.context=s,this.type="TransportError"}}class mt extends D{constructor(t){super(),this.writable=!1,ot(this,t),this.opts=t,this.query=t.query,this.socket=t.socket}onError(t,e,s){return super.emitReserved("error",new di(t,e,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return this.readyState!=="opening"&&this.readyState!=="open"||(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const e=Rt(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const e=function(s){let n="";for(let r in s)s.hasOwnProperty(r)&&(n.length&&(n+="&"),n+=encodeURIComponent(r)+"="+encodeURIComponent(s[r]));return n}(t);return e.length?"?"+e:""}}const js="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),jt=64,pi={};let is,ns=0,We=0;function rs(i){let t="";do t=js[i%jt]+t,i=Math.floor(i/jt);while(i>0);return t}function os(){const i=rs(+new Date);return i!==is?(ns=0,is=i):i+"."+rs(ns++)}for(;We<jt;We++)pi[js[We]]=We;let Bs=!1;try{Bs=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const gi=Bs;function Ls(i){const t=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||gi))return new XMLHttpRequest}catch{}if(!t)try{return new J[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function mi(){}const yi=new Ls({xdomain:!1}).responseType!=null;class re extends D{constructor(t,e){super(),ot(this,e),this.opts=e,this.method=e.method||"GET",this.uri=t,this.data=e.data!==void 0?e.data:null,this.create()}create(){var t;const e=Rs(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd;const s=this.xhr=new Ls(e);try{s.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let n in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(n)&&s.setRequestHeader(n,this.opts.extraHeaders[n])}}catch{}if(this.method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(s.timeout=this.opts.requestTimeout),s.onreadystatechange=()=>{var n;s.readyState===3&&((n=this.opts.cookieJar)===null||n===void 0||n.parseCookies(s)),s.readyState===4&&(s.status===200||s.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof s.status=="number"?s.status:0)},0))},s.send(this.data)}catch(n){return void this.setTimeoutFn(()=>{this.onError(n)},0)}typeof document<"u"&&(this.index=re.requestsCount++,re.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(this.xhr!==void 0&&this.xhr!==null){if(this.xhr.onreadystatechange=mi,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete re.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function as(){for(let i in re.requests)re.requests.hasOwnProperty(i)&&re.requests[i].abort()}re.requestsCount=0,re.requests={},typeof document<"u"&&(typeof attachEvent=="function"?attachEvent("onunload",as):typeof addEventListener=="function"&&addEventListener("onpagehide"in J?"pagehide":"unload",as,!1));const Bt=typeof Promise=="function"&&typeof Promise.resolve=="function"?i=>Promise.resolve().then(i):(i,t)=>t(i,0),He=J.WebSocket||J.MozWebSocket,cs=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",bi={websocket:class extends mt{constructor(i){super(i),this.supportsBinary=!i.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const i=this.uri(),t=this.opts.protocols,e=cs?{}:Rs(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(e.headers=this.opts.extraHeaders);try{this.ws=cs?new He(i,t,e):t?new He(i,t):new He(i)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=i=>this.onClose({description:"websocket connection closed",context:i}),this.ws.onmessage=i=>this.onData(i.data),this.ws.onerror=i=>this.onError("websocket error",i)}write(i){this.writable=!1;for(let t=0;t<i.length;t++){const e=i[t],s=t===i.length-1;dt(e,this.supportsBinary,n=>{try{this.ws.send(n)}catch{}s&&Bt(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){this.ws!==void 0&&(this.ws.close(),this.ws=null)}uri(){const i=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=os()),this.supportsBinary||(t.b64=1),this.createUri(i,t)}check(){return!!He}},webtransport:class extends mt{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(i=>{this.onError("webtransport error",i)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(i=>{const t=function(o,a){gt||(gt=new TextDecoder);const h=[];let l=0,u=-1,f=!1;return new TransformStream({transform(w,v){for(h.push(w);;){if(l===0){if(ze(h)<1)break;const m=Ve(h,1);f=!(128&~m[0]),u=127&m[0],l=u<126?3:u===126?1:2}else if(l===1){if(ze(h)<2)break;const m=Ve(h,2);u=new DataView(m.buffer,m.byteOffset,m.length).getUint16(0),l=3}else if(l===2){if(ze(h)<8)break;const m=Ve(h,8),S=new DataView(m.buffer,m.byteOffset,m.length),_=S.getUint32(0);if(_>Math.pow(2,21)-1){v.enqueue(Tt);break}u=_*Math.pow(2,32)+S.getUint32(4),l=3}else{if(ze(h)<u)break;const m=Ve(h,u);v.enqueue(Rt(f?m:gt.decode(m),a)),l=0}if(u===0||u>o){v.enqueue(Tt);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),e=i.readable.pipeThrough(t).getReader(),s=new TransformStream({transform(o,a){(function(h,l){Os&&h.data instanceof Blob?h.data.arrayBuffer().then(ts).then(l):As&&(h.data instanceof ArrayBuffer||Cs(h.data))?l(ts(h.data)):dt(h,!1,u=>{pt||(pt=new TextEncoder),l(pt.encode(u))})})(o,h=>{const l=h.length;let u;if(l<126)u=new Uint8Array(1),new DataView(u.buffer).setUint8(0,l);else if(l<65536){u=new Uint8Array(3);const f=new DataView(u.buffer);f.setUint8(0,126),f.setUint16(1,l)}else{u=new Uint8Array(9);const f=new DataView(u.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(l))}o.data&&typeof o.data!="string"&&(u[0]|=128),a.enqueue(u),a.enqueue(h)})}});s.readable.pipeTo(i.writable),this.writer=s.writable.getWriter();const n=()=>{e.read().then(({done:o,value:a})=>{o||(this.onPacket(a),n())}).catch(o=>{})};n();const r={type:"open"};this.query.sid&&(r.data=`{"sid":"${this.query.sid}"}`),this.writer.write(r).then(()=>this.onOpen())})}))}write(i){this.writable=!1;for(let t=0;t<i.length;t++){const e=i[t],s=t===i.length-1;this.writer.write(e).then(()=>{s&&Bt(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var i;(i=this.transport)===null||i===void 0||i.close()}},polling:class extends mt{constructor(i){if(super(i),this.polling=!1,typeof location<"u"){const e=location.protocol==="https:";let s=location.port;s||(s=e?"443":"80"),this.xd=typeof location<"u"&&i.hostname!==location.hostname||s!==i.port}const t=i&&i.forceBase64;this.supportsBinary=yi&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(i){this.readyState="pausing";const t=()=>{this.readyState="paused",i()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(i){((t,e)=>{const s=t.split(ss),n=[];for(let r=0;r<s.length;r++){const o=Rt(s[r],e);if(n.push(o),o.type==="error")break}return n})(i,this.socket.binaryType).forEach(t=>{if(this.readyState==="opening"&&t.type==="open"&&this.onOpen(),t.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)}),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const i=()=>{this.write([{type:"close"}])};this.readyState==="open"?i():this.once("open",i)}write(i){this.writable=!1,((t,e)=>{const s=t.length,n=new Array(s);let r=0;t.forEach((o,a)=>{dt(o,!1,h=>{n[a]=h,++r===s&&e(n.join(ss))})})})(i,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const i=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=os()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(i,t)}request(i={}){return Object.assign(i,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new re(this.uri(),i)}doWrite(i,t){const e=this.request({method:"POST",data:i});e.on("success",t),e.on("error",(s,n)=>{this.onError("xhr post error",s,n)})}doPoll(){const i=this.request();i.on("data",this.onData.bind(this)),i.on("error",(t,e)=>{this.onError("xhr poll error",t,e)}),this.pollXhr=i}}},vi=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,wi=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Lt(i){if(i.length>2e3)throw"URI too long";const t=i,e=i.indexOf("["),s=i.indexOf("]");e!=-1&&s!=-1&&(i=i.substring(0,e)+i.substring(e,s).replace(/:/g,";")+i.substring(s,i.length));let n=vi.exec(i||""),r={},o=14;for(;o--;)r[wi[o]]=n[o]||"";return e!=-1&&s!=-1&&(r.source=t,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=function(a,h){const l=h.replace(/\/{2,9}/g,"/").split("/");return h.slice(0,1)!="/"&&h.length!==0||l.splice(0,1),h.slice(-1)=="/"&&l.splice(l.length-1,1),l}(0,r.path),r.queryKey=function(a,h){const l={};return h.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(u,f,w){f&&(l[f]=w)}),l}(0,r.query),r}class pe extends D{constructor(t,e={}){super(),this.binaryType="arraybuffer",this.writeBuffer=[],t&&typeof t=="object"&&(e=t,t=null),t?(t=Lt(t),e.hostname=t.host,e.secure=t.protocol==="https"||t.protocol==="wss",e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=Lt(e.host).host),ot(this,e),this.secure=e.secure!=null?e.secure:typeof location<"u"&&location.protocol==="https:",e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=e.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=e.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=function(s){let n={},r=s.split("&");for(let o=0,a=r.length;o<a;o++){let h=r[o].split("=");n[decodeURIComponent(h[0])]=decodeURIComponent(h[1])}return n}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const e=Object.assign({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);const s=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new bi[t](s)}open(){let t;if(this.opts.rememberUpgrade&&pe.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else{if(this.transports.length===0)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch{return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",e=>this.onClose("transport close",e))}probe(t){let e=this.createTransport(t),s=!1;pe.priorWebsocketSuccess=!1;const n=()=>{s||(e.send([{type:"ping",data:"probe"}]),e.once("packet",f=>{if(!s)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;pe.priorWebsocketSuccess=e.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(u(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{const w=new Error("probe error");w.transport=e.name,this.emitReserved("upgradeError",w)}}))};function r(){s||(s=!0,u(),e.close(),e=null)}const o=f=>{const w=new Error("probe error: "+f);w.transport=e.name,r(),this.emitReserved("upgradeError",w)};function a(){o("transport closed")}function h(){o("socket closed")}function l(f){e&&f.name!==e.name&&r()}const u=()=>{e.removeListener("open",n),e.removeListener("error",o),e.removeListener("close",a),this.off("close",h),this.off("upgrading",l)};e.once("open",n),e.once("error",o),e.once("close",a),this.once("close",h),this.once("upgrading",l),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{s||e.open()},200):e.open()}onOpen(){if(this.readyState="open",pe.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const e=this.upgrades.length;for(;t<e;t++)this.probe(this.upgrades[t])}}onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),this.resetPingTimeout(),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let s=0;s<this.writeBuffer.length;s++){const n=this.writeBuffer[s].data;if(n&&(t+=typeof(e=n)=="string"?function(r){let o=0,a=0;for(let h=0,l=r.length;h<l;h++)o=r.charCodeAt(h),o<128?a+=1:o<2048?a+=2:o<55296||o>=57344?a+=3:(h++,a+=4);return a}(e):Math.ceil(1.33*(e.byteLength||e.size))),s>0&&t>this.maxPayload)return this.writeBuffer.slice(0,s);t+=2}var e;return this.writeBuffer}write(t,e,s){return this.sendPacket("message",t,e,s),this}send(t,e,s){return this.sendPacket("message",t,e,s),this}sendPacket(t,e,s,n){if(typeof e=="function"&&(n=e,e=void 0),typeof s=="function"&&(n=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;(s=s||{}).compress=s.compress!==!1;const r={type:t,data:e,options:s};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),n&&this.once("flush",n),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},s=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return this.readyState!=="opening"&&this.readyState!=="open"||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}onError(t){pe.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,e){this.readyState!=="opening"&&this.readyState!=="open"&&this.readyState!=="closing"||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const e=[];let s=0;const n=t.length;for(;s<n;s++)~this.transports.indexOf(t[s])&&e.push(t[s]);return e}}pe.protocol=4;const Si=typeof ArrayBuffer=="function",ki=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,Ds=Object.prototype.toString,_i=typeof Blob=="function"||typeof Blob<"u"&&Ds.call(Blob)==="[object BlobConstructor]",Ei=typeof File=="function"||typeof File<"u"&&Ds.call(File)==="[object FileConstructor]";function It(i){return Si&&(i instanceof ArrayBuffer||ki(i))||_i&&i instanceof Blob||Ei&&i instanceof File}function Xe(i,t){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let e=0,s=i.length;e<s;e++)if(Xe(i[e]))return!0;return!1}if(It(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Xe(i.toJSON(),!0);for(const e in i)if(Object.prototype.hasOwnProperty.call(i,e)&&Xe(i[e]))return!0;return!1}function xi(i){const t=[],e=i.data,s=i;return s.data=Dt(e,t),s.attachments=t.length,{packet:s,buffers:t}}function Dt(i,t){if(!i)return i;if(It(i)){const e={_placeholder:!0,num:t.length};return t.push(i),e}if(Array.isArray(i)){const e=new Array(i.length);for(let s=0;s<i.length;s++)e[s]=Dt(i[s],t);return e}if(typeof i=="object"&&!(i instanceof Date)){const e={};for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=Dt(i[s],t));return e}return i}function Oi(i,t){return i.data=Pt(i.data,t),delete i.attachments,i}function Pt(i,t){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<t.length)return t[i.num];throw new Error("illegal attachments")}if(Array.isArray(i))for(let e=0;e<i.length;e++)i[e]=Pt(i[e],t);else if(typeof i=="object")for(const e in i)Object.prototype.hasOwnProperty.call(i,e)&&(i[e]=Pt(i[e],t));return i}const Ai=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Ci=5;var O;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(O||(O={}));class Ti{constructor(t){this.replacer=t}encode(t){return t.type!==O.EVENT&&t.type!==O.ACK||!Xe(t)?[this.encodeAsString(t)]:this.encodeAsBinary({type:t.type===O.EVENT?O.BINARY_EVENT:O.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id})}encodeAsString(t){let e=""+t.type;return t.type!==O.BINARY_EVENT&&t.type!==O.BINARY_ACK||(e+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(e+=t.nsp+","),t.id!=null&&(e+=t.id),t.data!=null&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){const e=xi(t),s=this.encodeAsString(e.packet),n=e.buffers;return n.unshift(s),n}}function hs(i){return Object.prototype.toString.call(i)==="[object Object]"}class qt extends D{constructor(t){super(),this.reviver=t}add(t){let e;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);const s=e.type===O.BINARY_EVENT;s||e.type===O.BINARY_ACK?(e.type=s?O.EVENT:O.ACK,this.reconstructor=new Ri(e),e.attachments===0&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else{if(!It(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e))}}decodeString(t){let e=0;const s={type:Number(t.charAt(0))};if(O[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===O.BINARY_EVENT||s.type===O.BINARY_ACK){const r=e+1;for(;t.charAt(++e)!=="-"&&e!=t.length;);const o=t.substring(r,e);if(o!=Number(o)||t.charAt(e)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(t.charAt(e+1)==="/"){const r=e+1;for(;++e&&t.charAt(e)!==","&&e!==t.length;);s.nsp=t.substring(r,e)}else s.nsp="/";const n=t.charAt(e+1);if(n!==""&&Number(n)==n){const r=e+1;for(;++e;){const o=t.charAt(e);if(o==null||Number(o)!=o){--e;break}if(e===t.length)break}s.id=Number(t.substring(r,e+1))}if(t.charAt(++e)){const r=this.tryParse(t.substr(e));if(!qt.isPayloadValid(s.type,r))throw new Error("invalid payload");s.data=r}return s}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,e){switch(t){case O.CONNECT:return hs(e);case O.DISCONNECT:return e===void 0;case O.CONNECT_ERROR:return typeof e=="string"||hs(e);case O.EVENT:case O.BINARY_EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&Ai.indexOf(e[0])===-1);case O.ACK:case O.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Ri{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const e=Oi(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function ie(i,t,e){return i.on(t,e),function(){i.off(t,e)}}const ji=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ps extends D{constructor(t,e,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[ie(t,"open",this.onopen.bind(this)),ie(t,"packet",this.onpacket.bind(this)),ie(t,"error",this.onerror.bind(this)),ie(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen()),this}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){if(ji.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;const s={type:O.EVENT,data:e,options:{}};if(s.options.compress=this.flags.compress!==!1,typeof e[e.length-1]=="function"){const r=this.ids++,o=e.pop();this._registerAckCallback(r,o),s.id=r}const n=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!n||!this.connected)||(this.connected?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(t,e){var s;const n=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(n===void 0)return void(this.acks[t]=e);const r=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);e.call(this,new Error("operation has timed out"))},n),o=(...a)=>{this.io.clearTimeoutFn(r),e.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...e){return new Promise((s,n)=>{const r=(o,a)=>o?n(o):s(a);r.withError=!0,e.push(r),this.emit(t,...e)})}_addToQueue(t){let e;typeof t[t.length-1]=="function"&&(e=t.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((n,...r)=>{if(s===this._queue[0])return n!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(n)):(this._queue.shift(),e&&e(null,...r)),s.pending=!1,this._drainQueue()}),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:O.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(e=>String(e.id)===t)){const e=this.acks[t];delete this.acks[t],e.withError&&e.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case O.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case O.EVENT:case O.BINARY_EVENT:this.onevent(t);break;case O.ACK:case O.BINARY_ACK:this.onack(t);break;case O.DISCONNECT:this.ondisconnect();break;case O.CONNECT_ERROR:this.destroy();const e=new Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e)}}onevent(t){const e=t.data||[];t.id!=null&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const e=this._anyListeners.slice();for(const s of e)s.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const e=this;let s=!1;return function(...n){s||(s=!0,e.packet({type:O.ACK,id:t,data:n}))}}onack(t){const e=this.acks[t.id];typeof e=="function"&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:O.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const e=this._anyListeners;for(let s=0;s<e.length;s++)if(t===e[s])return e.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const e=this._anyOutgoingListeners;for(let s=0;s<e.length;s++)if(t===e[s])return e.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const e=this._anyOutgoingListeners.slice();for(const s of e)s.apply(this,t.data)}}}function ke(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}ke.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),e=Math.floor(t*this.jitter*i);i=1&Math.floor(10*t)?i+e:i-e}return 0|Math.min(i,this.max)},ke.prototype.reset=function(){this.attempts=0},ke.prototype.setMin=function(i){this.ms=i},ke.prototype.setMax=function(i){this.max=i},ke.prototype.setJitter=function(i){this.jitter=i};class st extends D{constructor(t,e){var s;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.opts=e,ot(this,e),this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor((s=e.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new ke({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this._readyState="closed",this.uri=t;const n=e.parser||bt;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=e.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(e=this.backoff)===null||e===void 0||e.setMin(t),this)}randomizationFactor(t){var e;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(e=this.backoff)===null||e===void 0||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(e=this.backoff)===null||e===void 0||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new pe(this.uri,this.opts);const e=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const n=ie(e,"open",function(){s.onopen(),t&&t()}),r=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=ie(e,"error",r);if(this._timeout!==!1){const a=this._timeout,h=this.setTimeoutFn(()=>{n(),r(new Error("timeout")),e.close()},a);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(n),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(ie(t,"ping",this.onping.bind(this)),ie(t,"data",this.ondata.bind(this)),ie(t,"error",this.onerror.bind(this)),ie(t,"close",this.onclose.bind(this)),ie(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(e){this.onclose("parse error",e)}}ondecoded(t){Bt(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new Ps(this,t,e),this.nsps[t]=s),s}_destroy(t){const e=Object.keys(this.nsps);for(const s of e)if(this.nsps[s].active)return;this._close()}_packet(t){const e=this.encoder.encode(t);for(let s=0;s<e.length;s++)this.engine.write(e[s],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,e){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const e=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),t.skipReconnect||t.open(n=>{n?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",n)):t.onreconnect()}))},e);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Re={};function yt(i,t){typeof i=="object"&&(t=i,i=void 0);const e=function(h,l="",u){let f=h;u=u||typeof location<"u"&&location,h==null&&(h=u.protocol+"//"+u.host),typeof h=="string"&&(h.charAt(0)==="/"&&(h=h.charAt(1)==="/"?u.protocol+h:u.host+h),/^(https?|wss?):\/\//.test(h)||(h=u!==void 0?u.protocol+"//"+h:"https://"+h),f=Lt(h)),f.port||(/^(http|ws)$/.test(f.protocol)?f.port="80":/^(http|ws)s$/.test(f.protocol)&&(f.port="443")),f.path=f.path||"/";const w=f.host.indexOf(":")!==-1?"["+f.host+"]":f.host;return f.id=f.protocol+"://"+w+":"+f.port+l,f.href=f.protocol+"://"+w+(u&&u.port===f.port?"":":"+f.port),f}(i,(t=t||{}).path||"/socket.io"),s=e.source,n=e.id,r=e.path,o=Re[n]&&r in Re[n].nsps;let a;return t.forceNew||t["force new connection"]||t.multiplex===!1||o?a=new st(s,t):(Re[n]||(Re[n]=new st(s,t)),a=Re[n]),e.query&&!t.query&&(t.query=e.queryKey),a.socket(e.path,t)}Object.assign(yt,{Manager:st,Socket:Ps,io:yt,connect:yt});class Bi{constructor(t,e){d(this,"socket");d(this,"token");d(this,"endpoint");d(this,"socketList",new Map);this.endpoint=t.replace("https://","wss://").replace("http://","ws://"),this.token=e,this.socket=this.getSocket("default").socket,this.socket.connect()}close(){this.socket.emit("end"),this.socket.removeAllListeners(),this.socket.disconnect()}getSocket(t,e){return this.createManager(e)}createManager(t){const e=new st(this.endpoint,{reconnection:!0,reconnectionDelay:500,rejectUnauthorized:!1,transports:["websocket"],forceNew:t}),s=e.socket("/proxy",{auth:{token:`Bearer ${this.token}`}});return{manager:e,socket:s}}}class Li{constructor(t){d(this,"api");d(this,"socketService");d(this,"config");d(this,"logger");d(this,"token");d(this,"deviceManager");d(this,"coreManager");this.config=t,this.logger=t.logger||{...console,attention:console.warn},this.api=new Fs(t.endpoint)}async connect(){return this.deviceManager&&this.coreManager||(this.cleanUpClient(),await this.login(),this.token=this.token||this.config.token,this.socketService=new Bi(this.config.endpoint,this.token),this.coreManager=new ai(this.socketService,this.logger),this.deviceManager=new ci(this.socketService,this.logger),this.checkSession()),{coreManager:this.coreManager,deviceManager:this.deviceManager}}async disconnect(){var t;(t=this.socketService)==null||t.close(),this.cleanUpClient(),this.config.username&&this.config.password&&await this.api.post("/auth/logout",void 0,{headers:{Authorization:`Bearer ${this.token}`}})}async updateCredentials(t){this.config={...this.config,...t},this.socketService&&await this.disconnect(),await this.connect()}async login(){var t;if(this.config.username&&this.config.password)try{const e=await this.api.post("/auth/login",{username:this.config.username,password:this.config.password}),s=await e.json();this.token=s.access_token}catch(e){throw((t=e.response)==null?void 0:t.status)===401?new Error("Invalid credentials"):new Error(`Failed to get token: ${e.message}`)}else if(this.config.token&&!this.config.skipCheck)try{await this.api.get("/auth/check",{headers:{Authorization:`Bearer ${this.config.token}`}})}catch(e){throw new Error(`Invalid token: ${e.message}`)}this.token=this.token||this.config.token}getDeviceManager(){return this.deviceManager}checkSession(){var t,e;(t=this.socketService)==null||t.socket.removeListener("invalidToken"),(e=this.socketService)==null||e.socket.on("invalidToken",async s=>{s===this.token&&await this.disconnect()})}cleanUpClient(){this.deviceManager=void 0}}var Pi=ds.j;export{Pi as r};
@@ -1 +1 @@
1
- var he=s=>{throw TypeError(s)};var Gt=(s,t,e)=>t.has(s)||he("Cannot "+e);var r=(s,t,e)=>(Gt(s,t,"read from private field"),e?e.call(s):t.get(s)),d=(s,t,e)=>t.has(s)?he("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),o=(s,t,e,i)=>(Gt(s,t,"write to private field"),i?i.call(s,e):t.set(s,e),e),p=(s,t,e)=>(Gt(s,t,"access private method"),e);var Kt=(s,t,e,i)=>({set _(n){o(s,t,n,e)},get _(){return r(s,t,i)}});import{i as Fe,u as We,h as ze,a as Ye,r as Je,n as Xe,c as De,s as Ee,w as mt,o as Me,t as Ae}from"./@vue.BeJw0wEm.0.0.30-alpha.0.js";var At=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(s){return this.listeners.add(s),this.onSubscribe(),()=>{this.listeners.delete(s),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},yt=typeof window>"u"||"Deno"in globalThis;function L(){}function Ze(s,t){return typeof s=="function"?s(t):s}function Bt(s){return typeof s=="number"&&s>=0&&s!==1/0}function Ue(s,t){return Math.max(s+(t||0)-Date.now(),0)}function vt(s,t){return typeof s=="function"?s(t):s}function N(s,t){return typeof s=="function"?s(t):s}function ce(s,t){const{type:e="all",exact:i,fetchStatus:n,predicate:a,queryKey:u,stale:f}=s;if(u){if(i){if(t.queryHash!==ae(u,t.options))return!1}else if(!qt(t.queryKey,u))return!1}if(e!=="all"){const g=t.isActive();if(e==="active"&&!g||e==="inactive"&&g)return!1}return!(typeof f=="boolean"&&t.isStale()!==f||n&&n!==t.state.fetchStatus||a&&!a(t))}function le(s,t){const{exact:e,status:i,predicate:n,mutationKey:a}=s;if(a){if(!t.options.mutationKey)return!1;if(e){if(pt(t.options.mutationKey)!==pt(a))return!1}else if(!qt(t.options.mutationKey,a))return!1}return!(i&&t.state.status!==i||n&&!n(t))}function ae(s,t){return((t==null?void 0:t.queryKeyHashFn)||pt)(s)}function pt(s){return JSON.stringify(s,(t,e)=>$t(e)?Object.keys(e).sort().reduce((i,n)=>(i[n]=e[n],i),{}):e)}function qt(s,t){return s===t?!0:typeof s!=typeof t?!1:s&&t&&typeof s=="object"&&typeof t=="object"?!Object.keys(t).some(e=>!qt(s[e],t[e])):!1}function qe(s,t){if(s===t)return s;const e=fe(s)&&fe(t);if(e||$t(s)&&$t(t)){const i=e?s:Object.keys(s),n=i.length,a=e?t:Object.keys(t),u=a.length,f=e?[]:{};let g=0;for(let C=0;C<u;C++){const y=e?C:a[C];(!e&&i.includes(y)||e)&&s[y]===void 0&&t[y]===void 0?(f[y]=void 0,g++):(f[y]=qe(s[y],t[y]),f[y]===s[y]&&s[y]!==void 0&&g++)}return n===u&&g===n?s:f}return t}function Ht(s,t){if(!t||Object.keys(s).length!==Object.keys(t).length)return!1;for(const e in s)if(s[e]!==t[e])return!1;return!0}function fe(s){return Array.isArray(s)&&s.length===Object.keys(s).length}function $t(s){if(!de(s))return!1;const t=s.constructor;if(t===void 0)return!0;const e=t.prototype;return!(!de(e)||!e.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(s)!==Object.prototype)}function de(s){return Object.prototype.toString.call(s)==="[object Object]"}function ts(s){return new Promise(t=>{setTimeout(t,s)})}function Vt(s,t,e){return typeof e.structuralSharing=="function"?e.structuralSharing(s,t):e.structuralSharing!==!1?qe(s,t):t}function es(s,t,e=0){const i=[...s,t];return e&&i.length>e?i.slice(1):i}function ss(s,t,e=0){const i=[t,...s];return e&&i.length>e?i.slice(0,-1):i}var Ie=Symbol();function Te(s,t){return!s.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!s.queryFn||s.queryFn===Ie?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}var ut,Z,bt,ve,is=(ve=class extends At{constructor(){super();d(this,ut);d(this,Z);d(this,bt);o(this,bt,t=>{if(!yt&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}})}onSubscribe(){r(this,Z)||this.setEventListener(r(this,bt))}onUnsubscribe(){var t;this.hasListeners()||((t=r(this,Z))==null||t.call(this),o(this,Z,void 0))}setEventListener(t){var e;o(this,bt,t),(e=r(this,Z))==null||e.call(this),o(this,Z,t(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(t){r(this,ut)!==t&&(o(this,ut,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){var t;return typeof r(this,ut)=="boolean"?r(this,ut):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ut=new WeakMap,Z=new WeakMap,bt=new WeakMap,ve),ue=new is,gt,tt,Ot,be,rs=(be=class extends At{constructor(){super();d(this,gt,!0);d(this,tt);d(this,Ot);o(this,Ot,t=>{if(!yt&&window.addEventListener){const e=()=>t(!0),i=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",i)}}})}onSubscribe(){r(this,tt)||this.setEventListener(r(this,Ot))}onUnsubscribe(){var t;this.hasListeners()||((t=r(this,tt))==null||t.call(this),o(this,tt,void 0))}setEventListener(t){var e;o(this,Ot,t),(e=r(this,tt))==null||e.call(this),o(this,tt,t(this.setOnline.bind(this)))}setOnline(t){r(this,gt)!==t&&(o(this,gt,t),this.listeners.forEach(i=>{i(t)}))}isOnline(){return r(this,gt)}},gt=new WeakMap,tt=new WeakMap,Ot=new WeakMap,be),Nt=new rs;function ns(s){return Math.min(1e3*2**s,3e4)}function je(s){return(s??"online")==="online"?Nt.isOnline():!0}var xe=class extends Error{constructor(s){super("CancelledError"),this.revert=s==null?void 0:s.revert,this.silent=s==null?void 0:s.silent}};function _t(s){return s instanceof xe}function Ke(s){let t=!1,e=0,i=!1,n,a,u;const f=new Promise((O,Q)=>{a=O,u=Q}),g=O=>{var Q;i||(P(new xe(O)),(Q=s.abort)==null||Q.call(s))},C=()=>{t=!0},y=()=>{t=!1},h=()=>ue.isFocused()&&(s.networkMode==="always"||Nt.isOnline())&&s.canRun(),l=()=>je(s.networkMode)&&s.canRun(),c=O=>{var Q;i||(i=!0,(Q=s.onSuccess)==null||Q.call(s,O),n==null||n(),a(O))},P=O=>{var Q;i||(i=!0,(Q=s.onError)==null||Q.call(s,O),n==null||n(),u(O))},D=()=>new Promise(O=>{var Q;n=S=>{(i||h())&&O(S)},(Q=s.onPause)==null||Q.call(s)}).then(()=>{var O;n=void 0,i||(O=s.onContinue)==null||O.call(s)}),R=()=>{if(i)return;let O;const Q=e===0?s.initialPromise:void 0;try{O=Q??s.fn()}catch(S){O=Promise.reject(S)}Promise.resolve(O).then(c).catch(S=>{var b;if(i)return;const E=s.retry??(yt?0:3),M=s.retryDelay??ns,G=typeof M=="function"?M(e,S):M,W=E===!0||typeof E=="number"&&e<E||typeof E=="function"&&E(e,S);if(t||!W){P(S);return}e++,(b=s.onFail)==null||b.call(s,e,S),ts(G).then(()=>h()?void 0:D()).then(()=>{t?P(S):R()})})};return{promise:f,cancel:g,continue:()=>(n==null||n(),f),cancelRetry:C,continueRetry:y,canStart:l,start:()=>(l()?R():D().then(R),f)}}function as(){let s=[],t=0,e=l=>{l()},i=l=>{l()},n=l=>setTimeout(l,0);const a=l=>{n=l},u=l=>{let c;t++;try{c=l()}finally{t--,t||C()}return c},f=l=>{t?s.push(l):n(()=>{e(l)})},g=l=>(...c)=>{f(()=>{l(...c)})},C=()=>{const l=s;s=[],l.length&&n(()=>{i(()=>{l.forEach(c=>{e(c)})})})};return{batch:u,batchCalls:g,schedule:f,setNotifyFunction:l=>{e=l},setBatchNotifyFunction:l=>{i=l},setScheduler:a}}var A=as(),ot,ge,Le=(ge=class{constructor(){d(this,ot)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Bt(this.gcTime)&&o(this,ot,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(yt?1/0:5*60*1e3))}clearGcTimeout(){r(this,ot)&&(clearTimeout(r(this,ot)),o(this,ot,void 0))}},ot=new WeakMap,ge),Ct,wt,K,U,It,ht,H,z,Oe,us=(Oe=class extends Le{constructor(t){super();d(this,H);d(this,Ct);d(this,wt);d(this,K);d(this,U);d(this,It);d(this,ht);o(this,ht,!1),o(this,It,t.defaultOptions),this.setOptions(t.options),this.observers=[],o(this,K,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,o(this,Ct,os(this.options)),this.state=t.state??r(this,Ct),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=r(this,U))==null?void 0:t.promise}setOptions(t){this.options={...r(this,It),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&r(this,K).remove(this)}setData(t,e){const i=Vt(this.state.data,t,this.options);return p(this,H,z).call(this,{data:i,type:"success",dataUpdatedAt:e==null?void 0:e.updatedAt,manual:e==null?void 0:e.manual}),i}setState(t,e){p(this,H,z).call(this,{type:"setState",state:t,setStateOptions:e})}cancel(t){var i,n;const e=(i=r(this,U))==null?void 0:i.promise;return(n=r(this,U))==null||n.cancel(t),e?e.then(L).catch(L):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(r(this,Ct))}isActive(){return this.observers.some(t=>N(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Ue(this.state.dataUpdatedAt,t)}onFocus(){var e;const t=this.observers.find(i=>i.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(e=r(this,U))==null||e.continue()}onOnline(){var e;const t=this.observers.find(i=>i.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(e=r(this,U))==null||e.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),r(this,K).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(r(this,U)&&(r(this,ht)?r(this,U).cancel({revert:!0}):r(this,U).cancelRetry()),this.scheduleGc()),r(this,K).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||p(this,H,z).call(this,{type:"invalidate"})}fetch(t,e){var g,C,y;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(e!=null&&e.cancelRefetch))this.cancel({silent:!0});else if(r(this,U))return r(this,U).continueRetry(),r(this,U).promise}if(t&&this.setOptions(t),!this.options.queryFn){const h=this.observers.find(l=>l.options.queryFn);h&&this.setOptions(h.options)}const i=new AbortController,n=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(o(this,ht,!0),i.signal)})},a=()=>{const h=Te(this.options,e),l={queryKey:this.queryKey,meta:this.meta};return n(l),o(this,ht,!1),this.options.persister?this.options.persister(h,l,this):h(l)},u={fetchOptions:e,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:a};n(u),(g=this.options.behavior)==null||g.onFetch(u,this),o(this,wt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((C=u.fetchOptions)==null?void 0:C.meta))&&p(this,H,z).call(this,{type:"fetch",meta:(y=u.fetchOptions)==null?void 0:y.meta});const f=h=>{var l,c,P,D;_t(h)&&h.silent||p(this,H,z).call(this,{type:"error",error:h}),_t(h)||((c=(l=r(this,K).config).onError)==null||c.call(l,h,this),(D=(P=r(this,K).config).onSettled)==null||D.call(P,this.state.data,h,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return o(this,U,Ke({initialPromise:e==null?void 0:e.initialPromise,fn:u.fetchFn,abort:i.abort.bind(i),onSuccess:h=>{var l,c,P,D;if(h===void 0){f(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(h)}catch(R){f(R);return}(c=(l=r(this,K).config).onSuccess)==null||c.call(l,h,this),(D=(P=r(this,K).config).onSettled)==null||D.call(P,h,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:f,onFail:(h,l)=>{p(this,H,z).call(this,{type:"failed",failureCount:h,error:l})},onPause:()=>{p(this,H,z).call(this,{type:"pause"})},onContinue:()=>{p(this,H,z).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0})),r(this,U).start()}},Ct=new WeakMap,wt=new WeakMap,K=new WeakMap,U=new WeakMap,It=new WeakMap,ht=new WeakMap,H=new WeakSet,z=function(t){const e=i=>{switch(t.type){case"failed":return{...i,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...ke(i.data,this.options),fetchMeta:t.meta??null};case"success":return{...i,data:t.data,dataUpdateCount:i.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=t.error;return _t(n)&&n.revert&&r(this,wt)?{...r(this,wt),fetchStatus:"idle"}:{...i,error:n,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...t.state}}};this.state=e(this.state),A.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),r(this,K).notify({query:this,type:"updated",action:t})})},Oe);function ke(s,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:je(t.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function os(s){const t=typeof s.initialData=="function"?s.initialData():s.initialData,e=t!==void 0,i=e?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:e?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:e?"success":"pending",fetchStatus:"idle"}}var _,Ce,He=(Ce=class extends At{constructor(e={}){super();d(this,_);this.config=e,o(this,_,new Map)}build(e,i,n){const a=i.queryKey,u=i.queryHash??ae(a,i);let f=this.get(u);return f||(f=new us({cache:this,queryKey:a,queryHash:u,options:e.defaultQueryOptions(i),state:n,defaultOptions:e.getQueryDefaults(a)}),this.add(f)),f}add(e){r(this,_).has(e.queryHash)||(r(this,_).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const i=r(this,_).get(e.queryHash);i&&(e.destroy(),i===e&&r(this,_).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){A.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return r(this,_).get(e)}getAll(){return[...r(this,_).values()]}find(e){const i={exact:!0,...e};return this.getAll().find(n=>ce(i,n))}findAll(e={}){const i=this.getAll();return Object.keys(e).length>0?i.filter(n=>ce(e,n)):i}notify(e){A.batch(()=>{this.listeners.forEach(i=>{i(e)})})}onFocus(){A.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){A.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},_=new WeakMap,Ce),B,q,ct,$,X,we,hs=(we=class extends Le{constructor(t){super();d(this,$);d(this,B);d(this,q);d(this,ct);this.mutationId=t.mutationId,o(this,q,t.mutationCache),o(this,B,[]),this.state=t.state||Ne(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){r(this,B).includes(t)||(r(this,B).push(t),this.clearGcTimeout(),r(this,q).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){o(this,B,r(this,B).filter(e=>e!==t)),this.scheduleGc(),r(this,q).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){r(this,B).length||(this.state.status==="pending"?this.scheduleGc():r(this,q).remove(this))}continue(){var t;return((t=r(this,ct))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var n,a,u,f,g,C,y,h,l,c,P,D,R,O,Q,S,E,M,G,W;o(this,ct,Ke({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(b,k)=>{p(this,$,X).call(this,{type:"failed",failureCount:b,error:k})},onPause:()=>{p(this,$,X).call(this,{type:"pause"})},onContinue:()=>{p(this,$,X).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>r(this,q).canRun(this)}));const e=this.state.status==="pending",i=!r(this,ct).canStart();try{if(!e){p(this,$,X).call(this,{type:"pending",variables:t,isPaused:i}),await((a=(n=r(this,q).config).onMutate)==null?void 0:a.call(n,t,this));const k=await((f=(u=this.options).onMutate)==null?void 0:f.call(u,t));k!==this.state.context&&p(this,$,X).call(this,{type:"pending",context:k,variables:t,isPaused:i})}const b=await r(this,ct).start();return await((C=(g=r(this,q).config).onSuccess)==null?void 0:C.call(g,b,t,this.state.context,this)),await((h=(y=this.options).onSuccess)==null?void 0:h.call(y,b,t,this.state.context)),await((c=(l=r(this,q).config).onSettled)==null?void 0:c.call(l,b,null,this.state.variables,this.state.context,this)),await((D=(P=this.options).onSettled)==null?void 0:D.call(P,b,null,t,this.state.context)),p(this,$,X).call(this,{type:"success",data:b}),b}catch(b){try{throw await((O=(R=r(this,q).config).onError)==null?void 0:O.call(R,b,t,this.state.context,this)),await((S=(Q=this.options).onError)==null?void 0:S.call(Q,b,t,this.state.context)),await((M=(E=r(this,q).config).onSettled)==null?void 0:M.call(E,void 0,b,this.state.variables,this.state.context,this)),await((W=(G=this.options).onSettled)==null?void 0:W.call(G,void 0,b,t,this.state.context)),b}finally{p(this,$,X).call(this,{type:"error",error:b})}}finally{r(this,q).runNext(this)}}},B=new WeakMap,q=new WeakMap,ct=new WeakMap,$=new WeakSet,X=function(t){const e=i=>{switch(t.type){case"failed":return{...i,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...i,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:t.error,failureCount:i.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),A.batch(()=>{r(this,B).forEach(i=>{i.onMutationUpdate(t)}),r(this,q).notify({mutation:this,type:"updated",action:t})})},we);function Ne(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var x,Tt,Qe,Ge=(Qe=class extends At{constructor(e={}){super();d(this,x);d(this,Tt);this.config=e,o(this,x,new Map),o(this,Tt,Date.now())}build(e,i,n){const a=new hs({mutationCache:this,mutationId:++Kt(this,Tt)._,options:e.defaultMutationOptions(i),state:n});return this.add(a),a}add(e){const i=Lt(e),n=r(this,x).get(i)??[];n.push(e),r(this,x).set(i,n),this.notify({type:"added",mutation:e})}remove(e){var n;const i=Lt(e);if(r(this,x).has(i)){const a=(n=r(this,x).get(i))==null?void 0:n.filter(u=>u!==e);a&&(a.length===0?r(this,x).delete(i):r(this,x).set(i,a))}this.notify({type:"removed",mutation:e})}canRun(e){var n;const i=(n=r(this,x).get(Lt(e)))==null?void 0:n.find(a=>a.state.status==="pending");return!i||i===e}runNext(e){var n;const i=(n=r(this,x).get(Lt(e)))==null?void 0:n.find(a=>a!==e&&a.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}clear(){A.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}getAll(){return[...r(this,x).values()].flat()}find(e){const i={exact:!0,...e};return this.getAll().find(n=>le(i,n))}findAll(e={}){return this.getAll().filter(i=>le(e,i))}notify(e){A.batch(()=>{this.listeners.forEach(i=>{i(e)})})}resumePausedMutations(){const e=this.getAll().filter(i=>i.state.isPaused);return A.batch(()=>Promise.all(e.map(i=>i.continue().catch(L))))}},x=new WeakMap,Tt=new WeakMap,Qe);function Lt(s){var t;return((t=s.options.scope)==null?void 0:t.id)??String(s.mutationId)}function cs(s){return{onFetch:(t,e)=>{const i=async()=>{var P,D,R,O,Q;const n=t.options,a=(R=(D=(P=t.fetchOptions)==null?void 0:P.meta)==null?void 0:D.fetchMore)==null?void 0:R.direction,u=((O=t.state.data)==null?void 0:O.pages)||[],f=((Q=t.state.data)==null?void 0:Q.pageParams)||[],g={pages:[],pageParams:[]};let C=!1;const y=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(t.signal.aborted?C=!0:t.signal.addEventListener("abort",()=>{C=!0}),t.signal)})},h=Te(t.options,t.fetchOptions),l=async(S,E,M)=>{if(C)return Promise.reject();if(E==null&&S.pages.length)return Promise.resolve(S);const G={queryKey:t.queryKey,pageParam:E,direction:M?"backward":"forward",meta:t.options.meta};y(G);const W=await h(G),{maxPages:b}=t.options,k=M?ss:es;return{pages:k(S.pages,W,b),pageParams:k(S.pageParams,E,b)}};let c;if(a&&u.length){const S=a==="backward",E=S?ls:ye,M={pages:u,pageParams:f},G=E(n,M);c=await l(M,G,S)}else{c=await l(g,f[0]??n.initialPageParam);const S=s??u.length;for(let E=1;E<S;E++){const M=ye(n,c);if(M==null)break;c=await l(c,M)}}return c};t.options.persister?t.fetchFn=()=>{var n,a;return(a=(n=t.options).persister)==null?void 0:a.call(n,i,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},e)}:t.fetchFn=i}}}function ye(s,{pages:t,pageParams:e}){const i=t.length-1;return t.length>0?s.getNextPageParam(t[i],t,e[i],e):void 0}function ls(s,{pages:t,pageParams:e}){var i;return t.length>0?(i=s.getPreviousPageParam)==null?void 0:i.call(s,t[0],t,e[0],e):void 0}var F,et,st,Qt,St,it,Pt,Rt,Se,fs=(Se=class{constructor(t={}){d(this,F);d(this,et);d(this,st);d(this,Qt);d(this,St);d(this,it);d(this,Pt);d(this,Rt);o(this,F,t.queryCache||new He),o(this,et,t.mutationCache||new Ge),o(this,st,t.defaultOptions||{}),o(this,Qt,new Map),o(this,St,new Map),o(this,it,0)}mount(){Kt(this,it)._++,r(this,it)===1&&(o(this,Pt,ue.subscribe(async t=>{t&&(await this.resumePausedMutations(),r(this,F).onFocus())})),o(this,Rt,Nt.subscribe(async t=>{t&&(await this.resumePausedMutations(),r(this,F).onOnline())})))}unmount(){var t,e;Kt(this,it)._--,r(this,it)===0&&((t=r(this,Pt))==null||t.call(this),o(this,Pt,void 0),(e=r(this,Rt))==null||e.call(this),o(this,Rt,void 0))}isFetching(t){return r(this,F).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return r(this,et).findAll({...t,status:"pending"}).length}getQueryData(t){var i;const e=this.defaultQueryOptions({queryKey:t});return(i=r(this,F).get(e.queryHash))==null?void 0:i.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);if(e===void 0)return this.fetchQuery(t);{const i=this.defaultQueryOptions(t),n=r(this,F).build(this,i);return t.revalidateIfStale&&n.isStaleByTime(vt(i.staleTime,n))&&this.prefetchQuery(i),Promise.resolve(e)}}getQueriesData(t){return r(this,F).findAll(t).map(({queryKey:e,state:i})=>{const n=i.data;return[e,n]})}setQueryData(t,e,i){const n=this.defaultQueryOptions({queryKey:t}),a=r(this,F).get(n.queryHash),u=a==null?void 0:a.state.data,f=Ze(e,u);if(f!==void 0)return r(this,F).build(this,n).setData(f,{...i,manual:!0})}setQueriesData(t,e,i){return A.batch(()=>r(this,F).findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,i)]))}getQueryState(t){var i;const e=this.defaultQueryOptions({queryKey:t});return(i=r(this,F).get(e.queryHash))==null?void 0:i.state}removeQueries(t){const e=r(this,F);A.batch(()=>{e.findAll(t).forEach(i=>{e.remove(i)})})}resetQueries(t,e){const i=r(this,F),n={type:"active",...t};return A.batch(()=>(i.findAll(t).forEach(a=>{a.reset()}),this.refetchQueries(n,e)))}cancelQueries(t={},e={}){const i={revert:!0,...e},n=A.batch(()=>r(this,F).findAll(t).map(a=>a.cancel(i)));return Promise.all(n).then(L).catch(L)}invalidateQueries(t={},e={}){return A.batch(()=>{if(r(this,F).findAll(t).forEach(n=>{n.invalidate()}),t.refetchType==="none")return Promise.resolve();const i={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(i,e)})}refetchQueries(t={},e){const i={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},n=A.batch(()=>r(this,F).findAll(t).filter(a=>!a.isDisabled()).map(a=>{let u=a.fetch(void 0,i);return i.throwOnError||(u=u.catch(L)),a.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(n).then(L)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const i=r(this,F).build(this,e);return i.isStaleByTime(vt(e.staleTime,i))?i.fetch(e):Promise.resolve(i.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(L).catch(L)}fetchInfiniteQuery(t){return t.behavior=cs(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(L).catch(L)}resumePausedMutations(){return Nt.isOnline()?r(this,et).resumePausedMutations():Promise.resolve()}getQueryCache(){return r(this,F)}getMutationCache(){return r(this,et)}getDefaultOptions(){return r(this,st)}setDefaultOptions(t){o(this,st,t)}setQueryDefaults(t,e){r(this,Qt).set(pt(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...r(this,Qt).values()];let i={};return e.forEach(n=>{qt(t,n.queryKey)&&(i={...i,...n.defaultOptions})}),i}setMutationDefaults(t,e){r(this,St).set(pt(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...r(this,St).values()];let i={};return e.forEach(n=>{qt(t,n.mutationKey)&&(i={...i,...n.defaultOptions})}),i}defaultQueryOptions(t){if(t._defaulted)return t;const e={...r(this,st).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=ae(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.enabled!==!0&&e.queryFn===Ie&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...r(this,st).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){r(this,F).clear(),r(this,et).clear()}},F=new WeakMap,et=new WeakMap,st=new WeakMap,Qt=new WeakMap,St=new WeakMap,it=new WeakMap,Pt=new WeakMap,Rt=new WeakMap,Se),T,v,jt,I,lt,Ft,V,xt,Dt,Et,ft,dt,rt,Mt,w,Ut,Wt,zt,Yt,Jt,Xt,Zt,te,_e,Pe,ds=(Pe=class extends At{constructor(t,e){super();d(this,w);d(this,T);d(this,v);d(this,jt);d(this,I);d(this,lt);d(this,Ft);d(this,V);d(this,xt);d(this,Dt);d(this,Et);d(this,ft);d(this,dt);d(this,rt);d(this,Mt,new Set);this.options=e,o(this,T,t),o(this,V,null),this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(r(this,v).addObserver(this),pe(r(this,v),this.options)?p(this,w,Ut).call(this):this.updateResult(),p(this,w,Jt).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ee(r(this,v),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ee(r(this,v),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,p(this,w,Xt).call(this),p(this,w,Zt).call(this),r(this,v).removeObserver(this)}setOptions(t,e){const i=this.options,n=r(this,v);if(this.options=r(this,T).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof N(this.options.enabled,r(this,v))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");p(this,w,te).call(this),r(this,v).setOptions(this.options),i._defaulted&&!Ht(this.options,i)&&r(this,T).getQueryCache().notify({type:"observerOptionsUpdated",query:r(this,v),observer:this});const a=this.hasListeners();a&&me(r(this,v),n,this.options,i)&&p(this,w,Ut).call(this),this.updateResult(e),a&&(r(this,v)!==n||N(this.options.enabled,r(this,v))!==N(i.enabled,r(this,v))||vt(this.options.staleTime,r(this,v))!==vt(i.staleTime,r(this,v)))&&p(this,w,Wt).call(this);const u=p(this,w,zt).call(this);a&&(r(this,v)!==n||N(this.options.enabled,r(this,v))!==N(i.enabled,r(this,v))||u!==r(this,rt))&&p(this,w,Yt).call(this,u)}getOptimisticResult(t){const e=r(this,T).getQueryCache().build(r(this,T),t),i=this.createResult(e,t);return ps(this,i)&&(o(this,I,i),o(this,Ft,this.options),o(this,lt,r(this,v).state)),i}getCurrentResult(){return r(this,I)}trackResult(t,e){const i={};return Object.keys(t).forEach(n=>{Object.defineProperty(i,n,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(n),e==null||e(n),t[n])})}),i}trackProp(t){r(this,Mt).add(t)}getCurrentQuery(){return r(this,v)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=r(this,T).defaultQueryOptions(t),i=r(this,T).getQueryCache().build(r(this,T),e);return i.isFetchingOptimistic=!0,i.fetch().then(()=>this.createResult(i,e))}fetch(t){return p(this,w,Ut).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),r(this,I)))}createResult(t,e){var W;const i=r(this,v),n=this.options,a=r(this,I),u=r(this,lt),f=r(this,Ft),C=t!==i?t.state:r(this,jt),{state:y}=t;let h={...y},l=!1,c;if(e._optimisticResults){const b=this.hasListeners(),k=!b&&pe(t,e),Ve=b&&me(t,i,e,n);(k||Ve)&&(h={...h,...ke(y.data,t.options)}),e._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:P,errorUpdatedAt:D,status:R}=h;if(e.select&&h.data!==void 0)if(a&&h.data===(u==null?void 0:u.data)&&e.select===r(this,xt))c=r(this,Dt);else try{o(this,xt,e.select),c=e.select(h.data),c=Vt(a==null?void 0:a.data,c,e),o(this,Dt,c),o(this,V,null)}catch(b){o(this,V,b)}else c=h.data;if(e.placeholderData!==void 0&&c===void 0&&R==="pending"){let b;if(a!=null&&a.isPlaceholderData&&e.placeholderData===(f==null?void 0:f.placeholderData))b=a.data;else if(b=typeof e.placeholderData=="function"?e.placeholderData((W=r(this,Et))==null?void 0:W.state.data,r(this,Et)):e.placeholderData,e.select&&b!==void 0)try{b=e.select(b),o(this,V,null)}catch(k){o(this,V,k)}b!==void 0&&(R="success",c=Vt(a==null?void 0:a.data,b,e),l=!0)}r(this,V)&&(P=r(this,V),c=r(this,Dt),D=Date.now(),R="error");const O=h.fetchStatus==="fetching",Q=R==="pending",S=R==="error",E=Q&&O,M=c!==void 0;return{status:R,fetchStatus:h.fetchStatus,isPending:Q,isSuccess:R==="success",isError:S,isInitialLoading:E,isLoading:E,data:c,dataUpdatedAt:h.dataUpdatedAt,error:P,errorUpdatedAt:D,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>C.dataUpdateCount||h.errorUpdateCount>C.errorUpdateCount,isFetching:O,isRefetching:O&&!Q,isLoadingError:S&&!M,isPaused:h.fetchStatus==="paused",isPlaceholderData:l,isRefetchError:S&&M,isStale:oe(t,e),refetch:this.refetch}}updateResult(t){const e=r(this,I),i=this.createResult(r(this,v),this.options);if(o(this,lt,r(this,v).state),o(this,Ft,this.options),r(this,lt).data!==void 0&&o(this,Et,r(this,v)),Ht(i,e))return;o(this,I,i);const n={},a=()=>{if(!e)return!0;const{notifyOnChangeProps:u}=this.options,f=typeof u=="function"?u():u;if(f==="all"||!f&&!r(this,Mt).size)return!0;const g=new Set(f??r(this,Mt));return this.options.throwOnError&&g.add("error"),Object.keys(r(this,I)).some(C=>{const y=C;return r(this,I)[y]!==e[y]&&g.has(y)})};(t==null?void 0:t.listeners)!==!1&&a()&&(n.listeners=!0),p(this,w,_e).call(this,{...n,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&p(this,w,Jt).call(this)}},T=new WeakMap,v=new WeakMap,jt=new WeakMap,I=new WeakMap,lt=new WeakMap,Ft=new WeakMap,V=new WeakMap,xt=new WeakMap,Dt=new WeakMap,Et=new WeakMap,ft=new WeakMap,dt=new WeakMap,rt=new WeakMap,Mt=new WeakMap,w=new WeakSet,Ut=function(t){p(this,w,te).call(this);let e=r(this,v).fetch(this.options,t);return t!=null&&t.throwOnError||(e=e.catch(L)),e},Wt=function(){p(this,w,Xt).call(this);const t=vt(this.options.staleTime,r(this,v));if(yt||r(this,I).isStale||!Bt(t))return;const i=Ue(r(this,I).dataUpdatedAt,t)+1;o(this,ft,setTimeout(()=>{r(this,I).isStale||this.updateResult()},i))},zt=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(r(this,v)):this.options.refetchInterval)??!1},Yt=function(t){p(this,w,Zt).call(this),o(this,rt,t),!(yt||N(this.options.enabled,r(this,v))===!1||!Bt(r(this,rt))||r(this,rt)===0)&&o(this,dt,setInterval(()=>{(this.options.refetchIntervalInBackground||ue.isFocused())&&p(this,w,Ut).call(this)},r(this,rt)))},Jt=function(){p(this,w,Wt).call(this),p(this,w,Yt).call(this,p(this,w,zt).call(this))},Xt=function(){r(this,ft)&&(clearTimeout(r(this,ft)),o(this,ft,void 0))},Zt=function(){r(this,dt)&&(clearInterval(r(this,dt)),o(this,dt,void 0))},te=function(){const t=r(this,T).getQueryCache().build(r(this,T),this.options);if(t===r(this,v))return;const e=r(this,v);o(this,v,t),o(this,jt,t.state),this.hasListeners()&&(e==null||e.removeObserver(this),t.addObserver(this))},_e=function(t){A.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(r(this,I))}),r(this,T).getQueryCache().notify({query:r(this,v),type:"observerResultsUpdated"})})},Pe);function ys(s,t){return N(t.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&t.retryOnMount===!1)}function pe(s,t){return ys(s,t)||s.state.data!==void 0&&ee(s,t,t.refetchOnMount)}function ee(s,t,e){if(N(t.enabled,s)!==!1){const i=typeof e=="function"?e(s):e;return i==="always"||i!==!1&&oe(s,t)}return!1}function me(s,t,e,i){return(s!==t||N(i.enabled,s)===!1)&&(!e.suspense||s.state.status!=="error")&&oe(s,e)}function oe(s,t){return N(t.enabled,s)!==!1&&s.isStaleByTime(vt(t.staleTime,s))}function ps(s,t){return!Ht(s.getCurrentResult(),t)}var nt,at,j,Y,J,kt,se,Re,ms=(Re=class extends At{constructor(t,e){super();d(this,J);d(this,nt);d(this,at);d(this,j);d(this,Y);o(this,nt,t),this.setOptions(e),this.bindMethods(),p(this,J,kt).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var i;const e=this.options;this.options=r(this,nt).defaultMutationOptions(t),Ht(this.options,e)||r(this,nt).getMutationCache().notify({type:"observerOptionsUpdated",mutation:r(this,j),observer:this}),e!=null&&e.mutationKey&&this.options.mutationKey&&pt(e.mutationKey)!==pt(this.options.mutationKey)?this.reset():((i=r(this,j))==null?void 0:i.state.status)==="pending"&&r(this,j).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=r(this,j))==null||t.removeObserver(this)}onMutationUpdate(t){p(this,J,kt).call(this),p(this,J,se).call(this,t)}getCurrentResult(){return r(this,at)}reset(){var t;(t=r(this,j))==null||t.removeObserver(this),o(this,j,void 0),p(this,J,kt).call(this),p(this,J,se).call(this)}mutate(t,e){var i;return o(this,Y,e),(i=r(this,j))==null||i.removeObserver(this),o(this,j,r(this,nt).getMutationCache().build(r(this,nt),this.options)),r(this,j).addObserver(this),r(this,j).execute(t)}},nt=new WeakMap,at=new WeakMap,j=new WeakMap,Y=new WeakMap,J=new WeakSet,kt=function(){var e;const t=((e=r(this,j))==null?void 0:e.state)??Ne();o(this,at,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},se=function(t){A.batch(()=>{var e,i,n,a,u,f,g,C;if(r(this,Y)&&this.hasListeners()){const y=r(this,at).variables,h=r(this,at).context;(t==null?void 0:t.type)==="success"?((i=(e=r(this,Y)).onSuccess)==null||i.call(e,t.data,y,h),(a=(n=r(this,Y)).onSettled)==null||a.call(n,t.data,null,y,h)):(t==null?void 0:t.type)==="error"&&((f=(u=r(this,Y)).onError)==null||f.call(u,t.error,y,h),(C=(g=r(this,Y)).onSettled)==null||C.call(g,void 0,t.error,y,h))}this.listeners.forEach(y=>{y(r(this,at))})})},Re),vs="VUE_QUERY_CLIENT";function Be(s){const t=s?`:${s}`:"";return`${vs}${t}`}function ie(s,t){Object.keys(s).forEach(e=>{s[e]=t[e]})}function re(s,t,e="",i=0){if(t){const n=t(s,e,i);if(n===void 0&&Fe(s)||n!==void 0)return n}if(Array.isArray(s))return s.map((n,a)=>re(n,t,String(a),i+1));if(typeof s=="object"&&gs(s)){const n=Object.entries(s).map(([a,u])=>[a,re(u,t,a,i+1)]);return Object.fromEntries(n)}return s}function bs(s,t){return re(s,t)}function m(s,t=!1){return bs(s,(e,i,n)=>{if(n===1&&i==="queryKey")return m(e,!0);if(t&&Os(e))return m(e(),t);if(Fe(e))return m(We(e),t)})}function gs(s){if(Object.prototype.toString.call(s)!=="[object Object]")return!1;const t=Object.getPrototypeOf(s);return t===null||t===Object.prototype}function Os(s){return typeof s=="function"}function ne(s,t){return typeof s=="function"?s(...t):!!s}function $e(s=""){if(!ze())throw new Error("vue-query hooks can only be used inside setup() function or functions that support injection context.");const t=Be(s),e=Ye(t);if(!e)throw new Error("No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library.");return e}var Cs=class extends He{find(s){return super.find(m(s))}findAll(s={}){return super.findAll(m(s))}},ws=class extends Ge{find(s){return super.find(m(s))}findAll(s={}){return super.findAll(m(s))}},Qs=class extends fs{constructor(s={}){const t={defaultOptions:s.defaultOptions,queryCache:s.queryCache||new Cs,mutationCache:s.mutationCache||new ws};super(t),this.isRestoring=Je(!1)}isFetching(s={}){return super.isFetching(m(s))}isMutating(s={}){return super.isMutating(m(s))}getQueryData(s){return super.getQueryData(m(s))}ensureQueryData(s){return super.ensureQueryData(m(s))}getQueriesData(s){return super.getQueriesData(m(s))}setQueryData(s,t,e={}){return super.setQueryData(m(s),t,m(e))}setQueriesData(s,t,e={}){return super.setQueriesData(m(s),t,m(e))}getQueryState(s){return super.getQueryState(m(s))}removeQueries(s={}){return super.removeQueries(m(s))}resetQueries(s={},t={}){return super.resetQueries(m(s),m(t))}cancelQueries(s={},t={}){return super.cancelQueries(m(s),m(t))}invalidateQueries(s={},t={}){const e=m(s),i=m(t);if(super.invalidateQueries({...e,refetchType:"none"},i),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return Xe().then(()=>super.refetchQueries(n,i))}refetchQueries(s={},t={}){return super.refetchQueries(m(s),m(t))}fetchQuery(s){return super.fetchQuery(m(s))}prefetchQuery(s){return super.prefetchQuery(m(s))}fetchInfiniteQuery(s){return super.fetchInfiniteQuery(m(s))}prefetchInfiniteQuery(s){return super.prefetchInfiniteQuery(m(s))}setDefaultOptions(s){super.setDefaultOptions(m(s))}setQueryDefaults(s,t){super.setQueryDefaults(m(s),m(t))}getQueryDefaults(s){return super.getQueryDefaults(m(s))}setMutationDefaults(s,t){super.setMutationDefaults(m(s),m(t))}getMutationDefaults(s){return super.getMutationDefaults(m(s))}},Ms={install:(s,t={})=>{const e=Be(t.queryClientKey);let i;if("queryClient"in t&&t.queryClient)i=t.queryClient;else{const u="queryClientConfig"in t?t.queryClientConfig:void 0;i=new Qs(u)}yt||i.mount();let n=()=>{};if(t.clientPersister){i.isRestoring.value=!0;const[u,f]=t.clientPersister(i);n=u,f.then(()=>{var g;i.isRestoring.value=!1,(g=t.clientPersisterOnSuccess)==null||g.call(t,i)})}const a=()=>{i.unmount(),n()};if(s.onUnmount)s.onUnmount(a);else{const u=s.unmount;s.unmount=function(){a(),u()}}s.provide(e,i)}};function Ss(s,t,e){const i=$e(),n=De(()=>{const c=m(t);typeof c.enabled=="function"&&(c.enabled=c.enabled());const P=i.defaultQueryOptions(c);return P._optimisticResults=i.isRestoring.value?"isRestoring":"optimistic",P}),a=new s(i,n.value),u=Ee(a.getCurrentResult());let f=()=>{};mt(i.isRestoring,c=>{c||(f(),f=a.subscribe(P=>{ie(u,P)}))},{immediate:!0});const g=()=>{a.setOptions(n.value),ie(u,a.getCurrentResult())};mt(n,g),Me(()=>{f()});const C=(...c)=>(g(),u.refetch(...c)),y=()=>new Promise((c,P)=>{let D=()=>{};const R=()=>{if(n.value.enabled!==!1){a.setOptions(n.value);const O=a.getOptimisticResult(n.value);O.isStale?(D(),a.fetchOptimistic(n.value).then(c,Q=>{ne(n.value.throwOnError,[Q,a.getCurrentQuery()])?P(Q):c(a.getCurrentResult())})):(D(),c(O))}};R(),D=mt(n,R)});mt(()=>u.error,c=>{if(u.isError&&!u.isFetching&&ne(n.value.throwOnError,[c,a.getCurrentQuery()]))throw c});const l=Ae(u);for(const c in u)typeof u[c]=="function"&&(l[c]=u[c]);return l.suspense=y,l.refetch=C,l}function As(s,t){return Ss(ds,s)}function Us(s,t){const e=$e(),i=De(()=>e.defaultMutationOptions(m(s))),n=new ms(e,i.value),a=Ee(n.getCurrentResult()),u=n.subscribe(y=>{ie(a,y)}),f=(y,h)=>{n.mutate(y,h).catch(()=>{})};mt(i,()=>{n.setOptions(i.value)}),Me(()=>{u()});const C=Ae(a);return mt(()=>a.error,y=>{if(y&&ne(i.value.throwOnError,[y]))throw y}),{...C,mutate:f,mutateAsync:a.mutate,reset:a.reset}}export{Qs as Q,Ms as V,As as a,Us as b,$e as u};
1
+ var he=s=>{throw TypeError(s)};var Gt=(s,t,e)=>t.has(s)||he("Cannot "+e);var r=(s,t,e)=>(Gt(s,t,"read from private field"),e?e.call(s):t.get(s)),d=(s,t,e)=>t.has(s)?he("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),o=(s,t,e,i)=>(Gt(s,t,"write to private field"),i?i.call(s,e):t.set(s,e),e),p=(s,t,e)=>(Gt(s,t,"access private method"),e);var Kt=(s,t,e,i)=>({set _(n){o(s,t,n,e)},get _(){return r(s,t,i)}});import{i as Fe,u as We,h as ze,a as Ye,r as Je,n as Xe,c as De,s as Ee,w as mt,o as Me,t as Ae}from"./@vue.BeJw0wEm.0.0.30-alpha.3.js";var At=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(s){return this.listeners.add(s),this.onSubscribe(),()=>{this.listeners.delete(s),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},yt=typeof window>"u"||"Deno"in globalThis;function L(){}function Ze(s,t){return typeof s=="function"?s(t):s}function Bt(s){return typeof s=="number"&&s>=0&&s!==1/0}function Ue(s,t){return Math.max(s+(t||0)-Date.now(),0)}function vt(s,t){return typeof s=="function"?s(t):s}function N(s,t){return typeof s=="function"?s(t):s}function ce(s,t){const{type:e="all",exact:i,fetchStatus:n,predicate:a,queryKey:u,stale:f}=s;if(u){if(i){if(t.queryHash!==ae(u,t.options))return!1}else if(!qt(t.queryKey,u))return!1}if(e!=="all"){const g=t.isActive();if(e==="active"&&!g||e==="inactive"&&g)return!1}return!(typeof f=="boolean"&&t.isStale()!==f||n&&n!==t.state.fetchStatus||a&&!a(t))}function le(s,t){const{exact:e,status:i,predicate:n,mutationKey:a}=s;if(a){if(!t.options.mutationKey)return!1;if(e){if(pt(t.options.mutationKey)!==pt(a))return!1}else if(!qt(t.options.mutationKey,a))return!1}return!(i&&t.state.status!==i||n&&!n(t))}function ae(s,t){return((t==null?void 0:t.queryKeyHashFn)||pt)(s)}function pt(s){return JSON.stringify(s,(t,e)=>$t(e)?Object.keys(e).sort().reduce((i,n)=>(i[n]=e[n],i),{}):e)}function qt(s,t){return s===t?!0:typeof s!=typeof t?!1:s&&t&&typeof s=="object"&&typeof t=="object"?!Object.keys(t).some(e=>!qt(s[e],t[e])):!1}function qe(s,t){if(s===t)return s;const e=fe(s)&&fe(t);if(e||$t(s)&&$t(t)){const i=e?s:Object.keys(s),n=i.length,a=e?t:Object.keys(t),u=a.length,f=e?[]:{};let g=0;for(let C=0;C<u;C++){const y=e?C:a[C];(!e&&i.includes(y)||e)&&s[y]===void 0&&t[y]===void 0?(f[y]=void 0,g++):(f[y]=qe(s[y],t[y]),f[y]===s[y]&&s[y]!==void 0&&g++)}return n===u&&g===n?s:f}return t}function Ht(s,t){if(!t||Object.keys(s).length!==Object.keys(t).length)return!1;for(const e in s)if(s[e]!==t[e])return!1;return!0}function fe(s){return Array.isArray(s)&&s.length===Object.keys(s).length}function $t(s){if(!de(s))return!1;const t=s.constructor;if(t===void 0)return!0;const e=t.prototype;return!(!de(e)||!e.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(s)!==Object.prototype)}function de(s){return Object.prototype.toString.call(s)==="[object Object]"}function ts(s){return new Promise(t=>{setTimeout(t,s)})}function Vt(s,t,e){return typeof e.structuralSharing=="function"?e.structuralSharing(s,t):e.structuralSharing!==!1?qe(s,t):t}function es(s,t,e=0){const i=[...s,t];return e&&i.length>e?i.slice(1):i}function ss(s,t,e=0){const i=[t,...s];return e&&i.length>e?i.slice(0,-1):i}var Ie=Symbol();function Te(s,t){return!s.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!s.queryFn||s.queryFn===Ie?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}var ut,Z,bt,ve,is=(ve=class extends At{constructor(){super();d(this,ut);d(this,Z);d(this,bt);o(this,bt,t=>{if(!yt&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}})}onSubscribe(){r(this,Z)||this.setEventListener(r(this,bt))}onUnsubscribe(){var t;this.hasListeners()||((t=r(this,Z))==null||t.call(this),o(this,Z,void 0))}setEventListener(t){var e;o(this,bt,t),(e=r(this,Z))==null||e.call(this),o(this,Z,t(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(t){r(this,ut)!==t&&(o(this,ut,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){var t;return typeof r(this,ut)=="boolean"?r(this,ut):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ut=new WeakMap,Z=new WeakMap,bt=new WeakMap,ve),ue=new is,gt,tt,Ot,be,rs=(be=class extends At{constructor(){super();d(this,gt,!0);d(this,tt);d(this,Ot);o(this,Ot,t=>{if(!yt&&window.addEventListener){const e=()=>t(!0),i=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",i)}}})}onSubscribe(){r(this,tt)||this.setEventListener(r(this,Ot))}onUnsubscribe(){var t;this.hasListeners()||((t=r(this,tt))==null||t.call(this),o(this,tt,void 0))}setEventListener(t){var e;o(this,Ot,t),(e=r(this,tt))==null||e.call(this),o(this,tt,t(this.setOnline.bind(this)))}setOnline(t){r(this,gt)!==t&&(o(this,gt,t),this.listeners.forEach(i=>{i(t)}))}isOnline(){return r(this,gt)}},gt=new WeakMap,tt=new WeakMap,Ot=new WeakMap,be),Nt=new rs;function ns(s){return Math.min(1e3*2**s,3e4)}function je(s){return(s??"online")==="online"?Nt.isOnline():!0}var xe=class extends Error{constructor(s){super("CancelledError"),this.revert=s==null?void 0:s.revert,this.silent=s==null?void 0:s.silent}};function _t(s){return s instanceof xe}function Ke(s){let t=!1,e=0,i=!1,n,a,u;const f=new Promise((O,Q)=>{a=O,u=Q}),g=O=>{var Q;i||(P(new xe(O)),(Q=s.abort)==null||Q.call(s))},C=()=>{t=!0},y=()=>{t=!1},h=()=>ue.isFocused()&&(s.networkMode==="always"||Nt.isOnline())&&s.canRun(),l=()=>je(s.networkMode)&&s.canRun(),c=O=>{var Q;i||(i=!0,(Q=s.onSuccess)==null||Q.call(s,O),n==null||n(),a(O))},P=O=>{var Q;i||(i=!0,(Q=s.onError)==null||Q.call(s,O),n==null||n(),u(O))},D=()=>new Promise(O=>{var Q;n=S=>{(i||h())&&O(S)},(Q=s.onPause)==null||Q.call(s)}).then(()=>{var O;n=void 0,i||(O=s.onContinue)==null||O.call(s)}),R=()=>{if(i)return;let O;const Q=e===0?s.initialPromise:void 0;try{O=Q??s.fn()}catch(S){O=Promise.reject(S)}Promise.resolve(O).then(c).catch(S=>{var b;if(i)return;const E=s.retry??(yt?0:3),M=s.retryDelay??ns,G=typeof M=="function"?M(e,S):M,W=E===!0||typeof E=="number"&&e<E||typeof E=="function"&&E(e,S);if(t||!W){P(S);return}e++,(b=s.onFail)==null||b.call(s,e,S),ts(G).then(()=>h()?void 0:D()).then(()=>{t?P(S):R()})})};return{promise:f,cancel:g,continue:()=>(n==null||n(),f),cancelRetry:C,continueRetry:y,canStart:l,start:()=>(l()?R():D().then(R),f)}}function as(){let s=[],t=0,e=l=>{l()},i=l=>{l()},n=l=>setTimeout(l,0);const a=l=>{n=l},u=l=>{let c;t++;try{c=l()}finally{t--,t||C()}return c},f=l=>{t?s.push(l):n(()=>{e(l)})},g=l=>(...c)=>{f(()=>{l(...c)})},C=()=>{const l=s;s=[],l.length&&n(()=>{i(()=>{l.forEach(c=>{e(c)})})})};return{batch:u,batchCalls:g,schedule:f,setNotifyFunction:l=>{e=l},setBatchNotifyFunction:l=>{i=l},setScheduler:a}}var A=as(),ot,ge,Le=(ge=class{constructor(){d(this,ot)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Bt(this.gcTime)&&o(this,ot,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(yt?1/0:5*60*1e3))}clearGcTimeout(){r(this,ot)&&(clearTimeout(r(this,ot)),o(this,ot,void 0))}},ot=new WeakMap,ge),Ct,wt,K,U,It,ht,H,z,Oe,us=(Oe=class extends Le{constructor(t){super();d(this,H);d(this,Ct);d(this,wt);d(this,K);d(this,U);d(this,It);d(this,ht);o(this,ht,!1),o(this,It,t.defaultOptions),this.setOptions(t.options),this.observers=[],o(this,K,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,o(this,Ct,os(this.options)),this.state=t.state??r(this,Ct),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=r(this,U))==null?void 0:t.promise}setOptions(t){this.options={...r(this,It),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&r(this,K).remove(this)}setData(t,e){const i=Vt(this.state.data,t,this.options);return p(this,H,z).call(this,{data:i,type:"success",dataUpdatedAt:e==null?void 0:e.updatedAt,manual:e==null?void 0:e.manual}),i}setState(t,e){p(this,H,z).call(this,{type:"setState",state:t,setStateOptions:e})}cancel(t){var i,n;const e=(i=r(this,U))==null?void 0:i.promise;return(n=r(this,U))==null||n.cancel(t),e?e.then(L).catch(L):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(r(this,Ct))}isActive(){return this.observers.some(t=>N(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Ue(this.state.dataUpdatedAt,t)}onFocus(){var e;const t=this.observers.find(i=>i.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(e=r(this,U))==null||e.continue()}onOnline(){var e;const t=this.observers.find(i=>i.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(e=r(this,U))==null||e.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),r(this,K).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(r(this,U)&&(r(this,ht)?r(this,U).cancel({revert:!0}):r(this,U).cancelRetry()),this.scheduleGc()),r(this,K).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||p(this,H,z).call(this,{type:"invalidate"})}fetch(t,e){var g,C,y;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(e!=null&&e.cancelRefetch))this.cancel({silent:!0});else if(r(this,U))return r(this,U).continueRetry(),r(this,U).promise}if(t&&this.setOptions(t),!this.options.queryFn){const h=this.observers.find(l=>l.options.queryFn);h&&this.setOptions(h.options)}const i=new AbortController,n=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(o(this,ht,!0),i.signal)})},a=()=>{const h=Te(this.options,e),l={queryKey:this.queryKey,meta:this.meta};return n(l),o(this,ht,!1),this.options.persister?this.options.persister(h,l,this):h(l)},u={fetchOptions:e,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:a};n(u),(g=this.options.behavior)==null||g.onFetch(u,this),o(this,wt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((C=u.fetchOptions)==null?void 0:C.meta))&&p(this,H,z).call(this,{type:"fetch",meta:(y=u.fetchOptions)==null?void 0:y.meta});const f=h=>{var l,c,P,D;_t(h)&&h.silent||p(this,H,z).call(this,{type:"error",error:h}),_t(h)||((c=(l=r(this,K).config).onError)==null||c.call(l,h,this),(D=(P=r(this,K).config).onSettled)==null||D.call(P,this.state.data,h,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return o(this,U,Ke({initialPromise:e==null?void 0:e.initialPromise,fn:u.fetchFn,abort:i.abort.bind(i),onSuccess:h=>{var l,c,P,D;if(h===void 0){f(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(h)}catch(R){f(R);return}(c=(l=r(this,K).config).onSuccess)==null||c.call(l,h,this),(D=(P=r(this,K).config).onSettled)==null||D.call(P,h,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:f,onFail:(h,l)=>{p(this,H,z).call(this,{type:"failed",failureCount:h,error:l})},onPause:()=>{p(this,H,z).call(this,{type:"pause"})},onContinue:()=>{p(this,H,z).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0})),r(this,U).start()}},Ct=new WeakMap,wt=new WeakMap,K=new WeakMap,U=new WeakMap,It=new WeakMap,ht=new WeakMap,H=new WeakSet,z=function(t){const e=i=>{switch(t.type){case"failed":return{...i,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...ke(i.data,this.options),fetchMeta:t.meta??null};case"success":return{...i,data:t.data,dataUpdateCount:i.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=t.error;return _t(n)&&n.revert&&r(this,wt)?{...r(this,wt),fetchStatus:"idle"}:{...i,error:n,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...t.state}}};this.state=e(this.state),A.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),r(this,K).notify({query:this,type:"updated",action:t})})},Oe);function ke(s,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:je(t.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function os(s){const t=typeof s.initialData=="function"?s.initialData():s.initialData,e=t!==void 0,i=e?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:e?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:e?"success":"pending",fetchStatus:"idle"}}var _,Ce,He=(Ce=class extends At{constructor(e={}){super();d(this,_);this.config=e,o(this,_,new Map)}build(e,i,n){const a=i.queryKey,u=i.queryHash??ae(a,i);let f=this.get(u);return f||(f=new us({cache:this,queryKey:a,queryHash:u,options:e.defaultQueryOptions(i),state:n,defaultOptions:e.getQueryDefaults(a)}),this.add(f)),f}add(e){r(this,_).has(e.queryHash)||(r(this,_).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const i=r(this,_).get(e.queryHash);i&&(e.destroy(),i===e&&r(this,_).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){A.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return r(this,_).get(e)}getAll(){return[...r(this,_).values()]}find(e){const i={exact:!0,...e};return this.getAll().find(n=>ce(i,n))}findAll(e={}){const i=this.getAll();return Object.keys(e).length>0?i.filter(n=>ce(e,n)):i}notify(e){A.batch(()=>{this.listeners.forEach(i=>{i(e)})})}onFocus(){A.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){A.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},_=new WeakMap,Ce),B,q,ct,$,X,we,hs=(we=class extends Le{constructor(t){super();d(this,$);d(this,B);d(this,q);d(this,ct);this.mutationId=t.mutationId,o(this,q,t.mutationCache),o(this,B,[]),this.state=t.state||Ne(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){r(this,B).includes(t)||(r(this,B).push(t),this.clearGcTimeout(),r(this,q).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){o(this,B,r(this,B).filter(e=>e!==t)),this.scheduleGc(),r(this,q).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){r(this,B).length||(this.state.status==="pending"?this.scheduleGc():r(this,q).remove(this))}continue(){var t;return((t=r(this,ct))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var n,a,u,f,g,C,y,h,l,c,P,D,R,O,Q,S,E,M,G,W;o(this,ct,Ke({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(b,k)=>{p(this,$,X).call(this,{type:"failed",failureCount:b,error:k})},onPause:()=>{p(this,$,X).call(this,{type:"pause"})},onContinue:()=>{p(this,$,X).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>r(this,q).canRun(this)}));const e=this.state.status==="pending",i=!r(this,ct).canStart();try{if(!e){p(this,$,X).call(this,{type:"pending",variables:t,isPaused:i}),await((a=(n=r(this,q).config).onMutate)==null?void 0:a.call(n,t,this));const k=await((f=(u=this.options).onMutate)==null?void 0:f.call(u,t));k!==this.state.context&&p(this,$,X).call(this,{type:"pending",context:k,variables:t,isPaused:i})}const b=await r(this,ct).start();return await((C=(g=r(this,q).config).onSuccess)==null?void 0:C.call(g,b,t,this.state.context,this)),await((h=(y=this.options).onSuccess)==null?void 0:h.call(y,b,t,this.state.context)),await((c=(l=r(this,q).config).onSettled)==null?void 0:c.call(l,b,null,this.state.variables,this.state.context,this)),await((D=(P=this.options).onSettled)==null?void 0:D.call(P,b,null,t,this.state.context)),p(this,$,X).call(this,{type:"success",data:b}),b}catch(b){try{throw await((O=(R=r(this,q).config).onError)==null?void 0:O.call(R,b,t,this.state.context,this)),await((S=(Q=this.options).onError)==null?void 0:S.call(Q,b,t,this.state.context)),await((M=(E=r(this,q).config).onSettled)==null?void 0:M.call(E,void 0,b,this.state.variables,this.state.context,this)),await((W=(G=this.options).onSettled)==null?void 0:W.call(G,void 0,b,t,this.state.context)),b}finally{p(this,$,X).call(this,{type:"error",error:b})}}finally{r(this,q).runNext(this)}}},B=new WeakMap,q=new WeakMap,ct=new WeakMap,$=new WeakSet,X=function(t){const e=i=>{switch(t.type){case"failed":return{...i,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...i,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:t.error,failureCount:i.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),A.batch(()=>{r(this,B).forEach(i=>{i.onMutationUpdate(t)}),r(this,q).notify({mutation:this,type:"updated",action:t})})},we);function Ne(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var x,Tt,Qe,Ge=(Qe=class extends At{constructor(e={}){super();d(this,x);d(this,Tt);this.config=e,o(this,x,new Map),o(this,Tt,Date.now())}build(e,i,n){const a=new hs({mutationCache:this,mutationId:++Kt(this,Tt)._,options:e.defaultMutationOptions(i),state:n});return this.add(a),a}add(e){const i=Lt(e),n=r(this,x).get(i)??[];n.push(e),r(this,x).set(i,n),this.notify({type:"added",mutation:e})}remove(e){var n;const i=Lt(e);if(r(this,x).has(i)){const a=(n=r(this,x).get(i))==null?void 0:n.filter(u=>u!==e);a&&(a.length===0?r(this,x).delete(i):r(this,x).set(i,a))}this.notify({type:"removed",mutation:e})}canRun(e){var n;const i=(n=r(this,x).get(Lt(e)))==null?void 0:n.find(a=>a.state.status==="pending");return!i||i===e}runNext(e){var n;const i=(n=r(this,x).get(Lt(e)))==null?void 0:n.find(a=>a!==e&&a.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}clear(){A.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}getAll(){return[...r(this,x).values()].flat()}find(e){const i={exact:!0,...e};return this.getAll().find(n=>le(i,n))}findAll(e={}){return this.getAll().filter(i=>le(e,i))}notify(e){A.batch(()=>{this.listeners.forEach(i=>{i(e)})})}resumePausedMutations(){const e=this.getAll().filter(i=>i.state.isPaused);return A.batch(()=>Promise.all(e.map(i=>i.continue().catch(L))))}},x=new WeakMap,Tt=new WeakMap,Qe);function Lt(s){var t;return((t=s.options.scope)==null?void 0:t.id)??String(s.mutationId)}function cs(s){return{onFetch:(t,e)=>{const i=async()=>{var P,D,R,O,Q;const n=t.options,a=(R=(D=(P=t.fetchOptions)==null?void 0:P.meta)==null?void 0:D.fetchMore)==null?void 0:R.direction,u=((O=t.state.data)==null?void 0:O.pages)||[],f=((Q=t.state.data)==null?void 0:Q.pageParams)||[],g={pages:[],pageParams:[]};let C=!1;const y=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(t.signal.aborted?C=!0:t.signal.addEventListener("abort",()=>{C=!0}),t.signal)})},h=Te(t.options,t.fetchOptions),l=async(S,E,M)=>{if(C)return Promise.reject();if(E==null&&S.pages.length)return Promise.resolve(S);const G={queryKey:t.queryKey,pageParam:E,direction:M?"backward":"forward",meta:t.options.meta};y(G);const W=await h(G),{maxPages:b}=t.options,k=M?ss:es;return{pages:k(S.pages,W,b),pageParams:k(S.pageParams,E,b)}};let c;if(a&&u.length){const S=a==="backward",E=S?ls:ye,M={pages:u,pageParams:f},G=E(n,M);c=await l(M,G,S)}else{c=await l(g,f[0]??n.initialPageParam);const S=s??u.length;for(let E=1;E<S;E++){const M=ye(n,c);if(M==null)break;c=await l(c,M)}}return c};t.options.persister?t.fetchFn=()=>{var n,a;return(a=(n=t.options).persister)==null?void 0:a.call(n,i,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},e)}:t.fetchFn=i}}}function ye(s,{pages:t,pageParams:e}){const i=t.length-1;return t.length>0?s.getNextPageParam(t[i],t,e[i],e):void 0}function ls(s,{pages:t,pageParams:e}){var i;return t.length>0?(i=s.getPreviousPageParam)==null?void 0:i.call(s,t[0],t,e[0],e):void 0}var F,et,st,Qt,St,it,Pt,Rt,Se,fs=(Se=class{constructor(t={}){d(this,F);d(this,et);d(this,st);d(this,Qt);d(this,St);d(this,it);d(this,Pt);d(this,Rt);o(this,F,t.queryCache||new He),o(this,et,t.mutationCache||new Ge),o(this,st,t.defaultOptions||{}),o(this,Qt,new Map),o(this,St,new Map),o(this,it,0)}mount(){Kt(this,it)._++,r(this,it)===1&&(o(this,Pt,ue.subscribe(async t=>{t&&(await this.resumePausedMutations(),r(this,F).onFocus())})),o(this,Rt,Nt.subscribe(async t=>{t&&(await this.resumePausedMutations(),r(this,F).onOnline())})))}unmount(){var t,e;Kt(this,it)._--,r(this,it)===0&&((t=r(this,Pt))==null||t.call(this),o(this,Pt,void 0),(e=r(this,Rt))==null||e.call(this),o(this,Rt,void 0))}isFetching(t){return r(this,F).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return r(this,et).findAll({...t,status:"pending"}).length}getQueryData(t){var i;const e=this.defaultQueryOptions({queryKey:t});return(i=r(this,F).get(e.queryHash))==null?void 0:i.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);if(e===void 0)return this.fetchQuery(t);{const i=this.defaultQueryOptions(t),n=r(this,F).build(this,i);return t.revalidateIfStale&&n.isStaleByTime(vt(i.staleTime,n))&&this.prefetchQuery(i),Promise.resolve(e)}}getQueriesData(t){return r(this,F).findAll(t).map(({queryKey:e,state:i})=>{const n=i.data;return[e,n]})}setQueryData(t,e,i){const n=this.defaultQueryOptions({queryKey:t}),a=r(this,F).get(n.queryHash),u=a==null?void 0:a.state.data,f=Ze(e,u);if(f!==void 0)return r(this,F).build(this,n).setData(f,{...i,manual:!0})}setQueriesData(t,e,i){return A.batch(()=>r(this,F).findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,i)]))}getQueryState(t){var i;const e=this.defaultQueryOptions({queryKey:t});return(i=r(this,F).get(e.queryHash))==null?void 0:i.state}removeQueries(t){const e=r(this,F);A.batch(()=>{e.findAll(t).forEach(i=>{e.remove(i)})})}resetQueries(t,e){const i=r(this,F),n={type:"active",...t};return A.batch(()=>(i.findAll(t).forEach(a=>{a.reset()}),this.refetchQueries(n,e)))}cancelQueries(t={},e={}){const i={revert:!0,...e},n=A.batch(()=>r(this,F).findAll(t).map(a=>a.cancel(i)));return Promise.all(n).then(L).catch(L)}invalidateQueries(t={},e={}){return A.batch(()=>{if(r(this,F).findAll(t).forEach(n=>{n.invalidate()}),t.refetchType==="none")return Promise.resolve();const i={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(i,e)})}refetchQueries(t={},e){const i={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},n=A.batch(()=>r(this,F).findAll(t).filter(a=>!a.isDisabled()).map(a=>{let u=a.fetch(void 0,i);return i.throwOnError||(u=u.catch(L)),a.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(n).then(L)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const i=r(this,F).build(this,e);return i.isStaleByTime(vt(e.staleTime,i))?i.fetch(e):Promise.resolve(i.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(L).catch(L)}fetchInfiniteQuery(t){return t.behavior=cs(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(L).catch(L)}resumePausedMutations(){return Nt.isOnline()?r(this,et).resumePausedMutations():Promise.resolve()}getQueryCache(){return r(this,F)}getMutationCache(){return r(this,et)}getDefaultOptions(){return r(this,st)}setDefaultOptions(t){o(this,st,t)}setQueryDefaults(t,e){r(this,Qt).set(pt(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...r(this,Qt).values()];let i={};return e.forEach(n=>{qt(t,n.queryKey)&&(i={...i,...n.defaultOptions})}),i}setMutationDefaults(t,e){r(this,St).set(pt(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...r(this,St).values()];let i={};return e.forEach(n=>{qt(t,n.mutationKey)&&(i={...i,...n.defaultOptions})}),i}defaultQueryOptions(t){if(t._defaulted)return t;const e={...r(this,st).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=ae(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.enabled!==!0&&e.queryFn===Ie&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...r(this,st).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){r(this,F).clear(),r(this,et).clear()}},F=new WeakMap,et=new WeakMap,st=new WeakMap,Qt=new WeakMap,St=new WeakMap,it=new WeakMap,Pt=new WeakMap,Rt=new WeakMap,Se),T,v,jt,I,lt,Ft,V,xt,Dt,Et,ft,dt,rt,Mt,w,Ut,Wt,zt,Yt,Jt,Xt,Zt,te,_e,Pe,ds=(Pe=class extends At{constructor(t,e){super();d(this,w);d(this,T);d(this,v);d(this,jt);d(this,I);d(this,lt);d(this,Ft);d(this,V);d(this,xt);d(this,Dt);d(this,Et);d(this,ft);d(this,dt);d(this,rt);d(this,Mt,new Set);this.options=e,o(this,T,t),o(this,V,null),this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(r(this,v).addObserver(this),pe(r(this,v),this.options)?p(this,w,Ut).call(this):this.updateResult(),p(this,w,Jt).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ee(r(this,v),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ee(r(this,v),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,p(this,w,Xt).call(this),p(this,w,Zt).call(this),r(this,v).removeObserver(this)}setOptions(t,e){const i=this.options,n=r(this,v);if(this.options=r(this,T).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof N(this.options.enabled,r(this,v))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");p(this,w,te).call(this),r(this,v).setOptions(this.options),i._defaulted&&!Ht(this.options,i)&&r(this,T).getQueryCache().notify({type:"observerOptionsUpdated",query:r(this,v),observer:this});const a=this.hasListeners();a&&me(r(this,v),n,this.options,i)&&p(this,w,Ut).call(this),this.updateResult(e),a&&(r(this,v)!==n||N(this.options.enabled,r(this,v))!==N(i.enabled,r(this,v))||vt(this.options.staleTime,r(this,v))!==vt(i.staleTime,r(this,v)))&&p(this,w,Wt).call(this);const u=p(this,w,zt).call(this);a&&(r(this,v)!==n||N(this.options.enabled,r(this,v))!==N(i.enabled,r(this,v))||u!==r(this,rt))&&p(this,w,Yt).call(this,u)}getOptimisticResult(t){const e=r(this,T).getQueryCache().build(r(this,T),t),i=this.createResult(e,t);return ps(this,i)&&(o(this,I,i),o(this,Ft,this.options),o(this,lt,r(this,v).state)),i}getCurrentResult(){return r(this,I)}trackResult(t,e){const i={};return Object.keys(t).forEach(n=>{Object.defineProperty(i,n,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(n),e==null||e(n),t[n])})}),i}trackProp(t){r(this,Mt).add(t)}getCurrentQuery(){return r(this,v)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=r(this,T).defaultQueryOptions(t),i=r(this,T).getQueryCache().build(r(this,T),e);return i.isFetchingOptimistic=!0,i.fetch().then(()=>this.createResult(i,e))}fetch(t){return p(this,w,Ut).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),r(this,I)))}createResult(t,e){var W;const i=r(this,v),n=this.options,a=r(this,I),u=r(this,lt),f=r(this,Ft),C=t!==i?t.state:r(this,jt),{state:y}=t;let h={...y},l=!1,c;if(e._optimisticResults){const b=this.hasListeners(),k=!b&&pe(t,e),Ve=b&&me(t,i,e,n);(k||Ve)&&(h={...h,...ke(y.data,t.options)}),e._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:P,errorUpdatedAt:D,status:R}=h;if(e.select&&h.data!==void 0)if(a&&h.data===(u==null?void 0:u.data)&&e.select===r(this,xt))c=r(this,Dt);else try{o(this,xt,e.select),c=e.select(h.data),c=Vt(a==null?void 0:a.data,c,e),o(this,Dt,c),o(this,V,null)}catch(b){o(this,V,b)}else c=h.data;if(e.placeholderData!==void 0&&c===void 0&&R==="pending"){let b;if(a!=null&&a.isPlaceholderData&&e.placeholderData===(f==null?void 0:f.placeholderData))b=a.data;else if(b=typeof e.placeholderData=="function"?e.placeholderData((W=r(this,Et))==null?void 0:W.state.data,r(this,Et)):e.placeholderData,e.select&&b!==void 0)try{b=e.select(b),o(this,V,null)}catch(k){o(this,V,k)}b!==void 0&&(R="success",c=Vt(a==null?void 0:a.data,b,e),l=!0)}r(this,V)&&(P=r(this,V),c=r(this,Dt),D=Date.now(),R="error");const O=h.fetchStatus==="fetching",Q=R==="pending",S=R==="error",E=Q&&O,M=c!==void 0;return{status:R,fetchStatus:h.fetchStatus,isPending:Q,isSuccess:R==="success",isError:S,isInitialLoading:E,isLoading:E,data:c,dataUpdatedAt:h.dataUpdatedAt,error:P,errorUpdatedAt:D,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>C.dataUpdateCount||h.errorUpdateCount>C.errorUpdateCount,isFetching:O,isRefetching:O&&!Q,isLoadingError:S&&!M,isPaused:h.fetchStatus==="paused",isPlaceholderData:l,isRefetchError:S&&M,isStale:oe(t,e),refetch:this.refetch}}updateResult(t){const e=r(this,I),i=this.createResult(r(this,v),this.options);if(o(this,lt,r(this,v).state),o(this,Ft,this.options),r(this,lt).data!==void 0&&o(this,Et,r(this,v)),Ht(i,e))return;o(this,I,i);const n={},a=()=>{if(!e)return!0;const{notifyOnChangeProps:u}=this.options,f=typeof u=="function"?u():u;if(f==="all"||!f&&!r(this,Mt).size)return!0;const g=new Set(f??r(this,Mt));return this.options.throwOnError&&g.add("error"),Object.keys(r(this,I)).some(C=>{const y=C;return r(this,I)[y]!==e[y]&&g.has(y)})};(t==null?void 0:t.listeners)!==!1&&a()&&(n.listeners=!0),p(this,w,_e).call(this,{...n,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&p(this,w,Jt).call(this)}},T=new WeakMap,v=new WeakMap,jt=new WeakMap,I=new WeakMap,lt=new WeakMap,Ft=new WeakMap,V=new WeakMap,xt=new WeakMap,Dt=new WeakMap,Et=new WeakMap,ft=new WeakMap,dt=new WeakMap,rt=new WeakMap,Mt=new WeakMap,w=new WeakSet,Ut=function(t){p(this,w,te).call(this);let e=r(this,v).fetch(this.options,t);return t!=null&&t.throwOnError||(e=e.catch(L)),e},Wt=function(){p(this,w,Xt).call(this);const t=vt(this.options.staleTime,r(this,v));if(yt||r(this,I).isStale||!Bt(t))return;const i=Ue(r(this,I).dataUpdatedAt,t)+1;o(this,ft,setTimeout(()=>{r(this,I).isStale||this.updateResult()},i))},zt=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(r(this,v)):this.options.refetchInterval)??!1},Yt=function(t){p(this,w,Zt).call(this),o(this,rt,t),!(yt||N(this.options.enabled,r(this,v))===!1||!Bt(r(this,rt))||r(this,rt)===0)&&o(this,dt,setInterval(()=>{(this.options.refetchIntervalInBackground||ue.isFocused())&&p(this,w,Ut).call(this)},r(this,rt)))},Jt=function(){p(this,w,Wt).call(this),p(this,w,Yt).call(this,p(this,w,zt).call(this))},Xt=function(){r(this,ft)&&(clearTimeout(r(this,ft)),o(this,ft,void 0))},Zt=function(){r(this,dt)&&(clearInterval(r(this,dt)),o(this,dt,void 0))},te=function(){const t=r(this,T).getQueryCache().build(r(this,T),this.options);if(t===r(this,v))return;const e=r(this,v);o(this,v,t),o(this,jt,t.state),this.hasListeners()&&(e==null||e.removeObserver(this),t.addObserver(this))},_e=function(t){A.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(r(this,I))}),r(this,T).getQueryCache().notify({query:r(this,v),type:"observerResultsUpdated"})})},Pe);function ys(s,t){return N(t.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&t.retryOnMount===!1)}function pe(s,t){return ys(s,t)||s.state.data!==void 0&&ee(s,t,t.refetchOnMount)}function ee(s,t,e){if(N(t.enabled,s)!==!1){const i=typeof e=="function"?e(s):e;return i==="always"||i!==!1&&oe(s,t)}return!1}function me(s,t,e,i){return(s!==t||N(i.enabled,s)===!1)&&(!e.suspense||s.state.status!=="error")&&oe(s,e)}function oe(s,t){return N(t.enabled,s)!==!1&&s.isStaleByTime(vt(t.staleTime,s))}function ps(s,t){return!Ht(s.getCurrentResult(),t)}var nt,at,j,Y,J,kt,se,Re,ms=(Re=class extends At{constructor(t,e){super();d(this,J);d(this,nt);d(this,at);d(this,j);d(this,Y);o(this,nt,t),this.setOptions(e),this.bindMethods(),p(this,J,kt).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var i;const e=this.options;this.options=r(this,nt).defaultMutationOptions(t),Ht(this.options,e)||r(this,nt).getMutationCache().notify({type:"observerOptionsUpdated",mutation:r(this,j),observer:this}),e!=null&&e.mutationKey&&this.options.mutationKey&&pt(e.mutationKey)!==pt(this.options.mutationKey)?this.reset():((i=r(this,j))==null?void 0:i.state.status)==="pending"&&r(this,j).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=r(this,j))==null||t.removeObserver(this)}onMutationUpdate(t){p(this,J,kt).call(this),p(this,J,se).call(this,t)}getCurrentResult(){return r(this,at)}reset(){var t;(t=r(this,j))==null||t.removeObserver(this),o(this,j,void 0),p(this,J,kt).call(this),p(this,J,se).call(this)}mutate(t,e){var i;return o(this,Y,e),(i=r(this,j))==null||i.removeObserver(this),o(this,j,r(this,nt).getMutationCache().build(r(this,nt),this.options)),r(this,j).addObserver(this),r(this,j).execute(t)}},nt=new WeakMap,at=new WeakMap,j=new WeakMap,Y=new WeakMap,J=new WeakSet,kt=function(){var e;const t=((e=r(this,j))==null?void 0:e.state)??Ne();o(this,at,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},se=function(t){A.batch(()=>{var e,i,n,a,u,f,g,C;if(r(this,Y)&&this.hasListeners()){const y=r(this,at).variables,h=r(this,at).context;(t==null?void 0:t.type)==="success"?((i=(e=r(this,Y)).onSuccess)==null||i.call(e,t.data,y,h),(a=(n=r(this,Y)).onSettled)==null||a.call(n,t.data,null,y,h)):(t==null?void 0:t.type)==="error"&&((f=(u=r(this,Y)).onError)==null||f.call(u,t.error,y,h),(C=(g=r(this,Y)).onSettled)==null||C.call(g,void 0,t.error,y,h))}this.listeners.forEach(y=>{y(r(this,at))})})},Re),vs="VUE_QUERY_CLIENT";function Be(s){const t=s?`:${s}`:"";return`${vs}${t}`}function ie(s,t){Object.keys(s).forEach(e=>{s[e]=t[e]})}function re(s,t,e="",i=0){if(t){const n=t(s,e,i);if(n===void 0&&Fe(s)||n!==void 0)return n}if(Array.isArray(s))return s.map((n,a)=>re(n,t,String(a),i+1));if(typeof s=="object"&&gs(s)){const n=Object.entries(s).map(([a,u])=>[a,re(u,t,a,i+1)]);return Object.fromEntries(n)}return s}function bs(s,t){return re(s,t)}function m(s,t=!1){return bs(s,(e,i,n)=>{if(n===1&&i==="queryKey")return m(e,!0);if(t&&Os(e))return m(e(),t);if(Fe(e))return m(We(e),t)})}function gs(s){if(Object.prototype.toString.call(s)!=="[object Object]")return!1;const t=Object.getPrototypeOf(s);return t===null||t===Object.prototype}function Os(s){return typeof s=="function"}function ne(s,t){return typeof s=="function"?s(...t):!!s}function $e(s=""){if(!ze())throw new Error("vue-query hooks can only be used inside setup() function or functions that support injection context.");const t=Be(s),e=Ye(t);if(!e)throw new Error("No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library.");return e}var Cs=class extends He{find(s){return super.find(m(s))}findAll(s={}){return super.findAll(m(s))}},ws=class extends Ge{find(s){return super.find(m(s))}findAll(s={}){return super.findAll(m(s))}},Qs=class extends fs{constructor(s={}){const t={defaultOptions:s.defaultOptions,queryCache:s.queryCache||new Cs,mutationCache:s.mutationCache||new ws};super(t),this.isRestoring=Je(!1)}isFetching(s={}){return super.isFetching(m(s))}isMutating(s={}){return super.isMutating(m(s))}getQueryData(s){return super.getQueryData(m(s))}ensureQueryData(s){return super.ensureQueryData(m(s))}getQueriesData(s){return super.getQueriesData(m(s))}setQueryData(s,t,e={}){return super.setQueryData(m(s),t,m(e))}setQueriesData(s,t,e={}){return super.setQueriesData(m(s),t,m(e))}getQueryState(s){return super.getQueryState(m(s))}removeQueries(s={}){return super.removeQueries(m(s))}resetQueries(s={},t={}){return super.resetQueries(m(s),m(t))}cancelQueries(s={},t={}){return super.cancelQueries(m(s),m(t))}invalidateQueries(s={},t={}){const e=m(s),i=m(t);if(super.invalidateQueries({...e,refetchType:"none"},i),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return Xe().then(()=>super.refetchQueries(n,i))}refetchQueries(s={},t={}){return super.refetchQueries(m(s),m(t))}fetchQuery(s){return super.fetchQuery(m(s))}prefetchQuery(s){return super.prefetchQuery(m(s))}fetchInfiniteQuery(s){return super.fetchInfiniteQuery(m(s))}prefetchInfiniteQuery(s){return super.prefetchInfiniteQuery(m(s))}setDefaultOptions(s){super.setDefaultOptions(m(s))}setQueryDefaults(s,t){super.setQueryDefaults(m(s),m(t))}getQueryDefaults(s){return super.getQueryDefaults(m(s))}setMutationDefaults(s,t){super.setMutationDefaults(m(s),m(t))}getMutationDefaults(s){return super.getMutationDefaults(m(s))}},Ms={install:(s,t={})=>{const e=Be(t.queryClientKey);let i;if("queryClient"in t&&t.queryClient)i=t.queryClient;else{const u="queryClientConfig"in t?t.queryClientConfig:void 0;i=new Qs(u)}yt||i.mount();let n=()=>{};if(t.clientPersister){i.isRestoring.value=!0;const[u,f]=t.clientPersister(i);n=u,f.then(()=>{var g;i.isRestoring.value=!1,(g=t.clientPersisterOnSuccess)==null||g.call(t,i)})}const a=()=>{i.unmount(),n()};if(s.onUnmount)s.onUnmount(a);else{const u=s.unmount;s.unmount=function(){a(),u()}}s.provide(e,i)}};function Ss(s,t,e){const i=$e(),n=De(()=>{const c=m(t);typeof c.enabled=="function"&&(c.enabled=c.enabled());const P=i.defaultQueryOptions(c);return P._optimisticResults=i.isRestoring.value?"isRestoring":"optimistic",P}),a=new s(i,n.value),u=Ee(a.getCurrentResult());let f=()=>{};mt(i.isRestoring,c=>{c||(f(),f=a.subscribe(P=>{ie(u,P)}))},{immediate:!0});const g=()=>{a.setOptions(n.value),ie(u,a.getCurrentResult())};mt(n,g),Me(()=>{f()});const C=(...c)=>(g(),u.refetch(...c)),y=()=>new Promise((c,P)=>{let D=()=>{};const R=()=>{if(n.value.enabled!==!1){a.setOptions(n.value);const O=a.getOptimisticResult(n.value);O.isStale?(D(),a.fetchOptimistic(n.value).then(c,Q=>{ne(n.value.throwOnError,[Q,a.getCurrentQuery()])?P(Q):c(a.getCurrentResult())})):(D(),c(O))}};R(),D=mt(n,R)});mt(()=>u.error,c=>{if(u.isError&&!u.isFetching&&ne(n.value.throwOnError,[c,a.getCurrentQuery()]))throw c});const l=Ae(u);for(const c in u)typeof u[c]=="function"&&(l[c]=u[c]);return l.suspense=y,l.refetch=C,l}function As(s,t){return Ss(ds,s)}function Us(s,t){const e=$e(),i=De(()=>e.defaultMutationOptions(m(s))),n=new ms(e,i.value),a=Ee(n.getCurrentResult()),u=n.subscribe(y=>{ie(a,y)}),f=(y,h)=>{n.mutate(y,h).catch(()=>{})};mt(i,()=>{n.setOptions(i.value)}),Me(()=>{u()});const C=Ae(a);return mt(()=>a.error,y=>{if(y&&ne(i.value.throwOnError,[y]))throw y}),{...C,mutate:f,mutateAsync:a.mutate,reset:a.reset}}export{Qs as Q,Ms as V,As as a,Us as b,$e as u};
@@ -1,4 +1,4 @@
1
- import{Z as s,a as h,b as a}from"./zod.DnW1_kUe.0.0.30-alpha.0.js";import{i as j,c as y}from"./vee-validate.DLoDjJ2f.0.0.30-alpha.0.js";/**
1
+ import{Z as s,a as h,b as a}from"./zod.DnW1_kUe.0.0.30-alpha.3.js";import{i as j,c as y}from"./vee-validate.BbcoErf-.0.0.30-alpha.3.js";/**
2
2
  * vee-validate v4.13.2
3
3
  * (c) 2024 Abdelrahman Awad
4
4
  * @license MIT
@@ -1 +1 @@
1
- import{t as v,c as b,b as S,d as V,e as D,v as B,f as p,g as y,j as w,k as C,m as N,l as j,p as T}from"./@vue.BeJw0wEm.0.0.30-alpha.0.js";var L={name:"Toggle",emits:["input","update:modelValue","change"],props:{value:{validator:function(e){return n=>["number","string","boolean"].indexOf(typeof n)!==-1||n==null},required:!1},modelValue:{validator:function(e){return n=>["number","string","boolean"].indexOf(typeof n)!==-1||n==null},required:!1},id:{type:[String,Number],required:!1,default:"toggle"},name:{type:[String,Number],required:!1,default:"toggle"},disabled:{type:Boolean,required:!1,default:!1},required:{type:Boolean,required:!1,default:!1},falseValue:{type:[String,Number,Boolean],required:!1,default:!1},trueValue:{type:[String,Number,Boolean],required:!1,default:!0},onLabel:{type:[String,Object],required:!1,default:""},offLabel:{type:[String,Object],required:!1,default:""},classes:{type:Object,required:!1,default:()=>({})},labelledby:{type:String,required:!1},describedby:{type:String,required:!1},aria:{required:!1,type:Object,default:()=>({})}},setup(e,n){const a=function(d,o,c){const{value:r,modelValue:u,falseValue:t,trueValue:l,disabled:f}=v(d),i=u&&u.value!==void 0?u:r,s=b(()=>i.value===l.value),h=g=>{o.emit("input",g),o.emit("update:modelValue",g),o.emit("change",g)},k=()=>{h(l.value)},m=()=>{h(t.value)};return[null,void 0,!1,0,"0","off"].indexOf(i.value)!==-1&&[t.value,l.value].indexOf(i.value)===-1&&m(),[!0,1,"1","on"].indexOf(i.value)!==-1&&[t.value,l.value].indexOf(i.value)===-1&&k(),{externalValue:i,checked:s,update:h,check:k,uncheck:m,handleInput:g=>{h(g.target.checked?l.value:t.value)},handleClick:()=>{f.value||(s.value?m():k())}}}(e,n),O=function(d,o,c){const{trueValue:r,falseValue:u,onLabel:t,offLabel:l}=v(d),f=c.checked,i=c.update;return{label:b(()=>{let s=f.value?t.value:l.value;return s||(s="&nbsp;"),s}),toggle:()=>{i(f.value?u.value:r.value)},on:()=>{i(r.value)},off:()=>{i(u.value)}}}(e,0,{checked:a.checked,update:a.update}),q=function(d,o,c){const r=v(d),u=r.disabled,t=c.checked,l=b(()=>({container:"toggle-container",toggle:"toggle",toggleOn:"toggle-on",toggleOff:"toggle-off",toggleOnDisabled:"toggle-on-disabled",toggleOffDisabled:"toggle-off-disabled",handle:"toggle-handle",handleOn:"toggle-handle-on",handleOff:"toggle-handle-off",handleOnDisabled:"toggle-handle-on-disabled",handleOffDisabled:"toggle-handle-off-disabled",label:"toggle-label",...r.classes.value}));return{classList:b(()=>({container:l.value.container,toggle:[l.value.toggle,u.value?t.value?l.value.toggleOnDisabled:l.value.toggleOffDisabled:t.value?l.value.toggleOn:l.value.toggleOff],handle:[l.value.handle,u.value?t.value?l.value.handleOnDisabled:l.value.handleOffDisabled:t.value?l.value.handleOn:l.value.handleOff],label:l.value.label}))}}(e,0,{checked:a.checked}),x=function(d,o,c){const{disabled:r}=v(d),u=c.check,t=c.uncheck,l=c.checked;return{handleSpace:()=>{r.value||(l.value?t():u())}}}(e,0,{check:a.check,uncheck:a.uncheck,checked:a.checked});return{...a,...q,...O,...x}}};const M=["tabindex","aria-checked","aria-describedby","aria-labelledby"],z=["id","name","value","checked","disabled"],H=["innerHTML"],K=["checked"];L.render=function(e,n,a,O,q,x){return S(),V("div",N({class:e.classList.container,tabindex:a.disabled?void 0:0,"aria-checked":e.checked,"aria-describedby":a.describedby,"aria-labelledby":a.labelledby,role:"switch"},a.aria,{onKeypress:n[1]||(n[1]=j(T((...d)=>e.handleSpace&&e.handleSpace(...d),["prevent"]),["space"]))}),[D(p("input",{type:"checkbox",id:a.id,name:a.name,value:a.trueValue,checked:e.checked,disabled:a.disabled},null,8,z),[[B,!1]]),p("div",{class:y(e.classList.toggle),onClick:n[0]||(n[0]=(...d)=>e.handleClick&&e.handleClick(...d))},[p("span",{class:y(e.classList.handle)},null,2),w(e.$slots,"label",{checked:e.checked,classList:e.classList},()=>[p("span",{class:y(e.classList.label),innerHTML:e.label},null,10,H)]),a.required?(S(),V("input",{key:0,type:"checkbox",style:{appearance:"none",height:"1px",margin:"0",padding:"0",fontSize:"0",background:"transparent",position:"absolute",width:"100%",bottom:"0",outline:"none"},checked:e.checked,"aria-hidden":"true",tabindex:"-1",required:""},null,8,K)):C("v-if",!0)],2)],16,M)},L.__file="src/Toggle.vue";export{L as b};
1
+ import{t as v,c as b,b as S,d as V,e as D,v as B,f as p,g as y,j as w,k as C,m as N,l as j,p as T}from"./@vue.BeJw0wEm.0.0.30-alpha.3.js";var L={name:"Toggle",emits:["input","update:modelValue","change"],props:{value:{validator:function(e){return n=>["number","string","boolean"].indexOf(typeof n)!==-1||n==null},required:!1},modelValue:{validator:function(e){return n=>["number","string","boolean"].indexOf(typeof n)!==-1||n==null},required:!1},id:{type:[String,Number],required:!1,default:"toggle"},name:{type:[String,Number],required:!1,default:"toggle"},disabled:{type:Boolean,required:!1,default:!1},required:{type:Boolean,required:!1,default:!1},falseValue:{type:[String,Number,Boolean],required:!1,default:!1},trueValue:{type:[String,Number,Boolean],required:!1,default:!0},onLabel:{type:[String,Object],required:!1,default:""},offLabel:{type:[String,Object],required:!1,default:""},classes:{type:Object,required:!1,default:()=>({})},labelledby:{type:String,required:!1},describedby:{type:String,required:!1},aria:{required:!1,type:Object,default:()=>({})}},setup(e,n){const a=function(d,o,c){const{value:r,modelValue:u,falseValue:t,trueValue:l,disabled:f}=v(d),i=u&&u.value!==void 0?u:r,s=b(()=>i.value===l.value),h=g=>{o.emit("input",g),o.emit("update:modelValue",g),o.emit("change",g)},k=()=>{h(l.value)},m=()=>{h(t.value)};return[null,void 0,!1,0,"0","off"].indexOf(i.value)!==-1&&[t.value,l.value].indexOf(i.value)===-1&&m(),[!0,1,"1","on"].indexOf(i.value)!==-1&&[t.value,l.value].indexOf(i.value)===-1&&k(),{externalValue:i,checked:s,update:h,check:k,uncheck:m,handleInput:g=>{h(g.target.checked?l.value:t.value)},handleClick:()=>{f.value||(s.value?m():k())}}}(e,n),O=function(d,o,c){const{trueValue:r,falseValue:u,onLabel:t,offLabel:l}=v(d),f=c.checked,i=c.update;return{label:b(()=>{let s=f.value?t.value:l.value;return s||(s="&nbsp;"),s}),toggle:()=>{i(f.value?u.value:r.value)},on:()=>{i(r.value)},off:()=>{i(u.value)}}}(e,0,{checked:a.checked,update:a.update}),q=function(d,o,c){const r=v(d),u=r.disabled,t=c.checked,l=b(()=>({container:"toggle-container",toggle:"toggle",toggleOn:"toggle-on",toggleOff:"toggle-off",toggleOnDisabled:"toggle-on-disabled",toggleOffDisabled:"toggle-off-disabled",handle:"toggle-handle",handleOn:"toggle-handle-on",handleOff:"toggle-handle-off",handleOnDisabled:"toggle-handle-on-disabled",handleOffDisabled:"toggle-handle-off-disabled",label:"toggle-label",...r.classes.value}));return{classList:b(()=>({container:l.value.container,toggle:[l.value.toggle,u.value?t.value?l.value.toggleOnDisabled:l.value.toggleOffDisabled:t.value?l.value.toggleOn:l.value.toggleOff],handle:[l.value.handle,u.value?t.value?l.value.handleOnDisabled:l.value.handleOffDisabled:t.value?l.value.handleOn:l.value.handleOff],label:l.value.label}))}}(e,0,{checked:a.checked}),x=function(d,o,c){const{disabled:r}=v(d),u=c.check,t=c.uncheck,l=c.checked;return{handleSpace:()=>{r.value||(l.value?t():u())}}}(e,0,{check:a.check,uncheck:a.uncheck,checked:a.checked});return{...a,...q,...O,...x}}};const M=["tabindex","aria-checked","aria-describedby","aria-labelledby"],z=["id","name","value","checked","disabled"],H=["innerHTML"],K=["checked"];L.render=function(e,n,a,O,q,x){return S(),V("div",N({class:e.classList.container,tabindex:a.disabled?void 0:0,"aria-checked":e.checked,"aria-describedby":a.describedby,"aria-labelledby":a.labelledby,role:"switch"},a.aria,{onKeypress:n[1]||(n[1]=j(T((...d)=>e.handleSpace&&e.handleSpace(...d),["prevent"]),["space"]))}),[D(p("input",{type:"checkbox",id:a.id,name:a.name,value:a.trueValue,checked:e.checked,disabled:a.disabled},null,8,z),[[B,!1]]),p("div",{class:y(e.classList.toggle),onClick:n[0]||(n[0]=(...d)=>e.handleClick&&e.handleClick(...d))},[p("span",{class:y(e.classList.handle)},null,2),w(e.$slots,"label",{checked:e.checked,classList:e.classList},()=>[p("span",{class:y(e.classList.label),innerHTML:e.label},null,10,H)]),a.required?(S(),V("input",{key:0,type:"checkbox",style:{appearance:"none",height:"1px",margin:"0",padding:"0",fontSize:"0",background:"transparent",position:"absolute",width:"100%",bottom:"0",outline:"none"},checked:e.checked,"aria-hidden":"true",tabindex:"-1",required:""},null,8,K)):C("v-if",!0)],2)],16,M)},L.__file="src/Toggle.vue";export{L as b};