@brytdesigns/shopify-ajax-cart-api 1.0.20 → 1.0.22

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/esm/index.js CHANGED
@@ -1,8 +1,488 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
2
10
  var __export = (target, all5) => {
3
11
  for (var name in all5)
4
12
  __defProp(target, name, { get: all5[name], enumerable: true });
5
13
  };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ __defProp(target, "default", { value: mod, enumerable: true }) ,
28
+ mod
29
+ ));
30
+
31
+ // ../../../node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js
32
+ var require_lz_string = __commonJS({
33
+ "../../../node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js"(exports, module) {
34
+ var LZString = function() {
35
+ var f = String.fromCharCode;
36
+ var keyStrBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
37
+ var keyStrUriSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
38
+ var baseReverseDic = {};
39
+ function getBaseValue(alphabet, character) {
40
+ if (!baseReverseDic[alphabet]) {
41
+ baseReverseDic[alphabet] = {};
42
+ for (var i = 0; i < alphabet.length; i++) {
43
+ baseReverseDic[alphabet][alphabet.charAt(i)] = i;
44
+ }
45
+ }
46
+ return baseReverseDic[alphabet][character];
47
+ }
48
+ var LZString2 = {
49
+ compressToBase64: function(input) {
50
+ if (input == null) return "";
51
+ var res = LZString2._compress(input, 6, function(a) {
52
+ return keyStrBase64.charAt(a);
53
+ });
54
+ switch (res.length % 4) {
55
+ // To produce valid Base64
56
+ default:
57
+ // When could this happen ?
58
+ case 0:
59
+ return res;
60
+ case 1:
61
+ return res + "===";
62
+ case 2:
63
+ return res + "==";
64
+ case 3:
65
+ return res + "=";
66
+ }
67
+ },
68
+ decompressFromBase64: function(input) {
69
+ if (input == null) return "";
70
+ if (input == "") return null;
71
+ return LZString2._decompress(input.length, 32, function(index) {
72
+ return getBaseValue(keyStrBase64, input.charAt(index));
73
+ });
74
+ },
75
+ compressToUTF16: function(input) {
76
+ if (input == null) return "";
77
+ return LZString2._compress(input, 15, function(a) {
78
+ return f(a + 32);
79
+ }) + " ";
80
+ },
81
+ decompressFromUTF16: function(compressed) {
82
+ if (compressed == null) return "";
83
+ if (compressed == "") return null;
84
+ return LZString2._decompress(compressed.length, 16384, function(index) {
85
+ return compressed.charCodeAt(index) - 32;
86
+ });
87
+ },
88
+ //compress into uint8array (UCS-2 big endian format)
89
+ compressToUint8Array: function(uncompressed) {
90
+ var compressed = LZString2.compress(uncompressed);
91
+ var buf = new Uint8Array(compressed.length * 2);
92
+ for (var i = 0, TotalLen = compressed.length; i < TotalLen; i++) {
93
+ var current_value = compressed.charCodeAt(i);
94
+ buf[i * 2] = current_value >>> 8;
95
+ buf[i * 2 + 1] = current_value % 256;
96
+ }
97
+ return buf;
98
+ },
99
+ //decompress from uint8array (UCS-2 big endian format)
100
+ decompressFromUint8Array: function(compressed) {
101
+ if (compressed === null || compressed === void 0) {
102
+ return LZString2.decompress(compressed);
103
+ } else {
104
+ var buf = new Array(compressed.length / 2);
105
+ for (var i = 0, TotalLen = buf.length; i < TotalLen; i++) {
106
+ buf[i] = compressed[i * 2] * 256 + compressed[i * 2 + 1];
107
+ }
108
+ var result = [];
109
+ buf.forEach(function(c) {
110
+ result.push(f(c));
111
+ });
112
+ return LZString2.decompress(result.join(""));
113
+ }
114
+ },
115
+ //compress into a string that is already URI encoded
116
+ compressToEncodedURIComponent: function(input) {
117
+ if (input == null) return "";
118
+ return LZString2._compress(input, 6, function(a) {
119
+ return keyStrUriSafe.charAt(a);
120
+ });
121
+ },
122
+ //decompress from an output of compressToEncodedURIComponent
123
+ decompressFromEncodedURIComponent: function(input) {
124
+ if (input == null) return "";
125
+ if (input == "") return null;
126
+ input = input.replace(/ /g, "+");
127
+ return LZString2._decompress(input.length, 32, function(index) {
128
+ return getBaseValue(keyStrUriSafe, input.charAt(index));
129
+ });
130
+ },
131
+ compress: function(uncompressed) {
132
+ return LZString2._compress(uncompressed, 16, function(a) {
133
+ return f(a);
134
+ });
135
+ },
136
+ _compress: function(uncompressed, bitsPerChar, getCharFromInt) {
137
+ if (uncompressed == null) return "";
138
+ var i, value2, context_dictionary = {}, context_dictionaryToCreate = {}, context_c = "", context_wc = "", context_w = "", context_enlargeIn = 2, context_dictSize = 3, context_numBits = 2, context_data = [], context_data_val = 0, context_data_position = 0, ii;
139
+ for (ii = 0; ii < uncompressed.length; ii += 1) {
140
+ context_c = uncompressed.charAt(ii);
141
+ if (!Object.prototype.hasOwnProperty.call(context_dictionary, context_c)) {
142
+ context_dictionary[context_c] = context_dictSize++;
143
+ context_dictionaryToCreate[context_c] = true;
144
+ }
145
+ context_wc = context_w + context_c;
146
+ if (Object.prototype.hasOwnProperty.call(context_dictionary, context_wc)) {
147
+ context_w = context_wc;
148
+ } else {
149
+ if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
150
+ if (context_w.charCodeAt(0) < 256) {
151
+ for (i = 0; i < context_numBits; i++) {
152
+ context_data_val = context_data_val << 1;
153
+ if (context_data_position == bitsPerChar - 1) {
154
+ context_data_position = 0;
155
+ context_data.push(getCharFromInt(context_data_val));
156
+ context_data_val = 0;
157
+ } else {
158
+ context_data_position++;
159
+ }
160
+ }
161
+ value2 = context_w.charCodeAt(0);
162
+ for (i = 0; i < 8; i++) {
163
+ context_data_val = context_data_val << 1 | value2 & 1;
164
+ if (context_data_position == bitsPerChar - 1) {
165
+ context_data_position = 0;
166
+ context_data.push(getCharFromInt(context_data_val));
167
+ context_data_val = 0;
168
+ } else {
169
+ context_data_position++;
170
+ }
171
+ value2 = value2 >> 1;
172
+ }
173
+ } else {
174
+ value2 = 1;
175
+ for (i = 0; i < context_numBits; i++) {
176
+ context_data_val = context_data_val << 1 | value2;
177
+ if (context_data_position == bitsPerChar - 1) {
178
+ context_data_position = 0;
179
+ context_data.push(getCharFromInt(context_data_val));
180
+ context_data_val = 0;
181
+ } else {
182
+ context_data_position++;
183
+ }
184
+ value2 = 0;
185
+ }
186
+ value2 = context_w.charCodeAt(0);
187
+ for (i = 0; i < 16; i++) {
188
+ context_data_val = context_data_val << 1 | value2 & 1;
189
+ if (context_data_position == bitsPerChar - 1) {
190
+ context_data_position = 0;
191
+ context_data.push(getCharFromInt(context_data_val));
192
+ context_data_val = 0;
193
+ } else {
194
+ context_data_position++;
195
+ }
196
+ value2 = value2 >> 1;
197
+ }
198
+ }
199
+ context_enlargeIn--;
200
+ if (context_enlargeIn == 0) {
201
+ context_enlargeIn = Math.pow(2, context_numBits);
202
+ context_numBits++;
203
+ }
204
+ delete context_dictionaryToCreate[context_w];
205
+ } else {
206
+ value2 = context_dictionary[context_w];
207
+ for (i = 0; i < context_numBits; i++) {
208
+ context_data_val = context_data_val << 1 | value2 & 1;
209
+ if (context_data_position == bitsPerChar - 1) {
210
+ context_data_position = 0;
211
+ context_data.push(getCharFromInt(context_data_val));
212
+ context_data_val = 0;
213
+ } else {
214
+ context_data_position++;
215
+ }
216
+ value2 = value2 >> 1;
217
+ }
218
+ }
219
+ context_enlargeIn--;
220
+ if (context_enlargeIn == 0) {
221
+ context_enlargeIn = Math.pow(2, context_numBits);
222
+ context_numBits++;
223
+ }
224
+ context_dictionary[context_wc] = context_dictSize++;
225
+ context_w = String(context_c);
226
+ }
227
+ }
228
+ if (context_w !== "") {
229
+ if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate, context_w)) {
230
+ if (context_w.charCodeAt(0) < 256) {
231
+ for (i = 0; i < context_numBits; i++) {
232
+ context_data_val = context_data_val << 1;
233
+ if (context_data_position == bitsPerChar - 1) {
234
+ context_data_position = 0;
235
+ context_data.push(getCharFromInt(context_data_val));
236
+ context_data_val = 0;
237
+ } else {
238
+ context_data_position++;
239
+ }
240
+ }
241
+ value2 = context_w.charCodeAt(0);
242
+ for (i = 0; i < 8; i++) {
243
+ context_data_val = context_data_val << 1 | value2 & 1;
244
+ if (context_data_position == bitsPerChar - 1) {
245
+ context_data_position = 0;
246
+ context_data.push(getCharFromInt(context_data_val));
247
+ context_data_val = 0;
248
+ } else {
249
+ context_data_position++;
250
+ }
251
+ value2 = value2 >> 1;
252
+ }
253
+ } else {
254
+ value2 = 1;
255
+ for (i = 0; i < context_numBits; i++) {
256
+ context_data_val = context_data_val << 1 | value2;
257
+ if (context_data_position == bitsPerChar - 1) {
258
+ context_data_position = 0;
259
+ context_data.push(getCharFromInt(context_data_val));
260
+ context_data_val = 0;
261
+ } else {
262
+ context_data_position++;
263
+ }
264
+ value2 = 0;
265
+ }
266
+ value2 = context_w.charCodeAt(0);
267
+ for (i = 0; i < 16; i++) {
268
+ context_data_val = context_data_val << 1 | value2 & 1;
269
+ if (context_data_position == bitsPerChar - 1) {
270
+ context_data_position = 0;
271
+ context_data.push(getCharFromInt(context_data_val));
272
+ context_data_val = 0;
273
+ } else {
274
+ context_data_position++;
275
+ }
276
+ value2 = value2 >> 1;
277
+ }
278
+ }
279
+ context_enlargeIn--;
280
+ if (context_enlargeIn == 0) {
281
+ context_enlargeIn = Math.pow(2, context_numBits);
282
+ context_numBits++;
283
+ }
284
+ delete context_dictionaryToCreate[context_w];
285
+ } else {
286
+ value2 = context_dictionary[context_w];
287
+ for (i = 0; i < context_numBits; i++) {
288
+ context_data_val = context_data_val << 1 | value2 & 1;
289
+ if (context_data_position == bitsPerChar - 1) {
290
+ context_data_position = 0;
291
+ context_data.push(getCharFromInt(context_data_val));
292
+ context_data_val = 0;
293
+ } else {
294
+ context_data_position++;
295
+ }
296
+ value2 = value2 >> 1;
297
+ }
298
+ }
299
+ context_enlargeIn--;
300
+ if (context_enlargeIn == 0) {
301
+ context_enlargeIn = Math.pow(2, context_numBits);
302
+ context_numBits++;
303
+ }
304
+ }
305
+ value2 = 2;
306
+ for (i = 0; i < context_numBits; i++) {
307
+ context_data_val = context_data_val << 1 | value2 & 1;
308
+ if (context_data_position == bitsPerChar - 1) {
309
+ context_data_position = 0;
310
+ context_data.push(getCharFromInt(context_data_val));
311
+ context_data_val = 0;
312
+ } else {
313
+ context_data_position++;
314
+ }
315
+ value2 = value2 >> 1;
316
+ }
317
+ while (true) {
318
+ context_data_val = context_data_val << 1;
319
+ if (context_data_position == bitsPerChar - 1) {
320
+ context_data.push(getCharFromInt(context_data_val));
321
+ break;
322
+ } else context_data_position++;
323
+ }
324
+ return context_data.join("");
325
+ },
326
+ decompress: function(compressed) {
327
+ if (compressed == null) return "";
328
+ if (compressed == "") return null;
329
+ return LZString2._decompress(compressed.length, 32768, function(index) {
330
+ return compressed.charCodeAt(index);
331
+ });
332
+ },
333
+ _decompress: function(length3, resetValue, getNextValue) {
334
+ var dictionary = [], enlargeIn = 4, dictSize = 4, numBits = 3, entry = "", result = [], i, w, bits, resb, maxpower, power, c, data = { val: getNextValue(0), position: resetValue, index: 1 };
335
+ for (i = 0; i < 3; i += 1) {
336
+ dictionary[i] = i;
337
+ }
338
+ bits = 0;
339
+ maxpower = Math.pow(2, 2);
340
+ power = 1;
341
+ while (power != maxpower) {
342
+ resb = data.val & data.position;
343
+ data.position >>= 1;
344
+ if (data.position == 0) {
345
+ data.position = resetValue;
346
+ data.val = getNextValue(data.index++);
347
+ }
348
+ bits |= (resb > 0 ? 1 : 0) * power;
349
+ power <<= 1;
350
+ }
351
+ switch (bits) {
352
+ case 0:
353
+ bits = 0;
354
+ maxpower = Math.pow(2, 8);
355
+ power = 1;
356
+ while (power != maxpower) {
357
+ resb = data.val & data.position;
358
+ data.position >>= 1;
359
+ if (data.position == 0) {
360
+ data.position = resetValue;
361
+ data.val = getNextValue(data.index++);
362
+ }
363
+ bits |= (resb > 0 ? 1 : 0) * power;
364
+ power <<= 1;
365
+ }
366
+ c = f(bits);
367
+ break;
368
+ case 1:
369
+ bits = 0;
370
+ maxpower = Math.pow(2, 16);
371
+ power = 1;
372
+ while (power != maxpower) {
373
+ resb = data.val & data.position;
374
+ data.position >>= 1;
375
+ if (data.position == 0) {
376
+ data.position = resetValue;
377
+ data.val = getNextValue(data.index++);
378
+ }
379
+ bits |= (resb > 0 ? 1 : 0) * power;
380
+ power <<= 1;
381
+ }
382
+ c = f(bits);
383
+ break;
384
+ case 2:
385
+ return "";
386
+ }
387
+ dictionary[3] = c;
388
+ w = c;
389
+ result.push(c);
390
+ while (true) {
391
+ if (data.index > length3) {
392
+ return "";
393
+ }
394
+ bits = 0;
395
+ maxpower = Math.pow(2, numBits);
396
+ power = 1;
397
+ while (power != maxpower) {
398
+ resb = data.val & data.position;
399
+ data.position >>= 1;
400
+ if (data.position == 0) {
401
+ data.position = resetValue;
402
+ data.val = getNextValue(data.index++);
403
+ }
404
+ bits |= (resb > 0 ? 1 : 0) * power;
405
+ power <<= 1;
406
+ }
407
+ switch (c = bits) {
408
+ case 0:
409
+ bits = 0;
410
+ maxpower = Math.pow(2, 8);
411
+ power = 1;
412
+ while (power != maxpower) {
413
+ resb = data.val & data.position;
414
+ data.position >>= 1;
415
+ if (data.position == 0) {
416
+ data.position = resetValue;
417
+ data.val = getNextValue(data.index++);
418
+ }
419
+ bits |= (resb > 0 ? 1 : 0) * power;
420
+ power <<= 1;
421
+ }
422
+ dictionary[dictSize++] = f(bits);
423
+ c = dictSize - 1;
424
+ enlargeIn--;
425
+ break;
426
+ case 1:
427
+ bits = 0;
428
+ maxpower = Math.pow(2, 16);
429
+ power = 1;
430
+ while (power != maxpower) {
431
+ resb = data.val & data.position;
432
+ data.position >>= 1;
433
+ if (data.position == 0) {
434
+ data.position = resetValue;
435
+ data.val = getNextValue(data.index++);
436
+ }
437
+ bits |= (resb > 0 ? 1 : 0) * power;
438
+ power <<= 1;
439
+ }
440
+ dictionary[dictSize++] = f(bits);
441
+ c = dictSize - 1;
442
+ enlargeIn--;
443
+ break;
444
+ case 2:
445
+ return result.join("");
446
+ }
447
+ if (enlargeIn == 0) {
448
+ enlargeIn = Math.pow(2, numBits);
449
+ numBits++;
450
+ }
451
+ if (dictionary[c]) {
452
+ entry = dictionary[c];
453
+ } else {
454
+ if (c === dictSize) {
455
+ entry = w + w.charAt(0);
456
+ } else {
457
+ return null;
458
+ }
459
+ }
460
+ result.push(entry);
461
+ dictionary[dictSize++] = w + entry.charAt(0);
462
+ enlargeIn--;
463
+ w = entry;
464
+ if (enlargeIn == 0) {
465
+ enlargeIn = Math.pow(2, numBits);
466
+ numBits++;
467
+ }
468
+ }
469
+ }
470
+ };
471
+ return LZString2;
472
+ }();
473
+ if (typeof define === "function" && define.amd) {
474
+ define(function() {
475
+ return LZString;
476
+ });
477
+ } else if (typeof module !== "undefined" && module != null) {
478
+ module.exports = LZString;
479
+ } else if (typeof angular !== "undefined" && angular != null) {
480
+ angular.module("LZString", []).factory("LZString", function() {
481
+ return LZString;
482
+ });
483
+ }
484
+ }
485
+ });
6
486
 
7
487
  // ../../../node_modules/.pnpm/effect@3.15.2/node_modules/effect/dist/esm/Function.js
8
488
  var isFunction = (input) => typeof input === "function";
@@ -2070,26 +2550,26 @@ var HashSetProto = {
2070
2550
  }
2071
2551
  };
2072
2552
  var makeImpl2 = (keyMap) => {
2073
- const set10 = Object.create(HashSetProto);
2074
- set10._keyMap = keyMap;
2075
- return set10;
2553
+ const set11 = Object.create(HashSetProto);
2554
+ set11._keyMap = keyMap;
2555
+ return set11;
2076
2556
  };
2077
2557
  var isHashSet = (u) => hasProperty(u, HashSetTypeId);
2078
2558
  var _empty3 = /* @__PURE__ */ makeImpl2(/* @__PURE__ */ empty4());
2079
2559
  var empty5 = () => _empty3;
2080
2560
  var fromIterable4 = (elements) => {
2081
- const set10 = beginMutation2(empty5());
2561
+ const set11 = beginMutation2(empty5());
2082
2562
  for (const value2 of elements) {
2083
- add(set10, value2);
2563
+ add(set11, value2);
2084
2564
  }
2085
- return endMutation2(set10);
2565
+ return endMutation2(set11);
2086
2566
  };
2087
2567
  var make6 = (...elements) => {
2088
- const set10 = beginMutation2(empty5());
2568
+ const set11 = beginMutation2(empty5());
2089
2569
  for (const value2 of elements) {
2090
- add(set10, value2);
2570
+ add(set11, value2);
2091
2571
  }
2092
- return endMutation2(set10);
2572
+ return endMutation2(set11);
2093
2573
  };
2094
2574
  var has3 = /* @__PURE__ */ dual(2, (self, value2) => has2(self._keyMap, value2));
2095
2575
  var size2 = (self) => size(self._keyMap);
@@ -2105,15 +2585,15 @@ var mutate2 = /* @__PURE__ */ dual(2, (self, f) => {
2105
2585
  });
2106
2586
  var add = /* @__PURE__ */ dual(2, (self, value2) => self._keyMap._editable ? (set(value2, true)(self._keyMap), self) : makeImpl2(set(value2, true)(self._keyMap)));
2107
2587
  var remove4 = /* @__PURE__ */ dual(2, (self, value2) => self._keyMap._editable ? (remove3(value2)(self._keyMap), self) : makeImpl2(remove3(value2)(self._keyMap)));
2108
- var difference2 = /* @__PURE__ */ dual(2, (self, that) => mutate2(self, (set10) => {
2588
+ var difference2 = /* @__PURE__ */ dual(2, (self, that) => mutate2(self, (set11) => {
2109
2589
  for (const value2 of that) {
2110
- remove4(set10, value2);
2590
+ remove4(set11, value2);
2111
2591
  }
2112
2592
  }));
2113
- var union2 = /* @__PURE__ */ dual(2, (self, that) => mutate2(empty5(), (set10) => {
2114
- forEach2(self, (value2) => add(set10, value2));
2593
+ var union2 = /* @__PURE__ */ dual(2, (self, that) => mutate2(empty5(), (set11) => {
2594
+ forEach2(self, (value2) => add(set11, value2));
2115
2595
  for (const value2 of that) {
2116
- add(set10, value2);
2596
+ add(set11, value2);
2117
2597
  }
2118
2598
  }));
2119
2599
  var forEach2 = /* @__PURE__ */ dual(2, (self, f) => forEach(self._keyMap, (_, k) => f(k)));
@@ -2264,7 +2744,7 @@ var isInterrupted = (self) => isSome2(interruptOption(self));
2264
2744
  var isInterruptedOnly = (self) => reduceWithContext(void 0, IsInterruptedOnlyCauseReducer)(self);
2265
2745
  var failures = (self) => reverse2(reduce6(self, empty3(), (list, cause2) => cause2._tag === OP_FAIL ? some2(pipe(list, prepend2(cause2.error))) : none2()));
2266
2746
  var defects = (self) => reverse2(reduce6(self, empty3(), (list, cause2) => cause2._tag === OP_DIE ? some2(pipe(list, prepend2(cause2.defect))) : none2()));
2267
- var interruptors = (self) => reduce6(self, empty6(), (set10, cause2) => cause2._tag === OP_INTERRUPT ? some2(pipe(set10, add2(cause2.fiberId))) : none2());
2747
+ var interruptors = (self) => reduce6(self, empty6(), (set11, cause2) => cause2._tag === OP_INTERRUPT ? some2(pipe(set11, add2(cause2.fiberId))) : none2());
2268
2748
  var failureOption = (self) => find(self, (cause2) => cause2._tag === OP_FAIL ? some2(cause2.error) : none2());
2269
2749
  var failureOrCause = (self) => {
2270
2750
  const option2 = failureOption(self);
@@ -3677,11 +4157,11 @@ var makeRemove = (value2) => {
3677
4157
  return o;
3678
4158
  };
3679
4159
  var diff2 = (oldValue, newValue) => {
3680
- const [removed, patch11] = reduce5([oldValue, empty13()], ([set10, patch12], value2) => {
3681
- if (has4(value2)(set10)) {
3682
- return [remove5(value2)(set10), patch12];
4160
+ const [removed, patch11] = reduce5([oldValue, empty13()], ([set11, patch12], value2) => {
4161
+ if (has4(value2)(set11)) {
4162
+ return [remove5(value2)(set11), patch12];
3683
4163
  }
3684
- return [set10, combine5(makeAdd(value2))(patch12)];
4164
+ return [set11, combine5(makeAdd(value2))(patch12)];
3685
4165
  })(newValue);
3686
4166
  return reduce5(patch11, (patch12, value2) => combine5(makeRemove(value2))(patch12))(removed);
3687
4167
  };
@@ -3690,7 +4170,7 @@ var patch2 = /* @__PURE__ */ dual(2, (self, oldValue) => {
3690
4170
  if (self._tag === "Empty") {
3691
4171
  return oldValue;
3692
4172
  }
3693
- let set10 = oldValue;
4173
+ let set11 = oldValue;
3694
4174
  let patches = of2(self);
3695
4175
  while (isNonEmpty(patches)) {
3696
4176
  const head7 = headNonEmpty2(patches);
@@ -3705,17 +4185,17 @@ var patch2 = /* @__PURE__ */ dual(2, (self, oldValue) => {
3705
4185
  break;
3706
4186
  }
3707
4187
  case "Add": {
3708
- set10 = add2(head7.value)(set10);
4188
+ set11 = add2(head7.value)(set11);
3709
4189
  patches = tail;
3710
4190
  break;
3711
4191
  }
3712
4192
  case "Remove": {
3713
- set10 = remove5(head7.value)(set10);
4193
+ set11 = remove5(head7.value)(set11);
3714
4194
  patches = tail;
3715
4195
  }
3716
4196
  }
3717
4197
  }
3718
- return set10;
4198
+ return set11;
3719
4199
  });
3720
4200
 
3721
4201
  // ../../../node_modules/.pnpm/effect@3.15.2/node_modules/effect/dist/esm/internal/differ/readonlyArrayPatch.js
@@ -6858,7 +7338,6 @@ var match7 = (concurrency, sequential4, unbounded4, bounded4) => {
6858
7338
  // ../../../node_modules/.pnpm/effect@3.15.2/node_modules/effect/dist/esm/Clock.js
6859
7339
  var sleep2 = sleep;
6860
7340
  var currentTimeMillis2 = currentTimeMillis;
6861
- var clockWith2 = clockWith;
6862
7341
  var Clock = clockTag;
6863
7342
 
6864
7343
  // ../../../node_modules/.pnpm/effect@3.15.2/node_modules/effect/dist/esm/internal/logSpan.js
@@ -6922,7 +7401,6 @@ var try_ = (arg) => {
6922
7401
  }
6923
7402
  });
6924
7403
  };
6925
- var clockWith3 = clockWith2;
6926
7404
  var diffFiberRefs = (self) => summarized(self, fiberRefs2, diff5);
6927
7405
  var diffFiberRefsAndRuntimeFlags = (self) => summarized(self, zip2(fiberRefs2, runtimeFlags), ([refs, flags], [refsNew, flagsNew]) => [diff5(refs, refsNew), diff4(flags, flagsNew)]);
6928
7406
  var match8 = /* @__PURE__ */ dual(2, (self, options3) => matchEffect(self, {
@@ -10636,27 +11114,6 @@ var Latch = class extends Class2 {
10636
11114
  };
10637
11115
  };
10638
11116
  var unsafeMakeLatch = (open) => new Latch(open ?? false);
10639
- var cached2 = /* @__PURE__ */ dual(2, (self, timeToLive) => map11(cachedInvalidateWithTTL(self, timeToLive), (tuple) => tuple[0]));
10640
- var cachedInvalidateWithTTL = /* @__PURE__ */ dual(2, (self, timeToLive) => {
10641
- const duration = decode(timeToLive);
10642
- return flatMap7(context(), (env) => map11(makeSynchronized(none2()), (cache) => [provideContext(getCachedValue(self, duration, cache), env), invalidateCache(cache)]));
10643
- });
10644
- var computeCachedValue = (self, timeToLive, start3) => {
10645
- const timeToLiveMillis = toMillis(decode(timeToLive));
10646
- return pipe(deferredMake(), tap((deferred) => intoDeferred(self, deferred)), map11((deferred) => some2([start3 + timeToLiveMillis, deferred])));
10647
- };
10648
- var getCachedValue = (self, timeToLive, cache) => uninterruptibleMask((restore) => pipe(clockWith3((clock3) => clock3.currentTimeMillis), flatMap7((time) => updateSomeAndGetEffectSynchronized(cache, (option2) => {
10649
- switch (option2._tag) {
10650
- case "None": {
10651
- return some2(computeCachedValue(self, timeToLive, time));
10652
- }
10653
- case "Some": {
10654
- const [end3] = option2.value;
10655
- return end3 - time <= 0 ? some2(computeCachedValue(self, timeToLive, time)) : none2();
10656
- }
10657
- }
10658
- })), flatMap7((option2) => isNone2(option2) ? dieMessage("BUG: Effect.cachedInvalidate - please report an issue at https://github.com/Effect-TS/effect/issues") : restore(deferredAwait(option2.value[1])))));
10659
- var invalidateCache = (cache) => set4(cache, none2());
10660
11117
  var forkIn = /* @__PURE__ */ dual(2, (self, scope4) => withFiberRuntime((parent, parentStatus) => {
10661
11118
  const scopeImpl = scope4;
10662
11119
  const fiber = unsafeFork2(self, parent, parentStatus.runtimeFlags, globalScope);
@@ -10708,17 +11165,6 @@ var unsafeMakeSynchronized = (value2) => {
10708
11165
  const sem = unsafeMakeSemaphore(1);
10709
11166
  return new SynchronizedImpl(ref, sem.withPermits(1));
10710
11167
  };
10711
- var updateSomeAndGetEffectSynchronized = /* @__PURE__ */ dual(2, (self, pf) => self.modifyEffect((value2) => {
10712
- const result = pf(value2);
10713
- switch (result._tag) {
10714
- case "None": {
10715
- return succeed([value2, value2]);
10716
- }
10717
- case "Some": {
10718
- return map11(result.value, (a) => [a, a]);
10719
- }
10720
- }
10721
- }));
10722
11168
 
10723
11169
  // ../../../node_modules/.pnpm/effect@3.15.2/node_modules/effect/dist/esm/internal/managedRuntime/circular.js
10724
11170
  var TypeId13 = /* @__PURE__ */ Symbol.for("effect/ManagedRuntime");
@@ -11351,7 +11797,6 @@ var pollUpTo = /* @__PURE__ */ dual(2, (self, n) => {
11351
11797
 
11352
11798
  // ../../../node_modules/.pnpm/effect@3.15.2/node_modules/effect/dist/esm/Effect.js
11353
11799
  var isEffect2 = isEffect;
11354
- var cachedWithTTL = cached2;
11355
11800
  var cached3 = memoize;
11356
11801
  var all4 = all3;
11357
11802
  var forEach8 = forEach7;
@@ -13565,8 +14010,8 @@ var go = (ast, isDecoding) => {
13565
14010
  };
13566
14011
  }
13567
14012
  case "Suspend": {
13568
- const get20 = memoizeThunk(() => goMemo(annotations(ast.f(), ast.annotations), isDecoding));
13569
- return (a, options3) => get20()(a, options3);
14013
+ const get21 = memoizeThunk(() => goMemo(annotations(ast.f(), ast.annotations), isDecoding));
14014
+ return (a, options3) => get21()(a, options3);
13570
14015
  }
13571
14016
  }
13572
14017
  };
@@ -16896,6 +17341,39 @@ var fromReadableStream2 = fromReadableStream;
16896
17341
  var suspend7 = suspend6;
16897
17342
  var toReadableStreamEffect2 = toReadableStreamEffect;
16898
17343
 
17344
+ // src/effect/cache.ts
17345
+ var import_lz_string = __toESM(require_lz_string());
17346
+ var Cache = {
17347
+ get(key) {
17348
+ const json2 = localStorage.getItem(key);
17349
+ if (!json2) return null;
17350
+ try {
17351
+ const entry = JSON.parse(import_lz_string.default.decompressFromUTF16(json2));
17352
+ if (entry.expiresAt !== void 0 && Date.now() > entry.expiresAt) {
17353
+ localStorage.removeItem(key);
17354
+ return null;
17355
+ }
17356
+ return entry.value;
17357
+ } catch {
17358
+ localStorage.removeItem(key);
17359
+ return null;
17360
+ }
17361
+ },
17362
+ set(key, value2, timeToLive) {
17363
+ const entry = { value: value2 };
17364
+ if (timeToLive !== void 0) {
17365
+ const ttlMs = toMillis(timeToLive);
17366
+ entry.expiresAt = Date.now() + ttlMs;
17367
+ }
17368
+ localStorage.setItem(key, import_lz_string.default.compressToUTF16(JSON.stringify(entry)));
17369
+ },
17370
+ remove(key) {
17371
+ localStorage.removeItem(key);
17372
+ }
17373
+ };
17374
+ var set7 = (key, value2, ttl) => sync4(() => Cache.set(key, value2, ttl));
17375
+ var get14 = (key) => sync4(() => Cache.get(key));
17376
+
16899
17377
  // src/effect/schema.ts
16900
17378
  var BaseAttributeValue = Union2(
16901
17379
  Null,
@@ -17107,7 +17585,7 @@ var BaseProduct = Struct({
17107
17585
  options: Array$(ProductOption),
17108
17586
  tags: Array$(String$)
17109
17587
  });
17110
- var get14 = (url) => tryPromise2({
17588
+ var get15 = (url) => tryPromise2({
17111
17589
  try: () => fetch(url).then((res) => {
17112
17590
  if (res.ok) {
17113
17591
  return res.json();
@@ -17117,8 +17595,12 @@ var get14 = (url) => tryPromise2({
17117
17595
  catch: (e) => new Error(String(e))
17118
17596
  });
17119
17597
  var cachedGet = (url) => gen2(function* () {
17120
- const cache = yield* cachedWithTTL(get14(url), "60 minutes");
17121
- return yield* cache;
17598
+ const cacheKey = `shopify-ajax-cart-api:${url}`;
17599
+ const cachedValue = yield* get14(cacheKey);
17600
+ if (cachedValue) return cachedValue;
17601
+ const value2 = yield* get15(url);
17602
+ yield* set7(cacheKey, value2, "60 minutes");
17603
+ return value2;
17122
17604
  });
17123
17605
  var Product = transformOrFail(String$, BaseProduct, {
17124
17606
  decode(handle, _, ast) {
@@ -17606,7 +18088,7 @@ var fromInput2 = (input) => {
17606
18088
  return out;
17607
18089
  };
17608
18090
  var unsafeFromRecord = (input) => Object.setPrototypeOf(input, Proto3);
17609
- var set8 = /* @__PURE__ */ dual(3, (self, key, value2) => {
18091
+ var set9 = /* @__PURE__ */ dual(3, (self, key, value2) => {
17610
18092
  const out = make49(self);
17611
18093
  out[key.toLowerCase()] = value2;
17612
18094
  return out;
@@ -17900,7 +18382,7 @@ var make50 = (method) => (url, options3) => modify4(empty35, {
17900
18382
  url,
17901
18383
  ...options3 ?? void 0
17902
18384
  });
17903
- var get16 = /* @__PURE__ */ make50("GET");
18385
+ var get17 = /* @__PURE__ */ make50("GET");
17904
18386
  var post = /* @__PURE__ */ make50("POST");
17905
18387
  var put = /* @__PURE__ */ make50("PUT");
17906
18388
  var patch9 = /* @__PURE__ */ make50("PATCH");
@@ -17935,7 +18417,7 @@ var modify4 = /* @__PURE__ */ dual(2, (self, options3) => {
17935
18417
  }
17936
18418
  return result;
17937
18419
  });
17938
- var setHeader = /* @__PURE__ */ dual(3, (self, key, value2) => makeInternal(self.method, self.url, self.urlParams, self.hash, set8(self.headers, key, value2), self.body));
18420
+ var setHeader = /* @__PURE__ */ dual(3, (self, key, value2) => makeInternal(self.method, self.url, self.urlParams, self.hash, set9(self.headers, key, value2), self.body));
17939
18421
  var setHeaders = /* @__PURE__ */ dual(2, (self, input) => makeInternal(self.method, self.url, self.urlParams, self.hash, setAll3(self.headers, input), self.body));
17940
18422
  var accept = /* @__PURE__ */ dual(2, (self, mediaType) => setHeader(self, "Accept", mediaType));
17941
18423
  var acceptJson = /* @__PURE__ */ accept("application/json");
@@ -17960,11 +18442,11 @@ var setBody = /* @__PURE__ */ dual(2, (self, body) => {
17960
18442
  } else {
17961
18443
  const contentType = body.contentType;
17962
18444
  if (contentType) {
17963
- headers = set8(headers, "content-type", contentType);
18445
+ headers = set9(headers, "content-type", contentType);
17964
18446
  }
17965
18447
  const contentLength = body.contentLength;
17966
18448
  if (contentLength) {
17967
- headers = set8(headers, "content-length", contentLength.toString());
18449
+ headers = set9(headers, "content-length", contentLength.toString());
17968
18450
  }
17969
18451
  }
17970
18452
  return makeInternal(self.method, self.url, self.urlParams, self.hash, headers, body);
@@ -18102,7 +18584,7 @@ var ClientProto = {
18102
18584
  };
18103
18585
  },
18104
18586
  get(url, options3) {
18105
- return this.execute(get16(url, options3));
18587
+ return this.execute(get17(url, options3));
18106
18588
  },
18107
18589
  head(url, options3) {
18108
18590
  return this.execute(head5(url, options3));
@@ -18298,7 +18780,7 @@ var {
18298
18780
  /** @internal */
18299
18781
  execute: execute2,
18300
18782
  /** @internal */
18301
- get: get17,
18783
+ get: get18,
18302
18784
  /** @internal */
18303
18785
  head: head6,
18304
18786
  /** @internal */
@@ -18320,7 +18802,7 @@ var layerMergedContext = (effect3) => effect(tag, flatMap10(context2(), (context
18320
18802
  var HttpClient = tag;
18321
18803
 
18322
18804
  // ../../../node_modules/.pnpm/@effect+platform@0.82.4_effect@3.15.2/node_modules/@effect/platform/dist/esm/HttpClientRequest.js
18323
- var get18 = get16;
18805
+ var get19 = get17;
18324
18806
  var post3 = post;
18325
18807
  var setUrlParams2 = setUrlParams;
18326
18808
  var bodyJson2 = bodyJson;
@@ -18419,7 +18901,7 @@ var makeFactory = ({
18419
18901
  }
18420
18902
  }).pipe(bodyJson2(decodedInput));
18421
18903
  } else if (method === "get") {
18422
- request = get18(url, {
18904
+ request = get19(url, {
18423
18905
  acceptJson: true
18424
18906
  }).pipe(setUrlParams2(decodedInput));
18425
18907
  } else {
@@ -18527,11 +19009,11 @@ var make57 = makeFactory({
18527
19009
  var add6 = make53;
18528
19010
  var change = make54;
18529
19011
  var clear = make55;
18530
- var get19 = make56;
19012
+ var get20 = make56;
18531
19013
  var update5 = make57;
18532
19014
 
18533
19015
  // src/index.ts
18534
- var validateCart = (cart) => runPromise(decodeUnknown2(CartOutput)(cart));
19016
+ var validateCart = (cart) => runSync(decodeUnknown2(CartOutput)(cart));
18535
19017
  var createAjaxCartApi = ({ debug = false }) => {
18536
19018
  let baseLayer = empty30;
18537
19019
  let minimumLogLevel2 = None3;
@@ -18639,7 +19121,7 @@ var createAjaxCartApi = ({ debug = false }) => {
18639
19121
  }
18640
19122
  ),
18641
19123
  get: (input, options3) => runPromise(
18642
- get19(input).pipe(
19124
+ get20(input).pipe(
18643
19125
  withMinimumLogLevel2(minimumLogLevel2),
18644
19126
  provide2(ajaxLayer),
18645
19127
  catchAll2((error) => {