@swell/apps-sdk 1.0.186 → 1.0.187

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3529,7 +3529,15 @@
3529
3529
  }, {}),
3530
3530
  ...preset.settings || void 0
3531
3531
  },
3532
- blocks: preset.blocks?.map((block) => {
3532
+ blocks: resolveSectionBlockPresets(preset, schema)
3533
+ }));
3534
+ }
3535
+ function resolveSectionBlockPresets(preset, schema) {
3536
+ if (!preset.blocks) {
3537
+ return;
3538
+ }
3539
+ if (Array.isArray(preset.blocks)) {
3540
+ return preset.blocks.map((block) => {
3533
3541
  const blockDef = schema.blocks?.find((b) => b.type === block.type);
3534
3542
  return blockDef ? {
3535
3543
  ...block,
@@ -3543,8 +3551,9 @@
3543
3551
  ...block.settings || void 0
3544
3552
  }
3545
3553
  } : block;
3546
- })
3547
- }));
3554
+ });
3555
+ }
3556
+ return Object.values(preset.blocks);
3548
3557
  }
3549
3558
  async function getLayoutSectionGroups(allSections, renderTemplateSchema) {
3550
3559
  const allSectionsList = Array.from(allSections.values());
@@ -3621,7 +3630,15 @@
3621
3630
  };
3622
3631
  const id = sectionGroup.id ? `page__${sectionGroup.id}__${key}` : schema.id;
3623
3632
  const blockOrder = Array.isArray(section.block_order) ? section.block_order : Object.keys(section.blocks || {});
3624
- const blocks = blockOrder.map((key2) => section.blocks?.[key2]).filter(Boolean);
3633
+ const blocks = blockOrder.map((key2) => {
3634
+ const block = section.blocks?.[key2];
3635
+ if (block) {
3636
+ return {
3637
+ ...block,
3638
+ id: `${schema.id}__${key2}`
3639
+ };
3640
+ }
3641
+ }).filter(Boolean);
3625
3642
  const settings = {
3626
3643
  section: {
3627
3644
  id,
@@ -5615,7 +5632,7 @@ ${formattedMessage}`;
5615
5632
  // TODO: figure out how to make this work, doesn't work for collections normally
5616
5633
  defaultValue: section.presets?.reduce(
5617
5634
  (acc, preset, index) => {
5618
- if (!preset.blocks) {
5635
+ if (!preset.blocks || !Array.isArray(preset.blocks)) {
5619
5636
  return acc;
5620
5637
  }
5621
5638
  return preset.blocks.reduce(
@@ -5822,7 +5839,7 @@ ${formattedMessage}`;
5822
5839
  custom_css: preset.settings?.["custom_css"] || "",
5823
5840
  ...processFields(section.fields, preset.settings),
5824
5841
  // Process blocks inside the preset
5825
- Blocks: (preset.blocks || []).map((block) => {
5842
+ Blocks: (Array.isArray(preset.blocks) ? preset.blocks : []).map((block) => {
5826
5843
  const blockSchema = section.blocks?.find(
5827
5844
  ({ type }) => type === block.type
5828
5845
  );
@@ -6282,11 +6299,11 @@ ${formattedMessage}`;
6282
6299
  }
6283
6300
 
6284
6301
  // src/menus.ts
6285
- var import_lodash_es15 = __require("lodash-es");
6302
+ var import_lodash_es17 = __require("lodash-es");
6286
6303
 
6287
6304
  // src/theme.ts
6288
6305
  var import_json56 = __toESM(__require("json5"), 1);
6289
- var import_lodash_es14 = __require("lodash-es");
6306
+ var import_lodash_es16 = __require("lodash-es");
6290
6307
 
6291
6308
  // src/compatibility/shopify.ts
6292
6309
  var import_lodash_es7 = __require("lodash-es");
@@ -11581,16 +11598,16 @@ ${formattedMessage}`;
11581
11598
  if (!Array.isArray(blogs?.results)) {
11582
11599
  return [];
11583
11600
  }
11584
- const set3 = blogs.results.reduce(
11585
- (set4, blog) => {
11601
+ const set4 = blogs.results.reduce(
11602
+ (set5, blog) => {
11586
11603
  for (const tag of blog.tags || []) {
11587
- set4.add(tag);
11604
+ set5.add(tag);
11588
11605
  }
11589
- return set4;
11606
+ return set5;
11590
11607
  },
11591
11608
  /* @__PURE__ */ new Set()
11592
11609
  );
11593
- return Array.from(set3.values());
11610
+ return Array.from(set4.values());
11594
11611
  });
11595
11612
  return new ShopifyResource({
11596
11613
  all_tags: allTags,
@@ -11974,18 +11991,18 @@ ${formattedMessage}`;
11974
11991
  if (!resolved) {
11975
11992
  return [];
11976
11993
  }
11977
- const set3 = /* @__PURE__ */ new Set();
11994
+ const set4 = /* @__PURE__ */ new Set();
11978
11995
  await Promise.all(
11979
11996
  resolved.results.map(async (product) => {
11980
11997
  const tags2 = await Promise.resolve().then(() => product.tags);
11981
11998
  if (Array.isArray(tags2)) {
11982
11999
  for (const tag of tags2) {
11983
- set3.add(tag);
12000
+ set4.add(tag);
11984
12001
  }
11985
12002
  }
11986
12003
  })
11987
12004
  );
11988
- return Array.from(set3.values());
12005
+ return Array.from(set4.values());
11989
12006
  }),
11990
12007
  all_types: defer(async () => {
11991
12008
  const products = await resolveProducts();
@@ -14573,6 +14590,8 @@ ${injects.join("\n")}<\/script>`;
14573
14590
  return `templates/${this.getPageType(name)}`;
14574
14591
  case "sections":
14575
14592
  return `sections/${name}`;
14593
+ case "blocks":
14594
+ return `blocks/${name}`;
14576
14595
  default:
14577
14596
  throw new Error(`Theme file type not supported: ${type}`);
14578
14597
  }
@@ -14746,7 +14765,7 @@ ${injects.join("\n")}<\/script>`;
14746
14765
  };
14747
14766
 
14748
14767
  // src/liquid/index.ts
14749
- var import_liquidjs35 = __require("liquidjs");
14768
+ var import_liquidjs40 = __require("liquidjs");
14750
14769
 
14751
14770
  // src/utils/escape.ts
14752
14771
  function replacerUnescape(match) {
@@ -14919,14 +14938,161 @@ ${injects.join("\n")}<\/script>`;
14919
14938
  };
14920
14939
  }
14921
14940
 
14922
- // src/liquid/tags/for.ts
14941
+ // src/liquid/tags/content_for.ts
14942
+ var import_liquidjs22 = __require("liquidjs");
14943
+ var import_lodash_es10 = __require("lodash-es");
14944
+
14945
+ // src/liquid/hash.ts
14946
+ var import_lodash_es9 = __require("lodash-es");
14947
+ var import_liquidjs21 = __require("liquidjs");
14948
+
14949
+ // src/liquid/tokienizer.ts
14950
+ var import_liquidjs20 = __require("liquidjs");
14951
+
14952
+ // src/liquid/tokens/identifier-token.ts
14923
14953
  var import_liquidjs19 = __require("liquidjs");
14954
+ var IdentifierToken = class extends import_liquidjs19.Token {
14955
+ constructor(input, begin, end, file) {
14956
+ super(import_liquidjs19.TokenKind.Word, input, begin, end, file);
14957
+ this.input = input;
14958
+ this.begin = begin;
14959
+ this.end = end;
14960
+ this.file = file;
14961
+ this.content = this.getText();
14962
+ }
14963
+ content;
14964
+ };
14965
+
14966
+ // src/liquid/tokienizer.ts
14967
+ var isNumber2 = (c) => c >= "0" && c <= "9";
14968
+ var isCharacter = (c) => c >= "a" && c <= "z" || c >= "A" && c <= "Z";
14969
+ var isWord = (c) => "_-?".includes(c) || isCharacter(c) || isNumber2(c);
14970
+ var TokenizerSwell = class extends import_liquidjs20.Tokenizer {
14971
+ readIdentifier() {
14972
+ this.skipBlank();
14973
+ const begin = this.p;
14974
+ while (!this.end()) {
14975
+ const char = this.peek();
14976
+ if (isWord(char) || char === ".") {
14977
+ this.p++;
14978
+ } else {
14979
+ break;
14980
+ }
14981
+ }
14982
+ return new IdentifierToken(this.input, begin, this.p, this.file);
14983
+ }
14984
+ };
14985
+
14986
+ // src/liquid/hash.ts
14987
+ var HashSwell = class extends import_liquidjs21.Hash {
14988
+ constructor(input, jekyllStyle) {
14989
+ super(input, jekyllStyle);
14990
+ const tokenizer = input instanceof import_liquidjs21.Tokenizer ? input : new TokenizerSwell(input, {});
14991
+ for (const hash of tokenizer.readHashes(jekyllStyle)) {
14992
+ this.hash[hash.name.content] = hash.value;
14993
+ }
14994
+ }
14995
+ *render(ctx) {
14996
+ const hash = {};
14997
+ for (const key of Object.keys(this.hash)) {
14998
+ const token = this.hash[key];
14999
+ if (token !== void 0) {
15000
+ const value = yield (0, import_liquidjs21.evalToken)(token, ctx);
15001
+ (0, import_lodash_es9.set)(hash, key, value);
15002
+ }
15003
+ }
15004
+ return hash;
15005
+ }
15006
+ };
15007
+
15008
+ // src/liquid/tags/content_for.ts
15009
+ function bind4(liquidSwell) {
15010
+ return class ContentForTag extends import_liquidjs22.Tag {
15011
+ name;
15012
+ hash;
15013
+ constructor(token, remainTokens, liquid) {
15014
+ super(token, remainTokens, liquid);
15015
+ const tokenizer = token.tokenizer;
15016
+ this.name = tokenizer.readValue()?.content;
15017
+ this.hash = new HashSwell(tokenizer.remaining());
15018
+ }
15019
+ *render(ctx, emitter) {
15020
+ const section = yield ctx._get(["section"]);
15021
+ const block = yield ctx._get(["block"]);
15022
+ const hash = yield this.hash.render(ctx);
15023
+ const blocks = this.getBlocks(section, block, hash);
15024
+ for (const block2 of blocks) {
15025
+ if (!isObject2(block2) || typeof block2.type !== "string") {
15026
+ continue;
15027
+ }
15028
+ const blockPath = yield liquidSwell.getThemeBlockPath(
15029
+ block2.type
15030
+ );
15031
+ if (!blockPath) {
15032
+ continue;
15033
+ }
15034
+ const childCtx = ctx.spawn();
15035
+ const scope = childCtx.bottom();
15036
+ (0, import_lodash_es10.assign)(scope, { section });
15037
+ (0, import_lodash_es10.assign)(scope, { block: block2 });
15038
+ (0, import_lodash_es10.assign)(scope, hash);
15039
+ const templates = yield this.liquid._parseFile(
15040
+ blockPath,
15041
+ childCtx.sync
15042
+ );
15043
+ yield this.liquid.renderer.renderTemplates(
15044
+ templates,
15045
+ childCtx,
15046
+ emitter
15047
+ );
15048
+ }
15049
+ }
15050
+ getBlocks(section, block, hash) {
15051
+ const blockConfigs = this.getBlockConfigs(section, block);
15052
+ if (!isObject2(hash) || !hash.type) {
15053
+ return blockConfigs;
15054
+ }
15055
+ const blockConfig = blockConfigs.find(
15056
+ (blockConfig2) => isObject2(blockConfig2) && blockConfig2.type === hash.type
15057
+ );
15058
+ return blockConfig ? [blockConfig] : [];
15059
+ }
15060
+ getBlockConfigs(section, block) {
15061
+ if (isObject2(block) && block.blocks) {
15062
+ return Object.values(block.blocks);
15063
+ }
15064
+ if (isObject2(section) && Array.isArray(section.blocks)) {
15065
+ return section.blocks;
15066
+ }
15067
+ return [];
15068
+ }
15069
+ };
15070
+ }
15071
+
15072
+ // src/liquid/tags/doc.ts
15073
+ var import_liquidjs23 = __require("liquidjs");
15074
+ function bind5() {
15075
+ return class DocTag extends import_liquidjs23.Tag {
15076
+ constructor(token, remainTokens, liquid, parser) {
15077
+ super(token, remainTokens, liquid);
15078
+ const stream = parser.parseStream(remainTokens).on("tag:enddoc", () => {
15079
+ stream.stop();
15080
+ });
15081
+ stream.start();
15082
+ }
15083
+ render() {
15084
+ }
15085
+ };
15086
+ }
15087
+
15088
+ // src/liquid/tags/for.ts
15089
+ var import_liquidjs24 = __require("liquidjs");
14924
15090
  var MODIFIERS = Object.freeze(["offset", "limit", "reversed"]);
14925
- function bind4(_liquidSwell) {
14926
- return class ForTag extends import_liquidjs19.ForTag {
15091
+ function bind6(_liquidSwell) {
15092
+ return class ForTag extends import_liquidjs24.ForTag {
14927
15093
  *render(ctx, emitter) {
14928
15094
  const r = this.liquid.renderer;
14929
- let collection = yield (0, import_liquidjs19.evalToken)(this.collection, ctx);
15095
+ let collection = yield (0, import_liquidjs24.evalToken)(this.collection, ctx);
14930
15096
  collection = yield resolveEnumerable(collection);
14931
15097
  if (!collection.length) {
14932
15098
  yield r.renderTemplates(this.elseTemplates, ctx, emitter);
@@ -14993,10 +15159,10 @@ ${injects.join("\n")}<\/script>`;
14993
15159
  }
14994
15160
 
14995
15161
  // src/liquid/tags/form.ts
14996
- var import_liquidjs20 = __require("liquidjs");
15162
+ var import_liquidjs25 = __require("liquidjs");
14997
15163
  var IGNORED_SHOPIFY_FORMS = Object.freeze(["new_comment", "guest_login"]);
14998
- function bind5(liquidSwell) {
14999
- return class FormTag extends import_liquidjs20.Tag {
15164
+ function bind7(liquidSwell) {
15165
+ return class FormTag extends import_liquidjs25.Tag {
15000
15166
  formType;
15001
15167
  formConfig;
15002
15168
  templates;
@@ -15009,10 +15175,10 @@ ${injects.join("\n")}<\/script>`;
15009
15175
  this.formConfig = liquidSwell.theme.getFormConfig(this.formType);
15010
15176
  this.arg = tokenizer.readValue();
15011
15177
  this.templates = [];
15012
- this.hash = new import_liquidjs20.Hash(this.tokenizer.remaining());
15178
+ this.hash = new import_liquidjs25.Hash(this.tokenizer.remaining());
15013
15179
  while (remainTokens.length > 0) {
15014
15180
  const token2 = remainTokens.shift();
15015
- if (import_liquidjs20.TypeGuards.isTagToken(token2) && token2.name === "endform") {
15181
+ if (import_liquidjs25.TypeGuards.isTagToken(token2) && token2.name === "endform") {
15016
15182
  return;
15017
15183
  }
15018
15184
  this.templates.push(parser.parseToken(token2, remainTokens));
@@ -15030,7 +15196,7 @@ ${injects.join("\n")}<\/script>`;
15030
15196
  return;
15031
15197
  }
15032
15198
  const r = this.liquid.renderer;
15033
- const arg = yield (0, import_liquidjs20.evalToken)(this.arg, ctx);
15199
+ const arg = yield (0, import_liquidjs25.evalToken)(this.arg, ctx);
15034
15200
  const hash = yield this.hash.render(ctx);
15035
15201
  const scope = ctx.getAll();
15036
15202
  const attrs = " " + Object.entries({ id: `${this.formConfig.id}_form`, ...hash }).reduce((acc, [key, value]) => {
@@ -15091,9 +15257,9 @@ ${injects.join("\n")}<\/script>`;
15091
15257
  }
15092
15258
 
15093
15259
  // src/liquid/tags/if.ts
15094
- var import_liquidjs21 = __require("liquidjs");
15095
- function bind6(_liquidSwell) {
15096
- return class IfTag extends import_liquidjs21.Tag {
15260
+ var import_liquidjs26 = __require("liquidjs");
15261
+ function bind8(_liquidSwell) {
15262
+ return class IfTag extends import_liquidjs26.Tag {
15097
15263
  branches = [];
15098
15264
  elseTemplates;
15099
15265
  constructor(tagToken, remainTokens, liquid, parser) {
@@ -15102,22 +15268,22 @@ ${injects.join("\n")}<\/script>`;
15102
15268
  parser.parseStream(remainTokens).on(
15103
15269
  "start",
15104
15270
  () => this.branches.push({
15105
- value: new import_liquidjs21.Value(
15271
+ value: new import_liquidjs26.Value(
15106
15272
  tagToken.tokenizer.readFilteredValue(),
15107
15273
  this.liquid
15108
15274
  ),
15109
15275
  templates: p = []
15110
15276
  })
15111
15277
  ).on("tag:elsif", (token) => {
15112
- (0, import_liquidjs21.assert)(!this.elseTemplates, "unexpected elsif after else");
15278
+ (0, import_liquidjs26.assert)(!this.elseTemplates, "unexpected elsif after else");
15113
15279
  this.branches.push({
15114
- value: new import_liquidjs21.Value(token.tokenizer.readFilteredValue(), this.liquid),
15280
+ value: new import_liquidjs26.Value(token.tokenizer.readFilteredValue(), this.liquid),
15115
15281
  templates: p = []
15116
15282
  });
15117
15283
  }).on("tag:else", (tag) => {
15118
15284
  if (tag.args.length > 0) {
15119
15285
  this.branches.push({
15120
- value: new import_liquidjs21.Value(tag.tokenizer.readFilteredValue(), this.liquid),
15286
+ value: new import_liquidjs26.Value(tag.tokenizer.readFilteredValue(), this.liquid),
15121
15287
  templates: p = []
15122
15288
  });
15123
15289
  } else {
@@ -15135,7 +15301,7 @@ ${injects.join("\n")}<\/script>`;
15135
15301
  const r = this.liquid.renderer;
15136
15302
  for (const { value, templates } of this.branches) {
15137
15303
  const v = yield value.value(ctx, ctx.opts.lenientIf);
15138
- if ((0, import_liquidjs21.isTruthy)(v, ctx)) {
15304
+ if ((0, import_liquidjs26.isTruthy)(v, ctx)) {
15139
15305
  yield r.renderTemplates(templates, ctx, emitter);
15140
15306
  return;
15141
15307
  }
@@ -15156,20 +15322,20 @@ ${injects.join("\n")}<\/script>`;
15156
15322
  };
15157
15323
  }
15158
15324
  function assertEmpty(predicate, message = `unexpected ${JSON.stringify(predicate)}`) {
15159
- (0, import_liquidjs21.assert)(!predicate, message);
15325
+ (0, import_liquidjs26.assert)(!predicate, message);
15160
15326
  }
15161
15327
 
15162
15328
  // src/liquid/tags/javascript.ts
15163
- var import_liquidjs22 = __require("liquidjs");
15164
- function bind7(_liquidSwell) {
15165
- return class JavascriptTag extends import_liquidjs22.Tag {
15329
+ var import_liquidjs27 = __require("liquidjs");
15330
+ function bind9(_liquidSwell) {
15331
+ return class JavascriptTag extends import_liquidjs27.Tag {
15166
15332
  templates;
15167
15333
  constructor(token, remainTokens, liquid, parser) {
15168
15334
  super(token, remainTokens, liquid);
15169
15335
  this.templates = [];
15170
15336
  while (remainTokens.length > 0) {
15171
15337
  const token2 = remainTokens.shift();
15172
- if (import_liquidjs22.TypeGuards.isTagToken(token2) && token2.name === "endjavascript") {
15338
+ if (import_liquidjs27.TypeGuards.isTagToken(token2) && token2.name === "endjavascript") {
15173
15339
  return;
15174
15340
  }
15175
15341
  this.templates.push(parser.parseToken(token2, remainTokens));
@@ -15187,9 +15353,9 @@ ${injects.join("\n")}<\/script>`;
15187
15353
  }
15188
15354
 
15189
15355
  // src/liquid/tags/layout.ts
15190
- var import_liquidjs23 = __require("liquidjs");
15191
- function bind8(liquidSwell) {
15192
- return class LayoutTag extends import_liquidjs23.Tag {
15356
+ var import_liquidjs28 = __require("liquidjs");
15357
+ function bind10(liquidSwell) {
15358
+ return class LayoutTag extends import_liquidjs28.Tag {
15193
15359
  fileName;
15194
15360
  constructor(token, remainTokens, liquid, _parser) {
15195
15361
  super(token, remainTokens, liquid);
@@ -15205,9 +15371,9 @@ ${injects.join("\n")}<\/script>`;
15205
15371
  }
15206
15372
 
15207
15373
  // src/liquid/tags/paginate.ts
15208
- var import_liquidjs24 = __require("liquidjs");
15209
- function bind9(liquidSwell) {
15210
- return class PaginateTag extends import_liquidjs24.Tag {
15374
+ var import_liquidjs29 = __require("liquidjs");
15375
+ function bind11(liquidSwell) {
15376
+ return class PaginateTag extends import_liquidjs29.Tag {
15211
15377
  collection;
15212
15378
  pageSize;
15213
15379
  templates;
@@ -15222,7 +15388,7 @@ ${injects.join("\n")}<\/script>`;
15222
15388
  }
15223
15389
  this.templates = [];
15224
15390
  this.collection = collection;
15225
- this.hash = new import_liquidjs24.Hash(this.tokenizer.remaining());
15391
+ this.hash = new import_liquidjs29.Hash(this.tokenizer.remaining());
15226
15392
  const stream = parser.parseStream(remainTokens).on("tag:endpaginate", () => stream.stop()).on("template", (tpl) => {
15227
15393
  this.templates.push(tpl);
15228
15394
  }).on("end", () => {
@@ -15232,8 +15398,8 @@ ${injects.join("\n")}<\/script>`;
15232
15398
  }
15233
15399
  *render(ctx, emitter) {
15234
15400
  const r = this.liquid.renderer;
15235
- const collection = yield (0, import_liquidjs24.evalToken)(this.collection, ctx);
15236
- const pageSize = Number(yield (0, import_liquidjs24.evalToken)(this.pageSize, ctx));
15401
+ const collection = yield (0, import_liquidjs29.evalToken)(this.collection, ctx);
15402
+ const pageSize = Number(yield (0, import_liquidjs29.evalToken)(this.pageSize, ctx));
15237
15403
  const hash = yield this.hash.render(ctx);
15238
15404
  if (!Number.isNaN(pageSize) && collection instanceof SwellStorefrontCollection && collection.limit !== pageSize) {
15239
15405
  yield collection._get({
@@ -15259,10 +15425,10 @@ ${injects.join("\n")}<\/script>`;
15259
15425
  }
15260
15426
 
15261
15427
  // src/liquid/tags/render.ts
15262
- var import_lodash_es9 = __require("lodash-es");
15263
- var import_liquidjs25 = __require("liquidjs");
15264
- function bind10(liquidSwell) {
15265
- return class RenderTag extends import_liquidjs25.RenderTag {
15428
+ var import_lodash_es11 = __require("lodash-es");
15429
+ var import_liquidjs30 = __require("liquidjs");
15430
+ function bind12(liquidSwell) {
15431
+ return class RenderTag extends import_liquidjs30.RenderTag {
15266
15432
  *render(ctx, emitter) {
15267
15433
  const self = this;
15268
15434
  const { liquid } = this;
@@ -15272,23 +15438,26 @@ ${injects.join("\n")}<\/script>`;
15272
15438
  ctx,
15273
15439
  liquid
15274
15440
  );
15275
- (0, import_liquidjs25.assert)(filename, () => `illegal file path "${filename}"`);
15441
+ (0, import_liquidjs30.assert)(filename, () => `illegal file path "${filename}"`);
15276
15442
  const configPath = yield liquidSwell.getComponentPath(
15277
15443
  filename
15278
15444
  );
15279
15445
  const childCtx = ctx.spawn();
15280
15446
  const scope = childCtx.bottom();
15281
- (0, import_lodash_es9.assign)(scope, yield hash.render(ctx));
15447
+ (0, import_lodash_es11.assign)(scope, ctx.bottom());
15282
15448
  const parentSection = yield ctx._get(["section"]);
15283
- if (parentSection) (0, import_lodash_es9.assign)(scope, { section: parentSection });
15449
+ if (parentSection) (0, import_lodash_es11.assign)(scope, { section: parentSection });
15450
+ const parentBlock = yield ctx._get(["block"]);
15451
+ if (parentBlock) (0, import_lodash_es11.assign)(scope, { block: parentBlock });
15452
+ (0, import_lodash_es11.assign)(scope, yield hash.render(ctx));
15284
15453
  if (self["with"]) {
15285
15454
  const { value, alias } = self["with"];
15286
15455
  const aliasName = alias || filename;
15287
- scope[aliasName] = yield (0, import_liquidjs25.evalToken)(value, ctx);
15456
+ scope[aliasName] = yield (0, import_liquidjs30.evalToken)(value, ctx);
15288
15457
  }
15289
15458
  if (self["for"]) {
15290
15459
  const { value, alias } = self["for"];
15291
- let collection = yield (0, import_liquidjs25.evalToken)(value, ctx);
15460
+ let collection = yield (0, import_liquidjs30.evalToken)(value, ctx);
15292
15461
  collection = yield resolveEnumerable(collection);
15293
15462
  scope["forloop"] = new ForloopDrop(
15294
15463
  collection.length,
@@ -15331,13 +15500,13 @@ ${injects.join("\n")}<\/script>`;
15331
15500
  default:
15332
15501
  break;
15333
15502
  }
15334
- return yield (0, import_liquidjs25.evalToken)(file, ctx);
15503
+ return yield (0, import_liquidjs30.evalToken)(file, ctx);
15335
15504
  }
15336
15505
 
15337
15506
  // src/liquid/tags/section.ts
15338
- var import_liquidjs26 = __require("liquidjs");
15339
- function bind11(liquidSwell) {
15340
- return class SectionTag extends import_liquidjs26.Tag {
15507
+ var import_liquidjs31 = __require("liquidjs");
15508
+ function bind13(liquidSwell) {
15509
+ return class SectionTag extends import_liquidjs31.Tag {
15341
15510
  fileName;
15342
15511
  constructor(token, remainTokens, liquid, _parser) {
15343
15512
  super(token, remainTokens, liquid);
@@ -15388,10 +15557,10 @@ ${injects.join("\n")}<\/script>`;
15388
15557
  }
15389
15558
 
15390
15559
  // src/liquid/tags/sections.ts
15391
- var import_liquidjs27 = __require("liquidjs");
15560
+ var import_liquidjs32 = __require("liquidjs");
15392
15561
  var import_json54 = __toESM(__require("json5"), 1);
15393
- function bind12(liquidSwell) {
15394
- return class SectionsTag extends import_liquidjs27.Tag {
15562
+ function bind14(liquidSwell) {
15563
+ return class SectionsTag extends import_liquidjs32.Tag {
15395
15564
  fileName;
15396
15565
  constructor(token, remainTokens, liquid, _parser) {
15397
15566
  super(token, remainTokens, liquid);
@@ -15431,9 +15600,9 @@ ${injects.join("\n")}<\/script>`;
15431
15600
  }
15432
15601
 
15433
15602
  // src/liquid/tags/style.ts
15434
- var import_liquidjs28 = __require("liquidjs");
15435
- function bind13(_liquidSwell) {
15436
- return class StyleTag extends import_liquidjs28.Tag {
15603
+ var import_liquidjs33 = __require("liquidjs");
15604
+ function bind15(_liquidSwell) {
15605
+ return class StyleTag extends import_liquidjs33.Tag {
15437
15606
  templates;
15438
15607
  hash;
15439
15608
  constructor(token, remainTokens, liquid, parser) {
@@ -15442,7 +15611,7 @@ ${injects.join("\n")}<\/script>`;
15442
15611
  const tagBegin = token.begin;
15443
15612
  while (remainTokens.length > 0) {
15444
15613
  const token2 = remainTokens.shift();
15445
- if (import_liquidjs28.TypeGuards.isTagToken(token2) && token2.name === "endstyle") {
15614
+ if (import_liquidjs33.TypeGuards.isTagToken(token2) && token2.name === "endstyle") {
15446
15615
  this.hash = md5(token2.input.slice(tagBegin, token2.end));
15447
15616
  return;
15448
15617
  }
@@ -15465,16 +15634,16 @@ ${injects.join("\n")}<\/script>`;
15465
15634
  }
15466
15635
 
15467
15636
  // src/liquid/tags/stylesheet.ts
15468
- var import_liquidjs29 = __require("liquidjs");
15469
- function bind14(_liquidSwell) {
15470
- return class StyleSheetTag extends import_liquidjs29.Tag {
15637
+ var import_liquidjs34 = __require("liquidjs");
15638
+ function bind16(_liquidSwell) {
15639
+ return class StyleSheetTag extends import_liquidjs34.Tag {
15471
15640
  templates;
15472
15641
  constructor(token, remainTokens, liquid, parser) {
15473
15642
  super(token, remainTokens, liquid);
15474
15643
  this.templates = [];
15475
15644
  while (remainTokens.length > 0) {
15476
15645
  const token2 = remainTokens.shift();
15477
- if (import_liquidjs29.TypeGuards.isTagToken(token2) && token2.name === "endstylesheet") {
15646
+ if (import_liquidjs34.TypeGuards.isTagToken(token2) && token2.name === "endstylesheet") {
15478
15647
  return;
15479
15648
  }
15480
15649
  this.templates.push(parser.parseToken(token2, remainTokens));
@@ -15490,9 +15659,9 @@ ${injects.join("\n")}<\/script>`;
15490
15659
  }
15491
15660
 
15492
15661
  // src/liquid/tags/shopify/include.ts
15493
- var import_liquidjs30 = __require("liquidjs");
15494
- function bind15(liquidSwell) {
15495
- return class IncludeTag extends import_liquidjs30.IncludeTag {
15662
+ var import_liquidjs35 = __require("liquidjs");
15663
+ function bind17(liquidSwell) {
15664
+ return class IncludeTag extends import_liquidjs35.IncludeTag {
15496
15665
  *render(ctx, emitter) {
15497
15666
  const { hash } = this;
15498
15667
  const filepath = yield renderFilePath(
@@ -15500,13 +15669,13 @@ ${injects.join("\n")}<\/script>`;
15500
15669
  ctx,
15501
15670
  this.liquid
15502
15671
  );
15503
- (0, import_liquidjs30.assert)(filepath, () => `illegal file path "${filepath}"`);
15672
+ (0, import_liquidjs35.assert)(filepath, () => `illegal file path "${filepath}"`);
15504
15673
  const saved = ctx.saveRegister("blocks", "blockMode");
15505
15674
  ctx.setRegister("blocks", {});
15506
15675
  ctx.setRegister("blockMode", 0);
15507
15676
  const scope = yield hash.render(ctx);
15508
15677
  if (this.withVar) {
15509
- scope[filepath] = yield (0, import_liquidjs30.evalToken)(this.withVar, ctx);
15678
+ scope[filepath] = yield (0, import_liquidjs35.evalToken)(this.withVar, ctx);
15510
15679
  }
15511
15680
  ctx.push(ctx.opts.jekyllInclude ? { include: scope } : scope);
15512
15681
  const output = yield liquidSwell.getComponentPath(filepath).then((path) => liquidSwell.getThemeConfig(path)).then((themeConfig) => liquidSwell.renderTemplate(themeConfig, ctx));
@@ -15518,10 +15687,10 @@ ${injects.join("\n")}<\/script>`;
15518
15687
  }
15519
15688
 
15520
15689
  // src/liquid/tags/shopify/schema.ts
15521
- var import_liquidjs31 = __require("liquidjs");
15690
+ var import_liquidjs36 = __require("liquidjs");
15522
15691
  var import_json55 = __toESM(__require("json5"), 1);
15523
- function bind16(liquidSwell) {
15524
- return class SchemaTag extends import_liquidjs31.Tag {
15692
+ function bind18(liquidSwell) {
15693
+ return class SchemaTag extends import_liquidjs36.Tag {
15525
15694
  templates;
15526
15695
  constructor(token, remainTokens, liquid, parser) {
15527
15696
  super(token, remainTokens, liquid);
@@ -15543,6 +15712,7 @@ ${injects.join("\n")}<\/script>`;
15543
15712
  liquidSwell.lastSchema = void 0;
15544
15713
  if (typeof jsonOutput === "string") {
15545
15714
  liquidSwell.lastSchema = import_json55.default.parse(jsonOutput);
15715
+ expandThemeBlocks(liquidSwell);
15546
15716
  }
15547
15717
  } catch (err) {
15548
15718
  console.warn(err);
@@ -15552,11 +15722,22 @@ ${injects.join("\n")}<\/script>`;
15552
15722
  }
15553
15723
  };
15554
15724
  }
15725
+ function expandThemeBlocks(liquidSwell) {
15726
+ const blocks = liquidSwell.lastSchema?.blocks;
15727
+ if (!Array.isArray(blocks)) {
15728
+ return;
15729
+ }
15730
+ for (let i = 0; i < blocks.length; i++) {
15731
+ if (blocks[i].type === "@theme") {
15732
+ blocks.splice(i, 1, ...liquidSwell.theme.getAllThemeBlockSchemas());
15733
+ }
15734
+ }
15735
+ }
15555
15736
 
15556
15737
  // src/liquid/tags/inline_editable.ts
15557
- var import_liquidjs32 = __require("liquidjs");
15558
- function bind17(_liquidSwell) {
15559
- return class InlineEditableTag extends import_liquidjs32.Tag {
15738
+ var import_liquidjs37 = __require("liquidjs");
15739
+ function bind19(_liquidSwell) {
15740
+ return class InlineEditableTag extends import_liquidjs37.Tag {
15560
15741
  key;
15561
15742
  value;
15562
15743
  constructor(token, remainTokens, liquid, _parser) {
@@ -15584,129 +15765,131 @@ ${injects.join("\n")}<\/script>`;
15584
15765
  assign: bind,
15585
15766
  case: bind2,
15586
15767
  comment: bind3,
15587
- for: bind4,
15588
- form: bind5,
15589
- if: bind6,
15590
- javascript: bind7,
15591
- layout: bind8,
15592
- paginate: bind9,
15593
- render: bind10,
15594
- section: bind11,
15595
- sections: bind12,
15596
- style: bind13,
15768
+ content_for: bind4,
15769
+ doc: bind5,
15770
+ for: bind6,
15771
+ form: bind7,
15772
+ if: bind8,
15773
+ javascript: bind9,
15774
+ layout: bind10,
15775
+ paginate: bind11,
15776
+ render: bind12,
15777
+ section: bind13,
15778
+ sections: bind14,
15779
+ style: bind15,
15597
15780
  // Shopify compatibility only
15598
- include: bind15,
15599
- schema: bind16,
15600
- stylesheet: bind14,
15781
+ include: bind17,
15782
+ schema: bind18,
15783
+ stylesheet: bind16,
15601
15784
  // Swell only
15602
- inline_editable: bind17
15785
+ inline_editable: bind19
15603
15786
  };
15604
15787
  function bindTags(liquidSwell) {
15605
15788
  Object.entries(tags).forEach(
15606
- ([tag, bind67]) => liquidSwell.registerTag(tag, bind67(liquidSwell))
15789
+ ([tag, bind70]) => liquidSwell.registerTag(tag, bind70(liquidSwell))
15607
15790
  );
15608
15791
  }
15609
15792
 
15610
15793
  // src/liquid/filters/asset_url.ts
15611
- function bind18(liquidSwell) {
15794
+ function bind20(liquidSwell) {
15612
15795
  return function filterAssetUrl(assetPath) {
15613
15796
  return liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
15614
15797
  };
15615
15798
  }
15616
15799
 
15617
15800
  // src/liquid/filters/brightness_difference.ts
15618
- function bind19(_liquidSwell) {
15801
+ function bind21(_liquidSwell) {
15619
15802
  return (color1, color2) => {
15620
15803
  return ThemeColor.get(color1).brightnessDifference(ThemeColor.get(color2));
15621
15804
  };
15622
15805
  }
15623
15806
 
15624
15807
  // src/liquid/filters/color_brightness.ts
15625
- function bind20(_liquidSwell) {
15808
+ function bind22(_liquidSwell) {
15626
15809
  return (color) => {
15627
15810
  return ThemeColor.get(color).brightness();
15628
15811
  };
15629
15812
  }
15630
15813
 
15631
15814
  // src/liquid/filters/color_contrast.ts
15632
- function bind21(_liquidSwell) {
15815
+ function bind23(_liquidSwell) {
15633
15816
  return (color1, color2) => {
15634
15817
  return ThemeColor.get(color1).contrast(ThemeColor.get(color2));
15635
15818
  };
15636
15819
  }
15637
15820
 
15638
15821
  // src/liquid/filters/color_darken.ts
15639
- function bind22(_liquidSwell) {
15822
+ function bind24(_liquidSwell) {
15640
15823
  return (color, percent) => {
15641
15824
  return ThemeColor.get(color).darken(percent);
15642
15825
  };
15643
15826
  }
15644
15827
 
15645
15828
  // src/liquid/filters/color_desaturate.ts
15646
- function bind23(_liquidSwell) {
15829
+ function bind25(_liquidSwell) {
15647
15830
  return (color, value) => {
15648
15831
  return ThemeColor.get(color).desaturate(value);
15649
15832
  };
15650
15833
  }
15651
15834
 
15652
15835
  // src/liquid/filters/color_difference.ts
15653
- function bind24(_liquidSwell) {
15836
+ function bind26(_liquidSwell) {
15654
15837
  return (color1, color2) => {
15655
15838
  return ThemeColor.get(color1).difference(ThemeColor.get(color2));
15656
15839
  };
15657
15840
  }
15658
15841
 
15659
15842
  // src/liquid/filters/color_extract.ts
15660
- function bind25(_liquidSwell) {
15843
+ function bind27(_liquidSwell) {
15661
15844
  return (color, field) => {
15662
15845
  return ThemeColor.get(color).extract(field);
15663
15846
  };
15664
15847
  }
15665
15848
 
15666
15849
  // src/liquid/filters/color_lighten.ts
15667
- function bind26(_liquidSwell) {
15850
+ function bind28(_liquidSwell) {
15668
15851
  return (color, percent) => {
15669
15852
  return ThemeColor.get(color).lighten(percent);
15670
15853
  };
15671
15854
  }
15672
15855
 
15673
15856
  // src/liquid/filters/color_mix.ts
15674
- function bind27(_liquidSwell) {
15857
+ function bind29(_liquidSwell) {
15675
15858
  return (color1, color2, ratio) => {
15676
15859
  return ThemeColor.get(color1).mix(ThemeColor.get(color2), ratio);
15677
15860
  };
15678
15861
  }
15679
15862
 
15680
15863
  // src/liquid/filters/color_modify.ts
15681
- function bind28(_liquidSwell) {
15864
+ function bind30(_liquidSwell) {
15682
15865
  return function filterColorModify(color, field, value) {
15683
15866
  return ThemeColor.get(color).modify(field, Number(value) || 0);
15684
15867
  };
15685
15868
  }
15686
15869
 
15687
15870
  // src/liquid/filters/color_saturate.ts
15688
- function bind29(_liquidSwell) {
15871
+ function bind31(_liquidSwell) {
15689
15872
  return (color, value) => {
15690
15873
  return ThemeColor.get(color).saturate(value);
15691
15874
  };
15692
15875
  }
15693
15876
 
15694
15877
  // src/liquid/filters/color_to_hex.ts
15695
- function bind30(_liquidSwell) {
15878
+ function bind32(_liquidSwell) {
15696
15879
  return (color) => {
15697
15880
  return ThemeColor.get(color).hex();
15698
15881
  };
15699
15882
  }
15700
15883
 
15701
15884
  // src/liquid/filters/color_to_hsl.ts
15702
- function bind31(_liquidSwell) {
15885
+ function bind33(_liquidSwell) {
15703
15886
  return (color) => {
15704
15887
  return ThemeColor.get(color).hsl();
15705
15888
  };
15706
15889
  }
15707
15890
 
15708
15891
  // src/liquid/filters/color_to_rgb.ts
15709
- function bind32(_liquidSwell) {
15892
+ function bind34(_liquidSwell) {
15710
15893
  return (color, alpha) => {
15711
15894
  return alpha !== void 0 ? ThemeColor.get(color).rgba(alpha) : ThemeColor.get(color).rgb();
15712
15895
  };
@@ -15714,7 +15897,7 @@ ${injects.join("\n")}<\/script>`;
15714
15897
 
15715
15898
  // src/liquid/filters/date.ts
15716
15899
  var import_strftime = __toESM(__require("strftime"), 1);
15717
- function bind33(_liquidSwell) {
15900
+ function bind35(_liquidSwell) {
15718
15901
  return (dateValue, ...params) => {
15719
15902
  const date = ensureDate(dateValue);
15720
15903
  const { format } = getDateFilterParams(params);
@@ -15772,7 +15955,7 @@ ${injects.join("\n")}<\/script>`;
15772
15955
  }
15773
15956
 
15774
15957
  // src/liquid/filters/date_next_interval.ts
15775
- function bind34(_liquidSwell) {
15958
+ function bind36(_liquidSwell) {
15776
15959
  return (dateValue, interval, intervalCount) => {
15777
15960
  const date = ensureDate(dateValue);
15778
15961
  const result = getNextIntervalDate(date, interval, Number(intervalCount));
@@ -15824,7 +16007,7 @@ ${injects.join("\n")}<\/script>`;
15824
16007
  }
15825
16008
 
15826
16009
  // src/liquid/filters/default_errors.ts
15827
- function bind35(_liquidSwell) {
16010
+ function bind37(_liquidSwell) {
15828
16011
  return async function filterDefaultError(errors) {
15829
16012
  if (!errors) {
15830
16013
  return "";
@@ -15850,7 +16033,7 @@ ${injects.join("\n")}<\/script>`;
15850
16033
  }
15851
16034
 
15852
16035
  // src/liquid/filters/divided_by.ts
15853
- function bind36(_liquidSwell) {
16036
+ function bind38(_liquidSwell) {
15854
16037
  return (dividend, divisor, integerArithmetic) => {
15855
16038
  if (!isNumber(dividend) || !isNumber(divisor)) {
15856
16039
  return dividend;
@@ -15860,20 +16043,20 @@ ${injects.join("\n")}<\/script>`;
15860
16043
  }
15861
16044
 
15862
16045
  // src/liquid/filters/embedded_content.ts
15863
- var import_lodash_es10 = __require("lodash-es");
15864
- function bind37(_liquidSwell) {
16046
+ var import_lodash_es12 = __require("lodash-es");
16047
+ function bind39(_liquidSwell) {
15865
16048
  return (value, tag = "iframe") => {
15866
16049
  const escapeIframes = value.replaceAll(`<${tag}`, `&lt;${tag}`).replaceAll(`</${tag}`, `&lt;/${tag}`);
15867
16050
  const removeTags = escapeIframes.replaceAll(/<(.*?)>/gi, "");
15868
- const unescaped = (0, import_lodash_es10.unescape)(removeTags);
16051
+ const unescaped = (0, import_lodash_es12.unescape)(removeTags);
15869
16052
  const replaceSpaces = unescaped.replaceAll("&nbsp;", " ");
15870
16053
  return replaceSpaces;
15871
16054
  };
15872
16055
  }
15873
16056
 
15874
16057
  // src/liquid/filters/escape.ts
15875
- var import_lodash_es11 = __require("lodash-es");
15876
- function bind38(_liquidSwell) {
16058
+ var import_lodash_es13 = __require("lodash-es");
16059
+ function bind40(_liquidSwell) {
15877
16060
  return function escapeTag(input) {
15878
16061
  if (!input?.startsWith) {
15879
16062
  return input;
@@ -15881,12 +16064,12 @@ ${injects.join("\n")}<\/script>`;
15881
16064
  if (input.startsWith("<img") || input.startsWith("<video")) {
15882
16065
  return input;
15883
16066
  }
15884
- return (0, import_lodash_es11.escape)(input);
16067
+ return (0, import_lodash_es13.escape)(input);
15885
16068
  };
15886
16069
  }
15887
16070
 
15888
16071
  // src/liquid/filters/font_face.ts
15889
- function bind39(_liquidSwell) {
16072
+ function bind41(_liquidSwell) {
15890
16073
  return (fontSetting, ...params) => {
15891
16074
  if (!fontSetting) {
15892
16075
  return null;
@@ -15898,14 +16081,14 @@ ${injects.join("\n")}<\/script>`;
15898
16081
  }
15899
16082
 
15900
16083
  // src/liquid/filters/font_modify.ts
15901
- function bind40(_liquidSwell) {
16084
+ function bind42(_liquidSwell) {
15902
16085
  return (fontSetting, prop, value) => {
15903
16086
  return ThemeFont.clone(fontSetting).modify(prop, value);
15904
16087
  };
15905
16088
  }
15906
16089
 
15907
16090
  // src/liquid/filters/font_url.ts
15908
- function bind41(_liquidSwell) {
16091
+ function bind43(_liquidSwell) {
15909
16092
  return (fontSetting) => {
15910
16093
  return ThemeFont.get(fontSetting).url();
15911
16094
  };
@@ -15954,15 +16137,15 @@ ${injects.join("\n")}<\/script>`;
15954
16137
  };
15955
16138
 
15956
16139
  // src/liquid/filters/handleize.ts
15957
- var import_lodash_es12 = __require("lodash-es");
15958
- function bind42(_liquidSwell) {
16140
+ var import_lodash_es14 = __require("lodash-es");
16141
+ function bind44(_liquidSwell) {
15959
16142
  return function filterHandleize(handle) {
15960
- return (0, import_lodash_es12.kebabCase)(handle);
16143
+ return (0, import_lodash_es14.kebabCase)(handle);
15961
16144
  };
15962
16145
  }
15963
16146
 
15964
16147
  // src/liquid/filters/image_tag.ts
15965
- function bind43(_liquidSwell) {
16148
+ function bind45(_liquidSwell) {
15966
16149
  return function filterImageTag(imageUrl, ...params) {
15967
16150
  imageUrl = String(imageUrl || "");
15968
16151
  let {
@@ -16126,7 +16309,7 @@ ${injects.join("\n")}<\/script>`;
16126
16309
  var image_url_default = filterDefinition;
16127
16310
 
16128
16311
  // src/liquid/filters/inline_asset_content.ts
16129
- function bind44(liquidSwell) {
16312
+ function bind46(liquidSwell) {
16130
16313
  return async (assetPath) => {
16131
16314
  const config = await liquidSwell.theme.getThemeConfig(
16132
16315
  `theme/assets/${assetPath}`
@@ -16136,14 +16319,14 @@ ${injects.join("\n")}<\/script>`;
16136
16319
  }
16137
16320
 
16138
16321
  // src/liquid/filters/json.ts
16139
- function bind45(_liquidSwell) {
16322
+ function bind47(_liquidSwell) {
16140
16323
  return async function filterJson(input, space = 0) {
16141
16324
  return jsonStringifyAsync(input, space);
16142
16325
  };
16143
16326
  }
16144
16327
 
16145
16328
  // src/liquid/filters/json_pretty.ts
16146
- function bind46(_liquidSwell) {
16329
+ function bind48(_liquidSwell) {
16147
16330
  return async function filterJsonPretty(input, space = 2) {
16148
16331
  const output = await jsonStringifyAsync(input, space);
16149
16332
  return `<pre>${output}</pre>`;
@@ -16153,7 +16336,7 @@ ${injects.join("\n")}<\/script>`;
16153
16336
  // src/liquid/filters/locale_flag.ts
16154
16337
  var import_country_flag_icons = __require("country-flag-icons");
16155
16338
  var flags = __toESM(__require("country-flag-icons/string/1x1"), 1);
16156
- function bind47(_liquidSwell) {
16339
+ function bind49(_liquidSwell) {
16157
16340
  return (localeCode) => {
16158
16341
  if (typeof localeCode !== "string") {
16159
16342
  return flags.US;
@@ -16164,7 +16347,7 @@ ${injects.join("\n")}<\/script>`;
16164
16347
  }
16165
16348
 
16166
16349
  // src/liquid/filters/minus.ts
16167
- function bind48(_liquidSwell) {
16350
+ function bind50(_liquidSwell) {
16168
16351
  return (first, second) => {
16169
16352
  const firstValue = isNumber(first) ? first : 0;
16170
16353
  const secondValue = isNumber(second) ? second : 0;
@@ -16173,7 +16356,7 @@ ${injects.join("\n")}<\/script>`;
16173
16356
  }
16174
16357
 
16175
16358
  // src/liquid/filters/money.ts
16176
- function bind49(liquidSwell) {
16359
+ function bind51(liquidSwell) {
16177
16360
  return function filterMoney(value) {
16178
16361
  const amount = getMoneyAmount(liquidSwell, value);
16179
16362
  return liquidSwell.renderCurrency(amount);
@@ -16190,7 +16373,7 @@ ${injects.join("\n")}<\/script>`;
16190
16373
  }
16191
16374
 
16192
16375
  // src/liquid/filters/money_with_currency.ts
16193
- function bind50(liquidSwell) {
16376
+ function bind52(liquidSwell) {
16194
16377
  return function filterMoneyWithCurrency(value) {
16195
16378
  const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
16196
16379
  const amount = getMoneyAmount(liquidSwell, value);
@@ -16199,7 +16382,7 @@ ${injects.join("\n")}<\/script>`;
16199
16382
  }
16200
16383
 
16201
16384
  // src/liquid/filters/money_without_currency.ts
16202
- function bind51(liquidSwell) {
16385
+ function bind53(liquidSwell) {
16203
16386
  return function filterMoneyWithoutCurrency(value) {
16204
16387
  const amount = getMoneyAmount(liquidSwell, value);
16205
16388
  return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
@@ -16207,30 +16390,45 @@ ${injects.join("\n")}<\/script>`;
16207
16390
  }
16208
16391
 
16209
16392
  // src/liquid/filters/money_without_trailing_zeros.ts
16210
- function bind52(liquidSwell) {
16393
+ function bind54(liquidSwell) {
16211
16394
  return function filterMoneyWithoutTrailingZeros(value) {
16212
16395
  const amount = getMoneyAmount(liquidSwell, value);
16213
16396
  return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
16214
16397
  };
16215
16398
  }
16216
16399
 
16400
+ // src/liquid/filters/preload_tag.ts
16401
+ function bind55(_liquidSwell) {
16402
+ return function filterPreloadTag(assetUrl, ...params) {
16403
+ if (!assetUrl) {
16404
+ return "";
16405
+ }
16406
+ const { as } = paramsToProps(params);
16407
+ let attributes = "";
16408
+ if (typeof as === "string" && as) {
16409
+ attributes += `as="${as}"`;
16410
+ }
16411
+ return `<link href="${assetUrl}" rel="preload" ${attributes} />`;
16412
+ };
16413
+ }
16414
+
16217
16415
  // src/liquid/filters/script_tag.ts
16218
- function bind53(_liquidSwell) {
16416
+ function bind56(_liquidSwell) {
16219
16417
  return function filterScriptTag(assetUrl) {
16220
16418
  return `<script src="${assetUrl}" type="text/javascript"><\/script>`;
16221
16419
  };
16222
16420
  }
16223
16421
 
16224
16422
  // src/liquid/filters/stylesheet_tag.ts
16225
- function bind54(_liquidSwell) {
16423
+ function bind57(_liquidSwell) {
16226
16424
  return function filterStyleSheetTag(assetUrl) {
16227
16425
  return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
16228
16426
  };
16229
16427
  }
16230
16428
 
16231
16429
  // src/liquid/filters/time_tag.ts
16232
- function bind55(_liquidSwell) {
16233
- const dateFilter = bind33(_liquidSwell);
16430
+ function bind58(_liquidSwell) {
16431
+ const dateFilter = bind35(_liquidSwell);
16234
16432
  return (dateValue, ...params) => {
16235
16433
  const date = ensureDate(dateValue);
16236
16434
  const formattedDate = dateFilter(dateValue, ...params);
@@ -16240,7 +16438,7 @@ ${injects.join("\n")}<\/script>`;
16240
16438
  }
16241
16439
 
16242
16440
  // src/liquid/filters/translate.ts
16243
- function bind56(liquidSwell) {
16441
+ function bind59(liquidSwell) {
16244
16442
  return async function filterTranslate(key, params) {
16245
16443
  const props = params && paramsToProps(params);
16246
16444
  const str = await liquidSwell.renderTranslation(key, props);
@@ -16249,7 +16447,7 @@ ${injects.join("\n")}<\/script>`;
16249
16447
  }
16250
16448
 
16251
16449
  // src/liquid/filters/where.ts
16252
- function bind57(_liquidSwell) {
16450
+ function bind60(_liquidSwell) {
16253
16451
  return function* filterWhere(arr, property, expected) {
16254
16452
  const results = [];
16255
16453
  const list = yield resolveEnumerable(arr);
@@ -16303,7 +16501,7 @@ ${injects.join("\n")}<\/script>`;
16303
16501
  height: height ? Number(height) : void 0
16304
16502
  };
16305
16503
  }
16306
- function bind58(liquidSwell) {
16504
+ function bind61(liquidSwell) {
16307
16505
  return async function filterAssetImgUrl(assetPath, size = "small") {
16308
16506
  const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
16309
16507
  const sizes = getSizesFromParam(size);
@@ -16319,14 +16517,14 @@ ${injects.join("\n")}<\/script>`;
16319
16517
  }
16320
16518
 
16321
16519
  // src/liquid/filters/shopify/hex_to_rgba.ts
16322
- function bind59(_liquidSwell) {
16520
+ function bind62(_liquidSwell) {
16323
16521
  return (color, alpha) => {
16324
16522
  return ThemeColor.get(color).rgba(alpha || 1);
16325
16523
  };
16326
16524
  }
16327
16525
 
16328
16526
  // src/liquid/filters/shopify/img_url.ts
16329
- function bind60(liquidSwell) {
16527
+ function bind63(liquidSwell) {
16330
16528
  return async function filterImgUrl(input, ...params) {
16331
16529
  const url = await getImageUrlFromInput(input, liquidSwell);
16332
16530
  if (typeof url !== "string" || url === "") {
@@ -16364,14 +16562,14 @@ ${injects.join("\n")}<\/script>`;
16364
16562
  };
16365
16563
 
16366
16564
  // src/liquid/filters/shopify/payment_button.ts
16367
- function bind61(_liquidSwell) {
16565
+ function bind64(_liquidSwell) {
16368
16566
  return (form) => {
16369
16567
  return `<button style="display: block; visibility: hidden;"></button>`;
16370
16568
  };
16371
16569
  }
16372
16570
 
16373
16571
  // src/liquid/filters/shopify/payment_terms.ts
16374
- function bind62(_liquidSwell) {
16572
+ function bind65(_liquidSwell) {
16375
16573
  return (form) => {
16376
16574
  return null;
16377
16575
  };
@@ -16473,7 +16671,7 @@ ${injects.join("\n")}<\/script>`;
16473
16671
  var placeholder_svgs_default = svgs;
16474
16672
 
16475
16673
  // src/liquid/filters/shopify/placeholder_svg_tag.ts
16476
- function bind63(_liquidSwell) {
16674
+ function bind66(_liquidSwell) {
16477
16675
  return function filterPlaceholderSvgTag(name, className) {
16478
16676
  const svg = placeholder_svgs_default[name];
16479
16677
  if (typeof svg === "object" && svg !== null) {
@@ -16484,7 +16682,7 @@ ${injects.join("\n")}<\/script>`;
16484
16682
  }
16485
16683
 
16486
16684
  // src/liquid/filters/shopify/shopify_asset_url.ts
16487
- function bind64(_liquidSwell) {
16685
+ function bind67(_liquidSwell) {
16488
16686
  return function filterShopifyAssetUrl(input) {
16489
16687
  if (typeof input === "string") {
16490
16688
  switch (input) {
@@ -16509,7 +16707,7 @@ ${injects.join("\n")}<\/script>`;
16509
16707
  }
16510
16708
 
16511
16709
  // src/liquid/filters/shopify/structured_data.ts
16512
- function bind65(_liquidSwell) {
16710
+ function bind68(_liquidSwell) {
16513
16711
  return async function filterStructuredData(input) {
16514
16712
  let value = input;
16515
16713
  if (value instanceof StorefrontResource) {
@@ -16587,7 +16785,7 @@ ${injects.join("\n")}<\/script>`;
16587
16785
  }
16588
16786
 
16589
16787
  // src/liquid/filters/inline_editable.ts
16590
- function bind66(_liquidSwell) {
16788
+ function bind69(_liquidSwell) {
16591
16789
  return (value, key) => {
16592
16790
  if (typeof value === "object" && "value" in value) {
16593
16791
  value = value.value;
@@ -16598,64 +16796,65 @@ ${injects.join("\n")}<\/script>`;
16598
16796
 
16599
16797
  // src/liquid/filters/index.ts
16600
16798
  var filters = {
16601
- asset_url: bind18,
16602
- brightness_difference: bind19,
16603
- color_brightness: bind20,
16604
- color_contrast: bind21,
16605
- color_darken: bind22,
16606
- color_desaturate: bind23,
16607
- color_difference: bind24,
16608
- color_extract: bind25,
16609
- color_lighten: bind26,
16610
- color_mix: bind27,
16611
- color_modify: bind28,
16612
- color_saturate: bind29,
16613
- color_to_hex: bind30,
16614
- color_to_hsl: bind31,
16615
- color_to_rgb: bind32,
16616
- date_next_interval: bind34,
16617
- date: bind33,
16618
- default_errors: bind35,
16619
- divided_by: bind36,
16620
- embedded_content: bind37,
16621
- escape: bind38,
16622
- font_face: bind39,
16623
- font_modify: bind40,
16624
- font_url: bind41,
16799
+ asset_url: bind20,
16800
+ brightness_difference: bind21,
16801
+ color_brightness: bind22,
16802
+ color_contrast: bind23,
16803
+ color_darken: bind24,
16804
+ color_desaturate: bind25,
16805
+ color_difference: bind26,
16806
+ color_extract: bind27,
16807
+ color_lighten: bind28,
16808
+ color_mix: bind29,
16809
+ color_modify: bind30,
16810
+ color_saturate: bind31,
16811
+ color_to_hex: bind32,
16812
+ color_to_hsl: bind33,
16813
+ color_to_rgb: bind34,
16814
+ date_next_interval: bind36,
16815
+ date: bind35,
16816
+ default_errors: bind37,
16817
+ divided_by: bind38,
16818
+ embedded_content: bind39,
16819
+ escape: bind40,
16820
+ font_face: bind41,
16821
+ font_modify: bind42,
16822
+ font_url: bind43,
16625
16823
  format_address: format_address_default,
16626
- handle: bind42,
16824
+ handle: bind44,
16627
16825
  // alias
16628
- handleize: bind42,
16629
- image_tag: bind43,
16826
+ handleize: bind44,
16827
+ image_tag: bind45,
16630
16828
  image_url: image_url_default,
16631
- inline_asset_content: bind44,
16632
- json: bind45,
16633
- json_pretty: bind46,
16634
- locale_flag: bind47,
16635
- minus: bind48,
16636
- money: bind49,
16637
- money_with_currency: bind50,
16638
- money_without_currency: bind51,
16639
- money_without_trailing_zeros: bind52,
16640
- script_tag: bind53,
16641
- stylesheet_tag: bind54,
16642
- time_tag: bind55,
16643
- translate: bind56,
16644
- t: bind56,
16829
+ inline_asset_content: bind46,
16830
+ json: bind47,
16831
+ json_pretty: bind48,
16832
+ locale_flag: bind49,
16833
+ minus: bind50,
16834
+ money: bind51,
16835
+ money_with_currency: bind52,
16836
+ money_without_currency: bind53,
16837
+ money_without_trailing_zeros: bind54,
16838
+ preload_tag: bind55,
16839
+ script_tag: bind56,
16840
+ stylesheet_tag: bind57,
16841
+ time_tag: bind58,
16842
+ translate: bind59,
16843
+ t: bind59,
16645
16844
  // alias
16646
- where: bind57,
16845
+ where: bind60,
16647
16846
  // Shopify compatibility only
16648
- asset_img_url: bind58,
16649
- hex_to_rgba: bind59,
16650
- img_url: bind60,
16847
+ asset_img_url: bind61,
16848
+ hex_to_rgba: bind62,
16849
+ img_url: bind63,
16651
16850
  item_count_for_variant: item_count_for_variant_default,
16652
- payment_button: bind61,
16653
- payment_terms: bind62,
16654
- placeholder_svg_tag: bind63,
16655
- shopify_asset_url: bind64,
16656
- structured_data: bind65,
16851
+ payment_button: bind64,
16852
+ payment_terms: bind65,
16853
+ placeholder_svg_tag: bind66,
16854
+ shopify_asset_url: bind67,
16855
+ structured_data: bind68,
16657
16856
  // Swell only
16658
- inline_editable: bind66
16857
+ inline_editable: bind69
16659
16858
  };
16660
16859
  function bindFilters(liquidSwell) {
16661
16860
  for (const [tag, handler] of Object.entries(filters)) {
@@ -16669,8 +16868,8 @@ ${injects.join("\n")}<\/script>`;
16669
16868
  }
16670
16869
  }
16671
16870
  }
16672
- function bindWithResolvedProps(liquidSwell, bind67, resolve = []) {
16673
- const handler = bind67(liquidSwell);
16871
+ function bindWithResolvedProps(liquidSwell, bind70, resolve = []) {
16872
+ const handler = bind70(liquidSwell);
16674
16873
  if (!Array.isArray(resolve)) {
16675
16874
  return handler;
16676
16875
  }
@@ -16722,9 +16921,9 @@ ${injects.join("\n")}<\/script>`;
16722
16921
  }
16723
16922
 
16724
16923
  // src/liquid/operators.ts
16725
- var import_liquidjs33 = __require("liquidjs");
16924
+ var import_liquidjs38 = __require("liquidjs");
16726
16925
  var swellOperators = {
16727
- ...import_liquidjs33.defaultOperators,
16926
+ ...import_liquidjs38.defaultOperators,
16728
16927
  "==": equal,
16729
16928
  "!=": (l, r) => !equal(l, r),
16730
16929
  contains: (l, r) => {
@@ -16752,8 +16951,8 @@ ${injects.join("\n")}<\/script>`;
16752
16951
 
16753
16952
  // src/liquid/color.ts
16754
16953
  var import_color = __toESM(__require("color"), 1);
16755
- var import_liquidjs34 = __require("liquidjs");
16756
- var ThemeColor = class _ThemeColor extends import_liquidjs34.Drop {
16954
+ var import_liquidjs39 = __require("liquidjs");
16955
+ var ThemeColor = class _ThemeColor extends import_liquidjs39.Drop {
16757
16956
  color;
16758
16957
  colorValues;
16759
16958
  red;
@@ -16797,10 +16996,16 @@ ${injects.join("\n")}<\/script>`;
16797
16996
  return this.color.darken(percent / 100).hex().toLowerCase();
16798
16997
  }
16799
16998
  rgb() {
16800
- return this.color.rgb().toString();
16999
+ return `${this.red} ${this.green} ${this.blue}`;
16801
17000
  }
16802
17001
  rgba(alpha) {
16803
- return this.color.alpha(alpha).rgb().toString();
17002
+ const colorValues = this.color.object();
17003
+ const alphaValue = alpha || colorValues.alpha;
17004
+ const rgb = this.rgb();
17005
+ if (alphaValue === void 0) {
17006
+ return rgb;
17007
+ }
17008
+ return `${rgb} / ${Number(alphaValue).toFixed(2)}`;
16804
17009
  }
16805
17010
  hsl() {
16806
17011
  return this.color.hsl().round().toString();
@@ -16888,7 +17093,7 @@ ${injects.join("\n")}<\/script>`;
16888
17093
  }
16889
17094
 
16890
17095
  // src/liquid/index.ts
16891
- var LiquidSwell31 = class extends import_liquidjs35.Liquid {
17096
+ var LiquidSwell31 = class extends import_liquidjs40.Liquid {
16892
17097
  theme;
16893
17098
  getThemeConfig;
16894
17099
  getThemeTemplateConfigByType;
@@ -16905,6 +17110,7 @@ ${injects.join("\n")}<\/script>`;
16905
17110
  extName;
16906
17111
  componentsDir;
16907
17112
  sectionsDir;
17113
+ blocksDir;
16908
17114
  lastSchema;
16909
17115
  constructor({
16910
17116
  theme,
@@ -16922,7 +17128,8 @@ ${injects.join("\n")}<\/script>`;
16922
17128
  layoutName,
16923
17129
  extName,
16924
17130
  componentsDir,
16925
- sectionsDir
17131
+ sectionsDir,
17132
+ blocksDir
16926
17133
  }) {
16927
17134
  getThemeConfig = getThemeConfig || theme.getThemeConfig.bind(theme);
16928
17135
  extName = extName || "liquid";
@@ -16951,6 +17158,7 @@ ${injects.join("\n")}<\/script>`;
16951
17158
  this.extName = extName;
16952
17159
  this.componentsDir = componentsDir || "components";
16953
17160
  this.sectionsDir = sectionsDir || "sections";
17161
+ this.blocksDir = blocksDir || "blocks";
16954
17162
  this.lastSchema = void 0;
16955
17163
  bindTags(this);
16956
17164
  bindFilters(this);
@@ -16973,6 +17181,9 @@ ${injects.join("\n")}<\/script>`;
16973
17181
  async getSectionGroupPath(sectionName) {
16974
17182
  return await this.resolveFilePathByType("sections", `${sectionName}.json`) || resolveFilePath(`${this.sectionsDir}/${sectionName}`, "json");
16975
17183
  }
17184
+ async getThemeBlockPath(blockName) {
17185
+ return await this.resolveFilePathByType("blocks", blockName) || resolveFilePath(`${this.blocksDir}/${blockName}`, this.extName);
17186
+ }
16976
17187
  };
16977
17188
  function resolveFilePath(fileName, extName) {
16978
17189
  return `theme/${fileName}.${extName}`;
@@ -17372,11 +17583,11 @@ ${injects.join("\n")}<\/script>`;
17372
17583
  };
17373
17584
 
17374
17585
  // src/globals.ts
17375
- var import_lodash_es13 = __require("lodash-es");
17586
+ var import_lodash_es15 = __require("lodash-es");
17376
17587
 
17377
17588
  // src/compatibility/drops/robots-rule.ts
17378
- var import_liquidjs36 = __require("liquidjs");
17379
- var RobotsRule = class _RobotsRule extends import_liquidjs36.Drop {
17589
+ var import_liquidjs41 = __require("liquidjs");
17590
+ var RobotsRule = class _RobotsRule extends import_liquidjs41.Drop {
17380
17591
  constructor(directive, value) {
17381
17592
  super();
17382
17593
  this.directive = directive;
@@ -17472,7 +17683,7 @@ ${injects.join("\n")}<\/script>`;
17472
17683
  }).filter(Boolean).join("\n");
17473
17684
  }
17474
17685
  function getRobotsGlobals(canonicalUrl) {
17475
- const sitemapUrl = `${(0, import_lodash_es13.trimEnd)(canonicalUrl, "/")}/sitemap.xml`;
17686
+ const sitemapUrl = `${(0, import_lodash_es15.trimEnd)(canonicalUrl, "/")}/sitemap.xml`;
17476
17687
  const defaultRules = [
17477
17688
  { directive: "Disallow", value: "/admin" },
17478
17689
  { directive: "Disallow", value: "/cart" },
@@ -17967,7 +18178,7 @@ ${injects.join("\n")}<\/script>`;
17967
18178
  return languageConfig;
17968
18179
  }
17969
18180
  const localeShortCode = locale.split("-")[0];
17970
- return (0, import_lodash_es14.reduce)(
18181
+ return (0, import_lodash_es16.reduce)(
17971
18182
  languageConfig,
17972
18183
  (acc, value, key) => {
17973
18184
  if (isObject2(value)) {
@@ -17991,15 +18202,15 @@ ${injects.join("\n")}<\/script>`;
17991
18202
  const translationEnd = translationParts.pop();
17992
18203
  const translationPath = translationParts.join(".");
17993
18204
  const translationConfigGlobal = this.globals.language;
17994
- acc[key] = (0, import_lodash_es14.get)(
18205
+ acc[key] = (0, import_lodash_es16.get)(
17995
18206
  translationConfigGlobal,
17996
18207
  `${translationPath}.$locale.${locale}.${translationEnd}`
17997
- ) || (0, import_lodash_es14.get)(
18208
+ ) || (0, import_lodash_es16.get)(
17998
18209
  translationConfigGlobal,
17999
18210
  `${translationPath}.$locale.${localeShortCode}.${translationEnd}`
18000
- ) || (0, import_lodash_es14.get)(translationConfigGlobal, translationKey) || value;
18211
+ ) || (0, import_lodash_es16.get)(translationConfigGlobal, translationKey) || value;
18001
18212
  } else {
18002
- acc[key] = (0, import_lodash_es14.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es14.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
18213
+ acc[key] = (0, import_lodash_es16.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es16.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
18003
18214
  }
18004
18215
  }
18005
18216
  return acc;
@@ -18684,6 +18895,30 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18684
18895
  const configs = this.getThemeConfigsByPath("theme/sections/");
18685
18896
  return getAllSections(configs, this.getTemplateSchema.bind(this));
18686
18897
  }
18898
+ /**
18899
+ * Returns all theme block schemas from /blocks folder.
18900
+ */
18901
+ getAllThemeBlockSchemas() {
18902
+ const schemas = [];
18903
+ const configs = this.getThemeConfigsByPath("theme/blocks/");
18904
+ for (const config of configs.values()) {
18905
+ const { name, file_path: filePath, file_data: fileData } = config;
18906
+ const rawSchema = extractSchemaTag(fileData, true);
18907
+ if (!rawSchema) {
18908
+ continue;
18909
+ }
18910
+ try {
18911
+ const schema = import_json56.default.parse(rawSchema);
18912
+ if (!schema.type) {
18913
+ schema.type = name;
18914
+ }
18915
+ schemas.push(schema);
18916
+ } catch (error) {
18917
+ console.warn(`Invalid schema in block: ${filePath}`, error);
18918
+ }
18919
+ }
18920
+ return schemas;
18921
+ }
18687
18922
  async getPageSections(sectionGroup, resolveSettings = true) {
18688
18923
  const sectionConfigs = await getPageSections(
18689
18924
  sectionGroup,
@@ -18835,8 +19070,8 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18835
19070
  const keyParts = key?.split(".") || [];
18836
19071
  const keyName = keyParts.pop() || "";
18837
19072
  const keyPath = keyParts.join(".");
18838
- const langObject = (0, import_lodash_es14.get)(langConfig, keyPath);
18839
- let localeValue = (0, import_lodash_es14.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es14.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
19073
+ const langObject = (0, import_lodash_es16.get)(langConfig, keyPath);
19074
+ let localeValue = (0, import_lodash_es16.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es16.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
18840
19075
  if (data?.count !== void 0 && localeValue?.one) {
18841
19076
  localeValue = data.count === 1 ? localeValue.one : localeValue.other;
18842
19077
  }
@@ -18916,7 +19151,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18916
19151
  }
18917
19152
  }
18918
19153
  function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
18919
- const settings = (0, import_lodash_es14.cloneDeep)(themeSettings);
19154
+ const settings = (0, import_lodash_es16.cloneDeep)(themeSettings);
18920
19155
  if (settings.$locale) {
18921
19156
  const { locale } = theme.swell.getStorefrontLocalization();
18922
19157
  const localeConfig = settings.$locale[locale] || {};
@@ -18926,16 +19161,16 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18926
19161
  }
18927
19162
  }
18928
19163
  }
18929
- (0, import_lodash_es14.each)(settings, (value, key) => {
19164
+ (0, import_lodash_es16.each)(settings, (value, key) => {
18930
19165
  const setting = (editorSchemaSettings && findEditorSetting(editorSchemaSettings, key)) ?? null;
18931
19166
  if (isObject2(value) && !(value instanceof StorefrontResource)) {
18932
19167
  switch (setting?.type) {
18933
19168
  case "color_scheme_group": {
18934
- (0, import_lodash_es14.each)(value, (scheme, schemeId) => {
19169
+ (0, import_lodash_es16.each)(value, (scheme, schemeId) => {
18935
19170
  if (isObject2(scheme) && typeof scheme.settings === "object" && scheme.settings) {
18936
19171
  const settings2 = scheme.settings;
18937
- (0, import_lodash_es14.each)(settings2, (colorValue, colorId) => {
18938
- const fieldDef = (0, import_lodash_es14.find)(setting.fields, { id: colorId });
19172
+ (0, import_lodash_es16.each)(settings2, (colorValue, colorId) => {
19173
+ const fieldDef = (0, import_lodash_es16.find)(setting.fields, { id: colorId });
18939
19174
  if (fieldDef?.type === "color" && colorValue) {
18940
19175
  scheme.id = schemeId;
18941
19176
  settings2[colorId] = new ThemeColor(colorValue);
@@ -18986,7 +19221,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18986
19221
  }
18987
19222
  function findThemeSettingsByType(type, themeSettings, editorSchemaSettings) {
18988
19223
  const foundSettings = [];
18989
- (0, import_lodash_es14.each)(themeSettings, (value, key) => {
19224
+ (0, import_lodash_es16.each)(themeSettings, (value, key) => {
18990
19225
  if (isObject2(value) && !(value instanceof ThemeFont) && !(value instanceof StorefrontResource)) {
18991
19226
  foundSettings.push(
18992
19227
  ...findThemeSettingsByType(type, value, editorSchemaSettings)
@@ -19044,14 +19279,14 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
19044
19279
  return {};
19045
19280
  }
19046
19281
  }
19047
- function extractSchemaTag(template) {
19282
+ function extractSchemaTag(template, inner = false) {
19048
19283
  const list = template.match(
19049
19284
  /\{%-?\s*schema\s*-?%\}(.*)\{%-?\s*endschema\s*-?%\}/s
19050
19285
  );
19051
19286
  if (list === null) {
19052
19287
  return template;
19053
19288
  }
19054
- return list[0];
19289
+ return inner ? list[1] : list[0];
19055
19290
  }
19056
19291
  function withSuffix(path, suffix) {
19057
19292
  return suffix ? `${path}.${suffix}` : path;
@@ -19160,7 +19395,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
19160
19395
  }
19161
19396
  function getMenuItemValueId(value) {
19162
19397
  const fallback = typeof value === "string" ? value : "";
19163
- const slug = (0, import_lodash_es15.get)(value, "id", (0, import_lodash_es15.get)(value, "slug", fallback)) || "";
19398
+ const slug = (0, import_lodash_es17.get)(value, "id", (0, import_lodash_es17.get)(value, "slug", fallback)) || "";
19164
19399
  return slug;
19165
19400
  }
19166
19401
  async function getMenuItemUrlAndResource(theme, menuItem) {