function WeddingKeepsakeBuilder(props) {
    const model = window.WeddingKeepsakeModel?.models?.[props.template?.id];
    if (!model)
        return React.createElement("main", { className: "section builder-load-state" },
            React.createElement("div", { className: "wrap" },
                React.createElement("h1", null, "This invitation could not open"),
                React.createElement("p", null, "Refresh the page and try again.")));
    return React.createElement(ApologyEditor, { ...props, model: model, mode: "wedding" });
}
function WeddingKeepsakeFields({ model, section, draft, field, update, disabled }) {
    const text = (label, path, options = {}) => field(label, path.split('.'), options);
    const paragraph = (label, path, limit = 2000, hint = '') => text(label, path, { multiline: true, limit, hint, rows: 4 });
    const items = (path, label, limit, blank, render) => {
        const keys = path.split('.');
        const rows = keys.reduce((value, key) => value?.[key], draft) || [];
        const remove = index => update(keys, rows.filter((_, position) => position !== index));
        const move = (index, delta) => {
            const next = rows.slice();
            [next[index], next[index + delta]] = [next[index + delta], next[index]];
            update(keys, next);
        };
        return React.createElement("div", { className: "keepsake-editor-list" },
            rows.length === 0 && React.createElement("p", { className: "ap-builder-quiet-note" },
                "No ",
                label.toLowerCase(),
                " added yet. Add only the details you want your guests to see."),
            rows.map((row, index) => React.createElement("section", { className: "keepsake-editor-item", key: row.id || index, "aria-label": label + ' ' + (index + 1) },
                React.createElement("div", { className: "keepsake-editor-item-heading" },
                    React.createElement("h4", null,
                        label,
                        " ",
                        index + 1),
                    React.createElement("div", null,
                        React.createElement("button", { type: "button", disabled: disabled || index === 0, onClick: () => move(index, -1), "aria-label": 'Move ' + label.toLowerCase() + ' ' + (index + 1) + ' earlier' }, "Move up"),
                        React.createElement("button", { type: "button", disabled: disabled || index === rows.length - 1, onClick: () => move(index, 1), "aria-label": 'Move ' + label.toLowerCase() + ' ' + (index + 1) + ' later' }, "Move down"),
                        React.createElement("button", { type: "button", disabled: disabled, onClick: () => remove(index), "aria-label": 'Remove ' + label.toLowerCase() + ' ' + (index + 1) }, "Remove"))),
                render(keys.concat(index), row, index))),
            React.createElement("button", { className: "btn btn-secondary", type: "button", disabled: disabled || rows.length >= limit, onClick: () => update(keys, [...rows, blank()]) },
                "Add ",
                label.toLowerCase()),
            React.createElement("small", null,
                rows.length,
                " of ",
                limit,
                " ",
                label.toLowerCase(),
                " entries"));
    };
    switch (section.id) {
        case 'opening': return React.createElement("p", { className: "ap-builder-quiet-note" }, "Use the section choices to include the opening animation. When it is off, your invitation opens directly on your names.");
        case 'photos': return null;
        case 'couple':
            return React.createElement(React.Fragment, null,
                text("Bride's name", 'couple.bride', { limit: 80, placeholder: 'Bride’s name' }),
                text("Groom's name", 'couple.groom', { limit: 80, placeholder: 'Groom’s name' }),
                text('Wedding date', 'couple.date', { type: 'date' }),
                text('Ceremony time', 'couple.time', { type: 'time' }),
                text('Time zone', 'couple.timezone', { limit: 80, placeholder: 'Asia/Kolkata', hint: 'Use a time zone such as Asia/Kolkata or Europe/London. The countdown and calendar use this zone.' }),
                text('Wedding hashtag (optional)', 'couple.hashtag', { limit: 100, placeholder: '#YourWedding' }));
        case 'date':
            return React.createElement(React.Fragment, null,
                text('Wedding date', 'couple.date', { type: 'date' }),
                text('Ceremony time', 'couple.time', { type: 'time' }),
                text('Time zone', 'couple.timezone', { limit: 80, placeholder: 'Asia/Kolkata' }));
        case 'invite':
            return React.createElement(React.Fragment, null,
                text('Opening blessing', 'invite.blessing', { limit: 240, placeholder: 'Together with our families' }),
                paragraph('Invitation wording', 'invite.text'),
                text('Bride’s family', 'invite.brideFamily', { limit: 240 }),
                text('Groom’s family', 'invite.groomFamily', { limit: 240 }));
        case 'venue':
            return React.createElement(React.Fragment, null,
                text('Venue name', 'venue.name', { limit: 180 }),
                text('City / region', 'venue.city', { limit: 180 }),
                paragraph('Venue address', 'venue.address', 500),
                text('Directions link (optional)', 'venue.mapsLink', { type: 'url', limit: 2000, placeholder: 'https://maps.google.com/…' }),
                paragraph('A note about the venue', 'venue.note'),
                text('Illustration caption', 'venue.illustrationCaption', { limit: 240, hint: 'The venue artwork belongs to this design. Describe it as an illustration, rather than a photograph of your venue.' }));
        case 'events':
            return items('events', 'Celebration', 12, () => ({ id: 'event-' + (globalThis.crypto?.randomUUID?.() || Date.now().toString(36) + Math.random().toString(36).slice(2)), name: '', date: '', time: '', venue: '', desc: '', dress: '', mapsLink: '' }), path => React.createElement(React.Fragment, null,
                field('Celebration name', [...path, 'name'], { limit: 180, placeholder: 'Haldi, wedding ceremony, reception…' }),
                field('Celebration date', [...path, 'date'], { type: 'date' }),
                field('Celebration time', [...path, 'time'], { limit: 80, placeholder: '6:00 PM onwards' }),
                field('Celebration venue', [...path, 'venue'], { limit: 180 }),
                field('Celebration details', [...path, 'desc'], { multiline: true, limit: 2000 }),
                field('Dress guidance', [...path, 'dress'], { multiline: true, limit: 500 }),
                field('Celebration directions link', [...path, 'mapsLink'], { type: 'url', limit: 2000 })));
        case 'story':
            return React.createElement(React.Fragment, null,
                text('Story heading', 'story.heading', { limit: 180 }),
                paragraph('Your story', 'story.text', 4000),
                paragraph('Story ending', 'story.ending', 500),
                items('story.items', 'Story moment', 8, () => ({ year: '', title: '', text: '' }), path => React.createElement(React.Fragment, null,
                    field('Moment date or year', [...path, 'year'], { limit: 80 }),
                    field('Moment title', [...path, 'title'], { limit: 180 }),
                    field('What happened', [...path, 'text'], { multiline: true, limit: 2000 }))));
        case 'details':
            return React.createElement(React.Fragment, null,
                paragraph('Attire guidance', 'details.attire'),
                paragraph('Arrival and transport', 'details.arrival'),
                paragraph('Accommodation', 'details.stay'),
                paragraph('Gifts and other guest notes', 'details.gifts'));
        case 'rsvp':
            return React.createElement(React.Fragment, null,
                text('Reply heading', 'rsvp.heading', { limit: 180 }),
                paragraph('Reply invitation', 'rsvp.subtext', 1000),
                text('Reply deadline (optional)', 'rsvp.deadline', { type: 'date' }),
                React.createElement("p", { className: "ap-builder-quiet-note" }, "After you publish, replies from your personal invitation link appear in your dashboard. Preview replies are not sent."));
        case 'timeline':
            return items('timeline', 'Wedding-day moment', 8, () => ({ time: '', title: '', note: '' }), path => React.createElement(React.Fragment, null,
                field('Moment time', [...path, 'time'], { limit: 80 }),
                field('Moment name', [...path, 'title'], { limit: 180 }),
                field('Moment details', [...path, 'note'], { multiline: true, limit: 2000 })));
        case 'brunch':
            return React.createElement(React.Fragment, null,
                text('Brunch date', 'brunch.date', { type: 'date' }),
                text('Brunch time', 'brunch.time', { type: 'time' }),
                text('Brunch venue', 'brunch.place', { limit: 180 }),
                paragraph('Brunch address', 'brunch.address', 500),
                text('Brunch directions link', 'brunch.mapsLink', { type: 'url', limit: 2000 }));
        case 'closing': return paragraph('Closing note', 'closing.line', 500);
        default: return React.createElement("p", null, "Choose a section to edit your invitation.");
    }
}
Object.assign(window, { WeddingKeepsakeBuilder, WeddingKeepsakeFields });
