styllar-react-plugin 1.0.0 → 1.0.1
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/styllar-react-plugin.js +293 -271
- package/dist/styllar-react-plugin.umd.cjs +9 -9
- package/package.json +2 -2
- package/src/StyllarPlugin.jsx +58 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
var
|
|
1
|
+
import ze, { useState as F, useEffect as fr } from "react";
|
|
2
|
+
var fe = { exports: {} }, J = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.min.js
|
|
@@ -10,20 +10,20 @@ var ue = { exports: {} }, B = {};
|
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/
|
|
12
12
|
var Ae;
|
|
13
|
-
function
|
|
14
|
-
if (Ae) return
|
|
13
|
+
function dr() {
|
|
14
|
+
if (Ae) return J;
|
|
15
15
|
Ae = 1;
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
for (
|
|
21
|
-
if (
|
|
22
|
-
return { $$typeof:
|
|
16
|
+
var z = ze, k = Symbol.for("react.element"), P = Symbol.for("react.fragment"), R = Object.prototype.hasOwnProperty, $ = z.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, W = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
|
+
function C(j, v, N) {
|
|
18
|
+
var p, S = {}, T = null, L = null;
|
|
19
|
+
N !== void 0 && (T = "" + N), v.key !== void 0 && (T = "" + v.key), v.ref !== void 0 && (L = v.ref);
|
|
20
|
+
for (p in v) R.call(v, p) && !W.hasOwnProperty(p) && (S[p] = v[p]);
|
|
21
|
+
if (j && j.defaultProps) for (p in v = j.defaultProps, v) S[p] === void 0 && (S[p] = v[p]);
|
|
22
|
+
return { $$typeof: k, type: j, key: T, ref: L, props: S, _owner: $.current };
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return J.Fragment = P, J.jsx = C, J.jsxs = C, J;
|
|
25
25
|
}
|
|
26
|
-
var
|
|
26
|
+
var K = {};
|
|
27
27
|
/**
|
|
28
28
|
* @license React
|
|
29
29
|
* react-jsx-runtime.development.js
|
|
@@ -34,17 +34,17 @@ var J = {};
|
|
|
34
34
|
* LICENSE file in the root directory of this source tree.
|
|
35
35
|
*/
|
|
36
36
|
var Ie;
|
|
37
|
-
function
|
|
37
|
+
function vr() {
|
|
38
38
|
return Ie || (Ie = 1, process.env.NODE_ENV !== "production" && function() {
|
|
39
|
-
var
|
|
39
|
+
var z = ze, k = Symbol.for("react.element"), P = Symbol.for("react.portal"), R = Symbol.for("react.fragment"), $ = Symbol.for("react.strict_mode"), W = Symbol.for("react.profiler"), C = Symbol.for("react.provider"), j = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), N = Symbol.for("react.suspense"), p = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), T = Symbol.for("react.lazy"), L = Symbol.for("react.offscreen"), U = Symbol.iterator, Q = "@@iterator";
|
|
40
40
|
function ee(e) {
|
|
41
41
|
if (e === null || typeof e != "object")
|
|
42
42
|
return null;
|
|
43
43
|
var r = U && e[U] || e[Q];
|
|
44
44
|
return typeof r == "function" ? r : null;
|
|
45
45
|
}
|
|
46
|
-
var
|
|
47
|
-
function
|
|
46
|
+
var O = z.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
47
|
+
function m(e) {
|
|
48
48
|
{
|
|
49
49
|
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
|
|
50
50
|
t[n - 1] = arguments[n];
|
|
@@ -53,71 +53,71 @@ function dr() {
|
|
|
53
53
|
}
|
|
54
54
|
function re(e, r, t) {
|
|
55
55
|
{
|
|
56
|
-
var n =
|
|
57
|
-
|
|
58
|
-
var c = t.map(function(
|
|
59
|
-
return String(
|
|
56
|
+
var n = O.ReactDebugCurrentFrame, s = n.getStackAddendum();
|
|
57
|
+
s !== "" && (r += "%s", t = t.concat([s]));
|
|
58
|
+
var c = t.map(function(i) {
|
|
59
|
+
return String(i);
|
|
60
60
|
});
|
|
61
61
|
c.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, c);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
function
|
|
67
|
-
return !!(typeof e == "string" || typeof e == "function" || e ===
|
|
64
|
+
var te = !1, o = !1, h = !1, f = !1, y = !1, g;
|
|
65
|
+
g = Symbol.for("react.module.reference");
|
|
66
|
+
function _(e) {
|
|
67
|
+
return !!(typeof e == "string" || typeof e == "function" || e === R || e === W || y || e === $ || e === N || e === p || f || e === L || te || o || h || typeof e == "object" && e !== null && (e.$$typeof === T || e.$$typeof === S || e.$$typeof === C || e.$$typeof === j || e.$$typeof === v || // This needs to include all possible module reference object
|
|
68
68
|
// types supported by any Flight configuration anywhere since
|
|
69
69
|
// we don't know which Flight build this will end up being used
|
|
70
70
|
// with.
|
|
71
|
-
e.$$typeof ===
|
|
71
|
+
e.$$typeof === g || e.getModuleId !== void 0));
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function E(e, r, t) {
|
|
74
74
|
var n = e.displayName;
|
|
75
75
|
if (n)
|
|
76
76
|
return n;
|
|
77
|
-
var
|
|
78
|
-
return
|
|
77
|
+
var s = r.displayName || r.name || "";
|
|
78
|
+
return s !== "" ? t + "(" + s + ")" : t;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function V(e) {
|
|
81
81
|
return e.displayName || "Context";
|
|
82
82
|
}
|
|
83
83
|
function D(e) {
|
|
84
84
|
if (e == null)
|
|
85
85
|
return null;
|
|
86
|
-
if (typeof e.tag == "number" &&
|
|
86
|
+
if (typeof e.tag == "number" && m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
87
87
|
return e.displayName || e.name || null;
|
|
88
88
|
if (typeof e == "string")
|
|
89
89
|
return e;
|
|
90
90
|
switch (e) {
|
|
91
|
-
case
|
|
91
|
+
case R:
|
|
92
92
|
return "Fragment";
|
|
93
|
-
case
|
|
93
|
+
case P:
|
|
94
94
|
return "Portal";
|
|
95
|
-
case L:
|
|
96
|
-
return "Profiler";
|
|
97
95
|
case W:
|
|
96
|
+
return "Profiler";
|
|
97
|
+
case $:
|
|
98
98
|
return "StrictMode";
|
|
99
|
-
case
|
|
99
|
+
case N:
|
|
100
100
|
return "Suspense";
|
|
101
|
-
case
|
|
101
|
+
case p:
|
|
102
102
|
return "SuspenseList";
|
|
103
103
|
}
|
|
104
104
|
if (typeof e == "object")
|
|
105
105
|
switch (e.$$typeof) {
|
|
106
|
-
case
|
|
106
|
+
case j:
|
|
107
107
|
var r = e;
|
|
108
|
-
return
|
|
109
|
-
case
|
|
108
|
+
return V(r) + ".Consumer";
|
|
109
|
+
case C:
|
|
110
110
|
var t = e;
|
|
111
|
-
return
|
|
112
|
-
case
|
|
113
|
-
return
|
|
114
|
-
case
|
|
111
|
+
return V(t._context) + ".Provider";
|
|
112
|
+
case v:
|
|
113
|
+
return E(e, e.render, "ForwardRef");
|
|
114
|
+
case S:
|
|
115
115
|
var n = e.displayName || null;
|
|
116
116
|
return n !== null ? n : D(e.type) || "Memo";
|
|
117
|
-
case
|
|
118
|
-
var
|
|
117
|
+
case T: {
|
|
118
|
+
var s = e, c = s._payload, i = s._init;
|
|
119
119
|
try {
|
|
120
|
-
return D(
|
|
120
|
+
return D(i(c));
|
|
121
121
|
} catch {
|
|
122
122
|
return null;
|
|
123
123
|
}
|
|
@@ -125,14 +125,14 @@ function dr() {
|
|
|
125
125
|
}
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
128
|
-
var A = Object.assign,
|
|
128
|
+
var A = Object.assign, q = 0, de, ve, pe, me, ge, he, be;
|
|
129
129
|
function ye() {
|
|
130
130
|
}
|
|
131
131
|
ye.__reactDisabledLog = !0;
|
|
132
|
-
function
|
|
132
|
+
function $e() {
|
|
133
133
|
{
|
|
134
|
-
if (
|
|
135
|
-
de = console.log, ve = console.info, pe = console.warn,
|
|
134
|
+
if (q === 0) {
|
|
135
|
+
de = console.log, ve = console.info, pe = console.warn, me = console.error, ge = console.group, he = console.groupCollapsed, be = console.groupEnd;
|
|
136
136
|
var e = {
|
|
137
137
|
configurable: !0,
|
|
138
138
|
enumerable: !0,
|
|
@@ -149,12 +149,12 @@ function dr() {
|
|
|
149
149
|
groupEnd: e
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
-
|
|
152
|
+
q++;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function We() {
|
|
156
156
|
{
|
|
157
|
-
if (
|
|
157
|
+
if (q--, q === 0) {
|
|
158
158
|
var e = {
|
|
159
159
|
configurable: !0,
|
|
160
160
|
enumerable: !0,
|
|
@@ -171,43 +171,43 @@ function dr() {
|
|
|
171
171
|
value: pe
|
|
172
172
|
}),
|
|
173
173
|
error: A({}, e, {
|
|
174
|
-
value:
|
|
174
|
+
value: me
|
|
175
175
|
}),
|
|
176
176
|
group: A({}, e, {
|
|
177
|
-
value:
|
|
177
|
+
value: ge
|
|
178
178
|
}),
|
|
179
179
|
groupCollapsed: A({}, e, {
|
|
180
|
-
value:
|
|
180
|
+
value: he
|
|
181
181
|
}),
|
|
182
182
|
groupEnd: A({}, e, {
|
|
183
183
|
value: be
|
|
184
184
|
})
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
-
|
|
187
|
+
q < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
var
|
|
190
|
+
var ne = O.ReactCurrentDispatcher, ae;
|
|
191
191
|
function X(e, r, t) {
|
|
192
192
|
{
|
|
193
|
-
if (
|
|
193
|
+
if (ae === void 0)
|
|
194
194
|
try {
|
|
195
195
|
throw Error();
|
|
196
|
-
} catch (
|
|
197
|
-
var n =
|
|
198
|
-
|
|
196
|
+
} catch (s) {
|
|
197
|
+
var n = s.stack.trim().match(/\n( *(at )?)/);
|
|
198
|
+
ae = n && n[1] || "";
|
|
199
199
|
}
|
|
200
200
|
return `
|
|
201
|
-
` +
|
|
201
|
+
` + ae + e;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
var
|
|
204
|
+
var oe = !1, G;
|
|
205
205
|
{
|
|
206
|
-
var
|
|
207
|
-
G = new
|
|
206
|
+
var Le = typeof WeakMap == "function" ? WeakMap : Map;
|
|
207
|
+
G = new Le();
|
|
208
208
|
}
|
|
209
209
|
function xe(e, r) {
|
|
210
|
-
if (!e ||
|
|
210
|
+
if (!e || oe)
|
|
211
211
|
return "";
|
|
212
212
|
{
|
|
213
213
|
var t = G.get(e);
|
|
@@ -215,69 +215,69 @@ function dr() {
|
|
|
215
215
|
return t;
|
|
216
216
|
}
|
|
217
217
|
var n;
|
|
218
|
-
|
|
219
|
-
var
|
|
218
|
+
oe = !0;
|
|
219
|
+
var s = Error.prepareStackTrace;
|
|
220
220
|
Error.prepareStackTrace = void 0;
|
|
221
221
|
var c;
|
|
222
|
-
c =
|
|
222
|
+
c = ne.current, ne.current = null, $e();
|
|
223
223
|
try {
|
|
224
224
|
if (r) {
|
|
225
|
-
var
|
|
225
|
+
var i = function() {
|
|
226
226
|
throw Error();
|
|
227
227
|
};
|
|
228
|
-
if (Object.defineProperty(
|
|
228
|
+
if (Object.defineProperty(i.prototype, "props", {
|
|
229
229
|
set: function() {
|
|
230
230
|
throw Error();
|
|
231
231
|
}
|
|
232
232
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
233
233
|
try {
|
|
234
|
-
Reflect.construct(
|
|
235
|
-
} catch (
|
|
236
|
-
n =
|
|
234
|
+
Reflect.construct(i, []);
|
|
235
|
+
} catch (x) {
|
|
236
|
+
n = x;
|
|
237
237
|
}
|
|
238
|
-
Reflect.construct(e, [],
|
|
238
|
+
Reflect.construct(e, [], i);
|
|
239
239
|
} else {
|
|
240
240
|
try {
|
|
241
|
-
|
|
242
|
-
} catch (
|
|
243
|
-
n =
|
|
241
|
+
i.call();
|
|
242
|
+
} catch (x) {
|
|
243
|
+
n = x;
|
|
244
244
|
}
|
|
245
|
-
e.call(
|
|
245
|
+
e.call(i.prototype);
|
|
246
246
|
}
|
|
247
247
|
} else {
|
|
248
248
|
try {
|
|
249
249
|
throw Error();
|
|
250
|
-
} catch (
|
|
251
|
-
n =
|
|
250
|
+
} catch (x) {
|
|
251
|
+
n = x;
|
|
252
252
|
}
|
|
253
253
|
e();
|
|
254
254
|
}
|
|
255
|
-
} catch (
|
|
256
|
-
if (
|
|
257
|
-
for (var a =
|
|
258
|
-
`),
|
|
259
|
-
`), u = a.length - 1,
|
|
260
|
-
|
|
261
|
-
for (; u >= 1 &&
|
|
262
|
-
if (a[u] !==
|
|
263
|
-
if (u !== 1 ||
|
|
255
|
+
} catch (x) {
|
|
256
|
+
if (x && n && typeof x.stack == "string") {
|
|
257
|
+
for (var a = x.stack.split(`
|
|
258
|
+
`), b = n.stack.split(`
|
|
259
|
+
`), u = a.length - 1, d = b.length - 1; u >= 1 && d >= 0 && a[u] !== b[d]; )
|
|
260
|
+
d--;
|
|
261
|
+
for (; u >= 1 && d >= 0; u--, d--)
|
|
262
|
+
if (a[u] !== b[d]) {
|
|
263
|
+
if (u !== 1 || d !== 1)
|
|
264
264
|
do
|
|
265
|
-
if (u--,
|
|
266
|
-
var
|
|
265
|
+
if (u--, d--, d < 0 || a[u] !== b[d]) {
|
|
266
|
+
var w = `
|
|
267
267
|
` + a[u].replace(" at new ", " at ");
|
|
268
|
-
return e.displayName &&
|
|
268
|
+
return e.displayName && w.includes("<anonymous>") && (w = w.replace("<anonymous>", e.displayName)), typeof e == "function" && G.set(e, w), w;
|
|
269
269
|
}
|
|
270
|
-
while (u >= 1 &&
|
|
270
|
+
while (u >= 1 && d >= 0);
|
|
271
271
|
break;
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
} finally {
|
|
275
|
-
|
|
275
|
+
oe = !1, ne.current = c, We(), Error.prepareStackTrace = s;
|
|
276
276
|
}
|
|
277
277
|
var M = e ? e.displayName || e.name : "", I = M ? X(M) : "";
|
|
278
278
|
return typeof e == "function" && G.set(e, I), I;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function Ye(e, r, t) {
|
|
281
281
|
return xe(e, !1);
|
|
282
282
|
}
|
|
283
283
|
function Me(e) {
|
|
@@ -292,28 +292,28 @@ function dr() {
|
|
|
292
292
|
if (typeof e == "string")
|
|
293
293
|
return X(e);
|
|
294
294
|
switch (e) {
|
|
295
|
-
case
|
|
295
|
+
case N:
|
|
296
296
|
return X("Suspense");
|
|
297
|
-
case
|
|
297
|
+
case p:
|
|
298
298
|
return X("SuspenseList");
|
|
299
299
|
}
|
|
300
300
|
if (typeof e == "object")
|
|
301
301
|
switch (e.$$typeof) {
|
|
302
|
-
case
|
|
303
|
-
return
|
|
304
|
-
case
|
|
302
|
+
case v:
|
|
303
|
+
return Ye(e.render);
|
|
304
|
+
case S:
|
|
305
305
|
return H(e.type, r, t);
|
|
306
|
-
case
|
|
307
|
-
var n = e,
|
|
306
|
+
case T: {
|
|
307
|
+
var n = e, s = n._payload, c = n._init;
|
|
308
308
|
try {
|
|
309
|
-
return H(c(
|
|
309
|
+
return H(c(s), r, t);
|
|
310
310
|
} catch {
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
return "";
|
|
315
315
|
}
|
|
316
|
-
var
|
|
316
|
+
var B = Object.prototype.hasOwnProperty, _e = {}, Ee = O.ReactDebugCurrentFrame;
|
|
317
317
|
function Z(e) {
|
|
318
318
|
if (e) {
|
|
319
319
|
var r = e._owner, t = H(e.type, e._source, r ? r.type : null);
|
|
@@ -321,27 +321,27 @@ function dr() {
|
|
|
321
321
|
} else
|
|
322
322
|
Ee.setExtraStackFrame(null);
|
|
323
323
|
}
|
|
324
|
-
function Ue(e, r, t, n,
|
|
324
|
+
function Ue(e, r, t, n, s) {
|
|
325
325
|
{
|
|
326
|
-
var c = Function.call.bind(
|
|
327
|
-
for (var
|
|
328
|
-
if (c(e,
|
|
326
|
+
var c = Function.call.bind(B);
|
|
327
|
+
for (var i in e)
|
|
328
|
+
if (c(e, i)) {
|
|
329
329
|
var a = void 0;
|
|
330
330
|
try {
|
|
331
|
-
if (typeof e[
|
|
332
|
-
var
|
|
333
|
-
throw
|
|
331
|
+
if (typeof e[i] != "function") {
|
|
332
|
+
var b = Error((n || "React class") + ": " + t + " type `" + i + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[i] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
333
|
+
throw b.name = "Invariant Violation", b;
|
|
334
334
|
}
|
|
335
|
-
a = e[
|
|
335
|
+
a = e[i](r, i, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
336
336
|
} catch (u) {
|
|
337
337
|
a = u;
|
|
338
338
|
}
|
|
339
|
-
a && !(a instanceof Error) && (Z(
|
|
339
|
+
a && !(a instanceof Error) && (Z(s), m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, i, typeof a), Z(null)), a instanceof Error && !(a.message in _e) && (_e[a.message] = !0, Z(s), m("Failed %s type: %s", t, a.message), Z(null));
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
var Ve = Array.isArray;
|
|
344
|
-
function
|
|
344
|
+
function ie(e) {
|
|
345
345
|
return Ve(e);
|
|
346
346
|
}
|
|
347
347
|
function qe(e) {
|
|
@@ -362,16 +362,16 @@ function dr() {
|
|
|
362
362
|
}
|
|
363
363
|
function we(e) {
|
|
364
364
|
if (Be(e))
|
|
365
|
-
return
|
|
365
|
+
return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", qe(e)), Re(e);
|
|
366
366
|
}
|
|
367
|
-
var
|
|
367
|
+
var Se = O.ReactCurrentOwner, Je = {
|
|
368
368
|
key: !0,
|
|
369
369
|
ref: !0,
|
|
370
370
|
__self: !0,
|
|
371
371
|
__source: !0
|
|
372
|
-
},
|
|
372
|
+
}, je, Te;
|
|
373
373
|
function Ke(e) {
|
|
374
|
-
if (
|
|
374
|
+
if (B.call(e, "ref")) {
|
|
375
375
|
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
376
376
|
if (r && r.isReactWarning)
|
|
377
377
|
return !1;
|
|
@@ -379,7 +379,7 @@ function dr() {
|
|
|
379
379
|
return e.ref !== void 0;
|
|
380
380
|
}
|
|
381
381
|
function Xe(e) {
|
|
382
|
-
if (
|
|
382
|
+
if (B.call(e, "key")) {
|
|
383
383
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
384
384
|
if (r && r.isReactWarning)
|
|
385
385
|
return !1;
|
|
@@ -387,12 +387,12 @@ function dr() {
|
|
|
387
387
|
return e.key !== void 0;
|
|
388
388
|
}
|
|
389
389
|
function Ge(e, r) {
|
|
390
|
-
typeof e.ref == "string" &&
|
|
390
|
+
typeof e.ref == "string" && Se.current;
|
|
391
391
|
}
|
|
392
392
|
function He(e, r) {
|
|
393
393
|
{
|
|
394
394
|
var t = function() {
|
|
395
|
-
|
|
395
|
+
je || (je = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
396
396
|
};
|
|
397
397
|
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
398
398
|
get: t,
|
|
@@ -403,7 +403,7 @@ function dr() {
|
|
|
403
403
|
function Ze(e, r) {
|
|
404
404
|
{
|
|
405
405
|
var t = function() {
|
|
406
|
-
Te || (Te = !0,
|
|
406
|
+
Te || (Te = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
407
407
|
};
|
|
408
408
|
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
409
409
|
get: t,
|
|
@@ -411,15 +411,15 @@ function dr() {
|
|
|
411
411
|
});
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
var Qe = function(e, r, t, n,
|
|
414
|
+
var Qe = function(e, r, t, n, s, c, i) {
|
|
415
415
|
var a = {
|
|
416
416
|
// This tag allows us to uniquely identify this as a React Element
|
|
417
|
-
$$typeof:
|
|
417
|
+
$$typeof: k,
|
|
418
418
|
// Built-in properties that belong on the element
|
|
419
419
|
type: e,
|
|
420
420
|
key: r,
|
|
421
421
|
ref: t,
|
|
422
|
-
props:
|
|
422
|
+
props: i,
|
|
423
423
|
// Record the component responsible for creating this element.
|
|
424
424
|
_owner: c
|
|
425
425
|
};
|
|
@@ -437,44 +437,44 @@ function dr() {
|
|
|
437
437
|
configurable: !1,
|
|
438
438
|
enumerable: !1,
|
|
439
439
|
writable: !1,
|
|
440
|
-
value:
|
|
440
|
+
value: s
|
|
441
441
|
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
442
442
|
};
|
|
443
|
-
function er(e, r, t, n,
|
|
443
|
+
function er(e, r, t, n, s) {
|
|
444
444
|
{
|
|
445
|
-
var c,
|
|
446
|
-
t !== void 0 && (we(t), a = "" + t), Xe(r) && (we(r.key), a = "" + r.key), Ke(r) && (
|
|
445
|
+
var c, i = {}, a = null, b = null;
|
|
446
|
+
t !== void 0 && (we(t), a = "" + t), Xe(r) && (we(r.key), a = "" + r.key), Ke(r) && (b = r.ref, Ge(r, s));
|
|
447
447
|
for (c in r)
|
|
448
|
-
|
|
448
|
+
B.call(r, c) && !Je.hasOwnProperty(c) && (i[c] = r[c]);
|
|
449
449
|
if (e && e.defaultProps) {
|
|
450
450
|
var u = e.defaultProps;
|
|
451
451
|
for (c in u)
|
|
452
|
-
|
|
452
|
+
i[c] === void 0 && (i[c] = u[c]);
|
|
453
453
|
}
|
|
454
|
-
if (a ||
|
|
455
|
-
var
|
|
456
|
-
a && He(
|
|
454
|
+
if (a || b) {
|
|
455
|
+
var d = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
456
|
+
a && He(i, d), b && Ze(i, d);
|
|
457
457
|
}
|
|
458
|
-
return Qe(e, a,
|
|
458
|
+
return Qe(e, a, b, s, n, Se.current, i);
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
var
|
|
462
|
-
function
|
|
461
|
+
var se = O.ReactCurrentOwner, Ce = O.ReactDebugCurrentFrame;
|
|
462
|
+
function Y(e) {
|
|
463
463
|
if (e) {
|
|
464
464
|
var r = e._owner, t = H(e.type, e._source, r ? r.type : null);
|
|
465
465
|
Ce.setExtraStackFrame(t);
|
|
466
466
|
} else
|
|
467
467
|
Ce.setExtraStackFrame(null);
|
|
468
468
|
}
|
|
469
|
-
var
|
|
470
|
-
|
|
471
|
-
function
|
|
472
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
469
|
+
var le;
|
|
470
|
+
le = !1;
|
|
471
|
+
function ce(e) {
|
|
472
|
+
return typeof e == "object" && e !== null && e.$$typeof === k;
|
|
473
473
|
}
|
|
474
474
|
function Oe() {
|
|
475
475
|
{
|
|
476
|
-
if (
|
|
477
|
-
var e = D(
|
|
476
|
+
if (se.current) {
|
|
477
|
+
var e = D(se.current.type);
|
|
478
478
|
if (e)
|
|
479
479
|
return `
|
|
480
480
|
|
|
@@ -509,25 +509,25 @@ Check the top-level render call using <` + t + ">.");
|
|
|
509
509
|
return;
|
|
510
510
|
ke[t] = !0;
|
|
511
511
|
var n = "";
|
|
512
|
-
e && e._owner && e._owner !==
|
|
512
|
+
e && e._owner && e._owner !== se.current && (n = " It was passed a child from " + D(e._owner.type) + "."), Y(e), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), Y(null);
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
function Ne(e, r) {
|
|
516
516
|
{
|
|
517
517
|
if (typeof e != "object")
|
|
518
518
|
return;
|
|
519
|
-
if (
|
|
519
|
+
if (ie(e))
|
|
520
520
|
for (var t = 0; t < e.length; t++) {
|
|
521
521
|
var n = e[t];
|
|
522
|
-
|
|
522
|
+
ce(n) && Pe(n, r);
|
|
523
523
|
}
|
|
524
|
-
else if (
|
|
524
|
+
else if (ce(e))
|
|
525
525
|
e._store && (e._store.validated = !0);
|
|
526
526
|
else if (e) {
|
|
527
|
-
var
|
|
528
|
-
if (typeof
|
|
529
|
-
for (var c =
|
|
530
|
-
|
|
527
|
+
var s = ee(e);
|
|
528
|
+
if (typeof s == "function" && s !== e.entries)
|
|
529
|
+
for (var c = s.call(e), i; !(i = c.next()).done; )
|
|
530
|
+
ce(i.value) && Pe(i.value, r);
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
}
|
|
@@ -539,21 +539,21 @@ Check the top-level render call using <` + t + ">.");
|
|
|
539
539
|
var t;
|
|
540
540
|
if (typeof r == "function")
|
|
541
541
|
t = r.propTypes;
|
|
542
|
-
else if (typeof r == "object" && (r.$$typeof ===
|
|
542
|
+
else if (typeof r == "object" && (r.$$typeof === v || // Note: Memo only checks outer props here.
|
|
543
543
|
// Inner props are checked in the reconciler.
|
|
544
|
-
r.$$typeof ===
|
|
544
|
+
r.$$typeof === S))
|
|
545
545
|
t = r.propTypes;
|
|
546
546
|
else
|
|
547
547
|
return;
|
|
548
548
|
if (t) {
|
|
549
549
|
var n = D(r);
|
|
550
550
|
Ue(t, e.props, "prop", n, e);
|
|
551
|
-
} else if (r.PropTypes !== void 0 && !
|
|
552
|
-
|
|
553
|
-
var
|
|
554
|
-
|
|
551
|
+
} else if (r.PropTypes !== void 0 && !le) {
|
|
552
|
+
le = !0;
|
|
553
|
+
var s = D(r);
|
|
554
|
+
m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", s || "Unknown");
|
|
555
555
|
}
|
|
556
|
-
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved &&
|
|
556
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
function ar(e) {
|
|
@@ -561,56 +561,56 @@ Check the top-level render call using <` + t + ">.");
|
|
|
561
561
|
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
562
562
|
var n = r[t];
|
|
563
563
|
if (n !== "children" && n !== "key") {
|
|
564
|
-
|
|
564
|
+
Y(e), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), Y(null);
|
|
565
565
|
break;
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
|
-
e.ref !== null && (
|
|
568
|
+
e.ref !== null && (Y(e), m("Invalid attribute `ref` supplied to `React.Fragment`."), Y(null));
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
571
|
var De = {};
|
|
572
|
-
function Fe(e, r, t, n,
|
|
572
|
+
function Fe(e, r, t, n, s, c) {
|
|
573
573
|
{
|
|
574
|
-
var
|
|
575
|
-
if (!
|
|
574
|
+
var i = _(e);
|
|
575
|
+
if (!i) {
|
|
576
576
|
var a = "";
|
|
577
577
|
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
578
|
-
var
|
|
579
|
-
|
|
578
|
+
var b = rr();
|
|
579
|
+
b ? a += b : a += Oe();
|
|
580
580
|
var u;
|
|
581
|
-
e === null ? u = "null" :
|
|
581
|
+
e === null ? u = "null" : ie(e) ? u = "array" : e !== void 0 && e.$$typeof === k ? (u = "<" + (D(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : u = typeof e, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", u, a);
|
|
582
582
|
}
|
|
583
|
-
var
|
|
584
|
-
if (
|
|
585
|
-
return
|
|
586
|
-
if (
|
|
587
|
-
var
|
|
588
|
-
if (
|
|
583
|
+
var d = er(e, r, t, s, c);
|
|
584
|
+
if (d == null)
|
|
585
|
+
return d;
|
|
586
|
+
if (i) {
|
|
587
|
+
var w = r.children;
|
|
588
|
+
if (w !== void 0)
|
|
589
589
|
if (n)
|
|
590
|
-
if (
|
|
591
|
-
for (var M = 0; M <
|
|
592
|
-
Ne(
|
|
593
|
-
Object.freeze && Object.freeze(
|
|
590
|
+
if (ie(w)) {
|
|
591
|
+
for (var M = 0; M < w.length; M++)
|
|
592
|
+
Ne(w[M], e);
|
|
593
|
+
Object.freeze && Object.freeze(w);
|
|
594
594
|
} else
|
|
595
|
-
|
|
595
|
+
m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
596
596
|
else
|
|
597
|
-
Ne(
|
|
597
|
+
Ne(w, e);
|
|
598
598
|
}
|
|
599
|
-
if (
|
|
600
|
-
var I = D(e),
|
|
599
|
+
if (B.call(r, "key")) {
|
|
600
|
+
var I = D(e), x = Object.keys(r).filter(function(ur) {
|
|
601
601
|
return ur !== "key";
|
|
602
|
-
}),
|
|
603
|
-
if (!De[I +
|
|
604
|
-
var cr =
|
|
605
|
-
|
|
602
|
+
}), ue = x.length > 0 ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
603
|
+
if (!De[I + ue]) {
|
|
604
|
+
var cr = x.length > 0 ? "{" + x.join(": ..., ") + ": ...}" : "{}";
|
|
605
|
+
m(`A props object containing a "key" prop is being spread into JSX:
|
|
606
606
|
let props = %s;
|
|
607
607
|
<%s {...props} />
|
|
608
608
|
React keys must be passed directly to JSX without using spread:
|
|
609
609
|
let props = %s;
|
|
610
|
-
<%s key={someKey} {...props} />`,
|
|
610
|
+
<%s key={someKey} {...props} />`, ue, I, cr, I), De[I + ue] = !0;
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
|
-
return e ===
|
|
613
|
+
return e === R ? ar(d) : nr(d), d;
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
616
|
function or(e, r, t) {
|
|
@@ -620,157 +620,179 @@ React keys must be passed directly to JSX without using spread:
|
|
|
620
620
|
return Fe(e, r, t, !1);
|
|
621
621
|
}
|
|
622
622
|
var sr = ir, lr = or;
|
|
623
|
-
|
|
624
|
-
}()),
|
|
623
|
+
K.Fragment = R, K.jsx = sr, K.jsxs = lr;
|
|
624
|
+
}()), K;
|
|
625
625
|
}
|
|
626
|
-
process.env.NODE_ENV === "production" ?
|
|
627
|
-
var
|
|
628
|
-
const
|
|
629
|
-
const [
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
626
|
+
process.env.NODE_ENV === "production" ? fe.exports = dr() : fe.exports = vr();
|
|
627
|
+
var l = fe.exports;
|
|
628
|
+
const mr = () => {
|
|
629
|
+
const [z, k] = F(!1), [P, R] = F("idle"), [$, W] = F(""), [C, j] = F(null), [v, N] = F(""), [p, S] = F(""), [T, L] = F(null), [U, Q] = F(null), ee = "http://136.113.197.77:5000/predict/size-from-chart", O = (o) => {
|
|
630
|
+
if (!o) return;
|
|
631
|
+
const h = () => {
|
|
632
|
+
const f = document.querySelectorAll('button, .size-swatch, .size-option, li[role="radio"], div[data-value]');
|
|
633
|
+
for (let y of f) {
|
|
634
|
+
const g = y.innerText.trim().toUpperCase(), _ = String(o).trim().toUpperCase();
|
|
635
|
+
if (g === _ || g === `SIZE ${_}`)
|
|
636
|
+
return y.click(), console.log(`Styllar: Successfully auto-selected size ${o}`), !0;
|
|
637
|
+
}
|
|
638
|
+
return !1;
|
|
639
|
+
};
|
|
640
|
+
if (!h()) {
|
|
641
|
+
let f = 0;
|
|
642
|
+
const y = setInterval(() => {
|
|
643
|
+
f++, (h() || f > 10) && clearInterval(y);
|
|
644
|
+
}, 500);
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
fr(() => {
|
|
648
|
+
typeof chrome < "u" && chrome.storage && chrome.storage.local.get(["styllar_last_size"], (o) => {
|
|
649
|
+
o.styllar_last_size && (console.log("Styllar: Found saved size:", o.styllar_last_size), setTimeout(() => O(o.styllar_last_size), 1e3));
|
|
650
|
+
});
|
|
651
|
+
}, []);
|
|
652
|
+
function m() {
|
|
653
|
+
var _;
|
|
654
|
+
let o = 0, h = 0;
|
|
655
|
+
const f = ["pant", "jeans", "trouser", "skirt", "short", "legging", "jogger", "bottom", "denim", "cargo"], y = ["shirt", "top", "tee", "blouse", "jacket", "coat", "hoodie", "sweater", "vest", "cardigan", "dress", "t-shirt"], g = (document.title + " " + (((_ = document.querySelector("h1")) == null ? void 0 : _.innerText) || "")).toLowerCase();
|
|
656
|
+
return f.forEach((E) => {
|
|
657
|
+
g.includes(E) && (h += 2);
|
|
658
|
+
}), y.forEach((E) => {
|
|
659
|
+
g.includes(E) && (o += 2);
|
|
660
|
+
}), h > o ? "bottom" : "top";
|
|
639
661
|
}
|
|
640
|
-
function
|
|
641
|
-
const
|
|
642
|
-
if (
|
|
643
|
-
return
|
|
644
|
-
const
|
|
645
|
-
for (let
|
|
646
|
-
const
|
|
647
|
-
if (
|
|
648
|
-
return
|
|
649
|
-
}
|
|
650
|
-
const
|
|
651
|
-
return
|
|
652
|
-
const
|
|
653
|
-
/^(XS|S|M|L|XL|XXL|[0-9]{2})$/i.test(
|
|
654
|
-
}),
|
|
662
|
+
function re() {
|
|
663
|
+
const o = { chart_type: "none", chart_content: null, available_sizes: [] }, h = document.querySelector("table");
|
|
664
|
+
if (h && /chest|waist|bust|hip|size/i.test(h.innerText))
|
|
665
|
+
return o.chart_type = "html_table", o.chart_content = h.outerHTML, o;
|
|
666
|
+
const f = document.querySelectorAll("img");
|
|
667
|
+
for (let _ of f) {
|
|
668
|
+
const E = _.src.toLowerCase(), V = (_.alt || "").toLowerCase();
|
|
669
|
+
if (E.includes("size") && E.includes("chart") || V.includes("size") && V.includes("guide"))
|
|
670
|
+
return o.chart_type = "image_url", o.chart_content = _.src, o;
|
|
671
|
+
}
|
|
672
|
+
const y = document.querySelector('.size-guide, #size-chart, .measurement-guide, [class*="SizeGuide"]');
|
|
673
|
+
return y ? (o.chart_type = "raw_text", o.chart_content = y.innerText, o) : (document.querySelectorAll("button, span, li").forEach((_) => {
|
|
674
|
+
const E = _.innerText.trim();
|
|
675
|
+
/^(XS|S|M|L|XL|XXL|[0-9]{2})$/i.test(E) && E.length < 4 && (o.available_sizes.includes(E) || o.available_sizes.push(E));
|
|
676
|
+
}), o);
|
|
655
677
|
}
|
|
656
|
-
const
|
|
657
|
-
if (!
|
|
678
|
+
const te = async () => {
|
|
679
|
+
if (!T || !U || !v || !p) {
|
|
658
680
|
alert("Please fill all fields.");
|
|
659
681
|
return;
|
|
660
682
|
}
|
|
661
|
-
|
|
662
|
-
const
|
|
663
|
-
|
|
683
|
+
R("loading");
|
|
684
|
+
const o = m(), h = re(), f = new FormData();
|
|
685
|
+
f.append("front_image", T), f.append("side_image", U), f.append("height", v), f.append("weight", p), f.append("product_type", o), f.append("chart_type", h.chart_type), f.append("chart_content", h.chart_content), f.append("available_sizes", JSON.stringify(h.available_sizes));
|
|
664
686
|
try {
|
|
665
|
-
const
|
|
666
|
-
if (
|
|
667
|
-
|
|
668
|
-
} catch (
|
|
669
|
-
|
|
687
|
+
const g = await (await fetch(ee, { method: "POST", body: f })).json();
|
|
688
|
+
if (g.error) throw new Error(g.error);
|
|
689
|
+
j(g), R("success"), g.recommended_size && (O(g.recommended_size), typeof chrome < "u" && chrome.storage && chrome.storage.local.set({ styllar_last_size: g.recommended_size }));
|
|
690
|
+
} catch (y) {
|
|
691
|
+
W(y.message), R("error");
|
|
670
692
|
}
|
|
671
693
|
};
|
|
672
|
-
return /* @__PURE__ */
|
|
673
|
-
/* @__PURE__ */
|
|
694
|
+
return /* @__PURE__ */ l.jsxs("div", { className: "fixed bottom-6 right-6 z-[999999]", children: [
|
|
695
|
+
/* @__PURE__ */ l.jsx(
|
|
674
696
|
"button",
|
|
675
697
|
{
|
|
676
|
-
onClick: () =>
|
|
698
|
+
onClick: () => k(!z),
|
|
677
699
|
className: "bg-black text-white px-7 py-3.5 rounded-full shadow-xl font-bold text-sm hover:opacity-80 transition-opacity",
|
|
678
700
|
children: "Styllar"
|
|
679
701
|
}
|
|
680
702
|
),
|
|
681
|
-
|
|
682
|
-
/* @__PURE__ */
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
703
|
+
z && /* @__PURE__ */ l.jsxs("div", { className: "absolute bottom-20 right-0 w-[330px] bg-white rounded-2xl p-6 shadow-2xl border border-gray-100 text-black", children: [
|
|
704
|
+
/* @__PURE__ */ l.jsxs("div", { className: "flex justify-between items-center mb-4", children: [
|
|
705
|
+
/* @__PURE__ */ l.jsx("h3", { className: "m-0 text-lg font-bold", children: "Smart Fit Assistant" }),
|
|
706
|
+
/* @__PURE__ */ l.jsx("button", { onClick: () => k(!1), className: "text-gray-400 hover:text-black text-2xl leading-none", children: "×" })
|
|
685
707
|
] }),
|
|
686
|
-
|
|
687
|
-
/* @__PURE__ */
|
|
688
|
-
/* @__PURE__ */
|
|
708
|
+
P === "loading" && /* @__PURE__ */ l.jsxs("div", { className: "flex flex-col items-center justify-center py-8", children: [
|
|
709
|
+
/* @__PURE__ */ l.jsx("div", { className: "w-8 h-8 border-4 border-gray-200 border-t-black rounded-full animate-spin mb-4" }),
|
|
710
|
+
/* @__PURE__ */ l.jsx("p", { className: "text-sm text-gray-600", children: "Analyzing body & page data..." })
|
|
689
711
|
] }),
|
|
690
|
-
|
|
691
|
-
/* @__PURE__ */
|
|
692
|
-
/* @__PURE__ */
|
|
693
|
-
/* @__PURE__ */
|
|
712
|
+
P === "success" && C && /* @__PURE__ */ l.jsxs("div", { className: "text-center py-6", children: [
|
|
713
|
+
/* @__PURE__ */ l.jsx("div", { className: "text-sm text-green-600 font-bold tracking-wider", children: "MATCH FOUND" }),
|
|
714
|
+
/* @__PURE__ */ l.jsx("div", { className: "text-5xl font-black my-4 text-black", children: C.recommended_size }),
|
|
715
|
+
/* @__PURE__ */ l.jsxs("div", { className: "text-xs text-gray-500 mb-6", children: [
|
|
694
716
|
"Confidence: ",
|
|
695
|
-
|
|
717
|
+
C.confidence
|
|
696
718
|
] }),
|
|
697
|
-
/* @__PURE__ */
|
|
719
|
+
/* @__PURE__ */ l.jsx(
|
|
698
720
|
"button",
|
|
699
721
|
{
|
|
700
722
|
onClick: () => {
|
|
701
|
-
|
|
723
|
+
R("idle"), j(null);
|
|
702
724
|
},
|
|
703
725
|
className: "text-blue-600 text-sm underline hover:text-blue-800",
|
|
704
726
|
children: "Run New Scan"
|
|
705
727
|
}
|
|
706
728
|
)
|
|
707
729
|
] }),
|
|
708
|
-
|
|
709
|
-
/* @__PURE__ */
|
|
730
|
+
P === "error" && /* @__PURE__ */ l.jsxs("div", { className: "py-4", children: [
|
|
731
|
+
/* @__PURE__ */ l.jsxs("p", { className: "text-red-500 text-sm mb-4", children: [
|
|
710
732
|
"Error: ",
|
|
711
|
-
|
|
733
|
+
$
|
|
712
734
|
] }),
|
|
713
|
-
/* @__PURE__ */
|
|
735
|
+
/* @__PURE__ */ l.jsx(
|
|
714
736
|
"button",
|
|
715
737
|
{
|
|
716
|
-
onClick: () =>
|
|
738
|
+
onClick: () => R("idle"),
|
|
717
739
|
className: "w-full bg-black text-white py-3 rounded-xl font-bold text-sm",
|
|
718
740
|
children: "Try Again"
|
|
719
741
|
}
|
|
720
742
|
)
|
|
721
743
|
] }),
|
|
722
|
-
|
|
723
|
-
/* @__PURE__ */
|
|
724
|
-
/* @__PURE__ */
|
|
725
|
-
/* @__PURE__ */
|
|
744
|
+
P === "idle" && /* @__PURE__ */ l.jsxs("div", { children: [
|
|
745
|
+
/* @__PURE__ */ l.jsx("p", { className: "text-sm text-gray-600 mb-5 leading-relaxed", children: "Upload photos for a precision body scan." }),
|
|
746
|
+
/* @__PURE__ */ l.jsxs("div", { className: "flex gap-3 mb-4", children: [
|
|
747
|
+
/* @__PURE__ */ l.jsx(
|
|
726
748
|
"input",
|
|
727
749
|
{
|
|
728
750
|
type: "number",
|
|
729
751
|
placeholder: "Height (cm)",
|
|
730
|
-
value:
|
|
731
|
-
onChange: (
|
|
752
|
+
value: v,
|
|
753
|
+
onChange: (o) => N(o.target.value),
|
|
732
754
|
className: "w-1/2 p-2.5 border border-gray-300 rounded-lg outline-none focus:border-black text-sm"
|
|
733
755
|
}
|
|
734
756
|
),
|
|
735
|
-
/* @__PURE__ */
|
|
757
|
+
/* @__PURE__ */ l.jsx(
|
|
736
758
|
"input",
|
|
737
759
|
{
|
|
738
760
|
type: "number",
|
|
739
761
|
placeholder: "Weight (kg)",
|
|
740
|
-
value:
|
|
741
|
-
onChange: (
|
|
762
|
+
value: p,
|
|
763
|
+
onChange: (o) => S(o.target.value),
|
|
742
764
|
className: "w-1/2 p-2.5 border border-gray-300 rounded-lg outline-none focus:border-black text-sm"
|
|
743
765
|
}
|
|
744
766
|
)
|
|
745
767
|
] }),
|
|
746
|
-
/* @__PURE__ */
|
|
747
|
-
/* @__PURE__ */
|
|
748
|
-
/* @__PURE__ */
|
|
768
|
+
/* @__PURE__ */ l.jsxs("div", { className: "mb-3", children: [
|
|
769
|
+
/* @__PURE__ */ l.jsx("label", { className: "text-[11px] font-bold text-gray-400 uppercase block mb-1", children: "Front Image" }),
|
|
770
|
+
/* @__PURE__ */ l.jsx(
|
|
749
771
|
"input",
|
|
750
772
|
{
|
|
751
773
|
type: "file",
|
|
752
774
|
accept: "image/*",
|
|
753
|
-
onChange: (
|
|
775
|
+
onChange: (o) => L(o.target.files[0]),
|
|
754
776
|
className: "w-full text-xs file:mr-3 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:bg-gray-100 file:text-black hover:file:bg-gray-200"
|
|
755
777
|
}
|
|
756
778
|
)
|
|
757
779
|
] }),
|
|
758
|
-
/* @__PURE__ */
|
|
759
|
-
/* @__PURE__ */
|
|
760
|
-
/* @__PURE__ */
|
|
780
|
+
/* @__PURE__ */ l.jsxs("div", { className: "mb-5", children: [
|
|
781
|
+
/* @__PURE__ */ l.jsx("label", { className: "text-[11px] font-bold text-gray-400 uppercase block mb-1", children: "Side Image" }),
|
|
782
|
+
/* @__PURE__ */ l.jsx(
|
|
761
783
|
"input",
|
|
762
784
|
{
|
|
763
785
|
type: "file",
|
|
764
786
|
accept: "image/*",
|
|
765
|
-
onChange: (
|
|
787
|
+
onChange: (o) => Q(o.target.files[0]),
|
|
766
788
|
className: "w-full text-xs file:mr-3 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:bg-gray-100 file:text-black hover:file:bg-gray-200"
|
|
767
789
|
}
|
|
768
790
|
)
|
|
769
791
|
] }),
|
|
770
|
-
/* @__PURE__ */
|
|
792
|
+
/* @__PURE__ */ l.jsx(
|
|
771
793
|
"button",
|
|
772
794
|
{
|
|
773
|
-
onClick:
|
|
795
|
+
onClick: te,
|
|
774
796
|
className: "w-full bg-black text-white py-3.5 rounded-xl font-bold text-sm hover:opacity-80 transition-opacity",
|
|
775
797
|
children: "Run Body Scan"
|
|
776
798
|
}
|
|
@@ -780,5 +802,5 @@ const pr = () => {
|
|
|
780
802
|
] });
|
|
781
803
|
};
|
|
782
804
|
export {
|
|
783
|
-
|
|
805
|
+
mr as StyllarPlugin
|
|
784
806
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(A,
|
|
1
|
+
(function(A,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],h):(A=typeof globalThis<"u"?globalThis:A||self,h(A.StyllarReactPlugin={},A.React))})(this,function(A,h){"use strict";var ee={exports:{}},B={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var pe;function We(){if(pe)return B;pe=1;var W=h,k=Symbol.for("react.element"),N=Symbol.for("react.fragment"),S=Object.prototype.hasOwnProperty,L=W.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Y={key:!0,ref:!0,__self:!0,__source:!0};function O(T,p,D){var v,j={},C=null,M=null;D!==void 0&&(C=""+D),p.key!==void 0&&(C=""+p.key),p.ref!==void 0&&(M=p.ref);for(v in p)S.call(p,v)&&!Y.hasOwnProperty(v)&&(j[v]=p[v]);if(T&&T.defaultProps)for(v in p=T.defaultProps,p)j[v]===void 0&&(j[v]=p[v]);return{$$typeof:k,type:T,key:C,ref:M,props:j,_owner:L.current}}return B.Fragment=N,B.jsx=O,B.jsxs=O,B}var J={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),u=a.length-1,
|
|
21
|
-
`+a[u].replace(" at new "," at ");return e.displayName&&
|
|
17
|
+
*/var ve;function Le(){return ve||(ve=1,process.env.NODE_ENV!=="production"&&function(){var W=h,k=Symbol.for("react.element"),N=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),Y=Symbol.for("react.profiler"),O=Symbol.for("react.provider"),T=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),M=Symbol.for("react.offscreen"),K=Symbol.iterator,re="@@iterator";function te(e){if(e===null||typeof e!="object")return null;var r=K&&e[K]||e[re];return typeof r=="function"?r:null}var P=W.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function m(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];ne("error",e,t)}}function ne(e,r,t){{var n=P.ReactDebugCurrentFrame,s=n.getStackAddendum();s!==""&&(r+="%s",t=t.concat([s]));var c=t.map(function(i){return String(i)});c.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,c)}}var ae=!1,o=!1,b=!1,f=!1,x=!1,g;g=Symbol.for("react.module.reference");function E(e){return!!(typeof e=="string"||typeof e=="function"||e===S||e===Y||x||e===L||e===D||e===v||f||e===M||ae||o||b||typeof e=="object"&&e!==null&&(e.$$typeof===C||e.$$typeof===j||e.$$typeof===O||e.$$typeof===T||e.$$typeof===p||e.$$typeof===g||e.getModuleId!==void 0))}function R(e,r,t){var n=e.displayName;if(n)return n;var s=r.displayName||r.name||"";return s!==""?t+"("+s+")":t}function X(e){return e.displayName||"Context"}function F(e){if(e==null)return null;if(typeof e.tag=="number"&&m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case N:return"Portal";case Y:return"Profiler";case L:return"StrictMode";case D:return"Suspense";case v:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case T:var r=e;return X(r)+".Consumer";case O:var t=e;return X(t._context)+".Provider";case p:return R(e,e.render,"ForwardRef");case j:var n=e.displayName||null;return n!==null?n:F(e.type)||"Memo";case C:{var s=e,c=s._payload,i=s._init;try{return F(i(c))}catch{return null}}}return null}var I=Object.assign,G=0,me,ge,he,be,ye,xe,_e;function Ee(){}Ee.__reactDisabledLog=!0;function Me(){{if(G===0){me=console.log,ge=console.info,he=console.warn,be=console.error,ye=console.group,xe=console.groupCollapsed,_e=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ee,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}G++}}function Ue(){{if(G--,G===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},e,{value:me}),info:I({},e,{value:ge}),warn:I({},e,{value:he}),error:I({},e,{value:be}),group:I({},e,{value:ye}),groupCollapsed:I({},e,{value:xe}),groupEnd:I({},e,{value:_e})})}G<0&&m("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var oe=P.ReactCurrentDispatcher,ie;function $(e,r,t){{if(ie===void 0)try{throw Error()}catch(s){var n=s.stack.trim().match(/\n( *(at )?)/);ie=n&&n[1]||""}return`
|
|
18
|
+
`+ie+e}}var se=!1,q;{var Ve=typeof WeakMap=="function"?WeakMap:Map;q=new Ve}function Re(e,r){if(!e||se)return"";{var t=q.get(e);if(t!==void 0)return t}var n;se=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var c;c=oe.current,oe.current=null,Me();try{if(r){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(_){n=_}Reflect.construct(e,[],i)}else{try{i.call()}catch(_){n=_}e.call(i.prototype)}}else{try{throw Error()}catch(_){n=_}e()}}catch(_){if(_&&n&&typeof _.stack=="string"){for(var a=_.stack.split(`
|
|
19
|
+
`),y=n.stack.split(`
|
|
20
|
+
`),u=a.length-1,d=y.length-1;u>=1&&d>=0&&a[u]!==y[d];)d--;for(;u>=1&&d>=0;u--,d--)if(a[u]!==y[d]){if(u!==1||d!==1)do if(u--,d--,d<0||a[u]!==y[d]){var w=`
|
|
21
|
+
`+a[u].replace(" at new "," at ");return e.displayName&&w.includes("<anonymous>")&&(w=w.replace("<anonymous>",e.displayName)),typeof e=="function"&&q.set(e,w),w}while(u>=1&&d>=0);break}}}finally{se=!1,oe.current=c,Ue(),Error.prepareStackTrace=s}var V=e?e.displayName||e.name:"",z=V?$(V):"";return typeof e=="function"&&q.set(e,z),z}function Be(e,r,t){return Re(e,!1)}function Je(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function Z(e,r,t){if(e==null)return"";if(typeof e=="function")return Re(e,Je(e));if(typeof e=="string")return $(e);switch(e){case D:return $("Suspense");case v:return $("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case p:return Be(e.render);case j:return Z(e.type,r,t);case C:{var n=e,s=n._payload,c=n._init;try{return Z(c(s),r,t)}catch{}}}return""}var H=Object.prototype.hasOwnProperty,Se={},we=P.ReactDebugCurrentFrame;function Q(e){if(e){var r=e._owner,t=Z(e.type,e._source,r?r.type:null);we.setExtraStackFrame(t)}else we.setExtraStackFrame(null)}function Ke(e,r,t,n,s){{var c=Function.call.bind(H);for(var i in e)if(c(e,i)){var a=void 0;try{if(typeof e[i]!="function"){var y=Error((n||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw y.name="Invariant Violation",y}a=e[i](r,i,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(u){a=u}a&&!(a instanceof Error)&&(Q(s),m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,i,typeof a),Q(null)),a instanceof Error&&!(a.message in Se)&&(Se[a.message]=!0,Q(s),m("Failed %s type: %s",t,a.message),Q(null))}}}var Xe=Array.isArray;function le(e){return Xe(e)}function Ge(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function He(e){try{return je(e),!1}catch{return!0}}function je(e){return""+e}function Te(e){if(He(e))return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ge(e)),je(e)}var Ce=P.ReactCurrentOwner,$e={key:!0,ref:!0,__self:!0,__source:!0},Oe,Pe;function qe(e){if(H.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Ze(e){if(H.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Qe(e,r){typeof e.ref=="string"&&Ce.current}function er(e,r){{var t=function(){Oe||(Oe=!0,m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function rr(e,r){{var t=function(){Pe||(Pe=!0,m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var tr=function(e,r,t,n,s,c,i){var a={$$typeof:k,type:e,key:r,ref:t,props:i,_owner:c};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:s}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function nr(e,r,t,n,s){{var c,i={},a=null,y=null;t!==void 0&&(Te(t),a=""+t),Ze(r)&&(Te(r.key),a=""+r.key),qe(r)&&(y=r.ref,Qe(r,s));for(c in r)H.call(r,c)&&!$e.hasOwnProperty(c)&&(i[c]=r[c]);if(e&&e.defaultProps){var u=e.defaultProps;for(c in u)i[c]===void 0&&(i[c]=u[c])}if(a||y){var d=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&er(i,d),y&&rr(i,d)}return tr(e,a,y,s,n,Ce.current,i)}}var ce=P.ReactCurrentOwner,ke=P.ReactDebugCurrentFrame;function U(e){if(e){var r=e._owner,t=Z(e.type,e._source,r?r.type:null);ke.setExtraStackFrame(t)}else ke.setExtraStackFrame(null)}var ue;ue=!1;function fe(e){return typeof e=="object"&&e!==null&&e.$$typeof===k}function Ne(){{if(ce.current){var e=F(ce.current.type);if(e)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+e+"`."}return""}}function ar(e){return""}var De={};function or(e){{var r=Ne();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+t+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=or(r);if(De[t])return;De[t]=!0;var n="";e&&e._owner&&e._owner!==
|
|
25
|
+
Check the top-level render call using <`+t+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=or(r);if(De[t])return;De[t]=!0;var n="";e&&e._owner&&e._owner!==ce.current&&(n=" It was passed a child from "+F(e._owner.type)+"."),U(e),m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),U(null)}}function Ae(e,r){{if(typeof e!="object")return;if(le(e))for(var t=0;t<e.length;t++){var n=e[t];fe(n)&&Fe(n,r)}else if(fe(e))e._store&&(e._store.validated=!0);else if(e){var s=te(e);if(typeof s=="function"&&s!==e.entries)for(var c=s.call(e),i;!(i=c.next()).done;)fe(i.value)&&Fe(i.value,r)}}}function ir(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===p||r.$$typeof===j))t=r.propTypes;else return;if(t){var n=F(r);Ke(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!ue){ue=!0;var s=F(r);m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",s||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function sr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){U(e),m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),U(null);break}}e.ref!==null&&(U(e),m("Invalid attribute `ref` supplied to `React.Fragment`."),U(null))}}var Ie={};function ze(e,r,t,n,s,c){{var i=E(e);if(!i){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var y=ar();y?a+=y:a+=Ne();var u;e===null?u="null":le(e)?u="array":e!==void 0&&e.$$typeof===k?(u="<"+(F(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):u=typeof e,m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",u,a)}var d=nr(e,r,t,s,c);if(d==null)return d;if(i){var w=r.children;if(w!==void 0)if(n)if(le(w)){for(var V=0;V<w.length;V++)Ae(w[V],e);Object.freeze&&Object.freeze(w)}else m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ae(w,e)}if(H.call(r,"key")){var z=F(e),_=Object.keys(r).filter(function(pr){return pr!=="key"}),de=_.length>0?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}";if(!Ie[z+de]){var dr=_.length>0?"{"+_.join(": ..., ")+": ...}":"{}";m(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,
|
|
30
|
+
<%s key={someKey} {...props} />`,de,z,dr,z),Ie[z+de]=!0}}return e===S?sr(d):ir(d),d}}function lr(e,r,t){return ze(e,r,t,!0)}function cr(e,r,t){return ze(e,r,t,!1)}var ur=cr,fr=lr;J.Fragment=S,J.jsx=ur,J.jsxs=fr}()),J}process.env.NODE_ENV==="production"?ee.exports=We():ee.exports=Le();var l=ee.exports;const Ye=()=>{const[W,k]=h.useState(!1),[N,S]=h.useState("idle"),[L,Y]=h.useState(""),[O,T]=h.useState(null),[p,D]=h.useState(""),[v,j]=h.useState(""),[C,M]=h.useState(null),[K,re]=h.useState(null),te="http://136.113.197.77:5000/predict/size-from-chart",P=o=>{if(!o)return;const b=()=>{const f=document.querySelectorAll('button, .size-swatch, .size-option, li[role="radio"], div[data-value]');for(let x of f){const g=x.innerText.trim().toUpperCase(),E=String(o).trim().toUpperCase();if(g===E||g===`SIZE ${E}`)return x.click(),console.log(`Styllar: Successfully auto-selected size ${o}`),!0}return!1};if(!b()){let f=0;const x=setInterval(()=>{f++,(b()||f>10)&&clearInterval(x)},500)}};h.useEffect(()=>{typeof chrome<"u"&&chrome.storage&&chrome.storage.local.get(["styllar_last_size"],o=>{o.styllar_last_size&&(console.log("Styllar: Found saved size:",o.styllar_last_size),setTimeout(()=>P(o.styllar_last_size),1e3))})},[]);function m(){var E;let o=0,b=0;const f=["pant","jeans","trouser","skirt","short","legging","jogger","bottom","denim","cargo"],x=["shirt","top","tee","blouse","jacket","coat","hoodie","sweater","vest","cardigan","dress","t-shirt"],g=(document.title+" "+(((E=document.querySelector("h1"))==null?void 0:E.innerText)||"")).toLowerCase();return f.forEach(R=>{g.includes(R)&&(b+=2)}),x.forEach(R=>{g.includes(R)&&(o+=2)}),b>o?"bottom":"top"}function ne(){const o={chart_type:"none",chart_content:null,available_sizes:[]},b=document.querySelector("table");if(b&&/chest|waist|bust|hip|size/i.test(b.innerText))return o.chart_type="html_table",o.chart_content=b.outerHTML,o;const f=document.querySelectorAll("img");for(let E of f){const R=E.src.toLowerCase(),X=(E.alt||"").toLowerCase();if(R.includes("size")&&R.includes("chart")||X.includes("size")&&X.includes("guide"))return o.chart_type="image_url",o.chart_content=E.src,o}const x=document.querySelector('.size-guide, #size-chart, .measurement-guide, [class*="SizeGuide"]');return x?(o.chart_type="raw_text",o.chart_content=x.innerText,o):(document.querySelectorAll("button, span, li").forEach(E=>{const R=E.innerText.trim();/^(XS|S|M|L|XL|XXL|[0-9]{2})$/i.test(R)&&R.length<4&&(o.available_sizes.includes(R)||o.available_sizes.push(R))}),o)}const ae=async()=>{if(!C||!K||!p||!v){alert("Please fill all fields.");return}S("loading");const o=m(),b=ne(),f=new FormData;f.append("front_image",C),f.append("side_image",K),f.append("height",p),f.append("weight",v),f.append("product_type",o),f.append("chart_type",b.chart_type),f.append("chart_content",b.chart_content),f.append("available_sizes",JSON.stringify(b.available_sizes));try{const g=await(await fetch(te,{method:"POST",body:f})).json();if(g.error)throw new Error(g.error);T(g),S("success"),g.recommended_size&&(P(g.recommended_size),typeof chrome<"u"&&chrome.storage&&chrome.storage.local.set({styllar_last_size:g.recommended_size}))}catch(x){Y(x.message),S("error")}};return l.jsxs("div",{className:"fixed bottom-6 right-6 z-[999999]",children:[l.jsx("button",{onClick:()=>k(!W),className:"bg-black text-white px-7 py-3.5 rounded-full shadow-xl font-bold text-sm hover:opacity-80 transition-opacity",children:"Styllar"}),W&&l.jsxs("div",{className:"absolute bottom-20 right-0 w-[330px] bg-white rounded-2xl p-6 shadow-2xl border border-gray-100 text-black",children:[l.jsxs("div",{className:"flex justify-between items-center mb-4",children:[l.jsx("h3",{className:"m-0 text-lg font-bold",children:"Smart Fit Assistant"}),l.jsx("button",{onClick:()=>k(!1),className:"text-gray-400 hover:text-black text-2xl leading-none",children:"×"})]}),N==="loading"&&l.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[l.jsx("div",{className:"w-8 h-8 border-4 border-gray-200 border-t-black rounded-full animate-spin mb-4"}),l.jsx("p",{className:"text-sm text-gray-600",children:"Analyzing body & page data..."})]}),N==="success"&&O&&l.jsxs("div",{className:"text-center py-6",children:[l.jsx("div",{className:"text-sm text-green-600 font-bold tracking-wider",children:"MATCH FOUND"}),l.jsx("div",{className:"text-5xl font-black my-4 text-black",children:O.recommended_size}),l.jsxs("div",{className:"text-xs text-gray-500 mb-6",children:["Confidence: ",O.confidence]}),l.jsx("button",{onClick:()=>{S("idle"),T(null)},className:"text-blue-600 text-sm underline hover:text-blue-800",children:"Run New Scan"})]}),N==="error"&&l.jsxs("div",{className:"py-4",children:[l.jsxs("p",{className:"text-red-500 text-sm mb-4",children:["Error: ",L]}),l.jsx("button",{onClick:()=>S("idle"),className:"w-full bg-black text-white py-3 rounded-xl font-bold text-sm",children:"Try Again"})]}),N==="idle"&&l.jsxs("div",{children:[l.jsx("p",{className:"text-sm text-gray-600 mb-5 leading-relaxed",children:"Upload photos for a precision body scan."}),l.jsxs("div",{className:"flex gap-3 mb-4",children:[l.jsx("input",{type:"number",placeholder:"Height (cm)",value:p,onChange:o=>D(o.target.value),className:"w-1/2 p-2.5 border border-gray-300 rounded-lg outline-none focus:border-black text-sm"}),l.jsx("input",{type:"number",placeholder:"Weight (kg)",value:v,onChange:o=>j(o.target.value),className:"w-1/2 p-2.5 border border-gray-300 rounded-lg outline-none focus:border-black text-sm"})]}),l.jsxs("div",{className:"mb-3",children:[l.jsx("label",{className:"text-[11px] font-bold text-gray-400 uppercase block mb-1",children:"Front Image"}),l.jsx("input",{type:"file",accept:"image/*",onChange:o=>M(o.target.files[0]),className:"w-full text-xs file:mr-3 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:bg-gray-100 file:text-black hover:file:bg-gray-200"})]}),l.jsxs("div",{className:"mb-5",children:[l.jsx("label",{className:"text-[11px] font-bold text-gray-400 uppercase block mb-1",children:"Side Image"}),l.jsx("input",{type:"file",accept:"image/*",onChange:o=>re(o.target.files[0]),className:"w-full text-xs file:mr-3 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:bg-gray-100 file:text-black hover:file:bg-gray-200"})]}),l.jsx("button",{onClick:ae,className:"w-full bg-black text-white py-3.5 rounded-xl font-bold text-sm hover:opacity-80 transition-opacity",children:"Run Body Scan"})]})]})]})};A.StyllarPlugin=Ye,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "styllar-react-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/styllar-react-plugin.umd.cjs",
|
|
6
6
|
"module": "dist/styllar-react-plugin.js",
|
|
@@ -35,4 +35,4 @@
|
|
|
35
35
|
"tailwindcss": "^4.2.0",
|
|
36
36
|
"vite": "^5.4.10"
|
|
37
37
|
}
|
|
38
|
-
}
|
|
38
|
+
}
|
package/src/StyllarPlugin.jsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
const StyllarPlugin = () => {
|
|
4
4
|
// --- 1. REACT STATE MANAGEMENT ---
|
|
@@ -15,6 +15,53 @@ const StyllarPlugin = () => {
|
|
|
15
15
|
|
|
16
16
|
const API_ENDPOINT = "http://136.113.197.77:5000/predict/size-from-chart";
|
|
17
17
|
|
|
18
|
+
// --- NEW: AUTO-SELECT FUNCTION (WITH POLLING) ---
|
|
19
|
+
const autoSelectSize = (targetSize) => {
|
|
20
|
+
if (!targetSize) return;
|
|
21
|
+
|
|
22
|
+
const trySelect = () => {
|
|
23
|
+
// Look for common size elements on e-commerce sites
|
|
24
|
+
const sizeElements = document.querySelectorAll('button, .size-swatch, .size-option, li[role="radio"], div[data-value]');
|
|
25
|
+
|
|
26
|
+
for (let el of sizeElements) {
|
|
27
|
+
const text = el.innerText.trim().toUpperCase();
|
|
28
|
+
const recommended = String(targetSize).trim().toUpperCase();
|
|
29
|
+
|
|
30
|
+
// Check for exact match or formats like "SIZE L"
|
|
31
|
+
if (text === recommended || text === `SIZE ${recommended}`) {
|
|
32
|
+
el.click();
|
|
33
|
+
console.log(`Styllar: Successfully auto-selected size ${targetSize}`);
|
|
34
|
+
return true; // Found and clicked
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return false; // Not found yet
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Try immediately. If it fails (DOM loading dynamically), poll for up to 5 seconds.
|
|
41
|
+
if (!trySelect()) {
|
|
42
|
+
let attempts = 0;
|
|
43
|
+
const interval = setInterval(() => {
|
|
44
|
+
attempts++;
|
|
45
|
+
if (trySelect() || attempts > 10) {
|
|
46
|
+
clearInterval(interval);
|
|
47
|
+
}
|
|
48
|
+
}, 500);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// --- NEW: CHECK STORAGE ON PAGE LOAD ---
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (typeof chrome !== "undefined" && chrome.storage) {
|
|
55
|
+
chrome.storage.local.get(["styllar_last_size"], (data) => {
|
|
56
|
+
if (data.styllar_last_size) {
|
|
57
|
+
console.log("Styllar: Found saved size:", data.styllar_last_size);
|
|
58
|
+
// Wait a brief moment for the host site to render its UI
|
|
59
|
+
setTimeout(() => autoSelectSize(data.styllar_last_size), 1000);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}, []);
|
|
64
|
+
|
|
18
65
|
// --- 2. INTELLIGENCE & SCRAPING (Unchanged logic) ---
|
|
19
66
|
function detectProductCategory() {
|
|
20
67
|
let scoreTop = 0; let scoreBottom = 0;
|
|
@@ -90,6 +137,16 @@ const StyllarPlugin = () => {
|
|
|
90
137
|
|
|
91
138
|
setResult(data);
|
|
92
139
|
setStatus('success');
|
|
140
|
+
|
|
141
|
+
// --- NEW: Trigger Auto-Select & Save to Storage ---
|
|
142
|
+
if (data.recommended_size) {
|
|
143
|
+
autoSelectSize(data.recommended_size);
|
|
144
|
+
|
|
145
|
+
if (typeof chrome !== "undefined" && chrome.storage) {
|
|
146
|
+
chrome.storage.local.set({ styllar_last_size: data.recommended_size });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
93
150
|
} catch (e) {
|
|
94
151
|
setErrorMsg(e.message);
|
|
95
152
|
setStatus('error');
|