fix: flat absolute routes + declare api.cal.com egress (2.0.7)

Register the chi routes as flat absolute paths (httpBase+"/slots" …)
instead of a nested r.Route mount: the wasm host forwards the full
original path with no prefix strip, so the nested mount's RoutePath
rebasing never matched and 404'd the entire HTTP surface.

Declare allowed_hosts = ["api.cal.com"] so the ADR-0023 install consent
dialog asks the admin to grant egress; without it every Cal.com call was
denied at runtime (ABI_ERROR_CODE_EGRESS_DENIED, no egress grant).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Alex Dunmow 2026-07-09 09:38:31 +08:00
parent 5a138b9ac8
commit bd7f9fad15
24 changed files with 142842 additions and 131665 deletions

View File

@ -300,34 +300,34 @@ func NewCalcomRouter(deps plugin.CoreServices) http.Handler {
h.blockConfig = publishedBlockResolver{source: deps.Content} h.blockConfig = publishedBlockResolver{source: deps.Content}
} }
// Routes are registered ABSOLUTE: the wasm host forwards the full request // Routes are registered ABSOLUTE on a flat chi router: the wasm host forwards
// path (no prefix strip), so relative registrations never match — the // the FULL original path (r.URL.Path, no prefix strip), so the guest matches
// 2.0.02.0.2 regression that 404'd the plugin's entire HTTP surface. // on the complete path. A nested r.Route(httpBase, …) instead relies on chi
// Mirrors testplugin's httpBase convention. // Mount's RoutePath rebasing, which the raw-path forwarder never populates —
r.Route(httpBase, func(r chi.Router) { // mirror testplugin's httpBase convention (flat + absolute) so the surface
// Public booking endpoints — reachable by anonymous visitors. // resolves regardless of how the host mounts the forwarder.
r.Get("/slots", h.HandleGetSlots) // Public booking endpoints — reachable by anonymous visitors.
r.Get("/form", h.HandleGetForm) r.Get(httpBase+"/slots", h.HandleGetSlots)
r.Post("/book", h.HandleCreateBooking) r.Get(httpBase+"/form", h.HandleGetForm)
r.Post("/cancel", h.HandleCancelBooking) r.Post(httpBase+"/book", h.HandleCreateBooking)
r.Get("/reset", h.HandleReset) r.Post(httpBase+"/cancel", h.HandleCancelBooking)
r.Get("/date-grid", h.HandleGetDateGrid) r.Get(httpBase+"/reset", h.HandleReset)
r.Get(httpBase+"/date-grid", h.HandleGetDateGrid)
// Webhook receiver — HMAC-verified inside the handler, so no admin gate. // Webhook receiver — HMAC-verified inside the handler, so no admin gate.
wh := NewWebhookHandler(settings, slog.Default()) wh := NewWebhookHandler(settings, slog.Default())
r.Post("/webhook", wh.Handle) r.Post(httpBase+"/webhook", wh.Handle)
// Admin endpoints — gated by requireAdmin. The plugin HTTP mount has no // Admin endpoints — gated by requireAdmin. The plugin HTTP mount has no
// outer admin middleware, so this is the only line keeping the API key // outer admin middleware, so this is the only line keeping the API key
// + webhook secret + Cal.com proxy out of attackers' hands. // + webhook secret + Cal.com proxy out of attackers' hands.
r.Group(func(admin chi.Router) { r.Group(func(admin chi.Router) {
admin.Use(requireAdmin) admin.Use(requireAdmin)
admin.Get("/settings", h.HandleGetSettings) admin.Get(httpBase+"/settings", h.HandleGetSettings)
admin.Post("/settings", h.HandleSaveSettings) admin.Post(httpBase+"/settings", h.HandleSaveSettings)
admin.Post("/settings/rotate-webhook-secret", h.HandleRotateWebhookSecret) admin.Post(httpBase+"/settings/rotate-webhook-secret", h.HandleRotateWebhookSecret)
admin.Post("/test", h.HandleTestConnection) admin.Post(httpBase+"/test", h.HandleTestConnection)
admin.Get("/event-types", h.HandleListEventTypes) admin.Get(httpBase+"/event-types", h.HandleListEventTypes)
})
}) })
return r return r

View File

@ -8,3 +8,4 @@ kind = "plugin"
categories = ["forms"] categories = ["forms"]
tags = ["calcom", "booking", "calendar", "scheduling", "appointments"] tags = ["calcom", "booking", "calendar", "scheduling", "appointments"]
private = true private = true
allowed_hosts = ["api.cal.com"]

View File

@ -1,351 +1,573 @@
import { importShared } from './__federation_fn_import-hlt2XzeI.js'; import { importShared } from "./__federation_fn_import-hlt2XzeI.js";
import { j as jsxRuntimeExports } from './jsx-runtime-CvJTHeKY.js'; import { j as jsxRuntimeExports } from "./jsx-runtime-CvJTHeKY.js";
const {useCallback,useEffect,useState} = await importShared('react'); const { useCallback, useEffect, useState } = await importShared("react");
const {Alert,AlertDescription,Button,Card,CardContent,CardDescription,CardHeader,CardTitle,Tabs,TabsContent,TabsList,TabsTrigger,Input,Label,Textarea,Switch,Select,SelectContent,SelectItem,SelectTrigger,SelectValue,Settings,Edit3,CheckCircle2,XCircle,Loader2,Key,AlertCircle,ExternalLink,RefreshCw,t} = await importShared('@block-ninja/ui'); const {
Alert,
AlertDescription,
Button,
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
Tabs,
TabsContent,
TabsList,
TabsTrigger,
Input,
Label,
Textarea,
Switch,
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
Settings,
Edit3,
CheckCircle2,
XCircle,
Loader2,
Key,
AlertCircle,
ExternalLink,
RefreshCw,
t,
} = await importShared("@block-ninja/ui");
function renderConnectedAccount(apiKeyConfigured, calcomUsername) { function renderConnectedAccount(apiKeyConfigured, calcomUsername) {
if (apiKeyConfigured === false) { if (apiKeyConfigured === false) {
return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: t("calcom.editor.connectedAs.noKey", "Configure the API key in plugin settings to connect an account.") }); return /* @__PURE__ */ jsxRuntimeExports.jsx("p", {
} className: "text-xs text-muted-foreground",
if (calcomUsername) { children: t("calcom.editor.connectedAs.noKey", "Configure the API key in plugin settings to connect an account."),
return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm font-mono", children: calcomUsername }); });
} }
return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: t("calcom.editor.connectedAs.resolving", "Resolving account from API key…") }); if (calcomUsername) {
return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm font-mono", children: calcomUsername });
}
return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: t("calcom.editor.connectedAs.resolving", "Resolving account from API key…") });
} }
function CalcomBlockEditor({ content, onChange }) { function CalcomBlockEditor({ content, onChange }) {
const [activeTab, setActiveTab] = useState("config"); const [activeTab, setActiveTab] = useState("config");
const [apiKeyConfigured, setApiKeyConfigured] = useState(null); const [apiKeyConfigured, setApiKeyConfigured] = useState(null);
const [calcomUsername, setCalcomUsername] = useState(""); const [calcomUsername, setCalcomUsername] = useState("");
const [eventTypes, setEventTypes] = useState([]); const [eventTypes, setEventTypes] = useState([]);
const [loadingEventTypes, setLoadingEventTypes] = useState(false); const [loadingEventTypes, setLoadingEventTypes] = useState(false);
const [fetchFailed, setFetchFailed] = useState(false); const [fetchFailed, setFetchFailed] = useState(false);
const [retryCounter, setRetryCounter] = useState(0); const [retryCounter, setRetryCounter] = useState(0);
const handleFieldChange = useCallback( const handleFieldChange = useCallback(
(field, value) => { (field, value) => {
onChange({ ...content, [field]: value }); onChange({ ...content, [field]: value });
}, },
[content, onChange] [content, onChange],
); );
const getString = (field, defaultValue = "") => { const getString = (field, defaultValue = "") => {
return content[field] || defaultValue; return content[field] || defaultValue;
}; };
const getNumber = (field, defaultValue = 0) => { const getNumber = (field, defaultValue = 0) => {
const val = content[field]; const val = content[field];
if (typeof val === "number") return val; if (typeof val === "number") return val;
if (typeof val === "string") return parseInt(val, 10) || defaultValue; if (typeof val === "string") return parseInt(val, 10) || defaultValue;
return defaultValue; return defaultValue;
}; };
const getBool = (field, defaultValue = false) => { const getBool = (field, defaultValue = false) => {
const val = content[field]; const val = content[field];
if (typeof val === "boolean") return val; if (typeof val === "boolean") return val;
return defaultValue; return defaultValue;
}; };
const eventTypeSlug = getString("eventTypeSlug"); const eventTypeSlug = getString("eventTypeSlug");
useEffect(() => { useEffect(() => {
fetch(`/api/plugins/calcomblock/settings`).then((r) => r.json()).then((d) => { fetch(`/api/plugins/calcomblock/settings`)
setApiKeyConfigured(!!d.api_key_configured); .then((r) => r.json())
setCalcomUsername(d.username ?? ""); .then((d) => {
}).catch(() => setApiKeyConfigured(false)); setApiKeyConfigured(!!d.api_key_configured);
}, []); setCalcomUsername(d.username ?? "");
useEffect(() => { })
if (calcomUsername && content.username !== calcomUsername) { .catch(() => setApiKeyConfigured(false));
onChange({ ...content, username: calcomUsername }); }, []);
} useEffect(() => {
}, [calcomUsername, content, onChange]); if (calcomUsername && content.username !== calcomUsername) {
useEffect(() => { onChange({ ...content, username: calcomUsername });
if (!apiKeyConfigured) { }
setEventTypes([]); }, [calcomUsername, content, onChange]);
setFetchFailed(false); useEffect(() => {
return; if (!apiKeyConfigured) {
} setEventTypes([]);
const timer = setTimeout(() => { setFetchFailed(false);
setLoadingEventTypes(true); return;
setFetchFailed(false); }
fetch(`/api/plugins/calcomblock/event-types?username=${encodeURIComponent(calcomUsername)}`).then((r) => r.json()).then((d) => { const timer = setTimeout(() => {
if (d.success) { setLoadingEventTypes(true);
setEventTypes(d.event_types ?? []); setFetchFailed(false);
} else { fetch(`/api/plugins/calcomblock/event-types?username=${encodeURIComponent(calcomUsername)}`)
setEventTypes([]); .then((r) => r.json())
setFetchFailed(true); .then((d) => {
} if (d.success) {
}).catch(() => { setEventTypes(d.event_types ?? []);
setEventTypes([]); } else {
setFetchFailed(true); setEventTypes([]);
}).finally(() => setLoadingEventTypes(false)); setFetchFailed(true);
}, 300); }
return () => clearTimeout(timer); })
}, [apiKeyConfigured, calcomUsername, retryCounter]); .catch(() => {
const handleRetry = useCallback(() => { setEventTypes([]);
setRetryCounter((n) => n + 1); setFetchFailed(true);
}, []); })
const selectPlaceholder = (() => { .finally(() => setLoadingEventTypes(false));
if (apiKeyConfigured === false) { }, 300);
return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "inline-flex items-center gap-1.5 text-muted-foreground", children: [ return () => clearTimeout(timer);
/* @__PURE__ */ jsxRuntimeExports.jsx(Key, { className: "h-3 w-3" }), }, [apiKeyConfigured, calcomUsername, retryCounter]);
t("calcom.editor.eventType.placeholder.noApiKey", "Configure API key first") const handleRetry = useCallback(() => {
] }); setRetryCounter((n) => n + 1);
} }, []);
if (loadingEventTypes) { const selectPlaceholder = (() => {
return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "inline-flex items-center gap-1.5 text-muted-foreground", children: [ if (apiKeyConfigured === false) {
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-3 w-3 animate-spin" }), return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
t("calcom.editor.eventType.placeholder.loading", "Loading…") className: "inline-flex items-center gap-1.5 text-muted-foreground",
] }); children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Key, { className: "h-3 w-3" }), t("calcom.editor.eventType.placeholder.noApiKey", "Configure API key first")],
} });
if (!calcomUsername) { }
return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "inline-flex items-center gap-1.5 text-muted-foreground", children: [ if (loadingEventTypes) {
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-3 w-3 animate-spin" }), return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
t("calcom.editor.eventType.placeholder.resolvingUser", "Resolving account…") className: "inline-flex items-center gap-1.5 text-muted-foreground",
] }); children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-3 w-3 animate-spin" }), t("calcom.editor.eventType.placeholder.loading", "Loading…")],
} });
if (eventTypes.length === 0) { }
return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "inline-flex items-center gap-1.5 text-muted-foreground", children: [ if (!calcomUsername) {
/* @__PURE__ */ jsxRuntimeExports.jsx(XCircle, { className: "h-3 w-3" }), return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
t("calcom.editor.eventType.placeholder.noEventTypes", "No event types found") className: "inline-flex items-center gap-1.5 text-muted-foreground",
] }); children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-3 w-3 animate-spin" }), t("calcom.editor.eventType.placeholder.resolvingUser", "Resolving account…")],
} });
return t("calcom.editor.eventType.placeholder.select", "Select event type"); }
})(); if (eventTypes.length === 0) {
const apiKeyReady = apiKeyConfigured === true; return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
const usernameReady = calcomUsername.length > 0; className: "inline-flex items-center gap-1.5 text-muted-foreground",
const eventTypeReady = eventTypeSlug.length > 0; children: [/* @__PURE__ */ jsxRuntimeExports.jsx(XCircle, { className: "h-3 w-3" }), t("calcom.editor.eventType.placeholder.noEventTypes", "No event types found")],
const canOpenInCalcom = usernameReady && eventTypeReady; });
const renderStatusRow = (ok, label, action) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [ }
ok ? /* @__PURE__ */ jsxRuntimeExports.jsx(CheckCircle2, { className: "h-4 w-4 text-primary", "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(XCircle, { className: "h-4 w-4 text-destructive", "aria-hidden": "true" }), return t("calcom.editor.eventType.placeholder.select", "Select event type");
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: ok ? "text-foreground" : "text-muted-foreground", children: label }), })();
action ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-auto", children: action }) : null const apiKeyReady = apiKeyConfigured === true;
] }); const usernameReady = calcomUsername.length > 0;
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { value: activeTab, onValueChange: setActiveTab, children: [ const eventTypeReady = eventTypeSlug.length > 0;
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "grid w-full grid-cols-2", children: [ const canOpenInCalcom = usernameReady && eventTypeReady;
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "config", className: "gap-2", children: [ const renderStatusRow = (ok, label, action) =>
/* @__PURE__ */ jsxRuntimeExports.jsx(Settings, { className: "h-4 w-4" }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t("calcom.editor.tab.configuration", "Configuration") }) className: "flex items-center gap-2 text-sm",
] }), children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "content", className: "gap-2", children: [ ok ?
/* @__PURE__ */ jsxRuntimeExports.jsx(Edit3, { className: "h-4 w-4" }), /* @__PURE__ */ jsxRuntimeExports.jsx(CheckCircle2, { "className": "h-4 w-4 text-primary", "aria-hidden": "true" })
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t("calcom.editor.tab.content", "Content") }) : /* @__PURE__ */ jsxRuntimeExports.jsx(XCircle, { "className": "h-4 w-4 text-destructive", "aria-hidden": "true" }),
] }) /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: ok ? "text-foreground" : "text-muted-foreground", children: label }),
] }), action ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-auto", children: action }) : null,
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsContent, { value: "config", className: "space-y-4 mt-4", children: [ ],
apiKeyConfigured === false && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDescription, { children: [ });
t("calcom.editor.alert.apiKeyMissing.prefix", "Configure your Cal.com API key in"), return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
" ", className: "space-y-4",
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "/admin/plugins?plugin=calcomblock", className: "text-primary hover:underline", children: t("calcom.editor.alert.apiKeyMissing.linkLabel", "plugin settings") }), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, {
" ", value: activeTab,
t("calcom.editor.alert.apiKeyMissing.suffix", "to enable the event-type dropdown.") onValueChange: setActiveTab,
] }) }), children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { children: [ /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, {
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, { children: [ className: "grid w-full grid-cols-2",
/* @__PURE__ */ jsxRuntimeExports.jsx(CardTitle, { className: "text-base", children: t("calcom.editor.section.config.title", "Cal.com Settings") }), children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(CardDescription, { children: t("calcom.editor.section.config.description", "Connect to your Cal.com account and select an event type") }) /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, {
] }), value: "config",
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, { className: "space-y-4", children: [ className: "gap-2",
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { children: t("calcom.editor.connectedAs.label", "Connected Account") }), /* @__PURE__ */ jsxRuntimeExports.jsx(Settings, { className: "h-4 w-4" }),
renderConnectedAccount(apiKeyConfigured, calcomUsername) /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t("calcom.editor.tab.configuration", "Configuration") }),
] }), ],
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ }),
/* @__PURE__ */ jsxRuntimeExports.jsxs(Label, { htmlFor: "eventTypeSlug", children: [ /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, {
t("calcom.editor.eventType.label", "Event Type"), value: "content",
" ", className: "gap-2",
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-destructive", children: "*" }) children: [
] }), /* @__PURE__ */ jsxRuntimeExports.jsx(Edit3, { className: "h-4 w-4" }),
fetchFailed ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t("calcom.editor.tab.content", "Content") }),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [ ],
/* @__PURE__ */ jsxRuntimeExports.jsx( }),
Input, ],
{ }),
id: "eventTypeSlug", /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsContent, {
value: eventTypeSlug, value: "config",
onChange: (e) => handleFieldChange("eventTypeSlug", e.target.value), className: "space-y-4 mt-4",
placeholder: t("calcom.editor.eventType.fallbackPlaceholder", "30min"), children: [
className: "flex-1" apiKeyConfigured === false &&
} /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, {
), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDescription, {
/* @__PURE__ */ jsxRuntimeExports.jsxs( children: [
Button, t("calcom.editor.alert.apiKeyMissing.prefix", "Configure your Cal.com API key in"),
{ " ",
type: "button", /* @__PURE__ */ jsxRuntimeExports.jsx("a", {
size: "sm", href: "/admin/plugins?plugin=calcomblock",
variant: "outline", className: "text-primary hover:underline",
action: "retry", children: t("calcom.editor.alert.apiKeyMissing.linkLabel", "plugin settings"),
entity: "event-types", }),
onClick: handleRetry, " ",
disabled: loadingEventTypes, t("calcom.editor.alert.apiKeyMissing.suffix", "to enable the event-type dropdown."),
"aria-label": t("calcom.editor.eventType.retryAria", "Retry loading event types"), ],
children: [ }),
/* @__PURE__ */ jsxRuntimeExports.jsx(RefreshCw, { className: `h-4 w-4 ${loadingEventTypes ? "animate-spin" : ""}`, "aria-hidden": "true" }), }),
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-1", children: t("calcom.editor.eventType.retryLabel", "Retry") }) /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, {
] children: [
} /* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, {
) children: [
] }), /* @__PURE__ */ jsxRuntimeExports.jsx(CardTitle, { className: "text-base", children: t("calcom.editor.section.config.title", "Cal.com Settings") }),
/* @__PURE__ */ jsxRuntimeExports.jsxs(Alert, { variant: "destructive", children: [ /* @__PURE__ */ jsxRuntimeExports.jsx(CardDescription, {
/* @__PURE__ */ jsxRuntimeExports.jsx(AlertCircle, { className: "h-4 w-4", "aria-hidden": "true" }), children: t("calcom.editor.section.config.description", "Connect to your Cal.com account and select an event type"),
/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDescription, { children: t("calcom.editor.eventType.fetchFailed", "Couldn't load event types from Cal.com. Enter the slug manually or retry.") }) }),
] }) ],
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ }),
/* @__PURE__ */ jsxRuntimeExports.jsxs( /* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, {
Select, className: "space-y-4",
{ children: [
value: eventTypeSlug, /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
onValueChange: (v) => handleFieldChange("eventTypeSlug", v), className: "space-y-2",
disabled: loadingEventTypes || !apiKeyConfigured || eventTypes.length === 0, children: [
children: [ /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { children: t("calcom.editor.connectedAs.label", "Connected Account") }),
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { "aria-label": t("calcom.editor.eventType.label", "Event Type"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: selectPlaceholder }) }), renderConnectedAccount(apiKeyConfigured, calcomUsername),
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, { children: eventTypes.map((et) => /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectItem, { value: et.slug, children: [ ],
et.title, }),
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-muted-foreground", children: [ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
" ", className: "space-y-2",
"(", children: [
et.slug, /* @__PURE__ */ jsxRuntimeExports.jsxs(Label, {
" · ", htmlFor: "eventTypeSlug",
et.lengthInMinutes, children: [
"m)" t("calcom.editor.eventType.label", "Event Type"),
] }) " ",
] }, et.id)) }) /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-destructive", children: "*" }),
] ],
} }),
), fetchFailed ?
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: t("calcom.editor.eventType.help", "Fetched from your Cal.com account") }) /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
] }) children: [
] }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ className: "flex items-center gap-2",
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "weeksToShow", children: t("calcom.editor.weeksToShow.label", "Weeks to Display") }), children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: String(getNumber("weeksToShow", 2)), onValueChange: (v) => handleFieldChange("weeksToShow", parseInt(v, 10)), children: [ /* @__PURE__ */ jsxRuntimeExports.jsx(Input, {
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { "aria-label": t("calcom.editor.weeksToShow.label", "Weeks to Display"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: t("calcom.editor.weeksToShow.placeholder", "Select weeks") }) }), id: "eventTypeSlug",
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, { children: [1, 2, 3, 4, 5, 6, 7, 8].map((n) => /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectItem, { value: String(n), children: [ value: eventTypeSlug,
n, onChange: (e) => handleFieldChange("eventTypeSlug", e.target.value),
" ", placeholder: t("calcom.editor.eventType.fallbackPlaceholder", "30min"),
n > 1 ? t("calcom.editor.weeksToShow.unitPlural", "weeks") : t("calcom.editor.weeksToShow.unitSingular", "week") className: "flex-1",
] }, n)) }) }),
] }), /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, {
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: t("calcom.editor.weeksToShow.help", "How many weeks of dates to show in the calendar") }) "type": "button",
] }), "size": "sm",
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded-lg border p-3", children: [ "variant": "outline",
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-0.5", children: [ "action": "retry",
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { children: t("calcom.editor.showTimezone.label", "Show Timezone Selector") }), "entity": "event-types",
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: t("calcom.editor.showTimezone.help", "Show a label above the date grid indicating which timezone times are displayed in.") }) "onClick": handleRetry,
] }), "disabled": loadingEventTypes,
/* @__PURE__ */ jsxRuntimeExports.jsx( "aria-label": t("calcom.editor.eventType.retryAria", "Retry loading event types"),
Switch, "children": [
{ /* @__PURE__ */ jsxRuntimeExports.jsx(RefreshCw, {
checked: getBool("showTimezone", true), "className": `h-4 w-4 ${loadingEventTypes ? "animate-spin" : ""}`,
onCheckedChange: (v) => handleFieldChange("showTimezone", v), "aria-hidden": "true",
"aria-label": t("calcom.editor.showTimezone.label", "Show Timezone Selector") }),
} /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
) className: "ml-1",
] }), children: t("calcom.editor.eventType.retryLabel", "Retry"),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded-lg border p-3", children: [ }),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-0.5", children: [ ],
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { children: t("calcom.editor.captchaEnabled.label", "Enable captcha") }), }),
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: t("calcom.editor.captchaEnabled.help", "Require visitors to solve a privacy-friendly proof-of-work captcha before booking (spam protection).") }) ],
] }), }),
/* @__PURE__ */ jsxRuntimeExports.jsx( /* @__PURE__ */ jsxRuntimeExports.jsxs(Alert, {
Switch, variant: "destructive",
{ children: [
checked: getBool("captchaEnabled", false), /* @__PURE__ */ jsxRuntimeExports.jsx(AlertCircle, { "className": "h-4 w-4", "aria-hidden": "true" }),
onCheckedChange: (v) => handleFieldChange("captchaEnabled", v), /* @__PURE__ */ jsxRuntimeExports.jsx(AlertDescription, {
"aria-label": t("calcom.editor.captchaEnabled.label", "Enable captcha") children: t("calcom.editor.eventType.fetchFailed", "Couldn't load event types from Cal.com. Enter the slug manually or retry."),
} }),
) ],
] }) }),
] }) ],
] }), })
/* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { children: [ : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, { children: [ children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(CardTitle, { className: "text-base", children: t("calcom.editor.status.title", "Configuration status") }), /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, {
/* @__PURE__ */ jsxRuntimeExports.jsx(CardDescription, { children: t("calcom.editor.status.description", "Quick check of the values needed before this block renders bookings.") }) value: eventTypeSlug,
] }), onValueChange: (v) => handleFieldChange("eventTypeSlug", v),
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, { className: "space-y-2", children: [ disabled: loadingEventTypes || !apiKeyConfigured || eventTypes.length === 0,
renderStatusRow( children: [
apiKeyReady, /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, {
t("calcom.editor.status.apiKey", "API key configured"), "aria-label": t("calcom.editor.eventType.label", "Event Type"),
!apiKeyReady ? /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "/admin/plugins?plugin=calcomblock", className: "text-xs text-primary hover:underline", children: t("calcom.editor.status.apiKey.configureLink", "Configure") }) : null "children": /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: selectPlaceholder }),
), }),
renderStatusRow(usernameReady, t("calcom.editor.status.username", "Account resolved")), /* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, {
renderStatusRow(eventTypeReady, t("calcom.editor.status.eventType", "Event type selected")), children: eventTypes.map((et) =>
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [ /* @__PURE__ */ jsxRuntimeExports.jsxs(
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "inline-flex h-4 w-4 items-center justify-center text-muted-foreground", children: "·" }), SelectItem,
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground", children: t("calcom.editor.status.eventTypesAvailable", "{count} event types available").replace("{count}", String(eventTypes.length)) }) {
] }), value: et.slug,
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx( children: [
Button, et.title,
{ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
type: "button", className: "text-muted-foreground",
size: "sm", children: [" ", "(", et.slug, " · ", et.lengthInMinutes, "m)"],
variant: "outline", }),
action: "open", ],
entity: "calcom-page", },
asChild: canOpenInCalcom, et.id,
disabled: !canOpenInCalcom, ),
"aria-label": t("calcom.editor.status.openExternalAria", "Open Cal.com booking page in a new tab"), ),
children: canOpenInCalcom ? /* @__PURE__ */ jsxRuntimeExports.jsxs("a", { href: `https://cal.com/${calcomUsername}/${eventTypeSlug}`, target: "_blank", rel: "noopener noreferrer", children: [ }),
/* @__PURE__ */ jsxRuntimeExports.jsx(ExternalLink, { className: "h-4 w-4", "aria-hidden": "true" }), ],
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-1", children: t("calcom.editor.status.openExternal", "Open in Cal.com") }) }),
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ /* @__PURE__ */ jsxRuntimeExports.jsx("p", {
/* @__PURE__ */ jsxRuntimeExports.jsx(ExternalLink, { className: "h-4 w-4", "aria-hidden": "true" }), className: "text-xs text-muted-foreground",
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-1", children: t("calcom.editor.status.openExternal", "Open in Cal.com") }) children: t("calcom.editor.eventType.help", "Fetched from your Cal.com account"),
] }) }),
} ],
) }) }),
] }) ],
] }) }),
] }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "content", className: "space-y-4 mt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { children: [ className: "space-y-2",
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, { children: [ children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(CardTitle, { className: "text-base", children: t("calcom.editor.section.content.title", "Widget Content") }), /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "weeksToShow", children: t("calcom.editor.weeksToShow.label", "Weeks to Display") }),
/* @__PURE__ */ jsxRuntimeExports.jsx(CardDescription, { children: t("calcom.editor.section.content.description", "Customize the text shown in the booking widget") }) /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, {
] }), value: String(getNumber("weeksToShow", 2)),
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, { className: "space-y-4", children: [ onValueChange: (v) => handleFieldChange("weeksToShow", parseInt(v, 10)),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "title", children: t("calcom.editor.title.label", "Title") }), /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, {
/* @__PURE__ */ jsxRuntimeExports.jsx( "aria-label": t("calcom.editor.weeksToShow.label", "Weeks to Display"),
Input, "children": /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: t("calcom.editor.weeksToShow.placeholder", "Select weeks") }),
{ }),
id: "title", /* @__PURE__ */ jsxRuntimeExports.jsx(SelectContent, {
value: getString("title"), children: [1, 2, 3, 4, 5, 6, 7, 8].map((n) =>
onChange: (e) => handleFieldChange("title", e.target.value), /* @__PURE__ */ jsxRuntimeExports.jsxs(
placeholder: t("calcom.editor.title.placeholder", "Book a Meeting") SelectItem,
} {
), value: String(n),
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: t("calcom.editor.title.help", "Main heading shown above the calendar") }) children: [
] }), n,
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ " ",
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "description", children: t("calcom.editor.description.label", "Description") }), n > 1 ? t("calcom.editor.weeksToShow.unitPlural", "weeks") : t("calcom.editor.weeksToShow.unitSingular", "week"),
/* @__PURE__ */ jsxRuntimeExports.jsx( ],
Textarea, },
{ n,
id: "description", ),
value: getString("description"), ),
onChange: (e) => handleFieldChange("description", e.target.value), }),
placeholder: t("calcom.editor.description.placeholder", "Choose a convenient time for your consultation..."), ],
rows: 3 }),
} /* @__PURE__ */ jsxRuntimeExports.jsx("p", {
), className: "text-xs text-muted-foreground",
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: t("calcom.editor.description.help", "Optional text shown below the title") }) children: t("calcom.editor.weeksToShow.help", "How many weeks of dates to show in the calendar"),
] }), }),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ ],
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "unavailableMessage", children: t("calcom.editor.unavailableMessage.label", "Booking unavailable message") }), }),
/* @__PURE__ */ jsxRuntimeExports.jsx( /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
Textarea, className: "flex items-center justify-between rounded-lg border p-3",
{ children: [
id: "unavailableMessage", /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
value: getString("unavailableMessage"), className: "space-y-0.5",
onChange: (e) => handleFieldChange("unavailableMessage", e.target.value), children: [
placeholder: t( /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { children: t("calcom.editor.showTimezone.label", "Show Timezone Selector") }),
"calcom.editor.unavailableMessage.placeholder", /* @__PURE__ */ jsxRuntimeExports.jsx("p", {
"Sorry — we couldn't complete your booking online. Please use our contact form and we'll get you booked in." className: "text-xs text-muted-foreground",
), children: t("calcom.editor.showTimezone.help", "Show a label above the date grid indicating which timezone times are displayed in."),
rows: 3 }),
} ],
), }),
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: t("calcom.editor.unavailableMessage.help", "Shown if an online booking can't be completed. Leave blank to use the default.") }) /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, {
] }) "checked": getBool("showTimezone", true),
] }) "onCheckedChange": (v) => handleFieldChange("showTimezone", v),
] }) }) "aria-label": t("calcom.editor.showTimezone.label", "Show Timezone Selector"),
] }) }); }),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
className: "flex items-center justify-between rounded-lg border p-3",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
className: "space-y-0.5",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { children: t("calcom.editor.captchaEnabled.label", "Enable captcha") }),
/* @__PURE__ */ jsxRuntimeExports.jsx("p", {
className: "text-xs text-muted-foreground",
children: t(
"calcom.editor.captchaEnabled.help",
"Require visitors to solve a privacy-friendly proof-of-work captcha before booking (spam protection).",
),
}),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsx(Switch, {
"checked": getBool("captchaEnabled", false),
"onCheckedChange": (v) => handleFieldChange("captchaEnabled", v),
"aria-label": t("calcom.editor.captchaEnabled.label", "Enable captcha"),
}),
],
}),
],
}),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsxs(Card, {
children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, {
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(CardTitle, { className: "text-base", children: t("calcom.editor.status.title", "Configuration status") }),
/* @__PURE__ */ jsxRuntimeExports.jsx(CardDescription, {
children: t("calcom.editor.status.description", "Quick check of the values needed before this block renders bookings."),
}),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, {
className: "space-y-2",
children: [
renderStatusRow(
apiKeyReady,
t("calcom.editor.status.apiKey", "API key configured"),
!apiKeyReady ?
/* @__PURE__ */ jsxRuntimeExports.jsx("a", {
href: "/admin/plugins?plugin=calcomblock",
className: "text-xs text-primary hover:underline",
children: t("calcom.editor.status.apiKey.configureLink", "Configure"),
})
: null,
),
renderStatusRow(usernameReady, t("calcom.editor.status.username", "Account resolved")),
renderStatusRow(eventTypeReady, t("calcom.editor.status.eventType", "Event type selected")),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
className: "flex items-center gap-2 text-sm",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "inline-flex h-4 w-4 items-center justify-center text-muted-foreground", children: "·" }),
/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
className: "text-muted-foreground",
children: t("calcom.editor.status.eventTypesAvailable", "{count} event types available").replace("{count}", String(eventTypes.length)),
}),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
className: "pt-2",
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
"type": "button",
"size": "sm",
"variant": "outline",
"action": "open",
"entity": "calcom-page",
"asChild": canOpenInCalcom,
"disabled": !canOpenInCalcom,
"aria-label": t("calcom.editor.status.openExternalAria", "Open Cal.com booking page in a new tab"),
"children":
canOpenInCalcom ?
/* @__PURE__ */ jsxRuntimeExports.jsxs("a", {
href: `https://cal.com/${calcomUsername}/${eventTypeSlug}`,
target: "_blank",
rel: "noopener noreferrer",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(ExternalLink, { "className": "h-4 w-4", "aria-hidden": "true" }),
/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
className: "ml-1",
children: t("calcom.editor.status.openExternal", "Open in Cal.com"),
}),
],
})
: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(ExternalLink, { "className": "h-4 w-4", "aria-hidden": "true" }),
/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
className: "ml-1",
children: t("calcom.editor.status.openExternal", "Open in Cal.com"),
}),
],
}),
}),
}),
],
}),
],
}),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, {
value: "content",
className: "space-y-4 mt-4",
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, {
children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, {
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(CardTitle, { className: "text-base", children: t("calcom.editor.section.content.title", "Widget Content") }),
/* @__PURE__ */ jsxRuntimeExports.jsx(CardDescription, {
children: t("calcom.editor.section.content.description", "Customize the text shown in the booking widget"),
}),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, {
className: "space-y-4",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
className: "space-y-2",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "title", children: t("calcom.editor.title.label", "Title") }),
/* @__PURE__ */ jsxRuntimeExports.jsx(Input, {
id: "title",
value: getString("title"),
onChange: (e) => handleFieldChange("title", e.target.value),
placeholder: t("calcom.editor.title.placeholder", "Book a Meeting"),
}),
/* @__PURE__ */ jsxRuntimeExports.jsx("p", {
className: "text-xs text-muted-foreground",
children: t("calcom.editor.title.help", "Main heading shown above the calendar"),
}),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
className: "space-y-2",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "description", children: t("calcom.editor.description.label", "Description") }),
/* @__PURE__ */ jsxRuntimeExports.jsx(Textarea, {
id: "description",
value: getString("description"),
onChange: (e) => handleFieldChange("description", e.target.value),
placeholder: t("calcom.editor.description.placeholder", "Choose a convenient time for your consultation..."),
rows: 3,
}),
/* @__PURE__ */ jsxRuntimeExports.jsx("p", {
className: "text-xs text-muted-foreground",
children: t("calcom.editor.description.help", "Optional text shown below the title"),
}),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
className: "space-y-2",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, {
htmlFor: "unavailableMessage",
children: t("calcom.editor.unavailableMessage.label", "Booking unavailable message"),
}),
/* @__PURE__ */ jsxRuntimeExports.jsx(Textarea, {
id: "unavailableMessage",
value: getString("unavailableMessage"),
onChange: (e) => handleFieldChange("unavailableMessage", e.target.value),
placeholder: t(
"calcom.editor.unavailableMessage.placeholder",
"Sorry — we couldn't complete your booking online. Please use our contact form and we'll get you booked in.",
),
rows: 3,
}),
/* @__PURE__ */ jsxRuntimeExports.jsx("p", {
className: "text-xs text-muted-foreground",
children: t("calcom.editor.unavailableMessage.help", "Shown if an online booking can't be completed. Leave blank to use the default."),
}),
],
}),
],
}),
],
}),
}),
],
}),
});
} }
export { CalcomBlockEditor as default }; export { CalcomBlockEditor as default };

View File

@ -1,384 +1,619 @@
import { importShared } from './__federation_fn_import-hlt2XzeI.js'; import { importShared } from "./__federation_fn_import-hlt2XzeI.js";
import { j as jsxRuntimeExports } from './jsx-runtime-CvJTHeKY.js'; import { j as jsxRuntimeExports } from "./jsx-runtime-CvJTHeKY.js";
const {useState,useCallback,useEffect} = await importShared('react'); const { useState, useCallback, useEffect } = await importShared("react");
const {Card,CardContent,CardDescription,CardHeader,CardTitle,Input,Label,Button,Alert,AlertDescription,Badge,ScrollArea,Loader2,CheckCircle2,XCircle,AlertCircle,Eye,EyeOff,Key,Zap,Settings,Send,Copy,RefreshCw,toast,t,useAlertDialog} = await importShared('@block-ninja/ui'); const {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
Input,
Label,
Button,
Alert,
AlertDescription,
Badge,
ScrollArea,
Loader2,
CheckCircle2,
XCircle,
AlertCircle,
Eye,
EyeOff,
Key,
Zap,
Settings,
Send,
Copy,
RefreshCw,
toast,
t,
useAlertDialog,
} = await importShared("@block-ninja/ui");
const copyToClipboard = async (text) => { const copyToClipboard = async (text) => {
if (!text) return; if (!text) return;
try { try {
await navigator.clipboard.writeText(text); await navigator.clipboard.writeText(text);
toast.success(t("calcom.settings.copied", "Copied to clipboard")); toast.success(t("calcom.settings.copied", "Copied to clipboard"));
} catch (_error) { } catch (_error) {
toast.error(t("calcom.settings.copyFailed", "Could not copy to clipboard")); toast.error(t("calcom.settings.copyFailed", "Could not copy to clipboard"));
} }
}; };
const formatRelativeTime = (iso) => { const formatRelativeTime = (iso) => {
const parsed = Date.parse(iso); const parsed = Date.parse(iso);
if (Number.isNaN(parsed)) return iso; if (Number.isNaN(parsed)) return iso;
const diffMs = Date.now() - parsed; const diffMs = Date.now() - parsed;
const minutes = Math.round(diffMs / 6e4); const minutes = Math.round(diffMs / 6e4);
if (minutes < 1) return t("calcom.settings.relative.justNow", "just now"); if (minutes < 1) return t("calcom.settings.relative.justNow", "just now");
if (minutes < 60) { if (minutes < 60) {
return minutes === 1 ? t("calcom.settings.relative.minute", "1 minute ago") : t("calcom.settings.relative.minutes", "{count} minutes ago").replace("{count}", String(minutes)); return minutes === 1 ? t("calcom.settings.relative.minute", "1 minute ago") : t("calcom.settings.relative.minutes", "{count} minutes ago").replace("{count}", String(minutes));
} }
const hours = Math.round(minutes / 60); const hours = Math.round(minutes / 60);
if (hours < 24) { if (hours < 24) {
return hours === 1 ? t("calcom.settings.relative.hour", "1 hour ago") : t("calcom.settings.relative.hours", "{count} hours ago").replace("{count}", String(hours)); return hours === 1 ? t("calcom.settings.relative.hour", "1 hour ago") : t("calcom.settings.relative.hours", "{count} hours ago").replace("{count}", String(hours));
} }
const days = Math.round(hours / 24); const days = Math.round(hours / 24);
return days === 1 ? t("calcom.settings.relative.day", "1 day ago") : t("calcom.settings.relative.days", "{count} days ago").replace("{count}", String(days)); return days === 1 ? t("calcom.settings.relative.day", "1 day ago") : t("calcom.settings.relative.days", "{count} days ago").replace("{count}", String(days));
}; };
function CalcomSettings({ pluginName }) { function CalcomSettings({ pluginName }) {
const { confirm } = useAlertDialog(); const { confirm } = useAlertDialog();
const [apiKey, setApiKey] = useState(""); const [apiKey, setApiKey] = useState("");
const [showApiKey, setShowApiKey] = useState(false); const [showApiKey, setShowApiKey] = useState(false);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [saving, setSaving] = useState(false); const [saving, setSaving] = useState(false);
const [testing, setTesting] = useState(false); const [testing, setTesting] = useState(false);
const [rotating, setRotating] = useState(false); const [rotating, setRotating] = useState(false);
const [showSecret, setShowSecret] = useState(false); const [showSecret, setShowSecret] = useState(false);
const [settings, setSettings] = useState(null); const [settings, setSettings] = useState(null);
const [testResult, setTestResult] = useState(null); const [testResult, setTestResult] = useState(null);
const [saveMessage, setSaveMessage] = useState(null); const [saveMessage, setSaveMessage] = useState(null);
const baseUrl = `/api/plugins/${pluginName}`; const baseUrl = `/api/plugins/${pluginName}`;
const loadSettings = useCallback(async () => { const loadSettings = useCallback(async () => {
try { try {
const res = await fetch(`${baseUrl}/settings`); const res = await fetch(`${baseUrl}/settings`);
if (res.ok) { if (res.ok) {
const data = await res.json(); const data = await res.json();
setSettings(data); setSettings(data);
} }
} catch (_error) { } catch (_error) {
console.error("Failed to load settings"); console.error("Failed to load settings");
} finally { } finally {
setLoading(false); setLoading(false);
} }
}, [baseUrl]); }, [baseUrl]);
useEffect(() => { useEffect(() => {
loadSettings(); loadSettings();
}, [loadSettings]); }, [loadSettings]);
const handleSave = async () => { const handleSave = async () => {
if (!apiKey.trim()) { if (!apiKey.trim()) {
setSaveMessage({ type: "error", text: t("calcom.settings.apiKey.errorEmpty", "Please enter an API key") }); setSaveMessage({ type: "error", text: t("calcom.settings.apiKey.errorEmpty", "Please enter an API key") });
return; return;
} }
setSaving(true); setSaving(true);
setSaveMessage(null); setSaveMessage(null);
setTestResult(null); setTestResult(null);
try { try {
const res = await fetch(`${baseUrl}/settings`, { const res = await fetch(`${baseUrl}/settings`, {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ api_key: apiKey }) body: JSON.stringify({ api_key: apiKey }),
}); });
if (res.ok) { if (res.ok) {
await loadSettings(); await loadSettings();
setApiKey(""); setApiKey("");
setSaveMessage({ type: "success", text: t("calcom.settings.apiKey.saved", "API key saved successfully") }); setSaveMessage({ type: "success", text: t("calcom.settings.apiKey.saved", "API key saved successfully") });
} else { } else {
const text = await res.text(); const text = await res.text();
setSaveMessage({ type: "error", text: text || t("calcom.settings.apiKey.saveFailed", "Failed to save API key") }); setSaveMessage({ type: "error", text: text || t("calcom.settings.apiKey.saveFailed", "Failed to save API key") });
} }
} catch (_error) { } catch (_error) {
setSaveMessage({ type: "error", text: t("calcom.settings.serverError", "Failed to connect to server") }); setSaveMessage({ type: "error", text: t("calcom.settings.serverError", "Failed to connect to server") });
} finally { } finally {
setSaving(false); setSaving(false);
} }
}; };
const handleTest = async () => { const handleTest = async () => {
setTesting(true); setTesting(true);
setTestResult(null); setTestResult(null);
try { try {
const res = await fetch(`${baseUrl}/test`, { method: "POST" }); const res = await fetch(`${baseUrl}/test`, { method: "POST" });
const data = await res.json(); const data = await res.json();
setTestResult(data); setTestResult(data);
} catch (_error) { } catch (_error) {
setTestResult({ success: false, error: t("calcom.settings.serverError", "Failed to connect to server") }); setTestResult({ success: false, error: t("calcom.settings.serverError", "Failed to connect to server") });
} finally { } finally {
setTesting(false); setTesting(false);
} }
}; };
const handleClear = async () => { const handleClear = async () => {
setSaving(true); setSaving(true);
setSaveMessage(null); setSaveMessage(null);
try { try {
const res = await fetch(`${baseUrl}/settings`, { const res = await fetch(`${baseUrl}/settings`, {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ api_key: "" }) body: JSON.stringify({ api_key: "" }),
}); });
if (res.ok) { if (res.ok) {
await loadSettings(); await loadSettings();
setTestResult(null); setTestResult(null);
setSaveMessage({ type: "success", text: t("calcom.settings.apiKey.removed", "API key removed") }); setSaveMessage({ type: "success", text: t("calcom.settings.apiKey.removed", "API key removed") });
} }
} catch (_error) { } catch (_error) {
setSaveMessage({ type: "error", text: t("calcom.settings.apiKey.clearFailed", "Failed to clear API key") }); setSaveMessage({ type: "error", text: t("calcom.settings.apiKey.clearFailed", "Failed to clear API key") });
} finally { } finally {
setSaving(false); setSaving(false);
} }
}; };
const handleRotate = async () => { const handleRotate = async () => {
const confirmed = await confirm({ const confirmed = await confirm({
title: t("calcom.settings.webhook.rotateConfirmTitle", "Rotate webhook secret?"), title: t("calcom.settings.webhook.rotateConfirmTitle", "Rotate webhook secret?"),
message: t("calcom.settings.webhook.rotateConfirmMessage", "This invalidates the existing secret immediately. You'll need to update Cal.com to keep webhooks flowing."), message: t("calcom.settings.webhook.rotateConfirmMessage", "This invalidates the existing secret immediately. You'll need to update Cal.com to keep webhooks flowing."),
confirmLabel: t("calcom.settings.webhook.rotateConfirmLabel", "Rotate"), confirmLabel: t("calcom.settings.webhook.rotateConfirmLabel", "Rotate"),
variant: "destructive" variant: "destructive",
}); });
if (!confirmed) return; if (!confirmed) return;
setRotating(true); setRotating(true);
setSaveMessage(null); setSaveMessage(null);
try { try {
const res = await fetch(`${baseUrl}/settings/rotate-webhook-secret`, { method: "POST" }); const res = await fetch(`${baseUrl}/settings/rotate-webhook-secret`, { method: "POST" });
if (res.ok) { if (res.ok) {
const data = await res.json(); const data = await res.json();
setSettings((prev) => prev ? { ...prev, webhook_secret_masked: data.webhook_secret_masked, webhook_secret_configured: true } : prev); setSettings((prev) => (prev ? { ...prev, webhook_secret_masked: data.webhook_secret_masked, webhook_secret_configured: true } : prev));
const successMsg = t("calcom.settings.webhook.rotated", "Webhook secret rotated. Update it in Cal.com."); const successMsg = t("calcom.settings.webhook.rotated", "Webhook secret rotated. Update it in Cal.com.");
setSaveMessage({ type: "success", text: successMsg }); setSaveMessage({ type: "success", text: successMsg });
toast.success(successMsg); toast.success(successMsg);
} else { } else {
setSaveMessage({ type: "error", text: t("calcom.settings.webhook.rotateFailed", "Failed to rotate webhook secret") }); setSaveMessage({ type: "error", text: t("calcom.settings.webhook.rotateFailed", "Failed to rotate webhook secret") });
} }
} catch (_error) { } catch (_error) {
setSaveMessage({ type: "error", text: t("calcom.settings.serverError", "Failed to connect to server") }); setSaveMessage({ type: "error", text: t("calcom.settings.serverError", "Failed to connect to server") });
} finally { } finally {
setRotating(false); setRotating(false);
} }
}; };
if (loading) { if (loading) {
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }) }); return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
} className: "flex items-center justify-center py-8",
const apiKeyVisibilityLabel = showApiKey ? t("calcom.settings.toggleVisibility.hide", "Hide") : t("calcom.settings.toggleVisibility.show", "Show"); children: /* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }),
const secretVisibilityLabel = showSecret ? t("calcom.settings.toggleVisibility.hide", "Hide") : t("calcom.settings.toggleVisibility.show", "Show"); });
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-6", children: [ }
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [ const apiKeyVisibilityLabel = showApiKey ? t("calcom.settings.toggleVisibility.hide", "Hide") : t("calcom.settings.toggleVisibility.show", "Show");
/* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "text-xl font-semibold flex items-center gap-2", children: [ const secretVisibilityLabel = showSecret ? t("calcom.settings.toggleVisibility.hide", "Hide") : t("calcom.settings.toggleVisibility.show", "Show");
/* @__PURE__ */ jsxRuntimeExports.jsx(Settings, { className: "h-5 w-5" }), return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
t("calcom.settings.heading", "Cal.com Integration") className: "space-y-6",
] }), children: [
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: t("calcom.settings.headingDescription", "Configure your Cal.com API key to enable booking functionality") }) /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
] }), children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { children: [ /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", {
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, { children: [ className: "text-xl font-semibold flex items-center gap-2",
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardTitle, { className: "text-base flex items-center gap-2", children: [ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Settings, { className: "h-5 w-5" }), t("calcom.settings.heading", "Cal.com Integration")],
/* @__PURE__ */ jsxRuntimeExports.jsx(Key, { className: "h-4 w-4" }), }),
t("calcom.settings.apiKey.title", "API Key Status") /* @__PURE__ */ jsxRuntimeExports.jsx("p", {
] }), className: "text-sm text-muted-foreground",
/* @__PURE__ */ jsxRuntimeExports.jsx(CardDescription, { children: t("calcom.settings.apiKey.description", "Your Cal.com API key is required for the booking widget to function") }) children: t("calcom.settings.headingDescription", "Configure your Cal.com API key to enable booking functionality"),
] }), }),
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, { className: "space-y-4", children: [ ],
settings?.api_key_configured ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded-lg border bg-muted/30 p-3", children: [ }),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [ /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, {
/* @__PURE__ */ jsxRuntimeExports.jsxs(Badge, { variant: "default", className: "gap-1.5", children: [ children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(CheckCircle2, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, {
t("calcom.settings.apiKey.configuredLabel", "Configured") children: [
] }), /* @__PURE__ */ jsxRuntimeExports.jsxs(CardTitle, {
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground font-mono", children: settings.api_key_masked || t("calcom.settings.apiKey.maskedFallback", "***configured***") }) className: "text-base flex items-center gap-2",
] }), children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Key, { className: "h-4 w-4" }), t("calcom.settings.apiKey.title", "API Key Status")],
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { action: "delete", entity: "plugin-setting", variant: "ghost", size: "sm", onClick: handleClear, disabled: saving, children: t("calcom.settings.apiKey.remove", "Remove") }) }),
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3 rounded-lg border bg-muted/30 p-3", children: [ /* @__PURE__ */ jsxRuntimeExports.jsx(CardDescription, {
/* @__PURE__ */ jsxRuntimeExports.jsxs(Badge, { variant: "outline", className: "gap-1.5", children: [ children: t("calcom.settings.apiKey.description", "Your Cal.com API key is required for the booking widget to function"),
/* @__PURE__ */ jsxRuntimeExports.jsx(XCircle, { className: "h-3.5 w-3.5" }), }),
t("calcom.settings.apiKey.notConfiguredLabel", "Not configured") ],
] }), }),
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: t("calcom.settings.apiKey.notConfiguredHelp", "Enter your Cal.com API key below to enable booking") }) /* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, {
] }), className: "space-y-4",
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "apiKey", children: settings?.api_key_configured ? t("calcom.settings.apiKey.updateLabel", "Update API Key") : t("calcom.settings.apiKey.label", "API Key") }), settings?.api_key_configured ?
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex-1", children: [ className: "flex items-center justify-between rounded-lg border bg-muted/30 p-3",
/* @__PURE__ */ jsxRuntimeExports.jsx( children: [
Input, /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
{ className: "flex items-center gap-3",
id: "apiKey", children: [
type: showApiKey ? "text" : "password", /* @__PURE__ */ jsxRuntimeExports.jsxs(Badge, {
value: apiKey, variant: "default",
onChange: (e) => setApiKey(e.target.value), className: "gap-1.5",
placeholder: t("calcom.settings.apiKey.placeholder", "cal_live_..."), children: [
className: "pr-10" /* @__PURE__ */ jsxRuntimeExports.jsx(CheckCircle2, { className: "h-3.5 w-3.5" }),
} t("calcom.settings.apiKey.configuredLabel", "Configured"),
), ],
/* @__PURE__ */ jsxRuntimeExports.jsx( }),
Button, /* @__PURE__ */ jsxRuntimeExports.jsx("p", {
{ className: "text-xs text-muted-foreground font-mono",
type: "button", children: settings.api_key_masked || t("calcom.settings.apiKey.maskedFallback", "***configured***"),
variant: "ghost", }),
action: "toggle", ],
entity: "api-key-visibility", }),
onClick: () => setShowApiKey(!showApiKey), /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
"aria-label": apiKeyVisibilityLabel, action: "delete",
className: "absolute right-3 top-1/2 -translate-y-1/2 h-auto p-0 text-muted-foreground hover:bg-transparent hover:text-foreground", entity: "plugin-setting",
children: showApiKey ? /* @__PURE__ */ jsxRuntimeExports.jsx(EyeOff, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Eye, { className: "h-4 w-4" }) variant: "ghost",
} size: "sm",
) onClick: handleClear,
] }), disabled: saving,
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { action: "save", entity: "plugin-setting", onClick: handleSave, disabled: saving || !apiKey.trim(), children: saving ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : t("calcom.settings.apiKey.save", "Save") }) children: t("calcom.settings.apiKey.remove", "Remove"),
] }), }),
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-xs text-muted-foreground", children: [ ],
t("calcom.settings.apiKey.helpPrefix", "Get your API key from"), })
" ", : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://app.cal.com/settings/developer/api-keys", target: "_blank", rel: "noopener noreferrer", className: "text-primary hover:underline", children: t("calcom.settings.apiKey.helpLink", "Cal.com API Settings") }) className: "flex items-center gap-3 rounded-lg border bg-muted/30 p-3",
] }) children: [
] }), /* @__PURE__ */ jsxRuntimeExports.jsxs(Badge, {
saveMessage && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { variant: saveMessage.type === "error" ? "destructive" : "default", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AlertDescription, { children: saveMessage.text }) }) variant: "outline",
] }) className: "gap-1.5",
] }), children: [/* @__PURE__ */ jsxRuntimeExports.jsx(XCircle, { className: "h-3.5 w-3.5" }), t("calcom.settings.apiKey.notConfiguredLabel", "Not configured")],
settings?.api_key_configured && /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { children: [ }),
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, { children: [ /* @__PURE__ */ jsxRuntimeExports.jsx("p", {
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardTitle, { className: "text-base flex items-center gap-2", children: [ className: "text-xs text-muted-foreground",
/* @__PURE__ */ jsxRuntimeExports.jsx(Zap, { className: "h-4 w-4" }), children: t("calcom.settings.apiKey.notConfiguredHelp", "Enter your Cal.com API key below to enable booking"),
t("calcom.settings.test.title", "Test Connection") }),
] }), ],
/* @__PURE__ */ jsxRuntimeExports.jsx(CardDescription, { children: t("calcom.settings.test.description", "Verify your API key works and see available event types") }) }),
] }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, { className: "space-y-4", children: [ className: "space-y-2",
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { action: "settings", entity: "plugin-connection", onClick: handleTest, disabled: testing, children: testing ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), /* @__PURE__ */ jsxRuntimeExports.jsx(Label, {
t("calcom.settings.test.testing", "Testing...") htmlFor: "apiKey",
] }) : t("calcom.settings.test.button", "Test Connection") }), children: settings?.api_key_configured ? t("calcom.settings.apiKey.updateLabel", "Update API Key") : t("calcom.settings.apiKey.label", "API Key"),
testResult && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-3", children: testResult.success ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ }),
/* @__PURE__ */ jsxRuntimeExports.jsxs(Alert, { children: [ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
/* @__PURE__ */ jsxRuntimeExports.jsx(CheckCircle2, { className: "h-4 w-4 text-success" }), className: "flex gap-2",
/* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDescription, { className: "ml-2", children: [ children: [
t("calcom.settings.test.successPrefix", "Connection successful! Found"), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
" ", className: "relative flex-1",
testResult.event_types?.length || 0, children: [
" ", /* @__PURE__ */ jsxRuntimeExports.jsx(Input, {
t("calcom.settings.test.successSuffix", "event types.") id: "apiKey",
] }) type: showApiKey ? "text" : "password",
] }), value: apiKey,
testResult.event_types && testResult.event_types.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { className: "max-h-96 rounded-lg border", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("table", { className: "w-full text-sm", children: [ onChange: (e) => setApiKey(e.target.value),
/* @__PURE__ */ jsxRuntimeExports.jsx("thead", { className: "bg-muted", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { children: [ placeholder: t("calcom.settings.apiKey.placeholder", "cal_live_..."),
/* @__PURE__ */ jsxRuntimeExports.jsx("th", { className: "text-left px-3 py-2 font-medium", children: t("calcom.settings.test.tableEventType", "Event Type") }), className: "pr-10",
/* @__PURE__ */ jsxRuntimeExports.jsx("th", { className: "text-left px-3 py-2 font-medium", children: t("calcom.settings.test.tableSlug", "Slug") }) }),
] }) }), /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
/* @__PURE__ */ jsxRuntimeExports.jsx("tbody", { children: testResult.event_types.map((et) => /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { className: "border-t", children: [ "type": "button",
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: "px-3 py-2", children: et.title }), "variant": "ghost",
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: "px-3 py-2 font-mono text-xs", children: et.slug }) "action": "toggle",
] }, et.id)) }) "entity": "api-key-visibility",
] }) }) "onClick": () => setShowApiKey(!showApiKey),
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(Alert, { variant: "destructive", children: [ "aria-label": apiKeyVisibilityLabel,
/* @__PURE__ */ jsxRuntimeExports.jsx(XCircle, { className: "h-4 w-4" }), "className": "absolute right-3 top-1/2 -translate-y-1/2 h-auto p-0 text-muted-foreground hover:bg-transparent hover:text-foreground",
/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDescription, { className: "ml-2", children: testResult.error || t("calcom.settings.test.failure", "Connection failed") }) "children":
] }) }) showApiKey ?
] }) /* @__PURE__ */ jsxRuntimeExports.jsx(EyeOff, { className: "h-4 w-4" })
] }), : /* @__PURE__ */ jsxRuntimeExports.jsx(Eye, { className: "h-4 w-4" }),
settings?.api_key_configured && /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { children: [ }),
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, { children: [ ],
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardTitle, { className: "text-base flex items-center gap-2", children: [ }),
/* @__PURE__ */ jsxRuntimeExports.jsx(Send, { className: "h-4 w-4" }), /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
t("calcom.settings.webhook.title", "Webhook") action: "save",
] }), entity: "plugin-setting",
/* @__PURE__ */ jsxRuntimeExports.jsx(CardDescription, { children: t("calcom.settings.webhook.description", "Configure this URL in Cal.com → Settings → Developer → Webhooks to receive booking events.") }) onClick: handleSave,
] }), disabled: saving || !apiKey.trim(),
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, { className: "space-y-4", children: [ children: saving ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : t("calcom.settings.apiKey.save", "Save"),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ }),
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "webhookUrl", children: t("calcom.settings.webhook.urlLabel", "Webhook URL") }), ],
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [ }),
/* @__PURE__ */ jsxRuntimeExports.jsx(Input, { id: "webhookUrl", readOnly: true, value: settings?.webhook_url || "", className: "flex-1 font-mono text-xs" }), /* @__PURE__ */ jsxRuntimeExports.jsxs("p", {
/* @__PURE__ */ jsxRuntimeExports.jsx( className: "text-xs text-muted-foreground",
Button, children: [
{ t("calcom.settings.apiKey.helpPrefix", "Get your API key from"),
action: "copy", " ",
entity: "webhook-url", /* @__PURE__ */ jsxRuntimeExports.jsx("a", {
variant: "outline", href: "https://app.cal.com/settings/developer/api-keys",
size: "sm", target: "_blank",
"aria-label": t("calcom.settings.webhook.copyUrl", "Copy webhook URL"), rel: "noopener noreferrer",
onClick: () => copyToClipboard(settings?.webhook_url || ""), className: "text-primary hover:underline",
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Copy, { className: "h-4 w-4" }) children: t("calcom.settings.apiKey.helpLink", "Cal.com API Settings"),
} }),
) ],
] }) }),
] }), ],
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [ }),
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "webhookSecret", children: t("calcom.settings.webhook.secretLabel", "Webhook Secret") }), saveMessage &&
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [ /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, {
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex-1", children: [ variant: saveMessage.type === "error" ? "destructive" : "default",
/* @__PURE__ */ jsxRuntimeExports.jsx( children: /* @__PURE__ */ jsxRuntimeExports.jsx(AlertDescription, { children: saveMessage.text }),
Input, }),
{ ],
id: "webhookSecret", }),
type: showSecret ? "text" : "password", ],
readOnly: true, }),
value: settings?.webhook_secret_masked || t("calcom.settings.webhook.secretNotConfigured", "Not configured"), settings?.api_key_configured &&
className: "pr-10 font-mono text-xs" /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, {
} children: [
), /* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, {
/* @__PURE__ */ jsxRuntimeExports.jsx( children: [
Button, /* @__PURE__ */ jsxRuntimeExports.jsxs(CardTitle, {
{ className: "text-base flex items-center gap-2",
type: "button", children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Zap, { className: "h-4 w-4" }), t("calcom.settings.test.title", "Test Connection")],
variant: "ghost", }),
action: "toggle", /* @__PURE__ */ jsxRuntimeExports.jsx(CardDescription, { children: t("calcom.settings.test.description", "Verify your API key works and see available event types") }),
entity: "webhook-secret-visibility", ],
onClick: () => setShowSecret(!showSecret), }),
"aria-label": secretVisibilityLabel, /* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, {
className: "absolute right-3 top-1/2 -translate-y-1/2 h-auto p-0 text-muted-foreground hover:bg-transparent hover:text-foreground", className: "space-y-4",
children: showSecret ? /* @__PURE__ */ jsxRuntimeExports.jsx(EyeOff, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Eye, { className: "h-4 w-4" }) children: [
} /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
) action: "settings",
] }), entity: "plugin-connection",
/* @__PURE__ */ jsxRuntimeExports.jsx( onClick: handleTest,
Button, disabled: testing,
{ children:
action: "copy", testing ?
entity: "webhook-secret", /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
variant: "outline", children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), t("calcom.settings.test.testing", "Testing...")],
size: "sm", })
"aria-label": t("calcom.settings.webhook.copySecret", "Copy webhook secret"), : t("calcom.settings.test.button", "Test Connection"),
onClick: () => copyToClipboard(settings?.webhook_secret_masked || ""), }),
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Copy, { className: "h-4 w-4" }) testResult &&
} /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
), className: "space-y-3",
/* @__PURE__ */ jsxRuntimeExports.jsx( children:
Button, testResult.success ?
{ /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
action: "rotate", children: [
entity: "webhook-secret", /* @__PURE__ */ jsxRuntimeExports.jsxs(Alert, {
variant: "outline", children: [
size: "sm", /* @__PURE__ */ jsxRuntimeExports.jsx(CheckCircle2, { className: "h-4 w-4 text-success" }),
"aria-label": t("calcom.settings.webhook.rotate", "Rotate webhook secret"), /* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDescription, {
onClick: handleRotate, className: "ml-2",
disabled: rotating, children: [
children: rotating ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefreshCw, { className: "h-4 w-4" }) t("calcom.settings.test.successPrefix", "Connection successful! Found"),
} " ",
) testResult.event_types?.length || 0,
] }), " ",
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: t( t("calcom.settings.test.successSuffix", "event types."),
"calcom.settings.webhook.secretHelp", ],
"Cal.com displays the secret only once. Regenerating invalidates the previous value immediately — update it in Cal.com after rotating." }),
) }) ],
] }), }),
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: settings?.last_event_at ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-foreground", children: [ testResult.event_types &&
/* @__PURE__ */ jsxRuntimeExports.jsx(CheckCircle2, { className: "h-4 w-4 text-success" }), testResult.event_types.length > 0 &&
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [ /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, {
t("calcom.settings.webhook.lastEventPrefix", "Last event"), className: "max-h-96 rounded-lg border",
" ", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("table", {
formatRelativeTime(settings.last_event_at), className: "w-full text-sm",
settings.last_event_type && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ children: [
" — ", /* @__PURE__ */ jsxRuntimeExports.jsx("thead", {
/* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "font-mono text-xs", children: settings.last_event_type }) className: "bg-muted",
] }) children: /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", {
] }) children: [
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-muted-foreground", children: [ /* @__PURE__ */ jsxRuntimeExports.jsx("th", {
/* @__PURE__ */ jsxRuntimeExports.jsx(AlertCircle, { className: "h-4 w-4" }), className: "text-left px-3 py-2 font-medium",
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t("calcom.settings.webhook.waitingForEvent", "Status: Waiting for first event") }) children: t("calcom.settings.test.tableEventType", "Event Type"),
] }) }) }),
] }) /* @__PURE__ */ jsxRuntimeExports.jsx("th", {
] }), className: "text-left px-3 py-2 font-medium",
/* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { children: [ children: t("calcom.settings.test.tableSlug", "Slug"),
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, { children: [ }),
/* @__PURE__ */ jsxRuntimeExports.jsx(CardTitle, { className: "text-base", children: t("calcom.settings.docs.title", "Documentation") }), ],
/* @__PURE__ */ jsxRuntimeExports.jsx(CardDescription, { children: t("calcom.settings.docs.description", "Reference material for working with the Cal.com plugin.") }) }),
] }), }),
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, { className: "space-y-2 text-sm", children: [ /* @__PURE__ */ jsxRuntimeExports.jsx("tbody", {
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://cal.com/docs/api-reference/v2", target: "_blank", rel: "noopener noreferrer", className: "text-primary hover:underline block", children: t("calcom.settings.docs.calcomApi", "Cal.com API documentation") }), children: testResult.event_types.map((et) =>
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "/admin/docs/calcom-plugin", target: "_blank", rel: "noopener noreferrer", className: "text-primary hover:underline block", children: t("calcom.settings.docs.pluginGuide", "BlockNinja plugin guide") }) /* @__PURE__ */ jsxRuntimeExports.jsxs(
] }) "tr",
] }) {
] }); className: "border-t",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: "px-3 py-2", children: et.title }),
/* @__PURE__ */ jsxRuntimeExports.jsx("td", {
className: "px-3 py-2 font-mono text-xs",
children: et.slug,
}),
],
},
et.id,
),
),
}),
],
}),
}),
],
})
: /* @__PURE__ */ jsxRuntimeExports.jsxs(Alert, {
variant: "destructive",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(XCircle, { className: "h-4 w-4" }),
/* @__PURE__ */ jsxRuntimeExports.jsx(AlertDescription, {
className: "ml-2",
children: testResult.error || t("calcom.settings.test.failure", "Connection failed"),
}),
],
}),
}),
],
}),
],
}),
settings?.api_key_configured &&
/* @__PURE__ */ jsxRuntimeExports.jsxs(Card, {
children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, {
children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardTitle, {
className: "text-base flex items-center gap-2",
children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Send, { className: "h-4 w-4" }), t("calcom.settings.webhook.title", "Webhook")],
}),
/* @__PURE__ */ jsxRuntimeExports.jsx(CardDescription, {
children: t("calcom.settings.webhook.description", "Configure this URL in Cal.com → Settings → Developer → Webhooks to receive booking events."),
}),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, {
className: "space-y-4",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
className: "space-y-2",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "webhookUrl", children: t("calcom.settings.webhook.urlLabel", "Webhook URL") }),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
className: "flex gap-2",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(Input, {
id: "webhookUrl",
readOnly: true,
value: settings?.webhook_url || "",
className: "flex-1 font-mono text-xs",
}),
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
"action": "copy",
"entity": "webhook-url",
"variant": "outline",
"size": "sm",
"aria-label": t("calcom.settings.webhook.copyUrl", "Copy webhook URL"),
"onClick": () => copyToClipboard(settings?.webhook_url || ""),
"children": /* @__PURE__ */ jsxRuntimeExports.jsx(Copy, { className: "h-4 w-4" }),
}),
],
}),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
className: "space-y-2",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { htmlFor: "webhookSecret", children: t("calcom.settings.webhook.secretLabel", "Webhook Secret") }),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
className: "flex gap-2",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
className: "relative flex-1",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(Input, {
id: "webhookSecret",
type: showSecret ? "text" : "password",
readOnly: true,
value: settings?.webhook_secret_masked || t("calcom.settings.webhook.secretNotConfigured", "Not configured"),
className: "pr-10 font-mono text-xs",
}),
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
"type": "button",
"variant": "ghost",
"action": "toggle",
"entity": "webhook-secret-visibility",
"onClick": () => setShowSecret(!showSecret),
"aria-label": secretVisibilityLabel,
"className": "absolute right-3 top-1/2 -translate-y-1/2 h-auto p-0 text-muted-foreground hover:bg-transparent hover:text-foreground",
"children":
showSecret ?
/* @__PURE__ */ jsxRuntimeExports.jsx(EyeOff, { className: "h-4 w-4" })
: /* @__PURE__ */ jsxRuntimeExports.jsx(Eye, { className: "h-4 w-4" }),
}),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
"action": "copy",
"entity": "webhook-secret",
"variant": "outline",
"size": "sm",
"aria-label": t("calcom.settings.webhook.copySecret", "Copy webhook secret"),
"onClick": () => copyToClipboard(settings?.webhook_secret_masked || ""),
"children": /* @__PURE__ */ jsxRuntimeExports.jsx(Copy, { className: "h-4 w-4" }),
}),
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
"action": "rotate",
"entity": "webhook-secret",
"variant": "outline",
"size": "sm",
"aria-label": t("calcom.settings.webhook.rotate", "Rotate webhook secret"),
"onClick": handleRotate,
"disabled": rotating,
"children":
rotating ?
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-4 w-4 animate-spin" })
: /* @__PURE__ */ jsxRuntimeExports.jsx(RefreshCw, { className: "h-4 w-4" }),
}),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsx("p", {
className: "text-xs text-muted-foreground",
children: t(
"calcom.settings.webhook.secretHelp",
"Cal.com displays the secret only once. Regenerating invalidates the previous value immediately — update it in Cal.com after rotating.",
),
}),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
className: "text-sm",
children:
settings?.last_event_at ?
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
className: "flex items-center gap-2 text-foreground",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(CheckCircle2, { className: "h-4 w-4 text-success" }),
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
children: [
t("calcom.settings.webhook.lastEventPrefix", "Last event"),
" ",
formatRelativeTime(settings.last_event_at),
settings.last_event_type &&
/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
children: [
" — ",
/* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "font-mono text-xs", children: settings.last_event_type }),
],
}),
],
}),
],
})
: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
className: "flex items-center gap-2 text-muted-foreground",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(AlertCircle, { className: "h-4 w-4" }),
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t("calcom.settings.webhook.waitingForEvent", "Status: Waiting for first event") }),
],
}),
}),
],
}),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsxs(Card, {
children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardHeader, {
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(CardTitle, { className: "text-base", children: t("calcom.settings.docs.title", "Documentation") }),
/* @__PURE__ */ jsxRuntimeExports.jsx(CardDescription, { children: t("calcom.settings.docs.description", "Reference material for working with the Cal.com plugin.") }),
],
}),
/* @__PURE__ */ jsxRuntimeExports.jsxs(CardContent, {
className: "space-y-2 text-sm",
children: [
/* @__PURE__ */ jsxRuntimeExports.jsx("a", {
href: "https://cal.com/docs/api-reference/v2",
target: "_blank",
rel: "noopener noreferrer",
className: "text-primary hover:underline block",
children: t("calcom.settings.docs.calcomApi", "Cal.com API documentation"),
}),
/* @__PURE__ */ jsxRuntimeExports.jsx("a", {
href: "/admin/docs/calcom-plugin",
target: "_blank",
rel: "noopener noreferrer",
className: "text-primary hover:underline block",
children: t("calcom.settings.docs.pluginGuide", "BlockNinja plugin guide"),
}),
],
}),
],
}),
],
});
} }
export { CalcomSettings as default }; export { CalcomSettings as default };

View File

@ -27,399 +27,366 @@ const xRange = `^${gtlt}\\s*${xRangePlain}$`;
const comparator = `^${gtlt}\\s*(${fullPlain})$|^$`; const comparator = `^${gtlt}\\s*(${fullPlain})$|^$`;
const gte0 = "^\\s*>=\\s*0.0.0\\s*$"; const gte0 = "^\\s*>=\\s*0.0.0\\s*$";
function parseRegex(source) { function parseRegex(source) {
return new RegExp(source); return new RegExp(source);
} }
function isXVersion(version) { function isXVersion(version) {
return !version || version.toLowerCase() === "x" || version === "*"; return !version || version.toLowerCase() === "x" || version === "*";
} }
function pipe(...fns) { function pipe(...fns) {
return (x) => { return (x) => {
return fns.reduce((v, f) => f(v), x); return fns.reduce((v, f) => f(v), x);
}; };
} }
function extractComparator(comparatorString) { function extractComparator(comparatorString) {
return comparatorString.match(parseRegex(comparator)); return comparatorString.match(parseRegex(comparator));
} }
function combineVersion(major, minor, patch, preRelease2) { function combineVersion(major, minor, patch, preRelease2) {
const mainVersion2 = `${major}.${minor}.${patch}`; const mainVersion2 = `${major}.${minor}.${patch}`;
if (preRelease2) { if (preRelease2) {
return `${mainVersion2}-${preRelease2}`; return `${mainVersion2}-${preRelease2}`;
} }
return mainVersion2; return mainVersion2;
} }
function parseHyphen(range) { function parseHyphen(range) {
return range.replace( return range.replace(parseRegex(hyphenRange), (_range, from, fromMajor, fromMinor, fromPatch, _fromPreRelease, _fromBuild, to, toMajor, toMinor, toPatch, toPreRelease) => {
parseRegex(hyphenRange), if (isXVersion(fromMajor)) {
(_range, from, fromMajor, fromMinor, fromPatch, _fromPreRelease, _fromBuild, to, toMajor, toMinor, toPatch, toPreRelease) => { from = "";
if (isXVersion(fromMajor)) { } else if (isXVersion(fromMinor)) {
from = ""; from = `>=${fromMajor}.0.0`;
} else if (isXVersion(fromMinor)) { } else if (isXVersion(fromPatch)) {
from = `>=${fromMajor}.0.0`; from = `>=${fromMajor}.${fromMinor}.0`;
} else if (isXVersion(fromPatch)) { } else {
from = `>=${fromMajor}.${fromMinor}.0`; from = `>=${from}`;
} else { }
from = `>=${from}`; if (isXVersion(toMajor)) {
} to = "";
if (isXVersion(toMajor)) { } else if (isXVersion(toMinor)) {
to = ""; to = `<${+toMajor + 1}.0.0-0`;
} else if (isXVersion(toMinor)) { } else if (isXVersion(toPatch)) {
to = `<${+toMajor + 1}.0.0-0`; to = `<${toMajor}.${+toMinor + 1}.0-0`;
} else if (isXVersion(toPatch)) { } else if (toPreRelease) {
to = `<${toMajor}.${+toMinor + 1}.0-0`; to = `<=${toMajor}.${toMinor}.${toPatch}-${toPreRelease}`;
} else if (toPreRelease) { } else {
to = `<=${toMajor}.${toMinor}.${toPatch}-${toPreRelease}`; to = `<=${to}`;
} else { }
to = `<=${to}`; return `${from} ${to}`.trim();
} });
return `${from} ${to}`.trim();
}
);
} }
function parseComparatorTrim(range) { function parseComparatorTrim(range) {
return range.replace(parseRegex(comparatorTrim), "$1$2$3"); return range.replace(parseRegex(comparatorTrim), "$1$2$3");
} }
function parseTildeTrim(range) { function parseTildeTrim(range) {
return range.replace(parseRegex(tildeTrim), "$1~"); return range.replace(parseRegex(tildeTrim), "$1~");
} }
function parseCaretTrim(range) { function parseCaretTrim(range) {
return range.replace(parseRegex(caretTrim), "$1^"); return range.replace(parseRegex(caretTrim), "$1^");
} }
function parseCarets(range) { function parseCarets(range) {
return range.trim().split(/\s+/).map((rangeVersion) => { return range
return rangeVersion.replace( .trim()
parseRegex(caret), .split(/\s+/)
(_, major, minor, patch, preRelease2) => { .map((rangeVersion) => {
if (isXVersion(major)) { return rangeVersion.replace(parseRegex(caret), (_, major, minor, patch, preRelease2) => {
return ""; if (isXVersion(major)) {
} else if (isXVersion(minor)) { return "";
return `>=${major}.0.0 <${+major + 1}.0.0-0`; } else if (isXVersion(minor)) {
} else if (isXVersion(patch)) { return `>=${major}.0.0 <${+major + 1}.0.0-0`;
if (major === "0") { } else if (isXVersion(patch)) {
return `>=${major}.${minor}.0 <${major}.${+minor + 1}.0-0`; if (major === "0") {
} else { return `>=${major}.${minor}.0 <${major}.${+minor + 1}.0-0`;
return `>=${major}.${minor}.0 <${+major + 1}.0.0-0`; } else {
} return `>=${major}.${minor}.0 <${+major + 1}.0.0-0`;
} else if (preRelease2) { }
if (major === "0") { } else if (preRelease2) {
if (minor === "0") { if (major === "0") {
return `>=${major}.${minor}.${patch}-${preRelease2} <${major}.${minor}.${+patch + 1}-0`; if (minor === "0") {
} else { return `>=${major}.${minor}.${patch}-${preRelease2} <${major}.${minor}.${+patch + 1}-0`;
return `>=${major}.${minor}.${patch}-${preRelease2} <${major}.${+minor + 1}.0-0`; } else {
} return `>=${major}.${minor}.${patch}-${preRelease2} <${major}.${+minor + 1}.0-0`;
} else { }
return `>=${major}.${minor}.${patch}-${preRelease2} <${+major + 1}.0.0-0`; } else {
} return `>=${major}.${minor}.${patch}-${preRelease2} <${+major + 1}.0.0-0`;
} else { }
if (major === "0") { } else {
if (minor === "0") { if (major === "0") {
return `>=${major}.${minor}.${patch} <${major}.${minor}.${+patch + 1}-0`; if (minor === "0") {
} else { return `>=${major}.${minor}.${patch} <${major}.${minor}.${+patch + 1}-0`;
return `>=${major}.${minor}.${patch} <${major}.${+minor + 1}.0-0`; } else {
} return `>=${major}.${minor}.${patch} <${major}.${+minor + 1}.0-0`;
} }
return `>=${major}.${minor}.${patch} <${+major + 1}.0.0-0`; }
} return `>=${major}.${minor}.${patch} <${+major + 1}.0.0-0`;
} }
); });
}).join(" "); })
.join(" ");
} }
function parseTildes(range) { function parseTildes(range) {
return range.trim().split(/\s+/).map((rangeVersion) => { return range
return rangeVersion.replace( .trim()
parseRegex(tilde), .split(/\s+/)
(_, major, minor, patch, preRelease2) => { .map((rangeVersion) => {
if (isXVersion(major)) { return rangeVersion.replace(parseRegex(tilde), (_, major, minor, patch, preRelease2) => {
return ""; if (isXVersion(major)) {
} else if (isXVersion(minor)) { return "";
return `>=${major}.0.0 <${+major + 1}.0.0-0`; } else if (isXVersion(minor)) {
} else if (isXVersion(patch)) { return `>=${major}.0.0 <${+major + 1}.0.0-0`;
return `>=${major}.${minor}.0 <${major}.${+minor + 1}.0-0`; } else if (isXVersion(patch)) {
} else if (preRelease2) { return `>=${major}.${minor}.0 <${major}.${+minor + 1}.0-0`;
return `>=${major}.${minor}.${patch}-${preRelease2} <${major}.${+minor + 1}.0-0`; } else if (preRelease2) {
} return `>=${major}.${minor}.${patch}-${preRelease2} <${major}.${+minor + 1}.0-0`;
return `>=${major}.${minor}.${patch} <${major}.${+minor + 1}.0-0`; }
} return `>=${major}.${minor}.${patch} <${major}.${+minor + 1}.0-0`;
); });
}).join(" "); })
.join(" ");
} }
function parseXRanges(range) { function parseXRanges(range) {
return range.split(/\s+/).map((rangeVersion) => { return range
return rangeVersion.trim().replace( .split(/\s+/)
parseRegex(xRange), .map((rangeVersion) => {
(ret, gtlt2, major, minor, patch, preRelease2) => { return rangeVersion.trim().replace(parseRegex(xRange), (ret, gtlt2, major, minor, patch, preRelease2) => {
const isXMajor = isXVersion(major); const isXMajor = isXVersion(major);
const isXMinor = isXMajor || isXVersion(minor); const isXMinor = isXMajor || isXVersion(minor);
const isXPatch = isXMinor || isXVersion(patch); const isXPatch = isXMinor || isXVersion(patch);
if (gtlt2 === "=" && isXPatch) { if (gtlt2 === "=" && isXPatch) {
gtlt2 = ""; gtlt2 = "";
} }
preRelease2 = ""; preRelease2 = "";
if (isXMajor) { if (isXMajor) {
if (gtlt2 === ">" || gtlt2 === "<") { if (gtlt2 === ">" || gtlt2 === "<") {
return "<0.0.0-0"; return "<0.0.0-0";
} else { } else {
return "*"; return "*";
} }
} else if (gtlt2 && isXPatch) { } else if (gtlt2 && isXPatch) {
if (isXMinor) { if (isXMinor) {
minor = 0; minor = 0;
} }
patch = 0; patch = 0;
if (gtlt2 === ">") { if (gtlt2 === ">") {
gtlt2 = ">="; gtlt2 = ">=";
if (isXMinor) { if (isXMinor) {
major = +major + 1; major = +major + 1;
minor = 0; minor = 0;
patch = 0; patch = 0;
} else { } else {
minor = +minor + 1; minor = +minor + 1;
patch = 0; patch = 0;
} }
} else if (gtlt2 === "<=") { } else if (gtlt2 === "<=") {
gtlt2 = "<"; gtlt2 = "<";
if (isXMinor) { if (isXMinor) {
major = +major + 1; major = +major + 1;
} else { } else {
minor = +minor + 1; minor = +minor + 1;
} }
} }
if (gtlt2 === "<") { if (gtlt2 === "<") {
preRelease2 = "-0"; preRelease2 = "-0";
} }
return `${gtlt2 + major}.${minor}.${patch}${preRelease2}`; return `${gtlt2 + major}.${minor}.${patch}${preRelease2}`;
} else if (isXMinor) { } else if (isXMinor) {
return `>=${major}.0.0${preRelease2} <${+major + 1}.0.0-0`; return `>=${major}.0.0${preRelease2} <${+major + 1}.0.0-0`;
} else if (isXPatch) { } else if (isXPatch) {
return `>=${major}.${minor}.0${preRelease2} <${major}.${+minor + 1}.0-0`; return `>=${major}.${minor}.0${preRelease2} <${major}.${+minor + 1}.0-0`;
} }
return ret; return ret;
} });
); })
}).join(" "); .join(" ");
} }
function parseStar(range) { function parseStar(range) {
return range.trim().replace(parseRegex(star), ""); return range.trim().replace(parseRegex(star), "");
} }
function parseGTE0(comparatorString) { function parseGTE0(comparatorString) {
return comparatorString.trim().replace(parseRegex(gte0), ""); return comparatorString.trim().replace(parseRegex(gte0), "");
} }
function compareAtom(rangeAtom, versionAtom) { function compareAtom(rangeAtom, versionAtom) {
rangeAtom = +rangeAtom || rangeAtom; rangeAtom = +rangeAtom || rangeAtom;
versionAtom = +versionAtom || versionAtom; versionAtom = +versionAtom || versionAtom;
if (rangeAtom > versionAtom) { if (rangeAtom > versionAtom) {
return 1; return 1;
} }
if (rangeAtom === versionAtom) { if (rangeAtom === versionAtom) {
return 0; return 0;
} }
return -1; return -1;
} }
function comparePreRelease(rangeAtom, versionAtom) { function comparePreRelease(rangeAtom, versionAtom) {
const { preRelease: rangePreRelease } = rangeAtom; const { preRelease: rangePreRelease } = rangeAtom;
const { preRelease: versionPreRelease } = versionAtom; const { preRelease: versionPreRelease } = versionAtom;
if (rangePreRelease === void 0 && !!versionPreRelease) { if (rangePreRelease === void 0 && !!versionPreRelease) {
return 1; return 1;
} }
if (!!rangePreRelease && versionPreRelease === void 0) { if (!!rangePreRelease && versionPreRelease === void 0) {
return -1; return -1;
} }
if (rangePreRelease === void 0 && versionPreRelease === void 0) { if (rangePreRelease === void 0 && versionPreRelease === void 0) {
return 0; return 0;
} }
for (let i = 0, n = rangePreRelease.length; i <= n; i++) { for (let i = 0, n = rangePreRelease.length; i <= n; i++) {
const rangeElement = rangePreRelease[i]; const rangeElement = rangePreRelease[i];
const versionElement = versionPreRelease[i]; const versionElement = versionPreRelease[i];
if (rangeElement === versionElement) { if (rangeElement === versionElement) {
continue; continue;
} }
if (rangeElement === void 0 && versionElement === void 0) { if (rangeElement === void 0 && versionElement === void 0) {
return 0; return 0;
} }
if (!rangeElement) { if (!rangeElement) {
return 1; return 1;
} }
if (!versionElement) { if (!versionElement) {
return -1; return -1;
} }
return compareAtom(rangeElement, versionElement); return compareAtom(rangeElement, versionElement);
} }
return 0; return 0;
} }
function compareVersion(rangeAtom, versionAtom) { function compareVersion(rangeAtom, versionAtom) {
return compareAtom(rangeAtom.major, versionAtom.major) || compareAtom(rangeAtom.minor, versionAtom.minor) || compareAtom(rangeAtom.patch, versionAtom.patch) || comparePreRelease(rangeAtom, versionAtom); return (
compareAtom(rangeAtom.major, versionAtom.major) ||
compareAtom(rangeAtom.minor, versionAtom.minor) ||
compareAtom(rangeAtom.patch, versionAtom.patch) ||
comparePreRelease(rangeAtom, versionAtom)
);
} }
function eq(rangeAtom, versionAtom) { function eq(rangeAtom, versionAtom) {
return rangeAtom.version === versionAtom.version; return rangeAtom.version === versionAtom.version;
} }
function compare(rangeAtom, versionAtom) { function compare(rangeAtom, versionAtom) {
switch (rangeAtom.operator) { switch (rangeAtom.operator) {
case "": case "":
case "=": case "=":
return eq(rangeAtom, versionAtom); return eq(rangeAtom, versionAtom);
case ">": case ">":
return compareVersion(rangeAtom, versionAtom) < 0; return compareVersion(rangeAtom, versionAtom) < 0;
case ">=": case ">=":
return eq(rangeAtom, versionAtom) || compareVersion(rangeAtom, versionAtom) < 0; return eq(rangeAtom, versionAtom) || compareVersion(rangeAtom, versionAtom) < 0;
case "<": case "<":
return compareVersion(rangeAtom, versionAtom) > 0; return compareVersion(rangeAtom, versionAtom) > 0;
case "<=": case "<=":
return eq(rangeAtom, versionAtom) || compareVersion(rangeAtom, versionAtom) > 0; return eq(rangeAtom, versionAtom) || compareVersion(rangeAtom, versionAtom) > 0;
case void 0: { case void 0: {
return true; return true;
} }
default: default:
return false; return false;
} }
} }
function parseComparatorString(range) { function parseComparatorString(range) {
return pipe( return pipe(parseCarets, parseTildes, parseXRanges, parseStar)(range);
parseCarets,
parseTildes,
parseXRanges,
parseStar
)(range);
} }
function parseRange(range) { function parseRange(range) {
return pipe( return pipe(parseHyphen, parseComparatorTrim, parseTildeTrim, parseCaretTrim)(range.trim()).split(/\s+/).join(" ");
parseHyphen,
parseComparatorTrim,
parseTildeTrim,
parseCaretTrim
)(range.trim()).split(/\s+/).join(" ");
} }
function satisfy(version, range) { function satisfy(version, range) {
if (!version) { if (!version) {
return false; return false;
} }
const parsedRange = parseRange(range); const parsedRange = parseRange(range);
const parsedComparator = parsedRange.split(" ").map((rangeVersion) => parseComparatorString(rangeVersion)).join(" "); const parsedComparator = parsedRange
const comparators = parsedComparator.split(/\s+/).map((comparator2) => parseGTE0(comparator2)); .split(" ")
const extractedVersion = extractComparator(version); .map((rangeVersion) => parseComparatorString(rangeVersion))
if (!extractedVersion) { .join(" ");
return false; const comparators = parsedComparator.split(/\s+/).map((comparator2) => parseGTE0(comparator2));
} const extractedVersion = extractComparator(version);
const [ if (!extractedVersion) {
, return false;
versionOperator, }
, const [, versionOperator, , versionMajor, versionMinor, versionPatch, versionPreRelease] = extractedVersion;
versionMajor, const versionAtom = {
versionMinor, version: combineVersion(versionMajor, versionMinor, versionPatch, versionPreRelease),
versionPatch, major: versionMajor,
versionPreRelease minor: versionMinor,
] = extractedVersion; patch: versionPatch,
const versionAtom = { preRelease: versionPreRelease == null ? void 0 : versionPreRelease.split("."),
version: combineVersion( };
versionMajor, for (const comparator2 of comparators) {
versionMinor, const extractedComparator = extractComparator(comparator2);
versionPatch, if (!extractedComparator) {
versionPreRelease return false;
), }
major: versionMajor, const [, rangeOperator, , rangeMajor, rangeMinor, rangePatch, rangePreRelease] = extractedComparator;
minor: versionMinor, const rangeAtom = {
patch: versionPatch, operator: rangeOperator,
preRelease: versionPreRelease == null ? void 0 : versionPreRelease.split(".") version: combineVersion(rangeMajor, rangeMinor, rangePatch, rangePreRelease),
}; major: rangeMajor,
for (const comparator2 of comparators) { minor: rangeMinor,
const extractedComparator = extractComparator(comparator2); patch: rangePatch,
if (!extractedComparator) { preRelease: rangePreRelease == null ? void 0 : rangePreRelease.split("."),
return false; };
} if (!compare(rangeAtom, versionAtom)) {
const [ return false;
, }
rangeOperator, }
, return true;
rangeMajor,
rangeMinor,
rangePatch,
rangePreRelease
] = extractedComparator;
const rangeAtom = {
operator: rangeOperator,
version: combineVersion(
rangeMajor,
rangeMinor,
rangePatch,
rangePreRelease
),
major: rangeMajor,
minor: rangeMinor,
patch: rangePatch,
preRelease: rangePreRelease == null ? void 0 : rangePreRelease.split(".")
};
if (!compare(rangeAtom, versionAtom)) {
return false;
}
}
return true;
} }
const currentImports = {}; const currentImports = {};
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const moduleMap = {'react':{get:()=>()=>__federation_import(new URL('__federation_shared_react-DoKb58Ht.js', import.meta.url).href),import:true},'react-dom':{get:()=>()=>__federation_import(new URL('__federation_shared_react-dom-DU2-P0kt.js', import.meta.url).href),import:true},'@block-ninja/ui':{get:()=>()=>__federation_import(new URL('__federation_shared_@block-ninja/ui-C3CAr7wz.js', import.meta.url).href),import:true}}; const moduleMap = {
"react": { get: () => () => __federation_import(new URL("__federation_shared_react-DoKb58Ht.js", import.meta.url).href), import: true },
"react-dom": { get: () => () => __federation_import(new URL("__federation_shared_react-dom-DU2-P0kt.js", import.meta.url).href), import: true },
"@block-ninja/ui": { get: () => () => __federation_import(new URL("__federation_shared_@block-ninja/ui-C3CAr7wz.js", import.meta.url).href), import: true },
};
const moduleCache = Object.create(null); const moduleCache = Object.create(null);
async function importShared(name, shareScope = 'default') { async function importShared(name, shareScope = "default") {
return moduleCache[name] return moduleCache[name] ? new Promise((r) => r(moduleCache[name])) : (await getSharedFromRuntime(name, shareScope)) || getSharedFromLocal(name);
? new Promise((r) => r(moduleCache[name]))
: (await getSharedFromRuntime(name, shareScope)) || getSharedFromLocal(name)
} }
// eslint-disable-next-line // eslint-disable-next-line
async function __federation_import(name) { async function __federation_import(name) {
currentImports[name] ??= import(name); currentImports[name] ??= import(name);
return currentImports[name] return currentImports[name];
} }
async function getSharedFromRuntime(name, shareScope) { async function getSharedFromRuntime(name, shareScope) {
let module = null; let module = null;
if (globalThis?.__federation_shared__?.[shareScope]?.[name]) { if (globalThis?.__federation_shared__?.[shareScope]?.[name]) {
const versionObj = globalThis.__federation_shared__[shareScope][name]; const versionObj = globalThis.__federation_shared__[shareScope][name];
const requiredVersion = moduleMap[name]?.requiredVersion; const requiredVersion = moduleMap[name]?.requiredVersion;
const hasRequiredVersion = !!requiredVersion; const hasRequiredVersion = !!requiredVersion;
if (hasRequiredVersion) { if (hasRequiredVersion) {
const versionKey = Object.keys(versionObj).find((version) => const versionKey = Object.keys(versionObj).find((version) => satisfy(version, requiredVersion));
satisfy(version, requiredVersion) if (versionKey) {
); const versionValue = versionObj[versionKey];
if (versionKey) { module = await (await versionValue.get())();
const versionValue = versionObj[versionKey]; } else {
module = await (await versionValue.get())(); console.log(`provider support ${name}(${versionKey}) is not satisfied requiredVersion(\${moduleMap[name].requiredVersion})`);
} else { }
console.log( } else {
`provider support ${name}(${versionKey}) is not satisfied requiredVersion(\${moduleMap[name].requiredVersion})` const versionKey = Object.keys(versionObj)[0];
); const versionValue = versionObj[versionKey];
} module = await (await versionValue.get())();
} else { }
const versionKey = Object.keys(versionObj)[0]; }
const versionValue = versionObj[versionKey]; if (module) {
module = await (await versionValue.get())(); return flattenModule(module, name);
} }
}
if (module) {
return flattenModule(module, name)
}
} }
async function getSharedFromLocal(name) { async function getSharedFromLocal(name) {
if (moduleMap[name]?.import) { if (moduleMap[name]?.import) {
let module = await (await moduleMap[name].get())(); let module = await (await moduleMap[name].get())();
return flattenModule(module, name) return flattenModule(module, name);
} else { } else {
console.error( console.error(`consumer config import=false,so cant use callback shared module`);
`consumer config import=false,so cant use callback shared module` }
);
}
} }
function flattenModule(module, name) { function flattenModule(module, name) {
// use a shared module which export default a function will getting error 'TypeError: xxx is not a function' // use a shared module which export default a function will getting error 'TypeError: xxx is not a function'
if (typeof module.default === 'function') { if (typeof module.default === "function") {
Object.keys(module).forEach((key) => { Object.keys(module).forEach((key) => {
if (key !== 'default') { if (key !== "default") {
module.default[key] = module[key]; module.default[key] = module[key];
} }
}); });
moduleCache[name] = module.default; moduleCache[name] = module.default;
return module.default return module.default;
} }
if (module.default) module = Object.assign({}, module.default, module); if (module.default) module = Object.assign({}, module.default, module);
moduleCache[name] = module; moduleCache[name] = module;
return module return module;
} }
export { importShared, getSharedFromLocal as importSharedLocal, getSharedFromRuntime as importSharedRuntime }; export { importShared, getSharedFromLocal as importSharedLocal, getSharedFromRuntime as importSharedRuntime };

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
import { g as getDefaultExportFromCjs } from './_commonjsHelpers-B85MJLTf.js'; import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-B85MJLTf.js";
import { r as requireReact } from './index-DQGM2Mpm.js'; import { r as requireReact } from "./index-DQGM2Mpm.js";
var reactExports = requireReact(); var reactExports = requireReact();
const index = /*@__PURE__*/getDefaultExportFromCjs(reactExports); const index = /*@__PURE__*/ getDefaultExportFromCjs(reactExports);
export { index as default }; export { index as default };

View File

@ -1,7 +1,7 @@
import { g as getDefaultExportFromCjs } from './_commonjsHelpers-B85MJLTf.js'; import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-B85MJLTf.js";
import { r as requireReactDom } from './index-eoEhLOdg.js'; import { r as requireReactDom } from "./index-eoEhLOdg.js";
var reactDomExports = requireReactDom(); var reactDomExports = requireReactDom();
const index = /*@__PURE__*/getDefaultExportFromCjs(reactDomExports); const index = /*@__PURE__*/ getDefaultExportFromCjs(reactDomExports);
export { index as default }; export { index as default };

View File

@ -1,5 +1,5 @@
function getDefaultExportFromCjs (x) { function getDefaultExportFromCjs(x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
} }
export { getDefaultExportFromCjs as g }; export { getDefaultExportFromCjs as g };

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
import { importShared } from './__federation_fn_import-hlt2XzeI.js'; import { importShared } from "./__federation_fn_import-hlt2XzeI.js";
import { X as requireShim } from './index-Bs--Ol2m.js'; import { X as requireShim } from "./index-Bs--Ol2m.js";
/** /**
* @license lucide-react v0.468.0 - ISC * @license lucide-react v0.468.0 - ISC
@ -9,9 +9,13 @@ import { X as requireShim } from './index-Bs--Ol2m.js';
*/ */
const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(); const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
const mergeClasses = (...classes) => classes.filter((className, index, array) => { const mergeClasses = (...classes) =>
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index; classes
}).join(" ").trim(); .filter((className, index, array) => {
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
})
.join(" ")
.trim();
/** /**
* @license lucide-react v0.468.0 - ISC * @license lucide-react v0.468.0 - ISC
@ -21,15 +25,15 @@ const mergeClasses = (...classes) => classes.filter((className, index, array) =>
*/ */
var defaultAttributes = { var defaultAttributes = {
xmlns: "http://www.w3.org/2000/svg", xmlns: "http://www.w3.org/2000/svg",
width: 24, width: 24,
height: 24, height: 24,
viewBox: "0 0 24 24", viewBox: "0 0 24 24",
fill: "none", fill: "none",
stroke: "currentColor", stroke: "currentColor",
strokeWidth: 2, strokeWidth: 2,
strokeLinecap: "round", strokeLinecap: "round",
strokeLinejoin: "round" strokeLinejoin: "round",
}; };
/** /**
@ -39,38 +43,24 @@ var defaultAttributes = {
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/ */
const {forwardRef: forwardRef$1,createElement: createElement$1} = await importShared('react'); const { forwardRef: forwardRef$1, createElement: createElement$1 } = await importShared("react");
const Icon = forwardRef$1( const Icon = forwardRef$1(({ color = "currentColor", size = 24, strokeWidth = 2, absoluteStrokeWidth, className = "", children, iconNode, ...rest }, ref) => {
({ return createElement$1(
color = "currentColor", "svg",
size = 24, {
strokeWidth = 2, ref,
absoluteStrokeWidth, ...defaultAttributes,
className = "", width: size,
children, height: size,
iconNode, stroke: color,
...rest strokeWidth: absoluteStrokeWidth ? (Number(strokeWidth) * 24) / Number(size) : strokeWidth,
}, ref) => { className: mergeClasses("lucide", className),
return createElement$1( ...rest,
"svg", },
{ [...iconNode.map(([tag, attrs]) => createElement$1(tag, attrs)), ...(Array.isArray(children) ? children : [children])],
ref, );
...defaultAttributes, });
width: size,
height: size,
stroke: color,
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
className: mergeClasses("lucide", className),
...rest
},
[
...iconNode.map(([tag, attrs]) => createElement$1(tag, attrs)),
...Array.isArray(children) ? children : [children]
]
);
}
);
/** /**
* @license lucide-react v0.468.0 - ISC * @license lucide-react v0.468.0 - ISC
@ -79,19 +69,19 @@ const Icon = forwardRef$1(
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/ */
const {forwardRef,createElement} = await importShared('react'); const { forwardRef, createElement } = await importShared("react");
const createLucideIcon = (iconName, iconNode) => { const createLucideIcon = (iconName, iconNode) => {
const Component = forwardRef( const Component = forwardRef(({ className, ...props }, ref) =>
({ className, ...props }, ref) => createElement(Icon, { createElement(Icon, {
ref, ref,
iconNode, iconNode,
className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className), className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),
...props ...props,
}) }),
); );
Component.displayName = `${iconName}`; Component.displayName = `${iconName}`;
return Component; return Component;
}; };
/** /**
@ -101,14 +91,13 @@ const createLucideIcon = (iconName, iconNode) => {
* See the LICENSE file in the root directory of this source tree. * See the LICENSE file in the root directory of this source tree.
*/ */
const List = createLucideIcon("List", [ const List = createLucideIcon("List", [
["path", { d: "M3 12h.01", key: "nlz23k" }], ["path", { d: "M3 12h.01", key: "nlz23k" }],
["path", { d: "M3 18h.01", key: "1tta3j" }], ["path", { d: "M3 18h.01", key: "1tta3j" }],
["path", { d: "M3 6h.01", key: "1rqtza" }], ["path", { d: "M3 6h.01", key: "1rqtza" }],
["path", { d: "M8 12h13", key: "1za7za" }], ["path", { d: "M8 12h13", key: "1za7za" }],
["path", { d: "M8 18h13", key: "1lx6n3" }], ["path", { d: "M8 18h13", key: "1lx6n3" }],
["path", { d: "M8 6h13", key: "ik3vkj" }] ["path", { d: "M8 6h13", key: "ik3vkj" }],
]); ]);
var shimExports = requireShim(); var shimExports = requireShim();

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
var react = {exports: {}}; var react = { exports: {} };
var react_production_min = {}; var react_production_min = {};
@ -14,36 +14,332 @@ var react_production_min = {};
var hasRequiredReact_production_min; var hasRequiredReact_production_min;
function requireReact_production_min () { function requireReact_production_min() {
if (hasRequiredReact_production_min) return react_production_min; if (hasRequiredReact_production_min) return react_production_min;
hasRequiredReact_production_min = 1; hasRequiredReact_production_min = 1;
var l=Symbol.for("react.element"),n=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),t=Symbol.for("react.provider"),u=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),z=Symbol.iterator;function A(a){if(null===a||"object"!==typeof a)return null;a=z&&a[z]||a["@@iterator"];return "function"===typeof a?a:null} var l = Symbol.for("react.element"),
var B={isMounted:function(){return false},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B;}E.prototype.isReactComponent={}; n = Symbol.for("react.portal"),
E.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,a,b,"setState");};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B;}var H=G.prototype=new F; p = Symbol.for("react.fragment"),
H.constructor=G;C(H,E.prototype);H.isPureReactComponent=true;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:true,ref:true,__self:true,__source:true}; q = Symbol.for("react.strict_mode"),
function M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];c.children=f;}if(a&&a.defaultProps)for(d in g=a.defaultProps,g) void 0===c[d]&&(c[d]=g[d]);return {$$typeof:l,type:a,key:k,ref:h,props:c,_owner:K.current}} r = Symbol.for("react.profiler"),
function N(a,b){return {$$typeof:l,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function O(a){return "object"===typeof a&&null!==a&&a.$$typeof===l}function escape(a){var b={"=":"=0",":":"=2"};return "$"+a.replace(/[=:]/g,function(a){return b[a]})}var P=/\/+/g;function Q(a,b){return "object"===typeof a&&null!==a&&null!=a.key?escape(""+a.key):b.toString(36)} t = Symbol.for("react.provider"),
function R(a,b,e,d,c){var k=typeof a;if("undefined"===k||"boolean"===k)a=null;var h=false;if(null===a)h=true;else switch(k){case "string":case "number":h=true;break;case "object":switch(a.$$typeof){case l:case n:h=true;}}if(h)return h=a,c=c(h),a=""===d?"."+Q(h,0):d,I(c)?(e="",null!=a&&(e=a.replace(P,"$&/")+"/"),R(c,b,e,"",function(a){return a})):null!=c&&(O(c)&&(c=N(c,e+(!c.key||h&&h.key===c.key?"":(""+c.key).replace(P,"$&/")+"/")+a)),b.push(c)),1;h=0;d=""===d?".":d+":";if(I(a))for(var g=0;g<a.length;g++){k= u = Symbol.for("react.context"),
a[g];var f=d+Q(k,g);h+=R(k,b,e,f,c);}else if(f=A(a),"function"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=d+Q(k,g++),h+=R(k,b,e,f,c);else if("object"===k)throw b=String(a),Error("Objects are not valid as a React child (found: "+("[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b)+"). If you meant to render a collection of children, use an array instead.");return h} v = Symbol.for("react.forward_ref"),
function S(a,b,e){if(null==a)return a;var d=[],c=0;R(a,d,"","",function(a){return b.call(e,a,c++)});return d}function T(a){if(-1===a._status){var b=a._result;b=b();b.then(function(b){if(0===a._status||-1===a._status)a._status=1,a._result=b;},function(b){if(0===a._status||-1===a._status)a._status=2,a._result=b;});-1===a._status&&(a._status=0,a._result=b);}if(1===a._status)return a._result.default;throw a._result;} w = Symbol.for("react.suspense"),
var U={current:null},V={transition:null},W={ReactCurrentDispatcher:U,ReactCurrentBatchConfig:V,ReactCurrentOwner:K};function X(){throw Error("act(...) is not supported in production builds of React.");} x = Symbol.for("react.memo"),
react_production_min.Children={map:S,forEach:function(a,b,e){S(a,function(){b.apply(this,arguments);},e);},count:function(a){var b=0;S(a,function(){b++;});return b},toArray:function(a){return S(a,function(a){return a})||[]},only:function(a){if(!O(a))throw Error("React.Children.only expected to receive a single React element child.");return a}};react_production_min.Component=E;react_production_min.Fragment=p;react_production_min.Profiler=r;react_production_min.PureComponent=G;react_production_min.StrictMode=q;react_production_min.Suspense=w; y = Symbol.for("react.lazy"),
react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W;react_production_min.act=X; z = Symbol.iterator;
react_production_min.cloneElement=function(a,b,e){if(null===a||void 0===a)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+a+".");var d=C({},a.props),c=a.key,k=a.ref,h=a._owner;if(null!=b){ void 0!==b.ref&&(k=b.ref,h=K.current);void 0!==b.key&&(c=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)J.call(b,f)&&!L.hasOwnProperty(f)&&(d[f]=void 0===b[f]&&void 0!==g?g[f]:b[f]);}var f=arguments.length-2;if(1===f)d.children=e;else if(1<f){g=Array(f); function A(a) {
for(var m=0;m<f;m++)g[m]=arguments[m+2];d.children=g;}return {$$typeof:l,type:a.type,key:c,ref:k,props:d,_owner:h}};react_production_min.createContext=function(a){a={$$typeof:u,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};a.Provider={$$typeof:t,_context:a};return a.Consumer=a};react_production_min.createElement=M;react_production_min.createFactory=function(a){var b=M.bind(null,a);b.type=a;return b};react_production_min.createRef=function(){return {current:null}}; if (null === a || "object" !== typeof a) return null;
react_production_min.forwardRef=function(a){return {$$typeof:v,render:a}};react_production_min.isValidElement=O;react_production_min.lazy=function(a){return {$$typeof:y,_payload:{_status:-1,_result:a},_init:T}};react_production_min.memo=function(a,b){return {$$typeof:x,type:a,compare:void 0===b?null:b}};react_production_min.startTransition=function(a){var b=V.transition;V.transition={};try{a();}finally{V.transition=b;}};react_production_min.unstable_act=X;react_production_min.useCallback=function(a,b){return U.current.useCallback(a,b)};react_production_min.useContext=function(a){return U.current.useContext(a)}; a = (z && a[z]) || a["@@iterator"];
react_production_min.useDebugValue=function(){};react_production_min.useDeferredValue=function(a){return U.current.useDeferredValue(a)};react_production_min.useEffect=function(a,b){return U.current.useEffect(a,b)};react_production_min.useId=function(){return U.current.useId()};react_production_min.useImperativeHandle=function(a,b,e){return U.current.useImperativeHandle(a,b,e)};react_production_min.useInsertionEffect=function(a,b){return U.current.useInsertionEffect(a,b)};react_production_min.useLayoutEffect=function(a,b){return U.current.useLayoutEffect(a,b)}; return "function" === typeof a ? a : null;
react_production_min.useMemo=function(a,b){return U.current.useMemo(a,b)};react_production_min.useReducer=function(a,b,e){return U.current.useReducer(a,b,e)};react_production_min.useRef=function(a){return U.current.useRef(a)};react_production_min.useState=function(a){return U.current.useState(a)};react_production_min.useSyncExternalStore=function(a,b,e){return U.current.useSyncExternalStore(a,b,e)};react_production_min.useTransition=function(){return U.current.useTransition()};react_production_min.version="18.3.1"; }
var B = {
isMounted: function () {
return false;
},
enqueueForceUpdate: function () {},
enqueueReplaceState: function () {},
enqueueSetState: function () {},
},
C = Object.assign,
D = {};
function E(a, b, e) {
this.props = a;
this.context = b;
this.refs = D;
this.updater = e || B;
}
E.prototype.isReactComponent = {};
E.prototype.setState = function (a, b) {
if ("object" !== typeof a && "function" !== typeof a && null != a)
throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
this.updater.enqueueSetState(this, a, b, "setState");
};
E.prototype.forceUpdate = function (a) {
this.updater.enqueueForceUpdate(this, a, "forceUpdate");
};
function F() {}
F.prototype = E.prototype;
function G(a, b, e) {
this.props = a;
this.context = b;
this.refs = D;
this.updater = e || B;
}
var H = (G.prototype = new F());
H.constructor = G;
C(H, E.prototype);
H.isPureReactComponent = true;
var I = Array.isArray,
J = Object.prototype.hasOwnProperty,
K = { current: null },
L = { key: true, ref: true, __self: true, __source: true };
function M(a, b, e) {
var d,
c = {},
k = null,
h = null;
if (null != b) for (d in (void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k = "" + b.key), b)) J.call(b, d) && !L.hasOwnProperty(d) && (c[d] = b[d]);
var g = arguments.length - 2;
if (1 === g) c.children = e;
else if (1 < g) {
for (var f = Array(g), m = 0; m < g; m++) f[m] = arguments[m + 2];
c.children = f;
}
if (a && a.defaultProps) for (d in ((g = a.defaultProps), g)) void 0 === c[d] && (c[d] = g[d]);
return { $$typeof: l, type: a, key: k, ref: h, props: c, _owner: K.current };
}
function N(a, b) {
return { $$typeof: l, type: a.type, key: b, ref: a.ref, props: a.props, _owner: a._owner };
}
function O(a) {
return "object" === typeof a && null !== a && a.$$typeof === l;
}
function escape(a) {
var b = { "=": "=0", ":": "=2" };
return (
"$" +
a.replace(/[=:]/g, function (a) {
return b[a];
})
);
}
var P = /\/+/g;
function Q(a, b) {
return "object" === typeof a && null !== a && null != a.key ? escape("" + a.key) : b.toString(36);
}
function R(a, b, e, d, c) {
var k = typeof a;
if ("undefined" === k || "boolean" === k) a = null;
var h = false;
if (null === a) h = true;
else
switch (k) {
case "string":
case "number":
h = true;
break;
case "object":
switch (a.$$typeof) {
case l:
case n:
h = true;
}
}
if (h)
return (
(h = a),
(c = c(h)),
(a = "" === d ? "." + Q(h, 0) : d),
I(c) ?
((e = ""),
null != a && (e = a.replace(P, "$&/") + "/"),
R(c, b, e, "", function (a) {
return a;
}))
: null != c && (O(c) && (c = N(c, e + (!c.key || (h && h.key === c.key) ? "" : ("" + c.key).replace(P, "$&/") + "/") + a)), b.push(c)),
1
);
h = 0;
d = "" === d ? "." : d + ":";
if (I(a))
for (var g = 0; g < a.length; g++) {
k = a[g];
var f = d + Q(k, g);
h += R(k, b, e, f, c);
}
else if (((f = A(a)), "function" === typeof f)) for (a = f.call(a), g = 0; !(k = a.next()).done; ) ((k = k.value), (f = d + Q(k, g++)), (h += R(k, b, e, f, c)));
else if ("object" === k)
throw (
(b = String(a)),
Error(
"Objects are not valid as a React child (found: " +
("[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b) +
"). If you meant to render a collection of children, use an array instead.",
)
);
return h;
}
function S(a, b, e) {
if (null == a) return a;
var d = [],
c = 0;
R(a, d, "", "", function (a) {
return b.call(e, a, c++);
});
return d;
}
function T(a) {
if (-1 === a._status) {
var b = a._result;
b = b();
b.then(
function (b) {
if (0 === a._status || -1 === a._status) ((a._status = 1), (a._result = b));
},
function (b) {
if (0 === a._status || -1 === a._status) ((a._status = 2), (a._result = b));
},
);
-1 === a._status && ((a._status = 0), (a._result = b));
}
if (1 === a._status) return a._result.default;
throw a._result;
}
var U = { current: null },
V = { transition: null },
W = { ReactCurrentDispatcher: U, ReactCurrentBatchConfig: V, ReactCurrentOwner: K };
function X() {
throw Error("act(...) is not supported in production builds of React.");
}
react_production_min.Children = {
map: S,
forEach: function (a, b, e) {
S(
a,
function () {
b.apply(this, arguments);
},
e,
);
},
count: function (a) {
var b = 0;
S(a, function () {
b++;
});
return b;
},
toArray: function (a) {
return (
S(a, function (a) {
return a;
}) || []
);
},
only: function (a) {
if (!O(a)) throw Error("React.Children.only expected to receive a single React element child.");
return a;
},
};
react_production_min.Component = E;
react_production_min.Fragment = p;
react_production_min.Profiler = r;
react_production_min.PureComponent = G;
react_production_min.StrictMode = q;
react_production_min.Suspense = w;
react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W;
react_production_min.act = X;
react_production_min.cloneElement = function (a, b, e) {
if (null === a || void 0 === a) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + ".");
var d = C({}, a.props),
c = a.key,
k = a.ref,
h = a._owner;
if (null != b) {
void 0 !== b.ref && ((k = b.ref), (h = K.current));
void 0 !== b.key && (c = "" + b.key);
if (a.type && a.type.defaultProps) var g = a.type.defaultProps;
for (f in b) J.call(b, f) && !L.hasOwnProperty(f) && (d[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]);
}
var f = arguments.length - 2;
if (1 === f) d.children = e;
else if (1 < f) {
g = Array(f);
for (var m = 0; m < f; m++) g[m] = arguments[m + 2];
d.children = g;
}
return { $$typeof: l, type: a.type, key: c, ref: k, props: d, _owner: h };
};
react_production_min.createContext = function (a) {
a = { $$typeof: u, _currentValue: a, _currentValue2: a, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null };
a.Provider = { $$typeof: t, _context: a };
return (a.Consumer = a);
};
react_production_min.createElement = M;
react_production_min.createFactory = function (a) {
var b = M.bind(null, a);
b.type = a;
return b;
};
react_production_min.createRef = function () {
return { current: null };
};
react_production_min.forwardRef = function (a) {
return { $$typeof: v, render: a };
};
react_production_min.isValidElement = O;
react_production_min.lazy = function (a) {
return { $$typeof: y, _payload: { _status: -1, _result: a }, _init: T };
};
react_production_min.memo = function (a, b) {
return { $$typeof: x, type: a, compare: void 0 === b ? null : b };
};
react_production_min.startTransition = function (a) {
var b = V.transition;
V.transition = {};
try {
a();
} finally {
V.transition = b;
}
};
react_production_min.unstable_act = X;
react_production_min.useCallback = function (a, b) {
return U.current.useCallback(a, b);
};
react_production_min.useContext = function (a) {
return U.current.useContext(a);
};
react_production_min.useDebugValue = function () {};
react_production_min.useDeferredValue = function (a) {
return U.current.useDeferredValue(a);
};
react_production_min.useEffect = function (a, b) {
return U.current.useEffect(a, b);
};
react_production_min.useId = function () {
return U.current.useId();
};
react_production_min.useImperativeHandle = function (a, b, e) {
return U.current.useImperativeHandle(a, b, e);
};
react_production_min.useInsertionEffect = function (a, b) {
return U.current.useInsertionEffect(a, b);
};
react_production_min.useLayoutEffect = function (a, b) {
return U.current.useLayoutEffect(a, b);
};
react_production_min.useMemo = function (a, b) {
return U.current.useMemo(a, b);
};
react_production_min.useReducer = function (a, b, e) {
return U.current.useReducer(a, b, e);
};
react_production_min.useRef = function (a) {
return U.current.useRef(a);
};
react_production_min.useState = function (a) {
return U.current.useState(a);
};
react_production_min.useSyncExternalStore = function (a, b, e) {
return U.current.useSyncExternalStore(a, b, e);
};
react_production_min.useTransition = function () {
return U.current.useTransition();
};
react_production_min.version = "18.3.1";
return react_production_min; return react_production_min;
} }
var hasRequiredReact; var hasRequiredReact;
function requireReact () { function requireReact() {
if (hasRequiredReact) return react.exports; if (hasRequiredReact) return react.exports;
hasRequiredReact = 1; hasRequiredReact = 1;
{ {
react.exports = requireReact_production_min(); react.exports = requireReact_production_min();
} }
return react.exports; return react.exports;
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
import { r as requireReact } from './index-DQGM2Mpm.js'; import { r as requireReact } from "./index-DQGM2Mpm.js";
var jsxRuntime = {exports: {}}; var jsxRuntime = { exports: {} };
var reactJsxRuntime_production_min = {}; var reactJsxRuntime_production_min = {};
@ -16,21 +16,40 @@ var reactJsxRuntime_production_min = {};
var hasRequiredReactJsxRuntime_production_min; var hasRequiredReactJsxRuntime_production_min;
function requireReactJsxRuntime_production_min () { function requireReactJsxRuntime_production_min() {
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min; if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
hasRequiredReactJsxRuntime_production_min = 1; hasRequiredReactJsxRuntime_production_min = 1;
var f=requireReact(),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:true,ref:true,__self:true,__source:true}; var f = requireReact(),
function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a) void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q; k = Symbol.for("react.element"),
l = Symbol.for("react.fragment"),
m = Object.prototype.hasOwnProperty,
n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,
p = { key: true, ref: true, __self: true, __source: true };
function q(c, a, g) {
var b,
d = {},
e = null,
h = null;
void 0 !== g && (e = "" + g);
void 0 !== a.key && (e = "" + a.key);
void 0 !== a.ref && (h = a.ref);
for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
if (c && c.defaultProps) for (b in ((a = c.defaultProps), a)) void 0 === d[b] && (d[b] = a[b]);
return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
}
reactJsxRuntime_production_min.Fragment = l;
reactJsxRuntime_production_min.jsx = q;
reactJsxRuntime_production_min.jsxs = q;
return reactJsxRuntime_production_min; return reactJsxRuntime_production_min;
} }
var hasRequiredJsxRuntime; var hasRequiredJsxRuntime;
function requireJsxRuntime () { function requireJsxRuntime() {
if (hasRequiredJsxRuntime) return jsxRuntime.exports; if (hasRequiredJsxRuntime) return jsxRuntime.exports;
hasRequiredJsxRuntime = 1; hasRequiredJsxRuntime = 1;
{ {
jsxRuntime.exports = requireReactJsxRuntime_production_min(); jsxRuntime.exports = requireReactJsxRuntime_production_min();
} }
return jsxRuntime.exports; return jsxRuntime.exports;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,84 +1,88 @@
const currentImports = {}; const currentImports = {};
const exportSet = new Set(['Module', '__esModule', 'default', '_export_sfc']); const exportSet = new Set(["Module", "__esModule", "default", "_export_sfc"]);
let moduleMap = { let moduleMap = {
"./editor":()=>{ "./editor": () => {
dynamicLoadingCss(["style-Bs2zy9jQ.css"], false, './editor'); dynamicLoadingCss(["style-Bs2zy9jQ.css"], false, "./editor");
return __federation_import('./__federation_expose_Editor-DbTTOPh9.js').then(module =>Object.keys(module).every(item => exportSet.has(item)) ? () => module.default : () => module)}, return __federation_import("./__federation_expose_Editor-DbTTOPh9.js").then((module) => (Object.keys(module).every((item) => exportSet.has(item)) ? () => module.default : () => module));
"./settings":()=>{ },
dynamicLoadingCss(["style-Bs2zy9jQ.css"], false, './settings'); "./settings": () => {
return __federation_import('./__federation_expose_Settings-C7jFM1o4.js').then(module =>Object.keys(module).every(item => exportSet.has(item)) ? () => module.default : () => module)},}; dynamicLoadingCss(["style-Bs2zy9jQ.css"], false, "./settings");
const seen = {}; return __federation_import("./__federation_expose_Settings-C7jFM1o4.js").then((module) => (Object.keys(module).every((item) => exportSet.has(item)) ? () => module.default : () => module));
const dynamicLoadingCss = (cssFilePaths, dontAppendStylesToHead, exposeItemName) => { },
const metaUrl = import.meta.url; };
if (typeof metaUrl === 'undefined') { const seen = {};
console.warn('The remote style takes effect only when the build.target option in the vite.config.ts file is higher than that of "es2020".'); const dynamicLoadingCss = (cssFilePaths, dontAppendStylesToHead, exposeItemName) => {
return; const metaUrl = import.meta.url;
} if (typeof metaUrl === "undefined") {
console.warn('The remote style takes effect only when the build.target option in the vite.config.ts file is higher than that of "es2020".');
return;
}
const curUrl = metaUrl.substring(0, metaUrl.lastIndexOf('remoteEntry.js')); const curUrl = metaUrl.substring(0, metaUrl.lastIndexOf("remoteEntry.js"));
const base = '/'; const base = "/";
'assets'; ("assets");
cssFilePaths.forEach(cssPath => { cssFilePaths.forEach((cssPath) => {
let href = ''; let href = "";
const baseUrl = base || curUrl; const baseUrl = base || curUrl;
if (baseUrl) { if (baseUrl) {
const trimmer = { const trimmer = {
trailing: (path) => (path.endsWith('/') ? path.slice(0, -1) : path), trailing: (path) => (path.endsWith("/") ? path.slice(0, -1) : path),
leading: (path) => (path.startsWith('/') ? path.slice(1) : path) leading: (path) => (path.startsWith("/") ? path.slice(1) : path),
}; };
const isAbsoluteUrl = (url) => url.startsWith('http') || url.startsWith('//'); const isAbsoluteUrl = (url) => url.startsWith("http") || url.startsWith("//");
const cleanBaseUrl = trimmer.trailing(baseUrl); const cleanBaseUrl = trimmer.trailing(baseUrl);
const cleanCssPath = trimmer.leading(cssPath); const cleanCssPath = trimmer.leading(cssPath);
const cleanCurUrl = trimmer.trailing(curUrl); const cleanCurUrl = trimmer.trailing(curUrl);
if (isAbsoluteUrl(baseUrl)) { if (isAbsoluteUrl(baseUrl)) {
href = [cleanBaseUrl, cleanCssPath].filter(Boolean).join('/'); href = [cleanBaseUrl, cleanCssPath].filter(Boolean).join("/");
} else { } else {
if (cleanCurUrl.includes(cleanBaseUrl)) { if (cleanCurUrl.includes(cleanBaseUrl)) {
href = [cleanCurUrl, cleanCssPath].filter(Boolean).join('/'); href = [cleanCurUrl, cleanCssPath].filter(Boolean).join("/");
} else { } else {
href = [cleanCurUrl + cleanBaseUrl, cleanCssPath].filter(Boolean).join('/'); href = [cleanCurUrl + cleanBaseUrl, cleanCssPath].filter(Boolean).join("/");
} }
} }
} else { } else {
href = cssPath; href = cssPath;
} }
if (dontAppendStylesToHead) {
const key = 'css__calcomblock__' + exposeItemName;
window[key] = window[key] || [];
window[key].push(href);
return;
}
if (href in seen) return; if (dontAppendStylesToHead) {
seen[href] = true; const key = "css__calcomblock__" + exposeItemName;
window[key] = window[key] || [];
window[key].push(href);
return;
}
const element = document.createElement('link'); if (href in seen) return;
element.rel = 'stylesheet'; seen[href] = true;
element.href = href;
document.head.appendChild(element); const element = document.createElement("link");
}); element.rel = "stylesheet";
}; element.href = href;
async function __federation_import(name) { document.head.appendChild(element);
currentImports[name] ??= import(name); });
return currentImports[name] };
} const get =(module) => { async function __federation_import(name) {
if(!moduleMap[module]) throw new Error('Can not find remote module ' + module) currentImports[name] ??= import(name);
return moduleMap[module](); return currentImports[name];
}; }
const init =(shareScope) => { const get = (module) => {
globalThis.__federation_shared__= globalThis.__federation_shared__|| {}; if (!moduleMap[module]) throw new Error("Can not find remote module " + module);
Object.entries(shareScope).forEach(([key, value]) => { return moduleMap[module]();
for (const [versionKey, versionValue] of Object.entries(value)) { };
const scope = versionValue.scope || 'default'; const init = (shareScope) => {
globalThis.__federation_shared__[scope] = globalThis.__federation_shared__[scope] || {}; globalThis.__federation_shared__ = globalThis.__federation_shared__ || {};
const shared= globalThis.__federation_shared__[scope]; Object.entries(shareScope).forEach(([key, value]) => {
(shared[key] = shared[key]||{})[versionKey] = versionValue; for (const [versionKey, versionValue] of Object.entries(value)) {
} const scope = versionValue.scope || "default";
}); globalThis.__federation_shared__[scope] = globalThis.__federation_shared__[scope] || {};
}; const shared = globalThis.__federation_shared__[scope];
(shared[key] = shared[key] || {})[versionKey] = versionValue;
}
});
};
export { dynamicLoadingCss, get, init }; export { dynamicLoadingCss, get, init };

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
import { r as requireReact } from './index-DQGM2Mpm.js'; import { r as requireReact } from "./index-DQGM2Mpm.js";
import { X as requireShim } from './index-Bs--Ol2m.js'; import { X as requireShim } from "./index-Bs--Ol2m.js";
var withSelector = {exports: {}}; var withSelector = { exports: {} };
var withSelector_production = {}; var withSelector_production = {};
@ -17,93 +17,84 @@ var withSelector_production = {};
var hasRequiredWithSelector_production; var hasRequiredWithSelector_production;
function requireWithSelector_production () { function requireWithSelector_production() {
if (hasRequiredWithSelector_production) return withSelector_production; if (hasRequiredWithSelector_production) return withSelector_production;
hasRequiredWithSelector_production = 1; hasRequiredWithSelector_production = 1;
var React = requireReact(), var React = requireReact(),
shim = requireShim(); shim = requireShim();
function is(x, y) { function is(x, y) {
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
} }
var objectIs = "function" === typeof Object.is ? Object.is : is, var objectIs = "function" === typeof Object.is ? Object.is : is,
useSyncExternalStore = shim.useSyncExternalStore, useSyncExternalStore = shim.useSyncExternalStore,
useRef = React.useRef, useRef = React.useRef,
useEffect = React.useEffect, useEffect = React.useEffect,
useMemo = React.useMemo, useMemo = React.useMemo,
useDebugValue = React.useDebugValue; useDebugValue = React.useDebugValue;
withSelector_production.useSyncExternalStoreWithSelector = function ( withSelector_production.useSyncExternalStoreWithSelector = function (subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
subscribe, var instRef = useRef(null);
getSnapshot, if (null === instRef.current) {
getServerSnapshot, var inst = { hasValue: false, value: null };
selector, instRef.current = inst;
isEqual } else inst = instRef.current;
) { instRef = useMemo(
var instRef = useRef(null); function () {
if (null === instRef.current) { function memoizedSelector(nextSnapshot) {
var inst = { hasValue: false, value: null }; if (!hasMemo) {
instRef.current = inst; hasMemo = true;
} else inst = instRef.current; memoizedSnapshot = nextSnapshot;
instRef = useMemo( nextSnapshot = selector(nextSnapshot);
function () { if (void 0 !== isEqual && inst.hasValue) {
function memoizedSelector(nextSnapshot) { var currentSelection = inst.value;
if (!hasMemo) { if (isEqual(currentSelection, nextSnapshot)) return (memoizedSelection = currentSelection);
hasMemo = true; }
memoizedSnapshot = nextSnapshot; return (memoizedSelection = nextSnapshot);
nextSnapshot = selector(nextSnapshot); }
if (void 0 !== isEqual && inst.hasValue) { currentSelection = memoizedSelection;
var currentSelection = inst.value; if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
if (isEqual(currentSelection, nextSnapshot)) var nextSelection = selector(nextSnapshot);
return (memoizedSelection = currentSelection); if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) return ((memoizedSnapshot = nextSnapshot), currentSelection);
} memoizedSnapshot = nextSnapshot;
return (memoizedSelection = nextSnapshot); return (memoizedSelection = nextSelection);
} }
currentSelection = memoizedSelection; var hasMemo = false,
if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection; memoizedSnapshot,
var nextSelection = selector(nextSnapshot); memoizedSelection,
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
return (memoizedSnapshot = nextSnapshot), currentSelection; return [
memoizedSnapshot = nextSnapshot; function () {
return (memoizedSelection = nextSelection); return memoizedSelector(getSnapshot());
} },
var hasMemo = false, null === maybeGetServerSnapshot ? void 0 : (
memoizedSnapshot, function () {
memoizedSelection, return memoizedSelector(maybeGetServerSnapshot());
maybeGetServerSnapshot = }
void 0 === getServerSnapshot ? null : getServerSnapshot; ),
return [ ];
function () { },
return memoizedSelector(getSnapshot()); [getSnapshot, getServerSnapshot, selector, isEqual],
}, );
null === maybeGetServerSnapshot var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
? void 0 useEffect(
: function () { function () {
return memoizedSelector(maybeGetServerSnapshot()); inst.hasValue = true;
} inst.value = value;
]; },
}, [value],
[getSnapshot, getServerSnapshot, selector, isEqual] );
); useDebugValue(value);
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]); return value;
useEffect(
function () {
inst.hasValue = true;
inst.value = value;
},
[value]
);
useDebugValue(value);
return value;
}; };
return withSelector_production; return withSelector_production;
} }
var hasRequiredWithSelector; var hasRequiredWithSelector;
function requireWithSelector () { function requireWithSelector() {
if (hasRequiredWithSelector) return withSelector.exports; if (hasRequiredWithSelector) return withSelector.exports;
hasRequiredWithSelector = 1; hasRequiredWithSelector = 1;
{ {
withSelector.exports = requireWithSelector_production(); withSelector.exports = requireWithSelector_production();
} }
return withSelector.exports; return withSelector.exports;
} }

2
web/dist/index.html vendored
View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title>CalcomBlock Plugin</title> <title>CalcomBlock Plugin</title>
<link rel="stylesheet" crossorigin href="/assets/style-Bs2zy9jQ.css"> <link rel="stylesheet" crossorigin href="/assets/style-Bs2zy9jQ.css" />
</head> </head>
<body> <body>
<!-- This is a placeholder for Module Federation remote entry --> <!-- This is a placeholder for Module Federation remote entry -->