galley-cms 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/galley.mjs +1205 -1091
- package/dist/starters/astro-editorial/src/galley/catalog-data.js +1 -1
- package/dist/starters/astro-editorial/src/galley/catalog.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/attribution.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/forms.js +2 -2
- package/dist/starters/astro-editorial/src/galley/client/providers/frame-post.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/galley.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/hubspot.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/mailto.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/marketo.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/pardot.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/salesforce.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/providers/webhook.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/registry.js +1 -1
- package/dist/starters/astro-editorial/src/galley/client/types.d.ts +1 -1
- package/dist/starters/astro-editorial/src/galley/components/ConsentBanner.astro +1 -1
- package/dist/starters/astro-editorial/src/galley/components/Form.astro +1 -1
- package/dist/starters/astro-editorial/src/galley/components/Scripts.astro +1 -1
- package/dist/starters/astro-editorial/src/galley/components/index.js +1 -1
- package/dist/starters/astro-editorial/src/galley/forms/forms.css +1 -1
- package/dist/starters/astro-editorial/src/galley/forms/free-email-domains.js +1 -1
- package/dist/starters/astro-editorial/src/galley/forms/logic.js +1 -1
- package/dist/starters/astro-editorial/src/galley/forms/messages.js +1 -1
- package/dist/starters/astro-editorial/src/galley/forms/render.js +1 -1
- package/dist/starters/astro-editorial/src/galley/integration.js +1 -1
- package/dist/starters/astro-editorial/src/galley/kit.d.ts +1 -1
- package/dist/starters/astro-editorial/src/galley/mailto/config.js +1 -1
- package/dist/starters/astro-editorial/src/galley/mailto/runtime.gen.js +1 -1
- package/dist/starters/astro-editorial/src/galley/runtime/site-config.js +1 -1
- package/dist/starters/astro-editorial/src/galley/schema.js +1 -1
- package/dist/starters/astro-editorial/src/galley/scripts/banner.js +1 -1
- package/dist/starters/astro-editorial/src/galley/scripts/plan.js +1 -1
- package/dist/starters/astro-editorial/src/galley/scripts/runtime.gen.js +1 -1
- package/dist/starters/astro-editorial/src/galley/scripts/snippets.js +1 -1
- package/dist/starters/astro-editorial/src/galley/shared/glob.js +1 -1
- package/dist/starters/astro-editorial/src/galley/shared/markdown.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/config.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/content.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/crawlers.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/html.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/integration.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/markdown.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/page.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/site.js +1 -1
- package/dist/starters/astro-editorial/src/galley/visibility/structured.js +1 -1
- package/dist/starters/astro-saas/src/galley/catalog-data.js +1 -1
- package/dist/starters/astro-saas/src/galley/catalog.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/attribution.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/forms.js +2 -2
- package/dist/starters/astro-saas/src/galley/client/providers/frame-post.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/galley.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/hubspot.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/mailto.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/marketo.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/pardot.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/salesforce.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/providers/webhook.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/registry.js +1 -1
- package/dist/starters/astro-saas/src/galley/client/types.d.ts +1 -1
- package/dist/starters/astro-saas/src/galley/components/ConsentBanner.astro +1 -1
- package/dist/starters/astro-saas/src/galley/components/Form.astro +1 -1
- package/dist/starters/astro-saas/src/galley/components/Scripts.astro +1 -1
- package/dist/starters/astro-saas/src/galley/components/index.js +1 -1
- package/dist/starters/astro-saas/src/galley/forms/forms.css +1 -1
- package/dist/starters/astro-saas/src/galley/forms/free-email-domains.js +1 -1
- package/dist/starters/astro-saas/src/galley/forms/logic.js +1 -1
- package/dist/starters/astro-saas/src/galley/forms/messages.js +1 -1
- package/dist/starters/astro-saas/src/galley/forms/render.js +1 -1
- package/dist/starters/astro-saas/src/galley/integration.js +1 -1
- package/dist/starters/astro-saas/src/galley/kit.d.ts +1 -1
- package/dist/starters/astro-saas/src/galley/mailto/config.js +1 -1
- package/dist/starters/astro-saas/src/galley/mailto/runtime.gen.js +1 -1
- package/dist/starters/astro-saas/src/galley/runtime/site-config.js +1 -1
- package/dist/starters/astro-saas/src/galley/schema.js +1 -1
- package/dist/starters/astro-saas/src/galley/scripts/banner.js +1 -1
- package/dist/starters/astro-saas/src/galley/scripts/plan.js +1 -1
- package/dist/starters/astro-saas/src/galley/scripts/runtime.gen.js +1 -1
- package/dist/starters/astro-saas/src/galley/scripts/snippets.js +1 -1
- package/dist/starters/astro-saas/src/galley/shared/glob.js +1 -1
- package/dist/starters/astro-saas/src/galley/shared/markdown.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/config.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/content.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/crawlers.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/html.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/integration.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/markdown.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/page.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/site.js +1 -1
- package/dist/starters/astro-saas/src/galley/visibility/structured.js +1 -1
- package/dist/starters/astro-starter/src/galley/catalog-data.js +1 -1
- package/dist/starters/astro-starter/src/galley/catalog.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/attribution.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/forms.js +2 -2
- package/dist/starters/astro-starter/src/galley/client/providers/frame-post.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/galley.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/hubspot.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/mailto.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/marketo.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/pardot.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/salesforce.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/providers/webhook.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/registry.js +1 -1
- package/dist/starters/astro-starter/src/galley/client/types.d.ts +1 -1
- package/dist/starters/astro-starter/src/galley/components/ConsentBanner.astro +1 -1
- package/dist/starters/astro-starter/src/galley/components/Form.astro +1 -1
- package/dist/starters/astro-starter/src/galley/components/Scripts.astro +1 -1
- package/dist/starters/astro-starter/src/galley/components/index.js +1 -1
- package/dist/starters/astro-starter/src/galley/forms/forms.css +1 -1
- package/dist/starters/astro-starter/src/galley/forms/free-email-domains.js +1 -1
- package/dist/starters/astro-starter/src/galley/forms/logic.js +1 -1
- package/dist/starters/astro-starter/src/galley/forms/messages.js +1 -1
- package/dist/starters/astro-starter/src/galley/forms/render.js +1 -1
- package/dist/starters/astro-starter/src/galley/integration.js +1 -1
- package/dist/starters/astro-starter/src/galley/kit.d.ts +1 -1
- package/dist/starters/astro-starter/src/galley/mailto/config.js +1 -1
- package/dist/starters/astro-starter/src/galley/mailto/runtime.gen.js +1 -1
- package/dist/starters/astro-starter/src/galley/runtime/site-config.js +1 -1
- package/dist/starters/astro-starter/src/galley/schema.js +1 -1
- package/dist/starters/astro-starter/src/galley/scripts/banner.js +1 -1
- package/dist/starters/astro-starter/src/galley/scripts/plan.js +1 -1
- package/dist/starters/astro-starter/src/galley/scripts/runtime.gen.js +1 -1
- package/dist/starters/astro-starter/src/galley/scripts/snippets.js +1 -1
- package/dist/starters/astro-starter/src/galley/shared/glob.js +1 -1
- package/dist/starters/astro-starter/src/galley/shared/markdown.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/config.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/content.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/crawlers.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/html.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/integration.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/markdown.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/page.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/site.js +1 -1
- package/dist/starters/astro-starter/src/galley/visibility/structured.js +1 -1
- package/dist/starters/astro-storefront/src/galley/catalog-data.js +1 -1
- package/dist/starters/astro-storefront/src/galley/catalog.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/attribution.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/forms.js +2 -2
- package/dist/starters/astro-storefront/src/galley/client/providers/frame-post.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/galley.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/hubspot.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/mailto.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/marketo.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/pardot.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/salesforce.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/providers/webhook.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/registry.js +1 -1
- package/dist/starters/astro-storefront/src/galley/client/types.d.ts +1 -1
- package/dist/starters/astro-storefront/src/galley/components/ConsentBanner.astro +1 -1
- package/dist/starters/astro-storefront/src/galley/components/Form.astro +1 -1
- package/dist/starters/astro-storefront/src/galley/components/Scripts.astro +1 -1
- package/dist/starters/astro-storefront/src/galley/components/index.js +1 -1
- package/dist/starters/astro-storefront/src/galley/forms/forms.css +1 -1
- package/dist/starters/astro-storefront/src/galley/forms/free-email-domains.js +1 -1
- package/dist/starters/astro-storefront/src/galley/forms/logic.js +1 -1
- package/dist/starters/astro-storefront/src/galley/forms/messages.js +1 -1
- package/dist/starters/astro-storefront/src/galley/forms/render.js +1 -1
- package/dist/starters/astro-storefront/src/galley/integration.js +1 -1
- package/dist/starters/astro-storefront/src/galley/kit.d.ts +1 -1
- package/dist/starters/astro-storefront/src/galley/mailto/config.js +1 -1
- package/dist/starters/astro-storefront/src/galley/mailto/runtime.gen.js +1 -1
- package/dist/starters/astro-storefront/src/galley/runtime/site-config.js +1 -1
- package/dist/starters/astro-storefront/src/galley/schema.js +1 -1
- package/dist/starters/astro-storefront/src/galley/scripts/banner.js +1 -1
- package/dist/starters/astro-storefront/src/galley/scripts/plan.js +1 -1
- package/dist/starters/astro-storefront/src/galley/scripts/runtime.gen.js +1 -1
- package/dist/starters/astro-storefront/src/galley/scripts/snippets.js +1 -1
- package/dist/starters/astro-storefront/src/galley/shared/glob.js +1 -1
- package/dist/starters/astro-storefront/src/galley/shared/markdown.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/config.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/content.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/crawlers.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/html.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/integration.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/markdown.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/page.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/site.js +1 -1
- package/dist/starters/astro-storefront/src/galley/visibility/structured.js +1 -1
- package/dist/web/assets/{AppSettingsScreen-C-YJx3gF.js → AppSettingsScreen-Dc1Bnkjc.js} +1 -1
- package/dist/web/assets/{BodyEditor-8Hp9g0iX.js → BodyEditor-sFGFYiy3.js} +1 -1
- package/dist/web/assets/BrandScreen-sRlTBAK2.js +1 -0
- package/dist/web/assets/{CollectionScreen-Ci_RBTIP.js → CollectionScreen-B1Dk62it.js} +1 -1
- package/dist/web/assets/{EditorScreen-CG30ospj.js → EditorScreen-CzwKUTDg.js} +3 -3
- package/dist/web/assets/{FormsScreen-C5Z4-vVZ.js → FormsScreen-DIAnSDOR.js} +1 -1
- package/dist/web/assets/{HistoryScreen-Cz0FyF3N.js → HistoryScreen-rlc0r8Mc.js} +1 -1
- package/dist/web/assets/ImportScreen-C7Ktj3md.js +1 -0
- package/dist/web/assets/{InboxScreen-GB8e8oLq.js → InboxScreen-CfKusmcx.js} +1 -1
- package/dist/web/assets/{MediaLibraryPane-D5J9z7rw.js → MediaLibraryPane-DTjjTvfl.js} +1 -1
- package/dist/web/assets/{MediaScreen-CoOq4MwF.js → MediaScreen-DBLgSoRu.js} +1 -1
- package/dist/web/assets/{NewSiteScreen-B_2094y0.js → NewSiteScreen-B-KeJDBG.js} +1 -1
- package/dist/web/assets/{Online-CS3LLMG4.js → Online-CFMXFfKL.js} +1 -1
- package/dist/web/assets/{PluginsScreen-Cdkv2qWN.js → PluginsScreen-BpMt6QXM.js} +1 -1
- package/dist/web/assets/{PreviewPane-HeTLVD45.js → PreviewPane-BhtgFkYG.js} +1 -1
- package/dist/web/assets/{ProofScreen-BGAsVuYb.js → ProofScreen-DJPRt15E.js} +1 -1
- package/dist/web/assets/{ProviderSettings-BtM56M7d.js → ProviderSettings-CbQQdCdU.js} +1 -1
- package/dist/web/assets/{PublishDialog-Ctv1sxHs.js → PublishDialog-DhytG_-7.js} +1 -1
- package/dist/web/assets/{ReachNote-BJrBYKWR.js → ReachNote-D-RSOg6l.js} +1 -1
- package/dist/web/assets/RedirectsScreen-CSdhCO4l.js +3 -0
- package/dist/web/assets/RedirectsScreen-DayIuauB.css +1 -0
- package/dist/web/assets/{ScriptsScreen-BsYOIXkI.js → ScriptsScreen-mAuVetAc.js} +1 -1
- package/dist/web/assets/{SiteHomeScreen-C7LLVNdQ.js → SiteHomeScreen-BNmf8jor.js} +1 -1
- package/dist/web/assets/{SiteSettingsScreen-DhX8CluW.js → SiteSettingsScreen-CUJkP4Zt.js} +1 -1
- package/dist/web/assets/{SourceView-CkX8bKwR.js → SourceView-Dx9Hkcz6.js} +1 -1
- package/dist/web/assets/VisibilityScreen-0dqY5q9C.js +2 -0
- package/dist/web/assets/brand-ChGvDfhV.css +1 -0
- package/dist/web/assets/{codemirror-ClWBLK2a.js → codemirror-BDN0rzm7.js} +1 -1
- package/dist/web/assets/{index-CtsAxi5d.js → index-A7aTfJ-x.js} +2 -2
- package/dist/web/assets/{listPlan-BPJMzA6e.js → listPlan-Bds9RfG_.js} +1 -1
- package/dist/web/assets/{outside-Bv1jj3yu.js → outside-1xNdvt-F.js} +1 -1
- package/dist/web/assets/{paths-B6ATG9Kg.js → paths-C9eC1yfK.js} +1 -1
- package/dist/web/assets/{prefs-D04M07D3.js → prefs-BRO4YD9h.js} +1 -1
- package/dist/web/assets/{scaffold-DrnWBKU9.js → scaffold-CA0oGKYi.js} +1 -1
- package/dist/web/assets/{usePlugins-6k3yRVYT.js → usePlugins-D8UH3hzc.js} +1 -1
- package/dist/web/assets/{useVisibility-kpZhLMTT.js → useVisibility-DFye68F4.js} +3 -3
- package/dist/web/assets/words-CoSgsy_e.js +1 -0
- package/dist/web/index.html +1 -1
- package/package.json +4 -4
- package/dist/web/assets/BrandScreen-BuYHSbp6.js +0 -1
- package/dist/web/assets/ImportScreen-eVAPjnE2.js +0 -1
- package/dist/web/assets/RedirectsScreen-DeR_yuj5.js +0 -3
- package/dist/web/assets/RedirectsScreen-QTaAXMh-.css +0 -1
- package/dist/web/assets/VisibilityScreen-ChOKniqk.js +0 -2
- package/dist/web/assets/brand-BYux4UiC.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,A as t,C as n,Ft as r,H as i,I as a,N as o,Nt as s,O as c,S as l,St as u,_ as d,a as f,bt as p,g as m,gt as h,h as g,ht as _,j as v,k as y,kt as b,mt as x,n as S,pt as C,z as w}from"./ui-C6O2tW4c.js";import{n as T,r as ee,t as te}from"./jobs-BHawhnH2.js";import{o as ne}from"./events-CTTFdOf-.js";import{a as E,s as D}from"./chrome-Brnq5kGb.js";import{t as O}from"./site-DJUEXLHW.js";import{A as re,B as k}from"./index-CtsAxi5d.js";import{f as A,t as j}from"./paths-B6ATG9Kg.js";import{S as M,b as N,c as ie,f as ae,l as oe,o as se,p as ce,s as le,t as ue,u as de,v as fe,y as pe}from"./outside-Bv1jj3yu.js";import{d as me,f as he}from"./listPlan-BPJMzA6e.js";import{t as ge}from"./store-C95UZPFo.js";var P=r(s(),1),F=p(),_e=4500,I=(0,P.createContext)({marks:new Set});function ve(){return(0,P.useContext)(I).marks}function ye(e,t){return D(k.entry(e,t??``),()=>w(`GET /api/sites/:siteId/entry`,{params:{siteId:e},query:{path:t??``}}),{enabled:!!t})}function be(e,t){let n=t.path,[r]=(0,P.useState)(()=>ae(t,{send:(t,r)=>w(`PATCH /api/sites/:siteId/entry`,{params:{siteId:e},query:{path:n},body:{ops:t,baseHash:r}}),reload:()=>w(`GET /api/sites/:siteId/entry`,{params:{siteId:e},query:{path:n}}),onEntry:t=>he(e,t)}));return(0,P.useEffect)(()=>()=>r.actions.dispose(),[r]),r}function xe({siteId:e,entry:t,marksFor:n,children:r}){let i=be(e,t),a=(0,P.useRef)(null),[o,s]=(0,P.useState)(()=>new Set),c=(0,P.useRef)(n);c.current=n;let l=O(e=>e.detail?.model.media??null);ne(`changes.updated`,n=>{n.siteId===e&&n.paths.includes(t.path)&&(a.current=n.origin)}),(0,P.useEffect)(()=>{i.actions.receive(t,ue({own:me(e,t),origin:a.current})),a.current=null},[t,i,e]),(0,P.useEffect)(()=>{let e,t=i.subscribe((t,n)=>{if(!t.outside||t.outside===n.outside)return;let r=c.current(n.stored,t.stored);r.length!==0&&(s(new Set(r)),clearTimeout(e),e=setTimeout(()=>s(new Set),_e))});return()=>{t(),clearTimeout(e)}},[i]);let[u,d]=(0,P.useState)(!1),f=(0,P.useRef)(null),p=(0,P.useCallback)(()=>new Promise(e=>{f.current?.(null),f.current=e,d(!0)}),[]),m=e=>{f.current?.(e),f.current=null,d(!1)},h=(0,P.useMemo)(()=>({store:i,siteId:e,entryPath:t.path,media:l,select:()=>void 0,pickImage:p,preview:()=>void 0}),[i,e,t.path,l,p]),g=(0,P.useMemo)(()=>({marks:o}),[o]);return(0,F.jsxs)(ce.Provider,{value:h,children:[(0,F.jsx)(I.Provider,{value:g,children:r}),(0,F.jsx)(A,{siteId:e,open:u,onClose:()=>m(null),onPick:e=>m(e)})]})}var Se=0,L=n(e=>({open:!1,request:null,show:t=>e({open:!0,request:t?{...t,nonce:++Se}:null}),hide:()=>e({open:!1,request:null})}));function R(){let e=D(k.settings(),()=>w(`GET /api/settings`));return e.data?e.data.secrets.some(e=>e.name===`anthropic`&&e.configured):null}function z(){return O(e=>e.detail?.model.ai.allowBuild??!1)}function Ce({siteId:e,entryPath:t}){let n=L(e=>e.open),r=L(e=>e.request),i=L(e=>e.hide),a=(0,P.useRef)(null);return(0,P.useEffect)(()=>{n&&r?.draft&&ge.getState().offerDraft(e,r.draft,r.mode)},[n,r,e]),(0,P.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&a.current?.contains(document.activeElement)&&i()};return window.addEventListener(`keydown`,e),requestAnimationFrame(()=>a.current?.querySelector(`textarea`)?.focus()),()=>window.removeEventListener(`keydown`,e)},[n,i]),n?(0,F.jsxs)(`aside`,{ref:a,className:`g-pane kit-assistant`,"aria-label":`Assistant`,children:[(0,F.jsxs)(`div`,{className:`g-pane__head kit-assistant__head`,children:[(0,F.jsx)(`span`,{className:`kit-assistant__title`,children:`Assistant`}),(0,F.jsx)(`span`,{className:`g-toolbar__spacer`}),(0,F.jsx)(de,{siteId:e}),(0,F.jsx)(x,{icon:`close`,label:`Close the assistant`,onClick:i})]}),(0,F.jsx)(`div`,{className:`kit-assistant__body`,children:(0,F.jsx)(oe,{siteId:e,context:t?{entryPath:t}:void 0,initialMessage:r?.send},r?.send?r.nonce:`panel`)})]}):null}var B=e=>[`site`,e,`kit`];function V(e){return D(B(e),()=>w(`GET /api/sites/:siteId/kit`,{params:{siteId:e}}),{enabled:e!==``})}async function we(e,t,n){let r=n===`visibility`?await w(`POST /api/sites/:siteId/kit/visibility`,{params:{siteId:e}}):await w(`POST /api/sites/:siteId/kit/setup`,{params:{siteId:e}});T.getState().upsert(r);let i=!1,a=n=>{i||n.state===`running`||(i=!0,o(),O.getState().refresh(),E(B(e)),t(n))},o=T.subscribe(e=>{let t=e.jobs.find(e=>e.id===r.id);t&&a(t)});return a(r),r}function Te(e){return{ready:e.steps.filter(e=>e.state===`ready`),left:e.steps.filter(e=>e.state===`left`)}}async function Ee(e){let t=await w(`POST /api/sites/:siteId/kit/endpoint`,{params:{siteId:e}});return E(B(e)),t}var De={forms:{title:`This site doesn’t have forms yet.`,body:`Forms are files the site’s own pages show, so the site needs the site kit first. Set it up for me adds it, with a first “Contact” form, as changes you check in Proof.`,left:`Forms are nearly set up.`},scripts:{title:`This site doesn’t manage its scripts here yet.`,body:`Scripts are kept in one setup file the site reads when it builds, so the site needs the site kit first. Set it up for me adds it as changes you check in Proof.`,left:`Scripts are nearly set up.`}};function Oe({steps:e}){return(0,F.jsx)(`ul`,{className:`kit-setup__steps`,children:e.map(e=>(0,F.jsxs)(`li`,{className:`kit-setup__step kit-setup__step--${e.state}`,children:[(0,F.jsx)(`span`,{className:`kit-setup__step-label`,children:e.label}),e.state===`left`&&e.detail?(0,F.jsx)(`span`,{className:`kit-setup__step-detail`,children:e.detail}):null]},e.id))})}function ke({steps:e}){let t=e.filter(e=>e.snippet);return t.length===0?null:(0,F.jsxs)(`details`,{className:`app-details kit-setup__dev`,children:[(0,F.jsx)(`summary`,{children:`For developers`}),t.map(e=>(0,F.jsxs)(`div`,{className:`kit-setup__snippet`,children:[(0,F.jsx)(`p`,{className:`g-field__key`,children:e.snippet.file}),(0,F.jsx)(`pre`,{className:`kit-embed__code`,children:(0,F.jsx)(`code`,{children:e.snippet.code})})]},e.id))]})}function Ae({detail:e}){return(0,F.jsx)(o,{mark:`caret`,title:`Setting up forms and scripts…`,body:e??`Reading the site`,children:(0,F.jsx)(`div`,{className:`kit-setup__working`,role:`status`,children:(0,F.jsx)(g,{label:`Setting up`})})})}function je({feature:e}){let t=b(),n=O(e=>e.detail?.id??``),r=l(e=>e.meta?.brand.docsUrl),s=R(),c=z(),d=L(e=>e.show),f=V(n),[p,h]=(0,P.useState)(null),[g,v]=(0,P.useState)(!1),y=te(p),x=De[e],w=g||p!==null&&(y===null||y.state===`running`);ee(p,w);let T=e=>{e.state===`error`?S({tone:`danger`,title:`Couldn’t set up forms and scripts`,body:e.detail??`Nothing was changed.`}):S({tone:e.output?`warning`:`success`,title:`Forms and scripts are set up`,body:e.detail,...e.output?{detail:e.output}:{},action:{label:`Open Proof`,onClick:()=>t(`/sites/${n}/proof`)},duration:12e3})},ne=async()=>{v(!0);try{let e=await we(n,T);h(e.id)}catch(e){S({tone:`danger`,title:`Couldn’t set up forms and scripts`,body:i(e).message})}finally{v(!1)}};if(w)return(0,F.jsx)(Ae,{detail:y?.detail});if(f.loading||!n)return(0,F.jsx)(m,{lines:4,height:14});if(!f.data)return(0,F.jsx)(a,{title:`Couldn’t check this site’s set-up`,error:f.error,onRetry:()=>void f.refetch()});let E=f.data,D=re(r,e);if(!E.supported){let e=re(r,`adapters`);return(0,F.jsx)(o,{mark:`pilcrow`,title:`The site kit is for Astro sites today.`,body:E.reason,actions:e?(0,F.jsx)(`a`,{className:_(`primary`),href:e,target:`_blank`,rel:`noreferrer`,children:`Read the adapter guide`}):null})}let{ready:k,left:A}=Te(E),j=e=>D?(0,F.jsx)(`a`,{className:_(e?`primary`:`secondary`),href:D,target:`_blank`,rel:`noreferrer`,children:`How a developer does it`}):null,M=s&&c&&E.assistantRequest?(0,F.jsx)(C,{variant:k.length>0?`secondary`:`primary`,icon:`chat`,onClick:()=>d({draft:E.assistantRequest,mode:`build`}),children:`Ask the assistant to finish it`}):null;return k.length===0&&A.length>0?(0,F.jsxs)(o,{mark:`caret`,title:x.left,body:`Set-up did everything it could without guessing. ${A.length===1?`One part of the site’s code is`:`${A.length} parts of the site’s code are`} left:`,actions:(0,F.jsxs)(F.Fragment,{children:[M,j(!M)]}),children:[(0,F.jsx)(Oe,{steps:A}),(0,F.jsx)(ke,{steps:A})]}):E.buildAllowed?(0,F.jsxs)(o,{mark:`pilcrow`,title:x.title,body:x.body,actions:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(C,{variant:`primary`,icon:`plus`,busy:g,busyLabel:`Starting…`,onClick:()=>void ne(),children:`Set it up for me`}),j(!1)]}),children:[(0,F.jsx)(Oe,{steps:[...k,...A]}),A.length>0?(0,F.jsx)(`p`,{className:`g-hint`,children:`The parts marked as left need a developer or the assistant afterwards; set-up won’t guess at them.`}):null,e===`forms`?(0,F.jsx)(`p`,{className:`g-hint kit-setup__inbox`,children:E.inbox.reachable&&E.inbox.address?`The live site’s forms will send to this app’s inbox at ${E.inbox.address}.`:`Forms in the preview send to this app’s inbox. Visitors can’t reach it from this computer, so the Forms screen then asks where the live site should send submissions.`}):null]}):(0,F.jsx)(o,{mark:`pilcrow`,title:x.title,body:`Setting it up changes the site’s code, and this site’s settings turn that off. Turn on “Allow build mode” in Site settings › Assistant, or have a developer add the site kit by hand.`,actions:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(u,{className:_(`primary`),to:`/sites/${n}/settings#assistant`,children:`Open Site settings › Assistant`}),j(!1)]})})}function Me({step:t}){let n=V(O(e=>e.detail?.id??``)),r=R(),i=z(),a=L(e=>e.show),o=n.data?.steps.find(e=>e.id===t&&e.state===`left`);return!o||!n.data?null:(0,F.jsxs)(`div`,{className:`kit-callout`,role:`note`,children:[(0,F.jsx)(e,{kind:`bang`,className:`kit-callout__mark`}),(0,F.jsxs)(`div`,{className:`kit-callout__main`,children:[(0,F.jsxs)(`p`,{className:`kit-callout__title`,children:[`One part of the set-up is left: `,o.label.toLowerCase()]}),o.detail?(0,F.jsxs)(`p`,{className:`kit-callout__body`,children:[o.detail,` Until then, nothing here loads on the site’s pages.`]}):null,(0,F.jsx)(ke,{steps:[o]}),r&&i&&n.data.assistantRequest?(0,F.jsx)(`div`,{className:`kit-callout__actions`,children:(0,F.jsx)(C,{size:`sm`,variant:`primary`,icon:`chat`,onClick:()=>a({draft:n.data.assistantRequest,mode:`build`}),children:`Ask the assistant to finish it`})}):null]})]})}function H(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ne(e){return JSON.parse(JSON.stringify(e))}function U(e){return Array.isArray(e)?e.filter(H):[]}var W=e=>typeof e==`string`?e:void 0;function Pe(e){return{...e,name:W(e.name)??``,submitLabel:W(e.submitLabel)??``,fields:U(e.fields).map(e=>({...e,id:W(e.id)??``,type:W(e.type)??`text`})),destinations:U(e.destinations).map(e=>({...e,provider:W(e.provider)??``,settings:H(e.settings)?e.settings:{}})),afterSubmit:U(e.afterSubmit)}}function Fe(e){return{...e,id:W(e.id)??``,kind:W(e.kind)??`custom`,enabled:e.enabled!==!1,settings:H(e.settings)?e.settings:{}}}function Ie(e){return H(e)?Fe(e):null}function Le(e){return{...e,scripts:U(e.scripts).map(Fe),consent:H(e.consent)?e.consent:void 0}}function G(e){return e==null?``:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e)}var K={destinations:`area:destinations`,afterSubmit:`area:afterSubmit`,settings:`area:settings`},Re=e=>`field:${e}`;function q(e){let t=new Map;if(!Array.isArray(e))return t;for(let n of e)H(n)&&typeof n.id==`string`&&t.set(n.id,n);return t}function ze(e,t){let n=[],r=q(e.fields);for(let[e,i]of q(t.fields))j(r.get(e),i)||n.push(Re(e));j(e.destinations,t.destinations)||n.push(K.destinations),j(e.afterSubmit,t.afterSubmit)||n.push(K.afterSubmit);let i=e=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==`fields`&&e!==`destinations`&&e!==`afterSubmit`));return j(i(e),i(t))||n.push(K.settings),n}function Be(e,t){let n=[],r=q(e.scripts);for(let[e,i]of q(t.scripts))j(r.get(e),i)||n.push(`script:${e}`);return j(e.consent,t.consent)||n.push(`area:consent`),n}function Ve({subject:t,context:n,examples:r,placeholder:i}){let[a,o]=(0,P.useState)(``),s=L(e=>e.show),c=R(),l=(0,P.useId)(),u=(0,P.useRef)(null),d=e=>{let t=e.trim();t&&(s({send:`${n} ${t}`}),o(``))};return(0,F.jsxs)(`form`,{className:`kit-ask`,onSubmit:e=>{e.preventDefault(),d(a)},"aria-labelledby":`${l}-label`,children:[(0,F.jsxs)(`span`,{id:`${l}-label`,className:`kit-ask__label`,children:[(0,F.jsx)(e,{kind:`caret`}),`Ask about `,t]}),(0,F.jsx)(`input`,{ref:u,className:`g-input g-input--sm kit-ask__input`,"aria-labelledby":`${l}-label`,placeholder:c===!1?`Connect the assistant in Settings to ask for changes`:i,value:a,disabled:c===!1,onChange:e=>o(e.target.value)}),(0,F.jsx)(C,{size:`sm`,type:`submit`,disabled:!a.trim()||c===!1,children:`Ask`}),c===!1?null:(0,F.jsx)(`span`,{className:`kit-ask__chips`,children:r.map(e=>(0,F.jsx)(`button`,{type:`button`,className:`g-chip kit-ask__chip`,onClick:()=>{o(e),u.current?.focus()},children:e},e))})]})}function He(){return pe(e=>e.data)}function Ue(){let e=He();return(0,P.useMemo)(()=>Pe(e),[e])}function We(){let e=He();return(0,P.useMemo)(()=>Le(e),[e])}function J(){let{store:e}=fe(),t=(0,P.useCallback)((t,n,r=!1)=>e.actions.edit(t,n,{required:r}),[e]),n=(0,P.useCallback)((t,n)=>e.actions.edit(t,n,{required:!1,immediate:!0}),[e]),r=(0,P.useCallback)(t=>e.actions.commit(t),[e]),i=(0,P.useCallback)((...t)=>{t.length>0&&e.actions.apply(...t)},[e]),a=(0,P.useCallback)(()=>e.getState().data,[e]);return(0,P.useMemo)(()=>({type:t,choose:n,commit:r,apply:i,read:a}),[t,n,r,i,a])}function Ge(e){return M(e)}function Ke({path:e,label:n,hint:r,error:i,hideLabel:a,aside:o,placeholder:s,keep:l,mono:u,multiline:d,inputRef:f,onTyped:p,autoComplete:m=`off`,list:h}){let g=J(),_=G(N(e)),y=Ge(e),b=t=>{g.type(e,t===``?void 0:t,l),p?.(t)};return(0,F.jsx)(v,{label:n,hint:r,error:i??y,hideLabel:a,aside:o,children:d?(0,F.jsx)(t,{value:_,placeholder:s,mono:u,maxRows:10,onChange:e=>b(e.target.value),onBlur:()=>g.commit(e)}):(0,F.jsx)(c,{ref:f,value:_,placeholder:s,mono:u,autoComplete:m,list:h,spellCheck:!u,onChange:e=>b(e.target.value),onBlur:()=>g.commit(e)})})}function qe({path:e,label:t,hint:n,error:r,placeholder:i,min:a}){let o=J(),s=N(e),[l,u]=(0,P.useState)(null),d=l??(typeof s==`number`?String(s):``),f=l!==null&&l.trim()!==``&&!Number.isFinite(Number(l));return(0,F.jsx)(v,{label:t,hint:n,error:f?`Type a number.`:r,children:(0,F.jsx)(c,{inputMode:`decimal`,value:d,placeholder:i,onChange:t=>{let n=t.target.value;u(n),n.trim()===``?o.type(e,void 0):Number.isFinite(Number(n))&&(a===void 0||Number(n)>=a)&&o.type(e,Number(n))},onBlur:()=>{u(null),o.commit(e)}})})}function Je({path:e,label:t,description:n,absent:r=!1}){let i=J(),a=N(e);return(0,F.jsx)(f,{checked:typeof a==`boolean`?a:r,label:t,description:n,onChange:t=>i.choose(e,t===r?void 0:t)})}function Ye({path:e,label:t,hint:n,options:r,absent:i,as:a=`segmented`}){let o=J(),s=N(e),c=typeof s==`string`&&r.some(e=>e.value===s)?s:i,l=t=>o.choose(e,t===i?void 0:t);return a===`select`?(0,F.jsx)(v,{label:t,hint:n,children:(0,F.jsx)(y,{value:c,options:r,onChange:e=>l(e)})}):(0,F.jsx)(v,{label:t,hint:n,group:!0,children:(0,F.jsx)(d,{label:typeof t==`string`?t:`Choose`,options:r,value:c,onChange:l})})}var Y=[{id:`galley`,name:`Galley inbox`,description:`Submissions arrive in this app's inbox, with e-mail alerts and forwarding. The default.`,settings:[{key:`endpoint`,label:`Capture address`,placeholder:`https://cms.example.com/f/…`,help:`Leave empty to use the address set once for the whole site.`}],canImportFields:!1},{id:`hubspot`,name:`HubSpot`,description:`Sends to a HubSpot form, so its workflows, lists and notifications run as usual.`,settings:[{key:`portalId`,label:`Hub ID`,placeholder:`12345678`,pattern:`^[0-9]{4,12}$`,required:!0},{key:`formId`,label:`Form ID`,placeholder:`0f8fad5b-d9cb-469f-a165-70867728950e`,pattern:`^[0-9a-fA-F-]{36}$`,required:!0},{key:`region`,label:`Data region`,placeholder:`na1`,pattern:`^[a-z]{2}[0-9]$`,help:`Only for accounts outside North America, e.g. eu1.`}],canImportFields:!0,docsUrl:`https://developers.hubspot.com/docs/api/marketing/forms`},{id:`marketo`,name:`Marketo`,description:`Submits through a Marketo form, keeping its validation, known-visitor matching and campaigns.`,settings:[{key:`munchkinId`,label:`Munchkin ID`,placeholder:`123-ABC-456`,pattern:`^[0-9]{3}-[A-Za-z]{3}-[0-9]{3}$`,required:!0},{key:`formId`,label:`Form ID`,placeholder:`1234`,pattern:`^[0-9]+$`,required:!0},{key:`host`,label:`Marketo address`,placeholder:`https://go.example.com`,pattern:`^https://.+`,help:`Where your Marketo forms are served from (a landing-page domain or app-xx.marketo.com).`,required:!0}],canImportFields:!0,docsUrl:`https://experienceleague.adobe.com/en/docs/marketo-developer/marketo/javascriptapi/forms-api-reference`},{id:`salesforce`,name:`Salesforce`,description:`Creates a lead with Web-to-Lead.`,settings:[{key:`orgId`,label:`Organization ID`,placeholder:`00D…`,pattern:`^00D[A-Za-z0-9]{12,15}$`,required:!0},{key:`returnUrl`,label:`Return address`,placeholder:`https://www.example.com/thanks/`,help:`Optional. Salesforce sends the visitor here after it accepts the lead.`},{key:`mode`,label:`Sending`,placeholder:`frame`,pattern:`^(frame|navigate)$`,help:`frame (default): sent in the background and the visitor stays on the page. navigate: the visitor goes to Salesforce and then to the return address.`}],canImportFields:!1,docsUrl:`https://help.salesforce.com/s/articleView?id=sales.setting_up_web-to-lead.htm`},{id:`pardot`,name:`Pardot (Account Engagement)`,description:`Posts to an Account Engagement form handler.`,settings:[{key:`handlerUrl`,label:`Form handler address`,placeholder:`https://go.example.com/l/123456/2026-01-01/abc123`,pattern:`^https://.+/l/[0-9]+/.+`,required:!0},{key:`successLocation`,label:`Success location`,placeholder:`https://www.example.com/forms/sent/`,pattern:`^https://.+`,help:`Optional. The same address as the handler's Success Location. A page on this site lets the form tell success from failure.`},{key:`errorLocation`,label:`Error location`,placeholder:`https://www.example.com/forms/not-sent/`,pattern:`^https://.+`,help:`Optional. The same address as the handler's Error Location, on this site.`},{key:`mode`,label:`Sending`,placeholder:`frame`,pattern:`^(frame|navigate)$`,help:`frame (default) or navigate, as for Salesforce.`}],canImportFields:!1,docsUrl:`https://help.salesforce.com/s/articleView?id=sf.pardot_forms_handler_create.htm`},{id:`webhook`,name:`Webhook`,description:`Posts the submission to any address — an automation tool, a function, your own service.`,settings:[{key:`url`,label:`Address`,placeholder:`https://hooks.example.com/…`,pattern:`^https://.+`,required:!0},{key:`format`,label:`Format`,placeholder:`json`,pattern:`^(json|form)$`,help:`json (default) or form.`}],canImportFields:!1},{id:`mailto`,name:`E-mail program`,description:`Opens the visitor's own mail program with the answers filled in. A last resort: nothing is stored.`,settings:[{key:`to`,label:`Send to`,placeholder:`hello@example.com`,pattern:`^[^@\\s]+@[^@\\s]+$`,required:!0},{key:`subject`,label:`Subject`,placeholder:`Website enquiry`}],canImportFields:!1}],X=[{kind:`gtm`,name:`Google Tag Manager`,description:`One container that loads your other tags.`,category:`tag-manager`,defaultConsent:`analytics`,defaultPlacement:`head`,settings:[{key:`containerId`,label:`Container ID`,placeholder:`GTM-XXXXXXX`,pattern:`^GTM-[A-Z0-9]{4,10}$`,required:!0},{key:`noscript`,label:`No-JavaScript frame`,placeholder:`false`,pattern:`^(true|false)$`,help:`Also add Google's older <noscript> frame after <body>. Only on pages where the container needs no consent.`}],docsUrl:`https://developers.google.com/tag-platform/tag-manager/web`},{kind:`ga4`,name:`Google Analytics 4`,description:`Page views and events in Google Analytics.`,category:`analytics`,defaultConsent:`analytics`,defaultPlacement:`head`,settings:[{key:`measurementId`,label:`Measurement ID`,placeholder:`G-XXXXXXXXXX`,pattern:`^G-[A-Z0-9]{6,12}$`,required:!0}],docsUrl:`https://developers.google.com/analytics/devguides/collection/ga4`},{kind:`meta-pixel`,name:`Meta Pixel`,description:`Conversion tracking for Facebook and Instagram ads.`,category:`advertising`,defaultConsent:`marketing`,defaultPlacement:`head`,settings:[{key:`pixelId`,label:`Pixel ID`,placeholder:`123456789012345`,pattern:`^[0-9]{10,20}$`,required:!0}],docsUrl:`https://developers.facebook.com/docs/meta-pixel/get-started`},{kind:`linkedin-insight`,name:`LinkedIn Insight Tag`,description:`Conversion tracking and audiences for LinkedIn ads.`,category:`advertising`,defaultConsent:`marketing`,defaultPlacement:`body-end`,settings:[{key:`partnerId`,label:`Partner ID`,placeholder:`1234567`,pattern:`^[0-9]{5,10}$`,required:!0}],docsUrl:`https://www.linkedin.com/help/lms/answer/a418880`},{kind:`hubspot`,name:`HubSpot tracking code`,description:`Visitor tracking, chat and pop-ups from HubSpot.`,category:`marketing`,defaultConsent:`marketing`,defaultPlacement:`body-end`,settings:[{key:`portalId`,label:`Hub ID`,placeholder:`12345678`,pattern:`^[0-9]{4,12}$`,required:!0},{key:`region`,label:`Data region`,placeholder:`na1`,pattern:`^[a-z]{2}[0-9]$`,help:`Only for accounts outside North America, e.g. eu1.`}],docsUrl:`https://knowledge.hubspot.com/reports/install-the-hubspot-tracking-code`},{kind:`marketo-munchkin`,name:`Marketo Munchkin`,description:`Visitor tracking for Marketo.`,category:`marketing`,defaultConsent:`marketing`,defaultPlacement:`head`,settings:[{key:`munchkinId`,label:`Munchkin ID`,placeholder:`123-ABC-456`,pattern:`^[0-9]{3}-[A-Za-z]{3}-[0-9]{3}$`,required:!0}],docsUrl:`https://experienceleague.adobe.com/en/docs/marketo-developer/marketo/javascriptapi/leadtracking/lead-tracking`},{kind:`plausible`,name:`Plausible`,description:`Privacy-friendly page analytics without cookies.`,category:`analytics`,defaultConsent:`necessary`,defaultPlacement:`head`,settings:[{key:`scriptId`,label:`Script ID`,placeholder:`pa-XXXXXXXXXXXX`,pattern:`^pa-[A-Za-z0-9_-]{6,64}$`,help:`From Site installation in Plausible's settings (the pa-….js file name). Sites set up before October 2025 can give the domain instead.`},{key:`domain`,label:`Site domain (older script)`,placeholder:`example.com`,pattern:`^[a-z0-9.-]+\\.[a-z]{2,}$`},{key:`host`,label:`Script address`,placeholder:`https://plausible.io`,pattern:`^https://.+`,help:`Only if you host Plausible yourself.`}],docsUrl:`https://plausible.io/docs/plausible-script`},{kind:`segment`,name:`Segment`,description:`One stream of events sent on to your other tools.`,category:`analytics`,defaultConsent:`analytics`,defaultPlacement:`head`,settings:[{key:`writeKey`,label:`Write key`,placeholder:`abc123…`,pattern:`^[A-Za-z0-9]{16,64}$`,required:!0}],docsUrl:`https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/`},{kind:`hotjar`,name:`Hotjar`,description:`Heatmaps and session recordings.`,category:`analytics`,defaultConsent:`analytics`,defaultPlacement:`head`,settings:[{key:`siteId`,label:`Site ID`,placeholder:`1234567`,pattern:`^[0-9]{5,10}$`,required:!0}],docsUrl:`https://help.hotjar.com/hc/en-us/articles/115009336727`},{kind:`clarity`,name:`Microsoft Clarity`,description:`Heatmaps and session recordings.`,category:`analytics`,defaultConsent:`analytics`,defaultPlacement:`head`,settings:[{key:`projectId`,label:`Project ID`,placeholder:`abcdefghij`,pattern:`^[a-z0-9]{8,12}$`,required:!0}],docsUrl:`https://learn.microsoft.com/en-us/clarity/setup-and-installation/clarity-setup`},{kind:`intercom`,name:`Intercom`,description:`The Intercom messenger.`,category:`support`,defaultConsent:`preferences`,defaultPlacement:`body-end`,settings:[{key:`appId`,label:`App ID`,placeholder:`abc123de`,pattern:`^[a-z0-9]{6,12}$`,required:!0},{key:`region`,label:`Data region`,placeholder:`us`,pattern:`^(us|eu|au)$`,help:`Where your Intercom workspace is hosted: us (default), eu or au.`}],docsUrl:`https://developers.intercom.com/installing-intercom/web/installation`},{kind:`custom`,name:`Custom script`,description:`Any other script: a file to load, or code to run.`,category:`other`,defaultConsent:`marketing`,defaultPlacement:`body-end`,settings:[{key:`src`,label:`Script address`,placeholder:`https://cdn.example.com/widget.js`,pattern:`^https://.+`},{key:`inline`,label:`Code`,help:`Used when there is no script address. Runs as it is written.`}]}],Xe=`@galley/builtin`,Z=e=>e.map(e=>({...e,plugin:Xe})),Q=n(e=>({formProviders:Z(Y),scriptIntegrations:Z(X),pluginNames:{},set:(t,n)=>e({formProviders:t.formProviders,scriptIntegrations:t.scriptIntegrations,pluginNames:n})}));function Ze(e){return Q.getState().formProviders.find(t=>t.id===e&&t.plugin!==`@galley/builtin`)??null}function Qe(e){return Q.getState().scriptIntegrations.find(t=>t.kind===e&&t.plugin!==`@galley/builtin`)??null}function $e(e){return`From a plugin that isn’t active: ${e}`}function et(e){let t=D(k.catalog(e),async()=>{let t=await w(`GET /api/sites/:siteId/catalog`,{params:{siteId:e}}),n=await w(`GET /api/sites/:siteId/plugins`,{params:{siteId:e}}).catch(()=>null),r=Object.fromEntries((n?.plugins??[]).map(e=>[e.name,e.displayName]));return Q.getState().set(t,r),{result:t,names:r}},{enabled:!!e,deps:[k.site(e),[`plugins`]]}),n=Q.getState(),r=t.data;return{formProviders:r?.result.formProviders??Z(Y),scriptIntegrations:r?.result.scriptIntegrations??Z(X),live:!!r,nameOf:e=>r?.names[e]??n.pluginNames[e]??e}}function tt(e){return!!(e.snippet&&e.plugin!==`@galley/builtin`)}function nt(e,t){let n=e=>{let n=t[e];return n==null?``:String(n)},r=(e,t)=>e.replace(/\{\{\s*([A-Za-z][\w-]*)\s*\}\}/g,(e,r)=>t(n(r))),i=e=>JSON.stringify(e).slice(1,-1).replace(/</g,`\\u003c`).replace(/>/g,`\\u003e`),a={};return e.src&&(a.src=r(e.src,encodeURIComponent)),e.inline&&(a.inline=r(e.inline,i)),e.attributes&&(a.attributes=Object.fromEntries(Object.entries(e.attributes).map(([e,t])=>[e,r(t,e=>e.replace(/"/g,`"`))]))),a}function rt(e,t,n){let r=nt(t.snippet,e.settings),i={};return r.src&&(i.src=r.src),r.inline&&(i.inline=r.inline),r.attributes&&Object.keys(r.attributes).length&&(i.attributes=r.attributes),{...e,kind:`custom`,label:t.name,settings:i,note:`Added from the plugin ${n}.`}}var it=`application/x-galley-card`;function at(e,t){let[n,r]=(0,P.useState)(null),i=(0,P.useRef)(n),a=e=>{i.current=e,r(e)},o=(0,P.useRef)(t);o.current=t;let s=n!==null;return(0,P.useEffect)(()=>{if(s)return se(()=>e.current)},[s,e]),{card:(0,P.useCallback)(e=>{let t=n,r=t&&t.over===e&&le(t.from,t.over,t.after)!==null?t.after?`after`:`before`:void 0;return{onDragOver:t=>{let n=i.current;if(!n||!t.dataTransfer.types.includes(it))return;t.preventDefault(),t.dataTransfer.dropEffect=`move`;let r=ie(t.clientY,t.currentTarget.getBoundingClientRect());(n.over!==e||n.after!==r)&&a({...n,over:e,after:r})},onDrop:e=>{let t=i.current;if(!t)return;e.preventDefault(),a(null);let n=le(t.from,t.over,t.after);n!==null&&o.current(t.from,n)},...r?{"data-drop":r}:{},...t?.from===e?{"data-dragging":!0}:{}}},[n]),grip:(0,P.useCallback)((e,t)=>({draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setData(it,String(e)),n.dataTransfer.setData(`text/plain`,`Item ${e+1}`);let r=t?.();r&&n.dataTransfer.setDragImage(r,24,18),a({from:e,over:e,after:!1})},onDragEnd:()=>a(null)}),[])}}function $(e,t){let n=G(t).trim();if(!n)return e.required?`Add the ${e.label}.`:null;if(!e.pattern)return null;let r;try{r=new RegExp(e.pattern)}catch{return null}return r.test(n)?null:e.placeholder?`Check the ${e.label} — it usually looks like ${e.placeholder}${/[.…]$/.test(e.placeholder)?``:`.`}`:`Check the ${e.label}.`}function ot(e,t){let n={};for(let r of e){let e=$(r,t[r.key]);e&&(n[r.key]=e)}return n}function st(e,t){return Object.keys(ot(e,t)).length===0}var ct={galley:`In`,hubspot:`Hs`,marketo:`Mk`,salesforce:`Sf`,pardot:`Pd`,webhook:`→`,mailto:`@`};function lt({text:e,size:t=`md`,className:n}){return(0,F.jsx)(`span`,{className:h(`kit-mark`,t===`sm`&&`kit-mark--sm`,n),"aria-hidden":`true`,children:e})}function ut(e){return ct[e]??e.slice(0,2)}function dt({path:e,specs:t,values:n}){let[r,i]=(0,P.useState)(()=>new Set);return(0,F.jsx)(`div`,{className:`kit-settings`,onBlur:e=>{let t=e.target.closest(`[data-setting]`)?.dataset.setting;t&&!r.has(t)&&i(new Set(r).add(t))},children:t.map(t=>{let i=n[t.key],a=r.has(t.key)||G(i).trim()!==``?$(t,i):null;return(0,F.jsx)(`div`,{"data-setting":t.key,children:(0,F.jsx)(Ke,{path:[...e,t.key],label:t.label,aside:t.required?(0,F.jsx)(`span`,{className:`kit-required`,children:`Required`}):(0,F.jsx)(`span`,{className:`g-faint`,children:`Optional`}),placeholder:t.placeholder,hint:a?void 0:t.help,error:a,mono:t.key!==`subject`&&t.key!==`label`,multiline:t.key===`inline`})},t.key)})})}export{Ie as A,xe as B,Ve as C,Be as D,ze as E,Ee as F,ye as H,we as I,V as L,Ne as M,Me as N,H as O,je as P,Ce as R,We as S,Re as T,ve as V,qe as _,st as a,J as b,tt as c,rt as d,Qe as f,Ye as g,X as h,$ as i,G as j,Pe as k,$e as l,Y as m,lt as n,at as o,et as p,ut as r,Xe as s,dt as t,Ze as u,Ke as v,K as w,Ue as x,Je as y,z};
|
|
1
|
+
import{$ as e,A as t,C as n,Ft as r,H as i,I as a,N as o,Nt as s,O as c,S as l,St as u,_ as d,a as f,bt as p,g as m,gt as h,h as g,ht as _,j as v,k as y,kt as b,mt as x,n as S,pt as C,z as w}from"./ui-C6O2tW4c.js";import{n as T,r as ee,t as te}from"./jobs-BHawhnH2.js";import{o as ne}from"./events-CTTFdOf-.js";import{a as E,s as D}from"./chrome-Brnq5kGb.js";import{t as O}from"./site-DJUEXLHW.js";import{A as re,B as k}from"./index-A7aTfJ-x.js";import{f as A,t as j}from"./paths-C9eC1yfK.js";import{S as M,b as N,c as ie,f as ae,l as oe,o as se,p as ce,s as le,t as ue,u as de,v as fe,y as pe}from"./outside-1xNdvt-F.js";import{d as me,f as he}from"./listPlan-Bds9RfG_.js";import{t as ge}from"./store-C95UZPFo.js";var P=r(s(),1),F=p(),_e=4500,I=(0,P.createContext)({marks:new Set});function ve(){return(0,P.useContext)(I).marks}function ye(e,t){return D(k.entry(e,t??``),()=>w(`GET /api/sites/:siteId/entry`,{params:{siteId:e},query:{path:t??``}}),{enabled:!!t})}function be(e,t){let n=t.path,[r]=(0,P.useState)(()=>ae(t,{send:(t,r)=>w(`PATCH /api/sites/:siteId/entry`,{params:{siteId:e},query:{path:n},body:{ops:t,baseHash:r}}),reload:()=>w(`GET /api/sites/:siteId/entry`,{params:{siteId:e},query:{path:n}}),onEntry:t=>he(e,t)}));return(0,P.useEffect)(()=>()=>r.actions.dispose(),[r]),r}function xe({siteId:e,entry:t,marksFor:n,children:r}){let i=be(e,t),a=(0,P.useRef)(null),[o,s]=(0,P.useState)(()=>new Set),c=(0,P.useRef)(n);c.current=n;let l=O(e=>e.detail?.model.media??null);ne(`changes.updated`,n=>{n.siteId===e&&n.paths.includes(t.path)&&(a.current=n.origin)}),(0,P.useEffect)(()=>{i.actions.receive(t,ue({own:me(e,t),origin:a.current})),a.current=null},[t,i,e]),(0,P.useEffect)(()=>{let e,t=i.subscribe((t,n)=>{if(!t.outside||t.outside===n.outside)return;let r=c.current(n.stored,t.stored);r.length!==0&&(s(new Set(r)),clearTimeout(e),e=setTimeout(()=>s(new Set),_e))});return()=>{t(),clearTimeout(e)}},[i]);let[u,d]=(0,P.useState)(!1),f=(0,P.useRef)(null),p=(0,P.useCallback)(()=>new Promise(e=>{f.current?.(null),f.current=e,d(!0)}),[]),m=e=>{f.current?.(e),f.current=null,d(!1)},h=(0,P.useMemo)(()=>({store:i,siteId:e,entryPath:t.path,media:l,select:()=>void 0,pickImage:p,preview:()=>void 0}),[i,e,t.path,l,p]),g=(0,P.useMemo)(()=>({marks:o}),[o]);return(0,F.jsxs)(ce.Provider,{value:h,children:[(0,F.jsx)(I.Provider,{value:g,children:r}),(0,F.jsx)(A,{siteId:e,open:u,onClose:()=>m(null),onPick:e=>m(e)})]})}var Se=0,L=n(e=>({open:!1,request:null,show:t=>e({open:!0,request:t?{...t,nonce:++Se}:null}),hide:()=>e({open:!1,request:null})}));function R(){let e=D(k.settings(),()=>w(`GET /api/settings`));return e.data?e.data.secrets.some(e=>e.name===`anthropic`&&e.configured):null}function z(){return O(e=>e.detail?.model.ai.allowBuild??!1)}function Ce({siteId:e,entryPath:t}){let n=L(e=>e.open),r=L(e=>e.request),i=L(e=>e.hide),a=(0,P.useRef)(null);return(0,P.useEffect)(()=>{n&&r?.draft&&ge.getState().offerDraft(e,r.draft,r.mode)},[n,r,e]),(0,P.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&a.current?.contains(document.activeElement)&&i()};return window.addEventListener(`keydown`,e),requestAnimationFrame(()=>a.current?.querySelector(`textarea`)?.focus()),()=>window.removeEventListener(`keydown`,e)},[n,i]),n?(0,F.jsxs)(`aside`,{ref:a,className:`g-pane kit-assistant`,"aria-label":`Assistant`,children:[(0,F.jsxs)(`div`,{className:`g-pane__head kit-assistant__head`,children:[(0,F.jsx)(`span`,{className:`kit-assistant__title`,children:`Assistant`}),(0,F.jsx)(`span`,{className:`g-toolbar__spacer`}),(0,F.jsx)(de,{siteId:e}),(0,F.jsx)(x,{icon:`close`,label:`Close the assistant`,onClick:i})]}),(0,F.jsx)(`div`,{className:`kit-assistant__body`,children:(0,F.jsx)(oe,{siteId:e,context:t?{entryPath:t}:void 0,initialMessage:r?.send},r?.send?r.nonce:`panel`)})]}):null}var B=e=>[`site`,e,`kit`];function V(e){return D(B(e),()=>w(`GET /api/sites/:siteId/kit`,{params:{siteId:e}}),{enabled:e!==``})}async function we(e,t,n){let r=n===`visibility`?await w(`POST /api/sites/:siteId/kit/visibility`,{params:{siteId:e}}):await w(`POST /api/sites/:siteId/kit/setup`,{params:{siteId:e}});T.getState().upsert(r);let i=!1,a=n=>{i||n.state===`running`||(i=!0,o(),O.getState().refresh(),E(B(e)),t(n))},o=T.subscribe(e=>{let t=e.jobs.find(e=>e.id===r.id);t&&a(t)});return a(r),r}function Te(e){return{ready:e.steps.filter(e=>e.state===`ready`),left:e.steps.filter(e=>e.state===`left`)}}async function Ee(e){let t=await w(`POST /api/sites/:siteId/kit/endpoint`,{params:{siteId:e}});return E(B(e)),t}var De={forms:{title:`This site doesn’t have forms yet.`,body:`Forms are files the site’s own pages show, so the site needs the site kit first. Set it up for me adds it, with a first “Contact” form, as changes you check in Proof.`,left:`Forms are nearly set up.`},scripts:{title:`This site doesn’t manage its scripts here yet.`,body:`Scripts are kept in one setup file the site reads when it builds, so the site needs the site kit first. Set it up for me adds it as changes you check in Proof.`,left:`Scripts are nearly set up.`}};function Oe({steps:e}){return(0,F.jsx)(`ul`,{className:`kit-setup__steps`,children:e.map(e=>(0,F.jsxs)(`li`,{className:`kit-setup__step kit-setup__step--${e.state}`,children:[(0,F.jsx)(`span`,{className:`kit-setup__step-label`,children:e.label}),e.state===`left`&&e.detail?(0,F.jsx)(`span`,{className:`kit-setup__step-detail`,children:e.detail}):null]},e.id))})}function ke({steps:e}){let t=e.filter(e=>e.snippet);return t.length===0?null:(0,F.jsxs)(`details`,{className:`app-details kit-setup__dev`,children:[(0,F.jsx)(`summary`,{children:`For developers`}),t.map(e=>(0,F.jsxs)(`div`,{className:`kit-setup__snippet`,children:[(0,F.jsx)(`p`,{className:`g-field__key`,children:e.snippet.file}),(0,F.jsx)(`pre`,{className:`kit-embed__code`,children:(0,F.jsx)(`code`,{children:e.snippet.code})})]},e.id))]})}function Ae({detail:e}){return(0,F.jsx)(o,{mark:`caret`,title:`Setting up forms and scripts…`,body:e??`Reading the site`,children:(0,F.jsx)(`div`,{className:`kit-setup__working`,role:`status`,children:(0,F.jsx)(g,{label:`Setting up`})})})}function je({feature:e}){let t=b(),n=O(e=>e.detail?.id??``),r=l(e=>e.meta?.brand.docsUrl),s=R(),c=z(),d=L(e=>e.show),f=V(n),[p,h]=(0,P.useState)(null),[g,v]=(0,P.useState)(!1),y=te(p),x=De[e],w=g||p!==null&&(y===null||y.state===`running`);ee(p,w);let T=e=>{e.state===`error`?S({tone:`danger`,title:`Couldn’t set up forms and scripts`,body:e.detail??`Nothing was changed.`}):S({tone:e.output?`warning`:`success`,title:`Forms and scripts are set up`,body:e.detail,...e.output?{detail:e.output}:{},action:{label:`Open Proof`,onClick:()=>t(`/sites/${n}/proof`)},duration:12e3})},ne=async()=>{v(!0);try{let e=await we(n,T);h(e.id)}catch(e){S({tone:`danger`,title:`Couldn’t set up forms and scripts`,body:i(e).message})}finally{v(!1)}};if(w)return(0,F.jsx)(Ae,{detail:y?.detail});if(f.loading||!n)return(0,F.jsx)(m,{lines:4,height:14});if(!f.data)return(0,F.jsx)(a,{title:`Couldn’t check this site’s set-up`,error:f.error,onRetry:()=>void f.refetch()});let E=f.data,D=re(r,e);if(!E.supported){let e=re(r,`adapters`);return(0,F.jsx)(o,{mark:`pilcrow`,title:`The site kit is for Astro sites today.`,body:E.reason,actions:e?(0,F.jsx)(`a`,{className:_(`primary`),href:e,target:`_blank`,rel:`noreferrer`,children:`Read the adapter guide`}):null})}let{ready:k,left:A}=Te(E),j=e=>D?(0,F.jsx)(`a`,{className:_(e?`primary`:`secondary`),href:D,target:`_blank`,rel:`noreferrer`,children:`How a developer does it`}):null,M=s&&c&&E.assistantRequest?(0,F.jsx)(C,{variant:k.length>0?`secondary`:`primary`,icon:`chat`,onClick:()=>d({draft:E.assistantRequest,mode:`build`}),children:`Ask the assistant to finish it`}):null;return k.length===0&&A.length>0?(0,F.jsxs)(o,{mark:`caret`,title:x.left,body:`Set-up did everything it could without guessing. ${A.length===1?`One part of the site’s code is`:`${A.length} parts of the site’s code are`} left:`,actions:(0,F.jsxs)(F.Fragment,{children:[M,j(!M)]}),children:[(0,F.jsx)(Oe,{steps:A}),(0,F.jsx)(ke,{steps:A})]}):E.buildAllowed?(0,F.jsxs)(o,{mark:`pilcrow`,title:x.title,body:x.body,actions:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(C,{variant:`primary`,icon:`plus`,busy:g,busyLabel:`Starting…`,onClick:()=>void ne(),children:`Set it up for me`}),j(!1)]}),children:[(0,F.jsx)(Oe,{steps:[...k,...A]}),A.length>0?(0,F.jsx)(`p`,{className:`g-hint`,children:`The parts marked as left need a developer or the assistant afterwards; set-up won’t guess at them.`}):null,e===`forms`?(0,F.jsx)(`p`,{className:`g-hint kit-setup__inbox`,children:E.inbox.reachable&&E.inbox.address?`The live site’s forms will send to this app’s inbox at ${E.inbox.address}.`:`Forms in the preview send to this app’s inbox. Visitors can’t reach it from this computer, so the Forms screen then asks where the live site should send submissions.`}):null]}):(0,F.jsx)(o,{mark:`pilcrow`,title:x.title,body:`Setting it up changes the site’s code, and this site’s settings turn that off. Turn on “Allow build mode” in Site settings › Assistant, or have a developer add the site kit by hand.`,actions:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(u,{className:_(`primary`),to:`/sites/${n}/settings#assistant`,children:`Open Site settings › Assistant`}),j(!1)]})})}function Me({step:t}){let n=V(O(e=>e.detail?.id??``)),r=R(),i=z(),a=L(e=>e.show),o=n.data?.steps.find(e=>e.id===t&&e.state===`left`);return!o||!n.data?null:(0,F.jsxs)(`div`,{className:`kit-callout`,role:`note`,children:[(0,F.jsx)(e,{kind:`bang`,className:`kit-callout__mark`}),(0,F.jsxs)(`div`,{className:`kit-callout__main`,children:[(0,F.jsxs)(`p`,{className:`kit-callout__title`,children:[`One part of the set-up is left: `,o.label.toLowerCase()]}),o.detail?(0,F.jsxs)(`p`,{className:`kit-callout__body`,children:[o.detail,` Until then, nothing here loads on the site’s pages.`]}):null,(0,F.jsx)(ke,{steps:[o]}),r&&i&&n.data.assistantRequest?(0,F.jsx)(`div`,{className:`kit-callout__actions`,children:(0,F.jsx)(C,{size:`sm`,variant:`primary`,icon:`chat`,onClick:()=>a({draft:n.data.assistantRequest,mode:`build`}),children:`Ask the assistant to finish it`})}):null]})]})}function H(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ne(e){return JSON.parse(JSON.stringify(e))}function U(e){return Array.isArray(e)?e.filter(H):[]}var W=e=>typeof e==`string`?e:void 0;function Pe(e){return{...e,name:W(e.name)??``,submitLabel:W(e.submitLabel)??``,fields:U(e.fields).map(e=>({...e,id:W(e.id)??``,type:W(e.type)??`text`})),destinations:U(e.destinations).map(e=>({...e,provider:W(e.provider)??``,settings:H(e.settings)?e.settings:{}})),afterSubmit:U(e.afterSubmit)}}function Fe(e){return{...e,id:W(e.id)??``,kind:W(e.kind)??`custom`,enabled:e.enabled!==!1,settings:H(e.settings)?e.settings:{}}}function Ie(e){return H(e)?Fe(e):null}function Le(e){return{...e,scripts:U(e.scripts).map(Fe),consent:H(e.consent)?e.consent:void 0}}function G(e){return e==null?``:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e)}var K={destinations:`area:destinations`,afterSubmit:`area:afterSubmit`,settings:`area:settings`},Re=e=>`field:${e}`;function q(e){let t=new Map;if(!Array.isArray(e))return t;for(let n of e)H(n)&&typeof n.id==`string`&&t.set(n.id,n);return t}function ze(e,t){let n=[],r=q(e.fields);for(let[e,i]of q(t.fields))j(r.get(e),i)||n.push(Re(e));j(e.destinations,t.destinations)||n.push(K.destinations),j(e.afterSubmit,t.afterSubmit)||n.push(K.afterSubmit);let i=e=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==`fields`&&e!==`destinations`&&e!==`afterSubmit`));return j(i(e),i(t))||n.push(K.settings),n}function Be(e,t){let n=[],r=q(e.scripts);for(let[e,i]of q(t.scripts))j(r.get(e),i)||n.push(`script:${e}`);return j(e.consent,t.consent)||n.push(`area:consent`),n}function Ve({subject:t,context:n,examples:r,placeholder:i}){let[a,o]=(0,P.useState)(``),s=L(e=>e.show),c=R(),l=(0,P.useId)(),u=(0,P.useRef)(null),d=e=>{let t=e.trim();t&&(s({send:`${n} ${t}`}),o(``))};return(0,F.jsxs)(`form`,{className:`kit-ask`,onSubmit:e=>{e.preventDefault(),d(a)},"aria-labelledby":`${l}-label`,children:[(0,F.jsxs)(`span`,{id:`${l}-label`,className:`kit-ask__label`,children:[(0,F.jsx)(e,{kind:`caret`}),`Ask about `,t]}),(0,F.jsx)(`input`,{ref:u,className:`g-input g-input--sm kit-ask__input`,"aria-labelledby":`${l}-label`,placeholder:c===!1?`Connect the assistant in Settings to ask for changes`:i,value:a,disabled:c===!1,onChange:e=>o(e.target.value)}),(0,F.jsx)(C,{size:`sm`,type:`submit`,disabled:!a.trim()||c===!1,children:`Ask`}),c===!1?null:(0,F.jsx)(`span`,{className:`kit-ask__chips`,children:r.map(e=>(0,F.jsx)(`button`,{type:`button`,className:`g-chip kit-ask__chip`,onClick:()=>{o(e),u.current?.focus()},children:e},e))})]})}function He(){return pe(e=>e.data)}function Ue(){let e=He();return(0,P.useMemo)(()=>Pe(e),[e])}function We(){let e=He();return(0,P.useMemo)(()=>Le(e),[e])}function J(){let{store:e}=fe(),t=(0,P.useCallback)((t,n,r=!1)=>e.actions.edit(t,n,{required:r}),[e]),n=(0,P.useCallback)((t,n)=>e.actions.edit(t,n,{required:!1,immediate:!0}),[e]),r=(0,P.useCallback)(t=>e.actions.commit(t),[e]),i=(0,P.useCallback)((...t)=>{t.length>0&&e.actions.apply(...t)},[e]),a=(0,P.useCallback)(()=>e.getState().data,[e]);return(0,P.useMemo)(()=>({type:t,choose:n,commit:r,apply:i,read:a}),[t,n,r,i,a])}function Ge(e){return M(e)}function Ke({path:e,label:n,hint:r,error:i,hideLabel:a,aside:o,placeholder:s,keep:l,mono:u,multiline:d,inputRef:f,onTyped:p,autoComplete:m=`off`,list:h}){let g=J(),_=G(N(e)),y=Ge(e),b=t=>{g.type(e,t===``?void 0:t,l),p?.(t)};return(0,F.jsx)(v,{label:n,hint:r,error:i??y,hideLabel:a,aside:o,children:d?(0,F.jsx)(t,{value:_,placeholder:s,mono:u,maxRows:10,onChange:e=>b(e.target.value),onBlur:()=>g.commit(e)}):(0,F.jsx)(c,{ref:f,value:_,placeholder:s,mono:u,autoComplete:m,list:h,spellCheck:!u,onChange:e=>b(e.target.value),onBlur:()=>g.commit(e)})})}function qe({path:e,label:t,hint:n,error:r,placeholder:i,min:a}){let o=J(),s=N(e),[l,u]=(0,P.useState)(null),d=l??(typeof s==`number`?String(s):``),f=l!==null&&l.trim()!==``&&!Number.isFinite(Number(l));return(0,F.jsx)(v,{label:t,hint:n,error:f?`Type a number.`:r,children:(0,F.jsx)(c,{inputMode:`decimal`,value:d,placeholder:i,onChange:t=>{let n=t.target.value;u(n),n.trim()===``?o.type(e,void 0):Number.isFinite(Number(n))&&(a===void 0||Number(n)>=a)&&o.type(e,Number(n))},onBlur:()=>{u(null),o.commit(e)}})})}function Je({path:e,label:t,description:n,absent:r=!1}){let i=J(),a=N(e);return(0,F.jsx)(f,{checked:typeof a==`boolean`?a:r,label:t,description:n,onChange:t=>i.choose(e,t===r?void 0:t)})}function Ye({path:e,label:t,hint:n,options:r,absent:i,as:a=`segmented`}){let o=J(),s=N(e),c=typeof s==`string`&&r.some(e=>e.value===s)?s:i,l=t=>o.choose(e,t===i?void 0:t);return a===`select`?(0,F.jsx)(v,{label:t,hint:n,children:(0,F.jsx)(y,{value:c,options:r,onChange:e=>l(e)})}):(0,F.jsx)(v,{label:t,hint:n,group:!0,children:(0,F.jsx)(d,{label:typeof t==`string`?t:`Choose`,options:r,value:c,onChange:l})})}var Y=[{id:`galley`,name:`Galley inbox`,description:`Submissions arrive in this app's inbox, with e-mail alerts and forwarding. The default.`,settings:[{key:`endpoint`,label:`Capture address`,placeholder:`https://cms.example.com/f/…`,help:`Leave empty to use the address set once for the whole site.`}],canImportFields:!1},{id:`hubspot`,name:`HubSpot`,description:`Sends to a HubSpot form, so its workflows, lists and notifications run as usual.`,settings:[{key:`portalId`,label:`Hub ID`,placeholder:`12345678`,pattern:`^[0-9]{4,12}$`,required:!0},{key:`formId`,label:`Form ID`,placeholder:`0f8fad5b-d9cb-469f-a165-70867728950e`,pattern:`^[0-9a-fA-F-]{36}$`,required:!0},{key:`region`,label:`Data region`,placeholder:`na1`,pattern:`^[a-z]{2}[0-9]$`,help:`Only for accounts outside North America, e.g. eu1.`}],canImportFields:!0,docsUrl:`https://developers.hubspot.com/docs/api/marketing/forms`},{id:`marketo`,name:`Marketo`,description:`Submits through a Marketo form, keeping its validation, known-visitor matching and campaigns.`,settings:[{key:`munchkinId`,label:`Munchkin ID`,placeholder:`123-ABC-456`,pattern:`^[0-9]{3}-[A-Za-z]{3}-[0-9]{3}$`,required:!0},{key:`formId`,label:`Form ID`,placeholder:`1234`,pattern:`^[0-9]+$`,required:!0},{key:`host`,label:`Marketo address`,placeholder:`https://go.example.com`,pattern:`^https://.+`,help:`Where your Marketo forms are served from (a landing-page domain or app-xx.marketo.com).`,required:!0}],canImportFields:!0,docsUrl:`https://experienceleague.adobe.com/en/docs/marketo-developer/marketo/javascriptapi/forms-api-reference`},{id:`salesforce`,name:`Salesforce`,description:`Creates a lead with Web-to-Lead.`,settings:[{key:`orgId`,label:`Organization ID`,placeholder:`00D…`,pattern:`^00D[A-Za-z0-9]{12,15}$`,required:!0},{key:`returnUrl`,label:`Return address`,placeholder:`https://www.example.com/thanks/`,help:`Optional. Salesforce sends the visitor here after it accepts the lead.`},{key:`mode`,label:`Sending`,placeholder:`frame`,pattern:`^(frame|navigate)$`,help:`frame (default): sent in the background and the visitor stays on the page. navigate: the visitor goes to Salesforce and then to the return address.`}],canImportFields:!1,docsUrl:`https://help.salesforce.com/s/articleView?id=sales.setting_up_web-to-lead.htm`},{id:`pardot`,name:`Pardot (Account Engagement)`,description:`Posts to an Account Engagement form handler.`,settings:[{key:`handlerUrl`,label:`Form handler address`,placeholder:`https://go.example.com/l/123456/2026-01-01/abc123`,pattern:`^https://.+/l/[0-9]+/.+`,required:!0},{key:`successLocation`,label:`Success location`,placeholder:`https://www.example.com/forms/sent/`,pattern:`^https://.+`,help:`Optional. The same address as the handler's Success Location. A page on this site lets the form tell success from failure.`},{key:`errorLocation`,label:`Error location`,placeholder:`https://www.example.com/forms/not-sent/`,pattern:`^https://.+`,help:`Optional. The same address as the handler's Error Location, on this site.`},{key:`mode`,label:`Sending`,placeholder:`frame`,pattern:`^(frame|navigate)$`,help:`frame (default) or navigate, as for Salesforce.`}],canImportFields:!1,docsUrl:`https://help.salesforce.com/s/articleView?id=sf.pardot_forms_handler_create.htm`},{id:`webhook`,name:`Webhook`,description:`Posts the submission to any address — an automation tool, a function, your own service.`,settings:[{key:`url`,label:`Address`,placeholder:`https://hooks.example.com/…`,pattern:`^https://.+`,required:!0},{key:`format`,label:`Format`,placeholder:`json`,pattern:`^(json|form)$`,help:`json (default) or form.`}],canImportFields:!1},{id:`mailto`,name:`E-mail program`,description:`Opens the visitor's own mail program with the answers filled in. A last resort: nothing is stored.`,settings:[{key:`to`,label:`Send to`,placeholder:`hello@example.com`,pattern:`^[^@\\s]+@[^@\\s]+$`,required:!0},{key:`subject`,label:`Subject`,placeholder:`Website enquiry`}],canImportFields:!1}],X=[{kind:`gtm`,name:`Google Tag Manager`,description:`One container that loads your other tags.`,category:`tag-manager`,defaultConsent:`analytics`,defaultPlacement:`head`,settings:[{key:`containerId`,label:`Container ID`,placeholder:`GTM-XXXXXXX`,pattern:`^GTM-[A-Z0-9]{4,10}$`,required:!0},{key:`noscript`,label:`No-JavaScript frame`,placeholder:`false`,pattern:`^(true|false)$`,help:`Also add Google's older <noscript> frame after <body>. Only on pages where the container needs no consent.`}],docsUrl:`https://developers.google.com/tag-platform/tag-manager/web`},{kind:`ga4`,name:`Google Analytics 4`,description:`Page views and events in Google Analytics.`,category:`analytics`,defaultConsent:`analytics`,defaultPlacement:`head`,settings:[{key:`measurementId`,label:`Measurement ID`,placeholder:`G-XXXXXXXXXX`,pattern:`^G-[A-Z0-9]{6,12}$`,required:!0}],docsUrl:`https://developers.google.com/analytics/devguides/collection/ga4`},{kind:`meta-pixel`,name:`Meta Pixel`,description:`Conversion tracking for Facebook and Instagram ads.`,category:`advertising`,defaultConsent:`marketing`,defaultPlacement:`head`,settings:[{key:`pixelId`,label:`Pixel ID`,placeholder:`123456789012345`,pattern:`^[0-9]{10,20}$`,required:!0}],docsUrl:`https://developers.facebook.com/docs/meta-pixel/get-started`},{kind:`linkedin-insight`,name:`LinkedIn Insight Tag`,description:`Conversion tracking and audiences for LinkedIn ads.`,category:`advertising`,defaultConsent:`marketing`,defaultPlacement:`body-end`,settings:[{key:`partnerId`,label:`Partner ID`,placeholder:`1234567`,pattern:`^[0-9]{5,10}$`,required:!0}],docsUrl:`https://www.linkedin.com/help/lms/answer/a418880`},{kind:`hubspot`,name:`HubSpot tracking code`,description:`Visitor tracking, chat and pop-ups from HubSpot.`,category:`marketing`,defaultConsent:`marketing`,defaultPlacement:`body-end`,settings:[{key:`portalId`,label:`Hub ID`,placeholder:`12345678`,pattern:`^[0-9]{4,12}$`,required:!0},{key:`region`,label:`Data region`,placeholder:`na1`,pattern:`^[a-z]{2}[0-9]$`,help:`Only for accounts outside North America, e.g. eu1.`}],docsUrl:`https://knowledge.hubspot.com/reports/install-the-hubspot-tracking-code`},{kind:`marketo-munchkin`,name:`Marketo Munchkin`,description:`Visitor tracking for Marketo.`,category:`marketing`,defaultConsent:`marketing`,defaultPlacement:`head`,settings:[{key:`munchkinId`,label:`Munchkin ID`,placeholder:`123-ABC-456`,pattern:`^[0-9]{3}-[A-Za-z]{3}-[0-9]{3}$`,required:!0}],docsUrl:`https://experienceleague.adobe.com/en/docs/marketo-developer/marketo/javascriptapi/leadtracking/lead-tracking`},{kind:`plausible`,name:`Plausible`,description:`Privacy-friendly page analytics without cookies.`,category:`analytics`,defaultConsent:`necessary`,defaultPlacement:`head`,settings:[{key:`scriptId`,label:`Script ID`,placeholder:`pa-XXXXXXXXXXXX`,pattern:`^pa-[A-Za-z0-9_-]{6,64}$`,help:`From Site installation in Plausible's settings (the pa-….js file name). Sites set up before October 2025 can give the domain instead.`},{key:`domain`,label:`Site domain (older script)`,placeholder:`example.com`,pattern:`^[a-z0-9.-]+\\.[a-z]{2,}$`},{key:`host`,label:`Script address`,placeholder:`https://plausible.io`,pattern:`^https://.+`,help:`Only if you host Plausible yourself.`}],docsUrl:`https://plausible.io/docs/plausible-script`},{kind:`segment`,name:`Segment`,description:`One stream of events sent on to your other tools.`,category:`analytics`,defaultConsent:`analytics`,defaultPlacement:`head`,settings:[{key:`writeKey`,label:`Write key`,placeholder:`abc123…`,pattern:`^[A-Za-z0-9]{16,64}$`,required:!0}],docsUrl:`https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/`},{kind:`hotjar`,name:`Hotjar`,description:`Heatmaps and session recordings.`,category:`analytics`,defaultConsent:`analytics`,defaultPlacement:`head`,settings:[{key:`siteId`,label:`Site ID`,placeholder:`1234567`,pattern:`^[0-9]{5,10}$`,required:!0}],docsUrl:`https://help.hotjar.com/hc/en-us/articles/115009336727`},{kind:`clarity`,name:`Microsoft Clarity`,description:`Heatmaps and session recordings.`,category:`analytics`,defaultConsent:`analytics`,defaultPlacement:`head`,settings:[{key:`projectId`,label:`Project ID`,placeholder:`abcdefghij`,pattern:`^[a-z0-9]{8,12}$`,required:!0}],docsUrl:`https://learn.microsoft.com/en-us/clarity/setup-and-installation/clarity-setup`},{kind:`intercom`,name:`Intercom`,description:`The Intercom messenger.`,category:`support`,defaultConsent:`preferences`,defaultPlacement:`body-end`,settings:[{key:`appId`,label:`App ID`,placeholder:`abc123de`,pattern:`^[a-z0-9]{6,12}$`,required:!0},{key:`region`,label:`Data region`,placeholder:`us`,pattern:`^(us|eu|au)$`,help:`Where your Intercom workspace is hosted: us (default), eu or au.`}],docsUrl:`https://developers.intercom.com/installing-intercom/web/installation`},{kind:`custom`,name:`Custom script`,description:`Any other script: a file to load, or code to run.`,category:`other`,defaultConsent:`marketing`,defaultPlacement:`body-end`,settings:[{key:`src`,label:`Script address`,placeholder:`https://cdn.example.com/widget.js`,pattern:`^https://.+`},{key:`inline`,label:`Code`,help:`Used when there is no script address. Runs as it is written.`}]}],Xe=`@galley/builtin`,Z=e=>e.map(e=>({...e,plugin:Xe})),Q=n(e=>({formProviders:Z(Y),scriptIntegrations:Z(X),pluginNames:{},set:(t,n)=>e({formProviders:t.formProviders,scriptIntegrations:t.scriptIntegrations,pluginNames:n})}));function Ze(e){return Q.getState().formProviders.find(t=>t.id===e&&t.plugin!==`@galley/builtin`)??null}function Qe(e){return Q.getState().scriptIntegrations.find(t=>t.kind===e&&t.plugin!==`@galley/builtin`)??null}function $e(e){return`From a plugin that isn’t active: ${e}`}function et(e){let t=D(k.catalog(e),async()=>{let t=await w(`GET /api/sites/:siteId/catalog`,{params:{siteId:e}}),n=await w(`GET /api/sites/:siteId/plugins`,{params:{siteId:e}}).catch(()=>null),r=Object.fromEntries((n?.plugins??[]).map(e=>[e.name,e.displayName]));return Q.getState().set(t,r),{result:t,names:r}},{enabled:!!e,deps:[k.site(e),[`plugins`]]}),n=Q.getState(),r=t.data;return{formProviders:r?.result.formProviders??Z(Y),scriptIntegrations:r?.result.scriptIntegrations??Z(X),live:!!r,nameOf:e=>r?.names[e]??n.pluginNames[e]??e}}function tt(e){return!!(e.snippet&&e.plugin!==`@galley/builtin`)}function nt(e,t){let n=e=>{let n=t[e];return n==null?``:String(n)},r=(e,t)=>e.replace(/\{\{\s*([A-Za-z][\w-]*)\s*\}\}/g,(e,r)=>t(n(r))),i=e=>JSON.stringify(e).slice(1,-1).replace(/</g,`\\u003c`).replace(/>/g,`\\u003e`),a={};return e.src&&(a.src=r(e.src,encodeURIComponent)),e.inline&&(a.inline=r(e.inline,i)),e.attributes&&(a.attributes=Object.fromEntries(Object.entries(e.attributes).map(([e,t])=>[e,r(t,e=>e.replace(/"/g,`"`))]))),a}function rt(e,t,n){let r=nt(t.snippet,e.settings),i={};return r.src&&(i.src=r.src),r.inline&&(i.inline=r.inline),r.attributes&&Object.keys(r.attributes).length&&(i.attributes=r.attributes),{...e,kind:`custom`,label:t.name,settings:i,note:`Added from the plugin ${n}.`}}var it=`application/x-galley-card`;function at(e,t){let[n,r]=(0,P.useState)(null),i=(0,P.useRef)(n),a=e=>{i.current=e,r(e)},o=(0,P.useRef)(t);o.current=t;let s=n!==null;return(0,P.useEffect)(()=>{if(s)return se(()=>e.current)},[s,e]),{card:(0,P.useCallback)(e=>{let t=n,r=t&&t.over===e&&le(t.from,t.over,t.after)!==null?t.after?`after`:`before`:void 0;return{onDragOver:t=>{let n=i.current;if(!n||!t.dataTransfer.types.includes(it))return;t.preventDefault(),t.dataTransfer.dropEffect=`move`;let r=ie(t.clientY,t.currentTarget.getBoundingClientRect());(n.over!==e||n.after!==r)&&a({...n,over:e,after:r})},onDrop:e=>{let t=i.current;if(!t)return;e.preventDefault(),a(null);let n=le(t.from,t.over,t.after);n!==null&&o.current(t.from,n)},...r?{"data-drop":r}:{},...t?.from===e?{"data-dragging":!0}:{}}},[n]),grip:(0,P.useCallback)((e,t)=>({draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setData(it,String(e)),n.dataTransfer.setData(`text/plain`,`Item ${e+1}`);let r=t?.();r&&n.dataTransfer.setDragImage(r,24,18),a({from:e,over:e,after:!1})},onDragEnd:()=>a(null)}),[])}}function $(e,t){let n=G(t).trim();if(!n)return e.required?`Add the ${e.label}.`:null;if(!e.pattern)return null;let r;try{r=new RegExp(e.pattern)}catch{return null}return r.test(n)?null:e.placeholder?`Check the ${e.label} — it usually looks like ${e.placeholder}${/[.…]$/.test(e.placeholder)?``:`.`}`:`Check the ${e.label}.`}function ot(e,t){let n={};for(let r of e){let e=$(r,t[r.key]);e&&(n[r.key]=e)}return n}function st(e,t){return Object.keys(ot(e,t)).length===0}var ct={galley:`In`,hubspot:`Hs`,marketo:`Mk`,salesforce:`Sf`,pardot:`Pd`,webhook:`→`,mailto:`@`};function lt({text:e,size:t=`md`,className:n}){return(0,F.jsx)(`span`,{className:h(`kit-mark`,t===`sm`&&`kit-mark--sm`,n),"aria-hidden":`true`,children:e})}function ut(e){return ct[e]??e.slice(0,2)}function dt({path:e,specs:t,values:n}){let[r,i]=(0,P.useState)(()=>new Set);return(0,F.jsx)(`div`,{className:`kit-settings`,onBlur:e=>{let t=e.target.closest(`[data-setting]`)?.dataset.setting;t&&!r.has(t)&&i(new Set(r).add(t))},children:t.map(t=>{let i=n[t.key],a=r.has(t.key)||G(i).trim()!==``?$(t,i):null;return(0,F.jsx)(`div`,{"data-setting":t.key,children:(0,F.jsx)(Ke,{path:[...e,t.key],label:t.label,aside:t.required?(0,F.jsx)(`span`,{className:`kit-required`,children:`Required`}):(0,F.jsx)(`span`,{className:`g-faint`,children:`Optional`}),placeholder:t.placeholder,hint:a?void 0:t.help,error:a,mono:t.key!==`subject`&&t.key!==`label`,multiline:t.key===`inline`})},t.key)})})}export{Ie as A,xe as B,Ve as C,Be as D,ze as E,Ee as F,ye as H,we as I,V as L,Ne as M,Me as N,H as O,je as P,Ce as R,We as S,Re as T,ve as V,qe as _,st as a,J as b,tt as c,rt as d,Qe as f,Ye as g,X as h,$ as i,G as j,Pe as k,$e as l,Y as m,lt as n,at as o,et as p,ut as r,Xe as s,dt as t,Ze as u,Ke as v,K as w,Ue as x,Je as y,z};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{$ as e,F as t,Ft as n,H as r,Nt as i,O as a,St as o,bt as s,ht as c,i as l,it as u,j as d,kt as ee,n as te,pt as f,z as p}from"./ui-C6O2tW4c.js";import{a as m}from"./chrome-Brnq5kGb.js";import{t as h}from"./changes-DLBkrfUR.js";import{t as g}from"./site-DJUEXLHW.js";import{n as _,r as v}from"./proof-zOrlMTSg.js";import{_ as y,m as b,s as ne,y as re}from"./index-
|
|
1
|
+
import{$ as e,F as t,Ft as n,H as r,Nt as i,O as a,St as o,bt as s,ht as c,i as l,it as u,j as d,kt as ee,n as te,pt as f,z as p}from"./ui-C6O2tW4c.js";import{a as m}from"./chrome-Brnq5kGb.js";import{t as h}from"./changes-DLBkrfUR.js";import{t as g}from"./site-DJUEXLHW.js";import{n as _,r as v}from"./proof-zOrlMTSg.js";import{_ as y,m as b,s as ne,y as re}from"./index-A7aTfJ-x.js";import{PublishDeployNote as ie}from"./Online-CFMXFfKL.js";var x=n(i(),1);function S(e,t){let n=`Recorded as ${e.name} (${e.email})`,r={label:`Site settings › Connections`,to:`/sites/${t}/settings#connections`},i={label:`App settings › You`,to:`/settings#you`};switch(e.from){case`site`:return{text:`${n}, this site’s own author.`,change:r};case`repository`:return{text:`${n}, from the site’s own version settings.`,change:r,note:`A developer can change those, or set this site’s own author in`};case`app`:return{text:`${n}, from your app settings.`,change:i};case`machine`:return{text:`${n}, from this computer’s settings.`,change:i,note:`To use another name, set it in`};default:return{text:`${n} — no name is set yet.`,change:i,note:`Set yours in`}}}var C=s(),w=[];function T(e){return e?.mode===`pull-request`?{mode:`pull-request`,text:`Sends the changes for review. A developer approves them before they go live.`}:e&&e.push&&e.remote?{mode:`commit`,text:`Publishes straight away: the changes go live on the site. You can undo it from Version history.`}:{mode:`commit`,text:`Saves the changes as a new version on this computer. This site isn’t set up to send versions to a host.`}}function E({outcome:t}){let n=t.tone===`danger`||t.tone===`warning`?`bang`:t.kind===`nothing`?`stet`:`reg`;return(0,C.jsxs)(`div`,{className:`publish-done`,role:`status`,children:[(0,C.jsx)(e,{kind:n,className:`publish-done__mark publish-done__mark--${t.tone}`}),(0,C.jsx)(`h3`,{className:`publish-done__title`,children:`${t.title}.`}),(0,C.jsx)(`p`,{className:`publish-done__body`,children:t.body}),t.detail?(0,C.jsxs)(`details`,{className:`app-details`,children:[(0,C.jsx)(`summary`,{children:`Technical details`}),(0,C.jsx)(`pre`,{className:`app-error__detail`,children:t.detail})]}):null]})}function ae({siteId:e,author:t,onNavigate:n}){let r=S(t,e);return(0,C.jsxs)(`p`,{className:`g-hint publish-author`,children:[r.text,` `,r.change?(0,C.jsxs)(C.Fragment,{children:[r.note?`${r.note} `:`Change it in `,(0,C.jsx)(o,{className:`g-link`,to:r.change.to,onClick:n,children:r.change.label}),`.`]}):null]})}function oe({check:t}){return(0,C.jsxs)(`section`,{className:t.refusal?`publish-warnings publish-warnings--stop`:`publish-warnings`,"aria-labelledby":`publish-warnings-title`,children:[(0,C.jsx)(e,{kind:`bang`,className:`publish-warnings__mark`}),(0,C.jsxs)(`div`,{className:`publish-warnings__body`,children:[(0,C.jsx)(`h3`,{id:`publish-warnings-title`,className:`publish-warnings__title`,children:t.refusal?`${t.refusal.plugin} will stop this publish`:`You can still publish`}),(0,C.jsxs)(`ul`,{className:`publish-warnings__list`,children:[t.refusal?(0,C.jsx)(`li`,{children:t.refusal.message}):null,t.warnings.map((e,t)=>(0,C.jsxs)(`li`,{children:[(0,C.jsx)(`strong`,{children:e.plugin}),` — `,e.message]},`${e.plugin}:${t}`))]})]})]})}function D({siteId:n,open:i,onClose:o}){let s=ee(),S=h(e=>e.changes?.files)??w,D=g(e=>e.detail?.model.publish),O=g(e=>e.detail?.git.author),{mode:k,text:A}=T(D),j=v(),[M,N]=(0,x.useState)(new Set),[P,F]=(0,x.useState)(``),[I,L]=(0,x.useState)(!1),[R,z]=(0,x.useState)(!1),[B,V]=(0,x.useState)(!1),[H,U]=(0,x.useState)(null),W=(0,x.useRef)(!1),G=!!ne(n).data?.config,K=(0,x.useRef)(null),q=S.filter(e=>!M.has(e.path)),se=q.map(e=>e.path).join(`
|
|
2
2
|
`),J=q.length===S.length,Y=_(n,i&&!H?S:w,J?void 0:q.map(e=>e.path));(0,x.useEffect)(()=>{i&&(N(new Set),U(null),F(``),W.current=!1)},[i]),(0,x.useEffect)(()=>{if(!i||H||q.length===0||W.current)return;let e=new AbortController;L(!0);let t=setTimeout(()=>{p(`POST /api/sites/:siteId/publish/message`,{params:{siteId:n},body:J?{}:{paths:q.map(e=>e.path)},signal:e.signal}).then(({message:e})=>{W.current||F(e.split(`
|
|
3
3
|
`)[0]??``)}).catch(()=>void 0).finally(()=>L(!1))},250);return()=>{clearTimeout(t),e.abort()}},[i,n,se,H]);let ce=async()=>{z(!0);let e=P.trim();try{let t=await p(`POST /api/sites/:siteId/publish`,{params:{siteId:n},body:{...e?{message:e}:{},...J?{}:{paths:q.map(e=>e.path)}}});U(re(t,{message:e||`these changes`,mode:k})),m([`site`,n,`history`]),m([`site`,n,`git`]),h.getState().refresh(),g.getState().refresh()}catch(e){let t=r(e);U({kind:`failed`,tone:`danger`,title:`Couldn’t publish`,body:`${t.message} Your changes are safe here.`,detail:t.detail,canRetry:!0})}finally{z(!1)}},X=(0,x.useRef)(null);(0,x.useEffect)(()=>{H&&requestAnimationFrame(()=>X.current?.focus())},[H]);let[Z,Q]=(0,x.useState)(!1),le=async()=>{Q(!0);try{await p(`POST /api/sites/:siteId/pull`,{params:{siteId:n}}),m([`site`,n,`git`]),m([`site`,n,`history`]),g.getState().refresh(),h.getState().refresh(),te({tone:`success`,title:`Up to date`,body:`This copy now has the newest published versions. Your edits are still here.`}),U(null)}catch(e){let t=r(e);U({kind:`failed`,tone:`danger`,title:`Couldn’t get the latest versions`,body:`${t.message} Your edits are safe.`,detail:t.detail,canRetry:!1})}finally{Q(!1)}},ue=async()=>{V(!0);try{U(await y(n))}finally{V(!1)}},de=k===`pull-request`?`Send for review`:`Publish ${u(q.length,`change`)}`,fe=H?H.title:k===`pull-request`?`Send ${u(q.length,`change`)} for review?`:`Publish ${u(q.length,`change`)}?`,$;if(!H)$=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(f,{variant:`secondary`,onClick:o,disabled:R,children:`Not yet`}),(0,C.jsx)(f,{variant:`primary`,busy:R,busyLabel:k===`pull-request`?`Sending…`:`Publishing…`,disabled:q.length===0,onClick:()=>void ce(),children:de})]});else{let e=H.kind===`published`||H.kind===`saved-local`||H.kind===`not-sent`||H.kind===`sent`||H.kind===`send-failed`;$=(0,C.jsxs)(C.Fragment,{children:[H.canSend?(0,C.jsx)(f,{variant:`secondary`,busy:B,busyLabel:`Sending…`,onClick:()=>void ue(),children:`Try sending again`}):null,H.canRetry?(0,C.jsx)(f,{variant:`secondary`,onClick:()=>U(null),children:`Try again`}):null,H.canGetLatest?(0,C.jsx)(f,{variant:`primary`,icon:`download`,busy:Z,busyLabel:`Getting the latest…`,onClick:()=>void le(),children:`Get the latest`}):null,H.reviewUrl?(0,C.jsx)(`a`,{className:c(`secondary`,`md`),href:H.reviewUrl,target:`_blank`,rel:`noopener noreferrer`,children:`View request`}):null,e?(0,C.jsx)(f,{variant:`secondary`,onClick:()=>{o(),s(`/sites/${n}/history`)},children:`See version history`}):null,(0,C.jsx)(f,{ref:X,variant:H.canGetLatest?`secondary`:`primary`,onClick:o,"data-autofocus":!0,disabled:B||Z,children:H.canGetLatest?`Not now`:`Done`})]})}return(0,C.jsx)(t,{open:i,onClose:o,title:fe,size:`md`,dismissible:!R&&!B,footer:$,hideTitle:!!H,initialFocus:H?void 0:K,children:H?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(E,{outcome:b(H,G)}),H.kind===`published`||H.kind===`saved-local`||H.kind===`not-sent`?(0,C.jsx)(ie,{siteId:n}):null]}):S.length===0?(0,C.jsx)(`p`,{className:`g-dialog__body`,children:`Nothing is waiting. Everything here already matches the live site.`}):(0,C.jsxs)(`div`,{className:`publish-body`,children:[(0,C.jsxs)(`p`,{className:`publish-mode`,children:[(0,C.jsx)(e,{kind:k===`pull-request`?`send`:`reg`}),(0,C.jsx)(`span`,{children:A})]}),(0,C.jsx)(d,{label:`Note for version history`,hint:`One line, in plain words. Shown in Version history.`,children:(0,C.jsx)(a,{ref:K,value:P,maxLength:120,placeholder:I&&!P?`Suggesting a note…`:`What changed, in a few words`,"aria-busy":I&&!P?!0:void 0,onChange:e=>{W.current=!0,F(e.target.value.replace(/[\r\n]+/g,` `))}})}),Y.refusal||Y.warnings.length>0?(0,C.jsx)(oe,{check:Y}):null,(0,C.jsxs)(`fieldset`,{className:`app-fieldset`,children:[(0,C.jsx)(`legend`,{className:`g-label`,children:S.length===1?`What goes`:`What goes · ${q.length} of ${S.length}`}),(0,C.jsx)(`ul`,{className:`publish-list`,children:S.map(e=>(0,C.jsxs)(`li`,{children:[(0,C.jsx)(l,{checked:!M.has(e.path),onChange:t=>N(n=>{let r=new Set(n);return t?r.delete(e.path):r.add(e.path),r}),label:j(e),description:e.summary}),(0,C.jsx)(`span`,{className:`publish-list__meta`,children:e.status===`added`?`New`:e.status===`deleted`?`Deleted`:`Edited`})]},e.path))})]}),O?(0,C.jsx)(ae,{siteId:n,author:O,onNavigate:o}):null]})})}export{D as PublishDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bt as e,g as t,gt as n,vt as r}from"./ui-C6O2tW4c.js";import{S as i}from"./index-
|
|
1
|
+
import{bt as e,g as t,gt as n,vt as r}from"./ui-C6O2tW4c.js";import{S as i}from"./index-A7aTfJ-x.js";var a=e();function o({settings:e,compact:t}){return e.captureReachable?(0,a.jsxs)(`div`,{className:n(`app-reach`,`app-reach--ok`,t&&`app-reach--compact`),role:`note`,children:[(0,a.jsx)(r,{name:`globe`}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`p`,{children:e.reachability}),(0,a.jsx)(`p`,{className:`app-reach__address g-mono`,children:e.captureAddress})]})]}):(0,a.jsxs)(`div`,{className:n(`app-reach`,`app-reach--warning`,t&&`app-reach--compact`),role:`note`,children:[(0,a.jsx)(r,{name:`warning`}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`p`,{className:`app-reach__lead`,children:e.reachability}),t?null:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`p`,{children:[`Visitors’ browsers can’t reach `,(0,a.jsx)(`span`,{className:`g-mono`,children:new URL(e.captureAddress).host}),`. To collect real submissions, run this app on a server with a public address (hosted mode), or send the form to a webhook or your CRM instead.`]}),(0,a.jsx)(`p`,{className:`app-reach__address g-mono`,children:e.captureAddress})]})]})]})}function s({siteId:e,compact:n}){let r=i(e);return r.loading?(0,a.jsx)(t,{height:44}):r.data?(0,a.jsx)(o,{settings:r.data,compact:n}):null}export{o as n,s as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{$ as e,A as t,At as n,B as r,F as i,Ft as a,G as o,H as s,I as c,N as l,Nt as u,O as d,P as f,St as p,_ as m,_t as h,bt as g,c as _,ft as v,g as y,gt as b,h as x,ht as S,j as C,jt as w,k as T,mt as E,n as D,pt as O,v as k,vt as A,y as j,z as M}from"./ui-C6O2tW4c.js";import{a as N,n as P,o as F,s as I}from"./chrome-Brnq5kGb.js";import{o as L}from"./events-CTTFdOf-.js";import{a as R,c as z,d as B,f as V,i as H,l as U,m as ee,o as te,p as ne,r as re,s as ie,t as ae,u as W}from"./words-CoSgsy_e.js";import{n as oe,r as se,t as ce}from"./jobs-BHawhnH2.js";var G=a(u(),1),K={all:e=>[`site`,e,`redirects`],overview:e=>[`site`,e,`redirects`,`overview`],health:e=>[`site`,e,`redirects`,`health`]};function le(e){return I(K.overview(e),()=>M(`GET /api/sites/:siteId/redirects`,{params:{siteId:e}}))}function ue(e,t){return I(K.health(e),()=>M(`GET /api/sites/:siteId/redirects/health`,{params:{siteId:e}}),{enabled:t})}function q(e,t){F(K.overview(e),t),N(K.health(e))}async function J(e,t,n,r={}){try{let i=await M(`PUT /api/sites/:siteId/redirects`,{params:{siteId:e},body:{redirects:n,baseHash:t.hash}});if(q(e,i),r.undo){let{label:t,previous:n}=r.undo;D({tone:`success`,title:t,body:`It's waiting in Proof.`,action:{label:`Undo`,onClick:()=>{J(e,i,n).then(e=>{e&&D({tone:`success`,title:`Put back`})})}}})}return i}catch(t){let n=s(t);return D({tone:`danger`,title:`Couldn’t save the redirects`,body:n.message,detail:n.detail}),n.code===`conflict`&&N(K.all(e)),null}}function de(e,t,n){return r(`GET /api/sites/:siteId/redirects/export`,{siteId:e},{format:t,...n?{hostname:n}:{}})}var Y=g(),fe=`/old-page/, /new-page/
|
|
2
|
+
/2019/05/notes/ /blog/notes/ 301
|
|
3
|
+
https://www.example.com/team/ /about/`;function pe({problem:t,onResolve:n}){let[r,i]=(0,G.useState)(t.severity===`error`),a=t.severity===`error`?`danger`:t.severity===`warning`?`warning`:`info`;return(0,Y.jsxs)(`li`,{className:`redir-problem redir-problem--${a}`,children:[(0,Y.jsxs)(`div`,{className:`redir-problem__head`,children:[(0,Y.jsx)(e,{kind:t.severity===`info`?`stet`:`bang`,className:`redir-problem__mark`}),(0,Y.jsxs)(`div`,{className:`redir-problem__text`,children:[(0,Y.jsx)(`p`,{className:`redir-problem__title`,children:t.title}),(0,Y.jsx)(`p`,{className:`redir-problem__body`,children:t.body})]})]}),(0,Y.jsx)(`div`,{className:`redir-problem__resolve`,children:t.resolution&&t.resolution.options.length>1?(0,Y.jsx)(m,{label:t.title,value:t.resolution.value,options:t.resolution.options,onChange:e=>n(t.resolution.key,e)}):t.resolution?.options.length===1&&t.resolution.value!==t.resolution.options[0].value?(0,Y.jsx)(O,{size:`sm`,variant:t.severity===`error`?`primary`:`secondary`,onClick:()=>n(t.resolution.key,t.resolution.options[0].value),children:t.resolution.options[0].label}):t.resolution?.options.length===1?(0,Y.jsx)(_,{tone:`neutral`,mark:null,children:t.resolution.options[0].label}):null}),t.examples.length?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{type:`button`,className:`app-link-button redir-problem__toggle`,"aria-expanded":r,onClick:()=>i(!r),children:r?`Hide them`:t.count>t.examples.length?`Show the first ${t.examples.length}`:`Show them`}),r?(0,Y.jsx)(`ul`,{className:`redir-problem__examples`,children:t.examples.map((e,t)=>(0,Y.jsxs)(`li`,{children:[e.line===void 0?null:(0,Y.jsx)(`span`,{className:`redir-problem__line g-mono`,children:`Line ${e.line}`}),(0,Y.jsx)(`span`,{className:`g-mono redir-problem__from`,children:e.from}),e.to?(0,Y.jsx)(`span`,{className:`g-mono g-faint`,children:` → ${e.to}`}):null,e.detail?(0,Y.jsx)(`span`,{className:`redir-problem__detail`,children:e.detail}):null]},`${e.line??t}:${e.from}`))}):null]}):null]})}function me({review:e}){let t=e.preview.filter(e=>e.state!==`same`).slice(0,200);return t.length?(0,Y.jsxs)(`div`,{className:`redir-preview`,children:[(0,Y.jsx)(`p`,{className:`g-eyebrow`,children:`What will be added`}),(0,Y.jsx)(`div`,{className:`redir-preview__table`,role:`table`,"aria-label":`Redirects to be added`,children:t.map(e=>{let t=z(e.from),n=ie(e.to);return(0,Y.jsxs)(`div`,{role:`row`,className:`redir-preview__row`,children:[(0,Y.jsx)(`span`,{role:`cell`,children:e.state===`new`?(0,Y.jsx)(_,{tone:`insert`,children:`New`}):(0,Y.jsx)(_,{tone:`change`,children:`Changed`})}),(0,Y.jsxs)(`span`,{role:`cell`,className:`redir-cell`,title:e.from,children:[t.lead?(0,Y.jsxs)(`span`,{className:`redir-address__lead`,children:[t.lead,` `]}):null,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.path})]}),(0,Y.jsx)(`span`,{role:`cell`,className:`redir-arrow`,"aria-label":`goes to`,children:`→`}),(0,Y.jsxs)(`span`,{role:`cell`,className:`redir-cell`,title:e.to,children:[(0,Y.jsx)(`span`,{className:`g-mono`,children:n.path}),n.tail?(0,Y.jsxs)(`span`,{className:`redir-address__lead`,children:[` `,n.tail]}):null]}),(0,Y.jsxs)(`span`,{role:`cell`,className:`redir-kind`,children:[R(e.status),` `,(0,Y.jsx)(`span`,{className:`redir-kind__code g-mono`,children:e.status})]})]},e.from)})}),e.counts.add+e.counts.change>t.length?(0,Y.jsx)(`p`,{className:`g-hint`,children:`And ${(e.counts.add+e.counts.change-t.length).toLocaleString()} more.`}):null]}):null}function he({siteId:n,open:r,onClose:a,overview:o,start:l}){let[u,d]=(0,G.useState)({text:``}),[f,p]=(0,G.useState)(`add`),[h,g]=(0,G.useState)({}),[_,v]=(0,G.useState)([]),[y,S]=(0,G.useState)(null),[C,w]=(0,G.useState)(null),[T,E]=(0,G.useState)(!1),[k,j]=(0,G.useState)(!1),[N,P]=(0,G.useState)(!1),F=(0,G.useRef)(null),I=(0,G.useRef)(0);(0,G.useEffect)(()=>{r&&(d(l?{path:l.path,label:l.label}:{text:``}),p(`add`),g({}),v([]),S(null),w(null))},[r,l]);let L=()=>({...u.path?{path:u.path}:{text:u.text??``},...u.filename?{filename:u.filename}:{},mode:f,resolutions:h,..._.length?{siteHosts:_}:{}});(0,G.useEffect)(()=>{if(!r)return;if(!u.path&&!(u.text??``).trim()){S(null);return}let e=++I.current,t=setTimeout(()=>{E(!0),M(`POST /api/sites/:siteId/redirects/review`,{params:{siteId:n},body:L()}).then(t=>{e===I.current&&(S(t),w(null))}).catch(t=>{e===I.current&&w(t)}).finally(()=>{e===I.current&&E(!1)})},u.path?0:350);return()=>clearTimeout(t)},[r,u,f,h,_,n]);let R=async e=>{e.size>20971520?w(Error(`That file is larger than 20 MB. Split it into smaller files.`)):d({text:await e.text(),filename:e.name,label:e.name})},z=e=>{e.preventDefault(),P(!1);let t=e.dataTransfer.files[0];t&&R(t)},B=async()=>{if(y){j(!0);try{let e=await M(`POST /api/sites/:siteId/redirects/import`,{params:{siteId:n},body:{...L(),baseHash:o.hash}});q(n,e.overview);let t=e.review.counts.add+e.review.counts.change;D({tone:`success`,title:t===1?`1 redirect added`:`${t.toLocaleString()} redirects added`,body:`They’re one change in Proof, with the host’s file updated beside them.`}),a()}catch(e){let t=s(e);D({tone:`danger`,title:`Couldn’t add the redirects`,body:t.message,detail:t.detail})}finally{j(!1)}}},V=y?y.counts.add+y.counts.change:0,H=!!(y&&y.blocking>0),U=!u.path&&!(u.text??``).trim();return(0,Y.jsx)(i,{open:r,onClose:a,size:`xl`,title:`Add many redirects`,description:`Paste a list, or drop a file: a spreadsheet, a _redirects file, .htaccess or nginx lines, a Cloudflare list. Nothing is added until you confirm.`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`secondary`,onClick:a,children:`Not now`}),(0,Y.jsx)(O,{variant:`primary`,busy:k,busyLabel:`Adding…`,disabled:!y||V===0||H||T,onClick:()=>void B(),children:y&&V>0?`Add ${W(V)}`:`Add redirects`})]}),children:(0,Y.jsxs)(`div`,{className:`redir-many`,children:[(0,Y.jsxs)(`div`,{className:`redir-many__source`,children:[u.path||u.filename?(0,Y.jsxs)(`div`,{className:`redir-many__file`,children:[(0,Y.jsx)(A,{name:`page`}),(0,Y.jsx)(`span`,{children:u.label??u.filename??u.path}),(0,Y.jsx)(O,{size:`sm`,variant:`quiet`,onClick:()=>d({text:``}),children:`Paste instead`})]}):(0,Y.jsxs)(`div`,{className:b(`redir-many__drop`,N&&`redir-many__drop--on`),onDragOver:e=>(e.preventDefault(),P(!0)),onDragLeave:()=>P(!1),onDrop:z,children:[(0,Y.jsx)(t,{mono:!0,rows:7,maxRows:14,value:u.text??``,placeholder:fe,"aria-label":`Redirects to add, one per line`,onChange:e=>d({text:e.target.value}),"data-autofocus":!0}),(0,Y.jsxs)(`div`,{className:`redir-many__actions`,children:[(0,Y.jsx)(O,{size:`sm`,variant:`secondary`,icon:`upload`,onClick:()=>F.current?.click(),children:`Choose a file…`}),(0,Y.jsx)(`span`,{className:`g-hint`,children:`or drop it here`}),(0,Y.jsx)(`input`,{ref:F,type:`file`,hidden:!0,accept:`.csv,.tsv,.txt,.json,.conf,.htaccess,.mjs,text/*`,onChange:e=>e.target.files?.[0]&&void R(e.target.files[0])})]})]}),o.imports.length&&!u.path?(0,Y.jsx)(`div`,{className:`redir-many__offers`,children:o.imports.map(e=>(0,Y.jsx)(O,{size:`sm`,variant:`quiet`,icon:`download`,onClick:()=>d({path:e.path,label:e.label}),children:`${e.label} (${e.count.toLocaleString()})`},e.path))}):null,(0,Y.jsx)(m,{label:`What to do with the list already here`,value:f,onChange:p,options:[{value:`add`,label:`Add to the list`},{value:`replace`,label:`Replace the list`}]})]}),(0,Y.jsx)(`div`,{className:`redir-many__review`,"aria-live":`polite`,"aria-busy":T,children:U?(0,Y.jsx)(`p`,{className:`redir-many__idle`,children:`One redirect per line: the old address, then the new one. Full addresses of this site are shortened to their path.`}):C&&!y?(0,Y.jsx)(c,{compact:!0,title:`Couldn’t read the list`,error:C}):y?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`redir-many__summary`,children:[(0,Y.jsx)(`strong`,{children:`Understood ${y.understood.toLocaleString()} ${y.understood===1?`line`:`lines`}`}),(0,Y.jsx)(`span`,{className:`g-faint`,children:` · ${y.formatLabel}`}),T?(0,Y.jsx)(x,{label:`Checking`}):null]}),(0,Y.jsxs)(`dl`,{className:`redir-tally`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:`New`}),(0,Y.jsx)(`dd`,{children:y.counts.add.toLocaleString()})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:`Changed`}),(0,Y.jsx)(`dd`,{children:y.counts.change.toLocaleString()})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:`Already there`}),(0,Y.jsx)(`dd`,{children:y.counts.same.toLocaleString()})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:`Left out`}),(0,Y.jsx)(`dd`,{children:y.counts.leftOut.toLocaleString()})]})]}),y.unknownHosts.length?(0,Y.jsx)(`div`,{className:`redir-many__hosts`,children:y.unknownHosts.slice(0,3).map(e=>(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`span`,{children:`${e.count.toLocaleString()} old ${e.count===1?`address is`:`addresses are`} on `}),(0,Y.jsx)(`span`,{className:`g-mono`,children:e.host}),(0,Y.jsx)(`span`,{children:`. Is that this site?`}),` `,(0,Y.jsx)(O,{size:`sm`,variant:`secondary`,onClick:()=>v([..._,e.host]),children:`Yes, read them as this site’s`})]},e.host))}):null,y.problems.length?(0,Y.jsx)(`ul`,{className:`redir-problems`,children:y.problems.map(e=>(0,Y.jsx)(pe,{problem:e,onResolve:(e,t)=>g({...h,[e]:e===`missingStatus`?Number(t):t})},`${e.code}:${e.title}`))}):(0,Y.jsxs)(`p`,{className:`redir-many__clean`,children:[(0,Y.jsx)(e,{kind:`reg`}),` Every line reads cleanly.`]}),H?(0,Y.jsx)(`p`,{className:`redir-many__blocked`,role:`status`,children:`Loops can’t be added. Leave them out to continue.`}):null,(0,Y.jsx)(me,{review:y})]}):(0,Y.jsx)(x,{label:`Reading the list`})})]})})}var ge=`2026-11-23`,_e=`https://developers.cloudflare.com/workers/static-assets/redirects/`,ve=`https://developers.cloudflare.com/pages/configuration/redirects/`,ye=`https://developers.cloudflare.com/rules/url-forwarding/bulk-redirects/create-api/`,be=`https://docs.netlify.com/manage/routing/redirects/overview/`,xe=`https://docs.netlify.com/manage/routing/redirects/redirect-options/`,Se=`https://vercel.com/docs/project-configuration/vercel-json#redirects`,Ce=`https://vercel.com/docs/routing/redirects/configuration-redirects`,we=[`Open Cloudflare's API Tokens page (My Profile › API Tokens).`,`Find the key you made for this site and select Edit (the three dots beside it).`,`Under “Permissions”, select “Add more” and choose Account › Account Filter Lists › Edit.`,`Select “Add more” again and choose Account › Bulk URL Redirects › Edit.`,`Check that “Account Resources” includes the account the site's domain is in.`,`Select “Continue to summary”, then “Update token”. The key stays the same, so nothing needs pasting again.`],Te=`https://dash.cloudflare.com/profile/api-tokens`,X=(e,t)=>({title:e,url:t,read:ge}),Z={cloudflare:{id:`cloudflare`,name:`Cloudflare`,file:`public/_redirects`,howItWorks:`Cloudflare reads a file called _redirects from the published site and applies it before serving any page. It travels with the site, so no access key is needed.`,limits:{static:2e3,dynamic:100,total:2100,lineLength:1e3},queryStrings:`Cloudflare can't match old addresses by their query string (the part after “?”); a new address may carry one.`,trailingSlash:`Cloudflare treats /page and /page/ as different addresses, so each needs its own redirect.`,caseSensitivity:`Cloudflare's docs don't say whether capitals matter; keep old addresses exactly as they were.`,statuses:[301,302,307,308],docs:[X(`Redirects (Workers static assets)`,_e),X(`Redirects (Pages)`,ve),X(`Bulk Redirects`,ye)]},netlify:{id:`netlify`,name:`Netlify`,file:`public/_redirects`,howItWorks:`Netlify reads a file called _redirects from the published site, top to bottom, and uses the first rule that matches.`,limits:{static:null,dynamic:null,total:null,lineLength:null},queryStrings:`Netlify passes the visitor's query string on to the new address, and can match an old address by its query parameters.`,trailingSlash:`Netlify matches /page and /page/ alike, so one redirect covers both.`,caseSensitivity:`Netlify matches paths with capitals exactly as written.`,statuses:[301,302],docs:[X(`Redirects and rewrites`,be),X(`Redirect options`,xe)]},vercel:{id:`vercel`,name:`Vercel`,file:`vercel.json`,howItWorks:`Vercel reads the redirects list in vercel.json when the site is built and applies it everywhere it serves the site.`,limits:{static:null,dynamic:null,total:2048,lineLength:4096},queryStrings:`Vercel passes the visitor's query string on to the new address; an old address can be matched by a query parameter.`,trailingSlash:`Vercel treats /page and /page/ as different addresses unless the site's trailing-slash setting joins them.`,caseSensitivity:`Vercel matches old addresses with capitals exactly as written.`,statuses:[301,302,307,308],docs:[X(`vercel.json redirects`,Se),X(`Configuration redirects and limits`,Ce)]},other:{id:`other`,name:`Another host`,file:null,howItWorks:`This app can't write redirects for this host. Download them in the host's format and add them where its documentation says.`,limits:{static:null,dynamic:null,total:null,lineLength:null},queryStrings:`Depends on the host.`,trailingSlash:`Depends on the host.`,caseSensitivity:`Depends on the host.`,statuses:[301,302,307,308],docs:[]}};function Q({item:e}){return(0,Y.jsxs)(`li`,{className:`g-mono`,children:[e.source_url,e.subpath_matching?` (and below)`:``,` → `,e.target_url,` `,(0,Y.jsx)(`span`,{className:`g-faint`,children:e.status_code})]})}function Ee({plan:e}){let t=e.list===`none`&&e.rule===`none`,n=[e.add?`add ${e.add.toLocaleString()}`:``,e.change?`change ${e.change.toLocaleString()}`:``,e.remove?`remove ${e.remove.toLocaleString()}`:``].filter(Boolean);return(0,Y.jsxs)(`div`,{className:`redir-plan`,children:[(0,Y.jsx)(`p`,{className:`redir-plan__headline`,children:t?`Cloudflare already matches the list. Nothing to change.`:`${n.length?n.join(`, `).replace(/^./,e=>e.toUpperCase()):`No redirects to change`} on Cloudflare.`}),(0,Y.jsxs)(`ul`,{className:`redir-plan__facts`,children:[(0,Y.jsx)(`li`,{children:e.list===`create`?`A new redirect list, “${e.listName}”, made by this app.`:`The list “${e.listName}”, made by this app${e.unchanged?`: ${e.unchanged.toLocaleString()} stay as they are`:``}.`}),(0,Y.jsx)(`li`,{children:e.rule===`create`?`One rule that turns the list on, for your account.`:e.rule===`update`?`The rule that turns the list on is put back the way this app set it.`:`The rule that turns the list on is already there.`}),(0,Y.jsx)(`li`,{children:`For ${e.hostnames.join(` and `)}. Lists and rules this app didn’t make aren’t touched.`})]}),e.examples.add.length?(0,Y.jsxs)(`details`,{className:`redir-plan__list`,open:e.add<=5,children:[(0,Y.jsx)(`summary`,{children:`Added (${e.add.toLocaleString()})`}),(0,Y.jsx)(`ul`,{children:e.examples.add.map(e=>(0,Y.jsx)(Q,{item:e},e.source_url))})]}):null,e.examples.change.length?(0,Y.jsxs)(`details`,{className:`redir-plan__list`,children:[(0,Y.jsx)(`summary`,{children:`Changed (${e.change.toLocaleString()})`}),(0,Y.jsx)(`ul`,{children:e.examples.change.map(e=>(0,Y.jsx)(Q,{item:e.after},e.after.source_url))})]}):null,e.examples.remove.length?(0,Y.jsxs)(`details`,{className:`redir-plan__list`,children:[(0,Y.jsx)(`summary`,{children:`Removed (${e.remove.toLocaleString()})`}),(0,Y.jsx)(`ul`,{children:e.examples.remove.map(e=>(0,Y.jsx)(Q,{item:e},e.source_url))})]}):null,e.skipped.length?(0,Y.jsxs)(`details`,{className:`redir-plan__list`,children:[(0,Y.jsx)(`summary`,{children:`Can’t go on Cloudflare (${e.skipped.length.toLocaleString()})`}),(0,Y.jsx)(`ul`,{children:e.skipped.slice(0,20).map(e=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`span`,{className:`g-mono`,children:e.from}),` — `,e.reason]},e.from))})]}):null,e.notes.map(e=>(0,Y.jsxs)(`p`,{className:`redir-plan__note`,children:[(0,Y.jsx)(A,{name:`warning`}),` `,e]},e))]})}function De(){return(0,Y.jsxs)(`div`,{className:`redir-key`,children:[(0,Y.jsx)(`ol`,{className:`redir-key__steps`,children:we.map(e=>(0,Y.jsx)(`li`,{children:e},e))}),(0,Y.jsxs)(`a`,{className:`app-link-button`,href:Te,target:`_blank`,rel:`noopener noreferrer`,children:[`Open Cloudflare’s API Tokens page `,(0,Y.jsx)(A,{name:`external`})]})]})}function Oe({siteId:t,open:n,onClose:r,overview:a}){let o=a.cloudflare,[l,u]=(0,G.useState)(`setup`),[m,h]=(0,G.useState)(o.account??``),[g,_]=(0,G.useState)(o.hostnames.join(`, `)),[v,y]=(0,G.useState)(null),[b,S]=(0,G.useState)(null),[w,T]=(0,G.useState)(!1),[E,k]=(0,G.useState)(o.jobId),[A,j]=(0,G.useState)(null),[P,F]=(0,G.useState)(!1),I=ce(E),L=!!b&&s(b).code===`forbidden`;se(E,n&&l===`applying`),(0,G.useEffect)(()=>{n&&(u(o.jobId&&oe.getState().jobs.find(e=>e.id===o.jobId)?.state===`running`?`applying`:`setup`),h(o.account??``),_(o.hostnames.join(`, `)),y(null),S(null),j(null))},[n]),(0,G.useEffect)(()=>{l===`applying`&&I&&I.state!==`running`&&(u(`done`),N(K.all(t)))},[I,l,t]);let R=g.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean),z=o.accountFrom!==`deploy`&&m.trim()!==(o.account??``)||R.join(`,`)!==o.hostnames.join(`,`),B=async()=>{T(!0),S(null);try{z&&q(t,await M(`PUT /api/sites/:siteId/redirects/settings`,{params:{siteId:t},body:{cloudflare:{...o.accountFrom===`deploy`?{}:{account:m.trim()||null},hostnames:R}}})),y(await M(`POST /api/sites/:siteId/redirects/cloudflare/plan`,{params:{siteId:t}})),u(`plan`)}catch(e){S(e)}finally{T(!1)}},V=async()=>{if(v){T(!0);try{let e=await M(`POST /api/sites/:siteId/redirects/cloudflare/apply`,{params:{siteId:t},body:{planId:v.id}});oe.getState().upsert(e),k(e.id),u(`applying`)}catch(e){S(e)}finally{T(!1)}}},H=async()=>{T(!0);try{j(await M(`POST /api/sites/:siteId/redirects/cloudflare/check`,{params:{siteId:t}})),S(null)}catch(e){S(e)}finally{T(!1)}},U=l===`setup`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`secondary`,onClick:r,children:`Not now`}),(0,Y.jsx)(O,{variant:`primary`,busy:w,busyLabel:`Asking Cloudflare…`,disabled:!o.keyConfigured||!R.length||!m.trim(),onClick:()=>void B(),children:`See the plan`})]}):l===`plan`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`secondary`,onClick:()=>u(`setup`),children:`Back`}),(0,Y.jsx)(O,{variant:`primary`,busy:w,busyLabel:`Starting…`,disabled:!v||v.list===`none`&&v.rule===`none`,onClick:()=>void V(),children:`Apply on Cloudflare`})]}):l===`done`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`secondary`,busy:w,busyLabel:`Checking…`,onClick:()=>void H(),children:`Check Cloudflare matches`}),(0,Y.jsx)(O,{variant:`primary`,onClick:r,children:`Done`})]}):null;return(0,Y.jsxs)(i,{open:n,onClose:r,size:`lg`,dismissible:l!==`applying`,title:`Set the redirects on Cloudflare`,description:`Cloudflare then answers the old addresses itself, in front of the site, with room for far more redirects than the file takes.`,footer:U,children:[l===`setup`?(0,Y.jsxs)(`div`,{className:`redir-cfd`,children:[(0,Y.jsxs)(`ul`,{className:`redir-cfd__facts`,children:[(0,Y.jsx)(`li`,{children:`Only once the site is on its own domain in this Cloudflare account, with its traffic going through Cloudflare (the orange cloud). Not on a workers.dev address.`}),(0,Y.jsx)(`li`,{children:`This app makes one redirect list and one rule, named for this site, and changes nothing else on Cloudflare.`}),(0,Y.jsx)(`li`,{children:`The file that travels with the site stays as well. Where both have a redirect, Cloudflare’s comes first.`})]}),o.accountFrom===`deploy`?(0,Y.jsx)(`p`,{className:`g-hint`,children:`Account: the one this site is put online with.`}):(0,Y.jsx)(C,{label:`Cloudflare account ID`,hint:`On the account’s home page in the Cloudflare dashboard, under Account ID.`,children:(0,Y.jsx)(d,{mono:!0,value:m,onChange:e=>h(e.target.value),placeholder:`0123456789abcdef0123456789abcdef`})}),(0,Y.jsx)(C,{label:`The site’s domains`,hint:`Separate several with commas, like example.com, www.example.com.`,children:(0,Y.jsx)(d,{mono:!0,value:g,onChange:e=>_(e.target.value),placeholder:`www.example.com`})}),o.keyConfigured?null:(0,Y.jsxs)(`p`,{className:`redir-cfd__key`,children:[(0,Y.jsx)(e,{kind:`bang`}),` Add a Cloudflare access key first, in the site’s `,(0,Y.jsx)(p,{to:`/sites/${t}/online`,children:`Online settings`}),`. Then give it these permissions:`]}),(0,Y.jsxs)(`details`,{className:`redir-cfd__perm`,open:!o.keyConfigured||L,children:[(0,Y.jsxs)(`summary`,{children:[`The access key needs `,o.permissions.join(` and `)]}),(0,Y.jsx)(De,{})]}),b?(0,Y.jsx)(c,{compact:!0,title:L?`The access key can’t change Bulk Redirects yet`:`Couldn’t make the plan`,error:b}):null,o.last?(0,Y.jsx)(`button`,{type:`button`,className:`app-link-button redir-cfd__remove`,onClick:()=>F(!0),children:`Take them off Cloudflare…`}):null]}):l===`plan`&&v?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ee,{plan:v}),b?(0,Y.jsx)(c,{compact:!0,title:`Couldn’t start`,error:b}):null]}):l===`applying`?(0,Y.jsxs)(`div`,{className:`redir-cfd__progress`,"aria-live":`polite`,children:[(0,Y.jsx)(x,{label:`Working`}),(0,Y.jsx)(`p`,{children:I?.detail??`Starting…`}),(0,Y.jsx)(`span`,{className:`redir-meter__bar`,"aria-hidden":`true`,children:(0,Y.jsx)(`span`,{style:{inlineSize:`${Math.round((I?.progress??.05)*100)}%`}})}),(0,Y.jsx)(`p`,{className:`g-hint`,children:`Cloudflare works through long lists in the background. You can close this; the result shows here and on the Redirects screen.`})]}):(0,Y.jsxs)(`div`,{className:`redir-cfd__done`,"aria-live":`polite`,children:[I?.state===`done`?(0,Y.jsxs)(`p`,{className:`redir-cfd__ok`,children:[(0,Y.jsx)(e,{kind:`reg`}),` `,I.detail]}):(0,Y.jsx)(c,{compact:!0,title:`Couldn’t set them on Cloudflare`,message:I?.detail??`Cloudflare didn’t finish.`,detail:I?.output}),A?A.matches?(0,Y.jsxs)(`p`,{className:`redir-cfd__ok`,children:[(0,Y.jsx)(e,{kind:`reg`}),` Cloudflare matches the list.`]}):(0,Y.jsx)(`ul`,{className:`redir-cfd__diff`,children:A.differences.map(e=>(0,Y.jsx)(`li`,{children:e},e))}):null,b?(0,Y.jsx)(c,{compact:!0,title:`Couldn’t check Cloudflare`,error:b}):null]}),(0,Y.jsx)(f,{open:P,onClose:()=>F(!1),title:`Take the redirects off Cloudflare?`,body:`This removes the redirect list and the rule this app made. The site’s own redirect file stays, so redirects within its limits keep working.`,confirmLabel:`Take them off`,cancelLabel:`Keep them`,tone:`danger`,errorTitle:`Couldn’t take them off Cloudflare`,onConfirm:async()=>{q(t,await M(`POST /api/sites/:siteId/redirects/cloudflare/remove`,{params:{siteId:t}})),D({tone:`success`,title:`Taken off Cloudflare`}),r()}})]})}function ke({siteId:t,overview:n}){let r=ue(t,n.redirects.length>0),i=r.data;if(n.redirects.length===0)return null;let a=(e,r)=>{J(t,n,n.redirects.map((t,n)=>n===e?{...t,to:r}:t),{undo:{label:`Pointed at the page`,previous:n.redirects}})};return(0,Y.jsxs)(`section`,{className:`app-card app-card--pad redir-panel`,"aria-labelledby":`redir-health-title`,"aria-busy":r.loading,children:[(0,Y.jsx)(`h2`,{id:`redir-health-title`,className:`redir-panel__title`,children:`Health`}),r.loading||!i?(0,Y.jsx)(y,{lines:2}):i.brokenTargets.length===0&&i.linkedOldAddresses.length===0?(0,Y.jsxs)(`p`,{className:`redir-health__ok`,children:[(0,Y.jsx)(e,{kind:`reg`}),` Every new address leads somewhere, and no page links to an old one.`]}):(0,Y.jsxs)(Y.Fragment,{children:[i.brokenTargets.length?(0,Y.jsxs)(`div`,{className:`redir-health__group`,children:[(0,Y.jsx)(`p`,{className:`redir-health__title`,children:`${i.brokenTargets.length.toLocaleString()} ${i.brokenTargets.length===1?`leads`:`lead`} nowhere`}),(0,Y.jsx)(`ul`,{children:i.brokenTargets.slice(0,6).map(e=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`span`,{className:`g-mono`,children:e.from}),` → `,(0,Y.jsx)(`span`,{className:`g-mono`,children:e.to}),e.suggestion?(0,Y.jsx)(O,{size:`sm`,variant:`quiet`,onClick:()=>a(e.index,e.suggestion),children:`Point at ${e.suggestion}`}):null]},e.from))})]}):null,i.linkedOldAddresses.length?(0,Y.jsxs)(`div`,{className:`redir-health__group`,children:[(0,Y.jsx)(`p`,{className:`redir-health__title`,children:`${i.linkedOldAddresses.length.toLocaleString()} old ${i.linkedOldAddresses.length===1?`address is`:`addresses are`} still linked from the site`}),(0,Y.jsx)(`p`,{className:`g-hint`,children:`Change the link to the new address instead, so visitors skip the redirect.`}),(0,Y.jsx)(`ul`,{children:i.linkedOldAddresses.slice(0,6).map(e=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`span`,{className:`g-mono`,children:e.from}),` on `,e.pages.slice(0,3).map((e,n)=>(0,Y.jsxs)(`span`,{children:[n?`, `:``,(0,Y.jsx)(p,{to:`/sites/${t}/edit?path=${encodeURIComponent(e.path)}`,children:e.title})]},e.path))]},e.from))})]}):null]})]})}var $=52;function Ae({full:e,children:t}){return(0,Y.jsx)(h,{content:(0,Y.jsx)(`span`,{className:`g-mono redir-full`,children:e}),children:(0,Y.jsx)(`span`,{className:`redir-address`,tabIndex:0,"aria-label":e,children:t})})}function je({from:e}){let{lead:t,path:n}=z(e);return(0,Y.jsxs)(Ae,{full:e,children:[t?(0,Y.jsxs)(`span`,{className:`redir-address__lead`,children:[t,` `]}):null,(0,Y.jsx)(`span`,{className:`g-mono redir-address__path`,children:n})]})}function Me({to:e}){let{path:t,tail:n}=ie(e);return(0,Y.jsxs)(Ae,{full:e,children:[(0,Y.jsx)(`span`,{className:`g-mono redir-address__path`,children:t}),n?(0,Y.jsxs)(`span`,{className:`redir-address__lead`,children:[` `,n]}):null]})}function Ne({status:e}){return(0,Y.jsxs)(`span`,{className:`redir-kind`,children:[R(e),` `,(0,Y.jsx)(`span`,{className:`redir-kind__code g-mono`,children:e})]})}function Pe({issues:t}){if(!t?.length)return(0,Y.jsx)(`span`,{className:`redir-row__mark`,"aria-hidden":`true`});let n=t.some(e=>e.severity===`error`)?`error`:t.some(e=>e.severity===`warning`)?`warning`:`info`,r=t.map(e=>e.message).join(` `);return(0,Y.jsx)(h,{content:r,children:(0,Y.jsx)(`span`,{className:`redir-row__mark redir-row__mark--${n}`,tabIndex:0,role:`img`,"aria-label":r,children:(0,Y.jsx)(e,{kind:n===`info`?`stet`:`bang`})})})}function Fe({initial:e,onSave:t,onCancel:n,saveLabel:r}){let[i,a]=(0,G.useState)(e.from),[o,s]=(0,G.useState)(e.to),[c,l]=(0,G.useState)(e.status),[u,f]=(0,G.useState)(e.note??``),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=(0,G.useRef)(null);(0,G.useEffect)(()=>_.current?.focus(),[]);let v=async()=>{let n=i.trim(),r=o.trim();if(!n.startsWith(`/`))return g(`The old address starts with “/”, like /old-page/.`);if(!r.startsWith(`/`)&&!/^https?:\/\//i.test(r))return g(`The new address starts with “/” or “https://”.`);g(null),m(!0);let a=await t({...e,from:n,to:r,status:c,...u.trim()?{note:u.trim()}:{note:void 0},source:e.source??`manual`});m(!1),a||g(`It wasn’t saved. See the message above.`)};return(0,Y.jsxs)(`div`,{className:`redir-edit`,role:`group`,"aria-label":e.from?`Edit the redirect from ${e.from}`:`New redirect`,onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),n()):e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),v())},children:[(0,Y.jsx)(d,{ref:_,size:`sm`,mono:!0,value:i,placeholder:`/old-page/`,"aria-label":`Old address`,onChange:e=>a(e.target.value)}),(0,Y.jsx)(`span`,{className:`redir-arrow`,"aria-hidden":`true`,children:`→`}),(0,Y.jsx)(d,{size:`sm`,mono:!0,value:o,placeholder:`/new-page/`,"aria-label":`New address`,onChange:e=>s(e.target.value)}),(0,Y.jsx)(T,{value:String(c),onChange:e=>l(Number(e)),options:ae,"aria-label":`Kind`}),(0,Y.jsx)(d,{size:`sm`,value:u,placeholder:`Note (optional)`,"aria-label":`Note`,onChange:e=>f(e.target.value)}),(0,Y.jsxs)(`span`,{className:`redir-edit__actions`,children:[(0,Y.jsx)(O,{size:`sm`,variant:`primary`,busy:p,busyLabel:`Saving…`,onClick:()=>void v(),children:r}),(0,Y.jsx)(O,{size:`sm`,variant:`quiet`,onClick:n,children:`Cancel`})]}),h?(0,Y.jsx)(`p`,{className:`redir-edit__problem`,role:`alert`,children:h}):null]})}function Ie({rows:e,issues:t,total:n,editing:r,onEdit:i,onSave:a,onDelete:o}){let s=(0,G.useRef)(null),[c,l]=(0,G.useState)({top:0,height:640}),u=(0,G.useMemo)(()=>H(t),[t]),d=ne(c.top,c.height,$,e.length),f=Math.min(e.length*$,728);return(0,G.useEffect)(()=>{let e=s.current;if(!e)return;let t=new ResizeObserver(()=>l(t=>({...t,height:e.clientHeight||640})));return t.observe(e),()=>t.disconnect()},[]),(0,Y.jsxs)(`div`,{className:`redir-table`,role:`table`,"aria-label":`Redirects`,"aria-rowcount":e.length+1,children:[(0,Y.jsxs)(`div`,{className:`redir-table__head`,role:`row`,"aria-rowindex":1,children:[(0,Y.jsx)(`span`,{role:`columnheader`,className:`redir-col--mark`,children:(0,Y.jsx)(`span`,{className:`g-sr`,children:`Problems`})}),(0,Y.jsx)(`span`,{role:`columnheader`,children:`Old address`}),(0,Y.jsx)(`span`,{role:`columnheader`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{role:`columnheader`,children:`New address`}),(0,Y.jsx)(`span`,{role:`columnheader`,children:`Kind`}),(0,Y.jsx)(`span`,{role:`columnheader`,className:`redir-col--source`,children:`Came from`}),(0,Y.jsx)(`span`,{role:`columnheader`,children:(0,Y.jsx)(`span`,{className:`g-sr`,children:`Actions`})})]}),(0,Y.jsx)(`div`,{ref:s,className:`redir-table__body`,style:{blockSize:Math.max(f,$)},onScroll:e=>l({top:e.currentTarget.scrollTop,height:e.currentTarget.clientHeight}),tabIndex:-1,children:(0,Y.jsx)(`div`,{style:{blockSize:e.length*$,position:`relative`},children:e.slice(d.start,d.end).map((e,t)=>{let n=d.start+t,{redirect:s,index:c}=e;return(0,Y.jsx)(`div`,{role:`row`,"aria-rowindex":n+2,className:b(`redir-row`,r===c&&`redir-row--editing`),style:{transform:`translateY(${n*$}px)`},children:r===c?(0,Y.jsx)(Fe,{initial:s,saveLabel:`Save`,onCancel:()=>i(null),onSave:e=>a(c,e)}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{role:`cell`,className:`redir-col--mark`,children:(0,Y.jsx)(Pe,{issues:u.get(c)})}),(0,Y.jsx)(`span`,{role:`cell`,className:`redir-cell`,children:(0,Y.jsx)(je,{from:s.from})}),(0,Y.jsx)(`span`,{role:`cell`,className:`redir-arrow`,"aria-label":`goes to`,children:`→`}),(0,Y.jsxs)(`span`,{role:`cell`,className:`redir-cell redir-cell--stack`,children:[(0,Y.jsx)(Me,{to:s.to}),s.note?(0,Y.jsx)(`span`,{className:`redir-note`,title:s.note,children:s.note}):null]}),(0,Y.jsx)(`span`,{role:`cell`,className:`redir-cell`,title:`${R(s.status)} (${s.status})`,children:(0,Y.jsx)(Ne,{status:s.status})}),(0,Y.jsx)(`span`,{role:`cell`,className:`redir-col--source redir-cell g-faint`,title:V(s.source),children:V(s.source)}),(0,Y.jsxs)(`span`,{role:`cell`,className:`redir-row__actions`,children:[(0,Y.jsx)(E,{icon:`settings`,label:`Edit the redirect from ${s.from}`,onClick:()=>i(c)}),(0,Y.jsx)(E,{icon:`trash`,label:`Delete the redirect from ${s.from}`,onClick:()=>o(c)})]})]})},`${c}:${s.from}`)})})}),e.length<n?(0,Y.jsx)(`p`,{className:`redir-table__foot g-hint`,children:`Showing ${e.length.toLocaleString()} of ${n.toLocaleString()}.`}):null]})}function Le({trace:t}){return t.otherDomain?(0,Y.jsxs)(`p`,{className:`redir-try__line`,children:[(0,Y.jsx)(`span`,{className:`g-mono`,children:t.otherDomain}),` isn’t this site’s address, so this site’s redirects never see it.`]}):t.hops.length===0?(0,Y.jsxs)(`div`,{className:`redir-try__result`,children:[(0,Y.jsx)(`p`,{className:`redir-try__line`,children:t.finalKind===`page`?(0,Y.jsxs)(Y.Fragment,{children:[`No redirect: `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.path}),` is the page “`,t.finalTitle,`”.`]}):t.finalKind===`file`?(0,Y.jsxs)(Y.Fragment,{children:[`No redirect: `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.path}),` is a file on the site.`]}):(0,Y.jsxs)(Y.Fragment,{children:[`No redirect, and nothing is at `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.path}),`: visitors see the missing-page page.`]})}),t.nearMiss?(0,Y.jsxs)(`p`,{className:`redir-try__note`,children:[`There is one for `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.nearMiss}),`, which differs only by the trailing slash or capitals. Most hosts treat those as different addresses.`]}):null]}):(0,Y.jsxs)(`div`,{className:`redir-try__result`,children:[(0,Y.jsx)(`ol`,{className:`redir-try__hops`,children:t.hops.map((e,t)=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`span`,{className:`g-mono`,children:e.from}),(0,Y.jsx)(`span`,{className:`redir-arrow`,"aria-label":`goes to`,children:`→`}),(0,Y.jsx)(`span`,{className:`g-mono`,children:e.to}),(0,Y.jsxs)(`span`,{className:`redir-kind`,children:[R(e.status),` `,(0,Y.jsx)(`span`,{className:`redir-kind__code g-mono`,children:e.status})]})]},`${t}:${e.from}`))}),t.loop?(0,Y.jsxs)(`p`,{className:`redir-try__line redir-try__line--danger`,children:[(0,Y.jsx)(e,{kind:`bang`}),` This goes round in a circle: visitors never arrive anywhere.`]}):t.finalKind===`external`?(0,Y.jsxs)(`p`,{className:`redir-try__line`,children:[`Ends on another site: `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.final})]}):t.finalKind===`page`?(0,Y.jsxs)(`p`,{className:`redir-try__line redir-try__line--ok`,children:[(0,Y.jsx)(e,{kind:`reg`}),` Ends on “`,t.finalTitle,`”, `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.final}),t.hops.length>1?`, after ${t.hops.length} steps.`:`.`]}):t.finalKind===`file`?(0,Y.jsxs)(`p`,{className:`redir-try__line redir-try__line--ok`,children:[`Ends on the file `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.final}),`.`]}):(0,Y.jsxs)(`p`,{className:`redir-try__line redir-try__line--danger`,children:[(0,Y.jsx)(e,{kind:`bang`}),` Ends at `,(0,Y.jsx)(`span`,{className:`g-mono`,children:t.final}),`, where nothing is: visitors see the missing-page page.`]})]})}function Re({siteId:e}){let[t,n]=(0,G.useState)(``),[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(null),[c,l]=(0,G.useState)(!1),u=async n=>{if(n.preventDefault(),t.trim()){l(!0);try{i(await M(`POST /api/sites/:siteId/redirects/try`,{params:{siteId:e},body:{address:t}})),o(null)}catch(e){o(s(e).message)}finally{l(!1)}}};return(0,Y.jsxs)(`section`,{className:`app-card app-card--pad redir-panel`,"aria-labelledby":`redir-try-title`,children:[(0,Y.jsx)(`h2`,{id:`redir-try-title`,className:`redir-panel__title`,children:`Try an address`}),(0,Y.jsxs)(`form`,{className:`redir-try__form`,onSubmit:e=>void u(e),children:[(0,Y.jsx)(d,{size:`sm`,mono:!0,value:t,placeholder:`/an-old-page/`,"aria-label":`An old address`,onChange:e=>n(e.target.value)}),(0,Y.jsx)(O,{size:`sm`,variant:`secondary`,type:`submit`,busy:c,busyLabel:`Trying…`,children:`Try`})]}),a?(0,Y.jsx)(`p`,{className:`redir-try__line redir-try__line--danger`,children:a}):r?(0,Y.jsx)(Le,{trace:r}):(0,Y.jsx)(`p`,{className:`g-hint`,children:`See exactly where a visitor who types it ends up.`})]})}var ze=[{id:`cloudflare`,blurb:`A _redirects file travels with the site.`},{id:`netlify`,blurb:`A _redirects file travels with the site.`},{id:`vercel`,blurb:`The redirects go in vercel.json.`},{id:`other`,blurb:`Download them in the host’s format.`}],Be=[{format:`csv`,label:`Spreadsheet (CSV)`},{format:`redirects-file`,label:`_redirects file`},{format:`vercel-json`,label:`Vercel`},{format:`cloudflare-csv`,label:`Cloudflare list`},{format:`nginx`,label:`nginx`},{format:`apache`,label:`Apache (.htaccess)`}];async function Ve(e,t){try{q(e,await M(`PUT /api/sites/:siteId/redirects/settings`,{params:{siteId:e},body:{host:t}}))}catch(e){let t=s(e);D({tone:`danger`,title:`Couldn’t save where the site is hosted`,body:t.message,detail:t.detail})}}function He({siteId:e,overview:t,onDone:n}){let r=t.host.suggestion?.id??null,[i,a]=(0,G.useState)(null);return(0,Y.jsxs)(`fieldset`,{className:`redir-hosts`,children:[(0,Y.jsx)(`legend`,{className:`redir-panel__title`,children:`Where is this site hosted?`}),t.host.suggestion?(0,Y.jsx)(`p`,{className:`g-hint`,children:t.host.suggestion.reason}):(0,Y.jsx)(`p`,{className:`g-hint`,children:`Redirects take effect through the host’s own file. Choose once; it’s saved with the site.`}),(0,Y.jsx)(`div`,{className:`redir-hosts__options`,children:ze.map(o=>(0,Y.jsxs)(`button`,{type:`button`,className:b(`redir-host`,r===o.id&&`redir-host--suggested`,t.host.id===o.id&&`redir-host--on`),"aria-pressed":t.host.id===o.id,disabled:i!==null,onClick:()=>{a(o.id),Ve(e,o.id).finally(()=>{a(null),n?.()})},children:[(0,Y.jsxs)(`span`,{className:`redir-host__name`,children:[Z[o.id].name,r===o.id?(0,Y.jsx)(_,{tone:`accent`,mark:null,children:`Looks like it`}):null]}),(0,Y.jsx)(`span`,{className:`redir-host__blurb`,children:o.blurb})]},o.id))})]})}function Ue({label:e,used:t,limit:n}){let r=B(t,n);return(0,Y.jsxs)(`div`,{className:b(`redir-meter`,r!==null&&r>=1&&t>(n??0)&&`redir-meter--over`),children:[(0,Y.jsxs)(`span`,{className:`redir-meter__label`,children:[e,(0,Y.jsx)(`span`,{className:`g-faint`,children:n===null?` ${t.toLocaleString()}`:` ${t.toLocaleString()} of ${n.toLocaleString()}`})]}),r===null?null:(0,Y.jsx)(`span`,{className:`redir-meter__bar`,"aria-hidden":`true`,children:(0,Y.jsx)(`span`,{style:{inlineSize:`${Math.max(r*100,t?2:0)}%`}})})]})}function We({siteId:t,overview:n,onImport:r}){let a=n.derived,[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1),f=async()=>{d(!0);try{q(t,await M(`POST /api/sites/:siteId/redirects/derived/replace`,{params:{siteId:t}})),l(!1),D({tone:`success`,title:`Replaced from the list`,body:`The change is waiting in Proof.`})}catch(e){let t=s(e);D({tone:`danger`,title:`Couldn’t replace the file`,body:t.message,detail:t.detail})}finally{d(!1)}},p={"in-step":{tone:`success`,text:`In step with the list`},stale:{tone:`warning`,text:`Behind the list — changed outside the app`},"hand-edited":{tone:`warning`,text:`Changed by hand`},foreign:{tone:`warning`,text:`The site’s own file`},missing:{tone:`neutral`,text:`Written when the first redirect is added`}}[a.state];return(0,Y.jsxs)(`div`,{className:`redir-derived`,children:[(0,Y.jsxs)(`p`,{className:`redir-derived__file`,children:[(0,Y.jsx)(`span`,{className:`g-mono`,children:a.path}),a.state===`missing`?null:(0,Y.jsxs)(`a`,{className:`app-link-button`,href:o(t,a.path),target:`_blank`,rel:`noopener noreferrer`,children:[`View it `,(0,Y.jsx)(A,{name:`external`})]})]}),(0,Y.jsxs)(`p`,{className:`redir-derived__state redir-derived__state--${p.tone}`,children:[(0,Y.jsx)(e,{kind:p.tone===`success`?`reg`:p.tone===`warning`?`bang`:`stet`}),` `,p.text]}),a.state===`stale`?(0,Y.jsx)(O,{size:`sm`,variant:`secondary`,busy:u,busyLabel:`Updating…`,onClick:()=>void f(),children:`Bring it up to date`}):null,a.state===`hand-edited`||a.state===`foreign`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`g-hint`,children:a.state===`foreign`?`The site already had this file, so it was left as it is. The list isn’t in it yet.`:`Someone edited this file by hand since the app wrote it, so it wasn’t replaced.`}),(0,Y.jsx)(O,{size:`sm`,variant:`secondary`,onClick:()=>l(!0),children:`Review the difference…`}),(0,Y.jsx)(i,{open:c,onClose:()=>l(!1),size:`xl`,title:a.state===`foreign`?`${a.path} isn’t from the list yet`:`${a.path} was changed by hand`,description:`The left is the file now; the right is what the list would make it. Bring its redirects into the list first if any of them should stay.`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`secondary`,onClick:()=>(l(!1),r(a.path)),children:`Bring its redirects into the list…`}),(0,Y.jsx)(O,{variant:`primary`,busy:u,busyLabel:`Replacing…`,onClick:()=>void f(),children:`Replace it with the list`})]}),children:(0,Y.jsxs)(`div`,{className:`redir-compare`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`g-eyebrow`,children:`Now`}),(0,Y.jsx)(`pre`,{className:`redir-compare__text g-mono`,children:a.current})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`g-eyebrow`,children:`From the list`}),(0,Y.jsx)(`pre`,{className:`redir-compare__text g-mono`,children:a.proposed})]})]})})]}):null]})}function Ge({siteId:t,overview:n,onImport:r,onCloudflare:i}){let[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(null),l=n.host.id,u=n.hostInfo;if(!l||a)return(0,Y.jsxs)(`section`,{className:`app-card app-card--pad redir-panel`,children:[(0,Y.jsx)(He,{siteId:t,overview:n,onDone:()=>o(!1)}),a?(0,Y.jsxs)(O,{size:`sm`,variant:`quiet`,onClick:()=>o(!1),children:[`Keep `,Z[l].name]}):null]});let d=n.usage,m=n.cloudflare;return(0,Y.jsxs)(`section`,{className:`app-card app-card--pad redir-panel`,"aria-labelledby":`redir-where-title`,children:[(0,Y.jsx)(`h2`,{id:`redir-where-title`,className:`redir-panel__title`,children:`Where they take effect`}),(0,Y.jsxs)(`p`,{className:`redir-where__host`,children:[(0,Y.jsx)(`strong`,{children:u.name}),n.host.from===`deploy`?(0,Y.jsxs)(`span`,{className:`g-faint`,children:[` · from the `,(0,Y.jsx)(p,{to:`/sites/${t}/online`,children:`Online settings`})]}):(0,Y.jsx)(`button`,{type:`button`,className:`app-link-button`,onClick:()=>o(!0),children:`Change`})]}),(0,Y.jsx)(`p`,{className:`redir-where__how`,children:u.howItWorks}),n.derived?(0,Y.jsx)(We,{siteId:t,overview:n,onImport:r}):null,d&&(u.limits.static!==null||u.limits.total!==null)?(0,Y.jsxs)(`div`,{className:`redir-meters`,children:[u.limits.static===null?null:(0,Y.jsx)(Ue,{label:`Exact addresses`,used:d.static,limit:u.limits.static}),u.limits.dynamic===null?null:(0,Y.jsx)(Ue,{label:`Wildcards`,used:d.dynamic,limit:u.limits.dynamic}),u.limits.static===null&&u.limits.total!==null?(0,Y.jsx)(Ue,{label:`Redirects`,used:d.total,limit:u.limits.total}):null]}):null,d?.leftOut.length?(0,Y.jsx)(`p`,{className:`g-hint`,children:`${d.leftOut.length.toLocaleString()} can’t go in ${u.name}’s file: ${d.leftOut[0].reason}`}):null,d?.over?(0,Y.jsxs)(`p`,{className:`redir-where__over`,role:`status`,children:[(0,Y.jsx)(e,{kind:`bang`}),` More than `,u.name,`’s file takes. `,l===`cloudflare`?`Set them on Cloudflare to cover the whole list.`:`Some won’t work until the list is shorter.`]}):null,n.leftovers.map(e=>(0,Y.jsxs)(`p`,{className:`redir-where__leftover`,children:[(0,Y.jsxs)(`span`,{children:[`The redirect file for `,Z[e.host].name,`, `,(0,Y.jsx)(`span`,{className:`g-mono`,children:e.path}),`, is still in the site.`]}),(0,Y.jsx)(O,{size:`sm`,variant:`quiet`,onClick:()=>c(e.path),children:`Remove it`})]},e.path)),l===`other`?(0,Y.jsxs)(`div`,{className:`redir-exports`,children:[(0,Y.jsx)(`p`,{className:`g-hint`,children:`This app can’t write redirects for this host. Download them in its format and add them where its documentation says.`}),(0,Y.jsx)(`ul`,{children:Be.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`a`,{className:S(`secondary`,`sm`),href:de(t,e.format),download:!0,children:[(0,Y.jsx)(A,{name:`download`}),` `,e.label]})},e.format))})]}):null,(0,Y.jsxs)(`details`,{className:`redir-where__docs`,children:[(0,Y.jsxs)(`summary`,{children:[`What `,u.name,` does with them`]}),(0,Y.jsxs)(`ul`,{children:[(0,Y.jsx)(`li`,{children:u.queryStrings}),(0,Y.jsx)(`li`,{children:u.trailingSlash}),(0,Y.jsx)(`li`,{children:u.caseSensitivity}),u.docs.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:e.title})},e.url))]})]}),m?(0,Y.jsxs)(`div`,{className:`redir-cf`,children:[(0,Y.jsx)(`h3`,{className:`redir-cf__title`,children:`Also set them on Cloudflare`}),(0,Y.jsx)(`p`,{className:`redir-cf__text`,children:m.reason}),m.last?(0,Y.jsxs)(`p`,{className:b(`redir-cf__last`,m.outOfDate&&`redir-cf__last--behind`),children:[(0,Y.jsx)(e,{kind:m.outOfDate?`bang`:`reg`}),` Set on Cloudflare ${v(m.last.appliedAt)}${m.last.who?` by ${m.last.who}`:``} · ${W(m.last.items)} for ${m.last.hostnames.join(`, `)}`,m.outOfDate?`. The list has changed since.`:`.`]}):null,(0,Y.jsx)(O,{size:`sm`,variant:m.recommended||m.outOfDate?`primary`:`secondary`,icon:`globe`,onClick:i,children:m.last?`Update on Cloudflare…`:`Set them on Cloudflare…`})]}):null,(0,Y.jsx)(f,{open:s!==null,onClose:()=>c(null),title:`Remove ${s??``}?`,body:`This app wrote it for a host the site no longer uses. Removing it is a pending change you can discard in Proof.`,confirmLabel:`Remove it`,cancelLabel:`Keep it`,onConfirm:async()=>{s&&q(t,await M(`POST /api/sites/:siteId/redirects/leftover/remove`,{params:{siteId:t},body:{path:s}}))}})]})}var Ke={from:``,to:``,status:301,source:`manual`};function qe(){let{siteId:e=``}=n(),t=le(e),r=t.data,[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(`all`),[u,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)({open:!1,start:null}),[_,v]=(0,G.useState)(!1),[b,x]=w(),S=b.get(`add`);(0,G.useEffect)(()=>{if(!S||!r)return;let e=re(r.imports,S);e&&g({open:!0,start:e}),x(e=>{let t=new URLSearchParams(e);return t.delete(`add`),t},{replace:!0})},[S,r,x]),P({crumbs:[{label:`Redirects`}]}),L(`changes.updated`,t=>{t.siteId===e&&N(K.all(e))}),L(`site.updated`,t=>{t.siteId===e&&N(K.all(e))}),L(`job`,t=>{t.job.kind===`redirects`&&t.job.siteId===e&&t.job.state!==`running`&&N(K.all(e))});let C=(0,G.useMemo)(()=>{if(!r)return[];let e=H(r.issues),t=[];return r.redirects.forEach((n,r)=>{te(n,i)&&(o!==`problems`||e.has(r))&&(o===`all`||o===`problems`||(e.get(r)??[]).some(e=>e.code===o))&&t.push({redirect:n,index:r})}),t},[r,i,o]);if(t.loading)return(0,Y.jsx)(`div`,{className:`app-screen`,"aria-busy":`true`,children:(0,Y.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide`,children:[(0,Y.jsx)(y,{width:220,height:32}),(0,Y.jsx)(y,{lines:8,style:{marginBlockStart:24}})]})});if(!r)return(0,Y.jsx)(`div`,{className:`app-screen`,children:(0,Y.jsx)(`div`,{className:`app-screen__inner`,children:(0,Y.jsx)(c,{title:`Couldn’t load the redirects`,error:t.error,onRetry:()=>void t.refetch()})})});let E=U(r.issues),D=H(r.issues).size,A=(t,n)=>J(e,r,t,n?{undo:{label:n,previous:r.redirects}}:{}),M=e=>{let t=r.redirects[e];f(null),A(r.redirects.filter((t,n)=>n!==e),`Removed the redirect from ${t.from}`)},F=async(e,t)=>{let n=await A(r.redirects.map((n,r)=>r===e?t:n));return n&&f(null),!!n},I=async e=>{let t=await A([...r.redirects,e],`Added a redirect from ${e.from}`);return t&&m(!1),!!t};return(0,Y.jsxs)(`div`,{className:`app-screen`,children:[(0,Y.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide redir-screen`,children:[(0,Y.jsx)(k,{title:`Redirects`,description:`When a page moves, a redirect sends visitors and search engines from its old address to the new one.`,actions:(0,Y.jsxs)(Y.Fragment,{children:[r.redirects.length?(0,Y.jsx)(j,{label:`Download`,placement:`bottom-end`,items:[{id:`csv`,label:`Spreadsheet (CSV)`},{id:`redirects-file`,label:`_redirects file`},{id:`vercel-json`,label:`Vercel (vercel.json)`},{id:`cloudflare-csv`,label:`Cloudflare Bulk Redirects list`},{id:`nginx`,label:`nginx configuration`},{id:`apache`,label:`Apache (.htaccess)`}].map(t=>({id:t.id,label:t.label,icon:`download`,onSelect:()=>window.open(de(e,t.id),`_blank`,`noopener`)})),trigger:e=>(0,Y.jsx)(O,{variant:`secondary`,icon:`download`,...e,children:`Download`})}):null,r.redirects.length?(0,Y.jsx)(O,{variant:`primary`,icon:`plus`,disabled:!!r.problem,onClick:()=>g({open:!0,start:null}),children:`Add many`}):null]})}),r.problem?(0,Y.jsx)(c,{compact:!0,title:`The redirects file can’t be read`,message:r.problem}):null,(0,Y.jsxs)(`div`,{className:`redir-layout`,children:[(0,Y.jsx)(`div`,{className:`redir-main`,children:r.redirects.length===0&&!p?(0,Y.jsxs)(`div`,{className:`app-card redir-empty`,children:[(0,Y.jsx)(l,{title:`No redirects yet.`,body:`A redirect sends visitors from an old address to a new one, so old links and search results keep working after a page moves.`,mark:`pilcrow`,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`primary`,onClick:()=>g({open:!0,start:null}),disabled:!!r.problem,children:`Add many`}),(0,Y.jsx)(O,{variant:`secondary`,onClick:()=>m(!0),disabled:!!r.problem,children:`Add one`})]})}),r.imports.length?(0,Y.jsx)(`div`,{className:`redir-empty__offers`,children:r.imports.map(e=>(0,Y.jsx)(O,{variant:`quiet`,icon:`download`,onClick:()=>g({open:!0,start:e}),children:`Bring in ${e.label.replace(/^The /,`the `)} (${e.count.toLocaleString()})`},e.path))}):null]}):(0,Y.jsxs)(Y.Fragment,{children:[ee(r.imports).filter(e=>e.path.startsWith(`wordpress-import/`)).map(e=>(0,Y.jsxs)(`div`,{className:`app-card redir-offer`,role:`note`,children:[(0,Y.jsx)(`span`,{children:`${e.label}: ${(e.waiting??e.count).toLocaleString()} ${(e.waiting??e.count)===1?`isn’t`:`aren’t`} in the list yet.`}),(0,Y.jsx)(O,{size:`sm`,variant:`secondary`,icon:`download`,disabled:!!r.problem,onClick:()=>g({open:!0,start:e}),children:`Review them`})]},e.path)),(0,Y.jsxs)(`div`,{className:`redir-toolbar`,children:[(0,Y.jsx)(d,{size:`sm`,type:`search`,value:i,placeholder:`Find an address or note`,"aria-label":`Find a redirect`,onChange:e=>a(e.target.value)}),(0,Y.jsx)(T,{value:o,onChange:s,"aria-label":`Show`,options:[{value:`all`,label:`All (${r.redirects.length.toLocaleString()})`},...D?[{value:`problems`,label:`With problems (${D.toLocaleString()})`}]:[],...E.map(e=>({value:e.code,label:`${e.label} (${e.count.toLocaleString()})`}))]}),(0,Y.jsx)(`span`,{className:`redir-toolbar__count g-faint`,children:W(r.redirects.length)}),(0,Y.jsx)(O,{size:`sm`,variant:`secondary`,icon:`plus`,onClick:()=>(m(!0),f(null)),disabled:p||!!r.problem,children:`Add one`})]}),p?(0,Y.jsx)(`div`,{className:`app-card redir-adding`,children:(0,Y.jsx)(Fe,{initial:Ke,saveLabel:`Add`,onCancel:()=>m(!1),onSave:I})}):null,C.length?(0,Y.jsx)(Ie,{rows:C,issues:r.issues,total:r.redirects.length,editing:u,onEdit:f,onSave:F,onDelete:M}):r.redirects.length?(0,Y.jsx)(l,{compact:!0,title:`Nothing matches.`,body:i?`No redirect mentions “${i}”.`:`No redirect has that problem.`,actions:(0,Y.jsx)(O,{variant:`secondary`,size:`sm`,onClick:()=>(a(``),s(`all`)),children:`Show all`})}):null,(0,Y.jsx)(`p`,{className:`redir-order g-hint`,children:`Exact addresses come first and wildcards after, the most specific first — the order every host needs. The list keeps it by itself.`})]})}),(0,Y.jsxs)(`aside`,{className:`redir-aside`,"aria-label":`Where redirects take effect`,children:[(0,Y.jsx)(Ge,{siteId:e,overview:r,onImport:e=>g({open:!0,start:{path:e,label:e,count:0}}),onCloudflare:()=>v(!0)}),(0,Y.jsx)(Re,{siteId:e}),(0,Y.jsx)(ke,{siteId:e,overview:r})]})]})]}),(0,Y.jsx)(he,{siteId:e,open:h.open,start:h.start,overview:r,onClose:()=>g({open:!1,start:null})}),r.cloudflare?(0,Y.jsx)(Oe,{siteId:e,open:_,onClose:()=>v(!1),overview:r}):null]})}export{qe as RedirectsScreen};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.redir-screen{gap:var(--space-6);display:grid}.redir-layout{gap:var(--space-6);grid-template-columns:minmax(0,1fr) clamp(280px,22vw,340px);align-items:start;display:grid}@media (width<=1100px){.redir-layout{grid-template-columns:minmax(0,1fr)}}.redir-main{gap:var(--space-3);min-inline-size:0;display:grid}.redir-aside{gap:var(--space-4);min-inline-size:0;display:grid;position:sticky;inset-block-start:0}@media (width<=1100px){.redir-aside{grid-template-columns:repeat(auto-fit,minmax(300px,1fr));position:static}}.redir-toolbar{gap:var(--space-2);flex-wrap:wrap;align-items:center;display:flex}.redir-toolbar>.g-input{flex:220px;max-inline-size:360px}.redir-toolbar__count{font-size:var(--text-sm);font-variant-numeric:tabular-nums;margin-inline-start:auto}.redir-table{border:var(--border-hair) solid var(--border-default);border-radius:var(--radius-md);background:var(--surface-raised);overflow:hidden}.redir-table__head,.redir-row,.redir-edit{align-items:center;column-gap:var(--space-3);padding-inline:var(--space-3);grid-template-columns:20px minmax(0,1.25fr) 16px minmax(0,1fr) 96px minmax(0,88px) 64px;display:grid}.redir-edit{padding-block:var(--space-2);grid-template-columns:minmax(0,1fr) 16px minmax(0,1fr) 176px minmax(0,.8fr) auto}.redir-table__head{border-block-end:var(--border-hair) solid var(--border-default);background:var(--surface-sunken);block-size:36px;font-size:var(--text-xs);font-weight:var(--weight-semibold);letter-spacing:var(--tracking-label);color:var(--ink-secondary);text-transform:uppercase}.redir-table__body{overscroll-behavior:contain;position:relative;overflow-y:auto}.redir-table__body:focus-visible{outline:var(--focus-width) solid var(--focus-ring);outline-offset:calc(-1 * var(--focus-width))}.redir-row{border-block-end:var(--border-hair) solid var(--border-subtle);block-size:52px;font-size:var(--text-sm);transition:background var(--duration-fast) var(--ease-standard);position:absolute;inset-block-start:0;inset-inline:0}.redir-row:hover,.redir-row:focus-within{background:var(--surface-sunken)}.redir-row--editing{background:var(--accent-subtle)}.redir-row--editing>.redir-edit{grid-column:1/-1;padding-inline:0}.redir-row__actions{justify-content:flex-end;gap:var(--space-0-5);opacity:.55;transition:opacity var(--duration-fast) var(--ease-standard);display:flex}.redir-row:hover .redir-row__actions,.redir-row:focus-within .redir-row__actions{opacity:1}.redir-row__mark{border-radius:var(--radius-pill);place-items:center;block-size:18px;inline-size:18px;display:inline-grid}.redir-row__mark:focus-visible{outline:var(--focus-width) solid var(--focus-ring);outline-offset:var(--focus-offset)}.redir-row__mark--error{color:var(--danger-ink)}.redir-row__mark--warning{color:var(--warning-ink)}.redir-row__mark--info{color:var(--ink-tertiary)}.redir-cell{text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;overflow:hidden}.redir-cell--stack{gap:1px;display:grid}.redir-cell--stack>*{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.redir-note{color:var(--ink-tertiary);font-size:var(--text-xs)}.redir-address{border-radius:var(--radius-xs);min-inline-size:0;display:inline}.redir-address:focus-visible{outline:var(--focus-width) solid var(--focus-ring);outline-offset:1px}.redir-cell>.app-tooltip-anchor{text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;display:block;overflow:hidden}.redir-full{overflow-wrap:anywhere}.redir-address__lead{color:var(--ink-secondary)}.redir-address__path{color:var(--ink-primary)}.redir-arrow{color:var(--ink-tertiary);text-align:center}.redir-kind{white-space:nowrap;color:var(--ink-primary)}.redir-kind__code{color:var(--ink-tertiary);font-size:var(--text-xs)}.redir-table__foot{padding:var(--space-2) var(--space-3);border-block-start:var(--border-hair) solid var(--border-subtle);margin:0}@media (width<=1280px){.redir-table__head,.redir-row{grid-template-columns:20px minmax(0,1.25fr) 16px minmax(0,1fr) 96px 64px}.redir-col--source{display:none}}@media (width<=760px){.redir-table__head,.redir-row{grid-template-columns:20px minmax(0,1fr) 16px minmax(0,1fr) 64px}.redir-col--source,.redir-table__head>:nth-child(5),.redir-row>:nth-child(5){display:none}.redir-edit{grid-template-columns:minmax(0,1fr)}.redir-edit>.redir-arrow{display:none}}.redir-edit__actions{gap:var(--space-1);justify-content:flex-end;display:flex}.redir-edit__problem{margin:var(--space-1) 0 0;color:var(--danger-ink);font-size:var(--text-sm);grid-column:1/-1}.redir-adding{padding:var(--space-1) var(--space-3)}.redir-adding>.redir-edit{padding-inline:0}.redir-order{margin:0}.redir-empty{padding-block-end:var(--space-4)}.redir-empty__offers{justify-content:center;gap:var(--space-2);flex-wrap:wrap;display:flex}.redir-offer{justify-content:space-between;align-items:center;gap:var(--space-3);padding:var(--space-2) var(--space-3);font-size:var(--text-sm);margin-block-end:var(--space-3);display:flex}.redir-panel{gap:var(--space-3);display:grid}.redir-panel__title{font-family:var(--font-text);font-size:var(--text-md);font-weight:var(--weight-semibold);color:var(--ink-primary);margin:0;padding:0}.redir-panel p{margin:0}.redir-where__host{align-items:baseline;gap:var(--space-2);display:flex}.redir-where__how{color:var(--ink-secondary);font-size:var(--text-sm);line-height:var(--leading-body)}.redir-where__over,.redir-where__leftover{gap:var(--space-2);font-size:var(--text-sm);color:var(--warning-ink);align-items:flex-start;display:flex}.redir-where__leftover{color:var(--ink-secondary);justify-content:space-between}.redir-where__docs{font-size:var(--text-sm);color:var(--ink-secondary)}.redir-where__docs>summary{cursor:pointer;color:var(--ink-primary)}.redir-where__docs ul{margin:var(--space-2) 0 0;gap:var(--space-1);line-height:var(--leading-body);padding-inline-start:var(--space-5);display:grid}.redir-derived{gap:var(--space-2);padding:var(--space-3);border-radius:var(--radius-sm);background:var(--surface-sunken);justify-items:start;display:grid}.redir-derived__file{gap:var(--space-2);font-size:var(--text-sm);flex-wrap:wrap;align-items:baseline;display:flex}.redir-derived__file .app-link-button{gap:var(--space-1);align-items:center;display:inline-flex}.redir-derived__state{gap:var(--space-2);font-size:var(--text-sm);align-items:center;display:flex}.redir-derived__state--success{color:var(--success-ink)}.redir-derived__state--warning{color:var(--warning-ink)}.redir-derived__state--neutral{color:var(--ink-secondary)}.redir-meters{gap:var(--space-2);display:grid}.redir-meter{gap:var(--space-1);font-size:var(--text-sm);display:grid}.redir-meter__label{font-variant-numeric:tabular-nums;justify-content:space-between;display:flex}.redir-meter__bar{border-radius:var(--radius-pill);background:var(--surface-sunken);block-size:6px;display:block;overflow:hidden}.redir-meter__bar>span{border-radius:inherit;background:var(--accent);block-size:100%;transition:inline-size var(--duration-slow) var(--ease-out);display:block}.redir-meter--over .redir-meter__bar>span{background:var(--danger)}@media (prefers-reduced-motion:reduce){.redir-meter__bar>span{transition:none}}.redir-exports ul{margin:var(--space-2) 0 0;gap:var(--space-2);flex-wrap:wrap;padding:0;list-style:none;display:flex}.redir-hosts{gap:var(--space-2);border:0;min-inline-size:0;margin:0;padding:0;display:grid}.redir-hosts>legend{margin-block-end:var(--space-1)}.redir-hosts__options{gap:var(--space-2);grid-template-columns:1fr 1fr;display:grid}.redir-host{gap:var(--space-1);text-align:start;padding:var(--space-3);cursor:pointer;border:var(--border-hair) solid var(--border-default);border-radius:var(--radius-md);background:var(--surface-raised);color:var(--ink-primary);font:inherit;transition:border-color var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard);display:grid}.redir-host:hover:not(:disabled){border-color:var(--border-strong);transform:translateY(-1px)}.redir-host:active:not(:disabled){transform:translateY(0)}.redir-host:focus-visible{outline:var(--focus-width) solid var(--focus-ring);outline-offset:var(--focus-offset)}.redir-host--suggested{border-color:var(--accent-line)}.redir-host--on{border-color:var(--accent);background:var(--accent-subtle)}.redir-host__name{gap:var(--space-2);font-weight:var(--weight-semibold);align-items:center;display:flex}.redir-host__blurb{color:var(--ink-secondary);font-size:var(--text-xs);line-height:var(--leading-sm)}@media (prefers-reduced-motion:reduce){.redir-host,.redir-host:hover:not(:disabled){transition:none;transform:none}}.redir-cf{gap:var(--space-2);border-block-start:var(--border-hair) solid var(--border-subtle);justify-items:start;padding-block-start:var(--space-3);display:grid}.redir-cf__title{font-size:var(--text-sm);font-weight:var(--weight-semibold);margin:0}.redir-cf__text{color:var(--ink-secondary);font-size:var(--text-sm);line-height:var(--leading-body)}.redir-cf__last{gap:var(--space-2);font-size:var(--text-sm);color:var(--success-ink);align-items:flex-start;display:flex}.redir-cf__last--behind{color:var(--warning-ink)}.redir-try__form{gap:var(--space-2);display:flex}.redir-try__form>.g-input{flex:1;min-inline-size:0}.redir-try__result{gap:var(--space-2);display:grid}.redir-try__hops{gap:var(--space-1);font-size:var(--text-sm);margin:0;padding:0;list-style:none;display:grid}.redir-try__hops>li{gap:var(--space-1-5);padding:var(--space-1-5) var(--space-2);border-radius:var(--radius-sm);background:var(--surface-sunken);flex-wrap:wrap;align-items:baseline;display:flex}.redir-try__hops .redir-kind{font-size:var(--text-xs);margin-inline-start:auto}.redir-try__line{gap:var(--space-1);font-size:var(--text-sm);line-height:var(--leading-body);flex-wrap:wrap;align-items:baseline;display:flex}.redir-try__line--ok{color:var(--success-ink)}.redir-try__line--danger{color:var(--danger-ink)}.redir-try__note{font-size:var(--text-sm);color:var(--warning-ink);line-height:var(--leading-body)}.redir-health__ok{gap:var(--space-2);font-size:var(--text-sm);color:var(--success-ink);line-height:var(--leading-body);display:flex}.redir-health__group{gap:var(--space-1);font-size:var(--text-sm);display:grid}.redir-health__title{font-weight:var(--weight-semibold)}.redir-health__group ul{gap:var(--space-1);margin:0;padding:0;list-style:none;display:grid}.redir-health__group li{gap:var(--space-1);flex-wrap:wrap;align-items:center;display:flex}.redir-many{gap:var(--space-5);grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);align-items:start;min-block-size:420px;display:grid}@media (width<=900px){.redir-many{grid-template-columns:minmax(0,1fr)}}.redir-many__source{gap:var(--space-3);display:grid}.redir-many__drop{gap:var(--space-2);padding:var(--space-2);border:var(--border-thick) dashed var(--border-default);border-radius:var(--radius-md);transition:border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard);display:grid}.redir-many__drop--on{border-color:var(--accent);background:var(--accent-subtle)}.redir-many__drop .g-textarea{background:0 0;border:0;min-block-size:168px}.redir-many__actions{gap:var(--space-2);align-items:center;display:flex}.redir-many__file{gap:var(--space-2);padding:var(--space-3);border-radius:var(--radius-md);background:var(--surface-sunken);font-size:var(--text-sm);align-items:center;display:flex}.redir-many__file>span{text-overflow:ellipsis;flex:1;min-inline-size:0;overflow:hidden}.redir-many__offers{gap:var(--space-1);flex-wrap:wrap;display:flex}.redir-many__review{gap:var(--space-3);max-block-size:62vh;align-content:start;padding-inline-end:var(--space-1);display:grid;overflow-y:auto}.redir-many__idle{padding:var(--space-6) var(--space-4);border-radius:var(--radius-md);background:var(--surface-sunken);color:var(--ink-secondary);font-size:var(--text-sm);line-height:var(--leading-body);margin:0}.redir-many__summary{gap:var(--space-2);flex-wrap:wrap;align-items:center;margin:0;display:flex}.redir-many__hosts p{gap:var(--space-1);font-size:var(--text-sm);flex-wrap:wrap;align-items:center;margin:0;display:flex}.redir-many__clean,.redir-many__blocked{gap:var(--space-2);font-size:var(--text-sm);margin:0;display:flex}.redir-many__clean{color:var(--success-ink)}.redir-many__blocked{color:var(--danger-ink);font-weight:var(--weight-medium)}.redir-tally{gap:var(--space-2);grid-template-columns:repeat(4,minmax(0,1fr));margin:0;display:grid}.redir-tally>div{padding:var(--space-2) var(--space-3);border-radius:var(--radius-sm);background:var(--surface-sunken)}.redir-tally dt{font-size:var(--text-xs);color:var(--ink-secondary)}.redir-tally dd{font-size:var(--text-lg);font-weight:var(--weight-semibold);font-variant-numeric:tabular-nums;margin:0}.redir-problems{gap:var(--space-2);margin:0;padding:0;list-style:none;display:grid}.redir-problem{gap:var(--space-1-5);padding:var(--space-3);border:var(--border-hair) solid var(--border-default);border-radius:var(--radius-md);background:var(--surface-raised);display:grid}.redir-problem--danger{border-color:var(--danger);background:var(--danger-tint)}.redir-problem__head{gap:var(--space-2);grid-template-columns:18px minmax(0,1fr);align-items:start;display:grid}.redir-problem__resolve{margin-inline-start:26px}.redir-problem__resolve:empty{display:none}.redir-problem__mark{margin-block-start:2px}.redir-problem--danger .redir-problem__mark{color:var(--danger-ink)}.redir-problem--warning .redir-problem__mark{color:var(--warning-ink)}.redir-problem--info .redir-problem__mark{color:var(--ink-tertiary)}.redir-problem__text{gap:var(--space-0-5);display:grid}.redir-problem__title{font-weight:var(--weight-semibold);font-size:var(--text-sm);margin:0}.redir-problem__body{color:var(--ink-secondary);font-size:var(--text-sm);line-height:var(--leading-body);margin:0}.redir-problem__toggle{font-size:var(--text-sm);justify-self:start;margin-inline-start:26px}.redir-problem__examples{gap:var(--space-1);font-size:var(--text-xs);margin:0 0 0 26px;padding:0;list-style:none;display:grid}.redir-problem__examples>li{gap:var(--space-1-5);flex-wrap:wrap;align-items:baseline;display:flex}.redir-problem__line{color:var(--ink-tertiary);min-inline-size:52px}.redir-problem__from{overflow-wrap:anywhere}.redir-problem__detail{color:var(--ink-secondary);flex-basis:100%;padding-inline-start:58px}.redir-preview{gap:var(--space-2);display:grid}.redir-preview>.g-eyebrow{margin:0}.redir-preview__table{border:var(--border-hair) solid var(--border-subtle);border-radius:var(--radius-sm);max-block-size:280px;overflow-y:auto}.redir-preview__row{gap:var(--space-2);padding:var(--space-1-5) var(--space-2);font-size:var(--text-xs);border-block-end:var(--border-hair) solid var(--border-subtle);grid-template-columns:76px minmax(0,1fr) 14px minmax(0,1fr) 108px;align-items:center;display:grid}.redir-preview__row:last-child{border-block-end:0}.redir-compare{gap:var(--space-3);grid-template-columns:1fr 1fr;display:grid}.redir-compare__text{margin:var(--space-1) 0 0;padding:var(--space-3);border-radius:var(--radius-sm);background:var(--surface-sunken);max-block-size:50vh;font-size:var(--text-xs);line-height:var(--leading-sm);white-space:pre;overflow:auto}.redir-cfd{gap:var(--space-4);display:grid}.redir-cfd__facts{gap:var(--space-1-5);font-size:var(--text-sm);line-height:var(--leading-body);color:var(--ink-secondary);margin:0;padding-inline-start:var(--space-5);display:grid}.redir-cfd__key{gap:var(--space-1);color:var(--warning-ink);font-size:var(--text-sm);flex-wrap:wrap;align-items:baseline;margin:0;display:flex}.redir-cfd__perm>summary{cursor:pointer;font-size:var(--text-sm);font-weight:var(--weight-medium)}.redir-cfd__remove{font-size:var(--text-sm);color:var(--danger-ink);justify-self:start}.redir-cfd__progress{gap:var(--space-3);justify-items:start;display:grid}.redir-cfd__progress>.redir-meter__bar{justify-self:stretch}.redir-cfd__progress p{margin:0}.redir-cfd__done{gap:var(--space-3);display:grid}.redir-cfd__ok{gap:var(--space-2);color:var(--success-ink);margin:0;display:flex}.redir-cfd__diff{color:var(--warning-ink);font-size:var(--text-sm);margin:0;padding-inline-start:var(--space-5)}.redir-key{gap:var(--space-2);margin-block-start:var(--space-2);display:grid}.redir-key__steps{gap:var(--space-1);font-size:var(--text-sm);line-height:var(--leading-body);margin:0;padding-inline-start:var(--space-6);display:grid}.redir-plan{gap:var(--space-3);display:grid}.redir-plan__headline{font-family:var(--font-display);font-size:var(--text-xl);line-height:var(--leading-heading);margin:0}.redir-plan__facts{gap:var(--space-1);font-size:var(--text-sm);color:var(--ink-secondary);line-height:var(--leading-body);margin:0;padding-inline-start:var(--space-5);display:grid}.redir-plan__list>summary{cursor:pointer;font-size:var(--text-sm);font-weight:var(--weight-medium)}.redir-plan__list ul{margin:var(--space-2) 0 0;gap:var(--space-1);font-size:var(--text-xs);overflow-wrap:anywhere;max-block-size:200px;padding:0;list-style:none;display:grid;overflow-y:auto}.redir-plan__note{gap:var(--space-2);font-size:var(--text-sm);color:var(--ink-secondary);line-height:var(--leading-body);align-items:flex-start;margin:0;display:flex}.redir-plan__note>.g-icon{color:var(--warning-ink);flex:none;margin-block-start:2px}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$ as e,A as t,At as n,F as r,Ft as i,I as a,N as o,Nt as s,O as c,_ as l,a as u,bt as d,c as f,g as p,gt as m,i as h,j as g,k as _,mt as v,n as y,pt as b,v as x,vt as ee}from"./ui-C6O2tW4c.js";import{A as S,B as C,C as w,D as T,H as E,M as D,N as O,P as k,R as A,S as te,V as ne,b as j,c as re,d as ie,f as ae,h as oe,i as se,j as M,l as ce,n as N,o as le,p as ue,t as de,v as P,y as F,z as I}from"./ProviderSettings-BtM56M7d.js";import{n as L}from"./chrome-Brnq5kGb.js";import{E as fe,T as R,_ as pe,b as me,g as he,i as ge,n as _e,y as ve}from"./outside-Bv1jj3yu.js";import{_ as ye,a as be,i as xe}from"./listPlan-BPJMzA6e.js";import{t as z}from"./site-DJUEXLHW.js";import{I as Se,j as Ce}from"./index-CtsAxi5d.js";var B=i(s(),1);function V(e){return oe.find(t=>t.kind===e)??ae(e)}function H(e){return e.label?.trim()||V(e.kind)?.name||e.kind}function we(e){let t=V(e.kind),n=e.kind===`custom`?M(e.settings.src)?`src`:null:t?.settings.find(e=>e.required)?.key??t?.settings[0]?.key??null;return n&&M(e.settings[n]).trim()||null}function U(e){return e.category===`tag-manager`||e.category===`analytics`?`eager`:e.category===`support`?`interaction`:`idle`}function Te(e,t,n){let r=new Set(n),i=e.kind;for(let t=2;r.has(i);t++)i=`${e.kind}-${t}`;let a={};for(let[e,n]of Object.entries(t))M(n).trim()&&(a[e]=typeof n==`string`?n.trim():n);return{id:i,kind:e.kind,enabled:!0,settings:a,placement:e.defaultPlacement,load:U(e),consent:e.defaultConsent}}var W={eager:{label:`Straight away`,line:`Loads with the page. Needed for tags that must see the first page view.`},idle:{label:`When idle`,line:`Waits until the page has finished loading, so it doesn’t slow the page down.`},interaction:{label:`First interaction`,line:`Waits for the visitor’s first scroll, tap or key press. Best for chat and pop-ups.`}},G={necessary:{label:`Necessary`,line:`Always loads. Only for scripts the site can’t work without, or that keep no record of the visitor.`},analytics:{label:`Analytics`,line:`Measures visits. Loads once the visitor agrees to analytics.`},marketing:{label:`Marketing`,line:`Advertising and follow-up. Loads once the visitor agrees to marketing.`},preferences:{label:`Preferences`,line:`Remembers choices and powers extras like chat. Loads once the visitor agrees to preferences.`}},K={head:`In the page head`,"body-start":`At the start of the page`,"body-end":`At the end of the page`},q={"tag-manager":`Tag managers`,analytics:`Analytics`,advertising:`Advertising`,marketing:`Marketing`,support:`Support and chat`,other:`Other`};function J(e){return e.consent??V(e.kind)?.defaultConsent??`necessary`}function Y(e){return e.load??`eager`}function Ee(e){return{gtm:`GTM`,ga4:`GA`,"meta-pixel":`Me`,"linkedin-insight":`in`,hubspot:`Hs`,"marketo-munchkin":`Mk`,plausible:`Pl`,segment:`Sg`,hotjar:`Hj`,clarity:`Cl`,intercom:`Ic`,custom:`</>`}[e]??e.slice(0,2)}var X=d();function De(e,t){let n=`${e.name} ${e.description} ${q[e.category]}`.toLowerCase();return t.toLowerCase().split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function Oe({open:e,onClose:i,taken:a,allowBuild:o,onAdd:s}){let[u,d]=(0,B.useState)(``),{siteId:f=``}=n(),p=ue(f),[h,_]=(0,B.useState)(null),[v,y]=(0,B.useState)({}),[x,S]=(0,B.useState)(`src`),[C,w]=(0,B.useState)(!1);(0,B.useEffect)(()=>{e&&(d(``),_(null),y({}),S(`src`),w(!1))},[e]);let T=(0,B.useMemo)(()=>{let e=p.scriptIntegrations.filter(e=>De(e,u));return Object.keys(q).map(t=>({category:t,items:e.filter(e=>e.category===t)})).filter(e=>e.items.length>0)},[u,p.scriptIntegrations]),E=h?.kind===`custom`,D=(h?.settings??[]).filter(e=>!E||e.key===x),O=Object.fromEntries(D.map(e=>[e.key,se(E?{...e,required:!0}:e,v[e.key])]).filter(([,e])=>e)),k=h!==null&&Object.keys(O).length===0,A=()=>{if(w(!0),!h||!k)return;let e={};for(let t of D)v[t.key]?.trim()&&(e[t.key]=v[t.key]??``);let t=Te(h,e,a);s(re(h)?ie(t,h,p.nameOf(h.plugin)):t),i()};return(0,X.jsx)(r,{open:e,onClose:i,title:h?`Add ${h.name}`:`Add a script`,description:h?h.description:`Pick what to add. You’ll only be asked for what it needs.`,size:`lg`,footer:h?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(b,{variant:`secondary`,onClick:()=>_(null),children:`Back to the list`}),(0,X.jsxs)(b,{variant:`primary`,onClick:A,disabled:C&&!k,children:[`Add `,h.name]})]}):(0,X.jsx)(b,{variant:`secondary`,onClick:i,children:`Not now`}),children:h?(0,X.jsxs)(`div`,{className:`kit-add`,children:[E?(0,X.jsx)(g,{label:`How it’s added`,group:!0,hint:o?void 0:`Writing code into the page is only offered on sites where build mode is allowed, because it runs with full access to every page.`,children:(0,X.jsx)(l,{label:`How it’s added`,options:[{value:`src`,label:`From an address`},{value:`inline`,label:`Code`,disabled:!o}],value:x,onChange:S})}):null,D.map(e=>{let n=C||v[e.key]?O[e.key]:void 0;return(0,X.jsx)(g,{label:e.label,hint:n?void 0:e.help??(e.placeholder?`Looks like ${e.placeholder}`:void 0),error:n,children:e.key===`inline`?(0,X.jsx)(t,{mono:!0,rows:6,maxRows:16,spellCheck:!1,value:v[e.key]??``,onChange:t=>y({...v,[e.key]:t.target.value})}):(0,X.jsx)(c,{mono:!0,spellCheck:!1,placeholder:e.placeholder,value:v[e.key]??``,onChange:t=>y({...v,[e.key]:t.target.value}),onKeyDown:e=>e.key===`Enter`&&A()})},e.key)}),(0,X.jsxs)(`div`,{className:m(`kit-add__defaults`),children:[(0,X.jsx)(`p`,{className:`g-eyebrow`,children:`Already chosen for you`}),(0,X.jsxs)(`ul`,{children:[(0,X.jsxs)(`li`,{children:[W[U(h)].label,` — `,W[U(h)].line]}),(0,X.jsxs)(`li`,{children:[K[h.defaultPlacement],`.`]}),(0,X.jsxs)(`li`,{children:[`Consent: `,G[h.defaultConsent].label,`. `,G[h.defaultConsent].line]}),(0,X.jsx)(`li`,{children:`Every page. You can limit it to some pages once it’s added.`})]})]})]}):(0,X.jsxs)(`div`,{className:`kit-catalogue`,children:[(0,X.jsx)(c,{"aria-label":`Search scripts`,placeholder:`Search — analytics, chat, ads…`,value:u,onChange:e=>d(e.target.value),"data-autofocus":!0}),T.length===0?(0,X.jsxs)(`p`,{className:`g-hint`,children:[`Nothing matches “`,u,`”. Try a shorter word, or add a custom script.`]}):null,T.map(e=>(0,X.jsxs)(`section`,{className:`kit-catalogue__group`,"aria-label":q[e.category],children:[(0,X.jsx)(`p`,{className:`g-eyebrow`,children:q[e.category]}),(0,X.jsx)(`div`,{className:`kit-catalogue__items`,children:e.items.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`kit-catalogue__item`,onClick:()=>{_(e),y({}),w(!1)},children:[(0,X.jsx)(N,{text:Ee(e.kind)}),(0,X.jsxs)(`span`,{className:`kit-catalogue__text`,children:[(0,X.jsx)(`span`,{className:`kit-catalogue__name`,children:e.name}),(0,X.jsx)(`span`,{className:`kit-catalogue__description`,children:e.description}),e.plugin===`@galley/builtin`?null:(0,X.jsxs)(`span`,{className:`kit-catalogue__description`,children:[`From the plugin `,p.nameOf(e.plugin)]})]}),(0,X.jsx)(ee,{name:`chevron-right`})]},e.kind))})]},e.category))]})})}var ke=[{value:`none`,label:`Off`},{value:`banner`,label:`Built-in banner`},{value:`external`,label:`Another consent tool`}],Ae={none:`Every switched-on script loads for every visitor, without asking.`,banner:`The site asks visitors first, with a small banner. Scripts wait for the categories they need.`,external:`Your own consent tool asks, and tells the site what visitors agreed to. Scripts wait for it.`},je=[`analytics`,`marketing`,`preferences`],Z={title:`Cookies and tracking`,text:`This site would like to measure visits and the success of its marketing. Choose what it may use. You can change this at any time from the link at the bottom of each page.`,acceptLabel:`Accept all`,rejectLabel:`Reject all`,settingsLabel:`Choose…`};function Me({banner:e,theme:t}){return(0,X.jsxs)(`div`,{className:`kit-banner-frame`,"data-theme":t,children:[(0,X.jsxs)(`div`,{className:`kit-banner`,"aria-hidden":`true`,children:[(0,X.jsx)(`p`,{className:`kit-banner__title`,children:e.title||Z.title}),(0,X.jsxs)(`p`,{className:`kit-banner__text`,children:[e.text||Z.text,` `,e.policyUrl?(0,X.jsx)(`span`,{className:`g-link`,children:`Privacy policy`}):null]}),(0,X.jsxs)(`span`,{className:`kit-banner__buttons`,children:[(0,X.jsx)(`span`,{className:`kit-pv__button`,children:e.acceptLabel||Z.acceptLabel}),(0,X.jsx)(`span`,{className:`kit-pv__button`,children:e.rejectLabel||Z.rejectLabel}),(0,X.jsx)(`span`,{className:`kit-pv__button kit-pv__button--back`,children:e.settingsLabel||Z.settingsLabel})]})]}),(0,X.jsx)(`span`,{className:`kit-banner-frame__label`,children:t===`light`?`Light`:`Dark`})]})}function Ne({config:t,trackingWithoutConsent:n}){let r=j(),i=ne(),a=t.consent,o=a?.mode??`none`,s=new Set(a?.defaults??[]),c=a?.banner??{},u=(e,t)=>{let n=je.filter(n=>n===e?t:s.has(n));r.choose([`consent`,`defaults`],n.length?n:void 0)};return(0,X.jsxs)(`section`,{className:m(`g-block kit-consent`,i.has(`area:consent`)&&`kit-consent--flash`),"aria-labelledby":`consent-title`,children:[(0,X.jsx)(`header`,{className:`g-block__head`,children:(0,X.jsx)(`h2`,{id:`consent-title`,className:`kit-tab-head__title`,children:`Consent`})}),(0,X.jsxs)(`div`,{className:`g-block__body kit-consent__body`,children:[(0,X.jsx)(g,{label:`Ask visitors first`,group:!0,hint:Ae[o],children:(0,X.jsx)(l,{label:`Ask visitors first`,options:ke,value:o,onChange:e=>r.choose([`consent`,`mode`],e)})}),n?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note kit-note--warning`,role:`status`,children:[(0,X.jsx)(e,{kind:`bang`}),(0,X.jsx)(`span`,{children:`Analytics or marketing scripts are switched on with consent off. In many countries visitors must agree before these load.`})]}):null,o===`banner`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`kit-consent__texts`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`title`],label:`Title`,placeholder:Z.title}),(0,X.jsx)(P,{path:[`consent`,`banner`,`text`],label:`Text`,placeholder:Z.text,multiline:!0}),(0,X.jsxs)(`div`,{className:`app-form-row`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`acceptLabel`],label:`Accept button`,placeholder:Z.acceptLabel}),(0,X.jsx)(P,{path:[`consent`,`banner`,`rejectLabel`],label:`Refuse button`,placeholder:Z.rejectLabel})]}),(0,X.jsxs)(`div`,{className:`app-form-row`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`settingsLabel`],label:`Choices button`,placeholder:Z.settingsLabel}),(0,X.jsx)(P,{path:[`consent`,`banner`,`policyUrl`],label:`Privacy policy page`,mono:!0,placeholder:`/privacy/`})]})]}),(0,X.jsxs)(`div`,{className:`kit-consent__previews`,"aria-label":`Banner preview`,children:[(0,X.jsx)(Me,{banner:c,theme:`light`}),(0,X.jsx)(Me,{banner:c,theme:`dark`})]})]}):null,o===`none`?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(g,{label:`On before the visitor chooses`,group:!0,hint:`Necessary scripts always load. Leave these off where the law asks for agreement first.`,children:(0,X.jsx)(`div`,{className:`kit-checks`,children:je.map(e=>(0,X.jsx)(h,{label:G[e].label,description:G[e].line,checked:s.has(e),onChange:t=>u(e,t)},e))})}),(0,X.jsx)(F,{path:[`consent`,`googleConsentMode`],label:`Tell Google tags about consent (Consent Mode)`,description:`Google Analytics and Tag Manager are told what visitors agreed to, so they can adjust what they record.`})]})]})]})}function Pe(e){let t=[],n=new Map;e.scripts.forEach((e,t)=>n.set(e.id,[...n.get(e.id)??[],t]));for(let[e,r]of n)e&&r.length>1&&t.push({id:`id-${e}`,tone:`warning`,text:`${r.length} scripts use the name “${e}”. Give each its own, so changes and page rules apply to the right one.`,scripts:r});let r=new Map;e.scripts.forEach((e,t)=>{if(!e.enabled)return;let n=we(e);if(!n)return;let i=`${e.kind}\n${n}`;r.set(i,[...r.get(i)??[],t])});for(let[n,i]of r){if(i.length<2)continue;let r=e.scripts[i[0]],a=n.split(`
|
|
1
|
+
import{$ as e,A as t,At as n,F as r,Ft as i,I as a,N as o,Nt as s,O as c,_ as l,a as u,bt as d,c as f,g as p,gt as m,i as h,j as g,k as _,mt as v,n as y,pt as b,v as x,vt as ee}from"./ui-C6O2tW4c.js";import{A as S,B as C,C as w,D as T,H as E,M as D,N as O,P as k,R as A,S as te,V as ne,b as j,c as re,d as ie,f as ae,h as oe,i as se,j as M,l as ce,n as N,o as le,p as ue,t as de,v as P,y as F,z as I}from"./ProviderSettings-CbQQdCdU.js";import{n as L}from"./chrome-Brnq5kGb.js";import{E as fe,T as R,_ as pe,b as me,g as he,i as ge,n as _e,y as ve}from"./outside-1xNdvt-F.js";import{_ as ye,a as be,i as xe}from"./listPlan-Bds9RfG_.js";import{t as z}from"./site-DJUEXLHW.js";import{I as Se,j as Ce}from"./index-A7aTfJ-x.js";var B=i(s(),1);function V(e){return oe.find(t=>t.kind===e)??ae(e)}function H(e){return e.label?.trim()||V(e.kind)?.name||e.kind}function we(e){let t=V(e.kind),n=e.kind===`custom`?M(e.settings.src)?`src`:null:t?.settings.find(e=>e.required)?.key??t?.settings[0]?.key??null;return n&&M(e.settings[n]).trim()||null}function U(e){return e.category===`tag-manager`||e.category===`analytics`?`eager`:e.category===`support`?`interaction`:`idle`}function Te(e,t,n){let r=new Set(n),i=e.kind;for(let t=2;r.has(i);t++)i=`${e.kind}-${t}`;let a={};for(let[e,n]of Object.entries(t))M(n).trim()&&(a[e]=typeof n==`string`?n.trim():n);return{id:i,kind:e.kind,enabled:!0,settings:a,placement:e.defaultPlacement,load:U(e),consent:e.defaultConsent}}var W={eager:{label:`Straight away`,line:`Loads with the page. Needed for tags that must see the first page view.`},idle:{label:`When idle`,line:`Waits until the page has finished loading, so it doesn’t slow the page down.`},interaction:{label:`First interaction`,line:`Waits for the visitor’s first scroll, tap or key press. Best for chat and pop-ups.`}},G={necessary:{label:`Necessary`,line:`Always loads. Only for scripts the site can’t work without, or that keep no record of the visitor.`},analytics:{label:`Analytics`,line:`Measures visits. Loads once the visitor agrees to analytics.`},marketing:{label:`Marketing`,line:`Advertising and follow-up. Loads once the visitor agrees to marketing.`},preferences:{label:`Preferences`,line:`Remembers choices and powers extras like chat. Loads once the visitor agrees to preferences.`}},K={head:`In the page head`,"body-start":`At the start of the page`,"body-end":`At the end of the page`},q={"tag-manager":`Tag managers`,analytics:`Analytics`,advertising:`Advertising`,marketing:`Marketing`,support:`Support and chat`,other:`Other`};function J(e){return e.consent??V(e.kind)?.defaultConsent??`necessary`}function Y(e){return e.load??`eager`}function Ee(e){return{gtm:`GTM`,ga4:`GA`,"meta-pixel":`Me`,"linkedin-insight":`in`,hubspot:`Hs`,"marketo-munchkin":`Mk`,plausible:`Pl`,segment:`Sg`,hotjar:`Hj`,clarity:`Cl`,intercom:`Ic`,custom:`</>`}[e]??e.slice(0,2)}var X=d();function De(e,t){let n=`${e.name} ${e.description} ${q[e.category]}`.toLowerCase();return t.toLowerCase().split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function Oe({open:e,onClose:i,taken:a,allowBuild:o,onAdd:s}){let[u,d]=(0,B.useState)(``),{siteId:f=``}=n(),p=ue(f),[h,_]=(0,B.useState)(null),[v,y]=(0,B.useState)({}),[x,S]=(0,B.useState)(`src`),[C,w]=(0,B.useState)(!1);(0,B.useEffect)(()=>{e&&(d(``),_(null),y({}),S(`src`),w(!1))},[e]);let T=(0,B.useMemo)(()=>{let e=p.scriptIntegrations.filter(e=>De(e,u));return Object.keys(q).map(t=>({category:t,items:e.filter(e=>e.category===t)})).filter(e=>e.items.length>0)},[u,p.scriptIntegrations]),E=h?.kind===`custom`,D=(h?.settings??[]).filter(e=>!E||e.key===x),O=Object.fromEntries(D.map(e=>[e.key,se(E?{...e,required:!0}:e,v[e.key])]).filter(([,e])=>e)),k=h!==null&&Object.keys(O).length===0,A=()=>{if(w(!0),!h||!k)return;let e={};for(let t of D)v[t.key]?.trim()&&(e[t.key]=v[t.key]??``);let t=Te(h,e,a);s(re(h)?ie(t,h,p.nameOf(h.plugin)):t),i()};return(0,X.jsx)(r,{open:e,onClose:i,title:h?`Add ${h.name}`:`Add a script`,description:h?h.description:`Pick what to add. You’ll only be asked for what it needs.`,size:`lg`,footer:h?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(b,{variant:`secondary`,onClick:()=>_(null),children:`Back to the list`}),(0,X.jsxs)(b,{variant:`primary`,onClick:A,disabled:C&&!k,children:[`Add `,h.name]})]}):(0,X.jsx)(b,{variant:`secondary`,onClick:i,children:`Not now`}),children:h?(0,X.jsxs)(`div`,{className:`kit-add`,children:[E?(0,X.jsx)(g,{label:`How it’s added`,group:!0,hint:o?void 0:`Writing code into the page is only offered on sites where build mode is allowed, because it runs with full access to every page.`,children:(0,X.jsx)(l,{label:`How it’s added`,options:[{value:`src`,label:`From an address`},{value:`inline`,label:`Code`,disabled:!o}],value:x,onChange:S})}):null,D.map(e=>{let n=C||v[e.key]?O[e.key]:void 0;return(0,X.jsx)(g,{label:e.label,hint:n?void 0:e.help??(e.placeholder?`Looks like ${e.placeholder}`:void 0),error:n,children:e.key===`inline`?(0,X.jsx)(t,{mono:!0,rows:6,maxRows:16,spellCheck:!1,value:v[e.key]??``,onChange:t=>y({...v,[e.key]:t.target.value})}):(0,X.jsx)(c,{mono:!0,spellCheck:!1,placeholder:e.placeholder,value:v[e.key]??``,onChange:t=>y({...v,[e.key]:t.target.value}),onKeyDown:e=>e.key===`Enter`&&A()})},e.key)}),(0,X.jsxs)(`div`,{className:m(`kit-add__defaults`),children:[(0,X.jsx)(`p`,{className:`g-eyebrow`,children:`Already chosen for you`}),(0,X.jsxs)(`ul`,{children:[(0,X.jsxs)(`li`,{children:[W[U(h)].label,` — `,W[U(h)].line]}),(0,X.jsxs)(`li`,{children:[K[h.defaultPlacement],`.`]}),(0,X.jsxs)(`li`,{children:[`Consent: `,G[h.defaultConsent].label,`. `,G[h.defaultConsent].line]}),(0,X.jsx)(`li`,{children:`Every page. You can limit it to some pages once it’s added.`})]})]})]}):(0,X.jsxs)(`div`,{className:`kit-catalogue`,children:[(0,X.jsx)(c,{"aria-label":`Search scripts`,placeholder:`Search — analytics, chat, ads…`,value:u,onChange:e=>d(e.target.value),"data-autofocus":!0}),T.length===0?(0,X.jsxs)(`p`,{className:`g-hint`,children:[`Nothing matches “`,u,`”. Try a shorter word, or add a custom script.`]}):null,T.map(e=>(0,X.jsxs)(`section`,{className:`kit-catalogue__group`,"aria-label":q[e.category],children:[(0,X.jsx)(`p`,{className:`g-eyebrow`,children:q[e.category]}),(0,X.jsx)(`div`,{className:`kit-catalogue__items`,children:e.items.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`kit-catalogue__item`,onClick:()=>{_(e),y({}),w(!1)},children:[(0,X.jsx)(N,{text:Ee(e.kind)}),(0,X.jsxs)(`span`,{className:`kit-catalogue__text`,children:[(0,X.jsx)(`span`,{className:`kit-catalogue__name`,children:e.name}),(0,X.jsx)(`span`,{className:`kit-catalogue__description`,children:e.description}),e.plugin===`@galley/builtin`?null:(0,X.jsxs)(`span`,{className:`kit-catalogue__description`,children:[`From the plugin `,p.nameOf(e.plugin)]})]}),(0,X.jsx)(ee,{name:`chevron-right`})]},e.kind))})]},e.category))]})})}var ke=[{value:`none`,label:`Off`},{value:`banner`,label:`Built-in banner`},{value:`external`,label:`Another consent tool`}],Ae={none:`Every switched-on script loads for every visitor, without asking.`,banner:`The site asks visitors first, with a small banner. Scripts wait for the categories they need.`,external:`Your own consent tool asks, and tells the site what visitors agreed to. Scripts wait for it.`},je=[`analytics`,`marketing`,`preferences`],Z={title:`Cookies and tracking`,text:`This site would like to measure visits and the success of its marketing. Choose what it may use. You can change this at any time from the link at the bottom of each page.`,acceptLabel:`Accept all`,rejectLabel:`Reject all`,settingsLabel:`Choose…`};function Me({banner:e,theme:t}){return(0,X.jsxs)(`div`,{className:`kit-banner-frame`,"data-theme":t,children:[(0,X.jsxs)(`div`,{className:`kit-banner`,"aria-hidden":`true`,children:[(0,X.jsx)(`p`,{className:`kit-banner__title`,children:e.title||Z.title}),(0,X.jsxs)(`p`,{className:`kit-banner__text`,children:[e.text||Z.text,` `,e.policyUrl?(0,X.jsx)(`span`,{className:`g-link`,children:`Privacy policy`}):null]}),(0,X.jsxs)(`span`,{className:`kit-banner__buttons`,children:[(0,X.jsx)(`span`,{className:`kit-pv__button`,children:e.acceptLabel||Z.acceptLabel}),(0,X.jsx)(`span`,{className:`kit-pv__button`,children:e.rejectLabel||Z.rejectLabel}),(0,X.jsx)(`span`,{className:`kit-pv__button kit-pv__button--back`,children:e.settingsLabel||Z.settingsLabel})]})]}),(0,X.jsx)(`span`,{className:`kit-banner-frame__label`,children:t===`light`?`Light`:`Dark`})]})}function Ne({config:t,trackingWithoutConsent:n}){let r=j(),i=ne(),a=t.consent,o=a?.mode??`none`,s=new Set(a?.defaults??[]),c=a?.banner??{},u=(e,t)=>{let n=je.filter(n=>n===e?t:s.has(n));r.choose([`consent`,`defaults`],n.length?n:void 0)};return(0,X.jsxs)(`section`,{className:m(`g-block kit-consent`,i.has(`area:consent`)&&`kit-consent--flash`),"aria-labelledby":`consent-title`,children:[(0,X.jsx)(`header`,{className:`g-block__head`,children:(0,X.jsx)(`h2`,{id:`consent-title`,className:`kit-tab-head__title`,children:`Consent`})}),(0,X.jsxs)(`div`,{className:`g-block__body kit-consent__body`,children:[(0,X.jsx)(g,{label:`Ask visitors first`,group:!0,hint:Ae[o],children:(0,X.jsx)(l,{label:`Ask visitors first`,options:ke,value:o,onChange:e=>r.choose([`consent`,`mode`],e)})}),n?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note kit-note--warning`,role:`status`,children:[(0,X.jsx)(e,{kind:`bang`}),(0,X.jsx)(`span`,{children:`Analytics or marketing scripts are switched on with consent off. In many countries visitors must agree before these load.`})]}):null,o===`banner`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`kit-consent__texts`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`title`],label:`Title`,placeholder:Z.title}),(0,X.jsx)(P,{path:[`consent`,`banner`,`text`],label:`Text`,placeholder:Z.text,multiline:!0}),(0,X.jsxs)(`div`,{className:`app-form-row`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`acceptLabel`],label:`Accept button`,placeholder:Z.acceptLabel}),(0,X.jsx)(P,{path:[`consent`,`banner`,`rejectLabel`],label:`Refuse button`,placeholder:Z.rejectLabel})]}),(0,X.jsxs)(`div`,{className:`app-form-row`,children:[(0,X.jsx)(P,{path:[`consent`,`banner`,`settingsLabel`],label:`Choices button`,placeholder:Z.settingsLabel}),(0,X.jsx)(P,{path:[`consent`,`banner`,`policyUrl`],label:`Privacy policy page`,mono:!0,placeholder:`/privacy/`})]})]}),(0,X.jsxs)(`div`,{className:`kit-consent__previews`,"aria-label":`Banner preview`,children:[(0,X.jsx)(Me,{banner:c,theme:`light`}),(0,X.jsx)(Me,{banner:c,theme:`dark`})]})]}):null,o===`none`?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(g,{label:`On before the visitor chooses`,group:!0,hint:`Necessary scripts always load. Leave these off where the law asks for agreement first.`,children:(0,X.jsx)(`div`,{className:`kit-checks`,children:je.map(e=>(0,X.jsx)(h,{label:G[e].label,description:G[e].line,checked:s.has(e),onChange:t=>u(e,t)},e))})}),(0,X.jsx)(F,{path:[`consent`,`googleConsentMode`],label:`Tell Google tags about consent (Consent Mode)`,description:`Google Analytics and Tag Manager are told what visitors agreed to, so they can adjust what they record.`})]})]})]})}function Pe(e){let t=[],n=new Map;e.scripts.forEach((e,t)=>n.set(e.id,[...n.get(e.id)??[],t]));for(let[e,r]of n)e&&r.length>1&&t.push({id:`id-${e}`,tone:`warning`,text:`${r.length} scripts use the name “${e}”. Give each its own, so changes and page rules apply to the right one.`,scripts:r});let r=new Map;e.scripts.forEach((e,t)=>{if(!e.enabled)return;let n=we(e);if(!n)return;let i=`${e.kind}\n${n}`;r.set(i,[...r.get(i)??[],t])});for(let[n,i]of r){if(i.length<2)continue;let r=e.scripts[i[0]],a=n.split(`
|
|
2
2
|
`)[1]??``;t.push({id:`tag-${n}`,tone:`warning`,text:`${r?H(r):`This script`} is installed ${i.length} times with ${a}. Visits would be counted more than once — switch one off.`,scripts:i})}let i=e.scripts.flatMap((e,t)=>e.enabled&&e.kind===`ga4`?[t]:[]),a=e.scripts.flatMap((e,t)=>e.enabled&&e.kind===`gtm`?[t]:[]);if(i.length>0&&a.length>0&&t.push({id:`ga4-in-gtm`,tone:`info`,text:`Google Analytics is often set up inside the Tag Manager container too. If yours is, page views are counted twice — keep it in one place.`,scripts:[...i,...a]}),(e.consent?.mode??`none`)===`none`){let n=e.scripts.flatMap((e,t)=>{let n=J(e);return e.enabled&&(n===`analytics`||n===`marketing`)?[t]:[]});n.length>0&&t.push({id:`no-consent`,tone:`warning`,text:`Analytics and marketing scripts load without asking, because consent is off. In many countries visitors must agree before these load.`,scripts:n})}return t}function Q(e){let t=e.trim(),n=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i.exec(t);return n&&(t=t.slice(n[0].length)),t=t.split(/[?#]/)[0]??``,t.startsWith(`/`)||(t=`/${t}`),t=t.replace(/\/{2,}/g,`/`),t.length>1&&(t=t.replace(/\/+$/,``)),t}function Fe(e){let t=``,n=e.trim();n.startsWith(`/`)||(n=`/${n}`),n=n.replace(/\/+$/,``);for(let e=0;e<n.length;e+=1){let r=n[e];r===`*`&&n[e+1]===`*`?(t.endsWith(`/`)?t=`${t.slice(0,-1)}(?:/.*)?`:t+=`.*`,e+=1):t+=r===`*`?`[^/]*`:r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/g,`\\$&`)}return RegExp(`^${t}/?$`)}function Ie(e,t){let n=Q(t);return Fe(e).test(n)||e.trim().replace(/\/+$/,``)===``&&n===`/`}function Le(e,t){let n=e.include??[],r=(e.exclude??[]).find(e=>Ie(e,t));if(r)return{loads:!1,because:{list:`exclude`,pattern:r}};if(n.length===0)return{loads:!0};let i=n.find(e=>Ie(e,t));return i?{loads:!0,because:{list:`include`,pattern:i}}:{loads:!1}}function Re(e){return(e.include??[]).length>0?`only`:(e.exclude??[]).length>0?`except`:`everywhere`}function ze(e){let t=Re(e),n=e=>(e??[]).map(e=>e.trim()||`/`).join(`, `);return t===`only`?`Only ${n(e.include)}${(e.exclude??[]).length?`, not ${n(e.exclude)}`:``}`:t===`except`?`Every page except ${n(e.exclude)}`:`Every page`}var Be=[{value:`everywhere`,label:`Every page`},{value:`only`,label:`Only these`},{value:`except`,label:`All except`}];function Ve({entry:e}){let[t,n]=(0,B.useState)(``),r=t.trim()?Le(e,t):null;return(0,X.jsxs)(g,{label:`Try an address`,hint:r?void 0:`Type a page address to see whether this script loads there.`,children:[(0,X.jsx)(c,{mono:!0,size:`sm`,placeholder:`/pricing/teams/`,value:t,onChange:e=>n(e.target.value)}),r?(0,X.jsxs)(`p`,{className:r.loads?`kit-verdict kit-verdict--yes`:`kit-verdict kit-verdict--no`,role:`status`,children:[r.loads?`Loads here`:`Doesn’t load here`,r.because?` — matches ${r.because.pattern}`:r.loads?` — it loads on every page`:` — no pattern matches`]}):null]})}function He({index:e,entry:t}){let n=j(),r=Re(t),[i,a]=(0,B.useState)(null),o=r===`everywhere`&&i?i:r,s=o===`except`?`exclude`:`include`,u=(o===`except`?t.exclude:t.include)??[],d=[`scripts`,e,s],f=r=>{if(a(r),r===o)return;let i=u.filter(e=>e.trim());if(r===`everywhere`){n.apply(...t.include?[{op:`unset`,path:[`scripts`,e,`include`]}]:[],...t.exclude?[{op:`unset`,path:[`scripts`,e,`exclude`]}]:[]);return}if(i.length===0)return;let c=r===`except`?`exclude`:`include`;n.apply({op:`unset`,path:[`scripts`,e,s]},{op:`set`,path:[`scripts`,e,c],value:i})},p=u.length>0?u:o===`everywhere`?[]:[``];return(0,X.jsxs)(`div`,{className:`kit-insp__group`,children:[(0,X.jsx)(g,{label:`Pages`,group:!0,children:(0,X.jsx)(l,{label:`Pages`,options:Be,value:o,onChange:f})}),o===`everywhere`?null:(0,X.jsxs)(g,{label:o===`only`?`Load only on`:`Don’t load on`,group:!0,hint:`A page address per line. * stands for one part of the address (/blog/*), ** for any number (/docs/**).`,children:[(0,X.jsx)(`ul`,{className:`kit-patterns`,children:p.map((e,t)=>(0,X.jsxs)(`li`,{className:`kit-pattern`,children:[(0,X.jsx)(c,{mono:!0,size:`sm`,"aria-label":`Page pattern ${t+1}`,placeholder:`/pricing/*`,value:e,onChange:e=>{let r=e.target.value;u.length===0?n.type(d,r?[r]:void 0):n.type([...d,t],r,!0)},onBlur:e=>{e.target.value.trim()===``&&u.length>0?n.apply(u.length===1?{op:`unset`,path:d}:{op:`remove`,path:d,index:t}):(n.commit(d),n.commit([...d,t]))}}),u.length>0?(0,X.jsx)(v,{icon:`close`,label:`Remove ${e||`pattern`}`,onClick:()=>n.apply(u.length===1?{op:`unset`,path:d}:{op:`remove`,path:d,index:t})}):null]},t))}),u.length>0?(0,X.jsx)(b,{size:`sm`,variant:`secondary`,icon:`plus`,onClick:()=>n.apply({op:`insert`,path:d,index:u.length,value:``}),children:`Add an address`}):null]}),(0,X.jsx)(Ve,{entry:t})]})}var Ue=[`necessary`,`analytics`,`marketing`,`preferences`];function We({index:t,entry:n}){let r=j(),i=I(),a=V(n.kind),o=(...e)=>[`scripts`,t,...e],s=Y(n),c=J(n),u=n.kind===`custom`,d=M(n.settings.inline).trim()!==``,f=(a?.settings??[]).filter(e=>!(u&&e.key===`inline`&&!i));return(0,X.jsxs)(`div`,{className:`kit-script-detail`,children:[(0,X.jsxs)(`div`,{className:`kit-script-detail__col`,children:[(0,X.jsx)(P,{path:o(`label`),label:`Name in this app`,placeholder:a?.name??n.kind}),f.length>0?(0,X.jsx)(de,{path:o(`settings`),specs:f,values:n.settings}):(0,X.jsx)(`p`,{className:`g-hint`,children:`This kind of script isn’t in the catalogue; its settings stay as they are in the file.`}),u&&!i?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note`,children:[(0,X.jsx)(e,{kind:`reg`}),(0,X.jsx)(`span`,{children:d?`This script runs code written into the site. It can only be changed where build mode is allowed.`:`Custom code can only be added on sites where build mode is allowed. A script address works everywhere.`})]}):null,a?.docsUrl?(0,X.jsxs)(`a`,{className:`g-link`,href:a.docsUrl,target:`_blank`,rel:`noreferrer`,children:[`Where to find these in `,a.name]}):null,(0,X.jsx)(P,{path:o(`note`),label:`Note for colleagues`,multiline:!0,placeholder:`Who asked for it and why — “added for the spring campaign, ask before removing”`})]}),(0,X.jsxs)(`div`,{className:`kit-script-detail__col`,children:[(0,X.jsx)(He,{index:t,entry:n}),(0,X.jsx)(g,{label:`When it loads`,group:!0,hint:W[s].line,children:(0,X.jsx)(l,{label:`When it loads`,options:Object.keys(W).map(e=>({value:e,label:W[e].label})),value:s,onChange:e=>r.choose(o(`load`),e)})}),(0,X.jsx)(g,{label:`Consent`,group:!0,hint:G[c].line,children:(0,X.jsx)(l,{label:`Consent`,options:Ue.map(e=>({value:e,label:G[e].label})),value:c,onChange:e=>r.choose(o(`consent`),e)})}),(0,X.jsx)(g,{label:`Where in the page`,children:(0,X.jsx)(_,{value:n.placement??a?.defaultPlacement??`head`,options:Object.keys(K).map(e=>({value:e,label:K[e]})),onChange:e=>r.choose(o(`placement`),e)})}),(0,X.jsx)(F,{path:o(`inPreview`),label:`Also load in preview and development`,description:`Off by default, so your own testing isn’t counted as visits or sent to your ad accounts.`})]})]})}function Ge({index:t}){let n=[`scripts`,t],r=pe(n),i=he(n);return r===0?null:(0,X.jsxs)(`span`,{className:`g-field__state`,children:[(0,X.jsx)(e,{kind:`caret`}),i===`added`?`New`:`Edited`]})}var Ke=(0,B.memo)(function({index:t,total:n,open:r,warned:i,drag:a,onToggle:o,onMove:s,onRemove:c}){let l=me([`scripts`,t]),d=j(),p=ne(),h=(0,B.useRef)(null),g=S(l);if(!g)return null;let _=H(g),y=we(g),b=J(g),x=e=>{if(!e.altKey||e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;e.preventDefault();let r=t+(e.key===`ArrowUp`?-1:1);r>=0&&r<n&&s(t,r)};return(0,X.jsxs)(`section`,{ref:h,className:m(`g-block kit-script`,!g.enabled&&`kit-script--off`,p.has(`script:${g.id}`)&&`kit-script--flash`,i&&`kit-script--warned`),"aria-label":_,...a.card(t),children:[(0,X.jsxs)(`div`,{className:`kit-script__row`,onKeyDown:x,children:[(0,X.jsx)(`span`,{className:`kit-dest__grip`,"aria-hidden":`true`,title:`Drag to change the order`,...a.grip(t,()=>h.current),children:(0,X.jsx)(fe,{name:`grip`})}),(0,X.jsx)(N,{text:Ee(g.kind)}),(0,X.jsxs)(`button`,{type:`button`,className:`kit-script__open`,"aria-expanded":r,onClick:()=>o(t),"aria-keyshortcuts":`Alt+ArrowUp Alt+ArrowDown`,children:[(0,X.jsx)(e,{kind:`chevron`,className:m(`app-card__chevron`,!r&&`app-card__chevron--closed`)}),(0,X.jsxs)(`span`,{className:`kit-script__titles`,children:[(0,X.jsx)(`span`,{className:`kit-script__name`,children:_}),(0,X.jsx)(`span`,{className:`kit-script__id g-mono`,children:y??(g.kind===`custom`?`Code written into the page`:V(g.kind)?`Not set up yet`:ce(g.kind))})]}),(0,X.jsxs)(`span`,{className:`g-sr`,children:[`, script `,t+1,` of `,n,`. Alt and arrow keys move it.`]})]}),(0,X.jsxs)(`span`,{className:`kit-script__facts`,children:[(0,X.jsx)(`span`,{children:ze(g)}),(0,X.jsx)(`span`,{children:W[Y(g)].label}),(0,X.jsx)(f,{tone:b===`necessary`?`neutral`:`info`,mark:null,children:G[b].label})]}),(0,X.jsx)(Ge,{index:t}),(0,X.jsx)(`span`,{className:`kit-script__switch`,children:(0,X.jsx)(u,{checked:g.enabled,"aria-label":g.enabled?`${_} is on`:`${_} is off`,onChange:e=>d.choose([`scripts`,t,`enabled`],e)})}),(0,X.jsxs)(`span`,{className:`kit-dest__tools`,children:[(0,X.jsx)(R,{icon:`arrow-up`,label:`Move ${_} up`,disabled:t===0,onClick:()=>s(t,t-1)}),(0,X.jsx)(R,{icon:`arrow-down`,label:`Move ${_} down`,disabled:t===n-1,onClick:()=>s(t,t+1)}),(0,X.jsx)(v,{icon:`trash`,label:`Remove ${_}`,onClick:()=>c(t)})]})]}),g.note&&!r?(0,X.jsx)(`p`,{className:`kit-script__note`,children:g.note}):null,r?(0,X.jsx)(`div`,{className:`g-block__body`,children:(0,X.jsx)(We,{index:t,entry:g})}):null]})});function qe(e,t){return e===`necessary`||(t?.mode??`none`)===`none`?!1:!(t?.defaults??[]).includes(e)}function Je(e,t){let n=J(e);return qe(n,t)?`Waits until ${t?.mode===`external`?`your consent tool`:`the visitor`} allows ${n}`:null}function Ye(e,t,n={}){let r=[],i=[];return e.scripts.forEach((a,o)=>{let s=H(a);if(!a.enabled)return void i.push({index:o,name:s,reason:`Switched off`});if(n.preview&&!a.inPreview)return void i.push({index:o,name:s,reason:`Not loaded in preview`});let c=Le(a,t);if(c.loads)r.push({index:o,id:a.id,name:s,load:Y(a),consent:J(a),waitsFor:Je(a,e.consent)});else{let e=c.because?`Not on pages matching ${c.because.pattern}`:`Only on ${(a.include??[]).join(`, `)}`;i.push({index:o,name:s,reason:e})}}),{loads:r,skipped:i}}function Xe({config:e,suggestions:t}){let[n,r]=(0,B.useState)(`/`),i=(0,B.useMemo)(()=>Ye(e,n||`/`),[e,n]),a=Q(n||`/`);return(0,X.jsxs)(`section`,{className:`g-block kit-where`,"aria-labelledby":`where-title`,children:[(0,X.jsx)(`header`,{className:`g-block__head`,children:(0,X.jsx)(`h2`,{id:`where-title`,className:`kit-tab-head__title`,children:`What loads where`})}),(0,X.jsxs)(`div`,{className:`g-block__body`,children:[(0,X.jsx)(g,{label:`Page address`,children:(0,X.jsx)(c,{mono:!0,value:n,onChange:e=>r(e.target.value),placeholder:`/pricing/`})}),t.length?(0,X.jsx)(`div`,{className:`kit-where__chips`,children:t.map(e=>(0,X.jsx)(`button`,{type:`button`,className:`g-chip`,onClick:()=>r(e),"aria-pressed":Q(e)===a,children:e},e))}):null,(0,X.jsxs)(`div`,{role:`status`,"aria-live":`polite`,children:[i.loads.length===0?(0,X.jsxs)(`p`,{className:`g-hint`,children:[`No scripts load on `,a,`.`]}):(0,X.jsx)(`ol`,{className:`kit-where__list`,children:i.loads.map(e=>(0,X.jsxs)(`li`,{className:`kit-where__item`,children:[(0,X.jsx)(`span`,{className:`kit-where__name`,children:e.name}),(0,X.jsxs)(`span`,{className:`kit-where__facts`,children:[W[e.load].label,e.waitsFor?` · ${e.waitsFor}`:` · No agreement needed`]})]},e.index))}),i.skipped.length>0?(0,X.jsxs)(`details`,{className:`app-details`,children:[(0,X.jsxs)(`summary`,{children:[`Not loaded here (`,i.skipped.length,`)`]}),(0,X.jsx)(`ul`,{className:`kit-where__skipped`,children:i.skipped.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`b`,{children:e.name}),` `,(0,X.jsx)(`span`,{className:`g-muted`,children:e.reason})]},e.index))})]}):null]})]})]})}var $=[`scripts`],Ze=[`Add GA4 with ID G-ABC123 and only load it after consent`,`Turn on the built-in consent banner with Consent Mode`,`Load the chat widget only on /support/**`];function Qe({open:e,setOpen:t,onAdd:n,warned:r}){let i=j(),a=me($),s=Array.isArray(a)?a:[],c=te(),l=(0,B.useRef)(null),u=(n,r)=>{let a=xe($,s.length,n,r);a&&(i.apply(...a.ops),e.has(n)&&t(new Set([...e].filter(e=>e!==n).concat(r))))},d=le(l,u),f=e=>{let n=be($,s,e),r=c.scripts[e];n&&r&&(i.apply(...n.ops),t(new Set),y({tone:`neutral`,title:`${H(r)} removed`,body:`It stops loading on the site when you publish. Undo puts it back where it was.`,action:{label:`Undo`,onClick:()=>i.apply(...n.undo)},duration:1e4}))},p=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)};return s.length===0?(0,X.jsx)(o,{compact:!0,title:`No scripts yet.`,body:`Add analytics, a tag manager, ad tracking or a chat widget. Nothing loads until you publish.`,actions:(0,X.jsx)(b,{variant:`primary`,icon:`plus`,onClick:n,children:`Add a script`})}):(0,X.jsx)(`div`,{className:`kit-scripts`,ref:l,children:s.map((t,n)=>(0,X.jsx)(Ke,{index:n,total:s.length,open:e.has(n),warned:r.has(n),drag:d,onToggle:p,onMove:u,onRemove:f},n))})}function $e({siteId:t,entry:n}){let r=z(e=>e.detail?.name??`Site`),i=z(e=>e.detail?.model.collections.find(e=>e.id===`pages`)?.url??null);L({crumbs:[{label:r,to:`/sites/${t}`},{label:`Scripts`}],...n.status===`modified`?{tag:{label:`Edited`,tone:`change`}}:n.status===`added`?{tag:{label:`New`,tone:`insert`}}:{}});let a=te(),o=j(),s=I(),c=z(e=>e.detail?.model),l=ve(e=>e.outside),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(()=>new Set),m=(0,B.useMemo)(()=>Pe(a),[a]),h=(0,B.useMemo)(()=>new Set(m.filter(e=>e.tone===`warning`&&e.id!==`no-consent`).flatMap(e=>e.scripts)),[m]),g=(0,B.useMemo)(()=>{let e=a.scripts.flatMap(e=>[...e.include??[],...e.exclude??[]]).map(e=>e.replace(/\*\*?/g,`example`).replace(/\?/g,`x`));return[...new Set([`/`,i?i.replace(`{slug}`,`about`):`/about/`,...e])].slice(0,6)},[a.scripts,i]),_=e=>{let t=a.scripts.length;o.apply(ye($,t,D(e))),p(new Set([t]))},v=m.some(e=>e.id===`no-consent`);return(0,X.jsxs)(`div`,{className:`app-screen kit-scripts-screen`,children:[(0,X.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide`,children:[(0,X.jsx)(x,{eyebrow:`Site`,title:`Scripts`,description:`Analytics, tags and widgets the site loads. Adding or changing one is powerful, so every change waits in Proof like any other until you publish.`,actions:(0,X.jsx)(b,{variant:`primary`,icon:`plus`,onClick:()=>d(!0),children:`Add a script`})}),(0,X.jsx)(w,{subject:`scripts`,context:`About the scripts setup in ${n.path}:`,examples:Ze,placeholder:`Add GA4 with ID G-… and only load it after consent`}),(0,X.jsx)(O,{step:`layout`}),(0,X.jsx)(_e,{fields:n.fields,noun:Ce(c,n.collection)}),(0,X.jsx)(ge,{}),l?(0,X.jsxs)(`p`,{className:`g-margin-note kit-note`,role:`status`,children:[(0,X.jsx)(e,{kind:`transpose`}),(0,X.jsx)(`span`,{children:l.origin===`agent`?`The assistant changed the scripts. What it changed is marked for a moment.`:`The scripts setup changed outside the app. This shows the latest version.`})]},l.at):null,m.filter(e=>e.id!==`no-consent`).map(t=>(0,X.jsxs)(`p`,{className:t.tone===`warning`?`g-margin-note kit-note kit-note--warning`:`g-margin-note kit-note`,role:`status`,children:[(0,X.jsx)(e,{kind:t.tone===`warning`?`bang`:`pilcrow`}),(0,X.jsx)(`span`,{children:t.text})]},t.id)),(0,X.jsxs)(`div`,{className:`kit-scripts-layout`,children:[(0,X.jsxs)(`section`,{className:`kit-scripts-layout__main`,"aria-labelledby":`installed-title`,children:[(0,X.jsx)(`h2`,{id:`installed-title`,className:`kit-tab-head__title`,children:`Installed`}),(0,X.jsx)(Qe,{open:f,setOpen:p,onAdd:()=>d(!0),warned:h})]}),(0,X.jsxs)(`div`,{className:`kit-scripts-layout__side`,children:[(0,X.jsx)(Ne,{config:a,trackingWithoutConsent:v}),(0,X.jsx)(Xe,{config:a,suggestions:g})]})]})]}),(0,X.jsx)(Oe,{open:u,onClose:()=>d(!1),taken:a.scripts.map(e=>e.id),allowBuild:s,onAdd:_})]})}function et({siteId:e,siteName:t}){return L({crumbs:[{label:t,to:`/sites/${e}`},{label:`Scripts`}]}),null}function tt(){let{siteId:e=``}=n(),t=z(e=>e.detail),r=t?.name??`Site`,i=t&&t.id===e?Se(t.model):null,o=E(e,i?.path??null),s;if(!t||t.id!==e||i&&o.loading)s=(0,X.jsx)(`div`,{className:`app-screen`,"aria-busy":`true`,children:(0,X.jsxs)(`div`,{className:`app-screen__inner`,children:[(0,X.jsx)(p,{width:120,height:12}),(0,X.jsx)(p,{width:240,height:28,style:{marginBlock:`var(--space-3) var(--space-6)`}}),(0,X.jsx)(p,{lines:5,height:14})]})});else if(!i)s=(0,X.jsx)(`div`,{className:`app-screen`,children:(0,X.jsxs)(`div`,{className:`app-screen__inner`,children:[(0,X.jsx)(x,{eyebrow:`Site`,title:`Scripts`}),(0,X.jsx)(k,{feature:`scripts`})]})});else if(!o.data)s=(0,X.jsx)(`div`,{className:`app-screen app-screen--center`,children:(0,X.jsx)(a,{title:`Couldn’t open the scripts setup`,error:o.error,onRetry:()=>void o.refetch()})});else return(0,X.jsx)(C,{siteId:e,entry:o.data,marksFor:T,children:(0,X.jsxs)(`div`,{className:`kit-screen`,children:[(0,X.jsx)($e,{siteId:e,entry:o.data}),(0,X.jsx)(A,{siteId:e,entryPath:o.data.path})]})},o.data.path);return(0,X.jsxs)(`div`,{className:`kit-screen`,children:[(0,X.jsx)(et,{siteId:e,siteName:r}),s,(0,X.jsx)(A,{siteId:e})]})}export{tt as ScriptsScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,At as t,E as n,Ft as r,I as i,N as a,Nt as o,Q as s,St as c,at as l,bt as u,c as d,ft as f,g as p,ht as m,it as h,kt as g,lt as _,nt as v,ot as y,pt as b,st as x,vt as S,z as C}from"./ui-C6O2tW4c.js";import{n as w,s as T}from"./chrome-Brnq5kGb.js";import{f as E}from"./changes-BtRtvJ12.js";import{n as D,t as O}from"./PreviewControls-Du87hOEG.js";import{B as k,R as A,z as j}from"./index-
|
|
1
|
+
import{$ as e,At as t,E as n,Ft as r,I as i,N as a,Nt as o,Q as s,St as c,at as l,bt as u,c as d,ft as f,g as p,ht as m,it as h,kt as g,lt as _,nt as v,ot as y,pt as b,st as x,vt as S,z as C}from"./ui-C6O2tW4c.js";import{n as w,s as T}from"./chrome-Brnq5kGb.js";import{f as E}from"./changes-BtRtvJ12.js";import{n as D,t as O}from"./PreviewControls-Du87hOEG.js";import{B as k,R as A,z as j}from"./index-A7aTfJ-x.js";import{t as M}from"./changes-DLBkrfUR.js";import{r as N,t as P}from"./site-DJUEXLHW.js";import{OnlineCard as F}from"./Online-CFMXFfKL.js";var I=r(o(),1),L=u(),R={added:{label:`New`,tone:`insert`},modified:{label:`Edited`,tone:`change`},deleted:{label:`Deleted`,tone:`delete`}};function z({change:e,actions:t,current:n}){let r=R[e.status];return(0,L.jsxs)(`div`,{className:`g-file app-file`,role:`listitem`,"aria-current":n||void 0,children:[(0,L.jsx)(d,{tone:r.tone,children:r.label}),(0,L.jsxs)(`div`,{className:`g-file__main`,children:[(0,L.jsx)(`span`,{className:`g-file__title`,children:e.title??(e.kind===`media`?y(e.path):x(e.path))}),(0,L.jsxs)(`span`,{className:`g-file__path`,children:[l(e.path),(0,L.jsx)(`b`,{children:y(e.path)}),e.media?` · ${_(e.media)}`:null,e.summary?(0,L.jsxs)(`span`,{className:`app-file__summary`,children:[` · `,e.summary]}):null]})]}),e.binary?(0,L.jsx)(`span`,{className:`g-tally`,children:(0,L.jsx)(`span`,{className:`g-tally__chg`,children:`image`})}):(0,L.jsx)(s,{additions:e.additions,deletions:e.deletions}),t?(0,L.jsx)(`div`,{className:`app-file__actions`,children:t}):(0,L.jsx)(`span`,{})]})}function B({siteId:e}){let t=g(),[r,i]=(0,I.useState)(``),a=n=>{n?.preventDefault();let i=r.trim();t(`/sites/${e}/edit${i?`?ask=${encodeURIComponent(i)}`:``}`)};return(0,L.jsxs)(`form`,{className:`app-ask`,onSubmit:a,children:[(0,L.jsx)(`label`,{className:`app-ask__label`,htmlFor:`home-ask`,children:`What would you like to change?`}),(0,L.jsxs)(`div`,{className:`g-composer`,children:[(0,L.jsx)(`textarea`,{id:`home-ask`,rows:2,placeholder:`Ask for a change… “Add a team member called Sam”, “Shorten the home page heading”`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&a()}}),(0,L.jsx)(`button`,{className:`g-btn g-btn--primary g-btn--icon g-btn--sm`,type:`submit`,"aria-label":`Ask the assistant`,children:(0,L.jsx)(`span`,{className:`g-mark g-mark--send`,"aria-hidden":`true`})}),(0,L.jsxs)(`div`,{className:`g-composer__foot`,children:[(0,L.jsx)(n,{keys:[`enter`]}),` opens the editor with your request · nothing changes until you publish`]})]})]})}function V({title:e,action:t,children:n,id:r}){return(0,L.jsxs)(`section`,{className:`app-section`,"aria-labelledby":r,children:[(0,L.jsxs)(`div`,{className:`app-section__head`,children:[(0,L.jsx)(`h2`,{className:`app-section__title`,id:r,children:e}),t]}),n]})}function H({siteId:e}){let{changes:t,status:n,error:r,refresh:o}=M(),s=g(),l=t?.files??[];return(0,L.jsx)(V,{id:`home-pending`,title:`Waiting to publish`,action:l.length>0?(0,L.jsx)(b,{size:`sm`,variant:`secondary`,icon:`proof`,onClick:()=>s(`/sites/${e}/proof`),children:`Review changes`}):null,children:n===`error`&&!t?(0,L.jsx)(i,{compact:!0,title:`Couldn’t check for changes`,error:r,onRetry:()=>void o()}):t?l.length===0?(0,L.jsx)(`div`,{className:`app-card app-card--quiet`,children:(0,L.jsx)(a,{compact:!0,mark:`reg`,title:`Nothing to publish.`,body:`Everything here already matches the live site. Changes you make wait here until you publish.`})}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`p`,{className:`app-section__lede`,children:[h(l.length,`page or image`,`pages and images`),` changed since the last publish`,E(l)?` — ${E(l)}`:``,`.`]}),(0,L.jsx)(`div`,{className:`app-card`,role:`list`,children:l.slice(0,5).map(t=>(0,L.jsx)(z,{change:t,actions:t.kind===`content`&&t.status!==`deleted`?(0,L.jsx)(c,{className:m(`quiet`,`sm`),to:`/sites/${e}/edit?path=${encodeURIComponent(t.path)}`,children:`Open`}):void 0},t.path))}),l.length>5?(0,L.jsxs)(c,{className:`g-link app-section__more`,to:`/sites/${e}/proof`,children:[`And `,h(l.length-5,`more change`),` in Proof`]}):null]}):(0,L.jsx)(`div`,{className:`app-card`,"aria-busy":`true`,children:[0,1].map(e=>(0,L.jsxs)(`div`,{className:`g-file`,"aria-hidden":`true`,children:[(0,L.jsx)(p,{width:54,height:20,pill:!0}),(0,L.jsx)(p,{width:180,height:12}),(0,L.jsx)(p,{width:40,height:12}),(0,L.jsx)(`span`,{})]},e))})})}function U({siteId:e}){let t=T(k.history(e,4),()=>C(`GET /api/sites/:siteId/history`,{params:{siteId:e},query:{limit:4}})),n=t.data?.items??[];return(0,L.jsx)(V,{id:`home-history`,title:`Recently published`,action:(0,L.jsx)(c,{className:m(`quiet`,`sm`),to:`/sites/${e}/history`,children:`Version history`}),children:t.loading?(0,L.jsx)(`ul`,{className:`app-timeline`,"aria-busy":`true`,children:[0,1,2].map(e=>(0,L.jsxs)(`li`,{className:`app-timeline__item`,children:[(0,L.jsx)(p,{width:220-e*30,height:14}),(0,L.jsx)(p,{width:120,height:11})]},e))}):t.status===`error`&&!t.data?(0,L.jsx)(i,{compact:!0,title:`Couldn’t load recent versions`,error:t.error,onRetry:()=>void t.refetch()}):n.length===0?(0,L.jsx)(`p`,{className:`g-hint`,children:`Nothing published yet. Each publish appears here.`}):(0,L.jsx)(`ul`,{className:`app-timeline`,children:n.map(e=>(0,L.jsxs)(`li`,{className:`app-timeline__item`,children:[(0,L.jsx)(`span`,{className:`app-timeline__message`,children:e.message}),(0,L.jsxs)(`span`,{className:`app-timeline__meta`,children:[e.author,` · `,f(e.date),e.viaGalley?(0,L.jsx)(`span`,{className:`g-sr`,children:` · published from this app`}):null]})]},e.commit))})})}function W({siteId:e}){let t=N(e);return(0,L.jsx)(V,{id:`home-preview`,title:`Preview`,action:(0,L.jsx)(D,{siteId:e}),children:(0,L.jsxs)(`div`,{className:`app-card app-card--pad app-preview-card`,children:[(0,L.jsx)(`p`,{className:`app-preview-card__text`,children:t?.state===`ready`?`Your site is running with your changes, so the editor can show every page as visitors will see it.`:t?.state===`error`?t.detail??`The preview stopped. The site’s own build reported a problem.`:t?.state===`starting`||t?.state===`installing`?t.detail??`Starting the site’s own dev server…`:`The preview runs your site with your changes. It starts when you open the editor, or now.`}),t?.baselineSource?(0,L.jsxs)(`p`,{className:`g-hint`,children:[`Compared against the `,t.baselineSource===`staging`?`staging site`:`live site`,`.`]}):null,(0,L.jsxs)(`div`,{className:`app-preview-card__actions`,children:[(0,L.jsx)(O,{siteId:e}),t?.state===`ready`&&t.url?(0,L.jsxs)(`a`,{className:m(`quiet`,`sm`),href:t.url,target:`_blank`,rel:`noreferrer`,children:[(0,L.jsx)(S,{name:`external`}),`Open in a new tab`]}):null]})]})})}function G(){let{siteId:n=``}=t(),r=P(e=>e.detail);if(w({crumbs:[{label:r?.name??`Site`},{label:`Site home`}]}),!r)return(0,L.jsx)(`div`,{className:`app-screen`,"aria-busy":`true`,children:(0,L.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide`,children:[(0,L.jsx)(p,{width:90,height:12}),(0,L.jsx)(p,{width:260,height:30,style:{marginBlock:`var(--space-3) var(--space-8)`}}),(0,L.jsx)(p,{height:96})]})});let{model:i}=r,a=j(i),o=i.framework.version?`${i.framework.name} ${i.framework.version}`:i.framework.name,s=a.filter(e=>e.kind===`entries`).reduce((e,t)=>e+t.count,0);return(0,L.jsx)(`div`,{className:`app-screen`,children:(0,L.jsxs)(`div`,{className:`app-screen__inner app-screen__inner--wide app-home`,children:[(0,L.jsxs)(`header`,{className:`app-home__head`,children:[(0,L.jsxs)(`p`,{className:`g-eyebrow`,children:[o,` site`]}),(0,L.jsx)(`h1`,{className:`app-home__title`,children:r.name}),(0,L.jsxs)(`p`,{className:`app-home__lede`,children:[h(a.length,`collection`),` and `,h(s,`page`),` ready to edit.`,r.git.hasRemote?null:` Its versions are kept on this computer only — not backed up or shared anywhere yet.`]})]}),(0,L.jsx)(B,{siteId:n}),(0,L.jsxs)(`div`,{className:`app-home__grid`,children:[(0,L.jsxs)(`div`,{className:`app-home__main`,children:[(0,L.jsx)(H,{siteId:n}),(0,L.jsxs)(V,{id:`home-found`,title:`What’s on this site`,children:[(0,L.jsx)(`ul`,{className:`app-collections`,children:a.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(c,{className:`app-collection-row`,to:`/sites/${n}/c/${encodeURIComponent(e.id)}`,children:[(0,L.jsx)(S,{name:A(e)}),(0,L.jsx)(`span`,{className:`app-collection-row__label`,children:e.label}),(0,L.jsx)(`span`,{className:`app-collection-row__path g-mono`,children:e.path}),(0,L.jsx)(`span`,{className:`app-collection-row__count`,children:e.kind===`entries`?h(e.count,e.singular,v(e).many):(0,L.jsx)(d,{mark:null,children:`Settings file`})}),(0,L.jsx)(S,{name:`chevron-right`,className:`app-collection-row__go`})]})},e.id))}),i.notes.length>0?(0,L.jsxs)(`details`,{className:`app-details app-notes`,children:[(0,L.jsx)(`summary`,{children:`How this site was read`}),(0,L.jsx)(`ul`,{children:i.notes.map(t=>(0,L.jsxs)(`li`,{className:`g-margin-note`,children:[(0,L.jsx)(e,{kind:`stet`}),(0,L.jsx)(`span`,{children:t})]},t))})]}):null]})]}),(0,L.jsxs)(`div`,{className:`app-home__side`,children:[(0,L.jsx)(V,{id:`home-online`,title:`Online`,children:(0,L.jsx)(F,{siteId:n})}),(0,L.jsx)(V,{id:`home-import`,title:`Moving from WordPress?`,children:(0,L.jsxs)(`div`,{className:`app-card app-card--pad app-preview-card`,children:[(0,L.jsx)(`p`,{className:`app-preview-card__text`,children:`Bring its posts, pages, images and SEO details here, as changes you check before anything goes live.`}),(0,L.jsx)(`div`,{className:`app-preview-card__actions`,children:(0,L.jsx)(c,{className:m(`secondary`,`sm`),to:`/sites/${n}/import`,children:`Bring your WordPress site`})})]})}),(0,L.jsx)(W,{siteId:n}),(0,L.jsx)(U,{siteId:n})]})]})]})})}export{G as SiteHomeScreen};
|