@integration-app/react 2.0.2 → 2.0.3-beta.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,13 @@
1
1
  import { IntegrationAppClient, parseDataLocationPath } from '@integration-app/sdk';
2
2
  export * from '@integration-app/sdk';
3
3
  export { DataForm } from '@integration-app/sdk';
4
- import { jsx } from 'react/jsx-runtime';
5
- import { createContext, useMemo, useContext, useState } from 'react';
4
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
+ import { createContext, useMemo, useContext, useState, forwardRef, createElement } from 'react';
6
6
  import useSWR from 'swr';
7
7
  import AwesomeDebouncePromiseImport from 'awesome-debounce-promise';
8
8
  import useSWRInfinite from 'swr/infinite';
9
9
  import qs from 'query-string';
10
+ import { ark } from '@ark-ui/react';
10
11
 
11
12
  const IntegrationAppContext = createContext(null);
12
13
  IntegrationAppContext.displayName = 'IntegrationAppClientContext';
@@ -34,19 +35,17 @@ function useIntegrationAppSWR(path, options) {
34
35
  return useSWR(client ? path : undefined, fetcher, options);
35
36
  }
36
37
 
37
- var _a;
38
- const AwesomeDebouncePromise = (_a = AwesomeDebouncePromiseImport === null || AwesomeDebouncePromiseImport === void 0 ? void 0 : AwesomeDebouncePromiseImport.default) !== null && _a !== void 0 ? _a : AwesomeDebouncePromiseImport;
38
+ const AwesomeDebouncePromise = AwesomeDebouncePromiseImport?.default ?? AwesomeDebouncePromiseImport;
39
39
 
40
40
  const elementStateCache = new Map();
41
41
  function useElement(selector, accessorGenerator) {
42
- var _a;
43
42
  const integrationApp = useIntegrationApp();
44
43
  const elementKeyData = {
45
- token: integrationApp === null || integrationApp === void 0 ? void 0 : integrationApp.token,
44
+ token: integrationApp?.token,
46
45
  selector,
47
46
  };
48
47
  const elementKey = JSON.stringify(elementKeyData);
49
- const elementState = (_a = elementStateCache.get(elementKey)) !== null && _a !== void 0 ? _a : {
48
+ const elementState = elementStateCache.get(elementKey) ?? {
50
49
  updatedLocally: false,
51
50
  savingToServer: false,
52
51
  currentPutRequests: [],
@@ -56,7 +55,7 @@ function useElement(selector, accessorGenerator) {
56
55
  elementState.updatedLocally = false;
57
56
  elementState.savingToServer = true;
58
57
  try {
59
- const result = await (accessor === null || accessor === void 0 ? void 0 : accessor.put(data));
58
+ const result = await accessor?.put(data);
60
59
  elementState.currentPutRequests =
61
60
  elementState.currentPutRequests.filter((id) => id !== requestId);
62
61
  if (!elementState.updatedLocally &&
@@ -81,7 +80,7 @@ function useElement(selector, accessorGenerator) {
81
80
  ? accessorGenerator(integrationApp)
82
81
  : undefined;
83
82
  const swrKey = accessor && selector ? `element:${elementKey}` : undefined;
84
- const { data: item, mutate, error, isLoading, isValidating, } = useSWR(swrKey, () => accessor === null || accessor === void 0 ? void 0 : accessor.get(), {
83
+ const { data: item, mutate, error, isLoading, isValidating, } = useSWR(swrKey, () => accessor?.get(), {
85
84
  isPaused: () => elementState.updatedLocally || elementState.savingToServer,
86
85
  });
87
86
  const loading = isLoading;
@@ -90,7 +89,7 @@ function useElement(selector, accessorGenerator) {
90
89
  return await mutate();
91
90
  }
92
91
  async function put(data) {
93
- if (!(accessor === null || accessor === void 0 ? void 0 : accessor.put)) {
92
+ if (!accessor?.put) {
94
93
  throw new Error(`"put method is not supported for accessor ${accessor.constructor.name}`);
95
94
  }
96
95
  elementState.updatedLocally = true;
@@ -109,18 +108,18 @@ function useElement(selector, accessorGenerator) {
109
108
  return put(newData);
110
109
  }
111
110
  async function archive() {
112
- if (!(accessor === null || accessor === void 0 ? void 0 : accessor.archive)) {
111
+ if (!accessor?.archive) {
113
112
  return;
114
113
  }
115
114
  await mutate({ ...item, archivedAt: new Date().toISOString() }, false);
116
- await (accessor === null || accessor === void 0 ? void 0 : accessor.archive());
115
+ await accessor?.archive();
117
116
  await mutate();
118
117
  }
119
118
  async function create(data) {
120
- if (!(accessor === null || accessor === void 0 ? void 0 : accessor.create)) {
121
- throw new Error(`"create method is not supported for accessor ${accessor === null || accessor === void 0 ? void 0 : accessor.constructor.name}`);
119
+ if (!accessor?.create) {
120
+ throw new Error(`"create method is not supported for accessor ${accessor?.constructor.name}`);
122
121
  }
123
- const result = await (accessor === null || accessor === void 0 ? void 0 : accessor.create(data));
122
+ const result = await accessor?.create(data);
124
123
  return await mutate(result);
125
124
  }
126
125
  return {
@@ -147,19 +146,17 @@ function useConnection(id) {
147
146
  }
148
147
 
149
148
  function useElements(route, query = {}) {
150
- var _a;
151
149
  const integrationApp = useIntegrationApp();
152
- const limit = (_a = query.limit) !== null && _a !== void 0 ? _a : 25;
150
+ const limit = query.limit ?? 25;
153
151
  const tokenHash = hashCode(integrationApp.token);
154
152
  function getKey(page, previousPageData) {
155
- var _a;
156
153
  if (page === 0)
157
154
  return `/${route}?${qs.stringify({
158
155
  ...query,
159
156
  limit,
160
157
  hash: tokenHash,
161
158
  })}`;
162
- if (((_a = previousPageData.items) === null || _a === void 0 ? void 0 : _a.length) < limit)
159
+ if (previousPageData.items?.length < limit)
163
160
  return null;
164
161
  return `/${route}?${qs.stringify({
165
162
  ...query,
@@ -174,8 +171,7 @@ function useElements(route, query = {}) {
174
171
  const loading = isLoading;
175
172
  const refreshing = isValidating;
176
173
  async function loadMore() {
177
- var _a, _b;
178
- const hasMoreToLoad = ((_b = (_a = data[size - 1]) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.length) === limit;
174
+ const hasMoreToLoad = data[size - 1]?.items?.length === limit;
179
175
  if (hasMoreToLoad) {
180
176
  setIsLoadingMore(true);
181
177
  await setSize(size + 1);
@@ -239,12 +235,12 @@ function useIntegrations(query) {
239
235
  function useFieldMapping(selector) {
240
236
  const { item: fieldMapping, accessor, refresh, ...rest } = useElement(selector, (integrationApp) => selector ? integrationApp.fieldMapping(selector) : undefined);
241
237
  async function apply(integrationKeys) {
242
- const result = await (accessor === null || accessor === void 0 ? void 0 : accessor.apply(integrationKeys));
238
+ const result = await accessor?.apply(integrationKeys);
243
239
  await refresh();
244
- return result !== null && result !== void 0 ? result : [];
240
+ return result ?? [];
245
241
  }
246
242
  async function reset() {
247
- await (accessor === null || accessor === void 0 ? void 0 : accessor.reset());
243
+ await accessor?.reset();
248
244
  await refresh();
249
245
  }
250
246
  return { fieldMapping, apply, reset, refresh, accessor, ...rest };
@@ -253,15 +249,15 @@ function useFieldMapping(selector) {
253
249
  function useFieldMappingInstance(selector) {
254
250
  const { item: fieldMappingInstance, accessor, refresh, ...rest } = useElement(selector, (integrationApp) => selector ? integrationApp.fieldMappingInstance(selector) : undefined);
255
251
  async function setup() {
256
- await (accessor === null || accessor === void 0 ? void 0 : accessor.setup());
252
+ await accessor?.setup();
257
253
  await refresh();
258
254
  }
259
255
  async function reset() {
260
- await (accessor === null || accessor === void 0 ? void 0 : accessor.reset());
256
+ await accessor?.reset();
261
257
  await refresh();
262
258
  }
263
259
  async function openConfiguration(options) {
264
- return accessor === null || accessor === void 0 ? void 0 : accessor.openConfiguration(options);
260
+ return accessor?.openConfiguration(options);
265
261
  }
266
262
  return {
267
263
  fieldMappingInstance,
@@ -293,12 +289,12 @@ function useFieldMappings(query) {
293
289
  function useDataSource(selector) {
294
290
  const { item: dataSource, refresh, accessor, ...rest } = useElement(selector, (integrationApp) => selector ? integrationApp.dataSource(selector) : undefined);
295
291
  async function apply(integrationKeys) {
296
- const result = await (accessor === null || accessor === void 0 ? void 0 : accessor.apply(integrationKeys));
292
+ const result = await accessor?.apply(integrationKeys);
297
293
  await refresh();
298
- return result !== null && result !== void 0 ? result : [];
294
+ return result ?? [];
299
295
  }
300
296
  async function reset() {
301
- await (accessor === null || accessor === void 0 ? void 0 : accessor.reset());
297
+ await accessor?.reset();
302
298
  await refresh();
303
299
  }
304
300
  return { dataSource, apply, reset, refresh, accessor, ...rest };
@@ -307,39 +303,39 @@ function useDataSource(selector) {
307
303
  function useDataSourceInstance(selector) {
308
304
  const { item: dataSourceInstance, accessor, refresh, ...rest } = useElement(selector, (integrationApp) => selector ? integrationApp.dataSourceInstance(selector) : undefined);
309
305
  async function setup() {
310
- await (accessor === null || accessor === void 0 ? void 0 : accessor.setup());
306
+ await accessor?.setup();
311
307
  await refresh();
312
308
  }
313
309
  async function reset() {
314
- await (accessor === null || accessor === void 0 ? void 0 : accessor.reset());
310
+ await accessor?.reset();
315
311
  await refresh();
316
312
  }
317
313
  async function openConfiguration(options) {
318
- return accessor === null || accessor === void 0 ? void 0 : accessor.openConfiguration(options);
314
+ return accessor?.openConfiguration(options);
319
315
  }
320
316
  async function listRecords(request) {
321
- return accessor === null || accessor === void 0 ? void 0 : accessor.listRecords(request);
317
+ return accessor?.listRecords(request);
322
318
  }
323
319
  async function findRecords(request) {
324
- return accessor === null || accessor === void 0 ? void 0 : accessor.findRecords(request);
320
+ return accessor?.findRecords(request);
325
321
  }
326
322
  async function findRecordById(id) {
327
- return accessor === null || accessor === void 0 ? void 0 : accessor.findRecordById(id);
323
+ return accessor?.findRecordById(id);
328
324
  }
329
325
  async function createRecord(request) {
330
- return accessor === null || accessor === void 0 ? void 0 : accessor.createRecord(request);
326
+ return accessor?.createRecord(request);
331
327
  }
332
328
  async function updateRecord(request) {
333
- return accessor === null || accessor === void 0 ? void 0 : accessor.updateRecord(request);
329
+ return accessor?.updateRecord(request);
334
330
  }
335
331
  async function deleteRecord(id) {
336
- return accessor === null || accessor === void 0 ? void 0 : accessor.deleteRecord(id);
332
+ return accessor?.deleteRecord(id);
337
333
  }
338
334
  async function unifiedFieldsToNative(unifiedFields) {
339
- return accessor === null || accessor === void 0 ? void 0 : accessor.unifiedFieldsToNative(unifiedFields);
335
+ return accessor?.unifiedFieldsToNative(unifiedFields);
340
336
  }
341
337
  async function getCollection() {
342
- return accessor === null || accessor === void 0 ? void 0 : accessor.getCollection();
338
+ return accessor?.getCollection();
343
339
  }
344
340
  return {
345
341
  dataSourceInstance,
@@ -441,7 +437,7 @@ function useAppDataSchemas(query) {
441
437
  function useAppDataSchemaInstance(selector) {
442
438
  const { item: appDataSchemaInstance, accessor, refresh, ...rest } = useElement(selector, (integrationApp) => selector ? integrationApp.appDataSchemaInstance(selector) : undefined);
443
439
  async function setup() {
444
- await (accessor === null || accessor === void 0 ? void 0 : accessor.setup());
440
+ await accessor?.setup();
445
441
  await refresh();
446
442
  }
447
443
  return {
@@ -464,12 +460,12 @@ function useAppDataSchemaInstances(query) {
464
460
  function useFlow(selector) {
465
461
  const { item: flow, accessor, refresh, ...rest } = useElement(selector, (integrationApp) => (selector ? integrationApp.flow(selector) : undefined));
466
462
  async function apply(integrationKeys) {
467
- const result = await (accessor === null || accessor === void 0 ? void 0 : accessor.apply(integrationKeys));
463
+ const result = await accessor?.apply(integrationKeys);
468
464
  await refresh();
469
465
  return result;
470
466
  }
471
467
  async function reset() {
472
- await (accessor === null || accessor === void 0 ? void 0 : accessor.reset());
468
+ await accessor?.reset();
473
469
  return await refresh();
474
470
  }
475
471
  return { flow, apply, reset, refresh, accessor, ...rest };
@@ -486,29 +482,29 @@ function useFlows(query) {
486
482
  function useFlowInstance(selector) {
487
483
  const { item: flowInstance, accessor, refresh, ...rest } = useElement(selector, (integrationApp) => selector ? integrationApp.flowInstance(selector) : undefined);
488
484
  async function enable() {
489
- await (accessor === null || accessor === void 0 ? void 0 : accessor.enable());
485
+ await accessor?.enable();
490
486
  await refresh();
491
487
  }
492
488
  async function disable() {
493
- await (accessor === null || accessor === void 0 ? void 0 : accessor.disable());
489
+ await accessor?.disable();
494
490
  await refresh();
495
491
  }
496
492
  async function reset(options) {
497
- await (accessor === null || accessor === void 0 ? void 0 : accessor.reset(options));
493
+ await accessor?.reset(options);
498
494
  await refresh();
499
495
  }
500
496
  async function setup() {
501
- await (accessor === null || accessor === void 0 ? void 0 : accessor.setup());
497
+ await accessor?.setup();
502
498
  await refresh();
503
499
  }
504
500
  async function openConfiguration(options) {
505
- return accessor === null || accessor === void 0 ? void 0 : accessor.openConfiguration(options);
501
+ return accessor?.openConfiguration(options);
506
502
  }
507
503
  async function run(options = {}) {
508
- return accessor === null || accessor === void 0 ? void 0 : accessor.run(options);
504
+ return accessor?.run(options);
509
505
  }
510
506
  async function startRun(options = {}) {
511
- return accessor === null || accessor === void 0 ? void 0 : accessor.startRun(options);
507
+ return accessor?.startRun(options);
512
508
  }
513
509
  return {
514
510
  flowInstance,
@@ -563,9 +559,9 @@ function useDataLinkTableInstance(selector) {
563
559
  dataLinkTableInstance,
564
560
  accessor,
565
561
  refresh,
566
- findLinks: accessor === null || accessor === void 0 ? void 0 : accessor.findLinks,
567
- createLink: accessor === null || accessor === void 0 ? void 0 : accessor.createLink,
568
- deleteLink: accessor === null || accessor === void 0 ? void 0 : accessor.deleteLink,
562
+ findLinks: accessor?.findLinks,
563
+ createLink: accessor?.createLink,
564
+ deleteLink: accessor?.deleteLink,
569
565
  ...rest,
570
566
  };
571
567
  }
@@ -589,12 +585,12 @@ function useDataLinkTables(query) {
589
585
  function useAction(selector) {
590
586
  const { item: action, accessor, refresh, ...rest } = useElement(selector, (integrationApp) => selector ? integrationApp.action(selector) : undefined);
591
587
  async function apply(integrationKeys) {
592
- const result = await (accessor === null || accessor === void 0 ? void 0 : accessor.apply(integrationKeys));
588
+ const result = await accessor?.apply(integrationKeys);
593
589
  await refresh();
594
590
  return result;
595
591
  }
596
592
  async function reset() {
597
- await (accessor === null || accessor === void 0 ? void 0 : accessor.reset());
593
+ await accessor?.reset();
598
594
  await refresh();
599
595
  }
600
596
  return { action, apply, reset, refresh, accessor, ...rest };
@@ -603,18 +599,18 @@ function useAction(selector) {
603
599
  function useActionInstance(selector) {
604
600
  const { item: actionInstance, accessor, refresh, ...rest } = useElement(selector, (integrationApp) => selector ? integrationApp.actionInstance(selector) : undefined);
605
601
  async function run(input) {
606
- return accessor === null || accessor === void 0 ? void 0 : accessor.run(input);
602
+ return accessor?.run(input);
607
603
  }
608
604
  async function setup() {
609
- await (accessor === null || accessor === void 0 ? void 0 : accessor.setup());
605
+ await accessor?.setup();
610
606
  await refresh();
611
607
  }
612
608
  async function reset() {
613
- await (accessor === null || accessor === void 0 ? void 0 : accessor.reset());
609
+ await accessor?.reset();
614
610
  await refresh();
615
611
  }
616
612
  async function openConfiguration(options) {
617
- return accessor === null || accessor === void 0 ? void 0 : accessor.open(options);
613
+ return accessor?.open(options);
618
614
  }
619
615
  return {
620
616
  actionInstance,
@@ -676,9 +672,8 @@ function useScenarios(query) {
676
672
  }
677
673
 
678
674
  function useDataCollectionSpec({ path, key, integrationId, }) {
679
- var _a;
680
675
  const client = useIntegrationApp();
681
- const dataCollectionKey = key !== null && key !== void 0 ? key : (_a = parseDataLocationPath(path)) === null || _a === void 0 ? void 0 : _a.key;
676
+ const dataCollectionKey = key ?? parseDataLocationPath(path)?.key;
682
677
  const { data: dataCollectionSpec } = useSWR(dataCollectionKey && integrationId
683
678
  ? `/integrations/${integrationId}/data/${dataCollectionKey}`
684
679
  : null, async () => {
@@ -700,23 +695,23 @@ function useExternalEventSubscriptions(query) {
700
695
  function useExternalEventSubscription(id) {
701
696
  const { item: externalEventSubscription, accessor, refresh, ...rest } = useElement(id, (integrationApp) => id ? integrationApp.externalEventSubscription(id) : undefined);
702
697
  async function setup() {
703
- await (accessor === null || accessor === void 0 ? void 0 : accessor.setup());
698
+ await accessor?.setup();
704
699
  await refresh();
705
700
  }
706
701
  async function subscribe() {
707
- await (accessor === null || accessor === void 0 ? void 0 : accessor.subscribe());
702
+ await accessor?.subscribe();
708
703
  await refresh();
709
704
  }
710
705
  async function resubscribe() {
711
- await (accessor === null || accessor === void 0 ? void 0 : accessor.resubscribe());
706
+ await accessor?.resubscribe();
712
707
  await refresh();
713
708
  }
714
709
  async function unsubscribe() {
715
- await (accessor === null || accessor === void 0 ? void 0 : accessor.unsubscribe());
710
+ await accessor?.unsubscribe();
716
711
  await refresh();
717
712
  }
718
713
  async function pullEvents() {
719
- await (accessor === null || accessor === void 0 ? void 0 : accessor.pullEvents());
714
+ await accessor?.pullEvents();
720
715
  await refresh();
721
716
  }
722
717
  return {
@@ -739,5 +734,751 @@ function useIntegrationElement(accessor) {
739
734
  return useElement(accessor.getUniqueIdentifier(), () => accessor);
740
735
  }
741
736
 
742
- export { IntegrationAppProvider, useAction, useActionInstance, useActionInstances, useActions, useAppDataSchema, useAppDataSchemaInstance, useAppDataSchemaInstances, useAppDataSchemas, useAppEventSubscription, useAppEventSubscriptions, useAppEventType, useAppEventTypes, useAppEvents, useConnection, useConnections, useConnectorSpec, useCustomer, useCustomers, useDataCollectionSpec, useDataLinkTable, useDataLinkTableInstance, useDataLinkTableInstances, useDataLinkTables, useDataSource, useDataSourceInstance, useDataSourceInstanceCollection, useDataSourceInstances, useDataSources, useExternalEventSubscription, useExternalEventSubscriptions, useFieldMapping, useFieldMappingInstance, useFieldMappingInstances, useFieldMappings, useFlow, useFlowInstance, useFlowInstances, useFlowRun, useFlowRuns, useFlows, useIntegration, useIntegrationApp, useIntegrationAppSWR, useIntegrationElement, useIntegrations, useScenario, useScenarios, useScreen };
737
+ // src/assert.ts
738
+ function isObject(value) {
739
+ return typeof value === "object" && value != null && !Array.isArray(value);
740
+ }
741
+
742
+ // src/compact.ts
743
+ function compact(value) {
744
+ return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));
745
+ }
746
+
747
+ // src/condition.ts
748
+ var isBaseCondition = (v) => v === "base";
749
+ function filterBaseConditions(c) {
750
+ return c.slice().filter((v) => !isBaseCondition(v));
751
+ }
752
+
753
+ // src/hash.ts
754
+ function toChar(code) {
755
+ return String.fromCharCode(code + (code > 25 ? 39 : 97));
756
+ }
757
+ function toName(code) {
758
+ let name = "";
759
+ let x;
760
+ for (x = Math.abs(code); x > 52; x = x / 52 | 0)
761
+ name = toChar(x % 52) + name;
762
+ return toChar(x % 52) + name;
763
+ }
764
+ function toPhash(h, x) {
765
+ let i = x.length;
766
+ while (i)
767
+ h = h * 33 ^ x.charCodeAt(--i);
768
+ return h;
769
+ }
770
+ function toHash(value) {
771
+ return toName(toPhash(5381, value) >>> 0);
772
+ }
773
+
774
+ // src/important.ts
775
+ var importantRegex = /\s*!(important)?/i;
776
+ function isImportant(value) {
777
+ return typeof value === "string" ? importantRegex.test(value) : false;
778
+ }
779
+ function withoutImportant(value) {
780
+ return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
781
+ }
782
+ function withoutSpace(str) {
783
+ return typeof str === "string" ? str.replaceAll(" ", "_") : str;
784
+ }
785
+
786
+ // src/memo.ts
787
+ var memo = (fn) => {
788
+ const cache = /* @__PURE__ */ new Map();
789
+ const get = (...args) => {
790
+ const key = JSON.stringify(args);
791
+ if (cache.has(key)) {
792
+ return cache.get(key);
793
+ }
794
+ const result = fn(...args);
795
+ cache.set(key, result);
796
+ return result;
797
+ };
798
+ return get;
799
+ };
800
+
801
+ // src/merge-props.ts
802
+ function mergeProps(...sources) {
803
+ const objects = sources.filter(Boolean);
804
+ return objects.reduce((prev, obj) => {
805
+ Object.keys(obj).forEach((key) => {
806
+ const prevValue = prev[key];
807
+ const value = obj[key];
808
+ if (isObject(prevValue) && isObject(value)) {
809
+ prev[key] = mergeProps(prevValue, value);
810
+ } else {
811
+ prev[key] = value;
812
+ }
813
+ });
814
+ return prev;
815
+ }, {});
816
+ }
817
+
818
+ // src/walk-object.ts
819
+ var isNotNullish = (element) => element != null;
820
+ function walkObject(target, predicate, options = {}) {
821
+ const { stop, getKey } = options;
822
+ function inner(value, path = []) {
823
+ if (isObject(value) || Array.isArray(value)) {
824
+ const result = {};
825
+ for (const [prop, child] of Object.entries(value)) {
826
+ const key = getKey?.(prop, child) ?? prop;
827
+ const childPath = [...path, key];
828
+ if (stop?.(value, childPath)) {
829
+ return predicate(value, path);
830
+ }
831
+ const next = inner(child, childPath);
832
+ if (isNotNullish(next)) {
833
+ result[key] = next;
834
+ }
835
+ }
836
+ return result;
837
+ }
838
+ return predicate(value, path);
839
+ }
840
+ return inner(target);
841
+ }
842
+ function mapObject(obj, fn) {
843
+ if (Array.isArray(obj))
844
+ return obj.map((value) => fn(value));
845
+ if (!isObject(obj))
846
+ return fn(obj);
847
+ return walkObject(obj, (value) => fn(value));
848
+ }
849
+
850
+ // src/normalize-style-object.ts
851
+ function toResponsiveObject(values, breakpoints) {
852
+ return values.reduce(
853
+ (acc, current, index) => {
854
+ const key = breakpoints[index];
855
+ if (current != null) {
856
+ acc[key] = current;
857
+ }
858
+ return acc;
859
+ },
860
+ {}
861
+ );
862
+ }
863
+ function normalizeStyleObject(styles, context, shorthand = true) {
864
+ const { utility, conditions } = context;
865
+ const { hasShorthand, resolveShorthand } = utility;
866
+ return walkObject(
867
+ styles,
868
+ (value) => {
869
+ return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;
870
+ },
871
+ {
872
+ stop: (value) => Array.isArray(value),
873
+ getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0
874
+ }
875
+ );
876
+ }
877
+
878
+ // src/classname.ts
879
+ var fallbackCondition = {
880
+ shift: (v) => v,
881
+ finalize: (v) => v,
882
+ breakpoints: { keys: [] }
883
+ };
884
+ var sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\n\s]+/g, " ") : value;
885
+ function createCss(context) {
886
+ const { utility, hash, conditions: conds = fallbackCondition } = context;
887
+ const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");
888
+ const hashFn = (conditions, className) => {
889
+ let result;
890
+ if (hash) {
891
+ const baseArray = [...conds.finalize(conditions), className];
892
+ result = formatClassName(utility.toHash(baseArray, toHash));
893
+ } else {
894
+ const baseArray = [...conds.finalize(conditions), formatClassName(className)];
895
+ result = baseArray.join(":");
896
+ }
897
+ return result;
898
+ };
899
+ return memo(({ base, ...styles } = {}) => {
900
+ const styleObject = Object.assign(styles, base);
901
+ const normalizedObject = normalizeStyleObject(styleObject, context);
902
+ const classNames = /* @__PURE__ */ new Set();
903
+ walkObject(normalizedObject, (value, paths) => {
904
+ const important = isImportant(value);
905
+ if (value == null)
906
+ return;
907
+ const [prop, ...allConditions] = conds.shift(paths);
908
+ const conditions = filterBaseConditions(allConditions);
909
+ const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
910
+ let className = hashFn(conditions, transformed.className);
911
+ if (important)
912
+ className = `${className}!`;
913
+ classNames.add(className);
914
+ });
915
+ return Array.from(classNames).join(" ");
916
+ });
917
+ }
918
+ function compactStyles(...styles) {
919
+ return styles.flat().filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);
920
+ }
921
+ function createMergeCss(context) {
922
+ function resolve(styles) {
923
+ const allStyles = compactStyles(...styles);
924
+ if (allStyles.length === 1)
925
+ return allStyles;
926
+ return allStyles.map((style) => normalizeStyleObject(style, context));
927
+ }
928
+ function mergeCss(...styles) {
929
+ return mergeProps(...resolve(styles));
930
+ }
931
+ function assignCss(...styles) {
932
+ return Object.assign({}, ...resolve(styles));
933
+ }
934
+ return { mergeCss: memo(mergeCss), assignCss };
935
+ }
936
+
937
+ // src/hypenate-property.ts
938
+ var wordRegex = /([A-Z])/g;
939
+ var msRegex = /^ms-/;
940
+ var hypenateProperty = memo((property) => {
941
+ if (property.startsWith("--"))
942
+ return property;
943
+ return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
944
+ });
945
+
946
+ // src/is-css-function.ts
947
+ var fns = ["min", "max", "clamp", "calc"];
948
+ var fnRegExp = new RegExp(`^(${fns.join("|")})\\(.*\\)`);
949
+ var isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);
950
+
951
+ // src/is-css-unit.ts
952
+ 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,%";
953
+ var lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;
954
+ var lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);
955
+ var isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);
956
+
957
+ // src/is-css-var.ts
958
+ var isCssVar = (v) => typeof v === "string" && /^var\(--.+\)$/.test(v);
959
+
960
+ // src/pattern-fns.ts
961
+ var patternFns = {
962
+ map: mapObject,
963
+ isCssFunction,
964
+ isCssVar,
965
+ isCssUnit
966
+ };
967
+ var getPatternStyles = (pattern, styles) => {
968
+ if (!pattern?.defaultValues)
969
+ return styles;
970
+ const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
971
+ return Object.assign({}, defaults, compact(styles));
972
+ };
973
+
974
+ // src/split-props.ts
975
+ function splitProps(props, ...keys) {
976
+ const descriptors = Object.getOwnPropertyDescriptors(props);
977
+ const dKeys = Object.keys(descriptors);
978
+ const split = (k) => {
979
+ const clone = {};
980
+ for (let i = 0; i < k.length; i++) {
981
+ const key = k[i];
982
+ if (descriptors[key]) {
983
+ Object.defineProperty(clone, key, descriptors[key]);
984
+ delete descriptors[key];
985
+ }
986
+ }
987
+ return clone;
988
+ };
989
+ const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));
990
+ return keys.map(fn).concat(split(dKeys));
991
+ }
992
+
993
+ // src/uniq.ts
994
+ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);
995
+
996
+
997
+
998
+ // src/normalize-html.ts
999
+ var htmlProps = ["htmlSize", "htmlTranslate", "htmlWidth", "htmlHeight"];
1000
+ function convert(key) {
1001
+ return htmlProps.includes(key) ? key.replace("html", "").toLowerCase() : key;
1002
+ }
1003
+ function normalizeHTMLProps(props) {
1004
+ return Object.fromEntries(Object.entries(props).map(([key, value]) => [convert(key), value]));
1005
+ }
1006
+ normalizeHTMLProps.keys = htmlProps;
1007
+
1008
+ const conditionsStr = "_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_default,_optional,_open,_closed,_fullscreen,_loading,_currentPage,_currentStep,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_starting,_collapsed,_current,_hidden,_off,_on,_today,_underValue,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,xl,xlOnly,xlDown,2xl,2xlOnly,2xlDown,smToMd,smToLg,smToXl,smTo2xl,mdToLg,mdToXl,mdTo2xl,lgToXl,lgTo2xl,xlTo2xl,base";
1009
+ const conditions = new Set(conditionsStr.split(','));
1010
+
1011
+ function isCondition(value){
1012
+ return conditions.has(value) || /^@|&|&$/.test(value)
1013
+ }
1014
+
1015
+ const underscoreRegex = /^_/;
1016
+ const conditionsSelectorRegex = /&|@/;
1017
+
1018
+ function finalizeConditions(paths){
1019
+ return paths.map((path) => {
1020
+ if (conditions.has(path)){
1021
+ return path.replace(underscoreRegex, '')
1022
+ }
1023
+
1024
+ if (conditionsSelectorRegex.test(path)){
1025
+ return `[${withoutSpace(path.trim())}]`
1026
+ }
1027
+
1028
+ return path
1029
+ })}
1030
+
1031
+ function sortConditions(paths){
1032
+ return paths.sort((a, b) => {
1033
+ const aa = isCondition(a);
1034
+ const bb = isCondition(b);
1035
+ if (aa && !bb) return 1
1036
+ if (!aa && bb) return -1
1037
+ return 0
1038
+ })
1039
+ }
1040
+
1041
+ const utilities = "aspectRatio:asp,boxDecorationBreak:bx-db,zIndex:z,boxSizing:bx-s,objectPosition:obj-p,objectFit:obj-f,overscrollBehavior:ovs-b,overscrollBehaviorX:ovs-bx,overscrollBehaviorY:ovs-by,position:pos/1,top:top,left:left,inset:inset,insetInline:inset-x/insetX,insetBlock:inset-y/insetY,insetBlockEnd:inset-be,insetBlockStart:inset-bs,insetInlineEnd:inset-e/insetEnd/end,insetInlineStart:inset-s/insetStart/start,right:right,bottom:bottom,float:float,visibility:vis,display:d,hideFrom:hide,hideBelow:show,flexBasis:flex-b,flex:flex,flexDirection:flex-d/flexDir,flexGrow:flex-g,flexShrink:flex-sh,gridTemplateColumns:grid-tc,gridTemplateRows:grid-tr,gridColumn:grid-c,gridRow:grid-r,gridColumnStart:grid-cs,gridColumnEnd:grid-ce,gridAutoFlow:grid-af,gridAutoColumns:grid-ac,gridAutoRows:grid-ar,gap:gap,gridGap:grid-g,gridRowGap:grid-rg,gridColumnGap:grid-cg,rowGap:rg,columnGap:cg,justifyContent:jc,alignContent:ac,alignItems:ai,alignSelf:as,padding:p/1,paddingLeft:pl/1,paddingRight:pr/1,paddingTop:pt/1,paddingBottom:pb/1,paddingBlock:py/1/paddingY,paddingBlockEnd:pbe,paddingBlockStart:pbs,paddingInline:px/paddingX/1,paddingInlineEnd:pe/1/paddingEnd,paddingInlineStart:ps/1/paddingStart,marginLeft:ml/1,marginRight:mr/1,marginTop:mt/1,marginBottom:mb/1,margin:m/1,marginBlock:my/1/marginY,marginBlockEnd:mbe,marginBlockStart:mbs,marginInline:mx/1/marginX,marginInlineEnd:me/1/marginEnd,marginInlineStart:ms/1/marginStart,spaceX:sx,spaceY:sy,outlineWidth:ring-w/ringWidth,outlineColor:ring-c/ringColor,outline:ring/1,outlineOffset:ring-o/ringOffset,divideX:dvd-x,divideY:dvd-y,divideColor:dvd-c,divideStyle:dvd-s,width:w/1,inlineSize:w-is,minWidth:min-w/minW,minInlineSize:min-w-is,maxWidth:max-w/maxW,maxInlineSize:max-w-is,height:h/1,blockSize:h-bs,minHeight:min-h/minH,minBlockSize:min-h-bs,maxHeight:max-h/maxH,maxBlockSize:max-b,color:c,fontFamily:ff,fontSize:fs,fontSizeAdjust:fs-a,fontPalette:fp,fontKerning:fk,fontFeatureSettings:ff-s,fontWeight:fw,fontSmoothing:fsmt,fontVariant:fv,fontVariantAlternates:fv-alt,fontVariantCaps:fv-caps,fontVariationSettings:fv-s,fontVariantNumeric:fv-num,letterSpacing:ls,lineHeight:lh,textAlign:ta,textDecoration:td,textDecorationColor:td-c,textEmphasisColor:te-c,textDecorationStyle:td-s,textDecorationThickness:td-t,textUnderlineOffset:tu-o,textTransform:tt,textIndent:ti,textShadow:tsh,textShadowColor:tsh-c/textShadowColor,textOverflow:tov,verticalAlign:va,wordBreak:wb,textWrap:tw,truncate:trunc,lineClamp:lc,listStyleType:li-t,listStylePosition:li-pos,listStyleImage:li-img,listStyle:li-s,backgroundPosition:bg-p/bgPosition,backgroundPositionX:bg-p-x/bgPositionX,backgroundPositionY:bg-p-y/bgPositionY,backgroundAttachment:bg-a/bgAttachment,backgroundClip:bg-cp/bgClip,background:bg/1,backgroundColor:bg-c/bgColor,backgroundOrigin:bg-o/bgOrigin,backgroundImage:bg-i/bgImage,backgroundRepeat:bg-r/bgRepeat,backgroundBlendMode:bg-bm/bgBlendMode,backgroundSize:bg-s/bgSize,backgroundGradient:bg-grad/bgGradient,textGradient:txt-grad,gradientFromPosition:grad-from-pos,gradientToPosition:grad-to-pos,gradientFrom:grad-from,gradientTo:grad-to,gradientVia:grad-via,gradientViaPosition:grad-via-pos,borderRadius:bdr/rounded,borderTopLeftRadius:bdr-tl/roundedTopLeft,borderTopRightRadius:bdr-tr/roundedTopRight,borderBottomRightRadius:bdr-br/roundedBottomRight,borderBottomLeftRadius:bdr-bl/roundedBottomLeft,borderTopRadius:bdr-t/roundedTop,borderRightRadius:bdr-r/roundedRight,borderBottomRadius:bdr-b/roundedBottom,borderLeftRadius:bdr-l/roundedLeft,borderStartStartRadius:bdr-ss/roundedStartStart,borderStartEndRadius:bdr-se/roundedStartEnd,borderStartRadius:bdr-s/roundedStart,borderEndStartRadius:bdr-es/roundedEndStart,borderEndEndRadius:bdr-ee/roundedEndEnd,borderEndRadius:bdr-e/roundedEnd,border:bd,borderWidth:bd-w,borderTopWidth:bd-t-w,borderLeftWidth:bd-l-w,borderRightWidth:bd-r-w,borderBottomWidth:bd-b-w,borderColor:bd-c,borderInline:bd-x/borderX,borderInlineWidth:bd-x-w/borderXWidth,borderInlineColor:bd-x-c/borderXColor,borderBlock:bd-y/borderY,borderBlockWidth:bd-y-w/borderYWidth,borderBlockColor:bd-y-c/borderYColor,borderLeft:bd-l,borderLeftColor:bd-l-c,borderInlineStart:bd-s/borderStart,borderInlineStartWidth:bd-s-w/borderStartWidth,borderInlineStartColor:bd-s-c/borderStartColor,borderRight:bd-r,borderRightColor:bd-r-c,borderInlineEnd:bd-e/borderEnd,borderInlineEndWidth:bd-e-w/borderEndWidth,borderInlineEndColor:bd-e-c/borderEndColor,borderTop:bd-t,borderTopColor:bd-t-c,borderBottom:bd-b,borderBottomColor:bd-b-c,borderBlockEnd:bd-be,borderBlockEndColor:bd-be-c,borderBlockStart:bd-bs,borderBlockStartColor:bd-bs-c,opacity:op,boxShadow:bx-sh/shadow,boxShadowColor:bx-sh-c/shadowColor,mixBlendMode:mix-bm,filter:filter,brightness:brightness,contrast:contrast,grayscale:grayscale,hueRotate:hue-rotate,invert:invert,saturate:saturate,sepia:sepia,dropShadow:drop-shadow,blur:blur,backdropFilter:bkdp,backdropBlur:bkdp-blur,backdropBrightness:bkdp-brightness,backdropContrast:bkdp-contrast,backdropGrayscale:bkdp-grayscale,backdropHueRotate:bkdp-hue-rotate,backdropInvert:bkdp-invert,backdropOpacity:bkdp-opacity,backdropSaturate:bkdp-saturate,backdropSepia:bkdp-sepia,borderCollapse:bd-cl,borderSpacing:bd-sp,borderSpacingX:bd-sx,borderSpacingY:bd-sy,tableLayout:tbl,transitionTimingFunction:trs-tmf,transitionDelay:trs-dly,transitionDuration:trs-dur,transitionProperty:trs-prop,transition:trs,animation:anim,animationName:anim-n,animationTimingFunction:anim-tmf,animationDuration:anim-dur,animationDelay:anim-dly,animationPlayState:anim-ps,animationComposition:anim-comp,animationFillMode:anim-fm,animationDirection:anim-dir,animationIterationCount:anim-ic,animationRange:anim-r,animationState:anim-s,animationRangeStart:anim-rs,animationRangeEnd:anim-re,animationTimeline:anim-tl,transformOrigin:trf-o,transformBox:trf-b,transformStyle:trf-s,transform:trf,rotate:rotate,rotateX:rotate-x,rotateY:rotate-y,rotateZ:rotate-z,scale:scale,scaleX:scale-x,scaleY:scale-y,translate:translate,translateX:translate-x/x,translateY:translate-y/y,translateZ:translate-z/z,accentColor:ac-c,caretColor:ca-c,scrollBehavior:scr-bhv,scrollbar:scr-bar,scrollbarColor:scr-bar-c,scrollbarGutter:scr-bar-g,scrollbarWidth:scr-bar-w,scrollMargin:scr-m,scrollMarginLeft:scr-ml,scrollMarginRight:scr-mr,scrollMarginTop:scr-mt,scrollMarginBottom:scr-mb,scrollMarginBlock:scr-my/scrollMarginY,scrollMarginBlockEnd:scr-mbe,scrollMarginBlockStart:scr-mbt,scrollMarginInline:scr-mx/scrollMarginX,scrollMarginInlineEnd:scr-me,scrollMarginInlineStart:scr-ms,scrollPadding:scr-p,scrollPaddingBlock:scr-py/scrollPaddingY,scrollPaddingBlockStart:scr-pbs,scrollPaddingBlockEnd:scr-pbe,scrollPaddingInline:scr-px/scrollPaddingX,scrollPaddingInlineEnd:scr-pe,scrollPaddingInlineStart:scr-ps,scrollPaddingLeft:scr-pl,scrollPaddingRight:scr-pr,scrollPaddingTop:scr-pt,scrollPaddingBottom:scr-pb,scrollSnapAlign:scr-sa,scrollSnapStop:scrs-s,scrollSnapType:scrs-t,scrollSnapStrictness:scrs-strt,scrollSnapMargin:scrs-m,scrollSnapMarginTop:scrs-mt,scrollSnapMarginBottom:scrs-mb,scrollSnapMarginLeft:scrs-ml,scrollSnapMarginRight:scrs-mr,scrollSnapCoordinate:scrs-c,scrollSnapDestination:scrs-d,scrollSnapPointsX:scrs-px,scrollSnapPointsY:scrs-py,scrollSnapTypeX:scrs-tx,scrollSnapTypeY:scrs-ty,scrollTimeline:scrtl,scrollTimelineAxis:scrtl-a,scrollTimelineName:scrtl-n,touchAction:tch-a,userSelect:us,overflow:ov,overflowWrap:ov-wrap,overflowX:ov-x,overflowY:ov-y,overflowAnchor:ov-a,overflowBlock:ov-b,overflowInline:ov-i,overflowClipBox:ovcp-bx,overflowClipMargin:ovcp-m,overscrollBehaviorBlock:ovs-bb,overscrollBehaviorInline:ovs-bi,fill:fill,stroke:stk,strokeWidth:stk-w,strokeDasharray:stk-dsh,strokeDashoffset:stk-do,strokeLinecap:stk-lc,strokeLinejoin:stk-lj,strokeMiterlimit:stk-ml,strokeOpacity:stk-op,srOnly:sr,debug:debug,appearance:ap,backfaceVisibility:bfv,clipPath:cp-path,hyphens:hy,mask:msk,maskImage:msk-i,maskSize:msk-s,textSizeAdjust:txt-adj,container:cq,containerName:cq-n,containerType:cq-t,textStyle:textStyle";
1042
+
1043
+ const classNameByProp = new Map();
1044
+ const shorthands = new Map();
1045
+ utilities.split(',').forEach((utility) => {
1046
+ const [prop, meta] = utility.split(':');
1047
+ const [className, ...shorthandList] = meta.split('/');
1048
+ classNameByProp.set(prop, className);
1049
+ if (shorthandList.length) {
1050
+ shorthandList.forEach((shorthand) => {
1051
+ shorthands.set(shorthand === '1' ? className : shorthand, prop);
1052
+ });
1053
+ }
1054
+ });
1055
+
1056
+ const resolveShorthand = (prop) => shorthands.get(prop) || prop;
1057
+
1058
+ const context = {
1059
+
1060
+ conditions: {
1061
+ shift: sortConditions,
1062
+ finalize: finalizeConditions,
1063
+ breakpoints: { keys: ["base","sm","md","lg","xl","2xl"] }
1064
+ },
1065
+ utility: {
1066
+
1067
+ transform: (prop, value) => {
1068
+ const key = resolveShorthand(prop);
1069
+ const propKey = classNameByProp.get(key) || hypenateProperty(key);
1070
+ return { className: `${propKey}_${withoutSpace(value)}` }
1071
+ },
1072
+ hasShorthand: true,
1073
+ toHash: (path, hashFn) => hashFn(path.join(":")),
1074
+ resolveShorthand: resolveShorthand,
1075
+ }
1076
+ };
1077
+
1078
+ const cssFn = createCss(context);
1079
+ const css = (...styles) => cssFn(mergeCss(...styles));
1080
+ css.raw = (...styles) => mergeCss(...styles);
1081
+
1082
+ const { mergeCss, assignCss } = createMergeCss(context);
1083
+
1084
+ function cx() {
1085
+ let str = '',
1086
+ i = 0,
1087
+ arg;
1088
+
1089
+ for (; i < arguments.length; ) {
1090
+ if ((arg = arguments[i++]) && typeof arg === 'string') {
1091
+ str && (str += ' ');
1092
+ str += arg;
1093
+ }
1094
+ }
1095
+ return str
1096
+ }
1097
+
1098
+ const defaults = (conf) => ({
1099
+ base: {},
1100
+ variants: {},
1101
+ defaultVariants: {},
1102
+ compoundVariants: [],
1103
+ ...conf,
1104
+ });
1105
+
1106
+ function cva(config) {
1107
+ const { base, variants, defaultVariants, compoundVariants } = defaults(config);
1108
+ const getVariantProps = (variants) => ({ ...defaultVariants, ...compact(variants) });
1109
+
1110
+ function resolve(props = {}) {
1111
+ const computedVariants = getVariantProps(props);
1112
+ let variantCss = { ...base };
1113
+ for (const [key, value] of Object.entries(computedVariants)) {
1114
+ if (variants[key]?.[value]) {
1115
+ variantCss = mergeCss(variantCss, variants[key][value]);
1116
+ }
1117
+ }
1118
+ const compoundVariantCss = getCompoundVariantCss(compoundVariants, computedVariants);
1119
+ return mergeCss(variantCss, compoundVariantCss)
1120
+ }
1121
+
1122
+ function merge(__cva) {
1123
+ const override = defaults(__cva.config);
1124
+ const variantKeys = uniq(__cva.variantKeys, Object.keys(variants));
1125
+ return cva({
1126
+ base: mergeCss(base, override.base),
1127
+ variants: Object.fromEntries(
1128
+ variantKeys.map((key) => [key, mergeCss(variants[key], override.variants[key])]),
1129
+ ),
1130
+ defaultVariants: mergeProps(defaultVariants, override.defaultVariants),
1131
+ compoundVariants: [...compoundVariants, ...override.compoundVariants],
1132
+ })
1133
+ }
1134
+
1135
+ function cvaFn(props) {
1136
+ return css(resolve(props))
1137
+ }
1138
+
1139
+ const variantKeys = Object.keys(variants);
1140
+
1141
+ function splitVariantProps(props) {
1142
+ return splitProps(props, variantKeys)
1143
+ }
1144
+
1145
+ const variantMap = Object.fromEntries(Object.entries(variants).map(([key, value]) => [key, Object.keys(value)]));
1146
+
1147
+ return Object.assign(memo(cvaFn), {
1148
+ __cva__: true,
1149
+ variantMap,
1150
+ variantKeys,
1151
+ raw: resolve,
1152
+ config,
1153
+ merge,
1154
+ splitVariantProps,
1155
+ getVariantProps
1156
+ })
1157
+ }
1158
+
1159
+ function getCompoundVariantCss(compoundVariants, variantMap) {
1160
+ let result = {};
1161
+ compoundVariants.forEach((compoundVariant) => {
1162
+ const isMatching = Object.entries(compoundVariant).every(([key, value]) => {
1163
+ if (key === 'css') return true
1164
+
1165
+ const values = Array.isArray(value) ? value : [value];
1166
+ return values.some((value) => variantMap[key] === value)
1167
+ });
1168
+
1169
+ if (isMatching) {
1170
+ result = mergeCss(result, compoundVariant.css);
1171
+ }
1172
+ });
1173
+
1174
+ return result
1175
+ }
1176
+
1177
+ function assertCompoundVariant(name, compoundVariants, variants, prop) {
1178
+ if (compoundVariants.length > 0 && typeof variants?.[prop] === 'object') {
1179
+ throw new Error(`[recipe:${name}:${prop}] Conditions are not supported when using compound variants.`)
1180
+ }
1181
+ }
1182
+
1183
+ // src/index.ts
1184
+ var userGeneratedStr = "css,pos,insetX,insetY,insetEnd,end,insetStart,start,flexDir,p,pl,pr,pt,pb,py,paddingY,paddingX,px,pe,paddingEnd,ps,paddingStart,ml,mr,mt,mb,m,my,marginY,mx,marginX,me,marginEnd,ms,marginStart,ringWidth,ringColor,ring,ringOffset,w,minW,maxW,h,minH,maxH,textShadowColor,bgPosition,bgPositionX,bgPositionY,bgAttachment,bgClip,bg,bgColor,bgOrigin,bgImage,bgRepeat,bgBlendMode,bgSize,bgGradient,rounded,roundedTopLeft,roundedTopRight,roundedBottomRight,roundedBottomLeft,roundedTop,roundedRight,roundedBottom,roundedLeft,roundedStartStart,roundedStartEnd,roundedStart,roundedEndStart,roundedEndEnd,roundedEnd,borderX,borderXWidth,borderXColor,borderY,borderYWidth,borderYColor,borderStart,borderStartWidth,borderStartColor,borderEnd,borderEndWidth,borderEndColor,shadow,shadowColor,x,y,z,scrollMarginY,scrollMarginX,scrollPaddingY,scrollPaddingX,aspectRatio,boxDecorationBreak,zIndex,boxSizing,objectPosition,objectFit,overscrollBehavior,overscrollBehaviorX,overscrollBehaviorY,position,top,left,inset,insetInline,insetBlock,insetBlockEnd,insetBlockStart,insetInlineEnd,insetInlineStart,right,bottom,float,visibility,display,hideFrom,hideBelow,flexBasis,flex,flexDirection,flexGrow,flexShrink,gridTemplateColumns,gridTemplateRows,gridColumn,gridRow,gridColumnStart,gridColumnEnd,gridAutoFlow,gridAutoColumns,gridAutoRows,gap,gridGap,gridRowGap,gridColumnGap,rowGap,columnGap,justifyContent,alignContent,alignItems,alignSelf,padding,paddingLeft,paddingRight,paddingTop,paddingBottom,paddingBlock,paddingBlockEnd,paddingBlockStart,paddingInline,paddingInlineEnd,paddingInlineStart,marginLeft,marginRight,marginTop,marginBottom,margin,marginBlock,marginBlockEnd,marginBlockStart,marginInline,marginInlineEnd,marginInlineStart,spaceX,spaceY,outlineWidth,outlineColor,outline,outlineOffset,divideX,divideY,divideColor,divideStyle,width,inlineSize,minWidth,minInlineSize,maxWidth,maxInlineSize,height,blockSize,minHeight,minBlockSize,maxHeight,maxBlockSize,color,fontFamily,fontSize,fontSizeAdjust,fontPalette,fontKerning,fontFeatureSettings,fontWeight,fontSmoothing,fontVariant,fontVariantAlternates,fontVariantCaps,fontVariationSettings,fontVariantNumeric,letterSpacing,lineHeight,textAlign,textDecoration,textDecorationColor,textEmphasisColor,textDecorationStyle,textDecorationThickness,textUnderlineOffset,textTransform,textIndent,textShadow,textOverflow,verticalAlign,wordBreak,textWrap,truncate,lineClamp,listStyleType,listStylePosition,listStyleImage,listStyle,backgroundPosition,backgroundPositionX,backgroundPositionY,backgroundAttachment,backgroundClip,background,backgroundColor,backgroundOrigin,backgroundImage,backgroundRepeat,backgroundBlendMode,backgroundSize,backgroundGradient,textGradient,gradientFromPosition,gradientToPosition,gradientFrom,gradientTo,gradientVia,gradientViaPosition,borderRadius,borderTopLeftRadius,borderTopRightRadius,borderBottomRightRadius,borderBottomLeftRadius,borderTopRadius,borderRightRadius,borderBottomRadius,borderLeftRadius,borderStartStartRadius,borderStartEndRadius,borderStartRadius,borderEndStartRadius,borderEndEndRadius,borderEndRadius,border,borderWidth,borderTopWidth,borderLeftWidth,borderRightWidth,borderBottomWidth,borderColor,borderInline,borderInlineWidth,borderInlineColor,borderBlock,borderBlockWidth,borderBlockColor,borderLeft,borderLeftColor,borderInlineStart,borderInlineStartWidth,borderInlineStartColor,borderRight,borderRightColor,borderInlineEnd,borderInlineEndWidth,borderInlineEndColor,borderTop,borderTopColor,borderBottom,borderBottomColor,borderBlockEnd,borderBlockEndColor,borderBlockStart,borderBlockStartColor,opacity,boxShadow,boxShadowColor,mixBlendMode,filter,brightness,contrast,grayscale,hueRotate,invert,saturate,sepia,dropShadow,blur,backdropFilter,backdropBlur,backdropBrightness,backdropContrast,backdropGrayscale,backdropHueRotate,backdropInvert,backdropOpacity,backdropSaturate,backdropSepia,borderCollapse,borderSpacing,borderSpacingX,borderSpacingY,tableLayout,transitionTimingFunction,transitionDelay,transitionDuration,transitionProperty,transition,animation,animationName,animationTimingFunction,animationDuration,animationDelay,animationPlayState,animationComposition,animationFillMode,animationDirection,animationIterationCount,animationRange,animationState,animationRangeStart,animationRangeEnd,animationTimeline,transformOrigin,transformBox,transformStyle,transform,rotate,rotateX,rotateY,rotateZ,scale,scaleX,scaleY,translate,translateX,translateY,translateZ,accentColor,caretColor,scrollBehavior,scrollbar,scrollbarColor,scrollbarGutter,scrollbarWidth,scrollMargin,scrollMarginLeft,scrollMarginRight,scrollMarginTop,scrollMarginBottom,scrollMarginBlock,scrollMarginBlockEnd,scrollMarginBlockStart,scrollMarginInline,scrollMarginInlineEnd,scrollMarginInlineStart,scrollPadding,scrollPaddingBlock,scrollPaddingBlockStart,scrollPaddingBlockEnd,scrollPaddingInline,scrollPaddingInlineEnd,scrollPaddingInlineStart,scrollPaddingLeft,scrollPaddingRight,scrollPaddingTop,scrollPaddingBottom,scrollSnapAlign,scrollSnapStop,scrollSnapType,scrollSnapStrictness,scrollSnapMargin,scrollSnapMarginTop,scrollSnapMarginBottom,scrollSnapMarginLeft,scrollSnapMarginRight,scrollSnapCoordinate,scrollSnapDestination,scrollSnapPointsX,scrollSnapPointsY,scrollSnapTypeX,scrollSnapTypeY,scrollTimeline,scrollTimelineAxis,scrollTimelineName,touchAction,userSelect,overflow,overflowWrap,overflowX,overflowY,overflowAnchor,overflowBlock,overflowInline,overflowClipBox,overflowClipMargin,overscrollBehaviorBlock,overscrollBehaviorInline,fill,stroke,strokeWidth,strokeDasharray,strokeDashoffset,strokeLinecap,strokeLinejoin,strokeMiterlimit,strokeOpacity,srOnly,debug,appearance,backfaceVisibility,clipPath,hyphens,mask,maskImage,maskSize,textSizeAdjust,container,containerName,containerType,colorPalette,_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_default,_optional,_open,_closed,_fullscreen,_loading,_currentPage,_currentStep,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_starting,_collapsed,_current,_hidden,_off,_on,_today,_underValue,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,xl,xlOnly,xlDown,2xl,2xlOnly,2xlDown,smToMd,smToLg,smToXl,smTo2xl,mdToLg,mdToXl,mdTo2xl,lgToXl,lgTo2xl,xlTo2xl,textStyle";
1185
+ var userGenerated = userGeneratedStr.split(",");
1186
+ var cssPropertiesStr = "WebkitAppearance,WebkitBorderBefore,WebkitBorderBeforeColor,WebkitBorderBeforeStyle,WebkitBorderBeforeWidth,WebkitBoxReflect,WebkitLineClamp,WebkitMask,WebkitMaskAttachment,WebkitMaskClip,WebkitMaskComposite,WebkitMaskImage,WebkitMaskOrigin,WebkitMaskPosition,WebkitMaskPositionX,WebkitMaskPositionY,WebkitMaskRepeat,WebkitMaskRepeatX,WebkitMaskRepeatY,WebkitMaskSize,WebkitOverflowScrolling,WebkitTapHighlightColor,WebkitTextFillColor,WebkitTextStroke,WebkitTextStrokeColor,WebkitTextStrokeWidth,WebkitTouchCallout,WebkitUserModify,accentColor,alignContent,alignItems,alignSelf,alignTracks,all,animation,animationComposition,animationDelay,animationDirection,animationDuration,animationFillMode,animationIterationCount,animationName,animationPlayState,animationRange,animationRangeEnd,animationRangeStart,animationTimingFunction,animationTimeline,appearance,aspectRatio,azimuth,backdropFilter,backfaceVisibility,background,backgroundAttachment,backgroundBlendMode,backgroundClip,backgroundColor,backgroundImage,backgroundOrigin,backgroundPosition,backgroundPositionX,backgroundPositionY,backgroundRepeat,backgroundSize,blockSize,border,borderBlock,borderBlockColor,borderBlockStyle,borderBlockWidth,borderBlockEnd,borderBlockEndColor,borderBlockEndStyle,borderBlockEndWidth,borderBlockStart,borderBlockStartColor,borderBlockStartStyle,borderBlockStartWidth,borderBottom,borderBottomColor,borderBottomLeftRadius,borderBottomRightRadius,borderBottomStyle,borderBottomWidth,borderCollapse,borderColor,borderEndEndRadius,borderEndStartRadius,borderImage,borderImageOutset,borderImageRepeat,borderImageSlice,borderImageSource,borderImageWidth,borderInline,borderInlineEnd,borderInlineColor,borderInlineStyle,borderInlineWidth,borderInlineEndColor,borderInlineEndStyle,borderInlineEndWidth,borderInlineStart,borderInlineStartColor,borderInlineStartStyle,borderInlineStartWidth,borderLeft,borderLeftColor,borderLeftStyle,borderLeftWidth,borderRadius,borderRight,borderRightColor,borderRightStyle,borderRightWidth,borderSpacing,borderStartEndRadius,borderStartStartRadius,borderStyle,borderTop,borderTopColor,borderTopLeftRadius,borderTopRightRadius,borderTopStyle,borderTopWidth,borderWidth,bottom,boxAlign,boxDecorationBreak,boxDirection,boxFlex,boxFlexGroup,boxLines,boxOrdinalGroup,boxOrient,boxPack,boxShadow,boxSizing,breakAfter,breakBefore,breakInside,captionSide,caret,caretColor,caretShape,clear,clip,clipPath,color,colorScheme,columnCount,columnFill,columnGap,columnRule,columnRuleColor,columnRuleStyle,columnRuleWidth,columnSpan,columnWidth,columns,contain,containIntrinsicSize,containIntrinsicBlockSize,containIntrinsicHeight,containIntrinsicInlineSize,containIntrinsicWidth,container,containerName,containerType,content,contentVisibility,counterIncrement,counterReset,counterSet,cursor,direction,display,emptyCells,filter,flex,flexBasis,flexDirection,flexFlow,flexGrow,flexShrink,flexWrap,float,font,fontFamily,fontFeatureSettings,fontKerning,fontLanguageOverride,fontOpticalSizing,fontPalette,fontVariationSettings,fontSize,fontSizeAdjust,fontSmooth,fontStretch,fontStyle,fontSynthesis,fontSynthesisPosition,fontSynthesisSmallCaps,fontSynthesisStyle,fontSynthesisWeight,fontVariant,fontVariantAlternates,fontVariantCaps,fontVariantEastAsian,fontVariantEmoji,fontVariantLigatures,fontVariantNumeric,fontVariantPosition,fontWeight,forcedColorAdjust,gap,grid,gridArea,gridAutoColumns,gridAutoFlow,gridAutoRows,gridColumn,gridColumnEnd,gridColumnGap,gridColumnStart,gridGap,gridRow,gridRowEnd,gridRowGap,gridRowStart,gridTemplate,gridTemplateAreas,gridTemplateColumns,gridTemplateRows,hangingPunctuation,height,hyphenateCharacter,hyphenateLimitChars,hyphens,imageOrientation,imageRendering,imageResolution,imeMode,initialLetter,initialLetterAlign,inlineSize,inputSecurity,inset,insetBlock,insetBlockEnd,insetBlockStart,insetInline,insetInlineEnd,insetInlineStart,isolation,justifyContent,justifyItems,justifySelf,justifyTracks,left,letterSpacing,lineBreak,lineClamp,lineHeight,lineHeightStep,listStyle,listStyleImage,listStylePosition,listStyleType,margin,marginBlock,marginBlockEnd,marginBlockStart,marginBottom,marginInline,marginInlineEnd,marginInlineStart,marginLeft,marginRight,marginTop,marginTrim,mask,maskBorder,maskBorderMode,maskBorderOutset,maskBorderRepeat,maskBorderSlice,maskBorderSource,maskBorderWidth,maskClip,maskComposite,maskImage,maskMode,maskOrigin,maskPosition,maskRepeat,maskSize,maskType,masonryAutoFlow,mathDepth,mathShift,mathStyle,maxBlockSize,maxHeight,maxInlineSize,maxLines,maxWidth,minBlockSize,minHeight,minInlineSize,minWidth,mixBlendMode,objectFit,objectPosition,offset,offsetAnchor,offsetDistance,offsetPath,offsetPosition,offsetRotate,opacity,order,orphans,outline,outlineColor,outlineOffset,outlineStyle,outlineWidth,overflow,overflowAnchor,overflowBlock,overflowClipBox,overflowClipMargin,overflowInline,overflowWrap,overflowX,overflowY,overlay,overscrollBehavior,overscrollBehaviorBlock,overscrollBehaviorInline,overscrollBehaviorX,overscrollBehaviorY,padding,paddingBlock,paddingBlockEnd,paddingBlockStart,paddingBottom,paddingInline,paddingInlineEnd,paddingInlineStart,paddingLeft,paddingRight,paddingTop,page,pageBreakAfter,pageBreakBefore,pageBreakInside,paintOrder,perspective,perspectiveOrigin,placeContent,placeItems,placeSelf,pointerEvents,position,printColorAdjust,quotes,resize,right,rotate,rowGap,rubyAlign,rubyMerge,rubyPosition,scale,scrollbarColor,scrollbarGutter,scrollbarWidth,scrollBehavior,scrollMargin,scrollMarginBlock,scrollMarginBlockStart,scrollMarginBlockEnd,scrollMarginBottom,scrollMarginInline,scrollMarginInlineStart,scrollMarginInlineEnd,scrollMarginLeft,scrollMarginRight,scrollMarginTop,scrollPadding,scrollPaddingBlock,scrollPaddingBlockStart,scrollPaddingBlockEnd,scrollPaddingBottom,scrollPaddingInline,scrollPaddingInlineStart,scrollPaddingInlineEnd,scrollPaddingLeft,scrollPaddingRight,scrollPaddingTop,scrollSnapAlign,scrollSnapCoordinate,scrollSnapDestination,scrollSnapPointsX,scrollSnapPointsY,scrollSnapStop,scrollSnapType,scrollSnapTypeX,scrollSnapTypeY,scrollTimeline,scrollTimelineAxis,scrollTimelineName,shapeImageThreshold,shapeMargin,shapeOutside,tabSize,tableLayout,textAlign,textAlignLast,textCombineUpright,textDecoration,textDecorationColor,textDecorationLine,textDecorationSkip,textDecorationSkipInk,textDecorationStyle,textDecorationThickness,textEmphasis,textEmphasisColor,textEmphasisPosition,textEmphasisStyle,textIndent,textJustify,textOrientation,textOverflow,textRendering,textShadow,textSizeAdjust,textTransform,textUnderlineOffset,textUnderlinePosition,textWrap,timelineScope,top,touchAction,transform,transformBox,transformOrigin,transformStyle,transition,transitionBehavior,transitionDelay,transitionDuration,transitionProperty,transitionTimingFunction,translate,unicodeBidi,userSelect,verticalAlign,viewTimeline,viewTimelineAxis,viewTimelineInset,viewTimelineName,viewTransitionName,visibility,whiteSpace,whiteSpaceCollapse,widows,width,willChange,wordBreak,wordSpacing,wordWrap,writingMode,zIndex,zoom,alignmentBaseline,baselineShift,clipRule,colorInterpolation,colorRendering,dominantBaseline,fill,fillOpacity,fillRule,floodColor,floodOpacity,glyphOrientationVertical,lightingColor,marker,markerEnd,markerMid,markerStart,shapeRendering,stopColor,stopOpacity,stroke,strokeDasharray,strokeDashoffset,strokeLinecap,strokeLinejoin,strokeMiterlimit,strokeOpacity,strokeWidth,textAnchor,vectorEffect";
1187
+ var allCssProperties = cssPropertiesStr.split(",").concat(userGenerated);
1188
+ var properties = new Map(allCssProperties.map((prop) => [prop, true]));
1189
+ var cssPropertySelectorRegex = /&|@/;
1190
+ var isCssProperty = /* @__PURE__ */ memo((prop) => {
1191
+ return properties.has(prop) || prop.startsWith("--") || cssPropertySelectorRegex.test(prop);
1192
+ });
1193
+
1194
+ const defaultShouldForwardProp = (prop, variantKeys) => !variantKeys.includes(prop) && !isCssProperty(prop);
1195
+
1196
+ const composeShouldForwardProps = (tag, shouldForwardProp) =>
1197
+ tag.__shouldForwardProps__ && shouldForwardProp
1198
+ ? (propName) => tag.__shouldForwardProps__(propName) && shouldForwardProp(propName)
1199
+ : shouldForwardProp;
1200
+
1201
+ const composeCvaFn = (cvaA, cvaB) => {
1202
+ if (cvaA && !cvaB) return cvaA
1203
+ if (!cvaA && cvaB) return cvaB
1204
+ if ((cvaA.__cva__ && cvaB.__cva__) || (cvaA.__recipe__ && cvaB.__recipe__)) return cvaA.merge(cvaB)
1205
+ const error = new TypeError('Cannot merge cva with recipe. Please use either cva or recipe.');
1206
+ TypeError.captureStackTrace?.(error);
1207
+ throw error
1208
+ };
1209
+
1210
+ const getDisplayName = (Component) => {
1211
+ if (typeof Component === 'string') return Component
1212
+ return Component?.displayName || Component?.name || 'Component'
1213
+ };
1214
+
1215
+ function styledFn(Dynamic, configOrCva = {}, options = {}) {
1216
+ const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva);
1217
+
1218
+ const forwardFn = options.shouldForwardProp || defaultShouldForwardProp;
1219
+ const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys);
1220
+
1221
+ const defaultProps = Object.assign(
1222
+ options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
1223
+ options.defaultProps,
1224
+ );
1225
+
1226
+ const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn);
1227
+ const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp);
1228
+ const __base__ = Dynamic.__base__ || Dynamic;
1229
+
1230
+ const StyledComponent = /* @__PURE__ */ forwardRef(function StyledComponent(props, ref) {
1231
+ const { as: Element = __base__, children, ...restProps } = props;
1232
+
1233
+ const combinedProps = useMemo(() => Object.assign({}, defaultProps, restProps), [restProps]);
1234
+
1235
+ const [htmlProps, forwardedProps, variantProps, styleProps, elementProps] = useMemo(() => {
1236
+ return splitProps(combinedProps, normalizeHTMLProps.keys, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty)
1237
+ }, [combinedProps]);
1238
+
1239
+ function recipeClass() {
1240
+ const { css: cssStyles, ...propStyles } = styleProps;
1241
+ const compoundVariantStyles = __cvaFn__.__getCompoundVariantCss__?.(variantProps);
1242
+ return cx(__cvaFn__(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), combinedProps.className)
1243
+ }
1244
+
1245
+ function cvaClass() {
1246
+ const { css: cssStyles, ...propStyles } = styleProps;
1247
+ const cvaStyles = __cvaFn__.raw(variantProps);
1248
+ return cx(css(cvaStyles, propStyles, cssStyles), combinedProps.className)
1249
+ }
1250
+
1251
+ const classes = configOrCva.__recipe__ ? recipeClass : cvaClass;
1252
+
1253
+ return createElement(Element, {
1254
+ ref,
1255
+ ...forwardedProps,
1256
+ ...elementProps,
1257
+ ...normalizeHTMLProps(htmlProps),
1258
+ className: classes(),
1259
+ }, combinedProps.children ?? children)
1260
+ });
1261
+
1262
+ const name = getDisplayName(__base__);
1263
+
1264
+ StyledComponent.displayName = `styled.${name}`;
1265
+ StyledComponent.__cva__ = __cvaFn__;
1266
+ StyledComponent.__base__ = __base__;
1267
+ StyledComponent.__shouldForwardProps__ = shouldForwardProp;
1268
+
1269
+ return StyledComponent
1270
+ }
1271
+
1272
+ function createJsxFactory() {
1273
+ const cache = new Map();
1274
+
1275
+ return new Proxy(styledFn, {
1276
+ apply(_, __, args) {
1277
+ return styledFn(...args)
1278
+ },
1279
+ get(_, el) {
1280
+ if (!cache.has(el)) {
1281
+ cache.set(el, styledFn(el));
1282
+ }
1283
+ return cache.get(el)
1284
+ },
1285
+ })
1286
+ }
1287
+
1288
+ const styled = /* @__PURE__ */ createJsxFactory();
1289
+
1290
+ const centerConfig = {
1291
+ transform(props) {
1292
+ const { inline, ...rest } = props;
1293
+ return {
1294
+ display: inline ? "inline-flex" : "flex",
1295
+ alignItems: "center",
1296
+ justifyContent: "center",
1297
+ ...rest
1298
+ };
1299
+ }};
1300
+
1301
+ const getCenterStyle = (styles = {}) => {
1302
+ const _styles = getPatternStyles(centerConfig, styles);
1303
+ return centerConfig.transform(_styles, patternFns)
1304
+ };
1305
+
1306
+ const Center = /* @__PURE__ */ forwardRef(function Center(props, ref) {
1307
+ const [patternProps, restProps] = splitProps(props, ["inline"]);
1308
+
1309
+ const styleProps = getCenterStyle(patternProps);
1310
+ const mergedProps = { ref, ...styleProps, ...restProps };
1311
+
1312
+ return createElement(styled.div, mergedProps)
1313
+ });
1314
+
1315
+ const createRecipe = (name, defaultVariants, compoundVariants) => {
1316
+ const getVariantProps = (variants) => {
1317
+ return {
1318
+ [name]: '__ignore__',
1319
+ ...defaultVariants,
1320
+ ...compact(variants),
1321
+ };
1322
+ };
1323
+
1324
+ const recipeFn = (variants, withCompoundVariants = true) => {
1325
+ const transform = (prop, value) => {
1326
+ assertCompoundVariant(name, compoundVariants, variants, prop);
1327
+
1328
+ if (value === '__ignore__') {
1329
+ return { className: name }
1330
+ }
1331
+
1332
+ value = withoutSpace(value);
1333
+ return { className: `${name}--${prop}_${value}` }
1334
+ };
1335
+
1336
+ const recipeCss = createCss({
1337
+
1338
+ conditions: {
1339
+ shift: sortConditions,
1340
+ finalize: finalizeConditions,
1341
+ breakpoints: { keys: ["base","sm","md","lg","xl","2xl"] }
1342
+ },
1343
+ utility: {
1344
+
1345
+ toHash: (path, hashFn) => hashFn(path.join(":")),
1346
+ transform,
1347
+ }
1348
+ });
1349
+
1350
+ const recipeStyles = getVariantProps(variants);
1351
+
1352
+ if (withCompoundVariants) {
1353
+ const compoundVariantStyles = getCompoundVariantCss(compoundVariants, recipeStyles);
1354
+ return cx(recipeCss(recipeStyles), css(compoundVariantStyles))
1355
+ }
1356
+
1357
+ return recipeCss(recipeStyles)
1358
+ };
1359
+
1360
+ return {
1361
+ recipeFn,
1362
+ getVariantProps,
1363
+ __getCompoundVariantCss__: (variants) => {
1364
+ return getCompoundVariantCss(compoundVariants, getVariantProps(variants));
1365
+ },
1366
+ }
1367
+ };
1368
+
1369
+ const mergeRecipes = (recipeA, recipeB) => {
1370
+ if (recipeA && !recipeB) return recipeA
1371
+ if (!recipeA && recipeB) return recipeB
1372
+
1373
+ const recipeFn = (...args) => cx(recipeA(...args), recipeB(...args));
1374
+ const variantKeys = uniq(recipeA.variantKeys, recipeB.variantKeys);
1375
+ const variantMap = variantKeys.reduce((acc, key) => {
1376
+ acc[key] = uniq(recipeA.variantMap[key], recipeB.variantMap[key]);
1377
+ return acc
1378
+ }, {});
1379
+
1380
+ return Object.assign(recipeFn, {
1381
+ __recipe__: true,
1382
+ __name__: `${recipeA.__name__} ${recipeB.__name__}`,
1383
+ raw: (props) => props,
1384
+ variantKeys,
1385
+ variantMap,
1386
+ splitVariantProps(props) {
1387
+ return splitProps(props, variantKeys)
1388
+ },
1389
+ })
1390
+ };
1391
+
1392
+ const buttonFn = /* @__PURE__ */ createRecipe('button', {
1393
+ "variant": "solid",
1394
+ "size": "md"
1395
+ }, []);
1396
+
1397
+ const buttonVariantMap = {
1398
+ "variant": [
1399
+ "solid",
1400
+ "outline",
1401
+ "ghost",
1402
+ "link",
1403
+ "subtle"
1404
+ ],
1405
+ "size": [
1406
+ "xs",
1407
+ "sm",
1408
+ "md",
1409
+ "lg",
1410
+ "xl",
1411
+ "2xl"
1412
+ ]
1413
+ };
1414
+
1415
+ const buttonVariantKeys = Object.keys(buttonVariantMap);
1416
+
1417
+ const button = /* @__PURE__ */ Object.assign(memo(buttonFn.recipeFn), {
1418
+ __recipe__: true,
1419
+ __name__: 'button',
1420
+ __getCompoundVariantCss__: buttonFn.__getCompoundVariantCss__,
1421
+ raw: (props) => props,
1422
+ variantKeys: buttonVariantKeys,
1423
+ variantMap: buttonVariantMap,
1424
+ merge(recipe) {
1425
+ return mergeRecipes(this, recipe)
1426
+ },
1427
+ splitVariantProps(props) {
1428
+ return splitProps(props, buttonVariantKeys)
1429
+ },
1430
+ getVariantProps: buttonFn.getVariantProps,
1431
+ });
1432
+
1433
+ const spinnerFn = /* @__PURE__ */ createRecipe('spinner', {
1434
+ "size": "md"
1435
+ }, []);
1436
+
1437
+ const spinnerVariantMap = {
1438
+ "size": [
1439
+ "xs",
1440
+ "sm",
1441
+ "md",
1442
+ "lg",
1443
+ "xl"
1444
+ ]
1445
+ };
1446
+
1447
+ const spinnerVariantKeys = Object.keys(spinnerVariantMap);
1448
+
1449
+ const spinner = /* @__PURE__ */ Object.assign(memo(spinnerFn.recipeFn), {
1450
+ __recipe__: true,
1451
+ __name__: 'spinner',
1452
+ __getCompoundVariantCss__: spinnerFn.__getCompoundVariantCss__,
1453
+ raw: (props) => props,
1454
+ variantKeys: spinnerVariantKeys,
1455
+ variantMap: spinnerVariantMap,
1456
+ merge(recipe) {
1457
+ return mergeRecipes(this, recipe)
1458
+ },
1459
+ splitVariantProps(props) {
1460
+ return splitProps(props, spinnerVariantKeys)
1461
+ },
1462
+ getVariantProps: spinnerFn.getVariantProps,
1463
+ });
1464
+
1465
+ const Spinner$1 = styled(ark.div, spinner);
1466
+
1467
+ const Spinner = forwardRef((props, ref) => {
1468
+ const { label = 'Loading...', ...rest } = props;
1469
+ return (jsx(Spinner$1, { ref: ref, borderBottomColor: 'transparent', borderLeftColor: 'transparent', ...rest, children: label && jsx(styled.span, { srOnly: true, children: label }) }));
1470
+ });
1471
+ Spinner.displayName = 'Spinner';
1472
+
1473
+ const Button$1 = styled(ark.button, button);
1474
+
1475
+ const Button = forwardRef((props, ref) => {
1476
+ const { loading, disabled, loadingText, children, ...rest } = props;
1477
+ const trulyDisabled = loading || disabled;
1478
+ return (jsx(Button$1, { disabled: trulyDisabled, ref: ref, ...rest, children: loading && !loadingText ? (jsxs(Fragment, { children: [jsx(ButtonSpinner, {}), jsx(styled.span, { opacity: 0, children: children })] })) : loadingText ? (loadingText) : (children) }));
1479
+ });
1480
+ Button.displayName = 'Button';
1481
+ const ButtonSpinner = () => (jsx(Center, { inline: true, position: 'absolute', transform: 'translate(-50%, -50%)', top: '50%', insetStart: '50%', children: jsx(Spinner, { colorPalette: 'gray' }) }));
1482
+
1483
+ export { Button, IntegrationAppProvider, useAction, useActionInstance, useActionInstances, useActions, useAppDataSchema, useAppDataSchemaInstance, useAppDataSchemaInstances, useAppDataSchemas, useAppEventSubscription, useAppEventSubscriptions, useAppEventType, useAppEventTypes, useAppEvents, useConnection, useConnections, useConnectorSpec, useCustomer, useCustomers, useDataCollectionSpec, useDataLinkTable, useDataLinkTableInstance, useDataLinkTableInstances, useDataLinkTables, useDataSource, useDataSourceInstance, useDataSourceInstanceCollection, useDataSourceInstances, useDataSources, useExternalEventSubscription, useExternalEventSubscriptions, useFieldMapping, useFieldMappingInstance, useFieldMappingInstances, useFieldMappings, useFlow, useFlowInstance, useFlowInstances, useFlowRun, useFlowRuns, useFlows, useIntegration, useIntegrationApp, useIntegrationAppSWR, useIntegrationElement, useIntegrations, useScenario, useScenarios, useScreen };
743
1484
  //# sourceMappingURL=index.module.mjs.map