@bettercms-ai/sdk 1.32.0 → 1.34.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/config.cjs +55 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +42 -0
- package/dist/config.d.ts +42 -0
- package/dist/config.js +29 -0
- package/dist/config.js.map +1 -0
- package/dist/draft.cjs +86 -0
- package/dist/draft.cjs.map +1 -0
- package/dist/draft.d.cts +24 -0
- package/dist/draft.d.ts +24 -0
- package/dist/draft.js +56 -0
- package/dist/draft.js.map +1 -0
- package/dist/index.d.cts +5 -488
- package/dist/index.d.ts +5 -488
- package/dist/read-ndf2I3D4.d.cts +393 -0
- package/dist/read-ndf2I3D4.d.ts +393 -0
- package/dist/read.cjs +457 -0
- package/dist/read.cjs.map +1 -0
- package/dist/read.d.cts +2 -0
- package/dist/read.d.ts +2 -0
- package/dist/read.js +423 -0
- package/dist/read.js.map +1 -0
- package/dist/seo.cjs +153 -0
- package/dist/seo.cjs.map +1 -0
- package/dist/seo.d.cts +99 -0
- package/dist/seo.d.ts +99 -0
- package/dist/seo.js +127 -0
- package/dist/seo.js.map +1 -0
- package/package.json +21 -1
package/dist/config.cjs
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/config.ts
|
|
21
|
+
var config_exports = {};
|
|
22
|
+
__export(config_exports, {
|
|
23
|
+
DEFAULT_MEDIA_URL: () => DEFAULT_MEDIA_URL,
|
|
24
|
+
resolveBcmsConfig: () => resolveBcmsConfig
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(config_exports);
|
|
27
|
+
var DEFAULT_MEDIA_URL = "https://cdn.bettercms.ai";
|
|
28
|
+
function resolveBcmsConfig(input) {
|
|
29
|
+
const env = input.env ?? {};
|
|
30
|
+
const fromEnv = (name) => {
|
|
31
|
+
for (const p of input.prefixes) {
|
|
32
|
+
const v = env[`${p}BCMS_${name}`];
|
|
33
|
+
if (v) return v;
|
|
34
|
+
}
|
|
35
|
+
return void 0;
|
|
36
|
+
};
|
|
37
|
+
let snap;
|
|
38
|
+
const snapshot = () => snap ??= input.snapshot?.() ?? {};
|
|
39
|
+
const o = input.options ?? {};
|
|
40
|
+
const config = {
|
|
41
|
+
apiUrl: (o.apiUrl ?? fromEnv("API_URL") ?? snapshot().apiUrl ?? "").replace(/\/+$/, ""),
|
|
42
|
+
workspace: o.workspace ?? fromEnv("WORKSPACE") ?? snapshot().workspace ?? "",
|
|
43
|
+
projectId: o.projectId ?? fromEnv("PROJECT_ID") ?? snapshot().projectId,
|
|
44
|
+
mediaUrl: (o.mediaUrl ?? fromEnv("MEDIA_URL") ?? DEFAULT_MEDIA_URL).replace(/\/+$/, ""),
|
|
45
|
+
studioUrl: o.studioUrl ?? fromEnv("STUDIO_URL")
|
|
46
|
+
};
|
|
47
|
+
const missing = ["apiUrl", "workspace"].filter((k) => !config[k]);
|
|
48
|
+
return { config, missing };
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
DEFAULT_MEDIA_URL,
|
|
53
|
+
resolveBcmsConfig
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=config.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/config.ts"],"sourcesContent":["/**\n * Where a site's BetterCMS settings come from, the same way on every framework: explicit options,\n * then `<PREFIX>BCMS_*` env (each framework exposes env to the browser under its own prefix:\n * `PUBLIC_` for Astro and SvelteKit, `NEXT_PUBLIC_` for Next, `VITE_` for Vite React,\n * `NUXT_PUBLIC_` for Nuxt), then the build snapshot `bettercms pull-content` writes.\n *\n * Pure: the adapter passes its env and reads the snapshot (this module touches no filesystem).\n */\n\nexport const DEFAULT_MEDIA_URL = \"https://cdn.bettercms.ai\";\n\nexport interface BcmsSiteOptions {\n apiUrl?: string;\n workspace?: string;\n projectId?: string;\n mediaUrl?: string;\n studioUrl?: string;\n}\n\nexport interface BcmsSiteConfig {\n apiUrl: string;\n workspace: string;\n projectId?: string;\n mediaUrl: string;\n studioUrl?: string;\n}\n\nexport interface ResolveBcmsConfigInput {\n options?: BcmsSiteOptions;\n env?: Record<string, string | undefined>;\n /** Env prefixes, first match wins: `[\"NEXT_PUBLIC_\", \"\"]` reads NEXT_PUBLIC_BCMS_API_URL, then BCMS_API_URL. */\n prefixes: string[];\n /** The build snapshot's identity, read only when options and env both miss. */\n snapshot?: () => { apiUrl?: string; workspace?: string; projectId?: string };\n}\n\n/** The resolved settings, and which essentials are missing (the adapter words the error). */\nexport function resolveBcmsConfig(input: ResolveBcmsConfigInput): { config: BcmsSiteConfig; missing: (\"apiUrl\" | \"workspace\")[] } {\n const env = input.env ?? {};\n const fromEnv = (name: string) => {\n for (const p of input.prefixes) {\n const v = env[`${p}BCMS_${name}`];\n if (v) return v;\n }\n return undefined;\n };\n let snap: ReturnType<NonNullable<ResolveBcmsConfigInput[\"snapshot\"]>> | undefined;\n const snapshot = () => (snap ??= input.snapshot?.() ?? {});\n const o = input.options ?? {};\n const config: BcmsSiteConfig = {\n apiUrl: (o.apiUrl ?? fromEnv(\"API_URL\") ?? snapshot().apiUrl ?? \"\").replace(/\\/+$/, \"\"),\n workspace: o.workspace ?? fromEnv(\"WORKSPACE\") ?? snapshot().workspace ?? \"\",\n projectId: o.projectId ?? fromEnv(\"PROJECT_ID\") ?? snapshot().projectId,\n mediaUrl: (o.mediaUrl ?? fromEnv(\"MEDIA_URL\") ?? DEFAULT_MEDIA_URL).replace(/\\/+$/, \"\"),\n studioUrl: o.studioUrl ?? fromEnv(\"STUDIO_URL\"),\n };\n const missing = ([\"apiUrl\", \"workspace\"] as const).filter((k) => !config[k]);\n return { config, missing };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,oBAAoB;AA4B1B,SAAS,kBAAkB,OAAgG;AAChI,QAAM,MAAM,MAAM,OAAO,CAAC;AAC1B,QAAM,UAAU,CAAC,SAAiB;AAChC,eAAW,KAAK,MAAM,UAAU;AAC9B,YAAM,IAAI,IAAI,GAAG,CAAC,QAAQ,IAAI,EAAE;AAChC,UAAI,EAAG,QAAO;AAAA,IAChB;AACA,WAAO;AAAA,EACT;AACA,MAAI;AACJ,QAAM,WAAW,MAAO,SAAS,MAAM,WAAW,KAAK,CAAC;AACxD,QAAM,IAAI,MAAM,WAAW,CAAC;AAC5B,QAAM,SAAyB;AAAA,IAC7B,SAAS,EAAE,UAAU,QAAQ,SAAS,KAAK,SAAS,EAAE,UAAU,IAAI,QAAQ,QAAQ,EAAE;AAAA,IACtF,WAAW,EAAE,aAAa,QAAQ,WAAW,KAAK,SAAS,EAAE,aAAa;AAAA,IAC1E,WAAW,EAAE,aAAa,QAAQ,YAAY,KAAK,SAAS,EAAE;AAAA,IAC9D,WAAW,EAAE,YAAY,QAAQ,WAAW,KAAK,mBAAmB,QAAQ,QAAQ,EAAE;AAAA,IACtF,WAAW,EAAE,aAAa,QAAQ,YAAY;AAAA,EAChD;AACA,QAAM,UAAW,CAAC,UAAU,WAAW,EAAY,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC3E,SAAO,EAAE,QAAQ,QAAQ;AAC3B;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a site's BetterCMS settings come from, the same way on every framework: explicit options,
|
|
3
|
+
* then `<PREFIX>BCMS_*` env (each framework exposes env to the browser under its own prefix:
|
|
4
|
+
* `PUBLIC_` for Astro and SvelteKit, `NEXT_PUBLIC_` for Next, `VITE_` for Vite React,
|
|
5
|
+
* `NUXT_PUBLIC_` for Nuxt), then the build snapshot `bettercms pull-content` writes.
|
|
6
|
+
*
|
|
7
|
+
* Pure: the adapter passes its env and reads the snapshot (this module touches no filesystem).
|
|
8
|
+
*/
|
|
9
|
+
declare const DEFAULT_MEDIA_URL = "https://cdn.bettercms.ai";
|
|
10
|
+
interface BcmsSiteOptions {
|
|
11
|
+
apiUrl?: string;
|
|
12
|
+
workspace?: string;
|
|
13
|
+
projectId?: string;
|
|
14
|
+
mediaUrl?: string;
|
|
15
|
+
studioUrl?: string;
|
|
16
|
+
}
|
|
17
|
+
interface BcmsSiteConfig {
|
|
18
|
+
apiUrl: string;
|
|
19
|
+
workspace: string;
|
|
20
|
+
projectId?: string;
|
|
21
|
+
mediaUrl: string;
|
|
22
|
+
studioUrl?: string;
|
|
23
|
+
}
|
|
24
|
+
interface ResolveBcmsConfigInput {
|
|
25
|
+
options?: BcmsSiteOptions;
|
|
26
|
+
env?: Record<string, string | undefined>;
|
|
27
|
+
/** Env prefixes, first match wins: `["NEXT_PUBLIC_", ""]` reads NEXT_PUBLIC_BCMS_API_URL, then BCMS_API_URL. */
|
|
28
|
+
prefixes: string[];
|
|
29
|
+
/** The build snapshot's identity, read only when options and env both miss. */
|
|
30
|
+
snapshot?: () => {
|
|
31
|
+
apiUrl?: string;
|
|
32
|
+
workspace?: string;
|
|
33
|
+
projectId?: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** The resolved settings, and which essentials are missing (the adapter words the error). */
|
|
37
|
+
declare function resolveBcmsConfig(input: ResolveBcmsConfigInput): {
|
|
38
|
+
config: BcmsSiteConfig;
|
|
39
|
+
missing: ("apiUrl" | "workspace")[];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { type BcmsSiteConfig, type BcmsSiteOptions, DEFAULT_MEDIA_URL, type ResolveBcmsConfigInput, resolveBcmsConfig };
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a site's BetterCMS settings come from, the same way on every framework: explicit options,
|
|
3
|
+
* then `<PREFIX>BCMS_*` env (each framework exposes env to the browser under its own prefix:
|
|
4
|
+
* `PUBLIC_` for Astro and SvelteKit, `NEXT_PUBLIC_` for Next, `VITE_` for Vite React,
|
|
5
|
+
* `NUXT_PUBLIC_` for Nuxt), then the build snapshot `bettercms pull-content` writes.
|
|
6
|
+
*
|
|
7
|
+
* Pure: the adapter passes its env and reads the snapshot (this module touches no filesystem).
|
|
8
|
+
*/
|
|
9
|
+
declare const DEFAULT_MEDIA_URL = "https://cdn.bettercms.ai";
|
|
10
|
+
interface BcmsSiteOptions {
|
|
11
|
+
apiUrl?: string;
|
|
12
|
+
workspace?: string;
|
|
13
|
+
projectId?: string;
|
|
14
|
+
mediaUrl?: string;
|
|
15
|
+
studioUrl?: string;
|
|
16
|
+
}
|
|
17
|
+
interface BcmsSiteConfig {
|
|
18
|
+
apiUrl: string;
|
|
19
|
+
workspace: string;
|
|
20
|
+
projectId?: string;
|
|
21
|
+
mediaUrl: string;
|
|
22
|
+
studioUrl?: string;
|
|
23
|
+
}
|
|
24
|
+
interface ResolveBcmsConfigInput {
|
|
25
|
+
options?: BcmsSiteOptions;
|
|
26
|
+
env?: Record<string, string | undefined>;
|
|
27
|
+
/** Env prefixes, first match wins: `["NEXT_PUBLIC_", ""]` reads NEXT_PUBLIC_BCMS_API_URL, then BCMS_API_URL. */
|
|
28
|
+
prefixes: string[];
|
|
29
|
+
/** The build snapshot's identity, read only when options and env both miss. */
|
|
30
|
+
snapshot?: () => {
|
|
31
|
+
apiUrl?: string;
|
|
32
|
+
workspace?: string;
|
|
33
|
+
projectId?: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** The resolved settings, and which essentials are missing (the adapter words the error). */
|
|
37
|
+
declare function resolveBcmsConfig(input: ResolveBcmsConfigInput): {
|
|
38
|
+
config: BcmsSiteConfig;
|
|
39
|
+
missing: ("apiUrl" | "workspace")[];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { type BcmsSiteConfig, type BcmsSiteOptions, DEFAULT_MEDIA_URL, type ResolveBcmsConfigInput, resolveBcmsConfig };
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/config.ts
|
|
2
|
+
var DEFAULT_MEDIA_URL = "https://cdn.bettercms.ai";
|
|
3
|
+
function resolveBcmsConfig(input) {
|
|
4
|
+
const env = input.env ?? {};
|
|
5
|
+
const fromEnv = (name) => {
|
|
6
|
+
for (const p of input.prefixes) {
|
|
7
|
+
const v = env[`${p}BCMS_${name}`];
|
|
8
|
+
if (v) return v;
|
|
9
|
+
}
|
|
10
|
+
return void 0;
|
|
11
|
+
};
|
|
12
|
+
let snap;
|
|
13
|
+
const snapshot = () => snap ??= input.snapshot?.() ?? {};
|
|
14
|
+
const o = input.options ?? {};
|
|
15
|
+
const config = {
|
|
16
|
+
apiUrl: (o.apiUrl ?? fromEnv("API_URL") ?? snapshot().apiUrl ?? "").replace(/\/+$/, ""),
|
|
17
|
+
workspace: o.workspace ?? fromEnv("WORKSPACE") ?? snapshot().workspace ?? "",
|
|
18
|
+
projectId: o.projectId ?? fromEnv("PROJECT_ID") ?? snapshot().projectId,
|
|
19
|
+
mediaUrl: (o.mediaUrl ?? fromEnv("MEDIA_URL") ?? DEFAULT_MEDIA_URL).replace(/\/+$/, ""),
|
|
20
|
+
studioUrl: o.studioUrl ?? fromEnv("STUDIO_URL")
|
|
21
|
+
};
|
|
22
|
+
const missing = ["apiUrl", "workspace"].filter((k) => !config[k]);
|
|
23
|
+
return { config, missing };
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
DEFAULT_MEDIA_URL,
|
|
27
|
+
resolveBcmsConfig
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/config.ts"],"sourcesContent":["/**\n * Where a site's BetterCMS settings come from, the same way on every framework: explicit options,\n * then `<PREFIX>BCMS_*` env (each framework exposes env to the browser under its own prefix:\n * `PUBLIC_` for Astro and SvelteKit, `NEXT_PUBLIC_` for Next, `VITE_` for Vite React,\n * `NUXT_PUBLIC_` for Nuxt), then the build snapshot `bettercms pull-content` writes.\n *\n * Pure: the adapter passes its env and reads the snapshot (this module touches no filesystem).\n */\n\nexport const DEFAULT_MEDIA_URL = \"https://cdn.bettercms.ai\";\n\nexport interface BcmsSiteOptions {\n apiUrl?: string;\n workspace?: string;\n projectId?: string;\n mediaUrl?: string;\n studioUrl?: string;\n}\n\nexport interface BcmsSiteConfig {\n apiUrl: string;\n workspace: string;\n projectId?: string;\n mediaUrl: string;\n studioUrl?: string;\n}\n\nexport interface ResolveBcmsConfigInput {\n options?: BcmsSiteOptions;\n env?: Record<string, string | undefined>;\n /** Env prefixes, first match wins: `[\"NEXT_PUBLIC_\", \"\"]` reads NEXT_PUBLIC_BCMS_API_URL, then BCMS_API_URL. */\n prefixes: string[];\n /** The build snapshot's identity, read only when options and env both miss. */\n snapshot?: () => { apiUrl?: string; workspace?: string; projectId?: string };\n}\n\n/** The resolved settings, and which essentials are missing (the adapter words the error). */\nexport function resolveBcmsConfig(input: ResolveBcmsConfigInput): { config: BcmsSiteConfig; missing: (\"apiUrl\" | \"workspace\")[] } {\n const env = input.env ?? {};\n const fromEnv = (name: string) => {\n for (const p of input.prefixes) {\n const v = env[`${p}BCMS_${name}`];\n if (v) return v;\n }\n return undefined;\n };\n let snap: ReturnType<NonNullable<ResolveBcmsConfigInput[\"snapshot\"]>> | undefined;\n const snapshot = () => (snap ??= input.snapshot?.() ?? {});\n const o = input.options ?? {};\n const config: BcmsSiteConfig = {\n apiUrl: (o.apiUrl ?? fromEnv(\"API_URL\") ?? snapshot().apiUrl ?? \"\").replace(/\\/+$/, \"\"),\n workspace: o.workspace ?? fromEnv(\"WORKSPACE\") ?? snapshot().workspace ?? \"\",\n projectId: o.projectId ?? fromEnv(\"PROJECT_ID\") ?? snapshot().projectId,\n mediaUrl: (o.mediaUrl ?? fromEnv(\"MEDIA_URL\") ?? DEFAULT_MEDIA_URL).replace(/\\/+$/, \"\"),\n studioUrl: o.studioUrl ?? fromEnv(\"STUDIO_URL\"),\n };\n const missing = ([\"apiUrl\", \"workspace\"] as const).filter((k) => !config[k]);\n return { config, missing };\n}\n"],"mappings":";AASO,IAAM,oBAAoB;AA4B1B,SAAS,kBAAkB,OAAgG;AAChI,QAAM,MAAM,MAAM,OAAO,CAAC;AAC1B,QAAM,UAAU,CAAC,SAAiB;AAChC,eAAW,KAAK,MAAM,UAAU;AAC9B,YAAM,IAAI,IAAI,GAAG,CAAC,QAAQ,IAAI,EAAE;AAChC,UAAI,EAAG,QAAO;AAAA,IAChB;AACA,WAAO;AAAA,EACT;AACA,MAAI;AACJ,QAAM,WAAW,MAAO,SAAS,MAAM,WAAW,KAAK,CAAC;AACxD,QAAM,IAAI,MAAM,WAAW,CAAC;AAC5B,QAAM,SAAyB;AAAA,IAC7B,SAAS,EAAE,UAAU,QAAQ,SAAS,KAAK,SAAS,EAAE,UAAU,IAAI,QAAQ,QAAQ,EAAE;AAAA,IACtF,WAAW,EAAE,aAAa,QAAQ,WAAW,KAAK,SAAS,EAAE,aAAa;AAAA,IAC1E,WAAW,EAAE,aAAa,QAAQ,YAAY,KAAK,SAAS,EAAE;AAAA,IAC9D,WAAW,EAAE,YAAY,QAAQ,WAAW,KAAK,mBAAmB,QAAQ,QAAQ,EAAE;AAAA,IACtF,WAAW,EAAE,aAAa,QAAQ,YAAY;AAAA,EAChD;AACA,QAAM,UAAW,CAAC,UAAU,WAAW,EAAY,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC3E,SAAO,EAAE,QAAQ,QAAQ;AAC3B;","names":[]}
|
package/dist/draft.cjs
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/draft.ts
|
|
21
|
+
var draft_exports = {};
|
|
22
|
+
__export(draft_exports, {
|
|
23
|
+
DRAFT_COOKIE: () => DRAFT_COOKIE,
|
|
24
|
+
decodeTokenSlug: () => decodeTokenSlug,
|
|
25
|
+
previewTokenValid: () => previewTokenValid,
|
|
26
|
+
safeRedirectPath: () => safeRedirectPath,
|
|
27
|
+
signValue: () => signValue,
|
|
28
|
+
verifyValue: () => verifyValue
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(draft_exports);
|
|
31
|
+
var DRAFT_COOKIE = "bcms-draft";
|
|
32
|
+
var enc = new TextEncoder();
|
|
33
|
+
function base64url(bytes) {
|
|
34
|
+
const b = btoa(String.fromCharCode(...new Uint8Array(bytes)));
|
|
35
|
+
return b.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
36
|
+
}
|
|
37
|
+
async function hmac(value, secret) {
|
|
38
|
+
const key = await crypto.subtle.importKey("raw", enc.encode(secret), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
39
|
+
return base64url(await crypto.subtle.sign("HMAC", key, enc.encode(value)));
|
|
40
|
+
}
|
|
41
|
+
async function signValue(value, secret) {
|
|
42
|
+
return `${value}.${await hmac(value, secret)}`;
|
|
43
|
+
}
|
|
44
|
+
async function verifyValue(signed, secret) {
|
|
45
|
+
const idx = signed.lastIndexOf(".");
|
|
46
|
+
if (idx < 0) return null;
|
|
47
|
+
const value = signed.slice(0, idx);
|
|
48
|
+
const sig = signed.slice(idx + 1);
|
|
49
|
+
const expected = await hmac(value, secret);
|
|
50
|
+
if (sig.length !== expected.length) return null;
|
|
51
|
+
let diff = 0;
|
|
52
|
+
for (let i = 0; i < sig.length; i++) diff |= sig.charCodeAt(i) ^ expected.charCodeAt(i);
|
|
53
|
+
return diff === 0 ? value : null;
|
|
54
|
+
}
|
|
55
|
+
function safeRedirectPath(to) {
|
|
56
|
+
return to.startsWith("/") && !to.startsWith("//") && !to.startsWith("/\\") ? to : "/";
|
|
57
|
+
}
|
|
58
|
+
function decodeTokenSlug(token) {
|
|
59
|
+
try {
|
|
60
|
+
const part = token.split(".")[1];
|
|
61
|
+
if (!part) return null;
|
|
62
|
+
const bytes = Uint8Array.from(atob(part.replace(/-/g, "+").replace(/_/g, "/")), (c) => c.charCodeAt(0));
|
|
63
|
+
const json = JSON.parse(new TextDecoder().decode(bytes));
|
|
64
|
+
return json.entrySlug ?? null;
|
|
65
|
+
} catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function previewTokenValid(apiUrl, token, fetchImpl = fetch) {
|
|
70
|
+
const slug = decodeTokenSlug(token);
|
|
71
|
+
if (!slug) return false;
|
|
72
|
+
const res = await fetchImpl(`${apiUrl.replace(/\/+$/, "")}/api/v1/preview/${encodeURIComponent(slug)}?token=${encodeURIComponent(token)}`);
|
|
73
|
+
await res.body?.cancel().catch(() => {
|
|
74
|
+
});
|
|
75
|
+
return res.ok;
|
|
76
|
+
}
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
DRAFT_COOKIE,
|
|
80
|
+
decodeTokenSlug,
|
|
81
|
+
previewTokenValid,
|
|
82
|
+
safeRedirectPath,
|
|
83
|
+
signValue,
|
|
84
|
+
verifyValue
|
|
85
|
+
});
|
|
86
|
+
//# sourceMappingURL=draft.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/draft.ts"],"sourcesContent":["/**\n * Draft mode, shared by every framework adapter: the signed cookie that says \"this visitor is\n * previewing\", the preview token's slug, and the redirect a draft route may follow.\n *\n * Web Crypto and `atob` only, so it runs in Node, edge runtimes and workers alike. Each adapter\n * mounts its own routes around these; the rules live here once.\n */\n\n/** The draft cookie every adapter sets: one name, so an editor link works on any framework. */\nexport const DRAFT_COOKIE = \"bcms-draft\";\n\nconst enc = new TextEncoder();\n\nfunction base64url(bytes: ArrayBuffer): string {\n const b = btoa(String.fromCharCode(...new Uint8Array(bytes)));\n return b.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\n}\n\nasync function hmac(value: string, secret: string): Promise<string> {\n const key = await crypto.subtle.importKey(\"raw\", enc.encode(secret), { name: \"HMAC\", hash: \"SHA-256\" }, false, [\"sign\"]);\n return base64url(await crypto.subtle.sign(\"HMAC\", key, enc.encode(value)));\n}\n\n/** Sign a value as `value.sig` for tamper-evident cookie storage (HMAC-SHA256, base64url). */\nexport async function signValue(value: string, secret: string): Promise<string> {\n return `${value}.${await hmac(value, secret)}`;\n}\n\n/** The original value of a signed one, or null when it was tampered with. */\nexport async function verifyValue(signed: string, secret: string): Promise<string | null> {\n const idx = signed.lastIndexOf(\".\");\n if (idx < 0) return null;\n const value = signed.slice(0, idx);\n const sig = signed.slice(idx + 1);\n const expected = await hmac(value, secret);\n if (sig.length !== expected.length) return null;\n let diff = 0;\n for (let i = 0; i < sig.length; i++) diff |= sig.charCodeAt(i) ^ expected.charCodeAt(i);\n return diff === 0 ? value : null;\n}\n\n/** Only same-origin relative paths: blocks \"//evil.com\", \"https://evil.com\" and \"/\\\\evil.com\". */\nexport function safeRedirectPath(to: string): string {\n return to.startsWith(\"/\") && !to.startsWith(\"//\") && !to.startsWith(\"/\\\\\") ? to : \"/\";\n}\n\n/** A preview token's `entrySlug`, read from its payload UNVERIFIED (the backend verifies it). */\nexport function decodeTokenSlug(token: string): string | null {\n try {\n const part = token.split(\".\")[1];\n if (!part) return null;\n // atob gives bytes as Latin-1: decoded as UTF-8, a slug like `über-uns` survives.\n const bytes = Uint8Array.from(atob(part.replace(/-/g, \"+\").replace(/_/g, \"/\")), (c) => c.charCodeAt(0));\n const json = JSON.parse(new TextDecoder().decode(bytes)) as { entrySlug?: string };\n return json.entrySlug ?? null;\n } catch {\n return null;\n }\n}\n\n/**\n * Ask the backend whether a preview token is good: the backend is the signature authority, so a\n * draft route enables draft mode only on its yes.\n */\nexport async function previewTokenValid(apiUrl: string, token: string, fetchImpl: typeof fetch = fetch): Promise<boolean> {\n const slug = decodeTokenSlug(token);\n if (!slug) return false;\n const res = await fetchImpl(`${apiUrl.replace(/\\/+$/, \"\")}/api/v1/preview/${encodeURIComponent(slug)}?token=${encodeURIComponent(token)}`);\n await res.body?.cancel().catch(() => {});\n return res.ok;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,eAAe;AAE5B,IAAM,MAAM,IAAI,YAAY;AAE5B,SAAS,UAAU,OAA4B;AAC7C,QAAM,IAAI,KAAK,OAAO,aAAa,GAAG,IAAI,WAAW,KAAK,CAAC,CAAC;AAC5D,SAAO,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,EAAE;AACpE;AAEA,eAAe,KAAK,OAAe,QAAiC;AAClE,QAAM,MAAM,MAAM,OAAO,OAAO,UAAU,OAAO,IAAI,OAAO,MAAM,GAAG,EAAE,MAAM,QAAQ,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;AACvH,SAAO,UAAU,MAAM,OAAO,OAAO,KAAK,QAAQ,KAAK,IAAI,OAAO,KAAK,CAAC,CAAC;AAC3E;AAGA,eAAsB,UAAU,OAAe,QAAiC;AAC9E,SAAO,GAAG,KAAK,IAAI,MAAM,KAAK,OAAO,MAAM,CAAC;AAC9C;AAGA,eAAsB,YAAY,QAAgB,QAAwC;AACxF,QAAM,MAAM,OAAO,YAAY,GAAG;AAClC,MAAI,MAAM,EAAG,QAAO;AACpB,QAAM,QAAQ,OAAO,MAAM,GAAG,GAAG;AACjC,QAAM,MAAM,OAAO,MAAM,MAAM,CAAC;AAChC,QAAM,WAAW,MAAM,KAAK,OAAO,MAAM;AACzC,MAAI,IAAI,WAAW,SAAS,OAAQ,QAAO;AAC3C,MAAI,OAAO;AACX,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,IAAK,SAAQ,IAAI,WAAW,CAAC,IAAI,SAAS,WAAW,CAAC;AACtF,SAAO,SAAS,IAAI,QAAQ;AAC9B;AAGO,SAAS,iBAAiB,IAAoB;AACnD,SAAO,GAAG,WAAW,GAAG,KAAK,CAAC,GAAG,WAAW,IAAI,KAAK,CAAC,GAAG,WAAW,KAAK,IAAI,KAAK;AACpF;AAGO,SAAS,gBAAgB,OAA8B;AAC5D,MAAI;AACF,UAAM,OAAO,MAAM,MAAM,GAAG,EAAE,CAAC;AAC/B,QAAI,CAAC,KAAM,QAAO;AAElB,UAAM,QAAQ,WAAW,KAAK,KAAK,KAAK,QAAQ,MAAM,GAAG,EAAE,QAAQ,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AACtG,UAAM,OAAO,KAAK,MAAM,IAAI,YAAY,EAAE,OAAO,KAAK,CAAC;AACvD,WAAO,KAAK,aAAa;AAAA,EAC3B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAMA,eAAsB,kBAAkB,QAAgB,OAAe,YAA0B,OAAyB;AACxH,QAAM,OAAO,gBAAgB,KAAK;AAClC,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,MAAM,MAAM,UAAU,GAAG,OAAO,QAAQ,QAAQ,EAAE,CAAC,mBAAmB,mBAAmB,IAAI,CAAC,UAAU,mBAAmB,KAAK,CAAC,EAAE;AACzI,QAAM,IAAI,MAAM,OAAO,EAAE,MAAM,MAAM;AAAA,EAAC,CAAC;AACvC,SAAO,IAAI;AACb;","names":[]}
|
package/dist/draft.d.cts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Draft mode, shared by every framework adapter: the signed cookie that says "this visitor is
|
|
3
|
+
* previewing", the preview token's slug, and the redirect a draft route may follow.
|
|
4
|
+
*
|
|
5
|
+
* Web Crypto and `atob` only, so it runs in Node, edge runtimes and workers alike. Each adapter
|
|
6
|
+
* mounts its own routes around these; the rules live here once.
|
|
7
|
+
*/
|
|
8
|
+
/** The draft cookie every adapter sets: one name, so an editor link works on any framework. */
|
|
9
|
+
declare const DRAFT_COOKIE = "bcms-draft";
|
|
10
|
+
/** Sign a value as `value.sig` for tamper-evident cookie storage (HMAC-SHA256, base64url). */
|
|
11
|
+
declare function signValue(value: string, secret: string): Promise<string>;
|
|
12
|
+
/** The original value of a signed one, or null when it was tampered with. */
|
|
13
|
+
declare function verifyValue(signed: string, secret: string): Promise<string | null>;
|
|
14
|
+
/** Only same-origin relative paths: blocks "//evil.com", "https://evil.com" and "/\\evil.com". */
|
|
15
|
+
declare function safeRedirectPath(to: string): string;
|
|
16
|
+
/** A preview token's `entrySlug`, read from its payload UNVERIFIED (the backend verifies it). */
|
|
17
|
+
declare function decodeTokenSlug(token: string): string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Ask the backend whether a preview token is good: the backend is the signature authority, so a
|
|
20
|
+
* draft route enables draft mode only on its yes.
|
|
21
|
+
*/
|
|
22
|
+
declare function previewTokenValid(apiUrl: string, token: string, fetchImpl?: typeof fetch): Promise<boolean>;
|
|
23
|
+
|
|
24
|
+
export { DRAFT_COOKIE, decodeTokenSlug, previewTokenValid, safeRedirectPath, signValue, verifyValue };
|
package/dist/draft.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Draft mode, shared by every framework adapter: the signed cookie that says "this visitor is
|
|
3
|
+
* previewing", the preview token's slug, and the redirect a draft route may follow.
|
|
4
|
+
*
|
|
5
|
+
* Web Crypto and `atob` only, so it runs in Node, edge runtimes and workers alike. Each adapter
|
|
6
|
+
* mounts its own routes around these; the rules live here once.
|
|
7
|
+
*/
|
|
8
|
+
/** The draft cookie every adapter sets: one name, so an editor link works on any framework. */
|
|
9
|
+
declare const DRAFT_COOKIE = "bcms-draft";
|
|
10
|
+
/** Sign a value as `value.sig` for tamper-evident cookie storage (HMAC-SHA256, base64url). */
|
|
11
|
+
declare function signValue(value: string, secret: string): Promise<string>;
|
|
12
|
+
/** The original value of a signed one, or null when it was tampered with. */
|
|
13
|
+
declare function verifyValue(signed: string, secret: string): Promise<string | null>;
|
|
14
|
+
/** Only same-origin relative paths: blocks "//evil.com", "https://evil.com" and "/\\evil.com". */
|
|
15
|
+
declare function safeRedirectPath(to: string): string;
|
|
16
|
+
/** A preview token's `entrySlug`, read from its payload UNVERIFIED (the backend verifies it). */
|
|
17
|
+
declare function decodeTokenSlug(token: string): string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Ask the backend whether a preview token is good: the backend is the signature authority, so a
|
|
20
|
+
* draft route enables draft mode only on its yes.
|
|
21
|
+
*/
|
|
22
|
+
declare function previewTokenValid(apiUrl: string, token: string, fetchImpl?: typeof fetch): Promise<boolean>;
|
|
23
|
+
|
|
24
|
+
export { DRAFT_COOKIE, decodeTokenSlug, previewTokenValid, safeRedirectPath, signValue, verifyValue };
|
package/dist/draft.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// src/draft.ts
|
|
2
|
+
var DRAFT_COOKIE = "bcms-draft";
|
|
3
|
+
var enc = new TextEncoder();
|
|
4
|
+
function base64url(bytes) {
|
|
5
|
+
const b = btoa(String.fromCharCode(...new Uint8Array(bytes)));
|
|
6
|
+
return b.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
7
|
+
}
|
|
8
|
+
async function hmac(value, secret) {
|
|
9
|
+
const key = await crypto.subtle.importKey("raw", enc.encode(secret), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
10
|
+
return base64url(await crypto.subtle.sign("HMAC", key, enc.encode(value)));
|
|
11
|
+
}
|
|
12
|
+
async function signValue(value, secret) {
|
|
13
|
+
return `${value}.${await hmac(value, secret)}`;
|
|
14
|
+
}
|
|
15
|
+
async function verifyValue(signed, secret) {
|
|
16
|
+
const idx = signed.lastIndexOf(".");
|
|
17
|
+
if (idx < 0) return null;
|
|
18
|
+
const value = signed.slice(0, idx);
|
|
19
|
+
const sig = signed.slice(idx + 1);
|
|
20
|
+
const expected = await hmac(value, secret);
|
|
21
|
+
if (sig.length !== expected.length) return null;
|
|
22
|
+
let diff = 0;
|
|
23
|
+
for (let i = 0; i < sig.length; i++) diff |= sig.charCodeAt(i) ^ expected.charCodeAt(i);
|
|
24
|
+
return diff === 0 ? value : null;
|
|
25
|
+
}
|
|
26
|
+
function safeRedirectPath(to) {
|
|
27
|
+
return to.startsWith("/") && !to.startsWith("//") && !to.startsWith("/\\") ? to : "/";
|
|
28
|
+
}
|
|
29
|
+
function decodeTokenSlug(token) {
|
|
30
|
+
try {
|
|
31
|
+
const part = token.split(".")[1];
|
|
32
|
+
if (!part) return null;
|
|
33
|
+
const bytes = Uint8Array.from(atob(part.replace(/-/g, "+").replace(/_/g, "/")), (c) => c.charCodeAt(0));
|
|
34
|
+
const json = JSON.parse(new TextDecoder().decode(bytes));
|
|
35
|
+
return json.entrySlug ?? null;
|
|
36
|
+
} catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async function previewTokenValid(apiUrl, token, fetchImpl = fetch) {
|
|
41
|
+
const slug = decodeTokenSlug(token);
|
|
42
|
+
if (!slug) return false;
|
|
43
|
+
const res = await fetchImpl(`${apiUrl.replace(/\/+$/, "")}/api/v1/preview/${encodeURIComponent(slug)}?token=${encodeURIComponent(token)}`);
|
|
44
|
+
await res.body?.cancel().catch(() => {
|
|
45
|
+
});
|
|
46
|
+
return res.ok;
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
DRAFT_COOKIE,
|
|
50
|
+
decodeTokenSlug,
|
|
51
|
+
previewTokenValid,
|
|
52
|
+
safeRedirectPath,
|
|
53
|
+
signValue,
|
|
54
|
+
verifyValue
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=draft.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/draft.ts"],"sourcesContent":["/**\n * Draft mode, shared by every framework adapter: the signed cookie that says \"this visitor is\n * previewing\", the preview token's slug, and the redirect a draft route may follow.\n *\n * Web Crypto and `atob` only, so it runs in Node, edge runtimes and workers alike. Each adapter\n * mounts its own routes around these; the rules live here once.\n */\n\n/** The draft cookie every adapter sets: one name, so an editor link works on any framework. */\nexport const DRAFT_COOKIE = \"bcms-draft\";\n\nconst enc = new TextEncoder();\n\nfunction base64url(bytes: ArrayBuffer): string {\n const b = btoa(String.fromCharCode(...new Uint8Array(bytes)));\n return b.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\n}\n\nasync function hmac(value: string, secret: string): Promise<string> {\n const key = await crypto.subtle.importKey(\"raw\", enc.encode(secret), { name: \"HMAC\", hash: \"SHA-256\" }, false, [\"sign\"]);\n return base64url(await crypto.subtle.sign(\"HMAC\", key, enc.encode(value)));\n}\n\n/** Sign a value as `value.sig` for tamper-evident cookie storage (HMAC-SHA256, base64url). */\nexport async function signValue(value: string, secret: string): Promise<string> {\n return `${value}.${await hmac(value, secret)}`;\n}\n\n/** The original value of a signed one, or null when it was tampered with. */\nexport async function verifyValue(signed: string, secret: string): Promise<string | null> {\n const idx = signed.lastIndexOf(\".\");\n if (idx < 0) return null;\n const value = signed.slice(0, idx);\n const sig = signed.slice(idx + 1);\n const expected = await hmac(value, secret);\n if (sig.length !== expected.length) return null;\n let diff = 0;\n for (let i = 0; i < sig.length; i++) diff |= sig.charCodeAt(i) ^ expected.charCodeAt(i);\n return diff === 0 ? value : null;\n}\n\n/** Only same-origin relative paths: blocks \"//evil.com\", \"https://evil.com\" and \"/\\\\evil.com\". */\nexport function safeRedirectPath(to: string): string {\n return to.startsWith(\"/\") && !to.startsWith(\"//\") && !to.startsWith(\"/\\\\\") ? to : \"/\";\n}\n\n/** A preview token's `entrySlug`, read from its payload UNVERIFIED (the backend verifies it). */\nexport function decodeTokenSlug(token: string): string | null {\n try {\n const part = token.split(\".\")[1];\n if (!part) return null;\n // atob gives bytes as Latin-1: decoded as UTF-8, a slug like `über-uns` survives.\n const bytes = Uint8Array.from(atob(part.replace(/-/g, \"+\").replace(/_/g, \"/\")), (c) => c.charCodeAt(0));\n const json = JSON.parse(new TextDecoder().decode(bytes)) as { entrySlug?: string };\n return json.entrySlug ?? null;\n } catch {\n return null;\n }\n}\n\n/**\n * Ask the backend whether a preview token is good: the backend is the signature authority, so a\n * draft route enables draft mode only on its yes.\n */\nexport async function previewTokenValid(apiUrl: string, token: string, fetchImpl: typeof fetch = fetch): Promise<boolean> {\n const slug = decodeTokenSlug(token);\n if (!slug) return false;\n const res = await fetchImpl(`${apiUrl.replace(/\\/+$/, \"\")}/api/v1/preview/${encodeURIComponent(slug)}?token=${encodeURIComponent(token)}`);\n await res.body?.cancel().catch(() => {});\n return res.ok;\n}\n"],"mappings":";AASO,IAAM,eAAe;AAE5B,IAAM,MAAM,IAAI,YAAY;AAE5B,SAAS,UAAU,OAA4B;AAC7C,QAAM,IAAI,KAAK,OAAO,aAAa,GAAG,IAAI,WAAW,KAAK,CAAC,CAAC;AAC5D,SAAO,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,EAAE;AACpE;AAEA,eAAe,KAAK,OAAe,QAAiC;AAClE,QAAM,MAAM,MAAM,OAAO,OAAO,UAAU,OAAO,IAAI,OAAO,MAAM,GAAG,EAAE,MAAM,QAAQ,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;AACvH,SAAO,UAAU,MAAM,OAAO,OAAO,KAAK,QAAQ,KAAK,IAAI,OAAO,KAAK,CAAC,CAAC;AAC3E;AAGA,eAAsB,UAAU,OAAe,QAAiC;AAC9E,SAAO,GAAG,KAAK,IAAI,MAAM,KAAK,OAAO,MAAM,CAAC;AAC9C;AAGA,eAAsB,YAAY,QAAgB,QAAwC;AACxF,QAAM,MAAM,OAAO,YAAY,GAAG;AAClC,MAAI,MAAM,EAAG,QAAO;AACpB,QAAM,QAAQ,OAAO,MAAM,GAAG,GAAG;AACjC,QAAM,MAAM,OAAO,MAAM,MAAM,CAAC;AAChC,QAAM,WAAW,MAAM,KAAK,OAAO,MAAM;AACzC,MAAI,IAAI,WAAW,SAAS,OAAQ,QAAO;AAC3C,MAAI,OAAO;AACX,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,IAAK,SAAQ,IAAI,WAAW,CAAC,IAAI,SAAS,WAAW,CAAC;AACtF,SAAO,SAAS,IAAI,QAAQ;AAC9B;AAGO,SAAS,iBAAiB,IAAoB;AACnD,SAAO,GAAG,WAAW,GAAG,KAAK,CAAC,GAAG,WAAW,IAAI,KAAK,CAAC,GAAG,WAAW,KAAK,IAAI,KAAK;AACpF;AAGO,SAAS,gBAAgB,OAA8B;AAC5D,MAAI;AACF,UAAM,OAAO,MAAM,MAAM,GAAG,EAAE,CAAC;AAC/B,QAAI,CAAC,KAAM,QAAO;AAElB,UAAM,QAAQ,WAAW,KAAK,KAAK,KAAK,QAAQ,MAAM,GAAG,EAAE,QAAQ,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AACtG,UAAM,OAAO,KAAK,MAAM,IAAI,YAAY,EAAE,OAAO,KAAK,CAAC;AACvD,WAAO,KAAK,aAAa;AAAA,EAC3B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAMA,eAAsB,kBAAkB,QAAgB,OAAe,YAA0B,OAAyB;AACxH,QAAM,OAAO,gBAAgB,KAAK;AAClC,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,MAAM,MAAM,UAAU,GAAG,OAAO,QAAQ,QAAQ,EAAE,CAAC,mBAAmB,mBAAmB,IAAI,CAAC,UAAU,mBAAmB,KAAK,CAAC,EAAE;AACzI,QAAM,IAAI,MAAM,OAAO,EAAE,MAAM,MAAM;AAAA,EAAC,CAAC;AACvC,SAAO,IAAI;AACb;","names":[]}
|