@feedmepos/mf-connect 0.1.114-prod → 0.1.115-dev

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 (157) hide show
  1. package/README.md +66 -1
  2. package/dist/{App-DMYXrCc7.js → App-43mZfFAr.js} +700 -654
  3. package/dist/AuditLogs-BPpdm96t.js +2016 -0
  4. package/dist/{Bin-CHZolo56.js → Bin-CA7v180Y.js} +8 -8
  5. package/dist/Broadcast-qmdifF2Y.js +306 -0
  6. package/dist/{CampaignAnalytic-DgZvsUoF.js → CampaignAnalytic-xnrDxqaH.js} +7 -7
  7. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-C42uL_JO.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-zjk-QdtX.js} +9 -9
  8. package/dist/{Card-wRFTJwJ9.js → Card-D8icsk7L.js} +25 -24
  9. package/dist/{Collections-9G-_9Etz.js → Collections--THcD-E_.js} +197 -185
  10. package/dist/{Credit-Bl7IDMCU.js → Credit-JrbtVMBp.js} +21 -20
  11. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-BVLJeofG.js → DateRangeChip.vue_vue_type_script_setup_true_lang-DrwKtnE5.js} +1 -1
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DgdAlHU7.js +4442 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Q1f6EQW3.js → EffectSheet.vue_vue_type_style_index_0_lang-hVgqWdD0.js} +32 -32
  14. package/dist/{Experience-Cs2iViLv.js → Experience-CFeRqBoj.js} +32 -31
  15. package/dist/{FileSaver.min-B3Levdbu.js → FileSaver.min-CCXIBm58.js} +1 -1
  16. package/dist/{Game-oXURgzan.js → Game-CPxq6Ex3.js} +19 -18
  17. package/dist/{GiftCardSetup-C2Wu-dRl.js → GiftCardSetup-D0esVZDp.js} +75 -75
  18. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-Da2e89Um.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-CJ1-vL-K.js} +7 -7
  19. package/dist/{Goals-B_xEM7gf.js → Goals-DaKI6uXt.js} +4 -4
  20. package/dist/Grab-BWzdN_cd.js +301 -0
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-BRJR1heE.js → ImageInput.vue_vue_type_script_setup_true_lang-BOnL0GxM.js} +1 -1
  22. package/dist/{Index-kuT6W6R_.js → Index-2kENoaZm.js} +10 -10
  23. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-7JqHfSk-.js → LocationPicker.vue_vue_type_script_setup_true_lang-BtWnJKU_.js} +1 -1
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CI_4S7tW.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CX_Sspu5.js} +1 -1
  25. package/dist/{LoyaltyDashboard-CqxHdZcm.js → LoyaltyDashboard-CB93Fz8u.js} +15 -15
  26. package/dist/MainLayout-DwnjGXh6.js +4 -0
  27. package/dist/{MainLayout-CAERFIms.js → MainLayout.vue_vue_type_script_setup_true_lang-Du8fw5v_.js} +5 -4
  28. package/dist/Marketing-DCco__2F.js +273 -0
  29. package/dist/MarketingMaterialEdit-BbgFtrYP.js +1037 -0
  30. package/dist/{Member-B8VZEn9t.js → Member-B--nYyr0.js} +7 -7
  31. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-B31lVLKh.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-BBlzO7Db.js} +43 -50
  32. package/dist/{MemberImportHistory-D9tgHnTS.js → MemberImportHistory-D52Y4RTC.js} +7 -7
  33. package/dist/{MemberList-Hw_xQY1i.js → MemberList-13Owa1fj.js} +103 -105
  34. package/dist/{MemberTransactions-DiBO4plw.js → MemberTransactions-CpXEWNbq.js} +1 -1
  35. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CbFt5X89.js → MessageInput.vue_vue_type_script_setup_true_lang-DlELjFM0.js} +4228 -4176
  36. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-BE_-Ed4z.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-C_y0rM8c.js} +1 -1
  37. package/dist/{Mission-DpYei3aF.js → Mission-Ci-UzXSu.js} +22 -21
  38. package/dist/{Overview-CARquJCS.js → Overview-CKxSfAGF.js} +145 -144
  39. package/dist/{Overview-BFQMmyT6.js → Overview-CXen9Ram.js} +23 -22
  40. package/dist/{Point-Dd2ykwNv.js → Point-CR3YOaag.js} +22 -21
  41. package/dist/{Promotion-DXl-W7np.js → Promotion-tw3J4ul-.js} +137 -131
  42. package/dist/{Queue-Cd3N-4iB.js → Queue-BZGA5ZXt.js} +47 -46
  43. package/dist/{Record-C3HdDsh5.js → Record-BTevVXnT.js} +9 -9
  44. package/dist/{Review-Bif3Ub9Z.js → Review-BU7c8ZF0.js} +2 -2
  45. package/dist/ReviewFacebookCallback-BnMF6Arh.js +225 -0
  46. package/dist/{ReviewGoogleCallback-i-RNLlLm.js → ReviewGoogleCallback-xpdPHSdg.js} +5 -5
  47. package/dist/{Reward-DHxzrR_7.js → Reward-jlA_7cxz.js} +29 -29
  48. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-DcrFlcSo.js → RewardGroup.vue_vue_type_script_setup_true_lang-D3z_n42G.js} +16 -15
  49. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CsHxqH9h.js +1923 -0
  50. package/dist/{Segment-Cjpxordk.js → Segment-C1Bwm--Q.js} +290 -291
  51. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-6u21xBu6.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-B6apgWTM.js} +31 -30
  52. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BOXVzfer.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-B7m2F9UV.js} +4 -4
  53. package/dist/Setting-CDM4RhLW.js +574 -0
  54. package/dist/{SettingAdvertisements-aog5fz32.js → SettingAdvertisements-4XEAJzlL.js} +12 -12
  55. package/dist/Settings-D-0tvZRr.js +286 -0
  56. package/dist/{Store-Bq3kw1l2.js → Store-C56dXtc4.js} +31 -30
  57. package/dist/{StoreRewards-ZGXKEM09.js → StoreRewards-DQ1Q6WS6.js} +15 -15
  58. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-LLD91Rz6.js +1319 -0
  59. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-Bvy4NJMd.js +7007 -0
  60. package/dist/{Tier-CfgpEHY7.js → Tier-D4CPZqw7.js} +2576 -687
  61. package/dist/{Title-B2itYWeD.js → Title-DCbwhUic.js} +94 -92
  62. package/dist/{Transaction-hJ5ygIcf.js → Transaction-C5LrasXr.js} +2 -2
  63. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-8BgGlpTh.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Cl9b4mrK.js} +26 -26
  64. package/dist/{Voucher-TG47pGR3.js → Voucher-rrVbNZKR.js} +19 -19
  65. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-CjuXCTxg.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BIq227nz.js} +16 -16
  66. package/dist/WhatsappAccount-oJDo5zTr.js +159 -0
  67. package/dist/WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-aCQCYFYq.js +39 -0
  68. package/dist/WhatsappBot-Cl64wG_F.js +876 -0
  69. package/dist/WhatsappBotLogs-D3uT4EiB.js +372 -0
  70. package/dist/WhatsappBotSettings-Cs1lLxh-.js +705 -0
  71. package/dist/WhatsappLayout-C639d2HP.js +21 -0
  72. package/dist/WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DpPxWp2x.js +253 -0
  73. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BRs-gbP0.js → ZodTextField.vue_vue_type_script_setup_true_lang-C39_95SZ.js} +2 -2
  74. package/dist/{app-tPHYkJcQ.js → app-CgimGODl.js} +10610 -8223
  75. package/dist/app.js +4 -3
  76. package/dist/{base.export-BHDVnGj2.js → base.export-D2P6HFvo.js} +2 -2
  77. package/dist/browser-BSAOEeIM.js +1478 -0
  78. package/dist/{business-HLyWfrXY.js → business-Bu5TqSA0.js} +1 -1
  79. package/dist/campaign-BFIXSgdJ.js +400 -0
  80. package/dist/{campaign-5zFgUNLw.js → campaign-zJxttSIk.js} +31 -25
  81. package/dist/{campaign.enum-BOkDnP2g.js → campaign.enum-Dx-Zo68Q.js} +3 -2
  82. package/dist/{campaign.fn-BIAoVtJj.js → campaign.fn-gvjlcEfe.js} +78 -78
  83. package/dist/{collectible.enum-BbZSAfys.js → collectible.enum-Liy2wH3s.js} +1 -1
  84. package/dist/{collection.fn-DPSgBHnz.js → collection.fn-DOm0HsSh.js} +2 -2
  85. package/dist/{currency-BVrMqU6-.js → currency-BpbQvbm8.js} +1 -1
  86. package/dist/duplicateCampaign-CvsvjRE9.js +51 -0
  87. package/dist/{effect-BBifVx76.js → effect-D-GtNB3n.js} +1 -1
  88. package/dist/{email-addresses-9C7xHTNv.js → email-addresses-BKMoAtMi.js} +2 -2
  89. package/dist/feature-flag-BJ_eyKsq.js +868 -0
  90. package/dist/feature-flag-Bo-k5sIG.js +50 -0
  91. package/dist/google-BQK68wbe.js +5 -0
  92. package/dist/{helper-C08jyQNK.js → helper-CkfjBgMM.js} +1 -1
  93. package/dist/{index-Dhyqf1s8.js → index-B6kU3PkV.js} +2700 -2613
  94. package/dist/{index-BgwZGunW.js → index-BAtUrtqM.js} +19 -6
  95. package/dist/index-BKsxIwbi.js +14571 -0
  96. package/dist/{index-DZ-q5O-V.js → index-BdEXUNoG.js} +4 -4
  97. package/dist/{index-hIUtD2eY.js → index-Bhl5IRXy.js} +11 -10
  98. package/dist/{index-kCbkOivd.js → index-BpTIulTX.js} +1 -1
  99. package/dist/index-C-iwb2Ln.js +109 -0
  100. package/dist/{index-Ciw2TZxV.js → index-CCEXSPxk.js} +8 -7
  101. package/dist/{index-CUle4c2B.js → index-CIej31pF.js} +4 -3
  102. package/dist/{index-ihw-WFCa.js → index-CQ8XFbBk.js} +2 -2
  103. package/dist/index-C_H8jFYf.js +2743 -0
  104. package/dist/{index-CEe1kJ0T.js → index-CfQuYqXn.js} +1 -1
  105. package/dist/{index-C_WoO58V.js → index-CuREApMc.js} +8 -7
  106. package/dist/{index-NJSI4wX4.js → index-D0JK99Ko.js} +693 -231
  107. package/dist/{index-DnRMNmUA.js → index-DKxN1mMS.js} +396 -232
  108. package/dist/index-DQ8JJhxs.js +74 -0
  109. package/dist/{index-D24Q28cH.js → index-DUAZOMVJ.js} +1 -1
  110. package/dist/{index-Yo0tP8KJ.js → index-DqGs6RJG.js} +683 -581
  111. package/dist/{index-B_334Y_i.js → index-DwU3fsLW.js} +29 -15
  112. package/dist/{index-hSRM1smQ.js → index-LygS9WsG.js} +8028 -10767
  113. package/dist/{index-96ZiAKj_.js → index-feCrYhi6.js} +1 -1
  114. package/dist/{index-Dk-jg0wN.js → index-zTvr2GR4.js} +2 -2
  115. package/dist/{index.esm2017-hN99SQTb.js → index.esm2017-DZi9IQPS.js} +209 -209
  116. package/dist/{loading-CVuY4vQ4.js → loading-Brid2wnu.js} +1 -1
  117. package/dist/{lodash-GFl9_FMH.js → lodash-C1epw3Kv.js} +1 -1
  118. package/dist/{member-import-CshTzabx.js → member-import-DAIxTIiu.js} +6 -5
  119. package/dist/{membership-S0KES3Ex.js → membership-BZmljFhF.js} +3 -3
  120. package/dist/{money-JxdX8ru4.js → money-cLcyGcSZ.js} +1 -1
  121. package/dist/{number-BRLwa-mB.js → number-C2jPLJr2.js} +1 -1
  122. package/dist/objectid-C-wocWKI.js +145 -0
  123. package/dist/{onboarding-BSKYeyP7.js → onboarding-oRfy_g05.js} +25 -25
  124. package/dist/{onboardingSetup-BqT52VRm.js → onboardingSetup-BLD6m8HY.js} +2 -2
  125. package/dist/{plugins-BR_wmMFJ.js → plugins-CUsr9vB0.js} +3 -3
  126. package/dist/{MarketingMaterialEdit-BvIthCHG.js → remy-icon-BhUGu2NI.js} +2 -1031
  127. package/dist/{reward-CpCGg_W2.js → reward-UOT03odb.js} +1 -1
  128. package/dist/{rule-Dbg9e8MO.js → rule-BgJnPjkI.js} +572 -492
  129. package/dist/style.css +1 -1
  130. package/dist/template-BZyFhr73.js +188 -0
  131. package/dist/{timezone-CDVa-xPr.js → timezone-BXA4wq7Y.js} +1 -1
  132. package/dist/{transaction.fn-DrTBoF9T.js → transaction.fn-CQ4fpRt3.js} +2 -2
  133. package/dist/{trigger-wqGwQfB2.js → trigger-DXJCGT0q.js} +8 -8
  134. package/dist/useMarketingMaterialActions-B-Wib5ga.js +125 -0
  135. package/dist/{usePagination-fODgpZZ8.js → usePagination-Pp4okWr8.js} +1 -1
  136. package/dist/{user-DaLUK1dk.js → user-B3gXcAIy.js} +1 -1
  137. package/dist/vue-i18n-DWGiC_vs.js +2365 -0
  138. package/dist/{xlsx-Bl4_Dtrq.js → xlsx-CCaDUTgW.js} +651 -651
  139. package/dist/{zod-CAzWyVqj.js → zod-CPwjOxvW.js} +1 -1
  140. package/package.json +12 -3
  141. package/dist/Broadcast-ByWvxVhW.js +0 -271
  142. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DGpQfV5T.js +0 -2431
  143. package/dist/Marketing-KgcwGErU.js +0 -236
  144. package/dist/ReviewFacebookCallback-mJF54-9l.js +0 -238
  145. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-39f3I4BB.js +0 -1883
  146. package/dist/Setting-Dl9MelHz.js +0 -2036
  147. package/dist/Settings-DvCCClIP.js +0 -179
  148. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-DscLAF0p.js +0 -1264
  149. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-l_v4FHO0.js +0 -142
  150. package/dist/campaign-awCRccgX.js +0 -228
  151. package/dist/google-C3S8u0mT.js +0 -4
  152. package/dist/index-CoNJdOx7.js +0 -51
  153. package/dist/objectid-CEHN25HN.js +0 -145
  154. package/dist/rule-builder-BEIjxsE0.js +0 -102
  155. package/dist/template-CS-lExgI.js +0 -236
  156. package/dist/useMarketingMaterialActions-DC0gIyIZ.js +0 -96
  157. package/dist/vue-i18n-Dx-KXojZ.js +0 -2365
@@ -0,0 +1,868 @@
1
+ var le = Object.defineProperty;
2
+ var ue = (m, u, d) => u in m ? le(m, u, { enumerable: !0, configurable: !0, writable: !0, value: d }) : m[u] = d;
3
+ var ot = (m, u, d) => ue(m, typeof u != "symbol" ? u + "" : u, d);
4
+ import { ref as ut, readonly as kt } from "vue";
5
+ import { c as st } from "./app-CgimGODl.js";
6
+ import { useCoreStore as ce } from "@feedmepos/mf-common";
7
+ var Rt = { exports: {} };
8
+ (function(m, u) {
9
+ (function(d, v) {
10
+ v(u);
11
+ })(st, function(d) {
12
+ var v = { getItemSync: function(a) {
13
+ try {
14
+ return localStorage.getItem(a) || null;
15
+ } catch {
16
+ return null;
17
+ }
18
+ }, getItem: function(a, e) {
19
+ var t = this;
20
+ return new Promise(function(i, n) {
21
+ try {
22
+ var r = t.getItemSync(a);
23
+ e == null || e(null, r), i(r);
24
+ } catch (o) {
25
+ e && e(o, null), n(o);
26
+ }
27
+ });
28
+ }, setItem: function(a, e, t) {
29
+ return new Promise(function(i, n) {
30
+ try {
31
+ localStorage.setItem(a, e), t && t(null, e), i(e);
32
+ } catch (r) {
33
+ t && t(r, null), n(r);
34
+ }
35
+ });
36
+ } }, s = function() {
37
+ return s = Object.assign || function(a) {
38
+ for (var e, t = 1, i = arguments.length; t < i; t++) for (var n in e = arguments[t]) Object.prototype.hasOwnProperty.call(e, n) && (a[n] = e[n]);
39
+ return a;
40
+ }, s.apply(this, arguments);
41
+ };
42
+ function T(a, e, t, i) {
43
+ return new (t || (t = Promise))(function(n, r) {
44
+ function o(f) {
45
+ try {
46
+ h(i.next(f));
47
+ } catch (l) {
48
+ r(l);
49
+ }
50
+ }
51
+ function c(f) {
52
+ try {
53
+ h(i.throw(f));
54
+ } catch (l) {
55
+ r(l);
56
+ }
57
+ }
58
+ function h(f) {
59
+ var l;
60
+ f.done ? n(f.value) : (l = f.value, l instanceof t ? l : new t(function(p) {
61
+ p(l);
62
+ })).then(o, c);
63
+ }
64
+ h((i = i.apply(a, [])).next());
65
+ });
66
+ }
67
+ function H(a, e) {
68
+ var t, i, n, r, o = { label: 0, sent: function() {
69
+ if (1 & n[0]) throw n[1];
70
+ return n[1];
71
+ }, trys: [], ops: [] };
72
+ return r = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (r[Symbol.iterator] = function() {
73
+ return this;
74
+ }), r;
75
+ function c(h) {
76
+ return function(f) {
77
+ return function(l) {
78
+ if (t) throw new TypeError("Generator is already executing.");
79
+ for (; o; ) try {
80
+ if (t = 1, i && (n = 2 & l[0] ? i.return : l[0] ? i.throw || ((n = i.return) && n.call(i), 0) : i.next) && !(n = n.call(i, l[1])).done) return n;
81
+ switch (i = 0, n && (l = [2 & l[0], n.value]), l[0]) {
82
+ case 0:
83
+ case 1:
84
+ n = l;
85
+ break;
86
+ case 4:
87
+ return o.label++, { value: l[1], done: !1 };
88
+ case 5:
89
+ o.label++, i = l[1], l = [0];
90
+ continue;
91
+ case 7:
92
+ l = o.ops.pop(), o.trys.pop();
93
+ continue;
94
+ default:
95
+ if (n = o.trys, !((n = n.length > 0 && n[n.length - 1]) || l[0] !== 6 && l[0] !== 2)) {
96
+ o = 0;
97
+ continue;
98
+ }
99
+ if (l[0] === 3 && (!n || l[1] > n[0] && l[1] < n[3])) {
100
+ o.label = l[1];
101
+ break;
102
+ }
103
+ if (l[0] === 6 && o.label < n[1]) {
104
+ o.label = n[1], n = l;
105
+ break;
106
+ }
107
+ if (n && o.label < n[2]) {
108
+ o.label = n[2], o.ops.push(l);
109
+ break;
110
+ }
111
+ n[2] && o.ops.pop(), o.trys.pop();
112
+ continue;
113
+ }
114
+ l = e.call(a, o);
115
+ } catch (p) {
116
+ l = [6, p], i = 0;
117
+ } finally {
118
+ t = n = 0;
119
+ }
120
+ if (5 & l[0]) throw l[1];
121
+ return { value: l[0] ? l[1] : void 0, done: !0 };
122
+ }([h, f]);
123
+ };
124
+ }
125
+ }
126
+ function D(a, e, t) {
127
+ for (var i, n = 0, r = e.length; n < r; n++) !i && n in e || (i || (i = Array.prototype.slice.call(e, 0, n)), i[n] = e[n]);
128
+ return a.concat(i || Array.prototype.slice.call(e));
129
+ }
130
+ var nt = function a(e, t) {
131
+ if (e === t) return !0;
132
+ if (e && t && typeof e == "object" && typeof t == "object") {
133
+ if (e.constructor !== t.constructor) return !1;
134
+ var i, n, r;
135
+ if (Array.isArray(e)) {
136
+ if ((i = e.length) != t.length) return !1;
137
+ for (n = i; n-- != 0; ) if (!a(e[n], t[n])) return !1;
138
+ return !0;
139
+ }
140
+ if (e.constructor === RegExp) return e.source === t.source && e.flags === t.flags;
141
+ if (e.valueOf !== Object.prototype.valueOf) return e.valueOf() === t.valueOf();
142
+ if (e.toString !== Object.prototype.toString) return e.toString() === t.toString();
143
+ if ((i = (r = Object.keys(e)).length) !== Object.keys(t).length) return !1;
144
+ for (n = i; n-- != 0; ) if (!Object.prototype.hasOwnProperty.call(t, r[n])) return !1;
145
+ for (n = i; n-- != 0; ) {
146
+ var o = r[n];
147
+ if (!a(e[o], t[o])) return !1;
148
+ }
149
+ return !0;
150
+ }
151
+ return e != e && t != t;
152
+ };
153
+ function _(a, e) {
154
+ var t = Object.keys(e || {}).filter(function(i) {
155
+ var n = a == null ? void 0 : a[i], r = e == null ? void 0 : e[i];
156
+ return !nt(n, r);
157
+ });
158
+ return Object.keys(a || {}).filter(function(i) {
159
+ Object.keys(e || {}).includes(i) || t.push(i);
160
+ }), Object.keys(t).length ? t : null;
161
+ }
162
+ var g, C;
163
+ function b(a, e, t) {
164
+ var i = "shortString", n = !0;
165
+ typeof t == "number" && (i = "javaDouble", n = !1), a[i] = a[i] || {}, a[i][e] = n ? t + "" : t;
166
+ }
167
+ function G(a) {
168
+ return !!a && typeof a == "object" && a.value !== void 0;
169
+ }
170
+ function it(a) {
171
+ return Object.fromEntries(Object.entries(a).map(function(e) {
172
+ var t = e[0], i = e[1];
173
+ return [t, G(i) ? i : { value: i }];
174
+ }));
175
+ }
176
+ function ct(a) {
177
+ return s(s({}, a), { identity: a.identity ? s(s({}, a.identity), { traits: it(a.identity.traits || {}) }) : void 0 });
178
+ }
179
+ (function(a) {
180
+ a.NONE = "NONE", a.DEFAULT_FLAGS = "DEFAULT_FLAGS", a.CACHE = "CACHE", a.SERVER = "SERVER";
181
+ })(g || (g = {}));
182
+ var ht, O = null, ie = "FLAGSMITH_EVENT", at = ie, Dt = "https://edge.api.flagsmith.com/api/v1/", Gt = "flagsmith_value_", Jt = "flagsmith_enabled_", Vt = "flagsmith_trait_", ae = function() {
183
+ function a(e) {
184
+ var t = this;
185
+ this._trigger = null, this._triggerLoadingState = null, this.timestamp = null, this.isLoading = !1, this.eventSource = null, this.getFlags = function() {
186
+ var i = t, n = i.api, r = i.evaluationContext;
187
+ t.log("Get Flags"), t.isLoading = !0, t.loadingState.isFetching || t.setLoadingState(s(s({}, t.loadingState), { isFetching: !0 }));
188
+ var o = "".concat(t.getContext().identity), c = function(h) {
189
+ var f, l, p, F;
190
+ if (h && o === "".concat(t.getContext().identity)) {
191
+ var P = h.flags, w = h.traits, j = h.identifier;
192
+ t.isLoading = !1;
193
+ var I = {}, A = {};
194
+ w = w || [], (P = P || []).forEach(function(y) {
195
+ I[y.feature.name.toLowerCase().replace(/ /g, "_")] = { id: y.feature.id, enabled: y.enabled, value: y.feature_state_value };
196
+ }), w.forEach(function(y) {
197
+ A[y.trait_key.toLowerCase().replace(/ /g, "_")] = { transient: y.transient, value: y.trait_value };
198
+ }), t.oldFlags = s({}, t.flags);
199
+ var k = _(t.oldFlags, I), Y = _((f = t.evaluationContext.identity) === null || f === void 0 ? void 0 : f.traits, A);
200
+ if ((j || Object.keys(A).length) && (t.evaluationContext.identity = s(s({}, t.evaluationContext.identity), { traits: A }), j && (t.evaluationContext.identity.identifier = j)), t.flags = I, t.updateStorage(), t._onChange(t.oldFlags, { isFromServer: !0, flagsChanged: k, traitsChanged: Y }, t._loadedState(null, g.SERVER)), t.datadogRum) try {
201
+ if (t.datadogRum.trackTraits) {
202
+ var Q = {};
203
+ Object.keys(((l = t.evaluationContext.identity) === null || l === void 0 ? void 0 : l.traits) || {}).map(function(y) {
204
+ Q[Vt + y] = t.getTrait(y);
205
+ });
206
+ var M = s(s(s({}, t.datadogRum.client.getUser()), { id: t.datadogRum.client.getUser().id || ((p = t.evaluationContext.identity) === null || p === void 0 ? void 0 : p.identifier) }), Q);
207
+ t.log("Setting Datadog user", M), t.datadogRum.client.setUser(M);
208
+ }
209
+ } catch (y) {
210
+ console.error(y);
211
+ }
212
+ if (t.dtrum) try {
213
+ var E = { javaDouble: {}, date: {}, shortString: {}, javaLongOrObject: {} };
214
+ Object.keys(t.flags).map(function(y) {
215
+ b(E, Gt + y, t.getValue(y, { skipAnalytics: !0 })), b(E, Jt + y, t.hasFeature(y, { skipAnalytics: !0 }));
216
+ }), Object.keys(((F = t.evaluationContext.identity) === null || F === void 0 ? void 0 : F.traits) || {}).map(function(y) {
217
+ b(E, Vt + y, t.getTrait(y));
218
+ }), t.log("Sending javaLongOrObject traits to dynatrace", E.javaLongOrObject), t.log("Sending date traits to dynatrace", E.date), t.log("Sending shortString traits to dynatrace", E.shortString), t.log("Sending javaDouble to dynatrace", E.javaDouble), t.dtrum.sendSessionProperties(E.javaLongOrObject, E.date, E.shortString, E.javaDouble);
219
+ } catch (y) {
220
+ console.error(y);
221
+ }
222
+ }
223
+ };
224
+ return r.identity ? Promise.all([r.identity.traits && Object.keys(r.identity.traits).length || !r.identity.identifier ? t.getJSON(n + "identities/", "POST", JSON.stringify({ identifier: r.identity.identifier, transient: r.identity.transient, traits: Object.entries(r.identity.traits).map(function(h) {
225
+ var f = h[0], l = h[1];
226
+ return { trait_key: f, trait_value: l == null ? void 0 : l.value, transient: l == null ? void 0 : l.transient };
227
+ }).filter(function(h) {
228
+ return h.trait_value !== void 0 || (t.log("Warning - attempted to set an undefined trait value for key", h.trait_key), !1);
229
+ }) })) : t.getJSON(n + "identities/?identifier=" + encodeURIComponent(r.identity.identifier) + (r.identity.transient ? "&transient=true" : ""))]).then(function(h) {
230
+ return t.evaluationContext.identity = s(s({}, t.evaluationContext.identity), { traits: {} }), c(h == null ? void 0 : h[0]);
231
+ }).catch(function(h) {
232
+ var f = h.message, l = new Error(f);
233
+ return Promise.reject(l);
234
+ }) : t.getJSON(n + "flags/").then(function(h) {
235
+ return c({ flags: h, traits: void 0 });
236
+ });
237
+ }, this.analyticsFlags = function() {
238
+ var i = t.api;
239
+ if (t.evaluationEvent && t.evaluationContext.environment && t.evaluationEvent[t.evaluationContext.environment.apiKey]) return t.evaluationEvent && Object.getOwnPropertyNames(t.evaluationEvent).length !== 0 && Object.getOwnPropertyNames(t.evaluationEvent[t.evaluationContext.environment.apiKey]).length !== 0 ? t.getJSON(i + "analytics/flags/", "POST", JSON.stringify(t.evaluationEvent[t.evaluationContext.environment.apiKey])).then(function(n) {
240
+ if (t.evaluationContext.environment) {
241
+ var r = t.getState();
242
+ t.evaluationEvent || (t.evaluationEvent = {}), t.evaluationEvent[t.evaluationContext.environment.apiKey] = {}, t.setState(s(s({}, r), { evaluationEvent: t.evaluationEvent })), t.updateEventStorage();
243
+ }
244
+ }).catch(function(n) {
245
+ t.log("Exception fetching evaluationEvent", n);
246
+ }) : void 0;
247
+ }, this.datadogRum = null, this.loadingState = { isLoading: !0, isFetching: !0, error: null, source: g.NONE }, this.canUseStorage = !1, this.analyticsInterval = null, this.api = null, this.cacheFlags = !1, this.ts = null, this.enableAnalytics = !1, this.enableLogs = !1, this.evaluationContext = {}, this.evaluationEvent = null, this.flags = null, this.getFlagInterval = null, this.headers = null, this.initialised = !1, this.oldFlags = null, this.onChange = null, this.onError = null, this.ticks = null, this.timer = null, this.dtrum = null, this.withTraits = null, this.cacheOptions = { ttl: 0, skipAPI: !1, loadStale: !1, storageKey: void 0 }, this.getValue = function(i, n, r) {
248
+ var o = t.flags && t.flags[i.toLowerCase().replace(/ /g, "_")], c = null;
249
+ if (o && (c = o.value), n != null && n.skipAnalytics || r || t.evaluateFlag(i, "VALUE"), c === null && (n == null ? void 0 : n.fallback) !== void 0) return n.fallback;
250
+ if (n != null && n.json) try {
251
+ return c === null ? (t.log("Tried to parse null flag as JSON: " + i), null) : JSON.parse(c);
252
+ } catch {
253
+ return n.fallback;
254
+ }
255
+ return c;
256
+ }, this.getTrait = function(i) {
257
+ var n, r;
258
+ return ((n = t.evaluationContext.identity) === null || n === void 0 ? void 0 : n.traits) && ((r = t.evaluationContext.identity.traits[i.toLowerCase().replace(/ /g, "_")]) === null || r === void 0 ? void 0 : r.value);
259
+ }, this.getAllTraits = function() {
260
+ var i;
261
+ return Object.fromEntries(Object.entries(((i = t.evaluationContext.identity) === null || i === void 0 ? void 0 : i.traits) || {}).map(function(n) {
262
+ var r = n[0], o = n[1];
263
+ return [r, o == null ? void 0 : o.value];
264
+ }));
265
+ }, this.setContext = function(i) {
266
+ var n = ct(i);
267
+ return t.evaluationContext = s(s({}, n), { environment: n.environment || t.evaluationContext.environment }), t.initialised ? t.getFlags() : Promise.resolve();
268
+ }, this.getContext = function() {
269
+ return t.evaluationContext;
270
+ }, this.updateContext = function(i) {
271
+ return t.setContext(s(s({}, t.getContext()), i));
272
+ }, this.setTrait = function(i, n) {
273
+ var r;
274
+ if (t.api) return t.setContext(s(s({}, t.evaluationContext), { identity: s(s({}, t.evaluationContext.identity), { traits: s(s({}, (r = t.evaluationContext.identity) === null || r === void 0 ? void 0 : r.traits), it(Object.fromEntries([[i, n]]))) }) }));
275
+ }, this.setTraits = function(i) {
276
+ var n;
277
+ if (t.api) return t.setContext(s(s({}, t.evaluationContext), { identity: s(s({}, t.evaluationContext.identity), { traits: s(s({}, (n = t.evaluationContext.identity) === null || n === void 0 ? void 0 : n.traits), Object.fromEntries(Object.entries(i).map(function(r) {
278
+ var o = r[0], c = r[1];
279
+ return [o, G(c) ? c : { value: c }];
280
+ }))) }) }));
281
+ console.error("Attempted to setTraits a user before calling flagsmith.init. Call flagsmith.init first, if you wish to prevent it sending a request for flags, call init with preventFetch:true.");
282
+ }, this.hasFeature = function(i, n) {
283
+ var r = typeof n == "object", o = t.flags && t.flags[i.toLowerCase().replace(/ /g, "_")], c = !1;
284
+ return !o && r && n.fallback !== void 0 ? c = n == null ? void 0 : n.fallback : o && o.enabled && (c = !0), (r && !n.skipAnalytics || !n) && t.evaluateFlag(i, "ENABLED"), c;
285
+ }, this.getStorageKey = function() {
286
+ var i, n;
287
+ return ((i = t.cacheOptions) === null || i === void 0 ? void 0 : i.storageKey) || "FLAGSMITH_DB_" + ((n = t.evaluationContext.environment) === null || n === void 0 ? void 0 : n.apiKey);
288
+ }, this.getJSON = function(i, n, r) {
289
+ var o, c = t;
290
+ c.evaluationContext;
291
+ var h = c.headers, f = { method: n || "GET", body: r, cache: "no-cache", headers: {} };
292
+ t.evaluationContext.environment && (f.headers["X-Environment-Key"] = t.evaluationContext.environment.apiKey), n && n !== "GET" && (f.headers["Content-Type"] = "application/json; charset=utf-8"), h && Object.assign(f.headers, h), C || console.error("Flagsmith: fetch is undefined, please specify a fetch implementation into flagsmith.init to support SSR.");
293
+ var l = "".concat((o = t.evaluationContext.identity) === null || o === void 0 ? void 0 : o.identifier);
294
+ return C(i, f).then(function(p) {
295
+ var F, P, w = "".concat((F = t.evaluationContext.identity) === null || F === void 0 ? void 0 : F.identifier);
296
+ if (l === w) {
297
+ var j = (P = p.headers) === null || P === void 0 ? void 0 : P.get("x-flagsmith-document-updated-at");
298
+ if (j) try {
299
+ var I = parseFloat(j);
300
+ if (isNaN(I)) return Promise.reject("Failed to parse x-flagsmith-document-updated-at");
301
+ t.timestamp = I;
302
+ } catch (A) {
303
+ t.log(A, "Failed to parse x-flagsmith-document-updated-at", j);
304
+ }
305
+ return t.log("Fetch response: " + p.status + " " + (n || "GET") + 0 + i), p.text().then(function(A) {
306
+ var k = A;
307
+ try {
308
+ k = JSON.parse(A);
309
+ } catch {
310
+ }
311
+ return !k && p.status && (k = "API Response: ".concat(p.status)), p.status && p.status >= 200 && p.status < 300 ? k : Promise.reject(new Error(k));
312
+ });
313
+ }
314
+ t.log("Received response with identity mismatch, ignoring response. Requested: ".concat(l, ", Current: ").concat(w));
315
+ });
316
+ }, this.evaluateFlag = function(i, n) {
317
+ if (t.datadogRum && (t.datadogRum.client.addFeatureFlagEvaluation ? n === "VALUE" ? t.datadogRum.client.addFeatureFlagEvaluation(Gt + i, t.getValue(i, {}, !0)) : t.datadogRum.client.addFeatureFlagEvaluation(Jt + i, t.hasFeature(i, !0)) : console.error("Flagsmith: Your datadog RUM client does not support the function addFeatureFlagEvaluation, please update it.")), t.enableAnalytics) {
318
+ if (!t.evaluationEvent || !t.evaluationContext.environment) return;
319
+ t.evaluationEvent[t.evaluationContext.environment.apiKey] || (t.evaluationEvent[t.evaluationContext.environment.apiKey] = {}), t.evaluationEvent[t.evaluationContext.environment.apiKey][i] === void 0 && (t.evaluationEvent[t.evaluationContext.environment.apiKey][i] = 0), t.evaluationEvent[t.evaluationContext.environment.apiKey][i] += 1;
320
+ }
321
+ t.updateEventStorage();
322
+ }, this._onChange = function(i, n, r) {
323
+ var o, c;
324
+ t.setLoadingState(r), (o = t.onChange) === null || o === void 0 || o.call(t, i, n, t.loadingState), (c = t._trigger) === null || c === void 0 || c.call(t);
325
+ }, C = e.fetch ? e.fetch : typeof fetch < "u" ? fetch : st === null || st === void 0 ? void 0 : st.fetch, this.canUseStorage = typeof window < "u" || !!e.browserlessStorage, this.log("Constructing flagsmith instance " + e), e.eventSource && (ht = e.eventSource), e.AsyncStorage && (O = e.AsyncStorage);
326
+ }
327
+ return a.prototype.init = function(e) {
328
+ var t, i, n;
329
+ return T(this, void 0, void 0, function() {
330
+ var r, o, c, h, f, l, p, F, P, w, j, I, A, k, Y, Q, M, E, y, vt, W, Xt, $, gt, Zt, Yt, ft, Qt, pt, tt, q, Wt, x = this;
331
+ return H(this, function(N) {
332
+ switch (N.label) {
333
+ case 0:
334
+ r = ct(e.evaluationContext || this.evaluationContext), N.label = 1;
335
+ case 1:
336
+ if (N.trys.push([1, 13, , 14]), o = e.environmentID, c = e.api, h = c === void 0 ? Dt : c, f = e.headers, l = e.onChange, p = e.cacheFlags, F = e.datadogRum, P = e.onError, w = e.defaultFlags, j = e.fetch, I = e.preventFetch, A = e.enableLogs, k = e.enableDynatrace, Y = e.enableAnalytics, Q = e.realtime, M = e.eventSourceUrl, E = M === void 0 ? "https://realtime.flagsmith.com/" : M, y = e.AsyncStorage, vt = e.identity, W = e.traits, Xt = e.state, $ = e.cacheOptions, gt = e.angularHttpClient, Zt = e._trigger, Yt = e._triggerLoadingState, r.environment = o ? { apiKey: o } : r.environment, !r.environment || !r.environment.apiKey) throw new Error("Please provide `evaluationContext.environment` with non-empty `apiKey`");
337
+ if (r.identity = vt || W ? { identifier: vt, traits: W ? Object.fromEntries(Object.entries(W).map(function(L) {
338
+ return [L[0], { value: L[1] }];
339
+ })) : {} } : r.identity, this.evaluationContext = r, this.api = h, this.headers = f, this.getFlagInterval = null, this.analyticsInterval = null, this.onChange = l, ft = "Wrong Flagsmith Configuration: preventFetch is true and no defaulFlags provided", this._trigger = Zt || this._trigger, this._triggerLoadingState = Yt || this._triggerLoadingState, this.onError = function(L) {
340
+ x.setLoadingState(s(s({}, x.loadingState), { isFetching: !1, isLoading: !1, error: L })), P == null || P(L);
341
+ }, this.enableLogs = A || !1, this.cacheOptions = $ ? { skipAPI: !!$.skipAPI, ttl: $.ttl || 0, storageKey: $.storageKey, loadStale: !!$.loadStale } : this.cacheOptions, !this.cacheOptions.ttl && this.cacheOptions.skipAPI && console.warn("Flagsmith: you have set a cache ttl of 0 and are skipping API calls, this means the API will not be hit unless you clear local storage."), j && (C = j), this.enableAnalytics = Y || !1, this.flags = Object.assign({}, w) || {}, this.datadogRum = F || null, this.initialised = !0, this.ticks = 1e4, this.timer = this.enableLogs ? (/* @__PURE__ */ new Date()).valueOf() : null, this.cacheFlags = O !== void 0 && !!p, at = "FLAGSMITH_EVENT_" + r.environment.apiKey, y && (O = y), Q && typeof window < "u" && this.setupRealtime(E, r.environment.apiKey), Object.keys(this.flags).length && (this.loadingState = s(s({}, this.loadingState), { isLoading: !1, source: g.DEFAULT_FLAGS })), this.setState(Xt), this.log("Initialising with properties", e, this), k && (typeof dtrum > "u" ? console.error("You have attempted to enable dynatrace but dtrum is undefined, please check you have the Dynatrace RUM JavaScript API installed.") : this.dtrum = dtrum), gt && (C = /* @__PURE__ */ function(L) {
342
+ return function(U, R) {
343
+ var V = R.headers, S = R.method, X = R.body;
344
+ return new Promise(function(B) {
345
+ switch (S) {
346
+ case "GET":
347
+ return L.get(U, { headers: V }).subscribe(function(J) {
348
+ B({ ok: !0, text: function() {
349
+ return Promise.resolve(J);
350
+ } });
351
+ });
352
+ case "POST":
353
+ case "PUT":
354
+ return L.post(U, X, { headers: V }).subscribe(function(J) {
355
+ B({ ok: !0, text: function() {
356
+ return Promise.resolve(J);
357
+ } });
358
+ });
359
+ }
360
+ });
361
+ };
362
+ }(gt)), O && this.canUseStorage && O.getItem(at).then(function(L) {
363
+ try {
364
+ x.evaluationEvent = JSON.parse(L) || {};
365
+ } catch {
366
+ x.evaluationEvent = {};
367
+ }
368
+ x.analyticsInterval = setInterval(x.analyticsFlags, x.ticks);
369
+ }), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), O && this.canUseStorage && O.getItem(at, function(L, U) {
370
+ if (U && x.evaluationContext.environment) {
371
+ var R = JSON.parse(U);
372
+ if (R[x.evaluationContext.environment.apiKey]) {
373
+ var V = x.getState();
374
+ x.log("Retrieved events from cache", U), x.setState(s(s({}, V), { evaluationEvent: R[x.evaluationContext.environment.apiKey] }));
375
+ }
376
+ }
377
+ })), !p) return [3, 9];
378
+ if (!O || !this.canUseStorage) return [3, 8];
379
+ Qt = function(L, U) {
380
+ return T(x, void 0, void 0, function() {
381
+ var R, V, S, X, B, J, yt, te, mt, St, Ct, bt, _t, Ft, Et, xt, Ot, wt, It, At, Lt, jt, Nt, Tt, ee = this;
382
+ return H(this, function(z) {
383
+ switch (z.label) {
384
+ case 0:
385
+ if (!U) return [3, 7];
386
+ R = null, V = null, z.label = 1;
387
+ case 1:
388
+ return z.trys.push([1, 5, , 6]), S = JSON.parse(U), X = !1, B = !1, S && S.api === this.api && ((St = (mt = S.evaluationContext) === null || mt === void 0 ? void 0 : mt.environment) === null || St === void 0 ? void 0 : St.apiKey) === ((Ct = this.evaluationContext.environment) === null || Ct === void 0 ? void 0 : Ct.apiKey) && (J = !0, this.evaluationContext.identity && ((_t = (bt = S.evaluationContext) === null || bt === void 0 ? void 0 : bt.identity) === null || _t === void 0 ? void 0 : _t.identifier) !== this.evaluationContext.identity.identifier && (this.log("Ignoring cache, identity has changed from " + ((Et = (Ft = S.evaluationContext) === null || Ft === void 0 ? void 0 : Ft.identity) === null || Et === void 0 ? void 0 : Et.identifier) + " to " + this.evaluationContext.identity.identifier), J = !1), this.cacheOptions.ttl && (!S.ts || (/* @__PURE__ */ new Date()).valueOf() - S.ts > this.cacheOptions.ttl) && (S.ts && !this.cacheOptions.loadStale ? (this.log("Ignoring cache, timestamp is too old ts:" + S.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - S.ts) + "ms"), J = !1) : S.ts && this.cacheOptions.loadStale && (this.log("Loading stale cache, timestamp ts:" + S.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - S.ts) + "ms"), B = !0, J = !0)), J && (X = !0, V = _((xt = this.evaluationContext.identity) === null || xt === void 0 ? void 0 : xt.traits, (wt = (Ot = S.evaluationContext) === null || Ot === void 0 ? void 0 : Ot.identity) === null || wt === void 0 ? void 0 : wt.traits), R = _(this.flags, S.flags), this.setState(s(s({}, S), { evaluationContext: ct(s(s({}, S.evaluationContext), { identity: !((It = S.evaluationContext) === null || It === void 0) && It.identity ? s(s({}, (At = S.evaluationContext) === null || At === void 0 ? void 0 : At.identity), { traits: s(s({}, ((jt = (Lt = S.evaluationContext) === null || Lt === void 0 ? void 0 : Lt.identity) === null || jt === void 0 ? void 0 : jt.traits) || {}), W || {}) }) : void 0 })) })), this.log("Retrieved flags from cache", S))), X ? (yt = !I && (!this.cacheOptions.skipAPI || B), this._onChange(null, { isFromServer: !1, flagsChanged: R, traitsChanged: V }, this._loadedState(null, g.CACHE, yt)), this.oldFlags = this.flags, this.cacheOptions.skipAPI && X && !B && this.log("Skipping API, using cache"), yt && this.getFlags().catch(function(se) {
389
+ var Pt;
390
+ (Pt = ee.onError) === null || Pt === void 0 || Pt.call(ee, se);
391
+ }), [3, 4]) : [3, 2];
392
+ case 2:
393
+ return I ? [3, 4] : [4, this.getFlags()];
394
+ case 3:
395
+ z.sent(), z.label = 4;
396
+ case 4:
397
+ return [3, 6];
398
+ case 5:
399
+ return te = z.sent(), this.log("Exception fetching cached logs", te), [3, 6];
400
+ case 6:
401
+ return [3, 10];
402
+ case 7:
403
+ return I ? [3, 9] : [4, this.getFlags()];
404
+ case 8:
405
+ return z.sent(), [3, 10];
406
+ case 9:
407
+ if (w) this._onChange(null, { isFromServer: !1, flagsChanged: _({}, this.flags), traitsChanged: _({}, (Nt = this.evaluationContext.identity) === null || Nt === void 0 ? void 0 : Nt.traits) }, this._loadedState(null, g.DEFAULT_FLAGS));
408
+ else {
409
+ if (!this.flags) throw new Error(ft);
410
+ this._onChange(null, { isFromServer: !1, flagsChanged: _({}, this.flags), traitsChanged: _({}, (Tt = this.evaluationContext.identity) === null || Tt === void 0 ? void 0 : Tt.traits) }, this._loadedState(null, g.DEFAULT_FLAGS));
411
+ }
412
+ z.label = 10;
413
+ case 10:
414
+ return [2];
415
+ }
416
+ });
417
+ });
418
+ }, N.label = 2;
419
+ case 2:
420
+ return N.trys.push([2, 7, , 8]), O.getItemSync ? (pt = O.getItemSync(this.getStorageKey()), [3, 5]) : [3, 3];
421
+ case 3:
422
+ return [4, O.getItem(this.getStorageKey())];
423
+ case 4:
424
+ pt = N.sent(), N.label = 5;
425
+ case 5:
426
+ return [4, Qt(null, pt)];
427
+ case 6:
428
+ case 7:
429
+ return N.sent(), [3, 8];
430
+ case 8:
431
+ return [3, 12];
432
+ case 9:
433
+ return I ? [3, 11] : [4, this.getFlags()];
434
+ case 10:
435
+ return N.sent(), [3, 12];
436
+ case 11:
437
+ if (w) this._onChange(null, { isFromServer: !1, flagsChanged: _({}, w), traitsChanged: _({}, (t = r.identity) === null || t === void 0 ? void 0 : t.traits) }, this._loadedState(null, g.DEFAULT_FLAGS));
438
+ else if (this.flags && (tt = null, Object.keys(this.flags).length === 0 && (tt = ft), this._onChange(null, { isFromServer: !1, flagsChanged: _({}, this.flags), traitsChanged: _({}, (i = r.identity) === null || i === void 0 ? void 0 : i.traits) }, this._loadedState(tt, g.DEFAULT_FLAGS)), tt)) throw new Error(tt);
439
+ N.label = 12;
440
+ case 12:
441
+ return [3, 14];
442
+ case 13:
443
+ throw q = N.sent(), this.log("Error during initialisation ", q), Wt = q instanceof Error ? q : new Error("".concat(q)), (n = this.onError) === null || n === void 0 || n.call(this, Wt), q;
444
+ case 14:
445
+ return [2];
446
+ }
447
+ });
448
+ });
449
+ }, a.prototype.getAllFlags = function() {
450
+ return this.flags;
451
+ }, a.prototype.identify = function(e, t, i) {
452
+ return this.evaluationContext.identity = { identifier: e, transient: i, traits: this.evaluationContext.identity && this.evaluationContext.identity.identifier == e ? this.evaluationContext.identity.traits : {} }, this.evaluationContext.identity.identifier = e, this.log("Identify: " + this.evaluationContext.identity.identifier), t && (this.evaluationContext.identity.traits = Object.fromEntries(Object.entries(t).map(function(n) {
453
+ var r = n[0], o = n[1];
454
+ return [r, G(o) ? o : { value: o }];
455
+ }))), this.initialised ? this.getFlags() : Promise.resolve();
456
+ }, a.prototype.getState = function() {
457
+ return { api: this.api, flags: this.flags, ts: this.ts, evaluationContext: this.evaluationContext, evaluationEvent: this.evaluationEvent };
458
+ }, a.prototype.setState = function(e) {
459
+ e && (this.initialised = !0, this.api = e.api || this.api || Dt, this.flags = e.flags || this.flags, this.evaluationContext = e.evaluationContext || this.evaluationContext, this.evaluationEvent = e.evaluationEvent || this.evaluationEvent, this.log("setState called", this));
460
+ }, a.prototype.logout = function() {
461
+ return this.evaluationContext.identity = null, this.initialised ? this.getFlags() : Promise.resolve();
462
+ }, a.prototype.startListening = function(e) {
463
+ e === void 0 && (e = 1e3), this.getFlagInterval && clearInterval(this.getFlagInterval), this.getFlagInterval = setInterval(this.getFlags, e);
464
+ }, a.prototype.stopListening = function() {
465
+ this.getFlagInterval && (clearInterval(this.getFlagInterval), this.getFlagInterval = null);
466
+ }, a.prototype._loadedState = function(e, t, i) {
467
+ return e === void 0 && (e = null), i === void 0 && (i = !1), { error: e, isFetching: i, isLoading: !1, source: t };
468
+ }, a.prototype.log = function() {
469
+ for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
470
+ this.enableLogs && console.log.apply(this, D(["FLAGSMITH:", (/* @__PURE__ */ new Date()).valueOf() - (this.timer || 0), "ms"], e));
471
+ }, a.prototype.updateStorage = function() {
472
+ if (this.cacheFlags) {
473
+ this.ts = (/* @__PURE__ */ new Date()).valueOf();
474
+ var e = JSON.stringify(this.getState());
475
+ this.log("Setting storage", e), O.setItem(this.getStorageKey(), e);
476
+ }
477
+ }, a.prototype.updateEventStorage = function() {
478
+ if (this.enableAnalytics) {
479
+ var e = JSON.stringify(this.getState().evaluationEvent);
480
+ O.setItem(at, e).catch(function(t) {
481
+ return console.error("Flagsmith: Error setting item in async storage", t);
482
+ });
483
+ }
484
+ }, a.prototype.setLoadingState = function(e) {
485
+ var t;
486
+ nt(e, this.loadingState) || (this.loadingState = s({}, e), this.log("Loading state changed", e), (t = this._triggerLoadingState) === null || t === void 0 || t.call(this));
487
+ }, a.prototype.setupRealtime = function(e, t) {
488
+ var i = this, n = e + "sse/environments/" + t + "/stream";
489
+ ht ? this.eventSource || (this.log("Creating event source with url " + n), this.eventSource = new ht(n), this.eventSource.addEventListener("environment_updated", function(r) {
490
+ var o;
491
+ try {
492
+ o = JSON.parse(r.data).updated_at;
493
+ } catch (c) {
494
+ i.log("Could not parse sse event", c);
495
+ }
496
+ o ? !i.timestamp || o > i.timestamp ? i.isLoading ? i.log("updated_at is new, but flags are loading", r.data, i.timestamp) : (i.log("updated_at is new, fetching flags", r.data, i.timestamp), i.getFlags()) : i.log("updated_at is outdated, skipping get flags", r.data, i.timestamp) : i.log("No updated_at received, fetching flags", r);
497
+ })) : this.log("Error, EventSource is undefined");
498
+ }, a;
499
+ }();
500
+ function zt(a) {
501
+ var e = a.fetch, t = a.AsyncStorage, i = a.eventSource;
502
+ return new ae({ fetch: e, AsyncStorage: t, eventSource: i });
503
+ }
504
+ var rt, re = (rt = function(a, e) {
505
+ return rt = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, i) {
506
+ t.__proto__ = i;
507
+ } || function(t, i) {
508
+ for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (t[n] = i[n]);
509
+ }, rt(a, e);
510
+ }, function(a, e) {
511
+ if (typeof e != "function" && e !== null) throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
512
+ function t() {
513
+ this.constructor = a;
514
+ }
515
+ rt(a, e), a.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
516
+ }), Ht = function(a) {
517
+ var e = typeof Symbol == "function" && Symbol.iterator, t = e && a[e], i = 0;
518
+ if (t) return t.call(a);
519
+ if (a && typeof a.length == "number") return { next: function() {
520
+ return a && i >= a.length && (a = void 0), { value: a && a[i++], done: !a };
521
+ } };
522
+ throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
523
+ }, Bt = function(a, e) {
524
+ var t = typeof Symbol == "function" && a[Symbol.iterator];
525
+ if (!t) return a;
526
+ var i, n, r = t.call(a), o = [];
527
+ try {
528
+ for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) o.push(i.value);
529
+ } catch (c) {
530
+ n = { error: c };
531
+ } finally {
532
+ try {
533
+ i && !i.done && (t = r.return) && t.call(r);
534
+ } finally {
535
+ if (n) throw n.error;
536
+ }
537
+ }
538
+ return o;
539
+ }, dt = function(a, e, t) {
540
+ if (arguments.length === 2) for (var i, n = 0, r = e.length; n < r; n++) !i && n in e || (i || (i = Array.prototype.slice.call(e, 0, n)), i[n] = e[n]);
541
+ return a.concat(i || Array.prototype.slice.call(e));
542
+ }, oe = function(a) {
543
+ function e() {
544
+ return a.call(this, `EventSource not available.
545
+ Consider loading an EventSource polyfill and making it available globally as EventSource, or passing one in as eventSourceClass to the ReconnectingEventSource constructor.`) || this;
546
+ }
547
+ return re(e, a), e;
548
+ }(Error), Mt = function() {
549
+ function a(e, t) {
550
+ var i = this;
551
+ if (this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, this._configuration = t != null ? Object.assign({}, t) : void 0, this.withCredentials = !1, this._eventSource = null, this._lastEventId = null, this._timer = null, this._listeners = { open: [], error: [], message: [] }, this.url = e.toString(), this.readyState = this.CONNECTING, this.max_retry_time = 3e3, this.eventSourceClass = globalThis.FlagsmithEventSource, this._configuration != null && (this._configuration.lastEventId && (this._lastEventId = this._configuration.lastEventId, delete this._configuration.lastEventId), this._configuration.max_retry_time && (this.max_retry_time = this._configuration.max_retry_time, delete this._configuration.max_retry_time), this._configuration.eventSourceClass && (this.eventSourceClass = this._configuration.eventSourceClass, delete this._configuration.eventSourceClass)), this.eventSourceClass == null || typeof this.eventSourceClass != "function") throw new oe();
552
+ this._onevent_wrapped = function(n) {
553
+ i._onevent(n);
554
+ }, this._start();
555
+ }
556
+ return a.prototype.dispatchEvent = function(e) {
557
+ throw new Error("Method not implemented.");
558
+ }, a.prototype._start = function() {
559
+ var e, t, i = this, n = this.url;
560
+ this._lastEventId && (n.indexOf("?") === -1 ? n += "?" : n += "&", n += "lastEventId=" + encodeURIComponent(this._lastEventId)), this._eventSource = new this.eventSourceClass(n, this._configuration), this._eventSource.onopen = function(h) {
561
+ i._onopen(h);
562
+ }, this._eventSource.onerror = function(h) {
563
+ i._onerror(h);
564
+ }, this._eventSource.onmessage = function(h) {
565
+ i.onmessage(h);
566
+ };
567
+ try {
568
+ for (var r = Ht(Object.keys(this._listeners)), o = r.next(); !o.done; o = r.next()) {
569
+ var c = o.value;
570
+ this._eventSource.addEventListener(c, this._onevent_wrapped);
571
+ }
572
+ } catch (h) {
573
+ e = { error: h };
574
+ } finally {
575
+ try {
576
+ o && !o.done && (t = r.return) && t.call(r);
577
+ } finally {
578
+ if (e) throw e.error;
579
+ }
580
+ }
581
+ }, a.prototype._onopen = function(e) {
582
+ this.readyState === 0 && (this.readyState = 1, this.onopen(e));
583
+ }, a.prototype._onerror = function(e) {
584
+ var t = this;
585
+ if (this.readyState === 1 && (this.readyState = 0, this.onerror(e)), this._eventSource) {
586
+ this._eventSource.close(), this._eventSource = null;
587
+ var i = Math.round(this.max_retry_time * Math.random());
588
+ this._timer = setTimeout(function() {
589
+ return t._start();
590
+ }, i);
591
+ }
592
+ }, a.prototype._onevent = function(e) {
593
+ var t, i;
594
+ e && e.lastEventId && (this._lastEventId = e.lastEventId);
595
+ var n = this._listeners[e.type];
596
+ if (n != null) try {
597
+ for (var r = Ht(dt([], Bt(n), !1)), o = r.next(); !o.done; o = r.next())
598
+ o.value.call(this, e);
599
+ } catch (c) {
600
+ t = { error: c };
601
+ } finally {
602
+ try {
603
+ o && !o.done && (i = r.return) && i.call(r);
604
+ } finally {
605
+ if (t) throw t.error;
606
+ }
607
+ }
608
+ e.type === "message" && this.onmessage(e);
609
+ }, a.prototype.onopen = function(e) {
610
+ }, a.prototype.onerror = function(e) {
611
+ }, a.prototype.onmessage = function(e) {
612
+ }, a.prototype.close = function() {
613
+ this._timer && (clearTimeout(this._timer), this._timer = null), this._eventSource && (this._eventSource.close(), this._eventSource = null), this.readyState = 2;
614
+ }, a.prototype.addEventListener = function(e, t, i) {
615
+ this._listeners[e] == null && (this._listeners[e] = [], this._eventSource != null && this._eventSource.addEventListener(e, this._onevent_wrapped));
616
+ var n = this._listeners[e];
617
+ n.includes(t) || (this._listeners[e] = dt(dt([], Bt(n), !1), [t], !1));
618
+ }, a.prototype.removeEventListener = function(e, t, i) {
619
+ var n = this._listeners[e];
620
+ this._listeners[e] = n.filter(function(r) {
621
+ return r !== t;
622
+ });
623
+ }, a;
624
+ }();
625
+ globalThis.FlagsmithEventSource = typeof EventSource < "u" ? EventSource : null;
626
+ var $t = function(a, e) {
627
+ return e = e || {}, new Promise(function(t, i) {
628
+ var n = new XMLHttpRequest(), r = [], o = [], c = {}, h = function() {
629
+ return { ok: (n.status / 100 | 0) == 2, statusText: n.statusText, status: n.status, url: n.responseURL, text: function() {
630
+ return Promise.resolve(n.responseText);
631
+ }, json: function() {
632
+ return Promise.resolve(n.responseText).then(JSON.parse);
633
+ }, blob: function() {
634
+ return Promise.resolve(new Blob([n.response]));
635
+ }, clone: h, headers: { keys: function() {
636
+ return r;
637
+ }, entries: function() {
638
+ return o;
639
+ }, get: function(l) {
640
+ return c[l.toLowerCase()];
641
+ }, has: function(l) {
642
+ return l.toLowerCase() in c;
643
+ } } };
644
+ };
645
+ for (var f in n.open(e.method || "get", a, !0), n.onload = function() {
646
+ n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(l, p, F) {
647
+ r.push(p = p.toLowerCase()), o.push([p, F]), c[p] = c[p] ? c[p] + "," + F : F;
648
+ }), t(h());
649
+ }, n.onerror = i, n.withCredentials = e.credentials == "include", e.headers) n.setRequestHeader(f, e.headers[f]);
650
+ n.send(e.body || null);
651
+ });
652
+ }, qt = zt({ AsyncStorage: v, fetch: $t, eventSource: Mt });
653
+ typeof window < "u" && (window.flagsmith = qt), d.createFlagsmithInstance = function() {
654
+ return zt({ AsyncStorage: v, fetch: $t, eventSource: Mt });
655
+ }, d.default = qt, Object.defineProperty(d, "__esModule", { value: !0 });
656
+ });
657
+ })(Rt, Rt.exports);
658
+ var he = Rt.exports, de = {
659
+ NOT_INITIALIZED: "FeatureFlag not initialized. Call init() first.",
660
+ INVALID_CONFIG: "Invalid Flagsmith configuration",
661
+ FETCH_FAILED: "Failed to fetch Flagsmith configuration",
662
+ NO_USER_CONTEXT: "User context not set. Call setUser() first.",
663
+ ALREADY_INITIALIZED: "FeatureFlag is already initialized."
664
+ }, ne = "business", K, ve = (K = class {
665
+ constructor() {
666
+ ot(this, "flagsmithClient", null);
667
+ ot(this, "userContext", null);
668
+ }
669
+ static getInstance() {
670
+ return K.instance || (K.instance = new K()), K.instance;
671
+ }
672
+ ensureInitialized() {
673
+ if (!this.flagsmithClient)
674
+ throw new Error(de.NOT_INITIALIZED);
675
+ }
676
+ async init(u, d = []) {
677
+ if (!this.flagsmithClient)
678
+ try {
679
+ this.flagsmithClient = he.createFlagsmithInstance();
680
+ const v = d.reduce((s, T) => (s[T.feature.name] = T, s), {});
681
+ await this.flagsmithClient.init({
682
+ environmentID: u.apiKey,
683
+ api: (u == null ? void 0 : u.url) ?? "https://feature-flag-proxy.feedme.farm/api/v1/",
684
+ enableAnalytics: (u == null ? void 0 : u.enableAnalytics) ?? !0,
685
+ defaultFlags: v,
686
+ cacheFlags: (u == null ? void 0 : u.cacheFlags) ?? !0
687
+ });
688
+ } catch (v) {
689
+ throw console.error("Failed to initialize FeatureFlag:", v), v;
690
+ }
691
+ }
692
+ async setUser(u) {
693
+ this.ensureInitialized(), this.userContext = { identifier: u }, await this.updateContext();
694
+ }
695
+ async updateContext() {
696
+ try {
697
+ if (!this.userContext) return;
698
+ await this.flagsmithClient.setContext({
699
+ identity: {
700
+ identifier: this.userContext.identifier
701
+ }
702
+ });
703
+ } catch (u) {
704
+ throw console.error("Failed to update user context:", u), u;
705
+ }
706
+ }
707
+ async getFlags() {
708
+ this.ensureInitialized();
709
+ const u = this.flagsmithClient.getAllFlags();
710
+ return Object.entries(u).map(([d, v]) => {
711
+ var s;
712
+ return {
713
+ feature: {
714
+ name: d,
715
+ id: (v == null ? void 0 : v.id) ?? 0
716
+ },
717
+ enabled: v.enabled,
718
+ value: ((s = v.value) == null ? void 0 : s.toString()) ?? null
719
+ };
720
+ });
721
+ }
722
+ getFlagValue(u, d) {
723
+ this.ensureInitialized();
724
+ const v = this.flagsmithClient.getValue(u);
725
+ if (v == null)
726
+ return null;
727
+ try {
728
+ const s = v.toString();
729
+ return d ? d(s) : typeof {} == "number" ? isNaN(Number(s)) ? null : Number(s) : typeof {} == "boolean" ? s.toLowerCase() === "true" : s;
730
+ } catch (s) {
731
+ return console.error("Error transforming flag value:", s), null;
732
+ }
733
+ }
734
+ getFlag(u) {
735
+ this.ensureInitialized();
736
+ const d = this.flagsmithClient.getValue(u);
737
+ if (d == null) return null;
738
+ const v = this.flagsmithClient.hasFeature(u);
739
+ return {
740
+ feature: {
741
+ name: u,
742
+ id: 0
743
+ },
744
+ enabled: v,
745
+ value: d.toString()
746
+ };
747
+ }
748
+ async getUserFlagValue(u, d, v = null, s) {
749
+ var H;
750
+ const T = this.userContext;
751
+ try {
752
+ return await this.setUser(u), this.getFlagValue(d, s) ?? v;
753
+ } catch (D) {
754
+ return console.error(`Error getting user flag value for ${d}:`, D), v;
755
+ } finally {
756
+ try {
757
+ await ((H = this.flagsmithClient) == null ? void 0 : H.logout()), this.userContext = null, T && await this.setUser(T.identifier);
758
+ } catch (D) {
759
+ console.error("Error during cleanup:", D);
760
+ }
761
+ }
762
+ }
763
+ reset() {
764
+ this.flagsmithClient = null, this.userContext = null;
765
+ }
766
+ }, ot(K, "instance"), K), ge = ve.getInstance(), et = ut(!1), lt = ut([]), Z = ut(null);
767
+ function fe(m = ge) {
768
+ const u = () => et.value ? !0 : (console.warn("FeatureFlag is not initialized. Using default values."), !1), d = async (g, C = []) => {
769
+ if (et.value) {
770
+ console.warn("FeatureFlag is already initialized.");
771
+ return;
772
+ }
773
+ try {
774
+ await m.init(g, C), lt.value = await m.getFlags(), et.value = !0, Z.value = null;
775
+ } catch (b) {
776
+ console.error("Failed to initialize feature flags:", b), Z.value = b;
777
+ }
778
+ }, v = async (g) => {
779
+ if (u())
780
+ try {
781
+ await m.setUser(g), lt.value = await m.getFlags(), Z.value = null;
782
+ } catch (C) {
783
+ console.error("Failed to set user:", C), Z.value = C;
784
+ }
785
+ }, s = async (g) => v(`${ne}-${g}`), T = (g, C, b = null) => {
786
+ if (!u()) return b;
787
+ try {
788
+ return m.getFlagValue(g, C) ?? b;
789
+ } catch (G) {
790
+ return console.error(`Error getting flag value for ${g}:`, G), b;
791
+ }
792
+ }, H = (g, C) => {
793
+ if (!u()) return C ?? null;
794
+ try {
795
+ return m.getFlag(g) ?? C ?? null;
796
+ } catch (b) {
797
+ return console.error(`Error getting flag for ${g}:`, b), C ?? null;
798
+ }
799
+ }, D = async (g, C, b = null, G) => {
800
+ if (!u()) return b;
801
+ try {
802
+ return await m.getUserFlagValue(g, C, b, G);
803
+ } catch (it) {
804
+ return console.error(`Error getting user flag value for ${C}:`, it), b;
805
+ }
806
+ }, nt = async (g, C, b = null, G) => D(`${ne}-${g}`, C, b, G), _ = () => {
807
+ try {
808
+ m.reset();
809
+ } catch (g) {
810
+ console.error("Error resetting feature flags:", g);
811
+ } finally {
812
+ lt.value = [], et.value = !1, Z.value = null;
813
+ }
814
+ };
815
+ return {
816
+ flags: kt(lt),
817
+ isInitialized: kt(et),
818
+ error: kt(Z),
819
+ init: d,
820
+ setUser: v,
821
+ setBusiness: s,
822
+ getFlagValue: T,
823
+ getFlag: H,
824
+ getUserFlagValue: D,
825
+ getBusinessFlagValue: nt,
826
+ reset: _
827
+ };
828
+ }
829
+ var pe = () => fe();
830
+ function ye(m, u) {
831
+ if (!(m != null && m.enabled)) return !1;
832
+ const d = (m.value ?? "").split(",").map((v) => v.trim().toUpperCase()).filter(Boolean);
833
+ return !d.length || d.includes("*") ? !0 : !!u && d.includes(u.toUpperCase());
834
+ }
835
+ var me = { firebase: { apiKey: "AIzaSyAj8JdCHtP0Vc5vZobCfgoLzWxPIn0WUG4", authDomain: "feedme-dev-4c3ef.firebaseapp.com", databaseURL: "https://feedme-dev-4c3ef.firebaseio.com", projectId: "feedme-dev-4c3ef", storageBucket: "feedme-dev-4c3ef.appspot.com", messagingSenderId: "458797803788", appId: "1:458797803788:web:37f2af2926a84288f0c129", measurementId: "G-J2QG09D2Q7" }, assetBucketUrl: "feedme-dev-4c3ef.appspot.com", importFilesBucketUrl: "feedme-dev-4c3ef.appspot.com", clientId: "1a362d621873497b277ea55258cc82594ba148d235257f7bd44ea2acc132d8a4", featureFlagApiKey: "MaGoXrEWuEJNpWgKTqseee" };
836
+ const Ut = {
837
+ broadcastAppInbox: "connect_broadcast_app_inbox_countries",
838
+ broadcastPush: "connect_broadcast_push_countries",
839
+ broadcastWhatsapp: "connect_broadcast_whatsapp_countries"
840
+ }, Se = {
841
+ APP_INBOX: Ut.broadcastAppInbox,
842
+ PUSH: Ut.broadcastPush,
843
+ WHATSAPP: Ut.broadcastWhatsapp
844
+ }, { init: Ce, isInitialized: be, setBusiness: _e, flags: Fe } = pe(), Kt = ut(!1);
845
+ async function Ie(m) {
846
+ Kt.value = !1;
847
+ try {
848
+ be.value || await Ce({ apiKey: me.featureFlagApiKey }), await _e(m);
849
+ } catch (u) {
850
+ console.warn("CONNECT: loadBusinessFlags failed", u);
851
+ } finally {
852
+ Kt.value = !0;
853
+ }
854
+ }
855
+ function Ae() {
856
+ const m = ce();
857
+ return (u) => {
858
+ const d = Se[u];
859
+ return d ? Kt.value ? ye(
860
+ Fe.value.find((v) => v.feature.name === d),
861
+ m.currentCountry.value
862
+ ) ? "on" : "off" : "loading" : "on";
863
+ };
864
+ }
865
+ export {
866
+ Ie as l,
867
+ Ae as u
868
+ };