@cleartrip/ct-design-segment 4.0.0-TEST.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +85 -0
  2. package/dist/Segment.d.ts +3 -26
  3. package/dist/Segment.d.ts.map +1 -1
  4. package/dist/Segment.native.d.ts +5 -0
  5. package/dist/Segment.native.d.ts.map +1 -0
  6. package/dist/SegmentButton.d.ts +5 -0
  7. package/dist/SegmentButton.d.ts.map +1 -0
  8. package/dist/SegmentButton.native.d.ts +5 -0
  9. package/dist/SegmentButton.native.d.ts.map +1 -0
  10. package/dist/constants.d.ts +5 -0
  11. package/dist/constants.d.ts.map +1 -0
  12. package/dist/ct-design-segment.browser.cjs.js +1 -1
  13. package/dist/ct-design-segment.browser.cjs.js.map +1 -1
  14. package/dist/ct-design-segment.browser.esm.js +1 -1
  15. package/dist/ct-design-segment.browser.esm.js.map +1 -1
  16. package/dist/ct-design-segment.cjs.js +339 -95
  17. package/dist/ct-design-segment.cjs.js.map +1 -1
  18. package/dist/ct-design-segment.esm.js +342 -97
  19. package/dist/ct-design-segment.esm.js.map +1 -1
  20. package/dist/ct-design-segment.umd.js +1986 -128
  21. package/dist/ct-design-segment.umd.js.map +1 -1
  22. package/dist/index.d.ts +2 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.native.d.ts +4 -0
  25. package/dist/index.native.d.ts.map +1 -0
  26. package/dist/style.d.ts +111 -18
  27. package/dist/style.d.ts.map +1 -1
  28. package/dist/type.d.ts +46 -0
  29. package/dist/type.d.ts.map +1 -0
  30. package/package.json +27 -13
  31. package/src/Segment.native.tsx +284 -0
  32. package/src/Segment.tsx +277 -0
  33. package/src/SegmentButton.native.tsx +110 -0
  34. package/src/SegmentButton.tsx +115 -0
  35. package/src/constants.ts +4 -0
  36. package/src/index.native.ts +3 -0
  37. package/src/index.ts +3 -0
  38. package/src/style.ts +132 -0
  39. package/src/type.ts +85 -0
@@ -1,10 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('@cleartrip/ct-design-theme'), require('@emotion/styled')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '@cleartrip/ct-design-theme', '@emotion/styled'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemSegment = {}, global.jsxRuntime, global.React, global.ctDesignTheme, global.styled));
5
- })(this, (function (exports, jsxRuntime, React, ctDesignTheme, styled) { 'use strict';
6
-
7
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('@cleartrip/ct-design-theme'), require('@cleartrip/ct-design-style-manager'), require('@cleartrip/ct-design-container'), require('@cleartrip/ct-design-button')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '@cleartrip/ct-design-theme', '@cleartrip/ct-design-style-manager', '@cleartrip/ct-design-container', '@cleartrip/ct-design-button'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemSegment = {}, global.jsxRuntime, global.React, global.ctDesignTheme, global.ctDesignStyleManager, global.ctDesignContainer, global.ctDesignButton));
5
+ })(this, (function (exports, jsxRuntime, React, ctDesignTheme, ctDesignStyleManager, ctDesignContainer, ctDesignButton) { 'use strict';
8
6
 
9
7
  function _interopNamespace(e) {
10
8
  if (e && e.__esModule) return e;
@@ -25,144 +23,2004 @@
25
23
  }
26
24
 
27
25
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
- var styled__default = /*#__PURE__*/_interopDefault(styled);
29
-
30
- /******************************************************************************
31
- Copyright (c) Microsoft Corporation.
32
-
33
- Permission to use, copy, modify, and/or distribute this software for any
34
- purpose with or without fee is hereby granted.
35
-
36
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
37
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
38
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
39
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
40
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
41
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
42
- PERFORMANCE OF THIS SOFTWARE.
43
- ***************************************************************************** */
44
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
45
-
46
- var __assign = function () {
47
- __assign = Object.assign || function __assign(t) {
48
- for (var s, i = 1, n = arguments.length; i < n; i++) {
49
- s = arguments[i];
50
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
51
- }
52
- return t;
53
- };
54
- return __assign.apply(this, arguments);
55
- };
56
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
57
- var e = new Error(message);
58
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
59
- };
60
26
 
61
- var getSegmentStyle = function (_a) {
62
- var isBlock = _a.isBlock, theme = _a.theme;
27
+ exports.SegmentVariant = void 0;
28
+ (function (SegmentVariant) {
29
+ SegmentVariant["DEFAULT"] = "default";
30
+ SegmentVariant["DARK"] = "dark";
31
+ })(exports.SegmentVariant || (exports.SegmentVariant = {}));
32
+
33
+ const SEGMENT_THUMB_BOX_SHADOW = '0px 0px 4px rgba(0, 0, 0, 0.12)';
34
+ const segmentStaticStyles = ctDesignStyleManager.makeStyles((theme) => {
35
+ const trackHeight = theme.size[10];
36
+ const borderWidth = theme.border.width.sm;
37
+ const trackInnerHeight = Math.max(trackHeight - borderWidth * 2, 0);
38
+ const thumbInset = Math.max(theme.spacing[0.25], 0);
39
+ const trackRadius = Math.max(0, trackHeight / 2);
40
+ const trackInnerRadius = Math.max(0, trackInnerHeight / 2);
41
+ const thumbRadius = Math.max(0, trackInnerRadius - thumbInset);
63
42
  return {
64
- display: 'flex',
65
- border: '1px solid transparent',
66
- borderRadius: '60px',
67
- overflow: 'hidden',
68
- background: theme.color.background.disabled,
69
- width: isBlock ? '100%' : 'fit-content',
70
- position: 'relative',
71
- height: '40px',
43
+ root: {
44
+ display: 'flex',
45
+ flexDirection: 'row',
46
+ borderWidth,
47
+ borderColor: 'transparent',
48
+ borderRadius: trackRadius,
49
+ overflow: 'hidden',
50
+ backgroundColor: theme.color.background.disabled,
51
+ position: 'relative',
52
+ height: trackHeight,
53
+ alignItems: 'stretch',
54
+ padding: theme.spacing[1],
55
+ },
56
+ button: {
57
+ backgroundColor: 'transparent',
58
+ fontSize: theme.typography.size[14],
59
+ fontWeight: theme.typography.weight.medium,
60
+ lineHeight: theme.size[5],
61
+ borderColor: theme.color.border.default,
62
+ borderRadius: thumbRadius,
63
+ textAlign: 'center',
64
+ justifyContent: 'center',
65
+ alignItems: 'center',
66
+ },
67
+ animatedBlock: {
68
+ position: 'absolute',
69
+ top: 0,
70
+ height: '100%',
71
+ borderRadius: thumbRadius,
72
+ backgroundColor: theme.color.background.neutral,
73
+ },
74
+ animatedContainer: {
75
+ flexDirection: 'row',
76
+ alignItems: 'stretch',
77
+ justifyContent: 'flex-start',
78
+ position: 'relative',
79
+ height: '100%',
80
+ width: '100%',
81
+ },
82
+ tabMeasureCell: {
83
+ flexGrow: 1,
84
+ flexShrink: 1,
85
+ flexBasis: 0,
86
+ minWidth: 0,
87
+ },
88
+ animatedBlockWidth: {
89
+ width: theme.size['100P'],
90
+ },
72
91
  };
73
- };
74
- var getSegmentOptionStyle = function (_a) {
75
- var theme = _a.theme, isActive = _a.isActive;
92
+ });
93
+ const segmentWebThumbStyles = ctDesignStyleManager.makeStyles((theme) => {
94
+ const trackHeight = theme.size[10];
95
+ const borderWidth = theme.border.width.sm;
96
+ const trackInnerHeight = Math.max(trackHeight - borderWidth * 2, 0);
97
+ const thumbInset = Math.max(theme.spacing[0.25], 0);
98
+ const thumbHeight = Math.max(trackInnerHeight - thumbInset * 2, 0);
99
+ const trackInnerRadius = Math.max(0, trackInnerHeight / 2);
100
+ const thumbRadius = Math.max(0, trackInnerRadius - thumbInset);
76
101
  return {
77
- color: isActive ? theme.color.text.primary : theme.color.text.subHeading,
78
- zIndex: 2,
79
- padding: '6px 8px 6px 8px',
80
- height: '40px',
81
- width: '50%',
102
+ root: {
103
+ position: 'absolute',
104
+ height: thumbHeight,
105
+ borderRadius: thumbRadius,
106
+ backgroundColor: theme.color.background.neutral,
107
+ top: thumbInset,
108
+ boxShadow: SEGMENT_THUMB_BOX_SHADOW,
109
+ },
82
110
  };
83
- };
84
- var getStyledSegmentButtonStyles = function (_a) {
85
- var theme = _a.theme, isActive = _a.isActive;
111
+ });
112
+ const getStyledSegmentButtonStyles = ({ theme, isActive }) => {
113
+ const color = isActive ? theme.color.tab.selectedPrimaryLabel : theme.color.tab.nonSelectedPrimaryLabel;
86
114
  return {
87
- background: 'transparent',
88
- color: isActive ? theme.color.text.primary : theme.color.text.subHeading,
89
- fontSize: '14px',
90
- fontWeight: '500',
91
- lineHeight: '20px',
92
- borderColor: 'transparent',
93
- borderRadius: '60px',
94
- cursor: 'pointer',
95
- width: '100%',
115
+ color,
116
+ fontSize: theme.typography.size[14],
117
+ fontWeight: theme.typography.weight.medium,
118
+ lineHeight: theme.size[5],
96
119
  };
97
120
  };
98
- var getStyledAnimatedContainerBlock = function () {
99
- return {
100
- position: 'absolute',
101
- height: '40px',
102
- width: '100%',
103
- zIndex: 1,
104
- };
121
+ const getSegmentVariantStyles = (variant, theme) => {
122
+ switch (variant) {
123
+ case exports.SegmentVariant.DARK:
124
+ return {
125
+ animatedBlock: { style: { backgroundColor: theme.color.background.defaultDarkest } },
126
+ segmentButton: { style: { color: theme.color.text.primary } },
127
+ segmentButtonActive: { style: { color: theme.color.text.neutral } },
128
+ root: {
129
+ style: {
130
+ backgroundColor: theme.color.background.neutral,
131
+ borderColor: theme.color.border.disabledDark,
132
+ },
133
+ },
134
+ };
135
+ case exports.SegmentVariant.DEFAULT:
136
+ default:
137
+ return {
138
+ animatedBlock: {},
139
+ segmentButton: {},
140
+ segmentButtonActive: {},
141
+ };
142
+ }
105
143
  };
106
- var getStyledAnimatedBlock = function (_a) {
107
- var activeIndex = _a.activeIndex, _b = _a.animationLength, animationLength = _b === void 0 ? '1s' : _b;
108
- var isFirstTab = activeIndex === 0;
109
- var offsetLeft = isFirstTab ? 4 : -4;
110
- return {
111
- position: 'absolute',
112
- width: 'calc(100% - 50%)',
113
- height: '32px',
114
- borderRadius: '60px',
115
- backgroundColor: '#fff',
116
- top: '2.5px',
117
- left: "calc(".concat(activeIndex ? 50 : 0, "% + ").concat(offsetLeft, "px)"),
118
- transition: "left ".concat(animationLength),
119
- animationDuration: animationLength,
120
- animationFillMode: 'forwards',
144
+
145
+ const SegmentButton = ({ option, index, activeIndex, disabled, onOptionClick, styleConfig, variant, optionLength: _optionLength, }) => {
146
+ var _a, _b;
147
+ const theme = ctDesignTheme.useTheme();
148
+ const isActive = index === activeIndex;
149
+ const { segmentButton = {}, segmentText = {} } = styleConfig || {};
150
+ const shell = ctDesignStyleManager.useStyles((t) => ({
151
+ rowCell: {
152
+ flexGrow: 1,
153
+ flexBasis: 0,
154
+ flexShrink: 1,
155
+ minWidth: 0,
156
+ minHeight: 0,
157
+ width: undefined,
158
+ alignSelf: 'stretch',
159
+ height: t.size[10],
160
+ maxHeight: t.size[10],
161
+ paddingHorizontal: 0,
162
+ paddingTop: 0,
163
+ paddingBottom: 0,
164
+ paddingVertical: 0,
165
+ justifyContent: 'center',
166
+ alignItems: 'center',
167
+ },
168
+ }), []);
169
+ const dynamicStyles = ctDesignStyleManager.useStyles((innerTheme) => {
170
+ if (variant === exports.SegmentVariant.DARK) {
171
+ return {
172
+ typography: {
173
+ fontSize: innerTheme.typography.size[14],
174
+ fontWeight: innerTheme.typography.weight.medium,
175
+ lineHeight: innerTheme.size[5],
176
+ textAlign: 'center',
177
+ display: 'flex',
178
+ justifyContent: 'center',
179
+ alignItems: 'center',
180
+ paddingTop: 0,
181
+ paddingBottom: 0,
182
+ marginTop: 0,
183
+ marginBottom: 0,
184
+ color: isActive ? theme.color.text.neutral : innerTheme.color.text.primary,
185
+ },
186
+ };
187
+ }
188
+ return {
189
+ typography: Object.assign(Object.assign({}, getStyledSegmentButtonStyles({ theme: innerTheme, isActive })), { textAlign: 'center', display: 'flex', justifyContent: 'center', alignItems: 'center', paddingTop: 0, paddingBottom: 0, marginTop: 0, marginBottom: 0 }),
190
+ };
191
+ }, [isActive, variant, theme]);
192
+ const segmentTextRoot = segmentText.root === undefined ? [] : Array.isArray(segmentText.root) ? segmentText.root : [segmentText.root];
193
+ return (jsxRuntime.jsx(ctDesignButton.Button, { variant: ctDesignButton.ButtonVariant.BARE, color: ctDesignButton.ButtonColor.TERTIARY, size: ctDesignButton.ButtonSize.SMALL, isFullWidth: false, prefixIcon: option === null || option === void 0 ? void 0 : option.icon, onClick: () => {
194
+ if (disabled)
195
+ return;
196
+ onOptionClick(option.tabId, index);
197
+ }, disabled: disabled, styleConfig: Object.assign(Object.assign({}, segmentButton), { root: [segmentStaticStyles.button, ...((_a = segmentButton.root) !== null && _a !== void 0 ? _a : []), shell.rowCell], typography: Object.assign(Object.assign({}, segmentText), { root: [dynamicStyles.typography, ...segmentTextRoot] }) }), children: (_b = option === null || option === void 0 ? void 0 : option.text) !== null && _b !== void 0 ? _b : '' }));
198
+ };
199
+
200
+ var isDevelopment$1 = false;
201
+
202
+ /*
203
+
204
+ Based off glamor's StyleSheet, thanks Sunil ❤️
205
+
206
+ high performance StyleSheet for css-in-js systems
207
+
208
+ - uses multiple style tags behind the scenes for millions of rules
209
+ - uses `insertRule` for appending in production for *much* faster performance
210
+
211
+ // usage
212
+
213
+ import { StyleSheet } from '@emotion/sheet'
214
+
215
+ let styleSheet = new StyleSheet({ key: '', container: document.head })
216
+
217
+ styleSheet.insert('#box { border: 1px solid red; }')
218
+ - appends a css rule into the stylesheet
219
+
220
+ styleSheet.flush()
221
+ - empties the stylesheet of all its contents
222
+
223
+ */
224
+
225
+ function sheetForTag(tag) {
226
+ if (tag.sheet) {
227
+ return tag.sheet;
228
+ } // this weirdness brought to you by firefox
229
+
230
+ /* istanbul ignore next */
231
+
232
+ for (var i = 0; i < document.styleSheets.length; i++) {
233
+ if (document.styleSheets[i].ownerNode === tag) {
234
+ return document.styleSheets[i];
235
+ }
236
+ } // this function should always return with a value
237
+ // TS can't understand it though so we make it stop complaining here
238
+
239
+ return undefined;
240
+ }
241
+ function createStyleElement(options) {
242
+ var tag = document.createElement('style');
243
+ tag.setAttribute('data-emotion', options.key);
244
+ if (options.nonce !== undefined) {
245
+ tag.setAttribute('nonce', options.nonce);
246
+ }
247
+ tag.appendChild(document.createTextNode(''));
248
+ tag.setAttribute('data-s', '');
249
+ return tag;
250
+ }
251
+ var StyleSheet = /*#__PURE__*/function () {
252
+ // Using Node instead of HTMLElement since container may be a ShadowRoot
253
+ function StyleSheet(options) {
254
+ var _this = this;
255
+ this._insertTag = function (tag) {
256
+ var before;
257
+ if (_this.tags.length === 0) {
258
+ if (_this.insertionPoint) {
259
+ before = _this.insertionPoint.nextSibling;
260
+ } else if (_this.prepend) {
261
+ before = _this.container.firstChild;
262
+ } else {
263
+ before = _this.before;
264
+ }
265
+ } else {
266
+ before = _this.tags[_this.tags.length - 1].nextSibling;
267
+ }
268
+ _this.container.insertBefore(tag, before);
269
+ _this.tags.push(tag);
121
270
  };
271
+ this.isSpeedy = options.speedy === undefined ? !isDevelopment$1 : options.speedy;
272
+ this.tags = [];
273
+ this.ctr = 0;
274
+ this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
275
+
276
+ this.key = options.key;
277
+ this.container = options.container;
278
+ this.prepend = options.prepend;
279
+ this.insertionPoint = options.insertionPoint;
280
+ this.before = null;
281
+ }
282
+ var _proto = StyleSheet.prototype;
283
+ _proto.hydrate = function hydrate(nodes) {
284
+ nodes.forEach(this._insertTag);
285
+ };
286
+ _proto.insert = function insert(rule) {
287
+ // the max length is how many rules we have per style tag, it's 65000 in speedy mode
288
+ // it's 1 in dev because we insert source maps that map a single rule to a location
289
+ // and you can only have one source map per style tag
290
+ if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
291
+ this._insertTag(createStyleElement(this));
292
+ }
293
+ var tag = this.tags[this.tags.length - 1];
294
+ if (this.isSpeedy) {
295
+ var sheet = sheetForTag(tag);
296
+ try {
297
+ // this is the ultrafast version, works across browsers
298
+ // the big drawback is that the css won't be editable in devtools
299
+ sheet.insertRule(rule, sheet.cssRules.length);
300
+ } catch (e) {}
301
+ } else {
302
+ tag.appendChild(document.createTextNode(rule));
303
+ }
304
+ this.ctr++;
305
+ };
306
+ _proto.flush = function flush() {
307
+ this.tags.forEach(function (tag) {
308
+ var _tag$parentNode;
309
+ return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
310
+ });
311
+ this.tags = [];
312
+ this.ctr = 0;
313
+ };
314
+ return StyleSheet;
315
+ }();
316
+
317
+ var stylisExports = {};
318
+ var stylis = {
319
+ get exports(){ return stylisExports; },
320
+ set exports(v){ stylisExports = v; },
122
321
  };
123
322
 
124
- var useIsomorphicEffect = typeof window !== 'undefined' ? React__namespace.useLayoutEffect : React__namespace.useEffect;
323
+ (function (module, exports) {
324
+ (function (e, r) {
325
+ r(exports) ;
326
+ })(this, function (e) {
125
327
 
126
- var StyledSegment = styled__default.default.div(function (_a) {
127
- var theme = _a.theme, isBlock = _a.isBlock, _b = _a.css, css = _b === void 0 ? {} : _b;
128
- return (__assign(__assign({}, getSegmentStyle({ isBlock: isBlock, theme: theme })), css));
129
- });
130
- var SegmentOption = styled__default.default.div(function (_a) {
131
- var theme = _a.theme, isActive = _a.isActive, _b = _a.css, css = _b === void 0 ? {} : _b;
132
- return (__assign(__assign({}, getSegmentOptionStyle({ theme: theme, isActive: isActive })), css));
133
- });
134
- var StyledSegmentBtn = styled__default.default.button(function (_a) {
135
- var theme = _a.theme, isActive = _a.isActive, _b = _a.css, css = _b === void 0 ? {} : _b;
136
- return (__assign(__assign({}, getStyledSegmentButtonStyles({ theme: theme, isActive: isActive })), css));
137
- });
138
- var StyledAnimatedContainerBlock = styled__default.default.div(function (_a) {
139
- var _b = _a.css, css = _b === void 0 ? {} : _b;
140
- return (__assign(__assign({}, getStyledAnimatedContainerBlock()), css));
141
- });
142
- var StyledAnimatedBlock = styled__default.default.div(function (_a) {
143
- var activeIndex = _a.activeIndex, _b = _a.css, css = _b === void 0 ? {} : _b;
144
- return (__assign(__assign({}, getStyledAnimatedBlock({ activeIndex: activeIndex })), css));
328
+ var r = "-ms-";
329
+ var a = "-moz-";
330
+ var c = "-webkit-";
331
+ var n = "comm";
332
+ var t = "rule";
333
+ var s = "decl";
334
+ var i = "@page";
335
+ var u = "@media";
336
+ var o = "@import";
337
+ var f = "@charset";
338
+ var l = "@viewport";
339
+ var p = "@supports";
340
+ var h = "@document";
341
+ var v = "@namespace";
342
+ var d = "@keyframes";
343
+ var b = "@font-face";
344
+ var w = "@counter-style";
345
+ var m = "@font-feature-values";
346
+ var g = "@layer";
347
+ var k = Math.abs;
348
+ var $ = String.fromCharCode;
349
+ var x = Object.assign;
350
+ function E(e, r) {
351
+ return M(e, 0) ^ 45 ? (((r << 2 ^ M(e, 0)) << 2 ^ M(e, 1)) << 2 ^ M(e, 2)) << 2 ^ M(e, 3) : 0;
352
+ }
353
+ function y(e) {
354
+ return e.trim();
355
+ }
356
+ function T(e, r) {
357
+ return (e = r.exec(e)) ? e[0] : e;
358
+ }
359
+ function A(e, r, a) {
360
+ return e.replace(r, a);
361
+ }
362
+ function O(e, r) {
363
+ return e.indexOf(r);
364
+ }
365
+ function M(e, r) {
366
+ return e.charCodeAt(r) | 0;
367
+ }
368
+ function C(e, r, a) {
369
+ return e.slice(r, a);
370
+ }
371
+ function R(e) {
372
+ return e.length;
373
+ }
374
+ function S(e) {
375
+ return e.length;
376
+ }
377
+ function z(e, r) {
378
+ return r.push(e), e;
379
+ }
380
+ function N(e, r) {
381
+ return e.map(r).join("");
382
+ }
383
+ e.line = 1;
384
+ e.column = 1;
385
+ e.length = 0;
386
+ e.position = 0;
387
+ e.character = 0;
388
+ e.characters = "";
389
+ function P(r, a, c, n, t, s, i) {
390
+ return {
391
+ value: r,
392
+ root: a,
393
+ parent: c,
394
+ type: n,
395
+ props: t,
396
+ children: s,
397
+ line: e.line,
398
+ column: e.column,
399
+ length: i,
400
+ return: ""
401
+ };
402
+ }
403
+ function j(e, r) {
404
+ return x(P("", null, null, "", null, null, 0), e, {
405
+ length: -e.length
406
+ }, r);
407
+ }
408
+ function U() {
409
+ return e.character;
410
+ }
411
+ function _() {
412
+ e.character = e.position > 0 ? M(e.characters, --e.position) : 0;
413
+ if (e.column--, e.character === 10) e.column = 1, e.line--;
414
+ return e.character;
415
+ }
416
+ function F() {
417
+ e.character = e.position < e.length ? M(e.characters, e.position++) : 0;
418
+ if (e.column++, e.character === 10) e.column = 1, e.line++;
419
+ return e.character;
420
+ }
421
+ function I() {
422
+ return M(e.characters, e.position);
423
+ }
424
+ function L() {
425
+ return e.position;
426
+ }
427
+ function D(r, a) {
428
+ return C(e.characters, r, a);
429
+ }
430
+ function Y(e) {
431
+ switch (e) {
432
+ case 0:
433
+ case 9:
434
+ case 10:
435
+ case 13:
436
+ case 32:
437
+ return 5;
438
+ case 33:
439
+ case 43:
440
+ case 44:
441
+ case 47:
442
+ case 62:
443
+ case 64:
444
+ case 126:
445
+ case 59:
446
+ case 123:
447
+ case 125:
448
+ return 4;
449
+ case 58:
450
+ return 3;
451
+ case 34:
452
+ case 39:
453
+ case 40:
454
+ case 91:
455
+ return 2;
456
+ case 41:
457
+ case 93:
458
+ return 1;
459
+ }
460
+ return 0;
461
+ }
462
+ function K(r) {
463
+ return e.line = e.column = 1, e.length = R(e.characters = r), e.position = 0, [];
464
+ }
465
+ function V(r) {
466
+ return e.characters = "", r;
467
+ }
468
+ function W(r) {
469
+ return y(D(e.position - 1, q(r === 91 ? r + 2 : r === 40 ? r + 1 : r)));
470
+ }
471
+ function B(e) {
472
+ return V(H(K(e)));
473
+ }
474
+ function G(r) {
475
+ while (e.character = I()) if (e.character < 33) F();else break;
476
+ return Y(r) > 2 || Y(e.character) > 3 ? "" : " ";
477
+ }
478
+ function H(r) {
479
+ while (F()) switch (Y(e.character)) {
480
+ case 0:
481
+ z(Q(e.position - 1), r);
482
+ break;
483
+ case 2:
484
+ z(W(e.character), r);
485
+ break;
486
+ default:
487
+ z($(e.character), r);
488
+ }
489
+ return r;
490
+ }
491
+ function Z(r, a) {
492
+ while (--a && F()) if (e.character < 48 || e.character > 102 || e.character > 57 && e.character < 65 || e.character > 70 && e.character < 97) break;
493
+ return D(r, L() + (a < 6 && I() == 32 && F() == 32));
494
+ }
495
+ function q(r) {
496
+ while (F()) switch (e.character) {
497
+ case r:
498
+ return e.position;
499
+ case 34:
500
+ case 39:
501
+ if (r !== 34 && r !== 39) q(e.character);
502
+ break;
503
+ case 40:
504
+ if (r === 41) q(r);
505
+ break;
506
+ case 92:
507
+ F();
508
+ break;
509
+ }
510
+ return e.position;
511
+ }
512
+ function J(r, a) {
513
+ while (F()) if (r + e.character === 47 + 10) break;else if (r + e.character === 42 + 42 && I() === 47) break;
514
+ return "/*" + D(a, e.position - 1) + "*" + $(r === 47 ? r : F());
515
+ }
516
+ function Q(r) {
517
+ while (!Y(I())) F();
518
+ return D(r, e.position);
519
+ }
520
+ function X(e) {
521
+ return V(ee("", null, null, null, [""], e = K(e), 0, [0], e));
522
+ }
523
+ function ee(e, r, a, c, n, t, s, i, u) {
524
+ var o = 0;
525
+ var f = 0;
526
+ var l = s;
527
+ var p = 0;
528
+ var h = 0;
529
+ var v = 0;
530
+ var d = 1;
531
+ var b = 1;
532
+ var w = 1;
533
+ var m = 0;
534
+ var g = "";
535
+ var k = n;
536
+ var x = t;
537
+ var E = c;
538
+ var y = g;
539
+ while (b) switch (v = m, m = F()) {
540
+ case 40:
541
+ if (v != 108 && M(y, l - 1) == 58) {
542
+ if (O(y += A(W(m), "&", "&\f"), "&\f") != -1) w = -1;
543
+ break;
544
+ }
545
+ case 34:
546
+ case 39:
547
+ case 91:
548
+ y += W(m);
549
+ break;
550
+ case 9:
551
+ case 10:
552
+ case 13:
553
+ case 32:
554
+ y += G(v);
555
+ break;
556
+ case 92:
557
+ y += Z(L() - 1, 7);
558
+ continue;
559
+ case 47:
560
+ switch (I()) {
561
+ case 42:
562
+ case 47:
563
+ z(ae(J(F(), L()), r, a), u);
564
+ break;
565
+ default:
566
+ y += "/";
567
+ }
568
+ break;
569
+ case 123 * d:
570
+ i[o++] = R(y) * w;
571
+ case 125 * d:
572
+ case 59:
573
+ case 0:
574
+ switch (m) {
575
+ case 0:
576
+ case 125:
577
+ b = 0;
578
+ case 59 + f:
579
+ if (w == -1) y = A(y, /\f/g, "");
580
+ if (h > 0 && R(y) - l) z(h > 32 ? ce(y + ";", c, a, l - 1) : ce(A(y, " ", "") + ";", c, a, l - 2), u);
581
+ break;
582
+ case 59:
583
+ y += ";";
584
+ default:
585
+ z(E = re(y, r, a, o, f, n, i, g, k = [], x = [], l), t);
586
+ if (m === 123) if (f === 0) ee(y, r, E, E, k, t, l, i, x);else switch (p === 99 && M(y, 3) === 110 ? 100 : p) {
587
+ case 100:
588
+ case 108:
589
+ case 109:
590
+ case 115:
591
+ ee(e, E, E, c && z(re(e, E, E, 0, 0, n, i, g, n, k = [], l), x), n, x, l, i, c ? k : x);
592
+ break;
593
+ default:
594
+ ee(y, E, E, E, [""], x, 0, i, x);
595
+ }
596
+ }
597
+ o = f = h = 0, d = w = 1, g = y = "", l = s;
598
+ break;
599
+ case 58:
600
+ l = 1 + R(y), h = v;
601
+ default:
602
+ if (d < 1) if (m == 123) --d;else if (m == 125 && d++ == 0 && _() == 125) continue;
603
+ switch (y += $(m), m * d) {
604
+ case 38:
605
+ w = f > 0 ? 1 : (y += "\f", -1);
606
+ break;
607
+ case 44:
608
+ i[o++] = (R(y) - 1) * w, w = 1;
609
+ break;
610
+ case 64:
611
+ if (I() === 45) y += W(F());
612
+ p = I(), f = l = R(g = y += Q(L())), m++;
613
+ break;
614
+ case 45:
615
+ if (v === 45 && R(y) == 2) d = 0;
616
+ }
617
+ }
618
+ return t;
619
+ }
620
+ function re(e, r, a, c, n, s, i, u, o, f, l) {
621
+ var p = n - 1;
622
+ var h = n === 0 ? s : [""];
623
+ var v = S(h);
624
+ for (var d = 0, b = 0, w = 0; d < c; ++d) for (var m = 0, g = C(e, p + 1, p = k(b = i[d])), $ = e; m < v; ++m) if ($ = y(b > 0 ? h[m] + " " + g : A(g, /&\f/g, h[m]))) o[w++] = $;
625
+ return P(e, r, a, n === 0 ? t : u, o, f, l);
626
+ }
627
+ function ae(e, r, a) {
628
+ return P(e, r, a, n, $(U()), C(e, 2, -2), 0);
629
+ }
630
+ function ce(e, r, a, c) {
631
+ return P(e, r, a, s, C(e, 0, c), C(e, c + 1, -1), c);
632
+ }
633
+ function ne(e, n, t) {
634
+ switch (E(e, n)) {
635
+ case 5103:
636
+ return c + "print-" + e + e;
637
+ case 5737:
638
+ case 4201:
639
+ case 3177:
640
+ case 3433:
641
+ case 1641:
642
+ case 4457:
643
+ case 2921:
644
+ case 5572:
645
+ case 6356:
646
+ case 5844:
647
+ case 3191:
648
+ case 6645:
649
+ case 3005:
650
+ case 6391:
651
+ case 5879:
652
+ case 5623:
653
+ case 6135:
654
+ case 4599:
655
+ case 4855:
656
+ case 4215:
657
+ case 6389:
658
+ case 5109:
659
+ case 5365:
660
+ case 5621:
661
+ case 3829:
662
+ return c + e + e;
663
+ case 4789:
664
+ return a + e + e;
665
+ case 5349:
666
+ case 4246:
667
+ case 4810:
668
+ case 6968:
669
+ case 2756:
670
+ return c + e + a + e + r + e + e;
671
+ case 5936:
672
+ switch (M(e, n + 11)) {
673
+ case 114:
674
+ return c + e + r + A(e, /[svh]\w+-[tblr]{2}/, "tb") + e;
675
+ case 108:
676
+ return c + e + r + A(e, /[svh]\w+-[tblr]{2}/, "tb-rl") + e;
677
+ case 45:
678
+ return c + e + r + A(e, /[svh]\w+-[tblr]{2}/, "lr") + e;
679
+ }
680
+ case 6828:
681
+ case 4268:
682
+ case 2903:
683
+ return c + e + r + e + e;
684
+ case 6165:
685
+ return c + e + r + "flex-" + e + e;
686
+ case 5187:
687
+ return c + e + A(e, /(\w+).+(:[^]+)/, c + "box-$1$2" + r + "flex-$1$2") + e;
688
+ case 5443:
689
+ return c + e + r + "flex-item-" + A(e, /flex-|-self/g, "") + (!T(e, /flex-|baseline/) ? r + "grid-row-" + A(e, /flex-|-self/g, "") : "") + e;
690
+ case 4675:
691
+ return c + e + r + "flex-line-pack" + A(e, /align-content|flex-|-self/g, "") + e;
692
+ case 5548:
693
+ return c + e + r + A(e, "shrink", "negative") + e;
694
+ case 5292:
695
+ return c + e + r + A(e, "basis", "preferred-size") + e;
696
+ case 6060:
697
+ return c + "box-" + A(e, "-grow", "") + c + e + r + A(e, "grow", "positive") + e;
698
+ case 4554:
699
+ return c + A(e, /([^-])(transform)/g, "$1" + c + "$2") + e;
700
+ case 6187:
701
+ return A(A(A(e, /(zoom-|grab)/, c + "$1"), /(image-set)/, c + "$1"), e, "") + e;
702
+ case 5495:
703
+ case 3959:
704
+ return A(e, /(image-set\([^]*)/, c + "$1" + "$`$1");
705
+ case 4968:
706
+ return A(A(e, /(.+:)(flex-)?(.*)/, c + "box-pack:$3" + r + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + c + e + e;
707
+ case 4200:
708
+ if (!T(e, /flex-|baseline/)) return r + "grid-column-align" + C(e, n) + e;
709
+ break;
710
+ case 2592:
711
+ case 3360:
712
+ return r + A(e, "template-", "") + e;
713
+ case 4384:
714
+ case 3616:
715
+ if (t && t.some(function (e, r) {
716
+ return n = r, T(e.props, /grid-\w+-end/);
717
+ })) {
718
+ return ~O(e + (t = t[n].value), "span") ? e : r + A(e, "-start", "") + e + r + "grid-row-span:" + (~O(t, "span") ? T(t, /\d+/) : +T(t, /\d+/) - +T(e, /\d+/)) + ";";
719
+ }
720
+ return r + A(e, "-start", "") + e;
721
+ case 4896:
722
+ case 4128:
723
+ return t && t.some(function (e) {
724
+ return T(e.props, /grid-\w+-start/);
725
+ }) ? e : r + A(A(e, "-end", "-span"), "span ", "") + e;
726
+ case 4095:
727
+ case 3583:
728
+ case 4068:
729
+ case 2532:
730
+ return A(e, /(.+)-inline(.+)/, c + "$1$2") + e;
731
+ case 8116:
732
+ case 7059:
733
+ case 5753:
734
+ case 5535:
735
+ case 5445:
736
+ case 5701:
737
+ case 4933:
738
+ case 4677:
739
+ case 5533:
740
+ case 5789:
741
+ case 5021:
742
+ case 4765:
743
+ if (R(e) - 1 - n > 6) switch (M(e, n + 1)) {
744
+ case 109:
745
+ if (M(e, n + 4) !== 45) break;
746
+ case 102:
747
+ return A(e, /(.+:)(.+)-([^]+)/, "$1" + c + "$2-$3" + "$1" + a + (M(e, n + 3) == 108 ? "$3" : "$2-$3")) + e;
748
+ case 115:
749
+ return ~O(e, "stretch") ? ne(A(e, "stretch", "fill-available"), n, t) + e : e;
750
+ }
751
+ break;
752
+ case 5152:
753
+ case 5920:
754
+ return A(e, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function (a, c, n, t, s, i, u) {
755
+ return r + c + ":" + n + u + (t ? r + c + "-span:" + (s ? i : +i - +n) + u : "") + e;
756
+ });
757
+ case 4949:
758
+ if (M(e, n + 6) === 121) return A(e, ":", ":" + c) + e;
759
+ break;
760
+ case 6444:
761
+ switch (M(e, M(e, 14) === 45 ? 18 : 11)) {
762
+ case 120:
763
+ return A(e, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, "$1" + c + (M(e, 14) === 45 ? "inline-" : "") + "box$3" + "$1" + c + "$2$3" + "$1" + r + "$2box$3") + e;
764
+ case 100:
765
+ return A(e, ":", ":" + r) + e;
766
+ }
767
+ break;
768
+ case 5719:
769
+ case 2647:
770
+ case 2135:
771
+ case 3927:
772
+ case 2391:
773
+ return A(e, "scroll-", "scroll-snap-") + e;
774
+ }
775
+ return e;
776
+ }
777
+ function te(e, r) {
778
+ var a = "";
779
+ var c = S(e);
780
+ for (var n = 0; n < c; n++) a += r(e[n], n, e, r) || "";
781
+ return a;
782
+ }
783
+ function se(e, r, a, c) {
784
+ switch (e.type) {
785
+ case g:
786
+ if (e.children.length) break;
787
+ case o:
788
+ case s:
789
+ return e.return = e.return || e.value;
790
+ case n:
791
+ return "";
792
+ case d:
793
+ return e.return = e.value + "{" + te(e.children, c) + "}";
794
+ case t:
795
+ e.value = e.props.join(",");
796
+ }
797
+ return R(a = te(e.children, c)) ? e.return = e.value + "{" + a + "}" : "";
798
+ }
799
+ function ie(e) {
800
+ var r = S(e);
801
+ return function (a, c, n, t) {
802
+ var s = "";
803
+ for (var i = 0; i < r; i++) s += e[i](a, c, n, t) || "";
804
+ return s;
805
+ };
806
+ }
807
+ function ue(e) {
808
+ return function (r) {
809
+ if (!r.root) if (r = r.return) e(r);
810
+ };
811
+ }
812
+ function oe(e, n, i, u) {
813
+ if (e.length > -1) if (!e.return) switch (e.type) {
814
+ case s:
815
+ e.return = ne(e.value, e.length, i);
816
+ return;
817
+ case d:
818
+ return te([j(e, {
819
+ value: A(e.value, "@", "@" + c)
820
+ })], u);
821
+ case t:
822
+ if (e.length) return N(e.props, function (n) {
823
+ switch (T(n, /(::plac\w+|:read-\w+)/)) {
824
+ case ":read-only":
825
+ case ":read-write":
826
+ return te([j(e, {
827
+ props: [A(n, /:(read-\w+)/, ":" + a + "$1")]
828
+ })], u);
829
+ case "::placeholder":
830
+ return te([j(e, {
831
+ props: [A(n, /:(plac\w+)/, ":" + c + "input-$1")]
832
+ }), j(e, {
833
+ props: [A(n, /:(plac\w+)/, ":" + a + "$1")]
834
+ }), j(e, {
835
+ props: [A(n, /:(plac\w+)/, r + "input-$1")]
836
+ })], u);
837
+ }
838
+ return "";
839
+ });
840
+ }
841
+ }
842
+ function fe(e) {
843
+ switch (e.type) {
844
+ case t:
845
+ e.props = e.props.map(function (r) {
846
+ return N(B(r), function (r, a, c) {
847
+ switch (M(r, 0)) {
848
+ case 12:
849
+ return C(r, 1, R(r));
850
+ case 0:
851
+ case 40:
852
+ case 43:
853
+ case 62:
854
+ case 126:
855
+ return r;
856
+ case 58:
857
+ if (c[++a] === "global") c[a] = "", c[++a] = "\f" + C(c[a], a = 1, -1);
858
+ case 32:
859
+ return a === 1 ? "" : r;
860
+ default:
861
+ switch (a) {
862
+ case 0:
863
+ e = r;
864
+ return S(c) > 1 ? "" : r;
865
+ case a = S(c) - 1:
866
+ case 2:
867
+ return a === 2 ? r + e + e : r + e;
868
+ default:
869
+ return r;
870
+ }
871
+ }
872
+ });
873
+ });
874
+ }
875
+ }
876
+ e.CHARSET = f;
877
+ e.COMMENT = n;
878
+ e.COUNTER_STYLE = w;
879
+ e.DECLARATION = s;
880
+ e.DOCUMENT = h;
881
+ e.FONT_FACE = b;
882
+ e.FONT_FEATURE_VALUES = m;
883
+ e.IMPORT = o;
884
+ e.KEYFRAMES = d;
885
+ e.LAYER = g;
886
+ e.MEDIA = u;
887
+ e.MOZ = a;
888
+ e.MS = r;
889
+ e.NAMESPACE = v;
890
+ e.PAGE = i;
891
+ e.RULESET = t;
892
+ e.SUPPORTS = p;
893
+ e.VIEWPORT = l;
894
+ e.WEBKIT = c;
895
+ e.abs = k;
896
+ e.alloc = K;
897
+ e.append = z;
898
+ e.assign = x;
899
+ e.caret = L;
900
+ e.char = U;
901
+ e.charat = M;
902
+ e.combine = N;
903
+ e.comment = ae;
904
+ e.commenter = J;
905
+ e.compile = X;
906
+ e.copy = j;
907
+ e.dealloc = V;
908
+ e.declaration = ce;
909
+ e.delimit = W;
910
+ e.delimiter = q;
911
+ e.escaping = Z;
912
+ e.from = $;
913
+ e.hash = E;
914
+ e.identifier = Q;
915
+ e.indexof = O;
916
+ e.match = T;
917
+ e.middleware = ie;
918
+ e.namespace = fe;
919
+ e.next = F;
920
+ e.node = P;
921
+ e.parse = ee;
922
+ e.peek = I;
923
+ e.prefix = ne;
924
+ e.prefixer = oe;
925
+ e.prev = _;
926
+ e.replace = A;
927
+ e.ruleset = re;
928
+ e.rulesheet = ue;
929
+ e.serialize = te;
930
+ e.sizeof = S;
931
+ e.slice = D;
932
+ e.stringify = se;
933
+ e.strlen = R;
934
+ e.substr = C;
935
+ e.token = Y;
936
+ e.tokenize = B;
937
+ e.tokenizer = H;
938
+ e.trim = y;
939
+ e.whitespace = G;
940
+ Object.defineProperty(e, "__esModule", {
941
+ value: true
942
+ });
943
+ });
944
+ })(stylis, stylisExports);
945
+
946
+ var weakMemoize = function weakMemoize(func) {
947
+ var cache = new WeakMap();
948
+ return function (arg) {
949
+ if (cache.has(arg)) {
950
+ // Use non-null assertion because we just checked that the cache `has` it
951
+ // This allows us to remove `undefined` from the return value
952
+ return cache.get(arg);
953
+ }
954
+ var ret = func(arg);
955
+ cache.set(arg, ret);
956
+ return ret;
957
+ };
958
+ };
959
+
960
+ function memoize(fn) {
961
+ var cache = Object.create(null);
962
+ return function (arg) {
963
+ if (cache[arg] === undefined) cache[arg] = fn(arg);
964
+ return cache[arg];
965
+ };
966
+ }
967
+
968
+ var isBrowser$1 = typeof document !== 'undefined';
969
+ var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
970
+ var previous = 0;
971
+ var character = 0;
972
+ while (true) {
973
+ previous = character;
974
+ character = stylisExports.peek(); // &\f
975
+
976
+ if (previous === 38 && character === 12) {
977
+ points[index] = 1;
978
+ }
979
+ if (stylisExports.token(character)) {
980
+ break;
981
+ }
982
+ stylisExports.next();
983
+ }
984
+ return stylisExports.slice(begin, stylisExports.position);
985
+ };
986
+ var toRules = function toRules(parsed, points) {
987
+ // pretend we've started with a comma
988
+ var index = -1;
989
+ var character = 44;
990
+ do {
991
+ switch (stylisExports.token(character)) {
992
+ case 0:
993
+ // &\f
994
+ if (character === 38 && stylisExports.peek() === 12) {
995
+ // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
996
+ // stylis inserts \f after & to know when & where it should replace this sequence with the context selector
997
+ // and when it should just concatenate the outer and inner selectors
998
+ // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
999
+ points[index] = 1;
1000
+ }
1001
+ parsed[index] += identifierWithPointTracking(stylisExports.position - 1, points, index);
1002
+ break;
1003
+ case 2:
1004
+ parsed[index] += stylisExports.delimit(character);
1005
+ break;
1006
+ case 4:
1007
+ // comma
1008
+ if (character === 44) {
1009
+ // colon
1010
+ parsed[++index] = stylisExports.peek() === 58 ? '&\f' : '';
1011
+ points[index] = parsed[index].length;
1012
+ break;
1013
+ }
1014
+
1015
+ // fallthrough
1016
+
1017
+ default:
1018
+ parsed[index] += stylisExports.from(character);
1019
+ }
1020
+ } while (character = stylisExports.next());
1021
+ return parsed;
1022
+ };
1023
+ var getRules = function getRules(value, points) {
1024
+ return stylisExports.dealloc(toRules(stylisExports.alloc(value), points));
1025
+ }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
1026
+
1027
+ var fixedElements = /* #__PURE__ */new WeakMap();
1028
+ var compat = function compat(element) {
1029
+ if (element.type !== 'rule' || !element.parent ||
1030
+ // positive .length indicates that this rule contains pseudo
1031
+ // negative .length indicates that this rule has been already prefixed
1032
+ element.length < 1) {
1033
+ return;
1034
+ }
1035
+ var value = element.value;
1036
+ var parent = element.parent;
1037
+ var isImplicitRule = element.column === parent.column && element.line === parent.line;
1038
+ while (parent.type !== 'rule') {
1039
+ parent = parent.parent;
1040
+ if (!parent) return;
1041
+ } // short-circuit for the simplest case
1042
+
1043
+ if (element.props.length === 1 && value.charCodeAt(0) !== 58
1044
+ /* colon */ && !fixedElements.get(parent)) {
1045
+ return;
1046
+ } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
1047
+ // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
1048
+
1049
+ if (isImplicitRule) {
1050
+ return;
1051
+ }
1052
+ fixedElements.set(element, true);
1053
+ var points = [];
1054
+ var rules = getRules(value, points);
1055
+ var parentRules = parent.props;
1056
+ for (var i = 0, k = 0; i < rules.length; i++) {
1057
+ for (var j = 0; j < parentRules.length; j++, k++) {
1058
+ element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
1059
+ }
1060
+ }
1061
+ };
1062
+ var removeLabel = function removeLabel(element) {
1063
+ if (element.type === 'decl') {
1064
+ var value = element.value;
1065
+ if (
1066
+ // charcode for l
1067
+ value.charCodeAt(0) === 108 &&
1068
+ // charcode for b
1069
+ value.charCodeAt(2) === 98) {
1070
+ // this ignores label
1071
+ element["return"] = '';
1072
+ element.value = '';
1073
+ }
1074
+ }
1075
+ };
1076
+
1077
+ /* eslint-disable no-fallthrough */
1078
+
1079
+ function prefix(value, length) {
1080
+ switch (stylisExports.hash(value, length)) {
1081
+ // color-adjust
1082
+ case 5103:
1083
+ return stylisExports.WEBKIT + 'print-' + value + value;
1084
+ // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
1085
+
1086
+ case 5737:
1087
+ case 4201:
1088
+ case 3177:
1089
+ case 3433:
1090
+ case 1641:
1091
+ case 4457:
1092
+ case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
1093
+
1094
+ case 5572:
1095
+ case 6356:
1096
+ case 5844:
1097
+ case 3191:
1098
+ case 6645:
1099
+ case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
1100
+
1101
+ case 6391:
1102
+ case 5879:
1103
+ case 5623:
1104
+ case 6135:
1105
+ case 4599:
1106
+ case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
1107
+
1108
+ case 4215:
1109
+ case 6389:
1110
+ case 5109:
1111
+ case 5365:
1112
+ case 5621:
1113
+ case 3829:
1114
+ return stylisExports.WEBKIT + value + value;
1115
+ // appearance, user-select, transform, hyphens, text-size-adjust
1116
+
1117
+ case 5349:
1118
+ case 4246:
1119
+ case 4810:
1120
+ case 6968:
1121
+ case 2756:
1122
+ return stylisExports.WEBKIT + value + stylisExports.MOZ + value + stylisExports.MS + value + value;
1123
+ // flex, flex-direction
1124
+
1125
+ case 6828:
1126
+ case 4268:
1127
+ return stylisExports.WEBKIT + value + stylisExports.MS + value + value;
1128
+ // order
1129
+
1130
+ case 6165:
1131
+ return stylisExports.WEBKIT + value + stylisExports.MS + 'flex-' + value + value;
1132
+ // align-items
1133
+
1134
+ case 5187:
1135
+ return stylisExports.WEBKIT + value + stylisExports.replace(value, /(\w+).+(:[^]+)/, stylisExports.WEBKIT + 'box-$1$2' + stylisExports.MS + 'flex-$1$2') + value;
1136
+ // align-self
1137
+
1138
+ case 5443:
1139
+ return stylisExports.WEBKIT + value + stylisExports.MS + 'flex-item-' + stylisExports.replace(value, /flex-|-self/, '') + value;
1140
+ // align-content
1141
+
1142
+ case 4675:
1143
+ return stylisExports.WEBKIT + value + stylisExports.MS + 'flex-line-pack' + stylisExports.replace(value, /align-content|flex-|-self/, '') + value;
1144
+ // flex-shrink
1145
+
1146
+ case 5548:
1147
+ return stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, 'shrink', 'negative') + value;
1148
+ // flex-basis
1149
+
1150
+ case 5292:
1151
+ return stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, 'basis', 'preferred-size') + value;
1152
+ // flex-grow
1153
+
1154
+ case 6060:
1155
+ return stylisExports.WEBKIT + 'box-' + stylisExports.replace(value, '-grow', '') + stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, 'grow', 'positive') + value;
1156
+ // transition
1157
+
1158
+ case 4554:
1159
+ return stylisExports.WEBKIT + stylisExports.replace(value, /([^-])(transform)/g, '$1' + stylisExports.WEBKIT + '$2') + value;
1160
+ // cursor
1161
+
1162
+ case 6187:
1163
+ return stylisExports.replace(stylisExports.replace(stylisExports.replace(value, /(zoom-|grab)/, stylisExports.WEBKIT + '$1'), /(image-set)/, stylisExports.WEBKIT + '$1'), value, '') + value;
1164
+ // background, background-image
1165
+
1166
+ case 5495:
1167
+ case 3959:
1168
+ return stylisExports.replace(value, /(image-set\([^]*)/, stylisExports.WEBKIT + '$1' + '$`$1');
1169
+ // justify-content
1170
+
1171
+ case 4968:
1172
+ return stylisExports.replace(stylisExports.replace(value, /(.+:)(flex-)?(.*)/, stylisExports.WEBKIT + 'box-pack:$3' + stylisExports.MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + stylisExports.WEBKIT + value + value;
1173
+ // (margin|padding)-inline-(start|end)
1174
+
1175
+ case 4095:
1176
+ case 3583:
1177
+ case 4068:
1178
+ case 2532:
1179
+ return stylisExports.replace(value, /(.+)-inline(.+)/, stylisExports.WEBKIT + '$1$2') + value;
1180
+ // (min|max)?(width|height|inline-size|block-size)
1181
+
1182
+ case 8116:
1183
+ case 7059:
1184
+ case 5753:
1185
+ case 5535:
1186
+ case 5445:
1187
+ case 5701:
1188
+ case 4933:
1189
+ case 4677:
1190
+ case 5533:
1191
+ case 5789:
1192
+ case 5021:
1193
+ case 4765:
1194
+ // stretch, max-content, min-content, fill-available
1195
+ if (stylisExports.strlen(value) - 1 - length > 6) switch (stylisExports.charat(value, length + 1)) {
1196
+ // (m)ax-content, (m)in-content
1197
+ case 109:
1198
+ // -
1199
+ if (stylisExports.charat(value, length + 4) !== 45) break;
1200
+ // (f)ill-available, (f)it-content
1201
+
1202
+ case 102:
1203
+ return stylisExports.replace(value, /(.+:)(.+)-([^]+)/, '$1' + stylisExports.WEBKIT + '$2-$3' + '$1' + stylisExports.MOZ + (stylisExports.charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
1204
+ // (s)tretch
1205
+
1206
+ case 115:
1207
+ return ~stylisExports.indexof(value, 'stretch') ? prefix(stylisExports.replace(value, 'stretch', 'fill-available'), length) + value : value;
1208
+ }
1209
+ break;
1210
+ // position: sticky
1211
+
1212
+ case 4949:
1213
+ // (s)ticky?
1214
+ if (stylisExports.charat(value, length + 1) !== 115) break;
1215
+ // display: (flex|inline-flex)
1216
+
1217
+ case 6444:
1218
+ switch (stylisExports.charat(value, stylisExports.strlen(value) - 3 - (~stylisExports.indexof(value, '!important') && 10))) {
1219
+ // stic(k)y
1220
+ case 107:
1221
+ return stylisExports.replace(value, ':', ':' + stylisExports.WEBKIT) + value;
1222
+ // (inline-)?fl(e)x
1223
+
1224
+ case 101:
1225
+ return stylisExports.replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + stylisExports.WEBKIT + (stylisExports.charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + stylisExports.WEBKIT + '$2$3' + '$1' + stylisExports.MS + '$2box$3') + value;
1226
+ }
1227
+ break;
1228
+ // writing-mode
1229
+
1230
+ case 5936:
1231
+ switch (stylisExports.charat(value, length + 11)) {
1232
+ // vertical-l(r)
1233
+ case 114:
1234
+ return stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
1235
+ // vertical-r(l)
1236
+
1237
+ case 108:
1238
+ return stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
1239
+ // horizontal(-)tb
1240
+
1241
+ case 45:
1242
+ return stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
1243
+ }
1244
+ return stylisExports.WEBKIT + value + stylisExports.MS + value + value;
1245
+ }
1246
+ return value;
1247
+ }
1248
+ var prefixer = function prefixer(element, index, children, callback) {
1249
+ if (element.length > -1) if (!element["return"]) switch (element.type) {
1250
+ case stylisExports.DECLARATION:
1251
+ element["return"] = prefix(element.value, element.length);
1252
+ break;
1253
+ case stylisExports.KEYFRAMES:
1254
+ return stylisExports.serialize([stylisExports.copy(element, {
1255
+ value: stylisExports.replace(element.value, '@', '@' + stylisExports.WEBKIT)
1256
+ })], callback);
1257
+ case stylisExports.RULESET:
1258
+ if (element.length) return stylisExports.combine(element.props, function (value) {
1259
+ switch (stylisExports.match(value, /(::plac\w+|:read-\w+)/)) {
1260
+ // :read-(only|write)
1261
+ case ':read-only':
1262
+ case ':read-write':
1263
+ return stylisExports.serialize([stylisExports.copy(element, {
1264
+ props: [stylisExports.replace(value, /:(read-\w+)/, ':' + stylisExports.MOZ + '$1')]
1265
+ })], callback);
1266
+ // :placeholder
1267
+
1268
+ case '::placeholder':
1269
+ return stylisExports.serialize([stylisExports.copy(element, {
1270
+ props: [stylisExports.replace(value, /:(plac\w+)/, ':' + stylisExports.WEBKIT + 'input-$1')]
1271
+ }), stylisExports.copy(element, {
1272
+ props: [stylisExports.replace(value, /:(plac\w+)/, ':' + stylisExports.MOZ + '$1')]
1273
+ }), stylisExports.copy(element, {
1274
+ props: [stylisExports.replace(value, /:(plac\w+)/, stylisExports.MS + 'input-$1')]
1275
+ })], callback);
1276
+ }
1277
+ return '';
1278
+ });
1279
+ }
1280
+ };
1281
+ var getServerStylisCache = isBrowser$1 ? undefined : weakMemoize(function () {
1282
+ return memoize(function () {
1283
+ return {};
1284
+ });
145
1285
  });
146
- var Segment = function (_a) {
147
- var _b = _a.block, block = _b === void 0 ? false : _b, onChange = _a.onChange; _a.disabled; var _c = _a.options, options = _c === void 0 ? [] : _c, activeTabId = _a.activeTabId, _d = _a.animationDuration, animationDuration = _d === void 0 ? '0.5s' : _d, _e = _a.styleConfig, styleConfig = _e === void 0 ? {} : _e;
148
- var theme = ctDesignTheme.useTheme();
149
- var animatedBlock = styleConfig.animatedBlock, animatedContainer = styleConfig.animatedContainer, optionButtonWrapper = styleConfig.optionButtonWrapper, root = styleConfig.root, segmentButton = styleConfig.segmentButton;
150
- var _f = React.useState(activeTabId || options[0].tabId), activeTabEleId = _f[0], setActiveTabEleId = _f[1];
151
- var _g = React.useState(false), animateSegment = _g[0], setAnimateSegment = _g[1];
152
- useIsomorphicEffect(function () {
153
- if (activeTabId) {
154
- setActiveTabEleId(activeTabId);
155
- }
156
- }, [activeTabId]);
157
- var handleOptionClick = function (tabId, index) {
158
- setActiveTabEleId(tabId || '');
159
- setAnimateSegment(true);
160
- onChange(tabId);
1286
+ var defaultStylisPlugins = [prefixer];
1287
+ var createCache = function createCache(options) {
1288
+ var key = options.key;
1289
+ if (isBrowser$1 && key === 'css') {
1290
+ var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
1291
+ // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
1292
+ // note this very very intentionally targets all style elements regardless of the key to ensure
1293
+ // that creating a cache works inside of render of a React component
1294
+
1295
+ Array.prototype.forEach.call(ssrStyles, function (node) {
1296
+ // we want to only move elements which have a space in the data-emotion attribute value
1297
+ // because that indicates that it is an Emotion 11 server-side rendered style elements
1298
+ // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
1299
+ // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
1300
+ // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
1301
+ // will not result in the Emotion 10 styles being destroyed
1302
+ var dataEmotionAttribute = node.getAttribute('data-emotion');
1303
+ if (dataEmotionAttribute.indexOf(' ') === -1) {
1304
+ return;
1305
+ }
1306
+ document.head.appendChild(node);
1307
+ node.setAttribute('data-s', '');
1308
+ });
1309
+ }
1310
+ var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
1311
+ var inserted = {};
1312
+ var container;
1313
+ var nodesToHydrate = [];
1314
+ if (isBrowser$1) {
1315
+ container = options.container || document.head;
1316
+ Array.prototype.forEach.call(
1317
+ // this means we will ignore elements which don't have a space in them which
1318
+ // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
1319
+ document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
1320
+ var attrib = node.getAttribute("data-emotion").split(' ');
1321
+ for (var i = 1; i < attrib.length; i++) {
1322
+ inserted[attrib[i]] = true;
1323
+ }
1324
+ nodesToHydrate.push(node);
1325
+ });
1326
+ }
1327
+ var _insert;
1328
+ var omnipresentPlugins = [compat, removeLabel];
1329
+ if (!getServerStylisCache) {
1330
+ var currentSheet;
1331
+ var finalizingPlugins = [stylisExports.stringify, stylisExports.rulesheet(function (rule) {
1332
+ currentSheet.insert(rule);
1333
+ })];
1334
+ var serializer = stylisExports.middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
1335
+ var stylis = function stylis(styles) {
1336
+ return stylisExports.serialize(stylisExports.compile(styles), serializer);
1337
+ };
1338
+ _insert = function insert(selector, serialized, sheet, shouldCache) {
1339
+ currentSheet = sheet;
1340
+ stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
1341
+ if (shouldCache) {
1342
+ cache.inserted[serialized.name] = true;
1343
+ }
161
1344
  };
162
- var findActiveIndex = function (id) {
163
- return options.findIndex(function (item) { return item.tabId === id; });
1345
+ } else {
1346
+ var _finalizingPlugins = [stylisExports.stringify];
1347
+ var _serializer = stylisExports.middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
1348
+ var _stylis = function _stylis(styles) {
1349
+ return stylisExports.serialize(stylisExports.compile(styles), _serializer);
164
1350
  };
165
- return (jsxRuntime.jsxs(StyledSegment, __assign({ isBlock: block, theme: theme }, root, { children: [options.map(function (option, index) { return (jsxRuntime.jsx(SegmentOption, __assign({ isActive: option.tabId === activeTabEleId, theme: theme }, optionButtonWrapper, { children: jsxRuntime.jsx(StyledSegmentBtn, __assign({ theme: theme, onClick: function () { return handleOptionClick(option.tabId); }, isActive: option.tabId === activeTabEleId }, segmentButton, { children: option.text }), "option-".concat(index)) }))); }), jsxRuntime.jsx(StyledAnimatedContainerBlock, __assign({}, animatedContainer, { children: jsxRuntime.jsx(StyledAnimatedBlock, __assign({ toAnimate: animateSegment, activeIndex: findActiveIndex(activeTabEleId), animationLength: animationDuration }, animatedBlock)) }))] })));
1351
+ var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
1352
+ var getRules = function getRules(selector, serialized) {
1353
+ var name = serialized.name;
1354
+ if (serverStylisCache[name] === undefined) {
1355
+ serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
1356
+ }
1357
+ return serverStylisCache[name];
1358
+ };
1359
+ _insert = function _insert(selector, serialized, sheet, shouldCache) {
1360
+ var name = serialized.name;
1361
+ var rules = getRules(selector, serialized);
1362
+ if (cache.compat === undefined) {
1363
+ // in regular mode, we don't set the styles on the inserted cache
1364
+ // since we don't need to and that would be wasting memory
1365
+ // we return them so that they are rendered in a style tag
1366
+ if (shouldCache) {
1367
+ cache.inserted[name] = true;
1368
+ }
1369
+ return rules;
1370
+ } else {
1371
+ // in compat mode, we put the styles on the inserted cache so
1372
+ // that emotion-server can pull out the styles
1373
+ // except when we don't want to cache it which was in Global but now
1374
+ // is nowhere but we don't want to do a major right now
1375
+ // and just in case we're going to leave the case here
1376
+ // it's also not affecting client side bundle size
1377
+ // so it's really not a big deal
1378
+ if (shouldCache) {
1379
+ cache.inserted[name] = rules;
1380
+ } else {
1381
+ return rules;
1382
+ }
1383
+ }
1384
+ };
1385
+ }
1386
+ var cache = {
1387
+ key: key,
1388
+ sheet: new StyleSheet({
1389
+ key: key,
1390
+ container: container,
1391
+ nonce: options.nonce,
1392
+ speedy: options.speedy,
1393
+ prepend: options.prepend,
1394
+ insertionPoint: options.insertionPoint
1395
+ }),
1396
+ nonce: options.nonce,
1397
+ inserted: inserted,
1398
+ registered: {},
1399
+ insert: _insert
1400
+ };
1401
+ cache.sheet.hydrate(nodesToHydrate);
1402
+ return cache;
1403
+ };
1404
+
1405
+ /* eslint-disable */
1406
+ // Inspired by https://github.com/garycourt/murmurhash-js
1407
+ // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
1408
+ function murmur2(str) {
1409
+ // 'm' and 'r' are mixing constants generated offline.
1410
+ // They're not really 'magic', they just happen to work well.
1411
+ // const m = 0x5bd1e995;
1412
+ // const r = 24;
1413
+ // Initialize the hash
1414
+ var h = 0; // Mix 4 bytes at a time into the hash
1415
+
1416
+ var k,
1417
+ i = 0,
1418
+ len = str.length;
1419
+ for (; len >= 4; ++i, len -= 4) {
1420
+ k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
1421
+ k = /* Math.imul(k, m): */
1422
+ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
1423
+ k ^= /* k >>> r: */
1424
+ k >>> 24;
1425
+ h = /* Math.imul(k, m): */
1426
+ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ /* Math.imul(h, m): */
1427
+ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
1428
+ } // Handle the last few bytes of the input array
1429
+
1430
+ switch (len) {
1431
+ case 3:
1432
+ h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
1433
+ case 2:
1434
+ h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
1435
+ case 1:
1436
+ h ^= str.charCodeAt(i) & 0xff;
1437
+ h = /* Math.imul(h, m): */
1438
+ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
1439
+ } // Do a few final mixes of the hash to ensure the last few
1440
+ // bytes are well-incorporated.
1441
+
1442
+ h ^= h >>> 13;
1443
+ h = /* Math.imul(h, m): */
1444
+ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
1445
+ return ((h ^ h >>> 15) >>> 0).toString(36);
1446
+ }
1447
+
1448
+ var unitlessKeys = {
1449
+ animationIterationCount: 1,
1450
+ aspectRatio: 1,
1451
+ borderImageOutset: 1,
1452
+ borderImageSlice: 1,
1453
+ borderImageWidth: 1,
1454
+ boxFlex: 1,
1455
+ boxFlexGroup: 1,
1456
+ boxOrdinalGroup: 1,
1457
+ columnCount: 1,
1458
+ columns: 1,
1459
+ flex: 1,
1460
+ flexGrow: 1,
1461
+ flexPositive: 1,
1462
+ flexShrink: 1,
1463
+ flexNegative: 1,
1464
+ flexOrder: 1,
1465
+ gridRow: 1,
1466
+ gridRowEnd: 1,
1467
+ gridRowSpan: 1,
1468
+ gridRowStart: 1,
1469
+ gridColumn: 1,
1470
+ gridColumnEnd: 1,
1471
+ gridColumnSpan: 1,
1472
+ gridColumnStart: 1,
1473
+ msGridRow: 1,
1474
+ msGridRowSpan: 1,
1475
+ msGridColumn: 1,
1476
+ msGridColumnSpan: 1,
1477
+ fontWeight: 1,
1478
+ lineHeight: 1,
1479
+ opacity: 1,
1480
+ order: 1,
1481
+ orphans: 1,
1482
+ scale: 1,
1483
+ tabSize: 1,
1484
+ widows: 1,
1485
+ zIndex: 1,
1486
+ zoom: 1,
1487
+ WebkitLineClamp: 1,
1488
+ // SVG-related properties
1489
+ fillOpacity: 1,
1490
+ floodOpacity: 1,
1491
+ stopOpacity: 1,
1492
+ strokeDasharray: 1,
1493
+ strokeDashoffset: 1,
1494
+ strokeMiterlimit: 1,
1495
+ strokeOpacity: 1,
1496
+ strokeWidth: 1
1497
+ };
1498
+
1499
+ var isDevelopment = false;
1500
+ var hyphenateRegex = /[A-Z]|^ms/g;
1501
+ var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
1502
+ var isCustomProperty = function isCustomProperty(property) {
1503
+ return property.charCodeAt(1) === 45;
1504
+ };
1505
+ var isProcessableValue = function isProcessableValue(value) {
1506
+ return value != null && typeof value !== 'boolean';
1507
+ };
1508
+ var processStyleName = /* #__PURE__ */memoize(function (styleName) {
1509
+ return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();
1510
+ });
1511
+ var processStyleValue = function processStyleValue(key, value) {
1512
+ switch (key) {
1513
+ case 'animation':
1514
+ case 'animationName':
1515
+ {
1516
+ if (typeof value === 'string') {
1517
+ return value.replace(animationRegex, function (match, p1, p2) {
1518
+ cursor = {
1519
+ name: p1,
1520
+ styles: p2,
1521
+ next: cursor
1522
+ };
1523
+ return p1;
1524
+ });
1525
+ }
1526
+ }
1527
+ }
1528
+ if (unitlessKeys[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {
1529
+ return value + 'px';
1530
+ }
1531
+ return value;
1532
+ };
1533
+ var noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.';
1534
+ function handleInterpolation(mergedProps, registered, interpolation) {
1535
+ if (interpolation == null) {
1536
+ return '';
1537
+ }
1538
+ var componentSelector = interpolation;
1539
+ if (componentSelector.__emotion_styles !== undefined) {
1540
+ return componentSelector;
1541
+ }
1542
+ switch (typeof interpolation) {
1543
+ case 'boolean':
1544
+ {
1545
+ return '';
1546
+ }
1547
+ case 'object':
1548
+ {
1549
+ var keyframes = interpolation;
1550
+ if (keyframes.anim === 1) {
1551
+ cursor = {
1552
+ name: keyframes.name,
1553
+ styles: keyframes.styles,
1554
+ next: cursor
1555
+ };
1556
+ return keyframes.name;
1557
+ }
1558
+ var serializedStyles = interpolation;
1559
+ if (serializedStyles.styles !== undefined) {
1560
+ var next = serializedStyles.next;
1561
+ if (next !== undefined) {
1562
+ // not the most efficient thing ever but this is a pretty rare case
1563
+ // and there will be very few iterations of this generally
1564
+ while (next !== undefined) {
1565
+ cursor = {
1566
+ name: next.name,
1567
+ styles: next.styles,
1568
+ next: cursor
1569
+ };
1570
+ next = next.next;
1571
+ }
1572
+ }
1573
+ var styles = serializedStyles.styles + ";";
1574
+ return styles;
1575
+ }
1576
+ return createStringFromObject(mergedProps, registered, interpolation);
1577
+ }
1578
+ case 'function':
1579
+ {
1580
+ if (mergedProps !== undefined) {
1581
+ var previousCursor = cursor;
1582
+ var result = interpolation(mergedProps);
1583
+ cursor = previousCursor;
1584
+ return handleInterpolation(mergedProps, registered, result);
1585
+ }
1586
+ break;
1587
+ }
1588
+ } // finalize string values (regular strings and functions interpolated into css calls)
1589
+
1590
+ var asString = interpolation;
1591
+ if (registered == null) {
1592
+ return asString;
1593
+ }
1594
+ var cached = registered[asString];
1595
+ return cached !== undefined ? cached : asString;
1596
+ }
1597
+ function createStringFromObject(mergedProps, registered, obj) {
1598
+ var string = '';
1599
+ if (Array.isArray(obj)) {
1600
+ for (var i = 0; i < obj.length; i++) {
1601
+ string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
1602
+ }
1603
+ } else {
1604
+ for (var key in obj) {
1605
+ var value = obj[key];
1606
+ if (typeof value !== 'object') {
1607
+ var asString = value;
1608
+ if (registered != null && registered[asString] !== undefined) {
1609
+ string += key + "{" + registered[asString] + "}";
1610
+ } else if (isProcessableValue(asString)) {
1611
+ string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";";
1612
+ }
1613
+ } else {
1614
+ if (key === 'NO_COMPONENT_SELECTOR' && isDevelopment) {
1615
+ throw new Error(noComponentSelectorMessage);
1616
+ }
1617
+ if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
1618
+ for (var _i = 0; _i < value.length; _i++) {
1619
+ if (isProcessableValue(value[_i])) {
1620
+ string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";";
1621
+ }
1622
+ }
1623
+ } else {
1624
+ var interpolated = handleInterpolation(mergedProps, registered, value);
1625
+ switch (key) {
1626
+ case 'animation':
1627
+ case 'animationName':
1628
+ {
1629
+ string += processStyleName(key) + ":" + interpolated + ";";
1630
+ break;
1631
+ }
1632
+ default:
1633
+ {
1634
+ string += key + "{" + interpolated + "}";
1635
+ }
1636
+ }
1637
+ }
1638
+ }
1639
+ }
1640
+ }
1641
+ return string;
1642
+ }
1643
+ var labelPattern = /label:\s*([^\s;{]+)\s*(;|$)/g; // this is the cursor for keyframes
1644
+ // keyframes are stored on the SerializedStyles object as a linked list
1645
+
1646
+ var cursor;
1647
+ function serializeStyles(args, registered, mergedProps) {
1648
+ if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
1649
+ return args[0];
1650
+ }
1651
+ var stringMode = true;
1652
+ var styles = '';
1653
+ cursor = undefined;
1654
+ var strings = args[0];
1655
+ if (strings == null || strings.raw === undefined) {
1656
+ stringMode = false;
1657
+ styles += handleInterpolation(mergedProps, registered, strings);
1658
+ } else {
1659
+ var asTemplateStringsArr = strings;
1660
+ styles += asTemplateStringsArr[0];
1661
+ } // we start at 1 since we've already handled the first arg
1662
+
1663
+ for (var i = 1; i < args.length; i++) {
1664
+ styles += handleInterpolation(mergedProps, registered, args[i]);
1665
+ if (stringMode) {
1666
+ var templateStringsArr = strings;
1667
+ styles += templateStringsArr[i];
1668
+ }
1669
+ } // using a global regex with .exec is stateful so lastIndex has to be reset each time
1670
+
1671
+ labelPattern.lastIndex = 0;
1672
+ var identifierName = '';
1673
+ var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
1674
+
1675
+ while ((match = labelPattern.exec(styles)) !== null) {
1676
+ identifierName += '-' + match[1];
1677
+ }
1678
+ var name = murmur2(styles) + identifierName;
1679
+ return {
1680
+ name: name,
1681
+ styles: styles,
1682
+ next: cursor
1683
+ };
1684
+ }
1685
+
1686
+ var isBrowser = typeof document !== 'undefined';
1687
+ function getRegisteredStyles(registered, registeredStyles, classNames) {
1688
+ var rawClassName = '';
1689
+ classNames.split(' ').forEach(function (className) {
1690
+ if (registered[className] !== undefined) {
1691
+ registeredStyles.push(registered[className] + ";");
1692
+ } else if (className) {
1693
+ rawClassName += className + " ";
1694
+ }
1695
+ });
1696
+ return rawClassName;
1697
+ }
1698
+ var registerStyles = function registerStyles(cache, serialized, isStringTag) {
1699
+ var className = cache.key + "-" + serialized.name;
1700
+ if (
1701
+ // we only need to add the styles to the registered cache if the
1702
+ // class name could be used further down
1703
+ // the tree but if it's a string tag, we know it won't
1704
+ // so we don't have to add it to registered cache.
1705
+ // this improves memory usage since we can avoid storing the whole style string
1706
+ (isStringTag === false ||
1707
+ // we need to always store it if we're in compat mode and
1708
+ // in node since emotion-server relies on whether a style is in
1709
+ // the registered cache to know whether a style is global or not
1710
+ // also, note that this check will be dead code eliminated in the browser
1711
+ isBrowser === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
1712
+ cache.registered[className] = serialized.styles;
1713
+ }
1714
+ };
1715
+ var insertStyles = function insertStyles(cache, serialized, isStringTag) {
1716
+ registerStyles(cache, serialized, isStringTag);
1717
+ var className = cache.key + "-" + serialized.name;
1718
+ if (cache.inserted[serialized.name] === undefined) {
1719
+ var stylesForSSR = '';
1720
+ var current = serialized;
1721
+ do {
1722
+ var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
1723
+ if (!isBrowser && maybeStyles !== undefined) {
1724
+ stylesForSSR += maybeStyles;
1725
+ }
1726
+ current = current.next;
1727
+ } while (current !== undefined);
1728
+ if (!isBrowser && stylesForSSR.length !== 0) {
1729
+ return stylesForSSR;
1730
+ }
1731
+ }
1732
+ };
1733
+
1734
+ function insertWithoutScoping(cache, serialized) {
1735
+ if (cache.inserted[serialized.name] === undefined) {
1736
+ return cache.insert('', serialized, cache.sheet, true);
1737
+ }
1738
+ }
1739
+ function merge(registered, css, className) {
1740
+ var registeredStyles = [];
1741
+ var rawClassName = getRegisteredStyles(registered, registeredStyles, className);
1742
+ if (registeredStyles.length < 2) {
1743
+ return className;
1744
+ }
1745
+ return rawClassName + css(registeredStyles);
1746
+ }
1747
+ var createEmotion = function createEmotion(options) {
1748
+ var cache = createCache(options);
1749
+ cache.sheet.speedy = function (value) {
1750
+ this.isSpeedy = value;
1751
+ };
1752
+ cache.compat = true;
1753
+ var css = function css() {
1754
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1755
+ args[_key] = arguments[_key];
1756
+ }
1757
+ var serialized = serializeStyles(args, cache.registered, undefined);
1758
+ insertStyles(cache, serialized, false);
1759
+ return cache.key + "-" + serialized.name;
1760
+ };
1761
+ var keyframes = function keyframes() {
1762
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1763
+ args[_key2] = arguments[_key2];
1764
+ }
1765
+ var serialized = serializeStyles(args, cache.registered);
1766
+ var animation = "animation-" + serialized.name;
1767
+ insertWithoutScoping(cache, {
1768
+ name: serialized.name,
1769
+ styles: "@keyframes " + animation + "{" + serialized.styles + "}"
1770
+ });
1771
+ return animation;
1772
+ };
1773
+ var injectGlobal = function injectGlobal() {
1774
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1775
+ args[_key3] = arguments[_key3];
1776
+ }
1777
+ var serialized = serializeStyles(args, cache.registered);
1778
+ insertWithoutScoping(cache, serialized);
1779
+ };
1780
+ var cx = function cx() {
1781
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1782
+ args[_key4] = arguments[_key4];
1783
+ }
1784
+ return merge(cache.registered, css, classnames(args));
1785
+ };
1786
+ return {
1787
+ css: css,
1788
+ cx: cx,
1789
+ injectGlobal: injectGlobal,
1790
+ keyframes: keyframes,
1791
+ hydrate: function hydrate(ids) {
1792
+ ids.forEach(function (key) {
1793
+ cache.inserted[key] = true;
1794
+ });
1795
+ },
1796
+ flush: function flush() {
1797
+ cache.registered = {};
1798
+ cache.inserted = {};
1799
+ cache.sheet.flush();
1800
+ },
1801
+ sheet: cache.sheet,
1802
+ cache: cache,
1803
+ getRegisteredStyles: getRegisteredStyles.bind(null, cache.registered),
1804
+ merge: merge.bind(null, cache.registered, css)
1805
+ };
1806
+ };
1807
+ var classnames = function classnames(args) {
1808
+ var cls = '';
1809
+ for (var i = 0; i < args.length; i++) {
1810
+ var arg = args[i];
1811
+ if (arg == null) continue;
1812
+ var toAdd = void 0;
1813
+ switch (typeof arg) {
1814
+ case 'boolean':
1815
+ break;
1816
+ case 'object':
1817
+ {
1818
+ if (Array.isArray(arg)) {
1819
+ toAdd = classnames(arg);
1820
+ } else {
1821
+ toAdd = '';
1822
+ for (var k in arg) {
1823
+ if (arg[k] && k) {
1824
+ toAdd && (toAdd += ' ');
1825
+ toAdd += k;
1826
+ }
1827
+ }
1828
+ }
1829
+ break;
1830
+ }
1831
+ default:
1832
+ {
1833
+ toAdd = arg;
1834
+ }
1835
+ }
1836
+ if (toAdd) {
1837
+ cls && (cls += ' ');
1838
+ cls += toAdd;
1839
+ }
1840
+ }
1841
+ return cls;
1842
+ };
1843
+
1844
+ var _createEmotion = createEmotion({
1845
+ key: 'css'
1846
+ }),
1847
+ css = _createEmotion.css;
1848
+
1849
+ const useIsomorphicEffect = typeof window !== 'undefined' ? React__namespace.useLayoutEffect : React__namespace.useEffect;
1850
+
1851
+ function isEmptyOptions(opts) {
1852
+ return !opts || opts.length === 0;
1853
+ }
1854
+ function toStyleArray(value) {
1855
+ if (value === undefined || value === null)
1856
+ return [];
1857
+ return Array.isArray(value) ? value : [value];
1858
+ }
1859
+ const Segment = ({ block = false, disabled = false, enableTabClick = false, variant = exports.SegmentVariant.DEFAULT, onChange, options = [], activeTabId, animationDuration = 500, styleConfig = {}, }) => {
1860
+ var _a, _b, _c, _d, _e, _f;
1861
+ const { root = [], optionButtonWrapper = [], segmentButton: segmentButtonConfig, animatedContainer = [], animatedBlock = [], optionButtonWrapperActive = [], segmentButtonActive = [], } = styleConfig || {};
1862
+ const theme = ctDesignTheme.useTheme();
1863
+ const variantStyles = React.useMemo(() => getSegmentVariantStyles(variant, theme), [variant, theme]);
1864
+ const rootRef = React.useRef(null);
1865
+ const tabRefs = React.useRef([]);
1866
+ const sanitizedOptions = React.useMemo(() => options.filter((option) => { var _a; return String((_a = option.tabId) !== null && _a !== void 0 ? _a : '').trim().length > 0; }), [options]);
1867
+ const [activeTabEleId, setActiveTabEleId] = React.useState(() => {
1868
+ const t = typeof activeTabId === 'string' ? activeTabId.trim() : '';
1869
+ return t.length > 0 ? t : '';
1870
+ });
1871
+ const [trackWidth, setTrackWidth] = React.useState(0);
1872
+ const [tabLayouts, setTabLayouts] = React.useState([]);
1873
+ const baseSegmentButtonConfig = React.useMemo(() => { var _a; return (_a = segmentButtonConfig === null || segmentButtonConfig === void 0 ? void 0 : segmentButtonConfig.segmentButton) !== null && _a !== void 0 ? _a : {}; }, [segmentButtonConfig]);
1874
+ const baseSegmentTextConfig = React.useMemo(() => { var _a; return (_a = segmentButtonConfig === null || segmentButtonConfig === void 0 ? void 0 : segmentButtonConfig.segmentText) !== null && _a !== void 0 ? _a : {}; }, [segmentButtonConfig]);
1875
+ const baseSegmentButtonRoot = React.useMemo(() => toStyleArray(baseSegmentButtonConfig.root), [baseSegmentButtonConfig.root]);
1876
+ const baseSegmentTextRoot = React.useMemo(() => toStyleArray(baseSegmentTextConfig.root), [baseSegmentTextConfig.root]);
1877
+ const measureTabs = React.useCallback(() => {
1878
+ const rootNode = rootRef.current;
1879
+ if (!rootNode)
1880
+ return;
1881
+ const rootRect = rootNode.getBoundingClientRect();
1882
+ setTrackWidth(rootRect.width);
1883
+ const layouts = sanitizedOptions.map((_, index) => {
1884
+ const tabNode = tabRefs.current[index];
1885
+ if (!tabNode)
1886
+ return { x: 0, width: 0 };
1887
+ const rect = tabNode.getBoundingClientRect();
1888
+ return { x: rect.left - rootRect.left, width: rect.width };
1889
+ });
1890
+ setTabLayouts(layouts);
1891
+ }, [sanitizedOptions]);
1892
+ React.useEffect(() => {
1893
+ tabRefs.current = tabRefs.current.slice(0, sanitizedOptions.length);
1894
+ }, [sanitizedOptions.length]);
1895
+ React.useEffect(() => {
1896
+ measureTabs();
1897
+ }, [measureTabs]);
1898
+ React.useEffect(() => {
1899
+ if (typeof ResizeObserver === 'undefined' || !rootRef.current)
1900
+ return;
1901
+ const observer = new ResizeObserver(() => {
1902
+ measureTabs();
1903
+ });
1904
+ observer.observe(rootRef.current);
1905
+ tabRefs.current.forEach((tabNode) => {
1906
+ if (tabNode)
1907
+ observer.observe(tabNode);
1908
+ });
1909
+ return () => observer.disconnect();
1910
+ }, [measureTabs, sanitizedOptions.length]);
1911
+ const findActiveIndex = React.useCallback((id) => {
1912
+ const idx = sanitizedOptions.findIndex((item) => item.tabId === id.trim());
1913
+ return idx === -1 ? 0 : idx;
1914
+ }, [sanitizedOptions]);
1915
+ const handleOptionClick = React.useCallback((tabId, index) => {
1916
+ var _a;
1917
+ const clickedOption = sanitizedOptions[index];
1918
+ const isDisabled = (_a = clickedOption === null || clickedOption === void 0 ? void 0 : clickedOption.disabled) !== null && _a !== void 0 ? _a : false;
1919
+ if (isDisabled && !enableTabClick)
1920
+ return;
1921
+ onChange(tabId);
1922
+ if (!isDisabled) {
1923
+ setActiveTabEleId(tabId || '');
1924
+ }
1925
+ }, [enableTabClick, onChange, sanitizedOptions]);
1926
+ const optionLength = sanitizedOptions.length;
1927
+ const activeIndex = findActiveIndex(activeTabEleId);
1928
+ const dynamicStyles = ctDesignStyleManager.useStyles(() => ({
1929
+ root: {
1930
+ width: block ? theme === null || theme === void 0 ? void 0 : theme.size['100P'] : 'auto',
1931
+ },
1932
+ }), [block, theme]);
1933
+ const getSegmentButtonStyleConfig = React.useCallback((index) => {
1934
+ var _a, _b;
1935
+ const isActive = index === activeIndex;
1936
+ return {
1937
+ segmentButton: Object.assign(Object.assign({}, baseSegmentButtonConfig), { root: [...optionButtonWrapper, ...(isActive ? optionButtonWrapperActive : []), ...baseSegmentButtonRoot] }),
1938
+ segmentText: Object.assign(Object.assign({}, baseSegmentTextConfig), { root: [
1939
+ ...(((_a = variantStyles.segmentButton) === null || _a === void 0 ? void 0 : _a.style) ? [variantStyles.segmentButton.style] : []),
1940
+ ...(isActive && ((_b = variantStyles.segmentButtonActive) === null || _b === void 0 ? void 0 : _b.style) ? [variantStyles.segmentButtonActive.style] : []),
1941
+ ...(isActive ? segmentButtonActive : []),
1942
+ ...baseSegmentTextRoot,
1943
+ ] }),
1944
+ };
1945
+ }, [
1946
+ activeIndex,
1947
+ baseSegmentButtonConfig,
1948
+ baseSegmentButtonRoot,
1949
+ baseSegmentTextConfig,
1950
+ baseSegmentTextRoot,
1951
+ optionButtonWrapper,
1952
+ optionButtonWrapperActive,
1953
+ segmentButtonActive,
1954
+ (_a = variantStyles.segmentButton) === null || _a === void 0 ? void 0 : _a.style,
1955
+ (_b = variantStyles.segmentButtonActive) === null || _b === void 0 ? void 0 : _b.style,
1956
+ ]);
1957
+ useIsomorphicEffect(() => {
1958
+ if (activeTabId === undefined || activeTabId === null)
1959
+ return;
1960
+ const t = `${activeTabId}`.trim();
1961
+ if (!t.length)
1962
+ return;
1963
+ if (sanitizedOptions.some((option) => option.tabId === t)) {
1964
+ setActiveTabEleId(t);
1965
+ return;
1966
+ }
1967
+ }, [activeTabId, sanitizedOptions]);
1968
+ useIsomorphicEffect(() => {
1969
+ setActiveTabEleId((prev) => {
1970
+ var _a, _b;
1971
+ const trimmed = prev.trim();
1972
+ if (trimmed.length > 0 && sanitizedOptions.some((option) => option.tabId === trimmed)) {
1973
+ return prev;
1974
+ }
1975
+ return (_b = (_a = sanitizedOptions[0]) === null || _a === void 0 ? void 0 : _a.tabId) !== null && _b !== void 0 ? _b : '';
1976
+ });
1977
+ }, [sanitizedOptions]);
1978
+ const rootClassName = ctDesignStyleManager.useWebMergeStyles([
1979
+ segmentStaticStyles.root,
1980
+ dynamicStyles.root,
1981
+ ...(((_c = variantStyles.root) === null || _c === void 0 ? void 0 : _c.style) ? [variantStyles.root.style] : []),
1982
+ ...root,
1983
+ ], [segmentStaticStyles.root, dynamicStyles.root, (_d = variantStyles.root) === null || _d === void 0 ? void 0 : _d.style, root]);
1984
+ const tabMeasureCellClassName = ctDesignStyleManager.useWebMergeStyles([segmentStaticStyles.tabMeasureCell], [segmentStaticStyles.tabMeasureCell]);
1985
+ const webThumbBaseClassName = ctDesignStyleManager.useWebMergeStyles([
1986
+ segmentWebThumbStyles.root,
1987
+ ...(((_e = variantStyles.animatedBlock) === null || _e === void 0 ? void 0 : _e.style) ? [variantStyles.animatedBlock.style] : []),
1988
+ ...animatedBlock,
1989
+ ], [segmentWebThumbStyles.root, (_f = variantStyles.animatedBlock) === null || _f === void 0 ? void 0 : _f.style, animatedBlock]);
1990
+ const hasStableMeasurements = tabLayouts.length >= optionLength &&
1991
+ tabLayouts.slice(0, optionLength).every((layout) => !!layout && layout.width > 0);
1992
+ const segmentPercent = optionLength > 0 ? 100 / optionLength : 100;
1993
+ const dynamicWebStyles = React.useMemo(() => {
1994
+ var _a, _b;
1995
+ const transition = `left ${animationDuration}ms ease, width ${animationDuration}ms ease`;
1996
+ if (hasStableMeasurements && optionLength > 0) {
1997
+ const safeIndex = Math.max(0, Math.min(activeIndex, optionLength - 1));
1998
+ const activeLayout = tabLayouts[safeIndex];
1999
+ const width = Math.max((_a = activeLayout === null || activeLayout === void 0 ? void 0 : activeLayout.width) !== null && _a !== void 0 ? _a : trackWidth / Math.max(optionLength, 1), 0);
2000
+ const maxLeft = Math.max(trackWidth - width, 0);
2001
+ const left = Math.min(Math.max((_b = activeLayout === null || activeLayout === void 0 ? void 0 : activeLayout.x) !== null && _b !== void 0 ? _b : 0, 0), maxLeft);
2002
+ return css({
2003
+ left: `${left}px`,
2004
+ width: `${width}px`,
2005
+ transition,
2006
+ });
2007
+ }
2008
+ return css({
2009
+ left: `calc(${activeIndex * segmentPercent}%)`,
2010
+ width: `${segmentPercent}%`,
2011
+ transition,
2012
+ animationDuration: `${animationDuration}ms`,
2013
+ animationFillMode: 'forwards',
2014
+ });
2015
+ }, [activeIndex, animationDuration, hasStableMeasurements, optionLength, segmentPercent, tabLayouts, trackWidth]);
2016
+ if (!(sanitizedOptions === null || sanitizedOptions === void 0 ? void 0 : sanitizedOptions.length))
2017
+ return null;
2018
+ return (jsxRuntime.jsxs("div", { className: rootClassName, ref: rootRef, children: [jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: {
2019
+ root: [segmentStaticStyles.animatedContainer, ...animatedContainer],
2020
+ }, children: !isEmptyOptions(sanitizedOptions) &&
2021
+ sanitizedOptions.map((option, index) => (jsxRuntime.jsx("div", { ref: (element) => {
2022
+ tabRefs.current[index] = element;
2023
+ }, className: tabMeasureCellClassName, children: jsxRuntime.jsx(SegmentButton, { option: option, index: index, activeIndex: activeIndex, disabled: disabled, onOptionClick: handleOptionClick, optionLength: optionLength, variant: variant, styleConfig: getSegmentButtonStyleConfig(index) }) }, option.tabId))) }), jsxRuntime.jsx("div", { className: `${webThumbBaseClassName} ${dynamicWebStyles}` })] }));
166
2024
  };
167
2025
 
168
2026
  exports.Segment = Segment;