magtool 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/util.js ADDED
@@ -0,0 +1,134 @@
1
+ const E = (i) => {
2
+ const u = (e) => new URL((/* @__PURE__ */ Object.assign({}))[`/src/assets/img/${e}`], import.meta.url).href;
3
+ i.config.globalProperties.$getImg = u, window.$getImg = u;
4
+ const $ = (e, n = 0) => {
5
+ let t = parseInt(Math.random() * e);
6
+ return t += n, t;
7
+ };
8
+ window.$rn = $;
9
+ const g = (e, n) => {
10
+ let t = [];
11
+ for (let o = 0; o < e; o++)
12
+ t.push(n(o));
13
+ return t;
14
+ };
15
+ window.$fd = g, i.config.globalProperties.$setTimeout = function(e = () => {
16
+ }, n) {
17
+ this.timer && (clearTimeout(this.timer), this.timer = null), this.timer = setTimeout(() => {
18
+ e(), clearTimeout(this.timer);
19
+ }, n);
20
+ };
21
+ const b = (e) => e.substr(0, 1).toUpperCase() + e.substr(1, e.length).toLowerCase();
22
+ window.$toUpperCamel = b;
23
+ const c = (e, n = 2) => {
24
+ const t = window.$getType(e);
25
+ let o;
26
+ t === "Number" ? (e = e.toFixed(n), o = String(e), e = String(Math.abs(e))) : t === "String" && (o = e, e = String(Math.abs(Number(e))));
27
+ const r = e.split(".");
28
+ let a = r[0].split("");
29
+ a = a.reverse();
30
+ let l = [];
31
+ a.forEach((N, m) => {
32
+ m !== 0 && m % 3 === 0 && l.push(","), l.push(N);
33
+ });
34
+ let s = l.reverse().join("");
35
+ return window.$getType(n) === "Number" && n > 0 && (s += ".", r[1] ? s += r[1].padEnd(n, 0).substr(0, n) : s += "0".padEnd(n, "0")), Number(o) !== Number(e) ? `-${s}` : s;
36
+ };
37
+ window.$fa = c, i.config.globalProperties.$fa = c;
38
+ const p = ({
39
+ prop: e,
40
+ currency: n,
41
+ value: t,
42
+ obj: o = window.$map.asa.asaMetric.allObj
43
+ }) => {
44
+ const r = o[e];
45
+ return r.unit === "currency" ? n ? `${n} ${window.$fa(t, r == null ? void 0 : r.precision)}` : window.$fa(t, r == null ? void 0 : r.precision) : r.unit === "%" ? `${window.$fa(t, r == null ? void 0 : r.precision)}%` : window.$fa(t, r == null ? void 0 : r.precision);
46
+ };
47
+ window.$fu = p, i.config.globalProperties.$fu = p;
48
+ const d = (e = () => {
49
+ }, n = 2) => {
50
+ let t = null;
51
+ return new Promise((o, r) => {
52
+ t = setTimeout(() => {
53
+ e(o, r), clearTimeout(t), o(!0);
54
+ }, n * 100);
55
+ });
56
+ };
57
+ window.$pm = d, window.$promise = d;
58
+ const w = (e = () => {
59
+ }, n = 500) => {
60
+ let t;
61
+ return function(...o) {
62
+ t && clearTimeout(t), t = setTimeout(() => {
63
+ e.apply(this, o);
64
+ }, n);
65
+ };
66
+ };
67
+ window.$db = w, window.$debounce = w, Number.prototype.toFixedNumber = function(e) {
68
+ return Number(this.toFixed(e));
69
+ }, Array.prototype.filter1 = function(e) {
70
+ if (!e || typeof e != "function")
71
+ throw new Error(e + " is not a function");
72
+ let n, t;
73
+ for (let o = 0; o < this.length; o++)
74
+ if (e(this[o], o, this)) {
75
+ t = o, n = this[o];
76
+ break;
77
+ }
78
+ return {
79
+ index: t,
80
+ data: n
81
+ };
82
+ }, window.$getType = (e) => Object.prototype.toString.call(e).slice(8, -1);
83
+ const f = (e, n) => {
84
+ if (!e) {
85
+ console.info("No Value");
86
+ return;
87
+ }
88
+ const t = window.$l("Copied");
89
+ let o;
90
+ if (n ? window.$getType(n) !== "Boolean" ? o = `${t} ${n}: ${e}` : o = `${t}: ${e}` : o = t, navigator.clipboard && window.isSecureContext)
91
+ navigator.clipboard.writeText(e).then(() => {
92
+ i.config.globalProperties.$message.success({
93
+ message: o,
94
+ // grouping: true,
95
+ center: !0,
96
+ duration: 0
97
+ });
98
+ });
99
+ else {
100
+ let r = document.createElement("textarea");
101
+ r.value = e, r.style.position = "fixed", r.style.opacity = 0, document.body.appendChild(r), r.select(), document.execCommand("Copy"), r.remove(), i.config.globalProperties.$message.success({
102
+ message: o,
103
+ // grouping: true,
104
+ center: !0,
105
+ duration: 0
106
+ });
107
+ }
108
+ };
109
+ window.$copy = f, i.config.globalProperties.$copy = f;
110
+ const h = (e) => e < 1e3 ? e : e < 1e6 ? parseInt(e / 1e3) + "K" : parseInt(e / 1e6) + "M";
111
+ window.$sc = h;
112
+ const y = {
113
+ cpa: "avgCPA",
114
+ cpt: "avgCPT"
115
+ }, T = (e, n = y) => {
116
+ const t = n[e.name];
117
+ t && (e.name = t);
118
+ };
119
+ window.$nr = T;
120
+ const C = (e, n) => (Object.keys(e).forEach((t) => {
121
+ objMap[t] && (e[objMap[t]] = e[t], delete e[t]);
122
+ }), e);
123
+ window.$nro = C;
124
+ const P = (e) => {
125
+ let n = 0;
126
+ return Object.keys(e).forEach((t) => {
127
+ (window.$getType(e[t]) === "Array" && e[t].length !== 0 || e[t]) && n++;
128
+ }), n;
129
+ };
130
+ window.$pc = P;
131
+ };
132
+ export {
133
+ E as d
134
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "magtool",
3
3
  "packageManager": "yarn@4.4.1",
4
- "version": "1.0.0",
4
+ "version": "1.0.2",
5
5
  "author": "magxl",
6
6
  "main": "./dist/index.mjs",
7
7
  "module": "./dist/index.mjs",
@@ -11,8 +11,20 @@
11
11
  "require": "./dist/index.mjs"
12
12
  },
13
13
  "./cps": {
14
- "import": "./dist/composition.mjs",
15
- "require": "./dist/composition.mjs"
14
+ "import": "./dist/cps.mjs",
15
+ "require": "./dist/cps.mjs"
16
+ },
17
+ "./directive": {
18
+ "import": "./dist/directive.mjs",
19
+ "require": "./dist/directive.mjs"
20
+ },
21
+ "./util": {
22
+ "import": "./dist/util.mjs",
23
+ "require": "./dist/util.mjs"
24
+ },
25
+ "./pinia": {
26
+ "import": "./dist/pinia.mjs",
27
+ "require": "./dist/pinia.mjs"
16
28
  }
17
29
  },
18
30
  "scripts": {
@@ -23,7 +35,9 @@
23
35
  "dist/*"
24
36
  ],
25
37
  "dependencies": {
26
- "momentjs": "^2.0.0",
38
+ "magtool": "^1.0.1",
39
+ "moment": "^2.30.1",
40
+ "pinia": "^3.0.0",
27
41
  "vue": "^3.3.4"
28
42
  },
29
43
  "devDependencies": {
package/dist/magtool.mjs DELETED
@@ -1,320 +0,0 @@
1
- const v = (t) => {
2
- const { age: r } = t || {};
3
- let a, s;
4
- if (r != null && r.included) {
5
- const { minAge: n, maxAge: i } = r.included[0] || {};
6
- n ? a = n : a = "all", i ? s = i : s = "all";
7
- }
8
- return s === "all" ? a === "all" ? "All" : `${a}~65+` : `${a}~${s}`;
9
- }, I = (t, r) => t === "all" ? null : r === 65 ? {
10
- included: [
11
- {
12
- minAge: t
13
- }
14
- ]
15
- } : {
16
- included: [
17
- {
18
- minAge: t,
19
- maxAge: r
20
- }
21
- ]
22
- }, A = (t) => {
23
- const { gender: r } = t || {};
24
- return r != null && r.included ? r.included[0] : null;
25
- }, E = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
26
- __proto__: null,
27
- useAgeFormat: v,
28
- useAgeValue: I,
29
- useGenderFormat: A
30
- }, Symbol.toStringTag, { value: "Module" })), R = (t) => new Promise((r, a) => {
31
- const s = new Image();
32
- s.src = window.$getType(t) === "String" ? t : URL.createObjectURL(t), s.onload = () => r(s), s.onerror = () => a(new Error("Could not load image"));
33
- }), U = (t) => new Promise((r, a) => {
34
- const s = document.createElement("video");
35
- s.preload = "metadata", window.$getType(t) === "String" ? s.src = t : s.src = URL.createObjectURL(t), s.onloadedmetadata = () => {
36
- window.URL.revokeObjectURL(t), console.info([s]), r(s);
37
- };
38
- }), L = ({ type: t = "csv", data: r, name: a }) => {
39
- let s = document.createElement("a");
40
- if (t === "csv") {
41
- const i = new Blob(["\uFEFF" + r], {
42
- type: "text/csv,charset=UTF-8"
43
- });
44
- s.href = URL.createObjectURL(i);
45
- }
46
- let n = new MouseEvent("click");
47
- s.download = a || "download", s.dispatchEvent(n), (t === "csv" || t === "video") && URL.revokeObjectURL(s.url), s = null, n = null;
48
- }, N = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
49
- __proto__: null,
50
- download: L,
51
- loadImage: R,
52
- loadVideo: U
53
- }, Symbol.toStringTag, { value: "Module" })), x = ({ table: t, key: r, form: a, value: s, cb: n = () => {
54
- } }) => {
55
- const i = t.getSelectionRows();
56
- i.length > 1 ? (t.clearSelection(), t.toggleRowSelection(i[1], "selected"), a[s] = i[1][r]) : i.length === 1 && (a[s] = i[0][r]), n();
57
- }, k = (t = {}) => {
58
- let { sortable: r = !0, empty: a = !1, mmp: s = !1 } = t, n = window.$map.asa.asaMetric.all;
59
- s && (n = n.concat(window.$map.asa.mmpMetric.all));
60
- const i = n.map((m, $) => ({
61
- label: m.label,
62
- prop: m.value,
63
- width: m.width,
64
- sortable: r,
65
- type: m.type,
66
- align: m.align,
67
- visible: m.visible,
68
- formatter: m.formatter
69
- }));
70
- return i.unshift({
71
- label: "Currency",
72
- prop: "currency",
73
- width: 80,
74
- align: "right"
75
- }), i;
76
- }, F = () => ({
77
- label: "-"
78
- }), z = ({ columns: t, data: r, currency: a = "", channel: s = "" }) => {
79
- if (!r.length || !t.length)
80
- return [];
81
- const n = {
82
- spend: {
83
- prop: "spend",
84
- prefix: a,
85
- format: (p) => window.$fa(p, 2)
86
- },
87
- taps: {
88
- prop: "taps",
89
- format: (p) => window.$fa(p, 0)
90
- },
91
- installs: {
92
- prop: "installs",
93
- format: (p) => window.$fa(p, 0)
94
- },
95
- impressions: {
96
- prop: "impressions",
97
- format: (p) => window.$fa(p, 0)
98
- },
99
- mmpInstalls: {
100
- prop: "mmpInstalls",
101
- format: (p) => window.$fa(p, 0)
102
- },
103
- mmpCPI: {
104
- prop: "mmpCPI",
105
- format: (p) => window.$fa(p, 2)
106
- },
107
- IPM: {
108
- prop: "IPM",
109
- format: (p) => window.$fa(p, 2)
110
- },
111
- revenue: {
112
- prop: "revenue",
113
- format: (p) => window.$fa(p, 2)
114
- }
115
- }, i = [], m = {
116
- avgCPT: {},
117
- avgCPA: {},
118
- avgCPM: {},
119
- cr: {},
120
- ttr: {},
121
- IPM: {},
122
- mmpInstalls: {},
123
- mmpCPI: {}
124
- };
125
- t.forEach((p, d) => {
126
- m[p.property] && (m[p.property].i = d);
127
- const e = n[p.property];
128
- if (e) {
129
- e.i = d;
130
- let o = window.$bigNumber(0);
131
- r.forEach((l) => {
132
- o = o.plus(l[p.property] || 0);
133
- }), o = o.toNumber(), e.total = o, i.push(o);
134
- } else
135
- i.push("");
136
- }), Object.keys(n).forEach((p) => {
137
- const d = n[p];
138
- d.format && i[d.i] && (i[d.i] = d.format(i[d.i]));
139
- });
140
- const g = n.taps.total ? window.$fa(n.spend.total / n.taps.total) : "0.00";
141
- i[m.avgCPT.i] = g;
142
- const b = n.installs.total ? window.$fa(n.spend.total / n.installs.total) : "0.00";
143
- if (i[m.avgCPA.i] = b, m.avgCPM.i !== void 0) {
144
- const p = n.impressions.total ? window.$fa(n.spend.total / (n.impressions.total / 1e3)) : "0.00";
145
- i[m.avgCPM.i] = p;
146
- }
147
- const y = n.taps.total ? window.$fa(n.installs.total / n.taps.total * 100) : "0.00";
148
- i[m.cr.i] = y;
149
- const f = n.impressions.total ? window.$fa(n.taps.total / n.impressions.total * 100) : "0.00";
150
- i[m.ttr.i] = f;
151
- const h = n.impressions.total ? window.$fa(n.installs.total * 1e3 / n.impressions.total) : "0.00";
152
- return i[m.IPM.i] = h, i;
153
- }, B = (t) => {
154
- const r = window.$map.asa.allMetric.obj;
155
- return Object.keys(t).forEach((a) => {
156
- const s = t[a];
157
- r[a] && (t[`${a}Format`] = window.$fu({ prop: a, value: s, currency: !1, obj: r }));
158
- }), t;
159
- }, q = ({ columns: t, data: r }, a) => t.length && r.length ? t.map((n) => {
160
- let i = a[n.property] === void 0 ? "" : a[n.property];
161
- if (i !== "")
162
- try {
163
- i = window.$fa(i, window.$map.asa.allMetric.obj[n.property].precision);
164
- } catch {
165
- }
166
- return i;
167
- }) : [], G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
168
- __proto__: null,
169
- useColumn: k,
170
- useEmptyColumn: F,
171
- useFormat: B,
172
- useRemoteSummary: q,
173
- useSingleSelect: x,
174
- useSummary: z
175
- }, Symbol.toStringTag, { value: "Module" })), K = (t, r = 88) => {
176
- const a = document.querySelector("html"), { scrollTop: s } = a, n = t.getBoundingClientRect();
177
- a.scrollTo({
178
- top: s + n.y - r,
179
- behavior: "smooth"
180
- });
181
- }, V = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
182
- __proto__: null,
183
- pageScrollTo: K
184
- }, Symbol.toStringTag, { value: "Module" })), T = /* @__PURE__ */ Object.assign({ "./composition/ads.js": E, "./composition/media.js": N, "./composition/table.js": G, "./composition/tool.js": V });
185
- let C = {};
186
- Object.keys(T).forEach((t) => {
187
- C = { ...C, ...T[t] };
188
- });
189
- const S = C, M = (t) => {
190
- const r = (e) => new URL((/* @__PURE__ */ Object.assign({}))[`/src/assets/img/${e}`], import.meta.url).href;
191
- t.config.globalProperties.$getImg = r, window.$getImg = r;
192
- const a = (e, o = 0) => {
193
- let l = parseInt(Math.random() * e);
194
- return l += o, l;
195
- };
196
- window.$rn = a;
197
- const s = (e, o) => {
198
- let l = [];
199
- for (let c = 0; c < e; c++)
200
- l.push(o(c));
201
- return l;
202
- };
203
- window.$fd = s, t.config.globalProperties.$setTimeout = function(e = () => {
204
- }, o) {
205
- this.timer && (clearTimeout(this.timer), this.timer = null), this.timer = setTimeout(() => {
206
- e(), clearTimeout(this.timer);
207
- }, o);
208
- };
209
- const n = (e) => e.substr(0, 1).toUpperCase() + e.substr(1, e.length).toLowerCase();
210
- window.$toUpperCamel = n;
211
- const i = (e, o = 2) => {
212
- const l = window.$getType(e);
213
- let c;
214
- l === "Number" ? (e = e.toFixed(o), c = String(e), e = String(Math.abs(e))) : l === "String" && (c = e, e = String(Math.abs(Number(e))));
215
- const u = e.split(".");
216
- let _ = u[0].split("");
217
- _ = _.reverse();
218
- let P = [];
219
- _.forEach((O, j) => {
220
- j !== 0 && j % 3 === 0 && P.push(","), P.push(O);
221
- });
222
- let w = P.reverse().join("");
223
- return window.$getType(o) === "Number" && o > 0 && (w += ".", u[1] ? w += u[1].padEnd(o, 0).substr(0, o) : w += "0".padEnd(o, "0")), Number(c) !== Number(e) ? `-${w}` : w;
224
- };
225
- window.$fa = i, t.config.globalProperties.$fa = i;
226
- const m = ({ prop: e, currency: o, value: l, obj: c = window.$map.asa.asaMetric.allObj }) => {
227
- const u = c[e];
228
- return u.unit === "currency" ? o ? `${o} ${window.$fa(l, u == null ? void 0 : u.precision)}` : window.$fa(l, u == null ? void 0 : u.precision) : u.unit === "%" ? `${window.$fa(l, u == null ? void 0 : u.precision)}%` : window.$fa(l, u == null ? void 0 : u.precision);
229
- };
230
- window.$fu = m, t.config.globalProperties.$fu = m;
231
- const $ = (e = () => {
232
- }, o = 2) => {
233
- let l = null;
234
- return new Promise((c, u) => {
235
- l = setTimeout(() => {
236
- e(c, u), clearTimeout(l), c(!0);
237
- }, o * 100);
238
- });
239
- };
240
- window.$pm = $;
241
- const g = (e = () => {
242
- }, o = 500) => {
243
- let l;
244
- return function(...c) {
245
- l && clearTimeout(l), l = setTimeout(() => {
246
- e.apply(this, c);
247
- }, o);
248
- };
249
- };
250
- window.$db = g, Number.prototype.toFixedNumber = function(e) {
251
- return Number(this.toFixed(e));
252
- }, Array.prototype.filter1 = function(e) {
253
- if (!e || typeof e != "function")
254
- throw new Error(e + " is not a function");
255
- let o, l;
256
- for (let c = 0; c < this.length; c++)
257
- if (e(this[c], c, this)) {
258
- l = c, o = this[c];
259
- break;
260
- }
261
- return {
262
- index: l,
263
- data: o
264
- };
265
- }, window.$getType = (e) => Object.prototype.toString.call(e).slice(8, -1);
266
- const b = (e, o) => {
267
- if (!e) {
268
- console.info("No Value");
269
- return;
270
- }
271
- const l = window.$l("Copied");
272
- let c;
273
- if (o ? window.$getType(o) !== "Boolean" ? c = `${l} ${o}: ${e}` : c = `${l}: ${e}` : c = l, navigator.clipboard && window.isSecureContext)
274
- navigator.clipboard.writeText(e).then(() => {
275
- t.config.globalProperties.$message.success({
276
- message: c,
277
- // grouping: true,
278
- center: !0,
279
- duration: 0
280
- });
281
- });
282
- else {
283
- let u = document.createElement("textarea");
284
- u.value = e, u.style.position = "fixed", u.style.opacity = 0, document.body.appendChild(u), u.select(), document.execCommand("Copy"), u.remove(), t.config.globalProperties.$message.success({
285
- message: c,
286
- // grouping: true,
287
- center: !0,
288
- duration: 0
289
- });
290
- }
291
- };
292
- window.$copy = b, t.config.globalProperties.$copy = b;
293
- const y = (e) => e < 1e3 ? e : e < 1e6 ? parseInt(e / 1e3) + "K" : parseInt(e / 1e6) + "M";
294
- window.$sc = y;
295
- const f = {
296
- cpa: "avgCPA",
297
- cpt: "avgCPT"
298
- }, h = (e) => {
299
- const o = f[e.name];
300
- o && (e.name = o);
301
- };
302
- window.$nr = h;
303
- const p = (e) => (Object.keys(e).forEach((o) => {
304
- f[o] && (e[f[o]] = e[o], delete e[o]);
305
- }), e);
306
- window.$nro = p;
307
- const d = (e) => {
308
- let o = 0;
309
- return Object.keys(e).forEach((l) => {
310
- (window.$getType(e[l]) === "Array" && e[l].length !== 0 || e[l]) && o++;
311
- }), o;
312
- };
313
- window.$pc = d;
314
- }, H = (t, r) => (t.use(S).use(M), {
315
- composition: S,
316
- data: M
317
- });
318
- export {
319
- H as default
320
- };
@@ -1 +0,0 @@
1
- (function(f,b){typeof exports=="object"&&typeof module<"u"?module.exports=b():typeof define=="function"&&define.amd?define(b):(f=typeof globalThis<"u"?globalThis:f||self,f.magtool=b())})(this,function(){"use strict";var f=typeof document<"u"?document.currentScript:null;const j=Object.assign({"./composition/ads.js":Object.freeze(Object.defineProperty({__proto__:null,useAgeFormat:t=>{const{age:r}=t||{};let a,s;if(r!=null&&r.included){const{minAge:n,maxAge:i}=r.included[0]||{};n?a=n:a="all",i?s=i:s="all"}return s==="all"?a==="all"?"All":`${a}~65+`:`${a}~${s}`},useAgeValue:(t,r)=>t==="all"?null:r===65?{included:[{minAge:t}]}:{included:[{minAge:t,maxAge:r}]},useGenderFormat:t=>{const{gender:r}=t||{};return r!=null&&r.included?r.included[0]:null}},Symbol.toStringTag,{value:"Module"})),"./composition/media.js":Object.freeze(Object.defineProperty({__proto__:null,download:({type:t="csv",data:r,name:a})=>{let s=document.createElement("a");if(t==="csv"){const i=new Blob(["\uFEFF"+r],{type:"text/csv,charset=UTF-8"});s.href=URL.createObjectURL(i)}let n=new MouseEvent("click");s.download=a||"download",s.dispatchEvent(n),(t==="csv"||t==="video")&&URL.revokeObjectURL(s.url),s=null,n=null},loadImage:t=>new Promise((r,a)=>{const s=new Image;s.src=window.$getType(t)==="String"?t:URL.createObjectURL(t),s.onload=()=>r(s),s.onerror=()=>a(new Error("Could not load image"))}),loadVideo:t=>new Promise((r,a)=>{const s=document.createElement("video");s.preload="metadata",window.$getType(t)==="String"?s.src=t:s.src=URL.createObjectURL(t),s.onloadedmetadata=()=>{window.URL.revokeObjectURL(t),console.info([s]),r(s)}})},Symbol.toStringTag,{value:"Module"})),"./composition/table.js":Object.freeze(Object.defineProperty({__proto__:null,useColumn:(t={})=>{let{sortable:r=!0,empty:a=!1,mmp:s=!1}=t,n=window.$map.asa.asaMetric.all;s&&(n=n.concat(window.$map.asa.mmpMetric.all));const i=n.map((m,h)=>({label:m.label,prop:m.value,width:m.width,sortable:r,type:m.type,align:m.align,visible:m.visible,formatter:m.formatter}));return i.unshift({label:"Currency",prop:"currency",width:80,align:"right"}),i},useEmptyColumn:()=>({label:"-"}),useFormat:t=>{const r=window.$map.asa.allMetric.obj;return Object.keys(t).forEach(a=>{const s=t[a];r[a]&&(t[`${a}Format`]=window.$fu({prop:a,value:s,currency:!1,obj:r}))}),t},useRemoteSummary:({columns:t,data:r},a)=>t.length&&r.length?t.map(n=>{let i=a[n.property]===void 0?"":a[n.property];if(i!=="")try{i=window.$fa(i,window.$map.asa.allMetric.obj[n.property].precision)}catch{}return i}):[],useSingleSelect:({table:t,key:r,form:a,value:s,cb:n=()=>{}})=>{const i=t.getSelectionRows();i.length>1?(t.clearSelection(),t.toggleRowSelection(i[1],"selected"),a[s]=i[1][r]):i.length===1&&(a[s]=i[0][r]),n()},useSummary:({columns:t,data:r,currency:a="",channel:s=""})=>{if(!r.length||!t.length)return[];const n={spend:{prop:"spend",prefix:a,format:d=>window.$fa(d,2)},taps:{prop:"taps",format:d=>window.$fa(d,0)},installs:{prop:"installs",format:d=>window.$fa(d,0)},impressions:{prop:"impressions",format:d=>window.$fa(d,0)},mmpInstalls:{prop:"mmpInstalls",format:d=>window.$fa(d,0)},mmpCPI:{prop:"mmpCPI",format:d=>window.$fa(d,2)},IPM:{prop:"IPM",format:d=>window.$fa(d,2)},revenue:{prop:"revenue",format:d=>window.$fa(d,2)}},i=[],m={avgCPT:{},avgCPA:{},avgCPM:{},cr:{},ttr:{},IPM:{},mmpInstalls:{},mmpCPI:{}};t.forEach((d,p)=>{m[d.property]&&(m[d.property].i=p);const e=n[d.property];if(e){e.i=p;let o=window.$bigNumber(0);r.forEach(l=>{o=o.plus(l[d.property]||0)}),o=o.toNumber(),e.total=o,i.push(o)}else i.push("")}),Object.keys(n).forEach(d=>{const p=n[d];p.format&&i[p.i]&&(i[p.i]=p.format(i[p.i]))});const $=n.taps.total?window.$fa(n.spend.total/n.taps.total):"0.00";i[m.avgCPT.i]=$;const y=n.installs.total?window.$fa(n.spend.total/n.installs.total):"0.00";if(i[m.avgCPA.i]=y,m.avgCPM.i!==void 0){const d=n.impressions.total?window.$fa(n.spend.total/(n.impressions.total/1e3)):"0.00";i[m.avgCPM.i]=d}const C=n.taps.total?window.$fa(n.installs.total/n.taps.total*100):"0.00";i[m.cr.i]=C;const w=n.impressions.total?window.$fa(n.taps.total/n.impressions.total*100):"0.00";i[m.ttr.i]=w;const P=n.impressions.total?window.$fa(n.installs.total*1e3/n.impressions.total):"0.00";return i[m.IPM.i]=P,i}},Symbol.toStringTag,{value:"Module"})),"./composition/tool.js":Object.freeze(Object.defineProperty({__proto__:null,pageScrollTo:(t,r=88)=>{const a=document.querySelector("html"),{scrollTop:s}=a,n=t.getBoundingClientRect();a.scrollTo({top:s+n.y-r,behavior:"smooth"})}},Symbol.toStringTag,{value:"Module"}))});let _={};Object.keys(j).forEach(t=>{_={..._,...j[t]}});const v=_,M=t=>{const r=e=>new URL(Object.assign({})[`/src/assets/img/${e}`],typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:f&&f.tagName.toUpperCase()==="SCRIPT"&&f.src||new URL("magtool.umd.js",document.baseURI).href).href;t.config.globalProperties.$getImg=r,window.$getImg=r;const a=(e,o=0)=>{let l=parseInt(Math.random()*e);return l+=o,l};window.$rn=a;const s=(e,o)=>{let l=[];for(let c=0;c<e;c++)l.push(o(c));return l};window.$fd=s,t.config.globalProperties.$setTimeout=function(e=()=>{},o){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout(()=>{e(),clearTimeout(this.timer)},o)};const n=e=>e.substr(0,1).toUpperCase()+e.substr(1,e.length).toLowerCase();window.$toUpperCamel=n;const i=(e,o=2)=>{const l=window.$getType(e);let c;l==="Number"?(e=e.toFixed(o),c=String(e),e=String(Math.abs(e))):l==="String"&&(c=e,e=String(Math.abs(Number(e))));const u=e.split(".");let S=u[0].split("");S=S.reverse();let T=[];S.forEach((I,O)=>{O!==0&&O%3===0&&T.push(","),T.push(I)});let g=T.reverse().join("");return window.$getType(o)==="Number"&&o>0&&(g+=".",u[1]?g+=u[1].padEnd(o,0).substr(0,o):g+="0".padEnd(o,"0")),Number(c)!==Number(e)?`-${g}`:g};window.$fa=i,t.config.globalProperties.$fa=i;const m=({prop:e,currency:o,value:l,obj:c=window.$map.asa.asaMetric.allObj})=>{const u=c[e];return u.unit==="currency"?o?`${o} ${window.$fa(l,u==null?void 0:u.precision)}`:window.$fa(l,u==null?void 0:u.precision):u.unit==="%"?`${window.$fa(l,u==null?void 0:u.precision)}%`:window.$fa(l,u==null?void 0:u.precision)};window.$fu=m,t.config.globalProperties.$fu=m;const h=(e=()=>{},o=2)=>{let l=null;return new Promise((c,u)=>{l=setTimeout(()=>{e(c,u),clearTimeout(l),c(!0)},o*100)})};window.$pm=h;const $=(e=()=>{},o=500)=>{let l;return function(...c){l&&clearTimeout(l),l=setTimeout(()=>{e.apply(this,c)},o)}};window.$db=$,Number.prototype.toFixedNumber=function(e){return Number(this.toFixed(e))},Array.prototype.filter1=function(e){if(!e||typeof e!="function")throw new Error(e+" is not a function");let o,l;for(let c=0;c<this.length;c++)if(e(this[c],c,this)){l=c,o=this[c];break}return{index:l,data:o}},window.$getType=e=>Object.prototype.toString.call(e).slice(8,-1);const y=(e,o)=>{if(!e){console.info("No Value");return}const l=window.$l("Copied");let c;if(o?window.$getType(o)!=="Boolean"?c=`${l} ${o}: ${e}`:c=`${l}: ${e}`:c=l,navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(e).then(()=>{t.config.globalProperties.$message.success({message:c,center:!0,duration:0})});else{let u=document.createElement("textarea");u.value=e,u.style.position="fixed",u.style.opacity=0,document.body.appendChild(u),u.select(),document.execCommand("Copy"),u.remove(),t.config.globalProperties.$message.success({message:c,center:!0,duration:0})}};window.$copy=y,t.config.globalProperties.$copy=y;const C=e=>e<1e3?e:e<1e6?parseInt(e/1e3)+"K":parseInt(e/1e6)+"M";window.$sc=C;const w={cpa:"avgCPA",cpt:"avgCPT"},P=e=>{const o=w[e.name];o&&(e.name=o)};window.$nr=P;const d=e=>(Object.keys(e).forEach(o=>{w[o]&&(e[w[o]]=e[o],delete e[o])}),e);window.$nro=d;const p=e=>{let o=0;return Object.keys(e).forEach(l=>{(window.$getType(e[l])==="Array"&&e[l].length!==0||e[l])&&o++}),o};window.$pc=p};return(t,r)=>(t.use(v).use(M),{composition:v,data:M})});