chaeditor 0.1.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 (40) hide show
  1. package/LICENSE.txt +21 -0
  2. package/README.ko.md +250 -0
  3. package/README.md +242 -0
  4. package/dist/core.cjs +1034 -0
  5. package/dist/core.d.mts +347 -0
  6. package/dist/core.d.ts +347 -0
  7. package/dist/core.mjs +988 -0
  8. package/dist/default-host.cjs +243 -0
  9. package/dist/default-host.d.mts +52 -0
  10. package/dist/default-host.d.ts +52 -0
  11. package/dist/default-host.mjs +239 -0
  12. package/dist/default-markdown-primitive-registry-B3PGEkqs.d.mts +12 -0
  13. package/dist/default-markdown-primitive-registry-CqzwhHj2.d.ts +12 -0
  14. package/dist/image-upload-kind-BJqItE_C.d.mts +18 -0
  15. package/dist/image-upload-kind-BJqItE_C.d.ts +18 -0
  16. package/dist/index.cjs +8736 -0
  17. package/dist/index.d.mts +7 -0
  18. package/dist/index.d.ts +7 -0
  19. package/dist/index.mjs +8668 -0
  20. package/dist/markdown-editor-B1qvE40Z.d.mts +460 -0
  21. package/dist/markdown-editor-Ce6DpnQk.d.ts +460 -0
  22. package/dist/markdown-primitive-contract-BXsqbKwY.d.mts +124 -0
  23. package/dist/markdown-primitive-contract-BXsqbKwY.d.ts +124 -0
  24. package/dist/panda-primitives.cjs +1299 -0
  25. package/dist/panda-primitives.d.mts +21127 -0
  26. package/dist/panda-primitives.d.ts +21127 -0
  27. package/dist/panda-primitives.mjs +1285 -0
  28. package/dist/react.cjs +8558 -0
  29. package/dist/react.d.mts +35 -0
  30. package/dist/react.d.ts +35 -0
  31. package/dist/react.mjs +8531 -0
  32. package/dist/toolbar-preset-B9ttTEol.d.ts +236 -0
  33. package/dist/toolbar-preset-DIsQN390.d.mts +236 -0
  34. package/package.json +151 -0
  35. package/recipes/host-presets/README.md +16 -0
  36. package/recipes/host-presets/emotion-host-preset.tsx.template +109 -0
  37. package/recipes/host-presets/styled-components-host-preset.tsx.template +102 -0
  38. package/recipes/host-presets/tailwind-host-preset.tsx.template +116 -0
  39. package/recipes/host-presets/vanilla-extract-host-preset.tsx.template +116 -0
  40. package/styled-system/styles.css +3370 -0
@@ -0,0 +1,1299 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var reactDom = require('react-dom');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ var React__default = /*#__PURE__*/_interopDefault(React);
10
+
11
+ // src/shared/ui/button/button.tsx
12
+
13
+ // styled-system/helpers.mjs
14
+ function isObject(value) {
15
+ return typeof value === "object" && value != null && !Array.isArray(value);
16
+ }
17
+ var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
18
+ function compact(value) {
19
+ return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));
20
+ }
21
+ var isBaseCondition = (v) => v === "base";
22
+ function filterBaseConditions(c) {
23
+ return c.slice().filter((v) => !isBaseCondition(v));
24
+ }
25
+ function toChar(code) {
26
+ return String.fromCharCode(code + (code > 25 ? 39 : 97));
27
+ }
28
+ function toName(code) {
29
+ let name = "";
30
+ let x;
31
+ for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toChar(x % 52) + name;
32
+ return toChar(x % 52) + name;
33
+ }
34
+ function toPhash(h, x) {
35
+ let i = x.length;
36
+ while (i) h = h * 33 ^ x.charCodeAt(--i);
37
+ return h;
38
+ }
39
+ function toHash(value) {
40
+ return toName(toPhash(5381, value) >>> 0);
41
+ }
42
+ var importantRegex = /\s*!(important)?/i;
43
+ function isImportant(value) {
44
+ return typeof value === "string" ? importantRegex.test(value) : false;
45
+ }
46
+ function withoutImportant(value) {
47
+ return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
48
+ }
49
+ function withoutSpace(str) {
50
+ return typeof str === "string" ? str.replaceAll(" ", "_") : str;
51
+ }
52
+ var memo = (fn) => {
53
+ const cache = /* @__PURE__ */ new Map();
54
+ const get = (...args) => {
55
+ const key = JSON.stringify(args);
56
+ if (cache.has(key)) {
57
+ return cache.get(key);
58
+ }
59
+ const result = fn(...args);
60
+ cache.set(key, result);
61
+ return result;
62
+ };
63
+ return get;
64
+ };
65
+ var MERGE_OMIT = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
66
+ function mergeProps(...sources) {
67
+ return sources.reduce((prev, obj) => {
68
+ if (!obj) return prev;
69
+ Object.keys(obj).forEach((key) => {
70
+ if (MERGE_OMIT.has(key)) return;
71
+ const prevValue = prev[key];
72
+ const value = obj[key];
73
+ if (isObject(prevValue) && isObject(value)) {
74
+ prev[key] = mergeProps(prevValue, value);
75
+ } else {
76
+ prev[key] = value;
77
+ }
78
+ });
79
+ return prev;
80
+ }, {});
81
+ }
82
+ var isNotNullish = (element) => element != null;
83
+ function walkObject(target, predicate, options = {}) {
84
+ const { stop, getKey } = options;
85
+ function inner(value, path = []) {
86
+ if (isObjectOrArray(value)) {
87
+ const result = {};
88
+ for (const [prop, child] of Object.entries(value)) {
89
+ const key = getKey?.(prop, child) ?? prop;
90
+ const childPath = [...path, key];
91
+ if (stop?.(value, childPath)) {
92
+ return predicate(value, path);
93
+ }
94
+ const next = inner(child, childPath);
95
+ if (isNotNullish(next)) {
96
+ result[key] = next;
97
+ }
98
+ }
99
+ return result;
100
+ }
101
+ return predicate(value, path);
102
+ }
103
+ return inner(target);
104
+ }
105
+ function toResponsiveObject(values, breakpoints) {
106
+ return values.reduce(
107
+ (acc, current, index) => {
108
+ const key = breakpoints[index];
109
+ if (current != null) {
110
+ acc[key] = current;
111
+ }
112
+ return acc;
113
+ },
114
+ {}
115
+ );
116
+ }
117
+ function normalizeStyleObject(styles, context2, shorthand = true) {
118
+ const { utility, conditions: conditions2 } = context2;
119
+ const { hasShorthand, resolveShorthand: resolveShorthand2 } = utility;
120
+ return walkObject(
121
+ styles,
122
+ (value) => {
123
+ return Array.isArray(value) ? toResponsiveObject(value, conditions2.breakpoints.keys) : value;
124
+ },
125
+ {
126
+ stop: (value) => Array.isArray(value),
127
+ getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand2(prop) : prop : void 0
128
+ }
129
+ );
130
+ }
131
+ var fallbackCondition = {
132
+ shift: (v) => v,
133
+ finalize: (v) => v,
134
+ breakpoints: { keys: [] }
135
+ };
136
+ var sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\n\s]+/g, " ") : value;
137
+ function createCss(context2) {
138
+ const { utility, hash, conditions: conds = fallbackCondition } = context2;
139
+ const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");
140
+ const hashFn = (conditions2, className) => {
141
+ let result;
142
+ if (hash) {
143
+ const baseArray = [...conds.finalize(conditions2), className];
144
+ result = formatClassName(utility.toHash(baseArray, toHash));
145
+ } else {
146
+ const baseArray = [...conds.finalize(conditions2), formatClassName(className)];
147
+ result = baseArray.join(":");
148
+ }
149
+ return result;
150
+ };
151
+ return memo(({ base, ...styles } = {}) => {
152
+ const styleObject = Object.assign(styles, base);
153
+ const normalizedObject = normalizeStyleObject(styleObject, context2);
154
+ const classNames = /* @__PURE__ */ new Set();
155
+ walkObject(normalizedObject, (value, paths) => {
156
+ if (value == null) return;
157
+ const important = isImportant(value);
158
+ const [prop, ...allConditions] = conds.shift(paths);
159
+ const conditions2 = filterBaseConditions(allConditions);
160
+ const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
161
+ let className = hashFn(conditions2, transformed.className);
162
+ if (important) className = `${className}!`;
163
+ classNames.add(className);
164
+ });
165
+ return Array.from(classNames).join(" ");
166
+ });
167
+ }
168
+ function compactStyles(...styles) {
169
+ return styles.flat().filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);
170
+ }
171
+ function createMergeCss(context2) {
172
+ function resolve(styles) {
173
+ const allStyles = compactStyles(...styles);
174
+ if (allStyles.length === 1) return allStyles;
175
+ return allStyles.map((style) => normalizeStyleObject(style, context2));
176
+ }
177
+ function mergeCss2(...styles) {
178
+ return mergeProps(...resolve(styles));
179
+ }
180
+ function assignCss2(...styles) {
181
+ return Object.assign({}, ...resolve(styles));
182
+ }
183
+ return { mergeCss: memo(mergeCss2), assignCss: assignCss2 };
184
+ }
185
+ var wordRegex = /([A-Z])/g;
186
+ var msRegex = /^ms-/;
187
+ var hypenateProperty = memo((property) => {
188
+ if (property.startsWith("--")) return property;
189
+ return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
190
+ });
191
+ var lengthUnits = "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%";
192
+ `(?:${lengthUnits.split(",").join("|")})`;
193
+ var getSlotRecipes = (recipe = {}) => {
194
+ const init = (slot) => ({
195
+ className: [recipe.className, slot].filter(Boolean).join("__"),
196
+ base: recipe.base?.[slot] ?? {},
197
+ variants: {},
198
+ defaultVariants: recipe.defaultVariants ?? {},
199
+ compoundVariants: recipe.compoundVariants ? getSlotCompoundVariant(recipe.compoundVariants, slot) : []
200
+ });
201
+ const slots = recipe.slots ?? [];
202
+ const recipeParts = slots.map((slot) => [slot, init(slot)]);
203
+ for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {
204
+ for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {
205
+ recipeParts.forEach(([slot, slotRecipe]) => {
206
+ slotRecipe.variants[variantsKey] ??= {};
207
+ slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};
208
+ });
209
+ }
210
+ }
211
+ return Object.fromEntries(recipeParts);
212
+ };
213
+ var getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));
214
+ function splitProps(props, ...keys) {
215
+ const descriptors = Object.getOwnPropertyDescriptors(props);
216
+ const dKeys = Object.keys(descriptors);
217
+ const split = (k) => {
218
+ const clone = {};
219
+ for (let i = 0; i < k.length; i++) {
220
+ const key = k[i];
221
+ if (descriptors[key]) {
222
+ Object.defineProperty(clone, key, descriptors[key]);
223
+ delete descriptors[key];
224
+ }
225
+ }
226
+ return clone;
227
+ };
228
+ const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));
229
+ return keys.map(fn).concat(split(dKeys));
230
+ }
231
+ var uniq = (...items) => {
232
+ const set = items.reduce((acc, currItems) => {
233
+ if (currItems) {
234
+ currItems.forEach((item) => acc.add(item));
235
+ }
236
+ return acc;
237
+ }, /* @__PURE__ */ new Set([]));
238
+ return Array.from(set);
239
+ };
240
+
241
+ // styled-system/css/conditions.mjs
242
+ var conditionsStr = "_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_complete,_incomplete,_dragging,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_grabbed,_underValue,_overValue,_atValue,_default,_optional,_open,_closed,_fullscreen,_loading,_hidden,_current,_currentPage,_currentStep,_today,_unavailable,_rangeStart,_rangeEnd,_now,_topmost,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_icon,_starting,_noscript,_invertedColors,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,xl,xlOnly,xlDown,2xl,2xlOnly,2xlDown,smToMd,smToLg,smToXl,smTo2xl,mdToLg,mdToXl,mdTo2xl,lgToXl,lgTo2xl,xlTo2xl,@/xs,@/sm,@/md,@/lg,@/xl,@/2xl,@/3xl,@/4xl,@/5xl,@/6xl,@/7xl,@/8xl,base";
243
+ var conditions = new Set(conditionsStr.split(","));
244
+ var conditionRegex = /^@|&|&$/;
245
+ function isCondition(value) {
246
+ return conditions.has(value) || conditionRegex.test(value);
247
+ }
248
+ var underscoreRegex = /^_/;
249
+ var conditionsSelectorRegex = /&|@/;
250
+ function finalizeConditions(paths) {
251
+ return paths.map((path) => {
252
+ if (conditions.has(path)) {
253
+ return path.replace(underscoreRegex, "");
254
+ }
255
+ if (conditionsSelectorRegex.test(path)) {
256
+ return `[${withoutSpace(path.trim())}]`;
257
+ }
258
+ return path;
259
+ });
260
+ }
261
+ function sortConditions(paths) {
262
+ return paths.sort((a, b) => {
263
+ const aa = isCondition(a);
264
+ const bb = isCondition(b);
265
+ if (aa && !bb) return 1;
266
+ if (!aa && bb) return -1;
267
+ return 0;
268
+ });
269
+ }
270
+
271
+ // styled-system/css/css.mjs
272
+ var utilities = "aspectRatio:asp,boxDecorationBreak:bx-db,zIndex:z,boxSizing:bx-s,objectPosition:obj-p,objectFit:obj-f,overscrollBehavior:ovs-b,overscrollBehaviorX:ovs-bx,overscrollBehaviorY:ovs-by,position:pos/1,top:top,left:left,inset:inset,insetInline:inset-x/insetX,insetBlock:inset-y/insetY,insetBlockEnd:inset-be,insetBlockStart:inset-bs,insetInlineEnd:inset-e/insetEnd/end,insetInlineStart:inset-s/insetStart/start,right:right,bottom:bottom,float:float,visibility:vis,display:d,hideFrom:hide,hideBelow:show,flexBasis:flex-b,flex:flex,flexDirection:flex-d/flexDir,flexGrow:flex-g,flexShrink:flex-sh,gridTemplateColumns:grid-tc,gridTemplateRows:grid-tr,gridColumn:grid-c,gridRow:grid-r,gridColumnStart:grid-cs,gridColumnEnd:grid-ce,gridAutoFlow:grid-af,gridAutoColumns:grid-ac,gridAutoRows:grid-ar,gap:gap,gridGap:grid-g,gridRowGap:grid-rg,gridColumnGap:grid-cg,rowGap:rg,columnGap:cg,justifyContent:jc,alignContent:ac,alignItems:ai,alignSelf:as,padding:p/1,paddingLeft:pl/1,paddingRight:pr/1,paddingTop:pt/1,paddingBottom:pb/1,paddingBlock:py/1/paddingY,paddingBlockEnd:pbe,paddingBlockStart:pbs,paddingInline:px/paddingX/1,paddingInlineEnd:pe/1/paddingEnd,paddingInlineStart:ps/1/paddingStart,marginLeft:ml/1,marginRight:mr/1,marginTop:mt/1,marginBottom:mb/1,margin:m/1,marginBlock:my/1/marginY,marginBlockEnd:mbe,marginBlockStart:mbs,marginInline:mx/1/marginX,marginInlineEnd:me/1/marginEnd,marginInlineStart:ms/1/marginStart,spaceX:sx,spaceY:sy,outlineWidth:ring-w/ringWidth,outlineColor:ring-c/ringColor,outline:ring/1,outlineOffset:ring-o/ringOffset,focusRing:focus-ring,focusVisibleRing:focus-v-ring,focusRingColor:focus-ring-c,focusRingOffset:focus-ring-o,focusRingWidth:focus-ring-w,focusRingStyle:focus-ring-s,divideX:dvd-x,divideY:dvd-y,divideColor:dvd-c,divideStyle:dvd-s,width:w/1,inlineSize:w-is,minWidth:min-w/minW,minInlineSize:min-w-is,maxWidth:max-w/maxW,maxInlineSize:max-w-is,height:h/1,blockSize:h-bs,minHeight:min-h/minH,minBlockSize:min-h-bs,maxHeight:max-h/maxH,maxBlockSize:max-b,boxSize:size,color:c,fontFamily:ff,fontSize:fs,fontSizeAdjust:fs-a,fontPalette:fp,fontKerning:fk,fontFeatureSettings:ff-s,fontWeight:fw,fontSmoothing:fsmt,fontVariant:fv,fontVariantAlternates:fv-alt,fontVariantCaps:fv-caps,fontVariationSettings:fv-s,fontVariantNumeric:fv-num,letterSpacing:ls,lineHeight:lh,textAlign:ta,textDecoration:td,textDecorationColor:td-c,textEmphasisColor:te-c,textDecorationStyle:td-s,textDecorationThickness:td-t,textUnderlineOffset:tu-o,textTransform:tt,textIndent:ti,textShadow:tsh,textShadowColor:tsh-c/textShadowColor,WebkitTextFillColor:wktf-c,textOverflow:tov,verticalAlign:va,wordBreak:wb,textWrap:tw,truncate:trunc,lineClamp:lc,listStyleType:li-t,listStylePosition:li-pos,listStyleImage:li-img,listStyle:li-s,backgroundPosition:bg-p/bgPosition,backgroundPositionX:bg-p-x/bgPositionX,backgroundPositionY:bg-p-y/bgPositionY,backgroundAttachment:bg-a/bgAttachment,backgroundClip:bg-cp/bgClip,background:bg/1,backgroundColor:bg-c/bgColor,backgroundOrigin:bg-o/bgOrigin,backgroundImage:bg-i/bgImage,backgroundRepeat:bg-r/bgRepeat,backgroundBlendMode:bg-bm/bgBlendMode,backgroundSize:bg-s/bgSize,backgroundGradient:bg-grad/bgGradient,backgroundLinear:bg-linear/bgLinear,backgroundRadial:bg-radial/bgRadial,backgroundConic:bg-conic/bgConic,textGradient:txt-grad,gradientFromPosition:grad-from-pos,gradientToPosition:grad-to-pos,gradientFrom:grad-from,gradientTo:grad-to,gradientVia:grad-via,gradientViaPosition:grad-via-pos,borderRadius:bdr/rounded,borderTopLeftRadius:bdr-tl/roundedTopLeft,borderTopRightRadius:bdr-tr/roundedTopRight,borderBottomRightRadius:bdr-br/roundedBottomRight,borderBottomLeftRadius:bdr-bl/roundedBottomLeft,borderTopRadius:bdr-t/roundedTop,borderRightRadius:bdr-r/roundedRight,borderBottomRadius:bdr-b/roundedBottom,borderLeftRadius:bdr-l/roundedLeft,borderStartStartRadius:bdr-ss/roundedStartStart,borderStartEndRadius:bdr-se/roundedStartEnd,borderStartRadius:bdr-s/roundedStart,borderEndStartRadius:bdr-es/roundedEndStart,borderEndEndRadius:bdr-ee/roundedEndEnd,borderEndRadius:bdr-e/roundedEnd,border:bd,borderWidth:bd-w,borderTopWidth:bd-t-w,borderLeftWidth:bd-l-w,borderRightWidth:bd-r-w,borderBottomWidth:bd-b-w,borderBlockStartWidth:bd-bs-w,borderBlockEndWidth:bd-be-w,borderColor:bd-c,borderInline:bd-x/borderX,borderInlineWidth:bd-x-w/borderXWidth,borderInlineColor:bd-x-c/borderXColor,borderBlock:bd-y/borderY,borderBlockWidth:bd-y-w/borderYWidth,borderBlockColor:bd-y-c/borderYColor,borderLeft:bd-l,borderLeftColor:bd-l-c,borderInlineStart:bd-s/borderStart,borderInlineStartWidth:bd-s-w/borderStartWidth,borderInlineStartColor:bd-s-c/borderStartColor,borderRight:bd-r,borderRightColor:bd-r-c,borderInlineEnd:bd-e/borderEnd,borderInlineEndWidth:bd-e-w/borderEndWidth,borderInlineEndColor:bd-e-c/borderEndColor,borderTop:bd-t,borderTopColor:bd-t-c,borderBottom:bd-b,borderBottomColor:bd-b-c,borderBlockEnd:bd-be,borderBlockEndColor:bd-be-c,borderBlockStart:bd-bs,borderBlockStartColor:bd-bs-c,opacity:op,boxShadow:bx-sh/shadow,boxShadowColor:bx-sh-c/shadowColor,mixBlendMode:mix-bm,filter:filter,brightness:brightness,contrast:contrast,grayscale:grayscale,hueRotate:hue-rotate,invert:invert,saturate:saturate,sepia:sepia,dropShadow:drop-shadow,blur:blur,backdropFilter:bkdp,backdropBlur:bkdp-blur,backdropBrightness:bkdp-brightness,backdropContrast:bkdp-contrast,backdropGrayscale:bkdp-grayscale,backdropHueRotate:bkdp-hue-rotate,backdropInvert:bkdp-invert,backdropOpacity:bkdp-opacity,backdropSaturate:bkdp-saturate,backdropSepia:bkdp-sepia,borderCollapse:bd-cl,borderSpacing:bd-sp,borderSpacingX:bd-sx,borderSpacingY:bd-sy,tableLayout:tbl,transitionTimingFunction:trs-tmf,transitionDelay:trs-dly,transitionDuration:trs-dur,transitionProperty:trs-prop,transition:trs,animation:anim,animationName:anim-n,animationTimingFunction:anim-tmf,animationDuration:anim-dur,animationDelay:anim-dly,animationPlayState:anim-ps,animationComposition:anim-comp,animationFillMode:anim-fm,animationDirection:anim-dir,animationIterationCount:anim-ic,animationRange:anim-r,animationState:anim-s,animationRangeStart:anim-rs,animationRangeEnd:anim-re,animationTimeline:anim-tl,transformOrigin:trf-o,transformBox:trf-b,transformStyle:trf-s,transform:trf,rotate:rotate,rotateX:rotate-x,rotateY:rotate-y,rotateZ:rotate-z,scale:scale,scaleX:scale-x,scaleY:scale-y,translate:translate,translateX:translate-x/x,translateY:translate-y/y,translateZ:translate-z/z,accentColor:ac-c,caretColor:ca-c,scrollBehavior:scr-bhv,scrollbar:scr-bar,scrollbarColor:scr-bar-c,scrollbarGutter:scr-bar-g,scrollbarWidth:scr-bar-w,scrollMargin:scr-m,scrollMarginLeft:scr-ml,scrollMarginRight:scr-mr,scrollMarginTop:scr-mt,scrollMarginBottom:scr-mb,scrollMarginBlock:scr-my/scrollMarginY,scrollMarginBlockEnd:scr-mbe,scrollMarginBlockStart:scr-mbt,scrollMarginInline:scr-mx/scrollMarginX,scrollMarginInlineEnd:scr-me,scrollMarginInlineStart:scr-ms,scrollPadding:scr-p,scrollPaddingBlock:scr-py/scrollPaddingY,scrollPaddingBlockStart:scr-pbs,scrollPaddingBlockEnd:scr-pbe,scrollPaddingInline:scr-px/scrollPaddingX,scrollPaddingInlineEnd:scr-pe,scrollPaddingInlineStart:scr-ps,scrollPaddingLeft:scr-pl,scrollPaddingRight:scr-pr,scrollPaddingTop:scr-pt,scrollPaddingBottom:scr-pb,scrollSnapAlign:scr-sa,scrollSnapStop:scrs-s,scrollSnapType:scrs-t,scrollSnapStrictness:scrs-strt,scrollSnapMargin:scrs-m,scrollSnapMarginTop:scrs-mt,scrollSnapMarginBottom:scrs-mb,scrollSnapMarginLeft:scrs-ml,scrollSnapMarginRight:scrs-mr,scrollSnapCoordinate:scrs-c,scrollSnapDestination:scrs-d,scrollSnapPointsX:scrs-px,scrollSnapPointsY:scrs-py,scrollSnapTypeX:scrs-tx,scrollSnapTypeY:scrs-ty,scrollTimeline:scrtl,scrollTimelineAxis:scrtl-a,scrollTimelineName:scrtl-n,touchAction:tch-a,userSelect:us,overflow:ov,overflowWrap:ov-wrap,overflowX:ov-x,overflowY:ov-y,overflowAnchor:ov-a,overflowBlock:ov-b,overflowInline:ov-i,overflowClipBox:ovcp-bx,overflowClipMargin:ovcp-m,overscrollBehaviorBlock:ovs-bb,overscrollBehaviorInline:ovs-bi,fill:fill,stroke:stk,strokeWidth:stk-w,strokeDasharray:stk-dsh,strokeDashoffset:stk-do,strokeLinecap:stk-lc,strokeLinejoin:stk-lj,strokeMiterlimit:stk-ml,strokeOpacity:stk-op,srOnly:sr,debug:debug,appearance:ap,backfaceVisibility:bfv,clipPath:cp-path,hyphens:hy,mask:msk,maskImage:msk-i,maskSize:msk-s,textSizeAdjust:txt-adj,container:cq,containerName:cq-n,containerType:cq-t,cursor:cursor,textStyle:textStyle";
273
+ var classNameByProp = /* @__PURE__ */ new Map();
274
+ var shorthands = /* @__PURE__ */ new Map();
275
+ utilities.split(",").forEach((utility) => {
276
+ const [prop, meta] = utility.split(":");
277
+ const [className, ...shorthandList] = meta.split("/");
278
+ classNameByProp.set(prop, className);
279
+ if (shorthandList.length) {
280
+ shorthandList.forEach((shorthand) => {
281
+ shorthands.set(shorthand === "1" ? className : shorthand, prop);
282
+ });
283
+ }
284
+ });
285
+ var resolveShorthand = (prop) => shorthands.get(prop) || prop;
286
+ var context = {
287
+ conditions: {
288
+ shift: sortConditions,
289
+ finalize: finalizeConditions,
290
+ breakpoints: { keys: ["base", "sm", "md", "lg", "xl", "2xl"] }
291
+ },
292
+ utility: {
293
+ transform: (prop, value) => {
294
+ const key = resolveShorthand(prop);
295
+ const propKey = classNameByProp.get(key) || hypenateProperty(key);
296
+ return { className: `${propKey}_${withoutSpace(value)}` };
297
+ },
298
+ hasShorthand: true,
299
+ toHash: (path, hashFn) => hashFn(path.join(":")),
300
+ resolveShorthand
301
+ }
302
+ };
303
+ var cssFn = createCss(context);
304
+ var css = (...styles) => cssFn(mergeCss(...styles));
305
+ css.raw = (...styles) => mergeCss(...styles);
306
+ var { mergeCss} = createMergeCss(context);
307
+
308
+ // styled-system/css/cx.mjs
309
+ function cx() {
310
+ let str = "", i = 0, arg;
311
+ for (; i < arguments.length; ) {
312
+ if ((arg = arguments[i++]) && typeof arg === "string") {
313
+ str && (str += " ");
314
+ str += arg;
315
+ }
316
+ }
317
+ return str;
318
+ }
319
+
320
+ // styled-system/css/cva.mjs
321
+ var defaults = (conf) => ({
322
+ base: {},
323
+ variants: {},
324
+ defaultVariants: {},
325
+ compoundVariants: [],
326
+ ...conf
327
+ });
328
+ function cva(config) {
329
+ const { base, variants, defaultVariants, compoundVariants } = defaults(config);
330
+ const getVariantProps = (variants2) => ({ ...defaultVariants, ...compact(variants2) });
331
+ function resolve(props = {}) {
332
+ const computedVariants = getVariantProps(props);
333
+ let variantCss = { ...base };
334
+ for (const [key, value] of Object.entries(computedVariants)) {
335
+ if (variants[key]?.[value]) {
336
+ variantCss = mergeCss(variantCss, variants[key][value]);
337
+ }
338
+ }
339
+ const compoundVariantCss = getCompoundVariantCss(compoundVariants, computedVariants);
340
+ return mergeCss(variantCss, compoundVariantCss);
341
+ }
342
+ function merge(__cva) {
343
+ const override = defaults(__cva.config);
344
+ const variantKeys2 = uniq(__cva.variantKeys, Object.keys(variants));
345
+ return cva({
346
+ base: mergeCss(base, override.base),
347
+ variants: Object.fromEntries(
348
+ variantKeys2.map((key) => [key, mergeCss(variants[key], override.variants[key])])
349
+ ),
350
+ defaultVariants: mergeProps(defaultVariants, override.defaultVariants),
351
+ compoundVariants: [...compoundVariants, ...override.compoundVariants]
352
+ });
353
+ }
354
+ function cvaFn(props) {
355
+ return css(resolve(props));
356
+ }
357
+ const variantKeys = Object.keys(variants);
358
+ function splitVariantProps(props) {
359
+ return splitProps(props, variantKeys);
360
+ }
361
+ const variantMap = Object.fromEntries(Object.entries(variants).map(([key, value]) => [key, Object.keys(value)]));
362
+ return Object.assign(memo(cvaFn), {
363
+ __cva__: true,
364
+ variantMap,
365
+ variantKeys,
366
+ raw: resolve,
367
+ config,
368
+ merge,
369
+ splitVariantProps,
370
+ getVariantProps
371
+ });
372
+ }
373
+ function getCompoundVariantCss(compoundVariants, variantMap) {
374
+ let result = {};
375
+ compoundVariants.forEach((compoundVariant) => {
376
+ const isMatching = Object.entries(compoundVariant).every(([key, value]) => {
377
+ if (key === "css") return true;
378
+ const values = Array.isArray(value) ? value : [value];
379
+ return values.some((value2) => variantMap[key] === value2);
380
+ });
381
+ if (isMatching) {
382
+ result = mergeCss(result, compoundVariant.css);
383
+ }
384
+ });
385
+ return result;
386
+ }
387
+
388
+ // styled-system/css/sva.mjs
389
+ function sva(config) {
390
+ const slots = Object.entries(getSlotRecipes(config)).map(([slot, slotCva]) => [slot, cva(slotCva)]);
391
+ const defaultVariants = config.defaultVariants ?? {};
392
+ const classNameMap = slots.reduce((acc, [slot, cvaFn]) => {
393
+ if (config.className) acc[slot] = cvaFn.config.className;
394
+ return acc;
395
+ }, {});
396
+ function svaFn(props) {
397
+ const result = slots.map(([slot, cvaFn]) => [slot, cx(cvaFn(props), classNameMap[slot])]);
398
+ return Object.fromEntries(result);
399
+ }
400
+ function raw(props) {
401
+ const result = slots.map(([slot, cvaFn]) => [slot, cvaFn.raw(props)]);
402
+ return Object.fromEntries(result);
403
+ }
404
+ const variants = config.variants ?? {};
405
+ const variantKeys = Object.keys(variants);
406
+ function splitVariantProps(props) {
407
+ return splitProps(props, variantKeys);
408
+ }
409
+ const getVariantProps = (variants2) => ({ ...defaultVariants, ...compact(variants2) });
410
+ const variantMap = Object.fromEntries(
411
+ Object.entries(variants).map(([key, value]) => [key, Object.keys(value)])
412
+ );
413
+ return Object.assign(memo(svaFn), {
414
+ __cva__: false,
415
+ raw,
416
+ config,
417
+ variantMap,
418
+ variantKeys,
419
+ classNameMap,
420
+ splitVariantProps,
421
+ getVariantProps
422
+ });
423
+ }
424
+
425
+ // src/entities/editor-core/model/theme-contract.ts
426
+ var CHAEDITOR_THEME_VARIABLES = {
427
+ overlayBackdrop: "--chaeditor-color-overlay-backdrop",
428
+ primaryHover: "--chaeditor-color-primary-hover"};
429
+ var CHAEDITOR_THEME_DEFAULTS = {
430
+ light: {
431
+ overlayBackdrop: "rgb(15 23 42 / 0.86)"}
432
+ };
433
+
434
+ // src/shared/ui/styles/primitive-theme.ts
435
+ var focusVisibleRingStyles = {
436
+ outlineColor: "focusRing",
437
+ outlineOffset: "[2px]",
438
+ outlineStyle: "solid",
439
+ outlineWidth: "[2px]"
440
+ };
441
+ var disabledFieldStyles = {
442
+ cursor: "not-allowed",
443
+ opacity: 0.56
444
+ };
445
+ var disabledButtonStyles = {
446
+ cursor: "not-allowed",
447
+ opacity: 0.48,
448
+ pointerEvents: "none"
449
+ };
450
+ var primaryHoverBackground = `[var(${CHAEDITOR_THEME_VARIABLES.primaryHover},var(--colors-primary))]`;
451
+ var overlayBackdropColor = `[var(${CHAEDITOR_THEME_VARIABLES.overlayBackdrop},${CHAEDITOR_THEME_DEFAULTS.light.overlayBackdrop})]`;
452
+ var overlayBackdropStyleValue = `var(${CHAEDITOR_THEME_VARIABLES.overlayBackdrop},${CHAEDITOR_THEME_DEFAULTS.light.overlayBackdrop})`;
453
+ var buttonRecipe = sva({
454
+ slots: ["root", "label", "visual"],
455
+ base: {
456
+ root: {
457
+ appearance: "none",
458
+ display: "inline-flex",
459
+ alignItems: "center",
460
+ justifyContent: "center",
461
+ gap: "2",
462
+ userSelect: "none",
463
+ cursor: "pointer",
464
+ transition: "colors",
465
+ letterSpacing: "[-0.01em]",
466
+ _focusVisible: {
467
+ ...focusVisibleRingStyles
468
+ },
469
+ _disabled: disabledButtonStyles,
470
+ '&[aria-disabled="true"]': {
471
+ ...disabledButtonStyles
472
+ }
473
+ },
474
+ label: {
475
+ display: "inline-flex",
476
+ alignItems: "center",
477
+ minWidth: "0"
478
+ },
479
+ visual: {
480
+ display: "inline-flex",
481
+ alignItems: "center",
482
+ justifyContent: "center",
483
+ flex: "none"
484
+ }
485
+ },
486
+ variants: {
487
+ fullWidth: {
488
+ true: { root: { width: "full" } },
489
+ false: { root: { width: "auto" } }
490
+ },
491
+ size: {
492
+ xs: { root: { fontSize: "xs" } },
493
+ sm: { root: { fontSize: "sm" } },
494
+ md: { root: { fontSize: "sm" } }
495
+ },
496
+ variant: {
497
+ solid: {
498
+ root: {
499
+ borderStyle: "solid",
500
+ borderWidth: "1px",
501
+ borderRadius: "full"
502
+ }
503
+ },
504
+ ghost: {
505
+ root: {
506
+ borderStyle: "solid",
507
+ borderWidth: "1px",
508
+ borderRadius: "full",
509
+ background: "transparent"
510
+ }
511
+ },
512
+ underline: {
513
+ root: {
514
+ minHeight: "auto",
515
+ p: "0",
516
+ textDecoration: "underline",
517
+ textUnderlineOffset: "[0.18em]"
518
+ }
519
+ }
520
+ },
521
+ tone: {
522
+ white: {},
523
+ primary: {},
524
+ black: {}
525
+ }
526
+ },
527
+ compoundVariants: [
528
+ /* Layout rules for the solid and ghost variants. */
529
+ {
530
+ variant: ["solid", "ghost"],
531
+ size: "xs",
532
+ css: { root: { minHeight: "8", px: "2" } }
533
+ },
534
+ {
535
+ variant: ["solid", "ghost"],
536
+ size: "sm",
537
+ css: { root: { minHeight: "[2.375rem]", px: "3" } }
538
+ },
539
+ {
540
+ variant: ["solid", "ghost"],
541
+ size: "md",
542
+ css: { root: { minHeight: "[2.75rem]", px: "4" } }
543
+ },
544
+ /* Colors for the solid variant. */
545
+ {
546
+ tone: "white",
547
+ variant: "solid",
548
+ css: {
549
+ root: {
550
+ background: "surface",
551
+ borderColor: "border",
552
+ color: "text",
553
+ _hover: { borderColor: "borderStrong" }
554
+ }
555
+ }
556
+ },
557
+ {
558
+ tone: "primary",
559
+ variant: "solid",
560
+ css: {
561
+ root: {
562
+ background: "primary",
563
+ color: "primaryContrast",
564
+ borderColor: "transparent",
565
+ _hover: { background: primaryHoverBackground }
566
+ }
567
+ }
568
+ },
569
+ {
570
+ tone: "black",
571
+ variant: "solid",
572
+ css: {
573
+ root: {
574
+ background: "text",
575
+ color: "surface",
576
+ borderColor: "transparent"
577
+ }
578
+ }
579
+ },
580
+ /* Colors for the ghost and underline variants. */
581
+ {
582
+ tone: "white",
583
+ variant: ["ghost", "underline"],
584
+ css: { root: { color: "text", borderColor: "transparent" } }
585
+ },
586
+ {
587
+ tone: "primary",
588
+ variant: ["ghost", "underline"],
589
+ css: { root: { color: "primary", borderColor: "transparent" } }
590
+ },
591
+ {
592
+ tone: "black",
593
+ variant: ["ghost", "underline"],
594
+ css: { root: { color: "text", borderColor: "transparent" } }
595
+ }
596
+ ],
597
+ defaultVariants: {
598
+ fullWidth: false,
599
+ size: "md",
600
+ tone: "white",
601
+ variant: "solid"
602
+ }
603
+ });
604
+ var Button = React.forwardRef(
605
+ ({
606
+ asChild = false,
607
+ children,
608
+ className,
609
+ fullWidth,
610
+ labelClassName,
611
+ leadingVisual,
612
+ leadingVisualClassName,
613
+ size,
614
+ tone,
615
+ trailingVisual,
616
+ trailingVisualClassName,
617
+ type = "button",
618
+ variant,
619
+ ...props
620
+ }, ref) => {
621
+ const styles = buttonRecipe({ fullWidth, size, tone, variant });
622
+ const isDisabled = props.disabled || props["aria-disabled"] === "true";
623
+ const renderContent = (labelContent) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
624
+ leadingVisual && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: cx(styles.visual, leadingVisualClassName), children: leadingVisual }),
625
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cx(styles.label, labelClassName), children: labelContent }),
626
+ trailingVisual && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: cx(styles.visual, trailingVisualClassName), children: trailingVisual })
627
+ ] });
628
+ if (asChild) {
629
+ if (!React__default.default.isValidElement(children)) {
630
+ throw new Error("Button with asChild requires a single React element child.");
631
+ }
632
+ const child = children;
633
+ const isNativeButtonElement = typeof child.type === "string" && child.type === "button";
634
+ const nextProps = {
635
+ ...props,
636
+ className: cx(styles.root, className, child.props.className),
637
+ children: renderContent(child.props.children)
638
+ };
639
+ if (isNativeButtonElement) {
640
+ nextProps.type = type;
641
+ }
642
+ if (isDisabled && !isNativeButtonElement) {
643
+ delete nextProps.disabled;
644
+ nextProps["aria-disabled"] = "true";
645
+ nextProps.tabIndex = -1;
646
+ nextProps.onClick = (event) => {
647
+ event.preventDefault();
648
+ event.stopPropagation();
649
+ };
650
+ }
651
+ return React__default.default.cloneElement(child, nextProps);
652
+ }
653
+ return /* @__PURE__ */ jsxRuntime.jsx(
654
+ "button",
655
+ {
656
+ ...props,
657
+ ref,
658
+ className: cx(styles.root, className),
659
+ type,
660
+ disabled: props.disabled,
661
+ children: renderContent(children)
662
+ }
663
+ );
664
+ }
665
+ );
666
+ Button.displayName = "Button";
667
+ var Input = React__default.default.forwardRef(
668
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("input", { ...props, className: cx(inputRecipe(), className), ref })
669
+ );
670
+ Input.displayName = "Input";
671
+ var inputRecipe = cva({
672
+ base: {
673
+ width: "full",
674
+ minHeight: "[2.75rem]",
675
+ px: "3",
676
+ py: "2",
677
+ borderRadius: "md",
678
+ borderWidth: "1px",
679
+ borderStyle: "solid",
680
+ borderColor: "border",
681
+ backgroundColor: "transparent",
682
+ color: "text",
683
+ transition: "colors",
684
+ _placeholder: {
685
+ color: "muted"
686
+ },
687
+ _hover: {
688
+ borderColor: "borderStrong"
689
+ },
690
+ _focusVisible: {
691
+ ...focusVisibleRingStyles,
692
+ borderColor: "primary"
693
+ },
694
+ _disabled: disabledFieldStyles
695
+ }
696
+ });
697
+
698
+ // src/shared/lib/a11y/get-focusable-elements.ts
699
+ var FOCUSABLE_SELECTOR = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
700
+ var getFocusableElements = (container) => Array.from(container.querySelectorAll(FOCUSABLE_SELECTOR)).filter(
701
+ (element) => !element.hasAttribute("hidden") && element.getAttribute("aria-hidden") !== "true"
702
+ );
703
+
704
+ // src/shared/lib/react/use-dialog-focus-management.ts
705
+ var useDialogFocusManagement = ({
706
+ containerRef,
707
+ initialFocusRef,
708
+ isEnabled,
709
+ onEscape,
710
+ restoreFocusRef
711
+ }) => {
712
+ const previousActiveElementRef = React.useRef(null);
713
+ const onEscapeRef = React.useRef(onEscape);
714
+ React.useEffect(() => {
715
+ onEscapeRef.current = onEscape;
716
+ }, [onEscape]);
717
+ React.useEffect(() => {
718
+ if (!isEnabled) return;
719
+ previousActiveElementRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
720
+ const requestFocus = () => {
721
+ const container = containerRef.current;
722
+ if (!container) return;
723
+ const fallbackTarget = initialFocusRef?.current ?? getFocusableElements(container)[0] ?? container;
724
+ fallbackTarget.focus();
725
+ };
726
+ const rafId = window.requestAnimationFrame(requestFocus);
727
+ const handleKeydown = (event) => {
728
+ if (event.key === "Escape") {
729
+ event.preventDefault();
730
+ event.stopPropagation();
731
+ onEscapeRef.current();
732
+ return;
733
+ }
734
+ if (event.key !== "Tab") return;
735
+ const container = containerRef.current;
736
+ if (!container) return;
737
+ const focusableElements = getFocusableElements(container);
738
+ if (focusableElements.length === 0) {
739
+ event.preventDefault();
740
+ container.focus();
741
+ return;
742
+ }
743
+ const activeElement = document.activeElement;
744
+ const activeIndex = activeElement ? focusableElements.indexOf(activeElement) : -1;
745
+ if (event.shiftKey && (activeIndex <= 0 || activeIndex === -1)) {
746
+ event.preventDefault();
747
+ focusableElements[focusableElements.length - 1]?.focus();
748
+ return;
749
+ }
750
+ if (!event.shiftKey && (activeIndex === -1 || activeIndex === focusableElements.length - 1)) {
751
+ event.preventDefault();
752
+ focusableElements[0]?.focus();
753
+ }
754
+ };
755
+ window.addEventListener("keydown", handleKeydown);
756
+ return () => {
757
+ window.cancelAnimationFrame(rafId);
758
+ window.removeEventListener("keydown", handleKeydown);
759
+ if (restoreFocusRef?.current !== false) {
760
+ previousActiveElementRef.current?.focus();
761
+ }
762
+ if (restoreFocusRef) {
763
+ restoreFocusRef.current = true;
764
+ }
765
+ };
766
+ }, [containerRef, initialFocusRef, isEnabled, restoreFocusRef]);
767
+ };
768
+ var XButton = React__default.default.forwardRef(
769
+ ({
770
+ ariaLabel,
771
+ className,
772
+ glyphClassName,
773
+ size = "sm",
774
+ tone = "black",
775
+ type = "button",
776
+ variant = "ghost",
777
+ ...props
778
+ }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
779
+ Button,
780
+ {
781
+ "aria-label": ariaLabel,
782
+ className,
783
+ ref,
784
+ size,
785
+ tone,
786
+ type,
787
+ variant,
788
+ ...props,
789
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: cx(glyphClass, glyphClassName), children: "+" })
790
+ }
791
+ )
792
+ );
793
+ XButton.displayName = "XButton";
794
+ var glyphClass = css({
795
+ display: "inline-block",
796
+ fontSize: "3xl",
797
+ lineHeight: "none",
798
+ transform: "rotate(45deg)"
799
+ });
800
+ var Modal = ({
801
+ ariaDescribedBy,
802
+ ariaLabel,
803
+ ariaLabelledBy,
804
+ backdropClassName,
805
+ children,
806
+ closeAriaLabel,
807
+ closeButtonClassName,
808
+ frameClassName,
809
+ initialFocusRef,
810
+ isOpen,
811
+ onClose
812
+ }) => {
813
+ const [isMounted, setIsMounted] = React.useState(false);
814
+ const frameRef = React.useRef(null);
815
+ React.useEffect(() => {
816
+ setIsMounted(true);
817
+ }, []);
818
+ React.useEffect(() => {
819
+ if (!isOpen || !isMounted) return;
820
+ const bodyOverflow = document.body.style.overflow;
821
+ document.body.style.overflow = "hidden";
822
+ return () => {
823
+ document.body.style.overflow = bodyOverflow;
824
+ };
825
+ }, [isMounted, isOpen]);
826
+ useDialogFocusManagement({
827
+ containerRef: frameRef,
828
+ initialFocusRef,
829
+ isEnabled: isOpen && isMounted,
830
+ onEscape: onClose
831
+ });
832
+ if (!isMounted || !isOpen) return null;
833
+ return reactDom.createPortal(
834
+ /* @__PURE__ */ jsxRuntime.jsx(
835
+ "div",
836
+ {
837
+ onClick: (event) => {
838
+ if (event.target === event.currentTarget) onClose();
839
+ },
840
+ className: cx(backdropClass, backdropClassName),
841
+ style: { background: overlayBackdropStyleValue },
842
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
843
+ "div",
844
+ {
845
+ "aria-describedby": ariaDescribedBy,
846
+ "aria-label": ariaLabel,
847
+ "aria-labelledby": ariaLabelledBy,
848
+ "aria-modal": "true",
849
+ ref: frameRef,
850
+ role: "dialog",
851
+ tabIndex: -1,
852
+ className: cx(frameBaseClass, frameClassName),
853
+ children: [
854
+ /* @__PURE__ */ jsxRuntime.jsx(
855
+ XButton,
856
+ {
857
+ ariaLabel: closeAriaLabel,
858
+ className: cx(closeButtonClass, closeButtonClassName),
859
+ onClick: onClose
860
+ }
861
+ ),
862
+ children
863
+ ]
864
+ }
865
+ )
866
+ }
867
+ ),
868
+ document.body
869
+ );
870
+ };
871
+ var backdropClass = css({
872
+ position: "fixed",
873
+ inset: "0",
874
+ zIndex: "1200",
875
+ backgroundColor: overlayBackdropColor,
876
+ p: "4",
877
+ display: "grid",
878
+ placeItems: "center",
879
+ overflow: "hidden"
880
+ });
881
+ var frameBaseClass = css({
882
+ position: "relative",
883
+ borderRadius: "3xl",
884
+ maxWidth: "full",
885
+ display: "flex",
886
+ flexDirection: "column",
887
+ maxHeight: "full",
888
+ minWidth: "0",
889
+ minHeight: "0",
890
+ overflow: "hidden"
891
+ });
892
+ var closeButtonClass = css({
893
+ position: "absolute",
894
+ top: "[0.6rem]",
895
+ right: "[0.5rem]",
896
+ zIndex: "10",
897
+ lineHeight: "none"
898
+ });
899
+
900
+ // src/shared/ui/styles/sr-only-style.ts
901
+ var srOnlyClass = css({
902
+ srOnly: true
903
+ });
904
+ var Tooltip = ({
905
+ children,
906
+ className,
907
+ content,
908
+ contentClassName,
909
+ forceOpen = false,
910
+ openOnFocus = true,
911
+ portalClassName,
912
+ preferredPlacement = "top"
913
+ }) => {
914
+ const [isFocused, setIsFocused] = React.useState(false);
915
+ const [isHovering, setIsHovering] = React.useState(false);
916
+ const [tooltipStyle, setTooltipStyle] = React.useState();
917
+ const rootRef = React.useRef(null);
918
+ const tooltipId = React.useId();
919
+ const isOpen = forceOpen || isHovering || openOnFocus && isFocused;
920
+ if (!React.isValidElement(children)) {
921
+ throw new Error("Tooltip requires a single React element child.");
922
+ }
923
+ const triggerElement = children;
924
+ const childProps = triggerElement.props;
925
+ const describedBy = [childProps["aria-describedby"], isOpen ? tooltipId : null].filter(Boolean).join(" ");
926
+ React.useLayoutEffect(() => {
927
+ if (!isOpen) {
928
+ setTooltipStyle(void 0);
929
+ return;
930
+ }
931
+ const updateTooltipPosition = () => {
932
+ if (!rootRef.current) return;
933
+ const triggerRect = rootRef.current.getBoundingClientRect();
934
+ const availableSpaceAbove = triggerRect.top;
935
+ const availableSpaceBelow = window.innerHeight - triggerRect.bottom;
936
+ const shouldPlaceBelow = preferredPlacement === "bottom" ? true : preferredPlacement === "top" ? false : availableSpaceAbove < 40 && availableSpaceBelow >= availableSpaceAbove;
937
+ setTooltipStyle({
938
+ left: triggerRect.left + triggerRect.width / 2,
939
+ position: "fixed",
940
+ top: shouldPlaceBelow ? triggerRect.bottom + 8 : triggerRect.top - 8,
941
+ transform: shouldPlaceBelow ? "translate(-50%, 0)" : "translate(-50%, -100%)"
942
+ });
943
+ };
944
+ updateTooltipPosition();
945
+ window.addEventListener("resize", updateTooltipPosition);
946
+ window.addEventListener("scroll", updateTooltipPosition, true);
947
+ return () => {
948
+ window.removeEventListener("resize", updateTooltipPosition);
949
+ window.removeEventListener("scroll", updateTooltipPosition, true);
950
+ };
951
+ }, [isOpen, preferredPlacement]);
952
+ return /* @__PURE__ */ jsxRuntime.jsxs(
953
+ "span",
954
+ {
955
+ className: cx(rootClass, className),
956
+ ref: rootRef,
957
+ onBlurCapture: () => {
958
+ if (!openOnFocus) return;
959
+ setIsFocused(false);
960
+ },
961
+ onFocusCapture: () => {
962
+ if (!openOnFocus) return;
963
+ setIsFocused(true);
964
+ },
965
+ onMouseEnter: () => setIsHovering(true),
966
+ onMouseLeave: () => setIsHovering(false),
967
+ children: [
968
+ React.cloneElement(triggerElement, {
969
+ "aria-describedby": describedBy || void 0
970
+ }),
971
+ isOpen ? reactDom.createPortal(
972
+ /* @__PURE__ */ jsxRuntime.jsx(
973
+ "span",
974
+ {
975
+ className: cx(tooltipPortalClass, portalClassName),
976
+ id: tooltipId,
977
+ role: "tooltip",
978
+ style: {
979
+ ...tooltipStyle,
980
+ visibility: tooltipStyle ? "visible" : "hidden"
981
+ },
982
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: cx(tooltipClass, contentClassName), children: content })
983
+ }
984
+ ),
985
+ document.body
986
+ ) : null
987
+ ]
988
+ }
989
+ );
990
+ };
991
+ var rootClass = css({
992
+ display: "inline-flex",
993
+ flex: "none"
994
+ });
995
+ var tooltipClass = css({
996
+ px: "2",
997
+ py: "1",
998
+ borderRadius: "md",
999
+ backgroundColor: "[rgba(15,23,42,0.92)]",
1000
+ color: "white",
1001
+ borderWidth: "1px",
1002
+ borderStyle: "solid",
1003
+ borderColor: "[rgba(255,255,255,0.08)]",
1004
+ fontSize: "xs",
1005
+ lineHeight: "tight",
1006
+ whiteSpace: "nowrap",
1007
+ boxShadow: "[0_12px_28px_rgba(15,23,42,0.28)]"
1008
+ });
1009
+ var tooltipPortalClass = css({
1010
+ zIndex: "[9999]",
1011
+ pointerEvents: "none"
1012
+ });
1013
+ var Popover = ({
1014
+ children,
1015
+ isOpen: controlledIsOpen,
1016
+ label,
1017
+ onOpenChange,
1018
+ onTriggerMouseDown,
1019
+ panelClassName,
1020
+ panelLabel,
1021
+ portalPlacement = "end",
1022
+ renderInPortal = false,
1023
+ rootClassName,
1024
+ triggerAriaLabel,
1025
+ triggerClassName,
1026
+ triggerContent,
1027
+ triggerLabelClassName,
1028
+ triggerSize = "sm",
1029
+ triggerTone = "white",
1030
+ triggerTooltip,
1031
+ triggerValueClassName,
1032
+ triggerVariant = "ghost",
1033
+ value
1034
+ }) => {
1035
+ const [uncontrolledIsOpen, setUncontrolledIsOpen] = React.useState(false);
1036
+ const isControlled = typeof controlledIsOpen === "boolean";
1037
+ const isOpen = isControlled ? controlledIsOpen : uncontrolledIsOpen;
1038
+ const rootRef = React.useRef(null);
1039
+ const triggerRef = React.useRef(null);
1040
+ const panelRef = React.useRef(null);
1041
+ const restoreFocusRef = React.useRef(true);
1042
+ const [portalStyle, setPortalStyle] = React.useState();
1043
+ const panelId = React.useId();
1044
+ const panelLabelId = React.useId();
1045
+ const triggerLabelId = React.useId();
1046
+ const valueId = React.useId();
1047
+ const resolvedTriggerLabel = triggerAriaLabel ?? panelLabel;
1048
+ const usesSharedLabel = resolvedTriggerLabel === panelLabel;
1049
+ const setOpen = React.useCallback(
1050
+ (nextOpen) => {
1051
+ if (!isControlled) {
1052
+ setUncontrolledIsOpen(nextOpen);
1053
+ }
1054
+ onOpenChange?.(nextOpen);
1055
+ },
1056
+ [isControlled, onOpenChange]
1057
+ );
1058
+ React.useEffect(() => {
1059
+ if (!isOpen) return;
1060
+ const handleOutsideInteraction = (event) => {
1061
+ const eventTarget = event.target;
1062
+ if (!rootRef.current?.contains(eventTarget) && !panelRef.current?.contains(eventTarget)) {
1063
+ setOpen(false);
1064
+ }
1065
+ };
1066
+ window.addEventListener("click", handleOutsideInteraction);
1067
+ window.addEventListener("pointerdown", handleOutsideInteraction);
1068
+ return () => {
1069
+ window.removeEventListener("click", handleOutsideInteraction);
1070
+ window.removeEventListener("pointerdown", handleOutsideInteraction);
1071
+ };
1072
+ }, [isOpen, setOpen]);
1073
+ React.useLayoutEffect(() => {
1074
+ if (!isOpen || !renderInPortal) return;
1075
+ const updatePortalPosition = () => {
1076
+ if (!triggerRef.current) return;
1077
+ const triggerRect = triggerRef.current.getBoundingClientRect();
1078
+ const baseTop = triggerRect.bottom + 9;
1079
+ if (portalPlacement === "start") {
1080
+ setPortalStyle({
1081
+ left: triggerRect.left,
1082
+ position: "fixed",
1083
+ top: baseTop
1084
+ });
1085
+ return;
1086
+ }
1087
+ setPortalStyle({
1088
+ position: "fixed",
1089
+ right: Math.max(window.innerWidth - triggerRect.right, 0),
1090
+ top: baseTop
1091
+ });
1092
+ };
1093
+ updatePortalPosition();
1094
+ window.addEventListener("resize", updatePortalPosition);
1095
+ window.addEventListener("scroll", updatePortalPosition, true);
1096
+ return () => {
1097
+ window.removeEventListener("resize", updatePortalPosition);
1098
+ window.removeEventListener("scroll", updatePortalPosition, true);
1099
+ };
1100
+ }, [isOpen, portalPlacement, renderInPortal]);
1101
+ useDialogFocusManagement({
1102
+ containerRef: panelRef,
1103
+ initialFocusRef: void 0,
1104
+ isEnabled: isOpen,
1105
+ onEscape: () => {
1106
+ setOpen(false);
1107
+ },
1108
+ restoreFocusRef
1109
+ });
1110
+ const closePopover = (options) => {
1111
+ restoreFocusRef.current = options?.restoreFocus ?? true;
1112
+ setOpen(false);
1113
+ };
1114
+ const triggerButton = /* @__PURE__ */ jsxRuntime.jsx(
1115
+ Button,
1116
+ {
1117
+ "aria-controls": isOpen ? panelId : void 0,
1118
+ "aria-describedby": !triggerContent && value ? valueId : void 0,
1119
+ "aria-expanded": isOpen,
1120
+ "aria-haspopup": "dialog",
1121
+ "aria-labelledby": usesSharedLabel ? panelLabelId : triggerLabelId,
1122
+ className: cx(triggerButtonClass, triggerClassName),
1123
+ onClick: () => setOpen(!isOpen),
1124
+ onMouseDown: onTriggerMouseDown,
1125
+ ref: triggerRef,
1126
+ size: triggerSize,
1127
+ tone: triggerTone,
1128
+ type: "button",
1129
+ variant: triggerVariant,
1130
+ children: triggerContent ? triggerContent : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1131
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cx(triggerLabelClass, triggerLabelClassName), children: label }),
1132
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cx(triggerValueClass, triggerValueClassName), id: valueId, children: value })
1133
+ ] })
1134
+ }
1135
+ );
1136
+ const panel = isOpen ? /* @__PURE__ */ jsxRuntime.jsx(
1137
+ "div",
1138
+ {
1139
+ "aria-labelledby": panelLabelId,
1140
+ className: cx(panelClass, renderInPortal ? portaledPanelClass : void 0, panelClassName),
1141
+ id: panelId,
1142
+ ref: panelRef,
1143
+ role: "dialog",
1144
+ style: renderInPortal ? portalStyle : void 0,
1145
+ tabIndex: -1,
1146
+ children: typeof children === "function" ? children({ closePopover }) : children
1147
+ }
1148
+ ) : null;
1149
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cx(rootClass2, rootClassName), ref: rootRef, children: [
1150
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: srOnlyClass, id: panelLabelId, children: panelLabel }),
1151
+ !usesSharedLabel ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: srOnlyClass, id: triggerLabelId, children: resolvedTriggerLabel }) : null,
1152
+ triggerTooltip ? /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { content: triggerTooltip, children: triggerButton }) : triggerButton,
1153
+ renderInPortal && panel ? reactDom.createPortal(panel, document.body) : panel
1154
+ ] });
1155
+ };
1156
+ var rootClass2 = css({
1157
+ position: "relative"
1158
+ });
1159
+ var triggerButtonClass = css({
1160
+ _hover: {
1161
+ color: "primary"
1162
+ },
1163
+ _focusVisible: {
1164
+ ...focusVisibleRingStyles,
1165
+ color: "primary"
1166
+ }
1167
+ });
1168
+ var triggerLabelClass = css({
1169
+ fontSize: "xs",
1170
+ fontWeight: "bold",
1171
+ letterSpacing: "[0.12em]",
1172
+ textTransform: "uppercase",
1173
+ color: "muted"
1174
+ });
1175
+ var triggerValueClass = css({
1176
+ fontSize: "sm",
1177
+ color: "text"
1178
+ });
1179
+ var panelClass = css({
1180
+ position: "absolute",
1181
+ top: "[calc(100% + 0.55rem)]",
1182
+ right: "0",
1183
+ minWidth: "48",
1184
+ p: "2",
1185
+ borderRadius: "2xl",
1186
+ border: "[1px solid var(--colors-border)]",
1187
+ backgroundColor: "surface",
1188
+ boxShadow: "floating",
1189
+ display: "grid",
1190
+ gap: "1",
1191
+ zIndex: "30"
1192
+ });
1193
+ var portaledPanelClass = css({
1194
+ top: "[auto]",
1195
+ right: "[auto]"
1196
+ });
1197
+ var resizeTextarea = (element) => {
1198
+ element.style.height = "0px";
1199
+ element.style.height = `${element.scrollHeight}px`;
1200
+ };
1201
+ var Textarea = React__default.default.forwardRef(
1202
+ ({ autoResize = true, className, onChange, rows = 1, style, ...props }, ref) => {
1203
+ const innerRef = React.useRef(null);
1204
+ React.useLayoutEffect(() => {
1205
+ if (!autoResize || !innerRef.current) return;
1206
+ resizeTextarea(innerRef.current);
1207
+ }, [autoResize, props.value]);
1208
+ const handleRef = (node) => {
1209
+ innerRef.current = node;
1210
+ if (!ref) return;
1211
+ if (typeof ref === "function") {
1212
+ ref(node);
1213
+ return;
1214
+ }
1215
+ ref.current = node;
1216
+ };
1217
+ const handleChange = (event) => {
1218
+ if (autoResize) {
1219
+ resizeTextarea(event.currentTarget);
1220
+ }
1221
+ onChange?.(event);
1222
+ };
1223
+ return /* @__PURE__ */ jsxRuntime.jsx(
1224
+ "textarea",
1225
+ {
1226
+ ...props,
1227
+ className: cx(textareaRecipe({ autoResize }), className),
1228
+ onChange: handleChange,
1229
+ ref: handleRef,
1230
+ rows,
1231
+ style
1232
+ }
1233
+ );
1234
+ }
1235
+ );
1236
+ Textarea.displayName = "Textarea";
1237
+ var textareaRecipe = cva({
1238
+ base: {
1239
+ width: "full",
1240
+ px: "3",
1241
+ py: "2",
1242
+ borderRadius: "md",
1243
+ borderWidth: "1px",
1244
+ borderStyle: "solid",
1245
+ borderColor: "border",
1246
+ backgroundColor: "transparent",
1247
+ color: "text",
1248
+ resize: "vertical",
1249
+ transition: "colors",
1250
+ _placeholder: {
1251
+ color: "muted"
1252
+ },
1253
+ _hover: {
1254
+ borderColor: "borderStrong"
1255
+ },
1256
+ _focusVisible: {
1257
+ ...focusVisibleRingStyles,
1258
+ borderColor: "primary"
1259
+ },
1260
+ _disabled: disabledFieldStyles,
1261
+ '&[aria-disabled="true"]': {
1262
+ ...disabledFieldStyles
1263
+ }
1264
+ },
1265
+ variants: {
1266
+ autoResize: {
1267
+ true: {
1268
+ resize: "none",
1269
+ overflow: "hidden"
1270
+ },
1271
+ false: {}
1272
+ }
1273
+ },
1274
+ defaultVariants: {
1275
+ autoResize: true
1276
+ }
1277
+ });
1278
+
1279
+ // src/shared/ui/primitive-registry/default-markdown-primitive-registry.ts
1280
+ var defaultMarkdownPrimitiveRegistry = {
1281
+ Button,
1282
+ Input,
1283
+ Modal,
1284
+ Popover,
1285
+ Textarea,
1286
+ Tooltip
1287
+ };
1288
+ var createDefaultMarkdownPrimitiveRegistry = () => defaultMarkdownPrimitiveRegistry;
1289
+ var createPandaMarkdownPrimitiveRegistry = () => defaultMarkdownPrimitiveRegistry;
1290
+
1291
+ exports.Button = Button;
1292
+ exports.Input = Input;
1293
+ exports.Modal = Modal;
1294
+ exports.Popover = Popover;
1295
+ exports.Textarea = Textarea;
1296
+ exports.Tooltip = Tooltip;
1297
+ exports.buttonRecipe = buttonRecipe;
1298
+ exports.createDefaultMarkdownPrimitiveRegistry = createDefaultMarkdownPrimitiveRegistry;
1299
+ exports.createPandaMarkdownPrimitiveRegistry = createPandaMarkdownPrimitiveRegistry;