1 | var _typeof = require("./typeof.js")["default"];
|
2 | var _Map = require("core-js/library/fn/map.js");
|
3 | var _Symbol = require("core-js/library/fn/symbol/index.js");
|
4 | var _Symbol$for = require("core-js/library/fn/symbol/for.js");
|
5 | var _Object$getOwnPropertySymbols = require("core-js/library/fn/object/get-own-property-symbols.js");
|
6 | var _Object$setPrototypeOf = require("core-js/library/fn/object/set-prototype-of.js");
|
7 | var _Array$from = require("core-js/library/fn/array/from.js");
|
8 | var _Object$assign = require("core-js/library/fn/object/assign.js");
|
9 | var _Object$getOwnPropertyDescriptor = require("core-js/library/fn/object/get-own-property-descriptor.js");
|
10 | var _Object$defineProperty = require("core-js/library/fn/object/define-property.js");
|
11 | var _Array$isArray = require("core-js/library/fn/array/is-array.js");
|
12 | var setFunctionName = require("./setFunctionName.js");
|
13 | var toPropertyKey = require("./toPropertyKey.js");
|
14 | function old_createMetadataMethodsForProperty(e, t, a, r) {
|
15 | return {
|
16 | getMetadata: function getMetadata(o) {
|
17 | old_assertNotFinished(r, "getMetadata"), old_assertMetadataKey(o);
|
18 | var i = e[o];
|
19 | if (void 0 !== i) if (1 === t) {
|
20 | var n = i["public"];
|
21 | if (void 0 !== n) return n[a];
|
22 | } else if (2 === t) {
|
23 | var l = i["private"];
|
24 | if (void 0 !== l) return l.get(a);
|
25 | } else if (Object.hasOwnProperty.call(i, "constructor")) return i.constructor;
|
26 | },
|
27 | setMetadata: function setMetadata(o, i) {
|
28 | old_assertNotFinished(r, "setMetadata"), old_assertMetadataKey(o);
|
29 | var n = e[o];
|
30 | if (void 0 === n && (n = e[o] = {}), 1 === t) {
|
31 | var l = n["public"];
|
32 | void 0 === l && (l = n["public"] = {}), l[a] = i;
|
33 | } else if (2 === t) {
|
34 | var s = n.priv;
|
35 | void 0 === s && (s = n["private"] = new _Map()), s.set(a, i);
|
36 | } else n.constructor = i;
|
37 | }
|
38 | };
|
39 | }
|
40 | function old_convertMetadataMapToFinal(e, t) {
|
41 | var a = e[_Symbol.metadata || _Symbol$for("Symbol.metadata")],
|
42 | r = _Object$getOwnPropertySymbols(t);
|
43 | if (0 !== r.length) {
|
44 | for (var o = 0; o < r.length; o++) {
|
45 | var i = r[o],
|
46 | n = t[i],
|
47 | l = a ? a[i] : null,
|
48 | s = n["public"],
|
49 | c = l ? l["public"] : null;
|
50 | s && c && _Object$setPrototypeOf(s, c);
|
51 | var d = n["private"];
|
52 | if (d) {
|
53 | var u = _Array$from(d.values()),
|
54 | f = l ? l["private"] : null;
|
55 | f && (u = u.concat(f)), n["private"] = u;
|
56 | }
|
57 | l && _Object$setPrototypeOf(n, l);
|
58 | }
|
59 | a && _Object$setPrototypeOf(t, a), e[_Symbol.metadata || _Symbol$for("Symbol.metadata")] = t;
|
60 | }
|
61 | }
|
62 | function old_createAddInitializerMethod(e, t) {
|
63 | return function (a) {
|
64 | old_assertNotFinished(t, "addInitializer"), old_assertCallable(a, "An initializer"), e.push(a);
|
65 | };
|
66 | }
|
67 | function old_memberDec(e, t, a, r, o, i, n, l, s) {
|
68 | var c;
|
69 | switch (i) {
|
70 | case 1:
|
71 | c = "accessor";
|
72 | break;
|
73 | case 2:
|
74 | c = "method";
|
75 | break;
|
76 | case 3:
|
77 | c = "getter";
|
78 | break;
|
79 | case 4:
|
80 | c = "setter";
|
81 | break;
|
82 | default:
|
83 | c = "field";
|
84 | }
|
85 | var d,
|
86 | u,
|
87 | f = {
|
88 | kind: c,
|
89 | name: l ? "#" + t : toPropertyKey(t),
|
90 | isStatic: n,
|
91 | isPrivate: l
|
92 | },
|
93 | p = {
|
94 | v: !1
|
95 | };
|
96 | if (0 !== i && (f.addInitializer = old_createAddInitializerMethod(o, p)), l) {
|
97 | d = 2, u = _Symbol(t);
|
98 | var v = {};
|
99 | 0 === i ? (v.get = a.get, v.set = a.set) : 2 === i ? v.get = function () {
|
100 | return a.value;
|
101 | } : (1 !== i && 3 !== i || (v.get = function () {
|
102 | return a.get.call(this);
|
103 | }), 1 !== i && 4 !== i || (v.set = function (e) {
|
104 | a.set.call(this, e);
|
105 | })), f.access = v;
|
106 | } else d = 1, u = t;
|
107 | try {
|
108 | return e(s, _Object$assign(f, old_createMetadataMethodsForProperty(r, d, u, p)));
|
109 | } finally {
|
110 | p.v = !0;
|
111 | }
|
112 | }
|
113 | function old_assertNotFinished(e, t) {
|
114 | if (e.v) throw Error("attempted to call " + t + " after decoration was finished");
|
115 | }
|
116 | function old_assertMetadataKey(e) {
|
117 | if ("symbol" != _typeof(e)) throw new TypeError("Metadata keys must be symbols, received: " + e);
|
118 | }
|
119 | function old_assertCallable(e, t) {
|
120 | if ("function" != typeof e) throw new TypeError(t + " must be a function");
|
121 | }
|
122 | function old_assertValidReturnValue(e, t) {
|
123 | var a = _typeof(t);
|
124 | if (1 === e) {
|
125 | if ("object" !== a || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
126 | void 0 !== t.get && old_assertCallable(t.get, "accessor.get"), void 0 !== t.set && old_assertCallable(t.set, "accessor.set"), void 0 !== t.init && old_assertCallable(t.init, "accessor.init"), void 0 !== t.initializer && old_assertCallable(t.initializer, "accessor.initializer");
|
127 | } else if ("function" !== a) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0");
|
128 | }
|
129 | function old_getInit(e) {
|
130 | var t;
|
131 | return null == (t = e.init) && (t = e.initializer) && void 0 !== console && console.warn(".initializer has been renamed to .init as of March 2022"), t;
|
132 | }
|
133 | function old_applyMemberDec(e, t, a, r, o, i, n, l, s) {
|
134 | var c,
|
135 | d,
|
136 | u,
|
137 | f,
|
138 | p,
|
139 | v,
|
140 | y,
|
141 | h = a[0];
|
142 | if (n ? (0 === o || 1 === o ? (c = {
|
143 | get: a[3],
|
144 | set: a[4]
|
145 | }, u = "get") : 3 === o ? (c = {
|
146 | get: a[3]
|
147 | }, u = "get") : 4 === o ? (c = {
|
148 | set: a[3]
|
149 | }, u = "set") : c = {
|
150 | value: a[3]
|
151 | }, 0 !== o && (1 === o && setFunctionName(a[4], "#" + r, "set"), setFunctionName(a[3], "#" + r, u))) : 0 !== o && (c = _Object$getOwnPropertyDescriptor(t, r)), 1 === o ? f = {
|
152 | get: c.get,
|
153 | set: c.set
|
154 | } : 2 === o ? f = c.value : 3 === o ? f = c.get : 4 === o && (f = c.set), "function" == typeof h) void 0 !== (p = old_memberDec(h, r, c, l, s, o, i, n, f)) && (old_assertValidReturnValue(o, p), 0 === o ? d = p : 1 === o ? (d = old_getInit(p), v = p.get || f.get, y = p.set || f.set, f = {
|
155 | get: v,
|
156 | set: y
|
157 | }) : f = p);else for (var m = h.length - 1; m >= 0; m--) {
|
158 | var b;
|
159 | void 0 !== (p = old_memberDec(h[m], r, c, l, s, o, i, n, f)) && (old_assertValidReturnValue(o, p), 0 === o ? b = p : 1 === o ? (b = old_getInit(p), v = p.get || f.get, y = p.set || f.set, f = {
|
160 | get: v,
|
161 | set: y
|
162 | }) : f = p, void 0 !== b && (void 0 === d ? d = b : "function" == typeof d ? d = [d, b] : d.push(b)));
|
163 | }
|
164 | if (0 === o || 1 === o) {
|
165 | if (void 0 === d) d = function d(e, t) {
|
166 | return t;
|
167 | };else if ("function" != typeof d) {
|
168 | var g = d;
|
169 | d = function d(e, t) {
|
170 | for (var a = t, r = 0; r < g.length; r++) a = g[r].call(e, a);
|
171 | return a;
|
172 | };
|
173 | } else {
|
174 | var _ = d;
|
175 | d = function d(e, t) {
|
176 | return _.call(e, t);
|
177 | };
|
178 | }
|
179 | e.push(d);
|
180 | }
|
181 | 0 !== o && (1 === o ? (c.get = f.get, c.set = f.set) : 2 === o ? c.value = f : 3 === o ? c.get = f : 4 === o && (c.set = f), n ? 1 === o ? (e.push(function (e, t) {
|
182 | return f.get.call(e, t);
|
183 | }), e.push(function (e, t) {
|
184 | return f.set.call(e, t);
|
185 | })) : 2 === o ? e.push(f) : e.push(function (e, t) {
|
186 | return f.call(e, t);
|
187 | }) : _Object$defineProperty(t, r, c));
|
188 | }
|
189 | function old_applyMemberDecs(e, t, a, r, o) {
|
190 | for (var i, n, l = new _Map(), s = new _Map(), c = 0; c < o.length; c++) {
|
191 | var d = o[c];
|
192 | if (_Array$isArray(d)) {
|
193 | var u,
|
194 | f,
|
195 | p,
|
196 | v = d[1],
|
197 | y = d[2],
|
198 | h = d.length > 3,
|
199 | m = v >= 5;
|
200 | if (m ? (u = t, f = r, 0 != (v -= 5) && (p = n = n || [])) : (u = t.prototype, f = a, 0 !== v && (p = i = i || [])), 0 !== v && !h) {
|
201 | var b = m ? s : l,
|
202 | g = b.get(y) || 0;
|
203 | if (!0 === g || 3 === g && 4 !== v || 4 === g && 3 !== v) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + y);
|
204 | !g && v > 2 ? b.set(y, v) : b.set(y, !0);
|
205 | }
|
206 | old_applyMemberDec(e, u, d, y, v, m, h, f, p);
|
207 | }
|
208 | }
|
209 | old_pushInitializers(e, i), old_pushInitializers(e, n);
|
210 | }
|
211 | function old_pushInitializers(e, t) {
|
212 | t && e.push(function (e) {
|
213 | for (var a = 0; a < t.length; a++) t[a].call(e);
|
214 | return e;
|
215 | });
|
216 | }
|
217 | function old_applyClassDecs(e, t, a, r) {
|
218 | if (r.length > 0) {
|
219 | for (var o = [], i = t, n = t.name, l = r.length - 1; l >= 0; l--) {
|
220 | var s = {
|
221 | v: !1
|
222 | };
|
223 | try {
|
224 | var c = _Object$assign({
|
225 | kind: "class",
|
226 | name: n,
|
227 | addInitializer: old_createAddInitializerMethod(o, s)
|
228 | }, old_createMetadataMethodsForProperty(a, 0, n, s)),
|
229 | d = r[l](i, c);
|
230 | } finally {
|
231 | s.v = !0;
|
232 | }
|
233 | void 0 !== d && (old_assertValidReturnValue(10, d), i = d);
|
234 | }
|
235 | e.push(i, function () {
|
236 | for (var e = 0; e < o.length; e++) o[e].call(i);
|
237 | });
|
238 | }
|
239 | }
|
240 | function applyDecs(e, t, a) {
|
241 | var r = [],
|
242 | o = {},
|
243 | i = {};
|
244 | return old_applyMemberDecs(r, e, i, o, t), old_convertMetadataMapToFinal(e.prototype, i), old_applyClassDecs(r, e, o, a), old_convertMetadataMapToFinal(e, o), r;
|
245 | }
|
246 | module.exports = applyDecs, module.exports.__esModule = true, module.exports["default"] = module.exports; |
\ | No newline at end of file |