@kky42/pievo-server 2.3.0 → 2.4.2
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/.output/nitro.json +1 -1
- package/.output/public/assets/MachinesModal-CSbnrUER.js +1 -0
- package/.output/public/assets/SignIn-0Tjqs-Ma.js +1 -0
- package/.output/public/assets/actionUi-DpwGIGpw.js +1 -0
- package/.output/public/assets/app-CaZpuwOS.css +2 -0
- package/.output/public/assets/index-CaS_SmDq.js +10 -0
- package/.output/public/assets/invite._token-Btg_0aLp.js +1 -0
- package/.output/public/assets/invite._token-KMD2JAgE.js +1 -0
- package/.output/public/assets/lifecycleUi-C7dwHtbw.js +1 -0
- package/.output/public/assets/loops._loopId-D5usF3DO.js +67 -0
- package/.output/public/assets/loops._loopId_.runs._runId-DRCgXaCq.js +3 -0
- package/.output/public/assets/preload-helper-DsxECZIS.js +5 -0
- package/.output/public/assets/routes-CtFgwdgW.js +1 -0
- package/.output/public/assets/routes-LDbnnQ3f.js +1 -0
- package/.output/public/assets/t._teamId-D41xcbsF.js +1 -0
- package/.output/public/assets/t._teamId-DUena1pV.js +1 -0
- package/.output/public/assets/ui-Do4gqMyP.js +1 -0
- package/.output/server/_libs/@base-ui/react+[...].mjs +4130 -4130
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
- package/.output/server/_libs/drizzle-orm+postgres.mjs +28 -1
- package/.output/server/_ssr/DashboardView-C2LdV6J0.mjs +914 -0
- package/.output/server/_ssr/{notifyFns-DuPR1zd7.mjs → MachinesModal-BjkcVjjx.mjs} +55 -35
- package/.output/server/_ssr/{SignIn-RmpWm9uy.mjs → SignIn-DEGrvJvb.mjs} +10 -24
- package/.output/server/_ssr/SocialLinks-Cm4H8pUJ.mjs +1044 -0
- package/.output/server/_ssr/{actionUi-BN55TNYE.mjs → actionUi-DJBWuNwr.mjs} +3 -3
- package/.output/server/_ssr/{artifactFiles-BCaIIrrT.mjs → artifactFiles-DtpRidFZ.mjs} +7 -8
- package/.output/server/_ssr/{artifactKind-BW0isV8L.mjs → artifactKind-FBYbgSuf.mjs} +27 -2
- package/.output/server/_ssr/artifacts-BR3jj0NC.mjs +2 -0
- package/.output/server/_ssr/{auth-30Z4lV1w.mjs → auth-C0zoZCGe.mjs} +16 -19
- package/.output/server/_ssr/boot-CdOO4xOo.mjs +2 -0
- package/.output/server/_ssr/{boot-3BNKujyp.mjs → boot-sNlIkoLe.mjs} +1331 -3927
- package/.output/server/_ssr/{bun-sqlite-dialect-BW9W1_Ps-_7tfuNRi.mjs → bun-sqlite-dialect-BW9W1_Ps-DmlZWqO7.mjs} +2 -2
- package/.output/server/_ssr/{d1-sqlite-dialect-BLC8LXE6-ucDUbeBk.mjs → d1-sqlite-dialect-BLC8LXE6-CCNzqZwZ.mjs} +2 -2
- package/.output/server/_ssr/db-CwLD-5w1.mjs +2 -0
- package/.output/server/_ssr/{dist-Cd6nlLlO.mjs → dist-B3SxDOpW.mjs} +2 -2
- package/.output/server/_ssr/{factory-CWWwV7XZ.mjs → factory-Dv3Zopis.mjs} +2 -2
- package/.output/server/_ssr/invite._token-CJ6-H-s3.mjs +20 -0
- package/.output/server/_ssr/{invite._token-SdWXemIc.mjs → invite._token-dLKDJKVs.mjs} +9 -17
- package/.output/server/_ssr/{invite._token-BKlz0R2f.mjs → invite._token-l1SjouDz.mjs} +6 -15
- package/.output/server/_ssr/{kysely-adapter-C8iS51DB.mjs → kysely-adapter-nL7WKSgw.mjs} +1 -1
- package/.output/server/_ssr/{lifecycleUi-DgBQAYzp.mjs → lifecycleUi-Dad3hvhm.mjs} +11 -11
- package/.output/server/_ssr/logger-B8m8F1Qu.mjs +2 -0
- package/.output/server/_ssr/loopApi-BKyFB4KM.mjs +342 -0
- package/.output/server/_ssr/{adapters-BoLkOf1T.mjs → loopProjection-B8a829ij.mjs} +25 -55
- package/.output/server/_ssr/loops._loopId-DS16Phmq.mjs +1271 -0
- package/.output/server/_ssr/{loops._loopId_.runs._runId-PUGBrD5q.mjs → loops._loopId_.runs._runId-BEJI6iK5.mjs} +23 -74
- package/.output/server/_ssr/{loops._loopId_.runs._runId-Ymy4lwee.mjs → loops._loopId_.runs._runId-CduETLqH.mjs} +4 -5
- package/.output/server/_ssr/{machineFns-BZ9puxDt.mjs → machineFns-ByMsgG12.mjs} +3 -5
- package/.output/server/_ssr/{node-sqlite-dialect-D_3JmkMo.mjs → node-sqlite-dialect-CjNineno.mjs} +2 -2
- package/.output/server/_ssr/router-CXyrnvx-.mjs +565 -0
- package/.output/server/_ssr/{routes-ClZEdsnB.mjs → routes-BulNEUEE.mjs} +6 -10
- package/.output/server/_ssr/{routes-ComqHvCL.mjs → routes-DD94baie.mjs} +3 -3
- package/.output/server/_ssr/{routes-D5jJJ-30.mjs → routes-Wjexi35W.mjs} +6 -6
- package/.output/server/_ssr/runDiff-Ba8Lg1vg.mjs +2 -0
- package/.output/server/_ssr/ssr.mjs +60 -100
- package/.output/server/_ssr/store-Cujtg2QE.mjs +2 -0
- package/.output/server/_ssr/{t._teamId-BgHV_KFP.mjs → t._teamId-1CreIlPV.mjs} +7 -11
- package/.output/server/_ssr/{t._teamId-DDERNgfn.mjs → t._teamId-Bd6-zZsy.mjs} +4 -4
- package/.output/server/_ssr/{t._teamId-DRJvKHZn.mjs → t._teamId-COuMKQ4r.mjs} +7 -7
- package/.output/server/_ssr/{teamFns-Bp81UO-x.mjs → teamFns-H438WnZC.mjs} +12 -30
- package/.output/server/_ssr/{teamFns-bm82twd5.mjs → teamFns-j2JKjorZ.mjs} +2 -2
- package/.output/server/_ssr/tokens-DgG_Syq3.mjs +2 -0
- package/.output/server/_ssr/{ui-Ww2tTM2u.mjs → ui-D5KWstlb.mjs} +26 -48
- package/.output/server/{_tanstack-start-manifest_v-DwKENYCN.mjs → _tanstack-start-manifest_v-3H7yBKLz.mjs} +25 -35
- package/{drizzle/0000_round_marauders.sql → .output/server/drizzle/0000_baseline.sql} +102 -44
- package/.output/server/drizzle/meta/_journal.json +3 -115
- package/.output/server/index.mjs +83 -132
- package/{.output/server/drizzle/0000_round_marauders.sql → drizzle/0000_baseline.sql} +102 -44
- package/drizzle/meta/_journal.json +3 -115
- package/package.json +2 -11
- package/scripts/pievo-server.mjs +3 -1
- package/scripts/server-cli-lib.mjs +23 -16
- package/.output/public/assets/CodeField-dOzyFQNH.js +0 -34
- package/.output/public/assets/LoopView-DjVHUyrR.js +0 -59
- package/.output/public/assets/Modal-CCRvx959.js +0 -1
- package/.output/public/assets/SignIn-Qxw5zDFq.js +0 -1
- package/.output/public/assets/actionUi-CXxhzYe2.js +0 -1
- package/.output/public/assets/app-D1cij_NJ.css +0 -2
- package/.output/public/assets/artifactView-Cd5wWPil.js +0 -66
- package/.output/public/assets/index-BRN_CQ8U.js +0 -12
- package/.output/public/assets/invite._token-BIxr8DlP.js +0 -1
- package/.output/public/assets/invite._token-j2BTCeG1.js +0 -1
- package/.output/public/assets/jsx-runtime-BseJUIpC.js +0 -1
- package/.output/public/assets/lifecycleUi-Qy_8beQK.js +0 -1
- package/.output/public/assets/loopApi-CT1mMhlb.js +0 -3
- package/.output/public/assets/loops._loopId-BRBQzioy.js +0 -4
- package/.output/public/assets/loops._loopId_.runs._runId-CMnOJkem.js +0 -3
- package/.output/public/assets/notifyFns-DYD4EKaG.js +0 -1
- package/.output/public/assets/preload-helper-DFkkpP6W.js +0 -3
- package/.output/public/assets/routes-3nuEJGdo.js +0 -1
- package/.output/public/assets/routes-DORLim-C.js +0 -1
- package/.output/public/assets/t._teamId-F5f4K8kd.js +0 -1
- package/.output/public/assets/t._teamId-XfE_S1Fo.js +0 -1
- package/.output/public/assets/ui-Dhsx6SW0.js +0 -1
- package/.output/public/assets/useRouter-DsjH8G0p.js +0 -1
- package/.output/server/_libs/@codemirror/autocomplete+[...].mjs +0 -19713
- package/.output/server/_libs/@codemirror/lang-css+[...].mjs +0 -2636
- package/.output/server/_libs/@codemirror/lang-html+[...].mjs +0 -2247
- package/.output/server/_libs/@codemirror/lang-json+[...].mjs +0 -79
- package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +0 -1736
- package/.output/server/_libs/@uiw/codemirror-extensions-basic-setup+[...].mjs +0 -76
- package/.output/server/_libs/babel__runtime.mjs +0 -30
- package/.output/server/_libs/clsx.mjs +0 -16
- package/.output/server/_libs/codemirror__commands.mjs +0 -1725
- package/.output/server/_libs/codemirror__lint.mjs +0 -565
- package/.output/server/_libs/codemirror__search.mjs +0 -1138
- package/.output/server/_libs/codemirror__theme-one-dark.mjs +0 -161
- package/.output/server/_libs/d3-array.mjs +0 -231
- package/.output/server/_libs/d3-color.mjs +0 -330
- package/.output/server/_libs/d3-format.mjs +0 -252
- package/.output/server/_libs/d3-interpolate.mjs +0 -163
- package/.output/server/_libs/d3-path.mjs +0 -77
- package/.output/server/_libs/d3-scale+[...].mjs +0 -1907
- package/.output/server/_libs/d3-shape.mjs +0 -818
- package/.output/server/_libs/decimal.js-light.mjs +0 -884
- package/.output/server/_libs/dom-serializer+[...].mjs +0 -708
- package/.output/server/_libs/domhandler.mjs +0 -461
- package/.output/server/_libs/domutils.mjs +0 -868
- package/.output/server/_libs/es-toolkit.mjs +0 -1737
- package/.output/server/_libs/eventemitter3.mjs +0 -236
- package/.output/server/_libs/html-dom-parser+htmlparser2.mjs +0 -1560
- package/.output/server/_libs/html-react-parser+[...].mjs +0 -1360
- package/.output/server/_libs/react-is.mjs +0 -48
- package/.output/server/_libs/react-redux+[...].mjs +0 -205
- package/.output/server/_libs/recharts+victory-vendor.mjs +0 -17303
- package/.output/server/_libs/uiw__codemirror-themes.mjs +0 -32
- package/.output/server/_libs/uiw__react-codemirror.mjs +0 -354
- package/.output/server/_ssr/CodeField-B7oOmmwH.mjs +0 -143
- package/.output/server/_ssr/DashboardView-BF7PciP7.mjs +0 -2736
- package/.output/server/_ssr/LoopPlaybook-DC7QVvPY.mjs +0 -2105
- package/.output/server/_ssr/LoopView-DwSrm9Ja.mjs +0 -1300
- package/.output/server/_ssr/Modal-MaCG52Pv.mjs +0 -49
- package/.output/server/_ssr/artifactView-iuPsp5aa.mjs +0 -304
- package/.output/server/_ssr/artifacts-jQ-bfdhI.mjs +0 -2
- package/.output/server/_ssr/boot-CsEFT53K.mjs +0 -2
- package/.output/server/_ssr/db-CXownd1H.mjs +0 -2
- package/.output/server/_ssr/invite._token-CWl6kipD.mjs +0 -28
- package/.output/server/_ssr/logger-Gy-47z3k.mjs +0 -2
- package/.output/server/_ssr/loopApi-8_KgBapr.mjs +0 -109
- package/.output/server/_ssr/loopApi-ABi9SgWS.mjs +0 -564
- package/.output/server/_ssr/loops._loopId-SON_t43g.mjs +0 -30
- package/.output/server/_ssr/loops._loopId-p1KWsvMM.mjs +0 -1477
- package/.output/server/_ssr/notifyFns-BUCePuF3.mjs +0 -118
- package/.output/server/_ssr/router-Czxvra6l.mjs +0 -685
- package/.output/server/_ssr/runDiff--qLtU4FI.mjs +0 -2
- package/.output/server/_ssr/store-40eVzW1S.mjs +0 -2
- package/.output/server/_ssr/tokens-CbfoRC_s.mjs +0 -2
- package/.output/server/drizzle/0001_naive_silver_fox.sql +0 -25
- package/.output/server/drizzle/0002_funny_sage.sql +0 -12
- package/.output/server/drizzle/0003_optimal_slapstick.sql +0 -102
- package/.output/server/drizzle/0004_remove_grok_agent.sql +0 -5
- package/.output/server/drizzle/0005_heavy_gauntlet.sql +0 -8
- package/.output/server/drizzle/0006_tranquil_sharon_carter.sql +0 -1
- package/.output/server/drizzle/0007_faulty_starbolt.sql +0 -30
- package/.output/server/drizzle/0008_durable_lifecycle_evidence.sql +0 -15
- package/.output/server/drizzle/0009_ordinary_electro.sql +0 -1
- package/.output/server/drizzle/0010_workable_rage.sql +0 -14
- package/.output/server/drizzle/0011_steep_marvel_zombies.sql +0 -3
- package/.output/server/drizzle/0012_blocked_run_status.sql +0 -12
- package/.output/server/drizzle/0013_drop_run_outcome.sql +0 -2
- package/.output/server/drizzle/0014_luxuriant_scrambler.sql +0 -5
- package/.output/server/drizzle/0015_run_history_foundation.sql +0 -43
- package/.output/server/drizzle/0016_plural_machine_runs.sql +0 -4
- package/.output/server/drizzle/meta/0000_snapshot.json +0 -1333
- package/.output/server/drizzle/meta/0001_snapshot.json +0 -1498
- package/.output/server/drizzle/meta/0002_snapshot.json +0 -1576
- package/.output/server/drizzle/meta/0003_snapshot.json +0 -1666
- package/.output/server/drizzle/meta/0005_snapshot.json +0 -1666
- package/.output/server/drizzle/meta/0006_snapshot.json +0 -1672
- package/.output/server/drizzle/meta/0007_snapshot.json +0 -1787
- package/.output/server/drizzle/meta/0009_snapshot.json +0 -1793
- package/.output/server/drizzle/meta/0010_snapshot.json +0 -1891
- package/.output/server/drizzle/meta/0011_snapshot.json +0 -1872
- package/drizzle/0001_naive_silver_fox.sql +0 -25
- package/drizzle/0002_funny_sage.sql +0 -12
- package/drizzle/0003_optimal_slapstick.sql +0 -102
- package/drizzle/0004_remove_grok_agent.sql +0 -5
- package/drizzle/0005_heavy_gauntlet.sql +0 -8
- package/drizzle/0006_tranquil_sharon_carter.sql +0 -1
- package/drizzle/0007_faulty_starbolt.sql +0 -30
- package/drizzle/0008_durable_lifecycle_evidence.sql +0 -15
- package/drizzle/0009_ordinary_electro.sql +0 -1
- package/drizzle/0010_workable_rage.sql +0 -14
- package/drizzle/0011_steep_marvel_zombies.sql +0 -3
- package/drizzle/0012_blocked_run_status.sql +0 -12
- package/drizzle/0013_drop_run_outcome.sql +0 -2
- package/drizzle/0014_luxuriant_scrambler.sql +0 -5
- package/drizzle/0015_run_history_foundation.sql +0 -43
- package/drizzle/0016_plural_machine_runs.sql +0 -4
- package/drizzle/meta/0000_snapshot.json +0 -1333
- package/drizzle/meta/0001_snapshot.json +0 -1498
- package/drizzle/meta/0002_snapshot.json +0 -1576
- package/drizzle/meta/0003_snapshot.json +0 -1666
- package/drizzle/meta/0005_snapshot.json +0 -1666
- package/drizzle/meta/0006_snapshot.json +0 -1672
- package/drizzle/meta/0007_snapshot.json +0 -1787
- package/drizzle/meta/0009_snapshot.json +0 -1793
- package/drizzle/meta/0010_snapshot.json +0 -1891
- package/drizzle/meta/0011_snapshot.json +0 -1872
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,k as t}from"./ui-Do4gqMyP.js";import{r as n}from"./actionUi-DpwGIGpw.js";var r=e();function i({error:e}){let i=t();return(0,r.jsx)(`main`,{className:`mx-auto max-w-[1180px] px-8 pt-12`,children:(0,r.jsx)(n,{title:`Couldn't open this invite.`,detail:String(e),onRetry:()=>void i.invalidate()})})}export{i as errorComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{M as e,P as t,j as n,s as r}from"./ui-Do4gqMyP.js";import{M as i,i as a,s as o}from"./preload-helper-DsxECZIS.js";import{c as s,n as c,s as l}from"./index-CaS_SmDq.js";import{t as u}from"./SignIn-0Tjqs-Ma.js";var d=t(e()),f=n();function p({children:e}){return(0,f.jsxs)(`div`,{className:`mx-auto mt-32 max-w-sm text-center`,children:[(0,f.jsx)(a,{size:52}),(0,f.jsx)(`h1`,{className:`mt-4 text-2xl font-semibold tracking-tight text-display`,children:`Team invite`}),e]})}function m(){let e=c.useLoaderData(),{data:t,isPending:n}=o(),a=i(),[m,h]=(0,d.useState)(`idle`),[g,_]=(0,d.useState)(null),v=(0,d.useRef)(!1),y=e.auth.enabled,b=y?!!t:!1;return(0,d.useEffect)(()=>{!y||n||!b||v.current||(v.current=!0,h(`redeeming`),(async()=>{let t=await l({data:e.token});if(t.ok){s(t.teamId),a({to:`/t/$teamId`,params:{teamId:t.teamId}});return}_(t.error),h(`error`)})())},[y,n,b,e.token,a]),y?!n&&!b?(0,f.jsx)(u,{callbackURL:`/invite/${e.token}`}):m===`error`?(0,f.jsxs)(p,{children:[(0,f.jsx)(`p`,{className:`mt-3 text-sm text-accent`,children:g}),(0,f.jsx)(`button`,{className:`${r} mt-6`,onClick:()=>void a({to:`/`}),children:`Go to the dashboard`})]}):(0,f.jsx)(p,{children:(0,f.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,children:`Joining the team…`})}):(0,f.jsxs)(p,{children:[(0,f.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,children:`This Pievo server runs in open mode (a single shared workspace), so team invites don't apply here.`}),(0,f.jsx)(`button`,{className:`${r} mt-6`,onClick:()=>void a({to:`/`}),children:`Go to the dashboard`})]})}export{m as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e="Daemon upgrade required to stop a running process. Run `npm install -g @kky42/pievo@latest`, then `pievo daemon restart`.";function t(e){if(e.deleteRequestedAt!=null)return`deleting`;let t=e.runs.find(e=>e.phase===`running`);return!e.enabled&&t?.cancelRequested?`stopping`:!e.enabled&&(e.running||t)?`paused-finishing`:e.enabled?`active`:`paused`}function n(e){return e===4?{supported:!0,label:`Daemon protocol 4 · Stop supported`}:{supported:!1,label:`Daemon protocol ${e??`unknown`} · upgrade required`}}function r(n){let r=t(n.summary);if(n.summary.queued&&n.summary.reconciliationBlocking)return n.machine.presence===`online`?`Queued · machine is checking an interrupted run`:`Queued · waiting for machine recovery`;let i=n.summary.runs.find(e=>e.phase===`running`);if(i&&n.machine.daemonProtocol!==4)return e;if(r===`stopping`&&i&&!n.machine.online)return`Stopping · waiting for ${n.machine.name||`machine`}`;switch(r){case`deleting`:return`Deleting`;case`stopping`:return`Stopping`;case`paused-finishing`:return n.summary.pauseCause?.kind===`blocked`?`Paused — blocked · current run finishing`:n.summary.pauseCause?.kind===`owner`?`Paused by owner · current run finishing`:`Paused · current run finishing`;case`paused`:return n.summary.pauseCause?.kind===`blocked`?`Paused — blocked`:n.summary.pauseCause?.kind===`failure-streak`?`Paused automatically`:n.summary.pauseCause?.kind===`owner`?`Paused by owner`:`Paused`;case`active`:return`Active`}}export{r as i,n,t as r,e as t};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import{D as e,E as t,M as n,O as r,P as i,S as a,a as o,c as s,d as c,h as l,j as u,m as d,n as ee,o as te,p as f,r as ne,s as re,t as ie,u as ae,v as p,w as m,x as h,y as g}from"./ui-Do4gqMyP.js";import{C as oe,M as se,S as ce,T as le,d as _,h as ue,j as de,l as fe,s as pe,u as me,w as he,x as ge,y as _e}from"./preload-helper-DsxECZIS.js";import{o as v,s as ve,t as ye}from"./MachinesModal-CSbnrUER.js";import{i as be,n as xe,r as Se,t as Ce}from"./lifecycleUi-C7dwHtbw.js";import{c as we,r as Te}from"./index-CaS_SmDq.js";import{t as Ee}from"./SignIn-0Tjqs-Ma.js";import{i as y,n as De,r as b,t as Oe}from"./actionUi-DpwGIGpw.js";var x=i(n(),1),ke={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,avif:`image/avif`,bmp:`image/bmp`,ico:`image/x-icon`,svg:`image/svg+xml`};function Ae(e){return(e.match(/\.([a-z0-9]+)$/i)?.[1]??``).toLowerCase()}function S(e){return ke[Ae(e)]??null}var C=e=>S(e)!==null,je=e=>Ae(e)===`html`||Ae(e)===`htm`,Me=e=>Ae(e)===`md`||Ae(e)===`markdown`;function Ne(e){return C(e)?`image`:je(e)?`html`:Me(e)?`markdown`:`text`}function w(e,t){let n=t.split(`/`).map(encodeURIComponent).join(`/`);return`/api/artifact/${encodeURIComponent(e)}/${n}`}function T(e,t){return`${w(e,t)}?view=inline`}function E(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function D(e){if(Array.isArray(e))return e}function Pe(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Fe(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O(e,t){return D(e)||Pe(e,t)||Ie(e,t)||Fe()}function Ie(e,t){if(e){if(typeof e==`string`)return E(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?E(e,t):void 0}}var Le=Object.entries,k=Object.setPrototypeOf,Re=Object.isFrozen,ze=Object.getPrototypeOf,Be=Object.getOwnPropertyDescriptor,A=Object.freeze,j=Object.seal,Ve=Object.create,He=typeof Reflect<`u`&&Reflect,Ue=He.apply,We=He.construct;A||=function(e){return e},j||=function(e){return e},Ue||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},We||=function(e){return new e(...[...arguments].slice(1))};var Ge=F(Array.prototype.forEach),Ke=F(Array.prototype.lastIndexOf),qe=F(Array.prototype.pop),Je=F(Array.prototype.push),Ye=F(Array.prototype.splice),Xe=Array.isArray,Ze=F(String.prototype.toLowerCase),Qe=F(String.prototype.toString),$e=F(String.prototype.match),et=F(String.prototype.replace),tt=F(String.prototype.indexOf),nt=F(String.prototype.trim),rt=F(Number.prototype.toString),M=F(Boolean.prototype.toString),it=typeof BigInt>`u`?null:F(BigInt.prototype.toString),at=typeof Symbol>`u`?null:F(Symbol.prototype.toString),N=F(Object.prototype.hasOwnProperty),ot=F(Object.prototype.toString),P=F(RegExp.prototype.test),st=ct(TypeError);function F(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Ue(e,t,n)}}function ct(e){return function(){return We(e,[...arguments])}}function I(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ze;if(k&&k(e,null),!Xe(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Re(t)||(t[r]=e),i=e)}e[i]=!0}return e}function lt(e){for(let t=0;t<e.length;t++)N(e,t)||(e[t]=null);return e}function L(e){let t=Ve(null);for(let r of Le(e)){var n=O(r,2);let i=n[0],a=n[1];N(e,i)&&(Xe(a)?t[i]=lt(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=L(a):t[i]=a)}return t}function ut(e){switch(typeof e){case`string`:return e;case`number`:return rt(e);case`boolean`:return M(e);case`bigint`:return it?it(e):`0`;case`symbol`:return at?at(e):`Symbol()`;case`undefined`:return ot(e);case`function`:case`object`:{if(e===null)return ot(e);let t=e,n=R(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:ot(e)}return ot(e)}default:return ot(e)}}function R(e,t){for(;e!==null;){let n=Be(e,t);if(n){if(n.get)return F(n.get);if(typeof n.value==`function`)return F(n.value)}e=ze(e)}function n(){return null}return n}function dt(e){try{return P(e,``),!0}catch{return!1}}var ft=A(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),pt=A(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),mt=A([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),ht=A([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),gt=A(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),_t=A([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),vt=A([`#text`]),yt=A(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),bt=A(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),xt=A(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),St=A([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Ct=j(/{{[\w\W]*|^[\w\W]*}}/g),wt=j(/<%[\w\W]*|^[\w\W]*%>/g),Tt=j(/\${[\w\W]*/g),Et=j(/^data-[\-\w.\u00B7-\uFFFF]+$/),Dt=j(/^aria-[\-\w]+$/),Ot=j(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),kt=j(/^(?:\w+script|data):/i),At=j(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),jt=j(/^html$/i),Mt=j(/^[a-z][.\w]*(-[.\w]+)+$/i),Nt=j(/<[/\w!]/g),Pt=j(/<[/\w]/g),Ft=j(/<\/no(script|embed|frames)/i),It=j(/\/>/i),z={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Lt=function(){return typeof window>`u`?null:window},Rt=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},zt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Bt=function(e,t,n,r){return N(e,t)&&Xe(e[t])?I(r.base?L(r.base):{},e[t],r.transform):n};function Vt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Lt(),t=e=>Vt(e);if(t.version=`3.4.11`,t.removed=[],!e||!e.document||e.document.nodeType!==z.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,ee=R(d,`cloneNode`),te=R(d,`remove`),f=R(d,`nextSibling`),ne=R(d,`childNodes`),re=R(d,`parentNode`),ie=R(d,`shadowRoot`),ae=R(d,`attributes`),p=o&&o.prototype?R(o.prototype,`nodeType`):null,m=o&&o.prototype?R(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let h,g=``,oe,se=!1,ce=0,le=function(){if(ce>0)throw st(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},_=function(e){le(),ce++;try{return h.createHTML(e)}finally{ce--}},ue=function(e){le(),ce++;try{return h.createScriptURL(e)}finally{ce--}},de=function(){return se||=(oe=Rt(u,i),!0),oe},fe=n,pe=fe.implementation,me=fe.createNodeIterator,he=fe.createDocumentFragment,ge=fe.getElementsByTagName,_e=r.importNode,v=zt();t.isSupported=typeof Le==`function`&&typeof re==`function`&&pe&&pe.createHTMLDocument!==void 0;let ve=Ct,ye=wt,be=Tt,xe=Et,Se=Dt,Ce=kt,we=At,Te=Mt,Ee=Ot,y=null,De=I({},[...ft,...pt,...mt,...gt,...vt]),b=null,Oe=I({},[...yt,...bt,...xt,...St]),x=Object.seal(Ve(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ke=null,Ae=null,S=Object.seal(Ve(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),C=!0,je=!0,Me=!1,Ne=!0,w=!1,T=!0,E=!1,D=!1,Pe=null,Fe=null,O=!1,Ie=!1,k=!1,Re=!1,ze=!0,Be=!1,He=`user-content-`,Ue=!0,We=!1,rt={},M=null,it=I({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),at=null,ot=I({},[`audio`,`video`,`img`,`source`,`image`,`track`]),F=null,ct=I({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),lt=`http://www.w3.org/1998/Math/MathML`,Ht=`http://www.w3.org/2000/svg`,B=`http://www.w3.org/1999/xhtml`,V=B,Ut=!1,H=null,Wt=I({},[lt,Ht,B],Qe),U=A([`mi`,`mo`,`mn`,`ms`,`mtext`]),Gt=I({},U),W=A([`annotation-xml`]),Kt=I({},W),qt=I({},[`title`,`style`,`font`,`a`,`script`]),Jt=null,Yt=[`application/xhtml+xml`,`text/html`],G=null,Xt=null,Zt=n.createElement(`form`),Qt=function(e){return e instanceof RegExp||e instanceof Function},$t=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Xt&&Xt===e)return;(!e||typeof e!=`object`)&&(e={}),e=L(e),Jt=Yt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,G=Jt===`application/xhtml+xml`?Qe:Ze,y=Bt(e,`ALLOWED_TAGS`,De,{transform:G}),b=Bt(e,`ALLOWED_ATTR`,Oe,{transform:G}),H=Bt(e,`ALLOWED_NAMESPACES`,Wt,{transform:Qe}),F=Bt(e,`ADD_URI_SAFE_ATTR`,ct,{transform:G,base:ct}),at=Bt(e,`ADD_DATA_URI_TAGS`,ot,{transform:G,base:ot}),M=Bt(e,`FORBID_CONTENTS`,it,{transform:G}),ke=Bt(e,`FORBID_TAGS`,L({}),{transform:G}),Ae=Bt(e,`FORBID_ATTR`,L({}),{transform:G}),rt=N(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?L(e.USE_PROFILES):e.USE_PROFILES:!1,C=e.ALLOW_ARIA_ATTR!==!1,je=e.ALLOW_DATA_ATTR!==!1,Me=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ne=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,w=e.SAFE_FOR_TEMPLATES||!1,T=e.SAFE_FOR_XML!==!1,E=e.WHOLE_DOCUMENT||!1,Ie=e.RETURN_DOM||!1,k=e.RETURN_DOM_FRAGMENT||!1,Re=e.RETURN_TRUSTED_TYPE||!1,O=e.FORCE_BODY||!1,ze=e.SANITIZE_DOM!==!1,Be=e.SANITIZE_NAMED_PROPS||!1,Ue=e.KEEP_CONTENT!==!1,We=e.IN_PLACE||!1,Ee=dt(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Ot,V=typeof e.NAMESPACE==`string`?e.NAMESPACE:B,Gt=N(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?L(e.MATHML_TEXT_INTEGRATION_POINTS):I({},U),Kt=N(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?L(e.HTML_INTEGRATION_POINTS):I({},W);let t=N(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?L(e.CUSTOM_ELEMENT_HANDLING):Ve(null);if(x=Ve(null),N(t,`tagNameCheck`)&&Qt(t.tagNameCheck)&&(x.tagNameCheck=t.tagNameCheck),N(t,`attributeNameCheck`)&&Qt(t.attributeNameCheck)&&(x.attributeNameCheck=t.attributeNameCheck),N(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(x.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),j(x),w&&(je=!1),k&&(Ie=!0),rt&&(y=I({},vt),b=Ve(null),rt.html===!0&&(I(y,ft),I(b,yt)),rt.svg===!0&&(I(y,pt),I(b,bt),I(b,St)),rt.svgFilters===!0&&(I(y,mt),I(b,bt),I(b,St)),rt.mathMl===!0&&(I(y,gt),I(b,xt),I(b,St))),S.tagCheck=null,S.attributeCheck=null,N(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?S.tagCheck=e.ADD_TAGS:Xe(e.ADD_TAGS)&&(y===De&&(y=L(y)),I(y,e.ADD_TAGS,G))),N(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?S.attributeCheck=e.ADD_ATTR:Xe(e.ADD_ATTR)&&(b===Oe&&(b=L(b)),I(b,e.ADD_ATTR,G))),N(e,`ADD_URI_SAFE_ATTR`)&&Xe(e.ADD_URI_SAFE_ATTR)&&I(F,e.ADD_URI_SAFE_ATTR,G),N(e,`FORBID_CONTENTS`)&&Xe(e.FORBID_CONTENTS)&&(M===it&&(M=L(M)),I(M,e.FORBID_CONTENTS,G)),N(e,`ADD_FORBID_CONTENTS`)&&Xe(e.ADD_FORBID_CONTENTS)&&(M===it&&(M=L(M)),I(M,e.ADD_FORBID_CONTENTS,G)),Ue&&(y[`#text`]=!0),E&&I(y,[`html`,`head`,`body`]),y.table&&(I(y,[`tbody`]),delete ke.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw st(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw st(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=h;h=e.TRUSTED_TYPES_POLICY;try{g=_(``)}catch(e){throw h=t,e}}else e.TRUSTED_TYPES_POLICY===null?(h=void 0,g=``):(h===void 0&&(h=de()),h&&typeof g==`string`&&(g=_(``)));A&&A(e),Xt=e},en=I({},[...pt,...mt,...ht]),tn=I({},[...gt,..._t]),nn=function(e,t,n){return t.namespaceURI===B?e===`svg`:t.namespaceURI===lt?e===`svg`&&(n===`annotation-xml`||Gt[n]):!!en[e]},rn=function(e,t,n){return t.namespaceURI===B?e===`math`:t.namespaceURI===Ht?e===`math`&&Kt[n]:!!tn[e]},an=function(e,t,n){return t.namespaceURI===Ht&&!Kt[n]||t.namespaceURI===lt&&!Gt[n]?!1:!tn[e]&&(qt[e]||!en[e])},on=function(e){let t=re(e);(!t||!t.tagName)&&(t={namespaceURI:V,tagName:`template`});let n=Ze(e.tagName),r=Ze(t.tagName);return H[e.namespaceURI]?e.namespaceURI===Ht?nn(n,t,r):e.namespaceURI===lt?rn(n,t,r):e.namespaceURI===B?an(n,t,r):!!(Jt===`application/xhtml+xml`&&H[e.namespaceURI]):!1},K=function(e){Je(t.removed,{element:e});try{re(e).removeChild(e)}catch{if(te(e),!re(e))throw st(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},sn=function(e){let t=ne(e);if(t){let e=[];Ge(t,t=>{Je(e,t)}),Ge(e,e=>{try{te(e)}catch{}})}let n=ae(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},cn=function(e,n){try{Je(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{Je(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(Ie||k)try{K(n)}catch{}else try{n.setAttribute(e,``)}catch{}},ln=function(e){let t=ae(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||b[G(i)]))try{e.removeAttribute(i)}catch{}}},un=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(p?p(e):e.nodeType)===z.element&&ln(e);let n=ne(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},dn=function(e){let t=null,r=null;if(O)e=`<remove></remove>`+e;else{let t=$e(e,/^[\r\n\t ]+/);r=t&&t[0]}Jt===`application/xhtml+xml`&&V===B&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=h?_(e):e;if(V===B)try{t=new l().parseFromString(i,Jt)}catch{}if(!t||!t.documentElement){t=pe.createDocument(V,`template`,null);try{t.documentElement.innerHTML=Ut?g:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),V===B?ge.call(t,E?`html`:`body`)[0]:E?t.documentElement:a},fn=function(e){return me.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},pn=function(e){return e=et(e,ve,` `),e=et(e,ye,` `),e=et(e,be,` `),e},mn=function(e){e.normalize();let t=me.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=pn(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&Ge(r,e=>{gn(e.content)&&mn(e.content)})},hn=function(e){let t=m?m(e):null;return typeof t!=`string`||G(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==ae(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==p(e)||e.childNodes!==ne(e)},gn=function(e){if(!p||typeof e!=`object`||!e)return!1;try{return p(e)===z.documentFragment}catch{return!1}},q=function(e){if(!p||typeof e!=`object`||!e)return!1;try{return typeof p(e)==`number`}catch{return!1}};function J(e,n,r){e.length!==0&&Ge(e,e=>{e.call(t,n,r,Xt)})}let _n=function(e,t){return!!(T&&e.hasChildNodes()&&!q(e.firstElementChild)&&P(Nt,e.textContent)&&P(Nt,e.innerHTML)||T&&e.namespaceURI===B&&t===`style`&&q(e.firstElementChild)||e.nodeType===z.processingInstruction||T&&e.nodeType===z.comment&&P(Pt,e.data))},vn=function(e,t){if(!ke[t]&&Sn(t)&&(x.tagNameCheck instanceof RegExp&&P(x.tagNameCheck,t)||x.tagNameCheck instanceof Function&&x.tagNameCheck(t)))return!1;if(Ue&&!M[t]){let t=re(e),n=ne(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=We?n[i]:ee(n[i],!0);t.insertBefore(r,f(e))}}}return K(e),!0},yn=function(e){if(J(v.beforeSanitizeElements,e,null),hn(e))return K(e),!0;let n=G(m?m(e):e.nodeName);if(J(v.uponSanitizeElement,e,{tagName:n,allowedTags:y}),_n(e,n))return K(e),!0;if(ke[n]||!(S.tagCheck instanceof Function&&S.tagCheck(n))&&!y[n])return vn(e,n);if((p?p(e):e.nodeType)===z.element&&!on(e)||(n===`noscript`||n===`noembed`||n===`noframes`)&&P(Ft,e.innerHTML))return K(e),!0;if(w&&e.nodeType===z.text){let n=pn(e.textContent);e.textContent!==n&&(Je(t.removed,{element:e.cloneNode()}),e.textContent=n)}return J(v.afterSanitizeElements,e,null),!1},bn=function(e,t,r){if(Ae[t]||ze&&(t===`id`||t===`name`)&&(r in n||r in Zt))return!1;let i=b[t]||S.attributeCheck instanceof Function&&S.attributeCheck(t,e);if(!(je&&P(xe,t))&&!(C&&P(Se,t))){if(!i){if(!(Sn(e)&&(x.tagNameCheck instanceof RegExp&&P(x.tagNameCheck,e)||x.tagNameCheck instanceof Function&&x.tagNameCheck(e))&&(x.attributeNameCheck instanceof RegExp&&P(x.attributeNameCheck,t)||x.attributeNameCheck instanceof Function&&x.attributeNameCheck(t,e))||t===`is`&&x.allowCustomizedBuiltInElements&&(x.tagNameCheck instanceof RegExp&&P(x.tagNameCheck,r)||x.tagNameCheck instanceof Function&&x.tagNameCheck(r))))return!1}else if(!F[t]&&!P(Ee,et(r,we,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&tt(r,`data:`)===0&&at[e])&&!(Me&&!P(Ce,et(r,we,``)))&&r)return!1}return!0},xn=I({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Sn=function(e){return!xn[Ze(e)]&&P(Te,e)},Cn=function(e,t,n,r){if(h&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return _(r);case`TrustedScriptURL`:return ue(r)}return r},wn=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),hn(e)?K(e):qe(t.removed)}catch{cn(n,e)}},Tn=function(e){J(v.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||hn(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:b,forceKeepAttr:void 0},r=t.length,i=G(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=G(o),u=c,d=o===`value`?u:nt(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,J(v.uponSanitizeAttribute,e,n),d=n.attrValue,Be&&(l===`id`||l===`name`)&&tt(d,He)!==0&&(cn(o,e),d=He+d),T&&P(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){cn(o,e);continue}if(l===`attributename`&&$e(d,`href`)){cn(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){cn(o,e);continue}if(!Ne&&P(It,d)){cn(o,e);continue}if(w&&(d=pn(d)),!bn(i,l,d)){cn(o,e);continue}d=Cn(i,l,s,d),d!==u&&wn(e,o,s,d)}}J(v.afterSanitizeAttributes,e,null)},En=function(e){let t=null,n=fn(e);for(J(v.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(J(v.uponSanitizeShadowNode,t,null),yn(t),Tn(t),gn(t.content)&&En(t.content),(p?p(t):t.nodeType)===z.element){let e=ie(t);gn(e)&&(Dn(e),En(e))}J(v.afterSanitizeShadowDOM,e,null)},Dn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){En(e.shadow);continue}let n=e.node,r=(p?p(n):n.nodeType)===z.element,i=ne(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=m?m(n):null;if(typeof e==`string`&&G(e)===`template`){let e=n.content;gn(e)&&t.push({node:e,shadow:null})}}if(r){let e=ie(n);gn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Ut=!e,Ut&&(e=`<!-->`),typeof e!=`string`&&!q(e)&&(e=ut(e),typeof e!=`string`))throw st(`dirty is not a string, aborting`);if(!t.isSupported)return e;D?(y=Pe,b=Fe):$t(n),(v.uponSanitizeElement.length>0||v.uponSanitizeAttribute.length>0)&&(y=L(y)),v.uponSanitizeAttribute.length>0&&(b=L(b)),t.removed=[];let c=We&&typeof e!=`string`&&q(e);if(c){let t=m?m(e):e.nodeName;if(typeof t==`string`){let e=G(t);if(!y[e]||ke[e])throw st(`root node is forbidden and cannot be sanitized in-place`)}if(hn(e))throw st(`root node is clobbered and cannot be sanitized in-place`);try{Dn(e)}catch(t){throw sn(e),t}}else if(q(e))i=dn(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===z.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Dn(a);else{if(!Ie&&!w&&!E&&e.indexOf(`<`)===-1)return h&&Re?_(e):e;if(i=dn(e),!i)return Ie?null:Re?g:``}i&&O&&K(i.firstChild);let l=fn(c?e:i);try{for(;o=l.nextNode();)yn(o),Tn(o),gn(o.content)&&En(o.content)}catch(t){throw c&&sn(e),t}if(c)return Ge(t.removed,e=>{e.element&&un(e.element)}),w&&mn(e),e;if(Ie){if(w&&mn(i),k)for(s=he.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(b.shadowroot||b.shadowrootmode)&&(s=_e.call(r,s,!0)),s}let u=E?i.outerHTML:i.innerHTML;return E&&y[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&P(jt,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
3
|
+
`+u),w&&(u=pn(u)),h&&Re?_(u):u},t.setConfig=function(){$t(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),D=!0,Pe=y,Fe=b},t.clearConfig=function(){Xt=null,D=!1,Pe=null,Fe=null,h=oe,g=``},t.isValidAttribute=function(e,t,n){return Xt||$t({}),bn(G(e),G(t),n)},t.addHook=function(e,t){typeof t==`function`&&N(v,e)&&Je(v[e],t)},t.removeHook=function(e,t){if(N(v,e)){if(t!==void 0){let n=Ke(v[e],t);return n===-1?void 0:Ye(v[e],n,1)[0]}return qe(v[e])}},t.removeHooks=function(e){N(v,e)&&(v[e]=[])},t.removeAllHooks=function(){v=zt()},t}var Ht=Vt();function B(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var V=B();function Ut(e){V=e}var H={exec:()=>null};function Wt(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function U(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(W.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Gt=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),W={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Wt(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Wt(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Wt(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Wt(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Wt(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:Wt(e=>RegExp(`^ {0,${e}}>`))},Kt=/^(?:[ \t]*(?:\n|$))+/,qt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Jt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Yt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,G=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Xt=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Zt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Qt=U(Zt).replace(/bull/g,Xt).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),$t=U(Zt).replace(/bull/g,Xt).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),en=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,tn=/^[^\n]+/,nn=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,rn=U(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,nn).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),an=U(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Xt).getRegex(),on=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,K=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sn=U(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,K).replace(`tag`,on).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),cn=U(en).replace(`hr`,Yt).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,on).getRegex(),ln={blockquote:U(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,cn).getRegex(),code:qt,def:rn,fences:Jt,heading:G,hr:Yt,html:sn,lheading:Qt,list:an,newline:Kt,paragraph:cn,table:H,text:tn},un=U(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Yt).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,on).getRegex(),dn={...ln,lheading:$t,table:un,paragraph:U(en).replace(`hr`,Yt).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,un).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,on).getRegex()},fn={...ln,html:U(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,K).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:H,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:U(en).replace(`hr`,Yt).replace(`heading`,` *#{1,6} *[^
|
|
4
|
+
]`).replace(`lheading`,Qt).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},pn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,mn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,hn=/^( {2,}|\\)\n(?!\s*$)/,gn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,q=/[\p{P}\p{S}]/u,J=/[\s\p{P}\p{S}]/u,_n=/[^\s\p{P}\p{S}]/u,vn=U(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,J).getRegex(),yn=/(?!~)[\p{P}\p{S}]/u,bn=/(?!~)[\s\p{P}\p{S}]/u,xn=/(?:[^\s\p{P}\p{S}]|~)/u,Sn=U(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Gt?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Cn=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,wn=U(Cn,`u`).replace(/punct/g,q).getRegex(),Tn=U(Cn,`u`).replace(/punct/g,yn).getRegex(),En=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Dn=U(En,`gu`).replace(/notPunctSpace/g,_n).replace(/punctSpace/g,J).replace(/punct/g,q).getRegex(),On=U(En,`gu`).replace(/notPunctSpace/g,xn).replace(/punctSpace/g,bn).replace(/punct/g,yn).getRegex(),kn=U(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,_n).replace(/punctSpace/g,J).replace(/punct/g,q).getRegex(),An=U(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,q).getRegex(),jn=U(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,_n).replace(/punctSpace/g,J).replace(/punct/g,q).getRegex(),Mn=U(/\\(punct)/,`gu`).replace(/punct/g,q).getRegex(),Nn=U(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Pn=U(K).replace(`(?:-->|$)`,`-->`).getRegex(),Fn=U(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Pn).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),In=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ln=U(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,In).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Rn=U(/^!?\[(label)\]\[(ref)\]/).replace(`label`,In).replace(`ref`,nn).getRegex(),zn=U(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,nn).getRegex(),Bn=U(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Rn).replace(`nolink`,zn).getRegex(),Vn=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Hn={_backpedal:H,anyPunctuation:Mn,autolink:Nn,blockSkip:Sn,br:hn,code:mn,del:H,delLDelim:H,delRDelim:H,emStrongLDelim:wn,emStrongRDelimAst:Dn,emStrongRDelimUnd:kn,escape:pn,link:Ln,nolink:zn,punctuation:vn,reflink:Rn,reflinkSearch:Bn,tag:Fn,text:gn,url:H},Un={...Hn,link:U(/^!?\[(label)\]\((.*?)\)/).replace(`label`,In).getRegex(),reflink:U(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,In).getRegex()},Wn={...Hn,emStrongRDelimAst:On,emStrongLDelim:Tn,delLDelim:An,delRDelim:jn,url:U(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Vn).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:U(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Vn).getRegex()},Gn={...Wn,br:U(hn).replace(`{2,}`,`*`).getRegex(),text:U(Wn.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Kn={normal:ln,gfm:dn,pedantic:fn},qn={normal:Hn,gfm:Wn,breaks:Gn,pedantic:Un},Jn={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Yn=e=>Jn[e];function Y(e,t){if(t){if(W.escapeTest.test(e))return e.replace(W.escapeReplace,Yn)}else if(W.escapeTestNoEncode.test(e))return e.replace(W.escapeReplaceNoEncode,Yn);return e}function Xn(e){try{e=encodeURI(e).replace(W.percentDecode,`%`)}catch{return null}return e}function Zn(e,t){let n=e.replace(W.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(W.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(W.slashPipe,`|`);return n}function Qn(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function $n(e){let t=e.split(`
|
|
5
|
+
`),n=t.length-1;for(;n>=0&&W.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
6
|
+
`)}function er(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function tr(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function nr(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function rr(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
7
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
8
|
+
`)}var ir=class{options;rules;lexer;constructor(e){this.options=e||V}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:$n(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=rr(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Qn(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Qn(t[0],`
|
|
9
|
+
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Qn(t[0],`
|
|
10
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Qn(t[0],`
|
|
11
|
+
`).split(`
|
|
12
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
13
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
14
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
15
|
+
${s}`:s,r=r?`${r}
|
|
16
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
17
|
+
`+e.join(`
|
|
18
|
+
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
19
|
+
`+e.join(`
|
|
20
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
21
|
+
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=tr(t[2].split(`
|
|
22
|
+
`,1)[0],t[1].length),l=e.split(`
|
|
23
|
+
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
24
|
+
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),ee=this.rules.other.blockquoteBeginRegex(d);for(;e;){let te=e.split(`
|
|
25
|
+
`,1)[0],f;if(l=te,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),f=l):f=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||ee.test(l)||t.test(l)||n.test(l))break;if(f.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
26
|
+
`+f.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
27
|
+
`+l}u=!l.trim(),r+=te+`
|
|
28
|
+
`,e=e.substring(te.length+1),c=f.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1;if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=$n(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:Qn(t[0],`
|
|
29
|
+
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Zn(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
30
|
+
`):[],a={type:`table`,raw:Qn(t[0],`
|
|
31
|
+
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Zn(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:Qn(t[0],`
|
|
32
|
+
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
33
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Qn(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=er(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),nr(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return nr(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},X=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||V,this.options.tokenizer=this.options.tokenizer||new ir,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:W,block:Kn.normal,inline:qn.normal};this.options.pedantic?(t.block=Kn.pedantic,t.inline=qn.pedantic):this.options.gfm&&(t.block=Kn.gfm,this.options.breaks?t.inline=qn.breaks:t.inline=qn.gfm),this.tokenizer.rules=t}static get rules(){return{block:Kn,inline:qn}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(W.carriageReturn,`
|
|
34
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(W.tabCharGlobal,` `).replace(W.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
|
|
35
|
+
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
36
|
+
`)?``:`
|
|
37
|
+
`)+i.raw,n.text+=`
|
|
38
|
+
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
39
|
+
`)?``:`
|
|
40
|
+
`)+i.raw,n.text+=`
|
|
41
|
+
`+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
|
|
42
|
+
`)?``:`
|
|
43
|
+
`)+i.raw,r.text+=`
|
|
44
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
45
|
+
`)?``:`
|
|
46
|
+
`)+i.raw,n.text+=`
|
|
47
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``,s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},ar=class{options;parser;constructor(e){this.options=e||V}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(W.notSpaceStart)?.[0],i=e.replace(W.endingNewline,``)+`
|
|
48
|
+
`;return r?`<pre><code class="language-`+Y(r)+`">`+(n?i:Y(i,!0))+`</code></pre>
|
|
49
|
+
`:`<pre><code>`+(n?i:Y(i,!0))+`</code></pre>
|
|
50
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
51
|
+
${this.parser.parse(e)}</blockquote>
|
|
52
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
53
|
+
`}hr(e){return`<hr>
|
|
54
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
55
|
+
`+r+`</`+i+`>
|
|
56
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
57
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
58
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
59
|
+
<thead>
|
|
60
|
+
`+t+`</thead>
|
|
61
|
+
`+r+`</table>
|
|
62
|
+
`}tablerow({text:e}){return`<tr>
|
|
63
|
+
${e}</tr>
|
|
64
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
65
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Y(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Xn(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Y(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Xn(e);if(i===null)return Y(n);e=i;let a=`<img src="${e}" alt="${Y(n)}"`;return t&&(a+=` title="${Y(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Y(e.text)}},or=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Z=class e{options;renderer;textRenderer;constructor(e){this.options=e||V,this.options.renderer=this.options.renderer||new ar,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new or}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},sr=class{options;block;constructor(e){this.options=e||V}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?X.lex:X.lexInline}provideParser(e=this.block){return e?Z.parse:Z.parseInline}},cr=new class{defaults=B();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Z;Renderer=ar;TextRenderer=or;Lexer=X;Tokenizer=ir;Hooks=sr;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new ar(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new ir(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new sr;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];sr.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&sr.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return X.lex(e,t??this.defaults)}parser(e,t){return Z.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?X.lex:X.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Z.parse:Z.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?X.lex:X.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Z.parse:Z.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
66
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Y(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Q(e,t){return cr.parse(e,t)}Q.options=Q.setOptions=function(e){return cr.setOptions(e),Q.defaults=cr.defaults,Ut(Q.defaults),Q},Q.getDefaults=B,Q.defaults=V,Q.use=function(...e){return cr.use(...e),Q.defaults=cr.defaults,Ut(Q.defaults),Q},Q.walkTokens=function(e,t){return cr.walkTokens(e,t)},Q.parseInline=cr.parseInline,Q.Parser=Z,Q.parser=Z.parse,Q.Renderer=ar,Q.TextRenderer=or,Q.Lexer=X,Q.lexer=X.lex,Q.Tokenizer=ir,Q.Hooks=sr,Q.parse=Q,Q.options,Q.setOptions,Q.use,Q.walkTokens,Q.parseInline,Z.parse,X.lex;var lr={ALLOWED_TAGS:`h1.h2.h3.h4.h5.h6.p.br.hr.strong.b.em.i.del.s.code.pre.blockquote.ul.ol.li.a.span.table.thead.tbody.tr.th.td.img`.split(`.`),ALLOWED_ATTR:[`href`,`title`,`target`,`rel`,`src`,`alt`]};function ur(e){return Ht.sanitize(Q.parse(e,{async:!1,gfm:!0}),lr)}var $=u();function dr({content:e}){return(0,$.jsx)(`div`,{className:`artifact-markdown px-5 py-4`,dangerouslySetInnerHTML:{__html:(0,x.useMemo)(()=>ur(e),[e])}})}function fr({path:e,meta:t,action:n}){return(0,$.jsxs)(`div`,{className:`sticky top-0 z-10 flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-hairline bg-surface px-5 py-2.5`,children:[(0,$.jsx)(`span`,{className:`break-all font-mono text-label text-primary`,children:e}),t&&(0,$.jsxs)(`span`,{className:`font-mono text-caption text-disabled`,children:[`· `,t]}),n&&(0,$.jsx)(`span`,{className:`ml-auto shrink-0`,children:n})]})}function pr({loopId:e,path:t,oversize:n}){return(0,$.jsx)(`div`,{className:`px-5 py-8 text-body text-secondary`,children:n?(0,$.jsx)(`span`,{className:`text-disabled`,children:`Too large to preview - stored as metadata only (no synced bytes).`}):(0,$.jsxs)($.Fragment,{children:[`Binary file - not previewable.`,` `,(0,$.jsx)(`a`,{href:w(e,t),download:!0,className:`text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Download`})]})})}function mr({loopId:e,path:t,mode:n,onMode:r,showToggle:i}){return(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-hairline bg-surface px-5 py-1.5`,children:[i&&n&&r&&(0,$.jsx)(`div`,{className:`inline-flex overflow-hidden rounded-control border border-hairline`,children:[`preview`,`source`].map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`cursor-pointer border-none px-2.5 py-0.5 text-caption font-medium transition-colors ${n===e?`bg-raised text-display`:`bg-transparent text-secondary hover:text-display`}`,children:e===`preview`?`Preview`:`Source`},e))}),(0,$.jsx)(`a`,{href:w(e,t),download:!0,className:`ml-auto shrink-0 text-caption font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Download ↓`})]})}function hr({html:e}){return(0,$.jsx)(`iframe`,{title:`Rendered HTML artifact (sandboxed)`,srcDoc:e,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,className:`h-[min(70vh,620px)] w-full border-0 bg-white`})}function gr({loopId:e,file:t}){let[n,r]=(0,x.useState)(!1);return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(mr,{loopId:e,path:t.path,showToggle:!1}),n?(0,$.jsxs)(`div`,{className:`px-5 py-8 text-body text-secondary`,children:[`Couldn't load this image.`,` `,(0,$.jsx)(`a`,{href:w(e,t.path),download:!0,className:`text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Download`}),` `,`instead.`]}):(0,$.jsx)(`div`,{className:`flex justify-center overflow-auto px-5 py-6`,children:(0,$.jsx)(`img`,{src:T(e,t.path),alt:t.path,onError:()=>r(!0),className:`max-w-full rounded-control border border-hairline bg-white object-contain`})})]})}function _r({loopId:e,file:t,kind:n}){let[r,i]=(0,x.useState)({loading:!0}),[a,o]=(0,x.useState)(`preview`);if((0,x.useEffect)(()=>{let n=!0;return i({loading:!0}),me({data:{loopId:e,path:t.path}}).then(e=>n&&i(e)).catch(e=>n&&i({error:String(e)})),()=>{n=!1}},[e,t.path,t.updatedAt]),`loading`in r)return(0,$.jsx)(`div`,{className:`px-5 py-6 text-body text-disabled`,children:`Loading…`});if(`binary`in r)return(0,$.jsx)(pr,{loopId:e,path:t.path,oversize:r.oversize});if(`error`in r)return(0,$.jsxs)(`div`,{className:`px-5 py-6 text-body text-accent`,children:[`Couldn't load this file - `,r.error]});let s=r.text||`(empty file)`,c=n===`html`||n===`markdown`,l=!c||a===`source`;return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(mr,{loopId:e,path:t.path,mode:a,onMode:o,showToggle:c}),n===`html`&&!l?(0,$.jsx)(hr,{html:r.text||``}):n===`markdown`&&!l?(0,$.jsx)(dr,{content:s}):(0,$.jsx)(`pre`,{className:`m-0 overflow-x-auto whitespace-pre-wrap px-5 py-4 font-mono text-label leading-relaxed text-secondary`,children:s})]})}function vr({loopId:e,file:t}){let n=Ne(t.path);return t.oversize?(0,$.jsx)(pr,{loopId:e,path:t.path,oversize:!0}):n===`image`?(0,$.jsx)(gr,{loopId:e,file:t},`${t.path}:${t.updatedAt??``}`):t.binary?(0,$.jsx)(pr,{loopId:e,path:t.path,oversize:!1}):(0,$.jsx)(_r,{loopId:e,file:t,kind:n},t.path)}var yr=e=>e.split(`/`).pop()||e;function br({loopId:e,configuredPaths:t,running:n}){let[r,i]=(0,x.useState)(null),[o,s]=(0,x.useState)(null),c=(0,x.useRef)(0),l=(0,x.useCallback)(async()=>{let t=++c.current;try{let n=await _({data:{loopId:e}});t===c.current&&i(n)}catch{t===c.current&&i(e=>e??[])}},[e]);(0,x.useEffect)(()=>{i(null),s(null),l()},[e,l]),(0,x.useEffect)(()=>{let e=setInterval(()=>void l(),n?4e3:12e3);return()=>clearInterval(e)},[n,l]);let u=r??[],d=o&&u.some(e=>e.path===o)?o:u[0]?.path??null,ee=u.find(e=>e.path===d)??null;return(0,$.jsxs)(`section`,{id:`files`,className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`mb-2.5 flex items-end justify-between gap-3 border-b border-hairline pb-1.5`,children:[(0,$.jsxs)(`h2`,{className:`text-label font-semibold text-secondary`,children:[`Artifacts`,r?` (${u.length})`:``]}),(0,$.jsxs)(`span`,{className:`text-caption font-medium text-disabled`,children:[`Configured exact paths: `,t.length]})]}),u.length===0?(0,$.jsx)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 py-10 text-center text-body text-disabled shadow-card`,children:r==null?`Loading…`:t.length?`No configured artifact has been collected yet.`:`No artifact paths configured.`}):(0,$.jsxs)(`div`,{className:`grid h-[min(600px,68vh)] grid-cols-1 overflow-hidden rounded-card border border-hairline bg-surface shadow-card sm:grid-cols-[210px_1fr]`,children:[(0,$.jsx)(`nav`,{className:`max-h-44 overflow-y-auto border-b border-hairline sm:max-h-none sm:border-b-0 sm:border-r`,children:(0,$.jsx)(`ul`,{className:`py-1.5`,children:u.map(e=>{let t=e.path===d;return(0,$.jsx)(`li`,{children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>s(e.path),className:`flex w-full items-center border-l-2 px-3 py-2 text-left transition-colors ${t?`border-display bg-raised`:`border-transparent hover:bg-raised/60`}`,children:(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate font-mono text-label ${t?`text-display`:`text-primary`}`,title:e.path,children:yr(e.path)}),(0,$.jsx)(`span`,{className:`block truncate font-mono text-micro text-disabled`,title:e.path,children:e.path})]})})},e.path)})})}),(0,$.jsx)(`div`,{className:`min-w-0 overflow-y-auto`,children:ee&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(fr,{path:ee.path,meta:[ee.size==null?``:m(ee.size),`collected ${a(ee.updatedAt)}`].filter(Boolean).join(` · `)}),(0,$.jsx)(vr,{loopId:e,file:ee})]})})]})]})}var xr=[`claude-code`,`codex`],Sr={"claude-code":`Claude Code`,codex:`Codex`},Cr=`mt-1 text-caption leading-snug text-disabled`;function wr(e){let t=e?.schedule;return{name:e?.name??``,mode:t?.mode??`cron`,cron:t?.mode===`cron`?t.cron:`0 */3 * * *`,timezone:t?.mode===`cron`?t.timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,overlap:t?.mode===`cron`?t.overlap:`queue-one`,delayMinutes:String(t?.mode===`continuous`?t.delayMinutes:1),workdir:e?.workdir??``,agent:e?.agent??`claude-code`,model:e?.model??``,reasoningEffort:e?.reasoningEffort??``,prompt:e?.prompt??``,keep:e?.statusDefinitions?.keep??``,noChange:e?.statusDefinitions?.noChange??``,block:e?.statusDefinitions?.block??``,artifacts:(e?.artifacts??[]).join(`
|
|
67
|
+
`)}}function Tr({title:e,hint:t}){return(0,$.jsxs)(`div`,{className:`mb-3 mt-7 border-b border-hairline pb-1.5 first:mt-2`,children:[(0,$.jsx)(`h2`,{className:d,children:e}),t&&(0,$.jsx)(`div`,{className:`mt-0.5 text-caption text-disabled`,children:t})]})}function Er({label:e,value:t,onChange:n,mono:r,hint:i,placeholder:a}){let o=(0,x.useId)();return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{htmlFor:o,className:c,children:e}),(0,$.jsx)(`input`,{id:o,className:`${ae} ${r?`font-mono`:``}`,value:t,placeholder:a,onChange:e=>n(e.target.value)}),i&&(0,$.jsx)(`div`,{className:Cr,children:i})]})}function Dr({label:e,value:t,onChange:n,rows:r=4,mono:i,hint:a}){let o=(0,x.useId)();return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{htmlFor:o,className:c,children:e}),(0,$.jsx)(`textarea`,{id:o,rows:r,className:`${ae} h-auto resize-y ${i?`font-mono`:``}`,value:t,onChange:e=>n(e.target.value)}),a&&(0,$.jsx)(`div`,{className:Cr,children:a})]})}var Or=(0,x.forwardRef)(function({initial:e},t){let[n,r]=(0,x.useState)(()=>wr(e)),[i,a]=(0,x.useState)(null),o=(e,t)=>r(n=>({...n,[e]:t}));return(0,x.useImperativeHandle)(t,()=>({read(){let e=[[`Name`,n.name],[`Working directory`,n.workdir],[`Prompt`,n.prompt],[`Keep definition`,n.keep],[`No-change definition`,n.noChange],[`Block definition`,n.block]].find(([,e])=>!e.trim());if(e)return a(`${e[0]} is required.`),null;let t=Number(n.delayMinutes);if(n.mode===`continuous`&&(!Number.isInteger(t)||t<1))return a(`Continuous delay must be an integer of at least 1 minute.`),null;let r=n.mode===`cron`?{mode:`cron`,cron:n.cron.trim(),timezone:n.timezone.trim(),overlap:n.overlap}:{mode:`continuous`,delayMinutes:t};return a(null),{name:n.name.trim(),schedule:r,workdir:n.workdir.trim(),agent:n.agent,model:n.model.trim()||null,reasoningEffort:n.reasoningEffort.trim()||null,prompt:n.prompt,statusDefinitions:{keep:n.keep,noChange:n.noChange,block:n.block},artifacts:n.artifacts.split(/\r?\n/).filter(e=>e.length>0)}}})),(0,$.jsxs)(`div`,{className:`grid gap-x-10 lg:grid-cols-[minmax(300px,380px)_minmax(0,1fr)]`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(Tr,{title:`Basics`}),(0,$.jsx)(Er,{label:`Name`,value:n.name,onChange:e=>o(`name`,e)}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:c,children:`Schedule`}),(0,$.jsxs)(`select`,{"aria-label":`Schedule`,className:l,value:n.mode,onChange:e=>o(`mode`,e.target.value),children:[(0,$.jsx)(`option`,{value:`cron`,children:`Cron`}),(0,$.jsx)(`option`,{value:`continuous`,children:`Continuous`})]})]}),n.mode===`cron`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Er,{label:`Cron expression`,value:n.cron,onChange:e=>o(`cron`,e),mono:!0}),(0,$.jsx)(Er,{label:`Timezone`,value:n.timezone,onChange:e=>o(`timezone`,e),mono:!0,hint:`IANA timezone, for example America/Los_Angeles.`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:c,children:`Cron overlap`}),(0,$.jsxs)(`select`,{"aria-label":`Cron overlap`,className:l,value:n.overlap,onChange:e=>o(`overlap`,e.target.value),children:[(0,$.jsx)(`option`,{value:`skip`,children:`Skip occurrence`}),(0,$.jsx)(`option`,{value:`queue-one`,children:`Queue one follow-up`})]}),(0,$.jsx)(`div`,{className:Cr,children:`Applies only when a cron occurrence is due while a run is still open.`})]})]}):(0,$.jsx)(Er,{label:`Delay after terminal run (minutes)`,value:n.delayMinutes,onChange:e=>o(`delayMinutes`,e),mono:!0}),(0,$.jsx)(Tr,{title:`Execution`}),(0,$.jsx)(Er,{label:`Working directory`,value:n.workdir,onChange:e=>o(`workdir`,e),mono:!0,placeholder:`/Users/you/project`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:c,children:`Coding agent`}),(0,$.jsx)(`select`,{"aria-label":`Coding agent`,className:l,value:n.agent,onChange:e=>o(`agent`,e.target.value),children:xr.map(e=>(0,$.jsx)(`option`,{value:e,children:Sr[e]??e},e))})]}),(0,$.jsx)(Er,{label:`Model`,value:n.model,onChange:e=>o(`model`,e),placeholder:`default`,hint:`Optional. Empty uses the agent default.`}),(0,$.jsx)(Er,{label:`Reasoning effort`,value:n.reasoningEffort,onChange:e=>o(`reasoningEffort`,e),placeholder:`default`,hint:`Optional. Empty uses the agent default.`})]}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(Tr,{title:`Prompt`,hint:`Sent unchanged before Pievo appends the report contract.`}),(0,$.jsx)(Dr,{label:`User prompt`,value:n.prompt,onChange:e=>o(`prompt`,e),rows:10}),(0,$.jsx)(Tr,{title:`Status definitions`,hint:`All three definitions are required and are appended to every run.`}),(0,$.jsx)(Dr,{label:`keep`,value:n.keep,onChange:e=>o(`keep`,e),rows:2}),(0,$.jsx)(Dr,{label:`no-change`,value:n.noChange,onChange:e=>o(`noChange`,e),rows:2}),(0,$.jsx)(Dr,{label:`block`,value:n.block,onChange:e=>o(`block`,e),rows:2}),(0,$.jsx)(Tr,{title:`Artifacts`,hint:`Optional exact paths relative to the working directory. One path per line; globs are not supported.`}),(0,$.jsx)(Dr,{label:`Artifact paths`,value:n.artifacts,onChange:e=>o(`artifacts`,e),rows:6,mono:!0}),i&&(0,$.jsx)(`div`,{className:`mt-4 text-body text-accent`,children:i})]})]})}),kr={"claude-code":`Claude Code`,codex:`Codex`};function Ar({id:e}){let n=se(),[i,s]=(0,x.useState)(null),[c,l]=(0,x.useState)(null),[u,f]=(0,x.useState)(null),[ae,p]=(0,x.useState)(!1),[m,h]=(0,x.useState)(!1),[g,_]=(0,x.useState)(null),[pe,me]=(0,x.useState)(!1),[v,Te]=y(),[Ee,ke]=(0,x.useState)([]),Ae=(0,x.useRef)(null),S=(0,x.useRef)(!1),C=(0,x.useCallback)(async(t=!1)=>{try{let t=await ue({data:e});s(t),S.current=t.summary.deleteRequestedAt!=null,l(null)}catch(e){S.current?n({to:`/`}):t||l(String(e))}},[e]);(0,x.useEffect)(()=>{s(null),p(!1),me(!1),ke([]),C()},[e,C]);let je=!!i?.summary.running;(0,x.useEffect)(()=>{if(ae)return;let e=setInterval(()=>void C(!0),je||S.current?3e3:8e3);return()=>clearInterval(e)},[ae,je,C]);async function Me(){f(null),_(`run`);try{let t=await oe({data:e});if(t.error)return f(`Run failed: ${t.error}`);Te({label:t.coalesced?`Already queued`:`Queued`,hold:4e3}),await C()}finally{_(null)}}async function Ne(t){f(null),_(`lifecycle`);try{let r=t===`pause`?await ce({data:e}):t===`start`?await he({data:e}):t===`stop`?await le({data:e}):await fe({data:e});if(r.error)return f(`${t[0].toUpperCase()+t.slice(1)} failed: ${r.error}`);if(me(!1),r.deleted)return n({to:`/`});t===`delete`&&(S.current=!0),await C(),Te({label:t===`start`?`Started`:t===`pause`?`Paused`:t===`stop`?`Stop requested`:`Deleting`})}finally{_(null)}}async function w(){let t=Ae.current?.read();if(t){f(null),_(`save`);try{let n=await ge({data:{id:e,patch:t}});if(n.error)return f(`Save failed: ${n.error}`);p(!1),await C(),Te({label:`Saved`})}finally{_(null)}}}let T=(0,$.jsxs)(de,{to:`/`,className:`inline-flex items-center gap-1.5 text-meta font-medium text-secondary hover:text-display`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Loops`]});if(c)return(0,$.jsx)(Fr,{back:T,children:(0,$.jsx)(b,{title:`Couldn't load this loop.`,detail:c,onRetry:()=>void C()})});if(!i)return(0,$.jsx)(Fr,{back:T,children:(0,$.jsx)(ee,{})});let{loop:E,summary:D,runs:Pe}=i,Fe=Se(D),O=Fe===`deleting`,Ie=D.enabled&&!O,Le=!D.enabled&&!O,k=g!=null,Re=xe(i.machine.daemonProtocol),ze=!O&&!!D.running&&Re.supported,Be=i.machine.online,A=i.machine.presence===`asleep`,j=i.team&&!i.team.isActive?i.team:null;if(ae)return(0,$.jsxs)(Fr,{back:T,children:[(0,$.jsx)(Pr,{name:D.name,onBack:()=>p(!1)}),(0,$.jsxs)(`div`,{className:`mt-5 rounded-card border border-hairline bg-surface px-6 pb-6 pt-2 shadow-card`,children:[(0,$.jsx)(Or,{ref:Ae,initial:E}),(0,$.jsxs)(`div`,{className:`mt-7 border-t border-hairline pt-4`,children:[u&&(0,$.jsx)(ie,{message:u,onDismiss:()=>f(null),className:`mb-3`}),(0,$.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,$.jsx)(`button`,{className:re,disabled:g===`save`,onClick:()=>void w(),children:g===`save`?`Saving…`:`Save`}),(0,$.jsx)(`button`,{className:o,disabled:g===`save`,onClick:()=>p(!1),children:`Cancel`})]})]})]})]});let Ve=E.schedule.mode===`cron`?`${E.schedule.cron} · ${E.schedule.timezone} · overlap ${E.schedule.overlap}`:`continuous · ${E.schedule.delayMinutes}m after terminal`,He=E.model||`default`,Ue=E.reasoningEffort||`default`;return(0,$.jsxs)(Fr,{back:T,children:[(0,$.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-6 pb-5 pt-[22px] shadow-card`,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-4`,children:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,$.jsx)(`h1`,{className:`text-[28px] font-semibold leading-tight tracking-[-0.015em] text-display`,children:D.name}),(0,$.jsx)(ne,{tone:Fe===`stopping`?`running`:void 0,dot:Fe===`stopping`?`pulse`:void 0,children:be(i)}),D.queued&&Fe===`active`&&(0,$.jsx)(ne,{tone:`outline`,children:`Queued`}),(0,$.jsx)(ne,{tone:`outline`,children:kr[E.agent]}),j&&(0,$.jsx)(ne,{tone:`outline`,children:j.name})]}),(0,$.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-meta text-secondary`,children:[(0,$.jsx)(`span`,{className:`font-mono text-primary`,children:Ve}),(0,$.jsx)(`span`,{className:`text-wire`,children:`·`}),(0,$.jsxs)(`span`,{children:[`next `,a(D.nextRun)]}),D.nextRun&&D.enabled&&(0,$.jsxs)(`span`,{className:`text-disabled`,children:[`(`,r(D.nextRun),`)`]}),(0,$.jsx)(`span`,{className:`text-wire`,children:`·`}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full ${Be?`bg-rubik-green`:A?`bg-rubik-yellow`:`bg-disabled`}`}),i.machine.name||`machine`]})]})]})}),(0,$.jsxs)(`div`,{className:`mt-5 border-t border-hairline pt-4`,children:[j&&(0,$.jsx)(Mr,{team:j,onSwitch:()=>{we(j.id),n({to:`/t/$teamId`,params:{teamId:j.id}})}}),i.machine.needsUpdate&&(0,$.jsx)(Nr,{tone:`warn`,text:`Daemon update required · server requires v${i.machine.requiredDaemonVersion}; machine reports ${i.machine.daemonVersion?`v${i.machine.daemonVersion}`:`an unknown version`}.`,action:`Update daemon`,onAction:()=>h(!0)}),!Be&&(0,$.jsx)(Nr,{text:`Machine ${A?`seems asleep or offline`:`is offline`}; queued work starts when it reconnects.${i.machine.lastSeen?` Last seen ${t(i.machine.lastSeen)}.`:``}`,action:`Reconnect`,onAction:()=>h(!0)}),u&&(0,$.jsx)(ie,{message:u,onDismiss:()=>f(null),className:`mb-2.5`}),v&&(0,$.jsx)(`div`,{className:`mb-2.5`,children:(0,$.jsx)(De,{label:v.label,tone:v.tone,onUndo:v.undo})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`button`,{className:re,disabled:k||O,onClick:()=>void Me(),children:g===`run`?`Queuing…`:`Run once`}),(0,$.jsx)(`button`,{className:o,disabled:k||O,onClick:()=>p(!0),children:`Settings`}),(0,$.jsx)(`button`,{className:o,disabled:k||!Le,onClick:()=>void Ne(`start`),children:`Start`}),(0,$.jsx)(`button`,{className:o,disabled:k||!Ie,onClick:()=>void Ne(`pause`),children:`Pause`}),(0,$.jsx)(`button`,{className:te,disabled:k||!ze,title:D.running&&!Re.supported?Ce:D.running?void 0:`No run is currently running`,onClick:()=>void Ne(`stop`),children:`Stop`}),(0,$.jsx)(`button`,{className:te,disabled:k||O,onClick:()=>me(!0),children:O?`Deleting…`:`Delete`})]}),pe&&!O&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(Oe,{prompt:`Stop this loop and delete its server data?`,note:`This stops the loop and deletes server history and collected artifacts. Files in the working directory are not deleted. If the machine is unreachable, its local process may continue running.`,cta:`Delete`,danger:!0,busy:k,onConfirm:()=>void Ne(`delete`),onCancel:()=>me(!1)})})]})]}),(0,$.jsxs)(`section`,{className:`mt-6 min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,$.jsx)(`h2`,{className:`mb-4 border-b border-hairline pb-1.5 ${d}`,children:`Configuration`}),(0,$.jsxs)(`dl`,{className:`grid min-w-0 gap-x-6 gap-y-4 md:grid-cols-[180px_minmax(0,1fr)]`,children:[(0,$.jsx)(jr,{label:`Schedule`,children:(0,$.jsx)(`code`,{className:`break-all font-mono`,children:Ve})}),(0,$.jsx)(jr,{label:`Working directory`,children:(0,$.jsx)(`code`,{className:`break-all font-mono`,children:E.workdir})}),(0,$.jsx)(jr,{label:`Agent`,children:kr[E.agent]}),(0,$.jsxs)(jr,{label:`Model / effort`,children:[He,` / `,Ue]}),(0,$.jsx)(jr,{label:`Prompt`,children:(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans`,children:E.prompt})}),(0,$.jsx)(jr,{label:`Status definitions`,children:(0,$.jsxs)(`ul`,{className:`space-y-1`,children:[(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`b`,{children:`keep:`}),` `,E.statusDefinitions.keep]}),(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`b`,{children:`no-change:`}),` `,E.statusDefinitions.noChange]}),(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`b`,{children:`block:`}),` `,E.statusDefinitions.block]})]})}),(0,$.jsx)(jr,{label:`Artifact paths`,children:E.artifacts.length?(0,$.jsx)(`ul`,{className:`space-y-1`,children:E.artifacts.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(`code`,{className:`break-all font-mono`,children:e})},e))}):(0,$.jsx)(`span`,{className:`text-disabled`,children:`None`})})]})]}),(0,$.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,$.jsx)(br,{loopId:e,configuredPaths:E.artifacts,running:je}),(0,$.jsx)(Ir,{loopId:e,summary:D,runs:Pe,older:Ee,onPickRun:t=>n({to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:t.id}}),onMore:async()=>{let t=(Ee.length?ve(D.runs,Ee):D.runs)[0];if(!t)return 0;let n=await _e({data:{loopId:e,beforeTs:t.ts,limit:16}});return n.length&&ke(e=>ve(e,n)),n.length}})]}),(0,$.jsx)(ye,{open:m,onClose:()=>h(!1)})]})}function jr({label:e,children:t}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-label font-medium text-secondary`,children:e}),(0,$.jsx)(`dd`,{className:`min-w-0 text-body text-primary`,children:t})]})}function Mr({team:e,onSwitch:t}){return(0,$.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-3 rounded-control border border-hairline bg-raised px-4 py-2.5 text-meta text-secondary`,children:[(0,$.jsxs)(`span`,{children:[`Viewing a loop in `,e.name,` - not your active team.`]}),(0,$.jsx)(`button`,{onClick:t,className:`ml-auto font-medium text-interactive underline`,children:`Switch to this team`})]})}function Nr({text:e,action:t,onAction:n,tone:r}){return(0,$.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-3 rounded-control border px-4 py-2.5 text-meta ${r===`warn`?`border-warn/40 bg-warn/10`:`border-hairline bg-raised`}`,children:[(0,$.jsx)(`span`,{className:`text-secondary`,children:e}),(0,$.jsx)(`button`,{onClick:n,className:`ml-auto font-medium text-interactive underline`,children:t})]})}function Pr({name:e,onBack:t}){return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:t,className:s,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]}),(0,$.jsxs)(`h1`,{className:`mt-2.5 text-[24px] font-semibold text-display`,children:[`Settings · `,e]}),(0,$.jsx)(`p`,{className:`mt-1.5 text-meta text-secondary`,children:`Edit the stored schedule, execution settings, prompt, status definitions, and exact artifact paths.`})]})}function Fr({back:e,children:t}){return(0,$.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-10`,children:[(0,$.jsx)(`div`,{className:`mb-5`,children:e}),t]})}function Ir({loopId:t,summary:n,runs:r,older:i,onMore:a,onPickRun:o}){let s=(0,x.useMemo)(()=>i.length?ve(n.runs,i):n.runs,[n.runs,i]);return(0,$.jsxs)(`section`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-2.5 border-b border-hairline pb-1.5`,children:(0,$.jsxs)(`h2`,{className:d,children:[`Runs (`,n.runCount,`)`]})}),n.runCount===0?(0,$.jsx)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 py-10 text-center text-body text-disabled`,children:`Never run`}):(0,$.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 pb-4 pt-5 shadow-card`,children:[(0,$.jsx)(v,{loop:n,runs:s,total:n.runCount,onLoadMore:a,onPickRun:o}),(0,$.jsx)(`ul`,{className:`mt-5 max-h-[clamp(280px,46vh,520px)] divide-y divide-hairline overflow-y-auto border-t border-hairline`,children:r.map(n=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(de,{to:`/loops/$loopId/runs/$runId`,params:{loopId:t,runId:n.id},className:`flex items-start gap-2.5 py-2.5 hover:bg-raised`,children:[(0,$.jsx)(`span`,{className:`mt-1 inline-block size-2.5 shrink-0 rounded-[2px]`,style:{background:p(n)},title:g(n)}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-label text-secondary`,children:e(n.ts)}),(0,$.jsx)(`span`,{className:`font-mono text-caption text-disabled`,children:h(n.durationMs)})]}),(0,$.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-meta text-primary`,children:n.phase===`pending`?`Queued`:n.phase===`running`?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:f}),`Running`]}):n.error||n.message||g(n)})]})]})},n.id))})]})]})}function Lr(){let{loopId:e}=Te.useParams(),{auth:t}=Te.useLoaderData()??{auth:{enabled:!1}},{data:n,isPending:r}=pe();return t?.enabled&&!r&&!n?(0,$.jsx)(Ee,{callbackURL:`/loops/${e}`}):(0,$.jsx)(Ar,{id:e})}export{Lr as component};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{C as e,M as t,P as n,S as r,a as i,i as a,j as o,m as s,n as c,o as l,p as u,r as d,w as f,x as p}from"./ui-Do4gqMyP.js";import{E as m,g as h,h as g,j as _,s as v,y}from"./preload-helper-DsxECZIS.js";import"./lifecycleUi-C7dwHtbw.js";import{t as b}from"./index-CaS_SmDq.js";import{t as x}from"./SignIn-0Tjqs-Ma.js";import{r as S}from"./actionUi-DpwGIGpw.js";var C=n(t(),1);function w(e,t){return e.startsWith(`@@`)?{kind:`hunk`,text:e,gutter:``}:t?e.startsWith(`+`)?{kind:`add`,text:e.slice(1),gutter:`+`}:e.startsWith(`-`)?{kind:`del`,text:e.slice(1),gutter:`-`}:e.startsWith(` `)?{kind:`context`,text:e.slice(1),gutter:``}:{kind:`context`,text:e,gutter:``}:e.startsWith(`---`)||e.startsWith(`+++`)||e.startsWith(`diff `)||e.startsWith(`index `)||e.startsWith(`Index:`)||e.startsWith(`===`)?{kind:`meta`,text:e,gutter:``}:{kind:`context`,text:e,gutter:``}}function T(e){if(!e)return[];let t=e.endsWith(`
|
|
2
|
+
`)?e.slice(0,-1):e,n=!1;return t.split(`
|
|
3
|
+
`).map(e=>{let t=w(e,n);return t.kind===`hunk`&&(n=!0),t})}function E(e){let t=0,n=0;for(let r of e)r.kind===`add`?t++:r.kind===`del`&&n++;return{added:t,removed:n}}var D=o(),O={added:`Added`,modified:`Changed`,removed:`Removed`},k={added:`text-success`,modified:`text-secondary`,removed:`text-accent`};function A(e){return e==null||e===0?``:`${e>0?`+`:`−`}${f(e)}`}var j={add:`bg-[color:var(--color-diff-add-bg)] text-primary`,del:`bg-[color:var(--color-diff-del-bg)] text-primary`,hunk:`bg-[color:var(--color-diff-hunk-bg)] text-disabled`,meta:`text-disabled`,context:`text-secondary`},M={add:`text-success`,del:`text-accent`,hunk:`text-disabled`,meta:`text-disabled`,context:`text-disabled`};function N({lines:e}){return(0,D.jsx)(`div`,{className:`min-w-0 max-h-[420px] overflow-auto border-t border-hairline bg-raised font-mono text-label leading-[1.55]`,children:(0,D.jsx)(`div`,{className:`min-w-max`,children:e.map((e,t)=>(0,D.jsxs)(`div`,{className:`flex ${j[e.kind]}`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`w-6 shrink-0 select-none pl-2.5 text-center ${M[e.kind]}`,children:e.gutter}),(0,D.jsx)(`span`,{className:`whitespace-pre pr-4`,children:e.text||`\xA0`})]},t))})})}function P({f:e,lines:t}){let n=A(e.sizeDelta),r=t?E(t):null;return(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2.5 gap-y-1 text-meta`,children:[(0,D.jsx)(`span`,{className:`shrink-0 text-caption font-medium ${k[e.status]}`,children:O[e.status]}),(0,D.jsx)(`span`,{className:`min-w-0 break-all font-mono text-primary`,children:e.path}),r&&(r.added>0||r.removed>0)&&(0,D.jsxs)(`span`,{className:`shrink-0 font-mono text-caption`,children:[r.added>0&&(0,D.jsxs)(`span`,{className:`text-success`,children:[`+`,r.added]}),r.added>0&&r.removed>0&&` `,r.removed>0&&(0,D.jsxs)(`span`,{className:`text-accent`,children:[`−`,r.removed]})]}),n&&(0,D.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-disabled`,children:n}),e.binary&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Binary`}),e.tooLarge&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Too large to diff`})]})}var F=40;function I({files:e}){return(0,D.jsx)(`div`,{className:`space-y-1.5`,children:e.map(e=>{if(!e.diff)return(0,D.jsx)(`div`,{className:`rounded-control border border-hairline bg-surface px-3.5 py-2`,children:(0,D.jsx)(P,{f:e,lines:null})},e.path);let t=T(e.diff);return(0,D.jsxs)(`details`,{open:t.length<=F,className:`group min-w-0 overflow-hidden rounded-control border border-hairline bg-surface`,children:[(0,D.jsxs)(`summary`,{className:`flex cursor-pointer select-none items-center gap-2 px-3.5 py-2 marker:content-['']`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled transition-transform group-open:rotate-90`,children:`▸`}),(0,D.jsx)(P,{f:e,lines:t})]}),(0,D.jsx)(N,{lines:t})]},e.path)})})}function L({label:e,count:t,children:n}){return(0,D.jsxs)(`section`,{className:`min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,D.jsxs)(`div`,{className:`mb-3.5 border-b border-hairline pb-1.5 ${s}`,children:[e,t!=null&&(0,D.jsxs)(`span`,{className:`text-disabled`,children:[` (`,t,`)`]})]}),n]})}function R({k:e,children:t}){return(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`div`,{className:`mb-0.5 text-label font-medium text-secondary`,children:e}),(0,D.jsx)(`div`,{className:`min-w-0 text-body text-primary`,children:t})]})}function z(e){return!e||e.inputTokens===void 0&&e.outputTokens===void 0?null:(e.inputTokens??0)+(e.outputTokens??0)}function B({run:e}){let[t,n]=(0,C.useState)(null);return(0,C.useEffect)(()=>{if(e.phase===`pending`||e.phase===`running`)return;let t=!0;return h({data:{runId:e.id}}).then(e=>t&&n(e)).catch(()=>t&&n({hasSnapshot:!1,files:[]})),()=>{t=!1}},[e.id,e.phase]),e.phase===`pending`||e.phase===`running`?(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`File changes appear once the run finishes.`})}):t?t.hasSnapshot?(0,D.jsx)(L,{label:`Changes`,count:t.files.length,children:t.files.length===0?(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`No files changed since the previous run.`}):(0,D.jsx)(I,{files:t.files})}):(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`No file snapshot was recorded for this run.`})}):(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(c,{})})}function V({run:e}){let t=p(Math.max(0,Date.now()-Date.parse(e.ts)));return(0,D.jsx)(L,{label:`Activity`,children:(0,D.jsxs)(`div`,{className:`flex items-center gap-2.5 text-body text-secondary`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:u}),(0,D.jsxs)(`span`,{children:[`Run in progress`,t?` for ${t}`:``,`.`]})]})})}function H({id:e}){let[t,n]=(0,C.useState)(!1);return(0,D.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1200)},title:`Copy session id`,className:`inline-flex max-w-full cursor-pointer items-center gap-1.5 border-none bg-transparent p-0 text-left font-mono text-label text-secondary transition-colors hover:text-display`,children:[(0,D.jsx)(`span`,{className:`truncate`,children:e}),(0,D.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled`,children:t?`✓ copied`:`copy`})]})}var U=64;function W({loopId:t,runId:n}){let[o,s]=(0,C.useState)(null),[u,f]=(0,C.useState)(null),[h,v]=(0,C.useState)(!1),[b,x]=(0,C.useState)(null),w=(0,C.useCallback)(async()=>{try{s(await g({data:t})),x(null)}catch(e){x(String(e))}},[t]),T=(0,C.useCallback)(async()=>{try{s(await g({data:t}))}catch{}},[t]);(0,C.useEffect)(()=>{s(null),f(null),v(!1),x(null),w()},[t,n,w]);let E=o?.runs.find(e=>e.id===n)??u,O=z(E?.usage??null);(0,C.useEffect)(()=>{if(!o||E||h)return;let e=!0;return(async()=>{try{let r=o.runs.length?o.runs[o.runs.length-1].ts:new Date().toISOString();for(let i=0;i<U&&e;i++){let i=await y({data:{loopId:t,beforeTs:r,limit:100}});if(!i.length)break;let a=i.find(e=>e.id===n);if(a){e&&f(a);return}r=i[0].ts}}finally{e&&v(!0)}})(),()=>{e=!1}},[o,E,h,t,n]);let k=!!E&&(E.phase===`pending`||E.phase===`running`||!!E.reconciliation);(0,C.useEffect)(()=>{if(!k)return;let e=setInterval(()=>void T(),3e3);return()=>clearInterval(e)},[k,T]);async function A(){if(!E||!confirm(`Stop this run? If it is running, Pievo will ask the daemon to terminate it.`))return;let e=await m({data:E.id});if(e?.error){alert(`Stop failed: ${e.error}`);return}await w()}if(b)return(0,D.jsx)(S,{title:`Couldn't load this run.`,detail:b,onRetry:()=>void w()});if(!o||!E&&!h)return(0,D.jsx)(c,{});if(!E)return(0,D.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-6 py-10 text-center shadow-card`,children:[(0,D.jsx)(`div`,{className:`text-[14px] text-secondary`,children:`This run is no longer available.`}),(0,D.jsx)(_,{to:`/loops/$loopId`,params:{loopId:t},className:`mt-3 inline-block text-label font-medium text-interactive underline underline-offset-2 hover:text-display`,children:`← Back to the loop`})]});let j=o.summary.name;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-6 pb-5 pt-[22px] shadow-card`,children:[(0,D.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-4`,children:(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,D.jsxs)(`h1`,{className:`text-[26px] font-medium leading-tight tracking-tight text-display`,children:[`Run · `,j]}),(0,D.jsx)(a,{run:E,colorText:!0})]}),(0,D.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-x-2.5 gap-y-1.5 text-meta text-secondary`,children:[(0,D.jsx)(`span`,{className:`text-primary`,children:r(E.ts)}),(0,D.jsx)(`span`,{className:`text-wire`,children:`·`}),E.durationMs!=null&&(0,D.jsx)(d,{tone:`ink`,children:p(E.durationMs)}),(0,D.jsx)(`code`,{className:`font-mono text-disabled`,children:E.id})]})]})}),(0,D.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2.5 border-t border-hairline pt-4`,children:[(0,D.jsx)(_,{to:`/loops/$loopId`,params:{loopId:t},className:i,children:`View the whole loop →`}),(E.phase===`pending`||E.phase===`running`)&&(0,D.jsx)(`button`,{type:`button`,onClick:A,className:l,disabled:E.phase===`running`&&o.machine.daemonProtocol!==4,title:E.phase===`running`&&o.machine.daemonProtocol!==4?"Daemon upgrade required to stop a running process. Run `npm install -g @kky42/pievo@latest`, then `pievo daemon restart`.":void 0,children:`Stop run`})]})]}),(0,D.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[E.phase===`pending`?(0,D.jsx)(L,{label:`Activity`,children:(0,D.jsx)(`div`,{className:`text-body text-secondary`,children:`Queued; it starts when this loop is free and the machine polls.`})}):E.phase===`running`?(0,D.jsx)(V,{run:E}):E.reconciliation?(0,D.jsx)(L,{label:`Recovery`,children:(0,D.jsx)(`div`,{className:`text-body text-secondary`,children:E.reconciliation===`blocking`?o.machine.presence===`online`?`The machine is online and checking an interrupted run. Queued work starts automatically after recovery.`:`Waiting for the machine to reconnect and check an interrupted run. Queued work starts automatically; no action is required.`:`This interrupted run no longer blocks queued work. Pievo will still accept its saved report if it arrives.`})}):null,E.reportIncident&&(0,D.jsx)(L,{label:`Terminal report rejected`,children:(0,D.jsxs)(`div`,{className:`space-y-3 text-body text-primary`,children:[(0,D.jsx)(`div`,{className:`font-medium`,children:E.reportIncident.code}),(0,D.jsx)(`div`,{className:`break-words text-secondary`,children:E.reportIncident.reason}),(0,D.jsxs)(`dl`,{className:`grid min-w-0 grid-cols-[max-content_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-label`,children:[(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Fault domain`}),(0,D.jsx)(`dd`,{children:E.reportIncident.faultDomain}),(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Recommended action`}),(0,D.jsx)(`dd`,{className:`break-words`,children:E.reportIncident.recommendedAction}),(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Report ID`}),(0,D.jsx)(`dd`,{className:`break-all font-mono`,children:E.reportIncident.reportId})]})]})}),E.message&&(0,D.jsx)(L,{label:`Report`,children:(0,D.jsx)(`div`,{className:`whitespace-pre-wrap break-words rounded-control border border-hairline bg-raised px-4 py-3.5 text-body leading-relaxed text-primary`,children:E.message})}),(0,D.jsx)(B,{run:E}),E.finalText&&(0,D.jsx)(L,{label:`Final output`,children:(0,D.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body text-primary`,children:E.finalText})})]}),(0,D.jsx)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:(0,D.jsx)(L,{label:`Details`,children:(0,D.jsxs)(`div`,{className:`space-y-3.5`,children:[E.status&&(0,D.jsx)(R,{k:`Status`,children:E.status}),E.durationMs!=null&&(0,D.jsx)(R,{k:`Duration`,children:p(E.durationMs)}),E.exitCode!=null&&(0,D.jsx)(R,{k:`Exit code`,children:E.exitCode}),O!=null&&(0,D.jsx)(R,{k:`Token usage`,children:(0,D.jsxs)(`span`,{className:`text-disabled`,children:[e(O),` tokens`]})}),E.error&&(0,D.jsx)(R,{k:`Error`,children:(0,D.jsx)(`span`,{className:`break-words`,style:{color:`var(--color-run-error)`},children:E.error})}),E.sessionId&&(0,D.jsx)(R,{k:`Session`,children:(0,D.jsx)(H,{id:E.sessionId})})]})})})]})]})}function G(){let{loopId:e,runId:t}=b.useParams(),{auth:n}=b.useLoaderData()??{auth:{enabled:!1}},{data:r,isPending:i}=v();return(0,D.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-10`,children:[(0,D.jsx)(`div`,{className:`mb-5`,children:(0,D.jsxs)(_,{to:`/loops/$loopId`,params:{loopId:e},className:`inline-flex items-center gap-1.5 text-label font-medium text-secondary transition-colors hover:text-display`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]})}),n?.enabled&&!i&&!r?(0,D.jsx)(x,{callbackURL:`/loops/${e}/runs/${t}`}):(0,D.jsx)(W,{loopId:e,runId:t})]})}export{G as component};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{M as e,N as t,P as n,j as r,k as i}from"./ui-Do4gqMyP.js";var a=t((t=>{var n=e();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,t.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},t.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},t.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},t.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},t.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},t.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},t.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},t.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},t.requestFormReset=function(e){a.d.r(e)},t.unstable_batchedUpdates=function(e,t){return e(t)},t.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},t.useFormStatus=function(){return c.H.useHostTransitionStatus()},t.version=`19.2.7`})),o=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=a()})),s=`__TSS_CONTEXT`,c=Symbol.for(`TSS_SERVER_FUNCTION`),l=Symbol.for(`TSS_SERVER_FUNCTION_FACTORY`),u=`application/x-tss-framed`,d={JSON:0,CHUNK:1,END:2,ERROR:3};`${u}`;var f=/;\s*v=(\d+)/;function p(e){let t=e.match(f);return t?parseInt(t[1],10):void 0}function m(e){let t=p(e);if(t!==void 0&&t!==1)throw Error(`Incompatible framed protocol version: server=${t}, client=1. Please ensure client and server are using compatible versions.`)}var h=()=>window.__TSS_START_OPTIONS__;function g(e){return e[e.length-1]}function _(e){return typeof e==`function`}function v(e,t){return _(e)?e(t):e}var y=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;function ee(e){for(let t in e)if(y.call(e,t))return!0;return!1}var te=()=>Object.create(null),ne=(e,t)=>re(e,t,te);function re(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=se(e)&&se(i);if(!a&&!(ae(e)&&ae(i)))return i;let o=a?e:ie(e);if(!o)return i;let s=a?i:ie(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:y.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=re(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function ie(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!b.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!b.call(e,t))return!1;r.push(t)}return r}function ae(e){if(!oe(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!oe(n)||!n.hasOwnProperty(`isPrototypeOf`))}function oe(e){return Object.prototype.toString.call(e)===`[object Object]`}function se(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ce(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!ce(e[r],t[r],n))return!1;return!0}if(ae(e)&&ae(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!ce(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!ce(e[o],t[o],n)))return!1;return i===a}return!1}function le(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function ue(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}function de(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function fe(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function pe(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return fe(t)}var me=[`http:`,`https:`,`mailto:`,`tel:`];function he(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}var ge={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},_e=/[&><\u2028\u2029]/g;function ve(e){return e.replace(_e,e=>ge[e])}function ye(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=pe(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=pe(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function be(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function xe(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function x(){throw Error(`Invariant failed`)}function S(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var C=4,Se=5;function Ce(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function we(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=Ce(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function w(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=we(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=D(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=D(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Ee(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Ee(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=Ee(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=D(n.fullPath??n.from);e.kind=Se,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=D(n.fullPath??n.from);e.kind=C,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)w(e,t,r,s,i,a,o)}function Te(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function E(e){if(e.pathless)for(let t of e.pathless)E(t);if(e.static)for(let t of e.static.values())E(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())E(t);if(e.dynamic?.length){e.dynamic.sort(Te);for(let t of e.dynamic)E(t)}if(e.optional?.length){e.optional.sort(Te);for(let t of e.optional)E(t)}if(e.wildcard?.length){e.wildcard.sort(Te);for(let t of e.wildcard)E(t)}}function D(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Ee(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function De(e,t){let n=D(`/`),r=new Uint16Array(6);for(let t of e)w(!1,r,t,1,n,0);E(n),t.masksTree=n,t.flatCache=S(1e3)}function Oe(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=k(e,t.masksTree);return t.flatCache.set(e,r),r}function ke(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=D(`/`),w(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),k(r,o,n)}function Ae(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=k(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Ne(a.route)),t.matchCache.set(r,a),a}function O(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function je(e,t=!1,n){let r=D(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return w(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&x(),a[e.id]=e,s!==0&&e.path){let t=O(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),E(r),{processedTree:{segmentTree:r,singleCache:S(1e3),matchCache:S(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function k(e,t,n=!1){let r=e.split(`/`),i=Fe(e,r,t,n);if(!i)return null;let[a]=Me(e,r,i);return{route:i.node.route,rawParams:a}}function Me(e,t,n){let r=Pe(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===C)break;if(u.kind===Se){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function Ne(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Pe(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Fe(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!g(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!ze(l,n))continue;if(i.parse){if(!Re(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==C&&ze(c,n)&&(c=n);let v=u===o;if(v&&(i.route&&(!a||i.kind===C||i.kind===2)&&ze(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[u],b;if(v&&i.index){let n={node:i.index,index:u,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(Re(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&Le(p,o))return n;ze(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:u,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:u+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+Ie(o,u),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,depth:f+1,statics:p,dynamics:m+Ie(o,u),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+Ie(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+Ie(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:u,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function Ie(e,t){return 2**(e-t-1)}function Le(e,t){return e===2**(t-1)-1}function Re(e,t,n){let r,i;try{[r,i]=Me(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function ze(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===C)>(e.node.kind===C)||t.node.kind===C==(e.node.kind===C)&&t.depth>e.depth))):!0}function Be(e){return Ve(e.filter(e=>e!==void 0).join(`/`))}function Ve(e){return e.replace(/\/{2,}/g,`/`)}function He(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function Ue(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function We(e){return Ue(He(e))}function Ge(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Ke(e,t,n){return Ge(e,n)===Ge(t,n)}function qe({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&g(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(g(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=Ve(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function Je(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function Ye(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>Ze(e,n)).join(`/`):Ze(r,n):r}function Xe({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=we(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=Ye(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Ye(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Ye(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function Ze(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function Qe(e){return e?.isNotFound===!0}function $e(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function et(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function tt(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=et(r):Array.isArray(t)?t.push(et(r)):n[e]=[t,et(r)]}return n}var nt=`__root__`;function rt(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function it(e){return e instanceof Response&&!!e.options}function at(e){if(typeof e==`object`&&e&&e.isSerializedRedirect)return rt(e)}var ot=`Error preloading route! ☝️`,st=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=nt:this.parentRoute||x();let r=n?nt:t?.path;r&&r!==`/`&&(r=He(r));let i=t?.id||r,a=n?nt:Be([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=Be([`/`,a]));let o=a===`__root__`?`/`:Be([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=Ue(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>rt({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},ct=class extends st{constructor(e){super(e)}},lt=(e=>(e[e.AggregateError=1]=`AggregateError`,e[e.ArrowFunction=2]=`ArrowFunction`,e[e.ErrorPrototypeStack=4]=`ErrorPrototypeStack`,e[e.ObjectAssign=8]=`ObjectAssign`,e[e.BigIntTypedArray=16]=`BigIntTypedArray`,e[e.RegExp=32]=`RegExp`,e))(lt||{}),A=Symbol.asyncIterator,ut=Symbol.hasInstance,dt=Symbol.isConcatSpreadable,j=Symbol.iterator,ft=Symbol.match,pt=Symbol.matchAll,mt=Symbol.replace,ht=Symbol.search,gt=Symbol.species,_t=Symbol.split,vt=Symbol.toPrimitive,yt=Symbol.toStringTag,bt=Symbol.unscopables,xt={[A]:0,[ut]:1,[dt]:2,[j]:3,[ft]:4,[pt]:5,[mt]:6,[ht]:7,[gt]:8,[_t]:9,[vt]:10,[yt]:11,[bt]:12},St={0:A,1:ut,2:dt,3:j,4:ft,5:pt,6:mt,7:ht,8:gt,9:_t,10:vt,11:yt,12:bt},M=void 0,Ct={2:!0,3:!1,1:M,0:null,4:-0,5:1/0,6:-1/0,7:NaN},wt={0:`Error`,1:`EvalError`,2:`RangeError`,3:`ReferenceError`,4:`SyntaxError`,5:`TypeError`,6:`URIError`},Tt={0:Error,1:EvalError,2:RangeError,3:ReferenceError,4:SyntaxError,5:TypeError,6:URIError};function N(e,t,n,r,i,a,o,s,c,l,u,d){return{t:e,i:t,s:n,c:r,m:i,p:a,e:o,a:s,f:c,b:l,o:u,l:d}}function P(e){return N(2,M,e,M,M,M,M,M,M,M,M,M)}var Et=P(2),Dt=P(3),Ot=P(1),kt=P(0),At=P(4),jt=P(5),Mt=P(6),Nt=P(7);function Pt(e){switch(e){case`"`:return`\\"`;case`\\`:return`\\\\`;case`
|
|
2
|
+
`:return`\\n`;case`\r`:return`\\r`;case`\b`:return`\\b`;case` `:return`\\t`;case`\f`:return`\\f`;case`<`:return`\\x3C`;case`\u2028`:return`\\u2028`;case`\u2029`:return`\\u2029`;default:return M}}function F(e){let t=``,n=0,r;for(let i=0,a=e.length;i<a;i++)r=Pt(e[i]),r&&(t+=e.slice(n,i)+r,n=i+1);return n===0?t=e:t+=e.slice(n),t}function Ft(e){switch(e){case`\\\\`:return`\\`;case`\\"`:return`"`;case`\\n`:return`
|
|
3
|
+
`;case`\\r`:return`\r`;case`\\b`:return`\b`;case`\\t`:return` `;case`\\f`:return`\f`;case`\\x3C`:return`<`;case`\\u2028`:return`\u2028`;case`\\u2029`:return`\u2029`;default:return e}}function I(e){return e.replace(/(\\\\|\\"|\\n|\\r|\\b|\\t|\\f|\\u2028|\\u2029|\\x3C)/g,Ft)}var It=`__SEROVAL_REFS__`,Lt=new Map,Rt=new Map;function zt(e){return Lt.has(e)}function Bt(e){return Rt.has(e)}function Vt(e){if(zt(e))return Lt.get(e);throw new kn(e)}function Ht(e){if(Bt(e))return Rt.get(e);throw new An(e)}typeof globalThis<`u`?Object.defineProperty(globalThis,It,{value:Rt,configurable:!0,writable:!1,enumerable:!1}):typeof window<`u`?Object.defineProperty(window,It,{value:Rt,configurable:!0,writable:!1,enumerable:!1}):typeof self<`u`?Object.defineProperty(self,It,{value:Rt,configurable:!0,writable:!1,enumerable:!1}):typeof global<`u`&&Object.defineProperty(global,It,{value:Rt,configurable:!0,writable:!1,enumerable:!1});function Ut(e){return e instanceof EvalError?1:e instanceof RangeError?2:e instanceof ReferenceError?3:e instanceof SyntaxError?4:e instanceof TypeError?5:e instanceof URIError?6:0}function Wt(e){let t=wt[Ut(e)];return e.name===t?e.constructor.name===t?{}:{name:e.constructor.name}:{name:e.name}}function Gt(e,t){let n=Wt(e),r=Object.getOwnPropertyNames(e);for(let i=0,a=r.length,o;i<a;i++)o=r[i],o!==`name`&&o!==`message`&&(o===`stack`?t&4&&(n||={},n[o]=e[o]):(n||={},n[o]=e[o]));return n}function Kt(e){return Object.isFrozen(e)?3:Object.isSealed(e)?2:+!Object.isExtensible(e)}function qt(e){switch(e){case 1/0:return jt;case-1/0:return Mt}return e===e?Object.is(e,-0)?At:N(0,M,e,M,M,M,M,M,M,M,M,M):Nt}function Jt(e){return N(1,M,F(e),M,M,M,M,M,M,M,M,M)}function Yt(e){return N(3,M,``+e,M,M,M,M,M,M,M,M,M)}function Xt(e){return N(4,e,M,M,M,M,M,M,M,M,M,M)}function Zt(e,t){let n=t.valueOf();return N(5,e,n===n?t.toISOString():``,M,M,M,M,M,M,M,M,M)}function Qt(e,t){return N(6,e,M,F(t.source),t.flags,M,M,M,M,M,M,M)}function $t(e,t){return N(17,e,xt[t],M,M,M,M,M,M,M,M,M)}function en(e,t){return N(18,e,F(Vt(t)),M,M,M,M,M,M,M,M,M)}function tn(e,t,n){return N(25,e,n,F(t),M,M,M,M,M,M,M,M)}function nn(e,t,n){return N(9,e,M,M,M,M,M,n,M,M,Kt(t),M)}function rn(e,t){return N(21,e,M,M,M,M,M,M,t,M,M,M)}function an(e,t,n){return N(15,e,M,t.constructor.name,M,M,M,M,n,t.byteOffset,M,t.length)}function on(e,t,n){return N(16,e,M,t.constructor.name,M,M,M,M,n,t.byteOffset,M,t.byteLength)}function sn(e,t,n){return N(20,e,M,M,M,M,M,M,n,t.byteOffset,M,t.byteLength)}function cn(e,t,n){return N(13,e,Ut(t),M,F(t.message),n,M,M,M,M,M,M)}function ln(e,t,n){return N(14,e,Ut(t),M,F(t.message),n,M,M,M,M,M,M)}function un(e,t){return N(7,e,M,M,M,M,M,t,M,M,M,M)}function dn(e,t){return N(28,M,M,M,M,M,M,[e,t],M,M,M,M)}function fn(e,t){return N(30,M,M,M,M,M,M,[e,t],M,M,M,M)}function pn(e,t,n){return N(31,e,M,M,M,M,M,n,t,M,M,M)}function mn(e,t){return N(32,e,M,M,M,M,M,M,t,M,M,M)}function hn(e,t){return N(33,e,M,M,M,M,M,M,t,M,M,M)}function gn(e,t){return N(34,e,M,M,M,M,M,M,t,M,M,M)}function _n(e,t,n,r){return N(35,e,n,M,M,M,M,t,M,M,M,r)}var{toString:vn}=Object.prototype,yn={parsing:1,serialization:2,deserialization:3};function bn(e){return`Seroval Error (step: ${yn[e]})`}var xn=(e,t)=>bn(e),Sn=class extends Error{constructor(e,t){super(xn(e,t)),this.cause=t}},Cn=class extends Sn{constructor(e){super(`parsing`,e)}},wn=class extends Sn{constructor(e){super(`deserialization`,e)}};function L(e){return`Seroval Error (specific: ${e})`}var Tn=class extends Error{constructor(e){super(L(1)),this.value=e}},En=class extends Error{constructor(e){super(L(2))}},Dn=class extends Error{constructor(e){super(L(3))}},On=class extends Error{constructor(e){super(L(4))}},kn=class extends Error{constructor(e){super(L(5)),this.value=e}},An=class extends Error{constructor(e){super(L(6))}},jn=class extends Error{constructor(e){super(L(7))}},R=class extends Error{constructor(e){super(L(8))}},Mn=class extends Error{constructor(e){super(L(9))}},Nn=class{constructor(e,t){this.value=e,this.replacement=t}},Pn=()=>{let e={p:0,s:0,f:0};return e.p=new Promise((t,n)=>{e.s=t,e.f=n}),e};Pn.toString(),((e,t)=>{e.s(t),e.p.s=1,e.p.v=t}).toString(),((e,t)=>{e.f(t),e.p.s=2,e.p.v=t}).toString();var Fn=()=>{let e=[],t=[],n=!0,r=!1,i=0,a=(e,n,r)=>{for(r=0;r<i;r++)t[r]&&t[r][n](e)},o=(t,i,a,o)=>{for(i=0,a=e.length;i<a;i++)o=e[i],!n&&i===a-1?t[r?`return`:`throw`](o):t.next(o)},s=(e,r)=>(n&&(r=i++,t[r]=e),o(e),()=>{n&&(t[r]=t[i],t[i--]=void 0)});return{__SEROVAL_STREAM__:!0,on:e=>s(e),next:t=>{n&&(e.push(t),a(t,`next`))},throw:i=>{n&&(e.push(i),a(i,`throw`),n=!1,r=!1,t.length=0)},return:i=>{n&&(e.push(i),a(i,`return`),n=!1,r=!0,t.length=0)}}};Fn.toString();var In=e=>t=>()=>{let n=0,r={[e]:()=>r,next:()=>{if(n>t.d)return{done:!0,value:void 0};let e=n++,r=t.v[e];if(e===t.t)throw r;return{done:e===t.d,value:r}}};return r};In.toString();var Ln=(e,t)=>n=>()=>{let r=0,i=-1,a=!1,o=[],s=[],c=(e=0,t=s.length)=>{for(;e<t;e++)s[e].s({done:!0,value:void 0})};n.on({next:e=>{let t=s.shift();t&&t.s({done:!1,value:e}),o.push(e)},throw:e=>{let t=s.shift();t&&t.f(e),c(),i=o.length,a=!0,o.push(e)},return:e=>{let t=s.shift();t&&t.s({done:!0,value:e}),c(),i=o.length,o.push(e)}});let l={[e]:()=>l,next:()=>{if(i===-1){let e=r++;if(e>=o.length){let e=t();return s.push(e),e.p}return{done:!1,value:o[e]}}if(r>i)return{done:!0,value:void 0};let e=r++,n=o[e];if(e!==i)return{done:!1,value:n};if(a)throw n;return{done:!0,value:n}}};return l};Ln.toString();var Rn=e=>{let t=atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r.buffer};Rn.toString();function zn(e){return`__SEROVAL_SEQUENCE__`in e}function Bn(e,t,n){return{__SEROVAL_SEQUENCE__:!0,v:e,t,d:n}}function Vn(e){let t=[],n=-1,r=-1,i=e[j]();for(;;)try{let e=i.next();if(t.push(e.value),e.done){r=t.length-1;break}}catch(e){n=t.length,t.push(e)}return Bn(t,n,r)}var Hn=In(j);function Un(e){return Hn(e)}var Wn={},Gn={},Kn={0:{},1:{},2:{},3:{},4:{},5:{}};function qn(e){return`__SEROVAL_STREAM__`in e}function z(){return Fn()}function Jn(e){let t=z(),n=e[A]();async function r(){try{let e=await n.next();e.done?t.return(e.value):(t.next(e.value),await r())}catch(e){t.throw(e)}}return r().catch(()=>{}),t}var Yn=Ln(A,Pn);function Xn(e){return Yn(e)}async function Zn(e){try{return[1,await e]}catch(e){return[0,e]}}function Qn(e,t){return{plugins:t.plugins,mode:e,marked:new Set,features:63^(t.disabledFeatures||0),refs:t.refs||new Map,depthLimit:t.depthLimit||1e3}}function $n(e,t){e.marked.add(t)}function er(e,t){let n=e.refs.size;return e.refs.set(t,n),n}function tr(e,t){let n=e.refs.get(t);return n==null?{type:0,value:er(e,t)}:($n(e,n),{type:1,value:Xt(n)})}function nr(e,t){let n=tr(e,t);return n.type===1?n:zt(t)?{type:2,value:en(n.value,t)}:n}function rr(e,t){let n=nr(e,t);if(n.type!==0)return n.value;if(t in xt)return $t(n.value,t);throw new Tn(t)}function ir(e,t){let n=tr(e,Kn[t]);return n.type===1?n.value:N(26,n.value,t,M,M,M,M,M,M,M,M,M)}function ar(e){let t=tr(e,Wn);return t.type===1?t.value:N(27,t.value,M,M,M,M,M,M,rr(e,j),M,M,M)}function or(e){let t=tr(e,Gn);return t.type===1?t.value:N(29,t.value,M,M,M,M,M,[ir(e,1),rr(e,A)],M,M,M,M)}function sr(e,t,n,r){return N(n?11:10,e,M,M,M,r,M,M,M,M,Kt(t),M)}function cr(e,t,n,r){return N(8,t,M,M,M,M,{k:n,v:r},M,ir(e,0),M,M,M)}function lr(e,t,n){let r=new Uint8Array(n),i=``;for(let e=0,t=r.length;e<t;e++)i+=String.fromCharCode(r[e]);return N(19,t,F(btoa(i)),M,M,M,M,M,ir(e,5),M,M,M)}function ur(e,t){return{base:Qn(e,t),child:void 0}}var dr=class{constructor(e,t){this._p=e,this.depth=t}parse(e){return B(this._p,this.depth,e)}};async function fr(e,t,n){let r=[];for(let i=0,a=n.length;i<a;i++)i in n?r[i]=await B(e,t,n[i]):r[i]=0;return r}async function pr(e,t,n,r){return nn(n,r,await fr(e,t,r))}async function mr(e,t,n){let r=Object.entries(n),i=[],a=[];for(let n=0,o=r.length;n<o;n++)i.push(F(r[n][0])),a.push(await B(e,t,r[n][1]));return j in n&&(i.push(rr(e.base,j)),a.push(dn(ar(e.base),await B(e,t,Vn(n))))),A in n&&(i.push(rr(e.base,A)),a.push(fn(or(e.base),await B(e,t,Jn(n))))),yt in n&&(i.push(rr(e.base,yt)),a.push(Jt(n[yt]))),dt in n&&(i.push(rr(e.base,dt)),a.push(n[dt]?Et:Dt)),{k:i,v:a}}async function hr(e,t,n,r,i){return sr(n,r,i,await mr(e,t,r))}async function gr(e,t,n,r){return rn(n,await B(e,t,r.valueOf()))}async function _r(e,t,n,r){return an(n,r,await B(e,t,r.buffer))}async function vr(e,t,n,r){return on(n,r,await B(e,t,r.buffer))}async function yr(e,t,n,r){return sn(n,r,await B(e,t,r.buffer))}async function br(e,t,n,r){let i=Gt(r,e.base.features);return cn(n,r,i?await mr(e,t,i):M)}async function xr(e,t,n,r){let i=Gt(r,e.base.features);return ln(n,r,i?await mr(e,t,i):M)}async function Sr(e,t,n,r){let i=[],a=[];for(let[n,o]of r.entries())i.push(await B(e,t,n)),a.push(await B(e,t,o));return cr(e.base,n,i,a)}async function Cr(e,t,n,r){let i=[];for(let n of r.keys())i.push(await B(e,t,n));return un(n,i)}async function wr(e,t,n,r){let i=e.base.plugins;if(i)for(let a=0,o=i.length;a<o;a++){let o=i[a];if(o.parse.async&&o.test(r))return tn(n,o.tag,await o.parse.async(r,new dr(e,t),{id:n}))}return M}async function Tr(e,t,n,r){let[i,a]=await Zn(r);return N(12,n,i,M,M,M,M,M,await B(e,t,a),M,M,M)}function Er(e,t,n,r,i){let a=[],o=n.on({next:n=>{$n(this.base,t),B(this,e,n).then(e=>{a.push(mn(t,e))},e=>{i(e),o()})},throw:n=>{$n(this.base,t),B(this,e,n).then(e=>{a.push(hn(t,e)),r(a),o()},e=>{i(e),o()})},return:n=>{$n(this.base,t),B(this,e,n).then(e=>{a.push(gn(t,e)),r(a),o()},e=>{i(e),o()})}})}async function Dr(e,t,n,r){return pn(n,ir(e.base,4),await new Promise(Er.bind(e,t,n,r)))}async function Or(e,t,n,r){let i=[];for(let n=0,a=r.v.length;n<a;n++)i[n]=await B(e,t,r.v[n]);return _n(n,i,r.t,r.d)}async function kr(e,t,n,r){if(Array.isArray(r))return pr(e,t,n,r);if(qn(r))return Dr(e,t,n,r);if(zn(r))return Or(e,t,n,r);let i=r.constructor;if(i===Nn)return B(e,t,r.replacement);let a=await wr(e,t,n,r);if(a)return a;switch(i){case Object:return hr(e,t,n,r,!1);case M:return hr(e,t,n,r,!0);case Date:return Zt(n,r);case Error:case EvalError:case RangeError:case ReferenceError:case SyntaxError:case TypeError:case URIError:return br(e,t,n,r);case Number:case Boolean:case String:case BigInt:return gr(e,t,n,r);case ArrayBuffer:return lr(e.base,n,r);case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return _r(e,t,n,r);case DataView:return yr(e,t,n,r);case Map:return Sr(e,t,n,r);case Set:return Cr(e,t,n,r);default:break}if(i===Promise||r instanceof Promise)return Tr(e,t,n,r);let o=e.base.features;if(o&32&&i===RegExp)return Qt(n,r);if(o&16)switch(i){case BigInt64Array:case BigUint64Array:return vr(e,t,n,r);default:break}if(o&1&&typeof AggregateError<`u`&&(i===AggregateError||r instanceof AggregateError))return xr(e,t,n,r);if(r instanceof Error)return br(e,t,n,r);if(j in r||A in r)return hr(e,t,n,r,!!i);throw new Tn(r)}async function Ar(e,t,n){let r=nr(e.base,n);if(r.type!==0)return r.value;let i=await wr(e,t,r.value,n);if(i)return i;throw new Tn(n)}async function B(e,t,n){switch(typeof n){case`boolean`:return n?Et:Dt;case`undefined`:return Ot;case`string`:return Jt(n);case`number`:return qt(n);case`bigint`:return Yt(n);case`object`:if(n){let r=nr(e.base,n);return r.type===0?await kr(e,t+1,r.value,n):r.value}return kt;case`symbol`:return rr(e.base,n);case`function`:return Ar(e,t,n);default:throw new Tn(n)}}async function jr(e,t){try{return await B(e,0,t)}catch(e){throw e instanceof Cn?e:new Cn(e)}}var Mr=(e=>(e[e.Vanilla=1]=`Vanilla`,e[e.Cross=2]=`Cross`,e))(Mr||{});function V(e){return e}function Nr(e,t){for(let n=0,r=t.length;n<r;n++){let r=t[n];e.has(r)||(e.add(r),r.extends&&Nr(e,r.extends))}}function Pr(e){if(e){let t=new Set;return Nr(t,e),[...t]}}function Fr(e){switch(e){case`Int8Array`:return Int8Array;case`Int16Array`:return Int16Array;case`Int32Array`:return Int32Array;case`Uint8Array`:return Uint8Array;case`Uint16Array`:return Uint16Array;case`Uint32Array`:return Uint32Array;case`Uint8ClampedArray`:return Uint8ClampedArray;case`Float32Array`:return Float32Array;case`Float64Array`:return Float64Array;case`BigInt64Array`:return BigInt64Array;case`BigUint64Array`:return BigUint64Array;default:throw new jn(e)}}var Ir=1e6,Lr=1e4,Rr=2e4;function zr(e,t){switch(t){case 3:return Object.freeze(e);case 1:return Object.preventExtensions(e);case 2:return Object.seal(e);default:return e}}var Br=1e3;function Vr(e,t){let n=t.refs||new Map;return`types`in n||Object.assign(n,{types:new Map}),{mode:e,plugins:t.plugins,refs:n,features:t.features??63^(t.disabledFeatures||0),depthLimit:t.depthLimit||Br}}function Hr(e){return{mode:2,base:Vr(2,e),child:M}}var Ur=class{constructor(e,t){this._p=e,this.depth=t}deserialize(e){return U(this._p,this.depth,e)}};function Wr(e,t){if(t<0||!Number.isFinite(t)||!Number.isInteger(t))throw new R({t:4,i:t});if(e.refs.has(t))throw Error(`Conflicted ref id: `+t)}function Gr(e,t,n){return Wr(e.base,t),e.state.marked.has(t)&&e.base.refs.set(t,n),n}function Kr(e,t,n){return Wr(e.base,t),e.base.refs.set(t,n),n}function H(e,t,n){return e.mode===1?Gr(e,t,n):Kr(e,t,n)}function qr(e,t,n){if(Object.hasOwn(t,n))return t[n];throw new R(e)}function Jr(e,t){return H(e,t.i,Ht(I(t.s)))}function Yr(e,t,n){let r=n.a,i=r.length,a=H(e,n.i,Array(i));for(let n=0,o;n<i;n++)o=r[n],o&&(a[n]=U(e,t,o));return zr(a,n.o),a}function Xr(e){switch(e){case`constructor`:case`__proto__`:case`prototype`:case`__defineGetter__`:case`__defineSetter__`:case`__lookupGetter__`:case`__lookupSetter__`:return!1;default:return!0}}function Zr(e){switch(e){case A:case dt:case yt:case j:return!0;default:return!1}}function Qr(e,t,n){Xr(t)?e[t]=n:Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function $r(e,t,n,r,i){if(typeof r==`string`)Qr(n,I(r),U(e,t,i));else{let a=U(e,t,r);switch(typeof a){case`string`:Qr(n,a,U(e,t,i));break;case`symbol`:Zr(a)&&(n[a]=U(e,t,i));break;default:throw new R(r)}}}function ei(e,t,n){e.base.refs.types.set(t,n)}function ti(e,t,n,r){if(e.base.refs.types.get(n)!==r)throw new R(t)}function ni(e,t,n,r){let i=n.k;if(i.length>0)for(let a=0,o=n.v,s=i.length;a<s;a++)$r(e,t,r,i[a],o[a]);return r}function ri(e,t,n){let r=H(e,n.i,n.t===10?{}:Object.create(null));return ni(e,t,n.p,r),zr(r,n.o),r}function ii(e,t){return H(e,t.i,new Date(t.s))}function ai(e,t){if(e.base.features&32){let n=I(t.c);if(n.length>Rr)throw new R(t);return H(e,t.i,new RegExp(n,t.m))}throw new En(t)}function oi(e,t,n){let r=H(e,n.i,new Set);for(let i=0,a=n.a,o=a.length;i<o;i++)r.add(U(e,t,a[i]));return r}function si(e,t,n){let r=H(e,n.i,new Map);for(let i=0,a=n.e.k,o=n.e.v,s=a.length;i<s;i++)r.set(U(e,t,a[i]),U(e,t,o[i]));return r}function ci(e,t){if(t.s.length>Ir)throw new R(t);return H(e,t.i,Rn(I(t.s)))}function li(e,t,n){let r=Fr(n.c),i=U(e,t,n.f),a=n.b??0;if(a<0||a>i.byteLength)throw new R(n);return H(e,n.i,new r(i,a,n.l))}function ui(e,t,n){let r=U(e,t,n.f),i=n.b??0;if(i<0||i>r.byteLength)throw new R(n);return H(e,n.i,new DataView(r,i,n.l))}function di(e,t,n,r){if(n.p){let i=ni(e,t,n.p,{});Object.defineProperties(r,Object.getOwnPropertyDescriptors(i))}return r}function fi(e,t,n){return di(e,t,n,H(e,n.i,AggregateError([],I(n.m))))}function pi(e,t,n){let r=qr(n,Tt,n.s);return di(e,t,n,H(e,n.i,new r(I(n.m))))}function mi(e,t,n){let r=Pn(),i=H(e,n.i,r.p),a=U(e,t,n.f);return n.s?r.s(a):r.f(a),i}function hi(e,t,n){return H(e,n.i,Object(U(e,t,n.f)))}function gi(e,t,n){let r=e.base.plugins;if(r){let i=I(n.c);for(let a=0,o=r.length;a<o;a++){let o=r[a];if(o.tag===i)return H(e,n.i,o.deserialize(n.s,new Ur(e,t),{id:n.i}))}}throw new Dn(n.c)}function _i(e,t){let n=H(e,t.i,H(e,t.s,Pn()).p);return ei(e,t.s,22),n}function vi(e,t,n){let r=e.base.refs.get(n.i);if(r)return ti(e,n,n.i,22),r.s(U(e,t,n.a[1])),M;throw new On(`Promise`)}function yi(e,t,n){let r=e.base.refs.get(n.i);if(r)return ti(e,n,n.i,22),r.f(U(e,t,n.a[1])),M;throw new On(`Promise`)}function bi(e,t,n){return U(e,t,n.a[0]),Un(U(e,t,n.a[1]))}function xi(e,t,n){return U(e,t,n.a[0]),Xn(U(e,t,n.a[1]))}function Si(e,t,n){let r=H(e,n.i,z());ei(e,n.i,31);let i=n.a,a=i.length;if(a)for(let n=0;n<a;n++)U(e,t,i[n]);return r}function Ci(e,t,n){let r=e.base.refs.get(n.i);if(r)return ti(e,n,n.i,31),r.next(U(e,t,n.f)),M;throw new On(`Stream`)}function wi(e,t,n){let r=e.base.refs.get(n.i);if(r)return ti(e,n,n.i,31),r.throw(U(e,t,n.f)),M;throw new On(`Stream`)}function Ti(e,t,n){let r=e.base.refs.get(n.i);if(r)return ti(e,n,n.i,31),r.return(U(e,t,n.f)),M;throw new On(`Stream`)}function Ei(e,t,n){return U(e,t,n.f),M}function Di(e,t,n){return U(e,t,n.a[1]),M}function Oi(e,t,n){let r=H(e,n.i,Bn([],n.s,n.l));for(let i=0,a=n.a.length;i<a;i++)r.v[i]=U(e,t,n.a[i]);return r}function U(e,t,n){if(t>e.base.depthLimit)throw new Mn(e.base.depthLimit);switch(t+=1,n.t){case 2:return qr(n,Ct,n.s);case 0:return Number(n.s);case 1:return I(String(n.s));case 3:if(String(n.s).length>Lr)throw new R(n);return BigInt(n.s);case 4:return e.base.refs.get(n.i);case 18:return Jr(e,n);case 9:return Yr(e,t,n);case 10:case 11:return ri(e,t,n);case 5:return ii(e,n);case 6:return ai(e,n);case 7:return oi(e,t,n);case 8:return si(e,t,n);case 19:return ci(e,n);case 16:case 15:return li(e,t,n);case 20:return ui(e,t,n);case 14:return fi(e,t,n);case 13:return pi(e,t,n);case 12:return mi(e,t,n);case 17:return qr(n,St,n.s);case 21:return hi(e,t,n);case 25:return gi(e,t,n);case 22:return _i(e,n);case 23:return vi(e,t,n);case 24:return yi(e,t,n);case 28:return bi(e,t,n);case 30:return xi(e,t,n);case 31:return Si(e,t,n);case 32:return Ci(e,t,n);case 33:return wi(e,t,n);case 34:return Ti(e,t,n);case 27:return Ei(e,t,n);case 29:return Di(e,t,n);case 35:return Oi(e,t,n);default:throw new En(n)}}function ki(e,t){try{return U(e,0,t)}catch(e){throw new wn(e)}}var Ai=(()=>T).toString();/=>/.test(Ai);function ji(e,t){return ki(Hr({plugins:Pr(t.plugins),refs:t.refs,features:t.features,disabledFeatures:t.disabledFeatures,depthLimit:t.depthLimit}),e)}async function Mi(e,t={}){let n=ur(1,{plugins:Pr(t.plugins),disabledFeatures:t.disabledFeatures});return{t:await jr(n,e),f:n.base.features,m:Array.from(n.base.marked)}}function Ni(e){return e}function Pi(e){return V({tag:`$TSR/t/`+e.key,test:e.test,parse:{sync(t,n,r){return{v:n.parse(e.toSerializable(t))}},async async(t,n,r){return{v:await n.parse(e.toSerializable(t))}},stream(t,n,r){return{v:n.parse(e.toSerializable(t))}}},serialize:void 0,deserialize(t,n,r){return e.fromSerializable(n.deserialize(t.v))}})}var Fi=class{constructor(e,t){this.stream=e,this.hint=t?.hint??`binary`}},Ii=globalThis.Buffer,Li=!!Ii&&typeof Ii.from==`function`;function Ri(e){if(e.length===0)return``;if(Li)return Ii.from(e).toString(`base64`);let t=32768,n=[];for(let r=0;r<e.length;r+=t){let i=e.subarray(r,r+t);n.push(String.fromCharCode.apply(null,i))}return btoa(n.join(``))}function zi(e){if(e.length===0)return new Uint8Array;if(Li){let t=Ii.from(e,`base64`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var Bi=Object.create(null),Vi=Object.create(null),Hi=e=>new ReadableStream({start(t){e.on({next(e){try{t.enqueue(zi(e))}catch{}},throw(e){t.error(e)},return(){try{t.close()}catch{}}})}}),Ui=new TextEncoder,Wi=e=>new ReadableStream({start(t){e.on({next(e){try{typeof e==`string`?t.enqueue(Ui.encode(e)):t.enqueue(zi(e.$b64))}catch{}},throw(e){t.error(e)},return(){try{t.close()}catch{}}})}}),Gi=`(s=>new ReadableStream({start(c){s.on({next(b){try{const d=atob(b),a=new Uint8Array(d.length);for(let i=0;i<d.length;i++)a[i]=d.charCodeAt(i);c.enqueue(a)}catch(_){}},throw(e){c.error(e)},return(){try{c.close()}catch(_){}}})}}))`,Ki=`(s=>{const e=new TextEncoder();return new ReadableStream({start(c){s.on({next(v){try{if(typeof v==='string'){c.enqueue(e.encode(v))}else{const d=atob(v.$b64),a=new Uint8Array(d.length);for(let i=0;i<d.length;i++)a[i]=d.charCodeAt(i);c.enqueue(a)}}catch(_){}},throw(x){c.error(x)},return(){try{c.close()}catch(_){}}})}})})`;function qi(e){let t=z(),n=e.getReader();return(async()=>{try{for(;;){let{done:e,value:r}=await n.read();if(e){t.return(void 0);break}t.next(Ri(r))}}catch(e){t.throw(e)}finally{n.releaseLock()}})(),t}function Ji(e){let t=z(),n=e.getReader(),r=new TextDecoder(`utf-8`,{fatal:!0});return(async()=>{try{for(;;){let{done:e,value:i}=await n.read();if(e){try{let e=r.decode();e.length>0&&t.next(e)}catch{}t.return(void 0);break}try{let e=r.decode(i,{stream:!0});e.length>0&&t.next(e)}catch{t.next({$b64:Ri(i)})}}}catch(e){t.throw(e)}finally{n.releaseLock()}})(),t}var Yi=V({tag:`tss/RawStream`,extends:[V({tag:`tss/RawStreamFactory`,test(e){return e===Bi},parse:{sync(e,t,n){return{}},async async(e,t,n){return{}},stream(e,t,n){return{}}},serialize(e,t,n){return Gi},deserialize(e,t,n){return Bi}}),V({tag:`tss/RawStreamFactoryText`,test(e){return e===Vi},parse:{sync(e,t,n){return{}},async async(e,t,n){return{}},stream(e,t,n){return{}}},serialize(e,t,n){return Ki},deserialize(e,t,n){return Vi}})],test(e){return e instanceof Fi},parse:{sync(e,t,n){let r=e.hint===`text`?Vi:Bi;return{hint:t.parse(e.hint),factory:t.parse(r),stream:t.parse(z())}},async async(e,t,n){let r=e.hint===`text`?Vi:Bi,i=e.hint===`text`?Ji(e.stream):qi(e.stream);return{hint:await t.parse(e.hint),factory:await t.parse(r),stream:await t.parse(i)}},stream(e,t,n){let r=e.hint===`text`?Vi:Bi,i=e.hint===`text`?Ji(e.stream):qi(e.stream);return{hint:t.parse(e.hint),factory:t.parse(r),stream:t.parse(i)}}},serialize(e,t,n){return`(`+t.serialize(e.factory)+`)(`+t.serialize(e.stream)+`)`},deserialize(e,t,n){let r=t.deserialize(e.stream);return t.deserialize(e.hint)===`text`?Wi(r):Hi(r)}});function Xi(e){return V({tag:`tss/RawStream`,test:()=>!1,parse:{},serialize(){throw Error(`RawStreamDeserializePlugin.serialize should not be called. Client only deserializes.`)},deserialize(t,n,r){return e(typeof n?.deserialize==`function`?n.deserialize(t.streamId):t.streamId)}})}var Zi=V({tag:`$TSR/Error`,test(e){return e instanceof Error},parse:{sync(e,t){return{message:t.parse(e.message)}},async async(e,t){return{message:await t.parse(e.message)}},stream(e,t){return{message:t.parse(e.message)}}},serialize(e,t){return`new Error(`+t.serialize(e.message)+`)`},deserialize(e,t){return Error(t.deserialize(e.message))}}),W={},Qi=e=>new ReadableStream({start:t=>{e.on({next:e=>{try{t.enqueue(e)}catch{}},throw:e=>{t.error(e)},return:()=>{try{t.close()}catch{}}})}}),$i=V({tag:`seroval-plugins/web/ReadableStreamFactory`,test(e){return e===W},parse:{sync(){return W},async async(){return await Promise.resolve(W)},stream(){return W}},serialize(){return Qi.toString()},deserialize(){return W}});function ea(e){let t=z(),n=e.getReader();async function r(){try{let e=await n.read();e.done?t.return(e.value):(t.next(e.value),await r())}catch(e){t.throw(e)}}return r().catch(()=>{}),t}var ta=[Zi,Yi,V({tag:`seroval/plugins/web/ReadableStream`,extends:[$i],test(e){return typeof ReadableStream>`u`?!1:e instanceof ReadableStream},parse:{sync(e,t){return{factory:t.parse(W),stream:t.parse(z())}},async async(e,t){return{factory:await t.parse(W),stream:await t.parse(ea(e))}},stream(e,t){return{factory:t.parse(W),stream:t.parse(ea(e))}}},serialize(e,t){return`(`+t.serialize(e.factory)+`)(`+t.serialize(e.stream)+`)`},deserialize(e,t){return Qi(t.deserialize(e.stream))}})];function na(){return[...(h()?.serializationAdapters)?.map(Pi)??[],...ta]}var ra=new TextDecoder,ia=new Uint8Array,aa=16*1024*1024,oa=32*1024*1024,sa=1024,ca=1e5;function la(e){let t=new Map,n=new Map,r=new Set,i=!1,a=null,o=0,s,c=new ReadableStream({start(e){s=e},cancel(){i=!0;try{a?.cancel()}catch{}t.forEach(e=>{try{e.error(Error(`Framed response cancelled`))}catch{}}),t.clear(),n.clear(),r.clear()}});function l(e){let i=n.get(e);if(i)return i;if(r.has(e))return new ReadableStream({start(e){e.close()}});if(n.size>=sa)throw Error(`Too many raw streams in framed response (max ${sa})`);let a=new ReadableStream({start(n){t.set(e,n)},cancel(){r.add(e),t.delete(e),n.delete(e)}});return n.set(e,a),a}function u(e){return l(e),t.get(e)}return(async()=>{let n=e.getReader();a=n;let c=[],l=0;function f(){if(l<9)return null;let e=c[0];if(e.length>=9)return{type:e[0],streamId:(e[1]<<24|e[2]<<16|e[3]<<8|e[4])>>>0,length:(e[5]<<24|e[6]<<16|e[7]<<8|e[8])>>>0};let t=new Uint8Array(9),n=0,r=9;for(let e=0;e<c.length&&r>0;e++){let i=c[e],a=Math.min(i.length,r);t.set(i.subarray(0,a),n),n+=a,r-=a}return{type:t[0],streamId:(t[1]<<24|t[2]<<16|t[3]<<8|t[4])>>>0,length:(t[5]<<24|t[6]<<16|t[7]<<8|t[8])>>>0}}function p(e){if(e===0)return ia;let t=new Uint8Array(e),n=0,r=e;for(;r>0&&c.length>0;){let e=c[0];if(!e)break;let i=Math.min(e.length,r);t.set(e.subarray(0,i),n),n+=i,r-=i,i===e.length?c.shift():c[0]=e.subarray(i)}return l-=e,t}try{for(;;){let{done:e,value:a}=await n.read();if(i||e)break;if(a){if(l+a.length>oa)throw Error(`Framed response buffer exceeded ${oa} bytes`);for(c.push(a),l+=a.length;;){let e=f();if(!e)break;let{type:n,streamId:i,length:a}=e;if(n!==d.JSON&&n!==d.CHUNK&&n!==d.END&&n!==d.ERROR)throw Error(`Unknown frame type: ${n}`);if(n===d.JSON){if(i!==0)throw Error(`Invalid JSON frame streamId (expected 0)`)}else if(i===0)throw Error(`Invalid raw frame streamId (expected non-zero)`);if(a>aa)throw Error(`Frame payload too large: ${a} bytes (max ${aa})`);let c=9+a;if(l<c)break;if(++o>ca)throw Error(`Too many frames in framed response (max ${ca})`);p(9);let m=p(a);switch(n){case d.JSON:try{s.enqueue(ra.decode(m))}catch{}break;case d.CHUNK:{let e=u(i);e&&e.enqueue(m);break}case d.END:{let e=u(i);if(r.add(i),e){try{e.close()}catch{}t.delete(i)}break}case d.ERROR:{let e=u(i);if(r.add(i),e){let n=ra.decode(m);e.error(Error(n)),t.delete(i)}break}}}}}if(l!==0)throw Error(`Incomplete frame at end of framed response`);try{s.close()}catch{}t.forEach(e=>{try{e.close()}catch{}}),t.clear()}catch(e){try{s.error(e)}catch{}t.forEach(t=>{try{t.error(e)}catch{}}),t.clear()}finally{try{n.releaseLock()}catch{}a=null}})(),{getOrCreateStream:l,jsonChunks:c}}var ua=null;async function da(e){e.length>0&&await Promise.allSettled(e)}var fa=Object.prototype.hasOwnProperty;function pa(e){for(let t in e)if(fa.call(e,t))return!0;return!1}async function ma(e,t,n){ua||=na();let r=t[0],i=r.fetch??n,a=r.data instanceof FormData?`formData`:`payload`,o=r.headers?new Headers(r.headers):new Headers;if(o.set(`x-tsr-serverFn`,`true`),a===`payload`&&o.set(`accept`,`${u}, application/x-ndjson, application/json`),r.method===`GET`){if(a===`formData`)throw Error(`FormData is not supported with GET requests`);let t=await ha(r);if(t!==void 0){let n=$e({payload:t});e.includes(`?`)?e+=`&${n}`:e+=`?${n}`}}let s;if(r.method===`POST`){let e=await _a(r);e?.contentType&&o.set(`content-type`,e.contentType),s=e?.body}return await va(async()=>i(e,{method:r.method,headers:o,signal:r.signal,body:s}))}async function ha(e){let t=!1,n={};if(e.data!==void 0&&(t=!0,n.data=e.data),e.context&&pa(e.context)&&(t=!0,n.context=e.context),t)return ga(n)}async function ga(e){return JSON.stringify(await Promise.resolve(Mi(e,{plugins:ua})))}async function _a(e){if(e.data instanceof FormData){let t;return e.context&&pa(e.context)&&(t=await ga(e.context)),t!==void 0&&e.data.set(s,t),{body:e.data}}let t=await ha(e);if(t)return{body:t,contentType:`application/json`}}async function va(e){let t;try{t=await e()}catch(e){if(e instanceof Response)t=e;else throw console.log(e),e}if(t.headers.get(`x-tss-raw`)===`true`)return t;let n=t.headers.get(`content-type`);if(n||x(),t.headers.get(`x-tss-serialized`)){let e;if(n.includes(`application/x-tss-framed`)){if(m(n),!t.body)throw Error(`No response body for framed response`);let{getOrCreateStream:r,jsonChunks:i}=la(t.body),a=[Xi(r),...ua||[]],o=new Map;e=await ya({jsonStream:i,onMessage:e=>ji(e,{refs:o,plugins:a}),onError(e,t){console.error(e,t)}})}else if(n.includes(`application/json`)){let n=await t.json(),r=[];try{e=ji(n,{plugins:ua})}finally{}await da(r)}if(e||x(),e instanceof Error)throw e;return e}if(n.includes(`application/json`)){let e=await t.json(),n=at(e);if(n)throw n;if(Qe(e))throw e;return e}if(!t.ok)throw Error(await t.text());return t}async function ya({jsonStream:e,onMessage:t,onError:n}){let r=e.getReader(),{value:i,done:a}=await r.read();if(a||!i)throw Error(`Stream ended before first object`);let o=JSON.parse(i),s=!1,c=(async()=>{try{for(;;){let{value:e,done:i}=await r.read();if(i)break;if(e)try{let n=[];try{t(JSON.parse(e))}finally{}await da(n)}catch(t){n?.(`Invalid JSON: ${e}`,t)}}}catch(e){s||n?.(`Stream processing error:`,e)}})(),l,u=[];try{l=t(o)}catch(e){throw s=!0,r.cancel().catch(()=>{}),e}return await da(u),Promise.resolve(l).catch(()=>{s=!0,r.cancel().catch(()=>{})}),c.finally(()=>{try{r.releaseLock()}catch{}}),l}function G(e){let t=`/_serverFn/`+e;return Object.assign((...e)=>{let n=h()?.serverFns?.fetch;return ma(t,e,n??fetch)},{url:t,serverFnMeta:{id:e},[c]:!0})}function ba(e){if(Array.isArray(e))return e.flatMap(e=>ba(e));if(typeof e!=`string`)return[];let t=[],n=0,r,i,a,o,s,c=()=>{for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n<e.length},l=()=>(i=e.charAt(n),i!==`=`&&i!==`;`&&i!==`,`);for(;n<e.length;){for(r=n,s=!1;c();)if(i=e.charAt(n),i===`,`){for(a=n,n+=1,c(),o=n;n<e.length&&l();)n+=1;n<e.length&&e.charAt(n)===`=`?(s=!0,n=o,t.push(e.slice(r,a)),r=n):n=a+1}else n+=1;(!s||n>=e.length)&&t.push(e.slice(r))}return t}function xa(e){return e instanceof Headers?e:Array.isArray(e)||typeof e==`object`?new Headers(e):null}function Sa(...e){return e.reduce((e,t)=>{let n=xa(t);if(!n)return e;for(let[t,r]of n.entries())t===`set-cookie`?ba(r).forEach(t=>e.append(`set-cookie`,t)):e.set(t,r);return e},new Headers)}var K=n(e(),1),Ca=K.use,wa=typeof window<`u`?K.useLayoutEffect:K.useEffect;function Ta(e){let t=K.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function Ea(e,t,n={},r={}){K.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function Da(e){let t=K.useRef(null);return K.useImperativeHandle(e,()=>t.current,[]),t}var q=r();function Oa({children:e,fallback:t=null}){return ka()?(0,q.jsx)(K.Fragment,{children:e}):(0,q.jsx)(K.Fragment,{children:t})}function ka(){return K.useSyncExternalStore(Aa,()=>!0,()=>!1)}function Aa(){return()=>{}}var ja=K.createContext(void 0),Ma=K.createContext(void 0),Na=t((t=>{var n=e();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useState,o=n.useEffect,s=n.useLayoutEffect,c=n.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;t.useSyncExternalStore=n.useSyncExternalStore===void 0?f:n.useSyncExternalStore})),Pa=t(((e,t)=>{t.exports=Na()})),Fa=t((t=>{var n=e(),r=Pa();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=n.useRef,c=n.useEffect,l=n.useMemo,u=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),Ia=t(((e,t)=>{t.exports=Fa()})),La=Ia();function Ra(e,t){return e===t}function za(e,t,n=Ra){let r=(0,K.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,K.useCallback)(()=>e?.get(),[e]);return(0,La.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Ba={get(){},subscribe(){return{unsubscribe(){}}}};function Va(e,t){let n=K.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=re(n.current,i):i}}function Ha(e){let t=i(),n=K.useContext(e.from?Ma:ja),r=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),a=Va(e,t),o=za(r??Ba,e=>e?a(e):Ba);if(o!==Ba)return o;(e.shouldThrow??!0)&&x()}function Ua(e){return Ha({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Wa(e){let{select:t,...n}=e;return Ha({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Ga(e){return Ha({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Ka(e){return Ha({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function qa(e){let t=i();return K.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Ja(e){return Ha({...e,select:t=>e.select?e.select(t.context):t.context})}var Ya=n(o(),1);function Xa(e,t){let n=i(),r=Da(t),{activeProps:a,inactiveProps:o,activeOptions:s,to:c,preload:l,preloadDelay:u,preloadIntentProximity:d,hashScrollIntoView:f,replace:p,startTransition:m,resetScroll:h,viewTransition:g,children:_,target:y,disabled:b,style:ee,className:te,onClick:ne,onBlur:re,onFocus:ie,onMouseEnter:ae,onMouseLeave:oe,onTouchStart:se,ignoreBlocker:le,params:ue,search:de,hash:fe,state:pe,mask:me,reloadDocument:ge,unsafeRelative:_e,from:ve,_fromLocation:ye,...be}=e,xe=ka(),x=K.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),S=za(n.stores.location,e=>e,(e,t)=>e.href===t.href),C=K.useMemo(()=>{let e={_fromLocation:S,...x};return n.buildLocation(e)},[n,S,x]),Se=C.maskedLocation?C.maskedLocation.publicHref:C.publicHref,Ce=C.maskedLocation?C.maskedLocation.external:C.external,we=K.useMemo(()=>ao(Se,Ce,n.history,b),[b,Ce,Se,n.history]),w=K.useMemo(()=>{if(we?.external)return he(we.href,n.protocolAllowlist)?void 0:we.href;if(!oo(c)&&!(typeof c!=`string`||c.indexOf(`:`)===-1))try{return new URL(c),he(c,n.protocolAllowlist)?void 0:c}catch{}},[c,we,n.protocolAllowlist]),Te=K.useMemo(()=>{if(w)return!1;if(s?.exact){if(!Ke(S.pathname,C.pathname,n.basepath))return!1}else{let e=Ge(S.pathname,n.basepath),t=Ge(C.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(s?.includeSearch??!0)&&!ce(S.search,C.search,{partial:!s?.exact,ignoreUndefined:!s?.explicitUndefined})?!1:s?.includeHash?xe&&S.hash===C.hash:!0},[s?.exact,s?.explicitUndefined,s?.includeHash,s?.includeSearch,S,w,xe,C.hash,C.pathname,C.search,n.basepath]),E=Te?v(a,{})??Qa:Za,D=Te?Za:v(o,{})??Za,Ee=[te,E.className,D.className].filter(Boolean).join(` `),De=(ee||E.style||D.style)&&{...ee,...E.style,...D.style},[Oe,ke]=K.useState(!1),Ae=K.useRef(!1),O=e.reloadDocument||w?!1:l??n.options.defaultPreload,je=u??n.options.defaultPreloadDelay??0,k=K.useCallback(()=>{n.preloadRoute({...x,_builtLocation:C}).catch(e=>{console.warn(e),console.warn(ot)})},[n,x,C]);Ea(r,K.useCallback(e=>{e?.isIntersecting&&k()},[k]),ro,{disabled:!!b||O!==`viewport`}),K.useEffect(()=>{Ae.current||!b&&O===`render`&&(k(),Ae.current=!0)},[b,k,O]);let Me=e=>{let t=e.currentTarget.getAttribute(`target`),r=y===void 0?t:y;if(!b&&!co(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,Ya.flushSync)(()=>{ke(!0)});let t=n.subscribe(`onResolved`,()=>{t(),ke(!1)});n.navigate({...x,replace:p,resetScroll:h,hashScrollIntoView:f,startTransition:m,viewTransition:g,ignoreBlocker:le})}};if(w)return{...be,ref:r,href:w,..._&&{children:_},...y&&{target:y},...b&&{disabled:b},...ee&&{style:ee},...te&&{className:te},...ne&&{onClick:ne},...re&&{onBlur:re},...ie&&{onFocus:ie},...ae&&{onMouseEnter:ae},...oe&&{onMouseLeave:oe},...se&&{onTouchStart:se}};let Ne=e=>{if(b||O!==`intent`)return;if(!je){k();return}let t=e.currentTarget;if(no.has(t))return;let n=setTimeout(()=>{no.delete(t),k()},je);no.set(t,n)},Pe=e=>{b||O!==`intent`||k()},Fe=e=>{if(b||!O||!je)return;let t=e.currentTarget,n=no.get(t);n&&(clearTimeout(n),no.delete(t))};return{...be,...E,...D,href:we?.href,ref:r,onClick:io([ne,Me]),onBlur:io([re,Fe]),onFocus:io([ie,Ne]),onMouseEnter:io([ae,Ne]),onMouseLeave:io([oe,Fe]),onTouchStart:io([se,Pe]),disabled:!!b,target:y,...De&&{style:De},...Ee&&{className:Ee},...b&&$a,...Te&&eo,...xe&&Oe&&to}}var Za={},Qa={className:`active`},$a={role:`link`,"aria-disabled":!0},eo={"data-status":`active`,"aria-current":`page`},to={"data-transitioning":`transitioning`},no=new WeakMap,ro={rootMargin:`100px`},io=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function ao(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function oo(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var so=K.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Xa(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return K.createElement(`a`,t,o)}return K.createElement(n,a,o)});function co(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var lo=class extends st{constructor(e){super(e),this.useMatch=e=>Ha({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Ja({...e,from:this.id}),this.useSearch=e=>Ka({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Ga({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Wa({...e,from:this.id}),this.useLoaderData=e=>Ua({...e,from:this.id}),this.useNavigate=()=>qa({from:this.fullPath}),this.Link=K.forwardRef((e,t)=>(0,q.jsx)(so,{ref:t,from:this.fullPath,...e}))}};function uo(e){return new lo(e)}var fo=class extends ct{constructor(e){super(e),this.useMatch=e=>Ha({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Ja({...e,from:this.id}),this.useSearch=e=>Ka({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Ga({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Wa({...e,from:this.id}),this.useLoaderData=e=>Ua({...e,from:this.id}),this.useNavigate=()=>qa({from:this.fullPath}),this.Link=K.forwardRef((e,t)=>(0,q.jsx)(so,{ref:t,from:this.fullPath,...e}))}};function po(e){return new fo(e)}function mo(e){return new ho(e,{silent:!0}).createRoute}var ho=class{constructor(e,t){this.path=e,this.createRoute=e=>{let t=uo(e);return t.isRoot=!1,t},this.silent=t?.silent}};function go(e,t){let n,r,i,a,o=()=>(n||=e().then(e=>{n=void 0,r=e[t??`default`]}).catch(e=>{if(i=e,ue(i)&&i instanceof Error&&typeof window<`u`&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;sessionStorage.getItem(e)||(sessionStorage.setItem(e,`1`),a=!0)}}),n),s=function(e){if(a)throw window.location.reload(),new Promise(()=>{});if(i)throw i;if(!r)if(Ca)Ca(o());else throw o();return K.createElement(r,e)};return s.preload=o,s}function _o(e){return e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}function vo(e,t){let n=Object.create(null);if(e)for(let t of Object.keys(e))_o(t)&&(n[t]=e[t]);if(t&&typeof t==`object`)for(let e of Object.keys(t))_o(e)&&(n[e]=t[e]);return n}function yo(e){if(!e)return Object.create(null);let t=Object.create(null);for(let n of Object.keys(e))_o(n)&&(t[n]=e[n]);return t}var bo=()=>{throw Error(`createServerOnlyFn() functions can only be called on the server!`)},J=(e,t)=>{let n=t||e||{};n.method===void 0&&(n.method=`GET`);let r=e=>J(void 0,{...n,validator:e,inputValidator:e});return Object.assign(e=>J(void 0,{...n,...e}),{options:n,middleware:e=>{let t=[...n.middleware||[]];e.map(e=>{l in e?e.options.middleware&&t.push(...e.options.middleware):t.push(e)});let r=J(void 0,{...n,middleware:t});return r[l]=!0,r},validator:r,inputValidator:r,handler:(...e)=>{let[t,r]=e,i={...n,extractedFn:t,serverFn:r},a=[...i.middleware||[],wo(i)];return t.method=n.method,Object.assign(async e=>{let n=await xo(a,`client`,{...t,...i,data:e?.data,headers:e?.headers,signal:e?.signal,fetch:e?.fetch,context:yo()}),r=at(n.error);if(r)throw r;if(n.error)throw n.error;return n.result},{...t,method:n.method,__executeServer:async e=>{let n=bo(),r=n.contextAfterGlobalMiddlewares;return await xo(a,`server`,{...t,...e,serverFnMeta:t.serverFnMeta,context:vo(e.context,r),request:n.request}).then(e=>({result:e.result,error:e.error,context:e.sendContext}))}})}})};async function xo(e,t,n){let r=So([...h()?.functionMiddleware||[],...e]);if(t===`server`){let e=bo({throwIfNotFound:!1});e?.executedRequestMiddlewares&&(r=r.filter(t=>!e.executedRequestMiddlewares.has(t)))}let i=async e=>{let n=r.shift();if(!n)return e;try{let r=`validator`in n.options?n.options.validator:void 0;!r&&`inputValidator`in n.options&&(r=n.options.inputValidator),r&&t===`server`&&(e.data=await Co(r,e.data));let a;if(t===`client`?`client`in n.options&&(a=n.options.client):`server`in n.options&&(a=n.options.server),a){let t=async(t={})=>{let n=await i({...e,...t,context:vo(e.context,t.context),sendContext:vo(e.sendContext,t.sendContext),headers:Sa(e.headers,t.headers),_callSiteFetch:e._callSiteFetch,fetch:e._callSiteFetch??t.fetch??e.fetch,result:t.result===void 0?t instanceof Response?t:e.result:t.result,error:t.error??e.error});if(n.error)throw n.error;return n},n=await a({...e,next:t});if(it(n))return{...e,error:n};if(n instanceof Response)return{...e,result:n};if(!n)throw Error(`User middleware returned undefined. You must call next() or return a result in your middlewares.`);return n}return i(e)}catch(t){return{...e,error:t}}};return i({...n,headers:n.headers||{},sendContext:n.sendContext||{},context:n.context||yo(),_callSiteFetch:n.fetch})}function So(e,t=100){let n=new Set,r=[],i=(e,a)=>{if(a>t)throw Error(`Middleware nesting depth exceeded maximum of ${t}. Check for circular references.`);e.forEach(e=>{e.options.middleware&&i(e.options.middleware,a+1),n.has(e)||(n.add(e),r.push(e))})};return i(e,0),r}async function Co(e,t){if(e==null)return{};if(`~standard`in e){let n=await e[`~standard`].validate(t);if(n.issues)throw Error(JSON.stringify(n.issues,void 0,2));return n.value}if(`parse`in e)return e.parse(t);if(typeof e==`function`)return e(t);throw Error(`Invalid validator type!`)}function wo(e){return{"~types":void 0,options:{inputValidator:e.validator??e.inputValidator,client:async({next:t,sendContext:n,fetch:r,...i})=>{let a={...i,context:n,fetch:r};return t(await e.extractedFn?.(a))},server:async({next:t,...n})=>{let r=await e.serverFn?.(n);return t({...n,result:r})}}}}var To=J({method:`GET`}).handler(G(`b8119d5fe6ca1ed9f609702aa2133b5ac5337030c0bdcf92dc7eba889d6bd2e6`)),Eo=J({method:`GET`}).handler(G(`cbb6a1b09b309459bbba3dc3851ae85fc468658b3cda77e22b6c6f3e28b65af4`)),Do=J({method:`GET`}).handler(G(`0fe12e769203c42f432a927b9cbf13a967a0f9db567b61843598f734afb4f5c6`)),Oo=J({method:`GET`}).handler(G(`7cc22b3a0f6b1c4c73463c3401e981ad42caf6487b479b738ee5aeacb11710da`)),ko=J({method:`GET`}).handler(G(`dc0ec955d0d53a150a3e9a4673f98f3509cfb4bd411c512079ae4e94c561b70c`)),Ao=J({method:`GET`}).handler(G(`23e290b2b7483ceea6fe669024c35b12c2c4ddd76649f6fab21c958ceda02940`)),jo=J({method:`GET`}).handler(G(`b050455aacc84dd2a2c9a45517826ad10f91d8f1545e87cc7015784cc7116a97`)),Mo=J({method:`GET`}).handler(G(`85fdf73d4fee43aed762f93c5d47d33200fbff39e2d082647dc921f610d32698`)),No=J({method:`GET`}).handler(G(`b18bbec3d06dfc77714e1e527dfb9172fd7575a64a6c0d6e73ba6dc658dccf0d`)),Po=J({method:`GET`}).handler(G(`ed10d5fe79208e5e0e4e18e4a17b18d7f7db4dd16204c00c3ac90c4644668841`)),Fo=J({method:`GET`}).handler(G(`08c28b892712a1b491b120b74c7dcb81761988d31ccea60216d1807b73c1182c`)),Io=J({method:`POST`}).handler(G(`9befe6b8d67ccbbd7aa9b538bde2a161a9894761c8936761a9503fda1a88c0fc`)),Lo=J({method:`POST`}).handler(G(`95b7483b333d7649e70c848319417e83c2af6a0327bbcda2d0e331f626dffe05`)),Ro=J({method:`POST`}).handler(G(`5660ea82ea5ff2549e0ce2f8f070c54f3e9e24fee84d547601ef5d6ef49a4016`)),zo=J({method:`POST`}).handler(G(`e233a461e4526dec3cc4cbaa891a7c3621d5967ce7f32b4fb17e9fb645857b9a`)),Bo=J({method:`POST`}).handler(G(`5e0d6b55f5629faac2f55a68661eeb82668b2be752192b16264ffb5cd1e6fabe`)),Vo=J({method:`POST`}).handler(G(`08565e35f6a3dd06ef25401de0343976c47f7ae319d3baed6320b56dd3718311`)),Ho=J({method:`POST`}).handler(G(`6850ba403da9dec5aff45794eb52636ca540ddec2d9e59f5c75ccbb852bfeacb`)),Uo=J({method:`POST`}).handler(G(`4646f52fb09b83c9c9cef34836f3c9d03416423c879d9e5ceffcafd9a71ecba6`)),Wo=Object.create(null),Go=e=>({}),Y=new Proxy(Wo,{get(e,t){return Go()[t]??Wo[t]},has(e,t){return t in Go()||t in Wo},set(e,t,n){let r=Go(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=Go(!0);return delete n[t],!0},ownKeys(){let e=Go(!0);return Object.keys(e)}});Y.NODE_ENV;function Ko(e,t){return typeof process<`u`?{}[e]??t:typeof Deno<`u`?Deno.env.get(e)??t:typeof Bun<`u`?Bun.env[e]??t:t}Object.freeze({get BETTER_AUTH_SECRET(){return Ko(`BETTER_AUTH_SECRET`)},get AUTH_SECRET(){return Ko(`AUTH_SECRET`)},get BETTER_AUTH_TELEMETRY(){return Ko(`BETTER_AUTH_TELEMETRY`)},get BETTER_AUTH_TELEMETRY_ID(){return Ko(`BETTER_AUTH_TELEMETRY_ID`)},get NODE_ENV(){return Ko(`NODE_ENV`,`development`)},get PACKAGE_VERSION(){return Ko(`PACKAGE_VERSION`,`0.0.0`)},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return Ko(`BETTER_AUTH_TELEMETRY_ENDPOINT`,``)}});function qo(){let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,`writable`)?e.writable:e.set!==void 0}function Jo(e){let t=e.split(`
|
|
4
|
+
at `);return t.length<=1?e:(t.splice(1,1),t.join(`
|
|
5
|
+
at `))}function Yo(e,t){class n extends e{#e;constructor(...e){if(qo()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=Jo(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(n.prototype,"constructor",{get(){return t},enumerable:!1,configurable:!0}),n}var Xo={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};Yo(class extends Error{constructor(e=`INTERNAL_SERVER_ERROR`,t=void 0,n={},r=typeof e==`number`?e:Xo[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=n,this.statusCode=r,this.name=`APIError`,this.status=e,this.headers=n,this.statusCode=r,this.body=t}},Error);var Zo=class extends Error{constructor(e,t){super(e,t),this.name=`BetterAuthError`,this.message=e,this.stack=``}},Qo=47;function $o(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===Qo;)t--;return t===e.length?e:e.slice(0,t)}function es(e){try{return($o(new URL(e).pathname)||`/`)!==`/`}catch{throw new Zo(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function ts(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new Zo(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof Zo?t:new Zo(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function ns(e,t=`/api/auth`){if(ts(e),es(e))return e;let n=$o(e);return!t||t===`/`?n:(t=t.startsWith(`/`)?t:`/${t}`,`${n}${t}`)}function rs(e,t){return!e||e.trim()===``?!1:t===`proto`?e===`http`||e===`https`:t===`host`?[/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(t=>t.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function is(e,t,n,r,i){if(e)return ns(e,t);if(r!==!1){let e=Y.BETTER_AUTH_URL||Y.NEXT_PUBLIC_BETTER_AUTH_URL||Y.PUBLIC_BETTER_AUTH_URL||Y.NUXT_PUBLIC_BETTER_AUTH_URL||Y.NUXT_PUBLIC_AUTH_URL||(Y.BASE_URL===`/`?void 0:Y.BASE_URL);if(e)return ns(e,t)}let a=n?.headers.get(`x-forwarded-host`),o=n?.headers.get(`x-forwarded-proto`);if(a&&o&&i&&rs(o,`proto`)&&rs(a,`host`))try{return ns(`${o}://${a}`,t)}catch{}if(n){let e=as(n.url);if(!e)throw new Zo(`Could not get origin from request. Please provide a valid base URL.`);return ns(e,t)}if(typeof window<`u`&&window.location)return ns(window.location.origin,t)}function as(e){try{let t=new URL(e);return t.origin===`null`?null:t.origin}catch{return null}}var os={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},ss=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,cs={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},ls=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function us(e){return e instanceof Date&&!isNaN(e.getTime())}function ds(e){let t=ls.exec(e);if(!t)return null;let[,n,r,i,a,o,s,c,l,u,d]=t,f=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(i,10),parseInt(a,10),parseInt(o,10),parseInt(s,10),c?parseInt(c.padEnd(3,`0`),10):0));if(l){let e=(parseInt(u,10)*60+parseInt(d,10))*(l===`+`?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return us(f)?f:null}function fs(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:i,parseDates:a=!0}=t;if(typeof e!=`string`)return e;let o=e.trim(),s=o.toLowerCase();if(s.length<=9&&s in cs)return cs[s];if(!ss.test(o)){if(n)throw SyntaxError(`[better-json] Invalid JSON`);return e}if(Object.entries(os).some(([e,t])=>{let n=t.test(o);return n&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),n})&&n)throw Error(`[better-json] Potential prototype pollution attempt detected`);try{return JSON.parse(o,(e,t)=>{if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){r&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(a&&typeof t==`string`){let e=ds(t);if(e)return e}return i?i(e,t):t})}catch(t){if(n)throw t;return e}}function ps(e,t={strict:!0}){return fs(e,t)}var ms=[`javascript:`,`data:`,`vbscript:`];function hs(e){let t;try{t=new URL(e)}catch{return!0}return!ms.includes(t.protocol)}var gs={id:`redirect`,name:`Redirect`,hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&hs(e.data.url)&&typeof window<`u`&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},X=[],Z=0,_s=4,vs=globalThis.nanostoresGlobal||={epoch:0},ys=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(e){return n.lc=t.push(e),()=>{for(let t=Z+_s;t<X.length;)X[t]===e?X.splice(t,_s):t+=_s;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){vs.epoch++;let i=!X.length;for(let i of t)X.push(i,n.value,e,r);if(i){for(Z=0;Z<X.length;Z+=_s)X[Z](X[Z+1],X[Z+2],X[Z+3]);X.length=0}},off(){},set(e){let t=n.value;t!==e&&(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n},bs=2,xs=5,Ss=6,Cs=10,ws=(e,t,n,r)=>(e.events=e.events||{},e.events[n+Cs]||(e.events[n+Cs]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],i=r.indexOf(t);r.splice(i,1),r.length||(delete e.events[n],e.events[n+Cs](),delete e.events[n+Cs])}),Ts=(e,t)=>ws(e,t,bs,t=>{let n=e.set,r=e.setKey;return e.setKey&&=(n,i)=>{let a;if(t({abort:()=>{a=!0},changed:n,newValue:{...e.value,[n]:i}}),!a)return r(n,i)},e.set=e=>{let r;if(t({abort:()=>{r=!0},newValue:e}),!r)return n(e)},()=>{e.set=n,e.setKey=r}}),Es=1e3,Ds=(e,t)=>ws(e,n=>{let r=t(n);r&&e.events[Ss].push(r)},xs,t=>{let n=e.listen;e.listen=(...r)=>(!e.lc&&!e.active&&(e.active=!0,t()),n(...r));let r=e.off;return e.events[Ss]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[Ss])t();e.events[Ss]=[]}},Es)},()=>{e.listen=n,e.off=r}});function Os(e,t,n){let r=new Set(t).add(void 0);return e.listen((e,t,i)=>{r.has(i)&&n(e,t,i)})}function ks(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function As(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!As(e[n],t[n]))return!1;return!0}if(ks(e)&&ks(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!(r in t)||!As(e[r],t[r]))return!1;return!0}return!1}function js(e,t){return Ts(e,({newValue:n,abort:r})=>{t(e.value,n)&&r()})}var Ms=Symbol.for(`better-auth:broadcast-channel`),Ns=()=>Math.floor(Date.now()/1e3),Ps=class{listeners=new Set;name;constructor(e=`better-auth.message`){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>`u`))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:Ns()}))}catch{}}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=e=>{if(e.key!==this.name)return;let t=JSON.parse(e.newValue??`{}`);t?.event!==`session`||!t?.data||this.listeners.forEach(e=>e(t))};return window.addEventListener(`storage`,e),()=>{window.removeEventListener(`storage`,e)}}};function Fs(e=`better-auth.message`){return globalThis[Ms]||(globalThis[Ms]=new Ps(e)),globalThis[Ms]}var Is=Symbol.for(`better-auth:focus-manager`),Ls=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||typeof document>`u`||window.addEventListener===void 0)return()=>{};let e=()=>{document.visibilityState===`visible`&&this.setFocused(!0)};return document.addEventListener(`visibilitychange`,e,!1),()=>{document.removeEventListener(`visibilitychange`,e,!1)}}};function Rs(){return globalThis[Is]||(globalThis[Is]=new Ls),globalThis[Is]}var zs=Symbol.for(`better-auth:online-manager`),Bs=class{listeners=new Set;isOnline=typeof navigator<`u`?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener(`online`,e,!1),window.addEventListener(`offline`,t,!1),()=>{window.removeEventListener(`online`,e,!1),window.removeEventListener(`offline`,t,!1)}}};function Vs(){return globalThis[zs]||(globalThis[zs]=new Bs),globalThis[zs]}var Hs=()=>Math.floor(Date.now()/1e3),Us=5;function Ws(e){let{fetchSession:t,shouldPollSession:n=()=>!0,sessionSignal:r,options:i={}}=e,a=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,s=i.sessionOptions?.refetchWhenOffline??!1,c={isInitialized:!1,lastSessionRequest:0},l=()=>s||Vs().isOnline,u=e=>{if(l()){if(e?.event===`storage`){t();return}if(e?.event===`poll`){c.lastSessionRequest=Hs(),t();return}if(e?.event===`visibilitychange`){if(Hs()-c.lastSessionRequest<Us)return;c.lastSessionRequest=Hs(),t();return}t()}},d=e=>{Fs().post({event:`session`,data:{trigger:e},clientId:Math.random().toString(36).substring(7)})},f=()=>{a&&a>0&&(c.pollInterval=setInterval(()=>{n()&&u({event:`poll`})},a*1e3))},p=()=>{c.unsubscribeBroadcast=Fs().subscribe(()=>{u({event:`storage`})})},m=()=>{o&&(c.unsubscribeFocus=Rs().subscribe(()=>{u({event:`visibilitychange`})}))},h=()=>{c.unsubscribeOnline=Vs().subscribe(e=>{e&&u({event:`visibilitychange`})})},g=()=>{c.unsubscribeSignal=r.listen(()=>{t()})};return{init:()=>{c.isInitialized||(c.isInitialized=!0,f(),p(),m(),h(),g(),c.cleanupBroadcastSetup=Fs().setup(),c.cleanupFocusSetup=Rs().setup(),c.cleanupOnlineSetup=Vs().setup())},cleanup:()=>{c.isInitialized&&(c.pollInterval&&=(clearInterval(c.pollInterval),void 0),c.unsubscribeBroadcast&&=(c.unsubscribeBroadcast(),void 0),c.unsubscribeFocus&&=(c.unsubscribeFocus(),void 0),c.unsubscribeOnline&&=(c.unsubscribeOnline(),void 0),c.unsubscribeSignal&&=(c.unsubscribeSignal(),void 0),c.cleanupBroadcastSetup&&=(c.cleanupBroadcastSetup(),void 0),c.cleanupFocusSetup&&=(c.cleanupFocusSetup(),void 0),c.cleanupOnlineSetup&&=(c.cleanupOnlineSetup(),void 0),c.isInitialized=!1,c.lastSessionRequest=0)},triggerRefetch:u,broadcastSessionUpdate:d}}var Gs=()=>typeof window>`u`;function Ks(e){return typeof e==`object`&&e&&`data`in e&&`error`in e?e:{data:e,error:null}}function qs(e){return!e||e.session===null&&e.user===null?null:e}function Js(e,t){return As(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function Ys(e,t){let n=ys(!1),r,i=e=>s(e),a=ys({data:null,error:null,isPending:!0,isRefetching:!1,refetch:i});js(a,Js);let o=e=>{if(r!==e)return;let t=a.get();r=void 0,!(!t.isPending&&!t.isRefetching)&&a.set({...t,isPending:!1,isRefetching:!1,refetch:i})},s=async t=>{r?.abort();let n=new AbortController;r=n;let s=a.get();a.set({...s,isPending:s.data===null,isRefetching:!0,error:null,refetch:i});try{let r=await e(`/get-session`,{method:`GET`,query:t?.query,signal:n.signal});if(n.signal.aborted){o(n);return}let{data:s,error:c}=Ks(r);if(s?.needsRefresh)try{let t=await e(`/get-session`,{method:`POST`,signal:n.signal});if(n.signal.aborted){o(n);return}({data:s,error:c}=Ks(t))}catch{if(n.signal.aborted){o(n);return}}if(c){let e=a.get(),t=c?.status===401;a.set({data:t?null:e.data,error:c,isPending:!1,isRefetching:!1,refetch:i});return}let l=qs(s),u=a.get(),d=u.data!=null&&l!=null&&As(u.data,l)?u.data:l;a.set({data:d,error:null,isPending:!1,isRefetching:!1,refetch:i})}catch(e){if(n.signal.aborted){o(n);return}let t=a.get();a.set({data:t.data,error:e,isPending:!1,isRefetching:!1,refetch:i})}},c=()=>{};return Ds(a,()=>{let e;Gs()||(e=setTimeout(()=>{s()},0));let i=Ws({fetchSession:s,shouldPollSession:()=>a.get().data!=null,sessionSignal:n,options:t});return i.init(),c=i.broadcastSessionUpdate,()=>{e&&clearTimeout(e);let t=r;t?.abort(),t&&o(t),i.cleanup()}}),{session:a,$sessionSignal:n,broadcastSessionUpdate:e=>c(e)}}function Xs(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function Zs(e,t,n=`.`,r){if(!Xs(t))return Zs(e,{},n,r);let i={...t};for(let t of Object.keys(e)){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:Xs(a)&&Xs(i[t])?i[t]=Zs(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function Qs(e){return(...t)=>t.reduce((t,n)=>Zs(t,n,``,e),{})}var $s=Qs(),ec=Object.defineProperty,tc=Object.defineProperties,nc=Object.getOwnPropertyDescriptors,rc=Object.getOwnPropertySymbols,ic=Object.prototype.hasOwnProperty,ac=Object.prototype.propertyIsEnumerable,oc=(e,t,n)=>t in e?ec(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q=(e,t)=>{for(var n in t||={})ic.call(t,n)&&oc(e,n,t[n]);if(rc)for(var n of rc(t))ac.call(t,n)&&oc(e,n,t[n]);return e},$=(e,t)=>tc(e,nc(t)),sc=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}},cc=async(e,t)=>{let n=t||{},r={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:n,hooks:r};for(let i of t?.plugins||[]){if(i.init){let r=await i.init?.call(i,e.toString(),t);n=r.options||n,e=r.url}r.onRequest.push(i.hooks?.onRequest),r.onResponse.push(i.hooks?.onResponse),r.onSuccess.push(i.hooks?.onSuccess),r.onError.push(i.hooks?.onError),r.onRetry.push(i.hooks?.onRetry)}return{url:e,options:n,hooks:r}},lc=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},uc=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function dc(e){if(typeof e==`number`)return new lc({type:`linear`,attempts:e,delay:1e3});switch(e.type){case`linear`:return new lc(e);case`exponential`:return new uc(e);default:throw Error(`Invalid retry strategy`)}}var fc=async e=>{let t={},n=async e=>typeof e==`function`?await e():e;if(e?.auth){if(e.auth.type===`Bearer`){let r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type===`Basic`){let[r,i]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!i)return t;t.authorization=`Basic ${btoa(`${r}:${i}`)}`}else if(e.auth.type===`Custom`){let[r,i]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!i)return t;t.authorization=`${r??``} ${i}`}}return t},pc=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function mc(e){let t=e.headers.get(`content-type`),n=new Set([`image/svg`,`application/xml`,`application/xhtml`,`application/html`]);if(!t)return`json`;let r=t.split(`;`).shift()||``;return pc.test(r)?`json`:n.has(r)||r.startsWith(`text/`)?`text`:`blob`}function hc(e){try{return JSON.parse(e),!0}catch{return!1}}function gc(e){if(e===void 0)return!1;let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===null?!0:t===`object`?Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name===`Object`||typeof e.toJSON==`function`:!1}function _c(e){try{return JSON.parse(e)}catch{return e}}function vc(e){return typeof e==`function`}function yc(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<`u`&&vc(globalThis.fetch))return globalThis.fetch;if(typeof window<`u`&&vc(window.fetch))return window.fetch;throw Error(`No fetch implementation found`)}function bc(...e){let t={};for(let n of e)if(n)if(n instanceof Headers)n.forEach((e,n)=>{t[n]=e});else{let e=Array.isArray(n)?n:Object.entries(n);for(let[n,r]of e)r!=null&&(t[n]=r)}return t}async function xc(e){let t=new Headers(bc(e?.headers,await fc(e)));if(!t.has(`content-type`)){let n=Sc(e?.body);n&&t.set(`content-type`,n)}return t}function Sc(e){return gc(e)?`application/json`:null}function Cc(e){let t=e.get(`content-type`);return t?t.split(`;`)[0].trim().toLowerCase():null}function wc(e,t){let{body:n}=e;return n?!gc(n)||typeof n==`string`?n:Cc(t)===`application/x-www-form-urlencoded`?new URLSearchParams(n).toString():JSON.stringify(n):null}function Tc(e,t){if(t?.method)return t.method.toUpperCase();if(e.startsWith(`@`)){let n=e.split(`@`)[1]?.split(`/`)[0];return kc.includes(n)?n.toUpperCase():t?.body?`POST`:`GET`}return t?.body?`POST`:`GET`}function Ec(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var Dc=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function Oc(e,t){let n=await e[`~standard`].validate(t);if(n.issues)throw new Dc(n.issues);return n.value}var kc=[`get`,`post`,`put`,`patch`,`delete`],Ac=e=>({id:`apply-schema`,name:`Apply Schema`,version:`1.0.0`,async init(t,n){let r=e.plugins?.find(e=>e.schema?.config?t.startsWith(e.schema.config.baseURL||``)||t.startsWith(e.schema.config.prefix||``):!1)?.schema||e.schema;if(r){let e=t;r.config?.prefix&&e.startsWith(r.config.prefix)&&(e=e.replace(r.config.prefix,``),r.config.baseURL&&(t=t.replace(r.config.prefix,r.config.baseURL))),r.config?.baseURL&&e.startsWith(r.config.baseURL)&&(e=e.replace(r.config.baseURL,``)),e.startsWith(`/`)&&e.charAt(1)===`@`&&(e=e.substring(1));let i=r.schema[e];if(i){let e=n?.headers;if(i.headers&&!n?.disableValidation){let t={};if(n?.headers){if(n.headers instanceof Headers)n.headers.forEach((e,n)=>{t[n.toLowerCase()]=e});else if(typeof n.headers==`object`)for(let[e,r]of Object.entries(n.headers))r!=null&&(t[e.toLowerCase()]=r)}let r=await Oc(i.headers,t),a={};for(let[e,t]of Object.entries(r))a[e.toLowerCase()]=t;e=a}let r=$(Q({},n),{method:i.method,output:i.output,headers:e});return n?.disableValidation||(r=$(Q({},r),{body:i.input?await Oc(i.input,n?.body):n?.body,params:i.params?await Oc(i.params,n?.params):n?.params,query:i.query?await Oc(i.query,n?.query):n?.query})),{url:t,options:r}}}return{url:t,options:n}}}),jc=e=>{async function t(t,n){let r=$(Q(Q({},e),n),{headers:bc(e?.headers,n?.headers),plugins:[...e?.plugins||[],Ac(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await Fc(t,r)}catch(e){return{data:null,error:{status:500,statusText:`Fetch Error`,message:`Fetch related error. Captured by catchAllError option. See error property for more details.`,error:e}}}return await Fc(t,r)}return t},Mc=e=>e===`.`||e===`..`;function Nc(e,t){let n=e;for(let[e,r]of t)n=n.replace(e,r);if(Mc(n))throw TypeError(`Path parameters cannot be reserved path segments`);return encodeURIComponent(n)}function Pc(e,t){let{baseURL:n,params:r,query:i}=t||{query:{},params:{},baseURL:``},a=e.startsWith(`http`)?e.split(`/`).slice(0,3).join(`/`):n||``;if(e.startsWith(`@`)){let t=e.toString().split(`@`)[1].split(`/`)[0];kc.includes(t)&&(e=e.replace(`@${t}/`,`/`))}a.endsWith(`/`)||(a+=`/`);let[o,s]=e.replace(a,``).split(`?`),c=new URLSearchParams(s);for(let[e,t]of Object.entries(i||{})){if(t==null)continue;let n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let n of t)c.append(e,n);continue}else n=JSON.stringify(t);c.set(e,n)}let l=new Map;if(r)if(Array.isArray(r)){let e=o.split(`/`).filter(e=>e.startsWith(`:`));for(let[t,n]of e.entries()){let e=r[t];l.set(n,String(e))}}else for(let[e,t]of Object.entries(r))l.set(`:${e}`,String(t));o=o.split(`/`).map(e=>Nc(e,l)).join(`/`),o=o.replace(/^\/+/,``);let u=c.toString();return u=u.length>0?`?${u}`.replace(/\+/g,`%20`):``,a.startsWith(`http`)?new URL(`${o}${u}`,a):`${a}${o}${u}`}var Fc=async(e,t)=>{let{hooks:n,url:r,options:i}=await cc(e,t),a=yc(i),o=new AbortController,s=i.signal??o.signal,c=Pc(r,i),l=await xc(i),u=wc(i,l),d=Tc(r,i),f=$(Q({},i),{url:c,headers:l,body:u,method:d,signal:s});for(let e of n.onRequest)if(e){let t=await e(f);typeof t==`object`&&t&&Object.assign(f,t)}(`pipeTo`in f&&typeof f.pipeTo==`function`||typeof t?.body?.pipe==`function`)&&(`duplex`in f||(f.duplex=`half`));let{clearTimeout:p}=Ec(i,o),m=await a(f.url,f);p();let h={response:m,request:f};for(let e of n.onResponse)if(e){let n=await e($(Q({},h),{response:t?.hookOptions?.cloneResponse?m.clone():m}));n instanceof Response?m=n:typeof n==`object`&&n&&(m=n.response)}if(m.ok){if(f.method===`HEAD`)return{data:``,error:null};let e=mc(m),r={data:null,response:m,request:f};if(e===`json`||e===`text`){let e=await m.text();r.data=await(f.jsonParser??_c)(e)}else r.data=await m[e]();f?.output&&f.output&&!f.disableValidation&&(r.data=await Oc(f.output,r.data));for(let e of n.onSuccess)e&&await e($(Q({},r),{response:t?.hookOptions?.cloneResponse?m.clone():m}));return t?.throw?r.data:{data:r.data,error:null}}let g=t?.jsonParser??_c,_=await m.text(),v=hc(_),y=v?await g(_):null,b={response:m,responseText:_,request:f,error:$(Q({},y),{status:m.status,statusText:m.statusText})};for(let e of n.onError)e&&await e($(Q({},b),{response:t?.hookOptions?.cloneResponse?m.clone():m}));if(t?.retry){let r=dc(t.retry),i=t.retryAttempt??0;if(await r.shouldAttemptRetry(i,m)){for(let e of n.onRetry)e&&await e(h);let a=r.getDelay(i);return await new Promise(e=>setTimeout(e,a)),await Fc(e,$(Q({},t),{retryAttempt:i+1}))}}if(t?.throw)throw new sc(m.status,m.statusText,v?y:_);return{data:null,error:$(Q({},y),{status:m.status,statusText:m.statusText})}},Ic=e=>{if(typeof process>`u`)return;let t=e??`/api/auth`;if({}.NEXT_PUBLIC_AUTH_URL)return{}.NEXT_PUBLIC_AUTH_URL;if(typeof window>`u`){if({}.NEXTAUTH_URL)try{return{}.NEXTAUTH_URL}catch{}if({}.VERCEL_URL)try{let e={}.VERCEL_URL.startsWith(`http`)?``:`https://`;return`${new URL(`${e}${{}.VERCEL_URL}`).origin}${t}`}catch{}}},Lc=(e,t)=>{let n=`credentials`in Request.prototype,r=is(e?.baseURL,e?.basePath,void 0,t)??Ic(e?.basePath)??`/api/auth`,i=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>e!==void 0)||[],a={id:`lifecycle-hooks`,name:`lifecycle-hooks`,hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:o,onError:s,onRequest:c,onResponse:l,...u}=e?.fetchOptions||{},d=jc({baseURL:r,...n?{credentials:`include`}:{},method:`GET`,jsonParser(e){return e?ps(e,{strict:!1}):null},customFetchImpl:fetch,...u,plugins:[a,...u.plugins||[],...e?.disableDefaultFetchPlugins?[]:[gs],...i]}),{$sessionSignal:f,session:p,broadcastSessionUpdate:m}=Ys(d,e),h=e?.plugins||[],g={},_={$sessionSignal:f,session:p},v={"/sign-out":`POST`,"/revoke-sessions":`POST`,"/revoke-other-sessions":`POST`,"/delete-user":`POST`},y=[{signal:`$sessionSignal`,matcher(e){return e===`/sign-out`||e===`/update-user`||e===`/update-session`||e===`/sign-up/email`||e===`/sign-in/email`||e===`/delete-user`||e===`/verify-email`||e===`/revoke-sessions`||e===`/revoke-session`||e===`/revoke-other-sessions`||e===`/change-email`||e===`/change-password`},callback(e){e===`/sign-out`?m(`signout`):(e===`/update-user`||e===`/update-session`)&&m(`updateUser`)}}];for(let e of h)e.getAtoms&&Object.assign(_,e.getAtoms?.(d)),e.pathMethods&&Object.assign(v,e.pathMethods),e.atomListeners&&y.push(...e.atomListeners);let b={notify:e=>{_[e].set(!_[e].get())},listen:(e,t)=>{_[e].subscribe(t)},atoms:_};for(let t of h)t.getActions&&(g=$s(t.getActions?.(d,b,e)??{},g));return{get baseURL(){return r},pluginsActions:g,pluginsAtoms:_,pluginPathMethods:v,atomListeners:y,$fetch:d,$store:b}};function Rc(e){return typeof e==`object`&&!!e&&`get`in e&&typeof e.get==`function`&&`lc`in e&&typeof e.lc==`number`}function zc(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Bc=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,Vc=/['\u2019]/g;function Hc(e){return e.replace(Vc,``).match(Bc)??[]}function Uc(e){return Hc(e).map(e=>e.toLowerCase()).join(`-`)}function Wc(e,t,n){let r=t[e],{fetchOptions:i,query:a,...o}=n||{};return r||(i?.method?i.method:o&&Object.keys(o).length>0?`POST`:`GET`)}function Gc(e,t,n,r,i){function a(o=[]){return new Proxy(function(){},{get(t,n){if(typeof n!=`string`||n===`then`||n===`catch`||n===`finally`)return;let r=[...o,n],i=e;for(let e of r)if(i&&typeof i==`object`&&e in i)i=i[e];else{i=void 0;break}return typeof i==`function`||Rc(i)?i:a(r)},apply:async(e,a,s)=>{let c=`/`+o.map(Uc).join(`/`),l=s[0]||{},u=s[1]||{},{query:d,fetchOptions:f,...p}=l,m={...u,...f},h=Wc(c,n,l);return await t(c,{...m,body:h===`GET`?void 0:{...p,...m?.body||{}},query:d||m?.query,method:h,async onSuccess(e){if(await m?.onSuccess?.(e),!i||m.disableSignal)return;let t=i.filter(e=>e.matcher(c));if(!t.length)return;let n=new Set;for(let e of t){let t=r[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let i=t.get();setTimeout(()=>{t.set(!i)},10),e.callback?.(c)}}})}})}return a()}function Kc(e,t={}){let n=(0,K.useRef)(e.get()),{keys:r,deps:i=[e,r]}=t,a=(0,K.useCallback)(t=>{let i=e=>{n.current!==e&&(n.current=e,t())};return i(e.value),r?.length?Os(e,r,i):e.listen(i)},i),o=()=>n.current;return(0,K.useSyncExternalStore)(a,o,o)}function qc(e){return`use${zc(e)}`}function Jc(e){let{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:i,$store:a,atomListeners:o}=Lc(e),s={};for(let[e,t]of Object.entries(r))s[qc(e)]=()=>Kc(t);return Gc({...n,...s,$fetch:i,$store:a},i,t,r,o)}var Yc=Jc(),{signIn:Xc,useSession:Zc}=Yc,Qc=[[9,9],[37,9],[65,9],[65,37],[65,65],[37,65],[9,65],[9,37]];function $c({size:e=24,plate:t=!1,trail:n=!1,animated:r=!1}){let i=e=>{let t=[`ring-cell`,`rc${e}`];return e===0?t.push(`ring-runner`):n&&e===7?t.push(`ring-trail-1`):n&&e===6&&t.push(`ring-trail-2`),t.join(` `)};return(0,q.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 96 96`,role:`img`,"aria-label":`Pievo`,className:[`ring-logo`,t&&`ring-logo-plate`,r&&`ring-logo-animated`].filter(Boolean).join(` `),children:[t&&(0,q.jsx)(`rect`,{width:`96`,height:`96`,rx:`15`,fill:`#0b0b0b`}),Qc.map(([e,t],n)=>(0,q.jsx)(`rect`,{x:e,y:t,width:22,height:22,rx:6,className:i(n)},n))]})}function el({size:e=56}){return(0,q.jsx)($c,{size:e,plate:!0,animated:!0})}var tl=`https://github.com/kky42/pievo`;function nl({className:e}){return(0,q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,className:e,children:(0,q.jsx)(`path`,{d:`M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.55 0-.27-.01-1.17-.02-2.12-3.2.7-3.88-1.36-3.88-1.36-.52-1.33-1.28-1.68-1.28-1.68-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.19 1.76 1.19 1.03 1.75 2.69 1.25 3.34.95.1-.74.4-1.25.72-1.54-2.55-.29-5.24-1.28-5.24-5.68 0-1.26.45-2.28 1.19-3.09-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.18a11.1 11.1 0 0 1 5.8 0c2.2-1.49 3.17-1.18 3.17-1.18.63 1.59.23 2.76.11 3.05.74.81 1.19 1.83 1.19 3.09 0 4.41-2.69 5.38-5.25 5.67.41.35.77 1.05.77 2.12 0 1.53-.01 2.76-.01 3.14 0 .3.2.66.8.55A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5z`})})}var rl=`modulepreload`,il=function(e){return`/`+e},al={},ol=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=il(t,n),t in al)return;al[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:rl,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};export{Be as $,po as A,wa as B,Vo as C,ne as Ct,J as D,Ho as E,o as Et,Pa as F,rt as G,G as H,ja as I,$e as J,nt as K,Oa as L,qa as M,za as N,go as O,Ia as P,Xe as Q,ka as R,Lo as S,g as St,zo as T,c as Tt,Ni as U,Ta as V,it as W,Ve as X,Qe as Y,Je as Z,Ao as _,ve as _t,Yc as a,Ae as at,Uo as b,he as bt,Oo as c,je as ct,No as d,me as dt,qe as et,To as f,xe as ft,Fo as g,be as gt,jo as h,ce as ht,el as i,Oe as it,so as j,mo as k,Bo as l,S as lt,ko as m,ye as mt,tl as n,Ue as nt,Xc as o,ke as ot,Eo as p,le as pt,tt as q,nl as r,Ne as rt,Zc as s,De as st,ol as t,We as tt,Po as u,x as ut,Do as v,v as vt,Ro as w,re as wt,Io as x,de as xt,Mo as y,ee as yt,Ca as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./ui-Do4gqMyP.js";import{s as t}from"./preload-helper-DsxECZIS.js";import{a as n,o as r}from"./index-CaS_SmDq.js";import{t as i}from"./SignIn-0Tjqs-Ma.js";var a=e();function o(){let e=n.useLoaderData(),{data:o,isPending:s}=t();return e?.auth?.enabled&&!s&&!o||e?.mode===`signin`?(0,a.jsx)(i,{}):(0,a.jsx)(r,{initial:e.initial})}export{o as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,k as t}from"./ui-Do4gqMyP.js";import{r as n}from"./actionUi-DpwGIGpw.js";var r=e();function i({error:e}){let i=t();return(0,r.jsx)(`main`,{className:`mx-auto max-w-[1180px] px-8 pt-12`,children:(0,r.jsx)(n,{title:`Couldn't load the dashboard.`,detail:String(e),onRetry:()=>void i.invalidate()})})}export{i as errorComponent};
|