@engenty/wizards-runtime 0.16.2 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/runtime/dist/agents/studio-assistant.js +13 -6
- package/apps/runtime/dist/assistant/knows.js +15 -2
- package/apps/runtime/dist/broker/call.js +16 -3
- package/apps/runtime/dist/broker/grant.js +25 -1
- package/apps/runtime/dist/broker/index.js +2 -2
- package/apps/runtime/dist/broker/log.js +30 -11
- package/apps/runtime/dist/broker/rwx.js +14 -2
- package/apps/runtime/dist/broker/send.js +84 -32
- package/apps/runtime/dist/connectors/space-connections.js +47 -2
- package/apps/runtime/dist/docs/dev/broker.md +72 -26
- package/apps/runtime/dist/docs/dev/plugins/space.md +13 -2
- package/apps/runtime/dist/docs/user-guide/capabilities.md +51 -7
- package/apps/runtime/dist/docs/user-guide/connectors.md +6 -3
- package/apps/runtime/dist/docs/user-guide/protocol.md +30 -4
- package/apps/runtime/dist/docs/user-guide/together.md +4 -4
- package/apps/runtime/dist/elements/knowledge.js +16 -12
- package/apps/runtime/dist/engine/steps.js +3 -2
- package/apps/runtime/dist/index.js +8 -0
- package/apps/runtime/dist/live/hub.js +17 -3
- package/apps/runtime/dist/live/origin.js +6 -4
- package/apps/runtime/dist/live/views.js +38 -7
- package/apps/runtime/dist/models.js +18 -0
- package/apps/runtime/dist/prompts/tools.md +1 -1
- package/apps/runtime/dist/routes/api.js +2 -2
- package/apps/runtime/dist/routes/broker.js +59 -20
- package/apps/runtime/dist/routes/live.js +4 -2
- package/apps/runtime/dist/routes/studio.js +13 -2
- package/apps/runtime/dist/services/api.js +4 -2
- package/apps/runtime/dist/services/errors.js +1 -0
- package/apps/runtime/dist/services/knowledge.js +93 -27
- package/apps/runtime/dist/services/members-studio.js +22 -2
- package/apps/runtime/dist/services/space-categories.js +83 -5
- package/apps/runtime/dist/services/space-index.js +77 -21
- package/apps/runtime/dist/services/space-origin.js +28 -11
- package/apps/runtime/dist/services/work-ai.js +15 -5
- package/apps/runtime/dist/sharing/jobs.js +2 -0
- package/apps/runtime/dist/sync/hub.js +17 -3
- package/apps/runtime/dist/texts.js +6 -4
- package/apps/runtime/dist/tools/index.js +13 -7
- package/apps/runtime/dist/tools/web-search.js +36 -0
- package/apps/web/dist/assets/{AboutDialog-BCcD8hKm.js → AboutDialog-B2Xmxyj4.js} +1 -1
- package/apps/web/dist/assets/{BlockEditor-DgaUm2pR.js → BlockEditor-D0HoUSih.js} +1 -1
- package/apps/web/dist/assets/CapabilitiesPage-C1th2cZE.js +2 -0
- package/apps/web/dist/assets/{ChangelogDialog-B08elwyr.js → ChangelogDialog-BIrJbAKi.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-BiyOk_SC.js → CodeEditor-DUVcXI5P.js} +1 -1
- package/apps/web/dist/assets/{EditorPage-EMFTHEYD.js → EditorPage-56sIqEfF.js} +1 -1
- package/apps/web/dist/assets/{FlowPreview-DF_6TvZ0.js → FlowPreview-BIag8_Be.js} +1 -1
- package/apps/web/dist/assets/{LangSwitch-Ba4OWLzJ.js → LangSwitch-CJ00IgaO.js} +1 -1
- package/apps/web/dist/assets/{Marketplace-DqziLf66.js → Marketplace-D7-ot9Dz.js} +2 -2
- package/apps/web/dist/assets/{NewWizardChannels-CsIGp0nZ.js → NewWizardChannels-DI3SQ4iS.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-CzQAkKMy.js → NewWizardPage-CytheHxX.js} +1 -1
- package/apps/web/dist/assets/{OnboardingPage-B9gr2OX5.js → OnboardingPage-_91Pa8Ad.js} +1 -1
- package/apps/web/dist/assets/{PreviewPane-DSOV3o-1.js → PreviewPane-BDsYm-_K.js} +2 -2
- package/apps/web/dist/assets/ProtocolSection-D_zaxHEL.js +1 -0
- package/apps/web/dist/assets/{PublicRunner-BVs8-Vu3.js → PublicRunner-CEgXSk3r.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly--4CIJCDD.js → ReadOnly-CWf5x74a.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-Dr8SDk-L.js +2 -0
- package/apps/web/dist/assets/{SetupPage-9Zk-KUGA.js → SetupPage-B68n0l4I.js} +1 -1
- package/apps/web/dist/assets/{SharePage-D_Ab0gjr.js → SharePage-DfznN7ar.js} +1 -1
- package/apps/web/dist/assets/{SkillEditor-DvtameHg.js → SkillEditor-BIcIczRc.js} +1 -1
- package/apps/web/dist/assets/{Skills-Cf1Kl4Fy.js → Skills-CN4QE7Kx.js} +1 -1
- package/apps/web/dist/assets/{SpacePage-CyqVzX9b.js → SpacePage-DiVTwhnJ.js} +2 -2
- package/apps/web/dist/assets/{UpdateCheck-DweZBVP6.js → UpdateCheck-QhBI3rlQ.js} +2 -2
- package/apps/web/dist/assets/changelog-a_CuplMX.js +1 -0
- package/apps/web/dist/assets/{code-editor-B1RbFTAZ.js → code-editor-DkPo1C-L.js} +2 -2
- package/apps/web/dist/assets/{host-CKS5U5Vg.js → host-D6H6Z9Jp.js} +6 -6
- package/apps/web/dist/assets/i18n-BaPKbQ1s.js +55 -0
- package/apps/web/dist/assets/{index-w-3J3ZJ9.css → index-CCUG6Vnh.css} +1 -1
- package/apps/web/dist/assets/{index-Ckcn5vy7.js → index-De0Wb42y.js} +3 -3
- package/apps/web/dist/assets/{read-aloud-Bq88XUHC.js → read-aloud-CnFwDSGD.js} +1 -1
- package/apps/web/dist/assets/{runners-DvYVe9Dt.js → runners-0sTPbWzr.js} +1 -1
- package/apps/web/dist/assets/{session-D2bjiA3P.js → session-BMiUrqHg.js} +1 -1
- package/apps/web/dist/assets/{theme-CNJIC2be.js → theme-CkNTe-_Z.js} +1 -1
- package/apps/web/dist/assets/{ui-Mplfhz_Z.js → ui-DAk_vjrL.js} +1 -1
- package/apps/web/dist/assets/{useMutation-8QRM-z4M.js → useMutation-isHfB33W.js} +1 -1
- package/apps/web/dist/assets/{viewers-CEocUV_2.js → viewers-ijNZHJFG.js} +2 -2
- package/apps/web/dist/index.html +12 -12
- package/apps/web/dist/mcp/flow.html +2 -2
- package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +7 -2
- package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +13 -1
- package/node_modules/@engenty/wizards-shared/dist/connectors.js +8 -0
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +12 -0
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +12 -0
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +3 -0
- package/node_modules/@engenty/wizards-shared/dist/run.js +6 -0
- package/node_modules/@engenty/wizards-shared/dist/spaces.d.ts +3 -2
- package/node_modules/@engenty/wizards-shared/dist/spaces.js +12 -3
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/web/dist/assets/CapabilitiesPage-DuJJV1ll.js +0 -2
- package/apps/web/dist/assets/SettingsPage-z2u8lSe2.js +0 -2
- package/apps/web/dist/assets/changelog-C85v9OWg.js +0 -1
- package/apps/web/dist/assets/connection-sign-in-CaVvh5GQ.js +0 -1
- package/apps/web/dist/assets/i18n-Bymk5Ev-.js +0 -55
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{$n as r,$t as i,Dn as a,Jn as o,Q as s,S as c,Tn as l,Vr as u,X as d,Zn as f,an as p,cr as m,en as h,fn as g,gr as _,hn as v,i as y,in as b,ln as x,nn as S,on as C,or as w,pn as T,rn as E,tn as D,un as O,vn as ee,x as k}from"./ui-DAk_vjrL.js";import{k as te}from"./Marketplace-D7-ot9Dz.js";import{t as A}from"./useMutation-isHfB33W.js";import{d as ne,i as re,r as ie}from"./marked.esm-DQ7XA7AC.js";import{Cn as ae,Qn as oe,_n as se,fn as j,p as M,wn as ce}from"./host-D6H6Z9Jp.js";import{n as le}from"./volume-2-BqlBtCIJ.js";import{t as ue}from"./circle-check-DDLzlcXP.js";import{d as de,h as fe,n as pe,u as me}from"./session-BMiUrqHg.js";import{n as N,s as P}from"./i18n-BaPKbQ1s.js";import{d as he,p as ge}from"./UpdateCheck-QhBI3rlQ.js";var _e={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};_e.node;var ve=ne(_e),F=e(t(),1),I=e(n(),1);function ye({connector:e}){let[t,n]=(0,F.useState)(!1);return(0,I.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-3 px-3 py-2 text-left`,children:[(0,I.jsx)(`span`,{className:v(`size-2 shrink-0 rounded-full`,e.usable?`bg-moss`:`bg-ink-4`)}),(0,I.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[0.8125rem]`,children:[e.name,` `,(0,I.jsx)(`span`,{className:`font-mono text-[0.6875rem] text-ink-4`,children:e.id})]}),(0,I.jsx)(`span`,{className:`shrink-0 text-[0.75rem] text-ink-3`,children:e.usable?P(e.actions.length===1?`connectors.actions.one`:`connectors.actions.n`,{n:e.actions.length,r:e.actions.filter(e=>e.group===`read`).length}):P(`connectors.notSetUp`)})]}),t?(0,I.jsxs)(`div`,{className:`border-border-soft border-t px-3 py-2 text-[0.75rem]`,children:[e.missingSetup?(0,I.jsxs)(`p`,{className:`mb-1 text-ink-3`,children:[P(`connectors.setup`),` `,(0,I.jsx)(`span`,{className:`font-mono text-ink-2`,children:e.missingSetup})]}):null,(0,I.jsx)(`p`,{className:`text-ink-4`,children:e.actions.map(e=>e.group===`read`?e.id:`${e.id} (${P(`connectors.group.${e.group}`)})`).join(` · `)})]}):null]})}var be={none:`connectors.authNone`,oauth2:`connectors.authOauth`,api_key:`connectors.authKey`};function xe({spaceId:e,connector:t,readOnly:n,onSetUp:r}){let o=u(),[c,l]=(0,F.useState)(!1),f=()=>o.invalidateQueries({queryKey:d.connectors(e)}),p=`/api/studio/spaces/${e}/connectors/${t.id}`,m=A({mutationFn:()=>s.post(`${p}/refresh`),onSuccess:f}),h=A({mutationFn:()=>s.del(p),onSuccess:f}),g=t.actions.filter(e=>e.group===`read`).length;return(0,I.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,I.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-paper-2 text-ink-2`,children:(0,I.jsx)(le,{className:`size-4`})}),(0,I.jsxs)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`min-w-0 flex-1 text-left`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`truncate font-medium text-[0.875rem]`,children:t.name}),(0,I.jsx)(`span`,{className:`font-mono text-[0.6875rem] text-ink-4`,children:t.id})]}),(0,I.jsxs)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:[t.domain,` · `,t.sourceKind===`mcp`?`MCP`:`OpenAPI`,` ·`,` `,P(be[t.auth]),` ·`,` `,t.toolsPending?P(`connectors.pending`):P(t.actions.length===1?`connectors.actions.one`:`connectors.actions.n`,{n:t.actions.length,r:g})]})]}),n?null:(0,I.jsxs)(I.Fragment,{children:[r?(0,I.jsx)(i,{size:`sm`,variant:`secondary`,onClick:()=>r(t.id),children:P(`capabilities.connectors.setUp`)}):null,(0,I.jsx)(b,{label:P(`connectors.refresh`),onClick:()=>m.mutate(),children:m.isPending?(0,I.jsx)(O,{className:`size-4`}):(0,I.jsx)(a,{className:`size-4`})}),(0,I.jsx)(b,{label:P(`connectors.remove`),className:`hover:text-rose`,onClick:async()=>await y(P(`connectors.removeConfirm`,{name:t.name}))&&h.mutate(),children:(0,I.jsx)(ie,{className:`size-4`})})]})]}),t.needsOAuthClient?(0,I.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[0.75rem] text-rose`,children:P(`connectors.needsClient`)}):null,m.error??h.error?(0,I.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[0.75rem] text-rose`,children:(m.error??h.error).message}):null,c&&t.actions.length?(0,I.jsx)(`ul`,{className:`max-h-64 overflow-y-auto border-border-soft border-t px-3 py-2`,children:t.actions.map(e=>(0,I.jsxs)(`li`,{className:`flex items-baseline gap-2 py-1 text-[0.75rem]`,children:[(0,I.jsx)(`span`,{className:v(`w-14 shrink-0 text-[0.6875rem] uppercase tracking-wide`,e.group===`read`?`text-moss`:e.group===`write`?`text-ink-3`:`text-rose`),children:P(`connectors.group.${e.group}`)}),(0,I.jsx)(`span`,{className:`shrink-0 font-mono text-ink-2`,children:e.id}),(0,I.jsx)(`span`,{className:`min-w-0 truncate text-ink-4`,children:e.summary})]},e.id))}):null]})}function Se({spaceId:e,domain:t,source:n,taken:r,onDone:a}){let o=u(),[c,l]=(0,F.useState)({id:``,secret:``}),[f,m]=(0,F.useState)(!1),h=r.includes(n.suggestedId),g=A({mutationFn:()=>s.post(`/api/studio/spaces/${e}/connectors`,{domain:t,sourceKind:n.sourceKind,sourceUrl:n.sourceUrl,id:n.suggestedId,toolPrefix:n.suggestedToolPrefix,...n.name?{name:n.name}:{},...c.id&&c.secret?{oauthClientId:c.id,oauthClientSecret:c.secret}:{}}),onSuccess:async t=>{await o.invalidateQueries({queryKey:d.connectors(e)}),a(t.warnings,t.connector.id)}});return(0,I.jsxs)(`div`,{className:`rounded-lg bg-card p-3 ring-1 ring-border-soft`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(D,{tone:n.sourceKind===`mcp`?`ember`:`neutral`,children:n.sourceKind===`mcp`?`MCP`:`OpenAPI`}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`div`,{className:`truncate text-[0.8125rem]`,children:n.name??n.suggestedId}),(0,I.jsx)(`div`,{className:`truncate font-mono text-[0.6875rem] text-ink-4`,children:n.sourceUrl})]}),n.blocked||h?null:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{type:`button`,onClick:()=>m(e=>!e),className:`text-[0.75rem] text-ink-3 hover:text-ink`,children:P(`connectors.ownClient`)}),(0,I.jsx)(i,{size:`sm`,busy:g.isPending,onClick:()=>g.mutate(),children:P(`connectors.import`)})]})]}),n.blocked?(0,I.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-3`,children:n.blocked}):null,h?(0,I.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-3`,children:P(`connectors.exists`)}):null,f?(0,I.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:[(0,I.jsx)(p,{placeholder:P(`connectors.clientId`),value:c.id,onChange:e=>l(t=>({...t,id:e.target.value}))}),(0,I.jsx)(p,{type:`password`,autoComplete:`off`,placeholder:P(`connectors.clientSecret`),value:c.secret,onChange:e=>l(t=>({...t,secret:e.target.value}))})]}):null,g.error?(0,I.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-rose`,children:g.error.message}):null]})}function Ce({spaceId:e,readOnly:t,embedded:n,onSetUp:r,domain:a}){let o=j(`unsetConnectors`),[c,u]=(0,F.useState)(``),[m,h]=(0,F.useState)(null),[g,v]=(0,F.useState)(null),[y,b]=(0,F.useState)([]),x=_({queryKey:d.connectors(e),queryFn:()=>s.get(`/api/studio/spaces/${e}/connectors`)}),S=A({mutationFn:()=>s.post(`/api/studio/connectors/search`,{query:c}),onSuccess:e=>{h(e),v(null),b([])}}),C=A({mutationFn:e=>s.get(`/api/studio/connectors/registry/${encodeURIComponent(e)}`),onSuccess:v}),w=C.mutate;(0,F.useEffect)(()=>{a&&!t&&w(a)},[a,t,w]);let T=x.data??[],E=T.filter(e=>e.sourceKind===`builtin`&&(o||e.usable)),D=T.filter(e=>e.sourceKind!==`builtin`);return(0,I.jsxs)(n?Te:we,{children:[n?null:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:P(`connectors.title`)}),(0,I.jsx)(`p`,{className:`mt-1 mb-5 text-[0.875rem] text-ink-3`,children:P(`connectors.hint`)})]}),E.length&&!n?(0,I.jsx)(`div`,{className:`mb-5 grid gap-1.5 sm:grid-cols-2`,children:E.map(e=>(0,I.jsx)(ye,{connector:e},e.id))}):null,(0,I.jsx)(`h3`,{className:`mb-2 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.07em]`,children:P(`connectors.imported`)}),D.length?(0,I.jsx)(`div`,{className:`mb-4 flex flex-col gap-2`,children:D.map(n=>(0,I.jsx)(xe,{spaceId:e,connector:n,readOnly:t,onSetUp:r},n.id))}):null,t?D.length?null:(0,I.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:P(`connectors.noneImported`)}):(0,I.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),c.trim()&&S.mutate()},children:[(0,I.jsx)(p,{value:c,placeholder:P(`connectors.search`),onChange:e=>u(e.target.value)}),(0,I.jsxs)(i,{type:`submit`,variant:`secondary`,busy:S.isPending,children:[(0,I.jsx)(l,{className:`size-4`}),` `,P(`connectors.find`)]})]}),S.error?(0,I.jsx)(`p`,{className:`mt-3 text-[0.8125rem] text-rose`,children:S.error.message}):null,m&&!g?(0,I.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1`,children:[m.length?null:(0,I.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:P(`connectors.none`)}),m.map(e=>(0,I.jsxs)(`button`,{type:`button`,disabled:!e.kinds.length,onClick:()=>C.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,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`div`,{className:`truncate text-[0.875rem]`,children:e.domain}),(0,I.jsx)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:e.description})]}),(0,I.jsx)(`span`,{className:`text-[0.6875rem] text-ink-4 uppercase`,children:e.kinds.join(` · `)}),(0,I.jsx)(f,{className:`-rotate-90 size-4 text-ink-4`})]},e.domain)),C.isPending?(0,I.jsx)(O,{className:`mx-auto mt-2 size-4 text-ink-4`}):null,C.error?(0,I.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:C.error.message}):null]}):null,g?(0,I.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,I.jsx)(`div`,{className:`font-medium text-[0.875rem]`,children:g.domain}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>v(null),className:`text-[0.75rem] text-ink-3 hover:text-ink`,children:P(`run.back`)})]}),g.summary?(0,I.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:g.summary}):null,g.sources.map(t=>(0,I.jsx)(Se,{spaceId:e,domain:g.domain,source:t,taken:T.map(e=>e.id),onDone:(e,t)=>{b(e),r?.(t)}},`${t.sourceKind}:${t.sourceUrl}`)),g.credentials.filter(e=>e.setup||e.url).map(e=>(0,I.jsxs)(`p`,{className:`text-[0.75rem] text-ink-3`,children:[(0,I.jsxs)(`span`,{className:`text-ink-2`,children:[e.label,`:`]}),` `,e.setup,` `,e.url?(0,I.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-ember underline`,children:e.url}):null]},e.label)),y.map(e=>(0,I.jsx)(`p`,{className:`text-[0.75rem] text-ink-3`,children:e},e))]}):null]})}function we({children:e}){return(0,I.jsx)(h,{className:`p-4 sm:p-6`,children:e})}function Te({children:e}){return(0,I.jsx)(`div`,{children:e})}var Ee=[`space`,`person`],De=[`admins`,`members`,`all`],Oe=[`read`,`write`,`destructive`,`send`],ke=[`allow`,`ask`,`deny`],Ae={name:80,perSpace:200};function L(e){return e.audience===`all`&&e.signIn===`space`}function je(e){(0,F.useEffect)(()=>{let t=t=>{t.data?.type===`wizards:connected`&&e()};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)},[e])}function R(e,t){let[n,r]=(0,F.useState)(null),[i,a]=(0,F.useState)(!1);return{keys:n,setKeys:r,confirm:i,setConfirm:a,signIn:A({mutationFn:async t=>{if(t)return s.post(e,{credentials:t});let n=window.open(``,`_blank`,`popup,width=520,height=700`);try{let{url:t}=await s.post(e,{oauth:!0});n?n.location.href=t:window.location.href=t}catch(e){throw n?.close(),e}},onSuccess:async(e,n)=>{n&&(r(null),await t())}}),signOut:A({mutationFn:()=>s.del(e),onSuccess:async()=>{a(!1),await t()}})}}function z({s:e,auth:t,signedIn:n}){return(0,I.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:n?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`max-sm:hidden`,children:(0,I.jsx)(D,{tone:`live`,children:P(`konto.signedIn`)})}),(0,I.jsx)(i,{variant:`ghost`,size:`sm`,onClick:()=>e.setConfirm(!0),children:P(`konto.signOut`)})]}):(0,I.jsx)(i,{size:`sm`,busy:e.signIn.isPending&&!e.keys,onClick:()=>t===`api_key`?e.setKeys(e.keys?null:{}):e.signIn.mutate(void 0),children:P(`konto.connectionSignIn`)})})}function B({s:e,fields:t,signedIn:n,confirmText:r,className:a}){let{keys:o}=e;return(0,I.jsxs)(I.Fragment,{children:[o&&!n?(0,I.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),e.signIn.mutate(o??{})},className:v(`mt-3 flex flex-col gap-3`,a),children:[t.map(t=>(0,I.jsxs)(`div`,{children:[(0,I.jsx)(C,{children:t.label}),(0,I.jsx)(p,{type:t.secret?`password`:`text`,autoComplete:`off`,placeholder:t.placeholder,required:t.required!==!1,maxLength:500,value:o[t.key]??``,onChange:n=>e.setKeys({...o,[t.key]:n.target.value})})]},t.key)),(0,I.jsxs)(`div`,{className:`flex gap-2`,children:[(0,I.jsx)(i,{type:`submit`,size:`sm`,busy:e.signIn.isPending,children:P(`konto.connectionSignIn`)}),(0,I.jsx)(i,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>e.setKeys(null),children:P(`orgSettings.cancel`)})]})]}):null,e.signIn.isError?(0,I.jsx)(`p`,{className:v(`mt-2 text-[0.8125rem] text-rose`,a),children:e.signIn.error.message}):null,e.signOut.isError?(0,I.jsx)(`p`,{className:v(`mt-2 text-[0.8125rem] text-rose`,a),children:e.signOut.error.message}):null,e.confirm?(0,I.jsxs)(`div`,{className:v(`mt-3 flex flex-wrap items-center gap-3 rounded-lg bg-paper p-3 text-[0.875rem] ring-1 ring-border-soft`,a),children:[(0,I.jsx)(`p`,{className:`min-w-48 flex-1`,children:r}),(0,I.jsx)(i,{variant:`ghost`,onClick:()=>e.setConfirm(!1),children:P(`orgSettings.cancel`)}),(0,I.jsx)(i,{busy:e.signOut.isPending,onClick:()=>e.signOut.mutate(),children:P(`konto.signOut`)})]}):null]})}var V=e=>[`space-connections`,e];function H(e){return _({enabled:!!e,queryKey:V(e),queryFn:()=>s.get(`/api/studio/spaces/${e}/connections`)})}function Me(e){return _({enabled:!!e,queryKey:d.connectors(e),queryFn:()=>s.get(`/api/studio/spaces/${e}/connectors`)})}function Ne(e,t,n){let r=new Set(t.map(e=>e.connectorId));return e.filter(e=>e.sourceKind===`builtin`&&!r.has(e.id)&&(e.usable||n))}var U={admins:`connection.audience.admins`,members:`connection.audience.members`,all:`connection.audience.all`},Pe={admins:`connection.audience.adminsHint`,members:`connection.audience.membersHint`,all:`connection.audience.allHint`},Fe={read:`connection.kind.read`,write:`connection.kind.write`,destructive:`connection.kind.destructive`,send:`connection.kind.send`},Ie={read:`connection.kind.readHint`,write:`connection.kind.writeHint`,destructive:`connection.kind.destructiveHint`,send:`connection.kind.sendHint`},Le={allow:`connection.outcome.allow`,ask:`connection.outcome.ask`,deny:`connection.outcome.deny`},W={space:`connection.signIn.space`,person:`connection.signIn.person`},Re={space:`connection.signIn.spaceHint`,person:`connection.signIn.personHint`},ze=e=>new Intl.DateTimeFormat(N,{dateStyle:`medium`}).format(new Date(e));function Be(e){let t=Math.round((Date.parse(e)-Date.now())/1e3),n=new Intl.RelativeTimeFormat(N,{numeric:`auto`});for(let[e,r]of[[`day`,86400],[`hour`,3600],[`minute`,60]])if(Math.abs(t)>=r)return n.format(Math.round(t/r),e);return n.format(0,`minute`)}function G(e){let t=e.connector?.name??e.connectorId;return e.name===t?e.name:`${t} · ${e.name}`}var K=e=>e.pluginName??e.plugin??``;function Ve(){let e=fe().data,t=j(`personSignIn`);if(!e||e.mode!==`managed`||t)return{allowed:!0,why:null};let n=e.tenant.plan?.name;return{allowed:!1,why:n?P(`connection.signIn.personPlan`,{plan:n}):P(`connection.signIn.personNoPlan`)}}function He(e){return e.signIn===`space`?e.account?P(`connection.asSpaceAccount`,{label:e.account.label}):P(`connection.asSpaceNotYet`):P(`connection.eachPersonCount`,{n:e.signedIn})}function Ue(e){return e.lastUsedAt?P(`connection.lastUsed`,{when:Be(e.lastUsedAt)}):P(`connection.neverUsed`)}function We(e){let t=e.toLowerCase().replace(/^https?:\/\//,``).split(`/`)[0].split(`.`);return t.length>1?t[t.length-2]:t[0]}function Ge(e,t){if(!e)return null;let n=t.find(t=>t.id===e);if(n)return{connectorId:n.id};let r=t.find(t=>t.domain&&t.domain===e.toLowerCase());if(r)return{connectorId:r.id};let i=We(e),a=t.find(e=>e.sourceKind===`builtin`&&(e.id===i||e.id.endsWith(`-${i}`)||e.name.toLowerCase()===i));return a?{connectorId:a.id}:e.includes(`.`)?{domain:e}:null}function Ke({name:e,large:t}){return(0,I.jsx)(`span`,{"aria-hidden":`true`,className:v(`flex shrink-0 items-center justify-center rounded-lg bg-paper-2 font-semibold text-ink-2`,t?`size-12 text-[0.9375rem]`:`size-9 text-[0.75rem]`),children:pe(e)||`?`})}function qe(){let[e,t]=m(),{space:n}=me(),r=de(),{narrow:i}=ge(),a=u(),o=n?.id??``,s=e.get(`show`),c=e.get(`setup`),l=r&&!n?.readOnly,d=H(o),f=Me(o),p=d.data?.connections??[],h=p.find(e=>e.id===s)??null;he(h?G(h):null),je((0,F.useCallback)(()=>{a.invalidateQueries({queryKey:[`space-connections`]}),a.invalidateQueries({queryKey:[`person-sign-ins`]})},[a])),(0,F.useEffect)(()=>{i||M().scrollTo({top:0})},[i,s]);let g=e=>i?t({show:e}):t(e===`all`?{}:{show:e},{replace:!0});return(0,I.jsx)(I.Fragment,{children:n?(0,I.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:h?(0,I.jsx)(Qe,{connection:h,connector:f.data?.find(e=>e.id===h.connectorId),writable:l,onGone:()=>g(`all`)},h.id):(0,I.jsx)(Je,{spaceId:n.id,connections:p,loading:d.isPending,error:d.error,connectors:f.data??[],writable:l,setup:c,onOpen:g,onSetUp:e=>{t({setup:e},{replace:!i}),i||M().scrollTo({top:0,behavior:`smooth`})},onSetUpDone:()=>t({},{replace:!0})})}):null})}function Je({spaceId:e,connections:t,loading:n,error:r,connectors:a,writable:o,setup:s,onOpen:l,onSetUp:u,onSetUpDone:d}){let f=j(`unsetConnectors`),p=(0,F.useRef)(null),m=s&&a.length?Ge(s,a):null,g=m&&`domain`in m?m.domain:null;(0,F.useEffect)(()=>{g&&p.current?.scrollIntoView({block:`start`,behavior:`smooth`})},[g]);let _=Ne(a,t,f);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(c,{title:P(`capabilities.connectors`),hint:P(`capabilities.connectors.hint`),plain:!0,action:o&&s===null?(0,I.jsxs)(i,{size:`sm`,onClick:()=>u(``),children:[(0,I.jsx)(re,{className:`size-4`}),` `,P(`capabilities.connectors.add`)]}):null,children:[o&&s!==null?(0,I.jsx)(Ze,{spaceId:e,connectors:a,initial:m&&`connectorId`in m?m.connectorId:``,onCancel:d,onDone:l},m&&`connectorId`in m?m.connectorId:`new`):null,(0,I.jsx)(`h3`,{className:`px-1 pt-2 font-display font-semibold text-base`,children:P(`capabilities.inSpace`)}),o?(0,I.jsx)(Xe,{connections:t,onOpen:l}):null,r?(0,I.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:r.message}):t.length?(0,I.jsx)(h,{className:`flex flex-col divide-y divide-border-soft p-0`,children:t.map(e=>(0,I.jsx)(Ye,{connection:e,onOpen:()=>l(e.id)},e.id))}):n?null:(0,I.jsx)(h,{children:(0,I.jsx)(E,{children:P(o?`capabilities.connectors.noneAdmin`:`capabilities.connectors.none`)})})]}),_.length?(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 px-1`,children:[(0,I.jsx)(`h3`,{className:`font-semibold text-[0.875rem]`,children:P(`capabilities.connectors.builtin`)}),(0,I.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:P(o?`capabilities.connectors.builtinHint`:`capabilities.connectors.builtinHintMember`)}),(0,I.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,children:_.map(e=>(0,I.jsx)(`li`,{children:o&&e.usable?(0,I.jsxs)(`button`,{type:`button`,onClick:()=>u(e.id),title:P(`capabilities.connectors.setUpNamed`,{name:e.name}),className:`inline-flex h-8 items-center gap-1.5 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:[(0,I.jsx)(re,{className:`size-3.5`,"aria-hidden":`true`}),e.name]}):(0,I.jsx)(`span`,{title:e.missingSetup??void 0,className:v(`inline-flex h-8 items-center rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-3`,!e.usable&&`opacity-60`),children:e.name})},e.id))})]}):null,(0,I.jsx)(`div`,{ref:p,className:`scroll-mt-6`,children:(0,I.jsx)(c,{title:P(`capabilities.connectors.more`),hint:P(`capabilities.connectors.moreHint`),children:(0,I.jsx)(Ce,{spaceId:e,readOnly:!o,embedded:!0,onSetUp:o?u:void 0,domain:g})})})]})}function Ye({connection:e,onOpen:t}){let n=u(),r=R(`/api/studio/connections/${encodeURIComponent(e.id)}/my-sign-in`,()=>n.invalidateQueries({queryKey:V(e.spaceId)})),i=Object.values(e.rules).includes(`ask`),a=e.signIn===`person`,o=L(e);return(0,I.jsxs)(`div`,{className:`px-3.5 py-3 sm:px-5`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:t,className:`-my-1 -ml-1 flex min-w-0 flex-1 items-center gap-3 rounded-lg p-1 text-left transition hover:bg-paper-2`,children:[(0,I.jsx)(Ke,{name:e.connector?.name??e.connectorId}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`div`,{className:`truncate text-[0.9375rem]`,children:G(e)}),(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[0.8125rem] text-ink-3`,children:[a?(0,I.jsx)(se,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}):(0,I.jsx)(oe,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,I.jsxs)(`span`,{className:`truncate`,children:[He(e),e.plugin?` · ${P(`connection.pluginNamed`,{plugin:K(e)})}`:``,` · `,Ue(e)]})]}),o?(0,I.jsx)(`div`,{className:`mt-1 sm:hidden`,children:(0,I.jsx)(D,{tone:`warn`,children:P(`connection.guests`)})}):null]}),(0,I.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 max-sm:hidden`,children:[i?(0,I.jsx)(D,{tone:`warn`,children:P(`connection.outcome.ask`)}):null,o?(0,I.jsx)(D,{tone:`warn`,children:P(`connection.guests`)}):(0,I.jsx)(D,{children:P(U[e.audience])})]})]}),a?(0,I.jsx)(z,{s:r,auth:e.connector?.auth,signedIn:!!e.mySignIn}):null]}),a?(0,I.jsx)(B,{s:r,fields:e.connector?.fields??[],signedIn:!!e.mySignIn,confirmText:P(`konto.connectionSignOutConfirm`,{name:G(e)}),className:`ml-12`}):null]})}function Xe({connections:e,onOpen:t}){let n=u(),r=e.filter(L),a=A({mutationFn:e=>s.patch(`/api/studio/connections/${encodeURIComponent(e.id)}`,{audience:`members`}),onSuccess:e=>{n.setQueryData(V(e.spaceId),t=>t&&{connections:t.connections.map(t=>t.id===e.id?e:t)}),n.invalidateQueries({queryKey:[`person-sign-ins`]})}});return r.length?(0,I.jsxs)(`section`,{className:`rounded-xl bg-paper-2 px-3.5 py-3 ring-1 ring-border-soft sm:px-5 sm:py-4`,children:[(0,I.jsx)(`h4`,{className:`font-semibold text-[0.875rem]`,children:P(`connection.guests.title`,{n:r.length})}),(0,I.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-2`,children:P(`connection.guests.hint`)}),(0,I.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border-soft`,children:r.map(e=>(0,I.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 py-2.5`,children:[(0,I.jsxs)(`div`,{className:`min-w-0 flex-1 basis-56`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),className:`max-w-full truncate text-left font-medium text-[0.875rem] hover:underline`,children:G(e)}),e.plugin?(0,I.jsx)(`p`,{className:`text-[0.8125rem] text-ink-2`,children:P(`connection.guests.plugin`,{plugin:K(e)})}):null]}),(0,I.jsx)(i,{size:`sm`,variant:`secondary`,"aria-label":P(`connection.guests.narrowNamed`,{name:G(e)}),busy:a.isPending&&a.variables?.id===e.id,onClick:()=>a.mutate(e),children:P(`connection.guests.narrow`)})]},e.id))}),a.error?(0,I.jsx)(`p`,{className:`mt-1 text-[0.8125rem] text-rose`,children:a.error.message}):null]}):null}function Ze({spaceId:e,connectors:t,initial:n,onCancel:r,onDone:a}){let o=u(),c=t.filter(e=>e.usable),[l,d]=(0,F.useState)(c.some(e=>e.id===n)?n:``),f=c.find(e=>e.id===l),[m,g]=(0,F.useState)(f?.name??``),_=Ve(),[v,y]=(0,F.useState)(_.allowed&&f?.auth===`oauth2`?`person`:`space`),[b,S]=(0,F.useState)(`members`),w=A({mutationFn:()=>s.post(`/api/studio/spaces/${e}/connections`,{connectorId:l,name:m.trim()||f?.name,signIn:v,audience:b}),onSuccess:async t=>{await o.invalidateQueries({queryKey:V(e)}),await o.invalidateQueries({queryKey:[`person-sign-ins`]}),a(t.id)}});return(0,I.jsx)(h,{className:`p-3.5 sm:p-5`,children:(0,I.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),l&&w.mutate()},className:`flex flex-col gap-5`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h3`,{className:`font-display font-semibold text-base`,children:P(`capabilities.connectors.add`)}),(0,I.jsx)(`p`,{className:`mt-1 text-[0.8125rem] text-ink-3`,children:P(`connection.setupHint`)})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(C,{children:P(`connection.connector`)}),(0,I.jsx)(x,{value:l,onChange:e=>{let t=c.find(t=>t.id===e);(!m.trim()||m===f?.name)&&g(t?.name??``),d(e)},placeholder:P(`connection.connectorPick`),options:c.map(e=>({value:e.id,label:e.name}))})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(C,{hint:P(`connection.nameHint`),children:P(`connection.name`)}),(0,I.jsx)(p,{value:m,maxLength:Ae.name,placeholder:P(`connection.namePlaceholder`),onChange:e=>g(e.target.value)})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(C,{hint:P(Re[v]),children:P(`connection.signIn`)}),(0,I.jsx)(T,{label:P(`connection.signIn`),value:v,onChange:y,options:Ee.map(e=>({id:e,label:P(W[e]),disabled:e===`person`&&!_.allowed}))}),(0,I.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-3`,children:_.why??P(`connection.signInLater`)})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(C,{hint:P(Pe[b]),children:P(`connection.audience`)}),(0,I.jsx)(T,{label:P(`connection.audience`),value:b,onChange:S,options:De.map(e=>({id:e,label:P(U[e])}))})]}),w.error?(0,I.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:w.error.message}):null,(0,I.jsxs)(`div`,{className:`flex gap-2`,children:[(0,I.jsx)(i,{type:`submit`,busy:w.isPending,disabled:!l,children:P(`capabilities.connectors.setUp`)}),(0,I.jsx)(i,{type:`button`,variant:`ghost`,onClick:r,children:P(`orgSettings.cancel`)})]})]})})}function Qe({connection:e,connector:t,writable:n,onGone:r}){let a=u(),o=V(e.spaceId),c=()=>a.invalidateQueries({queryKey:o}),[l,d]=(0,F.useState)(e.name),[f,m]=(0,F.useState)(!1),[g,_]=(0,F.useState)(null),v=Ve(),y=`/api/studio/connections/${encodeURIComponent(e.id)}`,b=A({mutationFn:e=>s.patch(y,e),onSuccess:e=>{a.setQueryData(o,t=>t&&{connections:t.connections.map(t=>t.id===e.id?e:t)}),a.invalidateQueries({queryKey:[`person-sign-ins`]})}}),x=A({mutationFn:()=>s.del(y),onSuccess:async()=>{await c(),a.invalidateQueries({queryKey:[`person-sign-ins`]}),r()}}),S=R(`${y}/sign-in`,c),C=R(`${y}/my-sign-in`,c),w=()=>{let t=l.trim();t&&t!==e.name?b.mutate({name:t}):d(e.name)},E=e.connector?.name??e.connectorId,O=e.connector?.fields??[],ee=e.setUpByName?P(`konto.connectionSetUpBy`,{name:e.setUpByName,when:ze(e.setUpAt)}):P(`konto.connectionSetUpAt`,{when:ze(e.setUpAt)}),k=e.plugin?P(`connection.signIn.pluginSpace`,{plugin:K(e)}):v.allowed?null:e.signIn===`person`?P(`connection.signIn.personKept`):v.why,te=n=>(t?.actions??[]).filter(e=>e.group===n).filter(t=>!e.actions.length||e.actions.includes(t.id));return(0,I.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-4 px-1`,children:[(0,I.jsx)(Ke,{name:E,large:!0}),(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:E}),e.connector?.description?(0,I.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[0.875rem] text-ink-3`,children:e.connector.description}):null]})]}),(0,I.jsxs)(h,{className:`flex flex-col gap-5 p-3.5 sm:p-5`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1`,children:[n?(0,I.jsx)(p,{"aria-label":P(`connection.name`),className:`max-w-sm font-semibold`,value:l,maxLength:Ae.name,onChange:e=>d(e.target.value),onBlur:w,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),w())}}):(0,I.jsx)(`b`,{className:`text-[0.9375rem]`,children:e.name}),(0,I.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:n?ee:P(`connection.adminsManage`)})]}),(0,I.jsx)(q,{label:P(`connection.signIn`),children:(0,I.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[n?(0,I.jsx)(`div`,{className:`max-w-full overflow-x-auto`,children:(0,I.jsx)(T,{label:P(`connection.signIn`),value:e.signIn,onChange:t=>_(t===e.signIn?null:t),options:Ee.map(e=>({id:e,label:P(W[e]),disabled:e===`person`&&!!k}))})}):(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[0.875rem]`,children:[e.signIn===`space`?(0,I.jsx)(oe,{className:`size-4 text-ink-3`,"aria-hidden":`true`}):(0,I.jsx)(se,{className:`size-4 text-ink-3`,"aria-hidden":`true`}),P(W[e.signIn])]}),(0,I.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:P(Re[e.signIn])}),n&&k?(0,I.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:k}):null,n&&g?(0,I.jsxs)(`div`,{className:`mt-1 flex flex-col gap-3 rounded-lg bg-paper p-3 text-[0.875rem] ring-1 ring-border-soft`,children:[(0,I.jsx)(`p`,{children:P(g===`space`?`connection.signIn.toSpaceConfirm`:`connection.signIn.toPersonConfirm`)}),(0,I.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,I.jsx)(i,{variant:`ghost`,onClick:()=>_(null),children:P(`orgSettings.cancel`)}),(0,I.jsx)(i,{busy:b.isPending,onClick:()=>b.mutate({signIn:g},{onSettled:()=>_(null)}),children:P(`connection.signIn.change`)})]})]}):null]})}),e.signIn===`space`?(0,I.jsx)(q,{label:P(`connection.account`),children:(0,I.jsxs)(`div`,{className:`flex flex-col`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,I.jsx)(`span`,{className:`text-[0.875rem]`,children:e.account?P(`connection.accountSignedIn`,{label:e.account.label}):P(n?`connection.accountNotYetAdmin`:`connection.accountNotYet`)}),n?(0,I.jsx)(z,{s:S,auth:e.connector?.auth,signedIn:!!e.account}):null]}),n?(0,I.jsx)(B,{s:S,fields:O,signedIn:!!e.account,confirmText:P(`connection.signOutSpaceConfirm`,{name:G(e)})}):null]})}):(0,I.jsx)(q,{label:P(`connection.people`),children:(0,I.jsxs)(`div`,{className:`flex flex-col`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,I.jsxs)(`span`,{className:`text-[0.875rem]`,children:[P(`connection.peopleSignedIn`,{n:e.signedIn}),` · `,e.mySignIn?P(`connection.youSignedIn`,{label:e.mySignIn.label}):P(`connection.youNotYet`)]}),(0,I.jsx)(z,{s:C,auth:e.connector?.auth,signedIn:!!e.mySignIn})]}),(0,I.jsx)(B,{s:C,fields:O,signedIn:!!e.mySignIn,confirmText:P(`konto.connectionSignOutConfirm`,{name:G(e)})})]})}),(0,I.jsx)(q,{label:P(`connection.audience`),children:(0,I.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[n?(0,I.jsx)(`div`,{children:(0,I.jsx)(T,{label:P(`connection.audience`),value:e.audience,onChange:e=>b.mutate({audience:e}),options:De.map(e=>({id:e,label:P(U[e])}))})}):(0,I.jsx)(`span`,{children:(0,I.jsx)(D,{children:P(U[e.audience])})}),(0,I.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:P(Pe[e.audience])}),n&&e.plugin&&L(e)?(0,I.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:P(`connection.guests.plugin`,{plugin:K(e)})}):null]})}),(0,I.jsx)(`div`,{className:`border-border-soft border-t`}),(0,I.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,I.jsx)(`h3`,{className:`font-semibold text-[0.875rem]`,children:P(`connection.rules`)}),Oe.map(t=>{let r=te(t);return(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`div`,{className:`font-medium text-[0.875rem]`,children:P(Fe[t])}),(0,I.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:P(Ie[t])}),r.length?(0,I.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[0.6875rem] text-ink-4`,children:r.map(e=>e.id).join(` · `)}):null]}),(0,I.jsx)(`div`,{className:`shrink-0`,children:n?(0,I.jsx)(T,{label:P(Fe[t]),value:e.rules[t],onChange:n=>b.mutate({rules:{...e.rules,[t]:n}}),options:ke.map(e=>({id:e,label:P(Le[e])}))}):(0,I.jsx)(D,{tone:e.rules[t]===`ask`?`warn`:`neutral`,children:P(Le[e.rules[t]])})})]},t)}),(0,I.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:P(n?`connection.askHint`:`connection.askHintMember`)})]}),b.error?(0,I.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:b.error.message}):null]}),(0,I.jsxs)(h,{className:`flex flex-col gap-1 p-3.5 sm:p-5`,children:[(0,I.jsx)(q,{label:P(`connection.use`),children:(0,I.jsx)(`span`,{className:`text-[0.875rem]`,children:Ue(e)})}),e.plugin?(0,I.jsx)(q,{label:P(`connection.plugin`),children:(0,I.jsx)(`span`,{className:`text-[0.875rem]`,children:P(`connection.pluginUses`,{plugin:K(e)})})}):null]}),n?(0,I.jsxs)(`div`,{className:`px-1`,children:[f?(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-lg bg-paper p-3 text-[0.875rem] ring-1 ring-border-soft`,children:[(0,I.jsx)(`p`,{className:`min-w-48 flex-1`,children:P(`connection.removeConfirm`,{name:G(e)})}),(0,I.jsx)(i,{variant:`ghost`,onClick:()=>m(!1),children:P(`orgSettings.cancel`)}),(0,I.jsx)(i,{variant:`danger`,busy:x.isPending,onClick:()=>x.mutate(),children:P(`connection.remove`)})]}):(0,I.jsx)(i,{variant:`danger`,size:`sm`,onClick:()=>m(!0),children:P(`connection.remove`)}),x.error?(0,I.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:x.error.message}):null]}):null]})}function q({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`grid gap-1.5 sm:grid-cols-[11rem_minmax(0,1fr)] sm:gap-4`,children:[(0,I.jsx)(`span`,{className:`pt-0.5 text-[0.8125rem] text-ink-3`,children:e}),t]})}var J={not_connected:`protocol.refused.not_connected`,no_action:`protocol.refused.no_action`,not_in_grant:`protocol.refused.not_in_grant`,denied:`protocol.refused.denied`,declined:`protocol.refused.declined`,nobody:`protocol.refused.nobody`,needs_approval:`protocol.refused.needs_approval`,ai_step_writes:`protocol.refused.ai_step_writes`,not_allowed_recipient:`protocol.refused.not_allowed_recipient`,channel_not_fixed:`protocol.refused.channel_not_fixed`,run_limit:`protocol.refused.run_limit`,day_limit:`protocol.refused.day_limit`},$e={read:`protocol.kind.read`,write:`protocol.kind.write`,destructive:`protocol.kind.destructive`,send:`protocol.kind.send`},et={read:`protocol.verb.read`,write:`protocol.verb.write`,destructive:`protocol.verb.destructive`,send:`protocol.verb.send`},tt={refused_write:`work.critical.refused_write`,outside_audience:`work.critical.outside_audience`,host_not_in_grant:`work.critical.host_not_in_grant`,limit_reached:`work.critical.limit_reached`,sign_in_failed:`work.critical.sign_in_failed`,first_use:`work.critical.first_use`,rule_changed:`work.critical.rule_changed`},nt={grant:`protocol.rule.grant`,audience:`protocol.rule.audience`,actions:`protocol.rule.actions`,ai_step_writes:`protocol.rule.ai_step_writes`,destructive:`protocol.rule.destructive`,policy:`protocol.rule.policy`,read:`protocol.rule.read`,own_job:`protocol.rule.own_job`,guest_send:`protocol.rule.guest_send`},rt={admins:`protocol.audience.admins`,members:`protocol.audience.members`,all:`protocol.audience.all`};function it(e){return e in $e}function Y(e){return it(e)?P($e[e]):e}function at(e){return it(e)?P(et[e]):e}function ot(e){return e&&e in tt?P(tt[e]):``}function st(e){if(!e)return P(`protocol.rule.none`);if(e.startsWith(`rules.`))return P(`protocol.rule.rules`,{kind:Y(e.slice(6))});let t=nt[e]??nt[e.split(`.`)[0]??``];return t?P(t):e}function ct(e,t,n){return e&&e!==`denied`&&e in J?P(J[e]):t===`audience`?n&&n in rt?P(`protocol.why.audienceFor`,{audience:P(rt[n])}):P(`protocol.why.audience`):t===`actions`?P(`protocol.why.actions`):t===`grant`?P(`protocol.refused.not_in_grant`):t?.startsWith(`rules.`)?P(`protocol.why.rule`):P(`protocol.refused.denied`)}function lt(e){let{outcome:t,result:n,rule:r}=e;return n===`ok`?{tone:`done`,text:P(t===`ask`?`protocol.outcome.doneApproved`:`protocol.outcome.done`)}:n===`needs_approval`?{tone:`held`,text:P(`protocol.outcome.held`)}:n===`sign_in_failed`?{tone:`failed`,text:P(`protocol.outcome.signInFailed`)}:n===`nobody`||n===`not_connected`?{tone:`failed`,text:P(`protocol.outcome.notDone`,{why:P(J[n])})}:t===`deny`||n===`declined`?{tone:`refused`,text:P(`protocol.outcome.refused`,{why:ct(n,r)})}:{tone:`failed`,text:P(`protocol.outcome.failed`,{error:n??``})}}function ut(e){switch(e.kind){case`guest`:return P(`protocol.who.guest`);case`person`:return e.name??P(`protocol.who.person`);case`admin`:return e.name?P(`protocol.who.adminNamed`,{name:e.name}):P(`protocol.who.admin`);case`goose`:return e.name?P(`protocol.who.gooseFor`,{name:e.name}):P(`protocol.who.goose`);case`plugin`:return P(`protocol.who.plugin`,{name:e.id??``});case`step`:return e.for?e.for.kind===`guest`?P(`protocol.who.stepForGuest`):P(`protocol.who.stepFor`,{name:e.for.name??P(`protocol.who.person`)}):P(`protocol.who.step`);default:return e.kind}}function dt(e){return e.runId?e.wizardName?P(e.runMode===`test`?`protocol.where.testRunOf`:`protocol.where.runOf`,{wizard:e.wizardName}):P(`protocol.where.run`):e.chatId?e.chatTitle?P(`protocol.where.chatNamed`,{title:e.chatTitle}):P(`protocol.where.chat`):e.who.kind===`goose`?P(`protocol.where.goose`):e.who.kind===`plugin`?P(`protocol.where.plugin`):``}function ft(e){let{connectionId:t}=e;return e.connectionName?e.connectorName&&!e.connectionName.includes(e.connectorName)?`${e.connectorName} · ${e.connectionName}`:e.connectionName:t.startsWith(`host:`)?P(`protocol.connection.host`,{host:t.slice(5)}):t===`mail:server`?P(`protocol.connection.serverMail`):t===`rwx`?P(`protocol.connection.rwx`):e.connectorName?`${e.connectorName} · ${t}`:t}function pt(e){switch(e.actionId){case`change_rules`:return P(`protocol.action.changeRules`);case`http_request`:return P(`protocol.action.request`);case`read_secret`:return P(`protocol.action.readSecret`);case`send_message`:return e.actionName??P(`protocol.action.sendMail`);default:return e.actionName??e.actionId}}function mt(e,t){let n={who:t.who,connection:t.connection,verb:at(e.action.kind)};return e.outcome===`allow`?P(`protocol.ask.allow`,n):e.outcome===`ask`?P(e.admins?`protocol.ask.askAdmins`:`protocol.ask.askPerson`,n):P(`protocol.ask.deny`,{...n,why:ct(e.refused??null,e.rule,t.audience)})}function ht(e){return e.fixedChannel?P(`protocol.ask.fixedChannel`):null}function gt(){let[e,t]=m(),{space:n}=me(),a=de(),o=e.get(`show`),c=a&&(o===`ask`||o===`notify`)?o:null,l=e=>t(e?{show:e}:{},{replace:!0}),u=_({queryKey:[`broker-choices`,n?.id],queryFn:()=>s.get(`/api/studio/spaces/${n?.id}/broker/choices`),enabled:!!n&&a});return n?a?(0,I.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[(0,I.jsx)(xt,{spaceId:n.id,action:(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(i,{variant:`secondary`,size:`sm`,onClick:()=>l(`ask`),children:[(0,I.jsx)(ae,{className:`size-4`}),` `,P(`protocol.ask.title`)]}),(0,I.jsx)(i,{variant:`secondary`,size:`sm`,onClick:()=>l(`notify`),"aria-label":P(`protocol.notify.title`),title:P(`protocol.notify.title`),children:(0,I.jsx)(r,{className:`size-4`})})]})}),(0,I.jsxs)(S,{open:c===`ask`,onClose:()=>l(null),wide:!0,title:P(`protocol.ask.title`),children:[(0,I.jsx)(`p`,{className:`-mt-2 mb-4 text-[0.875rem] text-ink-3`,children:P(`protocol.ask.hint`)}),(0,I.jsx)(Ot,{choices:u.data,spaceId:n.id})]}),(0,I.jsxs)(S,{open:c===`notify`,onClose:()=>l(null),title:P(`protocol.notify.title`),children:[(0,I.jsx)(`p`,{className:`-mt-2 mb-4 text-[0.875rem] text-ink-3`,children:P(`protocol.notify.hint`)}),(0,I.jsx)(At,{space:n})]})]}):(0,I.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:(0,I.jsx)(xt,{spaceId:n.id,own:!0})}):null}var _t={hour:36e5,day:864e5,week:6048e5,month:2592e6},vt=[`guest`,`person`,`admin`,`goose`,`plugin`,`step`],yt=50;function bt(e,t=300){let[n,r]=(0,F.useState)(e);return(0,F.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function xt({spaceId:e,own:t=!1,action:n}){let[r,a]=(0,F.useState)(`all`),[o,l]=(0,F.useState)(``),[u,d]=(0,F.useState)(``),[f,p]=(0,F.useState)(`week`),[m,h]=(0,F.useState)(``),g=bt(m).trim(),[_,y]=(0,F.useState)(null),b=H(e).data?.connections??[],S=te({queryKey:[`broker-log`,e,{outcome:r,who:o,connection:u,range:f,q:g}],initialPageParam:null,queryFn:({pageParam:t})=>{let n=new URLSearchParams({limit:String(yt)});return r===`refused`?n.set(`refused`,`true`):r===`critical`?n.set(`critical`,`true`):r===`held`&&n.set(`result`,`needs_approval`),o&&n.set(`who`,o),u&&n.set(`connection`,u),f!==`all`&&n.set(`since`,new Date(Date.now()-_t[f]).toISOString()),g&&n.set(`q`,g),t&&n.set(`cursor`,t),s.get(`/api/studio/spaces/${e}/broker/log?${n}`)},getNextPageParam:e=>e.next}),C=S.data?.pages.flatMap(e=>e.lines)??[],w=r!==`all`||o!==``||u!==``||f!==`all`||g!==``,E=new Set(b.map(e=>e.id));return(0,I.jsx)(c,{title:P(`capabilities.protocol`),hint:P(t?`protocol.own.hint`:`protocol.hint`),action:n,plain:!0,children:(0,I.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,I.jsx)(`div`,{className:`flex flex-wrap items-center gap-3`,children:(0,I.jsx)(T,{value:r,onChange:a,label:P(`protocol.filter.outcome`),options:[{id:`all`,label:P(`protocol.filter.all`)},{id:`refused`,label:P(`protocol.filter.refused`)},{id:`critical`,label:P(`protocol.filter.critical`)},{id:`held`,label:P(`protocol.filter.held`)}]})}),(0,I.jsxs)(`div`,{className:v(`grid gap-2`,t?`sm:grid-cols-2`:`sm:grid-cols-3`),children:[t?null:(0,I.jsx)(x,{value:o,onChange:l,placeholder:P(`protocol.filter.everyone`),options:vt.map(e=>({value:e,label:P(`protocol.filter.who.${e}`)}))}),(0,I.jsx)(x,{value:u,onChange:d,placeholder:P(`protocol.filter.everyConnection`),options:b.map(e=>({value:e.id,label:e.connector?`${e.connector.name} · ${e.name}`:e.name}))}),(0,I.jsx)(x,{value:f,onChange:e=>p(e),options:[`hour`,`day`,`week`,`month`,`all`].map(e=>({value:e,label:P(`protocol.range.${e}`)}))})]}),(0,I.jsx)(k,{value:m,onChange:h,placeholder:P(t?`protocol.own.search`:`protocol.search`),busy:S.isFetching&&!S.isFetchingNextPage}),S.error?(0,I.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:S.error.message}):S.isPending?(0,I.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,I.jsx)(O,{className:`text-ink-3`})}):C.length===0?(0,I.jsx)(`p`,{className:`py-12 text-center text-[0.9375rem] text-ink-3`,children:P(w?`protocol.emptyFiltered`:t?`protocol.own.empty`:`protocol.empty`)}):(0,I.jsx)(`ul`,{className:`flex flex-col gap-2`,children:C.map(t=>(0,I.jsx)(`li`,{children:(0,I.jsx)(wt,{line:t,spaceId:e,open:_===t.id,onToggle:()=>y(_===t.id?null:t.id),ofSpace:E.has(t.connectionId)})},t.id))}),S.hasNextPage?(0,I.jsx)(`div`,{className:`flex justify-center`,children:(0,I.jsx)(i,{variant:`quiet`,size:`sm`,busy:S.isFetchingNextPage,onClick:()=>void S.fetchNextPage(),children:P(`protocol.more`)})}):null]})})}var St={done:ue,refused:ve,held:o,failed:ee},X={done:`text-moss`,refused:`text-rose`,held:`text-ember`,failed:`text-ink-3`};function Ct(e,t=!1){return new Date(e).toLocaleString(N,{dateStyle:t?`medium`:`short`,timeStyle:t?`medium`:`short`})}function wt({line:e,spaceId:t,open:n,onToggle:r,ofSpace:i}){let a=lt(e),o=St[a.tone],s=dt(e),c=e.critical||a.tone===`refused`;return(0,I.jsxs)(`div`,{className:v(`rounded-xl bg-card ring-1 transition`,e.critical?`ring-ember/50`:a.tone===`refused`?`ring-rose/40`:`ring-border-soft`),children:[(0,I.jsxs)(`button`,{type:`button`,onClick:r,"aria-expanded":n,className:`flex w-full items-start gap-3 px-3.5 py-3 text-left`,children:[(0,I.jsx)(o,{className:v(`mt-0.5 size-4 shrink-0`,X[a.tone])}),(0,I.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,I.jsxs)(`span`,{className:`text-[0.9375rem] text-ink leading-snug`,children:[(0,I.jsx)(`b`,{className:`font-medium`,children:ut(e.who)}),` · `,Y(e.kind),`: `,pt(e),` · `,ft(e)]}),(0,I.jsxs)(`span`,{className:`text-[0.8125rem] text-ink-3 leading-snug`,children:[Ct(e.at),s?` · ${s}`:``,` · `,(0,I.jsx)(`span`,{className:v(c&&X[a.tone],c&&`font-medium`),children:a.text})]})]}),e.critical?(0,I.jsx)(`span`,{className:`shrink-0`,children:(0,I.jsx)(D,{tone:`ember`,icon:(0,I.jsx)(ce,{className:`size-3`}),title:ot(e.criticalKind),children:P(`protocol.critical`)})}):null,(0,I.jsx)(f,{className:v(`mt-0.5 size-4 shrink-0 text-ink-4 transition-transform`,n&&`rotate-180`)})]}),n?(0,I.jsx)(Tt,{line:e,spaceId:t,ofSpace:i}):null]})}function Z({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`grid gap-0.5 sm:grid-cols-[11rem_minmax(0,1fr)] sm:gap-3`,children:[(0,I.jsx)(`dt`,{className:`text-[0.8125rem] text-ink-3`,children:e}),(0,I.jsx)(`dd`,{className:`min-w-0 break-words text-[0.875rem] text-ink-2`,children:t})]})}function Tt({line:e,spaceId:t,ofSpace:n}){let r=_({queryKey:[`broker-line`,t,e.id],queryFn:()=>s.get(`/api/studio/spaces/${t}/broker/log/${e.id}`)}),i=r.data?.run,a=e.input,o=Object.keys(a?.fields??{}),c=e.connectionId.startsWith(`host:`);return(0,I.jsxs)(`div`,{className:`border-border-soft border-t px-3.5 py-3`,children:[(0,I.jsxs)(`dl`,{className:`grid gap-2`,children:[(0,I.jsxs)(Z,{label:P(`protocol.detail.when`),children:[Ct(e.at,!0),` · `,P(`protocol.detail.duration`,{ms:e.durationMs})]}),e.critical?(0,I.jsx)(Z,{label:P(`protocol.critical`),children:ot(e.criticalKind)}):null,(0,I.jsxs)(Z,{label:P(`protocol.detail.input`),children:[o.length?P(`protocol.detail.inputFields`,{fields:o.join(`, `),size:a?.size??0}):P(`protocol.detail.inputEmpty`),a?.sample?(0,I.jsx)(`span`,{className:`mt-0.5 block font-mono text-[0.8125rem] text-ink-3`,children:a.sample}):null]}),(0,I.jsx)(Z,{label:P(`protocol.detail.result`),children:e.resultSize===null?P(`protocol.detail.resultNone`):P(`protocol.detail.resultSize`,{size:e.resultSize})}),(0,I.jsxs)(Z,{label:P(`protocol.detail.rule`),children:[st(e.rule),e.reason?(0,I.jsx)(`span`,{className:`mt-0.5 block text-[0.8125rem] text-ink-3`,children:e.reason}):null]}),e.runId?(0,I.jsx)(Z,{label:P(`protocol.detail.grant`),children:r.isPending?(0,I.jsx)(O,{className:`size-4 text-ink-3`}):n?P(`protocol.detail.grantSpace`):i?.grant?c?i.grant.hosts.length?P(`protocol.detail.grantHosts`,{hosts:i.grant.hosts.join(`, `)}):P(`protocol.detail.grantNoHosts`):i.grant.actions?.length?P(`protocol.detail.grantActions`,{actions:i.grant.actions.join(`, `)}):P(`protocol.detail.grantNoActions`):P(`protocol.detail.grantNone`)}):null]}),(0,I.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[e.runId&&e.wizardId?(0,I.jsx)(Q,{to:`/edit/${e.wizardId}?run=${e.runId}`,children:P(`protocol.detail.openRun`)}):null,e.chatId?(0,I.jsx)(Q,{to:`/work/c/${e.chatId}`,children:P(`protocol.detail.openChat`)}):null,n?(0,I.jsx)(Q,{to:`/capabilities/connectors?show=${e.connectionId}`,children:P(`protocol.detail.openConnection`)}):null]})]})}function Q({to:e,children:t}){return(0,I.jsx)(w,{to:e,className:`inline-flex h-8 items-center rounded-full bg-paper-2 px-3 font-medium text-[0.8125rem] text-ink transition hover:bg-paper-3 coarse:h-11 coarse:px-4`,children:t})}function Et(e,t){if(e.startsWith(`person:`)){let n=t.people.find(t=>`person:${t.id}`===e);return{who:n&&n.role!==`member`?`admin`:`person`}}return e.startsWith(`step:`)?{who:`step`,for:e.slice(5)}:{who:e}}function Dt(e,t){return e.startsWith(`person:`)?t.people.find(t=>`person:${t.id}`===e)?.name??``:P(e===`guest`?`protocol.ask.who.guest`:e===`goose`?`protocol.ask.who.goose`:`protocol.ask.who.step`)}function Ot({choices:e,spaceId:t}){let[n,r]=(0,F.useState)(``),[i,a]=(0,F.useState)(``),[o,c]=(0,F.useState)(``),[l,u]=(0,F.useState)(`run`),d=e?.connections.find(e=>e.id===i),f=d?.actions.find(e=>e.id===o),p=n.startsWith(`step:`)?`run`:l,m=!!(e&&n&&d&&f),h=_({queryKey:[`broker-ask`,t,n,i,o,p],queryFn:()=>{let r=new URLSearchParams({...Et(n,e),resource:i,action:o,in:p});return s.get(`/api/studio/spaces/${t}/broker/ask?${r}`)},enabled:m});if(!e)return(0,I.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,I.jsx)(O,{className:`text-ink-3`})});let g=[...e.people.map(e=>({value:`person:${e.id}`,label:e.role===`member`?e.name:P(`protocol.who.adminNamed`,{name:e.name})})),{value:`guest`,label:P(`protocol.ask.who.guest`)},{value:`goose`,label:P(`protocol.ask.who.goose`)},{value:`step:guest`,label:P(`protocol.ask.who.stepGuest`)},{value:`step:person`,label:P(`protocol.ask.who.stepPerson`)}];return(0,I.jsx)(I.Fragment,{children:e.connections.length===0?(0,I.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:P(`protocol.ask.noConnections`)}):(0,I.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,I.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,I.jsx)($,{label:P(`protocol.ask.who`),children:(0,I.jsx)(x,{value:n,onChange:e=>r(e),placeholder:P(`protocol.ask.choose`),options:g})}),(0,I.jsx)($,{label:P(`protocol.ask.connection`),children:(0,I.jsx)(x,{value:i,onChange:e=>{a(e),c(``)},placeholder:P(`protocol.ask.choose`),options:e.connections.map(e=>({value:e.id,label:e.connector?`${e.connector.name} · ${e.name}`:e.name}))})}),(0,I.jsx)($,{label:P(`protocol.ask.action`),children:(0,I.jsx)(x,{value:o,onChange:c,placeholder:P(`protocol.ask.choose`),options:(d?.actions??[]).map(e=>({value:e.id,label:`${e.name} (${Y(e.kind)})`}))})}),(0,I.jsx)($,{label:P(`protocol.ask.where`),children:(0,I.jsx)(x,{value:p,onChange:e=>u(e),options:[{value:`run`,label:P(`protocol.ask.inRun`)},{value:`chat`,label:P(`protocol.ask.inChat`),disabled:n.startsWith(`step:`)}]})})]}),(0,I.jsx)(`div`,{className:`rounded-xl bg-paper-2 px-4 py-3.5`,children:m?h.error?(0,I.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:h.error.message}):h.data?(0,I.jsx)(kt,{answer:h.data,who:Dt(n,e),connection:d?d.connector?`${d.connector.name} · ${d.name}`:d.name:``,audience:d?.audience}):(0,I.jsx)(O,{className:`size-4 text-ink-3`}):(0,I.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:P(`protocol.ask.pick`)})})]})})}function kt({answer:e,who:t,connection:n,audience:r}){let i=e.outcome===`allow`?`done`:e.outcome===`ask`?`held`:`refused`,a=St[i],o=ht(e);return(0,I.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,I.jsx)(a,{className:v(`mt-1 size-4 shrink-0`,X[i])}),(0,I.jsxs)(`div`,{className:`grid min-w-0 gap-1.5`,children:[(0,I.jsx)(`p`,{className:`font-medium text-[0.9375rem] text-ink leading-snug`,children:mt(e,{who:t,connection:n,audience:r})}),o?(0,I.jsx)(`p`,{className:`text-[0.8125rem] text-ink-2`,children:o}):null,(0,I.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:P(`protocol.ask.rule`,{rule:st(e.rule)})}),(0,I.jsx)(`div`,{children:(0,I.jsx)(Q,{to:`/capabilities/connectors?show=${e.connection.id}`,children:P(`protocol.ask.change`)})})]})]})}function $({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,I.jsx)(`span`,{className:`font-medium text-[0.8125rem] text-ink-2`,children:e}),t]})}function At({space:e}){let t=u(),[n,r]=(0,F.useState)(!1),[i,a]=(0,F.useState)(null),o=e.notify??{bell:!0,mail:`hourly`},c=async n=>{r(!0),a(null);try{await s.patch(`/api/studio/spaces/${e.id}`,{notify:n}),await t.invalidateQueries({queryKey:d.spaces()})}catch(e){a(e.message)}finally{r(!1)}},l=e.readOnly||n;return(0,I.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,I.jsx)(jt,{label:P(`protocol.notify.bell`),hint:P(`protocol.notify.bellHint`),checked:o.bell,disabled:l,onChange:e=>void c({...o,bell:e})}),(0,I.jsx)(jt,{label:P(`protocol.notify.mail`),hint:P(`protocol.notify.mailHint`),checked:o.mail===`hourly`,disabled:l,onChange:e=>void c({...o,mail:e?`hourly`:`off`})}),i?(0,I.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:i}):null]})}function jt({label:e,hint:t,checked:n,disabled:r,onChange:i}){return(0,I.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`div`,{className:`font-medium text-[0.9375rem] text-ink`,children:e}),(0,I.jsx)(`div`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:t})]}),(0,I.jsx)(g,{checked:n,onChange:i,label:e,disabled:r})]})}export{Xe as a,H as c,je as d,R as f,qe as i,z as l,gt as n,Ne as o,Ce as p,Ye as r,Me as s,At as t,B as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{$t as r,Q as i,at as a,gr as o,hn as s,hr as c,in as l,lr as u,mr as d,mt as f,nr as p,pr as m,pt as h,qt as g,un as _,vt as v,yt as ee}from"./ui-Mplfhz_Z.js";import{d as y,n as b}from"./marked.esm-DQ7XA7AC.js";import{c as x}from"./read-aloud-Bq88XUHC.js";import{_ as S,b as C,d as w,f as te,g as T,h as E,m as D,n as ne,p as re,v as O,y as k}from"./theme-CNJIC2be.js";import{C as A,S as j,k as ie,x as M}from"./session-D2bjiA3P.js";import{J as N,a as P,l as F,s as I}from"./i18n-Bymk5Ev-.js";import{n as L}from"./LangSwitch-Ba4OWLzJ.js";var R={name:`bookmark`,size:24,node:[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]};R.node;var ae=y(R),z={name:`square-plus`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]],aliases:[`plus-square`]};z.node;var oe=y(z),B=e(t(),1);function se(){if(window.self===window.top)return null;let e=new URLSearchParams(window.location.search).get(`embed`);return e===`inline`||e===`modal`||e===`popout`?e:null}var V=se(),ce=V?new URLSearchParams(window.location.search).get(`page`):null,H=new URLSearchParams(window.location.search).get(`theme`),U=H?`?theme=${encodeURIComponent(H)}`:``,W=(e,t={})=>window.parent.postMessage({type:`engenty-wizard:${e}`,...t},`*`),le=()=>W(`close`);function ue(e){(0,B.useEffect)(()=>{if(V===`inline`&&!e){let e=document.documentElement;document.getElementById(`root`)?.style.setProperty(`min-height`,`0`),e.style.overflow=`hidden`;let t=new ResizeObserver(()=>W(`height`,{height:Math.ceil(e.getBoundingClientRect().height)}));return t.observe(e),()=>t.disconnect()}if(V===`modal`||V===`popout`){let e=e=>{e.key===`Escape`&&!document.querySelector(`dialog[open]`)&&W(`close`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[e])}var G=e(n(),1),K=`wizards.runner.translate`,q=new Set;function de(){try{return localStorage.getItem(K)===`on`}catch{return!1}}function fe(e){try{localStorage.setItem(K,e?`on`:`off`)}catch{}for(let e of q)e()}function pe(){return(0,B.useSyncExternalStore)(e=>(q.add(e),()=>q.delete(e)),de)}function me(e){let t=pe(),[n]=(0,B.useState)(()=>F()),r=e?.lang??`en`,a=e?.translatable&&n&&n!==r?n:null,s=a&&t?a:r,c=e?.token,l=o({queryKey:[`public-translation`,c,s],enabled:!!(c&&s!==r),queryFn:()=>i.post(`/api/public/wizards/${c}/translation${U}`,{lang:s}),staleTime:1/0,retry:!1}),u=o({queryKey:[`public-texts`,c,s],enabled:!(!c||N(s)),queryFn:()=>i.get(`/api/public/wizards/${c}/texts/${s}`),staleTime:1/0,retry:!1}),d=!N(s),f=s===r||l.data&&(!d||u.data),p=s!==r&&(l.isError||d&&u.isError),m=f&&!p?s:r,h=(0,B.useMemo)(()=>!N(m)&&u.data?.lang===m?{lang:u.data.lang,runner:u.data.runner,notes:u.data.notes}:null,[m,u.data]);if((0,B.useEffect)(()=>{e&&P(m,h)},[e,m,h]),(0,B.useEffect)(()=>()=>P(null),[]),!e)return null;let g=m!==r&&l.data?l.data:null;return{own:r,other:a,shown:m,wizard:g??e,translating:s!==r&&!f&&!p,failed:!!p,translated:!!g,machine:g?.translation?.machine??!1,pick:e=>fe(e!==r)}}function J({page:e,tone:t=`ground`}){if(!e?.other)return null;let n=e.translating?e.other:e.shown;return(0,G.jsx)(L,{langs:[e.own,e.other],value:n,onPick:e.pick,tone:t})}function Y({page:e,small:t}){if(!e)return null;let n=t?`truncate text-[0.75rem]`:`text-[0.8125rem]`;return e.failed?(0,G.jsx)(`p`,{className:s(`text-ink-3`,n),children:I(`translation.failed`)}):e.translated?(0,G.jsxs)(`p`,{className:s(`text-ink-3`,n),children:[e.machine?(0,G.jsxs)(G.Fragment,{children:[I(`translation.machine`),` · `]}):null,(0,G.jsx)(`button`,{type:`button`,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,onClick:()=>e.pick(e.own),children:I(`translation.showOriginal`)})]}):null}function he(e,t){let n=(0,B.useRef)(null),r=t&&!t.translating?t.translated?t.shown:null:void 0;(0,B.useEffect)(()=>{if(!e||r===void 0)return;let t=`${e}:${r}`;n.current!==t&&(n.current=t,i.post(`/api/runs/${e}/lang`,{lang:r}).catch(()=>void 0))},[e,r])}function ge(e,t){(0,B.useEffect)(()=>{if(!e||!t)return;let n=h(`/api/public/wizards/${e}`),r=[{rel:`manifest`,href:`${n}/manifest.webmanifest`},{rel:`apple-touch-icon`,href:`${n}/icons/apple-touch-icon.png`},{rel:`icon`,href:`${n}/icons/favicon.png`,type:`image/png`}].flatMap(({rel:e,href:t,type:n})=>{let r=document.querySelector(`link[rel="${e}"]`);if(!r)return[];let i={href:r.getAttribute(`href`),type:r.getAttribute(`type`)};return r.setAttribute(`href`,t),n&&r.setAttribute(`type`,n),[{link:r,before:i}]}),i=document.createElement(`meta`);return i.name=`apple-mobile-web-app-title`,i.content=t,document.head.appendChild(i),()=>{for(let{link:e,before:t}of r)for(let[n,r]of Object.entries(t))r===null?e.removeAttribute(n):e.setAttribute(n,r);i.remove()}},[e,t])}var _e=/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,X=_e||/Android/.test(navigator.userAgent);function ve(){let[e,t]=(0,B.useState)(()=>window.wizardInstall??null),[n,r]=(0,B.useState)(!1);if((0,B.useEffect)(()=>{let e=()=>t(window.wizardInstall??null);return window.addEventListener(`wizard-install`,e),()=>window.removeEventListener(`wizard-install`,e)},[]),window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0||X&&!e&&!_e)return null;let i=/Mac/.test(navigator.platform),a=I(X?`install.ios`:i?`install.bookmark.mac`:`install.bookmark.pc`);return(0,G.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{X&&e?(e.prompt(),window.wizardInstall=null,t(null)):r(e=>!e)},className:`inline-flex items-center gap-1.5 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:[X?(0,G.jsx)(oe,{className:`size-4`}):(0,G.jsx)(ae,{className:`size-4`}),I(X?`install.add`:`install.bookmark`)]}),n?(0,G.jsx)(`p`,{className:`max-w-xs leading-relaxed`,children:a}):null]})}function ye({brand:e,toggle:t=!0,start:n}){return(0,G.jsx)(`header`,{className:`safe-top`,children:(0,G.jsxs)(`div`,{className:`relative flex h-14 items-center justify-center px-5`,children:[n?(0,G.jsx)(`div`,{className:`absolute left-3`,children:n}):null,e.logoUrl?(0,G.jsx)(`img`,{src:h(e.logoUrl),alt:e.name,className:`h-7 max-w-[160px] object-contain`}):e.name?(0,G.jsx)(`span`,{className:`max-w-[60%] truncate font-display font-semibold text-[0.9375rem] text-ink-2 tracking-tight`,children:e.name}):null,t?(0,G.jsx)(`div`,{className:`absolute right-3`,children:(0,G.jsx)(A,{})}):null]})})}function be({siteKey:e,onToken:t}){let n=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let r=()=>{n.current&&window.turnstile&&!n.current.childElementCount&&window.turnstile.render(n.current,{sitekey:e,callback:t,appearance:`interaction-only`})};if(window.turnstile){r();return}let i=document.createElement(`script`);i.src=`https://challenges.cloudflare.com/turnstile/v0/api.js`,i.async=!0,i.onload=r,document.head.appendChild(i)},[e,t]),(0,G.jsx)(`div`,{ref:n,className:`mt-4 flex justify-center`})}function xe({token:e}){return!/iPhone|iPad|iPod|Android/.test(navigator.userAgent)||f||V?null:(0,G.jsxs)(`a`,{href:v(`${window.location.origin}${a}/w/${e}`),className:`mt-3 inline-flex items-center gap-1.5 text-[0.8125rem] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:[(0,G.jsx)(C,{className:`size-4`}),` `,I(`install.app`)]})}var Z=e=>`wz.run.${e}`,Se=()=>m().state?.elsewhere===!0,Ce=f&&new URLSearchParams(window.location.search).get(`start`)===`1`,Q=V===`inline`?`min-h-80`:`min-h-dvh`;function $(e,t,n){let r=d(),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(null),f=(()=>{try{return localStorage.getItem(Z(e.token))}catch{return null}})();return{busy:a,error:s,captcha:l,setCaptcha:u,start:async()=>{o(!0),c(null);try{let{runId:a}=await i.post(`/api/public/wizards/${e.token}/runs`,{turnstileToken:l??void 0,embedded:V!==null,origin:ce??void 0,lang:n??void 0});try{localStorage.setItem(Z(e.token),a)}catch{}r(`${t}/${a}`,{replace:Ce})}catch(e){c(e.message),o(!1)}},resume:f?()=>r(`${t}/${f}`):null}}function we({wizard:e,page:t}){let{busy:n,error:i,captcha:a,setCaptcha:o,start:s,resume:c}=$(e,`/w/${e.token}`,t?.translated?t.shown:null),l=Se(),u=Ce&&e.available&&!e.turnstileSiteKey,d=(0,B.useRef)(!1);return(0,B.useEffect)(()=>{u&&!d.current&&(d.current=!0,s())},[u]),u&&!i?(0,G.jsx)(`div`,{className:`flex min-h-[60dvh] items-center justify-center text-ink-4`,children:(0,G.jsx)(_,{})}):(0,G.jsxs)(`div`,{className:`mx-auto flex max-w-lg animate-rise flex-col items-center px-6 pt-6 pb-12 text-center sm:pt-16 sm:pb-16`,children:[l?(0,G.jsx)(`p`,{className:`mb-6 rounded-xl bg-paper-2 px-5 py-3 text-[0.875rem] text-ink-2`,children:I(`run.elsewhere`)}):null,(0,G.jsx)(j,{kind:e.avatar,costume:e.costume,size:190,fluffy:!0}),(0,G.jsx)(`h1`,{className:`wizard-title mt-2 text-balance font-display font-semibold text-[1.875rem] leading-[1.1] tracking-tight sm:text-[2.125rem]`,children:e.title}),e.description?(0,G.jsx)(`p`,{className:`mt-3 text-[1rem] text-ink-2 leading-relaxed`,children:e.description}):null,(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(Y,{page:t})}),e.available?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(r,{size:`lg`,className:`mt-10 min-w-48`,busy:n,disabled:!!e.turnstileSiteKey&&!a,onClick:s,children:[I(`run.start`),` `,(0,G.jsx)(p,{className:`size-4`})]}),e.turnstileSiteKey?(0,G.jsx)(be,{siteKey:e.turnstileSiteKey,onToken:o}):null,c?(0,G.jsx)(`button`,{type:`button`,onClick:c,className:`mt-4 text-[0.875rem] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:I(`run.resume`)}):null,(0,G.jsx)(Te,{wizard:e,current:`steps`}),V||f?null:(0,G.jsx)(ve,{}),(0,G.jsx)(xe,{token:e.token})]}):(0,G.jsx)(`p`,{className:`mt-10 rounded-xl bg-paper-2 px-5 py-4 text-[0.9375rem] text-ink-2`,children:e.unavailableReason??I(`run.unavailable`)}),i?(0,G.jsx)(`p`,{className:`mt-4 text-[0.875rem] text-rose`,children:i}):null]})}function Te({wizard:e,current:t}){let n=e.runners.filter(e=>e.id!==t&&e.kind===`page`&&e.url);return n.length?(0,G.jsx)(`p`,{className:`mt-4 flex flex-wrap justify-center gap-x-4 text-[0.875rem] text-ink-3`,children:n.map(e=>(0,G.jsx)(`a`,{href:e.url??void 0,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:I(`run.orAs`,{label:e.label})},e.id))}):null}function Ee({wizard:e,page:t}){let n=k();return(0,G.jsx)(`header`,{className:`safe-top shrink-0 border-border-soft border-b`,children:(0,G.jsxs)(`div`,{className:`mx-auto flex h-16 w-full max-w-[760px] items-center gap-3 pr-2 pl-4 sm:pr-4 sm:pl-6`,children:[(0,G.jsx)(`span`,{className:s(n?.speaking&&`animate-breathe`),children:(0,G.jsx)(j,{kind:e.avatar,costume:e.costume,size:38})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate font-display font-semibold text-[1rem] leading-tight tracking-tight`,children:e.title}),e.brand.name?(0,G.jsx)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:e.brand.name}):null,(0,G.jsx)(Y,{page:t,small:!0})]}),e.brand.logoUrl&&V!==`popout`?(0,G.jsx)(`img`,{src:h(e.brand.logoUrl),alt:e.brand.name,className:`h-6 max-w-[120px] object-contain max-sm:hidden`}):null,(0,G.jsx)(J,{page:t,tone:`surface`}),V?null:(0,G.jsx)(A,{}),V===`popout`?(0,G.jsx)(l,{label:I(`common.close`),onClick:le,children:(0,G.jsx)(b,{className:`size-5`})}):null]})})}function De({door:e,wizard:t,page:n,header:r,footer:i}){let{busy:a,error:o,captcha:s,setCaptcha:c,start:l,resume:u}=$(t,`/w/${t.token}/${e}`,n?.translated?n.shown:null),d=Se(),f=[];return d&&f.push({key:`elsewhere`,who:`bot`,node:I(`run.elsewhere`)}),f.push({key:`hello`,who:`bot`,node:t.description||t.title}),e!==`chat`&&f.push({key:e,who:`bot`,node:I(e===`video`?`video.hint`:`talk.joinHint`)}),t.available||f.push({key:`unavailable`,who:`bot`,node:t.unavailableReason??I(`run.unavailable`)}),o&&f.push({key:`error`,who:`bot`,node:o,tone:`error`}),t.available&&f.push(O(`start`,(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(T,{primary:!0,busy:a,disabled:!!t.turnstileSiteKey&&!s,onClick:()=>void l(),children:[I(`run.start`),` `,(0,G.jsx)(p,{className:`size-4`})]}),u?(0,G.jsx)(T,{onClick:u,children:I(`run.resume`)}):null,t.turnstileSiteKey?(0,G.jsx)(be,{siteKey:t.turnstileSiteKey,onToken:c}):null]}))),(0,G.jsxs)(D,{header:r,footer:i,children:[(0,G.jsx)(S,{avatar:t.avatar,costume:t.costume,lines:f}),(0,G.jsx)(E,{})]})}function Oe({className:e}){return(0,G.jsx)(`footer`,{className:s(`text-center text-ink-4`,e),children:(0,G.jsx)(`a`,{href:`${a}/`,target:V?`_blank`:void 0,rel:`noreferrer`,className:`inline-block hover:text-ink-2`,children:I(`run.madeWith`).replace(`engenty wizards`,M.name)})})}function ke({chat:e=!1,steps:t=!1,talk:n=!1,video:l=!1}){let{token:p,runId:m}=c(),h=d(),v=o({queryKey:[`public`,p,U],queryFn:()=>i.get(`/api/public/wizards/${p}${U}`),retry:(e,t)=>g(t)&&e<3}),y=v.data?.runners??[],b=!v.data||y.some(e=>e.id===`talk`),S=!v.data||y.some(e=>e.id===`video`),C=!v.data||y.some(e=>e.id===`chat`)||n&&b||l&&S,T=y[0]?.id,E=e||V===`popout`||!t&&!m&&C&&(T===`chat`||T===`talk`||T===`video`),D=l&&S||!t&&!e&&!n&&T===`video`,O=!D&&(n&&b||!t&&!e&&T===`talk`),k=D?`video`:O?`talk`:`chat`,A=me(v.data);he(m,A),ne(v.data?.brand.theme),ie(v.data?.avatar),ge(p,v.data?.title),ue(E);let N=A?.wizard.title??v.data?.title;(0,B.useEffect)(()=>{N&&(document.title=N)},[N]);let P=(0,B.useCallback)(e=>{try{p&&localStorage.getItem(Z(p))===m&&localStorage.removeItem(Z(p))}catch{}h(e,{replace:!0,state:{elsewhere:!0}})},[h,p,m]);if((0,B.useEffect)(()=>{p&&m&&ee(`run`,{token:p,runId:m})},[p,m]),v.isLoading)return(0,G.jsx)(`div`,{className:s(`flex items-center justify-center text-ink-4`,Q),children:(0,G.jsx)(_,{})});if(e&&v.data&&!C||n&&v.data&&!b||l&&v.data&&!S)return(0,G.jsx)(u,{to:`/w/${p}`,replace:!0});if(!v.data){let e=g(v.error);return(0,G.jsxs)(`div`,{className:s(`flex flex-col items-center justify-center gap-4 px-6 text-center`,Q),children:[(0,G.jsx)(j,{kind:`pebble`,size:80}),(0,G.jsx)(`p`,{className:`max-w-xs text-ink-3`,children:I(e?`common.offline`:`run.notFound`)}),e?(0,G.jsx)(r,{variant:`secondary`,onClick:()=>void v.refetch(),children:I(`common.retry`)}):null]})}let F=A?.wizard??v.data,L=A?.translating?(0,G.jsxs)(`div`,{className:s(`flex flex-col items-center justify-center gap-3 text-ink-3`,Q),children:[(0,G.jsx)(_,{}),(0,G.jsx)(`p`,{className:`text-[0.875rem]`,children:I(`translation.working`)})]}):null;if(E){let e=(0,G.jsx)(Ee,{wizard:F,page:A}),t=f?(0,G.jsx)(`div`,{className:`safe-bottom`}):(0,G.jsx)(Oe,{className:`pb-[max(0.375rem,env(safe-area-inset-bottom))] text-[0.6875rem]`});return(0,G.jsxs)(`div`,{className:`wizard-page flex h-dvh flex-col`,children:[(0,G.jsx)(w,{effects:v.data.brand.theme.effects}),V||f?null:(0,G.jsx)(x,{}),L??(m?(0,G.jsx)(re,{runId:m,talk:O,call:D?`video`:O?`audio`:!1,onRestart:()=>h(`/w/${p}/${k}`),onNotFound:()=>P(`/w/${p}/${k}`),header:D||O?void 0:e,footer:t}):(0,G.jsx)(De,{wizard:F,page:A,header:e,footer:t,door:k}))]})}return(0,G.jsxs)(`div`,{className:s(`wizard-page flex flex-col`,Q),children:[(0,G.jsx)(w,{effects:v.data.brand.theme.effects}),V||f?null:(0,G.jsx)(x,{}),V===`inline`||f?null:(0,G.jsx)(ye,{brand:v.data.brand,toggle:!V,start:(0,G.jsx)(J,{page:A})}),V===`inline`||f?(0,G.jsx)(`div`,{className:`flex justify-end px-3 pt-2`,children:(0,G.jsx)(J,{page:A,tone:`surface`})}):null,m&&(A?.translated||A?.failed)?(0,G.jsx)(`div`,{className:`flex justify-center px-5`,children:(0,G.jsx)(Y,{page:A})}):null,(0,G.jsx)(`div`,{className:`flex-1`,children:L??(m?(0,G.jsx)(te,{runId:m,onRestart:()=>h(`/w/${p}`),onNotFound:()=>P(`/w/${p}`)}):(0,G.jsx)(we,{wizard:F,page:A}))}),f?(0,G.jsx)(`div`,{className:`safe-bottom`}):(0,G.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[0.75rem] text-ink-4`,children:(0,G.jsx)(`a`,{href:`${a}/`,target:V?`_blank`:void 0,rel:`noreferrer`,className:`inline-block py-3.5 hover:text-ink-2`,children:I(`run.madeWith`).replace(`engenty wizards`,M.name)})})]})}export{ye as BrandHeader,ke as PublicRunner};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{$t as r,Q as i,at as a,gr as o,hn as s,hr as c,in as l,lr as u,mr as d,mt as f,nr as p,pr as m,pt as h,qt as g,un as _,vt as v,yt as ee}from"./ui-DAk_vjrL.js";import{d as y,n as b}from"./marked.esm-DQ7XA7AC.js";import{c as x}from"./read-aloud-CnFwDSGD.js";import{_ as S,b as C,d as w,f as te,g as T,h as E,m as D,n as ne,p as re,v as O,y as k}from"./theme-CkNTe-_Z.js";import{C as A,S as j,k as ie,x as M}from"./session-BMiUrqHg.js";import{J as N,a as P,l as F,s as I}from"./i18n-BaPKbQ1s.js";import{n as L}from"./LangSwitch-CJ00IgaO.js";var R={name:`bookmark`,size:24,node:[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]};R.node;var ae=y(R),z={name:`square-plus`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]],aliases:[`plus-square`]};z.node;var oe=y(z),B=e(t(),1);function se(){if(window.self===window.top)return null;let e=new URLSearchParams(window.location.search).get(`embed`);return e===`inline`||e===`modal`||e===`popout`?e:null}var V=se(),ce=V?new URLSearchParams(window.location.search).get(`page`):null,H=new URLSearchParams(window.location.search).get(`theme`),U=H?`?theme=${encodeURIComponent(H)}`:``,W=(e,t={})=>window.parent.postMessage({type:`engenty-wizard:${e}`,...t},`*`),le=()=>W(`close`);function ue(e){(0,B.useEffect)(()=>{if(V===`inline`&&!e){let e=document.documentElement;document.getElementById(`root`)?.style.setProperty(`min-height`,`0`),e.style.overflow=`hidden`;let t=new ResizeObserver(()=>W(`height`,{height:Math.ceil(e.getBoundingClientRect().height)}));return t.observe(e),()=>t.disconnect()}if(V===`modal`||V===`popout`){let e=e=>{e.key===`Escape`&&!document.querySelector(`dialog[open]`)&&W(`close`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[e])}var G=e(n(),1),K=`wizards.runner.translate`,q=new Set;function de(){try{return localStorage.getItem(K)===`on`}catch{return!1}}function fe(e){try{localStorage.setItem(K,e?`on`:`off`)}catch{}for(let e of q)e()}function pe(){return(0,B.useSyncExternalStore)(e=>(q.add(e),()=>q.delete(e)),de)}function me(e){let t=pe(),[n]=(0,B.useState)(()=>F()),r=e?.lang??`en`,a=e?.translatable&&n&&n!==r?n:null,s=a&&t?a:r,c=e?.token,l=o({queryKey:[`public-translation`,c,s],enabled:!!(c&&s!==r),queryFn:()=>i.post(`/api/public/wizards/${c}/translation${U}`,{lang:s}),staleTime:1/0,retry:!1}),u=o({queryKey:[`public-texts`,c,s],enabled:!(!c||N(s)),queryFn:()=>i.get(`/api/public/wizards/${c}/texts/${s}`),staleTime:1/0,retry:!1}),d=!N(s),f=s===r||l.data&&(!d||u.data),p=s!==r&&(l.isError||d&&u.isError),m=f&&!p?s:r,h=(0,B.useMemo)(()=>!N(m)&&u.data?.lang===m?{lang:u.data.lang,runner:u.data.runner,notes:u.data.notes}:null,[m,u.data]);if((0,B.useEffect)(()=>{e&&P(m,h)},[e,m,h]),(0,B.useEffect)(()=>()=>P(null),[]),!e)return null;let g=m!==r&&l.data?l.data:null;return{own:r,other:a,shown:m,wizard:g??e,translating:s!==r&&!f&&!p,failed:!!p,translated:!!g,machine:g?.translation?.machine??!1,pick:e=>fe(e!==r)}}function J({page:e,tone:t=`ground`}){if(!e?.other)return null;let n=e.translating?e.other:e.shown;return(0,G.jsx)(L,{langs:[e.own,e.other],value:n,onPick:e.pick,tone:t})}function Y({page:e,small:t}){if(!e)return null;let n=t?`truncate text-[0.75rem]`:`text-[0.8125rem]`;return e.failed?(0,G.jsx)(`p`,{className:s(`text-ink-3`,n),children:I(`translation.failed`)}):e.translated?(0,G.jsxs)(`p`,{className:s(`text-ink-3`,n),children:[e.machine?(0,G.jsxs)(G.Fragment,{children:[I(`translation.machine`),` · `]}):null,(0,G.jsx)(`button`,{type:`button`,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,onClick:()=>e.pick(e.own),children:I(`translation.showOriginal`)})]}):null}function he(e,t){let n=(0,B.useRef)(null),r=t&&!t.translating?t.translated?t.shown:null:void 0;(0,B.useEffect)(()=>{if(!e||r===void 0)return;let t=`${e}:${r}`;n.current!==t&&(n.current=t,i.post(`/api/runs/${e}/lang`,{lang:r}).catch(()=>void 0))},[e,r])}function ge(e,t){(0,B.useEffect)(()=>{if(!e||!t)return;let n=h(`/api/public/wizards/${e}`),r=[{rel:`manifest`,href:`${n}/manifest.webmanifest`},{rel:`apple-touch-icon`,href:`${n}/icons/apple-touch-icon.png`},{rel:`icon`,href:`${n}/icons/favicon.png`,type:`image/png`}].flatMap(({rel:e,href:t,type:n})=>{let r=document.querySelector(`link[rel="${e}"]`);if(!r)return[];let i={href:r.getAttribute(`href`),type:r.getAttribute(`type`)};return r.setAttribute(`href`,t),n&&r.setAttribute(`type`,n),[{link:r,before:i}]}),i=document.createElement(`meta`);return i.name=`apple-mobile-web-app-title`,i.content=t,document.head.appendChild(i),()=>{for(let{link:e,before:t}of r)for(let[n,r]of Object.entries(t))r===null?e.removeAttribute(n):e.setAttribute(n,r);i.remove()}},[e,t])}var _e=/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,X=_e||/Android/.test(navigator.userAgent);function ve(){let[e,t]=(0,B.useState)(()=>window.wizardInstall??null),[n,r]=(0,B.useState)(!1);if((0,B.useEffect)(()=>{let e=()=>t(window.wizardInstall??null);return window.addEventListener(`wizard-install`,e),()=>window.removeEventListener(`wizard-install`,e)},[]),window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0||X&&!e&&!_e)return null;let i=/Mac/.test(navigator.platform),a=I(X?`install.ios`:i?`install.bookmark.mac`:`install.bookmark.pc`);return(0,G.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{X&&e?(e.prompt(),window.wizardInstall=null,t(null)):r(e=>!e)},className:`inline-flex items-center gap-1.5 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:[X?(0,G.jsx)(oe,{className:`size-4`}):(0,G.jsx)(ae,{className:`size-4`}),I(X?`install.add`:`install.bookmark`)]}),n?(0,G.jsx)(`p`,{className:`max-w-xs leading-relaxed`,children:a}):null]})}function ye({brand:e,toggle:t=!0,start:n}){return(0,G.jsx)(`header`,{className:`safe-top`,children:(0,G.jsxs)(`div`,{className:`relative flex h-14 items-center justify-center px-5`,children:[n?(0,G.jsx)(`div`,{className:`absolute left-3`,children:n}):null,e.logoUrl?(0,G.jsx)(`img`,{src:h(e.logoUrl),alt:e.name,className:`h-7 max-w-[160px] object-contain`}):e.name?(0,G.jsx)(`span`,{className:`max-w-[60%] truncate font-display font-semibold text-[0.9375rem] text-ink-2 tracking-tight`,children:e.name}):null,t?(0,G.jsx)(`div`,{className:`absolute right-3`,children:(0,G.jsx)(A,{})}):null]})})}function be({siteKey:e,onToken:t}){let n=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let r=()=>{n.current&&window.turnstile&&!n.current.childElementCount&&window.turnstile.render(n.current,{sitekey:e,callback:t,appearance:`interaction-only`})};if(window.turnstile){r();return}let i=document.createElement(`script`);i.src=`https://challenges.cloudflare.com/turnstile/v0/api.js`,i.async=!0,i.onload=r,document.head.appendChild(i)},[e,t]),(0,G.jsx)(`div`,{ref:n,className:`mt-4 flex justify-center`})}function xe({token:e}){return!/iPhone|iPad|iPod|Android/.test(navigator.userAgent)||f||V?null:(0,G.jsxs)(`a`,{href:v(`${window.location.origin}${a}/w/${e}`),className:`mt-3 inline-flex items-center gap-1.5 text-[0.8125rem] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:[(0,G.jsx)(C,{className:`size-4`}),` `,I(`install.app`)]})}var Z=e=>`wz.run.${e}`,Se=()=>m().state?.elsewhere===!0,Ce=f&&new URLSearchParams(window.location.search).get(`start`)===`1`,Q=V===`inline`?`min-h-80`:`min-h-dvh`;function $(e,t,n){let r=d(),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(null),f=(()=>{try{return localStorage.getItem(Z(e.token))}catch{return null}})();return{busy:a,error:s,captcha:l,setCaptcha:u,start:async()=>{o(!0),c(null);try{let{runId:a}=await i.post(`/api/public/wizards/${e.token}/runs`,{turnstileToken:l??void 0,embedded:V!==null,origin:ce??void 0,lang:n??void 0});try{localStorage.setItem(Z(e.token),a)}catch{}r(`${t}/${a}`,{replace:Ce})}catch(e){c(e.message),o(!1)}},resume:f?()=>r(`${t}/${f}`):null}}function we({wizard:e,page:t}){let{busy:n,error:i,captcha:a,setCaptcha:o,start:s,resume:c}=$(e,`/w/${e.token}`,t?.translated?t.shown:null),l=Se(),u=Ce&&e.available&&!e.turnstileSiteKey,d=(0,B.useRef)(!1);return(0,B.useEffect)(()=>{u&&!d.current&&(d.current=!0,s())},[u]),u&&!i?(0,G.jsx)(`div`,{className:`flex min-h-[60dvh] items-center justify-center text-ink-4`,children:(0,G.jsx)(_,{})}):(0,G.jsxs)(`div`,{className:`mx-auto flex max-w-lg animate-rise flex-col items-center px-6 pt-6 pb-12 text-center sm:pt-16 sm:pb-16`,children:[l?(0,G.jsx)(`p`,{className:`mb-6 rounded-xl bg-paper-2 px-5 py-3 text-[0.875rem] text-ink-2`,children:I(`run.elsewhere`)}):null,(0,G.jsx)(j,{kind:e.avatar,costume:e.costume,size:190,fluffy:!0}),(0,G.jsx)(`h1`,{className:`wizard-title mt-2 text-balance font-display font-semibold text-[1.875rem] leading-[1.1] tracking-tight sm:text-[2.125rem]`,children:e.title}),e.description?(0,G.jsx)(`p`,{className:`mt-3 text-[1rem] text-ink-2 leading-relaxed`,children:e.description}):null,(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(Y,{page:t})}),e.available?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(r,{size:`lg`,className:`mt-10 min-w-48`,busy:n,disabled:!!e.turnstileSiteKey&&!a,onClick:s,children:[I(`run.start`),` `,(0,G.jsx)(p,{className:`size-4`})]}),e.turnstileSiteKey?(0,G.jsx)(be,{siteKey:e.turnstileSiteKey,onToken:o}):null,c?(0,G.jsx)(`button`,{type:`button`,onClick:c,className:`mt-4 text-[0.875rem] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:I(`run.resume`)}):null,(0,G.jsx)(Te,{wizard:e,current:`steps`}),V||f?null:(0,G.jsx)(ve,{}),(0,G.jsx)(xe,{token:e.token})]}):(0,G.jsx)(`p`,{className:`mt-10 rounded-xl bg-paper-2 px-5 py-4 text-[0.9375rem] text-ink-2`,children:e.unavailableReason??I(`run.unavailable`)}),i?(0,G.jsx)(`p`,{className:`mt-4 text-[0.875rem] text-rose`,children:i}):null]})}function Te({wizard:e,current:t}){let n=e.runners.filter(e=>e.id!==t&&e.kind===`page`&&e.url);return n.length?(0,G.jsx)(`p`,{className:`mt-4 flex flex-wrap justify-center gap-x-4 text-[0.875rem] text-ink-3`,children:n.map(e=>(0,G.jsx)(`a`,{href:e.url??void 0,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:I(`run.orAs`,{label:e.label})},e.id))}):null}function Ee({wizard:e,page:t}){let n=k();return(0,G.jsx)(`header`,{className:`safe-top shrink-0 border-border-soft border-b`,children:(0,G.jsxs)(`div`,{className:`mx-auto flex h-16 w-full max-w-[760px] items-center gap-3 pr-2 pl-4 sm:pr-4 sm:pl-6`,children:[(0,G.jsx)(`span`,{className:s(n?.speaking&&`animate-breathe`),children:(0,G.jsx)(j,{kind:e.avatar,costume:e.costume,size:38})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate font-display font-semibold text-[1rem] leading-tight tracking-tight`,children:e.title}),e.brand.name?(0,G.jsx)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:e.brand.name}):null,(0,G.jsx)(Y,{page:t,small:!0})]}),e.brand.logoUrl&&V!==`popout`?(0,G.jsx)(`img`,{src:h(e.brand.logoUrl),alt:e.brand.name,className:`h-6 max-w-[120px] object-contain max-sm:hidden`}):null,(0,G.jsx)(J,{page:t,tone:`surface`}),V?null:(0,G.jsx)(A,{}),V===`popout`?(0,G.jsx)(l,{label:I(`common.close`),onClick:le,children:(0,G.jsx)(b,{className:`size-5`})}):null]})})}function De({door:e,wizard:t,page:n,header:r,footer:i}){let{busy:a,error:o,captcha:s,setCaptcha:c,start:l,resume:u}=$(t,`/w/${t.token}/${e}`,n?.translated?n.shown:null),d=Se(),f=[];return d&&f.push({key:`elsewhere`,who:`bot`,node:I(`run.elsewhere`)}),f.push({key:`hello`,who:`bot`,node:t.description||t.title}),e!==`chat`&&f.push({key:e,who:`bot`,node:I(e===`video`?`video.hint`:`talk.joinHint`)}),t.available||f.push({key:`unavailable`,who:`bot`,node:t.unavailableReason??I(`run.unavailable`)}),o&&f.push({key:`error`,who:`bot`,node:o,tone:`error`}),t.available&&f.push(O(`start`,(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(T,{primary:!0,busy:a,disabled:!!t.turnstileSiteKey&&!s,onClick:()=>void l(),children:[I(`run.start`),` `,(0,G.jsx)(p,{className:`size-4`})]}),u?(0,G.jsx)(T,{onClick:u,children:I(`run.resume`)}):null,t.turnstileSiteKey?(0,G.jsx)(be,{siteKey:t.turnstileSiteKey,onToken:c}):null]}))),(0,G.jsxs)(D,{header:r,footer:i,children:[(0,G.jsx)(S,{avatar:t.avatar,costume:t.costume,lines:f}),(0,G.jsx)(E,{})]})}function Oe({className:e}){return(0,G.jsx)(`footer`,{className:s(`text-center text-ink-4`,e),children:(0,G.jsx)(`a`,{href:`${a}/`,target:V?`_blank`:void 0,rel:`noreferrer`,className:`inline-block hover:text-ink-2`,children:I(`run.madeWith`).replace(`engenty wizards`,M.name)})})}function ke({chat:e=!1,steps:t=!1,talk:n=!1,video:l=!1}){let{token:p,runId:m}=c(),h=d(),v=o({queryKey:[`public`,p,U],queryFn:()=>i.get(`/api/public/wizards/${p}${U}`),retry:(e,t)=>g(t)&&e<3}),y=v.data?.runners??[],b=!v.data||y.some(e=>e.id===`talk`),S=!v.data||y.some(e=>e.id===`video`),C=!v.data||y.some(e=>e.id===`chat`)||n&&b||l&&S,T=y[0]?.id,E=e||V===`popout`||!t&&!m&&C&&(T===`chat`||T===`talk`||T===`video`),D=l&&S||!t&&!e&&!n&&T===`video`,O=!D&&(n&&b||!t&&!e&&T===`talk`),k=D?`video`:O?`talk`:`chat`,A=me(v.data);he(m,A),ne(v.data?.brand.theme),ie(v.data?.avatar),ge(p,v.data?.title),ue(E);let N=A?.wizard.title??v.data?.title;(0,B.useEffect)(()=>{N&&(document.title=N)},[N]);let P=(0,B.useCallback)(e=>{try{p&&localStorage.getItem(Z(p))===m&&localStorage.removeItem(Z(p))}catch{}h(e,{replace:!0,state:{elsewhere:!0}})},[h,p,m]);if((0,B.useEffect)(()=>{p&&m&&ee(`run`,{token:p,runId:m})},[p,m]),v.isLoading)return(0,G.jsx)(`div`,{className:s(`flex items-center justify-center text-ink-4`,Q),children:(0,G.jsx)(_,{})});if(e&&v.data&&!C||n&&v.data&&!b||l&&v.data&&!S)return(0,G.jsx)(u,{to:`/w/${p}`,replace:!0});if(!v.data){let e=g(v.error);return(0,G.jsxs)(`div`,{className:s(`flex flex-col items-center justify-center gap-4 px-6 text-center`,Q),children:[(0,G.jsx)(j,{kind:`pebble`,size:80}),(0,G.jsx)(`p`,{className:`max-w-xs text-ink-3`,children:I(e?`common.offline`:`run.notFound`)}),e?(0,G.jsx)(r,{variant:`secondary`,onClick:()=>void v.refetch(),children:I(`common.retry`)}):null]})}let F=A?.wizard??v.data,L=A?.translating?(0,G.jsxs)(`div`,{className:s(`flex flex-col items-center justify-center gap-3 text-ink-3`,Q),children:[(0,G.jsx)(_,{}),(0,G.jsx)(`p`,{className:`text-[0.875rem]`,children:I(`translation.working`)})]}):null;if(E){let e=(0,G.jsx)(Ee,{wizard:F,page:A}),t=f?(0,G.jsx)(`div`,{className:`safe-bottom`}):(0,G.jsx)(Oe,{className:`pb-[max(0.375rem,env(safe-area-inset-bottom))] text-[0.6875rem]`});return(0,G.jsxs)(`div`,{className:`wizard-page flex h-dvh flex-col`,children:[(0,G.jsx)(w,{effects:v.data.brand.theme.effects}),V||f?null:(0,G.jsx)(x,{}),L??(m?(0,G.jsx)(re,{runId:m,talk:O,call:D?`video`:O?`audio`:!1,onRestart:()=>h(`/w/${p}/${k}`),onNotFound:()=>P(`/w/${p}/${k}`),header:D||O?void 0:e,footer:t}):(0,G.jsx)(De,{wizard:F,page:A,header:e,footer:t,door:k}))]})}return(0,G.jsxs)(`div`,{className:s(`wizard-page flex flex-col`,Q),children:[(0,G.jsx)(w,{effects:v.data.brand.theme.effects}),V||f?null:(0,G.jsx)(x,{}),V===`inline`||f?null:(0,G.jsx)(ye,{brand:v.data.brand,toggle:!V,start:(0,G.jsx)(J,{page:A})}),V===`inline`||f?(0,G.jsx)(`div`,{className:`flex justify-end px-3 pt-2`,children:(0,G.jsx)(J,{page:A,tone:`surface`})}):null,m&&(A?.translated||A?.failed)?(0,G.jsx)(`div`,{className:`flex justify-center px-5`,children:(0,G.jsx)(Y,{page:A})}):null,(0,G.jsx)(`div`,{className:`flex-1`,children:L??(m?(0,G.jsx)(te,{runId:m,onRestart:()=>h(`/w/${p}`),onNotFound:()=>P(`/w/${p}`)}):(0,G.jsx)(we,{wizard:F,page:A}))}),f?(0,G.jsx)(`div`,{className:`safe-bottom`}):(0,G.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[0.75rem] text-ink-4`,children:(0,G.jsx)(`a`,{href:`${a}/`,target:V?`_blank`:void 0,rel:`noreferrer`,className:`inline-block py-3.5 hover:text-ink-2`,children:I(`run.madeWith`).replace(`engenty wizards`,M.name)})})]})}export{ye as BrandHeader,ke as PublicRunner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./jsx-runtime-BNakU3Ej.js";import{d as n}from"./marked.esm-DQ7XA7AC.js";import{Rn as r}from"./host-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./jsx-runtime-BNakU3Ej.js";import{d as n}from"./marked.esm-DQ7XA7AC.js";import{Rn as r}from"./host-D6H6Z9Jp.js";import{s as i}from"./i18n-BaPKbQ1s.js";var a={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`]};a.node;var o=n(a),s=e(t(),1);function c(e){return i(e.origin===`local`?`readonly.space`:`readonly.server`)}function l({children:e}){return(0,s.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-amber-tint px-4 py-3 font-medium text-[0.875rem] text-ink leading-relaxed`,children:[(0,s.jsx)(r,{className:`mt-0.5 size-4 shrink-0 text-amber`}),(0,s.jsx)(`p`,{className:`min-w-0`,children:e})]})}export{c as n,o as r,l as t};
|