autumn-js 0.0.72 → 0.0.74

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.
Files changed (200) hide show
  1. package/components.json +2 -2
  2. package/dist/libraries/backend/better-auth.d.mts +8 -0
  3. package/dist/libraries/backend/better-auth.d.ts +8 -0
  4. package/dist/libraries/backend/better-auth.js +20061 -0
  5. package/dist/libraries/backend/better-auth.mjs +19201 -0
  6. package/dist/libraries/backend/{chunk-6DZX6EAA.mjs → chunk-XGB3TDIC.mjs} +5 -0
  7. package/dist/libraries/backend/constants.mjs +1 -1
  8. package/dist/libraries/backend/express.d.mts +1 -1
  9. package/dist/libraries/backend/express.d.ts +1 -1
  10. package/dist/libraries/backend/express.mjs +1 -1
  11. package/dist/libraries/backend/fastify.mjs +1 -1
  12. package/dist/libraries/backend/hono.mjs +1 -1
  13. package/dist/libraries/backend/next.mjs +1 -1
  14. package/dist/libraries/backend/react-router.mjs +1 -1
  15. package/dist/libraries/backend/{referralTypes-qdpA4XBw.d.ts → referralTypes-CSbCGBim.d.ts} +2 -0
  16. package/dist/libraries/backend/{referralTypes-C-jpvu6u.d.mts → referralTypes-DiYwS4QY.d.mts} +2 -0
  17. package/dist/libraries/backend/remix_dep.mjs +1 -1
  18. package/dist/libraries/backend/routes/backendRouter.mjs +1 -1
  19. package/dist/libraries/backend/routes/entityRoutes.mjs +1 -1
  20. package/dist/libraries/backend/routes/genRoutes.mjs +1 -1
  21. package/dist/libraries/backend/routes/productRoutes.mjs +1 -1
  22. package/dist/libraries/backend/routes/referralRoutes.mjs +1 -1
  23. package/dist/libraries/backend/supabase.mjs +1 -1
  24. package/dist/libraries/backend/tanstack.mjs +1 -1
  25. package/dist/libraries/backend/utils/backendRes.mjs +1 -1
  26. package/dist/libraries/backend/utils/logBackendErrors.mjs +1 -1
  27. package/dist/libraries/backend/utils/secretKeyCheck.mjs +1 -1
  28. package/dist/libraries/backend/utils/withAuth.d.mts +1 -1
  29. package/dist/libraries/backend/utils/withAuth.d.ts +1 -1
  30. package/dist/libraries/backend/utils/withAuth.mjs +1 -1
  31. package/dist/libraries/react/AutumnContext.d.mts +3 -3
  32. package/dist/libraries/react/AutumnContext.d.ts +3 -3
  33. package/dist/libraries/react/AutumnContext.js +11 -7
  34. package/dist/libraries/react/AutumnContext.mjs +7 -7
  35. package/dist/libraries/react/BaseAutumnProvider.d.mts +3 -3
  36. package/dist/libraries/react/BaseAutumnProvider.d.ts +3 -3
  37. package/dist/libraries/react/BaseAutumnProvider.js +5722 -179
  38. package/dist/libraries/react/BaseAutumnProvider.mjs +21 -12
  39. package/dist/libraries/react/{ReactAutumnClient-4e3t4WTF.d.mts → ReactAutumnClient-BT7tsOG0.d.mts} +2 -2
  40. package/dist/libraries/react/{ReactAutumnClient-B-lWmwRW.d.ts → ReactAutumnClient-DfDXFLBI.d.ts} +2 -2
  41. package/dist/libraries/react/ReactAutumnProvider.d.mts +2 -1
  42. package/dist/libraries/react/ReactAutumnProvider.d.ts +2 -1
  43. package/dist/libraries/react/ReactAutumnProvider.js +5729 -182
  44. package/dist/libraries/react/ReactAutumnProvider.mjs +21 -13
  45. package/dist/libraries/react/{checkTypes-BDNI_s2B.d.ts → checkTypes-ByzZ-KO2.d.ts} +2 -0
  46. package/dist/libraries/react/{checkTypes-CyKIOmeF.d.mts → checkTypes-h2Fyyuh0.d.mts} +2 -0
  47. package/dist/libraries/react/{chunk-4PX3AQKX.mjs → chunk-27OTS3Q5.mjs} +9 -9
  48. package/dist/libraries/react/{chunk-TBCLSIC2.mjs → chunk-3EYF7OI5.mjs} +1 -1
  49. package/dist/libraries/react/{chunk-4CGZZYLG.mjs → chunk-4J6OC4ZQ.mjs} +46 -1
  50. package/dist/libraries/react/chunk-5FZ7IV6P.mjs +2021 -0
  51. package/dist/libraries/react/{chunk-B7HGBQCO.mjs → chunk-6N2SUOJ6.mjs} +1 -1
  52. package/dist/libraries/react/{chunk-LS3NB4DU.mjs → chunk-77N4ARHR.mjs} +2 -2
  53. package/dist/libraries/react/chunk-CMO5LYYU.mjs +241 -0
  54. package/dist/libraries/react/{chunk-7PRD7RPD.mjs → chunk-D3H6GCJ4.mjs} +2 -2
  55. package/dist/libraries/react/chunk-FEFGYFXQ.mjs +134 -0
  56. package/dist/libraries/react/chunk-FPI3PLEL.mjs +218 -0
  57. package/dist/libraries/react/chunk-KQT5G3HT.mjs +27 -0
  58. package/dist/libraries/react/chunk-MF3MHICX.mjs +983 -0
  59. package/dist/libraries/react/{chunk-O4HHXBGR.mjs → chunk-P2O4LZFD.mjs} +30 -30
  60. package/dist/libraries/react/{chunk-Q7CK32YT.mjs → chunk-PFTFPWFN.mjs} +26 -8
  61. package/dist/libraries/react/{chunk-CE5BBB5H.mjs → chunk-TLRISML2.mjs} +10 -9
  62. package/dist/libraries/react/{chunk-4KKWHG2V.mjs → chunk-V5PKOA5A.mjs} +1 -1
  63. package/dist/libraries/react/client/ReactAutumnClient.d.mts +3 -3
  64. package/dist/libraries/react/client/ReactAutumnClient.d.ts +3 -3
  65. package/dist/libraries/react/client/ReactAutumnClient.js +11 -7
  66. package/dist/libraries/react/client/ReactAutumnClient.mjs +6 -6
  67. package/dist/libraries/react/client/clientCompMethods.d.mts +3 -3
  68. package/dist/libraries/react/client/clientCompMethods.d.ts +3 -3
  69. package/dist/libraries/react/client/clientCusMethods.d.mts +3 -3
  70. package/dist/libraries/react/client/clientCusMethods.d.ts +3 -3
  71. package/dist/libraries/react/client/clientEntityMethods.d.mts +3 -3
  72. package/dist/libraries/react/client/clientEntityMethods.d.ts +3 -3
  73. package/dist/libraries/react/client/clientEntityMethods.js +9 -6
  74. package/dist/libraries/react/client/clientEntityMethods.mjs +2 -2
  75. package/dist/libraries/react/client/clientGenMethods.d.mts +3 -3
  76. package/dist/libraries/react/client/clientGenMethods.d.ts +3 -3
  77. package/dist/libraries/react/client/clientGenMethods.js +10 -7
  78. package/dist/libraries/react/client/clientGenMethods.mjs +2 -2
  79. package/dist/libraries/react/client/clientProdMethods.d.mts +3 -3
  80. package/dist/libraries/react/client/clientProdMethods.d.ts +3 -3
  81. package/dist/libraries/react/client/clientReferralMethods.d.mts +3 -3
  82. package/dist/libraries/react/client/clientReferralMethods.d.ts +3 -3
  83. package/dist/libraries/react/client/clientReferralMethods.js +9 -6
  84. package/dist/libraries/react/client/clientReferralMethods.mjs +2 -2
  85. package/dist/libraries/react/client/types/clientGenTypes.d.mts +1 -0
  86. package/dist/libraries/react/client/types/clientGenTypes.d.ts +1 -0
  87. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.mts +1 -1
  88. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.ts +1 -1
  89. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.js +2594 -222
  90. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.mjs +18 -24
  91. package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.mts +1 -1
  92. package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.ts +1 -1
  93. package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.mts +1 -1
  94. package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.ts +1 -1
  95. package/dist/libraries/react/components/check-dialog/check-dialog-synced.js +2260 -127
  96. package/dist/libraries/react/components/check-dialog/check-dialog-synced.mjs +6 -4
  97. package/dist/libraries/react/components/check-dialog/lib/check-content.d.mts +1 -1
  98. package/dist/libraries/react/components/check-dialog/lib/check-content.d.ts +1 -1
  99. package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.mts +2 -2
  100. package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.ts +2 -2
  101. package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +3023 -664
  102. package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +18 -24
  103. package/dist/libraries/react/components/ui/button.d.mts +6 -6
  104. package/dist/libraries/react/components/ui/button.d.ts +6 -6
  105. package/dist/libraries/react/components/ui/button.js +206 -31
  106. package/dist/libraries/react/components/ui/button.mjs +3 -2
  107. package/dist/libraries/react/components/ui/dialog.d.mts +16 -12
  108. package/dist/libraries/react/components/ui/dialog.d.ts +16 -12
  109. package/dist/libraries/react/components/ui/dialog.js +2254 -148
  110. package/dist/libraries/react/components/ui/dialog.mjs +5 -2
  111. package/dist/libraries/react/components/ui/switch.d.mts +2 -3
  112. package/dist/libraries/react/components/ui/switch.d.ts +2 -3
  113. package/dist/libraries/react/components/ui/switch.js +575 -29
  114. package/dist/libraries/react/components/ui/switch.mjs +5 -2
  115. package/dist/libraries/react/hooks/useAutumn.d.mts +3 -3
  116. package/dist/libraries/react/hooks/useAutumn.d.ts +3 -3
  117. package/dist/libraries/react/hooks/useAutumn.js +5793 -134
  118. package/dist/libraries/react/hooks/useAutumn.mjs +22 -10
  119. package/dist/libraries/react/hooks/useAutumnBase.d.mts +3 -3
  120. package/dist/libraries/react/hooks/useAutumnBase.d.ts +3 -3
  121. package/dist/libraries/react/hooks/useAutumnBase.js +5789 -130
  122. package/dist/libraries/react/hooks/useAutumnBase.mjs +22 -9
  123. package/dist/libraries/react/hooks/useCustomer.d.mts +3 -3
  124. package/dist/libraries/react/hooks/useCustomer.d.ts +3 -3
  125. package/dist/libraries/react/hooks/useCustomer.js +5718 -174
  126. package/dist/libraries/react/hooks/useCustomer.mjs +21 -11
  127. package/dist/libraries/react/hooks/useCustomerBase.d.mts +3 -3
  128. package/dist/libraries/react/hooks/useCustomerBase.d.ts +3 -3
  129. package/dist/libraries/react/hooks/useCustomerBase.js +5726 -174
  130. package/dist/libraries/react/hooks/useCustomerBase.mjs +21 -10
  131. package/dist/libraries/react/hooks/useEntity.d.mts +8 -6
  132. package/dist/libraries/react/hooks/useEntity.d.ts +8 -6
  133. package/dist/libraries/react/hooks/useEntity.js +5986 -48
  134. package/dist/libraries/react/hooks/useEntity.mjs +21 -9
  135. package/dist/libraries/react/hooks/useEntityBase.d.mts +9 -11
  136. package/dist/libraries/react/hooks/useEntityBase.d.ts +9 -11
  137. package/dist/libraries/react/hooks/useEntityBase.js +6690 -37
  138. package/dist/libraries/react/hooks/useEntityBase.mjs +25 -1
  139. package/dist/libraries/react/hooks/usePricingTable.d.mts +1 -1
  140. package/dist/libraries/react/hooks/usePricingTable.d.ts +1 -1
  141. package/dist/libraries/react/hooks/usePricingTable.js +36 -14
  142. package/dist/libraries/react/hooks/usePricingTable.mjs +9 -9
  143. package/dist/libraries/react/hooks/usePricingTableBase.d.mts +3 -3
  144. package/dist/libraries/react/hooks/usePricingTableBase.d.ts +3 -3
  145. package/dist/libraries/react/hooks/usePricingTableBase.js +36 -14
  146. package/dist/libraries/react/hooks/usePricingTableBase.mjs +8 -8
  147. package/dist/libraries/react/hooks/useProductsBase.js +11 -7
  148. package/dist/libraries/react/hooks/useProductsBase.mjs +7 -7
  149. package/dist/libraries/react/index.d.ts +9 -7
  150. package/dist/libraries/react/index.js +3478 -1089
  151. package/dist/libraries/react/index.mjs +3476 -1087
  152. package/dist/libraries/react/lib/utils.js +46 -1
  153. package/dist/libraries/react/lib/utils.mjs +1 -1
  154. package/dist/libraries/react/{response-ChCmaLBk.d.mts → response-B37tbVeT.d.mts} +1 -1
  155. package/dist/libraries/react/{response-9K8DyGXf.d.ts → response-CREh0tw3.d.ts} +1 -1
  156. package/dist/libraries/react/utils/toSnakeCase.d.mts +1 -1
  157. package/dist/libraries/react/utils/toSnakeCase.d.ts +1 -1
  158. package/dist/libraries/react/utils/toSnakeCase.js +9 -6
  159. package/dist/libraries/react/utils/toSnakeCase.mjs +1 -1
  160. package/dist/next/client/NextAutumnClient.d.mts +2 -2
  161. package/dist/next/client/NextAutumnClient.d.ts +2 -2
  162. package/dist/next/client/{checkTypes-BHxu_xEV.d.ts → checkTypes-BVlLFoUT.d.ts} +2 -0
  163. package/dist/next/client/{checkTypes-CEaWu4S3.d.mts → checkTypes-CGZpuidI.d.mts} +2 -0
  164. package/dist/next/client/{clientGenTypes-i3cKamAv.d.ts → clientGenTypes-CXkGuJ6W.d.ts} +2 -1
  165. package/dist/next/client/{clientGenTypes-BRfigzSY.d.mts → clientGenTypes-Dh9BiE0s.d.mts} +2 -1
  166. package/dist/next/client/hooks/useAutumn.d.mts +3 -3
  167. package/dist/next/client/hooks/useAutumn.d.ts +3 -3
  168. package/dist/next/client/hooks/useCustomer.d.mts +2 -2
  169. package/dist/next/client/hooks/useCustomer.d.ts +2 -2
  170. package/dist/next/client/hooks/useEntity.d.mts +7 -7
  171. package/dist/next/client/hooks/useEntity.d.ts +7 -7
  172. package/dist/next/client/hooks/usePricingTable.d.mts +1 -1
  173. package/dist/next/client/hooks/usePricingTable.d.ts +1 -1
  174. package/dist/next/index.d.mts +7 -6
  175. package/dist/next/index.d.ts +7 -6
  176. package/dist/next/server/cusActions.d.mts +2 -0
  177. package/dist/next/server/cusActions.d.ts +2 -0
  178. package/dist/next/server/genActions.d.mts +1 -0
  179. package/dist/next/server/genActions.d.ts +1 -0
  180. package/dist/sdk/index.d.mts +2 -0
  181. package/dist/sdk/index.d.ts +2 -0
  182. package/dist/styles/global.css +1118 -1024
  183. package/package.json +11 -12
  184. package/scripts/sync-registry.ts +79 -191
  185. package/tailwind.config.ts +96 -0
  186. package/tsup.config.ts +3 -4
  187. package/tsup.dev.config.ts +2 -4
  188. package/dist/libraries/react/chunk-2XYYCR4J.mjs +0 -276
  189. package/dist/libraries/react/chunk-FHANCAHB.mjs +0 -17
  190. package/dist/libraries/react/chunk-GTF7A5TG.mjs +0 -76
  191. package/dist/libraries/react/chunk-NEV76K4V.mjs +0 -552
  192. package/dist/libraries/react/chunk-QMIIDFRP.mjs +0 -85
  193. package/dist/libraries/react/chunk-TFGQQAVB.mjs +0 -38
  194. package/dist/libraries/react/chunk-X3HJKZGO.mjs +0 -58
  195. package/dist/libraries/react/chunk-ZKHBOCMO.mjs +0 -17
  196. package/dist/libraries/react/chunk-ZNPQQ2WK.mjs +0 -24
  197. package/dist/libraries/react/chunk-ZQ6LDLK5.mjs +0 -149
  198. package/dist/libraries/react/chunk-ZWO4QYXI.mjs +0 -20
  199. package/dist/libraries/react/chunk-ZXE5MFKL.mjs +0 -45
  200. package/tailwind.config.js +0 -57
@@ -42,10 +42,10 @@ __export(pricing_table_synced_exports, {
42
42
  usePricingTableContext: () => usePricingTableContext
43
43
  });
44
44
  module.exports = __toCommonJS(pricing_table_synced_exports);
45
- var import_react9 = __toESM(require("react"));
45
+ var import_react11 = __toESM(require("react"));
46
46
 
47
47
  // src/libraries/react/BaseAutumnProvider.tsx
48
- var import_react3 = require("react");
48
+ var import_react7 = require("react");
49
49
 
50
50
  // src/libraries/react/hooks/useDialog.tsx
51
51
  var import_react = require("react");
@@ -543,15 +543,18 @@ var createCustomerMethod = async ({
543
543
  function stringToSnakeCase(str) {
544
544
  return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[-\s]+/g, "_").toLowerCase();
545
545
  }
546
- var toSnakeCase = (obj) => {
546
+ var toSnakeCase = (obj, excludeKeys) => {
547
547
  if (Array.isArray(obj)) {
548
- return obj.map(toSnakeCase);
548
+ return obj.map((item) => toSnakeCase(item, excludeKeys));
549
549
  } else if (obj !== null && typeof obj === "object") {
550
550
  return Object.fromEntries(
551
- Object.entries(obj).map(([key, value]) => [
552
- stringToSnakeCase(key),
553
- toSnakeCase(value)
554
- ])
551
+ Object.entries(obj).map(([key, value]) => {
552
+ const snakeKey = stringToSnakeCase(key);
553
+ if (excludeKeys && excludeKeys.includes(key)) {
554
+ return [snakeKey, value];
555
+ }
556
+ return [snakeKey, toSnakeCase(value, excludeKeys)];
557
+ })
555
558
  );
556
559
  }
557
560
  return obj;
@@ -585,7 +588,7 @@ async function deleteEntityMethod(entityId) {
585
588
  // src/libraries/react/client/clientGenMethods.ts
586
589
  async function attachMethod(params) {
587
590
  let { dialog, ...rest } = params;
588
- let snakeParams = toSnakeCase(rest);
591
+ let snakeParams = toSnakeCase(rest, ["checkoutSessionparams"]);
589
592
  const res = await this.post("/api/autumn/attach", snakeParams);
590
593
  return res;
591
594
  }
@@ -635,6 +638,7 @@ var AutumnClient = class {
635
638
  getBearerToken;
636
639
  customerData;
637
640
  includeCredentials;
641
+ // protected readonly pathPrefix?: string;
638
642
  constructor({
639
643
  backendUrl,
640
644
  getBearerToken,
@@ -785,7 +789,20 @@ var mergeProductDetails = (products, productDetails) => {
785
789
  return null;
786
790
  }
787
791
  if (!productDetails) {
788
- return products;
792
+ return products.map((product) => {
793
+ if (product.base_variant_id) {
794
+ let baseProduct = products.find(
795
+ (p) => p.id === product.base_variant_id
796
+ );
797
+ if (baseProduct) {
798
+ return {
799
+ ...product,
800
+ name: baseProduct.name
801
+ };
802
+ }
803
+ }
804
+ return product;
805
+ });
789
806
  }
790
807
  let fetchedProducts = structuredClone(products);
791
808
  let mergedProducts = [];
@@ -812,8 +829,8 @@ var mergeProductDetails = (products, productDetails) => {
812
829
  ];
813
830
  }
814
831
  mergedProducts.push({
815
- name: overrideDetails.name || "",
816
832
  display: {
833
+ name: overrideDetails.name,
817
834
  description: overrideDetails.description,
818
835
  button_text: overrideDetails.buttonText,
819
836
  recommend_text: overrideDetails.recommendText,
@@ -831,6 +848,15 @@ var mergeProductDetails = (products, productDetails) => {
831
848
  if (!fetchedProduct) {
832
849
  continue;
833
850
  }
851
+ let displayName = fetchedProduct.name;
852
+ let baseVariantId = fetchedProduct.base_variant_id;
853
+ if (baseVariantId) {
854
+ let baseProduct = fetchedProducts.find((p) => p.id === baseVariantId);
855
+ if (baseProduct) {
856
+ displayName = baseProduct.name;
857
+ }
858
+ }
859
+ displayName = overrideDetails.name || displayName;
834
860
  const originalIsFree = fetchedProduct.properties?.is_free;
835
861
  let overrideProperties = fetchedProduct.properties || {};
836
862
  let overrideItems = overrideDetails.items;
@@ -889,20 +915,16 @@ var mergeProductDetails = (products, productDetails) => {
889
915
  }
890
916
  const mergedProduct = {
891
917
  ...fetchedProduct,
892
- name: overrideDetails.name || fetchedProduct.name,
893
918
  items: mergedItems,
894
919
  properties: overrideProperties,
895
920
  display: {
921
+ name: displayName,
896
922
  description: overrideDetails.description,
897
923
  button_text: overrideDetails.buttonText,
898
924
  recommend_text: overrideDetails.recommendText,
899
925
  everything_from: overrideDetails.everythingFrom,
900
926
  button_url: overrideDetails.buttonUrl
901
927
  }
902
- // description: overrideDetails.description,
903
- // button_text: overrideDetails.buttonText,
904
- // recommend_text: overrideDetails.recommendText,
905
- // everything_from: overrideDetails.everythingFrom,
906
928
  };
907
929
  mergedProducts.push(mergedProduct);
908
930
  }
@@ -938,344 +960,77 @@ var usePricingTableBase = ({
938
960
  };
939
961
  };
940
962
 
941
- // src/libraries/react/hooks/useAutumnBase.tsx
942
- var useAutumnBase = ({
943
- AutumnContext: AutumnContext2
944
- }) => {
945
- const context = useAutumnContext({ AutumnContext: AutumnContext2, name: "useAutumn" });
946
- const { attachDialog, paywallDialog } = context;
947
- const client = context.client;
948
- const { refetch: refetchPricingTable } = usePricingTableBase({
949
- AutumnContext: AutumnContext2
950
- });
951
- let {
952
- open: attachOpen,
953
- setProps: setAttachProps,
954
- setOpen: setAttachOpen,
955
- setComponent: setAttachComponent
956
- } = attachDialog;
957
- let {
958
- setProps: setCheckProps,
959
- setOpen: setCheckOpen,
960
- setComponent: setPaywallComponent
961
- } = paywallDialog;
962
- const attachWithoutDialog = async (params) => {
963
- const result = await client.attach(params);
964
- if (result.error) {
965
- return result;
966
- }
967
- let data = result.data;
968
- if (data?.checkout_url && typeof window !== "undefined") {
969
- if (params.openInNewTab) {
970
- window.open(data.checkout_url, "_blank");
971
- } else {
972
- window.location.href = data.checkout_url;
973
- }
974
- }
975
- await refetchPricingTable();
976
- if (setAttachOpen) {
977
- setAttachOpen(false);
978
- }
979
- return result;
980
- };
981
- const attachWithDialog = async (params) => {
982
- let { dialog, ...rest } = params;
983
- const { productId, entityId, entityData } = params;
984
- const checkRes = await client.check({
985
- productId,
986
- entityId,
987
- entityData,
988
- withPreview: true
989
- });
990
- if (checkRes.error) {
991
- return checkRes;
992
- }
993
- let preview = checkRes.data.preview;
994
- if (!preview) {
995
- return await attachWithoutDialog(rest);
996
- } else {
997
- setAttachProps({ preview });
998
- setAttachOpen(true);
999
- }
1000
- return checkRes;
1001
- };
1002
- const attach = async (params) => {
1003
- const { dialog, openInNewTab } = params;
1004
- let finalDialog = dialog;
1005
- if (finalDialog && !attachOpen) {
1006
- setAttachComponent(finalDialog);
1007
- return await attachWithDialog(params);
1008
- }
1009
- return await attachWithoutDialog(params);
1010
- };
1011
- const cancel = async (params) => {
1012
- const res = await client.cancel(params);
1013
- if (res.error) {
1014
- return res;
1015
- }
1016
- return res;
1017
- };
1018
- const check = async (params) => {
1019
- let { dialog, withPreview } = params;
1020
- if (dialog) {
1021
- setPaywallComponent(dialog);
1022
- }
1023
- const res = await client.check({
1024
- ...params,
1025
- withPreview: withPreview || dialog ? true : false
1026
- });
1027
- if (res.error) {
1028
- return res;
1029
- }
1030
- let data = res.data;
1031
- if (data && data.preview && dialog) {
1032
- let preview = data.preview;
1033
- setCheckProps({ preview });
1034
- setCheckOpen(true);
1035
- }
1036
- return res;
1037
- };
1038
- const track = async (params) => {
1039
- const res = await client.track(params);
1040
- if (res.error) {
1041
- return res;
963
+ // src/libraries/react/components/attach-dialog/attach-dialog-synced.tsx
964
+ var import_react6 = require("react");
965
+
966
+ // ../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
967
+ function r(e) {
968
+ var t, f, n = "";
969
+ if ("string" == typeof e || "number" == typeof e) n += e;
970
+ else if ("object" == typeof e) if (Array.isArray(e)) {
971
+ var o = e.length;
972
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
973
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
974
+ return n;
975
+ }
976
+ function clsx() {
977
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
978
+ return n;
979
+ }
980
+
981
+ // ../node_modules/.pnpm/tailwind-merge@2.6.0/node_modules/tailwind-merge/dist/bundle-mjs.mjs
982
+ var CLASS_PART_SEPARATOR = "-";
983
+ var createClassGroupUtils = (config) => {
984
+ const classMap = createClassMap(config);
985
+ const {
986
+ conflictingClassGroups,
987
+ conflictingClassGroupModifiers
988
+ } = config;
989
+ const getClassGroupId = (className) => {
990
+ const classParts = className.split(CLASS_PART_SEPARATOR);
991
+ if (classParts[0] === "" && classParts.length !== 1) {
992
+ classParts.shift();
1042
993
  }
1043
- return res;
994
+ return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
1044
995
  };
1045
- const openBillingPortal = async (params) => {
1046
- let defaultParams = {
1047
- openInNewTab: false
1048
- };
1049
- let finalParams = {
1050
- ...defaultParams,
1051
- ...params
1052
- };
1053
- const res = await client.openBillingPortal(finalParams);
1054
- if (res.error) {
1055
- return res;
1056
- }
1057
- let data = res.data;
1058
- if (data?.url && typeof window !== "undefined") {
1059
- if (finalParams.openInNewTab) {
1060
- window.open(data.url, "_blank");
1061
- } else {
1062
- window.open(data.url, "_self");
1063
- }
1064
- return res;
1065
- } else {
1066
- return res;
996
+ const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
997
+ const conflicts = conflictingClassGroups[classGroupId] || [];
998
+ if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
999
+ return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
1067
1000
  }
1001
+ return conflicts;
1068
1002
  };
1069
1003
  return {
1070
- attach,
1071
- check,
1072
- track,
1073
- cancel,
1074
- openBillingPortal
1075
- };
1076
- };
1077
-
1078
- // src/libraries/react/hooks/handleAllowed.ts
1079
- var getCusFeature = ({
1080
- customer,
1081
- featureId,
1082
- requiredBalance = 1
1083
- }) => {
1084
- let creditSchema = Object.values(customer.features).find((f) => f.credit_schema && f.credit_schema.some((c) => c.feature_id === featureId));
1085
- if (creditSchema) {
1086
- let schemaItem = creditSchema.credit_schema?.find((c) => c.feature_id === featureId);
1087
- return {
1088
- feature: creditSchema,
1089
- requiredBalance: schemaItem.credit_amount * requiredBalance
1090
- };
1091
- }
1092
- return {
1093
- cusFeature: customer.features[featureId],
1094
- requiredBalance
1004
+ getClassGroupId,
1005
+ getConflictingClassGroupIds
1095
1006
  };
1096
1007
  };
1097
- var handleFeatureAllowed = ({ customer, params }) => {
1098
- let { cusFeature, requiredBalance } = getCusFeature({ customer, featureId: params.featureId });
1099
- if (!cusFeature) return false;
1100
- if (cusFeature.type == "static") return true;
1101
- if (cusFeature.unlimited || cusFeature.overage_allowed) return true;
1102
- return (cusFeature.balance || 0) >= requiredBalance;
1103
- };
1104
- var handleAllowed = ({ customer, params }) => {
1105
- if (!customer) return false;
1106
- if (!params.featureId && !params.productId) {
1107
- throw new Error("allowed() requires either featureId or productId");
1008
+ var getGroupRecursive = (classParts, classPartObject) => {
1009
+ if (classParts.length === 0) {
1010
+ return classPartObject.classGroupId;
1108
1011
  }
1109
- if (params.featureId) {
1110
- return handleFeatureAllowed({ customer, params });
1012
+ const currentClassPart = classParts[0];
1013
+ const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
1014
+ const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : void 0;
1015
+ if (classGroupFromNextClassPart) {
1016
+ return classGroupFromNextClassPart;
1111
1017
  }
1112
- if (params.productId) {
1113
- let product = customer.products.find((p) => p.id == params.productId);
1114
- if (!product) return false;
1115
- let status = product.status;
1116
- if (status == "scheduled") return false;
1117
- return true;
1018
+ if (classPartObject.validators.length === 0) {
1019
+ return void 0;
1118
1020
  }
1119
- return false;
1120
- };
1121
-
1122
- // src/libraries/react/hooks/useCustomerBase.tsx
1123
- var emptyDefaultFunctions = {
1124
- attach: "",
1125
- check: "",
1126
- track: "",
1127
- cancel: "",
1128
- openBillingPortal: ""
1021
+ const classRest = classParts.join(CLASS_PART_SEPARATOR);
1022
+ return classPartObject.validators.find(({
1023
+ validator
1024
+ }) => validator(classRest))?.classGroupId;
1129
1025
  };
1130
- var useCustomerBase = ({
1131
- params,
1132
- AutumnContext: AutumnContext2,
1133
- client
1134
- }) => {
1135
- const queryKey = ["customer"];
1136
- let context;
1137
- if (AutumnContext2) {
1138
- context = useAutumnContext({ AutumnContext: AutumnContext2, name: "useCustomer" });
1139
- }
1140
- if (!client) {
1141
- client = context.client;
1142
- }
1143
- const fetchCustomer = async () => {
1144
- const { data, error: error2 } = await client.createCustomer({
1145
- errorOnNotFound: params?.errorOnNotFound,
1146
- expand: params?.expand
1147
- });
1148
- if (error2) {
1149
- throw error2;
1150
- }
1151
- if (!data) {
1152
- return null;
1153
- }
1154
- return data;
1155
- };
1156
- const { data: customer, error, isLoading, mutate } = (0, import_swr2.default)(queryKey, fetchCustomer, {
1157
- fallbackData: null,
1158
- onErrorRetry: (error2, key, config) => {
1159
- if (error2.code == "entity_not_found") {
1160
- return false;
1161
- }
1162
- return true;
1163
- }
1164
- });
1165
- let autumnFunctions = emptyDefaultFunctions;
1166
- if (AutumnContext2) {
1167
- autumnFunctions = useAutumnBase({ AutumnContext: AutumnContext2 });
1168
- }
1169
- return {
1170
- customer: error ? null : customer,
1171
- isLoading,
1172
- error,
1173
- refetch: mutate,
1174
- ...autumnFunctions,
1175
- createEntity: client.entities.create,
1176
- createReferralCode: client.referrals.createCode,
1177
- redeemReferralCode: client.referrals.redeemCode,
1178
- allowed: (params2) => handleAllowed({ customer, params: params2 })
1179
- };
1180
- };
1181
-
1182
- // src/libraries/react/BaseAutumnProvider.tsx
1183
- var import_jsx_runtime = require("react/jsx-runtime");
1184
-
1185
- // src/libraries/react/ReactAutumnProvider.tsx
1186
- var import_jsx_runtime2 = require("react/jsx-runtime");
1187
-
1188
- // src/libraries/react/hooks/useCustomer.tsx
1189
- var useCustomer = (params) => {
1190
- return useCustomerBase({
1191
- params,
1192
- AutumnContext
1193
- });
1194
- };
1195
-
1196
- // src/libraries/react/hooks/usePricingTable.tsx
1197
- var usePricingTable = (params) => {
1198
- return usePricingTableBase({
1199
- AutumnContext,
1200
- params
1201
- });
1202
- };
1203
-
1204
- // src/libraries/react/hooks/useEntityBase.tsx
1205
- var import_swr3 = __toESM(require("swr"));
1206
- var import_react4 = require("react");
1207
-
1208
- // src/libraries/react/components/attach-dialog/attach-dialog-synced.tsx
1209
- var import_react7 = require("react");
1210
-
1211
- // ../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
1212
- function r(e) {
1213
- var t, f, n = "";
1214
- if ("string" == typeof e || "number" == typeof e) n += e;
1215
- else if ("object" == typeof e) if (Array.isArray(e)) {
1216
- var o = e.length;
1217
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
1218
- } else for (f in e) e[f] && (n && (n += " "), n += f);
1219
- return n;
1220
- }
1221
- function clsx() {
1222
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
1223
- return n;
1224
- }
1225
-
1226
- // ../node_modules/.pnpm/tailwind-merge@2.6.0/node_modules/tailwind-merge/dist/bundle-mjs.mjs
1227
- var CLASS_PART_SEPARATOR = "-";
1228
- var createClassGroupUtils = (config) => {
1229
- const classMap = createClassMap(config);
1230
- const {
1231
- conflictingClassGroups,
1232
- conflictingClassGroupModifiers
1233
- } = config;
1234
- const getClassGroupId = (className) => {
1235
- const classParts = className.split(CLASS_PART_SEPARATOR);
1236
- if (classParts[0] === "" && classParts.length !== 1) {
1237
- classParts.shift();
1238
- }
1239
- return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
1240
- };
1241
- const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
1242
- const conflicts = conflictingClassGroups[classGroupId] || [];
1243
- if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
1244
- return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
1245
- }
1246
- return conflicts;
1247
- };
1248
- return {
1249
- getClassGroupId,
1250
- getConflictingClassGroupIds
1251
- };
1252
- };
1253
- var getGroupRecursive = (classParts, classPartObject) => {
1254
- if (classParts.length === 0) {
1255
- return classPartObject.classGroupId;
1256
- }
1257
- const currentClassPart = classParts[0];
1258
- const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
1259
- const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : void 0;
1260
- if (classGroupFromNextClassPart) {
1261
- return classGroupFromNextClassPart;
1262
- }
1263
- if (classPartObject.validators.length === 0) {
1264
- return void 0;
1265
- }
1266
- const classRest = classParts.join(CLASS_PART_SEPARATOR);
1267
- return classPartObject.validators.find(({
1268
- validator
1269
- }) => validator(classRest))?.classGroupId;
1270
- };
1271
- var arbitraryPropertyRegex = /^\[(.+)\]$/;
1272
- var getGroupIdForArbitraryProperty = (className) => {
1273
- if (arbitraryPropertyRegex.test(className)) {
1274
- const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
1275
- const property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(":"));
1276
- if (property) {
1277
- return "arbitrary.." + property;
1278
- }
1026
+ var arbitraryPropertyRegex = /^\[(.+)\]$/;
1027
+ var getGroupIdForArbitraryProperty = (className) => {
1028
+ if (arbitraryPropertyRegex.test(className)) {
1029
+ const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
1030
+ const property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(":"));
1031
+ if (property) {
1032
+ return "arbitrary.." + property;
1033
+ }
1279
1034
  }
1280
1035
  };
1281
1036
  var createClassMap = (config) => {
@@ -3681,15 +3436,186 @@ var getDefaultConfig = () => {
3681
3436
  }
3682
3437
  };
3683
3438
  };
3684
- var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
3439
+ var mergeConfigs = (baseConfig, {
3440
+ cacheSize,
3441
+ prefix,
3442
+ separator,
3443
+ experimentalParseClassName,
3444
+ extend = {},
3445
+ override = {}
3446
+ }) => {
3447
+ overrideProperty(baseConfig, "cacheSize", cacheSize);
3448
+ overrideProperty(baseConfig, "prefix", prefix);
3449
+ overrideProperty(baseConfig, "separator", separator);
3450
+ overrideProperty(baseConfig, "experimentalParseClassName", experimentalParseClassName);
3451
+ for (const configKey in override) {
3452
+ overrideConfigProperties(baseConfig[configKey], override[configKey]);
3453
+ }
3454
+ for (const key in extend) {
3455
+ mergeConfigProperties(baseConfig[key], extend[key]);
3456
+ }
3457
+ return baseConfig;
3458
+ };
3459
+ var overrideProperty = (baseObject, overrideKey, overrideValue) => {
3460
+ if (overrideValue !== void 0) {
3461
+ baseObject[overrideKey] = overrideValue;
3462
+ }
3463
+ };
3464
+ var overrideConfigProperties = (baseObject, overrideObject) => {
3465
+ if (overrideObject) {
3466
+ for (const key in overrideObject) {
3467
+ overrideProperty(baseObject, key, overrideObject[key]);
3468
+ }
3469
+ }
3470
+ };
3471
+ var mergeConfigProperties = (baseObject, mergeObject) => {
3472
+ if (mergeObject) {
3473
+ for (const key in mergeObject) {
3474
+ const mergeValue = mergeObject[key];
3475
+ if (mergeValue !== void 0) {
3476
+ baseObject[key] = (baseObject[key] || []).concat(mergeValue);
3477
+ }
3478
+ }
3479
+ }
3480
+ };
3481
+ var extendTailwindMerge = (configExtension, ...createConfig) => typeof configExtension === "function" ? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig) : createTailwindMerge(() => mergeConfigs(getDefaultConfig(), configExtension), ...createConfig);
3685
3482
 
3686
3483
  // src/libraries/react/lib/utils.ts
3484
+ var twMerge = extendTailwindMerge({
3485
+ prefix: "au-"
3486
+ });
3687
3487
  function cn(...inputs) {
3688
3488
  return twMerge(clsx(inputs));
3689
3489
  }
3690
3490
 
3691
3491
  // src/libraries/react/components/ui/button.tsx
3692
- var import_react_slot = require("@radix-ui/react-slot");
3492
+ var React3 = __toESM(require("react"));
3493
+
3494
+ // ../node_modules/.pnpm/@radix-ui+react-slot@1.2.3_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-slot/dist/index.mjs
3495
+ var React2 = __toESM(require("react"), 1);
3496
+
3497
+ // ../node_modules/.pnpm/@radix-ui+react-compose-refs@1.1.2_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-compose-refs/dist/index.mjs
3498
+ var React = __toESM(require("react"), 1);
3499
+ function setRef(ref, value) {
3500
+ if (typeof ref === "function") {
3501
+ return ref(value);
3502
+ } else if (ref !== null && ref !== void 0) {
3503
+ ref.current = value;
3504
+ }
3505
+ }
3506
+ function composeRefs(...refs) {
3507
+ return (node) => {
3508
+ let hasCleanup = false;
3509
+ const cleanups = refs.map((ref) => {
3510
+ const cleanup = setRef(ref, node);
3511
+ if (!hasCleanup && typeof cleanup == "function") {
3512
+ hasCleanup = true;
3513
+ }
3514
+ return cleanup;
3515
+ });
3516
+ if (hasCleanup) {
3517
+ return () => {
3518
+ for (let i = 0; i < cleanups.length; i++) {
3519
+ const cleanup = cleanups[i];
3520
+ if (typeof cleanup == "function") {
3521
+ cleanup();
3522
+ } else {
3523
+ setRef(refs[i], null);
3524
+ }
3525
+ }
3526
+ };
3527
+ }
3528
+ };
3529
+ }
3530
+ function useComposedRefs(...refs) {
3531
+ return React.useCallback(composeRefs(...refs), refs);
3532
+ }
3533
+
3534
+ // ../node_modules/.pnpm/@radix-ui+react-slot@1.2.3_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-slot/dist/index.mjs
3535
+ var import_jsx_runtime = require("react/jsx-runtime");
3536
+ // @__NO_SIDE_EFFECTS__
3537
+ function createSlot(ownerName) {
3538
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
3539
+ const Slot22 = React2.forwardRef((props, forwardedRef) => {
3540
+ const { children, ...slotProps } = props;
3541
+ const childrenArray = React2.Children.toArray(children);
3542
+ const slottable = childrenArray.find(isSlottable);
3543
+ if (slottable) {
3544
+ const newElement = slottable.props.children;
3545
+ const newChildren = childrenArray.map((child) => {
3546
+ if (child === slottable) {
3547
+ if (React2.Children.count(newElement) > 1) return React2.Children.only(null);
3548
+ return React2.isValidElement(newElement) ? newElement.props.children : null;
3549
+ } else {
3550
+ return child;
3551
+ }
3552
+ });
3553
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React2.isValidElement(newElement) ? React2.cloneElement(newElement, void 0, newChildren) : null });
3554
+ }
3555
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children });
3556
+ });
3557
+ Slot22.displayName = `${ownerName}.Slot`;
3558
+ return Slot22;
3559
+ }
3560
+ var Slot = /* @__PURE__ */ createSlot("Slot");
3561
+ // @__NO_SIDE_EFFECTS__
3562
+ function createSlotClone(ownerName) {
3563
+ const SlotClone = React2.forwardRef((props, forwardedRef) => {
3564
+ const { children, ...slotProps } = props;
3565
+ if (React2.isValidElement(children)) {
3566
+ const childrenRef = getElementRef(children);
3567
+ const props2 = mergeProps(slotProps, children.props);
3568
+ if (children.type !== React2.Fragment) {
3569
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
3570
+ }
3571
+ return React2.cloneElement(children, props2);
3572
+ }
3573
+ return React2.Children.count(children) > 1 ? React2.Children.only(null) : null;
3574
+ });
3575
+ SlotClone.displayName = `${ownerName}.SlotClone`;
3576
+ return SlotClone;
3577
+ }
3578
+ var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
3579
+ function isSlottable(child) {
3580
+ return React2.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
3581
+ }
3582
+ function mergeProps(slotProps, childProps) {
3583
+ const overrideProps = { ...childProps };
3584
+ for (const propName in childProps) {
3585
+ const slotPropValue = slotProps[propName];
3586
+ const childPropValue = childProps[propName];
3587
+ const isHandler = /^on[A-Z]/.test(propName);
3588
+ if (isHandler) {
3589
+ if (slotPropValue && childPropValue) {
3590
+ overrideProps[propName] = (...args) => {
3591
+ const result = childPropValue(...args);
3592
+ slotPropValue(...args);
3593
+ return result;
3594
+ };
3595
+ } else if (slotPropValue) {
3596
+ overrideProps[propName] = slotPropValue;
3597
+ }
3598
+ } else if (propName === "style") {
3599
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
3600
+ } else if (propName === "className") {
3601
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
3602
+ }
3603
+ }
3604
+ return { ...slotProps, ...overrideProps };
3605
+ }
3606
+ function getElementRef(element) {
3607
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
3608
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
3609
+ if (mayWarn) {
3610
+ return element.ref;
3611
+ }
3612
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
3613
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
3614
+ if (mayWarn) {
3615
+ return element.props.ref;
3616
+ }
3617
+ return element.props.ref || element.ref;
3618
+ }
3693
3619
 
3694
3620
  // ../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs
3695
3621
  var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
@@ -3734,24 +3660,24 @@ var cva = (base, config) => (props) => {
3734
3660
  };
3735
3661
 
3736
3662
  // src/libraries/react/components/ui/button.tsx
3737
- var import_jsx_runtime3 = require("react/jsx-runtime");
3663
+ var import_jsx_runtime2 = require("react/jsx-runtime");
3738
3664
  var buttonVariants = cva(
3739
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
3665
+ "au-inline-flex au-items-center au-justify-center au-gap-2 au-whitespace-nowrap au-rounded-md au-text-sm au-font-medium au-transition-colors focus-visible:au-outline-none focus-visible:au-ring-1 focus-visible:au-ring-ring disabled:au-pointer-events-none disabled:au-opacity-50 [&_svg]:au-pointer-events-none [&_svg]:au-size-4 [&_svg]:au-shrink-0",
3740
3666
  {
3741
3667
  variants: {
3742
3668
  variant: {
3743
- default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
3744
- secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/90",
3745
- destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
3746
- outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
3747
- ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
3748
- link: "text-primary underline-offset-4 hover:underline"
3669
+ default: "au-bg-primary au-text-primary-foreground au-shadow hover:au-bg-primary/90",
3670
+ destructive: "au-bg-destructive au-text-destructive-foreground au-shadow-sm hover:au-bg-destructive/90",
3671
+ outline: "au-border au-border-input au-bg-background au-shadow-sm hover:au-bg-accent hover:au-text-accent-foreground",
3672
+ secondary: "au-bg-secondary au-text-secondary-foreground au-shadow-sm hover:au-bg-secondary/80",
3673
+ ghost: "hover:au-bg-accent hover:au-text-accent-foreground",
3674
+ link: "au-text-primary au-underline-offset-4 hover:au-underline"
3749
3675
  },
3750
3676
  size: {
3751
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
3752
- sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
3753
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
3754
- icon: "size-9"
3677
+ default: "au-h-9 au-px-4 au-py-2",
3678
+ sm: "au-h-8 au-rounded-md au-px-3 au-text-xs",
3679
+ lg: "au-h-10 au-rounded-md au-px-8",
3680
+ icon: "au-h-9 au-w-9"
3755
3681
  }
3756
3682
  },
3757
3683
  defaultVariants: {
@@ -3760,26 +3686,23 @@ var buttonVariants = cva(
3760
3686
  }
3761
3687
  }
3762
3688
  );
3763
- function Button({
3764
- className,
3765
- variant,
3766
- size,
3767
- asChild = false,
3768
- ...props
3769
- }) {
3770
- const Comp = asChild ? import_react_slot.Slot : "button";
3771
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3772
- Comp,
3773
- {
3774
- "data-slot": "button",
3775
- className: cn(buttonVariants({ variant, size, className })),
3776
- ...props
3777
- }
3778
- );
3779
- }
3689
+ var Button = React3.forwardRef(
3690
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
3691
+ const Comp = asChild ? Slot : "button";
3692
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3693
+ Comp,
3694
+ {
3695
+ className: cn(buttonVariants({ variant, size }), className),
3696
+ ref,
3697
+ ...props
3698
+ }
3699
+ );
3700
+ }
3701
+ );
3702
+ Button.displayName = "Button";
3780
3703
 
3781
3704
  // ../node_modules/.pnpm/lucide-react@0.523.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
3782
- var import_react6 = require("react");
3705
+ var import_react4 = require("react");
3783
3706
 
3784
3707
  // ../node_modules/.pnpm/lucide-react@0.523.0_react@18.3.1/node_modules/lucide-react/dist/esm/shared/src/utils.js
3785
3708
  var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
@@ -3803,7 +3726,7 @@ var hasA11yProp = (props) => {
3803
3726
  };
3804
3727
 
3805
3728
  // ../node_modules/.pnpm/lucide-react@0.523.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
3806
- var import_react5 = require("react");
3729
+ var import_react3 = require("react");
3807
3730
 
3808
3731
  // ../node_modules/.pnpm/lucide-react@0.523.0_react@18.3.1/node_modules/lucide-react/dist/esm/defaultAttributes.js
3809
3732
  var defaultAttributes = {
@@ -3819,7 +3742,7 @@ var defaultAttributes = {
3819
3742
  };
3820
3743
 
3821
3744
  // ../node_modules/.pnpm/lucide-react@0.523.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js
3822
- var Icon = (0, import_react5.forwardRef)(
3745
+ var Icon = (0, import_react3.forwardRef)(
3823
3746
  ({
3824
3747
  color = "currentColor",
3825
3748
  size = 24,
@@ -3829,7 +3752,7 @@ var Icon = (0, import_react5.forwardRef)(
3829
3752
  children,
3830
3753
  iconNode,
3831
3754
  ...rest
3832
- }, ref) => (0, import_react5.createElement)(
3755
+ }, ref) => (0, import_react3.createElement)(
3833
3756
  "svg",
3834
3757
  {
3835
3758
  ref,
@@ -3843,7 +3766,7 @@ var Icon = (0, import_react5.forwardRef)(
3843
3766
  ...rest
3844
3767
  },
3845
3768
  [
3846
- ...iconNode.map(([tag, attrs]) => (0, import_react5.createElement)(tag, attrs)),
3769
+ ...iconNode.map(([tag, attrs]) => (0, import_react3.createElement)(tag, attrs)),
3847
3770
  ...Array.isArray(children) ? children : [children]
3848
3771
  ]
3849
3772
  )
@@ -3851,8 +3774,8 @@ var Icon = (0, import_react5.forwardRef)(
3851
3774
 
3852
3775
  // ../node_modules/.pnpm/lucide-react@0.523.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
3853
3776
  var createLucideIcon = (iconName, iconNode) => {
3854
- const Component = (0, import_react6.forwardRef)(
3855
- ({ className, ...props }, ref) => (0, import_react6.createElement)(Icon, {
3777
+ const Component = (0, import_react4.forwardRef)(
3778
+ ({ className, ...props }, ref) => (0, import_react4.createElement)(Icon, {
3856
3779
  ref,
3857
3780
  iconNode,
3858
3781
  className: mergeClasses(
@@ -3883,98 +3806,2065 @@ var __iconNode3 = [
3883
3806
  var X = createLucideIcon("x", __iconNode3);
3884
3807
 
3885
3808
  // src/libraries/react/components/ui/dialog.tsx
3886
- var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
3887
- var import_jsx_runtime4 = require("react/jsx-runtime");
3888
- function Dialog({
3889
- ...props
3890
- }) {
3891
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
3809
+ var React26 = __toESM(require("react"));
3810
+
3811
+ // ../node_modules/.pnpm/@radix-ui+react-dialog@1.1.14_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@18.3_osy3texbcyy7oe3sqigksqvg74/node_modules/@radix-ui/react-dialog/dist/index.mjs
3812
+ var React25 = __toESM(require("react"), 1);
3813
+
3814
+ // ../node_modules/.pnpm/@radix-ui+primitive@1.1.2/node_modules/@radix-ui/primitive/dist/index.mjs
3815
+ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
3816
+ return function handleEvent2(event) {
3817
+ originalEventHandler?.(event);
3818
+ if (checkForDefaultPrevented === false || !event.defaultPrevented) {
3819
+ return ourEventHandler?.(event);
3820
+ }
3821
+ };
3892
3822
  }
3893
- function DialogPortal({
3894
- ...props
3895
- }) {
3896
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
3823
+
3824
+ // ../node_modules/.pnpm/@radix-ui+react-context@1.1.2_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-context/dist/index.mjs
3825
+ var React4 = __toESM(require("react"), 1);
3826
+ var import_jsx_runtime3 = require("react/jsx-runtime");
3827
+ function createContext22(rootComponentName, defaultContext) {
3828
+ const Context = React4.createContext(defaultContext);
3829
+ const Provider = (props) => {
3830
+ const { children, ...context } = props;
3831
+ const value = React4.useMemo(() => context, Object.values(context));
3832
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Context.Provider, { value, children });
3833
+ };
3834
+ Provider.displayName = rootComponentName + "Provider";
3835
+ function useContext22(consumerName) {
3836
+ const context = React4.useContext(Context);
3837
+ if (context) return context;
3838
+ if (defaultContext !== void 0) return defaultContext;
3839
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
3840
+ }
3841
+ return [Provider, useContext22];
3897
3842
  }
3898
- function DialogOverlay({
3899
- className,
3900
- ...props
3901
- }) {
3902
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3903
- DialogPrimitive.Overlay,
3904
- {
3905
- "data-slot": "dialog-overlay",
3906
- className: cn(
3907
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
3908
- className
3909
- ),
3910
- ...props
3843
+ function createContextScope(scopeName, createContextScopeDeps = []) {
3844
+ let defaultContexts = [];
3845
+ function createContext32(rootComponentName, defaultContext) {
3846
+ const BaseContext = React4.createContext(defaultContext);
3847
+ const index = defaultContexts.length;
3848
+ defaultContexts = [...defaultContexts, defaultContext];
3849
+ const Provider = (props) => {
3850
+ const { scope, children, ...context } = props;
3851
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
3852
+ const value = React4.useMemo(() => context, Object.values(context));
3853
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Context.Provider, { value, children });
3854
+ };
3855
+ Provider.displayName = rootComponentName + "Provider";
3856
+ function useContext22(consumerName, scope) {
3857
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
3858
+ const context = React4.useContext(Context);
3859
+ if (context) return context;
3860
+ if (defaultContext !== void 0) return defaultContext;
3861
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
3911
3862
  }
3863
+ return [Provider, useContext22];
3864
+ }
3865
+ const createScope = () => {
3866
+ const scopeContexts = defaultContexts.map((defaultContext) => {
3867
+ return React4.createContext(defaultContext);
3868
+ });
3869
+ return function useScope(scope) {
3870
+ const contexts = scope?.[scopeName] || scopeContexts;
3871
+ return React4.useMemo(
3872
+ () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
3873
+ [scope, contexts]
3874
+ );
3875
+ };
3876
+ };
3877
+ createScope.scopeName = scopeName;
3878
+ return [createContext32, composeContextScopes(createScope, ...createContextScopeDeps)];
3879
+ }
3880
+ function composeContextScopes(...scopes) {
3881
+ const baseScope = scopes[0];
3882
+ if (scopes.length === 1) return baseScope;
3883
+ const createScope = () => {
3884
+ const scopeHooks = scopes.map((createScope2) => ({
3885
+ useScope: createScope2(),
3886
+ scopeName: createScope2.scopeName
3887
+ }));
3888
+ return function useComposedScopes(overrideScopes) {
3889
+ const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
3890
+ const scopeProps = useScope(overrideScopes);
3891
+ const currentScope = scopeProps[`__scope${scopeName}`];
3892
+ return { ...nextScopes2, ...currentScope };
3893
+ }, {});
3894
+ return React4.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
3895
+ };
3896
+ };
3897
+ createScope.scopeName = baseScope.scopeName;
3898
+ return createScope;
3899
+ }
3900
+
3901
+ // ../node_modules/.pnpm/@radix-ui+react-id@1.1.1_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-id/dist/index.mjs
3902
+ var React6 = __toESM(require("react"), 1);
3903
+
3904
+ // ../node_modules/.pnpm/@radix-ui+react-use-layout-effect@1.1.1_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
3905
+ var React5 = __toESM(require("react"), 1);
3906
+ var useLayoutEffect2 = globalThis?.document ? React5.useLayoutEffect : () => {
3907
+ };
3908
+
3909
+ // ../node_modules/.pnpm/@radix-ui+react-id@1.1.1_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-id/dist/index.mjs
3910
+ var useReactId = React6[" useId ".trim().toString()] || (() => void 0);
3911
+ var count = 0;
3912
+ function useId(deterministicId) {
3913
+ const [id, setId] = React6.useState(useReactId());
3914
+ useLayoutEffect2(() => {
3915
+ if (!deterministicId) setId((reactId) => reactId ?? String(count++));
3916
+ }, [deterministicId]);
3917
+ return deterministicId || (id ? `radix-${id}` : "");
3918
+ }
3919
+
3920
+ // ../node_modules/.pnpm/@radix-ui+react-use-controllable-state@1.2.2_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
3921
+ var React7 = __toESM(require("react"), 1);
3922
+ var React22 = __toESM(require("react"), 1);
3923
+ var useInsertionEffect = React7[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
3924
+ function useControllableState({
3925
+ prop,
3926
+ defaultProp,
3927
+ onChange = () => {
3928
+ },
3929
+ caller
3930
+ }) {
3931
+ const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
3932
+ defaultProp,
3933
+ onChange
3934
+ });
3935
+ const isControlled = prop !== void 0;
3936
+ const value = isControlled ? prop : uncontrolledProp;
3937
+ if (true) {
3938
+ const isControlledRef = React7.useRef(prop !== void 0);
3939
+ React7.useEffect(() => {
3940
+ const wasControlled = isControlledRef.current;
3941
+ if (wasControlled !== isControlled) {
3942
+ const from = wasControlled ? "controlled" : "uncontrolled";
3943
+ const to = isControlled ? "controlled" : "uncontrolled";
3944
+ console.warn(
3945
+ `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
3946
+ );
3947
+ }
3948
+ isControlledRef.current = isControlled;
3949
+ }, [isControlled, caller]);
3950
+ }
3951
+ const setValue = React7.useCallback(
3952
+ (nextValue) => {
3953
+ if (isControlled) {
3954
+ const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
3955
+ if (value2 !== prop) {
3956
+ onChangeRef.current?.(value2);
3957
+ }
3958
+ } else {
3959
+ setUncontrolledProp(nextValue);
3960
+ }
3961
+ },
3962
+ [isControlled, prop, setUncontrolledProp, onChangeRef]
3912
3963
  );
3964
+ return [value, setValue];
3913
3965
  }
3914
- function DialogContent({
3915
- className,
3916
- children,
3917
- showCloseButton = true,
3918
- ...props
3966
+ function useUncontrolledState({
3967
+ defaultProp,
3968
+ onChange
3919
3969
  }) {
3920
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(DialogPortal, { "data-slot": "dialog-portal", children: [
3921
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DialogOverlay, {}),
3922
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
3923
- DialogPrimitive.Content,
3924
- {
3925
- "data-slot": "dialog-content",
3926
- className: cn(
3927
- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
3928
- className
3929
- ),
3970
+ const [value, setValue] = React7.useState(defaultProp);
3971
+ const prevValueRef = React7.useRef(value);
3972
+ const onChangeRef = React7.useRef(onChange);
3973
+ useInsertionEffect(() => {
3974
+ onChangeRef.current = onChange;
3975
+ }, [onChange]);
3976
+ React7.useEffect(() => {
3977
+ if (prevValueRef.current !== value) {
3978
+ onChangeRef.current?.(value);
3979
+ prevValueRef.current = value;
3980
+ }
3981
+ }, [value, prevValueRef]);
3982
+ return [value, setValue, onChangeRef];
3983
+ }
3984
+ function isFunction(value) {
3985
+ return typeof value === "function";
3986
+ }
3987
+ var SYNC_STATE = Symbol("RADIX:SYNC_STATE");
3988
+
3989
+ // ../node_modules/.pnpm/@radix-ui+react-dismissable-layer@1.1.10_@types+react-dom@18.3.5_@types+react@18.3.14__@types_dcs2l2jzs5flmzhfcv6rimpkfe/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
3990
+ var React11 = __toESM(require("react"), 1);
3991
+
3992
+ // ../node_modules/.pnpm/@radix-ui+react-primitive@2.1.3_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@18_t6r7cxmbmoheujv3t43yqlikou/node_modules/@radix-ui/react-primitive/dist/index.mjs
3993
+ var React8 = __toESM(require("react"), 1);
3994
+ var ReactDOM = __toESM(require("react-dom"), 1);
3995
+ var import_jsx_runtime4 = require("react/jsx-runtime");
3996
+ var NODES = [
3997
+ "a",
3998
+ "button",
3999
+ "div",
4000
+ "form",
4001
+ "h2",
4002
+ "h3",
4003
+ "img",
4004
+ "input",
4005
+ "label",
4006
+ "li",
4007
+ "nav",
4008
+ "ol",
4009
+ "p",
4010
+ "select",
4011
+ "span",
4012
+ "svg",
4013
+ "ul"
4014
+ ];
4015
+ var Primitive = NODES.reduce((primitive, node) => {
4016
+ const Slot3 = createSlot(`Primitive.${node}`);
4017
+ const Node2 = React8.forwardRef((props, forwardedRef) => {
4018
+ const { asChild, ...primitiveProps } = props;
4019
+ const Comp = asChild ? Slot3 : node;
4020
+ if (typeof window !== "undefined") {
4021
+ window[Symbol.for("radix-ui")] = true;
4022
+ }
4023
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Comp, { ...primitiveProps, ref: forwardedRef });
4024
+ });
4025
+ Node2.displayName = `Primitive.${node}`;
4026
+ return { ...primitive, [node]: Node2 };
4027
+ }, {});
4028
+ function dispatchDiscreteCustomEvent(target, event) {
4029
+ if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
4030
+ }
4031
+
4032
+ // ../node_modules/.pnpm/@radix-ui+react-use-callback-ref@1.1.1_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
4033
+ var React9 = __toESM(require("react"), 1);
4034
+ function useCallbackRef(callback) {
4035
+ const callbackRef = React9.useRef(callback);
4036
+ React9.useEffect(() => {
4037
+ callbackRef.current = callback;
4038
+ });
4039
+ return React9.useMemo(() => (...args) => callbackRef.current?.(...args), []);
4040
+ }
4041
+
4042
+ // ../node_modules/.pnpm/@radix-ui+react-use-escape-keydown@1.1.1_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs
4043
+ var React10 = __toESM(require("react"), 1);
4044
+ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
4045
+ const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
4046
+ React10.useEffect(() => {
4047
+ const handleKeyDown = (event) => {
4048
+ if (event.key === "Escape") {
4049
+ onEscapeKeyDown(event);
4050
+ }
4051
+ };
4052
+ ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
4053
+ return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
4054
+ }, [onEscapeKeyDown, ownerDocument]);
4055
+ }
4056
+
4057
+ // ../node_modules/.pnpm/@radix-ui+react-dismissable-layer@1.1.10_@types+react-dom@18.3.5_@types+react@18.3.14__@types_dcs2l2jzs5flmzhfcv6rimpkfe/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
4058
+ var import_jsx_runtime5 = require("react/jsx-runtime");
4059
+ var DISMISSABLE_LAYER_NAME = "DismissableLayer";
4060
+ var CONTEXT_UPDATE = "dismissableLayer.update";
4061
+ var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
4062
+ var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
4063
+ var originalBodyPointerEvents;
4064
+ var DismissableLayerContext = React11.createContext({
4065
+ layers: /* @__PURE__ */ new Set(),
4066
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
4067
+ branches: /* @__PURE__ */ new Set()
4068
+ });
4069
+ var DismissableLayer = React11.forwardRef(
4070
+ (props, forwardedRef) => {
4071
+ const {
4072
+ disableOutsidePointerEvents = false,
4073
+ onEscapeKeyDown,
4074
+ onPointerDownOutside,
4075
+ onFocusOutside,
4076
+ onInteractOutside,
4077
+ onDismiss,
4078
+ ...layerProps
4079
+ } = props;
4080
+ const context = React11.useContext(DismissableLayerContext);
4081
+ const [node, setNode] = React11.useState(null);
4082
+ const ownerDocument = node?.ownerDocument ?? globalThis?.document;
4083
+ const [, force] = React11.useState({});
4084
+ const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
4085
+ const layers = Array.from(context.layers);
4086
+ const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
4087
+ const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
4088
+ const index = node ? layers.indexOf(node) : -1;
4089
+ const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
4090
+ const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
4091
+ const pointerDownOutside = usePointerDownOutside((event) => {
4092
+ const target = event.target;
4093
+ const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
4094
+ if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
4095
+ onPointerDownOutside?.(event);
4096
+ onInteractOutside?.(event);
4097
+ if (!event.defaultPrevented) onDismiss?.();
4098
+ }, ownerDocument);
4099
+ const focusOutside = useFocusOutside((event) => {
4100
+ const target = event.target;
4101
+ const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
4102
+ if (isFocusInBranch) return;
4103
+ onFocusOutside?.(event);
4104
+ onInteractOutside?.(event);
4105
+ if (!event.defaultPrevented) onDismiss?.();
4106
+ }, ownerDocument);
4107
+ useEscapeKeydown((event) => {
4108
+ const isHighestLayer = index === context.layers.size - 1;
4109
+ if (!isHighestLayer) return;
4110
+ onEscapeKeyDown?.(event);
4111
+ if (!event.defaultPrevented && onDismiss) {
4112
+ event.preventDefault();
4113
+ onDismiss();
4114
+ }
4115
+ }, ownerDocument);
4116
+ React11.useEffect(() => {
4117
+ if (!node) return;
4118
+ if (disableOutsidePointerEvents) {
4119
+ if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
4120
+ originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
4121
+ ownerDocument.body.style.pointerEvents = "none";
4122
+ }
4123
+ context.layersWithOutsidePointerEventsDisabled.add(node);
4124
+ }
4125
+ context.layers.add(node);
4126
+ dispatchUpdate();
4127
+ return () => {
4128
+ if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
4129
+ ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
4130
+ }
4131
+ };
4132
+ }, [node, ownerDocument, disableOutsidePointerEvents, context]);
4133
+ React11.useEffect(() => {
4134
+ return () => {
4135
+ if (!node) return;
4136
+ context.layers.delete(node);
4137
+ context.layersWithOutsidePointerEventsDisabled.delete(node);
4138
+ dispatchUpdate();
4139
+ };
4140
+ }, [node, context]);
4141
+ React11.useEffect(() => {
4142
+ const handleUpdate = () => force({});
4143
+ document.addEventListener(CONTEXT_UPDATE, handleUpdate);
4144
+ return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
4145
+ }, []);
4146
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4147
+ Primitive.div,
4148
+ {
4149
+ ...layerProps,
4150
+ ref: composedRefs,
4151
+ style: {
4152
+ pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
4153
+ ...props.style
4154
+ },
4155
+ onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
4156
+ onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
4157
+ onPointerDownCapture: composeEventHandlers(
4158
+ props.onPointerDownCapture,
4159
+ pointerDownOutside.onPointerDownCapture
4160
+ )
4161
+ }
4162
+ );
4163
+ }
4164
+ );
4165
+ DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
4166
+ var BRANCH_NAME = "DismissableLayerBranch";
4167
+ var DismissableLayerBranch = React11.forwardRef((props, forwardedRef) => {
4168
+ const context = React11.useContext(DismissableLayerContext);
4169
+ const ref = React11.useRef(null);
4170
+ const composedRefs = useComposedRefs(forwardedRef, ref);
4171
+ React11.useEffect(() => {
4172
+ const node = ref.current;
4173
+ if (node) {
4174
+ context.branches.add(node);
4175
+ return () => {
4176
+ context.branches.delete(node);
4177
+ };
4178
+ }
4179
+ }, [context.branches]);
4180
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Primitive.div, { ...props, ref: composedRefs });
4181
+ });
4182
+ DismissableLayerBranch.displayName = BRANCH_NAME;
4183
+ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
4184
+ const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
4185
+ const isPointerInsideReactTreeRef = React11.useRef(false);
4186
+ const handleClickRef = React11.useRef(() => {
4187
+ });
4188
+ React11.useEffect(() => {
4189
+ const handlePointerDown = (event) => {
4190
+ if (event.target && !isPointerInsideReactTreeRef.current) {
4191
+ let handleAndDispatchPointerDownOutsideEvent2 = function() {
4192
+ handleAndDispatchCustomEvent(
4193
+ POINTER_DOWN_OUTSIDE,
4194
+ handlePointerDownOutside,
4195
+ eventDetail,
4196
+ { discrete: true }
4197
+ );
4198
+ };
4199
+ var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
4200
+ const eventDetail = { originalEvent: event };
4201
+ if (event.pointerType === "touch") {
4202
+ ownerDocument.removeEventListener("click", handleClickRef.current);
4203
+ handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
4204
+ ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
4205
+ } else {
4206
+ handleAndDispatchPointerDownOutsideEvent2();
4207
+ }
4208
+ } else {
4209
+ ownerDocument.removeEventListener("click", handleClickRef.current);
4210
+ }
4211
+ isPointerInsideReactTreeRef.current = false;
4212
+ };
4213
+ const timerId = window.setTimeout(() => {
4214
+ ownerDocument.addEventListener("pointerdown", handlePointerDown);
4215
+ }, 0);
4216
+ return () => {
4217
+ window.clearTimeout(timerId);
4218
+ ownerDocument.removeEventListener("pointerdown", handlePointerDown);
4219
+ ownerDocument.removeEventListener("click", handleClickRef.current);
4220
+ };
4221
+ }, [ownerDocument, handlePointerDownOutside]);
4222
+ return {
4223
+ // ensures we check React component tree (not just DOM tree)
4224
+ onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
4225
+ };
4226
+ }
4227
+ function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
4228
+ const handleFocusOutside = useCallbackRef(onFocusOutside);
4229
+ const isFocusInsideReactTreeRef = React11.useRef(false);
4230
+ React11.useEffect(() => {
4231
+ const handleFocus = (event) => {
4232
+ if (event.target && !isFocusInsideReactTreeRef.current) {
4233
+ const eventDetail = { originalEvent: event };
4234
+ handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
4235
+ discrete: false
4236
+ });
4237
+ }
4238
+ };
4239
+ ownerDocument.addEventListener("focusin", handleFocus);
4240
+ return () => ownerDocument.removeEventListener("focusin", handleFocus);
4241
+ }, [ownerDocument, handleFocusOutside]);
4242
+ return {
4243
+ onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
4244
+ onBlurCapture: () => isFocusInsideReactTreeRef.current = false
4245
+ };
4246
+ }
4247
+ function dispatchUpdate() {
4248
+ const event = new CustomEvent(CONTEXT_UPDATE);
4249
+ document.dispatchEvent(event);
4250
+ }
4251
+ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
4252
+ const target = detail.originalEvent.target;
4253
+ const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
4254
+ if (handler) target.addEventListener(name, handler, { once: true });
4255
+ if (discrete) {
4256
+ dispatchDiscreteCustomEvent(target, event);
4257
+ } else {
4258
+ target.dispatchEvent(event);
4259
+ }
4260
+ }
4261
+
4262
+ // ../node_modules/.pnpm/@radix-ui+react-focus-scope@1.1.7_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@_r3i6zfw7jzc6qbfsmvmyzd6wgu/node_modules/@radix-ui/react-focus-scope/dist/index.mjs
4263
+ var React12 = __toESM(require("react"), 1);
4264
+ var import_jsx_runtime6 = require("react/jsx-runtime");
4265
+ var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
4266
+ var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
4267
+ var EVENT_OPTIONS = { bubbles: false, cancelable: true };
4268
+ var FOCUS_SCOPE_NAME = "FocusScope";
4269
+ var FocusScope = React12.forwardRef((props, forwardedRef) => {
4270
+ const {
4271
+ loop = false,
4272
+ trapped = false,
4273
+ onMountAutoFocus: onMountAutoFocusProp,
4274
+ onUnmountAutoFocus: onUnmountAutoFocusProp,
4275
+ ...scopeProps
4276
+ } = props;
4277
+ const [container, setContainer] = React12.useState(null);
4278
+ const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
4279
+ const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
4280
+ const lastFocusedElementRef = React12.useRef(null);
4281
+ const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
4282
+ const focusScope = React12.useRef({
4283
+ paused: false,
4284
+ pause() {
4285
+ this.paused = true;
4286
+ },
4287
+ resume() {
4288
+ this.paused = false;
4289
+ }
4290
+ }).current;
4291
+ React12.useEffect(() => {
4292
+ if (trapped) {
4293
+ let handleFocusIn2 = function(event) {
4294
+ if (focusScope.paused || !container) return;
4295
+ const target = event.target;
4296
+ if (container.contains(target)) {
4297
+ lastFocusedElementRef.current = target;
4298
+ } else {
4299
+ focus(lastFocusedElementRef.current, { select: true });
4300
+ }
4301
+ }, handleFocusOut2 = function(event) {
4302
+ if (focusScope.paused || !container) return;
4303
+ const relatedTarget = event.relatedTarget;
4304
+ if (relatedTarget === null) return;
4305
+ if (!container.contains(relatedTarget)) {
4306
+ focus(lastFocusedElementRef.current, { select: true });
4307
+ }
4308
+ }, handleMutations2 = function(mutations) {
4309
+ const focusedElement = document.activeElement;
4310
+ if (focusedElement !== document.body) return;
4311
+ for (const mutation of mutations) {
4312
+ if (mutation.removedNodes.length > 0) focus(container);
4313
+ }
4314
+ };
4315
+ var handleFocusIn = handleFocusIn2, handleFocusOut = handleFocusOut2, handleMutations = handleMutations2;
4316
+ document.addEventListener("focusin", handleFocusIn2);
4317
+ document.addEventListener("focusout", handleFocusOut2);
4318
+ const mutationObserver = new MutationObserver(handleMutations2);
4319
+ if (container) mutationObserver.observe(container, { childList: true, subtree: true });
4320
+ return () => {
4321
+ document.removeEventListener("focusin", handleFocusIn2);
4322
+ document.removeEventListener("focusout", handleFocusOut2);
4323
+ mutationObserver.disconnect();
4324
+ };
4325
+ }
4326
+ }, [trapped, container, focusScope.paused]);
4327
+ React12.useEffect(() => {
4328
+ if (container) {
4329
+ focusScopesStack.add(focusScope);
4330
+ const previouslyFocusedElement = document.activeElement;
4331
+ const hasFocusedCandidate = container.contains(previouslyFocusedElement);
4332
+ if (!hasFocusedCandidate) {
4333
+ const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
4334
+ container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
4335
+ container.dispatchEvent(mountEvent);
4336
+ if (!mountEvent.defaultPrevented) {
4337
+ focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
4338
+ if (document.activeElement === previouslyFocusedElement) {
4339
+ focus(container);
4340
+ }
4341
+ }
4342
+ }
4343
+ return () => {
4344
+ container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
4345
+ setTimeout(() => {
4346
+ const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
4347
+ container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
4348
+ container.dispatchEvent(unmountEvent);
4349
+ if (!unmountEvent.defaultPrevented) {
4350
+ focus(previouslyFocusedElement ?? document.body, { select: true });
4351
+ }
4352
+ container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
4353
+ focusScopesStack.remove(focusScope);
4354
+ }, 0);
4355
+ };
4356
+ }
4357
+ }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
4358
+ const handleKeyDown = React12.useCallback(
4359
+ (event) => {
4360
+ if (!loop && !trapped) return;
4361
+ if (focusScope.paused) return;
4362
+ const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
4363
+ const focusedElement = document.activeElement;
4364
+ if (isTabKey && focusedElement) {
4365
+ const container2 = event.currentTarget;
4366
+ const [first, last] = getTabbableEdges(container2);
4367
+ const hasTabbableElementsInside = first && last;
4368
+ if (!hasTabbableElementsInside) {
4369
+ if (focusedElement === container2) event.preventDefault();
4370
+ } else {
4371
+ if (!event.shiftKey && focusedElement === last) {
4372
+ event.preventDefault();
4373
+ if (loop) focus(first, { select: true });
4374
+ } else if (event.shiftKey && focusedElement === first) {
4375
+ event.preventDefault();
4376
+ if (loop) focus(last, { select: true });
4377
+ }
4378
+ }
4379
+ }
4380
+ },
4381
+ [loop, trapped, focusScope.paused]
4382
+ );
4383
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
4384
+ });
4385
+ FocusScope.displayName = FOCUS_SCOPE_NAME;
4386
+ function focusFirst(candidates, { select = false } = {}) {
4387
+ const previouslyFocusedElement = document.activeElement;
4388
+ for (const candidate of candidates) {
4389
+ focus(candidate, { select });
4390
+ if (document.activeElement !== previouslyFocusedElement) return;
4391
+ }
4392
+ }
4393
+ function getTabbableEdges(container) {
4394
+ const candidates = getTabbableCandidates(container);
4395
+ const first = findVisible(candidates, container);
4396
+ const last = findVisible(candidates.reverse(), container);
4397
+ return [first, last];
4398
+ }
4399
+ function getTabbableCandidates(container) {
4400
+ const nodes = [];
4401
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
4402
+ acceptNode: (node) => {
4403
+ const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
4404
+ if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
4405
+ return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
4406
+ }
4407
+ });
4408
+ while (walker.nextNode()) nodes.push(walker.currentNode);
4409
+ return nodes;
4410
+ }
4411
+ function findVisible(elements, container) {
4412
+ for (const element of elements) {
4413
+ if (!isHidden(element, { upTo: container })) return element;
4414
+ }
4415
+ }
4416
+ function isHidden(node, { upTo }) {
4417
+ if (getComputedStyle(node).visibility === "hidden") return true;
4418
+ while (node) {
4419
+ if (upTo !== void 0 && node === upTo) return false;
4420
+ if (getComputedStyle(node).display === "none") return true;
4421
+ node = node.parentElement;
4422
+ }
4423
+ return false;
4424
+ }
4425
+ function isSelectableInput(element) {
4426
+ return element instanceof HTMLInputElement && "select" in element;
4427
+ }
4428
+ function focus(element, { select = false } = {}) {
4429
+ if (element && element.focus) {
4430
+ const previouslyFocusedElement = document.activeElement;
4431
+ element.focus({ preventScroll: true });
4432
+ if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
4433
+ element.select();
4434
+ }
4435
+ }
4436
+ var focusScopesStack = createFocusScopesStack();
4437
+ function createFocusScopesStack() {
4438
+ let stack = [];
4439
+ return {
4440
+ add(focusScope) {
4441
+ const activeFocusScope = stack[0];
4442
+ if (focusScope !== activeFocusScope) {
4443
+ activeFocusScope?.pause();
4444
+ }
4445
+ stack = arrayRemove(stack, focusScope);
4446
+ stack.unshift(focusScope);
4447
+ },
4448
+ remove(focusScope) {
4449
+ stack = arrayRemove(stack, focusScope);
4450
+ stack[0]?.resume();
4451
+ }
4452
+ };
4453
+ }
4454
+ function arrayRemove(array, item) {
4455
+ const updatedArray = [...array];
4456
+ const index = updatedArray.indexOf(item);
4457
+ if (index !== -1) {
4458
+ updatedArray.splice(index, 1);
4459
+ }
4460
+ return updatedArray;
4461
+ }
4462
+ function removeLinks(items) {
4463
+ return items.filter((item) => item.tagName !== "A");
4464
+ }
4465
+
4466
+ // ../node_modules/.pnpm/@radix-ui+react-portal@1.1.9_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@18.3._nlwlfidmfjbhuhdac2s4gonhum/node_modules/@radix-ui/react-portal/dist/index.mjs
4467
+ var React13 = __toESM(require("react"), 1);
4468
+ var import_react_dom = __toESM(require("react-dom"), 1);
4469
+ var import_jsx_runtime7 = require("react/jsx-runtime");
4470
+ var PORTAL_NAME = "Portal";
4471
+ var Portal = React13.forwardRef((props, forwardedRef) => {
4472
+ const { container: containerProp, ...portalProps } = props;
4473
+ const [mounted, setMounted] = React13.useState(false);
4474
+ useLayoutEffect2(() => setMounted(true), []);
4475
+ const container = containerProp || mounted && globalThis?.document?.body;
4476
+ return container ? import_react_dom.default.createPortal(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
4477
+ });
4478
+ Portal.displayName = PORTAL_NAME;
4479
+
4480
+ // ../node_modules/.pnpm/@radix-ui+react-presence@1.1.4_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@18._rdubggcljnkcjot4tnwunht5nu/node_modules/@radix-ui/react-presence/dist/index.mjs
4481
+ var React23 = __toESM(require("react"), 1);
4482
+ var React14 = __toESM(require("react"), 1);
4483
+ function useStateMachine(initialState, machine) {
4484
+ return React14.useReducer((state, event) => {
4485
+ const nextState = machine[state][event];
4486
+ return nextState ?? state;
4487
+ }, initialState);
4488
+ }
4489
+ var Presence = (props) => {
4490
+ const { present, children } = props;
4491
+ const presence = usePresence(present);
4492
+ const child = typeof children === "function" ? children({ present: presence.isPresent }) : React23.Children.only(children);
4493
+ const ref = useComposedRefs(presence.ref, getElementRef2(child));
4494
+ const forceMount = typeof children === "function";
4495
+ return forceMount || presence.isPresent ? React23.cloneElement(child, { ref }) : null;
4496
+ };
4497
+ Presence.displayName = "Presence";
4498
+ function usePresence(present) {
4499
+ const [node, setNode] = React23.useState();
4500
+ const stylesRef = React23.useRef(null);
4501
+ const prevPresentRef = React23.useRef(present);
4502
+ const prevAnimationNameRef = React23.useRef("none");
4503
+ const initialState = present ? "mounted" : "unmounted";
4504
+ const [state, send] = useStateMachine(initialState, {
4505
+ mounted: {
4506
+ UNMOUNT: "unmounted",
4507
+ ANIMATION_OUT: "unmountSuspended"
4508
+ },
4509
+ unmountSuspended: {
4510
+ MOUNT: "mounted",
4511
+ ANIMATION_END: "unmounted"
4512
+ },
4513
+ unmounted: {
4514
+ MOUNT: "mounted"
4515
+ }
4516
+ });
4517
+ React23.useEffect(() => {
4518
+ const currentAnimationName = getAnimationName(stylesRef.current);
4519
+ prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
4520
+ }, [state]);
4521
+ useLayoutEffect2(() => {
4522
+ const styles = stylesRef.current;
4523
+ const wasPresent = prevPresentRef.current;
4524
+ const hasPresentChanged = wasPresent !== present;
4525
+ if (hasPresentChanged) {
4526
+ const prevAnimationName = prevAnimationNameRef.current;
4527
+ const currentAnimationName = getAnimationName(styles);
4528
+ if (present) {
4529
+ send("MOUNT");
4530
+ } else if (currentAnimationName === "none" || styles?.display === "none") {
4531
+ send("UNMOUNT");
4532
+ } else {
4533
+ const isAnimating = prevAnimationName !== currentAnimationName;
4534
+ if (wasPresent && isAnimating) {
4535
+ send("ANIMATION_OUT");
4536
+ } else {
4537
+ send("UNMOUNT");
4538
+ }
4539
+ }
4540
+ prevPresentRef.current = present;
4541
+ }
4542
+ }, [present, send]);
4543
+ useLayoutEffect2(() => {
4544
+ if (node) {
4545
+ let timeoutId;
4546
+ const ownerWindow = node.ownerDocument.defaultView ?? window;
4547
+ const handleAnimationEnd = (event) => {
4548
+ const currentAnimationName = getAnimationName(stylesRef.current);
4549
+ const isCurrentAnimation = currentAnimationName.includes(event.animationName);
4550
+ if (event.target === node && isCurrentAnimation) {
4551
+ send("ANIMATION_END");
4552
+ if (!prevPresentRef.current) {
4553
+ const currentFillMode = node.style.animationFillMode;
4554
+ node.style.animationFillMode = "forwards";
4555
+ timeoutId = ownerWindow.setTimeout(() => {
4556
+ if (node.style.animationFillMode === "forwards") {
4557
+ node.style.animationFillMode = currentFillMode;
4558
+ }
4559
+ });
4560
+ }
4561
+ }
4562
+ };
4563
+ const handleAnimationStart = (event) => {
4564
+ if (event.target === node) {
4565
+ prevAnimationNameRef.current = getAnimationName(stylesRef.current);
4566
+ }
4567
+ };
4568
+ node.addEventListener("animationstart", handleAnimationStart);
4569
+ node.addEventListener("animationcancel", handleAnimationEnd);
4570
+ node.addEventListener("animationend", handleAnimationEnd);
4571
+ return () => {
4572
+ ownerWindow.clearTimeout(timeoutId);
4573
+ node.removeEventListener("animationstart", handleAnimationStart);
4574
+ node.removeEventListener("animationcancel", handleAnimationEnd);
4575
+ node.removeEventListener("animationend", handleAnimationEnd);
4576
+ };
4577
+ } else {
4578
+ send("ANIMATION_END");
4579
+ }
4580
+ }, [node, send]);
4581
+ return {
4582
+ isPresent: ["mounted", "unmountSuspended"].includes(state),
4583
+ ref: React23.useCallback((node2) => {
4584
+ stylesRef.current = node2 ? getComputedStyle(node2) : null;
4585
+ setNode(node2);
4586
+ }, [])
4587
+ };
4588
+ }
4589
+ function getAnimationName(styles) {
4590
+ return styles?.animationName || "none";
4591
+ }
4592
+ function getElementRef2(element) {
4593
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
4594
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
4595
+ if (mayWarn) {
4596
+ return element.ref;
4597
+ }
4598
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
4599
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
4600
+ if (mayWarn) {
4601
+ return element.props.ref;
4602
+ }
4603
+ return element.props.ref || element.ref;
4604
+ }
4605
+
4606
+ // ../node_modules/.pnpm/@radix-ui+react-focus-guards@1.1.2_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-focus-guards/dist/index.mjs
4607
+ var React15 = __toESM(require("react"), 1);
4608
+ var count2 = 0;
4609
+ function useFocusGuards() {
4610
+ React15.useEffect(() => {
4611
+ const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
4612
+ document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
4613
+ document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
4614
+ count2++;
4615
+ return () => {
4616
+ if (count2 === 1) {
4617
+ document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
4618
+ }
4619
+ count2--;
4620
+ };
4621
+ }, []);
4622
+ }
4623
+ function createFocusGuard() {
4624
+ const element = document.createElement("span");
4625
+ element.setAttribute("data-radix-focus-guard", "");
4626
+ element.tabIndex = 0;
4627
+ element.style.outline = "none";
4628
+ element.style.opacity = "0";
4629
+ element.style.position = "fixed";
4630
+ element.style.pointerEvents = "none";
4631
+ return element;
4632
+ }
4633
+
4634
+ // ../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
4635
+ var __assign = function() {
4636
+ __assign = Object.assign || function __assign2(t) {
4637
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4638
+ s = arguments[i];
4639
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
4640
+ }
4641
+ return t;
4642
+ };
4643
+ return __assign.apply(this, arguments);
4644
+ };
4645
+ function __rest(s, e) {
4646
+ var t = {};
4647
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4648
+ t[p] = s[p];
4649
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
4650
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
4651
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
4652
+ t[p[i]] = s[p[i]];
4653
+ }
4654
+ return t;
4655
+ }
4656
+ function __spreadArray(to, from, pack) {
4657
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4658
+ if (ar || !(i in from)) {
4659
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
4660
+ ar[i] = from[i];
4661
+ }
4662
+ }
4663
+ return to.concat(ar || Array.prototype.slice.call(from));
4664
+ }
4665
+
4666
+ // ../node_modules/.pnpm/react-remove-scroll@2.7.1_@types+react@18.3.14_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/Combination.js
4667
+ var React24 = __toESM(require("react"));
4668
+
4669
+ // ../node_modules/.pnpm/react-remove-scroll@2.7.1_@types+react@18.3.14_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/UI.js
4670
+ var React18 = __toESM(require("react"));
4671
+
4672
+ // ../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@18.3.14_react@18.3.1/node_modules/react-remove-scroll-bar/dist/es2015/constants.js
4673
+ var zeroRightClassName = "right-scroll-bar-position";
4674
+ var fullWidthClassName = "width-before-scroll-bar";
4675
+ var noScrollbarsClassName = "with-scroll-bars-hidden";
4676
+ var removedBarSizeVariable = "--removed-body-scroll-bar-size";
4677
+
4678
+ // ../node_modules/.pnpm/use-callback-ref@1.3.3_@types+react@18.3.14_react@18.3.1/node_modules/use-callback-ref/dist/es2015/assignRef.js
4679
+ function assignRef(ref, value) {
4680
+ if (typeof ref === "function") {
4681
+ ref(value);
4682
+ } else if (ref) {
4683
+ ref.current = value;
4684
+ }
4685
+ return ref;
4686
+ }
4687
+
4688
+ // ../node_modules/.pnpm/use-callback-ref@1.3.3_@types+react@18.3.14_react@18.3.1/node_modules/use-callback-ref/dist/es2015/useRef.js
4689
+ var import_react5 = require("react");
4690
+ function useCallbackRef2(initialValue, callback) {
4691
+ var ref = (0, import_react5.useState)(function() {
4692
+ return {
4693
+ // value
4694
+ value: initialValue,
4695
+ // last callback
4696
+ callback,
4697
+ // "memoized" public interface
4698
+ facade: {
4699
+ get current() {
4700
+ return ref.value;
4701
+ },
4702
+ set current(value) {
4703
+ var last = ref.value;
4704
+ if (last !== value) {
4705
+ ref.value = value;
4706
+ ref.callback(value, last);
4707
+ }
4708
+ }
4709
+ }
4710
+ };
4711
+ })[0];
4712
+ ref.callback = callback;
4713
+ return ref.facade;
4714
+ }
4715
+
4716
+ // ../node_modules/.pnpm/use-callback-ref@1.3.3_@types+react@18.3.14_react@18.3.1/node_modules/use-callback-ref/dist/es2015/useMergeRef.js
4717
+ var React16 = __toESM(require("react"));
4718
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React16.useLayoutEffect : React16.useEffect;
4719
+ var currentValues = /* @__PURE__ */ new WeakMap();
4720
+ function useMergeRefs(refs, defaultValue) {
4721
+ var callbackRef = useCallbackRef2(defaultValue || null, function(newValue) {
4722
+ return refs.forEach(function(ref) {
4723
+ return assignRef(ref, newValue);
4724
+ });
4725
+ });
4726
+ useIsomorphicLayoutEffect(function() {
4727
+ var oldValue = currentValues.get(callbackRef);
4728
+ if (oldValue) {
4729
+ var prevRefs_1 = new Set(oldValue);
4730
+ var nextRefs_1 = new Set(refs);
4731
+ var current_1 = callbackRef.current;
4732
+ prevRefs_1.forEach(function(ref) {
4733
+ if (!nextRefs_1.has(ref)) {
4734
+ assignRef(ref, null);
4735
+ }
4736
+ });
4737
+ nextRefs_1.forEach(function(ref) {
4738
+ if (!prevRefs_1.has(ref)) {
4739
+ assignRef(ref, current_1);
4740
+ }
4741
+ });
4742
+ }
4743
+ currentValues.set(callbackRef, refs);
4744
+ }, [refs]);
4745
+ return callbackRef;
4746
+ }
4747
+
4748
+ // ../node_modules/.pnpm/use-sidecar@1.1.3_@types+react@18.3.14_react@18.3.1/node_modules/use-sidecar/dist/es2015/medium.js
4749
+ function ItoI(a) {
4750
+ return a;
4751
+ }
4752
+ function innerCreateMedium(defaults, middleware) {
4753
+ if (middleware === void 0) {
4754
+ middleware = ItoI;
4755
+ }
4756
+ var buffer = [];
4757
+ var assigned = false;
4758
+ var medium = {
4759
+ read: function() {
4760
+ if (assigned) {
4761
+ throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
4762
+ }
4763
+ if (buffer.length) {
4764
+ return buffer[buffer.length - 1];
4765
+ }
4766
+ return defaults;
4767
+ },
4768
+ useMedium: function(data) {
4769
+ var item = middleware(data, assigned);
4770
+ buffer.push(item);
4771
+ return function() {
4772
+ buffer = buffer.filter(function(x) {
4773
+ return x !== item;
4774
+ });
4775
+ };
4776
+ },
4777
+ assignSyncMedium: function(cb) {
4778
+ assigned = true;
4779
+ while (buffer.length) {
4780
+ var cbs = buffer;
4781
+ buffer = [];
4782
+ cbs.forEach(cb);
4783
+ }
4784
+ buffer = {
4785
+ push: function(x) {
4786
+ return cb(x);
4787
+ },
4788
+ filter: function() {
4789
+ return buffer;
4790
+ }
4791
+ };
4792
+ },
4793
+ assignMedium: function(cb) {
4794
+ assigned = true;
4795
+ var pendingQueue = [];
4796
+ if (buffer.length) {
4797
+ var cbs = buffer;
4798
+ buffer = [];
4799
+ cbs.forEach(cb);
4800
+ pendingQueue = buffer;
4801
+ }
4802
+ var executeQueue = function() {
4803
+ var cbs2 = pendingQueue;
4804
+ pendingQueue = [];
4805
+ cbs2.forEach(cb);
4806
+ };
4807
+ var cycle = function() {
4808
+ return Promise.resolve().then(executeQueue);
4809
+ };
4810
+ cycle();
4811
+ buffer = {
4812
+ push: function(x) {
4813
+ pendingQueue.push(x);
4814
+ cycle();
4815
+ },
4816
+ filter: function(filter) {
4817
+ pendingQueue = pendingQueue.filter(filter);
4818
+ return buffer;
4819
+ }
4820
+ };
4821
+ }
4822
+ };
4823
+ return medium;
4824
+ }
4825
+ function createSidecarMedium(options) {
4826
+ if (options === void 0) {
4827
+ options = {};
4828
+ }
4829
+ var medium = innerCreateMedium(null);
4830
+ medium.options = __assign({ async: true, ssr: false }, options);
4831
+ return medium;
4832
+ }
4833
+
4834
+ // ../node_modules/.pnpm/use-sidecar@1.1.3_@types+react@18.3.14_react@18.3.1/node_modules/use-sidecar/dist/es2015/exports.js
4835
+ var React17 = __toESM(require("react"));
4836
+ var SideCar = function(_a) {
4837
+ var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
4838
+ if (!sideCar) {
4839
+ throw new Error("Sidecar: please provide `sideCar` property to import the right car");
4840
+ }
4841
+ var Target = sideCar.read();
4842
+ if (!Target) {
4843
+ throw new Error("Sidecar medium not found");
4844
+ }
4845
+ return React17.createElement(Target, __assign({}, rest));
4846
+ };
4847
+ SideCar.isSideCarExport = true;
4848
+ function exportSidecar(medium, exported) {
4849
+ medium.useMedium(exported);
4850
+ return SideCar;
4851
+ }
4852
+
4853
+ // ../node_modules/.pnpm/react-remove-scroll@2.7.1_@types+react@18.3.14_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/medium.js
4854
+ var effectCar = createSidecarMedium();
4855
+
4856
+ // ../node_modules/.pnpm/react-remove-scroll@2.7.1_@types+react@18.3.14_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/UI.js
4857
+ var nothing = function() {
4858
+ return;
4859
+ };
4860
+ var RemoveScroll = React18.forwardRef(function(props, parentRef) {
4861
+ var ref = React18.useRef(null);
4862
+ var _a = React18.useState({
4863
+ onScrollCapture: nothing,
4864
+ onWheelCapture: nothing,
4865
+ onTouchMoveCapture: nothing
4866
+ }), callbacks = _a[0], setCallbacks = _a[1];
4867
+ var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? "div" : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
4868
+ var SideCar2 = sideCar;
4869
+ var containerRef = useMergeRefs([ref, parentRef]);
4870
+ var containerProps = __assign(__assign({}, rest), callbacks);
4871
+ return React18.createElement(
4872
+ React18.Fragment,
4873
+ null,
4874
+ enabled && React18.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
4875
+ forwardProps ? React18.cloneElement(React18.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React18.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
4876
+ );
4877
+ });
4878
+ RemoveScroll.defaultProps = {
4879
+ enabled: true,
4880
+ removeScrollBar: true,
4881
+ inert: false
4882
+ };
4883
+ RemoveScroll.classNames = {
4884
+ fullWidth: fullWidthClassName,
4885
+ zeroRight: zeroRightClassName
4886
+ };
4887
+
4888
+ // ../node_modules/.pnpm/react-remove-scroll@2.7.1_@types+react@18.3.14_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/SideEffect.js
4889
+ var React21 = __toESM(require("react"));
4890
+
4891
+ // ../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@18.3.14_react@18.3.1/node_modules/react-remove-scroll-bar/dist/es2015/component.js
4892
+ var React20 = __toESM(require("react"));
4893
+
4894
+ // ../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@18.3.14_react@18.3.1/node_modules/react-style-singleton/dist/es2015/hook.js
4895
+ var React19 = __toESM(require("react"));
4896
+
4897
+ // ../node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es2015/index.js
4898
+ var currentNonce;
4899
+ var getNonce = function() {
4900
+ if (currentNonce) {
4901
+ return currentNonce;
4902
+ }
4903
+ if (typeof __webpack_nonce__ !== "undefined") {
4904
+ return __webpack_nonce__;
4905
+ }
4906
+ return void 0;
4907
+ };
4908
+
4909
+ // ../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@18.3.14_react@18.3.1/node_modules/react-style-singleton/dist/es2015/singleton.js
4910
+ function makeStyleTag() {
4911
+ if (!document)
4912
+ return null;
4913
+ var tag = document.createElement("style");
4914
+ tag.type = "text/css";
4915
+ var nonce = getNonce();
4916
+ if (nonce) {
4917
+ tag.setAttribute("nonce", nonce);
4918
+ }
4919
+ return tag;
4920
+ }
4921
+ function injectStyles(tag, css) {
4922
+ if (tag.styleSheet) {
4923
+ tag.styleSheet.cssText = css;
4924
+ } else {
4925
+ tag.appendChild(document.createTextNode(css));
4926
+ }
4927
+ }
4928
+ function insertStyleTag(tag) {
4929
+ var head = document.head || document.getElementsByTagName("head")[0];
4930
+ head.appendChild(tag);
4931
+ }
4932
+ var stylesheetSingleton = function() {
4933
+ var counter = 0;
4934
+ var stylesheet = null;
4935
+ return {
4936
+ add: function(style) {
4937
+ if (counter == 0) {
4938
+ if (stylesheet = makeStyleTag()) {
4939
+ injectStyles(stylesheet, style);
4940
+ insertStyleTag(stylesheet);
4941
+ }
4942
+ }
4943
+ counter++;
4944
+ },
4945
+ remove: function() {
4946
+ counter--;
4947
+ if (!counter && stylesheet) {
4948
+ stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
4949
+ stylesheet = null;
4950
+ }
4951
+ }
4952
+ };
4953
+ };
4954
+
4955
+ // ../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@18.3.14_react@18.3.1/node_modules/react-style-singleton/dist/es2015/hook.js
4956
+ var styleHookSingleton = function() {
4957
+ var sheet = stylesheetSingleton();
4958
+ return function(styles, isDynamic) {
4959
+ React19.useEffect(function() {
4960
+ sheet.add(styles);
4961
+ return function() {
4962
+ sheet.remove();
4963
+ };
4964
+ }, [styles && isDynamic]);
4965
+ };
4966
+ };
4967
+
4968
+ // ../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@18.3.14_react@18.3.1/node_modules/react-style-singleton/dist/es2015/component.js
4969
+ var styleSingleton = function() {
4970
+ var useStyle = styleHookSingleton();
4971
+ var Sheet = function(_a) {
4972
+ var styles = _a.styles, dynamic = _a.dynamic;
4973
+ useStyle(styles, dynamic);
4974
+ return null;
4975
+ };
4976
+ return Sheet;
4977
+ };
4978
+
4979
+ // ../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@18.3.14_react@18.3.1/node_modules/react-remove-scroll-bar/dist/es2015/utils.js
4980
+ var zeroGap = {
4981
+ left: 0,
4982
+ top: 0,
4983
+ right: 0,
4984
+ gap: 0
4985
+ };
4986
+ var parse = function(x) {
4987
+ return parseInt(x || "", 10) || 0;
4988
+ };
4989
+ var getOffset = function(gapMode) {
4990
+ var cs = window.getComputedStyle(document.body);
4991
+ var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
4992
+ var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
4993
+ var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
4994
+ return [parse(left), parse(top), parse(right)];
4995
+ };
4996
+ var getGapWidth = function(gapMode) {
4997
+ if (gapMode === void 0) {
4998
+ gapMode = "margin";
4999
+ }
5000
+ if (typeof window === "undefined") {
5001
+ return zeroGap;
5002
+ }
5003
+ var offsets = getOffset(gapMode);
5004
+ var documentWidth = document.documentElement.clientWidth;
5005
+ var windowWidth = window.innerWidth;
5006
+ return {
5007
+ left: offsets[0],
5008
+ top: offsets[1],
5009
+ right: offsets[2],
5010
+ gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
5011
+ };
5012
+ };
5013
+
5014
+ // ../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@18.3.14_react@18.3.1/node_modules/react-remove-scroll-bar/dist/es2015/component.js
5015
+ var Style = styleSingleton();
5016
+ var lockAttribute = "data-scroll-locked";
5017
+ var getStyles = function(_a, allowRelative, gapMode, important) {
5018
+ var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
5019
+ if (gapMode === void 0) {
5020
+ gapMode = "margin";
5021
+ }
5022
+ return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
5023
+ allowRelative && "position: relative ".concat(important, ";"),
5024
+ gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
5025
+ gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
5026
+ ].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
5027
+ };
5028
+ var getCurrentUseCounter = function() {
5029
+ var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
5030
+ return isFinite(counter) ? counter : 0;
5031
+ };
5032
+ var useLockAttribute = function() {
5033
+ React20.useEffect(function() {
5034
+ document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
5035
+ return function() {
5036
+ var newCounter = getCurrentUseCounter() - 1;
5037
+ if (newCounter <= 0) {
5038
+ document.body.removeAttribute(lockAttribute);
5039
+ } else {
5040
+ document.body.setAttribute(lockAttribute, newCounter.toString());
5041
+ }
5042
+ };
5043
+ }, []);
5044
+ };
5045
+ var RemoveScrollBar = function(_a) {
5046
+ var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
5047
+ useLockAttribute();
5048
+ var gap = React20.useMemo(function() {
5049
+ return getGapWidth(gapMode);
5050
+ }, [gapMode]);
5051
+ return React20.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
5052
+ };
5053
+
5054
+ // ../node_modules/.pnpm/react-remove-scroll@2.7.1_@types+react@18.3.14_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js
5055
+ var passiveSupported = false;
5056
+ if (typeof window !== "undefined") {
5057
+ try {
5058
+ options = Object.defineProperty({}, "passive", {
5059
+ get: function() {
5060
+ passiveSupported = true;
5061
+ return true;
5062
+ }
5063
+ });
5064
+ window.addEventListener("test", options, options);
5065
+ window.removeEventListener("test", options, options);
5066
+ } catch (err) {
5067
+ passiveSupported = false;
5068
+ }
5069
+ }
5070
+ var options;
5071
+ var nonPassive = passiveSupported ? { passive: false } : false;
5072
+
5073
+ // ../node_modules/.pnpm/react-remove-scroll@2.7.1_@types+react@18.3.14_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/handleScroll.js
5074
+ var alwaysContainsScroll = function(node) {
5075
+ return node.tagName === "TEXTAREA";
5076
+ };
5077
+ var elementCanBeScrolled = function(node, overflow) {
5078
+ if (!(node instanceof Element)) {
5079
+ return false;
5080
+ }
5081
+ var styles = window.getComputedStyle(node);
5082
+ return (
5083
+ // not-not-scrollable
5084
+ styles[overflow] !== "hidden" && // contains scroll inside self
5085
+ !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
5086
+ );
5087
+ };
5088
+ var elementCouldBeVScrolled = function(node) {
5089
+ return elementCanBeScrolled(node, "overflowY");
5090
+ };
5091
+ var elementCouldBeHScrolled = function(node) {
5092
+ return elementCanBeScrolled(node, "overflowX");
5093
+ };
5094
+ var locationCouldBeScrolled = function(axis, node) {
5095
+ var ownerDocument = node.ownerDocument;
5096
+ var current = node;
5097
+ do {
5098
+ if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
5099
+ current = current.host;
5100
+ }
5101
+ var isScrollable = elementCouldBeScrolled(axis, current);
5102
+ if (isScrollable) {
5103
+ var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
5104
+ if (scrollHeight > clientHeight) {
5105
+ return true;
5106
+ }
5107
+ }
5108
+ current = current.parentNode;
5109
+ } while (current && current !== ownerDocument.body);
5110
+ return false;
5111
+ };
5112
+ var getVScrollVariables = function(_a) {
5113
+ var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
5114
+ return [
5115
+ scrollTop,
5116
+ scrollHeight,
5117
+ clientHeight
5118
+ ];
5119
+ };
5120
+ var getHScrollVariables = function(_a) {
5121
+ var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
5122
+ return [
5123
+ scrollLeft,
5124
+ scrollWidth,
5125
+ clientWidth
5126
+ ];
5127
+ };
5128
+ var elementCouldBeScrolled = function(axis, node) {
5129
+ return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
5130
+ };
5131
+ var getScrollVariables = function(axis, node) {
5132
+ return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
5133
+ };
5134
+ var getDirectionFactor = function(axis, direction) {
5135
+ return axis === "h" && direction === "rtl" ? -1 : 1;
5136
+ };
5137
+ var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
5138
+ var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
5139
+ var delta = directionFactor * sourceDelta;
5140
+ var target = event.target;
5141
+ var targetInLock = endTarget.contains(target);
5142
+ var shouldCancelScroll = false;
5143
+ var isDeltaPositive = delta > 0;
5144
+ var availableScroll = 0;
5145
+ var availableScrollTop = 0;
5146
+ do {
5147
+ if (!target) {
5148
+ break;
5149
+ }
5150
+ var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
5151
+ var elementScroll = scroll_1 - capacity - directionFactor * position;
5152
+ if (position || elementScroll) {
5153
+ if (elementCouldBeScrolled(axis, target)) {
5154
+ availableScroll += elementScroll;
5155
+ availableScrollTop += position;
5156
+ }
5157
+ }
5158
+ var parent_1 = target.parentNode;
5159
+ target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
5160
+ } while (
5161
+ // portaled content
5162
+ !targetInLock && target !== document.body || // self content
5163
+ targetInLock && (endTarget.contains(target) || endTarget === target)
5164
+ );
5165
+ if (isDeltaPositive && (noOverscroll && Math.abs(availableScroll) < 1 || !noOverscroll && delta > availableScroll)) {
5166
+ shouldCancelScroll = true;
5167
+ } else if (!isDeltaPositive && (noOverscroll && Math.abs(availableScrollTop) < 1 || !noOverscroll && -delta > availableScrollTop)) {
5168
+ shouldCancelScroll = true;
5169
+ }
5170
+ return shouldCancelScroll;
5171
+ };
5172
+
5173
+ // ../node_modules/.pnpm/react-remove-scroll@2.7.1_@types+react@18.3.14_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/SideEffect.js
5174
+ var getTouchXY = function(event) {
5175
+ return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
5176
+ };
5177
+ var getDeltaXY = function(event) {
5178
+ return [event.deltaX, event.deltaY];
5179
+ };
5180
+ var extractRef = function(ref) {
5181
+ return ref && "current" in ref ? ref.current : ref;
5182
+ };
5183
+ var deltaCompare = function(x, y) {
5184
+ return x[0] === y[0] && x[1] === y[1];
5185
+ };
5186
+ var generateStyle = function(id) {
5187
+ return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
5188
+ };
5189
+ var idCounter = 0;
5190
+ var lockStack = [];
5191
+ function RemoveScrollSideCar(props) {
5192
+ var shouldPreventQueue = React21.useRef([]);
5193
+ var touchStartRef = React21.useRef([0, 0]);
5194
+ var activeAxis = React21.useRef();
5195
+ var id = React21.useState(idCounter++)[0];
5196
+ var Style2 = React21.useState(styleSingleton)[0];
5197
+ var lastProps = React21.useRef(props);
5198
+ React21.useEffect(function() {
5199
+ lastProps.current = props;
5200
+ }, [props]);
5201
+ React21.useEffect(function() {
5202
+ if (props.inert) {
5203
+ document.body.classList.add("block-interactivity-".concat(id));
5204
+ var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
5205
+ allow_1.forEach(function(el) {
5206
+ return el.classList.add("allow-interactivity-".concat(id));
5207
+ });
5208
+ return function() {
5209
+ document.body.classList.remove("block-interactivity-".concat(id));
5210
+ allow_1.forEach(function(el) {
5211
+ return el.classList.remove("allow-interactivity-".concat(id));
5212
+ });
5213
+ };
5214
+ }
5215
+ return;
5216
+ }, [props.inert, props.lockRef.current, props.shards]);
5217
+ var shouldCancelEvent = React21.useCallback(function(event, parent) {
5218
+ if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
5219
+ return !lastProps.current.allowPinchZoom;
5220
+ }
5221
+ var touch = getTouchXY(event);
5222
+ var touchStart = touchStartRef.current;
5223
+ var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
5224
+ var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
5225
+ var currentAxis;
5226
+ var target = event.target;
5227
+ var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
5228
+ if ("touches" in event && moveDirection === "h" && target.type === "range") {
5229
+ return false;
5230
+ }
5231
+ var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
5232
+ if (!canBeScrolledInMainDirection) {
5233
+ return true;
5234
+ }
5235
+ if (canBeScrolledInMainDirection) {
5236
+ currentAxis = moveDirection;
5237
+ } else {
5238
+ currentAxis = moveDirection === "v" ? "h" : "v";
5239
+ canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
5240
+ }
5241
+ if (!canBeScrolledInMainDirection) {
5242
+ return false;
5243
+ }
5244
+ if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
5245
+ activeAxis.current = currentAxis;
5246
+ }
5247
+ if (!currentAxis) {
5248
+ return true;
5249
+ }
5250
+ var cancelingAxis = activeAxis.current || currentAxis;
5251
+ return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY, true);
5252
+ }, []);
5253
+ var shouldPrevent = React21.useCallback(function(_event) {
5254
+ var event = _event;
5255
+ if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
5256
+ return;
5257
+ }
5258
+ var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
5259
+ var sourceEvent = shouldPreventQueue.current.filter(function(e) {
5260
+ return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
5261
+ })[0];
5262
+ if (sourceEvent && sourceEvent.should) {
5263
+ if (event.cancelable) {
5264
+ event.preventDefault();
5265
+ }
5266
+ return;
5267
+ }
5268
+ if (!sourceEvent) {
5269
+ var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
5270
+ return node.contains(event.target);
5271
+ });
5272
+ var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
5273
+ if (shouldStop) {
5274
+ if (event.cancelable) {
5275
+ event.preventDefault();
5276
+ }
5277
+ }
5278
+ }
5279
+ }, []);
5280
+ var shouldCancel = React21.useCallback(function(name, delta, target, should) {
5281
+ var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
5282
+ shouldPreventQueue.current.push(event);
5283
+ setTimeout(function() {
5284
+ shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
5285
+ return e !== event;
5286
+ });
5287
+ }, 1);
5288
+ }, []);
5289
+ var scrollTouchStart = React21.useCallback(function(event) {
5290
+ touchStartRef.current = getTouchXY(event);
5291
+ activeAxis.current = void 0;
5292
+ }, []);
5293
+ var scrollWheel = React21.useCallback(function(event) {
5294
+ shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
5295
+ }, []);
5296
+ var scrollTouchMove = React21.useCallback(function(event) {
5297
+ shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
5298
+ }, []);
5299
+ React21.useEffect(function() {
5300
+ lockStack.push(Style2);
5301
+ props.setCallbacks({
5302
+ onScrollCapture: scrollWheel,
5303
+ onWheelCapture: scrollWheel,
5304
+ onTouchMoveCapture: scrollTouchMove
5305
+ });
5306
+ document.addEventListener("wheel", shouldPrevent, nonPassive);
5307
+ document.addEventListener("touchmove", shouldPrevent, nonPassive);
5308
+ document.addEventListener("touchstart", scrollTouchStart, nonPassive);
5309
+ return function() {
5310
+ lockStack = lockStack.filter(function(inst) {
5311
+ return inst !== Style2;
5312
+ });
5313
+ document.removeEventListener("wheel", shouldPrevent, nonPassive);
5314
+ document.removeEventListener("touchmove", shouldPrevent, nonPassive);
5315
+ document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
5316
+ };
5317
+ }, []);
5318
+ var removeScrollBar = props.removeScrollBar, inert = props.inert;
5319
+ return React21.createElement(
5320
+ React21.Fragment,
5321
+ null,
5322
+ inert ? React21.createElement(Style2, { styles: generateStyle(id) }) : null,
5323
+ removeScrollBar ? React21.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null
5324
+ );
5325
+ }
5326
+ function getOutermostShadowParent(node) {
5327
+ var shadowParent = null;
5328
+ while (node !== null) {
5329
+ if (node instanceof ShadowRoot) {
5330
+ shadowParent = node.host;
5331
+ node = node.host;
5332
+ }
5333
+ node = node.parentNode;
5334
+ }
5335
+ return shadowParent;
5336
+ }
5337
+
5338
+ // ../node_modules/.pnpm/react-remove-scroll@2.7.1_@types+react@18.3.14_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/sidecar.js
5339
+ var sidecar_default = exportSidecar(effectCar, RemoveScrollSideCar);
5340
+
5341
+ // ../node_modules/.pnpm/react-remove-scroll@2.7.1_@types+react@18.3.14_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/Combination.js
5342
+ var ReactRemoveScroll = React24.forwardRef(function(props, ref) {
5343
+ return React24.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: sidecar_default }));
5344
+ });
5345
+ ReactRemoveScroll.classNames = RemoveScroll.classNames;
5346
+ var Combination_default = ReactRemoveScroll;
5347
+
5348
+ // ../node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es2015/index.js
5349
+ var getDefaultParent = function(originalTarget) {
5350
+ if (typeof document === "undefined") {
5351
+ return null;
5352
+ }
5353
+ var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
5354
+ return sampleTarget.ownerDocument.body;
5355
+ };
5356
+ var counterMap = /* @__PURE__ */ new WeakMap();
5357
+ var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
5358
+ var markerMap = {};
5359
+ var lockCount = 0;
5360
+ var unwrapHost = function(node) {
5361
+ return node && (node.host || unwrapHost(node.parentNode));
5362
+ };
5363
+ var correctTargets = function(parent, targets) {
5364
+ return targets.map(function(target) {
5365
+ if (parent.contains(target)) {
5366
+ return target;
5367
+ }
5368
+ var correctedTarget = unwrapHost(target);
5369
+ if (correctedTarget && parent.contains(correctedTarget)) {
5370
+ return correctedTarget;
5371
+ }
5372
+ console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
5373
+ return null;
5374
+ }).filter(function(x) {
5375
+ return Boolean(x);
5376
+ });
5377
+ };
5378
+ var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
5379
+ var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
5380
+ if (!markerMap[markerName]) {
5381
+ markerMap[markerName] = /* @__PURE__ */ new WeakMap();
5382
+ }
5383
+ var markerCounter = markerMap[markerName];
5384
+ var hiddenNodes = [];
5385
+ var elementsToKeep = /* @__PURE__ */ new Set();
5386
+ var elementsToStop = new Set(targets);
5387
+ var keep = function(el) {
5388
+ if (!el || elementsToKeep.has(el)) {
5389
+ return;
5390
+ }
5391
+ elementsToKeep.add(el);
5392
+ keep(el.parentNode);
5393
+ };
5394
+ targets.forEach(keep);
5395
+ var deep = function(parent) {
5396
+ if (!parent || elementsToStop.has(parent)) {
5397
+ return;
5398
+ }
5399
+ Array.prototype.forEach.call(parent.children, function(node) {
5400
+ if (elementsToKeep.has(node)) {
5401
+ deep(node);
5402
+ } else {
5403
+ try {
5404
+ var attr = node.getAttribute(controlAttribute);
5405
+ var alreadyHidden = attr !== null && attr !== "false";
5406
+ var counterValue = (counterMap.get(node) || 0) + 1;
5407
+ var markerValue = (markerCounter.get(node) || 0) + 1;
5408
+ counterMap.set(node, counterValue);
5409
+ markerCounter.set(node, markerValue);
5410
+ hiddenNodes.push(node);
5411
+ if (counterValue === 1 && alreadyHidden) {
5412
+ uncontrolledNodes.set(node, true);
5413
+ }
5414
+ if (markerValue === 1) {
5415
+ node.setAttribute(markerName, "true");
5416
+ }
5417
+ if (!alreadyHidden) {
5418
+ node.setAttribute(controlAttribute, "true");
5419
+ }
5420
+ } catch (e) {
5421
+ console.error("aria-hidden: cannot operate on ", node, e);
5422
+ }
5423
+ }
5424
+ });
5425
+ };
5426
+ deep(parentNode);
5427
+ elementsToKeep.clear();
5428
+ lockCount++;
5429
+ return function() {
5430
+ hiddenNodes.forEach(function(node) {
5431
+ var counterValue = counterMap.get(node) - 1;
5432
+ var markerValue = markerCounter.get(node) - 1;
5433
+ counterMap.set(node, counterValue);
5434
+ markerCounter.set(node, markerValue);
5435
+ if (!counterValue) {
5436
+ if (!uncontrolledNodes.has(node)) {
5437
+ node.removeAttribute(controlAttribute);
5438
+ }
5439
+ uncontrolledNodes.delete(node);
5440
+ }
5441
+ if (!markerValue) {
5442
+ node.removeAttribute(markerName);
5443
+ }
5444
+ });
5445
+ lockCount--;
5446
+ if (!lockCount) {
5447
+ counterMap = /* @__PURE__ */ new WeakMap();
5448
+ counterMap = /* @__PURE__ */ new WeakMap();
5449
+ uncontrolledNodes = /* @__PURE__ */ new WeakMap();
5450
+ markerMap = {};
5451
+ }
5452
+ };
5453
+ };
5454
+ var hideOthers = function(originalTarget, parentNode, markerName) {
5455
+ if (markerName === void 0) {
5456
+ markerName = "data-aria-hidden";
5457
+ }
5458
+ var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
5459
+ var activeParentNode = parentNode || getDefaultParent(originalTarget);
5460
+ if (!activeParentNode) {
5461
+ return function() {
5462
+ return null;
5463
+ };
5464
+ }
5465
+ targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
5466
+ return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
5467
+ };
5468
+
5469
+ // ../node_modules/.pnpm/@radix-ui+react-dialog@1.1.14_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@18.3_osy3texbcyy7oe3sqigksqvg74/node_modules/@radix-ui/react-dialog/dist/index.mjs
5470
+ var import_jsx_runtime8 = require("react/jsx-runtime");
5471
+ var DIALOG_NAME = "Dialog";
5472
+ var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
5473
+ var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
5474
+ var Dialog = (props) => {
5475
+ const {
5476
+ __scopeDialog,
5477
+ children,
5478
+ open: openProp,
5479
+ defaultOpen,
5480
+ onOpenChange,
5481
+ modal = true
5482
+ } = props;
5483
+ const triggerRef = React25.useRef(null);
5484
+ const contentRef = React25.useRef(null);
5485
+ const [open, setOpen] = useControllableState({
5486
+ prop: openProp,
5487
+ defaultProp: defaultOpen ?? false,
5488
+ onChange: onOpenChange,
5489
+ caller: DIALOG_NAME
5490
+ });
5491
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5492
+ DialogProvider,
5493
+ {
5494
+ scope: __scopeDialog,
5495
+ triggerRef,
5496
+ contentRef,
5497
+ contentId: useId(),
5498
+ titleId: useId(),
5499
+ descriptionId: useId(),
5500
+ open,
5501
+ onOpenChange: setOpen,
5502
+ onOpenToggle: React25.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
5503
+ modal,
5504
+ children
5505
+ }
5506
+ );
5507
+ };
5508
+ Dialog.displayName = DIALOG_NAME;
5509
+ var TRIGGER_NAME = "DialogTrigger";
5510
+ var DialogTrigger = React25.forwardRef(
5511
+ (props, forwardedRef) => {
5512
+ const { __scopeDialog, ...triggerProps } = props;
5513
+ const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
5514
+ const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
5515
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5516
+ Primitive.button,
5517
+ {
5518
+ type: "button",
5519
+ "aria-haspopup": "dialog",
5520
+ "aria-expanded": context.open,
5521
+ "aria-controls": context.contentId,
5522
+ "data-state": getState(context.open),
5523
+ ...triggerProps,
5524
+ ref: composedTriggerRef,
5525
+ onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
5526
+ }
5527
+ );
5528
+ }
5529
+ );
5530
+ DialogTrigger.displayName = TRIGGER_NAME;
5531
+ var PORTAL_NAME2 = "DialogPortal";
5532
+ var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME2, {
5533
+ forceMount: void 0
5534
+ });
5535
+ var DialogPortal = (props) => {
5536
+ const { __scopeDialog, forceMount, children, container } = props;
5537
+ const context = useDialogContext(PORTAL_NAME2, __scopeDialog);
5538
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PortalProvider, { scope: __scopeDialog, forceMount, children: React25.Children.map(children, (child) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Portal, { asChild: true, container, children: child }) })) });
5539
+ };
5540
+ DialogPortal.displayName = PORTAL_NAME2;
5541
+ var OVERLAY_NAME = "DialogOverlay";
5542
+ var DialogOverlay = React25.forwardRef(
5543
+ (props, forwardedRef) => {
5544
+ const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
5545
+ const { forceMount = portalContext.forceMount, ...overlayProps } = props;
5546
+ const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
5547
+ return context.modal ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
5548
+ }
5549
+ );
5550
+ DialogOverlay.displayName = OVERLAY_NAME;
5551
+ var Slot2 = createSlot("DialogOverlay.RemoveScroll");
5552
+ var DialogOverlayImpl = React25.forwardRef(
5553
+ (props, forwardedRef) => {
5554
+ const { __scopeDialog, ...overlayProps } = props;
5555
+ const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
5556
+ return (
5557
+ // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
5558
+ // ie. when `Overlay` and `Content` are siblings
5559
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Combination_default, { as: Slot2, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5560
+ Primitive.div,
5561
+ {
5562
+ "data-state": getState(context.open),
5563
+ ...overlayProps,
5564
+ ref: forwardedRef,
5565
+ style: { pointerEvents: "auto", ...overlayProps.style }
5566
+ }
5567
+ ) })
5568
+ );
5569
+ }
5570
+ );
5571
+ var CONTENT_NAME = "DialogContent";
5572
+ var DialogContent = React25.forwardRef(
5573
+ (props, forwardedRef) => {
5574
+ const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
5575
+ const { forceMount = portalContext.forceMount, ...contentProps } = props;
5576
+ const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
5577
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
5578
+ }
5579
+ );
5580
+ DialogContent.displayName = CONTENT_NAME;
5581
+ var DialogContentModal = React25.forwardRef(
5582
+ (props, forwardedRef) => {
5583
+ const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
5584
+ const contentRef = React25.useRef(null);
5585
+ const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
5586
+ React25.useEffect(() => {
5587
+ const content = contentRef.current;
5588
+ if (content) return hideOthers(content);
5589
+ }, []);
5590
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5591
+ DialogContentImpl,
5592
+ {
5593
+ ...props,
5594
+ ref: composedRefs,
5595
+ trapFocus: context.open,
5596
+ disableOutsidePointerEvents: true,
5597
+ onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
5598
+ event.preventDefault();
5599
+ context.triggerRef.current?.focus();
5600
+ }),
5601
+ onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
5602
+ const originalEvent = event.detail.originalEvent;
5603
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
5604
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
5605
+ if (isRightClick) event.preventDefault();
5606
+ }),
5607
+ onFocusOutside: composeEventHandlers(
5608
+ props.onFocusOutside,
5609
+ (event) => event.preventDefault()
5610
+ )
5611
+ }
5612
+ );
5613
+ }
5614
+ );
5615
+ var DialogContentNonModal = React25.forwardRef(
5616
+ (props, forwardedRef) => {
5617
+ const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
5618
+ const hasInteractedOutsideRef = React25.useRef(false);
5619
+ const hasPointerDownOutsideRef = React25.useRef(false);
5620
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5621
+ DialogContentImpl,
5622
+ {
3930
5623
  ...props,
3931
- children: [
3932
- children,
3933
- showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
3934
- DialogPrimitive.Close,
5624
+ ref: forwardedRef,
5625
+ trapFocus: false,
5626
+ disableOutsidePointerEvents: false,
5627
+ onCloseAutoFocus: (event) => {
5628
+ props.onCloseAutoFocus?.(event);
5629
+ if (!event.defaultPrevented) {
5630
+ if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
5631
+ event.preventDefault();
5632
+ }
5633
+ hasInteractedOutsideRef.current = false;
5634
+ hasPointerDownOutsideRef.current = false;
5635
+ },
5636
+ onInteractOutside: (event) => {
5637
+ props.onInteractOutside?.(event);
5638
+ if (!event.defaultPrevented) {
5639
+ hasInteractedOutsideRef.current = true;
5640
+ if (event.detail.originalEvent.type === "pointerdown") {
5641
+ hasPointerDownOutsideRef.current = true;
5642
+ }
5643
+ }
5644
+ const target = event.target;
5645
+ const targetIsTrigger = context.triggerRef.current?.contains(target);
5646
+ if (targetIsTrigger) event.preventDefault();
5647
+ if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
5648
+ event.preventDefault();
5649
+ }
5650
+ }
5651
+ }
5652
+ );
5653
+ }
5654
+ );
5655
+ var DialogContentImpl = React25.forwardRef(
5656
+ (props, forwardedRef) => {
5657
+ const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
5658
+ const context = useDialogContext(CONTENT_NAME, __scopeDialog);
5659
+ const contentRef = React25.useRef(null);
5660
+ const composedRefs = useComposedRefs(forwardedRef, contentRef);
5661
+ useFocusGuards();
5662
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
5663
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5664
+ FocusScope,
5665
+ {
5666
+ asChild: true,
5667
+ loop: true,
5668
+ trapped: trapFocus,
5669
+ onMountAutoFocus: onOpenAutoFocus,
5670
+ onUnmountAutoFocus: onCloseAutoFocus,
5671
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5672
+ DismissableLayer,
3935
5673
  {
3936
- "data-slot": "dialog-close",
3937
- className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
3938
- children: [
3939
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(X, {}),
3940
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "sr-only", children: "Close" })
3941
- ]
5674
+ role: "dialog",
5675
+ id: context.contentId,
5676
+ "aria-describedby": context.descriptionId,
5677
+ "aria-labelledby": context.titleId,
5678
+ "data-state": getState(context.open),
5679
+ ...contentProps,
5680
+ ref: composedRefs,
5681
+ onDismiss: () => context.onOpenChange(false)
3942
5682
  }
3943
5683
  )
3944
- ]
5684
+ }
5685
+ ),
5686
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
5687
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TitleWarning, { titleId: context.titleId }),
5688
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
5689
+ ] })
5690
+ ] });
5691
+ }
5692
+ );
5693
+ var TITLE_NAME = "DialogTitle";
5694
+ var DialogTitle = React25.forwardRef(
5695
+ (props, forwardedRef) => {
5696
+ const { __scopeDialog, ...titleProps } = props;
5697
+ const context = useDialogContext(TITLE_NAME, __scopeDialog);
5698
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
5699
+ }
5700
+ );
5701
+ DialogTitle.displayName = TITLE_NAME;
5702
+ var DESCRIPTION_NAME = "DialogDescription";
5703
+ var DialogDescription = React25.forwardRef(
5704
+ (props, forwardedRef) => {
5705
+ const { __scopeDialog, ...descriptionProps } = props;
5706
+ const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
5707
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
5708
+ }
5709
+ );
5710
+ DialogDescription.displayName = DESCRIPTION_NAME;
5711
+ var CLOSE_NAME = "DialogClose";
5712
+ var DialogClose = React25.forwardRef(
5713
+ (props, forwardedRef) => {
5714
+ const { __scopeDialog, ...closeProps } = props;
5715
+ const context = useDialogContext(CLOSE_NAME, __scopeDialog);
5716
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5717
+ Primitive.button,
5718
+ {
5719
+ type: "button",
5720
+ ...closeProps,
5721
+ ref: forwardedRef,
5722
+ onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
3945
5723
  }
3946
- )
3947
- ] });
5724
+ );
5725
+ }
5726
+ );
5727
+ DialogClose.displayName = CLOSE_NAME;
5728
+ function getState(open) {
5729
+ return open ? "open" : "closed";
3948
5730
  }
3949
- function DialogFooter({ className, ...props }) {
3950
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3951
- "div",
5731
+ var TITLE_WARNING_NAME = "DialogTitleWarning";
5732
+ var [WarningProvider, useWarningContext] = createContext22(TITLE_WARNING_NAME, {
5733
+ contentName: CONTENT_NAME,
5734
+ titleName: TITLE_NAME,
5735
+ docsSlug: "dialog"
5736
+ });
5737
+ var TitleWarning = ({ titleId }) => {
5738
+ const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
5739
+ const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
5740
+
5741
+ If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
5742
+
5743
+ For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
5744
+ React25.useEffect(() => {
5745
+ if (titleId) {
5746
+ const hasTitle = document.getElementById(titleId);
5747
+ if (!hasTitle) console.error(MESSAGE);
5748
+ }
5749
+ }, [MESSAGE, titleId]);
5750
+ return null;
5751
+ };
5752
+ var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
5753
+ var DescriptionWarning = ({ contentRef, descriptionId }) => {
5754
+ const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
5755
+ const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
5756
+ React25.useEffect(() => {
5757
+ const describedById = contentRef.current?.getAttribute("aria-describedby");
5758
+ if (descriptionId && describedById) {
5759
+ const hasDescription = document.getElementById(descriptionId);
5760
+ if (!hasDescription) console.warn(MESSAGE);
5761
+ }
5762
+ }, [MESSAGE, contentRef, descriptionId]);
5763
+ return null;
5764
+ };
5765
+ var Root = Dialog;
5766
+ var Portal2 = DialogPortal;
5767
+ var Overlay = DialogOverlay;
5768
+ var Content = DialogContent;
5769
+ var Title = DialogTitle;
5770
+ var Description = DialogDescription;
5771
+ var Close = DialogClose;
5772
+
5773
+ // src/libraries/react/components/ui/dialog.tsx
5774
+ var import_jsx_runtime9 = require("react/jsx-runtime");
5775
+ var Dialog2 = Root;
5776
+ var DialogPortal2 = ({
5777
+ children,
5778
+ ...props
5779
+ }) => {
5780
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Portal2, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "au-root", children }) });
5781
+ };
5782
+ var DialogOverlay2 = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5783
+ Overlay,
5784
+ {
5785
+ ref,
5786
+ className: cn(
5787
+ "au-fixed au-inset-0 au-z-50 au-bg-black/80 data-[state=open]:au-animate-in data-[state=closed]:au-animate-out data-[state=closed]:au-fade-out-0 data-[state=open]:au-fade-in-0",
5788
+ className
5789
+ ),
5790
+ ...props
5791
+ }
5792
+ ));
5793
+ DialogOverlay2.displayName = Overlay.displayName;
5794
+ var DialogContent2 = React26.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogPortal2, { children: [
5795
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogOverlay2, {}),
5796
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
5797
+ Content,
3952
5798
  {
3953
- "data-slot": "dialog-footer",
5799
+ ref,
3954
5800
  className: cn(
3955
- "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
5801
+ `au-fixed au-left-[50%] au-top-[50%] au-z-50 au-grid au-w-full au-max-w-lg au-translate-x-[-50%] au-translate-y-[-50%] au-gap-4 au-border au-bg-background au-p-6 au-shadow-lg au-duration-200 data-[state=open]:au-animate-in data-[state=closed]:au-animate-out data-[state=closed]:au-fade-out-0 data-[state=open]:au-fade-in-0 data-[state=closed]:au-zoom-out-95 data-[state=open]:au-zoom-in-95 data-[state=closed]:au-slide-out-to-left-1/2 data-[state=closed]:au-slide-out-to-top-[48%] data-[state=open]:au-slide-in-from-left-1/2 data-[state=open]:au-slide-in-from-top-[48%] sm:au-rounded-lg`,
3956
5802
  className
3957
5803
  ),
3958
- ...props
5804
+ ...props,
5805
+ children: [
5806
+ children,
5807
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Close, { className: "au-absolute au-right-4 au-top-4 au-rounded-sm au-opacity-70 au-ring-offset-background au-transition-opacity hover:au-opacity-100 focus:au-outline-none focus:au-ring-2 focus:au-ring-ring focus:au-ring-offset-2 disabled:au-pointer-events-none data-[state=open]:au-bg-accent data-[state=open]:au-text-muted-foreground", children: [
5808
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(X, { className: "au-h-4 au-w-4" }),
5809
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "au-sr-only", children: "Close" })
5810
+ ] })
5811
+ ]
3959
5812
  }
3960
- );
3961
- }
3962
- function DialogTitle({
5813
+ )
5814
+ ] }));
5815
+ DialogContent2.displayName = Content.displayName;
5816
+ var DialogHeader = ({
3963
5817
  className,
3964
5818
  ...props
3965
- }) {
3966
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3967
- DialogPrimitive.Title,
3968
- {
3969
- "data-slot": "dialog-title",
3970
- className: cn("text-lg leading-none font-semibold", className),
3971
- ...props
3972
- }
3973
- );
3974
- }
5819
+ }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5820
+ "div",
5821
+ {
5822
+ className: cn(
5823
+ "au-flex au-flex-col au-space-y-1.5 au-text-center sm:au-text-left",
5824
+ className
5825
+ ),
5826
+ ...props
5827
+ }
5828
+ );
5829
+ DialogHeader.displayName = "DialogHeader";
5830
+ var DialogFooter = ({
5831
+ className,
5832
+ ...props
5833
+ }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5834
+ "div",
5835
+ {
5836
+ className: cn(
5837
+ "au-flex au-flex-col-reverse sm:au-flex-row sm:au-justify-end sm:au-space-x-2",
5838
+ className
5839
+ ),
5840
+ ...props
5841
+ }
5842
+ );
5843
+ DialogFooter.displayName = "DialogFooter";
5844
+ var DialogTitle2 = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5845
+ Title,
5846
+ {
5847
+ ref,
5848
+ className: cn(
5849
+ "au-text-lg au-font-semibold au-leading-none au-tracking-tight",
5850
+ className
5851
+ ),
5852
+ ...props
5853
+ }
5854
+ ));
5855
+ DialogTitle2.displayName = Title.displayName;
5856
+ var DialogDescription2 = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5857
+ Description,
5858
+ {
5859
+ ref,
5860
+ className: cn("au-text-sm au-text-muted-foreground", className),
5861
+ ...props
5862
+ }
5863
+ ));
5864
+ DialogDescription2.displayName = Description.displayName;
3975
5865
 
3976
5866
  // src/libraries/react/components/attach-dialog/lib/attach-content.tsx
3977
- var import_jsx_runtime5 = require("react/jsx-runtime");
5867
+ var import_jsx_runtime10 = require("react/jsx-runtime");
3978
5868
  var getAttachContent = (preview) => {
3979
5869
  const {
3980
5870
  scenario,
@@ -3987,11 +5877,11 @@ var getAttachContent = (preview) => {
3987
5877
  switch (scenario) {
3988
5878
  case "scheduled":
3989
5879
  return {
3990
- title: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { children: [
5880
+ title: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { children: [
3991
5881
  product_name,
3992
5882
  " product already scheduled"
3993
5883
  ] }),
3994
- message: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { children: [
5884
+ message: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { children: [
3995
5885
  "You are currently on product ",
3996
5886
  current_product_name,
3997
5887
  " and are scheduled to start ",
@@ -4003,17 +5893,17 @@ var getAttachContent = (preview) => {
4003
5893
  };
4004
5894
  case "active":
4005
5895
  return {
4006
- title: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: "Product already active" }),
4007
- message: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: "You are already subscribed to this product." })
5896
+ title: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: "Product already active" }),
5897
+ message: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: "You are already subscribed to this product." })
4008
5898
  };
4009
5899
  case "new":
4010
5900
  if (recurring) {
4011
5901
  return {
4012
- title: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { children: [
5902
+ title: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { children: [
4013
5903
  "Subscribe to ",
4014
5904
  product_name
4015
5905
  ] }),
4016
- message: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { children: [
5906
+ message: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { children: [
4017
5907
  "By clicking confirm, you will be subscribed to ",
4018
5908
  product_name,
4019
5909
  " and your card will be charged immediately."
@@ -4021,11 +5911,11 @@ var getAttachContent = (preview) => {
4021
5911
  };
4022
5912
  } else {
4023
5913
  return {
4024
- title: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { children: [
5914
+ title: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { children: [
4025
5915
  "Purchase ",
4026
5916
  product_name
4027
5917
  ] }),
4028
- message: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { children: [
5918
+ message: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { children: [
4029
5919
  "By clicking confirm, you will purchase ",
4030
5920
  product_name,
4031
5921
  " and your card will be charged immediately."
@@ -4034,8 +5924,8 @@ var getAttachContent = (preview) => {
4034
5924
  }
4035
5925
  case "renew":
4036
5926
  return {
4037
- title: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: "Renew" }),
4038
- message: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { children: [
5927
+ title: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: "Renew" }),
5928
+ message: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { children: [
4039
5929
  "By clicking confirm, you will renew your subscription to",
4040
5930
  " ",
4041
5931
  product_name,
@@ -4044,11 +5934,11 @@ var getAttachContent = (preview) => {
4044
5934
  };
4045
5935
  case "upgrade":
4046
5936
  return {
4047
- title: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { children: [
5937
+ title: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { children: [
4048
5938
  "Upgrade to ",
4049
5939
  product_name
4050
5940
  ] }),
4051
- message: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { children: [
5941
+ message: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { children: [
4052
5942
  "By clicking confirm, you will upgrade to ",
4053
5943
  product_name,
4054
5944
  " and your payment method will be charged immediately."
@@ -4056,11 +5946,11 @@ var getAttachContent = (preview) => {
4056
5946
  };
4057
5947
  case "downgrade":
4058
5948
  return {
4059
- title: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { children: [
5949
+ title: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { children: [
4060
5950
  "Downgrade to ",
4061
5951
  product_name
4062
5952
  ] }),
4063
- message: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { children: [
5953
+ message: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { children: [
4064
5954
  "By clicking confirm, your current subscription to",
4065
5955
  " ",
4066
5956
  current_product_name,
@@ -4074,8 +5964,8 @@ var getAttachContent = (preview) => {
4074
5964
  };
4075
5965
  case "cancel":
4076
5966
  return {
4077
- title: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: "Cancel" }),
4078
- message: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { children: [
5967
+ title: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: "Cancel" }),
5968
+ message: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { children: [
4079
5969
  "By clicking confirm, your subscription to ",
4080
5970
  current_product_name,
4081
5971
  " ",
@@ -4086,18 +5976,18 @@ var getAttachContent = (preview) => {
4086
5976
  };
4087
5977
  default:
4088
5978
  return {
4089
- title: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: "Change Subscription" }),
4090
- message: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: "You are about to change your subscription." })
5979
+ title: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: "Change Subscription" }),
5980
+ message: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: "You are about to change your subscription." })
4091
5981
  };
4092
5982
  }
4093
5983
  };
4094
5984
 
4095
5985
  // src/libraries/react/components/attach-dialog/attach-dialog-synced.tsx
4096
- var import_jsx_runtime6 = require("react/jsx-runtime");
5986
+ var import_jsx_runtime11 = require("react/jsx-runtime");
4097
5987
  function AttachDialog(params) {
4098
5988
  const { attach } = useCustomer();
4099
- const [loading, setLoading] = (0, import_react7.useState)(false);
4100
- const [optionsInput, setOptionsInput] = (0, import_react7.useState)(
5989
+ const [loading, setLoading] = (0, import_react6.useState)(false);
5990
+ const [optionsInput, setOptionsInput] = (0, import_react6.useState)(
4101
5991
  params?.preview?.options || []
4102
5992
  );
4103
5993
  const getTotalPrice = () => {
@@ -4109,29 +5999,31 @@ function AttachDialog(params) {
4109
5999
  });
4110
6000
  return sum;
4111
6001
  };
4112
- (0, import_react7.useEffect)(() => {
6002
+ (0, import_react6.useEffect)(() => {
4113
6003
  setOptionsInput(params?.preview?.options || []);
4114
6004
  }, [params?.preview?.options]);
4115
6005
  if (!params || !params.preview) {
4116
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, {});
6006
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, {});
4117
6007
  }
4118
6008
  const { open, setOpen, preview } = params;
4119
6009
  const { items, due_today } = preview;
4120
6010
  const { title, message } = getAttachContent(preview);
4121
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
4122
- DialogContent,
6011
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Dialog2, { open, onOpenChange: setOpen, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
6012
+ DialogContent2,
4123
6013
  {
4124
- className: cn("p-0 pt-4 gap-0 text-foreground overflow-hidden text-sm"),
6014
+ className: cn(
6015
+ "au-p-0 au-pt-4 au-gap-0 au-text-foreground au-overflow-hidden au-text-sm"
6016
+ ),
4125
6017
  children: [
4126
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogTitle, { className: cn("px-6 mb-1 "), children: title }),
4127
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cn("px-6 mt-1 mb-4 text-muted-foreground"), children: message }),
4128
- (items || optionsInput.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mb-6 px-6", children: [
4129
- items?.map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(PriceItem, { children: [
4130
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "truncate flex-1", children: item.description }),
4131
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: item.price })
6018
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DialogTitle2, { className: cn("au-px-6 au-mb-1 "), children: title }),
6019
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: cn("au-px-6 au-mt-1 au-mb-4 au-text-muted-foreground"), children: message }),
6020
+ (items || optionsInput.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "au-mb-6 au-px-6", children: [
6021
+ items?.map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(PriceItem, { children: [
6022
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "au-truncate au-flex-1", children: item.description }),
6023
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: item.price })
4132
6024
  ] }, item.description)),
4133
6025
  optionsInput?.map((option, index) => {
4134
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
6026
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4135
6027
  OptionsInput,
4136
6028
  {
4137
6029
  option,
@@ -4143,15 +6035,15 @@ function AttachDialog(params) {
4143
6035
  );
4144
6036
  })
4145
6037
  ] }),
4146
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(DialogFooter, { className: "flex flex-col sm:flex-row justify-between gap-x-4 py-2 pl-6 pr-3 bg-secondary border-t shadow-inner", children: [
4147
- due_today && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(TotalPrice, { children: [
4148
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Due Today" }),
4149
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: new Intl.NumberFormat("en-US", {
6038
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(DialogFooter, { className: "au-flex au-flex-col sm:au-flex-row au-justify-between au-gap-x-4 au-py-2 au-pl-6 au-pr-3 au-bg-secondary au-border-t au-shadow-inner", children: [
6039
+ due_today && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(TotalPrice, { children: [
6040
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: "Due Today" }),
6041
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: new Intl.NumberFormat("en-US", {
4150
6042
  style: "currency",
4151
6043
  currency: due_today.currency
4152
6044
  }).format(getTotalPrice()) })
4153
6045
  ] }),
4154
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
6046
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4155
6047
  Button,
4156
6048
  {
4157
6049
  size: "sm",
@@ -4168,8 +6060,8 @@ function AttachDialog(params) {
4168
6060
  setLoading(false);
4169
6061
  },
4170
6062
  disabled: loading,
4171
- className: "min-w-16 flex items-center gap-2",
4172
- children: loading ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LoaderCircle, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "whitespace-nowrap flex gap-1", children: "Confirm" }) })
6063
+ className: "au-min-w-16 au-flex au-items-center au-gap-2",
6064
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LoaderCircle, { className: "au-w-4 au-h-4 au-animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "au-whitespace-nowrap au-flex au-gap-1", children: "Confirm" }) })
4173
6065
  }
4174
6066
  )
4175
6067
  ] })
@@ -4182,11 +6074,11 @@ var PriceItem = ({
4182
6074
  className,
4183
6075
  ...props
4184
6076
  }) => {
4185
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
6077
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4186
6078
  "div",
4187
6079
  {
4188
6080
  className: cn(
4189
- "flex flex-col pb-4 sm:pb-0 gap-1 sm:flex-row justify-between sm:h-7 sm:gap-2 sm:items-center",
6081
+ "au-flex au-flex-col au-pb-4 sm:au-pb-0 au-gap-1 sm:au-flex-row au-justify-between sm:au-h-7 sm:au-gap-2 sm:au-items-center",
4190
6082
  className
4191
6083
  ),
4192
6084
  ...props,
@@ -4203,9 +6095,9 @@ var OptionsInput = ({
4203
6095
  ...props
4204
6096
  }) => {
4205
6097
  const { feature_name, billing_units, quantity, price } = option;
4206
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(PriceItem, { children: [
4207
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: feature_name }),
4208
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
6098
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(PriceItem, { children: [
6099
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: feature_name }),
6100
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4209
6101
  QuantityInput,
4210
6102
  {
4211
6103
  value: quantity ? quantity / billing_units : "",
@@ -4214,7 +6106,7 @@ var OptionsInput = ({
4214
6106
  newOptions[index].quantity = parseInt(e.target.value) * billing_units;
4215
6107
  setOptionsInput(newOptions);
4216
6108
  },
4217
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "", children: [
6109
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "", children: [
4218
6110
  "\xD7 $",
4219
6111
  price,
4220
6112
  " per ",
@@ -4227,159 +6119,620 @@ var OptionsInput = ({
4227
6119
  )
4228
6120
  ] }, feature_name);
4229
6121
  };
4230
- var QuantityInput = ({
4231
- children,
4232
- onChange,
4233
- value,
4234
- className,
4235
- ...props
6122
+ var QuantityInput = ({
6123
+ children,
6124
+ onChange,
6125
+ value,
6126
+ className,
6127
+ ...props
6128
+ }) => {
6129
+ const currentValue = Number(value) || 0;
6130
+ const handleValueChange = (newValue) => {
6131
+ const syntheticEvent = {
6132
+ target: { value: String(newValue) }
6133
+ };
6134
+ onChange(syntheticEvent);
6135
+ };
6136
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
6137
+ "div",
6138
+ {
6139
+ className: cn(className, "au-flex au-flex-row au-items-center au-gap-4"),
6140
+ ...props,
6141
+ children: [
6142
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "au-flex au-items-center au-gap-1", children: [
6143
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6144
+ Button,
6145
+ {
6146
+ variant: "outline",
6147
+ size: "icon",
6148
+ onClick: () => currentValue > 0 && handleValueChange(currentValue - 1),
6149
+ disabled: currentValue <= 0,
6150
+ className: "au-h-6 au-w-6 au-pb-0.5",
6151
+ children: "-"
6152
+ }
6153
+ ),
6154
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "au-w-8 au-text-center au-text-foreground", children: currentValue }),
6155
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6156
+ Button,
6157
+ {
6158
+ variant: "outline",
6159
+ size: "icon",
6160
+ onClick: () => handleValueChange(currentValue + 1),
6161
+ className: "au-h-6 au-w-6 au-pb-0.5",
6162
+ children: "+"
6163
+ }
6164
+ )
6165
+ ] }),
6166
+ children
6167
+ ]
6168
+ }
6169
+ );
6170
+ };
6171
+ var TotalPrice = ({ children }) => {
6172
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "au-w-full au-font-semibold au-flex au-justify-between au-items-center", children });
6173
+ };
6174
+
6175
+ // src/libraries/react/hooks/useAutumnBase.tsx
6176
+ var useAutumnBase = ({
6177
+ AutumnContext: AutumnContext2
6178
+ }) => {
6179
+ const context = useAutumnContext({ AutumnContext: AutumnContext2, name: "useAutumn" });
6180
+ const { attachDialog, paywallDialog } = context;
6181
+ const client = context.client;
6182
+ const { refetch: refetchPricingTable } = usePricingTableBase({
6183
+ AutumnContext: AutumnContext2
6184
+ });
6185
+ let {
6186
+ open: attachOpen,
6187
+ setProps: setAttachProps,
6188
+ setOpen: setAttachOpen,
6189
+ setComponent: setAttachComponent
6190
+ } = attachDialog;
6191
+ let {
6192
+ setProps: setCheckProps,
6193
+ setOpen: setCheckOpen,
6194
+ setComponent: setPaywallComponent
6195
+ } = paywallDialog;
6196
+ const attachWithoutDialog = async (params) => {
6197
+ const result = await client.attach(params);
6198
+ if (result.error) {
6199
+ return result;
6200
+ }
6201
+ let data = result.data;
6202
+ if (data?.checkout_url && typeof window !== "undefined") {
6203
+ if (params.openInNewTab) {
6204
+ window.open(data.checkout_url, "_blank");
6205
+ } else {
6206
+ window.location.href = data.checkout_url;
6207
+ }
6208
+ }
6209
+ await refetchPricingTable();
6210
+ if (setAttachOpen) {
6211
+ setAttachOpen(false);
6212
+ }
6213
+ return result;
6214
+ };
6215
+ const attachWithDialog = async (params) => {
6216
+ let { dialog, ...rest } = params;
6217
+ const { productId, entityId, entityData } = params;
6218
+ const checkRes = await client.check({
6219
+ productId,
6220
+ entityId,
6221
+ entityData,
6222
+ withPreview: true
6223
+ });
6224
+ if (checkRes.error) {
6225
+ return checkRes;
6226
+ }
6227
+ let preview = checkRes.data.preview;
6228
+ if (!preview) {
6229
+ return await attachWithoutDialog(rest);
6230
+ } else {
6231
+ setAttachProps({ preview });
6232
+ setAttachOpen(true);
6233
+ }
6234
+ return checkRes;
6235
+ };
6236
+ const attach = async (params) => {
6237
+ const { dialog, openInNewTab } = params;
6238
+ let finalDialog = dialog ? dialog : context.disableDialogs ? void 0 : AttachDialog;
6239
+ if (finalDialog && !attachOpen) {
6240
+ setAttachComponent(finalDialog);
6241
+ return await attachWithDialog(params);
6242
+ }
6243
+ return await attachWithoutDialog(params);
6244
+ };
6245
+ const cancel = async (params) => {
6246
+ const res = await client.cancel(params);
6247
+ if (res.error) {
6248
+ return res;
6249
+ }
6250
+ return res;
6251
+ };
6252
+ const check = async (params) => {
6253
+ let { dialog, withPreview } = params;
6254
+ if (dialog) {
6255
+ setPaywallComponent(dialog);
6256
+ }
6257
+ const res = await client.check({
6258
+ ...params,
6259
+ withPreview: withPreview || dialog ? true : false
6260
+ });
6261
+ if (res.error) {
6262
+ return res;
6263
+ }
6264
+ let data = res.data;
6265
+ if (data && data.preview && dialog) {
6266
+ let preview = data.preview;
6267
+ setCheckProps({ preview });
6268
+ setCheckOpen(true);
6269
+ }
6270
+ return res;
6271
+ };
6272
+ const track = async (params) => {
6273
+ const res = await client.track(params);
6274
+ if (res.error) {
6275
+ return res;
6276
+ }
6277
+ return res;
6278
+ };
6279
+ const openBillingPortal = async (params) => {
6280
+ let defaultParams = {
6281
+ openInNewTab: false
6282
+ };
6283
+ let finalParams = {
6284
+ ...defaultParams,
6285
+ ...params
6286
+ };
6287
+ const res = await client.openBillingPortal(finalParams);
6288
+ if (res.error) {
6289
+ return res;
6290
+ }
6291
+ let data = res.data;
6292
+ if (data?.url && typeof window !== "undefined") {
6293
+ if (finalParams.openInNewTab) {
6294
+ window.open(data.url, "_blank");
6295
+ } else {
6296
+ window.open(data.url, "_self");
6297
+ }
6298
+ return res;
6299
+ } else {
6300
+ return res;
6301
+ }
6302
+ };
6303
+ return {
6304
+ attach,
6305
+ check,
6306
+ track,
6307
+ cancel,
6308
+ openBillingPortal
6309
+ };
6310
+ };
6311
+
6312
+ // src/libraries/react/hooks/handleAllowed.ts
6313
+ var getCusFeature = ({
6314
+ customer,
6315
+ featureId,
6316
+ requiredBalance = 1
4236
6317
  }) => {
4237
- const currentValue = Number(value) || 0;
4238
- const handleValueChange = (newValue) => {
4239
- const syntheticEvent = {
4240
- target: { value: String(newValue) }
6318
+ let creditSchema = Object.values(customer.features).find((f) => f.credit_schema && f.credit_schema.some((c) => c.feature_id === featureId));
6319
+ if (creditSchema) {
6320
+ let schemaItem = creditSchema.credit_schema?.find((c) => c.feature_id === featureId);
6321
+ return {
6322
+ feature: creditSchema,
6323
+ requiredBalance: schemaItem.credit_amount * requiredBalance
4241
6324
  };
4242
- onChange(syntheticEvent);
6325
+ }
6326
+ return {
6327
+ cusFeature: customer.features[featureId],
6328
+ requiredBalance
4243
6329
  };
4244
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
4245
- "div",
4246
- {
4247
- className: cn(className, "flex flex-row items-center gap-4"),
4248
- ...props,
4249
- children: [
4250
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
4251
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4252
- Button,
4253
- {
4254
- variant: "outline",
4255
- size: "icon",
4256
- onClick: () => currentValue > 0 && handleValueChange(currentValue - 1),
4257
- disabled: currentValue <= 0,
4258
- className: "h-6 w-6 pb-0.5",
4259
- children: "-"
4260
- }
4261
- ),
4262
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "w-8 text-center text-foreground", children: currentValue }),
4263
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4264
- Button,
4265
- {
4266
- variant: "outline",
4267
- size: "icon",
4268
- onClick: () => handleValueChange(currentValue + 1),
4269
- className: "h-6 w-6 pb-0.5",
4270
- children: "+"
4271
- }
4272
- )
4273
- ] }),
4274
- children
4275
- ]
6330
+ };
6331
+ var handleFeatureAllowed = ({ customer, params }) => {
6332
+ let { cusFeature, requiredBalance } = getCusFeature({ customer, featureId: params.featureId });
6333
+ if (!cusFeature) return false;
6334
+ if (cusFeature.type == "static") return true;
6335
+ if (cusFeature.unlimited || cusFeature.overage_allowed) return true;
6336
+ return (cusFeature.balance || 0) >= requiredBalance;
6337
+ };
6338
+ var handleAllowed = ({ customer, params }) => {
6339
+ if (!customer) return false;
6340
+ if (!params.featureId && !params.productId) {
6341
+ throw new Error("allowed() requires either featureId or productId");
6342
+ }
6343
+ if (params.featureId) {
6344
+ return handleFeatureAllowed({ customer, params });
6345
+ }
6346
+ if (params.productId) {
6347
+ let product = customer.products.find((p) => p.id == params.productId);
6348
+ if (!product) return false;
6349
+ let status = product.status;
6350
+ if (status == "scheduled") return false;
6351
+ return true;
6352
+ }
6353
+ return false;
6354
+ };
6355
+
6356
+ // src/libraries/react/hooks/useCustomerBase.tsx
6357
+ var emptyDefaultFunctions = {
6358
+ attach: "",
6359
+ check: "",
6360
+ track: "",
6361
+ cancel: "",
6362
+ openBillingPortal: ""
6363
+ };
6364
+ var useCustomerBase = ({
6365
+ params,
6366
+ AutumnContext: AutumnContext2,
6367
+ client
6368
+ }) => {
6369
+ const queryKey = ["customer"];
6370
+ let context;
6371
+ if (AutumnContext2) {
6372
+ context = useAutumnContext({ AutumnContext: AutumnContext2, name: "useCustomer" });
6373
+ }
6374
+ if (!client) {
6375
+ client = context.client;
6376
+ }
6377
+ const fetchCustomer = async () => {
6378
+ const { data, error: error2 } = await client.createCustomer({
6379
+ errorOnNotFound: params?.errorOnNotFound,
6380
+ expand: params?.expand
6381
+ });
6382
+ if (error2) {
6383
+ throw error2;
4276
6384
  }
4277
- );
6385
+ if (!data) {
6386
+ return null;
6387
+ }
6388
+ return data;
6389
+ };
6390
+ const { data: customer, error, isLoading, mutate } = (0, import_swr2.default)(queryKey, fetchCustomer, {
6391
+ fallbackData: null,
6392
+ onErrorRetry: (error2, key, config) => {
6393
+ if (error2.code == "entity_not_found") {
6394
+ return false;
6395
+ }
6396
+ return true;
6397
+ }
6398
+ });
6399
+ let autumnFunctions = emptyDefaultFunctions;
6400
+ if (AutumnContext2) {
6401
+ autumnFunctions = useAutumnBase({ AutumnContext: AutumnContext2 });
6402
+ }
6403
+ return {
6404
+ customer: error ? null : customer,
6405
+ isLoading,
6406
+ error,
6407
+ refetch: mutate,
6408
+ ...autumnFunctions,
6409
+ createEntity: client.entities.create,
6410
+ createReferralCode: client.referrals.createCode,
6411
+ redeemReferralCode: client.referrals.redeemCode,
6412
+ allowed: (params2) => handleAllowed({ customer, params: params2 })
6413
+ };
4278
6414
  };
4279
- var TotalPrice = ({ children }) => {
4280
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-full font-semibold flex justify-between items-center", children });
6415
+
6416
+ // src/libraries/react/BaseAutumnProvider.tsx
6417
+ var import_jsx_runtime12 = require("react/jsx-runtime");
6418
+
6419
+ // src/libraries/react/ReactAutumnProvider.tsx
6420
+ var import_react8 = require("react");
6421
+ var import_jsx_runtime13 = require("react/jsx-runtime");
6422
+
6423
+ // src/libraries/react/hooks/useCustomer.tsx
6424
+ var useCustomer = (params) => {
6425
+ return useCustomerBase({
6426
+ params,
6427
+ AutumnContext
6428
+ });
6429
+ };
6430
+
6431
+ // src/libraries/react/hooks/usePricingTable.tsx
6432
+ var usePricingTable = (params) => {
6433
+ return usePricingTableBase({
6434
+ AutumnContext,
6435
+ params
6436
+ });
4281
6437
  };
4282
6438
 
6439
+ // src/libraries/react/hooks/useEntityBase.tsx
6440
+ var import_swr3 = __toESM(require("swr"));
6441
+ var import_react9 = require("react");
6442
+
4283
6443
  // src/libraries/react/components/check-dialog/check-dialog-synced.tsx
4284
- var import_react8 = require("react");
4285
- var import_jsx_runtime7 = require("react/jsx-runtime");
6444
+ var import_react10 = require("react");
6445
+ var import_jsx_runtime14 = require("react/jsx-runtime");
4286
6446
 
4287
6447
  // src/libraries/react/components/pricing-table/pricing-table-synced.tsx
4288
- var import_react10 = require("react");
6448
+ var import_react12 = require("react");
4289
6449
 
4290
6450
  // src/libraries/react/components/ui/switch.tsx
4291
- var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"));
4292
- var import_jsx_runtime8 = require("react/jsx-runtime");
4293
- function Switch({
4294
- className,
4295
- ...props
4296
- }) {
4297
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4298
- SwitchPrimitive.Root,
4299
- {
4300
- "data-slot": "switch",
4301
- className: cn(
4302
- "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
4303
- className
6451
+ var React31 = __toESM(require("react"));
6452
+
6453
+ // ../node_modules/.pnpm/@radix-ui+react-switch@1.2.5_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@18.3._uwbsid7oqv3j27entxmzcweyee/node_modules/@radix-ui/react-switch/dist/index.mjs
6454
+ var React30 = __toESM(require("react"), 1);
6455
+
6456
+ // ../node_modules/.pnpm/@radix-ui+react-use-previous@1.1.1_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-use-previous/dist/index.mjs
6457
+ var React28 = __toESM(require("react"), 1);
6458
+ function usePrevious(value) {
6459
+ const ref = React28.useRef({ value, previous: value });
6460
+ return React28.useMemo(() => {
6461
+ if (ref.current.value !== value) {
6462
+ ref.current.previous = ref.current.value;
6463
+ ref.current.value = value;
6464
+ }
6465
+ return ref.current.previous;
6466
+ }, [value]);
6467
+ }
6468
+
6469
+ // ../node_modules/.pnpm/@radix-ui+react-use-size@1.1.1_@types+react@18.3.14_react@18.3.1/node_modules/@radix-ui/react-use-size/dist/index.mjs
6470
+ var React29 = __toESM(require("react"), 1);
6471
+ function useSize(element) {
6472
+ const [size, setSize] = React29.useState(void 0);
6473
+ useLayoutEffect2(() => {
6474
+ if (element) {
6475
+ setSize({ width: element.offsetWidth, height: element.offsetHeight });
6476
+ const resizeObserver = new ResizeObserver((entries) => {
6477
+ if (!Array.isArray(entries)) {
6478
+ return;
6479
+ }
6480
+ if (!entries.length) {
6481
+ return;
6482
+ }
6483
+ const entry = entries[0];
6484
+ let width;
6485
+ let height;
6486
+ if ("borderBoxSize" in entry) {
6487
+ const borderSizeEntry = entry["borderBoxSize"];
6488
+ const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
6489
+ width = borderSize["inlineSize"];
6490
+ height = borderSize["blockSize"];
6491
+ } else {
6492
+ width = element.offsetWidth;
6493
+ height = element.offsetHeight;
6494
+ }
6495
+ setSize({ width, height });
6496
+ });
6497
+ resizeObserver.observe(element, { box: "border-box" });
6498
+ return () => resizeObserver.unobserve(element);
6499
+ } else {
6500
+ setSize(void 0);
6501
+ }
6502
+ }, [element]);
6503
+ return size;
6504
+ }
6505
+
6506
+ // ../node_modules/.pnpm/@radix-ui+react-switch@1.2.5_@types+react-dom@18.3.5_@types+react@18.3.14__@types+react@18.3._uwbsid7oqv3j27entxmzcweyee/node_modules/@radix-ui/react-switch/dist/index.mjs
6507
+ var import_jsx_runtime15 = require("react/jsx-runtime");
6508
+ var SWITCH_NAME = "Switch";
6509
+ var [createSwitchContext, createSwitchScope] = createContextScope(SWITCH_NAME);
6510
+ var [SwitchProvider, useSwitchContext] = createSwitchContext(SWITCH_NAME);
6511
+ var Switch = React30.forwardRef(
6512
+ (props, forwardedRef) => {
6513
+ const {
6514
+ __scopeSwitch,
6515
+ name,
6516
+ checked: checkedProp,
6517
+ defaultChecked,
6518
+ required,
6519
+ disabled,
6520
+ value = "on",
6521
+ onCheckedChange,
6522
+ form,
6523
+ ...switchProps
6524
+ } = props;
6525
+ const [button, setButton] = React30.useState(null);
6526
+ const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
6527
+ const hasConsumerStoppedPropagationRef = React30.useRef(false);
6528
+ const isFormControl = button ? form || !!button.closest("form") : true;
6529
+ const [checked, setChecked] = useControllableState({
6530
+ prop: checkedProp,
6531
+ defaultProp: defaultChecked ?? false,
6532
+ onChange: onCheckedChange,
6533
+ caller: SWITCH_NAME
6534
+ });
6535
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(SwitchProvider, { scope: __scopeSwitch, checked, disabled, children: [
6536
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6537
+ Primitive.button,
6538
+ {
6539
+ type: "button",
6540
+ role: "switch",
6541
+ "aria-checked": checked,
6542
+ "aria-required": required,
6543
+ "data-state": getState2(checked),
6544
+ "data-disabled": disabled ? "" : void 0,
6545
+ disabled,
6546
+ value,
6547
+ ...switchProps,
6548
+ ref: composedRefs,
6549
+ onClick: composeEventHandlers(props.onClick, (event) => {
6550
+ setChecked((prevChecked) => !prevChecked);
6551
+ if (isFormControl) {
6552
+ hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
6553
+ if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
6554
+ }
6555
+ })
6556
+ }
4304
6557
  ),
4305
- ...props,
4306
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4307
- SwitchPrimitive.Thumb,
6558
+ isFormControl && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6559
+ SwitchBubbleInput,
4308
6560
  {
4309
- "data-slot": "switch-thumb",
4310
- className: cn(
4311
- "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
4312
- )
6561
+ control: button,
6562
+ bubbles: !hasConsumerStoppedPropagationRef.current,
6563
+ name,
6564
+ value,
6565
+ checked,
6566
+ required,
6567
+ disabled,
6568
+ form,
6569
+ style: { transform: "translateX(-100%)" }
4313
6570
  }
4314
6571
  )
4315
- }
4316
- );
6572
+ ] });
6573
+ }
6574
+ );
6575
+ Switch.displayName = SWITCH_NAME;
6576
+ var THUMB_NAME = "SwitchThumb";
6577
+ var SwitchThumb = React30.forwardRef(
6578
+ (props, forwardedRef) => {
6579
+ const { __scopeSwitch, ...thumbProps } = props;
6580
+ const context = useSwitchContext(THUMB_NAME, __scopeSwitch);
6581
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6582
+ Primitive.span,
6583
+ {
6584
+ "data-state": getState2(context.checked),
6585
+ "data-disabled": context.disabled ? "" : void 0,
6586
+ ...thumbProps,
6587
+ ref: forwardedRef
6588
+ }
6589
+ );
6590
+ }
6591
+ );
6592
+ SwitchThumb.displayName = THUMB_NAME;
6593
+ var BUBBLE_INPUT_NAME = "SwitchBubbleInput";
6594
+ var SwitchBubbleInput = React30.forwardRef(
6595
+ ({
6596
+ __scopeSwitch,
6597
+ control,
6598
+ checked,
6599
+ bubbles = true,
6600
+ ...props
6601
+ }, forwardedRef) => {
6602
+ const ref = React30.useRef(null);
6603
+ const composedRefs = useComposedRefs(ref, forwardedRef);
6604
+ const prevChecked = usePrevious(checked);
6605
+ const controlSize = useSize(control);
6606
+ React30.useEffect(() => {
6607
+ const input = ref.current;
6608
+ if (!input) return;
6609
+ const inputProto = window.HTMLInputElement.prototype;
6610
+ const descriptor = Object.getOwnPropertyDescriptor(
6611
+ inputProto,
6612
+ "checked"
6613
+ );
6614
+ const setChecked = descriptor.set;
6615
+ if (prevChecked !== checked && setChecked) {
6616
+ const event = new Event("click", { bubbles });
6617
+ setChecked.call(input, checked);
6618
+ input.dispatchEvent(event);
6619
+ }
6620
+ }, [prevChecked, checked, bubbles]);
6621
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6622
+ "input",
6623
+ {
6624
+ type: "checkbox",
6625
+ "aria-hidden": true,
6626
+ defaultChecked: checked,
6627
+ ...props,
6628
+ tabIndex: -1,
6629
+ ref: composedRefs,
6630
+ style: {
6631
+ ...props.style,
6632
+ ...controlSize,
6633
+ position: "absolute",
6634
+ pointerEvents: "none",
6635
+ opacity: 0,
6636
+ margin: 0
6637
+ }
6638
+ }
6639
+ );
6640
+ }
6641
+ );
6642
+ SwitchBubbleInput.displayName = BUBBLE_INPUT_NAME;
6643
+ function getState2(checked) {
6644
+ return checked ? "checked" : "unchecked";
4317
6645
  }
6646
+ var Root2 = Switch;
6647
+ var Thumb = SwitchThumb;
6648
+
6649
+ // src/libraries/react/components/ui/switch.tsx
6650
+ var import_jsx_runtime16 = require("react/jsx-runtime");
6651
+ var Switch2 = React31.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6652
+ Root2,
6653
+ {
6654
+ className: cn(
6655
+ "au-peer au-inline-flex au-h-5 au-w-9 au-shrink-0 au-cursor-pointer au-items-center au-rounded-full au-border-2 au-border-transparent au-shadow-sm au-transition-colors focus-visible:au-outline-none focus-visible:au-ring-2 focus-visible:au-ring-ring focus-visible:au-ring-offset-2 focus-visible:au-ring-offset-background au-disabled:cursor-not-allowed au-disabled:opacity-50 data-[state=checked]:au-bg-primary data-[state=unchecked]:au-bg-input",
6656
+ className
6657
+ ),
6658
+ ...props,
6659
+ ref,
6660
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6661
+ Thumb,
6662
+ {
6663
+ className: cn(
6664
+ "au-pointer-events-none au-block au-h-4 au-w-4 au-rounded-full au-bg-background au-shadow-lg au-ring-0 au-transition-transform data-[state=checked]:au-translate-x-4 data-[state=unchecked]:au-translate-x-0"
6665
+ )
6666
+ }
6667
+ )
6668
+ }
6669
+ ));
6670
+ Switch2.displayName = Root2.displayName;
4318
6671
 
4319
6672
  // src/libraries/react/components/pricing-table/lib/pricing-table-content.tsx
4320
- var import_jsx_runtime9 = require("react/jsx-runtime");
6673
+ var import_jsx_runtime17 = require("react/jsx-runtime");
4321
6674
  var getPricingTableContent = (product) => {
4322
6675
  const { scenario, free_trial } = product;
4323
6676
  if (free_trial && free_trial.trial_available) {
4324
6677
  return {
4325
- buttonText: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "Start Free Trial" })
6678
+ buttonText: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: "Start Free Trial" })
4326
6679
  };
4327
6680
  }
4328
6681
  switch (scenario) {
4329
6682
  case "scheduled":
4330
6683
  return {
4331
- buttonText: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "Plan Scheduled" })
6684
+ buttonText: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: "Plan Scheduled" })
4332
6685
  };
4333
6686
  case "active":
4334
6687
  return {
4335
- buttonText: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "Current Plan" })
6688
+ buttonText: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: "Current Plan" })
4336
6689
  };
4337
6690
  case "new":
4338
6691
  if (product.properties?.is_one_off) {
4339
6692
  return {
4340
- buttonText: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "Purchase" })
6693
+ buttonText: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: "Purchase" })
4341
6694
  };
4342
6695
  } else {
4343
6696
  return {
4344
- buttonText: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "Get started" })
6697
+ buttonText: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: "Get started" })
4345
6698
  };
4346
6699
  }
4347
6700
  case "renew":
4348
6701
  return {
4349
- buttonText: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "Renew" })
6702
+ buttonText: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: "Renew" })
4350
6703
  };
4351
6704
  case "upgrade":
4352
6705
  return {
4353
- buttonText: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "Upgrade" })
6706
+ buttonText: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: "Upgrade" })
4354
6707
  };
4355
6708
  case "downgrade":
4356
6709
  return {
4357
- buttonText: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "Downgrade" })
6710
+ buttonText: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: "Downgrade" })
4358
6711
  };
4359
6712
  case "cancel":
4360
6713
  return {
4361
- buttonText: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "Cancel Plan" })
6714
+ buttonText: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: "Cancel Plan" })
4362
6715
  };
4363
6716
  default:
4364
6717
  return {
4365
- buttonText: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "Get Started" })
6718
+ buttonText: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: "Get Started" })
4366
6719
  };
4367
6720
  }
4368
6721
  };
4369
6722
 
4370
6723
  // src/libraries/react/components/pricing-table/pricing-table-synced.tsx
4371
- var import_jsx_runtime10 = require("react/jsx-runtime");
6724
+ var import_jsx_runtime18 = require("react/jsx-runtime");
4372
6725
  function PricingTable({
4373
6726
  productDetails
4374
6727
  }) {
4375
6728
  const { attach } = useCustomer();
4376
- const [isAnnual, setIsAnnual] = (0, import_react10.useState)(false);
6729
+ const [isAnnual, setIsAnnual] = (0, import_react12.useState)(false);
4377
6730
  const { products, isLoading, error } = usePricingTable({ productDetails });
4378
6731
  if (isLoading) {
4379
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "w-full h-full flex justify-center items-center min-h-[300px]", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LoaderCircle, { className: "w-6 h-6 text-zinc-400 animate-spin" }) });
6732
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "au-w-full au-h-full au-flex au-justify-center au-items-center au-min-h-[300px]", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LoaderCircle, { className: "au-w-6 au-h-6 au-text-zinc-400 au-animate-spin" }) });
4380
6733
  }
4381
6734
  if (error) {
4382
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: " Something went wrong..." });
6735
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: " Something went wrong..." });
4383
6736
  }
4384
6737
  const intervals = Array.from(
4385
6738
  new Set(
@@ -4400,14 +6753,15 @@ function PricingTable({
4400
6753
  }
4401
6754
  return true;
4402
6755
  };
4403
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: products && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6756
+ const hasRecommended = products?.some((p) => p.display?.recommend_text);
6757
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "au-root", children: products && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4404
6758
  PricingTableContainer,
4405
6759
  {
4406
6760
  products,
4407
6761
  isAnnualToggle: isAnnual,
4408
6762
  setIsAnnualToggle: setIsAnnual,
4409
6763
  multiInterval,
4410
- children: products.filter(intervalFilter).map((product, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6764
+ children: products.filter(intervalFilter).map((product, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4411
6765
  PricingCard,
4412
6766
  {
4413
6767
  productId: product.id,
@@ -4430,7 +6784,7 @@ function PricingTable({
4430
6784
  }
4431
6785
  ) });
4432
6786
  }
4433
- var PricingTableContext = (0, import_react10.createContext)({
6787
+ var PricingTableContext = (0, import_react12.createContext)({
4434
6788
  isAnnualToggle: false,
4435
6789
  setIsAnnualToggle: () => {
4436
6790
  },
@@ -4438,7 +6792,7 @@ var PricingTableContext = (0, import_react10.createContext)({
4438
6792
  showFeatures: true
4439
6793
  });
4440
6794
  var usePricingTableContext = (componentName) => {
4441
- const context = (0, import_react10.useContext)(PricingTableContext);
6795
+ const context = (0, import_react12.useContext)(PricingTableContext);
4442
6796
  if (context === void 0) {
4443
6797
  throw new Error(`${componentName} must be used within <PricingTable />`);
4444
6798
  }
@@ -4457,20 +6811,20 @@ var PricingTableContainer = ({
4457
6811
  throw new Error("products is required in <PricingTable />");
4458
6812
  }
4459
6813
  if (products.length === 0) {
4460
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, {});
6814
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, {});
4461
6815
  }
4462
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6816
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4463
6817
  PricingTableContext.Provider,
4464
6818
  {
4465
6819
  value: { isAnnualToggle, setIsAnnualToggle, products, showFeatures },
4466
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: cn("flex items-center flex-col"), children: [
4467
- multiInterval && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6820
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: cn("au-flex au-items-center au-flex-col"), children: [
6821
+ multiInterval && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4468
6822
  "div",
4469
6823
  {
4470
6824
  className: cn(
4471
- products.some((p) => p.display?.recommend_text) && "mb-8"
6825
+ products.some((p) => p.display?.recommend_text) && "au-mb-8"
4472
6826
  ),
4473
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6827
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4474
6828
  AnnualSwitch,
4475
6829
  {
4476
6830
  isAnnualToggle,
@@ -4479,11 +6833,11 @@ var PricingTableContainer = ({
4479
6833
  )
4480
6834
  }
4481
6835
  ),
4482
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6836
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4483
6837
  "div",
4484
6838
  {
4485
6839
  className: cn(
4486
- "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-[repeat(auto-fit,minmax(200px,1fr))] w-full gap-2",
6840
+ "au-grid au-grid-cols-1 sm:au-grid-cols-2 lg:au-grid-cols-[repeat(auto-fit,minmax(200px,1fr))] au-w-full au-gap-2",
4487
6841
  className
4488
6842
  ),
4489
6843
  children
@@ -4496,7 +6850,6 @@ var PricingTableContainer = ({
4496
6850
  var PricingCard = ({
4497
6851
  productId,
4498
6852
  className,
4499
- onButtonClick,
4500
6853
  buttonProps
4501
6854
  }) => {
4502
6855
  const { products, showFeatures } = usePricingTableContext("PricingCard");
@@ -4511,41 +6864,41 @@ var PricingCard = ({
4511
6864
  primary_text: "Free"
4512
6865
  } : product.items[0].display;
4513
6866
  const featureItems = product.properties?.is_free ? product.items : product.items.slice(1);
4514
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
6867
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
4515
6868
  "div",
4516
6869
  {
4517
6870
  className: cn(
4518
- "w-full h-full py-6 text-foreground border rounded-lg shadow-sm max-w-xl",
4519
- isRecommended && "lg:-translate-y-6 lg:shadow-lg dark:shadow-zinc-800/80 lg:h-[calc(100%+48px)] bg-secondary/40",
6871
+ "au-w-full au-h-full au-py-6 au-text-foreground au-border au-rounded-lg au-shadow-sm au-max-w-xl",
6872
+ isRecommended && "lg:au--translate-y-6 lg:au-shadow-lg dark:au-shadow-zinc-800/80 lg:au-h-[calc(100%+48px)] au-bg-secondary/40",
4520
6873
  className
4521
6874
  ),
4522
6875
  children: [
4523
- productDisplay?.recommend_text && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RecommendedBadge, { recommended: productDisplay?.recommend_text }),
4524
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
6876
+ productDisplay?.recommend_text && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RecommendedBadge, { recommended: productDisplay?.recommend_text }),
6877
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
4525
6878
  "div",
4526
6879
  {
4527
6880
  className: cn(
4528
- "flex flex-col h-full flex-grow",
4529
- isRecommended && "lg:translate-y-6"
6881
+ "au-flex au-flex-col au-h-full au-flex-grow",
6882
+ isRecommended && "lg:au-translate-y-6"
4530
6883
  ),
4531
6884
  children: [
4532
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "h-full", children: [
4533
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col", children: [
4534
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "pb-4", children: [
4535
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "text-2xl font-semibold px-6 truncate", children: name }),
4536
- productDisplay?.description && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "text-sm text-muted-foreground px-6 h-8", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "line-clamp-2", children: [
6885
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "au-h-full", children: [
6886
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "au-flex au-flex-col", children: [
6887
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "au-pb-4", children: [
6888
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h2", { className: "au-text-2xl au-font-semibold au-px-6 au-truncate", children: productDisplay?.name || name }),
6889
+ productDisplay?.description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "au-text-sm au-text-muted-foreground au-px-6 au-h-8", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { className: "au-line-clamp-2", children: [
4537
6890
  "Everything from ",
4538
6891
  productDisplay?.description,
4539
6892
  ", plus:"
4540
6893
  ] }) })
4541
6894
  ] }),
4542
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { className: "font-semibold h-16 flex px-6 items-center border-y mb-4 bg-secondary/40", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "line-clamp-2", children: [
6895
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "au-mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h3", { className: "au-font-semibold au-h-16 au-flex au-px-6 au-items-center au-border-y au-mb-4 au-bg-secondary/40", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "au-line-clamp-2", children: [
4543
6896
  mainPriceDisplay?.primary_text,
4544
6897
  " ",
4545
- mainPriceDisplay?.secondary_text && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "font-normal text-muted-foreground mt-1", children: mainPriceDisplay?.secondary_text })
6898
+ mainPriceDisplay?.secondary_text && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "au-font-normal au-text-muted-foreground au-mt-1", children: mainPriceDisplay?.secondary_text })
4546
6899
  ] }) }) })
4547
6900
  ] }),
4548
- showFeatures && featureItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex-grow px-6 mb-6", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6901
+ showFeatures && featureItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "au-flex-grow au-px-6 au-mb-6", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4549
6902
  PricingFeatureList,
4550
6903
  {
4551
6904
  items: featureItems,
@@ -4554,15 +6907,20 @@ var PricingCard = ({
4554
6907
  }
4555
6908
  ) })
4556
6909
  ] }),
4557
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: cn(" px-6 ", isRecommended && "lg:-translate-y-12"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4558
- PricingCardButton,
6910
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6911
+ "div",
4559
6912
  {
4560
- recommended: productDisplay?.recommend_text ? true : false,
4561
- onClick: onButtonClick,
4562
- ...buttonProps,
4563
- children: buttonText
6913
+ className: cn(" au-px-6 ", isRecommended && "lg:au--translate-y-12"),
6914
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6915
+ PricingCardButton,
6916
+ {
6917
+ recommended: productDisplay?.recommend_text ? true : false,
6918
+ ...buttonProps,
6919
+ children: buttonText
6920
+ }
6921
+ )
4564
6922
  }
4565
- ) })
6923
+ )
4566
6924
  ]
4567
6925
  }
4568
6926
  )
@@ -4576,59 +6934,60 @@ var PricingFeatureList = ({
4576
6934
  everythingFrom,
4577
6935
  className
4578
6936
  }) => {
4579
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: cn("flex-grow", className), children: [
4580
- everythingFrom && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "text-sm mb-4", children: [
6937
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: cn("au-flex-grow", className), children: [
6938
+ everythingFrom && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { className: "au-text-sm au-mb-4", children: [
4581
6939
  "Everything from ",
4582
6940
  everythingFrom,
4583
6941
  ", plus:"
4584
6942
  ] }),
4585
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-3", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-start gap-2 text-sm", children: [
4586
- showIcon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Check, { className: "h-4 w-4 text-primary flex-shrink-0 mt-0.5" }),
4587
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col", children: [
4588
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: item.display?.primary_text }),
4589
- item.display?.secondary_text && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm text-muted-foreground", children: item.display?.secondary_text })
4590
- ] })
4591
- ] }, index)) })
6943
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "au-space-y-3", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
6944
+ "div",
6945
+ {
6946
+ className: "au-flex au-items-start au-gap-2 au-text-sm",
6947
+ children: [
6948
+ showIcon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Check, { className: "au-h-4 au-w-4 au-text-primary au-flex-shrink-0 au-mt-0.5" }),
6949
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "au-flex au-flex-col", children: [
6950
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: item.display?.primary_text }),
6951
+ item.display?.secondary_text && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "au-text-sm au-text-muted-foreground", children: item.display?.secondary_text })
6952
+ ] })
6953
+ ]
6954
+ },
6955
+ index
6956
+ )) })
4592
6957
  ] });
4593
6958
  };
4594
- var PricingCardButton = import_react9.default.forwardRef(({ recommended, children, buttonUrl, onClick, className, ...props }, ref) => {
4595
- const [loading, setLoading] = (0, import_react10.useState)(false);
4596
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6959
+ var PricingCardButton = import_react11.default.forwardRef(({ recommended, children, className, onClick, ...props }, ref) => {
6960
+ const [loading, setLoading] = (0, import_react12.useState)(false);
6961
+ const handleClick = async (e) => {
6962
+ setLoading(true);
6963
+ try {
6964
+ await onClick?.(e);
6965
+ } catch (error) {
6966
+ console.error(error);
6967
+ } finally {
6968
+ setLoading(false);
6969
+ }
6970
+ };
6971
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4597
6972
  Button,
4598
6973
  {
4599
6974
  className: cn(
4600
- "w-full py-3 px-4 group overflow-hidden relative transition-all duration-300 hover:brightness-90 border rounded-lg",
6975
+ "au-w-full au-py-3 au-px-4 au-group au-overflow-hidden au-relative au-transition-all au-duration-300 hover:au-brightness-90 au-border au-rounded-lg",
4601
6976
  className
4602
6977
  ),
6978
+ ...props,
4603
6979
  variant: recommended ? "default" : "secondary",
4604
6980
  ref,
4605
- disabled: loading,
4606
- onClick: async (e) => {
4607
- setLoading(true);
4608
- try {
4609
- if (onClick) {
4610
- await onClick(e);
4611
- return;
4612
- }
4613
- if (buttonUrl) {
4614
- window.open(buttonUrl, "_blank");
4615
- return;
4616
- }
4617
- } catch (error) {
4618
- throw error;
4619
- } finally {
4620
- setLoading(false);
4621
- }
4622
- },
4623
- ...props,
4624
- children: loading ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LoaderCircle, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
4625
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between w-full transition-transform duration-300 group-hover:translate-y-[-130%]", children: [
4626
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children }),
4627
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm", children: "\u2192" })
6981
+ disabled: loading || props.disabled,
6982
+ onClick: handleClick,
6983
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LoaderCircle, { className: "au-h-4 au-w-4 au-animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
6984
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "au-flex au-items-center au-justify-between au-w-full au-transition-transform au-duration-300 group-hover:au-translate-y-[-130%]", children: [
6985
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children }),
6986
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "au-text-sm", children: "\u2192" })
4628
6987
  ] }),
4629
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between w-full absolute px-4 translate-y-[130%] transition-transform duration-300 group-hover:translate-y-0 mt-2 group-hover:mt-0", children: [
4630
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children }),
4631
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm", children: "\u2192" })
6988
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "au-flex au-items-center au-justify-between au-w-full au-absolute au-px-4 au-translate-y-[130%] au-transition-transform au-duration-300 group-hover:au-translate-y-0 au-mt-2 group-hover:au-mt-0", children: [
6989
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children }),
6990
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "au-text-sm", children: "\u2192" })
4632
6991
  ] })
4633
6992
  ] })
4634
6993
  }
@@ -4639,21 +6998,21 @@ var AnnualSwitch = ({
4639
6998
  isAnnualToggle,
4640
6999
  setIsAnnualToggle
4641
7000
  }) => {
4642
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center space-x-2 mb-4", children: [
4643
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm text-muted-foreground", children: "Monthly" }),
4644
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4645
- Switch,
7001
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "au-flex au-items-center au-space-x-2 au-mb-4", children: [
7002
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "au-text-sm au-text-muted-foreground", children: "Monthly" }),
7003
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7004
+ Switch2,
4646
7005
  {
4647
7006
  id: "annual-billing",
4648
7007
  checked: isAnnualToggle,
4649
7008
  onCheckedChange: setIsAnnualToggle
4650
7009
  }
4651
7010
  ),
4652
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm text-muted-foreground", children: "Annual" })
7011
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "au-text-sm au-text-muted-foreground", children: "Annual" })
4653
7012
  ] });
4654
7013
  };
4655
7014
  var RecommendedBadge = ({ recommended }) => {
4656
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "bg-secondary absolute border text-muted-foreground text-sm font-medium lg:rounded-full px-3 lg:py-0.5 lg:top-4 lg:right-4 top-[-1px] right-[-1px] rounded-bl-lg", children: recommended });
7015
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "au-bg-secondary au-absolute au-border au-text-muted-foreground au-text-sm au-font-medium lg:au-rounded-full au-px-3 lg:au-py-0.5 lg:au-top-4 lg:au-right-4 au-top-[-1px] au-right-[-1px] au-rounded-bl-lg", children: recommended });
4657
7016
  };
4658
7017
  // Annotate the CommonJS export names for ESM import in node:
4659
7018
  0 && (module.exports = {