@bamboocss/shared 1.11.1

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.mjs ADDED
@@ -0,0 +1,1461 @@
1
+ // src/arbitrary-value.ts
2
+ var getArbitraryValue = (_value) => {
3
+ if (!_value || typeof _value !== "string") return _value;
4
+ const value = _value.trim();
5
+ if (value[0] === "[" && value[value.length - 1] === "]") {
6
+ const innerValue = value.slice(1, -1);
7
+ let bracketCount = 0;
8
+ for (let i = 0; i < innerValue.length; i++) {
9
+ if (innerValue[i] === "[") {
10
+ bracketCount++;
11
+ } else if (innerValue[i] === "]") {
12
+ if (bracketCount === 0) {
13
+ return value;
14
+ }
15
+ bracketCount--;
16
+ }
17
+ }
18
+ if (bracketCount === 0) {
19
+ return innerValue.trim();
20
+ }
21
+ }
22
+ return value;
23
+ };
24
+
25
+ // src/assert.ts
26
+ var isString = (v) => typeof v === "string";
27
+ var isBoolean = (v) => typeof v === "boolean";
28
+ var isFunction = (v) => typeof v === "function";
29
+ function isObject(value) {
30
+ return typeof value === "object" && value != null && !Array.isArray(value);
31
+ }
32
+ var isSymbol = (v) => typeof v === "symbol";
33
+ var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
34
+
35
+ // src/assign.ts
36
+ function assign(target, ...sources) {
37
+ for (const source of sources) {
38
+ for (const key in source) {
39
+ if (!target?.hasOwnProperty?.(key)) {
40
+ target[key] = source[key];
41
+ }
42
+ }
43
+ }
44
+ return target;
45
+ }
46
+
47
+ // src/astish.ts
48
+ var newRule = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g;
49
+ var ruleClean = /\/\*[^]*?\*\/| +/g;
50
+ var ruleNewline = /\n+/g;
51
+ var empty = " ";
52
+ var astish = (val, tree = [{}]) => {
53
+ if (!val) return tree[0];
54
+ let block, left;
55
+ while (block = newRule.exec(val.replace(ruleClean, ""))) {
56
+ if (block[4]) tree.shift();
57
+ else if (block[3]) {
58
+ left = block[3].replace(ruleNewline, empty).trim();
59
+ if (!left.includes("&") && !left.startsWith("@")) left = "& " + left;
60
+ tree.unshift(tree[0][left] = tree[0][left] || {});
61
+ } else tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim();
62
+ }
63
+ return tree[0];
64
+ };
65
+
66
+ // src/cache-map.ts
67
+ var CacheMap = class {
68
+ cache;
69
+ keysInUse;
70
+ maxCacheSize;
71
+ constructor(maxCacheSize = 1e3) {
72
+ this.maxCacheSize = maxCacheSize;
73
+ this.cache = /* @__PURE__ */ new Map();
74
+ this.keysInUse = [];
75
+ }
76
+ get(key) {
77
+ if (!this.cache.has(key)) {
78
+ return void 0;
79
+ }
80
+ this.updateKeyUsage(key);
81
+ return this.cache.get(key);
82
+ }
83
+ set(key, value) {
84
+ if (!this.cache.has(key) && this.cache.size === this.maxCacheSize) {
85
+ this.evictLeastRecentlyUsed();
86
+ }
87
+ this.cache.set(key, value);
88
+ this.updateKeyUsage(key);
89
+ return this;
90
+ }
91
+ delete(key) {
92
+ const result = this.cache.delete(key);
93
+ if (result) {
94
+ const index = this.keysInUse.indexOf(key);
95
+ if (index !== -1) {
96
+ this.keysInUse.splice(index, 1);
97
+ }
98
+ }
99
+ return result;
100
+ }
101
+ updateKeyUsage(key) {
102
+ const index = this.keysInUse.indexOf(key);
103
+ if (index !== -1) {
104
+ this.keysInUse.splice(index, 1);
105
+ }
106
+ this.keysInUse.push(key);
107
+ }
108
+ evictLeastRecentlyUsed() {
109
+ const keyToEvict = this.keysInUse.shift();
110
+ if (keyToEvict !== void 0) {
111
+ this.cache.delete(keyToEvict);
112
+ }
113
+ }
114
+ clear() {
115
+ this.cache.clear();
116
+ this.keysInUse = [];
117
+ }
118
+ has(key) {
119
+ return this.cache.has(key);
120
+ }
121
+ get size() {
122
+ return this.cache.size;
123
+ }
124
+ forEach(callback2, thisArg) {
125
+ this.cache.forEach(callback2, thisArg);
126
+ }
127
+ keys() {
128
+ return this.cache.keys();
129
+ }
130
+ values() {
131
+ return this.cache.values();
132
+ }
133
+ entries() {
134
+ return this.cache.entries();
135
+ }
136
+ getOrInsert(key, defaultValue) {
137
+ if (this.cache.has(key)) {
138
+ this.updateKeyUsage(key);
139
+ return this.cache.get(key);
140
+ }
141
+ this.set(key, defaultValue);
142
+ return defaultValue;
143
+ }
144
+ getOrInsertComputed(key, callback2) {
145
+ if (this.cache.has(key)) {
146
+ this.updateKeyUsage(key);
147
+ return this.cache.get(key);
148
+ }
149
+ const value = callback2(key);
150
+ this.set(key, value);
151
+ return value;
152
+ }
153
+ [Symbol.iterator]() {
154
+ return this.cache[Symbol.iterator]();
155
+ }
156
+ [Symbol.toStringTag] = "CacheMap";
157
+ toJSON = () => {
158
+ return this.cache;
159
+ };
160
+ };
161
+
162
+ // src/calc.ts
163
+ function isCssVar(value) {
164
+ return isObject(value) && "ref" in value;
165
+ }
166
+ function getRef(operand) {
167
+ return isCssVar(operand) ? operand.ref : operand.toString();
168
+ }
169
+ var calcRegex = /calc/g;
170
+ var toExpression = (operator, ...operands) => operands.map(getRef).join(` ${operator} `).replace(calcRegex, "");
171
+ var multiply = (...operands) => `calc(${toExpression("*", ...operands)})`;
172
+ var calc = {
173
+ negate(x) {
174
+ const value = getRef(x);
175
+ if (value != null && !Number.isNaN(parseFloat(value))) {
176
+ return String(value).startsWith("-") ? String(value).slice(1) : `-${value}`;
177
+ }
178
+ return multiply(value, -1);
179
+ }
180
+ };
181
+
182
+ // src/memo.ts
183
+ var memo = (fn) => {
184
+ const cache = /* @__PURE__ */ new Map();
185
+ const get = (...args) => {
186
+ const key = JSON.stringify(args);
187
+ if (cache.has(key)) {
188
+ return cache.get(key);
189
+ }
190
+ const result = fn(...args);
191
+ cache.set(key, result);
192
+ return result;
193
+ };
194
+ return get;
195
+ };
196
+
197
+ // src/camelcase-property.ts
198
+ var regex = /-(\w|$)/g;
199
+ var callback = (_dashChar, char) => char.toUpperCase();
200
+ var camelCaseProperty = memo((property) => {
201
+ if (property.startsWith("--")) return property;
202
+ let str = property.toLowerCase();
203
+ str = str.startsWith("-ms-") ? str.substring(1) : str;
204
+ return str.replace(regex, callback);
205
+ });
206
+
207
+ // src/capitalize.ts
208
+ var capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
209
+ var camelCaseRegex = /([a-z])([A-Z])/g;
210
+ var dashCase = (s) => s.replace(camelCaseRegex, "$1-$2").toLowerCase();
211
+ var uncapitalize = (s) => s.charAt(0).toLowerCase() + s.slice(1);
212
+
213
+ // src/compact.ts
214
+ function compact(value) {
215
+ return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));
216
+ }
217
+
218
+ // src/condition.ts
219
+ var isBaseCondition = (v) => v === "base";
220
+ function filterBaseConditions(c) {
221
+ return c.slice().filter((v) => !isBaseCondition(v));
222
+ }
223
+
224
+ // src/hash.ts
225
+ function toChar(code) {
226
+ return String.fromCharCode(code + (code > 25 ? 39 : 97));
227
+ }
228
+ function toName(code) {
229
+ let name = "";
230
+ let x;
231
+ for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toChar(x % 52) + name;
232
+ return toChar(x % 52) + name;
233
+ }
234
+ function toPhash(h, x) {
235
+ let i = x.length;
236
+ while (i) h = h * 33 ^ x.charCodeAt(--i);
237
+ return h;
238
+ }
239
+ function toHash(value) {
240
+ return toName(toPhash(5381, value) >>> 0);
241
+ }
242
+
243
+ // src/important.ts
244
+ var importantRegex = /\s*!(important)?/i;
245
+ function isImportant(value) {
246
+ return typeof value === "string" ? importantRegex.test(value) : false;
247
+ }
248
+ function withoutImportant(value) {
249
+ return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
250
+ }
251
+ function withoutSpace(str) {
252
+ return typeof str === "string" ? str.replaceAll(" ", "_") : str;
253
+ }
254
+ function markImportant(obj) {
255
+ if (typeof obj !== "object" || obj === null) {
256
+ return obj;
257
+ }
258
+ const result = Array.isArray(obj) ? [] : {};
259
+ const stack = [{ obj, result }];
260
+ while (stack.length > 0) {
261
+ const { obj: obj2, result: result2 } = stack.pop();
262
+ for (const [key, value] of Object.entries(obj2)) {
263
+ if (typeof value === "string" || typeof value === "number") {
264
+ result2[key] = `${value} !important`;
265
+ } else if (typeof value === "object" && value !== null) {
266
+ const next = Array.isArray(value) ? [] : {};
267
+ result2[key] = next;
268
+ stack.push({ obj: value, result: next });
269
+ } else {
270
+ result2[key] = value;
271
+ }
272
+ }
273
+ }
274
+ return result;
275
+ }
276
+
277
+ // src/merge-props.ts
278
+ var MERGE_OMIT = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
279
+ function mergeProps(...sources) {
280
+ return sources.reduce((prev, obj) => {
281
+ if (!obj) return prev;
282
+ Object.keys(obj).forEach((key) => {
283
+ if (MERGE_OMIT.has(key)) return;
284
+ const prevValue = prev[key];
285
+ const value = obj[key];
286
+ if (isObject(prevValue) && isObject(value)) {
287
+ prev[key] = mergeProps(prevValue, value);
288
+ } else {
289
+ prev[key] = value;
290
+ }
291
+ });
292
+ return prev;
293
+ }, {});
294
+ }
295
+
296
+ // src/walk-object.ts
297
+ var isNotNullish = (element) => element != null;
298
+ function walkObject(target, predicate, options = {}) {
299
+ const { stop, getKey } = options;
300
+ function inner(value, path = []) {
301
+ if (isObjectOrArray(value)) {
302
+ const result = {};
303
+ for (const [prop, child] of Object.entries(value)) {
304
+ const key = getKey?.(prop, child) ?? prop;
305
+ const childPath = [...path, key];
306
+ if (stop?.(value, childPath)) {
307
+ return predicate(value, path);
308
+ }
309
+ const next = inner(child, childPath);
310
+ if (isNotNullish(next)) {
311
+ result[key] = next;
312
+ }
313
+ }
314
+ return result;
315
+ }
316
+ return predicate(value, path);
317
+ }
318
+ return inner(target);
319
+ }
320
+ function mapObject(obj, fn) {
321
+ if (Array.isArray(obj)) return obj.map((value) => fn(value));
322
+ if (!isObject(obj)) return fn(obj);
323
+ return walkObject(obj, (value) => fn(value));
324
+ }
325
+
326
+ // src/normalize-style-object.ts
327
+ function toResponsiveObject(values, breakpoints) {
328
+ return values.reduce(
329
+ (acc, current, index) => {
330
+ const key = breakpoints[index];
331
+ if (current != null) {
332
+ acc[key] = current;
333
+ }
334
+ return acc;
335
+ },
336
+ {}
337
+ );
338
+ }
339
+ function normalizeStyleObject(styles, context, shorthand = true) {
340
+ const { utility, conditions } = context;
341
+ const { hasShorthand, resolveShorthand } = utility;
342
+ return walkObject(
343
+ styles,
344
+ (value) => {
345
+ return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;
346
+ },
347
+ {
348
+ stop: (value) => Array.isArray(value),
349
+ getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0
350
+ }
351
+ );
352
+ }
353
+
354
+ // src/classname.ts
355
+ var fallbackCondition = {
356
+ shift: (v) => v,
357
+ finalize: (v) => v,
358
+ breakpoints: { keys: [] }
359
+ };
360
+ var sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\n\s]+/g, " ") : value;
361
+ var ENTRY_SEP = "]___[";
362
+ var COND_SEP = "<___>";
363
+ function createCss(context) {
364
+ const { utility, hash, grouped, conditions: conds = fallbackCondition } = context;
365
+ const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");
366
+ const hashFn = (conditions, className) => {
367
+ let result;
368
+ if (hash) {
369
+ const baseArray = [...conds.finalize(conditions), className];
370
+ result = formatClassName(utility.toHash(baseArray, toHash));
371
+ } else {
372
+ const baseArray = [...conds.finalize(conditions), formatClassName(className)];
373
+ result = baseArray.join(":");
374
+ }
375
+ return result;
376
+ };
377
+ if (grouped) {
378
+ return memo(({ base, ...styles } = {}) => {
379
+ const styleObject = Object.assign(styles, base);
380
+ const normalizedObject = normalizeStyleObject(styleObject, context);
381
+ const hashes = [];
382
+ walkObject(normalizedObject, (value, paths) => {
383
+ if (value == null) return;
384
+ const [prop, ...allConditions] = conds.shift(paths);
385
+ const conditions = filterBaseConditions(allConditions);
386
+ const parts = [`${prop}${ENTRY_SEP}value:${value}`];
387
+ if (conditions.length) {
388
+ parts.push(`cond:${conditions.join(COND_SEP)}`);
389
+ }
390
+ hashes.push(parts.join(ENTRY_SEP));
391
+ });
392
+ if (hashes.length === 0) return "";
393
+ hashes.sort();
394
+ const groupId = hashes.join("|");
395
+ const shortHash = utility.toHash(["grouped", groupId], toHash);
396
+ return formatClassName(shortHash);
397
+ });
398
+ }
399
+ return memo(({ base, ...styles } = {}) => {
400
+ const styleObject = Object.assign(styles, base);
401
+ const normalizedObject = normalizeStyleObject(styleObject, context);
402
+ const classNames = /* @__PURE__ */ new Set();
403
+ walkObject(normalizedObject, (value, paths) => {
404
+ if (value == null) return;
405
+ const important = isImportant(value);
406
+ const [prop, ...allConditions] = conds.shift(paths);
407
+ const conditions = filterBaseConditions(allConditions);
408
+ const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
409
+ let className = hashFn(conditions, transformed.className);
410
+ if (important) className = `${className}!`;
411
+ classNames.add(className);
412
+ });
413
+ return Array.from(classNames).join(" ");
414
+ });
415
+ }
416
+ function compactStyles(...styles) {
417
+ return styles.flat().filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);
418
+ }
419
+ function createMergeCss(context) {
420
+ function resolve(styles) {
421
+ const allStyles = compactStyles(...styles);
422
+ if (allStyles.length === 1) return allStyles;
423
+ return allStyles.map((style) => normalizeStyleObject(style, context));
424
+ }
425
+ function mergeCss(...styles) {
426
+ return mergeProps(...resolve(styles));
427
+ }
428
+ function assignCss(...styles) {
429
+ return Object.assign({}, ...resolve(styles));
430
+ }
431
+ return { mergeCss: memo(mergeCss), assignCss };
432
+ }
433
+
434
+ // src/css-var.ts
435
+ var escRegex = /[^a-zA-Z0-9_\u0081-\uffff-]/g;
436
+ function esc(string) {
437
+ return `${string}`.replace(escRegex, (s) => `\\${s}`);
438
+ }
439
+ var dashCaseRegex = /[A-Z]/g;
440
+ function dashCase2(string) {
441
+ return string.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);
442
+ }
443
+ function cssVar(name, options = {}) {
444
+ const { fallback = "", prefix = "", hash } = options;
445
+ const variable = hash ? ["-", prefix, toHash(name)].filter(Boolean).join("-") : dashCase2(["-", prefix, esc(name)].filter(Boolean).join("-"));
446
+ const result = {
447
+ var: variable,
448
+ ref: `var(${variable}${fallback ? `, ${fallback}` : ""})`
449
+ };
450
+ return result;
451
+ }
452
+
453
+ // src/deep-set.ts
454
+ var deepSet = (target, path, value) => {
455
+ const isValueObject = isObject(value);
456
+ if (!path.length && isValueObject) {
457
+ return mergeProps(target, value);
458
+ }
459
+ let current = target;
460
+ for (let i = 0; i < path.length; i++) {
461
+ const key = path[i];
462
+ current[key] ||= {};
463
+ if (i === path.length - 1) {
464
+ if (isValueObject && isObject(current[key])) {
465
+ current[key] = mergeProps(current[key], value);
466
+ } else {
467
+ current[key] = value;
468
+ }
469
+ } else {
470
+ current = current[key];
471
+ }
472
+ }
473
+ return target;
474
+ };
475
+
476
+ // src/entries.ts
477
+ function fromEntries(entries2) {
478
+ const result = {};
479
+ entries2.forEach((kv) => {
480
+ result[kv[0]] = kv[1];
481
+ });
482
+ return result;
483
+ }
484
+ function entries(obj) {
485
+ const result = [];
486
+ for (const key in obj) {
487
+ result.push([key, obj[key]]);
488
+ }
489
+ return result;
490
+ }
491
+ function mapEntries(obj, f) {
492
+ const result = {};
493
+ for (const key in obj) {
494
+ const kv = f(key, obj[key]);
495
+ result[kv[0]] = kv[1];
496
+ }
497
+ return result;
498
+ }
499
+
500
+ // src/error.ts
501
+ var BambooError = class extends Error {
502
+ code;
503
+ hint;
504
+ constructor(code, message, opts) {
505
+ super(message, { cause: opts?.cause });
506
+ this.code = `ERR_BAMBOO_${code}`;
507
+ this.hint = opts?.hint;
508
+ }
509
+ };
510
+
511
+ // src/esc.ts
512
+ var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|^-|[^\x80-\uFFFF\w-]/g;
513
+ var fcssescape = function(ch, asCodePoint) {
514
+ if (!asCodePoint) return "\\" + ch;
515
+ if (ch === "\0") return "\uFFFD";
516
+ if (ch === "-" && ch.length === 1) return "\\-";
517
+ return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16);
518
+ };
519
+ var esc2 = (sel) => {
520
+ return (sel + "").replace(rcssescape, fcssescape);
521
+ };
522
+
523
+ // src/flatten.ts
524
+ function filterDefault(path) {
525
+ if (path[0] === "DEFAULT") return path;
526
+ return path.filter((item) => item !== "DEFAULT");
527
+ }
528
+ function flatten(values, stop) {
529
+ const result = {};
530
+ walkObject(
531
+ values,
532
+ (token, paths) => {
533
+ paths = filterDefault(paths);
534
+ if (token) {
535
+ result[paths.join(".")] = token.value;
536
+ }
537
+ },
538
+ {
539
+ stop: stop ?? ((v) => {
540
+ return isObject(v) && "value" in v;
541
+ })
542
+ }
543
+ );
544
+ return result;
545
+ }
546
+
547
+ // src/get-or-create-set.ts
548
+ function getOrCreateSet(map, key) {
549
+ let set = map.get(key);
550
+ if (!set) {
551
+ map.set(key, /* @__PURE__ */ new Set());
552
+ set = map.get(key);
553
+ }
554
+ return set;
555
+ }
556
+
557
+ // src/hypenate-property.ts
558
+ var wordRegex = /([A-Z])/g;
559
+ var msRegex = /^ms-/;
560
+ var hypenateProperty = memo((property) => {
561
+ if (property.startsWith("--")) return property;
562
+ return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
563
+ });
564
+
565
+ // src/is-css-function.ts
566
+ var fns = ["min", "max", "clamp", "calc"];
567
+ var fnRegExp = new RegExp(`^(${fns.join("|")})\\(.*\\)`);
568
+ var isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);
569
+
570
+ // src/is-css-unit.ts
571
+ var lengthUnits = "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%";
572
+ var lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;
573
+ var lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);
574
+ var isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);
575
+
576
+ // src/is-css-var.ts
577
+ var isCssVar2 = (v) => typeof v === "string" && /^var\(--.+\)$/.test(v);
578
+
579
+ // src/merge-anything.ts
580
+ var MERGE_OMIT2 = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
581
+ function concatArrays(originVal, newVal) {
582
+ if (Array.isArray(originVal) && Array.isArray(newVal)) {
583
+ return originVal.concat(newVal);
584
+ }
585
+ return newVal;
586
+ }
587
+ function assignProp(carry, key, newVal, originalObject) {
588
+ const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
589
+ if (propType === "enumerable") carry[key] = newVal;
590
+ if (propType === "nonenumerable") {
591
+ Object.defineProperty(carry, key, {
592
+ value: newVal,
593
+ enumerable: false,
594
+ writable: true,
595
+ configurable: true
596
+ });
597
+ }
598
+ }
599
+ function mergeRecursively(origin, newComer, compareFn) {
600
+ if (!isObject(newComer)) return newComer;
601
+ let newObject = {};
602
+ if (isObject(origin)) {
603
+ const props2 = Object.getOwnPropertyNames(origin);
604
+ const symbols2 = Object.getOwnPropertySymbols(origin);
605
+ newObject = [...props2, ...symbols2].reduce(
606
+ (carry, key) => {
607
+ if (isString(key) && MERGE_OMIT2.has(key)) return carry;
608
+ const targetVal = origin[key];
609
+ if (!isSymbol(key) && !Object.getOwnPropertyNames(newComer).includes(key) || isSymbol(key) && !Object.getOwnPropertySymbols(newComer).includes(key)) {
610
+ assignProp(carry, key, targetVal, origin);
611
+ }
612
+ return carry;
613
+ },
614
+ {}
615
+ );
616
+ }
617
+ const props = Object.getOwnPropertyNames(newComer);
618
+ const symbols = Object.getOwnPropertySymbols(newComer);
619
+ const result = [...props, ...symbols].reduce((carry, key) => {
620
+ if (isString(key) && MERGE_OMIT2.has(key)) return carry;
621
+ let newVal = newComer[key];
622
+ const targetVal = isObject(origin) ? origin[key] : void 0;
623
+ if (targetVal !== void 0 && isObject(newVal)) {
624
+ newVal = mergeRecursively(targetVal, newVal, compareFn);
625
+ }
626
+ const propToAssign = compareFn ? compareFn(targetVal, newVal, key) : newVal;
627
+ assignProp(carry, key, propToAssign, newComer);
628
+ return carry;
629
+ }, newObject);
630
+ return result;
631
+ }
632
+ function mergeAndConcat(object, ...otherObjects) {
633
+ return otherObjects.reduce((result, newComer) => {
634
+ return mergeRecursively(result, newComer, concatArrays);
635
+ }, object);
636
+ }
637
+
638
+ // src/merge-with.ts
639
+ var MERGE_OMIT3 = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
640
+ function mergeWith(target, ...sources) {
641
+ const customizer = sources.pop();
642
+ for (const source of sources) {
643
+ for (const key in source) {
644
+ if (isString(key) && MERGE_OMIT3.has(key)) continue;
645
+ const merged = customizer(target[key], source[key]);
646
+ if (merged === void 0) {
647
+ if (isObject(target[key]) && isObject(source[key])) {
648
+ target[key] = mergeWith({}, target[key], source[key], customizer);
649
+ } else {
650
+ target[key] = source[key];
651
+ }
652
+ } else {
653
+ target[key] = merged;
654
+ }
655
+ }
656
+ }
657
+ return target;
658
+ }
659
+
660
+ // src/traverse.ts
661
+ var defaultOptions = {
662
+ separator: ".",
663
+ maxDepth: Infinity
664
+ };
665
+ function traverse(obj, callback2, options = defaultOptions) {
666
+ const maxDepth = options.maxDepth ?? defaultOptions.maxDepth;
667
+ const separator = options.separator ?? defaultOptions.separator;
668
+ const stack = [{ value: obj, path: "", paths: [], depth: -1, parent: null, key: "" }];
669
+ while (stack.length > 0) {
670
+ const currentItem = stack.pop();
671
+ if (currentItem.parent !== null) {
672
+ callback2(currentItem);
673
+ }
674
+ if (options.stop?.(currentItem)) {
675
+ continue;
676
+ }
677
+ if (isObjectOrArray(currentItem.value) && currentItem.depth < maxDepth) {
678
+ const keys = Object.keys(currentItem.value);
679
+ for (let i = keys.length - 1; i >= 0; i--) {
680
+ const key = keys[i];
681
+ const value = currentItem.value[key];
682
+ const path = currentItem.path ? currentItem.path + separator + key : key;
683
+ const paths = currentItem.paths.concat(key);
684
+ stack.push({
685
+ value,
686
+ path,
687
+ paths,
688
+ depth: currentItem.depth + 1,
689
+ parent: currentItem.value,
690
+ key
691
+ });
692
+ }
693
+ }
694
+ }
695
+ }
696
+
697
+ // src/omit.ts
698
+ var omit = (obj, paths) => {
699
+ const result = { ...obj };
700
+ traverse(result, ({ path, parent, key }) => {
701
+ if (paths.includes(path)) {
702
+ delete parent[key];
703
+ }
704
+ });
705
+ return result;
706
+ };
707
+
708
+ // src/bamboo-config-name.ts
709
+ var BAMBOO_CONFIG_NAME = "__bamboo.config__";
710
+
711
+ // src/pattern-fns.ts
712
+ var patternFns = {
713
+ map: mapObject,
714
+ isCssFunction,
715
+ isCssVar: isCssVar2,
716
+ isCssUnit
717
+ };
718
+ var getPatternStyles = (pattern, styles) => {
719
+ if (!pattern?.defaultValues) return styles;
720
+ const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
721
+ return Object.assign({}, defaults, compact(styles));
722
+ };
723
+
724
+ // src/split.ts
725
+ function splitBy(value, separator = ",") {
726
+ const result = [];
727
+ let current = "";
728
+ let depth = 0;
729
+ for (let i = 0; i < value.length; i++) {
730
+ const char = value[i];
731
+ if (char === "(") {
732
+ depth++;
733
+ } else if (char === ")") {
734
+ depth--;
735
+ } else if (char === separator && depth === 0) {
736
+ result.push(current);
737
+ current = "";
738
+ continue;
739
+ }
740
+ current += char;
741
+ }
742
+ result.push(current);
743
+ return result;
744
+ }
745
+ function splitDotPath(path) {
746
+ return path.split(".").reduce((acc, curr) => {
747
+ const last = acc[acc.length - 1];
748
+ if (last != null && !isNaN(Number(last)) && !isNaN(Number(curr))) {
749
+ acc[acc.length - 1] = `${last}.${curr}`;
750
+ } else {
751
+ acc.push(curr);
752
+ }
753
+ return acc;
754
+ }, []);
755
+ }
756
+ function getNegativePath(path) {
757
+ return path.slice(0, -1).concat(`-${path.at(-1)}`);
758
+ }
759
+ function getDotPath(obj, path, fallback) {
760
+ if (typeof path !== "string") return fallback;
761
+ const idx = path.indexOf(".");
762
+ if (idx === -1) {
763
+ return obj?.[path] ?? fallback;
764
+ }
765
+ const key = path.slice(0, idx);
766
+ const nextPath = path.slice(idx + 1);
767
+ const checkValue = obj?.[key]?.[nextPath];
768
+ if (checkValue) {
769
+ return checkValue;
770
+ }
771
+ return getDotPath(obj?.[key], nextPath, fallback) ?? fallback;
772
+ }
773
+
774
+ // src/pick.ts
775
+ var pick = (obj, paths) => {
776
+ const result = {};
777
+ traverse(obj, ({ path, value }) => {
778
+ if (paths.includes(path)) {
779
+ const pathParts = splitDotPath(path);
780
+ deepSet(result, pathParts, value);
781
+ }
782
+ });
783
+ return result;
784
+ };
785
+
786
+ // src/property-priority.ts
787
+ var longHandPhysical = /* @__PURE__ */ new Set();
788
+ var longHandLogical = /* @__PURE__ */ new Set();
789
+ var shorthandsOfLonghands = /* @__PURE__ */ new Set();
790
+ var shorthandsOfShorthands = /* @__PURE__ */ new Set();
791
+ longHandLogical.add("backgroundBlendMode");
792
+ longHandLogical.add("isolation");
793
+ longHandLogical.add("mixBlendMode");
794
+ shorthandsOfShorthands.add("animation");
795
+ longHandLogical.add("animationComposition");
796
+ longHandLogical.add("animationDelay");
797
+ longHandLogical.add("animationDirection");
798
+ longHandLogical.add("animationDuration");
799
+ longHandLogical.add("animationFillMode");
800
+ longHandLogical.add("animationIterationCount");
801
+ longHandLogical.add("animationName");
802
+ longHandLogical.add("animationPlayState");
803
+ shorthandsOfLonghands.add("animationRange");
804
+ longHandLogical.add("animationRangeEnd");
805
+ longHandLogical.add("animationRangeStart");
806
+ longHandLogical.add("animationTimingFunction");
807
+ longHandLogical.add("animationTimeline");
808
+ shorthandsOfLonghands.add("scrollTimeline");
809
+ longHandLogical.add("scrollTimelineAxis");
810
+ longHandLogical.add("scrollTimelineName");
811
+ longHandLogical.add("timelineScope");
812
+ shorthandsOfLonghands.add("viewTimeline");
813
+ longHandLogical.add("viewTimelineAxis");
814
+ longHandLogical.add("viewTimelineInset");
815
+ longHandLogical.add("viewTimelineName");
816
+ shorthandsOfShorthands.add("background");
817
+ longHandLogical.add("backgroundAttachment");
818
+ longHandLogical.add("backgroundClip");
819
+ longHandLogical.add("backgroundColor");
820
+ longHandLogical.add("backgroundImage");
821
+ longHandLogical.add("backgroundOrigin");
822
+ longHandLogical.add("backgroundRepeat");
823
+ longHandLogical.add("backgroundSize");
824
+ shorthandsOfLonghands.add("backgroundPosition");
825
+ longHandLogical.add("backgroundPositionX");
826
+ longHandLogical.add("backgroundPositionY");
827
+ shorthandsOfShorthands.add("border");
828
+ shorthandsOfLonghands.add("borderColor");
829
+ shorthandsOfLonghands.add("borderStyle");
830
+ shorthandsOfLonghands.add("borderWidth");
831
+ shorthandsOfShorthands.add("borderBlock");
832
+ longHandLogical.add("borderBlockColor");
833
+ longHandLogical.add("borderBlockStyle");
834
+ longHandLogical.add("borderBlockWidth");
835
+ shorthandsOfLonghands.add("borderBlockStart");
836
+ shorthandsOfLonghands.add("borderTop");
837
+ longHandLogical.add("borderBlockStartColor");
838
+ longHandPhysical.add("borderTopColor");
839
+ longHandLogical.add("borderBlockStartStyle");
840
+ longHandPhysical.add("borderTopStyle");
841
+ longHandLogical.add("borderBlockStartWidth");
842
+ longHandPhysical.add("borderTopWidth");
843
+ shorthandsOfLonghands.add("borderBlockEnd");
844
+ shorthandsOfLonghands.add("borderBottom");
845
+ longHandLogical.add("borderBlockEndColor");
846
+ longHandPhysical.add("borderBottomColor");
847
+ longHandLogical.add("borderBlockEndStyle");
848
+ longHandPhysical.add("borderBottomStyle");
849
+ longHandLogical.add("borderBlockEndWidth");
850
+ longHandPhysical.add("borderBottomWidth");
851
+ shorthandsOfShorthands.add("borderInline");
852
+ shorthandsOfLonghands.add("borderInlineColor");
853
+ shorthandsOfLonghands.add("borderInlineStyle");
854
+ shorthandsOfLonghands.add("borderInlineWidth");
855
+ shorthandsOfLonghands.add("borderInlineStart");
856
+ shorthandsOfLonghands.add("borderLeft");
857
+ longHandLogical.add("borderInlineStartColor");
858
+ longHandPhysical.add("borderLeftColor");
859
+ longHandLogical.add("borderInlineStartStyle");
860
+ longHandPhysical.add("borderLeftStyle");
861
+ longHandLogical.add("borderInlineStartWidth");
862
+ longHandPhysical.add("borderLeftWidth");
863
+ shorthandsOfLonghands.add("borderInlineEnd");
864
+ shorthandsOfLonghands.add("borderRight");
865
+ longHandLogical.add("borderInlineEndColor");
866
+ longHandPhysical.add("borderRightColor");
867
+ longHandLogical.add("borderInlineEndStyle");
868
+ longHandPhysical.add("borderRightStyle");
869
+ longHandLogical.add("borderInlineEndWidth");
870
+ longHandPhysical.add("borderRightWidth");
871
+ shorthandsOfLonghands.add("borderImage");
872
+ longHandLogical.add("borderImageOutset");
873
+ longHandLogical.add("borderImageRepeat");
874
+ longHandLogical.add("borderImageSlice");
875
+ longHandLogical.add("borderImageSource");
876
+ longHandLogical.add("borderImageWidth");
877
+ shorthandsOfLonghands.add("borderRadius");
878
+ longHandLogical.add("borderStartEndRadius");
879
+ longHandLogical.add("borderStartStartRadius");
880
+ longHandLogical.add("borderEndEndRadius");
881
+ longHandLogical.add("borderEndStartRadius");
882
+ longHandPhysical.add("borderTopLeftRadius");
883
+ longHandPhysical.add("borderTopRightRadius");
884
+ longHandPhysical.add("borderBottomLeftRadius");
885
+ longHandPhysical.add("borderBottomRightRadius");
886
+ longHandLogical.add("boxShadow");
887
+ longHandLogical.add("accentColor");
888
+ longHandLogical.add("appearance");
889
+ longHandLogical.add("aspectRatio");
890
+ shorthandsOfLonghands.add("caret");
891
+ longHandLogical.add("caretColor");
892
+ longHandLogical.add("caretShape");
893
+ longHandLogical.add("cursor");
894
+ longHandLogical.add("imeMode");
895
+ longHandLogical.add("inputSecurity");
896
+ shorthandsOfLonghands.add("outline");
897
+ longHandLogical.add("outlineColor");
898
+ longHandLogical.add("outlineOffset");
899
+ longHandLogical.add("outlineStyle");
900
+ longHandLogical.add("outlineWidth");
901
+ longHandLogical.add("pointerEvents");
902
+ longHandLogical.add("resize");
903
+ longHandLogical.add("textOverflow");
904
+ longHandLogical.add("userSelect");
905
+ shorthandsOfLonghands.add("gridGap");
906
+ shorthandsOfLonghands.add("gap");
907
+ longHandLogical.add("gridRowGap");
908
+ longHandLogical.add("rowGap");
909
+ longHandLogical.add("gridColumnGap");
910
+ longHandLogical.add("columnGap");
911
+ shorthandsOfLonghands.add("placeContent");
912
+ longHandLogical.add("alignContent");
913
+ longHandLogical.add("justifyContent");
914
+ shorthandsOfLonghands.add("placeItems");
915
+ longHandLogical.add("alignItems");
916
+ longHandLogical.add("justifyItems");
917
+ shorthandsOfLonghands.add("placeSelf");
918
+ longHandLogical.add("alignSelf");
919
+ longHandLogical.add("justifySelf");
920
+ longHandLogical.add("boxSizing");
921
+ longHandLogical.add("fieldSizing");
922
+ longHandLogical.add("blockSize");
923
+ longHandPhysical.add("height");
924
+ longHandLogical.add("inlineSize");
925
+ longHandPhysical.add("width");
926
+ longHandLogical.add("maxBlockSize");
927
+ longHandPhysical.add("maxHeight");
928
+ longHandLogical.add("maxInlineSize");
929
+ longHandPhysical.add("maxWidth");
930
+ longHandLogical.add("minBlockSize");
931
+ longHandPhysical.add("minHeight");
932
+ longHandLogical.add("minInlineSize");
933
+ longHandPhysical.add("minWidth");
934
+ shorthandsOfShorthands.add("margin");
935
+ shorthandsOfLonghands.add("marginBlock");
936
+ longHandLogical.add("marginBlockStart");
937
+ longHandPhysical.add("marginTop");
938
+ longHandLogical.add("marginBlockEnd");
939
+ longHandPhysical.add("marginBottom");
940
+ shorthandsOfLonghands.add("marginInline");
941
+ longHandLogical.add("marginInlineStart");
942
+ longHandPhysical.add("marginLeft");
943
+ longHandLogical.add("marginInlineEnd");
944
+ longHandPhysical.add("marginRight");
945
+ longHandLogical.add("marginTrim");
946
+ shorthandsOfLonghands.add("overscrollBehavior");
947
+ longHandLogical.add("overscrollBehaviorBlock");
948
+ longHandPhysical.add("overscrollBehaviorY");
949
+ longHandLogical.add("overscrollBehaviorInline");
950
+ longHandPhysical.add("overscrollBehaviorX");
951
+ shorthandsOfShorthands.add("padding");
952
+ shorthandsOfLonghands.add("paddingBlock");
953
+ longHandLogical.add("paddingBlockStart");
954
+ longHandPhysical.add("paddingTop");
955
+ longHandLogical.add("paddingBlockEnd");
956
+ longHandPhysical.add("paddingBottom");
957
+ shorthandsOfLonghands.add("paddingInline");
958
+ longHandLogical.add("paddingInlineStart");
959
+ longHandPhysical.add("paddingLeft");
960
+ longHandLogical.add("paddingInlineEnd");
961
+ longHandPhysical.add("paddingRight");
962
+ longHandLogical.add("visibility");
963
+ longHandLogical.add("color");
964
+ longHandLogical.add("colorScheme");
965
+ longHandLogical.add("forcedColorAdjust");
966
+ longHandLogical.add("opacity");
967
+ longHandLogical.add("printColorAdjust");
968
+ shorthandsOfLonghands.add("columns");
969
+ longHandLogical.add("columnCount");
970
+ longHandLogical.add("columnWidth");
971
+ longHandLogical.add("columnFill");
972
+ longHandLogical.add("columnSpan");
973
+ shorthandsOfLonghands.add("columnRule");
974
+ longHandLogical.add("columnRuleColor");
975
+ longHandLogical.add("columnRuleStyle");
976
+ longHandLogical.add("columnRuleWidth");
977
+ longHandLogical.add("contain");
978
+ shorthandsOfLonghands.add("containIntrinsicSize");
979
+ longHandLogical.add("containIntrinsicBlockSize");
980
+ longHandLogical.add("containIntrinsicWidth");
981
+ longHandLogical.add("containIntrinsicHeight");
982
+ longHandLogical.add("containIntrinsicInlineSize");
983
+ shorthandsOfLonghands.add("container");
984
+ longHandLogical.add("containerName");
985
+ longHandLogical.add("containerType");
986
+ longHandLogical.add("contentVisibility");
987
+ longHandLogical.add("counterIncrement");
988
+ longHandLogical.add("counterReset");
989
+ longHandLogical.add("counterSet");
990
+ longHandLogical.add("display");
991
+ shorthandsOfLonghands.add("flex");
992
+ longHandLogical.add("flexBasis");
993
+ longHandLogical.add("flexGrow");
994
+ longHandLogical.add("flexShrink");
995
+ shorthandsOfLonghands.add("flexFlow");
996
+ longHandLogical.add("flexDirection");
997
+ longHandLogical.add("flexWrap");
998
+ longHandLogical.add("order");
999
+ shorthandsOfShorthands.add("font");
1000
+ longHandLogical.add("fontFamily");
1001
+ longHandLogical.add("fontSize");
1002
+ longHandLogical.add("fontStretch");
1003
+ longHandLogical.add("fontStyle");
1004
+ longHandLogical.add("fontWeight");
1005
+ longHandLogical.add("lineHeight");
1006
+ shorthandsOfLonghands.add("fontVariant");
1007
+ longHandLogical.add("fontVariantAlternates");
1008
+ longHandLogical.add("fontVariantCaps");
1009
+ longHandLogical.add("fontVariantEastAsian");
1010
+ longHandLogical.add("fontVariantEmoji");
1011
+ longHandLogical.add("fontVariantLigatures");
1012
+ longHandLogical.add("fontVariantNumeric");
1013
+ longHandLogical.add("fontVariantPosition");
1014
+ longHandLogical.add("fontFeatureSettings");
1015
+ longHandLogical.add("fontKerning");
1016
+ longHandLogical.add("fontLanguageOverride");
1017
+ longHandLogical.add("fontOpticalSizing");
1018
+ longHandLogical.add("fontPalette");
1019
+ longHandLogical.add("fontVariationSettings");
1020
+ longHandLogical.add("fontSizeAdjust");
1021
+ longHandLogical.add("fontSmooth");
1022
+ longHandLogical.add("fontSynthesisPosition");
1023
+ longHandLogical.add("fontSynthesisSmallCaps");
1024
+ longHandLogical.add("fontSynthesisStyle");
1025
+ longHandLogical.add("fontSynthesisWeight");
1026
+ shorthandsOfLonghands.add("fontSynthesis");
1027
+ longHandLogical.add("lineHeightStep");
1028
+ longHandLogical.add("boxDecorationBreak");
1029
+ longHandLogical.add("breakAfter");
1030
+ longHandLogical.add("breakBefore");
1031
+ longHandLogical.add("breakInside");
1032
+ longHandLogical.add("orphans");
1033
+ longHandLogical.add("widows");
1034
+ longHandLogical.add("content");
1035
+ longHandLogical.add("quotes");
1036
+ shorthandsOfShorthands.add("grid");
1037
+ longHandLogical.add("gridAutoFlow");
1038
+ longHandLogical.add("gridAutoRows");
1039
+ longHandLogical.add("gridAutoColumns");
1040
+ shorthandsOfShorthands.add("gridTemplate");
1041
+ shorthandsOfLonghands.add("gridTemplateAreas");
1042
+ longHandLogical.add("gridTemplateColumns");
1043
+ longHandLogical.add("gridTemplateRows");
1044
+ shorthandsOfShorthands.add("gridArea");
1045
+ shorthandsOfLonghands.add("gridRow");
1046
+ longHandLogical.add("gridRowStart");
1047
+ longHandLogical.add("gridRowEnd");
1048
+ shorthandsOfLonghands.add("gridColumn");
1049
+ longHandLogical.add("gridColumnStart");
1050
+ longHandLogical.add("gridColumnEnd");
1051
+ longHandLogical.add("alignTracks");
1052
+ longHandLogical.add("justifyTracks");
1053
+ longHandLogical.add("masonryAutoFlow");
1054
+ longHandLogical.add("imageOrientation");
1055
+ longHandLogical.add("imageRendering");
1056
+ longHandLogical.add("imageResolution");
1057
+ longHandLogical.add("objectFit");
1058
+ longHandLogical.add("objectPosition");
1059
+ longHandLogical.add("initialLetter");
1060
+ longHandLogical.add("initialLetterAlign");
1061
+ shorthandsOfLonghands.add("listStyle");
1062
+ longHandLogical.add("listStyleImage");
1063
+ longHandLogical.add("listStylePosition");
1064
+ longHandLogical.add("listStyleType");
1065
+ longHandLogical.add("clip");
1066
+ longHandLogical.add("clipPath");
1067
+ shorthandsOfLonghands.add("mask");
1068
+ longHandLogical.add("maskClip");
1069
+ longHandLogical.add("maskComposite");
1070
+ longHandLogical.add("maskImage");
1071
+ longHandLogical.add("maskMode");
1072
+ longHandLogical.add("maskOrigin");
1073
+ longHandLogical.add("maskPosition");
1074
+ longHandLogical.add("maskRepeat");
1075
+ longHandLogical.add("maskSize");
1076
+ longHandLogical.add("maskType");
1077
+ shorthandsOfLonghands.add("maskBorder");
1078
+ longHandLogical.add("maskBorderMode");
1079
+ longHandLogical.add("maskBorderOutset");
1080
+ longHandLogical.add("maskBorderRepeat");
1081
+ longHandLogical.add("maskBorderSlice");
1082
+ longHandLogical.add("maskBorderSource");
1083
+ longHandLogical.add("maskBorderWidth");
1084
+ shorthandsOfShorthands.add("all");
1085
+ longHandLogical.add("textRendering");
1086
+ longHandLogical.add("zoom");
1087
+ shorthandsOfLonghands.add("offset");
1088
+ longHandLogical.add("offsetAnchor");
1089
+ longHandLogical.add("offsetDistance");
1090
+ longHandLogical.add("offsetPath");
1091
+ longHandLogical.add("offsetPosition");
1092
+ longHandLogical.add("offsetRotate");
1093
+ longHandLogical.add("WebkitBoxOrient");
1094
+ longHandLogical.add("WebkitLineClamp");
1095
+ longHandPhysical.add("lineClamp");
1096
+ longHandPhysical.add("maxLines");
1097
+ longHandLogical.add("blockOverflow");
1098
+ shorthandsOfLonghands.add("overflow");
1099
+ longHandLogical.add("overflowBlock");
1100
+ longHandPhysical.add("overflowY");
1101
+ longHandLogical.add("overflowInline");
1102
+ longHandPhysical.add("overflowX");
1103
+ longHandLogical.add("overflowClipMargin");
1104
+ longHandLogical.add("scrollGutter");
1105
+ longHandLogical.add("scrollBehavior");
1106
+ longHandLogical.add("page");
1107
+ longHandLogical.add("pageBreakAfter");
1108
+ longHandLogical.add("pageBreakBefore");
1109
+ longHandLogical.add("pageBreakInside");
1110
+ shorthandsOfShorthands.add("inset");
1111
+ shorthandsOfLonghands.add("insetBlock");
1112
+ longHandLogical.add("insetBlockStart");
1113
+ longHandPhysical.add("top");
1114
+ longHandLogical.add("insetBlockEnd");
1115
+ longHandPhysical.add("bottom");
1116
+ shorthandsOfLonghands.add("insetInline");
1117
+ longHandLogical.add("insetInlineStart");
1118
+ longHandPhysical.add("left");
1119
+ longHandLogical.add("insetInlineEnd");
1120
+ longHandPhysical.add("right");
1121
+ longHandLogical.add("clear");
1122
+ longHandLogical.add("float");
1123
+ longHandLogical.add("overlay");
1124
+ longHandLogical.add("position");
1125
+ longHandLogical.add("zIndex");
1126
+ longHandLogical.add("rubyAlign");
1127
+ longHandLogical.add("rubyMerge");
1128
+ longHandLogical.add("rubyPosition");
1129
+ longHandLogical.add("overflowAnchor");
1130
+ shorthandsOfShorthands.add("scrollMargin");
1131
+ shorthandsOfLonghands.add("scrollMarginBlock");
1132
+ longHandLogical.add("scrollMarginBlockStart");
1133
+ longHandPhysical.add("scrollMarginTop");
1134
+ longHandLogical.add("scrollMarginBlockEnd");
1135
+ longHandPhysical.add("scrollMarginBottom");
1136
+ shorthandsOfLonghands.add("scrollMarginInline");
1137
+ longHandLogical.add("scrollMarginInlineStart");
1138
+ longHandPhysical.add("scrollMarginLeft");
1139
+ longHandLogical.add("scrollMarginInlineEnd");
1140
+ longHandPhysical.add("scrollMarginRight");
1141
+ shorthandsOfShorthands.add("scrollPadding");
1142
+ shorthandsOfLonghands.add("scrollPaddingBlock");
1143
+ longHandLogical.add("scrollPaddingBlockStart");
1144
+ longHandPhysical.add("scrollPaddingTop");
1145
+ longHandLogical.add("scrollPaddingBlockEnd");
1146
+ longHandPhysical.add("scrollPaddingBottom");
1147
+ shorthandsOfLonghands.add("scrollPaddingInline");
1148
+ longHandLogical.add("scrollPaddingInlineStart");
1149
+ longHandPhysical.add("scrollPaddingLeft");
1150
+ longHandLogical.add("scrollPaddingInlineEnd");
1151
+ longHandPhysical.add("scrollPaddingRight");
1152
+ longHandLogical.add("scrollSnapAlign");
1153
+ longHandLogical.add("scrollSnapStop");
1154
+ shorthandsOfLonghands.add("scrollSnapType");
1155
+ longHandLogical.add("scrollbarColor");
1156
+ longHandLogical.add("scrollbarWidth");
1157
+ longHandLogical.add("shapeImageThreshold");
1158
+ longHandLogical.add("shapeMargin");
1159
+ longHandLogical.add("shapeOutside");
1160
+ longHandLogical.add("azimuth");
1161
+ longHandLogical.add("borderCollapse");
1162
+ longHandLogical.add("borderSpacing");
1163
+ longHandLogical.add("captionSide");
1164
+ longHandLogical.add("emptyCells");
1165
+ longHandLogical.add("tableLayout");
1166
+ longHandLogical.add("verticalAlign");
1167
+ shorthandsOfLonghands.add("textDecoration");
1168
+ longHandLogical.add("textDecorationColor");
1169
+ longHandLogical.add("textDecorationLine");
1170
+ longHandLogical.add("textDecorationSkip");
1171
+ longHandLogical.add("textDecorationSkipInk");
1172
+ longHandLogical.add("textDecorationStyle");
1173
+ longHandLogical.add("textDecorationThickness");
1174
+ shorthandsOfLonghands.add("WebkitTextStroke");
1175
+ longHandLogical.add("WebkitTextStrokeColor");
1176
+ longHandLogical.add("WebkitTextStrokeWidth");
1177
+ longHandLogical.add("WebkitTextFillColor");
1178
+ shorthandsOfLonghands.add("textEmphasis");
1179
+ longHandLogical.add("textEmphasisColor");
1180
+ longHandLogical.add("textEmphasisPosition");
1181
+ longHandLogical.add("textEmphasisStyle");
1182
+ longHandLogical.add("textShadow");
1183
+ longHandLogical.add("textUnderlineOffset");
1184
+ longHandLogical.add("textUnderlinePosition");
1185
+ longHandLogical.add("hangingPunctuation");
1186
+ longHandLogical.add("hyphenateCharacter");
1187
+ longHandLogical.add("hyphenateLimitChars");
1188
+ longHandLogical.add("hyphens");
1189
+ longHandLogical.add("letterSpacing");
1190
+ longHandLogical.add("lineBreak");
1191
+ longHandLogical.add("overflowWrap");
1192
+ longHandLogical.add("paintOrder");
1193
+ longHandLogical.add("tabSize");
1194
+ longHandLogical.add("textAlign");
1195
+ longHandLogical.add("textAlignLast");
1196
+ longHandLogical.add("textIndent");
1197
+ longHandLogical.add("textJustify");
1198
+ longHandLogical.add("textSizeAdjust");
1199
+ longHandLogical.add("textTransform");
1200
+ shorthandsOfLonghands.add("textWrap");
1201
+ longHandLogical.add("textWrapMode");
1202
+ longHandLogical.add("textWrapStyle");
1203
+ longHandLogical.add("whiteSpace");
1204
+ longHandLogical.add("whiteSpaceCollapse");
1205
+ longHandLogical.add("whiteSpaceTrim");
1206
+ longHandLogical.add("wordBreak");
1207
+ longHandLogical.add("wordSpacing");
1208
+ longHandLogical.add("wordWrap");
1209
+ longHandLogical.add("backfaceVisibility");
1210
+ longHandLogical.add("perspective");
1211
+ longHandLogical.add("perspectiveOrigin");
1212
+ longHandLogical.add("rotate");
1213
+ longHandLogical.add("scale");
1214
+ longHandLogical.add("transform");
1215
+ longHandLogical.add("transformBox");
1216
+ longHandLogical.add("transformOrigin");
1217
+ longHandLogical.add("transformStyle");
1218
+ longHandLogical.add("translate");
1219
+ shorthandsOfLonghands.add("transition");
1220
+ longHandLogical.add("transitionBehavior");
1221
+ longHandLogical.add("transitionDelay");
1222
+ longHandLogical.add("transitionDuration");
1223
+ longHandLogical.add("transitionProperty");
1224
+ longHandLogical.add("transitionTimingFunction");
1225
+ longHandLogical.add("viewTransitionName");
1226
+ longHandLogical.add("willChange");
1227
+ longHandLogical.add("direction");
1228
+ longHandLogical.add("textCombineUpright");
1229
+ longHandLogical.add("textOrientation");
1230
+ longHandLogical.add("unicodeBidi");
1231
+ longHandLogical.add("writingMode");
1232
+ longHandLogical.add("backdropFilter");
1233
+ longHandLogical.add("filter");
1234
+ longHandLogical.add("mathDepth");
1235
+ longHandLogical.add("mathShift");
1236
+ longHandLogical.add("mathStyle");
1237
+ longHandLogical.add("touchAction");
1238
+ function getPropertyPriority(key) {
1239
+ if (key === "all") return 0;
1240
+ if (key.startsWith("--")) return 1;
1241
+ if (longHandPhysical.has(key)) return 4e3;
1242
+ if (longHandLogical.has(key)) return 3e3;
1243
+ if (shorthandsOfLonghands.has(key)) return 2e3;
1244
+ if (shorthandsOfShorthands.has(key)) return 1e3;
1245
+ return 3e3;
1246
+ }
1247
+
1248
+ // src/regex.ts
1249
+ var createRegex = (item) => {
1250
+ const regex2 = item.map((item2) => typeof item2 === "string" ? `^${item2}$` : item2.source).join("|");
1251
+ return new RegExp(regex2);
1252
+ };
1253
+
1254
+ // src/serialize.ts
1255
+ var stringifyJson = (config) => {
1256
+ return JSON.stringify(config, (_key, value) => {
1257
+ if (typeof value === "function") return value.toString();
1258
+ return value;
1259
+ });
1260
+ };
1261
+ var parseJson = (config) => {
1262
+ return JSON.parse(config);
1263
+ };
1264
+
1265
+ // src/slot.ts
1266
+ var getSlotRecipes = (recipe = {}) => {
1267
+ const init = (slot) => ({
1268
+ className: [recipe.className, slot].filter(Boolean).join("__"),
1269
+ base: recipe.base?.[slot] ?? {},
1270
+ variants: {},
1271
+ defaultVariants: recipe.defaultVariants ?? {},
1272
+ compoundVariants: recipe.compoundVariants ? getSlotCompoundVariant(recipe.compoundVariants, slot) : []
1273
+ });
1274
+ const slots = recipe.slots ?? [];
1275
+ const recipeParts = slots.map((slot) => [slot, init(slot)]);
1276
+ for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {
1277
+ for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {
1278
+ recipeParts.forEach(([slot, slotRecipe]) => {
1279
+ slotRecipe.variants[variantsKey] ??= {};
1280
+ slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};
1281
+ });
1282
+ }
1283
+ }
1284
+ return Object.fromEntries(recipeParts);
1285
+ };
1286
+ var getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));
1287
+
1288
+ // src/split-props.ts
1289
+ function splitProps(props, ...keys) {
1290
+ const descriptors = Object.getOwnPropertyDescriptors(props);
1291
+ const dKeys = Object.keys(descriptors);
1292
+ const split = (k) => {
1293
+ const clone = {};
1294
+ for (let i = 0; i < k.length; i++) {
1295
+ const key = k[i];
1296
+ if (descriptors[key]) {
1297
+ Object.defineProperty(clone, key, descriptors[key]);
1298
+ delete descriptors[key];
1299
+ }
1300
+ }
1301
+ return clone;
1302
+ };
1303
+ const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));
1304
+ return keys.map(fn).concat(split(dKeys));
1305
+ }
1306
+
1307
+ // src/to-json.ts
1308
+ function mapToJson(map) {
1309
+ const obj = {};
1310
+ map.forEach((value, key) => {
1311
+ if (value instanceof Map) {
1312
+ obj[key] = Object.fromEntries(value);
1313
+ } else {
1314
+ obj[key] = value;
1315
+ }
1316
+ });
1317
+ return obj;
1318
+ }
1319
+
1320
+ // src/typegen.ts
1321
+ function unionType(values, opts = {}) {
1322
+ const { fallback, stringify = JSON.stringify } = opts;
1323
+ const arr = Array.from(values);
1324
+ if (fallback != null && !arr.length) return fallback;
1325
+ return arr.map((v) => stringify(v)).join(" | ");
1326
+ }
1327
+
1328
+ // src/uniq.ts
1329
+ var uniq = (...items) => {
1330
+ const set = items.reduce((acc, currItems) => {
1331
+ if (currItems) {
1332
+ currItems.forEach((item) => acc.add(item));
1333
+ }
1334
+ return acc;
1335
+ }, /* @__PURE__ */ new Set([]));
1336
+ return Array.from(set);
1337
+ };
1338
+
1339
+ // src/unit-conversion.ts
1340
+ var BASE_FONT_SIZE = 16;
1341
+ var UNIT_PX = "px";
1342
+ var UNIT_EM = "em";
1343
+ var UNIT_REM = "rem";
1344
+ var DIGIT_REGEX = new RegExp(String.raw`-?\d+(?:\.\d+|\d*)`);
1345
+ var UNIT_REGEX = new RegExp(`${UNIT_PX}|${UNIT_EM}|${UNIT_REM}`);
1346
+ var VALUE_REGEX = new RegExp(`${DIGIT_REGEX.source}(${UNIT_REGEX.source})`);
1347
+ function getUnit(value = "") {
1348
+ const unit = value.match(VALUE_REGEX);
1349
+ return unit?.[1];
1350
+ }
1351
+ function toPx(value = "") {
1352
+ if (typeof value === "number") {
1353
+ return `${value}px`;
1354
+ }
1355
+ const unit = getUnit(value);
1356
+ if (!unit) return value;
1357
+ if (unit === UNIT_PX) {
1358
+ return value;
1359
+ }
1360
+ if (unit === UNIT_EM || unit === UNIT_REM) {
1361
+ return `${parseFloat(value) * BASE_FONT_SIZE}${UNIT_PX}`;
1362
+ }
1363
+ }
1364
+ function toEm(value = "", fontSize = BASE_FONT_SIZE) {
1365
+ const unit = getUnit(value);
1366
+ if (!unit) return value;
1367
+ if (unit === UNIT_EM) {
1368
+ return value;
1369
+ }
1370
+ if (unit === UNIT_PX) {
1371
+ return `${parseFloat(value) / fontSize}${UNIT_EM}`;
1372
+ }
1373
+ if (unit === UNIT_REM) {
1374
+ return `${parseFloat(value) * BASE_FONT_SIZE / fontSize}${UNIT_EM}`;
1375
+ }
1376
+ }
1377
+ function toRem(value = "") {
1378
+ const unit = getUnit(value);
1379
+ if (!unit) return value;
1380
+ if (unit === UNIT_REM) {
1381
+ return value;
1382
+ }
1383
+ if (unit === UNIT_EM) {
1384
+ return `${parseFloat(value)}${UNIT_REM}`;
1385
+ }
1386
+ if (unit === UNIT_PX) {
1387
+ return `${parseFloat(value) / BASE_FONT_SIZE}${UNIT_REM}`;
1388
+ }
1389
+ }
1390
+ export {
1391
+ BAMBOO_CONFIG_NAME,
1392
+ BambooError,
1393
+ CacheMap,
1394
+ assign,
1395
+ astish,
1396
+ calc,
1397
+ camelCaseProperty,
1398
+ capitalize,
1399
+ compact,
1400
+ createCss,
1401
+ createMergeCss,
1402
+ createRegex,
1403
+ cssVar,
1404
+ dashCase,
1405
+ deepSet,
1406
+ entries,
1407
+ esc2 as esc,
1408
+ filterBaseConditions,
1409
+ flatten,
1410
+ fromEntries,
1411
+ getArbitraryValue,
1412
+ getDotPath,
1413
+ getNegativePath,
1414
+ getOrCreateSet,
1415
+ getPatternStyles,
1416
+ getPropertyPriority,
1417
+ getSlotCompoundVariant,
1418
+ getSlotRecipes,
1419
+ getUnit,
1420
+ hypenateProperty,
1421
+ isBaseCondition,
1422
+ isBoolean,
1423
+ isCssFunction,
1424
+ isCssUnit,
1425
+ isCssVar2 as isCssVar,
1426
+ isFunction,
1427
+ isImportant,
1428
+ isObject,
1429
+ isObjectOrArray,
1430
+ isString,
1431
+ isSymbol,
1432
+ mapEntries,
1433
+ mapObject,
1434
+ mapToJson,
1435
+ markImportant,
1436
+ memo,
1437
+ mergeAndConcat,
1438
+ mergeProps,
1439
+ mergeWith,
1440
+ normalizeStyleObject,
1441
+ omit,
1442
+ parseJson,
1443
+ patternFns,
1444
+ pick,
1445
+ splitBy,
1446
+ splitDotPath,
1447
+ splitProps,
1448
+ stringifyJson,
1449
+ toEm,
1450
+ toHash,
1451
+ toPx,
1452
+ toRem,
1453
+ toResponsiveObject,
1454
+ traverse,
1455
+ uncapitalize,
1456
+ unionType,
1457
+ uniq,
1458
+ walkObject,
1459
+ withoutImportant,
1460
+ withoutSpace
1461
+ };