@crowi/plugin-api 0.1.0-alpha.2 → 1.0.0-alpha.11

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.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,18 +17,166 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
21
31
  var index_exports = {};
22
32
  __export(index_exports, {
23
33
  ACTION_FIELD_MARKER: () => ACTION_FIELD_MARKER,
34
+ CONFIG_VERIFICATION_KEY_PREFIX: () => CONFIG_VERIFICATION_KEY_PREFIX,
24
35
  SENSITIVE_FIELD_MARKER: () => SENSITIVE_FIELD_MARKER,
36
+ createOAuth2Driver: () => createOAuth2Driver,
37
+ createOidcDriver: () => createOidcDriver,
38
+ escapeHtml: () => escapeHtml,
39
+ extractSvgDimensions: () => extractSvgDimensions,
25
40
  getActionAnnotation: () => getActionAnnotation,
26
- isSensitiveField: () => isSensitiveField
41
+ isSensitiveField: () => isSensitiveField,
42
+ sanitizeSvg: () => sanitizeSvg
27
43
  });
28
44
  module.exports = __toCommonJS(index_exports);
29
45
 
46
+ // src/config-verification.ts
47
+ var CONFIG_VERIFICATION_KEY_PREFIX = "__crowi_config_verification__/";
48
+
49
+ // src/html.ts
50
+ function escapeHtml(s) {
51
+ return s.replace(/[&<>"']/g, (c) => {
52
+ switch (c) {
53
+ case "&":
54
+ return "&amp;";
55
+ case "<":
56
+ return "&lt;";
57
+ case ">":
58
+ return "&gt;";
59
+ case '"':
60
+ return "&quot;";
61
+ case "'":
62
+ return "&#39;";
63
+ default:
64
+ return c;
65
+ }
66
+ });
67
+ }
68
+
69
+ // src/registries/auth.ts
70
+ var import_node_crypto = require("crypto");
71
+ function assertNonEmptyString(value, label, factory) {
72
+ if (value.trim() === "") {
73
+ throw new TypeError(`${factory}: '${label}' must be a non-empty string.`);
74
+ }
75
+ }
76
+ function assertValidUrl(value, label, factory) {
77
+ try {
78
+ new URL(value);
79
+ } catch {
80
+ throw new TypeError(`${factory}: '${label}' must be a valid URL, got '${value}'.`);
81
+ }
82
+ }
83
+ function assertNonEmptyScopes(scopes, factory) {
84
+ for (const scope of scopes) {
85
+ assertNonEmptyString(scope, "scopes[]", factory);
86
+ }
87
+ }
88
+ function createOAuth2Driver(options) {
89
+ const FACTORY = "createOAuth2Driver";
90
+ assertNonEmptyString(options.buttonLabel, "buttonLabel", FACTORY);
91
+ assertValidUrl(options.authorizeUrl, "authorizeUrl", FACTORY);
92
+ assertValidUrl(options.tokenUrl, "tokenUrl", FACTORY);
93
+ const scopes = options.scopes ?? [];
94
+ assertNonEmptyScopes(scopes, FACTORY);
95
+ return {
96
+ kind: "oauth2",
97
+ buttonLabel: options.buttonLabel,
98
+ iconUrl: options.iconUrl,
99
+ authorizeUrl: options.authorizeUrl,
100
+ tokenUrl: options.tokenUrl,
101
+ scopes,
102
+ pkce: options.pkce,
103
+ getClientConfig: options.getClientConfig,
104
+ fetchProfile: options.fetchProfile
105
+ };
106
+ }
107
+ var DEFAULT_OIDC_SCOPES = ["openid", "email", "profile"];
108
+ function createOidcDriver(options) {
109
+ const FACTORY = "createOidcDriver";
110
+ assertNonEmptyString(options.buttonLabel, "buttonLabel", FACTORY);
111
+ assertValidUrl(options.discoveryUrl, "discoveryUrl", FACTORY);
112
+ const scopes = options.scopes ?? [...DEFAULT_OIDC_SCOPES];
113
+ assertNonEmptyScopes(scopes, FACTORY);
114
+ return {
115
+ kind: "oidc",
116
+ buttonLabel: options.buttonLabel,
117
+ iconUrl: options.iconUrl,
118
+ discoveryUrl: options.discoveryUrl,
119
+ scopes,
120
+ pkce: true,
121
+ getClientConfig: options.getClientConfig,
122
+ getConfiguration: () => resolveOidcConfiguration(options.discoveryUrl, options.getClientConfig),
123
+ authorize: options.authorize,
124
+ mapClaims: options.mapClaims
125
+ };
126
+ }
127
+ var DISCOVERY_CACHE_TTL_MS = 5 * 60 * 1e3;
128
+ var DISCOVERY_CACHE_MAX_ENTRIES = 64;
129
+ var discoveryCache = /* @__PURE__ */ new Map();
130
+ var inFlightDiscoveries = /* @__PURE__ */ new Map();
131
+ function discoveryCacheKey(discoveryUrl, clientId, clientSecret) {
132
+ const secretFingerprint = (0, import_node_crypto.createHash)("sha256").update(clientSecret).digest("hex");
133
+ return (0, import_node_crypto.createHash)("sha256").update(`${discoveryUrl}\0${clientId}\0${secretFingerprint}`).digest("hex");
134
+ }
135
+ function evictOldestDiscoveryCacheEntry() {
136
+ let oldestKey;
137
+ let oldestExpiresAt = Number.POSITIVE_INFINITY;
138
+ for (const [key, entry] of discoveryCache) {
139
+ if (entry.expiresAt < oldestExpiresAt) {
140
+ oldestExpiresAt = entry.expiresAt;
141
+ oldestKey = key;
142
+ }
143
+ }
144
+ if (oldestKey !== void 0) {
145
+ discoveryCache.delete(oldestKey);
146
+ }
147
+ }
148
+ function cacheDiscoveryResult(key, configuration) {
149
+ if (!discoveryCache.has(key) && discoveryCache.size >= DISCOVERY_CACHE_MAX_ENTRIES) {
150
+ evictOldestDiscoveryCacheEntry();
151
+ }
152
+ discoveryCache.set(key, { configuration, expiresAt: Date.now() + DISCOVERY_CACHE_TTL_MS });
153
+ }
154
+ async function resolveOidcConfiguration(discoveryUrl, getClientConfig) {
155
+ const clientConfig = getClientConfig();
156
+ if (clientConfig == null) return null;
157
+ const { clientId, clientSecret } = clientConfig;
158
+ const key = discoveryCacheKey(discoveryUrl, clientId, clientSecret);
159
+ const cached = discoveryCache.get(key);
160
+ if (cached !== void 0) {
161
+ if (cached.expiresAt > Date.now()) return cached.configuration;
162
+ discoveryCache.delete(key);
163
+ }
164
+ const inFlight = inFlightDiscoveries.get(key);
165
+ if (inFlight !== void 0) return inFlight;
166
+ const discoveryPromise = (async () => {
167
+ const { discovery } = await import("openid-client");
168
+ const configuration = await discovery(new URL(discoveryUrl), clientId, clientSecret);
169
+ cacheDiscoveryResult(key, configuration);
170
+ return configuration;
171
+ })();
172
+ inFlightDiscoveries.set(key, discoveryPromise);
173
+ try {
174
+ return await discoveryPromise;
175
+ } finally {
176
+ inFlightDiscoveries.delete(key);
177
+ }
178
+ }
179
+
30
180
  // src/schema-markers.ts
31
181
  var SENSITIVE_FIELD_MARKER = "@sensitive";
32
182
  var ACTION_FIELD_MARKER = "@action";
@@ -40,16 +190,223 @@ function getActionAnnotation(field) {
40
190
  const trimmed = description.trimStart();
41
191
  if (!trimmed.startsWith(ACTION_FIELD_MARKER)) return null;
42
192
  const rest = trimmed.slice(ACTION_FIELD_MARKER.length).trimStart();
43
- const match = rest.match(/^"([^"]+)"\s+(GET|POST|PUT|DELETE)\s+(\/\S*)/);
193
+ const match = rest.match(/^"([^"]+)"\s+(GET|POST)\s+(\/\S*)/);
44
194
  if (!match) return null;
45
195
  const [, label, method, path] = match;
46
196
  return { label, method, path };
47
197
  }
198
+
199
+ // ../svg-sanitize/dist/index.mjs
200
+ var import_xmldom = require("@xmldom/xmldom");
201
+ var MAX_DIMENSION_PX = 1e6;
202
+ function extractSvgDimensions(svg) {
203
+ const match = /\bviewBox\s*=\s*["']\s*([-\d.]+)[\s,]+([-\d.]+)[\s,]+([-\d.]+)[\s,]+([-\d.]+)\s*["']/.exec(svg);
204
+ if (!match) return null;
205
+ const width = Math.round(Number(match[3]));
206
+ const height = Math.round(Number(match[4]));
207
+ if (!Number.isFinite(width) || !Number.isFinite(height)) return null;
208
+ if (width <= 0 || height <= 0 || width > MAX_DIMENSION_PX || height > MAX_DIMENSION_PX) return null;
209
+ return { width, height };
210
+ }
211
+ function sanitizeSvg(input, policy) {
212
+ const doc = parseXml(input);
213
+ if (!doc) return { ok: false, reason: "malformed_xml" };
214
+ if (doc.doctype) {
215
+ return { ok: false, reason: "doctype_not_allowed" };
216
+ }
217
+ const root = doc.documentElement;
218
+ if (!isUnprefixedSvgElement(root)) {
219
+ return { ok: false, reason: "root_is_not_svg" };
220
+ }
221
+ sanitizeElementTree(root, policy, true);
222
+ const serializer = new import_xmldom.XMLSerializer();
223
+ const serialized = serializer.serializeToString(root);
224
+ const verifyDoc = parseXml(serialized);
225
+ if (!verifyDoc || !isUnprefixedSvgElement(verifyDoc.documentElement)) {
226
+ return { ok: false, reason: "sanitized_output_not_single_root_svg" };
227
+ }
228
+ return { ok: true, svg: serialized };
229
+ }
230
+ var SVG_NAMESPACE_URI = "http://www.w3.org/2000/svg";
231
+ var XML_NAMESPACE_URI = "http://www.w3.org/XML/1998/namespace";
232
+ var XLINK_NAMESPACE_URI = "http://www.w3.org/1999/xlink";
233
+ function isSvgNamespaceElement(el) {
234
+ return el.namespaceURI === SVG_NAMESPACE_URI && el.prefix == null;
235
+ }
236
+ function isUnprefixedSvgElement(el) {
237
+ return el != null && el.localName === "svg" && isSvgNamespaceElement(el);
238
+ }
239
+ function parseXml(source) {
240
+ try {
241
+ return new import_xmldom.DOMParser({ onError: () => void 0 }).parseFromString(source, "image/svg+xml");
242
+ } catch {
243
+ return null;
244
+ }
245
+ }
246
+ var ALLOWED_ELEMENTS = /* @__PURE__ */ new Set([
247
+ "svg",
248
+ "g",
249
+ "defs",
250
+ "symbol",
251
+ "use",
252
+ "title",
253
+ "desc",
254
+ "metadata",
255
+ "path",
256
+ "rect",
257
+ "circle",
258
+ "ellipse",
259
+ "line",
260
+ "polyline",
261
+ "polygon",
262
+ "text",
263
+ "tspan",
264
+ "textPath",
265
+ "tref",
266
+ "marker",
267
+ "clipPath",
268
+ "mask",
269
+ "pattern",
270
+ "linearGradient",
271
+ "radialGradient",
272
+ "stop",
273
+ "image",
274
+ "style",
275
+ "a",
276
+ "switch",
277
+ "filter",
278
+ "feGaussianBlur",
279
+ "feOffset",
280
+ "feMerge",
281
+ "feMergeNode",
282
+ "feColorMatrix",
283
+ "feComposite",
284
+ "feFlood",
285
+ "feBlend",
286
+ "feDropShadow",
287
+ "feMorphology",
288
+ "feTurbulence",
289
+ "feDisplacementMap"
290
+ ]);
291
+ var PROCESSING_INSTRUCTION_NODE = 7;
292
+ var ELEMENT_NODE = 1;
293
+ function sanitizeElementTree(el, policy, isRoot) {
294
+ sanitizeAttributes(el, policy, isRoot);
295
+ if (el.localName === "style") {
296
+ el.textContent = sanitizeStyleText(el.textContent ?? "");
297
+ return;
298
+ }
299
+ for (const child of Array.from(el.childNodes)) {
300
+ if (child.nodeType === PROCESSING_INSTRUCTION_NODE) {
301
+ el.removeChild(child);
302
+ continue;
303
+ }
304
+ if (child.nodeType !== ELEMENT_NODE) continue;
305
+ const childEl = child;
306
+ if (!isSvgNamespaceElement(childEl) || !ALLOWED_ELEMENTS.has(childEl.localName ?? childEl.nodeName)) {
307
+ el.removeChild(childEl);
308
+ continue;
309
+ }
310
+ sanitizeElementTree(childEl, policy, false);
311
+ }
312
+ }
313
+ function sanitizeAttributes(el, policy, isRoot) {
314
+ for (const attr of Array.from(el.attributes)) {
315
+ const localName = attr.localName ?? attr.name;
316
+ if (/^on/i.test(localName)) {
317
+ el.removeAttributeNode(attr);
318
+ continue;
319
+ }
320
+ if (localName === "style") {
321
+ el.removeAttributeNode(attr);
322
+ continue;
323
+ }
324
+ if (localName === "base" && attr.namespaceURI === XML_NAMESPACE_URI) {
325
+ el.removeAttributeNode(attr);
326
+ continue;
327
+ }
328
+ if (localName === "href") {
329
+ const sanitizedValue = sanitizeHrefValue(attr.value, policy);
330
+ if (sanitizedValue === null) {
331
+ el.removeAttributeNode(attr);
332
+ } else {
333
+ attr.value = sanitizedValue;
334
+ }
335
+ continue;
336
+ }
337
+ if (URL_VALUED_PRESENTATION_ATTRS.has(localName)) {
338
+ if (!isUrlFuncIriSafe(attr.value)) {
339
+ el.removeAttributeNode(attr);
340
+ }
341
+ continue;
342
+ }
343
+ if (attr.name === "xmlns" || attr.name.startsWith("xmlns:")) {
344
+ if (!isRoot || !isEssentialRootNamespaceDeclaration(attr)) {
345
+ el.removeAttributeNode(attr);
346
+ }
347
+ }
348
+ }
349
+ }
350
+ function isEssentialRootNamespaceDeclaration(attr) {
351
+ if (attr.name === "xmlns") return true;
352
+ return attr.name === "xmlns:xlink" && attr.value === XLINK_NAMESPACE_URI;
353
+ }
354
+ var URL_VALUED_PRESENTATION_ATTRS = /* @__PURE__ */ new Set([
355
+ "fill",
356
+ "stroke",
357
+ "filter",
358
+ "clip-path",
359
+ "mask",
360
+ "cursor",
361
+ "marker",
362
+ "marker-start",
363
+ "marker-mid",
364
+ "marker-end"
365
+ ]);
366
+ var URL_FUNC_PATTERN = /url\(\s*(['"]?)([^'")]*)\1\s*\)/gi;
367
+ function isUrlFuncIriSafe(rawValue) {
368
+ const matches = Array.from(cssUnescape(rawValue).matchAll(URL_FUNC_PATTERN));
369
+ if (matches.length === 0) return true;
370
+ return matches.every(([, , target]) => target.trim().startsWith("#"));
371
+ }
372
+ function sanitizeHrefValue(rawValue, policy) {
373
+ const value = rawValue.trim();
374
+ if (value.startsWith("#")) return value;
375
+ if (/^javascript:/i.test(value)) return null;
376
+ if (/^data:/i.test(value)) return null;
377
+ if (value.startsWith("//")) return null;
378
+ if (policy.allowSafeHref && /^https:\/\//i.test(value)) return value;
379
+ return null;
380
+ }
381
+ function sanitizeStyleText(css) {
382
+ const withoutComments = css.replace(/\/\*[\s\S]*?\*\//g, " ");
383
+ let out = cssUnescape(withoutComments);
384
+ out = out.replace(/@import\b[^;]*;?/gi, "");
385
+ out = out.replace(URL_FUNC_PATTERN, (match, _quote, target) => target.trim().startsWith("#") ? match : "none");
386
+ return out;
387
+ }
388
+ function cssUnescape(css) {
389
+ return css.replace(/\\([0-9a-fA-F]{1,6})[ \t\n\f\r]?|\\([^\r\n\f])|\\$/g, (_match, hex, literal) => {
390
+ if (hex !== void 0) {
391
+ const codePoint = Number.parseInt(hex, 16);
392
+ if (codePoint === 0 || codePoint > 1114111 || codePoint >= 55296 && codePoint <= 57343) return "\uFFFD";
393
+ return String.fromCodePoint(codePoint);
394
+ }
395
+ if (literal !== void 0) return literal;
396
+ return "\uFFFD";
397
+ });
398
+ }
48
399
  // Annotate the CommonJS export names for ESM import in node:
49
400
  0 && (module.exports = {
50
401
  ACTION_FIELD_MARKER,
402
+ CONFIG_VERIFICATION_KEY_PREFIX,
51
403
  SENSITIVE_FIELD_MARKER,
404
+ createOAuth2Driver,
405
+ createOidcDriver,
406
+ escapeHtml,
407
+ extractSvgDimensions,
52
408
  getActionAnnotation,
53
- isSensitiveField
409
+ isSensitiveField,
410
+ sanitizeSvg
54
411
  });
55
412
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/schema-markers.ts"],"sourcesContent":["/**\n * @crowi/plugin-api — type-only contract for Crowi 2.0 plugins.\n *\n * Plugins author against this package. The runtime (@crowi/server) loads\n * plugins listed in `crowi.config.json`, calls each plugin's\n * `register*` callbacks, and routes all the side effects (storage,\n * search, auth, notifications) through the typed registries declared\n * here.\n *\n * For the design rationale see `docs/rfcs/0001-plugin-architecture.md`\n * in the Crowi monorepo.\n */\n\nexport type { CrowiPlugin } from './plugin';\n\nexport type { PluginContext, AppInfo, PageMetadataAccessor, PluginCrypto, PluginLogger } from './context';\n\nexport type { StorageDriver, StorageRegistry, StoragePutMeta, StoragePutResult } from './registries/storage';\n\nexport type {\n SearchDriver,\n SearchRegistry,\n SearchableDoc,\n SearchQuery,\n SearchQueryViewer,\n SearchQueryGrants,\n SearchPageType,\n SearchHits,\n SearchHit,\n} from './registries/search';\n\nexport type { AuthDriver, AuthRegistry, AuthProfile, AuthVerifyResult } from './registries/auth';\n\nexport type { NotifierDriver, NotifierRegistry, NotificationPayload } from './registries/notifier';\n\nexport type { MailSender, MailSenderRegistry, EmailMessage } from './registries/mail';\n\nexport type {\n RendererRegistry,\n NodeRenderer,\n CodeBlockRenderer,\n CodeBlockInfo,\n EmbedRenderer,\n EmbedInput,\n EmbedFragment,\n UrlInlineExpansionRule,\n InlineExpansion,\n RenderContext,\n RenderPhase,\n RenderResult,\n RenderError,\n Reservation,\n CacheStorage,\n ScopedCacheStorage,\n CacheKey,\n CacheEntry,\n AuthContext,\n} from './renderer';\n\nexport type { EventBus, PluginEvents } from './events';\n\nexport type { PluginRouterScope, PluginRouteHandler, PluginRouteMethod, PluginRouteOptions } from './routes';\n\nexport { SENSITIVE_FIELD_MARKER, ACTION_FIELD_MARKER, isSensitiveField, getActionAnnotation } from './schema-markers';\n","import type { z } from 'zod/v3';\n\n/**\n * `configSchema` description-string markers.\n *\n * The admin UI walks the schema and looks at each field's\n * `description` (set via `z.string().describe('@sensitive ...')`). A\n * description starting with one of these marker tokens unlocks special\n * UI behaviour without forcing every field to declare a custom Zod\n * type.\n */\n\n/**\n * Marker that flags a config field as sensitive (encrypted at rest).\n * Usage:\n *\n * z.string().describe('@sensitive AWS secret access key')\n *\n * The runtime auto-encrypts on write and decrypts on read, using the\n * same KeyProvider as core sensitive Config. The admin UI renders the\n * field via `<SecretField>` (saved badge / clear pending / undo).\n */\nexport const SENSITIVE_FIELD_MARKER = '@sensitive';\n\n/**\n * Marker that adds an action button next to a config field. Usage:\n *\n * z.string().describe('@action \"Test connection\" POST /test')\n *\n * The admin form renders a button with the given label that calls the\n * plugin's contributed endpoint at the given verb / path (relative to\n * `/api/v2/plugins/<name>/`). Useful for \"Test connection\",\n * \"Authorise with Google\", etc. without forcing every plugin to ship\n * its own React component.\n */\nexport const ACTION_FIELD_MARKER = '@action';\n\n/**\n * True if the schema field is marked `@sensitive`.\n *\n * `field` is `z.ZodTypeAny` (intentionally loose); call sites pass the\n * value type from `configSchema.shape[key]`.\n */\nexport function isSensitiveField(field: z.ZodTypeAny): boolean {\n const description = field.description;\n return typeof description === 'string' && description.trimStart().startsWith(SENSITIVE_FIELD_MARKER);\n}\n\n/**\n * Parsed `@action` annotation extracted from a field's `description`.\n */\nexport interface ActionAnnotation {\n /** Visible button label, e.g. \"Test connection\". */\n label: string;\n /** HTTP verb of the plugin endpoint to call. */\n method: 'GET' | 'POST' | 'PUT' | 'DELETE';\n /** Path relative to `/api/v2/plugins/<name>/`, with leading slash. */\n path: string;\n}\n\n/**\n * Parse an `@action` annotation off a field, or return null if absent.\n *\n * Format: `@action \"<label>\" <METHOD> <path>`\n * e.g. `@action \"Test connection\" POST /test`\n *\n * The label may include spaces when wrapped in double quotes; the\n * method is one of `GET` / `POST` / `PUT` / `DELETE`; the path begins\n * with `/`.\n */\nexport function getActionAnnotation(field: z.ZodTypeAny): ActionAnnotation | null {\n const description = field.description;\n if (typeof description !== 'string') return null;\n const trimmed = description.trimStart();\n if (!trimmed.startsWith(ACTION_FIELD_MARKER)) return null;\n\n const rest = trimmed.slice(ACTION_FIELD_MARKER.length).trimStart();\n // `\"<label>\" <METHOD> <path>`\n const match = rest.match(/^\"([^\"]+)\"\\s+(GET|POST|PUT|DELETE)\\s+(\\/\\S*)/);\n if (!match) return null;\n\n const [, label, method, path] = match;\n return { label, method: method as ActionAnnotation['method'], path };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACsBO,IAAM,yBAAyB;AAa/B,IAAM,sBAAsB;AAQ5B,SAAS,iBAAiB,OAA8B;AAC7D,QAAM,cAAc,MAAM;AAC1B,SAAO,OAAO,gBAAgB,YAAY,YAAY,UAAU,EAAE,WAAW,sBAAsB;AACrG;AAwBO,SAAS,oBAAoB,OAA8C;AAChF,QAAM,cAAc,MAAM;AAC1B,MAAI,OAAO,gBAAgB,SAAU,QAAO;AAC5C,QAAM,UAAU,YAAY,UAAU;AACtC,MAAI,CAAC,QAAQ,WAAW,mBAAmB,EAAG,QAAO;AAErD,QAAM,OAAO,QAAQ,MAAM,oBAAoB,MAAM,EAAE,UAAU;AAEjE,QAAM,QAAQ,KAAK,MAAM,8CAA8C;AACvE,MAAI,CAAC,MAAO,QAAO;AAEnB,QAAM,CAAC,EAAE,OAAO,QAAQ,IAAI,IAAI;AAChC,SAAO,EAAE,OAAO,QAA8C,KAAK;AACrE;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/config-verification.ts","../src/html.ts","../src/registries/auth.ts","../src/schema-markers.ts","../../svg-sanitize/src/dimensions.ts","../../svg-sanitize/src/sanitize.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiGO,IAAM,iCAAiC;;;ACpFvC,SAAS,WAAW,GAAmB;AAC5C,SAAO,EAAE,QAAQ,YAAY,CAAC,MAAM;AAClC,YAAQ,GAAG;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF,CAAC;AACH;;;AC9BA,yBAA2B;AA2K3B,SAAS,qBAAqB,OAAe,OAAe,SAAuB;AACjF,MAAI,MAAM,KAAK,MAAM,IAAI;AACvB,UAAM,IAAI,UAAU,GAAG,OAAO,MAAM,KAAK,+BAA+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