GA4: Consent Mode signals, and ad_conversions for Google ads #41

Merged
jcoffey-dev merged 1 commits from feature/ga4-ad-conversions into main 2026-10-25 07:07:12 +00:00
11 changed files with 93 additions and 12 deletions

No files matched your search

+15
View File
@@ -32,6 +32,21 @@ strict Content-Security-Policy still holds.
check -csp` includes them in the policy it prints, and so do container
images built with `csp: true`.
**Google ads:** with GA4, `ad_conversions: true` also measures the site's
Google Ads campaigns, for visitors who accept: whether a visit from one of the
ads went on to sign up or buy. The banner says so, the privacy notice gets a
line for it, and the policy from `check -csp` adds Google's ad hosts.
```yaml
analytics: { provider: ga4, id: G-XXXXXXX, ad_conversions: true }
```
GA4 is always told what the visitor agreed to (Google's Consent Mode), so
what it learns from visitors in the EEA and the UK isn't thrown away:
statistics granted, ad personalization denied, and ad measurement granted
only with `ad_conversions: true`. It needs consent, so it can't be combined
with `gated: false`.
**Counting without asking** needs `gated: false` in `analytics:`. That's a
choice written into `site.yaml` where a reviewer sees it. The privacy notice
says so, and `check` warns (`analytics-ungated`) on every build.
+8 -1
View File
@@ -83,10 +83,17 @@ export function PrivacyView({ id, branch }: { id: string; branch?: string }) {
{an?.provider === 'ga4' && field('id', 'Measurement ID', 'G-XXXXXXX')}
{an && (
<label className="check field">
<input type="checkbox" checked={gated} disabled={!info.canWrite} onChange={(e) => setAn({ ...an, gated: e.target.checked ? undefined : false })} />
<input type="checkbox" checked={gated} disabled={!info.canWrite} onChange={(e) => setAn({ ...an, gated: e.target.checked ? undefined : false, adConversions: e.target.checked ? an.adConversions : undefined })} />
Ask visitors first (recommended)
</label>
)}
{an?.provider === 'ga4' && gated && (
<label className="check field">
<input type="checkbox" checked={!!an.adConversions} disabled={!info.canWrite} onChange={(e) => setAn({ ...an, adConversions: e.target.checked || undefined })} />
Also measure the site's Google ads
<span className="muted small">For visitors who accept: whether a visit from one of your ads went on to sign up or buy. The banner and the privacy notice say so. Ad personalization stays off.</span>
</label>
)}
{an && gated && <p className="muted small">A banner asks on the first visit, with Decline first and as prominent as Accept. Nothing is counted until someone accepts; declining later removes the counter's cookies.</p>}
{an && !gated && <p className="notice warn small">Statistics will start on page view, without asking. That's recorded in site.yaml (gated: false), the privacy notice says so, and every check warns about it. In much of the world, counting with cookies needs consent.</p>}
</fieldset>
+1 -1
View File
@@ -31,7 +31,7 @@ export type LookValue = string | { light?: string; dark?: string }
export type LookInfo = { look: LookFile | null; values: Record<string, LookValue>; branch: string; commit: string; canWrite: boolean; minContrast: number }
export type FileInfo = { path: string; size: number; text: boolean }
export type Commit = { sha: string; author: string; when: string; subject: string }
export type Analytics = { provider: 'plausible' | 'matomo' | 'ga4'; domain?: string; src?: string; url?: string; siteId?: string; id?: string; gated?: boolean }
export type Analytics = { provider: 'plausible' | 'matomo' | 'ga4'; domain?: string; src?: string; url?: string; siteId?: string; id?: string; gated?: boolean; adConversions?: boolean }
export type FormField = { name: string; type?: string; label?: string; help?: string; placeholder?: string; required?: boolean; max?: number; options?: string[] }
export type FormDef = { name?: string; title?: string; to?: string; subject?: string; reply_to?: string; submit?: string; success?: string; mailto?: string; turnstile_sitekey?: string; store?: boolean; fields: FormField[] }
export type Submissions = { form: string; total: number; fields?: { name: string; label: string }[]; submissions: { time: string; values: Record<string, string> }[] }
+16 -1
View File
@@ -23,6 +23,11 @@ import (
//
// The consent script's tag carries the counter's hosts (data-hosts), so the
// checks and the Content-Security-Policy see them in the page.
//
// GA4 gets Google's consent signals (Consent Mode) when it starts: without
// them Google drops what it learns from visitors in the EEA and the UK,
// even ones who said yes. Statistics are granted, ad personalization never
// is, and ad measurement only with ad_conversions: true.
var (
//go:embed static/hotdog-consent.js
@@ -52,7 +57,11 @@ func analyticsHosts(a *site.AnalyticsConfig) []string {
case "matomo":
return []string{origin(a.URL)}
case "ga4":
return []string{"https://www.googletagmanager.com", "https://www.google-analytics.com", "https://*.google-analytics.com", "https://*.analytics.google.com"}
h := []string{"https://www.googletagmanager.com", "https://www.google-analytics.com", "https://*.google-analytics.com", "https://*.analytics.google.com"}
if a.AdConversions {
h = append(h, "https://www.google.com", "https://www.googleadservices.com", "https://*.doubleclick.net")
}
return h
}
return nil
}
@@ -77,6 +86,9 @@ func consentTags(cfg *site.Config, a *Assets) template.HTML {
{"data-site", an.SiteID}, {"data-id", an.ID}, {"data-privacy", privacyPage(cfg)},
{"data-hosts", strings.Join(analyticsHosts(an), " ")},
}
if an.AdConversions {
attrs = append(attrs, [2]string{"data-ads", "true"})
}
if !an.IsGated() {
attrs = append(attrs, [2]string{"data-gated", "false"})
}
@@ -106,6 +118,9 @@ func privacyFacts(cfg *site.Config, siteForms map[string]*forms.Form) []site.Pri
who += " (" + strings.TrimPrefix(hosts[0], "https://") + ")"
}
out = append(out, site.PrivacyFact{What: "Visit statistics", Who: who, Why: "To count visits and see which pages are read.", Basis: basis})
if an.AdConversions {
out = append(out, site.PrivacyFact{What: "Whether a visit from one of the site's Google ads went on to sign up or buy", Who: "Google Ads, through Google Analytics", Why: "To see which of the site's ads work. Ad personalization is off: nothing is used to show you ads elsewhere.", Basis: basis})
}
}
names := make([]string, 0, len(siteForms))
for n := range siteForms {
+6 -1
View File
@@ -4,6 +4,8 @@
// Declining (now or later) removes the counter's cookies. A browser that
// sends Global Privacy Control has already said no. Any element with
// data-hotdog-consent-open reopens the choice ("Cookie settings").
// Google Analytics is told what was agreed (Consent Mode): statistics yes,
// ad personalization no, ad measurement only when the site asks about it.
(() => {
const me = document.currentScript
if (!me) return
@@ -34,6 +36,8 @@
if (c.provider === 'ga4') {
window.dataLayer = window.dataLayer || []
window.gtag = function () { window.dataLayer.push(arguments) }
const ads = c.ads === 'true' ? 'granted' : 'denied'
window.gtag('consent', 'default', { analytics_storage: 'granted', ad_storage: ads, ad_user_data: ads, ad_personalization: 'denied' })
window.gtag('js', new Date())
window.gtag('config', c.id)
script('https://www.googletagmanager.com/gtag/js?id=' + encodeURIComponent(c.id), {})
@@ -69,7 +73,8 @@
box.setAttribute('role', 'region')
box.setAttribute('aria-label', 'Visit statistics')
const p = document.createElement('p')
p.textContent = 'May this site count your visit with ' + (names[c.provider] || 'its statistics') + '? Nothing is counted unless you agree. '
const what = names[c.provider] || 'its statistics'
p.textContent = 'May this site count your visit with ' + what + (c.ads === 'true' ? ', including whether you came from one of its Google ads' : '') + '? Nothing is counted unless you agree. '
if (c.privacy) {
const a = document.createElement('a')
a.href = c.privacy
+29 -3
View File
@@ -90,9 +90,35 @@ func TestConsentAndPrivacy(t *testing.T) {
t.Error("no analytics-ungated warning")
}
// Measuring Google ads: the banner and the notice say so, and the policy
// lets Google's ad hosts through.
dir = starterSite(t, "analytics: { provider: ga4, id: G-ABC123, ad_conversions: true }\n")
res, err = build.Run(build.Options{SiteDir: dir})
if err != nil {
t.Fatal(err)
}
home, _ = os.ReadFile(filepath.Join(res.Out, "index.html"))
if !strings.Contains(string(home), `data-ads="true"`) {
t.Error("home missing data-ads")
}
priv, _ = os.ReadFile(filepath.Join(res.Out, "privacy", "index.html"))
if !strings.Contains(string(priv), "Google Ads, through Google Analytics") {
t.Error("privacy page doesn't mention Google Ads")
}
rep, _ = Run(dir, res.Out, res.Site.Config)
if !strings.Contains(rep.CSP, "https://www.googleadservices.com") {
t.Errorf("CSP: %s", rep.CSP)
}
// A bad analytics setting stops the build, saying why.
dir = starterSite(t, "analytics: { provider: ga4, id: UA-1 }\n")
if _, err := build.Run(build.Options{SiteDir: dir}); err == nil || !strings.Contains(err.Error(), "G-ABC123") {
t.Errorf("bad id: %v", err)
for setting, want := range map[string]string{
"analytics: { provider: ga4, id: UA-1 }\n": "G-ABC123",
"analytics: { provider: ga4, id: G-ABC123, gated: false, ad_conversions: true }\n": "needs consent",
"analytics: { provider: plausible, domain: example.org, ad_conversions: true }\n": "is for ga4",
} {
dir = starterSite(t, setting)
if _, err := build.Run(build.Options{SiteDir: dir}); err == nil || !strings.Contains(err.Error(), want) {
t.Errorf("%s: %v", setting, err)
}
}
}
+3
View File
@@ -86,6 +86,9 @@ func (s *Server) privacySave(w http.ResponseWriter, r *http.Request, sess *Sessi
if !a.IsGated() {
an["gated"] = false // counting without asking: a choice, written down
}
if a.AdConversions {
an["ad_conversions"] = true
}
}
pv := map[string]any{}
for _, k := range []string{"controller", "contact", "updated"} {
@@ -1,4 +1,4 @@
import{n as e,r as t,t as n}from"./index-D5e-FBh8.js";var r=e();function i(e){this.content=e}i.prototype={constructor:i,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,a=r.find(e),o=r.content.slice();return a==-1?o.push(n||e,t):(o[a+1]=t,n&&(o[a]=n)),new i(o)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new i(n)},addToStart:function(e,t){return new i([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new i(n)},addBefore:function(e,t,n){var r=this.remove(t),a=r.content.slice(),o=r.find(e);return a.splice(o==-1?a.length:o,0,t,n),new i(a)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=i.from(e),e.size?new i(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=i.from(e),e.size?new i(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=i.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},i.from=function(e){if(e instanceof i)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new i(t)};function a(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),o=t.child(r);if(i==o)n+=i.nodeSize;else{if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){let e=i.text,t=o.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&c(e.charCodeAt(r-1))&&s(e.charCodeAt(r))&&n--,n}if(i.content.size||o.content.size){let e=a(i.content,o.content,n+1);if(e!=null)return e}n+=i.nodeSize}}}function o(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let l=e.child(--i),u=t.child(--a),d=l.nodeSize;if(l==u)n-=d,r-=d;else{if(!l.sameMarkup(u))return{a:n,b:r};if(l.isText&&l.text!=u.text){let e=l.text,t=u.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&c(e.charCodeAt(i-1))&&s(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(l.content.size||u.content.size){let e=o(l.content,u.content,n-1,r-1);if(e)return e}n-=d,r-=d}}}function s(e){return e>=56320&&e<57344}function c(e){return e>=55296&&e<56320}var l=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return a(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return o(this,e,t,n)}findIndex(e){if(e==0)return d(0,e);if(e==this.size)return d(this.content.length,e);if(e>this.size||e<0)throw RanLine truncated
import{n as e,r as t,t as n}from"./index-CG9QFeJ3.js";var r=e();function i(e){this.content=e}i.prototype={constructor:i,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,a=r.find(e),o=r.content.slice();return a==-1?o.push(n||e,t):(o[a+1]=t,n&&(o[a]=n)),new i(o)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new i(n)},addToStart:function(e,t){return new i([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new i(n)},addBefore:function(e,t,n){var r=this.remove(t),a=r.content.slice(),o=r.find(e);return a.splice(o==-1?a.length:o,0,t,n),new i(a)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=i.from(e),e.size?new i(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=i.from(e),e.size?new i(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=i.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},i.from=function(e){if(e instanceof i)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new i(t)};function a(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),o=t.child(r);if(i==o)n+=i.nodeSize;else{if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){let e=i.text,t=o.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&c(e.charCodeAt(r-1))&&s(e.charCodeAt(r))&&n--,n}if(i.content.size||o.content.size){let e=a(i.content,o.content,n+1);if(e!=null)return e}n+=i.nodeSize}}}function o(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let l=e.child(--i),u=t.child(--a),d=l.nodeSize;if(l==u)n-=d,r-=d;else{if(!l.sameMarkup(u))return{a:n,b:r};if(l.isText&&l.text!=u.text){let e=l.text,t=u.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&c(e.charCodeAt(i-1))&&s(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(l.content.size||u.content.size){let e=o(l.content,u.content,n-1,r-1);if(e)return e}n-=d,r-=d}}}function s(e){return e>=56320&&e<57344}function c(e){return e>=55296&&e<56320}var l=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return a(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return o(this,e,t,n)}findIndex(e){if(e==0)return d(0,e);if(e==this.size)return d(this.content.length,e);if(e>this.size||e<0)throw RanLine truncated
`)}};ge.empty=new ge(!0);var _e=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function ve(e){let t=[];do t.push(ye(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function ye(e){let t=[];do t.push(be(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function be(e){let t=we(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Se(e,t);else break;return t}function xe(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Se(e,t){let n=xe(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:xe(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Ce(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function we(e){if(e.eat(`(`)){let t=ve(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Ce(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Te(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function Ee(e,t){return t-e}function De(e,t){let n=[];return r(t),n.sort(Ee);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Oe(e){let t=Object.create(null);return n(De(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);De(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new ge(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Ee);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function ke(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Ae(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function je(e,t){let n=Object.create(null);for(let r in e){let i=e[r],a=t&&t[r];if(a===void 0){if(i.hasDefault)a=i.default;else throw RangeError(`No value supplied for attribute `+r)}else i.validate&&i.validate(a);n[r]=a}return n}function Me(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Fe(e,r,t[r]);return n}var Ne=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=Me(e,n.attrs),this.defaultAttrs=Ae(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ge.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:je(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new fe(this,this.co Line truncated
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;We.hasOwnProperty(a)&&this.parser.normalizeLists&&Ze(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Ue.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(He.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node){if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=p.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):et(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=Je(e,i,a.options);a.options&qe&&a.content.length==0&&(o|=qe);let s=p.none;return n=n.filter(t=>!(a.type?a.type.allowsMarkType(t.type):et(t.type,e))||(s=t.addToSet(s),!1)),this.nodes.push(new Ye(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=Ge);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function Ze(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&We.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Qe(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMa Line truncated
@@ -1,4 +1,4 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/VisualEditor-Bk2XWLOr.js","assets/VisualEditor-ptHiDCW_.css"])))=>i.map(i=>d[i]);
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/VisualEditor-ChliXE4b.js","assets/VisualEditor-ptHiDCW_.css"])))=>i.map(i=>d[i]);
var e=Object.defineProperty,t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},r=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var j=/\/+/g;function ee(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function te(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,te(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ee(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(j,`$&/`)+`/`),te(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(j,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+ee(a,u),c+=te(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+ee(a,u++),c+=te(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return te(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function N(e,t,n){if(e==null)return e;var r=[],i=0;return te(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ne(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var re=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function P(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,re)}catch(e){re(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function ie(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else P(ie.bind(null,e))}var ae={map:N,forEach:function(e,t,n){N(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return N(e,function(){t++}),t},toArray:function(e){retuLine truncated
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
`+Oe+e+ke}var je=!1;function Me(e,t){if(!e||je)return``;je=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -40,7 +40,7 @@ It never runs shell commands: the editor host is not a shell.`;function Ae(e){le
`),disabled:!F,onChange:e=>ie(t,{options:e.target.value.split(`
`).map(e=>e.trim()).filter(Boolean)})})]}),(0,j.jsxs)(`label`,{children:[`Help`,(0,j.jsx)(`input`,{value:e.help||``,disabled:!F,onChange:e=>ie(t,{help:e.target.value})})]}),(0,j.jsxs)(`div`,{className:`actions-row`,children:[(0,j.jsxs)(`label`,{className:`check`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:!!e.required,disabled:!F,onChange:e=>ie(t,{required:e.target.checked||void 0})}),` Required`]}),(0,j.jsxs)(`label`,{className:`inline`,children:[`Most characters`,(0,j.jsx)(`input`,{type:`number`,min:1,value:e.max||``,disabled:!F,onChange:e=>ie(t,{max:e.target.value?Number(e.target.value):void 0})})]}),F&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{type:`button`,className:`ghost small`,disabled:t===0,onClick:()=>P({fields:qe(s.fields,t,t-1)}),"aria-label":`Move up`,children:`↑`}),(0,j.jsx)(`button`,{type:`button`,className:`ghost small`,disabled:t===s.fields.length-1,onClick:()=>P({fields:qe(s.fields,t,t+1)}),"aria-label":`Move down`,children:`↓`}),(0,j.jsx)(`button`,{type:`button`,className:`ghost small`,onClick:()=>P({fields:s.fields.filter((e,n)=>n!==t)}),children:`Remove`})]})]})]},t))}),F&&(0,j.jsxs)(`div`,{className:`actions-row`,children:[(0,j.jsx)(`button`,{type:`button`,className:`ghost small`,onClick:()=>P({fields:[...s.fields,{name:`field_${s.fields.length+1}`,label:`New field`}]}),children:`Add a field`}),(0,j.jsx)(`button`,{type:`button`,className:`button primary`,disabled:!re||T,onClick:()=>ae(),children:a?.branch===t?`Save`:`Save as draft`}),l&&(0,j.jsx)(`button`,{type:`button`,className:`ghost small`,disabled:T,onClick:()=>ae(!0),children:`Delete form`})]})]}),f===`submissions`&&(0,j.jsxs)(`div`,{className:`subs`,children:[!A&&(0,j.jsx)(`p`,{className:`muted`,children:`Reading submissions…`}),A&&A.total===0&&(0,j.jsx)(`p`,{className:`muted`,children:`No submissions kept for this form.`}),A&&A.submissions.length>0&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`p`,{className:`muted small`,children:[A.total,` kept, newest first. Read from the endpoint's private viewer; the public site can't show them.`]}),(0,j.jsx)(`div`,{className:`table-wrap`,children:(0,j.jsxs)(`table`,{className:`pages`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{children:`When`}),(A.fields||[]).map(e=>(0,j.jsx)(`th`,{children:e.label||e.name},e.name))]})}),(0,j.jsx)(`tbody`,{children:A.submissions.map((e,t)=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`td`,{className:`small`,children:new Date(e.time).toLocaleString()}),(A.fields||[]).map(t=>(0,j.jsx)(`td`,{className:`small sub-cell`,children:e.values[t.name]},t.name))]},t))})]})}),(0,j.jsxs)(`div`,{className:`actions-row`,children:[(0,j.jsx)(`button`,{type:`button`,className:`ghost small`,disabled:M===0,onClick:()=>te(Math.max(0,M-50)),children:`Newer`}),(0,j.jsx)(`button`,{type:`button`,className:`ghost small`,disabled:M+50>=A.total,onClick:()=>te(M+50),children:`Older`})]})]})]})]}),!n&&r&&r.length>0&&(0,j.jsx)(`p`,{className:`muted`,children:`Choose a form to change it.`})]}),right:(0,j.jsxs)(`section`,{className:`preview-pane`,"aria-label":`Preview`,children:[(0,j.jsx)(`div`,{className:`preview-bar`,children:(0,j.jsx)(We,{device:S,onChange:w})}),v&&(0,j.jsx)(`p`,{className:`notice warn small preview-note`,children:v}),(0,j.jsx)(Ge,{src:g,device:S,title:`Preview of the form`,reloadKey:b})]})})}function Ye({id:e}){let[t,n]=(0,d.useState)(),[r,i]=(0,d.useState)(),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)();(0,d.useEffect)(()=>{C.site(e).then(e=>o(e.canWrite),()=>void 0),C.log(e,void 0,void 0,50).then(e=>n(e.commits),e=>i({kind:`bad`,text:e.message}))},[e]);let l=async t=>{c(t.sha),i({kind:`info`,text:`Undoing "${t.subject}"…`});try{let n=await C.revert(e,t.sha);i({kind:`good`,text:`"${t.subject}" is undone on a new draft, ${n.branch}. Look it over, then submit it for review and publish.`,branch:n.branch})}catch(e){i({kind:`bad`,text:e.message})}finally{c(void 0)}};return(0,j.jsxs)(`section`,{className:`pad history`,children:[(0,j.jsx)(`a`,{className:`back`,href:`/sites/${encodeURIComponent(e)}`,onClick:t=>{t.preventDefault(),D({view:`site`,id:e})},children:`← Site`}),(0,j.jsx)(`h1`,{children:`History`}),(0,j.jsx)(`p`,{className:`muted`,children:`Every change that reached the published site, newest first. Undoing one makes a draft that reverses it; nothing changes until that's published.`}),r&&(0,j.jsxs)(`p`,{className:`notice ${r.kind}`,role:`status`,children:[r.text,r.branch&&(0,j.jsxs)(j.Fragment,{children:[` `,(0,j.jsx)(`a`,{href:`#`,onClick:t=>{t.preventDefault(),D({view:`site`,id:e,branch:r.branch})},children:`Open the draft`})]})]}),!t&&!r&&(0,j.jsx)(`p`,{className:`muted`,children:`Reading the history…`}),(0,j.jsx)(`ol`,{className:`commit-list`,children:t?.map(e=>(0,j.jsxs)(`li`,{children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:e.subject}),(0,j.jsxs)(`span`,{className:`muted small`,children:[` `,e.author,` · `,new Date(e.when).toLocaleString(),` · `,(0,j.jsx)(`span`,{className:`monLine truncated
`)}function nt(e){let t=e.trim().toLowerCase().replace(/^https?:\/\//,``).replace(/\/.*$/,``);return t.includes(`@`)&&(t=t.slice(t.lastIndexOf(`@`)+1)),/^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,}(?::\d{1,5})?$/.test(t)?t:``}function rt(e,t){return`https://${e}/share?text=${encodeURIComponent(t)}`}function it(e){return`https://bsky.app/intent/compose?text=${encodeURIComponent(e)}`}function at(e){return`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(e)}`}function ot(e){if(typeof Intl<`u`&&`Segmenter`in Intl){let t=0;for(let n of new Intl.Segmenter(void 0,{granularity:`grapheme`}).segment(e))t++;return t}return[...e].length}var st=`hotdog-mastodon`;function ct(){try{return localStorage.getItem(st)||``}catch{return``}}function lt({title:e,summary:t,url:n,onClose:r}){let[i,a]=(0,d.useState)(()=>tt(e,t,n)),[o,s]=(0,d.useState)(ct),[c,l]=(0,d.useState)(!1),u=nt(o),f=ot(i),p=e=>window.open(e,`_blank`,`noopener,noreferrer`);return(0,j.jsxs)(`div`,{className:`share-panel form`,role:`group`,"aria-label":`Share this page`,children:[(0,j.jsxs)(`div`,{className:`library-head`,children:[(0,j.jsx)(`strong`,{children:`Share`}),(0,j.jsx)(`button`,{type:`button`,className:`ghost small`,onClick:r,children:`Close`})]}),(0,j.jsx)(`p`,{className:`muted small`,children:`Each button opens the network's own share page with this filled in; you post it from your account there. Share once the live site shows the change.`}),(0,j.jsxs)(`label`,{children:[`Post`,(0,j.jsx)(`textarea`,{rows:5,value:i,onChange:e=>a(e.target.value)})]}),(0,j.jsxs)(`p`,{className:`small ${f>300?`bad-text`:`muted`}`,children:[f,` characters`,f>300?`: Bluesky allows 300`:``]}),(0,j.jsxs)(`div`,{className:`share-row`,children:[(0,j.jsxs)(`label`,{className:`share-server`,children:[`Mastodon server`,(0,j.jsx)(`input`,{value:o,placeholder:`mastodon.social`,onChange:e=>s(e.target.value),spellCheck:!1})]}),(0,j.jsx)(`button`,{type:`button`,className:`button`,disabled:!u||!i.trim(),onClick:()=>{try{localStorage.setItem(st,u)}catch{}p(rt(u,i))},children:`Mastodon ↗`})]}),(0,j.jsxs)(`div`,{className:`actions`,children:[(0,j.jsx)(`button`,{type:`button`,className:`button`,disabled:!i.trim()||f>300,onClick:()=>p(it(i)),children:`Bluesky ↗`}),(0,j.jsx)(`button`,{type:`button`,className:`button`,onClick:()=>p(at(n)),title:`LinkedIn takes the link and reads the title and picture from the page; copy the text to add it`,children:`LinkedIn ↗`}),(0,j.jsx)(`button`,{type:`button`,className:`ghost`,onClick:async()=>{try{await navigator.clipboard.writeText(i),l(!0),setTimeout(()=>l(!1),2e3)}catch{}},children:c?`Copied`:`Copy text`})]})]})}var ut=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),dt=function(e){return`/`+e},ft={},pt=function(e){return e.pathname.endsWith(`.css`)},mt=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},ht=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=dt(t,n);let r=s(t),i=pt(r);return mt(ft,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:ut,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},gt=(0,d.lazy)(()=>ht(()=>import(`./VisualEditor-Bk2XWLOr.js`).then(e=>({default:e.VisualEditor})),__vite__mapDeps([0,1]))),_t=[`title`,`summary`,`date`,`tags`,`image`,`image_alt`,`draft`,`publish_at`];function vt(e){return e==null?``:typeof e==`string`?e:String(e)}function yt(e){let t=vt(e);return/^\d{4}-\d{2}-\d{2}/.test(t)?t.slice(0,10):t}function bt(e){let t=vt(e);if(!t)return``;let n=new Date(t);if(isNaN(n.getTime()))return``;let r=e=>String(e).padStart(2,`0`);return`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())}T${r(n.getHours())}:${r(n.getMinutes())}`}function xt(e){let t=Array.isArray(e.tags)?e.tags.map(vt).join(`, `):vt(e.tags);return{title:vt(e.title),summary:v Line truncated
`)}function nt(e){let t=e.trim().toLowerCase().replace(/^https?:\/\//,``).replace(/\/.*$/,``);return t.includes(`@`)&&(t=t.slice(t.lastIndexOf(`@`)+1)),/^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,}(?::\d{1,5})?$/.test(t)?t:``}function rt(e,t){return`https://${e}/share?text=${encodeURIComponent(t)}`}function it(e){return`https://bsky.app/intent/compose?text=${encodeURIComponent(e)}`}function at(e){return`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(e)}`}function ot(e){if(typeof Intl<`u`&&`Segmenter`in Intl){let t=0;for(let n of new Intl.Segmenter(void 0,{granularity:`grapheme`}).segment(e))t++;return t}return[...e].length}var st=`hotdog-mastodon`;function ct(){try{return localStorage.getItem(st)||``}catch{return``}}function lt({title:e,summary:t,url:n,onClose:r}){let[i,a]=(0,d.useState)(()=>tt(e,t,n)),[o,s]=(0,d.useState)(ct),[c,l]=(0,d.useState)(!1),u=nt(o),f=ot(i),p=e=>window.open(e,`_blank`,`noopener,noreferrer`);return(0,j.jsxs)(`div`,{className:`share-panel form`,role:`group`,"aria-label":`Share this page`,children:[(0,j.jsxs)(`div`,{className:`library-head`,children:[(0,j.jsx)(`strong`,{children:`Share`}),(0,j.jsx)(`button`,{type:`button`,className:`ghost small`,onClick:r,children:`Close`})]}),(0,j.jsx)(`p`,{className:`muted small`,children:`Each button opens the network's own share page with this filled in; you post it from your account there. Share once the live site shows the change.`}),(0,j.jsxs)(`label`,{children:[`Post`,(0,j.jsx)(`textarea`,{rows:5,value:i,onChange:e=>a(e.target.value)})]}),(0,j.jsxs)(`p`,{className:`small ${f>300?`bad-text`:`muted`}`,children:[f,` characters`,f>300?`: Bluesky allows 300`:``]}),(0,j.jsxs)(`div`,{className:`share-row`,children:[(0,j.jsxs)(`label`,{className:`share-server`,children:[`Mastodon server`,(0,j.jsx)(`input`,{value:o,placeholder:`mastodon.social`,onChange:e=>s(e.target.value),spellCheck:!1})]}),(0,j.jsx)(`button`,{type:`button`,className:`button`,disabled:!u||!i.trim(),onClick:()=>{try{localStorage.setItem(st,u)}catch{}p(rt(u,i))},children:`Mastodon ↗`})]}),(0,j.jsxs)(`div`,{className:`actions`,children:[(0,j.jsx)(`button`,{type:`button`,className:`button`,disabled:!i.trim()||f>300,onClick:()=>p(it(i)),children:`Bluesky ↗`}),(0,j.jsx)(`button`,{type:`button`,className:`button`,onClick:()=>p(at(n)),title:`LinkedIn takes the link and reads the title and picture from the page; copy the text to add it`,children:`LinkedIn ↗`}),(0,j.jsx)(`button`,{type:`button`,className:`ghost`,onClick:async()=>{try{await navigator.clipboard.writeText(i),l(!0),setTimeout(()=>l(!1),2e3)}catch{}},children:c?`Copied`:`Copy text`})]})]})}var ut=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),dt=function(e){return`/`+e},ft={},pt=function(e){return e.pathname.endsWith(`.css`)},mt=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},ht=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=dt(t,n);let r=s(t),i=pt(r);return mt(ft,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:ut,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},gt=(0,d.lazy)(()=>ht(()=>import(`./VisualEditor-ChliXE4b.js`).then(e=>({default:e.VisualEditor})),__vite__mapDeps([0,1]))),_t=[`title`,`summary`,`date`,`tags`,`image`,`image_alt`,`draft`,`publish_at`];function vt(e){return e==null?``:typeof e==`string`?e:String(e)}function yt(e){let t=vt(e);return/^\d{4}-\d{2}-\d{2}/.test(t)?t.slice(0,10):t}function bt(e){let t=vt(e);if(!t)return``;let n=new Date(t);if(isNaN(n.getTime()))return``;let r=e=>String(e).padStart(2,`0`);return`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())}T${r(n.getHours())}:${r(n.getMinutes())}`}function xt(e){let t=Array.isArray(e.tags)?e.tags.map(vt).join(`, `):vt(e.tags);return{title:vt(e.title),summary:v Line truncated
`)?``:i.endsWith(`
`)?`
@@ -53,4 +53,4 @@ It never runs shell commands: the editor host is not a shell.`;function Ae(e){le
`:`
`;r=i+o+n+s+a}p(r),de(void 0);let u=we.current;if(we.current=void 0,!u)return;let d=(u.notes||[]).join(` `);x({kind:`good`,text:`Added ${u.url}${u.created?` on a new draft, ${u.branch}`:``}. ${d} Save to keep it in the page.`.trim()}),i(),u.created||u.branch!==Te?(l&&(Se.current={fields:l,body:r,yaml:v,yamlMode:g,secs:fe}),D({view:`page`,id:e,source:t,branch:u.branch})):a&&o({...a,commit:u.commit})},qe=(0,d.useRef)(void 0),Je=async n=>{let r=await C.upload(e,n,{branch:Te,baseCommit:a?.commit||``,source:t});return qe.current=r,r.url};(0,d.useEffect)(()=>{let n=qe.current;if(!n)return;qe.current=void 0;let r=(n.notes||[]).join(` `);x({kind:`good`,text:`Added ${n.url}${n.created?` on a new draft, ${n.branch}`:``}. ${r} Save to keep it in the page.`.trim()}),i(),n.created||n.branch!==Te?(l&&(Se.current={fields:l,body:f,yaml:v,yamlMode:g,secs:fe}),D({view:`page`,id:e,source:t,branch:n.branch})):a&&o({...a,commit:n.commit})},[fe]);let Ye=async()=>{O(!0),x({kind:`info`,text:`Checking the draft and publishing…`}),le(void 0);try{await C.publish(e,{branch:Te}),x({kind:`good`,text:`Published: the change is merged. The live site updates when its publishing pipeline runs.`}),w(!0),r&&D({view:`page`,id:e,source:t,branch:r.publishBranch}),i()}catch(e){e instanceof h&&le(e.problems),x({kind:`bad`,text:e.message})}finally{O(!1)}},Xe=k?new URL(k).origin:``,Qe=e=>{let t=document.querySelector(`.preview-pane iframe`);t?.contentWindow&&Xe&&t.contentWindow.postMessage({type:`hotdog:point`,on:e},Xe)};if((0,d.useEffect)(()=>{let e=e=>{if(!Xe||e.origin!==Xe||!e.data||typeof e.data!=`object`||(e.data.type===`hotdog:ready`&&Qe(ge),e.data.type!==`hotdog:jump`||typeof e.data.text!=`string`))return;let t=e.data.text.slice(0,200);if(me===`visual`&&he.current){he.current.jumpTo(t)||x({kind:`info`,text:`"${t.slice(0,60)}" isn't in the body; it comes from the front matter, a section or the template.`});return}let n=xe.current;if(!n)return;let r=f.toLowerCase(),i=t.toLowerCase().split(` `),a=-1;for(let e of[t.toLowerCase().slice(0,40),i.slice(0,4).join(` `),i.slice(0,2).join(` `)])if(e.length>=3&&(a=r.indexOf(e))>=0)break;if(a<0){x({kind:`info`,text:`"${t.slice(0,60)}" isn't in the body; it comes from the front matter, a section or the template.`});return}n.focus(),n.setSelectionRange(a,a+Math.min(t.length,f.length-a));let o=f.slice(0,a).split(`
`).length;n.scrollTop=Math.max(0,(o-3)*parseFloat(getComputedStyle(n).lineHeight||`20`))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[Xe,ge,me,f]),(0,d.useEffect)(()=>Qe(ge),[ge,k]),Ee(`mod+s`,()=>ke&&!T&&Re&&He(),!!a),Ce(()=>a?[...Re&&ke?[{id:`page-save`,title:Le?`Save`:`Save as draft`,group:`Page`,keys:`Ctrl+S`,run:He}]:[],...Re?[{id:`page-picture`,title:`Insert picture`,group:`Page`,run:()=>de({})}]:[],{id:`page-mode`,title:me===`visual`?`Edit the body as Markdown`:`Edit the body visually`,group:`Page`,run:()=>L(me===`visual`?`markdown`:`visual`)},...k?[{id:`page-point`,title:ge?`Stop pointing in the preview`:`Point and edit: click text in the preview`,group:`Page`,run:()=>_e(!ge)}]:[],{id:`page-yaml`,title:g?`Edit front matter as fields`:`Edit front matter as YAML`,group:`Page`,run:()=>_(!g)},...Le&&!Ie&&Re&&!ke?[{id:`page-review`,title:`Submit for review`,group:`Page`,run:()=>oe(!0)}]:[],...Le&&Ie&&Re&&!ke?[{id:`page-publish`,title:`Publish`,group:`Page`,run:Ye}]:[],...Be&&!ke?[{id:`page-share`,title:`Share this page`,group:`Page`,run:()=>w(!0)}]:[],...k?[{id:`page-present`,title:`Present in a new tab`,group:`Page`,run:()=>window.open(E({view:`present`,id:e,url:k,branch:n}),`_blank`,`noopener`)}]:[],{id:`page-file`,title:`Edit ${t} as a raw file`,group:`Page`,run:()=>D({view:`files`,id:e,branch:n,path:t})}]:[]),s)return(0,j.jsx)(`div`,{className:`pad notice bad`,role:`alert`,children:s});if(!a||!l)return(0,j.jsx)(`p`,{className:`pad muted`,children:`Loading the page…`});let $e=Object.keys(a.frontMatter).filter(e=>!_t.includes(e)&&!(e===`sections`&&fe)),tt=e=>t=>u({...l,[e]:t.target.type===`checkbox`?!!t.target.checked:t.target.value});return(0,j.jsx)(Ve,{left:(0,j.jsxs)(`section`,{className:`editor-pane`,children:[(0,j.jsxs)(`div`,{className:`pane-head`,children:[(0,j.jsxs)(`a`,{className:`back`,href:`/sites/${encodeURIComponent(e)}${n?`?branch=${encodeURIComponent(n)}`:``}`,onClick:t=>{t.preventDefault(),D({view:`site`,id:e,branch:n})},children:[`← `,r?.name||`Site`]}),(0,j.jsxs)(`span`,{className:`pane-pills`,children:[r&&r.accounts.length>1&&(0,j.jsxs)(`span`,{className:`pill`,title:`Change it in the site view`,children:[`as @`,r.as.split(`/`).pop()]}),(0,j.jsx)(`span`,{className:`pill ${Le?`warn`:``}`,children:Le?`draft: ${Te}`:`${Te} · published`})]})]}),(0,j.jsx)(`h1`,{children:l.title||t}),(0,j.jsxs)(`p`,{className:`muted mono small`,children:[t,Ne?` → ${Ne}`:``,Re&&ve===void 0&&t!==`content/index.md`&&(0,j.jsx)(`button`,{type:`button`,className:`ghost small move-btn`,onClick:()=>ye(Ne||``),children:`Move…`})]}),ve!==void 0&&(0,j.jsx)(Tt,{id:e,source:t,branch:Te,baseCommit:a.commit,current:Ne||``,value:ve,dirty:ke,onChange:ye,onDone:t=>{ye(void 0),x({kind:`good`,text:`Moved to ${t.to}${t.redirected?`; ${t.from} now redirects there`:``}.${t.created?` On a new draft, ${t.branch}.`:``}`}),i(),D({view:`page`,id:e,source:t.source,branch:t.branch})}}),(0,j.jsxs)(`div`,{className:`actions`,children:[(0,j.jsx)(`button`,{type:`button`,className:`button primary`,disabled:!ke||T||!Re,onClick:He,children:Le?`Save`:`Save as draft`}),Le&&!Ie&&(0,j.jsx)(`button`,{type:`button`,className:`button`,disabled:T||ke||!Re,onClick:()=>oe(!F),children:`Submit for review`}),Le&&Ie&&(0,j.jsxs)(`a`,{className:`button`,href:Ie.url,target:`_blank`,rel:`noopener noreferrer`,children:[`Review #`,Ie.number,` ↗`]}),Le&&Ie&&(0,j.jsx)(`button`,{type:`button`,className:`button`,disabled:T||ke||!Re,onClick:Ye,title:`Merges the review, if the draft passes the checks`,children:`Publish`}),Be&&!S&&(0,j.jsx)(`button`,{type:`button`,className:`ghost`,disabled:ke,onClick:()=>w(!0),title:`Post a link to this page on Mastodon, Bluesky or LinkedIn`,children:`Share…`}),!Re&&(0,j.jsx)(`span`,{className:`muted small`,children:`Read only: the platform doesn't let you change this site.`}),ke&&(0,j.jsx)(`span`,{className:`muted small`,children:`Unsaved changes`})]}),b&&(0,j.jsx)(`p`,{className:`notice ${b.kind}`,role:`status`,children:b.text}),ce&&ce.length>0&&(0,j.jsx)(`ul`,{className:`problems`,children:ce.filter(e=>e.Level===`error`).map((e,t)=>(0,j.jsxs)(`li`,{className:`error`,children:[(0,j.jsx)(`span`,{className:`pill`,children:e.Rule}),` `,(0,j.jsx)(`span`,{className:`mono small`,children:e.File}),` `,e.What]},t))}),S&&Be&&(0,j.jsx)(lt,{title:t===`content/index.md`&&r?.siteName||l.title,summary:l.summary,url:ze,onClose:()=>w(!1)}),F&&(0,j.jsx)(wt,{id:e,branch:Te,title:l.title,onDone:e=>{oe(!1),x({kind:`good`,text:e}),i()},onError:e=>x({kind:`bad`,text:e})}),Fe.length>0&&(0,j.jsxs)(`div`,{className:`notice warn`,children:[(0,j.jsx)(`strong`,{children:`Checks on this page`}),(0,j.jsx)(`ul`,{className:`problems`,children:Fe.map((e,t)=>(0,j.jsxs)(`li`,{className:e.Level,children:[(0,j.jsx)(`span`,{className:`pill`,children:e.Rule}),` `,e.What,e.Fix&&(0,j.jsx)(`span`,{className:`fix`,children:e.Fix})]},t))})]}),R&&(0,j.jsx)(et,{id:e,branch:Te,seo:R.seo,siteURL:R.siteURL,path:R.path}), Line truncated
`).length;n.scrollTop=Math.max(0,(o-3)*parseFloat(getComputedStyle(n).lineHeight||`20`))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[Xe,ge,me,f]),(0,d.useEffect)(()=>Qe(ge),[ge,k]),Ee(`mod+s`,()=>ke&&!T&&Re&&He(),!!a),Ce(()=>a?[...Re&&ke?[{id:`page-save`,title:Le?`Save`:`Save as draft`,group:`Page`,keys:`Ctrl+S`,run:He}]:[],...Re?[{id:`page-picture`,title:`Insert picture`,group:`Page`,run:()=>de({})}]:[],{id:`page-mode`,title:me===`visual`?`Edit the body as Markdown`:`Edit the body visually`,group:`Page`,run:()=>L(me===`visual`?`markdown`:`visual`)},...k?[{id:`page-point`,title:ge?`Stop pointing in the preview`:`Point and edit: click text in the preview`,group:`Page`,run:()=>_e(!ge)}]:[],{id:`page-yaml`,title:g?`Edit front matter as fields`:`Edit front matter as YAML`,group:`Page`,run:()=>_(!g)},...Le&&!Ie&&Re&&!ke?[{id:`page-review`,title:`Submit for review`,group:`Page`,run:()=>oe(!0)}]:[],...Le&&Ie&&Re&&!ke?[{id:`page-publish`,title:`Publish`,group:`Page`,run:Ye}]:[],...Be&&!ke?[{id:`page-share`,title:`Share this page`,group:`Page`,run:()=>w(!0)}]:[],...k?[{id:`page-present`,title:`Present in a new tab`,group:`Page`,run:()=>window.open(E({view:`present`,id:e,url:k,branch:n}),`_blank`,`noopener`)}]:[],{id:`page-file`,title:`Edit ${t} as a raw file`,group:`Page`,run:()=>D({view:`files`,id:e,branch:n,path:t})}]:[]),s)return(0,j.jsx)(`div`,{className:`pad notice bad`,role:`alert`,children:s});if(!a||!l)return(0,j.jsx)(`p`,{className:`pad muted`,children:`Loading the page…`});let $e=Object.keys(a.frontMatter).filter(e=>!_t.includes(e)&&!(e===`sections`&&fe)),tt=e=>t=>u({...l,[e]:t.target.type===`checkbox`?!!t.target.checked:t.target.value});return(0,j.jsx)(Ve,{left:(0,j.jsxs)(`section`,{className:`editor-pane`,children:[(0,j.jsxs)(`div`,{className:`pane-head`,children:[(0,j.jsxs)(`a`,{className:`back`,href:`/sites/${encodeURIComponent(e)}${n?`?branch=${encodeURIComponent(n)}`:``}`,onClick:t=>{t.preventDefault(),D({view:`site`,id:e,branch:n})},children:[`← `,r?.name||`Site`]}),(0,j.jsxs)(`span`,{className:`pane-pills`,children:[r&&r.accounts.length>1&&(0,j.jsxs)(`span`,{className:`pill`,title:`Change it in the site view`,children:[`as @`,r.as.split(`/`).pop()]}),(0,j.jsx)(`span`,{className:`pill ${Le?`warn`:``}`,children:Le?`draft: ${Te}`:`${Te} · published`})]})]}),(0,j.jsx)(`h1`,{children:l.title||t}),(0,j.jsxs)(`p`,{className:`muted mono small`,children:[t,Ne?` → ${Ne}`:``,Re&&ve===void 0&&t!==`content/index.md`&&(0,j.jsx)(`button`,{type:`button`,className:`ghost small move-btn`,onClick:()=>ye(Ne||``),children:`Move…`})]}),ve!==void 0&&(0,j.jsx)(Tt,{id:e,source:t,branch:Te,baseCommit:a.commit,current:Ne||``,value:ve,dirty:ke,onChange:ye,onDone:t=>{ye(void 0),x({kind:`good`,text:`Moved to ${t.to}${t.redirected?`; ${t.from} now redirects there`:``}.${t.created?` On a new draft, ${t.branch}.`:``}`}),i(),D({view:`page`,id:e,source:t.source,branch:t.branch})}}),(0,j.jsxs)(`div`,{className:`actions`,children:[(0,j.jsx)(`button`,{type:`button`,className:`button primary`,disabled:!ke||T||!Re,onClick:He,children:Le?`Save`:`Save as draft`}),Le&&!Ie&&(0,j.jsx)(`button`,{type:`button`,className:`button`,disabled:T||ke||!Re,onClick:()=>oe(!F),children:`Submit for review`}),Le&&Ie&&(0,j.jsxs)(`a`,{className:`button`,href:Ie.url,target:`_blank`,rel:`noopener noreferrer`,children:[`Review #`,Ie.number,` ↗`]}),Le&&Ie&&(0,j.jsx)(`button`,{type:`button`,className:`button`,disabled:T||ke||!Re,onClick:Ye,title:`Merges the review, if the draft passes the checks`,children:`Publish`}),Be&&!S&&(0,j.jsx)(`button`,{type:`button`,className:`ghost`,disabled:ke,onClick:()=>w(!0),title:`Post a link to this page on Mastodon, Bluesky or LinkedIn`,children:`Share…`}),!Re&&(0,j.jsx)(`span`,{className:`muted small`,children:`Read only: the platform doesn't let you change this site.`}),ke&&(0,j.jsx)(`span`,{className:`muted small`,children:`Unsaved changes`})]}),b&&(0,j.jsx)(`p`,{className:`notice ${b.kind}`,role:`status`,children:b.text}),ce&&ce.length>0&&(0,j.jsx)(`ul`,{className:`problems`,children:ce.filter(e=>e.Level===`error`).map((e,t)=>(0,j.jsxs)(`li`,{className:`error`,children:[(0,j.jsx)(`span`,{className:`pill`,children:e.Rule}),` `,(0,j.jsx)(`span`,{className:`mono small`,children:e.File}),` `,e.What]},t))}),S&&Be&&(0,j.jsx)(lt,{title:t===`content/index.md`&&r?.siteName||l.title,summary:l.summary,url:ze,onClose:()=>w(!1)}),F&&(0,j.jsx)(wt,{id:e,branch:Te,title:l.title,onDone:e=>{oe(!1),x({kind:`good`,text:e}),i()},onError:e=>x({kind:`bad`,text:e})}),Fe.length>0&&(0,j.jsxs)(`div`,{className:`notice warn`,children:[(0,j.jsx)(`strong`,{children:`Checks on this page`}),(0,j.jsx)(`ul`,{className:`problems`,children:Fe.map((e,t)=>(0,j.jsxs)(`li`,{className:e.Level,children:[(0,j.jsx)(`span`,{className:`pill`,children:e.Rule}),` `,e.What,e.Fix&&(0,j.jsx)(`span`,{className:`fix`,children:e.Fix})]},t))})]}),R&&(0,j.jsx)(et,{id:e,branch:Te,seo:R.seo,siteURL:R.siteURL,path:R.path}), Line truncated
+1 -1
View File
@@ -8,7 +8,7 @@
<script src="/theme.js"></script>
<link rel="icon" type="image/svg+xml" href="/assets/favicon-C_nYLbws.svg">
<link rel="apple-touch-icon" href="/assets/favicon-180-56THzeO7.png">
<script type="module" crossorigin src="/assets/index-D5e-FBh8.js"></script>
<script type="module" crossorigin src="/assets/index-CG9QFeJ3.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DFHl2DtG.css">
</head>
<body>
+10
View File
@@ -379,6 +379,10 @@ type AnalyticsConfig struct {
SiteID string `yaml:"site_id" json:"siteId,omitempty"` // matomo
ID string `yaml:"id" json:"id,omitempty"` // ga4: G-…
Gated *bool `yaml:"gated" json:"gated,omitempty"` // default true
// ga4: also measure the site's Google ads (whether a visit from one went
// on to sign up or buy), for visitors who accept. Ad personalization
// stays off either way.
AdConversions bool `yaml:"ad_conversions" json:"adConversions,omitempty"`
}
// IsGated reports whether analytics waits for consent.
@@ -395,6 +399,12 @@ func (a *AnalyticsConfig) Validate() error {
}
return nil
}
if a.AdConversions && a.Provider != "ga4" {
return fmt.Errorf("ad_conversions is for ga4: Google Ads measures through Google Analytics")
}
if a.AdConversions && !a.IsGated() {
return fmt.Errorf("ad_conversions needs consent: remove gated: false")
}
switch a.Provider {
case "plausible":
if a.Domain == "" {