@tern-secure/nextjs 3.0.2 → 3.0.4
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/components/sign-in.js +1 -76
- package/dist/components/sign-in.js.map +1 -1
- package/dist/hooks/useAuth.js.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/utils/create-styles.d.ts +98 -1
- package/dist/utils/create-styles.js +122 -17
- package/dist/utils/create-styles.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,82 +1,7 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { useState } from 'react';
|
|
4
3
|
import { signInWithEmail } from '../app-router/client';
|
|
5
|
-
import {
|
|
6
|
-
const styles = createStyles('tern', {
|
|
7
|
-
container: {
|
|
8
|
-
display: 'flex',
|
|
9
|
-
minHeight: '100%',
|
|
10
|
-
flex: '1',
|
|
11
|
-
flexDirection: 'column',
|
|
12
|
-
justifyContent: 'center',
|
|
13
|
-
padding: '3rem 1.5rem'
|
|
14
|
-
},
|
|
15
|
-
header: {
|
|
16
|
-
margin: '0 auto',
|
|
17
|
-
width: '100%',
|
|
18
|
-
maxWidth: '28rem'
|
|
19
|
-
},
|
|
20
|
-
title: {
|
|
21
|
-
marginTop: '1.5rem',
|
|
22
|
-
textAlign: 'center',
|
|
23
|
-
fontSize: '1.875rem',
|
|
24
|
-
fontWeight: '700',
|
|
25
|
-
lineHeight: '2.25rem',
|
|
26
|
-
letterSpacing: '-0.025em',
|
|
27
|
-
color: 'var(--tern-text-primary, #111827)'
|
|
28
|
-
},
|
|
29
|
-
formWrapper: {
|
|
30
|
-
marginTop: '2.5rem',
|
|
31
|
-
margin: '0 auto',
|
|
32
|
-
width: '100%',
|
|
33
|
-
maxWidth: '30rem'
|
|
34
|
-
},
|
|
35
|
-
formContainer: {
|
|
36
|
-
padding: '3rem 1.5rem',
|
|
37
|
-
boxShadow: '0 1px 3px 0 rgb(0 0 0 / 0.1)',
|
|
38
|
-
borderRadius: '0.5rem',
|
|
39
|
-
backgroundColor: 'var(--tern-background, white)'
|
|
40
|
-
},
|
|
41
|
-
form: {
|
|
42
|
-
display: 'flex',
|
|
43
|
-
flexDirection: 'column',
|
|
44
|
-
gap: '1rem'
|
|
45
|
-
},
|
|
46
|
-
label: {
|
|
47
|
-
display: 'block',
|
|
48
|
-
fontSize: '0.875rem',
|
|
49
|
-
fontWeight: '500',
|
|
50
|
-
color: 'var(--tern-text-secondary, #374151)'
|
|
51
|
-
},
|
|
52
|
-
input: {
|
|
53
|
-
marginTop: '0.25rem',
|
|
54
|
-
display: 'block',
|
|
55
|
-
width: '100%',
|
|
56
|
-
padding: '0.5rem 0.75rem',
|
|
57
|
-
borderRadius: '0.375rem',
|
|
58
|
-
border: '1px solid var(--tern-border, #D1D5DB)',
|
|
59
|
-
backgroundColor: 'var(--tern-input-background, white)',
|
|
60
|
-
color: 'var(--tern-text-primary, #111827)'
|
|
61
|
-
},
|
|
62
|
-
button: {
|
|
63
|
-
display: 'flex',
|
|
64
|
-
width: '100%',
|
|
65
|
-
justifyContent: 'center',
|
|
66
|
-
padding: '0.5rem 1rem',
|
|
67
|
-
fontSize: '0.875rem',
|
|
68
|
-
fontWeight: '500',
|
|
69
|
-
color: 'white',
|
|
70
|
-
backgroundColor: 'var(--tern-primary, #2563EB)',
|
|
71
|
-
border: 'none',
|
|
72
|
-
borderRadius: '0.375rem',
|
|
73
|
-
cursor: 'pointer'
|
|
74
|
-
},
|
|
75
|
-
error: {
|
|
76
|
-
color: 'var(--tern-error, #DC2626)',
|
|
77
|
-
fontSize: '0.875rem'
|
|
78
|
-
}
|
|
79
|
-
});
|
|
4
|
+
import { styles } from '../utils/create-styles';
|
|
80
5
|
export function SignIn({ onSuccess, onError, redirectUrl, className = '', style, customStyles = {} }) {
|
|
81
6
|
const [email, setEmail] = useState('');
|
|
82
7
|
const [password, setPassword] = useState('');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-in.js","sourceRoot":"","sources":["../../src/components/sign-in.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"sign-in.js","sourceRoot":"","sources":["../../src/components/sign-in.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAsB/C,MAAM,UAAU,MAAM,CAAC,EACrB,SAAS,EACT,OAAO,EACP,WAAW,EACX,SAAS,GAAG,EAAE,EACd,KAAK,EACL,YAAY,GAAG,EAAE,EACL;IACZ,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IACtC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IAC5C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC7C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IAEtC,MAAM,YAAY,GAAG,KAAK,EAAE,CAAkB,EAAE,EAAE;QAChD,CAAC,CAAC,cAAc,EAAE,CAAA;QAClB,UAAU,CAAC,IAAI,CAAC,CAAA;QAChB,QAAQ,CAAC,EAAE,CAAC,CAAA;QAEZ,IAAI,CAAC;YACH,MAAM,eAAe,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA;YAC1C,SAAS,EAAE,EAAE,CAAA;YAEb,IAAI,WAAW,EAAE,CAAC;gBAChB,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,WAAW,CAAA;YACpC,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,YAAY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@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.js","sourceRoot":"","sources":["../../src/hooks/useAuth.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,
|
|
1
|
+
{"version":3,"file":"useAuth.js","sourceRoot":"","sources":["../../src/hooks/useAuth.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAErD,MAAM,UAAU,OAAO;IACrB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,aAAa,CAAC,SAAS,CAAC,CAAA;IAElD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,cAAc,EAAE,CAAA,CAAC,4BAA4B;YAC1D,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAChB,GAAG,IAAI;gBACP,QAAQ,EAAE;oBACR,WAAW,EAAE,IAAI;oBACjB,KAAK,EAAE,IAAI;iBACZ;aACF,CAAC,CAAC,CAAA;YAEH,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,CACzC,CAAC,IAAI,EAAE,EAAE;gBACP,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBAChB,GAAG,IAAI;oBACP,IAAI,EAAE;wBACJ,IAAI;wBACJ,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,IAAI;wBACX,UAAU,EAAE,CAAC,CAAC,IAAI;qBACnB;iBACF,CAAC,CAAC,CAAA;YACL,CAAC,EACD,CAAC,KAAK,EAAE,EAAE;gBACR,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBAChB,GAAG,IAAI;oBACP,IAAI,EAAE;wBACJ,IAAI,EAAE,IAAI;wBACV,OAAO,EAAE,KAAK;wBACd,KAAK;wBACL,UAAU,EAAE,KAAK;qBAClB;iBACF,CAAC,CAAC,CAAA;YACL,CAAC,CACF,CAAA;YAED,OAAO,GAAG,EAAE,CAAC,WAAW,EAAE,CAAA;QAC5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAChB,GAAG,IAAI;gBACP,QAAQ,EAAE;oBACR,WAAW,EAAE,KAAK;oBAClB,KAAK,EAAE,KAAc;iBACtB;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,IAAI;oBACV,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,KAAc;oBACrB,UAAU,EAAE,KAAK;iBAClB;aACF,CAAC,CAAC,CAAA;QACL,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAA,CAAC,yBAAyB;IAEhC,OAAO,KAAK,CAAC,IAAI,CAAA;AACnB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import { User } from 'firebase/auth';
|
|
2
|
+
import { User, Auth } from 'firebase/auth';
|
|
3
3
|
export interface TernSecureConfig {
|
|
4
4
|
apiKey: string;
|
|
5
5
|
authDomain: string;
|
|
@@ -30,7 +30,7 @@ export interface AuthState {
|
|
|
30
30
|
export interface TernSecureContextValue {
|
|
31
31
|
_contextKey: symbol;
|
|
32
32
|
authState: AuthState;
|
|
33
|
-
auth:
|
|
33
|
+
auth: Auth;
|
|
34
34
|
}
|
|
35
35
|
export interface TernSecureContextType {
|
|
36
36
|
authState: AuthState;
|
|
@@ -1 +1,98 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const defaultClassNames: {
|
|
2
|
+
readonly container: "tern-container";
|
|
3
|
+
readonly header: "tern-header";
|
|
4
|
+
readonly title: "tern-title";
|
|
5
|
+
readonly formWrapper: "tern-formWrapper";
|
|
6
|
+
readonly formContainer: "tern-formContainer";
|
|
7
|
+
readonly form: "tern-form";
|
|
8
|
+
readonly label: "tern-label";
|
|
9
|
+
readonly input: "tern-input";
|
|
10
|
+
readonly button: "tern-button";
|
|
11
|
+
readonly error: "tern-error";
|
|
12
|
+
};
|
|
13
|
+
export declare const styleConfig: {
|
|
14
|
+
readonly container: {
|
|
15
|
+
readonly display: "flex";
|
|
16
|
+
readonly minHeight: "100%";
|
|
17
|
+
readonly flex: "1";
|
|
18
|
+
readonly flexDirection: "column";
|
|
19
|
+
readonly justifyContent: "center";
|
|
20
|
+
readonly padding: "3rem 1.5rem";
|
|
21
|
+
};
|
|
22
|
+
readonly header: {
|
|
23
|
+
readonly margin: "0 auto";
|
|
24
|
+
readonly width: "100%";
|
|
25
|
+
readonly maxWidth: "28rem";
|
|
26
|
+
};
|
|
27
|
+
readonly title: {
|
|
28
|
+
readonly marginTop: "1.5rem";
|
|
29
|
+
readonly textAlign: "center";
|
|
30
|
+
readonly fontSize: "1.875rem";
|
|
31
|
+
readonly fontWeight: "700";
|
|
32
|
+
readonly lineHeight: "2.25rem";
|
|
33
|
+
readonly letterSpacing: "-0.025em";
|
|
34
|
+
readonly color: "var(--tern-text-primary, #111827)";
|
|
35
|
+
};
|
|
36
|
+
readonly formWrapper: {
|
|
37
|
+
readonly marginTop: "2.5rem";
|
|
38
|
+
readonly margin: "0 auto";
|
|
39
|
+
readonly width: "100%";
|
|
40
|
+
readonly maxWidth: "30rem";
|
|
41
|
+
};
|
|
42
|
+
readonly formContainer: {
|
|
43
|
+
readonly padding: "3rem 1.5rem";
|
|
44
|
+
readonly boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1)";
|
|
45
|
+
readonly borderRadius: "0.5rem";
|
|
46
|
+
readonly backgroundColor: "var(--tern-background, white)";
|
|
47
|
+
};
|
|
48
|
+
readonly form: {
|
|
49
|
+
readonly display: "flex";
|
|
50
|
+
readonly flexDirection: "column";
|
|
51
|
+
readonly gap: "1rem";
|
|
52
|
+
};
|
|
53
|
+
readonly label: {
|
|
54
|
+
readonly display: "block";
|
|
55
|
+
readonly fontSize: "0.875rem";
|
|
56
|
+
readonly fontWeight: "500";
|
|
57
|
+
readonly color: "var(--tern-text-secondary, #374151)";
|
|
58
|
+
};
|
|
59
|
+
readonly input: {
|
|
60
|
+
readonly marginTop: "0.25rem";
|
|
61
|
+
readonly display: "block";
|
|
62
|
+
readonly width: "100%";
|
|
63
|
+
readonly padding: "0.5rem 0.75rem";
|
|
64
|
+
readonly borderRadius: "0.375rem";
|
|
65
|
+
readonly border: "1px solid var(--tern-border, #D1D5DB)";
|
|
66
|
+
readonly backgroundColor: "var(--tern-input-background, white)";
|
|
67
|
+
readonly color: "var(--tern-text-primary, #111827)";
|
|
68
|
+
};
|
|
69
|
+
readonly button: {
|
|
70
|
+
readonly display: "flex";
|
|
71
|
+
readonly width: "100%";
|
|
72
|
+
readonly justifyContent: "center";
|
|
73
|
+
readonly padding: "0.5rem 1rem";
|
|
74
|
+
readonly fontSize: "0.875rem";
|
|
75
|
+
readonly fontWeight: "500";
|
|
76
|
+
readonly color: "white";
|
|
77
|
+
readonly backgroundColor: "var(--tern-primary, #2563EB)";
|
|
78
|
+
readonly border: "none";
|
|
79
|
+
readonly borderRadius: "0.375rem";
|
|
80
|
+
readonly cursor: "pointer";
|
|
81
|
+
};
|
|
82
|
+
readonly error: {
|
|
83
|
+
readonly color: "var(--tern-error, #DC2626)";
|
|
84
|
+
readonly fontSize: "0.875rem";
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
export declare const styles: {
|
|
88
|
+
readonly container: "tern-container";
|
|
89
|
+
readonly header: "tern-header";
|
|
90
|
+
readonly title: "tern-title";
|
|
91
|
+
readonly formWrapper: "tern-formWrapper";
|
|
92
|
+
readonly formContainer: "tern-formContainer";
|
|
93
|
+
readonly form: "tern-form";
|
|
94
|
+
readonly label: "tern-label";
|
|
95
|
+
readonly input: "tern-input";
|
|
96
|
+
readonly button: "tern-button";
|
|
97
|
+
readonly error: "tern-error";
|
|
98
|
+
};
|
|
@@ -1,22 +1,127 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
const PREFIX = 'tern';
|
|
3
|
+
// Singleton to track style injection
|
|
4
|
+
const styleInjection = {
|
|
5
|
+
isInjected: false,
|
|
6
|
+
styleElement: null
|
|
7
|
+
};
|
|
8
|
+
export const defaultClassNames = {
|
|
9
|
+
container: `${PREFIX}-container`,
|
|
10
|
+
header: `${PREFIX}-header`,
|
|
11
|
+
title: `${PREFIX}-title`,
|
|
12
|
+
formWrapper: `${PREFIX}-formWrapper`,
|
|
13
|
+
formContainer: `${PREFIX}-formContainer`,
|
|
14
|
+
form: `${PREFIX}-form`,
|
|
15
|
+
label: `${PREFIX}-label`,
|
|
16
|
+
input: `${PREFIX}-input`,
|
|
17
|
+
button: `${PREFIX}-button`,
|
|
18
|
+
error: `${PREFIX}-error`
|
|
19
|
+
};
|
|
20
|
+
// Create styles once and cache them
|
|
21
|
+
function createStyleSheet(styles) {
|
|
22
|
+
if (typeof window === 'undefined')
|
|
23
|
+
return defaultClassNames;
|
|
24
|
+
// Return early if styles are already injected
|
|
25
|
+
if (styleInjection.isInjected) {
|
|
26
|
+
return defaultClassNames;
|
|
27
|
+
}
|
|
28
|
+
// Find existing style element or create new one
|
|
29
|
+
let styleElement = document.querySelector('[data-tern-secure]');
|
|
30
|
+
if (!styleElement) {
|
|
31
|
+
styleElement = document.createElement('style');
|
|
32
|
+
styleElement.setAttribute('data-tern-secure', '');
|
|
33
|
+
document.head.appendChild(styleElement);
|
|
34
|
+
styleInjection.styleElement = styleElement;
|
|
35
|
+
}
|
|
36
|
+
// Create CSS rules
|
|
37
|
+
const cssRules = Object.entries(styles).map(([key, rules]) => {
|
|
38
|
+
const className = defaultClassNames[key];
|
|
39
|
+
const cssProperties = Object.entries(rules).map(([prop, value]) => {
|
|
13
40
|
const cssProperty = prop.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
14
41
|
return `${cssProperty}: ${value};`;
|
|
15
42
|
}).join(' ');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
43
|
+
return `.${className} { ${cssProperties} }`;
|
|
44
|
+
}).join('\n');
|
|
45
|
+
// Insert styles only once
|
|
46
|
+
styleElement.textContent = cssRules;
|
|
47
|
+
styleInjection.isInjected = true;
|
|
48
|
+
return defaultClassNames;
|
|
49
|
+
}
|
|
50
|
+
// Style configuration
|
|
51
|
+
export const styleConfig = {
|
|
52
|
+
container: {
|
|
53
|
+
display: 'flex',
|
|
54
|
+
minHeight: '100%',
|
|
55
|
+
flex: '1',
|
|
56
|
+
flexDirection: 'column',
|
|
57
|
+
justifyContent: 'center',
|
|
58
|
+
padding: '3rem 1.5rem'
|
|
59
|
+
},
|
|
60
|
+
header: {
|
|
61
|
+
margin: '0 auto',
|
|
62
|
+
width: '100%',
|
|
63
|
+
maxWidth: '28rem'
|
|
64
|
+
},
|
|
65
|
+
title: {
|
|
66
|
+
marginTop: '1.5rem',
|
|
67
|
+
textAlign: 'center',
|
|
68
|
+
fontSize: '1.875rem',
|
|
69
|
+
fontWeight: '700',
|
|
70
|
+
lineHeight: '2.25rem',
|
|
71
|
+
letterSpacing: '-0.025em',
|
|
72
|
+
color: 'var(--tern-text-primary, #111827)'
|
|
73
|
+
},
|
|
74
|
+
formWrapper: {
|
|
75
|
+
marginTop: '2.5rem',
|
|
76
|
+
margin: '0 auto',
|
|
77
|
+
width: '100%',
|
|
78
|
+
maxWidth: '30rem'
|
|
79
|
+
},
|
|
80
|
+
formContainer: {
|
|
81
|
+
padding: '3rem 1.5rem',
|
|
82
|
+
boxShadow: '0 1px 3px 0 rgb(0 0 0 / 0.1)',
|
|
83
|
+
borderRadius: '0.5rem',
|
|
84
|
+
backgroundColor: 'var(--tern-background, white)'
|
|
85
|
+
},
|
|
86
|
+
form: {
|
|
87
|
+
display: 'flex',
|
|
88
|
+
flexDirection: 'column',
|
|
89
|
+
gap: '1rem'
|
|
90
|
+
},
|
|
91
|
+
label: {
|
|
92
|
+
display: 'block',
|
|
93
|
+
fontSize: '0.875rem',
|
|
94
|
+
fontWeight: '500',
|
|
95
|
+
color: 'var(--tern-text-secondary, #374151)'
|
|
96
|
+
},
|
|
97
|
+
input: {
|
|
98
|
+
marginTop: '0.25rem',
|
|
99
|
+
display: 'block',
|
|
100
|
+
width: '100%',
|
|
101
|
+
padding: '0.5rem 0.75rem',
|
|
102
|
+
borderRadius: '0.375rem',
|
|
103
|
+
border: '1px solid var(--tern-border, #D1D5DB)',
|
|
104
|
+
backgroundColor: 'var(--tern-input-background, white)',
|
|
105
|
+
color: 'var(--tern-text-primary, #111827)'
|
|
106
|
+
},
|
|
107
|
+
button: {
|
|
108
|
+
display: 'flex',
|
|
109
|
+
width: '100%',
|
|
110
|
+
justifyContent: 'center',
|
|
111
|
+
padding: '0.5rem 1rem',
|
|
112
|
+
fontSize: '0.875rem',
|
|
113
|
+
fontWeight: '500',
|
|
114
|
+
color: 'white',
|
|
115
|
+
backgroundColor: 'var(--tern-primary, #2563EB)',
|
|
116
|
+
border: 'none',
|
|
117
|
+
borderRadius: '0.375rem',
|
|
118
|
+
cursor: 'pointer'
|
|
119
|
+
},
|
|
120
|
+
error: {
|
|
121
|
+
color: 'var(--tern-error, #DC2626)',
|
|
122
|
+
fontSize: '0.875rem'
|
|
123
|
+
}
|
|
21
124
|
};
|
|
125
|
+
// Export pre-created styles
|
|
126
|
+
export const styles = createStyleSheet(styleConfig);
|
|
22
127
|
//# sourceMappingURL=create-styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-styles.js","sourceRoot":"","sources":["../../src/utils/create-styles.ts"],"names":[],"mappings":"AAAA,
|
|
1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