thunderous 0.6.4 → 1.0.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.cjs CHANGED
@@ -20,32 +20,454 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ clientOnlyCallback: () => clientOnlyCallback,
23
24
  createEffect: () => createEffect,
24
25
  createRegistry: () => createRegistry,
25
26
  createSignal: () => createSignal,
26
27
  css: () => css,
27
28
  customElement: () => customElement,
28
29
  derived: () => derived,
29
- html: () => html2
30
+ html: () => html,
31
+ insertTemplates: () => insertTemplates,
32
+ onServerDefine: () => onServerDefine
30
33
  });
31
34
  module.exports = __toCommonJS(src_exports);
32
35
 
33
- // src/html-helpers.ts
34
- var clearHTML = (element) => {
35
- while (element.childNodes.length > 0) {
36
- element.childNodes[0].remove();
36
+ // vendor/@webcomponents/scoped-custom-element-registry/src/scoped-custom-element-registry.js
37
+ if (typeof window !== "undefined") {
38
+ if (!ShadowRoot.prototype.createElement) {
39
+ const NativeHTMLElement = window.HTMLElement;
40
+ const nativeDefine = window.customElements.define;
41
+ const nativeGet = window.customElements.get;
42
+ const nativeRegistry = window.customElements;
43
+ const definitionForElement = /* @__PURE__ */ new WeakMap();
44
+ const pendingRegistryForElement = /* @__PURE__ */ new WeakMap();
45
+ const globalDefinitionForConstructor = /* @__PURE__ */ new WeakMap();
46
+ const scopeForElement = /* @__PURE__ */ new WeakMap();
47
+ window.CustomElementRegistry = class {
48
+ constructor() {
49
+ this._definitionsByTag = /* @__PURE__ */ new Map();
50
+ this._definitionsByClass = /* @__PURE__ */ new Map();
51
+ this._whenDefinedPromises = /* @__PURE__ */ new Map();
52
+ this._awaitingUpgrade = /* @__PURE__ */ new Map();
53
+ }
54
+ define(tagName, elementClass) {
55
+ tagName = tagName.toLowerCase();
56
+ if (this._getDefinition(tagName) !== void 0) {
57
+ throw new DOMException(
58
+ `Failed to execute 'define' on 'CustomElementRegistry': the name "${tagName}" has already been used with this registry`
59
+ );
60
+ }
61
+ if (this._definitionsByClass.get(elementClass) !== void 0) {
62
+ throw new DOMException(
63
+ `Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry`
64
+ );
65
+ }
66
+ const attributeChangedCallback = elementClass.prototype.attributeChangedCallback;
67
+ const observedAttributes = new Set(elementClass.observedAttributes || []);
68
+ patchAttributes(
69
+ elementClass,
70
+ observedAttributes,
71
+ attributeChangedCallback
72
+ );
73
+ const definition = {
74
+ elementClass,
75
+ connectedCallback: elementClass.prototype.connectedCallback,
76
+ disconnectedCallback: elementClass.prototype.disconnectedCallback,
77
+ adoptedCallback: elementClass.prototype.adoptedCallback,
78
+ attributeChangedCallback,
79
+ "formAssociated": elementClass["formAssociated"],
80
+ "formAssociatedCallback": elementClass.prototype["formAssociatedCallback"],
81
+ "formDisabledCallback": elementClass.prototype["formDisabledCallback"],
82
+ "formResetCallback": elementClass.prototype["formResetCallback"],
83
+ "formStateRestoreCallback": elementClass.prototype["formStateRestoreCallback"],
84
+ observedAttributes
85
+ };
86
+ this._definitionsByTag.set(tagName, definition);
87
+ this._definitionsByClass.set(elementClass, definition);
88
+ let standInClass = nativeGet.call(nativeRegistry, tagName);
89
+ if (!standInClass) {
90
+ standInClass = createStandInElement(tagName);
91
+ nativeDefine.call(nativeRegistry, tagName, standInClass);
92
+ }
93
+ if (this === window.customElements) {
94
+ globalDefinitionForConstructor.set(elementClass, definition);
95
+ definition.standInClass = standInClass;
96
+ }
97
+ const awaiting = this._awaitingUpgrade.get(tagName);
98
+ if (awaiting) {
99
+ this._awaitingUpgrade.delete(tagName);
100
+ for (const element of awaiting) {
101
+ pendingRegistryForElement.delete(element);
102
+ customize(element, definition, true);
103
+ }
104
+ }
105
+ const info = this._whenDefinedPromises.get(tagName);
106
+ if (info !== void 0) {
107
+ info.resolve(elementClass);
108
+ this._whenDefinedPromises.delete(tagName);
109
+ }
110
+ return elementClass;
111
+ }
112
+ upgrade() {
113
+ creationContext.push(this);
114
+ nativeRegistry.upgrade.apply(nativeRegistry, arguments);
115
+ creationContext.pop();
116
+ }
117
+ get(tagName) {
118
+ const definition = this._definitionsByTag.get(tagName);
119
+ return definition?.elementClass;
120
+ }
121
+ _getDefinition(tagName) {
122
+ return this._definitionsByTag.get(tagName);
123
+ }
124
+ whenDefined(tagName) {
125
+ const definition = this._getDefinition(tagName);
126
+ if (definition !== void 0) {
127
+ return Promise.resolve(definition.elementClass);
128
+ }
129
+ let info = this._whenDefinedPromises.get(tagName);
130
+ if (info === void 0) {
131
+ info = {};
132
+ info.promise = new Promise((r) => info.resolve = r);
133
+ this._whenDefinedPromises.set(tagName, info);
134
+ }
135
+ return info.promise;
136
+ }
137
+ _upgradeWhenDefined(element, tagName, shouldUpgrade) {
138
+ let awaiting = this._awaitingUpgrade.get(tagName);
139
+ if (!awaiting) {
140
+ this._awaitingUpgrade.set(tagName, awaiting = /* @__PURE__ */ new Set());
141
+ }
142
+ if (shouldUpgrade) {
143
+ awaiting.add(element);
144
+ } else {
145
+ awaiting.delete(element);
146
+ }
147
+ }
148
+ };
149
+ let upgradingInstance;
150
+ window.HTMLElement = function HTMLElement2() {
151
+ let instance = upgradingInstance;
152
+ if (instance) {
153
+ upgradingInstance = void 0;
154
+ return instance;
155
+ }
156
+ const definition = globalDefinitionForConstructor.get(this.constructor);
157
+ if (!definition) {
158
+ throw new TypeError(
159
+ "Illegal constructor (custom element class must be registered with global customElements registry to be newable)"
160
+ );
161
+ }
162
+ instance = Reflect.construct(
163
+ NativeHTMLElement,
164
+ [],
165
+ definition.standInClass
166
+ );
167
+ Object.setPrototypeOf(instance, this.constructor.prototype);
168
+ definitionForElement.set(instance, definition);
169
+ return instance;
170
+ };
171
+ window.HTMLElement.prototype = NativeHTMLElement.prototype;
172
+ const isValidScope = (node) => node === document || node instanceof ShadowRoot;
173
+ const registryForNode = (node) => {
174
+ let scope = node.getRootNode();
175
+ if (!isValidScope(scope)) {
176
+ const context = creationContext[creationContext.length - 1];
177
+ if (context instanceof CustomElementRegistry) {
178
+ return context;
179
+ }
180
+ scope = context.getRootNode();
181
+ if (!isValidScope(scope)) {
182
+ scope = scopeForElement.get(scope)?.getRootNode() || document;
183
+ }
184
+ }
185
+ return scope.customElements;
186
+ };
187
+ const createStandInElement = (tagName) => {
188
+ return class ScopedCustomElementBase {
189
+ static get ["formAssociated"]() {
190
+ return true;
191
+ }
192
+ constructor() {
193
+ const instance = Reflect.construct(
194
+ NativeHTMLElement,
195
+ [],
196
+ this.constructor
197
+ );
198
+ Object.setPrototypeOf(instance, HTMLElement.prototype);
199
+ const registry = registryForNode(instance) || window.customElements;
200
+ const definition = registry._getDefinition(tagName);
201
+ if (definition) {
202
+ customize(instance, definition);
203
+ } else {
204
+ pendingRegistryForElement.set(instance, registry);
205
+ }
206
+ return instance;
207
+ }
208
+ connectedCallback() {
209
+ const definition = definitionForElement.get(this);
210
+ if (definition) {
211
+ definition.connectedCallback && definition.connectedCallback.apply(this, arguments);
212
+ } else {
213
+ pendingRegistryForElement.get(this)._upgradeWhenDefined(this, tagName, true);
214
+ }
215
+ }
216
+ disconnectedCallback() {
217
+ const definition = definitionForElement.get(this);
218
+ if (definition) {
219
+ definition.disconnectedCallback && definition.disconnectedCallback.apply(this, arguments);
220
+ } else {
221
+ pendingRegistryForElement.get(this)._upgradeWhenDefined(this, tagName, false);
222
+ }
223
+ }
224
+ adoptedCallback() {
225
+ const definition = definitionForElement.get(this);
226
+ definition?.adoptedCallback?.apply(this, arguments);
227
+ }
228
+ // Form-associated custom elements lifecycle methods
229
+ ["formAssociatedCallback"]() {
230
+ const definition = definitionForElement.get(this);
231
+ if (definition && definition["formAssociated"]) {
232
+ definition?.["formAssociatedCallback"]?.apply(this, arguments);
233
+ }
234
+ }
235
+ ["formDisabledCallback"]() {
236
+ const definition = definitionForElement.get(this);
237
+ if (definition?.["formAssociated"]) {
238
+ definition?.["formDisabledCallback"]?.apply(this, arguments);
239
+ }
240
+ }
241
+ ["formResetCallback"]() {
242
+ const definition = definitionForElement.get(this);
243
+ if (definition?.["formAssociated"]) {
244
+ definition?.["formResetCallback"]?.apply(this, arguments);
245
+ }
246
+ }
247
+ ["formStateRestoreCallback"]() {
248
+ const definition = definitionForElement.get(this);
249
+ if (definition?.["formAssociated"]) {
250
+ definition?.["formStateRestoreCallback"]?.apply(this, arguments);
251
+ }
252
+ }
253
+ // no attributeChangedCallback or observedAttributes since these
254
+ // are simulated via setAttribute/removeAttribute patches
255
+ };
256
+ };
257
+ const patchAttributes = (elementClass, observedAttributes, attributeChangedCallback) => {
258
+ if (observedAttributes.size === 0 || attributeChangedCallback === void 0) {
259
+ return;
260
+ }
261
+ const setAttribute = elementClass.prototype.setAttribute;
262
+ if (setAttribute) {
263
+ elementClass.prototype.setAttribute = function(n, value) {
264
+ const name = n.toLowerCase();
265
+ if (observedAttributes.has(name)) {
266
+ const old = this.getAttribute(name);
267
+ setAttribute.call(this, name, value);
268
+ attributeChangedCallback.call(this, name, old, value);
269
+ } else {
270
+ setAttribute.call(this, name, value);
271
+ }
272
+ };
273
+ }
274
+ const removeAttribute = elementClass.prototype.removeAttribute;
275
+ if (removeAttribute) {
276
+ elementClass.prototype.removeAttribute = function(n) {
277
+ const name = n.toLowerCase();
278
+ if (observedAttributes.has(name)) {
279
+ const old = this.getAttribute(name);
280
+ removeAttribute.call(this, name);
281
+ attributeChangedCallback.call(this, name, old, null);
282
+ } else {
283
+ removeAttribute.call(this, name);
284
+ }
285
+ };
286
+ }
287
+ const toggleAttribute = elementClass.prototype.toggleAttribute;
288
+ if (toggleAttribute) {
289
+ elementClass.prototype.toggleAttribute = function(n, force) {
290
+ const name = n.toLowerCase();
291
+ if (observedAttributes.has(name)) {
292
+ const old = this.getAttribute(name);
293
+ toggleAttribute.call(this, name, force);
294
+ const newValue = this.getAttribute(name);
295
+ attributeChangedCallback.call(this, name, old, newValue);
296
+ } else {
297
+ toggleAttribute.call(this, name, force);
298
+ }
299
+ };
300
+ }
301
+ };
302
+ const patchHTMLElement = (elementClass) => {
303
+ const parentClass = Object.getPrototypeOf(elementClass);
304
+ if (parentClass !== window.HTMLElement) {
305
+ if (parentClass === NativeHTMLElement) {
306
+ return Object.setPrototypeOf(elementClass, window.HTMLElement);
307
+ }
308
+ return patchHTMLElement(parentClass);
309
+ }
310
+ };
311
+ const customize = (instance, definition, isUpgrade = false) => {
312
+ Object.setPrototypeOf(instance, definition.elementClass.prototype);
313
+ definitionForElement.set(instance, definition);
314
+ upgradingInstance = instance;
315
+ try {
316
+ new definition.elementClass();
317
+ } catch (_) {
318
+ patchHTMLElement(definition.elementClass);
319
+ new definition.elementClass();
320
+ }
321
+ if (definition.attributeChangedCallback) {
322
+ definition.observedAttributes.forEach((attr) => {
323
+ if (instance.hasAttribute(attr)) {
324
+ definition.attributeChangedCallback.call(
325
+ instance,
326
+ attr,
327
+ null,
328
+ instance.getAttribute(attr)
329
+ );
330
+ }
331
+ });
332
+ }
333
+ if (isUpgrade && definition.connectedCallback && instance.isConnected) {
334
+ definition.connectedCallback.call(instance);
335
+ }
336
+ };
337
+ const nativeAttachShadow = Element.prototype.attachShadow;
338
+ Element.prototype.attachShadow = function(init) {
339
+ const shadowRoot = nativeAttachShadow.apply(this, arguments);
340
+ if (init.customElements) {
341
+ shadowRoot.customElements = init.customElements;
342
+ }
343
+ return shadowRoot;
344
+ };
345
+ let creationContext = [document];
346
+ const installScopedCreationMethod = (ctor, method, from = void 0) => {
347
+ const native = (from ? Object.getPrototypeOf(from) : ctor.prototype)[method];
348
+ ctor.prototype[method] = function() {
349
+ creationContext.push(this);
350
+ const ret = native.apply(from || this, arguments);
351
+ if (ret !== void 0) {
352
+ scopeForElement.set(ret, this);
353
+ }
354
+ creationContext.pop();
355
+ return ret;
356
+ };
357
+ };
358
+ installScopedCreationMethod(ShadowRoot, "createElement", document);
359
+ installScopedCreationMethod(ShadowRoot, "importNode", document);
360
+ installScopedCreationMethod(Element, "insertAdjacentHTML");
361
+ installScopedCreationMethod(Node, "appendChild");
362
+ installScopedCreationMethod(Element, "append");
363
+ const installScopedCreationSetter = (ctor, name) => {
364
+ const descriptor = Object.getOwnPropertyDescriptor(ctor.prototype, name);
365
+ Object.defineProperty(ctor.prototype, name, {
366
+ ...descriptor,
367
+ set(value) {
368
+ creationContext.push(this);
369
+ descriptor.set.call(this, value);
370
+ creationContext.pop();
371
+ }
372
+ });
373
+ };
374
+ installScopedCreationSetter(Element, "innerHTML");
375
+ installScopedCreationSetter(ShadowRoot, "innerHTML");
376
+ Object.defineProperty(window, "customElements", {
377
+ value: new CustomElementRegistry(),
378
+ configurable: true,
379
+ writable: true
380
+ });
381
+ if (!!window["ElementInternals"] && !!window["ElementInternals"].prototype["setFormValue"]) {
382
+ const internalsToHostMap = /* @__PURE__ */ new WeakMap();
383
+ const attachInternals = HTMLElement.prototype["attachInternals"];
384
+ const methods = [
385
+ "setFormValue",
386
+ "setValidity",
387
+ "checkValidity",
388
+ "reportValidity"
389
+ ];
390
+ HTMLElement.prototype["attachInternals"] = function(...args) {
391
+ const internals = attachInternals.call(this, ...args);
392
+ internalsToHostMap.set(internals, this);
393
+ return internals;
394
+ };
395
+ methods.forEach((method) => {
396
+ const proto = window["ElementInternals"].prototype;
397
+ const originalMethod = proto[method];
398
+ proto[method] = function(...args) {
399
+ const host = internalsToHostMap.get(this);
400
+ const definition = definitionForElement.get(host);
401
+ if (definition["formAssociated"] === true) {
402
+ return originalMethod?.call(this, ...args);
403
+ } else {
404
+ throw new DOMException(
405
+ `Failed to execute ${originalMethod} on 'ElementInternals': The target element is not a form-associated custom element.`
406
+ );
407
+ }
408
+ };
409
+ });
410
+ class RadioNodeList extends Array {
411
+ constructor(elements) {
412
+ super(...elements);
413
+ this._elements = elements;
414
+ }
415
+ get ["value"]() {
416
+ return this._elements.find((element) => element["checked"] === true)?.value || "";
417
+ }
418
+ }
419
+ class HTMLFormControlsCollection {
420
+ constructor(elements) {
421
+ const entries = /* @__PURE__ */ new Map();
422
+ elements.forEach((element, index) => {
423
+ const name = element.getAttribute("name");
424
+ const nameReference = entries.get(name) || [];
425
+ this[+index] = element;
426
+ nameReference.push(element);
427
+ entries.set(name, nameReference);
428
+ });
429
+ this["length"] = elements.length;
430
+ entries.forEach((value, key) => {
431
+ if (!value) return;
432
+ if (value.length === 1) {
433
+ this[key] = value[0];
434
+ } else {
435
+ this[key] = new RadioNodeList(value);
436
+ }
437
+ });
438
+ }
439
+ ["namedItem"](key) {
440
+ return this[key];
441
+ }
442
+ }
443
+ const formElementsDescriptor = Object.getOwnPropertyDescriptor(
444
+ HTMLFormElement.prototype,
445
+ "elements"
446
+ );
447
+ Object.defineProperty(HTMLFormElement.prototype, "elements", {
448
+ get: function() {
449
+ const nativeElements = formElementsDescriptor.get.call(this, []);
450
+ const include = [];
451
+ for (const element of nativeElements) {
452
+ const definition = definitionForElement.get(element);
453
+ if (!definition || definition["formAssociated"] === true) {
454
+ include.push(element);
455
+ }
456
+ }
457
+ return new HTMLFormControlsCollection(include);
458
+ }
459
+ });
460
+ }
37
461
  }
38
- };
39
- var parseFragment = (htmlStr) => {
40
- const range = document.createRange();
41
- range.selectNode(document.body);
42
- return range.createContextualFragment(htmlStr);
43
- };
44
- var setInnerHTML = (element, html3) => {
45
- clearHTML(element);
46
- const fragment = typeof html3 === "string" ? parseFragment(html3) : html3;
47
- element.append(fragment);
48
- };
462
+ class TrackableCustomElementRegistry extends window.CustomElementRegistry {
463
+ __tagNames = /* @__PURE__ */ new Set();
464
+ define(tagName, constructor, options) {
465
+ super.define(tagName, constructor, options);
466
+ this.__tagNames.add(tagName);
467
+ }
468
+ }
469
+ window.CustomElementRegistry = TrackableCustomElementRegistry;
470
+ }
49
471
 
50
472
  // src/signals.ts
51
473
  var subscriber = null;
@@ -59,7 +481,7 @@ var createSignal = (initVal, options) => {
59
481
  subscribers.add(subscriber);
60
482
  }
61
483
  if (options?.debugMode || getterOptions?.debugMode) {
62
- requestAnimationFrame(() => {
484
+ queueMicrotask(() => {
63
485
  let label = "anonymous signal";
64
486
  if (options?.label !== void 0) {
65
487
  label = `(${options.label})`;
@@ -84,7 +506,7 @@ var createSignal = (initVal, options) => {
84
506
  }
85
507
  if (!isBatchingUpdates) {
86
508
  isBatchingUpdates = true;
87
- requestAnimationFrame(() => {
509
+ queueMicrotask(() => {
88
510
  for (const fn of updateQueue) {
89
511
  try {
90
512
  fn();
@@ -132,973 +554,154 @@ var createEffect = (fn) => {
132
554
  subscriber = null;
133
555
  };
134
556
 
135
- // node_modules/dompurify/dist/purify.es.mjs
136
- var {
137
- entries,
138
- setPrototypeOf,
139
- isFrozen,
140
- getPrototypeOf,
141
- getOwnPropertyDescriptor
142
- } = Object;
143
- var {
144
- freeze,
145
- seal,
146
- create
147
- } = Object;
148
- var {
149
- apply,
150
- construct
151
- } = typeof Reflect !== "undefined" && Reflect;
152
- if (!freeze) {
153
- freeze = function freeze2(x) {
154
- return x;
155
- };
156
- }
157
- if (!seal) {
158
- seal = function seal2(x) {
159
- return x;
160
- };
161
- }
162
- if (!apply) {
163
- apply = function apply2(fun, thisValue, args) {
164
- return fun.apply(thisValue, args);
165
- };
166
- }
167
- if (!construct) {
168
- construct = function construct2(Func, args) {
169
- return new Func(...args);
170
- };
171
- }
172
- var arrayForEach = unapply(Array.prototype.forEach);
173
- var arrayPop = unapply(Array.prototype.pop);
174
- var arrayPush = unapply(Array.prototype.push);
175
- var stringToLowerCase = unapply(String.prototype.toLowerCase);
176
- var stringToString = unapply(String.prototype.toString);
177
- var stringMatch = unapply(String.prototype.match);
178
- var stringReplace = unapply(String.prototype.replace);
179
- var stringIndexOf = unapply(String.prototype.indexOf);
180
- var stringTrim = unapply(String.prototype.trim);
181
- var objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
182
- var regExpTest = unapply(RegExp.prototype.test);
183
- var typeErrorCreate = unconstruct(TypeError);
184
- function unapply(func) {
185
- return function(thisArg) {
186
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
187
- args[_key - 1] = arguments[_key];
188
- }
189
- return apply(func, thisArg, args);
190
- };
191
- }
192
- function unconstruct(func) {
193
- return function() {
194
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
195
- args[_key2] = arguments[_key2];
196
- }
197
- return construct(func, args);
198
- };
199
- }
200
- function addToSet(set, array) {
201
- let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
202
- if (setPrototypeOf) {
203
- setPrototypeOf(set, null);
204
- }
205
- let l = array.length;
206
- while (l--) {
207
- let element = array[l];
208
- if (typeof element === "string") {
209
- const lcElement = transformCaseFunc(element);
210
- if (lcElement !== element) {
211
- if (!isFrozen(array)) {
212
- array[l] = lcElement;
213
- }
214
- element = lcElement;
215
- }
216
- }
217
- set[element] = true;
218
- }
219
- return set;
220
- }
221
- function cleanArray(array) {
222
- for (let index = 0; index < array.length; index++) {
223
- const isPropertyExist = objectHasOwnProperty(array, index);
224
- if (!isPropertyExist) {
225
- array[index] = null;
226
- }
227
- }
228
- return array;
229
- }
230
- function clone(object) {
231
- const newObject = create(null);
232
- for (const [property, value] of entries(object)) {
233
- const isPropertyExist = objectHasOwnProperty(object, property);
234
- if (isPropertyExist) {
235
- if (Array.isArray(value)) {
236
- newObject[property] = cleanArray(value);
237
- } else if (value && typeof value === "object" && value.constructor === Object) {
238
- newObject[property] = clone(value);
239
- } else {
240
- newObject[property] = value;
241
- }
242
- }
557
+ // src/server-side.ts
558
+ var isServer = typeof window === "undefined";
559
+ var serverDefineFns = /* @__PURE__ */ new Set();
560
+ var onServerDefine = (fn) => {
561
+ serverDefineFns.add(fn);
562
+ };
563
+ var serverDefine = ({ tagName, serverRender, options, scopedRegistry, parentRegistry }) => {
564
+ if (parentRegistry !== void 0) {
565
+ parentRegistry.__serverRenderOpts.set(tagName, { serverRender, ...options });
566
+ if (parentRegistry.scoped) return;
243
567
  }
244
- return newObject;
245
- }
246
- function lookupGetter(object, prop) {
247
- while (object !== null) {
248
- const desc = getOwnPropertyDescriptor(object, prop);
249
- if (desc) {
250
- if (desc.get) {
251
- return unapply(desc.get);
252
- }
253
- if (typeof desc.value === "function") {
254
- return unapply(desc.value);
568
+ for (const fn of serverDefineFns) {
569
+ let result = serverRender(getServerRenderArgs(tagName));
570
+ result = wrapTemplate({
571
+ tagName,
572
+ serverRender,
573
+ options
574
+ });
575
+ if (scopedRegistry !== void 0) {
576
+ for (const [scopedTagName, scopedRenderOptions] of scopedRegistry.__serverRenderOpts) {
577
+ const { serverRender: serverRender2, ...scopedOptions } = scopedRenderOptions;
578
+ let template = serverRender2(getServerRenderArgs(scopedTagName, scopedRegistry));
579
+ template = wrapTemplate({
580
+ tagName: scopedTagName,
581
+ serverRender: serverRender2,
582
+ options: scopedOptions
583
+ });
584
+ result = insertTemplates(scopedTagName, template, result);
255
585
  }
256
586
  }
257
- object = getPrototypeOf(object);
258
- }
259
- function fallbackValue() {
260
- return null;
587
+ fn(tagName, result);
261
588
  }
262
- return fallbackValue;
263
- }
264
- var html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
265
- var svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
266
- var svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]);
267
- var svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]);
268
- var mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]);
269
- var mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
270
- var text = freeze(["#text"]);
271
- var html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]);
272
- var svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
273
- var mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
274
- var xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
275
- var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
276
- var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
277
- var TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
278
- var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/);
279
- var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
280
- var IS_ALLOWED_URI = seal(
281
- /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
282
- // eslint-disable-line no-useless-escape
283
- );
284
- var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
285
- var ATTR_WHITESPACE = seal(
286
- /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
287
- // eslint-disable-line no-control-regex
288
- );
289
- var DOCTYPE_NAME = seal(/^html$/i);
290
- var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
291
- var EXPRESSIONS = /* @__PURE__ */ Object.freeze({
292
- __proto__: null,
293
- ARIA_ATTR,
294
- ATTR_WHITESPACE,
295
- CUSTOM_ELEMENT,
296
- DATA_ATTR,
297
- DOCTYPE_NAME,
298
- ERB_EXPR,
299
- IS_ALLOWED_URI,
300
- IS_SCRIPT_OR_DATA,
301
- MUSTACHE_EXPR,
302
- TMPLIT_EXPR
303
- });
304
- var NODE_TYPE = {
305
- element: 1,
306
- attribute: 2,
307
- text: 3,
308
- cdataSection: 4,
309
- entityReference: 5,
310
- // Deprecated
311
- entityNode: 6,
312
- // Deprecated
313
- progressingInstruction: 7,
314
- comment: 8,
315
- document: 9,
316
- documentType: 10,
317
- documentFragment: 11,
318
- notation: 12
319
- // Deprecated
320
589
  };
321
- var getGlobal = function getGlobal2() {
322
- return typeof window === "undefined" ? null : window;
323
- };
324
- var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
325
- if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
326
- return null;
327
- }
328
- let suffix = null;
329
- const ATTR_NAME = "data-tt-policy-suffix";
330
- if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
331
- suffix = purifyHostElement.getAttribute(ATTR_NAME);
332
- }
333
- const policyName = "dompurify" + (suffix ? "#" + suffix : "");
334
- try {
335
- return trustedTypes.createPolicy(policyName, {
336
- createHTML(html3) {
337
- return html3;
338
- },
339
- createScriptURL(scriptUrl) {
340
- return scriptUrl;
590
+ var serverCss = /* @__PURE__ */ new Map();
591
+ var getServerRenderArgs = (tagName, registry) => ({
592
+ get elementRef() {
593
+ return new Proxy({}, {
594
+ get: () => {
595
+ throw new Error("The `elementRef` property is not available on the server.");
341
596
  }
342
597
  });
343
- } catch (_) {
344
- console.warn("TrustedTypes policy " + policyName + " could not be created.");
345
- return null;
346
- }
347
- };
348
- function createDOMPurify() {
349
- let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
350
- const DOMPurify = (root) => createDOMPurify(root);
351
- DOMPurify.version = "3.2.1";
352
- DOMPurify.removed = [];
353
- if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document) {
354
- DOMPurify.isSupported = false;
355
- return DOMPurify;
356
- }
357
- let {
358
- document: document2
359
- } = window2;
360
- const originalDocument = document2;
361
- const currentScript = originalDocument.currentScript;
362
- const {
363
- DocumentFragment: DocumentFragment2,
364
- HTMLTemplateElement,
365
- Node,
366
- Element: Element2,
367
- NodeFilter,
368
- NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap,
369
- HTMLFormElement,
370
- DOMParser,
371
- trustedTypes
372
- } = window2;
373
- const ElementPrototype = Element2.prototype;
374
- const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
375
- const remove = lookupGetter(ElementPrototype, "remove");
376
- const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
377
- const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
378
- const getParentNode = lookupGetter(ElementPrototype, "parentNode");
379
- if (typeof HTMLTemplateElement === "function") {
380
- const template = document2.createElement("template");
381
- if (template.content && template.content.ownerDocument) {
382
- document2 = template.content.ownerDocument;
383
- }
384
- }
385
- let trustedTypesPolicy;
386
- let emptyHTML = "";
387
- const {
388
- implementation,
389
- createNodeIterator,
390
- createDocumentFragment,
391
- getElementsByTagName
392
- } = document2;
393
- const {
394
- importNode
395
- } = originalDocument;
396
- let hooks = {};
397
- DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
398
- const {
399
- MUSTACHE_EXPR: MUSTACHE_EXPR2,
400
- ERB_EXPR: ERB_EXPR2,
401
- TMPLIT_EXPR: TMPLIT_EXPR2,
402
- DATA_ATTR: DATA_ATTR2,
403
- ARIA_ATTR: ARIA_ATTR2,
404
- IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2,
405
- ATTR_WHITESPACE: ATTR_WHITESPACE2,
406
- CUSTOM_ELEMENT: CUSTOM_ELEMENT2
407
- } = EXPRESSIONS;
408
- let {
409
- IS_ALLOWED_URI: IS_ALLOWED_URI$1
410
- } = EXPRESSIONS;
411
- let ALLOWED_TAGS = null;
412
- const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
413
- let ALLOWED_ATTR = null;
414
- const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
415
- let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
416
- tagNameCheck: {
417
- writable: true,
418
- configurable: false,
419
- enumerable: true,
420
- value: null
421
- },
422
- attributeNameCheck: {
423
- writable: true,
424
- configurable: false,
425
- enumerable: true,
426
- value: null
427
- },
428
- allowCustomizedBuiltInElements: {
429
- writable: true,
430
- configurable: false,
431
- enumerable: true,
432
- value: false
433
- }
434
- }));
435
- let FORBID_TAGS = null;
436
- let FORBID_ATTR = null;
437
- let ALLOW_ARIA_ATTR = true;
438
- let ALLOW_DATA_ATTR = true;
439
- let ALLOW_UNKNOWN_PROTOCOLS = false;
440
- let ALLOW_SELF_CLOSE_IN_ATTR = true;
441
- let SAFE_FOR_TEMPLATES = false;
442
- let SAFE_FOR_XML = true;
443
- let WHOLE_DOCUMENT = false;
444
- let SET_CONFIG = false;
445
- let FORCE_BODY = false;
446
- let RETURN_DOM = false;
447
- let RETURN_DOM_FRAGMENT = false;
448
- let RETURN_TRUSTED_TYPE = false;
449
- let SANITIZE_DOM = true;
450
- let SANITIZE_NAMED_PROPS = false;
451
- const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
452
- let KEEP_CONTENT = true;
453
- let IN_PLACE = false;
454
- let USE_PROFILES = {};
455
- let FORBID_CONTENTS = null;
456
- const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
457
- let DATA_URI_TAGS = null;
458
- const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
459
- let URI_SAFE_ATTRIBUTES = null;
460
- const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
461
- const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
462
- const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
463
- const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
464
- let NAMESPACE = HTML_NAMESPACE;
465
- let IS_EMPTY_INPUT = false;
466
- let ALLOWED_NAMESPACES = null;
467
- const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
468
- let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
469
- let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
470
- const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
471
- let PARSER_MEDIA_TYPE = null;
472
- const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
473
- const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
474
- let transformCaseFunc = null;
475
- let CONFIG = null;
476
- const formElement = document2.createElement("form");
477
- const isRegexOrFunction = function isRegexOrFunction2(testValue) {
478
- return testValue instanceof RegExp || testValue instanceof Function;
479
- };
480
- const _parseConfig = function _parseConfig2() {
481
- let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
482
- if (CONFIG && CONFIG === cfg) {
483
- return;
484
- }
485
- if (!cfg || typeof cfg !== "object") {
486
- cfg = {};
487
- }
488
- cfg = clone(cfg);
489
- PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
490
- SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
491
- transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
492
- ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
493
- ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
494
- ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
495
- URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
496
- DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
497
- FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
498
- FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
499
- FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
500
- USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES : false;
501
- ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
502
- ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
503
- ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
504
- ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
505
- SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
506
- SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
507
- WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
508
- RETURN_DOM = cfg.RETURN_DOM || false;
509
- RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
510
- RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
511
- FORCE_BODY = cfg.FORCE_BODY || false;
512
- SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
513
- SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
514
- KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
515
- IN_PLACE = cfg.IN_PLACE || false;
516
- IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
517
- NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
518
- MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
519
- HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
520
- CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
521
- if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
522
- CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
523
- }
524
- if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
525
- CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
526
- }
527
- if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") {
528
- CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
529
- }
530
- if (SAFE_FOR_TEMPLATES) {
531
- ALLOW_DATA_ATTR = false;
532
- }
533
- if (RETURN_DOM_FRAGMENT) {
534
- RETURN_DOM = true;
535
- }
536
- if (USE_PROFILES) {
537
- ALLOWED_TAGS = addToSet({}, text);
538
- ALLOWED_ATTR = [];
539
- if (USE_PROFILES.html === true) {
540
- addToSet(ALLOWED_TAGS, html$1);
541
- addToSet(ALLOWED_ATTR, html);
542
- }
543
- if (USE_PROFILES.svg === true) {
544
- addToSet(ALLOWED_TAGS, svg$1);
545
- addToSet(ALLOWED_ATTR, svg);
546
- addToSet(ALLOWED_ATTR, xml);
547
- }
548
- if (USE_PROFILES.svgFilters === true) {
549
- addToSet(ALLOWED_TAGS, svgFilters);
550
- addToSet(ALLOWED_ATTR, svg);
551
- addToSet(ALLOWED_ATTR, xml);
552
- }
553
- if (USE_PROFILES.mathMl === true) {
554
- addToSet(ALLOWED_TAGS, mathMl$1);
555
- addToSet(ALLOWED_ATTR, mathMl);
556
- addToSet(ALLOWED_ATTR, xml);
557
- }
558
- }
559
- if (cfg.ADD_TAGS) {
560
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
561
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
562
- }
563
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
564
- }
565
- if (cfg.ADD_ATTR) {
566
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
567
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
568
- }
569
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
570
- }
571
- if (cfg.ADD_URI_SAFE_ATTR) {
572
- addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
573
- }
574
- if (cfg.FORBID_CONTENTS) {
575
- if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
576
- FORBID_CONTENTS = clone(FORBID_CONTENTS);
577
- }
578
- addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
579
- }
580
- if (KEEP_CONTENT) {
581
- ALLOWED_TAGS["#text"] = true;
582
- }
583
- if (WHOLE_DOCUMENT) {
584
- addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
585
- }
586
- if (ALLOWED_TAGS.table) {
587
- addToSet(ALLOWED_TAGS, ["tbody"]);
588
- delete FORBID_TAGS.tbody;
589
- }
590
- if (cfg.TRUSTED_TYPES_POLICY) {
591
- if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
592
- throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
593
- }
594
- if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
595
- throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
596
- }
597
- trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
598
- emptyHTML = trustedTypesPolicy.createHTML("");
599
- } else {
600
- if (trustedTypesPolicy === void 0) {
601
- trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
602
- }
603
- if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
604
- emptyHTML = trustedTypesPolicy.createHTML("");
598
+ },
599
+ get root() {
600
+ return new Proxy({}, {
601
+ get: () => {
602
+ throw new Error("The `root` property is not available on the server.");
605
603
  }
606
- }
607
- if (freeze) {
608
- freeze(cfg);
609
- }
610
- CONFIG = cfg;
611
- };
612
- const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
613
- const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
614
- const _checkValidNamespace = function _checkValidNamespace2(element) {
615
- let parent = getParentNode(element);
616
- if (!parent || !parent.tagName) {
617
- parent = {
618
- namespaceURI: NAMESPACE,
619
- tagName: "template"
620
- };
621
- }
622
- const tagName = stringToLowerCase(element.tagName);
623
- const parentTagName = stringToLowerCase(parent.tagName);
624
- if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
625
- return false;
626
- }
627
- if (element.namespaceURI === SVG_NAMESPACE) {
628
- if (parent.namespaceURI === HTML_NAMESPACE) {
629
- return tagName === "svg";
630
- }
631
- if (parent.namespaceURI === MATHML_NAMESPACE) {
632
- return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
633
- }
634
- return Boolean(ALL_SVG_TAGS[tagName]);
635
- }
636
- if (element.namespaceURI === MATHML_NAMESPACE) {
637
- if (parent.namespaceURI === HTML_NAMESPACE) {
638
- return tagName === "math";
639
- }
640
- if (parent.namespaceURI === SVG_NAMESPACE) {
641
- return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
642
- }
643
- return Boolean(ALL_MATHML_TAGS[tagName]);
644
- }
645
- if (element.namespaceURI === HTML_NAMESPACE) {
646
- if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
647
- return false;
648
- }
649
- if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
650
- return false;
651
- }
652
- return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
653
- }
654
- if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
655
- return true;
656
- }
657
- return false;
658
- };
659
- const _forceRemove = function _forceRemove2(node) {
660
- arrayPush(DOMPurify.removed, {
661
- element: node
662
604
  });
663
- try {
664
- getParentNode(node).removeChild(node);
665
- } catch (_) {
666
- remove(node);
667
- }
668
- };
669
- const _removeAttribute = function _removeAttribute2(name, element) {
670
- try {
671
- arrayPush(DOMPurify.removed, {
672
- attribute: element.getAttributeNode(name),
673
- from: element
674
- });
675
- } catch (_) {
676
- arrayPush(DOMPurify.removed, {
677
- attribute: null,
678
- from: element
679
- });
680
- }
681
- element.removeAttribute(name);
682
- if (name === "is" && !ALLOWED_ATTR[name]) {
683
- if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
684
- try {
685
- _forceRemove(element);
686
- } catch (_) {
687
- }
688
- } else {
689
- try {
690
- element.setAttribute(name, "");
691
- } catch (_) {
692
- }
605
+ },
606
+ get internals() {
607
+ return new Proxy({}, {
608
+ get: () => {
609
+ throw new Error("The `internals` property is not available on the server.");
693
610
  }
694
- }
695
- };
696
- const _initDocument = function _initDocument2(dirty) {
697
- let doc = null;
698
- let leadingWhitespace = null;
699
- if (FORCE_BODY) {
700
- dirty = "<remove></remove>" + dirty;
701
- } else {
702
- const matches = stringMatch(dirty, /^[\r\n\t ]+/);
703
- leadingWhitespace = matches && matches[0];
704
- }
705
- if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
706
- dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
707
- }
708
- const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
709
- if (NAMESPACE === HTML_NAMESPACE) {
710
- try {
711
- doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
712
- } catch (_) {
713
- }
714
- }
715
- if (!doc || !doc.documentElement) {
716
- doc = implementation.createDocument(NAMESPACE, "template", null);
717
- try {
718
- doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
719
- } catch (_) {
720
- }
721
- }
722
- const body = doc.body || doc.documentElement;
723
- if (dirty && leadingWhitespace) {
724
- body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
725
- }
726
- if (NAMESPACE === HTML_NAMESPACE) {
727
- return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
728
- }
729
- return WHOLE_DOCUMENT ? doc.documentElement : body;
730
- };
731
- const _createNodeIterator = function _createNodeIterator2(root) {
732
- return createNodeIterator.call(
733
- root.ownerDocument || root,
734
- root,
735
- // eslint-disable-next-line no-bitwise
736
- NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
737
- null
738
- );
739
- };
740
- const _isClobbered = function _isClobbered2(element) {
741
- return element instanceof HTMLFormElement && (typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function");
742
- };
743
- const _isNode = function _isNode2(value) {
744
- return typeof Node === "function" && value instanceof Node;
745
- };
746
- function _executeHook(entryPoint, currentNode, data) {
747
- if (!hooks[entryPoint]) {
748
- return;
749
- }
750
- arrayForEach(hooks[entryPoint], (hook) => {
751
- hook.call(DOMPurify, currentNode, data, CONFIG);
752
611
  });
612
+ },
613
+ attributeChangedCallback: () => {
614
+ },
615
+ connectedCallback: () => {
616
+ },
617
+ disconnectedCallback: () => {
618
+ },
619
+ adoptedCallback: () => {
620
+ },
621
+ formDisabledCallback: () => {
622
+ },
623
+ formResetCallback: () => {
624
+ },
625
+ formStateRestoreCallback: () => {
626
+ },
627
+ formAssociatedCallback: () => {
628
+ },
629
+ clientOnlyCallback: () => {
630
+ },
631
+ customCallback: () => `{{callback:unavailable-on-server}}`,
632
+ attrSignals: new Proxy({}, { get: (_, attr) => createSignal(`{{attr:${String(attr)}}}`) }),
633
+ propSignals: new Proxy({}, { get: () => createSignal(null) }),
634
+ refs: {},
635
+ // @ts-expect-error // this should be a string for server-side rendering
636
+ adoptStyleSheet: (cssStr) => {
637
+ const _serverCss = registry !== void 0 ? registry.__serverCss : serverCss;
638
+ const cssArr = _serverCss.get(tagName) ?? [];
639
+ cssArr.push(cssStr);
640
+ _serverCss.set(tagName, cssArr);
753
641
  }
754
- const _sanitizeElements = function _sanitizeElements2(currentNode) {
755
- let content = null;
756
- _executeHook("beforeSanitizeElements", currentNode, null);
757
- if (_isClobbered(currentNode)) {
758
- _forceRemove(currentNode);
759
- return true;
760
- }
761
- const tagName = transformCaseFunc(currentNode.nodeName);
762
- _executeHook("uponSanitizeElement", currentNode, {
763
- tagName,
764
- allowedTags: ALLOWED_TAGS
642
+ });
643
+ var wrapTemplate = ({ tagName, serverRender, options }) => {
644
+ const { registry } = options.shadowRootOptions;
645
+ const scopedRegistry = registry !== void 0 && "scoped" in registry ? registry : void 0;
646
+ const initialRenderString = serverRender(getServerRenderArgs(tagName, scopedRegistry));
647
+ const _serverCss = scopedRegistry?.__serverCss ?? serverCss;
648
+ const cssRenderString = (_serverCss.get(tagName) ?? []).map((cssStr) => `<style>${cssStr}</style>`).join("");
649
+ const finalScopedRenderString = options.attachShadow ? (
650
+ /* html */
651
+ `
652
+ <template
653
+ shadowrootmode="${options.shadowRootOptions.mode}"
654
+ shadowrootdelegatesfocus="${options.shadowRootOptions.delegatesFocus}"
655
+ shadowrootclonable="${options.shadowRootOptions.clonable}"
656
+ shadowrootserializable="${options.shadowRootOptions.serializable}"
657
+ >
658
+ ${cssRenderString + initialRenderString}
659
+ </template>
660
+ `
661
+ ) : cssRenderString + initialRenderString;
662
+ return finalScopedRenderString;
663
+ };
664
+ var insertTemplates = (tagName, template, inputString) => {
665
+ return inputString.replace(new RegExp(`(<s*${tagName}([^>]*)>)`, "gm"), ($1, _, $3) => {
666
+ const attrs = $3.split(/(?!=")\s+/).filter((attr) => attr !== "").map((attr) => {
667
+ const [key, _value] = attr.split("=");
668
+ const value = _value?.replace(/"/g, "") ?? "";
669
+ return [key, value];
765
670
  });
766
- if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
767
- _forceRemove(currentNode);
768
- return true;
769
- }
770
- if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
771
- _forceRemove(currentNode);
772
- return true;
671
+ let scopedResult = template;
672
+ for (const [key, value] of attrs) {
673
+ scopedResult = scopedResult.replace(new RegExp(`{{attr:${key}}}`, "gm"), value);
773
674
  }
774
- if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
775
- _forceRemove(currentNode);
776
- return true;
777
- }
778
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
779
- if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
780
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
781
- return false;
782
- }
783
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
784
- return false;
785
- }
786
- }
787
- if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
788
- const parentNode = getParentNode(currentNode) || currentNode.parentNode;
789
- const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
790
- if (childNodes && parentNode) {
791
- const childCount = childNodes.length;
792
- for (let i = childCount - 1; i >= 0; --i) {
793
- const childClone = cloneNode(childNodes[i], true);
794
- childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
795
- parentNode.insertBefore(childClone, getNextSibling(currentNode));
796
- }
797
- }
798
- }
799
- _forceRemove(currentNode);
800
- return true;
801
- }
802
- if (currentNode instanceof Element2 && !_checkValidNamespace(currentNode)) {
803
- _forceRemove(currentNode);
804
- return true;
805
- }
806
- if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
807
- _forceRemove(currentNode);
808
- return true;
809
- }
810
- if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
811
- content = currentNode.textContent;
812
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
813
- content = stringReplace(content, expr, " ");
814
- });
815
- if (currentNode.textContent !== content) {
816
- arrayPush(DOMPurify.removed, {
817
- element: currentNode.cloneNode()
818
- });
819
- currentNode.textContent = content;
820
- }
821
- }
822
- _executeHook("afterSanitizeElements", currentNode, null);
823
- return false;
824
- };
825
- const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
826
- if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
827
- return false;
828
- }
829
- if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
830
- else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) ;
831
- else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
832
- if (
833
- // First condition does a very basic check if a) it's basically a valid custom element tagname AND
834
- // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
835
- // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
836
- _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND
837
- // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
838
- lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))
839
- ) ;
840
- else {
841
- return false;
842
- }
843
- } else if (URI_SAFE_ATTRIBUTES[lcName]) ;
844
- else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
845
- else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
846
- else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
847
- else if (value) {
848
- return false;
849
- } else ;
850
- return true;
851
- };
852
- const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
853
- return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT2);
854
- };
855
- const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
856
- _executeHook("beforeSanitizeAttributes", currentNode, null);
857
- const {
858
- attributes
859
- } = currentNode;
860
- if (!attributes) {
861
- return;
862
- }
863
- const hookEvent = {
864
- attrName: "",
865
- attrValue: "",
866
- keepAttr: true,
867
- allowedAttributes: ALLOWED_ATTR,
868
- forceKeepAttr: void 0
869
- };
870
- let l = attributes.length;
871
- while (l--) {
872
- const attr = attributes[l];
873
- const {
874
- name,
875
- namespaceURI,
876
- value: attrValue
877
- } = attr;
878
- const lcName = transformCaseFunc(name);
879
- let value = name === "value" ? attrValue : stringTrim(attrValue);
880
- hookEvent.attrName = lcName;
881
- hookEvent.attrValue = value;
882
- hookEvent.keepAttr = true;
883
- hookEvent.forceKeepAttr = void 0;
884
- _executeHook("uponSanitizeAttribute", currentNode, hookEvent);
885
- value = hookEvent.attrValue;
886
- if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) {
887
- _removeAttribute(name, currentNode);
888
- value = SANITIZE_NAMED_PROPS_PREFIX + value;
889
- }
890
- if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
891
- _removeAttribute(name, currentNode);
892
- continue;
893
- }
894
- if (hookEvent.forceKeepAttr) {
895
- continue;
896
- }
897
- _removeAttribute(name, currentNode);
898
- if (!hookEvent.keepAttr) {
899
- continue;
900
- }
901
- if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
902
- _removeAttribute(name, currentNode);
903
- continue;
904
- }
905
- if (SAFE_FOR_TEMPLATES) {
906
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
907
- value = stringReplace(value, expr, " ");
908
- });
909
- }
910
- const lcTag = transformCaseFunc(currentNode.nodeName);
911
- if (!_isValidAttribute(lcTag, lcName, value)) {
912
- continue;
913
- }
914
- if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
915
- if (namespaceURI) ;
916
- else {
917
- switch (trustedTypes.getAttributeType(lcTag, lcName)) {
918
- case "TrustedHTML": {
919
- value = trustedTypesPolicy.createHTML(value);
920
- break;
921
- }
922
- case "TrustedScriptURL": {
923
- value = trustedTypesPolicy.createScriptURL(value);
924
- break;
925
- }
926
- }
927
- }
928
- }
929
- try {
930
- if (namespaceURI) {
931
- currentNode.setAttributeNS(namespaceURI, name, value);
932
- } else {
933
- currentNode.setAttribute(name, value);
934
- }
935
- if (_isClobbered(currentNode)) {
936
- _forceRemove(currentNode);
937
- } else {
938
- arrayPop(DOMPurify.removed);
939
- }
940
- } catch (_) {
941
- }
942
- }
943
- _executeHook("afterSanitizeAttributes", currentNode, null);
944
- };
945
- const _sanitizeShadowDOM = function _sanitizeShadowDOM2(fragment) {
946
- let shadowNode = null;
947
- const shadowIterator = _createNodeIterator(fragment);
948
- _executeHook("beforeSanitizeShadowDOM", fragment, null);
949
- while (shadowNode = shadowIterator.nextNode()) {
950
- _executeHook("uponSanitizeShadowNode", shadowNode, null);
951
- if (_sanitizeElements(shadowNode)) {
952
- continue;
953
- }
954
- if (shadowNode.content instanceof DocumentFragment2) {
955
- _sanitizeShadowDOM2(shadowNode.content);
956
- }
957
- _sanitizeAttributes(shadowNode);
958
- }
959
- _executeHook("afterSanitizeShadowDOM", fragment, null);
960
- };
961
- DOMPurify.sanitize = function(dirty) {
962
- let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
963
- let body = null;
964
- let importedNode = null;
965
- let currentNode = null;
966
- let returnNode = null;
967
- IS_EMPTY_INPUT = !dirty;
968
- if (IS_EMPTY_INPUT) {
969
- dirty = "<!-->";
970
- }
971
- if (typeof dirty !== "string" && !_isNode(dirty)) {
972
- if (typeof dirty.toString === "function") {
973
- dirty = dirty.toString();
974
- if (typeof dirty !== "string") {
975
- throw typeErrorCreate("dirty is not a string, aborting");
976
- }
977
- } else {
978
- throw typeErrorCreate("toString is not a function");
979
- }
980
- }
981
- if (!DOMPurify.isSupported) {
982
- return dirty;
983
- }
984
- if (!SET_CONFIG) {
985
- _parseConfig(cfg);
986
- }
987
- DOMPurify.removed = [];
988
- if (typeof dirty === "string") {
989
- IN_PLACE = false;
990
- }
991
- if (IN_PLACE) {
992
- if (dirty.nodeName) {
993
- const tagName = transformCaseFunc(dirty.nodeName);
994
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
995
- throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
996
- }
997
- }
998
- } else if (dirty instanceof Node) {
999
- body = _initDocument("<!---->");
1000
- importedNode = body.ownerDocument.importNode(dirty, true);
1001
- if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
1002
- body = importedNode;
1003
- } else if (importedNode.nodeName === "HTML") {
1004
- body = importedNode;
1005
- } else {
1006
- body.appendChild(importedNode);
1007
- }
1008
- } else {
1009
- if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
1010
- dirty.indexOf("<") === -1) {
1011
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1012
- }
1013
- body = _initDocument(dirty);
1014
- if (!body) {
1015
- return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
1016
- }
1017
- }
1018
- if (body && FORCE_BODY) {
1019
- _forceRemove(body.firstChild);
1020
- }
1021
- const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
1022
- while (currentNode = nodeIterator.nextNode()) {
1023
- if (_sanitizeElements(currentNode)) {
1024
- continue;
1025
- }
1026
- if (currentNode.content instanceof DocumentFragment2) {
1027
- _sanitizeShadowDOM(currentNode.content);
1028
- }
1029
- _sanitizeAttributes(currentNode);
1030
- }
1031
- if (IN_PLACE) {
1032
- return dirty;
1033
- }
1034
- if (RETURN_DOM) {
1035
- if (RETURN_DOM_FRAGMENT) {
1036
- returnNode = createDocumentFragment.call(body.ownerDocument);
1037
- while (body.firstChild) {
1038
- returnNode.appendChild(body.firstChild);
1039
- }
1040
- } else {
1041
- returnNode = body;
1042
- }
1043
- if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
1044
- returnNode = importNode.call(originalDocument, returnNode, true);
1045
- }
1046
- return returnNode;
1047
- }
1048
- let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1049
- if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
1050
- serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
1051
- }
1052
- if (SAFE_FOR_TEMPLATES) {
1053
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
1054
- serializedHTML = stringReplace(serializedHTML, expr, " ");
1055
- });
1056
- }
1057
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1058
- };
1059
- DOMPurify.setConfig = function() {
1060
- let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1061
- _parseConfig(cfg);
1062
- SET_CONFIG = true;
1063
- };
1064
- DOMPurify.clearConfig = function() {
1065
- CONFIG = null;
1066
- SET_CONFIG = false;
1067
- };
1068
- DOMPurify.isValidAttribute = function(tag, attr, value) {
1069
- if (!CONFIG) {
1070
- _parseConfig({});
1071
- }
1072
- const lcTag = transformCaseFunc(tag);
1073
- const lcName = transformCaseFunc(attr);
1074
- return _isValidAttribute(lcTag, lcName, value);
1075
- };
1076
- DOMPurify.addHook = function(entryPoint, hookFunction) {
1077
- if (typeof hookFunction !== "function") {
1078
- return;
1079
- }
1080
- hooks[entryPoint] = hooks[entryPoint] || [];
1081
- arrayPush(hooks[entryPoint], hookFunction);
1082
- };
1083
- DOMPurify.removeHook = function(entryPoint) {
1084
- if (hooks[entryPoint]) {
1085
- return arrayPop(hooks[entryPoint]);
1086
- }
1087
- };
1088
- DOMPurify.removeHooks = function(entryPoint) {
1089
- if (hooks[entryPoint]) {
1090
- hooks[entryPoint] = [];
1091
- }
1092
- };
1093
- DOMPurify.removeAllHooks = function() {
1094
- hooks = {};
1095
- };
1096
- return DOMPurify;
1097
- }
1098
- var purify = createDOMPurify();
675
+ return $1 + scopedResult;
676
+ });
677
+ };
678
+ var clientOnlyCallback = (fn) => {
679
+ if (!isServer) return fn();
680
+ };
1099
681
 
1100
682
  // src/render.ts
1101
- var html2 = (strings, ...values) => {
683
+ var clearHTML = (element) => {
684
+ while (element.childNodes.length > 0) {
685
+ element.childNodes[0].remove();
686
+ }
687
+ };
688
+ var parseFragment = (htmlStr) => {
689
+ const range = document.createRange();
690
+ range.selectNode(document.body);
691
+ return range.createContextualFragment(htmlStr);
692
+ };
693
+ var setInnerHTML = (element, html2) => {
694
+ clearHTML(element);
695
+ const fragment = typeof html2 === "string" ? parseFragment(html2) : html2;
696
+ element.append(fragment);
697
+ };
698
+ var logValueError = (value) => {
699
+ console.error(
700
+ "An invalid value was passed to a template function. Non-primitive values are not supported.\n\nValue:\n",
701
+ value
702
+ );
703
+ };
704
+ var html = (strings, ...values) => {
1102
705
  let innerHTML = "";
1103
706
  const signalMap = /* @__PURE__ */ new Map();
1104
707
  strings.forEach((string, i) => {
@@ -1106,11 +709,17 @@ var html2 = (strings, ...values) => {
1106
709
  if (typeof value === "function") {
1107
710
  const uniqueKey = crypto.randomUUID();
1108
711
  signalMap.set(uniqueKey, value);
1109
- value = `{{signal:${uniqueKey}}}`;
712
+ value = isServer ? value() : `{{signal:${uniqueKey}}}`;
713
+ }
714
+ if (typeof value === "object" && value !== null) {
715
+ logValueError(value);
716
+ value = "";
1110
717
  }
1111
718
  innerHTML += string + String(value);
1112
719
  });
1113
- purify.sanitize(innerHTML);
720
+ if (isServer) {
721
+ return innerHTML;
722
+ }
1114
723
  const fragment = parseFragment(innerHTML);
1115
724
  const callbackBindingRegex = /(\{\{callback:.+\}\})/;
1116
725
  const signalBindingRegex = /(\{\{signal:.+\}\})/;
@@ -1118,10 +727,10 @@ var html2 = (strings, ...values) => {
1118
727
  for (const child of element.childNodes) {
1119
728
  if (child instanceof Text && signalBindingRegex.test(child.data)) {
1120
729
  const textList = child.data.split(signalBindingRegex);
1121
- textList.forEach((text2, i) => {
1122
- const uniqueKey = text2.replace(/\{\{signal:(.+)\}\}/, "$1");
1123
- const signal = uniqueKey !== text2 ? signalMap.get(uniqueKey) : void 0;
1124
- const newValue = signal !== void 0 ? signal() : text2;
730
+ textList.forEach((text, i) => {
731
+ const uniqueKey = text.replace(/\{\{signal:(.+)\}\}/, "$1");
732
+ const signal = uniqueKey !== text ? signalMap.get(uniqueKey) : void 0;
733
+ const newValue = signal !== void 0 ? signal() : text;
1125
734
  const newNode = (() => {
1126
735
  if (typeof newValue === "string") return new Text(newValue);
1127
736
  if (newValue instanceof DocumentFragment) return newValue;
@@ -1146,10 +755,10 @@ var html2 = (strings, ...values) => {
1146
755
  createEffect(() => {
1147
756
  let newText = "";
1148
757
  let hasNull = false;
1149
- for (const text2 of textList) {
1150
- const uniqueKey = text2.replace(/\{\{signal:(.+)\}\}/, "$1");
1151
- const signal = uniqueKey !== text2 ? signalMap.get(uniqueKey) : void 0;
1152
- const value = signal !== void 0 ? signal() : text2;
758
+ for (const text of textList) {
759
+ const uniqueKey = text.replace(/\{\{signal:(.+)\}\}/, "$1");
760
+ const signal = uniqueKey !== text ? signalMap.get(uniqueKey) : void 0;
761
+ const value = signal !== void 0 ? signal() : text;
1153
762
  if (value === null) hasNull = true;
1154
763
  newText += value;
1155
764
  }
@@ -1189,18 +798,25 @@ var css = (strings, ...values) => {
1189
798
  if (typeof value === "function") {
1190
799
  const uniqueKey = crypto.randomUUID();
1191
800
  signalMap.set(uniqueKey, value);
1192
- value = `{{signal:${uniqueKey}}}`;
801
+ value = isServer ? value() : `{{signal:${uniqueKey}}}`;
802
+ }
803
+ if (typeof value === "object" && value !== null) {
804
+ logValueError(value);
805
+ value = "";
1193
806
  }
1194
807
  cssText += string + String(value);
1195
808
  });
809
+ if (isServer) {
810
+ return cssText;
811
+ }
1196
812
  let stylesheet = adoptedStylesSupported ? new CSSStyleSheet() : document.createElement("style");
1197
813
  const textList = cssText.split(signalBindingRegex);
1198
814
  createEffect(() => {
1199
815
  const newCSSTextList = [];
1200
- for (const text2 of textList) {
1201
- const uniqueKey = text2.replace(/\{\{signal:(.+)\}\}/, "$1");
1202
- const signal = uniqueKey !== text2 ? signalMap.get(uniqueKey) : null;
1203
- const newText = signal !== null ? signal() : text2;
816
+ for (const text of textList) {
817
+ const uniqueKey = text.replace(/\{\{signal:(.+)\}\}/, "$1");
818
+ const signal = uniqueKey !== text ? signalMap.get(uniqueKey) : null;
819
+ const newText = signal !== null ? signal() : text;
1204
820
  newCSSTextList.push(newText);
1205
821
  }
1206
822
  const newCSSText = newCSSTextList.join("");
@@ -1220,36 +836,70 @@ var DEFAULT_RENDER_OPTIONS = {
1220
836
  attributesAsProperties: [],
1221
837
  attachShadow: true,
1222
838
  shadowRootOptions: {
1223
- mode: "closed"
839
+ mode: "closed",
840
+ delegatesFocus: false,
841
+ clonable: false,
842
+ serializable: false,
843
+ slotAssignment: "named"
1224
844
  }
1225
845
  };
1226
- if (typeof window !== "undefined") {
1227
- class TrackableCustomElementRegistry extends window.CustomElementRegistry {
1228
- __tagNames = /* @__PURE__ */ new Set();
1229
- define(tagName, constructor) {
1230
- super.define(tagName, constructor);
1231
- this.__tagNames.add(tagName);
1232
- }
1233
- }
1234
- window.CustomElementRegistry = TrackableCustomElementRegistry;
1235
- }
1236
- var getPropName = (attrName) => attrName.replace(/^([A-Z]+)/, (_, letter) => letter.toLowerCase()).replace(/(-|_| )([a-zA-Z])/g, (_, letter) => letter.toUpperCase());
1237
846
  var customElement = (render, options) => {
847
+ const _options = { ...DEFAULT_RENDER_OPTIONS, ...options };
1238
848
  const {
1239
849
  formAssociated,
1240
850
  observedAttributes: _observedAttributes,
1241
851
  attributesAsProperties,
1242
852
  attachShadow,
1243
853
  shadowRootOptions: _shadowRootOptions
1244
- } = { ...DEFAULT_RENDER_OPTIONS, ...options };
854
+ } = _options;
1245
855
  const shadowRootOptions = { ...DEFAULT_RENDER_OPTIONS.shadowRootOptions, ..._shadowRootOptions };
856
+ const allOptions = { ..._options, shadowRootOptions };
857
+ if (isServer) {
858
+ const serverRender = render;
859
+ let _tagName2;
860
+ let _registry2;
861
+ const scopedRegistry = (() => {
862
+ if (shadowRootOptions.registry !== void 0 && "scoped" in shadowRootOptions.registry && shadowRootOptions.registry.scoped) {
863
+ return shadowRootOptions.registry;
864
+ }
865
+ })();
866
+ return {
867
+ define(tagName) {
868
+ _tagName2 = tagName;
869
+ serverDefine({
870
+ tagName,
871
+ serverRender,
872
+ options: allOptions,
873
+ scopedRegistry,
874
+ parentRegistry: _registry2
875
+ });
876
+ return this;
877
+ },
878
+ register(registry) {
879
+ if (_tagName2 !== void 0 && "eject" in registry && registry.scoped) {
880
+ console.error("Must call `register()` before `define()` for scoped registries.");
881
+ return this;
882
+ }
883
+ if ("eject" in registry) {
884
+ _registry2 = registry;
885
+ } else {
886
+ console.error("Registry must be created with `createRegistry()` for SSR.");
887
+ }
888
+ return this;
889
+ },
890
+ eject() {
891
+ throw new Error("Cannot eject a custom element on the server.");
892
+ }
893
+ };
894
+ }
1246
895
  shadowRootOptions.registry = shadowRootOptions.customElements = shadowRootOptions.registry instanceof CustomElementRegistry ? shadowRootOptions.registry : shadowRootOptions.registry?.eject();
1247
896
  const observedAttributesSet = new Set(_observedAttributes);
1248
897
  const attributesAsPropertiesMap = /* @__PURE__ */ new Map();
1249
898
  for (const [attrName, coerce] of attributesAsProperties) {
1250
899
  observedAttributesSet.add(attrName);
1251
900
  attributesAsPropertiesMap.set(attrName, {
1252
- prop: getPropName(attrName),
901
+ // convert kebab-case attribute names to camelCase property names
902
+ prop: attrName.replace(/^([A-Z]+)/, (_, letter) => letter.toLowerCase()).replace(/(-|_| )([a-zA-Z])/g, (_, letter) => letter.toUpperCase()),
1253
903
  coerce,
1254
904
  value: null
1255
905
  });
@@ -1267,6 +917,7 @@ var customElement = (render, options) => {
1267
917
  #formDisabledCallbackFns = /* @__PURE__ */ new Set();
1268
918
  #formResetCallbackFns = /* @__PURE__ */ new Set();
1269
919
  #formStateRestoreCallbackFns = /* @__PURE__ */ new Set();
920
+ #clientOnlyCallbackFns = /* @__PURE__ */ new Set();
1270
921
  __customCallbackFns = /* @__PURE__ */ new Map();
1271
922
  #shadowRoot = attachShadow ? this.attachShadow(shadowRootOptions) : null;
1272
923
  #internals = this.attachInternals();
@@ -1299,6 +950,7 @@ var customElement = (render, options) => {
1299
950
  formDisabledCallback: (fn) => this.#formDisabledCallbackFns.add(fn),
1300
951
  formResetCallback: (fn) => this.#formResetCallbackFns.add(fn),
1301
952
  formStateRestoreCallback: (fn) => this.#formStateRestoreCallbackFns.add(fn),
953
+ clientOnlyCallback: (fn) => this.#clientOnlyCallbackFns.add(fn),
1302
954
  customCallback: (fn) => {
1303
955
  const key = crypto.randomUUID();
1304
956
  this.__customCallbackFns.set(key, fn);
@@ -1397,6 +1049,9 @@ You must set an initial value before calling a property signal's getter.
1397
1049
  });
1398
1050
  }
1399
1051
  }
1052
+ for (const fn of this.#clientOnlyCallbackFns) {
1053
+ fn();
1054
+ }
1400
1055
  setInnerHTML(root, fragment);
1401
1056
  }
1402
1057
  static get formAssociated() {
@@ -1493,79 +1148,107 @@ You must set an initial value before calling a property signal's getter.
1493
1148
  }
1494
1149
  }
1495
1150
  }
1496
- let _tagName = null;
1497
- let _registry = null;
1498
- let _registered = false;
1499
- const register = () => {
1500
- if (_tagName === null || _registry === null || _registered) return;
1501
- _registry.register(_tagName, CustomElement);
1502
- _registry.register(_tagName, elementResult);
1503
- _registered = true;
1504
- };
1151
+ let _tagName;
1152
+ let _registry;
1505
1153
  const elementResult = {
1506
- define(tagName) {
1507
- const registry = _registry?.scoped ? _registry.eject() : customElements;
1508
- if (registry.get(tagName) !== void 0) {
1154
+ define(tagName, options2) {
1155
+ const registry = _registry !== void 0 ? _registry : customElements;
1156
+ const nativeRegistry = "eject" in registry ? registry.eject() : registry;
1157
+ if (nativeRegistry.get(tagName) !== void 0) {
1509
1158
  console.warn(`Custom element "${tagName}" was already defined. Skipping...`);
1510
1159
  return this;
1511
1160
  }
1512
- registry.define(tagName, CustomElement);
1161
+ registry.define(tagName, CustomElement, options2);
1513
1162
  _tagName = tagName;
1514
- register();
1515
1163
  return this;
1516
1164
  },
1517
1165
  register(registry) {
1518
- if (_tagName !== null && registry.scoped) {
1166
+ if (_tagName !== void 0 && "eject" in registry && registry.scoped) {
1519
1167
  console.error("Must call `register()` before `define()` for scoped registries.");
1520
1168
  return this;
1521
1169
  }
1522
1170
  _registry = registry;
1523
- register();
1524
1171
  return this;
1525
1172
  },
1526
1173
  eject: () => CustomElement
1527
1174
  };
1528
1175
  return elementResult;
1529
1176
  };
1177
+
1178
+ // src/registry.ts
1530
1179
  var createRegistry = (args) => {
1531
1180
  const { scoped = false } = args ?? {};
1532
- const registryResult = /* @__PURE__ */ new Map();
1533
- const registry = (() => {
1534
- try {
1535
- return new CustomElementRegistry();
1536
- } catch (error) {
1537
- if (scoped)
1538
- console.error(
1539
- "Scoped custom element registries are not supported in this environment. Please install `@webcomponents/scoped-custom-element-registry` to use this feature."
1540
- );
1541
- return customElements;
1542
- }
1181
+ const customElementMap = /* @__PURE__ */ new Map();
1182
+ const customElementTags = /* @__PURE__ */ new Set();
1183
+ const nativeRegistry = (() => {
1184
+ if (isServer) return;
1185
+ if (scoped) return new CustomElementRegistry();
1186
+ return customElements;
1543
1187
  })();
1544
1188
  return {
1545
- register: (tagName, element) => {
1546
- if (registryResult.has(element)) {
1547
- console.warn(`Custom element class "${element.constructor.name}" was already registered. Skipping...`);
1548
- return;
1189
+ __serverCss: /* @__PURE__ */ new Map(),
1190
+ __serverRenderOpts: /* @__PURE__ */ new Map(),
1191
+ define(tagName, ElementResult, options) {
1192
+ const isResult = "eject" in ElementResult;
1193
+ if (isServer) {
1194
+ if (isResult) ElementResult.register(this).define(tagName, options);
1195
+ return this;
1196
+ }
1197
+ const CustomElement = isResult ? ElementResult.eject() : ElementResult;
1198
+ if (customElementMap.has(CustomElement)) {
1199
+ console.warn(`Custom element class "${CustomElement.constructor.name}" was already defined. Skipping...`);
1200
+ return this;
1201
+ }
1202
+ if (customElementTags.has(tagName)) {
1203
+ console.warn(`Custom element tag name "${tagName}" was already defined. Skipping...`);
1204
+ return this;
1205
+ }
1206
+ customElementMap.set(CustomElement, tagName.toUpperCase());
1207
+ customElementTags.add(tagName);
1208
+ if (CustomElement === void 0) {
1209
+ console.error(`Custom element class for tag name "${tagName}" was not found. You must register it first.`);
1210
+ return this;
1211
+ }
1212
+ nativeRegistry?.define(tagName, CustomElement, options);
1213
+ return this;
1214
+ },
1215
+ getTagName: (ElementResult) => {
1216
+ const CustomElement = "eject" in ElementResult ? ElementResult.eject() : ElementResult;
1217
+ return customElementMap.get(CustomElement);
1218
+ },
1219
+ getAllTagNames: () => Array.from(customElementTags),
1220
+ eject: () => {
1221
+ if (nativeRegistry === void 0) {
1222
+ throw new Error("Cannot eject a registry on the server.");
1549
1223
  }
1550
- registryResult.set(element, tagName.toUpperCase());
1224
+ return nativeRegistry;
1551
1225
  },
1552
- getTagName: (element) => registryResult.get(element),
1553
- eject: () => registry,
1554
1226
  scoped
1555
1227
  };
1556
1228
  };
1557
1229
  // Annotate the CommonJS export names for ESM import in node:
1558
1230
  0 && (module.exports = {
1231
+ clientOnlyCallback,
1559
1232
  createEffect,
1560
1233
  createRegistry,
1561
1234
  createSignal,
1562
1235
  css,
1563
1236
  customElement,
1564
1237
  derived,
1565
- html
1238
+ html,
1239
+ insertTemplates,
1240
+ onServerDefine
1566
1241
  });
1567
- /*! Bundled license information:
1568
-
1569
- dompurify/dist/purify.es.mjs:
1570
- (*! @license DOMPurify 3.2.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.1/LICENSE *)
1571
- */
1242
+ /**
1243
+ * @license
1244
+ * Copyright (c) 2020 The Polymer Project Authors. All rights reserved.
1245
+ * This code may only be used under the BSD style license found at
1246
+ * http://polymer.github.io/LICENSE.txt
1247
+ * The complete set of authors may be found at
1248
+ * http://polymer.github.io/AUTHORS.txt
1249
+ * The complete set of contributors may be found at
1250
+ * http://polymer.github.io/CONTRIBUTORS.txt
1251
+ * Code distributed by Google as part of the polymer project is also
1252
+ * subject to an additional IP rights grant found at
1253
+ * http://polymer.github.io/PATENTS.txt
1254
+ */