@brytdesigns/shopify-ajax-cart-api 1.0.21 → 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
@@ -13530,8 +14010,8 @@ var go = (ast, isDecoding) => {
13530
14010
  };
13531
14011
  }
13532
14012
  case "Suspend": {
13533
- const get19 = memoizeThunk(() => goMemo(annotations(ast.f(), ast.annotations), isDecoding));
13534
- return (a, options3) => get19()(a, options3);
14013
+ const get21 = memoizeThunk(() => goMemo(annotations(ast.f(), ast.annotations), isDecoding));
14014
+ return (a, options3) => get21()(a, options3);
13535
14015
  }
13536
14016
  }
13537
14017
  };
@@ -16861,6 +17341,39 @@ var fromReadableStream2 = fromReadableStream;
16861
17341
  var suspend7 = suspend6;
16862
17342
  var toReadableStreamEffect2 = toReadableStreamEffect;
16863
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
+
16864
17377
  // src/effect/schema.ts
16865
17378
  var BaseAttributeValue = Union2(
16866
17379
  Null,
@@ -17045,9 +17558,59 @@ var UnitPriceMeasurement = Struct({
17045
17558
  reference_unit: String$,
17046
17559
  reference_value: Number$
17047
17560
  });
17561
+ var VariantQuantityRule = Struct({
17562
+ min: NullOr(Number$),
17563
+ max: NullOr(Number$),
17564
+ increment: Number$
17565
+ });
17048
17566
  var VariantOptions = optionalWith(Array$(String$), {
17049
17567
  default: () => []
17050
17568
  });
17569
+ var BaseVariant = Struct({
17570
+ id: Resource_exports.ID,
17571
+ title: String$,
17572
+ options: VariantOptions,
17573
+ quantity_rule: VariantQuantityRule
17574
+ });
17575
+ var ProductOption = Struct({
17576
+ name: String$,
17577
+ position: Number$,
17578
+ values: Array$(String$)
17579
+ });
17580
+ var BaseProduct = Struct({
17581
+ id: Resource_exports.ID,
17582
+ title: String$,
17583
+ handle: String$,
17584
+ variants: Array$(BaseVariant),
17585
+ options: Array$(ProductOption),
17586
+ tags: Array$(String$)
17587
+ });
17588
+ var get15 = (url) => tryPromise2({
17589
+ try: () => fetch(url).then((res) => {
17590
+ if (res.ok) {
17591
+ return res.json();
17592
+ }
17593
+ throw new Error(String(res.status));
17594
+ }),
17595
+ catch: (e) => new Error(String(e))
17596
+ });
17597
+ var cachedGet = (url) => gen2(function* () {
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;
17604
+ });
17605
+ var Product = transformOrFail(String$, BaseProduct, {
17606
+ decode(handle, _, ast) {
17607
+ return mapBoth3(cachedGet(`/products/${handle}.js`), {
17608
+ onFailure: (e) => new Type2(ast, handle, e.message),
17609
+ onSuccess: (product) => product
17610
+ });
17611
+ },
17612
+ encode: (product) => succeed8(product.handle)
17613
+ });
17051
17614
  var BaseLineItem = Struct({
17052
17615
  id: Resource_exports.ID,
17053
17616
  properties: BaseAttributes,
@@ -17098,6 +17661,7 @@ var LineItem = transform2(
17098
17661
  extend3(
17099
17662
  BaseLineItem,
17100
17663
  Struct({
17664
+ product: Product,
17101
17665
  properties_array: optionalWith(BaseAttributesArray, {
17102
17666
  default: () => []
17103
17667
  }),
@@ -17121,6 +17685,7 @@ var LineItem = transform2(
17121
17685
  {
17122
17686
  decode: (lineItem) => ({
17123
17687
  ...lineItem,
17688
+ product: lineItem.handle,
17124
17689
  properties_array: lineItem.properties,
17125
17690
  private_properties: lineItem.properties,
17126
17691
  private_properties_array: lineItem.properties,
@@ -17132,7 +17697,8 @@ var LineItem = transform2(
17132
17697
  remove("private_properties"),
17133
17698
  remove("private_properties_array"),
17134
17699
  remove("public_properties"),
17135
- remove("public_properties_array")
17700
+ remove("public_properties_array"),
17701
+ remove("product")
17136
17702
  )
17137
17703
  }
17138
17704
  );
@@ -17522,7 +18088,7 @@ var fromInput2 = (input) => {
17522
18088
  return out;
17523
18089
  };
17524
18090
  var unsafeFromRecord = (input) => Object.setPrototypeOf(input, Proto3);
17525
- var set8 = /* @__PURE__ */ dual(3, (self, key, value2) => {
18091
+ var set9 = /* @__PURE__ */ dual(3, (self, key, value2) => {
17526
18092
  const out = make49(self);
17527
18093
  out[key.toLowerCase()] = value2;
17528
18094
  return out;
@@ -17816,7 +18382,7 @@ var make50 = (method) => (url, options3) => modify4(empty35, {
17816
18382
  url,
17817
18383
  ...options3 ?? void 0
17818
18384
  });
17819
- var get15 = /* @__PURE__ */ make50("GET");
18385
+ var get17 = /* @__PURE__ */ make50("GET");
17820
18386
  var post = /* @__PURE__ */ make50("POST");
17821
18387
  var put = /* @__PURE__ */ make50("PUT");
17822
18388
  var patch9 = /* @__PURE__ */ make50("PATCH");
@@ -17851,7 +18417,7 @@ var modify4 = /* @__PURE__ */ dual(2, (self, options3) => {
17851
18417
  }
17852
18418
  return result;
17853
18419
  });
17854
- 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));
17855
18421
  var setHeaders = /* @__PURE__ */ dual(2, (self, input) => makeInternal(self.method, self.url, self.urlParams, self.hash, setAll3(self.headers, input), self.body));
17856
18422
  var accept = /* @__PURE__ */ dual(2, (self, mediaType) => setHeader(self, "Accept", mediaType));
17857
18423
  var acceptJson = /* @__PURE__ */ accept("application/json");
@@ -17876,11 +18442,11 @@ var setBody = /* @__PURE__ */ dual(2, (self, body) => {
17876
18442
  } else {
17877
18443
  const contentType = body.contentType;
17878
18444
  if (contentType) {
17879
- headers = set8(headers, "content-type", contentType);
18445
+ headers = set9(headers, "content-type", contentType);
17880
18446
  }
17881
18447
  const contentLength = body.contentLength;
17882
18448
  if (contentLength) {
17883
- headers = set8(headers, "content-length", contentLength.toString());
18449
+ headers = set9(headers, "content-length", contentLength.toString());
17884
18450
  }
17885
18451
  }
17886
18452
  return makeInternal(self.method, self.url, self.urlParams, self.hash, headers, body);
@@ -18018,7 +18584,7 @@ var ClientProto = {
18018
18584
  };
18019
18585
  },
18020
18586
  get(url, options3) {
18021
- return this.execute(get15(url, options3));
18587
+ return this.execute(get17(url, options3));
18022
18588
  },
18023
18589
  head(url, options3) {
18024
18590
  return this.execute(head5(url, options3));
@@ -18214,7 +18780,7 @@ var {
18214
18780
  /** @internal */
18215
18781
  execute: execute2,
18216
18782
  /** @internal */
18217
- get: get16,
18783
+ get: get18,
18218
18784
  /** @internal */
18219
18785
  head: head6,
18220
18786
  /** @internal */
@@ -18236,7 +18802,7 @@ var layerMergedContext = (effect3) => effect(tag, flatMap10(context2(), (context
18236
18802
  var HttpClient = tag;
18237
18803
 
18238
18804
  // ../../../node_modules/.pnpm/@effect+platform@0.82.4_effect@3.15.2/node_modules/@effect/platform/dist/esm/HttpClientRequest.js
18239
- var get17 = get15;
18805
+ var get19 = get17;
18240
18806
  var post3 = post;
18241
18807
  var setUrlParams2 = setUrlParams;
18242
18808
  var bodyJson2 = bodyJson;
@@ -18244,13 +18810,13 @@ var bodyJson2 = bodyJson;
18244
18810
  // ../../../node_modules/.pnpm/@effect+platform@0.82.4_effect@3.15.2/node_modules/@effect/platform/dist/esm/internal/fetchHttpClient.js
18245
18811
  var fetchTagKey = "@effect/platform/FetchHttpClient/Fetch";
18246
18812
  var requestInitTagKey = "@effect/platform/FetchHttpClient/FetchOptions";
18247
- var fetch = /* @__PURE__ */ make51((request, url, signal, fiber) => {
18813
+ var fetch2 = /* @__PURE__ */ make51((request, url, signal, fiber) => {
18248
18814
  const context5 = fiber.getFiberRef(currentContext2);
18249
- const fetch2 = context5.unsafeMap.get(fetchTagKey) ?? globalThis.fetch;
18815
+ const fetch3 = context5.unsafeMap.get(fetchTagKey) ?? globalThis.fetch;
18250
18816
  const options3 = context5.unsafeMap.get(requestInitTagKey) ?? {};
18251
18817
  const headers = options3.headers ? merge8(fromInput2(options3.headers), request.headers) : request.headers;
18252
18818
  const send = (body) => map17(tryPromise2({
18253
- try: () => fetch2(url, {
18819
+ try: () => fetch3(url, {
18254
18820
  ...options3,
18255
18821
  method: request.method,
18256
18822
  headers,
@@ -18275,7 +18841,7 @@ var fetch = /* @__PURE__ */ make51((request, url, signal, fiber) => {
18275
18841
  }
18276
18842
  return send(void 0);
18277
18843
  });
18278
- var layer = /* @__PURE__ */ layerMergedContext(/* @__PURE__ */ succeed7(fetch));
18844
+ var layer = /* @__PURE__ */ layerMergedContext(/* @__PURE__ */ succeed7(fetch2));
18279
18845
 
18280
18846
  // ../../../node_modules/.pnpm/@effect+platform@0.82.4_effect@3.15.2/node_modules/@effect/platform/dist/esm/FetchHttpClient.js
18281
18847
  var layer2 = layer;
@@ -18335,7 +18901,7 @@ var makeFactory = ({
18335
18901
  }
18336
18902
  }).pipe(bodyJson2(decodedInput));
18337
18903
  } else if (method === "get") {
18338
- request = get17(url, {
18904
+ request = get19(url, {
18339
18905
  acceptJson: true
18340
18906
  }).pipe(setUrlParams2(decodedInput));
18341
18907
  } else {
@@ -18443,7 +19009,7 @@ var make57 = makeFactory({
18443
19009
  var add6 = make53;
18444
19010
  var change = make54;
18445
19011
  var clear = make55;
18446
- var get18 = make56;
19012
+ var get20 = make56;
18447
19013
  var update5 = make57;
18448
19014
 
18449
19015
  // src/index.ts
@@ -18555,7 +19121,7 @@ var createAjaxCartApi = ({ debug = false }) => {
18555
19121
  }
18556
19122
  ),
18557
19123
  get: (input, options3) => runPromise(
18558
- get18(input).pipe(
19124
+ get20(input).pipe(
18559
19125
  withMinimumLogLevel2(minimumLogLevel2),
18560
19126
  provide2(ajaxLayer),
18561
19127
  catchAll2((error) => {