@vermeulen.solutions/eventual-attendance 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0 (2026-11-24)
4
+
5
+ ### Changed
6
+
7
+ - **One home for places, the waiting list and opening.** When the event collection has the capacity fields, the Registrations panel shows them read-only and points to the event form, also on an entry whose fields are still empty (EmDash leaves empty fields out of the entry's data, so the panel used to offer its own inputs there, and a value saved in them silently won). The panel keeps most places per person, approval, reply-to and the questions. A collection without the fields keeps the inputs.
8
+ - Values an older version saved in the panel for these settings are pointed out in a banner with **Use the event's fields**, which removes them. Saving the panel no longer keeps a stored copy that equals the event's field; a differing one stays until that button is used, so saving another setting never opens or closes registration.
9
+ - On pages and other content that is not an event collection, the Registrations panel says one neutral line instead of inviting the site's maintainers to add the collection. A collection with the capacity fields that is not listed yet still gets the pointer to Site setup.
10
+ - New permission `schema:read` (read-only): the panel reads the event collection's fields. Administrators approve the plugin again when they update.
11
+ - Language packs: pins `@vermeulen.solutions/eventual-locales` 0.1.11, which has the new texts in all 21 languages.
12
+
13
+ ### Limits
14
+
15
+ - The panel is still offered on every collection: EmDash 1.5 can limit an editor panel only to collections fixed in the manifest, and the event collections are a setting of each site.
16
+ - Sidebar entries and the panel title stay English: EmDash 1.5 still takes them as plain strings from the manifest.
17
+
3
18
  ## 0.1.1 (2026-11-14)
4
19
 
5
20
  ### Changed
package/README.md CHANGED
@@ -4,7 +4,7 @@ Free registration for [Eventual RSVP](https://github.com/Vermeulen-Solutions/eve
4
4
 
5
5
  **Website:** [eventual.rsvp/registrations](https://eventual.rsvp/registrations/), with the [documentation](https://eventual.rsvp/docs/#attendance), [install guide](https://eventual.rsvp/install/) and [support](https://eventual.rsvp/support/).
6
6
 
7
- **Version 0.1.1.** Registrations, the waiting list, approval, reminders, Turnstile, door check-in and personal-data erasure work and are tested on EmDash's runtime test host, in the local browser test site on Node, and on a Cloudflare preview (its emails are not yet proven there).
7
+ **Version 0.2.0.** Registrations, the waiting list, approval, reminders, Turnstile, door check-in and personal-data erasure work and are tested on EmDash's runtime test host, in the local browser test site on Node, and on a Cloudflare preview (its emails are not yet proven there).
8
8
 
9
9
  ## What it does
10
10
 
@@ -72,6 +72,7 @@ export default defineConfig({
72
72
  | :--- | :--- |
73
73
  | `content:read` | Read the event (title, dates, published or not) a booking is for |
74
74
  | `email:send` | Confirmations, waitlist offers, approval notices, reminders |
75
+ | `schema:read` | See whether an event collection has the capacity fields, so the event panel leaves places, the waiting list and opening to the event form even while those fields are empty (read-only; added in 0.2.0) |
75
76
  | `network:request` to `challenges.cloudflare.com` | Check Cloudflare Turnstile tokens, only when you turn Turnstile on |
76
77
  | `network:request` to `cdn.jsdelivr.net` | Download the admin and email translations (language packs from `@vermeulen.solutions/eventual-locales`); each file is checked against a hash built into the plugin |
77
78
 
@@ -167,7 +168,9 @@ The `eventual-capacity` exporter writes these fields for you. It merges them int
167
168
  node node_modules/@vermeulen.solutions/eventual-capacity/scripts/export-capacity-fields.mjs --merge eventual-schema.json --output eventual-schema-with-capacity.json
168
169
  ```
169
170
 
170
- The fields are optional. **Capacity and the waitlist switch have one home:** when the event collection has these fields, they are edited in the event form and the **Registrations** panel of the event editor only reports them; a collection without them gets both settings in the panel instead. (A value saved in the panel by a script or an older version still wins until the panel is saved again; the panel says so.) **Registration is closed by default.** An event accepts registrations only when it is published *and* either its `inventory_mode` is `rsvp` or **Open for registration** is on in the panel. Turning that switch off closes registration without touching existing bookings.
171
+ The fields are optional. **Places, the waiting list and opening have one home:** when the event collection has these fields, they are edited in the event form, and the **Registrations** panel of the event editor only reports them, also on an entry where they are still empty. The panel keeps only the settings that have no field: most places per person, approval, reply-to and the questions. A collection without the fields gets the matching settings in the panel instead (**Places available**, **Waiting list when full**, **Open for registration**). A value saved in the panel by a script or an older version still wins; the panel says so and offers **Use the event's fields** to remove it. **Registration is closed by default.** An event accepts registrations only when it is published *and* either its `inventory_mode` is `rsvp` or, in a collection without that field, **Open for registration** is on in the panel. Closing registration never touches existing bookings.
172
+
173
+ The **Registrations** panel is offered by EmDash on every collection: its manifest can only limit a panel to collections fixed when the plugin is built, and the event collections are a setting of each site. On a page or other content the panel says one line, that registrations are not used there. Only a collection that has the capacity fields but is not listed in **Site setup** gets a pointer to that setting.
171
174
 
172
175
  ### 2. Registration form
173
176
 
package/dist/index.mjs CHANGED
@@ -7,11 +7,12 @@
7
7
  /** @type {import("emdash").PluginDescriptor} */
8
8
  const descriptor = Object.freeze({
9
9
  "id": "eventual-attendance",
10
- "version": "0.1.1",
10
+ "version": "0.2.0",
11
11
  "format": "standard",
12
12
  "entrypoint": "@vermeulen.solutions/eventual-attendance/sandbox",
13
13
  "capabilities": [
14
14
  "content:read",
15
+ "schema:read",
15
16
  "network:request",
16
17
  "email:send"
17
18
  ],
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "id": "eventual-attendance",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "declaredAccess": {
5
5
  "content": {
6
6
  "read": {}
7
7
  },
8
+ "schema": {
9
+ "read": {}
10
+ },
8
11
  "network": {
9
12
  "request": {
10
13
  "allowedHosts": [
@@ -19,6 +22,7 @@
19
22
  },
20
23
  "capabilities": [
21
24
  "content:read",
25
+ "schema:read",
22
26
  "network:request",
23
27
  "email:send"
24
28
  ],
package/dist/plugin.mjs CHANGED
@@ -1,8 +1,8 @@
1
- function e(e={}){let t=[];return new Headers(e.headers).forEach((e,n)=>t.push([n,e])),{__emdashPluginResponse:!0,status:e.status??200,headers:t,body:e.body??null}}function t(e){return e}var n=class extends Error{code=`RPC_BUDGET_EXCEEDED`;constructor(){super(`RPC budget exhausted for this invocation.`)}},r=class{limit;used=0;constructor(e=10){this.limit=e}get remaining(){return this.limit-this.used}has(e){return this.remaining>=e}async call(e){if(this.used>=this.limit)throw new n;return this.used++,e()}},i=class{parent;reserve;constructor(e,t){this.parent=e,this.reserve=t}get remaining(){return this.parent.remaining-this.reserve}has(e){return this.remaining>=e}call(e){return this.remaining<=0?Promise.reject(new n):this.parent.call(e)}};function a(e,t,n,r,i){let a=t?.[n];typeof a!=`function`||!e.has(1)||e.call(async()=>{await a.call(t,r,i)}).catch(()=>{})}function o(e){return typeof e==`string`?e.trim():``}function s(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)&&!Number.isNaN(Date.parse(`${e}T00:00:00Z`))}function c(e,t){let n=new Date(`${e}T00:00:00Z`);return n.setUTCDate(n.getUTCDate()+t),n.toISOString().slice(0,10)}function l(e,t=``){let n=o(e.timezone)||void 0;if(e.all_day===!0){let r=o(e.start_date)||o(e.start).slice(0,10),i=t?t.slice(0,10):r;if(!s(i))return null;let a=o(e.end_date),l=s(r)&&s(a)?Math.max(0,Math.round((Date.parse(a)-Date.parse(r))/864e5)):0;return{startsAt:`${i}T00:00:00.000Z`,allDay:!0,startDate:i,end:c(i,l),timezone:n}}let r=o(e.start)||o(e.start_date);if(!o(e.start)&&s(r))return l({...e,all_day:!0},t);let i=Date.parse(r),a=t?Date.parse(t):i;if(Number.isNaN(a))return null;let u=Date.parse(o(e.end)||o(e.end_date)),d=!Number.isNaN(i)&&!Number.isNaN(u)&&u>i?u-i:36e5;return{startsAt:new Date(a).toISOString(),allDay:!1,end:new Date(a+d).toISOString(),timezone:n}}function u(e){if(typeof e!=`string`)return;let t=e.trim();if(!(!t||t.length>100))try{return new Intl.DateTimeFormat(`en`,{timeZone:t}),t}catch{return}}function d(e,t,n){let r=String(e??``).trim();if(!r)return``;let i=new Date(r);if(Number.isNaN(i.getTime()))return r;let a=u(t),o=a??`UTC`,s=String(n??``).trim()||`en`,c=new Intl.DateTimeFormat(s,{timeZone:o,dateStyle:`medium`,timeStyle:`short`}).format(i);if(!a)return`${c} UTC`;let l=new Intl.DateTimeFormat(s,{timeZone:a,timeZoneName:`short`}).formatToParts(i).find(e=>e.type===`timeZoneName`)?.value;return l?`${c} ${l}`:`${c} UTC`}const f={Mon:0,Tue:1,Wed:2,Thu:3,Fri:4,Sat:5,Sun:6};function p(e,t){let n=String(e??``).trim();if(!n)return null;let r=new Date(n);if(Number.isNaN(r.getTime()))return null;let i=u(t)??`UTC`,a=new Intl.DateTimeFormat(`en-US`,{timeZone:i,weekday:`short`,hour:`2-digit`,hourCycle:`h23`}).formatToParts(r),o=a.find(e=>e.type===`weekday`)?.value??``,s=a.find(e=>e.type===`hour`)?.value??``,c=f[o],l=Number.parseInt(s,10)%24;return c===void 0||!Number.isFinite(l)?null:{weekday:c,hour:l}}const m=/^[a-z0-9_]{1,48}$/,h=`ledger:`;function g(e,t=``){let n=e.trim(),r=t.trim();return r?`${h}${n}:${r}`:`${h}${n}`}function _(e,t){let n=e.slice(7);return t&&n.endsWith(`:${t}`)?n.slice(0,-(t.length+1)):n}function v(e,t=``,n=``){return{capacity:e,poolKey:n,taken:0,held:0,waitlistCount:0,nextPosition:1,occurrenceStart:t,updatedAt:new Date().toISOString()}}function y(e,t=0){if(!e||typeof e!=`object`)return null;let n=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?Math.floor(e):0,r=u(e.timezone);return{capacity:typeof e.capacity==`number`?n(e.capacity):t,taken:n(e.taken),held:n(e.held),waitlistCount:n(e.waitlistCount),nextPosition:Math.max(1,n(e.nextPosition)),poolKey:typeof e.poolKey==`string`?e.poolKey:``,occurrenceStart:typeof e.occurrenceStart==`string`?e.occurrenceStart:``,...typeof e.label==`string`&&e.label?{label:e.label.slice(0,200)}:{},...r?{timezone:r}:{},...b(e.buckets,n),updatedAt:typeof e.updatedAt==`string`?e.updatedAt:new Date().toISOString()}}function b(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return{};let n={};for(let[r,i]of Object.entries(e).slice(0,100)){if(!m.test(r)||!i||typeof i!=`object`)continue;let e=i;n[r]={capacity:t(e.capacity),taken:t(e.taken),held:t(e.held)}}return Object.keys(n).length?{buckets:n}:{}}function x(e){return e.capacity===0?1/0:Math.max(0,e.capacity-e.taken-e.held)}async function S(e,t,n,r,i=2){for(let a=0;a<i&&t.has(2);a++){let i=await t.call(()=>e.getVersioned(n)),a=r(i?y(i.value):null);if(`abort`in a)return{applied:!1,result:a.abort,reason:`ABORTED`};let o={...a.next,updatedAt:new Date().toISOString()};if((await t.call(()=>e.compareAndSet(n,i?.revision??null,o))).applied)return{applied:!0,result:a.result,ledger:o}}return{applied:!1,reason:`CONFLICT`}}async function ee(e,t,n,r){let{quantity:i,capacity:a,allowWaitlist:o=!1,occurrenceStart:s=``,poolKey:c=``,label:l,timezone:d,maxAttempts:f=2}=r,p=u(d),m=await S(e,t,n,e=>{let t={...e??v(a,s,c),capacity:a,poolKey:e?.poolKey||c,...l?{label:l.slice(0,200)}:{},...p?{timezone:p}:{}};if(!(o&&t.waitlistCount>0)&&i<=x(t))return{next:{...t,taken:t.taken+i},result:{status:`going`}};if(o&&t.capacity>0){let e=t.nextPosition;return{next:{...t,waitlistCount:t.waitlistCount+i,nextPosition:e+1},result:{status:`waitlist`,position:e}}}return{abort:{status:`full`}}},f);if(m.applied){if(m.result.status===`waitlist`)return{ok:!0,status:`waitlist`,position:m.result.position,ledger:m.ledger};let e=x(m.ledger);return{ok:!0,status:`going`,remaining:Number.isFinite(e)?e:-1,ledger:m.ledger}}return{ok:!1,reason:m.reason===`ABORTED`?`FULL`:`BUSY`}}function C(e,t){if(!t)return e;let n={...e??{}};for(let[e,r]of Object.entries(t)){let t=n[e];if(!t)continue;let i=Math.min(r.heldToTaken??0,t.held);n[e]={capacity:t.capacity,taken:Math.max(0,t.taken-(r.taken??0))+i,held:Math.max(0,t.held-(r.held??0)-i)}}return n}async function w(e,t,n,r,i=2){let a=await S(e,t,n,e=>{if(!e)return{abort:!0};let t=Math.min(r.heldToTaken??0,e.held);return{next:{...e,taken:Math.max(0,e.taken-(r.taken??0))+t,held:Math.max(0,e.held-(r.held??0)-t),waitlistCount:Math.max(0,e.waitlistCount-(r.waitlistCount??0)),...e.buckets||r.buckets?{buckets:C(e.buckets,r.buckets)}:{}},result:!0}},i);return a.applied||a.reason===`ABORTED`}async function T(e,t,n,r){let i=await S(e,t,n,e=>!e||x(e)<r?{abort:`INSUFFICIENT_SEATS`}:{next:{...e,held:e.held+r,waitlistCount:Math.max(0,e.waitlistCount-r)},result:`HELD`},1);return i.applied?`HELD`:i.reason===`ABORTED`?`INSUFFICIENT_SEATS`:`CONFLICT`}async function E(e,t,n,r=2){let i;do{if(!e.has(r))return`TOO_LARGE`;let a=await e.call(()=>t(i));for(let{data:e}of a.items)if(n(e)===!1)return`BUSY`;i=a.hasMore?a.cursor:void 0}while(i);return`OK`}function D(e,t){let n=new Set([...Object.keys(e??{}),...Object.keys(t??{})]);for(let r of n){let n=e?.[r],i=t?.[r];if((n?.taken??0)!==(i?.taken??0)||(n?.held??0)!==(i?.held??0))return!1}return!0}async function O(e,t,n,r,o={}){let s=o.nowMs??Date.now(),c=o.quietMs??6e5,l=e=>{let t=e?Date.parse(e):NaN;return!Number.isFinite(t)||s-t>=c},u=await t.call(()=>e.getVersioned(n)),d=u?y(u.value):null;if(!u||!d)return{status:`MISSING`,key:n};if(!l(d.updatedAt))return{status:`BUSY`,key:n};let f=d.poolKey||_(n,d.occurrenceStart),p=await r({ledger:d,poolKey:f,occurrenceStart:d.occurrenceStart,budget:new i(t,1),isQuiet:l});if(p===`BUSY`||p===`TOO_LARGE`)return{status:p,key:n};let m;if(d.buckets||p.buckets){m={};for(let e of new Set([...Object.keys(d.buckets??{}),...Object.keys(p.buckets??{})]))m[e]={capacity:d.buckets?.[e]?.capacity??0,taken:p.buckets?.[e]?.taken??0,held:p.buckets?.[e]?.held??0}}let h={...d,poolKey:f,taken:p.taken,held:p.held,waitlistCount:p.waitlistCount??d.waitlistCount,nextPosition:Math.max(d.nextPosition,(p.maxPosition??0)+1),...m?{buckets:m}:{}};return h.taken===d.taken&&h.held===d.held&&h.waitlistCount===d.waitlistCount&&h.nextPosition===d.nextPosition&&h.poolKey===d.poolKey&&D(h.buckets,d.buckets)?{status:`UNCHANGED`,key:n}:(await t.call(()=>e.compareAndSet(n,u.revision,{...h,updatedAt:new Date(s).toISOString()}))).applied?(a(t,o.log,`warn`,`Seat ledger corrected from records`,{key:n,before:d,after:h}),{status:`CORRECTED`,key:n,before:d,after:h}):{status:`CONFLICT`,key:n}}async function k(e,t,n,r){let a=(await t.call(()=>e.list(h))).map(e=>e.key).sort();if(a.length===0)return null;let o=await t.call(()=>e.getVersioned(n)),s=a.find(e=>!o||e>o.value)??a[0],c=await r(s,new i(t,1));return await t.call(()=>e.compareAndSet(n,o?.revision??null,s)),c}const A=`state:schedules`;let j=null;function M(e){return e.map(e=>`${e.name}=${e.schedule}`).sort().join(`;`)}function te(e){return typeof e==`object`&&!!e&&e.v===1&&typeof e.fingerprint==`string`&&Array.isArray(e.done)}async function N(e,t,n,r){let i=M(r);if(j===i)return`OK`;if(!t||!n.has(1))return`SKIPPED`;let a=await n.call(()=>e.getVersioned(A));if(a?.value===i)return j=i,`OK`;let o=new Set(te(a?.value)&&a.value.fingerprint===i?a.value.done:[]),s=r.filter(e=>!o.has(`${e.name}=${e.schedule}`)),c=n.remaining-1;if(c<1)return`SKIPPED`;let l=s.slice(0,c);for(let e of l)await n.call(()=>t.schedule(e.name,{schedule:e.schedule})),o.add(`${e.name}=${e.schedule}`);let u=r.every(e=>o.has(`${e.name}=${e.schedule}`)),d=u?i:{v:1,fingerprint:i,done:[...o]};return await n.call(()=>e.compareAndSet(A,a?.revision??null,d)),u?(j=i,`SCHEDULED`):`PARTIAL`}function P(e){return Array.from(new Uint8Array(e),e=>e.toString(16).padStart(2,`0`)).join(``)}async function F(e,t,n){if(!e||e.length<32)throw Error(`HMAC secret is missing or too short.`);if(!/^[a-z][a-z0-9-]{0,31}$/.test(t))throw Error(`Token purpose must be a short lowercase word.`);let r=await crypto.subtle.importKey(`raw`,new TextEncoder().encode(e),{name:`HMAC`,hash:`SHA-256`},!1,[`sign`]),i=`${t}:${n.join(`:`)}`;return P(await crypto.subtle.sign(`HMAC`,r,new TextEncoder().encode(i)))}async function I(e){return P(await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e)))}function L(e){return typeof e==`string`&&/^[0-9a-f]{64}$/.test(e)}function ne(e,t,n){return`${e.replace(/\/+$/,``)}${t}#${Object.entries(n).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join(`&`)}`}function re(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``)}function ie(e){return typeof e==`string`&&/^[0-9a-f]{64}$/.test(e)}async function ae(e,t,n=`state:signing-key`){for(let r=0;r<2;r++){let r=await t.call(()=>e.getVersioned(n));if(r&&ie(r.value))return r.value;let i=re(32);if((await t.call(()=>e.compareAndSet(n,r?.revision??null,i))).applied)return i}throw Error(`Unable to initialise the signing secret.`)}function R(e,t){let n=typeof e==`string`?e.trim():``;return!n.startsWith(`/`)||n.startsWith(`//`)||/[\s#?\\]/.test(n)?t:n.slice(0,200)}function z(e,t=`events`){let n=typeof e==`string`?e.trim():``;return/^[a-z][a-z0-9_]{0,63}$/.test(n)?n:t}const B=/^[^\s@]{1,64}@[^\s@]{1,255}\.[^\s@]{2,}$/;function oe(e){return typeof e==`string`&&e.length<=320&&B.test(e)}function V(e){let t=typeof e==`string`?e.trim().toLowerCase():``;return oe(t)?t:``}function se(e){return typeof e==`string`&&/^[A-Za-z0-9_-]{16,64}$/.test(e)}function ce(e){return!e||e.trim().length===0}function le(e,t=Date.now()){if(!e||typeof e!=`number`)return!0;let n=t-e;return n>=1500&&n<=72e5}function ue(e){let t=e.data?.inventory_mode;return t===`rsvp`||t===`tickets`?t:null}function de(e){return ue(e)===`tickets`}function fe(e){return(e.translationGroup||e.id).trim()}Object.freeze([{slug:`inventory_mode`,label:`Seats managed by`,type:`select`,translatable:!1,validation:{options:[`rsvp`,`tickets`]}},{slug:`capacity`,label:`Capacity per date (0 = unlimited)`,type:`integer`,translatable:!1,defaultValue:0},{slug:`allow_waitlist`,label:`Allow waitlist when full`,type:`boolean`,translatable:!1,defaultValue:!1}]);function pe(e){return e.replace(/\\/g,`\\\\`).replace(/;/g,`\\;`).replace(/,/g,`\\,`).replace(/\r\n|\r|\n/g,`\\n`)}function me(e){let t=new TextEncoder,n=[],r=``,i=0;for(let a of e){let e=t.encode(a).length,o=n.length===0?75:74;i+e>o&&(n.push(r),r=``,i=0),r+=a,i+=e}return n.push(r),n.join(`\r
2
- `)}function he(e){return e.toISOString().replace(/[-:]/g,``).replace(/\.\d{3}/,``)}function ge(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))throw Error(`All-day dates must be YYYY-MM-DD.`);return e.replace(/-/g,``)}function _e(e){let t=new Date(`${e}T00:00:00Z`);return t.setUTCDate(t.getUTCDate()+1),t.toISOString().slice(0,10)}function ve(e,t=`-//Vermeulen Solutions//Eventual//EN`){let n=[`BEGIN:VCALENDAR`,`VERSION:2.0`,`PRODID:${t}`,`CALSCALE:GREGORIAN`,`METHOD:PUBLISH`,`BEGIN:VEVENT`];if(n.push(`UID:${pe(e.uid)}`),n.push(`DTSTAMP:${he(e.stamp??new Date)}`),e.allDay){let t=e.end||e.start;n.push(`DTSTART;VALUE=DATE:${ge(e.start)}`),n.push(`DTEND;VALUE=DATE:${ge(_e(t))}`)}else{let t=new Date(e.start);if(Number.isNaN(t.getTime()))throw Error(`Invalid start instant.`);let r=e.end?new Date(e.end):new Date(t.getTime()+36e5),i=Number.isNaN(r.getTime())||r<=t?new Date(t.getTime()+36e5):r;n.push(`DTSTART:${he(t)}`),n.push(`DTEND:${he(i)}`)}return n.push(`SUMMARY:${pe(e.title)}`),e.location&&n.push(`LOCATION:${pe(e.location)}`),e.description&&n.push(`DESCRIPTION:${pe(e.description)}`),e.url&&/^https?:\/\//.test(e.url)&&n.push(`URL:${e.url}`),n.push(`END:VEVENT`,`END:VCALENDAR`),n.map(me).join(`\r
1
+ function e(e={}){let t=[];return new Headers(e.headers).forEach((e,n)=>t.push([n,e])),{__emdashPluginResponse:!0,status:e.status??200,headers:t,body:e.body??null}}function t(e){return e}var n=class extends Error{code=`RPC_BUDGET_EXCEEDED`;constructor(){super(`RPC budget exhausted for this invocation.`)}},r=class{limit;used=0;constructor(e=10){this.limit=e}get remaining(){return this.limit-this.used}has(e){return this.remaining>=e}async call(e){if(this.used>=this.limit)throw new n;return this.used++,e()}},i=class{parent;reserve;constructor(e,t){this.parent=e,this.reserve=t}get remaining(){return this.parent.remaining-this.reserve}has(e){return this.remaining>=e}call(e){return this.remaining<=0?Promise.reject(new n):this.parent.call(e)}};function a(e,t,n,r,i){let a=t?.[n];typeof a!=`function`||!e.has(1)||e.call(async()=>{await a.call(t,r,i)}).catch(()=>{})}function o(e){return typeof e==`string`?e.trim():``}function s(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)&&!Number.isNaN(Date.parse(`${e}T00:00:00Z`))}function c(e,t){let n=new Date(`${e}T00:00:00Z`);return n.setUTCDate(n.getUTCDate()+t),n.toISOString().slice(0,10)}function l(e,t=``){let n=o(e.timezone)||void 0;if(e.all_day===!0){let r=o(e.start_date)||o(e.start).slice(0,10),i=t?t.slice(0,10):r;if(!s(i))return null;let a=o(e.end_date),l=s(r)&&s(a)?Math.max(0,Math.round((Date.parse(a)-Date.parse(r))/864e5)):0;return{startsAt:`${i}T00:00:00.000Z`,allDay:!0,startDate:i,end:c(i,l),timezone:n}}let r=o(e.start)||o(e.start_date);if(!o(e.start)&&s(r))return l({...e,all_day:!0},t);let i=Date.parse(r),a=t?Date.parse(t):i;if(Number.isNaN(a))return null;let u=Date.parse(o(e.end)||o(e.end_date)),d=!Number.isNaN(i)&&!Number.isNaN(u)&&u>i?u-i:36e5;return{startsAt:new Date(a).toISOString(),allDay:!1,end:new Date(a+d).toISOString(),timezone:n}}function u(e){if(typeof e!=`string`)return;let t=e.trim();if(!(!t||t.length>100))try{return new Intl.DateTimeFormat(`en`,{timeZone:t}),t}catch{return}}function d(e,t,n){let r=String(e??``).trim();if(!r)return``;let i=new Date(r);if(Number.isNaN(i.getTime()))return r;let a=u(t),o=a??`UTC`,s=String(n??``).trim()||`en`,c=new Intl.DateTimeFormat(s,{timeZone:o,dateStyle:`medium`,timeStyle:`short`}).format(i);if(!a)return`${c} UTC`;let l=new Intl.DateTimeFormat(s,{timeZone:a,timeZoneName:`short`}).formatToParts(i).find(e=>e.type===`timeZoneName`)?.value;return l?`${c} ${l}`:`${c} UTC`}const f={Mon:0,Tue:1,Wed:2,Thu:3,Fri:4,Sat:5,Sun:6};function p(e,t){let n=String(e??``).trim();if(!n)return null;let r=new Date(n);if(Number.isNaN(r.getTime()))return null;let i=u(t)??`UTC`,a=new Intl.DateTimeFormat(`en-US`,{timeZone:i,weekday:`short`,hour:`2-digit`,hourCycle:`h23`}).formatToParts(r),o=a.find(e=>e.type===`weekday`)?.value??``,s=a.find(e=>e.type===`hour`)?.value??``,c=f[o],l=Number.parseInt(s,10)%24;return c===void 0||!Number.isFinite(l)?null:{weekday:c,hour:l}}const m=/^[a-z0-9_]{1,48}$/,h=`ledger:`;function g(e,t=``){let n=e.trim(),r=t.trim();return r?`${h}${n}:${r}`:`${h}${n}`}function _(e,t){let n=e.slice(7);return t&&n.endsWith(`:${t}`)?n.slice(0,-(t.length+1)):n}function v(e,t=``,n=``){return{capacity:e,poolKey:n,taken:0,held:0,waitlistCount:0,nextPosition:1,occurrenceStart:t,updatedAt:new Date().toISOString()}}function y(e,t=0){if(!e||typeof e!=`object`)return null;let n=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?Math.floor(e):0,r=u(e.timezone);return{capacity:typeof e.capacity==`number`?n(e.capacity):t,taken:n(e.taken),held:n(e.held),waitlistCount:n(e.waitlistCount),nextPosition:Math.max(1,n(e.nextPosition)),poolKey:typeof e.poolKey==`string`?e.poolKey:``,occurrenceStart:typeof e.occurrenceStart==`string`?e.occurrenceStart:``,...typeof e.label==`string`&&e.label?{label:e.label.slice(0,200)}:{},...r?{timezone:r}:{},...b(e.buckets,n),updatedAt:typeof e.updatedAt==`string`?e.updatedAt:new Date().toISOString()}}function b(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return{};let n={};for(let[r,i]of Object.entries(e).slice(0,100)){if(!m.test(r)||!i||typeof i!=`object`)continue;let e=i;n[r]={capacity:t(e.capacity),taken:t(e.taken),held:t(e.held)}}return Object.keys(n).length?{buckets:n}:{}}function x(e){return e.capacity===0?1/0:Math.max(0,e.capacity-e.taken-e.held)}async function S(e,t,n,r,i=2){for(let a=0;a<i&&t.has(2);a++){let i=await t.call(()=>e.getVersioned(n)),a=r(i?y(i.value):null);if(`abort`in a)return{applied:!1,result:a.abort,reason:`ABORTED`};let o={...a.next,updatedAt:new Date().toISOString()};if((await t.call(()=>e.compareAndSet(n,i?.revision??null,o))).applied)return{applied:!0,result:a.result,ledger:o}}return{applied:!1,reason:`CONFLICT`}}async function C(e,t,n,r){let{quantity:i,capacity:a,allowWaitlist:o=!1,occurrenceStart:s=``,poolKey:c=``,label:l,timezone:d,maxAttempts:f=2}=r,p=u(d),m=await S(e,t,n,e=>{let t={...e??v(a,s,c),capacity:a,poolKey:e?.poolKey||c,...l?{label:l.slice(0,200)}:{},...p?{timezone:p}:{}};if(!(o&&t.waitlistCount>0)&&i<=x(t))return{next:{...t,taken:t.taken+i},result:{status:`going`}};if(o&&t.capacity>0){let e=t.nextPosition;return{next:{...t,waitlistCount:t.waitlistCount+i,nextPosition:e+1},result:{status:`waitlist`,position:e}}}return{abort:{status:`full`}}},f);if(m.applied){if(m.result.status===`waitlist`)return{ok:!0,status:`waitlist`,position:m.result.position,ledger:m.ledger};let e=x(m.ledger);return{ok:!0,status:`going`,remaining:Number.isFinite(e)?e:-1,ledger:m.ledger}}return{ok:!1,reason:m.reason===`ABORTED`?`FULL`:`BUSY`}}function w(e,t){if(!t)return e;let n={...e??{}};for(let[e,r]of Object.entries(t)){let t=n[e];if(!t)continue;let i=Math.min(r.heldToTaken??0,t.held);n[e]={capacity:t.capacity,taken:Math.max(0,t.taken-(r.taken??0))+i,held:Math.max(0,t.held-(r.held??0)-i)}}return n}async function T(e,t,n,r,i=2){let a=await S(e,t,n,e=>{if(!e)return{abort:!0};let t=Math.min(r.heldToTaken??0,e.held);return{next:{...e,taken:Math.max(0,e.taken-(r.taken??0))+t,held:Math.max(0,e.held-(r.held??0)-t),waitlistCount:Math.max(0,e.waitlistCount-(r.waitlistCount??0)),...e.buckets||r.buckets?{buckets:w(e.buckets,r.buckets)}:{}},result:!0}},i);return a.applied||a.reason===`ABORTED`}async function E(e,t,n,r){let i=await S(e,t,n,e=>!e||x(e)<r?{abort:`INSUFFICIENT_SEATS`}:{next:{...e,held:e.held+r,waitlistCount:Math.max(0,e.waitlistCount-r)},result:`HELD`},1);return i.applied?`HELD`:i.reason===`ABORTED`?`INSUFFICIENT_SEATS`:`CONFLICT`}async function D(e,t,n,r=2){let i;do{if(!e.has(r))return`TOO_LARGE`;let a=await e.call(()=>t(i));for(let{data:e}of a.items)if(n(e)===!1)return`BUSY`;i=a.hasMore?a.cursor:void 0}while(i);return`OK`}function O(e,t){let n=new Set([...Object.keys(e??{}),...Object.keys(t??{})]);for(let r of n){let n=e?.[r],i=t?.[r];if((n?.taken??0)!==(i?.taken??0)||(n?.held??0)!==(i?.held??0))return!1}return!0}async function k(e,t,n,r,o={}){let s=o.nowMs??Date.now(),c=o.quietMs??6e5,l=e=>{let t=e?Date.parse(e):NaN;return!Number.isFinite(t)||s-t>=c},u=await t.call(()=>e.getVersioned(n)),d=u?y(u.value):null;if(!u||!d)return{status:`MISSING`,key:n};if(!l(d.updatedAt))return{status:`BUSY`,key:n};let f=d.poolKey||_(n,d.occurrenceStart),p=await r({ledger:d,poolKey:f,occurrenceStart:d.occurrenceStart,budget:new i(t,1),isQuiet:l});if(p===`BUSY`||p===`TOO_LARGE`)return{status:p,key:n};let m;if(d.buckets||p.buckets){m={};for(let e of new Set([...Object.keys(d.buckets??{}),...Object.keys(p.buckets??{})]))m[e]={capacity:d.buckets?.[e]?.capacity??0,taken:p.buckets?.[e]?.taken??0,held:p.buckets?.[e]?.held??0}}let h={...d,poolKey:f,taken:p.taken,held:p.held,waitlistCount:p.waitlistCount??d.waitlistCount,nextPosition:Math.max(d.nextPosition,(p.maxPosition??0)+1),...m?{buckets:m}:{}};return h.taken===d.taken&&h.held===d.held&&h.waitlistCount===d.waitlistCount&&h.nextPosition===d.nextPosition&&h.poolKey===d.poolKey&&O(h.buckets,d.buckets)?{status:`UNCHANGED`,key:n}:(await t.call(()=>e.compareAndSet(n,u.revision,{...h,updatedAt:new Date(s).toISOString()}))).applied?(a(t,o.log,`warn`,`Seat ledger corrected from records`,{key:n,before:d,after:h}),{status:`CORRECTED`,key:n,before:d,after:h}):{status:`CONFLICT`,key:n}}async function A(e,t,n,r){let a=(await t.call(()=>e.list(h))).map(e=>e.key).sort();if(a.length===0)return null;let o=await t.call(()=>e.getVersioned(n)),s=a.find(e=>!o||e>o.value)??a[0],c=await r(s,new i(t,1));return await t.call(()=>e.compareAndSet(n,o?.revision??null,s)),c}const j=`state:schedules`;let M=null;function N(e){return e.map(e=>`${e.name}=${e.schedule}`).sort().join(`;`)}function ee(e){return typeof e==`object`&&!!e&&e.v===1&&typeof e.fingerprint==`string`&&Array.isArray(e.done)}async function P(e,t,n,r){let i=N(r);if(M===i)return`OK`;if(!t||!n.has(1))return`SKIPPED`;let a=await n.call(()=>e.getVersioned(j));if(a?.value===i)return M=i,`OK`;let o=new Set(ee(a?.value)&&a.value.fingerprint===i?a.value.done:[]),s=r.filter(e=>!o.has(`${e.name}=${e.schedule}`)),c=n.remaining-1;if(c<1)return`SKIPPED`;let l=s.slice(0,c);for(let e of l)await n.call(()=>t.schedule(e.name,{schedule:e.schedule})),o.add(`${e.name}=${e.schedule}`);let u=r.every(e=>o.has(`${e.name}=${e.schedule}`)),d=u?i:{v:1,fingerprint:i,done:[...o]};return await n.call(()=>e.compareAndSet(j,a?.revision??null,d)),u?(M=i,`SCHEDULED`):`PARTIAL`}function F(e){return Array.from(new Uint8Array(e),e=>e.toString(16).padStart(2,`0`)).join(``)}async function I(e,t,n){if(!e||e.length<32)throw Error(`HMAC secret is missing or too short.`);if(!/^[a-z][a-z0-9-]{0,31}$/.test(t))throw Error(`Token purpose must be a short lowercase word.`);let r=await crypto.subtle.importKey(`raw`,new TextEncoder().encode(e),{name:`HMAC`,hash:`SHA-256`},!1,[`sign`]),i=`${t}:${n.join(`:`)}`;return F(await crypto.subtle.sign(`HMAC`,r,new TextEncoder().encode(i)))}async function L(e){return F(await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e)))}function R(e){return typeof e==`string`&&/^[0-9a-f]{64}$/.test(e)}function te(e,t,n){return`${e.replace(/\/+$/,``)}${t}#${Object.entries(n).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join(`&`)}`}function ne(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``)}function re(e){return typeof e==`string`&&/^[0-9a-f]{64}$/.test(e)}async function ie(e,t,n=`state:signing-key`){for(let r=0;r<2;r++){let r=await t.call(()=>e.getVersioned(n));if(r&&re(r.value))return r.value;let i=ne(32);if((await t.call(()=>e.compareAndSet(n,r?.revision??null,i))).applied)return i}throw Error(`Unable to initialise the signing secret.`)}function ae(e,t){let n=typeof e==`string`?e.trim():``;return!n.startsWith(`/`)||n.startsWith(`//`)||/[\s#?\\]/.test(n)?t:n.slice(0,200)}function z(e,t=`events`){let n=typeof e==`string`?e.trim():``;return/^[a-z][a-z0-9_]{0,63}$/.test(n)?n:t}const B=/^[^\s@]{1,64}@[^\s@]{1,255}\.[^\s@]{2,}$/;function oe(e){return typeof e==`string`&&e.length<=320&&B.test(e)}function se(e){let t=typeof e==`string`?e.trim().toLowerCase():``;return oe(t)?t:``}function ce(e){return typeof e==`string`&&/^[A-Za-z0-9_-]{16,64}$/.test(e)}function le(e){return!e||e.trim().length===0}function ue(e,t=Date.now()){if(!e||typeof e!=`number`)return!0;let n=t-e;return n>=1500&&n<=72e5}function de(e){let t=e.data?.inventory_mode;return t===`rsvp`||t===`tickets`?t:null}function fe(e){return de(e)===`tickets`}function pe(e){return(e.translationGroup||e.id).trim()}Object.freeze([{slug:`inventory_mode`,label:`Seats managed by`,type:`select`,translatable:!1,validation:{options:[`rsvp`,`tickets`]}},{slug:`capacity`,label:`Capacity per date (0 = unlimited)`,type:`integer`,translatable:!1,defaultValue:0},{slug:`allow_waitlist`,label:`Allow waitlist when full`,type:`boolean`,translatable:!1,defaultValue:!1}]);function me(e){return e.replace(/\\/g,`\\\\`).replace(/;/g,`\\;`).replace(/,/g,`\\,`).replace(/\r\n|\r|\n/g,`\\n`)}function he(e){let t=new TextEncoder,n=[],r=``,i=0;for(let a of e){let e=t.encode(a).length,o=n.length===0?75:74;i+e>o&&(n.push(r),r=``,i=0),r+=a,i+=e}return n.push(r),n.join(`\r
2
+ `)}function ge(e){return e.toISOString().replace(/[-:]/g,``).replace(/\.\d{3}/,``)}function _e(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))throw Error(`All-day dates must be YYYY-MM-DD.`);return e.replace(/-/g,``)}function ve(e){let t=new Date(`${e}T00:00:00Z`);return t.setUTCDate(t.getUTCDate()+1),t.toISOString().slice(0,10)}function ye(e,t=`-//Vermeulen Solutions//Eventual//EN`){let n=[`BEGIN:VCALENDAR`,`VERSION:2.0`,`PRODID:${t}`,`CALSCALE:GREGORIAN`,`METHOD:PUBLISH`,`BEGIN:VEVENT`];if(n.push(`UID:${me(e.uid)}`),n.push(`DTSTAMP:${ge(e.stamp??new Date)}`),e.allDay){let t=e.end||e.start;n.push(`DTSTART;VALUE=DATE:${_e(e.start)}`),n.push(`DTEND;VALUE=DATE:${_e(ve(t))}`)}else{let t=new Date(e.start);if(Number.isNaN(t.getTime()))throw Error(`Invalid start instant.`);let r=e.end?new Date(e.end):new Date(t.getTime()+36e5),i=Number.isNaN(r.getTime())||r<=t?new Date(t.getTime()+36e5):r;n.push(`DTSTART:${ge(t)}`),n.push(`DTEND:${ge(i)}`)}return n.push(`SUMMARY:${me(e.title)}`),e.location&&n.push(`LOCATION:${me(e.location)}`),e.description&&n.push(`DESCRIPTION:${me(e.description)}`),e.url&&/^https?:\/\//.test(e.url)&&n.push(`URL:${e.url}`),n.push(`END:VEVENT`,`END:VCALENDAR`),n.map(he).join(`\r
3
3
  `)+`\r
4
- `}const ye=[`text`,`textarea`,`email`,`phone`,`number`,`date`,`checkbox`,`select`],H=Object.freeze({questions:20,label:400,options:30,option:80,text:500,textarea:2e3});function be(e){return e.toLowerCase().normalize(`NFKD`).replace(/[̀-ͯ]/g,``).replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,40)||`question`}function xe(e,t){let n=e;for(let r=2;t.has(n);r++)n=`${e}_${r}`;return t.add(n),n}function Se(e){let t=[],n=[],r=[],i=new Set;return(e??``).split(/\r\n|\r|\n/).forEach((e,a)=>{let o=e.trim();if(!o||o.startsWith(`#`))return;let s=a+1,c=`Line ${s}`,[l=``,u=``,d=``,f=``]=o.split(`|`).map(e=>e.trim());if(!l){n.push(`${c}: start with the question's label.`),r.push({line:s,code:`NO_LABEL`});return}if(l.length>H.label){n.push(`${c}: the label is longer than ${H.label} characters.`),r.push({line:s,code:`LABEL_TOO_LONG`,limit:H.label});return}let p=u.toLowerCase()||`text`;if(!ye.includes(p)){n.push(`${c}: "${u}" isn't a type. Use one of: ${ye.join(`, `)}.`),r.push({line:s,code:`BAD_TYPE`,value:u});return}let m=d.toLowerCase();if(m&&m!==`required`&&m!==`optional`){n.push(`${c}: write "required" or "optional" in the third column.`),r.push({line:s,code:`BAD_REQUIRED`});return}let h={id:xe(be(l),i),label:l,type:p,required:m===`required`};if(p===`select`){let e=[...new Set(f.split(`,`).map(e=>e.trim()).filter(Boolean))];if(e.length===0){n.push(`${c}: a select question needs options, for example "S, M, L".`),r.push({line:s,code:`NO_OPTIONS`});return}if(e.length>H.options){n.push(`${c}: at most ${H.options} options.`),r.push({line:s,code:`TOO_MANY_OPTIONS`,limit:H.options});return}if(e.some(e=>e.length>H.option)){n.push(`${c}: options can be at most ${H.option} characters.`),r.push({line:s,code:`OPTION_TOO_LONG`,limit:H.option});return}h.options=e}else if(f){n.push(`${c}: only select questions take options.`),r.push({line:s,code:`OPTIONS_NOT_ALLOWED`});return}t.push(h)}),t.length>H.questions&&(n.push(`At most ${H.questions} questions per event.`),r.push({line:null,code:`TOO_MANY_QUESTIONS`,limit:H.questions})),{questions:t.slice(0,H.questions),errors:n,issues:r}}function Ce(e){if(!Array.isArray(e))return[];let t=new Set,n=[];for(let r of e.slice(0,H.questions)){if(!r||typeof r!=`object`)continue;let e=r,i=typeof e.label==`string`?e.label.trim().slice(0,H.label):``,a=ye.includes(e.type)?e.type:null;if(!i||!a)continue;let o=typeof e.id==`string`&&/^[a-z0-9_]{1,48}$/.test(e.id)&&!t.has(e.id)?(t.add(e.id),e.id):xe(be(i),t),s=a===`select`&&Array.isArray(e.options)?e.options.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>e.trim().slice(0,H.option)).slice(0,H.options):void 0;a===`select`&&!s?.length||n.push({id:o,label:i,type:a,required:e.required===!0,...s?{options:s}:{}})}return n}const we=/^[^\s@]{1,64}@[^\s@]{1,255}\.[^\s@]{2,}$/,Te=/^\+?[0-9 ()./-]{5,30}$/;function Ee(e,t){let n=t&&typeof t==`object`&&!Array.isArray(t)?t:{},r=[],i={};for(let t of e){let e=n[t.id];if(t.type===`checkbox`){let n=e===!0||e===`true`||e===`on`;t.required&&!n?i[t.id]=`REQUIRED`:r.push({id:t.id,label:t.label,value:n});continue}let a=typeof e==`string`?e.trim():typeof e==`number`&&Number.isFinite(e)?String(e):``;if(!a){t.required&&(i[t.id]=`REQUIRED`);continue}let o=t.type===`textarea`?H.textarea:H.text;if(a.length>o){i[t.id]=`TOO_LONG`;continue}let s=a,c=!0;switch(t.type){case`email`:c=we.test(a),s=a.toLowerCase();break;case`phone`:c=Te.test(a);break;case`number`:s=Number(a),c=Number.isFinite(s);break;case`date`:c=/^\d{4}-\d{2}-\d{2}$/.test(a)&&!Number.isNaN(Date.parse(`${a}T00:00:00Z`));break;case`select`:c=t.options?.includes(a)??!1;break;case`text`:c=!/[\r\n]/.test(a);break;default:break}c?r.push({id:t.id,label:t.label,value:s}):i[t.id]=`INVALID`}return Object.keys(i).length?{ok:!1,errors:i}:{ok:!0,answers:r}}function De(e){return(e??[]).map(e=>`${e.label}: ${typeof e.value==`boolean`?e.value?`Yes`:`No`:e.value}`).join(`; `)}const Oe=`challenges.cloudflare.com`,ke=`https://${Oe}/turnstile/v0/siteverify`;`${Oe}`;const Ae=/^[A-Za-z0-9_-]{10,100}$/;function je(e){let t=typeof e==`string`?e.trim():``;return Ae.test(t)?t:``}function Me(e){return typeof e==`string`&&e.length>0&&e.length<=2048&&!/\s/.test(e)}async function Ne(e,t,n){if(!Me(n.token))return{ok:!1,reason:`missing-input-response`};let r=new URLSearchParams({secret:n.secret,response:n.token});n.remoteIp&&r.set(`remoteip`,n.remoteIp);let i;try{i=await t.call(()=>e(ke,{method:`POST`,headers:{"content-type":`application/x-www-form-urlencoded`},body:r.toString()}))}catch(e){if(e?.code===`RPC_BUDGET_EXCEEDED`)throw e;return{ok:!0,verified:!1,reason:`unreachable`}}if(i.status>=500)return{ok:!0,verified:!1,reason:`http-${i.status}`};let a=await i.json().catch(()=>null);if(a?.success===!0)return{ok:!0,verified:!0};let o=Array.isArray(a?.[`error-codes`])?a[`error-codes`].map(String):[];return o.includes(`internal-error`)?{ok:!0,verified:!1,reason:`internal-error`}:{ok:!1,reason:o[0]??(a?`rejected`:`bad-response`)}}function Pe(e,t,n,r){return F(e,`cancel`,[t,n,r])}function Fe(e,t,n,r){return F(e,`claim`,[t,n,r])}const Ie=I,Le=I;function Re(e){let t=Number(e);return Number.isSafeInteger(t)&&t>0?t:0}async function ze(e,t,n){let r=Ue(await t.call(()=>e.get(fe(n)))),i=n.data??{},a=i.inventory_mode===`rsvp`;return{config:{enabled:typeof r?.enabled==`boolean`?r.enabled:a,capacity:Re(r?.capacity??i.capacity),maxPerRegistration:Be(r?.maxPerRegistration),allowWaitlist:!!(r?.allowWaitlist??i.allow_waitlist??!1),requireApproval:!!(r?.requireApproval??!1),approvalHours:Ve(r?.approvalHours),replyTo:V(r?.replyTo),questions:Ce(r?.questions)},source:typeof r?.enabled==`boolean`?`panel`:a?`event-field`:`default`,stored:r}}function Be(e){let t=Number(e);return Number.isSafeInteger(t)&&t>=1?Math.min(20,t):4}function Ve(e){if(typeof e!=`number`&&(typeof e!=`string`||!e.trim()))return 48;let t=Number(e);return Number.isSafeInteger(t)?Math.max(1,Math.min(720,t)):48}function He(e,t,n){let r=e+t*36e5,i=n?Date.parse(n):NaN,a=Number.isFinite(i)?Math.min(r,i):r;return new Date(a).toISOString()}function Ue(e){if(!e||typeof e!=`object`)return null;let t=e.data;return t&&typeof t==`object`?t:e}const We=new Map;function Ge(e){let t=0,n=(n,r)=>{let a=[],o=``,s=()=>{o&&a.push(o),o=``};for(;t<e.length;){let c=e[t];if(c===`{`)s(),t++,a.push(i(n));else if(c===`}`&&r)break;else c===`#`&&n?(s(),a.push(0),t++):(o+=c,t++)}return s(),a},r=()=>{for(;e[t]===` `;)t++;let n=t;for(;t<e.length&&!/[\s,{}]/.test(e[t]);)t++;let r=e.slice(n,t);for(;e[t]===` `||e[t]===`
5
- `;)t++;return r},i=i=>{let a=r();if(e[t]===`}`)return t++,{a};t++;let o=r();if(o!==`plural`&&o!==`select`){let n=e[t]===`,`?(t++,r()):``;for(;t<e.length&&e[t]!==`}`;)t++;return t++,{a,t:o,s:n}}t++;let s={};for(;;){let a=r();if(!a||e[t]!==`{`)break;t++,s[a]=n(o===`plural`||i,!0),t++}for(;t<e.length&&e[t]!==`}`;)t++;return t++,{a,p:o===`plural`,o:s}};return n(!1,!1)}function Ke(e,t,n,r){let i=``;for(let a of e)if(typeof a==`string`)i+=a;else if(a===0)i+=r===void 0?`#`:new Intl.NumberFormat(n).format(r);else if(a.t)i+=qe(a,t[a.a],n);else if(!a.o)i+=a.a in t?String(t[a.a]):`{${a.a}}`;else{let e=t[a.a],o;if(a.p){let r=Number(e),s=`other`;try{s=new Intl.PluralRules(n).select(r)}catch{}o=a.o[`=`+r]??a.o[s]??a.o.other,i+=Ke(o??[],t,n,r)}else o=a.o[String(e)]??a.o.other,i+=Ke(o??[],t,n,r)}return i}function qe(e,t,n){if(t==null||t===``)return``;try{if(e.t===`number`)return new Intl.NumberFormat(n).format(Number(t));if(e.t===`date`){let r=String(t),i=new Date(/^\d{4}-\d{2}-\d{2}$/.test(r)?r+`T00:00:00Z`:r);return Number.isNaN(i.getTime())?r:new Intl.DateTimeFormat(n,{dateStyle:e.s||`medium`,...r.length===10?{timeZone:`UTC`}:{}}).format(i)}}catch{}return String(t)}function Je(e,t={},n=`en`){if(!e.includes(`{`))return e;let r=We.get(e);return r||(r=Ge(e),We.size>4e3&&We.clear(),We.set(e,r)),Ke(r,t,n)}const Ye=[`fr`,`de`,`nl`,`es`,`it`,`pt`,`pt-BR`,`pl`,`cs`,`sv`,`da`,`nb`,`fi`,`ja`,`zh-CN`,`ko`,`tr`,`uk`,`ar`,`he`],Xe={no:`nb`,nn:`nb`,iw:`he`,"zh-Hans":`zh-CN`,"zh-SG":`zh-CN`,"zh-MY":`zh-CN`};function U(e,t=Ye){let n;try{n=Intl.getCanonicalLocales(String(e||``).trim().replace(/_/g,`-`))[0]}catch{}if(!n)return`en`;let[r,...i]=n.split(`-`),a=i.find(e=>e.length===4),o=i.find(e=>e.length===2||/^\d{3}$/.test(e)),s=[];if(r===`zh`){if(a===`Hant`||!a&&[`TW`,`HK`,`MO`].includes(o))return`en`;s.push(`zh-CN`)}o&&s.push(`${r}-${o}`,Xe[`${r}-${o}`]),a&&s.push(Xe[`${r}-${a}`]),s.push(r,Xe[r]);for(let e of s)if(e===`en`||t.includes(e))return e;return`en`}function Ze(e){return/^(ar|he|fa|ur)\b/.test(String(e))?`rtl`:`ltr`}function Qe(e,t,n=`en`,r=``){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e)){let e=r+a;if(typeof o==`string`){let r=t?.[e]||o;i[a]=r.includes(`{`)?Je(r,{},n):r}else if(Array.isArray(o)&&typeof o[0]==`string`){let[r,...s]=o,c=t?.[e]||r;i[a]=s.length?(...e)=>Je(c,Object.fromEntries(s.map((t,n)=>[t,e[n]])),n):(e={})=>Je(c,e,n)}else o&&typeof o==`object`?i[a]=Qe(o,t,n,e+`.`):i[a]=o}return i}const $e=new Map;function et(e,t){return`https://cdn.jsdelivr.net/npm/${e.package}@${e.version}/catalogs/${e.namespace}/${t}.json`}const tt=(e,t)=>`i18n:${e.namespace}:${e.version}:${t}`;async function nt(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t,0,16))).slice(0,22)}async function rt(e,t,n){let r=await e.http.fetch(et(t,n));if(!r.ok)return null;let i=await r.text();if(await nt(i)!==t.hashes[n])return null;let a=JSON.parse(i);return!a||typeof a!=`object`?null:(await e.kv.set(tt(t,n),a),$e.set(tt(t,n),{messages:a}),a)}async function it(e,t,n,r){let i=U(n,Object.keys(t.hashes));if(i===`en`)return null;let a=tt(t,i),o=$e.get(a);if(o&&(o.messages||Date.now()<o.retry))return o.messages;let s=null;try{if(r&&r()<1)return null;if(s=await e.kv?.get(a)??null,!s){if(!e.http||!e.kv||r&&r()<2)return null;s=await rt(e,t,i)}}catch{s=null}return s&&typeof s!=`object`&&(s=null),$e.set(a,s?{messages:s}:{messages:null,retry:Date.now()+3e5}),s}async function at(e,t,n,r){let i=Object.keys(t.hashes);if(!i.length||!e.kv||!e.http||r&&r()<4)return{added:0,missing:i.length};let a=tt(t,`index`),o=await e.kv.get(a),s=new Set(Array.isArray(o)?o:[]),c=[...new Set([U(n,i),...i])].filter(e=>e!==`en`&&!s.has(e)),l=0;for(let n of c){if(r&&r()<3)break;try{await rt(e,t,n)&&(s.add(n),l++)}catch{}}return l&&await e.kv.set(a,[...s]),{added:l,missing:c.length-l}}var ot={package:`@vermeulen.solutions/eventual-locales`,version:`0.1.10`,namespace:`attendance`,hashes:{ar:`mqO7FQfyBOVOpmIGM+PUcA`,cs:`sV0M3t5ob6sSBQvnSrKkCA`,da:`AkZ+3Q0n2UbyDri9uQySjw`,de:`/X5PAwNb3pACqGQhxiR5rg`,es:`IlO1xa4zSCQ2NOtGr5i4zw`,fi:`wZrh1jiQdPsxKR9mLclvgA`,fr:`eyLlsldAx2dzEY0B1huhew`,he:`Kpn4YVioIkhgL3LOCBLKXg`,it:`elHXuVmvyx5kDSwjLlhmAQ`,ja:`z+CDZDup7De959N049IWNw`,ko:`OfcuozLv0MrYedFI+Blokg`,nb:`g/cHIy1tQob+1/JKariuig`,nl:`4E/lI1+KsijOjcDupkPnBA`,pl:`ODbRML6Vuhu6H/He6Acs9Q`,"pt-BR":`Y1laV4PRMFgEVawKYFNuMw`,pt:`2Wt9JuABs3y9JdnSwNwO7A`,sv:`tE+18p3PzFNF8w2Dmfg15Q`,tr:`H+mdJc/ExSMNd966tZtq5Q`,uk:`2THBqyxoOki1sgKWDb3tPQ`,"zh-CN":`/02/CXMq4ANrP5+XALSZBw`}};const st=`attendance-language-packs`;function ct(e,t){let n=e.kv,r=e.http;return{kv:n&&{get:e=>t.call(()=>n.get(e)),set:(e,r)=>t.call(()=>n.set(e,r))},http:r&&{fetch:e=>t.call(()=>r.fetch(e))}}}async function lt(e,t,n,r=0){if(U(n)===`en`||!e.kv)return null;let{kv:i}=ct(e,t);return it({kv:i},ot,n,()=>Math.min(t.remaining-r,1))}let ut=!1;async function dt(e,t){if(ut)return{added:0,missing:0};let n=await at(ct(e,t),ot,e.site?.locale,()=>t.remaining);return ut=n.missing===0&&Object.keys(ot.hashes).length>0,n}const ft=[`en`,...Ye];function W(e,t=`en`){let n=typeof e==`string`?e.trim().slice(0,35):``;if(!n)return t;let r=U(n);return r===`en`&&!/^en\b/i.test(n)?t:r}function pt(e){return e===`fr`?`fr-CH`:e}function mt(e){try{let t=new Intl.DisplayNames([e],{type:`language`}).of(e)??e;return t.charAt(0).toLocaleUpperCase(e)+t.slice(1)}catch{return e}}const ht={fallbackTitle:`the event`,soon:`soon`,singleEvent:`single event`,rsvpConfirmed:{subject:[`RSVP confirmed: {title}`],text:[`Hi {name},
4
+ `}const be=[`text`,`textarea`,`email`,`phone`,`number`,`date`,`checkbox`,`select`],V=Object.freeze({questions:20,label:400,options:30,option:80,text:500,textarea:2e3});function xe(e){return e.toLowerCase().normalize(`NFKD`).replace(/[̀-ͯ]/g,``).replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,40)||`question`}function Se(e,t){let n=e;for(let r=2;t.has(n);r++)n=`${e}_${r}`;return t.add(n),n}function Ce(e){let t=[],n=[],r=[],i=new Set;return(e??``).split(/\r\n|\r|\n/).forEach((e,a)=>{let o=e.trim();if(!o||o.startsWith(`#`))return;let s=a+1,c=`Line ${s}`,[l=``,u=``,d=``,f=``]=o.split(`|`).map(e=>e.trim());if(!l){n.push(`${c}: start with the question's label.`),r.push({line:s,code:`NO_LABEL`});return}if(l.length>V.label){n.push(`${c}: the label is longer than ${V.label} characters.`),r.push({line:s,code:`LABEL_TOO_LONG`,limit:V.label});return}let p=u.toLowerCase()||`text`;if(!be.includes(p)){n.push(`${c}: "${u}" isn't a type. Use one of: ${be.join(`, `)}.`),r.push({line:s,code:`BAD_TYPE`,value:u});return}let m=d.toLowerCase();if(m&&m!==`required`&&m!==`optional`){n.push(`${c}: write "required" or "optional" in the third column.`),r.push({line:s,code:`BAD_REQUIRED`});return}let h={id:Se(xe(l),i),label:l,type:p,required:m===`required`};if(p===`select`){let e=[...new Set(f.split(`,`).map(e=>e.trim()).filter(Boolean))];if(e.length===0){n.push(`${c}: a select question needs options, for example "S, M, L".`),r.push({line:s,code:`NO_OPTIONS`});return}if(e.length>V.options){n.push(`${c}: at most ${V.options} options.`),r.push({line:s,code:`TOO_MANY_OPTIONS`,limit:V.options});return}if(e.some(e=>e.length>V.option)){n.push(`${c}: options can be at most ${V.option} characters.`),r.push({line:s,code:`OPTION_TOO_LONG`,limit:V.option});return}h.options=e}else if(f){n.push(`${c}: only select questions take options.`),r.push({line:s,code:`OPTIONS_NOT_ALLOWED`});return}t.push(h)}),t.length>V.questions&&(n.push(`At most ${V.questions} questions per event.`),r.push({line:null,code:`TOO_MANY_QUESTIONS`,limit:V.questions})),{questions:t.slice(0,V.questions),errors:n,issues:r}}function we(e){if(!Array.isArray(e))return[];let t=new Set,n=[];for(let r of e.slice(0,V.questions)){if(!r||typeof r!=`object`)continue;let e=r,i=typeof e.label==`string`?e.label.trim().slice(0,V.label):``,a=be.includes(e.type)?e.type:null;if(!i||!a)continue;let o=typeof e.id==`string`&&/^[a-z0-9_]{1,48}$/.test(e.id)&&!t.has(e.id)?(t.add(e.id),e.id):Se(xe(i),t),s=a===`select`&&Array.isArray(e.options)?e.options.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>e.trim().slice(0,V.option)).slice(0,V.options):void 0;a===`select`&&!s?.length||n.push({id:o,label:i,type:a,required:e.required===!0,...s?{options:s}:{}})}return n}const Te=/^[^\s@]{1,64}@[^\s@]{1,255}\.[^\s@]{2,}$/,Ee=/^\+?[0-9 ()./-]{5,30}$/;function De(e,t){let n=t&&typeof t==`object`&&!Array.isArray(t)?t:{},r=[],i={};for(let t of e){let e=n[t.id];if(t.type===`checkbox`){let n=e===!0||e===`true`||e===`on`;t.required&&!n?i[t.id]=`REQUIRED`:r.push({id:t.id,label:t.label,value:n});continue}let a=typeof e==`string`?e.trim():typeof e==`number`&&Number.isFinite(e)?String(e):``;if(!a){t.required&&(i[t.id]=`REQUIRED`);continue}let o=t.type===`textarea`?V.textarea:V.text;if(a.length>o){i[t.id]=`TOO_LONG`;continue}let s=a,c=!0;switch(t.type){case`email`:c=Te.test(a),s=a.toLowerCase();break;case`phone`:c=Ee.test(a);break;case`number`:s=Number(a),c=Number.isFinite(s);break;case`date`:c=/^\d{4}-\d{2}-\d{2}$/.test(a)&&!Number.isNaN(Date.parse(`${a}T00:00:00Z`));break;case`select`:c=t.options?.includes(a)??!1;break;case`text`:c=!/[\r\n]/.test(a);break;default:break}c?r.push({id:t.id,label:t.label,value:s}):i[t.id]=`INVALID`}return Object.keys(i).length?{ok:!1,errors:i}:{ok:!0,answers:r}}function Oe(e){return(e??[]).map(e=>`${e.label}: ${typeof e.value==`boolean`?e.value?`Yes`:`No`:e.value}`).join(`; `)}const ke=`challenges.cloudflare.com`,Ae=`https://${ke}/turnstile/v0/siteverify`;`${ke}`;const je=/^[A-Za-z0-9_-]{10,100}$/;function Me(e){let t=typeof e==`string`?e.trim():``;return je.test(t)?t:``}function Ne(e){return typeof e==`string`&&e.length>0&&e.length<=2048&&!/\s/.test(e)}async function Pe(e,t,n){if(!Ne(n.token))return{ok:!1,reason:`missing-input-response`};let r=new URLSearchParams({secret:n.secret,response:n.token});n.remoteIp&&r.set(`remoteip`,n.remoteIp);let i;try{i=await t.call(()=>e(Ae,{method:`POST`,headers:{"content-type":`application/x-www-form-urlencoded`},body:r.toString()}))}catch(e){if(e?.code===`RPC_BUDGET_EXCEEDED`)throw e;return{ok:!0,verified:!1,reason:`unreachable`}}if(i.status>=500)return{ok:!0,verified:!1,reason:`http-${i.status}`};let a=await i.json().catch(()=>null);if(a?.success===!0)return{ok:!0,verified:!0};let o=Array.isArray(a?.[`error-codes`])?a[`error-codes`].map(String):[];return o.includes(`internal-error`)?{ok:!0,verified:!1,reason:`internal-error`}:{ok:!1,reason:o[0]??(a?`rejected`:`bad-response`)}}function Fe(e,t,n,r){return I(e,`cancel`,[t,n,r])}function Ie(e,t,n,r){return I(e,`claim`,[t,n,r])}const Le=L,Re=L;function ze(e){let t=Number(e);return Number.isSafeInteger(t)&&t>0?t:0}async function Be(e,t,n){let r=We(await t.call(()=>e.get(pe(n)))),i=n.data??{},a=i.inventory_mode===`rsvp`;return{config:{enabled:typeof r?.enabled==`boolean`?r.enabled:a,capacity:ze(r?.capacity??i.capacity),maxPerRegistration:Ve(r?.maxPerRegistration),allowWaitlist:!!(r?.allowWaitlist??i.allow_waitlist??!1),requireApproval:!!(r?.requireApproval??!1),approvalHours:He(r?.approvalHours),replyTo:se(r?.replyTo),questions:we(r?.questions)},source:typeof r?.enabled==`boolean`?`panel`:a?`event-field`:`default`,stored:r}}function Ve(e){let t=Number(e);return Number.isSafeInteger(t)&&t>=1?Math.min(20,t):4}function He(e){if(typeof e!=`number`&&(typeof e!=`string`||!e.trim()))return 48;let t=Number(e);return Number.isSafeInteger(t)?Math.max(1,Math.min(720,t)):48}function Ue(e,t,n){let r=e+t*36e5,i=n?Date.parse(n):NaN,a=Number.isFinite(i)?Math.min(r,i):r;return new Date(a).toISOString()}function We(e){if(!e||typeof e!=`object`)return null;let t=e.data;return t&&typeof t==`object`?t:e}const Ge=new Map;function Ke(e){let t=0,n=(n,r)=>{let a=[],o=``,s=()=>{o&&a.push(o),o=``};for(;t<e.length;){let c=e[t];if(c===`{`)s(),t++,a.push(i(n));else if(c===`}`&&r)break;else c===`#`&&n?(s(),a.push(0),t++):(o+=c,t++)}return s(),a},r=()=>{for(;e[t]===` `;)t++;let n=t;for(;t<e.length&&!/[\s,{}]/.test(e[t]);)t++;let r=e.slice(n,t);for(;e[t]===` `||e[t]===`
5
+ `;)t++;return r},i=i=>{let a=r();if(e[t]===`}`)return t++,{a};t++;let o=r();if(o!==`plural`&&o!==`select`){let n=e[t]===`,`?(t++,r()):``;for(;t<e.length&&e[t]!==`}`;)t++;return t++,{a,t:o,s:n}}t++;let s={};for(;;){let a=r();if(!a||e[t]!==`{`)break;t++,s[a]=n(o===`plural`||i,!0),t++}for(;t<e.length&&e[t]!==`}`;)t++;return t++,{a,p:o===`plural`,o:s}};return n(!1,!1)}function qe(e,t,n,r){let i=``;for(let a of e)if(typeof a==`string`)i+=a;else if(a===0)i+=r===void 0?`#`:new Intl.NumberFormat(n).format(r);else if(a.t)i+=Je(a,t[a.a],n);else if(!a.o)i+=a.a in t?String(t[a.a]):`{${a.a}}`;else{let e=t[a.a],o;if(a.p){let r=Number(e),s=`other`;try{s=new Intl.PluralRules(n).select(r)}catch{}o=a.o[`=`+r]??a.o[s]??a.o.other,i+=qe(o??[],t,n,r)}else o=a.o[String(e)]??a.o.other,i+=qe(o??[],t,n,r)}return i}function Je(e,t,n){if(t==null||t===``)return``;try{if(e.t===`number`)return new Intl.NumberFormat(n).format(Number(t));if(e.t===`date`){let r=String(t),i=new Date(/^\d{4}-\d{2}-\d{2}$/.test(r)?r+`T00:00:00Z`:r);return Number.isNaN(i.getTime())?r:new Intl.DateTimeFormat(n,{dateStyle:e.s||`medium`,...r.length===10?{timeZone:`UTC`}:{}}).format(i)}}catch{}return String(t)}function Ye(e,t={},n=`en`){if(!e.includes(`{`))return e;let r=Ge.get(e);return r||(r=Ke(e),Ge.size>4e3&&Ge.clear(),Ge.set(e,r)),qe(r,t,n)}const Xe=[`fr`,`de`,`nl`,`es`,`it`,`pt`,`pt-BR`,`pl`,`cs`,`sv`,`da`,`nb`,`fi`,`ja`,`zh-CN`,`ko`,`tr`,`uk`,`ar`,`he`],Ze={no:`nb`,nn:`nb`,iw:`he`,"zh-Hans":`zh-CN`,"zh-SG":`zh-CN`,"zh-MY":`zh-CN`};function H(e,t=Xe){let n;try{n=Intl.getCanonicalLocales(String(e||``).trim().replace(/_/g,`-`))[0]}catch{}if(!n)return`en`;let[r,...i]=n.split(`-`),a=i.find(e=>e.length===4),o=i.find(e=>e.length===2||/^\d{3}$/.test(e)),s=[];if(r===`zh`){if(a===`Hant`||!a&&[`TW`,`HK`,`MO`].includes(o))return`en`;s.push(`zh-CN`)}o&&s.push(`${r}-${o}`,Ze[`${r}-${o}`]),a&&s.push(Ze[`${r}-${a}`]),s.push(r,Ze[r]);for(let e of s)if(e===`en`||t.includes(e))return e;return`en`}function Qe(e){return/^(ar|he|fa|ur)\b/.test(String(e))?`rtl`:`ltr`}function $e(e,t,n=`en`,r=``){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e)){let e=r+a;if(typeof o==`string`){let r=t?.[e]||o;i[a]=r.includes(`{`)?Ye(r,{},n):r}else if(Array.isArray(o)&&typeof o[0]==`string`){let[r,...s]=o,c=t?.[e]||r;i[a]=s.length?(...e)=>Ye(c,Object.fromEntries(s.map((t,n)=>[t,e[n]])),n):(e={})=>Ye(c,e,n)}else o&&typeof o==`object`?i[a]=$e(o,t,n,e+`.`):i[a]=o}return i}const et=new Map;function tt(e,t){return`https://cdn.jsdelivr.net/npm/${e.package}@${e.version}/catalogs/${e.namespace}/${t}.json`}const nt=(e,t)=>`i18n:${e.namespace}:${e.version}:${t}`;async function rt(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t,0,16))).slice(0,22)}async function it(e,t,n){let r=await e.http.fetch(tt(t,n));if(!r.ok)return null;let i=await r.text();if(await rt(i)!==t.hashes[n])return null;let a=JSON.parse(i);return!a||typeof a!=`object`?null:(await e.kv.set(nt(t,n),a),et.set(nt(t,n),{messages:a}),a)}async function at(e,t,n,r){let i=H(n,Object.keys(t.hashes));if(i===`en`)return null;let a=nt(t,i),o=et.get(a);if(o&&(o.messages||Date.now()<o.retry))return o.messages;let s=null;try{if(r&&r()<1)return null;if(s=await e.kv?.get(a)??null,!s){if(!e.http||!e.kv||r&&r()<2)return null;s=await it(e,t,i)}}catch{s=null}return s&&typeof s!=`object`&&(s=null),et.set(a,s?{messages:s}:{messages:null,retry:Date.now()+3e5}),s}async function ot(e,t,n,r){let i=Object.keys(t.hashes);if(!i.length||!e.kv||!e.http||r&&r()<4)return{added:0,missing:i.length};let a=nt(t,`index`),o=await e.kv.get(a),s=new Set(Array.isArray(o)?o:[]),c=[...new Set([H(n,i),...i])].filter(e=>e!==`en`&&!s.has(e)),l=0;for(let n of c){if(r&&r()<3)break;try{await it(e,t,n)&&(s.add(n),l++)}catch{}}return l&&await e.kv.set(a,[...s]),{added:l,missing:c.length-l}}var st={package:`@vermeulen.solutions/eventual-locales`,version:`0.1.11`,namespace:`attendance`,hashes:{ar:`yMYyvT1TAzbXqmNF3NbwCA`,cs:`wbyEwub+3/YEsGC6HslY+A`,da:`aO5CPBauWEfVuhKKKVCBGg`,de:`S5HNNcHOLjE7eE3SXBlC0w`,es:`I6drcxwb8yLscDQWLP3DPg`,fi:`n0iJq+R/qlbySrEw2ETlnA`,fr:`9PJz/hmui5GIBtmWQnLODg`,he:`+1mkr9xByLxqdBmVwhXx6g`,it:`PKQ5AcHFoTNevYYjODVKOg`,ja:`0hA9+R6MdDAnJr07tW0o7g`,ko:`X/zIsiRMFXAPv7pBa2/ZQw`,nb:`MLk848VWtVmZU1mkfnqQVA`,nl:`V+LmUqHdgPPCWy+GCdqaYQ`,pl:`ixZ3+mZGVa69JIW0jz6S5w`,"pt-BR":`bHvIJU79FnOSJJV3EQY/jQ`,pt:`xrywvUMk5MV3p6LwZwlhAg`,sv:`crt28Hd879D8VD+aJxSjCg`,tr:`ofQ9JQcCaYUuJCQ7bcW6fQ`,uk:`fkxdQ6lmkICdJ7TC3N0y5w`,"zh-CN":`Hq90dubGEnttFuVFUrLJgA`}};const ct=`attendance-language-packs`;function lt(e,t){let n=e.kv,r=e.http;return{kv:n&&{get:e=>t.call(()=>n.get(e)),set:(e,r)=>t.call(()=>n.set(e,r))},http:r&&{fetch:e=>t.call(()=>r.fetch(e))}}}async function ut(e,t,n,r=0){if(H(n)===`en`||!e.kv)return null;let{kv:i}=lt(e,t);return at({kv:i},st,n,()=>Math.min(t.remaining-r,1))}let dt=!1;async function ft(e,t){if(dt)return{added:0,missing:0};let n=await ot(lt(e,t),st,e.site?.locale,()=>t.remaining);return dt=n.missing===0&&Object.keys(st.hashes).length>0,n}const pt=[`en`,...Xe];function U(e,t=`en`){let n=typeof e==`string`?e.trim().slice(0,35):``;if(!n)return t;let r=H(n);return r===`en`&&!/^en\b/i.test(n)?t:r}function mt(e){return e===`fr`?`fr-CH`:e}function ht(e){try{let t=new Intl.DisplayNames([e],{type:`language`}).of(e)??e;return t.charAt(0).toLocaleUpperCase(e)+t.slice(1)}catch{return e}}const gt={fallbackTitle:`the event`,soon:`soon`,singleEvent:`single event`,rsvpConfirmed:{subject:[`RSVP confirmed: {title}`],text:[`Hi {name},
6
6
 
7
7
  Your spot for {title} has been reserved!
8
8
  {hasCalendar, select, true {
@@ -63,23 +63,23 @@ Add it to your calendar:
63
63
 
64
64
  If you can no longer come, please cancel so someone else can have your seat:
65
65
  {cancelUrl}
66
- `]}};function gt(e){let t={fallbackTitle:e.fallbackTitle,soon:e.soon,singleEvent:e.singleEvent};for(let[n,r]of Object.entries(e)){if(typeof r!=`object`)continue;let e=r;t[n]=t=>{let n={hasCalendar:!!t.calendarUrl,...t};return{subject:e.subject(n),text:e.text(n)}}}return t}const _t=new WeakMap;let vt;function yt(e,t){if(!e)return vt??=gt(Qe(ht,null,`en`));let n=_t.get(e);if(!n){let r={};for(let t in e)t.startsWith(`email.`)&&(r[t.slice(6)]=e[t]);_t.set(e,n=gt(Qe(ht,r,t)))}return n}async function G(e,t,n,r=1){return yt(await lt(e,t,n,r),n)}yt(null,`en`);const bt=`config:v1`,xt=6e4;let K=null;function St(e){let t=String(e??``).split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>z(e,``)).filter(Boolean),n=[...new Set(t)].slice(0,10);return n.length?n.join(`, `):`events`}function Ct(e){return e.eventCollection.split(`,`).map(e=>e.trim()).filter(Boolean)}function wt(e,t){let n=Ct(e),r=typeof t==`string`?t.trim():``;return r?n.includes(r)?r:null:n[0]??null}function Tt(e){let t=e&&typeof e==`object`?e:{};return{managePagePath:R(t.managePagePath,`/rsvp/manage`),eventCollection:St(t.eventCollection),replyTo:V(t.replyTo),reminderLeadHours:Dt(t.reminderLeadHours),defaultLocale:W(t.defaultLocale,`en`),retentionDays:Ot(t.retentionDays),defaultTimezone:u(t.defaultTimezone)??``,turnstileSiteKey:je(t.turnstileSiteKey),turnstileSecretKey:je(t.turnstileSecretKey)}}function Et(e){return!!e.turnstileSiteKey&&!!e.turnstileSecretKey}function Dt(e){let t=Number(e);return Number.isSafeInteger(t)&&t>=0&&t<=168?t:24}function Ot(e){if(e==null||e===``)return 365;let t=Number(e);if(!Number.isFinite(t))return 365;let n=Math.round(t);return Math.max(30,Math.min(3650,n))}async function kt(e,t){if(K&&Date.now()-K.at<xt){let{hmacSecret:e,...t}=K.config;return t}return Tt((await t.call(()=>e.kv.getVersioned(bt)))?.value)}async function q(e,t,n=Date.now()){if(K&&n-K.at<xt)return K.config;let r=await t.call(()=>e.kv.getVersioned(bt));return K={config:{hmacSecret:await ae(e.kv,t),...Tt(r?.value)},at:n},K.config}async function At(e,t,n){for(let r=0;r<2;r++){let r=await t.call(()=>e.kv.getVersioned(bt)),i=Tt({...Tt(r?.value),...n});if((await t.call(()=>e.kv.compareAndSet(bt,r?.revision??null,i))).applied)return K=null,q(e,t)}throw Error(`Unable to save configuration.`)}function jt(e,t,n,r){return ne(e,t.managePagePath,{action:n,token:r})}const Mt=`calendar`,Nt=`eventual-attendance`;function Pt(e){return typeof e==`string`?e.trim():``}function Ft(e,t,n=``,r=``,i=Nt){let a=e.replace(/\/+$/,``),o=new URLSearchParams({eventId:t});return n&&o.set(`occurrence`,n),r&&o.set(`collection`,r),`${a}/_emdash/api/plugins/${i||Nt}/${Mt}?${o.toString()}`}function It(e,t,n={}){let r=e.data??{},i=Pt(r.location)||Pt(r.virtual_url)||void 0;return ve({uid:`${e.id}-${n.occurrenceStart||`event`}@${n.host||`eventual-attendance`}`,title:Pt(r.title)||`Event`,start:t.allDay?t.startDate:t.startsAt,end:t.end,allDay:t.allDay,location:i,url:n.publicUrl??void 0})}function Lt(e,t=`en`){let n=new Date(e.startsAt),r=e.allDay?{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`,timeZone:`UTC`}:{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`,hour:`numeric`,minute:`2-digit`,timeZone:e.timezone||`UTC`,timeZoneName:`short`};try{let i=new Intl.DateTimeFormat(t===`fr`?`fr-CH`:t,r).format(n);return e.allDay||e.timezone?i:`${i} UTC`}catch{return`${new Intl.DateTimeFormat(t===`fr`?`fr-CH`:t,{...r,timeZone:`UTC`}).format(n)} UTC`}}async function J(e,t,n,r,i,o=`Attendance email failed`){if(!r.email||!e.email?.send||!t.has(1))return!1;let s=r.replyTo||n;try{return await t.call(()=>e.email.send({to:r.email,...i,...s?{replyTo:s}:{}})),!0}catch(n){return a(t,e.log,`warn`,o,{...r.id?{attendeeId:r.id}:{},error:String(n)}),!1}}function Rt(e,t,n){let r=t.eventTitle||e.fallbackTitle;return t.status===`waitlist`?e.waitlisted({name:t.displayName,title:r,position:t.waitlistPosition??0,cancelUrl:n.cancelUrl}):t.status===`pending`?e.requestReceived({name:t.displayName,title:r,deadline:n.deadline,cancelUrl:n.cancelUrl}):e.rsvpConfirmed({name:t.displayName,title:r,calendarUrl:n.calendarUrl,cancelUrl:n.cancelUrl})}const zt=`ledger-reconcile`;function Bt(e,t,n,r=Date.now()){return O(e.kv,t,n,async({poolKey:t,occurrenceStart:n,budget:r,isQuiet:i})=>{let a=0,o=await E(r,r=>e.storage.attendees.query({where:{translationGroup:t,occurrenceStart:n},limit:100,cursor:r}),e=>{if(!i(e.updatedAt))return!1;(e.status===`going`||e.status===`attended`||e.status===`pending`)&&(a+=e.quantity||1)},1);if(o!==`OK`)return o;let s=0,c=0,l=0,u=await E(r,r=>e.storage.waitlist_entries.query({where:{poolKey:t,occurrenceStart:n},limit:100,cursor:r}),e=>{if(!i(e.updatedAt))return!1;e.status===`queued`?c+=e.quantity||1:e.status===`offered`&&(s+=e.quantity||1),l=Math.max(l,e.position||0)},1);return u===`OK`?{taken:a,held:s,waitlistCount:c,maxPosition:l}:u},{nowMs:r,log:e.log})}function Vt(e,t,n=Date.now()){return k(e.kv,t,`state:reconcile-cursor`,(t,r)=>Bt(e,r,t,n))}const Ht=`attendance-reminders`;async function Ut(e,t,n=Date.now()){let r=await q(e,t);if(r.reminderLeadHours===0)return{sent:0,disabled:!0};let i=new Date(n).toISOString(),a=new Date(n+r.reminderLeadHours*36e5).toISOString(),o=await t.call(()=>e.storage.attendees.query({where:{reminder:`due`,status:`going`,startsAt:{gt:i,lte:a}},orderBy:{startsAt:`asc`},limit:3})),s=0;for(let{data:n}of o.items){if(!t.has(2))break;if(!(await t.call(()=>e.storage.attendees.updateIf(n.id,{where:{reminder:`due`,status:`going`},set:{reminder:`sent`,remindedAt:i}}))).applied||!n.email)continue;let a=W(n.locale,r.defaultLocale),o=await G(e,t,a),c=n.startsAt?Lt({startsAt:n.startsAt,allDay:n.allDay===!0,timezone:n.timezone},a):o.soon,l=e.site?.url??``,u=await Pe(r.hmacSecret,n.id,n.createdAt,n.eventId),d=o.reminder({name:n.displayName,title:n.eventTitle||o.fallbackTitle,when:c,quantity:n.quantity,calendarUrl:Ft(l,n.eventId,n.occurrenceStart,n.collection,e.plugin?.id),cancelUrl:jt(l,r,`cancel`,u)});await J(e,t,r.replyTo,n,d,`Reminder email failed`)&&s++}return{sent:s,disabled:!1}}const Wt=`waitlist-maintenance`,Gt=`attendance-mail`,Kt=`attendance-retention`,qt=`attendance-approvals`,Jt=[{name:Wt,schedule:`* * * * *`},{name:zt,schedule:`*/10 * * * *`},{name:Ht,schedule:`* * * * *`},{name:Gt,schedule:`* * * * *`},{name:qt,schedule:`*/5 * * * *`},{name:Kt,schedule:`17 * * * *`},{name:st,schedule:`* * * * *`}];async function Yt(e,t){if(!e||!t.has(1))return[];let n=await t.call(()=>e.list()),r=[];for(let i of Jt){let a=n.find(e=>e.name===i.name);if(!(a&&a.schedule===i.schedule)){if(!t.has(1))break;await t.call(()=>e.schedule(i.name,{schedule:i.schedule})),r.push(i.name)}}return r}async function Xt(e){if(e)for(let t of Jt)await e.schedule(t.name,{schedule:t.schedule})}function Zt(e,t=Date.now()){if(!e)return!0;let n=Date.parse(e);return Number.isNaN(n)?!1:n>=t-432e5}async function Qt(e,t,n,r=Date.now()){for(let i of[`going`,`pending`,`waitlist`]){if(!t.has(1))return!1;if((await t.call(()=>e.storage.attendees.query({where:{eventId:n,status:i},limit:50}))).items.some(e=>Zt(e.data.startsAt||e.data.occurrenceStart,r)))return!0}return!1}function Y(e){return e}function $t(e,t){return(e||t).trim()}async function en(e,t,n,r=``){if(!t.has(6))return{promoted:!1,reason:`BUDGET`};let i=(await t.call(()=>e.storage.waitlist_entries.query({where:{poolKey:n,occurrenceStart:r,status:`queued`},orderBy:{position:`asc`},limit:1}))).items[0]?.data;if(!i)return{promoted:!1,reason:`NO_QUEUED_ATTENDEES`};let o=await q(e,t);if(!t.has(4))return{promoted:!1,reason:`BUDGET`};let s=g(n,r),c=await T(e.kv,t,s,i.quantity);if(c!==`HELD`)return{promoted:!1,reason:c};let l=new Date,u=new Date(l.getTime()+72e5).toISOString(),d=await Fe(o.hmacSecret,i.id,i.eventId,u),f=await Le(d),p=await t.call(()=>e.storage.waitlist_entries.updateIf(i.id,{where:{status:`queued`},set:{status:`offered`,offerExpiresAt:u,claimTokenHash:f,updatedAt:l.toISOString()}}));if(!p.applied)return t.has(2)?await w(e.kv,t,s,{held:i.quantity,waitlistCount:-i.quantity},1):a(t,e.log,`error`,`Held seats could not be returned after a promotion race`,{ledgerKey:s,entryId:i.id}),{promoted:!1,reason:`RACE`};let m=await G(e,t,W(i.locale,o.defaultLocale)),h=jt(e.site?.url??``,o,`claim`,d);return await J(e,t,o.replyTo,i,m.offer({name:i.displayName,title:i.eventTitle||m.fallbackTitle,claimUrl:h})),{promoted:!0,entry:{...i,...p.data}}}async function tn(e,t,n,r=Date.now()){if(!L(n))return{ok:!1,error:`INVALID_TOKEN`};let i=await Le(n),o=(await t.call(()=>e.storage.waitlist_entries.query({where:{claimTokenHash:i},limit:1}))).items[0]?.data;if(!o)return{ok:!1,error:`ENTRY_NOT_FOUND`};if(o.status===`claimed`)return{ok:!1,error:`ALREADY_CLAIMED`};if(o.status===`expired`)return{ok:!1,error:`OFFER_EXPIRED`};if(o.status!==`offered`)return{ok:!1,error:`INVALID_STATUS`};if(!(r<(o.offerExpiresAt?Date.parse(o.offerExpiresAt):0)))return{ok:!1,error:`OFFER_EXPIRED`};let s=new Date(r).toISOString(),c=await t.call(()=>e.storage.waitlist_entries.updateIf(o.id,{where:{status:`offered`,claimTokenHash:i},set:{status:`claimed`,claimedAt:s,updatedAt:s}}));if(!c.applied)return{ok:!1,error:`OFFER_NO_LONGER_AVAILABLE`};let l=g(o.poolKey,o.occurrenceStart);await w(e.kv,t,l,{heldToTaken:o.quantity},2)||a(t,e.log,`error`,`Claim could not move held seats to taken`,{ledgerKey:l,entryId:o.id});let u=!1,f=48;if(e.storage.attendance_settings&&t.has(2)){let n=await ze(e.storage.attendance_settings,t,{id:o.eventId,translationGroup:o.poolKey,status:`published`,data:{}});u=n.config.requireApproval,f=n.config.approvalHours}else e.storage.attendance_settings&&a(t,e.log,`warn`,`Skipped approval check on waitlist claim due to call budget`,{entryId:o.id,attendeeId:o.attendeeId});let p=t.has(3)?await q(e,t):null,m=!!e.email?.send&&!!p&&t.has(2),h=!!e.email?.send&&!m,_=u?He(r,f,o.occurrenceStart||void 0):void 0,v=!!(o.replyTo||p?.replyTo),y=await t.call(()=>e.storage.attendees.updateIf(o.attendeeId,{where:{status:`waitlist`},set:{status:u?`pending`:`going`,..._?{approvalDueAt:_}:{},...u&&v?{organiserNotice:`queued`}:{},...h?{mail:`queued`}:{},updatedAt:s}}));if(!y.applied)return{ok:!1,error:`ATTENDEE_NOT_WAITLISTED`};let b=y.data;if(p&&m){let n=await Pe(p.hmacSecret,b.id,b.createdAt,b.eventId),r=W(b.locale??o.locale,p.defaultLocale),i=await G(e,t,r),a=o.eventTitle||i.fallbackTitle,s=jt(e.site?.url??``,p,`cancel`,n),c=u?i.requestReceived({name:b.displayName,title:a,deadline:d(_,b.timezone,pt(r)),cancelUrl:s}):i.claimConfirmed({name:b.displayName,title:a,calendarUrl:b.startsAt?Ft(e.site?.url??``,b.eventId,b.occurrenceStart,b.collection,e.plugin?.id):void 0,cancelUrl:s});await J(e,t,p.replyTo,b,c)}return{ok:!0,attendee:b,waitlistEntry:{...o,...c.data}}}async function nn(e,t,n){let r=await t.call(()=>e.storage.attendees.get(n));if(!r||r.erasedAt||r.status!==`waitlist`||!r.waitlistEntryId)return{ok:!1,error:`NOT_QUEUED`};let i=await t.call(()=>e.storage.waitlist_entries.get(r.waitlistEntryId));if(!i||i.status!==`queued`)return{ok:!1,error:`NOT_QUEUED`};let a=g(i.poolKey,i.occurrenceStart),o=await S(e.kv,t,a,e=>e?{next:{...e,nextPosition:e.nextPosition+1},result:e.nextPosition}:{abort:0});if(!o.applied)return{ok:!1,error:o.reason===`ABORTED`?`NO_LEDGER`:`RACE`};let s=o.result;if(!(await t.call(()=>e.storage.waitlist_entries.updateIf(i.id,{where:{status:`queued`,position:i.position},set:{position:s,updatedAt:new Date().toISOString()}}))).applied)return{ok:!1,error:`RACE`};if(t.has(3)){let n=await q(e,t),r=await G(e,t,W(i.locale,n.defaultLocale));await J(e,t,n.replyTo,i,r.movedToEnd({name:i.displayName,title:i.eventTitle||r.fallbackTitle,quantity:i.quantity}))}return{ok:!0,position:s}}async function rn(e,t,n){if(n.status===`cancelled`||n.erasedAt)return{ok:!1,error:`ALREADY_CANCELLED`,seatsFreed:!1};let r=new Date().toISOString(),i=await t.call(()=>e.storage.attendees.updateIf(n.id,{where:{status:n.status},set:{status:`cancelled`,...n.organiserNotice===`queued`?{organiserNotice:`sent`}:{},updatedAt:r}}));if(!i.applied)return{ok:!1,error:`ALREADY_CANCELLED`,seatsFreed:!1};let o=g($t(n.translationGroup,n.eventId),n.occurrenceStart),s={taken:n.quantity},c=!0;if(n.status===`waitlist`&&n.waitlistEntryId){s=null,c=!1;for(let i=0;i<2&&t.has(4);i++){let i=await t.call(()=>e.storage.waitlist_entries.get(n.waitlistEntryId));if(!i||i.status===`cancelled`||i.status===`expired`)break;if(i.status===`claimed`){s={taken:n.quantity},c=!0;break}if((await t.call(()=>e.storage.waitlist_entries.updateIf(i.id,{where:{status:i.status},set:{status:`cancelled`,updatedAt:r}}))).applied){s=i.status===`queued`?{waitlistCount:n.quantity}:{held:n.quantity},c=i.status===`offered`;break}}}return s&&(await w(e.kv,t,o,s,2)||a(t,e.log,`error`,`Cancellation could not release ledger seats`,{ledgerKey:o,attendeeId:n.id})),{ok:!0,attendee:{...n,...i.data},seatsFreed:c}}async function an(e,t,n=Date.now()){let r={expiredCount:0,promotedCount:0,budgetExhausted:!1},i=new Date(n).toISOString(),a=await t.call(()=>e.storage.waitlist_entries.query({where:{status:`offered`,offerExpiresAt:{lte:i}},orderBy:{offerExpiresAt:`asc`},limit:2}));for(let{data:n}of a.items){if(!t.has(5)){r.budgetExhausted=!0;break}(await t.call(()=>e.storage.waitlist_entries.updateIf(n.id,{where:{status:`offered`},set:{status:`expired`,updatedAt:i}}))).applied&&(r.expiredCount++,await w(e.kv,t,g(n.poolKey,n.occurrenceStart),{held:n.quantity},1),await t.call(()=>e.storage.attendees.updateIf(n.attendeeId,{where:{status:`waitlist`},set:{status:`cancelled`,updatedAt:i}})))}if(!t.has(7))return r.budgetExhausted=!0,r;let o=(await t.call(()=>e.kv.list(h))).map(({key:e,value:t})=>({key:e,ledger:y(t)})).filter(e=>!!e.ledger&&e.ledger.waitlistCount>0&&x(e.ledger)>0).sort((e,t)=>e.key<t.key?-1:e.key>t.key?1:0);if(o.length===0)return r;let s=o,c,l=null,u=o.length>1&&t.has(8);if(u){let n=await t.call(()=>e.kv.getVersioned(on));l=n?.revision??null;let r=o.findIndex(e=>!n||e.key>n.value);s=r<=0?o:[...o.slice(r),...o.slice(0,r)]}let d=u?1:0;for(let{key:n,ledger:i}of s){if(!t.has(6+d)){r.budgetExhausted=!0;break}let a=i.poolKey||_(n,i.occurrenceStart);c=n,(await en(e,t,a,i.occurrenceStart)).promoted&&r.promotedCount++}return u&&c&&await t.call(()=>e.kv.compareAndSet(on,l,c)),r}const on=`state:maintenance-cursor`,sn={navOverview:`Registrations`,navRoster:`Door list`,lightDone:`Done. Open the page again to see the updated lists.`,checkedIn:`Checked in.`,checkInRefused:`Only confirmed registrations can be checked in.`,cancelled:`Registration cancelled. Freed places go to the waiting list.`,alreadyCancelled:`This registration was already cancelled.`,moved:`Moved to the end of the waiting list. The next person in line is offered the free places within a minute.`,moveRefused:`Only people who are waiting can be moved (not while they have an offer).`,moveRace:`The waiting list changed at the same moment. Please try again.`,maintenance:[`Expired {expired} offer(s), sent {promoted} new offer(s){more, select, true {; more work remains for the next minute} other {}}.`,`expired`,`promoted`,`more`],noLedgers:`No seat ledgers yet.`,corrected:[`Corrected {key}: taken {t}, held {h}, waiting {w}.`,`key`,`t`,`h`,`w`],ledgerStatus:{UNCHANGED:`already matches its records.`,MISSING:`no longer exists.`,BUSY:`had activity in the last 10 minutes; it will be checked later.`,TOO_LARGE:`has too many records to check in one pass.`,CONFLICT:`changed while being checked; it will be retried.`},scheduled:[`Scheduled background task(s): {names}.`,`names`],downloadCsv:`Download the list (CSV)`,downloadHtml:`Download the printable list (.html)`,noSiteUrl:`Site URL not configured`,noSiteUrlBody:`Set the site URL so download links can be generated.`,linkNote:`The link works once, for 10 minutes. Open the .html file and print it.`,showAllEvents:`Show all events`,filterOn:[`Only showing: {event}`,`event`],filterOnBody:`The list below shows this event only. The overview above always counts all events.`,ticketedHeader:`Events with tickets`,ticketedIntro:`People who bought a ticket for these events are listed under Tickets → Orders, not here.`,openOrders:`View orders`,cancelledHidden:`Cancelled registrations are not shown.`,cancelledShown:`Cancelled registrations are shown too.`,showCancelled:`Show cancelled ones too`,hideCancelled:`Hide cancelled ones`,rosterHeader:`Door list and check-in`,rosterIntro:`Tick people off as they arrive. This page also works on a phone.`,preparePrintable:`Printable list`,prepareCsv:`CSV file`,colStatus:`Status`,colSeats:`Places`,colAnswers:`Answers`,checkIn:`Check in`,approve:`Approve`,decline:`Decline`,declineTitle:[`Decline {name}'s request?`,`name`],declineText:`Their places are released and they get an email.`,approvedSent:`Approved. The confirmation email is sent.`,approvedQueued:`Approved. The confirmation email goes out within a minute.`,declinedToast:`Declined. The places are free again.`,requestAlreadyHandled:`This request was already answered.`,moveToEnd:`Move to end of list`,moveTitle:[`Move {name} to the end of the waiting list?`,`name`],moveText:`They keep a place in line, behind everyone else, and get an email. Use this when the free places are too few for their booking and others are waiting.`,moveConfirm:`Move to end`,keep:`Keep`,cancelRsvp:`Cancel`,cancelConfirm:`Cancel registration`,cancelTitle:[`Cancel {name}'s registration?`,`name`],cancelText:`Their places go to the waiting list. This cannot be undone.`,heatmapHeader:`Which days and times fill up fastest`,heatmapIntro:`Average share of places in use by weekday and start hour, for upcoming dates with a limit. Busiest first.`,colDay:`Day`,colStarts:`Starts`,colUsedPct:`Places in use`,colSessions:`Dates`,upcomingSessions:`Upcoming events`,attendees:`Who registered`,colAttendee:`Name`,colEmail:`Email`,colDateTime:`Date`,colAction:`Actions`,colCancel:` `,noAttendeesSelection:`Nobody registered for this selection yet.`,noRsvps:`Nobody has registered yet. Registrations appear here as they come in.`,settingsHeader:`Registration settings`,settingsIntro:`Technical settings, normally set once when the site is built. Email links open the self-service page on your site, which must show the RsvpManage component.`,componentsHint:[`Site components (RsvpForm, RsvpManage): use apiEndpoint "/_emdash/api/plugins/{id}/rsvp" and apiBase "/_emdash/api/plugins/{id}".`,`id`],fieldCollections:`Content collections that hold events (comma-separated)`,fieldManagePath:`Path of the self-service page`,fieldReplyTo:`Replies to emails go to (optional)`,fieldReminders:`Send a reminder this many hours before the event (0 = no reminder)`,fieldRetentionDays:`Delete names, emails and answers this many days after the event (30–3650)`,fieldDefaultTimezone:`Time zone for events that don't have their own, for example Europe/Zurich (empty: UTC)`,fieldLocale:`Language of emails when the form doesn't say`,fieldTurnstileSiteKey:`Cloudflare Turnstile site key (optional; empty = off)`,fieldTurnstileSecret:`Cloudflare Turnstile secret key`,turnstileSecretSaved:`Saved. Leave empty to keep it.`,turnstileOn:`Turnstile is on: the booking form shows Cloudflare's check, and bookings without a valid token are refused. If Cloudflare can't be reached, bookings go through.`,turnstileOff:`Turnstile is off. To turn it on, create a widget for this site's domain in the Cloudflare dashboard (Turnstile) and paste both keys above.`,save:`Save`,tasksIntro:`Waiting-list offers move on every minute, and counts are checked every 10 minutes. You can run either now.`,runMaintenance:`Move the waiting list on now`,runReconcile:`Check the counts now`,status:{going:`Confirmed`,pending:`Awaiting approval`,waitlist:`Waiting list`,attended:`Checked in`,cancelled:`Cancelled`,erased:`Erased`},personalDataHeader:`Delete someone's personal data`,personalDataIntro:`When someone asks you to delete their details (GDPR, FADP), look them up by email address.`,fieldEraseEmail:`Their email address`,findPersonalData:`Find`,colEventTitle:`Event`,liveNotErased:`live, not erased`,statusErased:`Erased`,erasePersonalData:`Erase personal data`,eraseConfirmTitle:`Erase this person's data?`,eraseConfirmText:`Names, email addresses and answers are removed for good. Seat counts stay. Live registrations are not erased: cancel them first.`,eraseConfirmButton:`Erase personal data`,noPersonalDataFound:`No records found for this email address.`,erasedMore:[`Erased {n}. Press again for the rest.`,`n`],erasedAll:[`Personal data erased ({n, plural, one {# record} other {# records}}).`,`n`],singleEvent:`Single event`,bookedSeats:`Registered`,waiting:`Waiting list`,seatsOnWaitlists:`places asked for`,requestsWaiting:`To approve`,requestsPendingNote:`requests waiting for you`,unlimited:`No limit`,scopeAll:`places taken, all upcoming events`,colEvent:`Event`,colDateTimeLower:`Date`,colBooked:`Registered`,noUpcoming:`No upcoming events with registrations yet.`,days:{0:`Mon`,1:`Tue`,2:`Wed`,3:`Thu`,4:`Fri`,5:`Sat`,6:`Sun`},filterEvent:`Event`,allEvents:`All events`,filterDate:`Date`,allDates:`All dates`,showAttendees:`Show`,openEvent:`Open an event in the content editor to set up its registrations.`,notConfigured:[`Attendance applies to: {collections}. Add this collection on the Attendance admin page if bookings should be taken for it.`,`collections`],saveFirst:`Save the event first, then set up its registrations here.`,panelSaved:`Registration settings saved.`,panelNotSaved:`Nothing was saved: fix the questions first.`,questionsNeedFixing:`The questions need fixing`,ticketedTitle:`This event sells tickets`,ticketedBody:`Free registration is off for this event: it is managed in the Tickets panel, and purchases are listed under Tickets → Orders.`,enable:`Open for registration`,enableHelp:`Visitors can register on your site. Turn this off to stop new registrations; existing ones stay.`,capacityLimit:`Places available (0 = no limit)`,maxPerBooking:`Most places one person can book`,allowWaitlist:`Waiting list when full`,allowWaitlistHelp:`When all places are taken, visitors can join a waiting list. Freed places are offered in order of arrival.`,requireApproval:`Approve each registration yourself`,requireApprovalHelp:`Registrations wait, holding their places, until you approve or decline them under Registrations.`,approvalHours:`Hours you have to decide (1–720)`,eventReplyTo:`Replies to this event's emails go to (optional)`,savePanel:`Save registration settings`,required:`required`,statusOpen:`Open for registration`,statusClosed:`Closed for registration`,placesTakenOf:[`{n} of {c} places taken`,`n`,`c`],placesTaken:[`{n, plural, one {# place} other {# places}} taken`,`n`],placesTakenAllDates:[`{n, plural, one {# place} other {# places}} taken across all dates`,`n`],placesOffered:[`{n} offered to the waiting list`,`n`],peopleWaiting:[`{n} on the waiting list`,`n`],viewRegistrations:`View registrations`,fromEventPlaces:[`{c} places`,`c`],fromEventNoLimit:`No limit on places`,fromEventWaitlistOn:`waiting list on`,fromEventWaitlistOff:`no waiting list`,fromEventHint:`Change this in the event's own capacity and waiting-list fields.`,fromEventDiffersTitle:`This panel overrides the event's places`,fromEventDiffers:`Places or the waiting list were set here earlier, and that older choice is what visitors get, not what the event's fields say. Click “Save registration settings” to use the event's fields.`,savedSeparately:`Use this button to save these settings; the event's own Save doesn't include them. They apply to every language version of the event.`,qHeader:`Questions on the registration form`,qIntro:`Name and email are always asked. Add your own questions, such as T-shirt size or dietary needs. Each question is saved on its own; answers appear in the registration list, the door list and the CSV.`,qLabel:`Question`,qLabelPlaceholder:`For example: T-shirt size`,qType:`Kind of answer`,qTypes:{text:`Short text`,textarea:`Long text`,email:`Email address`,phone:`Phone number`,number:`Number`,date:`Date`,checkbox:`Tick box`,select:`Choice from a list`},qOptions:`Choices (one per line)`,qRequired:`Must be answered`,qAdd:`Add question`,qSave:`Save question`,qAddHeader:`Add a question`,qRemove:`Remove`,qRemoveTitle:[`Remove "{label}"?`,`label`],qRemoveText:`The question disappears from the form. Answers already given stay with their registrations.`,qMoveUp:`Move up`,qSaved:`Question saved.`,qAdded:`Question added.`,qRemoved:`Question removed.`,qMoved:`Question moved up.`,qNotSaved:`The question was not saved`,qGone:`This question no longer exists. Reload the page.`,navSettings:`Registration settings`,settingsSaved:`Settings saved.`,siteSetupHeader:`Site setup (for whoever built the site)`,undoCheckIn:`Undo check-in`,checkInUndone:`Check-in undone.`,undoRefused:`This person isn't checked in.`,places:[`{n, plural, one {# place} other {# places}}`,`n`],attentionTitle:[`Waiting for your decision: {n}`,`n`],attentionText:`These people asked to register. Their places are held until you approve or decline; if you don't answer in time, the request lapses.`,attentionMore:[`And {n} more: they are in the list below with the status "Awaiting approval".`,`n`],decideBy:[`decide by {when}`,`when`],sessFull:`Full`,sessAlmost:`Almost full`,sessOpen:`Places left`,colList:`List`,viewList:`View`,filterSearch:`Find a name or email address (optional)`,searchFound:[`Found {n}.`,`n`],searchNone:`Nobody found with that name or email address.`,searchPartial:`The list is long and was not searched to the end: choose an event to narrow it down.`,phoneHint:`On a phone the buttons in this table are hidden: search for a name above, or use the door list.`,doorShow:`Show`,doorSearch:`Find a name (optional)`,doorChooseTitle:`Choose an event`,doorChooseText:`Pick the event you are checking people in for, then press Show.`,doorCount:[`{n} of {of}{more, select, true {+} other {}} checked in`,`n`,`of`,`more`],doorCheckedAt:[`✓ checked in {when}`,`when`],doorEmpty:`Nobody to check in yet`,doorNext:`Show more people`,doorPrintIntro:`Prefer paper or a spreadsheet? Make a file of this list.`,doorNextEvent:[`Showing the next event: {event}. To check people in for another one, choose it above.`,`event`],listFilesIntro:`Print the list or open it in a spreadsheet: make a file of the event chosen above (all events when none is chosen), with everyone's status, cancelled ones included.`,allEventsTitle:`All Events`,allDatesTitle:`All Dates`,eventLabel:[`Event {id}`,`id`],truncated:[`Showing the first {n} attendees; filter by event to export the rest.`,`n`],csvHeaders:{0:`Check-in Status`,1:`Display Name`,2:`Email`,3:`Status`,4:`Quantity`,5:`Occurrence Time`,6:`Local time`,7:`Checked-in At`,8:`Answers`,9:`Attendee ID`},yes:`YES`,no:`NO`,rosterTitle:`Door Roster`,rosterSession:`Session`,rosterTotal:`Total Attendees`,printedAt:`Printed`,printButton:`Print Door Roster`,htmlHeaders:{0:`In`,1:`#`,2:`Attendee Name`,3:`Email`,4:`Status`,5:`Qty`,6:`Session Date`,7:`Answers`,8:`Staff Notes`},noAttendeesRegistered:`No attendees registered.`,singleEventCsv:`Single Event`,questionIssues:{NO_LABEL:[`{hasLine, select, true {Line {line}: } other {}}write the question first.`],LABEL_TOO_LONG:[`{hasLine, select, true {Line {line}: } other {}}the question is longer than {limit} characters.`],BAD_TYPE:[`{hasLine, select, true {Line {line}: } other {}}"{value}" isn't a type. Use one of: text, textarea, email, phone, number, date, checkbox, select.`],BAD_REQUIRED:[`{hasLine, select, true {Line {line}: } other {}}write "required" or "optional" in the third column.`],NO_OPTIONS:[`{hasLine, select, true {Line {line}: } other {}}a choice from a list needs at least one choice, for example S, M, L.`],TOO_MANY_OPTIONS:[`{hasLine, select, true {Line {line}: } other {}}at most {limit} choices.`],OPTION_TOO_LONG:[`{hasLine, select, true {Line {line}: } other {}}a choice can be at most {limit} characters.`],OPTIONS_NOT_ALLOWED:[`{hasLine, select, true {Line {line}: } other {}}only select questions take options.`],INVALID:[`{hasLine, select, true {Line {line}: } other {}}invalid question.`],TOO_MANY_QUESTIONS:[`At most {limit} questions per event.`]}},cn=new WeakMap;let ln;function un(e,t){let n=Qe(sn,e,t);return n.questionIssue=e=>{let t={hasLine:!!e.line,line:e.line??``,limit:e.limit??``,value:e.value??``},r=n.questionIssues;return(r[e.code]??r.INVALID)(t)},n}function dn(e,t=`en`){if(!e)return ln??=un(null,`en`);let n=cn.get(e);return n||cn.set(e,n=un(fn(e,`admin.`),t)),n}function fn(e,t){let n={};for(let r in e)r.startsWith(t)&&(n[r.slice(t.length)]=e[r]);return n}const pn=`export:`;function X(e){if(e==null)return`""`;let t=String(e);return/^[=+\-@\t\r\uFF1D\uFF0B\uFF0D\uFF20]/.test(t)&&(t=`'${t}`),`"${t.replace(/"/g,`""`)}"`}function Z(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#039;`)}function mn(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,`-`).slice(0,60)||`events`}function hn(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``)}const gn=`eventual-attendance`;async function _n(e,t,n,r=e.plugin?.id||gn){let i=String(e.site?.url??``).replace(/\/+$/,``);if(!/^https?:\/\//.test(i))return null;let a=hn(32),o=new Date(Date.now()+6e5).toISOString(),s={...n,expiresAt:o},c=`${pn}${await I(a)}`;return await t.call(()=>e.kv.set(c,s)),{url:`${i}/_emdash/api/plugins/${r||gn}/roster/download?token=${a}`,expiresAt:o}}async function vn(e,t,n){if(!L(n))return null;let r=`${pn}${await I(n)}`,i=await t.call(()=>e.kv.getVersioned(r));return!i||!(await t.call(()=>e.kv.compareAndDelete(r,i.revision))).applied||!(Date.now()<Date.parse(i.value.expiresAt))?null:yn(i.value,e,t)}async function yn(e,t,n){let r=dn(await lt(t,n,e.locale),U(e.locale)),i=t.storage.attendees,a=e.eventId?Ct(await q(t,n))[0]:void 0,o={};e.poolKey?o.translationGroup=e.poolKey:e.eventId&&(o.eventId=e.eventId),(e.poolKey||e.eventId)&&e.occurrenceStart&&(o.occurrenceStart=e.occurrenceStart);let s=[],c,l=!1;do{if(!n.has(2)){l=!0;break}let e=await n.call(()=>i.query({where:Object.keys(o).length?o:void 0,limit:100,cursor:c}));s.push(...e.items.map(e=>e.data)),c=e.hasMore?e.cursor:void 0}while(c);e.occurrenceStart&&!e.eventId&&(s=s.filter(t=>t.occurrenceStart===e.occurrenceStart));let u={going:1,attended:2,waitlist:3,cancelled:4};s.sort((e,t)=>{let n=u[e.status]??99,r=u[t.status]??99;return n===r?e.displayName.localeCompare(t.displayName):n-r});let f=s.find(e=>e.eventTitle)?.eventTitle,p=e.eventId&&!f&&n.has(1)?await n.call(()=>t.content.get(a,e.eventId)).catch(()=>null):null,m=String(e.title||f||p?.data?.title||(e.eventId?r.eventLabel(e.eventId):e.poolKey?r.rosterTitle:r.allEventsTitle)),h=pt(U(e.locale)),g=s.find(t=>(!e.occurrenceStart||t.occurrenceStart===e.occurrenceStart)&&t.timezone)?.timezone,_=e.occurrenceStart?d(e.occurrenceStart,g,h):r.allDatesTitle,v=l?r.truncated(s.length):``;if(e.format===`csv`){let t=[Object.values(r.csvHeaders).join(`,`)];v&&t.unshift(X(v));for(let e of s){let n=!!e.erasedAt;t.push([X(e.status===`attended`?r.yes:r.no),X(n?`—`:e.displayName),X(n?`—`:e.email),X(n?r.status.erased:r.status[e.status]??e.status),X(e.quantity||1),X(e.occurrenceStart||r.singleEventCsv),X(e.occurrenceStart?d(e.occurrenceStart,e.timezone,h):r.singleEventCsv),X(e.checkedInAt||``),X(n?``:De(e.answers)),X(e.id)].join(`,`))}return{contentType:`text/csv; charset=utf-8`,filename:`roster-${mn(e.eventId||e.poolKey||`events`)}-${Date.now()}.csv`,body:t.join(`\r
66
+ `]}};function _t(e){let t={fallbackTitle:e.fallbackTitle,soon:e.soon,singleEvent:e.singleEvent};for(let[n,r]of Object.entries(e)){if(typeof r!=`object`)continue;let e=r;t[n]=t=>{let n={hasCalendar:!!t.calendarUrl,...t};return{subject:e.subject(n),text:e.text(n)}}}return t}const vt=new WeakMap;let yt;function bt(e,t){if(!e)return yt??=_t($e(gt,null,`en`));let n=vt.get(e);if(!n){let r={};for(let t in e)t.startsWith(`email.`)&&(r[t.slice(6)]=e[t]);vt.set(e,n=_t($e(gt,r,t)))}return n}async function W(e,t,n,r=1){return bt(await ut(e,t,n,r),n)}bt(null,`en`);const xt=`config:v1`,St=6e4;let G=null;function Ct(e){let t=String(e??``).split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>z(e,``)).filter(Boolean),n=[...new Set(t)].slice(0,10);return n.length?n.join(`, `):`events`}function wt(e){return e.eventCollection.split(`,`).map(e=>e.trim()).filter(Boolean)}function Tt(e,t){let n=wt(e),r=typeof t==`string`?t.trim():``;return r?n.includes(r)?r:null:n[0]??null}function Et(e){let t=e&&typeof e==`object`?e:{};return{managePagePath:ae(t.managePagePath,`/rsvp/manage`),eventCollection:Ct(t.eventCollection),replyTo:se(t.replyTo),reminderLeadHours:Ot(t.reminderLeadHours),defaultLocale:U(t.defaultLocale,`en`),retentionDays:kt(t.retentionDays),defaultTimezone:u(t.defaultTimezone)??``,turnstileSiteKey:Me(t.turnstileSiteKey),turnstileSecretKey:Me(t.turnstileSecretKey)}}function Dt(e){return!!e.turnstileSiteKey&&!!e.turnstileSecretKey}function Ot(e){let t=Number(e);return Number.isSafeInteger(t)&&t>=0&&t<=168?t:24}function kt(e){if(e==null||e===``)return 365;let t=Number(e);if(!Number.isFinite(t))return 365;let n=Math.round(t);return Math.max(30,Math.min(3650,n))}async function At(e,t){if(G&&Date.now()-G.at<St){let{hmacSecret:e,...t}=G.config;return t}return Et((await t.call(()=>e.kv.getVersioned(xt)))?.value)}async function K(e,t,n=Date.now()){if(G&&n-G.at<St)return G.config;let r=await t.call(()=>e.kv.getVersioned(xt));return G={config:{hmacSecret:await ie(e.kv,t),...Et(r?.value)},at:n},G.config}async function jt(e,t,n){for(let r=0;r<2;r++){let r=await t.call(()=>e.kv.getVersioned(xt)),i=Et({...Et(r?.value),...n});if((await t.call(()=>e.kv.compareAndSet(xt,r?.revision??null,i))).applied)return G=null,K(e,t)}throw Error(`Unable to save configuration.`)}function Mt(e,t,n,r){return te(e,t.managePagePath,{action:n,token:r})}const Nt=`calendar`,Pt=`eventual-attendance`;function Ft(e){return typeof e==`string`?e.trim():``}function It(e,t,n=``,r=``,i=Pt){let a=e.replace(/\/+$/,``),o=new URLSearchParams({eventId:t});return n&&o.set(`occurrence`,n),r&&o.set(`collection`,r),`${a}/_emdash/api/plugins/${i||Pt}/${Nt}?${o.toString()}`}function Lt(e,t,n={}){let r=e.data??{},i=Ft(r.location)||Ft(r.virtual_url)||void 0;return ye({uid:`${e.id}-${n.occurrenceStart||`event`}@${n.host||`eventual-attendance`}`,title:Ft(r.title)||`Event`,start:t.allDay?t.startDate:t.startsAt,end:t.end,allDay:t.allDay,location:i,url:n.publicUrl??void 0})}function Rt(e,t=`en`){let n=new Date(e.startsAt),r=e.allDay?{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`,timeZone:`UTC`}:{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`,hour:`numeric`,minute:`2-digit`,timeZone:e.timezone||`UTC`,timeZoneName:`short`};try{let i=new Intl.DateTimeFormat(t===`fr`?`fr-CH`:t,r).format(n);return e.allDay||e.timezone?i:`${i} UTC`}catch{return`${new Intl.DateTimeFormat(t===`fr`?`fr-CH`:t,{...r,timeZone:`UTC`}).format(n)} UTC`}}async function q(e,t,n,r,i,o=`Attendance email failed`){if(!r.email||!e.email?.send||!t.has(1))return!1;let s=r.replyTo||n;try{return await t.call(()=>e.email.send({to:r.email,...i,...s?{replyTo:s}:{}})),!0}catch(n){return a(t,e.log,`warn`,o,{...r.id?{attendeeId:r.id}:{},error:String(n)}),!1}}function zt(e,t,n){let r=t.eventTitle||e.fallbackTitle;return t.status===`waitlist`?e.waitlisted({name:t.displayName,title:r,position:t.waitlistPosition??0,cancelUrl:n.cancelUrl}):t.status===`pending`?e.requestReceived({name:t.displayName,title:r,deadline:n.deadline,cancelUrl:n.cancelUrl}):e.rsvpConfirmed({name:t.displayName,title:r,calendarUrl:n.calendarUrl,cancelUrl:n.cancelUrl})}const Bt=`ledger-reconcile`;function Vt(e,t,n,r=Date.now()){return k(e.kv,t,n,async({poolKey:t,occurrenceStart:n,budget:r,isQuiet:i})=>{let a=0,o=await D(r,r=>e.storage.attendees.query({where:{translationGroup:t,occurrenceStart:n},limit:100,cursor:r}),e=>{if(!i(e.updatedAt))return!1;(e.status===`going`||e.status===`attended`||e.status===`pending`)&&(a+=e.quantity||1)},1);if(o!==`OK`)return o;let s=0,c=0,l=0,u=await D(r,r=>e.storage.waitlist_entries.query({where:{poolKey:t,occurrenceStart:n},limit:100,cursor:r}),e=>{if(!i(e.updatedAt))return!1;e.status===`queued`?c+=e.quantity||1:e.status===`offered`&&(s+=e.quantity||1),l=Math.max(l,e.position||0)},1);return u===`OK`?{taken:a,held:s,waitlistCount:c,maxPosition:l}:u},{nowMs:r,log:e.log})}function Ht(e,t,n=Date.now()){return A(e.kv,t,`state:reconcile-cursor`,(t,r)=>Vt(e,r,t,n))}const Ut=`attendance-reminders`;async function Wt(e,t,n=Date.now()){let r=await K(e,t);if(r.reminderLeadHours===0)return{sent:0,disabled:!0};let i=new Date(n).toISOString(),a=new Date(n+r.reminderLeadHours*36e5).toISOString(),o=await t.call(()=>e.storage.attendees.query({where:{reminder:`due`,status:`going`,startsAt:{gt:i,lte:a}},orderBy:{startsAt:`asc`},limit:3})),s=0;for(let{data:n}of o.items){if(!t.has(2))break;if(!(await t.call(()=>e.storage.attendees.updateIf(n.id,{where:{reminder:`due`,status:`going`},set:{reminder:`sent`,remindedAt:i}}))).applied||!n.email)continue;let a=U(n.locale,r.defaultLocale),o=await W(e,t,a),c=n.startsAt?Rt({startsAt:n.startsAt,allDay:n.allDay===!0,timezone:n.timezone},a):o.soon,l=e.site?.url??``,u=await Fe(r.hmacSecret,n.id,n.createdAt,n.eventId),d=o.reminder({name:n.displayName,title:n.eventTitle||o.fallbackTitle,when:c,quantity:n.quantity,calendarUrl:It(l,n.eventId,n.occurrenceStart,n.collection,e.plugin?.id),cancelUrl:Mt(l,r,`cancel`,u)});await q(e,t,r.replyTo,n,d,`Reminder email failed`)&&s++}return{sent:s,disabled:!1}}const Gt=`waitlist-maintenance`,Kt=`attendance-mail`,qt=`attendance-retention`,Jt=`attendance-approvals`,Yt=[{name:Gt,schedule:`* * * * *`},{name:Bt,schedule:`*/10 * * * *`},{name:Ut,schedule:`* * * * *`},{name:Kt,schedule:`* * * * *`},{name:Jt,schedule:`*/5 * * * *`},{name:qt,schedule:`17 * * * *`},{name:ct,schedule:`* * * * *`}];async function Xt(e,t){if(!e||!t.has(1))return[];let n=await t.call(()=>e.list()),r=[];for(let i of Yt){let a=n.find(e=>e.name===i.name);if(!(a&&a.schedule===i.schedule)){if(!t.has(1))break;await t.call(()=>e.schedule(i.name,{schedule:i.schedule})),r.push(i.name)}}return r}async function Zt(e){if(e)for(let t of Yt)await e.schedule(t.name,{schedule:t.schedule})}function Qt(e,t=Date.now()){if(!e)return!0;let n=Date.parse(e);return Number.isNaN(n)?!1:n>=t-432e5}async function $t(e,t,n,r=Date.now()){for(let i of[`going`,`pending`,`waitlist`]){if(!t.has(1))return!1;if((await t.call(()=>e.storage.attendees.query({where:{eventId:n,status:i},limit:50}))).items.some(e=>Qt(e.data.startsAt||e.data.occurrenceStart,r)))return!0}return!1}function J(e){return e}function en(e,t){return(e||t).trim()}async function tn(e,t,n,r=``){if(!t.has(6))return{promoted:!1,reason:`BUDGET`};let i=(await t.call(()=>e.storage.waitlist_entries.query({where:{poolKey:n,occurrenceStart:r,status:`queued`},orderBy:{position:`asc`},limit:1}))).items[0]?.data;if(!i)return{promoted:!1,reason:`NO_QUEUED_ATTENDEES`};let o=await K(e,t);if(!t.has(4))return{promoted:!1,reason:`BUDGET`};let s=g(n,r),c=await E(e.kv,t,s,i.quantity);if(c!==`HELD`)return{promoted:!1,reason:c};let l=new Date,u=new Date(l.getTime()+72e5).toISOString(),d=await Ie(o.hmacSecret,i.id,i.eventId,u),f=await Re(d),p=await t.call(()=>e.storage.waitlist_entries.updateIf(i.id,{where:{status:`queued`},set:{status:`offered`,offerExpiresAt:u,claimTokenHash:f,updatedAt:l.toISOString()}}));if(!p.applied)return t.has(2)?await T(e.kv,t,s,{held:i.quantity,waitlistCount:-i.quantity},1):a(t,e.log,`error`,`Held seats could not be returned after a promotion race`,{ledgerKey:s,entryId:i.id}),{promoted:!1,reason:`RACE`};let m=await W(e,t,U(i.locale,o.defaultLocale)),h=Mt(e.site?.url??``,o,`claim`,d);return await q(e,t,o.replyTo,i,m.offer({name:i.displayName,title:i.eventTitle||m.fallbackTitle,claimUrl:h})),{promoted:!0,entry:{...i,...p.data}}}async function nn(e,t,n,r=Date.now()){if(!R(n))return{ok:!1,error:`INVALID_TOKEN`};let i=await Re(n),o=(await t.call(()=>e.storage.waitlist_entries.query({where:{claimTokenHash:i},limit:1}))).items[0]?.data;if(!o)return{ok:!1,error:`ENTRY_NOT_FOUND`};if(o.status===`claimed`)return{ok:!1,error:`ALREADY_CLAIMED`};if(o.status===`expired`)return{ok:!1,error:`OFFER_EXPIRED`};if(o.status!==`offered`)return{ok:!1,error:`INVALID_STATUS`};if(!(r<(o.offerExpiresAt?Date.parse(o.offerExpiresAt):0)))return{ok:!1,error:`OFFER_EXPIRED`};let s=new Date(r).toISOString(),c=await t.call(()=>e.storage.waitlist_entries.updateIf(o.id,{where:{status:`offered`,claimTokenHash:i},set:{status:`claimed`,claimedAt:s,updatedAt:s}}));if(!c.applied)return{ok:!1,error:`OFFER_NO_LONGER_AVAILABLE`};let l=g(o.poolKey,o.occurrenceStart);await T(e.kv,t,l,{heldToTaken:o.quantity},2)||a(t,e.log,`error`,`Claim could not move held seats to taken`,{ledgerKey:l,entryId:o.id});let u=!1,f=48;if(e.storage.attendance_settings&&t.has(2)){let n=await Be(e.storage.attendance_settings,t,{id:o.eventId,translationGroup:o.poolKey,status:`published`,data:{}});u=n.config.requireApproval,f=n.config.approvalHours}else e.storage.attendance_settings&&a(t,e.log,`warn`,`Skipped approval check on waitlist claim due to call budget`,{entryId:o.id,attendeeId:o.attendeeId});let p=t.has(3)?await K(e,t):null,m=!!e.email?.send&&!!p&&t.has(2),h=!!e.email?.send&&!m,_=u?Ue(r,f,o.occurrenceStart||void 0):void 0,v=!!(o.replyTo||p?.replyTo),y=await t.call(()=>e.storage.attendees.updateIf(o.attendeeId,{where:{status:`waitlist`},set:{status:u?`pending`:`going`,..._?{approvalDueAt:_}:{},...u&&v?{organiserNotice:`queued`}:{},...h?{mail:`queued`}:{},updatedAt:s}}));if(!y.applied)return{ok:!1,error:`ATTENDEE_NOT_WAITLISTED`};let b=y.data;if(p&&m){let n=await Fe(p.hmacSecret,b.id,b.createdAt,b.eventId),r=U(b.locale??o.locale,p.defaultLocale),i=await W(e,t,r),a=o.eventTitle||i.fallbackTitle,s=Mt(e.site?.url??``,p,`cancel`,n),c=u?i.requestReceived({name:b.displayName,title:a,deadline:d(_,b.timezone,mt(r)),cancelUrl:s}):i.claimConfirmed({name:b.displayName,title:a,calendarUrl:b.startsAt?It(e.site?.url??``,b.eventId,b.occurrenceStart,b.collection,e.plugin?.id):void 0,cancelUrl:s});await q(e,t,p.replyTo,b,c)}return{ok:!0,attendee:b,waitlistEntry:{...o,...c.data}}}async function rn(e,t,n){let r=await t.call(()=>e.storage.attendees.get(n));if(!r||r.erasedAt||r.status!==`waitlist`||!r.waitlistEntryId)return{ok:!1,error:`NOT_QUEUED`};let i=await t.call(()=>e.storage.waitlist_entries.get(r.waitlistEntryId));if(!i||i.status!==`queued`)return{ok:!1,error:`NOT_QUEUED`};let a=g(i.poolKey,i.occurrenceStart),o=await S(e.kv,t,a,e=>e?{next:{...e,nextPosition:e.nextPosition+1},result:e.nextPosition}:{abort:0});if(!o.applied)return{ok:!1,error:o.reason===`ABORTED`?`NO_LEDGER`:`RACE`};let s=o.result;if(!(await t.call(()=>e.storage.waitlist_entries.updateIf(i.id,{where:{status:`queued`,position:i.position},set:{position:s,updatedAt:new Date().toISOString()}}))).applied)return{ok:!1,error:`RACE`};if(t.has(3)){let n=await K(e,t),r=await W(e,t,U(i.locale,n.defaultLocale));await q(e,t,n.replyTo,i,r.movedToEnd({name:i.displayName,title:i.eventTitle||r.fallbackTitle,quantity:i.quantity}))}return{ok:!0,position:s}}async function an(e,t,n){if(n.status===`cancelled`||n.erasedAt)return{ok:!1,error:`ALREADY_CANCELLED`,seatsFreed:!1};let r=new Date().toISOString(),i=await t.call(()=>e.storage.attendees.updateIf(n.id,{where:{status:n.status},set:{status:`cancelled`,...n.organiserNotice===`queued`?{organiserNotice:`sent`}:{},updatedAt:r}}));if(!i.applied)return{ok:!1,error:`ALREADY_CANCELLED`,seatsFreed:!1};let o=g(en(n.translationGroup,n.eventId),n.occurrenceStart),s={taken:n.quantity},c=!0;if(n.status===`waitlist`&&n.waitlistEntryId){s=null,c=!1;for(let i=0;i<2&&t.has(4);i++){let i=await t.call(()=>e.storage.waitlist_entries.get(n.waitlistEntryId));if(!i||i.status===`cancelled`||i.status===`expired`)break;if(i.status===`claimed`){s={taken:n.quantity},c=!0;break}if((await t.call(()=>e.storage.waitlist_entries.updateIf(i.id,{where:{status:i.status},set:{status:`cancelled`,updatedAt:r}}))).applied){s=i.status===`queued`?{waitlistCount:n.quantity}:{held:n.quantity},c=i.status===`offered`;break}}}return s&&(await T(e.kv,t,o,s,2)||a(t,e.log,`error`,`Cancellation could not release ledger seats`,{ledgerKey:o,attendeeId:n.id})),{ok:!0,attendee:{...n,...i.data},seatsFreed:c}}async function on(e,t,n=Date.now()){let r={expiredCount:0,promotedCount:0,budgetExhausted:!1},i=new Date(n).toISOString(),a=await t.call(()=>e.storage.waitlist_entries.query({where:{status:`offered`,offerExpiresAt:{lte:i}},orderBy:{offerExpiresAt:`asc`},limit:2}));for(let{data:n}of a.items){if(!t.has(5)){r.budgetExhausted=!0;break}(await t.call(()=>e.storage.waitlist_entries.updateIf(n.id,{where:{status:`offered`},set:{status:`expired`,updatedAt:i}}))).applied&&(r.expiredCount++,await T(e.kv,t,g(n.poolKey,n.occurrenceStart),{held:n.quantity},1),await t.call(()=>e.storage.attendees.updateIf(n.attendeeId,{where:{status:`waitlist`},set:{status:`cancelled`,updatedAt:i}})))}if(!t.has(7))return r.budgetExhausted=!0,r;let o=(await t.call(()=>e.kv.list(h))).map(({key:e,value:t})=>({key:e,ledger:y(t)})).filter(e=>!!e.ledger&&e.ledger.waitlistCount>0&&x(e.ledger)>0).sort((e,t)=>e.key<t.key?-1:e.key>t.key?1:0);if(o.length===0)return r;let s=o,c,l=null,u=o.length>1&&t.has(8);if(u){let n=await t.call(()=>e.kv.getVersioned(sn));l=n?.revision??null;let r=o.findIndex(e=>!n||e.key>n.value);s=r<=0?o:[...o.slice(r),...o.slice(0,r)]}let d=u?1:0;for(let{key:n,ledger:i}of s){if(!t.has(6+d)){r.budgetExhausted=!0;break}let a=i.poolKey||_(n,i.occurrenceStart);c=n,(await tn(e,t,a,i.occurrenceStart)).promoted&&r.promotedCount++}return u&&c&&await t.call(()=>e.kv.compareAndSet(sn,l,c)),r}const sn=`state:maintenance-cursor`,cn={navOverview:`Registrations`,navRoster:`Door list`,lightDone:`Done. Open the page again to see the updated lists.`,checkedIn:`Checked in.`,checkInRefused:`Only confirmed registrations can be checked in.`,cancelled:`Registration cancelled. Freed places go to the waiting list.`,alreadyCancelled:`This registration was already cancelled.`,moved:`Moved to the end of the waiting list. The next person in line is offered the free places within a minute.`,moveRefused:`Only people who are waiting can be moved (not while they have an offer).`,moveRace:`The waiting list changed at the same moment. Please try again.`,maintenance:[`Expired {expired} offer(s), sent {promoted} new offer(s){more, select, true {; more work remains for the next minute} other {}}.`,`expired`,`promoted`,`more`],noLedgers:`No seat ledgers yet.`,corrected:[`Corrected {key}: taken {t}, held {h}, waiting {w}.`,`key`,`t`,`h`,`w`],ledgerStatus:{UNCHANGED:`already matches its records.`,MISSING:`no longer exists.`,BUSY:`had activity in the last 10 minutes; it will be checked later.`,TOO_LARGE:`has too many records to check in one pass.`,CONFLICT:`changed while being checked; it will be retried.`},scheduled:[`Scheduled background task(s): {names}.`,`names`],downloadCsv:`Download the list (CSV)`,downloadHtml:`Download the printable list (.html)`,noSiteUrl:`Site URL not configured`,noSiteUrlBody:`Set the site URL so download links can be generated.`,linkNote:`The link works once, for 10 minutes. Open the .html file and print it.`,showAllEvents:`Show all events`,filterOn:[`Only showing: {event}`,`event`],filterOnBody:`The list below shows this event only. The overview above always counts all events.`,ticketedHeader:`Events with tickets`,ticketedIntro:`People who bought a ticket for these events are listed under Tickets → Orders, not here.`,openOrders:`View orders`,cancelledHidden:`Cancelled registrations are not shown.`,cancelledShown:`Cancelled registrations are shown too.`,showCancelled:`Show cancelled ones too`,hideCancelled:`Hide cancelled ones`,rosterHeader:`Door list and check-in`,rosterIntro:`Tick people off as they arrive. This page also works on a phone.`,preparePrintable:`Printable list`,prepareCsv:`CSV file`,colStatus:`Status`,colSeats:`Places`,colAnswers:`Answers`,checkIn:`Check in`,approve:`Approve`,decline:`Decline`,declineTitle:[`Decline {name}'s request?`,`name`],declineText:`Their places are released and they get an email.`,approvedSent:`Approved. The confirmation email is sent.`,approvedQueued:`Approved. The confirmation email goes out within a minute.`,declinedToast:`Declined. The places are free again.`,requestAlreadyHandled:`This request was already answered.`,moveToEnd:`Move to end of list`,moveTitle:[`Move {name} to the end of the waiting list?`,`name`],moveText:`They keep a place in line, behind everyone else, and get an email. Use this when the free places are too few for their booking and others are waiting.`,moveConfirm:`Move to end`,keep:`Keep`,cancelRsvp:`Cancel`,cancelConfirm:`Cancel registration`,cancelTitle:[`Cancel {name}'s registration?`,`name`],cancelText:`Their places go to the waiting list. This cannot be undone.`,heatmapHeader:`Which days and times fill up fastest`,heatmapIntro:`Average share of places in use by weekday and start hour, for upcoming dates with a limit. Busiest first.`,colDay:`Day`,colStarts:`Starts`,colUsedPct:`Places in use`,colSessions:`Dates`,upcomingSessions:`Upcoming events`,attendees:`Who registered`,colAttendee:`Name`,colEmail:`Email`,colDateTime:`Date`,colAction:`Actions`,colCancel:` `,noAttendeesSelection:`Nobody registered for this selection yet.`,noRsvps:`Nobody has registered yet. Registrations appear here as they come in.`,settingsHeader:`Registration settings`,settingsIntro:`Technical settings, normally set once when the site is built. Email links open the self-service page on your site, which must show the RsvpManage component.`,componentsHint:[`Site components (RsvpForm, RsvpManage): use apiEndpoint "/_emdash/api/plugins/{id}/rsvp" and apiBase "/_emdash/api/plugins/{id}".`,`id`],fieldCollections:`Content collections that hold events (comma-separated)`,fieldManagePath:`Path of the self-service page`,fieldReplyTo:`Replies to emails go to (optional)`,fieldReminders:`Send a reminder this many hours before the event (0 = no reminder)`,fieldRetentionDays:`Delete names, emails and answers this many days after the event (30–3650)`,fieldDefaultTimezone:`Time zone for events that don't have their own, for example Europe/Zurich (empty: UTC)`,fieldLocale:`Language of emails when the form doesn't say`,fieldTurnstileSiteKey:`Cloudflare Turnstile site key (optional; empty = off)`,fieldTurnstileSecret:`Cloudflare Turnstile secret key`,turnstileSecretSaved:`Saved. Leave empty to keep it.`,turnstileOn:`Turnstile is on: the booking form shows Cloudflare's check, and bookings without a valid token are refused. If Cloudflare can't be reached, bookings go through.`,turnstileOff:`Turnstile is off. To turn it on, create a widget for this site's domain in the Cloudflare dashboard (Turnstile) and paste both keys above.`,save:`Save`,tasksIntro:`Waiting-list offers move on every minute, and counts are checked every 10 minutes. You can run either now.`,runMaintenance:`Move the waiting list on now`,runReconcile:`Check the counts now`,status:{going:`Confirmed`,pending:`Awaiting approval`,waitlist:`Waiting list`,attended:`Checked in`,cancelled:`Cancelled`,erased:`Erased`},personalDataHeader:`Delete someone's personal data`,personalDataIntro:`When someone asks you to delete their details (GDPR, FADP), look them up by email address.`,fieldEraseEmail:`Their email address`,findPersonalData:`Find`,colEventTitle:`Event`,liveNotErased:`live, not erased`,statusErased:`Erased`,erasePersonalData:`Erase personal data`,eraseConfirmTitle:`Erase this person's data?`,eraseConfirmText:`Names, email addresses and answers are removed for good. Seat counts stay. Live registrations are not erased: cancel them first.`,eraseConfirmButton:`Erase personal data`,noPersonalDataFound:`No records found for this email address.`,erasedMore:[`Erased {n}. Press again for the rest.`,`n`],erasedAll:[`Personal data erased ({n, plural, one {# record} other {# records}}).`,`n`],singleEvent:`Single event`,bookedSeats:`Registered`,waiting:`Waiting list`,seatsOnWaitlists:`places asked for`,requestsWaiting:`To approve`,requestsPendingNote:`requests waiting for you`,unlimited:`No limit`,scopeAll:`places taken, all upcoming events`,colEvent:`Event`,colDateTimeLower:`Date`,colBooked:`Registered`,noUpcoming:`No upcoming events with registrations yet.`,days:{0:`Mon`,1:`Tue`,2:`Wed`,3:`Thu`,4:`Fri`,5:`Sat`,6:`Sun`},filterEvent:`Event`,allEvents:`All events`,filterDate:`Date`,allDates:`All dates`,showAttendees:`Show`,openEvent:`Open an event in the content editor to set up its registrations.`,notConfigured:[`Attendance applies to: {collections}. Add this collection on the Attendance admin page if bookings should be taken for it.`,`collections`],notEventContent:`Registrations are not used for this kind of content.`,saveFirst:`Save the event first, then set up its registrations here.`,panelSaved:`Registration settings saved.`,panelNotSaved:`Nothing was saved: fix the questions first.`,questionsNeedFixing:`The questions need fixing`,ticketedTitle:`This event sells tickets`,ticketedBody:`Free registration is off for this event: it is managed in the Tickets panel, and purchases are listed under Tickets → Orders.`,enable:`Open for registration`,enableHelp:`Visitors can register on your site. Turn this off to stop new registrations; existing ones stay.`,capacityLimit:`Places available (0 = no limit)`,maxPerBooking:`Most places one person can book`,allowWaitlist:`Waiting list when full`,allowWaitlistHelp:`When all places are taken, visitors can join a waiting list. Freed places are offered in order of arrival.`,requireApproval:`Approve each registration yourself`,requireApprovalHelp:`Registrations wait, holding their places, until you approve or decline them under Registrations.`,approvalHours:`Hours you have to decide (1–720)`,eventReplyTo:`Replies to this event's emails go to (optional)`,savePanel:`Save registration settings`,required:`required`,statusOpen:`Open for registration`,statusClosed:`Closed for registration`,placesTakenOf:[`{n} of {c} places taken`,`n`,`c`],placesTaken:[`{n, plural, one {# place} other {# places}} taken`,`n`],placesTakenAllDates:[`{n, plural, one {# place} other {# places}} taken across all dates`,`n`],placesOffered:[`{n} offered to the waiting list`,`n`],peopleWaiting:[`{n} on the waiting list`,`n`],viewRegistrations:`View registrations`,fromEventPlaces:[`{c} places`,`c`],fromEventNoLimit:`No limit on places`,fromEventWaitlistOn:`waiting list on`,fromEventWaitlistOff:`no waiting list`,fromEventLead:`From the event form:`,fromEventHint:`Change this in the event's own capacity and waiting-list fields.`,fromEventOpenHint:`Registration is open when the event is published and its field with the choices “Rsvp” and “Tickets” is set to “Rsvp”. Leave that field empty to keep registration closed.`,fieldsOverriddenTitle:`Older settings in this panel still apply`,fieldsOverridden:`Places, the waiting list or opening were set in this panel earlier, and those older values decide what visitors get instead of the event's fields.`,useEventFields:`Use the event's fields`,usingEventFields:`The event's own fields apply again.`,savedSeparately:`Use this button to save these settings; the event's own Save doesn't include them. They apply to every language version of the event.`,qHeader:`Questions on the registration form`,qIntro:`Name and email are always asked. Add your own questions, such as T-shirt size or dietary needs. Each question is saved on its own; answers appear in the registration list, the door list and the CSV.`,qLabel:`Question`,qLabelPlaceholder:`For example: T-shirt size`,qType:`Kind of answer`,qTypes:{text:`Short text`,textarea:`Long text`,email:`Email address`,phone:`Phone number`,number:`Number`,date:`Date`,checkbox:`Tick box`,select:`Choice from a list`},qOptions:`Choices (one per line)`,qRequired:`Must be answered`,qAdd:`Add question`,qSave:`Save question`,qAddHeader:`Add a question`,qRemove:`Remove`,qRemoveTitle:[`Remove "{label}"?`,`label`],qRemoveText:`The question disappears from the form. Answers already given stay with their registrations.`,qMoveUp:`Move up`,qSaved:`Question saved.`,qAdded:`Question added.`,qRemoved:`Question removed.`,qMoved:`Question moved up.`,qNotSaved:`The question was not saved`,qGone:`This question no longer exists. Reload the page.`,navSettings:`Registration settings`,settingsSaved:`Settings saved.`,siteSetupHeader:`Site setup (for whoever built the site)`,undoCheckIn:`Undo check-in`,checkInUndone:`Check-in undone.`,undoRefused:`This person isn't checked in.`,places:[`{n, plural, one {# place} other {# places}}`,`n`],attentionTitle:[`Waiting for your decision: {n}`,`n`],attentionText:`These people asked to register. Their places are held until you approve or decline; if you don't answer in time, the request lapses.`,attentionMore:[`And {n} more: they are in the list below with the status "Awaiting approval".`,`n`],decideBy:[`decide by {when}`,`when`],sessFull:`Full`,sessAlmost:`Almost full`,sessOpen:`Places left`,colList:`List`,viewList:`View`,filterSearch:`Find a name or email address (optional)`,searchFound:[`Found {n}.`,`n`],searchNone:`Nobody found with that name or email address.`,searchPartial:`The list is long and was not searched to the end: choose an event to narrow it down.`,phoneHint:`On a phone the buttons in this table are hidden: search for a name above, or use the door list.`,doorShow:`Show`,doorSearch:`Find a name (optional)`,doorChooseTitle:`Choose an event`,doorChooseText:`Pick the event you are checking people in for, then press Show.`,doorCount:[`{n} of {of}{more, select, true {+} other {}} checked in`,`n`,`of`,`more`],doorCheckedAt:[`✓ checked in {when}`,`when`],doorEmpty:`Nobody to check in yet`,doorNext:`Show more people`,doorPrintIntro:`Prefer paper or a spreadsheet? Make a file of this list.`,doorNextEvent:[`Showing the next event: {event}. To check people in for another one, choose it above.`,`event`],listFilesIntro:`Print the list or open it in a spreadsheet: make a file of the event chosen above (all events when none is chosen), with everyone's status, cancelled ones included.`,allEventsTitle:`All Events`,allDatesTitle:`All Dates`,eventLabel:[`Event {id}`,`id`],truncated:[`Showing the first {n} attendees; filter by event to export the rest.`,`n`],csvHeaders:{0:`Check-in Status`,1:`Display Name`,2:`Email`,3:`Status`,4:`Quantity`,5:`Occurrence Time`,6:`Local time`,7:`Checked-in At`,8:`Answers`,9:`Attendee ID`},yes:`YES`,no:`NO`,rosterTitle:`Door Roster`,rosterSession:`Session`,rosterTotal:`Total Attendees`,printedAt:`Printed`,printButton:`Print Door Roster`,htmlHeaders:{0:`In`,1:`#`,2:`Attendee Name`,3:`Email`,4:`Status`,5:`Qty`,6:`Session Date`,7:`Answers`,8:`Staff Notes`},noAttendeesRegistered:`No attendees registered.`,singleEventCsv:`Single Event`,questionIssues:{NO_LABEL:[`{hasLine, select, true {Line {line}: } other {}}write the question first.`],LABEL_TOO_LONG:[`{hasLine, select, true {Line {line}: } other {}}the question is longer than {limit} characters.`],BAD_TYPE:[`{hasLine, select, true {Line {line}: } other {}}"{value}" isn't a type. Use one of: text, textarea, email, phone, number, date, checkbox, select.`],BAD_REQUIRED:[`{hasLine, select, true {Line {line}: } other {}}write "required" or "optional" in the third column.`],NO_OPTIONS:[`{hasLine, select, true {Line {line}: } other {}}a choice from a list needs at least one choice, for example S, M, L.`],TOO_MANY_OPTIONS:[`{hasLine, select, true {Line {line}: } other {}}at most {limit} choices.`],OPTION_TOO_LONG:[`{hasLine, select, true {Line {line}: } other {}}a choice can be at most {limit} characters.`],OPTIONS_NOT_ALLOWED:[`{hasLine, select, true {Line {line}: } other {}}only select questions take options.`],INVALID:[`{hasLine, select, true {Line {line}: } other {}}invalid question.`],TOO_MANY_QUESTIONS:[`At most {limit} questions per event.`]}},ln=new WeakMap;let un;function dn(e,t){let n=$e(cn,e,t);return n.questionIssue=e=>{let t={hasLine:!!e.line,line:e.line??``,limit:e.limit??``,value:e.value??``},r=n.questionIssues;return(r[e.code]??r.INVALID)(t)},n}function fn(e,t=`en`){if(!e)return un??=dn(null,`en`);let n=ln.get(e);return n||ln.set(e,n=dn(pn(e,`admin.`),t)),n}function pn(e,t){let n={};for(let r in e)r.startsWith(t)&&(n[r.slice(t.length)]=e[r]);return n}const mn=`export:`;function Y(e){if(e==null)return`""`;let t=String(e);return/^[=+\-@\t\r\uFF1D\uFF0B\uFF0D\uFF20]/.test(t)&&(t=`'${t}`),`"${t.replace(/"/g,`""`)}"`}function X(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#039;`)}function hn(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,`-`).slice(0,60)||`events`}function gn(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``)}const _n=`eventual-attendance`;async function vn(e,t,n,r=e.plugin?.id||_n){let i=String(e.site?.url??``).replace(/\/+$/,``);if(!/^https?:\/\//.test(i))return null;let a=gn(32),o=new Date(Date.now()+6e5).toISOString(),s={...n,expiresAt:o},c=`${mn}${await L(a)}`;return await t.call(()=>e.kv.set(c,s)),{url:`${i}/_emdash/api/plugins/${r||_n}/roster/download?token=${a}`,expiresAt:o}}async function yn(e,t,n){if(!R(n))return null;let r=`${mn}${await L(n)}`,i=await t.call(()=>e.kv.getVersioned(r));return!i||!(await t.call(()=>e.kv.compareAndDelete(r,i.revision))).applied||!(Date.now()<Date.parse(i.value.expiresAt))?null:bn(i.value,e,t)}async function bn(e,t,n){let r=fn(await ut(t,n,e.locale),H(e.locale)),i=t.storage.attendees,a=e.eventId?wt(await K(t,n))[0]:void 0,o={};e.poolKey?o.translationGroup=e.poolKey:e.eventId&&(o.eventId=e.eventId),(e.poolKey||e.eventId)&&e.occurrenceStart&&(o.occurrenceStart=e.occurrenceStart);let s=[],c,l=!1;do{if(!n.has(2)){l=!0;break}let e=await n.call(()=>i.query({where:Object.keys(o).length?o:void 0,limit:100,cursor:c}));s.push(...e.items.map(e=>e.data)),c=e.hasMore?e.cursor:void 0}while(c);e.occurrenceStart&&!e.eventId&&(s=s.filter(t=>t.occurrenceStart===e.occurrenceStart));let u={going:1,attended:2,waitlist:3,cancelled:4};s.sort((e,t)=>{let n=u[e.status]??99,r=u[t.status]??99;return n===r?e.displayName.localeCompare(t.displayName):n-r});let f=s.find(e=>e.eventTitle)?.eventTitle,p=e.eventId&&!f&&n.has(1)?await n.call(()=>t.content.get(a,e.eventId)).catch(()=>null):null,m=String(e.title||f||p?.data?.title||(e.eventId?r.eventLabel(e.eventId):e.poolKey?r.rosterTitle:r.allEventsTitle)),h=mt(H(e.locale)),g=s.find(t=>(!e.occurrenceStart||t.occurrenceStart===e.occurrenceStart)&&t.timezone)?.timezone,_=e.occurrenceStart?d(e.occurrenceStart,g,h):r.allDatesTitle,v=l?r.truncated(s.length):``;if(e.format===`csv`){let t=[Object.values(r.csvHeaders).join(`,`)];v&&t.unshift(Y(v));for(let e of s){let n=!!e.erasedAt;t.push([Y(e.status===`attended`?r.yes:r.no),Y(n?`—`:e.displayName),Y(n?`—`:e.email),Y(n?r.status.erased:r.status[e.status]??e.status),Y(e.quantity||1),Y(e.occurrenceStart||r.singleEventCsv),Y(e.occurrenceStart?d(e.occurrenceStart,e.timezone,h):r.singleEventCsv),Y(e.checkedInAt||``),Y(n?``:Oe(e.answers)),Y(e.id)].join(`,`))}return{contentType:`text/csv; charset=utf-8`,filename:`roster-${hn(e.eventId||e.poolKey||`events`)}-${Date.now()}.csv`,body:t.join(`\r
67
67
  `)}}let y=s.map((e,t)=>{let n=e.status===`attended`,i=!!e.erasedAt,a=e.status,o=e.occurrenceStart?d(e.occurrenceStart,e.timezone,h):`-`;return`<tr>
68
68
  <td class="checkbox-col">${n?`☑`:`☐`}</td>
69
69
  <td class="idx-col">${t+1}</td>
70
- <td class="name-col"><strong>${Z(i?`—`:e.displayName)}</strong></td>
71
- <td>${Z(i?`—`:e.email)}</td>
72
- <td class="status-col"><span class="badge ${a}">${Z(i?r.status.erased:r.status[e.status]??e.status)}</span></td>
70
+ <td class="name-col"><strong>${X(i?`—`:e.displayName)}</strong></td>
71
+ <td>${X(i?`—`:e.email)}</td>
72
+ <td class="status-col"><span class="badge ${a}">${X(i?r.status.erased:r.status[e.status]??e.status)}</span></td>
73
73
  <td class="num-col">${e.quantity||1}</td>
74
- <td class="time-col">${Z(o)}</td>
75
- <td class="answers-col">${Z(i?``:De(e.answers))}</td>
74
+ <td class="time-col">${X(o)}</td>
75
+ <td class="answers-col">${X(i?``:Oe(e.answers))}</td>
76
76
  <td class="notes-col"></td>
77
77
  </tr>`}).join(`
78
78
  `),b=`<!DOCTYPE html>
79
- <html lang="${U(e.locale)}" dir="${Ze(U(e.locale))}">
79
+ <html lang="${H(e.locale)}" dir="${Qe(H(e.locale))}">
80
80
  <head>
81
81
  <meta charset="utf-8">
82
- <title>${Z(r.rosterTitle)}: ${Z(m)}</title>
82
+ <title>${X(r.rosterTitle)}: ${X(m)}</title>
83
83
  <style>
84
84
  @page { size: A4 landscape; margin: 12mm; }
85
85
  body {
@@ -155,24 +155,24 @@ If you can no longer come, please cancel so someone else can have your seat:
155
155
  <body>
156
156
  <div class="header">
157
157
  <div>
158
- <h1>${Z(m)}</h1>
159
- <div class="meta">${Z(r.rosterSession)}: <strong>${Z(_)}</strong> | ${Z(r.rosterTotal)}: <strong>${s.length}</strong> | ${Z(r.printedAt)}: ${new Date().toUTCString()}</div>
160
- ${v?`<div class="meta"><strong>${Z(v)}</strong></div>`:``}
158
+ <h1>${X(m)}</h1>
159
+ <div class="meta">${X(r.rosterSession)}: <strong>${X(_)}</strong> | ${X(r.rosterTotal)}: <strong>${s.length}</strong> | ${X(r.printedAt)}: ${new Date().toUTCString()}</div>
160
+ ${v?`<div class="meta"><strong>${X(v)}</strong></div>`:``}
161
161
  </div>
162
- <button class="print-btn" onclick="window.print()">${Z(r.printButton)}</button>
162
+ <button class="print-btn" onclick="window.print()">${X(r.printButton)}</button>
163
163
  </div>
164
164
  <table>
165
165
  <thead>
166
166
  <tr>
167
- <th class="checkbox-col">${Z(r.htmlHeaders[0])}</th>
168
- <th class="idx-col">${Z(r.htmlHeaders[1])}</th>
169
- <th>${Z(r.htmlHeaders[2])}</th>
170
- <th>${Z(r.htmlHeaders[3])}</th>
171
- <th>${Z(r.htmlHeaders[4])}</th>
172
- <th class="num-col">${Z(r.htmlHeaders[5])}</th>
173
- <th>${Z(r.htmlHeaders[6])}</th>
174
- <th>${Z(r.htmlHeaders[7])}</th>
175
- <th>${Z(r.htmlHeaders[8])}</th>
167
+ <th class="checkbox-col">${X(r.htmlHeaders[0])}</th>
168
+ <th class="idx-col">${X(r.htmlHeaders[1])}</th>
169
+ <th>${X(r.htmlHeaders[2])}</th>
170
+ <th>${X(r.htmlHeaders[3])}</th>
171
+ <th>${X(r.htmlHeaders[4])}</th>
172
+ <th class="num-col">${X(r.htmlHeaders[5])}</th>
173
+ <th>${X(r.htmlHeaders[6])}</th>
174
+ <th>${X(r.htmlHeaders[7])}</th>
175
+ <th>${X(r.htmlHeaders[8])}</th>
176
176
  </tr>
177
177
  </thead>
178
178
  <tbody>
@@ -180,9 +180,9 @@ If you can no longer come, please cancel so someone else can have your seat:
180
180
  </tbody>
181
181
  </table>
182
182
  </body>
183
- </html>`;return{contentType:`application/octet-stream`,filename:`roster-${mn(e.eventId||`events`)}.html`,body:b}}const bn=dn();function xn(e){let t=[];for(let{key:n,value:r}of e){let e=y(r);if(!e)continue;let i=e.poolKey||_(n,e.occurrenceStart),a=e.taken+e.held;t.push({key:n,poolKey:i,occurrenceStart:e.occurrenceStart,label:e.label||i,...e.timezone?{timezone:e.timezone}:{},capacity:e.capacity,taken:e.taken,held:e.held,waitlistCount:e.waitlistCount,usedPct:e.capacity>0?Math.round(a/e.capacity*100):null})}return t}function Sn(e,t){return e.filter(e=>!e.occurrenceStart||Date.parse(e.occurrenceStart)>=t-432e5).sort((e,t)=>(e.occurrenceStart||`9999`).localeCompare(t.occurrenceStart||`9999`)||e.label.localeCompare(t.label))}function Cn(e,t){let n=e&&typeof e==`object`?e:{},r=typeof n.pool==`string`&&t.some(e=>e.poolKey===n.pool)?n.pool:void 0,i=r&&typeof n.occurrence==`string`&&t.some(e=>e.poolKey===r&&e.occurrenceStart===n.occurrence&&n.occurrence!==``)?n.occurrence:void 0;return{...r?{pool:r}:{},...i?{occurrence:i}:{},...n.cancelled===!0?{cancelled:!0}:{}}}function Q(e,t=bn,n,r=`en`){return e?d(e,n,r):t.singleEvent}function wn(e,t,n=bn,r){let i=t=>e.reduce((e,n)=>e+t(n),0),a=i(e=>e.held);return{type:`stats`,items:[{label:n.bookedSeats,value:i(e=>e.taken),description:t},{label:n.waiting,value:i(e=>e.waitlistCount),description:a?n.placesOffered(a):n.seatsOnWaitlists},...r===void 0?[]:[{label:n.requestsWaiting,value:r>=50?`50+`:r,description:n.requestsPendingNote}]]}}function Tn(e,t){return e.usedPct===null?t.unlimited:e.taken+e.held>=e.capacity?t.sessFull:e.usedPct>=80?t.sessAlmost:t.sessOpen}function En(e,t=bn,n=`en`,r){return{type:`table`,page_action_id:`page-sessions`,columns:[{key:`label`,label:t.colEvent},{key:`taken`,label:t.colBooked},{key:`used`,label:t.colStatus,format:`badge`},{key:`when`,label:t.colDateTimeLower},{key:`waiting`,label:t.waiting,format:`number`},{key:`view`,label:t.colList,format:`element`}],rows:e.slice(0,30).map(e=>({label:e.label,when:Q(e.occurrenceStart||r?.get(e.poolKey)||``,t,e.timezone,n),taken:e.capacity>0?`${e.taken+e.held} / ${e.capacity}`:String(e.taken),waiting:e.waitlistCount,used:Tn(e,t),view:{type:`button`,action_id:`view-session`,label:t.viewList,value:`${e.poolKey}\n${e.occurrenceStart}`}})),empty_text:t.noUpcoming}}function Dn(e,t=bn){let n=new Map;for(let t of e){if(!t.occurrenceStart||t.usedPct===null)continue;let e=p(t.occurrenceStart,t.timezone);if(!e)continue;let r=`${e.hour}:${e.weekday}`,i=t.waitlistCount>0?Math.max(100,t.usedPct):t.usedPct,a=n.get(r)??{sum:0,n:0};n.set(r,{sum:a.sum+i,n:a.n+1})}if([...n.values()].reduce((e,t)=>e+t.n,0)<2)return null;let r=[...n.entries()].map(([e,n])=>{let[r,i]=e.split(`:`).map(Number);return{day:t.days[i]??String(i),starts:`${String(r).padStart(2,`0`)}:00`,used:`${Math.min(100,Math.round(n.sum/n.n))}%`,sessions:n.n,value:Math.min(100,Math.round(n.sum/n.n))}}).sort((e,t)=>t.value-e.value||e.day.localeCompare(t.day)||e.starts.localeCompare(t.starts)).slice(0,8).map(({value:e,...t})=>t);return{type:`table`,block_id:`heatmap`,page_action_id:`page-heatmap`,columns:[{key:`day`,label:t.colDay},{key:`starts`,label:t.colStarts},{key:`used`,label:t.colUsedPct},{key:`sessions`,label:t.colSessions,format:`number`}],rows:r}}function On(e,t,n=bn,r=`en`,i={}){let a=new Map;for(let t of e)a.has(t.poolKey)||a.set(t.poolKey,t.label);let o=t.pool?e.filter(e=>e.poolKey===t.pool&&e.occurrenceStart):[],s=[];return a.size>1&&s.push({type:`select`,action_id:`pool`,label:n.filterEvent,options:[{label:n.allEvents,value:``},...[...a].slice(0,100).map(([e,t])=>({label:t,value:e}))],initial_value:t.pool??``}),o.length>1&&s.push({type:`select`,action_id:`occurrence`,label:n.filterDate,options:[{label:n.allDates,value:``},...o.slice(0,100).map(e=>({label:Q(e.occurrenceStart,n,e.timezone,r),value:e.occurrenceStart}))],initial_value:t.occurrence??``}),s.push({type:`text_input`,action_id:`q`,label:i.searchLabel??n.filterSearch,initial_value:i.q??``}),{type:`form`,block_id:`attendee-filter:${t.pool??``}:${t.occurrence??``}`,fields:s,submit:{label:i.submitLabel??n.showAttendees,action_id:`apply-filter`}}}const kn=`/attendance`,$=`/attendance/roster`,An=`/attendance/settings`;function jn(e){if(typeof e==`string`&&e)return e;if(e&&typeof e==`object`&&typeof e.cursor==`string`)return e.cursor}function Mn(e,t){let n=(e,n)=>({type:`link`,label:e,target:{kind:`plugin-page`,path:n},...n===t?{appearance:`primary`}:{}});return{type:`actions`,elements:[n(e.navOverview,kn),n(e.navRoster,$),n(e.navSettings,An)]}}function Nn(e,t){return{toast:t,blocks:[Mn(e),{type:`header`,text:e.navOverview},{type:`context`,text:e.lightDone}]}}function Pn(e){if(!e||e.turnstileSiteKey===void 0)return{};let t=String(e.turnstileSiteKey??``).trim(),n=String(e.turnstileSecretKey??``).trim();return t?{turnstileSiteKey:t,...n?{turnstileSecretKey:n}:{}}:{turnstileSiteKey:``,turnstileSecretKey:``}}function Fn(e){return`state:admin-filter:${e?.id??`shared`}`}async function In(e,t,n,i){let a=new r,o=U(i),s=dn(await lt(t,a,i),o),c=Y(t),u=t.kv,d=e&&typeof e==`object`&&!Array.isArray(e)?e:{},f=String(d.action_id??``);if(d.page===`widget:recent`){let e=(await q(c,a)).defaultTimezone||void 0,t=await a.call(()=>c.storage.attendees.query({where:{status:{in:[`going`,`pending`,`waitlist`,`attended`]}},orderBy:{createdAt:`desc`},limit:5}));return{blocks:[{type:`table`,page_action_id:`page-recent`,columns:[{key:`name`,label:s.colAttendee},{key:`event`,label:s.colEvent},{key:`date`,label:s.colDateTime},{key:`status`,label:s.colStatus,format:`badge`}],rows:t.items.map(({data:t})=>({name:t.erasedAt?`—`:t.displayName,event:t.eventTitle??``,date:Q(t.occurrenceStart||t.startsAt||``,s,t.timezone||e,o),status:t.erasedAt?s.status.erased:s.status[t.status]??t.status})),empty_text:s.noRsvps},{type:`actions`,elements:[{type:`link`,label:s.navOverview,target:{kind:`plugin-page`,path:kn}}]}]}}let p=d.page===An||/^(save-config|find-personal-data|erase-personal-data)$/.test(f)?An:d.page===$?$:kn,m=Date.now(),g,_,v=[],y,b=[];if(d.type===`block_action`&&f===`checkin-attendee`&&typeof d.value==`string`){let e=await a.call(()=>c.storage.attendees.get(d.value));g=!e||e.erasedAt||e.status!==`going`?{message:s.checkInRefused,type:`error`}:(await a.call(()=>c.storage.attendees.updateIf(e.id,{where:{status:`going`},set:{status:`attended`,checkedInAt:new Date().toISOString(),updatedAt:new Date().toISOString()}}))).applied?{message:s.checkedIn,type:`success`}:{message:s.checkInRefused,type:`error`}}if(d.type===`block_action`&&f===`undo-checkin`&&typeof d.value==`string`&&(g=(await a.call(()=>c.storage.attendees.updateIf(d.value,{where:{status:`attended`},set:{status:`going`,checkedInAt:``,updatedAt:new Date().toISOString()}}))).applied?{message:s.checkInUndone,type:`success`}:{message:s.undoRefused,type:`error`}),d.type===`block_action`&&f===`approve-attendee`&&typeof d.value==`string`){let e=await a.call(()=>c.storage.attendees.get(d.value));if(!e||e.erasedAt||e.status!==`pending`)g={message:s.requestAlreadyHandled,type:`info`};else{let n=a.has(3)?await q(c,a):null,r=!!c.email?.send&&!!n&&!!e.email&&a.has(2),i=!!c.email?.send&&!!e.email&&!r,o=new Date(m).toISOString();if(!(await a.call(()=>c.storage.attendees.updateIf(e.id,{where:{status:`pending`},set:{status:`going`,approvalDueAt:``,...e.startsAt?{reminder:`due`}:{},...e.organiserNotice===`queued`?{organiserNotice:`sent`}:{},...i?{mail:`queued`}:e.mail===`queued`?{mail:`sent`}:{},updatedAt:o}}))).applied)g={message:s.requestAlreadyHandled,type:`info`};else{if(r&&n){let r=t.site?.url??``,i=jt(r,n,`cancel`,await Pe(n.hmacSecret,e.id,e.createdAt,e.eventId)),o=e.startsAt?Ft(r,e.eventId,e.occurrenceStart,e.collection,t.plugin?.id):void 0,s=await G(c,a,W(e.locale,n.defaultLocale)),l=s.rsvpConfirmed({name:e.displayName,title:e.eventTitle||s.fallbackTitle,calendarUrl:o,cancelUrl:i});await J(c,a,n.replyTo,e,l,`Approval confirmation email failed`)}g={message:i?s.approvedQueued:s.approvedSent,type:`success`}}}}if(d.type===`block_action`&&f===`decline-attendee`&&typeof d.value==`string`){let e=await a.call(()=>c.storage.attendees.get(d.value));if(!e||e.erasedAt||e.status!==`pending`)g={message:s.requestAlreadyHandled,type:`info`};else{let t=await rn(c,a,e);if(!t.ok)g={message:s.requestAlreadyHandled,type:`info`};else{if(e.email&&c.email?.send&&a.has(1)){let t=a.has(3)?await q(c,a):null;if(t&&a.has(1)){let n=await G(c,a,W(e.locale,t.defaultLocale));await J(c,a,t.replyTo,e,n.requestDeclined({name:e.displayName,title:e.eventTitle||n.fallbackTitle}),`Decline email failed`)}}t.seatsFreed&&a.has(6)&&await en(c,a,$t(e.translationGroup,e.eventId),e.occurrenceStart),g={message:s.declinedToast,type:`success`}}}}if(d.type===`block_action`&&f===`cancel-attendee`&&typeof d.value==`string`){let e=await a.call(()=>c.storage.attendees.get(d.value)),t=e?await rn(c,a,e):{ok:!1,seatsFreed:!1};t.ok&&e&&t.seatsFreed&&a.has(6)&&await en(c,a,$t(e.translationGroup,e.eventId),e.occurrenceStart),g=t.ok?{message:s.cancelled,type:`success`}:{message:s.alreadyCancelled,type:`info`}}if(d.type===`block_action`&&f===`move-to-end`&&typeof d.value==`string`){let e=await nn(c,a,d.value);g=e.ok?{message:s.moved,type:`success`}:e.error===`NOT_QUEUED`?{message:s.moveRefused,type:`error`}:{message:s.moveRace,type:`info`}}if(d.type===`block_action`&&f===`run-maintenance`){let e=await an(c,a);return Nn(s,{message:s.maintenance(e.expiredCount,e.promotedCount,!!e.budgetExhausted),type:`info`})}if(d.type===`block_action`&&f===`run-reconcile`){let e=await Vt(c,a);return Nn(s,e?e.status===`CORRECTED`?{message:s.corrected(e.key,`${e.before.taken} → ${e.after.taken}`,`${e.before.held} → ${e.after.held}`,`${e.before.waitlistCount} → ${e.after.waitlistCount}`),type:`success`}:{message:`${e.key}: ${s.ledgerStatus[e.status]??e.status}`,type:`info`}:{message:s.noLedgers,type:`info`})}if(d.type===`page_load`){let e=await Yt(t.cron,a);e.length&&(g={message:s.scheduled(e.join(`, `)),type:`info`})}if(d.type===`form_submit`&&f===`save-config`){let e=e=>d.values?.[e]===void 0?{}:{[e]:String(d.values[e]??``)};await At(c,a,{...e(`managePagePath`),...e(`eventCollection`),...e(`replyTo`),...d.values?.reminderLeadHours===void 0?{}:{reminderLeadHours:Number(d.values.reminderLeadHours)},...d.values?.retentionDays===void 0?{}:{retentionDays:Number(d.values.retentionDays)},...e(`defaultTimezone`),...d.values?.defaultLocale===void 0?{}:{defaultLocale:d.values.defaultLocale},...Pn(d.values)}),g={message:s.settingsSaved,type:`success`}}if(d.type===`form_submit`&&f===`find-personal-data`){let e=V(d.values?.eraseEmail);if(e){y=e;let t=await a.call(()=>c.storage.attendees.query({where:{email:e},limit:20})),n=await a.call(()=>c.storage.waitlist_entries.query({where:{email:e},limit:20})),r=[],i=!1;for(let{data:e}of t.items){let t=(e.status===`going`||e.status===`pending`||e.status===`waitlist`)&&Zt(e.startsAt||e.occurrenceStart,m);!t&&e.retainFrom!==`~erased`&&(i=!0),r.push({title:e.eventTitle||e.eventId,date:Q(e.occurrenceStart,s,e.timezone,o),status:t?s.liveNotErased:e.retainFrom===`~erased`?s.statusErased:s.status[e.status]??e.status})}let l=new Set(t.items.map(e=>e.data.id));for(let{data:e}of n.items){if(l.has(e.attendeeId))continue;let t=(e.status===`queued`||e.status===`offered`)&&Zt(e.startsAt||e.occurrenceStart,m);!t&&e.retainFrom!==`~erased`&&(i=!0),r.push({title:e.eventTitle||e.eventId,date:Q(e.occurrenceStart,s,void 0,o),status:t?s.liveNotErased:e.retainFrom===`~erased`?s.statusErased:e.status})}b.push({type:`table`,page_action_id:`page-personal-data`,columns:[{key:`title`,label:s.colEventTitle},{key:`date`,label:s.colDateTime},{key:`status`,label:s.colStatus,format:`badge`}],rows:r,empty_text:s.noPersonalDataFound}),i&&b.push({type:`actions`,elements:[{type:`button`,action_id:`erase-personal-data`,label:s.erasePersonalData,style:`danger`,value:e,confirm:{title:s.eraseConfirmTitle,text:s.eraseConfirmText,confirm:s.eraseConfirmButton,deny:s.keep}}]})}}if(d.type===`block_action`&&f===`erase-personal-data`){let e=V(d.value);if(e){let t=await a.call(()=>c.storage.attendees.query({where:{email:e},limit:20})),n=await a.call(()=>c.storage.waitlist_entries.query({where:{email:e},limit:20})),r=new Date(m).toISOString(),i=0,o=t.items.map(e=>e.data).filter(e=>e.retainFrom!==`~erased`&&!((e.status===`going`||e.status===`pending`||e.status===`waitlist`)&&Zt(e.startsAt||e.occurrenceStart,m))),l=n.items.map(e=>e.data).filter(e=>e.retainFrom!==`~erased`&&!((e.status===`queued`||e.status===`offered`)&&Zt(e.startsAt||e.occurrenceStart,m))),u=o.slice(0,6);for(let e of u){if(!a.has(1))break;(await a.call(()=>c.storage.attendees.updateIf(e.id,{where:{email:e.email},set:{displayName:``,email:``,answers:[],replyTo:``,ipHash:``,retainFrom:`~erased`,erasedAt:r}}))).applied&&i++}let d=Math.max(0,6-u.length),f=l.slice(0,d);for(let e of f){if(!a.has(1))break;(await a.call(()=>c.storage.waitlist_entries.updateIf(e.id,{where:{email:e.email},set:{displayName:``,email:``,retainFrom:`~erased`,erasedAt:r}}))).applied&&i++}if(g=o.length+l.length>i?{message:s.erasedMore(i),type:`info`}:{message:s.erasedAll(i),type:`success`},!a.has(4))return Nn(s,g)}}if(d.type===`form_submit`&&f===`apply-filter`){let e=String(d.values?.pool??``),t=String(d.values?.occurrence??``);_={...e?{pool:e}:{},...e&&t?{occurrence:t}:{}},await a.call(()=>u.set(Fn(n),_))}if(d.type===`block_action`&&f===`view-session`&&typeof d.value==`string`){let[e=``,t=``]=d.value.split(`
184
- `);_={...e?{pool:e}:{},...e&&t?{occurrence:t}:{}},await a.call(()=>u.set(Fn(n),_))}if(d.type===`block_action`&&f===`toggle-cancelled`){let{cancelled:e,...t}=await a.call(()=>u.get(Fn(n)))??{};_=e?t:{...t,cancelled:!0},await a.call(()=>u.set(Fn(n),_))}if(d.type===`block_action`&&f===`clear-filter`&&(_={},await a.call(()=>u.set(Fn(n),_))),d.type===`block_action`&&(f===`prepare-export`||f===`prepare-export-html`||f===`prepare-export-csv`)){let e=(f===`prepare-export`?d.value:f.slice(15))===`html`?`html`:`csv`,[r=``,i=``]=typeof d.value==`string`&&f!==`prepare-export`?d.value.slice(0,300).split(`
185
- `):[],c=typeof d.value==`string`&&f!==`prepare-export`?{...r?{pool:r}:{},...r&&i?{occurrence:i}:{}}:_??await a.call(()=>u.get(Fn(n))),l=``;if(c?.pool){let e=await a.call(()=>u.list(h)),t=`${h}${c.pool}`,n=e.find(e=>e.key===t||e.key.startsWith(`${t}:`));l=String(n?.value?.label??``)}let p=await _n(t,a,{format:e,locale:o,...c?.pool?{poolKey:c.pool,...l?{title:l}:{}}:{},...c?.occurrence?{occurrenceStart:c.occurrence}:{}},t.plugin?.id);v.push(p?{type:`actions`,elements:[{type:`link`,label:e===`csv`?s.downloadCsv:s.downloadHtml,target:{kind:`external`,url:p.url},appearance:`primary`}]}:{type:`banner`,title:s.noSiteUrl,description:s.noSiteUrlBody,variant:`error`}),p&&v.push({type:`context`,text:s.linkNote})}if(p===An){if(!a.has(2))return Nn(s,g);let e=f===`save-config`&&d.values?.eventCollection!==void 0;return{toast:g,blocks:Rn(s,await q(c,a),t.plugin?.id??`eventual-attendance`,y,b,e)}}if(!a.has(4))return Nn(s,g);let x;p===kn&&a.has(5)&&(x=(await a.call(()=>c.storage.attendees.query({where:{status:`pending`},limit:50}))).items.map(e=>e.data).filter(e=>!e.erasedAt));let S=Sn(xn(await a.call(()=>u.list(h))),m),ee=new Map;for(let e of S)e.timezone&&ee.set(`${e.poolKey}\0${e.occurrenceStart}`,e.timezone);let C,w=e=>e.timezone||ee.get(`${$t(e.translationGroup,e.eventId)}\0${e.occurrenceStart}`)||C,T=e=>Q(e.occurrenceStart||e.startsAt||``,s,w(e),o),E=Cn(_??await a.call(()=>u.get(Fn(n))),S),D=new Set(S.map(e=>e.poolKey));p===$&&!E.pool&&D.size===1&&(E={pool:[...D][0]});let O=async()=>{let e=await q(c,a);return C=e.defaultTimezone||void 0,(await a.call(()=>t.content.list(Ct(e)[0],{limit:100,where:{status:`published`}}))).items},k,A=S[0];if(p===$&&!E.pool&&(A?.occurrenceStart&&(k={pool:A.poolKey,occurrence:A.occurrenceStart,label:A.label,at:A.occurrenceStart,zone:A.timezone}),S.some(e=>!e.occurrenceStart)&&a.has(5)))for(let{id:e,translationGroup:t,data:n={}}of await O()){let r=l(n),i=r&&S.find(n=>n.poolKey===(t||e)&&!n.occurrenceStart),a=r?Date.parse(r.startsAt):NaN;i&&a>=m-12*36e5&&(!k||a<Date.parse(k.at))&&(k={pool:i.poolKey,occurrence:``,label:i.label,at:r.startsAt,zone:r.timezone||void 0})}k&&(E={pool:k.pool,...k.occurrence?{occurrence:k.occurrence}:{}});let j=E.pool?{translationGroup:E.pool,...E.occurrence?{occurrenceStart:E.occurrence}:{}}:void 0,M=String(d.values?.q??``).trim().toLowerCase().slice(0,80),te=e=>!M||!e.erasedAt&&(e.displayName.toLowerCase().includes(M)||e.email.toLowerCase().includes(M)),N=async(e,t,n)=>{let r=[],i=n,o=0;do{let t=await a.call(()=>c.storage.attendees.query({where:j,limit:100,cursor:i}));r.push(...t.items.map(e=>e.data).filter(e)),i=t.hasMore?t.cursor:void 0}while(i&&r.length<t&&++o<3&&a.has(1));return{found:r,cursor:i}},P=S.find(e=>e.poolKey===E.pool),F=(e,t)=>[On(S,E,s,o,{q:M,searchLabel:t,submitLabel:e}),...P&&!k&&(p!==$||D.size>1)?[...p===$?[]:[{type:`banner`,title:s.filterOn(P.label+(E.occurrence?` · ${Q(E.occurrence,s,P.timezone,o)}`:``)),description:s.filterOnBody}],{type:`actions`,elements:[{type:`button`,action_id:`clear-filter`,label:s.showAllEvents,style:`primary`}]}]:[]],I=e=>[{type:`divider`},{type:`context`,text:e},{type:`actions`,elements:[`html`,`csv`].map(e=>({type:`button`,action_id:`prepare-export-${e}`,label:e===`html`?s.preparePrintable:s.prepareCsv,value:`${E.pool??``}\n${E.occurrence??``}`}))},...v],L=e=>({type:`button`,action_id:`cancel-attendee`,label:s.cancelRsvp,style:`danger`,value:e.id,confirm:{title:s.cancelTitle(e.displayName),text:s.cancelText,confirm:s.cancelConfirm,deny:s.keep}}),ne=e=>({type:`button`,action_id:`decline-attendee`,label:s.decline,style:`danger`,value:e.id,confirm:{title:s.declineTitle(e.displayName),text:s.declineText,confirm:s.decline,deny:s.keep}}),re=e=>e.status===`going`?{type:`button`,action_id:`checkin-attendee`,label:s.checkIn,value:e.id}:e.status===`attended`?{type:`button`,action_id:`undo-checkin`,label:s.undoCheckIn,value:e.id}:e.status===`pending`?{type:`button`,action_id:`approve-attendee`,label:s.approve,style:`primary`,value:e.id}:e.status===`waitlist`?{type:`button`,action_id:`move-to-end`,label:s.moveToEnd,value:e.id,confirm:{title:s.moveTitle(e.displayName),text:s.moveText,confirm:s.moveConfirm,deny:s.keep}}:void 0,ie=e=>e.status===`pending`?ne(e):e.status===`cancelled`?void 0:L(e),ae=e=>e.erasedAt?s.status.erased:s.status[e.status]??e.status,R=(e,t)=>{let n=e.erasedAt?[]:[re(e),ie(e)].filter(e=>!!e);return[{type:`section`,text:[e.erasedAt?`—`:e.displayName,t??ae(e),s.places(e.quantity||1),e.eventTitle??``,e.occurrenceStart?T(e):``,e.erasedAt?``:e.email,e.erasedAt?``:De(e.answers)].filter(Boolean).join(` · `)},...n.length?[{type:`actions`,elements:n}]:[]]};if(p===$){let e=[Mn(s,p),{type:`header`,text:s.rosterHeader},{type:`context`,text:s.rosterIntro}];e.push(...F(s.doorShow,s.doorSearch)),k&&e.push({type:`context`,text:s.doorNextEvent(`${k.label} · ${Q(k.at,s,k.zone||C,o)}`)});let t=I(s.doorPrintIntro);if(!E.pool)return e.push({type:`empty`,title:s.doorChooseTitle,description:S.length?s.doorChooseText:s.noUpcoming,size:`sm`},...t),{toast:g,blocks:e};let n=e=>!e.erasedAt&&(e.status===`going`||e.status===`attended`),{found:r,cursor:i}=await N(e=>n(e)&&te(e),60,f===`page-roster`?jn(d.value):void 0);if(!M){let t=r.filter(e=>e.status===`attended`).length;e.push({type:`header`,text:s.doorCount(t,r.length,!!i)})}for(let t of r){let n=t.status===`attended`;e.push({type:`section`,text:[t.displayName,(t.quantity||1)>1?s.places(t.quantity):``,E.occurrence?``:t.occurrenceStart?T(t):``,n?s.doorCheckedAt(Ln(t.checkedInAt,w(t))):``,De(t.answers)].filter(Boolean).join(` · `),accessory:n?{type:`button`,action_id:`undo-checkin`,label:s.undoCheckIn,value:t.id}:{type:`button`,action_id:`checkin-attendee`,label:s.checkIn,style:`primary`,value:t.id}})}return r.length||e.push({type:`empty`,title:M?s.searchNone:s.doorEmpty,size:`sm`}),i&&e.push({type:`actions`,elements:[{type:`button`,action_id:`page-roster`,label:s.doorNext,value:i}]}),e.push(...t),{toast:g,blocks:e}}let z=[Mn(s,p),{type:`header`,text:s.navOverview}];if(x?.length){z.push({type:`banner`,title:s.attentionTitle(x.length>=50?`50+`:String(x.length)),description:s.attentionText,variant:`alert`});for(let e of x.slice(0,8))z.push(...R(e,e.approvalDueAt?s.decideBy(Q(e.approvalDueAt,s,w(e),o)):void 0));x.length>8&&z.push({type:`context`,text:s.attentionMore(x.length-8)}),z.push({type:`divider`})}let B=new Map,oe=[];if(a.has(4))for(let{id:e,translationGroup:t,data:n={}}of await O()){let r=l(n);r&&B.set(t||e,r.startsAt),n.inventory_mode===`tickets`&&(!r||Date.parse(r.startsAt)>=m-12*36e5)&&oe.push({label:String(n.title??``),date:r?Q(r.startsAt,s,r.timezone||C,o):``})}z.push(wn(S,s.scopeAll,s,x?.length),{type:`header`,text:s.upcomingSessions},En(S.map(e=>e.timezone||!C?e:{...e,timezone:C}),s,o,B)),oe.length&&z.push({type:`header`,text:s.ticketedHeader},{type:`context`,text:s.ticketedIntro},{type:`table`,page_action_id:`page-ticketed`,columns:[{key:`label`,label:s.colEvent},{key:`date`,label:s.colDateTimeLower}],rows:oe},{type:`actions`,elements:[{type:`link`,label:s.openOrders,target:{kind:`external`,url:`${t.site?.url??``}/_emdash/admin/plugins/eventual-tickets/orders`},appearance:`secondary`}]});let se=Dn(S,s);if(se&&z.push({type:`accordion`,label:s.heatmapHeader,blocks:[{type:`context`,text:s.heatmapIntro},se]}),z.push({type:`divider`},{type:`header`,text:s.attendees},...F(s.showAttendees,s.filterSearch)),M){let e=M.includes(`@`)?V(M):``,t,n;e?t=(await a.call(()=>c.storage.attendees.query({where:{email:e},limit:50}))).items.map(e=>e.data).filter(e=>(!E.pool||$t(e.translationGroup,e.eventId)===E.pool)&&(!E.occurrence||e.occurrenceStart===E.occurrence)):{found:t,cursor:n}=await N(te,20),z.push({type:`context`,text:`${t.length?s.searchFound(Math.min(t.length,20)):s.searchNone}${n?` ${s.searchPartial}`:``}`});for(let e of t.slice(0,20))z.push(...R(e));return{blocks:z,toast:g}}let ce=E.cancelled?j:{...j,status:{in:[`going`,`pending`,`waitlist`,`attended`]}},le=await a.call(()=>c.storage.attendees.query({where:ce,limit:25,cursor:f===`page-attendees`?jn(d.value):void 0}));return z.push({type:`table`,page_action_id:`page-attendees`,next_cursor:le.hasMore?le.cursor:void 0,columns:[{key:`displayName`,label:s.colAttendee},{key:`email`,label:s.colEmail},{key:`status`,label:s.colStatus,format:`badge`},{key:`quantity`,label:s.colSeats,format:`number`},{key:`occurrence`,label:s.colDateTime},{key:`answers`,label:s.colAnswers},{key:`action`,label:s.colAction,format:`element`},{key:`cancelAction`,label:s.colCancel,format:`element`}],rows:le.items.map(({data:e})=>({displayName:e.erasedAt?`—`:e.displayName,email:e.erasedAt?`—`:e.email,status:ae(e),quantity:e.quantity||1,occurrence:T(e),answers:e.erasedAt?``:De(e.answers),action:e.erasedAt?void 0:re(e),cancelAction:e.erasedAt?void 0:ie(e)})),empty_text:E.pool?s.noAttendeesSelection:s.noRsvps}),z.push({type:`context`,text:E.cancelled?s.cancelledShown:s.cancelledHidden},{type:`actions`,elements:[{type:`button`,action_id:`toggle-cancelled`,label:E.cancelled?s.hideCancelled:s.showCancelled}]}),le.items.length&&z.push({type:`context`,text:s.phoneHint}),z.push(...I(s.listFilesIntro)),{blocks:z,toast:g}}function Ln(e,t){if(!e)return``;let n=t=>new Intl.DateTimeFormat(`en-GB`,{hour:`2-digit`,minute:`2-digit`,timeZone:t}).format(new Date(e));try{if(t)return n(t)}catch{}return`${n(`UTC`)} UTC`}function Rn(e,t,n,r,i,a){return[Mn(e,An),{type:`header`,text:e.settingsHeader},{type:`form`,block_id:`config`,fields:[{type:`text_input`,action_id:`replyTo`,label:e.fieldReplyTo,initial_value:t.replyTo},{type:`number_input`,action_id:`reminderLeadHours`,label:e.fieldReminders,min:0,max:168,initial_value:t.reminderLeadHours},{type:`select`,action_id:`defaultLocale`,label:e.fieldLocale,options:ft.map(e=>({label:mt(e),value:e})),initial_value:t.defaultLocale},{type:`number_input`,action_id:`retentionDays`,label:e.fieldRetentionDays,min:30,max:3650,initial_value:t.retentionDays},{type:`text_input`,action_id:`defaultTimezone`,label:e.fieldDefaultTimezone,placeholder:`Europe/Zurich`,initial_value:t.defaultTimezone}],submit:{label:e.save,action_id:`save-config`}},{type:`divider`},{type:`header`,text:e.personalDataHeader},{type:`context`,text:e.personalDataIntro},{type:`form`,block_id:`personal-data`,fields:[{type:`text_input`,action_id:`eraseEmail`,label:e.fieldEraseEmail,initial_value:r??``}],submit:{label:e.findPersonalData,action_id:`find-personal-data`}},...i,{type:`divider`},{type:`accordion`,label:e.siteSetupHeader,default_open:a,blocks:[{type:`context`,text:e.settingsIntro},{type:`form`,block_id:`site-setup`,fields:[{type:`text_input`,action_id:`eventCollection`,label:e.fieldCollections,initial_value:t.eventCollection},{type:`text_input`,action_id:`managePagePath`,label:e.fieldManagePath,initial_value:t.managePagePath},{type:`text_input`,action_id:`turnstileSiteKey`,label:e.fieldTurnstileSiteKey,initial_value:t.turnstileSiteKey},{type:`text_input`,action_id:`turnstileSecretKey`,label:e.fieldTurnstileSecret,placeholder:t.turnstileSecretKey?e.turnstileSecretSaved:``,initial_value:``}],submit:{label:e.save,action_id:`save-config`}},{type:`context`,text:Et(t)?e.turnstileOn:e.turnstileOff},{type:`context`,text:e.componentsHint(n)},{type:`context`,text:e.tasksIntro},{type:`actions`,elements:[{type:`button`,action_id:`run-maintenance`,label:e.runMaintenance},{type:`button`,action_id:`run-reconcile`,label:e.runReconcile}]}]}]}function zn(e,t,n,r){if(typeof e!=`number`&&(typeof e!=`string`||!e.trim()))return r;let i=Number(e);return Number.isSafeInteger(i)?Math.max(t,Math.min(n,i)):r}const Bn=(e,t)=>typeof e==`string`?e.slice(0,t):``;function Vn(e,t){return{id:e,label:Bn(t.label,400).trim(),type:Bn(t.type,20)||`text`,required:t.required===!0,options:Bn(t.options,4e3)}}function Hn(e){let t=e.label.replace(/\|/g,`/`).replace(/^#+\s*/,``);if(!t)return{issue:{line:null,code:`NO_LABEL`}};let n=e.type===`select`?e.options.split(/[\n,]/).map(e=>e.replace(/\|/g,`/`).trim()).filter(Boolean).join(`, `):``,r=Se([t,e.type,e.required?`required`:`optional`,n].join(` | `));return r.issues[0]?{issue:{...r.issues[0],line:null}}:{question:r.questions[0]}}function Un(e,t,n){return{type:`form`,block_id:n?`question-new`:`question-${t.id}`,fields:[{type:`text_input`,action_id:`label`,label:e.qLabel,placeholder:n?e.qLabelPlaceholder:void 0,initial_value:t.label},{type:`select`,action_id:`type`,label:e.qType,options:ye.map(t=>({label:e.qTypes[t],value:t})),initial_value:t.type},{type:`text_input`,action_id:`options`,label:e.qOptions,placeholder:`S
183
+ </html>`;return{contentType:`application/octet-stream`,filename:`roster-${hn(e.eventId||`events`)}.html`,body:b}}const xn=fn();function Sn(e){let t=[];for(let{key:n,value:r}of e){let e=y(r);if(!e)continue;let i=e.poolKey||_(n,e.occurrenceStart),a=e.taken+e.held;t.push({key:n,poolKey:i,occurrenceStart:e.occurrenceStart,label:e.label||i,...e.timezone?{timezone:e.timezone}:{},capacity:e.capacity,taken:e.taken,held:e.held,waitlistCount:e.waitlistCount,usedPct:e.capacity>0?Math.round(a/e.capacity*100):null})}return t}function Cn(e,t){return e.filter(e=>!e.occurrenceStart||Date.parse(e.occurrenceStart)>=t-432e5).sort((e,t)=>(e.occurrenceStart||`9999`).localeCompare(t.occurrenceStart||`9999`)||e.label.localeCompare(t.label))}function wn(e,t){let n=e&&typeof e==`object`?e:{},r=typeof n.pool==`string`&&t.some(e=>e.poolKey===n.pool)?n.pool:void 0,i=r&&typeof n.occurrence==`string`&&t.some(e=>e.poolKey===r&&e.occurrenceStart===n.occurrence&&n.occurrence!==``)?n.occurrence:void 0;return{...r?{pool:r}:{},...i?{occurrence:i}:{},...n.cancelled===!0?{cancelled:!0}:{}}}function Z(e,t=xn,n,r=`en`){return e?d(e,n,r):t.singleEvent}function Tn(e,t,n=xn,r){let i=t=>e.reduce((e,n)=>e+t(n),0),a=i(e=>e.held);return{type:`stats`,items:[{label:n.bookedSeats,value:i(e=>e.taken),description:t},{label:n.waiting,value:i(e=>e.waitlistCount),description:a?n.placesOffered(a):n.seatsOnWaitlists},...r===void 0?[]:[{label:n.requestsWaiting,value:r>=50?`50+`:r,description:n.requestsPendingNote}]]}}function En(e,t){return e.usedPct===null?t.unlimited:e.taken+e.held>=e.capacity?t.sessFull:e.usedPct>=80?t.sessAlmost:t.sessOpen}function Dn(e,t=xn,n=`en`,r){return{type:`table`,page_action_id:`page-sessions`,columns:[{key:`label`,label:t.colEvent},{key:`taken`,label:t.colBooked},{key:`used`,label:t.colStatus,format:`badge`},{key:`when`,label:t.colDateTimeLower},{key:`waiting`,label:t.waiting,format:`number`},{key:`view`,label:t.colList,format:`element`}],rows:e.slice(0,30).map(e=>({label:e.label,when:Z(e.occurrenceStart||r?.get(e.poolKey)||``,t,e.timezone,n),taken:e.capacity>0?`${e.taken+e.held} / ${e.capacity}`:String(e.taken),waiting:e.waitlistCount,used:En(e,t),view:{type:`button`,action_id:`view-session`,label:t.viewList,value:`${e.poolKey}\n${e.occurrenceStart}`}})),empty_text:t.noUpcoming}}function On(e,t=xn){let n=new Map;for(let t of e){if(!t.occurrenceStart||t.usedPct===null)continue;let e=p(t.occurrenceStart,t.timezone);if(!e)continue;let r=`${e.hour}:${e.weekday}`,i=t.waitlistCount>0?Math.max(100,t.usedPct):t.usedPct,a=n.get(r)??{sum:0,n:0};n.set(r,{sum:a.sum+i,n:a.n+1})}if([...n.values()].reduce((e,t)=>e+t.n,0)<2)return null;let r=[...n.entries()].map(([e,n])=>{let[r,i]=e.split(`:`).map(Number);return{day:t.days[i]??String(i),starts:`${String(r).padStart(2,`0`)}:00`,used:`${Math.min(100,Math.round(n.sum/n.n))}%`,sessions:n.n,value:Math.min(100,Math.round(n.sum/n.n))}}).sort((e,t)=>t.value-e.value||e.day.localeCompare(t.day)||e.starts.localeCompare(t.starts)).slice(0,8).map(({value:e,...t})=>t);return{type:`table`,block_id:`heatmap`,page_action_id:`page-heatmap`,columns:[{key:`day`,label:t.colDay},{key:`starts`,label:t.colStarts},{key:`used`,label:t.colUsedPct},{key:`sessions`,label:t.colSessions,format:`number`}],rows:r}}function kn(e,t,n=xn,r=`en`,i={}){let a=new Map;for(let t of e)a.has(t.poolKey)||a.set(t.poolKey,t.label);let o=t.pool?e.filter(e=>e.poolKey===t.pool&&e.occurrenceStart):[],s=[];return a.size>1&&s.push({type:`select`,action_id:`pool`,label:n.filterEvent,options:[{label:n.allEvents,value:``},...[...a].slice(0,100).map(([e,t])=>({label:t,value:e}))],initial_value:t.pool??``}),o.length>1&&s.push({type:`select`,action_id:`occurrence`,label:n.filterDate,options:[{label:n.allDates,value:``},...o.slice(0,100).map(e=>({label:Z(e.occurrenceStart,n,e.timezone,r),value:e.occurrenceStart}))],initial_value:t.occurrence??``}),s.push({type:`text_input`,action_id:`q`,label:i.searchLabel??n.filterSearch,initial_value:i.q??``}),{type:`form`,block_id:`attendee-filter:${t.pool??``}:${t.occurrence??``}`,fields:s,submit:{label:i.submitLabel??n.showAttendees,action_id:`apply-filter`}}}const An=`/attendance`,Q=`/attendance/roster`,jn=`/attendance/settings`;function Mn(e){if(typeof e==`string`&&e)return e;if(e&&typeof e==`object`&&typeof e.cursor==`string`)return e.cursor}function Nn(e,t){let n=(e,n)=>({type:`link`,label:e,target:{kind:`plugin-page`,path:n},...n===t?{appearance:`primary`}:{}});return{type:`actions`,elements:[n(e.navOverview,An),n(e.navRoster,Q),n(e.navSettings,jn)]}}function Pn(e,t){return{toast:t,blocks:[Nn(e),{type:`header`,text:e.navOverview},{type:`context`,text:e.lightDone}]}}function Fn(e){if(!e||e.turnstileSiteKey===void 0)return{};let t=String(e.turnstileSiteKey??``).trim(),n=String(e.turnstileSecretKey??``).trim();return t?{turnstileSiteKey:t,...n?{turnstileSecretKey:n}:{}}:{turnstileSiteKey:``,turnstileSecretKey:``}}function $(e){return`state:admin-filter:${e?.id??`shared`}`}async function In(e,t,n,i){let a=new r,o=H(i),s=fn(await ut(t,a,i),o),c=J(t),u=t.kv,d=e&&typeof e==`object`&&!Array.isArray(e)?e:{},f=String(d.action_id??``);if(d.page===`widget:recent`){let e=(await K(c,a)).defaultTimezone||void 0,t=await a.call(()=>c.storage.attendees.query({where:{status:{in:[`going`,`pending`,`waitlist`,`attended`]}},orderBy:{createdAt:`desc`},limit:5}));return{blocks:[{type:`table`,page_action_id:`page-recent`,columns:[{key:`name`,label:s.colAttendee},{key:`event`,label:s.colEvent},{key:`date`,label:s.colDateTime},{key:`status`,label:s.colStatus,format:`badge`}],rows:t.items.map(({data:t})=>({name:t.erasedAt?`—`:t.displayName,event:t.eventTitle??``,date:Z(t.occurrenceStart||t.startsAt||``,s,t.timezone||e,o),status:t.erasedAt?s.status.erased:s.status[t.status]??t.status})),empty_text:s.noRsvps},{type:`actions`,elements:[{type:`link`,label:s.navOverview,target:{kind:`plugin-page`,path:An}}]}]}}let p=d.page===jn||/^(save-config|find-personal-data|erase-personal-data)$/.test(f)?jn:d.page===Q?Q:An,m=Date.now(),g,_,v=[],y,b=[];if(d.type===`block_action`&&f===`checkin-attendee`&&typeof d.value==`string`){let e=await a.call(()=>c.storage.attendees.get(d.value));g=!e||e.erasedAt||e.status!==`going`?{message:s.checkInRefused,type:`error`}:(await a.call(()=>c.storage.attendees.updateIf(e.id,{where:{status:`going`},set:{status:`attended`,checkedInAt:new Date().toISOString(),updatedAt:new Date().toISOString()}}))).applied?{message:s.checkedIn,type:`success`}:{message:s.checkInRefused,type:`error`}}if(d.type===`block_action`&&f===`undo-checkin`&&typeof d.value==`string`&&(g=(await a.call(()=>c.storage.attendees.updateIf(d.value,{where:{status:`attended`},set:{status:`going`,checkedInAt:``,updatedAt:new Date().toISOString()}}))).applied?{message:s.checkInUndone,type:`success`}:{message:s.undoRefused,type:`error`}),d.type===`block_action`&&f===`approve-attendee`&&typeof d.value==`string`){let e=await a.call(()=>c.storage.attendees.get(d.value));if(!e||e.erasedAt||e.status!==`pending`)g={message:s.requestAlreadyHandled,type:`info`};else{let n=a.has(3)?await K(c,a):null,r=!!c.email?.send&&!!n&&!!e.email&&a.has(2),i=!!c.email?.send&&!!e.email&&!r,o=new Date(m).toISOString();if(!(await a.call(()=>c.storage.attendees.updateIf(e.id,{where:{status:`pending`},set:{status:`going`,approvalDueAt:``,...e.startsAt?{reminder:`due`}:{},...e.organiserNotice===`queued`?{organiserNotice:`sent`}:{},...i?{mail:`queued`}:e.mail===`queued`?{mail:`sent`}:{},updatedAt:o}}))).applied)g={message:s.requestAlreadyHandled,type:`info`};else{if(r&&n){let r=t.site?.url??``,i=Mt(r,n,`cancel`,await Fe(n.hmacSecret,e.id,e.createdAt,e.eventId)),o=e.startsAt?It(r,e.eventId,e.occurrenceStart,e.collection,t.plugin?.id):void 0,s=await W(c,a,U(e.locale,n.defaultLocale)),l=s.rsvpConfirmed({name:e.displayName,title:e.eventTitle||s.fallbackTitle,calendarUrl:o,cancelUrl:i});await q(c,a,n.replyTo,e,l,`Approval confirmation email failed`)}g={message:i?s.approvedQueued:s.approvedSent,type:`success`}}}}if(d.type===`block_action`&&f===`decline-attendee`&&typeof d.value==`string`){let e=await a.call(()=>c.storage.attendees.get(d.value));if(!e||e.erasedAt||e.status!==`pending`)g={message:s.requestAlreadyHandled,type:`info`};else{let t=await an(c,a,e);if(!t.ok)g={message:s.requestAlreadyHandled,type:`info`};else{if(e.email&&c.email?.send&&a.has(1)){let t=a.has(3)?await K(c,a):null;if(t&&a.has(1)){let n=await W(c,a,U(e.locale,t.defaultLocale));await q(c,a,t.replyTo,e,n.requestDeclined({name:e.displayName,title:e.eventTitle||n.fallbackTitle}),`Decline email failed`)}}t.seatsFreed&&a.has(6)&&await tn(c,a,en(e.translationGroup,e.eventId),e.occurrenceStart),g={message:s.declinedToast,type:`success`}}}}if(d.type===`block_action`&&f===`cancel-attendee`&&typeof d.value==`string`){let e=await a.call(()=>c.storage.attendees.get(d.value)),t=e?await an(c,a,e):{ok:!1,seatsFreed:!1};t.ok&&e&&t.seatsFreed&&a.has(6)&&await tn(c,a,en(e.translationGroup,e.eventId),e.occurrenceStart),g=t.ok?{message:s.cancelled,type:`success`}:{message:s.alreadyCancelled,type:`info`}}if(d.type===`block_action`&&f===`move-to-end`&&typeof d.value==`string`){let e=await rn(c,a,d.value);g=e.ok?{message:s.moved,type:`success`}:e.error===`NOT_QUEUED`?{message:s.moveRefused,type:`error`}:{message:s.moveRace,type:`info`}}if(d.type===`block_action`&&f===`run-maintenance`){let e=await on(c,a);return Pn(s,{message:s.maintenance(e.expiredCount,e.promotedCount,!!e.budgetExhausted),type:`info`})}if(d.type===`block_action`&&f===`run-reconcile`){let e=await Ht(c,a);return Pn(s,e?e.status===`CORRECTED`?{message:s.corrected(e.key,`${e.before.taken} → ${e.after.taken}`,`${e.before.held} → ${e.after.held}`,`${e.before.waitlistCount} → ${e.after.waitlistCount}`),type:`success`}:{message:`${e.key}: ${s.ledgerStatus[e.status]??e.status}`,type:`info`}:{message:s.noLedgers,type:`info`})}if(d.type===`page_load`){let e=await Xt(t.cron,a);e.length&&(g={message:s.scheduled(e.join(`, `)),type:`info`})}if(d.type===`form_submit`&&f===`save-config`){let e=e=>d.values?.[e]===void 0?{}:{[e]:String(d.values[e]??``)};await jt(c,a,{...e(`managePagePath`),...e(`eventCollection`),...e(`replyTo`),...d.values?.reminderLeadHours===void 0?{}:{reminderLeadHours:Number(d.values.reminderLeadHours)},...d.values?.retentionDays===void 0?{}:{retentionDays:Number(d.values.retentionDays)},...e(`defaultTimezone`),...d.values?.defaultLocale===void 0?{}:{defaultLocale:d.values.defaultLocale},...Fn(d.values)}),g={message:s.settingsSaved,type:`success`}}if(d.type===`form_submit`&&f===`find-personal-data`){let e=se(d.values?.eraseEmail);if(e){y=e;let t=await a.call(()=>c.storage.attendees.query({where:{email:e},limit:20})),n=await a.call(()=>c.storage.waitlist_entries.query({where:{email:e},limit:20})),r=[],i=!1;for(let{data:e}of t.items){let t=(e.status===`going`||e.status===`pending`||e.status===`waitlist`)&&Qt(e.startsAt||e.occurrenceStart,m);!t&&e.retainFrom!==`~erased`&&(i=!0),r.push({title:e.eventTitle||e.eventId,date:Z(e.occurrenceStart,s,e.timezone,o),status:t?s.liveNotErased:e.retainFrom===`~erased`?s.statusErased:s.status[e.status]??e.status})}let l=new Set(t.items.map(e=>e.data.id));for(let{data:e}of n.items){if(l.has(e.attendeeId))continue;let t=(e.status===`queued`||e.status===`offered`)&&Qt(e.startsAt||e.occurrenceStart,m);!t&&e.retainFrom!==`~erased`&&(i=!0),r.push({title:e.eventTitle||e.eventId,date:Z(e.occurrenceStart,s,void 0,o),status:t?s.liveNotErased:e.retainFrom===`~erased`?s.statusErased:e.status})}b.push({type:`table`,page_action_id:`page-personal-data`,columns:[{key:`title`,label:s.colEventTitle},{key:`date`,label:s.colDateTime},{key:`status`,label:s.colStatus,format:`badge`}],rows:r,empty_text:s.noPersonalDataFound}),i&&b.push({type:`actions`,elements:[{type:`button`,action_id:`erase-personal-data`,label:s.erasePersonalData,style:`danger`,value:e,confirm:{title:s.eraseConfirmTitle,text:s.eraseConfirmText,confirm:s.eraseConfirmButton,deny:s.keep}}]})}}if(d.type===`block_action`&&f===`erase-personal-data`){let e=se(d.value);if(e){let t=await a.call(()=>c.storage.attendees.query({where:{email:e},limit:20})),n=await a.call(()=>c.storage.waitlist_entries.query({where:{email:e},limit:20})),r=new Date(m).toISOString(),i=0,o=t.items.map(e=>e.data).filter(e=>e.retainFrom!==`~erased`&&!((e.status===`going`||e.status===`pending`||e.status===`waitlist`)&&Qt(e.startsAt||e.occurrenceStart,m))),l=n.items.map(e=>e.data).filter(e=>e.retainFrom!==`~erased`&&!((e.status===`queued`||e.status===`offered`)&&Qt(e.startsAt||e.occurrenceStart,m))),u=o.slice(0,6);for(let e of u){if(!a.has(1))break;(await a.call(()=>c.storage.attendees.updateIf(e.id,{where:{email:e.email},set:{displayName:``,email:``,answers:[],replyTo:``,ipHash:``,retainFrom:`~erased`,erasedAt:r}}))).applied&&i++}let d=Math.max(0,6-u.length),f=l.slice(0,d);for(let e of f){if(!a.has(1))break;(await a.call(()=>c.storage.waitlist_entries.updateIf(e.id,{where:{email:e.email},set:{displayName:``,email:``,retainFrom:`~erased`,erasedAt:r}}))).applied&&i++}if(g=o.length+l.length>i?{message:s.erasedMore(i),type:`info`}:{message:s.erasedAll(i),type:`success`},!a.has(4))return Pn(s,g)}}if(d.type===`form_submit`&&f===`apply-filter`){let e=String(d.values?.pool??``),t=String(d.values?.occurrence??``);_={...e?{pool:e}:{},...e&&t?{occurrence:t}:{}},await a.call(()=>u.set($(n),_))}if(d.type===`block_action`&&f===`view-session`&&typeof d.value==`string`){let[e=``,t=``]=d.value.split(`
184
+ `);_={...e?{pool:e}:{},...e&&t?{occurrence:t}:{}},await a.call(()=>u.set($(n),_))}if(d.type===`block_action`&&f===`toggle-cancelled`){let{cancelled:e,...t}=await a.call(()=>u.get($(n)))??{};_=e?t:{...t,cancelled:!0},await a.call(()=>u.set($(n),_))}if(d.type===`block_action`&&f===`clear-filter`&&(_={},await a.call(()=>u.set($(n),_))),d.type===`block_action`&&(f===`prepare-export`||f===`prepare-export-html`||f===`prepare-export-csv`)){let e=(f===`prepare-export`?d.value:f.slice(15))===`html`?`html`:`csv`,[r=``,i=``]=typeof d.value==`string`&&f!==`prepare-export`?d.value.slice(0,300).split(`
185
+ `):[],c=typeof d.value==`string`&&f!==`prepare-export`?{...r?{pool:r}:{},...r&&i?{occurrence:i}:{}}:_??await a.call(()=>u.get($(n))),l=``;if(c?.pool){let e=await a.call(()=>u.list(h)),t=`${h}${c.pool}`,n=e.find(e=>e.key===t||e.key.startsWith(`${t}:`));l=String(n?.value?.label??``)}let p=await vn(t,a,{format:e,locale:o,...c?.pool?{poolKey:c.pool,...l?{title:l}:{}}:{},...c?.occurrence?{occurrenceStart:c.occurrence}:{}},t.plugin?.id);v.push(p?{type:`actions`,elements:[{type:`link`,label:e===`csv`?s.downloadCsv:s.downloadHtml,target:{kind:`external`,url:p.url},appearance:`primary`}]}:{type:`banner`,title:s.noSiteUrl,description:s.noSiteUrlBody,variant:`error`}),p&&v.push({type:`context`,text:s.linkNote})}if(p===jn){if(!a.has(2))return Pn(s,g);let e=f===`save-config`&&d.values?.eventCollection!==void 0;return{toast:g,blocks:Rn(s,await K(c,a),t.plugin?.id??`eventual-attendance`,y,b,e)}}if(!a.has(4))return Pn(s,g);let x;p===An&&a.has(5)&&(x=(await a.call(()=>c.storage.attendees.query({where:{status:`pending`},limit:50}))).items.map(e=>e.data).filter(e=>!e.erasedAt));let S=Cn(Sn(await a.call(()=>u.list(h))),m),C=new Map;for(let e of S)e.timezone&&C.set(`${e.poolKey}\0${e.occurrenceStart}`,e.timezone);let w,T=e=>e.timezone||C.get(`${en(e.translationGroup,e.eventId)}\0${e.occurrenceStart}`)||w,E=e=>Z(e.occurrenceStart||e.startsAt||``,s,T(e),o),D=wn(_??await a.call(()=>u.get($(n))),S),O=new Set(S.map(e=>e.poolKey));p===Q&&!D.pool&&O.size===1&&(D={pool:[...O][0]});let k=async()=>{let e=await K(c,a);return w=e.defaultTimezone||void 0,(await a.call(()=>t.content.list(wt(e)[0],{limit:100,where:{status:`published`}}))).items},A,j=S[0];if(p===Q&&!D.pool&&(j?.occurrenceStart&&(A={pool:j.poolKey,occurrence:j.occurrenceStart,label:j.label,at:j.occurrenceStart,zone:j.timezone}),S.some(e=>!e.occurrenceStart)&&a.has(5)))for(let{id:e,translationGroup:t,data:n={}}of await k()){let r=l(n),i=r&&S.find(n=>n.poolKey===(t||e)&&!n.occurrenceStart),a=r?Date.parse(r.startsAt):NaN;i&&a>=m-12*36e5&&(!A||a<Date.parse(A.at))&&(A={pool:i.poolKey,occurrence:``,label:i.label,at:r.startsAt,zone:r.timezone||void 0})}A&&(D={pool:A.pool,...A.occurrence?{occurrence:A.occurrence}:{}});let M=D.pool?{translationGroup:D.pool,...D.occurrence?{occurrenceStart:D.occurrence}:{}}:void 0,N=String(d.values?.q??``).trim().toLowerCase().slice(0,80),ee=e=>!N||!e.erasedAt&&(e.displayName.toLowerCase().includes(N)||e.email.toLowerCase().includes(N)),P=async(e,t,n)=>{let r=[],i=n,o=0;do{let t=await a.call(()=>c.storage.attendees.query({where:M,limit:100,cursor:i}));r.push(...t.items.map(e=>e.data).filter(e)),i=t.hasMore?t.cursor:void 0}while(i&&r.length<t&&++o<3&&a.has(1));return{found:r,cursor:i}},F=S.find(e=>e.poolKey===D.pool),I=(e,t)=>[kn(S,D,s,o,{q:N,searchLabel:t,submitLabel:e}),...F&&!A&&(p!==Q||O.size>1)?[...p===Q?[]:[{type:`banner`,title:s.filterOn(F.label+(D.occurrence?` · ${Z(D.occurrence,s,F.timezone,o)}`:``)),description:s.filterOnBody}],{type:`actions`,elements:[{type:`button`,action_id:`clear-filter`,label:s.showAllEvents,style:`primary`}]}]:[]],L=e=>[{type:`divider`},{type:`context`,text:e},{type:`actions`,elements:[`html`,`csv`].map(e=>({type:`button`,action_id:`prepare-export-${e}`,label:e===`html`?s.preparePrintable:s.prepareCsv,value:`${D.pool??``}\n${D.occurrence??``}`}))},...v],R=e=>({type:`button`,action_id:`cancel-attendee`,label:s.cancelRsvp,style:`danger`,value:e.id,confirm:{title:s.cancelTitle(e.displayName),text:s.cancelText,confirm:s.cancelConfirm,deny:s.keep}}),te=e=>({type:`button`,action_id:`decline-attendee`,label:s.decline,style:`danger`,value:e.id,confirm:{title:s.declineTitle(e.displayName),text:s.declineText,confirm:s.decline,deny:s.keep}}),ne=e=>e.status===`going`?{type:`button`,action_id:`checkin-attendee`,label:s.checkIn,value:e.id}:e.status===`attended`?{type:`button`,action_id:`undo-checkin`,label:s.undoCheckIn,value:e.id}:e.status===`pending`?{type:`button`,action_id:`approve-attendee`,label:s.approve,style:`primary`,value:e.id}:e.status===`waitlist`?{type:`button`,action_id:`move-to-end`,label:s.moveToEnd,value:e.id,confirm:{title:s.moveTitle(e.displayName),text:s.moveText,confirm:s.moveConfirm,deny:s.keep}}:void 0,re=e=>e.status===`pending`?te(e):e.status===`cancelled`?void 0:R(e),ie=e=>e.erasedAt?s.status.erased:s.status[e.status]??e.status,ae=(e,t)=>{let n=e.erasedAt?[]:[ne(e),re(e)].filter(e=>!!e);return[{type:`section`,text:[e.erasedAt?`—`:e.displayName,t??ie(e),s.places(e.quantity||1),e.eventTitle??``,e.occurrenceStart?E(e):``,e.erasedAt?``:e.email,e.erasedAt?``:Oe(e.answers)].filter(Boolean).join(` · `)},...n.length?[{type:`actions`,elements:n}]:[]]};if(p===Q){let e=[Nn(s,p),{type:`header`,text:s.rosterHeader},{type:`context`,text:s.rosterIntro}];e.push(...I(s.doorShow,s.doorSearch)),A&&e.push({type:`context`,text:s.doorNextEvent(`${A.label} · ${Z(A.at,s,A.zone||w,o)}`)});let t=L(s.doorPrintIntro);if(!D.pool)return e.push({type:`empty`,title:s.doorChooseTitle,description:S.length?s.doorChooseText:s.noUpcoming,size:`sm`},...t),{toast:g,blocks:e};let n=e=>!e.erasedAt&&(e.status===`going`||e.status===`attended`),{found:r,cursor:i}=await P(e=>n(e)&&ee(e),60,f===`page-roster`?Mn(d.value):void 0);if(!N){let t=r.filter(e=>e.status===`attended`).length;e.push({type:`header`,text:s.doorCount(t,r.length,!!i)})}for(let t of r){let n=t.status===`attended`;e.push({type:`section`,text:[t.displayName,(t.quantity||1)>1?s.places(t.quantity):``,D.occurrence?``:t.occurrenceStart?E(t):``,n?s.doorCheckedAt(Ln(t.checkedInAt,T(t))):``,Oe(t.answers)].filter(Boolean).join(` · `),accessory:n?{type:`button`,action_id:`undo-checkin`,label:s.undoCheckIn,value:t.id}:{type:`button`,action_id:`checkin-attendee`,label:s.checkIn,style:`primary`,value:t.id}})}return r.length||e.push({type:`empty`,title:N?s.searchNone:s.doorEmpty,size:`sm`}),i&&e.push({type:`actions`,elements:[{type:`button`,action_id:`page-roster`,label:s.doorNext,value:i}]}),e.push(...t),{toast:g,blocks:e}}let z=[Nn(s,p),{type:`header`,text:s.navOverview}];if(x?.length){z.push({type:`banner`,title:s.attentionTitle(x.length>=50?`50+`:String(x.length)),description:s.attentionText,variant:`alert`});for(let e of x.slice(0,8))z.push(...ae(e,e.approvalDueAt?s.decideBy(Z(e.approvalDueAt,s,T(e),o)):void 0));x.length>8&&z.push({type:`context`,text:s.attentionMore(x.length-8)}),z.push({type:`divider`})}let B=new Map,oe=[];if(a.has(4))for(let{id:e,translationGroup:t,data:n={}}of await k()){let r=l(n);r&&B.set(t||e,r.startsAt),n.inventory_mode===`tickets`&&(!r||Date.parse(r.startsAt)>=m-12*36e5)&&oe.push({label:String(n.title??``),date:r?Z(r.startsAt,s,r.timezone||w,o):``})}z.push(Tn(S,s.scopeAll,s,x?.length),{type:`header`,text:s.upcomingSessions},Dn(S.map(e=>e.timezone||!w?e:{...e,timezone:w}),s,o,B)),oe.length&&z.push({type:`header`,text:s.ticketedHeader},{type:`context`,text:s.ticketedIntro},{type:`table`,page_action_id:`page-ticketed`,columns:[{key:`label`,label:s.colEvent},{key:`date`,label:s.colDateTimeLower}],rows:oe},{type:`actions`,elements:[{type:`link`,label:s.openOrders,target:{kind:`external`,url:`${t.site?.url??``}/_emdash/admin/plugins/eventual-tickets/orders`},appearance:`secondary`}]});let ce=On(S,s);if(ce&&z.push({type:`accordion`,label:s.heatmapHeader,blocks:[{type:`context`,text:s.heatmapIntro},ce]}),z.push({type:`divider`},{type:`header`,text:s.attendees},...I(s.showAttendees,s.filterSearch)),N){let e=N.includes(`@`)?se(N):``,t,n;e?t=(await a.call(()=>c.storage.attendees.query({where:{email:e},limit:50}))).items.map(e=>e.data).filter(e=>(!D.pool||en(e.translationGroup,e.eventId)===D.pool)&&(!D.occurrence||e.occurrenceStart===D.occurrence)):{found:t,cursor:n}=await P(ee,20),z.push({type:`context`,text:`${t.length?s.searchFound(Math.min(t.length,20)):s.searchNone}${n?` ${s.searchPartial}`:``}`});for(let e of t.slice(0,20))z.push(...ae(e));return{blocks:z,toast:g}}let le=D.cancelled?M:{...M,status:{in:[`going`,`pending`,`waitlist`,`attended`]}},ue=await a.call(()=>c.storage.attendees.query({where:le,limit:25,cursor:f===`page-attendees`?Mn(d.value):void 0}));return z.push({type:`table`,page_action_id:`page-attendees`,next_cursor:ue.hasMore?ue.cursor:void 0,columns:[{key:`displayName`,label:s.colAttendee},{key:`email`,label:s.colEmail},{key:`status`,label:s.colStatus,format:`badge`},{key:`quantity`,label:s.colSeats,format:`number`},{key:`occurrence`,label:s.colDateTime},{key:`answers`,label:s.colAnswers},{key:`action`,label:s.colAction,format:`element`},{key:`cancelAction`,label:s.colCancel,format:`element`}],rows:ue.items.map(({data:e})=>({displayName:e.erasedAt?`—`:e.displayName,email:e.erasedAt?`—`:e.email,status:ie(e),quantity:e.quantity||1,occurrence:E(e),answers:e.erasedAt?``:Oe(e.answers),action:e.erasedAt?void 0:ne(e),cancelAction:e.erasedAt?void 0:re(e)})),empty_text:D.pool?s.noAttendeesSelection:s.noRsvps}),z.push({type:`context`,text:D.cancelled?s.cancelledShown:s.cancelledHidden},{type:`actions`,elements:[{type:`button`,action_id:`toggle-cancelled`,label:D.cancelled?s.hideCancelled:s.showCancelled}]}),ue.items.length&&z.push({type:`context`,text:s.phoneHint}),z.push(...L(s.listFilesIntro)),{blocks:z,toast:g}}function Ln(e,t){if(!e)return``;let n=t=>new Intl.DateTimeFormat(`en-GB`,{hour:`2-digit`,minute:`2-digit`,timeZone:t}).format(new Date(e));try{if(t)return n(t)}catch{}return`${n(`UTC`)} UTC`}function Rn(e,t,n,r,i,a){return[Nn(e,jn),{type:`header`,text:e.settingsHeader},{type:`form`,block_id:`config`,fields:[{type:`text_input`,action_id:`replyTo`,label:e.fieldReplyTo,initial_value:t.replyTo},{type:`number_input`,action_id:`reminderLeadHours`,label:e.fieldReminders,min:0,max:168,initial_value:t.reminderLeadHours},{type:`select`,action_id:`defaultLocale`,label:e.fieldLocale,options:pt.map(e=>({label:ht(e),value:e})),initial_value:t.defaultLocale},{type:`number_input`,action_id:`retentionDays`,label:e.fieldRetentionDays,min:30,max:3650,initial_value:t.retentionDays},{type:`text_input`,action_id:`defaultTimezone`,label:e.fieldDefaultTimezone,placeholder:`Europe/Zurich`,initial_value:t.defaultTimezone}],submit:{label:e.save,action_id:`save-config`}},{type:`divider`},{type:`header`,text:e.personalDataHeader},{type:`context`,text:e.personalDataIntro},{type:`form`,block_id:`personal-data`,fields:[{type:`text_input`,action_id:`eraseEmail`,label:e.fieldEraseEmail,initial_value:r??``}],submit:{label:e.findPersonalData,action_id:`find-personal-data`}},...i,{type:`divider`},{type:`accordion`,label:e.siteSetupHeader,default_open:a,blocks:[{type:`context`,text:e.settingsIntro},{type:`form`,block_id:`site-setup`,fields:[{type:`text_input`,action_id:`eventCollection`,label:e.fieldCollections,initial_value:t.eventCollection},{type:`text_input`,action_id:`managePagePath`,label:e.fieldManagePath,initial_value:t.managePagePath},{type:`text_input`,action_id:`turnstileSiteKey`,label:e.fieldTurnstileSiteKey,initial_value:t.turnstileSiteKey},{type:`text_input`,action_id:`turnstileSecretKey`,label:e.fieldTurnstileSecret,placeholder:t.turnstileSecretKey?e.turnstileSecretSaved:``,initial_value:``}],submit:{label:e.save,action_id:`save-config`}},{type:`context`,text:Dt(t)?e.turnstileOn:e.turnstileOff},{type:`context`,text:e.componentsHint(n)},{type:`context`,text:e.tasksIntro},{type:`actions`,elements:[{type:`button`,action_id:`run-maintenance`,label:e.runMaintenance},{type:`button`,action_id:`run-reconcile`,label:e.runReconcile}]}]}]}const zn=new Map,Bn=e=>({mode:e.has(`inventory_mode`),capacity:e.has(`capacity`),waitlist:e.has(`allow_waitlist`)});async function Vn(e,t,n,r){let i=new Set([`inventory_mode`,`capacity`,`allow_waitlist`].filter(e=>e in r));if(i.size===3)return Bn(i);let a=zn.get(n);if(a&&Date.now()-a.at<6e4)return a.fields;let o=e.schema;if(o&&t.has(1))try{let e=await t.call(()=>o.getCollection(n)),r=Bn(new Set([...i,...(e?.fields??[]).map(e=>e.slug)]));return zn.set(n,{fields:r,at:Date.now()}),r}catch{}let s=i.size>0;return{mode:s,capacity:s,waitlist:s}}function Hn(e,t,n,r){if(typeof e!=`number`&&(typeof e!=`string`||!e.trim()))return r;let i=Number(e);return Number.isSafeInteger(i)?Math.max(t,Math.min(n,i)):r}function Un(e){let t=Number(e);return Number.isSafeInteger(t)&&t>0?t:0}const Wn=(e,t)=>typeof e==`string`?e.slice(0,t):``;function Gn(e,t){return{id:e,label:Wn(t.label,400).trim(),type:Wn(t.type,20)||`text`,required:t.required===!0,options:Wn(t.options,4e3)}}function Kn(e){let t=e.label.replace(/\|/g,`/`).replace(/^#+\s*/,``);if(!t)return{issue:{line:null,code:`NO_LABEL`}};let n=e.type===`select`?e.options.split(/[\n,]/).map(e=>e.replace(/\|/g,`/`).trim()).filter(Boolean).join(`, `):``,r=Ce([t,e.type,e.required?`required`:`optional`,n].join(` | `));return r.issues[0]?{issue:{...r.issues[0],line:null}}:{question:r.questions[0]}}function qn(e,t,n){return{type:`form`,block_id:n?`question-new`:`question-${t.id}`,fields:[{type:`text_input`,action_id:`label`,label:e.qLabel,placeholder:n?e.qLabelPlaceholder:void 0,initial_value:t.label},{type:`select`,action_id:`type`,label:e.qType,options:be.map(t=>({label:e.qTypes[t],value:t})),initial_value:t.type},{type:`text_input`,action_id:`options`,label:e.qOptions,placeholder:`S
186
186
  M
187
- L`,multiline:!0,initial_value:t.options,condition:{field:`type`,eq:`select`}},{type:`toggle`,action_id:`required`,label:e.qRequired,initial_value:t.required}],submit:n?{action_id:`add-question`,label:e.qAdd}:{action_id:`save-question:${t.id}`,label:e.qSave}}}async function Wn(e,t){let n=new r,i=dn(await lt(t,n,e.ui?.locale),U(e.ui?.locale)),a=e.ui?.entry;if(!a?.id)return{blocks:[{type:`context`,text:i.openEvent}]};let o=Y(t),s=await q(o,n);if(!Ct(s).includes(a.collection))return{blocks:[{type:`context`,text:i.notConfigured(s.eventCollection)}]};let c=await n.call(()=>t.content.get(a.collection,a.id));if(!c)return{blocks:[{type:`context`,text:i.saveFirst}]};let l=fe(c),u=t.storage.attendance_settings,d=e.input&&typeof e.input==`object`&&!Array.isArray(e.input)?e.input:{},f=typeof d.action_id==`string`?d.action_id:``,p=d.values&&typeof d.values==`object`?d.values:null,m=await ze(u,n,c),g=m.config,_={...m.stored??{}},v,b=[],x=null,S=c.data??{},ee=`capacity`in S,C=`allow_waitlist`in S,w=async(e,t)=>{await n.call(()=>u.put(l,{...e,eventId:l})),_=e,g=(await ze({get:async()=>e},new r,c)).config,v={message:t,type:`success`}};if(f===`save-attendance-settings`&&p){let e=g.questions??[];if(typeof p.questions==`string`){let t=Se(p.questions.slice(0,2e4));b=t.issues.map(i.questionIssue),e=t.questions}b.length===0&&await w({enabled:p.enabled===!0,capacity:`capacity`in p?zn(p.capacity,0,1e5,g.capacity):void 0,maxPerRegistration:zn(p.maxPerRegistration,1,20,4),allowWaitlist:`allowWaitlist`in p?p.allowWaitlist===!0:void 0,requireApproval:p.requireApproval===!0,approvalHours:zn(p.approvalHours,1,720,g.approvalHours??48),replyTo:V(p.replyTo),questions:e},i.panelSaved)}else if((f===`add-question`||f.startsWith(`save-question:`))&&p){let e=f===`add-question`?``:f.slice(14),t=[...g.questions??[]],n=t.findIndex(t=>t.id===e),r=Vn(e,p),a=Hn(r);if(e&&n<0)b=[i.qGone];else if(!e&&t.length>=H.questions)b=[i.questionIssue({line:null,code:`TOO_MANY_QUESTIONS`,limit:H.questions})];else if(!a.question)b=[i.questionIssue(a.issue)],x=r;else if(e)t[n]={...a.question,id:e},await w({..._,questions:t},i.qSaved);else{let e=new Set(t.map(e=>e.id)),n=a.question.id;for(let t=2;e.has(n);t++)n=`${a.question.id}_${t}`;t.push({...a.question,id:n}),await w({..._,questions:t},i.qAdded)}}else if(f===`remove-question`||f===`move-question-up`){let e=[...g.questions??[]],t=e.findIndex(e=>e.id===d.value);t<0?b=[i.qGone]:f===`remove-question`?(e.splice(t,1),await w({..._,questions:e},i.qRemoved)):t>0&&([e[t-1],e[t]]=[e[t],e[t-1]],await w({..._,questions:e},i.qMoved))}else if(f===`view-registrations`)return await n.call(()=>t.kv.set(`state:admin-filter:${e.user?.id??`shared`}`,{pool:l})),{blocks:[],navigate:{kind:`plugin-page`,path:`/attendance`}};b.length&&(v={message:x||!p||!(`questions`in p)?b[0]:i.panelNotSaved,type:`error`});let T=`${h}${l}`,E=(await n.call(()=>o.kv.list(T))).filter(e=>e.key===T||e.key.startsWith(`${T}:`)).map(e=>y(e.value)).filter(e=>!!e),D=E.reduce((e,t)=>e+t.taken,0),O=E.reduce((e,t)=>e+t.held,0),k=E.reduce((e,t)=>e+t.waitlistCount,0),A=D+O+k>0,j=[];b.length&&j.push({type:`banner`,title:x?i.qNotSaved:i.questionsNeedFixing,description:b.slice(0,10).join(` `),variant:`error`});let M={type:`button`,action_id:`view-registrations`,label:i.viewRegistrations},te=[E.length>1?i.placesTakenAllDates(D):g.capacity>0?i.placesTakenOf(D,g.capacity):i.placesTaken(D),O?i.placesOffered(O):``,k?i.peopleWaiting(k):``].filter(Boolean).join(` · `);if(de(c))return j.push({type:`banner`,title:i.ticketedTitle,description:i.ticketedBody,variant:`alert`}),A&&j.push({type:`section`,text:te,accessory:M}),{blocks:j,toast:v};j.push({type:`section`,text:`${g.enabled?i.statusOpen:i.statusClosed} · ${te}`,accessory:M});let N=[{type:`toggle`,action_id:`enabled`,label:i.enable,description:i.enableHelp,initial_value:g.enabled}];if(ee||N.push({type:`number_input`,action_id:`capacity`,label:i.capacityLimit,min:0,max:1e5,initial_value:g.capacity}),C||N.push({type:`toggle`,action_id:`allowWaitlist`,label:i.allowWaitlist,description:i.allowWaitlistHelp,initial_value:g.allowWaitlist}),N.push({type:`number_input`,action_id:`maxPerRegistration`,label:i.maxPerBooking,min:1,max:20,initial_value:g.maxPerRegistration},{type:`toggle`,action_id:`requireApproval`,label:i.requireApproval,description:i.requireApprovalHelp,initial_value:g.requireApproval},{type:`number_input`,action_id:`approvalHours`,label:i.approvalHours,min:1,max:720,initial_value:g.approvalHours,condition:{field:`requireApproval`,eq:!0}},{type:`text_input`,action_id:`replyTo`,label:i.eventReplyTo,placeholder:s.replyTo||void 0,initial_value:g.replyTo??``}),ee||C){let e=[];ee&&e.push(g.capacity>0?i.fromEventPlaces(g.capacity):i.fromEventNoLimit),C&&e.push(g.allowWaitlist?i.fromEventWaitlistOn:i.fromEventWaitlistOff);let t=ee&&_.capacity!=null&&Number(_.capacity)!==(Number(S.capacity)||0)||C&&_.allowWaitlist!=null&&!!_.allowWaitlist!=!!S.allow_waitlist;j.push({type:`context`,text:`${e.join(` · `)}. ${i.fromEventHint}`}),t&&j.push({type:`banner`,title:i.fromEventDiffersTitle,description:i.fromEventDiffers,variant:`alert`})}j.push({type:`form`,block_id:`attendance-settings`,fields:N,submit:{action_id:`save-attendance-settings`,label:i.savePanel}},{type:`context`,text:i.savedSeparately},{type:`divider`},{type:`section`,text:i.qHeader},{type:`context`,text:i.qIntro});let P=g.questions??[];if(P.forEach((e,t)=>{let n=x?.id===e.id,r=n?x:{id:e.id,label:e.label,type:e.type,required:e.required,options:(e.options??[]).join(`
188
- `)},a=[];t>0&&a.push({type:`button`,action_id:`move-question-up`,label:i.qMoveUp,value:e.id}),a.push({type:`button`,action_id:`remove-question`,label:i.qRemove,style:`danger`,value:e.id,confirm:{title:i.qRemoveTitle(e.label),text:i.qRemoveText,confirm:i.qRemove,deny:i.keep}}),j.push({type:`accordion`,label:`${t+1}. ${e.label} · ${i.qTypes[e.type]}${e.required?` · ${i.required}`:``}`,default_open:n,blocks:[Un(i,r,!1),{type:`actions`,elements:a}]})}),P.length<H.questions){let e=x&&!x.id?x:{id:``,label:``,type:`text`,required:!1,options:``};j.push({type:`accordion`,label:i.qAddHeader,default_open:P.length===0||!!x&&!x.id,blocks:[Un(i,e,!0)]})}return{blocks:j,toast:v}}async function Gn(e,t,n,r=Date.now()){let i=n&&typeof n==`object`?n:{},a=i.token;if(!L(a))return{ok:!1,error:`INVALID_TOKEN`};if(i.action===`claim`){let n=await Le(a),i=(await t.call(()=>e.storage.waitlist_entries.query({where:{claimTokenHash:n},limit:1}))).items[0]?.data;return i?{ok:!0,kind:`claim`,state:i.status===`expired`||i.status===`offered`&&!(r<Date.parse(i.offerExpiresAt??``))?`expired`:i.status===`claimed`?`claimed`:i.status===`offered`?`offered`:`unavailable`,eventTitle:i.eventTitle??``,occurrenceStart:i.occurrenceStart,quantity:i.quantity,...i.locale?{locale:i.locale}:{},...i.offerExpiresAt?{offerExpiresAt:i.offerExpiresAt}:{}}:{ok:!1,error:`ENTRY_NOT_FOUND`}}if(i.action!==`cancel`)return{ok:!1,error:`INVALID_ACTION`};let o=await Ie(a),s=(await t.call(()=>e.storage.attendees.query({where:{cancelTokenHash:o},limit:1}))).items[0]?.data;return s?{ok:!0,kind:`cancel`,state:s.status,eventTitle:s.eventTitle??``,occurrenceStart:s.occurrenceStart,...s.startsAt?{startsAt:s.startsAt}:{},...s.allDay?{allDay:!0}:{},...s.timezone?{timezone:s.timezone}:{},quantity:s.quantity||1,displayName:s.displayName,...s.locale?{locale:s.locale}:{}}:{ok:!1,error:`ALREADY_CANCELLED_OR_UNKNOWN`}}async function Kn(e,t,n=Date.now()){let r=await q(e,t),i=new Date(n).toISOString(),o=0,s=0;if(t.has(1)){let n=await t.call(()=>e.storage.attendees.query({where:{status:`pending`,approvalDueAt:{lt:i}},limit:2}));for(let{data:a}of n.items){if(!a.approvalDueAt||!(a.approvalDueAt<i))continue;if(!t.has(4))break;if(!(await rn(e,t,a)).ok)continue;o++;let n=await G(e,t,W(a.locale,r.defaultLocale));await J(e,t,r.replyTo,a,n.requestLapsed({name:a.displayName,title:a.eventTitle||n.fallbackTitle}),`Approval lapse email failed`)}}if(t.has(3)){let n=await t.call(()=>e.storage.attendees.query({where:{organiserNotice:`queued`},limit:2})),o=W(r.defaultLocale),c=pt(o),l=await G(e,t,o);for(let{data:o}of n.items){let n=o.replyTo||r.replyTo;if(!t.has(n?2:1))break;if(!(await t.call(()=>e.storage.attendees.updateIf(o.id,{where:{organiserNotice:`queued`},set:{organiserNotice:`sent`,updatedAt:i}}))).applied||!n||o.status!==`pending`||!e.email?.send)continue;let u=o.occurrenceStart||o.startsAt,f=u?d(u,o.timezone,c):l.singleEvent,p=d(o.approvalDueAt||i,o.timezone,c);try{await t.call(()=>e.email.send({to:n,...l.organiserNewRequest({name:o.displayName,email:o.email,quantity:o.quantity||1,title:o.eventTitle||l.fallbackTitle,date:f,deadline:p})})),s++}catch(n){a(t,e.log,`warn`,`Organiser approval notice failed`,{attendeeId:o.id,error:String(n)})}}}return{lapsed:o,noticed:s}}async function qn(e,t,n=Date.now()){let r=await q(e,t);if(!e.email?.send)return{sent:0};let i=await t.call(()=>e.storage.attendees.query({where:{mail:`queued`},limit:3})),a=new Date(n).toISOString(),o=0;for(let{data:n}of i.items){if(!t.has(2))break;if(!(await t.call(()=>e.storage.attendees.updateIf(n.id,{where:{mail:`queued`},set:{mail:`sent`,updatedAt:a}}))).applied||!n.email||n.status===`cancelled`||n.status===`attended`)continue;let i=W(n.locale,r.defaultLocale),s=await G(e,t,i),c=e.site?.url??``,l=Rt(s,n,{cancelUrl:jt(c,r,`cancel`,await Pe(r.hmacSecret,n.id,n.createdAt,n.eventId)),calendarUrl:n.status===`going`&&n.startsAt?Ft(c,n.eventId,n.occurrenceStart,n.collection,e.plugin?.id):void 0,deadline:n.status===`pending`?d(n.approvalDueAt||a,n.timezone,pt(i)):void 0});await J(e,t,r.replyTo,n,l,`Queued RSVP email failed`)&&o++}return{sent:o}}async function Jn(e,t,n=Date.now()){let r=await kt(e,t),i=new Date(n-r.retentionDays*864e5).toISOString(),a=new Date(n).toISOString(),o=0,s=0;if(t.has(1)){let r=await t.call(()=>e.storage.attendees.query({where:{retainFrom:{lt:i}},orderBy:{retainFrom:`asc`},limit:4}));for(let{data:i}of r.items){if(!t.has(1))break;if((i.status===`going`||i.status===`pending`||i.status===`waitlist`)&&Zt(i.startsAt||i.occurrenceStart,n)){await t.call(()=>e.storage.attendees.updateIf(i.id,{where:{retainFrom:i.retainFrom},set:{retainFrom:a}}));continue}(await t.call(()=>e.storage.attendees.updateIf(i.id,{where:{retainFrom:i.retainFrom},set:{displayName:``,email:``,answers:[],replyTo:``,ipHash:``,retainFrom:`~erased`,erasedAt:a}}))).applied&&o++}}if(t.has(2)){let r=Math.max(1,Math.min(4,t.remaining-2)),o=await t.call(()=>e.storage.waitlist_entries.query({where:{retainFrom:{lt:i}},orderBy:{retainFrom:`asc`},limit:r}));for(let{data:r}of o.items){if(!t.has(1))break;if((r.status===`queued`||r.status===`offered`)&&Zt(r.startsAt||r.occurrenceStart,n)){await t.call(()=>e.storage.waitlist_entries.updateIf(r.id,{where:{retainFrom:r.retainFrom},set:{retainFrom:a}}));continue}(await t.call(()=>e.storage.waitlist_entries.updateIf(r.id,{where:{retainFrom:r.retainFrom},set:{displayName:``,email:``,retainFrom:`~erased`,erasedAt:a}}))).applied&&s++}}return{attendees:o,waitlist:s}}async function Yn(e,t){return(await F(e,`ip`,[t])).slice(0,32)}async function Xn(e,t,n,r=Date.now()){return(await t.call(()=>e.query({where:{ipHash:n,createdAt:{gt:new Date(r-6e5).toISOString()}},limit:10}))).items.length>=10}const Zn=/^[^\s@]{1,64}@[^\s@]{1,255}\.[^\s@]{2,}$/;function Qn(e){return e&&typeof e==`object`?e.token:void 0}async function $n(e,t){return`att_${(await I(`rsvp:${e}:${t}`)).slice(0,32)}`}function er(e,t){if(!(e.eventId===t.eventId&&e.email===t.email&&e.occurrenceStart===t.occurrenceStart&&e.quantity===t.quantity))return{ok:!1,error:`IDEMPOTENCY_CONFLICT`};if(e.status===`cancelled`)return{ok:!1,error:`ALREADY_CANCELLED`};let n=e.status===`waitlist`?`waitlist`:e.status===`pending`?`pending`:`going`;return{ok:!0,attendeeId:e.id,status:n,...n===`pending`&&e.approvalDueAt?{approvalDueAt:e.approvalDueAt}:{},waitlistPosition:n===`waitlist`?e.waitlistPosition:void 0,replayed:!0}}const tr={hooks:{"plugin:activate":async(e,t)=>{await Xt(t.cron)},cron:async(e,t)=>{if(e.name===Wt){let e=new r,n=await an(Y(t),e);(n.expiredCount||n.promotedCount)&&a(e,t.log,`info`,`Waitlist maintenance`,n)}else if(e.name===zt)await Vt(Y(t),new r);else if(e.name===Ht){let e=new r,n=await Ut(Y(t),e);n.sent&&a(e,t.log,`info`,`Attendance reminders sent`,n)}else if(e.name===Gt){let e=new r,n=await qn(Y(t),e);n.sent>0&&e.has(1)&&a(e,t.log,`info`,`Queued confirmations sent`,n)}else if(e.name===qt){let e=new r,n=await Kn(Y(t),e);(n.lapsed||n.noticed)&&e.has(1)&&a(e,t.log,`info`,`Attendance approvals`,n)}else if(e.name===st)await dt(t,new r);else if(e.name===Kt){let e=new r,n=await Jn(Y(t),e);(n.attendees>0||n.waitlist>0)&&e.has(1)&&a(e,t.log,`info`,`Attendance retention sweep`,n)}},"content:beforeDelete":async(e,t)=>{let n=new r,i=Y(t);if(Ct(await kt(i,n)).includes(e.collection)&&await Qt(i,n,e.id))return a(n,t.log,`warn`,`Delete blocked: the event has live registrations`,{id:e.id}),!1}},routes:{admin:{permission:`content:edit_any`,handler:async(e,t)=>In(e.input,t,e.user,e.ui?.locale)},"admin/editor/attendance":{permission:`content:edit_any`,handler:async(e,t)=>Wn(e,t)},rsvp:t({public:!0,methods:[`POST`],request:{body:`json`},handler:async(e,t)=>{let n=new r,i=e.input&&typeof e.input==`object`?e.input:{};if(!ce(typeof i.honeypot==`string`?i.honeypot:void 0))return{ok:!0,status:`going`,message:`Registration received.`};if(!le(typeof i.formTimestamp==`number`?i.formTimestamp:void 0))return{ok:!1,error:`INVALID_SUBMISSION_TIMING`};let a=String(i.eventId??``).trim().slice(0,128),o=String(i.email??``).trim().toLowerCase().slice(0,320),s=String(i.displayName??``).trim().slice(0,100),c=String(i.occurrenceStart??``).trim().slice(0,40),u=i.quantity===void 0?1:Number(i.quantity);if(!a||!o||!s)return{ok:!1,error:`MISSING_REQUIRED_FIELDS`};if(!Zn.test(o))return{ok:!1,error:`INVALID_EMAIL`};if(!Number.isSafeInteger(u)||u<1||u>20)return{ok:!1,error:`INVALID_QUANTITY`};if(c&&Number.isNaN(Date.parse(c)))return{ok:!1,error:`INVALID_OCCURRENCE`};let f=Y(t),p=await q(f,n),m=W(i.locale,p.defaultLocale),h=se(i.commandId)?i.commandId:`srv_${crypto.randomUUID()}`,_=await $n(a,h);if(se(i.commandId)&&i.firstAttempt!==!0){let e=await n.call(()=>f.storage.attendees.get(_));if(e)return er(e,{eventId:a,email:o,occurrenceStart:c,quantity:u})}let v=typeof e.requestMeta?.ip==`string`?e.requestMeta.ip.trim():``,y=Date.now();if(Et(p)){if(!t.http?.fetch)return{ok:!1,error:`TRY_AGAIN`};if(!(await Ne(t.http.fetch.bind(t.http),n,{secret:p.turnstileSecretKey,token:i.turnstileToken,remoteIp:v||null})).ok)return{ok:!1,error:`CHALLENGE_FAILED`}}let b=``;if(!Et(p)&&v&&(b=await Yn(p.hmacSecret,v),await Xn(f.storage.attendees,n,b,y)))return{ok:!1,error:`RATE_LIMITED`};let x=wt(p,i.collection);if(!x)return{ok:!1,error:`EVENT_NOT_FOUND`};let S=x===Ct(p)[0]?``:x,C=await n.call(()=>t.content.get(x,a));if(!C)return{ok:!1,error:`EVENT_NOT_FOUND`};if(C.status!==`published`)return{ok:!1,error:`EVENT_NOT_PUBLISHED`};if(de(C))return{ok:!1,error:`EVENT_TICKETED`};let T=C.data??{},{config:E}=await ze(t.storage.attendance_settings,n,C),D=E.capacity;if(!E.enabled)return{ok:!1,error:`RSVP_DISABLED`};if(u>E.maxPerRegistration)return{ok:!1,error:`MAX_QUANTITY_EXCEEDED`,maxAllowed:E.maxPerRegistration};let O=Ee(E.questions??[],i.answers);if(!O.ok)return{ok:!1,error:`INVALID_ANSWERS`,fields:O.errors};let k=fe(C),A=g(k,c);if(!n.has(4))return{ok:!1,error:`TRY_AGAIN`};let j=l(T,c),M=j&&!j.timezone&&p.defaultTimezone?{...j,timezone:p.defaultTimezone}:j,te=Math.max(1,Math.min(2,Math.floor((n.remaining-4)/2))),N=await ee(f.kv,n,A,{quantity:u,capacity:D,allowWaitlist:E.allowWaitlist,occurrenceStart:c,poolKey:k,maxAttempts:te,label:String(T.title??``).slice(0,200)||void 0,timezone:M?.timezone});if(!N.ok)return{ok:!1,status:`full`,error:N.reason===`FULL`?`Registration is full for this date.`:`High registration traffic. Please try again in a moment.`};let P=N.status===`waitlist`?N.position:void 0,F=new Date(y).toISOString(),I=await Pe(p.hmacSecret,_,F,a),L=String(T.title??`the event`).slice(0,200),ne=N.status===`waitlist`?`wl_${crypto.randomUUID()}`:void 0,re=1+(N.status===`waitlist`?1:0),ie=!!t.email?.send&&n.remaining>=re+1,ae=!!t.email?.send&&!ie,R=E.requireApproval&&N.status===`going`,z=N.status===`waitlist`?`waitlist`:R?`pending`:`going`,B=R?He(y,E.approvalHours,M?.startsAt):void 0,oe=!!(E.replyTo||p.replyTo),V={id:_,eventId:a,translationGroup:k,occurrenceStart:c,email:o,displayName:s,status:z,quantity:u,cancelTokenHash:await Ie(I),commandId:h,waitlistEntryId:ne,waitlistPosition:P,replyTo:E.replyTo||void 0,startsAt:M?.startsAt,allDay:M?.allDay,timezone:M?.timezone,eventTitle:L,locale:m,...S?{collection:S}:{},reminder:M&&!R?`due`:void 0,...B?{approvalDueAt:B}:{},...R&&oe?{organiserNotice:`queued`}:{},...ae?{mail:`queued`}:{},...b?{ipHash:b}:{},answers:O.answers.length?O.answers:void 0,retainFrom:M?.startsAt??F,createdAt:F,updatedAt:F};if(!(await n.call(()=>t.storage.attendees.compareAndSet(_,null,V))).applied){if(n.has(2)){let e=Math.max(1,Math.min(3,Math.floor((n.remaining-1)/2)));await w(f.kv,n,A,N.status===`waitlist`?{waitlistCount:u}:{taken:u},e)}let e=n.has(1)?await n.call(()=>f.storage.attendees.get(_)):null;return e?er(e,{eventId:a,email:o,occurrenceStart:c,quantity:u}):{ok:!1,error:`TRY_AGAIN`}}if(ne){let e={id:ne,eventId:a,poolKey:k,occurrenceStart:c,attendeeId:_,quantity:u,email:o,displayName:s,eventTitle:L,replyTo:E.replyTo||void 0,locale:m,position:P??0,status:`queued`,startsAt:M?.startsAt,retainFrom:M?.startsAt??c??F,createdAt:F,updatedAt:F};await n.call(()=>t.storage.waitlist_entries.put(ne,e))}let ue=jt(t.site?.url??``,p,`cancel`,I),pe=M?Ft(t.site?.url??``,a,c,S,t.plugin?.id):void 0;if(ie&&o){let e=z===`pending`?d(B,M?.timezone,pt(m)):void 0,t=Rt(await G(f,n,m),{displayName:s,eventTitle:L,status:z,waitlistPosition:P},{cancelUrl:ue,calendarUrl:pe,deadline:e});await J(f,n,E.replyTo||p.replyTo,{email:o,id:_},t,`RSVP email failed`)}return{ok:!0,attendeeId:_,status:z,...B?{approvalDueAt:B}:{},remaining:N.status===`going`?N.remaining:0,waitlistPosition:P,email:t.email?.send?ae?`queued`:`sent`:`none`,...ue?{manageUrl:ue}:{}}}}),"rsvp/form":t({public:!0,methods:[`GET`],request:{body:`none`},cacheControl:`no-store`,handler:async(e,t)=>{let n=(new URL(e.request.url).searchParams.get(`eventId`)??``).trim().slice(0,128);if(!n)return{ok:!1,error:`MISSING_EVENT`};let a=new r,o=Y(t);await N(o.kv,t.cron,new i(a,4),Jt).catch(()=>`SKIPPED`);let s=await kt(o,a),c=wt(s,new URL(e.request.url).searchParams.get(`collection`));if(!c)return{ok:!1,error:`EVENT_NOT_FOUND`};let l=await a.call(()=>t.content.get(c,n));if(!l||l.status!==`published`)return{ok:!1,error:`EVENT_NOT_FOUND`};if(de(l))return{ok:!1,error:`EVENT_TICKETED`};let{config:u}=await ze(t.storage.attendance_settings,a,l),d=(new URL(e.request.url).searchParams.get(`occurrence`)??``).trim().slice(0,40),f=u.capacity>0&&a.has(1)?await a.call(()=>o.kv.getVersioned(g(fe(l),d))):null,p=f?y(f.value):null,m=u.capacity>0?Math.max(0,u.capacity-(p?.taken??0)-(p?.held??0)):null;return{ok:!0,open:u.enabled,maxPerRegistration:u.maxPerRegistration,allowWaitlist:u.allowWaitlist,...u.requireApproval?{requiresApproval:!0}:{},seatsLeft:m,full:m===0,questions:u.enabled?u.questions??[]:[],...u.enabled&&Et(s)?{turnstileSiteKey:s.turnstileSiteKey}:{}}}}),cancel:t({public:!0,methods:[`POST`],request:{body:`json`},handler:async(e,t)=>{let n=new r,i=Qn(e.input);if(!L(i))return{ok:!1,error:`INVALID_TOKEN`};let a=Y(t),o=await Ie(i),s=(await n.call(()=>a.storage.attendees.query({where:{cancelTokenHash:o},limit:1}))).items[0]?.data;if(!s||s.status===`cancelled`)return{ok:!1,error:`ALREADY_CANCELLED_OR_UNKNOWN`};let c=await rn(a,n,s);return c.ok?(c.seatsFreed&&n.has(6)&&await en(a,n,$t(s.translationGroup,s.eventId),s.occurrenceStart),{ok:!0,status:`cancelled`,displayName:s.displayName}):{ok:!1,error:c.error}}}),"manage/lookup":t({public:!0,methods:[`POST`],request:{body:`json`},handler:async(e,t)=>Gn(Y(t),new r,e.input)}),"waitlist/claim":t({public:!0,methods:[`POST`],request:{body:`json`},handler:async(e,t)=>{let n=await tn(Y(t),new r,Qn(e.input));return n.ok?{ok:!0,status:n.attendee?.status??`going`,...n.attendee?.approvalDueAt?{approvalDueAt:n.attendee.approvalDueAt}:{},displayName:n.attendee?.displayName}:{ok:!1,error:n.error}}}),[Mt]:t({public:!0,methods:[`GET`],request:{body:`none`},response:`raw`,cacheControl:`public, max-age=300`,handler:async(t,n)=>{let i=new URL(t.request.url),a=(i.searchParams.get(`eventId`)??``).trim().slice(0,128),o=(i.searchParams.get(`occurrence`)??``).trim().slice(0,40),s=()=>e({status:404,headers:{"content-type":`text/plain; charset=utf-8`},body:{kind:`text`,value:`Event not found.`}});if(!a||o&&Number.isNaN(Date.parse(o)))return s();let c=new r,u=wt(await kt(Y(n),c),i.searchParams.get(`collection`));if(!u)return s();let d=await c.call(()=>n.content.get(u,a));if(!d||d.status!==`published`)return s();let f=l(d.data??{},o);if(!f)return s();let p=n.content?.getPublicUrl&&c.has(1)?await c.call(()=>n.content.getPublicUrl(u,a)).catch(()=>null):null;return e({status:200,headers:{"content-type":`text/calendar; charset=utf-8`,"content-disposition":`attachment; filename="event.ics"`},body:{kind:`text`,value:It(d,f,{occurrenceStart:o,publicUrl:p,host:i.host})}})}}),"roster/download":t({public:!0,methods:[`GET`],request:{body:`none`},response:`raw`,handler:async(t,n)=>{let i=new URL(t.request.url).searchParams.get(`token`),a=await vn(n,new r,i);return e(a?{status:200,headers:{"content-type":a.contentType,"content-disposition":`attachment; filename="${a.filename}"`},body:{kind:`text`,value:a.body}}:{status:404,headers:{"content-type":`text/plain; charset=utf-8`},body:{kind:`text`,value:`This download link is invalid, expired, or has already been used.`}})}}),"roster/export":t({public:!1,permission:`content:edit_any`,methods:[`GET`],request:{body:`none`},response:`raw`,handler:async(t,n)=>{let i=new URL(t.request.url),a=await yn({eventId:i.searchParams.get(`eventId`)||void 0,occurrenceStart:i.searchParams.get(`occurrence`)||i.searchParams.get(`occurrenceStart`)||void 0,format:i.searchParams.get(`format`)===`html`?`html`:`csv`},n,new r);return e({status:200,headers:{"content-type":a.contentType,"content-disposition":`attachment; filename="${a.filename}"`},body:{kind:`text`,value:a.body}})}})}},nr=[`rsvp`,`rsvp/form`,`cancel`,`manage/lookup`,`waitlist/claim`,Mt,`roster/download`];for(let t of nr){let r=tr.routes[t];if(!r?.handler)continue;let i=r.handler;r.handler=async(a,o)=>{try{return await i(a,o)}catch(i){if(!(i instanceof n))try{await o.log?.error?.(`Attendance public route failed`,{route:t,error:String(i).slice(0,500)})}catch{}return r.response===`raw`?e({status:503,headers:{"content-type":`text/plain; charset=utf-8`,"cache-control":`no-store`},body:{kind:`text`,value:`Temporarily unavailable. Please try again.`}}):{ok:!1,error:`TRY_AGAIN`}}}}export{tr as default,tr as plugin};
187
+ L`,multiline:!0,initial_value:t.options,condition:{field:`type`,eq:`select`}},{type:`toggle`,action_id:`required`,label:e.qRequired,initial_value:t.required}],submit:n?{action_id:`add-question`,label:e.qAdd}:{action_id:`save-question:${t.id}`,label:e.qSave}}}async function Jn(e,t){let n=new r,i=fn(await ut(t,n,e.ui?.locale),H(e.ui?.locale)),a=e.ui?.entry;if(!a?.id)return{blocks:[{type:`context`,text:i.openEvent}]};let o=J(t),s=await K(o,n);if(!wt(s).includes(a.collection)){let e=await n.call(()=>t.content.get(a.collection,a.id)),r=await Vn(t,n,a.collection,e?.data??{});return{blocks:[{type:`context`,text:r.mode||r.capacity||r.waitlist?i.notConfigured(s.eventCollection):i.notEventContent}]}}let c=await n.call(()=>t.content.get(a.collection,a.id));if(!c)return{blocks:[{type:`context`,text:i.saveFirst}]};let l=pe(c),u=t.storage.attendance_settings,d=e.input&&typeof e.input==`object`&&!Array.isArray(e.input)?e.input:{},f=typeof d.action_id==`string`?d.action_id:``,p=d.values&&typeof d.values==`object`?d.values:null,m=await Be(u,n,c),g=m.config,_={...m.stored??{}},v,b=[],x=null,S=c.data??{},C=await Vn(t,n,a.collection,S),w=S.inventory_mode===`rsvp`,T=Un(S.capacity),E=!!S.allow_waitlist,D=e=>({enabled:C.mode&&typeof e.enabled==`boolean`&&e.enabled!==w,capacity:C.capacity&&e.capacity!=null&&Un(e.capacity)!==T,waitlist:C.waitlist&&e.allowWaitlist!=null&&!!e.allowWaitlist!==E}),O=async(e,t)=>{e={...e};let i=D(e);C.mode&&!i.enabled&&delete e.enabled,C.capacity&&!i.capacity&&delete e.capacity,C.waitlist&&!i.waitlist&&delete e.allowWaitlist,await n.call(()=>u.put(l,{...e,eventId:l})),_=e,g=(await Be({get:async()=>e},new r,c)).config,v={message:t,type:`success`}};if(f===`save-attendance-settings`&&p){let e=g.questions??[];if(typeof p.questions==`string`){let t=Ce(p.questions.slice(0,2e4));b=t.issues.map(i.questionIssue),e=t.questions}b.length===0&&await O({enabled:`enabled`in p||!C.mode?p.enabled===!0:_.enabled,capacity:`capacity`in p?Hn(p.capacity,0,1e5,g.capacity):C.capacity?_.capacity:void 0,maxPerRegistration:Hn(p.maxPerRegistration,1,20,4),allowWaitlist:`allowWaitlist`in p?p.allowWaitlist===!0:C.waitlist?_.allowWaitlist:void 0,requireApproval:p.requireApproval===!0,approvalHours:Hn(p.approvalHours,1,720,g.approvalHours??48),replyTo:se(p.replyTo),questions:e},i.panelSaved)}else if((f===`add-question`||f.startsWith(`save-question:`))&&p){let e=f===`add-question`?``:f.slice(14),t=[...g.questions??[]],n=t.findIndex(t=>t.id===e),r=Gn(e,p),a=Kn(r);if(e&&n<0)b=[i.qGone];else if(!e&&t.length>=V.questions)b=[i.questionIssue({line:null,code:`TOO_MANY_QUESTIONS`,limit:V.questions})];else if(!a.question)b=[i.questionIssue(a.issue)],x=r;else if(e)t[n]={...a.question,id:e},await O({..._,questions:t},i.qSaved);else{let e=new Set(t.map(e=>e.id)),n=a.question.id;for(let t=2;e.has(n);t++)n=`${a.question.id}_${t}`;t.push({...a.question,id:n}),await O({..._,questions:t},i.qAdded)}}else if(f===`remove-question`||f===`move-question-up`){let e=[...g.questions??[]],t=e.findIndex(e=>e.id===d.value);t<0?b=[i.qGone]:f===`remove-question`?(e.splice(t,1),await O({..._,questions:e},i.qRemoved)):t>0&&([e[t-1],e[t]]=[e[t],e[t-1]],await O({..._,questions:e},i.qMoved))}else if(f===`use-event-fields`){let e={..._};C.mode&&delete e.enabled,C.capacity&&delete e.capacity,C.waitlist&&delete e.allowWaitlist,await O(e,i.usingEventFields)}else if(f===`view-registrations`)return await n.call(()=>t.kv.set(`state:admin-filter:${e.user?.id??`shared`}`,{pool:l})),{blocks:[],navigate:{kind:`plugin-page`,path:`/attendance`}};b.length&&(v={message:x||!p||!(`questions`in p)?b[0]:i.panelNotSaved,type:`error`});let k=`${h}${l}`,A=(await n.call(()=>o.kv.list(k))).filter(e=>e.key===k||e.key.startsWith(`${k}:`)).map(e=>y(e.value)).filter(e=>!!e),j=A.reduce((e,t)=>e+t.taken,0),M=A.reduce((e,t)=>e+t.held,0),N=A.reduce((e,t)=>e+t.waitlistCount,0),ee=j+M+N>0,P=[];b.length&&P.push({type:`banner`,title:x?i.qNotSaved:i.questionsNeedFixing,description:b.slice(0,10).join(` `),variant:`error`});let F={type:`button`,action_id:`view-registrations`,label:i.viewRegistrations},I=[A.length>1?i.placesTakenAllDates(j):g.capacity>0?i.placesTakenOf(j,g.capacity):i.placesTaken(j),M?i.placesOffered(M):``,N?i.peopleWaiting(N):``].filter(Boolean).join(` · `);if(fe(c))return P.push({type:`banner`,title:i.ticketedTitle,description:i.ticketedBody,variant:`alert`}),ee&&P.push({type:`section`,text:I,accessory:F}),{blocks:P,toast:v};P.push({type:`section`,text:`${g.enabled?i.statusOpen:i.statusClosed} · ${I}`,accessory:F});let L=[];if(C.mode||L.push({type:`toggle`,action_id:`enabled`,label:i.enable,description:i.enableHelp,initial_value:g.enabled}),C.capacity||L.push({type:`number_input`,action_id:`capacity`,label:i.capacityLimit,min:0,max:1e5,initial_value:g.capacity}),C.waitlist||L.push({type:`toggle`,action_id:`allowWaitlist`,label:i.allowWaitlist,description:i.allowWaitlistHelp,initial_value:g.allowWaitlist}),L.push({type:`number_input`,action_id:`maxPerRegistration`,label:i.maxPerBooking,min:1,max:20,initial_value:g.maxPerRegistration},{type:`toggle`,action_id:`requireApproval`,label:i.requireApproval,description:i.requireApprovalHelp,initial_value:g.requireApproval},{type:`number_input`,action_id:`approvalHours`,label:i.approvalHours,min:1,max:720,initial_value:g.approvalHours,condition:{field:`requireApproval`,eq:!0}},{type:`text_input`,action_id:`replyTo`,label:i.eventReplyTo,placeholder:s.replyTo||void 0,initial_value:g.replyTo??``}),C.mode||C.capacity||C.waitlist){let e=[];C.mode&&e.push(w?i.statusOpen:i.statusClosed),C.capacity&&e.push(T>0?i.fromEventPlaces(T):i.fromEventNoLimit),C.waitlist&&e.push(E?i.fromEventWaitlistOn:i.fromEventWaitlistOff);let t=[C.capacity||C.waitlist?i.fromEventHint:``,C.mode?i.fromEventOpenHint:``].filter(Boolean);P.push({type:`context`,text:`${i.fromEventLead} ${e.join(` · `)}. ${t.join(` `)}`});let n=D(_);(n.enabled||n.capacity||n.waitlist)&&P.push({type:`banner`,title:i.fieldsOverriddenTitle,description:i.fieldsOverridden,variant:`alert`},{type:`actions`,elements:[{type:`button`,action_id:`use-event-fields`,label:i.useEventFields,style:`primary`}]})}P.push({type:`form`,block_id:`attendance-settings`,fields:L,submit:{action_id:`save-attendance-settings`,label:i.savePanel}},{type:`context`,text:i.savedSeparately},{type:`divider`},{type:`section`,text:i.qHeader},{type:`context`,text:i.qIntro});let R=g.questions??[];if(R.forEach((e,t)=>{let n=x?.id===e.id,r=n?x:{id:e.id,label:e.label,type:e.type,required:e.required,options:(e.options??[]).join(`
188
+ `)},a=[];t>0&&a.push({type:`button`,action_id:`move-question-up`,label:i.qMoveUp,value:e.id}),a.push({type:`button`,action_id:`remove-question`,label:i.qRemove,style:`danger`,value:e.id,confirm:{title:i.qRemoveTitle(e.label),text:i.qRemoveText,confirm:i.qRemove,deny:i.keep}}),P.push({type:`accordion`,label:`${t+1}. ${e.label} · ${i.qTypes[e.type]}${e.required?` · ${i.required}`:``}`,default_open:n,blocks:[qn(i,r,!1),{type:`actions`,elements:a}]})}),R.length<V.questions){let e=x&&!x.id?x:{id:``,label:``,type:`text`,required:!1,options:``};P.push({type:`accordion`,label:i.qAddHeader,default_open:R.length===0||!!x&&!x.id,blocks:[qn(i,e,!0)]})}return{blocks:P,toast:v}}async function Yn(e,t,n,r=Date.now()){let i=n&&typeof n==`object`?n:{},a=i.token;if(!R(a))return{ok:!1,error:`INVALID_TOKEN`};if(i.action===`claim`){let n=await Re(a),i=(await t.call(()=>e.storage.waitlist_entries.query({where:{claimTokenHash:n},limit:1}))).items[0]?.data;return i?{ok:!0,kind:`claim`,state:i.status===`expired`||i.status===`offered`&&!(r<Date.parse(i.offerExpiresAt??``))?`expired`:i.status===`claimed`?`claimed`:i.status===`offered`?`offered`:`unavailable`,eventTitle:i.eventTitle??``,occurrenceStart:i.occurrenceStart,quantity:i.quantity,...i.locale?{locale:i.locale}:{},...i.offerExpiresAt?{offerExpiresAt:i.offerExpiresAt}:{}}:{ok:!1,error:`ENTRY_NOT_FOUND`}}if(i.action!==`cancel`)return{ok:!1,error:`INVALID_ACTION`};let o=await Le(a),s=(await t.call(()=>e.storage.attendees.query({where:{cancelTokenHash:o},limit:1}))).items[0]?.data;return s?{ok:!0,kind:`cancel`,state:s.status,eventTitle:s.eventTitle??``,occurrenceStart:s.occurrenceStart,...s.startsAt?{startsAt:s.startsAt}:{},...s.allDay?{allDay:!0}:{},...s.timezone?{timezone:s.timezone}:{},quantity:s.quantity||1,displayName:s.displayName,...s.locale?{locale:s.locale}:{}}:{ok:!1,error:`ALREADY_CANCELLED_OR_UNKNOWN`}}async function Xn(e,t,n=Date.now()){let r=await K(e,t),i=new Date(n).toISOString(),o=0,s=0;if(t.has(1)){let n=await t.call(()=>e.storage.attendees.query({where:{status:`pending`,approvalDueAt:{lt:i}},limit:2}));for(let{data:a}of n.items){if(!a.approvalDueAt||!(a.approvalDueAt<i))continue;if(!t.has(4))break;if(!(await an(e,t,a)).ok)continue;o++;let n=await W(e,t,U(a.locale,r.defaultLocale));await q(e,t,r.replyTo,a,n.requestLapsed({name:a.displayName,title:a.eventTitle||n.fallbackTitle}),`Approval lapse email failed`)}}if(t.has(3)){let n=await t.call(()=>e.storage.attendees.query({where:{organiserNotice:`queued`},limit:2})),o=U(r.defaultLocale),c=mt(o),l=await W(e,t,o);for(let{data:o}of n.items){let n=o.replyTo||r.replyTo;if(!t.has(n?2:1))break;if(!(await t.call(()=>e.storage.attendees.updateIf(o.id,{where:{organiserNotice:`queued`},set:{organiserNotice:`sent`,updatedAt:i}}))).applied||!n||o.status!==`pending`||!e.email?.send)continue;let u=o.occurrenceStart||o.startsAt,f=u?d(u,o.timezone,c):l.singleEvent,p=d(o.approvalDueAt||i,o.timezone,c);try{await t.call(()=>e.email.send({to:n,...l.organiserNewRequest({name:o.displayName,email:o.email,quantity:o.quantity||1,title:o.eventTitle||l.fallbackTitle,date:f,deadline:p})})),s++}catch(n){a(t,e.log,`warn`,`Organiser approval notice failed`,{attendeeId:o.id,error:String(n)})}}}return{lapsed:o,noticed:s}}async function Zn(e,t,n=Date.now()){let r=await K(e,t);if(!e.email?.send)return{sent:0};let i=await t.call(()=>e.storage.attendees.query({where:{mail:`queued`},limit:3})),a=new Date(n).toISOString(),o=0;for(let{data:n}of i.items){if(!t.has(2))break;if(!(await t.call(()=>e.storage.attendees.updateIf(n.id,{where:{mail:`queued`},set:{mail:`sent`,updatedAt:a}}))).applied||!n.email||n.status===`cancelled`||n.status===`attended`)continue;let i=U(n.locale,r.defaultLocale),s=await W(e,t,i),c=e.site?.url??``,l=zt(s,n,{cancelUrl:Mt(c,r,`cancel`,await Fe(r.hmacSecret,n.id,n.createdAt,n.eventId)),calendarUrl:n.status===`going`&&n.startsAt?It(c,n.eventId,n.occurrenceStart,n.collection,e.plugin?.id):void 0,deadline:n.status===`pending`?d(n.approvalDueAt||a,n.timezone,mt(i)):void 0});await q(e,t,r.replyTo,n,l,`Queued RSVP email failed`)&&o++}return{sent:o}}async function Qn(e,t,n=Date.now()){let r=await At(e,t),i=new Date(n-r.retentionDays*864e5).toISOString(),a=new Date(n).toISOString(),o=0,s=0;if(t.has(1)){let r=await t.call(()=>e.storage.attendees.query({where:{retainFrom:{lt:i}},orderBy:{retainFrom:`asc`},limit:4}));for(let{data:i}of r.items){if(!t.has(1))break;if((i.status===`going`||i.status===`pending`||i.status===`waitlist`)&&Qt(i.startsAt||i.occurrenceStart,n)){await t.call(()=>e.storage.attendees.updateIf(i.id,{where:{retainFrom:i.retainFrom},set:{retainFrom:a}}));continue}(await t.call(()=>e.storage.attendees.updateIf(i.id,{where:{retainFrom:i.retainFrom},set:{displayName:``,email:``,answers:[],replyTo:``,ipHash:``,retainFrom:`~erased`,erasedAt:a}}))).applied&&o++}}if(t.has(2)){let r=Math.max(1,Math.min(4,t.remaining-2)),o=await t.call(()=>e.storage.waitlist_entries.query({where:{retainFrom:{lt:i}},orderBy:{retainFrom:`asc`},limit:r}));for(let{data:r}of o.items){if(!t.has(1))break;if((r.status===`queued`||r.status===`offered`)&&Qt(r.startsAt||r.occurrenceStart,n)){await t.call(()=>e.storage.waitlist_entries.updateIf(r.id,{where:{retainFrom:r.retainFrom},set:{retainFrom:a}}));continue}(await t.call(()=>e.storage.waitlist_entries.updateIf(r.id,{where:{retainFrom:r.retainFrom},set:{displayName:``,email:``,retainFrom:`~erased`,erasedAt:a}}))).applied&&s++}}return{attendees:o,waitlist:s}}async function $n(e,t){return(await I(e,`ip`,[t])).slice(0,32)}async function er(e,t,n,r=Date.now()){return(await t.call(()=>e.query({where:{ipHash:n,createdAt:{gt:new Date(r-6e5).toISOString()}},limit:10}))).items.length>=10}const tr=/^[^\s@]{1,64}@[^\s@]{1,255}\.[^\s@]{2,}$/;function nr(e){return e&&typeof e==`object`?e.token:void 0}async function rr(e,t){return`att_${(await L(`rsvp:${e}:${t}`)).slice(0,32)}`}function ir(e,t){if(!(e.eventId===t.eventId&&e.email===t.email&&e.occurrenceStart===t.occurrenceStart&&e.quantity===t.quantity))return{ok:!1,error:`IDEMPOTENCY_CONFLICT`};if(e.status===`cancelled`)return{ok:!1,error:`ALREADY_CANCELLED`};let n=e.status===`waitlist`?`waitlist`:e.status===`pending`?`pending`:`going`;return{ok:!0,attendeeId:e.id,status:n,...n===`pending`&&e.approvalDueAt?{approvalDueAt:e.approvalDueAt}:{},waitlistPosition:n===`waitlist`?e.waitlistPosition:void 0,replayed:!0}}const ar={hooks:{"plugin:activate":async(e,t)=>{await Zt(t.cron)},cron:async(e,t)=>{if(e.name===Gt){let e=new r,n=await on(J(t),e);(n.expiredCount||n.promotedCount)&&a(e,t.log,`info`,`Waitlist maintenance`,n)}else if(e.name===Bt)await Ht(J(t),new r);else if(e.name===Ut){let e=new r,n=await Wt(J(t),e);n.sent&&a(e,t.log,`info`,`Attendance reminders sent`,n)}else if(e.name===Kt){let e=new r,n=await Zn(J(t),e);n.sent>0&&e.has(1)&&a(e,t.log,`info`,`Queued confirmations sent`,n)}else if(e.name===Jt){let e=new r,n=await Xn(J(t),e);(n.lapsed||n.noticed)&&e.has(1)&&a(e,t.log,`info`,`Attendance approvals`,n)}else if(e.name===ct)await ft(t,new r);else if(e.name===qt){let e=new r,n=await Qn(J(t),e);(n.attendees>0||n.waitlist>0)&&e.has(1)&&a(e,t.log,`info`,`Attendance retention sweep`,n)}},"content:beforeDelete":async(e,t)=>{let n=new r,i=J(t);if(wt(await At(i,n)).includes(e.collection)&&await $t(i,n,e.id))return a(n,t.log,`warn`,`Delete blocked: the event has live registrations`,{id:e.id}),!1}},routes:{admin:{permission:`content:edit_any`,handler:async(e,t)=>In(e.input,t,e.user,e.ui?.locale)},"admin/editor/attendance":{permission:`content:edit_any`,handler:async(e,t)=>Jn(e,t)},rsvp:t({public:!0,methods:[`POST`],request:{body:`json`},handler:async(e,t)=>{let n=new r,i=e.input&&typeof e.input==`object`?e.input:{};if(!le(typeof i.honeypot==`string`?i.honeypot:void 0))return{ok:!0,status:`going`,message:`Registration received.`};if(!ue(typeof i.formTimestamp==`number`?i.formTimestamp:void 0))return{ok:!1,error:`INVALID_SUBMISSION_TIMING`};let a=String(i.eventId??``).trim().slice(0,128),o=String(i.email??``).trim().toLowerCase().slice(0,320),s=String(i.displayName??``).trim().slice(0,100),c=String(i.occurrenceStart??``).trim().slice(0,40),u=i.quantity===void 0?1:Number(i.quantity);if(!a||!o||!s)return{ok:!1,error:`MISSING_REQUIRED_FIELDS`};if(!tr.test(o))return{ok:!1,error:`INVALID_EMAIL`};if(!Number.isSafeInteger(u)||u<1||u>20)return{ok:!1,error:`INVALID_QUANTITY`};if(c&&Number.isNaN(Date.parse(c)))return{ok:!1,error:`INVALID_OCCURRENCE`};let f=J(t),p=await K(f,n),m=U(i.locale,p.defaultLocale),h=ce(i.commandId)?i.commandId:`srv_${crypto.randomUUID()}`,_=await rr(a,h);if(ce(i.commandId)&&i.firstAttempt!==!0){let e=await n.call(()=>f.storage.attendees.get(_));if(e)return ir(e,{eventId:a,email:o,occurrenceStart:c,quantity:u})}let v=typeof e.requestMeta?.ip==`string`?e.requestMeta.ip.trim():``,y=Date.now();if(Dt(p)){if(!t.http?.fetch)return{ok:!1,error:`TRY_AGAIN`};if(!(await Pe(t.http.fetch.bind(t.http),n,{secret:p.turnstileSecretKey,token:i.turnstileToken,remoteIp:v||null})).ok)return{ok:!1,error:`CHALLENGE_FAILED`}}let b=``;if(!Dt(p)&&v&&(b=await $n(p.hmacSecret,v),await er(f.storage.attendees,n,b,y)))return{ok:!1,error:`RATE_LIMITED`};let x=Tt(p,i.collection);if(!x)return{ok:!1,error:`EVENT_NOT_FOUND`};let S=x===wt(p)[0]?``:x,w=await n.call(()=>t.content.get(x,a));if(!w)return{ok:!1,error:`EVENT_NOT_FOUND`};if(w.status!==`published`)return{ok:!1,error:`EVENT_NOT_PUBLISHED`};if(fe(w))return{ok:!1,error:`EVENT_TICKETED`};let E=w.data??{},{config:D}=await Be(t.storage.attendance_settings,n,w),O=D.capacity;if(!D.enabled)return{ok:!1,error:`RSVP_DISABLED`};if(u>D.maxPerRegistration)return{ok:!1,error:`MAX_QUANTITY_EXCEEDED`,maxAllowed:D.maxPerRegistration};let k=De(D.questions??[],i.answers);if(!k.ok)return{ok:!1,error:`INVALID_ANSWERS`,fields:k.errors};let A=pe(w),j=g(A,c);if(!n.has(4))return{ok:!1,error:`TRY_AGAIN`};let M=l(E,c),N=M&&!M.timezone&&p.defaultTimezone?{...M,timezone:p.defaultTimezone}:M,ee=Math.max(1,Math.min(2,Math.floor((n.remaining-4)/2))),P=await C(f.kv,n,j,{quantity:u,capacity:O,allowWaitlist:D.allowWaitlist,occurrenceStart:c,poolKey:A,maxAttempts:ee,label:String(E.title??``).slice(0,200)||void 0,timezone:N?.timezone});if(!P.ok)return{ok:!1,status:`full`,error:P.reason===`FULL`?`Registration is full for this date.`:`High registration traffic. Please try again in a moment.`};let F=P.status===`waitlist`?P.position:void 0,I=new Date(y).toISOString(),L=await Fe(p.hmacSecret,_,I,a),R=String(E.title??`the event`).slice(0,200),te=P.status===`waitlist`?`wl_${crypto.randomUUID()}`:void 0,ne=1+(P.status===`waitlist`?1:0),re=!!t.email?.send&&n.remaining>=ne+1,ie=!!t.email?.send&&!re,ae=D.requireApproval&&P.status===`going`,z=P.status===`waitlist`?`waitlist`:ae?`pending`:`going`,B=ae?Ue(y,D.approvalHours,N?.startsAt):void 0,oe=!!(D.replyTo||p.replyTo),se={id:_,eventId:a,translationGroup:A,occurrenceStart:c,email:o,displayName:s,status:z,quantity:u,cancelTokenHash:await Le(L),commandId:h,waitlistEntryId:te,waitlistPosition:F,replyTo:D.replyTo||void 0,startsAt:N?.startsAt,allDay:N?.allDay,timezone:N?.timezone,eventTitle:R,locale:m,...S?{collection:S}:{},reminder:N&&!ae?`due`:void 0,...B?{approvalDueAt:B}:{},...ae&&oe?{organiserNotice:`queued`}:{},...ie?{mail:`queued`}:{},...b?{ipHash:b}:{},answers:k.answers.length?k.answers:void 0,retainFrom:N?.startsAt??I,createdAt:I,updatedAt:I};if(!(await n.call(()=>t.storage.attendees.compareAndSet(_,null,se))).applied){if(n.has(2)){let e=Math.max(1,Math.min(3,Math.floor((n.remaining-1)/2)));await T(f.kv,n,j,P.status===`waitlist`?{waitlistCount:u}:{taken:u},e)}let e=n.has(1)?await n.call(()=>f.storage.attendees.get(_)):null;return e?ir(e,{eventId:a,email:o,occurrenceStart:c,quantity:u}):{ok:!1,error:`TRY_AGAIN`}}if(te){let e={id:te,eventId:a,poolKey:A,occurrenceStart:c,attendeeId:_,quantity:u,email:o,displayName:s,eventTitle:R,replyTo:D.replyTo||void 0,locale:m,position:F??0,status:`queued`,startsAt:N?.startsAt,retainFrom:N?.startsAt??c??I,createdAt:I,updatedAt:I};await n.call(()=>t.storage.waitlist_entries.put(te,e))}let de=Mt(t.site?.url??``,p,`cancel`,L),me=N?It(t.site?.url??``,a,c,S,t.plugin?.id):void 0;if(re&&o){let e=z===`pending`?d(B,N?.timezone,mt(m)):void 0,t=zt(await W(f,n,m),{displayName:s,eventTitle:R,status:z,waitlistPosition:F},{cancelUrl:de,calendarUrl:me,deadline:e});await q(f,n,D.replyTo||p.replyTo,{email:o,id:_},t,`RSVP email failed`)}return{ok:!0,attendeeId:_,status:z,...B?{approvalDueAt:B}:{},remaining:P.status===`going`?P.remaining:0,waitlistPosition:F,email:t.email?.send?ie?`queued`:`sent`:`none`,...de?{manageUrl:de}:{}}}}),"rsvp/form":t({public:!0,methods:[`GET`],request:{body:`none`},cacheControl:`no-store`,handler:async(e,t)=>{let n=(new URL(e.request.url).searchParams.get(`eventId`)??``).trim().slice(0,128);if(!n)return{ok:!1,error:`MISSING_EVENT`};let a=new r,o=J(t);await P(o.kv,t.cron,new i(a,4),Yt).catch(()=>`SKIPPED`);let s=await At(o,a),c=Tt(s,new URL(e.request.url).searchParams.get(`collection`));if(!c)return{ok:!1,error:`EVENT_NOT_FOUND`};let l=await a.call(()=>t.content.get(c,n));if(!l||l.status!==`published`)return{ok:!1,error:`EVENT_NOT_FOUND`};if(fe(l))return{ok:!1,error:`EVENT_TICKETED`};let{config:u}=await Be(t.storage.attendance_settings,a,l),d=(new URL(e.request.url).searchParams.get(`occurrence`)??``).trim().slice(0,40),f=u.capacity>0&&a.has(1)?await a.call(()=>o.kv.getVersioned(g(pe(l),d))):null,p=f?y(f.value):null,m=u.capacity>0?Math.max(0,u.capacity-(p?.taken??0)-(p?.held??0)):null;return{ok:!0,open:u.enabled,maxPerRegistration:u.maxPerRegistration,allowWaitlist:u.allowWaitlist,...u.requireApproval?{requiresApproval:!0}:{},seatsLeft:m,full:m===0,questions:u.enabled?u.questions??[]:[],...u.enabled&&Dt(s)?{turnstileSiteKey:s.turnstileSiteKey}:{}}}}),cancel:t({public:!0,methods:[`POST`],request:{body:`json`},handler:async(e,t)=>{let n=new r,i=nr(e.input);if(!R(i))return{ok:!1,error:`INVALID_TOKEN`};let a=J(t),o=await Le(i),s=(await n.call(()=>a.storage.attendees.query({where:{cancelTokenHash:o},limit:1}))).items[0]?.data;if(!s||s.status===`cancelled`)return{ok:!1,error:`ALREADY_CANCELLED_OR_UNKNOWN`};let c=await an(a,n,s);return c.ok?(c.seatsFreed&&n.has(6)&&await tn(a,n,en(s.translationGroup,s.eventId),s.occurrenceStart),{ok:!0,status:`cancelled`,displayName:s.displayName}):{ok:!1,error:c.error}}}),"manage/lookup":t({public:!0,methods:[`POST`],request:{body:`json`},handler:async(e,t)=>Yn(J(t),new r,e.input)}),"waitlist/claim":t({public:!0,methods:[`POST`],request:{body:`json`},handler:async(e,t)=>{let n=await nn(J(t),new r,nr(e.input));return n.ok?{ok:!0,status:n.attendee?.status??`going`,...n.attendee?.approvalDueAt?{approvalDueAt:n.attendee.approvalDueAt}:{},displayName:n.attendee?.displayName}:{ok:!1,error:n.error}}}),[Nt]:t({public:!0,methods:[`GET`],request:{body:`none`},response:`raw`,cacheControl:`public, max-age=300`,handler:async(t,n)=>{let i=new URL(t.request.url),a=(i.searchParams.get(`eventId`)??``).trim().slice(0,128),o=(i.searchParams.get(`occurrence`)??``).trim().slice(0,40),s=()=>e({status:404,headers:{"content-type":`text/plain; charset=utf-8`},body:{kind:`text`,value:`Event not found.`}});if(!a||o&&Number.isNaN(Date.parse(o)))return s();let c=new r,u=Tt(await At(J(n),c),i.searchParams.get(`collection`));if(!u)return s();let d=await c.call(()=>n.content.get(u,a));if(!d||d.status!==`published`)return s();let f=l(d.data??{},o);if(!f)return s();let p=n.content?.getPublicUrl&&c.has(1)?await c.call(()=>n.content.getPublicUrl(u,a)).catch(()=>null):null;return e({status:200,headers:{"content-type":`text/calendar; charset=utf-8`,"content-disposition":`attachment; filename="event.ics"`},body:{kind:`text`,value:Lt(d,f,{occurrenceStart:o,publicUrl:p,host:i.host})}})}}),"roster/download":t({public:!0,methods:[`GET`],request:{body:`none`},response:`raw`,handler:async(t,n)=>{let i=new URL(t.request.url).searchParams.get(`token`),a=await yn(n,new r,i);return e(a?{status:200,headers:{"content-type":a.contentType,"content-disposition":`attachment; filename="${a.filename}"`},body:{kind:`text`,value:a.body}}:{status:404,headers:{"content-type":`text/plain; charset=utf-8`},body:{kind:`text`,value:`This download link is invalid, expired, or has already been used.`}})}}),"roster/export":t({public:!1,permission:`content:edit_any`,methods:[`GET`],request:{body:`none`},response:`raw`,handler:async(t,n)=>{let i=new URL(t.request.url),a=await bn({eventId:i.searchParams.get(`eventId`)||void 0,occurrenceStart:i.searchParams.get(`occurrence`)||i.searchParams.get(`occurrenceStart`)||void 0,format:i.searchParams.get(`format`)===`html`?`html`:`csv`},n,new r);return e({status:200,headers:{"content-type":a.contentType,"content-disposition":`attachment; filename="${a.filename}"`},body:{kind:`text`,value:a.body}})}})}},or=[`rsvp`,`rsvp/form`,`cancel`,`manage/lookup`,`waitlist/claim`,Nt,`roster/download`];for(let t of or){let r=ar.routes[t];if(!r?.handler)continue;let i=r.handler;r.handler=async(a,o)=>{try{return await i(a,o)}catch(i){if(!(i instanceof n))try{await o.log?.error?.(`Attendance public route failed`,{route:t,error:String(i).slice(0,500)})}catch{}return r.response===`raw`?e({status:503,headers:{"content-type":`text/plain; charset=utf-8`,"cache-control":`no-store`},body:{kind:`text`,value:`Temporarily unavailable. Please try again.`}}):{ok:!1,error:`TRY_AGAIN`}}}}export{ar as default,ar as plugin};
@@ -1,95 +1,100 @@
1
- {
2
- "slug": "eventual-attendance",
3
- "publisher": "did:plc:g2hei4vcwndrdl3gdbb6np6c",
4
- "license": "MIT",
5
- "author": { "name": "Jaap Vermeulen", "url": "https://eventual.rsvp/", "email": "support@eventual.rsvp" },
6
- "security": { "email": "security@eventual.rsvp" },
7
- "name": "Eventual RSVP – Registrations",
8
- "description": "Free registration for Eventual RSVP events: places that never overbook, a waiting list, optional approval, reminders and a door list.",
9
- "keywords": ["events", "registration", "rsvp", "waiting list", "check-in"],
10
- "sections": {
11
- "description": { "file": "./docs/registry-description.md" },
12
- "installation": { "file": "./docs/registry-installation.md" },
13
- "changelog": { "file": "./docs/registry-changelog.md" }
14
- },
15
- "repo": "https://github.com/Vermeulen-Solutions/eventual-rsvp-registrations",
16
- "release": {
17
- "requires": { "env:emdash": ">=1.2.0 <2.0.0" },
18
- "artifacts": {
19
- "icon": { "file": "./images/registry/icon-v1.png" },
20
- "banner": { "file": "./images/registry/banner-v1.png" },
21
- "screenshots": [
22
- { "file": "./images/registry/screenshots-v1/1-registration-form.png" },
23
- { "file": "./images/registry/screenshots-v1/2-confirmed.png" },
24
- { "file": "./images/registry/screenshots-v1/3-event-panel.png" },
25
- { "file": "./images/registry/screenshots-v1/4-overview.png" },
26
- { "file": "./images/registry/screenshots-v1/5-registrations.png" },
27
- { "file": "./images/registry/screenshots-v1/6-door-list.png" }
28
- ]
29
- }
30
- },
31
- "capabilities": [
32
- "content:read",
33
- "email:send",
34
- "network:request"
35
- ],
36
- // cdn.jsdelivr.net: language packs, downloaded by the language-packs cron and checked against
37
- // SHA-256 hashes pinned in this bundle.
38
- "allowedHosts": ["challenges.cloudflare.com", "cdn.jsdelivr.net"],
39
- "storage": {
40
- "attendees": {
41
- "indexes": [
42
- "eventId",
43
- ["eventId", "occurrenceStart"],
44
- ["eventId", "status"],
45
- ["eventId", "occurrenceStart", "status"],
46
- "email",
47
- "status",
48
- ["status", "approvalDueAt"],
49
- "organiserNotice",
50
- ["translationGroup", "occurrenceStart"],
51
- ["reminder", "status", "startsAt"],
52
- ["mail", "status"],
53
- "cancelTokenHash",
54
- ["ipHash", "createdAt"],
55
- "createdAt",
56
- "retainFrom"
57
- ]
58
- },
59
- "attendance_settings": {
60
- "indexes": ["eventId"]
61
- },
62
- "waitlist_entries": {
63
- "indexes": [
64
- "eventId",
65
- "poolKey",
66
- ["poolKey", "occurrenceStart"],
67
- ["poolKey", "occurrenceStart", "status"],
68
- ["poolKey", "occurrenceStart", "status", "position"],
69
- "status",
70
- ["status", "offerExpiresAt"],
71
- "offerExpiresAt",
72
- "position",
73
- "claimTokenHash",
74
- "email",
75
- "retainFrom"
76
- ]
77
- }
78
- },
79
- "admin": {
80
- "pages": [
81
- { "path": "/attendance", "label": "Registrations", "icon": "users" },
82
- { "path": "/attendance/roster", "label": "Door list", "icon": "list-checks" },
83
- { "path": "/attendance/settings", "label": "Registration settings", "icon": "settings" }
84
- ],
85
- "widgets": [{ "id": "recent", "title": "Recent registrations", "size": "half" }],
86
- "editorPanels": [
87
- {
88
- "id": "event-attendance",
89
- "title": "Registrations",
90
- "route": "admin/editor/attendance",
91
- "order": 20
92
- }
93
- ]
94
- }
95
- }
1
+ {
2
+ "slug": "eventual-attendance",
3
+ "publisher": "did:plc:g2hei4vcwndrdl3gdbb6np6c",
4
+ "license": "MIT",
5
+ "author": { "name": "Jaap Vermeulen", "url": "https://eventual.rsvp/", "email": "support@eventual.rsvp" },
6
+ "security": { "email": "security@eventual.rsvp" },
7
+ "name": "Eventual RSVP – Registrations",
8
+ "description": "Free registration for Eventual RSVP events: places that never overbook, a waiting list, optional approval, reminders and a door list.",
9
+ "keywords": ["events", "registration", "rsvp", "waiting list", "check-in"],
10
+ "sections": {
11
+ "description": { "file": "./docs/registry-description.md" },
12
+ "installation": { "file": "./docs/registry-installation.md" },
13
+ "changelog": { "file": "./docs/registry-changelog.md" }
14
+ },
15
+ // No "repo": the registry package profile is still linked to the old address
16
+ // (github.com/Vermeulen-Solutions/eventual-attendance) and emdash-plugin publish refuses any
17
+ // other one. Publish with git hidden (GIT_DIR=none) so the CLI does not take the origin remote.
18
+ "release": {
19
+ "requires": { "env:emdash": ">=1.2.0 <2.0.0" },
20
+ "artifacts": {
21
+ "icon": { "file": "./images/registry/icon-v1.png" },
22
+ "banner": { "file": "./images/registry/banner-v1.png" },
23
+ "screenshots": [
24
+ { "file": "./images/registry/screenshots-v1/1-registration-form.png" },
25
+ { "file": "./images/registry/screenshots-v1/2-confirmed.png" },
26
+ { "file": "./images/registry/screenshots-v1/3-event-panel.png" },
27
+ { "file": "./images/registry/screenshots-v1/4-overview.png" },
28
+ { "file": "./images/registry/screenshots-v1/5-registrations.png" },
29
+ { "file": "./images/registry/screenshots-v1/6-door-list.png" }
30
+ ]
31
+ }
32
+ },
33
+ "capabilities": [
34
+ "content:read",
35
+ "email:send",
36
+ "network:request",
37
+ // Read-only: lets the event panel see whether an event collection has the capacity fields,
38
+ // also on an entry where they are still empty (EmDash leaves empty fields out of its data).
39
+ "schema:read"
40
+ ],
41
+ // cdn.jsdelivr.net: language packs, downloaded by the language-packs cron and checked against
42
+ // SHA-256 hashes pinned in this bundle.
43
+ "allowedHosts": ["challenges.cloudflare.com", "cdn.jsdelivr.net"],
44
+ "storage": {
45
+ "attendees": {
46
+ "indexes": [
47
+ "eventId",
48
+ ["eventId", "occurrenceStart"],
49
+ ["eventId", "status"],
50
+ ["eventId", "occurrenceStart", "status"],
51
+ "email",
52
+ "status",
53
+ ["status", "approvalDueAt"],
54
+ "organiserNotice",
55
+ ["translationGroup", "occurrenceStart"],
56
+ ["reminder", "status", "startsAt"],
57
+ ["mail", "status"],
58
+ "cancelTokenHash",
59
+ ["ipHash", "createdAt"],
60
+ "createdAt",
61
+ "retainFrom"
62
+ ]
63
+ },
64
+ "attendance_settings": {
65
+ "indexes": ["eventId"]
66
+ },
67
+ "waitlist_entries": {
68
+ "indexes": [
69
+ "eventId",
70
+ "poolKey",
71
+ ["poolKey", "occurrenceStart"],
72
+ ["poolKey", "occurrenceStart", "status"],
73
+ ["poolKey", "occurrenceStart", "status", "position"],
74
+ "status",
75
+ ["status", "offerExpiresAt"],
76
+ "offerExpiresAt",
77
+ "position",
78
+ "claimTokenHash",
79
+ "email",
80
+ "retainFrom"
81
+ ]
82
+ }
83
+ },
84
+ "admin": {
85
+ "pages": [
86
+ { "path": "/attendance", "label": "Registrations", "icon": "users" },
87
+ { "path": "/attendance/roster", "label": "Door list", "icon": "list-checks" },
88
+ { "path": "/attendance/settings", "label": "Registration settings", "icon": "settings" }
89
+ ],
90
+ "widgets": [{ "id": "recent", "title": "Recent registrations", "size": "half" }],
91
+ "editorPanels": [
92
+ {
93
+ "id": "event-attendance",
94
+ "title": "Registrations",
95
+ "route": "admin/editor/attendance",
96
+ "order": 20
97
+ }
98
+ ]
99
+ }
100
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vermeulen.solutions/eventual-attendance",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "homepage": "https://eventual.rsvp/registrations/",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@emdash-cms/blocks": "1.4.0",
57
- "@vermeulen.solutions/eventual-locales": "0.1.10",
57
+ "@vermeulen.solutions/eventual-locales": "0.1.11",
58
58
  "zod": "4.5.4"
59
59
  }
60
60
  }