wizards 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/runtime/dist/docs/user/test-and-share.md +21 -11
- package/apps/runtime/dist/routes/studio.js +15 -2
- package/apps/runtime/dist/services/wizards.js +25 -0
- package/apps/web/dist/assets/{AboutDialog-D1N4-3FE.js → AboutDialog-Dz_tYBSU.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-VEBTlC3f.js → ChangelogDialog-m2M7gZiB.js} +1 -1
- package/apps/web/dist/assets/{ChatView-DSRUEpb6.js → ChatView-D21o-lq8.js} +2 -2
- package/apps/web/dist/assets/EditorPage-D6j3dQpu.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-86xWWfdk.js → FlowPreview-BdRy7FO7.js} +1 -1
- package/apps/web/dist/assets/{Harness-CF6H2TYJ.js → Harness-DmJkTwOO.js} +1 -1
- package/apps/web/dist/assets/{Marketplace-C-Vz3yEk.js → Marketplace-B-gy2onK.js} +2 -2
- package/apps/web/dist/assets/{NewWizardChannels-Cc7gDitg.js → NewWizardChannels-B3FEpsJ-.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-sY5q-l99.js → NewWizardPage-CT1lThNM.js} +1 -1
- package/apps/web/dist/assets/{ProjectPage-iSdpJAZS.js → ProjectPage-BIanCF0m.js} +2 -2
- package/apps/web/dist/assets/{PublicRunner-BgRXMUxS.js → PublicRunner-H1fXa9BK.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly-mhKW496R.js → ReadOnly-CaGzgOPe.js} +1 -1
- package/apps/web/dist/assets/{RunDrawer-B0gJzdxH.js → RunDrawer-8sjkAbm5.js} +1 -1
- package/apps/web/dist/assets/{RunnerView-CTRFgyu5.js → RunnerView-CJ4cLA_0.js} +1 -1
- package/apps/web/dist/assets/{SettingsPage-CBF8i6j6.js → SettingsPage-BsdwE1OA.js} +1 -1
- package/apps/web/dist/assets/{SetupPage-Fpz9aSLN.js → SetupPage-sqrv7Auf.js} +1 -1
- package/apps/web/dist/assets/{SharePage-Dv3Csh4A.js → SharePage-B6ets1ot.js} +1 -1
- package/apps/web/dist/assets/{brand-BamUjXVr.js → brand-BRw18WJF.js} +1 -1
- package/apps/web/dist/assets/changelog-BOFdRjx2.js +1 -0
- package/apps/web/dist/assets/{circle-alert-CYs622_r.js → circle-alert-CpuMIhbH.js} +1 -1
- package/apps/web/dist/assets/{esm-B52LIMhP.js → esm-DRaZAcXQ.js} +1 -1
- package/apps/web/dist/assets/{index-CDdJDojq.css → index-DY9CslcT.css} +1 -1
- package/apps/web/dist/assets/{index-Bdx1Qity.js → index-DkDBEMwz.js} +4 -4
- package/apps/web/dist/assets/{lock-BvSWZOin.js → lock-BGotwAyN.js} +1 -1
- package/apps/web/dist/assets/{phone-CI2Flerg.js → phone-CA2A8W7I.js} +1 -1
- package/apps/web/dist/assets/{session-BEHF6g4Y.js → session-DBOQL_bg.js} +1 -1
- package/apps/web/dist/assets/{settings-menu-BOOPxcJH.js → settings-menu-DxswVOqQ.js} +1 -1
- package/apps/web/dist/assets/{ui-CMdSOoUZ.js → ui-DAHMnAVc.js} +1 -1
- package/apps/web/dist/assets/{upload-Cz9HgBT9.js → upload-DLbJVvfd.js} +1 -1
- package/apps/web/dist/assets/{volume-2-CyQuz1nn.js → volume-2-KaKQ4zMJ.js} +1 -1
- package/apps/web/dist/index.html +7 -7
- package/apps/web/dist/mcp/flow.html +2 -2
- package/node_modules/@engenty-wizards/shared/dist/changes.d.ts +22 -0
- package/node_modules/@engenty-wizards/shared/dist/changes.js +61 -0
- package/node_modules/@engenty-wizards/shared/dist/definition.d.ts +8 -8
- package/node_modules/@engenty-wizards/shared/dist/marketplace.d.ts +1 -1
- package/node_modules/@engenty-wizards/shared/dist/wizard-package.d.ts +1 -1
- package/package.json +1 -1
- package/apps/web/dist/assets/EditorPage-UkaHDklX.js +0 -3
- package/apps/web/dist/assets/changelog-ViHoNW7e.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowPreview-
|
|
2
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{n,t as r}from"./jsx-runtime-BNakU3Ej.js";import{O as i,a,c as o,i as s,r as c,s as l,v as u}from"./logo-C4V2_3Ar.js";import{t as d}from"./useMutation-DKyQXgyj.js";import{t as f}from"./preload-helper-CNEI7N0N.js";import{Dt as p,Gt as m,Kt as h,Mt as g,Tt as _,Ut as v,Xt as y,an as ee,bt as b,dn as x,dt as S,ft as te,in as ne,jt as C,kt as w,l as T,lt as E,on as D,tn as O,ut as k,yn as A}from"./ui-CMdSOoUZ.js";import{l as j,r as re}from"./brand-BamUjXVr.js";import{t as ie}from"./volume-2-CyQuz1nn.js";import{l as ae,u as oe}from"./engenty-eXZ-EAwd.js";import{d as se,s as ce}from"./session-BEHF6g4Y.js";var le=class extends a{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:s,isRefetchError:c}=r,u=n.fetchMeta?.fetchMore?.direction,d=s&&u===`forward`,f=i&&u===`forward`,p=s&&u===`backward`,m=i&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:l(t,n.data),hasPreviousPage:o(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:c&&!d&&!p,isRefetching:a&&!f&&!m}}};function ue(e,t){return s(e,le,t)}var de={name:`app-window`,size:24,node:[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]};de.node;var M=x(de),fe={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};fe.node;var N=x(fe),pe={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};pe.node;var me=x(pe),he={name:`circle-dollar-sign`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]};he.node;var ge=x(he),_e={name:`circle-euro`,size:24,node:[[`path`,{d:`M15 9.4a4 4 0 1 0 0 5.2`,key:`1makmb`}],[`path`,{d:`M7 12h5`,key:`gblrwe`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};_e.node;var ve=x(_e),ye={name:`clapperboard`,size:24,node:[[`path`,{d:`m12.296 3.464 3.02 3.956`,key:`qash78`}],[`path`,{d:`M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z`,key:`1h7j8b`}],[`path`,{d:`M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`4lm6w1`}],[`path`,{d:`m6.18 5.276 3.1 3.899`,key:`zjj9t3`}]]};ye.node;var P=x(ye),be={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};be.node;var xe=x(be),Se={name:`coins`,size:24,node:[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]};Se.node;var Ce=x(Se),we={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};we.node;var F=x(we),Te={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};Te.node;var Ee=x(Te),De={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};De.node;var Oe=x(De),ke={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};ke.node;var I=x(ke),Ae={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};Ae.node;var je=x(Ae),Me={name:`layout-template`,size:24,node:[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]};Me.node;var Ne=x(Me),Pe={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};Pe.node;var L=x(Pe),Fe={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]};Fe.node;var Ie=x(Fe),Le={name:`puzzle`,size:24,node:[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]};Le.node;var Re=x(Le),ze={name:`scan-text`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 8h8`,key:`1jbsf9`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`path`,{d:`M7 16h6`,key:`1vyc9m`}]]};ze.node;var Be=x(ze),Ve={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Ve.node;var He=x(Ve),Ue={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};Ue.node;var R=x(Ue),We={name:`table-2`,size:24,node:[[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]};We.node;var Ge=x(We),Ke={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};Ke.node;var qe=x(Ke),Je={name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]};Je.node;var Ye=x(Je),Xe={name:`wand-sparkles`,size:24,node:[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]],aliases:[`wand-2`]};Xe.node;var z=x(Xe),B={text:{de:`Text`,en:`Text`},document:{de:`Dokument (PDF, Word)`,en:`Document (PDF, Word)`},table:{de:`Tabelle`,en:`Table`},image:{de:`Bild`,en:`Image`},video:{de:`Video`,en:`Video`},audio:{de:`Audio`,en:`Audio`},dashboard:{de:`Dashboard`,en:`Dashboard`}},Ze={any:{de:`Jede Branche`,en:`Any industry`},trades:{de:`Handwerk`,en:`Trades`},gastronomy:{de:`Gastronomie`,en:`Food service`},hospitality:{de:`Hotel & Tourismus`,en:`Hotels & tourism`},realEstate:{de:`Immobilien`,en:`Real estate`},retail:{de:`Handel`,en:`Retail`},health:{de:`Gesundheit`,en:`Health`},professional:{de:`Kanzlei & Beratung`,en:`Professional services`},agency:{de:`Agentur & Marketing`,en:`Agency & marketing`},events:{de:`Veranstaltungen`,en:`Events`},publicSector:{de:`Vereine & Öffentliches`,en:`Associations & public sector`}},Qe={marketing:{de:`Marketing & Social Media`,en:`Marketing & social media`},sales:{de:`Angebote & Verkauf`,en:`Offers & sales`},accounting:{de:`Buchhaltung & Belege`,en:`Accounting & receipts`},service:{de:`Kundenservice`,en:`Customer service`},research:{de:`Recherche & Analyse`,en:`Research & analysis`},hr:{de:`Personal & Bewerbungen`,en:`HR & applications`},operations:{de:`Planung & Abläufe`,en:`Planning & operations`},website:{de:`Helfer für die Website`,en:`Website helpers`},visuals:{de:`Bilder & Video`,en:`Images & video`},inquiries:{de:`Anfragen & Termine`,en:`Inquiries & bookings`},advice:{de:`Beratung & Preise`,en:`Advice & pricing`}},V={text:{de:`Text schreiben`,en:`Writes text`},web:{de:`Websuche`,en:`Web search`},browser:{de:`Browser bedienen`,en:`Drives a browser`},documents:{de:`Dokumente & Fotos lesen`,en:`Reads documents & photos`},image:{de:`Bilder erzeugen`,en:`Makes images`},video:{de:`Videos erzeugen`,en:`Makes video`},speech:{de:`Sprachausgabe`,en:`Speech output`},listening:{de:`Sprachnotizen verstehen`,en:`Understands voice notes`},code:{de:`Code ausführen`,en:`Runs code`},connectors:{de:`Verbundene Konten & Systeme`,en:`Connected accounts & systems`},film:{de:`Filme mit Claude Code (auf deinem Abo)`,en:`Films with Claude Code (on your subscription)`}},$e={low:{de:`günstig`,en:`low cost`},medium:{de:`mittel`,en:`medium cost`},high:{de:`teuer`,en:`high cost`}},et={free:{de:`Kostenlos`,en:`Free`},pro:{de:`Pro`,en:`Pro`}},H=e=>Object.keys(e);H(B),H(Ze),H(Qe),H(V),H(et);var U=t(n(),1);function tt(e){switch(e.type){case`page`:return L;case`agent`:return N;case`generate`:return e.asset===`image`?I:e.asset===`video`?g:e.asset===`dashboard`?je:y;case`widget`:return M;case`surface`:return Ne;case`film`:return P;case`review`:return F;case`result`:return Ee}return z}var nt={page:`bg-cobalt-tint text-cobalt`,agent:`bg-ember-tint text-ember-strong`,generate:`bg-amber-tint text-ink-2`,widget:`bg-ember-veil text-ember-strong`,surface:`bg-ember-veil text-ember-strong`,film:`bg-amber-tint text-ink-2`,review:`bg-moss-tint text-moss`,result:`bg-paper-2 text-ink-2`};function rt(e){return w(`type.${e.type}`)}var it=[`web_search`,`web_fetch`,`browser`,`sandbox`,`image`,`http`,`pages`];function at(e){return it.includes(e)?w(`tool.${e}`):e}function ot(e){switch(e.type){case`page`:return e.fields.map(e=>e.label).join(` · `);case`agent`:{let t=e.tools.map(at),n=e.mcp?.length?[`MCP: ${e.mcp.join(`, `)}`]:[];return[...t,...n].join(` · `)||e.instructions.slice(0,90)}case`generate`:{let t=[e.asset];return e.options?.aspectRatio&&t.push(e.options.aspectRatio),e.options?.duration&&t.push(`${e.options.duration}s`),e.options?.resolution&&t.push(e.options.resolution),e.options?.template&&t.push(e.options.template),t.join(` · `)}case`widget`:return[e.entry,Object.keys(e.data).join(`, `)].filter(Boolean).join(` · `);case`surface`:return e.candidates?e.candidates.map(e=>e.id).join(` · `):Object.keys(e.data).join(`, `);case`film`:return[e.format,e.seconds?`${e.seconds}s`:null,e.skills.join(`, `)].filter(Boolean).join(` · `);case`review`:return[e.edit?w(`editor.reviewEditable`):null,e.regenerate?w(`editor.reviewRedo`):null].filter(Boolean).join(` · `);case`result`:return e.deliverables.map(e=>`${e.label??e.from} (${e.formats.join(`, `)})`).join(` · `)}return``}var st=e({EntryDialog:()=>Q,MarketplaceBrowser:()=>Et,MarketplaceCards:()=>Tt,MarketplaceHits:()=>wt,ProChip:()=>mt,useSettled:()=>$}),W=t(r(),1),ct=(0,U.lazy)(()=>f(()=>import(`./FlowPreview-86xWWfdk.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),lt={useCase:``,industry:``,format:``,capability:``,plan:``},G=(e,t)=>e[t]?.[p]??t;function ut(e){if(e<1)return 1;let t=10**Math.floor(Math.log10(e));return Math.round(e/t)*t}function dt(e){return e.credits?w(`market.credits`,{n:ut(e.credits.credits)}):$e[e.costTier][p]}var ft={text:Ye,document:y,table:Ge,image:I,video:g,audio:D,dashboard:me};function K({format:e,className:t}){let n=ft[e],r=G(B,e);return(0,W.jsx)(`span`,{title:r,className:`inline-flex`,children:(0,W.jsx)(n,{className:t,"aria-label":r,role:`img`})})}var pt=[`low`,`medium`,`high`];function q({entry:e}){let t=pt.indexOf(e.costTier)+1,n=p===`de`?ve:ge;return(0,W.jsxs)(`span`,{title:dt(e),className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0`,children:pt.slice(0,t).map((e,t)=>(0,W.jsx)(`span`,{className:_(`rounded-full bg-(--coin-bg,var(--color-card))`,t>0&&`-ml-1.5`),children:(0,W.jsx)(n,{className:`size-4`})},e))}),$e[e.costTier][p]]})}function mt(){return(0,W.jsx)(S,{tone:`ember`,title:w(`market.proHint`),children:w(`market.pro`)})}function ht({plugin:e}){return(0,W.jsx)(S,{icon:(0,W.jsx)(Re,{className:`size-3.5`}),title:w(`market.fromPlugin`,{name:e.name}),children:e.name})}function gt({entry:e,onOpen:t}){return(0,W.jsxs)(k,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},className:_(`relative flex min-h-[124px] cursor-pointer flex-col gap-5 p-4 text-left transition sm:min-h-[136px] sm:p-5 hover:shadow-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,(!e.usable||e.missing.length>0||!!e.needs?.length)&&`opacity-60`),children:[(0,W.jsx)(`span`,{className:`-top-4 pointer-events-none absolute right-4`,children:(0,W.jsx)(re,{kind:e.avatar,size:68})}),(0,W.jsxs)(`div`,{className:`min-w-0 pr-20`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 font-display font-semibold text-[0.9375rem]`,children:[e.title,e.plan===`pro`?(0,W.jsx)(mt,{}):null,e.starred?(0,W.jsx)(R,{className:`size-3.5 shrink-0 fill-amber text-amber`,"aria-label":w(`market.starred`)}):null]}),(0,W.jsx)(`div`,{className:`mt-0.5 text-[0.8125rem] text-ink-3 leading-snug`,children:e.pitch})]}),(0,W.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[0.75rem] text-ink-3`,children:[e.plugin?(0,W.jsx)(ht,{plugin:e.plugin}):null,e.needs?.length?(0,W.jsx)(S,{tone:`warn`,children:w(`market.needsPro`,{list:e.needs.join(`, `)})}):e.usable&&e.missing.length?(0,W.jsx)(S,{tone:`warn`,children:w(`market.missing`,{list:Y(e.missing)})}):e.usable?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(O,{className:`size-3.5`}),` `,w(`market.minutes`,{n:e.effort.minutes})]}),(0,W.jsx)(q,{entry:e}),e.optional?.length?(0,W.jsx)(S,{title:w(`market.optionalHint`,{list:Y(e.optional)}),children:w(`market.without`,{list:Y(e.optional)})}):null,(0,W.jsx)(`span`,{className:`ml-auto inline-flex items-center gap-1.5`,children:e.formats.map(e=>(0,W.jsx)(K,{format:e,className:`size-4`},e))})]}):(0,W.jsx)(S,{tone:`warn`,children:w(`market.needsUpdate`)})]})]})}function J({title:e,children:t}){return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`mb-1.5 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:e}),t]})}var Y=e=>e.map(e=>G(V,e)).join(`, `),_t={text:v,web:Oe,browser:m,documents:Be,image:I,video:g,speech:ie,listening:h,code:qe,connectors:Ie,film:P};function vt(e){switch(e.type){case`page`:return L;case`agent`:return N;case`generate`:return e.asset===`image`?I:e.asset===`video`?g:e.asset===`voice`?ie:e.asset===`dashboard`?me:y;case`widget`:return e.video?P:M;case`surface`:return M;case`film`:return P;case`review`:return F;case`result`:return Ee}return z}function yt(e){let t=new Set;for(let[n,r]of e.entries())for(let i of r.branches??[]){let r=i.to===`end`?e.length:e.findIndex(e=>e.id===i.to);for(let i=n+1;i<r;i++)t.add(e[i].id)}return t}function bt(e){let t=yt(e);return e.map(e=>({id:e.id,title:e.title,icon:vt(e),tone:nt[e.type]??`bg-paper-2 text-ink-2`,optional:t.has(e.id),branches:e.branches}))}function X({title:e,children:t}){return(0,W.jsx)(`span`,{title:e,className:`inline-flex items-center gap-2 border-border border-l px-4 first:border-l-0 first:pl-0`,children:t})}function Z({icon:e,children:t,more:n}){return(0,W.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,W.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:e}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`div`,{className:`text-[0.875rem] text-ink leading-snug`,children:t}),n?(0,W.jsx)(`div`,{className:`text-[0.75rem] text-ink-3 leading-snug`,children:n}):null]})]})}function xt({className:e,children:t}){let n=(0,U.useRef)(null),[r,i]=(0,U.useState)({above:!1,below:!1});(0,U.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{let t=e.scrollTop>1,n=e.scrollTop+e.clientHeight<e.scrollHeight-1;i(e=>e.above===t&&e.below===n?e:{above:t,below:n})};t(),e.addEventListener(`scroll`,t,{passive:!0});let r=new ResizeObserver(t);return r.observe(e),e.firstElementChild&&r.observe(e.firstElementChild),()=>{e.removeEventListener(`scroll`,t),r.disconnect()}},[]);let a=`linear-gradient(to bottom, ${r.above?`transparent`:`black`} 0, black 28px, black calc(100% - 44px), ${r.below?`transparent`:`black`} 100%)`;return(0,W.jsx)(`div`,{ref:n,className:e,style:{maskImage:a,WebkitMaskImage:a},children:(0,W.jsx)(`div`,{children:t})})}function Q({id:e,fallback:t,onClose:n,onUse:r,busy:a}){let o=i(),s=A(),l=c({queryKey:[`marketplace-entry`,e,p],queryFn:()=>T.get(`/api/studio/marketplace/${encodeURIComponent(e)}?lang=${p}`),enabled:!!e,retry:!1}),u=l.data??t,f=d({mutationFn:t=>{let n=`/api/studio/marketplace/${encodeURIComponent(e)}/star`;return t?T.put(n):T.del(n)},onSuccess:()=>Promise.all([o.invalidateQueries({queryKey:[`marketplace`]}),o.invalidateQueries({queryKey:[`marketplace-entry`,e]})])}),m=j()===`dark`,h=ae[oe[u?.avatar||`round`]],g=m?`var(--card)`:`color-mix(in oklch, ${h??`var(--ink-4)`} 14%, var(--paper-2))`;return(0,W.jsx)(te,{open:!!e,onClose:n,wide:!0,bare:!0,children:u?(0,W.jsxs)(`div`,{className:`relative flex max-h-[calc(100dvh-48px)] flex-col rounded-2xl bg-card shadow-overlay max-sm:h-dvh max-sm:max-h-none max-sm:rounded-none`,children:[(0,W.jsx)(`button`,{type:`button`,"aria-label":w(`common.close`),onClick:n,className:`sm:-top-3.5 sm:-right-3.5 absolute top-3 right-3 z-20 flex size-9 items-center justify-center rounded-full bg-card text-ink-2 shadow-elevated ring-1 ring-border-soft transition hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,children:(0,W.jsx)(C,{className:`size-4`})}),(0,W.jsxs)(`header`,{className:`relative shrink-0 border-border-soft border-b px-5 pt-5 pb-4 text-ink sm:rounded-t-2xl sm:px-7`,style:{background:g,"--coin-bg":g},children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 overflow-hidden sm:rounded-t-2xl`,children:(0,W.jsx)(`span`,{className:_(`-top-28 -right-10 absolute size-80 rounded-full bg-white blur-3xl`,m?`opacity-[0.14]`:`opacity-80`)})}),(0,W.jsx)(`div`,{className:`-bottom-5 absolute right-9 z-10 max-sm:hidden`,children:(0,W.jsx)(re,{kind:u.avatar,size:104})}),(0,W.jsxs)(`div`,{className:`relative sm:pr-36`,children:[(0,W.jsx)(`h2`,{className:`font-display font-semibold text-[1.375rem] leading-tight tracking-tight max-sm:pr-10`,children:u.title}),(0,W.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-2 leading-snug`,children:l.data?.description||u.pitch})]}),u.usable?(0,W.jsxs)(`div`,{className:`-mx-5 sm:-mx-7 relative mt-3.5 flex flex-wrap items-center gap-y-2 border-border-soft border-t px-5 pt-3 font-medium text-[0.875rem] sm:px-7 sm:pr-40`,children:[(0,W.jsxs)(X,{title:w(`market.duration`),children:[(0,W.jsx)(O,{className:`size-4 text-ink-3`}),w(`market.minutes`,{n:u.effort.minutes})]}),(0,W.jsx)(X,{title:w(`market.cost`),children:(0,W.jsx)(q,{entry:u})}),(0,W.jsx)(X,{title:w(`market.result`),children:u.formats.map(e=>(0,W.jsx)(K,{format:e,className:`size-4`},e))})]}):null]}),u.usable?(0,W.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-x-7 gap-y-6 px-5 pt-6 max-sm:overflow-y-auto max-sm:pb-4 sm:grid-cols-[230px_minmax(0,1fr)] sm:grid-rows-[minmax(0,1fr)] sm:px-7`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col gap-5 sm:min-h-0 sm:overflow-y-auto`,children:[(0,W.jsx)(J,{title:w(`market.duration`),children:(0,W.jsx)(Z,{icon:(0,W.jsx)(O,{className:`size-4 text-moss`}),more:w(`market.durationHint`,{n:u.effort.fields}),children:w(`market.minutes`,{n:u.effort.minutes})})}),(0,W.jsx)(J,{title:w(`market.cost`),children:(0,W.jsx)(Z,{icon:(0,W.jsx)(Ce,{className:`size-4 text-amber`}),more:u.credits?w(`market.creditsHint`):void 0,children:(0,W.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2`,children:[(0,W.jsx)(q,{entry:u}),u.credits?(0,W.jsx)(`span`,{className:`text-ink-2`,children:w(`market.creditsRange`,{n:ut(u.credits.credits)})}):null]})})}),(0,W.jsx)(J,{title:w(`market.result`),children:(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:(l.data?.results??[]).map(e=>(0,W.jsx)(Z,{icon:(0,W.jsx)(K,{format:e.kind,className:`size-4 text-ember-strong`}),more:e.formats.map(e=>e.toUpperCase()).join(` · `),children:e.title},e.title))})}),(0,W.jsx)(J,{title:w(`market.needs`),children:(0,W.jsx)(`ul`,{className:`flex flex-col gap-2`,children:u.capabilities.map(e=>{let t=_t[e],n=u.missing.includes(e),r=u.optional?.includes(e);return(0,W.jsxs)(`li`,{className:_(`flex items-center gap-2.5 text-[0.875rem]`,n?`text-ink-3`:`text-ink-2`),children:[(0,W.jsx)(t,{className:_(`size-4 shrink-0`,n?`text-rose`:r?`text-amber`:`text-cobalt`)}),G(V,e),n?(0,W.jsx)(`span`,{className:`text-[0.75rem] text-rose`,children:w(`market.unavailable`)}):r?(0,W.jsx)(`span`,{className:`text-[0.75rem] text-amber`,children:w(`market.optional`)}):null]},e)})})})]}),(0,W.jsxs)(`div`,{className:`flex flex-col sm:min-h-0`,children:[(0,W.jsx)(`div`,{className:`mb-1.5 shrink-0 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:w(`market.steps`)}),(0,W.jsx)(xt,{className:`-mr-2 overscroll-contain pt-1 pr-2 pl-1 sm:min-h-0 sm:flex-1 sm:overflow-y-auto`,children:l.isLoading?(0,W.jsx)(b,{className:`size-5 text-ink-3`}):(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(b,{className:`size-5 text-ink-3`}),children:(0,W.jsx)(ct,{steps:bt(l.data?.outline??[])})})})]})]}):(0,W.jsx)(`div`,{className:`flex-1 px-5 pt-6 sm:px-7`,children:(0,W.jsx)(`p`,{className:`rounded-lg bg-amber-tint p-3 text-[0.875rem] text-ink-2`,children:w(`market.needsUpdateHint`)})}),(0,W.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 px-5 pt-4 pb-5 max-sm:border-border-soft max-sm:border-t sm:px-7 sm:pb-6`,children:[u.plugin?(0,W.jsx)(`span`,{className:`mr-auto flex items-center`,children:(0,W.jsx)(ht,{plugin:u.plugin})}):(0,W.jsxs)(E,{variant:`ghost`,className:`mr-auto`,title:w(`market.starHint`),"aria-pressed":u.starred,busy:f.isPending,onClick:()=>f.mutate(!u.starred),children:[(0,W.jsx)(R,{className:_(`size-4`,u.starred&&`fill-amber text-amber`)}),(0,W.jsx)(`span`,{className:`max-sm:sr-only`,children:w(u.starred?`market.starred`:`market.star`)})]}),(0,W.jsx)(E,{variant:`secondary`,onClick:n,children:w(`common.close`)}),u.usable&&u.missing.length?(0,W.jsx)(E,{variant:`secondary`,onClick:()=>s(`/settings/models`),children:w(`editor.models.settings`)}):null,r?(0,W.jsx)(E,{disabled:!u.usable||u.missing.length>0||!!u.needs?.length,title:u.needs?.length?w(`market.needsProHint`,{list:u.needs.join(`, `)}):u.missing.length?w(`market.missingHint`,{list:Y(u.missing)}):u.optional?.length?w(`market.optionalHint`,{list:Y(u.optional)}):void 0,busy:a,onClick:()=>r(u),children:w(`market.use`)}):null]})]}):(0,W.jsx)(`div`,{className:`flex min-h-48 flex-col items-center justify-center gap-3 rounded-2xl bg-card p-8 text-[0.875rem] text-ink-2 shadow-overlay`,children:l.isLoading?(0,W.jsx)(b,{className:`size-6 text-ink-3`}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{children:w(`market.notFound`)}),(0,W.jsx)(E,{variant:`secondary`,onClick:n,children:w(`common.close`)})]})})})}function St({name:e,value:t,options:n,onChange:r}){let[i,a]=(0,U.useState)(!1),o=(0,U.useRef)(null);(0,U.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=n.find(e=>e.value===t);return(0,W.jsxs)(`div`,{ref:o,className:`relative`,children:[(0,W.jsxs)(`div`,{className:_(`flex h-8 items-center rounded-full text-[0.8125rem] transition`,s?`bg-ember-tint text-ink`:`text-ink-2 hover:bg-paper-2 hover:text-ink`,i&&!s&&`bg-paper-2 text-ink`),children:[(0,W.jsx)(`button`,{type:`button`,"aria-haspopup":`listbox`,"aria-expanded":i,onClick:()=>a(!i),className:_(`flex h-full items-center gap-1.5 rounded-full pl-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,s?`pr-1`:`pr-2.5`),children:s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`text-ink-3`,children:e}),(0,W.jsx)(`span`,{className:`font-medium`,children:s.label})]}):(0,W.jsxs)(W.Fragment,{children:[e,(0,W.jsx)(ne,{className:_(`size-3.5 transition`,i&&`rotate-180`)})]})}),s?(0,W.jsx)(`button`,{type:`button`,"aria-label":`${e}: ${w(`market.reset`)}`,onClick:()=>r(``),className:`mr-1 flex size-6 items-center justify-center rounded-full text-ink-3 hover:bg-card hover:text-ink`,children:(0,W.jsx)(C,{className:`size-3.5`})}):null]}),i?(0,W.jsx)(`div`,{role:`listbox`,"aria-label":e,className:`absolute top-full left-0 z-30 mt-1.5 max-h-80 min-w-60 overflow-y-auto rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:n.map(e=>(0,W.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e.value===t,disabled:!e.count||e.unavailable,onClick:()=>{r(e.value===t?``:e.value),a(!1)},className:_(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[0.875rem] transition coarse:py-2.5`,e.count&&!e.unavailable?`text-ink-2 hover:bg-paper-2 hover:text-ink`:`text-ink-4`,e.value===t&&`font-medium text-ink`),children:[e.icon,(0,W.jsx)(`span`,{className:`flex-1 whitespace-nowrap`,children:e.label}),e.value===t?(0,W.jsx)(ee,{className:`size-4 text-ember`}):e.unavailable?(0,W.jsx)(`span`,{className:`whitespace-nowrap text-[0.75rem] text-ink-4`,children:w(`market.unavailable`)}):(0,W.jsx)(`span`,{className:`text-[0.75rem] text-ink-4 tabular-nums`,children:e.count})]},e.value))}):null]})}function $(e,t){let[n,r]=(0,U.useState)(e);return(0,U.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var Ct=60;function wt({query:e,onUse:t,busy:n,limit:r=6}){let[i,a]=(0,U.useState)(null),o=$(e.trim(),250),s=c({queryKey:[`marketplace`,p,o,`hits`,r],queryFn:()=>T.get(`/api/studio/marketplace?${new URLSearchParams({lang:p,limit:String(r),offset:`0`,q:o})}`),enabled:!!o,placeholderData:u}),l=o?s.data?.entries??[]:[];return l.length?(0,W.jsxs)(`section`,{className:`mt-10`,children:[(0,W.jsxs)(`h2`,{className:`mb-5 flex items-center gap-2 font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.08em]`,children:[w(`market.hits`),s.isFetching?(0,W.jsx)(b,{className:`size-3.5`}):null]}),(0,W.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:l.map(e=>(0,W.jsx)(gt,{entry:e,onOpen:()=>a(e.id)},e.id))}),(0,W.jsx)(Q,{id:i,fallback:l.find(e=>e.id===i)??null,onClose:()=>a(null),onUse:t,busy:n})]}):null}function Tt({entries:e}){let t=i(),n=A(),{project:r}=ce(),a=se()&&!!r&&!r?.readOnly,[o,s]=(0,U.useState)(null),c=d({mutationFn:e=>T.post(`/api/studio/wizards`,{projectId:r.id,starterId:e,lang:p}),onSuccess:async({id:e})=>{await t.invalidateQueries({queryKey:[`projects`]}),await t.invalidateQueries({queryKey:[`wizards`]}),s(null),n(`/edit/${e}`)}});return(0,W.jsxs)(`div`,{className:`@container mt-3`,children:[(0,W.jsx)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:e.map(e=>(0,W.jsx)(gt,{entry:e,onOpen:()=>s(e.id)},e.id))}),c.error?(0,W.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:c.error.message}):null,(0,W.jsx)(Q,{id:o,fallback:e.find(e=>e.id===o)??null,onClose:()=>s(null),onUse:a?e=>!c.isPending&&c.mutate(e.id):void 0,busy:c.isPending})]})}function Et({onUse:e,busy:t,open:n,search:r}){let[i,a]=(0,U.useState)(``);(0,U.useEffect)(()=>{r&&a(r.text)},[r]);let[o,s]=(0,U.useState)(lt),[c,l]=(0,U.useState)(!1),[d,f]=(0,U.useState)(n??null),m=$(i.trim(),250),h=ue({queryKey:[`marketplace`,p,m,o,c],queryFn:({pageParam:e})=>{let t=new URLSearchParams({lang:p,limit:String(Ct),offset:String(e)});m&&t.set(`q`,m);for(let[e,n]of Object.entries(o))n&&t.set(e,n);return c&&t.set(`starred`,`1`),T.get(`/api/studio/marketplace?${t}`)},initialPageParam:0,getNextPageParam:(e,t)=>{let n=t.reduce((e,t)=>e+t.entries.length,0);return n<e.total?n:void 0},placeholderData:u}),g=h.data?.pages[0],v=h.data?.pages.flatMap(e=>e.entries)??[],y=g?.all??0,ee=i.trim()!==m||h.isFetching&&!h.isFetchingNextPage,x=(e,t,n)=>Object.keys(t).filter(t=>g?.facets[e]?.[t]!==void 0).map(r=>({value:r,label:G(t,r),icon:n?.(r),count:(g?.facets[e])[r]??0,unavailable:e===`capability`&&S.has(r)})),S=new Set(g?.unavailable??[]),te=x(`useCase`,Qe),ne=[{key:`industry`,name:w(`market.industry`),options:x(`industry`,Ze)},{key:`format`,name:w(`market.format`),options:x(`format`,B,e=>(0,W.jsx)(K,{format:e,className:`size-4 text-ink-3`}))},{key:`plan`,name:w(`market.plan`),options:x(`plan`,et)},{key:`capability`,name:w(`market.capability`),options:x(`capability`,V,e=>{let t=_t[e];return(0,W.jsx)(t,{className:`size-4 text-ink-3`})})}],D=!!i.trim()||c||Object.values(o).some(Boolean),O=()=>{s(lt),a(``),l(!1)};if(h.isLoading)return(0,W.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,W.jsx)(b,{className:`size-6 text-ink-3`})});let k=g?.offline?(0,W.jsxs)(`p`,{className:`mt-4 flex items-center justify-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,W.jsx)(xe,{className:`size-4 shrink-0`}),w(`market.offline`)]}):null;if(!y&&!D)return k;let A=i?(0,W.jsx)(`button`,{type:`button`,"aria-label":w(`market.reset`),onClick:()=>a(``),className:`-mr-1.5 flex size-7 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-paper-2 hover:text-ink`,children:(0,W.jsx)(C,{className:`size-4`})}):null,j=e=>_(`inline-flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2.5 text-[0.78125rem] transition`,e?`bg-card font-medium text-ink shadow-soft ring-1 ring-border-soft`:`text-ink-3 hover:bg-card/60 hover:text-ink`);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`label`,{className:`relative mx-auto flex h-10 max-w-md items-center gap-2.5 rounded-full bg-card px-4 shadow-soft ring-1 ring-border-soft transition focus-within:ring-2 focus-within:ring-focus sm:h-11`,children:[ee?(0,W.jsx)(b,{className:`size-4 shrink-0 text-ink-3`}):(0,W.jsx)(He,{className:`size-4 shrink-0 text-ink-3`}),(0,W.jsx)(`input`,{type:`search`,value:i,onChange:e=>a(e.target.value),placeholder:w(`market.search`),"aria-label":w(`market.search`),className:`min-w-0 flex-1 bg-transparent text-[0.9375rem] outline-none placeholder:text-ink-4 [&::-webkit-search-cancel-button]:hidden`}),A]}),k,(0,W.jsxs)(`div`,{className:`max-sm:-mx-3 mt-4 flex gap-1 max-sm:overflow-x-auto max-sm:px-3 max-sm:[scrollbar-width:none] sm:flex-wrap sm:justify-center max-sm:[&::-webkit-scrollbar]:hidden`,children:[[{value:``,label:w(`market.all`)},...te].map(e=>(0,W.jsx)(`button`,{type:`button`,"aria-pressed":!c&&o.useCase===e.value,onClick:()=>{l(!1),s({...o,useCase:e.value})},className:j(!c&&o.useCase===e.value),children:e.label},e.value)),(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":c,onClick:()=>l(!c),className:j(c),children:[(0,W.jsx)(R,{className:_(`size-3.5`,c&&`fill-amber text-amber`)}),w(`market.starred`)]})]}),(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-1 gap-y-2 sm:mt-6`,children:[c?null:ne.map(e=>(0,W.jsx)(St,{name:e.name,value:o[e.key],options:e.options,onChange:t=>s({...o,[e.key]:t})},e.key)),(0,W.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 whitespace-nowrap pl-2 text-[0.8125rem] text-ink-3`,children:[D?(0,W.jsxs)(`button`,{type:`button`,onClick:O,className:`inline-flex items-center gap-1 text-ember-strong underline-offset-2 hover:underline`,children:[(0,W.jsx)(C,{className:`size-3.5 max-sm:size-4`}),(0,W.jsx)(`span`,{className:`max-sm:sr-only`,children:w(`market.resetShort`)})]}):null,D?(0,W.jsx)(`span`,{className:`tabular-nums sm:hidden`,children:w(`market.countOfShort`,{n:g?.total??0,all:y})}):null,(0,W.jsx)(`span`,{className:_(`tabular-nums`,D&&`max-sm:hidden`),children:D?w(`market.countOf`,{n:g?.total??0,all:y}):w(`market.count`,{n:y})})]})]}),v.length?(0,W.jsx)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:v.map(e=>(0,W.jsx)(gt,{entry:e,onOpen:()=>f(e.id)},e.id))}):(0,W.jsxs)(`div`,{className:`py-10 text-center text-[0.875rem] text-ink-3`,children:[(0,W.jsx)(`p`,{children:w(c?`market.noneStarred`:`market.none`)}),(0,W.jsx)(E,{variant:`ghost`,className:`mt-2`,onClick:O,children:w(`market.reset`)})]}),h.hasNextPage?(0,W.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,W.jsx)(E,{variant:`secondary`,busy:h.isFetchingNextPage,onClick:()=>void h.fetchNextPage(),children:w(`market.more`)})}):null,(0,W.jsx)(Q,{id:d,fallback:v.find(e=>e.id===d)??null,onClose:()=>f(null),onUse:e,busy:t})]})}export{Oe as C,P as D,xe as E,N as O,I as S,Ce as T,He as _,mt as a,L as b,tt as c,rt as d,V as f,R as g,Ge as h,st as i,M as k,ot as l,Ye as m,Et as n,$ as o,z as p,wt as r,nt as s,Q as t,at as u,Re as v,F as w,Ne as x,Ie as y};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowPreview-BdRy7FO7.js","assets/rolldown-runtime-hePW80VL.js","assets/jsx-runtime-BNakU3Ej.js","assets/ui-DAHMnAVc.js","assets/preload-helper-CNEI7N0N.js","assets/esm-DRaZAcXQ.js","assets/index-DkDBEMwz.js","assets/logo-C4V2_3Ar.js","assets/engenty-eXZ-EAwd.js","assets/useMutation-DKyQXgyj.js","assets/brand-BRw18WJF.js","assets/volume-2-KaKQ4zMJ.js","assets/session-DBOQL_bg.js","assets/index-DY9CslcT.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{n,t as r}from"./jsx-runtime-BNakU3Ej.js";import{O as i,a,c as o,i as s,r as c,s as l,v as u}from"./logo-C4V2_3Ar.js";import{t as d}from"./useMutation-DKyQXgyj.js";import{t as f}from"./preload-helper-CNEI7N0N.js";import{Dt as p,Gt as m,Kt as h,Mt as g,Tt as _,Ut as v,Xt as y,an as ee,bt as b,dn as x,dt as S,ft as te,in as ne,jt as C,kt as w,l as T,lt as E,on as D,tn as O,ut as k,yn as A}from"./ui-DAHMnAVc.js";import{l as j,r as re}from"./brand-BRw18WJF.js";import{t as ie}from"./volume-2-KaKQ4zMJ.js";import{l as ae,u as oe}from"./engenty-eXZ-EAwd.js";import{d as se,s as ce}from"./session-DBOQL_bg.js";var le=class extends a{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:s,isRefetchError:c}=r,u=n.fetchMeta?.fetchMore?.direction,d=s&&u===`forward`,f=i&&u===`forward`,p=s&&u===`backward`,m=i&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:l(t,n.data),hasPreviousPage:o(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:c&&!d&&!p,isRefetching:a&&!f&&!m}}};function ue(e,t){return s(e,le,t)}var de={name:`app-window`,size:24,node:[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]};de.node;var M=x(de),fe={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};fe.node;var N=x(fe),pe={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};pe.node;var me=x(pe),he={name:`circle-dollar-sign`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]};he.node;var ge=x(he),_e={name:`circle-euro`,size:24,node:[[`path`,{d:`M15 9.4a4 4 0 1 0 0 5.2`,key:`1makmb`}],[`path`,{d:`M7 12h5`,key:`gblrwe`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};_e.node;var ve=x(_e),ye={name:`clapperboard`,size:24,node:[[`path`,{d:`m12.296 3.464 3.02 3.956`,key:`qash78`}],[`path`,{d:`M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z`,key:`1h7j8b`}],[`path`,{d:`M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`4lm6w1`}],[`path`,{d:`m6.18 5.276 3.1 3.899`,key:`zjj9t3`}]]};ye.node;var P=x(ye),be={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};be.node;var xe=x(be),Se={name:`coins`,size:24,node:[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]};Se.node;var Ce=x(Se),we={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};we.node;var F=x(we),Te={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};Te.node;var Ee=x(Te),De={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};De.node;var Oe=x(De),ke={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};ke.node;var I=x(ke),Ae={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};Ae.node;var je=x(Ae),Me={name:`layout-template`,size:24,node:[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]};Me.node;var Ne=x(Me),Pe={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};Pe.node;var L=x(Pe),Fe={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]};Fe.node;var Ie=x(Fe),Le={name:`puzzle`,size:24,node:[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]};Le.node;var Re=x(Le),ze={name:`scan-text`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 8h8`,key:`1jbsf9`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`path`,{d:`M7 16h6`,key:`1vyc9m`}]]};ze.node;var Be=x(ze),Ve={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Ve.node;var He=x(Ve),Ue={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};Ue.node;var R=x(Ue),We={name:`table-2`,size:24,node:[[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]};We.node;var Ge=x(We),Ke={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};Ke.node;var qe=x(Ke),Je={name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]};Je.node;var Ye=x(Je),Xe={name:`wand-sparkles`,size:24,node:[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]],aliases:[`wand-2`]};Xe.node;var z=x(Xe),B={text:{de:`Text`,en:`Text`},document:{de:`Dokument (PDF, Word)`,en:`Document (PDF, Word)`},table:{de:`Tabelle`,en:`Table`},image:{de:`Bild`,en:`Image`},video:{de:`Video`,en:`Video`},audio:{de:`Audio`,en:`Audio`},dashboard:{de:`Dashboard`,en:`Dashboard`}},Ze={any:{de:`Jede Branche`,en:`Any industry`},trades:{de:`Handwerk`,en:`Trades`},gastronomy:{de:`Gastronomie`,en:`Food service`},hospitality:{de:`Hotel & Tourismus`,en:`Hotels & tourism`},realEstate:{de:`Immobilien`,en:`Real estate`},retail:{de:`Handel`,en:`Retail`},health:{de:`Gesundheit`,en:`Health`},professional:{de:`Kanzlei & Beratung`,en:`Professional services`},agency:{de:`Agentur & Marketing`,en:`Agency & marketing`},events:{de:`Veranstaltungen`,en:`Events`},publicSector:{de:`Vereine & Öffentliches`,en:`Associations & public sector`}},Qe={marketing:{de:`Marketing & Social Media`,en:`Marketing & social media`},sales:{de:`Angebote & Verkauf`,en:`Offers & sales`},accounting:{de:`Buchhaltung & Belege`,en:`Accounting & receipts`},service:{de:`Kundenservice`,en:`Customer service`},research:{de:`Recherche & Analyse`,en:`Research & analysis`},hr:{de:`Personal & Bewerbungen`,en:`HR & applications`},operations:{de:`Planung & Abläufe`,en:`Planning & operations`},website:{de:`Helfer für die Website`,en:`Website helpers`},visuals:{de:`Bilder & Video`,en:`Images & video`},inquiries:{de:`Anfragen & Termine`,en:`Inquiries & bookings`},advice:{de:`Beratung & Preise`,en:`Advice & pricing`}},V={text:{de:`Text schreiben`,en:`Writes text`},web:{de:`Websuche`,en:`Web search`},browser:{de:`Browser bedienen`,en:`Drives a browser`},documents:{de:`Dokumente & Fotos lesen`,en:`Reads documents & photos`},image:{de:`Bilder erzeugen`,en:`Makes images`},video:{de:`Videos erzeugen`,en:`Makes video`},speech:{de:`Sprachausgabe`,en:`Speech output`},listening:{de:`Sprachnotizen verstehen`,en:`Understands voice notes`},code:{de:`Code ausführen`,en:`Runs code`},connectors:{de:`Verbundene Konten & Systeme`,en:`Connected accounts & systems`},film:{de:`Filme mit Claude Code (auf deinem Abo)`,en:`Films with Claude Code (on your subscription)`}},$e={low:{de:`günstig`,en:`low cost`},medium:{de:`mittel`,en:`medium cost`},high:{de:`teuer`,en:`high cost`}},et={free:{de:`Kostenlos`,en:`Free`},pro:{de:`Pro`,en:`Pro`}},H=e=>Object.keys(e);H(B),H(Ze),H(Qe),H(V),H(et);var U=t(n(),1);function tt(e){switch(e.type){case`page`:return L;case`agent`:return N;case`generate`:return e.asset===`image`?I:e.asset===`video`?g:e.asset===`dashboard`?je:y;case`widget`:return M;case`surface`:return Ne;case`film`:return P;case`review`:return F;case`result`:return Ee}return z}var nt={page:`bg-cobalt-tint text-cobalt`,agent:`bg-ember-tint text-ember-strong`,generate:`bg-amber-tint text-ink-2`,widget:`bg-ember-veil text-ember-strong`,surface:`bg-ember-veil text-ember-strong`,film:`bg-amber-tint text-ink-2`,review:`bg-moss-tint text-moss`,result:`bg-paper-2 text-ink-2`};function rt(e){return w(`type.${e.type}`)}var it=[`web_search`,`web_fetch`,`browser`,`sandbox`,`image`,`http`,`pages`];function at(e){return it.includes(e)?w(`tool.${e}`):e}function ot(e){switch(e.type){case`page`:return e.fields.map(e=>e.label).join(` · `);case`agent`:{let t=e.tools.map(at),n=e.mcp?.length?[`MCP: ${e.mcp.join(`, `)}`]:[];return[...t,...n].join(` · `)||e.instructions.slice(0,90)}case`generate`:{let t=[e.asset];return e.options?.aspectRatio&&t.push(e.options.aspectRatio),e.options?.duration&&t.push(`${e.options.duration}s`),e.options?.resolution&&t.push(e.options.resolution),e.options?.template&&t.push(e.options.template),t.join(` · `)}case`widget`:return[e.entry,Object.keys(e.data).join(`, `)].filter(Boolean).join(` · `);case`surface`:return e.candidates?e.candidates.map(e=>e.id).join(` · `):Object.keys(e.data).join(`, `);case`film`:return[e.format,e.seconds?`${e.seconds}s`:null,e.skills.join(`, `)].filter(Boolean).join(` · `);case`review`:return[e.edit?w(`editor.reviewEditable`):null,e.regenerate?w(`editor.reviewRedo`):null].filter(Boolean).join(` · `);case`result`:return e.deliverables.map(e=>`${e.label??e.from} (${e.formats.join(`, `)})`).join(` · `)}return``}var st=e({EntryDialog:()=>Q,MarketplaceBrowser:()=>Et,MarketplaceCards:()=>Tt,MarketplaceHits:()=>wt,ProChip:()=>mt,useSettled:()=>$}),W=t(r(),1),ct=(0,U.lazy)(()=>f(()=>import(`./FlowPreview-BdRy7FO7.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),lt={useCase:``,industry:``,format:``,capability:``,plan:``},G=(e,t)=>e[t]?.[p]??t;function ut(e){if(e<1)return 1;let t=10**Math.floor(Math.log10(e));return Math.round(e/t)*t}function dt(e){return e.credits?w(`market.credits`,{n:ut(e.credits.credits)}):$e[e.costTier][p]}var ft={text:Ye,document:y,table:Ge,image:I,video:g,audio:D,dashboard:me};function K({format:e,className:t}){let n=ft[e],r=G(B,e);return(0,W.jsx)(`span`,{title:r,className:`inline-flex`,children:(0,W.jsx)(n,{className:t,"aria-label":r,role:`img`})})}var pt=[`low`,`medium`,`high`];function q({entry:e}){let t=pt.indexOf(e.costTier)+1,n=p===`de`?ve:ge;return(0,W.jsxs)(`span`,{title:dt(e),className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0`,children:pt.slice(0,t).map((e,t)=>(0,W.jsx)(`span`,{className:_(`rounded-full bg-(--coin-bg,var(--color-card))`,t>0&&`-ml-1.5`),children:(0,W.jsx)(n,{className:`size-4`})},e))}),$e[e.costTier][p]]})}function mt(){return(0,W.jsx)(S,{tone:`ember`,title:w(`market.proHint`),children:w(`market.pro`)})}function ht({plugin:e}){return(0,W.jsx)(S,{icon:(0,W.jsx)(Re,{className:`size-3.5`}),title:w(`market.fromPlugin`,{name:e.name}),children:e.name})}function gt({entry:e,onOpen:t}){return(0,W.jsxs)(k,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},className:_(`relative flex min-h-[124px] cursor-pointer flex-col gap-5 p-4 text-left transition sm:min-h-[136px] sm:p-5 hover:shadow-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,(!e.usable||e.missing.length>0||!!e.needs?.length)&&`opacity-60`),children:[(0,W.jsx)(`span`,{className:`-top-4 pointer-events-none absolute right-4`,children:(0,W.jsx)(re,{kind:e.avatar,size:68})}),(0,W.jsxs)(`div`,{className:`min-w-0 pr-20`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 font-display font-semibold text-[0.9375rem]`,children:[e.title,e.plan===`pro`?(0,W.jsx)(mt,{}):null,e.starred?(0,W.jsx)(R,{className:`size-3.5 shrink-0 fill-amber text-amber`,"aria-label":w(`market.starred`)}):null]}),(0,W.jsx)(`div`,{className:`mt-0.5 text-[0.8125rem] text-ink-3 leading-snug`,children:e.pitch})]}),(0,W.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[0.75rem] text-ink-3`,children:[e.plugin?(0,W.jsx)(ht,{plugin:e.plugin}):null,e.needs?.length?(0,W.jsx)(S,{tone:`warn`,children:w(`market.needsPro`,{list:e.needs.join(`, `)})}):e.usable&&e.missing.length?(0,W.jsx)(S,{tone:`warn`,children:w(`market.missing`,{list:Y(e.missing)})}):e.usable?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(O,{className:`size-3.5`}),` `,w(`market.minutes`,{n:e.effort.minutes})]}),(0,W.jsx)(q,{entry:e}),e.optional?.length?(0,W.jsx)(S,{title:w(`market.optionalHint`,{list:Y(e.optional)}),children:w(`market.without`,{list:Y(e.optional)})}):null,(0,W.jsx)(`span`,{className:`ml-auto inline-flex items-center gap-1.5`,children:e.formats.map(e=>(0,W.jsx)(K,{format:e,className:`size-4`},e))})]}):(0,W.jsx)(S,{tone:`warn`,children:w(`market.needsUpdate`)})]})]})}function J({title:e,children:t}){return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`mb-1.5 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:e}),t]})}var Y=e=>e.map(e=>G(V,e)).join(`, `),_t={text:v,web:Oe,browser:m,documents:Be,image:I,video:g,speech:ie,listening:h,code:qe,connectors:Ie,film:P};function vt(e){switch(e.type){case`page`:return L;case`agent`:return N;case`generate`:return e.asset===`image`?I:e.asset===`video`?g:e.asset===`voice`?ie:e.asset===`dashboard`?me:y;case`widget`:return e.video?P:M;case`surface`:return M;case`film`:return P;case`review`:return F;case`result`:return Ee}return z}function yt(e){let t=new Set;for(let[n,r]of e.entries())for(let i of r.branches??[]){let r=i.to===`end`?e.length:e.findIndex(e=>e.id===i.to);for(let i=n+1;i<r;i++)t.add(e[i].id)}return t}function bt(e){let t=yt(e);return e.map(e=>({id:e.id,title:e.title,icon:vt(e),tone:nt[e.type]??`bg-paper-2 text-ink-2`,optional:t.has(e.id),branches:e.branches}))}function X({title:e,children:t}){return(0,W.jsx)(`span`,{title:e,className:`inline-flex items-center gap-2 border-border border-l px-4 first:border-l-0 first:pl-0`,children:t})}function Z({icon:e,children:t,more:n}){return(0,W.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,W.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:e}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`div`,{className:`text-[0.875rem] text-ink leading-snug`,children:t}),n?(0,W.jsx)(`div`,{className:`text-[0.75rem] text-ink-3 leading-snug`,children:n}):null]})]})}function xt({className:e,children:t}){let n=(0,U.useRef)(null),[r,i]=(0,U.useState)({above:!1,below:!1});(0,U.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{let t=e.scrollTop>1,n=e.scrollTop+e.clientHeight<e.scrollHeight-1;i(e=>e.above===t&&e.below===n?e:{above:t,below:n})};t(),e.addEventListener(`scroll`,t,{passive:!0});let r=new ResizeObserver(t);return r.observe(e),e.firstElementChild&&r.observe(e.firstElementChild),()=>{e.removeEventListener(`scroll`,t),r.disconnect()}},[]);let a=`linear-gradient(to bottom, ${r.above?`transparent`:`black`} 0, black 28px, black calc(100% - 44px), ${r.below?`transparent`:`black`} 100%)`;return(0,W.jsx)(`div`,{ref:n,className:e,style:{maskImage:a,WebkitMaskImage:a},children:(0,W.jsx)(`div`,{children:t})})}function Q({id:e,fallback:t,onClose:n,onUse:r,busy:a}){let o=i(),s=A(),l=c({queryKey:[`marketplace-entry`,e,p],queryFn:()=>T.get(`/api/studio/marketplace/${encodeURIComponent(e)}?lang=${p}`),enabled:!!e,retry:!1}),u=l.data??t,f=d({mutationFn:t=>{let n=`/api/studio/marketplace/${encodeURIComponent(e)}/star`;return t?T.put(n):T.del(n)},onSuccess:()=>Promise.all([o.invalidateQueries({queryKey:[`marketplace`]}),o.invalidateQueries({queryKey:[`marketplace-entry`,e]})])}),m=j()===`dark`,h=ae[oe[u?.avatar||`round`]],g=m?`var(--card)`:`color-mix(in oklch, ${h??`var(--ink-4)`} 14%, var(--paper-2))`;return(0,W.jsx)(te,{open:!!e,onClose:n,wide:!0,bare:!0,children:u?(0,W.jsxs)(`div`,{className:`relative flex max-h-[calc(100dvh-48px)] flex-col rounded-2xl bg-card shadow-overlay max-sm:h-dvh max-sm:max-h-none max-sm:rounded-none`,children:[(0,W.jsx)(`button`,{type:`button`,"aria-label":w(`common.close`),onClick:n,className:`sm:-top-3.5 sm:-right-3.5 absolute top-3 right-3 z-20 flex size-9 items-center justify-center rounded-full bg-card text-ink-2 shadow-elevated ring-1 ring-border-soft transition hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,children:(0,W.jsx)(C,{className:`size-4`})}),(0,W.jsxs)(`header`,{className:`relative shrink-0 border-border-soft border-b px-5 pt-5 pb-4 text-ink sm:rounded-t-2xl sm:px-7`,style:{background:g,"--coin-bg":g},children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 overflow-hidden sm:rounded-t-2xl`,children:(0,W.jsx)(`span`,{className:_(`-top-28 -right-10 absolute size-80 rounded-full bg-white blur-3xl`,m?`opacity-[0.14]`:`opacity-80`)})}),(0,W.jsx)(`div`,{className:`-bottom-5 absolute right-9 z-10 max-sm:hidden`,children:(0,W.jsx)(re,{kind:u.avatar,size:104})}),(0,W.jsxs)(`div`,{className:`relative sm:pr-36`,children:[(0,W.jsx)(`h2`,{className:`font-display font-semibold text-[1.375rem] leading-tight tracking-tight max-sm:pr-10`,children:u.title}),(0,W.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-2 leading-snug`,children:l.data?.description||u.pitch})]}),u.usable?(0,W.jsxs)(`div`,{className:`-mx-5 sm:-mx-7 relative mt-3.5 flex flex-wrap items-center gap-y-2 border-border-soft border-t px-5 pt-3 font-medium text-[0.875rem] sm:px-7 sm:pr-40`,children:[(0,W.jsxs)(X,{title:w(`market.duration`),children:[(0,W.jsx)(O,{className:`size-4 text-ink-3`}),w(`market.minutes`,{n:u.effort.minutes})]}),(0,W.jsx)(X,{title:w(`market.cost`),children:(0,W.jsx)(q,{entry:u})}),(0,W.jsx)(X,{title:w(`market.result`),children:u.formats.map(e=>(0,W.jsx)(K,{format:e,className:`size-4`},e))})]}):null]}),u.usable?(0,W.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-x-7 gap-y-6 px-5 pt-6 max-sm:overflow-y-auto max-sm:pb-4 sm:grid-cols-[230px_minmax(0,1fr)] sm:grid-rows-[minmax(0,1fr)] sm:px-7`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col gap-5 sm:min-h-0 sm:overflow-y-auto`,children:[(0,W.jsx)(J,{title:w(`market.duration`),children:(0,W.jsx)(Z,{icon:(0,W.jsx)(O,{className:`size-4 text-moss`}),more:w(`market.durationHint`,{n:u.effort.fields}),children:w(`market.minutes`,{n:u.effort.minutes})})}),(0,W.jsx)(J,{title:w(`market.cost`),children:(0,W.jsx)(Z,{icon:(0,W.jsx)(Ce,{className:`size-4 text-amber`}),more:u.credits?w(`market.creditsHint`):void 0,children:(0,W.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2`,children:[(0,W.jsx)(q,{entry:u}),u.credits?(0,W.jsx)(`span`,{className:`text-ink-2`,children:w(`market.creditsRange`,{n:ut(u.credits.credits)})}):null]})})}),(0,W.jsx)(J,{title:w(`market.result`),children:(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:(l.data?.results??[]).map(e=>(0,W.jsx)(Z,{icon:(0,W.jsx)(K,{format:e.kind,className:`size-4 text-ember-strong`}),more:e.formats.map(e=>e.toUpperCase()).join(` · `),children:e.title},e.title))})}),(0,W.jsx)(J,{title:w(`market.needs`),children:(0,W.jsx)(`ul`,{className:`flex flex-col gap-2`,children:u.capabilities.map(e=>{let t=_t[e],n=u.missing.includes(e),r=u.optional?.includes(e);return(0,W.jsxs)(`li`,{className:_(`flex items-center gap-2.5 text-[0.875rem]`,n?`text-ink-3`:`text-ink-2`),children:[(0,W.jsx)(t,{className:_(`size-4 shrink-0`,n?`text-rose`:r?`text-amber`:`text-cobalt`)}),G(V,e),n?(0,W.jsx)(`span`,{className:`text-[0.75rem] text-rose`,children:w(`market.unavailable`)}):r?(0,W.jsx)(`span`,{className:`text-[0.75rem] text-amber`,children:w(`market.optional`)}):null]},e)})})})]}),(0,W.jsxs)(`div`,{className:`flex flex-col sm:min-h-0`,children:[(0,W.jsx)(`div`,{className:`mb-1.5 shrink-0 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:w(`market.steps`)}),(0,W.jsx)(xt,{className:`-mr-2 overscroll-contain pt-1 pr-2 pl-1 sm:min-h-0 sm:flex-1 sm:overflow-y-auto`,children:l.isLoading?(0,W.jsx)(b,{className:`size-5 text-ink-3`}):(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(b,{className:`size-5 text-ink-3`}),children:(0,W.jsx)(ct,{steps:bt(l.data?.outline??[])})})})]})]}):(0,W.jsx)(`div`,{className:`flex-1 px-5 pt-6 sm:px-7`,children:(0,W.jsx)(`p`,{className:`rounded-lg bg-amber-tint p-3 text-[0.875rem] text-ink-2`,children:w(`market.needsUpdateHint`)})}),(0,W.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 px-5 pt-4 pb-5 max-sm:border-border-soft max-sm:border-t sm:px-7 sm:pb-6`,children:[u.plugin?(0,W.jsx)(`span`,{className:`mr-auto flex items-center`,children:(0,W.jsx)(ht,{plugin:u.plugin})}):(0,W.jsxs)(E,{variant:`ghost`,className:`mr-auto`,title:w(`market.starHint`),"aria-pressed":u.starred,busy:f.isPending,onClick:()=>f.mutate(!u.starred),children:[(0,W.jsx)(R,{className:_(`size-4`,u.starred&&`fill-amber text-amber`)}),(0,W.jsx)(`span`,{className:`max-sm:sr-only`,children:w(u.starred?`market.starred`:`market.star`)})]}),(0,W.jsx)(E,{variant:`secondary`,onClick:n,children:w(`common.close`)}),u.usable&&u.missing.length?(0,W.jsx)(E,{variant:`secondary`,onClick:()=>s(`/settings/models`),children:w(`editor.models.settings`)}):null,r?(0,W.jsx)(E,{disabled:!u.usable||u.missing.length>0||!!u.needs?.length,title:u.needs?.length?w(`market.needsProHint`,{list:u.needs.join(`, `)}):u.missing.length?w(`market.missingHint`,{list:Y(u.missing)}):u.optional?.length?w(`market.optionalHint`,{list:Y(u.optional)}):void 0,busy:a,onClick:()=>r(u),children:w(`market.use`)}):null]})]}):(0,W.jsx)(`div`,{className:`flex min-h-48 flex-col items-center justify-center gap-3 rounded-2xl bg-card p-8 text-[0.875rem] text-ink-2 shadow-overlay`,children:l.isLoading?(0,W.jsx)(b,{className:`size-6 text-ink-3`}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{children:w(`market.notFound`)}),(0,W.jsx)(E,{variant:`secondary`,onClick:n,children:w(`common.close`)})]})})})}function St({name:e,value:t,options:n,onChange:r}){let[i,a]=(0,U.useState)(!1),o=(0,U.useRef)(null);(0,U.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=n.find(e=>e.value===t);return(0,W.jsxs)(`div`,{ref:o,className:`relative`,children:[(0,W.jsxs)(`div`,{className:_(`flex h-8 items-center rounded-full text-[0.8125rem] transition`,s?`bg-ember-tint text-ink`:`text-ink-2 hover:bg-paper-2 hover:text-ink`,i&&!s&&`bg-paper-2 text-ink`),children:[(0,W.jsx)(`button`,{type:`button`,"aria-haspopup":`listbox`,"aria-expanded":i,onClick:()=>a(!i),className:_(`flex h-full items-center gap-1.5 rounded-full pl-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,s?`pr-1`:`pr-2.5`),children:s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`text-ink-3`,children:e}),(0,W.jsx)(`span`,{className:`font-medium`,children:s.label})]}):(0,W.jsxs)(W.Fragment,{children:[e,(0,W.jsx)(ne,{className:_(`size-3.5 transition`,i&&`rotate-180`)})]})}),s?(0,W.jsx)(`button`,{type:`button`,"aria-label":`${e}: ${w(`market.reset`)}`,onClick:()=>r(``),className:`mr-1 flex size-6 items-center justify-center rounded-full text-ink-3 hover:bg-card hover:text-ink`,children:(0,W.jsx)(C,{className:`size-3.5`})}):null]}),i?(0,W.jsx)(`div`,{role:`listbox`,"aria-label":e,className:`absolute top-full left-0 z-30 mt-1.5 max-h-80 min-w-60 overflow-y-auto rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:n.map(e=>(0,W.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e.value===t,disabled:!e.count||e.unavailable,onClick:()=>{r(e.value===t?``:e.value),a(!1)},className:_(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[0.875rem] transition coarse:py-2.5`,e.count&&!e.unavailable?`text-ink-2 hover:bg-paper-2 hover:text-ink`:`text-ink-4`,e.value===t&&`font-medium text-ink`),children:[e.icon,(0,W.jsx)(`span`,{className:`flex-1 whitespace-nowrap`,children:e.label}),e.value===t?(0,W.jsx)(ee,{className:`size-4 text-ember`}):e.unavailable?(0,W.jsx)(`span`,{className:`whitespace-nowrap text-[0.75rem] text-ink-4`,children:w(`market.unavailable`)}):(0,W.jsx)(`span`,{className:`text-[0.75rem] text-ink-4 tabular-nums`,children:e.count})]},e.value))}):null]})}function $(e,t){let[n,r]=(0,U.useState)(e);return(0,U.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var Ct=60;function wt({query:e,onUse:t,busy:n,limit:r=6}){let[i,a]=(0,U.useState)(null),o=$(e.trim(),250),s=c({queryKey:[`marketplace`,p,o,`hits`,r],queryFn:()=>T.get(`/api/studio/marketplace?${new URLSearchParams({lang:p,limit:String(r),offset:`0`,q:o})}`),enabled:!!o,placeholderData:u}),l=o?s.data?.entries??[]:[];return l.length?(0,W.jsxs)(`section`,{className:`mt-10`,children:[(0,W.jsxs)(`h2`,{className:`mb-5 flex items-center gap-2 font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.08em]`,children:[w(`market.hits`),s.isFetching?(0,W.jsx)(b,{className:`size-3.5`}):null]}),(0,W.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:l.map(e=>(0,W.jsx)(gt,{entry:e,onOpen:()=>a(e.id)},e.id))}),(0,W.jsx)(Q,{id:i,fallback:l.find(e=>e.id===i)??null,onClose:()=>a(null),onUse:t,busy:n})]}):null}function Tt({entries:e}){let t=i(),n=A(),{project:r}=ce(),a=se()&&!!r&&!r?.readOnly,[o,s]=(0,U.useState)(null),c=d({mutationFn:e=>T.post(`/api/studio/wizards`,{projectId:r.id,starterId:e,lang:p}),onSuccess:async({id:e})=>{await t.invalidateQueries({queryKey:[`projects`]}),await t.invalidateQueries({queryKey:[`wizards`]}),s(null),n(`/edit/${e}`)}});return(0,W.jsxs)(`div`,{className:`@container mt-3`,children:[(0,W.jsx)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:e.map(e=>(0,W.jsx)(gt,{entry:e,onOpen:()=>s(e.id)},e.id))}),c.error?(0,W.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:c.error.message}):null,(0,W.jsx)(Q,{id:o,fallback:e.find(e=>e.id===o)??null,onClose:()=>s(null),onUse:a?e=>!c.isPending&&c.mutate(e.id):void 0,busy:c.isPending})]})}function Et({onUse:e,busy:t,open:n,search:r}){let[i,a]=(0,U.useState)(``);(0,U.useEffect)(()=>{r&&a(r.text)},[r]);let[o,s]=(0,U.useState)(lt),[c,l]=(0,U.useState)(!1),[d,f]=(0,U.useState)(n??null),m=$(i.trim(),250),h=ue({queryKey:[`marketplace`,p,m,o,c],queryFn:({pageParam:e})=>{let t=new URLSearchParams({lang:p,limit:String(Ct),offset:String(e)});m&&t.set(`q`,m);for(let[e,n]of Object.entries(o))n&&t.set(e,n);return c&&t.set(`starred`,`1`),T.get(`/api/studio/marketplace?${t}`)},initialPageParam:0,getNextPageParam:(e,t)=>{let n=t.reduce((e,t)=>e+t.entries.length,0);return n<e.total?n:void 0},placeholderData:u}),g=h.data?.pages[0],v=h.data?.pages.flatMap(e=>e.entries)??[],y=g?.all??0,ee=i.trim()!==m||h.isFetching&&!h.isFetchingNextPage,x=(e,t,n)=>Object.keys(t).filter(t=>g?.facets[e]?.[t]!==void 0).map(r=>({value:r,label:G(t,r),icon:n?.(r),count:(g?.facets[e])[r]??0,unavailable:e===`capability`&&S.has(r)})),S=new Set(g?.unavailable??[]),te=x(`useCase`,Qe),ne=[{key:`industry`,name:w(`market.industry`),options:x(`industry`,Ze)},{key:`format`,name:w(`market.format`),options:x(`format`,B,e=>(0,W.jsx)(K,{format:e,className:`size-4 text-ink-3`}))},{key:`plan`,name:w(`market.plan`),options:x(`plan`,et)},{key:`capability`,name:w(`market.capability`),options:x(`capability`,V,e=>{let t=_t[e];return(0,W.jsx)(t,{className:`size-4 text-ink-3`})})}],D=!!i.trim()||c||Object.values(o).some(Boolean),O=()=>{s(lt),a(``),l(!1)};if(h.isLoading)return(0,W.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,W.jsx)(b,{className:`size-6 text-ink-3`})});let k=g?.offline?(0,W.jsxs)(`p`,{className:`mt-4 flex items-center justify-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,W.jsx)(xe,{className:`size-4 shrink-0`}),w(`market.offline`)]}):null;if(!y&&!D)return k;let A=i?(0,W.jsx)(`button`,{type:`button`,"aria-label":w(`market.reset`),onClick:()=>a(``),className:`-mr-1.5 flex size-7 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-paper-2 hover:text-ink`,children:(0,W.jsx)(C,{className:`size-4`})}):null,j=e=>_(`inline-flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2.5 text-[0.78125rem] transition`,e?`bg-card font-medium text-ink shadow-soft ring-1 ring-border-soft`:`text-ink-3 hover:bg-card/60 hover:text-ink`);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`label`,{className:`relative mx-auto flex h-10 max-w-md items-center gap-2.5 rounded-full bg-card px-4 shadow-soft ring-1 ring-border-soft transition focus-within:ring-2 focus-within:ring-focus sm:h-11`,children:[ee?(0,W.jsx)(b,{className:`size-4 shrink-0 text-ink-3`}):(0,W.jsx)(He,{className:`size-4 shrink-0 text-ink-3`}),(0,W.jsx)(`input`,{type:`search`,value:i,onChange:e=>a(e.target.value),placeholder:w(`market.search`),"aria-label":w(`market.search`),className:`min-w-0 flex-1 bg-transparent text-[0.9375rem] outline-none placeholder:text-ink-4 [&::-webkit-search-cancel-button]:hidden`}),A]}),k,(0,W.jsxs)(`div`,{className:`max-sm:-mx-3 mt-4 flex gap-1 max-sm:overflow-x-auto max-sm:px-3 max-sm:[scrollbar-width:none] sm:flex-wrap sm:justify-center max-sm:[&::-webkit-scrollbar]:hidden`,children:[[{value:``,label:w(`market.all`)},...te].map(e=>(0,W.jsx)(`button`,{type:`button`,"aria-pressed":!c&&o.useCase===e.value,onClick:()=>{l(!1),s({...o,useCase:e.value})},className:j(!c&&o.useCase===e.value),children:e.label},e.value)),(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":c,onClick:()=>l(!c),className:j(c),children:[(0,W.jsx)(R,{className:_(`size-3.5`,c&&`fill-amber text-amber`)}),w(`market.starred`)]})]}),(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-1 gap-y-2 sm:mt-6`,children:[c?null:ne.map(e=>(0,W.jsx)(St,{name:e.name,value:o[e.key],options:e.options,onChange:t=>s({...o,[e.key]:t})},e.key)),(0,W.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 whitespace-nowrap pl-2 text-[0.8125rem] text-ink-3`,children:[D?(0,W.jsxs)(`button`,{type:`button`,onClick:O,className:`inline-flex items-center gap-1 text-ember-strong underline-offset-2 hover:underline`,children:[(0,W.jsx)(C,{className:`size-3.5 max-sm:size-4`}),(0,W.jsx)(`span`,{className:`max-sm:sr-only`,children:w(`market.resetShort`)})]}):null,D?(0,W.jsx)(`span`,{className:`tabular-nums sm:hidden`,children:w(`market.countOfShort`,{n:g?.total??0,all:y})}):null,(0,W.jsx)(`span`,{className:_(`tabular-nums`,D&&`max-sm:hidden`),children:D?w(`market.countOf`,{n:g?.total??0,all:y}):w(`market.count`,{n:y})})]})]}),v.length?(0,W.jsx)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:v.map(e=>(0,W.jsx)(gt,{entry:e,onOpen:()=>f(e.id)},e.id))}):(0,W.jsxs)(`div`,{className:`py-10 text-center text-[0.875rem] text-ink-3`,children:[(0,W.jsx)(`p`,{children:w(c?`market.noneStarred`:`market.none`)}),(0,W.jsx)(E,{variant:`ghost`,className:`mt-2`,onClick:O,children:w(`market.reset`)})]}),h.hasNextPage?(0,W.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,W.jsx)(E,{variant:`secondary`,busy:h.isFetchingNextPage,onClick:()=>void h.fetchNextPage(),children:w(`market.more`)})}):null,(0,W.jsx)(Q,{id:d,fallback:v.find(e=>e.id===d)??null,onClose:()=>f(null),onUse:e,busy:t})]})}export{Oe as C,P as D,xe as E,N as O,I as S,Ce as T,He as _,mt as a,L as b,tt as c,rt as d,V as f,R as g,Ge as h,st as i,M as k,ot as l,Ye as m,Et as n,$ as o,z as p,wt as r,nt as s,Q as t,at as u,Re as v,F as w,Ne as x,Ie as y};
|
package/apps/web/dist/assets/{NewWizardChannels-Cc7gDitg.js → NewWizardChannels-B3FEpsJ-.js}
RENAMED
|
@@ -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{C as r,b as i}from"./Marketplace-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{C as r,b as i}from"./Marketplace-B-gy2onK.js";import{Mt as a,R as o,Tt as s,an as c,dn as l,kt as u,on as d}from"./ui-DAHMnAVc.js";import{t as f}from"./phone-CA2A8W7I.js";import{ct as p,st as m}from"./index-DkDBEMwz.js";var h={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};h.node;var g=l(h),_=[`text`,`data`,`image`,`video`,`voice`,`document`,`dashboard`,`widget`,`film`,`surface`];[...o],[..._];var v={default:`steps`,enabled:[`steps`,`chat`]},y=e(t(),1),b=e(n(),1),x=[{id:`steps`,group:`web`,runner:`steps`,label:`new.ch.steps`,icon:i},{id:`chat`,group:`web`,runner:`chat`,label:`new.ch.chat`,icon:p},{id:`talk`,group:`web`,runner:`talk`,label:`new.ch.talk`,icon:d},{id:`video`,group:`web`,runner:`video`,label:`new.ch.video`,icon:a},{id:`call`,group:`phone`,runner:`call`,label:`new.ch.call`,icon:f},{id:`wacall`,group:`phone`,runner:`call`,label:`new.ch.whatsapp`,icon:null},{id:`sms`,group:`message`,runner:`sms`,label:`new.ch.sms`,icon:g},{id:`whatsapp`,group:`message`,runner:`whatsapp`,label:`new.ch.whatsapp`,icon:null}],S=[{id:`web`,label:`new.web`,icon:r},{id:`phone`,label:`new.phone`,icon:f},{id:`message`,label:`new.messages`,icon:m}],C=x.filter(e=>v.enabled.includes(e.id)).map(e=>e.id),w=e=>x.filter(t=>e.includes(t.id));function T(e){return e.length===C.length&&C.every(t=>e.includes(t))}function E(e){let t=w(e),n=[...new Set(t.map(e=>e.runner))];return{default:t.find(e=>e.group===`web`)?.runner??n[0]??v.default,enabled:n}}var D=e=>e.map(e=>u(e.label));function O(e){return x.find(t=>t.runner===e)}function k(e){return x.filter(t=>t.id!==`wacall`&&e.includes(t.runner)).map(e=>e.id)}function A(e){let t=w(e),n=S.flatMap(e=>{let n=D(t.filter(t=>t.group===e.id));return n.length?[e.id===`web`?n.join(`, `):`${u(e.label)}: ${n.join(`, `)}`]:[]});return`${u(`new.runsAs`)}: ${n.join(` · `)}`}function j(e){return e.length<=2?e.join(`, `):`${e.slice(0,2).join(`, `)} +${e.length-2}`}function M({channel:e,className:t}){let n=e.icon;return n?(0,b.jsx)(n,{className:t??`size-4`}):(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`font-semibold text-[0.625rem] tracking-wide`,children:`WA`})}function N(e){let t=new Set(e?.map(e=>e.id)??[`steps`,`chat`,`talk`,`video`]);return x.filter(e=>t.has(e.runner))}function P({value:e,onChange:t,runners:n,without:r,disabled:i}){let a=N(n).filter(e=>!r?.includes(e.id)),o=t=>e.includes(t.id),l=n=>{i||o(n)&&e.length===1||t(o(n)?e.filter(e=>e!==n.id):[...e,n.id])},d=t=>{let n=S.find(e=>e.id===t),r=a.filter(e=>e.group===t);if(!(n&&r.length))return null;let d=n.icon;return(0,b.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col border-0 p-0`,children:[(0,b.jsxs)(`legend`,{className:`flex items-center gap-1.5 px-2 pt-2 pb-1 text-[0.75rem] text-ink-3`,children:[(0,b.jsx)(d,{className:`size-3.5`}),` `,u(n.label)]}),r.map(t=>(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`label`,{className:s(`flex h-10 w-full cursor-pointer items-center gap-2.5 rounded-lg px-2 text-[0.875rem] transition hover:bg-accent has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-focus coarse:h-11`,o(t)&&`bg-paper-2`),children:[(0,b.jsx)(`span`,{className:`flex w-5 justify-center text-ink-3`,children:(0,b.jsx)(M,{channel:t})}),(0,b.jsx)(`span`,{className:`flex-1`,children:u(t.label)}),(0,b.jsx)(`input`,{type:`checkbox`,className:`sr-only`,"aria-label":u(t.label),checked:o(t),disabled:i,"aria-disabled":o(t)&&e.length===1,onChange:()=>l(t)}),(0,b.jsx)(`span`,{"aria-hidden":`true`,className:s(`flex size-[1.125rem] items-center justify-center rounded-md ring-1`,o(t)?`bg-ink text-paper ring-ink`:`ring-border`),children:o(t)?(0,b.jsx)(c,{className:`size-3`,strokeWidth:3}):null})]}),t.id===`call`&&o(t)?(0,b.jsx)(`p`,{className:`px-2 pb-1.5 pl-9 text-[0.75rem] text-ink-3`,children:u(`new.callHandoff`)}):null]},t.id))]})};return(0,b.jsxs)(`div`,{className:`grid gap-x-4 sm:grid-cols-2`,children:[d(`web`),(0,b.jsxs)(`div`,{className:`flex flex-col`,children:[d(`phone`),d(`message`)]})]})}function F({value:e,onChange:t,runners:n,className:r}){let[i,a]=(0,y.useState)(!1),[o,c]=(0,y.useState)(0),l=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(!i)return;let e=e=>{l.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[i]);let d=N(n),f=S.filter(e=>d.some(t=>t.group===e.id)),p=t=>e.includes(t.id);return(0,b.jsxs)(`div`,{ref:l,className:s(`relative flex flex-wrap items-center gap-1.5`,r),children:[(0,b.jsx)(`span`,{className:`mr-0.5 px-1 text-[0.8125rem] text-ink-3`,children:u(`new.runsAs`)}),f.map(e=>{let t=D(d.filter(t=>t.group===e.id&&p(t))),n=e.icon;return(0,b.jsxs)(`button`,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i,"aria-label":`${u(e.label)}: ${t.length?t.join(`, `):u(`new.off`)}`,onClick:e=>{let t=e.currentTarget;c(t.offsetLeft+t.offsetWidth/2),a(e=>!e)},className:s(`inline-flex h-9 items-center justify-center gap-1.5 rounded-full font-medium text-[0.8125rem] transition coarse:h-11`,t.length?`bg-ink px-3 text-paper`:`w-9 text-ink-3 ring-1 ring-border hover:text-ink coarse:w-11`),children:[(0,b.jsx)(n,{className:`size-4 shrink-0`}),t.length?(0,b.jsx)(`span`,{className:`truncate`,children:j(t)}):null]},e.id)}),i?(0,b.jsxs)(`div`,{role:`dialog`,"aria-label":u(`new.where`),style:{transformOrigin:`${o}px top`},className:`absolute top-full left-0 z-20 mt-2 w-[min(32rem,calc(100vw-2rem))] animate-unfold rounded-2xl bg-card p-3 text-left shadow-overlay ring-1 ring-border`,children:[(0,b.jsx)(`p`,{className:`px-2 pt-1 font-semibold text-[0.9375rem]`,children:u(`new.where`)}),(0,b.jsx)(P,{value:e,onChange:t,runners:n})]}):null]})}export{C as a,k as c,F as i,T as l,M as n,A as o,P as r,O as s,S as t,E as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{O as r,r as i,v as a}from"./logo-C4V2_3Ar.js";import{a as o,n as s,o as c,t as l}from"./Marketplace-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{O as r,r as i,v as a}from"./logo-C4V2_3Ar.js";import{a as o,n as s,o as c,t as l}from"./Marketplace-B-gy2onK.js";import{t as u}from"./useMutation-DKyQXgyj.js";import{Bt as d,Dt as f,Tt as p,Wt as m,a as h,c as g,cn as _,dt as v,ft as y,hn as b,i as x,jt as S,kt as C,l as w,lt as T,o as ee,r as te,s as ne,st as E,v as D,wt as O,xn as re,yn as k}from"./ui-DAHMnAVc.js";import{a as ie,i as ae,l as A,o as j,u as M}from"./NewWizardChannels-B3FEpsJ-.js";import{r as oe}from"./brand-BRw18WJF.js";import{t as N}from"./upload-DLbJVvfd.js";import{d as P,s as F}from"./session-DBOQL_bg.js";var I=[[`id`,8],[`toolId`,10],[`moduleId`,7],[`pluginId`,6],[`title`,6],[`description`,4],[`tags`,3],[`path`,3],[`inputSchema`,2],[`outputSchema`,2],[`request`,1],[`response`,1]];function L(e){return e.normalize(`NFKD`).replace(/[̀-ͯ]/g,``).replace(/([a-z])([A-Z])/g,`$1 $2`).toLowerCase()}function R(e){return L(e).split(/[^a-z0-9]+/).map(e=>e.trim()).filter(e=>e.length>1)}function z(e){return e==null?``:Array.isArray(e)?e.map(z).filter(Boolean).join(` `):typeof e==`object`?Object.values(e).map(z).filter(Boolean).join(` `):String(e)}function B(e,t){let n=t.map(([t,n])=>({text:z(e[t]),weight:n})).filter(e=>e.text.length>0);return{fields:n,tokens:n.flatMap(e=>R(e.text))}}function V(e){let t=[e];if(e.length<5)return t;if(e.endsWith(`ing`)){let n=e.slice(0,-3);n.length>=3&&t.push(n,`${n}e`)}else if(e.endsWith(`ies`)&&e.length>=6)t.push(`${e.slice(0,-3)}y`);else if(e.endsWith(`es`))t.push(e.slice(0,-2),e.slice(0,-1));else if(e.endsWith(`ed`)){let n=e.slice(0,-2);t.push(n,`${n}e`)}else e.endsWith(`s`)&&!e.endsWith(`ss`)&&t.push(e.slice(0,-1));return[...new Set(t)]}function H(e,t){if(e===t)return 1;let n=0;for(let r of V(e))for(let i of V(t)){if(r===i){n=Math.max(n,r===e&&i===t?1:.75);continue}r.length>=2&&i.startsWith(r)&&(n=Math.max(n,.55*(r.length/i.length))),i.length>=4&&r.startsWith(i)&&(n=Math.max(n,.4*(i.length/r.length)))}return n}function U(e,t){return e.reduce((e,n)=>e+H(t,n),0)}function W(e,t,n=I){if(!t?.trim())return 0;let r=R(t);if(r.length===0)return 0;let i=B(e,n);return i.tokens.length===0?0:r.reduce((e,t)=>U(i.tokens,t)===0?e:e+i.fields.reduce((e,n)=>{let r=R(n.text),i=U(r,t);if(i===0)return e;let a=i*2.2/(i+1.2+r.length/16);return e+n.weight*a},0),0)}var G=new Set(R(`aber als also am an auch auf aus bei bin bitte brauche brauchen braucht das dass dem den der
|
|
2
2
|
des die dies diese dieser doch du ein eine einem einen einer eines er es etwas fuer für gerne
|
|
3
3
|
habe haben hat ich ihr im in ist kann können koennen mache machen mag mein meine meinem meinen
|
|
4
4
|
meiner mich mir mit möchte moechte nach nicht noch nur oder sich sie sind soll suche suchen
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{O as r,r as i}from"./logo-C4V2_3Ar.js";import{_ as a,g as o,m as s,p as c,v as l,w as u}from"./Marketplace-C-Vz3yEk.js";import{t as d}from"./useMutation-DKyQXgyj.js";import{Bt as f,Dt as p,Jt as m,Nt as h,Rt as g,St as _,T as v,Tt as y,Vt as ee,Wt as te,Yt as b,Zt as x,an as S,bn as ne,bt as C,dn as re,dt as w,ft as T,gt as E,hn as D,ht as O,kt as k,l as A,lt as j,mt as M,pt as ie,sn as ae,ut as N,vn as oe,wt as P,xn as se,xt as F,yn as ce,yt as I}from"./ui-CMdSOoUZ.js";import{_ as le,a as ue,b as L,c as de,d as fe,f as R,g as pe,h as me,i as he,l as ge,m as _e,n as z,o as ve,p as ye,s as be,u as xe,v as Se,x as B,y as V}from"./RunDrawer-B0gJzdxH.js";import{t as H}from"./phone-CI2Flerg.js";import{n as U,r as Ce,t as W}from"./ReadOnly-mhKW496R.js";import{t as G}from"./upload-Cz9HgBT9.js";import{c as K,l as we,s as Te}from"./session-BEHF6g4Y.js";import{A as q,D as J,E as Y,F as Ee,H as De,I as X,M as Oe,N as ke,O as Ae,P as je,_ as Me,ct as Ne,d as Pe,f as Fe,g as Ie,j as Le,k as Re,l as ze,lt as Be,p as Ve,s as He,u as Ue,v as We}from"./index-Bdx1Qity.js";import{a as Z,c as Ge,f as Ke,i as qe,n as Je,o as Ye,r as Xe,s as Ze,t as Qe,u as $e}from"./settings-menu-BOOPxcJH.js";import{t as et}from"./RunnerView-CTRFgyu5.js";var tt={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};tt.node;var nt=re(tt),rt={name:`music`,size:24,node:[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]};rt.node;var it=re(rt),Q=e(t(),1),$=e(n(),1),at={backgroundImage:`repeating-conic-gradient(#c9c9c9 0% 25%, #dedede 0% 50%)`,backgroundSize:`16px 16px`};function ot({file:e,actions:t}){let[n,r]=(0,Q.useState)(e.description),i=(0,Q.useRef)(e.description),a=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{e.description!==i.current&&(r(t=>t===i.current?e.description:t),i.current=e.description)},[e.description]),(0,Q.useLayoutEffect)(()=>{let e=a.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)},[n]);let o=e.status===`pending`&&!n;return t.readOnly?n?(0,$.jsx)(`p`,{className:`text-[0.8125rem] text-ink-2 leading-snug`,children:n}):null:(0,$.jsx)(`textarea`,{ref:a,rows:1,value:n,maxLength:600,placeholder:k(o?`project.describing`:`project.description`),onChange:e=>r(e.target.value),onBlur:()=>{n.trim()!==e.description&&(i.current=n.trim(),t.describe(e.id,n.trim()))},className:`-mx-1 block w-[calc(100%+0.5rem)] resize-none overflow-hidden rounded-md bg-transparent px-1 py-0.5 text-[0.8125rem] text-ink-2 leading-snug outline-none transition placeholder:text-ink-4 hover:bg-paper-2 focus:bg-card focus:text-ink focus:ring-1 focus:ring-border`})}function st(e,t){confirm(k(`project.removeConfirm`,{name:e.name}))&&t.remove(e.id)}function ct({projectId:e,file:t,small:n}){let r=Oe(e,t.id);return t.mime.startsWith(`image/`)?(0,$.jsx)(`img`,{src:r,alt:``,loading:`lazy`,className:y(`size-full`,t.kind===`logo`?`object-contain p-3`:`object-cover`)}):t.mime.startsWith(`video/`)?(0,$.jsx)(`video`,{src:`${r}#t=0.1`,preload:`metadata`,controls:!n,className:`size-full object-cover`}):(0,$.jsx)(`div`,{className:`flex size-full items-center justify-center text-ink-3`,children:t.mime.startsWith(`audio/`)?(0,$.jsx)(it,{className:n?`size-5`:`size-7`}):(0,$.jsx)(b,{className:n?`size-5`:`size-7`})})}function lt({projectId:e,kind:t,files:n,actions:r,accept:i,addLabel:a,onPreview:s}){return(0,$.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(184px,1fr))] gap-3`,children:[n.map((i,a)=>(0,$.jsxs)(`div`,{className:`group relative flex flex-col gap-1.5 rounded-lg bg-paper p-2 pb-2.5 ring-1 ring-border-soft`,children:[t===`logo`&&a===0?(0,$.jsx)(`span`,{className:`absolute -top-3 left-3 z-10 rounded-full ring-2 ring-card`,children:(0,$.jsx)(w,{tone:`ember`,children:k(`project.logoMain`)})}):null,(0,$.jsxs)(`div`,{className:`relative h-28 overflow-hidden rounded-md bg-paper-2`,style:t===`logo`?at:void 0,children:[s&&i.mime.startsWith(`image/`)?(0,$.jsx)(`button`,{type:`button`,"aria-label":`${k(`project.preview`)}: ${i.name}`,onClick:()=>s(i),className:`block size-full cursor-zoom-in`,children:(0,$.jsx)(ct,{projectId:e,file:i})}):(0,$.jsx)(ct,{projectId:e,file:i}),(0,$.jsxs)(`div`,{className:`absolute top-1 right-1 flex gap-1 opacity-0 transition focus-within:opacity-100 group-hover:opacity-100 coarse:opacity-100`,children:[s?(0,$.jsx)(M,{label:k(`project.preview`),onClick:()=>s(i),className:`size-8 bg-card shadow-soft`,children:(0,$.jsx)(u,{className:`size-4`})}):null,t===`logo`&&a>0&&!r.readOnly?(0,$.jsx)(M,{label:k(`project.logoMakeMain`),onClick:()=>r.order(`logo`,[i.id,...n.filter(e=>e.id!==i.id).map(e=>e.id)]),className:`size-8 bg-card shadow-soft`,children:(0,$.jsx)(o,{className:`size-4`})}):null,r.readOnly?null:(0,$.jsx)(M,{label:k(`project.remove`),onClick:()=>st(i,r),className:`size-8 bg-card shadow-soft hover:text-rose`,children:(0,$.jsx)(h,{className:`size-4`})})]})]}),t===`asset`?(0,$.jsx)(`div`,{className:`truncate px-0.5 text-[0.75rem] text-ink-3`,title:i.name,children:i.name}):null,(0,$.jsx)(ot,{file:i,actions:r})]},i.id)),a&&!r.readOnly?(0,$.jsxs)(J,{accept:i,multiple:!1,onFiles:e=>r.upload(t,e),className:`min-h-28 flex-col p-3`,children:[r.busy?(0,$.jsx)(C,{className:`size-5`}):(0,$.jsx)(f,{className:`size-5`}),a]}):null]})}function ut({projectId:e,data:t,readOnly:n}){let r=je(e,n);return(0,$.jsxs)(q,{title:k(`project.logos`),hint:k(`project.logosHint`),children:[(0,$.jsx)(lt,{projectId:e,kind:`logo`,files:t.files.filter(e=>e.kind===`logo`),actions:r,accept:`image/*`,addLabel:k(`project.logoAdd`)}),r.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:r.error}):null]})}var dt=e=>[(e.name.includes(`.`)?e.name.split(`.`).pop():e.mime.split(`/`).pop())?.toUpperCase().slice(0,5),Le(e.size)].filter(Boolean).join(` · `);function ft({projectId:e,file:t,actions:n,onClose:r}){let i=Oe(e,t.id);return(0,$.jsxs)(T,{open:!0,onClose:r,wide:`page`,title:t.name,children:[(0,$.jsxs)(`div`,{className:`-mt-2 mb-4 flex items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:dt(t)}),(0,$.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,"aria-label":k(`project.openOriginal`),title:k(`project.openOriginal`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,$.jsx)(x,{className:`size-4`})})]}),t.mime.startsWith(`image/`)?(0,$.jsx)(`div`,{className:`overflow-hidden rounded-lg`,style:at,children:(0,$.jsx)(`img`,{src:i,alt:``,className:`mx-auto max-h-[68dvh] object-contain`})}):t.mime.startsWith(`video/`)?(0,$.jsx)(`video`,{src:i,controls:!0,className:`max-h-[68dvh] w-full rounded-lg bg-black`}):(0,$.jsx)(`audio`,{src:i,controls:!0,className:`w-full`}),(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(ot,{file:t,actions:n})})]})}function pt({projectId:e,file:t,actions:n,onPreview:r}){return(0,$.jsxs)(`li`,{className:`flex items-start gap-3 rounded-lg bg-paper p-2 ring-1 ring-border-soft`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`${k(`project.preview`)}: ${t.name}`,onClick:r,className:`size-14 shrink-0 cursor-zoom-in overflow-hidden rounded-md bg-paper-2`,children:(0,$.jsx)(ct,{projectId:e,file:t,small:!0})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 py-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:r,title:t.name,className:`min-w-0 truncate font-medium text-[0.875rem] hover:underline`,children:t.name}),(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:dt(t)})]}),(0,$.jsx)(ot,{file:t,actions:n})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start`,children:[(0,$.jsx)(M,{label:k(`project.preview`),onClick:r,children:(0,$.jsx)(u,{className:`size-4`})}),n.readOnly?null:(0,$.jsx)(M,{label:k(`project.remove`),onClick:()=>st(t,n),className:`hover:text-rose`,children:(0,$.jsx)(h,{className:`size-4`})})]})]})}function mt({projectId:e,data:t,readOnly:n}){let r=je(e,n),[i,a]=Ee(`assets`,`cards`),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(null),u=t.files.filter(e=>e.kind===`asset`),d=u.find(e=>e.id===c),f=o.trim().toLowerCase(),p=f?u.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(f)):u;return(0,$.jsxs)(q,{title:k(`project.assets`),hint:k(`project.assetsHint`),children:[u.length?(0,$.jsx)(Ae,{layout:i,onToggle:a,children:(0,$.jsx)(Re,{value:o,onChange:s,placeholder:k(`project.assetSearch`)})}):null,p.length?(0,$.jsx)(`div`,{className:`mb-3`,children:i===`cards`?(0,$.jsx)(lt,{projectId:e,kind:`asset`,files:p,actions:r,onPreview:e=>l(e.id)}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.map(t=>(0,$.jsx)(pt,{projectId:e,file:t,actions:r,onPreview:()=>l(t.id)},t.id))})}):null,n?u.length?null:(0,$.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:k(`project.staysLocal`)}):(0,$.jsxs)(J,{accept:`image/*,video/*,audio/*`,onFiles:e=>r.upload(`asset`,e),className:`h-16 w-full`,children:[r.busy?(0,$.jsx)(C,{className:`size-4`}):(0,$.jsx)(G,{className:`size-4`}),k(`project.drop`),` `,(0,$.jsx)(`span`,{className:`underline`,children:k(`project.assetAdd`)})]}),r.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:r.error}):null,d?(0,$.jsx)(ft,{projectId:e,file:d,actions:r,onClose:()=>l(null)}):null]})}function ht(e,t,n){return i({queryKey:[`project-file-text`,t.id,t.chars,n],queryFn:()=>A.get(`/api/studio/projects/${e}/files/${t.id}/text?limit=${n}`),enabled:t.status===`ready`,staleTime:6e4})}function gt(e){return((e.name.includes(`.`)?e.name.split(`.`).pop():``)||e.mime.split(`/`).pop()||``).toUpperCase().slice(0,5)}var _t=e=>[gt(e),e.pages?k(`project.pages`,{n:e.pages}):null,Le(e.size)].filter(Boolean).join(` · `),vt=2e5;function yt({projectId:e,fileId:t,readOnly:n,onGone:i}){let a=r(),o=X(e),s=_e(e),c=je(e,n),l=o.data?.files.find(e=>e.id===t),u=l?l.mime===`application/pdf`||l.mime.startsWith(`image/`):!1,[d,f]=(0,Q.useState)(null);if(!l)return o.isLoading?(0,$.jsx)(C,{className:`mx-auto text-ink-3`}):null;let p=d??(u?`original`:`text`),m=s.data?.items.find(e=>e.key===`f:${l.id}`),_=Oe(e,l.id),v=(e,t)=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":p===e,onClick:()=>f(e),className:y(`rounded-full px-3 py-1 text-[0.8125rem] transition`,p===e?`bg-paper-2 font-medium text-ink`:`text-ink-3 hover:text-ink`),children:t});return(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 px-1`,children:[(0,$.jsx)(`h2`,{className:`min-w-0 flex-1 truncate font-display font-semibold text-lg`,children:l.name}),(0,$.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 max-sm:hidden`,children:_t(l)}),(0,$.jsx)(`a`,{href:_,target:`_blank`,rel:`noreferrer`,"aria-label":k(`project.openOriginal`),title:k(`project.openOriginal`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,$.jsx)(x,{className:`size-4`})}),n?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(M,{label:k(`project.reindex`),onClick:async()=>{await c.reindex(l.id),await a.invalidateQueries({queryKey:[`knowledge`,e]})},children:(0,$.jsx)(g,{className:`size-4`})}),(0,$.jsx)(M,{label:k(`know.deleteFile`),className:`hover:text-rose`,onClick:async()=>{confirm(k(`data.confirmDelete`,{title:l.name}))&&(await c.remove(l.id),await a.invalidateQueries({queryKey:[`knowledge`,e]}),i())},children:(0,$.jsx)(h,{className:`size-4`})})]})]}),(0,$.jsx)(R,{projectId:e,itemKey:`f:${l.id}`,has:m?.categories??[],originLabel:m?.originLabel??null,kept:!1,review:null,file:null,readOnly:n,onReviewed:()=>void 0}),(0,$.jsx)(`div`,{className:`px-1`,children:(0,$.jsx)(ot,{file:l,actions:c})}),l.status===`failed`?(0,$.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:l.error}):null,(0,$.jsxs)(N,{className:`flex flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1 border-border-soft border-b px-2 py-1.5`,children:[u?v(`original`,k(`project.original`)):null,v(`text`,k(`project.readText`))]}),p===`original`?l.mime===`application/pdf`?(0,$.jsx)(`iframe`,{src:_,title:l.name,className:`h-[70dvh] w-full rounded-b-xl bg-paper-2`}):(0,$.jsx)(`img`,{src:_,alt:``,className:`mx-auto max-h-[70dvh] object-contain p-4`}):(0,$.jsx)(bt,{projectId:e,file:l})]})]})}function bt({projectId:e,file:t}){let n=ht(e,t,vt);return n.isLoading||t.status===`pending`?(0,$.jsx)(`div`,{className:`flex h-40 items-center justify-center text-ink-3`,children:(0,$.jsx)(C,{})}):n.data?.text?(0,$.jsxs)(`div`,{className:`overflow-x-auto p-4 sm:p-5`,children:[(0,$.jsx)(v,{text:n.data.text,className:`text-[0.875rem]`}),n.data.chars>n.data.text.length?(0,$.jsx)(`p`,{className:`mt-3 text-[0.8125rem] text-ink-3`,children:k(`project.textCut`,{shown:n.data.text.length.toLocaleString(),total:n.data.chars.toLocaleString()})}):null]}):(0,$.jsx)(`p`,{className:`py-8 text-center text-[0.875rem] text-ink-3`,children:k(`project.noText`)})}var xt=[`text`,`longtext`,`number`,`date`,`url`,`email`,`phone`,`boolean`],St=/^(\d{4}-\d{2}-\d{2}|\d{1,2}\.\s?\d{1,2}\.\s?\d{4})$/,Ct=/^[+-]?\d{1,3}([.,\s']?\d{3})*([.,]\d+)?$/,wt=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,Tt=/^(https?:\/\/|www\.)\S+$/i,Et=/^\+?[\d\s()/.-]{7,20}$/,Dt=/^(ja|nein|yes|no|true|false)$/i;function Ot(e){let t=e.trim();return t?t.includes(`
|
|
2
|
-
`)||t.length>140?`longtext`:Dt.test(t)?`boolean`:wt.test(t)?`email`:Tt.test(t)?`url`:St.test(t)?`date`:Ct.test(t)&&!/^(\+|0\d)/.test(t)?`number`:Et.test(t)&&t.replace(/\D/g,``).length>=7?`phone`:`text`:`text`}function kt(e,t=[]){let n=e.toLowerCase().replace(/ä/g,`ae`).replace(/ö/g,`oe`).replace(/ü/g,`ue`).replace(/ß/g,`ss`).normalize(`NFD`).replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,40)||`fakt`,r=n;for(let e=2;t.includes(r);e++)r=`${n}_${e}`;return r}var At=[{key:`adresse`,de:`Adresse`,en:`Address`},{key:`plz`,de:`PLZ`,en:`Postcode`},{key:`ort`,de:`Ort`,en:`City`},{key:`uid`,de:`UID`,en:`VAT id`},{key:`telefon`,de:`Telefon`,en:`Phone`},{key:`e_mail`,de:`E-Mail`,en:`Email`},{key:`website`,de:`Website`,en:`Website`},{key:`iban`,de:`IBAN`,en:`IBAN`}],jt={facts:100,colors:12,files:{logo:8,asset:100,document:2e3},bytes:{logo:5e6,asset:15e6,video:8e7,document:3e7}},Mt=/^#[0-9a-fA-F]{6}$/;function Nt({onAdd:e,onClose:t}){let[n,r]=(0,Q.useState)(`#e0531b`),[i,a]=(0,Q.useState)(``),o=Mt.test(n);return(0,$.jsx)(T,{open:!0,onClose:t,title:k(`project.colorAddTitle`),children:(0,$.jsxs)(`form`,{onSubmit:r=>{r.preventDefault(),o&&(e({name:i.trim(),value:n.toLowerCase()}),t())},className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(E,{children:k(`project.colorValue`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(F,{value:o?n:`#888888`,onChange:e=>r(e.target.value)}),(0,$.jsx)(O,{value:n,placeholder:`#e0531b`,spellCheck:!1,onChange:e=>r(e.target.value.trim()),className:`font-mono text-[0.875rem]`})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(E,{children:k(`project.colorUseLabel`)}),(0,$.jsx)(O,{autoFocus:!0,value:i,maxLength:120,placeholder:k(`project.colorName`),onChange:e=>a(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:k(`project.colorUse`)})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(j,{variant:`ghost`,onClick:t,children:k(`common.cancel`)}),(0,$.jsx)(j,{type:`submit`,disabled:!o,children:k(`project.add`)})]})]})})}function Pt({colors:e,save:t,readOnly:n}){let r=(0,Q.useRef)(0),[i,a]=(0,Q.useState)(()=>e.map(e=>({...e,id:`c${r.current++}`}))),[o,s]=(0,Q.useState)(!1),c=ke(i.filter(e=>Mt.test(e.value)).map(({name:e,value:t})=>({name:e.trim(),value:t})),t),l=(e,t)=>a(n=>n.map(n=>n.id===e?{...n,...t}:n));return(0,$.jsxs)(q,{title:k(`project.colors`),hint:k(`project.colorsHint`),save:c,locked:n,children:[(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(F,{value:Mt.test(e.value)?e.value:`#888888`,onChange:t=>l(e.id,{value:t.target.value})}),(0,$.jsx)(O,{value:e.name,placeholder:k(`project.colorName`),maxLength:120,onChange:t=>l(e.id,{name:t.target.value}),className:`min-w-0 flex-1`}),(0,$.jsx)(O,{value:e.value,placeholder:`#e0531b`,spellCheck:!1,onChange:t=>l(e.id,{value:t.target.value.trim()}),className:`w-28 font-mono text-[0.8125rem]`}),(0,$.jsxs)(`div`,{className:`flex w-24 shrink-0 items-center justify-end max-sm:w-auto`,children:[t===0?(0,$.jsx)(`span`,{className:`mr-1 max-sm:hidden`,children:(0,$.jsx)(w,{tone:`ember`,children:k(`project.colorAccent`)})}):n?null:(0,$.jsx)(M,{label:k(`project.colorFirst`),onClick:()=>a(t=>[e,...t.filter(t=>t.id!==e.id)]),children:(0,$.jsx)(ae,{className:`size-4`})}),n?null:(0,$.jsx)(M,{label:k(`project.remove`),onClick:()=>a(t=>t.filter(t=>t.id!==e.id)),className:`hover:text-rose`,children:(0,$.jsx)(h,{className:`size-4`})})]})]},e.id))}),i.length&&!n?(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:k(`project.colorUse`)}):null,i.length<jt.colors&&!n?(0,$.jsxs)(j,{variant:`secondary`,size:`sm`,className:i.length?`mt-3`:void 0,onClick:()=>s(!0),children:[(0,$.jsx)(f,{className:`size-4`}),` `,k(`project.colorAdd`)]}):null,o?(0,$.jsx)(Nt,{onClose:()=>s(!1),onAdd:e=>a(t=>[...t,{...e,id:`c${r.current++}`}])}):null]})}var Ft=e=>/^(ja|yes|true)$/i.test(e.trim()),It={text:s,longtext:Ce,number:L,date:B,url:m,email:Ne,phone:H,boolean:V};function Lt({type:e,detected:t,onChange:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(!r)return;let e=e=>{s.current?.contains(e.target)||i(!1)},t=e=>e.key===`Escape`&&i(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[r]);let l=It[e??t],u=`${k(`project.factType`)}: ${k(`project.type.${e??t}`)}`,d=`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[0.875rem] text-ink-2 hover:bg-accent hover:text-ink`,f=e=>{n(e),i(!1)};return(0,$.jsxs)(`div`,{className:`relative`,ref:s,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":u,title:u,"aria-haspopup":`menu`,"aria-expanded":r,onClick:e=>{o(window.innerHeight-e.currentTarget.getBoundingClientRect().bottom<400),i(e=>!e)},className:y(`inline-flex size-11 items-center justify-center rounded-lg transition hover:bg-accent hover:text-ink`,r?`bg-accent text-ink`:e?`text-ink-2`:`text-ink-4`),children:(0,$.jsx)(l,{className:`size-4`})}),r?(0,$.jsxs)(`div`,{role:`menu`,className:y(`absolute right-0 z-50 w-56 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,a?`bottom-12`:`top-12`),children:[(0,$.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":!e,className:d,onClick:()=>f(void 0),children:[(0,$.jsx)(c,{className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{className:`flex-1`,children:k(`project.factAuto`)}),(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-4`,children:k(`project.type.${t}`)}),(0,$.jsx)(S,{className:y(`size-4 shrink-0`,e&&`invisible`)})]}),(0,$.jsx)(`div`,{className:`mx-2 my-1 h-px bg-border-soft`}),xt.map(t=>{let n=It[t];return(0,$.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e===t,className:d,onClick:()=>f(t),children:[(0,$.jsx)(n,{className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{className:`flex-1`,children:k(`project.type.${t}`)}),(0,$.jsx)(S,{className:y(`size-4 shrink-0`,e!==t&&`invisible`)})]},t)})]}):null]})}function Rt({facts:e,save:t,readOnly:n}){let r=(0,Q.useRef)(0),i=(0,Q.useRef)(null),[a,o]=(0,Q.useState)(()=>e.map(e=>({...e,id:`f${r.current++}`}))),s=ke(a.filter(e=>e.key&&e.label.trim()).map(({key:e,label:t,value:n,type:r})=>({key:e,label:t.trim(),value:n,...r?{type:r}:{}})),t),c=(e,t)=>o(n=>n.map(n=>n.id===e?{...n,...t}:n)),l=(e,t,n=!1)=>{let a=`f${r.current++}`;i.current=`${a}:${t}`;let s={id:a,key:``,label:``,value:``,...e};o(e=>n?[s,...e]:[...e,s])},u=e=>t=>{t&&i.current===e&&(i.current=null,t.focus())},d=At.filter(e=>!a.some(t=>t.key===e.key));return(0,$.jsxs)(q,{title:k(`project.facts`),hint:k(`project.factsHint`),save:s,locked:n,action:a.length<jt.facts&&!n?(0,$.jsxs)(j,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`,!0),children:[(0,$.jsx)(f,{className:`size-4`}),` `,k(`project.factAdd`)]}):null,children:[(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>{let t=Ot(e.value),r=e.type??t;return(0,$.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] items-start gap-x-1 gap-y-2 sm:grid-cols-[minmax(0,2fr)_minmax(0,3fr)_auto_auto]`,children:[(0,$.jsx)(O,{ref:u(`${e.id}:label`),value:e.label,placeholder:k(`project.factLabel`),title:e.key?`{{facts.${e.key}}}`:void 0,onChange:t=>c(e.id,{label:t.target.value}),onBlur:()=>{!e.key&&e.label.trim()&&c(e.id,{key:kt(e.label,a.map(e=>e.key))})},className:`max-sm:col-span-3 max-sm:font-medium sm:mr-1`}),e.type===`boolean`?(0,$.jsxs)(`div`,{className:`flex h-11 items-center gap-3`,children:[(0,$.jsx)(_,{checked:Ft(e.value),label:e.label,onChange:t=>c(e.id,{value:k(t?`project.yes`:`project.no`)})}),(0,$.jsx)(`span`,{className:`text-[0.875rem] text-ink-2`,children:Ft(e.value)?k(`project.yes`):k(`project.no`)})]}):(0,$.jsx)(P,{ref:u(`${e.id}:value`),rows:1,minRows:r===`longtext`?2:1,maxRows:10,value:e.value,placeholder:k(`project.factValue`),onChange:t=>c(e.id,{value:t.target.value}),className:`min-h-11`}),(0,$.jsx)(Lt,{type:e.type,detected:t,onChange:t=>c(e.id,{type:t})}),n?null:(0,$.jsx)(M,{label:k(`project.remove`),onClick:()=>o(t=>t.filter(t=>t.id!==e.id)),className:`size-11 rounded-lg hover:text-rose`,children:(0,$.jsx)(h,{className:`size-4`})})]},e.id)})}),a.length<jt.facts&&!n?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${a.length?`mt-4`:``}`,children:[(0,$.jsxs)(j,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`),children:[(0,$.jsx)(f,{className:`size-4`}),` `,k(`project.factAdd`)]}),d.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>l({key:e.key,label:p===`en`?e.en:e.de},`value`),className:`inline-flex h-8 items-center gap-1 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:[(0,$.jsx)(f,{className:`size-3.5`}),` `,p===`en`?e.en:e.de]},e.key))]}):null]})}function zt({project:e,save:t}){let[n,r]=(0,Q.useState)(e.brand.name??``),[i,a]=(0,Q.useState)(e.brand.about??``),o=ke({name:n.trim(),about:i.trim()},e=>t({brand:e}));return(0,$.jsx)(q,{title:k(`project.base`),hint:k(`project.baseHint`),save:o,locked:e.readOnly,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(E,{children:k(`project.title`)}),(0,$.jsx)(O,{value:n,maxLength:120,onChange:e=>r(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:k(`project.titleHint`)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(E,{children:k(`project.about`)}),(0,$.jsx)(P,{minRows:4,value:i,onChange:e=>a(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:k(`project.aboutHint`)})]})]})})}function Bt({project:e,group:t,children:n}){let i=r(),a=X(e.id),[o,s]=(0,Q.useState)(0),c=async t=>{await A.patch(`/api/studio/projects/${e.id}`,t),await i.invalidateQueries({queryKey:[`projects`]})},l=d({mutationFn:()=>A.del(`/api/studio/projects/${e.id}`),onSuccess:()=>i.invalidateQueries({queryKey:[`projects`]})}),u=we(),f=K(),p=a.data??{files:[],embeddings:!0},m=`${e.id}:${o}`,h=e.readOnly,g=t===`knowledge`;return De(h?{}:{title:k(g?`project.assistantTitleKnowledge`:`project.assistantTitle`),hello:k(g?`project.assistantHelloKnowledge`:`project.assistantHello`),placeholder:k(g?`project.assistantComposerKnowledge`:`project.assistantComposer`),suggestions:g?[{label:k(`assistant.suggest.knowledgeHow`)},{label:k(`assistant.suggest.knowledgeSite`),fill:!0},{label:k(`assistant.suggest.knowledgeCategories`)}]:[{label:k(`assistant.suggest.readSite`),fill:!0},{label:k(`assistant.suggest.missing`)},{label:k(`assistant.suggest.facts`)}],summary:g?void 0:[e.brand.name?`title "${e.brand.name}"`:`no title`,`${e.facts.length} facts`,`${e.brand.colors?.length??0} colours`,`${p.files.filter(e=>e.kind===`logo`).length} logos`].join(` · `),onChanged:()=>s(e=>e+1)}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[h?(0,$.jsx)(W,{children:U(e)}):null,t===`info`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{id:`base`,children:(0,$.jsx)(zt,{project:e,save:c},`base:${m}`)}),(0,$.jsx)(Y,{id:`logos`,children:(0,$.jsx)(ut,{projectId:e.id,data:p,readOnly:h})}),(0,$.jsx)(Y,{id:`colors`,children:(0,$.jsx)(Pt,{colors:e.brand.colors??[],save:e=>c({brand:{colors:e}}),readOnly:h},`colors:${m}`)}),(0,$.jsx)(Y,{id:`assets`,children:(0,$.jsx)(mt,{projectId:e.id,data:p,readOnly:h})}),(0,$.jsx)(Y,{id:`facts`,children:(0,$.jsx)(Rt,{facts:e.facts,save:e=>c({facts:e}),readOnly:h},`facts:${m}`)})]}):null,n,t===`info`&&u&&!h&&f?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(j,{variant:`danger`,busy:l.isPending,onClick:()=>confirm(`${k(`settings.delete`)}?`)&&l.mutate(),children:k(`settings.delete`)}),l.error?(0,$.jsx)(`p`,{className:`mt-2 text-[0.875rem] text-rose`,children:l.error.message}):null]}):null]})}var Vt={q:``,mode:``,days:0};function Ht(e,t,n){let r=new URLSearchParams;t&&r.set(`wizard`,t),n.q.trim()&&r.set(`q`,n.q.trim()),n.mode&&r.set(`mode`,n.mode),n.days&&r.set(`days`,String(n.days));let a=r.toString();return i({queryKey:[`results`,e,a],queryFn:()=>A.get(`/api/studio/projects/${e}/results${a&&`?${a}`}`),enabled:!!e,placeholderData:e=>e,refetchInterval:15e3})}function Ut({filter:e,onFilter:t}){let[n,r]=(0,Q.useState)(e.q);return(0,Q.useEffect)(()=>{if(n===e.q)return;let r=setTimeout(()=>t({...e,q:n}),250);return()=>clearTimeout(r)},[n,e,t]),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-0 flex-1 basis-56`,children:[(0,$.jsx)(a,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-3`}),(0,$.jsx)(O,{type:`search`,value:n,onChange:e=>r(e.target.value),placeholder:k(`space.resultsSearch`),"aria-label":k(`space.resultsSearch`),className:`w-full pl-9`})]}),(0,$.jsx)(I,{value:e.mode,onChange:n=>t({...e,mode:n}),options:[{value:``,label:k(`space.resultsModeAll`)},{value:`live`,label:`Live`},{value:`test`,label:`Test`}],className:`w-32`}),(0,$.jsx)(I,{value:String(e.days),onChange:n=>t({...e,days:Number(n)}),options:[{value:`0`,label:k(`space.resultsAnyTime`)},{value:`1`,label:k(`space.resultsDay`)},{value:`7`,label:k(`space.resultsDays`,{n:7})},{value:`30`,label:k(`space.resultsDays`,{n:30})}],className:`w-44`})]})}function Wt({data:e,wizardId:t,filter:n,onFilter:r}){let[i,a]=(0,Q.useState)(null),o=t=>e.wizards.find(e=>e.id===t)?.title??``,s=new Intl.DateTimeFormat(p,{dateStyle:`medium`,timeStyle:`short`});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(q,{title:t?o(t):k(`space.resultsAll`),hint:k(`space.resultsHint`),plain:!0,children:[(0,$.jsx)(Ut,{filter:n,onFilter:r}),e.runs.length?(0,$.jsx)(N,{className:`flex flex-col p-1.5`,children:e.runs.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a(e),className:`flex items-center gap-3 rounded-lg px-3 py-2.5 text-left transition hover:bg-accent`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate text-[0.875rem]`,children:t?s.format(new Date(e.doneAt)):o(e.wizardId)}),(0,$.jsxs)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:[t?null:`${s.format(new Date(e.doneAt))} · `,k(`space.resultCredits`,{n:e.credits})]})]}),e.assets?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[0.75rem] text-ink-3 tabular-nums`,title:k(`space.resultFiles`,{n:e.assets}),children:[(0,$.jsx)(te,{className:`size-3.5`}),e.assets]}):null,e.mode===`test`?(0,$.jsx)(w,{children:`Test`}):(0,$.jsxs)(w,{tone:`live`,children:[`Live v`,e.version]})]},e.id))}):(0,$.jsx)(N,{children:(0,$.jsx)(ie,{children:n.q.trim()||n.mode||n.days?k(`space.resultsNone`):k(`space.resultsEmpty`)})})]}),i?(0,$.jsx)(z,{header:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-[0.875rem]`,children:o(i.wizardId)}),i.mode===`test`?(0,$.jsx)(w,{children:`Test`}):(0,$.jsxs)(w,{tone:`live`,children:[`Live v`,i.version]})]}),onClose:()=>a(null),children:(0,$.jsx)(et,{runId:i.id,compact:!0},i.id)}):null]})}function Gt({project:e,save:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(e.name),o=d({mutationFn:()=>t({name:i.trim()}),onSuccess:()=>r(!1)});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(M,{label:k(`project.rename`),onClick:()=>{a(e.name),r(!0)},children:(0,$.jsx)(ee,{className:`size-4`})}),(0,$.jsx)(T,{open:n,onClose:()=>r(!1),title:k(`project.rename`),children:(0,$.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.trim()&&o.mutate()},children:[(0,$.jsx)(O,{"data-autofocus":!0,value:i,maxLength:80,onChange:e=>a(e.target.value)}),o.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:o.error.message}):null,(0,$.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,$.jsx)(j,{variant:`ghost`,onClick:()=>r(!1),children:k(`common.cancel`)}),(0,$.jsx)(j,{type:`submit`,busy:o.isPending,disabled:!i.trim(),children:k(`settings.save`)})]})]})})]})}function Kt({project:e}){let t=r();return(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(We,{}),e.readOnly?null:(0,$.jsx)(Gt,{project:e,save:async n=>{await A.patch(`/api/studio/projects/${e.id}`,n),await t.invalidateQueries({queryKey:[`projects`]})}})]})}function qt(e){let t=e.join(` `),[n,r]=(0,Q.useState)(e[0]);return(0,Q.useEffect)(()=>{let e=t.split(` `),n=0,i=()=>{n=0;let t=Ie(),i=t.scrollTop>0&&t.clientHeight+t.scrollTop>=t.scrollHeight-4,a=(t===document.documentElement?0:t.getBoundingClientRect().top)+Math.max(120,t.clientHeight/3),o=e[0];for(let t of e){let e=document.getElementById(t)?.getBoundingClientRect().top;e!==void 0&&e<=a&&(o=t)}r(i?e.at(-1):o)},a=()=>{n||=requestAnimationFrame(i)};return i(),window.addEventListener(`scroll`,a,{passive:!0,capture:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(n),window.removeEventListener(`scroll`,a,{capture:!0}),window.removeEventListener(`resize`,a)}},[t]),n}function Jt(e,t){let n=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;document.getElementById(e)?.scrollIntoView({block:`start`,behavior:t&&!n?`smooth`:`auto`})}function Yt({groups:e,current:t,onPick:n}){return e.map(e=>{let r=e.sections.map(e=>(0,$.jsx)(Z,{icon:e.icon??l,label:e.label,selected:e.id===t,onPick:()=>n(e.id)},e.id));return e.label?(0,$.jsx)(qe,{label:e.label,children:r},e.plugin):(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:r},`own`)})}function Xt(){let{group:e}=ne(),[t,n]=se(),r=ce(),i=oe(),{hash:a}=i,{project:o,loading:s}=Te(),l=we(),u=ze(),d=$e(),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),v=Pe(e)?e:void 0,ee=i.state?.parts===!0,te=Ve().map(e=>({...e,to:`/space/${e.id}`})),b=te.find(e=>e.id===v),x=t.get(`show`),S=v?x?2:1:0,C=d?Math.min(S,1):v&&g!==v&&!ee?1:0,re=Ke(C),w=Ke(S),T=(0,Q.useMemo)(()=>({slot:f,narrow:d,setDetail:h}),[f,d]),E=o?o.brand.name?.trim()||o.name:k(`nav.project`),O=v&&v!==`results`?Fe(v,u):[],A=v?Fe(v,u).filter(e=>e.plugin):[],j=qt([...O,...v===`results`?A:[]].flatMap(e=>e.sections.map(e=>e.id))),M=v===`results`&&x&&x!==`all`?x:null,[ae,N]=(0,Q.useState)(Vt),P=Ht(v===`results`?o?.id:void 0,M,ae),F=P.data?.wizards.find(e=>e.id===M)?.title,I=v===`data`&&x&&x!==`all`||v===`knowledge`&&x&&/^[ptfcvs]:/.test(x)?x:null,L=I?.startsWith(`s:`)?u.spaceSections.find(e=>e.id===I.slice(2)):void 0,R=v===`knowledge`&&I&&/^[ptf]:/.test(I)?I:null,z=de(v===`data`?o?.id:void 0),B=_e(v===`knowledge`?o?.id:void 0),V=Se(I?.startsWith(`v:`)?I.slice(2):``),H=B.data?.categories.find(e=>e.id===(I?.startsWith(`c:`)?I.slice(2):V.data?.category.id)),U=v===`knowledge`?L?L.label():I?.startsWith(`v:`)?V.data&&`${V.data.category.name}: ${V.data.value}`:I?.startsWith(`c:`)?H?.name:B.data?.items.find(e=>e.key===I)?.title:z.data?be(z.data).flatMap(e=>e.items).find(e=>e.key===I)?.title:void 0;Me([{label:k(`nav.project`),to:`/space`},...b?[{label:b.label,to:`/space/${b.id}`}]:[],...b&&(m??F??U)?[{label:m??F??U}]:[]]);let Ce={p:`page`,t:`table`,f:`file`,c:`kategorie`,v:`kategorie value`,s:`plugin section`};De({...v===`data`||v===`results`?{compact:!0}:{},...v===`data`?{suggestions:[{label:k(`assistant.suggest.dataWhat`)},{label:k(`assistant.suggest.dataWho`)},{label:k(`assistant.suggest.dataEdit`)}]}:v===`results`?{suggestions:[{label:k(`assistant.suggest.resultsFailed`)},{label:k(`assistant.suggest.resultsCost`)},{label:k(`assistant.suggest.resultsShare`)}]}:{},...I&&U?{open:{kind:Ce[I[0]]??`item`,id:I.slice(2),label:U}}:M&&F?{open:{kind:`wizard`,id:M,label:F}}:{}});let W=v===`results`||v===`data`||I?a.slice(1):x||a.slice(1),G=(0,Q.useRef)(``);if((0,Q.useEffect)(()=>{let e=`${v}#${W}`;W&&G.current!==e&&document.getElementById(W)&&(G.current=e,requestAnimationFrame(()=>Jt(W,!1)))},[v,W,o?.id,u.spaceSections]),!v){let t=a.slice(1),n=t?Ue(t,u):null;if(n===`knowledge`&&u.spaceSections.some(e=>e.id===t))return(0,$.jsx)(D,{to:`/space/knowledge?show=s:${t}`,replace:!0});if(n)return(0,$.jsx)(D,{to:d?`/space/${n}?show=${t}`:{pathname:`/space/${n}`,hash:t},replace:!0});if(t&&u.status!==`ready`)return null;if(e!==void 0||!d)return(0,$.jsx)(D,{to:`/space/info`,replace:!0,state:{parts:!0}})}if(v===`knowledge`&&!x&&u.spaceSections.some(e=>e.id===a.slice(1)))return(0,$.jsx)(D,{to:`/space/knowledge?show=s:${a.slice(1)}`,replace:!0});let K=e=>{if(d){r({search:`?show=${e}`});return}G.current=`${v}#${e}`,Jt(e,!0),r({search:``,hash:e},{replace:!0})},J=e=>d?n({show:e}):n(e===`all`?{}:{show:e},{replace:!0}),Ee=e=>e.flatMap(e=>e.sections).map(e=>u.spaceSections.find(t=>t.id===e.id)).filter(e=>e!==void 0).map(e=>(0,$.jsx)(Y,{id:e.id,children:(0,$.jsx)(q,{title:e.label(),hint:e.hint?.(),plain:!0,children:(0,$.jsx)(He,{of:e,children:(0,$.jsx)(e.component,{})})})},e.serial)),X=d?void 0:j;return(0,$.jsx)(Ye.Provider,{value:T,children:(0,$.jsx)(`div`,{className:`animate-rise`,children:(0,$.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-[13.5rem_minmax(0,1fr)] md:gap-8 lg:grid-cols-[15rem_minmax(0,1fr)] lg:gap-10`,children:[(0,$.jsxs)(`aside`,{className:y(`min-w-0 md:sticky md:top-6 md:self-start`,d&&S===2&&`hidden`,d&&w===`back`&&Ge(`back`)),children:[(0,$.jsx)(Je,{title:E,open:C===1?b??null:null,onBack:()=>d?r(`/space`):_(v??null)}),(0,$.jsx)(`div`,{className:y(Ge(re)),children:C===0?(0,$.jsx)(Xe,{entries:te,current:d?void 0:b,onPick:()=>_(null)}):(0,$.jsx)(`div`,{ref:p})},C)]}),v?(0,$.jsxs)(`div`,{className:y(`min-w-0`,d&&S<2&&`hidden`,d&&w===`deeper`&&Ge(`deeper`)),children:[d?(0,$.jsx)(`div`,{className:`mb-3`,children:(0,$.jsx)(Qe,{label:b?.label??E,onBack:()=>r(`/space/${v}`)})}):null,l&&o?(0,$.jsx)(`div`,{className:`mb-6`,children:(0,$.jsx)(Kt,{project:o})}):null,v===`results`?(0,$.jsxs)(Ze,{children:[(0,$.jsxs)(`ul`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(Z,{icon:nt,label:k(`space.resultsAll`),selected:!d&&!M,onPick:()=>J(`all`)}),P.data?.wizards.filter(e=>e.results||e.id===M).map(e=>(0,$.jsx)(Z,{icon:c,label:e.title,badge:e.results?(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:e.results}):null,selected:!d&&e.id===M,onPick:()=>J(e.id)},e.id))]}),(0,$.jsx)(Yt,{groups:A,current:X,onPick:K})]}):v===`data`?(0,$.jsxs)(Ze,{children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(0,$.jsx)(Z,{icon:Be,label:k(`data.all`),selected:!d&&!I,onPick:()=>J(`all`)})}),z.data?be(z.data).map(e=>(0,$.jsx)(qe,{label:e.label,children:e.items.map(e=>(0,$.jsx)(Z,{icon:ue[e.kind],label:e.title,selected:!d&&e.key===I,onPick:()=>J(e.key)},e.key))},e.key)):null,(0,$.jsx)(Yt,{groups:A,current:X,onPick:K})]}):v===`knowledge`?(0,$.jsxs)(Ze,{children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(0,$.jsx)(Z,{icon:Be,label:k(`know.all`),selected:!(d||I),onPick:()=>J(`all`)})}),B.data?.categories.length?(0,$.jsx)(qe,{label:k(`know.categories`),children:B.data.categories.map(e=>(0,$.jsx)(Z,{icon:me[e.type],label:e.name,badge:(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:e.proposed?`·`:e.count}),selected:!d&&(I===`c:${e.id}`||V.data?.category.id===e.id),onPick:()=>J(`c:${e.id}`)},e.id))}):null,(0,$.jsx)(Yt,{groups:A,current:d?void 0:L?.id,onPick:e=>J(`s:${e}`)})]}):(0,$.jsx)(Ze,{children:(0,$.jsx)(Yt,{groups:O,current:X,onPick:K})}),o&&(v===`info`||v===`knowledge`)?(0,$.jsxs)(Bt,{project:o,group:v,children:[v===`knowledge`?R?R.startsWith(`p:`)?(0,$.jsx)(ge,{pageId:R.slice(2),onGone:()=>J(`all`),onOpen:J},R):R.startsWith(`t:`)?(0,$.jsx)(he,{tableId:R.slice(2),onGone:()=>J(`all`)},R):(0,$.jsx)(yt,{projectId:o.id,fileId:R.slice(2),readOnly:o.readOnly,onGone:()=>J(`all`)},R):B.data?L?(0,$.jsx)(q,{title:L.label(),hint:L.hint?.(),plain:!0,children:(0,$.jsx)(He,{of:L,children:(0,$.jsx)(L.component,{})})},I):I?.startsWith(`c:`)?H?(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsx)(pe,{projectId:o.id,category:H,readOnly:o.readOnly,onOpen:J,onGone:()=>J(`all`)}),H.type===`choice`?null:(0,$.jsx)(xe,{projectId:o.id,category:H,categories:B.data.categories,onOpen:J})]},I):null:I?.startsWith(`v:`)?V.data?(0,$.jsx)(le,{value:V.data,readOnly:o.readOnly,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[V.data.items.length?(0,$.jsx)(`div`,{className:`flex flex-col rounded-xl bg-card p-1.5 shadow-soft ring-1 ring-border-soft`,children:V.data.items.map(e=>(0,$.jsx)(fe,{item:e,categories:B.data.categories.filter(e=>e.id!==V.data?.category.id),onOpen:J},e.key))}):null,V.data.rows.map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>J(`t:${e.tableId}`),className:`px-1 text-left text-[0.8125rem] text-ink-3 hover:text-ink`,children:k(`know.tocRows`,{n:e.count,table:e.title})},e.tableId))]})},I):null:(0,$.jsx)(Y,{id:`documents`,children:(0,$.jsx)(ye,{projectId:o.id,data:B.data,readOnly:o.readOnly,onOpen:J})}):null:null,v===`info`?Ee(A):null]},o.id):null,o&&v===`data`?(0,$.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:I?.startsWith(`t:`)?(0,$.jsx)(he,{tableId:I.slice(2),onGone:()=>J(`all`)},I):I?.startsWith(`p:`)?(0,$.jsx)(ge,{pageId:I.slice(2),onGone:()=>J(`all`)},I):(0,$.jsxs)($.Fragment,{children:[z.data?(0,$.jsx)(ve,{projectId:o.id,data:z.data,readOnly:o.readOnly,onOpen:J}):null,Ee(A)]})}):null,o&&v===`results`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[P.data?(0,$.jsx)(Wt,{data:P.data,wizardId:M,filter:ae,onFilter:N}):null,P.isError?(0,$.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:P.error.message}):null,Ee(A)]}):null,o||s?null:(0,$.jsx)(ie,{children:k(`settings.noProject`)})]}):null]})})})}export{Xt as ProjectPage};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{O as r,r as i}from"./logo-C4V2_3Ar.js";import{_ as a,g as o,m as s,p as c,v as l,w as u}from"./Marketplace-B-gy2onK.js";import{t as d}from"./useMutation-DKyQXgyj.js";import{Bt as f,Dt as p,Jt as m,Nt as h,Rt as g,St as _,T as v,Tt as y,Vt as ee,Wt as te,Yt as b,Zt as x,an as S,bn as ne,bt as C,dn as re,dt as w,ft as T,gt as E,hn as D,ht as O,kt as k,l as A,lt as j,mt as M,pt as ie,sn as ae,ut as N,vn as oe,wt as P,xn as se,xt as F,yn as ce,yt as I}from"./ui-DAHMnAVc.js";import{_ as le,a as ue,b as L,c as de,d as fe,f as R,g as pe,h as me,i as he,l as ge,m as _e,n as z,o as ve,p as ye,s as be,u as xe,v as Se,x as B,y as V}from"./RunDrawer-8sjkAbm5.js";import{t as H}from"./phone-CA2A8W7I.js";import{n as U,r as Ce,t as W}from"./ReadOnly-CaGzgOPe.js";import{t as G}from"./upload-DLbJVvfd.js";import{c as K,l as we,s as Te}from"./session-DBOQL_bg.js";import{A as q,D as J,E as Y,F as Ee,H as De,I as X,M as Oe,N as ke,O as Ae,P as je,_ as Me,d as Ne,f as Pe,g as Fe,j as Ie,k as Le,l as Re,lt as ze,p as Be,s as Ve,u as He,ut as Ue,v as We}from"./index-DkDBEMwz.js";import{a as Z,c as Ge,f as Ke,i as qe,n as Je,o as Ye,r as Xe,s as Ze,t as Qe,u as $e}from"./settings-menu-DxswVOqQ.js";import{t as et}from"./RunnerView-CJ4cLA_0.js";var tt={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};tt.node;var nt=re(tt),rt={name:`music`,size:24,node:[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]};rt.node;var it=re(rt),Q=e(t(),1),$=e(n(),1),at={backgroundImage:`repeating-conic-gradient(#c9c9c9 0% 25%, #dedede 0% 50%)`,backgroundSize:`16px 16px`};function ot({file:e,actions:t}){let[n,r]=(0,Q.useState)(e.description),i=(0,Q.useRef)(e.description),a=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{e.description!==i.current&&(r(t=>t===i.current?e.description:t),i.current=e.description)},[e.description]),(0,Q.useLayoutEffect)(()=>{let e=a.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)},[n]);let o=e.status===`pending`&&!n;return t.readOnly?n?(0,$.jsx)(`p`,{className:`text-[0.8125rem] text-ink-2 leading-snug`,children:n}):null:(0,$.jsx)(`textarea`,{ref:a,rows:1,value:n,maxLength:600,placeholder:k(o?`project.describing`:`project.description`),onChange:e=>r(e.target.value),onBlur:()=>{n.trim()!==e.description&&(i.current=n.trim(),t.describe(e.id,n.trim()))},className:`-mx-1 block w-[calc(100%+0.5rem)] resize-none overflow-hidden rounded-md bg-transparent px-1 py-0.5 text-[0.8125rem] text-ink-2 leading-snug outline-none transition placeholder:text-ink-4 hover:bg-paper-2 focus:bg-card focus:text-ink focus:ring-1 focus:ring-border`})}function st(e,t){confirm(k(`project.removeConfirm`,{name:e.name}))&&t.remove(e.id)}function ct({projectId:e,file:t,small:n}){let r=Oe(e,t.id);return t.mime.startsWith(`image/`)?(0,$.jsx)(`img`,{src:r,alt:``,loading:`lazy`,className:y(`size-full`,t.kind===`logo`?`object-contain p-3`:`object-cover`)}):t.mime.startsWith(`video/`)?(0,$.jsx)(`video`,{src:`${r}#t=0.1`,preload:`metadata`,controls:!n,className:`size-full object-cover`}):(0,$.jsx)(`div`,{className:`flex size-full items-center justify-center text-ink-3`,children:t.mime.startsWith(`audio/`)?(0,$.jsx)(it,{className:n?`size-5`:`size-7`}):(0,$.jsx)(b,{className:n?`size-5`:`size-7`})})}function lt({projectId:e,kind:t,files:n,actions:r,accept:i,addLabel:a,onPreview:s}){return(0,$.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(184px,1fr))] gap-3`,children:[n.map((i,a)=>(0,$.jsxs)(`div`,{className:`group relative flex flex-col gap-1.5 rounded-lg bg-paper p-2 pb-2.5 ring-1 ring-border-soft`,children:[t===`logo`&&a===0?(0,$.jsx)(`span`,{className:`absolute -top-3 left-3 z-10 rounded-full ring-2 ring-card`,children:(0,$.jsx)(w,{tone:`ember`,children:k(`project.logoMain`)})}):null,(0,$.jsxs)(`div`,{className:`relative h-28 overflow-hidden rounded-md bg-paper-2`,style:t===`logo`?at:void 0,children:[s&&i.mime.startsWith(`image/`)?(0,$.jsx)(`button`,{type:`button`,"aria-label":`${k(`project.preview`)}: ${i.name}`,onClick:()=>s(i),className:`block size-full cursor-zoom-in`,children:(0,$.jsx)(ct,{projectId:e,file:i})}):(0,$.jsx)(ct,{projectId:e,file:i}),(0,$.jsxs)(`div`,{className:`absolute top-1 right-1 flex gap-1 opacity-0 transition focus-within:opacity-100 group-hover:opacity-100 coarse:opacity-100`,children:[s?(0,$.jsx)(M,{label:k(`project.preview`),onClick:()=>s(i),className:`size-8 bg-card shadow-soft`,children:(0,$.jsx)(u,{className:`size-4`})}):null,t===`logo`&&a>0&&!r.readOnly?(0,$.jsx)(M,{label:k(`project.logoMakeMain`),onClick:()=>r.order(`logo`,[i.id,...n.filter(e=>e.id!==i.id).map(e=>e.id)]),className:`size-8 bg-card shadow-soft`,children:(0,$.jsx)(o,{className:`size-4`})}):null,r.readOnly?null:(0,$.jsx)(M,{label:k(`project.remove`),onClick:()=>st(i,r),className:`size-8 bg-card shadow-soft hover:text-rose`,children:(0,$.jsx)(h,{className:`size-4`})})]})]}),t===`asset`?(0,$.jsx)(`div`,{className:`truncate px-0.5 text-[0.75rem] text-ink-3`,title:i.name,children:i.name}):null,(0,$.jsx)(ot,{file:i,actions:r})]},i.id)),a&&!r.readOnly?(0,$.jsxs)(J,{accept:i,multiple:!1,onFiles:e=>r.upload(t,e),className:`min-h-28 flex-col p-3`,children:[r.busy?(0,$.jsx)(C,{className:`size-5`}):(0,$.jsx)(f,{className:`size-5`}),a]}):null]})}function ut({projectId:e,data:t,readOnly:n}){let r=je(e,n);return(0,$.jsxs)(q,{title:k(`project.logos`),hint:k(`project.logosHint`),children:[(0,$.jsx)(lt,{projectId:e,kind:`logo`,files:t.files.filter(e=>e.kind===`logo`),actions:r,accept:`image/*`,addLabel:k(`project.logoAdd`)}),r.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:r.error}):null]})}var dt=e=>[(e.name.includes(`.`)?e.name.split(`.`).pop():e.mime.split(`/`).pop())?.toUpperCase().slice(0,5),Ie(e.size)].filter(Boolean).join(` · `);function ft({projectId:e,file:t,actions:n,onClose:r}){let i=Oe(e,t.id);return(0,$.jsxs)(T,{open:!0,onClose:r,wide:`page`,title:t.name,children:[(0,$.jsxs)(`div`,{className:`-mt-2 mb-4 flex items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:dt(t)}),(0,$.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,"aria-label":k(`project.openOriginal`),title:k(`project.openOriginal`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,$.jsx)(x,{className:`size-4`})})]}),t.mime.startsWith(`image/`)?(0,$.jsx)(`div`,{className:`overflow-hidden rounded-lg`,style:at,children:(0,$.jsx)(`img`,{src:i,alt:``,className:`mx-auto max-h-[68dvh] object-contain`})}):t.mime.startsWith(`video/`)?(0,$.jsx)(`video`,{src:i,controls:!0,className:`max-h-[68dvh] w-full rounded-lg bg-black`}):(0,$.jsx)(`audio`,{src:i,controls:!0,className:`w-full`}),(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(ot,{file:t,actions:n})})]})}function pt({projectId:e,file:t,actions:n,onPreview:r}){return(0,$.jsxs)(`li`,{className:`flex items-start gap-3 rounded-lg bg-paper p-2 ring-1 ring-border-soft`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`${k(`project.preview`)}: ${t.name}`,onClick:r,className:`size-14 shrink-0 cursor-zoom-in overflow-hidden rounded-md bg-paper-2`,children:(0,$.jsx)(ct,{projectId:e,file:t,small:!0})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 py-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:r,title:t.name,className:`min-w-0 truncate font-medium text-[0.875rem] hover:underline`,children:t.name}),(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:dt(t)})]}),(0,$.jsx)(ot,{file:t,actions:n})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start`,children:[(0,$.jsx)(M,{label:k(`project.preview`),onClick:r,children:(0,$.jsx)(u,{className:`size-4`})}),n.readOnly?null:(0,$.jsx)(M,{label:k(`project.remove`),onClick:()=>st(t,n),className:`hover:text-rose`,children:(0,$.jsx)(h,{className:`size-4`})})]})]})}function mt({projectId:e,data:t,readOnly:n}){let r=je(e,n),[i,a]=Ee(`assets`,`cards`),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(null),u=t.files.filter(e=>e.kind===`asset`),d=u.find(e=>e.id===c),f=o.trim().toLowerCase(),p=f?u.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(f)):u;return(0,$.jsxs)(q,{title:k(`project.assets`),hint:k(`project.assetsHint`),children:[u.length?(0,$.jsx)(Ae,{layout:i,onToggle:a,children:(0,$.jsx)(Le,{value:o,onChange:s,placeholder:k(`project.assetSearch`)})}):null,p.length?(0,$.jsx)(`div`,{className:`mb-3`,children:i===`cards`?(0,$.jsx)(lt,{projectId:e,kind:`asset`,files:p,actions:r,onPreview:e=>l(e.id)}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.map(t=>(0,$.jsx)(pt,{projectId:e,file:t,actions:r,onPreview:()=>l(t.id)},t.id))})}):null,n?u.length?null:(0,$.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:k(`project.staysLocal`)}):(0,$.jsxs)(J,{accept:`image/*,video/*,audio/*`,onFiles:e=>r.upload(`asset`,e),className:`h-16 w-full`,children:[r.busy?(0,$.jsx)(C,{className:`size-4`}):(0,$.jsx)(G,{className:`size-4`}),k(`project.drop`),` `,(0,$.jsx)(`span`,{className:`underline`,children:k(`project.assetAdd`)})]}),r.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:r.error}):null,d?(0,$.jsx)(ft,{projectId:e,file:d,actions:r,onClose:()=>l(null)}):null]})}function ht(e,t,n){return i({queryKey:[`project-file-text`,t.id,t.chars,n],queryFn:()=>A.get(`/api/studio/projects/${e}/files/${t.id}/text?limit=${n}`),enabled:t.status===`ready`,staleTime:6e4})}function gt(e){return((e.name.includes(`.`)?e.name.split(`.`).pop():``)||e.mime.split(`/`).pop()||``).toUpperCase().slice(0,5)}var _t=e=>[gt(e),e.pages?k(`project.pages`,{n:e.pages}):null,Ie(e.size)].filter(Boolean).join(` · `),vt=2e5;function yt({projectId:e,fileId:t,readOnly:n,onGone:i}){let a=r(),o=X(e),s=_e(e),c=je(e,n),l=o.data?.files.find(e=>e.id===t),u=l?l.mime===`application/pdf`||l.mime.startsWith(`image/`):!1,[d,f]=(0,Q.useState)(null);if(!l)return o.isLoading?(0,$.jsx)(C,{className:`mx-auto text-ink-3`}):null;let p=d??(u?`original`:`text`),m=s.data?.items.find(e=>e.key===`f:${l.id}`),_=Oe(e,l.id),v=(e,t)=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":p===e,onClick:()=>f(e),className:y(`rounded-full px-3 py-1 text-[0.8125rem] transition`,p===e?`bg-paper-2 font-medium text-ink`:`text-ink-3 hover:text-ink`),children:t});return(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 px-1`,children:[(0,$.jsx)(`h2`,{className:`min-w-0 flex-1 truncate font-display font-semibold text-lg`,children:l.name}),(0,$.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 max-sm:hidden`,children:_t(l)}),(0,$.jsx)(`a`,{href:_,target:`_blank`,rel:`noreferrer`,"aria-label":k(`project.openOriginal`),title:k(`project.openOriginal`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,$.jsx)(x,{className:`size-4`})}),n?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(M,{label:k(`project.reindex`),onClick:async()=>{await c.reindex(l.id),await a.invalidateQueries({queryKey:[`knowledge`,e]})},children:(0,$.jsx)(g,{className:`size-4`})}),(0,$.jsx)(M,{label:k(`know.deleteFile`),className:`hover:text-rose`,onClick:async()=>{confirm(k(`data.confirmDelete`,{title:l.name}))&&(await c.remove(l.id),await a.invalidateQueries({queryKey:[`knowledge`,e]}),i())},children:(0,$.jsx)(h,{className:`size-4`})})]})]}),(0,$.jsx)(R,{projectId:e,itemKey:`f:${l.id}`,has:m?.categories??[],originLabel:m?.originLabel??null,kept:!1,review:null,file:null,readOnly:n,onReviewed:()=>void 0}),(0,$.jsx)(`div`,{className:`px-1`,children:(0,$.jsx)(ot,{file:l,actions:c})}),l.status===`failed`?(0,$.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:l.error}):null,(0,$.jsxs)(N,{className:`flex flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1 border-border-soft border-b px-2 py-1.5`,children:[u?v(`original`,k(`project.original`)):null,v(`text`,k(`project.readText`))]}),p===`original`?l.mime===`application/pdf`?(0,$.jsx)(`iframe`,{src:_,title:l.name,className:`h-[70dvh] w-full rounded-b-xl bg-paper-2`}):(0,$.jsx)(`img`,{src:_,alt:``,className:`mx-auto max-h-[70dvh] object-contain p-4`}):(0,$.jsx)(bt,{projectId:e,file:l})]})]})}function bt({projectId:e,file:t}){let n=ht(e,t,vt);return n.isLoading||t.status===`pending`?(0,$.jsx)(`div`,{className:`flex h-40 items-center justify-center text-ink-3`,children:(0,$.jsx)(C,{})}):n.data?.text?(0,$.jsxs)(`div`,{className:`overflow-x-auto p-4 sm:p-5`,children:[(0,$.jsx)(v,{text:n.data.text,className:`text-[0.875rem]`}),n.data.chars>n.data.text.length?(0,$.jsx)(`p`,{className:`mt-3 text-[0.8125rem] text-ink-3`,children:k(`project.textCut`,{shown:n.data.text.length.toLocaleString(),total:n.data.chars.toLocaleString()})}):null]}):(0,$.jsx)(`p`,{className:`py-8 text-center text-[0.875rem] text-ink-3`,children:k(`project.noText`)})}var xt=[`text`,`longtext`,`number`,`date`,`url`,`email`,`phone`,`boolean`],St=/^(\d{4}-\d{2}-\d{2}|\d{1,2}\.\s?\d{1,2}\.\s?\d{4})$/,Ct=/^[+-]?\d{1,3}([.,\s']?\d{3})*([.,]\d+)?$/,wt=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,Tt=/^(https?:\/\/|www\.)\S+$/i,Et=/^\+?[\d\s()/.-]{7,20}$/,Dt=/^(ja|nein|yes|no|true|false)$/i;function Ot(e){let t=e.trim();return t?t.includes(`
|
|
2
|
+
`)||t.length>140?`longtext`:Dt.test(t)?`boolean`:wt.test(t)?`email`:Tt.test(t)?`url`:St.test(t)?`date`:Ct.test(t)&&!/^(\+|0\d)/.test(t)?`number`:Et.test(t)&&t.replace(/\D/g,``).length>=7?`phone`:`text`:`text`}function kt(e,t=[]){let n=e.toLowerCase().replace(/ä/g,`ae`).replace(/ö/g,`oe`).replace(/ü/g,`ue`).replace(/ß/g,`ss`).normalize(`NFD`).replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,40)||`fakt`,r=n;for(let e=2;t.includes(r);e++)r=`${n}_${e}`;return r}var At=[{key:`adresse`,de:`Adresse`,en:`Address`},{key:`plz`,de:`PLZ`,en:`Postcode`},{key:`ort`,de:`Ort`,en:`City`},{key:`uid`,de:`UID`,en:`VAT id`},{key:`telefon`,de:`Telefon`,en:`Phone`},{key:`e_mail`,de:`E-Mail`,en:`Email`},{key:`website`,de:`Website`,en:`Website`},{key:`iban`,de:`IBAN`,en:`IBAN`}],jt={facts:100,colors:12,files:{logo:8,asset:100,document:2e3},bytes:{logo:5e6,asset:15e6,video:8e7,document:3e7}},Mt=/^#[0-9a-fA-F]{6}$/;function Nt({onAdd:e,onClose:t}){let[n,r]=(0,Q.useState)(`#e0531b`),[i,a]=(0,Q.useState)(``),o=Mt.test(n);return(0,$.jsx)(T,{open:!0,onClose:t,title:k(`project.colorAddTitle`),children:(0,$.jsxs)(`form`,{onSubmit:r=>{r.preventDefault(),o&&(e({name:i.trim(),value:n.toLowerCase()}),t())},className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(E,{children:k(`project.colorValue`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(F,{value:o?n:`#888888`,onChange:e=>r(e.target.value)}),(0,$.jsx)(O,{value:n,placeholder:`#e0531b`,spellCheck:!1,onChange:e=>r(e.target.value.trim()),className:`font-mono text-[0.875rem]`})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(E,{children:k(`project.colorUseLabel`)}),(0,$.jsx)(O,{autoFocus:!0,value:i,maxLength:120,placeholder:k(`project.colorName`),onChange:e=>a(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:k(`project.colorUse`)})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(j,{variant:`ghost`,onClick:t,children:k(`common.cancel`)}),(0,$.jsx)(j,{type:`submit`,disabled:!o,children:k(`project.add`)})]})]})})}function Pt({colors:e,save:t,readOnly:n}){let r=(0,Q.useRef)(0),[i,a]=(0,Q.useState)(()=>e.map(e=>({...e,id:`c${r.current++}`}))),[o,s]=(0,Q.useState)(!1),c=ke(i.filter(e=>Mt.test(e.value)).map(({name:e,value:t})=>({name:e.trim(),value:t})),t),l=(e,t)=>a(n=>n.map(n=>n.id===e?{...n,...t}:n));return(0,$.jsxs)(q,{title:k(`project.colors`),hint:k(`project.colorsHint`),save:c,locked:n,children:[(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(F,{value:Mt.test(e.value)?e.value:`#888888`,onChange:t=>l(e.id,{value:t.target.value})}),(0,$.jsx)(O,{value:e.name,placeholder:k(`project.colorName`),maxLength:120,onChange:t=>l(e.id,{name:t.target.value}),className:`min-w-0 flex-1`}),(0,$.jsx)(O,{value:e.value,placeholder:`#e0531b`,spellCheck:!1,onChange:t=>l(e.id,{value:t.target.value.trim()}),className:`w-28 font-mono text-[0.8125rem]`}),(0,$.jsxs)(`div`,{className:`flex w-24 shrink-0 items-center justify-end max-sm:w-auto`,children:[t===0?(0,$.jsx)(`span`,{className:`mr-1 max-sm:hidden`,children:(0,$.jsx)(w,{tone:`ember`,children:k(`project.colorAccent`)})}):n?null:(0,$.jsx)(M,{label:k(`project.colorFirst`),onClick:()=>a(t=>[e,...t.filter(t=>t.id!==e.id)]),children:(0,$.jsx)(ae,{className:`size-4`})}),n?null:(0,$.jsx)(M,{label:k(`project.remove`),onClick:()=>a(t=>t.filter(t=>t.id!==e.id)),className:`hover:text-rose`,children:(0,$.jsx)(h,{className:`size-4`})})]})]},e.id))}),i.length&&!n?(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:k(`project.colorUse`)}):null,i.length<jt.colors&&!n?(0,$.jsxs)(j,{variant:`secondary`,size:`sm`,className:i.length?`mt-3`:void 0,onClick:()=>s(!0),children:[(0,$.jsx)(f,{className:`size-4`}),` `,k(`project.colorAdd`)]}):null,o?(0,$.jsx)(Nt,{onClose:()=>s(!1),onAdd:e=>a(t=>[...t,{...e,id:`c${r.current++}`}])}):null]})}var Ft=e=>/^(ja|yes|true)$/i.test(e.trim()),It={text:s,longtext:Ce,number:L,date:B,url:m,email:ze,phone:H,boolean:V};function Lt({type:e,detected:t,onChange:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(!r)return;let e=e=>{s.current?.contains(e.target)||i(!1)},t=e=>e.key===`Escape`&&i(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[r]);let l=It[e??t],u=`${k(`project.factType`)}: ${k(`project.type.${e??t}`)}`,d=`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[0.875rem] text-ink-2 hover:bg-accent hover:text-ink`,f=e=>{n(e),i(!1)};return(0,$.jsxs)(`div`,{className:`relative`,ref:s,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":u,title:u,"aria-haspopup":`menu`,"aria-expanded":r,onClick:e=>{o(window.innerHeight-e.currentTarget.getBoundingClientRect().bottom<400),i(e=>!e)},className:y(`inline-flex size-11 items-center justify-center rounded-lg transition hover:bg-accent hover:text-ink`,r?`bg-accent text-ink`:e?`text-ink-2`:`text-ink-4`),children:(0,$.jsx)(l,{className:`size-4`})}),r?(0,$.jsxs)(`div`,{role:`menu`,className:y(`absolute right-0 z-50 w-56 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,a?`bottom-12`:`top-12`),children:[(0,$.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":!e,className:d,onClick:()=>f(void 0),children:[(0,$.jsx)(c,{className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{className:`flex-1`,children:k(`project.factAuto`)}),(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-4`,children:k(`project.type.${t}`)}),(0,$.jsx)(S,{className:y(`size-4 shrink-0`,e&&`invisible`)})]}),(0,$.jsx)(`div`,{className:`mx-2 my-1 h-px bg-border-soft`}),xt.map(t=>{let n=It[t];return(0,$.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e===t,className:d,onClick:()=>f(t),children:[(0,$.jsx)(n,{className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{className:`flex-1`,children:k(`project.type.${t}`)}),(0,$.jsx)(S,{className:y(`size-4 shrink-0`,e!==t&&`invisible`)})]},t)})]}):null]})}function Rt({facts:e,save:t,readOnly:n}){let r=(0,Q.useRef)(0),i=(0,Q.useRef)(null),[a,o]=(0,Q.useState)(()=>e.map(e=>({...e,id:`f${r.current++}`}))),s=ke(a.filter(e=>e.key&&e.label.trim()).map(({key:e,label:t,value:n,type:r})=>({key:e,label:t.trim(),value:n,...r?{type:r}:{}})),t),c=(e,t)=>o(n=>n.map(n=>n.id===e?{...n,...t}:n)),l=(e,t,n=!1)=>{let a=`f${r.current++}`;i.current=`${a}:${t}`;let s={id:a,key:``,label:``,value:``,...e};o(e=>n?[s,...e]:[...e,s])},u=e=>t=>{t&&i.current===e&&(i.current=null,t.focus())},d=At.filter(e=>!a.some(t=>t.key===e.key));return(0,$.jsxs)(q,{title:k(`project.facts`),hint:k(`project.factsHint`),save:s,locked:n,action:a.length<jt.facts&&!n?(0,$.jsxs)(j,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`,!0),children:[(0,$.jsx)(f,{className:`size-4`}),` `,k(`project.factAdd`)]}):null,children:[(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>{let t=Ot(e.value),r=e.type??t;return(0,$.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] items-start gap-x-1 gap-y-2 sm:grid-cols-[minmax(0,2fr)_minmax(0,3fr)_auto_auto]`,children:[(0,$.jsx)(O,{ref:u(`${e.id}:label`),value:e.label,placeholder:k(`project.factLabel`),title:e.key?`{{facts.${e.key}}}`:void 0,onChange:t=>c(e.id,{label:t.target.value}),onBlur:()=>{!e.key&&e.label.trim()&&c(e.id,{key:kt(e.label,a.map(e=>e.key))})},className:`max-sm:col-span-3 max-sm:font-medium sm:mr-1`}),e.type===`boolean`?(0,$.jsxs)(`div`,{className:`flex h-11 items-center gap-3`,children:[(0,$.jsx)(_,{checked:Ft(e.value),label:e.label,onChange:t=>c(e.id,{value:k(t?`project.yes`:`project.no`)})}),(0,$.jsx)(`span`,{className:`text-[0.875rem] text-ink-2`,children:Ft(e.value)?k(`project.yes`):k(`project.no`)})]}):(0,$.jsx)(P,{ref:u(`${e.id}:value`),rows:1,minRows:r===`longtext`?2:1,maxRows:10,value:e.value,placeholder:k(`project.factValue`),onChange:t=>c(e.id,{value:t.target.value}),className:`min-h-11`}),(0,$.jsx)(Lt,{type:e.type,detected:t,onChange:t=>c(e.id,{type:t})}),n?null:(0,$.jsx)(M,{label:k(`project.remove`),onClick:()=>o(t=>t.filter(t=>t.id!==e.id)),className:`size-11 rounded-lg hover:text-rose`,children:(0,$.jsx)(h,{className:`size-4`})})]},e.id)})}),a.length<jt.facts&&!n?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${a.length?`mt-4`:``}`,children:[(0,$.jsxs)(j,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`),children:[(0,$.jsx)(f,{className:`size-4`}),` `,k(`project.factAdd`)]}),d.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>l({key:e.key,label:p===`en`?e.en:e.de},`value`),className:`inline-flex h-8 items-center gap-1 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:[(0,$.jsx)(f,{className:`size-3.5`}),` `,p===`en`?e.en:e.de]},e.key))]}):null]})}function zt({project:e,save:t}){let[n,r]=(0,Q.useState)(e.brand.name??``),[i,a]=(0,Q.useState)(e.brand.about??``),o=ke({name:n.trim(),about:i.trim()},e=>t({brand:e}));return(0,$.jsx)(q,{title:k(`project.base`),hint:k(`project.baseHint`),save:o,locked:e.readOnly,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(E,{children:k(`project.title`)}),(0,$.jsx)(O,{value:n,maxLength:120,onChange:e=>r(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:k(`project.titleHint`)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(E,{children:k(`project.about`)}),(0,$.jsx)(P,{minRows:4,value:i,onChange:e=>a(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:k(`project.aboutHint`)})]})]})})}function Bt({project:e,group:t,children:n}){let i=r(),a=X(e.id),[o,s]=(0,Q.useState)(0),c=async t=>{await A.patch(`/api/studio/projects/${e.id}`,t),await i.invalidateQueries({queryKey:[`projects`]})},l=d({mutationFn:()=>A.del(`/api/studio/projects/${e.id}`),onSuccess:()=>i.invalidateQueries({queryKey:[`projects`]})}),u=we(),f=K(),p=a.data??{files:[],embeddings:!0},m=`${e.id}:${o}`,h=e.readOnly,g=t===`knowledge`;return De(h?{}:{title:k(g?`project.assistantTitleKnowledge`:`project.assistantTitle`),hello:k(g?`project.assistantHelloKnowledge`:`project.assistantHello`),placeholder:k(g?`project.assistantComposerKnowledge`:`project.assistantComposer`),suggestions:g?[{label:k(`assistant.suggest.knowledgeHow`)},{label:k(`assistant.suggest.knowledgeSite`),fill:!0},{label:k(`assistant.suggest.knowledgeCategories`)}]:[{label:k(`assistant.suggest.readSite`),fill:!0},{label:k(`assistant.suggest.missing`)},{label:k(`assistant.suggest.facts`)}],summary:g?void 0:[e.brand.name?`title "${e.brand.name}"`:`no title`,`${e.facts.length} facts`,`${e.brand.colors?.length??0} colours`,`${p.files.filter(e=>e.kind===`logo`).length} logos`].join(` · `),onChanged:()=>s(e=>e+1)}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[h?(0,$.jsx)(W,{children:U(e)}):null,t===`info`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{id:`base`,children:(0,$.jsx)(zt,{project:e,save:c},`base:${m}`)}),(0,$.jsx)(Y,{id:`logos`,children:(0,$.jsx)(ut,{projectId:e.id,data:p,readOnly:h})}),(0,$.jsx)(Y,{id:`colors`,children:(0,$.jsx)(Pt,{colors:e.brand.colors??[],save:e=>c({brand:{colors:e}}),readOnly:h},`colors:${m}`)}),(0,$.jsx)(Y,{id:`assets`,children:(0,$.jsx)(mt,{projectId:e.id,data:p,readOnly:h})}),(0,$.jsx)(Y,{id:`facts`,children:(0,$.jsx)(Rt,{facts:e.facts,save:e=>c({facts:e}),readOnly:h},`facts:${m}`)})]}):null,n,t===`info`&&u&&!h&&f?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(j,{variant:`danger`,busy:l.isPending,onClick:()=>confirm(`${k(`settings.delete`)}?`)&&l.mutate(),children:k(`settings.delete`)}),l.error?(0,$.jsx)(`p`,{className:`mt-2 text-[0.875rem] text-rose`,children:l.error.message}):null]}):null]})}var Vt={q:``,mode:``,days:0};function Ht(e,t,n){let r=new URLSearchParams;t&&r.set(`wizard`,t),n.q.trim()&&r.set(`q`,n.q.trim()),n.mode&&r.set(`mode`,n.mode),n.days&&r.set(`days`,String(n.days));let a=r.toString();return i({queryKey:[`results`,e,a],queryFn:()=>A.get(`/api/studio/projects/${e}/results${a&&`?${a}`}`),enabled:!!e,placeholderData:e=>e,refetchInterval:15e3})}function Ut({filter:e,onFilter:t}){let[n,r]=(0,Q.useState)(e.q);return(0,Q.useEffect)(()=>{if(n===e.q)return;let r=setTimeout(()=>t({...e,q:n}),250);return()=>clearTimeout(r)},[n,e,t]),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-0 flex-1 basis-56`,children:[(0,$.jsx)(a,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-3`}),(0,$.jsx)(O,{type:`search`,value:n,onChange:e=>r(e.target.value),placeholder:k(`space.resultsSearch`),"aria-label":k(`space.resultsSearch`),className:`w-full pl-9`})]}),(0,$.jsx)(I,{value:e.mode,onChange:n=>t({...e,mode:n}),options:[{value:``,label:k(`space.resultsModeAll`)},{value:`live`,label:`Live`},{value:`test`,label:`Test`}],className:`w-32`}),(0,$.jsx)(I,{value:String(e.days),onChange:n=>t({...e,days:Number(n)}),options:[{value:`0`,label:k(`space.resultsAnyTime`)},{value:`1`,label:k(`space.resultsDay`)},{value:`7`,label:k(`space.resultsDays`,{n:7})},{value:`30`,label:k(`space.resultsDays`,{n:30})}],className:`w-44`})]})}function Wt({data:e,wizardId:t,filter:n,onFilter:r}){let[i,a]=(0,Q.useState)(null),o=t=>e.wizards.find(e=>e.id===t)?.title??``,s=new Intl.DateTimeFormat(p,{dateStyle:`medium`,timeStyle:`short`});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(q,{title:t?o(t):k(`space.resultsAll`),hint:k(`space.resultsHint`),plain:!0,children:[(0,$.jsx)(Ut,{filter:n,onFilter:r}),e.runs.length?(0,$.jsx)(N,{className:`flex flex-col p-1.5`,children:e.runs.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a(e),className:`flex items-center gap-3 rounded-lg px-3 py-2.5 text-left transition hover:bg-accent`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate text-[0.875rem]`,children:t?s.format(new Date(e.doneAt)):o(e.wizardId)}),(0,$.jsxs)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:[t?null:`${s.format(new Date(e.doneAt))} · `,k(`space.resultCredits`,{n:e.credits})]})]}),e.assets?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[0.75rem] text-ink-3 tabular-nums`,title:k(`space.resultFiles`,{n:e.assets}),children:[(0,$.jsx)(te,{className:`size-3.5`}),e.assets]}):null,e.mode===`test`?(0,$.jsx)(w,{children:`Test`}):(0,$.jsxs)(w,{tone:`live`,children:[`Live v`,e.version]})]},e.id))}):(0,$.jsx)(N,{children:(0,$.jsx)(ie,{children:n.q.trim()||n.mode||n.days?k(`space.resultsNone`):k(`space.resultsEmpty`)})})]}),i?(0,$.jsx)(z,{header:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-[0.875rem]`,children:o(i.wizardId)}),i.mode===`test`?(0,$.jsx)(w,{children:`Test`}):(0,$.jsxs)(w,{tone:`live`,children:[`Live v`,i.version]})]}),onClose:()=>a(null),children:(0,$.jsx)(et,{runId:i.id,compact:!0},i.id)}):null]})}function Gt({project:e,save:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(e.name),o=d({mutationFn:()=>t({name:i.trim()}),onSuccess:()=>r(!1)});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(M,{label:k(`project.rename`),onClick:()=>{a(e.name),r(!0)},children:(0,$.jsx)(ee,{className:`size-4`})}),(0,$.jsx)(T,{open:n,onClose:()=>r(!1),title:k(`project.rename`),children:(0,$.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.trim()&&o.mutate()},children:[(0,$.jsx)(O,{"data-autofocus":!0,value:i,maxLength:80,onChange:e=>a(e.target.value)}),o.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:o.error.message}):null,(0,$.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,$.jsx)(j,{variant:`ghost`,onClick:()=>r(!1),children:k(`common.cancel`)}),(0,$.jsx)(j,{type:`submit`,busy:o.isPending,disabled:!i.trim(),children:k(`settings.save`)})]})]})})]})}function Kt({project:e}){let t=r();return(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(We,{}),e.readOnly?null:(0,$.jsx)(Gt,{project:e,save:async n=>{await A.patch(`/api/studio/projects/${e.id}`,n),await t.invalidateQueries({queryKey:[`projects`]})}})]})}function qt(e){let t=e.join(` `),[n,r]=(0,Q.useState)(e[0]);return(0,Q.useEffect)(()=>{let e=t.split(` `),n=0,i=()=>{n=0;let t=Fe(),i=t.scrollTop>0&&t.clientHeight+t.scrollTop>=t.scrollHeight-4,a=(t===document.documentElement?0:t.getBoundingClientRect().top)+Math.max(120,t.clientHeight/3),o=e[0];for(let t of e){let e=document.getElementById(t)?.getBoundingClientRect().top;e!==void 0&&e<=a&&(o=t)}r(i?e.at(-1):o)},a=()=>{n||=requestAnimationFrame(i)};return i(),window.addEventListener(`scroll`,a,{passive:!0,capture:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(n),window.removeEventListener(`scroll`,a,{capture:!0}),window.removeEventListener(`resize`,a)}},[t]),n}function Jt(e,t){let n=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;document.getElementById(e)?.scrollIntoView({block:`start`,behavior:t&&!n?`smooth`:`auto`})}function Yt({groups:e,current:t,onPick:n}){return e.map(e=>{let r=e.sections.map(e=>(0,$.jsx)(Z,{icon:e.icon??l,label:e.label,selected:e.id===t,onPick:()=>n(e.id)},e.id));return e.label?(0,$.jsx)(qe,{label:e.label,children:r},e.plugin):(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:r},`own`)})}function Xt(){let{group:e}=ne(),[t,n]=se(),r=ce(),i=oe(),{hash:a}=i,{project:o,loading:s}=Te(),l=we(),u=Re(),d=$e(),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),v=Ne(e)?e:void 0,ee=i.state?.parts===!0,te=Be().map(e=>({...e,to:`/space/${e.id}`})),b=te.find(e=>e.id===v),x=t.get(`show`),S=v?x?2:1:0,C=d?Math.min(S,1):v&&g!==v&&!ee?1:0,re=Ke(C),w=Ke(S),T=(0,Q.useMemo)(()=>({slot:f,narrow:d,setDetail:h}),[f,d]),E=o?o.brand.name?.trim()||o.name:k(`nav.project`),O=v&&v!==`results`?Pe(v,u):[],A=v?Pe(v,u).filter(e=>e.plugin):[],j=qt([...O,...v===`results`?A:[]].flatMap(e=>e.sections.map(e=>e.id))),M=v===`results`&&x&&x!==`all`?x:null,[ae,N]=(0,Q.useState)(Vt),P=Ht(v===`results`?o?.id:void 0,M,ae),F=P.data?.wizards.find(e=>e.id===M)?.title,I=v===`data`&&x&&x!==`all`||v===`knowledge`&&x&&/^[ptfcvs]:/.test(x)?x:null,L=I?.startsWith(`s:`)?u.spaceSections.find(e=>e.id===I.slice(2)):void 0,R=v===`knowledge`&&I&&/^[ptf]:/.test(I)?I:null,z=de(v===`data`?o?.id:void 0),B=_e(v===`knowledge`?o?.id:void 0),V=Se(I?.startsWith(`v:`)?I.slice(2):``),H=B.data?.categories.find(e=>e.id===(I?.startsWith(`c:`)?I.slice(2):V.data?.category.id)),U=v===`knowledge`?L?L.label():I?.startsWith(`v:`)?V.data&&`${V.data.category.name}: ${V.data.value}`:I?.startsWith(`c:`)?H?.name:B.data?.items.find(e=>e.key===I)?.title:z.data?be(z.data).flatMap(e=>e.items).find(e=>e.key===I)?.title:void 0;Me([{label:k(`nav.project`),to:`/space`},...b?[{label:b.label,to:`/space/${b.id}`}]:[],...b&&(m??F??U)?[{label:m??F??U}]:[]]);let Ce={p:`page`,t:`table`,f:`file`,c:`kategorie`,v:`kategorie value`,s:`plugin section`};De({...v===`data`||v===`results`?{compact:!0}:{},...v===`data`?{suggestions:[{label:k(`assistant.suggest.dataWhat`)},{label:k(`assistant.suggest.dataWho`)},{label:k(`assistant.suggest.dataEdit`)}]}:v===`results`?{suggestions:[{label:k(`assistant.suggest.resultsFailed`)},{label:k(`assistant.suggest.resultsCost`)},{label:k(`assistant.suggest.resultsShare`)}]}:{},...I&&U?{open:{kind:Ce[I[0]]??`item`,id:I.slice(2),label:U}}:M&&F?{open:{kind:`wizard`,id:M,label:F}}:{}});let W=v===`results`||v===`data`||I?a.slice(1):x||a.slice(1),G=(0,Q.useRef)(``);if((0,Q.useEffect)(()=>{let e=`${v}#${W}`;W&&G.current!==e&&document.getElementById(W)&&(G.current=e,requestAnimationFrame(()=>Jt(W,!1)))},[v,W,o?.id,u.spaceSections]),!v){let t=a.slice(1),n=t?He(t,u):null;if(n===`knowledge`&&u.spaceSections.some(e=>e.id===t))return(0,$.jsx)(D,{to:`/space/knowledge?show=s:${t}`,replace:!0});if(n)return(0,$.jsx)(D,{to:d?`/space/${n}?show=${t}`:{pathname:`/space/${n}`,hash:t},replace:!0});if(t&&u.status!==`ready`)return null;if(e!==void 0||!d)return(0,$.jsx)(D,{to:`/space/info`,replace:!0,state:{parts:!0}})}if(v===`knowledge`&&!x&&u.spaceSections.some(e=>e.id===a.slice(1)))return(0,$.jsx)(D,{to:`/space/knowledge?show=s:${a.slice(1)}`,replace:!0});let K=e=>{if(d){r({search:`?show=${e}`});return}G.current=`${v}#${e}`,Jt(e,!0),r({search:``,hash:e},{replace:!0})},J=e=>d?n({show:e}):n(e===`all`?{}:{show:e},{replace:!0}),Ee=e=>e.flatMap(e=>e.sections).map(e=>u.spaceSections.find(t=>t.id===e.id)).filter(e=>e!==void 0).map(e=>(0,$.jsx)(Y,{id:e.id,children:(0,$.jsx)(q,{title:e.label(),hint:e.hint?.(),plain:!0,children:(0,$.jsx)(Ve,{of:e,children:(0,$.jsx)(e.component,{})})})},e.serial)),X=d?void 0:j;return(0,$.jsx)(Ye.Provider,{value:T,children:(0,$.jsx)(`div`,{className:`animate-rise`,children:(0,$.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-[13.5rem_minmax(0,1fr)] md:gap-8 lg:grid-cols-[15rem_minmax(0,1fr)] lg:gap-10`,children:[(0,$.jsxs)(`aside`,{className:y(`min-w-0 md:sticky md:top-6 md:self-start`,d&&S===2&&`hidden`,d&&w===`back`&&Ge(`back`)),children:[(0,$.jsx)(Je,{title:E,open:C===1?b??null:null,onBack:()=>d?r(`/space`):_(v??null)}),(0,$.jsx)(`div`,{className:y(Ge(re)),children:C===0?(0,$.jsx)(Xe,{entries:te,current:d?void 0:b,onPick:()=>_(null)}):(0,$.jsx)(`div`,{ref:p})},C)]}),v?(0,$.jsxs)(`div`,{className:y(`min-w-0`,d&&S<2&&`hidden`,d&&w===`deeper`&&Ge(`deeper`)),children:[d?(0,$.jsx)(`div`,{className:`mb-3`,children:(0,$.jsx)(Qe,{label:b?.label??E,onBack:()=>r(`/space/${v}`)})}):null,l&&o?(0,$.jsx)(`div`,{className:`mb-6`,children:(0,$.jsx)(Kt,{project:o})}):null,v===`results`?(0,$.jsxs)(Ze,{children:[(0,$.jsxs)(`ul`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(Z,{icon:nt,label:k(`space.resultsAll`),selected:!d&&!M,onPick:()=>J(`all`)}),P.data?.wizards.filter(e=>e.results||e.id===M).map(e=>(0,$.jsx)(Z,{icon:c,label:e.title,badge:e.results?(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:e.results}):null,selected:!d&&e.id===M,onPick:()=>J(e.id)},e.id))]}),(0,$.jsx)(Yt,{groups:A,current:X,onPick:K})]}):v===`data`?(0,$.jsxs)(Ze,{children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(0,$.jsx)(Z,{icon:Ue,label:k(`data.all`),selected:!d&&!I,onPick:()=>J(`all`)})}),z.data?be(z.data).map(e=>(0,$.jsx)(qe,{label:e.label,children:e.items.map(e=>(0,$.jsx)(Z,{icon:ue[e.kind],label:e.title,selected:!d&&e.key===I,onPick:()=>J(e.key)},e.key))},e.key)):null,(0,$.jsx)(Yt,{groups:A,current:X,onPick:K})]}):v===`knowledge`?(0,$.jsxs)(Ze,{children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(0,$.jsx)(Z,{icon:Ue,label:k(`know.all`),selected:!(d||I),onPick:()=>J(`all`)})}),B.data?.categories.length?(0,$.jsx)(qe,{label:k(`know.categories`),children:B.data.categories.map(e=>(0,$.jsx)(Z,{icon:me[e.type],label:e.name,badge:(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:e.proposed?`·`:e.count}),selected:!d&&(I===`c:${e.id}`||V.data?.category.id===e.id),onPick:()=>J(`c:${e.id}`)},e.id))}):null,(0,$.jsx)(Yt,{groups:A,current:d?void 0:L?.id,onPick:e=>J(`s:${e}`)})]}):(0,$.jsx)(Ze,{children:(0,$.jsx)(Yt,{groups:O,current:X,onPick:K})}),o&&(v===`info`||v===`knowledge`)?(0,$.jsxs)(Bt,{project:o,group:v,children:[v===`knowledge`?R?R.startsWith(`p:`)?(0,$.jsx)(ge,{pageId:R.slice(2),onGone:()=>J(`all`),onOpen:J},R):R.startsWith(`t:`)?(0,$.jsx)(he,{tableId:R.slice(2),onGone:()=>J(`all`)},R):(0,$.jsx)(yt,{projectId:o.id,fileId:R.slice(2),readOnly:o.readOnly,onGone:()=>J(`all`)},R):B.data?L?(0,$.jsx)(q,{title:L.label(),hint:L.hint?.(),plain:!0,children:(0,$.jsx)(Ve,{of:L,children:(0,$.jsx)(L.component,{})})},I):I?.startsWith(`c:`)?H?(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsx)(pe,{projectId:o.id,category:H,readOnly:o.readOnly,onOpen:J,onGone:()=>J(`all`)}),H.type===`choice`?null:(0,$.jsx)(xe,{projectId:o.id,category:H,categories:B.data.categories,onOpen:J})]},I):null:I?.startsWith(`v:`)?V.data?(0,$.jsx)(le,{value:V.data,readOnly:o.readOnly,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[V.data.items.length?(0,$.jsx)(`div`,{className:`flex flex-col rounded-xl bg-card p-1.5 shadow-soft ring-1 ring-border-soft`,children:V.data.items.map(e=>(0,$.jsx)(fe,{item:e,categories:B.data.categories.filter(e=>e.id!==V.data?.category.id),onOpen:J},e.key))}):null,V.data.rows.map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>J(`t:${e.tableId}`),className:`px-1 text-left text-[0.8125rem] text-ink-3 hover:text-ink`,children:k(`know.tocRows`,{n:e.count,table:e.title})},e.tableId))]})},I):null:(0,$.jsx)(Y,{id:`documents`,children:(0,$.jsx)(ye,{projectId:o.id,data:B.data,readOnly:o.readOnly,onOpen:J})}):null:null,v===`info`?Ee(A):null]},o.id):null,o&&v===`data`?(0,$.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:I?.startsWith(`t:`)?(0,$.jsx)(he,{tableId:I.slice(2),onGone:()=>J(`all`)},I):I?.startsWith(`p:`)?(0,$.jsx)(ge,{pageId:I.slice(2),onGone:()=>J(`all`)},I):(0,$.jsxs)($.Fragment,{children:[z.data?(0,$.jsx)(ve,{projectId:o.id,data:z.data,readOnly:o.readOnly,onOpen:J}):null,Ee(A)]})}):null,o&&v===`results`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[P.data?(0,$.jsx)(Wt,{data:P.data,wizardId:M,filter:ae,onFilter:N}):null,P.isError?(0,$.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:P.error.message}):null,Ee(A)]}):null,o||s?null:(0,$.jsx)(ie,{children:k(`settings.noProject`)})]}):null]})})})}export{Xt as ProjectPage};
|
|
@@ -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{r}from"./logo-C4V2_3Ar.js";import{Tt as i,bn as a,bt as o,cn as s,ct as c,dn as l,hn as u,jt as d,kt as f,l as p,lt as m,mt as h,p as g,v as _,yn as v}from"./ui-CMdSOoUZ.js";import{a as y,i as b,n as x,o as S,r as C,s as w,t as T}from"./ChatView-DSRUEpb6.js";import{c as ee,i as E,r as D,t as O}from"./brand-BamUjXVr.js";import{a as k,n as A,o as j}from"./index-Bdx1Qity.js";import{t as M}from"./RunnerView-CTRFgyu5.js";var N={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`}]]};N.node;var te=l(N),P={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};P.node;var F=l(P),I={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`]};I.node;var L=l(I),R=e(t(),1);function ne(){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 z=ne(),re=z?new URLSearchParams(window.location.search).get(`page`):null,B=(e,t={})=>window.parent.postMessage({type:`engenty-wizard:${e}`,...t},`*`),ie=()=>B(`close`);function ae(e){(0,R.useEffect)(()=>{if(z===`inline`&&!e){let e=document.documentElement;document.getElementById(`root`)?.style.setProperty(`min-height`,`0`),e.style.overflow=`hidden`;let t=new ResizeObserver(()=>B(`height`,{height:Math.ceil(e.getBoundingClientRect().height)}));return t.observe(e),()=>t.disconnect()}if(z===`modal`||z===`popout`){let e=e=>{e.key===`Escape`&&!document.querySelector(`dialog[open]`)&&B(`close`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[e])}var V=e(n(),1);function H(e){(0,R.useEffect)(()=>{if(!e)return;let t=document.documentElement;return t.style.setProperty(`--raw-primary`,e),()=>{t.style.removeProperty(`--raw-primary`)}},[e])}function U(e,t){(0,R.useEffect)(()=>{if(!e||!t)return;let n=_(`/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 W=/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,G=W||/Android/.test(navigator.userAgent);function K(){let[e,t]=(0,R.useState)(()=>window.wizardInstall??null),[n,r]=(0,R.useState)(!1);if((0,R.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||G&&!e&&!W)return null;let i=/Mac/.test(navigator.platform),a=f(G?`install.ios`:i?`install.bookmark.mac`:`install.bookmark.pc`);return(0,V.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{G&&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:[G?(0,V.jsx)(L,{className:`size-4`}):(0,V.jsx)(te,{className:`size-4`}),f(G?`install.add`:`install.bookmark`)]}),n?(0,V.jsx)(`p`,{className:`max-w-xs leading-relaxed`,children:a}):null]})}function q({brand:e,toggle:t=!0}){return(0,V.jsx)(`header`,{className:`safe-top`,children:(0,V.jsxs)(`div`,{className:`relative flex h-14 items-center justify-center px-5`,children:[e.logoUrl?(0,V.jsx)(`img`,{src:_(e.logoUrl),alt:e.name,className:`h-7 max-w-[160px] object-contain`}):e.name?(0,V.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,V.jsx)(`div`,{className:`absolute right-3`,children:(0,V.jsx)(E,{})}):null]})})}function J({siteKey:e,onToken:t}){let n=(0,R.useRef)(null);return(0,R.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,V.jsx)(`div`,{ref:n,className:`mt-4 flex justify-center`})}function oe({token:e}){return!/iPhone|iPad|iPod|Android/.test(navigator.userAgent)||A||z?null:(0,V.jsxs)(`a`,{href:k(`${window.location.origin}${g}/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,V.jsx)(F,{className:`size-4`}),` `,f(`install.app`)]})}var Y=e=>`wz.run.${e}`,X=A&&new URLSearchParams(window.location.search).get(`start`)===`1`,Z=z===`inline`?`min-h-80`:`min-h-dvh`;function Q(e,t){let n=v(),[r,i]=(0,R.useState)(!1),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),l=(()=>{try{return localStorage.getItem(Y(e.token))}catch{return null}})();return{busy:r,error:a,captcha:s,setCaptcha:c,start:async()=>{i(!0),o(null);try{let{runId:r}=await p.post(`/api/public/wizards/${e.token}/runs`,{turnstileToken:s??void 0,embedded:z!==null,origin:re??void 0});try{localStorage.setItem(Y(e.token),r)}catch{}n(`${t}/${r}`,{replace:X})}catch(e){o(e.message),i(!1)}},resume:l?()=>n(`${t}/${l}`):null}}function se({wizard:e}){let{busy:t,error:n,captcha:r,setCaptcha:i,start:a,resume:c}=Q(e,`/w/${e.token}`),l=X&&e.available&&!e.turnstileSiteKey,u=(0,R.useRef)(!1);return(0,R.useEffect)(()=>{l&&!u.current&&(u.current=!0,a())},[l]),l&&!n?(0,V.jsx)(`div`,{className:`flex min-h-[60dvh] items-center justify-center text-ink-4`,children:(0,V.jsx)(o,{})}):(0,V.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:[(0,V.jsx)(D,{kind:e.avatar,size:190,fluffy:!0}),(0,V.jsx)(`h1`,{className:`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,V.jsx)(`p`,{className:`mt-3 text-[1rem] text-ink-2 leading-relaxed`,children:e.description}):null,e.available?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(m,{size:`lg`,className:`mt-10 min-w-48`,busy:t,disabled:!!e.turnstileSiteKey&&!r,onClick:a,children:[f(`run.start`),` `,(0,V.jsx)(s,{className:`size-4`})]}),e.turnstileSiteKey?(0,V.jsx)(J,{siteKey:e.turnstileSiteKey,onToken:i}):null,c?(0,V.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:f(`run.resume`)}):null,(0,V.jsx)(ce,{wizard:e,current:`steps`}),z||A?null:(0,V.jsx)(K,{}),(0,V.jsx)(oe,{token:e.token})]}):(0,V.jsx)(`p`,{className:`mt-10 rounded-xl bg-paper-2 px-5 py-4 text-[0.9375rem] text-ink-2`,children:e.unavailableReason??f(`run.unavailable`)}),n?(0,V.jsx)(`p`,{className:`mt-4 text-[0.875rem] text-rose`,children:n}):null]})}function ce({wizard:e,current:t}){let n=e.runners.filter(e=>e.id!==t&&e.kind===`page`&&e.url);return n.length?(0,V.jsx)(`p`,{className:`mt-4 flex flex-wrap justify-center gap-x-4 text-[0.875rem] text-ink-3`,children:n.map(e=>(0,V.jsx)(`a`,{href:e.url??void 0,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:f(`run.orAs`,{label:e.label})},e.id))}):null}function le({wizard:e}){let t=w();return(0,V.jsx)(`header`,{className:`safe-top shrink-0 border-border-soft border-b`,children:(0,V.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,V.jsx)(`span`,{className:i(t?.speaking&&`animate-breathe`),children:(0,V.jsx)(D,{kind:e.avatar,size:38})}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`div`,{className:`truncate font-display font-semibold text-[1rem] leading-tight tracking-tight`,children:e.title}),e.brand.name?(0,V.jsx)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:e.brand.name}):null]}),e.brand.logoUrl&&z!==`popout`?(0,V.jsx)(`img`,{src:_(e.brand.logoUrl),alt:e.brand.name,className:`h-6 max-w-[120px] object-contain max-sm:hidden`}):null,z?null:(0,V.jsx)(E,{}),z===`popout`?(0,V.jsx)(h,{label:f(`common.close`),onClick:ie,children:(0,V.jsx)(d,{className:`size-5`})}):null]})})}function $({door:e,wizard:t,header:n,footer:r}){let{busy:i,error:a,captcha:o,setCaptcha:c,start:l,resume:u}=Q(t,`/w/${t.token}/${e}`),d=[{key:`hello`,who:`bot`,node:t.description||t.title}];return e!==`chat`&&d.push({key:e,who:`bot`,node:f(e===`video`?`video.hint`:`talk.joinHint`)}),t.available||d.push({key:`unavailable`,who:`bot`,node:t.unavailableReason??f(`run.unavailable`)}),a&&d.push({key:`error`,who:`bot`,node:a,tone:`error`}),t.available&&d.push(S(`start`,(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(b,{primary:!0,busy:i,disabled:!!t.turnstileSiteKey&&!o,onClick:()=>void l(),children:[f(`run.start`),` `,(0,V.jsx)(s,{className:`size-4`})]}),u?(0,V.jsx)(b,{onClick:u,children:f(`run.resume`)}):null,t.turnstileSiteKey?(0,V.jsx)(J,{siteKey:t.turnstileSiteKey,onToken:c}):null]}))),(0,V.jsxs)(x,{header:n,footer:r,children:[(0,V.jsx)(y,{avatar:t.avatar,lines:d}),(0,V.jsx)(C,{})]})}function ue({className:e}){return(0,V.jsx)(`footer`,{className:i(`text-center text-ink-4`,e),children:(0,V.jsx)(`a`,{href:`${g}/`,target:z?`_blank`:void 0,rel:`noreferrer`,className:`inline-block hover:text-ink-2`,children:f(`run.madeWith`).replace(`engenty wizards`,O.name)})})}function de({chat:e=!1,steps:t=!1,talk:n=!1,video:s=!1}){let{token:l,runId:d}=a(),h=v(),_=r({queryKey:[`public`,l],queryFn:()=>p.get(`/api/public/wizards/${l}`),retry:(e,t)=>c(t)&&e<3}),y=_.data?.runners??[],b=!_.data||y.some(e=>e.id===`talk`),x=!_.data||y.some(e=>e.id===`video`),S=!_.data||y.some(e=>e.id===`chat`)||n&&b||s&&x,C=y[0]?.id,w=e||z===`popout`||!t&&!d&&S&&(C===`chat`||C===`talk`||C===`video`),E=s&&x||!t&&!e&&!n&&C===`video`,k=!E&&(n&&b||!t&&!e&&C===`talk`),N=E?`video`:k?`talk`:`chat`;if(H(_.data?.brand.accent),ee(_.data?.avatar),U(l,_.data?.title),ae(w),(0,R.useEffect)(()=>{_.data&&(document.title=_.data.title)},[_.data]),(0,R.useEffect)(()=>{l&&d&&j(`run`,{token:l,runId:d})},[l,d]),_.isLoading)return(0,V.jsx)(`div`,{className:i(`flex items-center justify-center text-ink-4`,Z),children:(0,V.jsx)(o,{})});if(e&&_.data&&!S||n&&_.data&&!b||s&&_.data&&!x)return(0,V.jsx)(u,{to:`/w/${l}`,replace:!0});if(!_.data){let e=c(_.error);return(0,V.jsxs)(`div`,{className:i(`flex flex-col items-center justify-center gap-4 px-6 text-center`,Z),children:[(0,V.jsx)(D,{kind:`pebble`,size:80}),(0,V.jsx)(`p`,{className:`max-w-xs text-ink-3`,children:f(e?`common.offline`:`run.notFound`)}),e?(0,V.jsx)(m,{variant:`secondary`,onClick:()=>void _.refetch(),children:f(`common.retry`)}):null]})}if(w){let e=(0,V.jsx)(le,{wizard:_.data}),t=A?(0,V.jsx)(`div`,{className:`safe-bottom`}):(0,V.jsx)(ue,{className:`pb-[max(0.375rem,env(safe-area-inset-bottom))] text-[0.6875rem]`});return(0,V.jsx)(`div`,{className:`flex h-dvh flex-col`,children:d?(0,V.jsx)(T,{runId:d,talk:k,call:E?`video`:k?`audio`:!1,onRestart:()=>h(`/w/${l}/${N}`),header:E||k?void 0:e,footer:t}):(0,V.jsx)($,{wizard:_.data,header:e,footer:t,door:N})})}return(0,V.jsxs)(`div`,{className:i(`flex flex-col`,Z),children:[z===`inline`||A?null:(0,V.jsx)(q,{brand:_.data.brand,toggle:!z}),(0,V.jsx)(`div`,{className:`flex-1`,children:d?(0,V.jsx)(M,{runId:d,onRestart:()=>h(`/w/${l}`)}):(0,V.jsx)(se,{wizard:_.data})}),A?(0,V.jsx)(`div`,{className:`safe-bottom`}):(0,V.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[0.75rem] text-ink-4`,children:(0,V.jsx)(`a`,{href:`${g}/`,target:z?`_blank`:void 0,rel:`noreferrer`,className:`inline-block py-3.5 hover:text-ink-2`,children:f(`run.madeWith`).replace(`engenty wizards`,O.name)})})]})}export{q as BrandHeader,de as PublicRunner,H as useBrandAccent};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{r}from"./logo-C4V2_3Ar.js";import{Tt as i,bn as a,bt as o,cn as s,ct as c,dn as l,hn as u,jt as d,kt as f,l as p,lt as m,mt as h,p as g,v as _,yn as v}from"./ui-DAHMnAVc.js";import{a as y,i as b,n as x,o as S,r as C,s as w,t as T}from"./ChatView-D21o-lq8.js";import{c as ee,i as E,r as D,t as O}from"./brand-BRw18WJF.js";import{a as k,n as A,o as j}from"./index-DkDBEMwz.js";import{t as M}from"./RunnerView-CJ4cLA_0.js";var N={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`}]]};N.node;var te=l(N),P={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};P.node;var F=l(P),I={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`]};I.node;var L=l(I),R=e(t(),1);function ne(){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 z=ne(),re=z?new URLSearchParams(window.location.search).get(`page`):null,B=(e,t={})=>window.parent.postMessage({type:`engenty-wizard:${e}`,...t},`*`),ie=()=>B(`close`);function ae(e){(0,R.useEffect)(()=>{if(z===`inline`&&!e){let e=document.documentElement;document.getElementById(`root`)?.style.setProperty(`min-height`,`0`),e.style.overflow=`hidden`;let t=new ResizeObserver(()=>B(`height`,{height:Math.ceil(e.getBoundingClientRect().height)}));return t.observe(e),()=>t.disconnect()}if(z===`modal`||z===`popout`){let e=e=>{e.key===`Escape`&&!document.querySelector(`dialog[open]`)&&B(`close`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[e])}var V=e(n(),1);function H(e){(0,R.useEffect)(()=>{if(!e)return;let t=document.documentElement;return t.style.setProperty(`--raw-primary`,e),()=>{t.style.removeProperty(`--raw-primary`)}},[e])}function U(e,t){(0,R.useEffect)(()=>{if(!e||!t)return;let n=_(`/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 W=/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,G=W||/Android/.test(navigator.userAgent);function K(){let[e,t]=(0,R.useState)(()=>window.wizardInstall??null),[n,r]=(0,R.useState)(!1);if((0,R.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||G&&!e&&!W)return null;let i=/Mac/.test(navigator.platform),a=f(G?`install.ios`:i?`install.bookmark.mac`:`install.bookmark.pc`);return(0,V.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{G&&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:[G?(0,V.jsx)(L,{className:`size-4`}):(0,V.jsx)(te,{className:`size-4`}),f(G?`install.add`:`install.bookmark`)]}),n?(0,V.jsx)(`p`,{className:`max-w-xs leading-relaxed`,children:a}):null]})}function q({brand:e,toggle:t=!0}){return(0,V.jsx)(`header`,{className:`safe-top`,children:(0,V.jsxs)(`div`,{className:`relative flex h-14 items-center justify-center px-5`,children:[e.logoUrl?(0,V.jsx)(`img`,{src:_(e.logoUrl),alt:e.name,className:`h-7 max-w-[160px] object-contain`}):e.name?(0,V.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,V.jsx)(`div`,{className:`absolute right-3`,children:(0,V.jsx)(E,{})}):null]})})}function J({siteKey:e,onToken:t}){let n=(0,R.useRef)(null);return(0,R.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,V.jsx)(`div`,{ref:n,className:`mt-4 flex justify-center`})}function oe({token:e}){return!/iPhone|iPad|iPod|Android/.test(navigator.userAgent)||A||z?null:(0,V.jsxs)(`a`,{href:k(`${window.location.origin}${g}/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,V.jsx)(F,{className:`size-4`}),` `,f(`install.app`)]})}var Y=e=>`wz.run.${e}`,X=A&&new URLSearchParams(window.location.search).get(`start`)===`1`,Z=z===`inline`?`min-h-80`:`min-h-dvh`;function Q(e,t){let n=v(),[r,i]=(0,R.useState)(!1),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),l=(()=>{try{return localStorage.getItem(Y(e.token))}catch{return null}})();return{busy:r,error:a,captcha:s,setCaptcha:c,start:async()=>{i(!0),o(null);try{let{runId:r}=await p.post(`/api/public/wizards/${e.token}/runs`,{turnstileToken:s??void 0,embedded:z!==null,origin:re??void 0});try{localStorage.setItem(Y(e.token),r)}catch{}n(`${t}/${r}`,{replace:X})}catch(e){o(e.message),i(!1)}},resume:l?()=>n(`${t}/${l}`):null}}function se({wizard:e}){let{busy:t,error:n,captcha:r,setCaptcha:i,start:a,resume:c}=Q(e,`/w/${e.token}`),l=X&&e.available&&!e.turnstileSiteKey,u=(0,R.useRef)(!1);return(0,R.useEffect)(()=>{l&&!u.current&&(u.current=!0,a())},[l]),l&&!n?(0,V.jsx)(`div`,{className:`flex min-h-[60dvh] items-center justify-center text-ink-4`,children:(0,V.jsx)(o,{})}):(0,V.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:[(0,V.jsx)(D,{kind:e.avatar,size:190,fluffy:!0}),(0,V.jsx)(`h1`,{className:`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,V.jsx)(`p`,{className:`mt-3 text-[1rem] text-ink-2 leading-relaxed`,children:e.description}):null,e.available?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(m,{size:`lg`,className:`mt-10 min-w-48`,busy:t,disabled:!!e.turnstileSiteKey&&!r,onClick:a,children:[f(`run.start`),` `,(0,V.jsx)(s,{className:`size-4`})]}),e.turnstileSiteKey?(0,V.jsx)(J,{siteKey:e.turnstileSiteKey,onToken:i}):null,c?(0,V.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:f(`run.resume`)}):null,(0,V.jsx)(ce,{wizard:e,current:`steps`}),z||A?null:(0,V.jsx)(K,{}),(0,V.jsx)(oe,{token:e.token})]}):(0,V.jsx)(`p`,{className:`mt-10 rounded-xl bg-paper-2 px-5 py-4 text-[0.9375rem] text-ink-2`,children:e.unavailableReason??f(`run.unavailable`)}),n?(0,V.jsx)(`p`,{className:`mt-4 text-[0.875rem] text-rose`,children:n}):null]})}function ce({wizard:e,current:t}){let n=e.runners.filter(e=>e.id!==t&&e.kind===`page`&&e.url);return n.length?(0,V.jsx)(`p`,{className:`mt-4 flex flex-wrap justify-center gap-x-4 text-[0.875rem] text-ink-3`,children:n.map(e=>(0,V.jsx)(`a`,{href:e.url??void 0,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:f(`run.orAs`,{label:e.label})},e.id))}):null}function le({wizard:e}){let t=w();return(0,V.jsx)(`header`,{className:`safe-top shrink-0 border-border-soft border-b`,children:(0,V.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,V.jsx)(`span`,{className:i(t?.speaking&&`animate-breathe`),children:(0,V.jsx)(D,{kind:e.avatar,size:38})}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`div`,{className:`truncate font-display font-semibold text-[1rem] leading-tight tracking-tight`,children:e.title}),e.brand.name?(0,V.jsx)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:e.brand.name}):null]}),e.brand.logoUrl&&z!==`popout`?(0,V.jsx)(`img`,{src:_(e.brand.logoUrl),alt:e.brand.name,className:`h-6 max-w-[120px] object-contain max-sm:hidden`}):null,z?null:(0,V.jsx)(E,{}),z===`popout`?(0,V.jsx)(h,{label:f(`common.close`),onClick:ie,children:(0,V.jsx)(d,{className:`size-5`})}):null]})})}function $({door:e,wizard:t,header:n,footer:r}){let{busy:i,error:a,captcha:o,setCaptcha:c,start:l,resume:u}=Q(t,`/w/${t.token}/${e}`),d=[{key:`hello`,who:`bot`,node:t.description||t.title}];return e!==`chat`&&d.push({key:e,who:`bot`,node:f(e===`video`?`video.hint`:`talk.joinHint`)}),t.available||d.push({key:`unavailable`,who:`bot`,node:t.unavailableReason??f(`run.unavailable`)}),a&&d.push({key:`error`,who:`bot`,node:a,tone:`error`}),t.available&&d.push(S(`start`,(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(b,{primary:!0,busy:i,disabled:!!t.turnstileSiteKey&&!o,onClick:()=>void l(),children:[f(`run.start`),` `,(0,V.jsx)(s,{className:`size-4`})]}),u?(0,V.jsx)(b,{onClick:u,children:f(`run.resume`)}):null,t.turnstileSiteKey?(0,V.jsx)(J,{siteKey:t.turnstileSiteKey,onToken:c}):null]}))),(0,V.jsxs)(x,{header:n,footer:r,children:[(0,V.jsx)(y,{avatar:t.avatar,lines:d}),(0,V.jsx)(C,{})]})}function ue({className:e}){return(0,V.jsx)(`footer`,{className:i(`text-center text-ink-4`,e),children:(0,V.jsx)(`a`,{href:`${g}/`,target:z?`_blank`:void 0,rel:`noreferrer`,className:`inline-block hover:text-ink-2`,children:f(`run.madeWith`).replace(`engenty wizards`,O.name)})})}function de({chat:e=!1,steps:t=!1,talk:n=!1,video:s=!1}){let{token:l,runId:d}=a(),h=v(),_=r({queryKey:[`public`,l],queryFn:()=>p.get(`/api/public/wizards/${l}`),retry:(e,t)=>c(t)&&e<3}),y=_.data?.runners??[],b=!_.data||y.some(e=>e.id===`talk`),x=!_.data||y.some(e=>e.id===`video`),S=!_.data||y.some(e=>e.id===`chat`)||n&&b||s&&x,C=y[0]?.id,w=e||z===`popout`||!t&&!d&&S&&(C===`chat`||C===`talk`||C===`video`),E=s&&x||!t&&!e&&!n&&C===`video`,k=!E&&(n&&b||!t&&!e&&C===`talk`),N=E?`video`:k?`talk`:`chat`;if(H(_.data?.brand.accent),ee(_.data?.avatar),U(l,_.data?.title),ae(w),(0,R.useEffect)(()=>{_.data&&(document.title=_.data.title)},[_.data]),(0,R.useEffect)(()=>{l&&d&&j(`run`,{token:l,runId:d})},[l,d]),_.isLoading)return(0,V.jsx)(`div`,{className:i(`flex items-center justify-center text-ink-4`,Z),children:(0,V.jsx)(o,{})});if(e&&_.data&&!S||n&&_.data&&!b||s&&_.data&&!x)return(0,V.jsx)(u,{to:`/w/${l}`,replace:!0});if(!_.data){let e=c(_.error);return(0,V.jsxs)(`div`,{className:i(`flex flex-col items-center justify-center gap-4 px-6 text-center`,Z),children:[(0,V.jsx)(D,{kind:`pebble`,size:80}),(0,V.jsx)(`p`,{className:`max-w-xs text-ink-3`,children:f(e?`common.offline`:`run.notFound`)}),e?(0,V.jsx)(m,{variant:`secondary`,onClick:()=>void _.refetch(),children:f(`common.retry`)}):null]})}if(w){let e=(0,V.jsx)(le,{wizard:_.data}),t=A?(0,V.jsx)(`div`,{className:`safe-bottom`}):(0,V.jsx)(ue,{className:`pb-[max(0.375rem,env(safe-area-inset-bottom))] text-[0.6875rem]`});return(0,V.jsx)(`div`,{className:`flex h-dvh flex-col`,children:d?(0,V.jsx)(T,{runId:d,talk:k,call:E?`video`:k?`audio`:!1,onRestart:()=>h(`/w/${l}/${N}`),header:E||k?void 0:e,footer:t}):(0,V.jsx)($,{wizard:_.data,header:e,footer:t,door:N})})}return(0,V.jsxs)(`div`,{className:i(`flex flex-col`,Z),children:[z===`inline`||A?null:(0,V.jsx)(q,{brand:_.data.brand,toggle:!z}),(0,V.jsx)(`div`,{className:`flex-1`,children:d?(0,V.jsx)(M,{runId:d,onRestart:()=>h(`/w/${l}`)}):(0,V.jsx)(se,{wizard:_.data})}),A?(0,V.jsx)(`div`,{className:`safe-bottom`}):(0,V.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[0.75rem] text-ink-4`,children:(0,V.jsx)(`a`,{href:`${g}/`,target:z?`_blank`:void 0,rel:`noreferrer`,className:`inline-block py-3.5 hover:text-ink-2`,children:f(`run.madeWith`).replace(`engenty wizards`,O.name)})})]})}export{q as BrandHeader,de as PublicRunner,H as useBrandAccent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./jsx-runtime-BNakU3Ej.js";import{dn as n,kt as r}from"./ui-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./jsx-runtime-BNakU3Ej.js";import{dn as n,kt as r}from"./ui-DAHMnAVc.js";import{t as i}from"./lock-BGotwAyN.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 r(e.origin===`local`?`readonly.project`:`readonly.server`)}function l({children:e}){return(0,s.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-paper-2 px-4 py-3 text-[0.875rem] text-ink-2 leading-relaxed`,children:[(0,s.jsx)(i,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,s.jsx)(`p`,{className:`min-w-0`,children:e})]})}export{c as n,o as r,l as t};
|