promptfoo 0.50.0 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/package.json +2 -2
  2. package/dist/src/__mocks__/database.js +18 -6
  3. package/dist/src/__mocks__/database.js.map +1 -1
  4. package/dist/src/assertions.d.ts.map +1 -1
  5. package/dist/src/assertions.js +35 -38
  6. package/dist/src/assertions.js.map +1 -1
  7. package/dist/src/cliState.d.ts +6 -0
  8. package/dist/src/cliState.d.ts.map +1 -0
  9. package/dist/src/cliState.js +5 -0
  10. package/dist/src/cliState.js.map +1 -0
  11. package/dist/src/commands/list.d.ts.map +1 -1
  12. package/dist/src/commands/list.js.map +1 -1
  13. package/dist/src/constants.d.ts.map +1 -1
  14. package/dist/src/constants.js +2 -2
  15. package/dist/src/constants.js.map +1 -1
  16. package/dist/src/database.d.ts.map +1 -1
  17. package/dist/src/database.js +9 -3
  18. package/dist/src/database.js.map +1 -1
  19. package/dist/src/esm.d.ts.map +1 -1
  20. package/dist/src/esm.js +3 -2
  21. package/dist/src/esm.js.map +1 -1
  22. package/dist/src/evaluator.d.ts +3 -2
  23. package/dist/src/evaluator.d.ts.map +1 -1
  24. package/dist/src/evaluator.js +23 -8
  25. package/dist/src/evaluator.js.map +1 -1
  26. package/dist/src/main.js +7 -4
  27. package/dist/src/main.js.map +1 -1
  28. package/dist/src/prompts.d.ts.map +1 -1
  29. package/dist/src/prompts.js +15 -2
  30. package/dist/src/prompts.js.map +1 -1
  31. package/dist/src/providers/anthropic.d.ts +1 -7
  32. package/dist/src/providers/anthropic.d.ts.map +1 -1
  33. package/dist/src/providers/anthropic.js +18 -5
  34. package/dist/src/providers/anthropic.js.map +1 -1
  35. package/dist/src/providers/azureopenai.d.ts +2 -0
  36. package/dist/src/providers/azureopenai.d.ts.map +1 -1
  37. package/dist/src/providers/azureopenai.js +9 -1
  38. package/dist/src/providers/azureopenai.js.map +1 -1
  39. package/dist/src/providers/mistral.d.ts.map +1 -1
  40. package/dist/src/providers/mistral.js +4 -1
  41. package/dist/src/providers/mistral.js.map +1 -1
  42. package/dist/src/providers/openai.d.ts.map +1 -1
  43. package/dist/src/providers/openai.js +4 -1
  44. package/dist/src/providers/openai.js.map +1 -1
  45. package/dist/src/providers/pythonCompletion.d.ts +1 -0
  46. package/dist/src/providers/pythonCompletion.d.ts.map +1 -1
  47. package/dist/src/providers/pythonCompletion.js +5 -2
  48. package/dist/src/providers/pythonCompletion.js.map +1 -1
  49. package/dist/src/python/wrapper.d.ts +3 -1
  50. package/dist/src/python/wrapper.d.ts.map +1 -1
  51. package/dist/src/python/wrapper.js +9 -3
  52. package/dist/src/python/wrapper.js.map +1 -1
  53. package/dist/src/testCases.d.ts.map +1 -1
  54. package/dist/src/testCases.js +6 -2
  55. package/dist/src/testCases.js.map +1 -1
  56. package/dist/src/types.d.ts +1 -1
  57. package/dist/src/types.d.ts.map +1 -1
  58. package/dist/src/util.d.ts +8 -2
  59. package/dist/src/util.d.ts.map +1 -1
  60. package/dist/src/util.js +42 -4
  61. package/dist/src/util.js.map +1 -1
  62. package/dist/src/web/nextui/404/index.html +1 -1
  63. package/dist/src/web/nextui/404.html +1 -1
  64. package/dist/src/web/nextui/_next/static/chunks/113-1056b5f87446395e.js +1 -0
  65. package/dist/src/web/nextui/_next/static/chunks/261-1bc0898df259d0fd.js +1 -0
  66. package/dist/src/web/nextui/_next/static/chunks/414-51e6cdc7aba4bb24.js +2 -0
  67. package/dist/src/web/nextui/_next/static/chunks/{293-fa7b9b02f62ab5d8.js → 547-00556ed98de9671b.js} +2 -2
  68. package/dist/src/web/nextui/_next/static/chunks/{376-1c0d6e6983c73fe2.js → 580-cccb247de1b7350b.js} +2 -2
  69. package/dist/src/web/nextui/_next/static/chunks/602-fce79bd3bd7891e9.js +1 -0
  70. package/dist/src/web/nextui/_next/static/chunks/609-483decb66cf4cfa8.js +44 -0
  71. package/dist/src/web/nextui/_next/static/chunks/670-57b040ef305d13be.js +1 -0
  72. package/dist/src/web/nextui/_next/static/chunks/680-aa07f4d4d0312894.js +7 -0
  73. package/dist/src/web/nextui/_next/static/chunks/72-202cb66305c1995a.js +1 -0
  74. package/dist/src/web/nextui/_next/static/chunks/840-854b7ee26e0beb0b.js +1 -0
  75. package/dist/src/web/nextui/_next/static/chunks/app/auth/login/page-2daaaf4e1f6912b3.js +1 -0
  76. package/dist/src/web/nextui/_next/static/chunks/app/auth/signup/page-23ca04075bd65316.js +1 -0
  77. package/dist/src/web/nextui/_next/static/chunks/app/datasets/{page-ad55f89d622ef8e7.js → page-b348c3d000a051ae.js} +1 -1
  78. package/dist/src/web/nextui/_next/static/chunks/app/eval/[id]/{page-b7184244049e5915.js → page-6f275364ed1179d3.js} +1 -1
  79. package/dist/src/web/nextui/_next/static/chunks/app/eval/page-7a1f6ddb7c8a0989.js +1 -0
  80. package/dist/src/web/nextui/_next/static/chunks/app/layout-6bdc710ec6575432.js +1 -0
  81. package/dist/src/web/nextui/_next/static/chunks/app/progress/page-3920254227ac3a80.js +1 -0
  82. package/dist/src/web/nextui/_next/static/chunks/app/prompts/page-eb6647787729eb01.js +1 -0
  83. package/dist/src/web/nextui/_next/static/chunks/app/setup/{page-f5a10b7790f14c70.js → page-b0609d23570b9503.js} +1 -1
  84. package/dist/src/web/nextui/_next/static/chunks/{main-61a7cc8906bd5722.js → main-b311752d7554d977.js} +1 -1
  85. package/dist/src/web/nextui/api/datasets +1 -1
  86. package/dist/src/web/nextui/api/progress +1 -0
  87. package/dist/src/web/nextui/api/prompts +1 -1
  88. package/dist/src/web/nextui/api/results +1 -1
  89. package/dist/src/web/nextui/auth/login/index.html +1 -1
  90. package/dist/src/web/nextui/auth/login/index.txt +5 -5
  91. package/dist/src/web/nextui/auth/signup/index.html +1 -1
  92. package/dist/src/web/nextui/auth/signup/index.txt +5 -5
  93. package/dist/src/web/nextui/datasets/index.html +1 -1
  94. package/dist/src/web/nextui/datasets/index.txt +5 -5
  95. package/dist/src/web/nextui/eval/index.html +1 -1
  96. package/dist/src/web/nextui/eval/index.txt +5 -5
  97. package/dist/src/web/nextui/index.html +1 -1
  98. package/dist/src/web/nextui/index.txt +4 -4
  99. package/dist/src/web/nextui/progress/index.html +1 -0
  100. package/dist/src/web/nextui/progress/index.txt +15 -0
  101. package/dist/src/web/nextui/prompts/index.html +1 -1
  102. package/dist/src/web/nextui/prompts/index.txt +5 -5
  103. package/dist/src/web/nextui/setup/index.html +2 -2
  104. package/dist/src/web/nextui/setup/index.txt +6 -6
  105. package/dist/src/web/server.d.ts.map +1 -1
  106. package/dist/src/web/server.js +6 -0
  107. package/dist/src/web/server.js.map +1 -1
  108. package/package.json +2 -2
  109. package/dist/src/web/nextui/_next/static/chunks/420-c4133cd89d8c5e4b.js +0 -2
  110. package/dist/src/web/nextui/_next/static/chunks/445-74742af8ab1894f2.js +0 -1
  111. package/dist/src/web/nextui/_next/static/chunks/548-ffb8dd99ad3940cb.js +0 -1
  112. package/dist/src/web/nextui/_next/static/chunks/670-8cc4b4f4fc7b80ad.js +0 -1
  113. package/dist/src/web/nextui/_next/static/chunks/683-31836dfcc9c45e50.js +0 -44
  114. package/dist/src/web/nextui/_next/static/chunks/808-b64f39fb5aa81c36.js +0 -1
  115. package/dist/src/web/nextui/_next/static/chunks/82-6e8c9ebc91ff932b.js +0 -7
  116. package/dist/src/web/nextui/_next/static/chunks/886-ed0ff9e461fce55a.js +0 -1
  117. package/dist/src/web/nextui/_next/static/chunks/app/auth/login/page-1c10570a7e431039.js +0 -1
  118. package/dist/src/web/nextui/_next/static/chunks/app/auth/signup/page-57f3e1b961ec3eac.js +0 -1
  119. package/dist/src/web/nextui/_next/static/chunks/app/eval/page-d0218b6214481455.js +0 -1
  120. package/dist/src/web/nextui/_next/static/chunks/app/layout-d634a41da738217d.js +0 -1
  121. package/dist/src/web/nextui/_next/static/chunks/app/prompts/page-01ab4878803b7068.js +0 -1
  122. /package/dist/src/web/nextui/_next/static/{vh97xvBohjbcaZhzFItCJ → Zu8DYbL4MKrTEyvAwxFTR}/_buildManifest.js +0 -0
  123. /package/dist/src/web/nextui/_next/static/{vh97xvBohjbcaZhzFItCJ → Zu8DYbL4MKrTEyvAwxFTR}/_ssgManifest.js +0 -0
  124. /package/dist/src/web/nextui/_next/static/chunks/{webpack-a35a338695cdcd13.js → webpack-e02a742b401be2a0.js} +0 -0
@@ -0,0 +1,7 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[680],{9190:function(e,t,r){"use strict";var s=r(1047);let i=(0,s.ZP)();t.Z=i},3082:function(e,t,r){"use strict";var s,i=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,l={};((e,t)=>{for(var r in t)i(e,r,{get:t[r],enumerable:!0})})(l,{createBrowserSupabaseClient:()=>C,createClientComponentClient:()=>c,createMiddlewareClient:()=>b,createMiddlewareSupabaseClient:()=>I,createPagesBrowserClient:()=>u,createPagesServerClient:()=>y,createRouteHandlerClient:()=>T,createServerActionClient:()=>E,createServerComponentClient:()=>k,createServerSupabaseClient:()=>j}),e.exports=((e,t,r,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of o(t))a.call(e,r)||void 0===r||i(e,r,{get:()=>t[r],enumerable:!(s=n(t,r))||s.enumerable});return e})(i({},"__esModule",{value:!0}),l);var h=r(9335);function c({supabaseUrl:e="https://vhywkeydkitmauabqnwv.supabase.co",supabaseKey:t="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZoeXdrZXlka2l0bWF1YWJxbnd2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTI5OTAwMjQsImV4cCI6MjAwODU2NjAyNH0.C02",options:r,cookieOptions:i,isSingleton:n=!0}={}){if(!e||!t)throw Error("either NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY env variables or supabaseUrl and supabaseKey are required!");let o=()=>{var s;return(0,h.createSupabaseClient)(e,t,{...r,global:{...null==r?void 0:r.global,headers:{...null==(s=null==r?void 0:r.global)?void 0:s.headers,"X-Client-Info":"@supabase/auth-helpers-nextjs@0.7.4"}},auth:{storageKey:null==i?void 0:i.name,storage:new h.BrowserCookieAuthStorageAdapter(i)}})};if(n){let e=s??o();return"undefined"==typeof window?e:(s||(s=e),s)}return o()}var u=c,d=r(9335),f=r(8027),p=class extends d.CookieAuthStorageAdapter{constructor(e,t){super(t),this.context=e}getCookie(e){var t;let r=(0,f.splitCookiesString)((null==(t=this.context.res.getHeader("set-cookie"))?void 0:t.toString())??"").map(t=>(0,d.parseCookies)(t)[e]).find(e=>!!e),s=r??this.context.req.cookies[e];return s}setCookie(e,t){this._setCookie(e,t)}deleteCookie(e){this._setCookie(e,"",{maxAge:0})}_setCookie(e,t,r){var s;let i=(0,f.splitCookiesString)((null==(s=this.context.res.getHeader("set-cookie"))?void 0:s.toString())??"").filter(t=>!(e in(0,d.parseCookies)(t))),n=(0,d.serializeCookie)(e,t,{...this.cookieOptions,...r,httpOnly:!1});this.context.res.setHeader("set-cookie",[...i,n])}};function y(e,{supabaseUrl:t="https://vhywkeydkitmauabqnwv.supabase.co",supabaseKey:r="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZoeXdrZXlka2l0bWF1YWJxbnd2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTI5OTAwMjQsImV4cCI6MjAwODU2NjAyNH0.C02",options:s,cookieOptions:i}={}){var n;if(!t||!r)throw Error("either NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY env variables or supabaseUrl and supabaseKey are required!");return(0,d.createSupabaseClient)(t,r,{...s,global:{...null==s?void 0:s.global,headers:{...null==(n=null==s?void 0:s.global)?void 0:n.headers,"X-Client-Info":"@supabase/auth-helpers-nextjs@0.7.4"}},auth:{storageKey:null==i?void 0:i.name,storage:new p(e,i)}})}var g=r(9335),m=r(8027),v=class extends g.CookieAuthStorageAdapter{constructor(e,t){super(t),this.context=e}getCookie(e){var t;let r=(0,m.splitCookiesString)((null==(t=this.context.res.headers.get("set-cookie"))?void 0:t.toString())??"").map(t=>(0,g.parseCookies)(t)[e]).find(e=>!!e);return r||(0,g.parseCookies)(this.context.req.headers.get("cookie")??"")[e]}setCookie(e,t){this._setCookie(e,t)}deleteCookie(e){this._setCookie(e,"",{maxAge:0})}_setCookie(e,t,r){let s=(0,g.serializeCookie)(e,t,{...this.cookieOptions,...r,httpOnly:!1});this.context.res.headers&&(this.context.res.headers.append("set-cookie",s),this.context.res.headers.append("cookie",s))}};function b(e,{supabaseUrl:t="https://vhywkeydkitmauabqnwv.supabase.co",supabaseKey:r="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZoeXdrZXlka2l0bWF1YWJxbnd2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTI5OTAwMjQsImV4cCI6MjAwODU2NjAyNH0.C02",options:s,cookieOptions:i}={}){var n;if(!t||!r)throw Error("either NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY env variables or supabaseUrl and supabaseKey are required!");return(0,g.createSupabaseClient)(t,r,{...s,global:{...null==s?void 0:s.global,headers:{...null==(n=null==s?void 0:s.global)?void 0:n.headers,"X-Client-Info":"@supabase/auth-helpers-nextjs@0.7.4"}},auth:{storageKey:null==i?void 0:i.name,storage:new v(e,i)}})}var _=r(9335),w=class extends _.CookieAuthStorageAdapter{constructor(e,t){super(t),this.context=e}getCookie(e){var t;let r=this.context.cookies();return null==(t=r.get(e))?void 0:t.value}setCookie(e,t){}deleteCookie(e){}};function k(e,{supabaseUrl:t="https://vhywkeydkitmauabqnwv.supabase.co",supabaseKey:r="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZoeXdrZXlka2l0bWF1YWJxbnd2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTI5OTAwMjQsImV4cCI6MjAwODU2NjAyNH0.C02",options:s,cookieOptions:i}={}){var n;if(!t||!r)throw Error("either NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY env variables or supabaseUrl and supabaseKey are required!");return(0,_.createSupabaseClient)(t,r,{...s,global:{...null==s?void 0:s.global,headers:{...null==(n=null==s?void 0:s.global)?void 0:n.headers,"X-Client-Info":"@supabase/auth-helpers-nextjs@0.7.4"}},auth:{storageKey:null==i?void 0:i.name,storage:new w(e,i)}})}var S=r(9335),O=class extends S.CookieAuthStorageAdapter{constructor(e,t){super(t),this.context=e}getCookie(e){var t;let r=this.context.cookies();return null==(t=r.get(e))?void 0:t.value}setCookie(e,t){let r=this.context.cookies();r.set(e,t,this.cookieOptions)}deleteCookie(e){let t=this.context.cookies();t.set(e,"",{maxAge:0})}};function T(e,{supabaseUrl:t="https://vhywkeydkitmauabqnwv.supabase.co",supabaseKey:r="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZoeXdrZXlka2l0bWF1YWJxbnd2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTI5OTAwMjQsImV4cCI6MjAwODU2NjAyNH0.C02",options:s,cookieOptions:i}={}){var n;if(!t||!r)throw Error("either NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY env variables or supabaseUrl and supabaseKey are required!");return(0,S.createSupabaseClient)(t,r,{...s,global:{...null==s?void 0:s.global,headers:{...null==(n=null==s?void 0:s.global)?void 0:n.headers,"X-Client-Info":"@supabase/auth-helpers-nextjs@0.7.4"}},auth:{storageKey:null==i?void 0:i.name,storage:new O(e,i)}})}var E=T;function C({supabaseUrl:e="https://vhywkeydkitmauabqnwv.supabase.co",supabaseKey:t="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZoeXdrZXlka2l0bWF1YWJxbnd2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTI5OTAwMjQsImV4cCI6MjAwODU2NjAyNH0.C02",options:r,cookieOptions:s}={}){return console.warn("Please utilize the `createPagesBrowserClient` function instead of the deprecated `createBrowserSupabaseClient` function. Learn more: https://supabase.com/docs/guides/auth/auth-helpers/nextjs-pages"),u({supabaseUrl:e,supabaseKey:t,options:r,cookieOptions:s})}function j(e,{supabaseUrl:t="https://vhywkeydkitmauabqnwv.supabase.co",supabaseKey:r="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZoeXdrZXlka2l0bWF1YWJxbnd2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTI5OTAwMjQsImV4cCI6MjAwODU2NjAyNH0.C02",options:s,cookieOptions:i}={}){return console.warn("Please utilize the `createPagesServerClient` function instead of the deprecated `createServerSupabaseClient` function. Learn more: https://supabase.com/docs/guides/auth/auth-helpers/nextjs-pages"),y(e,{supabaseUrl:t,supabaseKey:r,options:s,cookieOptions:i})}function I(e,{supabaseUrl:t="https://vhywkeydkitmauabqnwv.supabase.co",supabaseKey:r="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZoeXdrZXlka2l0bWF1YWJxbnd2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTI5OTAwMjQsImV4cCI6MjAwODU2NjAyNH0.C02",options:s,cookieOptions:i}={}){return console.warn("Please utilize the `createMiddlewareClient` function instead of the deprecated `createMiddlewareSupabaseClient` function. Learn more: https://supabase.com/docs/guides/auth/auth-helpers/nextjs#middleware"),b(e,{supabaseUrl:t,supabaseKey:r,options:s,cookieOptions:i})}},7992:function(e,t,r){"use strict";var s=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw Error("unable to locate global object")}();e.exports=t=s.fetch,s.fetch&&(t.default=s.fetch.bind(s)),t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response},9366:function(e,t){var r="undefined"!=typeof self?self:this,s=function(){function e(){this.fetch=!1,this.DOMException=r.DOMException}return e.prototype=r,new e}();(function(e){var t={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};if(t.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=ArrayBuffer.isView||function(e){return e&&r.indexOf(Object.prototype.toString.call(e))>-1};function n(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw TypeError("Invalid character in header field name");return e.toLowerCase()}function o(e){return"string"!=typeof e&&(e=String(e)),e}function a(e){var r={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t.iterable&&(r[Symbol.iterator]=function(){return r}),r}function l(e){this.map={},e instanceof l?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function h(e){if(e.bodyUsed)return Promise.reject(TypeError("Already read"));e.bodyUsed=!0}function c(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function u(e){var t=new FileReader,r=c(t);return t.readAsArrayBuffer(e),r}function d(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function f(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e){if("string"==typeof e)this._bodyText=e;else if(t.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(t.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else{var r;t.arrayBuffer&&t.blob&&(r=e)&&DataView.prototype.isPrototypeOf(r)?(this._bodyArrayBuffer=d(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):t.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||i(e))?this._bodyArrayBuffer=d(e):this._bodyText=e=Object.prototype.toString.call(e)}}else this._bodyText="";!this.headers.get("content-type")&&("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},t.blob&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(!this._bodyFormData)return Promise.resolve(new Blob([this._bodyText]));throw Error("could not read FormData body as blob")},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(u)}),this.text=function(){var e,t,r,s=h(this);if(s)return s;if(this._bodyBlob)return e=this._bodyBlob,r=c(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=Array(t.length),s=0;s<t.length;s++)r[s]=String.fromCharCode(t[s]);return r.join("")}(this._bodyArrayBuffer));if(!this._bodyFormData)return Promise.resolve(this._bodyText);throw Error("could not read FormData body as text")},t.formData&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(e,t){e=n(e),t=o(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},l.prototype.delete=function(e){delete this.map[n(e)]},l.prototype.get=function(e){return e=n(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(n(e))},l.prototype.set=function(e,t){this.map[n(e)]=o(t)},l.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},l.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),a(e)},l.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),a(e)},l.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),a(e)},t.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(e,t){var r,s,i=(t=t||{}).body;if(e instanceof y){if(e.bodyUsed)throw TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new l(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,i||null==e._bodyInit||(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new l(t.headers)),this.method=(s=(r=t.method||this.method||"GET").toUpperCase(),p.indexOf(s)>-1?s:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function g(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),s=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(s),decodeURIComponent(i))}}),t}function m(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},f.call(y.prototype),f.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},m.error=function(){var e=new m(null,{status:0,statusText:""});return e.type="error",e};var v=[301,302,303,307,308];m.redirect=function(e,t){if(-1===v.indexOf(t))throw RangeError("Invalid status code");return new m(null,{status:t,headers:{location:e}})},e.DOMException=s.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function b(r,s){return new Promise(function(i,n){var o=new y(r,s);if(o.signal&&o.signal.aborted)return n(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function h(){a.abort()}a.onload=function(){var e,t,r={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var r=e.split(":"),s=r.shift().trim();if(s){var i=r.join(":").trim();t.append(s,i)}}),t)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var s="response"in a?a.response:a.responseText;i(new m(s,r))},a.onerror=function(){n(TypeError("Network request failed"))},a.ontimeout=function(){n(TypeError("Network request failed"))},a.onabort=function(){n(new e.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&t.blob&&(a.responseType="blob"),o.headers.forEach(function(e,t){a.setRequestHeader(t,e)}),o.signal&&(o.signal.addEventListener("abort",h),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",h)}),a.send(void 0===o._bodyInit?null:o._bodyInit)})}b.polyfill=!0,s.fetch||(s.fetch=b,s.Headers=l,s.Request=y,s.Response=m),e.Headers=l,e.Request=y,e.Response=m,e.fetch=b,Object.defineProperty(e,"__esModule",{value:!0})})({}),s.fetch.ponyfill=!0,delete s.fetch.polyfill,(t=s.fetch).default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,e.exports=t},9472:function(e){var t=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw Error("Unable to resolve global `this`")};e.exports=function(){if(this)return this;if("object"==typeof globalThis&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(e){return t()}try{if(!__global__)return t();return __global__}finally{delete Object.prototype.__global__}}()},4033:function(e,t,r){e.exports=r(8165)},8027:function(e){"use strict";var t={decodeValues:!0,map:!1,silent:!1};function r(e){return"string"==typeof e&&!!e.trim()}function s(e,s){var i,n,o,a,l=e.split(";").filter(r),h=(i=l.shift(),n="",o="",(a=i.split("=")).length>1?(n=a.shift(),o=a.join("=")):o=i,{name:n,value:o}),c=h.name,u=h.value;s=s?Object.assign({},t,s):t;try{u=s.decodeValues?decodeURIComponent(u):u}catch(e){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+u+"'. Set options.decodeValues to false to disable this feature.",e)}var d={name:c,value:u};return l.forEach(function(e){var t=e.split("="),r=t.shift().trimLeft().toLowerCase(),s=t.join("=");"expires"===r?d.expires=new Date(s):"max-age"===r?d.maxAge=parseInt(s,10):"secure"===r?d.secure=!0:"httponly"===r?d.httpOnly=!0:"samesite"===r?d.sameSite=s:d[r]=s}),d}function i(e,i){if(i=i?Object.assign({},t,i):t,!e)return i.map?{}:[];if(e.headers){if("function"==typeof e.headers.getSetCookie)e=e.headers.getSetCookie();else if(e.headers["set-cookie"])e=e.headers["set-cookie"];else{var n=e.headers[Object.keys(e.headers).find(function(e){return"set-cookie"===e.toLowerCase()})];n||!e.headers.cookie||i.silent||console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),e=n}}return(Array.isArray(e)||(e=[e]),(i=i?Object.assign({},t,i):t).map)?e.filter(r).reduce(function(e,t){var r=s(t,i);return e[r.name]=r,e},{}):e.filter(r).map(function(e){return s(e,i)})}e.exports=i,e.exports.parse=i,e.exports.parseString=s,e.exports.splitCookiesString=function(e){if(Array.isArray(e))return e;if("string"!=typeof e)return[];var t,r,s,i,n,o=[],a=0;function l(){for(;a<e.length&&/\s/.test(e.charAt(a));)a+=1;return a<e.length}for(;a<e.length;){for(t=a,n=!1;l();)if(","===(r=e.charAt(a))){for(s=a,a+=1,l(),i=a;a<e.length&&"="!==(r=e.charAt(a))&&";"!==r&&","!==r;)a+=1;a<e.length&&"="===e.charAt(a)?(n=!0,a=i,o.push(e.substring(t,s)),t=a):a=s+1}else a+=1;(!n||a>=e.length)&&o.push(e.substring(t,e.length))}return o}},1775:function(e,t,r){if("object"==typeof globalThis)s=globalThis;else try{s=r(9472)}catch(e){}finally{if(s||"undefined"==typeof window||(s=window),!s)throw Error("Could not determine global this")}var s,i=s.WebSocket||s.MozWebSocket,n=r(5506);function o(e,t){return t?new i(e,t):new i(e)}i&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach(function(e){Object.defineProperty(o,e,{get:function(){return i[e]}})}),e.exports={w3cwebsocket:i?o:null,version:n}},5506:function(e,t,r){e.exports=r(2151).version},9335:function(e,t,r){"use strict";r.r(t),r.d(t,{BrowserCookieAuthStorageAdapter:function(){return tq},CookieAuthStorageAdapter:function(){return tz},DEFAULT_COOKIE_OPTIONS:function(){return tM},createSupabaseClient:function(){return tK},isBrowser:function(){return tF},parseCookies:function(){return tH},parseSupabaseCookie:function(){return tJ},serializeCookie:function(){return tX},stringifySupabaseSession:function(){return tB}}),new TextEncoder;let s=new TextDecoder,i=e=>{let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r};var n,o,a,l,h,c,u,d,f,p,y,g,m,v,b,_,w,k,S,O,T,E=crypto;E.getRandomValues.bind(E),Symbol();let C=e=>{let t=e;t instanceof Uint8Array&&(t=s.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return i(t)}catch(e){throw TypeError("The input to be decoded is not correctly encoded.")}},j=e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>{var t,s,i,n;return t=void 0,s=void 0,i=void 0,n=function*(){return yield(yield Promise.resolve().then(r.t.bind(r,9366,23))).fetch(...e)},new(i||(i=Promise))(function(e,r){function o(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n.throw(e))}catch(e){r(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof i?r:new i(function(e){e(r)})).then(o,a)}l((n=n.apply(t,s||[])).next())})}:fetch),(...e)=>t(...e)};class I extends Error{constructor(e,t="FunctionsError",r){super(e),this.name=t,this.context=r}}class x extends I{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class A extends I{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class P extends I{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}class ${constructor(e,{headers:t={},customFetch:r}={}){this.url=e,this.headers=t,this.fetch=j(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var r,s,i,n,o;return s=this,i=void 0,n=void 0,o=function*(){try{let s;let{headers:i,method:n,body:o}=t,a={};o&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)&&("undefined"!=typeof Blob&&o instanceof Blob||o instanceof ArrayBuffer?(a["Content-Type"]="application/octet-stream",s=o):"string"==typeof o?(a["Content-Type"]="text/plain",s=o):"undefined"!=typeof FormData&&o instanceof FormData?s=o:(a["Content-Type"]="application/json",s=JSON.stringify(o)));let l=yield this.fetch(`${this.url}/${e}`,{method:n||"POST",headers:Object.assign(Object.assign(Object.assign({},a),this.headers),i),body:s}).catch(e=>{throw new x(e)}),h=l.headers.get("x-relay-error");if(h&&"true"===h)throw new A(l);if(!l.ok)throw new P(l);let c=(null!==(r=l.headers.get("Content-Type"))&&void 0!==r?r:"text/plain").split(";")[0].trim();return{data:"application/json"===c?yield l.json():"application/octet-stream"===c?yield l.blob():"multipart/form-data"===c?yield l.formData():yield l.text(),error:null}}catch(e){return{data:null,error:e}}},new(n||(n=Promise))(function(e,t){function r(e){try{l(o.next(e))}catch(e){t(e)}}function a(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var s;t.done?e(t.value):((s=t.value)instanceof n?s:new n(function(e){e(s)})).then(r,a)}l((o=o.apply(s,i||[])).next())})}}var R=r(7992),U=r.n(R);class L{constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:"undefined"==typeof fetch?this.fetch=U():this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}then(e,t){void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),"GET"!==this.method&&"HEAD"!==this.method&&(this.headers["Content-Type"]="application/json");let r=this.fetch,s=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async e=>{var t,r,s;let i=null,n=null,o=null,a=e.status,l=e.statusText;if(e.ok){if("HEAD"!==this.method){let t=await e.text();""===t||(n="text/csv"===this.headers.Accept?t:this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?t:JSON.parse(t))}let s=null===(t=this.headers.Prefer)||void 0===t?void 0:t.match(/count=(exact|planned|estimated)/),h=null===(r=e.headers.get("content-range"))||void 0===r?void 0:r.split("/");s&&h&&h.length>1&&(o=parseInt(h[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(n)&&(n.length>1?(i={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,o=null,a=406,l="Not Acceptable"):n=1===n.length?n[0]:null)}else{let t=await e.text();try{i=JSON.parse(t),Array.isArray(i)&&404===e.status&&(n=[],i=null,a=200,l="OK")}catch(r){404===e.status&&""===t?(a=204,l="No Content"):i={message:t}}if(i&&this.isMaybeSingle&&(null===(s=null==i?void 0:i.details)||void 0===s?void 0:s.includes("Results contain 0 rows"))&&(i=null,a=200,l="OK"),i&&this.shouldThrowOnError)throw i}let h={error:i,data:n,count:o,status:a,statusText:l};return h});return this.shouldThrowOnError||(s=s.catch(e=>{var t,r,s;return{error:{message:`${null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null==e?void 0:e.message}`,details:`${null!==(r=null==e?void 0:e.stack)&&void 0!==r?r:""}`,hint:"",code:`${null!==(s=null==e?void 0:e.code)&&void 0!==s?s:""}`},data:null,count:null,status:0,statusText:""}})),s.then(e,t)}}class N extends L{select(e){let t=!1,r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:s}={}){let i=s?`${s}.order`:"order",n=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${n?`${n},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t}={}){let r=void 0===t?"limit":`${t}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:r}={}){let s=void 0===r?"offset":`${r}.offset`,i=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return"GET"===this.method?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:s=!1,wal:i=!1,format:n="text"}={}){let o=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,i?"wal":null].filter(Boolean).join("|"),a=this.headers.Accept;return this.headers.Accept=`application/vnd.pgrst.plan+${n}; for="${a}"; options=${o};`,this}rollback(){var e;return(null!==(e=this.headers.Prefer)&&void 0!==e?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}}class D extends N{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){let r=t.map(e=>"string"==typeof e&&RegExp("[,()]").test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s}={}){let i="";"plain"===s?i="pl":"phrase"===s?i="ph":"websearch"===s&&(i="w");let n=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${i}fts${n}.${t}`),this}match(e){return Object.entries(e).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t}={}){let r=t?`${t}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}}class J{constructor(e,{headers:t={},schema:r,fetch:s}){this.url=e,this.headers=t,this.schema=r,this.fetch=s}select(e,{head:t=!1,count:r}={}){let s=!1,i=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!s?"":('"'===e&&(s=!s),e)).join("");return this.url.searchParams.set("select",i),r&&(this.headers.Prefer=`count=${r}`),new D({method:t?"HEAD":"GET",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:t,defaultToNull:r=!0}={}){let s=[];if(this.headers.Prefer&&s.push(this.headers.Prefer),t&&s.push(`count=${t}`),r||s.push("missing=default"),this.headers.Prefer=s.join(","),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);this.url.searchParams.set("columns",e.join(","))}}return new D({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:s,defaultToNull:i=!0}={}){let n=[`resolution=${r?"ignore":"merge"}-duplicates`];if(void 0!==t&&this.url.searchParams.set("on_conflict",t),this.headers.Prefer&&n.push(this.headers.Prefer),s&&n.push(`count=${s}`),i||n.push("missing=default"),this.headers.Prefer=n.join(","),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);this.url.searchParams.set("columns",e.join(","))}}return new D({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:t}={}){let r=[];return this.headers.Prefer&&r.push(this.headers.Prefer),t&&r.push(`count=${t}`),this.headers.Prefer=r.join(","),new D({method:"PATCH",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){let t=[];return e&&t.push(`count=${e}`),this.headers.Prefer&&t.unshift(this.headers.Prefer),this.headers.Prefer=t.join(","),new D({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}}let B={"X-Client-Info":"postgrest-js/1.8.4"};class F{constructor(e,{headers:t={},schema:r,fetch:s}={}){this.url=e,this.headers=Object.assign(Object.assign({},B),t),this.schemaName=r,this.fetch=s}from(e){let t=new URL(`${this.url}/${e}`);return new J(t,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new F(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:r=!1,count:s}={}){let i,n;let o=new URL(`${this.url}/rpc/${e}`);r?(i="HEAD",Object.entries(t).forEach(([e,t])=>{o.searchParams.append(e,`${t}`)})):(i="POST",n=t);let a=Object.assign({},this.headers);return s&&(a.Prefer=`count=${s}`),new D({method:i,url:o,headers:a,schema:this.schemaName,body:n,fetch:this.fetch,allowEmpty:!1})}}var M=r(1775);let z={"X-Client-Info":"realtime-js/2.7.4"};(n=g||(g={}))[n.connecting=0]="connecting",n[n.open=1]="open",n[n.closing=2]="closing",n[n.closed=3]="closed",(o=m||(m={})).closed="closed",o.errored="errored",o.joined="joined",o.joining="joining",o.leaving="leaving",(a=v||(v={})).close="phx_close",a.error="phx_error",a.join="phx_join",a.reply="phx_reply",a.leave="phx_leave",a.access_token="access_token",(b||(b={})).websocket="websocket",(l=_||(_={})).Connecting="connecting",l.Open="open",l.Closing="closing",l.Closed="closed";class q{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}class K{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):"string"==typeof e?t(JSON.parse(e)):t({})}_binaryDecode(e){let t=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,t,r)}_decodeBroadcast(e,t,r){let s=t.getUint8(1),i=t.getUint8(2),n=this.HEADER_LENGTH+2,o=r.decode(e.slice(n,n+s));n+=s;let a=r.decode(e.slice(n,n+i));n+=i;let l=JSON.parse(r.decode(e.slice(n,e.byteLength)));return{ref:null,topic:o,event:a,payload:l}}}class H{constructor(e,t,r={},s=1e4){this.channel=e,this.event=t,this.payload=r,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null,this.rateLimited=!1}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){if(this._hasReceived("timeout"))return;this.startTimeout(),this.sent=!0;let e=this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()});"rate limited"===e&&(this.rateLimited=!0)}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var r;return this._hasReceived(e)&&t(null===(r=this.receivedResp)||void 0===r?void 0:r.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){this.timeoutTimer||(this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref),this.channel._on(this.refEvent,{},e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout))}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}(h=w||(w={})).SYNC="sync",h.JOIN="join",h.LEAVE="leave";class X{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};let r=(null==t?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},e=>{let{onJoin:t,onLeave:r,onSync:s}=this.caller;this.joinRef=this.channel._joinRef(),this.state=X.syncState(this.state,e,t,r),this.pendingDiffs.forEach(e=>{this.state=X.syncDiff(this.state,e,t,r)}),this.pendingDiffs=[],s()}),this.channel._on(r.diff,{},e=>{let{onJoin:t,onLeave:r,onSync:s}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=X.syncDiff(this.state,e,t,r),s())}),this.onJoin((e,t,r)=>{this.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:r})}),this.onLeave((e,t,r)=>{this.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:r})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,r,s){let i=this.cloneDeep(e),n=this.transformState(t),o={},a={};return this.map(i,(e,t)=>{n[e]||(a[e]=t)}),this.map(n,(e,t)=>{let r=i[e];if(r){let s=t.map(e=>e.presence_ref),i=r.map(e=>e.presence_ref),n=t.filter(e=>0>i.indexOf(e.presence_ref)),l=r.filter(e=>0>s.indexOf(e.presence_ref));n.length>0&&(o[e]=n),l.length>0&&(a[e]=l)}else o[e]=t}),this.syncDiff(i,{joins:o,leaves:a},r,s)}static syncDiff(e,t,r,s){let{joins:i,leaves:n}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return r||(r=()=>{}),s||(s=()=>{}),this.map(i,(t,s)=>{var i;let n=null!==(i=e[t])&&void 0!==i?i:[];if(e[t]=this.cloneDeep(s),n.length>0){let r=e[t].map(e=>e.presence_ref),s=n.filter(e=>0>r.indexOf(e.presence_ref));e[t].unshift(...s)}r(t,n,s)}),this.map(n,(t,r)=>{let i=e[t];if(!i)return;let n=r.map(e=>e.presence_ref);i=i.filter(e=>0>n.indexOf(e.presence_ref)),e[t]=i,s(t,i,r),0===i.length&&delete e[t]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static transformState(e){return Object.getOwnPropertyNames(e=this.cloneDeep(e)).reduce((t,r)=>{let s=e[r];return"metas"in s?t[r]=s.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e)):t[r]=s,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}(c=k||(k={})).abstime="abstime",c.bool="bool",c.date="date",c.daterange="daterange",c.float4="float4",c.float8="float8",c.int2="int2",c.int4="int4",c.int4range="int4range",c.int8="int8",c.int8range="int8range",c.json="json",c.jsonb="jsonb",c.money="money",c.numeric="numeric",c.oid="oid",c.reltime="reltime",c.text="text",c.time="time",c.timestamp="timestamp",c.timestamptz="timestamptz",c.timetz="timetz",c.tsrange="tsrange",c.tstzrange="tstzrange";let G=(e,t,r={})=>{var s;let i=null!==(s=r.skipTypes)&&void 0!==s?s:[];return Object.keys(t).reduce((r,s)=>(r[s]=V(s,e,t,i),r),{})},V=(e,t,r,s)=>{let i=t.find(t=>t.name===e),n=null==i?void 0:i.type,o=r[e];return n&&!s.includes(n)?Z(n,o):Y(o)},Z=(e,t)=>{if("_"===e.charAt(0)){let r=e.slice(1,e.length);return et(t,r)}switch(e){case k.bool:return W(t);case k.float4:case k.float8:case k.int2:case k.int4:case k.int8:case k.numeric:case k.oid:return Q(t);case k.json:case k.jsonb:return ee(t);case k.timestamp:return er(t);case k.abstime:case k.date:case k.daterange:case k.int4range:case k.int8range:case k.money:case k.reltime:case k.text:case k.time:case k.timestamptz:case k.timetz:case k.tsrange:case k.tstzrange:default:return Y(t)}},Y=e=>e,W=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Q=e=>{if("string"==typeof e){let t=parseFloat(e);if(!Number.isNaN(t))return t}return e},ee=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){console.log(`JSON parse error: ${e}`)}return e},et=(e,t)=>{if("string"!=typeof e)return e;let r=e.length-1,s=e[r],i=e[0];if("{"===i&&"}"===s){let s;let i=e.slice(1,r);try{s=JSON.parse("["+i+"]")}catch(e){s=i?i.split(","):[]}return s.map(e=>Z(t,e))}return e},er=e=>"string"==typeof e?e.replace(" ","T"):e;var es=function(e,t,r,s){return new(r||(r=Promise))(function(i,n){function o(e){try{l(s.next(e))}catch(e){n(e)}}function a(e){try{l(s.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((s=s.apply(e,t||[])).next())})};(u=S||(S={})).ALL="*",u.INSERT="INSERT",u.UPDATE="UPDATE",u.DELETE="DELETE",(d=O||(O={})).BROADCAST="broadcast",d.PRESENCE="presence",d.POSTGRES_CHANGES="postgres_changes",(f=T||(T={})).SUBSCRIBED="SUBSCRIBED",f.TIMED_OUT="TIMED_OUT",f.CLOSED="CLOSED",f.CHANNEL_ERROR="CHANNEL_ERROR";class ei{constructor(e,t={config:{}},r){this.topic=e,this.params=t,this.socket=r,this.bindings={},this.state=m.closed,this.joinedOnce=!1,this.pushBuffer=[],this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""}},t.config),this.timeout=this.socket.timeout,this.joinPush=new H(this,v.join,this.params,this.timeout),this.rejoinTimer=new q(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=m.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=m.closed,this.socket._remove(this)}),this._onError(e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=m.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=m.errored,this.rejoinTimer.scheduleTimeout())}),this._on(v.reply,{},(e,t)=>{this._trigger(this._replyEventName(t),e)}),this.presence=new X(this)}subscribe(e,t=this.timeout){var r,s;if(this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{let{config:{broadcast:i,presence:n}}=this.params;this._onError(t=>e&&e("CHANNEL_ERROR",t)),this._onClose(()=>e&&e("CLOSED"));let o={},a={broadcast:i,presence:n,postgres_changes:null!==(s=null===(r=this.bindings.postgres_changes)||void 0===r?void 0:r.map(e=>e.filter))&&void 0!==s?s:[]};this.socket.accessToken&&(o.access_token=this.socket.accessToken),this.updateJoinPayload(Object.assign({config:a},o)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",({postgres_changes:t})=>{var r;if(this.socket.accessToken&&this.socket.setAuth(this.socket.accessToken),void 0===t){e&&e("SUBSCRIBED");return}{let s=this.bindings.postgres_changes,i=null!==(r=null==s?void 0:s.length)&&void 0!==r?r:0,n=[];for(let r=0;r<i;r++){let i=s[r],{filter:{event:o,schema:a,table:l,filter:h}}=i,c=t&&t[r];if(c&&c.event===o&&c.schema===a&&c.table===l&&c.filter===h)n.push(Object.assign(Object.assign({},i),{id:c.id}));else{this.unsubscribe(),e&&e("CHANNEL_ERROR",Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=n,e&&e("SUBSCRIBED");return}}).receive("error",t=>{e&&e("CHANNEL_ERROR",Error(JSON.stringify(Object.values(t).join(", ")||"error")))}).receive("timeout",()=>{e&&e("TIMED_OUT")})}return this}presenceState(){return this.presence.state}track(e,t={}){return es(this,void 0,void 0,function*(){return yield this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)})}untrack(e={}){return es(this,void 0,void 0,function*(){return yield this.send({type:"presence",event:"untrack"},e)})}on(e,t,r){return this._on(e,t,r)}send(e,t={}){return new Promise(r=>{var s,i,n;let o=this._push(e.type,e,t.timeout||this.timeout);o.rateLimited&&r("rate limited"),"broadcast"!==e.type||(null===(n=null===(i=null===(s=this.params)||void 0===s?void 0:s.config)||void 0===i?void 0:i.broadcast)||void 0===n?void 0:n.ack)||r("ok"),o.receive("ok",()=>r("ok")),o.receive("timeout",()=>r("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=m.leaving;let t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(v.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise(r=>{let s=new H(this,v.leave,{},e);s.receive("ok",()=>{t(),r("ok")}).receive("timeout",()=>{t(),r("timed out")}).receive("error",()=>{r("error")}),s.send(),this._canPush()||s.trigger("ok",{})})}_push(e,t,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new H(this,e,t,r);return this._canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}_onMessage(e,t,r){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,r){var s,i;let n=e.toLocaleLowerCase(),{close:o,error:a,leave:l,join:h}=v;if(r&&[o,a,l,h].indexOf(n)>=0&&r!==this._joinRef())return;let c=this._onMessage(n,t,r);if(t&&!c)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(n)?null===(s=this.bindings.postgres_changes)||void 0===s||s.filter(e=>{var t,r,s;return(null===(t=e.filter)||void 0===t?void 0:t.event)==="*"||(null===(s=null===(r=e.filter)||void 0===r?void 0:r.event)||void 0===s?void 0:s.toLocaleLowerCase())===n}).map(e=>e.callback(c,r)):null===(i=this.bindings[n])||void 0===i||i.filter(e=>{var r,s,i,o,a,l;if(!["broadcast","presence","postgres_changes"].includes(n))return e.type.toLocaleLowerCase()===n;if("id"in e){let n=e.id,o=null===(r=e.filter)||void 0===r?void 0:r.event;return n&&(null===(s=t.ids)||void 0===s?void 0:s.includes(n))&&("*"===o||(null==o?void 0:o.toLocaleLowerCase())===(null===(i=t.data)||void 0===i?void 0:i.type.toLocaleLowerCase()))}{let r=null===(a=null===(o=null==e?void 0:e.filter)||void 0===o?void 0:o.event)||void 0===a?void 0:a.toLocaleLowerCase();return"*"===r||r===(null===(l=null==t?void 0:t.event)||void 0===l?void 0:l.toLocaleLowerCase())}}).map(e=>{if("object"==typeof c&&"ids"in c){let e=c.data,{schema:t,table:r,commit_timestamp:s,type:i,errors:n}=e;c=Object.assign(Object.assign({},{schema:t,table:r,commit_timestamp:s,eventType:i,new:{},old:{},errors:n}),this._getPayloadRecords(e))}e.callback(c,r)})}_isClosed(){return this.state===m.closed}_isJoined(){return this.state===m.joined}_isJoining(){return this.state===m.joining}_isLeaving(){return this.state===m.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,r){let s=e.toLocaleLowerCase(),i={type:s,filter:t,callback:r};return this.bindings[s]?this.bindings[s].push(i):this.bindings[s]=[i],this}_off(e,t){let r=e.toLocaleLowerCase();return this.bindings[r]=this.bindings[r].filter(e=>{var s;return!((null===(s=e.type)||void 0===s?void 0:s.toLocaleLowerCase())===r&&ei.isEqual(e.filter,t))}),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(v.close,{},e)}_onError(e){this._on(v.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=m.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let t={new:{},old:{}};return("INSERT"===e.type||"UPDATE"===e.type)&&(t.new=G(e.columns,e.record)),("UPDATE"===e.type||"DELETE"===e.type)&&(t.old=G(e.columns,e.old_record)),t}}var en=function(e,t,r,s){return new(r||(r=Promise))(function(i,n){function o(e){try{l(s.next(e))}catch(e){n(e)}}function a(e){try{l(s.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((s=s.apply(e,t||[])).next())})};let eo=()=>{};class ea{constructor(e,t){var r,s;this.accessToken=null,this.channels=[],this.endPoint="",this.headers=z,this.params={},this.timeout=1e4,this.transport=M.w3cwebsocket,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=eo,this.conn=null,this.sendBuffer=[],this.serializer=new K,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.eventsPerSecondLimitMs=100,this.inThrottle=!1,this.endPoint=`${e}/${b.websocket}`,(null==t?void 0:t.params)&&(this.params=t.params),(null==t?void 0:t.headers)&&(this.headers=Object.assign(Object.assign({},this.headers),t.headers)),(null==t?void 0:t.timeout)&&(this.timeout=t.timeout),(null==t?void 0:t.logger)&&(this.logger=t.logger),(null==t?void 0:t.transport)&&(this.transport=t.transport),(null==t?void 0:t.heartbeatIntervalMs)&&(this.heartbeatIntervalMs=t.heartbeatIntervalMs);let i=null===(r=null==t?void 0:t.params)||void 0===r?void 0:r.eventsPerSecond;i&&(this.eventsPerSecondLimitMs=Math.floor(1e3/i));let n=null===(s=null==t?void 0:t.params)||void 0===s?void 0:s.apikey;n&&(this.accessToken=n),this.reconnectAfterMs=(null==t?void 0:t.reconnectAfterMs)?t.reconnectAfterMs:e=>[1e3,2e3,5e3,1e4][e-1]||1e4,this.encode=(null==t?void 0:t.encode)?t.encode:(e,t)=>t(JSON.stringify(e)),this.decode=(null==t?void 0:t.decode)?t.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new q(()=>en(this,void 0,void 0,function*(){this.disconnect(),this.connect()}),this.reconnectAfterMs)}connect(){!this.conn&&(this.conn=new this.transport(this._endPointURL(),[],null,this.headers),this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e)))}disconnect(e,t){this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,null!=t?t:""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}removeChannel(e){return en(this,void 0,void 0,function*(){let t=yield e.unsubscribe();return 0===this.channels.length&&this.disconnect(),t})}removeAllChannels(){return en(this,void 0,void 0,function*(){let e=yield Promise.all(this.channels.map(e=>e.unsubscribe()));return this.disconnect(),e})}log(e,t,r){this.logger(e,t,r)}connectionState(){switch(this.conn&&this.conn.readyState){case g.connecting:return _.Connecting;case g.open:return _.Open;case g.closing:return _.Closing;default:return _.Closed}}isConnected(){return this.connectionState()===_.Open}channel(e,t={config:{}}){this.isConnected()||this.connect();let r=new ei(`realtime:${e}`,t,this);return this.channels.push(r),r}push(e){let{topic:t,event:r,payload:s,ref:i}=e,n=()=>{this.encode(e,e=>{var t;null===(t=this.conn)||void 0===t||t.send(e)})};if(this.log("push",`${t} ${r} (${i})`,s),this.isConnected()){if(["broadcast","presence","postgres_changes"].includes(r)){let e=this._throttle(n)();if(e)return"rate limited"}else n()}else this.sendBuffer.push(n)}setAuth(e){this.accessToken=e,this.channels.forEach(t=>{e&&t.updateJoinPayload({access_token:e}),t.joinedOnce&&t._isJoined()&&t._push(v.access_token,{access_token:e})})}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t._isJoined()||t._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t._joinRef()!==e._joinRef())}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:"1.0.0"}))}_onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:r,payload:s,ref:i}=e;(i&&i===this.pendingHeartbeatRef||r===(null==s?void 0:s.type))&&(this.pendingHeartbeatRef=null),this.log("receive",`${s.status||""} ${t} ${r} ${i&&"("+i+")"||""}`,s),this.channels.filter(e=>e._isMember(t)).forEach(e=>e._trigger(r,s,i)),this.stateChangeCallbacks.message.forEach(t=>t(e))})}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this._sendHeartbeat(),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach(e=>e())}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(t=>t(e))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(t=>t(e))}_triggerChanError(){this.channels.forEach(e=>e._trigger(v.error))}_appendParams(e,t){if(0===Object.keys(t).length)return e;let r=e.match(/\?/)?"&":"?",s=new URLSearchParams(t);return`${e}${r}${s}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),null===(e=this.conn)||void 0===e||e.close(1e3,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}_throttle(e,t=this.eventsPerSecondLimitMs){return()=>!!this.inThrottle||(e(),t>0&&(this.inThrottle=!0,setTimeout(()=>{this.inThrottle=!1},t)),!1)}}class el extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function eh(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e}class ec extends el{constructor(e,t){super(e),this.name="StorageApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class eu extends el{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}var ed=function(e,t,r,s){return new(r||(r=Promise))(function(i,n){function o(e){try{l(s.next(e))}catch(e){n(e)}}function a(e){try{l(s.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((s=s.apply(e,t||[])).next())})};let ef=e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>ed(void 0,void 0,void 0,function*(){return yield(yield Promise.resolve().then(r.t.bind(r,9366,23))).fetch(...e)}):fetch),(...e)=>t(...e)},ep=()=>ed(void 0,void 0,void 0,function*(){return"undefined"==typeof Response?(yield Promise.resolve().then(r.t.bind(r,9366,23))).Response:Response});var ey=function(e,t,r,s){return new(r||(r=Promise))(function(i,n){function o(e){try{l(s.next(e))}catch(e){n(e)}}function a(e){try{l(s.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((s=s.apply(e,t||[])).next())})};let eg=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),em=(e,t)=>ey(void 0,void 0,void 0,function*(){let r=yield ep();e instanceof r?e.json().then(r=>{t(new ec(eg(r),e.status||500))}).catch(e=>{t(new eu(eg(e),e))}):t(new eu(eg(e),e))}),ev=(e,t,r,s)=>{let i={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?i:(i.headers=Object.assign({"Content-Type":"application/json"},null==t?void 0:t.headers),i.body=JSON.stringify(s),Object.assign(Object.assign({},i),r))};function eb(e,t,r,s,i,n){return ey(this,void 0,void 0,function*(){return new Promise((o,a)=>{e(r,ev(t,s,i,n)).then(e=>{if(!e.ok)throw e;return(null==s?void 0:s.noResolveJson)?e:e.json()}).then(e=>o(e)).catch(e=>em(e,a))})})}function e_(e,t,r,s){return ey(this,void 0,void 0,function*(){return eb(e,"GET",t,r,s)})}function ew(e,t,r,s,i){return ey(this,void 0,void 0,function*(){return eb(e,"POST",t,s,i,r)})}function ek(e,t,r,s,i){return ey(this,void 0,void 0,function*(){return eb(e,"DELETE",t,s,i,r)})}var eS=function(e,t,r,s){return new(r||(r=Promise))(function(i,n){function o(e){try{l(s.next(e))}catch(e){n(e)}}function a(e){try{l(s.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((s=s.apply(e,t||[])).next())})};let eO={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},eT={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class eE{constructor(e,t={},r,s){this.url=e,this.headers=t,this.bucketId=r,this.fetch=ef(s)}uploadOrUpdate(e,t,r,s){return eS(this,void 0,void 0,function*(){try{let i;let n=Object.assign(Object.assign({},eT),s),o=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(n.upsert)});"undefined"!=typeof Blob&&r instanceof Blob?((i=new FormData).append("cacheControl",n.cacheControl),i.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(i=r).append("cacheControl",n.cacheControl):(i=r,o["cache-control"]=`max-age=${n.cacheControl}`,o["content-type"]=n.contentType);let a=this._removeEmptyFolders(t),l=this._getFinalPath(a),h=yield this.fetch(`${this.url}/object/${l}`,Object.assign({method:e,body:i,headers:o},(null==n?void 0:n.duplex)?{duplex:n.duplex}:{}));if(h.ok)return{data:{path:a},error:null};{let e=yield h.json();return{data:null,error:e}}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}upload(e,t,r){return eS(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,r)})}uploadToSignedUrl(e,t,r,s){return eS(this,void 0,void 0,function*(){let i=this._removeEmptyFolders(e),n=this._getFinalPath(i),o=new URL(this.url+`/object/upload/sign/${n}`);o.searchParams.set("token",t);try{let e;let t=Object.assign({upsert:eT.upsert},s),n=Object.assign(Object.assign({},this.headers),{"x-upsert":String(t.upsert)});"undefined"!=typeof Blob&&r instanceof Blob?((e=new FormData).append("cacheControl",t.cacheControl),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r).append("cacheControl",t.cacheControl):(e=r,n["cache-control"]=`max-age=${t.cacheControl}`,n["content-type"]=t.contentType);let a=yield this.fetch(o.toString(),{method:"PUT",body:e,headers:n});if(a.ok)return{data:{path:i},error:null};{let e=yield a.json();return{data:null,error:e}}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}createSignedUploadUrl(e){return eS(this,void 0,void 0,function*(){try{let t=this._getFinalPath(e),r=yield ew(this.fetch,`${this.url}/object/upload/sign/${t}`,{},{headers:this.headers}),s=new URL(this.url+r.url),i=s.searchParams.get("token");if(!i)throw new el("No token returned by API");return{data:{signedUrl:s.toString(),path:e,token:i},error:null}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}update(e,t,r){return eS(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,r)})}move(e,t){return eS(this,void 0,void 0,function*(){try{let r=yield ew(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers});return{data:r,error:null}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}copy(e,t){return eS(this,void 0,void 0,function*(){try{let r=yield ew(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers});return{data:{path:r.Key},error:null}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}createSignedUrl(e,t,r){return eS(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e),i=yield ew(this.fetch,`${this.url}/object/sign/${s}`,Object.assign({expiresIn:t},(null==r?void 0:r.transform)?{transform:r.transform}:{}),{headers:this.headers}),n=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"",o=encodeURI(`${this.url}${i.signedURL}${n}`);return{data:i={signedUrl:o},error:null}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}createSignedUrls(e,t,r){return eS(this,void 0,void 0,function*(){try{let s=yield ew(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:s.map(e=>Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${i}`):null})),error:null}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}download(e,t){return eS(this,void 0,void 0,function*(){let r=void 0!==(null==t?void 0:t.transform),s=this.transformOptsToQueryString((null==t?void 0:t.transform)||{}),i=s?`?${s}`:"";try{let t=this._getFinalPath(e),s=yield e_(this.fetch,`${this.url}/${r?"render/image/authenticated":"object"}/${t}${i}`,{headers:this.headers,noResolveJson:!0}),n=yield s.blob();return{data:n,error:null}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}getPublicUrl(e,t){let r=this._getFinalPath(e),s=[],i=(null==t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==i&&s.push(i);let n=void 0!==(null==t?void 0:t.transform),o=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});""!==o&&s.push(o);let a=s.join("&");return""!==a&&(a=`?${a}`),{data:{publicUrl:encodeURI(`${this.url}/${n?"render/image":"object"}/public/${r}${a}`)}}}remove(e){return eS(this,void 0,void 0,function*(){try{let t=yield ek(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers});return{data:t,error:null}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}list(e,t,r){return eS(this,void 0,void 0,function*(){try{let s=Object.assign(Object.assign(Object.assign({},eO),t),{prefix:e||""}),i=yield ew(this.fetch,`${this.url}/object/list/${this.bucketId}`,s,{headers:this.headers},r);return{data:i,error:null}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}_getFinalPath(e){return`${this.bucketId}/${e}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){let t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}let eC={"X-Client-Info":"storage-js/2.5.3"};var ej=function(e,t,r,s){return new(r||(r=Promise))(function(i,n){function o(e){try{l(s.next(e))}catch(e){n(e)}}function a(e){try{l(s.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((s=s.apply(e,t||[])).next())})};class eI{constructor(e,t={},r){this.url=e,this.headers=Object.assign(Object.assign({},eC),t),this.fetch=ef(r)}listBuckets(){return ej(this,void 0,void 0,function*(){try{let e=yield e_(this.fetch,`${this.url}/bucket`,{headers:this.headers});return{data:e,error:null}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}getBucket(e){return ej(this,void 0,void 0,function*(){try{let t=yield e_(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers});return{data:t,error:null}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}createBucket(e,t={public:!1}){return ej(this,void 0,void 0,function*(){try{let r=yield ew(this.fetch,`${this.url}/bucket`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers});return{data:r,error:null}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}updateBucket(e,t){return ej(this,void 0,void 0,function*(){try{let r=yield function(e,t,r,s,i){return ey(this,void 0,void 0,function*(){return eb(e,"PUT",t,s,void 0,r)})}(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers});return{data:r,error:null}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}emptyBucket(e){return ej(this,void 0,void 0,function*(){try{let t=yield ew(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers});return{data:t,error:null}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}deleteBucket(e){return ej(this,void 0,void 0,function*(){try{let t=yield ek(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers});return{data:t,error:null}}catch(e){if(eh(e))return{data:null,error:e};throw e}})}}class ex extends eI{constructor(e,t={},r){super(e,t,r)}from(e){return new eE(this.url,this.headers,e,this.fetch)}}var eA=r(9366),eP=r.n(eA);let e$=e=>{let t;return t=e||("undefined"==typeof fetch?eP():fetch),(...e)=>t(...e)},eR=()=>"undefined"==typeof Headers?eA.Headers:Headers,eU=(e,t,r)=>{let s=e$(r),i=eR();return(r,n)=>{var o,a,l,h;return o=void 0,a=void 0,l=void 0,h=function*(){var o;let a=null!==(o=yield t())&&void 0!==o?o:e,l=new i(null==n?void 0:n.headers);return l.has("apikey")||l.set("apikey",e),l.has("Authorization")||l.set("Authorization",`Bearer ${a}`),s(r,Object.assign(Object.assign({},n),{headers:l}))},new(l||(l=Promise))(function(e,t){function r(e){try{i(h.next(e))}catch(e){t(e)}}function s(e){try{i(h.throw(e))}catch(e){t(e)}}function i(t){var i;t.done?e(t.value):((i=t.value)instanceof l?i:new l(function(e){e(i)})).then(r,s)}i((h=h.apply(o,a||[])).next())})}},eL=()=>"undefined"!=typeof document,eN={tested:!1,writable:!1},eD=()=>{if(!eL())return!1;try{if("object"!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(eN.tested)return eN.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),eN.tested=!0,eN.writable=!0}catch(e){eN.tested=!0,eN.writable=!1}return eN.writable};function eJ(e){let t={},r=new URL(e);if(r.hash&&"#"===r.hash[0])try{let e=new URLSearchParams(r.hash.substring(1));e.forEach((e,r)=>{t[r]=e})}catch(e){}return r.searchParams.forEach((e,r)=>{t[r]=e}),t}let eB=e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(r.t.bind(r,7992,23)).then(({default:t})=>t(...e)):fetch),(...e)=>t(...e)},eF=e=>"object"==typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"==typeof e.json,eM=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},ez=async(e,t)=>{let r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch(e){return r}},eq=async(e,t)=>{await e.removeItem(t)};class eK{constructor(){this.promise=new eK.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function eH(e){let t=e.split(".");if(3!==t.length)throw Error("JWT is not valid: not a JWT structure");if(!/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i.test(t[1]))throw Error("JWT is not valid: payload is not in base64url format");let r=t[1];return JSON.parse(function(e){let t,r,s,i,n,o,a;let l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h="",c=0;for(e=e.replace("-","+").replace("_","/");c<e.length;)i=l.indexOf(e.charAt(c++)),n=l.indexOf(e.charAt(c++)),o=l.indexOf(e.charAt(c++)),a=l.indexOf(e.charAt(c++)),t=i<<2|n>>4,r=(15&n)<<4|o>>2,s=(3&o)<<6|a,h+=String.fromCharCode(t),64!=o&&0!=r&&(h+=String.fromCharCode(r)),64!=a&&0!=s&&(h+=String.fromCharCode(s));return h}(r))}async function eX(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function eG(e){return("0"+e.toString(16)).substr(-2)}function eV(){let e=new Uint32Array(56);if("undefined"==typeof crypto){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length,r="";for(let s=0;s<56;s++)r+=e.charAt(Math.floor(Math.random()*t));return r}return crypto.getRandomValues(e),Array.from(e,eG).join("")}async function eZ(e){let t=new TextEncoder,r=t.encode(e),s=await crypto.subtle.digest("SHA-256",r),i=new Uint8Array(s);return Array.from(i).map(e=>String.fromCharCode(e)).join("")}async function eY(e){if("undefined"==typeof crypto)return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;let t=await eZ(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}eK.promiseConstructor=Promise;class eW extends Error{constructor(e,t){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t}}function eQ(e){return"object"==typeof e&&null!==e&&"__isAuthError"in e}class e0 extends eW{constructor(e,t){super(e,t),this.name="AuthApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class e1 extends eW{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class e2 extends eW{constructor(e,t,r){super(e),this.name=t,this.status=r}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class e3 extends e2{constructor(){super("Auth session missing!","AuthSessionMissingError",400)}}class e6 extends e2{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500)}}class e4 extends e2{constructor(e){super(e,"AuthInvalidCredentialsError",400)}}class e5 extends e2{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class e9 extends e2{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class e8 extends e2{constructor(e,t){super(e,"AuthRetryableFetchError",t)}}function e7(e){return eQ(e)&&"AuthRetryableFetchError"===e.name}var te=function(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&0>t.indexOf(s)&&(r[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)0>t.indexOf(s[i])&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(r[s[i]]=e[s[i]]);return r};let tt=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),tr=[502,503,504];async function ts(e){let t;if(!eF(e))throw new e8(tt(e),0);if(tr.includes(e.status))throw new e8(tt(e),e.status);try{t=await e.json()}catch(e){throw new e1(tt(e),e)}throw new e0(tt(t),e.status||500)}let ti=(e,t,r,s)=>{let i={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null==t?void 0:t.headers),i.body=JSON.stringify(s),Object.assign(Object.assign({},i),r))};async function tn(e,t,r,s){var i;let n=Object.assign({},null==s?void 0:s.headers);(null==s?void 0:s.jwt)&&(n.Authorization=`Bearer ${s.jwt}`);let o=null!==(i=null==s?void 0:s.query)&&void 0!==i?i:{};(null==s?void 0:s.redirectTo)&&(o.redirect_to=s.redirectTo);let a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await to(e,t,r+a,{headers:n,noResolveJson:null==s?void 0:s.noResolveJson},{},null==s?void 0:s.body);return(null==s?void 0:s.xform)?null==s?void 0:s.xform(l):{data:Object.assign({},l),error:null}}async function to(e,t,r,s,i,n){let o;let a=ti(t,s,i,n);try{o=await e(r,a)}catch(e){throw console.error(e),new e8(tt(e),0)}if(o.ok||await ts(o),null==s?void 0:s.noResolveJson)return o;try{return await o.json()}catch(e){await ts(e)}}function ta(e){var t;let r=null;e.access_token&&e.refresh_token&&e.expires_in&&(r=Object.assign({},e),e.expires_at||(r.expires_at=function(e){let t=Math.round(Date.now()/1e3);return t+e}(e.expires_in)));let s=null!==(t=e.user)&&void 0!==t?t:e;return{data:{session:r,user:s},error:null}}function tl(e){var t;let r=null!==(t=e.user)&&void 0!==t?t:e;return{data:{user:r},error:null}}function th(e){return{data:e,error:null}}function tc(e){let{action_link:t,email_otp:r,hashed_token:s,redirect_to:i,verification_type:n}=e,o=te(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a=Object.assign({},o);return{data:{properties:{action_link:t,email_otp:r,hashed_token:s,redirect_to:i,verification_type:n},user:a},error:null}}function tu(e){return e}var td=function(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&0>t.indexOf(s)&&(r[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)0>t.indexOf(s[i])&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(r[s[i]]=e[s[i]]);return r};class tf{constructor({url:e="",headers:t={},fetch:r}){this.url=e,this.headers=t,this.fetch=eB(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t="global"){try{return await tn(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(eQ(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await tn(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:tl})}catch(e){if(eQ(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{let{options:t}=e,r=td(e,["options"]),s=Object.assign(Object.assign({},r),t);return"newEmail"in r&&(s.new_email=null==r?void 0:r.newEmail,delete s.newEmail),await tn(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:tc,redirectTo:null==t?void 0:t.redirectTo})}catch(e){if(eQ(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await tn(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:tl})}catch(e){if(eQ(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,r,s,i,n,o,a;try{let l={nextPage:null,lastPage:0,total:0},h=await tn(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(r=null===(t=null==e?void 0:e.page)||void 0===t?void 0:t.toString())&&void 0!==r?r:"",per_page:null!==(i=null===(s=null==e?void 0:e.perPage)||void 0===s?void 0:s.toString())&&void 0!==i?i:""},xform:tu});if(h.error)throw h.error;let c=await h.json(),u=null!==(n=h.headers.get("x-total-count"))&&void 0!==n?n:0,d=null!==(a=null===(o=h.headers.get("link"))||void 0===o?void 0:o.split(","))&&void 0!==a?a:[];return d.length>0&&(d.forEach(e=>{let t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l[`${r}Page`]=t}),l.total=parseInt(u)),{data:Object.assign(Object.assign({},c),l),error:null}}catch(e){if(eQ(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){try{return await tn(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:tl})}catch(e){if(eQ(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){try{return await tn(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:tl})}catch(e){if(eQ(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){try{return await tn(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:tl})}catch(e){if(eQ(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){try{let{data:t,error:r}=await tn(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:r}}catch(e){if(eQ(e))return{data:null,error:e};throw e}}async _deleteFactor(e){try{let t=await tn(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers});return{data:t,error:null}}catch(e){if(eQ(e))return{data:null,error:e};throw e}}}let tp="2.51.0",ty={"X-Client-Info":`gotrue-js/${tp}`};var tg={getItem:e=>eD()?globalThis.localStorage.getItem(e):null,setItem:(e,t)=>{eD()&&globalThis.localStorage.setItem(e,t)},removeItem:e=>{eD()&&globalThis.localStorage.removeItem(e)}};globalThis&&eD()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class tm extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}!function(){if("object"!=typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"undefined"!=typeof self&&(self.globalThis=self)}}();let tv={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:ty,flowType:"implicit",debug:!1};async function tb(e,t,r){return await r()}class t_{constructor(e){var t;this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.instanceID=t_.nextInstanceID,t_.nextInstanceID+=1,this.instanceID>0&&eL()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");let r=Object.assign(Object.assign({},tv),e);if(this.logDebugMessages=r.debug,this.inMemorySession=null,this.storageKey=r.storageKey,this.autoRefreshToken=r.autoRefreshToken,this.persistSession=r.persistSession,this.storage=r.storage||tg,this.admin=new tf({url:r.url,headers:r.headers,fetch:r.fetch}),this.url=r.url,this.headers=r.headers,this.fetch=eB(r.fetch),this.lock=r.lock||tb,this.detectSessionInUrl=r.detectSessionInUrl,this.flowType=r.flowType,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession&&this.storage===tg&&!eD()&&console.warn(`No storage option exists to persist the session, which may result in unexpected behavior when using auth.
2
+ If you want to set persistSession to true, please provide a storage option or you may set persistSession to false to disable this warning.`),eL()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",e)}null===(t=this.broadcastChannel)||void 0===t||t.addEventListener("message",async e=>{this._debug("received broadcast notification from other tab or client",e),await this._notifyAllSubscribers(e.data.event,e.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&console.log(`GoTrueClient@${this.instanceID} (${tp}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))()),await this.initializePromise}async _initialize(){try{let e=!!eL()&&await this._isPKCEFlow();if(this._debug("#_initialize()","begin","is PKCE flow",e),e||this.detectSessionInUrl&&this._isImplicitGrantFlow()){let{data:t,error:r}=await this._getSessionFromURL(e);if(r)return this._debug("#_initialize()","error detecting session from URL",r),await this._removeSession(),{error:r};let{session:s,redirectType:i}=t;return this._debug("#_initialize()","detected session in URL",s,"redirect type",i),await this._saveSession(s),setTimeout(async()=>{"recovery"===i?await this._notifyAllSubscribers("PASSWORD_RECOVERY",s):await this._notifyAllSubscribers("SIGNED_IN",s)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){if(eQ(e))return{error:e};return{error:new e1("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signUp(e){var t,r,s;try{let i;if(await this._removeSession(),"email"in e){let{email:r,password:s,options:n}=e,o=null,a=null;if("pkce"===this.flowType){let e=eV();await eM(this.storage,`${this.storageKey}-code-verifier`,e),o=await eY(e),a=e===o?"plain":"s256"}i=await tn(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null==n?void 0:n.emailRedirectTo,body:{email:r,password:s,data:null!==(t=null==n?void 0:n.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:o,code_challenge_method:a},xform:ta})}else if("phone"in e){let{phone:t,password:n,options:o}=e;i=await tn(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!==(r=null==o?void 0:o.data)&&void 0!==r?r:{},channel:null!==(s=null==o?void 0:o.channel)&&void 0!==s?s:"sms",gotrue_meta_security:{captcha_token:null==o?void 0:o.captchaToken}},xform:ta})}else throw new e4("You must provide either an email or phone number and a password");let{data:n,error:o}=i;if(o||!n)return{data:{user:null,session:null},error:o};let a=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:l,session:a},error:null}}catch(e){if(eQ(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithPassword(e){try{let t;if(await this._removeSession(),"email"in e){let{email:r,password:s,options:i}=e;t=await tn(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:r,password:s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:ta})}else if("phone"in e){let{phone:r,password:s,options:i}=e;t=await tn(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:r,password:s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:ta})}else throw new e4("You must provide either an email or phone number and a password");let{data:r,error:s}=t;if(s)return{data:{user:null,session:null},error:s};if(!r||!r.session||!r.user)return{data:{user:null,session:null},error:new e6};return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:{user:r.user,session:r.session},error:s}}catch(e){if(eQ(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOAuth(e){var t,r,s,i;return await this._removeSession(),await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(s=e.options)||void 0===s?void 0:s.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async _exchangeCodeForSession(e){let t=await ez(this.storage,`${this.storageKey}-code-verifier`),{data:r,error:s}=await tn(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:t},xform:ta});return(await eq(this.storage,`${this.storageKey}-code-verifier`),s)?{data:{user:null,session:null},error:s}:r&&r.session&&r.user?(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:r,error:s}):{data:{user:null,session:null},error:new e6}}async signInWithIdToken(e){await this._removeSession();try{let{options:t,provider:r,token:s,access_token:i,nonce:n}=e,o=await tn(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:ta}),{data:a,error:l}=o;if(l)return{data:{user:null,session:null},error:l};if(!a||!a.session||!a.user)return{data:{user:null,session:null},error:new e6};return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),{data:a,error:l}}catch(e){if(eQ(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOtp(e){var t,r,s,i,n;try{if(await this._removeSession(),"email"in e){let{email:s,options:i}=e,n=null,o=null;if("pkce"===this.flowType){let e=eV();await eM(this.storage,`${this.storageKey}-code-verifier`,e),n=await eY(e),o=e===n?"plain":"s256"}let{error:a}=await tn(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:s,data:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},create_user:null===(r=null==i?void 0:i.shouldCreateUser)||void 0===r||r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:o},redirectTo:null==i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:a}}if("phone"in e){let{phone:t,options:r}=e,{data:o,error:a}=await tn(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(s=null==r?void 0:r.data)&&void 0!==s?s:{},create_user:null===(i=null==r?void 0:r.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null==r?void 0:r.captchaToken},channel:null!==(n=null==r?void 0:r.channel)&&void 0!==n?n:"sms"}});return{data:{user:null,session:null,messageId:null==o?void 0:o.message_id},error:a}}throw new e4("You must provide either an email or phone number.")}catch(e){if(eQ(e))return{data:{user:null,session:null},error:e};throw e}}async verifyOtp(e){var t,r;try{let s,i;"email_change"!==e.type&&"phone_change"!==e.type&&await this._removeSession(),"options"in e&&(s=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(r=e.options)||void 0===r?void 0:r.captchaToken);let{data:n,error:o}=await tn(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:ta});if(o)throw o;if(!n)throw Error("An error occurred on token verification.");let a=n.session,l=n.user;return(null==a?void 0:a.access_token)&&(await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:l,session:a},error:null}}catch(e){if(eQ(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSSO(e){var t,r,s;try{return await this._removeSession(),await tn(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:null!==(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==r?r:void 0}),(null===(s=null==e?void 0:e.options)||void 0===s?void 0:s.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0}),headers:this.headers,xform:th})}catch(e){if(eQ(e))return{data:null,error:e};throw e}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;if(r)throw r;if(!t)throw new e3;let{error:s}=await tn(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:s}})}catch(e){if(eQ(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{"email_change"!=e.type&&"phone_change"!=e.type&&await this._removeSession();let t=`${this.url}/resend`;if("email"in e){let{email:r,type:s,options:i}=e,{error:n}=await tn(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},redirectTo:null==i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:n}}if("phone"in e){let{phone:r,type:s,options:i}=e,{data:n,error:o}=await tn(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:null==n?void 0:n.message_id},error:o}}throw new e4("You must provide either an email or phone number and a type")}catch(e){if(eQ(e))return{data:{user:null,session:null},error:e};throw e}}async getSession(){return await this.initializePromise,this._acquireLock(-1,async()=>this._useSession(async e=>e))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await r}catch(e){}})()),r}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){let e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{let t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",Error().stack);try{let e=null;if(this.persistSession){let t=await ez(this.storage,this.storageKey);this._debug("#getSession()","session from storage",t),null!==t&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession()))}else e=this.inMemorySession,this._debug("#getSession()","session from memory",e);if(!e)return{data:{session:null},error:null};let t=!!e.expires_at&&e.expires_at<=Date.now()/1e3;if(this._debug("#__loadSession()",`session has${t?"":" not"} expired`,"expires_at",e.expires_at),!t)return{data:{session:e},error:null};let{session:r,error:s}=await this._callRefreshToken(e.refresh_token);if(s)return{data:{session:null},error:s};return{data:{session:r},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{if(e)return await tn(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:tl});return await this._useSession(async e=>{var t,r;let{data:s,error:i}=e;if(i)throw i;return await tn(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!==(r=null===(t=s.session)||void 0===t?void 0:t.access_token)&&void 0!==r?r:void 0,xform:tl})})}catch(e){if(eQ(e))return{data:{user:null},error:e};throw e}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async r=>{let{data:s,error:i}=r;if(i)throw i;if(!s.session)throw new e3;let n=s.session,o=null,a=null;if("pkce"===this.flowType&&null!=e.email){let e=eV();await eM(this.storage,`${this.storageKey}-code-verifier`,e),o=await eY(e),a=e===o?"plain":"s256"}let{data:l,error:h}=await tn(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:o,code_challenge_method:a}),jwt:n.access_token,xform:tl});if(h)throw h;return n.user=l.user,await this._saveSession(n),await this._notifyAllSubscribers("USER_UPDATED",n),{data:{user:n.user},error:null}})}catch(e){if(eQ(e))return{data:{user:null},error:e};throw e}}_decodeJWT(e){return eH(e)}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new e3;let t=Date.now()/1e3,r=t,s=!0,i=null,n=eH(e.access_token);if(n.exp&&(s=(r=n.exp)<=t),s){let{session:t,error:r}=await this._callRefreshToken(e.refresh_token);if(r)return{data:{user:null,session:null},error:r};if(!t)return{data:{user:null,session:null},error:null};i=t}else{let{data:s,error:n}=await this._getUser(e.access_token);if(n)throw n;i={access_token:e.access_token,refresh_token:e.refresh_token,user:s.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(e){if(eQ(e))return{data:{session:null,user:null},error:e};throw e}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var r;if(!e){let{data:s,error:i}=t;if(i)throw i;e=null!==(r=s.session)&&void 0!==r?r:void 0}if(!(null==e?void 0:e.refresh_token))throw new e3;let{session:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:s?{data:{user:s.user,session:s},error:null}:{data:{user:null,session:null},error:null}})}catch(e){if(eQ(e))return{data:{user:null,session:null},error:e};throw e}}async _getSessionFromURL(e){try{if(!eL())throw new e5("No browser detected.");if("implicit"!==this.flowType||this._isImplicitGrantFlow()){if("pkce"==this.flowType&&!e)throw new e9("Not a valid PKCE flow url.")}else throw new e5("Not a valid implicit grant flow url.");let t=eJ(window.location.href);if(e){if(!t.code)throw new e9("No code detected.");let{data:e,error:r}=await this._exchangeCodeForSession(t.code);if(r)throw r;let s=new URL(window.location.href);return s.searchParams.delete("code"),window.history.replaceState(window.history.state,"",s.toString()),{data:{session:e.session,redirectType:null},error:null}}if(t.error||t.error_description||t.error_code)throw new e5(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});let{provider_token:r,provider_refresh_token:s,access_token:i,refresh_token:n,expires_in:o,expires_at:a,token_type:l}=t;if(!i||!o||!n||!l)throw new e5("No session defined in URL");let h=Math.round(Date.now()/1e3),c=parseInt(o),u=h+c;a&&(u=parseInt(a));let d=u-h;1e3*d<=3e4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${d}s, should have been closer to ${c}s`);let f=u-c;h-f>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",f,u,h):h-f<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",f,u,h);let{data:p,error:y}=await this._getUser(i);if(y)throw y;let g={provider_token:r,provider_refresh_token:s,access_token:i,expires_in:c,expires_at:u,refresh_token:n,token_type:l,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:g,redirectType:t.type},error:null}}catch(e){if(eQ(e))return{data:{session:null,redirectType:null},error:e};throw e}}_isImplicitGrantFlow(){let e=eJ(window.location.href);return!!(eL()&&(e.access_token||e.error_description))}async _isPKCEFlow(){let e=eJ(window.location.href),t=await ez(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var r;let{data:s,error:i}=t;if(i)return{error:i};let n=null===(r=s.session)||void 0===r?void 0:r.access_token;if(n){let{error:t}=await this.admin.signOut(n,e);if(t&&!(eQ(t)&&"AuthApiError"===t.name&&(404===t.status||401===t.status)))return{error:t}}return"others"!==e&&(await this._removeSession(),await eq(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}})}onAuthStateChange(e){let t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}),r={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,r),(async()=>{await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(t)})})(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async t=>{var r,s;try{let{data:{session:s},error:i}=t;if(i)throw i;await (null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(t){await (null===(s=this.stateChangeEmitters.get(e))||void 0===s?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),console.error(t)}})}async resetPasswordForEmail(e,t={}){let r=null,s=null;if("pkce"===this.flowType){let e=eV();await eM(this.storage,`${this.storageKey}-code-verifier`,e),r=await eY(e),s=e===r?"plain":"s256"}try{return await tn(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(eQ(e))return{data:null,error:e};throw e}}async _refreshAccessToken(e){let t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{let r=Date.now();return await function(e,t){let r=new Promise((r,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{let s=await e(i);if(!t(i,null,s)){r(s);return}}catch(e){if(!t(i,e)){s(e);return}}})()});return r}(async r=>(await eX(200*r),this._debug(t,"refreshing attempt",r),await tn(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:ta})),(e,t,s)=>s&&s.error&&e7(s.error)&&Date.now()+(e+1)*200-r<3e4)}catch(e){if(this._debug(t,"error",e),eQ(e))return{data:{session:null,user:null},error:e};throw e}finally{this._debug(t,"end")}}_isValidSession(e){return"object"==typeof e&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){let r=await this._getUrlForProvider(e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",r),eL()&&!t.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e;let t="#_recoverAndRefresh()";this._debug(t,"begin");try{let r=await ez(this.storage,this.storageKey);if(this._debug(t,"session from storage",r),!this._isValidSession(r)){this._debug(t,"session is not valid"),null!==r&&await this._removeSession();return}let s=Math.round(Date.now()/1e3),i=(null!==(e=r.expires_at)&&void 0!==e?e:1/0)<s+10;if(this._debug(t,`session has${i?"":" not"} expired with margin of 10s`),i){if(this.autoRefreshToken&&r.refresh_token){let{error:e}=await this._callRefreshToken(r.refresh_token);e&&(console.error(e),e7(e)||(this._debug(t,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else await this._notifyAllSubscribers("SIGNED_IN",r)}catch(e){this._debug(t,"error",e),console.error(e);return}finally{this._debug(t,"end")}}async _callRefreshToken(e){var t,r;if(!e)throw new e3;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new eK;let{data:t,error:r}=await this._refreshAccessToken(e);if(r)throw r;if(!t.session)throw new e3;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);let s={session:t.session,error:null};return this.refreshingDeferred.resolve(s),s}catch(e){if(this._debug(s,"error",e),eQ(e)){let r={session:null,error:e};return null===(t=this.refreshingDeferred)||void 0===t||t.resolve(r),r}throw null===(r=this.refreshingDeferred)||void 0===r||r.reject(e),e}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,t,r=!0){let s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",t,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});let s=[],i=Array.from(this.stateChangeEmitters.values()).map(async r=>{try{await r.callback(e,t)}catch(e){s.push(e)}});if(await Promise.all(i),s.length>0){for(let e=0;e<s.length;e+=1)console.error(s[e]);throw s[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.persistSession||(this.inMemorySession=e),this.persistSession&&e.expires_at&&await this._persistSession(e)}_persistSession(e){return this._debug("#_persistSession()",e),eM(this.storage,this.storageKey,e)}async _removeSession(){this._debug("#_removeSession()"),this.persistSession?await eq(this.storage,this.storageKey):this.inMemorySession=null}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&eL()&&(null==window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(e){console.error("removing visibilitychange callback failed",e)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),3e4);this.autoRefreshTicker=e,e&&"object"==typeof e&&"function"==typeof e.unref?e.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{let e=Date.now();try{return await this._useSession(async t=>{let{data:{session:r}}=t;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}let s=Math.floor((1e3*r.expires_at-e)/3e4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),s<=3&&await this._callRefreshToken(r.refresh_token)})}catch(e){console.error("Auto refresh tick failed with error. This is likely a transient error.",e)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof tm)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!eL()||!(null==window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),null==window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if("visible"!==document.visibilityState){this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t){let r=[`provider=${encodeURIComponent(e)}`];if((null==t?void 0:t.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(t.redirectTo)}`),(null==t?void 0:t.scopes)&&r.push(`scopes=${encodeURIComponent(t.scopes)}`),"pkce"===this.flowType){let e=eV();await eM(this.storage,`${this.storageKey}-code-verifier`,e);let t=await eY(e),s=e===t?"plain":"s256";this._debug("PKCE","code verifier",`${e.substring(0,5)}...`,"code challenge",t,"method",s);let i=new URLSearchParams({code_challenge:`${encodeURIComponent(t)}`,code_challenge_method:`${encodeURIComponent(s)}`});r.push(i.toString())}if(null==t?void 0:t.queryParams){let e=new URLSearchParams(t.queryParams);r.push(e.toString())}return`${this.url}/authorize?${r.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var r;let{data:s,error:i}=t;return i?{data:null,error:i}:await tn(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(r=null==s?void 0:s.session)||void 0===r?void 0:r.access_token})})}catch(e){if(eQ(e))return{data:null,error:e};throw e}}async _enroll(e){try{return await this._useSession(async t=>{var r,s;let{data:i,error:n}=t;if(n)return{data:null,error:n};let{data:o,error:a}=await tn(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:e.friendlyName,factor_type:e.factorType,issuer:e.issuer},headers:this.headers,jwt:null===(r=null==i?void 0:i.session)||void 0===r?void 0:r.access_token});return a?{data:null,error:a}:((null===(s=null==o?void 0:o.totp)||void 0===s?void 0:s.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})})}catch(e){if(eQ(e))return{data:null,error:e};throw e}}async _verify(e){try{return await this._useSession(async t=>{var r;let{data:s,error:i}=t;if(i)return{data:null,error:i};let{data:n,error:o}=await tn(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:null===(r=null==s?void 0:s.session)||void 0===r?void 0:r.access_token});return o?{data:null,error:o}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+n.expires_in},n)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",n),{data:n,error:o})})}catch(e){if(eQ(e))return{data:null,error:e};throw e}}async _challenge(e){try{return await this._useSession(async t=>{var r;let{data:s,error:i}=t;return i?{data:null,error:i}:await tn(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{headers:this.headers,jwt:null===(r=null==s?void 0:s.session)||void 0===r?void 0:r.access_token})})}catch(e){if(eQ(e))return{data:null,error:e};throw e}}async _challengeAndVerify(e){let{data:t,error:r}=await this._challenge({factorId:e.factorId});return r?{data:null,error:r}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){let{data:{user:e},error:t}=await this._getUser();if(t)return{data:null,error:t};let r=(null==e?void 0:e.factors)||[],s=r.filter(e=>"totp"===e.factor_type&&"verified"===e.status);return{data:{all:r,totp:s},error:null}}async _getAuthenticatorAssuranceLevel(){return await this._useSession(async e=>{var t,r;let{data:{session:s},error:i}=e;if(i)return{data:null,error:i};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let n=this._decodeJWT(s.access_token),o=null;n.aal&&(o=n.aal);let a=o,l=null!==(r=null===(t=s.user.factors)||void 0===t?void 0:t.filter(e=>"verified"===e.status))&&void 0!==r?r:[];l.length>0&&(a="aal2");let h=n.amr||[];return{data:{currentLevel:o,nextLevel:a,currentAuthenticationMethods:h},error:null}})}}t_.nextInstanceID=0;class tw extends t_{constructor(e){super(e)}}let tk={headers:{"X-Client-Info":"supabase-js/2.33.1"}},tS={schema:"public"},tO={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},tT={};class tE{constructor(e,t,r){var s,i,n,o,a,l,h,c;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw Error("supabaseUrl is required.");if(!t)throw Error("supabaseKey is required.");let u=e.replace(/\/$/,"");this.realtimeUrl=`${u}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${u}/auth/v1`,this.storageUrl=`${u}/storage/v1`,this.functionsUrl=`${u}/functions/v1`;let d=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,f={db:tS,realtime:tT,auth:Object.assign(Object.assign({},tO),{storageKey:d}),global:tk},p=function(e,t){let{db:r,auth:s,realtime:i,global:n}=e,{db:o,auth:a,realtime:l,global:h}=t;return{db:Object.assign(Object.assign({},o),r),auth:Object.assign(Object.assign({},a),s),realtime:Object.assign(Object.assign({},l),i),global:Object.assign(Object.assign({},h),n)}}(null!=r?r:{},f);this.storageKey=null!==(i=null===(s=p.auth)||void 0===s?void 0:s.storageKey)&&void 0!==i?i:"",this.headers=null!==(o=null===(n=p.global)||void 0===n?void 0:n.headers)&&void 0!==o?o:{},this.auth=this._initSupabaseAuthClient(null!==(a=p.auth)&&void 0!==a?a:{},this.headers,null===(l=p.global)||void 0===l?void 0:l.fetch),this.fetch=eU(t,this._getAccessToken.bind(this),null===(h=p.global)||void 0===h?void 0:h.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},p.realtime)),this.rest=new F(`${u}/rest/v1`,{headers:this.headers,schema:null===(c=p.db)||void 0===c?void 0:c.schema,fetch:this.fetch}),this._listenForAuthEvents()}get functions(){return new $(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new ex(this.storageUrl,this.headers,this.fetch)}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r){return this.rest.rpc(e,t,r)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,t,r,s,i,n;return r=this,s=void 0,i=void 0,n=function*(){let{data:r}=yield this.auth.getSession();return null!==(t=null===(e=r.session)||void 0===e?void 0:e.access_token)&&void 0!==t?t:null},new(i||(i=Promise))(function(e,t){function o(e){try{l(n.next(e))}catch(e){t(e)}}function a(e){try{l(n.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof i?r:new i(function(e){e(r)})).then(o,a)}l((n=n.apply(r,s||[])).next())})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:s,storageKey:i,flowType:n,debug:o},a,l){let h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new tw({url:this.authUrl,headers:Object.assign(Object.assign({},h),a),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:s,flowType:n,debug:o,fetch:l})}_initRealtimeClient(e){return new ea(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,r){("TOKEN_REFRESHED"===e||"SIGNED_IN"===e)&&this.changedAccessToken!==r?(this.realtime.setAuth(null!=r?r:null),this.changedAccessToken=r):"SIGNED_OUT"===e&&(this.realtime.setAuth(this.supabaseKey),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0)}}let tC=(e,t,r)=>new tE(e,t,r);var tj=Object.create,tI=Object.defineProperty,tx=Object.getOwnPropertyDescriptor,tA=Object.getOwnPropertyNames,tP=Object.getPrototypeOf,t$=Object.prototype.hasOwnProperty,tR=(e,t,r,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of tA(t))t$.call(e,i)||i===r||tI(e,i,{get:()=>t[i],enumerable:!(s=tx(t,i))||s.enumerable});return e},tU=(e,t,r)=>(r=null!=e?tj(tP(e)):{},tR(!t&&e&&e.__esModule?r:tI(r,"default",{value:e,enumerable:!0}),e)),tL=(p={"../../node_modules/.pnpm/cookie@0.5.0/node_modules/cookie/index.js"(e){e.parse=function(e,t){if("string"!=typeof e)throw TypeError("argument str must be a string");for(var r={},i=(t||{}).decode||s,n=0;n<e.length;){var o=e.indexOf("=",n);if(-1===o)break;var a=e.indexOf(";",n);if(-1===a)a=e.length;else if(a<o){n=e.lastIndexOf(";",o-1)+1;continue}var l=e.slice(n,o).trim();if(void 0===r[l]){var h=e.slice(o+1,a).trim();34===h.charCodeAt(0)&&(h=h.slice(1,-1)),r[l]=function(e,t){try{return t(e)}catch(t){return e}}(h,i)}n=a+1}return r},e.serialize=function(e,s,n){var o=n||{},a=o.encode||i;if("function"!=typeof a)throw TypeError("option encode is invalid");if(!r.test(e))throw TypeError("argument name is invalid");var l=a(s);if(l&&!r.test(l))throw TypeError("argument val is invalid");var h=e+"="+l;if(null!=o.maxAge){var c=o.maxAge-0;if(isNaN(c)||!isFinite(c))throw TypeError("option maxAge is invalid");h+="; Max-Age="+Math.floor(c)}if(o.domain){if(!r.test(o.domain))throw TypeError("option domain is invalid");h+="; Domain="+o.domain}if(o.path){if(!r.test(o.path))throw TypeError("option path is invalid");h+="; Path="+o.path}if(o.expires){var u=o.expires;if("[object Date]"!==t.call(u)&&!(u instanceof Date)||isNaN(u.valueOf()))throw TypeError("option expires is invalid");h+="; Expires="+u.toUTCString()}if(o.httpOnly&&(h+="; HttpOnly"),o.secure&&(h+="; Secure"),o.priority)switch("string"==typeof o.priority?o.priority.toLowerCase():o.priority){case"low":h+="; Priority=Low";break;case"medium":h+="; Priority=Medium";break;case"high":h+="; Priority=High";break;default:throw TypeError("option priority is invalid")}if(o.sameSite)switch("string"==typeof o.sameSite?o.sameSite.toLowerCase():o.sameSite){case!0:case"strict":h+="; SameSite=Strict";break;case"lax":h+="; SameSite=Lax";break;case"none":h+="; SameSite=None";break;default:throw TypeError("option sameSite is invalid")}return h};var t=Object.prototype.toString,r=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function s(e){return -1!==e.indexOf("%")?decodeURIComponent(e):e}function i(e){return encodeURIComponent(e)}}},function(){return y||(0,p[tA(p)[0]])((y={exports:{}}).exports,y),y.exports}),tN=tU(tL()),tD=tU(tL());function tJ(e){if(!e)return null;try{let t=JSON.parse(e);if(!t)return null;if("Object"===t.constructor.name)return t;if("Array"!==t.constructor.name)throw Error(`Unexpected format: ${t.constructor.name}`);let[r,s,i]=t[0].split("."),n=C(s),o=new TextDecoder,{exp:a,sub:l,...h}=JSON.parse(o.decode(n));return{expires_at:a,expires_in:a-Math.round(Date.now()/1e3),token_type:"bearer",access_token:t[0],refresh_token:t[1],provider_token:t[2],provider_refresh_token:t[3],user:{id:l,factors:t[4],...h}}}catch(e){return console.warn("Failed to parse cookie string:",e),null}}function tB(e){var t;return JSON.stringify([e.access_token,e.refresh_token,e.provider_token,e.provider_refresh_token,(null==(t=e.user)?void 0:t.factors)??null])}function tF(){return"undefined"!=typeof window&&void 0!==window.document}var tM={path:"/",maxAge:31536e6},tz=class{constructor(e){this.cookieOptions={...tM,...e}}getItem(e){let t=this.getCookie(e);return t?e.endsWith("-code-verifier")?t:JSON.stringify(tJ(t)):null}setItem(e,t){if(e.endsWith("-code-verifier")){this.setCookie(e,t);return}let r=JSON.parse(t),s=tB(r);this.setCookie(e,s)}removeItem(e){this.deleteCookie(e)}},tq=class extends tz{constructor(e){super(e)}getCookie(e){if(!tF())return null;let t=(0,tN.parse)(document.cookie);return t[e]}setCookie(e,t){if(!tF())return null;document.cookie=(0,tN.serialize)(e,t,{...this.cookieOptions,httpOnly:!1})}deleteCookie(e){if(!tF())return null;document.cookie=(0,tN.serialize)(e,"",{...this.cookieOptions,maxAge:0,httpOnly:!1})}};function tK(e,t,r){var s;let i=tF();return tC(e,t,{...r,auth:{flowType:"pkce",autoRefreshToken:i,detectSessionInUrl:i,persistSession:!0,storage:r.auth.storage,...(null==(s=r.auth)?void 0:s.storageKey)?{storageKey:r.auth.storageKey}:{}}})}var tH=tD.parse,tX=tD.serialize;/*!
3
+ * cookie
4
+ * Copyright(c) 2012-2014 Roman Shtylman
5
+ * Copyright(c) 2015 Douglas Christopher Wilson
6
+ * MIT Licensed
7
+ */},2151:function(e){"use strict";e.exports={version:"1.0.34"}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[72],{7820:function(e,t,r){var o=r(2265);let n=o.createContext({});t.Z=n},3375:function(e,t,r){r.d(t,{Z:function(){return ei}});var o=r(3428),n=r(791),i=r(2265);r(9176);var l=r(7042),a=r(5600),s=r(7282),u=r(3931),p=r(5843),c=r(7927),d=r(7820),f=r(6520),h=r(5702);function m(e){return(0,h.Z)("MuiList",e)}(0,f.Z)("MuiList",["root","padding","dense","subheader"]);var v=r(7437);let Z=["children","className","component","dense","disablePadding","subheader"],g=e=>{let{classes:t,disablePadding:r,dense:o,subheader:n}=e;return(0,a.Z)({root:["root",!r&&"padding",o&&"dense",n&&"subheader"]},m,t)},b=(0,p.ZP)("ul",{name:"MuiList",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,!r.disablePadding&&t.padding,r.dense&&t.dense,r.subheader&&t.subheader]}})(({ownerState:e})=>(0,o.Z)({listStyle:"none",margin:0,padding:0,position:"relative"},!e.disablePadding&&{paddingTop:8,paddingBottom:8},e.subheader&&{paddingTop:0})),y=i.forwardRef(function(e,t){let r=(0,c.Z)({props:e,name:"MuiList"}),{children:a,className:s,component:u="ul",dense:p=!1,disablePadding:f=!1,subheader:h}=r,m=(0,n.Z)(r,Z),y=i.useMemo(()=>({dense:p}),[p]),P=(0,o.Z)({},r,{component:u,dense:p,disablePadding:f}),x=g(P);return(0,v.jsx)(d.Z.Provider,{value:y,children:(0,v.jsxs)(b,(0,o.Z)({as:u,className:(0,l.Z)(x.root,s),ref:t,ownerState:P},m,{children:[h,a]}))})});var P=r(878).Z,x=r(7663),S=r(8519);let M=["actions","autoFocus","autoFocusItem","children","className","disabledItemsFocusable","disableListWrap","onKeyDown","variant"];function w(e,t,r){return e===t?e.firstChild:t&&t.nextElementSibling?t.nextElementSibling:r?null:e.firstChild}function C(e,t,r){return e===t?r?e.firstChild:e.lastChild:t&&t.previousElementSibling?t.previousElementSibling:r?null:e.lastChild}function E(e,t){if(void 0===t)return!0;let r=e.innerText;return void 0===r&&(r=e.textContent),0!==(r=r.trim().toLowerCase()).length&&(t.repeating?r[0]===t.keys[0]:0===r.indexOf(t.keys.join("")))}function k(e,t,r,o,n,i){let l=!1,a=n(e,t,!!t&&r);for(;a;){if(a===e.firstChild){if(l)return!1;l=!0}let t=!o&&(a.disabled||"true"===a.getAttribute("aria-disabled"));if(a.hasAttribute("tabindex")&&E(a,i)&&!t)return a.focus(),!0;a=n(e,a,r)}return!1}let T=i.forwardRef(function(e,t){let{actions:r,autoFocus:l=!1,autoFocusItem:a=!1,children:s,className:p,disabledItemsFocusable:c=!1,disableListWrap:d=!1,onKeyDown:f,variant:h="selectedMenu"}=e,m=(0,n.Z)(e,M),Z=i.useRef(null),g=i.useRef({keys:[],repeating:!0,previousKeyMatched:!0,lastTime:null});(0,S.Z)(()=>{l&&Z.current.focus()},[l]),i.useImperativeHandle(r,()=>({adjustStyleForScrollbar:(e,t)=>{let r=!Z.current.style.width;if(e.clientHeight<Z.current.clientHeight&&r){let r=`${P((0,u.Z)(e))}px`;Z.current.style["rtl"===t.direction?"paddingLeft":"paddingRight"]=r,Z.current.style.width=`calc(100% + ${r})`}return Z.current}}),[]);let b=(0,x.Z)(Z,t),T=-1;i.Children.forEach(s,(e,t)=>{if(!i.isValidElement(e)){T===t&&(T+=1)>=s.length&&(T=-1);return}e.props.disabled||("selectedMenu"===h&&e.props.selected?T=t:-1!==T||(T=t)),T===t&&(e.props.disabled||e.props.muiSkipListHighlight||e.type.muiSkipListHighlight)&&(T+=1)>=s.length&&(T=-1)});let R=i.Children.map(s,(e,t)=>{if(t===T){let t={};return a&&(t.autoFocus=!0),void 0===e.props.tabIndex&&"selectedMenu"===h&&(t.tabIndex=0),i.cloneElement(e,t)}return e});return(0,v.jsx)(y,(0,o.Z)({role:"menu",ref:b,className:p,onKeyDown:e=>{let t=Z.current,r=e.key,o=(0,u.Z)(t).activeElement;if("ArrowDown"===r)e.preventDefault(),k(t,o,d,c,w);else if("ArrowUp"===r)e.preventDefault(),k(t,o,d,c,C);else if("Home"===r)e.preventDefault(),k(t,null,d,c,w);else if("End"===r)e.preventDefault(),k(t,null,d,c,C);else if(1===r.length){let n=g.current,i=r.toLowerCase(),l=performance.now();n.keys.length>0&&(l-n.lastTime>500?(n.keys=[],n.repeating=!0,n.previousKeyMatched=!0):n.repeating&&i!==n.keys[0]&&(n.repeating=!1)),n.lastTime=l,n.keys.push(i);let a=o&&!n.repeating&&E(o,n);n.previousKeyMatched&&(a||k(t,o,!1,c,w,n))?e.preventDefault():n.previousKeyMatched=!1}f&&f(e)},tabIndex:l?0:-1},m,{children:R}))});var R=r(3655),z=r(494),D=r(6649),N=r(6176),L=r(1376),F=r(9872);function j(e){return(0,h.Z)("MuiPopover",e)}(0,f.Z)("MuiPopover",["root","paper"]);let H=["onEntering"],O=["action","anchorEl","anchorOrigin","anchorPosition","anchorReference","children","className","container","elevation","marginThreshold","open","PaperProps","slots","slotProps","transformOrigin","TransitionComponent","transitionDuration","TransitionProps"],I=["slotProps"];function K(e,t){let r=0;return"number"==typeof t?r=t:"center"===t?r=e.height/2:"bottom"===t&&(r=e.height),r}function _(e,t){let r=0;return"number"==typeof t?r=t:"center"===t?r=e.width/2:"right"===t&&(r=e.width),r}function A(e){return[e.horizontal,e.vertical].map(e=>"number"==typeof e?`${e}px`:e).join(" ")}function W(e){return"function"==typeof e?e():e}let $=e=>{let{classes:t}=e;return(0,a.Z)({root:["root"],paper:["paper"]},j,t)},V=(0,p.ZP)(L.Z,{name:"MuiPopover",slot:"Root",overridesResolver:(e,t)=>t.root})({}),B=(0,p.ZP)(F.Z,{name:"MuiPopover",slot:"Paper",overridesResolver:(e,t)=>t.paper})({position:"absolute",overflowY:"auto",overflowX:"hidden",minWidth:16,minHeight:16,maxWidth:"calc(100% - 32px)",maxHeight:"calc(100% - 32px)",outline:0}),X=i.forwardRef(function(e,t){var r,a,p;let d=(0,c.Z)({props:e,name:"MuiPopover"}),{action:f,anchorEl:h,anchorOrigin:m={vertical:"top",horizontal:"left"},anchorPosition:Z,anchorReference:g="anchorEl",children:b,className:y,container:P,elevation:S=8,marginThreshold:M=16,open:w,PaperProps:C={},slots:E,slotProps:k,transformOrigin:T={vertical:"top",horizontal:"left"},TransitionComponent:L=N.Z,transitionDuration:F="auto",TransitionProps:{onEntering:j}={}}=d,X=(0,n.Z)(d.TransitionProps,H),U=(0,n.Z)(d,O),Y=null!=(r=null==k?void 0:k.paper)?r:C,q=i.useRef(),G=(0,x.Z)(q,Y.ref),J=(0,o.Z)({},d,{anchorOrigin:m,anchorReference:g,elevation:S,marginThreshold:M,externalPaperSlotProps:Y,transformOrigin:T,TransitionComponent:L,transitionDuration:F,TransitionProps:X}),Q=$(J),ee=i.useCallback(()=>{if("anchorPosition"===g)return Z;let e=W(h),t=e&&1===e.nodeType?e:(0,u.Z)(q.current).body,r=t.getBoundingClientRect();return{top:r.top+K(r,m.vertical),left:r.left+_(r,m.horizontal)}},[h,m.horizontal,m.vertical,Z,g]),et=i.useCallback(e=>({vertical:K(e,T.vertical),horizontal:_(e,T.horizontal)}),[T.horizontal,T.vertical]),er=i.useCallback(e=>{let t={width:e.offsetWidth,height:e.offsetHeight},r=et(t);if("none"===g)return{top:null,left:null,transformOrigin:A(r)};let o=ee(),n=o.top-r.vertical,i=o.left-r.horizontal,l=n+t.height,a=i+t.width,s=(0,D.Z)(W(h)),u=s.innerHeight-M,p=s.innerWidth-M;if(n<M){let e=n-M;n-=e,r.vertical+=e}else if(l>u){let e=l-u;n-=e,r.vertical+=e}if(i<M){let e=i-M;i-=e,r.horizontal+=e}else if(a>p){let e=a-p;i-=e,r.horizontal+=e}return{top:`${Math.round(n)}px`,left:`${Math.round(i)}px`,transformOrigin:A(r)}},[h,g,ee,et,M]),[eo,en]=i.useState(w),ei=i.useCallback(()=>{let e=q.current;if(!e)return;let t=er(e);null!==t.top&&(e.style.top=t.top),null!==t.left&&(e.style.left=t.left),e.style.transformOrigin=t.transformOrigin,en(!0)},[er]);i.useEffect(()=>{w&&ei()}),i.useImperativeHandle(f,()=>w?{updatePosition:()=>{ei()}}:null,[w,ei]),i.useEffect(()=>{if(!w)return;let e=(0,z.Z)(()=>{ei()}),t=(0,D.Z)(h);return t.addEventListener("resize",e),()=>{e.clear(),t.removeEventListener("resize",e)}},[h,w,ei]);let el=F;"auto"!==F||L.muiSupportAuto||(el=void 0);let ea=P||(h?(0,u.Z)(W(h)).body:void 0),es=null!=(a=null==E?void 0:E.root)?a:V,eu=null!=(p=null==E?void 0:E.paper)?p:B,ep=(0,s.y)({elementType:eu,externalSlotProps:(0,o.Z)({},Y,{style:eo?Y.style:(0,o.Z)({},Y.style,{opacity:0})}),additionalProps:{elevation:S,ref:G},ownerState:J,className:(0,l.Z)(Q.paper,null==Y?void 0:Y.className)}),ec=(0,s.y)({elementType:es,externalSlotProps:(null==k?void 0:k.root)||{},externalForwardedProps:U,additionalProps:{ref:t,slotProps:{backdrop:{invisible:!0}},container:ea,open:w},ownerState:J,className:(0,l.Z)(Q.root,y)}),{slotProps:ed}=ec,ef=(0,n.Z)(ec,I);return(0,v.jsx)(es,(0,o.Z)({},ef,!(0,R.X)(es)&&{slotProps:ed},{children:(0,v.jsx)(L,(0,o.Z)({appear:!0,in:w,onEntering:(e,t)=>{j&&j(e,t),ei()},onExited:()=>{en(!1)},timeout:el},X,{children:(0,v.jsx)(eu,(0,o.Z)({},ep,{children:b}))}))}))});var U=r(1101);function Y(e){return(0,h.Z)("MuiMenu",e)}(0,f.Z)("MuiMenu",["root","paper","list"]);let q=["onEntering"],G=["autoFocus","children","className","disableAutoFocusItem","MenuListProps","onClose","open","PaperProps","PopoverClasses","transitionDuration","TransitionProps","variant","slots","slotProps"],J={vertical:"top",horizontal:"right"},Q={vertical:"top",horizontal:"left"},ee=e=>{let{classes:t}=e;return(0,a.Z)({root:["root"],paper:["paper"],list:["list"]},Y,t)},et=(0,p.ZP)(X,{shouldForwardProp:e=>(0,p.FO)(e)||"classes"===e,name:"MuiMenu",slot:"Root",overridesResolver:(e,t)=>t.root})({}),er=(0,p.ZP)(B,{name:"MuiMenu",slot:"Paper",overridesResolver:(e,t)=>t.paper})({maxHeight:"calc(100% - 96px)",WebkitOverflowScrolling:"touch"}),eo=(0,p.ZP)(T,{name:"MuiMenu",slot:"List",overridesResolver:(e,t)=>t.list})({outline:0}),en=i.forwardRef(function(e,t){var r,a;let u=(0,c.Z)({props:e,name:"MuiMenu"}),{autoFocus:p=!0,children:d,className:f,disableAutoFocusItem:h=!1,MenuListProps:m={},onClose:Z,open:g,PaperProps:b={},PopoverClasses:y,transitionDuration:P="auto",TransitionProps:{onEntering:x}={},variant:S="selectedMenu",slots:M={},slotProps:w={}}=u,C=(0,n.Z)(u.TransitionProps,q),E=(0,n.Z)(u,G),k=(0,U.Z)(),T="rtl"===k.direction,R=(0,o.Z)({},u,{autoFocus:p,disableAutoFocusItem:h,MenuListProps:m,onEntering:x,PaperProps:b,transitionDuration:P,TransitionProps:C,variant:S}),z=ee(R),D=p&&!h&&g,N=i.useRef(null),L=-1;i.Children.map(d,(e,t)=>{i.isValidElement(e)&&(e.props.disabled||("selectedMenu"===S&&e.props.selected?L=t:-1!==L||(L=t)))});let F=null!=(r=M.paper)?r:er,j=null!=(a=w.paper)?a:b,H=(0,s.y)({elementType:M.root,externalSlotProps:w.root,ownerState:R,className:[z.root,f]}),O=(0,s.y)({elementType:F,externalSlotProps:j,ownerState:R,className:z.paper});return(0,v.jsx)(et,(0,o.Z)({onClose:Z,anchorOrigin:{vertical:"bottom",horizontal:T?"right":"left"},transformOrigin:T?J:Q,slots:{paper:F,root:M.root},slotProps:{root:H,paper:O},open:g,ref:t,transitionDuration:P,TransitionProps:(0,o.Z)({onEntering:(e,t)=>{N.current&&N.current.adjustStyleForScrollbar(e,k),x&&x(e,t)}},C),ownerState:R},E,{classes:y,children:(0,v.jsx)(eo,(0,o.Z)({onKeyDown:e=>{"Tab"===e.key&&(e.preventDefault(),Z&&Z(e,"tabKeyDown"))},actions:N,autoFocus:p&&(-1===L||h),autoFocusItem:D,variant:S},m,{className:(0,l.Z)(z.list,m.className),children:d}))}))});var ei=en},494:function(e,t,r){var o=r(8078);t.Z=o.Z},673:function(e,t,r){r.d(t,{Z:function(){return n}});var o=r(2265),n=function(e,t){return o.isValidElement(e)&&-1!==t.indexOf(e.type.muiName)}},3931:function(e,t,r){var o=r(6278);t.Z=o.Z},6649:function(e,t,r){var o=r(8221);t.Z=o.Z},8519:function(e,t,r){var o=r(1091);t.Z=o.Z},8236:function(e,t){Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.server_context"),Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.suspense_list"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.for("react.offscreen"),Symbol.for("react.module.reference")},9176:function(e,t,r){r(8236)}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[840],{7580:function(e){var t,r,n,o=e.exports={};function i(){throw Error("setTimeout has not been defined")}function a(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var u=[],s=!1,c=-1;function d(){s&&n&&(s=!1,n.length?u=n.concat(u):c=-1,u.length&&f())}function f(){if(!s){var e=l(d);s=!0;for(var t=u.length;t;){for(n=u,u=[];++c<t;)n&&n[c].run();c=-1,t=u.length}n=null,s=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new p(e,t)),1!==u.length||s||l(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw Error("process.chdir is not supported")},o.umask=function(){return 0}},9864:function(e,t,r){"use strict";var n=r(6314);t.Z=void 0;var o=n(r(984)),i=r(7437),a=(0,o.default)((0,i.jsx)("path",{d:"M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1z"}),"DarkMode");t.Z=a},7028:function(e,t,r){"use strict";var n=r(6314);t.Z=void 0;var o=n(r(984)),i=r(7437),a=(0,o.default)((0,i.jsx)("path",{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"}),"LightMode");t.Z=a},984:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n.createSvgIcon}});var n=r(3135)},3283:function(e,t,r){"use strict";r.d(t,{Z:function(){return x}});var n=r(791),o=r(3428),i=r(2265),a=r(7042),l=r(5600),u=r(5843),s=r(7927),c=r(9782),d=r(7437),f=(0,c.Z)((0,d.jsx)("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"}),"Person"),p=r(6520),m=r(5702);function g(e){return(0,m.Z)("MuiAvatar",e)}(0,p.Z)("MuiAvatar",["root","colorDefault","circular","rounded","square","img","fallback"]);let h=["alt","children","className","component","imgProps","sizes","src","srcSet","variant"],v=e=>{let{classes:t,variant:r,colorDefault:n}=e;return(0,l.Z)({root:["root",r,n&&"colorDefault"],img:["img"],fallback:["fallback"]},g,t)},b=(0,u.ZP)("div",{name:"MuiAvatar",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,t[r.variant],r.colorDefault&&t.colorDefault]}})(({theme:e,ownerState:t})=>(0,o.Z)({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,width:40,height:40,fontFamily:e.typography.fontFamily,fontSize:e.typography.pxToRem(20),lineHeight:1,borderRadius:"50%",overflow:"hidden",userSelect:"none"},"rounded"===t.variant&&{borderRadius:(e.vars||e).shape.borderRadius},"square"===t.variant&&{borderRadius:0},t.colorDefault&&(0,o.Z)({color:(e.vars||e).palette.background.default},e.vars?{backgroundColor:e.vars.palette.Avatar.defaultBg}:{backgroundColor:"light"===e.palette.mode?e.palette.grey[400]:e.palette.grey[600]}))),y=(0,u.ZP)("img",{name:"MuiAvatar",slot:"Img",overridesResolver:(e,t)=>t.img})({width:"100%",height:"100%",textAlign:"center",objectFit:"cover",color:"transparent",textIndent:1e4}),Z=(0,u.ZP)(f,{name:"MuiAvatar",slot:"Fallback",overridesResolver:(e,t)=>t.fallback})({width:"75%",height:"75%"}),w=i.forwardRef(function(e,t){let r=(0,s.Z)({props:e,name:"MuiAvatar"}),{alt:l,children:u,className:c,component:f="div",imgProps:p,sizes:m,src:g,srcSet:w,variant:x="circular"}=r,_=(0,n.Z)(r,h),S=null,C=function({crossOrigin:e,referrerPolicy:t,src:r,srcSet:n}){let[o,a]=i.useState(!1);return i.useEffect(()=>{if(!r&&!n)return;a(!1);let o=!0,i=new Image;return i.onload=()=>{o&&a("loaded")},i.onerror=()=>{o&&a("error")},i.crossOrigin=e,i.referrerPolicy=t,i.src=r,n&&(i.srcset=n),()=>{o=!1}},[e,t,r,n]),o}((0,o.Z)({},p,{src:g,srcSet:w})),M=g||w,k=M&&"error"!==C,P=(0,o.Z)({},r,{colorDefault:!k,component:f,variant:x}),j=v(P);return S=k?(0,d.jsx)(y,(0,o.Z)({alt:l,src:g,srcSet:w,sizes:m,ownerState:P,className:j.img},p)):null!=u?u:M&&l?l[0]:(0,d.jsx)(Z,{ownerState:P,className:j.fallback}),(0,d.jsx)(b,(0,o.Z)({as:f,ownerState:P,className:(0,a.Z)(j.root,c),ref:t},_,{children:S}))});var x=w},6507:function(e,t,r){"use strict";r.d(t,{Z:function(){return b}});var n=r(3428),o=r(791),i=r(2265),a=r(7042),l=r(9613),u=r(7947),s=r(3381),c=r(5270),d=r(7437);let f=["className","component"];var p=r(5097),m=r(606),g=r(3469);let h=(0,m.Z)(),v=function(e={}){let{themeId:t,defaultTheme:r,defaultClassName:p="MuiBox-root",generateClassName:m}=e,g=(0,l.ZP)("div",{shouldForwardProp:e=>"theme"!==e&&"sx"!==e&&"as"!==e})(u.Z),h=i.forwardRef(function(e,i){let l=(0,c.Z)(r),u=(0,s.Z)(e),{className:h,component:v="div"}=u,b=(0,o.Z)(u,f);return(0,d.jsx)(g,(0,n.Z)({as:v,ref:i,className:(0,a.Z)(h,m?m(p):p),theme:t&&l[t]||l},b))});return h}({themeId:g.Z,defaultTheme:h,defaultClassName:"MuiBox-root",generateClassName:p.Z.generate});var b=v},2653:function(e,t,r){"use strict";r.d(t,{Z:function(){return x}});var n=r(791),o=r(3428),i=r(2265),a=r(7042),l=r(5600),u=r(9975),s=r(5843),c=r(7927),d=r(6659),f=r(8702),p=r(6520),m=r(5702);function g(e){return(0,m.Z)("MuiIconButton",e)}let h=(0,p.Z)("MuiIconButton",["root","disabled","colorInherit","colorPrimary","colorSecondary","colorError","colorInfo","colorSuccess","colorWarning","edgeStart","edgeEnd","sizeSmall","sizeMedium","sizeLarge"]);var v=r(7437);let b=["edge","children","className","color","disabled","disableFocusRipple","size"],y=e=>{let{classes:t,disabled:r,color:n,edge:o,size:i}=e,a={root:["root",r&&"disabled","default"!==n&&`color${(0,f.Z)(n)}`,o&&`edge${(0,f.Z)(o)}`,`size${(0,f.Z)(i)}`]};return(0,l.Z)(a,g,t)},Z=(0,s.ZP)(d.Z,{name:"MuiIconButton",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,"default"!==r.color&&t[`color${(0,f.Z)(r.color)}`],r.edge&&t[`edge${(0,f.Z)(r.edge)}`],t[`size${(0,f.Z)(r.size)}`]]}})(({theme:e,ownerState:t})=>(0,o.Z)({textAlign:"center",flex:"0 0 auto",fontSize:e.typography.pxToRem(24),padding:8,borderRadius:"50%",overflow:"visible",color:(e.vars||e).palette.action.active,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shortest})},!t.disableRipple&&{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,u.Fq)(e.palette.action.active,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},"start"===t.edge&&{marginLeft:"small"===t.size?-3:-12},"end"===t.edge&&{marginRight:"small"===t.size?-3:-12}),({theme:e,ownerState:t})=>{var r;let n=null==(r=(e.vars||e).palette)?void 0:r[t.color];return(0,o.Z)({},"inherit"===t.color&&{color:"inherit"},"inherit"!==t.color&&"default"!==t.color&&(0,o.Z)({color:null==n?void 0:n.main},!t.disableRipple&&{"&:hover":(0,o.Z)({},n&&{backgroundColor:e.vars?`rgba(${n.mainChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,u.Fq)(n.main,e.palette.action.hoverOpacity)},{"@media (hover: none)":{backgroundColor:"transparent"}})}),"small"===t.size&&{padding:5,fontSize:e.typography.pxToRem(18)},"large"===t.size&&{padding:12,fontSize:e.typography.pxToRem(28)},{[`&.${h.disabled}`]:{backgroundColor:"transparent",color:(e.vars||e).palette.action.disabled}})}),w=i.forwardRef(function(e,t){let r=(0,c.Z)({props:e,name:"MuiIconButton"}),{edge:i=!1,children:l,className:u,color:s="default",disabled:d=!1,disableFocusRipple:f=!1,size:p="medium"}=r,m=(0,n.Z)(r,b),g=(0,o.Z)({},r,{edge:i,color:s,disabled:d,disableFocusRipple:f,size:p}),h=y(g);return(0,v.jsx)(Z,(0,o.Z)({className:(0,a.Z)(h.root,u),centerRipple:!0,focusRipple:!f,disabled:d,ref:t,ownerState:g},m,{children:l}))});var x=w},9660:function(e,t,r){"use strict";r.d(t,{L:function(){return i}});var n=r(6520),o=r(5702);function i(e){return(0,o.Z)("MuiListItemText",e)}let a=(0,n.Z)("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]);t.Z=a},5507:function(e,t,r){"use strict";r.d(t,{Z:function(){return k}});var n=r(791),o=r(3428),i=r(2265),a=r(7042),l=r(5600),u=r(9975),s=r(5843),c=r(7927),d=r(7820),f=r(6659),p=r(8519),m=r(7663),g=r(6520);let h=(0,g.Z)("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]),v=(0,g.Z)("MuiListItemIcon",["root","alignItemsFlexStart"]);var b=r(9660),y=r(5702);function Z(e){return(0,y.Z)("MuiMenuItem",e)}let w=(0,g.Z)("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]);var x=r(7437);let _=["autoFocus","component","dense","divider","disableGutters","focusVisibleClassName","role","tabIndex","className"],S=e=>{let{disabled:t,dense:r,divider:n,disableGutters:i,selected:a,classes:u}=e,s=(0,l.Z)({root:["root",r&&"dense",t&&"disabled",!i&&"gutters",n&&"divider",a&&"selected"]},Z,u);return(0,o.Z)({},u,s)},C=(0,s.ZP)(f.Z,{shouldForwardProp:e=>(0,s.FO)(e)||"classes"===e,name:"MuiMenuItem",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,r.dense&&t.dense,r.divider&&t.divider,!r.disableGutters&&t.gutters]}})(({theme:e,ownerState:t})=>(0,o.Z)({},e.typography.body1,{display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:"border-box",whiteSpace:"nowrap"},!t.disableGutters&&{paddingLeft:16,paddingRight:16},t.divider&&{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"},{"&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${w.selected}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,u.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity),[`&.${w.focusVisible}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:(0,u.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},[`&.${w.selected}:hover`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:(0,u.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,u.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity)}},[`&.${w.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${w.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${h.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${h.inset}`]:{marginLeft:52},[`& .${b.Z.root}`]:{marginTop:0,marginBottom:0},[`& .${b.Z.inset}`]:{paddingLeft:36},[`& .${v.root}`]:{minWidth:36}},!t.dense&&{[e.breakpoints.up("sm")]:{minHeight:"auto"}},t.dense&&(0,o.Z)({minHeight:32,paddingTop:4,paddingBottom:4},e.typography.body2,{[`& .${v.root} svg`]:{fontSize:"1.25rem"}}))),M=i.forwardRef(function(e,t){let r;let l=(0,c.Z)({props:e,name:"MuiMenuItem"}),{autoFocus:u=!1,component:s="li",dense:f=!1,divider:g=!1,disableGutters:h=!1,focusVisibleClassName:v,role:b="menuitem",tabIndex:y,className:Z}=l,w=(0,n.Z)(l,_),M=i.useContext(d.Z),k=i.useMemo(()=>({dense:f||M.dense||!1,disableGutters:h}),[M.dense,f,h]),P=i.useRef(null);(0,p.Z)(()=>{u&&P.current&&P.current.focus()},[u]);let j=(0,o.Z)({},l,{dense:k.dense,divider:g,disableGutters:h}),O=S(l),z=(0,m.Z)(P,t);return l.disabled||(r=void 0!==y?y:-1),(0,x.jsx)(d.Z.Provider,{value:k,children:(0,x.jsx)(C,(0,o.Z)({ref:z,role:b,tabIndex:r,component:s,focusVisibleClassName:(0,a.Z)(O.focusVisible,v),className:(0,a.Z)(O.root,Z)},w,{ownerState:j,classes:O}))})});var k=M},3457:function(e,t,r){"use strict";r.d(t,{Z:function(){return M}});var n=r(791),o=r(3428),i=r(2265),a=r(7042),l=r(5959),u=r(5600),s=r(5702),c=r(9190),d=r(8153),f=r(3381),p=r(4775),m=r(5425),g=r(7508),h=r(7437);let v=["component","direction","spacing","divider","children","className","useFlexGap"],b=(0,p.Z)(),y=(0,c.Z)("div",{name:"MuiStack",slot:"Root",overridesResolver:(e,t)=>t.root});function Z(e){return(0,d.Z)({props:e,name:"MuiStack",defaultTheme:b})}let w=e=>({row:"Left","row-reverse":"Right",column:"Top","column-reverse":"Bottom"})[e],x=({ownerState:e,theme:t})=>{let r=(0,o.Z)({display:"flex",flexDirection:"column"},(0,m.k9)({theme:t},(0,m.P$)({values:e.direction,breakpoints:t.breakpoints.values}),e=>({flexDirection:e})));if(e.spacing){let n=(0,g.hB)(t),o=Object.keys(t.breakpoints.values).reduce((t,r)=>(("object"==typeof e.spacing&&null!=e.spacing[r]||"object"==typeof e.direction&&null!=e.direction[r])&&(t[r]=!0),t),{}),i=(0,m.P$)({values:e.direction,base:o}),a=(0,m.P$)({values:e.spacing,base:o});"object"==typeof i&&Object.keys(i).forEach((e,t,r)=>{let n=i[e];if(!n){let n=t>0?i[r[t-1]]:"column";i[e]=n}}),r=(0,l.Z)(r,(0,m.k9)({theme:t},a,(t,r)=>e.useFlexGap?{gap:(0,g.NA)(n,t)}:{"& > :not(style):not(style)":{margin:0},"& > :not(style) ~ :not(style)":{[`margin${w(r?i[r]:e.direction)}`]:(0,g.NA)(n,t)}}))}return(0,m.dt)(t.breakpoints,r)};var _=r(5843),S=r(7927);let C=function(e={}){let{createStyledComponent:t=y,useThemeProps:r=Z,componentName:l="MuiStack"}=e,c=()=>(0,u.Z)({root:["root"]},e=>(0,s.Z)(l,e),{}),d=t(x),p=i.forwardRef(function(e,t){let l=r(e),u=(0,f.Z)(l),{component:s="div",direction:p="column",spacing:m=0,divider:g,children:b,className:y,useFlexGap:Z=!1}=u,w=(0,n.Z)(u,v),x=c();return(0,h.jsx)(d,(0,o.Z)({as:s,ownerState:{direction:p,spacing:m,useFlexGap:Z},ref:t,className:(0,a.Z)(x.root,y)},w,{children:g?function(e,t){let r=i.Children.toArray(e).filter(Boolean);return r.reduce((e,n,o)=>(e.push(n),o<r.length-1&&e.push(i.cloneElement(t,{key:`separator-${o}`})),e),[])}(b,g):b}))});return p}({createStyledComponent:(0,_.ZP)("div",{name:"MuiStack",slot:"Root",overridesResolver:(e,t)=>t.root}),useThemeProps:e=>(0,S.Z)({props:e,name:"MuiStack"})});var M=C},5573:function(e,t,r){"use strict";r.d(t,{Z:function(){return y}});var n=r(3428),o=r(791),i=r(2265);let a=i.createContext(null);function l(){let e=i.useContext(a);return e}let u="function"==typeof Symbol&&Symbol.for;var s=u?Symbol.for("mui.nested"):"__THEME_NESTED__",c=r(7437),d=function(e){let{children:t,theme:r}=e,o=l(),u=i.useMemo(()=>{let e=null===o?r:function(e,t){if("function"==typeof t){let r=t(e);return r}return(0,n.Z)({},e,t)}(o,r);return null!=e&&(e[s]=null!==o),e},[r,o]);return(0,c.jsx)(a.Provider,{value:u,children:t})},f=r(6375),p=r(4809);let m={};function g(e,t,r,o=!1){return i.useMemo(()=>{let i=e&&t[e]||t;if("function"==typeof r){let a=r(i),l=e?(0,n.Z)({},t,{[e]:a}):a;return o?()=>l:l}return e?(0,n.Z)({},t,{[e]:r}):(0,n.Z)({},t,r)},[e,t,r,o])}var h=function(e){let{children:t,theme:r,themeId:n}=e,o=(0,p.Z)(m),i=l()||m,a=g(n,o,r),u=g(n,i,r,!0);return(0,c.jsx)(d,{theme:u,children:(0,c.jsx)(f.T.Provider,{value:a,children:t})})},v=r(3469);let b=["theme"];function y(e){let{theme:t}=e,r=(0,o.Z)(e,b),i=t[v.Z];return(0,c.jsx)(h,(0,n.Z)({},r,{themeId:i?v.Z:void 0,theme:i||t}))}},2135:function(e,t,r){"use strict";r.d(t,{Z:function(){return d}});var n,o=r(2265),i=r(4809),a=r(1529),l=r(8519);function u(e,t,r,n,i){let[a,u]=o.useState(()=>i&&r?r(e).matches:n?n(e).matches:t);return(0,l.Z)(()=>{let t=!0;if(!r)return;let n=r(e),o=()=>{t&&u(n.matches)};return o(),n.addListener(o),()=>{t=!1,n.removeListener(o)}},[e,r]),a}let s=(n||(n=r.t(o,2))).useSyncExternalStore;function c(e,t,r,n,i){let a=o.useCallback(()=>t,[t]),l=o.useMemo(()=>{if(i&&r)return()=>r(e).matches;if(null!==n){let{matches:t}=n(e);return()=>t}return a},[a,e,n,i,r]),[u,c]=o.useMemo(()=>{if(null===r)return[a,()=>()=>{}];let t=r(e);return[()=>t.matches,e=>(t.addListener(e),()=>{t.removeListener(e)})]},[a,r,e]),d=s(c,u,l);return d}function d(e,t={}){let r=(0,i.Z)(),n="undefined"!=typeof window&&void 0!==window.matchMedia,{defaultMatches:o=!1,matchMedia:l=n?window.matchMedia:null,ssrMatchMedia:d=null,noSsr:f=!1}=(0,a.Z)({name:"MuiUseMediaQuery",props:t,theme:r}),p="function"==typeof e?e(r):e;p=p.replace(/^@media( ?)/m,"");let m=(void 0!==s?c:u)(p,o,l,d,f);return m}},3135:function(e,t,r){"use strict";r.r(t),r.d(t,{capitalize:function(){return o.Z},createChainedFunction:function(){return i},createSvgIcon:function(){return a.Z},debounce:function(){return l.Z},deprecatedPropType:function(){return u},isMuiElement:function(){return s.Z},ownerDocument:function(){return c.Z},ownerWindow:function(){return d.Z},requirePropFactory:function(){return f},setRef:function(){return p},unstable_ClassNameGenerator:function(){return w},unstable_useEnhancedEffect:function(){return m.Z},unstable_useId:function(){return g.Z},unsupportedProp:function(){return h},useControlled:function(){return v.Z},useEventCallback:function(){return b.Z},useForkRef:function(){return y.Z},useIsFocusVisible:function(){return Z.Z}});var n=r(5097),o=r(8702),i=r(2940).Z,a=r(9782),l=r(494),u=function(e,t){return()=>null},s=r(673),c=r(3931),d=r(6649);r(3428);var f=function(e,t){return()=>null},p=r(3406).Z,m=r(8519),g=r(419),h=function(e,t,r,n,o){return null},v=r(3292),b=r(96),y=r(7663),Z=r(2143);let w={configure:e=>{n.Z.configure(e)}}},419:function(e,t,r){"use strict";var n=r(3449);t.Z=n.Z},3222:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return b}});let n=r(1024),o=r(8533),i=o._(r(2265)),a=r(4887),l=n._(r(2912)),u=r(2301),s=r(7709),c=r(9469);r(7873);let d=r(2706),f=n._(r(6515)),p={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image/",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function m(e,t,r,n,o,i){let a=null==e?void 0:e.src;if(!e||e["data-loaded-src"]===a)return;e["data-loaded-src"]=a;let l="decode"in e?e.decode():Promise.resolve();l.catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("blur"===t&&o(!0),null==r?void 0:r.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let n=!1,o=!1;r.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>n,isPropagationStopped:()=>o,persist:()=>{},preventDefault:()=>{n=!0,t.preventDefault()},stopPropagation:()=>{o=!0,t.stopPropagation()}})}(null==n?void 0:n.current)&&n.current(e)}})}function g(e){let[t,r]=i.version.split("."),n=parseInt(t,10),o=parseInt(r,10);return n>18||18===n&&o>=3?{fetchPriority:e}:{fetchpriority:e}}let h=(0,i.forwardRef)((e,t)=>{let{src:r,srcSet:n,sizes:o,height:a,width:l,decoding:u,className:s,style:c,fetchPriority:d,placeholder:f,loading:p,unoptimized:h,fill:v,onLoadRef:b,onLoadingCompleteRef:y,setBlurComplete:Z,setShowAltText:w,onLoad:x,onError:_,...S}=e;return i.default.createElement("img",{...S,...g(d),loading:p,width:l,height:a,decoding:u,"data-nimg":v?"fill":"1",className:s,style:c,sizes:o,srcSet:n,src:r,ref:(0,i.useCallback)(e=>{t&&("function"==typeof t?t(e):"object"==typeof t&&(t.current=e)),e&&(_&&(e.src=e.src),e.complete&&m(e,f,b,y,Z,h))},[r,f,b,y,Z,_,h,t]),onLoad:e=>{let t=e.currentTarget;m(t,f,b,y,Z,h)},onError:e=>{w(!0),"blur"===f&&Z(!0),_&&_(e)}})});function v(e){let{isAppRouter:t,imgAttributes:r}=e,n={as:"image",imageSrcSet:r.srcSet,imageSizes:r.sizes,crossOrigin:r.crossOrigin,referrerPolicy:r.referrerPolicy,...g(r.fetchPriority)};return t?((0,a.preload)(r.src,n),null):i.default.createElement(l.default,null,i.default.createElement("link",{key:"__nimg-"+r.src+r.srcSet+r.sizes,rel:"preload",href:r.srcSet?void 0:r.src,...n}))}let b=(0,i.forwardRef)((e,t)=>{let r=(0,i.useContext)(d.RouterContext),n=(0,i.useContext)(c.ImageConfigContext),o=(0,i.useMemo)(()=>{let e=p||n||s.imageConfigDefault,t=[...e.deviceSizes,...e.imageSizes].sort((e,t)=>e-t),r=e.deviceSizes.sort((e,t)=>e-t);return{...e,allSizes:t,deviceSizes:r}},[n]),{onLoad:a,onLoadingComplete:l}=e,m=(0,i.useRef)(a);(0,i.useEffect)(()=>{m.current=a},[a]);let g=(0,i.useRef)(l);(0,i.useEffect)(()=>{g.current=l},[l]);let[b,y]=(0,i.useState)(!1),[Z,w]=(0,i.useState)(!1),{props:x,meta:_}=(0,u.getImgProps)(e,{defaultLoader:f.default,imgConf:o,blurComplete:b,showAltText:Z});return i.default.createElement(i.default.Fragment,null,i.default.createElement(h,{...x,unoptimized:_.unoptimized,placeholder:_.placeholder,fill:_.fill,onLoadRef:m,onLoadingCompleteRef:g,setBlurComplete:y,setShowAltText:w,ref:t}),_.priority?i.default.createElement(v,{isAppRouter:!r,imgAttributes:x}):null)});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},5885:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"AmpStateContext",{enumerable:!0,get:function(){return i}});let n=r(1024),o=n._(r(2265)),i=o.default.createContext({})},8551:function(e,t){"use strict";function r(e){let{ampFirst:t=!1,hybrid:r=!1,hasQuery:n=!1}=void 0===e?{}:e;return t||r&&n}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isInAmpMode",{enumerable:!0,get:function(){return r}})},2301:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImgProps",{enumerable:!0,get:function(){return l}}),r(7873);let n=r(9540),o=r(7709);function i(e){return void 0!==e.default}function a(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function l(e,t){var r;let l,u,s,{src:c,sizes:d,unoptimized:f=!1,priority:p=!1,loading:m,className:g,quality:h,width:v,height:b,fill:y=!1,style:Z,onLoad:w,onLoadingComplete:x,placeholder:_="empty",blurDataURL:S,fetchPriority:C,layout:M,objectFit:k,objectPosition:P,lazyBoundary:j,lazyRoot:O,...z}=e,{imgConf:I,showAltText:R,blurComplete:E,defaultLoader:$}=t,T=I||o.imageConfigDefault;if("allSizes"in T)l=T;else{let e=[...T.deviceSizes,...T.imageSizes].sort((e,t)=>e-t),t=T.deviceSizes.sort((e,t)=>e-t);l={...T,allSizes:e,deviceSizes:t}}let A=z.loader||$;delete z.loader,delete z.srcSet;let F="__next_img_default"in A;if(F){if("custom"===l.loader)throw Error('Image with src "'+c+'" is missing "loader" prop.\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader')}else{let e=A;A=t=>{let{config:r,...n}=t;return e(n)}}if(M){"fill"===M&&(y=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[M];e&&(Z={...Z,...e});let t={responsive:"100vw",fill:"100vw"}[M];t&&!d&&(d=t)}let L="",N=a(v),D=a(b);if("object"==typeof(r=c)&&(i(r)||void 0!==r.src)){let e=i(c)?c.default:c;if(!e.src)throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received "+JSON.stringify(e));if(!e.height||!e.width)throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received "+JSON.stringify(e));if(u=e.blurWidth,s=e.blurHeight,S=S||e.blurDataURL,L=e.src,!y){if(N||D){if(N&&!D){let t=N/e.width;D=Math.round(e.height*t)}else if(!N&&D){let t=D/e.height;N=Math.round(e.width*t)}}else N=e.width,D=e.height}}let B=!p&&("lazy"===m||void 0===m);(!(c="string"==typeof c?c:L)||c.startsWith("data:")||c.startsWith("blob:"))&&(f=!0,B=!1),l.unoptimized&&(f=!0),F&&c.endsWith(".svg")&&!l.dangerouslyAllowSVG&&(f=!0),p&&(C="high");let V=a(h),G=Object.assign(y?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:k,objectPosition:P}:{},R?{}:{color:"transparent"},Z),q="blur"===_&&S&&!E?{backgroundSize:G.objectFit||"cover",backgroundPosition:G.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:'url("data:image/svg+xml;charset=utf-8,'+(0,n.getImageBlurSvg)({widthInt:N,heightInt:D,blurWidth:u,blurHeight:s,blurDataURL:S,objectFit:G.objectFit})+'")'}:{},U=function(e){let{config:t,src:r,unoptimized:n,width:o,quality:i,sizes:a,loader:l}=e;if(n)return{src:r,srcSet:void 0,sizes:void 0};let{widths:u,kind:s}=function(e,t,r){let{deviceSizes:n,allSizes:o}=e;if(r){let e=/(^|\s)(1?\d?\d)vw/g,t=[];for(let n;n=e.exec(r);n)t.push(parseInt(n[2]));if(t.length){let e=.01*Math.min(...t);return{widths:o.filter(t=>t>=n[0]*e),kind:"w"}}return{widths:o,kind:"w"}}if("number"!=typeof t)return{widths:n,kind:"w"};let i=[...new Set([t,2*t].map(e=>o.find(t=>t>=e)||o[o.length-1]))];return{widths:i,kind:"x"}}(t,o,a),c=u.length-1;return{sizes:a||"w"!==s?a:"100vw",srcSet:u.map((e,n)=>l({config:t,src:r,quality:i,width:e})+" "+("w"===s?e:n+1)+s).join(", "),src:l({config:t,src:r,quality:i,width:u[c]})}}({config:l,src:c,unoptimized:f,width:N,quality:V,sizes:d,loader:A}),W={...z,loading:B?"lazy":m,fetchPriority:C,width:N,height:D,decoding:"async",className:g,style:{...G,...q},sizes:U.sizes,srcSet:U.srcSet,src:U.src},H={unoptimized:f,priority:p,placeholder:_,fill:y};return{props:W,meta:H}}},2912:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{defaultHead:function(){return c},default:function(){return m}});let n=r(1024),o=r(8533),i=o._(r(2265)),a=n._(r(3878)),l=r(5885),u=r(1330),s=r(8551);function c(e){void 0===e&&(e=!1);let t=[i.default.createElement("meta",{charSet:"utf-8"})];return e||t.push(i.default.createElement("meta",{name:"viewport",content:"width=device-width"})),t}function d(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===i.default.Fragment?e.concat(i.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}r(7873);let f=["name","httpEquiv","charSet","itemProp"];function p(e,t){let{inAmpMode:r}=t;return e.reduce(d,[]).reverse().concat(c(r).reverse()).filter(function(){let e=new Set,t=new Set,r=new Set,n={};return o=>{let i=!0,a=!1;if(o.key&&"number"!=typeof o.key&&o.key.indexOf("$")>0){a=!0;let t=o.key.slice(o.key.indexOf("$")+1);e.has(t)?i=!1:e.add(t)}switch(o.type){case"title":case"base":t.has(o.type)?i=!1:t.add(o.type);break;case"meta":for(let e=0,t=f.length;e<t;e++){let t=f[e];if(o.props.hasOwnProperty(t)){if("charSet"===t)r.has(t)?i=!1:r.add(t);else{let e=o.props[t],r=n[t]||new Set;("name"!==t||!a)&&r.has(e)?i=!1:(r.add(e),n[t]=r)}}}}return i}}()).reverse().map((e,t)=>{let n=e.key||t;if(!r&&"link"===e.type&&e.props.href&&["https://fonts.googleapis.com/css","https://use.typekit.net/"].some(t=>e.props.href.startsWith(t))){let t={...e.props||{}};return t["data-href"]=t.href,t.href=void 0,t["data-optimized-fonts"]=!0,i.default.cloneElement(e,t)}return i.default.cloneElement(e,{key:n})})}let m=function(e){let{children:t}=e,r=(0,i.useContext)(l.AmpStateContext),n=(0,i.useContext)(u.HeadManagerContext);return i.default.createElement(a.default,{reduceComponentsToState:p,headManager:n,inAmpMode:(0,s.isInAmpMode)(r)},t)};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},9540:function(e,t){"use strict";function r(e){let{widthInt:t,heightInt:r,blurWidth:n,blurHeight:o,blurDataURL:i,objectFit:a}=e,l=n?40*n:t,u=o?40*o:r,s=l&&u?"viewBox='0 0 "+l+" "+u+"'":"";return"%3Csvg xmlns='http://www.w3.org/2000/svg' "+s+"%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='"+(s?"none":"contain"===a?"xMidYMid":"cover"===a?"xMidYMid slice":"none")+"' style='filter: url(%23b);' href='"+i+"'/%3E%3C/svg%3E"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImageBlurSvg",{enumerable:!0,get:function(){return r}})},9469:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ImageConfigContext",{enumerable:!0,get:function(){return a}});let n=r(1024),o=n._(r(2265)),i=r(7709),a=o.default.createContext(i.imageConfigDefault)},7709:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{VALID_LOADERS:function(){return r},imageConfigDefault:function(){return n}});let r=["default","imgix","cloudinary","akamai","custom"],n={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:60,formats:["image/webp"],dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"inline",remotePatterns:[],unoptimized:!1}},1295:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{default:function(){return s},unstable_getImgProps:function(){return u}});let n=r(1024),o=r(2301),i=r(7873),a=r(3222),l=n._(r(6515)),u=e=>{(0,i.warnOnce)("Warning: unstable_getImgProps() is experimental and may change or be removed at any time. Use at your own risk.");let{props:t}=(0,o.getImgProps)(e,{defaultLoader:l.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image/",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,r]of Object.entries(t))void 0===r&&delete t[e];return{props:t}},s=a.Image},6515:function(e,t){"use strict";function r(e){let{config:t,src:r,width:n,quality:o}=e;return t.path+"?url="+encodeURIComponent(r)+"&w="+n+"&q="+(o||75)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n}}),r.__next_img_default=!0;let n=r},3878:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return l}});let n=r(8533),o=n._(r(2265)),i=o.useLayoutEffect,a=o.useEffect;function l(e){let{headManager:t,reduceComponentsToState:r}=e;function n(){if(t&&t.mountedInstances){let n=o.Children.toArray(Array.from(t.mountedInstances).filter(Boolean));t.updateHead(r(n,e))}}return i(()=>{var r;return null==t||null==(r=t.mountedInstances)||r.add(e.children),()=>{var r;null==t||null==(r=t.mountedInstances)||r.delete(e.children)}}),i(()=>(t&&(t._pendingUpdate=n),()=>{t&&(t._pendingUpdate=n)})),a(()=>(t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null),()=>{t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null)})),null}},7873:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"warnOnce",{enumerable:!0,get:function(){return r}});let r=e=>{}},8384:function(e){e.exports={style:{fontFamily:"'__Roboto_c5054f', '__Roboto_Fallback_c5054f'"},className:"__className_c5054f"}},6691:function(e,t,r){e.exports=r(1295)},6314:function(e){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[716],{8938:function(t,e,a){"use strict";a.d(e,{Z:function(){return S}});var r=a(791),n=a(3428),i=a(2265),o=a(7042),s=a(1380),u=a(5702),l=a(5600),d=a(8153),h=a(9190),p=a(4775),c=a(7437);let m=["className","component","disableGutters","fixed","maxWidth","classes"],g=(0,p.Z)(),f=(0,h.Z)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:a}=t;return[e.root,e[`maxWidth${(0,s.Z)(String(a.maxWidth))}`],a.fixed&&e.fixed,a.disableGutters&&e.disableGutters]}}),x=t=>(0,d.Z)({props:t,name:"MuiContainer",defaultTheme:g}),b=(t,e)=>{let{classes:a,fixed:r,disableGutters:n,maxWidth:i}=t,o={root:["root",i&&`maxWidth${(0,s.Z)(String(i))}`,r&&"fixed",n&&"disableGutters"]};return(0,l.Z)(o,t=>(0,u.Z)(e,t),a)};var v=a(8702),y=a(5843),Z=a(7927);let W=function(t={}){let{createStyledComponent:e=f,useThemeProps:a=x,componentName:s="MuiContainer"}=t,u=e(({theme:t,ownerState:e})=>(0,n.Z)({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!e.disableGutters&&{paddingLeft:t.spacing(2),paddingRight:t.spacing(2),[t.breakpoints.up("sm")]:{paddingLeft:t.spacing(3),paddingRight:t.spacing(3)}}),({theme:t,ownerState:e})=>e.fixed&&Object.keys(t.breakpoints.values).reduce((e,a)=>{let r=t.breakpoints.values[a];return 0!==r&&(e[t.breakpoints.up(a)]={maxWidth:`${r}${t.breakpoints.unit}`}),e},{}),({theme:t,ownerState:e})=>(0,n.Z)({},"xs"===e.maxWidth&&{[t.breakpoints.up("xs")]:{maxWidth:Math.max(t.breakpoints.values.xs,444)}},e.maxWidth&&"xs"!==e.maxWidth&&{[t.breakpoints.up(e.maxWidth)]:{maxWidth:`${t.breakpoints.values[e.maxWidth]}${t.breakpoints.unit}`}})),l=i.forwardRef(function(t,e){let i=a(t),{className:l,component:d="div",disableGutters:h=!1,fixed:p=!1,maxWidth:g="lg"}=i,f=(0,r.Z)(i,m),x=(0,n.Z)({},i,{component:d,disableGutters:h,fixed:p,maxWidth:g}),v=b(x,s);return(0,c.jsx)(u,(0,n.Z)({as:d,ownerState:x,className:(0,o.Z)(v.root,l),ref:e},f))});return l}({createStyledComponent:(0,y.ZP)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:a}=t;return[e.root,e[`maxWidth${(0,v.Z)(String(a.maxWidth))}`],a.fixed&&e.fixed,a.disableGutters&&e.disableGutters]}}),useThemeProps:t=>(0,Z.Z)({props:t,name:"MuiContainer"})});var S=W},3226:function(t,e,a){"use strict";a.d(e,{Z:function(){return S}});var r=a(791),n=a(3428),i=a(2265),o=a(7042),s=a(3381),u=a(5600),l=a(5843),d=a(7927),h=a(8702),p=a(6520),c=a(5702);function m(t){return(0,c.Z)("MuiTypography",t)}(0,p.Z)("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);var g=a(7437);let f=["align","className","component","gutterBottom","noWrap","paragraph","variant","variantMapping"],x=t=>{let{align:e,gutterBottom:a,noWrap:r,paragraph:n,variant:i,classes:o}=t,s={root:["root",i,"inherit"!==t.align&&`align${(0,h.Z)(e)}`,a&&"gutterBottom",r&&"noWrap",n&&"paragraph"]};return(0,u.Z)(s,m,o)},b=(0,l.ZP)("span",{name:"MuiTypography",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:a}=t;return[e.root,a.variant&&e[a.variant],"inherit"!==a.align&&e[`align${(0,h.Z)(a.align)}`],a.noWrap&&e.noWrap,a.gutterBottom&&e.gutterBottom,a.paragraph&&e.paragraph]}})(({theme:t,ownerState:e})=>(0,n.Z)({margin:0},"inherit"===e.variant&&{font:"inherit"},"inherit"!==e.variant&&t.typography[e.variant],"inherit"!==e.align&&{textAlign:e.align},e.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},e.gutterBottom&&{marginBottom:"0.35em"},e.paragraph&&{marginBottom:16})),v={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},y={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},Z=t=>y[t]||t,W=i.forwardRef(function(t,e){let a=(0,d.Z)({props:t,name:"MuiTypography"}),i=Z(a.color),u=(0,s.Z)((0,n.Z)({},a,{color:i})),{align:l="inherit",className:h,component:p,gutterBottom:c=!1,noWrap:m=!1,paragraph:y=!1,variant:W="body1",variantMapping:S=v}=u,C=(0,r.Z)(u,f),w=(0,n.Z)({},u,{align:l,color:i,className:h,component:p,gutterBottom:c,noWrap:m,paragraph:y,variant:W,variantMapping:S}),k=p||(y?"p":S[W]||v[W])||"span",R=x(w);return(0,g.jsx)(b,(0,n.Z)({as:k,ref:e,ownerState:w,className:(0,o.Z)(R.root,h)},C))});var S=W},8642:function(t,e,a){Promise.resolve().then(a.bind(a,6722))},6722:function(t,e,a){"use strict";a.r(e),a.d(e,{default:function(){return c}});var r=a(7437),n=a(2265),i=a(1396),o=a.n(i),s=a(5551),u=a(1975),l=a(8938),d=a(3226),h=a(4033),p=a(3571);function c(){let t=(0,h.useRouter)(),[e,a]=n.useState(""),[i,c]=n.useState(""),[m,g]=n.useState(""),[f,x]=n.useState(!1),[b,v]=n.useState(null),y=n.useCallback(async()=>{let{data:t,error:e}=await p.OQ.auth.refreshSession();t&&v(t.user)},[]);n.useEffect(()=>{y()},[y]);let Z=async a=>{if(x(!0),g(""),a.stopPropagation(),a.preventDefault(),!b){let{data:a,error:r}=await p.OQ.auth.signInWithPassword({email:e,password:i});r?g(r.message):t.push("/")}x(!1)};return b?(0,r.jsxs)("div",{style:{textAlign:"center"},children:["You're already logged in as ",b.email,"."]}):(0,r.jsxs)(l.Z,{component:"main",maxWidth:"xs",children:[(0,r.jsx)(d.Z,{component:"h1",variant:"h5",children:"Sign in"}),(0,r.jsx)("form",{children:!b&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"email",label:"Email Address",name:"email",autoComplete:"email",autoFocus:!0,onChange:t=>a(t.target.value),value:e,error:!!m}),(0,r.jsx)(u.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,name:"password",label:"Password",type:"password",id:"password",autoComplete:"current-password",onChange:t=>c(t.target.value),value:i,error:!!m,helperText:m}),(0,r.jsx)(s.Z,{type:"submit",disabled:f,sx:{marginTop:"1em"},fullWidth:!0,variant:"contained",color:"primary",onClick:Z,children:"Sign In"}),(0,r.jsxs)("p",{children:["Don't have an account yet? ",(0,r.jsx)(o(),{href:"/auth/signup",children:"Sign up"})]})]})})]})}},3571:function(t,e,a){"use strict";a.d(e,{Ho:function(){return h},OQ:function(){return o},aC:function(){return u}});var r=a(7437),n=a(2265),i=a(3082);let o=(0,i.createClientComponentClient)(),s=(0,n.createContext)({}),u=()=>(0,n.useContext)(s),l=(t,e)=>o.auth.signInWithPassword({email:t,password:e}),d=()=>o.auth.signOut(),h=t=>{let{children:e}=t,[a,i]=(0,n.useState)(null),[u,h]=(0,n.useState)(!1),p=(0,n.useCallback)(async()=>{let{data:t,error:e}=await o.auth.refreshSession();t&&i(t.user)},[]);return(0,n.useEffect)(()=>{p();let{data:t}=o.auth.onAuthStateChange(async(t,e)=>{"PASSWORD_RECOVERY"==t?h(!1):"SIGNED_IN"===t&&e?(i(e.user),h(!0)):"SIGNED_OUT"===t&&(h(!1),i(null))});return()=>{t.subscription.unsubscribe()}},[p]),(0,r.jsx)(s.Provider,{value:{loggedIn:u,user:a,login:l,logout:d},children:e})}}},function(t){t.O(0,[547,602,72,975,680,971,596,744],function(){return t(t.s=8642)}),_N_E=t.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[271],{8938:function(t,e,a){"use strict";a.d(e,{Z:function(){return W}});var r=a(791),n=a(3428),i=a(2265),o=a(7042),s=a(1380),u=a(5702),l=a(5600),d=a(8153),p=a(9190),h=a(4775),c=a(7437);let m=["className","component","disableGutters","fixed","maxWidth","classes"],g=(0,h.Z)(),f=(0,p.Z)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:a}=t;return[e.root,e[`maxWidth${(0,s.Z)(String(a.maxWidth))}`],a.fixed&&e.fixed,a.disableGutters&&e.disableGutters]}}),x=t=>(0,d.Z)({props:t,name:"MuiContainer",defaultTheme:g}),b=(t,e)=>{let{classes:a,fixed:r,disableGutters:n,maxWidth:i}=t,o={root:["root",i&&`maxWidth${(0,s.Z)(String(i))}`,r&&"fixed",n&&"disableGutters"]};return(0,l.Z)(o,t=>(0,u.Z)(e,t),a)};var v=a(8702),y=a(5843),Z=a(7927);let S=function(t={}){let{createStyledComponent:e=f,useThemeProps:a=x,componentName:s="MuiContainer"}=t,u=e(({theme:t,ownerState:e})=>(0,n.Z)({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!e.disableGutters&&{paddingLeft:t.spacing(2),paddingRight:t.spacing(2),[t.breakpoints.up("sm")]:{paddingLeft:t.spacing(3),paddingRight:t.spacing(3)}}),({theme:t,ownerState:e})=>e.fixed&&Object.keys(t.breakpoints.values).reduce((e,a)=>{let r=t.breakpoints.values[a];return 0!==r&&(e[t.breakpoints.up(a)]={maxWidth:`${r}${t.breakpoints.unit}`}),e},{}),({theme:t,ownerState:e})=>(0,n.Z)({},"xs"===e.maxWidth&&{[t.breakpoints.up("xs")]:{maxWidth:Math.max(t.breakpoints.values.xs,444)}},e.maxWidth&&"xs"!==e.maxWidth&&{[t.breakpoints.up(e.maxWidth)]:{maxWidth:`${t.breakpoints.values[e.maxWidth]}${t.breakpoints.unit}`}})),l=i.forwardRef(function(t,e){let i=a(t),{className:l,component:d="div",disableGutters:p=!1,fixed:h=!1,maxWidth:g="lg"}=i,f=(0,r.Z)(i,m),x=(0,n.Z)({},i,{component:d,disableGutters:p,fixed:h,maxWidth:g}),v=b(x,s);return(0,c.jsx)(u,(0,n.Z)({as:d,ownerState:x,className:(0,o.Z)(v.root,l),ref:e},f))});return l}({createStyledComponent:(0,y.ZP)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:a}=t;return[e.root,e[`maxWidth${(0,v.Z)(String(a.maxWidth))}`],a.fixed&&e.fixed,a.disableGutters&&e.disableGutters]}}),useThemeProps:t=>(0,Z.Z)({props:t,name:"MuiContainer"})});var W=S},3226:function(t,e,a){"use strict";a.d(e,{Z:function(){return W}});var r=a(791),n=a(3428),i=a(2265),o=a(7042),s=a(3381),u=a(5600),l=a(5843),d=a(7927),p=a(8702),h=a(6520),c=a(5702);function m(t){return(0,c.Z)("MuiTypography",t)}(0,h.Z)("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);var g=a(7437);let f=["align","className","component","gutterBottom","noWrap","paragraph","variant","variantMapping"],x=t=>{let{align:e,gutterBottom:a,noWrap:r,paragraph:n,variant:i,classes:o}=t,s={root:["root",i,"inherit"!==t.align&&`align${(0,p.Z)(e)}`,a&&"gutterBottom",r&&"noWrap",n&&"paragraph"]};return(0,u.Z)(s,m,o)},b=(0,l.ZP)("span",{name:"MuiTypography",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:a}=t;return[e.root,a.variant&&e[a.variant],"inherit"!==a.align&&e[`align${(0,p.Z)(a.align)}`],a.noWrap&&e.noWrap,a.gutterBottom&&e.gutterBottom,a.paragraph&&e.paragraph]}})(({theme:t,ownerState:e})=>(0,n.Z)({margin:0},"inherit"===e.variant&&{font:"inherit"},"inherit"!==e.variant&&t.typography[e.variant],"inherit"!==e.align&&{textAlign:e.align},e.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},e.gutterBottom&&{marginBottom:"0.35em"},e.paragraph&&{marginBottom:16})),v={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},y={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},Z=t=>y[t]||t,S=i.forwardRef(function(t,e){let a=(0,d.Z)({props:t,name:"MuiTypography"}),i=Z(a.color),u=(0,s.Z)((0,n.Z)({},a,{color:i})),{align:l="inherit",className:p,component:h,gutterBottom:c=!1,noWrap:m=!1,paragraph:y=!1,variant:S="body1",variantMapping:W=v}=u,C=(0,r.Z)(u,f),w=(0,n.Z)({},u,{align:l,color:i,className:p,component:h,gutterBottom:c,noWrap:m,paragraph:y,variant:S,variantMapping:W}),k=h||(y?"p":W[S]||v[S])||"span",R=x(w);return(0,g.jsx)(b,(0,n.Z)({as:k,ref:e,ownerState:w,className:(0,o.Z)(R.root,p)},C))});var W=S},1771:function(t,e,a){Promise.resolve().then(a.bind(a,3948))},3948:function(t,e,a){"use strict";a.r(e),a.d(e,{default:function(){return c}});var r=a(7437),n=a(2265),i=a(1396),o=a.n(i),s=a(5551),u=a(1975),l=a(8938),d=a(3226),p=a(4033),h=a(3571);function c(){let t=(0,p.useRouter)(),[e,a]=n.useState(""),[i,c]=n.useState(""),[m,g]=n.useState(""),[f,x]=n.useState(!1),[b,v]=n.useState(null),y=n.useCallback(async()=>{let{data:t,error:e}=await h.OQ.auth.refreshSession();t&&v(t.user)},[]);n.useEffect(()=>{y()},[y]);let Z=async a=>{if(x(!0),g(""),a.stopPropagation(),a.preventDefault(),!b){let{data:a,error:r}=await h.OQ.auth.signUp({email:e,password:i,options:{emailRedirectTo:"".concat(location.origin,"/auth/callback")}});r?g(r.message):t.push("/")}x(!1)};return(0,r.jsxs)(l.Z,{component:"main",maxWidth:"xs",children:[(0,r.jsx)(d.Z,{component:"h1",variant:"h5",children:"Sign up"}),(0,r.jsx)("p",{children:(0,r.jsx)(d.Z,{variant:"body1",children:"An account helps you easily save, view, and share your evals."})}),(0,r.jsxs)("form",{children:[!b&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"email",label:"Email Address",name:"email",autoComplete:"email",autoFocus:!0,onChange:t=>a(t.target.value),value:e,error:!!m}),(0,r.jsx)(u.Z,{disabled:f,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,name:"password",label:"Password",type:"password",id:"password",autoComplete:"current-password",onChange:t=>c(t.target.value),value:i,error:!!m,helperText:m}),(0,r.jsx)(s.Z,{type:"submit",disabled:f,sx:{marginTop:"1em"},fullWidth:!0,variant:"contained",color:"primary",onClick:Z,children:"Sign Up"})]}),(0,r.jsxs)("p",{children:["Already have an account? ",(0,r.jsx)(o(),{href:"/auth/login",children:"Sign in"})]})]})]})}},3571:function(t,e,a){"use strict";a.d(e,{Ho:function(){return p},OQ:function(){return o},aC:function(){return u}});var r=a(7437),n=a(2265),i=a(3082);let o=(0,i.createClientComponentClient)(),s=(0,n.createContext)({}),u=()=>(0,n.useContext)(s),l=(t,e)=>o.auth.signInWithPassword({email:t,password:e}),d=()=>o.auth.signOut(),p=t=>{let{children:e}=t,[a,i]=(0,n.useState)(null),[u,p]=(0,n.useState)(!1),h=(0,n.useCallback)(async()=>{let{data:t,error:e}=await o.auth.refreshSession();t&&i(t.user)},[]);return(0,n.useEffect)(()=>{h();let{data:t}=o.auth.onAuthStateChange(async(t,e)=>{"PASSWORD_RECOVERY"==t?p(!1):"SIGNED_IN"===t&&e?(i(e.user),p(!0)):"SIGNED_OUT"===t&&(p(!1),i(null))});return()=>{t.subscription.unsubscribe()}},[h]),(0,r.jsx)(s.Provider,{value:{loggedIn:u,user:a,login:l,logout:d},children:e})}}},function(t){t.O(0,[547,602,72,975,680,971,596,744],function(){return t(t.s=1771)}),_N_E=t.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[958],{4303:function(e,t,s){Promise.resolve().then(s.bind(s,4260))},2810:function(e,t,s){"use strict";let i,n;async function l(){if(i||(n||(n=fetch("/api/config").then(e=>e.json()).then(e=>i=e.apiBaseUrl)),await n),void 0===i)throw Error("API base URL is undefined");return i}s.d(t,{b:function(){return l}})},4260:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return E}});var i=s(7437),n=s(2265),l=s(1396),r=s.n(l),c=s(6507),d=s(2492),a=s(3701),o=s(9279),h=s(666),u=s(6988),v=s(4147),x=s(5781),j=s(8276),p=s(4033),Z=s(8339),m=s(5551),f=s(9394),w=s(2834),C=s(6337),y=s(1797),g=s(3226),I=s(5446);function k(e){var t,s,l,c,x;let{openDialog:j,handleClose:p,testCase:k}=e,[S,E]=(0,n.useState)(1);return(0,i.jsxs)(f.Z,{open:j,onClose:p,fullWidth:!0,maxWidth:"lg",children:[(0,i.jsxs)(y.Z,{children:["Dataset ",k.id.slice(0,6)]}),(0,i.jsxs)(C.Z,{children:[(0,i.jsx)(g.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Test cases"}),(0,i.jsx)(I.u,{readOnly:!0,value:k&&Z.default.dump(k.testCases),style:{width:"100%",padding:"0.75rem"},maxRows:15}),(0,i.jsx)(g.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Used in..."}),(0,i.jsxs)(a.Z,{children:[(0,i.jsx)(u.Z,{children:(0,i.jsxs)(v.Z,{children:[(0,i.jsx)(h.Z,{children:"Eval ID"}),(0,i.jsx)(h.Z,{children:"Prompt ID"}),(0,i.jsx)(h.Z,{children:"Raw score"}),(0,i.jsx)(h.Z,{children:"Pass rate"}),(0,i.jsx)(h.Z,{children:"Pass count"}),(0,i.jsx)(h.Z,{children:"Fail count"}),(0,i.jsx)(h.Z,{children:"Prompt"})]})}),(0,i.jsx)(o.Z,{children:null==k?void 0:null===(t=k.prompts)||void 0===t?void 0:t.slice((S-1)*10,10*S).sort((e,t)=>t.evalId.localeCompare(e.evalId)).map((e,t)=>{var s,n,d,a,o,u,j,p;return(0,i.jsxs)(v.Z,{hover:!0,children:[(0,i.jsx)(h.Z,{children:(0,i.jsx)(r(),{href:"/eval/?evalId=".concat(e.evalId),children:e.evalId})}),(0,i.jsx)(h.Z,{style:{minWidth:"8em"},children:(0,i.jsx)(r(),{href:"/prompts/?id=".concat(e.id),children:e.id.slice(0,6)})}),(0,i.jsx)(h.Z,{children:null!==(l=null===(s=e.prompt.metrics)||void 0===s?void 0:s.score.toFixed(2))&&void 0!==l?l:"-"}),(0,i.jsx)(h.Z,{children:(null===(n=e.prompt.metrics)||void 0===n?void 0:n.testPassCount)!==void 0&&(null===(d=e.prompt.metrics)||void 0===d?void 0:d.testFailCount)!==void 0?((null===(a=e.prompt.metrics)||void 0===a?void 0:a.testPassCount)/((null===(o=e.prompt.metrics)||void 0===o?void 0:o.testPassCount)+(null===(u=e.prompt.metrics)||void 0===u?void 0:u.testFailCount))*100).toFixed(2)+"%":"-"}),(0,i.jsx)(h.Z,{children:null!==(c=null===(j=e.prompt.metrics)||void 0===j?void 0:j.testPassCount)&&void 0!==c?c:"-"}),(0,i.jsx)(h.Z,{children:null!==(x=null===(p=e.prompt.metrics)||void 0===p?void 0:p.testFailCount)&&void 0!==x?x:"-"}),(0,i.jsx)(h.Z,{children:e.prompt.raw.length>250?e.prompt.raw.slice(0,250)+"...":e.prompt.raw})]},t)})})]}),Math.ceil(((null==k?void 0:null===(s=k.prompts)||void 0===s?void 0:s.length)||0)/10)>1&&(0,i.jsx)(d.Z,{count:Math.ceil(k.prompts.length/10),page:S,onChange:(e,t)=>{E(t)}})]}),(0,i.jsx)(w.Z,{children:(0,i.jsx)(m.Z,{onClick:p,children:"Close"})})]})}var S=s(2810);function E(){let e=(0,p.useSearchParams)(),[t,s]=(0,n.useState)([]),[l,Z]=(0,n.useState)("date"),[m,f]=(0,n.useState)("desc"),[w,C]=(0,n.useState)(1),[y,g]=(0,n.useState)(10),[I,E]=(0,n.useState)(!1),[P,b]=(0,n.useState)(0),D=e=>{let t=l===e&&"asc"===m?"desc":"asc";Z(e),f(t)};(0,n.useEffect)(()=>{(async()=>{fetch("".concat(await (0,S.b)(),"/api/datasets")).then(e=>e.json()).then(e=>{let t=[...e.data].sort((e,t)=>null===l?0:"asc"===m?e[l]>t[l]?1:-1:e[l]<t[l]?1:-1);s(t)})})()},[l,m,w,y]),(0,n.useEffect)(()=>{let s=null==e?void 0:e.get("id");if(s){let e=t.findIndex(e=>e.id.startsWith(s));-1!==e&&M(e)}},[t,e]);let M=e=>{b(e),E(!0)};return(0,i.jsxs)(c.Z,{paddingX:2,children:[(0,i.jsxs)(a.Z,{children:[(0,i.jsx)(u.Z,{children:(0,i.jsxs)(v.Z,{children:[(0,i.jsx)(h.Z,{style:{width:"10%"},children:"ID"}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:(0,i.jsx)(x.Z,{active:"raw"===l,direction:"raw"===l?m:"asc",onClick:()=>D("raw"),children:"Info"})}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:"Variables"}),(0,i.jsx)(h.Z,{style:{width:"10%"},children:(0,i.jsx)(x.Z,{active:"count"===l,direction:"count"===l?m:"asc",onClick:()=>D("count"),children:"Total # evals"})}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:(0,i.jsx)(j.Z,{title:"The date of the most recent eval for this set of test cases",children:(0,i.jsx)(x.Z,{active:"date"===l,direction:"date"===l?m:"asc",onClick:()=>D("date"),children:"Most recent eval date"})})}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:(0,i.jsx)(j.Z,{title:"The ID of the most recent eval for this set of test cases",children:(0,i.jsx)(x.Z,{active:"evalId"===l,direction:"evalId"===l?m:"asc",onClick:()=>D("evalId"),children:"Most recent eval ID"})})})]})}),(0,i.jsx)(o.Z,{children:t.slice((w-1)*y,w*y).map((e,t)=>(0,i.jsxs)(v.Z,{hover:!0,onClick:()=>M(t),style:{cursor:"pointer"},children:[(0,i.jsx)(h.Z,{children:e.id.slice(0,6)}),(0,i.jsxs)(h.Z,{style:{width:"20%",whiteSpace:"pre-wrap"},children:[e.testCases.length," test cases"]}),(0,i.jsx)(h.Z,{style:{width:"20%",whiteSpace:"pre-wrap"},children:(()=>{if(!Array.isArray(e.testCases)||"string"==typeof e.testCases[0])return"";let t=(e.testCases||[]).flatMap(e=>Object.keys(e.vars||{})),s=Array.from(new Set(t));return s.length>0?s.join(", "):"None"})()}),(0,i.jsx)(h.Z,{style:{width:"10%"},children:e.count}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:e.recentEvalDate||"Unknown"}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:e.recentEvalId?(0,i.jsx)(r(),{href:"/eval?evalId=".concat(e.recentEvalId),children:e.recentEvalId}):"Unknown"})]},t))})]}),Math.ceil(t.length/y)>1&&(0,i.jsx)(d.Z,{count:Math.ceil(t.length/y),page:w,onChange:(e,t)=>C(t)}),t[P]&&(0,i.jsx)(k,{openDialog:I,handleClose:()=>{E(!1)},testCase:t[P]})]})}}},function(e){e.O(0,[293,808,420,339,21,971,596,744],function(){return e(e.s=4303)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[958],{4303:function(e,t,s){Promise.resolve().then(s.bind(s,4260))},2810:function(e,t,s){"use strict";let i,n;async function l(){if(i||(n||(n=fetch("/api/config").then(e=>e.json()).then(e=>i=e.apiBaseUrl)),await n),void 0===i)throw Error("API base URL is undefined");return i}s.d(t,{b:function(){return l}})},4260:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return E}});var i=s(7437),n=s(2265),l=s(1396),r=s.n(l),c=s(6507),d=s(2492),a=s(3701),o=s(9279),h=s(666),u=s(6988),v=s(4147),x=s(5781),j=s(8276),p=s(4033),Z=s(8339),m=s(5551),f=s(9394),w=s(2834),C=s(6337),y=s(1797),g=s(3226),I=s(5446);function k(e){var t,s,l,c,x;let{openDialog:j,handleClose:p,testCase:k}=e,[S,E]=(0,n.useState)(1);return(0,i.jsxs)(f.Z,{open:j,onClose:p,fullWidth:!0,maxWidth:"lg",children:[(0,i.jsxs)(y.Z,{children:["Dataset ",k.id.slice(0,6)]}),(0,i.jsxs)(C.Z,{children:[(0,i.jsx)(g.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Test cases"}),(0,i.jsx)(I.u,{readOnly:!0,value:k&&Z.default.dump(k.testCases),style:{width:"100%",padding:"0.75rem"},maxRows:15}),(0,i.jsx)(g.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Used in..."}),(0,i.jsxs)(a.Z,{children:[(0,i.jsx)(u.Z,{children:(0,i.jsxs)(v.Z,{children:[(0,i.jsx)(h.Z,{children:"Eval ID"}),(0,i.jsx)(h.Z,{children:"Prompt ID"}),(0,i.jsx)(h.Z,{children:"Raw score"}),(0,i.jsx)(h.Z,{children:"Pass rate"}),(0,i.jsx)(h.Z,{children:"Pass count"}),(0,i.jsx)(h.Z,{children:"Fail count"}),(0,i.jsx)(h.Z,{children:"Prompt"})]})}),(0,i.jsx)(o.Z,{children:null==k?void 0:null===(t=k.prompts)||void 0===t?void 0:t.slice((S-1)*10,10*S).sort((e,t)=>t.evalId.localeCompare(e.evalId)).map((e,t)=>{var s,n,d,a,o,u,j,p;return(0,i.jsxs)(v.Z,{hover:!0,children:[(0,i.jsx)(h.Z,{children:(0,i.jsx)(r(),{href:"/eval/?evalId=".concat(e.evalId),children:e.evalId})}),(0,i.jsx)(h.Z,{style:{minWidth:"8em"},children:(0,i.jsx)(r(),{href:"/prompts/?id=".concat(e.id),children:e.id.slice(0,6)})}),(0,i.jsx)(h.Z,{children:null!==(l=null===(s=e.prompt.metrics)||void 0===s?void 0:s.score.toFixed(2))&&void 0!==l?l:"-"}),(0,i.jsx)(h.Z,{children:(null===(n=e.prompt.metrics)||void 0===n?void 0:n.testPassCount)!==void 0&&(null===(d=e.prompt.metrics)||void 0===d?void 0:d.testFailCount)!==void 0?((null===(a=e.prompt.metrics)||void 0===a?void 0:a.testPassCount)/((null===(o=e.prompt.metrics)||void 0===o?void 0:o.testPassCount)+(null===(u=e.prompt.metrics)||void 0===u?void 0:u.testFailCount))*100).toFixed(2)+"%":"-"}),(0,i.jsx)(h.Z,{children:null!==(c=null===(j=e.prompt.metrics)||void 0===j?void 0:j.testPassCount)&&void 0!==c?c:"-"}),(0,i.jsx)(h.Z,{children:null!==(x=null===(p=e.prompt.metrics)||void 0===p?void 0:p.testFailCount)&&void 0!==x?x:"-"}),(0,i.jsx)(h.Z,{children:e.prompt.raw.length>250?e.prompt.raw.slice(0,250)+"...":e.prompt.raw})]},t)})})]}),Math.ceil(((null==k?void 0:null===(s=k.prompts)||void 0===s?void 0:s.length)||0)/10)>1&&(0,i.jsx)(d.Z,{count:Math.ceil(k.prompts.length/10),page:S,onChange:(e,t)=>{E(t)}})]}),(0,i.jsx)(w.Z,{children:(0,i.jsx)(m.Z,{onClick:p,children:"Close"})})]})}var S=s(2810);function E(){let e=(0,p.useSearchParams)(),[t,s]=(0,n.useState)([]),[l,Z]=(0,n.useState)("date"),[m,f]=(0,n.useState)("desc"),[w,C]=(0,n.useState)(1),[y,g]=(0,n.useState)(10),[I,E]=(0,n.useState)(!1),[P,b]=(0,n.useState)(0),D=e=>{let t=l===e&&"asc"===m?"desc":"asc";Z(e),f(t)};(0,n.useEffect)(()=>{(async()=>{fetch("".concat(await (0,S.b)(),"/api/datasets")).then(e=>e.json()).then(e=>{let t=[...e.data].sort((e,t)=>null===l?0:"asc"===m?e[l]>t[l]?1:-1:e[l]<t[l]?1:-1);s(t)})})()},[l,m,w,y]),(0,n.useEffect)(()=>{let s=null==e?void 0:e.get("id");if(s){let e=t.findIndex(e=>e.id.startsWith(s));-1!==e&&M(e)}},[t,e]);let M=e=>{b(e),E(!0)};return(0,i.jsxs)(c.Z,{paddingX:2,children:[(0,i.jsxs)(a.Z,{children:[(0,i.jsx)(u.Z,{children:(0,i.jsxs)(v.Z,{children:[(0,i.jsx)(h.Z,{style:{width:"10%"},children:"ID"}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:(0,i.jsx)(x.Z,{active:"raw"===l,direction:"raw"===l?m:"asc",onClick:()=>D("raw"),children:"Info"})}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:"Variables"}),(0,i.jsx)(h.Z,{style:{width:"10%"},children:(0,i.jsx)(x.Z,{active:"count"===l,direction:"count"===l?m:"asc",onClick:()=>D("count"),children:"Total # evals"})}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:(0,i.jsx)(j.Z,{title:"The date of the most recent eval for this set of test cases",children:(0,i.jsx)(x.Z,{active:"date"===l,direction:"date"===l?m:"asc",onClick:()=>D("date"),children:"Most recent eval date"})})}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:(0,i.jsx)(j.Z,{title:"The ID of the most recent eval for this set of test cases",children:(0,i.jsx)(x.Z,{active:"evalId"===l,direction:"evalId"===l?m:"asc",onClick:()=>D("evalId"),children:"Most recent eval ID"})})})]})}),(0,i.jsx)(o.Z,{children:t.slice((w-1)*y,w*y).map((e,t)=>(0,i.jsxs)(v.Z,{hover:!0,onClick:()=>M(t),style:{cursor:"pointer"},children:[(0,i.jsx)(h.Z,{children:e.id.slice(0,6)}),(0,i.jsxs)(h.Z,{style:{width:"20%",whiteSpace:"pre-wrap"},children:[e.testCases.length," test cases"]}),(0,i.jsx)(h.Z,{style:{width:"20%",whiteSpace:"pre-wrap"},children:(()=>{if(!Array.isArray(e.testCases)||"string"==typeof e.testCases[0])return"";let t=(e.testCases||[]).flatMap(e=>Object.keys(e.vars||{})),s=Array.from(new Set(t));return s.length>0?s.join(", "):"None"})()}),(0,i.jsx)(h.Z,{style:{width:"10%"},children:e.count}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:e.recentEvalDate||"Unknown"}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:e.recentEvalId?(0,i.jsx)(r(),{href:"/eval?evalId=".concat(e.recentEvalId),children:e.recentEvalId}):"Unknown"})]},t))})]}),Math.ceil(t.length/y)>1&&(0,i.jsx)(d.Z,{count:Math.ceil(t.length/y),page:w,onChange:(e,t)=>C(t)}),t[P]&&(0,i.jsx)(k,{openDialog:I,handleClose:()=>{E(!1)},testCase:t[P]})]})}},4033:function(e,t,s){e.exports=s(8165)}},function(e){e.O(0,[547,602,414,113,339,21,971,596,744],function(){return e(e.s=4303)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[421],{6427:function(e,n,t){Promise.resolve().then(t.t.bind(t,6656,23)),Promise.resolve().then(t.t.bind(t,6208,23)),Promise.resolve().then(t.t.bind(t,8169,23)),Promise.resolve().then(t.t.bind(t,3699,23)),Promise.resolve().then(t.bind(t,9670)),Promise.resolve().then(t.t.bind(t,4116,23))},3699:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e,n){for(var t in n)Object.defineProperty(e,t,{enumerable:!0,get:n[t]})}(n,{suspense:function(){return o},NoSSR:function(){return i}}),t(1024),t(2265);let r=t(7669);function o(){let e=Error(r.NEXT_DYNAMIC_NO_SSR_CODE);throw e.digest=r.NEXT_DYNAMIC_NO_SSR_CODE,e}function i(e){let{children:n}=e;return n}},4116:function(){}},function(e){e.O(0,[674,293,808,548,82,420,975,339,886,683,133,782,670,971,596,744],function(){return e(e.s=6427)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[421],{6427:function(e,n,t){Promise.resolve().then(t.t.bind(t,6656,23)),Promise.resolve().then(t.t.bind(t,6208,23)),Promise.resolve().then(t.t.bind(t,8169,23)),Promise.resolve().then(t.t.bind(t,3699,23)),Promise.resolve().then(t.bind(t,9670)),Promise.resolve().then(t.t.bind(t,4116,23))},3699:function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e,n){for(var t in n)Object.defineProperty(e,t,{enumerable:!0,get:n[t]})}(n,{suspense:function(){return o},NoSSR:function(){return i}}),t(1024),t(2265);let r=t(7669);function o(){let e=Error(r.NEXT_DYNAMIC_NO_SSR_CODE);throw e.digest=r.NEXT_DYNAMIC_NO_SSR_CODE,e}function i(e){let{children:n}=e;return n}},4116:function(){}},function(e){e.O(0,[674,547,602,72,975,414,680,113,261,339,609,133,782,670,971,596,744],function(){return e(e.s=6427)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[11],{7304:function(e,n,s){Promise.resolve().then(s.t.bind(s,6685,23)),Promise.resolve().then(s.bind(s,9670))}},function(e){e.O(0,[674,547,602,72,975,414,680,113,261,339,609,133,782,670,971,596,744],function(){return e(e.s=7304)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{679:function(e,t,n){Promise.resolve().then(n.bind(n,2112)),Promise.resolve().then(n.t.bind(n,8384,23)),Promise.resolve().then(n.t.bind(n,2471,23))},2112:function(e,t,n){"use strict";n.r(t),n.d(t,{PageShell:function(){return Z}});var r=n(7437),s=n(2265),o=n(2135),i=n(606),a=n(5573),l=n(3571),u=n(1396),c=n.n(u),d=n(3457),h=n(4033),f=n(6691),m=n.n(f),x=n(6507);function g(){return(0,r.jsxs)(x.Z,{className:"logo",children:[(0,r.jsx)(m(),{width:25,height:25,src:"/logo.svg",alt:"Promptfoo logo"})," ",(0,r.jsx)("span",{children:"promptfoo"})]})}n(1320);var j=n(3283),p=n(3375),v=n(5507),b=n(2653);function E(){let{user:e,logout:t}=(0,l.aC)(),[n,o]=s.useState(null),i=async()=>{null==t||t(),a()},a=()=>{o(null)};return e?(0,r.jsxs)("div",{children:[(0,r.jsx)(b.Z,{edge:"end","aria-label":"account of current user","aria-controls":"menu-appbar","aria-haspopup":"true",onClick:e=>{o(e.currentTarget)},color:"inherit",children:(0,r.jsx)(j.Z,{sx:{width:"1em",height:"1em",bgcolor:"#1976d2"}})}),(0,r.jsxs)(p.Z,{id:"menu-appbar",anchorEl:n,anchorOrigin:{vertical:"top",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:!!n,onClose:a,children:[(0,r.jsxs)(v.Z,{disabled:!0,children:["Logged in as ",e.email]}),(0,r.jsx)(v.Z,{onClick:i,children:"Logout"})]})]}):(0,r.jsx)(c(),{href:"/auth/signup/",children:(0,r.jsx)(b.Z,{edge:"end","aria-label":"User not logged in","aria-controls":"menu-appbar","aria-haspopup":"true",color:"inherit",children:(0,r.jsx)(j.Z,{sx:{width:"1em",height:"1em"}})})})}var _=n(9864),k=n(7028);function N(e){let{darkMode:t,onToggleDarkMode:n}=e;return(0,r.jsx)("div",{className:"dark-mode-toggle",onClick:n,children:t?(0,r.jsx)(_.Z,{}):(0,r.jsx)(k.Z,{})})}n(2794);var O=n(279);n(5154);var C=n(7580);function P(e){let{href:t,label:n}=e,s=(0,h.usePathname)()||"";return(0,r.jsx)(c(),{href:t,className:s.startsWith(t)?"active":"",children:n})}function S(e){let{darkMode:t,onToggleDarkMode:n}=e;return C.env.NEXT_PUBLIC_NO_BROWSING?(0,r.jsxs)(d.Z,{direction:"row",spacing:2,className:"nav",children:[(0,r.jsx)(g,{}),(0,r.jsx)(N,{darkMode:t,onToggleDarkMode:n})]}):(0,r.jsxs)(d.Z,{direction:"row",spacing:2,className:"nav",children:[(0,r.jsx)(g,{}),(0,r.jsx)(P,{href:"/setup",label:"New Eval"}),(0,r.jsx)(P,{href:"/eval",label:"Evals"}),(0,r.jsx)(P,{href:"/prompts",label:"Prompts"}),(0,r.jsx)(P,{href:"/datasets",label:"Datasets"}),(0,r.jsx)(P,{href:"/progress",label:"Progress"}),(0,r.jsxs)("div",{className:"right-aligned",children:[O.Ox?(0,r.jsx)(E,{}):null,(0,r.jsx)(N,{darkMode:t,onToggleDarkMode:n})]})]})}function Z(e){let{children:t}=e,n=(0,o.Z)("(prefers-color-scheme: dark)"),[u,c]=s.useState(n),d=s.useMemo(()=>(0,i.Z)({typography:{fontFamily:"inherit"},palette:{mode:u||n?"dark":"light"}}),[u,n]);return s.useEffect(()=>{n&&document.documentElement.setAttribute("data-theme","dark")},[n]),(0,r.jsx)(s.StrictMode,{children:(0,r.jsx)(a.Z,{theme:d,children:(0,r.jsx)(l.Ho,{children:(0,r.jsxs)(T,{children:[(0,r.jsx)(S,{darkMode:u,onToggleDarkMode:()=>{c(!u),u?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme","dark")}}),(0,r.jsx)("div",{children:t})]})})})})}function T(e){let{children:t}=e;return(0,r.jsx)("div",{children:t})}n(5587)},279:function(e,t,n){"use strict";n.d(t,{Ox:function(){return o},T8:function(){return s},eA:function(){return i}});var r=n(7580);let s=!r.env.NEXT_PUBLIC_PROMPTFOO_BUILD_STANDALONE_SERVER,o=!!r.env.NEXT_PUBLIC_PROMPTFOO_USE_SUPABASE,i=""},3571:function(e,t,n){"use strict";n.d(t,{Ho:function(){return d},OQ:function(){return i},aC:function(){return l}});var r=n(7437),s=n(2265),o=n(3082);let i=(0,o.createClientComponentClient)(),a=(0,s.createContext)({}),l=()=>(0,s.useContext)(a),u=(e,t)=>i.auth.signInWithPassword({email:e,password:t}),c=()=>i.auth.signOut(),d=e=>{let{children:t}=e,[n,o]=(0,s.useState)(null),[l,d]=(0,s.useState)(!1),h=(0,s.useCallback)(async()=>{let{data:e,error:t}=await i.auth.refreshSession();e&&o(e.user)},[]);return(0,s.useEffect)(()=>{h();let{data:e}=i.auth.onAuthStateChange(async(e,t)=>{"PASSWORD_RECOVERY"==e?d(!1):"SIGNED_IN"===e&&t?(o(t.user),d(!0)):"SIGNED_OUT"===e&&(d(!1),o(null))});return()=>{e.subscription.unsubscribe()}},[h]),(0,r.jsx)(a.Provider,{value:{loggedIn:l,user:n,login:u,logout:c},children:t})}},2794:function(){},1320:function(){},5154:function(){},5587:function(){},2471:function(){}},function(e){e.O(0,[547,72,680,840,971,596,744],function(){return e(e.s=679)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[92],{2481:function(e,t,a){"use strict";var i=a(6314);t.Z=void 0;var r=i(a(984)),n=a(7437),s=(0,r.default)((0,n.jsx)("path",{d:"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"}),"Download");t.Z=s},9660:function(e,t,a){"use strict";a.d(t,{L:function(){return n}});var i=a(6520),r=a(5702);function n(e){return(0,r.Z)("MuiListItemText",e)}let s=(0,i.Z)("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]);t.Z=s},5507:function(e,t,a){"use strict";a.d(t,{Z:function(){return k}});var i=a(791),r=a(3428),n=a(2265),s=a(7042),o=a(5600),l=a(9975),d=a(5843),c=a(7927),u=a(7820),p=a(6659),v=a(8519),m=a(7663),h=a(6520);let x=(0,h.Z)("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]),f=(0,h.Z)("MuiListItemIcon",["root","alignItemsFlexStart"]);var Z=a(9660),g=a(5702);function C(e){return(0,g.Z)("MuiMenuItem",e)}let I=(0,h.Z)("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]);var j=a(7437);let b=["autoFocus","component","dense","divider","disableGutters","focusVisibleClassName","role","tabIndex","className"],y=e=>{let{disabled:t,dense:a,divider:i,disableGutters:n,selected:s,classes:l}=e,d=(0,o.Z)({root:["root",a&&"dense",t&&"disabled",!n&&"gutters",i&&"divider",s&&"selected"]},C,l);return(0,r.Z)({},l,d)},w=(0,d.ZP)(p.Z,{shouldForwardProp:e=>(0,d.FO)(e)||"classes"===e,name:"MuiMenuItem",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:a}=e;return[t.root,a.dense&&t.dense,a.divider&&t.divider,!a.disableGutters&&t.gutters]}})(({theme:e,ownerState:t})=>(0,r.Z)({},e.typography.body1,{display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:"border-box",whiteSpace:"nowrap"},!t.disableGutters&&{paddingLeft:16,paddingRight:16},t.divider&&{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"},{"&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${I.selected}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity),[`&.${I.focusVisible}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},[`&.${I.selected}:hover`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:(0,l.Fq)(e.palette.primary.main,e.palette.action.selectedOpacity)}},[`&.${I.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${I.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${x.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${x.inset}`]:{marginLeft:52},[`& .${Z.Z.root}`]:{marginTop:0,marginBottom:0},[`& .${Z.Z.inset}`]:{paddingLeft:36},[`& .${f.root}`]:{minWidth:36}},!t.dense&&{[e.breakpoints.up("sm")]:{minHeight:"auto"}},t.dense&&(0,r.Z)({minHeight:32,paddingTop:4,paddingBottom:4},e.typography.body2,{[`& .${f.root} svg`]:{fontSize:"1.25rem"}}))),P=n.forwardRef(function(e,t){let a;let o=(0,c.Z)({props:e,name:"MuiMenuItem"}),{autoFocus:l=!1,component:d="li",dense:p=!1,divider:h=!1,disableGutters:x=!1,focusVisibleClassName:f,role:Z="menuitem",tabIndex:g,className:C}=o,I=(0,i.Z)(o,b),P=n.useContext(u.Z),k=n.useMemo(()=>({dense:p||P.dense||!1,disableGutters:x}),[P.dense,p,x]),F=n.useRef(null);(0,v.Z)(()=>{l&&F.current&&F.current.focus()},[l]);let M=(0,r.Z)({},o,{dense:k.dense,divider:h,disableGutters:x}),S=y(o),$=(0,m.Z)(F,t);return o.disabled||(a=void 0!==g?g:-1),(0,j.jsx)(u.Z.Provider,{value:k,children:(0,j.jsx)(w,(0,r.Z)({ref:$,role:Z,tabIndex:a,component:d,focusVisibleClassName:(0,s.Z)(S.focusVisible,f),className:(0,s.Z)(S.root,C)},I,{ownerState:M,classes:S}))})});var k=P},932:function(e,t,a){Promise.resolve().then(a.bind(a,5986))},5986:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return I}});var i=a(7437),r=a(2265),n=a(1396),s=a.n(n),o=a(8440),l=a(6507),d=a(5551),c=a(2481),u=a(3375),p=a(5507),v=a(2492),m=a(3701),h=a(9279),x=a(666),f=a(6988),Z=a(4147),g=a(5781),C=a(1975);function I(){let[e,t]=(0,r.useState)([]),[a,n]=(0,r.useState)(null),[I,j]=(0,r.useState)("asc"),[b,y]=(0,r.useState)(null),[w,P]=r.useState(1),[k,F]=(0,r.useState)({evalId:"",datasetId:"",provider:"",promptId:""}),M=!!b;(0,r.useEffect)(()=>{(async()=>{let e=await fetch("/api/progress"),a=await e.json();a&&a.data&&t(a.data)})()},[]);let S=e=>{let t=a===e&&"asc"===I;n(e),j(t?"desc":"asc")},$=t=>{let a="json"===t?JSON.stringify(e):R(e),i=new Blob([a],{type:"text/".concat(t,";charset=utf-8;")}),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download="cols_export.".concat(t),r.click(),URL.revokeObjectURL(r.href),y(null)},O=e=>(null==e?void 0:e.testPassCount)!=null&&(null==e?void 0:e.testFailCount)!=null?(e.testPassCount/(e.testPassCount+e.testFailCount)*100).toFixed(2):"-",R=e=>{var t,a,i,r,n;let s=e.map(e=>{var s,o,l,d,c;return[null!==(t=e.evalId)&&void 0!==t?t:"",null!==(a=null===(s=e.datasetId)||void 0===s?void 0:s.slice(0,6))&&void 0!==a?a:"",null!==(i=e.provider)&&void 0!==i?i:"",(null!==(r=null===(o=e.promptId)||void 0===o?void 0:o.slice(0,6))&&void 0!==r?r:"")+" "+(null!==(n=e.raw)&&void 0!==n?n:""),O(e.metrics),(null===(l=e.metrics)||void 0===l?void 0:l.testPassCount)==null?"-":"".concat(e.metrics.testPassCount),(null===(d=e.metrics)||void 0===d?void 0:d.testFailCount)==null?"-":"".concat(e.metrics.testFailCount),(null===(c=e.metrics)||void 0===c?void 0:c.score)==null?"-":e.metrics.score.toFixed(2)]});return[["Eval","Dataset","Provider","Prompt","Pass Rate %","Pass Count","Fail Count","Raw score"]].concat(s).map(e=>e.map(e=>null!=e?e:"").join(",")).join("\n")},L=r.useMemo(()=>e.filter(e=>{var t,a,i,r;return(!k.evalId||(null===(t=e.evalId)||void 0===t?void 0:t.includes(k.evalId)))&&(!k.datasetId||(null===(a=e.datasetId)||void 0===a?void 0:a.startsWith(k.datasetId)))&&(!k.provider||(null===(i=e.provider)||void 0===i?void 0:i.includes(k.provider)))&&(!k.promptId||(null===(r=e.promptId)||void 0===r?void 0:r.startsWith(k.promptId)))}),[e,k]),D=r.useMemo(()=>L.sort((e,t)=>{if(!a)return 0;if("passRate"===a){let a=parseFloat(O(e.metrics)),i=parseFloat(O(t.metrics));return"asc"===I?a-i:i-a}if(a in e&&a in t){let i=e[a]||"",r=t[a]||"";return"asc"===I?i.toString().localeCompare(r.toString()):r.toString().localeCompare(i.toString())}return 0}),[L,a,I]),E=r.useMemo(()=>Array.from(new Set(e.map(e=>e.evalId))),[e]),V=r.useMemo(()=>Array.from(new Set(e.map(e=>e.datasetId))),[e]),N=r.useMemo(()=>Array.from(new Set(e.map(e=>e.provider))),[e]),z=r.useMemo(()=>Array.from(new Set(e.map(e=>e.promptId))),[e]);return(0,i.jsxs)(l.Z,{paddingX:2,children:[(0,i.jsxs)(l.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,i.jsx)("h2",{children:"Progress summary"}),(0,i.jsxs)("div",{children:[(0,i.jsx)(d.Z,{id:"export-button","aria-controls":M?"export-menu":void 0,"aria-haspopup":"true","aria-expanded":M?"true":void 0,onClick:e=>{y(e.currentTarget)},startIcon:(0,i.jsx)(c.Z,{}),children:"Export"}),(0,i.jsxs)(u.Z,{id:"export-menu",anchorEl:b,open:M,onClose:()=>{y(null)},MenuListProps:{"aria-labelledby":"export-button"},children:[(0,i.jsx)(p.Z,{onClick:()=>$("csv"),children:"CSV"}),(0,i.jsx)(p.Z,{onClick:()=>$("json"),children:"JSON"})]})]})]}),(0,i.jsx)(l.Z,{children:"This page shows performance metrics for recent evals."}),(0,i.jsxs)(l.Z,{display:"flex",flexDirection:"row",gap:2,mt:2,children:[(0,i.jsx)(o.Z,{options:E,value:k.evalId,onChange:(e,t)=>{F({...k,evalId:t||""})},renderInput:e=>(0,i.jsx)(C.Z,{...e,label:"Eval ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,i.jsx)(o.Z,{options:V,value:k.datasetId,onChange:(e,t)=>{F({...k,datasetId:t||""})},renderInput:e=>(0,i.jsx)(C.Z,{...e,label:"Dataset ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,i.jsx)(o.Z,{options:N,value:k.provider,onChange:(e,t)=>{F({...k,provider:t||""})},renderInput:e=>(0,i.jsx)(C.Z,{...e,label:"Provider",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}}),(0,i.jsx)(o.Z,{options:z,value:k.promptId,onChange:(e,t)=>{F({...k,promptId:t||""})},renderInput:e=>(0,i.jsx)(C.Z,{...e,label:"Prompt ID",variant:"outlined",size:"small",fullWidth:!0}),sx:{width:220}})]}),(0,i.jsxs)(m.Z,{children:[(0,i.jsx)(f.Z,{children:(0,i.jsxs)(Z.Z,{children:[(0,i.jsx)(x.Z,{children:(0,i.jsx)(g.Z,{active:"evalId"===a,direction:"evalId"===a?I:"asc",onClick:()=>S("evalId"),children:"Eval"})}),(0,i.jsx)(x.Z,{children:"Dataset"}),(0,i.jsx)(x.Z,{children:"Provider"}),(0,i.jsx)(x.Z,{children:"Prompt"}),(0,i.jsx)(x.Z,{children:(0,i.jsx)(g.Z,{active:"passRate"===a,direction:"passRate"===a?I:"asc",onClick:()=>S("passRate"),children:"Pass Rate %"})}),(0,i.jsx)(x.Z,{children:(0,i.jsx)(g.Z,{active:"testPassCount"===a,direction:"testPassCount"===a?I:"asc",onClick:()=>S("testPassCount"),children:"Pass Count"})}),(0,i.jsx)(x.Z,{children:(0,i.jsx)(g.Z,{active:"testFailCount"===a,direction:"testFailCount"===a?I:"asc",onClick:()=>S("testFailCount"),children:"Fail Count"})}),(0,i.jsx)(x.Z,{children:(0,i.jsx)(g.Z,{active:"score"===a,direction:"score"===a?I:"asc",onClick:()=>S("score"),children:"Raw score"})})]})}),(0,i.jsx)(h.Z,{children:D.slice((w-1)*25,25*w).map((e,t)=>{var a,r,n,o,l;return(0,i.jsxs)(Z.Z,{hover:!0,onClick:()=>F({...k,evalId:e.evalId,datasetId:e.datasetId||"",promptId:e.promptId||"",provider:e.provider}),children:[(0,i.jsx)(x.Z,{children:(0,i.jsx)(s(),{href:"/eval?evalId=".concat(e.evalId),onClick:e=>e.stopPropagation(),children:e.evalId})}),(0,i.jsx)(x.Z,{children:(0,i.jsx)(s(),{href:"/datasets?id=".concat(e.datasetId),onClick:e=>e.stopPropagation(),children:null===(a=e.datasetId)||void 0===a?void 0:a.slice(0,6)})}),(0,i.jsx)(x.Z,{children:e.provider}),(0,i.jsxs)(x.Z,{children:[(0,i.jsxs)(s(),{href:"/prompts?id=".concat(e.promptId),onClick:e=>e.stopPropagation(),children:["[",null===(r=e.promptId)||void 0===r?void 0:r.slice(0,6),"]"]})," ",e.raw]}),(0,i.jsx)(x.Z,{children:O(e.metrics)}),(0,i.jsx)(x.Z,{children:(null===(n=e.metrics)||void 0===n?void 0:n.testPassCount)==null?"-":"".concat(e.metrics.testPassCount)}),(0,i.jsx)(x.Z,{children:(null===(o=e.metrics)||void 0===o?void 0:o.testFailCount)==null?"-":"".concat(e.metrics.testFailCount)}),(0,i.jsx)(x.Z,{children:(null===(l=e.metrics)||void 0===l?void 0:l.score)==null?"-":e.metrics.score.toFixed(2)})]},t)})})]}),Math.ceil(L.length/25)>1&&(0,i.jsx)(v.Z,{count:Math.ceil(D.length/25),page:w,onChange:(e,t)=>P(t),sx:{pt:2,pb:4,display:"flex",justifyContent:"center"}})]})}}},function(e){e.O(0,[547,602,72,975,414,261,21,971,596,744],function(){return e(e.s=932)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[794],{8050:function(e,t,n){Promise.resolve().then(n.bind(n,176))},2810:function(e,t,n){"use strict";let i,s;async function l(){if(i||(s||(s=fetch("/api/config").then(e=>e.json()).then(e=>i=e.apiBaseUrl)),await s),void 0===i)throw Error("API base URL is undefined");return i}n.d(t,{b:function(){return l}})},176:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return I}});var i=n(7437),s=n(2265),l=n(1396),r=n.n(l),c=n(6507),d=n(2492),a=n(3701),o=n(9279),h=n(666),u=n(6988),x=n(4147),j=n(5781),Z=n(8276),v=n(4033),p=n(2810),f=n(9394),m=n(2834),w=n(6337),y=n(1797),C=n(5446),g=n(3226),E=n(5551),k=e=>{var t;let{openDialog:n,handleClose:s,selectedPrompt:l}=e;return(0,i.jsxs)(f.Z,{open:n,onClose:s,fullWidth:!0,maxWidth:"lg",children:[(0,i.jsxs)(y.Z,{children:["Prompt ",l.id.slice(0,6)]}),(0,i.jsxs)(w.Z,{children:[(0,i.jsx)(g.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Prompt"}),(0,i.jsx)(C.u,{readOnly:!0,value:null==l?void 0:null===(t=l.prompt)||void 0===t?void 0:t.raw,style:{width:"100%",padding:"0.75rem"},maxRows:50}),(0,i.jsx)(g.Z,{variant:"h6",style:{marginTop:"1rem"},children:"Used in..."}),(0,i.jsxs)(a.Z,{children:[(0,i.jsx)(u.Z,{children:(0,i.jsxs)(x.Z,{children:[(0,i.jsx)(h.Z,{children:"Eval ID"}),(0,i.jsx)(h.Z,{children:"Dataset ID"}),(0,i.jsx)(h.Z,{children:"Raw score"}),(0,i.jsx)(h.Z,{children:"Pass rate"}),(0,i.jsx)(h.Z,{children:"Pass count"}),(0,i.jsx)(h.Z,{children:"Fail count"})]})}),(0,i.jsx)(o.Z,{children:null==l?void 0:l.evals.sort((e,t)=>t.id.localeCompare(e.id)).map(e=>{var t,n,s,l,c,d;let a=null!==(l=null===(t=e.metrics)||void 0===t?void 0:t.testPassCount)&&void 0!==l?l:0,o=null!==(c=null===(n=e.metrics)||void 0===n?void 0:n.testFailCount)&&void 0!==c?c:0,u=a+o>0?(a/(a+o)*100).toFixed(2)+"%":"-";return(0,i.jsxs)(x.Z,{children:[(0,i.jsx)(h.Z,{children:(0,i.jsx)(r(),{href:"/eval/?evalId=".concat(e.id),children:e.id})}),(0,i.jsx)(h.Z,{children:(0,i.jsx)(r(),{href:"/datasets/?id=".concat(e.datasetId),children:e.datasetId.slice(0,6)})}),(0,i.jsx)(h.Z,{children:null!==(d=null===(s=e.metrics)||void 0===s?void 0:s.score.toFixed(2))&&void 0!==d?d:"-"}),(0,i.jsx)(h.Z,{children:u}),(0,i.jsx)(h.Z,{children:a}),(0,i.jsx)(h.Z,{children:o})]},"eval-".concat(e.id))})})]})]}),(0,i.jsx)(m.Z,{children:(0,i.jsx)(E.Z,{onClick:s,children:"Close"})})]})};function I(){let e=(0,v.useSearchParams)(),[t,n]=(0,s.useState)([]),[l,f]=(0,s.useState)("date"),[m,w]=(0,s.useState)("desc"),[y,C]=(0,s.useState)(1),[g,E]=(0,s.useState)(10),[I,P]=(0,s.useState)(!1),[S,D]=(0,s.useState)(0),b=e=>{let t=l===e&&"asc"===m?"desc":"asc";f(e),w(t)};(0,s.useEffect)(()=>{(async()=>{fetch("".concat(await (0,p.b)(),"/api/prompts")).then(e=>e.json()).then(e=>{let t=[...e.data].sort((e,t)=>null===l?0:"asc"===m?e[l]>t[l]?1:-1:e[l]<t[l]?1:-1);n(t)})})()},[l,m]),(0,s.useEffect)(()=>{let n=null==e?void 0:e.get("id");if(n){let e=t.findIndex(e=>e.id.startsWith(n));-1!==e&&_(e)}},[t,e]);let _=e=>{P(!0),D(e)};return(0,i.jsxs)(c.Z,{paddingX:2,children:[(0,i.jsxs)(a.Z,{children:[(0,i.jsx)(u.Z,{children:(0,i.jsxs)(x.Z,{children:[(0,i.jsx)(h.Z,{style:{width:"10%"},children:"ID"}),(0,i.jsx)(h.Z,{style:{width:"60%"},children:(0,i.jsx)(j.Z,{active:"raw"===l,direction:"raw"===l?m:"asc",onClick:()=>b("raw"),children:"Prompt"})}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:(0,i.jsx)(Z.Z,{title:"The date of the most recent eval for this prompt",children:(0,i.jsx)(j.Z,{active:"date"===l,direction:"date"===l?m:"asc",onClick:()=>b("date"),children:"Most recent eval"})})}),(0,i.jsx)(h.Z,{style:{width:"10%"},children:(0,i.jsx)(j.Z,{active:"count"===l,direction:"count"===l?m:"asc",onClick:()=>b("count"),children:"# Evals"})})]})}),(0,i.jsx)(o.Z,{children:t.slice((y-1)*g,y*g).map((e,t)=>(0,i.jsxs)(x.Z,{hover:!0,children:[(0,i.jsx)(h.Z,{style:{width:"10%"},children:e.id.slice(0,6)}),(0,i.jsx)(h.Z,{style:{width:"60%",whiteSpace:"pre-wrap",cursor:"pointer"},onClick:()=>_(t),children:e.prompt.raw.length>500?e.prompt.raw.slice(0,500)+"...":e.prompt.raw}),(0,i.jsx)(h.Z,{style:{width:"20%"},children:e.recentEvalDate?(0,i.jsx)(r(),{href:"/eval?evalId=".concat(e.recentEvalId),children:e.recentEvalDate.slice(0,10)}):"Unknown"}),(0,i.jsx)(h.Z,{style:{width:"10%"},children:e.count})]},t))})]}),Math.ceil(t.length/g)>1&&(0,i.jsx)(d.Z,{count:Math.ceil(t.length/g),page:y,onChange:(e,t)=>C(t)}),t[S]&&(0,i.jsx)(k,{openDialog:I,handleClose:()=>{P(!1)},selectedPrompt:t[S]})]})}},4033:function(e,t,n){e.exports=n(8165)}},function(e){e.O(0,[547,602,414,113,21,971,596,744],function(){return e(e.s=8050)}),_N_E=e.O()}]);