super-time-tracker-ui 0.1.45 → 0.1.46
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.
- package/dist/standalone/next-output/BUILD_ID +1 -1
- package/dist/standalone/next-output/app-path-routes-manifest.json +2 -0
- package/dist/standalone/next-output/build-manifest.json +3 -3
- package/dist/standalone/next-output/routes-manifest.json +12 -0
- package/dist/standalone/next-output/server/app/_global-error.html +1 -1
- package/dist/standalone/next-output/server/app/_global-error.rsc +1 -1
- package/dist/standalone/next-output/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dist/standalone/next-output/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/standalone/next-output/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/standalone/next-output/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/standalone/next-output/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/standalone/next-output/server/app/_not-found/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/_not-found/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/api/command-palette/route.js +1 -1
- package/dist/standalone/next-output/server/app/api/command-palette/route.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/api/entries/search/route.js +1 -1
- package/dist/standalone/next-output/server/app/api/entries/search/route.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/api/entry/completed/route.js +1 -1
- package/dist/standalone/next-output/server/app/api/entry/completed/route.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/api/entry/delete-bulk/route.js +1 -1
- package/dist/standalone/next-output/server/app/api/entry/delete-bulk/route.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/api/entry/merge/route.js +1 -1
- package/dist/standalone/next-output/server/app/api/entry/merge/route.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/api/entry/move/route.js +1 -1
- package/dist/standalone/next-output/server/app/api/entry/move/route.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/api/entry/move-bulk/route.js +1 -1
- package/dist/standalone/next-output/server/app/api/entry/move-bulk/route.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/api/entry/route.js +1 -1
- package/dist/standalone/next-output/server/app/api/entry/route.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/api/entry/split/route.js +1 -1
- package/dist/standalone/next-output/server/app/api/entry/split/route.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/api/in/route.js +1 -1
- package/dist/standalone/next-output/server/app/api/in/route.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/api/note/delete/route.js +1 -1
- package/dist/standalone/next-output/server/app/api/note/delete/route.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/api/note/route.js +1 -1
- package/dist/standalone/next-output/server/app/api/note/route.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/api/out/route.js +1 -1
- package/dist/standalone/next-output/server/app/api/out/route.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/api/sheet/route.js +1 -1
- package/dist/standalone/next-output/server/app/api/sheet/route.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/api/state/route.js +1 -1
- package/dist/standalone/next-output/server/app/api/state/route.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/api/task/route/app-paths-manifest.json +3 -0
- package/dist/standalone/next-output/server/app/api/task/route/build-manifest.json +9 -0
- package/dist/standalone/next-output/server/app/api/task/route/server-reference-manifest.json +4 -0
- package/dist/standalone/next-output/server/app/api/task/route.js +6 -0
- package/dist/standalone/next-output/server/app/api/task/route.js.nft.json +1 -0
- package/dist/standalone/next-output/server/app/api/task/route_client-reference-manifest.js +3 -0
- package/dist/standalone/next-output/server/app/login/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/login/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/login/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/offline/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/offline/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/offline/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/page.js +3 -2
- package/dist/standalone/next-output/server/app/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/pomodoro/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/pomodoro/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/pomodoro/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/register/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/register/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/register/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/reporting/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/reporting/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/reporting/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/review/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/review/page.js +1 -1
- package/dist/standalone/next-output/server/app/review/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/review/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/search/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/search/page.js +1 -1
- package/dist/standalone/next-output/server/app/search/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/search/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/ai-suggestions/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/settings/ai-suggestions/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/ai-suggestions/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/cloud-sync/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/settings/cloud-sync/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/cloud-sync/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/data/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/settings/data/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/data/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/display/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/settings/display/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/display/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/goals/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/settings/goals/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/goals/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/notifications/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/settings/notifications/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/notifications/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/settings/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/pomodoro/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/settings/pomodoro/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/pomodoro/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/quick-actions/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/settings/quick-actions/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/quick-actions/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/settings/tags/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/settings/tags/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/settings/tags/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/sheets/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/sheets/page.js +1 -1
- package/dist/standalone/next-output/server/app/sheets/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/sheets/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/tasks/page/app-paths-manifest.json +3 -0
- package/dist/standalone/next-output/server/app/tasks/page/build-manifest.json +18 -0
- package/dist/standalone/next-output/server/app/tasks/page/next-font-manifest.json +11 -0
- package/dist/standalone/next-output/server/app/tasks/page/react-loadable-manifest.json +8 -0
- package/dist/standalone/next-output/server/app/tasks/page/server-reference-manifest.json +4 -0
- package/dist/standalone/next-output/server/app/tasks/page.js +15 -0
- package/dist/standalone/next-output/server/app/tasks/page.js.nft.json +1 -0
- package/dist/standalone/next-output/server/app/tasks/page_client-reference-manifest.js +3 -0
- package/dist/standalone/next-output/server/app/templates/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/templates/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/templates/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app/today/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/next-output/server/app/today/page.js +1 -1
- package/dist/standalone/next-output/server/app/today/page.js.nft.json +1 -1
- package/dist/standalone/next-output/server/app/today/page_client-reference-manifest.js +1 -1
- package/dist/standalone/next-output/server/app-paths-manifest.json +2 -0
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0-taz6n._.js +1 -1
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__00~g.6x._.js +1 -1
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__02ngfib._.js +3 -0
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__06666_b._.js +1 -1
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__06wq380._.js +1 -1
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0agceca._.js +3 -0
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0m-c-3t._.js +1 -1
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0m8yoxl._.js +3 -0
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0mft_cy._.js +2 -2
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0o-u0o6._.js +1 -1
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0pwxv6f._.js +3 -0
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0rv02cm._.js +3 -0
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0tk~k.1._.js +3 -0
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0wdwx.8._.js +1 -1
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0wj1pxh._.js +1 -1
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0~22xdv._.js +1 -1
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__137-7ty._.js +3 -0
- package/dist/standalone/next-output/server/chunks/_next-internal_server_app_api_task_route_actions_12ylnj2.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/0prs_next_dist_esm_build_templates_app-page_0ki.wrf.js +4 -0
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__0.9xlwz._.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__0.g3pd4._.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__02n0dvz._.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__04flz4-._.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__05o8b_c._.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__08jp.ha._.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__08mtp44._.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__0_y9w.y._.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__0fvs04n._.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__0gmlwng._.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__0il5~uq._.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__0ou-jv5._.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__0p4w3_0._.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__0sx0ra6._.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__0u.h8zx._.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__0v5-roe._.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/_02oputi._.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/_040~8u~._.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/_04wup-5._.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/_05t~0qd._.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/_08~9-.f._.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/_092k549._.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/_0_0w8kz._.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/_0bypypo._.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/_0e_h4bk._.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/_0lp.vd1._.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/_0mdf7jn._.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/_0sic8ed._.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/_0t7z076._.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/{_028bo2r._.js → _0~6f4kw._.js} +2 -2
- package/dist/standalone/next-output/server/chunks/ssr/_10n.q--._.js +1 -1
- package/dist/standalone/next-output/server/chunks/ssr/_next-internal_server_app_tasks_page_actions_0_2o_cr.js +3 -0
- package/dist/standalone/next-output/server/chunks/ssr/components_reporting-view_tsx_0-0ofcv._.js +1 -1
- package/dist/standalone/next-output/server/middleware-build-manifest.js +3 -3
- package/dist/standalone/next-output/server/next-font-manifest.js +1 -1
- package/dist/standalone/next-output/server/next-font-manifest.json +4 -0
- package/dist/standalone/next-output/server/pages/500.html +1 -1
- package/dist/standalone/next-output/static/chunks/0-3kyxhxw4bbj.js +1 -0
- package/dist/standalone/next-output/static/chunks/0-408g-._49ss.js +1 -0
- package/dist/standalone/next-output/static/chunks/0-cegmvshy7~a.js +1 -0
- package/dist/standalone/next-output/static/chunks/0-vzgnzke5d_x.js +1 -0
- package/dist/standalone/next-output/static/chunks/0.dc4~0qlrrmq.js +1 -0
- package/dist/standalone/next-output/static/chunks/00kyekysf5.rz.js +1 -0
- package/dist/standalone/next-output/static/chunks/0ad60i1-~p1p9.js +1 -0
- package/dist/standalone/next-output/static/chunks/0bp_fueuuzc3l.js +1 -0
- package/dist/standalone/next-output/static/chunks/0d.t1amf2zp1y.js +1 -0
- package/dist/standalone/next-output/static/chunks/0f1u1npfh1b-o.js +1 -0
- package/dist/standalone/next-output/static/chunks/0fcd7jg.xwz~d.js +1 -0
- package/dist/standalone/next-output/static/chunks/0gkw9_fpp4r.i.js +1 -0
- package/dist/standalone/next-output/static/chunks/0hiigo7crs4m1.js +1 -0
- package/dist/standalone/next-output/static/chunks/{15hds0xz6b5ce.js → 0k-swz.-tm1g3.js} +1 -1
- package/dist/standalone/next-output/static/chunks/0l-z2n83y2aa2.js +1 -0
- package/dist/standalone/next-output/static/chunks/0njsx8jnl8cgg.js +1 -0
- package/dist/standalone/next-output/static/chunks/{0ya1a.o~xsixd.js → 0np820b81oc9m.js} +1 -1
- package/dist/standalone/next-output/static/chunks/0pgfu2rxbx5z2.js +1 -0
- package/dist/standalone/next-output/static/chunks/0puu5bj-k_hz9.js +1 -0
- package/dist/standalone/next-output/static/chunks/0qsrkbt.l5i70.js +1 -0
- package/dist/standalone/next-output/static/chunks/0tumi91py-w0x.js +1 -0
- package/dist/standalone/next-output/static/chunks/0unkbkr3scujr.js +1 -0
- package/dist/standalone/next-output/static/chunks/{0-niex.k_xqnu.js → 0wj9lgwud1gqj.js} +1 -1
- package/dist/standalone/next-output/static/chunks/0xv~-o0b9qigv.css +3 -0
- package/dist/standalone/next-output/static/chunks/0zi_5_ssa1_j-.js +1 -0
- package/dist/standalone/next-output/static/chunks/0~og7w2d0fi8k.js +1 -0
- package/dist/standalone/next-output/static/chunks/13-.m15df8.b8.js +1 -0
- package/dist/standalone/next-output/static/chunks/13hyb9n2laeam.js +1 -0
- package/dist/standalone/package.json +1 -1
- package/package.json +1 -1
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__06h__d_._.js +0 -3
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0_b50~5._.js +0 -3
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0eruj62._.js +0 -3
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0g4.zxh._.js +0 -3
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0hasizg._.js +0 -3
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0jlfmb8._.js +0 -3
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0m~u8g4._.js +0 -3
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0nx-vwn._.js +0 -3
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0rl2w7-._.js +0 -3
- package/dist/standalone/next-output/server/chunks/[root-of-the-server]__0yqw7pu._.js +0 -3
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__03dwgvv._.js +0 -3
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__06jwkua._.js +0 -3
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__078pqlk._.js +0 -3
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__09~j2of._.js +0 -3
- package/dist/standalone/next-output/server/chunks/ssr/[root-of-the-server]__0njhf-m._.js +0 -3
- package/dist/standalone/next-output/server/chunks/ssr/_02fm6gp._.js +0 -3
- package/dist/standalone/next-output/server/chunks/ssr/_07q4l3.._.js +0 -3
- package/dist/standalone/next-output/server/chunks/ssr/_0aaepl8._.js +0 -3
- package/dist/standalone/next-output/server/chunks/ssr/_0ja6w18._.js +0 -3
- package/dist/standalone/next-output/server/chunks/ssr/_0rhx88g._.js +0 -3
- package/dist/standalone/next-output/server/chunks/ssr/_0y9lue.._.js +0 -3
- package/dist/standalone/next-output/server/chunks/ssr/_0zatphu._.js +0 -3
- package/dist/standalone/next-output/static/chunks/048hg7.kf50p6.js +0 -1
- package/dist/standalone/next-output/static/chunks/099rnw4-qk_33.js +0 -1
- package/dist/standalone/next-output/static/chunks/09p9p33-jf6p_.js +0 -1
- package/dist/standalone/next-output/static/chunks/0_8ps~_e8~ea7.js +0 -1
- package/dist/standalone/next-output/static/chunks/0cnb9ojb1.4_s.js +0 -1
- package/dist/standalone/next-output/static/chunks/0f.g~ypqld4i2.js +0 -1
- package/dist/standalone/next-output/static/chunks/0feo1c5hcq~fw.js +0 -1
- package/dist/standalone/next-output/static/chunks/0gc_4fwvsadx9.js +0 -1
- package/dist/standalone/next-output/static/chunks/0lbfeprw3roep.js +0 -1
- package/dist/standalone/next-output/static/chunks/0lw-y46eplh.w.js +0 -1
- package/dist/standalone/next-output/static/chunks/0ni97tabbd6ql.js +0 -1
- package/dist/standalone/next-output/static/chunks/0q_cw2e3uj20q.js +0 -1
- package/dist/standalone/next-output/static/chunks/0qc9jf34l6_d8.js +0 -1
- package/dist/standalone/next-output/static/chunks/0r9inu-z~8h4p.js +0 -1
- package/dist/standalone/next-output/static/chunks/0s7b~rp4s3q9q.js +0 -1
- package/dist/standalone/next-output/static/chunks/0t~0aam6r_eto.js +0 -1
- package/dist/standalone/next-output/static/chunks/0ua4wv84cw5ds.js +0 -1
- package/dist/standalone/next-output/static/chunks/0vmr-fgq74aqi.js +0 -1
- package/dist/standalone/next-output/static/chunks/0vudo56ulr706.js +0 -1
- package/dist/standalone/next-output/static/chunks/0wd.8~gqkz5cp.css +0 -3
- package/dist/standalone/next-output/static/chunks/11~k89a6fiu2w.js +0 -1
- package/dist/standalone/next-output/static/chunks/16tc8vh998e~1.js +0 -1
- /package/dist/standalone/next-output/static/{y7QrkWDtEEq8SX6iBgDNU → 4G6Gtdu0DdRdBmSmuydRA}/_buildManifest.js +0 -0
- /package/dist/standalone/next-output/static/{y7QrkWDtEEq8SX6iBgDNU → 4G6Gtdu0DdRdBmSmuydRA}/_clientMiddlewareManifest.js +0 -0
- /package/dist/standalone/next-output/static/{y7QrkWDtEEq8SX6iBgDNU → 4G6Gtdu0DdRdBmSmuydRA}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},68194,e=>{"use strict";var t=e.i(76386);e.s(["api_error_response",0,function(e,r=400){let n=e instanceof Error?e.message:String(e);return t.NextResponse.json({error:n},{status:r})}])},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},72507,e=>{"use strict";var t=e.i(60526),r=e.i(50227);let n="db.json",s=r.default.join(t.default.homedir(),".super-time-tracker"),a=r.default.join(s,n);e.s(["DB_FILE_NAME",0,n,"DB_PATH",0,a,"DB_VERSION",0,4,"DEFAULT_SHEET_NAME",0,"main"])},72127,30853,e=>{"use strict";e.s(["convert_json_db",0,function(e){let{sheets:t,version:r,activeSheetName:n}=e;return{version:r,activeSheetName:n,sheets:t.map(({name:e,entries:t,activeEntryID:r,archived:n})=>({name:e,activeEntryID:r,...!0===n?{archived:!0}:{},entries:t.map(({id:e,start:t,end:r,description:n,tags:s,notes:a,archived:i})=>({id:e,description:n,tags:s,notes:a.map(({timestamp:e,text:t})=>({text:t,timestamp:new Date(e)})),start:new Date(t),end:null===r?null:new Date(r),...!0===i?{archived:!0}:{}}))}))}}],72127);var t=e.i(2157);async function r(e){try{await t.promises.mkdir(e,{recursive:!0})}catch(e){if("EEXIST"!==(null!==e&&"object"==typeof e&&"code"in e&&"string"==typeof e.code?e.code:null))throw e}}e.s(["ensure_dir_exists",0,r],30853)},93361,e=>{"use strict";var t=e.i(72507);function r(e,t=[],n=null){if(0===e.length)throw Error("New sheet name must not be empty");if(null!==n&&void 0===t.find(({id:e})=>e===n))throw Error("New sheet active entry does not exist");return{name:e,entries:t,activeEntryID:n}}e.s(["gen_db",0,function(){return{version:t.DB_VERSION,sheets:[r(t.DEFAULT_SHEET_NAME)],activeSheetName:t.DEFAULT_SHEET_NAME}},"gen_sheet",0,r])},24507,e=>{"use strict";var t=e.i(72507);let r={2:function(e){let{sheets:t,version:r,activeSheetName:n}=e;if(1!==r&&void 0!==r)throw Error(`DB is version ${r}, cannot migrate to version 2.`);return{version:2,activeSheetName:n,sheets:t.map(({name:e,entries:t,activeEntryID:r})=>({name:e,activeEntryID:r,entries:t.map(({id:e,start:t,end:r,description:n})=>({tags:[],notes:[],id:e,end:r,start:t,description:n}))}))}},3:function(e){let{sheets:t,version:r,activeSheetName:n}=e;if(2!==r&&void 0!==r)throw Error(`DB is version ${r}, cannot migrate to version 3.`);return{version:3,activeSheetName:n,sheets:t.map(({name:e,entries:t,activeEntryID:r})=>({name:e,activeEntryID:r,entries:t.map(({id:e,start:t,end:r,description:n,tags:s})=>({notes:[],tags:s,id:e,end:r,start:t,description:n}))}))}},4:function(e){let{version:t,activeSheetName:r,sheets:n}=e;if(3!==t)throw Error(`DB is version ${t}, cannot migrate to version 4.`);return{version:4,activeSheetName:r,sheets:n}}};e.s(["migrate_json_db",0,function(e){let n=e,s=!1,a=n.version??1;if(a>t.DB_VERSION||a<1)throw Error(`Unknown DB version ${n.version}, cannot load.`);for(;a<t.DB_VERSION;){let e=a+1,t=r[e];if(void 0===t)throw Error(`Missing migration from version ${a} to ${e}.`);if((n=t(n)).version!==e)throw Error(`Invalid migration output for version ${e}.`);a=e,s=!0}return{json_db:n,did_migrate:s}}],24507)},20253,e=>{"use strict";function t(e,t){let r=new Set,n=[];for(let s of[...e,...t]){let e=`${s.timestamp.getTime()}:${s.text}`;r.has(e)||(r.add(e),n.push(s))}return n.sort((e,t)=>e.timestamp.getTime()-t.timestamp.getTime()),n}e.s(["dedupe_sheet_entries_by_id",0,function(e){let r=new Map;for(let n of e){let e=r.get(n.id);if(void 0===e){r.set(n.id,n);continue}if(null===n.end&&null!==e.end){r.set(n.id,{...n,notes:t(n.notes,e.notes)});continue}if(null===e.end&&null!==n.end){r.set(n.id,{...e,notes:t(e.notes,n.notes)});continue}r.set(n.id,{...e,notes:t(e.notes,n.notes)})}return[...r.values()].sort((e,t)=>e.id-t.id)}],20253)},47143,e=>{"use strict";var t=e.i(20253);e.s(["dedupe_tracker_db_sheet_entries",0,function(e){let r=!1;for(let n of e.sheets){let e=(0,t.dedupe_sheet_entries_by_id)(n.entries);e.length!==n.entries.length&&(r=!0,n.entries=e)}return r}])},13690,e=>{"use strict";e.s(["find_running_entry_on_sheet",0,function(e){if(null===e.activeEntryID)return null;let t=e.entries.find(({id:t})=>t===e.activeEntryID);return t?.end!=null?null:t??null}])},62775,e=>{"use strict";var t=e.i(13690);e.s(["reconcile_stale_active_entry_ids",0,function(e){let r=!1;for(let n of e.sheets)null!==n.activeEntryID&&null===(0,t.find_running_entry_on_sheet)(n)&&(n.activeEntryID=null,r=!0);return r}])},16366,e=>{"use strict";e.s(["convert_db_to_json",0,function(e){let t=e.sheets.map(e=>({name:e.name,activeEntryID:e.activeEntryID,...!0===e.archived?{archived:!0}:{},entries:e.entries.map(e=>({id:e.id,description:e.description,tags:e.tags,start:e.start.getTime(),end:null===e.end?null:e.end.getTime(),notes:e.notes.map(e=>({text:e.text,timestamp:e.timestamp.getTime()})),...!0===e.archived?{archived:!0}:{}}))}));return{version:e.version,activeSheetName:e.activeSheetName,sheets:t}}])},71786,32806,e=>{"use strict";var t=e.i(50227),r=e.i(2157),n=e.i(72507),s=e.i(72127),a=e.i(30853),i=e.i(93361),o=e.i(24507),l=e.i(47143),u=e.i(62775),d=e.i(16366);async function c(e,t=n.DB_PATH){let s=JSON.stringify((0,d.convert_db_to_json)(e));try{await r.promises.writeFile(t,s)}catch(e){throw Error(`Failed to save DB: ${String(e)}`,{cause:e})}}async function p(e=n.DB_PATH){let d,v=t.default.dirname(e);await (0,a.ensure_dir_exists)(v);try{await r.promises.access(e)}catch{let t=(0,i.gen_db)();return await c(t,e),t}let m=await r.promises.readFile(e,"utf-8");try{d=JSON.parse(m)}catch(t){throw Error(`DB at ${e} is invalid JSON: ${String(t)}`,{cause:t})}let _=(0,o.migrate_json_db)(d);d=_.json_db;let h=(0,s.convert_json_db)(d),f=_.did_migrate,g=(0,u.reconcile_stale_active_entry_ids)(h),w=(0,l.dedupe_tracker_db_sheet_entries)(h);return(f||g||w)&&await c(h,e),h}e.s(["write_local_db",0,c],32806),e.s(["read_local_db",0,p],71786)},27440,e=>{"use strict";var t=e.i(49827),r=e.i(71786);let n=(0,t.cache)(async e=>(0,r.read_local_db)(e));e.s(["read_db",0,n])},72609,52455,13455,45196,58611,e=>{"use strict";let t=Symbol.for("constructDateFrom");function r(e,r){return"function"==typeof e?e(r):e&&"object"==typeof e&&t in e?e[t](r):e instanceof Date?new e.constructor(r):new Date(r)}function n(e,t){return r(t||e,e)}e.s(["constructFromSymbol",0,t,"millisecondsInHour",0,36e5,"millisecondsInMinute",0,6e4,"millisecondsInSecond",0,1e3,"millisecondsInWeek",0,6048e5],52455),e.s(["constructFrom",0,r],13455),e.s(["toDate",0,n],45196),e.s(["endOfDay",0,function(e,t){let r=n(e,t?.in);return r.setHours(23,59,59,999),r}],72609);let s={};e.s(["getDefaultOptions",0,function(){return s}],58611)},69856,e=>{"use strict";var t=e.i(45196);e.s(["startOfDay",0,function(e,r){let n=(0,t.toDate)(e,r?.in);return n.setHours(0,0,0,0),n}])},64457,e=>{"use strict";var t=e.i(58611),r=e.i(45196);e.s(["startOfWeek",0,function(e,n){let s=(0,t.getDefaultOptions)(),a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,i=(0,r.toDate)(e,n?.in),o=i.getDay();return i.setDate(i.getDate()-(7*(o<a)+o-a)),i.setHours(0,0,0,0),i}])},77052,e=>{"use strict";function t(e,r,n,s=Date.now()){let a=+e.start;return Math.max(0,Math.min(null===e.end?s:+e.end,n)-Math.max(a,r))}var r=e.i(72609),n=e.i(45196),s=e.i(58611),a=e.i(69856),i=e.i(64457);function o(e,t=new Date,l=1){var u;switch(e){case"week":let d,c,p,v;return{startMs:+(0,i.startOfWeek)(t,{weekStartsOn:l}),endMs:+(u={weekStartsOn:l},d=(0,s.getDefaultOptions)(),c=u?.weekStartsOn??u?.locale?.options?.weekStartsOn??d.weekStartsOn??d.locale?.options?.weekStartsOn??0,v=(p=(0,n.toDate)(t,u?.in)).getDay(),p.setDate(p.getDate()+((v<c?-7:0)+6-(v-c))),p.setHours(23,59,59,999),p)};case"month":let m,_,h;return{startMs:+((m=(0,n.toDate)(t,void 0)).setDate(1),m.setHours(0,0,0,0),m),endMs:+(h=(_=(0,n.toDate)(t,void 0)).getMonth(),_.setFullYear(_.getFullYear(),h+1,0),_.setHours(23,59,59,999),_)};default:return{startMs:+(0,a.startOfDay)(t),endMs:+(0,r.endOfDay)(t)}}}var l=e.i(27440);async function u({scope:e="global",sheet_name:r,tag_name:n,db:s}={}){let a=s??await (0,l.read_db)(),i=Date.now(),d=new Date(i),c=o("today",d),p=o("week",d),v=0,m=0,_={last_log_ms:null,active_timer_duration_ms:null};for(let s of a.sheets)for(let a of s.entries)(function(e){let{scope:t,sheet_name:r,tag_name:n,sheet_name_on_entry:s,entry:a}=e;return!!("global"===t||"sheet"===t&&void 0!==r&&s===r||"tag"===t&&void 0!==n&&a.tags.includes(n))})({scope:e,sheet_name:r,tag_name:n,sheet_name_on_entry:s.name,entry:a})&&(v+=t(a,c.startMs,c.endMs,i),m+=t(a,p.startMs,p.endMs,i)),_=function(e,t,r){let n=+e.start,s=null===e.end?null:+e.end,a=null===s?n:Math.max(n,s),i=null===r.last_log_ms||a>r.last_log_ms?a:r.last_log_ms;if(null!==e.end)return{last_log_ms:i,active_timer_duration_ms:r.active_timer_duration_ms};let o=Math.max(0,t-n);return{last_log_ms:i,active_timer_duration_ms:null===r.active_timer_duration_ms||o>r.active_timer_duration_ms?o:r.active_timer_duration_ms}}(a,i,_);let h=null!==_.active_timer_duration_ms||null===_.last_log_ms?null:Math.floor((i-_.last_log_ms)/6e4);return{todayTrackedMs:v,weekTrackedMs:m,activeTimerDurationMs:_.active_timer_duration_ms,minutesSinceLastLog:h}}e.s(["get_focus_nudges_status",0,u],77052)},90781,e=>{"use strict";var t=e.i(4394),r=e.i(45404),n=e.i(60016),s=e.i(33535),a=e.i(46593),i=e.i(10659),o=e.i(3644),l=e.i(31269),u=e.i(13865),d=e.i(65034),c=e.i(81157),p=e.i(82614),v=e.i(24377),m=e.i(57949),_=e.i(9566),h=e.i(93695);e.i(46179);var f=e.i(42108),g=e.i(76386),w=e.i(68194),E=e.i(77052);async function x(e){try{let t=new URL(e.url),r=t.searchParams.get("scope"),n=t.searchParams.get("sheet")??void 0,s=t.searchParams.get("tag")??void 0,a=await (0,E.get_focus_nudges_status)({scope:"sheet"===r||"tag"===r?r:"global",sheet_name:n,tag_name:s});return g.NextResponse.json(a)}catch(e){return(0,w.api_error_response)(e,500)}}e.s(["GET",0,x],47860);var y=e.i(47860);let D=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/focus-nudges/status/route",pathname:"/api/focus-nudges/status",filename:"route",bundlePath:""},distDir:"next-output",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/focus-nudges/status/route.ts",nextConfigOutput:"standalone",userland:y,...{}}),{workAsyncStorage:R,workUnitAsyncStorage:S,serverHooks:b}=D;async function N(e,t,n){n.requestMeta&&(0,s.setRequestMeta)(e,n.requestMeta),D.isDev&&(0,s.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/focus-nudges/status/route";g=g.replace(/\/index$/,"")||"/";let w=await D.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:E,deploymentId:x,params:y,nextConfig:R,parsedUrl:S,isDraftMode:b,prerenderManifest:N,routerServerContext:O,isOnDemandRevalidate:T,revalidateOnlyGenerated:k,resolvedPathname:M,clientReferenceManifest:A,serverActionsManifest:I}=w,C=(0,o.normalizeAppPath)(g),j=!!(N.dynamicRoutes[C]||N.routes[M]),H=async()=>((null==O?void 0:O.render404)?await O.render404(e,t,S,!1):t.end("This page could not be found"),null);if(j&&!b){let e=!!N.routes[M],t=N.dynamicRoutes[C];if(t&&!1===t.fallback&&!e){if(R.adapterPath)return await H();throw new h.NoFallbackError}}let P=null;!j||D.isDev||b||(P="/index"===(P=M)?"/":P);let q=!0===D.isDev||!j,U=j&&!q;I&&A&&(0,i.setManifestsSingleton)({page:g,clientReferenceManifest:A,serverActionsManifest:I});let $=e.method||"GET",B=(0,a.getTracer)(),F=B.getActiveScopeSpan(),L=!!(null==O?void 0:O.isWrappedByNextServer),K=!!(0,s.getRequestMeta)(e,"minimalMode"),V=(0,s.getRequestMeta)(e,"incrementalCache")||await D.getIncrementalCache(e,R,N,K);null==V||V.resetRequestCache(),globalThis.__incrementalCache=V;let W={params:y,previewProps:N.preview,renderOpts:{experimental:{authInterrupts:!!R.experimental.authInterrupts},cacheComponents:!!R.cacheComponents,supportsDynamicResponse:q,incrementalCache:V,cacheLifeProfiles:R.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,s)=>D.onRequestError(e,t,n,s,O)},sharedContext:{buildId:E,deploymentId:x}},G=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),J=u.NextRequestAdapter.fromNodeNextRequest(G,(0,u.signalFromNodeResponse)(t));try{let s,i=async e=>D.handle(J,W).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=B.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${$} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),s&&s!==e&&(s.setAttribute("http.route",n),s.updateName(t))}else e.updateName(`${$} ${g}`)}),o=async s=>{var a,o;let l=async({previousCacheEntry:r})=>{try{if(!K&&T&&k&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await i(s);e.fetchMetrics=W.renderOpts.fetchMetrics;let o=W.renderOpts.pendingWaitUntil;o&&n.waitUntil&&(n.waitUntil(o),o=void 0);let l=W.renderOpts.collectedTags;if(!j)return await (0,p.sendResponse)(G,X,a,W.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,v.toNodeOutgoingHttpHeaders)(a.headers);l&&(t[_.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=_.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,n=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=_.INFINITE_CACHE?void 0:W.renderOpts.collectedExpire;return{value:{kind:f.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await D.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:T})},!1,O),t}},u=await D.handleResponse({req:e,nextConfig:R,cacheKey:P,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:k,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:K});if(!j)return null;if((null==u||null==(a=u.value)?void 0:a.kind)!==f.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(o=u.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",T?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),b&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,v.fromNodeOutgoingHttpHeaders)(u.value.headers);return K&&j||d.delete(_.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,m.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(G,X,new Response(u.value.body,{headers:d,status:u.value.status||200})),null};L&&F?await o(F):(s=B.getActiveScopeSpan(),await B.withPropagatedContext(e.headers,()=>B.trace(d.BaseServerSpan.handleRequest,{spanName:`${$} ${g}`,kind:a.SpanKind.SERVER,attributes:{"http.method":$,"http.target":e.url}},o),void 0,!L))}catch(t){if(t instanceof h.NoFallbackError||await D.onRequestError(e,t,{routerKind:"App Router",routePath:C,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:T})},!1,O),j)throw t;return await (0,p.sendResponse)(G,X,new Response(null,{status:500})),null}}e.s(["handler",0,N,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:R,workUnitAsyncStorage:S})},"routeModule",0,D,"serverHooks",0,b,"workAsyncStorage",0,R,"workUnitAsyncStorage",0,S],90781)}];
|
|
1
|
+
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},68194,e=>{"use strict";var t=e.i(76386);e.s(["api_error_response",0,function(e,r=400){let n=e instanceof Error?e.message:String(e);return t.NextResponse.json({error:n},{status:r})}])},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},72507,e=>{"use strict";var t=e.i(60526),r=e.i(50227);let n="db.json",s=r.default.join(t.default.homedir(),".super-time-tracker"),a=r.default.join(s,n);e.s(["DB_FILE_NAME",0,n,"DB_PATH",0,a,"DB_VERSION",0,5,"DEFAULT_SHEET_NAME",0,"main"])},72127,30853,e=>{"use strict";e.s(["convert_json_db",0,function(e){let{sheets:t,version:r,activeSheetName:n}=e;return{version:r,activeSheetName:n,sheets:t.map(({name:e,entries:t,tasks:r,activeEntryID:n,archived:s})=>({name:e,activeEntryID:n,...!0===s?{archived:!0}:{},tasks:(r??[]).map(({id:e,title:t,createdAt:r,updatedAt:n,completedAt:s})=>({id:e,title:t,createdAt:new Date(r),updatedAt:new Date(n),completedAt:null===s?null:new Date(s)})),entries:t.map(({id:e,start:t,end:r,description:n,tags:s,notes:a,archived:i})=>({id:e,description:n,tags:s,notes:a.map(({timestamp:e,text:t})=>({text:t,timestamp:new Date(e)})),start:new Date(t),end:null===r?null:new Date(r),...!0===i?{archived:!0}:{}}))}))}}],72127);var t=e.i(2157);async function r(e){try{await t.promises.mkdir(e,{recursive:!0})}catch(e){if("EEXIST"!==(null!==e&&"object"==typeof e&&"code"in e&&"string"==typeof e.code?e.code:null))throw e}}e.s(["ensure_dir_exists",0,r],30853)},93361,e=>{"use strict";var t=e.i(72507);function r(e,t=[],n=null,s=[]){if(0===e.length)throw Error("New sheet name must not be empty");if(null!==n&&void 0===t.find(({id:e})=>e===n))throw Error("New sheet active entry does not exist");return{name:e,entries:t,tasks:s,activeEntryID:n}}e.s(["gen_db",0,function(){return{version:t.DB_VERSION,sheets:[r(t.DEFAULT_SHEET_NAME)],activeSheetName:t.DEFAULT_SHEET_NAME}},"gen_sheet",0,r])},24507,e=>{"use strict";var t=e.i(72507);let r={2:function(e){let{sheets:t,version:r,activeSheetName:n}=e;if(1!==r&&void 0!==r)throw Error(`DB is version ${r}, cannot migrate to version 2.`);return{version:2,activeSheetName:n,sheets:t.map(({name:e,entries:t,activeEntryID:r})=>({name:e,activeEntryID:r,tasks:[],entries:t.map(({id:e,start:t,end:r,description:n})=>({tags:[],notes:[],id:e,end:r,start:t,description:n}))}))}},3:function(e){let{sheets:t,version:r,activeSheetName:n}=e;if(2!==r&&void 0!==r)throw Error(`DB is version ${r}, cannot migrate to version 3.`);return{version:3,activeSheetName:n,sheets:t.map(({name:e,entries:t,activeEntryID:r})=>({name:e,activeEntryID:r,tasks:[],entries:t.map(({id:e,start:t,end:r,description:n,tags:s})=>({notes:[],tags:s,id:e,end:r,start:t,description:n}))}))}},4:function(e){let{version:t,activeSheetName:r,sheets:n}=e;if(3!==t)throw Error(`DB is version ${t}, cannot migrate to version 4.`);return{version:4,activeSheetName:r,sheets:n}},5:function(e){let{version:t,activeSheetName:r,sheets:n}=e;if(4!==t)throw Error(`DB is version ${t}, cannot migrate to version 5.`);return{version:5,activeSheetName:r,sheets:n.map(e=>({...e,tasks:e.tasks??[]}))}}};e.s(["migrate_json_db",0,function(e){let n=e,s=!1,a=n.version??1;if(a>t.DB_VERSION||a<1)throw Error(`Unknown DB version ${n.version}, cannot load.`);for(;a<t.DB_VERSION;){let e=a+1,t=r[e];if(void 0===t)throw Error(`Missing migration from version ${a} to ${e}.`);if((n=t(n)).version!==e)throw Error(`Invalid migration output for version ${e}.`);a=e,s=!0}return{json_db:n,did_migrate:s}}],24507)},20253,e=>{"use strict";function t(e,t){let r=new Set,n=[];for(let s of[...e,...t]){let e=`${s.timestamp.getTime()}:${s.text}`;r.has(e)||(r.add(e),n.push(s))}return n.sort((e,t)=>e.timestamp.getTime()-t.timestamp.getTime()),n}e.s(["dedupe_sheet_entries_by_id",0,function(e){let r=new Map;for(let n of e){let e=r.get(n.id);if(void 0===e){r.set(n.id,n);continue}if(null===n.end&&null!==e.end){r.set(n.id,{...n,notes:t(n.notes,e.notes)});continue}if(null===e.end&&null!==n.end){r.set(n.id,{...e,notes:t(e.notes,n.notes)});continue}r.set(n.id,{...e,notes:t(e.notes,n.notes)})}return[...r.values()].sort((e,t)=>e.id-t.id)}],20253)},47143,e=>{"use strict";var t=e.i(20253);e.s(["dedupe_tracker_db_sheet_entries",0,function(e){let r=!1;for(let n of e.sheets){let e=(0,t.dedupe_sheet_entries_by_id)(n.entries);e.length!==n.entries.length&&(r=!0,n.entries=e)}return r}])},13690,e=>{"use strict";e.s(["find_running_entry_on_sheet",0,function(e){if(null===e.activeEntryID)return null;let t=e.entries.find(({id:t})=>t===e.activeEntryID);return t?.end!=null?null:t??null}])},62775,e=>{"use strict";var t=e.i(13690);e.s(["reconcile_stale_active_entry_ids",0,function(e){let r=!1;for(let n of e.sheets)null!==n.activeEntryID&&null===(0,t.find_running_entry_on_sheet)(n)&&(n.activeEntryID=null,r=!0);return r}])},16366,e=>{"use strict";e.s(["convert_db_to_json",0,function(e){let t=e.sheets.map(e=>({name:e.name,activeEntryID:e.activeEntryID,...!0===e.archived?{archived:!0}:{},tasks:e.tasks.map(e=>({id:e.id,title:e.title,createdAt:e.createdAt.getTime(),updatedAt:e.updatedAt.getTime(),completedAt:null===e.completedAt?null:e.completedAt.getTime()})),entries:e.entries.map(e=>({id:e.id,description:e.description,tags:e.tags,start:e.start.getTime(),end:null===e.end?null:e.end.getTime(),notes:e.notes.map(e=>({text:e.text,timestamp:e.timestamp.getTime()})),...!0===e.archived?{archived:!0}:{}}))}));return{version:e.version,activeSheetName:e.activeSheetName,sheets:t}}])},71786,32806,e=>{"use strict";var t=e.i(50227),r=e.i(2157),n=e.i(72507),s=e.i(72127),a=e.i(30853),i=e.i(93361),o=e.i(24507),l=e.i(47143),u=e.i(62775),d=e.i(16366);async function c(e,t=n.DB_PATH){let s=JSON.stringify((0,d.convert_db_to_json)(e));try{await r.promises.writeFile(t,s)}catch(e){throw Error(`Failed to save DB: ${String(e)}`,{cause:e})}}async function p(e=n.DB_PATH){let d,m=t.default.dirname(e);await (0,a.ensure_dir_exists)(m);try{await r.promises.access(e)}catch{let t=(0,i.gen_db)();return await c(t,e),t}let v=await r.promises.readFile(e,"utf-8");try{d=JSON.parse(v)}catch(t){throw Error(`DB at ${e} is invalid JSON: ${String(t)}`,{cause:t})}let _=(0,o.migrate_json_db)(d);d=_.json_db;let h=(0,s.convert_json_db)(d),f=_.did_migrate,g=(0,u.reconcile_stale_active_entry_ids)(h),w=(0,l.dedupe_tracker_db_sheet_entries)(h);return(f||g||w)&&await c(h,e),h}e.s(["write_local_db",0,c],32806),e.s(["read_local_db",0,p],71786)},27440,e=>{"use strict";var t=e.i(49827),r=e.i(71786);let n=(0,t.cache)(async e=>(0,r.read_local_db)(e));e.s(["read_db",0,n])},72609,52455,13455,45196,58611,e=>{"use strict";let t=Symbol.for("constructDateFrom");function r(e,r){return"function"==typeof e?e(r):e&&"object"==typeof e&&t in e?e[t](r):e instanceof Date?new e.constructor(r):new Date(r)}function n(e,t){return r(t||e,e)}e.s(["constructFromSymbol",0,t,"millisecondsInHour",0,36e5,"millisecondsInMinute",0,6e4,"millisecondsInSecond",0,1e3,"millisecondsInWeek",0,6048e5],52455),e.s(["constructFrom",0,r],13455),e.s(["toDate",0,n],45196),e.s(["endOfDay",0,function(e,t){let r=n(e,t?.in);return r.setHours(23,59,59,999),r}],72609);let s={};e.s(["getDefaultOptions",0,function(){return s}],58611)},69856,e=>{"use strict";var t=e.i(45196);e.s(["startOfDay",0,function(e,r){let n=(0,t.toDate)(e,r?.in);return n.setHours(0,0,0,0),n}])},64457,e=>{"use strict";var t=e.i(58611),r=e.i(45196);e.s(["startOfWeek",0,function(e,n){let s=(0,t.getDefaultOptions)(),a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,i=(0,r.toDate)(e,n?.in),o=i.getDay();return i.setDate(i.getDate()-(7*(o<a)+o-a)),i.setHours(0,0,0,0),i}])},77052,e=>{"use strict";function t(e,r,n,s=Date.now()){let a=+e.start;return Math.max(0,Math.min(null===e.end?s:+e.end,n)-Math.max(a,r))}var r=e.i(72609),n=e.i(45196),s=e.i(58611),a=e.i(69856),i=e.i(64457);function o(e,t=new Date,l=1){var u;switch(e){case"week":let d,c,p,m;return{startMs:+(0,i.startOfWeek)(t,{weekStartsOn:l}),endMs:+(u={weekStartsOn:l},d=(0,s.getDefaultOptions)(),c=u?.weekStartsOn??u?.locale?.options?.weekStartsOn??d.weekStartsOn??d.locale?.options?.weekStartsOn??0,m=(p=(0,n.toDate)(t,u?.in)).getDay(),p.setDate(p.getDate()+((m<c?-7:0)+6-(m-c))),p.setHours(23,59,59,999),p)};case"month":let v,_,h;return{startMs:+((v=(0,n.toDate)(t,void 0)).setDate(1),v.setHours(0,0,0,0),v),endMs:+(h=(_=(0,n.toDate)(t,void 0)).getMonth(),_.setFullYear(_.getFullYear(),h+1,0),_.setHours(23,59,59,999),_)};default:return{startMs:+(0,a.startOfDay)(t),endMs:+(0,r.endOfDay)(t)}}}var l=e.i(27440);async function u({scope:e="global",sheet_name:r,tag_name:n,db:s}={}){let a=s??await (0,l.read_db)(),i=Date.now(),d=new Date(i),c=o("today",d),p=o("week",d),m=0,v=0,_={last_log_ms:null,active_timer_duration_ms:null};for(let s of a.sheets)for(let a of s.entries)(function(e){let{scope:t,sheet_name:r,tag_name:n,sheet_name_on_entry:s,entry:a}=e;return!!("global"===t||"sheet"===t&&void 0!==r&&s===r||"tag"===t&&void 0!==n&&a.tags.includes(n))})({scope:e,sheet_name:r,tag_name:n,sheet_name_on_entry:s.name,entry:a})&&(m+=t(a,c.startMs,c.endMs,i),v+=t(a,p.startMs,p.endMs,i)),_=function(e,t,r){let n=+e.start,s=null===e.end?null:+e.end,a=null===s?n:Math.max(n,s),i=null===r.last_log_ms||a>r.last_log_ms?a:r.last_log_ms;if(null!==e.end)return{last_log_ms:i,active_timer_duration_ms:r.active_timer_duration_ms};let o=Math.max(0,t-n);return{last_log_ms:i,active_timer_duration_ms:null===r.active_timer_duration_ms||o>r.active_timer_duration_ms?o:r.active_timer_duration_ms}}(a,i,_);let h=null!==_.active_timer_duration_ms||null===_.last_log_ms?null:Math.floor((i-_.last_log_ms)/6e4);return{todayTrackedMs:m,weekTrackedMs:v,activeTimerDurationMs:_.active_timer_duration_ms,minutesSinceLastLog:h}}e.s(["get_focus_nudges_status",0,u],77052)},90781,e=>{"use strict";var t=e.i(4394),r=e.i(45404),n=e.i(60016),s=e.i(33535),a=e.i(46593),i=e.i(10659),o=e.i(3644),l=e.i(31269),u=e.i(13865),d=e.i(65034),c=e.i(81157),p=e.i(82614),m=e.i(24377),v=e.i(57949),_=e.i(9566),h=e.i(93695);e.i(46179);var f=e.i(42108),g=e.i(76386),w=e.i(68194),E=e.i(77052);async function x(e){try{let t=new URL(e.url),r=t.searchParams.get("scope"),n=t.searchParams.get("sheet")??void 0,s=t.searchParams.get("tag")??void 0,a=await (0,E.get_focus_nudges_status)({scope:"sheet"===r||"tag"===r?r:"global",sheet_name:n,tag_name:s});return g.NextResponse.json(a)}catch(e){return(0,w.api_error_response)(e,500)}}e.s(["GET",0,x],47860);var y=e.i(47860);let D=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/focus-nudges/status/route",pathname:"/api/focus-nudges/status",filename:"route",bundlePath:""},distDir:"next-output",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/focus-nudges/status/route.ts",nextConfigOutput:"standalone",userland:y,...{}}),{workAsyncStorage:R,workUnitAsyncStorage:S,serverHooks:b}=D;async function A(e,t,n){n.requestMeta&&(0,s.setRequestMeta)(e,n.requestMeta),D.isDev&&(0,s.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/focus-nudges/status/route";g=g.replace(/\/index$/,"")||"/";let w=await D.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:E,deploymentId:x,params:y,nextConfig:R,parsedUrl:S,isDraftMode:b,prerenderManifest:A,routerServerContext:k,isOnDemandRevalidate:N,revalidateOnlyGenerated:T,resolvedPathname:O,clientReferenceManifest:M,serverActionsManifest:I}=w,C=(0,o.normalizeAppPath)(g),j=!!(A.dynamicRoutes[C]||A.routes[O]),H=async()=>((null==k?void 0:k.render404)?await k.render404(e,t,S,!1):t.end("This page could not be found"),null);if(j&&!b){let e=!!A.routes[O],t=A.dynamicRoutes[C];if(t&&!1===t.fallback&&!e){if(R.adapterPath)return await H();throw new h.NoFallbackError}}let P=null;!j||D.isDev||b||(P="/index"===(P=O)?"/":P);let q=!0===D.isDev||!j,$=j&&!q;I&&M&&(0,i.setManifestsSingleton)({page:g,clientReferenceManifest:M,serverActionsManifest:I});let B=e.method||"GET",U=(0,a.getTracer)(),F=U.getActiveScopeSpan(),L=!!(null==k?void 0:k.isWrappedByNextServer),K=!!(0,s.getRequestMeta)(e,"minimalMode"),V=(0,s.getRequestMeta)(e,"incrementalCache")||await D.getIncrementalCache(e,R,A,K);null==V||V.resetRequestCache(),globalThis.__incrementalCache=V;let W={params:y,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!R.experimental.authInterrupts},cacheComponents:!!R.cacheComponents,supportsDynamicResponse:q,incrementalCache:V,cacheLifeProfiles:R.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,s)=>D.onRequestError(e,t,n,s,k)},sharedContext:{buildId:E,deploymentId:x}},G=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),J=u.NextRequestAdapter.fromNodeNextRequest(G,(0,u.signalFromNodeResponse)(t));try{let s,i=async e=>D.handle(J,W).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=U.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${B} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),s&&s!==e&&(s.setAttribute("http.route",n),s.updateName(t))}else e.updateName(`${B} ${g}`)}),o=async s=>{var a,o;let l=async({previousCacheEntry:r})=>{try{if(!K&&N&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await i(s);e.fetchMetrics=W.renderOpts.fetchMetrics;let o=W.renderOpts.pendingWaitUntil;o&&n.waitUntil&&(n.waitUntil(o),o=void 0);let l=W.renderOpts.collectedTags;if(!j)return await (0,p.sendResponse)(G,X,a,W.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(a.headers);l&&(t[_.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=_.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,n=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=_.INFINITE_CACHE?void 0:W.renderOpts.collectedExpire;return{value:{kind:f.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await D.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:N})},!1,k),t}},u=await D.handleResponse({req:e,nextConfig:R,cacheKey:P,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:T,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:K});if(!j)return null;if((null==u||null==(a=u.value)?void 0:a.kind)!==f.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(o=u.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",N?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),b&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,m.fromNodeOutgoingHttpHeaders)(u.value.headers);return K&&j||d.delete(_.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,v.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(G,X,new Response(u.value.body,{headers:d,status:u.value.status||200})),null};L&&F?await o(F):(s=U.getActiveScopeSpan(),await U.withPropagatedContext(e.headers,()=>U.trace(d.BaseServerSpan.handleRequest,{spanName:`${B} ${g}`,kind:a.SpanKind.SERVER,attributes:{"http.method":B,"http.target":e.url}},o),void 0,!L))}catch(t){if(t instanceof h.NoFallbackError||await D.onRequestError(e,t,{routerKind:"App Router",routePath:C,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:N})},!1,k),j)throw t;return await (0,p.sendResponse)(G,X,new Response(null,{status:500})),null}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:R,workUnitAsyncStorage:S})},"routeModule",0,D,"serverHooks",0,b,"workAsyncStorage",0,R,"workUnitAsyncStorage",0,S],90781)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=%5Broot-of-the-server%5D__06wq380._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[29207,e=>{"use strict";var t=e.i(5313),n=e.i(36117);async function r(){if(!(0,t.is_supabase_configured)())return null;let e=await (0,n.create_server_supabase_client)(),{data:{user:r}}=await e.auth.getUser();return r?.id??null}e.s(["get_authenticated_user_id",0,r])},12888,27984,e=>{"use strict";e.s(["is_entry_archived",0,function(e){return!0===e.archived}],12888),e.s(["serialize_entry",0,function(e,t,n){return{id:e.id,description:e.description,start:e.start.toISOString(),end:null===e.end?null:e.end.toISOString(),tags:e.tags,notes:e.notes.map(({timestamp:e,text:t})=>({timestamp:e.toISOString(),text:t})),sheetName:t,durationMs:function(e,t=Date.now()){let{end:n,start:r}=e;return Math.max(0,(null===n?t:+n)-r)}(e),isActive:n,...!0===e.archived?{archived:!0}:{}}}],27984)},18212,e=>{"use strict";var t=e.i(47143),n=e.i(62775),r=e.i(32806);async function s(e,s){(0,n.reconcile_stale_active_entry_ids)(e),(0,t.dedupe_tracker_db_sheet_entries)(e),await (0,r.write_local_db)(e,s)}e.s(["write_db",0,s])},18622,(e,t,n)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,n)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,n)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},68194,e=>{"use strict";var t=e.i(76386);e.s(["api_error_response",0,function(e,n=400){let r=e instanceof Error?e.message:String(e);return t.NextResponse.json({error:r},{status:n})}])},50227,(e,t,n)=>{t.exports=e.x("node:path",()=>require("node:path"))},60526,(e,t,n)=>{t.exports=e.x("node:os",()=>require("node:os"))},2157,(e,t,n)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},72507,e=>{"use strict";var t=e.i(60526),n=e.i(50227);let r="db.json",s=n.default.join(t.default.homedir(),".super-time-tracker"),i=n.default.join(s,r);e.s(["DB_FILE_NAME",0,r,"DB_PATH",0,i,"DB_VERSION",0,5,"DEFAULT_SHEET_NAME",0,"main"])},13690,e=>{"use strict";e.s(["find_running_entry_on_sheet",0,function(e){if(null===e.activeEntryID)return null;let t=e.entries.find(({id:t})=>t===e.activeEntryID);return t?.end!=null?null:t??null}])},72127,30853,e=>{"use strict";e.s(["convert_json_db",0,function(e){let{sheets:t,version:n,activeSheetName:r}=e;return{version:n,activeSheetName:r,sheets:t.map(({name:e,entries:t,tasks:n,activeEntryID:r,archived:s})=>({name:e,activeEntryID:r,...!0===s?{archived:!0}:{},tasks:(n??[]).map(({id:e,title:t,createdAt:n,updatedAt:r,completedAt:s})=>({id:e,title:t,createdAt:new Date(n),updatedAt:new Date(r),completedAt:null===s?null:new Date(s)})),entries:t.map(({id:e,start:t,end:n,description:r,tags:s,notes:i,archived:a})=>({id:e,description:r,tags:s,notes:i.map(({timestamp:e,text:t})=>({text:t,timestamp:new Date(e)})),start:new Date(t),end:null===n?null:new Date(n),...!0===a?{archived:!0}:{}}))}))}}],72127);var t=e.i(2157);async function n(e){try{await t.promises.mkdir(e,{recursive:!0})}catch(e){if("EEXIST"!==(null!==e&&"object"==typeof e&&"code"in e&&"string"==typeof e.code?e.code:null))throw e}}e.s(["ensure_dir_exists",0,n],30853)},93361,e=>{"use strict";var t=e.i(72507);function n(e,t=[],r=null,s=[]){if(0===e.length)throw Error("New sheet name must not be empty");if(null!==r&&void 0===t.find(({id:e})=>e===r))throw Error("New sheet active entry does not exist");return{name:e,entries:t,tasks:s,activeEntryID:r}}e.s(["gen_db",0,function(){return{version:t.DB_VERSION,sheets:[n(t.DEFAULT_SHEET_NAME)],activeSheetName:t.DEFAULT_SHEET_NAME}},"gen_sheet",0,n])},24507,e=>{"use strict";var t=e.i(72507);let n={2:function(e){let{sheets:t,version:n,activeSheetName:r}=e;if(1!==n&&void 0!==n)throw Error(`DB is version ${n}, cannot migrate to version 2.`);return{version:2,activeSheetName:r,sheets:t.map(({name:e,entries:t,activeEntryID:n})=>({name:e,activeEntryID:n,tasks:[],entries:t.map(({id:e,start:t,end:n,description:r})=>({tags:[],notes:[],id:e,end:n,start:t,description:r}))}))}},3:function(e){let{sheets:t,version:n,activeSheetName:r}=e;if(2!==n&&void 0!==n)throw Error(`DB is version ${n}, cannot migrate to version 3.`);return{version:3,activeSheetName:r,sheets:t.map(({name:e,entries:t,activeEntryID:n})=>({name:e,activeEntryID:n,tasks:[],entries:t.map(({id:e,start:t,end:n,description:r,tags:s})=>({notes:[],tags:s,id:e,end:n,start:t,description:r}))}))}},4:function(e){let{version:t,activeSheetName:n,sheets:r}=e;if(3!==t)throw Error(`DB is version ${t}, cannot migrate to version 4.`);return{version:4,activeSheetName:n,sheets:r}},5:function(e){let{version:t,activeSheetName:n,sheets:r}=e;if(4!==t)throw Error(`DB is version ${t}, cannot migrate to version 5.`);return{version:5,activeSheetName:n,sheets:r.map(e=>({...e,tasks:e.tasks??[]}))}}};e.s(["migrate_json_db",0,function(e){let r=e,s=!1,i=r.version??1;if(i>t.DB_VERSION||i<1)throw Error(`Unknown DB version ${r.version}, cannot load.`);for(;i<t.DB_VERSION;){let e=i+1,t=n[e];if(void 0===t)throw Error(`Missing migration from version ${i} to ${e}.`);if((r=t(r)).version!==e)throw Error(`Invalid migration output for version ${e}.`);i=e,s=!0}return{json_db:r,did_migrate:s}}],24507)},20253,e=>{"use strict";function t(e,t){let n=new Set,r=[];for(let s of[...e,...t]){let e=`${s.timestamp.getTime()}:${s.text}`;n.has(e)||(n.add(e),r.push(s))}return r.sort((e,t)=>e.timestamp.getTime()-t.timestamp.getTime()),r}e.s(["dedupe_sheet_entries_by_id",0,function(e){let n=new Map;for(let r of e){let e=n.get(r.id);if(void 0===e){n.set(r.id,r);continue}if(null===r.end&&null!==e.end){n.set(r.id,{...r,notes:t(r.notes,e.notes)});continue}if(null===e.end&&null!==r.end){n.set(r.id,{...e,notes:t(e.notes,r.notes)});continue}n.set(r.id,{...e,notes:t(e.notes,r.notes)})}return[...n.values()].sort((e,t)=>e.id-t.id)}],20253)},47143,e=>{"use strict";var t=e.i(20253);e.s(["dedupe_tracker_db_sheet_entries",0,function(e){let n=!1;for(let r of e.sheets){let e=(0,t.dedupe_sheet_entries_by_id)(r.entries);e.length!==r.entries.length&&(n=!0,r.entries=e)}return n}])},62775,e=>{"use strict";var t=e.i(13690);e.s(["reconcile_stale_active_entry_ids",0,function(e){let n=!1;for(let r of e.sheets)null!==r.activeEntryID&&null===(0,t.find_running_entry_on_sheet)(r)&&(r.activeEntryID=null,n=!0);return n}])},16366,e=>{"use strict";e.s(["convert_db_to_json",0,function(e){let t=e.sheets.map(e=>({name:e.name,activeEntryID:e.activeEntryID,...!0===e.archived?{archived:!0}:{},tasks:e.tasks.map(e=>({id:e.id,title:e.title,createdAt:e.createdAt.getTime(),updatedAt:e.updatedAt.getTime(),completedAt:null===e.completedAt?null:e.completedAt.getTime()})),entries:e.entries.map(e=>({id:e.id,description:e.description,tags:e.tags,start:e.start.getTime(),end:null===e.end?null:e.end.getTime(),notes:e.notes.map(e=>({text:e.text,timestamp:e.timestamp.getTime()})),...!0===e.archived?{archived:!0}:{}}))}));return{version:e.version,activeSheetName:e.activeSheetName,sheets:t}}])},71786,32806,e=>{"use strict";var t=e.i(50227),n=e.i(2157),r=e.i(72507),s=e.i(72127),i=e.i(30853),a=e.i(93361),o=e.i(24507),l=e.i(47143),u=e.i(62775),c=e.i(16366);async function d(e,t=r.DB_PATH){let s=JSON.stringify((0,c.convert_db_to_json)(e));try{await n.promises.writeFile(t,s)}catch(e){throw Error(`Failed to save DB: ${String(e)}`,{cause:e})}}async function _(e=r.DB_PATH){let c,m=t.default.dirname(e);await (0,i.ensure_dir_exists)(m);try{await n.promises.access(e)}catch{let t=(0,a.gen_db)();return await d(t,e),t}let v=await n.promises.readFile(e,"utf-8");try{c=JSON.parse(v)}catch(t){throw Error(`DB at ${e} is invalid JSON: ${String(t)}`,{cause:t})}let h=(0,o.migrate_json_db)(c);c=h.json_db;let f=(0,s.convert_json_db)(c),p=h.did_migrate,g=(0,u.reconcile_stale_active_entry_ids)(f),w=(0,l.dedupe_tracker_db_sheet_entries)(f);return(p||g||w)&&await d(f,e),f}e.s(["write_local_db",0,d],32806),e.s(["read_local_db",0,_],71786)},27440,e=>{"use strict";var t=e.i(49827),n=e.i(71786);let r=(0,t.cache)(async e=>(0,n.read_local_db)(e));e.s(["read_db",0,r])},14850,e=>{"use strict";e.s(["is_sheet_archived",0,function(e){return!0===e.archived}])},81207,e=>{"use strict";e.s(["collect_known_tags",0,function(e){let t=new Set;for(let n of e.sheets){for(let e of n.entries)for(let n of e.tags){let e=n.trim();e.length>0&&t.add(e)}for(let e of n.tasks)for(let n of e.title.match(/@\w+/g)??[])t.add(n)}return[...t].sort((e,t)=>e.localeCompare(t))}])},93204,e=>{"use strict";e.s(["get_sheet",0,function(e,t){let n=e.sheets.find(({name:e})=>e===t);if(void 0===n)throw Error(`Sheet ${t} not found`);return n}])},72609,52455,13455,45196,58611,e=>{"use strict";let t=Symbol.for("constructDateFrom");function n(e,n){return"function"==typeof e?e(n):e&&"object"==typeof e&&t in e?e[t](n):e instanceof Date?new e.constructor(n):new Date(n)}function r(e,t){return n(t||e,e)}e.s(["constructFromSymbol",0,t,"millisecondsInHour",0,36e5,"millisecondsInMinute",0,6e4,"millisecondsInSecond",0,1e3,"millisecondsInWeek",0,6048e5],52455),e.s(["constructFrom",0,n],13455),e.s(["toDate",0,r],45196),e.s(["endOfDay",0,function(e,t){let n=r(e,t?.in);return n.setHours(23,59,59,999),n}],72609);let s={};e.s(["getDefaultOptions",0,function(){return s}],58611)},69856,e=>{"use strict";var t=e.i(45196);e.s(["startOfDay",0,function(e,n){let r=(0,t.toDate)(e,n?.in);return r.setHours(0,0,0,0),r}])},64457,e=>{"use strict";var t=e.i(58611),n=e.i(45196);e.s(["startOfWeek",0,function(e,r){let s=(0,t.getDefaultOptions)(),i=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,a=(0,n.toDate)(e,r?.in),o=a.getDay();return a.setDate(a.getDate()-(7*(o<i)+o-i)),a.setHours(0,0,0,0),a}])},77052,e=>{"use strict";function t(e,n,r,s=Date.now()){let i=+e.start;return Math.max(0,Math.min(null===e.end?s:+e.end,r)-Math.max(i,n))}var n=e.i(72609),r=e.i(45196),s=e.i(58611),i=e.i(69856),a=e.i(64457);function o(e,t=new Date,l=1){var u;switch(e){case"week":let c,d,_,m;return{startMs:+(0,a.startOfWeek)(t,{weekStartsOn:l}),endMs:+(u={weekStartsOn:l},c=(0,s.getDefaultOptions)(),d=u?.weekStartsOn??u?.locale?.options?.weekStartsOn??c.weekStartsOn??c.locale?.options?.weekStartsOn??0,m=(_=(0,r.toDate)(t,u?.in)).getDay(),_.setDate(_.getDate()+((m<d?-7:0)+6-(m-d))),_.setHours(23,59,59,999),_)};case"month":let v,h,f;return{startMs:+((v=(0,r.toDate)(t,void 0)).setDate(1),v.setHours(0,0,0,0),v),endMs:+(f=(h=(0,r.toDate)(t,void 0)).getMonth(),h.setFullYear(h.getFullYear(),f+1,0),h.setHours(23,59,59,999),h)};default:return{startMs:+(0,i.startOfDay)(t),endMs:+(0,n.endOfDay)(t)}}}var l=e.i(27440);async function u({scope:e="global",sheet_name:n,tag_name:r,db:s}={}){let i=s??await (0,l.read_db)(),a=Date.now(),c=new Date(a),d=o("today",c),_=o("week",c),m=0,v=0,h={last_log_ms:null,active_timer_duration_ms:null};for(let s of i.sheets)for(let i of s.entries)(function(e){let{scope:t,sheet_name:n,tag_name:r,sheet_name_on_entry:s,entry:i}=e;return!!("global"===t||"sheet"===t&&void 0!==n&&s===n||"tag"===t&&void 0!==r&&i.tags.includes(r))})({scope:e,sheet_name:n,tag_name:r,sheet_name_on_entry:s.name,entry:i})&&(m+=t(i,d.startMs,d.endMs,a),v+=t(i,_.startMs,_.endMs,a)),h=function(e,t,n){let r=+e.start,s=null===e.end?null:+e.end,i=null===s?r:Math.max(r,s),a=null===n.last_log_ms||i>n.last_log_ms?i:n.last_log_ms;if(null!==e.end)return{last_log_ms:a,active_timer_duration_ms:n.active_timer_duration_ms};let o=Math.max(0,t-r);return{last_log_ms:a,active_timer_duration_ms:null===n.active_timer_duration_ms||o>n.active_timer_duration_ms?o:n.active_timer_duration_ms}}(i,a,h);let f=null!==h.active_timer_duration_ms||null===h.last_log_ms?null:Math.floor((a-h.last_log_ms)/6e4);return{todayTrackedMs:m,weekTrackedMs:v,activeTimerDurationMs:h.active_timer_duration_ms,minutesSinceLastLog:f}}e.s(["get_focus_nudges_status",0,u],77052)},4760,95634,e=>{"use strict";var t=e.i(81207),n=e.i(12888),r=e.i(14850),s=e.i(72507),i=e.i(29207),a=e.i(5313);async function o(){return!!(0,a.is_supabase_configured)()&&null!==await (0,i.get_authenticated_user_id)()}async function l(){return await o()?`Cloud sync (${"https://ctruizaqyeyidujmtxhc.supabase.co".trim()??"Supabase"})`:s.DB_PATH}var u=e.i(77052),c=e.i(93204),d=e.i(27440),_=e.i(13690),m=e.i(27984),v=e.i(20253),h=e.i(93361),f=e.i(18212);async function p(e){let t=await (0,d.read_db)();t.sheets.some(({name:t})=>t===e)||t.sheets.push((0,h.gen_sheet)(e)),t.activeSheetName=e,await (0,f.write_db)(t)}async function g(e,i={}){let a=i.persist_active_sheet??!0,o=i.include_sheet_entries??!0,h=i.include_focus_nudges??!1,f=i.db??await (0,d.read_db)(),w=function(e,t){let n=t?.trim()??"";if(n.length>0&&e.sheets.some(e=>e.name===n&&!(0,r.is_sheet_archived)(e)))return n;if(null!==e.activeSheetName&&e.sheets.some(t=>t.name===e.activeSheetName&&!(0,r.is_sheet_archived)(t)))return e.activeSheetName;let i=e.sheets.find(e=>!(0,r.is_sheet_archived)(e)&&null!==(0,_.find_running_entry_on_sheet)(e));if(void 0!==i)return i.name;let a=e.sheets.find(e=>!(0,r.is_sheet_archived)(e));return a?.name??s.DEFAULT_SHEET_NAME}(f,e);a&&f.activeSheetName!==w&&(await p(w),f.activeSheetName=w);let{sheets:y}=f,D=[];o&&(D=function(e,t){let n=[...e];switch(t){case"oldest":return n.sort((e,t)=>new Date(e.start).getTime()-new Date(t.start).getTime());case"duration":return n.sort((e,t)=>t.durationMs-e.durationMs);case"description":return n.sort((e,t)=>{let n=e.description.trim()||"Untitled entry",r=t.description.trim()||"Untitled entry";return n.localeCompare(r)});default:return n.sort((e,t)=>new Date(t.start).getTime()-new Date(e.start).getTime())}}(function(e){let{activeEntryID:t,entries:n,name:r}=e;return(0,v.dedupe_sheet_entries_by_id)(n).map(e=>(0,m.serialize_entry)(e,r,t===e.id&&null===e.end))}((0,c.get_sheet)(f,w)),"newest"));let S=function(e,t){let n=e.sheets.find(({name:e})=>e===t);if(void 0===n)return null;let r=(0,_.find_running_entry_on_sheet)(n);return null===r?null:(0,m.serialize_entry)(r,n.name,!0)}(f,w),E=f.sheets.flatMap(e=>{let t=(0,_.find_running_entry_on_sheet)(e);return null==t?[]:[(0,m.serialize_entry)(t,e.name,!0)]}),x=S??E[0]??null,b=h?await (0,u.get_focus_nudges_status)({scope:"global",db:f}):void 0;return{dbPath:await l(),activeSheetName:w,knownTags:(0,t.collect_known_tags)(f),sheets:y.map(e=>({name:e.name,activeEntryID:e.activeEntryID,entryCount:e.entries.filter(e=>!(0,n.is_entry_archived)(e)).length,isActive:e.name===w,hasActiveEntry:null!==(0,_.find_running_entry_on_sheet)(e),...(0,r.is_sheet_archived)(e)?{archived:!0}:{}})),activeEntry:S,runningEntry:x,runningEntries:E,activeSheetEntries:D,activeSheetTotalMs:D.reduce((e,t)=>e+t.durationMs,0),activeSheetEntriesLoaded:o,focusNudgesStatusGlobal:b}}e.s(["set_active_sheet",0,p],95634),e.s(["get_tracker_state",0,g],4760)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__0agceca._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},68194,e=>{"use strict";var t=e.i(76386);e.s(["api_error_response",0,function(e,r=400){let a=e instanceof Error?e.message:String(e);return t.NextResponse.json({error:a},{status:r})}])},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},72507,e=>{"use strict";var t=e.i(60526),r=e.i(50227);let a="db.json",n=r.default.join(t.default.homedir(),".super-time-tracker"),i=r.default.join(n,a);e.s(["DB_FILE_NAME",0,a,"DB_PATH",0,i,"DB_VERSION",0,
|
|
1
|
+
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},68194,e=>{"use strict";var t=e.i(76386);e.s(["api_error_response",0,function(e,r=400){let a=e instanceof Error?e.message:String(e);return t.NextResponse.json({error:a},{status:r})}])},60526,(e,t,r)=>{t.exports=e.x("node:os",()=>require("node:os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},72507,e=>{"use strict";var t=e.i(60526),r=e.i(50227);let a="db.json",n=r.default.join(t.default.homedir(),".super-time-tracker"),i=r.default.join(n,a);e.s(["DB_FILE_NAME",0,a,"DB_PATH",0,i,"DB_VERSION",0,5,"DEFAULT_SHEET_NAME",0,"main"])},29207,e=>{"use strict";var t=e.i(5313),r=e.i(36117);async function a(){if(!(0,t.is_supabase_configured)())return null;let e=await (0,r.create_server_supabase_client)(),{data:{user:a}}=await e.auth.getUser();return a?.id??null}e.s(["get_authenticated_user_id",0,a])},99712,e=>{"use strict";var t=e.i(4394),r=e.i(45404),a=e.i(60016),n=e.i(33535),i=e.i(46593),s=e.i(10659),o=e.i(3644),l=e.i(31269),u=e.i(13865),d=e.i(65034),p=e.i(81157),c=e.i(82614),h=e.i(24377),v=e.i(57949),x=e.i(9566),R=e.i(93695);e.i(46179);var f=e.i(42108),g=e.i(76386),_=e.i(68194),m=e.i(29207),w=e.i(72507),E=e.i(36117);async function y(e,t){let r=await (0,E.create_server_supabase_client)(),{data:a,error:n}=await r.from("tracker_accounts").select("db_version").eq("user_id",e).maybeSingle();if(null!==n)throw Error(`Failed to load tracker account: ${n.message}`);let{error:i}=await r.from("tracker_accounts").upsert({user_id:e,active_sheet_name:t,db_version:a?.db_version??w.DB_VERSION,updated_at:new Date().toISOString()},{onConflict:"user_id"});if(null!==i)throw Error(`Failed to update active sheet: ${i.message}`)}async function C(e){try{let t=await (0,m.get_authenticated_user_id)();if(null===t)return(0,_.api_error_response)(Error("Sign in required"),401);let r=await e.json(),a=r.name?.trim()??"";if(0===a.length)return(0,_.api_error_response)(Error("Sheet name is required"));return await y(t,a),g.NextResponse.json({ok:!0})}catch(e){return(0,_.api_error_response)(e)}}e.s(["POST",0,C],98913);var b=e.i(98913);let A=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/sheet/active/route",pathname:"/api/sheet/active",filename:"route",bundlePath:""},distDir:"next-output",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/sheet/active/route.ts",nextConfigOutput:"standalone",userland:b,...{}}),{workAsyncStorage:S,workUnitAsyncStorage:N,serverHooks:q}=A;async function T(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),A.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/sheet/active/route";g=g.replace(/\/index$/,"")||"/";let _=await A.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!_)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:m,deploymentId:w,params:E,nextConfig:y,parsedUrl:C,isDraftMode:b,prerenderManifest:S,routerServerContext:N,isOnDemandRevalidate:q,revalidateOnlyGenerated:T,resolvedPathname:k,clientReferenceManifest:P,serverActionsManifest:O}=_,j=(0,o.normalizeAppPath)(g),I=!!(S.dynamicRoutes[j]||S.routes[k]),D=async()=>((null==N?void 0:N.render404)?await N.render404(e,t,C,!1):t.end("This page could not be found"),null);if(I&&!b){let e=!!S.routes[k],t=S.dynamicRoutes[j];if(t&&!1===t.fallback&&!e){if(y.adapterPath)return await D();throw new R.NoFallbackError}}let H=null;!I||A.isDev||b||(H="/index"===(H=k)?"/":H);let U=!0===A.isDev||!I,M=I&&!U;O&&P&&(0,s.setManifestsSingleton)({page:g,clientReferenceManifest:P,serverActionsManifest:O});let F=e.method||"GET",$=(0,i.getTracer)(),B=$.getActiveScopeSpan(),K=!!(null==N?void 0:N.isWrappedByNextServer),L=!!(0,n.getRequestMeta)(e,"minimalMode"),V=(0,n.getRequestMeta)(e,"incrementalCache")||await A.getIncrementalCache(e,y,S,L);null==V||V.resetRequestCache(),globalThis.__incrementalCache=V;let G={params:E,previewProps:S.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts},cacheComponents:!!y.cacheComponents,supportsDynamicResponse:U,incrementalCache:V,cacheLifeProfiles:y.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>A.onRequestError(e,t,a,n,N)},sharedContext:{buildId:m,deploymentId:w}},W=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),z=u.NextRequestAdapter.fromNodeNextRequest(W,(0,u.signalFromNodeResponse)(t));try{let n,s=async e=>A.handle(z,G).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${F} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${F} ${g}`)}),o=async n=>{var i,o;let l=async({previousCacheEntry:r})=>{try{if(!L&&q&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await s(n);e.fetchMetrics=G.renderOpts.fetchMetrics;let o=G.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let l=G.renderOpts.collectedTags;if(!I)return await (0,c.sendResponse)(W,X,i,G.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(i.headers);l&&(t[x.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,a=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:G.renderOpts.collectedExpire;return{value:{kind:f.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await A.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:q})},!1,N),t}},u=await A.handleResponse({req:e,nextConfig:y,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:S,isRoutePPREnabled:!1,isOnDemandRevalidate:q,revalidateOnlyGenerated:T,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:L});if(!I)return null;if((null==u||null==(i=u.value)?void 0:i.kind)!==f.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(o=u.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});L||t.setHeader("x-nextjs-cache",q?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),b&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,h.fromNodeOutgoingHttpHeaders)(u.value.headers);return L&&I||d.delete(x.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,v.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(W,X,new Response(u.value.body,{headers:d,status:u.value.status||200})),null};K&&B?await o(B):(n=$.getActiveScopeSpan(),await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${F} ${g}`,kind:i.SpanKind.SERVER,attributes:{"http.method":F,"http.target":e.url}},o),void 0,!K))}catch(t){if(t instanceof R.NoFallbackError||await A.onRequestError(e,t,{routerKind:"App Router",routePath:j,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:q})},!1,N),I)throw t;return await (0,c.sendResponse)(W,X,new Response(null,{status:500})),null}}e.s(["handler",0,T,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:S,workUnitAsyncStorage:N})},"routeModule",0,A,"serverHooks",0,q,"workAsyncStorage",0,S,"workUnitAsyncStorage",0,N],99712)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=%5Broot-of-the-server%5D__0m-c-3t._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[29207,e=>{"use strict";var t=e.i(5313),n=e.i(36117);async function r(){if(!(0,t.is_supabase_configured)())return null;let e=await (0,n.create_server_supabase_client)(),{data:{user:r}}=await e.auth.getUser();return r?.id??null}e.s(["get_authenticated_user_id",0,r])},12888,27984,e=>{"use strict";e.s(["is_entry_archived",0,function(e){return!0===e.archived}],12888),e.s(["serialize_entry",0,function(e,t,n){return{id:e.id,description:e.description,start:e.start.toISOString(),end:null===e.end?null:e.end.toISOString(),tags:e.tags,notes:e.notes.map(({timestamp:e,text:t})=>({timestamp:e.toISOString(),text:t})),sheetName:t,durationMs:function(e,t=Date.now()){let{end:n,start:r}=e;return Math.max(0,(null===n?t:+n)-r)}(e),isActive:n,...!0===e.archived?{archived:!0}:{}}}],27984)},18212,e=>{"use strict";var t=e.i(47143),n=e.i(62775),r=e.i(32806);async function s(e,s){(0,n.reconcile_stale_active_entry_ids)(e),(0,t.dedupe_tracker_db_sheet_entries)(e),await (0,r.write_local_db)(e,s)}e.s(["write_db",0,s])},18622,(e,t,n)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,n)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,n)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,n)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},68194,e=>{"use strict";var t=e.i(76386);e.s(["api_error_response",0,function(e,n=400){let r=e instanceof Error?e.message:String(e);return t.NextResponse.json({error:r},{status:n})}])},60526,(e,t,n)=>{t.exports=e.x("node:os",()=>require("node:os"))},50227,(e,t,n)=>{t.exports=e.x("node:path",()=>require("node:path"))},2157,(e,t,n)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},72507,e=>{"use strict";var t=e.i(60526),n=e.i(50227);let r="db.json",s=n.default.join(t.default.homedir(),".super-time-tracker"),i=n.default.join(s,r);e.s(["DB_FILE_NAME",0,r,"DB_PATH",0,i,"DB_VERSION",0,5,"DEFAULT_SHEET_NAME",0,"main"])},93361,e=>{"use strict";var t=e.i(72507);function n(e,t=[],r=null,s=[]){if(0===e.length)throw Error("New sheet name must not be empty");if(null!==r&&void 0===t.find(({id:e})=>e===r))throw Error("New sheet active entry does not exist");return{name:e,entries:t,tasks:s,activeEntryID:r}}e.s(["gen_db",0,function(){return{version:t.DB_VERSION,sheets:[n(t.DEFAULT_SHEET_NAME)],activeSheetName:t.DEFAULT_SHEET_NAME}},"gen_sheet",0,n])},13690,e=>{"use strict";e.s(["find_running_entry_on_sheet",0,function(e){if(null===e.activeEntryID)return null;let t=e.entries.find(({id:t})=>t===e.activeEntryID);return t?.end!=null?null:t??null}])},72127,30853,e=>{"use strict";e.s(["convert_json_db",0,function(e){let{sheets:t,version:n,activeSheetName:r}=e;return{version:n,activeSheetName:r,sheets:t.map(({name:e,entries:t,tasks:n,activeEntryID:r,archived:s})=>({name:e,activeEntryID:r,...!0===s?{archived:!0}:{},tasks:(n??[]).map(({id:e,title:t,createdAt:n,updatedAt:r,completedAt:s})=>({id:e,title:t,createdAt:new Date(n),updatedAt:new Date(r),completedAt:null===s?null:new Date(s)})),entries:t.map(({id:e,start:t,end:n,description:r,tags:s,notes:i,archived:a})=>({id:e,description:r,tags:s,notes:i.map(({timestamp:e,text:t})=>({text:t,timestamp:new Date(e)})),start:new Date(t),end:null===n?null:new Date(n),...!0===a?{archived:!0}:{}}))}))}}],72127);var t=e.i(2157);async function n(e){try{await t.promises.mkdir(e,{recursive:!0})}catch(e){if("EEXIST"!==(null!==e&&"object"==typeof e&&"code"in e&&"string"==typeof e.code?e.code:null))throw e}}e.s(["ensure_dir_exists",0,n],30853)},24507,e=>{"use strict";var t=e.i(72507);let n={2:function(e){let{sheets:t,version:n,activeSheetName:r}=e;if(1!==n&&void 0!==n)throw Error(`DB is version ${n}, cannot migrate to version 2.`);return{version:2,activeSheetName:r,sheets:t.map(({name:e,entries:t,activeEntryID:n})=>({name:e,activeEntryID:n,tasks:[],entries:t.map(({id:e,start:t,end:n,description:r})=>({tags:[],notes:[],id:e,end:n,start:t,description:r}))}))}},3:function(e){let{sheets:t,version:n,activeSheetName:r}=e;if(2!==n&&void 0!==n)throw Error(`DB is version ${n}, cannot migrate to version 3.`);return{version:3,activeSheetName:r,sheets:t.map(({name:e,entries:t,activeEntryID:n})=>({name:e,activeEntryID:n,tasks:[],entries:t.map(({id:e,start:t,end:n,description:r,tags:s})=>({notes:[],tags:s,id:e,end:n,start:t,description:r}))}))}},4:function(e){let{version:t,activeSheetName:n,sheets:r}=e;if(3!==t)throw Error(`DB is version ${t}, cannot migrate to version 4.`);return{version:4,activeSheetName:n,sheets:r}},5:function(e){let{version:t,activeSheetName:n,sheets:r}=e;if(4!==t)throw Error(`DB is version ${t}, cannot migrate to version 5.`);return{version:5,activeSheetName:n,sheets:r.map(e=>({...e,tasks:e.tasks??[]}))}}};e.s(["migrate_json_db",0,function(e){let r=e,s=!1,i=r.version??1;if(i>t.DB_VERSION||i<1)throw Error(`Unknown DB version ${r.version}, cannot load.`);for(;i<t.DB_VERSION;){let e=i+1,t=n[e];if(void 0===t)throw Error(`Missing migration from version ${i} to ${e}.`);if((r=t(r)).version!==e)throw Error(`Invalid migration output for version ${e}.`);i=e,s=!0}return{json_db:r,did_migrate:s}}],24507)},20253,e=>{"use strict";function t(e,t){let n=new Set,r=[];for(let s of[...e,...t]){let e=`${s.timestamp.getTime()}:${s.text}`;n.has(e)||(n.add(e),r.push(s))}return r.sort((e,t)=>e.timestamp.getTime()-t.timestamp.getTime()),r}e.s(["dedupe_sheet_entries_by_id",0,function(e){let n=new Map;for(let r of e){let e=n.get(r.id);if(void 0===e){n.set(r.id,r);continue}if(null===r.end&&null!==e.end){n.set(r.id,{...r,notes:t(r.notes,e.notes)});continue}if(null===e.end&&null!==r.end){n.set(r.id,{...e,notes:t(e.notes,r.notes)});continue}n.set(r.id,{...e,notes:t(e.notes,r.notes)})}return[...n.values()].sort((e,t)=>e.id-t.id)}],20253)},47143,e=>{"use strict";var t=e.i(20253);e.s(["dedupe_tracker_db_sheet_entries",0,function(e){let n=!1;for(let r of e.sheets){let e=(0,t.dedupe_sheet_entries_by_id)(r.entries);e.length!==r.entries.length&&(n=!0,r.entries=e)}return n}])},62775,e=>{"use strict";var t=e.i(13690);e.s(["reconcile_stale_active_entry_ids",0,function(e){let n=!1;for(let r of e.sheets)null!==r.activeEntryID&&null===(0,t.find_running_entry_on_sheet)(r)&&(r.activeEntryID=null,n=!0);return n}])},16366,e=>{"use strict";e.s(["convert_db_to_json",0,function(e){let t=e.sheets.map(e=>({name:e.name,activeEntryID:e.activeEntryID,...!0===e.archived?{archived:!0}:{},tasks:e.tasks.map(e=>({id:e.id,title:e.title,createdAt:e.createdAt.getTime(),updatedAt:e.updatedAt.getTime(),completedAt:null===e.completedAt?null:e.completedAt.getTime()})),entries:e.entries.map(e=>({id:e.id,description:e.description,tags:e.tags,start:e.start.getTime(),end:null===e.end?null:e.end.getTime(),notes:e.notes.map(e=>({text:e.text,timestamp:e.timestamp.getTime()})),...!0===e.archived?{archived:!0}:{}}))}));return{version:e.version,activeSheetName:e.activeSheetName,sheets:t}}])},71786,32806,e=>{"use strict";var t=e.i(50227),n=e.i(2157),r=e.i(72507),s=e.i(72127),i=e.i(30853),a=e.i(93361),o=e.i(24507),l=e.i(47143),u=e.i(62775),c=e.i(16366);async function d(e,t=r.DB_PATH){let s=JSON.stringify((0,c.convert_db_to_json)(e));try{await n.promises.writeFile(t,s)}catch(e){throw Error(`Failed to save DB: ${String(e)}`,{cause:e})}}async function _(e=r.DB_PATH){let c,m=t.default.dirname(e);await (0,i.ensure_dir_exists)(m);try{await n.promises.access(e)}catch{let t=(0,a.gen_db)();return await d(t,e),t}let v=await n.promises.readFile(e,"utf-8");try{c=JSON.parse(v)}catch(t){throw Error(`DB at ${e} is invalid JSON: ${String(t)}`,{cause:t})}let h=(0,o.migrate_json_db)(c);c=h.json_db;let f=(0,s.convert_json_db)(c),p=h.did_migrate,g=(0,u.reconcile_stale_active_entry_ids)(f),w=(0,l.dedupe_tracker_db_sheet_entries)(f);return(p||g||w)&&await d(f,e),f}e.s(["write_local_db",0,d],32806),e.s(["read_local_db",0,_],71786)},27440,e=>{"use strict";var t=e.i(49827),n=e.i(71786);let r=(0,t.cache)(async e=>(0,n.read_local_db)(e));e.s(["read_db",0,r])},14850,e=>{"use strict";e.s(["is_sheet_archived",0,function(e){return!0===e.archived}])},81207,e=>{"use strict";e.s(["collect_known_tags",0,function(e){let t=new Set;for(let n of e.sheets){for(let e of n.entries)for(let n of e.tags){let e=n.trim();e.length>0&&t.add(e)}for(let e of n.tasks)for(let n of e.title.match(/@\w+/g)??[])t.add(n)}return[...t].sort((e,t)=>e.localeCompare(t))}])},93204,e=>{"use strict";e.s(["get_sheet",0,function(e,t){let n=e.sheets.find(({name:e})=>e===t);if(void 0===n)throw Error(`Sheet ${t} not found`);return n}])},72609,52455,13455,45196,58611,e=>{"use strict";let t=Symbol.for("constructDateFrom");function n(e,n){return"function"==typeof e?e(n):e&&"object"==typeof e&&t in e?e[t](n):e instanceof Date?new e.constructor(n):new Date(n)}function r(e,t){return n(t||e,e)}e.s(["constructFromSymbol",0,t,"millisecondsInHour",0,36e5,"millisecondsInMinute",0,6e4,"millisecondsInSecond",0,1e3,"millisecondsInWeek",0,6048e5],52455),e.s(["constructFrom",0,n],13455),e.s(["toDate",0,r],45196),e.s(["endOfDay",0,function(e,t){let n=r(e,t?.in);return n.setHours(23,59,59,999),n}],72609);let s={};e.s(["getDefaultOptions",0,function(){return s}],58611)},69856,e=>{"use strict";var t=e.i(45196);e.s(["startOfDay",0,function(e,n){let r=(0,t.toDate)(e,n?.in);return r.setHours(0,0,0,0),r}])},64457,e=>{"use strict";var t=e.i(58611),n=e.i(45196);e.s(["startOfWeek",0,function(e,r){let s=(0,t.getDefaultOptions)(),i=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,a=(0,n.toDate)(e,r?.in),o=a.getDay();return a.setDate(a.getDate()-(7*(o<i)+o-i)),a.setHours(0,0,0,0),a}])},77052,e=>{"use strict";function t(e,n,r,s=Date.now()){let i=+e.start;return Math.max(0,Math.min(null===e.end?s:+e.end,r)-Math.max(i,n))}var n=e.i(72609),r=e.i(45196),s=e.i(58611),i=e.i(69856),a=e.i(64457);function o(e,t=new Date,l=1){var u;switch(e){case"week":let c,d,_,m;return{startMs:+(0,a.startOfWeek)(t,{weekStartsOn:l}),endMs:+(u={weekStartsOn:l},c=(0,s.getDefaultOptions)(),d=u?.weekStartsOn??u?.locale?.options?.weekStartsOn??c.weekStartsOn??c.locale?.options?.weekStartsOn??0,m=(_=(0,r.toDate)(t,u?.in)).getDay(),_.setDate(_.getDate()+((m<d?-7:0)+6-(m-d))),_.setHours(23,59,59,999),_)};case"month":let v,h,f;return{startMs:+((v=(0,r.toDate)(t,void 0)).setDate(1),v.setHours(0,0,0,0),v),endMs:+(f=(h=(0,r.toDate)(t,void 0)).getMonth(),h.setFullYear(h.getFullYear(),f+1,0),h.setHours(23,59,59,999),h)};default:return{startMs:+(0,i.startOfDay)(t),endMs:+(0,n.endOfDay)(t)}}}var l=e.i(27440);async function u({scope:e="global",sheet_name:n,tag_name:r,db:s}={}){let i=s??await (0,l.read_db)(),a=Date.now(),c=new Date(a),d=o("today",c),_=o("week",c),m=0,v=0,h={last_log_ms:null,active_timer_duration_ms:null};for(let s of i.sheets)for(let i of s.entries)(function(e){let{scope:t,sheet_name:n,tag_name:r,sheet_name_on_entry:s,entry:i}=e;return!!("global"===t||"sheet"===t&&void 0!==n&&s===n||"tag"===t&&void 0!==r&&i.tags.includes(r))})({scope:e,sheet_name:n,tag_name:r,sheet_name_on_entry:s.name,entry:i})&&(m+=t(i,d.startMs,d.endMs,a),v+=t(i,_.startMs,_.endMs,a)),h=function(e,t,n){let r=+e.start,s=null===e.end?null:+e.end,i=null===s?r:Math.max(r,s),a=null===n.last_log_ms||i>n.last_log_ms?i:n.last_log_ms;if(null!==e.end)return{last_log_ms:a,active_timer_duration_ms:n.active_timer_duration_ms};let o=Math.max(0,t-r);return{last_log_ms:a,active_timer_duration_ms:null===n.active_timer_duration_ms||o>n.active_timer_duration_ms?o:n.active_timer_duration_ms}}(i,a,h);let f=null!==h.active_timer_duration_ms||null===h.last_log_ms?null:Math.floor((a-h.last_log_ms)/6e4);return{todayTrackedMs:m,weekTrackedMs:v,activeTimerDurationMs:h.active_timer_duration_ms,minutesSinceLastLog:f}}e.s(["get_focus_nudges_status",0,u],77052)},4760,95634,e=>{"use strict";var t=e.i(81207),n=e.i(12888),r=e.i(14850),s=e.i(72507),i=e.i(29207),a=e.i(5313);async function o(){return!!(0,a.is_supabase_configured)()&&null!==await (0,i.get_authenticated_user_id)()}async function l(){return await o()?`Cloud sync (${"https://ctruizaqyeyidujmtxhc.supabase.co".trim()??"Supabase"})`:s.DB_PATH}var u=e.i(77052),c=e.i(93204),d=e.i(27440),_=e.i(13690),m=e.i(27984),v=e.i(20253),h=e.i(93361),f=e.i(18212);async function p(e){let t=await (0,d.read_db)();t.sheets.some(({name:t})=>t===e)||t.sheets.push((0,h.gen_sheet)(e)),t.activeSheetName=e,await (0,f.write_db)(t)}async function g(e,i={}){let a=i.persist_active_sheet??!0,o=i.include_sheet_entries??!0,h=i.include_focus_nudges??!1,f=i.db??await (0,d.read_db)(),w=function(e,t){let n=t?.trim()??"";if(n.length>0&&e.sheets.some(e=>e.name===n&&!(0,r.is_sheet_archived)(e)))return n;if(null!==e.activeSheetName&&e.sheets.some(t=>t.name===e.activeSheetName&&!(0,r.is_sheet_archived)(t)))return e.activeSheetName;let i=e.sheets.find(e=>!(0,r.is_sheet_archived)(e)&&null!==(0,_.find_running_entry_on_sheet)(e));if(void 0!==i)return i.name;let a=e.sheets.find(e=>!(0,r.is_sheet_archived)(e));return a?.name??s.DEFAULT_SHEET_NAME}(f,e);a&&f.activeSheetName!==w&&(await p(w),f.activeSheetName=w);let{sheets:y}=f,D=[];o&&(D=function(e,t){let n=[...e];switch(t){case"oldest":return n.sort((e,t)=>new Date(e.start).getTime()-new Date(t.start).getTime());case"duration":return n.sort((e,t)=>t.durationMs-e.durationMs);case"description":return n.sort((e,t)=>{let n=e.description.trim()||"Untitled entry",r=t.description.trim()||"Untitled entry";return n.localeCompare(r)});default:return n.sort((e,t)=>new Date(t.start).getTime()-new Date(e.start).getTime())}}(function(e){let{activeEntryID:t,entries:n,name:r}=e;return(0,v.dedupe_sheet_entries_by_id)(n).map(e=>(0,m.serialize_entry)(e,r,t===e.id&&null===e.end))}((0,c.get_sheet)(f,w)),"newest"));let S=function(e,t){let n=e.sheets.find(({name:e})=>e===t);if(void 0===n)return null;let r=(0,_.find_running_entry_on_sheet)(n);return null===r?null:(0,m.serialize_entry)(r,n.name,!0)}(f,w),E=f.sheets.flatMap(e=>{let t=(0,_.find_running_entry_on_sheet)(e);return null==t?[]:[(0,m.serialize_entry)(t,e.name,!0)]}),x=S??E[0]??null,b=h?await (0,u.get_focus_nudges_status)({scope:"global",db:f}):void 0;return{dbPath:await l(),activeSheetName:w,knownTags:(0,t.collect_known_tags)(f),sheets:y.map(e=>({name:e.name,activeEntryID:e.activeEntryID,entryCount:e.entries.filter(e=>!(0,n.is_entry_archived)(e)).length,isActive:e.name===w,hasActiveEntry:null!==(0,_.find_running_entry_on_sheet)(e),...(0,r.is_sheet_archived)(e)?{archived:!0}:{}})),activeEntry:S,runningEntry:x,runningEntries:E,activeSheetEntries:D,activeSheetTotalMs:D.reduce((e,t)=>e+t.durationMs,0),activeSheetEntriesLoaded:o,focusNudgesStatusGlobal:b}}e.s(["set_active_sheet",0,p],95634),e.s(["get_tracker_state",0,g],4760)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__0m8yoxl._.js.map
|
|
@@ -51,7 +51,7 @@ Expiration Time: ${s.toISOString()}`),o&&(b+=`
|
|
|
51
51
|
Not Before: ${o.toISOString()}`),l&&(b+=`
|
|
52
52
|
Request ID: ${l}`),c){let e="\nResources:";for(let t of c){if(!t||"string"!=typeof t)throw Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${t}`);e+=`
|
|
53
53
|
- ${t}`}b+=e}return`${m}
|
|
54
|
-
${b}`}({domain:b.host,address:v,statement:g,uri:b.href,version:"1",chainId:w,nonce:null==(n=null==m?void 0:m.signInWithEthereum)?void 0:n.nonce,issuedAt:null!=(i=null==(s=null==m?void 0:m.signInWithEthereum)?void 0:s.issuedAt)?i:new Date,expirationTime:null==(a=null==m?void 0:m.signInWithEthereum)?void 0:a.expirationTime,notBefore:null==(o=null==m?void 0:m.signInWithEthereum)?void 0:o.notBefore,requestId:null==(l=null==m?void 0:m.signInWithEthereum)?void 0:l.requestId,resources:null==(c=null==m?void 0:m.signInWithEthereum)?void 0:c.resources}),f=await h.request({method:"personal_sign",params:[(d=p,"0x"+Array.from(new TextEncoder().encode(d),e=>e.toString(16).padStart(2,"0")).join("")),v]})}try{let{data:t,error:r}=await sq(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:f},(null==(u=e.options)?void 0:u.captchaToken)?{gotrue_meta_security:{captcha_token:null==(h=e.options)?void 0:h.captchaToken}}:null),xform:sF});if(r)throw r;if(!t||!t.session||!t.user){let e=new si;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign({},t),error:r})}catch(e){if(n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){var t,r,n,s,i,a,o,l,c,u,h,d;let p,f;if("message"in e)p=e.message,f=e.signature;else{let{chain:h,wallet:d,statement:g,options:m}=e;if("object"!=typeof d||!(null==m?void 0:m.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");let b=new URL(null!=(t=null==m?void 0:m.url)?t:window.location.href);if("signIn"in d&&d.signIn){let e,t=await d.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},null==m?void 0:m.signInWithSolana),{version:"1",domain:b.host,uri:b.href}),g?{statement:g}:null));if(Array.isArray(t)&&t[0]&&"object"==typeof t[0])e=t[0];else if(t&&"object"==typeof t&&"signedMessage"in t&&"signature"in t)e=t;else throw Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in e&&"signature"in e&&("string"==typeof e.signedMessage||e.signedMessage instanceof Uint8Array)&&e.signature instanceof Uint8Array)p="string"==typeof e.signedMessage?e.signedMessage:new TextDecoder().decode(e.signedMessage),f=e.signature;else throw Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in d)||"function"!=typeof d.signMessage||!("publicKey"in d)||"object"!=typeof d||!d.publicKey||!("toBase58"in d.publicKey)||"function"!=typeof d.publicKey.toBase58)throw Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${b.host} wants you to sign in with your Solana account:`,d.publicKey.toBase58(),...g?["",g,""]:[""],"Version: 1",`URI: ${b.href}`,`Issued At: ${null!=(n=null==(r=null==m?void 0:m.signInWithSolana)?void 0:r.issuedAt)?n:new Date().toISOString()}`,...(null==(s=null==m?void 0:m.signInWithSolana)?void 0:s.notBefore)?[`Not Before: ${m.signInWithSolana.notBefore}`]:[],...(null==(i=null==m?void 0:m.signInWithSolana)?void 0:i.expirationTime)?[`Expiration Time: ${m.signInWithSolana.expirationTime}`]:[],...(null==(a=null==m?void 0:m.signInWithSolana)?void 0:a.chainId)?[`Chain ID: ${m.signInWithSolana.chainId}`]:[],...(null==(o=null==m?void 0:m.signInWithSolana)?void 0:o.nonce)?[`Nonce: ${m.signInWithSolana.nonce}`]:[],...(null==(l=null==m?void 0:m.signInWithSolana)?void 0:l.requestId)?[`Request ID: ${m.signInWithSolana.requestId}`]:[],...(null==(u=null==(c=null==m?void 0:m.signInWithSolana)?void 0:c.resources)?void 0:u.length)?["Resources",...m.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join("\n");let e=await d.signMessage(new TextEncoder().encode(p),"utf8");if(!e||!(e instanceof Uint8Array))throw Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");f=e}}try{let{data:t,error:r}=await sq(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:sw(f)},(null==(h=e.options)?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null==(d=e.options)?void 0:d.captchaToken}}:null),xform:sF});if(r)throw r;if(!t||!t.session||!t.user){let e=new si;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign({},t),error:r})}catch(e){if(n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e){let t=await sS(this.storage,`${this.storageKey}-code-verifier`),[r,n]=(null!=t?t:"").split("/");try{if(!r&&"pkce"===this.flowType)throw new sl;let{data:t,error:s}=await sq(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:sF});if(await sR(this.storage,`${this.storageKey}-code-verifier`),s)throw s;if(!t||!t.session||!t.user){let e=new si;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("recovery"===n?"PASSWORD_RECOVERY":"SIGNED_IN",t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=n?n:null}),error:s})}catch(e){if(await sR(this.storage,`${this.storageKey}-code-verifier`),n7(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{let{options:t,provider:r,token:n,access_token:s,nonce:i}=e,{data:a,error:o}=await sq(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:n,access_token:s,nonce:i,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:sF});if(o)return this._returnResult({data:{user:null,session:null},error:o});if(!a||!a.session||!a.user){let e=new si;return this._returnResult({data:{user:null,session:null},error:e})}return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),this._returnResult({data:a,error:o})}catch(e){if(n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,r,n,s,i;try{if("email"in e){let{email:n,options:s}=e,i=null,a=null;"pkce"===this.flowType&&([i,a]=await sA(this.storage,this.storageKey));let{error:o}=await sq(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:n,data:null!=(t=null==s?void 0:s.data)?t:{},create_user:null==(r=null==s?void 0:s.shouldCreateUser)||r,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},code_challenge:i,code_challenge_method:a},redirectTo:null==s?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if("phone"in e){let{phone:t,options:r}=e,{data:a,error:o}=await sq(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!=(n=null==r?void 0:r.data)?n:{},create_user:null==(s=null==r?void 0:r.shouldCreateUser)||s,gotrue_meta_security:{captcha_token:null==r?void 0:r.captchaToken},channel:null!=(i=null==r?void 0:r.channel)?i:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o})}throw new sa("You must provide either an email or phone number.")}catch(e){if(await sR(this.storage,`${this.storageKey}-code-verifier`),n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,r;try{let n,s;"options"in e&&(n=null==(t=e.options)?void 0:t.redirectTo,s=null==(r=e.options)?void 0:r.captchaToken);let{data:i,error:a}=await sq(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:n,xform:sF});if(a)throw a;if(!i)throw Error("An error occurred on token verification.");let o=i.session,l=i.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if(n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,r,n,s;try{let i=null,a=null;"pkce"===this.flowType&&([i,a]=await sA(this.storage,this.storageKey));let o=await sq(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.redirectTo)?r:void 0}),(null==(n=null==e?void 0:e.options)?void 0:n.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:a}),headers:this.headers,xform:sV});return null==(s=o.data)||s.url,this._returnResult(o)}catch(e){if(await sR(this.storage,`${this.storageKey}-code-verifier`),n7(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,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 sn;let{error:n}=await sq(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:n})})}catch(e){if(n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{let t=`${this.url}/resend`;if("email"in e){let{email:r,type:n,options:s}=e,{error:i}=await sq(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},redirectTo:null==s?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:i})}if("phone"in e){let{phone:r,type:n,options:s}=e,{data:i,error:a}=await sq(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==i?void 0:i.message_id},error:a})}throw new sa("You must provide either an email or phone number and a type")}catch(e){if(n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,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 t=null,r=await sS(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),null!==r&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};let n=!!t.expires_at&&1e3*t.expires_at-Date.now()<9e4;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){let e=await sS(this.userStorage,this.storageKey+"-user");(null==e?void 0:e.user)?t.user=e.user:t.user=s$()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){var e;let r={value:this.suppressGetSessionWarning};t.user=(e=t.user,new Proxy(e,{get:(e,t,n)=>{if("__isInsecureUserWarningProxy"===t)return!0;if("symbol"==typeof t){let r=t.toString();if("Symbol(Symbol.toPrimitive)"===r||"Symbol(Symbol.toStringTag)"===r||"Symbol(util.inspect.custom)"===r||"Symbol(nodejs.util.inspect.custom)"===r)return Reflect.get(e,t,n)}return r.value||"string"!=typeof t||(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),r.value=!0),Reflect.get(e,t,n)}})),r.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}let{data:s,error:i}=await this._callRefreshToken(t.refresh_token);if(i)return this._returnResult({data:{session:null},error:i});return this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;let t=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{if(e)return await sq(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:sW});return await this._useSession(async e=>{var t,r,n;let{data:s,error:i}=e;if(i)throw i;return(null==(t=s.session)?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await sq(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!=(n=null==(r=s.session)?void 0:r.access_token)?n:void 0,xform:sW}):{data:{user:null},error:new sn}})}catch(e){if(n7(e))return ss(e)&&(await this._removeSession(),await sR(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async r=>{let{data:n,error:s}=r;if(s)throw s;if(!n.session)throw new sn;let i=n.session,a=null,o=null;"pkce"===this.flowType&&null!=e.email&&([a,o]=await sA(this.storage,this.storageKey));let{data:l,error:c}=await sq(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:i.access_token,xform:sW});if(c)throw c;return i.user=l.user,await this._saveSession(i),await this._notifyAllSubscribers("USER_UPDATED",i),this._returnResult({data:{user:i.user},error:null})})}catch(e){if(await sR(this.storage,`${this.storageKey}-code-verifier`),n7(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new sn;let t=Date.now()/1e3,r=t,n=!0,s=null,{payload:i}=sk(e.access_token);if(i.exp&&(n=(r=i.exp)<=t),n){let{data:t,error:r}=await this._callRefreshToken(e.refresh_token);if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!t)return{data:{user:null,session:null},error:null};s=t}else{let{data:n,error:i}=await this._getUser(e.access_token);if(i)return this._returnResult({data:{user:null,session:null},error:i});s={access_token:e.access_token,refresh_token:e.refresh_token,user:n.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(e){if(n7(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var r;if(!e){let{data:n,error:s}=t;if(s)throw s;e=null!=(r=n.session)?r:void 0}if(!(null==e?void 0:e.refresh_token))throw new sn;let{data:n,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):n?this._returnResult({data:{user:n.user,session:n},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if(n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){try{throw new so("No browser detected.")}catch(e){if(n7(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return"function"==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){let t=await sS(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var r;let{data:n,error:s}=t;if(s&&!ss(s))return this._returnResult({error:s});let i=null==(r=n.session)?void 0:r.access_token;if(i){let{error:t}=await this.admin.signOut(i,e);if(t&&!(n7(t)&&"AuthApiError"===t.name&&(404===t.status||401===t.status||403===t.status)||ss(t)))return this._returnResult({error:t})}return"others"!==e&&(await this._removeSession(),await sR(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){let t=Symbol("auth-callback"),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(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)})})(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async t=>{var r,n;try{let{data:{session:n},error:s}=t;if(s)throw s;await (null==(r=this.stateChangeEmitters.get(e))?void 0:r.callback("INITIAL_SESSION",n)),this._debug("INITIAL_SESSION","callback id",e,"session",n)}catch(t){await (null==(n=this.stateChangeEmitters.get(e))?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),ss(t)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let r=null,n=null;"pkce"===this.flowType&&([r,n]=await sA(this.storage,this.storageKey,!0));try{return await sq(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:n,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(await sR(this.storage,`${this.storageKey}-code-verifier`),n7(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){var e;try{let{data:t,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:null!=(e=t.user.identities)?e:[]},error:null})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){try{let{data:t,error:r}=await this._useSession(async t=>{var r,n,s,i,a;let{data:o,error:l}=t;if(l)throw l;let c=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null==(r=e.options)?void 0:r.redirectTo,scopes:null==(n=e.options)?void 0:n.scopes,queryParams:null==(s=e.options)?void 0:s.queryParams,skipBrowserRedirect:!0});return await sq(this.fetch,"GET",c,{headers:this.headers,jwt:null!=(a=null==(i=o.session)?void 0:i.access_token)?a:void 0})});if(r)throw r;return this._returnResult({data:{provider:e.provider,url:null==t?void 0:t.url},error:null})}catch(t){if(n7(t))return this._returnResult({data:{provider:e.provider,url:null},error:t});throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var r;try{let{error:n,data:{session:s}}=t;if(n)throw n;let{options:i,provider:a,token:o,access_token:l,nonce:c}=e,{data:u,error:h}=await sq(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!=(r=null==s?void 0:s.access_token)?r:void 0,body:{provider:a,id_token:o,access_token:l,nonce:c,link_identity:!0,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:sF});if(h)return this._returnResult({data:{user:null,session:null},error:h});if(!u||!u.session||!u.user)return this._returnResult({data:{user:null,session:null},error:new si});return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("USER_UPDATED",u.session)),this._returnResult({data:u,error:h})}catch(e){if(await sR(this.storage,`${this.storageKey}-code-verifier`),n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,n;let{data:s,error:i}=t;if(i)throw i;return await sq(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!=(n=null==(r=s.session)?void 0:r.access_token)?n:void 0})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){let t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{var r,n;let s=Date.now();return await (r=async r=>(r>0&&await sO(200*Math.pow(2,r-1)),this._debug(t,"refreshing attempt",r),await sq(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:sF})),n=(e,t)=>{let r=200*Math.pow(2,e);return t&&su(t)&&Date.now()+r-s<3e4},new Promise((e,t)=>{(async()=>{for(let s=0;s<1/0;s++)try{let t=await r(s);if(!n(s,null,t))return void e(t)}catch(e){if(!n(s,e))return void t(e)}})()}))}catch(e){if(this._debug(t,"error",e),n7(e))return this._returnResult({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(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,t;let r="#_recoverAndRefresh()";this._debug(r,"begin");try{let n=await sS(this.storage,this.storageKey);if(n&&this.userStorage){let t=await sS(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!t&&(t={user:n.user},await sE(this.userStorage,this.storageKey+"-user",t)),n.user=null!=(e=null==t?void 0:t.user)?e:s$()}else if(n&&!n.user&&!n.user){let e=await sS(this.storage,this.storageKey+"-user");e&&(null==e?void 0:e.user)?(n.user=e.user,await sR(this.storage,this.storageKey+"-user"),await sE(this.storage,this.storageKey,n)):n.user=s$()}if(this._debug(r,"session from storage",n),!this._isValidSession(n)){this._debug(r,"session is not valid"),null!==n&&await this._removeSession();return}let s=(null!=(t=n.expires_at)?t:1/0)*1e3-Date.now()<9e4;if(this._debug(r,`session has${s?"":" not"} expired with margin of 90000s`),s){if(this.autoRefreshToken&&n.refresh_token){let{error:e}=await this._callRefreshToken(n.refresh_token);e&&(console.error(e),su(e)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else if(n.user&&!0===n.user.__isUserNotAvailableProxy)try{let{data:e,error:t}=await this._getUser(n.access_token);!t&&(null==e?void 0:e.user)?(n.user=e.user,await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(e){console.error("Error getting user data:",e),this._debug(r,"error getting user data, skipping SIGNED_IN notification",e)}else await this._notifyAllSubscribers("SIGNED_IN",n)}catch(e){this._debug(r,"error",e),console.error(e);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var t,r;if(!e)throw new sn;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let n=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new sT;let{data:t,error:r}=await this._refreshAccessToken(e);if(r)throw r;if(!t.session)throw new sn;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);let n={data:t.session,error:null};return this.refreshingDeferred.resolve(n),n}catch(e){if(this._debug(n,"error",e),n7(e)){let r={data:null,error:e};return su(e)||await this._removeSession(),null==(t=this.refreshingDeferred)||t.resolve(r),r}throw null==(r=this.refreshingDeferred)||r.reject(e),e}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(e,t,r=!0){let n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",t,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});let n=[],s=Array.from(this.stateChangeEmitters.values()).map(async r=>{try{await r.callback(e,t)}catch(e){n.push(e)}});if(await Promise.all(s),n.length>0){for(let e=0;e<n.length;e+=1)console.error(n[e]);throw n[0]}}finally{this._debug(n,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await sR(this.storage,`${this.storageKey}-code-verifier`);let t=Object.assign({},e),r=t.user&&!0===t.user.__isUserNotAvailableProxy;if(this.userStorage){!r&&t.user&&await sE(this.userStorage,this.storageKey+"-user",{user:t.user});let e=Object.assign({},t);delete e.user;let n=sL(e);await sE(this.storage,this.storageKey,n)}else{let e=sL(t);await sE(this.storage,this.storageKey,e)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await sR(this.storage,this.storageKey),await sR(this.storage,this.storageKey+"-code-verifier"),await sR(this.storage,this.storageKey+"-user"),this.userStorage&&await sR(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()"),this.visibilityChangedCallback,this.visibilityChangedCallback=null}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():"u">typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(e);let t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&"object"==typeof t&&"function"==typeof t.unref?t.unref():"u">typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);let t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}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)return void this._debug("#_autoRefreshTokenTick()","no session");let n=Math.floor((1e3*r.expires_at-e)/3e4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),n<=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 instanceof sQ)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){return this._debug("#_handleVisibilityChange()"),this.autoRefreshToken&&this.startAutoRefresh(),!1}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(this.lockAcquireTimeout,async()=>{"visible"!==document.visibilityState?this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting"):await this._recoverAndRefresh()}))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,r){let n=[`provider=${encodeURIComponent(t)}`];if((null==r?void 0:r.redirectTo)&&n.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),(null==r?void 0:r.scopes)&&n.push(`scopes=${encodeURIComponent(r.scopes)}`),"pkce"===this.flowType){let[e,t]=await sA(this.storage,this.storageKey),r=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});n.push(r.toString())}if(null==r?void 0:r.queryParams){let e=new URLSearchParams(r.queryParams);n.push(e.toString())}return(null==r?void 0:r.skipBrowserRedirect)&&n.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${n.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var r;let{data:n,error:s}=t;return s?this._returnResult({data:null,error:s}):await sq(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var r,n;let{data:s,error:i}=t;if(i)return this._returnResult({data:null,error:i});let a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},"phone"===e.factorType?{phone:e.phone}:"totp"===e.factorType?{issuer:e.issuer}:{}),{data:o,error:l}=await sq(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:null==(r=null==s?void 0:s.session)?void 0:r.access_token});return l?this._returnResult({data:null,error:l}):("totp"===e.factorType&&"totp"===o.type&&(null==(n=null==o?void 0:o.totp)?void 0:n.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),this._returnResult({data:o,error:null}))})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var r;let{data:n,error:s}=t;if(s)return this._returnResult({data:null,error:s});let i=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:"create"===e.webauthn.type?s5(e.webauthn.credential_response):s6(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:o}=await sq(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:i,headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token});return o?this._returnResult({data:null,error:o}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:o}))})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var r;let{data:n,error:s}=t;if(s)return this._returnResult({data:null,error:s});let i=await sq(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token});if(i.error)return i;let{data:a}=i;if("webauthn"!==a.type)return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:s3(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:s4(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}})}async _challengeAndVerify(e){let{data:t,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;let{data:{user:t},error:r}=await this.getUser();if(r)return{data:null,error:r};let n={all:[],phone:[],totp:[],webauthn:[]};for(let r of null!=(e=null==t?void 0:t.factors)?e:[])n.all.push(r),"verified"===r.status&&n[r.factor_type].push(r);return{data:n,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,r,n,s;if(e)try{let{payload:n}=sk(e),s=null;n.aal&&(s=n.aal);let i=s,{data:{user:a},error:o}=await this.getUser(e);if(o)return this._returnResult({data:null,error:o});(null!=(r=null==(t=null==a?void 0:a.factors)?void 0:t.filter(e=>"verified"===e.status))?r:[]).length>0&&(i="aal2");let l=n.amr||[];return{data:{currentLevel:s,nextLevel:i,currentAuthenticationMethods:l},error:null}}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}let{data:{session:i},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:o}=sk(i.access_token),l=null;o.aal&&(l=o.aal);let c=l;return(null!=(s=null==(n=i.user.factors)?void 0:n.filter(e=>"verified"===e.status))?s:[]).length>0&&(c="aal2"),{data:{currentLevel:l,nextLevel:c,currentAuthenticationMethods:o.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;return n?this._returnResult({data:null,error:n}):r?await sq(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new sn})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new sn});let s=await sq(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"approve"},xform:e=>({data:e,error:null})});return s.data&&s.data.redirect_url,s})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new sn});let s=await sq(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"deny"},xform:e=>({data:e,error:null})});return s.data&&s.data.redirect_url,s})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;return r?this._returnResult({data:null,error:r}):t?await sq(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new sn})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;return n?this._returnResult({data:null,error:n}):r?(await sq(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new sn})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let r=t.keys.find(t=>t.kid===e);if(r)return r;let n=Date.now();if((r=this.jwks.keys.find(t=>t.kid===e))&&this.jwks_cached_at+6e5>n)return r;let{data:s,error:i}=await sq(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(i)throw i;return s.keys&&0!==s.keys.length&&(this.jwks=s,this.jwks_cached_at=n,r=s.keys.find(t=>t.kid===e))?r:null}async getClaims(e,t={}){try{var r;let n,s=e;if(!s){let{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});s=e.session.access_token}let{header:i,payload:a,signature:o,raw:{header:l,payload:c}}=sk(s);(null==t?void 0:t.allowExpired)||function(e){if(!e)throw Error("Missing exp claim");if(e<=Math.floor(Date.now()/1e3))throw Error("JWT has expired")}(a.exp);let u=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks);if(!u){let{error:e}=await this.getUser(s);if(e)throw e;return{data:{claims:a,header:i,signature:o},error:null}}let h=function(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw Error("Invalid alg claim")}}(i.alg),d=await crypto.subtle.importKey("jwk",u,h,!0,["verify"]);if(!await crypto.subtle.verify(h,d,o,(r=`${l}.${c}`,n=[],!function(e,t){for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>55295&&n<=56319){let t=(n-55296)*1024&65535;n=(e.charCodeAt(r+1)-56320&65535|t)+65536,r+=1}!function(e,t){if(e<=127)return t(e);if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}(n,t)}}(r,e=>n.push(e)),new Uint8Array(n))))throw new sd("Invalid JWT signature");return{data:{claims:a,header:i,signature:o},error:null}}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){var t,r,n;sD(this.experimental);try{1;return this._returnResult({data:null,error:new st("Browser does not support WebAuthn",null)})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){var t,r;sD(this.experimental);try{1;return this._returnResult({data:null,error:new st("Browser does not support WebAuthn",null)})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){sD(this.experimental);try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!t)return this._returnResult({data:null,error:new sn});let{data:n,error:s}=await sq(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){sD(this.experimental);try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new sn});let{data:s,error:i}=await sq(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:r.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){var t;sD(this.experimental);try{let{data:r,error:n}=await sq(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:null==(t=null==e?void 0:e.options)?void 0:t.captchaToken}}});if(n)return this._returnResult({data:null,error:n});return this._returnResult({data:r,error:null})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){sD(this.experimental);try{let{data:t,error:r}=await sq(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:sF});if(r)return this._returnResult({data:null,error:r});return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:t,error:null})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){sD(this.experimental);try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!t)return this._returnResult({data:null,error:new sn});let{data:n,error:s}=await sq(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){sD(this.experimental);try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new sn});let{data:s,error:i}=await sq(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,body:{friendly_name:e.friendlyName}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){sD(this.experimental);try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new sn});let{error:s}=await sq(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,noResolveJson:!0});return s?this._returnResult({data:null,error:s}):this._returnResult({data:null,error:null})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}}il.nextInstanceID={};let ic=il,iu="";iu="u">typeof Deno?"deno":"u">typeof document?"web":"u">typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";let ih={headers:{"X-Client-Info":`supabase-js-${iu}/2.106.0`}},id={schema:"public"},ip={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},ig={},im={enabled:!1,respectSamplingDecision:!0},ib=null;function iy(e){return(iy="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function iv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function iw(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?iv(Object(r),!0).forEach(function(t){!function(e,t,r){var n;(n=function(e,t){if("object"!=iy(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=iy(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==iy(n)?n:n+"")in e)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iv(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}async function i_(e,t,r){if(!function(e,t){let r;if(!e||!t||0===t.length)return!1;if(e instanceof URL)r=e;else try{r=new URL(e)}catch(e){return!1}for(let e of t)try{if("string"==typeof e){if(function(e,t){if(t===e)return!0;if(t.startsWith("*.")){let r=t.slice(2);if(e.endsWith(r)&&(e===r||e.endsWith("."+r)))return!0}return!1}(r.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(r.hostname))return!0}else if("function"==typeof e&&e(r))return!0}catch(e){continue}return!1}("string"==typeof e||e instanceof URL?e:e.url,t))return null;let n=await function(){var e,t,r,n;return e=this,t=void 0,r=void 0,n=function*(){try{let e=yield(null===ib&&(ib=import("@opentelemetry/api").catch(()=>null)),ib);if(!e||!e.propagation||!e.context)return null;let t={};e.propagation.inject(e.context.active(),t);let r=t.traceparent;if(!r)return null;return{traceparent:r,tracestate:t.tracestate,baggage:t.baggage}}catch(e){return null}},new(r||(r=Promise))(function(s,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?s(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((n=n.apply(e,t||[])).next())})}();if(!n||!n.traceparent)return null;if(r){let e=function(e){if(!e||"string"!=typeof e)return null;let t=e.split("-");if(4!==t.length)return null;let[r,n,s,i]=t;if(2!==r.length||32!==n.length||16!==s.length||2!==i.length)return null;let a=/^[0-9a-f]+$/i;return a.test(r)&&a.test(n)&&a.test(s)&&a.test(i)&&"00000000000000000000000000000000"!==n&&"0000000000000000"!==s?{version:r,traceId:n,parentId:s,traceFlags:i,isSampled:(1&parseInt(i,16))==1}:null}(n.traceparent);if(e&&!e.isSampled)return null}return n}function iE(e){return"boolean"==typeof e?{enabled:e}:e}var iS=class extends ic{constructor(e){super(e)}},iR=class{constructor(e,t,r){var n,s,i;this.supabaseUrl=e,this.supabaseKey=t;const a=function(e){let t=null==e?void 0:e.trim();if(!t)throw Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(t.endsWith("/")?t:t+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}(e);if(!t)throw Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const o=`sb-${a.hostname.split(".")[0]}-auth-token`,l=function(e,t){var r,n,s,i,a,o;let{db:l,auth:c,realtime:u,global:h}=e,{db:d,auth:p,realtime:f,global:g}=t,m=iE(e.tracePropagation),b=iE(t.tracePropagation),y={db:iw(iw({},d),l),auth:iw(iw({},p),c),realtime:iw(iw({},f),u),storage:{},global:iw(iw(iw({},g),h),{},{headers:iw(iw({},null!=(r=null==g?void 0:g.headers)?r:{}),null!=(n=null==h?void 0:h.headers)?n:{})}),tracePropagation:{enabled:null!=(s=null!=(i=null==m?void 0:m.enabled)?i:null==b?void 0:b.enabled)&&s,respectSamplingDecision:null==(a=null!=(o=null==m?void 0:m.respectSamplingDecision)?o:null==b?void 0:b.respectSamplingDecision)||a},accessToken:async()=>""};return e.accessToken?y.accessToken=e.accessToken:delete y.accessToken,y}(null!=r?r:{},{db:id,realtime:ig,auth:iw(iw({},ip),{},{storageKey:o}),global:ih,tracePropagation:im});this.settings=l,this.storageKey=null!=(n=l.auth.storageKey)?n:"",this.headers=null!=(s=l.global.headers)?s:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!=(i=l.auth)?i:{},this.headers,l.global.fetch),this.fetch=((e,t,r,n,s)=>{let i=n?(...e)=>n(...e):(...e)=>fetch(...e),a=Headers,o=(null==s?void 0:s.enabled)===!0,l=(null==s?void 0:s.respectSamplingDecision)!==!1,c=o?function(e){let t=[];try{let r=new URL(e);t.push(r.hostname)}catch(e){}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}(t):null;return async(t,n)=>{var s;let o=null!=(s=await r())?s:e,u=new a(null==n?void 0:n.headers);if(u.has("apikey")||u.set("apikey",e),u.has("Authorization")||u.set("Authorization",`Bearer ${o}`),c){let e=await i_(t,c,l);e&&(e.traceparent&&!u.has("traceparent")&&u.set("traceparent",e.traceparent),e.tracestate&&!u.has("tracestate")&&u.set("tracestate",e.tracestate),e.baggage&&!u.has("baggage")&&u.set("baggage",e.baggage))}return i(t,iw(iw({},n),{},{headers:u}))}})(t,e,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(iw({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new rA(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new n2(this.storageUrl.href,this.headers,this.fetch,null==r?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new rb(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={head:!1,get:!1,count:void 0}){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()}async _getAccessToken(){var e,t;if(this.accessToken)return await this.accessToken();let{data:r}=await this.auth.getSession();return null!=(e=null==(t=r.session)?void 0:t.access_token)?e:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:i,flowType:a,lock:o,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:h,skipAutoInitialize:d},p,f){let g={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new iS({url:this.authUrl.href,headers:iw(iw({},g),p),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,flowType:a,lock:o,debug:l,throwOnError:c,experimental:u,fetch:f,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new nf(this.realtimeUrl.href,iw(iw({},e),{},{params:iw(iw({},{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.changedAccessToken=r,this.realtime.setAuth(r)):"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0)}};(function(){let e=globalThis.process;if(!e)return!1;let t=e.version;if(null==t)return!1;let r=t.match(/^v(\d+)\./);return!!r&&18>=parseInt(r[1],10)})()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");var iT=e.i(64742);let ik={path:"/",sameSite:"lax",httpOnly:!1,maxAge:3456e4},iO=/^(.*)[.](0|[1-9][0-9]*)$/;function iP(e,t){if(e===t)return!0;let r=e.match(iO);return!!r&&r[1]===t}function ix(e,t,r){let n=r??3180,s=encodeURIComponent(t);if(s.length<=n)return[{name:e,value:t}];let i=[];for(;s.length>0;){let e=s.slice(0,n),t=e.lastIndexOf("%");t>n-3&&(e=e.slice(0,t));let r="";for(;e.length>0;)try{r=decodeURIComponent(e);break}catch(t){if(t instanceof URIError&&"%"===e.at(-3)&&e.length>3)e=e.slice(0,e.length-3);else throw t}i.push(r),s=s.slice(e.length)}return i.map((t,r)=>({name:`${e}.${r}`,value:t}))}async function iC(e,t){let r=await t(e);if(r)return r;let n=[];for(let r=0;;r++){let s=`${e}.${r}`,i=await t(s);if(!i)break;n.push(i)}return n.length>0?n.join(""):null}iT.parse,iT.serialize;let iA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),iN=" \n\r=".split(""),iI=(()=>{let e=Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<iN.length;t+=1)e[iN[t].charCodeAt(0)]=-2;for(let t=0;t<iA.length;t+=1)e[iA[t].charCodeAt(0)]=t;return e})();function ij(e){let t=[],r=0,n=0;if(function(e,t){for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>55295&&n<=56319){let t=(n-55296)*1024&65535;n=(e.charCodeAt(r+1)-56320&65535|t)+65536,r+=1}!function(e,t){if(e<=127)return t(e);if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}(n,t)}}(e,e=>{for(r=r<<8|e,n+=8;n>=6;){let e=r>>n-6&63;t.push(iA[e]),n-=6}}),n>0)for(r<<=6-n,n=6;n>=6;){let e=r>>n-6&63;t.push(iA[e]),n-=6}return t.join("")}let iD="base64-";function i$(e){let t;if(!e.startsWith(iD))return e;try{t=function(e){let t=[],r=e=>{t.push(String.fromCodePoint(e))},n={utf8seq:0,codepoint:0},s=0,i=0;for(let t=0;t<e.length;t+=1){let a=iI[e.charCodeAt(t)];if(a>-1)for(s=s<<6|a,i+=6;i>=8;)(function(e,t,r){if(0===t.utf8seq){if(e<=127)return r(e);for(let r=1;r<6;r+=1)if((e>>7-r&1)==0){t.utf8seq=r;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else if(4===t.utf8seq)t.codepoint=7&e;else throw Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&r(t.codepoint)}})(s>>i-8&255,n,r),i-=8;else if(-2===a)continue;else throw Error(`Invalid Base64-URL character "${e.at(t)}" at position ${t}`)}return t.join("")}(e.substring(iD.length))}catch(e){return console.warn("@supabase/ssr: could not base64url-decode chunked cookie value, treating as absent. Cookie chunks may have been written partially across responses.",e),null}try{JSON.parse(t)}catch{return console.warn("@supabase/ssr: chunked cookie decoded to invalid JSON, treating as absent. This usually indicates that cookie chunks from different writes were combined (e.g. response committed before all Set-Cookie headers were sent)."),null}return t}async function iL({getAll:e,setAll:t,setItems:r,removedItems:n},s){let i=s.cookieEncoding,a=s.cookieOptions??null,o=await e([...r?Object.keys(r):[],...n?Object.keys(n):[]]),l=o?.map(({name:e})=>e)||[],c=Object.keys(n).flatMap(e=>l.filter(t=>iP(t,e))),u=Object.keys(r).flatMap(e=>{let t=new Set(l.filter(t=>iP(t,e))),n=r[e];"base64url"===i&&(n=iD+ij(n));let s=ix(e,n);return s.forEach(e=>{t.delete(e.name)}),c.push(...t),s}),h={...ik,...a,maxAge:0},d={...ik,...a,maxAge:ik.maxAge};delete h.name,delete d.name,await t([...c.map(e=>({name:e,value:"",options:h})),...u.map(({name:e,value:t})=>({name:e,value:t,options:d}))],{"Cache-Control":"private, no-cache, no-store, must-revalidate, max-age=0",Expires:"0",Pragma:"no-cache"})}let iM=!1,iU=["@supabase/auth-helpers-nextjs","@supabase/auth-helpers-react","@supabase/auth-helpers-remix","@supabase/auth-helpers-sveltekit"];function iB(){return("https://ctruizaqyeyidujmtxhc.supabase.co".trim()??"").length>0&&("sb_publishable_gTYHeWoWIPPW3SIC4cYaXw_ux7UL_Jb".trim()??"").length>0}async function iq(e){if(!iB())return rh.NextResponse.next({request:e});let{supabase:t,response:r}=function(e){let t=rh.NextResponse.next({request:e}),{anon_key:r,url:n}=function(){if(!iB())throw Error("Supabase is not configured");return{url:"https://ctruizaqyeyidujmtxhc.supabase.co".trim(),anon_key:"sb_publishable_gTYHeWoWIPPW3SIC4cYaXw_ux7UL_Jb".trim()}}();return{supabase:function(e,t,r){if(!function(){if(iM||"u"<typeof process||!process.env?.npm_package_name)return;let e=process.env.npm_package_name;iU.includes(e)&&(iM=!0,console.warn(`
|
|
54
|
+
${b}`}({domain:b.host,address:v,statement:g,uri:b.href,version:"1",chainId:w,nonce:null==(n=null==m?void 0:m.signInWithEthereum)?void 0:n.nonce,issuedAt:null!=(i=null==(s=null==m?void 0:m.signInWithEthereum)?void 0:s.issuedAt)?i:new Date,expirationTime:null==(a=null==m?void 0:m.signInWithEthereum)?void 0:a.expirationTime,notBefore:null==(o=null==m?void 0:m.signInWithEthereum)?void 0:o.notBefore,requestId:null==(l=null==m?void 0:m.signInWithEthereum)?void 0:l.requestId,resources:null==(c=null==m?void 0:m.signInWithEthereum)?void 0:c.resources}),f=await h.request({method:"personal_sign",params:[(d=p,"0x"+Array.from(new TextEncoder().encode(d),e=>e.toString(16).padStart(2,"0")).join("")),v]})}try{let{data:t,error:r}=await sq(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:f},(null==(u=e.options)?void 0:u.captchaToken)?{gotrue_meta_security:{captcha_token:null==(h=e.options)?void 0:h.captchaToken}}:null),xform:sF});if(r)throw r;if(!t||!t.session||!t.user){let e=new si;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign({},t),error:r})}catch(e){if(n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){var t,r,n,s,i,a,o,l,c,u,h,d;let p,f;if("message"in e)p=e.message,f=e.signature;else{let{chain:h,wallet:d,statement:g,options:m}=e;if("object"!=typeof d||!(null==m?void 0:m.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");let b=new URL(null!=(t=null==m?void 0:m.url)?t:window.location.href);if("signIn"in d&&d.signIn){let e,t=await d.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},null==m?void 0:m.signInWithSolana),{version:"1",domain:b.host,uri:b.href}),g?{statement:g}:null));if(Array.isArray(t)&&t[0]&&"object"==typeof t[0])e=t[0];else if(t&&"object"==typeof t&&"signedMessage"in t&&"signature"in t)e=t;else throw Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in e&&"signature"in e&&("string"==typeof e.signedMessage||e.signedMessage instanceof Uint8Array)&&e.signature instanceof Uint8Array)p="string"==typeof e.signedMessage?e.signedMessage:new TextDecoder().decode(e.signedMessage),f=e.signature;else throw Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in d)||"function"!=typeof d.signMessage||!("publicKey"in d)||"object"!=typeof d||!d.publicKey||!("toBase58"in d.publicKey)||"function"!=typeof d.publicKey.toBase58)throw Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${b.host} wants you to sign in with your Solana account:`,d.publicKey.toBase58(),...g?["",g,""]:[""],"Version: 1",`URI: ${b.href}`,`Issued At: ${null!=(n=null==(r=null==m?void 0:m.signInWithSolana)?void 0:r.issuedAt)?n:new Date().toISOString()}`,...(null==(s=null==m?void 0:m.signInWithSolana)?void 0:s.notBefore)?[`Not Before: ${m.signInWithSolana.notBefore}`]:[],...(null==(i=null==m?void 0:m.signInWithSolana)?void 0:i.expirationTime)?[`Expiration Time: ${m.signInWithSolana.expirationTime}`]:[],...(null==(a=null==m?void 0:m.signInWithSolana)?void 0:a.chainId)?[`Chain ID: ${m.signInWithSolana.chainId}`]:[],...(null==(o=null==m?void 0:m.signInWithSolana)?void 0:o.nonce)?[`Nonce: ${m.signInWithSolana.nonce}`]:[],...(null==(l=null==m?void 0:m.signInWithSolana)?void 0:l.requestId)?[`Request ID: ${m.signInWithSolana.requestId}`]:[],...(null==(u=null==(c=null==m?void 0:m.signInWithSolana)?void 0:c.resources)?void 0:u.length)?["Resources",...m.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join("\n");let e=await d.signMessage(new TextEncoder().encode(p),"utf8");if(!e||!(e instanceof Uint8Array))throw Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");f=e}}try{let{data:t,error:r}=await sq(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:sw(f)},(null==(h=e.options)?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null==(d=e.options)?void 0:d.captchaToken}}:null),xform:sF});if(r)throw r;if(!t||!t.session||!t.user){let e=new si;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign({},t),error:r})}catch(e){if(n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e){let t=await sS(this.storage,`${this.storageKey}-code-verifier`),[r,n]=(null!=t?t:"").split("/");try{if(!r&&"pkce"===this.flowType)throw new sl;let{data:t,error:s}=await sq(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:sF});if(await sR(this.storage,`${this.storageKey}-code-verifier`),s)throw s;if(!t||!t.session||!t.user){let e=new si;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("recovery"===n?"PASSWORD_RECOVERY":"SIGNED_IN",t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=n?n:null}),error:s})}catch(e){if(await sR(this.storage,`${this.storageKey}-code-verifier`),n7(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{let{options:t,provider:r,token:n,access_token:s,nonce:i}=e,{data:a,error:o}=await sq(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:n,access_token:s,nonce:i,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:sF});if(o)return this._returnResult({data:{user:null,session:null},error:o});if(!a||!a.session||!a.user){let e=new si;return this._returnResult({data:{user:null,session:null},error:e})}return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),this._returnResult({data:a,error:o})}catch(e){if(n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,r,n,s,i;try{if("email"in e){let{email:n,options:s}=e,i=null,a=null;"pkce"===this.flowType&&([i,a]=await sA(this.storage,this.storageKey));let{error:o}=await sq(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:n,data:null!=(t=null==s?void 0:s.data)?t:{},create_user:null==(r=null==s?void 0:s.shouldCreateUser)||r,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},code_challenge:i,code_challenge_method:a},redirectTo:null==s?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if("phone"in e){let{phone:t,options:r}=e,{data:a,error:o}=await sq(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!=(n=null==r?void 0:r.data)?n:{},create_user:null==(s=null==r?void 0:r.shouldCreateUser)||s,gotrue_meta_security:{captcha_token:null==r?void 0:r.captchaToken},channel:null!=(i=null==r?void 0:r.channel)?i:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o})}throw new sa("You must provide either an email or phone number.")}catch(e){if(await sR(this.storage,`${this.storageKey}-code-verifier`),n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,r;try{let n,s;"options"in e&&(n=null==(t=e.options)?void 0:t.redirectTo,s=null==(r=e.options)?void 0:r.captchaToken);let{data:i,error:a}=await sq(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:n,xform:sF});if(a)throw a;if(!i)throw Error("An error occurred on token verification.");let o=i.session,l=i.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if(n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,r,n,s;try{let i=null,a=null;"pkce"===this.flowType&&([i,a]=await sA(this.storage,this.storageKey));let o=await sq(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.redirectTo)?r:void 0}),(null==(n=null==e?void 0:e.options)?void 0:n.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:a}),headers:this.headers,xform:sV});return null==(s=o.data)||s.url,this._returnResult(o)}catch(e){if(await sR(this.storage,`${this.storageKey}-code-verifier`),n7(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,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 sn;let{error:n}=await sq(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:n})})}catch(e){if(n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{let t=`${this.url}/resend`;if("email"in e){let{email:r,type:n,options:s}=e,{error:i}=await sq(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},redirectTo:null==s?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:i})}if("phone"in e){let{phone:r,type:n,options:s}=e,{data:i,error:a}=await sq(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==i?void 0:i.message_id},error:a})}throw new sa("You must provide either an email or phone number and a type")}catch(e){if(n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,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 t=null,r=await sS(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),null!==r&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};let n=!!t.expires_at&&1e3*t.expires_at-Date.now()<9e4;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){let e=await sS(this.userStorage,this.storageKey+"-user");(null==e?void 0:e.user)?t.user=e.user:t.user=s$()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){var e;let r={value:this.suppressGetSessionWarning};t.user=(e=t.user,new Proxy(e,{get:(e,t,n)=>{if("__isInsecureUserWarningProxy"===t)return!0;if("symbol"==typeof t){let r=t.toString();if("Symbol(Symbol.toPrimitive)"===r||"Symbol(Symbol.toStringTag)"===r||"Symbol(util.inspect.custom)"===r||"Symbol(nodejs.util.inspect.custom)"===r)return Reflect.get(e,t,n)}return r.value||"string"!=typeof t||(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),r.value=!0),Reflect.get(e,t,n)}})),r.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}let{data:s,error:i}=await this._callRefreshToken(t.refresh_token);if(i)return this._returnResult({data:{session:null},error:i});return this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;let t=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{if(e)return await sq(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:sW});return await this._useSession(async e=>{var t,r,n;let{data:s,error:i}=e;if(i)throw i;return(null==(t=s.session)?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await sq(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!=(n=null==(r=s.session)?void 0:r.access_token)?n:void 0,xform:sW}):{data:{user:null},error:new sn}})}catch(e){if(n7(e))return ss(e)&&(await this._removeSession(),await sR(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async r=>{let{data:n,error:s}=r;if(s)throw s;if(!n.session)throw new sn;let i=n.session,a=null,o=null;"pkce"===this.flowType&&null!=e.email&&([a,o]=await sA(this.storage,this.storageKey));let{data:l,error:c}=await sq(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:i.access_token,xform:sW});if(c)throw c;return i.user=l.user,await this._saveSession(i),await this._notifyAllSubscribers("USER_UPDATED",i),this._returnResult({data:{user:i.user},error:null})})}catch(e){if(await sR(this.storage,`${this.storageKey}-code-verifier`),n7(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new sn;let t=Date.now()/1e3,r=t,n=!0,s=null,{payload:i}=sk(e.access_token);if(i.exp&&(n=(r=i.exp)<=t),n){let{data:t,error:r}=await this._callRefreshToken(e.refresh_token);if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!t)return{data:{user:null,session:null},error:null};s=t}else{let{data:n,error:i}=await this._getUser(e.access_token);if(i)return this._returnResult({data:{user:null,session:null},error:i});s={access_token:e.access_token,refresh_token:e.refresh_token,user:n.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(e){if(n7(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var r;if(!e){let{data:n,error:s}=t;if(s)throw s;e=null!=(r=n.session)?r:void 0}if(!(null==e?void 0:e.refresh_token))throw new sn;let{data:n,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):n?this._returnResult({data:{user:n.user,session:n},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if(n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){try{throw new so("No browser detected.")}catch(e){if(n7(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return"function"==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){let t=await sS(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var r;let{data:n,error:s}=t;if(s&&!ss(s))return this._returnResult({error:s});let i=null==(r=n.session)?void 0:r.access_token;if(i){let{error:t}=await this.admin.signOut(i,e);if(t&&!(n7(t)&&"AuthApiError"===t.name&&(404===t.status||401===t.status||403===t.status)||ss(t)))return this._returnResult({error:t})}return"others"!==e&&(await this._removeSession(),await sR(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){let t=Symbol("auth-callback"),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(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)})})(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async t=>{var r,n;try{let{data:{session:n},error:s}=t;if(s)throw s;await (null==(r=this.stateChangeEmitters.get(e))?void 0:r.callback("INITIAL_SESSION",n)),this._debug("INITIAL_SESSION","callback id",e,"session",n)}catch(t){await (null==(n=this.stateChangeEmitters.get(e))?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),ss(t)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let r=null,n=null;"pkce"===this.flowType&&([r,n]=await sA(this.storage,this.storageKey,!0));try{return await sq(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:n,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(await sR(this.storage,`${this.storageKey}-code-verifier`),n7(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){var e;try{let{data:t,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:null!=(e=t.user.identities)?e:[]},error:null})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){try{let{data:t,error:r}=await this._useSession(async t=>{var r,n,s,i,a;let{data:o,error:l}=t;if(l)throw l;let c=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null==(r=e.options)?void 0:r.redirectTo,scopes:null==(n=e.options)?void 0:n.scopes,queryParams:null==(s=e.options)?void 0:s.queryParams,skipBrowserRedirect:!0});return await sq(this.fetch,"GET",c,{headers:this.headers,jwt:null!=(a=null==(i=o.session)?void 0:i.access_token)?a:void 0})});if(r)throw r;return this._returnResult({data:{provider:e.provider,url:null==t?void 0:t.url},error:null})}catch(t){if(n7(t))return this._returnResult({data:{provider:e.provider,url:null},error:t});throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var r;try{let{error:n,data:{session:s}}=t;if(n)throw n;let{options:i,provider:a,token:o,access_token:l,nonce:c}=e,{data:u,error:h}=await sq(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!=(r=null==s?void 0:s.access_token)?r:void 0,body:{provider:a,id_token:o,access_token:l,nonce:c,link_identity:!0,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:sF});if(h)return this._returnResult({data:{user:null,session:null},error:h});if(!u||!u.session||!u.user)return this._returnResult({data:{user:null,session:null},error:new si});return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("USER_UPDATED",u.session)),this._returnResult({data:u,error:h})}catch(e){if(await sR(this.storage,`${this.storageKey}-code-verifier`),n7(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,n;let{data:s,error:i}=t;if(i)throw i;return await sq(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!=(n=null==(r=s.session)?void 0:r.access_token)?n:void 0})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){let t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{var r,n;let s=Date.now();return await (r=async r=>(r>0&&await sO(200*Math.pow(2,r-1)),this._debug(t,"refreshing attempt",r),await sq(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:sF})),n=(e,t)=>{let r=200*Math.pow(2,e);return t&&su(t)&&Date.now()+r-s<3e4},new Promise((e,t)=>{(async()=>{for(let s=0;s<1/0;s++)try{let t=await r(s);if(!n(s,null,t))return void e(t)}catch(e){if(!n(s,e))return void t(e)}})()}))}catch(e){if(this._debug(t,"error",e),n7(e))return this._returnResult({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(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,t;let r="#_recoverAndRefresh()";this._debug(r,"begin");try{let n=await sS(this.storage,this.storageKey);if(n&&this.userStorage){let t=await sS(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!t&&(t={user:n.user},await sE(this.userStorage,this.storageKey+"-user",t)),n.user=null!=(e=null==t?void 0:t.user)?e:s$()}else if(n&&!n.user&&!n.user){let e=await sS(this.storage,this.storageKey+"-user");e&&(null==e?void 0:e.user)?(n.user=e.user,await sR(this.storage,this.storageKey+"-user"),await sE(this.storage,this.storageKey,n)):n.user=s$()}if(this._debug(r,"session from storage",n),!this._isValidSession(n)){this._debug(r,"session is not valid"),null!==n&&await this._removeSession();return}let s=(null!=(t=n.expires_at)?t:1/0)*1e3-Date.now()<9e4;if(this._debug(r,`session has${s?"":" not"} expired with margin of 90000s`),s){if(this.autoRefreshToken&&n.refresh_token){let{error:e}=await this._callRefreshToken(n.refresh_token);e&&(console.error(e),su(e)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else if(n.user&&!0===n.user.__isUserNotAvailableProxy)try{let{data:e,error:t}=await this._getUser(n.access_token);!t&&(null==e?void 0:e.user)?(n.user=e.user,await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(e){console.error("Error getting user data:",e),this._debug(r,"error getting user data, skipping SIGNED_IN notification",e)}else await this._notifyAllSubscribers("SIGNED_IN",n)}catch(e){this._debug(r,"error",e),console.error(e);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var t,r;if(!e)throw new sn;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let n=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new sT;let{data:t,error:r}=await this._refreshAccessToken(e);if(r)throw r;if(!t.session)throw new sn;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);let n={data:t.session,error:null};return this.refreshingDeferred.resolve(n),n}catch(e){if(this._debug(n,"error",e),n7(e)){let r={data:null,error:e};return su(e)||await this._removeSession(),null==(t=this.refreshingDeferred)||t.resolve(r),r}throw null==(r=this.refreshingDeferred)||r.reject(e),e}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(e,t,r=!0){let n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",t,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});let n=[],s=Array.from(this.stateChangeEmitters.values()).map(async r=>{try{await r.callback(e,t)}catch(e){n.push(e)}});if(await Promise.all(s),n.length>0){for(let e=0;e<n.length;e+=1)console.error(n[e]);throw n[0]}}finally{this._debug(n,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await sR(this.storage,`${this.storageKey}-code-verifier`);let t=Object.assign({},e),r=t.user&&!0===t.user.__isUserNotAvailableProxy;if(this.userStorage){!r&&t.user&&await sE(this.userStorage,this.storageKey+"-user",{user:t.user});let e=Object.assign({},t);delete e.user;let n=sL(e);await sE(this.storage,this.storageKey,n)}else{let e=sL(t);await sE(this.storage,this.storageKey,e)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await sR(this.storage,this.storageKey),await sR(this.storage,this.storageKey+"-code-verifier"),await sR(this.storage,this.storageKey+"-user"),this.userStorage&&await sR(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()"),this.visibilityChangedCallback,this.visibilityChangedCallback=null}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():"u">typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(e);let t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&"object"==typeof t&&"function"==typeof t.unref?t.unref():"u">typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);let t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}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)return void this._debug("#_autoRefreshTokenTick()","no session");let n=Math.floor((1e3*r.expires_at-e)/3e4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),n<=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 instanceof sQ)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){return this._debug("#_handleVisibilityChange()"),this.autoRefreshToken&&this.startAutoRefresh(),!1}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(this.lockAcquireTimeout,async()=>{"visible"!==document.visibilityState?this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting"):await this._recoverAndRefresh()}))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,r){let n=[`provider=${encodeURIComponent(t)}`];if((null==r?void 0:r.redirectTo)&&n.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),(null==r?void 0:r.scopes)&&n.push(`scopes=${encodeURIComponent(r.scopes)}`),"pkce"===this.flowType){let[e,t]=await sA(this.storage,this.storageKey),r=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});n.push(r.toString())}if(null==r?void 0:r.queryParams){let e=new URLSearchParams(r.queryParams);n.push(e.toString())}return(null==r?void 0:r.skipBrowserRedirect)&&n.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${n.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var r;let{data:n,error:s}=t;return s?this._returnResult({data:null,error:s}):await sq(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var r,n;let{data:s,error:i}=t;if(i)return this._returnResult({data:null,error:i});let a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},"phone"===e.factorType?{phone:e.phone}:"totp"===e.factorType?{issuer:e.issuer}:{}),{data:o,error:l}=await sq(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:null==(r=null==s?void 0:s.session)?void 0:r.access_token});return l?this._returnResult({data:null,error:l}):("totp"===e.factorType&&"totp"===o.type&&(null==(n=null==o?void 0:o.totp)?void 0:n.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),this._returnResult({data:o,error:null}))})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var r;let{data:n,error:s}=t;if(s)return this._returnResult({data:null,error:s});let i=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:"create"===e.webauthn.type?s5(e.webauthn.credential_response):s6(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:o}=await sq(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:i,headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token});return o?this._returnResult({data:null,error:o}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:o}))})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var r;let{data:n,error:s}=t;if(s)return this._returnResult({data:null,error:s});let i=await sq(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token});if(i.error)return i;let{data:a}=i;if("webauthn"!==a.type)return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:s3(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:s4(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}})}async _challengeAndVerify(e){let{data:t,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;let{data:{user:t},error:r}=await this.getUser();if(r)return{data:null,error:r};let n={all:[],phone:[],totp:[],webauthn:[]};for(let r of null!=(e=null==t?void 0:t.factors)?e:[])n.all.push(r),"verified"===r.status&&n[r.factor_type].push(r);return{data:n,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,r,n,s;if(e)try{let{payload:n}=sk(e),s=null;n.aal&&(s=n.aal);let i=s,{data:{user:a},error:o}=await this.getUser(e);if(o)return this._returnResult({data:null,error:o});(null!=(r=null==(t=null==a?void 0:a.factors)?void 0:t.filter(e=>"verified"===e.status))?r:[]).length>0&&(i="aal2");let l=n.amr||[];return{data:{currentLevel:s,nextLevel:i,currentAuthenticationMethods:l},error:null}}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}let{data:{session:i},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:o}=sk(i.access_token),l=null;o.aal&&(l=o.aal);let c=l;return(null!=(s=null==(n=i.user.factors)?void 0:n.filter(e=>"verified"===e.status))?s:[]).length>0&&(c="aal2"),{data:{currentLevel:l,nextLevel:c,currentAuthenticationMethods:o.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;return n?this._returnResult({data:null,error:n}):r?await sq(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new sn})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new sn});let s=await sq(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"approve"},xform:e=>({data:e,error:null})});return s.data&&s.data.redirect_url,s})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new sn});let s=await sq(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"deny"},xform:e=>({data:e,error:null})});return s.data&&s.data.redirect_url,s})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;return r?this._returnResult({data:null,error:r}):t?await sq(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new sn})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;return n?this._returnResult({data:null,error:n}):r?(await sq(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new sn})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let r=t.keys.find(t=>t.kid===e);if(r)return r;let n=Date.now();if((r=this.jwks.keys.find(t=>t.kid===e))&&this.jwks_cached_at+6e5>n)return r;let{data:s,error:i}=await sq(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(i)throw i;return s.keys&&0!==s.keys.length&&(this.jwks=s,this.jwks_cached_at=n,r=s.keys.find(t=>t.kid===e))?r:null}async getClaims(e,t={}){try{var r;let n,s=e;if(!s){let{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});s=e.session.access_token}let{header:i,payload:a,signature:o,raw:{header:l,payload:c}}=sk(s);(null==t?void 0:t.allowExpired)||function(e){if(!e)throw Error("Missing exp claim");if(e<=Math.floor(Date.now()/1e3))throw Error("JWT has expired")}(a.exp);let u=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks);if(!u){let{error:e}=await this.getUser(s);if(e)throw e;return{data:{claims:a,header:i,signature:o},error:null}}let h=function(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw Error("Invalid alg claim")}}(i.alg),d=await crypto.subtle.importKey("jwk",u,h,!0,["verify"]);if(!await crypto.subtle.verify(h,d,o,(r=`${l}.${c}`,n=[],!function(e,t){for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>55295&&n<=56319){let t=(n-55296)*1024&65535;n=(e.charCodeAt(r+1)-56320&65535|t)+65536,r+=1}!function(e,t){if(e<=127)return t(e);if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}(n,t)}}(r,e=>n.push(e)),new Uint8Array(n))))throw new sd("Invalid JWT signature");return{data:{claims:a,header:i,signature:o},error:null}}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){var t,r,n;sD(this.experimental);try{1;return this._returnResult({data:null,error:new st("Browser does not support WebAuthn",null)})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){var t,r;sD(this.experimental);try{1;return this._returnResult({data:null,error:new st("Browser does not support WebAuthn",null)})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){sD(this.experimental);try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!t)return this._returnResult({data:null,error:new sn});let{data:n,error:s}=await sq(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){sD(this.experimental);try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new sn});let{data:s,error:i}=await sq(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:r.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){var t;sD(this.experimental);try{let{data:r,error:n}=await sq(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:null==(t=null==e?void 0:e.options)?void 0:t.captchaToken}}});if(n)return this._returnResult({data:null,error:n});return this._returnResult({data:r,error:null})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){sD(this.experimental);try{let{data:t,error:r}=await sq(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:sF});if(r)return this._returnResult({data:null,error:r});return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:t,error:null})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){sD(this.experimental);try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!t)return this._returnResult({data:null,error:new sn});let{data:n,error:s}=await sq(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){sD(this.experimental);try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new sn});let{data:s,error:i}=await sq(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,body:{friendly_name:e.friendlyName}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){sD(this.experimental);try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new sn});let{error:s}=await sq(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,noResolveJson:!0});return s?this._returnResult({data:null,error:s}):this._returnResult({data:null,error:null})})}catch(e){if(n7(e))return this._returnResult({data:null,error:e});throw e}}}il.nextInstanceID={};let ic=il,iu="";iu="u">typeof Deno?"deno":"u">typeof document?"web":"u">typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";let ih={headers:{"X-Client-Info":`supabase-js-${iu}/2.106.0`}},id={schema:"public"},ip={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},ig={},im={enabled:!1,respectSamplingDecision:!0},ib=null;function iy(e){return(iy="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function iv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function iw(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?iv(Object(r),!0).forEach(function(t){!function(e,t,r){var n;(n=function(e,t){if("object"!=iy(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=iy(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==iy(n)?n:n+"")in e)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iv(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}async function i_(e,t,r){if(!function(e,t){let r;if(!e||!t||0===t.length)return!1;if(e instanceof URL)r=e;else try{r=new URL(e)}catch(e){return!1}for(let e of t)try{if("string"==typeof e){if(function(e,t){if(t===e)return!0;if(t.startsWith("*.")){let r=t.slice(2);if(e.endsWith(r)&&(e===r||e.endsWith("."+r)))return!0}return!1}(r.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(r.hostname))return!0}else if("function"==typeof e&&e(r))return!0}catch(e){continue}return!1}("string"==typeof e||e instanceof URL?e:e.url,t))return null;let n=await function(){var e,t,r,n;return e=this,t=void 0,r=void 0,n=function*(){try{let e=yield(null===ib&&(ib=import("@opentelemetry/api").catch(()=>null)),ib);if(!e||!e.propagation||!e.context)return null;let t={};e.propagation.inject(e.context.active(),t);let r=t.traceparent;if(!r)return null;return{traceparent:r,tracestate:t.tracestate,baggage:t.baggage}}catch(e){return null}},new(r||(r=Promise))(function(s,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?s(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((n=n.apply(e,t||[])).next())})}();if(!n||!n.traceparent)return null;if(r){let e=function(e){if(!e||"string"!=typeof e)return null;let t=e.split("-");if(4!==t.length)return null;let[r,n,s,i]=t;if(2!==r.length||32!==n.length||16!==s.length||2!==i.length)return null;let a=/^[0-9a-f]+$/i;return a.test(r)&&a.test(n)&&a.test(s)&&a.test(i)&&"00000000000000000000000000000000"!==n&&"0000000000000000"!==s?{version:r,traceId:n,parentId:s,traceFlags:i,isSampled:(1&parseInt(i,16))==1}:null}(n.traceparent);if(e&&!e.isSampled)return null}return n}function iE(e){return"boolean"==typeof e?{enabled:e}:e}var iS=class extends ic{constructor(e){super(e)}},iR=class{constructor(e,t,r){var n,s,i;this.supabaseUrl=e,this.supabaseKey=t;const a=function(e){let t=null==e?void 0:e.trim();if(!t)throw Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(t.endsWith("/")?t:t+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}(e);if(!t)throw Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const o=`sb-${a.hostname.split(".")[0]}-auth-token`,l=function(e,t){var r,n,s,i,a,o;let{db:l,auth:c,realtime:u,global:h}=e,{db:d,auth:p,realtime:f,global:g}=t,m=iE(e.tracePropagation),b=iE(t.tracePropagation),y={db:iw(iw({},d),l),auth:iw(iw({},p),c),realtime:iw(iw({},f),u),storage:{},global:iw(iw(iw({},g),h),{},{headers:iw(iw({},null!=(r=null==g?void 0:g.headers)?r:{}),null!=(n=null==h?void 0:h.headers)?n:{})}),tracePropagation:{enabled:null!=(s=null!=(i=null==m?void 0:m.enabled)?i:null==b?void 0:b.enabled)&&s,respectSamplingDecision:null==(a=null!=(o=null==m?void 0:m.respectSamplingDecision)?o:null==b?void 0:b.respectSamplingDecision)||a},accessToken:async()=>""};return e.accessToken?y.accessToken=e.accessToken:delete y.accessToken,y}(null!=r?r:{},{db:id,realtime:ig,auth:iw(iw({},ip),{},{storageKey:o}),global:ih,tracePropagation:im});this.settings=l,this.storageKey=null!=(n=l.auth.storageKey)?n:"",this.headers=null!=(s=l.global.headers)?s:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!=(i=l.auth)?i:{},this.headers,l.global.fetch),this.fetch=((e,t,r,n,s)=>{let i=n?(...e)=>n(...e):(...e)=>fetch(...e),a=Headers,o=(null==s?void 0:s.enabled)===!0,l=(null==s?void 0:s.respectSamplingDecision)!==!1,c=o?function(e){let t=[];try{let r=new URL(e);t.push(r.hostname)}catch(e){}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}(t):null;return async(t,n)=>{var s;let o=null!=(s=await r())?s:e,u=new a(null==n?void 0:n.headers);if(u.has("apikey")||u.set("apikey",e),u.has("Authorization")||u.set("Authorization",`Bearer ${o}`),c){let e=await i_(t,c,l);e&&(e.traceparent&&!u.has("traceparent")&&u.set("traceparent",e.traceparent),e.tracestate&&!u.has("tracestate")&&u.set("tracestate",e.tracestate),e.baggage&&!u.has("baggage")&&u.set("baggage",e.baggage))}return i(t,iw(iw({},n),{},{headers:u}))}})(t,e,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(iw({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new rA(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new n2(this.storageUrl.href,this.headers,this.fetch,null==r?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new rb(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={head:!1,get:!1,count:void 0}){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()}async _getAccessToken(){var e,t;if(this.accessToken)return await this.accessToken();let{data:r}=await this.auth.getSession();return null!=(e=null==(t=r.session)?void 0:t.access_token)?e:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:i,flowType:a,lock:o,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:h,skipAutoInitialize:d},p,f){let g={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new iS({url:this.authUrl.href,headers:iw(iw({},g),p),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,flowType:a,lock:o,debug:l,throwOnError:c,experimental:u,fetch:f,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new nf(this.realtimeUrl.href,iw(iw({},e),{},{params:iw(iw({},{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.changedAccessToken=r,this.realtime.setAuth(r)):"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0)}};(function(){let e=globalThis.process;if(!e)return!1;let t=e.version;if(null==t)return!1;let r=t.match(/^v(\d+)\./);return!!r&&18>=parseInt(r[1],10)})()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");var iT=e.i(64742);let ik={path:"/",sameSite:"lax",httpOnly:!1,maxAge:3456e4},iO=/^(.*)[.](0|[1-9][0-9]*)$/;function iP(e,t){if(e===t)return!0;let r=e.match(iO);return!!r&&r[1]===t}function ix(e,t,r){let n=r??3180,s=encodeURIComponent(t);if(s.length<=n)return[{name:e,value:t}];let i=[];for(;s.length>0;){let e=s.slice(0,n),t=e.lastIndexOf("%");t>n-3&&(e=e.slice(0,t));let r="";for(;e.length>0;)try{r=decodeURIComponent(e);break}catch(t){if(t instanceof URIError&&"%"===e.at(-3)&&e.length>3)e=e.slice(0,e.length-3);else throw t}i.push(r),s=s.slice(e.length)}return i.map((t,r)=>({name:`${e}.${r}`,value:t}))}async function iC(e,t){let r=await t(e);if(r)return r;let n=[];for(let r=0;;r++){let s=`${e}.${r}`,i=await t(s);if(!i)break;n.push(i)}return n.length>0?n.join(""):null}iT.parse,iT.serialize;let iA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),iN=" \n\r=".split(""),iI=(()=>{let e=Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<iN.length;t+=1)e[iN[t].charCodeAt(0)]=-2;for(let t=0;t<iA.length;t+=1)e[iA[t].charCodeAt(0)]=t;return e})();function ij(e){let t=[],r=0,n=0;if(function(e,t){for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>55295&&n<=56319){let t=(n-55296)*1024&65535;n=(e.charCodeAt(r+1)-56320&65535|t)+65536,r+=1}!function(e,t){if(e<=127)return t(e);if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}(n,t)}}(e,e=>{for(r=r<<8|e,n+=8;n>=6;){let e=r>>n-6&63;t.push(iA[e]),n-=6}}),n>0)for(r<<=6-n,n=6;n>=6;){let e=r>>n-6&63;t.push(iA[e]),n-=6}return t.join("")}let iD="base64-";function i$(e){let t;if(!e.startsWith(iD))return e;try{t=function(e){let t=[],r=e=>{t.push(String.fromCodePoint(e))},n={utf8seq:0,codepoint:0},s=0,i=0;for(let t=0;t<e.length;t+=1){let a=iI[e.charCodeAt(t)];if(a>-1)for(s=s<<6|a,i+=6;i>=8;)(function(e,t,r){if(0===t.utf8seq){if(e<=127)return r(e);for(let r=1;r<6;r+=1)if((e>>7-r&1)==0){t.utf8seq=r;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else if(4===t.utf8seq)t.codepoint=7&e;else throw Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&r(t.codepoint)}})(s>>i-8&255,n,r),i-=8;else if(-2===a)continue;else throw Error(`Invalid Base64-URL character "${e.at(t)}" at position ${t}`)}return t.join("")}(e.substring(iD.length))}catch(e){return console.warn("@supabase/ssr: could not base64url-decode chunked cookie value, treating as absent. Cookie chunks may have been written partially across responses.",e),null}try{JSON.parse(t)}catch{return console.warn("@supabase/ssr: chunked cookie decoded to invalid JSON, treating as absent. This usually indicates that cookie chunks from different writes were combined (e.g. response committed before all Set-Cookie headers were sent)."),null}return t}async function iL({getAll:e,setAll:t,setItems:r,removedItems:n},s){let i=s.cookieEncoding,a=s.cookieOptions??null,o=await e([...r?Object.keys(r):[],...n?Object.keys(n):[]]),l=o?.map(({name:e})=>e)||[],c=Object.keys(n).flatMap(e=>l.filter(t=>iP(t,e))),u=Object.keys(r).flatMap(e=>{let t=new Set(l.filter(t=>iP(t,e))),n=r[e];"base64url"===i&&(n=iD+ij(n));let s=ix(e,n);return s.forEach(e=>{t.delete(e.name)}),c.push(...t),s}),h={...ik,...a,maxAge:0},d={...ik,...a,maxAge:ik.maxAge};delete h.name,delete d.name,await t([...c.map(e=>({name:e,value:"",options:h})),...u.map(({name:e,value:t})=>({name:e,value:t,options:d}))],{"Cache-Control":"private, no-cache, no-store, must-revalidate, max-age=0",Expires:"0",Pragma:"no-cache"})}let iM=!1,iU=["@supabase/auth-helpers-nextjs","@supabase/auth-helpers-react","@supabase/auth-helpers-remix","@supabase/auth-helpers-sveltekit"];function iB(){return("https://ctruizaqyeyidujmtxhc.supabase.co".trim()??"").length>0&&("sb_publishable_gTYHeWoWIPPW3SIC4cYaXw_ux7UL_Jb".trim()??"").length>0}async function iq(e){if(!iB())return rh.NextResponse.next();let{supabase:t,response:r}=function(e){let t=rh.NextResponse.next(),{anon_key:r,url:n}=function(){if(!iB())throw Error("Supabase is not configured");return{url:"https://ctruizaqyeyidujmtxhc.supabase.co".trim(),anon_key:"sb_publishable_gTYHeWoWIPPW3SIC4cYaXw_ux7UL_Jb".trim()}}();return{supabase:function(e,t,r){if(!function(){if(iM||"u"<typeof process||!process.env?.npm_package_name)return;let e=process.env.npm_package_name;iU.includes(e)&&(iM=!0,console.warn(`
|
|
55
55
|
╔════════════════════════════════════════════════════════════════════════════╗
|
|
56
56
|
║ ⚠️ IMPORTANT: Package Consolidation Notice ║
|
|
57
57
|
║ ║
|
|
@@ -73,6 +73,6 @@ ${b}`}({domain:b.host,address:v,statement:g,uri:b.href,version:"1",chainId:w,non
|
|
|
73
73
|
|
|
74
74
|
Check your Supabase project's API settings to find these values
|
|
75
75
|
|
|
76
|
-
https://supabase.com/dashboard/project/_/settings/api`);let{storage:n,getAll:s,setAll:i,setItems:a,removedItems:o}=function(e,t){let r,n,s=e.cookies??null,i=e.cookieEncoding,a={},o={},l=()=>{let e=(0,iT.parse)(document.cookie);return Object.keys(e).map(t=>({name:t,value:e[t]??""}))},c=e=>{e.forEach(({name:e,value:t,options:r})=>{document.cookie=(0,iT.serialize)(e,t,r)})};if(s)if("get"in s){let e=async e=>{let t=e.flatMap(e=>[e,...Array.from({length:5}).map((t,r)=>`${e}.${r}`)]),r=[];for(let e=0;e<t.length;e+=1){let n=await s.get(t[e]);(n||"string"==typeof n)&&r.push({name:t[e],value:n})}return r};if(r=async t=>await e(t),"set"in s&&"remove"in s)n=async e=>{for(let t=0;t<e.length;t+=1){let{name:r,value:n,options:i}=e[t];n?await s.set(r,n,i):await s.remove(r,i)}};else if(t)n=async()=>{console.warn("@supabase/ssr: createServerClient was configured without set and remove cookie methods, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness. Consider switching to the getAll and setAll cookie methods instead of get, set and remove which are deprecated and can be difficult to use correctly.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring a getAll and setAll cookie method (deprecated: alternatively both get, set and remove can be used)")}else if("getAll"in s)if(r=async()=>await s.getAll(),"setAll"in s)n=s.setAll;else if(t)n=async()=>{console.warn("@supabase/ssr: createServerClient was configured without the setAll cookie method, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring both getAll and setAll cookie methods (deprecated: alternatively both get, set and remove can be used)");else if(t||1)throw Error(`@supabase/ssr: ${t?"createServerClient":"createBrowserClient"} requires configuring getAll and setAll cookie methods (deprecated: alternatively use get, set and remove).`);else r=()=>l(),n=c;else if(t||1)if(t)throw Error("@supabase/ssr: createServerClient must be initialized with cookie options that specify getAll and setAll functions (deprecated, not recommended: alternatively use get, set and remove)");else r=()=>[],n=()=>{throw Error("@supabase/ssr: createBrowserClient in non-browser runtimes (including Next.js pre-rendering mode) was not initialized cookie options that specify getAll and setAll functions (deprecated: alternatively use get, set and remove), but they were needed")};else r=()=>l(),n=c;return t?{getAll:r,setAll:n,setItems:a,removedItems:o,storage:{isServer:!0,getItem:async e=>{if("string"==typeof a[e])return a[e];if(o[e])return null;let t=await r([e]),n=await iC(e,async e=>{let r=t?.find(({name:t})=>t===e)||null;return r?r.value:null});return n?"string"!=typeof n?n:i$(n):null},setItem:async(t,s)=>{t.endsWith("-code-verifier")&&await iL({getAll:r,setAll:n,setItems:{[t]:s},removedItems:{}},{cookieOptions:e?.cookieOptions??null,cookieEncoding:i}),a[t]=s,delete o[t]},removeItem:async e=>{delete a[e],o[e]=!0}}}:{getAll:r,setAll:n,setItems:a,removedItems:o,storage:{isServer:!1,getItem:async e=>{let t=await r([e]),n=await iC(e,async e=>{let r=t?.find(({name:t})=>t===e)||null;return r?r.value:null});return n?i$(n):null},setItem:async(t,s)=>{let a=await r([t]),o=new Set((a?.map(({name:e})=>e)||[]).filter(e=>iP(e,t))),l=s;"base64url"===i&&(l=iD+ij(s));let c=ix(t,l);c.forEach(({name:e})=>{o.delete(e)});let u={...ik,...e?.cookieOptions,maxAge:0},h={...ik,...e?.cookieOptions,maxAge:ik.maxAge};delete u.name,delete h.name;let d=[...[...o].map(e=>({name:e,value:"",options:u})),...c.map(({name:e,value:t})=>({name:e,value:t,options:h}))];d.length>0&&await n(d,{})},removeItem:async t=>{let s=await r([t]),i=(s?.map(({name:e})=>e)||[]).filter(e=>iP(e,t)),a={...ik,...e?.cookieOptions,maxAge:0};delete a.name,i.length>0&&await n(i.map(e=>({name:e,value:"",options:a})),{})}}}}({...r,cookieEncoding:r?.cookieEncoding??"base64url"},!0),l=new iR(e,t,{...r,global:{...r?.global,headers:{...r?.global?.headers,"X-Client-Info":"supabase-ssr/0.10.3 createServerClient"}},auth:{...r?.cookieOptions?.name?{storageKey:r.cookieOptions.name}:null,...r?.auth,flowType:"pkce",autoRefreshToken:!1,detectSessionInUrl:!1,persistSession:!0,skipAutoInitialize:!0,storage:n,...r?.cookies&&"encode"in r.cookies&&"tokens-only"===r.cookies.encode?{userStorage:r?.auth?.userStorage??function(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}()}:null}});return l.auth.onAuthStateChange(async e=>{(Object.keys(a).length>0||Object.keys(o).length>0)&&("SIGNED_IN"===e||"TOKEN_REFRESHED"===e||"USER_UPDATED"===e||"PASSWORD_RECOVERY"===e||"SIGNED_OUT"===e||"MFA_CHALLENGE_VERIFIED"===e)&&await iL({getAll:s,setAll:i,setItems:a,removedItems:o},{cookieOptions:r?.cookieOptions??null,cookieEncoding:r?.cookieEncoding??"base64url"})}),l}(n,r,{cookies:{getAll:()=>e.cookies.getAll(),setAll(r){r.forEach(({name:t,value:r})=>{e.cookies.set(t,r)}),t=rh.NextResponse.next(
|
|
76
|
+
https://supabase.com/dashboard/project/_/settings/api`);let{storage:n,getAll:s,setAll:i,setItems:a,removedItems:o}=function(e,t){let r,n,s=e.cookies??null,i=e.cookieEncoding,a={},o={},l=()=>{let e=(0,iT.parse)(document.cookie);return Object.keys(e).map(t=>({name:t,value:e[t]??""}))},c=e=>{e.forEach(({name:e,value:t,options:r})=>{document.cookie=(0,iT.serialize)(e,t,r)})};if(s)if("get"in s){let e=async e=>{let t=e.flatMap(e=>[e,...Array.from({length:5}).map((t,r)=>`${e}.${r}`)]),r=[];for(let e=0;e<t.length;e+=1){let n=await s.get(t[e]);(n||"string"==typeof n)&&r.push({name:t[e],value:n})}return r};if(r=async t=>await e(t),"set"in s&&"remove"in s)n=async e=>{for(let t=0;t<e.length;t+=1){let{name:r,value:n,options:i}=e[t];n?await s.set(r,n,i):await s.remove(r,i)}};else if(t)n=async()=>{console.warn("@supabase/ssr: createServerClient was configured without set and remove cookie methods, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness. Consider switching to the getAll and setAll cookie methods instead of get, set and remove which are deprecated and can be difficult to use correctly.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring a getAll and setAll cookie method (deprecated: alternatively both get, set and remove can be used)")}else if("getAll"in s)if(r=async()=>await s.getAll(),"setAll"in s)n=s.setAll;else if(t)n=async()=>{console.warn("@supabase/ssr: createServerClient was configured without the setAll cookie method, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring both getAll and setAll cookie methods (deprecated: alternatively both get, set and remove can be used)");else if(t||1)throw Error(`@supabase/ssr: ${t?"createServerClient":"createBrowserClient"} requires configuring getAll and setAll cookie methods (deprecated: alternatively use get, set and remove).`);else r=()=>l(),n=c;else if(t||1)if(t)throw Error("@supabase/ssr: createServerClient must be initialized with cookie options that specify getAll and setAll functions (deprecated, not recommended: alternatively use get, set and remove)");else r=()=>[],n=()=>{throw Error("@supabase/ssr: createBrowserClient in non-browser runtimes (including Next.js pre-rendering mode) was not initialized cookie options that specify getAll and setAll functions (deprecated: alternatively use get, set and remove), but they were needed")};else r=()=>l(),n=c;return t?{getAll:r,setAll:n,setItems:a,removedItems:o,storage:{isServer:!0,getItem:async e=>{if("string"==typeof a[e])return a[e];if(o[e])return null;let t=await r([e]),n=await iC(e,async e=>{let r=t?.find(({name:t})=>t===e)||null;return r?r.value:null});return n?"string"!=typeof n?n:i$(n):null},setItem:async(t,s)=>{t.endsWith("-code-verifier")&&await iL({getAll:r,setAll:n,setItems:{[t]:s},removedItems:{}},{cookieOptions:e?.cookieOptions??null,cookieEncoding:i}),a[t]=s,delete o[t]},removeItem:async e=>{delete a[e],o[e]=!0}}}:{getAll:r,setAll:n,setItems:a,removedItems:o,storage:{isServer:!1,getItem:async e=>{let t=await r([e]),n=await iC(e,async e=>{let r=t?.find(({name:t})=>t===e)||null;return r?r.value:null});return n?i$(n):null},setItem:async(t,s)=>{let a=await r([t]),o=new Set((a?.map(({name:e})=>e)||[]).filter(e=>iP(e,t))),l=s;"base64url"===i&&(l=iD+ij(s));let c=ix(t,l);c.forEach(({name:e})=>{o.delete(e)});let u={...ik,...e?.cookieOptions,maxAge:0},h={...ik,...e?.cookieOptions,maxAge:ik.maxAge};delete u.name,delete h.name;let d=[...[...o].map(e=>({name:e,value:"",options:u})),...c.map(({name:e,value:t})=>({name:e,value:t,options:h}))];d.length>0&&await n(d,{})},removeItem:async t=>{let s=await r([t]),i=(s?.map(({name:e})=>e)||[]).filter(e=>iP(e,t)),a={...ik,...e?.cookieOptions,maxAge:0};delete a.name,i.length>0&&await n(i.map(e=>({name:e,value:"",options:a})),{})}}}}({...r,cookieEncoding:r?.cookieEncoding??"base64url"},!0),l=new iR(e,t,{...r,global:{...r?.global,headers:{...r?.global?.headers,"X-Client-Info":"supabase-ssr/0.10.3 createServerClient"}},auth:{...r?.cookieOptions?.name?{storageKey:r.cookieOptions.name}:null,...r?.auth,flowType:"pkce",autoRefreshToken:!1,detectSessionInUrl:!1,persistSession:!0,skipAutoInitialize:!0,storage:n,...r?.cookies&&"encode"in r.cookies&&"tokens-only"===r.cookies.encode?{userStorage:r?.auth?.userStorage??function(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}()}:null}});return l.auth.onAuthStateChange(async e=>{(Object.keys(a).length>0||Object.keys(o).length>0)&&("SIGNED_IN"===e||"TOKEN_REFRESHED"===e||"USER_UPDATED"===e||"PASSWORD_RECOVERY"===e||"SIGNED_OUT"===e||"MFA_CHALLENGE_VERIFIED"===e)&&await iL({getAll:s,setAll:i,setItems:a,removedItems:o},{cookieOptions:r?.cookieOptions??null,cookieEncoding:r?.cookieEncoding??"base64url"})}),l}(n,r,{cookies:{getAll:()=>e.cookies.getAll(),setAll(r){r.forEach(({name:t,value:r})=>{e.cookies.set(t,r)}),t=rh.NextResponse.next(),r.forEach(({name:e,value:r,options:n})=>{t.cookies.set(e,r,n)})}}}),response:t}}(e);return await t.auth.getSession(),r}e.s(["config",0,{matcher:["/((?!_next/static|_next/image|favicon.ico|api/focus-nudges|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)"]},"proxy",0,iq],94824);let iH={...e.i(94824)},iF="/proxy",iG=iH.proxy||iH.default;if("function"!=typeof iG)throw new class extends Error{constructor(e){super(e),this.stack=""}}(`The Proxy file "${iF}" must export a function named \`proxy\` or a default function.`);let iW=e=>tN({...e,IncrementalCache:ru,incrementalCacheHandler:null,page:iF,handler:async(...e)=>{try{return await iG(...e)}catch(s){let t=e[0],r=new URL(t.url),n=r.pathname+r.search;throw await l(s,{path:n,method:t.method,headers:Object.fromEntries(t.headers.entries())},{routerKind:"Pages Router",routePath:"/proxy",routeType:"proxy",revalidateReason:void 0}),s}}});async function iV(e,t){let r=await iW({request:{url:e.url,method:e.method,headers:R(e.headers),nextConfig:{basePath:"",i18n:"",trailingSlash:!1,experimental:{cacheLife:{default:{stale:300,revalidate:900,expire:0xfffffffe},seconds:{stale:30,revalidate:1,expire:60},minutes:{stale:300,revalidate:60,expire:3600},hours:{stale:300,revalidate:3600,expire:86400},days:{stale:300,revalidate:86400,expire:604800},weeks:{stale:300,revalidate:604800,expire:2592e3},max:{stale:300,revalidate:2592e3,expire:31536e3}},authInterrupts:!1,clientParamParsingOrigins:[]}},page:{name:iF},body:"GET"!==e.method&&"HEAD"!==e.method?e.body??void 0:void 0,waitUntil:t.waitUntil,requestMeta:t.requestMeta,signal:t.signal||new AbortController().signal}});return null==t.waitUntil||t.waitUntil.call(t,r.waitUntil),r.response}e.s(["default",0,iW,"handler",0,iV],33344)}];
|
|
77
77
|
|
|
78
78
|
//# sourceMappingURL=%5Broot-of-the-server%5D__0mft_cy._.js.map
|