wizards 0.2.5 → 0.2.6
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/apps/runtime/dist/app.js +7 -2
- package/apps/runtime/dist/routes/delivery.js +6 -14
- package/apps/runtime/dist/routes/runs.js +28 -1
- package/apps/runtime/dist/services/engenty-shapes.js +71 -0
- package/apps/runtime/dist/services/wizard-icon.js +145 -0
- package/apps/web/dist/assets/{Account-BKribBzW.js → Account-knfyfyOq.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-CYQC4l57.js → ChangelogDialog-Bj4bclMv.js} +1 -1
- package/apps/web/dist/assets/{ChatPanel-Cnd_dfF2.js → ChatPanel-Dnpk2feK.js} +1 -1
- package/apps/web/dist/assets/{CreditsDialog-7nLXWFvP.js → CreditsDialog-Dn7uevkp.js} +1 -1
- package/apps/web/dist/assets/{EditorPage-BjFAF_4T.js → EditorPage-Q4ogvKEI.js} +1 -1
- package/apps/web/dist/assets/{FlowPreview-BT4i-qIF.js → FlowPreview-Cx8WOBr7.js} +1 -1
- package/apps/web/dist/assets/{HomePage-F04N9Y1Q.js → HomePage-C29lUDnZ.js} +1 -1
- package/apps/web/dist/assets/{ImportWizard-Cg0l6q88.js → ImportWizard-B1kfyd-n.js} +1 -1
- package/apps/web/dist/assets/{LocalRuntime-BoVnl1ga.js → LocalRuntime-DwCJawPW.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-DumPEWtE.js → NewWizardPage-GNxcj0KW.js} +2 -2
- package/apps/web/dist/assets/PublicRunner-D3uBfK35.js +1 -0
- package/apps/web/dist/assets/{RunnerView-adkYnOSi.js → RunnerView-B8QFy6Sw.js} +1 -1
- package/apps/web/dist/assets/{SettingsPage-7EG_dMSP.js → SettingsPage-DAkSf8E6.js} +1 -1
- package/apps/web/dist/assets/{SetupPage-BzZMf7Oz.js → SetupPage-DyC2so9b.js} +1 -1
- package/apps/web/dist/assets/{SharePage-CONXJnOU.js → SharePage-CWM_8lGl.js} +1 -1
- package/apps/web/dist/assets/{api-BC3K8Na8.js → api-C7nO5qT8.js} +1 -1
- package/apps/web/dist/assets/changelog-C257tJV1.js +1 -0
- package/apps/web/dist/assets/{index-CJ3iuK8-.js → index-Dp8RnbHf.js} +3 -3
- package/apps/web/dist/assets/{meta-BeYxDfVN.js → meta-DWFege7H.js} +1 -1
- package/apps/web/dist/assets/{oss-credits-Hu4LieLA.js → oss-credits-C-U2Tlpn.js} +1 -1
- package/apps/web/dist/assets/{outputs-DLmQMIUm.js → outputs-Cy_I6D0i.js} +1 -1
- package/apps/web/dist/assets/{session-_w8H5O_d.js → session-C44_g_hY.js} +1 -1
- package/apps/web/dist/assets/ui-BHAxG0j4.js +1 -0
- package/apps/web/dist/index.html +4 -4
- package/apps/web/dist/mcp/flow.html +1 -1
- package/package.json +2 -1
- package/apps/web/dist/assets/PublicRunner-CllgpTeL.js +0 -1
- package/apps/web/dist/assets/changelog-C0GmxRP2.js +0 -1
- package/apps/web/dist/assets/ui-Cj3EzOCA.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,S as i,d as a,i as o,j as s,k as c,n as l,nt as u,w as d}from"./api-BC3K8Na8.js";import{c as f,f as p,s as m,u as h}from"./session-_w8H5O_d.js";import{t as g}from"./createLucideIcon-q3MZMmnf.js";import{n as _,t as v}from"./plug-CLjyCoHB.js";import{t as y}from"./arrow-right-6FyN3e7D.js";import{D as b,E as x,S,T as ee,r as C,w as te,x as ne,y as w}from"./outputs-DLmQMIUm.js";import{t as T}from"./check-CUpby_J9.js";import{n as E,r as re,t as ie}from"./wand-sparkles-CKxArWPY.js";import{a as ae,r as oe,t as se}from"./ChatPanel-Cnd_dfF2.js";import{n as ce,t as le}from"./upload-DNRENWzQ.js";import{n as ue,t as D}from"./plus-Du-Jx8aI.js";import{t as de}from"./external-link-MAL7vJYj.js";import{n as fe}from"./mic-Bvz4mA2j.js";import{n as pe,r as me,t as he}from"./type-DnfgUhpM.js";import{a as ge,c as _e,d as O,f as ve,i as k,l as A,o as ye,p as be,s as j,t as xe,u as M}from"./Account-BKribBzW.js";import{p as Se}from"./definition-DndaH5Ow.js";import{_ as Ce,a as we,c as N,d as P,f as Te,h as F,i as I,m as Ee,n as L,o as R,p as De,r as z,s as B,t as V,u as Oe,y as H}from"./ui-Cj3EzOCA.js";import{d as ke,f as Ae,l as je,m as Me,p as Ne}from"./index-CJ3iuK8-.js";import{t as Pe}from"./LocalRuntime-BoVnl1ga.js";import{ProjectSwitcher as Fe}from"./HomePage-F04N9Y1Q.js";var Ie={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};Ie.node;var Le=g(Ie),Re={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};Re.node;var ze=g(Re),Be={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};Be.node;var Ve=g(Be),He={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};He.node;var Ue=g(He),We={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};We.node;var Ge=g(We),Ke={name:`music`,size:24,node:[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]};Ke.node;var qe=g(Ke),Je={name:`phone`,size:24,node:[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]};Je.node;var Ye=g(Je),Xe={name:`rotate-cw`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]};Xe.node;var Ze=g(Xe),Qe={name:`text-align-start`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]],aliases:[`text`,`align-left`]};Qe.node;var $e=g(Qe),et={name:`toggle-left`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]};et.node;var tt=g(et),nt={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};nt.node;var rt=g(nt),U=e(t(),1),W=e(n(),1);function it(){let e=Me(),[t,n]=(0,U.useState)(null),[r,i]=(0,U.useState)(null),a=async e=>{n(e??`*`),i(null);try{await Ne(e)}catch(e){i(e.message)}finally{n(null)}};return(0,W.jsxs)(j,{title:H(`plugins.title`),hint:e.canReload?H(`plugins.hint`):H(`plugins.hintManaged`),action:e.canReload?(0,W.jsx)(V,{variant:`secondary`,busy:t===`*`,onClick:()=>void a(),children:H(`plugins.rescan`)}):null,children:[(0,W.jsxs)(`ul`,{className:`divide-y divide-border-soft`,children:[e.plugins.map(n=>{let r=e.failed[n.id];return(0,W.jsxs)(`li`,{className:`flex items-start gap-4 py-4 first:pt-0 last:pb-0`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,W.jsx)(`span`,{className:`font-medium text-[15px]`,children:n.name}),n.name===n.id?null:(0,W.jsxs)(`span`,{className:`font-mono text-[12px] text-ink-4`,children:[n.id,` · `,n.version]})]}),n.description?(0,W.jsx)(`p`,{className:`mt-0.5 text-[14px] text-ink-3`,children:n.description}):null,n.tools.length?(0,W.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[12px] text-ink-3`,children:[H(`plugins.tools`),n.tools.map(e=>(0,W.jsx)(z,{children:e.id},e.id))]}):null,n.error?(0,W.jsx)(`p`,{className:`mt-2 text-[13px] text-rose`,children:H(`plugins.serverFailed`,{error:n.error})}):null,r?(0,W.jsx)(`p`,{className:`mt-2 text-[13px] text-rose`,children:H(`plugins.studioFailed`,{error:r})}):null]}),e.canReload?(0,W.jsx)(R,{label:H(`plugins.reload`),disabled:t!==null,onClick:()=>void a(n.id),children:(0,W.jsx)(Ze,{className:t===n.id?`size-4 animate-spin`:`size-4`})}):null]},n.id)}),e.problems.map(e=>(0,W.jsxs)(`li`,{className:`py-4 first:pt-0 last:pb-0`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,W.jsx)(z,{tone:`warn`,children:H(`plugins.problems`)}),(0,W.jsx)(`span`,{className:`break-all font-mono text-[12px] text-ink-3`,children:e.path})]}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:e.message})]},e.path))]}),r?(0,W.jsx)(`p`,{className:`mt-4 text-[13px] text-rose`,children:r}):null]})}function at({connector:e}){let[t,n]=(0,U.useState)(!1);return(0,W.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-3 px-3 py-2 text-left`,children:[(0,W.jsx)(`span`,{className:F(`size-2 shrink-0 rounded-full`,e.usable?`bg-moss`:`bg-ink-4`)}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:[e.name,` `,(0,W.jsx)(`span`,{className:`font-mono text-[11px] text-ink-4`,children:e.id})]}),(0,W.jsx)(`span`,{className:`shrink-0 text-[12px] text-ink-3`,children:e.usable?H(`connectors.actions`,{n:e.actions.length,r:e.actions.filter(e=>e.group===`read`).length}):H(`connectors.notSetUp`)})]}),t?(0,W.jsxs)(`div`,{className:`border-border-soft border-t px-3 py-2 text-[12px]`,children:[e.missingSetup?(0,W.jsxs)(`p`,{className:`mb-1 text-ink-3`,children:[H(`connectors.setup`),` `,(0,W.jsx)(`span`,{className:`font-mono text-ink-2`,children:e.missingSetup})]}):null,(0,W.jsx)(`p`,{className:`text-ink-4`,children:e.actions.map(e=>e.group===`read`?e.id:`${e.id} (${H(`connectors.group.${e.group}`)})`).join(` · `)})]}):null]})}var ot={none:`connectors.authNone`,oauth2:`connectors.authOauth`,api_key:`connectors.authKey`};function st({projectId:e,connector:t,readOnly:n}){let r=u(),[i,a]=(0,U.useState)(!1),o=()=>r.invalidateQueries({queryKey:[`connectors`,e]}),s=`/api/studio/projects/${e}/connectors/${t.id}`,c=p({mutationFn:()=>l.post(`${s}/refresh`),onSuccess:o}),d=p({mutationFn:()=>l.del(s),onSuccess:o}),f=t.actions.filter(e=>e.group===`read`).length;return(0,W.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,W.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-paper-2 text-ink-2`,children:(0,W.jsx)(v,{className:`size-4`})}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`min-w-0 flex-1 text-left`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate font-medium text-[14px]`,children:t.name}),(0,W.jsx)(`span`,{className:`font-mono text-[11px] text-ink-4`,children:t.id})]}),(0,W.jsxs)(`div`,{className:`truncate text-[12px] text-ink-3`,children:[t.domain,` · `,t.sourceKind===`mcp`?`MCP`:`OpenAPI`,` ·`,` `,H(ot[t.auth]),` ·`,` `,t.toolsPending?H(`connectors.pending`):H(`connectors.actions`,{n:t.actions.length,r:f})]})]}),n?null:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R,{label:H(`connectors.refresh`),onClick:()=>c.mutate(),children:c.isPending?(0,W.jsx)(P,{className:`size-4`}):(0,W.jsx)(Se,{className:`size-4`})}),(0,W.jsx)(R,{label:H(`connectors.remove`),className:`hover:text-rose`,onClick:()=>confirm(`${t.name}: ${H(`connectors.remove`)}?`)&&d.mutate(),children:(0,W.jsx)(w,{className:`size-4`})})]})]}),t.needsOAuthClient?(0,W.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[12px] text-rose`,children:H(`connectors.needsClient`)}):null,c.error??d.error?(0,W.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[12px] text-rose`,children:(c.error??d.error).message}):null,i&&t.actions.length?(0,W.jsx)(`ul`,{className:`max-h-64 overflow-y-auto border-border-soft border-t px-3 py-2`,children:t.actions.map(e=>(0,W.jsxs)(`li`,{className:`flex items-baseline gap-2 py-1 text-[12px]`,children:[(0,W.jsx)(`span`,{className:F(`w-14 shrink-0 text-[11px] uppercase tracking-wide`,e.group===`read`?`text-moss`:e.group===`write`?`text-ink-3`:`text-rose`),children:H(`connectors.group.${e.group}`)}),(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-ink-2`,children:e.id}),(0,W.jsx)(`span`,{className:`min-w-0 truncate text-ink-4`,children:e.summary})]},e.id))}):null]})}function ct({projectId:e,domain:t,source:n,taken:r,onDone:i}){let a=u(),[o,s]=(0,U.useState)({id:``,secret:``}),[c,d]=(0,U.useState)(!1),f=r.includes(n.suggestedId),m=p({mutationFn:()=>l.post(`/api/studio/projects/${e}/connectors`,{domain:t,sourceKind:n.sourceKind,sourceUrl:n.sourceUrl,id:n.suggestedId,toolPrefix:n.suggestedToolPrefix,...n.name?{name:n.name}:{},...o.id&&o.secret?{oauthClientId:o.id,oauthClientSecret:o.secret}:{}}),onSuccess:async t=>{await a.invalidateQueries({queryKey:[`connectors`,e]}),i(t.warnings)}});return(0,W.jsxs)(`div`,{className:`rounded-lg bg-card p-3 ring-1 ring-border-soft`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(z,{tone:n.sourceKind===`mcp`?`ember`:`neutral`,children:n.sourceKind===`mcp`?`MCP`:`OpenAPI`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate text-[13px]`,children:n.name??n.suggestedId}),(0,W.jsx)(`div`,{className:`truncate font-mono text-[11px] text-ink-4`,children:n.sourceUrl})]}),n.blocked||f?null:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>d(e=>!e),className:`text-[12px] text-ink-3 hover:text-ink`,children:H(`connectors.ownClient`)}),(0,W.jsx)(V,{size:`sm`,busy:m.isPending,onClick:()=>m.mutate(),children:H(`connectors.import`)})]})]}),n.blocked?(0,W.jsx)(`p`,{className:`mt-2 text-[12px] text-ink-3`,children:n.blocked}):null,f?(0,W.jsx)(`p`,{className:`mt-2 text-[12px] text-ink-3`,children:H(`connectors.exists`)}):null,c?(0,W.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:[(0,W.jsx)(B,{placeholder:`OAuth Client-ID`,value:o.id,onChange:e=>s(t=>({...t,id:e.target.value}))}),(0,W.jsx)(B,{type:`password`,autoComplete:`off`,placeholder:`OAuth Client-Secret`,value:o.secret,onChange:e=>s(t=>({...t,secret:e.target.value}))})]}):null,m.error?(0,W.jsx)(`p`,{className:`mt-2 text-[12px] text-rose`,children:m.error.message}):null]})}function lt({projectId:e,readOnly:t}){let[n,r]=(0,U.useState)(``),[i,a]=(0,U.useState)(null),[o,c]=(0,U.useState)(null),[u,d]=(0,U.useState)([]),f=s({queryKey:[`connectors`,e],queryFn:()=>l.get(`/api/studio/projects/${e}/connectors`)}),m=p({mutationFn:()=>l.post(`/api/studio/connectors/search`,{query:n}),onSuccess:e=>{a(e),c(null),d([])}}),h=p({mutationFn:e=>l.get(`/api/studio/connectors/registry/${encodeURIComponent(e)}`),onSuccess:c}),g=f.data??[],_=g.filter(e=>e.sourceKind===`builtin`&&(ke.unsetConnectors||e.usable)),v=g.filter(e=>e.sourceKind!==`builtin`);return(0,W.jsxs)(L,{className:`p-6`,children:[(0,W.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:H(`connectors.title`)}),(0,W.jsx)(`p`,{className:`mt-1 mb-5 text-[14px] text-ink-3`,children:H(`connectors.hint`)}),_.length?(0,W.jsx)(`div`,{className:`mb-5 grid gap-1.5 sm:grid-cols-2`,children:_.map(e=>(0,W.jsx)(at,{connector:e},e.id))}):null,(0,W.jsx)(`h3`,{className:`mb-2 font-medium text-[12px] text-ink-3 uppercase tracking-[0.07em]`,children:H(`connectors.imported`)}),v.length?(0,W.jsx)(`div`,{className:`mb-4 flex flex-col gap-2`,children:v.map(n=>(0,W.jsx)(st,{projectId:e,connector:n,readOnly:t},n.id))}):null,t?v.length?null:(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:H(`connectors.noneImported`)}):(0,W.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),n.trim()&&m.mutate()},children:[(0,W.jsx)(B,{value:n,placeholder:H(`connectors.search`),onChange:e=>r(e.target.value)}),(0,W.jsxs)(V,{type:`submit`,variant:`secondary`,busy:m.isPending,children:[(0,W.jsx)(ce,{className:`size-4`}),` `,H(`connectors.find`)]})]}),m.error?(0,W.jsx)(`p`,{className:`mt-3 text-[13px] text-rose`,children:m.error.message}):null,i&&!o?(0,W.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1`,children:[i.length?null:(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:H(`connectors.none`)}),i.map(e=>(0,W.jsxs)(`button`,{type:`button`,disabled:!e.kinds.length,onClick:()=>h.mutate(e.domain),className:`flex items-center gap-3 rounded-lg px-3 py-2 text-left transition hover:bg-paper-2 disabled:opacity-50`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate text-[14px]`,children:e.domain}),(0,W.jsx)(`div`,{className:`truncate text-[12px] text-ink-3`,children:e.description})]}),(0,W.jsx)(`span`,{className:`text-[11px] text-ink-4 uppercase`,children:e.kinds.join(` · `)}),(0,W.jsx)(re,{className:`-rotate-90 size-4 text-ink-4`})]},e.domain)),h.isPending?(0,W.jsx)(P,{className:`mx-auto mt-2 size-4 text-ink-4`}):null,h.error?(0,W.jsx)(`p`,{className:`text-[13px] text-rose`,children:h.error.message}):null]}):null,o?(0,W.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,W.jsx)(`div`,{className:`font-medium text-[14px]`,children:o.domain}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>c(null),className:`text-[12px] text-ink-3 hover:text-ink`,children:H(`run.back`)})]}),o.summary?(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:o.summary}):null,o.sources.map(t=>(0,W.jsx)(ct,{projectId:e,domain:o.domain,source:t,taken:g.map(e=>e.id),onDone:d},`${t.sourceKind}:${t.sourceUrl}`)),o.credentials.filter(e=>e.setup||e.url).map(e=>(0,W.jsxs)(`p`,{className:`text-[12px] text-ink-3`,children:[(0,W.jsxs)(`span`,{className:`text-ink-2`,children:[e.label,`:`]}),` `,e.setup,` `,e.url?(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-ember underline`,children:e.url}):null]},e.label)),u.map(e=>(0,W.jsx)(`p`,{className:`text-[12px] text-ink-3`,children:e},e))]}):null]})}var G=`engenty-wizards`,ut=`ENGENTY_WIZARDS_KEY`,dt=[{id:`claude-desktop`,name:`Claude Desktop`,widgets:!0},{id:`claude-code`,name:`Claude Code`,widgets:!1},{id:`codex`,name:`Codex · ChatGPT app`,widgets:!1},{id:`cursor`,name:`Cursor`,widgets:!0},{id:`vscode`,name:`VS Code (Copilot)`,widgets:!0},{id:`windsurf`,name:`Windsurf`,widgets:!1},{id:`gemini`,name:`Gemini CLI`,widgets:!1},{id:`goose`,name:`Goose`,widgets:!0},{id:`openclaw`,name:`OpenClaw`,widgets:!1},{id:`lm-studio`,name:`LM Studio`,widgets:!1},{id:`claude-ai`,name:`claude.ai`,widgets:!0,oauth:!0},{id:`chatgpt`,name:`ChatGPT`,widgets:!0,oauth:!0}];function K({text:e}){let[t,n]=(0,U.useState)(!1);return(0,W.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg bg-paper-2 p-3`,children:[(0,W.jsx)(`code`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-all font-mono text-[12px] leading-relaxed`,children:e}),(0,W.jsx)(R,{label:H(t?`settings.copied`:`settings.copy`),onClick:async()=>{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},children:t?(0,W.jsx)(T,{className:`size-4`}):(0,W.jsx)(ue,{className:`size-4`})})]})}function ft(e){try{let t=new URL(e);return t.protocol===`https:`&&!/(^|\.)localhost$/.test(t.hostname)&&!/^(127\.|10\.|192\.168\.|\[::1\])/.test(t.hostname)}catch{return!1}}function q({children:e}){return(0,W.jsx)(`p`,{className:`text-[14px] text-ink-3`,children:e})}function J({title:e,children:t}){return(0,W.jsxs)(`section`,{className:`flex flex-col gap-2.5 border-border-soft border-t pt-5 first:border-t-0 first:pt-0`,children:[(0,W.jsx)(`h3`,{className:`font-medium text-[15px]`,children:e}),t]})}function Y(e,t){return JSON.stringify({[e]:{[G]:t}},null,2)}function pt({id:e,url:t,apiKey:n}){let r=n?`Authorization: Bearer ${n}`:null,i=n?{headers:{Authorization:`Bearer ${n}`}}:{};switch(e){case`claude-code`:{let e=t.replace(/\/api\/mcp$/,`/api/claude-plugin`);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`mcp.terminal`)}),(0,W.jsx)(K,{text:`claude mcp add --transport http --scope user ${G} ${t}${r?` --header "${r}"`:``}`}),!n&&ft(t)?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`mcp.ccPlugin`)}),(0,W.jsx)(K,{text:`claude plugin marketplace add ${e}/marketplace.json`}),(0,W.jsx)(K,{text:`claude plugin install ${G}@engenty`})]}):null]})}case`codex`:return n?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`mcp.codexKey`)}),(0,W.jsx)(K,{text:`echo 'export ${ut}=${n}' >> ~/.zshrc && source ~/.zshrc`}),(0,W.jsx)(K,{text:`codex mcp add ${G} --url ${t} --bearer-token-env-var ${ut}`})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`mcp.terminal`)}),(0,W.jsx)(K,{text:`codex mcp add ${G} --url ${t}`}),(0,W.jsx)(K,{text:`codex mcp login ${G}`})]});case`gemini`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`mcp.terminal`)}),(0,W.jsx)(K,{text:`gemini mcp add --scope user --transport http ${G} ${t}${r?` -H "${r}"`:``}`})]});case`cursor`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`integrate.file`,{file:`~/.cursor/mcp.json`})}),(0,W.jsx)(K,{text:Y(`mcpServers`,{url:t,...i})})]});case`vscode`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`integrate.vscode`)}),(0,W.jsx)(K,{text:Y(`servers`,{type:`http`,url:t,...i})})]});case`windsurf`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`integrate.file`,{file:`~/.codeium/windsurf/mcp_config.json`})}),(0,W.jsx)(K,{text:Y(`mcpServers`,{serverUrl:t,...i})})]});case`lm-studio`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`integrate.file`,{file:`~/.lmstudio/mcp.json`})}),(0,W.jsx)(K,{text:Y(`mcpServers`,{url:t,...i})})]});case`claude-desktop`:case`claude-ai`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`mcp.claudeAi`)}),(0,W.jsx)(K,{text:t})]});case`chatgpt`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`integrate.chatgpt`)}),(0,W.jsx)(K,{text:t})]});default:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`integrate.generic`)}),(0,W.jsx)(K,{text:t}),r?(0,W.jsx)(K,{text:r}):null]})}}function mt(){let e=u(),t=s({queryKey:[`api-keys`],queryFn:()=>l.get(`/api/studio/api-keys`)}),n=p({mutationFn:e=>l.del(`/api/studio/api-keys/${e}`),onSuccess:()=>e.invalidateQueries({queryKey:[`api-keys`]})});return t.data?.length?(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:H(`mcp.keys`)}),(0,W.jsx)(`p`,{className:`mt-1 mb-4 text-[14px] text-ink-3`,children:H(`mcp.keysHint`)}),(0,W.jsx)(L,{className:`flex flex-col gap-2 p-3`,children:t.data.map(e=>(0,W.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg px-3 py-2`,children:[(0,W.jsx)(Ue,{className:`size-4 shrink-0 text-ink-4`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate text-[14px]`,children:e.name}),(0,W.jsxs)(`div`,{className:`font-mono text-[11px] text-ink-4`,children:[e.start,`… ·`,` `,e.lastRequest?H(`settings.lastUsed`,{when:new Date(e.lastRequest).toLocaleString()}):H(`settings.neverUsed`)]})]}),(0,W.jsx)(R,{label:H(`settings.revoke`),onClick:()=>n.mutate(e.id),className:`hover:text-rose`,children:(0,W.jsx)(w,{className:`size-4`})})]},e.id))})]}):null}function X({state:e,title:t,children:n}){return(0,W.jsxs)(`li`,{className:`grid grid-cols-[22px_minmax(0,1fr)] gap-x-3`,children:[(0,W.jsx)(`span`,{className:F(`mt-0.5 grid size-[22px] place-items-center rounded-full`,e===`done`&&`bg-moss text-white`,e===`now`&&`bg-amber-tint text-ink-2`,e===`later`&&`bg-paper-2 ring-1 ring-border-soft`),children:e===`done`?(0,W.jsx)(T,{className:`size-3.5`,strokeWidth:3}):e===`now`?(0,W.jsx)(P,{className:`size-3`}):null}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 pb-4`,children:[(0,W.jsx)(`span`,{className:F(`text-[14px]`,e===`later`?`text-ink-3`:`font-medium`),children:t}),e===`now`?n:null]})]})}function ht({widgets:e}){return(0,W.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,W.jsxs)(`div`,{className:`rounded-xl bg-paper p-4 ring-1 ring-border-soft`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-[14px]`,children:[(0,W.jsx)(rt,{className:`size-4 text-ember-strong`}),` MCP`]}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:H(`integrate.kindMcp`)})]}),(0,W.jsxs)(`div`,{className:F(`rounded-xl p-4 ring-1`,e?`bg-paper ring-border-soft`:`bg-paper-2/60 ring-border-soft/60`),children:[(0,W.jsxs)(`div`,{className:F(`flex items-center gap-2 font-medium text-[14px]`,e?null:`text-ink-3`),children:[(0,W.jsx)(_,{className:F(`size-4`,e?`text-ember-strong`:`text-ink-4`)}),` MCP App`]}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:H(e?`integrate.kindApp`:`integrate.kindAppNo`)})]})]})}function Z({selected:e,title:t,note:n,tone:r,widgets:i,disabled:a,onPick:o}){return(0,W.jsxs)(`button`,{type:`button`,disabled:a,onClick:o,"aria-pressed":e,className:F(`group flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left transition`,e?`bg-card shadow-soft ring-1 ring-border-soft`:`hover:bg-accent`,a&&`cursor-default opacity-55 hover:bg-transparent`),children:[(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate font-medium text-[14px]`,children:t}),i?(0,W.jsx)(`span`,{title:`MCP App`,className:`rounded bg-ember-tint px-1 font-semibold text-[10px] text-ember-strong leading-4`,children:`APP`}):null]}),n?(0,W.jsxs)(`span`,{className:F(`flex items-center gap-1 text-[12px]`,r===`done`?`text-moss`:r===`ok`?`text-ink-2`:`text-ink-4`),children:[r===`done`?(0,W.jsx)(T,{className:`size-3`,strokeWidth:3}):null,n]}):null]}),a?null:(0,W.jsx)(y,{className:F(`size-3.5 shrink-0 transition`,e?`text-ink-3`:`text-ink-4 opacity-0 group-hover:opacity-100`)})]})}function gt({at:e,done:t}){let n=[H(`setup.stage.connect`),H(`setup.stage.test`),H(`setup.stage.done`)];return(0,W.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-medium text-[11px] uppercase tracking-[0.14em]`,children:n.map((n,r)=>{let i=t||r<e;return(0,W.jsxs)(`li`,{"aria-current":!i&&r===e?`step`:void 0,className:F(`flex items-center gap-1`,i?`text-moss`:r===e?`text-ember-strong`:`text-ink-4`),children:[i?(0,W.jsx)(T,{className:`size-3`,strokeWidth:3}):null,n]},n)})})}function _t({client:e,local:t,seen:n,managed:r,url:i}){let a=u(),o=ft(i),s=!r&&!!t&&!e.oauth,[c,d]=(0,U.useState)(s&&t?.installed!==!1?`here`:`address`),[f,m]=(0,U.useState)(null),[h,g]=(0,U.useState)(),_=p({mutationFn:t=>l.post(`/api/studio/local/apps/${e.id}`,{connect:t}),onSuccess:e=>m(e),onError:e=>m({ok:!1,message:e.message}),onSettled:()=>a.invalidateQueries({queryKey:[`local-apps`]})}),v=p({mutationFn:()=>l.post(`/api/studio/api-keys`,{name:e.name.slice(0,32)}),onSuccess:async e=>{g(e.key),await a.invalidateQueries({queryKey:[`api-keys`]})}}),y=e.oauth===!0||e.id===`claude-desktop`,b=c===`address`&&y&&!(r&&o),x=c===`here`?!!t?.connected:r||!!h,S=!!n?.toolAt,ee=S?2:x||n?1:0,C=e=>(0,W.jsx)(K,{text:e});return(0,W.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(gt,{at:ee,done:S}),(0,W.jsx)(`h2`,{className:`mt-1.5 font-display font-semibold text-[26px] leading-tight tracking-tight`,children:e.name}),(0,W.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3`,children:e.widgets?H(`integrate.leadApp`):H(`integrate.leadMcp`)})]}),(0,W.jsx)(ht,{widgets:e.widgets}),(0,W.jsxs)(L,{className:`flex flex-col gap-6 p-6`,children:[s||!e.oauth?(0,W.jsx)(J,{title:H(`integrate.where`),children:(0,W.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[`here`,`address`].map(e=>{let t=e===`here`&&!s;return(0,W.jsxs)(`button`,{type:`button`,disabled:t,onClick:()=>d(e),"aria-pressed":c===e,className:F(`flex items-start gap-3 rounded-xl p-3.5 text-left ring-1 transition`,c===e?`bg-ember-tint/50 ring-ember-strong/40`:`ring-border-soft hover:bg-accent`,t&&`cursor-not-allowed opacity-50 hover:bg-transparent`),children:[e===`here`?(0,W.jsx)(Ge,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}):(0,W.jsx)(me,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,W.jsxs)(`span`,{className:`min-w-0`,children:[(0,W.jsx)(`span`,{className:`block font-medium text-[14px]`,children:H(e===`here`?`integrate.here`:`integrate.address`)}),(0,W.jsx)(`span`,{className:`block text-[12px] text-ink-3`,children:H(e===`here`?r?`integrate.hereManaged`:`integrate.hereHint`:`integrate.addressHint`)})]})]},e)})})}):null,b?(0,W.jsx)(J,{title:H(`mcp.notHere`),children:(0,W.jsx)(q,{children:H(r?`mcp.needsPublic`:`integrate.oauthLocal`)})}):c===`here`?(0,W.jsxs)(J,{title:H(`integrate.connectTitle`),children:[t?.installed===!1&&!t.connected?(0,W.jsx)(q,{children:H(`integrate.notInstalled`,{app:e.name})}):null,t?.connected?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-2 text-[14px] text-ink-2`,children:[(0,W.jsx)(T,{className:`size-4 text-moss`}),H(`integrate.connected`,{app:e.name})]}),(0,W.jsx)(V,{size:`sm`,variant:`ghost`,busy:_.isPending&&_.variables===!1,onClick:()=>_.mutate(!1),children:H(`mcp.appsDisconnect`)})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`integrate.connectHint`,{app:e.name})}),(0,W.jsx)(`div`,{children:(0,W.jsxs)(V,{busy:_.isPending,onClick:()=>_.mutate(!0),children:[(0,W.jsx)(D,{className:`size-4`}),` `,H(`integrate.connect`,{app:e.name})]})})]}),f&&!f.ok?(0,W.jsx)(`p`,{className:`text-[13px] text-rose`,children:f.message}):null,f?.snippet?(0,W.jsx)(K,{text:f.snippet}):null,t?.where?(0,W.jsx)(`p`,{className:`font-mono text-[11px] text-ink-4`,children:t.where}):null]}):(0,W.jsxs)(W.Fragment,{children:[r||y?null:(0,W.jsx)(J,{title:H(`mcp.keyTitle`),children:h?(0,W.jsxs)(`p`,{className:`flex items-center gap-2 text-[14px] text-ink-2`,children:[(0,W.jsx)(T,{className:`size-4 text-moss`}),` `,H(`mcp.keyReady`)]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`mcp.keyHint`)}),(0,W.jsx)(`div`,{children:(0,W.jsxs)(V,{variant:`secondary`,busy:v.isPending,onClick:()=>v.mutate(),children:[(0,W.jsx)(D,{className:`size-4`}),` `,H(`mcp.keyCreate`,{client:e.name})]})})]})}),(0,W.jsxs)(J,{title:H(`mcp.add`),children:[r||h||y?(0,W.jsx)(pt,{id:e.id,url:i,apiKey:h}):(0,W.jsx)(q,{children:H(`mcp.keyFirst`)}),r?(0,W.jsx)(q,{children:H(`mcp.oauth`)}):null,(0,W.jsx)(`p`,{className:`text-[12px] text-ink-4`,children:H(o?`mcp.addressPublic`:`mcp.addressLocal`)})]})]}),b?null:(0,W.jsxs)(J,{title:H(`integrate.test`),children:[(0,W.jsxs)(`ol`,{className:`flex flex-col`,children:[(0,W.jsx)(X,{state:n?`done`:x?`now`:`later`,title:H(`integrate.seen`,{app:e.name}),children:(0,W.jsx)(q,{children:H(c===`here`?`integrate.restart`:`integrate.reload`,{app:e.name})})}),(0,W.jsxs)(X,{state:n?.toolAt?`done`:n?`now`:`later`,title:H(`integrate.tool`),children:[(0,W.jsx)(q,{children:H(`integrate.askHint`,{app:e.name})}),C(H(`integrate.askTool`))]}),e.widgets?(0,W.jsxs)(X,{state:n?.widgetAt?`done`:n?.toolAt?`now`:`later`,title:H(`integrate.widget`),children:[(0,W.jsx)(q,{children:H(`integrate.widgetHint`)}),C(H(`integrate.askWidget`))]}):null]}),S?(0,W.jsxs)(`p`,{className:`flex items-center gap-2 font-medium text-[14px] text-moss`,children:[(0,W.jsx)(T,{className:`size-4`,strokeWidth:3}),H(`integrate.works`,{app:e.name})]}):null]})]})]})}function vt(){let e=h(),t=e.data?.mode===`managed`,n=s({queryKey:[`local-apps`],queryFn:()=>l.get(`/api/studio/local/apps`),enabled:e.data?.mode===`local`}),r=s({queryKey:[`integrations-seen`],queryFn:()=>l.get(`/api/studio/integrations/seen`),refetchInterval:2500}),[i,a]=(0,U.useState)(null);if(!e.data||!t&&!n.data)return null;let o=e.data.mcpUrl??``,c=e=>n.data?.find(t=>t.id===e),u=e=>r.data?.[e],d=e=>{let t=c(e);return t?.installed||t?.connected?0:1},f=[...dt].sort((e,t)=>d(e.id)-d(t.id)),p=f.find(e=>e.id===i)??f[0],m=e=>{let t=c(e);return u(e)?.toolAt?{note:H(`integrate.stateWorks`),tone:`done`}:t?.connected?{note:H(`integrate.stateConnected`),tone:`ok`}:t?.installed?{note:H(`integrate.stateInstalled`),tone:`dim`}:{}};return(0,W.jsxs)(`div`,{className:`flex flex-col gap-10`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h2`,{className:`font-display font-semibold text-[22px] tracking-tight`,children:H(`integrate.title`)}),(0,W.jsx)(`p`,{className:`mt-1 max-w-2xl text-[14px] text-ink-2`,children:H(`integrate.lead`)})]}),(0,W.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-[16rem_minmax(0,1fr)]`,children:[(0,W.jsxs)(`nav`,{className:`flex flex-col gap-5 lg:sticky lg:top-24 lg:self-start`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`mb-1.5 px-3 font-medium text-[11px] text-ink-4 uppercase tracking-[0.14em]`,children:H(`integrate.groupApps`)}),(0,W.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:f.map(e=>(0,W.jsx)(Z,{selected:e.id===p.id,title:e.name,widgets:e.widgets,onPick:()=>a(e.id),...m(e.id)},e.id))})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`mb-1.5 px-3 font-medium text-[11px] text-ink-4 uppercase tracking-[0.14em]`,children:H(`integrate.groupShare`)}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,W.jsx)(Z,{selected:!1,disabled:!0,title:H(`integrate.shareLink`),note:H(`integrate.soon`)}),(0,W.jsx)(Z,{selected:!1,disabled:!0,title:H(`integrate.shareSite`),note:H(`integrate.soon`)})]})]})]}),(0,W.jsx)(_t,{client:p,local:c(p.id),seen:u(p.id),managed:t,url:o},p.id)]}),t?null:(0,W.jsx)(mt,{}),(0,W.jsxs)(`p`,{className:`flex items-start gap-2 text-[13px] text-ink-3`,children:[(0,W.jsx)(ee,{className:`mt-0.5 size-3.5 shrink-0`}),H(`mcp.notReverse`)]})]})}function yt(e){return H(e.origin===`local`?`readonly.project`:`readonly.server`)}function bt({children:e}){return(0,W.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-paper-2 px-4 py-3 text-[14px] text-ink-2 leading-relaxed`,children:[(0,W.jsx)(ae,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,W.jsx)(`p`,{className:`min-w-0`,children:e})]})}function xt(e){return e.type.startsWith(`image/`)&&/logo/i.test(e.name)?`logo`:/^(image|video|audio)\//.test(e.type)?`asset`:`document`}function St(e,t){let n=u(),[r,i]=(0,U.useState)([]),[a,s]=(0,U.useState)(`idle`),[c,d]=(0,U.useState)(null),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)(null),g=(0,U.useRef)(null),_=()=>(g.current??=(async()=>{await Promise.all([n.invalidateQueries({queryKey:[`projects`]}),n.invalidateQueries({queryKey:[`project-files`,e]})]),t(),g.current=null})(),g.current);return{messages:r,phase:a,activity:f,startedAt:m,error:c,send:async(t,c=[])=>{if(!(t.trim()||c.length)||a!==`idle`)return!1;if(d(null),s(`thinking`),h(Date.now()),c.length){try{for(let t of c)await l.upload(`/api/studio/projects/${e}/files?kind=${xt(t)}`,t)}catch(e){return d(e.message),s(`idle`),h(null),await _(),!1}await _();let n=`${H(`editor.attached`)}: ${c.map(e=>e.name).join(`, `)}`;t=t.trim()?`${t}\n\n${n}`:n}let u=r.map(({role:e,content:t})=>({role:e,content:t})).slice(-12),f=`p-${Date.now()}`;i(e=>[...e,{id:`u-${Date.now()}`,role:`user`,content:t,previews:oe(c)},{id:f,role:`assistant`,content:``,pending:!0}]),p(null);let m=!1;try{await o(`/api/studio/projects/${e}/assist`,{message:t,history:u},(e,t)=>{if(e===`text`){let e=JSON.parse(t);i(t=>t.map(t=>t.id===f?{...t,content:t.content+e}:t))}else if(e===`activity`)p(JSON.parse(t));else if(e===`changed`)s(`building`),_();else if(e===`done`){m=!0;let e=JSON.parse(t);i(t=>t.map(t=>t.id===f?{...t,content:e.reply,changed:e.changed,pending:!1}:t))}else e===`error`&&(m=!0,d(JSON.parse(t).message))}),m||d(H(`editor.chatBroken`))}catch(e){d(e.message)}finally{p(null),h(null),i(e=>e.filter(e=>!(e.id===f&&!e.content)).map(e=>({...e,pending:!1}))),s(`idle`),await g.current,await _(),await n.invalidateQueries({queryKey:[`me`]})}return!0}}}function Ct(){return(0,W.jsxs)(`div`,{className:`sm:pr-36`,children:[(0,W.jsx)(`h2`,{className:`font-display font-semibold text-[20px] leading-tight tracking-tight`,children:H(`project.assistantTitle`)}),(0,W.jsx)(`p`,{className:`mt-1.5 max-w-2xl text-[15px] text-ink-2 leading-relaxed`,children:H(`project.assistantHello`)})]})}var wt=72,Tt=720;function Et({projectId:e,onChanged:t}){let n=St(e,t),r=(0,U.useRef)(null),[i,o]=(0,U.useState)(null);return(0,U.useEffect)(()=>{let e=()=>{let e=r.current?.getBoundingClientRect();e&&o(t=>{if(e.bottom>=wt)return null;let n=Math.min(e.width,Tt),r=e.left+(e.width-n)/2;return t&&t.left===r&&t.width===n?t:{left:r,width:n,height:t?.height??e.height}})};return e(),window.addEventListener(`scroll`,e,{passive:!0}),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e),window.removeEventListener(`resize`,e)}},[]),(0,W.jsxs)(`div`,{ref:r,style:i?{minHeight:i.height}:void 0,children:[(0,W.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 px-1 font-medium text-[12px] text-ember-strong uppercase tracking-[0.07em]`,children:[(0,W.jsx)(ne,{className:`size-3.5`}),` `,H(`project.assistant`)]}),(0,W.jsxs)(`div`,{className:`relative`,children:[!i&&n.messages.length===0?(0,W.jsx)(`div`,{className:`absolute -top-14 right-10 z-10 max-sm:hidden`,children:(0,W.jsx)(a,{kind:`round`,size:104})}):null,(0,W.jsx)(`div`,{className:F(`flex flex-col overflow-hidden bg-card`,i?`fixed bottom-4 z-30 max-h-[70dvh] animate-dock rounded-2xl shadow-overlay ring-1 ring-border`:`max-h-[520px] rounded-xl bg-linear-to-br from-ember-tint via-card to-card shadow-soft ring-1 ring-ember-veil`),style:i?{left:i.left,width:i.width}:void 0,children:(0,W.jsx)(se,{chat:n,avatar:`round`,compact:!!i,intro:(0,W.jsx)(Ct,{}),placeholder:H(`project.assistantComposer`),changedLabel:H(`project.assistantChanged`)})})]})]})}var Dt=[`text`,`longtext`,`number`,`date`,`url`,`email`,`phone`,`boolean`],Ot=/^(\d{4}-\d{2}-\d{2}|\d{1,2}\.\s?\d{1,2}\.\s?\d{4})$/,kt=/^[+-]?\d{1,3}([.,\s']?\d{3})*([.,]\d+)?$/,At=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,jt=/^(https?:\/\/|www\.)\S+$/i,Mt=/^\+?[\d\s()/.-]{7,20}$/,Nt=/^(ja|nein|yes|no|true|false)$/i;function Pt(e){let t=e.trim();return t?t.includes(`
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,S as i,d as a,i as o,j as s,k as c,n as l,nt as u,w as d}from"./api-C7nO5qT8.js";import{c as f,f as p,s as m,u as h}from"./session-C44_g_hY.js";import{t as g}from"./createLucideIcon-q3MZMmnf.js";import{n as _,t as v}from"./plug-CLjyCoHB.js";import{t as y}from"./arrow-right-6FyN3e7D.js";import{D as b,E as x,S,T as ee,r as C,w as te,x as ne,y as w}from"./outputs-Cy_I6D0i.js";import{t as T}from"./check-CUpby_J9.js";import{n as E,r as re,t as ie}from"./wand-sparkles-CKxArWPY.js";import{a as ae,r as oe,t as se}from"./ChatPanel-Dnpk2feK.js";import{n as ce,t as le}from"./upload-DNRENWzQ.js";import{n as ue,t as D}from"./plus-Du-Jx8aI.js";import{t as de}from"./external-link-MAL7vJYj.js";import{n as fe}from"./mic-Bvz4mA2j.js";import{n as pe,r as me,t as he}from"./type-DnfgUhpM.js";import{a as ge,c as _e,d as O,f as ve,i as k,l as A,o as ye,p as be,s as j,t as xe,u as M}from"./Account-knfyfyOq.js";import{p as Se}from"./definition-DndaH5Ow.js";import{_ as Ce,a as we,c as N,d as P,f as Te,h as F,i as I,m as Ee,n as L,o as R,p as De,r as z,s as B,t as V,u as Oe,y as H}from"./ui-BHAxG0j4.js";import{d as ke,f as Ae,l as je,m as Me,p as Ne}from"./index-Dp8RnbHf.js";import{t as Pe}from"./LocalRuntime-DwCJawPW.js";import{ProjectSwitcher as Fe}from"./HomePage-C29lUDnZ.js";var Ie={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};Ie.node;var Le=g(Ie),Re={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};Re.node;var ze=g(Re),Be={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};Be.node;var Ve=g(Be),He={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};He.node;var Ue=g(He),We={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};We.node;var Ge=g(We),Ke={name:`music`,size:24,node:[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]};Ke.node;var qe=g(Ke),Je={name:`phone`,size:24,node:[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]};Je.node;var Ye=g(Je),Xe={name:`rotate-cw`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]};Xe.node;var Ze=g(Xe),Qe={name:`text-align-start`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]],aliases:[`text`,`align-left`]};Qe.node;var $e=g(Qe),et={name:`toggle-left`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]};et.node;var tt=g(et),nt={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};nt.node;var rt=g(nt),U=e(t(),1),W=e(n(),1);function it(){let e=Me(),[t,n]=(0,U.useState)(null),[r,i]=(0,U.useState)(null),a=async e=>{n(e??`*`),i(null);try{await Ne(e)}catch(e){i(e.message)}finally{n(null)}};return(0,W.jsxs)(j,{title:H(`plugins.title`),hint:e.canReload?H(`plugins.hint`):H(`plugins.hintManaged`),action:e.canReload?(0,W.jsx)(V,{variant:`secondary`,busy:t===`*`,onClick:()=>void a(),children:H(`plugins.rescan`)}):null,children:[(0,W.jsxs)(`ul`,{className:`divide-y divide-border-soft`,children:[e.plugins.map(n=>{let r=e.failed[n.id];return(0,W.jsxs)(`li`,{className:`flex items-start gap-4 py-4 first:pt-0 last:pb-0`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,W.jsx)(`span`,{className:`font-medium text-[15px]`,children:n.name}),n.name===n.id?null:(0,W.jsxs)(`span`,{className:`font-mono text-[12px] text-ink-4`,children:[n.id,` · `,n.version]})]}),n.description?(0,W.jsx)(`p`,{className:`mt-0.5 text-[14px] text-ink-3`,children:n.description}):null,n.tools.length?(0,W.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[12px] text-ink-3`,children:[H(`plugins.tools`),n.tools.map(e=>(0,W.jsx)(z,{children:e.id},e.id))]}):null,n.error?(0,W.jsx)(`p`,{className:`mt-2 text-[13px] text-rose`,children:H(`plugins.serverFailed`,{error:n.error})}):null,r?(0,W.jsx)(`p`,{className:`mt-2 text-[13px] text-rose`,children:H(`plugins.studioFailed`,{error:r})}):null]}),e.canReload?(0,W.jsx)(R,{label:H(`plugins.reload`),disabled:t!==null,onClick:()=>void a(n.id),children:(0,W.jsx)(Ze,{className:t===n.id?`size-4 animate-spin`:`size-4`})}):null]},n.id)}),e.problems.map(e=>(0,W.jsxs)(`li`,{className:`py-4 first:pt-0 last:pb-0`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,W.jsx)(z,{tone:`warn`,children:H(`plugins.problems`)}),(0,W.jsx)(`span`,{className:`break-all font-mono text-[12px] text-ink-3`,children:e.path})]}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:e.message})]},e.path))]}),r?(0,W.jsx)(`p`,{className:`mt-4 text-[13px] text-rose`,children:r}):null]})}function at({connector:e}){let[t,n]=(0,U.useState)(!1);return(0,W.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-3 px-3 py-2 text-left`,children:[(0,W.jsx)(`span`,{className:F(`size-2 shrink-0 rounded-full`,e.usable?`bg-moss`:`bg-ink-4`)}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:[e.name,` `,(0,W.jsx)(`span`,{className:`font-mono text-[11px] text-ink-4`,children:e.id})]}),(0,W.jsx)(`span`,{className:`shrink-0 text-[12px] text-ink-3`,children:e.usable?H(`connectors.actions`,{n:e.actions.length,r:e.actions.filter(e=>e.group===`read`).length}):H(`connectors.notSetUp`)})]}),t?(0,W.jsxs)(`div`,{className:`border-border-soft border-t px-3 py-2 text-[12px]`,children:[e.missingSetup?(0,W.jsxs)(`p`,{className:`mb-1 text-ink-3`,children:[H(`connectors.setup`),` `,(0,W.jsx)(`span`,{className:`font-mono text-ink-2`,children:e.missingSetup})]}):null,(0,W.jsx)(`p`,{className:`text-ink-4`,children:e.actions.map(e=>e.group===`read`?e.id:`${e.id} (${H(`connectors.group.${e.group}`)})`).join(` · `)})]}):null]})}var ot={none:`connectors.authNone`,oauth2:`connectors.authOauth`,api_key:`connectors.authKey`};function st({projectId:e,connector:t,readOnly:n}){let r=u(),[i,a]=(0,U.useState)(!1),o=()=>r.invalidateQueries({queryKey:[`connectors`,e]}),s=`/api/studio/projects/${e}/connectors/${t.id}`,c=p({mutationFn:()=>l.post(`${s}/refresh`),onSuccess:o}),d=p({mutationFn:()=>l.del(s),onSuccess:o}),f=t.actions.filter(e=>e.group===`read`).length;return(0,W.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,W.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-paper-2 text-ink-2`,children:(0,W.jsx)(v,{className:`size-4`})}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`min-w-0 flex-1 text-left`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate font-medium text-[14px]`,children:t.name}),(0,W.jsx)(`span`,{className:`font-mono text-[11px] text-ink-4`,children:t.id})]}),(0,W.jsxs)(`div`,{className:`truncate text-[12px] text-ink-3`,children:[t.domain,` · `,t.sourceKind===`mcp`?`MCP`:`OpenAPI`,` ·`,` `,H(ot[t.auth]),` ·`,` `,t.toolsPending?H(`connectors.pending`):H(`connectors.actions`,{n:t.actions.length,r:f})]})]}),n?null:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R,{label:H(`connectors.refresh`),onClick:()=>c.mutate(),children:c.isPending?(0,W.jsx)(P,{className:`size-4`}):(0,W.jsx)(Se,{className:`size-4`})}),(0,W.jsx)(R,{label:H(`connectors.remove`),className:`hover:text-rose`,onClick:()=>confirm(`${t.name}: ${H(`connectors.remove`)}?`)&&d.mutate(),children:(0,W.jsx)(w,{className:`size-4`})})]})]}),t.needsOAuthClient?(0,W.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[12px] text-rose`,children:H(`connectors.needsClient`)}):null,c.error??d.error?(0,W.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[12px] text-rose`,children:(c.error??d.error).message}):null,i&&t.actions.length?(0,W.jsx)(`ul`,{className:`max-h-64 overflow-y-auto border-border-soft border-t px-3 py-2`,children:t.actions.map(e=>(0,W.jsxs)(`li`,{className:`flex items-baseline gap-2 py-1 text-[12px]`,children:[(0,W.jsx)(`span`,{className:F(`w-14 shrink-0 text-[11px] uppercase tracking-wide`,e.group===`read`?`text-moss`:e.group===`write`?`text-ink-3`:`text-rose`),children:H(`connectors.group.${e.group}`)}),(0,W.jsx)(`span`,{className:`shrink-0 font-mono text-ink-2`,children:e.id}),(0,W.jsx)(`span`,{className:`min-w-0 truncate text-ink-4`,children:e.summary})]},e.id))}):null]})}function ct({projectId:e,domain:t,source:n,taken:r,onDone:i}){let a=u(),[o,s]=(0,U.useState)({id:``,secret:``}),[c,d]=(0,U.useState)(!1),f=r.includes(n.suggestedId),m=p({mutationFn:()=>l.post(`/api/studio/projects/${e}/connectors`,{domain:t,sourceKind:n.sourceKind,sourceUrl:n.sourceUrl,id:n.suggestedId,toolPrefix:n.suggestedToolPrefix,...n.name?{name:n.name}:{},...o.id&&o.secret?{oauthClientId:o.id,oauthClientSecret:o.secret}:{}}),onSuccess:async t=>{await a.invalidateQueries({queryKey:[`connectors`,e]}),i(t.warnings)}});return(0,W.jsxs)(`div`,{className:`rounded-lg bg-card p-3 ring-1 ring-border-soft`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(z,{tone:n.sourceKind===`mcp`?`ember`:`neutral`,children:n.sourceKind===`mcp`?`MCP`:`OpenAPI`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate text-[13px]`,children:n.name??n.suggestedId}),(0,W.jsx)(`div`,{className:`truncate font-mono text-[11px] text-ink-4`,children:n.sourceUrl})]}),n.blocked||f?null:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>d(e=>!e),className:`text-[12px] text-ink-3 hover:text-ink`,children:H(`connectors.ownClient`)}),(0,W.jsx)(V,{size:`sm`,busy:m.isPending,onClick:()=>m.mutate(),children:H(`connectors.import`)})]})]}),n.blocked?(0,W.jsx)(`p`,{className:`mt-2 text-[12px] text-ink-3`,children:n.blocked}):null,f?(0,W.jsx)(`p`,{className:`mt-2 text-[12px] text-ink-3`,children:H(`connectors.exists`)}):null,c?(0,W.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:[(0,W.jsx)(B,{placeholder:`OAuth Client-ID`,value:o.id,onChange:e=>s(t=>({...t,id:e.target.value}))}),(0,W.jsx)(B,{type:`password`,autoComplete:`off`,placeholder:`OAuth Client-Secret`,value:o.secret,onChange:e=>s(t=>({...t,secret:e.target.value}))})]}):null,m.error?(0,W.jsx)(`p`,{className:`mt-2 text-[12px] text-rose`,children:m.error.message}):null]})}function lt({projectId:e,readOnly:t}){let[n,r]=(0,U.useState)(``),[i,a]=(0,U.useState)(null),[o,c]=(0,U.useState)(null),[u,d]=(0,U.useState)([]),f=s({queryKey:[`connectors`,e],queryFn:()=>l.get(`/api/studio/projects/${e}/connectors`)}),m=p({mutationFn:()=>l.post(`/api/studio/connectors/search`,{query:n}),onSuccess:e=>{a(e),c(null),d([])}}),h=p({mutationFn:e=>l.get(`/api/studio/connectors/registry/${encodeURIComponent(e)}`),onSuccess:c}),g=f.data??[],_=g.filter(e=>e.sourceKind===`builtin`&&(ke.unsetConnectors||e.usable)),v=g.filter(e=>e.sourceKind!==`builtin`);return(0,W.jsxs)(L,{className:`p-6`,children:[(0,W.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:H(`connectors.title`)}),(0,W.jsx)(`p`,{className:`mt-1 mb-5 text-[14px] text-ink-3`,children:H(`connectors.hint`)}),_.length?(0,W.jsx)(`div`,{className:`mb-5 grid gap-1.5 sm:grid-cols-2`,children:_.map(e=>(0,W.jsx)(at,{connector:e},e.id))}):null,(0,W.jsx)(`h3`,{className:`mb-2 font-medium text-[12px] text-ink-3 uppercase tracking-[0.07em]`,children:H(`connectors.imported`)}),v.length?(0,W.jsx)(`div`,{className:`mb-4 flex flex-col gap-2`,children:v.map(n=>(0,W.jsx)(st,{projectId:e,connector:n,readOnly:t},n.id))}):null,t?v.length?null:(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:H(`connectors.noneImported`)}):(0,W.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),n.trim()&&m.mutate()},children:[(0,W.jsx)(B,{value:n,placeholder:H(`connectors.search`),onChange:e=>r(e.target.value)}),(0,W.jsxs)(V,{type:`submit`,variant:`secondary`,busy:m.isPending,children:[(0,W.jsx)(ce,{className:`size-4`}),` `,H(`connectors.find`)]})]}),m.error?(0,W.jsx)(`p`,{className:`mt-3 text-[13px] text-rose`,children:m.error.message}):null,i&&!o?(0,W.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1`,children:[i.length?null:(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:H(`connectors.none`)}),i.map(e=>(0,W.jsxs)(`button`,{type:`button`,disabled:!e.kinds.length,onClick:()=>h.mutate(e.domain),className:`flex items-center gap-3 rounded-lg px-3 py-2 text-left transition hover:bg-paper-2 disabled:opacity-50`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate text-[14px]`,children:e.domain}),(0,W.jsx)(`div`,{className:`truncate text-[12px] text-ink-3`,children:e.description})]}),(0,W.jsx)(`span`,{className:`text-[11px] text-ink-4 uppercase`,children:e.kinds.join(` · `)}),(0,W.jsx)(re,{className:`-rotate-90 size-4 text-ink-4`})]},e.domain)),h.isPending?(0,W.jsx)(P,{className:`mx-auto mt-2 size-4 text-ink-4`}):null,h.error?(0,W.jsx)(`p`,{className:`text-[13px] text-rose`,children:h.error.message}):null]}):null,o?(0,W.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,W.jsx)(`div`,{className:`font-medium text-[14px]`,children:o.domain}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>c(null),className:`text-[12px] text-ink-3 hover:text-ink`,children:H(`run.back`)})]}),o.summary?(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:o.summary}):null,o.sources.map(t=>(0,W.jsx)(ct,{projectId:e,domain:o.domain,source:t,taken:g.map(e=>e.id),onDone:d},`${t.sourceKind}:${t.sourceUrl}`)),o.credentials.filter(e=>e.setup||e.url).map(e=>(0,W.jsxs)(`p`,{className:`text-[12px] text-ink-3`,children:[(0,W.jsxs)(`span`,{className:`text-ink-2`,children:[e.label,`:`]}),` `,e.setup,` `,e.url?(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-ember underline`,children:e.url}):null]},e.label)),u.map(e=>(0,W.jsx)(`p`,{className:`text-[12px] text-ink-3`,children:e},e))]}):null]})}var G=`engenty-wizards`,ut=`ENGENTY_WIZARDS_KEY`,dt=[{id:`claude-desktop`,name:`Claude Desktop`,widgets:!0},{id:`claude-code`,name:`Claude Code`,widgets:!1},{id:`codex`,name:`Codex · ChatGPT app`,widgets:!1},{id:`cursor`,name:`Cursor`,widgets:!0},{id:`vscode`,name:`VS Code (Copilot)`,widgets:!0},{id:`windsurf`,name:`Windsurf`,widgets:!1},{id:`gemini`,name:`Gemini CLI`,widgets:!1},{id:`goose`,name:`Goose`,widgets:!0},{id:`openclaw`,name:`OpenClaw`,widgets:!1},{id:`lm-studio`,name:`LM Studio`,widgets:!1},{id:`claude-ai`,name:`claude.ai`,widgets:!0,oauth:!0},{id:`chatgpt`,name:`ChatGPT`,widgets:!0,oauth:!0}];function K({text:e}){let[t,n]=(0,U.useState)(!1);return(0,W.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg bg-paper-2 p-3`,children:[(0,W.jsx)(`code`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-all font-mono text-[12px] leading-relaxed`,children:e}),(0,W.jsx)(R,{label:H(t?`settings.copied`:`settings.copy`),onClick:async()=>{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},children:t?(0,W.jsx)(T,{className:`size-4`}):(0,W.jsx)(ue,{className:`size-4`})})]})}function ft(e){try{let t=new URL(e);return t.protocol===`https:`&&!/(^|\.)localhost$/.test(t.hostname)&&!/^(127\.|10\.|192\.168\.|\[::1\])/.test(t.hostname)}catch{return!1}}function q({children:e}){return(0,W.jsx)(`p`,{className:`text-[14px] text-ink-3`,children:e})}function J({title:e,children:t}){return(0,W.jsxs)(`section`,{className:`flex flex-col gap-2.5 border-border-soft border-t pt-5 first:border-t-0 first:pt-0`,children:[(0,W.jsx)(`h3`,{className:`font-medium text-[15px]`,children:e}),t]})}function Y(e,t){return JSON.stringify({[e]:{[G]:t}},null,2)}function pt({id:e,url:t,apiKey:n}){let r=n?`Authorization: Bearer ${n}`:null,i=n?{headers:{Authorization:`Bearer ${n}`}}:{};switch(e){case`claude-code`:{let e=t.replace(/\/api\/mcp$/,`/api/claude-plugin`);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`mcp.terminal`)}),(0,W.jsx)(K,{text:`claude mcp add --transport http --scope user ${G} ${t}${r?` --header "${r}"`:``}`}),!n&&ft(t)?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`mcp.ccPlugin`)}),(0,W.jsx)(K,{text:`claude plugin marketplace add ${e}/marketplace.json`}),(0,W.jsx)(K,{text:`claude plugin install ${G}@engenty`})]}):null]})}case`codex`:return n?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`mcp.codexKey`)}),(0,W.jsx)(K,{text:`echo 'export ${ut}=${n}' >> ~/.zshrc && source ~/.zshrc`}),(0,W.jsx)(K,{text:`codex mcp add ${G} --url ${t} --bearer-token-env-var ${ut}`})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`mcp.terminal`)}),(0,W.jsx)(K,{text:`codex mcp add ${G} --url ${t}`}),(0,W.jsx)(K,{text:`codex mcp login ${G}`})]});case`gemini`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`mcp.terminal`)}),(0,W.jsx)(K,{text:`gemini mcp add --scope user --transport http ${G} ${t}${r?` -H "${r}"`:``}`})]});case`cursor`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`integrate.file`,{file:`~/.cursor/mcp.json`})}),(0,W.jsx)(K,{text:Y(`mcpServers`,{url:t,...i})})]});case`vscode`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`integrate.vscode`)}),(0,W.jsx)(K,{text:Y(`servers`,{type:`http`,url:t,...i})})]});case`windsurf`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`integrate.file`,{file:`~/.codeium/windsurf/mcp_config.json`})}),(0,W.jsx)(K,{text:Y(`mcpServers`,{serverUrl:t,...i})})]});case`lm-studio`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`integrate.file`,{file:`~/.lmstudio/mcp.json`})}),(0,W.jsx)(K,{text:Y(`mcpServers`,{url:t,...i})})]});case`claude-desktop`:case`claude-ai`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`mcp.claudeAi`)}),(0,W.jsx)(K,{text:t})]});case`chatgpt`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`integrate.chatgpt`)}),(0,W.jsx)(K,{text:t})]});default:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`integrate.generic`)}),(0,W.jsx)(K,{text:t}),r?(0,W.jsx)(K,{text:r}):null]})}}function mt(){let e=u(),t=s({queryKey:[`api-keys`],queryFn:()=>l.get(`/api/studio/api-keys`)}),n=p({mutationFn:e=>l.del(`/api/studio/api-keys/${e}`),onSuccess:()=>e.invalidateQueries({queryKey:[`api-keys`]})});return t.data?.length?(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:H(`mcp.keys`)}),(0,W.jsx)(`p`,{className:`mt-1 mb-4 text-[14px] text-ink-3`,children:H(`mcp.keysHint`)}),(0,W.jsx)(L,{className:`flex flex-col gap-2 p-3`,children:t.data.map(e=>(0,W.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg px-3 py-2`,children:[(0,W.jsx)(Ue,{className:`size-4 shrink-0 text-ink-4`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate text-[14px]`,children:e.name}),(0,W.jsxs)(`div`,{className:`font-mono text-[11px] text-ink-4`,children:[e.start,`… ·`,` `,e.lastRequest?H(`settings.lastUsed`,{when:new Date(e.lastRequest).toLocaleString()}):H(`settings.neverUsed`)]})]}),(0,W.jsx)(R,{label:H(`settings.revoke`),onClick:()=>n.mutate(e.id),className:`hover:text-rose`,children:(0,W.jsx)(w,{className:`size-4`})})]},e.id))})]}):null}function X({state:e,title:t,children:n}){return(0,W.jsxs)(`li`,{className:`grid grid-cols-[22px_minmax(0,1fr)] gap-x-3`,children:[(0,W.jsx)(`span`,{className:F(`mt-0.5 grid size-[22px] place-items-center rounded-full`,e===`done`&&`bg-moss text-white`,e===`now`&&`bg-amber-tint text-ink-2`,e===`later`&&`bg-paper-2 ring-1 ring-border-soft`),children:e===`done`?(0,W.jsx)(T,{className:`size-3.5`,strokeWidth:3}):e===`now`?(0,W.jsx)(P,{className:`size-3`}):null}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 pb-4`,children:[(0,W.jsx)(`span`,{className:F(`text-[14px]`,e===`later`?`text-ink-3`:`font-medium`),children:t}),e===`now`?n:null]})]})}function ht({widgets:e}){return(0,W.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,W.jsxs)(`div`,{className:`rounded-xl bg-paper p-4 ring-1 ring-border-soft`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-[14px]`,children:[(0,W.jsx)(rt,{className:`size-4 text-ember-strong`}),` MCP`]}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:H(`integrate.kindMcp`)})]}),(0,W.jsxs)(`div`,{className:F(`rounded-xl p-4 ring-1`,e?`bg-paper ring-border-soft`:`bg-paper-2/60 ring-border-soft/60`),children:[(0,W.jsxs)(`div`,{className:F(`flex items-center gap-2 font-medium text-[14px]`,e?null:`text-ink-3`),children:[(0,W.jsx)(_,{className:F(`size-4`,e?`text-ember-strong`:`text-ink-4`)}),` MCP App`]}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:H(e?`integrate.kindApp`:`integrate.kindAppNo`)})]})]})}function Z({selected:e,title:t,note:n,tone:r,widgets:i,disabled:a,onPick:o}){return(0,W.jsxs)(`button`,{type:`button`,disabled:a,onClick:o,"aria-pressed":e,className:F(`group flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left transition`,e?`bg-card shadow-soft ring-1 ring-border-soft`:`hover:bg-accent`,a&&`cursor-default opacity-55 hover:bg-transparent`),children:[(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate font-medium text-[14px]`,children:t}),i?(0,W.jsx)(`span`,{title:`MCP App`,className:`rounded bg-ember-tint px-1 font-semibold text-[10px] text-ember-strong leading-4`,children:`APP`}):null]}),n?(0,W.jsxs)(`span`,{className:F(`flex items-center gap-1 text-[12px]`,r===`done`?`text-moss`:r===`ok`?`text-ink-2`:`text-ink-4`),children:[r===`done`?(0,W.jsx)(T,{className:`size-3`,strokeWidth:3}):null,n]}):null]}),a?null:(0,W.jsx)(y,{className:F(`size-3.5 shrink-0 transition`,e?`text-ink-3`:`text-ink-4 opacity-0 group-hover:opacity-100`)})]})}function gt({at:e,done:t}){let n=[H(`setup.stage.connect`),H(`setup.stage.test`),H(`setup.stage.done`)];return(0,W.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-medium text-[11px] uppercase tracking-[0.14em]`,children:n.map((n,r)=>{let i=t||r<e;return(0,W.jsxs)(`li`,{"aria-current":!i&&r===e?`step`:void 0,className:F(`flex items-center gap-1`,i?`text-moss`:r===e?`text-ember-strong`:`text-ink-4`),children:[i?(0,W.jsx)(T,{className:`size-3`,strokeWidth:3}):null,n]},n)})})}function _t({client:e,local:t,seen:n,managed:r,url:i}){let a=u(),o=ft(i),s=!r&&!!t&&!e.oauth,[c,d]=(0,U.useState)(s&&t?.installed!==!1?`here`:`address`),[f,m]=(0,U.useState)(null),[h,g]=(0,U.useState)(),_=p({mutationFn:t=>l.post(`/api/studio/local/apps/${e.id}`,{connect:t}),onSuccess:e=>m(e),onError:e=>m({ok:!1,message:e.message}),onSettled:()=>a.invalidateQueries({queryKey:[`local-apps`]})}),v=p({mutationFn:()=>l.post(`/api/studio/api-keys`,{name:e.name.slice(0,32)}),onSuccess:async e=>{g(e.key),await a.invalidateQueries({queryKey:[`api-keys`]})}}),y=e.oauth===!0||e.id===`claude-desktop`,b=c===`address`&&y&&!(r&&o),x=c===`here`?!!t?.connected:r||!!h,S=!!n?.toolAt,ee=S?2:x||n?1:0,C=e=>(0,W.jsx)(K,{text:e});return(0,W.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(gt,{at:ee,done:S}),(0,W.jsx)(`h2`,{className:`mt-1.5 font-display font-semibold text-[26px] leading-tight tracking-tight`,children:e.name}),(0,W.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3`,children:e.widgets?H(`integrate.leadApp`):H(`integrate.leadMcp`)})]}),(0,W.jsx)(ht,{widgets:e.widgets}),(0,W.jsxs)(L,{className:`flex flex-col gap-6 p-6`,children:[s||!e.oauth?(0,W.jsx)(J,{title:H(`integrate.where`),children:(0,W.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[`here`,`address`].map(e=>{let t=e===`here`&&!s;return(0,W.jsxs)(`button`,{type:`button`,disabled:t,onClick:()=>d(e),"aria-pressed":c===e,className:F(`flex items-start gap-3 rounded-xl p-3.5 text-left ring-1 transition`,c===e?`bg-ember-tint/50 ring-ember-strong/40`:`ring-border-soft hover:bg-accent`,t&&`cursor-not-allowed opacity-50 hover:bg-transparent`),children:[e===`here`?(0,W.jsx)(Ge,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}):(0,W.jsx)(me,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,W.jsxs)(`span`,{className:`min-w-0`,children:[(0,W.jsx)(`span`,{className:`block font-medium text-[14px]`,children:H(e===`here`?`integrate.here`:`integrate.address`)}),(0,W.jsx)(`span`,{className:`block text-[12px] text-ink-3`,children:H(e===`here`?r?`integrate.hereManaged`:`integrate.hereHint`:`integrate.addressHint`)})]})]},e)})})}):null,b?(0,W.jsx)(J,{title:H(`mcp.notHere`),children:(0,W.jsx)(q,{children:H(r?`mcp.needsPublic`:`integrate.oauthLocal`)})}):c===`here`?(0,W.jsxs)(J,{title:H(`integrate.connectTitle`),children:[t?.installed===!1&&!t.connected?(0,W.jsx)(q,{children:H(`integrate.notInstalled`,{app:e.name})}):null,t?.connected?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-2 text-[14px] text-ink-2`,children:[(0,W.jsx)(T,{className:`size-4 text-moss`}),H(`integrate.connected`,{app:e.name})]}),(0,W.jsx)(V,{size:`sm`,variant:`ghost`,busy:_.isPending&&_.variables===!1,onClick:()=>_.mutate(!1),children:H(`mcp.appsDisconnect`)})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`integrate.connectHint`,{app:e.name})}),(0,W.jsx)(`div`,{children:(0,W.jsxs)(V,{busy:_.isPending,onClick:()=>_.mutate(!0),children:[(0,W.jsx)(D,{className:`size-4`}),` `,H(`integrate.connect`,{app:e.name})]})})]}),f&&!f.ok?(0,W.jsx)(`p`,{className:`text-[13px] text-rose`,children:f.message}):null,f?.snippet?(0,W.jsx)(K,{text:f.snippet}):null,t?.where?(0,W.jsx)(`p`,{className:`font-mono text-[11px] text-ink-4`,children:t.where}):null]}):(0,W.jsxs)(W.Fragment,{children:[r||y?null:(0,W.jsx)(J,{title:H(`mcp.keyTitle`),children:h?(0,W.jsxs)(`p`,{className:`flex items-center gap-2 text-[14px] text-ink-2`,children:[(0,W.jsx)(T,{className:`size-4 text-moss`}),` `,H(`mcp.keyReady`)]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{children:H(`mcp.keyHint`)}),(0,W.jsx)(`div`,{children:(0,W.jsxs)(V,{variant:`secondary`,busy:v.isPending,onClick:()=>v.mutate(),children:[(0,W.jsx)(D,{className:`size-4`}),` `,H(`mcp.keyCreate`,{client:e.name})]})})]})}),(0,W.jsxs)(J,{title:H(`mcp.add`),children:[r||h||y?(0,W.jsx)(pt,{id:e.id,url:i,apiKey:h}):(0,W.jsx)(q,{children:H(`mcp.keyFirst`)}),r?(0,W.jsx)(q,{children:H(`mcp.oauth`)}):null,(0,W.jsx)(`p`,{className:`text-[12px] text-ink-4`,children:H(o?`mcp.addressPublic`:`mcp.addressLocal`)})]})]}),b?null:(0,W.jsxs)(J,{title:H(`integrate.test`),children:[(0,W.jsxs)(`ol`,{className:`flex flex-col`,children:[(0,W.jsx)(X,{state:n?`done`:x?`now`:`later`,title:H(`integrate.seen`,{app:e.name}),children:(0,W.jsx)(q,{children:H(c===`here`?`integrate.restart`:`integrate.reload`,{app:e.name})})}),(0,W.jsxs)(X,{state:n?.toolAt?`done`:n?`now`:`later`,title:H(`integrate.tool`),children:[(0,W.jsx)(q,{children:H(`integrate.askHint`,{app:e.name})}),C(H(`integrate.askTool`))]}),e.widgets?(0,W.jsxs)(X,{state:n?.widgetAt?`done`:n?.toolAt?`now`:`later`,title:H(`integrate.widget`),children:[(0,W.jsx)(q,{children:H(`integrate.widgetHint`)}),C(H(`integrate.askWidget`))]}):null]}),S?(0,W.jsxs)(`p`,{className:`flex items-center gap-2 font-medium text-[14px] text-moss`,children:[(0,W.jsx)(T,{className:`size-4`,strokeWidth:3}),H(`integrate.works`,{app:e.name})]}):null]})]})]})}function vt(){let e=h(),t=e.data?.mode===`managed`,n=s({queryKey:[`local-apps`],queryFn:()=>l.get(`/api/studio/local/apps`),enabled:e.data?.mode===`local`}),r=s({queryKey:[`integrations-seen`],queryFn:()=>l.get(`/api/studio/integrations/seen`),refetchInterval:2500}),[i,a]=(0,U.useState)(null);if(!e.data||!t&&!n.data)return null;let o=e.data.mcpUrl??``,c=e=>n.data?.find(t=>t.id===e),u=e=>r.data?.[e],d=e=>{let t=c(e);return t?.installed||t?.connected?0:1},f=[...dt].sort((e,t)=>d(e.id)-d(t.id)),p=f.find(e=>e.id===i)??f[0],m=e=>{let t=c(e);return u(e)?.toolAt?{note:H(`integrate.stateWorks`),tone:`done`}:t?.connected?{note:H(`integrate.stateConnected`),tone:`ok`}:t?.installed?{note:H(`integrate.stateInstalled`),tone:`dim`}:{}};return(0,W.jsxs)(`div`,{className:`flex flex-col gap-10`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h2`,{className:`font-display font-semibold text-[22px] tracking-tight`,children:H(`integrate.title`)}),(0,W.jsx)(`p`,{className:`mt-1 max-w-2xl text-[14px] text-ink-2`,children:H(`integrate.lead`)})]}),(0,W.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-[16rem_minmax(0,1fr)]`,children:[(0,W.jsxs)(`nav`,{className:`flex flex-col gap-5 lg:sticky lg:top-24 lg:self-start`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`mb-1.5 px-3 font-medium text-[11px] text-ink-4 uppercase tracking-[0.14em]`,children:H(`integrate.groupApps`)}),(0,W.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:f.map(e=>(0,W.jsx)(Z,{selected:e.id===p.id,title:e.name,widgets:e.widgets,onPick:()=>a(e.id),...m(e.id)},e.id))})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`mb-1.5 px-3 font-medium text-[11px] text-ink-4 uppercase tracking-[0.14em]`,children:H(`integrate.groupShare`)}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,W.jsx)(Z,{selected:!1,disabled:!0,title:H(`integrate.shareLink`),note:H(`integrate.soon`)}),(0,W.jsx)(Z,{selected:!1,disabled:!0,title:H(`integrate.shareSite`),note:H(`integrate.soon`)})]})]})]}),(0,W.jsx)(_t,{client:p,local:c(p.id),seen:u(p.id),managed:t,url:o},p.id)]}),t?null:(0,W.jsx)(mt,{}),(0,W.jsxs)(`p`,{className:`flex items-start gap-2 text-[13px] text-ink-3`,children:[(0,W.jsx)(ee,{className:`mt-0.5 size-3.5 shrink-0`}),H(`mcp.notReverse`)]})]})}function yt(e){return H(e.origin===`local`?`readonly.project`:`readonly.server`)}function bt({children:e}){return(0,W.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-paper-2 px-4 py-3 text-[14px] text-ink-2 leading-relaxed`,children:[(0,W.jsx)(ae,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,W.jsx)(`p`,{className:`min-w-0`,children:e})]})}function xt(e){return e.type.startsWith(`image/`)&&/logo/i.test(e.name)?`logo`:/^(image|video|audio)\//.test(e.type)?`asset`:`document`}function St(e,t){let n=u(),[r,i]=(0,U.useState)([]),[a,s]=(0,U.useState)(`idle`),[c,d]=(0,U.useState)(null),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)(null),g=(0,U.useRef)(null),_=()=>(g.current??=(async()=>{await Promise.all([n.invalidateQueries({queryKey:[`projects`]}),n.invalidateQueries({queryKey:[`project-files`,e]})]),t(),g.current=null})(),g.current);return{messages:r,phase:a,activity:f,startedAt:m,error:c,send:async(t,c=[])=>{if(!(t.trim()||c.length)||a!==`idle`)return!1;if(d(null),s(`thinking`),h(Date.now()),c.length){try{for(let t of c)await l.upload(`/api/studio/projects/${e}/files?kind=${xt(t)}`,t)}catch(e){return d(e.message),s(`idle`),h(null),await _(),!1}await _();let n=`${H(`editor.attached`)}: ${c.map(e=>e.name).join(`, `)}`;t=t.trim()?`${t}\n\n${n}`:n}let u=r.map(({role:e,content:t})=>({role:e,content:t})).slice(-12),f=`p-${Date.now()}`;i(e=>[...e,{id:`u-${Date.now()}`,role:`user`,content:t,previews:oe(c)},{id:f,role:`assistant`,content:``,pending:!0}]),p(null);let m=!1;try{await o(`/api/studio/projects/${e}/assist`,{message:t,history:u},(e,t)=>{if(e===`text`){let e=JSON.parse(t);i(t=>t.map(t=>t.id===f?{...t,content:t.content+e}:t))}else if(e===`activity`)p(JSON.parse(t));else if(e===`changed`)s(`building`),_();else if(e===`done`){m=!0;let e=JSON.parse(t);i(t=>t.map(t=>t.id===f?{...t,content:e.reply,changed:e.changed,pending:!1}:t))}else e===`error`&&(m=!0,d(JSON.parse(t).message))}),m||d(H(`editor.chatBroken`))}catch(e){d(e.message)}finally{p(null),h(null),i(e=>e.filter(e=>!(e.id===f&&!e.content)).map(e=>({...e,pending:!1}))),s(`idle`),await g.current,await _(),await n.invalidateQueries({queryKey:[`me`]})}return!0}}}function Ct(){return(0,W.jsxs)(`div`,{className:`sm:pr-36`,children:[(0,W.jsx)(`h2`,{className:`font-display font-semibold text-[20px] leading-tight tracking-tight`,children:H(`project.assistantTitle`)}),(0,W.jsx)(`p`,{className:`mt-1.5 max-w-2xl text-[15px] text-ink-2 leading-relaxed`,children:H(`project.assistantHello`)})]})}var wt=72,Tt=720;function Et({projectId:e,onChanged:t}){let n=St(e,t),r=(0,U.useRef)(null),[i,o]=(0,U.useState)(null);return(0,U.useEffect)(()=>{let e=()=>{let e=r.current?.getBoundingClientRect();e&&o(t=>{if(e.bottom>=wt)return null;let n=Math.min(e.width,Tt),r=e.left+(e.width-n)/2;return t&&t.left===r&&t.width===n?t:{left:r,width:n,height:t?.height??e.height}})};return e(),window.addEventListener(`scroll`,e,{passive:!0}),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e),window.removeEventListener(`resize`,e)}},[]),(0,W.jsxs)(`div`,{ref:r,style:i?{minHeight:i.height}:void 0,children:[(0,W.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 px-1 font-medium text-[12px] text-ember-strong uppercase tracking-[0.07em]`,children:[(0,W.jsx)(ne,{className:`size-3.5`}),` `,H(`project.assistant`)]}),(0,W.jsxs)(`div`,{className:`relative`,children:[!i&&n.messages.length===0?(0,W.jsx)(`div`,{className:`absolute -top-14 right-10 z-10 max-sm:hidden`,children:(0,W.jsx)(a,{kind:`round`,size:104})}):null,(0,W.jsx)(`div`,{className:F(`flex flex-col overflow-hidden bg-card`,i?`fixed bottom-4 z-30 max-h-[70dvh] animate-dock rounded-2xl shadow-overlay ring-1 ring-border`:`max-h-[520px] rounded-xl bg-linear-to-br from-ember-tint via-card to-card shadow-soft ring-1 ring-ember-veil`),style:i?{left:i.left,width:i.width}:void 0,children:(0,W.jsx)(se,{chat:n,avatar:`round`,compact:!!i,intro:(0,W.jsx)(Ct,{}),placeholder:H(`project.assistantComposer`),changedLabel:H(`project.assistantChanged`)})})]})]})}var Dt=[`text`,`longtext`,`number`,`date`,`url`,`email`,`phone`,`boolean`],Ot=/^(\d{4}-\d{2}-\d{2}|\d{1,2}\.\s?\d{1,2}\.\s?\d{4})$/,kt=/^[+-]?\d{1,3}([.,\s']?\d{3})*([.,]\d+)?$/,At=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,jt=/^(https?:\/\/|www\.)\S+$/i,Mt=/^\+?[\d\s()/.-]{7,20}$/,Nt=/^(ja|nein|yes|no|true|false)$/i;function Pt(e){let t=e.trim();return t?t.includes(`
|
|
2
2
|
`)||t.length>140?`longtext`:Nt.test(t)?`boolean`:At.test(t)?`email`:jt.test(t)?`url`:Ot.test(t)?`date`:kt.test(t)&&!/^(\+|0\d)/.test(t)?`number`:Mt.test(t)&&t.replace(/\D/g,``).length>=7?`phone`:`text`:`text`}function Ft(e,t=[]){let n=e.toLowerCase().replace(/ä/g,`ae`).replace(/ö/g,`oe`).replace(/ü/g,`ue`).replace(/ß/g,`ss`).normalize(`NFD`).replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,40)||`fakt`,r=n;for(let e=2;t.includes(r);e++)r=`${n}_${e}`;return r}var It=[{key:`adresse`,de:`Adresse`,en:`Address`},{key:`plz`,de:`PLZ`,en:`Postcode`},{key:`ort`,de:`Ort`,en:`City`},{key:`uid`,de:`UID`,en:`VAT id`},{key:`telefon`,de:`Telefon`,en:`Phone`},{key:`e_mail`,de:`E-Mail`,en:`Email`},{key:`website`,de:`Website`,en:`Website`},{key:`iban`,de:`IBAN`,en:`IBAN`}],Q={facts:100,colors:12,files:{logo:8,asset:100,document:50},bytes:{logo:5e6,asset:15e6,video:8e7,document:3e7}},Lt=/^#[0-9a-fA-F]{6}$/;function Rt({onAdd:e,onClose:t}){let[n,r]=(0,U.useState)(`#e0531b`),[i,a]=(0,U.useState)(``),o=Lt.test(n);return(0,W.jsx)(I,{open:!0,onClose:t,title:H(`project.colorAddTitle`),children:(0,W.jsxs)(`form`,{onSubmit:r=>{r.preventDefault(),o&&(e({name:i.trim(),value:n.toLowerCase()}),t())},className:`flex flex-col gap-5`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{children:H(`project.colorValue`)}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(Te,{value:o?n:`#888888`,onChange:e=>r(e.target.value)}),(0,W.jsx)(B,{value:n,placeholder:`#e0531b`,spellCheck:!1,onChange:e=>r(e.target.value.trim()),className:`font-mono text-[14px]`})]})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{children:H(`project.colorUseLabel`)}),(0,W.jsx)(B,{autoFocus:!0,value:i,maxLength:120,placeholder:H(`project.colorName`),onChange:e=>a(e.target.value)}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:H(`project.colorUse`)})]}),(0,W.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,W.jsx)(V,{variant:`ghost`,onClick:t,children:H(`common.cancel`)}),(0,W.jsx)(V,{type:`submit`,disabled:!o,children:H(`project.add`)})]})]})})}function zt({colors:e,save:t,readOnly:n}){let r=(0,U.useRef)(0),[i,a]=(0,U.useState)(()=>e.map(e=>({...e,id:`c${r.current++}`}))),[o,s]=(0,U.useState)(!1),c=M(i.filter(e=>Lt.test(e.value)).map(({name:e,value:t})=>({name:e.trim(),value:t})),t),l=(e,t)=>a(n=>n.map(n=>n.id===e?{...n,...t}:n));return(0,W.jsxs)(j,{title:H(`project.colors`),hint:H(`project.colorsHint`),save:c,locked:n,children:[(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map((e,t)=>(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(Te,{value:Lt.test(e.value)?e.value:`#888888`,onChange:t=>l(e.id,{value:t.target.value})}),(0,W.jsx)(B,{value:e.name,placeholder:H(`project.colorName`),maxLength:120,onChange:t=>l(e.id,{name:t.target.value}),className:`min-w-0 flex-1`}),(0,W.jsx)(B,{value:e.value,placeholder:`#e0531b`,spellCheck:!1,onChange:t=>l(e.id,{value:t.target.value.trim()}),className:`w-28 font-mono text-[13px]`}),(0,W.jsxs)(`div`,{className:`flex w-24 shrink-0 items-center justify-end max-sm:w-auto`,children:[t===0?(0,W.jsx)(`span`,{className:`mr-1 max-sm:hidden`,children:(0,W.jsx)(z,{tone:`ember`,children:H(`project.colorAccent`)})}):n?null:(0,W.jsx)(R,{label:H(`project.colorFirst`),onClick:()=>a(t=>[e,...t.filter(t=>t.id!==e.id)]),children:(0,W.jsx)(b,{className:`size-4`})}),n?null:(0,W.jsx)(R,{label:H(`project.remove`),onClick:()=>a(t=>t.filter(t=>t.id!==e.id)),className:`hover:text-rose`,children:(0,W.jsx)(w,{className:`size-4`})})]})]},e.id))}),i.length&&!n?(0,W.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:H(`project.colorUse`)}):null,i.length<Q.colors&&!n?(0,W.jsxs)(V,{variant:`secondary`,size:`sm`,className:i.length?`mt-3`:void 0,onClick:()=>s(!0),children:[(0,W.jsx)(D,{className:`size-4`}),` `,H(`project.colorAdd`)]}):null,o?(0,W.jsx)(Rt,{onClose:()=>s(!1),onAdd:e=>a(t=>[...t,{...e,id:`c${r.current++}`}])}):null]})}var Bt={backgroundImage:`repeating-conic-gradient(#c9c9c9 0% 25%, #dedede 0% 50%)`,backgroundSize:`16px 16px`};function $({file:e,actions:t}){let[n,r]=(0,U.useState)(e.description),i=(0,U.useRef)(e.description),a=(0,U.useRef)(null);(0,U.useEffect)(()=>{e.description!==i.current&&(r(t=>t===i.current?e.description:t),i.current=e.description)},[e.description]),(0,U.useLayoutEffect)(()=>{let e=a.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)},[n]);let o=e.status===`pending`&&!n;return t.readOnly?n?(0,W.jsx)(`p`,{className:`text-[13px] text-ink-2 leading-snug`,children:n}):null:(0,W.jsx)(`textarea`,{ref:a,rows:1,value:n,maxLength:600,placeholder:H(o?`project.describing`:`project.description`),onChange:e=>r(e.target.value),onBlur:()=>{n.trim()!==e.description&&(i.current=n.trim(),t.describe(e.id,n.trim()))},className:`-mx-1 block w-[calc(100%+0.5rem)] resize-none overflow-hidden rounded-md bg-transparent px-1 py-0.5 text-[13px] text-ink-2 leading-snug outline-none transition placeholder:text-ink-4 hover:bg-paper-2 focus:bg-card focus:text-ink focus:ring-1 focus:ring-border`})}function Vt(e,t){confirm(H(`project.removeConfirm`,{name:e.name}))&&t.remove(e.id)}function Ht({projectId:e,file:t,small:n}){let r=A(e,t.id);return t.mime.startsWith(`image/`)?(0,W.jsx)(`img`,{src:r,alt:``,loading:`lazy`,className:F(`size-full`,t.kind===`logo`?`object-contain p-3`:`object-cover`)}):t.mime.startsWith(`video/`)?(0,W.jsx)(`video`,{src:`${r}#t=0.1`,preload:`metadata`,controls:!n,className:`size-full object-cover`}):(0,W.jsx)(`div`,{className:`flex size-full items-center justify-center text-ink-3`,children:t.mime.startsWith(`audio/`)?(0,W.jsx)(qe,{className:n?`size-5`:`size-7`}):(0,W.jsx)(x,{className:n?`size-5`:`size-7`})})}function Ut({projectId:e,kind:t,files:n,actions:r,accept:i,addLabel:a,onPreview:o}){return(0,W.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(184px,1fr))] gap-3`,children:[n.map((i,a)=>(0,W.jsxs)(`div`,{className:`group relative flex flex-col gap-1.5 rounded-lg bg-paper p-2 pb-2.5 ring-1 ring-border-soft`,children:[t===`logo`&&a===0?(0,W.jsx)(`span`,{className:`absolute -top-3 left-3 z-10 rounded-full ring-2 ring-card`,children:(0,W.jsx)(z,{tone:`ember`,children:H(`project.logoMain`)})}):null,(0,W.jsxs)(`div`,{className:`relative h-28 overflow-hidden rounded-md bg-paper-2`,style:t===`logo`?Bt:void 0,children:[o&&i.mime.startsWith(`image/`)?(0,W.jsx)(`button`,{type:`button`,"aria-label":`${H(`project.preview`)}: ${i.name}`,onClick:()=>o(i),className:`block size-full cursor-zoom-in`,children:(0,W.jsx)(Ht,{projectId:e,file:i})}):(0,W.jsx)(Ht,{projectId:e,file:i}),(0,W.jsxs)(`div`,{className:`absolute top-1 right-1 flex gap-1 opacity-0 transition focus-within:opacity-100 group-hover:opacity-100 coarse:opacity-100`,children:[o?(0,W.jsx)(R,{label:H(`project.preview`),onClick:()=>o(i),className:`size-8 bg-card shadow-soft`,children:(0,W.jsx)(E,{className:`size-4`})}):null,t===`logo`&&a>0&&!r.readOnly?(0,W.jsx)(R,{label:H(`project.logoMakeMain`),onClick:()=>r.order(`logo`,[i.id,...n.filter(e=>e.id!==i.id).map(e=>e.id)]),className:`size-8 bg-card shadow-soft`,children:(0,W.jsx)(pe,{className:`size-4`})}):null,r.readOnly?null:(0,W.jsx)(R,{label:H(`project.remove`),onClick:()=>Vt(i,r),className:`size-8 bg-card shadow-soft hover:text-rose`,children:(0,W.jsx)(w,{className:`size-4`})})]})]}),t===`asset`?(0,W.jsx)(`div`,{className:`truncate px-0.5 text-[12px] text-ink-3`,title:i.name,children:i.name}):null,(0,W.jsx)($,{file:i,actions:r})]},i.id)),a&&!r.readOnly?(0,W.jsxs)(k,{accept:i,multiple:!1,onFiles:e=>r.upload(t,e),className:`min-h-28 flex-col p-3`,children:[r.busy?(0,W.jsx)(P,{className:`size-5`}):(0,W.jsx)(D,{className:`size-5`}),a]}):null]})}function Wt({projectId:e,data:t,readOnly:n}){let r=O(e,n);return(0,W.jsxs)(j,{title:H(`project.logos`),hint:H(`project.logosHint`),children:[(0,W.jsx)(Ut,{projectId:e,kind:`logo`,files:t.files.filter(e=>e.kind===`logo`),actions:r,accept:`image/*`,addLabel:H(`project.logoAdd`)}),r.error?(0,W.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:r.error}):null]})}var Gt=e=>[(e.name.includes(`.`)?e.name.split(`.`).pop():e.mime.split(`/`).pop())?.toUpperCase().slice(0,5),_e(e.size)].filter(Boolean).join(` · `);function Kt({projectId:e,file:t,actions:n,onClose:r}){let i=A(e,t.id);return(0,W.jsxs)(I,{open:!0,onClose:r,wide:`page`,title:t.name,children:[(0,W.jsxs)(`div`,{className:`-mt-2 mb-4 flex items-center justify-between gap-3`,children:[(0,W.jsx)(`span`,{className:`text-[13px] text-ink-3`,children:Gt(t)}),(0,W.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,"aria-label":H(`project.openOriginal`),title:H(`project.openOriginal`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,W.jsx)(de,{className:`size-4`})})]}),t.mime.startsWith(`image/`)?(0,W.jsx)(`div`,{className:`overflow-hidden rounded-lg`,style:Bt,children:(0,W.jsx)(`img`,{src:i,alt:``,className:`mx-auto max-h-[68dvh] object-contain`})}):t.mime.startsWith(`video/`)?(0,W.jsx)(`video`,{src:i,controls:!0,className:`max-h-[68dvh] w-full rounded-lg bg-black`}):(0,W.jsx)(`audio`,{src:i,controls:!0,className:`w-full`}),(0,W.jsx)(`div`,{className:`mt-4`,children:(0,W.jsx)($,{file:t,actions:n})})]})}function qt({projectId:e,file:t,actions:n,onPreview:r}){return(0,W.jsxs)(`li`,{className:`flex items-start gap-3 rounded-lg bg-paper p-2 ring-1 ring-border-soft`,children:[(0,W.jsx)(`button`,{type:`button`,"aria-label":`${H(`project.preview`)}: ${t.name}`,onClick:r,className:`size-14 shrink-0 cursor-zoom-in overflow-hidden rounded-md bg-paper-2`,children:(0,W.jsx)(Ht,{projectId:e,file:t,small:!0})}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 py-0.5`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:r,title:t.name,className:`min-w-0 truncate font-medium text-[14px] hover:underline`,children:t.name}),(0,W.jsx)(`span`,{className:`text-[12px] text-ink-3`,children:Gt(t)})]}),(0,W.jsx)($,{file:t,actions:n})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-start`,children:[(0,W.jsx)(R,{label:H(`project.preview`),onClick:r,children:(0,W.jsx)(E,{className:`size-4`})}),n.readOnly?null:(0,W.jsx)(R,{label:H(`project.remove`),onClick:()=>Vt(t,n),className:`hover:text-rose`,children:(0,W.jsx)(w,{className:`size-4`})})]})]})}function Jt({projectId:e,data:t,readOnly:n}){let r=O(e,n),[i,a]=ve(`assets`,`cards`),[o,s]=(0,U.useState)(``),[c,l]=(0,U.useState)(null),u=t.files.filter(e=>e.kind===`asset`),d=u.find(e=>e.id===c),f=o.trim().toLowerCase(),p=f?u.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(f)):u;return(0,W.jsxs)(j,{title:H(`project.assets`),hint:H(`project.assetsHint`),children:[u.length?(0,W.jsx)(ge,{layout:i,onToggle:a,children:(0,W.jsx)(ye,{value:o,onChange:s,placeholder:H(`project.assetSearch`)})}):null,p.length?(0,W.jsx)(`div`,{className:`mb-3`,children:i===`cards`?(0,W.jsx)(Ut,{projectId:e,kind:`asset`,files:p,actions:r,onPreview:e=>l(e.id)}):(0,W.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.map(t=>(0,W.jsx)(qt,{projectId:e,file:t,actions:r,onPreview:()=>l(t.id)},t.id))})}):null,n?u.length?null:(0,W.jsx)(`p`,{className:`text-[14px] text-ink-3`,children:H(`project.staysLocal`)}):(0,W.jsxs)(k,{accept:`image/*,video/*,audio/*`,onFiles:e=>r.upload(`asset`,e),className:`h-16 w-full`,children:[r.busy?(0,W.jsx)(P,{className:`size-4`}):(0,W.jsx)(le,{className:`size-4`}),H(`project.drop`),` `,(0,W.jsx)(`span`,{className:`underline`,children:H(`project.assetAdd`)})]}),r.error?(0,W.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:r.error}):null,d?(0,W.jsx)(Kt,{projectId:e,file:d,actions:r,onClose:()=>l(null)}):null]})}function Yt(e,t,n){return s({queryKey:[`project-file-text`,t.id,t.chars,n],queryFn:()=>l.get(`/api/studio/projects/${e}/files/${t.id}/text?limit=${n}`),enabled:t.status===`ready`,staleTime:6e4})}function Xt(e){return((e.name.includes(`.`)?e.name.split(`.`).pop():``)||e.mime.split(`/`).pop()||``).toUpperCase().slice(0,5)}var Zt=e=>[Xt(e),e.pages?H(`project.pages`,{n:e.pages}):null,_e(e.size)].filter(Boolean).join(` · `);function Qt({file:e}){return e.status===`pending`?(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12px] text-ink-3`,children:[(0,W.jsx)(P,{className:`size-3`}),` `,H(`project.reading`)]}):e.status===`failed`?(0,W.jsx)(`span`,{className:`text-[12px] text-rose`,children:e.error}):e.indexed?(0,W.jsx)(z,{tone:`live`,children:e.indexed===`embeddings`?H(`project.indexed`):H(`project.indexedKeywords`)}):(0,W.jsx)(z,{tone:`warn`,children:H(`project.notIndexed`)})}function $t({file:e,actions:t,onPreview:n}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R,{label:H(`project.preview`),onClick:n,children:(0,W.jsx)(E,{className:`size-4`})}),e.status!==`pending`&&!t.readOnly?(0,W.jsx)(R,{label:H(`project.reindex`),onClick:()=>t.reindex(e.id),children:(0,W.jsx)(Se,{className:`size-4`})}):null,t.readOnly?null:(0,W.jsx)(R,{label:H(`project.remove`),onClick:()=>Vt(e,t),className:`hover:text-rose`,children:(0,W.jsx)(w,{className:`size-4`})})]})}function en({file:e,actions:t,onPreview:n}){let r=/sheet|csv|excel/.test(e.mime);return(0,W.jsxs)(`li`,{className:`flex gap-3 rounded-lg bg-paper p-3 ring-1 ring-border-soft`,children:[(0,W.jsx)(`div`,{className:`mt-0.5 text-ink-3`,children:r?(0,W.jsx)(ze,{className:`size-5`}):(0,W.jsx)(fe,{className:`size-5`})}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:n,title:e.name,className:`min-w-0 truncate font-medium text-[14px] hover:underline`,children:e.name}),(0,W.jsx)(`span`,{className:`text-[12px] text-ink-3`,children:Zt(e)}),(0,W.jsx)(Qt,{file:e})]}),(0,W.jsx)($,{file:e,actions:t})]}),(0,W.jsx)(`div`,{className:`-my-1 flex shrink-0 items-start`,children:(0,W.jsx)($t,{file:e,actions:t,onPreview:n})})]})}function tn({projectId:e,file:t}){let n=Yt(e,t,1500);return t.mime.startsWith(`image/`)?(0,W.jsx)(`img`,{src:A(e,t.id),alt:``,className:`size-full object-cover`}):t.status===`pending`||n.isLoading?(0,W.jsx)(`div`,{className:`flex size-full items-center justify-center text-ink-4`,children:(0,W.jsx)(P,{className:`size-5`})}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`w-[222%] origin-top-left scale-[0.45] p-6`,children:(0,W.jsx)(C,{text:n.data?.text??``})}),(0,W.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 h-12 bg-linear-to-t from-card to-transparent`})]})}function nn({projectId:e,file:t,actions:n,onPreview:r}){return(0,W.jsxs)(`li`,{className:`group flex flex-col gap-1.5 rounded-lg bg-paper p-2 pb-2.5 ring-1 ring-border-soft`,children:[(0,W.jsxs)(`div`,{className:`relative`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`${H(`project.preview`)}: ${t.name}`,className:`relative block h-44 w-full overflow-hidden rounded-md bg-card text-left ring-1 ring-border-soft transition hover:ring-border`,children:(0,W.jsx)(tn,{projectId:e,file:t})}),(0,W.jsx)(`div`,{className:`absolute top-1 right-1 flex gap-1 opacity-0 transition focus-within:opacity-100 group-hover:opacity-100 coarse:opacity-100 [&>button]:size-8 [&>button]:bg-card [&>button]:shadow-soft`,children:(0,W.jsx)($t,{file:t,actions:n,onPreview:r})})]}),(0,W.jsxs)(`div`,{className:`mt-1 flex flex-col gap-1 px-0.5`,children:[(0,W.jsx)(`div`,{className:`truncate font-medium text-[13px]`,title:t.name,children:t.name}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,W.jsx)(`span`,{className:`text-[12px] text-ink-3`,children:Zt(t)}),(0,W.jsx)(Qt,{file:t})]})]}),(0,W.jsx)($,{file:t,actions:n})]})}var rn=2e5;function an({projectId:e,file:t,onClose:n}){let r=t.mime===`application/pdf`||t.mime.startsWith(`image/`),[i,a]=(0,U.useState)(r?`original`:`text`),o=Yt(e,t,rn),s=A(e,t.id),c=(e,t)=>(0,W.jsx)(`button`,{type:`button`,"aria-pressed":i===e,onClick:()=>a(e),className:F(`h-8 rounded-full px-3 text-[13px] transition`,i===e?`bg-paper-2 font-medium text-ink`:`text-ink-3 hover:text-ink`),children:t});return(0,W.jsxs)(I,{open:!0,onClose:n,wide:`page`,title:t.name,children:[(0,W.jsxs)(`div`,{className:`-mt-2 mb-4 flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,W.jsx)(`span`,{className:`text-[13px] text-ink-3`,children:Zt(t)}),(0,W.jsx)(Qt,{file:t}),(0,W.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[r?(0,W.jsxs)(W.Fragment,{children:[c(`original`,H(`project.original`)),c(`text`,H(`project.readText`))]}):null,(0,W.jsx)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,"aria-label":H(`project.openOriginal`),title:H(`project.openOriginal`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,W.jsx)(de,{className:`size-4`})})]})]}),i===`original`?t.mime===`application/pdf`?(0,W.jsx)(`iframe`,{src:s,title:t.name,className:`h-[70dvh] w-full rounded-lg bg-paper-2 ring-1 ring-border-soft`}):(0,W.jsx)(`img`,{src:s,alt:``,className:`mx-auto max-h-[70dvh] rounded-lg object-contain`}):o.isLoading?(0,W.jsx)(`div`,{className:`flex h-40 items-center justify-center text-ink-3`,children:(0,W.jsx)(P,{})}):o.data?.text?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`overflow-x-auto rounded-lg bg-paper p-5 ring-1 ring-border-soft`,children:(0,W.jsx)(C,{text:o.data.text,className:`text-[14px]`})}),o.data.chars>o.data.text.length?(0,W.jsx)(`p`,{className:`mt-3 text-[13px] text-ink-3`,children:H(`project.textCut`,{shown:o.data.text.length.toLocaleString(),total:o.data.chars.toLocaleString()})}):null]}):(0,W.jsx)(`p`,{className:`py-8 text-center text-[14px] text-ink-3`,children:H(`project.noText`)})]})}function on({projectId:e}){let[t,n]=(0,U.useState)(``),[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(!1),s=async()=>{if(!t.trim()){i(null);return}o(!0);try{let n=await l.post(`/api/studio/projects/${e}/search`,{query:t});i(n.hits)}catch{i([])}finally{o(!1)}};return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ye,{value:t,placeholder:H(`project.searchTest`),busy:a,onEnter:()=>void s(),onChange:e=>{n(e),e.trim()||i(null)}}),r?r.length?(0,W.jsx)(`ul`,{className:`mt-2 flex flex-col gap-2`,children:r.map((e,t)=>(0,W.jsxs)(`li`,{className:`rounded-lg bg-paper-2 px-3 py-2 text-[13px]`,children:[(0,W.jsx)(`div`,{className:`mb-0.5 font-medium text-[12px] text-ink-3`,children:e.name}),(0,W.jsx)(`p`,{className:`line-clamp-3 whitespace-pre-line text-ink-2`,children:e.text})]},t))}):(0,W.jsx)(`p`,{className:`mt-2 text-[13px] text-ink-3`,children:H(`project.searchNone`)}):null]})}function sn({projectId:e,data:t,readOnly:n}){let r=O(e,n),[i,a]=ve(`documents`,`list`),[o,s]=(0,U.useState)(null),c=t.files.filter(e=>e.kind===`document`),l=c.find(e=>e.id===o),u=i===`cards`?nn:en;return(0,W.jsxs)(j,{title:H(`project.documents`),hint:H(`project.documentsHint`),children:[c.length?(0,W.jsx)(ge,{layout:i,onToggle:a,children:(0,W.jsx)(on,{projectId:e})}):null,c.length?(0,W.jsx)(`ul`,{className:F(`mb-3`,i===`cards`?`grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-3`:`flex flex-col gap-2`),children:c.map(t=>(0,W.jsx)(u,{projectId:e,file:t,actions:r,onPreview:()=>s(t.id)},t.id))}):null,n?c.length?null:(0,W.jsx)(`p`,{className:`text-[14px] text-ink-3`,children:H(`project.staysLocal`)}):(0,W.jsxs)(k,{accept:`.pdf,.docx,.doc,.xlsx,.csv,.tsv,.txt,.md,.json,.html,.eml,image/*`,onFiles:e=>r.upload(`document`,e),className:`h-16 w-full`,children:[r.busy?(0,W.jsx)(P,{className:`size-4`}):(0,W.jsx)(le,{className:`size-4`}),H(`project.drop`),` `,(0,W.jsx)(`span`,{className:`underline`,children:H(`project.documentAdd`)})]}),r.error?(0,W.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:r.error}):null,c.length&&!t.embeddings?(0,W.jsx)(`p`,{className:`mt-3 text-[13px] text-ink-3`,children:H(`project.keywordsOnly`)}):null,l?(0,W.jsx)(an,{projectId:e,file:l,onClose:()=>s(null)}):null]})}var cn=e=>/^(ja|yes|true)$/i.test(e.trim()),ln={text:he,longtext:$e,number:Ve,date:Le,url:ee,email:te,phone:Ye,boolean:tt};function un({type:e,detected:t,onChange:n}){let[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(!1),s=(0,U.useRef)(null);(0,U.useEffect)(()=>{if(!r)return;let e=e=>{s.current?.contains(e.target)||i(!1)},t=e=>e.key===`Escape`&&i(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[r]);let c=ln[e??t],l=`${H(`project.factType`)}: ${H(`project.type.${e??t}`)}`,u=`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[14px] text-ink-2 hover:bg-accent hover:text-ink`,d=e=>{n(e),i(!1)};return(0,W.jsxs)(`div`,{className:`relative`,ref:s,children:[(0,W.jsx)(`button`,{type:`button`,"aria-label":l,title:l,"aria-haspopup":`menu`,"aria-expanded":r,onClick:e=>{o(window.innerHeight-e.currentTarget.getBoundingClientRect().bottom<400),i(e=>!e)},className:F(`inline-flex size-11 items-center justify-center rounded-lg transition hover:bg-accent hover:text-ink`,r?`bg-accent text-ink`:e?`text-ink-2`:`text-ink-4`),children:(0,W.jsx)(c,{className:`size-4`})}),r?(0,W.jsxs)(`div`,{role:`menu`,className:F(`absolute right-0 z-50 w-56 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,a?`bottom-12`:`top-12`),children:[(0,W.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":!e,className:u,onClick:()=>d(void 0),children:[(0,W.jsx)(ie,{className:`size-4 shrink-0`}),(0,W.jsx)(`span`,{className:`flex-1`,children:H(`project.factAuto`)}),(0,W.jsx)(`span`,{className:`text-[12px] text-ink-4`,children:H(`project.type.${t}`)}),(0,W.jsx)(T,{className:F(`size-4 shrink-0`,e&&`invisible`)})]}),(0,W.jsx)(`div`,{className:`mx-2 my-1 h-px bg-border-soft`}),Dt.map(t=>{let n=ln[t];return(0,W.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e===t,className:u,onClick:()=>d(t),children:[(0,W.jsx)(n,{className:`size-4 shrink-0`}),(0,W.jsx)(`span`,{className:`flex-1`,children:H(`project.type.${t}`)}),(0,W.jsx)(T,{className:F(`size-4 shrink-0`,e!==t&&`invisible`)})]},t)})]}):null]})}function dn({facts:e,save:t,readOnly:n}){let r=(0,U.useRef)(0),i=(0,U.useRef)(null),[a,o]=(0,U.useState)(()=>e.map(e=>({...e,id:`f${r.current++}`}))),s=M(a.filter(e=>e.key&&e.label.trim()).map(({key:e,label:t,value:n,type:r})=>({key:e,label:t.trim(),value:n,...r?{type:r}:{}})),t),c=(e,t)=>o(n=>n.map(n=>n.id===e?{...n,...t}:n)),l=(e,t,n=!1)=>{let a=`f${r.current++}`;i.current=`${a}:${t}`;let s={id:a,key:``,label:``,value:``,...e};o(e=>n?[s,...e]:[...e,s])},u=e=>t=>{t&&i.current===e&&(i.current=null,t.focus())},d=It.filter(e=>!a.some(t=>t.key===e.key));return(0,W.jsxs)(j,{title:H(`project.facts`),hint:H(`project.factsHint`),save:s,locked:n,action:a.length<Q.facts&&!n?(0,W.jsxs)(V,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`,!0),children:[(0,W.jsx)(D,{className:`size-4`}),` `,H(`project.factAdd`)]}):null,children:[(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>{let t=Pt(e.value),r=e.type??t;return(0,W.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] items-start gap-x-1 gap-y-2 sm:grid-cols-[minmax(0,2fr)_minmax(0,3fr)_auto_auto]`,children:[(0,W.jsx)(B,{ref:u(`${e.id}:label`),value:e.label,placeholder:H(`project.factLabel`),title:e.key?`{{facts.${e.key}}}`:void 0,onChange:t=>c(e.id,{label:t.target.value}),onBlur:()=>{!e.key&&e.label.trim()&&c(e.id,{key:Ft(e.label,a.map(e=>e.key))})},className:`max-sm:col-span-3 max-sm:font-medium sm:mr-1`}),e.type===`boolean`?(0,W.jsxs)(`div`,{className:`flex h-11 items-center gap-3`,children:[(0,W.jsx)(De,{checked:cn(e.value),label:e.label,onChange:t=>c(e.id,{value:H(t?`project.yes`:`project.no`)})}),(0,W.jsx)(`span`,{className:`text-[14px] text-ink-2`,children:cn(e.value)?H(`project.yes`):H(`project.no`)})]}):(0,W.jsx)(Ee,{ref:u(`${e.id}:value`),rows:1,minRows:r===`longtext`?2:1,maxRows:10,value:e.value,placeholder:H(`project.factValue`),onChange:t=>c(e.id,{value:t.target.value}),className:`min-h-11`}),(0,W.jsx)(un,{type:e.type,detected:t,onChange:t=>c(e.id,{type:t})}),n?null:(0,W.jsx)(R,{label:H(`project.remove`),onClick:()=>o(t=>t.filter(t=>t.id!==e.id)),className:`size-11 rounded-lg hover:text-rose`,children:(0,W.jsx)(w,{className:`size-4`})})]},e.id)})}),a.length<Q.facts&&!n?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${a.length?`mt-4`:``}`,children:[(0,W.jsxs)(V,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`),children:[(0,W.jsx)(D,{className:`size-4`}),` `,H(`project.factAdd`)]}),d.map(e=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>l({key:e.key,label:Ce===`en`?e.en:e.de},`value`),className:`inline-flex h-8 items-center gap-1 rounded-full bg-paper-2 px-3 text-[13px] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:[(0,W.jsx)(D,{className:`size-3.5`}),` `,Ce===`en`?e.en:e.de]},e.key))]}):null]})}function fn({project:e,save:t}){let[n,r]=(0,U.useState)(e.brand.name??``),[i,a]=(0,U.useState)(e.brand.about??``),o=M({name:n.trim(),about:i.trim()},e=>t({brand:e}));return(0,W.jsx)(j,{title:H(`project.base`),hint:H(`project.baseHint`),save:o,locked:e.readOnly,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{children:H(`project.title`)}),(0,W.jsx)(B,{value:n,maxLength:120,onChange:e=>r(e.target.value)}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:H(`project.titleHint`)})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{children:H(`project.about`)}),(0,W.jsx)(Ee,{minRows:4,value:i,onChange:e=>a(e.target.value)}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:H(`project.aboutHint`)})]})]})})}function pn({project:e,save:t}){let[n,r]=(0,U.useState)(!1),[i,a]=(0,U.useState)(e.name),o=p({mutationFn:()=>t({name:i.trim()}),onSuccess:()=>r(!1)});return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R,{label:H(`project.rename`),onClick:()=>{a(e.name),r(!0)},children:(0,W.jsx)(S,{className:`size-4`})}),(0,W.jsx)(I,{open:n,onClose:()=>r(!1),title:H(`project.rename`),children:(0,W.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.trim()&&o.mutate()},children:[(0,W.jsx)(B,{autoFocus:!0,value:i,maxLength:80,onChange:e=>a(e.target.value)}),o.error?(0,W.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:o.error.message}):null,(0,W.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,W.jsx)(V,{variant:`ghost`,onClick:()=>r(!1),children:H(`common.cancel`)}),(0,W.jsx)(V,{type:`submit`,busy:o.isPending,disabled:!i.trim(),children:H(`settings.save`)})]})]})})]})}function mn({project:e}){let t=u(),n=be(e.id),[r,i]=(0,U.useState)(0),a=async n=>{await l.patch(`/api/studio/projects/${e.id}`,n),await t.invalidateQueries({queryKey:[`projects`]})},o=p({mutationFn:()=>l.del(`/api/studio/projects/${e.id}`),onSuccess:()=>t.invalidateQueries({queryKey:[`projects`]})}),s=f(),c=n.data??{files:[],embeddings:!0},d=`${e.id}:${r}`,m=e.readOnly;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[s?(0,W.jsxs)(`div`,{className:`-mb-3 flex items-center gap-1`,children:[(0,W.jsx)(Fe,{}),m?null:(0,W.jsx)(pn,{project:e,save:a})]}):null,m?(0,W.jsx)(bt,{children:yt(e)}):(0,W.jsx)(Et,{projectId:e.id,onChanged:()=>i(e=>e+1)},e.id),(0,W.jsx)(fn,{project:e,save:a},`base:${d}`),(0,W.jsx)(Wt,{projectId:e.id,data:c,readOnly:m}),(0,W.jsx)(zt,{colors:e.brand.colors??[],save:e=>a({brand:{colors:e}}),readOnly:m},`colors:${d}`),(0,W.jsx)(Jt,{projectId:e.id,data:c,readOnly:m}),(0,W.jsx)(sn,{projectId:e.id,data:c,readOnly:m}),(0,W.jsx)(dn,{facts:e.facts,save:e=>a({facts:e}),readOnly:m},`facts:${d}`),s&&!m?(0,W.jsxs)(`div`,{children:[(0,W.jsx)(V,{variant:`danger`,busy:o.isPending,onClick:()=>confirm(`${H(`settings.delete`)}?`)&&o.mutate(),children:H(`settings.delete`)}),o.error?(0,W.jsx)(`p`,{className:`mt-2 text-[14px] text-rose`,children:o.error.message}):null]}):null]})}function hn(e,t){let n=e.toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).replace(/^[^a-z]+/,``).slice(0,24)||`system`,r=n,i=2;for(;t.includes(r);)r=`${n}_${i++}`;return r}function gn({project:e}){let t=u(),[n,r]=(0,U.useState)(e.mcpServers.map(e=>({...e,auth:e.headers?.Authorization??e.headers?.authorization??``}))),[i,a]=(0,U.useState)(!1),o=e.readOnly,s=p({mutationFn:()=>l.patch(`/api/studio/projects/${e.id}`,{mcpServers:n.filter(e=>e.name&&e.url).map(({auth:e,headers:t,...n})=>({...n,headers:e?{...t,Authorization:e}:void 0}))}),onSuccess:async()=>{await t.invalidateQueries({queryKey:[`projects`]}),a(!0),setTimeout(()=>a(!1),1800)}});return(0,W.jsxs)(L,{className:`p-6`,children:[(0,W.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:H(`settings.mcp`)}),(0,W.jsx)(`p`,{className:`mt-1 mb-5 text-[14px] text-ink-3`,children:H(`settings.mcpHint`)}),(0,W.jsxs)(`fieldset`,{disabled:o,className:`flex min-w-0 flex-col gap-3`,children:[n.map((e,t)=>(0,W.jsxs)(`div`,{className:`grid gap-2 rounded-lg bg-paper p-3 ring-1 ring-border-soft sm:grid-cols-[1fr_2fr_auto]`,children:[(0,W.jsx)(B,{placeholder:H(`settings.serverName`),value:e.name,onChange:e=>r(n=>n.map((r,i)=>i===t?{...r,name:e.target.value,id:r.id||hn(e.target.value,n.map(e=>e.id))}:r))}),(0,W.jsx)(B,{placeholder:`${H(`settings.serverUrl`)} (https://…/mcp)`,value:e.url,onChange:e=>r(n=>n.map((n,r)=>r===t?{...n,url:e.target.value}:n))}),o?(0,W.jsx)(`span`,{}):(0,W.jsx)(R,{label:`Entfernen`,onClick:()=>r(e=>e.filter((e,n)=>n!==t)),className:`hover:text-rose`,children:(0,W.jsx)(w,{className:`size-4`})}),(0,W.jsx)(B,{className:`sm:col-span-2`,placeholder:H(`settings.serverHeader`),value:e.auth??``,onChange:e=>r(n=>n.map((n,r)=>r===t?{...n,auth:e.target.value}:n))}),e.id?(0,W.jsx)(`span`,{className:`self-center font-mono text-[11px] text-ink-4`,children:e.id}):null]},t)),o?null:(0,W.jsxs)(V,{variant:`secondary`,className:`self-start`,onClick:()=>r(e=>[...e,{id:``,name:``,url:``,auth:``}]),children:[(0,W.jsx)(D,{className:`size-4`}),` `,H(`settings.addServer`)]})]}),o?null:(0,W.jsxs)(`div`,{className:`mt-5 flex items-center justify-end gap-3`,children:[s.error?(0,W.jsx)(`p`,{className:`text-[14px] text-rose`,children:s.error.message}):null,(0,W.jsx)(V,{busy:s.isPending,onClick:()=>s.mutate(),children:H(i?`settings.saved`:`settings.save`)})]})]})}function _n(){let{section:e}=c(),t=r(),n=h(),{project:a,loading:o}=m(),s=f(),[l,u]=(0,U.useState)(a?.id);(0,U.useEffect)(()=>u(a?.id),[a?.id]);let p=Me(),g=je(n.data,p),_=g.find(t=>t.id===e);if(!_)return e===`build`?(0,W.jsx)(d,{to:`/settings/integrate`,replace:!0}):p.status===`ready`?(0,W.jsx)(d,{to:`/settings/project`,replace:!0}):null;let v=_.id===`connectors`&&s;return(0,W.jsxs)(`div`,{className:`animate-rise`,children:[(0,W.jsx)(`h1`,{className:`font-display font-semibold text-[28px] tracking-tight`,children:H(`settings.title`)}),(0,W.jsxs)(`div`,{className:`mt-6 grid gap-6 md:mt-8 md:grid-cols-[200px_minmax(0,1fr)] md:gap-10`,children:[(0,W.jsx)(`nav`,{className:`max-md:hidden`,children:(0,W.jsx)(`ul`,{className:`sticky top-24 flex flex-col gap-0.5`,children:g.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsx)(i,{to:`/settings/${e.id}`,"aria-current":e.id===_.id?`page`:void 0,className:F(`block rounded-lg px-3 py-2 text-[14px] transition`,e.id===_.id?`bg-paper-2 font-medium text-ink`:`text-ink-3 hover:bg-accent hover:text-ink`),children:e.label})},e.id))})}),(0,W.jsx)(Oe,{className:`md:hidden`,value:_.id,onChange:e=>t(`/settings/${e}`),options:g.map(e=>({value:e.id,label:e.label}))}),(0,W.jsxs)(`div`,{className:F(`min-w-0`,_.id!==`project`&&_.id!==`integrate`&&`max-w-2xl`),children:[v?(0,W.jsx)(`div`,{className:`mb-6`,children:(0,W.jsx)(Fe,{})}):null,_.id===`project`&&a?(0,W.jsx)(mn,{project:a},l):null,_.id===`connectors`&&a?(0,W.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[a.readOnly?(0,W.jsx)(bt,{children:yt(a)}):null,(0,W.jsx)(lt,{projectId:a.id,readOnly:a.readOnly},l),(0,W.jsx)(gn,{project:a},l)]}):null,(_.id===`project`||_.id===`connectors`)&&!a&&!o?(0,W.jsx)(we,{children:H(`settings.noProject`)}):null,_.id===`models`?(0,W.jsx)(Pe,{}):null,_.id===`integrate`?(0,W.jsx)(vt,{}):null,_.id===`account`&&n.data?(0,W.jsx)(xe,{me:n.data}):null,_.id===`plugins`?(0,W.jsx)(it,{}):null,_.plugin?(0,W.jsx)(Ae,{of:_.plugin,children:(0,W.jsx)(_.plugin.component,{})}):null]})]})]})}export{_n as SettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,_ as i,d as a,j as o,m as s,n as c,nt as l}from"./api-BC3K8Na8.js";import{f as u,u as d}from"./session-_w8H5O_d.js";import{t as ee}from"./arrow-left-hTN1VoH1.js";import{t as f}from"./arrow-right-6FyN3e7D.js";import{t as p}from"./check-CUpby_J9.js";import{p as te}from"./definition-DndaH5Ow.js";import{h as m,t as ne,y as h}from"./ui-Cj3EzOCA.js";import{d as g,u as _}from"./index-CJ3iuK8-.js";import{a as v,i as y,n as re,r as b}from"./LocalRuntime-BoVnl1ga.js";var x=e(t(),1),S=e(n(),1),C=`oklch(50% 0.2 262)`,w=`oklch(32% 0.15 262)`,T=`oklch(90% 0.1 80)`,E=`oklch(88% 0.17 150)`,D=`oklch(88% 0.14 80)`,O=`rgb(255 255 255 / 0.38)`,ie={"--ink-2":`oklch(96% 0.02 262)`,"--ink-3":`oklch(90% 0.035 262)`,"--ink-4":`oklch(82% 0.05 262)`,"--moss":`oklch(90% 0.14 150)`,"--rose":`oklch(89% 0.09 45)`},k=`ease-[cubic-bezier(0.3,0.7,0.2,1)]`,ae=220,oe={codex:`dome`,claude:`oval`,gemini:`wedge`,cursor:`sprout`,own:`bean`,account:`drop`},se=`oklch(27% 0.09 150)`,A=`relative w-fit max-w-full transition-[left,translate] duration-700 ease-[cubic-bezier(0.3,0.7,0.2,1)] motion-reduce:transition-none`,j=`left-1/2 -translate-x-1/2 text-center`,M=`max-lg:left-1/2 max-lg:-translate-x-1/2 max-lg:text-center lg:left-0 lg:translate-x-0 lg:text-left`;function N(){window.matchMedia(`(max-width: 1023px)`).matches&&window.scrollTo({top:0})}var P=`wizards.setup.own`;function F(){try{return sessionStorage.getItem(P)===`1`}catch{return!1}}function I(e){try{e?sessionStorage.setItem(P,`1`):sessionStorage.removeItem(P)}catch{}}function L(){return(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-2.5`,children:[(0,S.jsx)(i,{size:28}),(0,S.jsxs)(`span`,{className:`font-display font-semibold text-[17px] tracking-tight`,children:[`engenty`,(0,S.jsx)(`span`,{className:`mr-[0.09em] ml-[0.06em]`,style:{color:T},children:`.`}),(0,S.jsx)(`span`,{className:`font-normal text-white/70`,children:`wizards`})]})]})}function R({selected:e,title:t,description:n,badge:r,note:i,onPick:a}){return(0,S.jsxs)(`button`,{type:`button`,onClick:a,"aria-pressed":e,className:m(`group relative flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left transition-[background-color,color,box-shadow] duration-300`,e?`bg-white shadow-elevated`:`bg-white/10 ring-1 ring-white/15 hover:bg-white/15`),style:e?{color:w}:void 0,children:[r?(0,S.jsx)(`span`,{className:`absolute -top-2.5 right-4 rounded-full px-2.5 py-[3px] font-semibold text-[11px] leading-none tracking-wide shadow-[0_2px_8px_oklch(0%_0_0/0.22)]`,style:{background:T,color:w},children:r}):null,(0,S.jsx)(`span`,{className:m(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors duration-300`,e?`border-transparent`:`border-white/40`),style:e?{background:w}:void 0,children:e?(0,S.jsx)(p,{className:`size-3.5 text-white`}):null}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`span`,{className:`block font-medium text-[15px]`,children:t}),(0,S.jsx)(`span`,{className:m(`mt-0.5 block truncate text-[13px]`,e?`opacity-70`:`text-white/65`),children:n})]}),i?(0,S.jsx)(`span`,{className:m(`shrink-0 text-[12px]`,e?`opacity-70`:`text-white/65`),children:i}):null,(0,S.jsx)(f,{className:m(`size-4 shrink-0 transition`,e?`opacity-70`:`text-white/40 group-hover:translate-x-0.5 group-hover:text-white/80`)})]})}function z({name:e,at:t,done:n}){let r=[h(`setup.stage.connect`),h(`setup.stage.test`),h(`setup.stage.done`)],i=n?r.length:t+1;return(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 font-medium text-[12px] uppercase tracking-[0.14em]`,children:[(0,S.jsx)(`span`,{className:`text-white/70`,children:e}),(0,S.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:r.map((e,r)=>{let i=n||r<t;return(0,S.jsxs)(`li`,{"aria-current":!i&&r===t?`step`:void 0,className:`flex items-center gap-1 transition-colors duration-500`,style:{color:i?E:r===t?D:O},children:[i?(0,S.jsx)(p,{className:`size-3.5`,strokeWidth:3}):null,e]},e)})}),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1.5`,children:r.map((e,t)=>(0,S.jsx)(`span`,{className:`h-[3px] w-5 rounded-full transition-colors duration-500`,style:{background:t<i?n?E:D:`rgb(255 255 255 / 0.22)`}},e))})]})}function B({href:e,children:t}){return(0,S.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`transition hover:text-white`,onClick:t=>{t.preventDefault(),b(e)},children:t})}function V(){s(C);let e=d(),t=l(),n=r(),i=o({queryKey:[`config`],queryFn:()=>c.get(`/api/config`)}),[f,b]=(0,x.useState)(F),[D,O]=(0,x.useState)(!1),P=u({mutationFn:e=>c.put(`/api/studio/local/models`,{source:e}),onSuccess:async(e,n)=>{await t.invalidateQueries({queryKey:[`me`]}),b(!0),O(!1),N(),I(n===`own`)}}),V=u({mutationFn:()=>Promise.all((e.data?.harnesses??[]).map(e=>c.post(`/api/studio/local/harness/${e.id}/detect`))),onSuccess:()=>t.invalidateQueries({queryKey:[`me`]})});if(!e.data?.models)return null;let H=e.data.models,U=e=>(e.version===null?2:0)+ +!e.app,W=[...e.data.harnesses].sort((e,t)=>U(e)-U(t)),G=W.filter(e=>e.version!==null),K=f||e.data.setupDone||H.source!==`own`?H.source:null,q=e.data.harnesses.find(e=>e.id===K),J=e.data.setupDone,Y=Object.values(H.keys).some(Boolean),ce=J?2:q?q.auth===`none`?0:1:+!!Y,X=J?h(`setup.h.done`):q?q.version===null?h(`setup.h.install`,{name:q.name}):q.auth===`none`?h(`setup.h.signIn`,{name:q.name}):h(`setup.h.test`):h(Y?`setup.h.test`:`setup.h.keys`),Z=g.site?i.data?.site:null,Q=K!==null&&!D,$=P.isPending?P.variables??K:K;return(0,S.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-white sm:px-10`,style:ie,children:[(0,S.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,S.jsx)(L,{}),(0,S.jsx)(_,{ink:w})]}),(0,S.jsxs)(`main`,{className:`relative mx-auto flex w-full max-w-6xl flex-1 flex-col pt-6 pb-10 lg:pt-[6vh]`,children:[(0,S.jsx)(`div`,{"aria-hidden":`true`,className:m(`absolute top-6 left-1/2 z-10 origin-top -translate-x-1/2 transition-[opacity,scale,left] duration-500 motion-reduce:transition-none lg:top-[calc(6vh+5.25rem)] lg:origin-center lg:translate-x-0`,k,K?`lg:pointer-events-none lg:left-[calc(50%-560px)] lg:scale-75 lg:opacity-0`:`lg:left-[calc(50%-508px)] lg:scale-100 lg:opacity-100`,Q?`max-lg:pointer-events-none max-lg:scale-[0.4] max-lg:opacity-0`:`max-lg:scale-[0.6] max-lg:opacity-100`),children:(0,S.jsx)(`div`,{className:`animate-rise`,children:(0,S.jsx)(a,{kind:`drop`,size:ae,fluffy:!0,coat:`fur`})})}),(0,S.jsx)(`div`,{"aria-hidden":`true`,className:m(`shrink-0 transition-[height] duration-500 motion-reduce:transition-none lg:h-0`,k,Q?`max-lg:h-0`:`max-lg:h-[148px]`)}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-10 lg:flex-row lg:items-start lg:gap-14`,children:[(0,S.jsxs)(`section`,{className:m(`flex w-full shrink-0 animate-rise flex-col lg:w-[32rem] lg:transition-[margin] lg:duration-700 motion-reduce:transition-none`,k,K?`lg:ml-0`:`lg:ml-[calc(50%-16rem)]`,Q?`max-lg:hidden`:``),children:[(0,S.jsxs)(`div`,{className:`flex flex-col lg:min-h-[6.5rem]`,children:[(0,S.jsx)(`p`,{className:m(A,`font-medium text-[12px] text-white/70 uppercase tracking-[0.16em]`,K?M:j),children:h(`setup.title`)}),(0,S.jsx)(`h1`,{className:m(A,`mt-2 font-display font-semibold text-[26px] leading-[1.08] tracking-[-0.02em] sm:text-[28px]`,K?M:j),children:h(`setup.source`)}),(0,S.jsx)(`p`,{className:m(A,`mt-2.5 text-[15px] text-white/75 leading-relaxed`,K?M:j),children:h(`setup.sub`)})]}),(0,S.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[W.map((e,t)=>(0,S.jsx)(R,{selected:$===e.id,title:e.name,description:h(`harness.desc.${e.id}`),badge:t===0?h(`setup.recommended`):void 0,note:e.version===null?h(`harness.notInstalled`):e.auth===`subscription`?h(`harness.ready`):void 0,onPick:()=>P.mutate(e.id)},e.id)),(0,S.jsx)(R,{selected:$===`own`,title:h(`local.sourceOwn`),description:h(`setup.ownDesc`),onPick:()=>P.mutate(`own`)})]}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-center gap-x-2 gap-y-1 text-[13px] text-white/60`,children:[(0,S.jsx)(`span`,{children:G.length?null:h(`setup.noHarness`)}),(0,S.jsxs)(ne,{variant:`ghost`,size:`sm`,busy:V.isPending,onClick:()=>V.mutate(),children:[(0,S.jsx)(te,{className:`size-3.5`}),` `,h(`local.recheck`)]})]})]}),K?(0,S.jsxs)(`section`,{className:m(`min-w-0 flex-1 animate-settle`,D?`max-lg:hidden`:``),children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>{O(!0),N()},className:`-ml-1.5 mb-5 inline-flex items-center gap-1.5 rounded-full px-1.5 py-1 text-[14px] text-white/80 transition hover:text-white lg:hidden`,children:[(0,S.jsx)(ee,{className:`size-4`}),` `,h(`run.back`)]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{"aria-hidden":`true`,className:`absolute top-6 right-2 z-10`,children:(0,S.jsx)(a,{kind:oe[K],size:120,fluffy:!0,coat:`fur`})}),(0,S.jsxs)(`div`,{className:`min-h-[6.5rem]`,children:[(0,S.jsx)(z,{name:q?.name??h(`local.sourceOwn`),at:ce,done:J}),(0,S.jsx)(`h2`,{className:`mt-2 animate-rise pr-32 font-display font-semibold text-[clamp(28px,3vw,40px)] leading-[1.06] tracking-[-0.03em]`,children:X},X)]}),(0,S.jsx)(`div`,{className:`mt-5 rounded-2xl bg-white/[0.07] p-5 ring-1 ring-white/12 sm:p-6`,children:q?(0,S.jsx)(y,{me:e.data,id:q.id,autoTest:!J}):(0,S.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,S.jsx)(re,{models:H}),(0,S.jsx)(v,{})]})}),(0,S.jsxs)(`div`,{className:`mt-9`,children:[J?(0,S.jsxs)(`p`,{className:`mb-3 flex animate-rise items-center gap-2 font-medium text-[15px]`,style:{color:E},children:[(0,S.jsx)(p,{className:`size-4`,strokeWidth:3}),h(`setup.ready`)]}):null,(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,S.jsxs)(`button`,{type:`button`,disabled:!J,onClick:()=>n(`/`,{replace:!0}),className:m(`group inline-flex h-12 items-center gap-2.5 rounded-full px-6 font-semibold text-[16px] transition-[background-color,color,box-shadow,filter] duration-300`,J?`shadow-[0_6px_24px_oklch(88%_0.17_150/0.35)] hover:brightness-105`:`cursor-not-allowed bg-white/20 text-white/65`),style:J?{background:E,color:se}:void 0,children:[h(`setup.done`),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-enabled:group-hover:translate-x-0.5`,children:`→`})]}),J?null:(0,S.jsx)(`span`,{className:`text-[13px] text-white/65`,children:h(`setup.untilWorks`)})]})]})]})]},K):null]})]}),(0,S.jsxs)(`footer`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between gap-4 pb-6 text-[12px] text-white/55 sm:pb-8`,children:[(0,S.jsxs)(`span`,{children:[`© `,new Date().getFullYear(),` engenty · `,h(`setup.local`)]}),(0,S.jsxs)(`span`,{className:`flex items-center gap-5`,children:[Z?(0,S.jsx)(B,{href:Z,children:new URL(Z).host}):null,(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`size-[3px]`,style:{background:T}})]})]})]})}export{V as SetupPage};
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,_ as i,d as a,j as o,m as s,n as c,nt as l}from"./api-C7nO5qT8.js";import{f as u,u as d}from"./session-C44_g_hY.js";import{t as ee}from"./arrow-left-hTN1VoH1.js";import{t as f}from"./arrow-right-6FyN3e7D.js";import{t as p}from"./check-CUpby_J9.js";import{p as te}from"./definition-DndaH5Ow.js";import{h as m,t as ne,y as h}from"./ui-BHAxG0j4.js";import{d as g,u as _}from"./index-Dp8RnbHf.js";import{a as v,i as y,n as re,r as b}from"./LocalRuntime-DwCJawPW.js";var x=e(t(),1),S=e(n(),1),C=`oklch(50% 0.2 262)`,w=`oklch(32% 0.15 262)`,T=`oklch(90% 0.1 80)`,E=`oklch(88% 0.17 150)`,D=`oklch(88% 0.14 80)`,O=`rgb(255 255 255 / 0.38)`,ie={"--ink-2":`oklch(96% 0.02 262)`,"--ink-3":`oklch(90% 0.035 262)`,"--ink-4":`oklch(82% 0.05 262)`,"--moss":`oklch(90% 0.14 150)`,"--rose":`oklch(89% 0.09 45)`},k=`ease-[cubic-bezier(0.3,0.7,0.2,1)]`,ae=220,oe={codex:`dome`,claude:`oval`,gemini:`wedge`,cursor:`sprout`,own:`bean`,account:`drop`},se=`oklch(27% 0.09 150)`,A=`relative w-fit max-w-full transition-[left,translate] duration-700 ease-[cubic-bezier(0.3,0.7,0.2,1)] motion-reduce:transition-none`,j=`left-1/2 -translate-x-1/2 text-center`,M=`max-lg:left-1/2 max-lg:-translate-x-1/2 max-lg:text-center lg:left-0 lg:translate-x-0 lg:text-left`;function N(){window.matchMedia(`(max-width: 1023px)`).matches&&window.scrollTo({top:0})}var P=`wizards.setup.own`;function F(){try{return sessionStorage.getItem(P)===`1`}catch{return!1}}function I(e){try{e?sessionStorage.setItem(P,`1`):sessionStorage.removeItem(P)}catch{}}function L(){return(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-2.5`,children:[(0,S.jsx)(i,{size:28}),(0,S.jsxs)(`span`,{className:`font-display font-semibold text-[17px] tracking-tight`,children:[`engenty`,(0,S.jsx)(`span`,{className:`mr-[0.09em] ml-[0.06em]`,style:{color:T},children:`.`}),(0,S.jsx)(`span`,{className:`font-normal text-white/70`,children:`wizards`})]})]})}function R({selected:e,title:t,description:n,badge:r,note:i,onPick:a}){return(0,S.jsxs)(`button`,{type:`button`,onClick:a,"aria-pressed":e,className:m(`group relative flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left transition-[background-color,color,box-shadow] duration-300`,e?`bg-white shadow-elevated`:`bg-white/10 ring-1 ring-white/15 hover:bg-white/15`),style:e?{color:w}:void 0,children:[r?(0,S.jsx)(`span`,{className:`absolute -top-2.5 right-4 rounded-full px-2.5 py-[3px] font-semibold text-[11px] leading-none tracking-wide shadow-[0_2px_8px_oklch(0%_0_0/0.22)]`,style:{background:T,color:w},children:r}):null,(0,S.jsx)(`span`,{className:m(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors duration-300`,e?`border-transparent`:`border-white/40`),style:e?{background:w}:void 0,children:e?(0,S.jsx)(p,{className:`size-3.5 text-white`}):null}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`span`,{className:`block font-medium text-[15px]`,children:t}),(0,S.jsx)(`span`,{className:m(`mt-0.5 block truncate text-[13px]`,e?`opacity-70`:`text-white/65`),children:n})]}),i?(0,S.jsx)(`span`,{className:m(`shrink-0 text-[12px]`,e?`opacity-70`:`text-white/65`),children:i}):null,(0,S.jsx)(f,{className:m(`size-4 shrink-0 transition`,e?`opacity-70`:`text-white/40 group-hover:translate-x-0.5 group-hover:text-white/80`)})]})}function z({name:e,at:t,done:n}){let r=[h(`setup.stage.connect`),h(`setup.stage.test`),h(`setup.stage.done`)],i=n?r.length:t+1;return(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 font-medium text-[12px] uppercase tracking-[0.14em]`,children:[(0,S.jsx)(`span`,{className:`text-white/70`,children:e}),(0,S.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:r.map((e,r)=>{let i=n||r<t;return(0,S.jsxs)(`li`,{"aria-current":!i&&r===t?`step`:void 0,className:`flex items-center gap-1 transition-colors duration-500`,style:{color:i?E:r===t?D:O},children:[i?(0,S.jsx)(p,{className:`size-3.5`,strokeWidth:3}):null,e]},e)})}),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1.5`,children:r.map((e,t)=>(0,S.jsx)(`span`,{className:`h-[3px] w-5 rounded-full transition-colors duration-500`,style:{background:t<i?n?E:D:`rgb(255 255 255 / 0.22)`}},e))})]})}function B({href:e,children:t}){return(0,S.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`transition hover:text-white`,onClick:t=>{t.preventDefault(),b(e)},children:t})}function V(){s(C);let e=d(),t=l(),n=r(),i=o({queryKey:[`config`],queryFn:()=>c.get(`/api/config`)}),[f,b]=(0,x.useState)(F),[D,O]=(0,x.useState)(!1),P=u({mutationFn:e=>c.put(`/api/studio/local/models`,{source:e}),onSuccess:async(e,n)=>{await t.invalidateQueries({queryKey:[`me`]}),b(!0),O(!1),N(),I(n===`own`)}}),V=u({mutationFn:()=>Promise.all((e.data?.harnesses??[]).map(e=>c.post(`/api/studio/local/harness/${e.id}/detect`))),onSuccess:()=>t.invalidateQueries({queryKey:[`me`]})});if(!e.data?.models)return null;let H=e.data.models,U=e=>(e.version===null?2:0)+ +!e.app,W=[...e.data.harnesses].sort((e,t)=>U(e)-U(t)),G=W.filter(e=>e.version!==null),K=f||e.data.setupDone||H.source!==`own`?H.source:null,q=e.data.harnesses.find(e=>e.id===K),J=e.data.setupDone,Y=Object.values(H.keys).some(Boolean),ce=J?2:q?q.auth===`none`?0:1:+!!Y,X=J?h(`setup.h.done`):q?q.version===null?h(`setup.h.install`,{name:q.name}):q.auth===`none`?h(`setup.h.signIn`,{name:q.name}):h(`setup.h.test`):h(Y?`setup.h.test`:`setup.h.keys`),Z=g.site?i.data?.site:null,Q=K!==null&&!D,$=P.isPending?P.variables??K:K;return(0,S.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-white sm:px-10`,style:ie,children:[(0,S.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,S.jsx)(L,{}),(0,S.jsx)(_,{ink:w})]}),(0,S.jsxs)(`main`,{className:`relative mx-auto flex w-full max-w-6xl flex-1 flex-col pt-6 pb-10 lg:pt-[6vh]`,children:[(0,S.jsx)(`div`,{"aria-hidden":`true`,className:m(`absolute top-6 left-1/2 z-10 origin-top -translate-x-1/2 transition-[opacity,scale,left] duration-500 motion-reduce:transition-none lg:top-[calc(6vh+5.25rem)] lg:origin-center lg:translate-x-0`,k,K?`lg:pointer-events-none lg:left-[calc(50%-560px)] lg:scale-75 lg:opacity-0`:`lg:left-[calc(50%-508px)] lg:scale-100 lg:opacity-100`,Q?`max-lg:pointer-events-none max-lg:scale-[0.4] max-lg:opacity-0`:`max-lg:scale-[0.6] max-lg:opacity-100`),children:(0,S.jsx)(`div`,{className:`animate-rise`,children:(0,S.jsx)(a,{kind:`drop`,size:ae,fluffy:!0,coat:`fur`})})}),(0,S.jsx)(`div`,{"aria-hidden":`true`,className:m(`shrink-0 transition-[height] duration-500 motion-reduce:transition-none lg:h-0`,k,Q?`max-lg:h-0`:`max-lg:h-[148px]`)}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-10 lg:flex-row lg:items-start lg:gap-14`,children:[(0,S.jsxs)(`section`,{className:m(`flex w-full shrink-0 animate-rise flex-col lg:w-[32rem] lg:transition-[margin] lg:duration-700 motion-reduce:transition-none`,k,K?`lg:ml-0`:`lg:ml-[calc(50%-16rem)]`,Q?`max-lg:hidden`:``),children:[(0,S.jsxs)(`div`,{className:`flex flex-col lg:min-h-[6.5rem]`,children:[(0,S.jsx)(`p`,{className:m(A,`font-medium text-[12px] text-white/70 uppercase tracking-[0.16em]`,K?M:j),children:h(`setup.title`)}),(0,S.jsx)(`h1`,{className:m(A,`mt-2 font-display font-semibold text-[26px] leading-[1.08] tracking-[-0.02em] sm:text-[28px]`,K?M:j),children:h(`setup.source`)}),(0,S.jsx)(`p`,{className:m(A,`mt-2.5 text-[15px] text-white/75 leading-relaxed`,K?M:j),children:h(`setup.sub`)})]}),(0,S.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[W.map((e,t)=>(0,S.jsx)(R,{selected:$===e.id,title:e.name,description:h(`harness.desc.${e.id}`),badge:t===0?h(`setup.recommended`):void 0,note:e.version===null?h(`harness.notInstalled`):e.auth===`subscription`?h(`harness.ready`):void 0,onPick:()=>P.mutate(e.id)},e.id)),(0,S.jsx)(R,{selected:$===`own`,title:h(`local.sourceOwn`),description:h(`setup.ownDesc`),onPick:()=>P.mutate(`own`)})]}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-center gap-x-2 gap-y-1 text-[13px] text-white/60`,children:[(0,S.jsx)(`span`,{children:G.length?null:h(`setup.noHarness`)}),(0,S.jsxs)(ne,{variant:`ghost`,size:`sm`,busy:V.isPending,onClick:()=>V.mutate(),children:[(0,S.jsx)(te,{className:`size-3.5`}),` `,h(`local.recheck`)]})]})]}),K?(0,S.jsxs)(`section`,{className:m(`min-w-0 flex-1 animate-settle`,D?`max-lg:hidden`:``),children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>{O(!0),N()},className:`-ml-1.5 mb-5 inline-flex items-center gap-1.5 rounded-full px-1.5 py-1 text-[14px] text-white/80 transition hover:text-white lg:hidden`,children:[(0,S.jsx)(ee,{className:`size-4`}),` `,h(`run.back`)]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{"aria-hidden":`true`,className:`absolute top-6 right-2 z-10`,children:(0,S.jsx)(a,{kind:oe[K],size:120,fluffy:!0,coat:`fur`})}),(0,S.jsxs)(`div`,{className:`min-h-[6.5rem]`,children:[(0,S.jsx)(z,{name:q?.name??h(`local.sourceOwn`),at:ce,done:J}),(0,S.jsx)(`h2`,{className:`mt-2 animate-rise pr-32 font-display font-semibold text-[clamp(28px,3vw,40px)] leading-[1.06] tracking-[-0.03em]`,children:X},X)]}),(0,S.jsx)(`div`,{className:`mt-5 rounded-2xl bg-white/[0.07] p-5 ring-1 ring-white/12 sm:p-6`,children:q?(0,S.jsx)(y,{me:e.data,id:q.id,autoTest:!J}):(0,S.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,S.jsx)(re,{models:H}),(0,S.jsx)(v,{})]})}),(0,S.jsxs)(`div`,{className:`mt-9`,children:[J?(0,S.jsxs)(`p`,{className:`mb-3 flex animate-rise items-center gap-2 font-medium text-[15px]`,style:{color:E},children:[(0,S.jsx)(p,{className:`size-4`,strokeWidth:3}),h(`setup.ready`)]}):null,(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,S.jsxs)(`button`,{type:`button`,disabled:!J,onClick:()=>n(`/`,{replace:!0}),className:m(`group inline-flex h-12 items-center gap-2.5 rounded-full px-6 font-semibold text-[16px] transition-[background-color,color,box-shadow,filter] duration-300`,J?`shadow-[0_6px_24px_oklch(88%_0.17_150/0.35)] hover:brightness-105`:`cursor-not-allowed bg-white/20 text-white/65`),style:J?{background:E,color:se}:void 0,children:[h(`setup.done`),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-enabled:group-hover:translate-x-0.5`,children:`→`})]}),J?null:(0,S.jsx)(`span`,{className:`text-[13px] text-white/65`,children:h(`setup.untilWorks`)})]})]})]})]},K):null]})]}),(0,S.jsxs)(`footer`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between gap-4 pb-6 text-[12px] text-white/55 sm:pb-8`,children:[(0,S.jsxs)(`span`,{children:[`© `,new Date().getFullYear(),` engenty · `,h(`setup.local`)]}),(0,S.jsxs)(`span`,{className:`flex items-center gap-5`,children:[Z?(0,S.jsx)(B,{href:Z,children:new URL(Z).host}):null,(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`size-[3px]`,style:{background:T}})]})]})]})}export{V as SetupPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{a as r,d as i,h as a,j as o,k as s,l as c,n as l,r as u}from"./api-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{a as r,d as i,h as a,j as o,k as s,l as c,n as l,r as u}from"./api-C7nO5qT8.js";import{t as d}from"./arrow-right-6FyN3e7D.js";import{i as f,t as p}from"./outputs-Cy_I6D0i.js";import{_ as m,d as h,n as g,t as _,y as v}from"./ui-BHAxG0j4.js";import{BrandHeader as y,useBrandAccent as b}from"./PublicRunner-D3uBfK35.js";var x=e(t(),1),S=e(n(),1);function C(){let{token:e}=s(),t=o({queryKey:[`share`,e],queryFn:()=>l.get(`/api/shares/${e}`),retry:(e,t)=>u(t)&&e<3});if(b(t.data?.brand.accent),a(t.data?.wizard.avatar),(0,x.useEffect)(()=>{t.data&&(document.title=`${t.data.title} · ${t.data.wizard.title}`)},[t.data]),t.isLoading)return(0,S.jsx)(`div`,{className:`flex min-h-dvh items-center justify-center text-ink-4`,children:(0,S.jsx)(h,{})});let n=t.data;if(!n)return(0,S.jsxs)(`div`,{className:`flex min-h-dvh flex-col items-center justify-center gap-4 px-6 text-center`,children:[(0,S.jsx)(i,{kind:`pebble`,size:80}),(0,S.jsx)(`p`,{className:`max-w-sm text-ink-3`,children:v(u(t.error)?`common.offline`:`sharePage.gone`)}),u(t.error)?(0,S.jsx)(_,{variant:`secondary`,onClick:()=>void t.refetch(),children:v(`common.retry`)}):null]});let C=`/api/shares/${n.token}`,w=e=>new Intl.DateTimeFormat(m,{dateStyle:`long`}).format(new Date(e));return(0,S.jsxs)(`div`,{className:`flex min-h-dvh flex-col`,children:[(0,S.jsx)(y,{brand:n.brand}),(0,S.jsxs)(`main`,{className:`mx-auto w-full max-w-3xl flex-1 animate-rise px-4 pt-6 pb-12 sm:px-6`,children:[(0,S.jsxs)(`div`,{className:`mb-8 flex flex-wrap items-center gap-4`,children:[(0,S.jsx)(i,{kind:n.wizard.avatar,size:64}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`p`,{className:`text-[13px] text-ink-4`,children:n.expiresAt?v(`sharePage.until`,{date:w(n.expiresAt)}):v(`sharePage.shared`,{date:w(n.createdAt)})}),(0,S.jsx)(`h1`,{className:`font-display font-semibold text-[28px] leading-tight tracking-tight sm:text-[32px]`,children:n.title}),n.message?(0,S.jsx)(`p`,{className:`mt-1 text-[15px] text-ink-3`,children:n.message}):null]})]}),(0,S.jsx)(`div`,{className:`flex flex-col gap-6`,children:n.shown.map(({step:e,output:t,formats:n,label:r})=>(0,S.jsxs)(g,{className:`p-4 sm:p-5`,children:[(0,S.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,S.jsx)(`h2`,{className:`font-display font-semibold text-[17px]`,children:r??e.title}),(0,S.jsx)(p,{base:C,stepId:e.id,formats:n,title:r??e.title})]}),(0,S.jsx)(f,{base:C,step:e,output:t})]},e.id))}),n.wizardUrl?(0,S.jsxs)(`a`,{href:n.wizardUrl,className:`mt-10 flex items-center gap-4 rounded-2xl bg-card p-5 shadow-soft ring-1 ring-border-soft transition hover:shadow-elevated`,children:[(0,S.jsx)(i,{kind:n.wizard.avatar,size:44,interactive:!1}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`font-display font-semibold text-[16px]`,children:n.wizard.title}),n.wizard.description?(0,S.jsx)(`div`,{className:`truncate text-[14px] text-ink-3`,children:n.wizard.description}):null]}),(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium text-[14px] text-ember-strong`,children:[v(`sharePage.own`),` `,(0,S.jsx)(d,{className:`size-4`})]})]}):null]}),(0,S.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[12px] text-ink-4`,children:(0,S.jsx)(`a`,{href:`${r}/`,className:`inline-block py-3.5 hover:text-ink-2`,children:v(`run.madeWith`).replace(`engenty wizards`,c.name)})})]})}export{C as SharePage};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/fluffy-engenty-D7rFrNcJ.js","assets/jsx-runtime-D3jfb0Ew.js","assets/engenty-Cm8yZLON.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{t as r}from"./preload-helper-CNEI7N0N.js";import{t as i}from"./createLucideIcon-q3MZMmnf.js";import{c as a,l as o,t as s,u as c}from"./engenty-Cm8yZLON.js";import{o as l,y as u}from"./ui-Cj3EzOCA.js";var d=e(t(),1),f=e(n(),1),p=d.createContext(void 0),m=e=>{let t=d.useContext(p);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},h=({client:e,children:t})=>(d.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,f.jsx)(p.Provider,{value:e,children:t})),g={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_=new class{#e=g;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function v(e){setTimeout(e,0)}var y=typeof window>`u`||`Deno`in globalThis;function b(){}function x(e,t){return typeof e==`function`?e(t):e}function S(e){return typeof e==`number`&&e>=0&&e!==1/0}function C(e,t){return Math.max(e+(t||0)-Date.now(),0)}function w(e,t){return typeof e==`function`?e(t):e}function ee(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ne(o,t.options))return!1}else if(!E(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function te(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(T(t.options.mutationKey)!==T(a))return!1}else if(!E(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ne(e,t){return(t?.queryKeyHashFn||T)(e)}function T(e){return JSON.stringify(e,(e,t)=>se(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function E(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!E(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!E(e[r],t[r]))return!1;return!0}return!1}var re=Object.prototype.hasOwnProperty;function ie(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=oe(e)&&oe(t);if(!r&&!(se(e)&&se(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:re.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=ie(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ae(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function oe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function se(e){if(!ce(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!ce(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function ce(e){return Object.prototype.toString.call(e)===`[object Object]`}function le(e){return new Promise(t=>{_.setTimeout(t,e)})}function ue(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ie(e,t)}function de(e){return e}function fe(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function pe(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var me=Symbol();function he(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===me?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ge(e,t){return typeof e==`function`?e(...t):!!e}function _e(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var ve=()=>y,ye=()=>ve(),be=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},xe=new class extends be{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Se=v;function Ce(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Se,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var we=Ce(),Te=new class extends be{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Ee(e){return Math.min(1e3*2**e,3e4)}function De(e){return(e??`online`)!==`online`||Te.isOnline()}var Oe=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ke(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(b);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Oe(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>xe.isFocused()&&(e.networkMode===`always`||Te.isOnline())&&e.canRun(),p=()=>De(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(ye()?0:3),a=e.retryDelay??Ee,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),le(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Ae=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),S(this.gcTime)&&(this.#e=_.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ye()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(_.clearTimeout(this.#e),this.#e=void 0)}};function je(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{_e(e,()=>t.signal,()=>n=!0)},u=he(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?pe:fe;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Ne:Me,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Me(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Me(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ne(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Pe(e,t){return t?Me(e,t)!=null:!1}function Fe(e,t){return!t||!e.getPreviousPageParam?!1:Ne(e,t)!=null}var Ie=class extends Ae{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=ze(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=ze(this.options);e.data!==void 0&&(this.setState(Re(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ue(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(b).catch(b):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>w(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===me||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>w(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!C(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=he(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?je(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=ke({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Oe&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Oe){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Le(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Re(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),we.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Le(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:De(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Re(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ze(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Be=class extends be{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),He(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ue(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ue(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof w(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!ae(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&We(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||w(this.options.staleTime,this.#t)!==w(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ae(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(b)),t}#h(e){return!ye()&&w(this.options.enabled,this.#t)!==!1&&S(e)}#g(){this.#b();let e=w(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=C(this.#r.dataUpdatedAt,e)+1;this.#u=_.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return w(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=_.setInterval(()=>{(this.options.refetchIntervalInBackground||xe.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(_.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(_.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&He(e,t),o=i&&We(e,n,t,r);(a||o)&&(l={...l,...Le(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=ue(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=ue(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ge(e,t),refetch:this.refetch,isEnabled:w(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),ae(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();we.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Ve(e,t){return w(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||w(t.retryOnMount,e)!==!1)}function He(e,t){return Ve(e,t)||e.state.data!==void 0&&Ue(e,t,t.refetchOnMount)}function Ue(e,t,n){if(w(t.enabled,e)!==!1&&w(t.staleTime,e)!==`static`){let r=w(n,e);return r===`always`||r!==!1&&Ge(e,t)}return!1}function We(e,t,n,r){return(e!==t||w(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ge(e,n)}function Ge(e,t){return w(t.enabled,e)!==!1&&e.isStaleByTime(w(t.staleTime,e))}var Ke=d.createContext(!1),qe=()=>d.useContext(Ke);Ke.Provider;function Je(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ye=d.createContext(Je()),Xe=()=>d.useContext(Ye),Ze=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ge(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Qe=e=>{d.useEffect(()=>{e.clearReset()},[e])},$e=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ge(n,[e.error,r])),et=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},tt=(e,t)=>e?.suspense&&t.isPending,nt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function rt(e,t,n){let r=qe(),i=Xe(),a=m(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,et(o),Ze(o,i,s),Qe(i);let[l]=d.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),f=!r&&c;if(d.useSyncExternalStore(d.useCallback(e=>{let t=f?l.subscribe(we.batchCalls(e)):b;return l.updateResult(),t},[l,f]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),d.useEffect(()=>{l.setOptions(o)},[o,l]),tt(o,u))throw nt(o,l,i);if($e({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function it(e,t){return rt(e,Be,t)}var at=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,ot=/^[\\/]{2}/;function st(e,t){return t+e.replace(/\\/g,`/`)}var ct=`popstate`;function lt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function ut(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return pt(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:k(t)}return mt(t,n,null,e)}function D(e,t){if(e===!1||e==null)throw Error(t)}function O(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function dt(){return Math.random().toString(36).substring(2,10)}function ft(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function pt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?A(t):t,state:n,key:t&&t.key||r||dt(),mask:i}}function k({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function A(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function mt(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=lt(e)?e:pt(h.location,e,t);n&&n(r,e),l=u()+1;let d=ft(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=lt(e)?e:pt(h.location,e,t);n&&n(r,e),l=u();let i=ft(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return ht(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(ct,d),c=e,()=>{i.removeEventListener(ct,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function ht(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),D(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:k(t);return i=i.replace(/ $/,`%20`),!n&&ot.test(i)&&(i=r+i),new URL(i,r)}function gt(e,t,n=`/`){return _t(e,t,n,!1)}function _t(e,t,n,r,i){let a=M((typeof t==`string`?A(t):t).pathname||`/`,n);if(a==null)return null;let o=i??vt(e),s=null,c=Pt(a);for(let e=0;s==null&&e<o.length;++e)s=jt(o[e],c,r);return s}function vt(e){let t=yt(e);return xt(t),t}function yt(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;D(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=N([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(D(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),yt(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:kt(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Nt(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of bt(e.path))a(e,t,!0,n)}),t}function bt(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=bt(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function xt(e){e.sort((e,t)=>e.score===t.score?At(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var St=/^:[\w-]+$/,Ct=3,wt=2,Tt=1,Et=10,Dt=-2,Ot=e=>e===`*`;function kt(e,t){let n=e.split(`/`),r=n.length;return n.some(Ot)&&(r+=Dt),t&&(r+=wt),n.filter(e=>!Ot(e)).reduce((e,t)=>e+(St.test(t)?Ct:t===``?Tt:Et),r)}function At(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function jt(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?Mt(u,l,s.matcher,s.compiledParams):j(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=j({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:N([a,d.pathname]),pathnameBase:Ht(N([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=N([a,d.pathnameBase]))}return o}function j(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Nt(e.path,e.caseSensitive,e.end);return Mt(e,t,n,r)}function Mt(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=P(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=P(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Nt(e,t=!1,n=!0){O(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Pt(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return O(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function M(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function Ft(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?A(e):e,a;return n?(n=Vt(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?It(n.substring(1),`/`):It(n,t)):a=t,{pathname:a,search:Ut(r),hash:Wt(i)}}function It(e,t){let n=P(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Lt(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Rt(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function zt(e){let t=Rt(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Bt(e,t,n,r=!1){let i;typeof e==`string`?i=A(e):(i={...e},D(!i.pathname||!i.pathname.includes(`?`),Lt(`?`,`pathname`,`search`,i)),D(!i.pathname||!i.pathname.includes(`#`),Lt(`#`,`pathname`,`hash`,i)),D(!i.search||!i.search.includes(`#`),Lt(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Ft(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Vt=e=>e.replace(/[\\/]{2,}/g,`/`),N=e=>Vt(e.join(`/`));function P(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var Ht=e=>P(e).replace(/^\/*/,`/`),Ut=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Wt=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Gt=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Kt(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function qt(e){return N(e.map(e=>e.route.path).filter(Boolean))||`/`}var Jt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Yt(e,t){let n=e;if(typeof n!=`string`||!at.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Jt)try{let e=new URL(window.location.href),r=ot.test(n)?new URL(st(n,e.protocol)):new URL(n),a=M(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{O(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Xt=new URL(`http://localhost`);function Zt(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),Xt)}catch{return Xt}}function Qt(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function $t(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function en(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!Qt(i,n),s=!Qt(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!$t(e,i)||!Qt(i,a)))throw Error(`External navigation is not allowed`)}var tn=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(tn);var nn=[`GET`,...tn];new Set(nn);var rn=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function an(e){try{return rn.includes(new URL(e).protocol)}catch{return!1}}var F=d.createContext(null);F.displayName=`DataRouter`;var I=d.createContext(null);I.displayName=`DataRouterState`;var on=d.createContext(!1);function sn(){return d.useContext(on)}var cn=d.createContext({isTransitioning:!1});cn.displayName=`ViewTransition`;var ln=d.createContext(new Map);ln.displayName=`Fetchers`;var un=d.createContext(null);un.displayName=`Await`;var L=d.createContext(null);L.displayName=`Navigation`;var R=d.createContext(null);R.displayName=`Location`;var z=d.createContext({outlet:null,matches:[],isDataRoute:!1});z.displayName=`Route`;var dn=d.createContext(null);dn.displayName=`RouteError`;var fn=`REACT_ROUTER_ERROR`,pn=`REDIRECT`,mn=`ROUTE_ERROR_RESPONSE`;function hn(e){if(e.startsWith(`${fn}:${pn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function gn(e){if(e.startsWith(`${fn}:${mn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Gt(t.status,t.statusText,t.data)}catch{}}function _n(e,{relative:t}={}){D(B(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=d.useContext(L),{hash:i,pathname:a,search:o}=U(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:N([n,a])),r.createHref({pathname:s,search:o,hash:i})}function B(){return d.useContext(R)!=null}function V(){return D(B(),`useLocation() may be used only in the context of a <Router> component.`),d.useContext(R).location}var vn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function yn(e){d.useContext(L).static||d.useLayoutEffect(e)}function H(){let{isDataRoute:e}=d.useContext(z);return e?Rn():bn()}function bn(){D(B(),`useNavigate() may be used only in the context of a <Router> component.`);let e=d.useContext(F),{basename:t,navigator:n}=d.useContext(L),{matches:r}=d.useContext(z),{pathname:i}=V(),a=JSON.stringify(zt(r)),o=d.useRef(!1);return yn(()=>{o.current=!0}),d.useCallback((r,s={})=>{if(O(o.current,vn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Bt(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:N([t,c.pathname])),en(typeof r==`string`?r:k(r),n.createHref(c),Zt(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}d.createContext(null);function xn(){let{matches:e}=d.useContext(z);return e[e.length-1]?.params??{}}function U(e,{relative:t}={}){let{matches:n}=d.useContext(z),{pathname:r}=V(),i=JSON.stringify(zt(n));return d.useMemo(()=>Bt(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Sn(e,t){return Cn(e,t)}function Cn(e,t,n){D(B(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=d.useContext(L),{matches:i}=d.useContext(z),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Bn(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
2
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{t as r}from"./preload-helper-CNEI7N0N.js";import{t as i}from"./createLucideIcon-q3MZMmnf.js";import{c as a,l as o,t as s,u as c}from"./engenty-Cm8yZLON.js";import{o as l,y as u}from"./ui-BHAxG0j4.js";var d=e(t(),1),f=e(n(),1),p=d.createContext(void 0),m=e=>{let t=d.useContext(p);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},h=({client:e,children:t})=>(d.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,f.jsx)(p.Provider,{value:e,children:t})),g={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_=new class{#e=g;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function v(e){setTimeout(e,0)}var y=typeof window>`u`||`Deno`in globalThis;function b(){}function x(e,t){return typeof e==`function`?e(t):e}function S(e){return typeof e==`number`&&e>=0&&e!==1/0}function C(e,t){return Math.max(e+(t||0)-Date.now(),0)}function w(e,t){return typeof e==`function`?e(t):e}function ee(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ne(o,t.options))return!1}else if(!E(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function te(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(T(t.options.mutationKey)!==T(a))return!1}else if(!E(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ne(e,t){return(t?.queryKeyHashFn||T)(e)}function T(e){return JSON.stringify(e,(e,t)=>se(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function E(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!E(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!E(e[r],t[r]))return!1;return!0}return!1}var re=Object.prototype.hasOwnProperty;function ie(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=oe(e)&&oe(t);if(!r&&!(se(e)&&se(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:re.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=ie(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ae(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function oe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function se(e){if(!ce(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!ce(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function ce(e){return Object.prototype.toString.call(e)===`[object Object]`}function le(e){return new Promise(t=>{_.setTimeout(t,e)})}function ue(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ie(e,t)}function de(e){return e}function fe(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function pe(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var me=Symbol();function he(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===me?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ge(e,t){return typeof e==`function`?e(...t):!!e}function _e(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var ve=()=>y,ye=()=>ve(),be=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},xe=new class extends be{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Se=v;function Ce(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Se,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var we=Ce(),Te=new class extends be{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Ee(e){return Math.min(1e3*2**e,3e4)}function De(e){return(e??`online`)!==`online`||Te.isOnline()}var Oe=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ke(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(b);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Oe(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>xe.isFocused()&&(e.networkMode===`always`||Te.isOnline())&&e.canRun(),p=()=>De(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(ye()?0:3),a=e.retryDelay??Ee,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),le(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Ae=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),S(this.gcTime)&&(this.#e=_.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ye()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(_.clearTimeout(this.#e),this.#e=void 0)}};function je(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{_e(e,()=>t.signal,()=>n=!0)},u=he(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?pe:fe;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Ne:Me,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Me(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Me(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ne(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Pe(e,t){return t?Me(e,t)!=null:!1}function Fe(e,t){return!t||!e.getPreviousPageParam?!1:Ne(e,t)!=null}var Ie=class extends Ae{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=ze(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=ze(this.options);e.data!==void 0&&(this.setState(Re(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ue(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(b).catch(b):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>w(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===me||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>w(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!C(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=he(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?je(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=ke({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Oe&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Oe){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Le(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Re(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),we.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Le(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:De(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Re(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ze(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Be=class extends be{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),He(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ue(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ue(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof w(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!ae(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&We(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||w(this.options.staleTime,this.#t)!==w(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ae(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(b)),t}#h(e){return!ye()&&w(this.options.enabled,this.#t)!==!1&&S(e)}#g(){this.#b();let e=w(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=C(this.#r.dataUpdatedAt,e)+1;this.#u=_.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return w(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=_.setInterval(()=>{(this.options.refetchIntervalInBackground||xe.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(_.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(_.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&He(e,t),o=i&&We(e,n,t,r);(a||o)&&(l={...l,...Le(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=ue(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=ue(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ge(e,t),refetch:this.refetch,isEnabled:w(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),ae(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();we.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Ve(e,t){return w(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||w(t.retryOnMount,e)!==!1)}function He(e,t){return Ve(e,t)||e.state.data!==void 0&&Ue(e,t,t.refetchOnMount)}function Ue(e,t,n){if(w(t.enabled,e)!==!1&&w(t.staleTime,e)!==`static`){let r=w(n,e);return r===`always`||r!==!1&&Ge(e,t)}return!1}function We(e,t,n,r){return(e!==t||w(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ge(e,n)}function Ge(e,t){return w(t.enabled,e)!==!1&&e.isStaleByTime(w(t.staleTime,e))}var Ke=d.createContext(!1),qe=()=>d.useContext(Ke);Ke.Provider;function Je(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ye=d.createContext(Je()),Xe=()=>d.useContext(Ye),Ze=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ge(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Qe=e=>{d.useEffect(()=>{e.clearReset()},[e])},$e=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ge(n,[e.error,r])),et=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},tt=(e,t)=>e?.suspense&&t.isPending,nt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function rt(e,t,n){let r=qe(),i=Xe(),a=m(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,et(o),Ze(o,i,s),Qe(i);let[l]=d.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),f=!r&&c;if(d.useSyncExternalStore(d.useCallback(e=>{let t=f?l.subscribe(we.batchCalls(e)):b;return l.updateResult(),t},[l,f]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),d.useEffect(()=>{l.setOptions(o)},[o,l]),tt(o,u))throw nt(o,l,i);if($e({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function it(e,t){return rt(e,Be,t)}var at=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,ot=/^[\\/]{2}/;function st(e,t){return t+e.replace(/\\/g,`/`)}var ct=`popstate`;function lt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function ut(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return pt(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:k(t)}return mt(t,n,null,e)}function D(e,t){if(e===!1||e==null)throw Error(t)}function O(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function dt(){return Math.random().toString(36).substring(2,10)}function ft(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function pt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?A(t):t,state:n,key:t&&t.key||r||dt(),mask:i}}function k({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function A(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function mt(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=lt(e)?e:pt(h.location,e,t);n&&n(r,e),l=u()+1;let d=ft(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=lt(e)?e:pt(h.location,e,t);n&&n(r,e),l=u();let i=ft(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return ht(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(ct,d),c=e,()=>{i.removeEventListener(ct,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function ht(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),D(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:k(t);return i=i.replace(/ $/,`%20`),!n&&ot.test(i)&&(i=r+i),new URL(i,r)}function gt(e,t,n=`/`){return _t(e,t,n,!1)}function _t(e,t,n,r,i){let a=M((typeof t==`string`?A(t):t).pathname||`/`,n);if(a==null)return null;let o=i??vt(e),s=null,c=Pt(a);for(let e=0;s==null&&e<o.length;++e)s=jt(o[e],c,r);return s}function vt(e){let t=yt(e);return xt(t),t}function yt(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;D(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=N([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(D(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),yt(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:kt(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Nt(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of bt(e.path))a(e,t,!0,n)}),t}function bt(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=bt(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function xt(e){e.sort((e,t)=>e.score===t.score?At(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var St=/^:[\w-]+$/,Ct=3,wt=2,Tt=1,Et=10,Dt=-2,Ot=e=>e===`*`;function kt(e,t){let n=e.split(`/`),r=n.length;return n.some(Ot)&&(r+=Dt),t&&(r+=wt),n.filter(e=>!Ot(e)).reduce((e,t)=>e+(St.test(t)?Ct:t===``?Tt:Et),r)}function At(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function jt(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?Mt(u,l,s.matcher,s.compiledParams):j(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=j({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:N([a,d.pathname]),pathnameBase:Ht(N([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=N([a,d.pathnameBase]))}return o}function j(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Nt(e.path,e.caseSensitive,e.end);return Mt(e,t,n,r)}function Mt(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=P(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=P(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Nt(e,t=!1,n=!0){O(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Pt(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return O(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function M(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function Ft(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?A(e):e,a;return n?(n=Vt(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?It(n.substring(1),`/`):It(n,t)):a=t,{pathname:a,search:Ut(r),hash:Wt(i)}}function It(e,t){let n=P(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Lt(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Rt(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function zt(e){let t=Rt(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Bt(e,t,n,r=!1){let i;typeof e==`string`?i=A(e):(i={...e},D(!i.pathname||!i.pathname.includes(`?`),Lt(`?`,`pathname`,`search`,i)),D(!i.pathname||!i.pathname.includes(`#`),Lt(`#`,`pathname`,`hash`,i)),D(!i.search||!i.search.includes(`#`),Lt(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Ft(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Vt=e=>e.replace(/[\\/]{2,}/g,`/`),N=e=>Vt(e.join(`/`));function P(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var Ht=e=>P(e).replace(/^\/*/,`/`),Ut=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Wt=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Gt=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Kt(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function qt(e){return N(e.map(e=>e.route.path).filter(Boolean))||`/`}var Jt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Yt(e,t){let n=e;if(typeof n!=`string`||!at.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Jt)try{let e=new URL(window.location.href),r=ot.test(n)?new URL(st(n,e.protocol)):new URL(n),a=M(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{O(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Xt=new URL(`http://localhost`);function Zt(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),Xt)}catch{return Xt}}function Qt(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function $t(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function en(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!Qt(i,n),s=!Qt(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!$t(e,i)||!Qt(i,a)))throw Error(`External navigation is not allowed`)}var tn=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(tn);var nn=[`GET`,...tn];new Set(nn);var rn=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function an(e){try{return rn.includes(new URL(e).protocol)}catch{return!1}}var F=d.createContext(null);F.displayName=`DataRouter`;var I=d.createContext(null);I.displayName=`DataRouterState`;var on=d.createContext(!1);function sn(){return d.useContext(on)}var cn=d.createContext({isTransitioning:!1});cn.displayName=`ViewTransition`;var ln=d.createContext(new Map);ln.displayName=`Fetchers`;var un=d.createContext(null);un.displayName=`Await`;var L=d.createContext(null);L.displayName=`Navigation`;var R=d.createContext(null);R.displayName=`Location`;var z=d.createContext({outlet:null,matches:[],isDataRoute:!1});z.displayName=`Route`;var dn=d.createContext(null);dn.displayName=`RouteError`;var fn=`REACT_ROUTER_ERROR`,pn=`REDIRECT`,mn=`ROUTE_ERROR_RESPONSE`;function hn(e){if(e.startsWith(`${fn}:${pn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function gn(e){if(e.startsWith(`${fn}:${mn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Gt(t.status,t.statusText,t.data)}catch{}}function _n(e,{relative:t}={}){D(B(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=d.useContext(L),{hash:i,pathname:a,search:o}=U(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:N([n,a])),r.createHref({pathname:s,search:o,hash:i})}function B(){return d.useContext(R)!=null}function V(){return D(B(),`useLocation() may be used only in the context of a <Router> component.`),d.useContext(R).location}var vn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function yn(e){d.useContext(L).static||d.useLayoutEffect(e)}function H(){let{isDataRoute:e}=d.useContext(z);return e?Rn():bn()}function bn(){D(B(),`useNavigate() may be used only in the context of a <Router> component.`);let e=d.useContext(F),{basename:t,navigator:n}=d.useContext(L),{matches:r}=d.useContext(z),{pathname:i}=V(),a=JSON.stringify(zt(r)),o=d.useRef(!1);return yn(()=>{o.current=!0}),d.useCallback((r,s={})=>{if(O(o.current,vn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Bt(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:N([t,c.pathname])),en(typeof r==`string`?r:k(r),n.createHref(c),Zt(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}d.createContext(null);function xn(){let{matches:e}=d.useContext(z);return e[e.length-1]?.params??{}}function U(e,{relative:t}={}){let{matches:n}=d.useContext(z),{pathname:r}=V(),i=JSON.stringify(zt(n));return d.useMemo(()=>Bt(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Sn(e,t){return Cn(e,t)}function Cn(e,t,n){D(B(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=d.useContext(L),{matches:i}=d.useContext(z),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Bn(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
3
3
|
|
|
4
4
|
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=V(),f;if(t){let e=typeof t==`string`?A(t):t;D(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),f=e}else f=u;let p=f.pathname||`/`,m=p;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);m=`/`+p.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let h=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):gt(e,{pathname:m});O(l||h!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),O(h==null||h[h.length-1].route.element!==void 0||h[h.length-1].route.Component!==void 0||h[h.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let g=An(h&&h.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:N([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:N([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&g?d.createElement(R.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...f},navigationType:`POP`}},g):g}function wn(){let e=Ln(),t=Kt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=d.createElement(d.Fragment,null,d.createElement(`p`,null,`💿 Hey developer 👋`),d.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,d.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,d.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),d.createElement(d.Fragment,null,d.createElement(`h2`,null,`Unexpected Application Error!`),d.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?d.createElement(`pre`,{style:i},n):null,o)}var Tn=d.createElement(wn,null),En=class extends d.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=gn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:d.createElement(z.Provider,{value:this.props.routeContext},d.createElement(dn.Provider,{value:e,children:this.props.component}));return this.context?d.createElement(On,{error:e},t):t}};En.contextType=on;var Dn=new WeakMap;function On({children:e,error:t}){let{basename:n,navigator:r}=d.useContext(L);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=hn(t.digest);if(e){let i=Dn.get(t);if(i)throw i;let a=Yt(e.location,n),o=a.absoluteURL||a.to;if(en(e.location,o,Zt(r),`allow-explicit`),an(o))throw Error(`Invalid redirect location`);if(Jt&&!Dn.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw Dn.set(t,n),n}}return d.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function kn({routeContext:e,match:t,children:n}){let r=d.useContext(F);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),d.createElement(z.Provider,{value:e},n)}function An(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);D(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:qt(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,f=!1,p=null,m=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,p=n.route.errorElement||Tn,o&&(s<0&&c===0?(Bn(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):s===c&&(f=!0,m=n.route.hydrateFallbackElement||null)));let h=t.concat(i.slice(0,c+1)),g=()=>{let t;return t=u?p:f?m:n.route.Component?d.createElement(n.route.Component,null):n.route.element?n.route.element:e,d.createElement(kn,{match:n,routeContext:{outlet:e,matches:h,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?d.createElement(En,{location:r.location,revalidation:r.revalidation,component:p,error:u,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:l}):g()},null)}function jn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mn(e){let t=d.useContext(F);return D(t,jn(e)),t}function Nn(e){let t=d.useContext(I);return D(t,jn(e)),t}function Pn(e){let t=d.useContext(z);return D(t,jn(e)),t}function Fn(e){let t=Pn(e),n=t.matches[t.matches.length-1];return D(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function In(){return Fn(`useRouteId`)}function Ln(){let e=d.useContext(dn),t=Nn(`useRouteError`),n=Fn(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Rn(){let{router:e}=Mn(`useNavigate`),t=Fn(`useNavigate`),n=d.useRef(!1);return yn(()=>{n.current=!0}),d.useCallback(async(r,i={})=>{O(n.current,vn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var zn={};function Bn(e,t,n){!t&&!zn[e]&&(zn[e]=!0,O(!1,n))}d.memo(Vn);function Vn({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Cn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Hn({to:e,replace:t,state:n,relative:r}){D(B(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=d.useContext(L);O(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=d.useContext(z),{pathname:s}=V(),c=H(),l=Bt(e,zt(o),s,r===`path`);en(typeof e==`string`?e:k(e),a.createHref(l),Zt(a),`reject`);let u=JSON.stringify(l);return d.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function Un(e){D(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Wn({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){D(!B(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=d.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=A(n));let{pathname:l=`/`,search:u=``,hash:f=``,state:p=null,key:m=`default`,mask:h}=n,g=d.useMemo(()=>{let e=M(l,s);return e==null?null:{location:{pathname:e,search:u,hash:f,state:p,key:m,mask:h},navigationType:r}},[s,l,u,f,p,m,r,h]);return O(g!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${f}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:d.createElement(L.Provider,{value:c},d.createElement(R.Provider,{children:t,value:g}))}function Gn({children:e,location:t}){return Sn(Kn(e),t)}d.Component;function Kn(e,t=[]){let n=[];return d.Children.forEach(e,(e,r)=>{if(!d.isValidElement(e))return;let i=[...t,r];if(e.type===d.Fragment){n.push.apply(n,Kn(e.props.children,i));return}D(e.type===Un,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),D(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Kn(e.props.children,i)),n.push(a)}),n}var W=`get`,G=`application/x-www-form-urlencoded`;function K(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function qn(e){return K(e)&&e.tagName.toLowerCase()===`button`}function Jn(e){return K(e)&&e.tagName.toLowerCase()===`form`}function Yn(e){return K(e)&&e.tagName.toLowerCase()===`input`}function Xn(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Zn(e,t){return e.button===0&&(!t||t===`_self`)&&!Xn(e)}function Qn(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function $n(e,t){let n=Qn(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var q=null;function er(){if(q===null)try{new FormData(document.createElement(`form`),0),q=!1}catch{q=!0}return q}var tr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function nr(e){return e!=null&&!tr.has(e)?(O(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${G}"`),null):e}function rr(e,t){let n,r,i,a,o;if(Jn(e)){let o=e.getAttribute(`action`);r=o?M(o,t):null,n=e.getAttribute(`method`)||W,i=nr(e.getAttribute(`enctype`))||G,a=new FormData(e)}else if(qn(e)||Yn(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?M(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||W,i=nr(e.getAttribute(`formenctype`))||nr(o.getAttribute(`enctype`))||G,a=new FormData(o,e),!er()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(K(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=W,r=null,i=G,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function ir(e,t){if(e===!1||e==null)throw Error(t)}function ar(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&M(i.pathname,t)===`/`?`${P(t)}/_root.${r}`:`${P(i.pathname)}.${r}`,i}async function or(e,t){if(e.id in t)return t[e.id];try{let n=await r(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function sr(e){return e!=null&&typeof e.page==`string`}function cr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function lr(e,t,n){return mr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await or(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(cr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function ur(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function dr(e,t,{includeHydrateFallback:n}={}){return fr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function fr(e){return[...new Set(e)]}function pr(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function mr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!sr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(pr(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function hr(){let e=d.useContext(F);return ir(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function gr(){let e=d.useContext(I);return ir(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var _r=d.createContext(void 0);_r.displayName=`FrameworkContext`;function J(){let e=d.useContext(_r);return ir(e,`You must render this element inside a <HydratedRouter> element`),e}function vr(e,t){let n=d.useContext(_r),[r,i]=d.useState(!1),[a,o]=d.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:f}=t,p=d.useRef(null);d.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),d.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let m=()=>{i(!0)},h=()=>{i(!1),o(!1)};return n?e===`intent`?[a,p,{onFocus:Y(s,m),onBlur:Y(c,h),onMouseEnter:Y(l,m),onMouseLeave:Y(u,h),onTouchStart:Y(f,m)}]:[a,p,{}]:[!1,p,{}]}function Y(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function yr({page:e,...t}){let n=sn(),{nonce:r}=J(),{router:i}=hr(),a=d.useMemo(()=>gt(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?d.createElement(xr,{page:e,matches:a,...t}):d.createElement(Sr,{page:e,matches:a,...t})):null}function br(e){let{manifest:t,routeModules:n}=J(),[r,i]=d.useState([]);return d.useEffect(()=>{let r=!1;return lr(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function xr({page:e,matches:t,...n}){let r=V(),{future:i}=J(),{basename:a}=hr(),o=d.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=ar(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return d.createElement(d.Fragment,null,o.map(e=>d.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Sr({page:e,matches:t,...n}){let r=V(),{future:i,manifest:a,routeModules:o}=J(),{basename:s}=hr(),{loaderData:c,matches:l}=gr(),u=d.useMemo(()=>ur(e,t,l,a,r,`data`),[e,t,l,a,r]),f=d.useMemo(()=>ur(e,t,l,a,r,`assets`),[e,t,l,a,r]),p=d.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];t&&t.hasLoader&&(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=ar(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),m=d.useMemo(()=>dr(f,a),[f,a]),h=br(f);return d.createElement(d.Fragment,null,p.map(e=>d.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>d.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>d.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Cr(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}d.Component;var wr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{wr&&(window.__reactRouterVersion=`7.18.4`)}catch{}function Tr({basename:e,children:t,useTransitions:n,window:r}){let i=d.useRef();i.current??=ut({window:r,v5Compat:!0});let a=i.current,[o,s]=d.useState({action:a.action,location:a.location}),c=d.useCallback(e=>{n===!1?s(e):d.startTransition(()=>s(e))},[n]);return d.useLayoutEffect(()=>a.listen(c),[a,c]),d.createElement(Wn,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var Er=d.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:f,defaultShouldRevalidate:p,...m},h){let{basename:g,navigator:_,useTransitions:v}=d.useContext(L),y=typeof l==`string`&&at.test(l),b=Yt(l,g);l=b.to;let x=_n(l,{relative:r}),S=V(),C=null;if(o){let e=Bt(o,[],S.mask?S.mask.pathname:`/`,!0);g!==`/`&&(e.pathname=e.pathname===`/`?g:N([g,e.pathname])),C=_.createHref(e)}let[w,ee,te]=vr(n,m),ne=jr(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:f,defaultShouldRevalidate:p,useTransitions:v});function T(t){e&&e(t),t.defaultPrevented||ne(t)}let E=!(b.isExternal||i),re=d.createElement(`a`,{...m,...te,href:(E?C:void 0)||b.absoluteURL||x,onClick:E?T:e,ref:Cr(h,ee),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?d.createElement(d.Fragment,null,re,d.createElement(yr,{page:x})):re});Er.displayName=`Link`;var Dr=d.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=U(a,{relative:c.relative}),f=V(),p=d.useContext(I),{navigator:m,basename:h}=d.useContext(L),g=p!=null&&Lr(u)&&o===!0,_=m.encodeLocation?m.encodeLocation(u).pathname:u.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=M(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!r&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!r&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,ee;ee=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let te=typeof i==`function`?i(C):i;return d.createElement(Er,{...c,"aria-current":w,className:ee,ref:l,style:te,to:a,viewTransition:o},typeof s==`function`?s(C):s)});Dr.displayName=`NavLink`;var Or=d.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=W,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:f,defaultShouldRevalidate:p,...m},h)=>{let{useTransitions:g}=d.useContext(L),_=Fr(),v=Ir(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&at.test(s);return d.createElement(`form`,{ref:h,method:y,action:v,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,m=()=>_(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:f,defaultShouldRevalidate:p});g&&n!==!1?d.startTransition(()=>m()):m()},...m,"data-discover":!b&&e===`render`?`true`:void 0})});Or.displayName=`Form`;function kr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ar(e){let t=d.useContext(F);return D(t,kr(e)),t}function jr(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=H(),f=V(),p=U(e,{relative:o});return d.useCallback(m=>{if(Zn(m,t)){m.preventDefault();let t=n===void 0?k(f)===k(p):n,h=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?d.startTransition(()=>h()):h()}},[f,u,p,n,r,i,t,e,a,o,s,c,l])}function Mr(e){O(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=d.useRef(Qn(e)),n=d.useRef(!1),r=V(),i=d.useMemo(()=>$n(r.search,n.current?null:t.current),[r.search]),a=H();return[i,d.useCallback((e,t)=>{let r=Qn(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Nr=0,Pr=()=>`__${String(++Nr)}__`;function Fr(){let{router:e}=Ar(`useSubmit`),{basename:t}=d.useContext(L),n=In(),r=e.fetch,i=e.navigate;return d.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=rr(e,t);if(a.navigate===!1){let e=a.fetcherKey||Pr();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Ir(e,{relative:t}={}){let{basename:n}=d.useContext(L),r=d.useContext(z);D(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...U(e||`.`,{relative:t})},o=V();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:N([n,a.pathname])),k(a)}function Lr(e,{relative:t}={}){let n=d.useContext(cn);D(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ar(`useViewTransitionState`),i=U(e,{relative:t});if(!n.isTransitioning)return!1;let a=M(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=M(n.nextLocation.pathname,r)||n.nextLocation.pathname;return j(i.pathname,o)!=null||j(i.pathname,a)!=null}var Rr={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};Rr.node;var zr=i(Rr),Br={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};Br.node;var Vr=i(Br),Hr=2800;function Ur({size:e=72}){let[t,n]=(0,d.useState)(0);return(0,d.useEffect)(()=>{if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=window.setInterval(()=>n(e=>(e+1)%a.length),Hr);return()=>window.clearInterval(e)},[]),(0,f.jsx)(`span`,{"aria-hidden":`true`,className:`relative inline-block shrink-0`,style:{width:e,height:e},children:a.map((n,r)=>(0,f.jsx)(`span`,{className:`absolute inset-0`,style:{opacity:+(r===t),transition:`opacity 0.45s ease`},children:(0,f.jsx)(s,{kind:n,size:e})},n))})}function Wr({className:e,style:t,onDark:n=!1}){return(0,f.jsxs)(`span`,{className:e,style:t,children:[`engenty`,(0,f.jsx)(`span`,{style:{color:n?`oklch(88% 0.11 75)`:`var(--ember, oklch(64% 0.195 35))`},children:`.`})]})}var Gr=`wizards.theme`,Kr=new Set,qr=window.matchMedia(`(prefers-color-scheme: dark)`);function Jr(){try{let e=localStorage.getItem(Gr);return e===`light`||e===`dark`?e:null}catch{return null}}var Yr=0;function Xr(){return Yr>0?`dark`:Jr()??(qr.matches?`dark`:`light`)}function Zr(){requestAnimationFrame(()=>{let e=document.querySelector(`meta[name="theme-color"]`),t=document.createElement(`canvas`).getContext(`2d`);if(!e||!t||!document.body)return;t.fillStyle=getComputedStyle(document.body).backgroundColor,t.fillRect(0,0,1,1);let[n,r,i]=t.getImageData(0,0,1,1).data;e.content=`#${[n,r,i].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`})}function X(){let e=Xr()===`dark`;document.documentElement.classList.toggle(`dark`,e),Zr();for(let e of Kr)e()}qr.addEventListener(`change`,X),X();function Qr(e){try{localStorage.setItem(Gr,e)}catch{document.documentElement.classList.toggle(`dark`,e===`dark`);return}X()}function $r(){return(0,d.useSyncExternalStore)(e=>(Kr.add(e),()=>Kr.delete(e)),()=>document.documentElement.classList.contains(`dark`)?`dark`:`light`)}var ei=e=>`oklch(from ${o[c[e]??`cobalt`]} 0.34 calc(c * 0.6) h)`;function ti(e){(0,d.useEffect)(()=>{let t=document.documentElement;return Yr+=1,t.style.setProperty(`--stage`,e),X(),()=>{--Yr,t.style.removeProperty(`--stage`),X()}},[e])}function ni(e){(0,d.useEffect)(()=>{if(!e)return;let t=document.documentElement;return t.style.setProperty(`--stage`,ei(e)),Zr(),()=>{t.style.removeProperty(`--stage`),Zr()}},[e])}var ri={name:`engenty wizards`,short:`wizards`},ii=(0,d.lazy)(()=>r(()=>import(`./fluffy-engenty-D7rFrNcJ.js`).then(e=>({default:e.FluffyEngenty})),__vite__mapDeps([0,1,2])));function ai({kind:e,size:t=64,fluffy:n,coat:r,goggles:i=!1,interactive:a=!0}){let o=e||`round`,c=$r(),l=r??(c===`dark`?`jelly`:`fur`);if(n&&t>=120&&(l===`fur`||c===`dark`))return(0,f.jsx)(d.Suspense,{fallback:(0,f.jsx)(s,{goggles:i,kind:o,size:Math.round(t*.62)}),children:(0,f.jsx)(ii,{goggles:i,coat:l,kind:o,size:t,quality:`medium`,interactive:a})});if(n&&t>=120){let e=Math.round(t*1.08);return(0,f.jsxs)(`div`,{"aria-hidden":`true`,className:`relative flex items-center justify-center overflow-hidden`,style:{background:ei(o),borderRadius:t*.28,height:t,width:t},children:[(0,f.jsx)(`span`,{className:`pointer-events-none absolute rounded-full bg-white`,style:{filter:`blur(${t*.18}px)`,height:t*.8,opacity:.16,right:-t*.3,top:-t*.3,width:t*.8}}),(0,f.jsx)(`div`,{className:`relative`,style:{marginTop:t*.04},children:(0,f.jsx)(d.Suspense,{fallback:(0,f.jsx)(s,{goggles:i,kind:o,size:Math.round(e*.62)}),children:(0,f.jsx)(ii,{goggles:i,coat:`jelly`,kind:o,size:e,quality:`medium`,interactive:a})})})]})}return(0,f.jsx)(s,{goggles:i,kind:o,size:t,animated:a})}function oi({onClick:e,place:t}){return(0,f.jsxs)(`button`,{type:`button`,onClick:e,className:`flex min-w-0 items-center gap-2.5 whitespace-nowrap rounded-full pr-2 text-ink`,children:[(0,f.jsx)(Ur,{size:30}),(0,f.jsxs)(`span`,{className:`font-display font-semibold text-[17px] tracking-tight`,children:[`engenty`,(0,f.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,f.jsx)(`span`,{className:t?`ml-1 font-normal text-ink-3 max-sm:hidden`:`ml-1 font-normal text-ink-3 max-[420px]:hidden`,children:ri.short}),t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`mx-2 font-normal text-ink-4 max-sm:hidden`,children:`/`}),(0,f.jsx)(`span`,{className:`font-medium text-ink max-sm:ml-1.5`,children:t})]}):null]})]})}function si(){let e=$r(),t=e===`dark`?`light`:`dark`;return(0,f.jsx)(l,{label:u(t===`dark`?`theme.dark`:`theme.light`),onClick:()=>Qr(t),children:e===`dark`?(0,f.jsx)(Vr,{className:`size-4`}):(0,f.jsx)(zr,{className:`size-4`})})}var Z=``.replace(/\/+$/,``),ci=`${Z}/studio`;function li(e){return!Z||!e.startsWith(`/`)||e.startsWith(`//`)||e===Z||e.startsWith(`${Z}/`)?e:`${Z}${e}`}function ui(e){return`/studio/${e.replace(/^\/+/,``)}`}var Q=class extends Error{status;body;constructor(e,t,n){super(e),this.status=t,this.body=n}};function di(e){return e instanceof Q&&e.status===0}async function $(e,t,n){let r=await fetch(li(t),{method:e,credentials:`include`,headers:n!==void 0&&!(n instanceof FormData)?{"content-type":`application/json`}:void 0,body:n===void 0?void 0:n instanceof FormData?n:JSON.stringify(n)}).catch(()=>{throw new Q(u(`common.offline`),0,null)}),i=await r.text(),a=i?fi(i):null;if(!r.ok)throw new Q(a?.error??r.statusText,r.status,a);return a}function fi(e){try{return JSON.parse(e)}catch{return{error:e}}}var pi={get:e=>$(`GET`,e),post:(e,t)=>$(`POST`,e,t??{}),put:(e,t)=>$(`PUT`,e,t),patch:(e,t)=>$(`PATCH`,e,t),del:e=>$(`DELETE`,e),upload:(e,t)=>{let n=new FormData;return n.set(`file`,t),$(`POST`,e,n)}};async function mi(e,t,n,r){let i=await fetch(li(e),{method:`POST`,credentials:`include`,headers:{"content-type":`application/json`},body:JSON.stringify(t),signal:r});if(!i.ok||!i.body){let e=fi(await i.text());throw new Q(e?.error??i.statusText,i.status,e)}let a=i.body.getReader(),o=new TextDecoder,s=``;for(;;){let{done:e,value:t}=await a.read();if(e)break;s+=o.decode(t,{stream:!0});let r=s.indexOf(`
|
|
5
5
|
|