@sesionario/blocks 1.3.1 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var React5 = require('react');
4
+ var React6 = require('react');
5
5
  var lucideReact = require('lucide-react');
6
6
  var clsx = require('clsx');
7
7
  var tailwindMerge = require('tailwind-merge');
@@ -43,7 +43,7 @@ function _interopNamespace(e) {
43
43
  return Object.freeze(n);
44
44
  }
45
45
 
46
- var React5__namespace = /*#__PURE__*/_interopNamespace(React5);
46
+ var React6__namespace = /*#__PURE__*/_interopNamespace(React6);
47
47
  var AlertDialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(AlertDialogPrimitive);
48
48
  var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
49
49
  var SliderPrimitive__namespace = /*#__PURE__*/_interopNamespace(SliderPrimitive);
@@ -54,9 +54,9 @@ var RPNInput__namespace = /*#__PURE__*/_interopNamespace(RPNInput);
54
54
  var flags__default = /*#__PURE__*/_interopDefault(flags);
55
55
  var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
56
56
 
57
- var LanguageContext = React5.createContext(null);
57
+ var LanguageContext = React6.createContext(null);
58
58
  function useLanguageContext() {
59
- return React5.useContext(LanguageContext);
59
+ return React6.useContext(LanguageContext);
60
60
  }
61
61
  function cn(...inputs) {
62
62
  return tailwindMerge.twMerge(clsx.clsx(inputs));
@@ -609,18 +609,18 @@ function ThemeSwitcher({
609
609
  labels: userLabels
610
610
  }) {
611
611
  const { theme, setTheme } = nextThemes.useTheme();
612
- const [mounted, setMounted] = React5.useState(false);
612
+ const [mounted, setMounted] = React6.useState(false);
613
613
  const reduceMotion = framerMotion.useReducedMotion();
614
614
  const sizes = sizeClasses[size];
615
615
  const shapeClass = shapeClasses[shape];
616
616
  const labels = { ...defaultLabels, ...userLabels };
617
- const handleThemeClick = React5.useCallback(
617
+ const handleThemeClick = React6.useCallback(
618
618
  (themeKey) => {
619
619
  setTheme(themeKey);
620
620
  },
621
621
  [setTheme]
622
622
  );
623
- React5.useEffect(() => {
623
+ React6.useEffect(() => {
624
624
  setMounted(true);
625
625
  }, []);
626
626
  if (!mounted) {
@@ -1162,7 +1162,7 @@ function Slider({
1162
1162
  max = 100,
1163
1163
  ...props
1164
1164
  }) {
1165
- const _values = React5__namespace.useMemo(
1165
+ const _values = React6__namespace.useMemo(
1166
1166
  () => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
1167
1167
  [value, defaultValue, min, max]
1168
1168
  );
@@ -1256,18 +1256,18 @@ function AvatarEditor({
1256
1256
  className,
1257
1257
  controlSize = "default"
1258
1258
  }) {
1259
- const canvasRef = React5.useRef(null);
1260
- const fileInputRef = React5.useRef(null);
1261
- const containerRef = React5.useRef(null);
1262
- const [image, setImage] = React5.useState(null);
1263
- const [imageLoaded, setImageLoaded] = React5.useState(false);
1264
- const [zoom, setZoom] = React5.useState(1);
1265
- const [rotation, setRotation] = React5.useState(0);
1266
- const [position, setPosition] = React5.useState({ x: 0, y: 0 });
1267
- const [isDragging, setIsDragging] = React5.useState(false);
1268
- const [dragStart, setDragStart] = React5.useState({ x: 0, y: 0 });
1269
- const [showGrid, setShowGrid] = React5.useState(initialShowGrid);
1270
- const generateOutput = React5.useCallback(() => {
1259
+ const canvasRef = React6.useRef(null);
1260
+ const fileInputRef = React6.useRef(null);
1261
+ const containerRef = React6.useRef(null);
1262
+ const [image, setImage] = React6.useState(null);
1263
+ const [imageLoaded, setImageLoaded] = React6.useState(false);
1264
+ const [zoom, setZoom] = React6.useState(1);
1265
+ const [rotation, setRotation] = React6.useState(0);
1266
+ const [position, setPosition] = React6.useState({ x: 0, y: 0 });
1267
+ const [isDragging, setIsDragging] = React6.useState(false);
1268
+ const [dragStart, setDragStart] = React6.useState({ x: 0, y: 0 });
1269
+ const [showGrid, setShowGrid] = React6.useState(initialShowGrid);
1270
+ const generateOutput = React6.useCallback(() => {
1271
1271
  if (!canvasRef.current || !image) return null;
1272
1272
  const outputCanvas = document.createElement("canvas");
1273
1273
  outputCanvas.width = outputSize;
@@ -1278,7 +1278,7 @@ function AvatarEditor({
1278
1278
  const mimeType = `image/${outputFormat}`;
1279
1279
  return outputCanvas.toDataURL(mimeType, outputQuality);
1280
1280
  }, [image, outputSize, outputFormat, outputQuality]);
1281
- React5.useEffect(() => {
1281
+ React6.useEffect(() => {
1282
1282
  if (!canvasRef.current || !image || !imageLoaded) return;
1283
1283
  const canvas = canvasRef.current;
1284
1284
  const ctx = canvas.getContext("2d");
@@ -1346,12 +1346,12 @@ function AvatarEditor({
1346
1346
  generateOutput,
1347
1347
  onChange
1348
1348
  ]);
1349
- const resetTransforms = React5.useCallback(() => {
1349
+ const resetTransforms = React6.useCallback(() => {
1350
1350
  setZoom(1);
1351
1351
  setRotation(0);
1352
1352
  setPosition({ x: 0, y: 0 });
1353
1353
  }, []);
1354
- const handleFileSelect = React5.useCallback(
1354
+ const handleFileSelect = React6.useCallback(
1355
1355
  (e) => {
1356
1356
  const file = e.target.files?.[0];
1357
1357
  if (!file) return;
@@ -1370,7 +1370,7 @@ function AvatarEditor({
1370
1370
  },
1371
1371
  [resetTransforms]
1372
1372
  );
1373
- const handleMouseDown = React5.useCallback(
1373
+ const handleMouseDown = React6.useCallback(
1374
1374
  (e) => {
1375
1375
  if (!imageLoaded) return;
1376
1376
  setIsDragging(true);
@@ -1378,7 +1378,7 @@ function AvatarEditor({
1378
1378
  },
1379
1379
  [imageLoaded, position]
1380
1380
  );
1381
- const handleMouseMove = React5.useCallback(
1381
+ const handleMouseMove = React6.useCallback(
1382
1382
  (e) => {
1383
1383
  if (!isDragging) return;
1384
1384
  setPosition({
@@ -1388,10 +1388,10 @@ function AvatarEditor({
1388
1388
  },
1389
1389
  [isDragging, dragStart]
1390
1390
  );
1391
- const handleMouseUp = React5.useCallback(() => {
1391
+ const handleMouseUp = React6.useCallback(() => {
1392
1392
  setIsDragging(false);
1393
1393
  }, []);
1394
- const handleTouchStart = React5.useCallback(
1394
+ const handleTouchStart = React6.useCallback(
1395
1395
  (e) => {
1396
1396
  if (!imageLoaded) return;
1397
1397
  const touch = e.touches[0];
@@ -1403,7 +1403,7 @@ function AvatarEditor({
1403
1403
  },
1404
1404
  [imageLoaded, position]
1405
1405
  );
1406
- const handleTouchMove = React5.useCallback(
1406
+ const handleTouchMove = React6.useCallback(
1407
1407
  (e) => {
1408
1408
  if (!isDragging) return;
1409
1409
  const touch = e.touches[0];
@@ -1414,7 +1414,7 @@ function AvatarEditor({
1414
1414
  },
1415
1415
  [isDragging, dragStart]
1416
1416
  );
1417
- const handleDiscard = React5.useCallback(() => {
1417
+ const handleDiscard = React6.useCallback(() => {
1418
1418
  setImage(null);
1419
1419
  setImageLoaded(false);
1420
1420
  resetTransforms();
@@ -1963,8 +1963,8 @@ function DrawerTitle({
1963
1963
  );
1964
1964
  }
1965
1965
  function useMediaQuery(query) {
1966
- const [matches, setMatches] = React5.useState(false);
1967
- React5.useEffect(() => {
1966
+ const [matches, setMatches] = React6.useState(false);
1967
+ React6.useEffect(() => {
1968
1968
  const media = window.matchMedia(query);
1969
1969
  if (media.matches !== matches) {
1970
1970
  setMatches(media.matches);
@@ -1991,13 +1991,13 @@ function AvatarEditorDialog({
1991
1991
  errorMessage = "Failed to save avatar. Please try again.",
1992
1992
  className
1993
1993
  }) {
1994
- const [isOpen, setIsOpen] = React5.useState(false);
1995
- const [editedValue, setEditedValue] = React5.useState(value ?? null);
1996
- const [isSaving, setIsSaving] = React5.useState(false);
1997
- const [feedback, setFeedback] = React5.useState(null);
1994
+ const [isOpen, setIsOpen] = React6.useState(false);
1995
+ const [editedValue, setEditedValue] = React6.useState(value ?? null);
1996
+ const [isSaving, setIsSaving] = React6.useState(false);
1997
+ const [feedback, setFeedback] = React6.useState(null);
1998
1998
  const isMobile = useMediaQuery("(max-width: 640px)");
1999
1999
  const caption = (placeholder ?? "").trim();
2000
- const handleOpenChange = React5.useCallback(
2000
+ const handleOpenChange = React6.useCallback(
2001
2001
  (open) => {
2002
2002
  if (open) {
2003
2003
  setEditedValue(value ?? null);
@@ -2007,7 +2007,7 @@ function AvatarEditorDialog({
2007
2007
  },
2008
2008
  [value]
2009
2009
  );
2010
- const handleAccept = React5.useCallback(async () => {
2010
+ const handleAccept = React6.useCallback(async () => {
2011
2011
  if (!editedValue) return;
2012
2012
  setIsSaving(true);
2013
2013
  setFeedback(null);
@@ -2289,22 +2289,22 @@ function EmojiPicker({
2289
2289
  recentLimit = 24,
2290
2290
  storageKey = "blocks-emoji"
2291
2291
  }) {
2292
- const strings = React5__namespace.useMemo(
2292
+ const strings = React6__namespace.useMemo(
2293
2293
  () => ({ ...DEFAULT_LABELS[locale], ...labels }),
2294
2294
  [locale, labels]
2295
2295
  );
2296
- const titles = React5__namespace.useMemo(
2296
+ const titles = React6__namespace.useMemo(
2297
2297
  () => ({ ...DEFAULT_TITLES[locale], ...labels?.categoryTitles }),
2298
2298
  [locale, labels]
2299
2299
  );
2300
- const [query, setQuery] = React5__namespace.useState("");
2301
- const [skinTone, setSkinTone] = React5__namespace.useState(() => {
2300
+ const [query, setQuery] = React6__namespace.useState("");
2301
+ const [skinTone, setSkinTone] = React6__namespace.useState(() => {
2302
2302
  const raw = readStored(storageKey, "tone");
2303
2303
  const parsed = raw != null ? Number.parseInt(raw, 10) : 0;
2304
2304
  return parsed >= 0 && parsed <= 5 ? parsed : 0;
2305
2305
  });
2306
- const [toneOpen, setToneOpen] = React5__namespace.useState(false);
2307
- const [recents, setRecents] = React5__namespace.useState(() => {
2306
+ const [toneOpen, setToneOpen] = React6__namespace.useState(false);
2307
+ const [recents, setRecents] = React6__namespace.useState(() => {
2308
2308
  const raw = readStored(storageKey, "recent");
2309
2309
  if (!raw) return [];
2310
2310
  try {
@@ -2314,13 +2314,13 @@ function EmojiPicker({
2314
2314
  return [];
2315
2315
  }
2316
2316
  });
2317
- const [focusIndex, setFocusIndex] = React5__namespace.useState(-1);
2318
- const scrollRef = React5__namespace.useRef(null);
2319
- const sectionRefs = React5__namespace.useRef(
2317
+ const [focusIndex, setFocusIndex] = React6__namespace.useState(-1);
2318
+ const scrollRef = React6__namespace.useRef(null);
2319
+ const sectionRefs = React6__namespace.useRef(
2320
2320
  /* @__PURE__ */ new Map()
2321
2321
  );
2322
2322
  const normalizedQuery = normalizeEmojiQuery(query);
2323
- const sections = React5__namespace.useMemo(() => {
2323
+ const sections = React6__namespace.useMemo(() => {
2324
2324
  if (normalizedQuery) return [];
2325
2325
  const result = [];
2326
2326
  if (recents.length > 0) {
@@ -2339,7 +2339,7 @@ function EmojiPicker({
2339
2339
  }
2340
2340
  return result;
2341
2341
  }, [normalizedQuery, recents, titles]);
2342
- const searchResults = React5__namespace.useMemo(() => {
2342
+ const searchResults = React6__namespace.useMemo(() => {
2343
2343
  if (!normalizedQuery) return [];
2344
2344
  const out = [];
2345
2345
  for (const category of EMOJI_CATEGORIES) {
@@ -2349,21 +2349,21 @@ function EmojiPicker({
2349
2349
  }
2350
2350
  return out;
2351
2351
  }, [normalizedQuery]);
2352
- const flatList = React5__namespace.useMemo(() => {
2352
+ const flatList = React6__namespace.useMemo(() => {
2353
2353
  if (normalizedQuery) return searchResults;
2354
2354
  return sections.flatMap((s) => s.emojis);
2355
2355
  }, [normalizedQuery, searchResults, sections]);
2356
- React5__namespace.useEffect(() => {
2356
+ React6__namespace.useEffect(() => {
2357
2357
  setFocusIndex(-1);
2358
2358
  }, [normalizedQuery]);
2359
- React5__namespace.useEffect(() => {
2359
+ React6__namespace.useEffect(() => {
2360
2360
  if (focusIndex < 0) return;
2361
2361
  const el = scrollRef.current?.querySelector(
2362
2362
  `[data-emoji-index="${focusIndex}"]`
2363
2363
  );
2364
2364
  el?.focus();
2365
2365
  }, [focusIndex]);
2366
- const commitRecent = React5__namespace.useCallback(
2366
+ const commitRecent = React6__namespace.useCallback(
2367
2367
  (glyph) => {
2368
2368
  setRecents((prev) => {
2369
2369
  const next = [glyph, ...prev.filter((e) => e !== glyph)].slice(
@@ -2376,14 +2376,14 @@ function EmojiPicker({
2376
2376
  },
2377
2377
  [recentLimit, storageKey]
2378
2378
  );
2379
- const handleSelect = React5__namespace.useCallback(
2379
+ const handleSelect = React6__namespace.useCallback(
2380
2380
  (glyph) => {
2381
2381
  commitRecent(glyph);
2382
2382
  onSelect(glyph);
2383
2383
  },
2384
2384
  [commitRecent, onSelect]
2385
2385
  );
2386
- const chooseTone = React5__namespace.useCallback(
2386
+ const chooseTone = React6__namespace.useCallback(
2387
2387
  (tone) => {
2388
2388
  setSkinTone(tone);
2389
2389
  setToneOpen(false);
@@ -2680,6 +2680,7 @@ function EmojiPickerPopover({
2680
2680
  onSelect,
2681
2681
  triggerLabel,
2682
2682
  triggerClassName: triggerClassName2,
2683
+ disabled = false,
2683
2684
  side = "top",
2684
2685
  align = "end",
2685
2686
  open,
@@ -2688,17 +2689,17 @@ function EmojiPickerPopover({
2688
2689
  locale = "en",
2689
2690
  ...pickerProps
2690
2691
  }) {
2691
- const [internalOpen, setInternalOpen] = React5__namespace.useState(false);
2692
+ const [internalOpen, setInternalOpen] = React6__namespace.useState(false);
2692
2693
  const isControlled = open !== void 0;
2693
2694
  const isOpen = isControlled ? open : internalOpen;
2694
- const setOpen = React5__namespace.useCallback(
2695
+ const setOpen = React6__namespace.useCallback(
2695
2696
  (next) => {
2696
2697
  if (!isControlled) setInternalOpen(next);
2697
2698
  onOpenChange?.(next);
2698
2699
  },
2699
2700
  [isControlled, onOpenChange]
2700
2701
  );
2701
- const handleSelect = React5__namespace.useCallback(
2702
+ const handleSelect = React6__namespace.useCallback(
2702
2703
  (emoji) => {
2703
2704
  onSelect(emoji);
2704
2705
  if (!keepOpenOnSelect) setOpen(false);
@@ -2712,6 +2713,7 @@ function EmojiPickerPopover({
2712
2713
  type: "button",
2713
2714
  variant: "ghost",
2714
2715
  size: "icon",
2716
+ disabled,
2715
2717
  "aria-label": triggerLabel ?? DEFAULT_TRIGGER_LABEL[locale],
2716
2718
  className: cn("text-muted-foreground", triggerClassName2),
2717
2719
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Smile, { className: "size-5" })
@@ -2721,6 +2723,196 @@ function EmojiPickerPopover({
2721
2723
  ] });
2722
2724
  }
2723
2725
 
2726
+ // src/lib/insert-at-caret.ts
2727
+ function insertAtCaret(element, value, text) {
2728
+ const start = element?.selectionStart ?? value.length;
2729
+ const end = element?.selectionEnd ?? value.length;
2730
+ return {
2731
+ value: value.slice(0, start) + text + value.slice(end),
2732
+ caret: start + text.length
2733
+ };
2734
+ }
2735
+ var wrapperClassName = "relative w-full rounded-md border border-input bg-transparent shadow-xs transition-[color,box-shadow] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50 has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-destructive/20 has-[:disabled]:opacity-50 dark:bg-input/30 dark:has-[[aria-invalid=true]]:ring-destructive/40";
2736
+ var fieldResetClassName = "border-0 bg-transparent shadow-none focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent";
2737
+ function mergeRefs(...refs) {
2738
+ return (node) => {
2739
+ for (const ref of refs) {
2740
+ if (typeof ref === "function") {
2741
+ ref(node);
2742
+ } else if (ref) {
2743
+ ref.current = node;
2744
+ }
2745
+ }
2746
+ };
2747
+ }
2748
+ function emitChange(element, nextValue, onChange) {
2749
+ const prototype = element instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype;
2750
+ const descriptor = Object.getOwnPropertyDescriptor(prototype, "value");
2751
+ descriptor?.set?.call(element, nextValue);
2752
+ const tracker = element._valueTracker;
2753
+ tracker?.setValue?.(nextValue === "" ? " " : "");
2754
+ onChange?.({
2755
+ target: element,
2756
+ currentTarget: element
2757
+ });
2758
+ }
2759
+ function useEmojiInsert(fieldRef, value, onChange) {
2760
+ return React6__namespace.useCallback(
2761
+ (emoji) => {
2762
+ const el = fieldRef.current;
2763
+ const current = value !== void 0 && value !== null ? String(value) : el?.value ?? "";
2764
+ const { value: next, caret } = insertAtCaret(el, current, emoji);
2765
+ if (el) {
2766
+ emitChange(el, next, onChange);
2767
+ requestAnimationFrame(() => {
2768
+ el.focus();
2769
+ el.setSelectionRange(caret, caret);
2770
+ });
2771
+ return;
2772
+ }
2773
+ onChange?.({
2774
+ target: { value: next },
2775
+ currentTarget: { value: next }
2776
+ });
2777
+ },
2778
+ [fieldRef, value, onChange]
2779
+ );
2780
+ }
2781
+ var EmojiTextarea = React6__namespace.forwardRef(
2782
+ function EmojiTextarea2({
2783
+ className,
2784
+ locale = "en",
2785
+ disabled,
2786
+ readOnly,
2787
+ value,
2788
+ onChange,
2789
+ triggerLabel,
2790
+ keepOpenOnSelect,
2791
+ open,
2792
+ onOpenChange,
2793
+ side = "top",
2794
+ align = "end",
2795
+ labels,
2796
+ recentLimit,
2797
+ storageKey,
2798
+ emojiTriggerClassName,
2799
+ ...props
2800
+ }, ref) {
2801
+ const fieldRef = React6__namespace.useRef(null);
2802
+ const handleEmojiSelect = useEmojiInsert(fieldRef, value, onChange);
2803
+ const pickerDisabled = Boolean(disabled || readOnly);
2804
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(wrapperClassName, className), children: [
2805
+ /* @__PURE__ */ jsxRuntime.jsx(
2806
+ "textarea",
2807
+ {
2808
+ "data-slot": "textarea",
2809
+ ref: mergeRefs(fieldRef, ref),
2810
+ disabled,
2811
+ readOnly,
2812
+ value,
2813
+ onChange,
2814
+ className: cn(
2815
+ "placeholder:text-muted-foreground flex min-h-20 w-full rounded-md px-3 py-2 pb-9 pr-10 text-base outline-none transition-[color,box-shadow] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
2816
+ fieldResetClassName,
2817
+ className
2818
+ ),
2819
+ ...props
2820
+ }
2821
+ ),
2822
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute right-1 bottom-1", children: /* @__PURE__ */ jsxRuntime.jsx(
2823
+ EmojiPickerPopover,
2824
+ {
2825
+ locale,
2826
+ onSelect: handleEmojiSelect,
2827
+ disabled: pickerDisabled,
2828
+ triggerLabel,
2829
+ keepOpenOnSelect,
2830
+ open,
2831
+ onOpenChange,
2832
+ side,
2833
+ align,
2834
+ labels,
2835
+ recentLimit,
2836
+ storageKey,
2837
+ triggerClassName: cn(
2838
+ "size-7 text-muted-foreground",
2839
+ emojiTriggerClassName
2840
+ )
2841
+ }
2842
+ ) })
2843
+ ] });
2844
+ }
2845
+ );
2846
+ EmojiTextarea.displayName = "EmojiTextarea";
2847
+ var EmojiInput = React6__namespace.forwardRef(
2848
+ function EmojiInput2({
2849
+ className,
2850
+ locale = "en",
2851
+ disabled,
2852
+ readOnly,
2853
+ value,
2854
+ onChange,
2855
+ type = "text",
2856
+ triggerLabel,
2857
+ keepOpenOnSelect,
2858
+ open,
2859
+ onOpenChange,
2860
+ side = "top",
2861
+ align = "end",
2862
+ labels,
2863
+ recentLimit,
2864
+ storageKey,
2865
+ emojiTriggerClassName,
2866
+ ...props
2867
+ }, ref) {
2868
+ const fieldRef = React6__namespace.useRef(null);
2869
+ const handleEmojiSelect = useEmojiInsert(fieldRef, value, onChange);
2870
+ const pickerDisabled = Boolean(disabled || readOnly);
2871
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(wrapperClassName, className), children: [
2872
+ /* @__PURE__ */ jsxRuntime.jsx(
2873
+ "input",
2874
+ {
2875
+ "data-slot": "input",
2876
+ type,
2877
+ ref: mergeRefs(fieldRef, ref),
2878
+ disabled,
2879
+ readOnly,
2880
+ value,
2881
+ onChange,
2882
+ className: cn(
2883
+ "placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-md px-3 py-1 pr-10 text-base outline-none transition-[color,box-shadow] selection:bg-primary selection:text-primary-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
2884
+ fieldResetClassName,
2885
+ className
2886
+ ),
2887
+ ...props
2888
+ }
2889
+ ),
2890
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-1/2 right-1 -translate-y-1/2", children: /* @__PURE__ */ jsxRuntime.jsx(
2891
+ EmojiPickerPopover,
2892
+ {
2893
+ locale,
2894
+ onSelect: handleEmojiSelect,
2895
+ disabled: pickerDisabled,
2896
+ triggerLabel,
2897
+ keepOpenOnSelect,
2898
+ open,
2899
+ onOpenChange,
2900
+ side,
2901
+ align,
2902
+ labels,
2903
+ recentLimit,
2904
+ storageKey,
2905
+ triggerClassName: cn(
2906
+ "size-7 text-muted-foreground",
2907
+ emojiTriggerClassName
2908
+ )
2909
+ }
2910
+ ) })
2911
+ ] });
2912
+ }
2913
+ );
2914
+ EmojiInput.displayName = "EmojiInput";
2915
+
2724
2916
  // src/components/video/hls-config.ts
2725
2917
  function shouldRetryLiveEdge404(retryConfig, retryCount, _isTimeout, loaderResponse, defaultRetry) {
2726
2918
  if (loaderResponse?.code === 404) {
@@ -2881,27 +3073,27 @@ function useHlsPlayback({
2881
3073
  onError,
2882
3074
  onPlayingChange
2883
3075
  }) {
2884
- const videoRef = React5__namespace.useRef(null);
2885
- const hlsRef = React5__namespace.useRef(null);
2886
- const [state, setState] = React5__namespace.useState("idle");
2887
- const [qualities, setQualities] = React5__namespace.useState([]);
2888
- const [activeLevel, setActiveLevel] = React5__namespace.useState(-1);
2889
- const [autoplayState, setAutoplayState] = React5__namespace.useState("none");
2890
- const [error, setError] = React5__namespace.useState(null);
2891
- const [reloadKey, setReloadKey] = React5__namespace.useState(0);
2892
- const onErrorRef = React5__namespace.useRef(onError);
2893
- const onPlayingChangeRef = React5__namespace.useRef(onPlayingChange);
2894
- React5__namespace.useEffect(() => {
3076
+ const videoRef = React6__namespace.useRef(null);
3077
+ const hlsRef = React6__namespace.useRef(null);
3078
+ const [state, setState] = React6__namespace.useState("idle");
3079
+ const [qualities, setQualities] = React6__namespace.useState([]);
3080
+ const [activeLevel, setActiveLevel] = React6__namespace.useState(-1);
3081
+ const [autoplayState, setAutoplayState] = React6__namespace.useState("none");
3082
+ const [error, setError] = React6__namespace.useState(null);
3083
+ const [reloadKey, setReloadKey] = React6__namespace.useState(0);
3084
+ const onErrorRef = React6__namespace.useRef(onError);
3085
+ const onPlayingChangeRef = React6__namespace.useRef(onPlayingChange);
3086
+ React6__namespace.useEffect(() => {
2895
3087
  onErrorRef.current = onError;
2896
3088
  onPlayingChangeRef.current = onPlayingChange;
2897
3089
  }, [onError, onPlayingChange]);
2898
- const retry = React5__namespace.useCallback(() => {
3090
+ const retry = React6__namespace.useCallback(() => {
2899
3091
  setError(null);
2900
3092
  setState("loading");
2901
3093
  setAutoplayState("none");
2902
3094
  setReloadKey((k) => k + 1);
2903
3095
  }, []);
2904
- React5__namespace.useEffect(() => {
3096
+ React6__namespace.useEffect(() => {
2905
3097
  const media = videoRef.current;
2906
3098
  if (!media || !src || !active) {
2907
3099
  setState("idle");
@@ -3113,7 +3305,7 @@ function useHlsPlayback({
3113
3305
  destroyHls();
3114
3306
  };
3115
3307
  }, [src, mode, active, autoPlay, muted, reloadKey]);
3116
- const setLevel = React5__namespace.useCallback((index) => {
3308
+ const setLevel = React6__namespace.useCallback((index) => {
3117
3309
  const hls = hlsRef.current;
3118
3310
  if (!hls) return;
3119
3311
  hls.nextLevel = index;
@@ -3183,12 +3375,12 @@ function VideoPlayer({
3183
3375
  className
3184
3376
  }) {
3185
3377
  const t = { ...DEFAULT_LABELS2, ...labels };
3186
- const containerRef = React5__namespace.useRef(null);
3187
- const firstPlayFiredRef = React5__namespace.useRef(false);
3188
- const [userStarted, setUserStarted] = React5__namespace.useState(false);
3378
+ const containerRef = React6__namespace.useRef(null);
3379
+ const firstPlayFiredRef = React6__namespace.useRef(false);
3380
+ const [userStarted, setUserStarted] = React6__namespace.useState(false);
3189
3381
  const active = autoPlay || !poster || userStarted;
3190
3382
  const autoplayActive = autoPlay || userStarted;
3191
- const handlePlayingChange = React5__namespace.useCallback(
3383
+ const handlePlayingChange = React6__namespace.useCallback(
3192
3384
  (playing) => {
3193
3385
  setIsPlaying(playing);
3194
3386
  if (playing && !firstPlayFiredRef.current) {
@@ -3217,25 +3409,25 @@ function VideoPlayer({
3217
3409
  onError,
3218
3410
  onPlayingChange: handlePlayingChange
3219
3411
  });
3220
- const [isPlaying, setIsPlaying] = React5__namespace.useState(false);
3221
- const [isMuted, setIsMuted] = React5__namespace.useState(muted);
3222
- const [volume, setVolume] = React5__namespace.useState(1);
3223
- const [currentTime, setCurrentTime] = React5__namespace.useState(0);
3224
- const [duration, setDuration] = React5__namespace.useState(0);
3225
- const [buffered, setBuffered] = React5__namespace.useState(0);
3226
- const [isFullscreen, setIsFullscreen] = React5__namespace.useState(false);
3227
- const [pipActive, setPipActive] = React5__namespace.useState(false);
3228
- const [controlsVisible, setControlsVisible] = React5__namespace.useState(true);
3229
- const [playbackRate, setPlaybackRate] = React5__namespace.useState(1);
3230
- const [openMenu, setOpenMenu] = React5__namespace.useState(
3412
+ const [isPlaying, setIsPlaying] = React6__namespace.useState(false);
3413
+ const [isMuted, setIsMuted] = React6__namespace.useState(muted);
3414
+ const [volume, setVolume] = React6__namespace.useState(1);
3415
+ const [currentTime, setCurrentTime] = React6__namespace.useState(0);
3416
+ const [duration, setDuration] = React6__namespace.useState(0);
3417
+ const [buffered, setBuffered] = React6__namespace.useState(0);
3418
+ const [isFullscreen, setIsFullscreen] = React6__namespace.useState(false);
3419
+ const [pipActive, setPipActive] = React6__namespace.useState(false);
3420
+ const [controlsVisible, setControlsVisible] = React6__namespace.useState(true);
3421
+ const [playbackRate, setPlaybackRate] = React6__namespace.useState(1);
3422
+ const [openMenu, setOpenMenu] = React6__namespace.useState(
3231
3423
  null
3232
3424
  );
3233
- const [behindLive, setBehindLive] = React5__namespace.useState(false);
3234
- const hideTimerRef = React5__namespace.useRef(null);
3425
+ const [behindLive, setBehindLive] = React6__namespace.useState(false);
3426
+ const hideTimerRef = React6__namespace.useRef(null);
3235
3427
  const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
3236
3428
  const fullscreenSupported = typeof document !== "undefined" && (!!document.fullscreenEnabled || // Safari
3237
3429
  "webkitFullscreenEnabled" in document);
3238
- React5__namespace.useEffect(() => {
3430
+ React6__namespace.useEffect(() => {
3239
3431
  const video = videoRef.current;
3240
3432
  if (!video || !active) return;
3241
3433
  const onTimeUpdate = () => {
@@ -3268,12 +3460,12 @@ function VideoPlayer({
3268
3460
  video.removeEventListener("ratechange", onRate);
3269
3461
  };
3270
3462
  }, [videoRef, active, mode]);
3271
- React5__namespace.useEffect(() => {
3463
+ React6__namespace.useEffect(() => {
3272
3464
  const onFsChange = () => setIsFullscreen(document.fullscreenElement === containerRef.current);
3273
3465
  document.addEventListener("fullscreenchange", onFsChange);
3274
3466
  return () => document.removeEventListener("fullscreenchange", onFsChange);
3275
3467
  }, []);
3276
- React5__namespace.useEffect(() => {
3468
+ React6__namespace.useEffect(() => {
3277
3469
  const video = videoRef.current;
3278
3470
  if (!video) return;
3279
3471
  const onEnter = () => setPipActive(true);
@@ -3285,18 +3477,18 @@ function VideoPlayer({
3285
3477
  video.removeEventListener("leavepictureinpicture", onLeave);
3286
3478
  };
3287
3479
  }, [videoRef]);
3288
- const scheduleHide = React5__namespace.useCallback(() => {
3480
+ const scheduleHide = React6__namespace.useCallback(() => {
3289
3481
  if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
3290
3482
  hideTimerRef.current = setTimeout(() => {
3291
3483
  setControlsVisible(false);
3292
3484
  setOpenMenu(null);
3293
3485
  }, CONTROLS_HIDE_MS);
3294
3486
  }, []);
3295
- const revealControls = React5__namespace.useCallback(() => {
3487
+ const revealControls = React6__namespace.useCallback(() => {
3296
3488
  setControlsVisible(true);
3297
3489
  scheduleHide();
3298
3490
  }, [scheduleHide]);
3299
- React5__namespace.useEffect(() => {
3491
+ React6__namespace.useEffect(() => {
3300
3492
  return () => {
3301
3493
  if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
3302
3494
  };
@@ -3749,8 +3941,8 @@ function MenuItem({
3749
3941
  );
3750
3942
  }
3751
3943
  function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {}) {
3752
- const [stats, setStats] = React5__namespace.useState({});
3753
- React5__namespace.useEffect(() => {
3944
+ const [stats, setStats] = React6__namespace.useState({});
3945
+ React6__namespace.useEffect(() => {
3754
3946
  if (!statsUrl || !enabled) return;
3755
3947
  let cancelled = false;
3756
3948
  const controller = new AbortController();
@@ -3780,16 +3972,16 @@ function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {})
3780
3972
  return stats;
3781
3973
  }
3782
3974
  function useDebouncedValue(value, delayMs) {
3783
- const [debounced, setDebounced] = React5.useState(value);
3784
- React5.useEffect(() => {
3975
+ const [debounced, setDebounced] = React6.useState(value);
3976
+ React6.useEffect(() => {
3785
3977
  const id = window.setTimeout(() => setDebounced(value), delayMs);
3786
3978
  return () => window.clearTimeout(id);
3787
3979
  }, [value, delayMs]);
3788
3980
  return debounced;
3789
3981
  }
3790
3982
  function useDebouncedValueStrict(value, delayMs) {
3791
- const [debounced, setDebounced] = React5.useState(void 0);
3792
- React5.useEffect(() => {
3983
+ const [debounced, setDebounced] = React6.useState(void 0);
3984
+ React6.useEffect(() => {
3793
3985
  setDebounced(void 0);
3794
3986
  const id = window.setTimeout(() => setDebounced(value), delayMs);
3795
3987
  return () => window.clearTimeout(id);
@@ -3798,9 +3990,9 @@ function useDebouncedValueStrict(value, delayMs) {
3798
3990
  }
3799
3991
  function useSearchHotkey(options = {}) {
3800
3992
  const { defaultOpen = false, disabled = false } = options;
3801
- const [open, setOpen] = React5.useState(defaultOpen);
3802
- const toggle = React5.useCallback(() => setOpen((prev) => !prev), []);
3803
- React5.useEffect(() => {
3993
+ const [open, setOpen] = React6.useState(defaultOpen);
3994
+ const toggle = React6.useCallback(() => setOpen((prev) => !prev), []);
3995
+ React6.useEffect(() => {
3804
3996
  if (disabled) return;
3805
3997
  function handleKeyDown(event) {
3806
3998
  if (event.key.toLowerCase() !== "k") return;
@@ -3997,20 +4189,20 @@ function SearchCommand({
3997
4189
  className
3998
4190
  }) {
3999
4191
  const labels = { ...defaultLabels3, ...userLabels };
4000
- const [query, setQuery] = React5.useState("");
4001
- const [hits, setHits] = React5.useState([]);
4002
- const [isLoading, setIsLoading] = React5.useState(false);
4003
- const [hasError, setHasError] = React5.useState(false);
4192
+ const [query, setQuery] = React6.useState("");
4193
+ const [hits, setHits] = React6.useState([]);
4194
+ const [isLoading, setIsLoading] = React6.useState(false);
4195
+ const [hasError, setHasError] = React6.useState(false);
4004
4196
  const debouncedQuery = useDebouncedValue(query, debounceMs);
4005
- const requestIdRef = React5.useRef(0);
4006
- React5.useEffect(() => {
4197
+ const requestIdRef = React6.useRef(0);
4198
+ React6.useEffect(() => {
4007
4199
  if (!open) {
4008
4200
  setQuery("");
4009
4201
  setHits([]);
4010
4202
  setHasError(false);
4011
4203
  }
4012
4204
  }, [open]);
4013
- React5.useEffect(() => {
4205
+ React6.useEffect(() => {
4014
4206
  const trimmed = debouncedQuery.trim();
4015
4207
  if (trimmed.length < minQueryLength) {
4016
4208
  setHits([]);
@@ -4033,13 +4225,13 @@ function SearchCommand({
4033
4225
  setIsLoading(false);
4034
4226
  });
4035
4227
  }, [debouncedQuery, minQueryLength, fetchResults]);
4036
- const filteredFeatures = React5.useMemo(() => {
4228
+ const filteredFeatures = React6.useMemo(() => {
4037
4229
  if (!query.trim()) return features;
4038
4230
  return features.filter(
4039
4231
  (feature) => fuzzyMatch(query, feature.label) || feature.keywords?.some((keyword) => fuzzyMatch(query, keyword))
4040
4232
  );
4041
4233
  }, [features, query]);
4042
- const groupedHits = React5.useMemo(() => groupHitsByType(hits), [hits]);
4234
+ const groupedHits = React6.useMemo(() => groupHitsByType(hits), [hits]);
4043
4235
  function handleSelect(selection) {
4044
4236
  onSelect(selection);
4045
4237
  onOpenChange(false);
@@ -4173,7 +4365,7 @@ function ScrollBar({
4173
4365
  );
4174
4366
  }
4175
4367
  var phoneInputGroupClass = "flex h-9 w-full gap-0 overflow-hidden rounded-md border border-input bg-transparent shadow-xs transition-[color,box-shadow] [--PhoneInputCountrySelect-marginRight:0] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50 dark:bg-input/30 [&_.PhoneInputCountry]:mr-0";
4176
- var PhoneInput = React5__namespace.forwardRef(
4368
+ var PhoneInput = React6__namespace.forwardRef(
4177
4369
  ({ className, onChange, value, defaultCountry = "MX", ...props }, ref) => {
4178
4370
  return /* @__PURE__ */ jsxRuntime.jsx(
4179
4371
  RPNInput__namespace.default,
@@ -4193,7 +4385,7 @@ var PhoneInput = React5__namespace.forwardRef(
4193
4385
  }
4194
4386
  );
4195
4387
  PhoneInput.displayName = "PhoneInput";
4196
- var InputComponent = React5__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4388
+ var InputComponent = React6__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4197
4389
  Input,
4198
4390
  {
4199
4391
  className: cn(
@@ -4211,9 +4403,9 @@ var CountrySelect = ({
4211
4403
  options: countryList,
4212
4404
  onChange
4213
4405
  }) => {
4214
- const scrollAreaRef = React5__namespace.useRef(null);
4215
- const [searchValue, setSearchValue] = React5__namespace.useState("");
4216
- const [isOpen, setIsOpen] = React5__namespace.useState(false);
4406
+ const scrollAreaRef = React6__namespace.useRef(null);
4407
+ const [searchValue, setSearchValue] = React6__namespace.useState("");
4408
+ const [isOpen, setIsOpen] = React6__namespace.useState(false);
4217
4409
  return /* @__PURE__ */ jsxRuntime.jsxs(
4218
4410
  Popover,
4219
4411
  {
@@ -4394,8 +4586,8 @@ var MEXICO_STATE_PATHS = {
4394
4586
  };
4395
4587
  function MexicoMap({ selected, onToggle, className }) {
4396
4588
  const isInteractive = typeof onToggle === "function";
4397
- const selectedSet = React5__namespace.useMemo(() => new Set(selected), [selected]);
4398
- const handleKeyDown = React5__namespace.useCallback(
4589
+ const selectedSet = React6__namespace.useMemo(() => new Set(selected), [selected]);
4590
+ const handleKeyDown = React6__namespace.useCallback(
4399
4591
  (event, id) => {
4400
4592
  if (!onToggle) return;
4401
4593
  if (event.key === "Enter" || event.key === " ") {
@@ -4898,8 +5090,10 @@ exports.BubbleGroup = BubbleGroup;
4898
5090
  exports.BubbleReactions = BubbleReactions;
4899
5091
  exports.ChatMessageList = ChatMessageList;
4900
5092
  exports.ConfirmDestructiveDialog = ConfirmDestructiveDialog;
5093
+ exports.EmojiInput = EmojiInput;
4901
5094
  exports.EmojiPicker = EmojiPicker;
4902
5095
  exports.EmojiPickerPopover = EmojiPickerPopover;
5096
+ exports.EmojiTextarea = EmojiTextarea;
4903
5097
  exports.Empty = Empty;
4904
5098
  exports.EmptyContent = EmptyContent;
4905
5099
  exports.EmptyDescription = EmptyDescription;
@@ -4945,6 +5139,7 @@ exports.describePlaybackError = describePlaybackError;
4945
5139
  exports.fuzzyMatch = fuzzyMatch;
4946
5140
  exports.getAvatarColors = getAvatarColors;
4947
5141
  exports.getInitials = getInitials;
5142
+ exports.insertAtCaret = insertAtCaret;
4948
5143
  exports.markerVariants = markerVariants;
4949
5144
  exports.normalizeEmojiQuery = normalizeEmojiQuery;
4950
5145
  exports.shouldRetryLiveEdge404 = shouldRetryLiveEdge404;