@domainkit/react 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,1600 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Dialog } from "@base-ui/react/dialog";
3
+ import { createContext, useCallback, useContext, useEffect, useId, useInsertionEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
4
+ import { useRender } from "@base-ui/react/use-render";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ //#region src/composition.tsx
7
+ function usePart(defaultTagName, componentProps, state, internalProps) {
8
+ const { className, render, style, ...externalProps } = componentProps;
9
+ const parameters = {
10
+ ...className === void 0 ? {} : { className },
11
+ defaultTagName,
12
+ props: [internalProps, externalProps],
13
+ ...render === void 0 ? {} : { render },
14
+ state,
15
+ ...style === void 0 ? {} : { style }
16
+ };
17
+ return useRender(parameters);
18
+ }
19
+ //#endregion
20
+ //#region src/icons.tsx
21
+ function Glyph({ children }) {
22
+ return /* @__PURE__ */ jsx("svg", {
23
+ "aria-hidden": "true",
24
+ fill: "none",
25
+ stroke: "currentColor",
26
+ strokeLinecap: "round",
27
+ strokeLinejoin: "round",
28
+ strokeWidth: 2,
29
+ viewBox: "0 0 24 24",
30
+ children
31
+ });
32
+ }
33
+ const defaultIcons = {
34
+ copied: /* @__PURE__ */ jsx(Glyph, { children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }) }),
35
+ copy: /* @__PURE__ */ jsxs(Glyph, { children: [/* @__PURE__ */ jsx("rect", {
36
+ height: "14",
37
+ rx: "2",
38
+ width: "14",
39
+ x: "8",
40
+ y: "8"
41
+ }), /* @__PURE__ */ jsx("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })] }),
42
+ download: /* @__PURE__ */ jsxs(Glyph, { children: [
43
+ /* @__PURE__ */ jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
44
+ /* @__PURE__ */ jsx("path", { d: "m7 10 5 5 5-5" }),
45
+ /* @__PURE__ */ jsx("path", { d: "M12 15V3" })
46
+ ] })
47
+ };
48
+ const IconsContext = createContext(defaultIcons);
49
+ function IconsProvider({ children, icons }) {
50
+ const value = useMemo(() => ({
51
+ copied: icons?.copied ?? defaultIcons.copied,
52
+ copy: icons?.copy ?? defaultIcons.copy,
53
+ download: icons?.download ?? defaultIcons.download
54
+ }), [icons]);
55
+ return /* @__PURE__ */ jsx(IconsContext.Provider, {
56
+ value,
57
+ children
58
+ });
59
+ }
60
+ function useIcons() {
61
+ return useContext(IconsContext);
62
+ }
63
+ //#endregion
64
+ //#region src/messages.ts
65
+ var messages_exports = /* @__PURE__ */ __exportAll({
66
+ english: () => english,
67
+ merge: () => merge
68
+ });
69
+ const english = {
70
+ applyCleanup: "Remove records",
71
+ applyDns: "Add records",
72
+ applyingDns: "Adding records…",
73
+ automaticUnavailable: "Automatic connection is not available for this domain",
74
+ cancel: "Cancel",
75
+ checkAgain: "Check again",
76
+ checkingDns: "Checking DNS…",
77
+ checkDns: "Check DNS",
78
+ cleanupComplete: "DNS cleanup complete",
79
+ cleanupConsent: "Only records proven by the apply receipt will be deleted.",
80
+ cleanupPartial: "Some DNS records could not be deleted. Review and retry safely.",
81
+ cleaningDns: "Removing records…",
82
+ connectProvider: () => "Connect",
83
+ connected: (provider) => `${provider} connected`,
84
+ connecting: "Connecting…",
85
+ close: "Close",
86
+ detectingProvider: "Detecting DNS provider…",
87
+ disconnectDomain: "Disconnect",
88
+ disconnecting: "Disconnecting…",
89
+ domainDisconnected: "Domain disconnected. DNS records were preserved.",
90
+ dialogDescription: (domain) => `Authorize DNS changes for ${domain}.`,
91
+ dialogTitle: (provider) => `Connect ${provider}`,
92
+ openingAuthorization: "Opening provider authorization…",
93
+ planConsent: "Review the exact DNS operations before approving this plan.",
94
+ planningCleanup: "Preparing cleanup…",
95
+ planningDns: "Preparing DNS changes…",
96
+ recordsApplied: "DNS changes applied",
97
+ recordsPartiallyApplied: "Some DNS changes failed. Review and retry safely.",
98
+ reviewCleanup: "Remove records",
99
+ reviewDns: "Review changes",
100
+ retry: "Try again",
101
+ reuseConnection: (connection) => `Use ${connection}`,
102
+ tokenLabel: "API token"
103
+ };
104
+ const merge = (overrides = {}) => ({
105
+ ...english,
106
+ ...overrides
107
+ });
108
+ //#endregion
109
+ //#region src/theme.ts
110
+ var theme_exports = /* @__PURE__ */ __exportAll({ toStyle: () => toStyle });
111
+ const variables = {
112
+ accent: "--domainkit-accent",
113
+ accentContrast: "--domainkit-accent-contrast",
114
+ background: "--domainkit-background",
115
+ border: "--domainkit-border",
116
+ danger: "--domainkit-danger",
117
+ fill: "--domainkit-fill",
118
+ fontFamily: "--domainkit-font-family",
119
+ muted: "--domainkit-muted",
120
+ radius: "--domainkit-radius",
121
+ shadow: "--domainkit-shadow",
122
+ success: "--domainkit-success",
123
+ text: "--domainkit-text"
124
+ };
125
+ function toStyle(theme = {}) {
126
+ return Object.fromEntries(Object.entries(theme).flatMap(([key, value]) => value === void 0 ? [] : [[variables[key], value]]));
127
+ }
128
+ //#endregion
129
+ //#region src/domain-kit.tsx
130
+ var domain_kit_exports = /* @__PURE__ */ __exportAll({
131
+ Root: () => Root$2,
132
+ useDomainKit: () => useDomainKit
133
+ });
134
+ const Context = createContext(null);
135
+ const navigateInBrowser = (url) => {
136
+ if (typeof window === "undefined") throw new Error("DomainKit OAuth navigation requires a browser or a custom navigate function");
137
+ window.location.assign(url);
138
+ };
139
+ const resolvePortalContainer = (container, ownerDocument) => {
140
+ if (container === null || ownerDocument === null) return null;
141
+ return container.ownerDocument === ownerDocument && container.getRootNode() === ownerDocument ? container : null;
142
+ };
143
+ const usePortalContainer = (container) => {
144
+ const ownerDocument = useMemo(() => container?.ownerDocument ?? null, [container]);
145
+ const subscribe = useCallback((notify) => {
146
+ if (ownerDocument === null || typeof MutationObserver === "undefined") return () => {};
147
+ const observer = new MutationObserver(notify);
148
+ observer.observe(ownerDocument, {
149
+ childList: true,
150
+ subtree: true
151
+ });
152
+ return () => observer.disconnect();
153
+ }, [ownerDocument]);
154
+ const getSnapshot = useCallback(() => resolvePortalContainer(container, ownerDocument), [container, ownerDocument]);
155
+ return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
156
+ };
157
+ function Root$2({ children, colorScheme = "inherit", icons, marks = {}, messages, navigate = navigateInBrowser, portalContainer = null, theme, transport, ...props }) {
158
+ const themeStyle = toStyle(theme);
159
+ const resolvedPortalContainer = usePortalContainer(portalContainer);
160
+ const portalContainerRef = useMemo(() => ({ current: resolvedPortalContainer }), [resolvedPortalContainer]);
161
+ const content = usePart("div", props, { colorScheme }, {
162
+ children,
163
+ "data-color-scheme": colorScheme,
164
+ "data-domainkit-root": "",
165
+ style: themeStyle
166
+ });
167
+ return /* @__PURE__ */ jsx(Context.Provider, {
168
+ value: {
169
+ colorScheme,
170
+ marks,
171
+ messages: merge(messages),
172
+ navigate,
173
+ portalContainer: portalContainerRef,
174
+ themeStyle,
175
+ transport
176
+ },
177
+ children: /* @__PURE__ */ jsx(IconsProvider, {
178
+ ...icons === void 0 ? {} : { icons },
179
+ children: content
180
+ })
181
+ });
182
+ }
183
+ function useDomainKit() {
184
+ const value = useContext(Context);
185
+ if (value === null) throw new Error("DomainKit components must be rendered inside DomainKit.Root");
186
+ return value;
187
+ }
188
+ //#endregion
189
+ //#region src/request-state.ts
190
+ function useController$4(identity, initial) {
191
+ const currentIdentity = useRef(identity);
192
+ const revision = useRef(0);
193
+ const [snapshot, setSnapshot] = useState(() => ({
194
+ identity,
195
+ state: initial
196
+ }));
197
+ useInsertionEffect(() => {
198
+ currentIdentity.current = identity;
199
+ revision.current += 1;
200
+ }, [identity]);
201
+ useEffect(() => {
202
+ setSnapshot({
203
+ identity,
204
+ state: initial
205
+ });
206
+ }, [identity]);
207
+ return {
208
+ begin: useCallback((state) => {
209
+ const request = ++revision.current;
210
+ setSnapshot({
211
+ identity: currentIdentity.current,
212
+ state
213
+ });
214
+ return request;
215
+ }, []),
216
+ commit: useCallback((request, state) => {
217
+ if (revision.current !== request) return false;
218
+ setSnapshot({
219
+ identity: currentIdentity.current,
220
+ state
221
+ });
222
+ return true;
223
+ }, []),
224
+ reset: useCallback((state) => {
225
+ revision.current += 1;
226
+ setSnapshot({
227
+ identity: currentIdentity.current,
228
+ state
229
+ });
230
+ }, []),
231
+ state: snapshot.identity === identity ? snapshot.state : initial
232
+ };
233
+ }
234
+ const recordsIdentity = (records) => JSON.stringify(records.map((record) => [
235
+ record.id,
236
+ record.name,
237
+ record.priority ?? null,
238
+ record.type,
239
+ record.value
240
+ ]));
241
+ //#endregion
242
+ //#region src/cleanup.tsx
243
+ var cleanup_exports = /* @__PURE__ */ __exportAll({
244
+ Flow: () => Flow$3,
245
+ useController: () => useController$3
246
+ });
247
+ function useController$3(connection, receiptId) {
248
+ const { transport } = useDomainKit();
249
+ const requestState = useController$4(`${connection.connectionId}:${connection.domain}:${receiptId}`, { _tag: "Idle" });
250
+ const state = requestState.state;
251
+ const plan = useCallback(async () => {
252
+ const request = requestState.begin({ _tag: "Planning" });
253
+ try {
254
+ const result = await transport.cleanup.plan({
255
+ connectionId: connection.connectionId,
256
+ domain: connection.domain,
257
+ receiptId
258
+ });
259
+ requestState.commit(request, result._tag === "CleanupPlan" ? {
260
+ _tag: "Review",
261
+ plan: result
262
+ } : result);
263
+ } catch (cause) {
264
+ requestState.commit(request, toFailure(cause));
265
+ }
266
+ }, [
267
+ connection.connectionId,
268
+ connection.domain,
269
+ receiptId,
270
+ requestState,
271
+ transport
272
+ ]);
273
+ return {
274
+ apply: useCallback(async () => {
275
+ if (state._tag !== "Review") return;
276
+ const reviewedPlan = state.plan;
277
+ if (reviewedPlan.operations.some((operation) => operation._tag === "Blocked")) return;
278
+ const request = requestState.begin({
279
+ _tag: "Cleaning",
280
+ plan: reviewedPlan
281
+ });
282
+ try {
283
+ const result = await transport.cleanup.apply({
284
+ connectionId: connection.connectionId,
285
+ domain: connection.domain,
286
+ planDigest: reviewedPlan.digest,
287
+ receiptId
288
+ });
289
+ requestState.commit(request, result._tag === "Cleaned" ? {
290
+ _tag: "Cleaned",
291
+ result
292
+ } : result._tag === "Partial" ? {
293
+ _tag: "Partial",
294
+ result
295
+ } : result);
296
+ } catch (cause) {
297
+ requestState.commit(request, toFailure(cause));
298
+ }
299
+ }, [
300
+ connection.connectionId,
301
+ connection.domain,
302
+ receiptId,
303
+ requestState,
304
+ state,
305
+ transport
306
+ ]),
307
+ dismiss: () => requestState.reset({ _tag: "Idle" }),
308
+ plan,
309
+ state
310
+ };
311
+ }
312
+ const toFailure = (cause) => ({
313
+ _tag: "Failure",
314
+ message: cause instanceof Error ? cause.message : "Domain cleanup failed",
315
+ retry: "safe"
316
+ });
317
+ function Flow$3({ connection, receiptId, ...props }) {
318
+ const controller = useController$3(connection, receiptId);
319
+ const { colorScheme, messages, portalContainer, themeStyle } = useDomainKit();
320
+ const state = controller.state;
321
+ const plan = state._tag === "Review" || state._tag === "Cleaning" ? state.plan : void 0;
322
+ return usePart("div", props, { status: state._tag }, {
323
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [
324
+ state._tag === "Cleaned" ? /* @__PURE__ */ jsx("p", {
325
+ "data-domainkit-part": "flow-outcome",
326
+ "data-tone": "success",
327
+ children: messages.cleanupComplete
328
+ }) : null,
329
+ state._tag === "Partial" || state._tag === "Failure" || state._tag === "Stale" ? /* @__PURE__ */ jsx("p", {
330
+ "data-domainkit-part": "flow-outcome",
331
+ "data-tone": "danger",
332
+ role: "alert",
333
+ children: state._tag === "Partial" ? messages.cleanupPartial : state.message
334
+ }) : null,
335
+ /* @__PURE__ */ jsxs(Dialog.Root, {
336
+ onOpenChange: (open) => {
337
+ if (!open) controller.dismiss();
338
+ },
339
+ open: plan !== void 0,
340
+ children: [/* @__PURE__ */ jsx(Dialog.Trigger, {
341
+ "data-domainkit-part": "cleanup-trigger",
342
+ disabled: state._tag === "Planning" || state._tag === "Cleaning",
343
+ onClick: () => void controller.plan(),
344
+ children: state._tag === "Planning" ? messages.planningCleanup : messages.reviewCleanup
345
+ }), plan === void 0 ? null : /* @__PURE__ */ jsxs(Dialog.Portal, {
346
+ container: portalContainer ?? void 0,
347
+ children: [/* @__PURE__ */ jsx(Dialog.Backdrop, { "data-domainkit-part": "dialog-backdrop" }), /* @__PURE__ */ jsxs(Dialog.Popup, {
348
+ "data-color-scheme": colorScheme,
349
+ "data-domainkit-part": "cleanup-dialog",
350
+ "data-domainkit-root": "",
351
+ style: themeStyle,
352
+ children: [
353
+ /* @__PURE__ */ jsxs("div", {
354
+ "data-domainkit-part": "dialog-header",
355
+ children: [/* @__PURE__ */ jsxs("div", {
356
+ "data-domainkit-part": "dialog-heading",
357
+ children: [/* @__PURE__ */ jsx(Dialog.Title, {
358
+ "data-domainkit-part": "dialog-title",
359
+ children: messages.reviewCleanup
360
+ }), /* @__PURE__ */ jsx(Dialog.Description, {
361
+ "data-domainkit-part": "dialog-description",
362
+ children: messages.cleanupConsent
363
+ })]
364
+ }), /* @__PURE__ */ jsx(Dialog.Close, {
365
+ "aria-label": messages.close,
366
+ "data-domainkit-part": "dialog-close",
367
+ children: "×"
368
+ })]
369
+ }),
370
+ /* @__PURE__ */ jsx("div", {
371
+ "data-domainkit-part": "dialog-body",
372
+ children: /* @__PURE__ */ jsx("ul", {
373
+ "data-domainkit-part": "cleanup-operations",
374
+ children: plan.operations.map((operation) => /* @__PURE__ */ jsxs("li", {
375
+ "data-operation": operation._tag,
376
+ children: [
377
+ /* @__PURE__ */ jsx("span", {
378
+ "data-domainkit-part": "operation-kind",
379
+ children: operation._tag
380
+ }),
381
+ " ",
382
+ /* @__PURE__ */ jsx("strong", { children: operation.record.type }),
383
+ " ",
384
+ /* @__PURE__ */ jsxs("span", {
385
+ "data-domainkit-part": "operation-record",
386
+ children: [operation.record.name, operation._tag === "Blocked" ? ` ${operation.reason}` : ""]
387
+ })
388
+ ]
389
+ }, operation.id))
390
+ })
391
+ }),
392
+ /* @__PURE__ */ jsxs("div", {
393
+ "data-domainkit-part": "dialog-footer",
394
+ children: [/* @__PURE__ */ jsx(Dialog.Close, {
395
+ "data-domainkit-part": "dialog-cancel",
396
+ children: messages.cancel
397
+ }), /* @__PURE__ */ jsx("button", {
398
+ "data-domainkit-part": "cleanup-apply",
399
+ disabled: state._tag === "Cleaning" || plan.operations.some((operation) => operation._tag === "Blocked"),
400
+ onClick: () => void controller.apply(),
401
+ type: "button",
402
+ children: state._tag === "Cleaning" ? messages.cleaningDns : messages.applyCleanup
403
+ })]
404
+ })
405
+ ]
406
+ })]
407
+ })]
408
+ })
409
+ ] }),
410
+ "data-domainkit-part": "cleanup-flow",
411
+ "data-state": state._tag
412
+ });
413
+ }
414
+ //#endregion
415
+ //#region src/provider.tsx
416
+ var provider_exports = /* @__PURE__ */ __exportAll({ Mark: () => Mark });
417
+ const logoHosts = {
418
+ aws: "amazonaws.com",
419
+ bluehost: "bluehost.com",
420
+ cloudflare: "cloudflare.com",
421
+ digitalocean: "digitalocean.com",
422
+ dnsimple: "dnsimple.com",
423
+ dreamhost: "dreamhost.com",
424
+ dynadot: "dynadot.com",
425
+ gandi: "gandi.net",
426
+ godaddy: "godaddy.com",
427
+ google: "cloud.google.com",
428
+ googlecloud: "cloud.google.com",
429
+ googleclouddns: "cloud.google.com",
430
+ hostgator: "hostgator.com",
431
+ hostinger: "hostinger.com",
432
+ hover: "hover.com",
433
+ ionos: "ionos.com",
434
+ namecheap: "namecheap.com",
435
+ namecom: "name.com",
436
+ netlify: "netlify.com",
437
+ ns1: "ns1.com",
438
+ ovh: "ovh.com",
439
+ porkbun: "porkbun.com",
440
+ spaceship: "spaceship.com",
441
+ squarespace: "squarespace.com",
442
+ vercel: "vercel.com"
443
+ };
444
+ const logoKey = (providerId) => providerId.trim().toLowerCase().replace(/[^a-z0-9]+/g, "");
445
+ const logoHost = (providerId) => logoHosts[logoKey(providerId)];
446
+ const letterMark = (provider) => provider.name.trim().charAt(0).toUpperCase() || "?";
447
+ /** Official AWS architecture glyph (white "53" in nested circles). */
448
+ const route53Glyph = "M48.692,40.6795109 C49.431,41.3627732 49.801,42.2781246 49.801,43.4275659 C49.801,44.678046 49.351,45.6764293 48.452,46.4227159 C47.552,47.1700028 46.343,47.543146 44.826,47.543146 C43.627,47.543146 42.44,47.2870477 41.266,46.7768518 L41.266,45.2452638 C42.657,45.7054405 43.843,45.9345284 44.826,45.9345284 C45.796,45.9345284 46.542,45.7174451 47.065,45.2842788 C47.588,44.8501121 47.849,44.2308744 47.849,43.4275659 C47.849,41.8829729 46.874,41.1106764 44.921,41.1106764 C44.309,41.1106764 43.703,41.1426887 43.103,41.2057129 L43.103,39.9432282 L47.123,35.5585448 L41.458,35.5585448 L41.458,33.9889422 L49.247,33.9889422 L49.247,35.5015229 L45.304,39.6751253 C45.369,39.6621203 45.431,39.656118 45.496,39.656118 L45.687,39.656118 C46.951,39.656118 47.952,39.9972489 48.692,40.6795109 M37.574,40.3453826 C38.351,41.0726618 38.74,42.0740463 38.74,43.349536 C38.74,44.6010165 38.288,45.6124048 37.381,46.3847013 C36.475,47.1569978 35.283,47.543146 33.803,47.543146 C32.503,47.543146 31.284,47.2870477 30.148,46.7768518 L30.148,45.2452638 C31.564,45.7054405 32.776,45.9345284 33.784,45.9345284 C34.754,45.9345284 35.497,45.7154443 36.013,45.2742749 C36.53,44.834106 36.789,44.1998624 36.789,43.3695437 C36.789,42.4631957 36.546,41.8059434 36.061,41.3977867 C35.576,40.9896299 34.785,40.7845512 33.688,40.7845512 C32.897,40.7845512 31.909,40.8495762 30.722,40.976625 L30.722,39.7131399 L31.086,33.9889422 L38.071,33.9889422 L38.071,35.5585448 L32.693,35.5585448 L32.444,39.4450369 C33.146,39.3179882 33.777,39.2539636 34.338,39.2539636 C35.716,39.2539636 36.795,39.617103 37.574,40.3453826 M51.957,54.37777 C47.103,55.250105 42.852,57.2268639 40,58.8374822 C37.147,57.2268639 32.896,55.250105 28.043,54.37777 C26.677,54.1326759 19.869,52.7111302 19.869,48.7756192 C19.869,46.951919 20.522,45.7424547 21.776,43.5826255 C23.274,40.9996338 25.138,37.7843994 25.138,33.1556222 C25.138,29.8473521 24.271,26.6751342 22.559,23.7149977 C22.76,23.4669025 22.965,23.2158061 23.171,22.9627089 C25.707,24.2301955 28.347,24.8724421 31.031,24.8724421 C34.311,24.8724421 37.325,24.0111114 40,22.3114589 C42.674,24.0111114 45.688,24.8724421 48.968,24.8724421 C51.652,24.8724421 54.293,24.2301955 56.829,22.9627089 C57.034,23.2158061 57.239,23.4669025 57.44,23.7149977 C55.728,26.6751342 54.861,29.8473521 54.861,33.1556222 C54.861,37.7843994 56.725,40.9996338 58.226,43.586627 C59.477,45.7424547 60.13,46.951919 60.13,48.7756192 C60.13,52.7111302 53.322,54.1326759 51.957,54.37777 M56.861,33.1556222 C56.861,29.9974097 57.752,26.9702475 59.507,24.1581679 C59.735,23.7950284 59.706,23.3278491 59.434,22.9957216 C58.926,22.3734827 58.393,21.7182311 57.867,21.0669811 C57.562,20.6898363 57.032,20.5857963 56.606,20.8198862 C54.143,22.1814089 51.574,22.8716739 48.968,22.8716739 C45.824,22.8716739 43.077,22.0263494 40.569,20.2886823 C40.227,20.0515912 39.772,20.0515912 39.43,20.2886823 C36.922,22.0263494 34.175,22.8716739 31.031,22.8716739 C28.425,22.8716739 25.856,22.1814089 23.393,20.8198862 C22.968,20.5857963 22.437,20.6898363 22.132,21.0669811 C21.606,21.7182311 21.073,22.3734827 20.565,22.9957216 C20.294,23.3278491 20.264,23.7950284 20.492,24.1581679 C22.248,26.9702475 23.138,29.9974097 23.138,33.1556222 C23.138,37.2461927 21.423,40.2023277 20.045,42.581241 C18.695,44.9041328 17.869,46.4467251 17.869,48.7756192 C17.869,54.1646882 25.385,55.9343677 27.689,56.3475263 C32.549,57.2208616 36.793,59.2806524 39.497,60.8542565 C39.652,60.9452915 39.826,60.9903088 40,60.9903088 C40.173,60.9903088 40.347,60.9452915 40.503,60.8542565 C43.207,59.2806524 47.45,57.2208616 52.31,56.3475263 C54.614,55.9343677 62.13,54.1646882 62.13,48.7756192 C62.13,46.4467251 61.304,44.9041328 59.954,42.5782399 C58.576,40.2023277 56.861,37.2461927 56.861,33.1556222 M52.994,60.1569888 C46.863,61.2594121 41.723,64.556678 40,65.7641416 C38.276,64.556678 33.136,61.2594121 27.005,60.1569888 C14.937,57.9891566 14,50.8974338 14,48.7756192 C14,45.2852792 15.371,42.9233724 16.697,40.6374948 C17.961,38.4596586 19.268,36.2067937 19.268,33.1556222 C19.268,28.3357718 16.485,24.9314648 15.112,23.5459328 C16.556,21.7892584 20.204,17.3415508 22.003,15.0236609 C24.729,17.5966487 27.898,19.0001876 31.031,19.0001876 C34.509,19.0001876 37.385,17.5846441 40,14.5644846 C42.614,17.5846441 45.49,19.0001876 48.968,19.0001876 C52.101,19.0001876 55.27,17.5966487 57.997,15.0236609 C59.796,17.3415508 63.443,21.7892584 64.887,23.5459328 C63.514,24.9314648 60.731,28.3357718 60.731,33.1556222 C60.731,36.2067937 62.039,38.4596586 63.302,40.6374948 C64.629,42.9233724 66,45.2852792 66,48.7756192 C66,50.8974338 65.062,57.9891566 52.994,60.1569888 M65.032,39.6341095 C63.797,37.5052922 62.731,35.6675867 62.731,33.1556222 C62.731,27.867592 66.847,24.4472789 66.887,24.4152666 C67.094,24.2472021 67.226,24.0031083 67.254,23.7370062 C67.28,23.470904 67.2,23.2058022 67.03,22.9997231 C66.963,22.9196924 60.408,14.9726413 58.906,12.9138509 C58.73,12.6727583 58.457,12.5227007 58.159,12.5046938 C57.86,12.4826853 57.572,12.601731 57.368,12.8198148 C54.848,15.5148495 51.866,16.9994194 48.968,16.9994194 C45.764,16.9994194 43.244,15.5718713 40.794,12.3706423 C40.415,11.8764526 39.585,11.8764526 39.206,12.3706423 C36.755,15.5718713 34.235,16.9994194 31.031,16.9994194 C28.133,16.9994194 25.151,15.5148495 22.631,12.8198148 C22.427,12.601731 22.137,12.4776834 21.84,12.5046938 C21.543,12.5227007 21.269,12.6727583 21.093,12.9138509 C19.591,14.9726413 13.036,22.9196924 12.969,22.9997231 C12.8,23.2058022 12.72,23.470904 12.747,23.7360058 C12.773,24.0011076 12.904,24.2452013 13.11,24.4132658 C13.152,24.4472789 17.268,27.867592 17.268,33.1556222 C17.268,35.6675867 16.202,37.5052922 14.967,39.6341095 C13.576,42.0310298 12,44.7470725 12,48.7756192 C12,55.487196 17.477,60.4781121 26.652,62.1267451 C33.559,63.3682217 39.334,67.7489036 39.391,67.7939209 C39.57,67.9309735 39.785,68 40,68 C40.214,68 40.429,67.9309735 40.609,67.7929205 C40.667,67.7489036 46.422,63.3712229 53.347,62.1267451 C62.522,60.4781121 68,55.487196 68,48.7756192 C68,44.7470725 66.423,42.0310298 65.032,39.6341095";
449
+ function Route53Mark() {
450
+ const gradientId = `dk-r53-${useId().replaceAll(":", "")}`;
451
+ return /* @__PURE__ */ jsxs("svg", {
452
+ "aria-hidden": "true",
453
+ viewBox: "0 0 80 80",
454
+ children: [
455
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", {
456
+ id: gradientId,
457
+ x1: "0%",
458
+ x2: "100%",
459
+ y1: "100%",
460
+ y2: "0%",
461
+ children: [/* @__PURE__ */ jsx("stop", {
462
+ offset: "0%",
463
+ stopColor: "#4D27A8"
464
+ }), /* @__PURE__ */ jsx("stop", {
465
+ offset: "100%",
466
+ stopColor: "#A166FF"
467
+ })]
468
+ }) }),
469
+ /* @__PURE__ */ jsx("rect", {
470
+ fill: `url(#${gradientId})`,
471
+ height: "80",
472
+ width: "80"
473
+ }),
474
+ /* @__PURE__ */ jsx("path", {
475
+ d: route53Glyph,
476
+ fill: "#fff"
477
+ })
478
+ ]
479
+ });
480
+ }
481
+ const logoMarks = {
482
+ amazonroute53: Route53Mark,
483
+ route53: Route53Mark
484
+ };
485
+ function DefaultMark({ provider }) {
486
+ const BuiltIn = logoMarks[logoKey(provider.id)];
487
+ const host = logoHost(provider.id);
488
+ const [failed, setFailed] = useState(false);
489
+ if (BuiltIn !== void 0) return /* @__PURE__ */ jsx(BuiltIn, {});
490
+ if (host === void 0 || failed) return letterMark(provider);
491
+ return /* @__PURE__ */ jsx("img", {
492
+ alt: "",
493
+ height: 32,
494
+ onError: () => setFailed(true),
495
+ referrerPolicy: "no-referrer",
496
+ src: `https://integrations.sh/logo/${host}?sz=64`,
497
+ width: 32
498
+ });
499
+ }
500
+ function Mark({ provider, ...props }) {
501
+ const { marks } = useDomainKit();
502
+ const replacement = marks[provider.id];
503
+ const content = typeof replacement === "function" ? replacement(provider) : replacement ?? /* @__PURE__ */ jsx(DefaultMark, { provider });
504
+ return usePart("span", props, { providerId: provider.id }, {
505
+ "aria-label": provider.name,
506
+ children: content,
507
+ "data-domainkit-part": "provider-mark",
508
+ role: "img"
509
+ });
510
+ }
511
+ //#endregion
512
+ //#region src/connection.tsx
513
+ var connection_exports = /* @__PURE__ */ __exportAll({
514
+ Dialog: () => Dialog$1,
515
+ DisconnectAction: () => DisconnectAction,
516
+ Flow: () => Flow$2,
517
+ OAuthAction: () => OAuthAction,
518
+ RetryAction: () => RetryAction,
519
+ ReuseAction: () => ReuseAction,
520
+ Root: () => Root$1,
521
+ Status: () => Status$2,
522
+ TokenAction: () => TokenAction,
523
+ Trigger: () => Trigger,
524
+ useController: () => useController$2,
525
+ useDisconnect: () => useDisconnect
526
+ });
527
+ const failure$1 = (cause) => ({
528
+ _tag: "Failure",
529
+ message: cause instanceof Error ? cause.message : "The connection request failed",
530
+ retry: "safe"
531
+ });
532
+ function useController$2(domain) {
533
+ const { navigate, transport } = useDomainKit();
534
+ const [attempt, setAttempt] = useState(0);
535
+ const [state, setState] = useState({ _tag: "Loading" });
536
+ const activeRequest = useRef(0);
537
+ useEffect(() => {
538
+ const request = ++activeRequest.current;
539
+ setState({ _tag: "Loading" });
540
+ transport.connection.inspect({ domain }).then((snapshot) => {
541
+ if (activeRequest.current === request) setState(snapshot);
542
+ }, (cause) => {
543
+ if (activeRequest.current === request) setState(failure$1(cause));
544
+ });
545
+ return () => {
546
+ if (activeRequest.current === request) activeRequest.current += 1;
547
+ };
548
+ }, [
549
+ attempt,
550
+ domain,
551
+ transport
552
+ ]);
553
+ return {
554
+ connect: useCallback(async (method, token, parameters) => {
555
+ if (state._tag !== "Disconnected") return;
556
+ const request = ++activeRequest.current;
557
+ const snapshot = state;
558
+ setState({
559
+ _tag: "Submitting",
560
+ snapshot
561
+ });
562
+ try {
563
+ const result = await transport.connection.connect({
564
+ domain,
565
+ method,
566
+ ...parameters === void 0 ? {} : { parameters },
567
+ providerId: snapshot.provider.id,
568
+ ...token === void 0 ? {} : { token }
569
+ });
570
+ if (activeRequest.current !== request) return;
571
+ if (result._tag === "Redirect") {
572
+ setState({
573
+ _tag: "Redirecting",
574
+ snapshot
575
+ });
576
+ navigate(result.authorizationUrl);
577
+ return;
578
+ }
579
+ setState(result);
580
+ } catch (cause) {
581
+ if (activeRequest.current === request) setState(failure$1(cause));
582
+ }
583
+ }, [
584
+ domain,
585
+ navigate,
586
+ state,
587
+ transport
588
+ ]),
589
+ retry: () => setAttempt((current) => current + 1),
590
+ reuse: useCallback(async () => {
591
+ if (state._tag !== "Disconnected" || state.reusableConnection === void 0) return;
592
+ const request = ++activeRequest.current;
593
+ const snapshot = state;
594
+ const reusableConnection = state.reusableConnection;
595
+ setState({
596
+ _tag: "Submitting",
597
+ snapshot
598
+ });
599
+ try {
600
+ const result = await transport.connection.reuse({
601
+ connectionId: reusableConnection.connectionId,
602
+ domain
603
+ });
604
+ if (activeRequest.current === request) setState(result);
605
+ } catch (cause) {
606
+ if (activeRequest.current === request) setState(failure$1(cause));
607
+ }
608
+ }, [
609
+ domain,
610
+ state,
611
+ transport
612
+ ]),
613
+ state
614
+ };
615
+ }
616
+ function Root$1({ children, status = "Loading", ...props }) {
617
+ return usePart("div", props, { status }, {
618
+ children,
619
+ "data-domainkit-part": "connection-root"
620
+ });
621
+ }
622
+ function Status$2({ state, ...props }) {
623
+ const { messages } = useDomainKit();
624
+ const text = state._tag === "Loading" ? messages.detectingProvider : state._tag === "Connected" ? messages.connected(state.provider.name) : state._tag === "Unsupported" ? messages.automaticUnavailable : state._tag === "Failure" ? state.message : state._tag === "Redirecting" ? messages.openingAuthorization : state._tag === "Submitting" ? messages.connecting : `${state.provider.name} is available`;
625
+ return usePart("div", props, { status: state._tag }, {
626
+ children: text,
627
+ "data-domainkit-part": "connection-status",
628
+ "data-state": state._tag
629
+ });
630
+ }
631
+ function Trigger({ provider, ...props }) {
632
+ const { messages } = useDomainKit();
633
+ return /* @__PURE__ */ jsxs(Dialog.Trigger, {
634
+ "data-domainkit-part": "connection-trigger",
635
+ ...props,
636
+ children: [/* @__PURE__ */ jsx(Mark, {
637
+ "aria-hidden": "true",
638
+ provider
639
+ }), messages.connectProvider(provider.name)]
640
+ });
641
+ }
642
+ function OAuthAction({ controller, label, ...props }) {
643
+ return usePart("button", props, { authentication: "oauth" }, {
644
+ children: label,
645
+ "data-domainkit-part": "oauth-connect",
646
+ onClick: () => void controller.connect("oauth"),
647
+ type: "button"
648
+ });
649
+ }
650
+ function ReuseAction({ controller, label, ...props }) {
651
+ return usePart("button", props, { authentication: "reuse" }, {
652
+ children: label,
653
+ "data-domainkit-part": "reuse-connection",
654
+ onClick: () => void controller.reuse(),
655
+ type: "button"
656
+ });
657
+ }
658
+ function TokenAction({ controller, method, ...props }) {
659
+ const { messages } = useDomainKit();
660
+ const [token, setToken] = useState("");
661
+ const [parameters, setParameters] = useState({});
662
+ const submit = (event) => {
663
+ event.preventDefault();
664
+ if (token.length > 0) {
665
+ const populated = Object.fromEntries(Object.entries(parameters).filter(([, value]) => value.length > 0));
666
+ controller.connect("token", token, Object.keys(populated).length === 0 ? void 0 : populated);
667
+ }
668
+ };
669
+ const missingRequiredParameter = method.parameters?.some((parameter) => parameter.required === true && !parameters[parameter.key]);
670
+ return usePart("form", props, { authentication: "token" }, {
671
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [
672
+ method.parameters?.map((parameter) => /* @__PURE__ */ jsxs("label", { children: [
673
+ parameter.label,
674
+ /* @__PURE__ */ jsx("input", {
675
+ name: parameter.key,
676
+ onChange: (event) => {
677
+ const value = event.currentTarget.value;
678
+ setParameters((current) => ({
679
+ ...current,
680
+ [parameter.key]: value
681
+ }));
682
+ },
683
+ placeholder: parameter.placeholder,
684
+ required: parameter.required,
685
+ type: "text",
686
+ value: parameters[parameter.key] ?? ""
687
+ }),
688
+ parameter.description === void 0 ? null : /* @__PURE__ */ jsx("small", { children: parameter.description })
689
+ ] }, parameter.key)),
690
+ /* @__PURE__ */ jsxs("label", { children: [messages.tokenLabel, /* @__PURE__ */ jsx("input", {
691
+ autoComplete: "off",
692
+ name: "token",
693
+ onChange: (event) => setToken(event.currentTarget.value),
694
+ placeholder: method.placeholder,
695
+ type: "password",
696
+ value: token
697
+ })] }),
698
+ /* @__PURE__ */ jsx("button", {
699
+ disabled: token.length === 0 || missingRequiredParameter === true,
700
+ type: "submit",
701
+ children: method.label
702
+ })
703
+ ] }),
704
+ "data-domainkit-part": "token-connect",
705
+ onSubmit: submit
706
+ });
707
+ }
708
+ function Dialog$1({ controller, snapshot }) {
709
+ const { colorScheme, messages, portalContainer, themeStyle } = useDomainKit();
710
+ return /* @__PURE__ */ jsxs(Dialog.Portal, {
711
+ container: portalContainer,
712
+ children: [/* @__PURE__ */ jsx(Dialog.Backdrop, { "data-domainkit-part": "dialog-backdrop" }), /* @__PURE__ */ jsxs(Dialog.Popup, {
713
+ "data-domainkit-part": "connection-dialog",
714
+ "data-domainkit-root": "",
715
+ "data-color-scheme": colorScheme,
716
+ style: themeStyle,
717
+ children: [
718
+ /* @__PURE__ */ jsxs("div", {
719
+ "data-domainkit-part": "dialog-header",
720
+ children: [
721
+ /* @__PURE__ */ jsx(Mark, { provider: snapshot.provider }),
722
+ /* @__PURE__ */ jsxs("div", {
723
+ "data-domainkit-part": "dialog-heading",
724
+ children: [/* @__PURE__ */ jsx(Dialog.Title, {
725
+ "data-domainkit-part": "dialog-title",
726
+ children: messages.dialogTitle(snapshot.provider.name)
727
+ }), /* @__PURE__ */ jsx(Dialog.Description, {
728
+ "data-domainkit-part": "dialog-description",
729
+ children: messages.dialogDescription(snapshot.domain)
730
+ })]
731
+ }),
732
+ /* @__PURE__ */ jsx(Dialog.Close, {
733
+ "aria-label": messages.close,
734
+ "data-domainkit-part": "dialog-close",
735
+ children: "×"
736
+ })
737
+ ]
738
+ }),
739
+ /* @__PURE__ */ jsxs("div", {
740
+ "data-domainkit-part": "dialog-body",
741
+ children: [
742
+ snapshot.provider.authentication.map((method) => method._tag === "OAuth" ? /* @__PURE__ */ jsx(OAuthAction, {
743
+ controller,
744
+ label: method.label
745
+ }, method._tag) : null),
746
+ snapshot.reusableConnection === void 0 ? null : /* @__PURE__ */ jsx(ReuseAction, {
747
+ controller,
748
+ label: messages.reuseConnection(snapshot.reusableConnection.label)
749
+ }),
750
+ snapshot.provider.authentication.map((method) => method._tag === "Token" ? /* @__PURE__ */ jsx(TokenAction, {
751
+ controller,
752
+ method
753
+ }, method._tag) : null)
754
+ ]
755
+ }),
756
+ /* @__PURE__ */ jsx("div", {
757
+ "data-domainkit-part": "dialog-footer",
758
+ children: /* @__PURE__ */ jsx(Dialog.Close, {
759
+ "data-domainkit-part": "dialog-cancel",
760
+ children: messages.cancel
761
+ })
762
+ })
763
+ ]
764
+ })]
765
+ });
766
+ }
767
+ function Flow$2({ domain, ...props }) {
768
+ const controller = useController$2(domain);
769
+ const state = controller.state;
770
+ const snapshot = state._tag === "Disconnected" ? state : state._tag === "Submitting" || state._tag === "Redirecting" ? state.snapshot : void 0;
771
+ return /* @__PURE__ */ jsxs(Root$1, {
772
+ ...props,
773
+ status: state._tag,
774
+ children: [
775
+ /* @__PURE__ */ jsx(Status$2, { state }),
776
+ state._tag === "Failure" && state.retry !== "never" ? /* @__PURE__ */ jsx(RetryAction, {
777
+ controller,
778
+ kind: state.retry === "after-user-action" ? "after-user-action" : "retry"
779
+ }) : null,
780
+ snapshot === void 0 ? null : /* @__PURE__ */ jsxs(Dialog.Root, { children: [/* @__PURE__ */ jsx(Trigger, { provider: snapshot.provider }), /* @__PURE__ */ jsx(Dialog$1, {
781
+ controller,
782
+ snapshot
783
+ })] })
784
+ ]
785
+ });
786
+ }
787
+ function RetryAction({ controller, kind = "retry", ...props }) {
788
+ const { messages } = useDomainKit();
789
+ return usePart("button", props, { status: "Failure" }, {
790
+ children: kind === "after-user-action" ? messages.checkAgain : messages.retry,
791
+ "data-domainkit-part": "connection-retry",
792
+ onClick: controller.retry,
793
+ type: "button"
794
+ });
795
+ }
796
+ function useDisconnect(connection) {
797
+ const { transport } = useDomainKit();
798
+ const requestState = useController$4(`${connection.connectionId}:${connection.domain}:disconnect`, { _tag: "Idle" });
799
+ return {
800
+ disconnect: useCallback(async () => {
801
+ const request = requestState.begin({ _tag: "Disconnecting" });
802
+ try {
803
+ requestState.commit(request, await transport.connection.removeDomain({
804
+ connectionId: connection.connectionId,
805
+ domain: connection.domain,
806
+ preserveDns: true
807
+ }));
808
+ } catch (cause) {
809
+ requestState.commit(request, failure$1(cause));
810
+ }
811
+ }, [
812
+ connection.connectionId,
813
+ connection.domain,
814
+ requestState,
815
+ transport
816
+ ]),
817
+ state: requestState.state
818
+ };
819
+ }
820
+ function DisconnectAction({ connection, ...props }) {
821
+ const controller = useDisconnect(connection);
822
+ const { messages } = useDomainKit();
823
+ const state = controller.state;
824
+ return usePart("div", props, { status: state._tag }, {
825
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [
826
+ state._tag === "Removed" ? /* @__PURE__ */ jsx("p", {
827
+ "data-domainkit-part": "flow-outcome",
828
+ "data-tone": "success",
829
+ children: messages.domainDisconnected
830
+ }) : null,
831
+ state._tag === "Failure" ? /* @__PURE__ */ jsx("p", {
832
+ "data-domainkit-part": "flow-outcome",
833
+ "data-tone": "danger",
834
+ role: "alert",
835
+ children: state.message
836
+ }) : null,
837
+ state._tag === "Removed" ? null : /* @__PURE__ */ jsx("button", {
838
+ "data-domainkit-part": "disconnect-action",
839
+ disabled: state._tag === "Disconnecting",
840
+ onClick: () => void controller.disconnect(),
841
+ type: "button",
842
+ children: state._tag === "Disconnecting" ? messages.disconnecting : messages.disconnectDomain
843
+ })
844
+ ] }),
845
+ "data-domainkit-part": "disconnect"
846
+ });
847
+ }
848
+ //#endregion
849
+ //#region src/records.tsx
850
+ var records_exports = /* @__PURE__ */ __exportAll({
851
+ Body: () => Body,
852
+ Caption: () => Caption,
853
+ Card: () => Card,
854
+ CardContent: () => CardContent,
855
+ CardHeader: () => CardHeader,
856
+ CardTitle: () => CardTitle,
857
+ Cell: () => Cell,
858
+ CopyValue: () => CopyValue,
859
+ Footer: () => Footer,
860
+ Head: () => Head,
861
+ Header: () => Header,
862
+ Priority: () => Priority,
863
+ Root: () => Root,
864
+ Row: () => Row,
865
+ Status: () => Status$1,
866
+ Table: () => Table,
867
+ Value: () => Value,
868
+ ZoneFile: () => ZoneFile,
869
+ toZoneFile: () => toZoneFile
870
+ });
871
+ const copyText = (value) => {
872
+ if (typeof navigator === "undefined" || navigator.clipboard === void 0) return Promise.resolve(false);
873
+ return navigator.clipboard.writeText(value).then(() => true, () => false);
874
+ };
875
+ const downloadText = (filename, contents) => {
876
+ if (typeof document === "undefined") return;
877
+ const blob = new Blob([contents], { type: "text/plain;charset=utf-8" });
878
+ const url = URL.createObjectURL(blob);
879
+ const anchor = document.createElement("a");
880
+ anchor.download = filename;
881
+ anchor.href = url;
882
+ document.body.append(anchor);
883
+ anchor.click();
884
+ anchor.remove();
885
+ URL.revokeObjectURL(url);
886
+ };
887
+ const absoluteDomainName = (value) => value.endsWith(".") ? value : `${value}.`;
888
+ const textEncoder = new TextEncoder();
889
+ const escapeTxtCharacter = (character) => {
890
+ if (character === "\"" || character === "\\") return `\\${character}`;
891
+ const codePoint = character.codePointAt(0);
892
+ if (codePoint !== void 0 && (codePoint < 32 || codePoint === 127)) return `\\${codePoint.toString().padStart(3, "0")}`;
893
+ return character;
894
+ };
895
+ const txtValue = (value) => {
896
+ const chunks = [];
897
+ let chunk = "";
898
+ let byteLength = 0;
899
+ for (const character of value) {
900
+ const characterByteLength = textEncoder.encode(character).byteLength;
901
+ if (byteLength + characterByteLength > 255) {
902
+ chunks.push(chunk);
903
+ chunk = "";
904
+ byteLength = 0;
905
+ }
906
+ chunk += escapeTxtCharacter(character);
907
+ byteLength += characterByteLength;
908
+ }
909
+ chunks.push(chunk);
910
+ return chunks.map((part) => `"${part}"`).join(" ");
911
+ };
912
+ const srvValue = (value) => {
913
+ const fields = value.trim().split(/\s+/);
914
+ if (fields.length !== 3) throw new Error(`Invalid SRV value: ${value}`);
915
+ const [weight, port, target] = fields;
916
+ if (weight === void 0 || port === void 0 || target === void 0) throw new Error(`Invalid SRV value: ${value}`);
917
+ return `${weight} ${port} ${absoluteDomainName(target)}`;
918
+ };
919
+ const zoneValue = (record) => {
920
+ switch (record.type.toUpperCase()) {
921
+ case "CNAME":
922
+ case "MX":
923
+ case "NS":
924
+ case "PTR": return absoluteDomainName(record.value);
925
+ case "SRV": return srvValue(record.value);
926
+ case "TXT": return txtValue(record.value);
927
+ default: return record.value;
928
+ }
929
+ };
930
+ function leafPart(defaultTagName, part) {
931
+ return function Leaf(props) {
932
+ return usePart(defaultTagName, props, {}, { "data-domainkit-part": part });
933
+ };
934
+ }
935
+ function CopyValue({ copiedIcon, copiedLabel = "Copied", copyIcon, copyLabel = "Copy", value, ...props }) {
936
+ const icons = useIcons();
937
+ const [copied, setCopied] = useState(false);
938
+ const reset = useRef(void 0);
939
+ useEffect(() => () => clearTimeout(reset.current), []);
940
+ return usePart("span", props, { copied }, {
941
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("code", { children: value }), /* @__PURE__ */ jsxs("button", {
942
+ "aria-label": `${copied ? copiedLabel : copyLabel} ${value}`,
943
+ "data-domainkit-part": "copy-action",
944
+ onClick: () => {
945
+ copyText(value).then((ok) => {
946
+ if (!ok) return;
947
+ setCopied(true);
948
+ clearTimeout(reset.current);
949
+ reset.current = setTimeout(() => setCopied(false), 2e3);
950
+ });
951
+ },
952
+ type: "button",
953
+ children: [/* @__PURE__ */ jsx("span", {
954
+ "aria-hidden": "true",
955
+ "data-domainkit-part": "copy-glyph",
956
+ "data-icon": "",
957
+ "data-state": "idle",
958
+ children: copyIcon ?? icons.copy
959
+ }), /* @__PURE__ */ jsx("span", {
960
+ "aria-hidden": "true",
961
+ "data-domainkit-part": "copy-glyph",
962
+ "data-icon": "",
963
+ "data-state": "done",
964
+ children: copiedIcon ?? icons.copied
965
+ })]
966
+ })] }),
967
+ "data-copied": copied ? "" : void 0,
968
+ "data-domainkit-part": "copy-value"
969
+ });
970
+ }
971
+ function ZoneFile({ copiedIcon, copiedLabel = "Copied", copyIcon, copyLabel = "Copy zone", domain, downloadIcon, downloadLabel = "Download", records, ...props }) {
972
+ const icons = useIcons();
973
+ const [copied, setCopied] = useState(false);
974
+ const reset = useRef(void 0);
975
+ const zone = toZoneFile(records);
976
+ useEffect(() => () => clearTimeout(reset.current), []);
977
+ return usePart("div", props, { count: records.length }, {
978
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("button", {
979
+ "aria-label": copied ? copiedLabel : copyLabel,
980
+ "data-domainkit-part": "zone-copy",
981
+ onClick: () => {
982
+ copyText(zone).then((ok) => {
983
+ if (!ok) return;
984
+ setCopied(true);
985
+ clearTimeout(reset.current);
986
+ reset.current = setTimeout(() => setCopied(false), 2e3);
987
+ });
988
+ },
989
+ type: "button",
990
+ children: [/* @__PURE__ */ jsx("span", {
991
+ "aria-hidden": "true",
992
+ "data-icon": "inline-start",
993
+ children: copied ? copiedIcon ?? icons.copied : copyIcon ?? icons.copy
994
+ }), copied ? copiedLabel : copyLabel]
995
+ }), /* @__PURE__ */ jsxs("button", {
996
+ "data-domainkit-part": "zone-download",
997
+ onClick: () => downloadText(`${domain}.txt`, zone),
998
+ type: "button",
999
+ children: [/* @__PURE__ */ jsx("span", {
1000
+ "aria-hidden": "true",
1001
+ "data-icon": "inline-start",
1002
+ children: downloadIcon ?? icons.download
1003
+ }), downloadLabel]
1004
+ })] }),
1005
+ "data-domainkit-part": "zone-file"
1006
+ });
1007
+ }
1008
+ function Status$1({ evidence, ...props }) {
1009
+ return usePart("span", props, { status: evidence._tag }, {
1010
+ children: evidence._tag,
1011
+ "data-domainkit-part": "record-status",
1012
+ "data-status": evidence._tag
1013
+ });
1014
+ }
1015
+ function Priority({ children, priority = 0, ...props }) {
1016
+ return usePart("span", props, { priority }, {
1017
+ children: children ?? `Priority ${priority}`,
1018
+ "data-domainkit-part": "record-priority"
1019
+ });
1020
+ }
1021
+ const Header = leafPart("thead", "records-header");
1022
+ const Body = leafPart("tbody", "records-body");
1023
+ const Footer = leafPart("tfoot", "records-footer");
1024
+ const Row = leafPart("tr", "records-row");
1025
+ const Head = leafPart("th", "records-head");
1026
+ const Cell = leafPart("td", "records-cell");
1027
+ const Caption = leafPart("caption", "records-caption");
1028
+ const Value = leafPart("span", "record-value");
1029
+ const CardHeader = leafPart("div", "record-card-head");
1030
+ const CardTitle = leafPart("strong", "record-card-title");
1031
+ const CardContent = leafPart("dl", "record-card-content");
1032
+ function Root({ count = 0, ...props }) {
1033
+ return /* @__PURE__ */ jsx("div", {
1034
+ "data-domainkit-part": "records-panel",
1035
+ children: usePart("table", props, { count }, { "data-domainkit-part": "records-table" })
1036
+ });
1037
+ }
1038
+ function Card({ copiedIcon, copyIcon, evidence, record, ...props }) {
1039
+ const matching = evidence === void 0 ? [] : evidence.filter((item) => item.recordId === record.id);
1040
+ return usePart("section", props, { recordId: record.id }, {
1041
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsx(CardTitle, { children: record.type }), matching.map((item, index) => /* @__PURE__ */ jsx(Status$1, { evidence: item }, `${item._tag}-${index}`))] }), /* @__PURE__ */ jsxs(CardContent, { children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Name" }), /* @__PURE__ */ jsx("dd", { children: /* @__PURE__ */ jsx(CopyValue, {
1042
+ copiedIcon,
1043
+ copyIcon,
1044
+ value: record.name
1045
+ }) })] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Value" }), /* @__PURE__ */ jsxs("dd", { children: [/* @__PURE__ */ jsx(CopyValue, {
1046
+ copiedIcon,
1047
+ copyIcon,
1048
+ value: record.value
1049
+ }), record.priority === void 0 ? null : /* @__PURE__ */ jsx(Priority, { priority: record.priority })] })] })] })] }),
1050
+ "data-domainkit-part": "record-card"
1051
+ });
1052
+ }
1053
+ function Table({ copiedIcon, copyIcon, evidence, records, ...props }) {
1054
+ const status = evidence !== void 0;
1055
+ return /* @__PURE__ */ jsxs(Root, {
1056
+ count: records.length,
1057
+ ...props,
1058
+ children: [/* @__PURE__ */ jsx(Header, { children: /* @__PURE__ */ jsxs(Row, { children: [
1059
+ /* @__PURE__ */ jsx(Head, {
1060
+ scope: "col",
1061
+ children: "Type"
1062
+ }),
1063
+ /* @__PURE__ */ jsx(Head, {
1064
+ scope: "col",
1065
+ children: "Name"
1066
+ }),
1067
+ /* @__PURE__ */ jsx(Head, {
1068
+ scope: "col",
1069
+ children: "Value"
1070
+ }),
1071
+ status ? /* @__PURE__ */ jsx(Head, {
1072
+ "data-column": "status",
1073
+ scope: "col",
1074
+ children: "Status"
1075
+ }) : null
1076
+ ] }) }), /* @__PURE__ */ jsx(Body, { children: records.map((record) => /* @__PURE__ */ jsxs(Row, { children: [
1077
+ /* @__PURE__ */ jsx(Cell, { children: record.type }),
1078
+ /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx(CopyValue, {
1079
+ copiedIcon,
1080
+ copyIcon,
1081
+ value: record.name
1082
+ }) }),
1083
+ /* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsxs(Value, { children: [/* @__PURE__ */ jsx(CopyValue, {
1084
+ copiedIcon,
1085
+ copyIcon,
1086
+ value: record.value
1087
+ }), record.priority === void 0 ? null : /* @__PURE__ */ jsx(Priority, { priority: record.priority })] }) }),
1088
+ status ? /* @__PURE__ */ jsx(Cell, {
1089
+ "data-column": "status",
1090
+ children: evidence.filter((item) => item.recordId === record.id).map((item, index) => /* @__PURE__ */ jsx(Status$1, { evidence: item }, `${item._tag}-${index}`))
1091
+ }) : null
1092
+ ] }, record.id)) })]
1093
+ });
1094
+ }
1095
+ const toZoneFile = (records) => `${records.map((record) => `${absoluteDomainName(record.name)} IN ${record.type} ${record.priority === void 0 ? "" : `${record.priority} `}${zoneValue(record)}`).join("\n")}\n`;
1096
+ //#endregion
1097
+ //#region src/provisioning.tsx
1098
+ var provisioning_exports = /* @__PURE__ */ __exportAll({
1099
+ Flow: () => Flow$1,
1100
+ OperationList: () => OperationList,
1101
+ useController: () => useController$1
1102
+ });
1103
+ const failure = (cause) => ({
1104
+ _tag: "Failure",
1105
+ message: cause instanceof Error ? cause.message : "DNS provisioning failed",
1106
+ retry: "safe"
1107
+ });
1108
+ function useController$1(connection, records, onApplied) {
1109
+ const { transport } = useDomainKit();
1110
+ const requestState = useController$4(`${connection.connectionId}:${connection.domain}:${recordsIdentity(records)}`, { _tag: "Idle" });
1111
+ const state = requestState.state;
1112
+ const plan = useCallback(async () => {
1113
+ const request = requestState.begin({ _tag: "Planning" });
1114
+ try {
1115
+ const result = await transport.provisioning.plan({
1116
+ connectionId: connection.connectionId,
1117
+ domain: connection.domain,
1118
+ records
1119
+ });
1120
+ requestState.commit(request, result._tag === "Plan" ? {
1121
+ _tag: "Review",
1122
+ plan: result
1123
+ } : result);
1124
+ } catch (cause) {
1125
+ requestState.commit(request, failure(cause));
1126
+ }
1127
+ }, [
1128
+ connection.connectionId,
1129
+ connection.domain,
1130
+ records,
1131
+ requestState,
1132
+ transport
1133
+ ]);
1134
+ return {
1135
+ apply: useCallback(async () => {
1136
+ if (state._tag !== "Review") return;
1137
+ const reviewedPlan = state.plan;
1138
+ if (reviewedPlan.operations.some((operation) => operation._tag === "Conflict")) return;
1139
+ const request = requestState.begin({
1140
+ _tag: "Applying",
1141
+ plan: reviewedPlan
1142
+ });
1143
+ try {
1144
+ const result = await transport.provisioning.apply({
1145
+ connectionId: connection.connectionId,
1146
+ domain: connection.domain,
1147
+ planDigest: reviewedPlan.digest
1148
+ });
1149
+ if (result._tag === "Applied") {
1150
+ if (requestState.commit(request, {
1151
+ _tag: "Complete",
1152
+ result
1153
+ })) onApplied?.(result);
1154
+ } else if (result._tag === "Partial") {
1155
+ if (requestState.commit(request, {
1156
+ _tag: "Partial",
1157
+ result
1158
+ })) onApplied?.(result);
1159
+ } else requestState.commit(request, result);
1160
+ } catch (cause) {
1161
+ requestState.commit(request, failure(cause));
1162
+ }
1163
+ }, [
1164
+ connection.connectionId,
1165
+ connection.domain,
1166
+ onApplied,
1167
+ requestState,
1168
+ state,
1169
+ transport
1170
+ ]),
1171
+ dismiss: () => requestState.reset({ _tag: "Idle" }),
1172
+ plan,
1173
+ retry: plan,
1174
+ state
1175
+ };
1176
+ }
1177
+ function Flow$1({ connection, onApplied, records, showRecords = true, ...props }) {
1178
+ const controller = useController$1(connection, records, onApplied);
1179
+ const { colorScheme, messages, portalContainer, themeStyle } = useDomainKit();
1180
+ const state = controller.state;
1181
+ const plan = state._tag === "Review" || state._tag === "Applying" ? state.plan : void 0;
1182
+ return usePart("div", props, { status: state._tag }, {
1183
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [
1184
+ showRecords ? /* @__PURE__ */ jsx(Table, { records }) : null,
1185
+ state._tag === "Complete" ? /* @__PURE__ */ jsx("p", {
1186
+ "data-domainkit-part": "flow-outcome",
1187
+ "data-tone": "success",
1188
+ children: messages.recordsApplied
1189
+ }) : null,
1190
+ state._tag === "Partial" ? /* @__PURE__ */ jsx("p", {
1191
+ "data-domainkit-part": "flow-outcome",
1192
+ "data-tone": "danger",
1193
+ role: "alert",
1194
+ children: messages.recordsPartiallyApplied
1195
+ }) : null,
1196
+ state._tag === "Failure" || state._tag === "Stale" ? /* @__PURE__ */ jsx("p", {
1197
+ "data-domainkit-part": "flow-outcome",
1198
+ "data-tone": "danger",
1199
+ role: "alert",
1200
+ children: state.message
1201
+ }) : null,
1202
+ /* @__PURE__ */ jsxs(Dialog.Root, {
1203
+ onOpenChange: (open) => {
1204
+ if (!open) controller.dismiss();
1205
+ },
1206
+ open: plan !== void 0,
1207
+ children: [/* @__PURE__ */ jsx(Dialog.Trigger, {
1208
+ "data-domainkit-part": "plan-trigger",
1209
+ disabled: state._tag === "Planning" || state._tag === "Applying",
1210
+ onClick: () => void controller.plan(),
1211
+ children: state._tag === "Planning" ? messages.planningDns : messages.reviewDns
1212
+ }), plan === void 0 ? null : /* @__PURE__ */ jsxs(Dialog.Portal, {
1213
+ container: portalContainer ?? void 0,
1214
+ children: [/* @__PURE__ */ jsx(Dialog.Backdrop, { "data-domainkit-part": "dialog-backdrop" }), /* @__PURE__ */ jsxs(Dialog.Popup, {
1215
+ "data-color-scheme": colorScheme,
1216
+ "data-domainkit-part": "plan-dialog",
1217
+ "data-domainkit-root": "",
1218
+ style: themeStyle,
1219
+ children: [
1220
+ /* @__PURE__ */ jsxs("div", {
1221
+ "data-domainkit-part": "dialog-header",
1222
+ children: [/* @__PURE__ */ jsxs("div", {
1223
+ "data-domainkit-part": "dialog-heading",
1224
+ children: [/* @__PURE__ */ jsx(Dialog.Title, {
1225
+ "data-domainkit-part": "dialog-title",
1226
+ children: messages.reviewDns
1227
+ }), /* @__PURE__ */ jsx(Dialog.Description, {
1228
+ "data-domainkit-part": "dialog-description",
1229
+ children: messages.planConsent
1230
+ })]
1231
+ }), /* @__PURE__ */ jsx(Dialog.Close, {
1232
+ "aria-label": messages.close,
1233
+ "data-domainkit-part": "dialog-close",
1234
+ children: "×"
1235
+ })]
1236
+ }),
1237
+ /* @__PURE__ */ jsx("div", {
1238
+ "data-domainkit-part": "dialog-body",
1239
+ children: /* @__PURE__ */ jsx(OperationList, { plan })
1240
+ }),
1241
+ /* @__PURE__ */ jsxs("div", {
1242
+ "data-domainkit-part": "dialog-footer",
1243
+ children: [/* @__PURE__ */ jsx(Dialog.Close, {
1244
+ "data-domainkit-part": "dialog-cancel",
1245
+ children: messages.cancel
1246
+ }), /* @__PURE__ */ jsx("button", {
1247
+ "data-domainkit-part": "plan-apply",
1248
+ disabled: state._tag === "Applying" || plan.operations.some((operation) => operation._tag === "Conflict"),
1249
+ onClick: () => void controller.apply(),
1250
+ type: "button",
1251
+ children: state._tag === "Applying" ? messages.applyingDns : messages.applyDns
1252
+ })]
1253
+ })
1254
+ ]
1255
+ })]
1256
+ })]
1257
+ }),
1258
+ state._tag === "Failure" || state._tag === "Stale" || state._tag === "Partial" ? /* @__PURE__ */ jsx("button", {
1259
+ "data-domainkit-part": "provisioning-retry",
1260
+ onClick: () => void controller.retry(),
1261
+ type: "button",
1262
+ children: messages.retry
1263
+ }) : null
1264
+ ] }),
1265
+ "data-domainkit-part": "provisioning-flow",
1266
+ "data-state": state._tag
1267
+ });
1268
+ }
1269
+ function OperationList({ plan }) {
1270
+ return /* @__PURE__ */ jsx("ul", {
1271
+ "data-domainkit-part": "plan-operations",
1272
+ children: plan.operations.map((operation) => /* @__PURE__ */ jsxs("li", {
1273
+ "data-operation": operation._tag,
1274
+ children: [
1275
+ /* @__PURE__ */ jsx("span", {
1276
+ "data-domainkit-part": "operation-kind",
1277
+ children: operation._tag
1278
+ }),
1279
+ " ",
1280
+ /* @__PURE__ */ jsx("strong", { children: operation.record.type }),
1281
+ " ",
1282
+ /* @__PURE__ */ jsxs("span", {
1283
+ "data-domainkit-part": "operation-record",
1284
+ children: [operation.record.name, operation._tag === "Conflict" ? ` ${operation.reason}` : ""]
1285
+ })
1286
+ ]
1287
+ }, operation.id))
1288
+ });
1289
+ }
1290
+ //#endregion
1291
+ //#region src/verification.tsx
1292
+ var verification_exports = /* @__PURE__ */ __exportAll({
1293
+ Status: () => Status,
1294
+ useController: () => useController
1295
+ });
1296
+ function useController(config) {
1297
+ const { transport } = useDomainKit();
1298
+ const sources = {
1299
+ provider: config.sources?.provider ?? config.connection !== void 0,
1300
+ publicDns: config.sources?.publicDns ?? true
1301
+ };
1302
+ const requestState = useController$4(`${config.connection?.connectionId ?? "public"}:${config.domain}:${sources.provider}:${sources.publicDns}:${recordsIdentity(config.records)}`, { _tag: "Idle" });
1303
+ const state = requestState.state;
1304
+ return {
1305
+ observe: useCallback(async () => {
1306
+ const request = requestState.begin({ _tag: "Observing" });
1307
+ try {
1308
+ requestState.commit(request, await transport.verification.observe({
1309
+ ...config.connection === void 0 ? {} : { connectionId: config.connection.connectionId },
1310
+ domain: config.domain,
1311
+ records: config.records,
1312
+ sources
1313
+ }));
1314
+ } catch (cause) {
1315
+ requestState.commit(request, {
1316
+ _tag: "Failure",
1317
+ message: cause instanceof Error ? cause.message : "DNS observation failed",
1318
+ retry: "safe"
1319
+ });
1320
+ }
1321
+ }, [
1322
+ config,
1323
+ requestState,
1324
+ sources,
1325
+ transport
1326
+ ]),
1327
+ state
1328
+ };
1329
+ }
1330
+ const evidenceNote = (evidence) => {
1331
+ switch (evidence._tag) {
1332
+ case "Mismatch":
1333
+ case "Unavailable": return evidence.message;
1334
+ case "Found":
1335
+ case "Missing": return;
1336
+ default: return evidence;
1337
+ }
1338
+ };
1339
+ const observationGroups = (observation) => [{
1340
+ evidence: observation.provider,
1341
+ label: "Provider"
1342
+ }, {
1343
+ evidence: observation.publicDns,
1344
+ label: "Public DNS"
1345
+ }].filter((group) => group.evidence.length > 0);
1346
+ function Status({ config, ...props }) {
1347
+ const controller = useController(config);
1348
+ const { messages } = useDomainKit();
1349
+ const state = controller.state;
1350
+ return usePart("div", props, { status: state._tag }, {
1351
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [state._tag === "Observation" ? /* @__PURE__ */ jsx("div", {
1352
+ "data-domainkit-part": "observation-list",
1353
+ children: observationGroups(state).map((group) => /* @__PURE__ */ jsxs("section", {
1354
+ "data-domainkit-part": "observation-group",
1355
+ children: [/* @__PURE__ */ jsx("p", {
1356
+ "data-domainkit-part": "observation-source",
1357
+ children: group.label
1358
+ }), /* @__PURE__ */ jsx("ul", { children: group.evidence.map((evidence, index) => {
1359
+ const note = evidenceNote(evidence);
1360
+ return /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsxs("div", {
1361
+ "data-domainkit-part": "observation-row",
1362
+ children: [/* @__PURE__ */ jsx("span", {
1363
+ "data-domainkit-part": "observation-record",
1364
+ children: evidence.recordId
1365
+ }), /* @__PURE__ */ jsx(Status$1, { evidence })]
1366
+ }), note === void 0 ? null : /* @__PURE__ */ jsx("p", {
1367
+ "data-domainkit-part": "observation-note",
1368
+ children: note
1369
+ })] }, `${evidence._tag}-${evidence.recordId}-${index}`);
1370
+ }) })]
1371
+ }, group.label))
1372
+ }) : state._tag === "Failure" ? /* @__PURE__ */ jsx("p", {
1373
+ "data-domainkit-part": "flow-outcome",
1374
+ "data-tone": "danger",
1375
+ role: "alert",
1376
+ children: state.message
1377
+ }) : null, /* @__PURE__ */ jsx("button", {
1378
+ "data-domainkit-part": "observe-action",
1379
+ disabled: state._tag === "Observing",
1380
+ onClick: () => void controller.observe(),
1381
+ type: "button",
1382
+ children: state._tag === "Observing" ? messages.checkingDns : messages.checkDns
1383
+ })] }),
1384
+ "data-domainkit-part": "verification-status",
1385
+ "data-state": state._tag
1386
+ });
1387
+ }
1388
+ //#endregion
1389
+ //#region src/domain.tsx
1390
+ var domain_exports = /* @__PURE__ */ __exportAll({ Flow: () => Flow });
1391
+ function Flow({ domain, receiptId, records }) {
1392
+ const connection = useController$2(domain);
1393
+ const state = connection.state;
1394
+ return /* @__PURE__ */ jsxs(Root$1, {
1395
+ status: state._tag,
1396
+ children: [
1397
+ state._tag === "Connected" ? null : /* @__PURE__ */ jsx(Status$2, { state }),
1398
+ state._tag === "Failure" && (state.retry === "safe" || state.retry === "unknown") ? /* @__PURE__ */ jsx(RetryAction, { controller: connection }) : null,
1399
+ state._tag === "Disconnected" ? /* @__PURE__ */ jsxs(Dialog.Root, { children: [/* @__PURE__ */ jsx(Trigger, { provider: state.provider }), /* @__PURE__ */ jsx(Dialog$1, {
1400
+ controller: connection,
1401
+ snapshot: state
1402
+ })] }) : null,
1403
+ state._tag === "Connected" ? /* @__PURE__ */ jsx("div", {
1404
+ "data-domainkit-part": "connected-shell",
1405
+ children: /* @__PURE__ */ jsx(ConnectedFlow, {
1406
+ connection: state,
1407
+ ...receiptId === void 0 ? {} : { initialReceiptId: receiptId },
1408
+ records
1409
+ })
1410
+ }) : null
1411
+ ]
1412
+ });
1413
+ }
1414
+ function ConnectedFlow({ connection, initialReceiptId, records }) {
1415
+ const [appliedReceipt, setAppliedReceipt] = useState();
1416
+ const receiptSource = initialReceiptId ?? null;
1417
+ const receiptEpoch = useRef({
1418
+ source: receiptSource,
1419
+ value: 0
1420
+ });
1421
+ const epoch = receiptEpoch.current.source === receiptSource ? receiptEpoch.current.value : receiptEpoch.current.value + 1;
1422
+ useEffect(() => {
1423
+ if (receiptEpoch.current.source === receiptSource) return;
1424
+ receiptEpoch.current = {
1425
+ source: receiptSource,
1426
+ value: receiptEpoch.current.value + 1
1427
+ };
1428
+ setAppliedReceipt(void 0);
1429
+ }, [receiptSource]);
1430
+ const receiptId = appliedReceipt !== void 0 && appliedReceipt.epoch === epoch ? appliedReceipt.receiptId : initialReceiptId;
1431
+ const rememberReceipt = (result) => {
1432
+ setAppliedReceipt({
1433
+ epoch,
1434
+ receiptId: result.receiptId
1435
+ });
1436
+ };
1437
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1438
+ /* @__PURE__ */ jsxs("div", {
1439
+ "data-domainkit-part": "connected-card",
1440
+ children: [/* @__PURE__ */ jsxs("div", {
1441
+ "data-domainkit-part": "connected-identity",
1442
+ children: [/* @__PURE__ */ jsx(Mark, { provider: connection.provider }), /* @__PURE__ */ jsx(Status$2, { state: connection })]
1443
+ }), /* @__PURE__ */ jsxs("div", {
1444
+ "data-domainkit-part": "connected-actions",
1445
+ children: [
1446
+ /* @__PURE__ */ jsx(Flow$1, {
1447
+ connection,
1448
+ onApplied: rememberReceipt,
1449
+ records,
1450
+ showRecords: false
1451
+ }),
1452
+ /* @__PURE__ */ jsx(Status, { config: {
1453
+ connection,
1454
+ domain: connection.domain,
1455
+ records
1456
+ } }),
1457
+ /* @__PURE__ */ jsx(DisconnectAction, { connection })
1458
+ ]
1459
+ })]
1460
+ }),
1461
+ /* @__PURE__ */ jsx(Table, { records }),
1462
+ receiptId === void 0 ? null : /* @__PURE__ */ jsx(Flow$3, {
1463
+ connection,
1464
+ receiptId
1465
+ })
1466
+ ] });
1467
+ }
1468
+ //#endregion
1469
+ //#region src/testing.ts
1470
+ var testing_exports = /* @__PURE__ */ __exportAll({
1471
+ makeFakeTransport: () => makeFakeTransport,
1472
+ provider: () => provider
1473
+ });
1474
+ const provider = (overrides = {}) => ({
1475
+ authentication: [{
1476
+ _tag: "OAuth",
1477
+ label: "Continue with OAuth"
1478
+ }, {
1479
+ _tag: "Token",
1480
+ label: "Connect with token",
1481
+ placeholder: "Paste API token"
1482
+ }],
1483
+ id: "cloudflare",
1484
+ name: "Cloudflare",
1485
+ ...overrides
1486
+ });
1487
+ function makeFakeTransport(options) {
1488
+ const calls = {
1489
+ apply: [],
1490
+ cleanupApply: [],
1491
+ cleanupPlan: [],
1492
+ connect: [],
1493
+ inspect: [],
1494
+ observe: [],
1495
+ plan: [],
1496
+ removeDomain: [],
1497
+ reuse: []
1498
+ };
1499
+ const inspections = Array.isArray(options.inspect) ? [...options.inspect] : [options.inspect];
1500
+ return {
1501
+ calls,
1502
+ cleanup: {
1503
+ apply: async (input) => {
1504
+ calls.cleanupApply.push(input);
1505
+ return options.cleanupApply ?? {
1506
+ _tag: "Cleaned",
1507
+ operationId: "cleanup-operation-1",
1508
+ results: []
1509
+ };
1510
+ },
1511
+ plan: async (input) => {
1512
+ calls.cleanupPlan.push(input);
1513
+ return options.cleanupPlan ?? {
1514
+ _tag: "CleanupPlan",
1515
+ digest: "cleanup-digest-1",
1516
+ expiresAt: "2099-01-01T00:00:00.000Z",
1517
+ operations: []
1518
+ };
1519
+ }
1520
+ },
1521
+ connection: {
1522
+ connect: async (input) => {
1523
+ calls.connect.push(input);
1524
+ return options.connect ?? {
1525
+ _tag: "Connected",
1526
+ connectionId: "connection-1",
1527
+ domain: input.domain,
1528
+ provider: provider()
1529
+ };
1530
+ },
1531
+ inspect: async (input) => {
1532
+ calls.inspect.push(input);
1533
+ return inspections.shift() ?? inspections.at(-1) ?? options.inspect;
1534
+ },
1535
+ reuse: async (input) => {
1536
+ calls.reuse.push(input);
1537
+ return options.reuse ?? {
1538
+ _tag: "Connected",
1539
+ connectionId: input.connectionId,
1540
+ domain: input.domain,
1541
+ provider: provider()
1542
+ };
1543
+ },
1544
+ removeDomain: async (input) => {
1545
+ calls.removeDomain.push(input);
1546
+ return options.removeDomain ?? {
1547
+ _tag: "Removed",
1548
+ connectionId: input.connectionId,
1549
+ domain: input.domain,
1550
+ remainingDomainCount: 0
1551
+ };
1552
+ }
1553
+ },
1554
+ provisioning: {
1555
+ apply: async (input) => {
1556
+ calls.apply.push(input);
1557
+ return options.apply ?? {
1558
+ _tag: "Applied",
1559
+ operationId: "apply-operation-1",
1560
+ receiptId: "receipt-1",
1561
+ results: []
1562
+ };
1563
+ },
1564
+ plan: async (input) => {
1565
+ calls.plan.push(input);
1566
+ return options.plan ?? {
1567
+ _tag: "Plan",
1568
+ digest: "plan-digest-1",
1569
+ expiresAt: "2099-01-01T00:00:00.000Z",
1570
+ operations: input.records.map((record) => ({
1571
+ _tag: "Create",
1572
+ id: `create-${record.id}`,
1573
+ record
1574
+ }))
1575
+ };
1576
+ }
1577
+ },
1578
+ verification: { observe: async (input) => {
1579
+ calls.observe.push(input);
1580
+ return options.observe ?? {
1581
+ _tag: "Observation",
1582
+ provider: input.sources.provider ? input.records.map((record) => ({
1583
+ _tag: "Found",
1584
+ recordId: record.id
1585
+ })) : [],
1586
+ publicDns: input.sources.publicDns ? input.records.map((record) => ({
1587
+ _tag: "Found",
1588
+ recordId: record.id
1589
+ })) : []
1590
+ };
1591
+ } }
1592
+ };
1593
+ }
1594
+ //#endregion
1595
+ //#region src/transport.ts
1596
+ var transport_exports = /* @__PURE__ */ __exportAll({});
1597
+ //#endregion
1598
+ export { cleanup_exports as Cleanup, connection_exports as Connection, domain_exports as Domain, domain_kit_exports as DomainKit, messages_exports as Messages, provider_exports as Provider, provisioning_exports as Provisioning, records_exports as Records, testing_exports as Testing, theme_exports as Theme, transport_exports as Transport, verification_exports as Verification };
1599
+
1600
+ //# sourceMappingURL=index.mjs.map