'use strict';

var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var LocalUI = require('../core/LocalUI.js');
var photoFilters = require('./photoFilters.js');
var photoOverlays = require('./photoOverlays.js');
var photoEditorTypes = require('./photoEditorTypes.js');
var FilterThumb = require('./FilterThumb.js');
var PhotoEditor_module = require('./PhotoEditor.module.css.js');

// ── Overlay Toolbar (extracted from the original inline function) ──
const OverlayToolbar = ({ api }) => {
    var _a, _b, _c, _d, _e;
    const { selectedOverlay, accent, t, updateOverlay, pushHistory, moveOverlayBack, moveOverlayForward, deleteOverlay } = api;
    if (!selectedOverlay)
        return null;
    return (jsxRuntime.jsxs("div", { className: PhotoEditor_module.overlayToolbar, children: [jsxRuntime.jsxs("span", { className: PhotoEditor_module.overlayToolbarLabel, children: [jsxRuntime.jsx("i", { className: "fa fa-object-group me-1" }), "Warstwa"] }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 0, max: 100, value: ((_a = selectedOverlay.opacity) !== null && _a !== void 0 ? _a : 1) * 100, onChange: e => updateOverlay(selectedOverlay.id, { opacity: Number(e.target.value) / 100 }), onMouseUp: pushHistory, accentColor: accent, style: { maxWidth: 70 }, title: t("photoEditor.opacity", "Opacity") }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValueSm, style: { color: accent }, children: [Math.round(((_b = selectedOverlay.opacity) !== null && _b !== void 0 ? _b : 1) * 100), "%"] }), selectedOverlay.type !== "drawing" && selectedOverlay.type !== "frame" && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(LocalUI.RangeInput, { min: 20, max: 500, value: ((_c = selectedOverlay.scaleX) !== null && _c !== void 0 ? _c : 1) * 100, onChange: e => {
                            const s = Number(e.target.value) / 100;
                            updateOverlay(selectedOverlay.id, { scaleX: s, scaleY: s });
                        }, onMouseUp: pushHistory, accentColor: accent, style: { maxWidth: 60 }, title: "Skala" }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValueSm, style: { color: "#aaa" }, children: [Math.round(((_d = selectedOverlay.scaleX) !== null && _d !== void 0 ? _d : 1) * 100), "%"] })] })), selectedOverlay.type !== "drawing" && selectedOverlay.type !== "frame" && (jsxRuntime.jsx(LocalUI.RangeInput, { min: -180, max: 180, value: (_e = selectedOverlay.rotation) !== null && _e !== void 0 ? _e : 0, onChange: e => updateOverlay(selectedOverlay.id, { rotation: Number(e.target.value) }), onMouseUp: pushHistory, accentColor: accent, style: { maxWidth: 60 }, title: t("photoEditor.rotation", "Rotation") })), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: () => moveOverlayBack(selectedOverlay.id), title: t("photoEditor.moveBack", "Move back"), className: PhotoEditor_module.overlayToolbarBtn, children: jsxRuntime.jsx("i", { className: "fa fa-arrow-down" }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: () => moveOverlayForward(selectedOverlay.id), title: t("photoEditor.moveForward", "Move forward"), className: PhotoEditor_module.overlayToolbarBtn, children: jsxRuntime.jsx("i", { className: "fa fa-arrow-up" }) }), jsxRuntime.jsx(LocalUI.Button, { variant: "outline-danger", size: "sm", onClick: () => deleteOverlay(selectedOverlay.id), className: PhotoEditor_module.overlayToolbarBtn, children: jsxRuntime.jsx("i", { className: "fa fa-trash" }) })] }));
};
// ── Left Panel ──
const PhotoEditorLeftPanel = React.memo(({ api }) => {
    var _a;
    const { t, accent, accentDim, activeTab, setActiveTab, setCropMode, 
    // Filters
    selectedFilter, setSelectedFilter, filterIntensity, setFilterIntensity, filterCategory, setFilterCategory, filteredList, generateThumbnail, pushHistory, 
    // Adjustments
    adjustments, handleAdjChange, handleAdjChangeEnd, 
    // Crop
    image, cropRect, setCropRect, cropAspect, setCropAspect, 
    // Transform
    rotation, setRotation, flipH, setFlipH, flipV, setFlipV, zoom, setZoom, 
    // Overlays
    overlays, setOverlays, selectedOverlayId, setSelectedOverlayId, addOverlay, deleteOverlay, mainCanvasRef, 
    // Stickers / Emoji
    emojiCat, setEmojiCat, 
    // Text
    textDraft, setTextDraft, textColor, setTextColor, textBold, setTextBold, textItalic, setTextItalic, textOutline, setTextOutline, textFontSize, setTextFontSize, textBg, setTextBg, selectedOverlay, updateOverlay, 
    // Shapes
    shapeStroke, setShapeStroke, shapeFill, setShapeFill, shapeStrokeW, setShapeStrokeW, 
    // Frame
    frameColor, setFrameColor, frameThick, setFrameThick, 
    // Drawing
    drawColor, setDrawColor, drawWidth, setDrawWidth, drawingOverlayRef, 
    // Creators
    createEmojiOverlay, createTextOverlay, createShapeOverlay, createFrameOverlay, } = api;
    return (jsxRuntime.jsxs("div", { className: PhotoEditor_module.leftPanel, children: [jsxRuntime.jsx("div", { className: PhotoEditor_module.tabBar, children: photoEditorTypes.TAB_DEFS.map(tab => (jsxRuntime.jsxs("button", { onClick: () => {
                        setActiveTab(tab.key);
                        if (tab.key === "crop")
                            setCropMode(true);
                        else
                            setCropMode(false);
                    }, title: tab.label, className: activeTab === tab.key ? PhotoEditor_module.tabButtonActive : PhotoEditor_module.tabButton, style: {
                        color: activeTab === tab.key ? accent : undefined,
                        borderBottomColor: activeTab === tab.key ? accent : undefined,
                    }, children: [jsxRuntime.jsx("i", { className: `fa ${tab.icon}`, style: { fontSize: 14 } }), tab.label] }, tab.key))) }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.panelContent, children: [activeTab === "filters" && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: PhotoEditor_module.pillRow, children: [
                                    { key: "all", label: "All" },
                                    { key: "color", label: "Color" },
                                    { key: "light", label: "Light" },
                                    { key: "vintage", label: "Vintage" },
                                    { key: "artistic", label: "Artistic" },
                                    { key: "fun", label: "Fun" },
                                ].map(cat => (jsxRuntime.jsx("button", { onClick: () => setFilterCategory(cat.key), className: filterCategory === cat.key ? PhotoEditor_module.pillActive : PhotoEditor_module.pill, style: {
                                        borderColor: filterCategory === cat.key ? accent : undefined,
                                        background: filterCategory === cat.key ? accentDim : undefined,
                                    }, children: cat.label }, cat.key))) }), jsxRuntime.jsx("div", { className: PhotoEditor_module.filterGrid, children: filteredList.map(filter => (jsxRuntime.jsx(FilterThumb, { filter: filter, selected: selectedFilter === filter.id, accent: accent, onSelect: () => {
                                        setSelectedFilter(filter.id);
                                        pushHistory();
                                    }, generateThumbnail: generateThumbnail }, filter.id))) }), selectedFilter !== "none" && (jsxRuntime.jsxs("div", { className: PhotoEditor_module.intensitySection, children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.intensityHeader, children: [jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderLabel, children: [jsxRuntime.jsx("i", { className: "fa fa-tachometer me-1" }), "Intensity"] }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValue, style: { color: accent }, children: [Math.round(filterIntensity * 100), "%"] })] }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 0, max: 100, value: filterIntensity * 100, onChange: e => setFilterIntensity(Number(e.target.value) / 100), onMouseUp: () => pushHistory(), accentColor: accent })] }))] })), activeTab === "adjust" && (jsxRuntime.jsxs("div", { className: PhotoEditor_module.adjustColumn, children: [photoEditorTypes.ADJUSTMENT_SLIDERS.map(sl => (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.adjustHeader, children: [jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderLabel, children: [jsxRuntime.jsx("i", { className: `fa ${sl.icon} me-1`, style: { width: 14, textAlign: "center" } }), sl.label] }), jsxRuntime.jsx("span", { className: PhotoEditor_module.adjustValue, style: { color: adjustments[sl.key] !== 0 ? accent : "#666" }, onClick: () => handleAdjChange(sl.key, sl.key === "blur" ? 0 : 0), title: "Reset", children: adjustments[sl.key] })] }), jsxRuntime.jsx(LocalUI.RangeInput, { min: sl.min, max: sl.max, value: adjustments[sl.key], onChange: e => handleAdjChange(sl.key, Number(e.target.value)), onMouseUp: handleAdjChangeEnd, accentColor: accent })] }, sl.key))), jsxRuntime.jsxs(LocalUI.Button, { variant: "outline-secondary", size: "sm", className: "mt-2", onClick: () => {
                                    handleAdjChange("brightness", 0);
                                    const defaults = { ...photoFilters.DEFAULT_ADJUSTMENTS };
                                    for (const key of Object.keys(defaults)) {
                                        handleAdjChange(key, defaults[key]);
                                    }
                                    pushHistory();
                                }, children: [jsxRuntime.jsx("i", { className: "fa fa-refresh me-1" }), "Resetuj korekty"] })] })), activeTab === "crop" && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.cropInfo, children: [jsxRuntime.jsx("i", { className: "fa fa-info-circle me-1" }), "Drag corners or edges to crop the photo."] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.cropAspectLabel, children: "Aspect ratio" }), jsxRuntime.jsx("div", { className: PhotoEditor_module.cropAspectRow, children: photoEditorTypes.ASPECT_RATIOS.map(ar => (jsxRuntime.jsx("button", { onClick: () => {
                                        setCropAspect(ar.value);
                                        if (ar.value && cropRect && image) {
                                            let newW = cropRect.w;
                                            let newH = cropRect.w / ar.value;
                                            if (newH > image.naturalHeight) {
                                                newH = image.naturalHeight;
                                                newW = newH * ar.value;
                                            }
                                            setCropRect({
                                                x: Math.max(0, cropRect.x),
                                                y: Math.max(0, cropRect.y),
                                                w: Math.min(newW, image.naturalWidth),
                                                h: Math.min(newH, image.naturalHeight),
                                            });
                                        }
                                    }, className: cropAspect === ar.value ? PhotoEditor_module.pillCropActive : PhotoEditor_module.pillCrop, style: {
                                        borderColor: cropAspect === ar.value ? accent : undefined,
                                        background: cropAspect === ar.value ? accentDim : undefined,
                                    }, children: ar.label }, ar.label))) }), jsxRuntime.jsxs(LocalUI.Button, { variant: "outline-secondary", size: "sm", className: "mt-3", onClick: () => {
                                    if (image) {
                                        setCropRect({ x: 0, y: 0, w: image.naturalWidth, h: image.naturalHeight });
                                        setCropAspect(null);
                                        pushHistory();
                                    }
                                }, children: [jsxRuntime.jsx("i", { className: "fa fa-expand me-1" }), "Resetuj kadrowanie"] })] })), activeTab === "transform" && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: PhotoEditor_module.sectionTitleMb8, children: "Rotation" }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.transformRow, children: [jsxRuntime.jsxs(LocalUI.Button, { variant: "dark", size: "sm", onClick: () => { setRotation((rotation - 90 + 360) % 360); pushHistory(); }, children: [jsxRuntime.jsx("i", { className: "fa fa-rotate-left me-1" }), " -90\u00B0"] }), jsxRuntime.jsxs(LocalUI.Button, { variant: "dark", size: "sm", onClick: () => { setRotation((rotation + 90) % 360); pushHistory(); }, children: [jsxRuntime.jsx("i", { className: "fa fa-rotate-right me-1" }), " +90\u00B0"] }), jsxRuntime.jsx(LocalUI.Button, { variant: "dark", size: "sm", onClick: () => { setRotation(0); pushHistory(); }, children: "0\u00B0" })] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.sectionTitleMb8, children: "Flip" }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.transformRow, children: [jsxRuntime.jsxs(LocalUI.Button, { variant: flipH ? "outline-info" : "dark", size: "sm", onClick: () => { setFlipH(!flipH); pushHistory(); }, children: [jsxRuntime.jsx("i", { className: "fa fa-arrows-h me-1" }), " Horizontal"] }), jsxRuntime.jsxs(LocalUI.Button, { variant: flipV ? "outline-info" : "dark", size: "sm", onClick: () => { setFlipV(!flipV); pushHistory(); }, children: [jsxRuntime.jsx("i", { className: "fa fa-arrows-v me-1" }), " Vertical"] })] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.sectionTitleMb8, children: "Preview zoom" }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.transformZoomRow, children: [jsxRuntime.jsx(LocalUI.RangeInput, { min: 50, max: 300, value: zoom * 100, onChange: e => setZoom(Number(e.target.value) / 100), accentColor: accent }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.transformZoomValue, style: { color: accent }, children: [Math.round(zoom * 100), "%"] })] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.transformInfo, children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Rotation:" }), " ", rotation, "\u00B0"] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Flip H:" }), " ", flipH ? "Yes" : "No"] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Flip V:" }), " ", flipV ? "Yes" : "No"] }), cropRect && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Crop:" }), " ", Math.round(cropRect.w), " \u00D7 ", Math.round(cropRect.h), " (", "x:", Math.round(cropRect.x), ", y:", Math.round(cropRect.y), ")"] }))] })] })), activeTab === "stickers" && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitle, children: [jsxRuntime.jsx("i", { className: "fa fa-smile-o me-1" }), " Stickers / Emoji"] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.pillRowGap3, children: photoOverlays.EMOJI_CATALOG.map(cat => (jsxRuntime.jsxs("button", { onClick: () => setEmojiCat(cat.id), className: emojiCat === cat.id ? PhotoEditor_module.pillEmojiActive : PhotoEditor_module.pillEmoji, style: {
                                        borderColor: emojiCat === cat.id ? accent : undefined,
                                        background: emojiCat === cat.id ? accentDim : undefined,
                                    }, children: [cat.icon, " ", cat.label] }, cat.id))) }), jsxRuntime.jsx("div", { className: PhotoEditor_module.emojiGrid, children: (_a = photoOverlays.EMOJI_CATALOG.find(c => c.id === emojiCat)) === null || _a === void 0 ? void 0 : _a.emojis.map((em, idx) => (jsxRuntime.jsx("button", { onClick: () => {
                                        var _a, _b, _c, _d;
                                        const cw = (_b = (_a = mainCanvasRef.current) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : 400;
                                        const ch = (_d = (_c = mainCanvasRef.current) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 400;
                                        addOverlay(createEmojiOverlay(em, cw, ch));
                                    }, className: PhotoEditor_module.emojiBtn, title: em, children: em }, idx))) }), overlays.length > 0 && (jsxRuntime.jsxs("div", { className: PhotoEditor_module.overlaySection, children: [jsxRuntime.jsxs("div", { className: PhotoEditor_module.overlaySectionTitle, children: ["Warstwy (", overlays.length, ")"] }), overlays.map(ov => (jsxRuntime.jsxs("div", { onClick: () => setSelectedOverlayId(ov.id), className: PhotoEditor_module.overlayItem, style: { background: selectedOverlayId === ov.id ? accentDim : undefined }, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.overlayIcon, children: ov.type === "emoji" ? ov.emoji
                                                    : ov.type === "text" ? "T"
                                                        : ov.type === "shape" ? "◆"
                                                            : ov.type === "drawing" ? "✏"
                                                                : "▢" }), jsxRuntime.jsx("span", { className: PhotoEditor_module.overlayName, children: ov.type === "text" ? ov.text.slice(0, 20)
                                                    : ov.type === "emoji" ? "Emoji"
                                                        : ov.type === "shape" ? ov.shapeKind
                                                            : ov.type === "drawing" ? `Rysunek (${ov.strokes.length})`
                                                                : ov.type === "frame" ? ov.frameStyle
                                                                    : "" }), jsxRuntime.jsx("button", { onClick: e => { e.stopPropagation(); deleteOverlay(ov.id); }, className: PhotoEditor_module.overlayDeleteBtn, children: "\u2715" })] }, ov.id)))] }))] })), activeTab === "text" && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitleMb8, children: [jsxRuntime.jsx("i", { className: "fa fa-font me-1" }), " ", t("photoEditor.addCaption", "Add caption")] }), jsxRuntime.jsx(LocalUI.TextArea, { rows: 2, value: textDraft, onChange: e => setTextDraft(e.target.value), placeholder: "Wpisz tekst...", className: PhotoEditor_module.textArea }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.textBtnRow, children: [jsxRuntime.jsx(LocalUI.Button, { variant: textBold ? "light" : "dark", size: "sm", onClick: () => setTextBold(!textBold), title: "Bold", className: PhotoEditor_module.textFormatBtn, style: { fontWeight: 700 }, children: "B" }), jsxRuntime.jsx(LocalUI.Button, { variant: textItalic ? "light" : "dark", size: "sm", onClick: () => setTextItalic(!textItalic), title: "Italic", className: PhotoEditor_module.textFormatBtn, style: { fontStyle: "italic" }, children: "I" }), jsxRuntime.jsx(LocalUI.Button, { variant: textOutline ? "light" : "dark", size: "sm", onClick: () => setTextOutline(!textOutline), title: "Kontur", className: PhotoEditor_module.textFormatBtn, children: "O" }), jsxRuntime.jsx(LocalUI.Button, { variant: textBg ? "light" : "dark", size: "sm", onClick: () => setTextBg(!textBg), title: t("photoEditor.background", "Background"), className: PhotoEditor_module.textFormatBtn, children: jsxRuntime.jsx("i", { className: "fa fa-square" }) }), jsxRuntime.jsx("input", { type: "color", value: textColor, onChange: e => setTextColor(e.target.value), className: PhotoEditor_module.colorInputLg, title: "Kolor tekstu" })] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sliderRow, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.sliderLabel, children: "Rozmiar:" }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 12, max: 120, value: textFontSize, onChange: e => setTextFontSize(Number(e.target.value)), accentColor: accent, style: { flex: 1 } }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValue, style: { color: accent }, children: [textFontSize, "px"] })] }), jsxRuntime.jsxs(LocalUI.Button, { size: "sm", className: PhotoEditor_module.accentBtn, style: { background: accent, borderColor: accent }, disabled: !textDraft.trim(), onClick: () => {
                                    const ov = createTextOverlay(textDraft);
                                    ov.color = textColor;
                                    ov.bold = textBold;
                                    ov.italic = textItalic;
                                    ov.fontSize = textFontSize;
                                    ov.outlineColor = textOutline ? "#000000" : null;
                                    ov.outlineWidth = textOutline ? 2 : 0;
                                    ov.background = textBg ? "rgba(0,0,0,0.5)" : null;
                                    addOverlay(ov);
                                }, children: [jsxRuntime.jsx("i", { className: "fa fa-plus me-1" }), " ", t("photoEditor.addText", "Add text")] }), (selectedOverlay === null || selectedOverlay === void 0 ? void 0 : selectedOverlay.type) === "text" && (jsxRuntime.jsxs("div", { className: PhotoEditor_module.editSelectedSection, children: [jsxRuntime.jsx("div", { className: PhotoEditor_module.editSelectedLabel, children: t("photoEditor.editSelectedText", "Edit selected text:") }), jsxRuntime.jsx(LocalUI.TextArea, { rows: 2, value: selectedOverlay.text, onChange: e => updateOverlay(selectedOverlay.id, { text: e.target.value }), onBlur: pushHistory, className: PhotoEditor_module.textAreaSm }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.textGapRow, children: [jsxRuntime.jsx("input", { type: "color", value: selectedOverlay.color, onChange: e => { updateOverlay(selectedOverlay.id, { color: e.target.value }); }, onBlur: pushHistory, className: PhotoEditor_module.colorInput, "aria-label": t("photoEditor.textColor", "Text overlay color") }), jsxRuntime.jsx(LocalUI.Button, { variant: selectedOverlay.bold ? "light" : "dark", size: "sm", onClick: () => { updateOverlay(selectedOverlay.id, { bold: !selectedOverlay.bold }); pushHistory(); }, className: PhotoEditor_module.textFormatBtnSm, style: { fontWeight: 700 }, children: "B" }), jsxRuntime.jsx(LocalUI.Button, { variant: selectedOverlay.italic ? "light" : "dark", size: "sm", onClick: () => { updateOverlay(selectedOverlay.id, { italic: !selectedOverlay.italic }); pushHistory(); }, className: PhotoEditor_module.textFormatBtnSm, style: { fontStyle: "italic" }, children: "I" })] })] }))] })), activeTab === "shapes" && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitle, children: [jsxRuntime.jsx("i", { className: "fa fa-star me-1" }), " Shapes"] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.shapeColorRow, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.shapeColorLabel, children: "Stroke:" }), jsxRuntime.jsx("input", { type: "color", value: shapeStroke, onChange: e => setShapeStroke(e.target.value), className: PhotoEditor_module.colorInput, title: "Stroke color" }), jsxRuntime.jsx("span", { className: PhotoEditor_module.shapeColorLabelMl, children: "Fill:" }), jsxRuntime.jsx("input", { type: "color", value: shapeFill || "#ffffff", onChange: e => setShapeFill(e.target.value), className: PhotoEditor_module.colorInput, title: t("photoEditor.fillColor", "Fill color") }), jsxRuntime.jsx(LocalUI.Button, { variant: shapeFill ? "light" : "dark", size: "sm", onClick: () => setShapeFill(shapeFill ? "" : "#ffffff"), className: PhotoEditor_module.shapeFillToggle, children: shapeFill ? "Off" : "On" })] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sliderRow, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.sliderLabel, children: "Width:" }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 1, max: 20, value: shapeStrokeW, onChange: e => setShapeStrokeW(Number(e.target.value)), accentColor: accent, style: { flex: 1 } }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValue, style: { color: accent }, children: [shapeStrokeW, "px"] })] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.shapeGrid, children: photoOverlays.SHAPE_CATALOG.map(sh => (jsxRuntime.jsx("button", { title: sh.label, onClick: () => {
                                        const ov = createShapeOverlay(sh.id);
                                        ov.strokeColor = shapeStroke;
                                        ov.fillColor = shapeFill || null;
                                        ov.strokeWidth = shapeStrokeW;
                                        addOverlay(ov);
                                    }, className: PhotoEditor_module.shapeBtn, children: sh.icon }, sh.id))) }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitle, children: [jsxRuntime.jsx("i", { className: "fa fa-picture-o me-1" }), " Ramki"] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.frameColorRow, children: [jsxRuntime.jsx("input", { type: "color", value: frameColor, onChange: e => setFrameColor(e.target.value), className: PhotoEditor_module.colorInput, "aria-label": t("photoEditor.frameColor", "Frame color") }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.frameThicknessWrap, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.sliderLabel, children: "Grub.:" }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 1, max: 10, value: frameThick, onChange: e => setFrameThick(Number(e.target.value)), accentColor: accent, style: { flex: 1 } }), jsxRuntime.jsx("span", { className: PhotoEditor_module.frameThicknessValue, style: { color: accent }, children: frameThick })] })] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.frameGrid, children: [photoOverlays.FRAME_CATALOG.map(fr => (jsxRuntime.jsx("button", { title: fr.label, onClick: () => {
                                            setOverlays((prev) => prev.filter(o => o.type !== "frame"));
                                            const ov = createFrameOverlay(fr.id, frameColor);
                                            ov.thickness = frameThick / 100;
                                            addOverlay(ov);
                                        }, className: PhotoEditor_module.frameBtn, children: fr.icon }, fr.id))), jsxRuntime.jsx("button", { title: t("photoEditor.removeFrame", "Remove frame"), onClick: () => { setOverlays((prev) => prev.filter(o => o.type !== "frame")); pushHistory(); }, className: PhotoEditor_module.removeFrameBtn, children: "\u2715" })] })] })), activeTab === "draw" && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(OverlayToolbar, { api: api }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionTitleMb8, children: [jsxRuntime.jsx("i", { className: "fa fa-paint-brush me-1" }), " Freehand drawing"] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sectionInfoMb, children: [jsxRuntime.jsx("i", { className: "fa fa-info-circle me-1" }), "Draw directly on the photo by holding the left mouse button."] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.quickColorRow, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.sliderLabel, children: "Color:" }), jsxRuntime.jsx("input", { type: "color", value: drawColor, onChange: e => setDrawColor(e.target.value), className: PhotoEditor_module.colorInputDraw, "aria-label": t("photoEditor.drawColor", "Drawing color") }), ["#ff0000", "#ff8800", "#ffff00", "#00cc00", "#0088ff", "#8800ff", "#ff00ff", "#ffffff", "#000000"].map(c => (jsxRuntime.jsx("div", { onClick: () => setDrawColor(c), className: PhotoEditor_module.quickColorSwatch, style: {
                                            background: c,
                                            border: drawColor === c ? `2px solid ${accent}` : undefined,
                                        } }, c)))] }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.sliderRow, style: { marginBottom: 12 }, children: [jsxRuntime.jsx("span", { className: PhotoEditor_module.sliderLabel, children: "Width:" }), jsxRuntime.jsx(LocalUI.RangeInput, { min: 1, max: 30, value: drawWidth, onChange: e => setDrawWidth(Number(e.target.value)), accentColor: accent, style: { flex: 1 } }), jsxRuntime.jsxs("span", { className: PhotoEditor_module.sliderValue, style: { color: accent }, children: [drawWidth, "px"] })] }), jsxRuntime.jsx("div", { className: PhotoEditor_module.drawPreview, children: jsxRuntime.jsx("div", { style: {
                                        width: Math.max(drawWidth, 4), height: Math.max(drawWidth, 4),
                                        borderRadius: "50%", background: drawColor,
                                        border: "1px solid #555",
                                    } }) }), jsxRuntime.jsxs("div", { className: PhotoEditor_module.drawActionRow, children: [jsxRuntime.jsxs(LocalUI.Button, { variant: "outline-warning", size: "sm", onClick: () => {
                                            if (drawingOverlayRef.current) {
                                                const id = drawingOverlayRef.current.id;
                                                setOverlays((prev) => prev.map(o => {
                                                    if (o.id === id && o.type === "drawing") {
                                                        const d = o;
                                                        if (d.strokes.length <= 1)
                                                            return o;
                                                        return { ...d, strokes: d.strokes.slice(0, -1) };
                                                    }
                                                    return o;
                                                }));
                                                pushHistory();
                                            }
                                        }, className: PhotoEditor_module.drawActionBtn, children: [jsxRuntime.jsx("i", { className: "fa fa-undo me-1" }), " Undo stroke"] }), jsxRuntime.jsxs(LocalUI.Button, { variant: "outline-danger", size: "sm", onClick: () => {
                                            if (drawingOverlayRef.current) {
                                                deleteOverlay(drawingOverlayRef.current.id);
                                                drawingOverlayRef.current = null;
                                            }
                                        }, className: PhotoEditor_module.drawActionBtn, children: [jsxRuntime.jsx("i", { className: "fa fa-trash me-1" }), " Clear"] })] }), jsxRuntime.jsxs(LocalUI.Button, { variant: "dark", size: "sm", className: "mt-2 w-100", onClick: () => {
                                    drawingOverlayRef.current = null;
                                }, children: [jsxRuntime.jsx("i", { className: "fa fa-plus me-1" }), " New drawing layer"] })] }))] })] }));
});
PhotoEditorLeftPanel.displayName = "PhotoEditorLeftPanel";

module.exports = PhotoEditorLeftPanel;
//# sourceMappingURL=PhotoEditorLeftPanel.js.map
