@swell/apps-sdk 1.0.186 → 1.0.188

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3652,7 +3652,15 @@ function resolveSectionPresets(schema) {
3652
3652
  }, {}),
3653
3653
  ...preset.settings || void 0
3654
3654
  },
3655
- blocks: preset.blocks?.map((block) => {
3655
+ blocks: resolveSectionBlockPresets(preset, schema)
3656
+ }));
3657
+ }
3658
+ function resolveSectionBlockPresets(preset, schema) {
3659
+ if (!preset.blocks) {
3660
+ return;
3661
+ }
3662
+ if (Array.isArray(preset.blocks)) {
3663
+ return preset.blocks.map((block) => {
3656
3664
  const blockDef = schema.blocks?.find((b) => b.type === block.type);
3657
3665
  return blockDef ? {
3658
3666
  ...block,
@@ -3666,8 +3674,9 @@ function resolveSectionPresets(schema) {
3666
3674
  ...block.settings || void 0
3667
3675
  }
3668
3676
  } : block;
3669
- })
3670
- }));
3677
+ });
3678
+ }
3679
+ return Object.values(preset.blocks);
3671
3680
  }
3672
3681
  async function getLayoutSectionGroups(allSections, renderTemplateSchema) {
3673
3682
  const allSectionsList = Array.from(allSections.values());
@@ -3744,7 +3753,15 @@ async function getPageSections(sectionGroup, getSchema) {
3744
3753
  };
3745
3754
  const id = sectionGroup.id ? `page__${sectionGroup.id}__${key}` : schema.id;
3746
3755
  const blockOrder = Array.isArray(section.block_order) ? section.block_order : Object.keys(section.blocks || {});
3747
- const blocks = blockOrder.map((key2) => section.blocks?.[key2]).filter(Boolean);
3756
+ const blocks = blockOrder.map((key2) => {
3757
+ const block = section.blocks?.[key2];
3758
+ if (block) {
3759
+ return {
3760
+ ...block,
3761
+ id: `${schema.id}__${key2}`
3762
+ };
3763
+ }
3764
+ }).filter(Boolean);
3748
3765
  const settings = {
3749
3766
  section: {
3750
3767
  id,
@@ -4966,12 +4983,17 @@ function transformSwellVariant(params, product, variant) {
4966
4983
  var SwellVariant = class extends SwellStorefrontRecord {
4967
4984
  product;
4968
4985
  constructor(swell, product, id, query) {
4986
+ const params = swell.queryParams;
4969
4987
  super(swell, "products:variants", id, query, async function() {
4970
4988
  const variant = await this._swell.get(
4971
- "/products:variants/{id}",
4972
- { id: this._id }
4989
+ "/products:variants/:last",
4990
+ { $or: [{ id: this._id }, { sku: this._id }] }
4991
+ );
4992
+ return transformSwellVariant(
4993
+ params,
4994
+ product instanceof SwellStorefrontRecord ? await product.resolve() : product,
4995
+ variant
4973
4996
  );
4974
- return variant ?? null;
4975
4997
  });
4976
4998
  this.product = product;
4977
4999
  }
@@ -5738,7 +5760,7 @@ function getAllSectionComponents(allSections) {
5738
5760
  // TODO: figure out how to make this work, doesn't work for collections normally
5739
5761
  defaultValue: section.presets?.reduce(
5740
5762
  (acc, preset, index) => {
5741
- if (!preset.blocks) {
5763
+ if (!preset.blocks || !Array.isArray(preset.blocks)) {
5742
5764
  return acc;
5743
5765
  }
5744
5766
  return preset.blocks.reduce(
@@ -5945,7 +5967,7 @@ function getAllSectionComponentTemplates(allSections) {
5945
5967
  custom_css: preset.settings?.["custom_css"] || "",
5946
5968
  ...processFields(section.fields, preset.settings),
5947
5969
  // Process blocks inside the preset
5948
- Blocks: (preset.blocks || []).map((block) => {
5970
+ Blocks: (Array.isArray(preset.blocks) ? preset.blocks : []).map((block) => {
5949
5971
  const blockSchema = section.blocks?.find(
5950
5972
  ({ type }) => type === block.type
5951
5973
  );
@@ -6405,11 +6427,11 @@ function getRandomId() {
6405
6427
  }
6406
6428
 
6407
6429
  // src/menus.ts
6408
- var import_lodash_es15 = require("lodash-es");
6430
+ var import_lodash_es17 = require("lodash-es");
6409
6431
 
6410
6432
  // src/theme.ts
6411
6433
  var import_json56 = __toESM(require("json5"), 1);
6412
- var import_lodash_es14 = require("lodash-es");
6434
+ var import_lodash_es16 = require("lodash-es");
6413
6435
 
6414
6436
  // src/compatibility/shopify.ts
6415
6437
  var import_lodash_es7 = require("lodash-es");
@@ -11704,16 +11726,16 @@ function ShopifyBlog(instance, blogCategory) {
11704
11726
  if (!Array.isArray(blogs?.results)) {
11705
11727
  return [];
11706
11728
  }
11707
- const set3 = blogs.results.reduce(
11708
- (set4, blog) => {
11729
+ const set4 = blogs.results.reduce(
11730
+ (set5, blog) => {
11709
11731
  for (const tag of blog.tags || []) {
11710
- set4.add(tag);
11732
+ set5.add(tag);
11711
11733
  }
11712
- return set4;
11734
+ return set5;
11713
11735
  },
11714
11736
  /* @__PURE__ */ new Set()
11715
11737
  );
11716
- return Array.from(set3.values());
11738
+ return Array.from(set4.values());
11717
11739
  });
11718
11740
  return new ShopifyResource({
11719
11741
  all_tags: allTags,
@@ -12097,18 +12119,18 @@ function ShopifyCollection(instance, category) {
12097
12119
  if (!resolved) {
12098
12120
  return [];
12099
12121
  }
12100
- const set3 = /* @__PURE__ */ new Set();
12122
+ const set4 = /* @__PURE__ */ new Set();
12101
12123
  await Promise.all(
12102
12124
  resolved.results.map(async (product) => {
12103
12125
  const tags2 = await Promise.resolve().then(() => product.tags);
12104
12126
  if (Array.isArray(tags2)) {
12105
12127
  for (const tag of tags2) {
12106
- set3.add(tag);
12128
+ set4.add(tag);
12107
12129
  }
12108
12130
  }
12109
12131
  })
12110
12132
  );
12111
- return Array.from(set3.values());
12133
+ return Array.from(set4.values());
12112
12134
  }),
12113
12135
  all_types: defer(async () => {
12114
12136
  const products = await resolveProducts();
@@ -14696,6 +14718,8 @@ ${injects.join("\n")}</script>`;
14696
14718
  return `templates/${this.getPageType(name)}`;
14697
14719
  case "sections":
14698
14720
  return `sections/${name}`;
14721
+ case "blocks":
14722
+ return `blocks/${name}`;
14699
14723
  default:
14700
14724
  throw new Error(`Theme file type not supported: ${type}`);
14701
14725
  }
@@ -14869,7 +14893,7 @@ var RenderDrop = class extends import_liquidjs15.Drop {
14869
14893
  };
14870
14894
 
14871
14895
  // src/liquid/index.ts
14872
- var import_liquidjs35 = require("liquidjs");
14896
+ var import_liquidjs40 = require("liquidjs");
14873
14897
 
14874
14898
  // src/utils/escape.ts
14875
14899
  function replacerUnescape(match) {
@@ -15042,14 +15066,161 @@ function bind3(_liquidSwell) {
15042
15066
  };
15043
15067
  }
15044
15068
 
15045
- // src/liquid/tags/for.ts
15069
+ // src/liquid/tags/content_for.ts
15070
+ var import_liquidjs22 = require("liquidjs");
15071
+ var import_lodash_es10 = require("lodash-es");
15072
+
15073
+ // src/liquid/hash.ts
15074
+ var import_lodash_es9 = require("lodash-es");
15075
+ var import_liquidjs21 = require("liquidjs");
15076
+
15077
+ // src/liquid/tokienizer.ts
15078
+ var import_liquidjs20 = require("liquidjs");
15079
+
15080
+ // src/liquid/tokens/identifier-token.ts
15046
15081
  var import_liquidjs19 = require("liquidjs");
15082
+ var IdentifierToken = class extends import_liquidjs19.Token {
15083
+ constructor(input, begin, end, file) {
15084
+ super(import_liquidjs19.TokenKind.Word, input, begin, end, file);
15085
+ this.input = input;
15086
+ this.begin = begin;
15087
+ this.end = end;
15088
+ this.file = file;
15089
+ this.content = this.getText();
15090
+ }
15091
+ content;
15092
+ };
15093
+
15094
+ // src/liquid/tokienizer.ts
15095
+ var isNumber2 = (c) => c >= "0" && c <= "9";
15096
+ var isCharacter = (c) => c >= "a" && c <= "z" || c >= "A" && c <= "Z";
15097
+ var isWord = (c) => "_-?".includes(c) || isCharacter(c) || isNumber2(c);
15098
+ var TokenizerSwell = class extends import_liquidjs20.Tokenizer {
15099
+ readIdentifier() {
15100
+ this.skipBlank();
15101
+ const begin = this.p;
15102
+ while (!this.end()) {
15103
+ const char = this.peek();
15104
+ if (isWord(char) || char === ".") {
15105
+ this.p++;
15106
+ } else {
15107
+ break;
15108
+ }
15109
+ }
15110
+ return new IdentifierToken(this.input, begin, this.p, this.file);
15111
+ }
15112
+ };
15113
+
15114
+ // src/liquid/hash.ts
15115
+ var HashSwell = class extends import_liquidjs21.Hash {
15116
+ constructor(input, jekyllStyle) {
15117
+ super(input, jekyllStyle);
15118
+ const tokenizer = input instanceof import_liquidjs21.Tokenizer ? input : new TokenizerSwell(input, {});
15119
+ for (const hash of tokenizer.readHashes(jekyllStyle)) {
15120
+ this.hash[hash.name.content] = hash.value;
15121
+ }
15122
+ }
15123
+ *render(ctx) {
15124
+ const hash = {};
15125
+ for (const key of Object.keys(this.hash)) {
15126
+ const token = this.hash[key];
15127
+ if (token !== void 0) {
15128
+ const value = yield (0, import_liquidjs21.evalToken)(token, ctx);
15129
+ (0, import_lodash_es9.set)(hash, key, value);
15130
+ }
15131
+ }
15132
+ return hash;
15133
+ }
15134
+ };
15135
+
15136
+ // src/liquid/tags/content_for.ts
15137
+ function bind4(liquidSwell) {
15138
+ return class ContentForTag extends import_liquidjs22.Tag {
15139
+ name;
15140
+ hash;
15141
+ constructor(token, remainTokens, liquid) {
15142
+ super(token, remainTokens, liquid);
15143
+ const tokenizer = token.tokenizer;
15144
+ this.name = tokenizer.readValue()?.content;
15145
+ this.hash = new HashSwell(tokenizer.remaining());
15146
+ }
15147
+ *render(ctx, emitter) {
15148
+ const section = yield ctx._get(["section"]);
15149
+ const block = yield ctx._get(["block"]);
15150
+ const hash = yield this.hash.render(ctx);
15151
+ const blocks = this.getBlocks(section, block, hash);
15152
+ for (const block2 of blocks) {
15153
+ if (!isObject2(block2) || typeof block2.type !== "string") {
15154
+ continue;
15155
+ }
15156
+ const blockPath = yield liquidSwell.getThemeBlockPath(
15157
+ block2.type
15158
+ );
15159
+ if (!blockPath) {
15160
+ continue;
15161
+ }
15162
+ const childCtx = ctx.spawn();
15163
+ const scope = childCtx.bottom();
15164
+ (0, import_lodash_es10.assign)(scope, { section });
15165
+ (0, import_lodash_es10.assign)(scope, { block: block2 });
15166
+ (0, import_lodash_es10.assign)(scope, hash);
15167
+ const templates = yield this.liquid._parseFile(
15168
+ blockPath,
15169
+ childCtx.sync
15170
+ );
15171
+ yield this.liquid.renderer.renderTemplates(
15172
+ templates,
15173
+ childCtx,
15174
+ emitter
15175
+ );
15176
+ }
15177
+ }
15178
+ getBlocks(section, block, hash) {
15179
+ const blockConfigs = this.getBlockConfigs(section, block);
15180
+ if (!isObject2(hash) || !hash.type) {
15181
+ return blockConfigs;
15182
+ }
15183
+ const blockConfig = blockConfigs.find(
15184
+ (blockConfig2) => isObject2(blockConfig2) && blockConfig2.type === hash.type
15185
+ );
15186
+ return blockConfig ? [blockConfig] : [];
15187
+ }
15188
+ getBlockConfigs(section, block) {
15189
+ if (isObject2(block) && block.blocks) {
15190
+ return Object.values(block.blocks);
15191
+ }
15192
+ if (isObject2(section) && Array.isArray(section.blocks)) {
15193
+ return section.blocks;
15194
+ }
15195
+ return [];
15196
+ }
15197
+ };
15198
+ }
15199
+
15200
+ // src/liquid/tags/doc.ts
15201
+ var import_liquidjs23 = require("liquidjs");
15202
+ function bind5() {
15203
+ return class DocTag extends import_liquidjs23.Tag {
15204
+ constructor(token, remainTokens, liquid, parser) {
15205
+ super(token, remainTokens, liquid);
15206
+ const stream = parser.parseStream(remainTokens).on("tag:enddoc", () => {
15207
+ stream.stop();
15208
+ });
15209
+ stream.start();
15210
+ }
15211
+ render() {
15212
+ }
15213
+ };
15214
+ }
15215
+
15216
+ // src/liquid/tags/for.ts
15217
+ var import_liquidjs24 = require("liquidjs");
15047
15218
  var MODIFIERS = Object.freeze(["offset", "limit", "reversed"]);
15048
- function bind4(_liquidSwell) {
15049
- return class ForTag extends import_liquidjs19.ForTag {
15219
+ function bind6(_liquidSwell) {
15220
+ return class ForTag extends import_liquidjs24.ForTag {
15050
15221
  *render(ctx, emitter) {
15051
15222
  const r = this.liquid.renderer;
15052
- let collection = yield (0, import_liquidjs19.evalToken)(this.collection, ctx);
15223
+ let collection = yield (0, import_liquidjs24.evalToken)(this.collection, ctx);
15053
15224
  collection = yield resolveEnumerable(collection);
15054
15225
  if (!collection.length) {
15055
15226
  yield r.renderTemplates(this.elseTemplates, ctx, emitter);
@@ -15116,10 +15287,10 @@ function limit(arr, count) {
15116
15287
  }
15117
15288
 
15118
15289
  // src/liquid/tags/form.ts
15119
- var import_liquidjs20 = require("liquidjs");
15290
+ var import_liquidjs25 = require("liquidjs");
15120
15291
  var IGNORED_SHOPIFY_FORMS = Object.freeze(["new_comment", "guest_login"]);
15121
- function bind5(liquidSwell) {
15122
- return class FormTag extends import_liquidjs20.Tag {
15292
+ function bind7(liquidSwell) {
15293
+ return class FormTag extends import_liquidjs25.Tag {
15123
15294
  formType;
15124
15295
  formConfig;
15125
15296
  templates;
@@ -15132,10 +15303,10 @@ function bind5(liquidSwell) {
15132
15303
  this.formConfig = liquidSwell.theme.getFormConfig(this.formType);
15133
15304
  this.arg = tokenizer.readValue();
15134
15305
  this.templates = [];
15135
- this.hash = new import_liquidjs20.Hash(this.tokenizer.remaining());
15306
+ this.hash = new import_liquidjs25.Hash(this.tokenizer.remaining());
15136
15307
  while (remainTokens.length > 0) {
15137
15308
  const token2 = remainTokens.shift();
15138
- if (import_liquidjs20.TypeGuards.isTagToken(token2) && token2.name === "endform") {
15309
+ if (import_liquidjs25.TypeGuards.isTagToken(token2) && token2.name === "endform") {
15139
15310
  return;
15140
15311
  }
15141
15312
  this.templates.push(parser.parseToken(token2, remainTokens));
@@ -15153,7 +15324,7 @@ function bind5(liquidSwell) {
15153
15324
  return;
15154
15325
  }
15155
15326
  const r = this.liquid.renderer;
15156
- const arg = yield (0, import_liquidjs20.evalToken)(this.arg, ctx);
15327
+ const arg = yield (0, import_liquidjs25.evalToken)(this.arg, ctx);
15157
15328
  const hash = yield this.hash.render(ctx);
15158
15329
  const scope = ctx.getAll();
15159
15330
  const attrs = " " + Object.entries({ id: `${this.formConfig.id}_form`, ...hash }).reduce((acc, [key, value]) => {
@@ -15214,9 +15385,9 @@ function bind5(liquidSwell) {
15214
15385
  }
15215
15386
 
15216
15387
  // src/liquid/tags/if.ts
15217
- var import_liquidjs21 = require("liquidjs");
15218
- function bind6(_liquidSwell) {
15219
- return class IfTag extends import_liquidjs21.Tag {
15388
+ var import_liquidjs26 = require("liquidjs");
15389
+ function bind8(_liquidSwell) {
15390
+ return class IfTag extends import_liquidjs26.Tag {
15220
15391
  branches = [];
15221
15392
  elseTemplates;
15222
15393
  constructor(tagToken, remainTokens, liquid, parser) {
@@ -15225,22 +15396,22 @@ function bind6(_liquidSwell) {
15225
15396
  parser.parseStream(remainTokens).on(
15226
15397
  "start",
15227
15398
  () => this.branches.push({
15228
- value: new import_liquidjs21.Value(
15399
+ value: new import_liquidjs26.Value(
15229
15400
  tagToken.tokenizer.readFilteredValue(),
15230
15401
  this.liquid
15231
15402
  ),
15232
15403
  templates: p = []
15233
15404
  })
15234
15405
  ).on("tag:elsif", (token) => {
15235
- (0, import_liquidjs21.assert)(!this.elseTemplates, "unexpected elsif after else");
15406
+ (0, import_liquidjs26.assert)(!this.elseTemplates, "unexpected elsif after else");
15236
15407
  this.branches.push({
15237
- value: new import_liquidjs21.Value(token.tokenizer.readFilteredValue(), this.liquid),
15408
+ value: new import_liquidjs26.Value(token.tokenizer.readFilteredValue(), this.liquid),
15238
15409
  templates: p = []
15239
15410
  });
15240
15411
  }).on("tag:else", (tag) => {
15241
15412
  if (tag.args.length > 0) {
15242
15413
  this.branches.push({
15243
- value: new import_liquidjs21.Value(tag.tokenizer.readFilteredValue(), this.liquid),
15414
+ value: new import_liquidjs26.Value(tag.tokenizer.readFilteredValue(), this.liquid),
15244
15415
  templates: p = []
15245
15416
  });
15246
15417
  } else {
@@ -15258,7 +15429,7 @@ function bind6(_liquidSwell) {
15258
15429
  const r = this.liquid.renderer;
15259
15430
  for (const { value, templates } of this.branches) {
15260
15431
  const v = yield value.value(ctx, ctx.opts.lenientIf);
15261
- if ((0, import_liquidjs21.isTruthy)(v, ctx)) {
15432
+ if ((0, import_liquidjs26.isTruthy)(v, ctx)) {
15262
15433
  yield r.renderTemplates(templates, ctx, emitter);
15263
15434
  return;
15264
15435
  }
@@ -15279,20 +15450,20 @@ function bind6(_liquidSwell) {
15279
15450
  };
15280
15451
  }
15281
15452
  function assertEmpty(predicate, message = `unexpected ${JSON.stringify(predicate)}`) {
15282
- (0, import_liquidjs21.assert)(!predicate, message);
15453
+ (0, import_liquidjs26.assert)(!predicate, message);
15283
15454
  }
15284
15455
 
15285
15456
  // src/liquid/tags/javascript.ts
15286
- var import_liquidjs22 = require("liquidjs");
15287
- function bind7(_liquidSwell) {
15288
- return class JavascriptTag extends import_liquidjs22.Tag {
15457
+ var import_liquidjs27 = require("liquidjs");
15458
+ function bind9(_liquidSwell) {
15459
+ return class JavascriptTag extends import_liquidjs27.Tag {
15289
15460
  templates;
15290
15461
  constructor(token, remainTokens, liquid, parser) {
15291
15462
  super(token, remainTokens, liquid);
15292
15463
  this.templates = [];
15293
15464
  while (remainTokens.length > 0) {
15294
15465
  const token2 = remainTokens.shift();
15295
- if (import_liquidjs22.TypeGuards.isTagToken(token2) && token2.name === "endjavascript") {
15466
+ if (import_liquidjs27.TypeGuards.isTagToken(token2) && token2.name === "endjavascript") {
15296
15467
  return;
15297
15468
  }
15298
15469
  this.templates.push(parser.parseToken(token2, remainTokens));
@@ -15310,9 +15481,9 @@ function bind7(_liquidSwell) {
15310
15481
  }
15311
15482
 
15312
15483
  // src/liquid/tags/layout.ts
15313
- var import_liquidjs23 = require("liquidjs");
15314
- function bind8(liquidSwell) {
15315
- return class LayoutTag extends import_liquidjs23.Tag {
15484
+ var import_liquidjs28 = require("liquidjs");
15485
+ function bind10(liquidSwell) {
15486
+ return class LayoutTag extends import_liquidjs28.Tag {
15316
15487
  fileName;
15317
15488
  constructor(token, remainTokens, liquid, _parser) {
15318
15489
  super(token, remainTokens, liquid);
@@ -15328,9 +15499,9 @@ function bind8(liquidSwell) {
15328
15499
  }
15329
15500
 
15330
15501
  // src/liquid/tags/paginate.ts
15331
- var import_liquidjs24 = require("liquidjs");
15332
- function bind9(liquidSwell) {
15333
- return class PaginateTag extends import_liquidjs24.Tag {
15502
+ var import_liquidjs29 = require("liquidjs");
15503
+ function bind11(liquidSwell) {
15504
+ return class PaginateTag extends import_liquidjs29.Tag {
15334
15505
  collection;
15335
15506
  pageSize;
15336
15507
  templates;
@@ -15345,7 +15516,7 @@ function bind9(liquidSwell) {
15345
15516
  }
15346
15517
  this.templates = [];
15347
15518
  this.collection = collection;
15348
- this.hash = new import_liquidjs24.Hash(this.tokenizer.remaining());
15519
+ this.hash = new import_liquidjs29.Hash(this.tokenizer.remaining());
15349
15520
  const stream = parser.parseStream(remainTokens).on("tag:endpaginate", () => stream.stop()).on("template", (tpl) => {
15350
15521
  this.templates.push(tpl);
15351
15522
  }).on("end", () => {
@@ -15355,8 +15526,8 @@ function bind9(liquidSwell) {
15355
15526
  }
15356
15527
  *render(ctx, emitter) {
15357
15528
  const r = this.liquid.renderer;
15358
- const collection = yield (0, import_liquidjs24.evalToken)(this.collection, ctx);
15359
- const pageSize = Number(yield (0, import_liquidjs24.evalToken)(this.pageSize, ctx));
15529
+ const collection = yield (0, import_liquidjs29.evalToken)(this.collection, ctx);
15530
+ const pageSize = Number(yield (0, import_liquidjs29.evalToken)(this.pageSize, ctx));
15360
15531
  const hash = yield this.hash.render(ctx);
15361
15532
  if (!Number.isNaN(pageSize) && collection instanceof SwellStorefrontCollection && collection.limit !== pageSize) {
15362
15533
  yield collection._get({
@@ -15382,10 +15553,10 @@ function bind9(liquidSwell) {
15382
15553
  }
15383
15554
 
15384
15555
  // src/liquid/tags/render.ts
15385
- var import_lodash_es9 = require("lodash-es");
15386
- var import_liquidjs25 = require("liquidjs");
15387
- function bind10(liquidSwell) {
15388
- return class RenderTag extends import_liquidjs25.RenderTag {
15556
+ var import_lodash_es11 = require("lodash-es");
15557
+ var import_liquidjs30 = require("liquidjs");
15558
+ function bind12(liquidSwell) {
15559
+ return class RenderTag extends import_liquidjs30.RenderTag {
15389
15560
  *render(ctx, emitter) {
15390
15561
  const self = this;
15391
15562
  const { liquid } = this;
@@ -15395,23 +15566,26 @@ function bind10(liquidSwell) {
15395
15566
  ctx,
15396
15567
  liquid
15397
15568
  );
15398
- (0, import_liquidjs25.assert)(filename, () => `illegal file path "${filename}"`);
15569
+ (0, import_liquidjs30.assert)(filename, () => `illegal file path "${filename}"`);
15399
15570
  const configPath = yield liquidSwell.getComponentPath(
15400
15571
  filename
15401
15572
  );
15402
15573
  const childCtx = ctx.spawn();
15403
15574
  const scope = childCtx.bottom();
15404
- (0, import_lodash_es9.assign)(scope, yield hash.render(ctx));
15575
+ (0, import_lodash_es11.assign)(scope, ctx.bottom());
15405
15576
  const parentSection = yield ctx._get(["section"]);
15406
- if (parentSection) (0, import_lodash_es9.assign)(scope, { section: parentSection });
15577
+ if (parentSection) (0, import_lodash_es11.assign)(scope, { section: parentSection });
15578
+ const parentBlock = yield ctx._get(["block"]);
15579
+ if (parentBlock) (0, import_lodash_es11.assign)(scope, { block: parentBlock });
15580
+ (0, import_lodash_es11.assign)(scope, yield hash.render(ctx));
15407
15581
  if (self["with"]) {
15408
15582
  const { value, alias } = self["with"];
15409
15583
  const aliasName = alias || filename;
15410
- scope[aliasName] = yield (0, import_liquidjs25.evalToken)(value, ctx);
15584
+ scope[aliasName] = yield (0, import_liquidjs30.evalToken)(value, ctx);
15411
15585
  }
15412
15586
  if (self["for"]) {
15413
15587
  const { value, alias } = self["for"];
15414
- let collection = yield (0, import_liquidjs25.evalToken)(value, ctx);
15588
+ let collection = yield (0, import_liquidjs30.evalToken)(value, ctx);
15415
15589
  collection = yield resolveEnumerable(collection);
15416
15590
  scope["forloop"] = new ForloopDrop(
15417
15591
  collection.length,
@@ -15454,13 +15628,13 @@ function* renderFilePath(file, ctx, liquid) {
15454
15628
  default:
15455
15629
  break;
15456
15630
  }
15457
- return yield (0, import_liquidjs25.evalToken)(file, ctx);
15631
+ return yield (0, import_liquidjs30.evalToken)(file, ctx);
15458
15632
  }
15459
15633
 
15460
15634
  // src/liquid/tags/section.ts
15461
- var import_liquidjs26 = require("liquidjs");
15462
- function bind11(liquidSwell) {
15463
- return class SectionTag extends import_liquidjs26.Tag {
15635
+ var import_liquidjs31 = require("liquidjs");
15636
+ function bind13(liquidSwell) {
15637
+ return class SectionTag extends import_liquidjs31.Tag {
15464
15638
  fileName;
15465
15639
  constructor(token, remainTokens, liquid, _parser) {
15466
15640
  super(token, remainTokens, liquid);
@@ -15511,10 +15685,10 @@ function bind11(liquidSwell) {
15511
15685
  }
15512
15686
 
15513
15687
  // src/liquid/tags/sections.ts
15514
- var import_liquidjs27 = require("liquidjs");
15688
+ var import_liquidjs32 = require("liquidjs");
15515
15689
  var import_json54 = __toESM(require("json5"), 1);
15516
- function bind12(liquidSwell) {
15517
- return class SectionsTag extends import_liquidjs27.Tag {
15690
+ function bind14(liquidSwell) {
15691
+ return class SectionsTag extends import_liquidjs32.Tag {
15518
15692
  fileName;
15519
15693
  constructor(token, remainTokens, liquid, _parser) {
15520
15694
  super(token, remainTokens, liquid);
@@ -15554,9 +15728,9 @@ function bind12(liquidSwell) {
15554
15728
  }
15555
15729
 
15556
15730
  // src/liquid/tags/style.ts
15557
- var import_liquidjs28 = require("liquidjs");
15558
- function bind13(_liquidSwell) {
15559
- return class StyleTag extends import_liquidjs28.Tag {
15731
+ var import_liquidjs33 = require("liquidjs");
15732
+ function bind15(_liquidSwell) {
15733
+ return class StyleTag extends import_liquidjs33.Tag {
15560
15734
  templates;
15561
15735
  hash;
15562
15736
  constructor(token, remainTokens, liquid, parser) {
@@ -15565,7 +15739,7 @@ function bind13(_liquidSwell) {
15565
15739
  const tagBegin = token.begin;
15566
15740
  while (remainTokens.length > 0) {
15567
15741
  const token2 = remainTokens.shift();
15568
- if (import_liquidjs28.TypeGuards.isTagToken(token2) && token2.name === "endstyle") {
15742
+ if (import_liquidjs33.TypeGuards.isTagToken(token2) && token2.name === "endstyle") {
15569
15743
  this.hash = md5(token2.input.slice(tagBegin, token2.end));
15570
15744
  return;
15571
15745
  }
@@ -15588,16 +15762,16 @@ function bind13(_liquidSwell) {
15588
15762
  }
15589
15763
 
15590
15764
  // src/liquid/tags/stylesheet.ts
15591
- var import_liquidjs29 = require("liquidjs");
15592
- function bind14(_liquidSwell) {
15593
- return class StyleSheetTag extends import_liquidjs29.Tag {
15765
+ var import_liquidjs34 = require("liquidjs");
15766
+ function bind16(_liquidSwell) {
15767
+ return class StyleSheetTag extends import_liquidjs34.Tag {
15594
15768
  templates;
15595
15769
  constructor(token, remainTokens, liquid, parser) {
15596
15770
  super(token, remainTokens, liquid);
15597
15771
  this.templates = [];
15598
15772
  while (remainTokens.length > 0) {
15599
15773
  const token2 = remainTokens.shift();
15600
- if (import_liquidjs29.TypeGuards.isTagToken(token2) && token2.name === "endstylesheet") {
15774
+ if (import_liquidjs34.TypeGuards.isTagToken(token2) && token2.name === "endstylesheet") {
15601
15775
  return;
15602
15776
  }
15603
15777
  this.templates.push(parser.parseToken(token2, remainTokens));
@@ -15613,9 +15787,9 @@ function bind14(_liquidSwell) {
15613
15787
  }
15614
15788
 
15615
15789
  // src/liquid/tags/shopify/include.ts
15616
- var import_liquidjs30 = require("liquidjs");
15617
- function bind15(liquidSwell) {
15618
- return class IncludeTag extends import_liquidjs30.IncludeTag {
15790
+ var import_liquidjs35 = require("liquidjs");
15791
+ function bind17(liquidSwell) {
15792
+ return class IncludeTag extends import_liquidjs35.IncludeTag {
15619
15793
  *render(ctx, emitter) {
15620
15794
  const { hash } = this;
15621
15795
  const filepath = yield renderFilePath(
@@ -15623,13 +15797,13 @@ function bind15(liquidSwell) {
15623
15797
  ctx,
15624
15798
  this.liquid
15625
15799
  );
15626
- (0, import_liquidjs30.assert)(filepath, () => `illegal file path "${filepath}"`);
15800
+ (0, import_liquidjs35.assert)(filepath, () => `illegal file path "${filepath}"`);
15627
15801
  const saved = ctx.saveRegister("blocks", "blockMode");
15628
15802
  ctx.setRegister("blocks", {});
15629
15803
  ctx.setRegister("blockMode", 0);
15630
15804
  const scope = yield hash.render(ctx);
15631
15805
  if (this.withVar) {
15632
- scope[filepath] = yield (0, import_liquidjs30.evalToken)(this.withVar, ctx);
15806
+ scope[filepath] = yield (0, import_liquidjs35.evalToken)(this.withVar, ctx);
15633
15807
  }
15634
15808
  ctx.push(ctx.opts.jekyllInclude ? { include: scope } : scope);
15635
15809
  const output = yield liquidSwell.getComponentPath(filepath).then((path) => liquidSwell.getThemeConfig(path)).then((themeConfig) => liquidSwell.renderTemplate(themeConfig, ctx));
@@ -15641,10 +15815,10 @@ function bind15(liquidSwell) {
15641
15815
  }
15642
15816
 
15643
15817
  // src/liquid/tags/shopify/schema.ts
15644
- var import_liquidjs31 = require("liquidjs");
15818
+ var import_liquidjs36 = require("liquidjs");
15645
15819
  var import_json55 = __toESM(require("json5"), 1);
15646
- function bind16(liquidSwell) {
15647
- return class SchemaTag extends import_liquidjs31.Tag {
15820
+ function bind18(liquidSwell) {
15821
+ return class SchemaTag extends import_liquidjs36.Tag {
15648
15822
  templates;
15649
15823
  constructor(token, remainTokens, liquid, parser) {
15650
15824
  super(token, remainTokens, liquid);
@@ -15666,6 +15840,7 @@ function bind16(liquidSwell) {
15666
15840
  liquidSwell.lastSchema = void 0;
15667
15841
  if (typeof jsonOutput === "string") {
15668
15842
  liquidSwell.lastSchema = import_json55.default.parse(jsonOutput);
15843
+ expandThemeBlocks(liquidSwell);
15669
15844
  }
15670
15845
  } catch (err) {
15671
15846
  console.warn(err);
@@ -15675,11 +15850,22 @@ function bind16(liquidSwell) {
15675
15850
  }
15676
15851
  };
15677
15852
  }
15853
+ function expandThemeBlocks(liquidSwell) {
15854
+ const blocks = liquidSwell.lastSchema?.blocks;
15855
+ if (!Array.isArray(blocks)) {
15856
+ return;
15857
+ }
15858
+ for (let i = 0; i < blocks.length; i++) {
15859
+ if (blocks[i].type === "@theme") {
15860
+ blocks.splice(i, 1, ...liquidSwell.theme.getAllThemeBlockSchemas());
15861
+ }
15862
+ }
15863
+ }
15678
15864
 
15679
15865
  // src/liquid/tags/inline_editable.ts
15680
- var import_liquidjs32 = require("liquidjs");
15681
- function bind17(_liquidSwell) {
15682
- return class InlineEditableTag extends import_liquidjs32.Tag {
15866
+ var import_liquidjs37 = require("liquidjs");
15867
+ function bind19(_liquidSwell) {
15868
+ return class InlineEditableTag extends import_liquidjs37.Tag {
15683
15869
  key;
15684
15870
  value;
15685
15871
  constructor(token, remainTokens, liquid, _parser) {
@@ -15707,129 +15893,131 @@ var tags = {
15707
15893
  assign: bind,
15708
15894
  case: bind2,
15709
15895
  comment: bind3,
15710
- for: bind4,
15711
- form: bind5,
15712
- if: bind6,
15713
- javascript: bind7,
15714
- layout: bind8,
15715
- paginate: bind9,
15716
- render: bind10,
15717
- section: bind11,
15718
- sections: bind12,
15719
- style: bind13,
15896
+ content_for: bind4,
15897
+ doc: bind5,
15898
+ for: bind6,
15899
+ form: bind7,
15900
+ if: bind8,
15901
+ javascript: bind9,
15902
+ layout: bind10,
15903
+ paginate: bind11,
15904
+ render: bind12,
15905
+ section: bind13,
15906
+ sections: bind14,
15907
+ style: bind15,
15720
15908
  // Shopify compatibility only
15721
- include: bind15,
15722
- schema: bind16,
15723
- stylesheet: bind14,
15909
+ include: bind17,
15910
+ schema: bind18,
15911
+ stylesheet: bind16,
15724
15912
  // Swell only
15725
- inline_editable: bind17
15913
+ inline_editable: bind19
15726
15914
  };
15727
15915
  function bindTags(liquidSwell) {
15728
15916
  Object.entries(tags).forEach(
15729
- ([tag, bind67]) => liquidSwell.registerTag(tag, bind67(liquidSwell))
15917
+ ([tag, bind70]) => liquidSwell.registerTag(tag, bind70(liquidSwell))
15730
15918
  );
15731
15919
  }
15732
15920
 
15733
15921
  // src/liquid/filters/asset_url.ts
15734
- function bind18(liquidSwell) {
15922
+ function bind20(liquidSwell) {
15735
15923
  return function filterAssetUrl(assetPath) {
15736
15924
  return liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
15737
15925
  };
15738
15926
  }
15739
15927
 
15740
15928
  // src/liquid/filters/brightness_difference.ts
15741
- function bind19(_liquidSwell) {
15929
+ function bind21(_liquidSwell) {
15742
15930
  return (color1, color2) => {
15743
15931
  return ThemeColor.get(color1).brightnessDifference(ThemeColor.get(color2));
15744
15932
  };
15745
15933
  }
15746
15934
 
15747
15935
  // src/liquid/filters/color_brightness.ts
15748
- function bind20(_liquidSwell) {
15936
+ function bind22(_liquidSwell) {
15749
15937
  return (color) => {
15750
15938
  return ThemeColor.get(color).brightness();
15751
15939
  };
15752
15940
  }
15753
15941
 
15754
15942
  // src/liquid/filters/color_contrast.ts
15755
- function bind21(_liquidSwell) {
15943
+ function bind23(_liquidSwell) {
15756
15944
  return (color1, color2) => {
15757
15945
  return ThemeColor.get(color1).contrast(ThemeColor.get(color2));
15758
15946
  };
15759
15947
  }
15760
15948
 
15761
15949
  // src/liquid/filters/color_darken.ts
15762
- function bind22(_liquidSwell) {
15950
+ function bind24(_liquidSwell) {
15763
15951
  return (color, percent) => {
15764
15952
  return ThemeColor.get(color).darken(percent);
15765
15953
  };
15766
15954
  }
15767
15955
 
15768
15956
  // src/liquid/filters/color_desaturate.ts
15769
- function bind23(_liquidSwell) {
15957
+ function bind25(_liquidSwell) {
15770
15958
  return (color, value) => {
15771
15959
  return ThemeColor.get(color).desaturate(value);
15772
15960
  };
15773
15961
  }
15774
15962
 
15775
15963
  // src/liquid/filters/color_difference.ts
15776
- function bind24(_liquidSwell) {
15964
+ function bind26(_liquidSwell) {
15777
15965
  return (color1, color2) => {
15778
15966
  return ThemeColor.get(color1).difference(ThemeColor.get(color2));
15779
15967
  };
15780
15968
  }
15781
15969
 
15782
15970
  // src/liquid/filters/color_extract.ts
15783
- function bind25(_liquidSwell) {
15971
+ function bind27(_liquidSwell) {
15784
15972
  return (color, field) => {
15785
15973
  return ThemeColor.get(color).extract(field);
15786
15974
  };
15787
15975
  }
15788
15976
 
15789
15977
  // src/liquid/filters/color_lighten.ts
15790
- function bind26(_liquidSwell) {
15978
+ function bind28(_liquidSwell) {
15791
15979
  return (color, percent) => {
15792
15980
  return ThemeColor.get(color).lighten(percent);
15793
15981
  };
15794
15982
  }
15795
15983
 
15796
15984
  // src/liquid/filters/color_mix.ts
15797
- function bind27(_liquidSwell) {
15985
+ function bind29(_liquidSwell) {
15798
15986
  return (color1, color2, ratio) => {
15799
15987
  return ThemeColor.get(color1).mix(ThemeColor.get(color2), ratio);
15800
15988
  };
15801
15989
  }
15802
15990
 
15803
15991
  // src/liquid/filters/color_modify.ts
15804
- function bind28(_liquidSwell) {
15992
+ function bind30(_liquidSwell) {
15805
15993
  return function filterColorModify(color, field, value) {
15806
15994
  return ThemeColor.get(color).modify(field, Number(value) || 0);
15807
15995
  };
15808
15996
  }
15809
15997
 
15810
15998
  // src/liquid/filters/color_saturate.ts
15811
- function bind29(_liquidSwell) {
15999
+ function bind31(_liquidSwell) {
15812
16000
  return (color, value) => {
15813
16001
  return ThemeColor.get(color).saturate(value);
15814
16002
  };
15815
16003
  }
15816
16004
 
15817
16005
  // src/liquid/filters/color_to_hex.ts
15818
- function bind30(_liquidSwell) {
16006
+ function bind32(_liquidSwell) {
15819
16007
  return (color) => {
15820
16008
  return ThemeColor.get(color).hex();
15821
16009
  };
15822
16010
  }
15823
16011
 
15824
16012
  // src/liquid/filters/color_to_hsl.ts
15825
- function bind31(_liquidSwell) {
16013
+ function bind33(_liquidSwell) {
15826
16014
  return (color) => {
15827
16015
  return ThemeColor.get(color).hsl();
15828
16016
  };
15829
16017
  }
15830
16018
 
15831
16019
  // src/liquid/filters/color_to_rgb.ts
15832
- function bind32(_liquidSwell) {
16020
+ function bind34(_liquidSwell) {
15833
16021
  return (color, alpha) => {
15834
16022
  return alpha !== void 0 ? ThemeColor.get(color).rgba(alpha) : ThemeColor.get(color).rgb();
15835
16023
  };
@@ -15837,7 +16025,7 @@ function bind32(_liquidSwell) {
15837
16025
 
15838
16026
  // src/liquid/filters/date.ts
15839
16027
  var import_strftime = __toESM(require("strftime"), 1);
15840
- function bind33(_liquidSwell) {
16028
+ function bind35(_liquidSwell) {
15841
16029
  return (dateValue, ...params) => {
15842
16030
  const date = ensureDate(dateValue);
15843
16031
  const { format } = getDateFilterParams(params);
@@ -15895,7 +16083,7 @@ function applyStrftimeFormat(format, date) {
15895
16083
  }
15896
16084
 
15897
16085
  // src/liquid/filters/date_next_interval.ts
15898
- function bind34(_liquidSwell) {
16086
+ function bind36(_liquidSwell) {
15899
16087
  return (dateValue, interval, intervalCount) => {
15900
16088
  const date = ensureDate(dateValue);
15901
16089
  const result = getNextIntervalDate(date, interval, Number(intervalCount));
@@ -15947,7 +16135,7 @@ function time(date) {
15947
16135
  }
15948
16136
 
15949
16137
  // src/liquid/filters/default_errors.ts
15950
- function bind35(_liquidSwell) {
16138
+ function bind37(_liquidSwell) {
15951
16139
  return async function filterDefaultError(errors) {
15952
16140
  if (!errors) {
15953
16141
  return "";
@@ -15973,7 +16161,7 @@ function bind35(_liquidSwell) {
15973
16161
  }
15974
16162
 
15975
16163
  // src/liquid/filters/divided_by.ts
15976
- function bind36(_liquidSwell) {
16164
+ function bind38(_liquidSwell) {
15977
16165
  return (dividend, divisor, integerArithmetic) => {
15978
16166
  if (!isNumber(dividend) || !isNumber(divisor)) {
15979
16167
  return dividend;
@@ -15983,20 +16171,20 @@ function bind36(_liquidSwell) {
15983
16171
  }
15984
16172
 
15985
16173
  // src/liquid/filters/embedded_content.ts
15986
- var import_lodash_es10 = require("lodash-es");
15987
- function bind37(_liquidSwell) {
16174
+ var import_lodash_es12 = require("lodash-es");
16175
+ function bind39(_liquidSwell) {
15988
16176
  return (value, tag = "iframe") => {
15989
16177
  const escapeIframes = value.replaceAll(`<${tag}`, `&lt;${tag}`).replaceAll(`</${tag}`, `&lt;/${tag}`);
15990
16178
  const removeTags = escapeIframes.replaceAll(/<(.*?)>/gi, "");
15991
- const unescaped = (0, import_lodash_es10.unescape)(removeTags);
16179
+ const unescaped = (0, import_lodash_es12.unescape)(removeTags);
15992
16180
  const replaceSpaces = unescaped.replaceAll("&nbsp;", " ");
15993
16181
  return replaceSpaces;
15994
16182
  };
15995
16183
  }
15996
16184
 
15997
16185
  // src/liquid/filters/escape.ts
15998
- var import_lodash_es11 = require("lodash-es");
15999
- function bind38(_liquidSwell) {
16186
+ var import_lodash_es13 = require("lodash-es");
16187
+ function bind40(_liquidSwell) {
16000
16188
  return function escapeTag(input) {
16001
16189
  if (!input?.startsWith) {
16002
16190
  return input;
@@ -16004,12 +16192,12 @@ function bind38(_liquidSwell) {
16004
16192
  if (input.startsWith("<img") || input.startsWith("<video")) {
16005
16193
  return input;
16006
16194
  }
16007
- return (0, import_lodash_es11.escape)(input);
16195
+ return (0, import_lodash_es13.escape)(input);
16008
16196
  };
16009
16197
  }
16010
16198
 
16011
16199
  // src/liquid/filters/font_face.ts
16012
- function bind39(_liquidSwell) {
16200
+ function bind41(_liquidSwell) {
16013
16201
  return (fontSetting, ...params) => {
16014
16202
  if (!fontSetting) {
16015
16203
  return null;
@@ -16021,14 +16209,14 @@ function bind39(_liquidSwell) {
16021
16209
  }
16022
16210
 
16023
16211
  // src/liquid/filters/font_modify.ts
16024
- function bind40(_liquidSwell) {
16212
+ function bind42(_liquidSwell) {
16025
16213
  return (fontSetting, prop, value) => {
16026
16214
  return ThemeFont.clone(fontSetting).modify(prop, value);
16027
16215
  };
16028
16216
  }
16029
16217
 
16030
16218
  // src/liquid/filters/font_url.ts
16031
- function bind41(_liquidSwell) {
16219
+ function bind43(_liquidSwell) {
16032
16220
  return (fontSetting) => {
16033
16221
  return ThemeFont.get(fontSetting).url();
16034
16222
  };
@@ -16077,15 +16265,15 @@ var format_address_default = {
16077
16265
  };
16078
16266
 
16079
16267
  // src/liquid/filters/handleize.ts
16080
- var import_lodash_es12 = require("lodash-es");
16081
- function bind42(_liquidSwell) {
16268
+ var import_lodash_es14 = require("lodash-es");
16269
+ function bind44(_liquidSwell) {
16082
16270
  return function filterHandleize(handle) {
16083
- return (0, import_lodash_es12.kebabCase)(handle);
16271
+ return (0, import_lodash_es14.kebabCase)(handle);
16084
16272
  };
16085
16273
  }
16086
16274
 
16087
16275
  // src/liquid/filters/image_tag.ts
16088
- function bind43(_liquidSwell) {
16276
+ function bind45(_liquidSwell) {
16089
16277
  return function filterImageTag(imageUrl, ...params) {
16090
16278
  imageUrl = String(imageUrl || "");
16091
16279
  let {
@@ -16249,7 +16437,7 @@ var filterDefinition = {
16249
16437
  var image_url_default = filterDefinition;
16250
16438
 
16251
16439
  // src/liquid/filters/inline_asset_content.ts
16252
- function bind44(liquidSwell) {
16440
+ function bind46(liquidSwell) {
16253
16441
  return async (assetPath) => {
16254
16442
  const config = await liquidSwell.theme.getThemeConfig(
16255
16443
  `theme/assets/${assetPath}`
@@ -16259,14 +16447,14 @@ function bind44(liquidSwell) {
16259
16447
  }
16260
16448
 
16261
16449
  // src/liquid/filters/json.ts
16262
- function bind45(_liquidSwell) {
16450
+ function bind47(_liquidSwell) {
16263
16451
  return async function filterJson(input, space = 0) {
16264
16452
  return jsonStringifyAsync(input, space);
16265
16453
  };
16266
16454
  }
16267
16455
 
16268
16456
  // src/liquid/filters/json_pretty.ts
16269
- function bind46(_liquidSwell) {
16457
+ function bind48(_liquidSwell) {
16270
16458
  return async function filterJsonPretty(input, space = 2) {
16271
16459
  const output = await jsonStringifyAsync(input, space);
16272
16460
  return `<pre>${output}</pre>`;
@@ -16276,7 +16464,7 @@ function bind46(_liquidSwell) {
16276
16464
  // src/liquid/filters/locale_flag.ts
16277
16465
  var import_country_flag_icons = require("country-flag-icons");
16278
16466
  var flags = __toESM(require("country-flag-icons/string/1x1"), 1);
16279
- function bind47(_liquidSwell) {
16467
+ function bind49(_liquidSwell) {
16280
16468
  return (localeCode) => {
16281
16469
  if (typeof localeCode !== "string") {
16282
16470
  return flags.US;
@@ -16287,7 +16475,7 @@ function bind47(_liquidSwell) {
16287
16475
  }
16288
16476
 
16289
16477
  // src/liquid/filters/minus.ts
16290
- function bind48(_liquidSwell) {
16478
+ function bind50(_liquidSwell) {
16291
16479
  return (first, second) => {
16292
16480
  const firstValue = isNumber(first) ? first : 0;
16293
16481
  const secondValue = isNumber(second) ? second : 0;
@@ -16296,7 +16484,7 @@ function bind48(_liquidSwell) {
16296
16484
  }
16297
16485
 
16298
16486
  // src/liquid/filters/money.ts
16299
- function bind49(liquidSwell) {
16487
+ function bind51(liquidSwell) {
16300
16488
  return function filterMoney(value) {
16301
16489
  const amount = getMoneyAmount(liquidSwell, value);
16302
16490
  return liquidSwell.renderCurrency(amount);
@@ -16313,7 +16501,7 @@ function getMoneyAmount(liquidSwell, value) {
16313
16501
  }
16314
16502
 
16315
16503
  // src/liquid/filters/money_with_currency.ts
16316
- function bind50(liquidSwell) {
16504
+ function bind52(liquidSwell) {
16317
16505
  return function filterMoneyWithCurrency(value) {
16318
16506
  const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
16319
16507
  const amount = getMoneyAmount(liquidSwell, value);
@@ -16322,7 +16510,7 @@ function bind50(liquidSwell) {
16322
16510
  }
16323
16511
 
16324
16512
  // src/liquid/filters/money_without_currency.ts
16325
- function bind51(liquidSwell) {
16513
+ function bind53(liquidSwell) {
16326
16514
  return function filterMoneyWithoutCurrency(value) {
16327
16515
  const amount = getMoneyAmount(liquidSwell, value);
16328
16516
  return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
@@ -16330,30 +16518,45 @@ function bind51(liquidSwell) {
16330
16518
  }
16331
16519
 
16332
16520
  // src/liquid/filters/money_without_trailing_zeros.ts
16333
- function bind52(liquidSwell) {
16521
+ function bind54(liquidSwell) {
16334
16522
  return function filterMoneyWithoutTrailingZeros(value) {
16335
16523
  const amount = getMoneyAmount(liquidSwell, value);
16336
16524
  return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
16337
16525
  };
16338
16526
  }
16339
16527
 
16528
+ // src/liquid/filters/preload_tag.ts
16529
+ function bind55(_liquidSwell) {
16530
+ return function filterPreloadTag(assetUrl, ...params) {
16531
+ if (!assetUrl) {
16532
+ return "";
16533
+ }
16534
+ const { as } = paramsToProps(params);
16535
+ let attributes = "";
16536
+ if (typeof as === "string" && as) {
16537
+ attributes += `as="${as}"`;
16538
+ }
16539
+ return `<link href="${assetUrl}" rel="preload" ${attributes} />`;
16540
+ };
16541
+ }
16542
+
16340
16543
  // src/liquid/filters/script_tag.ts
16341
- function bind53(_liquidSwell) {
16544
+ function bind56(_liquidSwell) {
16342
16545
  return function filterScriptTag(assetUrl) {
16343
16546
  return `<script src="${assetUrl}" type="text/javascript"></script>`;
16344
16547
  };
16345
16548
  }
16346
16549
 
16347
16550
  // src/liquid/filters/stylesheet_tag.ts
16348
- function bind54(_liquidSwell) {
16551
+ function bind57(_liquidSwell) {
16349
16552
  return function filterStyleSheetTag(assetUrl) {
16350
16553
  return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
16351
16554
  };
16352
16555
  }
16353
16556
 
16354
16557
  // src/liquid/filters/time_tag.ts
16355
- function bind55(_liquidSwell) {
16356
- const dateFilter = bind33(_liquidSwell);
16558
+ function bind58(_liquidSwell) {
16559
+ const dateFilter = bind35(_liquidSwell);
16357
16560
  return (dateValue, ...params) => {
16358
16561
  const date = ensureDate(dateValue);
16359
16562
  const formattedDate = dateFilter(dateValue, ...params);
@@ -16363,7 +16566,7 @@ function bind55(_liquidSwell) {
16363
16566
  }
16364
16567
 
16365
16568
  // src/liquid/filters/translate.ts
16366
- function bind56(liquidSwell) {
16569
+ function bind59(liquidSwell) {
16367
16570
  return async function filterTranslate(key, params) {
16368
16571
  const props = params && paramsToProps(params);
16369
16572
  const str = await liquidSwell.renderTranslation(key, props);
@@ -16372,7 +16575,7 @@ function bind56(liquidSwell) {
16372
16575
  }
16373
16576
 
16374
16577
  // src/liquid/filters/where.ts
16375
- function bind57(_liquidSwell) {
16578
+ function bind60(_liquidSwell) {
16376
16579
  return function* filterWhere(arr, property, expected) {
16377
16580
  const results = [];
16378
16581
  const list = yield resolveEnumerable(arr);
@@ -16426,7 +16629,7 @@ function getSizesFromParam(param) {
16426
16629
  height: height ? Number(height) : void 0
16427
16630
  };
16428
16631
  }
16429
- function bind58(liquidSwell) {
16632
+ function bind61(liquidSwell) {
16430
16633
  return async function filterAssetImgUrl(assetPath, size = "small") {
16431
16634
  const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
16432
16635
  const sizes = getSizesFromParam(size);
@@ -16442,14 +16645,14 @@ function bind58(liquidSwell) {
16442
16645
  }
16443
16646
 
16444
16647
  // src/liquid/filters/shopify/hex_to_rgba.ts
16445
- function bind59(_liquidSwell) {
16648
+ function bind62(_liquidSwell) {
16446
16649
  return (color, alpha) => {
16447
16650
  return ThemeColor.get(color).rgba(alpha || 1);
16448
16651
  };
16449
16652
  }
16450
16653
 
16451
16654
  // src/liquid/filters/shopify/img_url.ts
16452
- function bind60(liquidSwell) {
16655
+ function bind63(liquidSwell) {
16453
16656
  return async function filterImgUrl(input, ...params) {
16454
16657
  const url = await getImageUrlFromInput(input, liquidSwell);
16455
16658
  if (typeof url !== "string" || url === "") {
@@ -16487,14 +16690,14 @@ var item_count_for_variant_default = {
16487
16690
  };
16488
16691
 
16489
16692
  // src/liquid/filters/shopify/payment_button.ts
16490
- function bind61(_liquidSwell) {
16693
+ function bind64(_liquidSwell) {
16491
16694
  return (form) => {
16492
16695
  return `<button style="display: block; visibility: hidden;"></button>`;
16493
16696
  };
16494
16697
  }
16495
16698
 
16496
16699
  // src/liquid/filters/shopify/payment_terms.ts
16497
- function bind62(_liquidSwell) {
16700
+ function bind65(_liquidSwell) {
16498
16701
  return (form) => {
16499
16702
  return null;
16500
16703
  };
@@ -16596,7 +16799,7 @@ var svgs = {
16596
16799
  var placeholder_svgs_default = svgs;
16597
16800
 
16598
16801
  // src/liquid/filters/shopify/placeholder_svg_tag.ts
16599
- function bind63(_liquidSwell) {
16802
+ function bind66(_liquidSwell) {
16600
16803
  return function filterPlaceholderSvgTag(name, className) {
16601
16804
  const svg = placeholder_svgs_default[name];
16602
16805
  if (typeof svg === "object" && svg !== null) {
@@ -16607,7 +16810,7 @@ function bind63(_liquidSwell) {
16607
16810
  }
16608
16811
 
16609
16812
  // src/liquid/filters/shopify/shopify_asset_url.ts
16610
- function bind64(_liquidSwell) {
16813
+ function bind67(_liquidSwell) {
16611
16814
  return function filterShopifyAssetUrl(input) {
16612
16815
  if (typeof input === "string") {
16613
16816
  switch (input) {
@@ -16632,7 +16835,7 @@ function bind64(_liquidSwell) {
16632
16835
  }
16633
16836
 
16634
16837
  // src/liquid/filters/shopify/structured_data.ts
16635
- function bind65(_liquidSwell) {
16838
+ function bind68(_liquidSwell) {
16636
16839
  return async function filterStructuredData(input) {
16637
16840
  let value = input;
16638
16841
  if (value instanceof StorefrontResource) {
@@ -16710,7 +16913,7 @@ function convertToSchemaOrgProductGroup(product) {
16710
16913
  }
16711
16914
 
16712
16915
  // src/liquid/filters/inline_editable.ts
16713
- function bind66(_liquidSwell) {
16916
+ function bind69(_liquidSwell) {
16714
16917
  return (value, key) => {
16715
16918
  if (typeof value === "object" && "value" in value) {
16716
16919
  value = value.value;
@@ -16721,64 +16924,65 @@ function bind66(_liquidSwell) {
16721
16924
 
16722
16925
  // src/liquid/filters/index.ts
16723
16926
  var filters = {
16724
- asset_url: bind18,
16725
- brightness_difference: bind19,
16726
- color_brightness: bind20,
16727
- color_contrast: bind21,
16728
- color_darken: bind22,
16729
- color_desaturate: bind23,
16730
- color_difference: bind24,
16731
- color_extract: bind25,
16732
- color_lighten: bind26,
16733
- color_mix: bind27,
16734
- color_modify: bind28,
16735
- color_saturate: bind29,
16736
- color_to_hex: bind30,
16737
- color_to_hsl: bind31,
16738
- color_to_rgb: bind32,
16739
- date_next_interval: bind34,
16740
- date: bind33,
16741
- default_errors: bind35,
16742
- divided_by: bind36,
16743
- embedded_content: bind37,
16744
- escape: bind38,
16745
- font_face: bind39,
16746
- font_modify: bind40,
16747
- font_url: bind41,
16927
+ asset_url: bind20,
16928
+ brightness_difference: bind21,
16929
+ color_brightness: bind22,
16930
+ color_contrast: bind23,
16931
+ color_darken: bind24,
16932
+ color_desaturate: bind25,
16933
+ color_difference: bind26,
16934
+ color_extract: bind27,
16935
+ color_lighten: bind28,
16936
+ color_mix: bind29,
16937
+ color_modify: bind30,
16938
+ color_saturate: bind31,
16939
+ color_to_hex: bind32,
16940
+ color_to_hsl: bind33,
16941
+ color_to_rgb: bind34,
16942
+ date_next_interval: bind36,
16943
+ date: bind35,
16944
+ default_errors: bind37,
16945
+ divided_by: bind38,
16946
+ embedded_content: bind39,
16947
+ escape: bind40,
16948
+ font_face: bind41,
16949
+ font_modify: bind42,
16950
+ font_url: bind43,
16748
16951
  format_address: format_address_default,
16749
- handle: bind42,
16952
+ handle: bind44,
16750
16953
  // alias
16751
- handleize: bind42,
16752
- image_tag: bind43,
16954
+ handleize: bind44,
16955
+ image_tag: bind45,
16753
16956
  image_url: image_url_default,
16754
- inline_asset_content: bind44,
16755
- json: bind45,
16756
- json_pretty: bind46,
16757
- locale_flag: bind47,
16758
- minus: bind48,
16759
- money: bind49,
16760
- money_with_currency: bind50,
16761
- money_without_currency: bind51,
16762
- money_without_trailing_zeros: bind52,
16763
- script_tag: bind53,
16764
- stylesheet_tag: bind54,
16765
- time_tag: bind55,
16766
- translate: bind56,
16767
- t: bind56,
16957
+ inline_asset_content: bind46,
16958
+ json: bind47,
16959
+ json_pretty: bind48,
16960
+ locale_flag: bind49,
16961
+ minus: bind50,
16962
+ money: bind51,
16963
+ money_with_currency: bind52,
16964
+ money_without_currency: bind53,
16965
+ money_without_trailing_zeros: bind54,
16966
+ preload_tag: bind55,
16967
+ script_tag: bind56,
16968
+ stylesheet_tag: bind57,
16969
+ time_tag: bind58,
16970
+ translate: bind59,
16971
+ t: bind59,
16768
16972
  // alias
16769
- where: bind57,
16973
+ where: bind60,
16770
16974
  // Shopify compatibility only
16771
- asset_img_url: bind58,
16772
- hex_to_rgba: bind59,
16773
- img_url: bind60,
16975
+ asset_img_url: bind61,
16976
+ hex_to_rgba: bind62,
16977
+ img_url: bind63,
16774
16978
  item_count_for_variant: item_count_for_variant_default,
16775
- payment_button: bind61,
16776
- payment_terms: bind62,
16777
- placeholder_svg_tag: bind63,
16778
- shopify_asset_url: bind64,
16779
- structured_data: bind65,
16979
+ payment_button: bind64,
16980
+ payment_terms: bind65,
16981
+ placeholder_svg_tag: bind66,
16982
+ shopify_asset_url: bind67,
16983
+ structured_data: bind68,
16780
16984
  // Swell only
16781
- inline_editable: bind66
16985
+ inline_editable: bind69
16782
16986
  };
16783
16987
  function bindFilters(liquidSwell) {
16784
16988
  for (const [tag, handler] of Object.entries(filters)) {
@@ -16792,8 +16996,8 @@ function bindFilters(liquidSwell) {
16792
16996
  }
16793
16997
  }
16794
16998
  }
16795
- function bindWithResolvedProps(liquidSwell, bind67, resolve = []) {
16796
- const handler = bind67(liquidSwell);
16999
+ function bindWithResolvedProps(liquidSwell, bind70, resolve = []) {
17000
+ const handler = bind70(liquidSwell);
16797
17001
  if (!Array.isArray(resolve)) {
16798
17002
  return handler;
16799
17003
  }
@@ -16845,9 +17049,9 @@ async function resolveAsyncProps(propArg, resolveProps) {
16845
17049
  }
16846
17050
 
16847
17051
  // src/liquid/operators.ts
16848
- var import_liquidjs33 = require("liquidjs");
17052
+ var import_liquidjs38 = require("liquidjs");
16849
17053
  var swellOperators = {
16850
- ...import_liquidjs33.defaultOperators,
17054
+ ...import_liquidjs38.defaultOperators,
16851
17055
  "==": equal,
16852
17056
  "!=": (l, r) => !equal(l, r),
16853
17057
  contains: (l, r) => {
@@ -16875,8 +17079,8 @@ function arrayEqual(lhs, rhs) {
16875
17079
 
16876
17080
  // src/liquid/color.ts
16877
17081
  var import_color = __toESM(require("color"), 1);
16878
- var import_liquidjs34 = require("liquidjs");
16879
- var ThemeColor = class _ThemeColor extends import_liquidjs34.Drop {
17082
+ var import_liquidjs39 = require("liquidjs");
17083
+ var ThemeColor = class _ThemeColor extends import_liquidjs39.Drop {
16880
17084
  color;
16881
17085
  colorValues;
16882
17086
  red;
@@ -16920,10 +17124,16 @@ var ThemeColor = class _ThemeColor extends import_liquidjs34.Drop {
16920
17124
  return this.color.darken(percent / 100).hex().toLowerCase();
16921
17125
  }
16922
17126
  rgb() {
16923
- return this.color.rgb().toString();
17127
+ return `${this.red} ${this.green} ${this.blue}`;
16924
17128
  }
16925
17129
  rgba(alpha) {
16926
- return this.color.alpha(alpha).rgb().toString();
17130
+ const colorValues = this.color.object();
17131
+ const alphaValue = alpha || colorValues.alpha;
17132
+ const rgb = this.rgb();
17133
+ if (alphaValue === void 0) {
17134
+ return rgb;
17135
+ }
17136
+ return `${rgb} / ${Number(alphaValue).toFixed(2)}`;
16927
17137
  }
16928
17138
  hsl() {
16929
17139
  return this.color.hsl().round().toString();
@@ -17011,7 +17221,7 @@ function isThemeColorLike(value) {
17011
17221
  }
17012
17222
 
17013
17223
  // src/liquid/index.ts
17014
- var LiquidSwell31 = class extends import_liquidjs35.Liquid {
17224
+ var LiquidSwell31 = class extends import_liquidjs40.Liquid {
17015
17225
  theme;
17016
17226
  getThemeConfig;
17017
17227
  getThemeTemplateConfigByType;
@@ -17028,6 +17238,7 @@ var LiquidSwell31 = class extends import_liquidjs35.Liquid {
17028
17238
  extName;
17029
17239
  componentsDir;
17030
17240
  sectionsDir;
17241
+ blocksDir;
17031
17242
  lastSchema;
17032
17243
  constructor({
17033
17244
  theme,
@@ -17045,7 +17256,8 @@ var LiquidSwell31 = class extends import_liquidjs35.Liquid {
17045
17256
  layoutName,
17046
17257
  extName,
17047
17258
  componentsDir,
17048
- sectionsDir
17259
+ sectionsDir,
17260
+ blocksDir
17049
17261
  }) {
17050
17262
  getThemeConfig = getThemeConfig || theme.getThemeConfig.bind(theme);
17051
17263
  extName = extName || "liquid";
@@ -17074,6 +17286,7 @@ var LiquidSwell31 = class extends import_liquidjs35.Liquid {
17074
17286
  this.extName = extName;
17075
17287
  this.componentsDir = componentsDir || "components";
17076
17288
  this.sectionsDir = sectionsDir || "sections";
17289
+ this.blocksDir = blocksDir || "blocks";
17077
17290
  this.lastSchema = void 0;
17078
17291
  bindTags(this);
17079
17292
  bindFilters(this);
@@ -17096,6 +17309,9 @@ var LiquidSwell31 = class extends import_liquidjs35.Liquid {
17096
17309
  async getSectionGroupPath(sectionName) {
17097
17310
  return await this.resolveFilePathByType("sections", `${sectionName}.json`) || resolveFilePath(`${this.sectionsDir}/${sectionName}`, "json");
17098
17311
  }
17312
+ async getThemeBlockPath(blockName) {
17313
+ return await this.resolveFilePathByType("blocks", blockName) || resolveFilePath(`${this.blocksDir}/${blockName}`, this.extName);
17314
+ }
17099
17315
  };
17100
17316
  function resolveFilePath(fileName, extName) {
17101
17317
  return `theme/${fileName}.${extName}`;
@@ -17495,11 +17711,11 @@ var ThemeLoader = class _ThemeLoader {
17495
17711
  };
17496
17712
 
17497
17713
  // src/globals.ts
17498
- var import_lodash_es13 = require("lodash-es");
17714
+ var import_lodash_es15 = require("lodash-es");
17499
17715
 
17500
17716
  // src/compatibility/drops/robots-rule.ts
17501
- var import_liquidjs36 = require("liquidjs");
17502
- var RobotsRule = class _RobotsRule extends import_liquidjs36.Drop {
17717
+ var import_liquidjs41 = require("liquidjs");
17718
+ var RobotsRule = class _RobotsRule extends import_liquidjs41.Drop {
17503
17719
  constructor(directive, value) {
17504
17720
  super();
17505
17721
  this.directive = directive;
@@ -17595,7 +17811,7 @@ function getAllCountryOptionTags(geoSettings) {
17595
17811
  }).filter(Boolean).join("\n");
17596
17812
  }
17597
17813
  function getRobotsGlobals(canonicalUrl) {
17598
- const sitemapUrl = `${(0, import_lodash_es13.trimEnd)(canonicalUrl, "/")}/sitemap.xml`;
17814
+ const sitemapUrl = `${(0, import_lodash_es15.trimEnd)(canonicalUrl, "/")}/sitemap.xml`;
17599
17815
  const defaultRules = [
17600
17816
  { directive: "Disallow", value: "/admin" },
17601
17817
  { directive: "Disallow", value: "/cart" },
@@ -18090,7 +18306,7 @@ var SwellTheme3 = class {
18090
18306
  return languageConfig;
18091
18307
  }
18092
18308
  const localeShortCode = locale.split("-")[0];
18093
- return (0, import_lodash_es14.reduce)(
18309
+ return (0, import_lodash_es16.reduce)(
18094
18310
  languageConfig,
18095
18311
  (acc, value, key) => {
18096
18312
  if (isObject2(value)) {
@@ -18114,15 +18330,15 @@ var SwellTheme3 = class {
18114
18330
  const translationEnd = translationParts.pop();
18115
18331
  const translationPath = translationParts.join(".");
18116
18332
  const translationConfigGlobal = this.globals.language;
18117
- acc[key] = (0, import_lodash_es14.get)(
18333
+ acc[key] = (0, import_lodash_es16.get)(
18118
18334
  translationConfigGlobal,
18119
18335
  `${translationPath}.$locale.${locale}.${translationEnd}`
18120
- ) || (0, import_lodash_es14.get)(
18336
+ ) || (0, import_lodash_es16.get)(
18121
18337
  translationConfigGlobal,
18122
18338
  `${translationPath}.$locale.${localeShortCode}.${translationEnd}`
18123
- ) || (0, import_lodash_es14.get)(translationConfigGlobal, translationKey) || value;
18339
+ ) || (0, import_lodash_es16.get)(translationConfigGlobal, translationKey) || value;
18124
18340
  } else {
18125
- acc[key] = (0, import_lodash_es14.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es14.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
18341
+ acc[key] = (0, import_lodash_es16.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es16.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
18126
18342
  }
18127
18343
  }
18128
18344
  return acc;
@@ -18807,6 +19023,30 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18807
19023
  const configs = this.getThemeConfigsByPath("theme/sections/");
18808
19024
  return getAllSections(configs, this.getTemplateSchema.bind(this));
18809
19025
  }
19026
+ /**
19027
+ * Returns all theme block schemas from /blocks folder.
19028
+ */
19029
+ getAllThemeBlockSchemas() {
19030
+ const schemas = [];
19031
+ const configs = this.getThemeConfigsByPath("theme/blocks/");
19032
+ for (const config of configs.values()) {
19033
+ const { name, file_path: filePath, file_data: fileData } = config;
19034
+ const rawSchema = extractSchemaTag(fileData, true);
19035
+ if (!rawSchema) {
19036
+ continue;
19037
+ }
19038
+ try {
19039
+ const schema = import_json56.default.parse(rawSchema);
19040
+ if (!schema.type) {
19041
+ schema.type = name;
19042
+ }
19043
+ schemas.push(schema);
19044
+ } catch (error) {
19045
+ console.warn(`Invalid schema in block: ${filePath}`, error);
19046
+ }
19047
+ }
19048
+ return schemas;
19049
+ }
18810
19050
  async getPageSections(sectionGroup, resolveSettings = true) {
18811
19051
  const sectionConfigs = await getPageSections(
18812
19052
  sectionGroup,
@@ -18958,8 +19198,8 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18958
19198
  const keyParts = key?.split(".") || [];
18959
19199
  const keyName = keyParts.pop() || "";
18960
19200
  const keyPath = keyParts.join(".");
18961
- const langObject = (0, import_lodash_es14.get)(langConfig, keyPath);
18962
- let localeValue = (0, import_lodash_es14.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es14.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
19201
+ const langObject = (0, import_lodash_es16.get)(langConfig, keyPath);
19202
+ let localeValue = (0, import_lodash_es16.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es16.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
18963
19203
  if (data?.count !== void 0 && localeValue?.one) {
18964
19204
  localeValue = data.count === 1 ? localeValue.one : localeValue.other;
18965
19205
  }
@@ -19039,7 +19279,7 @@ function fillDefaultThemeSettings(themeSettings, editorSchemaSettings) {
19039
19279
  }
19040
19280
  }
19041
19281
  function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
19042
- const settings = (0, import_lodash_es14.cloneDeep)(themeSettings);
19282
+ const settings = (0, import_lodash_es16.cloneDeep)(themeSettings);
19043
19283
  if (settings.$locale) {
19044
19284
  const { locale } = theme.swell.getStorefrontLocalization();
19045
19285
  const localeConfig = settings.$locale[locale] || {};
@@ -19049,16 +19289,16 @@ function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
19049
19289
  }
19050
19290
  }
19051
19291
  }
19052
- (0, import_lodash_es14.each)(settings, (value, key) => {
19292
+ (0, import_lodash_es16.each)(settings, (value, key) => {
19053
19293
  const setting = (editorSchemaSettings && findEditorSetting(editorSchemaSettings, key)) ?? null;
19054
19294
  if (isObject2(value) && !(value instanceof StorefrontResource)) {
19055
19295
  switch (setting?.type) {
19056
19296
  case "color_scheme_group": {
19057
- (0, import_lodash_es14.each)(value, (scheme, schemeId) => {
19297
+ (0, import_lodash_es16.each)(value, (scheme, schemeId) => {
19058
19298
  if (isObject2(scheme) && typeof scheme.settings === "object" && scheme.settings) {
19059
19299
  const settings2 = scheme.settings;
19060
- (0, import_lodash_es14.each)(settings2, (colorValue, colorId) => {
19061
- const fieldDef = (0, import_lodash_es14.find)(setting.fields, { id: colorId });
19300
+ (0, import_lodash_es16.each)(settings2, (colorValue, colorId) => {
19301
+ const fieldDef = (0, import_lodash_es16.find)(setting.fields, { id: colorId });
19062
19302
  if (fieldDef?.type === "color" && colorValue) {
19063
19303
  scheme.id = schemeId;
19064
19304
  settings2[colorId] = new ThemeColor(colorValue);
@@ -19109,7 +19349,7 @@ function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
19109
19349
  }
19110
19350
  function findThemeSettingsByType(type, themeSettings, editorSchemaSettings) {
19111
19351
  const foundSettings = [];
19112
- (0, import_lodash_es14.each)(themeSettings, (value, key) => {
19352
+ (0, import_lodash_es16.each)(themeSettings, (value, key) => {
19113
19353
  if (isObject2(value) && !(value instanceof ThemeFont) && !(value instanceof StorefrontResource)) {
19114
19354
  foundSettings.push(
19115
19355
  ...findThemeSettingsByType(type, value, editorSchemaSettings)
@@ -19167,14 +19407,14 @@ function parseJsonConfig(config) {
19167
19407
  return {};
19168
19408
  }
19169
19409
  }
19170
- function extractSchemaTag(template) {
19410
+ function extractSchemaTag(template, inner = false) {
19171
19411
  const list = template.match(
19172
19412
  /\{%-?\s*schema\s*-?%\}(.*)\{%-?\s*endschema\s*-?%\}/s
19173
19413
  );
19174
19414
  if (list === null) {
19175
19415
  return template;
19176
19416
  }
19177
- return list[0];
19417
+ return inner ? list[1] : list[0];
19178
19418
  }
19179
19419
  function withSuffix(path, suffix) {
19180
19420
  return suffix ? `${path}.${suffix}` : path;
@@ -19283,7 +19523,7 @@ function isChildItemActive(items) {
19283
19523
  }
19284
19524
  function getMenuItemValueId(value) {
19285
19525
  const fallback = typeof value === "string" ? value : "";
19286
- const slug = (0, import_lodash_es15.get)(value, "id", (0, import_lodash_es15.get)(value, "slug", fallback)) || "";
19526
+ const slug = (0, import_lodash_es17.get)(value, "id", (0, import_lodash_es17.get)(value, "slug", fallback)) || "";
19287
19527
  return slug;
19288
19528
  }
19289
19529
  async function getMenuItemUrlAndResource(theme, menuItem) {