@underverse-ui/underverse 0.2.106 → 0.2.108

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.js CHANGED
@@ -6935,6 +6935,14 @@ function WheelColumn({
6935
6935
  const wheelDeltaRef = React25.useRef(0);
6936
6936
  const scrollEndTimeoutRef = React25.useRef(null);
6937
6937
  const suppressScrollSelectUntilRef = React25.useRef(0);
6938
+ const suppressItemClickUntilRef = React25.useRef(0);
6939
+ const dragRef = React25.useRef(null);
6940
+ const draggingRef = React25.useRef(false);
6941
+ const inertialRef = React25.useRef(false);
6942
+ const inertiaRafRef = React25.useRef(null);
6943
+ const inertiaVelocityRef = React25.useRef(0);
6944
+ const inertiaLastTimeRef = React25.useRef(0);
6945
+ const moveSamplesRef = React25.useRef([]);
6938
6946
  const loop = true;
6939
6947
  const ui = React25.useMemo(() => {
6940
6948
  if (size === "sm") {
@@ -6984,17 +6992,20 @@ function WheelColumn({
6984
6992
  },
6985
6993
  [items.length, loop]
6986
6994
  );
6987
- React25.useEffect(() => {
6995
+ React25.useLayoutEffect(() => {
6988
6996
  const el = scrollRef.current;
6989
6997
  if (!el) return;
6990
6998
  const maxVirtual = Math.max(0, extendedItems.length - 1);
6991
6999
  const currentVirtual2 = clamp3(Math.round(el.scrollTop / itemHeight), 0, maxVirtual);
6992
- const desiredVirtual = loop ? getNearestVirtualIndex(valueIndex, currentVirtual2) : valueIndex;
7000
+ const desiredVirtual = loop && lastVirtualIndexRef.current == null ? baseOffset + valueIndex : loop ? getNearestVirtualIndex(valueIndex, currentVirtual2) : valueIndex;
6993
7001
  const nextTop = desiredVirtual * itemHeight;
6994
7002
  const delta = Math.abs(el.scrollTop - nextTop);
6995
7003
  if (delta > 1) {
6996
- const behavior = animate && delta <= itemHeight * 1.5 ? "smooth" : "auto";
6997
- el.scrollTo({ top: nextTop, behavior });
7004
+ if (animate && delta <= itemHeight * 1.5) {
7005
+ el.scrollTo({ top: nextTop, behavior: "smooth" });
7006
+ } else {
7007
+ el.scrollTop = nextTop;
7008
+ }
6998
7009
  }
6999
7010
  lastVirtualIndexRef.current = desiredVirtual;
7000
7011
  return () => {
@@ -7002,9 +7013,13 @@ function WheelColumn({
7002
7013
  window.clearTimeout(scrollEndTimeoutRef.current);
7003
7014
  scrollEndTimeoutRef.current = null;
7004
7015
  }
7016
+ if (inertiaRafRef.current != null) {
7017
+ cancelAnimationFrame(inertiaRafRef.current);
7018
+ inertiaRafRef.current = null;
7019
+ }
7005
7020
  cancelAnimationFrame(rafRef.current);
7006
7021
  };
7007
- }, [animate, extendedItems.length, getNearestVirtualIndex, itemHeight, loop, scrollRef, valueIndex]);
7022
+ }, [animate, baseOffset, extendedItems.length, getNearestVirtualIndex, itemHeight, loop, scrollRef, valueIndex]);
7008
7023
  React25.useEffect(() => {
7009
7024
  const el = scrollRef.current;
7010
7025
  if (!el) return;
@@ -7087,7 +7102,7 @@ function WheelColumn({
7087
7102
  if (centered > max) centered -= len;
7088
7103
  if (centered !== snappedVirtual) {
7089
7104
  lastVirtualIndexRef.current = centered;
7090
- el.scrollTo({ top: centered * itemHeight, behavior: "auto" });
7105
+ el.scrollTop = centered * itemHeight;
7091
7106
  }
7092
7107
  }
7093
7108
  }, 120);
@@ -7099,6 +7114,138 @@ function WheelColumn({
7099
7114
  const from = lastVirtualIndexRef.current ?? fallback;
7100
7115
  return getNearestVirtualIndex(valueIndex, from);
7101
7116
  }, [baseOffset, getNearestVirtualIndex, items.length, loop, valueIndex]);
7117
+ const commitFromScrollTop = React25.useCallback(
7118
+ (behavior) => {
7119
+ const el = scrollRef.current;
7120
+ if (!el) return;
7121
+ if (items.length <= 0) return;
7122
+ const len = items.length;
7123
+ const maxVirtual = Math.max(0, extendedItems.length - 1);
7124
+ const idxVirtual = clamp3(Math.round(el.scrollTop / itemHeight), 0, maxVirtual);
7125
+ const realIndex = (idxVirtual % len + len) % len;
7126
+ const snappedVirtual = loop ? getNearestVirtualIndex(realIndex, idxVirtual) : realIndex;
7127
+ lastVirtualIndexRef.current = snappedVirtual;
7128
+ suppressScrollSelectUntilRef.current = Date.now() + 350;
7129
+ if (behavior === "auto") el.scrollTop = snappedVirtual * itemHeight;
7130
+ else el.scrollTo({ top: snappedVirtual * itemHeight, behavior });
7131
+ onSelect(items[realIndex]);
7132
+ if (loop) {
7133
+ const min = len;
7134
+ const max = len * 2 - 1;
7135
+ let centered = snappedVirtual;
7136
+ if (centered < min) centered += len;
7137
+ if (centered > max) centered -= len;
7138
+ if (centered !== snappedVirtual) {
7139
+ lastVirtualIndexRef.current = centered;
7140
+ el.scrollTop = centered * itemHeight;
7141
+ }
7142
+ }
7143
+ },
7144
+ [extendedItems.length, getNearestVirtualIndex, itemHeight, items, loop, onSelect, scrollRef]
7145
+ );
7146
+ const onPointerDown = (e) => {
7147
+ if (e.pointerType !== "mouse") return;
7148
+ if (e.button !== 0) return;
7149
+ const el = scrollRef.current;
7150
+ if (!el) return;
7151
+ e.preventDefault();
7152
+ setFocusedColumn(column);
7153
+ draggingRef.current = true;
7154
+ inertialRef.current = false;
7155
+ if (inertiaRafRef.current != null) {
7156
+ cancelAnimationFrame(inertiaRafRef.current);
7157
+ inertiaRafRef.current = null;
7158
+ }
7159
+ if (scrollEndTimeoutRef.current != null) {
7160
+ window.clearTimeout(scrollEndTimeoutRef.current);
7161
+ scrollEndTimeoutRef.current = null;
7162
+ }
7163
+ dragRef.current = { pointerId: e.pointerId, startY: e.clientY, startScrollTop: el.scrollTop, moved: false };
7164
+ moveSamplesRef.current = [{ t: performance.now(), top: el.scrollTop }];
7165
+ try {
7166
+ el.setPointerCapture(e.pointerId);
7167
+ } catch {
7168
+ }
7169
+ };
7170
+ const onPointerMove = (e) => {
7171
+ const el = scrollRef.current;
7172
+ const drag = dragRef.current;
7173
+ if (!el || !drag) return;
7174
+ if (e.pointerId !== drag.pointerId) return;
7175
+ e.preventDefault();
7176
+ const dy = e.clientY - drag.startY;
7177
+ if (!drag.moved && Math.abs(dy) < 4) return;
7178
+ if (!drag.moved) {
7179
+ drag.moved = true;
7180
+ suppressItemClickUntilRef.current = Date.now() + 400;
7181
+ }
7182
+ suppressScrollSelectUntilRef.current = Date.now() + 500;
7183
+ el.scrollTop = drag.startScrollTop - dy;
7184
+ const now = performance.now();
7185
+ const samples = moveSamplesRef.current;
7186
+ samples.push({ t: now, top: el.scrollTop });
7187
+ while (samples.length > 6 && samples[0] && now - samples[0].t > 120) samples.shift();
7188
+ while (samples.length > 8) samples.shift();
7189
+ if (samples.length >= 2) {
7190
+ const oldest = samples[0];
7191
+ const dt = now - oldest.t;
7192
+ if (dt > 0) inertiaVelocityRef.current = (el.scrollTop - oldest.top) / dt;
7193
+ }
7194
+ };
7195
+ const startInertia = React25.useCallback(() => {
7196
+ const el = scrollRef.current;
7197
+ if (!el) return;
7198
+ if (items.length <= 0) return;
7199
+ inertialRef.current = true;
7200
+ suppressItemClickUntilRef.current = Date.now() + 600;
7201
+ inertiaLastTimeRef.current = performance.now();
7202
+ const len = items.length;
7203
+ const cycle = len * itemHeight;
7204
+ const frictionPerFrame = 0.92;
7205
+ const tick = () => {
7206
+ const now = performance.now();
7207
+ const last = inertiaLastTimeRef.current || now;
7208
+ const dt = Math.min(48, Math.max(0, now - last));
7209
+ inertiaLastTimeRef.current = now;
7210
+ let v = inertiaVelocityRef.current;
7211
+ el.scrollTop += v * dt;
7212
+ if (loop && cycle > 0) {
7213
+ if (el.scrollTop < cycle * 0.5) el.scrollTop += cycle;
7214
+ else if (el.scrollTop > cycle * 2.5) el.scrollTop -= cycle;
7215
+ }
7216
+ const decay = Math.pow(frictionPerFrame, dt / 16);
7217
+ v *= decay;
7218
+ inertiaVelocityRef.current = v;
7219
+ if (Math.abs(v) < 0.03) {
7220
+ inertialRef.current = false;
7221
+ inertiaRafRef.current = null;
7222
+ commitFromScrollTop("smooth");
7223
+ return;
7224
+ }
7225
+ inertiaRafRef.current = requestAnimationFrame(tick);
7226
+ };
7227
+ inertiaRafRef.current = requestAnimationFrame(tick);
7228
+ }, [commitFromScrollTop, itemHeight, items.length, loop, scrollRef]);
7229
+ const endDrag = (pointerId) => {
7230
+ const el = scrollRef.current;
7231
+ const drag = dragRef.current;
7232
+ if (!el || !drag) return;
7233
+ if (pointerId !== drag.pointerId) return;
7234
+ dragRef.current = null;
7235
+ draggingRef.current = false;
7236
+ try {
7237
+ el.releasePointerCapture(pointerId);
7238
+ } catch {
7239
+ }
7240
+ const v = inertiaVelocityRef.current;
7241
+ const shouldFlick = drag.moved && Math.abs(v) >= 0.35;
7242
+ if (shouldFlick) {
7243
+ startInertia();
7244
+ } else {
7245
+ inertialRef.current = false;
7246
+ commitFromScrollTop("smooth");
7247
+ }
7248
+ };
7102
7249
  return /* @__PURE__ */ jsxs26("div", { className: cn("flex-1", ui.columnWidth), children: [
7103
7250
  /* @__PURE__ */ jsx31("div", { className: cn(ui.label, "font-bold uppercase tracking-wider text-muted-foreground/70 text-center"), children: labelText }),
7104
7251
  /* @__PURE__ */ jsxs26("div", { className: "relative rounded-xl bg-muted/30 overflow-hidden", style: { height }, children: [
@@ -7116,8 +7263,9 @@ function WheelColumn({
7116
7263
  {
7117
7264
  ref: scrollRef,
7118
7265
  className: cn(
7119
- "h-full overflow-y-auto overscroll-contain snap-y snap-mandatory scroll-smooth",
7266
+ "h-full overflow-y-auto overscroll-contain snap-y snap-mandatory",
7120
7267
  "scrollbar-none",
7268
+ "select-none cursor-grab active:cursor-grabbing",
7121
7269
  "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-xl"
7122
7270
  ),
7123
7271
  style: { paddingTop: paddingY, paddingBottom: paddingY },
@@ -7126,7 +7274,15 @@ function WheelColumn({
7126
7274
  tabIndex: focused ? 0 : -1,
7127
7275
  onKeyDown: (e) => onKeyDown(e, column),
7128
7276
  onFocus: () => setFocusedColumn(column),
7129
- onScroll: handleScroll,
7277
+ onScroll: () => {
7278
+ if (draggingRef.current) return;
7279
+ if (inertialRef.current) return;
7280
+ handleScroll();
7281
+ },
7282
+ onPointerDown,
7283
+ onPointerMove,
7284
+ onPointerUp: (e) => endDrag(e.pointerId),
7285
+ onPointerCancel: (e) => endDrag(e.pointerId),
7130
7286
  children: /* @__PURE__ */ jsx31("div", { children: extendedItems.map((n, index) => {
7131
7287
  const dist = Math.abs(index - currentVirtual);
7132
7288
  const distForVisual = Math.min(dist, 2);
@@ -7151,6 +7307,7 @@ function WheelColumn({
7151
7307
  opacity
7152
7308
  },
7153
7309
  onClick: () => {
7310
+ if (Date.now() < suppressItemClickUntilRef.current) return;
7154
7311
  const el = scrollRef.current;
7155
7312
  if (!el) return;
7156
7313
  suppressScrollSelectUntilRef.current = Date.now() + 350;
@@ -7511,7 +7668,7 @@ function TimePicker({
7511
7668
  emit(next);
7512
7669
  };
7513
7670
  const timePickerContent = /* @__PURE__ */ jsxs26("div", { className: panelSz.stackGap, children: [
7514
- /* @__PURE__ */ jsx31("div", { className: "flex items-center justify-center py-2 px-3 rounded-xl bg-linear-to-r from-primary/10 via-primary/5 to-primary/10 border border-primary/20", children: /* @__PURE__ */ jsx31("span", { className: cn(panelSz.timeText, "font-bold tabular-nums tracking-wide text-foreground"), children: display }) }),
7671
+ /* @__PURE__ */ jsx31("div", { className: "flex items-center justify-center py-1", children: /* @__PURE__ */ jsx31("span", { className: cn(panelSz.timeText, "font-bold tabular-nums tracking-wide text-foreground underline underline-offset-8 decoration-primary/60"), children: display }) }),
7515
7672
  allowManualInput && /* @__PURE__ */ jsxs26("div", { className: "relative", children: [
7516
7673
  /* @__PURE__ */ jsx31(
7517
7674
  Input_default,
@@ -11124,7 +11281,7 @@ RadioGroupItem.displayName = "RadioGroupItem";
11124
11281
 
11125
11282
  // ../../components/ui/Slider.tsx
11126
11283
  import * as React34 from "react";
11127
- import { jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
11284
+ import { Fragment as Fragment14, jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
11128
11285
  var SIZE_STYLES = {
11129
11286
  sm: {
11130
11287
  track: "h-1",
@@ -11142,16 +11299,22 @@ var SIZE_STYLES = {
11142
11299
  container: "py-3"
11143
11300
  }
11144
11301
  };
11302
+ var clamp5 = (n, min, max) => Math.min(max, Math.max(min, n));
11145
11303
  var Slider = React34.forwardRef(
11146
11304
  ({
11147
11305
  className,
11306
+ mode = "single",
11148
11307
  value,
11149
11308
  defaultValue = 0,
11309
+ rangeValue,
11310
+ defaultRangeValue,
11150
11311
  min = 0,
11151
11312
  max = 100,
11152
11313
  step = 1,
11153
11314
  onChange,
11154
11315
  onValueChange,
11316
+ onRangeChange,
11317
+ onRangeValueChange,
11155
11318
  onMouseUp,
11156
11319
  onTouchEnd,
11157
11320
  label,
@@ -11168,20 +11331,125 @@ var Slider = React34.forwardRef(
11168
11331
  noFocus = true,
11169
11332
  ...props
11170
11333
  }, ref) => {
11334
+ const isRange = mode === "range";
11335
+ const trackRef = React34.useRef(null);
11171
11336
  const [internalValue, setInternalValue] = React34.useState(defaultValue);
11337
+ const [internalRange, setInternalRange] = React34.useState(() => {
11338
+ if (defaultRangeValue) return defaultRangeValue;
11339
+ const v = clamp5(defaultValue, min, max);
11340
+ return [min, v];
11341
+ });
11342
+ const [activeThumb, setActiveThumb] = React34.useState(null);
11343
+ const dragRef = React34.useRef(null);
11172
11344
  const isControlled = value !== void 0;
11173
11345
  const currentValue = isControlled ? value : internalValue;
11174
- const handleChange = (e) => {
11175
- const newValue = Number(e.target.value);
11176
- if (!isControlled) {
11177
- setInternalValue(newValue);
11346
+ const isRangeControlled = rangeValue !== void 0;
11347
+ const currentRange = isRangeControlled ? rangeValue : internalRange;
11348
+ const rangeMin = clamp5(currentRange[0] ?? min, min, max);
11349
+ const rangeMax = clamp5(currentRange[1] ?? max, min, max);
11350
+ const normalizedRange = rangeMin <= rangeMax ? [rangeMin, rangeMax] : [rangeMax, rangeMin];
11351
+ const handleSingleChange = React34.useCallback(
11352
+ (e) => {
11353
+ const newValue = Number(e.target.value);
11354
+ if (!isControlled) {
11355
+ setInternalValue(newValue);
11356
+ }
11357
+ onChange?.(newValue);
11358
+ onValueChange?.(newValue);
11359
+ },
11360
+ [isControlled, onChange, onValueChange]
11361
+ );
11362
+ const emitRange = React34.useCallback(
11363
+ (next) => {
11364
+ onRangeChange?.(next);
11365
+ onRangeValueChange?.(next);
11366
+ },
11367
+ [onRangeChange, onRangeValueChange]
11368
+ );
11369
+ const handleRangeChange = React34.useCallback(
11370
+ (thumb) => (e) => {
11371
+ const nextVal = Number(e.target.value);
11372
+ const [curMin, curMax] = normalizedRange;
11373
+ const next = thumb === "min" ? [Math.min(nextVal, curMax), curMax] : [curMin, Math.max(nextVal, curMin)];
11374
+ if (!isRangeControlled) setInternalRange(next);
11375
+ emitRange(next);
11376
+ },
11377
+ [emitRange, isRangeControlled, normalizedRange]
11378
+ );
11379
+ const denom = Math.max(1e-9, max - min);
11380
+ const percentage = (currentValue - min) / denom * 100;
11381
+ const rangeStartPct = (normalizedRange[0] - min) / denom * 100;
11382
+ const rangeEndPct = (normalizedRange[1] - min) / denom * 100;
11383
+ const sizeStyles8 = SIZE_STYLES[size];
11384
+ const displayValue = React34.useMemo(() => {
11385
+ if (isRange) {
11386
+ const a = formatValue ? formatValue(normalizedRange[0]) : normalizedRange[0].toString();
11387
+ const b = formatValue ? formatValue(normalizedRange[1]) : normalizedRange[1].toString();
11388
+ return `${a} \u2013 ${b}`;
11389
+ }
11390
+ return formatValue ? formatValue(currentValue) : currentValue.toString();
11391
+ }, [currentValue, formatValue, isRange, normalizedRange]);
11392
+ const quantize = React34.useCallback(
11393
+ (v) => {
11394
+ const stepped = Math.round((v - min) / step) * step + min;
11395
+ const fixed = Number(stepped.toFixed(10));
11396
+ return clamp5(fixed, min, max);
11397
+ },
11398
+ [max, min, step]
11399
+ );
11400
+ const valueFromClientX = React34.useCallback(
11401
+ (clientX) => {
11402
+ const el = trackRef.current;
11403
+ if (!el) return min;
11404
+ const rect = el.getBoundingClientRect();
11405
+ const x = clamp5(clientX - rect.left, 0, rect.width);
11406
+ const ratio = rect.width <= 0 ? 0 : x / rect.width;
11407
+ return quantize(min + ratio * (max - min));
11408
+ },
11409
+ [max, min, quantize]
11410
+ );
11411
+ const startRangeDrag = (e) => {
11412
+ if (!isRange) return;
11413
+ if (disabled) return;
11414
+ if (orientation !== "horizontal") return;
11415
+ if (e.button !== 0) return;
11416
+ const nextValue = valueFromClientX(e.clientX);
11417
+ const [curMin, curMax] = normalizedRange;
11418
+ const distToMin = Math.abs(nextValue - curMin);
11419
+ const distToMax = Math.abs(nextValue - curMax);
11420
+ const thumb = distToMin <= distToMax ? "min" : "max";
11421
+ setActiveThumb(thumb);
11422
+ dragRef.current = { pointerId: e.pointerId, thumb };
11423
+ try {
11424
+ e.currentTarget.setPointerCapture(e.pointerId);
11425
+ } catch {
11426
+ }
11427
+ const next = thumb === "min" ? [Math.min(nextValue, curMax), curMax] : [curMin, Math.max(nextValue, curMin)];
11428
+ if (!isRangeControlled) setInternalRange(next);
11429
+ emitRange(next);
11430
+ };
11431
+ const moveRangeDrag = (e) => {
11432
+ const drag = dragRef.current;
11433
+ if (!drag) return;
11434
+ if (e.pointerId !== drag.pointerId) return;
11435
+ const nextValue = valueFromClientX(e.clientX);
11436
+ const [curMin, curMax] = normalizedRange;
11437
+ const next = drag.thumb === "min" ? [Math.min(nextValue, curMax), curMax] : [curMin, Math.max(nextValue, curMin)];
11438
+ if (!isRangeControlled) setInternalRange(next);
11439
+ emitRange(next);
11440
+ };
11441
+ const endRangeDrag = (e) => {
11442
+ const drag = dragRef.current;
11443
+ if (!drag) return;
11444
+ if (e.pointerId !== drag.pointerId) return;
11445
+ dragRef.current = null;
11446
+ onMouseUp?.();
11447
+ onTouchEnd?.();
11448
+ try {
11449
+ e.currentTarget.releasePointerCapture(e.pointerId);
11450
+ } catch {
11178
11451
  }
11179
- onChange?.(newValue);
11180
- onValueChange?.(newValue);
11181
11452
  };
11182
- const percentage = (currentValue - min) / (max - min) * 100;
11183
- const sizeStyles8 = SIZE_STYLES[size];
11184
- const displayValue = formatValue ? formatValue(currentValue) : currentValue.toString();
11185
11453
  if (orientation === "vertical") {
11186
11454
  }
11187
11455
  return /* @__PURE__ */ jsxs36("div", { className: cn("w-full space-y-2", containerClassName), children: [
@@ -11189,65 +11457,129 @@ var Slider = React34.forwardRef(
11189
11457
  label && /* @__PURE__ */ jsx41("label", { className: cn("text-sm font-medium text-foreground", labelClassName), children: label }),
11190
11458
  showValue && /* @__PURE__ */ jsx41("span", { className: cn("text-xs font-mono text-muted-foreground min-w-8 text-right", valueClassName), children: displayValue })
11191
11459
  ] }),
11192
- /* @__PURE__ */ jsxs36("div", { className: cn("relative flex items-center", sizeStyles8.container), children: [
11193
- /* @__PURE__ */ jsx41("div", { className: cn("w-full rounded-full bg-secondary relative overflow-hidden", sizeStyles8.track, trackClassName), children: /* @__PURE__ */ jsx41("div", { className: "absolute left-0 top-0 h-full bg-primary rounded-full", style: { width: `${percentage}%` } }) }),
11194
- /* @__PURE__ */ jsx41(
11195
- "input",
11460
+ /* @__PURE__ */ jsxs36("div", { ref: trackRef, className: cn("relative flex items-center", sizeStyles8.container), children: [
11461
+ /* @__PURE__ */ jsx41("div", { className: cn("w-full rounded-full bg-secondary relative overflow-hidden", sizeStyles8.track, trackClassName), children: isRange ? /* @__PURE__ */ jsx41(
11462
+ "div",
11196
11463
  {
11197
- ref,
11198
- type: "range",
11199
- min,
11200
- max,
11201
- step,
11202
- value: currentValue,
11203
- onChange: handleChange,
11204
- onMouseUp,
11205
- onTouchEnd,
11206
- disabled,
11207
- className: cn(
11208
- // Base styles
11209
- "absolute w-full h-full appearance-none bg-transparent cursor-pointer",
11210
- !noFocus && "focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:ring-offset-background rounded-full",
11211
- noFocus && "outline-none ring-0 focus:outline-none focus:ring-0 focus-visible:outline-none",
11212
- // Webkit styles for thumb
11213
- "[&::-webkit-slider-thumb]:appearance-none",
11214
- "[&::-webkit-slider-thumb]:bg-primary",
11215
- "[&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-background",
11216
- "[&::-webkit-slider-thumb]:rounded-full",
11217
- "[&::-webkit-slider-thumb]:shadow-md",
11218
- "[&::-webkit-slider-thumb]:cursor-pointer",
11219
- "[&::-webkit-slider-thumb]:transition-all [&::-webkit-slider-thumb]:duration-150",
11220
- size === "sm" && "[&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3",
11221
- size === "md" && "[&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4",
11222
- size === "lg" && "[&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:h-5",
11223
- // Firefox styles for thumb
11224
- "[&::-moz-range-thumb]:bg-primary",
11225
- "[&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-background",
11226
- "[&::-moz-range-thumb]:rounded-full",
11227
- "[&::-moz-range-thumb]:shadow-md",
11228
- "[&::-moz-range-thumb]:cursor-pointer",
11229
- "[&::-moz-range-thumb]:transition-all [&::-moz-range-thumb]:duration-150",
11230
- size === "sm" && "[&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3",
11231
- size === "md" && "[&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:h-4",
11232
- size === "lg" && "[&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:h-5",
11233
- // Remove default track in Firefox
11234
- "[&::-moz-range-track]:bg-transparent",
11235
- "[&::-moz-range-track]:border-transparent",
11236
- // Hover effects
11237
- "hover:[&::-webkit-slider-thumb]:scale-110 hover:[&::-webkit-slider-thumb]:shadow-lg",
11238
- "hover:[&::-moz-range-thumb]:scale-110 hover:[&::-moz-range-thumb]:shadow-lg",
11239
- // Disabled styles
11240
- disabled && [
11241
- "cursor-not-allowed opacity-50",
11242
- "[&::-webkit-slider-thumb]:cursor-not-allowed [&::-webkit-slider-thumb]:opacity-50",
11243
- "[&::-moz-range-thumb]:cursor-not-allowed [&::-moz-range-thumb]:opacity-50"
11244
- ],
11245
- className,
11246
- thumbClassName
11247
- ),
11248
- ...props
11464
+ className: "absolute top-0 h-full bg-primary rounded-full",
11465
+ style: { left: `${rangeStartPct}%`, width: `${Math.max(0, rangeEndPct - rangeStartPct)}%` }
11249
11466
  }
11250
- )
11467
+ ) : /* @__PURE__ */ jsx41("div", { className: "absolute left-0 top-0 h-full bg-primary rounded-full", style: { width: `${percentage}%` } }) }),
11468
+ (() => {
11469
+ const baseInputClassName = cn(
11470
+ // Base styles
11471
+ "absolute w-full h-full appearance-none bg-transparent cursor-pointer",
11472
+ !noFocus && "focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:ring-offset-background rounded-full",
11473
+ noFocus && "outline-none ring-0 focus:outline-none focus:ring-0 focus-visible:outline-none",
11474
+ // Webkit styles for thumb
11475
+ "[&::-webkit-slider-thumb]:appearance-none",
11476
+ "[&::-webkit-slider-thumb]:bg-primary",
11477
+ "[&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-background",
11478
+ "[&::-webkit-slider-thumb]:rounded-full",
11479
+ "[&::-webkit-slider-thumb]:shadow-md",
11480
+ "[&::-webkit-slider-thumb]:cursor-pointer",
11481
+ "[&::-webkit-slider-thumb]:transition-all [&::-webkit-slider-thumb]:duration-150",
11482
+ size === "sm" && "[&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3",
11483
+ size === "md" && "[&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4",
11484
+ size === "lg" && "[&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:h-5",
11485
+ // Firefox styles for thumb
11486
+ "[&::-moz-range-thumb]:bg-primary",
11487
+ "[&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-background",
11488
+ "[&::-moz-range-thumb]:rounded-full",
11489
+ "[&::-moz-range-thumb]:shadow-md",
11490
+ "[&::-moz-range-thumb]:cursor-pointer",
11491
+ "[&::-moz-range-thumb]:transition-all [&::-moz-range-thumb]:duration-150",
11492
+ size === "sm" && "[&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3",
11493
+ size === "md" && "[&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:h-4",
11494
+ size === "lg" && "[&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:h-5",
11495
+ // Remove default track in Firefox
11496
+ "[&::-moz-range-track]:bg-transparent",
11497
+ "[&::-moz-range-track]:border-transparent",
11498
+ // Hover effects
11499
+ "hover:[&::-webkit-slider-thumb]:scale-110 hover:[&::-webkit-slider-thumb]:shadow-lg",
11500
+ "hover:[&::-moz-range-thumb]:scale-110 hover:[&::-moz-range-thumb]:shadow-lg",
11501
+ // Disabled styles
11502
+ disabled && [
11503
+ "cursor-not-allowed opacity-50",
11504
+ "[&::-webkit-slider-thumb]:cursor-not-allowed [&::-webkit-slider-thumb]:opacity-50",
11505
+ "[&::-moz-range-thumb]:cursor-not-allowed [&::-moz-range-thumb]:opacity-50"
11506
+ ],
11507
+ className,
11508
+ thumbClassName
11509
+ );
11510
+ if (!isRange) {
11511
+ return /* @__PURE__ */ jsx41(
11512
+ "input",
11513
+ {
11514
+ ref,
11515
+ type: "range",
11516
+ min,
11517
+ max,
11518
+ step,
11519
+ value: currentValue,
11520
+ onChange: handleSingleChange,
11521
+ onMouseUp,
11522
+ onTouchEnd,
11523
+ disabled,
11524
+ className: baseInputClassName,
11525
+ ...props
11526
+ }
11527
+ );
11528
+ }
11529
+ const minZ = activeThumb === "min" ? "z-20" : "z-10";
11530
+ const maxZ = activeThumb === "max" ? "z-20" : "z-10";
11531
+ return /* @__PURE__ */ jsxs36(Fragment14, { children: [
11532
+ /* @__PURE__ */ jsx41(
11533
+ "div",
11534
+ {
11535
+ className: cn("absolute inset-0 z-30", disabled ? "cursor-not-allowed" : "cursor-pointer"),
11536
+ onPointerDown: startRangeDrag,
11537
+ onPointerMove: moveRangeDrag,
11538
+ onPointerUp: endRangeDrag,
11539
+ onPointerCancel: endRangeDrag
11540
+ }
11541
+ ),
11542
+ /* @__PURE__ */ jsx41(
11543
+ "input",
11544
+ {
11545
+ ref,
11546
+ type: "range",
11547
+ min,
11548
+ max,
11549
+ step,
11550
+ value: normalizedRange[0],
11551
+ onChange: handleRangeChange("min"),
11552
+ onMouseUp,
11553
+ onTouchEnd,
11554
+ disabled,
11555
+ "aria-label": "Minimum value",
11556
+ onPointerDown: () => setActiveThumb("min"),
11557
+ onFocus: () => setActiveThumb("min"),
11558
+ className: cn(baseInputClassName, minZ, "pointer-events-none"),
11559
+ ...props
11560
+ }
11561
+ ),
11562
+ /* @__PURE__ */ jsx41(
11563
+ "input",
11564
+ {
11565
+ type: "range",
11566
+ min,
11567
+ max,
11568
+ step,
11569
+ value: normalizedRange[1],
11570
+ onChange: handleRangeChange("max"),
11571
+ onMouseUp,
11572
+ onTouchEnd,
11573
+ disabled,
11574
+ "aria-label": "Maximum value",
11575
+ onPointerDown: () => setActiveThumb("max"),
11576
+ onFocus: () => setActiveThumb("max"),
11577
+ className: cn(baseInputClassName, maxZ, "pointer-events-none"),
11578
+ ...props
11579
+ }
11580
+ )
11581
+ ] });
11582
+ })()
11251
11583
  ] })
11252
11584
  ] });
11253
11585
  }
@@ -11257,7 +11589,7 @@ Slider.displayName = "Slider";
11257
11589
  // ../../components/ui/OverlayControls.tsx
11258
11590
  import { Dot as Dot2, Maximize2, Pause, Play, RotateCcw, RotateCw, Volume2, VolumeX } from "lucide-react";
11259
11591
  import React35 from "react";
11260
- import { Fragment as Fragment14, jsx as jsx42, jsxs as jsxs37 } from "react/jsx-runtime";
11592
+ import { Fragment as Fragment15, jsx as jsx42, jsxs as jsxs37 } from "react/jsx-runtime";
11261
11593
  function OverlayControls({
11262
11594
  mode,
11263
11595
  value,
@@ -11480,7 +11812,7 @@ function OverlayControls({
11480
11812
  const handleSliderMouseLeave = () => {
11481
11813
  setPreviewData(null);
11482
11814
  };
11483
- return /* @__PURE__ */ jsxs37(Fragment14, { children: [
11815
+ return /* @__PURE__ */ jsxs37(Fragment15, { children: [
11484
11816
  keyboardFeedback && /* @__PURE__ */ jsx42(
11485
11817
  "div",
11486
11818
  {
@@ -11690,7 +12022,7 @@ function OverlayControls({
11690
12022
  // ../../components/ui/CategoryTreeSelect.tsx
11691
12023
  import { useState as useState29, useEffect as useEffect19 } from "react";
11692
12024
  import { ChevronRight as ChevronRight6, ChevronDown as ChevronDown4, Check as Check6, FolderTree, Layers } from "lucide-react";
11693
- import { Fragment as Fragment15, jsx as jsx43, jsxs as jsxs38 } from "react/jsx-runtime";
12025
+ import { Fragment as Fragment16, jsx as jsx43, jsxs as jsxs38 } from "react/jsx-runtime";
11694
12026
  var defaultLabels = {
11695
12027
  emptyText: "No categories",
11696
12028
  selectedText: (count) => `${count} selected`
@@ -11927,7 +12259,7 @@ function CategoryTreeSelect(props) {
11927
12259
  ]
11928
12260
  }
11929
12261
  ),
11930
- isOpen && !disabled && /* @__PURE__ */ jsxs38(Fragment15, { children: [
12262
+ isOpen && !disabled && /* @__PURE__ */ jsxs38(Fragment16, { children: [
11931
12263
  /* @__PURE__ */ jsx43("div", { className: "fixed inset-0 z-10", onClick: () => setIsOpen(false) }),
11932
12264
  /* @__PURE__ */ jsx43(
11933
12265
  "div",
@@ -11947,7 +12279,7 @@ function CategoryTreeSelect(props) {
11947
12279
  }
11948
12280
 
11949
12281
  // ../../components/ui/ImageUpload.tsx
11950
- import { useState as useState30, useRef as useRef13, useCallback as useCallback10 } from "react";
12282
+ import { useState as useState30, useRef as useRef14, useCallback as useCallback11 } from "react";
11951
12283
  import { Upload, X as X12, Image as ImageIcon, Loader2 as Loader25, Check as Check7 } from "lucide-react";
11952
12284
  import { jsx as jsx44, jsxs as jsxs39 } from "react/jsx-runtime";
11953
12285
  function ImageUpload({
@@ -11968,7 +12300,7 @@ function ImageUpload({
11968
12300
  const [isDragging, setIsDragging] = useState30(false);
11969
12301
  const [uploading, setUploading] = useState30(false);
11970
12302
  const [uploadedImages, setUploadedImages] = useState30([]);
11971
- const fileInputRef = useRef13(null);
12303
+ const fileInputRef = useRef14(null);
11972
12304
  const { addToast } = useToast();
11973
12305
  const t = useTranslations("OCR.imageUpload");
11974
12306
  const previewSizes = {
@@ -11976,7 +12308,7 @@ function ImageUpload({
11976
12308
  md: "w-24 h-24",
11977
12309
  lg: "w-32 h-32"
11978
12310
  };
11979
- const handleDragOver = useCallback10(
12311
+ const handleDragOver = useCallback11(
11980
12312
  (e) => {
11981
12313
  e.preventDefault();
11982
12314
  if (!disabled) {
@@ -11985,11 +12317,11 @@ function ImageUpload({
11985
12317
  },
11986
12318
  [disabled]
11987
12319
  );
11988
- const handleDragLeave = useCallback10((e) => {
12320
+ const handleDragLeave = useCallback11((e) => {
11989
12321
  e.preventDefault();
11990
12322
  setIsDragging(false);
11991
12323
  }, []);
11992
- const handleFiles = useCallback10(
12324
+ const handleFiles = useCallback11(
11993
12325
  async (files) => {
11994
12326
  if (files.length === 0) return;
11995
12327
  const validFiles = files.filter((file) => {
@@ -12056,7 +12388,7 @@ function ImageUpload({
12056
12388
  },
12057
12389
  [maxSize, addToast, onUpload]
12058
12390
  );
12059
- const handleDrop = useCallback10(
12391
+ const handleDrop = useCallback11(
12060
12392
  (e) => {
12061
12393
  e.preventDefault();
12062
12394
  setIsDragging(false);
@@ -12066,7 +12398,7 @@ function ImageUpload({
12066
12398
  },
12067
12399
  [disabled, handleFiles]
12068
12400
  );
12069
- const handleFileSelect = useCallback10(
12401
+ const handleFileSelect = useCallback11(
12070
12402
  (e) => {
12071
12403
  const files = Array.from(e.target.files || []);
12072
12404
  handleFiles(files);
@@ -12171,7 +12503,7 @@ function ImageUpload({
12171
12503
  // ../../components/ui/Carousel.tsx
12172
12504
  import * as React37 from "react";
12173
12505
  import { ChevronLeft as ChevronLeft5, ChevronRight as ChevronRight7 } from "lucide-react";
12174
- import { Fragment as Fragment16, jsx as jsx45, jsxs as jsxs40 } from "react/jsx-runtime";
12506
+ import { Fragment as Fragment17, jsx as jsx45, jsxs as jsxs40 } from "react/jsx-runtime";
12175
12507
  function Carousel({
12176
12508
  children,
12177
12509
  autoScroll = true,
@@ -12383,7 +12715,7 @@ function Carousel({
12383
12715
  ))
12384
12716
  }
12385
12717
  ),
12386
- showArrows && totalSlides > slidesToShow && /* @__PURE__ */ jsxs40(Fragment16, { children: [
12718
+ showArrows && totalSlides > slidesToShow && /* @__PURE__ */ jsxs40(Fragment17, { children: [
12387
12719
  /* @__PURE__ */ jsx45(
12388
12720
  Button_default,
12389
12721
  {
@@ -12745,7 +13077,7 @@ function FallingIcons({
12745
13077
  // ../../components/ui/List.tsx
12746
13078
  import * as React39 from "react";
12747
13079
  import { ChevronRight as ChevronRight8 } from "lucide-react";
12748
- import { Fragment as Fragment17, jsx as jsx47, jsxs as jsxs42 } from "react/jsx-runtime";
13080
+ import { Fragment as Fragment18, jsx as jsx47, jsxs as jsxs42 } from "react/jsx-runtime";
12749
13081
  var SIZE_STYLES2 = {
12750
13082
  xs: { label: "text-xs", desc: "text-[11px]", icon: "h-3.5 w-3.5", avatar: "h-6 w-6" },
12751
13083
  sm: { label: "text-[13px]", desc: "text-[12px]", icon: "h-4 w-4", avatar: "h-8 w-8" },
@@ -12897,7 +13229,7 @@ var ListItem = React39.forwardRef(
12897
13229
  }
12898
13230
  }
12899
13231
  } : {};
12900
- const inner = /* @__PURE__ */ jsxs42(Fragment17, { children: [
13232
+ const inner = /* @__PURE__ */ jsxs42(Fragment18, { children: [
12901
13233
  /* @__PURE__ */ jsxs42("div", { className: cn("flex items-center gap-3", contentClassName, "group/item relative"), ...headerProps, children: [
12902
13234
  avatar && /* @__PURE__ */ jsx47("div", { className: cn("shrink-0", sz.avatar), children: typeof avatar === "string" ? /* @__PURE__ */ jsx47("img", { src: avatar, alt: "", className: cn("rounded-full object-cover", sz.avatar) }) : avatar }),
12903
13235
  Left && !avatar && /* @__PURE__ */ jsx47("span", { className: cn("text-muted-foreground shrink-0", sz.icon), children: /* @__PURE__ */ jsx47(Left, { className: cn(sz.icon) }) }),
@@ -12942,7 +13274,7 @@ var List_default = List;
12942
13274
  // ../../components/ui/Watermark.tsx
12943
13275
  import * as React40 from "react";
12944
13276
  import { createPortal as createPortal5 } from "react-dom";
12945
- import { Fragment as Fragment18, jsx as jsx48, jsxs as jsxs43 } from "react/jsx-runtime";
13277
+ import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs43 } from "react/jsx-runtime";
12946
13278
  var PRESETS2 = {
12947
13279
  confidential: { text: "CONFIDENTIAL", color: "rgba(220, 38, 38, 0.15)", rotate: -22, fontSize: 16, fontWeight: "bold" },
12948
13280
  draft: { text: "DRAFT", color: "rgba(59, 130, 246, 0.15)", rotate: -22, fontSize: 18, fontWeight: "bold" },
@@ -13221,7 +13553,7 @@ var Watermark = ({
13221
13553
  }
13222
13554
  );
13223
13555
  if (fullPage) {
13224
- return /* @__PURE__ */ jsxs43(Fragment18, { children: [
13556
+ return /* @__PURE__ */ jsxs43(Fragment19, { children: [
13225
13557
  children,
13226
13558
  typeof window !== "undefined" ? createPortal5(overlay, document.body) : null
13227
13559
  ] });
@@ -13513,7 +13845,7 @@ var Timeline_default = Timeline;
13513
13845
  import * as React42 from "react";
13514
13846
  import { Pipette, X as X13, Copy, Check as Check8, Palette, History } from "lucide-react";
13515
13847
  import { jsx as jsx50, jsxs as jsxs45 } from "react/jsx-runtime";
13516
- var clamp5 = (n, min, max) => Math.max(min, Math.min(max, n));
13848
+ var clamp6 = (n, min, max) => Math.max(min, Math.min(max, n));
13517
13849
  function hexToRgb(hex) {
13518
13850
  const str = hex.replace(/^#/, "").trim();
13519
13851
  if (str.length === 3) {
@@ -13531,7 +13863,7 @@ function hexToRgb(hex) {
13531
13863
  return null;
13532
13864
  }
13533
13865
  function rgbToHex(r, g, b) {
13534
- return `#${[r, g, b].map((v) => clamp5(Math.round(v), 0, 255).toString(16).padStart(2, "0")).join("")}`;
13866
+ return `#${[r, g, b].map((v) => clamp6(Math.round(v), 0, 255).toString(16).padStart(2, "0")).join("")}`;
13535
13867
  }
13536
13868
  function rgbToHsl(r, g, b) {
13537
13869
  r /= 255;
@@ -13592,10 +13924,10 @@ function parseAnyColor(input) {
13592
13924
  }
13593
13925
  const rgbaMatch = s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(\d*\.?\d+))?\s*\)/i);
13594
13926
  if (rgbaMatch) {
13595
- const r = clamp5(parseInt(rgbaMatch[1], 10), 0, 255);
13596
- const g = clamp5(parseInt(rgbaMatch[2], 10), 0, 255);
13597
- const b = clamp5(parseInt(rgbaMatch[3], 10), 0, 255);
13598
- const a = rgbaMatch[4] != null ? clamp5(parseFloat(rgbaMatch[4]), 0, 1) : 1;
13927
+ const r = clamp6(parseInt(rgbaMatch[1], 10), 0, 255);
13928
+ const g = clamp6(parseInt(rgbaMatch[2], 10), 0, 255);
13929
+ const b = clamp6(parseInt(rgbaMatch[3], 10), 0, 255);
13930
+ const a = rgbaMatch[4] != null ? clamp6(parseFloat(rgbaMatch[4]), 0, 1) : 1;
13599
13931
  return { r, g, b, a };
13600
13932
  }
13601
13933
  const hslaMatch = s.match(/hsla?\(\s*(\d{1,3}(?:\.\d+)?)\s*,?\s*(\d{1,3}(?:\.\d+)?)%?\s*,?\s*(\d{1,3}(?:\.\d+)?)%?(?:\s*,?\s*(\d*\.?\d+))?\s*\)/i);
@@ -13603,7 +13935,7 @@ function parseAnyColor(input) {
13603
13935
  const h = parseFloat(hslaMatch[1]);
13604
13936
  const sl = parseFloat(hslaMatch[2]);
13605
13937
  const l = parseFloat(hslaMatch[3]);
13606
- const a = hslaMatch[4] != null ? clamp5(parseFloat(hslaMatch[4]), 0, 1) : 1;
13938
+ const a = hslaMatch[4] != null ? clamp6(parseFloat(hslaMatch[4]), 0, 1) : 1;
13607
13939
  const rgb = hslToRgb(h, sl, l);
13608
13940
  return { ...rgb, a };
13609
13941
  }
@@ -13616,12 +13948,12 @@ function formatOutput({ r, g, b, a }, withAlpha, format) {
13616
13948
  if (format === "hsl" || format === "hsla") {
13617
13949
  const hsl = rgbToHsl(r, g, b);
13618
13950
  if (format === "hsla" || withAlpha) {
13619
- return `hsla(${Math.round(hsl.h)}, ${Math.round(hsl.s)}%, ${Math.round(hsl.l)}%, ${clamp5(a, 0, 1)})`;
13951
+ return `hsla(${Math.round(hsl.h)}, ${Math.round(hsl.s)}%, ${Math.round(hsl.l)}%, ${clamp6(a, 0, 1)})`;
13620
13952
  }
13621
13953
  return `hsl(${Math.round(hsl.h)}, ${Math.round(hsl.s)}%, ${Math.round(hsl.l)}%)`;
13622
13954
  }
13623
13955
  if (withAlpha || a !== 1) {
13624
- return `rgba(${clamp5(r, 0, 255)}, ${clamp5(g, 0, 255)}, ${clamp5(b, 0, 255)}, ${clamp5(a, 0, 1)})`;
13956
+ return `rgba(${clamp6(r, 0, 255)}, ${clamp6(g, 0, 255)}, ${clamp6(b, 0, 255)}, ${clamp6(a, 0, 1)})`;
13625
13957
  }
13626
13958
  return rgbToHex(r, g, b);
13627
13959
  }
@@ -13755,7 +14087,7 @@ function ColorPicker({
13755
14087
  emit(next);
13756
14088
  };
13757
14089
  const setAlpha = (aPct) => {
13758
- const a = clamp5(aPct / 100, 0, 1);
14090
+ const a = clamp6(aPct / 100, 0, 1);
13759
14091
  const next = { ...rgba, a };
13760
14092
  setRgba(next);
13761
14093
  emit(next);
@@ -14033,7 +14365,7 @@ function ColorPicker({
14033
14365
 
14034
14366
  // ../../components/ui/Grid.tsx
14035
14367
  import React43, { useId as useId7 } from "react";
14036
- import { Fragment as Fragment19, jsx as jsx51, jsxs as jsxs46 } from "react/jsx-runtime";
14368
+ import { Fragment as Fragment20, jsx as jsx51, jsxs as jsxs46 } from "react/jsx-runtime";
14037
14369
  var BP_MIN = {
14038
14370
  sm: 640,
14039
14371
  md: 768,
@@ -14190,7 +14522,7 @@ var GridItem = React43.forwardRef(
14190
14522
  st.opacity = 0;
14191
14523
  st.animation = `uvGridItemFadeIn 0.5s ease-out forwards`;
14192
14524
  }
14193
- return /* @__PURE__ */ jsxs46(Fragment19, { children: [
14525
+ return /* @__PURE__ */ jsxs46(Fragment20, { children: [
14194
14526
  animationDelay != null && /* @__PURE__ */ jsx51(
14195
14527
  "style",
14196
14528
  {
@@ -14220,12 +14552,12 @@ var Grid = Object.assign(GridRoot, { Item: GridItem });
14220
14552
  var Grid_default = Grid;
14221
14553
 
14222
14554
  // ../../components/ui/LineChart.tsx
14223
- import { useMemo as useMemo13, useState as useState37, useRef as useRef15 } from "react";
14555
+ import { useMemo as useMemo14, useState as useState37, useRef as useRef16 } from "react";
14224
14556
 
14225
14557
  // ../../components/ui/ChartTooltip.tsx
14226
14558
  import { useEffect as useEffect23, useState as useState36 } from "react";
14227
14559
  import { createPortal as createPortal6 } from "react-dom";
14228
- import { Fragment as Fragment20, jsx as jsx52, jsxs as jsxs47 } from "react/jsx-runtime";
14560
+ import { Fragment as Fragment21, jsx as jsx52, jsxs as jsxs47 } from "react/jsx-runtime";
14229
14561
  function ChartTooltip({ x, y, visible, label, value, color, secondaryLabel, secondaryValue, items, containerRef }) {
14230
14562
  const [isMounted, setIsMounted] = useState36(false);
14231
14563
  const [position, setPosition] = useState36(null);
@@ -14272,7 +14604,7 @@ function ChartTooltip({ x, y, visible, label, value, color, secondaryLabel, seco
14272
14604
  ":"
14273
14605
  ] }),
14274
14606
  /* @__PURE__ */ jsx52("span", { className: "font-semibold ml-auto", children: item.value })
14275
- ] }, i)) }) : /* @__PURE__ */ jsxs47(Fragment20, { children: [
14607
+ ] }, i)) }) : /* @__PURE__ */ jsxs47(Fragment21, { children: [
14276
14608
  /* @__PURE__ */ jsxs47("div", { className: "flex items-center gap-2", children: [
14277
14609
  color && /* @__PURE__ */ jsx52("div", { className: "w-2 h-2 rounded-full shrink-0", style: { backgroundColor: color } }),
14278
14610
  /* @__PURE__ */ jsx52("span", { className: "font-semibold", children: value })
@@ -14299,7 +14631,7 @@ function ChartTooltip({ x, y, visible, label, value, color, secondaryLabel, seco
14299
14631
  }
14300
14632
 
14301
14633
  // ../../components/ui/LineChart.tsx
14302
- import { Fragment as Fragment21, jsx as jsx53, jsxs as jsxs48 } from "react/jsx-runtime";
14634
+ import { Fragment as Fragment22, jsx as jsx53, jsxs as jsxs48 } from "react/jsx-runtime";
14303
14635
  function LineChart({
14304
14636
  data,
14305
14637
  width = 400,
@@ -14314,12 +14646,12 @@ function LineChart({
14314
14646
  curved = true,
14315
14647
  className = ""
14316
14648
  }) {
14317
- const svgRef = useRef15(null);
14649
+ const svgRef = useRef16(null);
14318
14650
  const padding = { top: 20, right: 20, bottom: 40, left: 40 };
14319
14651
  const chartWidth = width - padding.left - padding.right;
14320
14652
  const chartHeight = height - padding.top - padding.bottom;
14321
14653
  const [hoveredPoint, setHoveredPoint] = useState37(null);
14322
- const { minValue, maxValue, points, linePath, areaPath } = useMemo13(() => {
14654
+ const { minValue, maxValue, points, linePath, areaPath } = useMemo14(() => {
14323
14655
  if (!data.length) return { minValue: 0, maxValue: 0, points: [], linePath: "", areaPath: "" };
14324
14656
  const values = data.map((d) => d.value);
14325
14657
  const min = Math.min(...values);
@@ -14354,7 +14686,7 @@ function LineChart({
14354
14686
  }
14355
14687
  return { minValue: min, maxValue: max, points: pts, linePath: path, areaPath: area };
14356
14688
  }, [data, chartWidth, chartHeight, curved, padding.left, padding.top]);
14357
- const gridLines = useMemo13(() => {
14689
+ const gridLines = useMemo14(() => {
14358
14690
  const lines = [];
14359
14691
  const steps = 5;
14360
14692
  for (let i = 0; i <= steps; i++) {
@@ -14364,7 +14696,7 @@ function LineChart({
14364
14696
  }
14365
14697
  return lines;
14366
14698
  }, [minValue, maxValue, chartHeight, padding.top]);
14367
- return /* @__PURE__ */ jsxs48(Fragment21, { children: [
14699
+ return /* @__PURE__ */ jsxs48(Fragment22, { children: [
14368
14700
  /* @__PURE__ */ jsxs48("svg", { ref: svgRef, width, height, className: `overflow-visible ${className}`, style: { fontFamily: "inherit" }, children: [
14369
14701
  showGrid && /* @__PURE__ */ jsx53("g", { className: "text-muted-foreground/20", children: gridLines.map((line, i) => /* @__PURE__ */ jsxs48("g", { children: [
14370
14702
  /* @__PURE__ */ jsx53("line", { x1: padding.left, y1: line.y, x2: width - padding.right, y2: line.y, stroke: "currentColor", strokeDasharray: "4 4" }),
@@ -14472,8 +14804,8 @@ function LineChart({
14472
14804
  }
14473
14805
 
14474
14806
  // ../../components/ui/BarChart.tsx
14475
- import { useMemo as useMemo14, useState as useState38, useRef as useRef16 } from "react";
14476
- import { Fragment as Fragment22, jsx as jsx54, jsxs as jsxs49 } from "react/jsx-runtime";
14807
+ import { useMemo as useMemo15, useState as useState38, useRef as useRef17 } from "react";
14808
+ import { Fragment as Fragment23, jsx as jsx54, jsxs as jsxs49 } from "react/jsx-runtime";
14477
14809
  function BarChart({
14478
14810
  data,
14479
14811
  width = 400,
@@ -14488,12 +14820,12 @@ function BarChart({
14488
14820
  barGap = 0.3,
14489
14821
  className = ""
14490
14822
  }) {
14491
- const svgRef = useRef16(null);
14823
+ const svgRef = useRef17(null);
14492
14824
  const padding = horizontal ? { top: 20, right: 40, bottom: 20, left: 80 } : { top: 20, right: 20, bottom: 40, left: 40 };
14493
14825
  const chartWidth = width - padding.left - padding.right;
14494
14826
  const chartHeight = height - padding.top - padding.bottom;
14495
14827
  const [hoveredBar, setHoveredBar] = useState38(null);
14496
- const { maxValue, bars, gridLines } = useMemo14(() => {
14828
+ const { maxValue, bars, gridLines } = useMemo15(() => {
14497
14829
  if (!data.length) return { maxValue: 0, bars: [], gridLines: [] };
14498
14830
  const max = Math.max(...data.map((d) => d.value));
14499
14831
  const barCount = data.length;
@@ -14542,12 +14874,12 @@ function BarChart({
14542
14874
  }
14543
14875
  return { maxValue: max, bars: barsData, gridLines: lines };
14544
14876
  }, [data, chartWidth, chartHeight, horizontal, barGap, padding, width, height]);
14545
- return /* @__PURE__ */ jsxs49(Fragment22, { children: [
14877
+ return /* @__PURE__ */ jsxs49(Fragment23, { children: [
14546
14878
  /* @__PURE__ */ jsxs49("svg", { ref: svgRef, width, height, className: `overflow-visible ${className}`, style: { fontFamily: "inherit" }, children: [
14547
- showGrid && /* @__PURE__ */ jsx54("g", { className: "text-muted-foreground/20", children: gridLines.map((line, i) => /* @__PURE__ */ jsx54("g", { children: horizontal ? /* @__PURE__ */ jsxs49(Fragment22, { children: [
14879
+ showGrid && /* @__PURE__ */ jsx54("g", { className: "text-muted-foreground/20", children: gridLines.map((line, i) => /* @__PURE__ */ jsx54("g", { children: horizontal ? /* @__PURE__ */ jsxs49(Fragment23, { children: [
14548
14880
  /* @__PURE__ */ jsx54("line", { x1: line.x, y1: line.y1, x2: line.x, y2: line.y2, stroke: "currentColor", strokeDasharray: "4 4" }),
14549
14881
  /* @__PURE__ */ jsx54("text", { x: line.x, y: height - 8, textAnchor: "middle", fontSize: "10", className: "text-muted-foreground", fill: "currentColor", children: line.value.toFixed(0) })
14550
- ] }) : /* @__PURE__ */ jsxs49(Fragment22, { children: [
14882
+ ] }) : /* @__PURE__ */ jsxs49(Fragment23, { children: [
14551
14883
  /* @__PURE__ */ jsx54("line", { x1: line.x1, y1: line.y, x2: line.x2, y2: line.y, stroke: "currentColor", strokeDasharray: "4 4" }),
14552
14884
  /* @__PURE__ */ jsx54("text", { x: padding.left - 8, y: line.y + 4, textAnchor: "end", fontSize: "10", className: "text-muted-foreground", fill: "currentColor", children: line.value.toFixed(0) })
14553
14885
  ] }) }, i)) }),
@@ -14654,7 +14986,7 @@ function BarChart({
14654
14986
  }
14655
14987
 
14656
14988
  // ../../components/ui/PieChart.tsx
14657
- import { useMemo as useMemo15, useState as useState39, useRef as useRef17 } from "react";
14989
+ import { useMemo as useMemo16, useState as useState39, useRef as useRef18 } from "react";
14658
14990
  import { jsx as jsx55, jsxs as jsxs50 } from "react/jsx-runtime";
14659
14991
  function PieChart({
14660
14992
  data,
@@ -14668,11 +15000,11 @@ function PieChart({
14668
15000
  startAngle = -90,
14669
15001
  className = ""
14670
15002
  }) {
14671
- const containerRef = useRef17(null);
15003
+ const containerRef = useRef18(null);
14672
15004
  const center = size / 2;
14673
15005
  const radius = size / 2 - 10;
14674
15006
  const innerRadius = donut ? radius - donutWidth : 0;
14675
- const { segments, total } = useMemo15(() => {
15007
+ const { segments, total } = useMemo16(() => {
14676
15008
  if (!data.length) return { segments: [], total: 0 };
14677
15009
  const sum = data.reduce((acc, d) => acc + d.value, 0);
14678
15010
  let currentAngle = startAngle;
@@ -14819,7 +15151,7 @@ function PieChart({
14819
15151
  }
14820
15152
 
14821
15153
  // ../../components/ui/AreaChart.tsx
14822
- import { useMemo as useMemo16, useState as useState40, useRef as useRef18 } from "react";
15154
+ import { useMemo as useMemo17, useState as useState40, useRef as useRef19 } from "react";
14823
15155
  import { jsx as jsx56, jsxs as jsxs51 } from "react/jsx-runtime";
14824
15156
  function getCatmullRomSpline(points) {
14825
15157
  if (points.length < 2) return "";
@@ -14854,12 +15186,12 @@ function AreaChart({
14854
15186
  curved = true,
14855
15187
  className = ""
14856
15188
  }) {
14857
- const containerRef = useRef18(null);
15189
+ const containerRef = useRef19(null);
14858
15190
  const padding = { top: 20, right: 20, bottom: 40, left: 50 };
14859
15191
  const chartWidth = width - padding.left - padding.right;
14860
15192
  const chartHeight = height - padding.top - padding.bottom;
14861
15193
  const [hoveredPoint, setHoveredPoint] = useState40(null);
14862
- const { processedSeries, gridLines, maxValue, labels } = useMemo16(() => {
15194
+ const { processedSeries, gridLines, maxValue, labels } = useMemo17(() => {
14863
15195
  if (!series.length || !series[0]?.data?.length) {
14864
15196
  return { processedSeries: [], gridLines: [], maxValue: 0, labels: [] };
14865
15197
  }
@@ -15073,7 +15405,7 @@ function AreaChart({
15073
15405
  }
15074
15406
 
15075
15407
  // ../../components/ui/Sparkline.tsx
15076
- import { useMemo as useMemo17 } from "react";
15408
+ import { useMemo as useMemo18 } from "react";
15077
15409
  import { jsx as jsx57, jsxs as jsxs52 } from "react/jsx-runtime";
15078
15410
  function getCatmullRomSpline2(points) {
15079
15411
  if (points.length < 2) return "";
@@ -15112,7 +15444,7 @@ function Sparkline({
15112
15444
  const padding = 4;
15113
15445
  const chartWidth = width - padding * 2;
15114
15446
  const chartHeight = height - padding * 2;
15115
- const { points, linePath, areaPath, lineLength, trend } = useMemo17(() => {
15447
+ const { points, linePath, areaPath, lineLength, trend } = useMemo18(() => {
15116
15448
  const normalizedData = data.map((d) => typeof d === "number" ? d : d.value);
15117
15449
  if (!normalizedData.length) {
15118
15450
  return { points: [], linePath: "", areaPath: "", lineLength: 0, trend: 0 };
@@ -15216,7 +15548,7 @@ function Sparkline({
15216
15548
  }
15217
15549
 
15218
15550
  // ../../components/ui/RadarChart.tsx
15219
- import { useMemo as useMemo18, useState as useState41, useRef as useRef19 } from "react";
15551
+ import { useMemo as useMemo19, useState as useState41, useRef as useRef20 } from "react";
15220
15552
  import { jsx as jsx58, jsxs as jsxs53 } from "react/jsx-runtime";
15221
15553
  function RadarChart({
15222
15554
  series,
@@ -15228,11 +15560,11 @@ function RadarChart({
15228
15560
  animated = true,
15229
15561
  className = ""
15230
15562
  }) {
15231
- const containerRef = useRef19(null);
15563
+ const containerRef = useRef20(null);
15232
15564
  const center = size / 2;
15233
15565
  const radius = size / 2 - 40;
15234
15566
  const [hoveredPoint, setHoveredPoint] = useState41(null);
15235
- const { axes, processedSeries, levelPaths } = useMemo18(() => {
15567
+ const { axes, processedSeries, levelPaths } = useMemo19(() => {
15236
15568
  if (!series.length || !series[0]?.data?.length) {
15237
15569
  return { axes: [], processedSeries: [], levelPaths: [] };
15238
15570
  }
@@ -15416,7 +15748,7 @@ function RadarChart({
15416
15748
  }
15417
15749
 
15418
15750
  // ../../components/ui/GaugeChart.tsx
15419
- import { useMemo as useMemo19 } from "react";
15751
+ import { useMemo as useMemo20 } from "react";
15420
15752
  import { jsx as jsx59, jsxs as jsxs54 } from "react/jsx-runtime";
15421
15753
  function GaugeChart({
15422
15754
  value,
@@ -15436,7 +15768,7 @@ function GaugeChart({
15436
15768
  }) {
15437
15769
  const center = size / 2;
15438
15770
  const radius = center - thickness / 2 - 10;
15439
- const { backgroundPath, valuePath, percentage, needleAngle } = useMemo19(() => {
15771
+ const { backgroundPath, valuePath, percentage, needleAngle } = useMemo20(() => {
15440
15772
  const normalizedValue = Math.min(Math.max(value, min), max);
15441
15773
  const pct = (normalizedValue - min) / (max - min);
15442
15774
  const totalAngle = endAngle - startAngle;
@@ -15585,16 +15917,16 @@ function GaugeChart({
15585
15917
 
15586
15918
  // ../../components/ui/ClientOnly.tsx
15587
15919
  import { useEffect as useEffect24, useState as useState42 } from "react";
15588
- import { Fragment as Fragment23, jsx as jsx60 } from "react/jsx-runtime";
15920
+ import { Fragment as Fragment24, jsx as jsx60 } from "react/jsx-runtime";
15589
15921
  function ClientOnly({ children, fallback = null }) {
15590
15922
  const [hasMounted, setHasMounted] = useState42(false);
15591
15923
  useEffect24(() => {
15592
15924
  setHasMounted(true);
15593
15925
  }, []);
15594
15926
  if (!hasMounted) {
15595
- return /* @__PURE__ */ jsx60(Fragment23, { children: fallback });
15927
+ return /* @__PURE__ */ jsx60(Fragment24, { children: fallback });
15596
15928
  }
15597
- return /* @__PURE__ */ jsx60(Fragment23, { children });
15929
+ return /* @__PURE__ */ jsx60(Fragment24, { children });
15598
15930
  }
15599
15931
 
15600
15932
  // ../../components/ui/Loading.tsx
@@ -16236,7 +16568,7 @@ function validateColumns(columns) {
16236
16568
  }
16237
16569
 
16238
16570
  // ../../components/ui/DataTable/DataTable.tsx
16239
- import { Fragment as Fragment24, jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
16571
+ import { Fragment as Fragment25, jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
16240
16572
  function DataTable({
16241
16573
  columns,
16242
16574
  data,
@@ -16474,17 +16806,17 @@ function DataTable({
16474
16806
  isCenterAlign && "justify-center",
16475
16807
  !isRightAlign && !isCenterAlign && "justify-start"
16476
16808
  ),
16477
- children: isRightAlign ? /* @__PURE__ */ jsxs59(Fragment24, { children: [
16809
+ children: isRightAlign ? /* @__PURE__ */ jsxs59(Fragment25, { children: [
16478
16810
  filterContent,
16479
16811
  titleContent
16480
- ] }) : /* @__PURE__ */ jsxs59(Fragment24, { children: [
16812
+ ] }) : /* @__PURE__ */ jsxs59(Fragment25, { children: [
16481
16813
  titleContent,
16482
16814
  filterContent
16483
16815
  ] })
16484
16816
  }
16485
16817
  );
16486
16818
  };
16487
- const renderHeader = /* @__PURE__ */ jsx65(Fragment24, { children: headerRows.map((row, rowIndex) => /* @__PURE__ */ jsx65(TableRow, { children: row.map((headerCell, cellIndex) => {
16819
+ const renderHeader = /* @__PURE__ */ jsx65(Fragment25, { children: headerRows.map((row, rowIndex) => /* @__PURE__ */ jsx65(TableRow, { children: row.map((headerCell, cellIndex) => {
16488
16820
  const { column: col, colSpan, rowSpan, isLeaf } = headerCell;
16489
16821
  const prevCell = cellIndex > 0 ? row[cellIndex - 1] : null;
16490
16822
  const prevCol = prevCell?.column;
@@ -16973,9 +17305,9 @@ function AccessDenied({
16973
17305
 
16974
17306
  // ../../components/ui/ThemeToggleHeadless.tsx
16975
17307
  import { Moon as Moon2, Sun as Sun2, Monitor } from "lucide-react";
16976
- import { useEffect as useEffect26, useRef as useRef20, useState as useState43 } from "react";
17308
+ import { useEffect as useEffect26, useRef as useRef21, useState as useState43 } from "react";
16977
17309
  import { createPortal as createPortal7 } from "react-dom";
16978
- import { Fragment as Fragment25, jsx as jsx70, jsxs as jsxs64 } from "react/jsx-runtime";
17310
+ import { Fragment as Fragment26, jsx as jsx70, jsxs as jsxs64 } from "react/jsx-runtime";
16979
17311
  function ThemeToggleHeadless({
16980
17312
  theme,
16981
17313
  onChange,
@@ -16984,7 +17316,7 @@ function ThemeToggleHeadless({
16984
17316
  }) {
16985
17317
  const [isOpen, setIsOpen] = useState43(false);
16986
17318
  const [mounted, setMounted] = useState43(false);
16987
- const triggerRef = useRef20(null);
17319
+ const triggerRef = useRef21(null);
16988
17320
  const [dropdownPosition, setDropdownPosition] = useState43(null);
16989
17321
  useEffect26(() => setMounted(true), []);
16990
17322
  const themes = [
@@ -17026,7 +17358,7 @@ function ThemeToggleHeadless({
17026
17358
  children: /* @__PURE__ */ jsx70(CurrentIcon, { className: "h-5 w-5" })
17027
17359
  }
17028
17360
  ),
17029
- isOpen && /* @__PURE__ */ jsxs64(Fragment25, { children: [
17361
+ isOpen && /* @__PURE__ */ jsxs64(Fragment26, { children: [
17030
17362
  typeof window !== "undefined" && createPortal7(/* @__PURE__ */ jsx70("div", { className: "fixed inset-0 z-9998", onClick: () => setIsOpen(false) }), document.body),
17031
17363
  typeof window !== "undefined" && dropdownPosition && createPortal7(
17032
17364
  /* @__PURE__ */ jsx70(
@@ -17075,10 +17407,10 @@ function ThemeToggleHeadless({
17075
17407
  }
17076
17408
 
17077
17409
  // ../../components/ui/LanguageSwitcherHeadless.tsx
17078
- import { useRef as useRef21, useState as useState44 } from "react";
17410
+ import { useRef as useRef22, useState as useState44 } from "react";
17079
17411
  import { createPortal as createPortal8 } from "react-dom";
17080
17412
  import { Globe } from "lucide-react";
17081
- import { Fragment as Fragment26, jsx as jsx71, jsxs as jsxs65 } from "react/jsx-runtime";
17413
+ import { Fragment as Fragment27, jsx as jsx71, jsxs as jsxs65 } from "react/jsx-runtime";
17082
17414
  function LanguageSwitcherHeadless({
17083
17415
  locales,
17084
17416
  currentLocale,
@@ -17088,7 +17420,7 @@ function LanguageSwitcherHeadless({
17088
17420
  }) {
17089
17421
  const [isOpen, setIsOpen] = useState44(false);
17090
17422
  const [dropdownPosition, setDropdownPosition] = useState44(null);
17091
- const triggerButtonRef = useRef21(null);
17423
+ const triggerButtonRef = useRef22(null);
17092
17424
  const currentLanguage = locales.find((l) => l.code === currentLocale) || locales[0];
17093
17425
  const calculatePosition = () => {
17094
17426
  const rect = triggerButtonRef.current?.getBoundingClientRect();
@@ -17123,7 +17455,7 @@ function LanguageSwitcherHeadless({
17123
17455
  children: /* @__PURE__ */ jsx71(Globe, { className: "h-5 w-5" })
17124
17456
  }
17125
17457
  ),
17126
- isOpen && /* @__PURE__ */ jsxs65(Fragment26, { children: [
17458
+ isOpen && /* @__PURE__ */ jsxs65(Fragment27, { children: [
17127
17459
  typeof window !== "undefined" && createPortal8(/* @__PURE__ */ jsx71("div", { className: "fixed inset-0 z-9998", onClick: () => setIsOpen(false) }), document.body),
17128
17460
  typeof window !== "undefined" && dropdownPosition && createPortal8(
17129
17461
  /* @__PURE__ */ jsx71(
@@ -18039,7 +18371,7 @@ function useSmartLocale() {
18039
18371
  }
18040
18372
 
18041
18373
  // ../../components/ui/UEditor/UEditor.tsx
18042
- import { useEffect as useEffect31, useMemo as useMemo22 } from "react";
18374
+ import { useEffect as useEffect31, useMemo as useMemo23 } from "react";
18043
18375
  import { useTranslations as useTranslations7 } from "next-intl";
18044
18376
  import { useEditor, EditorContent } from "@tiptap/react";
18045
18377
 
@@ -18082,7 +18414,7 @@ import { common, createLowlight } from "lowlight";
18082
18414
  import { Extension } from "@tiptap/core";
18083
18415
  import Suggestion from "@tiptap/suggestion";
18084
18416
  import { ReactRenderer } from "@tiptap/react";
18085
- import { forwardRef as forwardRef13, useEffect as useEffect27, useImperativeHandle, useRef as useRef22, useState as useState45 } from "react";
18417
+ import { forwardRef as forwardRef13, useEffect as useEffect27, useImperativeHandle, useRef as useRef23, useState as useState45 } from "react";
18086
18418
  import {
18087
18419
  FileCode,
18088
18420
  Heading1,
@@ -18100,7 +18432,7 @@ import tippy from "tippy.js";
18100
18432
  import { jsx as jsx74, jsxs as jsxs66 } from "react/jsx-runtime";
18101
18433
  var CommandList = forwardRef13((props, ref) => {
18102
18434
  const [selectedIndex, setSelectedIndex] = useState45(0);
18103
- const listRef = useRef22(null);
18435
+ const listRef = useRef23(null);
18104
18436
  useEffect27(() => {
18105
18437
  setSelectedIndex(0);
18106
18438
  }, [props.items]);
@@ -18413,7 +18745,7 @@ var ClipboardImages = Extension2.create({
18413
18745
  });
18414
18746
 
18415
18747
  // ../../components/ui/UEditor/resizable-image.tsx
18416
- import { useEffect as useEffect28, useRef as useRef23, useState as useState46 } from "react";
18748
+ import { useEffect as useEffect28, useRef as useRef24, useState as useState46 } from "react";
18417
18749
  import Image3 from "@tiptap/extension-image";
18418
18750
  import { mergeAttributes } from "@tiptap/core";
18419
18751
  import { NodeViewWrapper, ReactNodeViewRenderer } from "@tiptap/react";
@@ -18428,19 +18760,19 @@ function toNullableNumber(value) {
18428
18760
  }
18429
18761
  return null;
18430
18762
  }
18431
- function clamp6(value, min, max) {
18763
+ function clamp7(value, min, max) {
18432
18764
  return Math.min(max, Math.max(min, value));
18433
18765
  }
18434
18766
  function ResizableImageNodeView(props) {
18435
18767
  const { node, selected, updateAttributes, editor, getPos } = props;
18436
- const wrapperRef = useRef23(null);
18437
- const imgRef = useRef23(null);
18768
+ const wrapperRef = useRef24(null);
18769
+ const imgRef = useRef24(null);
18438
18770
  const [isHovered, setIsHovered] = useState46(false);
18439
18771
  const [isResizing, setIsResizing] = useState46(false);
18440
18772
  const widthAttr = toNullableNumber(node.attrs["width"]);
18441
18773
  const heightAttr = toNullableNumber(node.attrs["height"]);
18442
18774
  const textAlign = String(node.attrs["textAlign"] ?? "");
18443
- const dragStateRef = useRef23(null);
18775
+ const dragStateRef = useRef24(null);
18444
18776
  useEffect28(() => {
18445
18777
  const img = imgRef.current;
18446
18778
  if (!img) return;
@@ -18490,18 +18822,18 @@ function ResizableImageNodeView(props) {
18490
18822
  let nextH = drag.startH;
18491
18823
  if (event.ctrlKey) {
18492
18824
  if (Math.abs(dx) >= Math.abs(dy)) {
18493
- nextW = clamp6(drag.startW + dx, MIN_IMAGE_SIZE_PX, drag.maxW);
18494
- nextH = clamp6(nextW / drag.aspect, MIN_IMAGE_SIZE_PX, Number.POSITIVE_INFINITY);
18825
+ nextW = clamp7(drag.startW + dx, MIN_IMAGE_SIZE_PX, drag.maxW);
18826
+ nextH = clamp7(nextW / drag.aspect, MIN_IMAGE_SIZE_PX, Number.POSITIVE_INFINITY);
18495
18827
  } else {
18496
- nextH = clamp6(drag.startH + dy, MIN_IMAGE_SIZE_PX, Number.POSITIVE_INFINITY);
18497
- nextW = clamp6(nextH * drag.aspect, MIN_IMAGE_SIZE_PX, drag.maxW);
18828
+ nextH = clamp7(drag.startH + dy, MIN_IMAGE_SIZE_PX, Number.POSITIVE_INFINITY);
18829
+ nextW = clamp7(nextH * drag.aspect, MIN_IMAGE_SIZE_PX, drag.maxW);
18498
18830
  }
18499
18831
  } else {
18500
18832
  if (!drag.axis && (Math.abs(dx) > AXIS_LOCK_THRESHOLD_PX || Math.abs(dy) > AXIS_LOCK_THRESHOLD_PX)) {
18501
18833
  drag.axis = Math.abs(dx) >= Math.abs(dy) ? "x" : "y";
18502
18834
  }
18503
- if (drag.axis === "x") nextW = clamp6(drag.startW + dx, MIN_IMAGE_SIZE_PX, drag.maxW);
18504
- if (drag.axis === "y") nextH = clamp6(drag.startH + dy, MIN_IMAGE_SIZE_PX, Number.POSITIVE_INFINITY);
18835
+ if (drag.axis === "x") nextW = clamp7(drag.startW + dx, MIN_IMAGE_SIZE_PX, drag.maxW);
18836
+ if (drag.axis === "y") nextH = clamp7(drag.startH + dy, MIN_IMAGE_SIZE_PX, Number.POSITIVE_INFINITY);
18505
18837
  }
18506
18838
  drag.lastW = nextW;
18507
18839
  drag.lastH = nextH;
@@ -18733,7 +19065,7 @@ function buildUEditorExtensions({
18733
19065
  }
18734
19066
 
18735
19067
  // ../../components/ui/UEditor/toolbar.tsx
18736
- import React65, { useRef as useRef25, useState as useState48 } from "react";
19068
+ import React65, { useRef as useRef26, useState as useState48 } from "react";
18737
19069
  import { useTranslations as useTranslations4 } from "next-intl";
18738
19070
  import {
18739
19071
  AlignCenter,
@@ -18771,13 +19103,13 @@ import {
18771
19103
  } from "lucide-react";
18772
19104
 
18773
19105
  // ../../components/ui/UEditor/colors.tsx
18774
- import { useMemo as useMemo20 } from "react";
19106
+ import { useMemo as useMemo21 } from "react";
18775
19107
  import { useTranslations as useTranslations2 } from "next-intl";
18776
19108
  import { X as X14 } from "lucide-react";
18777
19109
  import { jsx as jsx76, jsxs as jsxs68 } from "react/jsx-runtime";
18778
19110
  var useEditorColors = () => {
18779
19111
  const t = useTranslations2("UEditor");
18780
- const textColors = useMemo20(
19112
+ const textColors = useMemo21(
18781
19113
  () => [
18782
19114
  { name: t("colors.default"), color: "inherit", cssClass: "text-foreground" },
18783
19115
  { name: t("colors.muted"), color: "var(--muted-foreground)", cssClass: "text-muted-foreground" },
@@ -18790,7 +19122,7 @@ var useEditorColors = () => {
18790
19122
  ],
18791
19123
  [t]
18792
19124
  );
18793
- const highlightColors = useMemo20(
19125
+ const highlightColors = useMemo21(
18794
19126
  () => [
18795
19127
  { name: t("colors.default"), color: "", cssClass: "" },
18796
19128
  { name: t("colors.muted"), color: "var(--muted)", cssClass: "bg-muted" },
@@ -18835,7 +19167,7 @@ var EditorColorPalette = ({
18835
19167
  ] });
18836
19168
 
18837
19169
  // ../../components/ui/UEditor/inputs.tsx
18838
- import { useEffect as useEffect29, useRef as useRef24, useState as useState47 } from "react";
19170
+ import { useEffect as useEffect29, useRef as useRef25, useState as useState47 } from "react";
18839
19171
  import { useTranslations as useTranslations3 } from "next-intl";
18840
19172
  import { Check as Check9, X as X15 } from "lucide-react";
18841
19173
  import { jsx as jsx77, jsxs as jsxs69 } from "react/jsx-runtime";
@@ -18853,7 +19185,7 @@ var LinkInput = ({
18853
19185
  }) => {
18854
19186
  const t = useTranslations3("UEditor");
18855
19187
  const [url, setUrl] = useState47(initialUrl);
18856
- const inputRef = useRef24(null);
19188
+ const inputRef = useRef25(null);
18857
19189
  useEffect29(() => {
18858
19190
  inputRef.current?.focus();
18859
19191
  inputRef.current?.select();
@@ -18883,7 +19215,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
18883
19215
  const t = useTranslations3("UEditor");
18884
19216
  const [url, setUrl] = useState47("");
18885
19217
  const [alt, setAlt] = useState47("");
18886
- const inputRef = useRef24(null);
19218
+ const inputRef = useRef25(null);
18887
19219
  useEffect29(() => {
18888
19220
  inputRef.current?.focus();
18889
19221
  }, []);
@@ -18937,7 +19269,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
18937
19269
  };
18938
19270
 
18939
19271
  // ../../components/ui/UEditor/toolbar.tsx
18940
- import { Fragment as Fragment27, jsx as jsx78, jsxs as jsxs70 } from "react/jsx-runtime";
19272
+ import { Fragment as Fragment28, jsx as jsx78, jsxs as jsxs70 } from "react/jsx-runtime";
18941
19273
  function fileToDataUrl2(file) {
18942
19274
  return new Promise((resolve, reject) => {
18943
19275
  const reader = new FileReader();
@@ -18985,7 +19317,7 @@ var EditorToolbar = ({
18985
19317
  const t = useTranslations4("UEditor");
18986
19318
  const { textColors, highlightColors } = useEditorColors();
18987
19319
  const [showImageInput, setShowImageInput] = useState48(false);
18988
- const fileInputRef = useRef25(null);
19320
+ const fileInputRef = useRef26(null);
18989
19321
  const [isUploadingImage, setIsUploadingImage] = useState48(false);
18990
19322
  const [imageUploadError, setImageUploadError] = useState48(null);
18991
19323
  const insertImageFiles = async (files) => {
@@ -19294,7 +19626,7 @@ var EditorToolbar = ({
19294
19626
  },
19295
19627
  onCancel: () => setShowImageInput(false)
19296
19628
  }
19297
- ) : /* @__PURE__ */ jsxs70(Fragment27, { children: [
19629
+ ) : /* @__PURE__ */ jsxs70(Fragment28, { children: [
19298
19630
  /* @__PURE__ */ jsx78(DropdownMenuItem, { icon: LinkIcon, label: t("imageInput.addFromUrl"), onClick: () => setShowImageInput(true) }),
19299
19631
  /* @__PURE__ */ jsx78(
19300
19632
  DropdownMenuItem,
@@ -19404,7 +19736,7 @@ var EditorToolbar = ({
19404
19736
  };
19405
19737
 
19406
19738
  // ../../components/ui/UEditor/menus.tsx
19407
- import { useCallback as useCallback13, useEffect as useEffect30, useMemo as useMemo21, useRef as useRef26, useState as useState49 } from "react";
19739
+ import { useCallback as useCallback14, useEffect as useEffect30, useMemo as useMemo22, useRef as useRef27, useState as useState49 } from "react";
19408
19740
  import { createPortal as createPortal9 } from "react-dom";
19409
19741
  import { useTranslations as useTranslations5 } from "next-intl";
19410
19742
  import {
@@ -19434,8 +19766,8 @@ import { jsx as jsx79, jsxs as jsxs71 } from "react/jsx-runtime";
19434
19766
  var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
19435
19767
  const t = useTranslations5("UEditor");
19436
19768
  const [selectedIndex, setSelectedIndex] = useState49(0);
19437
- const menuRef = useRef26(null);
19438
- const allCommands = useMemo21(
19769
+ const menuRef = useRef27(null);
19770
+ const allCommands = useMemo22(
19439
19771
  () => [
19440
19772
  {
19441
19773
  icon: Type3,
@@ -19506,7 +19838,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
19506
19838
  ],
19507
19839
  [editor, t]
19508
19840
  );
19509
- const commands = useMemo21(() => {
19841
+ const commands = useMemo22(() => {
19510
19842
  if (!filterText) return allCommands;
19511
19843
  const lowerFilter = filterText.toLowerCase();
19512
19844
  return allCommands.filter((cmd) => cmd.label.toLowerCase().includes(lowerFilter) || cmd.description.toLowerCase().includes(lowerFilter));
@@ -19518,7 +19850,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
19518
19850
  const selectedElement = menuRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
19519
19851
  selectedElement?.scrollIntoView({ block: "nearest" });
19520
19852
  }, [selectedIndex]);
19521
- const selectCommand = useCallback13(
19853
+ const selectCommand = useCallback14(
19522
19854
  (index) => {
19523
19855
  const command = commands[index];
19524
19856
  if (command) {
@@ -19741,9 +20073,9 @@ var BubbleMenuContent = ({
19741
20073
  var CustomBubbleMenu = ({ editor }) => {
19742
20074
  const [isVisible, setIsVisible] = useState49(false);
19743
20075
  const [position, setPosition] = useState49({ top: 0, left: 0 });
19744
- const menuRef = useRef26(null);
19745
- const keepOpenRef = useRef26(false);
19746
- const setKeepOpen = useCallback13((next) => {
20076
+ const menuRef = useRef27(null);
20077
+ const keepOpenRef = useRef27(false);
20078
+ const setKeepOpen = useCallback14((next) => {
19747
20079
  keepOpenRef.current = next;
19748
20080
  if (next) setIsVisible(true);
19749
20081
  }, []);
@@ -19898,7 +20230,7 @@ var UEditor = ({
19898
20230
  }) => {
19899
20231
  const t = useTranslations7("UEditor");
19900
20232
  const effectivePlaceholder = placeholder ?? t("placeholder");
19901
- const extensions = useMemo22(
20233
+ const extensions = useMemo23(
19902
20234
  () => buildUEditorExtensions({ placeholder: effectivePlaceholder, maxCharacters, uploadImage, imageInsertMode, editable }),
19903
20235
  [effectivePlaceholder, maxCharacters, uploadImage, imageInsertMode, editable]
19904
20236
  );