@spiffcommerce/theme-bridge 1.17.4 → 1.18.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.d.ts CHANGED
@@ -47,6 +47,7 @@ declare enum FieldType {
47
47
  Asset = "Asset",
48
48
  Boolean = "Boolean",
49
49
  Color = "Color",
50
+ ConversionConfiguration = "ConversionConfiguration",
50
51
  Heading = "Heading",
51
52
  List = "List",
52
53
  Number = "Number",
@@ -107,6 +108,9 @@ interface AssetField extends ConfigurableField, RequiredOption {
107
108
  assetType: AssetType;
108
109
  type: FieldType.Asset;
109
110
  }
111
+ interface ConversionConfigurationField extends ConfigurableField {
112
+ type: FieldType.ConversionConfiguration;
113
+ }
110
114
  interface SelectFieldBase extends ConfigurableField {
111
115
  /**
112
116
  * The options available for the Partner to select in the configuration form.
@@ -170,7 +174,7 @@ type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : nev
170
174
  /**
171
175
  * All fields that are configurable by a user in Hub.
172
176
  */
173
- type ThemeConfigurationConfigurableFields = GenericField | AssetField | SelectField | TextField | ListField | ObjectField | CustomObjectField;
177
+ type ThemeConfigurationConfigurableFields = GenericField | AssetField | ConversionConfigurationField | SelectField | TextField | ListField | ObjectField | CustomObjectField;
174
178
  /**
175
179
  * All fields.
176
180
  */
@@ -299,12 +303,65 @@ interface ThemeInstallConfigurationResource {
299
303
  updatedAt: string;
300
304
  fields: ThemeInstallConfigurationFieldResource[];
301
305
  }
306
+ /**
307
+ * Defines the locations at which a conversion attempt can take place.
308
+ */
309
+ declare enum ConversionLocation {
310
+ /**
311
+ * The client should expose a flow for allowing the user to optionally input details at any point.
312
+ */
313
+ Manual = "Manual",
314
+ /**
315
+ * The client should show the conversion flow at the beginning of a workflow.
316
+ */
317
+ OnStart = "OnStart",
318
+ /**
319
+ * The client should allow the user to input details just before quitting the experience.
320
+ */
321
+ OnQuit = "OnQuit",
322
+ /**
323
+ * The client should ask the user for details prior to adding to cart.
324
+ */
325
+ OnEnd = "OnEnd"
326
+ }
327
+ /**
328
+ * The data configured to be requested.
329
+ */
330
+ declare enum ConversionDataType {
331
+ Email = "Email",
332
+ FirstName = "FirstName",
333
+ LastName = "LastName",
334
+ Phone = "Phone",
335
+ Apartment = "Apartment",
336
+ City = "City",
337
+ Country = "Country",
338
+ OrganizationName = "OrganizationName",
339
+ PostCode = "PostCode",
340
+ State = "State",
341
+ StreetAddress = "StreetAddress"
342
+ }
343
+ interface ConversionData {
344
+ type: ConversionDataType;
345
+ mandatory: boolean;
346
+ }
347
+ /**
348
+ * The configuration for conversion, exposed on products currently.
349
+ */
350
+ interface ConversionConfiguration {
351
+ id: string;
352
+ name?: string;
353
+ locations: ConversionLocation[];
354
+ requestedData: ConversionDataType[];
355
+ requestedDataItems: ConversionData[];
356
+ mandatory?: boolean;
357
+ }
302
358
  interface ThemeInstallConfigurationFieldResource {
303
359
  key?: string;
304
360
  fallbackToDefaultConfiguration?: boolean;
305
361
  value?: string;
306
362
  type: FieldType;
307
363
  asset?: AssetResource;
364
+ conversionConfiguration?: ConversionConfiguration;
308
365
  /** When the type is `List`, this will be the configured values */
309
366
  listValues?: ThemeInstallConfigurationFieldResource[];
310
367
  /** When the type is `Object`, this will be the configured field values */
@@ -501,4 +558,4 @@ interface PluginOptions {
501
558
  */
502
559
  declare function spiffThemePlugin(opts?: PluginOptions): Plugin;
503
560
 
504
- export { type AssetResource, AssetType, CustomSchemaType, FieldType, type SpiffDevOptions, type SpiffThemeLoader, type ThemeConfigurationConfigurableFields, type ThemeConfigurationFile, type ThemeConfigurationLaunchData, type ThemeConfigurationLaunchDataTargetFile, type ThemeConfigurationSchema, type ThemeConfigurationSchemaCustomSchema, type ThemeConfigurationSchemaCustomSchemaGraphQl, type ThemeConfigurationSchemaCustomSchemaResource, type ThemeConfigurationSchemaField, type ThemeConfigurationSchemaFieldGraphQl, type ThemeConfigurationSchemaFieldResource, type ThemeConfigurationSchemaGraphQl, type ThemeConfigurationSchemaResource, type ThemeContext, type ThemeContextBundle, type ThemeContextBundleOptions, type ThemeContextBundleOptionsExisting, type ThemeContextBundleOptionsNew, type ThemeContextTransaction, type ThemeContextWorkflowOptions, type ThemeContextWorkflowOptionsExternalProduct, type ThemeContextWorkflowOptionsIntegrationProduct, type ThemeContextWorkflowOptionsNewBase, type ThemeContextWorkflowOptionsTransaction, ThemeFileType, type ThemeInstallConfigurationField, type ThemeInstallConfigurationFieldGraphQl, type ThemeInstallConfigurationFieldResource, type ThemeInstallConfigurationGraphQl, type ThemeInstallConfigurationResource, type ThemeLaunchDataResource, type ThemeLaunchDataTargetFileResource, type ThemeResource, type ThemeVersionGraphQl, type ThemeVersionResource, exampleThemeInstallConfig, getDefaultsForSchema, setSpiffDevOptions, spiffThemePlugin, themeInstallConfigurationFieldsToRecordObject, themeInstallConfigurationGraphQlToResource, themeInstallConfigurationToRecordObject, themeVersionConfigurationGraphQlToResource, themeVersionGraphQlToResource };
561
+ export { type AssetResource, AssetType, type ConversionConfiguration, type ConversionData, ConversionDataType, ConversionLocation, CustomSchemaType, FieldType, type SpiffDevOptions, type SpiffThemeLoader, type ThemeConfigurationConfigurableFields, type ThemeConfigurationFile, type ThemeConfigurationLaunchData, type ThemeConfigurationLaunchDataTargetFile, type ThemeConfigurationSchema, type ThemeConfigurationSchemaCustomSchema, type ThemeConfigurationSchemaCustomSchemaGraphQl, type ThemeConfigurationSchemaCustomSchemaResource, type ThemeConfigurationSchemaField, type ThemeConfigurationSchemaFieldGraphQl, type ThemeConfigurationSchemaFieldResource, type ThemeConfigurationSchemaGraphQl, type ThemeConfigurationSchemaResource, type ThemeContext, type ThemeContextBundle, type ThemeContextBundleOptions, type ThemeContextBundleOptionsExisting, type ThemeContextBundleOptionsNew, type ThemeContextTransaction, type ThemeContextWorkflowOptions, type ThemeContextWorkflowOptionsExternalProduct, type ThemeContextWorkflowOptionsIntegrationProduct, type ThemeContextWorkflowOptionsNewBase, type ThemeContextWorkflowOptionsTransaction, ThemeFileType, type ThemeInstallConfigurationField, type ThemeInstallConfigurationFieldGraphQl, type ThemeInstallConfigurationFieldResource, type ThemeInstallConfigurationGraphQl, type ThemeInstallConfigurationResource, type ThemeLaunchDataResource, type ThemeLaunchDataTargetFileResource, type ThemeResource, type ThemeVersionGraphQl, type ThemeVersionResource, exampleThemeInstallConfig, getDefaultsForSchema, setSpiffDevOptions, spiffThemePlugin, themeInstallConfigurationFieldsToRecordObject, themeInstallConfigurationGraphQlToResource, themeInstallConfigurationToRecordObject, themeVersionConfigurationGraphQlToResource, themeVersionGraphQlToResource };
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("#spiffThemeWrapper{width:100%;height:100%}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
2
  var $e = Object.defineProperty;
3
- var Te = (e, t, n) => t in e ? $e(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
4
- var B = (e, t, n) => (Te(e, typeof t != "symbol" ? t + "" : t, n), n);
3
+ var Ne = (e, t, n) => t in e ? $e(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
4
+ var B = (e, t, n) => (Ne(e, typeof t != "symbol" ? t + "" : t, n), n);
5
5
  import je from "fs";
6
- import Pe from "path";
7
- var Z = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(Z || {}), E = /* @__PURE__ */ ((e) => (e.Asset = "Asset", e.Boolean = "Boolean", e.Color = "Color", e.Heading = "Heading", e.List = "List", e.Number = "Number", e.Object = "Object", e.Select = "Select", e.Text = "Text", e))(E || {}), He = /* @__PURE__ */ ((e) => (e.Color = "Color", e.ColorProfile = "ColorProfile", e.Data = "Data", e.Environment = "Environment", e.Font = "Font", e.Frame = "Frame", e.Illustration = "Illustration", e.Image = "Image", e.Material = "Material", e.Model = "Model", e.Video = "Video", e))(He || {}), Ve = /* @__PURE__ */ ((e) => (e.Object = "Object", e.Union = "Union", e))(Ve || {});
6
+ import He from "path";
7
+ var Q = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(Q || {}), S = /* @__PURE__ */ ((e) => (e.Asset = "Asset", e.Boolean = "Boolean", e.Color = "Color", e.ConversionConfiguration = "ConversionConfiguration", e.Heading = "Heading", e.List = "List", e.Number = "Number", e.Object = "Object", e.Select = "Select", e.Text = "Text", e))(S || {}), Ve = /* @__PURE__ */ ((e) => (e.Color = "Color", e.ColorProfile = "ColorProfile", e.Data = "Data", e.Environment = "Environment", e.Font = "Font", e.Frame = "Frame", e.Illustration = "Illustration", e.Image = "Image", e.Material = "Material", e.Model = "Model", e.Video = "Video", e))(Ve || {}), Ie = /* @__PURE__ */ ((e) => (e.Object = "Object", e.Union = "Union", e))(Ie || {}), Oe = /* @__PURE__ */ ((e) => (e.Manual = "Manual", e.OnStart = "OnStart", e.OnQuit = "OnQuit", e.OnEnd = "OnEnd", e))(Oe || {}), De = /* @__PURE__ */ ((e) => (e.Email = "Email", e.FirstName = "FirstName", e.LastName = "LastName", e.Phone = "Phone", e.Apartment = "Apartment", e.City = "City", e.Country = "Country", e.OrganizationName = "OrganizationName", e.PostCode = "PostCode", e.State = "State", e.StreetAddress = "StreetAddress", e))(De || {});
8
8
  function X(e) {
9
9
  return Object.assign({}, ...e.map((t) => {
10
10
  if (t.key)
@@ -14,18 +14,20 @@ function X(e) {
14
14
  }));
15
15
  }
16
16
  function he(e) {
17
- if (e.type === E.Asset)
17
+ if (e.type === S.Asset)
18
18
  return e.asset;
19
- if (e.type !== E.List && e.type !== E.Object) {
19
+ if (e.type === S.ConversionConfiguration)
20
+ return e.conversionConfiguration;
21
+ if (e.type !== S.List && e.type !== S.Object) {
20
22
  if (e.value === void 0)
21
23
  return;
22
- if (e.type === E.Number)
24
+ if (e.type === S.Number)
23
25
  try {
24
26
  return Number.parseFloat(e.value);
25
27
  } catch {
26
28
  return;
27
29
  }
28
- else if (e.type === E.Boolean)
30
+ else if (e.type === S.Boolean)
29
31
  return e.value === "true";
30
32
  return e.value;
31
33
  }
@@ -37,10 +39,10 @@ function he(e) {
37
39
  schema: e.schema ?? void 0
38
40
  };
39
41
  }
40
- function ht(e) {
42
+ function vt(e) {
41
43
  return X(e);
42
44
  }
43
- function mt(e) {
45
+ function gt(e) {
44
46
  return X(e.fields);
45
47
  }
46
48
  function F(e, t) {
@@ -51,7 +53,7 @@ function F(e, t) {
51
53
  };
52
54
  return e.items !== void 0 && (n.items = F(t[e.items], t)), e.fields !== void 0 && (n.fields = e.fields.map((_) => F(t[_], t))), n;
53
55
  }
54
- function Ie(e) {
56
+ function Te(e) {
55
57
  var _;
56
58
  const t = {
57
59
  ...e,
@@ -60,7 +62,7 @@ function Ie(e) {
60
62
  var i;
61
63
  return {
62
64
  ...o,
63
- fields: (i = o.fields) == null ? void 0 : i.map((u) => F(e.fields[u], e.fields))
65
+ fields: (i = o.fields) == null ? void 0 : i.map((l) => F(e.fields[l], e.fields))
64
66
  };
65
67
  })
66
68
  }, n = [];
@@ -70,58 +72,58 @@ function Ie(e) {
70
72
  throw new Error("Failed to map ThemeVersionConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeConfigurationSchemaField");
71
73
  return t.fields = n, t;
72
74
  }
73
- function vt(e) {
75
+ function yt(e) {
74
76
  return {
75
77
  ...e,
76
- configurationSchema: Ie(e.configurationSchema)
78
+ configurationSchema: Te(e.configurationSchema)
77
79
  };
78
80
  }
79
- function Q(e, t) {
81
+ function z(e, t) {
80
82
  const n = {
81
83
  ...e,
82
84
  listValues: void 0,
83
85
  objectValues: void 0
84
86
  };
85
- return e.listValues !== void 0 && (n.listValues = e.listValues.map((_) => Q(t[_], t))), e.objectValues !== void 0 && (n.objectValues = e.objectValues.map((_) => Q(t[_], t))), n;
87
+ return e.listValues !== void 0 && (n.listValues = e.listValues.map((_) => z(t[_], t))), e.objectValues !== void 0 && (n.objectValues = e.objectValues.map((_) => z(t[_], t))), n;
86
88
  }
87
- function yt(e) {
89
+ function bt(e) {
88
90
  const t = {
89
91
  ...e,
90
92
  fields: []
91
93
  }, n = [];
92
94
  if (e.fields.forEach((_) => {
93
- _.root && n.push(Q(_, e.fields));
95
+ _.root && n.push(z(_, e.fields));
94
96
  }), e.fields.length > 0 && n.length === 0)
95
97
  throw new Error("Failed to map ThemeInstallConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeInstallConfigurationField");
96
98
  return t.fields = n, t;
97
99
  }
98
- var A, f, me, S, _e, ve, z, $ = {}, ye = [], Ne = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, q = Array.isArray;
100
+ var M, f, me, E, _e, ve, Z, $ = {}, ge = [], Fe = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, q = Array.isArray;
99
101
  function x(e, t) {
100
102
  for (var n in t)
101
103
  e[n] = t[n];
102
104
  return e;
103
105
  }
104
- function ge(e) {
106
+ function ye(e) {
105
107
  var t = e.parentNode;
106
108
  t && t.removeChild(e);
107
109
  }
108
110
  function Le(e, t, n) {
109
- var _, o, i, u = {};
111
+ var _, o, i, l = {};
110
112
  for (i in t)
111
- i == "key" ? _ = t[i] : i == "ref" ? o = t[i] : u[i] = t[i];
112
- if (arguments.length > 2 && (u.children = arguments.length > 3 ? A.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null)
113
+ i == "key" ? _ = t[i] : i == "ref" ? o = t[i] : l[i] = t[i];
114
+ if (arguments.length > 2 && (l.children = arguments.length > 3 ? M.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null)
113
115
  for (i in e.defaultProps)
114
- u[i] === void 0 && (u[i] = e.defaultProps[i]);
115
- return V(e, u, _, o, null);
116
+ l[i] === void 0 && (l[i] = e.defaultProps[i]);
117
+ return I(e, l, _, o, null);
116
118
  }
117
- function V(e, t, n, _, o) {
119
+ function I(e, t, n, _, o) {
118
120
  var i = { type: e, props: t, key: n, ref: _, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: o ?? ++me, __i: -1, __u: 0 };
119
121
  return o == null && f.vnode != null && f.vnode(i), i;
120
122
  }
121
123
  function R(e) {
122
124
  return e.children;
123
125
  }
124
- function I(e, t) {
126
+ function O(e, t) {
125
127
  this.props = e, this.context = t;
126
128
  }
127
129
  function w(e, t) {
@@ -144,24 +146,24 @@ function be(e) {
144
146
  }
145
147
  }
146
148
  function oe(e) {
147
- (!e.__d && (e.__d = !0) && S.push(e) && !O.__r++ || _e !== f.debounceRendering) && ((_e = f.debounceRendering) || ve)(O);
148
- }
149
- function O() {
150
- var e, t, n, _, o, i, u, l, c;
151
- for (S.sort(z); e = S.shift(); )
152
- e.__d && (t = S.length, _ = void 0, i = (o = (n = e).__v).__e, l = [], c = [], (u = n.__P) && ((_ = x({}, o)).__v = o.__v + 1, f.vnode && f.vnode(_), ee(u, _, o, n.__n, u.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, l, i ?? w(o), !!(32 & o.__u), c), _.__.__k[_.__i] = _, xe(l, _, c), _.__e != i && be(_)), S.length > t && S.sort(z));
153
- O.__r = 0;
154
- }
155
- function ke(e, t, n, _, o, i, u, l, c, s, p) {
156
- var r, d, a, v, k, y = _ && _.__k || ye, h = t.length;
157
- for (n.__d = c, Fe(n, t, y), c = n.__d, r = 0; r < h; r++)
158
- (a = n.__k[r]) != null && typeof a != "boolean" && typeof a != "function" && (d = a.__i === -1 ? $ : y[a.__i] || $, a.__i = r, ee(e, a, d, o, i, u, l, c, s, p), v = a.__e, a.ref && d.ref != a.ref && (d.ref && te(d.ref, null, a), p.push(a.ref, a.__c || v, a)), k == null && v != null && (k = v), 65536 & a.__u || d.__k === a.__k ? c = Ce(a, c, e) : typeof a.type == "function" && a.__d !== void 0 ? c = a.__d : v && (c = v.nextSibling), a.__d = void 0, a.__u &= -196609);
149
+ (!e.__d && (e.__d = !0) && E.push(e) && !L.__r++ || _e !== f.debounceRendering) && ((_e = f.debounceRendering) || ve)(L);
150
+ }
151
+ function L() {
152
+ var e, t, n, _, o, i, l, u, c;
153
+ for (E.sort(Z); e = E.shift(); )
154
+ e.__d && (t = E.length, _ = void 0, i = (o = (n = e).__v).__e, u = [], c = [], (l = n.__P) && ((_ = x({}, o)).__v = o.__v + 1, f.vnode && f.vnode(_), ee(l, _, o, n.__n, l.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, u, i ?? w(o), !!(32 & o.__u), c), _.__.__k[_.__i] = _, xe(u, _, c), _.__e != i && be(_)), E.length > t && E.sort(Z));
155
+ L.__r = 0;
156
+ }
157
+ function ke(e, t, n, _, o, i, l, u, c, s, p) {
158
+ var r, d, a, v, k, g = _ && _.__k || ge, h = t.length;
159
+ for (n.__d = c, Ae(n, t, g), c = n.__d, r = 0; r < h; r++)
160
+ (a = n.__k[r]) != null && typeof a != "boolean" && typeof a != "function" && (d = a.__i === -1 ? $ : g[a.__i] || $, a.__i = r, ee(e, a, d, o, i, l, u, c, s, p), v = a.__e, a.ref && d.ref != a.ref && (d.ref && te(d.ref, null, a), p.push(a.ref, a.__c || v, a)), k == null && v != null && (k = v), 65536 & a.__u || d.__k === a.__k ? c = Ce(a, c, e) : typeof a.type == "function" && a.__d !== void 0 ? c = a.__d : v && (c = v.nextSibling), a.__d = void 0, a.__u &= -196609);
159
161
  n.__d = c, n.__e = k;
160
162
  }
161
- function Fe(e, t, n) {
162
- var _, o, i, u, l, c = t.length, s = n.length, p = s, r = 0;
163
+ function Ae(e, t, n) {
164
+ var _, o, i, l, u, c = t.length, s = n.length, p = s, r = 0;
163
165
  for (e.__k = [], _ = 0; _ < c; _++)
164
- (o = e.__k[_] = (o = t[_]) == null || typeof o == "boolean" || typeof o == "function" ? null : typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? V(null, o, null, null, o) : q(o) ? V(R, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? V(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : o) != null ? (o.__ = e, o.__b = e.__b + 1, l = Oe(o, n, u = _ + r, p), o.__i = l, i = null, l !== -1 && (p--, (i = n[l]) && (i.__u |= 131072)), i == null || i.__v === null ? (l == -1 && r--, typeof o.type != "function" && (o.__u |= 65536)) : l !== u && (l === u + 1 ? r++ : l > u ? p > c - u ? r += l - u : r-- : r = l < u && l == u - 1 ? l - u : 0, l !== _ + r && (o.__u |= 65536))) : (i = n[_]) && i.key == null && i.__e && (i.__e == e.__d && (e.__d = w(i)), J(i, i, !1), n[_] = null, p--);
166
+ (o = e.__k[_] = (o = t[_]) == null || typeof o == "boolean" || typeof o == "function" ? null : typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? I(null, o, null, null, o) : q(o) ? I(R, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? I(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : o) != null ? (o.__ = e, o.__b = e.__b + 1, u = Ue(o, n, l = _ + r, p), o.__i = u, i = null, u !== -1 && (p--, (i = n[u]) && (i.__u |= 131072)), i == null || i.__v === null ? (u == -1 && r--, typeof o.type != "function" && (o.__u |= 65536)) : u !== l && (u === l + 1 ? r++ : u > l ? p > c - l ? r += u - l : r-- : r = u < l && u == l - 1 ? u - l : 0, u !== _ + r && (o.__u |= 65536))) : (i = n[_]) && i.key == null && i.__e && (i.__e == e.__d && (e.__d = w(i)), J(i, i, !1), n[_] = null, p--);
165
167
  if (p)
166
168
  for (_ = 0; _ < s; _++)
167
169
  (i = n[_]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d = w(i)), J(i, i));
@@ -175,29 +177,29 @@ function Ce(e, t, n) {
175
177
  }
176
178
  return e.__e != t && (n.insertBefore(e.__e, t || null), t = e.__e), t && t.nextSibling;
177
179
  }
178
- function Oe(e, t, n, _) {
179
- var o = e.key, i = e.type, u = n - 1, l = n + 1, c = t[n];
180
+ function Ue(e, t, n, _) {
181
+ var o = e.key, i = e.type, l = n - 1, u = n + 1, c = t[n];
180
182
  if (c === null || c && o == c.key && i === c.type)
181
183
  return n;
182
184
  if (_ > (c != null && !(131072 & c.__u) ? 1 : 0))
183
- for (; u >= 0 || l < t.length; ) {
184
- if (u >= 0) {
185
- if ((c = t[u]) && !(131072 & c.__u) && o == c.key && i === c.type)
186
- return u;
187
- u--;
188
- }
189
- if (l < t.length) {
185
+ for (; l >= 0 || u < t.length; ) {
186
+ if (l >= 0) {
190
187
  if ((c = t[l]) && !(131072 & c.__u) && o == c.key && i === c.type)
191
188
  return l;
192
- l++;
189
+ l--;
190
+ }
191
+ if (u < t.length) {
192
+ if ((c = t[u]) && !(131072 & c.__u) && o == c.key && i === c.type)
193
+ return u;
194
+ u++;
193
195
  }
194
196
  }
195
197
  return -1;
196
198
  }
197
199
  function re(e, t, n) {
198
- t[0] === "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || Ne.test(t) ? n : n + "px";
200
+ t[0] === "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || Fe.test(t) ? n : n + "px";
199
201
  }
200
- function H(e, t, n, _, o) {
202
+ function V(e, t, n, _, o) {
201
203
  var i;
202
204
  e:
203
205
  if (t === "style")
@@ -237,43 +239,43 @@ function ie(e) {
237
239
  function se(e) {
238
240
  return this.l[e.type + !0](f.event ? f.event(e) : e);
239
241
  }
240
- function ee(e, t, n, _, o, i, u, l, c, s) {
241
- var p, r, d, a, v, k, y, h, g, C, T, D, ne, j, W, b = t.type;
242
+ function ee(e, t, n, _, o, i, l, u, c, s) {
243
+ var p, r, d, a, v, k, g, h, y, C, N, P, ne, j, W, b = t.type;
242
244
  if (t.constructor !== void 0)
243
245
  return null;
244
- 128 & n.__u && (c = !!(32 & n.__u), i = [l = t.__e = n.__e]), (p = f.__b) && p(t);
246
+ 128 & n.__u && (c = !!(32 & n.__u), i = [u = t.__e = n.__e]), (p = f.__b) && p(t);
245
247
  e:
246
248
  if (typeof b == "function")
247
249
  try {
248
- if (h = t.props, g = (p = b.contextType) && _[p.__c], C = p ? g ? g.props.value : p.__ : _, n.__c ? y = (r = t.__c = n.__c).__ = r.__E : ("prototype" in b && b.prototype.render ? t.__c = r = new b(h, C) : (t.__c = r = new I(h, C), r.constructor = b, r.render = Me), g && g.sub(r), r.props = h, r.state || (r.state = {}), r.context = C, r.__n = _, d = r.__d = !0, r.__h = [], r._sb = []), r.__s == null && (r.__s = r.state), b.getDerivedStateFromProps != null && (r.__s == r.state && (r.__s = x({}, r.__s)), x(r.__s, b.getDerivedStateFromProps(h, r.__s))), a = r.props, v = r.state, r.__v = t, d)
250
+ if (h = t.props, y = (p = b.contextType) && _[p.__c], C = p ? y ? y.props.value : p.__ : _, n.__c ? g = (r = t.__c = n.__c).__ = r.__E : ("prototype" in b && b.prototype.render ? t.__c = r = new b(h, C) : (t.__c = r = new O(h, C), r.constructor = b, r.render = Re), y && y.sub(r), r.props = h, r.state || (r.state = {}), r.context = C, r.__n = _, d = r.__d = !0, r.__h = [], r._sb = []), r.__s == null && (r.__s = r.state), b.getDerivedStateFromProps != null && (r.__s == r.state && (r.__s = x({}, r.__s)), x(r.__s, b.getDerivedStateFromProps(h, r.__s))), a = r.props, v = r.state, r.__v = t, d)
249
251
  b.getDerivedStateFromProps == null && r.componentWillMount != null && r.componentWillMount(), r.componentDidMount != null && r.__h.push(r.componentDidMount);
250
252
  else {
251
253
  if (b.getDerivedStateFromProps == null && h !== a && r.componentWillReceiveProps != null && r.componentWillReceiveProps(h, C), !r.__e && (r.shouldComponentUpdate != null && r.shouldComponentUpdate(h, r.__s, C) === !1 || t.__v === n.__v)) {
252
- for (t.__v !== n.__v && (r.props = h, r.state = r.__s, r.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.forEach(function(P) {
253
- P && (P.__ = t);
254
- }), T = 0; T < r._sb.length; T++)
255
- r.__h.push(r._sb[T]);
256
- r._sb = [], r.__h.length && u.push(r);
254
+ for (t.__v !== n.__v && (r.props = h, r.state = r.__s, r.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.forEach(function(H) {
255
+ H && (H.__ = t);
256
+ }), N = 0; N < r._sb.length; N++)
257
+ r.__h.push(r._sb[N]);
258
+ r._sb = [], r.__h.length && l.push(r);
257
259
  break e;
258
260
  }
259
261
  r.componentWillUpdate != null && r.componentWillUpdate(h, r.__s, C), r.componentDidUpdate != null && r.__h.push(function() {
260
262
  r.componentDidUpdate(a, v, k);
261
263
  });
262
264
  }
263
- if (r.context = C, r.props = h, r.__P = e, r.__e = !1, D = f.__r, ne = 0, "prototype" in b && b.prototype.render) {
264
- for (r.state = r.__s, r.__d = !1, D && D(t), p = r.render(r.props, r.state, r.context), j = 0; j < r._sb.length; j++)
265
+ if (r.context = C, r.props = h, r.__P = e, r.__e = !1, P = f.__r, ne = 0, "prototype" in b && b.prototype.render) {
266
+ for (r.state = r.__s, r.__d = !1, P && P(t), p = r.render(r.props, r.state, r.context), j = 0; j < r._sb.length; j++)
265
267
  r.__h.push(r._sb[j]);
266
268
  r._sb = [];
267
269
  } else
268
270
  do
269
- r.__d = !1, D && D(t), p = r.render(r.props, r.state, r.context), r.state = r.__s;
271
+ r.__d = !1, P && P(t), p = r.render(r.props, r.state, r.context), r.state = r.__s;
270
272
  while (r.__d && ++ne < 25);
271
- r.state = r.__s, r.getChildContext != null && (_ = x(x({}, _), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(a, v)), ke(e, q(W = p != null && p.type === R && p.key == null ? p.props.children : p) ? W : [W], t, n, _, o, i, u, l, c, s), r.base = t.__e, t.__u &= -161, r.__h.length && u.push(r), y && (r.__E = r.__ = null);
272
- } catch (P) {
273
- t.__v = null, c || i != null ? (t.__e = l, t.__u |= c ? 160 : 32, i[i.indexOf(l)] = null) : (t.__e = n.__e, t.__k = n.__k), f.__e(P, t, n);
273
+ r.state = r.__s, r.getChildContext != null && (_ = x(x({}, _), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(a, v)), ke(e, q(W = p != null && p.type === R && p.key == null ? p.props.children : p) ? W : [W], t, n, _, o, i, l, u, c, s), r.base = t.__e, t.__u &= -161, r.__h.length && l.push(r), g && (r.__E = r.__ = null);
274
+ } catch (H) {
275
+ t.__v = null, c || i != null ? (t.__e = u, t.__u |= c ? 160 : 32, i[i.indexOf(u)] = null) : (t.__e = n.__e, t.__k = n.__k), f.__e(H, t, n);
274
276
  }
275
277
  else
276
- i == null && t.__v === n.__v ? (t.__k = n.__k, t.__e = n.__e) : t.__e = Ue(n.__e, t, n, _, o, i, u, c, s);
278
+ i == null && t.__v === n.__v ? (t.__k = n.__k, t.__e = n.__e) : t.__e = Me(n.__e, t, n, _, o, i, l, c, s);
277
279
  (p = f.diffed) && p(t);
278
280
  }
279
281
  function xe(e, t, n) {
@@ -290,36 +292,36 @@ function xe(e, t, n) {
290
292
  }
291
293
  });
292
294
  }
293
- function Ue(e, t, n, _, o, i, u, l, c) {
294
- var s, p, r, d, a, v, k, y = n.props, h = t.props, g = t.type;
295
- if (g === "svg" && (o = !0), i != null) {
295
+ function Me(e, t, n, _, o, i, l, u, c) {
296
+ var s, p, r, d, a, v, k, g = n.props, h = t.props, y = t.type;
297
+ if (y === "svg" && (o = !0), i != null) {
296
298
  for (s = 0; s < i.length; s++)
297
- if ((a = i[s]) && "setAttribute" in a == !!g && (g ? a.localName === g : a.nodeType === 3)) {
299
+ if ((a = i[s]) && "setAttribute" in a == !!y && (y ? a.localName === y : a.nodeType === 3)) {
298
300
  e = a, i[s] = null;
299
301
  break;
300
302
  }
301
303
  }
302
304
  if (e == null) {
303
- if (g === null)
305
+ if (y === null)
304
306
  return document.createTextNode(h);
305
- e = o ? document.createElementNS("http://www.w3.org/2000/svg", g) : document.createElement(g, h.is && h), i = null, l = !1;
307
+ e = o ? document.createElementNS("http://www.w3.org/2000/svg", y) : document.createElement(y, h.is && h), i = null, u = !1;
306
308
  }
307
- if (g === null)
308
- y === h || l && e.data === h || (e.data = h);
309
+ if (y === null)
310
+ g === h || u && e.data === h || (e.data = h);
309
311
  else {
310
- if (i = i && A.call(e.childNodes), y = n.props || $, !l && i != null)
311
- for (y = {}, s = 0; s < e.attributes.length; s++)
312
- y[(a = e.attributes[s]).name] = a.value;
313
- for (s in y)
314
- a = y[s], s == "children" || (s == "dangerouslySetInnerHTML" ? r = a : s === "key" || s in h || H(e, s, null, a, o));
312
+ if (i = i && M.call(e.childNodes), g = n.props || $, !u && i != null)
313
+ for (g = {}, s = 0; s < e.attributes.length; s++)
314
+ g[(a = e.attributes[s]).name] = a.value;
315
+ for (s in g)
316
+ a = g[s], s == "children" || (s == "dangerouslySetInnerHTML" ? r = a : s === "key" || s in h || V(e, s, null, a, o));
315
317
  for (s in h)
316
- a = h[s], s == "children" ? d = a : s == "dangerouslySetInnerHTML" ? p = a : s == "value" ? v = a : s == "checked" ? k = a : s === "key" || l && typeof a != "function" || y[s] === a || H(e, s, a, y[s], o);
318
+ a = h[s], s == "children" ? d = a : s == "dangerouslySetInnerHTML" ? p = a : s == "value" ? v = a : s == "checked" ? k = a : s === "key" || u && typeof a != "function" || g[s] === a || V(e, s, a, g[s], o);
317
319
  if (p)
318
- l || r && (p.__html === r.__html || p.__html === e.innerHTML) || (e.innerHTML = p.__html), t.__k = [];
319
- else if (r && (e.innerHTML = ""), ke(e, q(d) ? d : [d], t, n, _, o && g !== "foreignObject", i, u, i ? i[0] : n.__k && w(n, 0), l, c), i != null)
320
+ u || r && (p.__html === r.__html || p.__html === e.innerHTML) || (e.innerHTML = p.__html), t.__k = [];
321
+ else if (r && (e.innerHTML = ""), ke(e, q(d) ? d : [d], t, n, _, o && y !== "foreignObject", i, l, i ? i[0] : n.__k && w(n, 0), u, c), i != null)
320
322
  for (s = i.length; s--; )
321
- i[s] != null && ge(i[s]);
322
- l || (s = "value", v !== void 0 && (v !== e[s] || g === "progress" && !v || g === "option" && v !== y[s]) && H(e, s, v, y[s], !1), s = "checked", k !== void 0 && k !== e[s] && H(e, s, k, y[s], !1));
323
+ i[s] != null && ye(i[s]);
324
+ u || (s = "value", v !== void 0 && (v !== e[s] || y === "progress" && !v || y === "option" && v !== g[s]) && V(e, s, v, g[s], !1), s = "checked", k !== void 0 && k !== e[s] && V(e, s, k, g[s], !1));
323
325
  }
324
326
  return e;
325
327
  }
@@ -344,49 +346,49 @@ function J(e, t, n) {
344
346
  if (_ = e.__k)
345
347
  for (o = 0; o < _.length; o++)
346
348
  _[o] && J(_[o], t, n || typeof e.type != "function");
347
- n || e.__e == null || ge(e.__e), e.__ = e.__e = e.__d = void 0;
349
+ n || e.__e == null || ye(e.__e), e.__ = e.__e = e.__d = void 0;
348
350
  }
349
- function Me(e, t, n) {
351
+ function Re(e, t, n) {
350
352
  return this.constructor(e, n);
351
353
  }
352
- function Ae(e, t, n) {
353
- var _, o, i, u;
354
- f.__ && f.__(e, t), o = (_ = typeof n == "function") ? null : n && n.__k || t.__k, i = [], u = [], ee(t, e = (!_ && n || t).__k = Le(R, null, [e]), o || $, $, t.ownerSVGElement !== void 0, !_ && n ? [n] : o ? null : t.firstChild ? A.call(t.childNodes) : null, i, !_ && n ? n : o ? o.__e : t.firstChild, _, u), xe(i, e, u);
354
+ function We(e, t, n) {
355
+ var _, o, i, l;
356
+ f.__ && f.__(e, t), o = (_ = typeof n == "function") ? null : n && n.__k || t.__k, i = [], l = [], ee(t, e = (!_ && n || t).__k = Le(R, null, [e]), o || $, $, t.ownerSVGElement !== void 0, !_ && n ? [n] : o ? null : t.firstChild ? M.call(t.childNodes) : null, i, !_ && n ? n : o ? o.__e : t.firstChild, _, l), xe(i, e, l);
355
357
  }
356
- A = ye.slice, f = { __e: function(e, t, n, _) {
357
- for (var o, i, u; t = t.__; )
358
+ M = ge.slice, f = { __e: function(e, t, n, _) {
359
+ for (var o, i, l; t = t.__; )
358
360
  if ((o = t.__c) && !o.__)
359
361
  try {
360
- if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(e)), u = o.__d), o.componentDidCatch != null && (o.componentDidCatch(e, _ || {}), u = o.__d), u)
362
+ if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(e)), l = o.__d), o.componentDidCatch != null && (o.componentDidCatch(e, _ || {}), l = o.__d), l)
361
363
  return o.__E = o;
362
- } catch (l) {
363
- e = l;
364
+ } catch (u) {
365
+ e = u;
364
366
  }
365
367
  throw e;
366
- } }, me = 0, I.prototype.setState = function(e, t) {
368
+ } }, me = 0, O.prototype.setState = function(e, t) {
367
369
  var n;
368
370
  n = this.__s != null && this.__s !== this.state ? this.__s : this.__s = x({}, this.state), typeof e == "function" && (e = e(x({}, n), this.props)), e && x(n, e), e != null && this.__v && (t && this._sb.push(t), oe(this));
369
- }, I.prototype.forceUpdate = function(e) {
371
+ }, O.prototype.forceUpdate = function(e) {
370
372
  this.__v && (this.__e = !0, e && this.__h.push(e), oe(this));
371
- }, I.prototype.render = R, S = [], ve = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, z = function(e, t) {
373
+ }, O.prototype.render = R, E = [], ve = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Z = function(e, t) {
372
374
  return e.__v.__b - t.__v.__b;
373
- }, O.__r = 0;
374
- var U, m, G, le, Y = 0, Se = [], N = [], ue = f.__b, ce = f.__r, ae = f.diffed, fe = f.__c, pe = f.unmount;
375
+ }, L.__r = 0;
376
+ var A, m, G, ue, Y = 0, Se = [], D = [], le = f.__b, ce = f.__r, ae = f.diffed, fe = f.__c, pe = f.unmount;
375
377
  function Ee(e, t) {
376
378
  f.__h && f.__h(m, e, Y || t), Y = 0;
377
379
  var n = m.__H || (m.__H = { __: [], __h: [] });
378
- return e >= n.__.length && n.__.push({ __V: N }), n.__[e];
380
+ return e >= n.__.length && n.__.push({ __V: D }), n.__[e];
379
381
  }
380
- function Re(e) {
381
- return Y = 1, We(we, e);
382
+ function Be(e) {
383
+ return Y = 1, Ge(we, e);
382
384
  }
383
- function We(e, t, n) {
384
- var _ = Ee(U++, 2);
385
- if (_.t = e, !_.__c && (_.__ = [n ? n(t) : we(void 0, t), function(l) {
386
- var c = _.__N ? _.__N[0] : _.__[0], s = _.t(c, l);
385
+ function Ge(e, t, n) {
386
+ var _ = Ee(A++, 2);
387
+ if (_.t = e, !_.__c && (_.__ = [n ? n(t) : we(void 0, t), function(u) {
388
+ var c = _.__N ? _.__N[0] : _.__[0], s = _.t(c, u);
387
389
  c !== s && (_.__N = [s, _.__[1]], _.__c.setState({}));
388
390
  }], _.__c = m, !m.u)) {
389
- var o = function(l, c, s) {
391
+ var o = function(u, c, s) {
390
392
  if (!_.__c.__H)
391
393
  return !0;
392
394
  var p = _.__c.__H.__.filter(function(d) {
@@ -395,58 +397,58 @@ function We(e, t, n) {
395
397
  if (p.every(function(d) {
396
398
  return !d.__N;
397
399
  }))
398
- return !i || i.call(this, l, c, s);
400
+ return !i || i.call(this, u, c, s);
399
401
  var r = !1;
400
402
  return p.forEach(function(d) {
401
403
  if (d.__N) {
402
404
  var a = d.__[0];
403
405
  d.__ = d.__N, d.__N = void 0, a !== d.__[0] && (r = !0);
404
406
  }
405
- }), !(!r && _.__c.props === l) && (!i || i.call(this, l, c, s));
407
+ }), !(!r && _.__c.props === u) && (!i || i.call(this, u, c, s));
406
408
  };
407
409
  m.u = !0;
408
- var i = m.shouldComponentUpdate, u = m.componentWillUpdate;
409
- m.componentWillUpdate = function(l, c, s) {
410
+ var i = m.shouldComponentUpdate, l = m.componentWillUpdate;
411
+ m.componentWillUpdate = function(u, c, s) {
410
412
  if (this.__e) {
411
413
  var p = i;
412
- i = void 0, o(l, c, s), i = p;
414
+ i = void 0, o(u, c, s), i = p;
413
415
  }
414
- u && u.call(this, l, c, s);
416
+ l && l.call(this, u, c, s);
415
417
  }, m.shouldComponentUpdate = o;
416
418
  }
417
419
  return _.__N || _.__;
418
420
  }
419
- function Be(e, t) {
420
- var n = Ee(U++, 3);
421
- !f.__s && Qe(n.__H, t) && (n.__ = e, n.i = t, m.__H.__h.push(n));
421
+ function Qe(e, t) {
422
+ var n = Ee(A++, 3);
423
+ !f.__s && Je(n.__H, t) && (n.__ = e, n.i = t, m.__H.__h.push(n));
422
424
  }
423
- function Ge() {
425
+ function ze() {
424
426
  for (var e; e = Se.shift(); )
425
427
  if (e.__P && e.__H)
426
428
  try {
427
- e.__H.__h.forEach(L), e.__H.__h.forEach(K), e.__H.__h = [];
429
+ e.__H.__h.forEach(T), e.__H.__h.forEach(K), e.__H.__h = [];
428
430
  } catch (t) {
429
431
  e.__H.__h = [], f.__e(t, e.__v);
430
432
  }
431
433
  }
432
434
  f.__b = function(e) {
433
- m = null, ue && ue(e);
435
+ m = null, le && le(e);
434
436
  }, f.__r = function(e) {
435
- ce && ce(e), U = 0;
437
+ ce && ce(e), A = 0;
436
438
  var t = (m = e.__c).__H;
437
439
  t && (G === m ? (t.__h = [], m.__h = [], t.__.forEach(function(n) {
438
- n.__N && (n.__ = n.__N), n.__V = N, n.__N = n.i = void 0;
439
- })) : (t.__h.forEach(L), t.__h.forEach(K), t.__h = [], U = 0)), G = m;
440
+ n.__N && (n.__ = n.__N), n.__V = D, n.__N = n.i = void 0;
441
+ })) : (t.__h.forEach(T), t.__h.forEach(K), t.__h = [], A = 0)), G = m;
440
442
  }, f.diffed = function(e) {
441
443
  ae && ae(e);
442
444
  var t = e.__c;
443
- t && t.__H && (t.__H.__h.length && (Se.push(t) !== 1 && le === f.requestAnimationFrame || ((le = f.requestAnimationFrame) || Ze)(Ge)), t.__H.__.forEach(function(n) {
444
- n.i && (n.__H = n.i), n.__V !== N && (n.__ = n.__V), n.i = void 0, n.__V = N;
445
+ t && t.__H && (t.__H.__h.length && (Se.push(t) !== 1 && ue === f.requestAnimationFrame || ((ue = f.requestAnimationFrame) || Ze)(ze)), t.__H.__.forEach(function(n) {
446
+ n.i && (n.__H = n.i), n.__V !== D && (n.__ = n.__V), n.i = void 0, n.__V = D;
445
447
  })), G = m = null;
446
448
  }, f.__c = function(e, t) {
447
449
  t.some(function(n) {
448
450
  try {
449
- n.__h.forEach(L), n.__h = n.__h.filter(function(_) {
451
+ n.__h.forEach(T), n.__h = n.__h.filter(function(_) {
450
452
  return !_.__ || K(_);
451
453
  });
452
454
  } catch (_) {
@@ -460,7 +462,7 @@ f.__b = function(e) {
460
462
  var t, n = e.__c;
461
463
  n && n.__H && (n.__H.__.forEach(function(_) {
462
464
  try {
463
- L(_);
465
+ T(_);
464
466
  } catch (o) {
465
467
  t = o;
466
468
  }
@@ -473,7 +475,7 @@ function Ze(e) {
473
475
  }, _ = setTimeout(n, 100);
474
476
  de && (t = requestAnimationFrame(n));
475
477
  }
476
- function L(e) {
478
+ function T(e) {
477
479
  var t = m, n = e.__c;
478
480
  typeof n == "function" && (e.__c = void 0, n()), m = t;
479
481
  }
@@ -481,7 +483,7 @@ function K(e) {
481
483
  var t = m;
482
484
  e.__c = e.__(), m = t;
483
485
  }
484
- function Qe(e, t) {
486
+ function Je(e, t) {
485
487
  return !e || e.length !== t.length || t.some(function(n, _) {
486
488
  return n !== e[_];
487
489
  });
@@ -489,18 +491,18 @@ function Qe(e, t) {
489
491
  function we(e, t) {
490
492
  return typeof t == "function" ? t(e) : t;
491
493
  }
492
- var ze = 0;
493
- function De(e, t, n, _, o, i) {
494
- var u, l, c = {};
495
- for (l in t)
496
- l == "ref" ? u = t[l] : c[l] = t[l];
497
- var s = { type: e, props: c, key: n, ref: u, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --ze, __i: -1, __u: 0, __source: o, __self: i };
498
- if (typeof e == "function" && (u = e.defaultProps))
499
- for (l in u)
500
- c[l] === void 0 && (c[l] = u[l]);
494
+ var Ye = 0;
495
+ function Pe(e, t, n, _, o, i) {
496
+ var l, u, c = {};
497
+ for (u in t)
498
+ u == "ref" ? l = t[u] : c[u] = t[u];
499
+ var s = { type: e, props: c, key: n, ref: l, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --Ye, __i: -1, __u: 0, __source: o, __self: i };
500
+ if (typeof e == "function" && (l = e.defaultProps))
501
+ for (u in l)
502
+ c[u] === void 0 && (c[u] = l[u]);
501
503
  return f.vnode && f.vnode(s), s;
502
504
  }
503
- class Je {
505
+ class Ke {
504
506
  constructor() {
505
507
  B(this, "_context");
506
508
  B(this, "_getContextCallbacks", []);
@@ -529,33 +531,33 @@ class Je {
529
531
  console.log("Navigating to customer portal");
530
532
  }
531
533
  }
532
- let M;
533
- const Ye = ({
534
+ let U;
535
+ const Xe = ({
534
536
  context: e
535
537
  }) => {
536
- const [t, n] = Re(null);
537
- return Be(() => {
538
+ const [t, n] = Be(null);
539
+ return Qe(() => {
538
540
  if (t) {
539
- if (M === void 0)
541
+ if (U === void 0)
540
542
  throw new Error("Please call setSpiffDevOptions before requesting the context.");
541
- M.setContext({
543
+ U.setContext({
542
544
  ...e,
543
545
  container: t
544
546
  });
545
547
  }
546
- }, [t, e]), De("div", {
548
+ }, [t, e]), Pe("div", {
547
549
  ref: n,
548
550
  id: "spiffThemeWrapper"
549
551
  });
550
552
  };
551
- function gt(e, t) {
552
- M = new Je(), window.SpiffThemeLoader = M;
553
+ function kt(e, t) {
554
+ U = new Ke(), window.SpiffThemeLoader = U;
553
555
  let n;
554
- typeof e == "string" ? n = document.getElementById(e) : n = e, Ae(De(Ye, {
556
+ typeof e == "string" ? n = document.getElementById(e) : n = e, We(Pe(Xe, {
555
557
  context: t
556
558
  }), n);
557
559
  }
558
- function bt(e) {
560
+ function Ct(e) {
559
561
  return {
560
562
  id: "example",
561
563
  themeInstallId: (e == null ? void 0 : e.themeInstallId) ?? "example",
@@ -584,30 +586,30 @@ function bt(e) {
584
586
  ...e
585
587
  };
586
588
  }
587
- const Ke = (e) => {
589
+ const qe = (e) => {
588
590
  if (Object.keys(e).includes("defaultValue"))
589
591
  return e.defaultValue;
590
592
  };
591
- function kt(e, ...t) {
593
+ function xt(e, ...t) {
592
594
  return e.fields.filter((n) => !n.key || !t.includes(n.key)).map((n) => ({
593
595
  key: n.key,
594
596
  fallbackToDefaultConfiguration: !1,
595
- value: Ke(n),
597
+ value: qe(n),
596
598
  type: n.type,
597
599
  asset: void 0
598
600
  }));
599
601
  }
600
- const Xe = "@spiffcommerce/theme-bridge", qe = "1.17.4", et = "module", tt = {
602
+ const et = "@spiffcommerce/theme-bridge", tt = "1.18.0", nt = "module", _t = {
601
603
  build: "tsc && vite build",
602
604
  preview: "vite preview",
603
605
  dev: "ladle serve",
604
606
  schema: "node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"
605
- }, nt = "./dist/index.umd.cjs", _t = "./dist/index.js", ot = "./dist/index.d.ts", rt = [
607
+ }, ot = "./dist/index.umd.cjs", rt = "./dist/index.js", it = "./dist/index.d.ts", st = [
606
608
  "./dist"
607
- ], it = {
609
+ ], ut = {
608
610
  import: "./dist/index.js",
609
611
  require: "./dist/index.umd.cjs"
610
- }, st = {}, lt = {
612
+ }, lt = {}, ct = {
611
613
  "@ladle/react": "^4.0.2",
612
614
  "@preact/preset-vite": "^2.7.0",
613
615
  "@spiffcommerce/core": "^21.0.1",
@@ -627,42 +629,42 @@ const Xe = "@spiffcommerce/theme-bridge", qe = "1.17.4", et = "module", tt = {
627
629
  vite: "^5.0.8",
628
630
  "vite-plugin-css-injected-by-js": "^3.4.0",
629
631
  "vite-plugin-externalize-deps": "^0.8.0"
630
- }, ut = {
632
+ }, at = {
631
633
  "@spiffcommerce/core": "^21.0.1"
632
- }, ct = {
633
- name: Xe,
634
- version: qe,
635
- type: et,
636
- scripts: tt,
637
- main: nt,
638
- module: _t,
639
- types: ot,
640
- files: rt,
641
- exports: it,
642
- dependencies: st,
643
- devDependencies: lt,
644
- peerDependencies: ut
634
+ }, ft = {
635
+ name: et,
636
+ version: tt,
637
+ type: nt,
638
+ scripts: _t,
639
+ main: ot,
640
+ module: rt,
641
+ types: it,
642
+ files: st,
643
+ exports: ut,
644
+ dependencies: lt,
645
+ devDependencies: ct,
646
+ peerDependencies: at
645
647
  };
646
- function at(e, t, n) {
648
+ function pt(e, t, n) {
647
649
  if (t.type === "chunk") {
648
650
  if (console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`), !t.isEntry && !n)
649
651
  return null;
650
652
  if (!t.isDynamicEntry)
651
653
  return {
652
- type: Z.Javascript,
654
+ type: Q.Javascript,
653
655
  mimeType: "text/javascript",
654
656
  preload: !t.isEntry,
655
657
  filename: e
656
658
  };
657
659
  } else if (e.endsWith(".css"))
658
660
  return {
659
- type: Z.CSS,
661
+ type: Q.CSS,
660
662
  mimeType: "text/css",
661
663
  filename: e
662
664
  };
663
665
  return null;
664
666
  }
665
- function Ct(e) {
667
+ function St(e) {
666
668
  const {
667
669
  autoGenerateTargetFiles: t = !0,
668
670
  configurationSchema: n,
@@ -671,35 +673,37 @@ function Ct(e) {
671
673
  } = e ?? {};
672
674
  return {
673
675
  name: "spiff-theme-plugin",
674
- version: ct.version,
675
- config(i, u) {
676
+ version: ft.version,
677
+ config(i, l) {
676
678
  i.base !== void 0 && i.base !== "" && console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'), i.base = "";
677
679
  },
678
- writeBundle(i, u) {
679
- const l = t ? Object.keys(u).map((s) => o != null && o.some((p) => p.filename === s) ? null : at(s, u[s], _)).filter((s) => s !== null) : [];
680
- o && l.push(...o);
680
+ writeBundle(i, l) {
681
+ const u = t ? Object.keys(l).map((s) => o != null && o.some((p) => p.filename === s) ? null : pt(s, l[s], _)).filter((s) => s !== null) : [];
682
+ o && u.push(...o);
681
683
  const c = {
682
684
  launchData: {
683
- targetFiles: l
685
+ targetFiles: u
684
686
  },
685
687
  configurationSchema: n
686
688
  };
687
- je.writeFileSync(Pe.join(i.dir, "spiffTheme.json"), JSON.stringify(c, void 0, 4));
689
+ je.writeFileSync(He.join(i.dir, "spiffTheme.json"), JSON.stringify(c, void 0, 4));
688
690
  }
689
691
  };
690
692
  }
691
693
  export {
692
- He as AssetType,
693
- Ve as CustomSchemaType,
694
- E as FieldType,
695
- Z as ThemeFileType,
696
- bt as exampleThemeInstallConfig,
697
- kt as getDefaultsForSchema,
698
- gt as setSpiffDevOptions,
699
- Ct as spiffThemePlugin,
700
- ht as themeInstallConfigurationFieldsToRecordObject,
701
- yt as themeInstallConfigurationGraphQlToResource,
702
- mt as themeInstallConfigurationToRecordObject,
703
- Ie as themeVersionConfigurationGraphQlToResource,
704
- vt as themeVersionGraphQlToResource
694
+ Ve as AssetType,
695
+ De as ConversionDataType,
696
+ Oe as ConversionLocation,
697
+ Ie as CustomSchemaType,
698
+ S as FieldType,
699
+ Q as ThemeFileType,
700
+ Ct as exampleThemeInstallConfig,
701
+ xt as getDefaultsForSchema,
702
+ kt as setSpiffDevOptions,
703
+ St as spiffThemePlugin,
704
+ vt as themeInstallConfigurationFieldsToRecordObject,
705
+ bt as themeInstallConfigurationGraphQlToResource,
706
+ gt as themeInstallConfigurationToRecordObject,
707
+ Te as themeVersionConfigurationGraphQlToResource,
708
+ yt as themeVersionGraphQlToResource
705
709
  };
@@ -1,2 +1,2 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("#spiffThemeWrapper{width:100%;height:100%}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- (function(d,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(d=typeof globalThis<"u"?globalThis:d||self,k(d.theme={},d.fs,d.path))})(this,function(d,k,x){"use strict";var st=Object.defineProperty;var lt=(d,k,x)=>k in d?st(d,k,{enumerable:!0,configurable:!0,writable:!0,value:x}):d[k]=x;var _e=(d,k,x)=>(lt(d,typeof k!="symbol"?k+"":k,x),x);var V=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(V||{}),w=(e=>(e.Asset="Asset",e.Boolean="Boolean",e.Color="Color",e.Heading="Heading",e.List="List",e.Number="Number",e.Object="Object",e.Select="Select",e.Text="Text",e))(w||{}),re=(e=>(e.Color="Color",e.ColorProfile="ColorProfile",e.Data="Data",e.Environment="Environment",e.Font="Font",e.Frame="Frame",e.Illustration="Illustration",e.Image="Image",e.Material="Material",e.Model="Model",e.Video="Video",e))(re||{}),ie=(e=>(e.Object="Object",e.Union="Union",e))(ie||{});function Z(e){return Object.assign({},...e.map(t=>{if(t.key)return{[t.key]:se(t)}}))}function se(e){if(e.type===w.Asset)return e.asset;if(e.type!==w.List&&e.type!==w.Object){if(e.value===void 0)return;if(e.type===w.Number)try{return Number.parseFloat(e.value)}catch{return}else if(e.type===w.Boolean)return e.value==="true";return e.value}if(e.listValues)return e.listValues.map(se);if(e.objectValues)return{...Z(e.objectValues),schema:e.schema??void 0}}function He(e){return Z(e)}function Ne(e){return Z(e.fields)}function I(e,t){const n={...e,items:void 0,fields:void 0};return e.items!==void 0&&(n.items=I(t[e.items],t)),e.fields!==void 0&&(n.fields=e.fields.map(o=>I(t[o],t))),n}function le(e){var o;const t={...e,fields:[],customSchemas:(o=e.customSchemas)==null?void 0:o.map(_=>{var i;return{..._,fields:(i=_.fields)==null?void 0:i.map(u=>I(e.fields[u],e.fields))}})},n=[];if(e.fields.forEach(_=>{_.root&&n.push(I(_,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeVersionConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeConfigurationSchemaField");return t.fields=n,t}function Fe(e){return{...e,configurationSchema:le(e.configurationSchema)}}function z(e,t){const n={...e,listValues:void 0,objectValues:void 0};return e.listValues!==void 0&&(n.listValues=e.listValues.map(o=>z(t[o],t))),e.objectValues!==void 0&&(n.objectValues=e.objectValues.map(o=>z(t[o],t))),n}function Oe(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(o=>{o.root&&n.push(z(o,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeInstallConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeInstallConfigurationField");return t.fields=n,t}var H,f,ue,D,ce,ae,J,$={},fe=[],Le=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Y=Array.isArray;function T(e,t){for(var n in t)e[n]=t[n];return e}function pe(e){var t=e.parentNode;t&&t.removeChild(e)}function Re(e,t,n){var o,_,i,u={};for(i in t)i=="key"?o=t[i]:i=="ref"?_=t[i]:u[i]=t[i];if(arguments.length>2&&(u.children=arguments.length>3?H.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)u[i]===void 0&&(u[i]=e.defaultProps[i]);return N(e,u,o,_,null)}function N(e,t,n,o,_){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:_??++ue,__i:-1,__u:0};return _==null&&f.vnode!=null&&f.vnode(i),i}function F(e){return e.children}function O(e,t){this.props=e,this.context=t}function j(e,t){if(t==null)return e.__?j(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?j(e):null}function de(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return de(e)}}function he(e){(!e.__d&&(e.__d=!0)&&D.push(e)&&!L.__r++||ce!==f.debounceRendering)&&((ce=f.debounceRendering)||ae)(L)}function L(){var e,t,n,o,_,i,u,l,c;for(D.sort(J);e=D.shift();)e.__d&&(t=D.length,o=void 0,i=(_=(n=e).__v).__e,l=[],c=[],(u=n.__P)&&((o=T({},_)).__v=_.__v+1,f.vnode&&f.vnode(o),K(u,o,_,n.__n,u.ownerSVGElement!==void 0,32&_.__u?[i]:null,l,i??j(_),!!(32&_.__u),c),o.__.__k[o.__i]=o,ke(l,o,c),o.__e!=i&&de(o)),D.length>t&&D.sort(J));L.__r=0}function me(e,t,n,o,_,i,u,l,c,s,p){var r,h,a,y,S,g=o&&o.__k||fe,m=t.length;for(n.__d=c,Ue(n,t,g),c=n.__d,r=0;r<m;r++)(a=n.__k[r])!=null&&typeof a!="boolean"&&typeof a!="function"&&(h=a.__i===-1?$:g[a.__i]||$,a.__i=r,K(e,a,h,_,i,u,l,c,s,p),y=a.__e,a.ref&&h.ref!=a.ref&&(h.ref&&X(h.ref,null,a),p.push(a.ref,a.__c||y,a)),S==null&&y!=null&&(S=y),65536&a.__u||h.__k===a.__k?c=ve(a,c,e):typeof a.type=="function"&&a.__d!==void 0?c=a.__d:y&&(c=y.nextSibling),a.__d=void 0,a.__u&=-196609);n.__d=c,n.__e=S}function Ue(e,t,n){var o,_,i,u,l,c=t.length,s=n.length,p=s,r=0;for(e.__k=[],o=0;o<c;o++)(_=e.__k[o]=(_=t[o])==null||typeof _=="boolean"||typeof _=="function"?null:typeof _=="string"||typeof _=="number"||typeof _=="bigint"||_.constructor==String?N(null,_,null,null,_):Y(_)?N(F,{children:_},null,null,null):_.constructor===void 0&&_.__b>0?N(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_)!=null?(_.__=e,_.__b=e.__b+1,l=Me(_,n,u=o+r,p),_.__i=l,i=null,l!==-1&&(p--,(i=n[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&r--,typeof _.type!="function"&&(_.__u|=65536)):l!==u&&(l===u+1?r++:l>u?p>c-u?r+=l-u:r--:r=l<u&&l==u-1?l-u:0,l!==o+r&&(_.__u|=65536))):(i=n[o])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=j(i)),q(i,i,!1),n[o]=null,p--);if(p)for(o=0;o<s;o++)(i=n[o])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=j(i)),q(i,i))}function ve(e,t,n){var o,_;if(typeof e.type=="function"){for(o=e.__k,_=0;o&&_<o.length;_++)o[_]&&(o[_].__=e,t=ve(o[_],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Me(e,t,n,o){var _=e.key,i=e.type,u=n-1,l=n+1,c=t[n];if(c===null||c&&_==c.key&&i===c.type)return n;if(o>(c!=null&&!(131072&c.__u)?1:0))for(;u>=0||l<t.length;){if(u>=0){if((c=t[u])&&!(131072&c.__u)&&_==c.key&&i===c.type)return u;u--}if(l<t.length){if((c=t[l])&&!(131072&c.__u)&&_==c.key&&i===c.type)return l;l++}}return-1}function ye(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Le.test(t)?n:n+"px"}function R(e,t,n,o,_){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||ye(e.style,t,"");if(n)for(t in n)o&&n[t]===o[t]||ye(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n.u=o.u:(n.u=Date.now(),e.addEventListener(t,i?be:ge,i)):e.removeEventListener(t,i?be:ge,i);else{if(_)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function ge(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(f.event?f.event(e):e)}function be(e){return this.l[e.type+!0](f.event?f.event(e):e)}function K(e,t,n,o,_,i,u,l,c,s){var p,r,h,a,y,S,g,m,b,E,G,P,Ie,B,oe,C=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),i=[l=t.__e=n.__e]),(p=f.__b)&&p(t);e:if(typeof C=="function")try{if(m=t.props,b=(p=C.contextType)&&o[p.__c],E=p?b?b.props.value:p.__:o,n.__c?g=(r=t.__c=n.__c).__=r.__E:("prototype"in C&&C.prototype.render?t.__c=r=new C(m,E):(t.__c=r=new O(m,E),r.constructor=C,r.render=We),b&&b.sub(r),r.props=m,r.state||(r.state={}),r.context=E,r.__n=o,h=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),C.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=T({},r.__s)),T(r.__s,C.getDerivedStateFromProps(m,r.__s))),a=r.props,y=r.state,r.__v=t,h)C.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(C.getDerivedStateFromProps==null&&m!==a&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(m,E),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(m,r.__s,E)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(r.props=m,r.state=r.__s,r.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(Q){Q&&(Q.__=t)}),G=0;G<r._sb.length;G++)r.__h.push(r._sb[G]);r._sb=[],r.__h.length&&u.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(m,r.__s,E),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(a,y,S)})}if(r.context=E,r.props=m,r.__P=e,r.__e=!1,P=f.__r,Ie=0,"prototype"in C&&C.prototype.render){for(r.state=r.__s,r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),B=0;B<r._sb.length;B++)r.__h.push(r._sb[B]);r._sb=[]}else do r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++Ie<25);r.state=r.__s,r.getChildContext!=null&&(o=T(T({},o),r.getChildContext())),h||r.getSnapshotBeforeUpdate==null||(S=r.getSnapshotBeforeUpdate(a,y)),me(e,Y(oe=p!=null&&p.type===F&&p.key==null?p.props.children:p)?oe:[oe],t,n,o,_,i,u,l,c,s),r.base=t.__e,t.__u&=-161,r.__h.length&&u.push(r),g&&(r.__E=r.__=null)}catch(Q){t.__v=null,c||i!=null?(t.__e=l,t.__u|=c?160:32,i[i.indexOf(l)]=null):(t.__e=n.__e,t.__k=n.__k),f.__e(Q,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Ae(n.__e,t,n,o,_,i,u,c,s);(p=f.diffed)&&p(t)}function ke(e,t,n){t.__d=void 0;for(var o=0;o<n.length;o++)X(n[o],n[++o],n[++o]);f.__c&&f.__c(t,e),e.some(function(_){try{e=_.__h,_.__h=[],e.some(function(i){i.call(_)})}catch(i){f.__e(i,_.__v)}})}function Ae(e,t,n,o,_,i,u,l,c){var s,p,r,h,a,y,S,g=n.props,m=t.props,b=t.type;if(b==="svg"&&(_=!0),i!=null){for(s=0;s<i.length;s++)if((a=i[s])&&"setAttribute"in a==!!b&&(b?a.localName===b:a.nodeType===3)){e=a,i[s]=null;break}}if(e==null){if(b===null)return document.createTextNode(m);e=_?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,m.is&&m),i=null,l=!1}if(b===null)g===m||l&&e.data===m||(e.data=m);else{if(i=i&&H.call(e.childNodes),g=n.props||$,!l&&i!=null)for(g={},s=0;s<e.attributes.length;s++)g[(a=e.attributes[s]).name]=a.value;for(s in g)a=g[s],s=="children"||(s=="dangerouslySetInnerHTML"?r=a:s==="key"||s in m||R(e,s,null,a,_));for(s in m)a=m[s],s=="children"?h=a:s=="dangerouslySetInnerHTML"?p=a:s=="value"?y=a:s=="checked"?S=a:s==="key"||l&&typeof a!="function"||g[s]===a||R(e,s,a,g[s],_);if(p)l||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(r&&(e.innerHTML=""),me(e,Y(h)?h:[h],t,n,o,_&&b!=="foreignObject",i,u,i?i[0]:n.__k&&j(n,0),l,c),i!=null)for(s=i.length;s--;)i[s]!=null&&pe(i[s]);l||(s="value",y!==void 0&&(y!==e[s]||b==="progress"&&!y||b==="option"&&y!==g[s])&&R(e,s,y,g[s],!1),s="checked",S!==void 0&&S!==e[s]&&R(e,s,S,g[s],!1))}return e}function X(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(o){f.__e(o,n)}}function q(e,t,n){var o,_;if(f.unmount&&f.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||X(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(i){f.__e(i,t)}o.base=o.__P=null,e.__c=void 0}if(o=e.__k)for(_=0;_<o.length;_++)o[_]&&q(o[_],t,n||typeof e.type!="function");n||e.__e==null||pe(e.__e),e.__=e.__e=e.__d=void 0}function We(e,t,n){return this.constructor(e,n)}function Ge(e,t,n){var o,_,i,u;f.__&&f.__(e,t),_=(o=typeof n=="function")?null:n&&n.__k||t.__k,i=[],u=[],K(t,e=(!o&&n||t).__k=Re(F,null,[e]),_||$,$,t.ownerSVGElement!==void 0,!o&&n?[n]:_?null:t.firstChild?H.call(t.childNodes):null,i,!o&&n?n:_?_.__e:t.firstChild,o,u),ke(i,e,u)}H=fe.slice,f={__e:function(e,t,n,o){for(var _,i,u;t=t.__;)if((_=t.__c)&&!_.__)try{if((i=_.constructor)&&i.getDerivedStateFromError!=null&&(_.setState(i.getDerivedStateFromError(e)),u=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(e,o||{}),u=_.__d),u)return _.__E=_}catch(l){e=l}throw e}},ue=0,O.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=T({},this.state),typeof e=="function"&&(e=e(T({},n),this.props)),e&&T(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),he(this))},O.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),he(this))},O.prototype.render=F,D=[],ae=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,J=function(e,t){return e.__v.__b-t.__v.__b},L.__r=0;var U,v,ee,Ce,te=0,Se=[],M=[],Te=f.__b,Ee=f.__r,xe=f.diffed,we=f.__c,De=f.unmount;function je(e,t){f.__h&&f.__h(v,e,te||t),te=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:M}),n.__[e]}function Be(e){return te=1,Qe(Pe,e)}function Qe(e,t,n){var o=je(U++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Pe(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],s=o.t(c,l);c!==s&&(o.__N=[s,o.__[1]],o.__c.setState({}))}],o.__c=v,!v.u)){var _=function(l,c,s){if(!o.__c.__H)return!0;var p=o.__c.__H.__.filter(function(h){return h.__c});if(p.every(function(h){return!h.__N}))return!i||i.call(this,l,c,s);var r=!1;return p.forEach(function(h){if(h.__N){var a=h.__[0];h.__=h.__N,h.__N=void 0,a!==h.__[0]&&(r=!0)}}),!(!r&&o.__c.props===l)&&(!i||i.call(this,l,c,s))};v.u=!0;var i=v.shouldComponentUpdate,u=v.componentWillUpdate;v.componentWillUpdate=function(l,c,s){if(this.__e){var p=i;i=void 0,_(l,c,s),i=p}u&&u.call(this,l,c,s)},v.shouldComponentUpdate=_}return o.__N||o.__}function Ze(e,t){var n=je(U++,3);!f.__s&&Ye(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function ze(){for(var e;e=Se.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(A),e.__H.__h.forEach(ne),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){v=null,Te&&Te(e)},f.__r=function(e){Ee&&Ee(e),U=0;var t=(v=e.__c).__H;t&&(ee===v?(t.__h=[],v.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=M,n.__N=n.i=void 0})):(t.__h.forEach(A),t.__h.forEach(ne),t.__h=[],U=0)),ee=v},f.diffed=function(e){xe&&xe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Se.push(t)!==1&&Ce===f.requestAnimationFrame||((Ce=f.requestAnimationFrame)||Je)(ze)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==M&&(n.__=n.__V),n.i=void 0,n.__V=M})),ee=v=null},f.__c=function(e,t){t.some(function(n){try{n.__h.forEach(A),n.__h=n.__h.filter(function(o){return!o.__||ne(o)})}catch(o){t.some(function(_){_.__h&&(_.__h=[])}),t=[],f.__e(o,n.__v)}}),we&&we(e,t)},f.unmount=function(e){De&&De(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(o){try{A(o)}catch(_){t=_}}),n.__H=void 0,t&&f.__e(t,n.__v))};var $e=typeof requestAnimationFrame=="function";function Je(e){var t,n=function(){clearTimeout(o),$e&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,100);$e&&(t=requestAnimationFrame(n))}function A(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function ne(e){var t=v;e.__c=e.__(),v=t}function Ye(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Pe(e,t){return typeof t=="function"?t(e):t}var Ke=0;function Ve(e,t,n,o,_,i){var u,l,c={};for(l in t)l=="ref"?u=t[l]:c[l]=t[l];var s={type:e,props:c,key:n,ref:u,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Ke,__i:-1,__u:0,__source:_,__self:i};if(typeof e=="function"&&(u=e.defaultProps))for(l in u)c[l]===void 0&&(c[l]=u[l]);return f.vnode&&f.vnode(s),s}class Xe{constructor(){_e(this,"_context");_e(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(t=>{this._getContextCallbacks.push(t)})}setContext(t){this._context=t,this._getContextCallbacks.forEach(n=>n(t)),this._getContextCallbacks=[]}configureClient(t){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(t){console.log("Add to cart",t)}navigateToCustomerPortal(){console.log("Navigating to customer portal")}}let W;const qe=({context:e})=>{const[t,n]=Be(null);return Ze(()=>{if(t){if(W===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");W.setContext({...e,container:t})}},[t,e]),Ve("div",{ref:n,id:"spiffThemeWrapper"})};function et(e,t){W=new Xe,window.SpiffThemeLoader=W;let n;typeof e=="string"?n=document.getElementById(e):n=e,Ge(Ve(qe,{context:t}),n)}function tt(e){return{id:"example",themeInstallId:(e==null?void 0:e.themeInstallId)??"example",name:"Example Configuration",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",themeVersion:{id:"example",version:"1.0.0",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",configurationSchema:{fields:[]},launchData:{targetFiles:[]},theme:{id:"example",name:"Example Theme",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z"}},fields:[],...e}}const nt=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function ot(e,...t){return e.fields.filter(n=>!n.key||!t.includes(n.key)).map(n=>({key:n.key,fallbackToDefaultConfiguration:!1,value:nt(n),type:n.type,asset:void 0}))}const _t={name:"@spiffcommerce/theme-bridge",version:"1.17.4",type:"module",scripts:{build:"tsc && vite build",preview:"vite preview",dev:"ladle serve",schema:"node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"},main:"./dist/index.umd.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",files:["./dist"],exports:{import:"./dist/index.js",require:"./dist/index.umd.cjs"},dependencies:{},devDependencies:{"@ladle/react":"^4.0.2","@preact/preset-vite":"^2.7.0","@spiffcommerce/core":"^21.0.1","@types/node":"^20.11.16","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3",preact:"^10.19.3",prettier:"^3.2.4",rollup:"^4.12.0","ts-json-schema-generator":"^1.5.0","ts-node":"^10.9.2",tsup:"^8.0.1",typescript:"^5.2.2",vite:"^5.0.8","vite-plugin-css-injected-by-js":"^3.4.0","vite-plugin-externalize-deps":"^0.8.0"},peerDependencies:{"@spiffcommerce/core":"^21.0.1"}};function rt(e,t,n){if(t.type==="chunk"){if(console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`),!t.isEntry&&!n)return null;if(!t.isDynamicEntry)return{type:V.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:V.CSS,mimeType:"text/css",filename:e};return null}function it(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:n,includePreloadChunks:o=!1,targetFiles:_}=e??{};return{name:"spiff-theme-plugin",version:_t.version,config(i,u){i.base!==void 0&&i.base!==""&&console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'),i.base=""},writeBundle(i,u){const l=t?Object.keys(u).map(s=>_!=null&&_.some(p=>p.filename===s)?null:rt(s,u[s],o)).filter(s=>s!==null):[];_&&l.push(..._);const c={launchData:{targetFiles:l},configurationSchema:n};k.writeFileSync(x.join(i.dir,"spiffTheme.json"),JSON.stringify(c,void 0,4))}}}d.AssetType=re,d.CustomSchemaType=ie,d.FieldType=w,d.ThemeFileType=V,d.exampleThemeInstallConfig=tt,d.getDefaultsForSchema=ot,d.setSpiffDevOptions=et,d.spiffThemePlugin=it,d.themeInstallConfigurationFieldsToRecordObject=He,d.themeInstallConfigurationGraphQlToResource=Oe,d.themeInstallConfigurationToRecordObject=Ne,d.themeVersionConfigurationGraphQlToResource=le,d.themeVersionGraphQlToResource=Fe,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
2
+ (function(d,C){typeof exports=="object"&&typeof module<"u"?C(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],C):(d=typeof globalThis<"u"?globalThis:d||self,C(d.theme={},d.fs,d.path))})(this,function(d,C,P){"use strict";var lt=Object.defineProperty;var at=(d,C,P)=>C in d?lt(d,C,{enumerable:!0,configurable:!0,writable:!0,value:P}):d[C]=P;var _e=(d,C,P)=>(at(d,typeof C!="symbol"?C+"":C,P),P);var V=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(V||{}),E=(e=>(e.Asset="Asset",e.Boolean="Boolean",e.Color="Color",e.ConversionConfiguration="ConversionConfiguration",e.Heading="Heading",e.List="List",e.Number="Number",e.Object="Object",e.Select="Select",e.Text="Text",e))(E||{}),re=(e=>(e.Color="Color",e.ColorProfile="ColorProfile",e.Data="Data",e.Environment="Environment",e.Font="Font",e.Frame="Frame",e.Illustration="Illustration",e.Image="Image",e.Material="Material",e.Model="Model",e.Video="Video",e))(re||{}),ie=(e=>(e.Object="Object",e.Union="Union",e))(ie||{}),se=(e=>(e.Manual="Manual",e.OnStart="OnStart",e.OnQuit="OnQuit",e.OnEnd="OnEnd",e))(se||{}),ue=(e=>(e.Email="Email",e.FirstName="FirstName",e.LastName="LastName",e.Phone="Phone",e.Apartment="Apartment",e.City="City",e.Country="Country",e.OrganizationName="OrganizationName",e.PostCode="PostCode",e.State="State",e.StreetAddress="StreetAddress",e))(ue||{});function z(e){return Object.assign({},...e.map(t=>{if(t.key)return{[t.key]:le(t)}}))}function le(e){if(e.type===E.Asset)return e.asset;if(e.type===E.ConversionConfiguration)return e.conversionConfiguration;if(e.type!==E.List&&e.type!==E.Object){if(e.value===void 0)return;if(e.type===E.Number)try{return Number.parseFloat(e.value)}catch{return}else if(e.type===E.Boolean)return e.value==="true";return e.value}if(e.listValues)return e.listValues.map(le);if(e.objectValues)return{...z(e.objectValues),schema:e.schema??void 0}}function De(e){return z(e)}function Fe(e){return z(e.fields)}function I(e,t){const n={...e,items:void 0,fields:void 0};return e.items!==void 0&&(n.items=I(t[e.items],t)),e.fields!==void 0&&(n.fields=e.fields.map(o=>I(t[o],t))),n}function ae(e){var o;const t={...e,fields:[],customSchemas:(o=e.customSchemas)==null?void 0:o.map(_=>{var i;return{..._,fields:(i=_.fields)==null?void 0:i.map(l=>I(e.fields[l],e.fields))}})},n=[];if(e.fields.forEach(_=>{_.root&&n.push(I(_,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeVersionConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeConfigurationSchemaField");return t.fields=n,t}function Le(e){return{...e,configurationSchema:ae(e.configurationSchema)}}function Z(e,t){const n={...e,listValues:void 0,objectValues:void 0};return e.listValues!==void 0&&(n.listValues=e.listValues.map(o=>Z(t[o],t))),e.objectValues!==void 0&&(n.objectValues=e.objectValues.map(o=>Z(t[o],t))),n}function Ae(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(o=>{o.root&&n.push(Z(o,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeInstallConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeInstallConfigurationField");return t.fields=n,t}var H,f,ce,T,fe,pe,J,$={},de=[],Re=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Y=Array.isArray;function w(e,t){for(var n in t)e[n]=t[n];return e}function he(e){var t=e.parentNode;t&&t.removeChild(e)}function Me(e,t,n){var o,_,i,l={};for(i in t)i=="key"?o=t[i]:i=="ref"?_=t[i]:l[i]=t[i];if(arguments.length>2&&(l.children=arguments.length>3?H.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)l[i]===void 0&&(l[i]=e.defaultProps[i]);return O(e,l,o,_,null)}function O(e,t,n,o,_){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:_??++ce,__i:-1,__u:0};return _==null&&f.vnode!=null&&f.vnode(i),i}function D(e){return e.children}function F(e,t){this.props=e,this.context=t}function j(e,t){if(t==null)return e.__?j(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?j(e):null}function me(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return me(e)}}function ve(e){(!e.__d&&(e.__d=!0)&&T.push(e)&&!L.__r++||fe!==f.debounceRendering)&&((fe=f.debounceRendering)||pe)(L)}function L(){var e,t,n,o,_,i,l,u,a;for(T.sort(J);e=T.shift();)e.__d&&(t=T.length,o=void 0,i=(_=(n=e).__v).__e,u=[],a=[],(l=n.__P)&&((o=w({},_)).__v=_.__v+1,f.vnode&&f.vnode(o),K(l,o,_,n.__n,l.ownerSVGElement!==void 0,32&_.__u?[i]:null,u,i??j(_),!!(32&_.__u),a),o.__.__k[o.__i]=o,Se(u,o,a),o.__e!=i&&me(o)),T.length>t&&T.sort(J));L.__r=0}function ge(e,t,n,o,_,i,l,u,a,s,p){var r,h,c,g,S,y=o&&o.__k||de,m=t.length;for(n.__d=a,Ue(n,t,y),a=n.__d,r=0;r<m;r++)(c=n.__k[r])!=null&&typeof c!="boolean"&&typeof c!="function"&&(h=c.__i===-1?$:y[c.__i]||$,c.__i=r,K(e,c,h,_,i,l,u,a,s,p),g=c.__e,c.ref&&h.ref!=c.ref&&(h.ref&&X(h.ref,null,c),p.push(c.ref,c.__c||g,c)),S==null&&g!=null&&(S=g),65536&c.__u||h.__k===c.__k?a=ye(c,a,e):typeof c.type=="function"&&c.__d!==void 0?a=c.__d:g&&(a=g.nextSibling),c.__d=void 0,c.__u&=-196609);n.__d=a,n.__e=S}function Ue(e,t,n){var o,_,i,l,u,a=t.length,s=n.length,p=s,r=0;for(e.__k=[],o=0;o<a;o++)(_=e.__k[o]=(_=t[o])==null||typeof _=="boolean"||typeof _=="function"?null:typeof _=="string"||typeof _=="number"||typeof _=="bigint"||_.constructor==String?O(null,_,null,null,_):Y(_)?O(D,{children:_},null,null,null):_.constructor===void 0&&_.__b>0?O(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_)!=null?(_.__=e,_.__b=e.__b+1,u=We(_,n,l=o+r,p),_.__i=u,i=null,u!==-1&&(p--,(i=n[u])&&(i.__u|=131072)),i==null||i.__v===null?(u==-1&&r--,typeof _.type!="function"&&(_.__u|=65536)):u!==l&&(u===l+1?r++:u>l?p>a-l?r+=u-l:r--:r=u<l&&u==l-1?u-l:0,u!==o+r&&(_.__u|=65536))):(i=n[o])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=j(i)),q(i,i,!1),n[o]=null,p--);if(p)for(o=0;o<s;o++)(i=n[o])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=j(i)),q(i,i))}function ye(e,t,n){var o,_;if(typeof e.type=="function"){for(o=e.__k,_=0;o&&_<o.length;_++)o[_]&&(o[_].__=e,t=ye(o[_],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function We(e,t,n,o){var _=e.key,i=e.type,l=n-1,u=n+1,a=t[n];if(a===null||a&&_==a.key&&i===a.type)return n;if(o>(a!=null&&!(131072&a.__u)?1:0))for(;l>=0||u<t.length;){if(l>=0){if((a=t[l])&&!(131072&a.__u)&&_==a.key&&i===a.type)return l;l--}if(u<t.length){if((a=t[u])&&!(131072&a.__u)&&_==a.key&&i===a.type)return u;u++}}return-1}function be(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Re.test(t)?n:n+"px"}function A(e,t,n,o,_){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||be(e.style,t,"");if(n)for(t in n)o&&n[t]===o[t]||be(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n.u=o.u:(n.u=Date.now(),e.addEventListener(t,i?ke:Ce,i)):e.removeEventListener(t,i?ke:Ce,i);else{if(_)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function Ce(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(f.event?f.event(e):e)}function ke(e){return this.l[e.type+!0](f.event?f.event(e):e)}function K(e,t,n,o,_,i,l,u,a,s){var p,r,h,c,g,S,y,m,b,x,G,N,Oe,Q,oe,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(a=!!(32&n.__u),i=[u=t.__e=n.__e]),(p=f.__b)&&p(t);e:if(typeof k=="function")try{if(m=t.props,b=(p=k.contextType)&&o[p.__c],x=p?b?b.props.value:p.__:o,n.__c?y=(r=t.__c=n.__c).__=r.__E:("prototype"in k&&k.prototype.render?t.__c=r=new k(m,x):(t.__c=r=new F(m,x),r.constructor=k,r.render=Qe),b&&b.sub(r),r.props=m,r.state||(r.state={}),r.context=x,r.__n=o,h=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),k.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=w({},r.__s)),w(r.__s,k.getDerivedStateFromProps(m,r.__s))),c=r.props,g=r.state,r.__v=t,h)k.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(k.getDerivedStateFromProps==null&&m!==c&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(m,x),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(m,r.__s,x)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(r.props=m,r.state=r.__s,r.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(B){B&&(B.__=t)}),G=0;G<r._sb.length;G++)r.__h.push(r._sb[G]);r._sb=[],r.__h.length&&l.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(m,r.__s,x),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(c,g,S)})}if(r.context=x,r.props=m,r.__P=e,r.__e=!1,N=f.__r,Oe=0,"prototype"in k&&k.prototype.render){for(r.state=r.__s,r.__d=!1,N&&N(t),p=r.render(r.props,r.state,r.context),Q=0;Q<r._sb.length;Q++)r.__h.push(r._sb[Q]);r._sb=[]}else do r.__d=!1,N&&N(t),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++Oe<25);r.state=r.__s,r.getChildContext!=null&&(o=w(w({},o),r.getChildContext())),h||r.getSnapshotBeforeUpdate==null||(S=r.getSnapshotBeforeUpdate(c,g)),ge(e,Y(oe=p!=null&&p.type===D&&p.key==null?p.props.children:p)?oe:[oe],t,n,o,_,i,l,u,a,s),r.base=t.__e,t.__u&=-161,r.__h.length&&l.push(r),y&&(r.__E=r.__=null)}catch(B){t.__v=null,a||i!=null?(t.__e=u,t.__u|=a?160:32,i[i.indexOf(u)]=null):(t.__e=n.__e,t.__k=n.__k),f.__e(B,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Ge(n.__e,t,n,o,_,i,l,a,s);(p=f.diffed)&&p(t)}function Se(e,t,n){t.__d=void 0;for(var o=0;o<n.length;o++)X(n[o],n[++o],n[++o]);f.__c&&f.__c(t,e),e.some(function(_){try{e=_.__h,_.__h=[],e.some(function(i){i.call(_)})}catch(i){f.__e(i,_.__v)}})}function Ge(e,t,n,o,_,i,l,u,a){var s,p,r,h,c,g,S,y=n.props,m=t.props,b=t.type;if(b==="svg"&&(_=!0),i!=null){for(s=0;s<i.length;s++)if((c=i[s])&&"setAttribute"in c==!!b&&(b?c.localName===b:c.nodeType===3)){e=c,i[s]=null;break}}if(e==null){if(b===null)return document.createTextNode(m);e=_?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,m.is&&m),i=null,u=!1}if(b===null)y===m||u&&e.data===m||(e.data=m);else{if(i=i&&H.call(e.childNodes),y=n.props||$,!u&&i!=null)for(y={},s=0;s<e.attributes.length;s++)y[(c=e.attributes[s]).name]=c.value;for(s in y)c=y[s],s=="children"||(s=="dangerouslySetInnerHTML"?r=c:s==="key"||s in m||A(e,s,null,c,_));for(s in m)c=m[s],s=="children"?h=c:s=="dangerouslySetInnerHTML"?p=c:s=="value"?g=c:s=="checked"?S=c:s==="key"||u&&typeof c!="function"||y[s]===c||A(e,s,c,y[s],_);if(p)u||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(r&&(e.innerHTML=""),ge(e,Y(h)?h:[h],t,n,o,_&&b!=="foreignObject",i,l,i?i[0]:n.__k&&j(n,0),u,a),i!=null)for(s=i.length;s--;)i[s]!=null&&he(i[s]);u||(s="value",g!==void 0&&(g!==e[s]||b==="progress"&&!g||b==="option"&&g!==y[s])&&A(e,s,g,y[s],!1),s="checked",S!==void 0&&S!==e[s]&&A(e,s,S,y[s],!1))}return e}function X(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(o){f.__e(o,n)}}function q(e,t,n){var o,_;if(f.unmount&&f.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||X(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(i){f.__e(i,t)}o.base=o.__P=null,e.__c=void 0}if(o=e.__k)for(_=0;_<o.length;_++)o[_]&&q(o[_],t,n||typeof e.type!="function");n||e.__e==null||he(e.__e),e.__=e.__e=e.__d=void 0}function Qe(e,t,n){return this.constructor(e,n)}function Be(e,t,n){var o,_,i,l;f.__&&f.__(e,t),_=(o=typeof n=="function")?null:n&&n.__k||t.__k,i=[],l=[],K(t,e=(!o&&n||t).__k=Me(D,null,[e]),_||$,$,t.ownerSVGElement!==void 0,!o&&n?[n]:_?null:t.firstChild?H.call(t.childNodes):null,i,!o&&n?n:_?_.__e:t.firstChild,o,l),Se(i,e,l)}H=de.slice,f={__e:function(e,t,n,o){for(var _,i,l;t=t.__;)if((_=t.__c)&&!_.__)try{if((i=_.constructor)&&i.getDerivedStateFromError!=null&&(_.setState(i.getDerivedStateFromError(e)),l=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(e,o||{}),l=_.__d),l)return _.__E=_}catch(u){e=u}throw e}},ce=0,F.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=w({},this.state),typeof e=="function"&&(e=e(w({},n),this.props)),e&&w(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ve(this))},F.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ve(this))},F.prototype.render=D,T=[],pe=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,J=function(e,t){return e.__v.__b-t.__v.__b},L.__r=0;var R,v,ee,Ee,te=0,we=[],M=[],xe=f.__b,Pe=f.__r,Te=f.diffed,je=f.__c,$e=f.unmount;function Ne(e,t){f.__h&&f.__h(v,e,te||t),te=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:M}),n.__[e]}function ze(e){return te=1,Ze(Ie,e)}function Ze(e,t,n){var o=Ne(R++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Ie(void 0,t),function(u){var a=o.__N?o.__N[0]:o.__[0],s=o.t(a,u);a!==s&&(o.__N=[s,o.__[1]],o.__c.setState({}))}],o.__c=v,!v.u)){var _=function(u,a,s){if(!o.__c.__H)return!0;var p=o.__c.__H.__.filter(function(h){return h.__c});if(p.every(function(h){return!h.__N}))return!i||i.call(this,u,a,s);var r=!1;return p.forEach(function(h){if(h.__N){var c=h.__[0];h.__=h.__N,h.__N=void 0,c!==h.__[0]&&(r=!0)}}),!(!r&&o.__c.props===u)&&(!i||i.call(this,u,a,s))};v.u=!0;var i=v.shouldComponentUpdate,l=v.componentWillUpdate;v.componentWillUpdate=function(u,a,s){if(this.__e){var p=i;i=void 0,_(u,a,s),i=p}l&&l.call(this,u,a,s)},v.shouldComponentUpdate=_}return o.__N||o.__}function Je(e,t){var n=Ne(R++,3);!f.__s&&Xe(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function Ye(){for(var e;e=we.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(U),e.__H.__h.forEach(ne),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){v=null,xe&&xe(e)},f.__r=function(e){Pe&&Pe(e),R=0;var t=(v=e.__c).__H;t&&(ee===v?(t.__h=[],v.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=M,n.__N=n.i=void 0})):(t.__h.forEach(U),t.__h.forEach(ne),t.__h=[],R=0)),ee=v},f.diffed=function(e){Te&&Te(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(we.push(t)!==1&&Ee===f.requestAnimationFrame||((Ee=f.requestAnimationFrame)||Ke)(Ye)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==M&&(n.__=n.__V),n.i=void 0,n.__V=M})),ee=v=null},f.__c=function(e,t){t.some(function(n){try{n.__h.forEach(U),n.__h=n.__h.filter(function(o){return!o.__||ne(o)})}catch(o){t.some(function(_){_.__h&&(_.__h=[])}),t=[],f.__e(o,n.__v)}}),je&&je(e,t)},f.unmount=function(e){$e&&$e(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(o){try{U(o)}catch(_){t=_}}),n.__H=void 0,t&&f.__e(t,n.__v))};var Ve=typeof requestAnimationFrame=="function";function Ke(e){var t,n=function(){clearTimeout(o),Ve&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,100);Ve&&(t=requestAnimationFrame(n))}function U(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function ne(e){var t=v;e.__c=e.__(),v=t}function Xe(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Ie(e,t){return typeof t=="function"?t(e):t}var qe=0;function He(e,t,n,o,_,i){var l,u,a={};for(u in t)u=="ref"?l=t[u]:a[u]=t[u];var s={type:e,props:a,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--qe,__i:-1,__u:0,__source:_,__self:i};if(typeof e=="function"&&(l=e.defaultProps))for(u in l)a[u]===void 0&&(a[u]=l[u]);return f.vnode&&f.vnode(s),s}class et{constructor(){_e(this,"_context");_e(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(t=>{this._getContextCallbacks.push(t)})}setContext(t){this._context=t,this._getContextCallbacks.forEach(n=>n(t)),this._getContextCallbacks=[]}configureClient(t){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(t){console.log("Add to cart",t)}navigateToCustomerPortal(){console.log("Navigating to customer portal")}}let W;const tt=({context:e})=>{const[t,n]=ze(null);return Je(()=>{if(t){if(W===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");W.setContext({...e,container:t})}},[t,e]),He("div",{ref:n,id:"spiffThemeWrapper"})};function nt(e,t){W=new et,window.SpiffThemeLoader=W;let n;typeof e=="string"?n=document.getElementById(e):n=e,Be(He(tt,{context:t}),n)}function ot(e){return{id:"example",themeInstallId:(e==null?void 0:e.themeInstallId)??"example",name:"Example Configuration",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",themeVersion:{id:"example",version:"1.0.0",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",configurationSchema:{fields:[]},launchData:{targetFiles:[]},theme:{id:"example",name:"Example Theme",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z"}},fields:[],...e}}const _t=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function rt(e,...t){return e.fields.filter(n=>!n.key||!t.includes(n.key)).map(n=>({key:n.key,fallbackToDefaultConfiguration:!1,value:_t(n),type:n.type,asset:void 0}))}const it={name:"@spiffcommerce/theme-bridge",version:"1.18.0",type:"module",scripts:{build:"tsc && vite build",preview:"vite preview",dev:"ladle serve",schema:"node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"},main:"./dist/index.umd.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",files:["./dist"],exports:{import:"./dist/index.js",require:"./dist/index.umd.cjs"},dependencies:{},devDependencies:{"@ladle/react":"^4.0.2","@preact/preset-vite":"^2.7.0","@spiffcommerce/core":"^21.0.1","@types/node":"^20.11.16","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3",preact:"^10.19.3",prettier:"^3.2.4",rollup:"^4.12.0","ts-json-schema-generator":"^1.5.0","ts-node":"^10.9.2",tsup:"^8.0.1",typescript:"^5.2.2",vite:"^5.0.8","vite-plugin-css-injected-by-js":"^3.4.0","vite-plugin-externalize-deps":"^0.8.0"},peerDependencies:{"@spiffcommerce/core":"^21.0.1"}};function st(e,t,n){if(t.type==="chunk"){if(console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`),!t.isEntry&&!n)return null;if(!t.isDynamicEntry)return{type:V.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:V.CSS,mimeType:"text/css",filename:e};return null}function ut(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:n,includePreloadChunks:o=!1,targetFiles:_}=e??{};return{name:"spiff-theme-plugin",version:it.version,config(i,l){i.base!==void 0&&i.base!==""&&console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'),i.base=""},writeBundle(i,l){const u=t?Object.keys(l).map(s=>_!=null&&_.some(p=>p.filename===s)?null:st(s,l[s],o)).filter(s=>s!==null):[];_&&u.push(..._);const a={launchData:{targetFiles:u},configurationSchema:n};C.writeFileSync(P.join(i.dir,"spiffTheme.json"),JSON.stringify(a,void 0,4))}}}d.AssetType=re,d.ConversionDataType=ue,d.ConversionLocation=se,d.CustomSchemaType=ie,d.FieldType=E,d.ThemeFileType=V,d.exampleThemeInstallConfig=ot,d.getDefaultsForSchema=rt,d.setSpiffDevOptions=nt,d.spiffThemePlugin=ut,d.themeInstallConfigurationFieldsToRecordObject=De,d.themeInstallConfigurationGraphQlToResource=Ae,d.themeInstallConfigurationToRecordObject=Fe,d.themeVersionConfigurationGraphQlToResource=ae,d.themeVersionGraphQlToResource=Le,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/theme-bridge",
3
- "version": "1.17.4",
3
+ "version": "1.18.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "tsc && vite build",