pixedi 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib/index.js CHANGED
@@ -1,56 +1,225 @@
1
- (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`._button_1vpzl_1{cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;box-sizing:border-box;background-color:#0000;border:1px solid #0000;border-radius:4px;justify-content:center;align-items:center;gap:8px;height:32px;padding:0 8px;font-family:inherit;font-size:14px;font-weight:500;transition:background-color .2s,border-color .2s,opacity .2s;display:inline-flex}._button_1vpzl_1:disabled{pointer-events:none;opacity:.5}._button_1vpzl_1 svg{flex-shrink:0;width:16px;height:16px}._default_1vpzl_35{background-color:var(--primary);color:var(--primary-foreground)}._default_1vpzl_35:hover{opacity:.9}._outline_1vpzl_44{border-color:var(--border);background-color:var(--background);color:var(--foreground)}._outline_1vpzl_44:hover{background-color:var(--secondary)}._ghost_1vpzl_54{color:var(--foreground);padding:0 8px}._ghost_1vpzl_54:hover{background-color:var(--secondary)}._rect_1vpzl_63{width:32px;height:32px}._separator_gp8ff_1{background-color:var(--border);box-sizing:border-box;border:none;flex-shrink:0;display:block}._separator_gp8ff_1[data-orientation=horizontal]{width:100%;height:1px}._separator_gp8ff_1[data-orientation=vertical]{align-self:stretch;width:1px;height:100%;margin:0}._wrapper_1aw0m_1{box-sizing:border-box;width:100%;position:relative}._trigger_1aw0m_6{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--border);cursor:pointer;box-sizing:border-box;-webkit-user-select:none;user-select:none;border-radius:4px;outline:none;justify-content:space-between;align-items:center;padding:0 8px 0 10px;font-family:inherit;font-size:14px;transition:border-color .2s;display:flex}._trigger_1aw0m_6:hover,._trigger_1aw0m_6:focus{border-color:var(--muted-foreground)}._triggerArrow_1aw0m_31{width:16px;height:16px;color:var(--muted-foreground);transition:transform .2s}._wrapper_1aw0m_1[data-state=open] ._triggerArrow_1aw0m_31{transform:rotate(180deg)}._content_1aw0m_40{background-color:var(--background);border:1px solid var(--border);z-index:50;box-sizing:border-box;border-radius:4px;width:100%;max-height:282px;padding:4px;position:absolute;top:calc(100% + 4px);left:0;overflow-y:auto;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d}._content_1aw0m_40::-webkit-scrollbar{width:4px}._content_1aw0m_40::-webkit-scrollbar-track{background:0 0}._content_1aw0m_40::-webkit-scrollbar-thumb{background-color:var(--border);border-radius:10px}._wrapper_1aw0m_1[data-state=closed] ._content_1aw0m_40{display:none}._groupLabel_1aw0m_74{color:var(--muted-foreground);-webkit-user-select:none;user-select:none;padding:8px 10px;font-size:12px;font-weight:500}._item_1aw0m_81{width:100%;color:var(--foreground);cursor:pointer;-webkit-user-select:none;user-select:none;box-sizing:border-box;background:0 0;border-radius:4px;justify-content:space-between;align-items:center;padding:4px 10px;display:flex}._item_1aw0m_81:hover{background-color:var(--secondary)}._itemLeft_1aw0m_98{font-size:14px;font-weight:400}._itemAddon_1aw0m_102{align-items:center;gap:8px;display:flex}._itemAddon_1aw0m_102 span{color:var(--muted-foreground);font-size:12px}._itemAddon_1aw0m_102 svg{font-size:14px}._itemAddon_1aw0m_102 b{flex-shrink:0;width:16px;height:16px}._itemRightContainer_1aw0m_122{align-items:center;gap:8px;display:flex}._itemRight_1aw0m_122{color:var(--muted-foreground);font-size:14px}._itemCheck_1aw0m_131{width:16px;height:16px;color:var(--foreground);flex-shrink:0}:host{height:100%;display:block}:host *{box-sizing:border-box}._root_1qifp_8{width:100%;height:100%;font-size:16px;font-family:var(--font-sans);--font-sans:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, Helvetica, Arial, sans-serif;--font-mono:"Courier New", Courier, monospace;--color-white:#fff;--color-white-fade:color-mix(in srgb, var(--color-white) 65%, transparent);--color-black:#000;--color-red:oklch(63.7% .237 25.331);--color-green:oklch(76.8% .188 151.716);--background:oklch(100% 0 0);--background-fade:color-mix(in srgb, var(--background) 65%, transparent);--foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(75.6% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--accent-blue:oklch(60.9% .221 251.687);--accent-blue-light:oklch(96% .02 250);--accent-blue-fade:color-mix(in srgb, var(--accent-blue) 60%, transparent);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 50%, transparent);--overlay-bg-white:color-mix(in srgb, var(--color-white) 80%, transparent);--surface-border:solid 1px transparent;position:relative}._root_1qifp_8[data-theme=dark]{--color-white-fade:color-mix(in srgb, var(--color-white) 45%, transparent);--background:oklch(24.5% 0 0);--background-fade:color-mix(in srgb, var(--background) 70%, transparent);--foreground:oklch(78.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(29.5% 0 0);--muted-foreground:oklch(50% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--accent-blue-light:oklch(25% .06 250);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 75%, transparent);--surface-border:solid 1px var(--border)}._root_1qifp_8 h1,._root_1qifp_8 h2,._root_1qifp_8 h3,._root_1qifp_8 h4,._root_1qifp_8 h5,._root_1qifp_8 h6{color:var(--foreground);margin:0;font-weight:600}._textRed_1qifp_78{color:var(--color-red)}._bgRed_1qifp_81{background-color:var(--color-red)}._bgGreen_1qifp_84{background-color:var(--color-green)}._textGreen_1qifp_87{color:var(--color-green)}._mask_1qifp_90{background-color:var(--overlay-bg)}._semibold_1qifp_93{letter-spacing:.4px;font-weight:600}._bold_1qifp_97{letter-spacing:.4px;font-weight:700}._system_1qifp_101{color:var(--muted-foreground);background-color:var(--background);justify-content:center;align-items:center;display:flex;position:absolute;inset:0}._wrapper_1qifp_111{width:100%;height:100%;min-height:480px;position:relative;overflow:hidden}._grid_1qifp_118{background:var(--background);grid-template:"header header"48px"sidebar frame"1fr"sidebar infobar"32px/48px 1fr;height:100%;display:grid;position:relative}._grid_1qifp_118._mobile_1qifp_130{grid-template-columns:0 1fr}._gridNoInfobar_1qifp_134{grid-template:"header header"48px"sidebar frame"1fr/48px 1fr;height:100%;display:grid;position:relative}._gridNoInfobar_1qifp_134._mobile_1qifp_130{grid-template-columns:0 1fr}._input_kyavx_1{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--input);box-sizing:border-box;border-radius:4px;outline:none;padding:0 8px;font-family:inherit;font-size:14px;line-height:normal;transition:border-color .2s,box-shadow .2s;display:block}._input_kyavx_1:hover:not(:disabled):not(:focus){border-color:var(--muted-foreground)}._input_kyavx_1:focus{box-shadow:0 0 0 1px var(--ring)}._input_kyavx_1:disabled{cursor:not-allowed;opacity:.5;background-color:var(--secondary)}._input_kyavx_1::placeholder{color:var(--muted-foreground);opacity:1}._numberClean_kyavx_39::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._numberClean_kyavx_39::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}._numberClean_kyavx_39[type=number]{-moz-appearance:textfield}._container_14vsv_1{position:relative}._legend_14vsv_4{color:var(--muted-foreground);background:var(--background);margin-left:8px;padding:0 4px;font-size:12px;position:absolute;top:-9px}._suffix_14vsv_13{color:var(--muted-foreground);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:14px;position:absolute;bottom:2px;right:8px}._group_1e7jm_1{margin-left:4px;display:flex}._save_1e7jm_6{width:36px;color:var(--color-green);border-top-right-radius:0;border-bottom-right-radius:0}._close_1e7jm_13{width:36px;color:var(--color-red);border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}._sliderContainer_1unyb_1{cursor:pointer;touch-action:none;--slider-progress:0%;align-items:center;width:100%;height:24px;display:flex;position:relative}._sliderContainer_1unyb_1._disabled_1unyb_11{pointer-events:none;cursor:not-allowed;opacity:.5}._sliderContainer_1unyb_1:not(._disabled_1unyb_11):hover ._sliderThumb_1unyb_17{transform:translate(-50%,-50%)scale(1.1)}._sliderTrack_1unyb_22{background-color:color-mix(in oklch, var(--muted-foreground) 65%, transparent);border-radius:2px;width:100%;height:2px;position:relative}._sliderRange_1unyb_34{background-color:var(--primary);height:100%;width:var(--slider-progress);border-radius:2px;position:absolute}._sliderThumb_1unyb_17{top:50%;left:var(--slider-progress);background-color:var(--background);border:2px solid var(--primary);pointer-events:none;border-radius:50%;width:12px;height:13px;transition:transform .1s,box-shadow .1s;position:absolute;transform:translate(-50%,-50%)}._sliderTooltip_1unyb_58{top:-40px;left:var(--slider-progress);background-color:var(--foreground);color:var(--background,#000);white-space:nowrap;pointer-events:none;z-index:2;border-radius:4px;padding:7px 10px 8px;font-size:12px;line-height:1;position:absolute;transform:translate(-50%);box-shadow:0 2px 8px #0000001a}._sliderTooltip_1unyb_58:after{content:"";background-color:var(--foreground);width:6px;height:6px;position:absolute;bottom:-2px;left:50%;transform:translate(-50%)rotate(45deg)}._hiddenInput_1unyb_86{opacity:0;cursor:pointer;z-index:1;width:100%;height:100%;margin:0;position:absolute;top:0;left:0}._tooltip_1rdl9_1{position:relative}._container_1rdl9_5{gap:0;display:flex}._container_1rdl9_5[data-position=left],._container_1rdl9_5[data-position=right]{flex-direction:column}._container_1rdl9_5 [data-tooltip]{pointer-events:auto}._popup_1rdl9_19{top:var(--tooltip-y,0px);left:var(--tooltip-x,0px);background-color:var(--foreground);color:var(--background);z-index:999;pointer-events:none;opacity:var(--tooltip-opacity,0);width:var(--tooltip-w,auto);height:var(--tooltip-h,auto);transition:opacity var(--tooltip-fade,.2s);border-radius:4px;font-size:14px;position:absolute;transform:translate(-50%,-100%);box-shadow:0 2px 8px #0000001a}._popup_1rdl9_19:before{content:"";background-color:inherit;width:10px;height:10px;position:absolute;bottom:-3px;left:50%;transform:translate(-50%)rotate(45deg)}._popup_1rdl9_19[data-position=top]{transform:translate(-50%,-100%)}._popup_1rdl9_19[data-position=top]:before{top:auto;bottom:-3px;left:50%;transform:translate(-50%)rotate(45deg)}._popup_1rdl9_19[data-position=bottom]{transform:translate(-50%)}._popup_1rdl9_19[data-position=bottom]:before{top:-3px;bottom:auto;left:50%;transform:translate(-50%)rotate(45deg)}._popup_1rdl9_19[data-position=left]{transform:translate(-100%,-50%)}._popup_1rdl9_19[data-position=left]:before{top:50%;left:auto;right:-3px;transform:translateY(-50%)rotate(45deg)}._popup_1rdl9_19[data-position=right]{transform:translateY(-50%)}._popup_1rdl9_19[data-position=right]:before{top:50%;left:-3px;right:auto;transform:translateY(-50%)rotate(45deg)}._popup_1rdl9_19._animated_1rdl9_92{transition:left var(--tooltip-slide,.4s), top var(--tooltip-slide,.4s), width var(--tooltip-slide,.4s), height var(--tooltip-slide,.4s), opacity var(--tooltip-fade,.2s)}._mask_1rdl9_101{border-radius:inherit;width:100%;height:100%;overflow:hidden}._track_1rdl9_108{width:max-content;height:max-content;transform:translateX(calc(-1 * var(--tooltip-offset,0px)));display:flex}._track_1rdl9_108[data-position=left],._track_1rdl9_108[data-position=right]{transform:translateY(calc(-1 * var(--tooltip-offset,0px)));flex-direction:column}._animated_1rdl9_92 ._track_1rdl9_108{transition:transform var(--tooltip-slide,.4s)}._title_1rdl9_125{min-width:var(--tooltip-item-w,auto);max-width:var(--tooltip-item-w,none);min-height:var(--tooltip-item-h,32px);max-height:var(--tooltip-item-h,none);white-space:nowrap;box-sizing:border-box;flex:none;justify-content:center;align-items:center;padding:0 10px;display:flex}._surfaceTool_1skmt_1{background-color:var(--background);border:var(--surface-border);color:var(--foreground);z-index:9;border-radius:4px;align-items:center;gap:4px;padding:4px;display:flex;position:absolute;bottom:16px;left:50%;transform:translate(-50%);box-shadow:0 2px 8px #0000001a}._content_1skmt_18{display:flex}._drag_1skmt_22{cursor:move;touch-action:none;-webkit-user-select:none;user-select:none;width:16px;height:16px;padding:0 2px}._header_m05h6_1{box-sizing:border-box;background-color:var(--background);border-bottom:1px solid var(--border);grid-area:header;justify-content:space-between;align-items:center;height:48px;padding:0 8px;display:flex}._left_m05h6_12{align-items:center;gap:0;display:flex}._sidebarToggle_m05h6_17{border-right:solid 1px var(--border);width:48px;height:48px;color:var(--foreground);cursor:pointer;justify-content:center;align-items:center;transition:all .2s;display:none;position:relative;left:-8px}._sidebarToggle_m05h6_17._mobile_m05h6_30{display:flex}._sidebarIcon_m05h6_34{stroke-width:1.6px;width:18px;height:18px}._tools_m05h6_39{gap:8px;display:flex}._history_m05h6_43{align-items:center;gap:6px;display:flex}._historyText_m05h6_48{color:var(--muted-foreground);font-size:14px;font-family:var(--font-mono)}._tools_4u8qe_1{flex-direction:column}._row1_4u8qe_5{flex-direction:row;align-items:center;gap:4px;padding:4px;display:flex}._min_4u8qe_13{text-align:left;width:30px;font-size:14px}._slider_4u8qe_19{flex:1}._max_4u8qe_23{text-align:right;width:45px;font-size:14px}._row2_4u8qe_29{flex-direction:row;gap:4px;display:flex}._select_4u8qe_35{width:160px}._option_4u8qe_39{width:120px;height:32px}._option_4u8qe_39 img{object-fit:cover;width:100%;height:100%}._active_4u8qe_50{color:var(--accent-blue);background:var(--muted)}._filterInteract_4u8qe_55{max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;position:absolute;inset:0}._filterInteract_4u8qe_55>div:first-child{width:100%;max-width:100%;height:100%;max-height:100%}._compare_4u8qe_70{width:0;height:100%;position:absolute;top:0;transform:translate(-50%)}._compare_4u8qe_70:before{content:"";background:var(--accent-blue);width:1px;height:100%;position:absolute;top:0;left:-.5px}._compareThumb_4u8qe_88{background:var(--color-white);border:solid 1px var(--accent-blue);width:32px;height:32px;color:var(--accent-blue);cursor:pointer;border-radius:50%;justify-content:center;align-items:center;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}._compareThumb_4u8qe_88 svg{width:20px;height:20px}._preview_t77n1_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;transition:all .2s linear,clip-path;position:absolute;inset:0;overflow:hidden}._preview_t77n1_1._faded_t77n1_13{opacity:.5;filter:blur(2px)}._rotate_t77n1_19{box-sizing:border-box;width:100%;height:100%;transition:all .2s linear;position:absolute;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)}._flip_t77n1_31{box-sizing:border-box;transition:all .2s linear;position:absolute;inset:0;overflow:hidden}._image_t77n1_39{max-width:none;max-height:none;transition:all .2s linear,filter;display:block;position:absolute}._label_t77n1_49{background:var(--color-white-fade);box-sizing:border-box;text-transform:uppercase;letter-spacing:1px;width:80px;height:28px;color:var(--color-black);z-index:3;justify-content:center;align-items:center;font-size:12px;font-weight:600;display:flex;position:absolute;top:8px}._before_t77n1_67{left:8px}._after_t77n1_71{right:8px}._sidebar_1lx29_1{background:var(--background-fade);-webkit-backdrop-filter:blur(5px);backdrop-filter:blur(5px);border-right:1px solid var(--border);z-index:10;grid-area:sidebar;width:48px;position:relative}._sidebar_1lx29_1._mobile_1lx29_10{transition:transform .2s ease-out;transform:translate(-110%);box-shadow:0 2px 8px #0000001a}._sidebar_1lx29_1._mobile_1lx29_10._open_1lx29_15{transform:translate(0%)}._wrapper_1lx29_20{flex-direction:column;display:flex}._item_1lx29_24{cursor:pointer;height:48px;color:var(--foreground);justify-content:center;align-items:center;transition:all .2s;display:flex;position:relative}._item_1lx29_24 svg{width:16px;height:16px}._item_1lx29_24:hover{background-color:var(--accent)}._item_1lx29_24._selected_1lx29_43{color:var(--accent-blue);background-color:var(--accent)}._item_1lx29_24._selected_1lx29_43:before{content:"";background-color:var(--accent-blue);width:2px;position:absolute;top:0;bottom:0;left:0}._infobar_895qe_1{background:var(--muted);font-family:var(--font-mono);color:var(--foreground);grid-area:infobar;justify-content:space-between;align-items:center;padding:0 16px;font-size:14px;display:flex}._resize_1sbig_1{align-items:center;padding-top:16px}._toolsLock_1sbig_5{width:12px;height:12px;color:var(--muted-foreground)}._indicatorWrapper_1sbig_10{justify-content:center;width:100%;height:2px;display:flex;position:absolute;top:0;left:0}._indicator_1sbig_10{background:var(--accent-blue);opacity:.6;border-radius:2px;width:30%;height:100%;transition:width .2s}._wrapper_1co2u_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;position:absolute;inset:0}._box_1co2u_9{cursor:move;box-sizing:border-box;-webkit-user-select:none;user-select:none;touch-action:none;border:1px solid var(--color-white-fade);position:absolute}._toolsInfo_1co2u_18{-webkit-user-select:none;user-select:none;min-width:54px;margin-top:-2px;display:inline-block}._toolsInfoLabel_1co2u_25{color:var(--muted-foreground);font-size:12px;line-height:12px}._toolsInfoValue_1co2u_30{color:var(--foreground);font-size:14px;line-height:14px}._linesBox_1co2u_35{pointer-events:none;position:absolute;inset:1px}._line_1co2u_35{border:1px dashed var(--color-white);opacity:.5;position:absolute}._lineV_1co2u_45{border-top:0;border-bottom:0;width:33%;height:100%;top:0;left:33%}._lineH_1co2u_53{border-left:0;border-right:0;width:100%;height:33%;top:33%;left:0}._pointer_1co2u_61{box-sizing:border-box;width:14px;height:14px;position:absolute}._pointerTopLeft_1co2u_67{border-top:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nwse-resize;top:-6px;left:-6px}._pointerTopRight_1co2u_74{border-top:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nesw-resize;top:-6px;right:-6px}._pointerBottomRight_1co2u_81{border-bottom:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nwse-resize;bottom:-6px;right:-6px}._pointerBottomLeft_1co2u_88{border-bottom:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nesw-resize;bottom:-6px;left:-6px}._mobileBorder_1co2u_95{box-sizing:border-box;border:2px solid var(--accent-blue);position:absolute;inset:0}._mobilePointer_1co2u_101{background-color:var(--overlay-bg-white);border:3px solid var(--accent-blue);box-sizing:border-box;border-radius:50%;width:32px;height:32px;position:absolute;bottom:-16px;right:-16px}._info_1co2u_112{height:16px;font-family:var(--font-mono);color:#000;background-color:var(--color-white-fade);box-sizing:border-box;align-items:center;padding:0 6px;font-size:12px;display:flex;position:absolute}._info_1co2u_112 b{font-weight:600;transform:translateY(1px)}._infoX_1co2u_129{border-left:solid 2px var(--accent-blue);top:-12px;left:16px}._infoY_1co2u_134{transform-origin:100%;border-right:solid 2px var(--accent-blue);top:8px;right:calc(100% + 4px);transform:rotate(-90deg)}._infoW_1co2u_141{border-right:solid 2px var(--accent-blue);bottom:-12px;right:16px}._infoH_1co2u_146{transform-origin:0%;border-left:solid 2px var(--accent-blue);bottom:8px;left:calc(100% + 4px);transform:rotate(-90deg)}._group_1co2u_153{flex-shrink:0;width:max-content;display:flex}._group_1co2u_153 button{color:var(--foreground);border-radius:0}._group_1co2u_153 button._active_1co2u_162{color:var(--accent-blue);background:var(--muted)}._group_1co2u_153 button:not(:first-child){margin-left:-1px}._group_1co2u_153 button:first-child{border-top-left-radius:4px;border-bottom-left-radius:4px}._group_1co2u_153 button:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px}._select_1ieak_1{width:220px}._btnH_15adi_1{border-top-right-radius:0;border-bottom-right-radius:0;width:36px}._btnV_15adi_7{border-top-left-radius:0;border-bottom-left-radius:0;width:36px;margin-left:-1px}._frame_1p6kh_1{box-sizing:border-box;background:var(--background);grid-area:frame;width:100%;height:100%;margin:0 auto;position:relative;overflow:hidden}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
1
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`._button_1vpzl_1{cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;box-sizing:border-box;background-color:#0000;border:1px solid #0000;border-radius:4px;justify-content:center;align-items:center;gap:8px;height:32px;padding:0 8px;font-family:inherit;font-size:14px;font-weight:500;transition:background-color .2s,border-color .2s,opacity .2s;display:inline-flex}._button_1vpzl_1:disabled{pointer-events:none;opacity:.5}._button_1vpzl_1 svg{flex-shrink:0;width:16px;height:16px}._default_1vpzl_35{background-color:var(--primary);color:var(--primary-foreground)}._default_1vpzl_35:hover{opacity:.9}._outline_1vpzl_44{border-color:var(--border);background-color:var(--background);color:var(--foreground)}._outline_1vpzl_44:hover{background-color:var(--secondary)}._ghost_1vpzl_54{color:var(--foreground);padding:0 8px}._ghost_1vpzl_54:hover{background-color:var(--secondary)}._rect_1vpzl_63{width:32px;height:32px}._separator_gp8ff_1{background-color:var(--border);box-sizing:border-box;border:none;flex-shrink:0;display:block}._separator_gp8ff_1[data-orientation=horizontal]{width:100%;height:1px}._separator_gp8ff_1[data-orientation=vertical]{align-self:stretch;width:1px;height:100%;margin:0}._wrapper_1aw0m_1{box-sizing:border-box;width:100%;position:relative}._trigger_1aw0m_6{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--border);cursor:pointer;box-sizing:border-box;-webkit-user-select:none;user-select:none;border-radius:4px;outline:none;justify-content:space-between;align-items:center;padding:0 8px 0 10px;font-family:inherit;font-size:14px;transition:border-color .2s;display:flex}._trigger_1aw0m_6:hover,._trigger_1aw0m_6:focus{border-color:var(--muted-foreground)}._triggerArrow_1aw0m_31{width:16px;height:16px;color:var(--muted-foreground);transition:transform .2s}._wrapper_1aw0m_1[data-state=open] ._triggerArrow_1aw0m_31{transform:rotate(180deg)}._content_1aw0m_40{background-color:var(--background);border:1px solid var(--border);z-index:50;box-sizing:border-box;border-radius:4px;width:100%;max-height:282px;padding:4px;position:absolute;top:calc(100% + 4px);left:0;overflow-y:auto;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d}._content_1aw0m_40::-webkit-scrollbar{width:4px}._content_1aw0m_40::-webkit-scrollbar-track{background:0 0}._content_1aw0m_40::-webkit-scrollbar-thumb{background-color:var(--border);border-radius:10px}._wrapper_1aw0m_1[data-state=closed] ._content_1aw0m_40{display:none}._groupLabel_1aw0m_74{color:var(--muted-foreground);-webkit-user-select:none;user-select:none;padding:8px 10px;font-size:12px;font-weight:500}._item_1aw0m_81{width:100%;color:var(--foreground);cursor:pointer;-webkit-user-select:none;user-select:none;box-sizing:border-box;background:0 0;border-radius:4px;justify-content:space-between;align-items:center;padding:4px 10px;display:flex}._item_1aw0m_81:hover{background-color:var(--secondary)}._itemLeft_1aw0m_98{font-size:14px;font-weight:400}._itemAddon_1aw0m_102{align-items:center;gap:8px;display:flex}._itemAddon_1aw0m_102 span{color:var(--muted-foreground);font-size:12px}._itemAddon_1aw0m_102 svg{font-size:14px}._itemAddon_1aw0m_102 b{flex-shrink:0;width:16px;height:16px}._itemRightContainer_1aw0m_122{align-items:center;gap:8px;display:flex}._itemRight_1aw0m_122{color:var(--muted-foreground);font-size:14px}._itemCheck_1aw0m_131{width:16px;height:16px;color:var(--foreground);flex-shrink:0}:host{height:100%;display:block}:host *{box-sizing:border-box}._root_187c5_8{width:100%;height:100%;font-size:16px;font-family:var(--font-sans);--font-sans:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, Helvetica, Arial, sans-serif;--font-mono:"Courier New", Courier, monospace;--color-white:#fff;--color-white-fade:color-mix(in srgb, var(--color-white) 65%, transparent);--color-black:#000;--color-red:oklch(63.7% .237 25.331);--color-green:oklch(76.8% .188 151.716);--background:oklch(100% 0 0);--background-fade:color-mix(in srgb, var(--background) 65%, transparent);--foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(75.6% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--accent-blue:oklch(60.9% .221 251.687);--accent-blue-light:oklch(96% .02 250);--accent-blue-fade:color-mix(in srgb, var(--accent-blue) 60%, transparent);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 50%, transparent);--overlay-bg-white:color-mix(in srgb, var(--color-white) 80%, transparent);--surface-border:solid 1px transparent;position:relative}._root_187c5_8[data-theme=dark]{--color-white-fade:color-mix(in srgb, var(--color-white) 45%, transparent);--background:oklch(24.5% 0 0);--background-fade:color-mix(in srgb, var(--background) 70%, transparent);--foreground:oklch(78.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(29.5% 0 0);--muted-foreground:oklch(50% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--accent-blue-light:oklch(25% .06 250);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--overlay-bg:color-mix(in srgb, var(--color-black) 75%, transparent);--surface-border:solid 1px var(--border)}._root_187c5_8 h1,._root_187c5_8 h2,._root_187c5_8 h3,._root_187c5_8 h4,._root_187c5_8 h5,._root_187c5_8 h6{color:var(--foreground);margin:0;font-weight:600}._textRed_187c5_78{color:var(--color-red)}._bgRed_187c5_81{background-color:var(--color-red)}._bgGreen_187c5_84{background-color:var(--color-green)}._textGreen_187c5_87{color:var(--color-green)}._mask_187c5_90{background-color:var(--overlay-bg)}._semibold_187c5_93{letter-spacing:.4px;font-weight:600}._bold_187c5_97{letter-spacing:.4px;font-weight:700}._system_187c5_101{color:var(--muted-foreground);background-color:var(--background);justify-content:center;align-items:center;display:flex;position:absolute;inset:0}._wrapper_187c5_111{width:100%;height:100%;min-height:480px;position:relative;overflow:hidden}._grid_187c5_118{background:var(--background);grid-template:"header header"48px"sidebar frame"1fr"sidebar infobar"32px/48px 1fr;height:100%;display:grid;position:relative}._grid_187c5_118._mobile_187c5_130{grid-template-columns:0 1fr}._gridNoInfobar_187c5_134{grid-template:"header header"48px"sidebar frame"1fr/48px 1fr;height:100%;display:grid;position:relative}._gridNoInfobar_187c5_134._mobile_187c5_130{grid-template-columns:0 1fr}._gridSingleTool_187c5_149{grid-template:"frame"1fr/1fr;height:100%;display:grid;position:relative}._input_kyavx_1{width:100%;height:32px;color:var(--foreground);background-color:var(--background);border:1px solid var(--input);box-sizing:border-box;border-radius:4px;outline:none;padding:0 8px;font-family:inherit;font-size:14px;line-height:normal;transition:border-color .2s,box-shadow .2s;display:block}._input_kyavx_1:hover:not(:disabled):not(:focus){border-color:var(--muted-foreground)}._input_kyavx_1:focus{box-shadow:0 0 0 1px var(--ring)}._input_kyavx_1:disabled{cursor:not-allowed;opacity:.5;background-color:var(--secondary)}._input_kyavx_1::placeholder{color:var(--muted-foreground);opacity:1}._numberClean_kyavx_39::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._numberClean_kyavx_39::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}._numberClean_kyavx_39[type=number]{-moz-appearance:textfield}._container_14vsv_1{position:relative}._legend_14vsv_4{color:var(--muted-foreground);background:var(--background);margin-left:8px;padding:0 4px;font-size:12px;position:absolute;top:-9px}._suffix_14vsv_13{color:var(--muted-foreground);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:14px;position:absolute;bottom:2px;right:8px}._group_1e7jm_1{margin-left:4px;display:flex}._save_1e7jm_6{width:36px;color:var(--color-green);border-top-right-radius:0;border-bottom-right-radius:0}._close_1e7jm_13{width:36px;color:var(--color-red);border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}._sliderContainer_1unyb_1{cursor:pointer;touch-action:none;--slider-progress:0%;align-items:center;width:100%;height:24px;display:flex;position:relative}._sliderContainer_1unyb_1._disabled_1unyb_11{pointer-events:none;cursor:not-allowed;opacity:.5}._sliderContainer_1unyb_1:not(._disabled_1unyb_11):hover ._sliderThumb_1unyb_17{transform:translate(-50%,-50%)scale(1.1)}._sliderTrack_1unyb_22{background-color:color-mix(in oklch, var(--muted-foreground) 65%, transparent);border-radius:2px;width:100%;height:2px;position:relative}._sliderRange_1unyb_34{background-color:var(--primary);height:100%;width:var(--slider-progress);border-radius:2px;position:absolute}._sliderThumb_1unyb_17{top:50%;left:var(--slider-progress);background-color:var(--background);border:2px solid var(--primary);pointer-events:none;border-radius:50%;width:12px;height:13px;transition:transform .1s,box-shadow .1s;position:absolute;transform:translate(-50%,-50%)}._sliderTooltip_1unyb_58{top:-40px;left:var(--slider-progress);background-color:var(--foreground);color:var(--background,#000);white-space:nowrap;pointer-events:none;z-index:2;border-radius:4px;padding:7px 10px 8px;font-size:12px;line-height:1;position:absolute;transform:translate(-50%);box-shadow:0 2px 8px #0000001a}._sliderTooltip_1unyb_58:after{content:"";background-color:var(--foreground);width:6px;height:6px;position:absolute;bottom:-2px;left:50%;transform:translate(-50%)rotate(45deg)}._hiddenInput_1unyb_86{opacity:0;cursor:pointer;z-index:1;width:100%;height:100%;margin:0;position:absolute;top:0;left:0}._tooltip_1rdl9_1{position:relative}._container_1rdl9_5{gap:0;display:flex}._container_1rdl9_5[data-position=left],._container_1rdl9_5[data-position=right]{flex-direction:column}._container_1rdl9_5 [data-tooltip]{pointer-events:auto}._popup_1rdl9_19{top:var(--tooltip-y,0px);left:var(--tooltip-x,0px);background-color:var(--foreground);color:var(--background);z-index:999;pointer-events:none;opacity:var(--tooltip-opacity,0);width:var(--tooltip-w,auto);height:var(--tooltip-h,auto);transition:opacity var(--tooltip-fade,.2s);border-radius:4px;font-size:14px;position:absolute;transform:translate(-50%,-100%);box-shadow:0 2px 8px #0000001a}._popup_1rdl9_19:before{content:"";background-color:inherit;width:10px;height:10px;position:absolute;bottom:-3px;left:50%;transform:translate(-50%)rotate(45deg)}._popup_1rdl9_19[data-position=top]{transform:translate(-50%,-100%)}._popup_1rdl9_19[data-position=top]:before{top:auto;bottom:-3px;left:50%;transform:translate(-50%)rotate(45deg)}._popup_1rdl9_19[data-position=bottom]{transform:translate(-50%)}._popup_1rdl9_19[data-position=bottom]:before{top:-3px;bottom:auto;left:50%;transform:translate(-50%)rotate(45deg)}._popup_1rdl9_19[data-position=left]{transform:translate(-100%,-50%)}._popup_1rdl9_19[data-position=left]:before{top:50%;left:auto;right:-3px;transform:translateY(-50%)rotate(45deg)}._popup_1rdl9_19[data-position=right]{transform:translateY(-50%)}._popup_1rdl9_19[data-position=right]:before{top:50%;left:-3px;right:auto;transform:translateY(-50%)rotate(45deg)}._popup_1rdl9_19._animated_1rdl9_92{transition:left var(--tooltip-slide,.4s), top var(--tooltip-slide,.4s), width var(--tooltip-slide,.4s), height var(--tooltip-slide,.4s), opacity var(--tooltip-fade,.2s)}._mask_1rdl9_101{border-radius:inherit;width:100%;height:100%;overflow:hidden}._track_1rdl9_108{width:max-content;height:max-content;transform:translateX(calc(-1 * var(--tooltip-offset,0px)));display:flex}._track_1rdl9_108[data-position=left],._track_1rdl9_108[data-position=right]{transform:translateY(calc(-1 * var(--tooltip-offset,0px)));flex-direction:column}._animated_1rdl9_92 ._track_1rdl9_108{transition:transform var(--tooltip-slide,.4s)}._title_1rdl9_125{min-width:var(--tooltip-item-w,auto);max-width:var(--tooltip-item-w,none);min-height:var(--tooltip-item-h,32px);max-height:var(--tooltip-item-h,none);white-space:nowrap;box-sizing:border-box;flex:none;justify-content:center;align-items:center;padding:0 10px;display:flex}._surfaceTool_1skmt_1{background-color:var(--background);border:var(--surface-border);color:var(--foreground);z-index:9;border-radius:4px;align-items:center;gap:4px;padding:4px;display:flex;position:absolute;bottom:16px;left:50%;transform:translate(-50%);box-shadow:0 2px 8px #0000001a}._content_1skmt_18{display:flex}._drag_1skmt_22{cursor:move;touch-action:none;-webkit-user-select:none;user-select:none;width:16px;height:16px;padding:0 2px}._tools_4u8qe_1{flex-direction:column}._row1_4u8qe_5{flex-direction:row;align-items:center;gap:4px;padding:4px;display:flex}._min_4u8qe_13{text-align:left;width:30px;font-size:14px}._slider_4u8qe_19{flex:1}._max_4u8qe_23{text-align:right;width:45px;font-size:14px}._row2_4u8qe_29{flex-direction:row;gap:4px;display:flex}._select_4u8qe_35{width:160px}._option_4u8qe_39{width:120px;height:32px}._option_4u8qe_39 img{object-fit:cover;width:100%;height:100%}._active_4u8qe_50{color:var(--accent-blue);background:var(--muted)}._filterInteract_4u8qe_55{max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;position:absolute;inset:0}._filterInteract_4u8qe_55>div:first-child{width:100%;max-width:100%;height:100%;max-height:100%}._compare_4u8qe_70{width:0;height:100%;position:absolute;top:0;transform:translate(-50%)}._compare_4u8qe_70:before{content:"";background:var(--accent-blue);width:1px;height:100%;position:absolute;top:0;left:-.5px}._compareThumb_4u8qe_88{background:var(--color-white);border:solid 1px var(--accent-blue);width:32px;height:32px;color:var(--accent-blue);cursor:pointer;border-radius:50%;justify-content:center;align-items:center;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}._compareThumb_4u8qe_88 svg{width:20px;height:20px}._preview_t77n1_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;transition:all .2s linear,clip-path;position:absolute;inset:0;overflow:hidden}._preview_t77n1_1._faded_t77n1_13{opacity:.5;filter:blur(2px)}._rotate_t77n1_19{box-sizing:border-box;width:100%;height:100%;transition:all .2s linear;position:absolute;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)}._flip_t77n1_31{box-sizing:border-box;transition:all .2s linear;position:absolute;inset:0;overflow:hidden}._image_t77n1_39{max-width:none;max-height:none;transition:all .2s linear,filter;display:block;position:absolute}._label_t77n1_49{background:var(--color-white-fade);box-sizing:border-box;text-transform:uppercase;letter-spacing:1px;width:80px;height:28px;color:var(--color-black);z-index:3;justify-content:center;align-items:center;font-size:12px;font-weight:600;display:flex;position:absolute;top:8px}._before_t77n1_67{left:8px}._after_t77n1_71{right:8px}._header_m05h6_1{box-sizing:border-box;background-color:var(--background);border-bottom:1px solid var(--border);grid-area:header;justify-content:space-between;align-items:center;height:48px;padding:0 8px;display:flex}._left_m05h6_12{align-items:center;gap:0;display:flex}._sidebarToggle_m05h6_17{border-right:solid 1px var(--border);width:48px;height:48px;color:var(--foreground);cursor:pointer;justify-content:center;align-items:center;transition:all .2s;display:none;position:relative;left:-8px}._sidebarToggle_m05h6_17._mobile_m05h6_30{display:flex}._sidebarIcon_m05h6_34{stroke-width:1.6px;width:18px;height:18px}._tools_m05h6_39{gap:8px;display:flex}._history_m05h6_43{align-items:center;gap:6px;display:flex}._historyText_m05h6_48{color:var(--muted-foreground);font-size:14px;font-family:var(--font-mono)}._sidebar_1lx29_1{background:var(--background-fade);-webkit-backdrop-filter:blur(5px);backdrop-filter:blur(5px);border-right:1px solid var(--border);z-index:10;grid-area:sidebar;width:48px;position:relative}._sidebar_1lx29_1._mobile_1lx29_10{transition:transform .2s ease-out;transform:translate(-110%);box-shadow:0 2px 8px #0000001a}._sidebar_1lx29_1._mobile_1lx29_10._open_1lx29_15{transform:translate(0%)}._wrapper_1lx29_20{flex-direction:column;display:flex}._item_1lx29_24{cursor:pointer;height:48px;color:var(--foreground);justify-content:center;align-items:center;transition:all .2s;display:flex;position:relative}._item_1lx29_24 svg{width:16px;height:16px}._item_1lx29_24:hover{background-color:var(--accent)}._item_1lx29_24._selected_1lx29_43{color:var(--accent-blue);background-color:var(--accent)}._item_1lx29_24._selected_1lx29_43:before{content:"";background-color:var(--accent-blue);width:2px;position:absolute;top:0;bottom:0;left:0}._infobar_895qe_1{background:var(--muted);font-family:var(--font-mono);color:var(--foreground);grid-area:infobar;justify-content:space-between;align-items:center;padding:0 16px;font-size:14px;display:flex}._resize_1sbig_1{align-items:center;padding-top:16px}._toolsLock_1sbig_5{width:12px;height:12px;color:var(--muted-foreground)}._indicatorWrapper_1sbig_10{justify-content:center;width:100%;height:2px;display:flex;position:absolute;top:0;left:0}._indicator_1sbig_10{background:var(--accent-blue);opacity:.6;border-radius:2px;width:30%;height:100%;transition:width .2s}._wrapper_1co2u_1{box-sizing:border-box;max-width:calc(100% - 32px);max-height:calc(100% - 32px);margin:auto;position:absolute;inset:0}._box_1co2u_9{cursor:move;box-sizing:border-box;-webkit-user-select:none;user-select:none;touch-action:none;border:1px solid var(--color-white-fade);position:absolute}._toolsInfo_1co2u_18{-webkit-user-select:none;user-select:none;min-width:54px;margin-top:-2px;display:inline-block}._toolsInfoLabel_1co2u_25{color:var(--muted-foreground);font-size:12px;line-height:12px}._toolsInfoValue_1co2u_30{color:var(--foreground);font-size:14px;line-height:14px}._linesBox_1co2u_35{pointer-events:none;position:absolute;inset:1px}._line_1co2u_35{border:1px dashed var(--color-white);opacity:.5;position:absolute}._lineV_1co2u_45{border-top:0;border-bottom:0;width:33%;height:100%;top:0;left:33%}._lineH_1co2u_53{border-left:0;border-right:0;width:100%;height:33%;top:33%;left:0}._pointer_1co2u_61{box-sizing:border-box;width:14px;height:14px;position:absolute}._pointerTopLeft_1co2u_67{border-top:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nwse-resize;top:-6px;left:-6px}._pointerTopRight_1co2u_74{border-top:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nesw-resize;top:-6px;right:-6px}._pointerBottomRight_1co2u_81{border-bottom:3px solid var(--accent-blue);border-right:3px solid var(--accent-blue);cursor:nwse-resize;bottom:-6px;right:-6px}._pointerBottomLeft_1co2u_88{border-bottom:3px solid var(--accent-blue);border-left:3px solid var(--accent-blue);cursor:nesw-resize;bottom:-6px;left:-6px}._mobileBorder_1co2u_95{box-sizing:border-box;border:2px solid var(--accent-blue);position:absolute;inset:0}._mobilePointer_1co2u_101{background-color:var(--overlay-bg-white);border:3px solid var(--accent-blue);box-sizing:border-box;border-radius:50%;width:32px;height:32px;position:absolute;bottom:-16px;right:-16px}._info_1co2u_112{height:16px;font-family:var(--font-mono);color:#000;background-color:var(--color-white-fade);box-sizing:border-box;align-items:center;padding:0 6px;font-size:12px;display:flex;position:absolute}._info_1co2u_112 b{font-weight:600;transform:translateY(1px)}._infoX_1co2u_129{border-left:solid 2px var(--accent-blue);top:-12px;left:16px}._infoY_1co2u_134{transform-origin:100%;border-right:solid 2px var(--accent-blue);top:8px;right:calc(100% + 4px);transform:rotate(-90deg)}._infoW_1co2u_141{border-right:solid 2px var(--accent-blue);bottom:-12px;right:16px}._infoH_1co2u_146{transform-origin:0%;border-left:solid 2px var(--accent-blue);bottom:8px;left:calc(100% + 4px);transform:rotate(-90deg)}._group_1co2u_153{flex-shrink:0;width:max-content;display:flex}._group_1co2u_153 button{color:var(--foreground);border-radius:0}._group_1co2u_153 button._active_1co2u_162{color:var(--accent-blue);background:var(--muted)}._group_1co2u_153 button:not(:first-child){margin-left:-1px}._group_1co2u_153 button:first-child{border-top-left-radius:4px;border-bottom-left-radius:4px}._group_1co2u_153 button:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px}._select_1ieak_1{width:220px}._btnH_15adi_1{border-top-right-radius:0;border-bottom-right-radius:0;width:36px}._btnV_15adi_7{border-top-left-radius:0;border-bottom-left-radius:0;width:36px;margin-left:-1px}._frame_1p6kh_1{box-sizing:border-box;background:var(--background);grid-area:frame;width:100%;height:100%;margin:0 auto;position:relative;overflow:hidden}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
2
2
  import { Children as e, createContext as t, forwardRef as n, isValidElement as r, useCallback as i, useContext as a, useEffect as o, useImperativeHandle as s, useLayoutEffect as c, useMemo as l, useRef as u, useState as d } from "react";
3
3
  //#region \0rolldown/runtime.js
4
4
  var f = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), p = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
5
5
  if (typeof require < "u") return require.apply(this, arguments);
6
6
  throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
7
- }), m = {
8
- sm: 480,
9
- md: 768,
10
- lg: 1024,
11
- xl: 1280
12
- }, h = {
13
- INITIAL: "initial",
14
- RESIZE: "resize",
15
- CROP: "crop",
16
- PRESET_CROP: "presetCrop",
17
- FLIP: "flip",
18
- ROTATE: "rotate",
19
- FILTERS: "filters"
20
- }, g = {
21
- tools: [
22
- "resize",
23
- "crop",
24
- "presetCrop",
25
- "flip",
26
- "rotate",
27
- "filters"
28
- ],
29
- infobar: !0,
30
- quality: .85,
31
- saveAsWEBP: !1,
32
- exportAs: "blob"
33
- }, _ = (e, t, n, r, i, a, o) => ({
34
- history: {
35
- pointer: 0,
36
- items: [{
37
- width: t,
38
- height: n,
39
- action: {
40
- name: h.INITIAL,
41
- args: null
7
+ }), m = 1920, h = .85, g = [
8
+ {
9
+ label: "Facebook",
10
+ value: "facebook",
11
+ options: [
12
+ {
13
+ value: "facebook-post",
14
+ label: "Post",
15
+ w: 1200,
16
+ h: 630,
17
+ rightLabel: "1200 x 630"
18
+ },
19
+ {
20
+ value: "facebook-cover",
21
+ label: "Cover",
22
+ w: 851,
23
+ h: 315,
24
+ rightLabel: "851 x 315"
25
+ },
26
+ {
27
+ value: "facebook-profile",
28
+ label: "Profile",
29
+ w: 170,
30
+ h: 170,
31
+ rightLabel: "170 x 170"
32
+ },
33
+ {
34
+ value: "facebook-story",
35
+ label: "Story",
36
+ w: 1080,
37
+ h: 1920,
38
+ rightLabel: "1080 x 1920"
42
39
  }
43
- }]
40
+ ]
44
41
  },
45
- currentAction: null,
46
- previewUrl: i,
47
- originalBlob: r,
48
- mimeType: e,
49
- sidebar: !1,
50
- settings: o,
51
- isAlpha: a,
52
- showCompare: !1
53
- }), v = t(void 0), y = /* @__PURE__ */ f(((e) => {
42
+ {
43
+ label: "Instagram",
44
+ value: "instagram",
45
+ options: [
46
+ {
47
+ value: "instagram-landscape",
48
+ label: "Landscape",
49
+ w: 1080,
50
+ h: 566,
51
+ rightLabel: "1080 x 566"
52
+ },
53
+ {
54
+ value: "instagram-portait",
55
+ label: "Portait",
56
+ w: 1080,
57
+ h: 1350,
58
+ rightLabel: "1080 x 1350"
59
+ },
60
+ {
61
+ value: "instagram-square",
62
+ label: "Square",
63
+ w: 1080,
64
+ h: 1080,
65
+ rightLabel: "1080 x 1080"
66
+ },
67
+ {
68
+ value: "instagram-story",
69
+ label: "Story",
70
+ w: 1080,
71
+ h: 1920,
72
+ rightLabel: "1080 x 1920"
73
+ },
74
+ {
75
+ value: "instagram-thumbnail",
76
+ label: "Thumbnail",
77
+ w: 161,
78
+ h: 161,
79
+ rightLabel: "161 x 161"
80
+ }
81
+ ]
82
+ },
83
+ {
84
+ label: "LinkedIn",
85
+ value: "linkedin",
86
+ options: [
87
+ {
88
+ value: "linkedin-blog-post",
89
+ label: "Blog Post",
90
+ w: 1200,
91
+ h: 627,
92
+ rightLabel: "1200 x 627"
93
+ },
94
+ {
95
+ value: "linkedin-cover",
96
+ label: "Cover",
97
+ w: 1128,
98
+ h: 191,
99
+ rightLabel: "1128 x 191"
100
+ },
101
+ {
102
+ value: "linkedin-profile",
103
+ label: "Profile",
104
+ w: 400,
105
+ h: 400,
106
+ rightLabel: "400 x 400"
107
+ }
108
+ ]
109
+ }
110
+ ], _ = [
111
+ {
112
+ value: "saturate",
113
+ label: "Saturate",
114
+ min: 0,
115
+ max: 200,
116
+ step: 1,
117
+ unit: "%",
118
+ sliderValue: 100,
119
+ rightLabel: "100%"
120
+ },
121
+ {
122
+ value: "grayscale",
123
+ label: "Grayscale",
124
+ min: 0,
125
+ max: 100,
126
+ step: 1,
127
+ unit: "%",
128
+ sliderValue: 0,
129
+ rightLabel: "0%"
130
+ },
131
+ {
132
+ value: "sepia",
133
+ label: "Sepia",
134
+ min: 0,
135
+ max: 100,
136
+ step: 1,
137
+ unit: "%",
138
+ sliderValue: 0,
139
+ rightLabel: "0%"
140
+ },
141
+ {
142
+ value: "invert",
143
+ label: "Invert",
144
+ min: 0,
145
+ max: 100,
146
+ step: 1,
147
+ unit: "%",
148
+ sliderValue: 0,
149
+ rightLabel: "0%"
150
+ },
151
+ {
152
+ value: "hueRotate",
153
+ label: "Hue Rotate",
154
+ min: 0,
155
+ max: 360,
156
+ step: 1,
157
+ unit: "°",
158
+ sliderValue: 0,
159
+ rightLabel: "0°"
160
+ },
161
+ {
162
+ value: "brightness",
163
+ label: "Brightness",
164
+ min: 0,
165
+ max: 200,
166
+ step: 1,
167
+ unit: "%",
168
+ sliderValue: 100,
169
+ rightLabel: "100%"
170
+ },
171
+ {
172
+ value: "contrast",
173
+ label: "Contrast",
174
+ min: 0,
175
+ max: 200,
176
+ step: 1,
177
+ unit: "%",
178
+ sliderValue: 100,
179
+ rightLabel: "100%"
180
+ }
181
+ ], v = [
182
+ {
183
+ value: "vintage",
184
+ label: "Vintage"
185
+ },
186
+ {
187
+ value: "olive-army",
188
+ label: "Olive Army"
189
+ },
190
+ {
191
+ value: "warm-sunset",
192
+ label: "Warm Sunset"
193
+ },
194
+ {
195
+ value: "sin-city-red",
196
+ label: "Sin City Red"
197
+ },
198
+ {
199
+ value: "plastic-wrap",
200
+ label: "Plastic Wrap"
201
+ },
202
+ {
203
+ value: "cross-process",
204
+ label: "Cross-Processing"
205
+ },
206
+ {
207
+ value: "crt-lines",
208
+ label: "CRT Monitor"
209
+ },
210
+ {
211
+ value: "grain",
212
+ label: "Grain / Noise"
213
+ },
214
+ {
215
+ value: "emboss",
216
+ label: "Emboss Effect"
217
+ },
218
+ {
219
+ value: "x-ray",
220
+ label: "X-Ray"
221
+ }
222
+ ], y = /* @__PURE__ */ f(((e) => {
54
223
  var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
55
224
  function r(e, n, r) {
56
225
  var i = null;
@@ -129,7 +298,7 @@ var f = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
129
298
  return Error("react-stack-top-frame");
130
299
  }
131
300
  function s(e) {
132
- if (j.call(e, "key")) {
301
+ if (ee.call(e, "key")) {
133
302
  var t = Object.getOwnPropertyDescriptor(e, "key").get;
134
303
  if (t && t.isReactWarning) return !1;
135
304
  }
@@ -137,7 +306,7 @@ var f = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
137
306
  }
138
307
  function c(e, t) {
139
308
  function n() {
140
- te || (te = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
309
+ ne || (ne = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
141
310
  }
142
311
  n.isReactWarning = !0, Object.defineProperty(e, "key", {
143
312
  get: n,
@@ -146,7 +315,7 @@ var f = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
146
315
  }
147
316
  function l() {
148
317
  var e = t(this.type);
149
- return ne[e] || (ne[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
318
+ return re[e] || (re[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
150
319
  }
151
320
  function u(e, t, n, r, i, a) {
152
321
  var o = n.ref;
@@ -186,17 +355,17 @@ var f = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
186
355
  }
187
356
  function d(e, n, i, o, l, d) {
188
357
  var p = n.children;
189
- if (p !== void 0) if (o) if (ee(p)) {
358
+ if (p !== void 0) if (o) if (te(p)) {
190
359
  for (o = 0; o < p.length; o++) f(p[o]);
191
360
  Object.freeze && Object.freeze(p);
192
361
  } else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
193
362
  else f(p);
194
- if (j.call(n, "key")) {
363
+ if (ee.call(n, "key")) {
195
364
  p = t(e);
196
365
  var m = Object.keys(n).filter(function(e) {
197
366
  return e !== "key";
198
367
  });
199
- o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", ae[p + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, p, m, p), ae[p + o] = !0);
368
+ o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", N[p + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, p, m, p), N[p + o] = !0);
200
369
  }
201
370
  if (p = null, i !== void 0 && (r(i), p = "" + i), s(n) && (r(n.key), p = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
202
371
  else i = n;
@@ -208,176 +377,24 @@ var f = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
208
377
  function m(e) {
209
378
  return typeof e == "object" && !!e && e.$$typeof === g;
210
379
  }
211
- var h = p("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, ee = Array.isArray, M = console.createTask ? console.createTask : function() {
380
+ var h = p("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ee = Object.prototype.hasOwnProperty, te = Array.isArray, j = console.createTask ? console.createTask : function() {
212
381
  return null;
213
382
  };
214
383
  h = { react_stack_bottom_frame: function(e) {
215
384
  return e();
216
385
  } };
217
- var te, ne = {}, re = h.react_stack_bottom_frame.bind(h, o)(), ie = M(i(o)), ae = {};
386
+ var ne, re = {}, M = h.react_stack_bottom_frame.bind(h, o)(), ie = j(i(o)), N = {};
218
387
  e.Fragment = v, e.jsx = function(e, t, n) {
219
388
  var r = 1e4 > A.recentlyCreatedOwnerStacks++;
220
- return d(e, t, n, !1, r ? Error("react-stack-top-frame") : re, r ? M(i(e)) : ie);
389
+ return d(e, t, n, !1, r ? Error("react-stack-top-frame") : M, r ? j(i(e)) : ie);
221
390
  }, e.jsxs = function(e, t, n) {
222
391
  var r = 1e4 > A.recentlyCreatedOwnerStacks++;
223
- return d(e, t, n, !0, r ? Error("react-stack-top-frame") : re, r ? M(i(e)) : ie);
392
+ return d(e, t, n, !0, r ? Error("react-stack-top-frame") : M, r ? j(i(e)) : ie);
224
393
  };
225
394
  })();
226
395
  })), x = (/* @__PURE__ */ f(((e, t) => {
227
396
  process.env.NODE_ENV === "production" ? t.exports = y() : t.exports = b();
228
- })))(), S = ({ children: e, mimeType: t, width: n, height: r, originalBlob: i, previewUrl: a, isAlpha: s, settings: c }) => {
229
- let [f, p] = d(_(t, n, r, i, a, s, c)), m = u(null);
230
- o(() => () => {
231
- m.current &&= (URL.revokeObjectURL(m.current), null);
232
- }, []);
233
- let g = (e) => p((t) => ({
234
- ...t,
235
- currentAction: e
236
- })), y = (e) => p((t) => {
237
- let n = t.history.pointer + 1, r = [...t.history.items.slice(0, n), e];
238
- return {
239
- ...t,
240
- currentAction: null,
241
- history: {
242
- items: r,
243
- pointer: n
244
- }
245
- };
246
- }), b = () => p((e) => ({
247
- ...e,
248
- showCompare: !e.showCompare
249
- })), S = () => {
250
- let { items: e, pointer: t } = f.history;
251
- return e.at(t) ?? e.at(0) ?? {
252
- width: 0,
253
- height: 0,
254
- action: {
255
- name: h.INITIAL,
256
- args: null
257
- }
258
- };
259
- }, C = () => {
260
- let { items: e, pointer: t } = f.history;
261
- return e.filter((e, n) => n <= t && e.action.name === h.FILTERS).at(-1) ?? null;
262
- }, w = () => {
263
- let { items: e, pointer: t } = f.history;
264
- if (e.length === 0 || t < 0) return 0;
265
- let n = e.slice(0, t + 1).findLast((e) => e.action.name === h.ROTATE);
266
- return n?.action.name === h.ROTATE ? n.action.args.degrees : 0;
267
- }, T = () => p((e) => ({
268
- ...e,
269
- history: {
270
- items: [e.history.items[0]],
271
- pointer: 0
272
- }
273
- })), E = () => p((e) => e.history.pointer <= 0 ? e : {
274
- ...e,
275
- history: {
276
- ...e.history,
277
- pointer: e.history.pointer - 1
278
- }
279
- }), D = () => p((e) => e.history.pointer >= e.history.items.length - 1 ? e : {
280
- ...e,
281
- history: {
282
- ...e.history,
283
- pointer: e.history.pointer + 1
284
- }
285
- }), O = (e) => p((t) => ({
286
- ...t,
287
- sidebar: e
288
- })), k = l(() => new EventTarget(), []), A = (e) => {
289
- m.current && URL.revokeObjectURL(m.current), m.current = URL.createObjectURL(e.previewBlob), p(_(e.mimeType, e.width, e.height, e.newBlob, m.current, e.isAlpha, c));
290
- };
291
- return /* @__PURE__ */ (0, x.jsx)(v, {
292
- value: {
293
- ...f,
294
- setImage: A,
295
- setCurrentAction: g,
296
- toggleCompare: b,
297
- getLastHistoryItem: S,
298
- getLastRotation: w,
299
- getLastFilter: C,
300
- addToHistory: y,
301
- resetHistory: T,
302
- undo: E,
303
- redo: D,
304
- setSidebar: O,
305
- eventBus: k
306
- },
307
- children: e
308
- });
309
- }, C = "(function(){let e=async e=>{let{width:t,height:n}=e,r=Math.min(1,1920/Math.max(t,n)),i=Math.round(t*r),a=Math.round(n*r),o=new OffscreenCanvas(i,a),s=o.getContext(`2d`);if(!s)throw Error(`Failed to get 2D context for preview canvas`);return s.drawImage(e,0,0,i,a),o.convertToBlob({type:`image/webp`,quality:.85})};function t(e){let t=new OffscreenCanvas(e.width,e.height),n=t.getContext(`2d`);if(!n)throw Error(`Failed to create 2D context for canvas.`);n.drawImage(e,0,0);try{let e=n.getImageData(0,0,t.width,t.height).data;for(let t=3;t<e.length;t+=4)if(e[t]<255)return!0;return!1}catch(e){throw Error(`Error reading pixels: ${e}`,{cause:e})}}self.onmessage=async n=>{let r=``;try{let i;if(n.data instanceof Blob)i=n.data;else{let e=n.data.trim();!e.startsWith(`http://`)&&!e.startsWith(`https://`)&&!e.startsWith(`blob:`)&&!e.startsWith(`data:`)&&(r=`image/png`,e=`data:${r};base64,${e}`);let t=await fetch(e);if(!t.ok)throw Error(`HTTP error! Status: ${t.status}`);i=await t.blob()}let a=i.type||r||`image/unknown`,o=await createImageBitmap(i),{width:s,height:c}=o,l=await e(o),u=t(o);o.close(),self.postMessage({success:!0,originalBlob:i,previewBlob:l,mimeType:a,width:s,height:c,isAlpha:u})}catch(e){self.postMessage({success:!1,error:e instanceof Error?e.message:`An error occurred during image loader worker execution.`})}}})();", w = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", C], { type: "text/javascript;charset=utf-8" });
310
- function T(e) {
311
- let t;
312
- try {
313
- if (t = w && (self.URL || self.webkitURL).createObjectURL(w), !t) throw "";
314
- let n = new Worker(t, { name: e?.name });
315
- return n.addEventListener("error", () => {
316
- (self.URL || self.webkitURL).revokeObjectURL(t);
317
- }), n;
318
- } catch {
319
- return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(C), { name: e?.name });
320
- }
321
- }
322
- //#endregion
323
- //#region src/shared/components/Pixedi/hooks/useImageLoader.tsx
324
- var E = ({ src: e, skip: t = !1 }) => {
325
- let [n, r] = d({
326
- loading: !t,
327
- error: "",
328
- width: 0,
329
- height: 0,
330
- mimeType: "",
331
- originalBlob: null,
332
- previewUrl: "",
333
- isAlpha: !1
334
- }), i = u(null);
335
- return o(() => {
336
- if (!e || t) return;
337
- let n = new T();
338
- return n.postMessage(e), n.onmessage = (e) => {
339
- let t = e.data;
340
- t.success ? (i.current && URL.revokeObjectURL(i.current), i.current = URL.createObjectURL(t.previewBlob), r({
341
- loading: !1,
342
- error: "",
343
- mimeType: t.mimeType,
344
- width: t.width,
345
- height: t.height,
346
- originalBlob: t.originalBlob,
347
- previewUrl: i.current,
348
- isAlpha: t.isAlpha
349
- })) : r((e) => ({
350
- ...e,
351
- loading: !1,
352
- error: t.error || "Error processing image."
353
- }));
354
- }, () => {
355
- n.terminate(), i.current &&= (URL.revokeObjectURL(i.current), null);
356
- };
357
- }, [t, e]), n;
358
- }, D = () => {
359
- if (typeof window > "u" || !window.navigator) return null;
360
- let e = window.navigator.userAgent.toLowerCase();
361
- return /android/.test(e) ? "android" : /iphone|ipad|ipod/.test(e) ? "ios" : /windows phone/.test(e) ? "windows-phone" : /blackberry|bb10/.test(e) ? "blackberry" : /opera mini/.test(e) ? "opera-mini" : /mobile/.test(e) ? "mobile" : null;
362
- }, O = () => {
363
- let [e] = d(() => D());
364
- return e;
365
- };
366
- //#endregion
367
- //#region src/shared/components/Pixedi/hooks/useBellow.tsx
368
- function k(e, t) {
369
- let [n, r] = d(!0);
370
- return o(() => {
371
- if (!t) return;
372
- let n = new ResizeObserver(([t]) => {
373
- t && r(t.contentRect.width < m[e]);
374
- });
375
- return n.observe(t), () => n.disconnect();
376
- }, [e, t]), n;
377
- }
378
- //#endregion
379
- //#region src/shared/components/Pixedi/assets/icons.tsx
380
- var A = {
397
+ })))(), S = {
381
398
  xmlns: "http://w3.org",
382
399
  width: "24",
383
400
  height: "24",
@@ -387,16 +404,16 @@ var A = {
387
404
  strokeWidth: "2",
388
405
  strokeLinecap: "round",
389
406
  strokeLinejoin: "round"
390
- }, j = (e) => /* @__PURE__ */ (0, x.jsx)("svg", {
391
- ...A,
407
+ }, C = (e) => /* @__PURE__ */ (0, x.jsx)("svg", {
408
+ ...S,
392
409
  ...e,
393
410
  children: /* @__PURE__ */ (0, x.jsx)("path", { d: "M20 6 9 17l-5-5" })
394
- }), ee = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
395
- ...A,
411
+ }), w = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
412
+ ...S,
396
413
  ...e,
397
414
  children: [/* @__PURE__ */ (0, x.jsx)("path", { d: "M18 6 6 18" }), /* @__PURE__ */ (0, x.jsx)("path", { d: "m6 6 12 12" })]
398
- }), M = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
399
- ...A,
415
+ }), T = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
416
+ ...S,
400
417
  ...e,
401
418
  children: [/* @__PURE__ */ (0, x.jsx)("rect", {
402
419
  width: "18",
@@ -406,28 +423,28 @@ var A = {
406
423
  rx: "2",
407
424
  ry: "2"
408
425
  }), /* @__PURE__ */ (0, x.jsx)("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })]
409
- }), te = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
410
- ...A,
426
+ }), E = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
427
+ ...S,
411
428
  ...e,
412
429
  children: [/* @__PURE__ */ (0, x.jsx)("path", { d: "m12 19-7-7 7-7" }), /* @__PURE__ */ (0, x.jsx)("path", { d: "M19 12H5" })]
413
- }), ne = (e) => /* @__PURE__ */ (0, x.jsx)("svg", {
414
- ...A,
430
+ }), D = (e) => /* @__PURE__ */ (0, x.jsx)("svg", {
431
+ ...S,
415
432
  ...e,
416
433
  children: /* @__PURE__ */ (0, x.jsx)("path", { d: "m6 9 6 6 6-6" })
417
- }), re = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
418
- ...A,
434
+ }), O = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
435
+ ...S,
419
436
  ...e,
420
437
  children: [/* @__PURE__ */ (0, x.jsx)("path", { d: "M3 7v6h6" }), /* @__PURE__ */ (0, x.jsx)("path", { d: "M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13" })]
421
- }), ie = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
422
- ...A,
438
+ }), k = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
439
+ ...S,
423
440
  ...e,
424
441
  children: [/* @__PURE__ */ (0, x.jsx)("path", { d: "M21 7v6h-6" }), /* @__PURE__ */ (0, x.jsx)("path", { d: "M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7" })]
425
- }), ae = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
426
- ...A,
442
+ }), A = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
443
+ ...S,
427
444
  ...e,
428
445
  children: [/* @__PURE__ */ (0, x.jsx)("path", { d: "M6 2v14a2 2 0 0 0 2 2h14" }), /* @__PURE__ */ (0, x.jsx)("path", { d: "M18 22V8a2 2 0 0 0-2-2H2" })]
429
- }), oe = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
430
- ...A,
446
+ }), ee = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
447
+ ...S,
431
448
  ...e,
432
449
  children: [
433
450
  /* @__PURE__ */ (0, x.jsx)("rect", {
@@ -445,8 +462,8 @@ var A = {
445
462
  }),
446
463
  /* @__PURE__ */ (0, x.jsx)("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
447
464
  ]
448
- }), se = (e) => /* @__PURE__ */ (0, x.jsx)("svg", {
449
- ...A,
465
+ }), te = (e) => /* @__PURE__ */ (0, x.jsx)("svg", {
466
+ ...S,
450
467
  ...e,
451
468
  children: /* @__PURE__ */ (0, x.jsx)("rect", {
452
469
  width: "18",
@@ -455,8 +472,8 @@ var A = {
455
472
  y: "3",
456
473
  rx: "2"
457
474
  })
458
- }), ce = (e) => /* @__PURE__ */ (0, x.jsx)("svg", {
459
- ...A,
475
+ }), j = (e) => /* @__PURE__ */ (0, x.jsx)("svg", {
476
+ ...S,
460
477
  ...e,
461
478
  children: /* @__PURE__ */ (0, x.jsx)("rect", {
462
479
  width: "20",
@@ -465,8 +482,8 @@ var A = {
465
482
  y: "6",
466
483
  rx: "2"
467
484
  })
468
- }), le = (e) => /* @__PURE__ */ (0, x.jsx)("svg", {
469
- ...A,
485
+ }), ne = (e) => /* @__PURE__ */ (0, x.jsx)("svg", {
486
+ ...S,
470
487
  ...e,
471
488
  children: /* @__PURE__ */ (0, x.jsx)("rect", {
472
489
  width: "20",
@@ -475,8 +492,8 @@ var A = {
475
492
  y: "4.5",
476
493
  rx: "2"
477
494
  })
478
- }), ue = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
479
- ...A,
495
+ }), re = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
496
+ ...S,
480
497
  ...e,
481
498
  children: [
482
499
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M3 7V5a2 2 0 0 1 2-2h2" }),
@@ -491,8 +508,8 @@ var A = {
491
508
  rx: "1"
492
509
  })
493
510
  ]
494
- }), de = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
495
- ...A,
511
+ }), M = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
512
+ ...S,
496
513
  ...e,
497
514
  children: [
498
515
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3" }),
@@ -502,8 +519,8 @@ var A = {
502
519
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M12 8v2" }),
503
520
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M12 2v2" })
504
521
  ]
505
- }), fe = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
506
- ...A,
522
+ }), ie = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
523
+ ...S,
507
524
  ...e,
508
525
  children: [
509
526
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3" }),
@@ -513,16 +530,16 @@ var A = {
513
530
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M16 12h-2" }),
514
531
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M22 12h-2" })
515
532
  ]
516
- }), pe = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
517
- ...A,
533
+ }), N = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
534
+ ...S,
518
535
  ...e,
519
536
  children: [/* @__PURE__ */ (0, x.jsx)("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }), /* @__PURE__ */ (0, x.jsx)("path", { d: "M21 3v5h-5" })]
520
- }), me = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
521
- ...A,
537
+ }), ae = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
538
+ ...S,
522
539
  ...e,
523
540
  children: [/* @__PURE__ */ (0, x.jsx)("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), /* @__PURE__ */ (0, x.jsx)("path", { d: "M3 3v5h5" })]
524
- }), he = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
525
- ...A,
541
+ }), oe = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
542
+ ...S,
526
543
  ...e,
527
544
  children: [
528
545
  /* @__PURE__ */ (0, x.jsx)("rect", {
@@ -544,8 +561,8 @@ var A = {
544
561
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M14 15h7" }),
545
562
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M14 20h7" })
546
563
  ]
547
- }), ge = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
548
- ...A,
564
+ }), se = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
565
+ ...S,
549
566
  ...e,
550
567
  children: [
551
568
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M10 5H3" }),
@@ -558,8 +575,8 @@ var A = {
558
575
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M8 10v4" }),
559
576
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M8 12H3" })
560
577
  ]
561
- }), _e = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
562
- ...A,
578
+ }), ce = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
579
+ ...S,
563
580
  ...e,
564
581
  children: [
565
582
  /* @__PURE__ */ (0, x.jsx)("rect", {
@@ -572,8 +589,8 @@ var A = {
572
589
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M9 3v18" }),
573
590
  /* @__PURE__ */ (0, x.jsx)("path", { d: "m14 9 3 3-3 3" })
574
591
  ]
575
- }), ve = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
576
- ...A,
592
+ }), le = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
593
+ ...S,
577
594
  ...e,
578
595
  children: [
579
596
  /* @__PURE__ */ (0, x.jsx)("rect", {
@@ -586,8 +603,8 @@ var A = {
586
603
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M9 3v18" }),
587
604
  /* @__PURE__ */ (0, x.jsx)("path", { d: "m16 15-3-3 3-3" })
588
605
  ]
589
- }), ye = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
590
- ...A,
606
+ }), ue = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
607
+ ...S,
591
608
  ...e,
592
609
  children: [
593
610
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M15 4V2" }),
@@ -600,16 +617,16 @@ var A = {
600
617
  /* @__PURE__ */ (0, x.jsx)("path", { d: "m3 21 9-9" }),
601
618
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M12.2 6.2 11 5" })
602
619
  ]
603
- }), be = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
604
- ...A,
620
+ }), de = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
621
+ ...S,
605
622
  ...e,
606
623
  children: [
607
624
  /* @__PURE__ */ (0, x.jsx)("path", { d: "M12 3v18" }),
608
625
  /* @__PURE__ */ (0, x.jsx)("path", { d: "m16 16 4-4-4-4" }),
609
626
  /* @__PURE__ */ (0, x.jsx)("path", { d: "m8 8-4 4 4 4" })
610
627
  ]
611
- }), xe = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
612
- ...A,
628
+ }), fe = (e) => /* @__PURE__ */ (0, x.jsxs)("svg", {
629
+ ...S,
613
630
  ...e,
614
631
  children: [
615
632
  /* @__PURE__ */ (0, x.jsx)("circle", {
@@ -643,8 +660,8 @@ var A = {
643
660
  r: "1"
644
661
  })
645
662
  ]
646
- }), Se = (e) => /* @__PURE__ */ (0, x.jsx)("svg", {
647
- ...A,
663
+ }), pe = (e) => /* @__PURE__ */ (0, x.jsx)("svg", {
664
+ ...S,
648
665
  ...e,
649
666
  children: /* @__PURE__ */ (0, x.jsx)("path", {
650
667
  d: "M21 12a9 9 0 1 1-6.219-8.56",
@@ -658,11 +675,7 @@ var A = {
658
675
  repeatCount: "indefinite"
659
676
  })
660
677
  })
661
- }), N = () => {
662
- let e = a(v);
663
- if (!e) throw Error("usePixediContext must be used within an PixediProvider");
664
- return e;
665
- }, P = {
678
+ }), P = {
666
679
  button: "_button_1vpzl_1",
667
680
  default: "_default_1vpzl_35",
668
681
  outline: "_outline_1vpzl_44",
@@ -673,15 +686,15 @@ var A = {
673
686
  className: `${P.button} ${P[t]} ${e}`.trim(),
674
687
  ...i,
675
688
  children: n
676
- }), Ce = { separator: "_separator_gp8ff_1" }, we = n(({ className: e = "", orientation: t = "horizontal", ...n }, r) => /* @__PURE__ */ (0, x.jsx)("hr", {
689
+ }), me = { separator: "_separator_gp8ff_1" }, he = n(({ className: e = "", orientation: t = "horizontal", ...n }, r) => /* @__PURE__ */ (0, x.jsx)("hr", {
677
690
  ref: r,
678
691
  role: "separator",
679
692
  "aria-orientation": t,
680
693
  "data-orientation": t,
681
- className: `${Ce.separator} ${e}`.trim(),
694
+ className: `${me.separator} ${e}`.trim(),
682
695
  ...n
683
696
  }));
684
- we.displayName = "Separator";
697
+ he.displayName = "Separator";
685
698
  var I = {
686
699
  wrapper: "_wrapper_1aw0m_1",
687
700
  trigger: "_trigger_1aw0m_6",
@@ -695,20 +708,21 @@ var I = {
695
708
  itemRight: "_itemRight_1aw0m_122",
696
709
  itemCheck: "_itemCheck_1aw0m_131"
697
710
  }, L = {
698
- root: "_root_1qifp_8",
699
- textRed: "_textRed_1qifp_78",
700
- bgRed: "_bgRed_1qifp_81",
701
- bgGreen: "_bgGreen_1qifp_84",
702
- textGreen: "_textGreen_1qifp_87",
703
- mask: "_mask_1qifp_90",
704
- semibold: "_semibold_1qifp_93",
705
- bold: "_bold_1qifp_97",
706
- system: "_system_1qifp_101",
707
- wrapper: "_wrapper_1qifp_111",
708
- grid: "_grid_1qifp_118",
709
- mobile: "_mobile_1qifp_130",
710
- gridNoInfobar: "_gridNoInfobar_1qifp_134"
711
- }, Te = (e) => {
711
+ root: "_root_187c5_8",
712
+ textRed: "_textRed_187c5_78",
713
+ bgRed: "_bgRed_187c5_81",
714
+ bgGreen: "_bgGreen_187c5_84",
715
+ textGreen: "_textGreen_187c5_87",
716
+ mask: "_mask_187c5_90",
717
+ semibold: "_semibold_187c5_93",
718
+ bold: "_bold_187c5_97",
719
+ system: "_system_187c5_101",
720
+ wrapper: "_wrapper_187c5_111",
721
+ grid: "_grid_187c5_118",
722
+ mobile: "_mobile_187c5_130",
723
+ gridNoInfobar: "_gridNoInfobar_187c5_134",
724
+ gridSingleTool: "_gridSingleTool_187c5_149"
725
+ }, ge = (e) => {
712
726
  let t = 0, n = window.innerHeight;
713
727
  for (let r = e.parentElement; r; r = r.parentElement) {
714
728
  let { overflow: e, overflowY: i } = getComputedStyle(r);
@@ -720,7 +734,7 @@ var I = {
720
734
  top: t,
721
735
  bottom: n
722
736
  };
723
- }, Ee = ({ items: e, value: t, onChange: n }) => {
737
+ }, _e = ({ items: e, value: t, onChange: n }) => {
724
738
  let [r, i] = d(!1), a = u(null), s = u(null), f = u(null), p = l(() => {
725
739
  let t = (e) => e.reduce((e, n) => n.options ? [...e, ...t(n.options.map((e) => ({
726
740
  ...e,
@@ -737,7 +751,7 @@ var I = {
737
751
  let e = a.current, t = s.current, n = f.current;
738
752
  if (!r || !e || !t || !n) return;
739
753
  n.style.removeProperty("top"), n.style.removeProperty("max-height");
740
- let { top: i, bottom: o } = Te(e), c = e.getBoundingClientRect().top, l = t.getBoundingClientRect(), u = n.offsetHeight, d = o - 8 - l.bottom - 4, p = l.top - 4 - i - 8, m = l.bottom + 4, h = 0;
754
+ let { top: i, bottom: o } = ge(e), c = e.getBoundingClientRect().top, l = t.getBoundingClientRect(), u = n.offsetHeight, d = o - 8 - l.bottom - 4, p = l.top - 4 - i - 8, m = l.bottom + 4, h = 0;
741
755
  u > d && (u <= p ? m = l.top - 4 - u : p > d ? (h = Math.max(p, 0), m = l.top - 4 - h) : h = Math.max(d, 0)), h && (n.style.maxHeight = `${h}px`), n.style.top = `${m - c}px`;
742
756
  }, [r, e]), {
743
757
  isOpen: r,
@@ -750,8 +764,8 @@ var I = {
750
764
  },
751
765
  toggleOpen: () => i((e) => !e)
752
766
  };
753
- }, De = ({ items: e, value: t, onChange: n, placeholder: r = "Select an option", className: i = "", renderOption: a }) => {
754
- let { isOpen: o, selectedLabel: s, containerRef: c, triggerRef: l, contentRef: u, handleSelectItem: d, toggleOpen: f } = Ee({
767
+ }, ve = ({ items: e, value: t, onChange: n, placeholder: r = "Select an option", className: i = "", renderOption: a }) => {
768
+ let { isOpen: o, selectedLabel: s, containerRef: c, triggerRef: l, contentRef: u, handleSelectItem: d, toggleOpen: f } = _e({
755
769
  items: e,
756
770
  value: t,
757
771
  onChange: n
@@ -765,7 +779,7 @@ var I = {
765
779
  type: "button",
766
780
  className: I.trigger,
767
781
  onClick: f,
768
- children: [/* @__PURE__ */ (0, x.jsx)("span", { children: s ?? r }), /* @__PURE__ */ (0, x.jsx)(ne, { className: I.triggerArrow })]
782
+ children: [/* @__PURE__ */ (0, x.jsx)("span", { children: s ?? r }), /* @__PURE__ */ (0, x.jsx)(D, { className: I.triggerArrow })]
769
783
  }), /* @__PURE__ */ (0, x.jsx)("div", {
770
784
  ref: u,
771
785
  className: I.content,
@@ -782,7 +796,7 @@ var I = {
782
796
  className: I.itemAddon,
783
797
  children: [
784
798
  e.rightLabel && /* @__PURE__ */ (0, x.jsx)("span", { children: e.rightLabel }),
785
- t === e.value && /* @__PURE__ */ (0, x.jsx)(j, { className: I.itemCheck }),
799
+ t === e.value && /* @__PURE__ */ (0, x.jsx)(C, { className: I.itemCheck }),
786
800
  t !== e.value && /* @__PURE__ */ (0, x.jsx)("b", {})
787
801
  ]
788
802
  })]
@@ -796,66 +810,66 @@ var I = {
796
810
  className: I.itemAddon,
797
811
  children: [
798
812
  e.rightLabel && /* @__PURE__ */ (0, x.jsx)("span", { children: e.rightLabel }),
799
- t === e.value && /* @__PURE__ */ (0, x.jsx)(j, { className: I.itemCheck }),
813
+ t === e.value && /* @__PURE__ */ (0, x.jsx)(C, { className: I.itemCheck }),
800
814
  t !== e.value && /* @__PURE__ */ (0, x.jsx)("b", {})
801
815
  ]
802
816
  })]
803
817
  }, e.value))
804
818
  })]
805
819
  });
806
- }, Oe = {
820
+ }, ye = {
807
821
  input: "_input_kyavx_1",
808
822
  numberClean: "_numberClean_kyavx_39"
809
- }, ke = ({ className: e = "", type: t = "text", hideArrows: n = !0, ref: r, ...i }) => {
810
- let a = t === "number" && n ? Oe.numberClean : "";
823
+ }, be = ({ className: e = "", type: t = "text", hideArrows: n = !0, ref: r, ...i }) => {
824
+ let a = t === "number" && n ? ye.numberClean : "";
811
825
  return /* @__PURE__ */ (0, x.jsx)("input", {
812
826
  ref: r,
813
827
  type: t,
814
- className: `${Oe.input} ${a} ${e}`.trim(),
828
+ className: `${ye.input} ${a} ${e}`.trim(),
815
829
  ...i
816
830
  });
817
- }, Ae = {
831
+ }, xe = {
818
832
  container: "_container_14vsv_1",
819
833
  legend: "_legend_14vsv_4",
820
834
  suffix: "_suffix_14vsv_13"
821
- }, je = ({ label: e, className: t = "", style: n, ref: r, ...i }) => /* @__PURE__ */ (0, x.jsxs)("div", {
822
- className: `${Ae.container} ${t}`.trim(),
835
+ }, Se = ({ label: e, className: t = "", style: n, ref: r, ...i }) => /* @__PURE__ */ (0, x.jsxs)("div", {
836
+ className: `${xe.container} ${t}`.trim(),
823
837
  style: n,
824
838
  children: [
825
839
  /* @__PURE__ */ (0, x.jsx)("span", {
826
- className: Ae.legend,
840
+ className: xe.legend,
827
841
  children: e
828
842
  }),
829
- /* @__PURE__ */ (0, x.jsx)(ke, {
843
+ /* @__PURE__ */ (0, x.jsx)(be, {
830
844
  ref: r,
831
845
  type: "number",
832
846
  ...i
833
847
  }),
834
848
  /* @__PURE__ */ (0, x.jsx)("span", {
835
- className: Ae.suffix,
849
+ className: xe.suffix,
836
850
  children: "px"
837
851
  })
838
852
  ]
839
- }), Me = {
853
+ }), Ce = {
840
854
  group: "_group_1e7jm_1",
841
855
  save: "_save_1e7jm_6",
842
856
  close: "_close_1e7jm_13"
843
857
  }, R = ({ onSave: e, onClose: t, saving: n = !1, disabled: r = !1 }) => /* @__PURE__ */ (0, x.jsxs)("div", {
844
- className: Me.group,
858
+ className: Ce.group,
845
859
  children: [/* @__PURE__ */ (0, x.jsx)(F, {
846
860
  variant: "outline",
847
- className: Me.save,
861
+ className: Ce.save,
848
862
  "aria-label": "Save",
849
863
  disabled: r || n,
850
864
  onClick: e,
851
- children: n ? /* @__PURE__ */ (0, x.jsx)(Se, {}) : /* @__PURE__ */ (0, x.jsx)(j, {})
865
+ children: n ? /* @__PURE__ */ (0, x.jsx)(pe, {}) : /* @__PURE__ */ (0, x.jsx)(C, {})
852
866
  }), /* @__PURE__ */ (0, x.jsx)(F, {
853
867
  variant: "outline",
854
- className: Me.close,
868
+ className: Ce.close,
855
869
  "aria-label": "Close",
856
870
  disabled: n,
857
871
  onClick: t,
858
- children: /* @__PURE__ */ (0, x.jsx)(ee, {})
872
+ children: /* @__PURE__ */ (0, x.jsx)(w, {})
859
873
  })]
860
874
  }), z = {
861
875
  sliderContainer: "_sliderContainer_1unyb_1",
@@ -865,10 +879,10 @@ var I = {
865
879
  sliderRange: "_sliderRange_1unyb_34",
866
880
  sliderTooltip: "_sliderTooltip_1unyb_58",
867
881
  hiddenInput: "_hiddenInput_1unyb_86"
868
- }, Ne = (e, t, n) => {
882
+ }, we = (e, t, n) => {
869
883
  let r = n - t;
870
884
  return r <= 0 ? 0 : (e - t) / r * 100;
871
- }, Pe = /* @__PURE__ */ new Set([
885
+ }, Te = /* @__PURE__ */ new Set([
872
886
  "ArrowDown",
873
887
  "ArrowLeft",
874
888
  "ArrowRight",
@@ -877,12 +891,12 @@ var I = {
877
891
  "Home",
878
892
  "PageDown",
879
893
  "PageUp"
880
- ]), Fe = ({ min: e, max: t, value: n, step: r = 1, disabled: i = !1, isTooltip: a = !1, unit: o = "", className: l, onChange: f, onInput: p, ref: m }) => {
894
+ ]), Ee = ({ min: e, max: t, value: n, step: r = 1, disabled: i = !1, isTooltip: a = !1, unit: o = "", className: l, onChange: f, onInput: p, ref: m }) => {
881
895
  let h = u(null), g = u(null), _ = n ?? e, [v, y] = d(_);
882
896
  s(m, () => ({ getValue: () => v }), [v]);
883
897
  let b = (n) => {
884
898
  y(n);
885
- let r = Ne(n, e, t);
899
+ let r = we(n, e, t);
886
900
  h.current?.style.setProperty("--slider-progress", `${r}%`);
887
901
  }, S = () => {
888
902
  !i && g.current && f?.(Number(g.current.value));
@@ -892,7 +906,7 @@ var I = {
892
906
  n !== void 0 && (g.current.value = String(n));
893
907
  let r = Number(g.current.value);
894
908
  y(r);
895
- let i = Ne(r, e, t);
909
+ let i = we(r, e, t);
896
910
  h.current?.style.setProperty("--slider-progress", `${i}%`);
897
911
  }, [
898
912
  n,
@@ -901,7 +915,7 @@ var I = {
901
915
  ]), /* @__PURE__ */ (0, x.jsxs)("div", {
902
916
  ref: h,
903
917
  className: `${z.sliderContainer} ${i ? z.disabled : ""} ${l || ""}`,
904
- style: { "--slider-progress": `${Ne(_, e, t)}%` },
918
+ style: { "--slider-progress": `${we(_, e, t)}%` },
905
919
  children: [/* @__PURE__ */ (0, x.jsxs)("div", {
906
920
  className: z.sliderTrack,
907
921
  children: [
@@ -928,7 +942,7 @@ var I = {
928
942
  S();
929
943
  },
930
944
  onKeyUp: (e) => {
931
- Pe.has(e.key) && S();
945
+ Te.has(e.key) && S();
932
946
  },
933
947
  className: z.hiddenInput
934
948
  })]
@@ -936,450 +950,215 @@ var I = {
936
950
  }, B = {
937
951
  tooltip: "_tooltip_1rdl9_1",
938
952
  container: "_container_1rdl9_5",
939
- popup: "_popup_1rdl9_19",
940
- animated: "_animated_1rdl9_92",
941
- mask: "_mask_1rdl9_101",
942
- track: "_track_1rdl9_108",
943
- title: "_title_1rdl9_125"
944
- }, Ie = (t, n = "top") => {
945
- let [i, a] = d(null), [s, f] = d(null), [p, m] = d(!1), [h, g] = d(!1), [_, v] = d([]), y = u(null), b = u(null), x = u([]), S = n === "left" || n === "right", C = l(() => {
946
- let n = [];
947
- return e.forEach(t, (e) => {
948
- if (r(e)) {
949
- let { "data-tooltip": t } = e.props;
950
- t && n.push(t);
951
- }
952
- }), n;
953
- }, [t]), w = C.join("\0"), T = C.length;
954
- c(() => {
955
- let e = () => {
956
- let e = x.current.slice(0, T).map((e) => ({
957
- w: e?.offsetWidth ?? 0,
958
- h: e?.offsetHeight ?? 0
959
- }));
960
- v((t) => t.length === e.length && t.every((t, n) => t.w === e[n].w && t.h === e[n].h) ? t : e);
961
- };
962
- e();
963
- let t = b.current;
964
- if (!t || typeof ResizeObserver > "u") return;
965
- let n = new ResizeObserver(e);
966
- return n.observe(t), () => n.disconnect();
967
- }, [w, T]), o(() => {
968
- if (!p || h) return;
969
- let e = 0, t = requestAnimationFrame(() => {
970
- e = requestAnimationFrame(() => g(!0));
971
- });
972
- return () => {
973
- cancelAnimationFrame(t), cancelAnimationFrame(e);
974
- };
975
- }, [p, h]);
976
- let E = (e) => {
977
- let t = e.target.closest("[data-tooltip]");
978
- if (!t) {
979
- m(!1);
980
- return;
981
- }
982
- let r = t.parentElement;
983
- if (!r) return;
984
- let o = Array.from(r.children).indexOf(t);
985
- if (o === -1 || p && o === i) return;
986
- let s = y.current?.getBoundingClientRect();
987
- if (!s) return;
988
- let c = t.getBoundingClientRect(), l = S ? {
989
- x: n === "left" ? c.left - s.left - 4 : c.right - s.left + 4,
990
- y: c.top - s.top + c.height / 2
991
- } : {
992
- x: c.left - s.left + c.width / 2,
993
- y: n === "top" ? c.top - s.top - 8 : c.bottom - s.top + 8
994
- };
995
- p || g(!1), f(l), a(o), m(!0);
996
- }, D = () => m(!1), O = i ?? 0, k = _[O], A = _.slice(0, O).reduce((e, t) => e + (S ? t.h : t.w), 0);
997
- return {
998
- containerRef: y,
999
- trackRef: b,
1000
- titleRefs: x,
1001
- titles: C,
1002
- position: n,
1003
- isVisible: p,
1004
- isAnimated: h,
1005
- cssVars: {
1006
- "--tooltip-x": s ? `${s.x}px` : "0px",
1007
- "--tooltip-y": s ? `${s.y}px` : "0px",
1008
- "--tooltip-opacity": p ? "1" : "0",
1009
- "--tooltip-w": k?.w ? `${k.w}px` : "auto",
1010
- "--tooltip-h": k?.h ? `${k.h}px` : "auto",
1011
- "--tooltip-offset": `${A}px`
1012
- },
1013
- handleMouseMove: E,
1014
- handleMouseLeave: D
1015
- };
1016
- }, V = ({ children: e, position: t = "top", className: n = "", classNameTitle: r = "", style: i }) => {
1017
- let { containerRef: a, trackRef: o, titleRefs: s, titles: c, isAnimated: l, cssVars: u, handleMouseMove: d, handleMouseLeave: f } = Ie(e, t);
1018
- return /* @__PURE__ */ (0, x.jsxs)("div", {
1019
- ref: a,
1020
- onMouseMove: d,
1021
- onMouseLeave: f,
1022
- onBlur: f,
1023
- className: B.tooltip,
1024
- style: {
1025
- ...u,
1026
- ...i
1027
- },
1028
- children: [/* @__PURE__ */ (0, x.jsx)("div", {
1029
- "data-position": t,
1030
- className: `${B.container} ${n}`,
1031
- children: e
1032
- }), /* @__PURE__ */ (0, x.jsx)("div", {
1033
- "aria-hidden": "true",
1034
- "data-position": t,
1035
- className: `${B.popup} ${l ? B.animated : ""}`,
1036
- children: /* @__PURE__ */ (0, x.jsx)("div", {
1037
- className: B.mask,
1038
- children: /* @__PURE__ */ (0, x.jsx)("div", {
1039
- ref: o,
1040
- "data-position": t,
1041
- className: B.track,
1042
- children: c.map((e, t) => /* @__PURE__ */ (0, x.jsx)("div", {
1043
- ref: (e) => {
1044
- s.current[t] = e;
1045
- },
1046
- className: `${B.title} ${r}`,
1047
- children: e
1048
- }, t))
1049
- })
1050
- })
1051
- })]
1052
- });
1053
- }, Le = t(void 0), Re = () => {
1054
- let e = a(Le), t = u({
1055
- dx: 0,
1056
- dy: 0
1057
- });
1058
- return e ?? t;
1059
- };
1060
- //#endregion
1061
- //#region src/shared/components/Pixedi/ui/surface-tool/useSurfaceTool.tsx
1062
- function H(e, t, n) {
1063
- return Math.min(Math.max(e, t), n);
1064
- }
1065
- function ze(e, { dx: t, dy: n }) {
1066
- e.style.transform = `translate(calc(-50% + ${t}px), ${n}px)`;
1067
- }
1068
- function Be(e, t) {
1069
- let n = e.parentElement;
1070
- if (!n) return null;
1071
- let r = e.getBoundingClientRect(), i = n.getBoundingClientRect(), a = r.left - i.left - t.dx, o = r.top - i.top - t.dy;
1072
- return {
1073
- minDx: -a,
1074
- maxDx: Math.max(-a, i.width - r.width - a),
1075
- minDy: -o,
1076
- maxDy: Math.max(-o, i.height - r.height - o)
1077
- };
1078
- }
1079
- var Ve = ({ surfaceRef: e }) => {
1080
- let t = O(), n = Re(), r = u(null), i = u({
1081
- dx: 0,
1082
- dy: 0
1083
- }), a = u(null);
1084
- return o(() => {
1085
- let o = e.current;
1086
- if (!o) return;
1087
- let s = (e) => {
1088
- n.current = e, ze(o, e);
1089
- }, c = () => {
1090
- let e = Be(o, n.current);
1091
- if (!e) return;
1092
- let { dx: t, dy: r } = n.current;
1093
- s({
1094
- dx: H(t, e.minDx, e.maxDx),
1095
- dy: H(r, e.minDy, e.maxDy)
1096
- });
1097
- }, l = (e) => {
1098
- let t = r.current, n = a.current;
1099
- if (!t || !n) return;
1100
- e.preventDefault();
1101
- let o = "clientX" in e ? e.clientX : e.touches[0].clientX, c = "clientY" in e ? e.clientY : e.touches[0].clientY;
1102
- s({
1103
- dx: H(i.current.dx + (o - t.x), n.minDx, n.maxDx),
1104
- dy: H(i.current.dy + (c - t.y), n.minDy, n.maxDy)
1105
- });
1106
- }, u = () => {
1107
- r.current && (r.current = null, a.current = null, t || (document.body.style.cursor = ""));
1108
- };
1109
- c();
1110
- let d = new AbortController(), { signal: f } = d;
1111
- if (document.addEventListener("mousemove", l, { signal: f }), document.addEventListener("touchmove", l, {
1112
- signal: f,
1113
- passive: !1
1114
- }), document.addEventListener("mouseup", u, { signal: f }), document.addEventListener("touchend", u, { signal: f }), typeof ResizeObserver < "u" && o.parentElement) {
1115
- let e = new ResizeObserver(c);
1116
- e.observe(o.parentElement), f.addEventListener("abort", () => e.disconnect());
1117
- }
1118
- return () => d.abort();
1119
- }, [
1120
- e,
1121
- n,
1122
- t
1123
- ]), { handleDragStart: (o) => {
1124
- let s = e.current;
1125
- if (!s) return;
1126
- o.stopPropagation();
1127
- let c = Be(s, n.current);
1128
- if (!c) return;
1129
- let l = "clientX" in o ? o.clientX : o.touches[0].clientX, u = "clientY" in o ? o.clientY : o.touches[0].clientY;
1130
- r.current = {
1131
- x: l,
1132
- y: u
1133
- }, i.current = { ...n.current }, a.current = c, t || (document.body.style.cursor = "move");
1134
- } };
1135
- }, He = {
1136
- surfaceTool: "_surfaceTool_1skmt_1",
1137
- content: "_content_1skmt_18",
1138
- drag: "_drag_1skmt_22"
1139
- }, U = ({ children: e, className: t = "", ref: n }) => {
1140
- let r = u(null), { handleDragStart: i } = Ve({ surfaceRef: r });
1141
- return /* @__PURE__ */ (0, x.jsxs)("div", {
1142
- ref: (e) => {
1143
- r.current = e, n && (n.current = e);
1144
- },
1145
- className: He.surfaceTool,
1146
- children: [/* @__PURE__ */ (0, x.jsx)(xe, {
1147
- className: He.drag,
1148
- onMouseDown: i,
1149
- onTouchStart: i
1150
- }), /* @__PURE__ */ (0, x.jsx)("div", {
1151
- className: `${He.content} ${t}`,
1152
- children: e
1153
- })]
1154
- });
1155
- }, Ue = ({ children: e }) => /* @__PURE__ */ (0, x.jsx)(Le, {
1156
- value: u({
1157
- dx: 0,
1158
- dy: 0
1159
- }),
1160
- children: e
1161
- }), We = 1920, Ge = .85, Ke = [
1162
- {
1163
- label: "Facebook",
1164
- value: "facebook",
1165
- options: [
1166
- {
1167
- value: "facebook-post",
1168
- label: "Post",
1169
- w: 1200,
1170
- h: 630,
1171
- rightLabel: "1200 x 630"
1172
- },
1173
- {
1174
- value: "facebook-cover",
1175
- label: "Cover",
1176
- w: 851,
1177
- h: 315,
1178
- rightLabel: "851 x 315"
1179
- },
1180
- {
1181
- value: "facebook-profile",
1182
- label: "Profile",
1183
- w: 170,
1184
- h: 170,
1185
- rightLabel: "170 x 170"
1186
- },
1187
- {
1188
- value: "facebook-story",
1189
- label: "Story",
1190
- w: 1080,
1191
- h: 1920,
1192
- rightLabel: "1080 x 1920"
1193
- }
1194
- ]
1195
- },
1196
- {
1197
- label: "Instagram",
1198
- value: "instagram",
1199
- options: [
1200
- {
1201
- value: "instagram-landscape",
1202
- label: "Landscape",
1203
- w: 1080,
1204
- h: 566,
1205
- rightLabel: "1080 x 566"
1206
- },
1207
- {
1208
- value: "instagram-portait",
1209
- label: "Portait",
1210
- w: 1080,
1211
- h: 1350,
1212
- rightLabel: "1080 x 1350"
1213
- },
1214
- {
1215
- value: "instagram-square",
1216
- label: "Square",
1217
- w: 1080,
1218
- h: 1080,
1219
- rightLabel: "1080 x 1080"
1220
- },
1221
- {
1222
- value: "instagram-story",
1223
- label: "Story",
1224
- w: 1080,
1225
- h: 1920,
1226
- rightLabel: "1080 x 1920"
1227
- },
1228
- {
1229
- value: "instagram-thumbnail",
1230
- label: "Thumbnail",
1231
- w: 161,
1232
- h: 161,
1233
- rightLabel: "161 x 161"
1234
- }
1235
- ]
1236
- },
1237
- {
1238
- label: "LinkedIn",
1239
- value: "linkedin",
1240
- options: [
1241
- {
1242
- value: "linkedin-blog-post",
1243
- label: "Blog Post",
1244
- w: 1200,
1245
- h: 627,
1246
- rightLabel: "1200 x 627"
1247
- },
1248
- {
1249
- value: "linkedin-cover",
1250
- label: "Cover",
1251
- w: 1128,
1252
- h: 191,
1253
- rightLabel: "1128 x 191"
1254
- },
1255
- {
1256
- value: "linkedin-profile",
1257
- label: "Profile",
1258
- w: 400,
1259
- h: 400,
1260
- rightLabel: "400 x 400"
1261
- }
1262
- ]
1263
- }
1264
- ], qe = [
1265
- {
1266
- value: "saturate",
1267
- label: "Saturate",
1268
- min: 0,
1269
- max: 200,
1270
- step: 1,
1271
- unit: "%",
1272
- sliderValue: 100,
1273
- rightLabel: "100%"
1274
- },
1275
- {
1276
- value: "grayscale",
1277
- label: "Grayscale",
1278
- min: 0,
1279
- max: 100,
1280
- step: 1,
1281
- unit: "%",
1282
- sliderValue: 0,
1283
- rightLabel: "0%"
1284
- },
1285
- {
1286
- value: "sepia",
1287
- label: "Sepia",
1288
- min: 0,
1289
- max: 100,
1290
- step: 1,
1291
- unit: "%",
1292
- sliderValue: 0,
1293
- rightLabel: "0%"
1294
- },
1295
- {
1296
- value: "invert",
1297
- label: "Invert",
1298
- min: 0,
1299
- max: 100,
1300
- step: 1,
1301
- unit: "%",
1302
- sliderValue: 0,
1303
- rightLabel: "0%"
1304
- },
1305
- {
1306
- value: "hueRotate",
1307
- label: "Hue Rotate",
1308
- min: 0,
1309
- max: 360,
1310
- step: 1,
1311
- unit: "°",
1312
- sliderValue: 0,
1313
- rightLabel: "0°"
1314
- },
1315
- {
1316
- value: "brightness",
1317
- label: "Brightness",
1318
- min: 0,
1319
- max: 200,
1320
- step: 1,
1321
- unit: "%",
1322
- sliderValue: 100,
1323
- rightLabel: "100%"
1324
- },
1325
- {
1326
- value: "contrast",
1327
- label: "Contrast",
1328
- min: 0,
1329
- max: 200,
1330
- step: 1,
1331
- unit: "%",
1332
- sliderValue: 100,
1333
- rightLabel: "100%"
1334
- }
1335
- ], Je = [
1336
- {
1337
- value: "vintage",
1338
- label: "Vintage"
1339
- },
1340
- {
1341
- value: "olive-army",
1342
- label: "Olive Army"
1343
- },
1344
- {
1345
- value: "warm-sunset",
1346
- label: "Warm Sunset"
1347
- },
1348
- {
1349
- value: "sin-city-red",
1350
- label: "Sin City Red"
1351
- },
1352
- {
1353
- value: "plastic-wrap",
1354
- label: "Plastic Wrap"
1355
- },
1356
- {
1357
- value: "cross-process",
1358
- label: "Cross-Processing"
1359
- },
1360
- {
1361
- value: "crt-lines",
1362
- label: "CRT Monitor"
1363
- },
1364
- {
1365
- value: "grain",
1366
- label: "Grain / Noise"
1367
- },
1368
- {
1369
- value: "emboss",
1370
- label: "Emboss Effect"
1371
- },
1372
- {
1373
- value: "x-ray",
1374
- label: "X-Ray"
953
+ popup: "_popup_1rdl9_19",
954
+ animated: "_animated_1rdl9_92",
955
+ mask: "_mask_1rdl9_101",
956
+ track: "_track_1rdl9_108",
957
+ title: "_title_1rdl9_125"
958
+ }, De = (t, n = "top") => {
959
+ let [i, a] = d(null), [s, f] = d(null), [p, m] = d(!1), [h, g] = d(!1), [_, v] = d([]), y = u(null), b = u(null), x = u([]), S = n === "left" || n === "right", C = l(() => {
960
+ let n = [];
961
+ return e.forEach(t, (e) => {
962
+ if (r(e)) {
963
+ let { "data-tooltip": t } = e.props;
964
+ t && n.push(t);
965
+ }
966
+ }), n;
967
+ }, [t]), w = C.join("\0"), T = C.length;
968
+ c(() => {
969
+ let e = () => {
970
+ let e = x.current.slice(0, T).map((e) => ({
971
+ w: e?.offsetWidth ?? 0,
972
+ h: e?.offsetHeight ?? 0
973
+ }));
974
+ v((t) => t.length === e.length && t.every((t, n) => t.w === e[n].w && t.h === e[n].h) ? t : e);
975
+ };
976
+ e();
977
+ let t = b.current;
978
+ if (!t || typeof ResizeObserver > "u") return;
979
+ let n = new ResizeObserver(e);
980
+ return n.observe(t), () => n.disconnect();
981
+ }, [w, T]), o(() => {
982
+ if (!p || h) return;
983
+ let e = 0, t = requestAnimationFrame(() => {
984
+ e = requestAnimationFrame(() => g(!0));
985
+ });
986
+ return () => {
987
+ cancelAnimationFrame(t), cancelAnimationFrame(e);
988
+ };
989
+ }, [p, h]);
990
+ let E = (e) => {
991
+ let t = e.target.closest("[data-tooltip]");
992
+ if (!t) {
993
+ m(!1);
994
+ return;
995
+ }
996
+ let r = t.parentElement;
997
+ if (!r) return;
998
+ let o = Array.from(r.children).indexOf(t);
999
+ if (o === -1 || p && o === i) return;
1000
+ let s = y.current?.getBoundingClientRect();
1001
+ if (!s) return;
1002
+ let c = t.getBoundingClientRect(), l = S ? {
1003
+ x: n === "left" ? c.left - s.left - 4 : c.right - s.left + 4,
1004
+ y: c.top - s.top + c.height / 2
1005
+ } : {
1006
+ x: c.left - s.left + c.width / 2,
1007
+ y: n === "top" ? c.top - s.top - 8 : c.bottom - s.top + 8
1008
+ };
1009
+ p || g(!1), f(l), a(o), m(!0);
1010
+ }, D = () => m(!1), O = i ?? 0, k = _[O], A = _.slice(0, O).reduce((e, t) => e + (S ? t.h : t.w), 0);
1011
+ return {
1012
+ containerRef: y,
1013
+ trackRef: b,
1014
+ titleRefs: x,
1015
+ titles: C,
1016
+ position: n,
1017
+ isVisible: p,
1018
+ isAnimated: h,
1019
+ cssVars: {
1020
+ "--tooltip-x": s ? `${s.x}px` : "0px",
1021
+ "--tooltip-y": s ? `${s.y}px` : "0px",
1022
+ "--tooltip-opacity": p ? "1" : "0",
1023
+ "--tooltip-w": k?.w ? `${k.w}px` : "auto",
1024
+ "--tooltip-h": k?.h ? `${k.h}px` : "auto",
1025
+ "--tooltip-offset": `${A}px`
1026
+ },
1027
+ handleMouseMove: E,
1028
+ handleMouseLeave: D
1029
+ };
1030
+ }, V = ({ children: e, position: t = "top", className: n = "", classNameTitle: r = "", style: i }) => {
1031
+ let { containerRef: a, trackRef: o, titleRefs: s, titles: c, isAnimated: l, cssVars: u, handleMouseMove: d, handleMouseLeave: f } = De(e, t);
1032
+ return /* @__PURE__ */ (0, x.jsxs)("div", {
1033
+ ref: a,
1034
+ onMouseMove: d,
1035
+ onMouseLeave: f,
1036
+ onBlur: f,
1037
+ className: B.tooltip,
1038
+ style: {
1039
+ ...u,
1040
+ ...i
1041
+ },
1042
+ children: [/* @__PURE__ */ (0, x.jsx)("div", {
1043
+ "data-position": t,
1044
+ className: `${B.container} ${n}`,
1045
+ children: e
1046
+ }), /* @__PURE__ */ (0, x.jsx)("div", {
1047
+ "aria-hidden": "true",
1048
+ "data-position": t,
1049
+ className: `${B.popup} ${l ? B.animated : ""}`,
1050
+ children: /* @__PURE__ */ (0, x.jsx)("div", {
1051
+ className: B.mask,
1052
+ children: /* @__PURE__ */ (0, x.jsx)("div", {
1053
+ ref: o,
1054
+ "data-position": t,
1055
+ className: B.track,
1056
+ children: c.map((e, t) => /* @__PURE__ */ (0, x.jsx)("div", {
1057
+ ref: (e) => {
1058
+ s.current[t] = e;
1059
+ },
1060
+ className: `${B.title} ${r}`,
1061
+ children: e
1062
+ }, t))
1063
+ })
1064
+ })
1065
+ })]
1066
+ });
1067
+ }, Oe = "(function(){let e=async e=>{let{width:t,height:n}=e,r=Math.min(1,1920/Math.max(t,n)),i=Math.round(t*r),a=Math.round(n*r),o=new OffscreenCanvas(i,a),s=o.getContext(`2d`);if(!s)throw Error(`Failed to get 2D context for preview canvas`);return s.drawImage(e,0,0,i,a),o.convertToBlob({type:`image/webp`,quality:.85})};function t(e){let t=new OffscreenCanvas(e.width,e.height),n=t.getContext(`2d`);if(!n)throw Error(`Failed to create 2D context for canvas.`);n.drawImage(e,0,0);try{let e=n.getImageData(0,0,t.width,t.height).data;for(let t=3;t<e.length;t+=4)if(e[t]<255)return!0;return!1}catch(e){throw Error(`Error reading pixels: ${e}`,{cause:e})}}self.onmessage=async n=>{let r=``;try{let i;if(n.data instanceof Blob)i=n.data;else{let e=n.data.trim();!e.startsWith(`http://`)&&!e.startsWith(`https://`)&&!e.startsWith(`blob:`)&&!e.startsWith(`data:`)&&(r=`image/png`,e=`data:${r};base64,${e}`);let t=await fetch(e);if(!t.ok)throw Error(`HTTP error! Status: ${t.status}`);i=await t.blob()}let a=i.type||r||`image/unknown`,o=await createImageBitmap(i),{width:s,height:c}=o,l=await e(o),u=t(o);o.close(),self.postMessage({success:!0,originalBlob:i,previewBlob:l,mimeType:a,width:s,height:c,isAlpha:u})}catch(e){self.postMessage({success:!1,error:e instanceof Error?e.message:`An error occurred during image loader worker execution.`})}}})();", ke = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Oe], { type: "text/javascript;charset=utf-8" });
1068
+ function Ae(e) {
1069
+ let t;
1070
+ try {
1071
+ if (t = ke && (self.URL || self.webkitURL).createObjectURL(ke), !t) throw "";
1072
+ let n = new Worker(t, { name: e?.name });
1073
+ return n.addEventListener("error", () => {
1074
+ (self.URL || self.webkitURL).revokeObjectURL(t);
1075
+ }), n;
1076
+ } catch {
1077
+ return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(Oe), { name: e?.name });
1375
1078
  }
1376
- ], W = 32, Ye = (e, t, n, r, i, a, o, s, c, l) => {
1079
+ }
1080
+ //#endregion
1081
+ //#region src/shared/components/Pixedi/hooks/useImageLoader.tsx
1082
+ var je = ({ src: e, skip: t = !1 }) => {
1083
+ let [n, r] = d({
1084
+ loading: !t,
1085
+ error: "",
1086
+ width: 0,
1087
+ height: 0,
1088
+ mimeType: "",
1089
+ originalBlob: null,
1090
+ previewUrl: "",
1091
+ isAlpha: !1
1092
+ }), i = u(null);
1093
+ return o(() => {
1094
+ if (!e || t) return;
1095
+ let n = new Ae();
1096
+ return n.postMessage(e), n.onmessage = (e) => {
1097
+ let t = e.data;
1098
+ t.success ? (i.current && URL.revokeObjectURL(i.current), i.current = URL.createObjectURL(t.previewBlob), r({
1099
+ loading: !1,
1100
+ error: "",
1101
+ mimeType: t.mimeType,
1102
+ width: t.width,
1103
+ height: t.height,
1104
+ originalBlob: t.originalBlob,
1105
+ previewUrl: i.current,
1106
+ isAlpha: t.isAlpha
1107
+ })) : r((e) => ({
1108
+ ...e,
1109
+ loading: !1,
1110
+ error: t.error || "Error processing image."
1111
+ }));
1112
+ }, () => {
1113
+ n.terminate(), i.current &&= (URL.revokeObjectURL(i.current), null);
1114
+ };
1115
+ }, [t, e]), n;
1116
+ }, Me = () => {
1117
+ if (typeof window > "u" || !window.navigator) return null;
1118
+ let e = window.navigator.userAgent.toLowerCase();
1119
+ return /android/.test(e) ? "android" : /iphone|ipad|ipod/.test(e) ? "ios" : /windows phone/.test(e) ? "windows-phone" : /blackberry|bb10/.test(e) ? "blackberry" : /opera mini/.test(e) ? "opera-mini" : /mobile/.test(e) ? "mobile" : null;
1120
+ }, H = () => {
1121
+ let [e] = d(() => Me());
1122
+ return e;
1123
+ }, Ne = {
1124
+ sm: 480,
1125
+ md: 768,
1126
+ lg: 1024,
1127
+ xl: 1280
1128
+ }, U = {
1129
+ INITIAL: "initial",
1130
+ RESIZE: "resize",
1131
+ CROP: "crop",
1132
+ PRESET_CROP: "presetCrop",
1133
+ FLIP: "flip",
1134
+ ROTATE: "rotate",
1135
+ FILTERS: "filters"
1136
+ };
1137
+ //#endregion
1138
+ //#region src/shared/components/Pixedi/hooks/useBellow.tsx
1139
+ function Pe(e, t) {
1140
+ let [n, r] = d(!0);
1141
+ return o(() => {
1142
+ if (!t) return;
1143
+ let n = new ResizeObserver(([t]) => {
1144
+ t && r(t.contentRect.width < Ne[e]);
1145
+ });
1146
+ return n.observe(t), () => n.disconnect();
1147
+ }, [e, t]), n;
1148
+ }
1149
+ //#endregion
1150
+ //#region src/shared/components/Pixedi/provider/StoreContext.tsx
1151
+ var Fe = t(void 0), W = () => {
1152
+ let e = a(Fe);
1153
+ if (!e) throw Error("usePixediContext must be used within an PixediProvider");
1154
+ return e;
1155
+ }, G = 32, Ie = (e, t, n, r, i, a, o, s, c, l) => {
1377
1156
  let { x: u, y: d, w: f, h: p } = c;
1378
1157
  if (e) {
1379
1158
  let e = o - c.w - c.x;
1380
- u += i - n, u < 0 && (u = 0), f = o - u - e, f < W && (f = W, u = o - e - W);
1159
+ u += i - n, u < 0 && (u = 0), f = o - u - e, f < G && (f = G, u = o - e - G);
1381
1160
  let t = s - p - d;
1382
- d += a - r, d < 0 && (d = 0), p = s - d - t, p < W && (p = W, d = s - t - W);
1161
+ d += a - r, d < 0 && (d = 0), p = s - d - t, p < G && (p = G, d = s - t - G);
1383
1162
  } else {
1384
1163
  if (t >= 1) {
1385
1164
  let e = i - n, r = Math.round(e / t);
@@ -1388,7 +1167,7 @@ var Ve = ({ surfaceRef: e }) => {
1388
1167
  let e = a - r, n = Math.round(e * t);
1389
1168
  f -= n, p -= e, u += n, d += e;
1390
1169
  }
1391
- if (u < 0 || d < 0 || f < W || p < W) return l;
1170
+ if (u < 0 || d < 0 || f < G || p < G) return l;
1392
1171
  }
1393
1172
  return {
1394
1173
  x: u,
@@ -1396,12 +1175,12 @@ var Ve = ({ surfaceRef: e }) => {
1396
1175
  w: f,
1397
1176
  h: p
1398
1177
  };
1399
- }, Xe = (e, t, n, r, i, a, o, s, c, l) => {
1178
+ }, Le = (e, t, n, r, i, a, o, s, c, l) => {
1400
1179
  let { x: u } = c, { y: d, w: f, h: p } = c;
1401
1180
  if (e) {
1402
- f += i - n, f + u > o && (f = o - u), f < W && (f = W);
1181
+ f += i - n, f + u > o && (f = o - u), f < G && (f = G);
1403
1182
  let e = s - p - d;
1404
- d += a - r, d < 0 && (d = 0), p = s - d - e, p < W && (p = W, d = s - e - W);
1183
+ d += a - r, d < 0 && (d = 0), p = s - d - e, p < G && (p = G, d = s - e - G);
1405
1184
  } else {
1406
1185
  if (t > 1) {
1407
1186
  let e = i - n, r = Math.round(e / t);
@@ -1410,7 +1189,7 @@ var Ve = ({ surfaceRef: e }) => {
1410
1189
  let e = a - r, n = Math.round(e * t);
1411
1190
  f -= n, p -= e, d += e;
1412
1191
  }
1413
- if (f + u > o || d < 0 || f < W || p < W) return l;
1192
+ if (f + u > o || d < 0 || f < G || p < G) return l;
1414
1193
  }
1415
1194
  return {
1416
1195
  x: u,
@@ -1418,12 +1197,12 @@ var Ve = ({ surfaceRef: e }) => {
1418
1197
  w: f,
1419
1198
  h: p
1420
1199
  };
1421
- }, Ze = (e, t, n, r, i, a, o, s, c, l) => {
1200
+ }, Re = (e, t, n, r, i, a, o, s, c, l) => {
1422
1201
  let { y: u } = c, { x: d, w: f, h: p } = c;
1423
1202
  if (e) {
1424
- p += a - r, p + u > s && (p = s - u), p < W && (p = W);
1203
+ p += a - r, p + u > s && (p = s - u), p < G && (p = G);
1425
1204
  let e = o - c.w - c.x;
1426
- d += i - n, d < 0 && (d = 0), f = o - d - e, f < W && (f = W, d = o - e - W);
1205
+ d += i - n, d < 0 && (d = 0), f = o - d - e, f < G && (f = G, d = o - e - G);
1427
1206
  } else {
1428
1207
  if (t >= 1) {
1429
1208
  let e = i - n, r = Math.round(e / t);
@@ -1432,7 +1211,7 @@ var Ve = ({ surfaceRef: e }) => {
1432
1211
  let e = a - r, n = Math.round(e * t);
1433
1212
  f += n, p += e, d -= n;
1434
1213
  }
1435
- if (p + u > s || d < 0 || f < W || p < W) return l;
1214
+ if (p + u > s || d < 0 || f < G || p < G) return l;
1436
1215
  }
1437
1216
  return {
1438
1217
  x: d,
@@ -1440,9 +1219,9 @@ var Ve = ({ surfaceRef: e }) => {
1440
1219
  w: f,
1441
1220
  h: p
1442
1221
  };
1443
- }, Qe = (e, t, n, r, i, a, o, s, c, l) => {
1222
+ }, ze = (e, t, n, r, i, a, o, s, c, l) => {
1444
1223
  let { x: u, y: d } = c, { w: f, h: p } = c;
1445
- if (e) f += i - n, f + u > o && (f = o - u), f < W && (f = W), p += a - r, p + d > s && (p = s - d), p < W && (p = W);
1224
+ if (e) f += i - n, f + u > o && (f = o - u), f < G && (f = G), p += a - r, p + d > s && (p = s - d), p < G && (p = G);
1446
1225
  else {
1447
1226
  if (t >= 1) {
1448
1227
  let e = i - n, r = Math.round(e / t);
@@ -1451,7 +1230,7 @@ var Ve = ({ surfaceRef: e }) => {
1451
1230
  let e = a - r, n = Math.round(e * t);
1452
1231
  f += n, p += e;
1453
1232
  }
1454
- if (p + d > s || f + u > o || f < W || p < W) return l;
1233
+ if (p + d > s || f + u > o || f < G || p < G) return l;
1455
1234
  }
1456
1235
  return {
1457
1236
  x: u,
@@ -1459,20 +1238,20 @@ var Ve = ({ surfaceRef: e }) => {
1459
1238
  w: f,
1460
1239
  h: p
1461
1240
  };
1462
- }, $e = (e, t, n, r, i, a, o, s, c) => {
1463
- let l = e === "tl" || e === "bl", u = e === "tl" || e === "tr", d = c.x + c.w, f = c.y + c.h, p = i - n, m = a - r, h = t >= 1 ? c.w + (l ? -p : p) : (c.h + (u ? -m : m)) * t, g = l ? d : o - c.x, _ = u ? f : s - c.y, v = Math.min(g, _ * t), y = Math.max(W, W * t), b = Math.min(Math.max(h, y), v), x = b / t;
1241
+ }, Be = (e, t, n, r, i, a, o, s, c) => {
1242
+ let l = e === "tl" || e === "bl", u = e === "tl" || e === "tr", d = c.x + c.w, f = c.y + c.h, p = i - n, m = a - r, h = t >= 1 ? c.w + (l ? -p : p) : (c.h + (u ? -m : m)) * t, g = l ? d : o - c.x, _ = u ? f : s - c.y, v = Math.min(g, _ * t), y = Math.max(G, G * t), b = Math.min(Math.max(h, y), v), x = b / t;
1464
1243
  return {
1465
1244
  x: l ? d - b : c.x,
1466
1245
  y: u ? f - x : c.y,
1467
1246
  w: b,
1468
1247
  h: x
1469
1248
  };
1470
- }, et = (e, t, n, r, i, a, o, s, c, l, u) => t ? e === "tl" ? Ye(t, n, r, i, a, o, s, c, l, u) : e === "tr" ? Xe(t, n, r, i, a, o, s, c, l, u) : e === "bl" ? Ze(t, n, r, i, a, o, s, c, l, u) : e === "br" ? Qe(t, n, r, i, a, o, s, c, l, u) : {
1249
+ }, Ve = (e, t, n, r, i, a, o, s, c, l, u) => t ? e === "tl" ? Ie(t, n, r, i, a, o, s, c, l, u) : e === "tr" ? Le(t, n, r, i, a, o, s, c, l, u) : e === "bl" ? Re(t, n, r, i, a, o, s, c, l, u) : e === "br" ? ze(t, n, r, i, a, o, s, c, l, u) : {
1471
1250
  x: 0,
1472
1251
  y: 0,
1473
1252
  w: 0,
1474
1253
  h: 0
1475
- } : $e(e, n, r, i, a, o, s, c, l), G = (e, t, n) => {
1254
+ } : Be(e, n, r, i, a, o, s, c, l), K = (e, t, n) => {
1476
1255
  let r = .12, i = t / n, a = 0, o = 0;
1477
1256
  e === 1 && (a = (i > 1 ? n : t) * (1 - r * 2), o = a), e > 1 && (i > e ? (o = n * (1 - r * 2), a = o * e) : (a = t * (1 - r * 2), o = a / e)), e < 1 && (i > e ? (o = n * (1 - r * 2), a = o * e) : (a = t * (1 - r * 2), o = a / e));
1478
1257
  let s = a / t * 100, c = o / n * 100, l = (t - a) / 2 / t * 100, u = (n - o) / 2 / n * 100;
@@ -1486,7 +1265,7 @@ var Ve = ({ surfaceRef: e }) => {
1486
1265
  wP: Math.round(s / 100 * t),
1487
1266
  hP: Math.round(c / 100 * n)
1488
1267
  };
1489
- }, tt = (e, t, n, r) => {
1268
+ }, He = (e, t, n, r) => {
1490
1269
  let i = e.w / 100 * n, a = e.h / 100 * r;
1491
1270
  t >= 1 ? a = i / t : i = a * t;
1492
1271
  let o = i / n * 100, s = a / r * 100, c = Math.max(o / (100 - e.x), s / (100 - e.y), 1);
@@ -1495,21 +1274,21 @@ var Ve = ({ surfaceRef: e }) => {
1495
1274
  w: o,
1496
1275
  h: s
1497
1276
  };
1498
- }, K = (e) => Math.abs(Math.round(e / 90)) % 2 == 1, nt = (e, t, n, r) => K(n) === K(r) ? {
1277
+ }, Ue = (e) => Math.abs(Math.round(e / 90)) % 2 == 1, We = (e, t, n, r) => Ue(n) === Ue(r) ? {
1499
1278
  width: e,
1500
1279
  height: t
1501
1280
  } : {
1502
1281
  width: t,
1503
1282
  height: e
1504
- }, rt = async (e) => {
1505
- let { width: t, height: n } = e, r = Math.min(1, We / Math.max(t, n)), i = Math.round(t * r), a = Math.round(n * r), o = new OffscreenCanvas(i, a), s = o.getContext("2d");
1283
+ }, Ge = async (e) => {
1284
+ let { width: t, height: n } = e, r = Math.min(1, m / Math.max(t, n)), i = Math.round(t * r), a = Math.round(n * r), o = new OffscreenCanvas(i, a), s = o.getContext("2d");
1506
1285
  if (!s) throw Error("Failed to get 2D context for preview canvas");
1507
1286
  return s.drawImage(e, 0, 0, i, a), o.convertToBlob({
1508
1287
  type: "image/webp",
1509
- quality: Ge
1288
+ quality: h
1510
1289
  });
1511
1290
  };
1512
- function it(e) {
1291
+ function Ke(e) {
1513
1292
  let t = new OffscreenCanvas(e.width, e.height), n = t.getContext("2d");
1514
1293
  if (!n) throw Error("Failed to create 2D context for canvas.");
1515
1294
  n.drawImage(e, 0, 0);
@@ -1523,14 +1302,14 @@ function it(e) {
1523
1302
  }
1524
1303
  //#endregion
1525
1304
  //#region src/shared/components/Pixedi/utils/imageProcessor.ts
1526
- var at = (e) => new Promise((t, n) => {
1305
+ var qe = (e) => new Promise((t, n) => {
1527
1306
  let r = new FileReader();
1528
1307
  r.onloadend = () => {
1529
1308
  let e = r.result;
1530
1309
  typeof e == "string" ? t(e) : n(/* @__PURE__ */ Error("Failed to read blob as base64"));
1531
1310
  }, r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("FileReader error")), r.readAsDataURL(e);
1532
1311
  });
1533
- async function ot(e) {
1312
+ async function Je(e) {
1534
1313
  let t = await createImageBitmap(e), n = e.type || "image/png", r = n === "image/gif" ? "image/png" : n, i = document.createElement("canvas"), a = i.getContext("2d", { alpha: !0 });
1535
1314
  i.width = t.width, i.height = t.height, a?.drawImage(t, 0, 0), t.close();
1536
1315
  let o = () => {
@@ -1570,7 +1349,7 @@ async function ot(e) {
1570
1349
  }, a, t) : i.toBlob((t) => {
1571
1350
  t ? e(t) : o(/* @__PURE__ */ Error("Failed to encode image as image/png"));
1572
1351
  }, "image/png");
1573
- }), s = await createImageBitmap(o), c = await rt(s), { width: l, height: u } = s, d = it(s);
1352
+ }), s = await createImageBitmap(o), c = await Ge(s), { width: l, height: u } = s, d = Ke(s);
1574
1353
  return s.close(), {
1575
1354
  newBlob: o,
1576
1355
  previewBlob: c,
@@ -1584,17 +1363,17 @@ async function ot(e) {
1584
1363
  }
1585
1364
  //#endregion
1586
1365
  //#region src/shared/components/Pixedi/utils/preview.ts
1587
- var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0][0] + e[0][1] * t[1][0], e[0][0] * t[0][1] + e[0][1] * t[1][1]], [e[1][0] * t[0][0] + e[1][1] * t[1][0], e[1][0] * t[0][1] + e[1][1] * t[1][1]]], ct = (e) => (Math.round(e / 90) % 4 + 4) % 4 * 90, lt = (e) => {
1588
- switch (ct(e)) {
1366
+ var Ye = (e, t, n) => Math.max(t, Math.min(n, e)), Xe = (e, t) => [[e[0][0] * t[0][0] + e[0][1] * t[1][0], e[0][0] * t[0][1] + e[0][1] * t[1][1]], [e[1][0] * t[0][0] + e[1][1] * t[1][0], e[1][0] * t[0][1] + e[1][1] * t[1][1]]], Ze = (e) => (Math.round(e / 90) % 4 + 4) % 4 * 90, Qe = (e) => {
1367
+ switch (Ze(e)) {
1589
1368
  case 90: return [[0, -1], [1, 0]];
1590
1369
  case 180: return [[-1, 0], [0, -1]];
1591
1370
  case 270: return [[0, 1], [-1, 0]];
1592
1371
  default: return [[1, 0], [0, 1]];
1593
1372
  }
1594
- }, ut = (e, t) => [[e ? -1 : 1, 0], [0, t ? -1 : 1]], dt = (e, t, n) => st(ut(t, n), lt(-e)), ft = (e) => [+(e[0][0] < 0 || e[0][1] < 0), +(e[1][0] < 0 || e[1][1] < 0)], pt = (e, t, n) => {
1595
- let r = ft(e);
1373
+ }, $e = (e, t) => [[e ? -1 : 1, 0], [0, t ? -1 : 1]], et = (e, t, n) => Xe($e(t, n), Qe(-e)), tt = (e) => [+(e[0][0] < 0 || e[0][1] < 0), +(e[1][0] < 0 || e[1][1] < 0)], nt = (e, t, n) => {
1374
+ let r = tt(e);
1596
1375
  return [e[0][0] * t + e[0][1] * n + r[0], e[1][0] * t + e[1][1] * n + r[1]];
1597
- }, mt = (e) => {
1376
+ }, rt = (e) => {
1598
1377
  let t = 1, n = 1, r = {
1599
1378
  x: 0,
1600
1379
  y: 0,
@@ -1603,18 +1382,18 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
1603
1382
  }, i = 0, a = !1, o = !1;
1604
1383
  for (let s = 0; s < e.length; s++) {
1605
1384
  let c = e[s];
1606
- if (c.action.name === h.INITIAL) t = c.width, n = c.height, r = {
1385
+ if (c.action.name === U.INITIAL) t = c.width, n = c.height, r = {
1607
1386
  x: 0,
1608
1387
  y: 0,
1609
1388
  w: 1,
1610
1389
  h: 1
1611
1390
  }, i = 0, a = !1, o = !1;
1612
- else if (c.action.name === h.CROP) {
1613
- let e = (c.action.args.x ?? 0) / 100, t = (c.action.args.y ?? 0) / 100, n = (c.action.args.w ?? 100) / 100, s = (c.action.args.h ?? 100) / 100, l = dt(i, a, o), u = [
1614
- pt(l, e, t),
1615
- pt(l, e + n, t),
1616
- pt(l, e, t + s),
1617
- pt(l, e + n, t + s)
1391
+ else if (c.action.name === U.CROP) {
1392
+ let e = (c.action.args.x ?? 0) / 100, t = (c.action.args.y ?? 0) / 100, n = (c.action.args.w ?? 100) / 100, s = (c.action.args.h ?? 100) / 100, l = et(i, a, o), u = [
1393
+ nt(l, e, t),
1394
+ nt(l, e + n, t),
1395
+ nt(l, e, t + s),
1396
+ nt(l, e + n, t + s)
1618
1397
  ], d = Math.min(...u.map((e) => e[0])), f = Math.max(...u.map((e) => e[0])), p = Math.min(...u.map((e) => e[1])), m = Math.max(...u.map((e) => e[1]));
1619
1398
  r = {
1620
1399
  x: r.x + d * r.w,
@@ -1622,12 +1401,12 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
1622
1401
  w: r.w * (f - d),
1623
1402
  h: r.h * (m - p)
1624
1403
  };
1625
- } else if (c.action.name === h.FLIP) {
1626
- let e = K(i), t = e ? c.action.args.vertical : c.action.args.horizontal, n = e ? c.action.args.horizontal : c.action.args.vertical;
1404
+ } else if (c.action.name === U.FLIP) {
1405
+ let e = Ue(i), t = e ? c.action.args.vertical : c.action.args.horizontal, n = e ? c.action.args.horizontal : c.action.args.vertical;
1627
1406
  t && (a = !a), n && (o = !o);
1628
- } else c.action.name === h.ROTATE && (i = c.action.args.degrees);
1407
+ } else c.action.name === U.ROTATE && (i = c.action.args.degrees);
1629
1408
  }
1630
- let s = r.w * t, c = r.h * n, l = K(i), u = l ? c : s, d = l ? s : c, f = e.at(-1)?.width || 0, p = e.at(-1)?.height || 0, m = e.filter((e) => e.action.name === h.FILTERS).at(-1), g = Object.entries(m?.action.args || {}).map(([e, t]) => e === "url" ? `url(#${t})` : e === "hueRotate" ? `hue-rotate(${t}deg)` : `${e}(${t}%)`);
1409
+ let s = r.w * t, c = r.h * n, l = Ue(i), u = l ? c : s, d = l ? s : c, f = e.at(-1)?.width || 0, p = e.at(-1)?.height || 0, m = e.filter((e) => e.action.name === U.FILTERS).at(-1), h = Object.entries(m?.action.args || {}).map(([e, t]) => e === "url" ? `url(#${t})` : e === "hueRotate" ? `hue-rotate(${t}deg)` : `${e}(${t}%)`);
1631
1410
  return {
1632
1411
  box: r,
1633
1412
  boxWidth: s,
@@ -1641,15 +1420,15 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
1641
1420
  rotation: i,
1642
1421
  flipH: a,
1643
1422
  flipV: o,
1644
- filters: g
1423
+ filters: h
1645
1424
  };
1646
- }, ht = (e) => {
1647
- let { box: t, flipH: n, flipV: r, rotation: i, newWidth: a, newHeight: o, initWidth: s, initHeight: c, viewWidth: l, viewHeight: u } = mt(e), d = e.filter((e) => e.action.name === h.FILTERS).at(-1)?.action.args, f = q(t.x, 0, 1), p = q(t.y, 0, 1), m = {
1425
+ }, it = (e) => {
1426
+ let { box: t, flipH: n, flipV: r, rotation: i, newWidth: a, newHeight: o, initWidth: s, initHeight: c, viewWidth: l, viewHeight: u } = rt(e), d = e.filter((e) => e.action.name === U.FILTERS).at(-1)?.action.args, f = Ye(t.x, 0, 1), p = Ye(t.y, 0, 1), m = {
1648
1427
  x: f,
1649
1428
  y: p,
1650
- w: q(t.w, 0, 1 - f),
1651
- h: q(t.h, 0, 1 - p)
1652
- }, g = ct(i);
1429
+ w: Ye(t.w, 0, 1 - f),
1430
+ h: Ye(t.h, 0, 1 - p)
1431
+ }, h = Ze(i);
1653
1432
  return {
1654
1433
  ...m.x === 0 && m.y === 0 && m.w === 1 && m.h === 1 ? {} : { crop: {
1655
1434
  x: Math.round(s * t.x),
@@ -1657,7 +1436,7 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
1657
1436
  w: Math.round(s * t.w),
1658
1437
  h: Math.round(c * t.h)
1659
1438
  } },
1660
- ...g === 0 ? {} : { rotate: { degrees: g } },
1439
+ ...h === 0 ? {} : { rotate: { degrees: h } },
1661
1440
  ...n || r ? { flip: {
1662
1441
  horizontal: n,
1663
1442
  vertical: r
@@ -1668,21 +1447,21 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
1668
1447
  } } : {},
1669
1448
  ...d ? { filters: d } : {}
1670
1449
  };
1671
- }, gt = (e) => {
1672
- let [t, n] = d(!1), { setImage: r, settings: i, history: a, originalBlob: o, setCurrentAction: s, resetHistory: c } = N();
1450
+ }, at = () => {
1451
+ let [e, t] = d(!1), { setImage: n, settings: r, history: i, originalBlob: a, setCurrentAction: o, resetHistory: s, onSave: c } = W();
1673
1452
  return {
1674
- save: async () => {
1675
- if (!o) return;
1676
- n(!0);
1677
- let t = ht(a.items.slice(0, a.pointer + 1));
1453
+ save: async (o) => {
1454
+ if (!a || e) return;
1455
+ t(!0);
1456
+ let s = it([...i.items.slice(0, i.pointer + 1), ...o ? [o] : []]);
1678
1457
  try {
1679
- let n = await ot(o);
1680
- t.crop && n.crop(t.crop.x, t.crop.y, t.crop.w, t.crop.h), t.flip && n.flip(t.flip.horizontal, t.flip.vertical), t.rotate && n.rotate(t.rotate.degrees), t.resize && n.resize(t.resize.width, t.resize.height), t.filters && n.filters(t.filters);
1681
- let { newBlob: a, previewBlob: s, mimeType: c, width: l, height: u, isAlpha: d } = await n.get(i), f = "";
1682
- i.exportAs === "base64" && (f = await at(a)), await e(f || a), r({
1683
- newBlob: a,
1684
- previewBlob: s,
1685
- mimeType: c,
1458
+ let e = await Je(a);
1459
+ s.crop && e.crop(s.crop.x, s.crop.y, s.crop.w, s.crop.h), s.flip && e.flip(s.flip.horizontal, s.flip.vertical), s.rotate && e.rotate(s.rotate.degrees), s.resize && e.resize(s.resize.width, s.resize.height), s.filters && e.filters(s.filters);
1460
+ let { newBlob: t, previewBlob: i, mimeType: o, width: l, height: u, isAlpha: d } = await e.get(r), f = "";
1461
+ r.exportAs === "base64" && (f = await qe(t)), await c(f || t), n({
1462
+ newBlob: t,
1463
+ previewBlob: i,
1464
+ mimeType: o,
1686
1465
  width: l,
1687
1466
  height: u,
1688
1467
  isAlpha: d
@@ -1690,119 +1469,163 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
1690
1469
  } catch (e) {
1691
1470
  throw Error(`Error saving image: ${e}`, { cause: e });
1692
1471
  } finally {
1693
- n(!1);
1472
+ t(!1);
1694
1473
  }
1695
1474
  },
1696
1475
  reset: () => {
1697
- s(null), c();
1476
+ o(null), s();
1698
1477
  },
1699
- isSaving: t
1478
+ isSaving: e
1700
1479
  };
1701
- }, J = {
1702
- header: "_header_m05h6_1",
1703
- left: "_left_m05h6_12",
1704
- sidebarToggle: "_sidebarToggle_m05h6_17",
1705
- mobile: "_mobile_m05h6_30",
1706
- sidebarIcon: "_sidebarIcon_m05h6_34",
1707
- tools: "_tools_m05h6_39",
1708
- history: "_history_m05h6_43",
1709
- historyText: "_historyText_m05h6_48"
1710
- }, _t = ({ onBack: e, onSave: t, isMobile: n }) => {
1711
- let { save: r, reset: i, isSaving: a } = gt(t), { sidebar: o, history: s, undo: c, redo: l, setSidebar: u, setCurrentAction: d } = N(), f = s.items.length > 1 && !a, p = s.pointer === 0, m = s.pointer === s.items.length - 1, h = s.items.length < 2 || a, g = h || s.pointer === 0;
1480
+ }, q = () => {
1481
+ let { singleToolUI: e, addToHistory: t, setCurrentAction: n, setSidebar: r, onBack: i } = W(), { save: a, isSaving: o } = at();
1482
+ return {
1483
+ commit: (n) => {
1484
+ if (e) return a(n);
1485
+ t(n), r(!0);
1486
+ },
1487
+ close: () => {
1488
+ if (e) {
1489
+ i();
1490
+ return;
1491
+ }
1492
+ n(null), r(!0);
1493
+ },
1494
+ isSaving: o,
1495
+ singleToolUI: e
1496
+ };
1497
+ }, ot = t(void 0), st = () => {
1498
+ let e = a(ot), t = u({
1499
+ dx: 0,
1500
+ dy: 0
1501
+ });
1502
+ return e ?? t;
1503
+ };
1504
+ //#endregion
1505
+ //#region src/shared/components/Pixedi/ui/surface-tool/useSurfaceTool.tsx
1506
+ function ct(e, t, n) {
1507
+ return Math.min(Math.max(e, t), n);
1508
+ }
1509
+ function lt(e, { dx: t, dy: n }) {
1510
+ e.style.transform = `translate(calc(-50% + ${t}px), ${n}px)`;
1511
+ }
1512
+ function ut(e, t) {
1513
+ let n = e.parentElement;
1514
+ if (!n) return null;
1515
+ let r = e.getBoundingClientRect(), i = n.getBoundingClientRect(), a = r.left - i.left - t.dx, o = r.top - i.top - t.dy;
1516
+ return {
1517
+ minDx: -a,
1518
+ maxDx: Math.max(-a, i.width - r.width - a),
1519
+ minDy: -o,
1520
+ maxDy: Math.max(-o, i.height - r.height - o)
1521
+ };
1522
+ }
1523
+ var dt = ({ surfaceRef: e }) => {
1524
+ let t = H(), n = st(), r = u(null), i = u({
1525
+ dx: 0,
1526
+ dy: 0
1527
+ }), a = u(null);
1528
+ return o(() => {
1529
+ let o = e.current;
1530
+ if (!o) return;
1531
+ let s = (e) => {
1532
+ n.current = e, lt(o, e);
1533
+ }, c = () => {
1534
+ let e = ut(o, n.current);
1535
+ if (!e) return;
1536
+ let { dx: t, dy: r } = n.current;
1537
+ s({
1538
+ dx: ct(t, e.minDx, e.maxDx),
1539
+ dy: ct(r, e.minDy, e.maxDy)
1540
+ });
1541
+ }, l = (e) => {
1542
+ let t = r.current, n = a.current;
1543
+ if (!t || !n) return;
1544
+ e.preventDefault();
1545
+ let o = "clientX" in e ? e.clientX : e.touches[0].clientX, c = "clientY" in e ? e.clientY : e.touches[0].clientY;
1546
+ s({
1547
+ dx: ct(i.current.dx + (o - t.x), n.minDx, n.maxDx),
1548
+ dy: ct(i.current.dy + (c - t.y), n.minDy, n.maxDy)
1549
+ });
1550
+ }, u = () => {
1551
+ r.current && (r.current = null, a.current = null, t || (document.body.style.cursor = ""));
1552
+ };
1553
+ c();
1554
+ let d = new AbortController(), { signal: f } = d;
1555
+ if (document.addEventListener("mousemove", l, { signal: f }), document.addEventListener("touchmove", l, {
1556
+ signal: f,
1557
+ passive: !1
1558
+ }), document.addEventListener("mouseup", u, { signal: f }), document.addEventListener("touchend", u, { signal: f }), typeof ResizeObserver < "u" && o.parentElement) {
1559
+ let e = new ResizeObserver(c);
1560
+ e.observe(o.parentElement), f.addEventListener("abort", () => e.disconnect());
1561
+ }
1562
+ return () => d.abort();
1563
+ }, [
1564
+ e,
1565
+ n,
1566
+ t
1567
+ ]), { handleDragStart: (o) => {
1568
+ let s = e.current;
1569
+ if (!s) return;
1570
+ o.stopPropagation();
1571
+ let c = ut(s, n.current);
1572
+ if (!c) return;
1573
+ let l = "clientX" in o ? o.clientX : o.touches[0].clientX, u = "clientY" in o ? o.clientY : o.touches[0].clientY;
1574
+ r.current = {
1575
+ x: l,
1576
+ y: u
1577
+ }, i.current = { ...n.current }, a.current = c, t || (document.body.style.cursor = "move");
1578
+ } };
1579
+ }, ft = {
1580
+ surfaceTool: "_surfaceTool_1skmt_1",
1581
+ content: "_content_1skmt_18",
1582
+ drag: "_drag_1skmt_22"
1583
+ }, J = ({ children: e, className: t = "", ref: n }) => {
1584
+ let r = u(null), { handleDragStart: i } = dt({ surfaceRef: r });
1712
1585
  return /* @__PURE__ */ (0, x.jsxs)("div", {
1713
- className: J.header,
1714
- children: [/* @__PURE__ */ (0, x.jsxs)("div", {
1715
- className: J.left,
1716
- children: [/* @__PURE__ */ (0, x.jsx)("div", {
1717
- className: `${J.sidebarToggle} ${n ? J.mobile : ""}`,
1718
- onClick: () => {
1719
- u(!o);
1720
- },
1721
- children: o ? /* @__PURE__ */ (0, x.jsx)(ve, { className: J.sidebarIcon }) : /* @__PURE__ */ (0, x.jsx)(_e, { className: J.sidebarIcon })
1722
- }), /* @__PURE__ */ (0, x.jsx)(F, {
1723
- variant: "ghost",
1724
- className: P.rect,
1725
- onClick: e,
1726
- children: /* @__PURE__ */ (0, x.jsx)(te, {})
1727
- })]
1728
- }), /* @__PURE__ */ (0, x.jsxs)("div", {
1729
- className: J.tools,
1730
- children: [
1731
- f && /* @__PURE__ */ (0, x.jsxs)("div", {
1732
- className: J.history,
1733
- children: [
1734
- /* @__PURE__ */ (0, x.jsx)(F, {
1735
- variant: "outline",
1736
- disabled: p,
1737
- className: P.rect,
1738
- onClick: () => {
1739
- c(), d(null);
1740
- },
1741
- children: /* @__PURE__ */ (0, x.jsx)(re, {})
1742
- }),
1743
- /* @__PURE__ */ (0, x.jsxs)("div", {
1744
- className: J.historyText,
1745
- children: [
1746
- s.pointer + 1,
1747
- "/",
1748
- s.items.length
1749
- ]
1750
- }),
1751
- /* @__PURE__ */ (0, x.jsx)(F, {
1752
- variant: "outline",
1753
- disabled: m,
1754
- className: P.rect,
1755
- onClick: () => {
1756
- l(), d(null);
1757
- },
1758
- children: /* @__PURE__ */ (0, x.jsx)(ie, {})
1759
- })
1760
- ]
1761
- }),
1762
- /* @__PURE__ */ (0, x.jsx)(F, {
1763
- variant: "outline",
1764
- disabled: h,
1765
- onClick: i,
1766
- children: "Reset"
1767
- }),
1768
- /* @__PURE__ */ (0, x.jsxs)(F, {
1769
- disabled: g,
1770
- onClick: r,
1771
- children: [a ? /* @__PURE__ */ (0, x.jsx)(Se, {}) : /* @__PURE__ */ (0, x.jsx)(j, {}), "Save"]
1772
- })
1773
- ]
1586
+ ref: (e) => {
1587
+ r.current = e, n && (n.current = e);
1588
+ },
1589
+ className: ft.surfaceTool,
1590
+ children: [/* @__PURE__ */ (0, x.jsx)(fe, {
1591
+ className: ft.drag,
1592
+ onMouseDown: i,
1593
+ onTouchStart: i
1594
+ }), /* @__PURE__ */ (0, x.jsx)("div", {
1595
+ className: `${ft.content} ${t}`,
1596
+ children: e
1774
1597
  })]
1775
1598
  });
1776
- }, vt = (e, t) => {
1599
+ }, pt = (e, t) => {
1777
1600
  let n = new CustomEvent("crop-update", { detail: t });
1778
1601
  e.dispatchEvent(n);
1779
- }, yt = (e, t) => {
1602
+ }, mt = (e, t) => {
1780
1603
  let n = new CustomEvent("clip-path-update", { detail: t });
1781
1604
  e.dispatchEvent(n);
1782
- }, bt = (e, t) => {
1605
+ }, ht = (e, t) => {
1783
1606
  let n = new CustomEvent("resize-update", { detail: t });
1784
1607
  e.dispatchEvent(n);
1785
- }, xt = (e, t) => {
1608
+ }, gt = (e, t) => {
1786
1609
  let n = new CustomEvent("filter-update", { detail: t });
1787
1610
  e.dispatchEvent(n);
1788
- }, St = (e, t) => {
1611
+ }, _t = (e, t) => {
1789
1612
  let n = new CustomEvent("compare-update", { detail: t });
1790
1613
  e.dispatchEvent(n);
1791
- }, Ct = () => {
1792
- let { showCompare: e, previewUrl: t, getLastFilter: n, getLastHistoryItem: r, setCurrentAction: i, setSidebar: a, toggleCompare: s, addToHistory: c, eventBus: u } = N(), { width: f, height: p } = r(), { action: m } = n() || {}, g = m?.args || {}, _ = g?.url, v = qe.map((e) => ({
1614
+ }, vt = () => {
1615
+ let { showCompare: e, previewUrl: t, getLastFilter: n, getLastHistoryItem: r, toggleCompare: i, eventBus: a } = W(), { commit: s, close: c, isSaving: u } = q(), { width: f, height: p } = r(), { action: m } = n() || {}, h = m?.args || {}, g = h?.url, v = _.map((e) => ({
1793
1616
  ...e,
1794
- sliderValue: g[e.value] ?? e.sliderValue,
1795
- rightLabel: `${g[e.value] ?? e.sliderValue}${e.unit}`
1796
- })), y = v.find((e) => e.value === "saturate")?.sliderValue, [b, x] = d("saturate"), [S, C] = d(_ ?? "vintage"), [w, T] = d(v), [E, D] = d(y ?? 0), [O, k] = d(!!_), A = l(() => Object.fromEntries(w.map((e) => [e.value, e.sliderValue])), [w]), j = () => {
1797
- s(), St(u, 50);
1798
- }, ee = (e) => {
1799
- xt(u, {
1617
+ sliderValue: h[e.value] ?? e.sliderValue,
1618
+ rightLabel: `${h[e.value] ?? e.sliderValue}${e.unit}`
1619
+ })), y = v.find((e) => e.value === "saturate")?.sliderValue, [b, x] = d("saturate"), [S, C] = d(g ?? "vintage"), [w, T] = d(v), [E, D] = d(y ?? 0), [O, k] = d(!!g), A = l(() => Object.fromEntries(w.map((e) => [e.value, e.sliderValue])), [w]), ee = () => {
1620
+ i(), _t(a, 50);
1621
+ }, te = (e) => {
1622
+ gt(a, {
1800
1623
  ...A,
1801
1624
  [b]: e
1802
1625
  });
1803
- }, M = w.find((e) => e.value === b);
1626
+ }, j = w.find((e) => e.value === b);
1804
1627
  return o(() => {
1805
- O ? xt(u, { url: S }) : xt(u, {
1628
+ O ? gt(a, { url: S }) : gt(a, {
1806
1629
  ...A,
1807
1630
  [b]: E
1808
1631
  });
@@ -1812,7 +1635,7 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
1812
1635
  E,
1813
1636
  A,
1814
1637
  b,
1815
- u
1638
+ a
1816
1639
  ]), {
1817
1640
  showCompare: e,
1818
1641
  previewUrl: t,
@@ -1820,11 +1643,11 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
1820
1643
  toggleIsUrl: () => k(!O),
1821
1644
  filters: w,
1822
1645
  selectedFilter: b,
1823
- selectedFilterItem: M,
1646
+ selectedFilterItem: j,
1824
1647
  selectedUrl: S,
1825
1648
  sliderValue: E,
1826
- handleToggleCompare: j,
1827
- handleSliderInput: ee,
1649
+ handleToggleCompare: ee,
1650
+ handleSliderInput: te,
1828
1651
  handleSliderChange: (e) => {
1829
1652
  D(e), T((t) => t.map((t) => t.value === b ? {
1830
1653
  ...t,
@@ -1836,21 +1659,22 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
1836
1659
  x(e), D(w.find((t) => t.value === e)?.sliderValue || 0);
1837
1660
  },
1838
1661
  handleChangeWhenUrl: (e) => {
1839
- C(e), xt(u, { url: e });
1662
+ C(e), gt(a, { url: e });
1840
1663
  },
1841
1664
  handleSave: () => {
1842
- c({
1665
+ e && i(), s({
1843
1666
  width: f,
1844
1667
  height: p,
1845
1668
  action: {
1846
- name: h.FILTERS,
1669
+ name: U.FILTERS,
1847
1670
  args: { ...O ? { url: S } : Object.fromEntries(w.map((e) => [e.value, e.sliderValue])) }
1848
1671
  }
1849
- }), e && s(), a(!0);
1672
+ });
1850
1673
  },
1851
1674
  handleClose: () => {
1852
- e && s(), i(null), a(!0);
1853
- }
1675
+ e && i(), c();
1676
+ },
1677
+ isSaving: u
1854
1678
  };
1855
1679
  }, Y = {
1856
1680
  tools: "_tools_4u8qe_1",
@@ -1865,9 +1689,9 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
1865
1689
  filterInteract: "_filterInteract_4u8qe_55",
1866
1690
  compare: "_compare_4u8qe_70",
1867
1691
  compareThumb: "_compareThumb_4u8qe_88"
1868
- }, wt = () => {
1869
- let { showCompare: e, previewUrl: t, isUrl: n, toggleIsUrl: r, filters: i, selectedFilter: a, selectedFilterItem: o, selectedUrl: s, sliderValue: c, handleToggleCompare: l, handleSliderInput: u, handleSliderChange: d, handleChange: f, handleChangeWhenUrl: p, handleSave: m, handleClose: h } = Ct();
1870
- return /* @__PURE__ */ (0, x.jsxs)(U, {
1692
+ }, yt = () => {
1693
+ let { showCompare: e, previewUrl: t, isUrl: n, toggleIsUrl: r, filters: i, selectedFilter: a, selectedFilterItem: o, selectedUrl: s, sliderValue: c, handleToggleCompare: l, handleSliderInput: u, handleSliderChange: d, handleChange: f, handleChangeWhenUrl: p, handleSave: m, handleClose: h, isSaving: g } = vt();
1694
+ return /* @__PURE__ */ (0, x.jsxs)(J, {
1871
1695
  className: Y.tools,
1872
1696
  children: [!n && o && /* @__PURE__ */ (0, x.jsxs)("div", {
1873
1697
  className: Y.row1,
@@ -1876,7 +1700,7 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
1876
1700
  className: Y.min,
1877
1701
  children: [o.min, o.unit]
1878
1702
  }),
1879
- /* @__PURE__ */ (0, x.jsx)(Fe, {
1703
+ /* @__PURE__ */ (0, x.jsx)(Ee, {
1880
1704
  className: Y.slider,
1881
1705
  min: o.min,
1882
1706
  max: o.max,
@@ -1903,7 +1727,7 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
1903
1727
  "data-tooltip": "Compare",
1904
1728
  onClick: l,
1905
1729
  className: e ? Y.active : "",
1906
- children: /* @__PURE__ */ (0, x.jsx)(be, {})
1730
+ children: /* @__PURE__ */ (0, x.jsx)(de, {})
1907
1731
  })
1908
1732
  }),
1909
1733
  /* @__PURE__ */ (0, x.jsx)(V, {
@@ -1913,11 +1737,11 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
1913
1737
  "aria-label": n ? "Filters" : "Predefined Filters",
1914
1738
  "data-tooltip": n ? "Filters" : "Predefined Filters",
1915
1739
  onClick: r,
1916
- children: n ? /* @__PURE__ */ (0, x.jsx)(ge, {}) : /* @__PURE__ */ (0, x.jsx)(ye, {})
1740
+ children: n ? /* @__PURE__ */ (0, x.jsx)(se, {}) : /* @__PURE__ */ (0, x.jsx)(ue, {})
1917
1741
  })
1918
1742
  }),
1919
- /* @__PURE__ */ (0, x.jsx)(De, {
1920
- items: n ? Je : i,
1743
+ /* @__PURE__ */ (0, x.jsx)(ve, {
1744
+ items: n ? v : i,
1921
1745
  value: n ? s : a,
1922
1746
  placeholder: "Select filter",
1923
1747
  className: Y.select,
@@ -1933,13 +1757,14 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
1933
1757
  }),
1934
1758
  /* @__PURE__ */ (0, x.jsx)(R, {
1935
1759
  onSave: m,
1936
- onClose: h
1760
+ onClose: h,
1761
+ saving: g
1937
1762
  })
1938
1763
  ]
1939
1764
  })]
1940
1765
  });
1941
- }, Tt = ({ isClipped: e, isFilter: t }) => {
1942
- let { history: n, previewUrl: r, currentAction: i, getLastRotation: a, eventBus: s } = N(), l = u(null), d = u(null), f = u(i?.name), p = u(r);
1766
+ }, bt = ({ isClipped: e, isFilter: t }) => {
1767
+ let { history: n, previewUrl: r, currentAction: i, getLastRotation: a, eventBus: s } = W(), l = u(null), d = u(null), f = u(i?.name), p = u(r);
1943
1768
  c(() => {
1944
1769
  let e = f.current, t = i?.name, n = p.current !== r;
1945
1770
  if (f.current = t, p.current = r, !(e && t && e !== t) && !n) return;
@@ -1962,16 +1787,16 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
1962
1787
  if (i) {
1963
1788
  let { width: e, height: t } = n.items.at(n.pointer);
1964
1789
  m.push({
1965
- ...i.name === h.ROTATE ? nt(e, t, a(), i.args.degrees) : {
1790
+ ...i.name === U.ROTATE ? We(e, t, a(), i.args.degrees) : {
1966
1791
  width: e,
1967
1792
  height: t
1968
1793
  },
1969
1794
  action: i
1970
1795
  });
1971
1796
  }
1972
- let g = mt(m);
1797
+ let h = rt(m);
1973
1798
  return o(() => {
1974
- e && l.current && (l.current.style.transition = "none"), i?.name !== h.RESIZE && l.current && (l.current.style.transform = "scale(1)");
1799
+ e && l.current && (l.current.style.transition = "none"), i?.name !== U.RESIZE && l.current && (l.current.style.transform = "scale(1)");
1975
1800
  let n = (e) => {
1976
1801
  let t = e.detail;
1977
1802
  l.current && (l.current.style.transform = `scale(${t / 100})`);
@@ -2002,7 +1827,7 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2002
1827
  previewRef: l,
2003
1828
  imageRef: d,
2004
1829
  previewUrl: r,
2005
- ...g
1830
+ ...h
2006
1831
  };
2007
1832
  }, X = {
2008
1833
  preview: "_preview_t77n1_1",
@@ -2013,8 +1838,8 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2013
1838
  label: "_label_t77n1_49",
2014
1839
  before: "_before_t77n1_67",
2015
1840
  after: "_after_t77n1_71"
2016
- }, Et = ({ isClipped: e, isFilter: t, faded: n, style: r = {} }) => {
2017
- let { showCompare: i } = N(), { previewRef: a, imageRef: o, previewUrl: s, box: c, boxWidth: l, boxHeight: u, viewWidth: d, viewHeight: f, rotation: p, flipH: m, flipV: h, filters: g } = Tt({
1841
+ }, xt = ({ isClipped: e, isFilter: t, faded: n, style: r = {} }) => {
1842
+ let { showCompare: i } = W(), { previewRef: a, imageRef: o, previewUrl: s, box: c, boxWidth: l, boxHeight: u, viewWidth: d, viewHeight: f, rotation: p, flipH: m, flipV: h, filters: g } = bt({
2018
1843
  isClipped: e,
2019
1844
  isFilter: t
2020
1845
  });
@@ -2061,10 +1886,10 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2061
1886
  })
2062
1887
  ]
2063
1888
  });
2064
- }, Dt = ({ compareRef: e }) => {
2065
- let { eventBus: t } = N(), n = O(), r = u(null), i = u(null);
1889
+ }, St = ({ compareRef: e }) => {
1890
+ let { eventBus: t } = W(), n = H(), r = u(null), i = u(null);
2066
1891
  return o(() => {
2067
- i.current = 0, St(t, 0);
1892
+ i.current = 0, _t(t, 0);
2068
1893
  }, [t]), o(() => {
2069
1894
  let n = (n) => {
2070
1895
  if (!e.current || !r.current) return;
@@ -2072,7 +1897,7 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2072
1897
  let a = e.current.parentElement;
2073
1898
  if (!a) return;
2074
1899
  let o = "clientX" in n ? n.clientX : n.touches[0].clientX, { width: s, left: c } = a.getBoundingClientRect(), l = Math.min(Math.max(o - c, 0), s) / s * 100;
2075
- i.current = l, e.current.style.left = `${l}%`, St(t, l);
1900
+ i.current = l, e.current.style.left = `${l}%`, _t(t, l);
2076
1901
  }, a = () => {
2077
1902
  e.current && (r.current = null, document.body.style.cursor = "auto");
2078
1903
  }, o = new AbortController(), { signal: s } = o;
@@ -2086,12 +1911,12 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2086
1911
  let a = "clientX" in t ? t.clientX : t.touches[0].clientX;
2087
1912
  r.current = a, n || (document.body.style.cursor = "pointer");
2088
1913
  } };
2089
- }, Ot = () => {
2090
- let { showCompare: e, getLastHistoryItem: t } = N(), { width: n, height: r } = t(), i = u(null), { handleDragStart: a } = Dt({ compareRef: i });
1914
+ }, Ct = () => {
1915
+ let { showCompare: e, getLastHistoryItem: t } = W(), { width: n, height: r } = t(), i = u(null), { handleDragStart: a } = St({ compareRef: i });
2091
1916
  return /* @__PURE__ */ (0, x.jsxs)("div", {
2092
1917
  className: Y.filterInteract,
2093
1918
  style: { aspectRatio: `${n} / ${r}` },
2094
- children: [/* @__PURE__ */ (0, x.jsx)(Et, { isFilter: !0 }), e && /* @__PURE__ */ (0, x.jsx)(x.Fragment, { children: /* @__PURE__ */ (0, x.jsx)("div", {
1919
+ children: [/* @__PURE__ */ (0, x.jsx)(xt, { isFilter: !0 }), e && /* @__PURE__ */ (0, x.jsx)(x.Fragment, { children: /* @__PURE__ */ (0, x.jsx)("div", {
2095
1920
  ref: i,
2096
1921
  className: Y.compare,
2097
1922
  style: { left: "50%" },
@@ -2099,11 +1924,11 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2099
1924
  className: Y.compareThumb,
2100
1925
  onMouseDown: a,
2101
1926
  onTouchStart: a,
2102
- children: /* @__PURE__ */ (0, x.jsx)(be, {})
1927
+ children: /* @__PURE__ */ (0, x.jsx)(de, {})
2103
1928
  })
2104
1929
  }) })]
2105
1930
  });
2106
- }, kt = () => ({
1931
+ }, wt = () => ({
2107
1932
  saturate: 100,
2108
1933
  grayscale: 0,
2109
1934
  sepia: 0,
@@ -2111,51 +1936,290 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2111
1936
  hueRotate: 0,
2112
1937
  brightness: 100,
2113
1938
  contrast: 100
2114
- }), At = {
2115
- [h.RESIZE]: {
2116
- icon: /* @__PURE__ */ (0, x.jsx)(ue, {}),
1939
+ }), Tt = (e, t, n) => {
1940
+ if (e.length === 1) switch (e[0]) {
1941
+ case "resize": return {
1942
+ name: U.RESIZE,
1943
+ args: {
1944
+ width: t,
1945
+ height: n
1946
+ }
1947
+ };
1948
+ case "crop": return {
1949
+ name: U.CROP,
1950
+ args: {
1951
+ id: "freeform",
1952
+ ratio: t / n,
1953
+ isFree: !0
1954
+ }
1955
+ };
1956
+ case "presetCrop": return {
1957
+ name: U.PRESET_CROP,
1958
+ args: {
1959
+ id: "facebook-post",
1960
+ ratio: 1200 / 630,
1961
+ isFree: !1,
1962
+ preset: {
1963
+ width: 1200,
1964
+ height: 630
1965
+ }
1966
+ }
1967
+ };
1968
+ case "flip": return {
1969
+ name: U.FLIP,
1970
+ args: {
1971
+ horizontal: !1,
1972
+ vertical: !1
1973
+ }
1974
+ };
1975
+ case "rotate": return {
1976
+ name: U.ROTATE,
1977
+ args: { degrees: 0 }
1978
+ };
1979
+ case "filters": return {
1980
+ name: U.FILTERS,
1981
+ args: wt()
1982
+ };
1983
+ default: return null;
1984
+ }
1985
+ return null;
1986
+ }, Et = {
1987
+ tools: [
1988
+ "resize",
1989
+ "crop",
1990
+ "presetCrop",
1991
+ "flip",
1992
+ "rotate",
1993
+ "filters"
1994
+ ],
1995
+ infobar: !0,
1996
+ quality: .85,
1997
+ saveAsWEBP: !1,
1998
+ exportAs: "blob"
1999
+ }, Dt = (e, t, n, r, i, a, o) => ({
2000
+ history: {
2001
+ pointer: 0,
2002
+ items: [{
2003
+ width: t,
2004
+ height: n,
2005
+ action: {
2006
+ name: U.INITIAL,
2007
+ args: null
2008
+ }
2009
+ }]
2010
+ },
2011
+ currentAction: Tt(o?.tools || [], t, n),
2012
+ previewUrl: i,
2013
+ originalBlob: r,
2014
+ mimeType: e,
2015
+ sidebar: !1,
2016
+ settings: o,
2017
+ isAlpha: a,
2018
+ showCompare: !1,
2019
+ singleToolUI: o?.tools?.length === 1
2020
+ }), Ot = () => {}, kt = ({ children: e, mimeType: t, width: n, height: r, originalBlob: i, previewUrl: a, isAlpha: s, settings: c, onSave: f = Ot, onBack: p = Ot }) => {
2021
+ let [m, h] = d(Dt(t, n, r, i, a, s, c)), g = u(null);
2022
+ o(() => () => {
2023
+ g.current &&= (URL.revokeObjectURL(g.current), null);
2024
+ }, []);
2025
+ let _ = (e) => h((t) => ({
2026
+ ...t,
2027
+ currentAction: e
2028
+ })), v = (e) => h((t) => {
2029
+ let n = t.history.pointer + 1, r = [...t.history.items.slice(0, n), e];
2030
+ return {
2031
+ ...t,
2032
+ currentAction: null,
2033
+ history: {
2034
+ items: r,
2035
+ pointer: n
2036
+ }
2037
+ };
2038
+ }), y = () => h((e) => ({
2039
+ ...e,
2040
+ showCompare: !e.showCompare
2041
+ })), b = () => {
2042
+ let { items: e, pointer: t } = m.history;
2043
+ return e.at(t) ?? e.at(0) ?? {
2044
+ width: 0,
2045
+ height: 0,
2046
+ action: {
2047
+ name: U.INITIAL,
2048
+ args: null
2049
+ }
2050
+ };
2051
+ }, S = () => {
2052
+ let { items: e, pointer: t } = m.history;
2053
+ return e.filter((e, n) => n <= t && e.action.name === U.FILTERS).at(-1) ?? null;
2054
+ }, C = () => {
2055
+ let { items: e, pointer: t } = m.history;
2056
+ if (e.length === 0 || t < 0) return 0;
2057
+ let n = e.slice(0, t + 1).findLast((e) => e.action.name === U.ROTATE);
2058
+ return n?.action.name === U.ROTATE ? n.action.args.degrees : 0;
2059
+ }, w = () => h((e) => ({
2060
+ ...e,
2061
+ history: {
2062
+ items: [e.history.items[0]],
2063
+ pointer: 0
2064
+ }
2065
+ })), T = () => h((e) => e.history.pointer <= 0 ? e : {
2066
+ ...e,
2067
+ history: {
2068
+ ...e.history,
2069
+ pointer: e.history.pointer - 1
2070
+ }
2071
+ }), E = () => h((e) => e.history.pointer >= e.history.items.length - 1 ? e : {
2072
+ ...e,
2073
+ history: {
2074
+ ...e.history,
2075
+ pointer: e.history.pointer + 1
2076
+ }
2077
+ }), D = (e) => h((t) => ({
2078
+ ...t,
2079
+ sidebar: e
2080
+ })), O = l(() => new EventTarget(), []), k = (e) => {
2081
+ g.current && URL.revokeObjectURL(g.current), g.current = URL.createObjectURL(e.previewBlob), h(Dt(e.mimeType, e.width, e.height, e.newBlob, g.current, e.isAlpha, c));
2082
+ };
2083
+ return /* @__PURE__ */ (0, x.jsx)(Fe, {
2084
+ value: {
2085
+ ...m,
2086
+ setImage: k,
2087
+ setCurrentAction: _,
2088
+ toggleCompare: y,
2089
+ getLastHistoryItem: b,
2090
+ getLastRotation: C,
2091
+ getLastFilter: S,
2092
+ addToHistory: v,
2093
+ resetHistory: w,
2094
+ undo: T,
2095
+ redo: E,
2096
+ setSidebar: D,
2097
+ eventBus: O,
2098
+ onSave: f,
2099
+ onBack: p
2100
+ },
2101
+ children: e
2102
+ });
2103
+ }, Z = {
2104
+ header: "_header_m05h6_1",
2105
+ left: "_left_m05h6_12",
2106
+ sidebarToggle: "_sidebarToggle_m05h6_17",
2107
+ mobile: "_mobile_m05h6_30",
2108
+ sidebarIcon: "_sidebarIcon_m05h6_34",
2109
+ tools: "_tools_m05h6_39",
2110
+ history: "_history_m05h6_43",
2111
+ historyText: "_historyText_m05h6_48"
2112
+ }, At = ({ isMobile: e }) => {
2113
+ let { save: t, reset: n, isSaving: r } = at(), { sidebar: i, history: a, undo: o, redo: s, setSidebar: c, setCurrentAction: l, onBack: u } = W(), d = a.items.length > 1 && !r, f = a.pointer === 0, p = a.pointer === a.items.length - 1, m = a.items.length < 2 || r, h = m || a.pointer === 0;
2114
+ return /* @__PURE__ */ (0, x.jsxs)("div", {
2115
+ className: Z.header,
2116
+ children: [/* @__PURE__ */ (0, x.jsxs)("div", {
2117
+ className: Z.left,
2118
+ children: [/* @__PURE__ */ (0, x.jsx)("div", {
2119
+ className: `${Z.sidebarToggle} ${e ? Z.mobile : ""}`,
2120
+ onClick: () => {
2121
+ c(!i);
2122
+ },
2123
+ children: i ? /* @__PURE__ */ (0, x.jsx)(le, { className: Z.sidebarIcon }) : /* @__PURE__ */ (0, x.jsx)(ce, { className: Z.sidebarIcon })
2124
+ }), /* @__PURE__ */ (0, x.jsx)(F, {
2125
+ variant: "ghost",
2126
+ className: P.rect,
2127
+ onClick: () => u(),
2128
+ children: /* @__PURE__ */ (0, x.jsx)(E, {})
2129
+ })]
2130
+ }), /* @__PURE__ */ (0, x.jsxs)("div", {
2131
+ className: Z.tools,
2132
+ children: [
2133
+ d && /* @__PURE__ */ (0, x.jsxs)("div", {
2134
+ className: Z.history,
2135
+ children: [
2136
+ /* @__PURE__ */ (0, x.jsx)(F, {
2137
+ variant: "outline",
2138
+ disabled: f,
2139
+ className: P.rect,
2140
+ onClick: () => {
2141
+ o(), l(null);
2142
+ },
2143
+ children: /* @__PURE__ */ (0, x.jsx)(O, {})
2144
+ }),
2145
+ /* @__PURE__ */ (0, x.jsxs)("div", {
2146
+ className: Z.historyText,
2147
+ children: [
2148
+ a.pointer + 1,
2149
+ "/",
2150
+ a.items.length
2151
+ ]
2152
+ }),
2153
+ /* @__PURE__ */ (0, x.jsx)(F, {
2154
+ variant: "outline",
2155
+ disabled: p,
2156
+ className: P.rect,
2157
+ onClick: () => {
2158
+ s(), l(null);
2159
+ },
2160
+ children: /* @__PURE__ */ (0, x.jsx)(k, {})
2161
+ })
2162
+ ]
2163
+ }),
2164
+ /* @__PURE__ */ (0, x.jsx)(F, {
2165
+ variant: "outline",
2166
+ disabled: m,
2167
+ onClick: n,
2168
+ children: "Reset"
2169
+ }),
2170
+ /* @__PURE__ */ (0, x.jsxs)(F, {
2171
+ disabled: h,
2172
+ onClick: () => t(),
2173
+ children: [r ? /* @__PURE__ */ (0, x.jsx)(pe, {}) : /* @__PURE__ */ (0, x.jsx)(C, {}), "Save"]
2174
+ })
2175
+ ]
2176
+ })]
2177
+ });
2178
+ }, jt = {
2179
+ [U.RESIZE]: {
2180
+ icon: /* @__PURE__ */ (0, x.jsx)(re, {}),
2117
2181
  label: "Resize"
2118
2182
  },
2119
- [h.CROP]: {
2120
- icon: /* @__PURE__ */ (0, x.jsx)(ae, {}),
2183
+ [U.CROP]: {
2184
+ icon: /* @__PURE__ */ (0, x.jsx)(A, {}),
2121
2185
  label: "Crop"
2122
2186
  },
2123
- [h.PRESET_CROP]: {
2124
- icon: /* @__PURE__ */ (0, x.jsx)(he, {}),
2187
+ [U.PRESET_CROP]: {
2188
+ icon: /* @__PURE__ */ (0, x.jsx)(oe, {}),
2125
2189
  label: "Presets"
2126
2190
  },
2127
- [h.FLIP]: {
2128
- icon: /* @__PURE__ */ (0, x.jsx)(de, {}),
2191
+ [U.FLIP]: {
2192
+ icon: /* @__PURE__ */ (0, x.jsx)(M, {}),
2129
2193
  label: "Flip"
2130
2194
  },
2131
- [h.ROTATE]: {
2132
- icon: /* @__PURE__ */ (0, x.jsx)(pe, {}),
2195
+ [U.ROTATE]: {
2196
+ icon: /* @__PURE__ */ (0, x.jsx)(N, {}),
2133
2197
  label: "Rotate"
2134
2198
  },
2135
- [h.FILTERS]: {
2136
- icon: /* @__PURE__ */ (0, x.jsx)(ge, {}),
2199
+ [U.FILTERS]: {
2200
+ icon: /* @__PURE__ */ (0, x.jsx)(se, {}),
2137
2201
  label: "Filters"
2138
2202
  }
2139
- }, jt = (e) => At[e] ?? null, Mt = () => {
2140
- let { settings: e, currentAction: t, showCompare: n, toggleCompare: r, getLastRotation: i, getLastHistoryItem: a, setCurrentAction: o, setSidebar: s } = N(), c = e?.tools || [], l = t?.name, { width: u, height: d } = a();
2203
+ }, Mt = (e) => jt[e] ?? null, Nt = () => {
2204
+ let { settings: e, currentAction: t, showCompare: n, toggleCompare: r, getLastRotation: i, getLastHistoryItem: a, setCurrentAction: o, setSidebar: s } = W(), c = e?.tools || [], l = t?.name, { width: u, height: d } = a();
2141
2205
  return { click: (e) => {
2142
2206
  if (c.includes(e) && l === e) {
2143
2207
  o(null);
2144
2208
  return;
2145
2209
  }
2146
2210
  switch (e) {
2147
- case h.RESIZE:
2211
+ case U.RESIZE:
2148
2212
  o({
2149
- name: h.RESIZE,
2213
+ name: U.RESIZE,
2150
2214
  args: {
2151
2215
  width: u,
2152
2216
  height: d
2153
2217
  }
2154
2218
  });
2155
2219
  break;
2156
- case h.CROP:
2220
+ case U.CROP:
2157
2221
  o({
2158
- name: h.CROP,
2222
+ name: U.CROP,
2159
2223
  args: {
2160
2224
  id: "freeform",
2161
2225
  ratio: u / d,
@@ -2163,9 +2227,9 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2163
2227
  }
2164
2228
  });
2165
2229
  break;
2166
- case h.PRESET_CROP:
2230
+ case U.PRESET_CROP:
2167
2231
  o({
2168
- name: h.PRESET_CROP,
2232
+ name: U.PRESET_CROP,
2169
2233
  args: {
2170
2234
  id: "facebook-post",
2171
2235
  ratio: 1200 / 630,
@@ -2177,50 +2241,50 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2177
2241
  }
2178
2242
  });
2179
2243
  break;
2180
- case h.FLIP:
2244
+ case U.FLIP:
2181
2245
  o({
2182
- name: h.FLIP,
2246
+ name: U.FLIP,
2183
2247
  args: {
2184
2248
  horizontal: !1,
2185
2249
  vertical: !1
2186
2250
  }
2187
2251
  });
2188
2252
  break;
2189
- case h.ROTATE:
2253
+ case U.ROTATE:
2190
2254
  o({
2191
- name: h.ROTATE,
2255
+ name: U.ROTATE,
2192
2256
  args: { degrees: i() }
2193
2257
  });
2194
2258
  break;
2195
- case h.FILTERS:
2259
+ case U.FILTERS:
2196
2260
  o({
2197
- name: h.FILTERS,
2198
- args: kt()
2261
+ name: U.FILTERS,
2262
+ args: wt()
2199
2263
  });
2200
2264
  break;
2201
2265
  }
2202
2266
  n && r(), s(!1);
2203
2267
  } };
2204
- }, Z = {
2268
+ }, Q = {
2205
2269
  sidebar: "_sidebar_1lx29_1",
2206
2270
  mobile: "_mobile_1lx29_10",
2207
2271
  open: "_open_1lx29_15",
2208
2272
  wrapper: "_wrapper_1lx29_20",
2209
2273
  item: "_item_1lx29_24",
2210
2274
  selected: "_selected_1lx29_43"
2211
- }, Nt = ({ isMobile: e }) => {
2212
- let { settings: t, sidebar: n, currentAction: r } = N(), i = t?.tools || [], a = r?.name, { click: o } = Mt();
2275
+ }, Pt = ({ isMobile: e }) => {
2276
+ let { settings: t, sidebar: n, currentAction: r } = W(), i = t?.tools || [], a = r?.name, { click: o } = Nt();
2213
2277
  return /* @__PURE__ */ (0, x.jsx)("nav", {
2214
- className: `${Z.sidebar} ${e ? Z.mobile : ""} ${e && n ? Z.open : ""}`,
2278
+ className: `${Q.sidebar} ${e ? Q.mobile : ""} ${e && n ? Q.open : ""}`,
2215
2279
  children: /* @__PURE__ */ (0, x.jsx)(V, {
2216
2280
  position: "right",
2217
- className: Z.tooltip,
2281
+ className: Q.tooltip,
2218
2282
  children: i.map((e) => {
2219
- let t = jt(e);
2283
+ let t = Mt(e);
2220
2284
  if (!t) return null;
2221
2285
  let { icon: n, label: r } = t;
2222
2286
  return /* @__PURE__ */ (0, x.jsx)("div", {
2223
- className: `${Z.item} ${a === e ? Z.selected : ""}`,
2287
+ className: `${Q.item} ${a === e ? Q.selected : ""}`,
2224
2288
  onClick: () => o(e),
2225
2289
  "data-tooltip": r,
2226
2290
  "aria-label": r,
@@ -2229,15 +2293,15 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2229
2293
  })
2230
2294
  })
2231
2295
  });
2232
- }, Pt = { infobar: "_infobar_895qe_1" }, Ft = (e) => e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(2)} KB` : `${(e / 1024 / 1024).toFixed(2)} MB`, It = () => {
2233
- let { originalBlob: e, getLastHistoryItem: t } = N(), { width: n, height: r } = t();
2296
+ }, Ft = { infobar: "_infobar_895qe_1" }, It = (e) => e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(2)} KB` : `${(e / 1024 / 1024).toFixed(2)} MB`, Lt = () => {
2297
+ let { originalBlob: e, getLastHistoryItem: t } = W(), { width: n, height: r } = t();
2234
2298
  return /* @__PURE__ */ (0, x.jsxs)("div", {
2235
- className: Pt.infobar,
2299
+ className: Ft.infobar,
2236
2300
  children: [/* @__PURE__ */ (0, x.jsx)("div", {
2237
- className: Pt.filesize,
2238
- children: e ? Ft(e.size) : "0 B"
2301
+ className: Ft.filesize,
2302
+ children: e ? It(e.size) : "0 B"
2239
2303
  }), /* @__PURE__ */ (0, x.jsxs)("div", {
2240
- className: Pt.sizes,
2304
+ className: Ft.sizes,
2241
2305
  children: [
2242
2306
  n,
2243
2307
  " / ",
@@ -2245,94 +2309,95 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2245
2309
  ]
2246
2310
  })]
2247
2311
  });
2248
- }, Lt = 15, Rt = 200, zt = 2, Bt = (e, t, n) => {
2249
- let r = Math.min(Rt, Math.max(Lt, e));
2312
+ }, Rt = 15, zt = 200, Bt = 2, Vt = (e, t, n) => {
2313
+ let r = Math.min(zt, Math.max(Rt, e));
2250
2314
  return {
2251
2315
  scale: r,
2252
2316
  width: Math.round(r / 100 * t),
2253
2317
  height: Math.round(r / 100 * n)
2254
2318
  };
2255
- }, Vt = () => {
2256
- let { getLastHistoryItem: e, setCurrentAction: t, addToHistory: n, setSidebar: r, eventBus: a } = N(), { width: s, height: c } = e(), [l, f] = d(s), [p, m] = d(c), [g, _] = d(100), v = u(g), y = u(0), b = u(null), x = i((e) => {
2257
- let t = Bt(e, s, c);
2258
- f(t.width), m(t.height), _(t.scale), v.current = t.scale, bt(a, t.scale);
2319
+ }, Ht = () => {
2320
+ let { getLastHistoryItem: e, eventBus: t } = W(), { commit: n, close: r, isSaving: a } = q(), { width: s, height: c } = e(), [l, f] = d(s), [p, m] = d(c), [h, g] = d(100), _ = u(h), v = u(0), y = u(null), b = i((e) => {
2321
+ let n = Vt(e, s, c);
2322
+ f(n.width), m(n.height), g(n.scale), _.current = n.scale, ht(t, n.scale);
2259
2323
  }, [
2260
2324
  c,
2261
2325
  s,
2262
- a
2263
- ]), S = (e, t) => {
2326
+ t
2327
+ ]), x = (e, t) => {
2264
2328
  let n = Number.parseInt(e, 10);
2265
2329
  if (!Number.isFinite(n)) {
2266
- x(100);
2330
+ b(100);
2267
2331
  return;
2268
2332
  }
2269
- x(n / t * 100);
2333
+ b(n / t * 100);
2270
2334
  };
2271
2335
  return o(() => {
2272
2336
  let e = (e) => {
2273
- let t = b.current?.parentElement, n = e.composedPath?.()[0] ?? e.target;
2337
+ let t = y.current?.parentElement, n = e.composedPath?.()[0] ?? e.target;
2274
2338
  return n instanceof Node && !!t?.contains(n);
2275
2339
  }, t = (t) => {
2276
- e(t) && x(v.current - Math.sign(t.deltaY) * zt);
2340
+ e(t) && b(_.current - Math.sign(t.deltaY) * Bt);
2277
2341
  }, n = (t) => {
2278
- e(t) && (y.current = t.touches[0].clientY);
2342
+ e(t) && (v.current = t.touches[0].clientY);
2279
2343
  }, r = (t) => {
2280
2344
  if (!e(t)) return;
2281
- let n = t.touches[0].clientY, r = y.current - n;
2282
- Math.abs(r) < 10 || (x(v.current + Math.sign(r) * zt), y.current = n);
2345
+ let n = t.touches[0].clientY, r = v.current - n;
2346
+ Math.abs(r) < 10 || (b(_.current + Math.sign(r) * Bt), v.current = n);
2283
2347
  }, i = new AbortController(), { signal: a } = i;
2284
2348
  return window.addEventListener("wheel", t, { signal: a }), window.addEventListener("touchstart", n, { signal: a }), window.addEventListener("touchmove", r, { signal: a }), () => i.abort();
2285
- }, [x]), {
2286
- resizeRef: b,
2349
+ }, [b]), {
2350
+ resizeRef: y,
2287
2351
  width: l,
2288
2352
  height: p,
2289
- scale: g,
2353
+ scale: h,
2290
2354
  currentWidth: s,
2291
2355
  currentHeight: c,
2292
2356
  setWidth: f,
2293
2357
  setHeight: m,
2294
2358
  handleWidthBlur: (e) => {
2295
- S(e.target.value, s);
2359
+ x(e.target.value, s);
2296
2360
  },
2297
2361
  handleHeightBlur: (e) => {
2298
- S(e.target.value, c);
2362
+ x(e.target.value, c);
2299
2363
  },
2300
2364
  save: () => {
2301
2365
  n({
2302
2366
  width: l,
2303
2367
  height: p,
2304
2368
  action: {
2305
- name: h.RESIZE,
2369
+ name: U.RESIZE,
2306
2370
  args: {
2307
2371
  width: l,
2308
2372
  height: p
2309
2373
  }
2310
2374
  }
2311
- }), bt(a, 100), r(!0);
2375
+ }), ht(t, 100);
2312
2376
  },
2313
2377
  close: () => {
2314
- bt(a, 100), t(null), r(!0);
2315
- }
2378
+ ht(t, 100), r();
2379
+ },
2380
+ isSaving: a
2316
2381
  };
2317
- }, Q = {
2382
+ }, Ut = {
2318
2383
  resize: "_resize_1sbig_1",
2319
2384
  toolsLock: "_toolsLock_1sbig_5",
2320
2385
  indicatorWrapper: "_indicatorWrapper_1sbig_10",
2321
2386
  indicator: "_indicator_1sbig_10"
2322
- }, Ht = () => {
2323
- let { resizeRef: e, width: t, height: n, scale: r, currentWidth: i, currentHeight: a, setWidth: o, setHeight: s, handleWidthBlur: c, handleHeightBlur: l, save: u, close: d } = Vt();
2324
- return /* @__PURE__ */ (0, x.jsxs)(U, {
2387
+ }, Wt = () => {
2388
+ let { resizeRef: e, width: t, height: n, scale: r, currentWidth: i, currentHeight: a, setWidth: o, setHeight: s, handleWidthBlur: c, handleHeightBlur: l, save: u, close: d, isSaving: f } = Ht();
2389
+ return /* @__PURE__ */ (0, x.jsxs)(J, {
2325
2390
  ref: e,
2326
- className: Q.resize,
2391
+ className: Ut.resize,
2327
2392
  children: [
2328
2393
  /* @__PURE__ */ (0, x.jsx)("div", {
2329
- className: Q.indicatorWrapper,
2394
+ className: Ut.indicatorWrapper,
2330
2395
  children: /* @__PURE__ */ (0, x.jsx)("div", {
2331
- className: Q.indicator,
2396
+ className: Ut.indicator,
2332
2397
  style: { width: `${r / 2}%` }
2333
2398
  })
2334
2399
  }),
2335
- /* @__PURE__ */ (0, x.jsx)(je, {
2400
+ /* @__PURE__ */ (0, x.jsx)(Se, {
2336
2401
  value: t,
2337
2402
  name: "width",
2338
2403
  label: "Width",
@@ -2340,8 +2405,8 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2340
2405
  onChange: (e) => o(Number(e.target.value)),
2341
2406
  onBlur: c
2342
2407
  }),
2343
- /* @__PURE__ */ (0, x.jsx)(M, { className: Q.toolsLock }),
2344
- /* @__PURE__ */ (0, x.jsx)(je, {
2408
+ /* @__PURE__ */ (0, x.jsx)(T, { className: Ut.toolsLock }),
2409
+ /* @__PURE__ */ (0, x.jsx)(Se, {
2345
2410
  value: n,
2346
2411
  name: "height",
2347
2412
  label: "Height",
@@ -2352,6 +2417,7 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2352
2417
  /* @__PURE__ */ (0, x.jsx)(R, {
2353
2418
  onSave: u,
2354
2419
  onClose: d,
2420
+ saving: f,
2355
2421
  disabled: t === i && n === a
2356
2422
  })
2357
2423
  ]
@@ -2380,9 +2446,9 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2380
2446
  infoH: "_infoH_1co2u_146",
2381
2447
  group: "_group_1co2u_153",
2382
2448
  active: "_active_1co2u_162"
2383
- }, Ut = () => {
2384
- let { getLastHistoryItem: e } = N(), t = O(), n = u(null), { handleCropStart: r, initialCrop: i } = tn({ boxRef: n }), { width: a, height: o } = e(), { x: s, y: c, w: l, h: d } = i;
2385
- return /* @__PURE__ */ (0, x.jsxs)(x.Fragment, { children: [/* @__PURE__ */ (0, x.jsx)(Et, {
2449
+ }, Gt = () => {
2450
+ let { getLastHistoryItem: e } = W(), t = H(), n = u(null), { handleCropStart: r, initialCrop: i } = rn({ boxRef: n }), { width: a, height: o } = e(), { x: s, y: c, w: l, h: d } = i;
2451
+ return /* @__PURE__ */ (0, x.jsxs)(x.Fragment, { children: [/* @__PURE__ */ (0, x.jsx)(xt, {
2386
2452
  isClipped: !0,
2387
2453
  style: { clipPath: `xywh(${s}% ${c}% ${l}% ${d}%)` }
2388
2454
  }), /* @__PURE__ */ (0, x.jsx)("div", {
@@ -2397,40 +2463,40 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2397
2463
  top: `${c}%`,
2398
2464
  left: `${s}%`
2399
2465
  },
2400
- children: [/* @__PURE__ */ (0, x.jsx)(Jt, {}), t ? /* @__PURE__ */ (0, x.jsx)(nn, { onMouseDown: r }) : /* @__PURE__ */ (0, x.jsxs)(x.Fragment, { children: [/* @__PURE__ */ (0, x.jsx)(Yt, { onMouseDown: r }), /* @__PURE__ */ (0, x.jsx)(rn, {})] })]
2466
+ children: [/* @__PURE__ */ (0, x.jsx)(Xt, {}), t ? /* @__PURE__ */ (0, x.jsx)(an, { onMouseDown: r }) : /* @__PURE__ */ (0, x.jsxs)(x.Fragment, { children: [/* @__PURE__ */ (0, x.jsx)(Zt, { onMouseDown: r }), /* @__PURE__ */ (0, x.jsx)(on, {})] })]
2401
2467
  })
2402
2468
  })] });
2403
- }, Wt = [
2469
+ }, Kt = [
2404
2470
  {
2405
2471
  id: "freeform",
2406
- icon: /* @__PURE__ */ (0, x.jsx)(ae, {}),
2472
+ icon: /* @__PURE__ */ (0, x.jsx)(A, {}),
2407
2473
  label: "Freeform"
2408
2474
  },
2409
2475
  {
2410
2476
  id: "origin",
2411
- icon: /* @__PURE__ */ (0, x.jsx)(oe, {}),
2477
+ icon: /* @__PURE__ */ (0, x.jsx)(ee, {}),
2412
2478
  label: "Original"
2413
2479
  },
2414
2480
  {
2415
2481
  id: "1:1",
2416
- icon: /* @__PURE__ */ (0, x.jsx)(se, {}),
2482
+ icon: /* @__PURE__ */ (0, x.jsx)(te, {}),
2417
2483
  label: "1 : 1"
2418
2484
  },
2419
2485
  {
2420
2486
  id: "4:3",
2421
- icon: /* @__PURE__ */ (0, x.jsx)(le, {}),
2487
+ icon: /* @__PURE__ */ (0, x.jsx)(ne, {}),
2422
2488
  label: "4 : 3"
2423
2489
  },
2424
2490
  {
2425
2491
  id: "16:9",
2426
- icon: /* @__PURE__ */ (0, x.jsx)(ce, {}),
2492
+ icon: /* @__PURE__ */ (0, x.jsx)(j, {}),
2427
2493
  label: "16 : 9"
2428
2494
  }
2429
- ], Gt = ({ value: e, onChange: t }) => /* @__PURE__ */ (0, x.jsx)("div", {
2495
+ ], qt = ({ value: e, onChange: t }) => /* @__PURE__ */ (0, x.jsx)("div", {
2430
2496
  className: $.group,
2431
2497
  children: /* @__PURE__ */ (0, x.jsx)(V, {
2432
2498
  position: "top",
2433
- children: Wt.map((n) => /* @__PURE__ */ (0, x.jsx)(F, {
2499
+ children: Kt.map((n) => /* @__PURE__ */ (0, x.jsx)(F, {
2434
2500
  variant: "outline",
2435
2501
  className: `${$.groupBtn} ${e === n.id ? $.active : ""}`,
2436
2502
  onClick: () => t(n.id),
@@ -2439,72 +2505,72 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2439
2505
  children: n.icon
2440
2506
  }, n.id))
2441
2507
  })
2442
- }), Kt = () => {
2443
- let { setCurrentAction: e, currentAction: t, getLastHistoryItem: n, addToHistory: r, setSidebar: i, eventBus: a } = N(), { width: s, height: c } = n(), { name: l, args: d } = t || {}, f = l === h.CROP ? d?.id : "", p = s / c, m = u({
2508
+ }), Jt = () => {
2509
+ let { setCurrentAction: e, currentAction: t, getLastHistoryItem: n, eventBus: r } = W(), { commit: i, close: a, isSaving: s } = q(), { width: c, height: l } = n(), { name: d, args: f } = t || {}, p = d === U.CROP ? f?.id : "", m = c / l, h = u({
2444
2510
  x: 0,
2445
2511
  y: 0,
2446
2512
  w: 0,
2447
2513
  h: 0
2448
2514
  });
2449
2515
  return o(() => {
2450
- if (t?.name !== h.CROP) return;
2451
- let e = G(t.args.ratio, s, c);
2452
- m.current = e;
2516
+ if (t?.name !== U.CROP) return;
2517
+ let e = K(t.args.ratio, c, l);
2518
+ h.current = e;
2453
2519
  let n = (e) => {
2454
- m.current = e.detail;
2520
+ h.current = e.detail;
2455
2521
  };
2456
- return a.addEventListener("clip-path-update", n), () => {
2457
- a.removeEventListener("clip-path-update", n);
2522
+ return r.addEventListener("clip-path-update", n), () => {
2523
+ r.removeEventListener("clip-path-update", n);
2458
2524
  };
2459
2525
  }, [
2460
2526
  t,
2461
- s,
2462
2527
  c,
2463
- a
2528
+ l,
2529
+ r
2464
2530
  ]), {
2465
- currentValue: f,
2531
+ currentValue: p,
2466
2532
  handleChange: (t) => {
2467
- t !== f && e({
2468
- name: h.CROP,
2533
+ t !== p && e({
2534
+ name: U.CROP,
2469
2535
  args: {
2470
2536
  id: t,
2471
- ratio: /^\d+:\d+$/.test(t) ? t.split(":").map(Number).reduce((e, t) => e / t) : p,
2537
+ ratio: /^\d+:\d+$/.test(t) ? t.split(":").map(Number).reduce((e, t) => e / t) : m,
2472
2538
  isFree: t === "freeform"
2473
2539
  }
2474
2540
  });
2475
2541
  },
2476
2542
  handleSave: () => {
2477
- if (!t || t.name !== h.CROP) return;
2478
- let e = t.args?.preset?.width || Math.round(s * m.current.w / 100), n = t.args?.preset?.height || Math.round(c * m.current.h / 100);
2479
- r({
2543
+ if (!t || t.name !== U.CROP) return;
2544
+ let e = t.args?.preset?.width || Math.round(c * h.current.w / 100), n = t.args?.preset?.height || Math.round(l * h.current.h / 100);
2545
+ i({
2480
2546
  width: e,
2481
2547
  height: n,
2482
2548
  action: {
2483
- name: h.CROP,
2549
+ name: U.CROP,
2484
2550
  args: {
2485
2551
  ...t.args,
2486
- ...m.current
2552
+ ...h.current
2487
2553
  }
2488
2554
  }
2489
- }), i(!0);
2555
+ });
2490
2556
  },
2491
- handleClose: () => {
2492
- e(null), i(!0);
2493
- }
2557
+ handleClose: a,
2558
+ isSaving: s
2494
2559
  };
2495
- }, qt = () => {
2496
- let { currentValue: e, handleChange: t, handleSave: n, handleClose: r } = Kt();
2497
- return /* @__PURE__ */ (0, x.jsxs)(U, { children: [/* @__PURE__ */ (0, x.jsx)(Gt, {
2560
+ }, Yt = () => {
2561
+ let { currentValue: e, handleChange: t, handleSave: n, handleClose: r, isSaving: i } = Jt();
2562
+ return /* @__PURE__ */ (0, x.jsxs)(J, { children: [/* @__PURE__ */ (0, x.jsx)(qt, {
2498
2563
  value: e,
2499
2564
  onChange: t
2500
2565
  }), /* @__PURE__ */ (0, x.jsx)(R, {
2501
2566
  onSave: n,
2502
- onClose: r
2567
+ onClose: r,
2568
+ saving: i
2503
2569
  })] });
2504
- }, Jt = () => /* @__PURE__ */ (0, x.jsxs)("div", {
2570
+ }, Xt = () => /* @__PURE__ */ (0, x.jsxs)("div", {
2505
2571
  className: $.linesBox,
2506
2572
  children: [/* @__PURE__ */ (0, x.jsx)("span", { className: `${$.line} ${$.lineV}` }), /* @__PURE__ */ (0, x.jsx)("span", { className: `${$.line} ${$.lineH}` })]
2507
- }), Yt = ({ onMouseDown: e }) => /* @__PURE__ */ (0, x.jsxs)(x.Fragment, { children: [
2573
+ }), Zt = ({ onMouseDown: e }) => /* @__PURE__ */ (0, x.jsxs)(x.Fragment, { children: [
2508
2574
  /* @__PURE__ */ (0, x.jsx)("div", {
2509
2575
  className: `${$.pointer} ${$.pointerTopLeft}`,
2510
2576
  onMouseDown: (t) => e(t, "tl", "nwse")
@@ -2524,20 +2590,20 @@ var q = (e, t, n) => Math.max(t, Math.min(n, e)), st = (e, t) => [[e[0][0] * t[0
2524
2590
  ] });
2525
2591
  //#endregion
2526
2592
  //#region src/shared/components/Pixedi/crop/useCropInteraction.ts
2527
- function Xt(e, t, n) {
2593
+ function Qt(e, t, n) {
2528
2594
  return Math.min(Math.max(e, t), n);
2529
2595
  }
2530
- function Zt(e, { x: t, y: n, w: r, h: i }) {
2596
+ function $t(e, { x: t, y: n, w: r, h: i }) {
2531
2597
  e.style.left = `${t}%`, e.style.top = `${n}%`, e.style.width = `${r}%`, e.style.height = `${i}%`;
2532
2598
  }
2533
- function Qt(e) {
2599
+ function en(e) {
2534
2600
  let { width: t, height: n } = e.getBoundingClientRect();
2535
2601
  return {
2536
2602
  frameW: t,
2537
2603
  frameH: n
2538
2604
  };
2539
2605
  }
2540
- function $t({ x: e, y: t, w: n, h: r }, i, a) {
2606
+ function tn({ x: e, y: t, w: n, h: r }, i, a) {
2541
2607
  return {
2542
2608
  x: e / 100 * i,
2543
2609
  y: t / 100 * a,
@@ -2545,7 +2611,7 @@ function $t({ x: e, y: t, w: n, h: r }, i, a) {
2545
2611
  h: r / 100 * a
2546
2612
  };
2547
2613
  }
2548
- function en({ x: e, y: t, w: n, h: r }, i, a) {
2614
+ function nn({ x: e, y: t, w: n, h: r }, i, a) {
2549
2615
  return {
2550
2616
  x: e / i * 100,
2551
2617
  y: t / a * 100,
@@ -2553,24 +2619,24 @@ function en({ x: e, y: t, w: n, h: r }, i, a) {
2553
2619
  h: r / a * 100
2554
2620
  };
2555
2621
  }
2556
- var tn = ({ boxRef: e }) => {
2557
- let { currentAction: t, getLastHistoryItem: n, eventBus: r } = N(), i = O(), { width: a, height: s } = n(), c = t?.name === h.CROP || t?.name === h.PRESET_CROP, d = c ? t.args.ratio : 1, f = !c || t.args.isFree, p = l(() => G(d, a, s), [
2622
+ var rn = ({ boxRef: e }) => {
2623
+ let { currentAction: t, getLastHistoryItem: n, eventBus: r } = W(), i = H(), { width: a, height: s } = n(), c = t?.name === U.CROP || t?.name === U.PRESET_CROP, d = c ? t.args.ratio : 1, f = !c || t.args.isFree, p = l(() => K(d, a, s), [
2558
2624
  d,
2559
2625
  a,
2560
2626
  s
2561
- ]), m = u(null), g = u(""), _ = u(p), v = u(p);
2627
+ ]), m = u(null), h = u(""), g = u(p), _ = u(p);
2562
2628
  return o(() => {
2563
- _.current = p, yt(r, p);
2629
+ g.current = p, mt(r, p);
2564
2630
  }, [p, r]), o(() => {
2565
2631
  let t = (e, t) => {
2566
- _.current = t, Zt(e, t), vt(r, {
2632
+ g.current = t, $t(e, t), pt(r, {
2567
2633
  x: Math.round(t.x / 100 * a),
2568
2634
  y: Math.round(t.y / 100 * s),
2569
2635
  w: Math.round(t.w / 100 * a),
2570
2636
  h: Math.round(t.h / 100 * s)
2571
- }), yt(r, t);
2637
+ }), mt(r, t);
2572
2638
  }, n = (e) => {
2573
- e.preventDefault(), v.current = _.current;
2639
+ e.preventDefault(), _.current = g.current;
2574
2640
  let t = "clientX" in e ? e.clientX : e.touches[0].clientX, n = "clientY" in e ? e.clientY : e.touches[0].clientY;
2575
2641
  m.current = {
2576
2642
  x: t,
@@ -2581,27 +2647,27 @@ var tn = ({ boxRef: e }) => {
2581
2647
  t.preventDefault();
2582
2648
  let n = e.current, r = n.parentElement;
2583
2649
  if (!r) return;
2584
- let { frameW: i, frameH: a } = Qt(r);
2585
- if (g.current) {
2650
+ let { frameW: i, frameH: a } = en(r);
2651
+ if (h.current) {
2586
2652
  o(t, n, i, a);
2587
2653
  return;
2588
2654
  }
2589
2655
  c(t, n, i, a);
2590
2656
  }, o = (e, n, r, i) => {
2591
2657
  if (!m.current) return;
2592
- let o = "clientX" in e ? e.clientX : e.touches[0].clientX, c = "clientY" in e ? e.clientY : e.touches[0].clientY, l = en(et(g.current, f, d, m.current.x, m.current.y, o, c, r, i, $t(v.current, r, i), $t(_.current, r, i)), r, i);
2593
- t(n, f ? l : tt(l, d, a, s));
2658
+ let o = "clientX" in e ? e.clientX : e.touches[0].clientX, c = "clientY" in e ? e.clientY : e.touches[0].clientY, l = nn(Ve(h.current, f, d, m.current.x, m.current.y, o, c, r, i, tn(_.current, r, i), tn(g.current, r, i)), r, i);
2659
+ t(n, f ? l : He(l, d, a, s));
2594
2660
  }, c = (e, n, r, i) => {
2595
2661
  if (!m.current) return;
2596
- let { x: a, y: o, w: s, h: c } = v.current, l = "clientX" in e ? e.clientX : e.touches[0].clientX, u = "clientY" in e ? e.clientY : e.touches[0].clientY, d = (l - m.current.x) / r * 100, f = (u - m.current.y) / i * 100;
2662
+ let { x: a, y: o, w: s, h: c } = _.current, l = "clientX" in e ? e.clientX : e.touches[0].clientX, u = "clientY" in e ? e.clientY : e.touches[0].clientY, d = (l - m.current.x) / r * 100, f = (u - m.current.y) / i * 100;
2597
2663
  t(n, {
2598
- x: Xt(a + d, 0, Math.max(0, 100 - s)),
2599
- y: Xt(o + f, 0, Math.max(0, 100 - c)),
2664
+ x: Qt(a + d, 0, Math.max(0, 100 - s)),
2665
+ y: Qt(o + f, 0, Math.max(0, 100 - c)),
2600
2666
  w: s,
2601
2667
  h: c
2602
2668
  });
2603
2669
  }, l = () => {
2604
- e.current && (m.current = null, g.current = "", e.current.style.cursor = "move", document.body.style.cursor = "auto");
2670
+ e.current && (m.current = null, h.current = "", e.current.style.cursor = "move", document.body.style.cursor = "auto");
2605
2671
  };
2606
2672
  if (!e.current) return;
2607
2673
  let u = new AbortController(), { signal: p } = u;
@@ -2622,26 +2688,26 @@ var tn = ({ boxRef: e }) => {
2622
2688
  ]), {
2623
2689
  handleCropStart: (t, n, r) => {
2624
2690
  if (!e.current) return;
2625
- t.stopPropagation(), t.preventDefault(), v.current = _.current;
2691
+ t.stopPropagation(), t.preventDefault(), _.current = g.current;
2626
2692
  let a = "clientX" in t ? t.clientX : t.touches[0].clientX, o = "clientY" in t ? t.clientY : t.touches[0].clientY;
2627
2693
  m.current = {
2628
2694
  x: a,
2629
2695
  y: o
2630
- }, g.current = n, i || (e.current.style.cursor = `${r}-resize`, document.body.style.cursor = `${r}-resize`);
2696
+ }, h.current = n, i || (e.current.style.cursor = `${r}-resize`, document.body.style.cursor = `${r}-resize`);
2631
2697
  },
2632
2698
  initialCrop: p
2633
2699
  };
2634
- }, nn = ({ onMouseDown: e }) => /* @__PURE__ */ (0, x.jsx)("div", {
2700
+ }, an = ({ onMouseDown: e }) => /* @__PURE__ */ (0, x.jsx)("div", {
2635
2701
  className: $.mobileBorder,
2636
2702
  children: /* @__PURE__ */ (0, x.jsx)("div", {
2637
2703
  className: $.mobilePointer,
2638
2704
  onTouchStart: (t) => e(t, "br", "nwse")
2639
2705
  })
2640
- }), rn = () => {
2641
- let e = u(null), t = u(null), n = u(null), r = u(null), { currentAction: i, getLastHistoryItem: a, eventBus: s } = N(), { width: c, height: l } = a();
2706
+ }), on = () => {
2707
+ let e = u(null), t = u(null), n = u(null), r = u(null), { currentAction: i, getLastHistoryItem: a, eventBus: s } = W(), { width: c, height: l } = a();
2642
2708
  return o(() => {
2643
- if (!(i?.name === h.CROP || i?.name === h.PRESET_CROP)) return;
2644
- let { xP: a, yP: o, wP: u, hP: d } = G(i.args.ratio, c, l);
2709
+ if (!(i?.name === U.CROP || i?.name === U.PRESET_CROP)) return;
2710
+ let { xP: a, yP: o, wP: u, hP: d } = K(i.args.ratio, c, l);
2645
2711
  e.current && (e.current.textContent = a.toString()), t.current && (t.current.textContent = o.toString()), n.current && (n.current.textContent = u.toString()), r.current && (r.current.textContent = d.toString());
2646
2712
  let f = (i) => {
2647
2713
  let { x: a, y: o, w: s, h: c } = i.detail;
@@ -2673,36 +2739,36 @@ var tn = ({ boxRef: e }) => {
2673
2739
  children: /* @__PURE__ */ (0, x.jsx)("b", { ref: r })
2674
2740
  })
2675
2741
  ] });
2676
- }, an = Ke.map((e) => e.options).flat(), on = () => an, sn = () => {
2677
- let { currentAction: e, getLastHistoryItem: t, addToHistory: n, setSidebar: r, setCurrentAction: i, eventBus: a } = N(), { width: s, height: c } = t(), l = e?.name === h.PRESET_CROP && an.some((t) => t.value === e.args.id) ? e.args.id : "", d = u({
2742
+ }, sn = g.map((e) => e.options).flat(), cn = () => sn, ln = () => {
2743
+ let { currentAction: e, getLastHistoryItem: t, setCurrentAction: n, eventBus: r } = W(), { commit: i, close: a, isSaving: s } = q(), { width: c, height: l } = t(), d = e?.name === U.PRESET_CROP && sn.some((t) => t.value === e.args.id) ? e.args.id : "", f = u({
2678
2744
  x: 0,
2679
2745
  y: 0,
2680
2746
  w: 0,
2681
2747
  h: 0
2682
2748
  });
2683
2749
  return o(() => {
2684
- if (e?.name !== h.PRESET_CROP) return;
2685
- let t = G(e.args.ratio, s, c);
2686
- d.current = t;
2750
+ if (e?.name !== U.PRESET_CROP) return;
2751
+ let t = K(e.args.ratio, c, l);
2752
+ f.current = t;
2687
2753
  let n = (e) => {
2688
- d.current = e.detail;
2754
+ f.current = e.detail;
2689
2755
  };
2690
- return a.addEventListener("clip-path-update", n), () => {
2691
- a.removeEventListener("clip-path-update", n);
2756
+ return r.addEventListener("clip-path-update", n), () => {
2757
+ r.removeEventListener("clip-path-update", n);
2692
2758
  };
2693
2759
  }, [
2694
2760
  e,
2695
- s,
2696
2761
  c,
2697
- a
2762
+ l,
2763
+ r
2698
2764
  ]), {
2699
- currentValue: l,
2700
- presetsData: Ke,
2765
+ currentValue: d,
2766
+ presetsData: g,
2701
2767
  handleChange: (e) => {
2702
2768
  if (!e) return;
2703
- let t = on().find((t) => t.value === e);
2769
+ let t = cn().find((t) => t.value === e);
2704
2770
  if (!t) return;
2705
- let n = {
2771
+ let r = {
2706
2772
  id: e,
2707
2773
  ratio: t.w / t.h,
2708
2774
  isFree: !1,
@@ -2711,44 +2777,44 @@ var tn = ({ boxRef: e }) => {
2711
2777
  height: t.h
2712
2778
  }
2713
2779
  };
2714
- i({
2715
- name: h.PRESET_CROP,
2716
- args: n
2780
+ n({
2781
+ name: U.PRESET_CROP,
2782
+ args: r
2717
2783
  });
2718
2784
  },
2719
2785
  handleSave: () => {
2720
- !e || e.name !== h.PRESET_CROP || (n({
2786
+ !e || e.name !== U.PRESET_CROP || i({
2721
2787
  width: e.args?.preset?.width || 0,
2722
2788
  height: e.args?.preset?.height || 0,
2723
2789
  action: {
2724
- name: h.CROP,
2790
+ name: U.CROP,
2725
2791
  args: {
2726
2792
  ...e.args,
2727
- ...d.current
2793
+ ...f.current
2728
2794
  }
2729
2795
  }
2730
- }), r(!0));
2796
+ });
2731
2797
  },
2732
- handleClose: () => {
2733
- i(null), r(!0);
2734
- }
2798
+ handleClose: a,
2799
+ isSaving: s
2735
2800
  };
2736
- }, cn = { select: "_select_1ieak_1" }, ln = () => {
2737
- let { currentValue: e, presetsData: t, handleChange: n, handleSave: r, handleClose: i } = sn();
2738
- return /* @__PURE__ */ (0, x.jsxs)(U, { children: [/* @__PURE__ */ (0, x.jsx)(De, {
2801
+ }, un = { select: "_select_1ieak_1" }, dn = () => {
2802
+ let { currentValue: e, presetsData: t, handleChange: n, handleSave: r, handleClose: i, isSaving: a } = ln();
2803
+ return /* @__PURE__ */ (0, x.jsxs)(J, { children: [/* @__PURE__ */ (0, x.jsx)(ve, {
2739
2804
  value: e,
2740
2805
  placeholder: "Select preset",
2741
2806
  onChange: n,
2742
2807
  items: t,
2743
- className: cn.select
2808
+ className: un.select
2744
2809
  }), /* @__PURE__ */ (0, x.jsx)(R, {
2745
2810
  onSave: r,
2746
- onClose: i
2811
+ onClose: i,
2812
+ saving: a
2747
2813
  })] });
2748
- }, un = () => {
2749
- let { getLastHistoryItem: e, setCurrentAction: t, addToHistory: n, setSidebar: r } = N(), { width: i, height: a } = e(), [o, s] = d(!1), [c, l] = d(!1), u = (e, n) => {
2814
+ }, fn = () => {
2815
+ let { getLastHistoryItem: e, setCurrentAction: t } = W(), { commit: n, close: r, isSaving: i } = q(), { width: a, height: o } = e(), [s, c] = d(!1), [l, u] = d(!1), f = (e, n) => {
2750
2816
  t({
2751
- name: h.FLIP,
2817
+ name: U.FLIP,
2752
2818
  args: {
2753
2819
  horizontal: e,
2754
2820
  vertical: n
@@ -2756,131 +2822,131 @@ var tn = ({ boxRef: e }) => {
2756
2822
  });
2757
2823
  };
2758
2824
  return {
2759
- flipHorizontal: o,
2760
- flipVertical: c,
2825
+ flipHorizontal: s,
2826
+ flipVertical: l,
2761
2827
  handleFlipHorizontal: () => {
2762
- let e = !o;
2763
- s(e), u(e, c);
2828
+ let e = !s;
2829
+ c(e), f(e, l);
2764
2830
  },
2765
2831
  handleFlipVertical: () => {
2766
- let e = !c;
2767
- l(e), u(o, e);
2832
+ let e = !l;
2833
+ u(e), f(s, e);
2768
2834
  },
2769
2835
  handleSave: () => {
2770
2836
  n({
2771
- width: i,
2772
- height: a,
2837
+ width: a,
2838
+ height: o,
2773
2839
  action: {
2774
- name: h.FLIP,
2840
+ name: U.FLIP,
2775
2841
  args: {
2776
- horizontal: o,
2777
- vertical: c
2842
+ horizontal: s,
2843
+ vertical: l
2778
2844
  }
2779
2845
  }
2780
- }), r(!0);
2846
+ });
2781
2847
  },
2782
- handleClose: () => {
2783
- t(null), r(!0);
2784
- }
2848
+ handleClose: r,
2849
+ isSaving: i
2785
2850
  };
2786
- }, dn = {
2851
+ }, pn = {
2787
2852
  btnH: "_btnH_15adi_1",
2788
2853
  btnV: "_btnV_15adi_7"
2789
- }, fn = () => {
2790
- let { flipHorizontal: e, flipVertical: t, handleFlipHorizontal: n, handleFlipVertical: r, handleSave: i, handleClose: a } = un();
2791
- return /* @__PURE__ */ (0, x.jsxs)(U, { children: [/* @__PURE__ */ (0, x.jsx)("div", {
2792
- className: dn.scGroup,
2854
+ }, mn = () => {
2855
+ let { flipHorizontal: e, flipVertical: t, handleFlipHorizontal: n, handleFlipVertical: r, handleSave: i, handleClose: a, isSaving: o } = fn();
2856
+ return /* @__PURE__ */ (0, x.jsxs)(J, { children: [/* @__PURE__ */ (0, x.jsx)("div", {
2857
+ className: pn.scGroup,
2793
2858
  children: /* @__PURE__ */ (0, x.jsxs)(V, {
2794
2859
  position: "top",
2795
2860
  children: [/* @__PURE__ */ (0, x.jsx)(F, {
2796
2861
  variant: "outline",
2797
- className: dn.btnH,
2862
+ className: pn.btnH,
2798
2863
  onClick: n,
2799
2864
  "aria-label": "Horizontal",
2800
2865
  "data-tooltip": "Horizontal",
2801
- children: /* @__PURE__ */ (0, x.jsx)(de, { style: { color: e ? "var(--accent-blue)" : "var(--foreground)" } })
2866
+ children: /* @__PURE__ */ (0, x.jsx)(M, { style: { color: e ? "var(--accent-blue)" : "var(--foreground)" } })
2802
2867
  }), /* @__PURE__ */ (0, x.jsx)(F, {
2803
2868
  variant: "outline",
2804
- className: dn.btnV,
2869
+ className: pn.btnV,
2805
2870
  onClick: r,
2806
2871
  "aria-label": "Vertical",
2807
2872
  "data-tooltip": "Vertical",
2808
- children: /* @__PURE__ */ (0, x.jsx)(fe, { style: { color: t ? "var(--accent-blue)" : "var(--foreground)" } })
2873
+ children: /* @__PURE__ */ (0, x.jsx)(ie, { style: { color: t ? "var(--accent-blue)" : "var(--foreground)" } })
2809
2874
  })]
2810
2875
  })
2811
2876
  }), /* @__PURE__ */ (0, x.jsx)(R, {
2812
2877
  disabled: !e && !t,
2878
+ saving: o,
2813
2879
  onSave: i,
2814
2880
  onClose: a
2815
2881
  })] });
2816
- }, pn = () => {
2817
- let { getLastRotation: e, getLastHistoryItem: t, addToHistory: n, setSidebar: r, setCurrentAction: i } = N(), { width: a, height: o } = t(), s = e(), c = u(s), l = u(s);
2882
+ }, hn = () => {
2883
+ let { getLastRotation: e, getLastHistoryItem: t, setCurrentAction: n } = W(), { commit: r, close: i, isSaving: a } = q(), { width: o, height: s } = t(), c = e(), l = u(c), d = u(c);
2818
2884
  return {
2819
2885
  handleRotate: (e) => {
2820
- l.current += e, i({
2821
- name: h.ROTATE,
2822
- args: { degrees: l.current }
2886
+ d.current += e, n({
2887
+ name: U.ROTATE,
2888
+ args: { degrees: d.current }
2823
2889
  });
2824
2890
  },
2825
2891
  handleSave: () => {
2826
- n({
2827
- ...nt(a, o, c.current, l.current),
2892
+ r({
2893
+ ...We(o, s, l.current, d.current),
2828
2894
  action: {
2829
- name: h.ROTATE,
2830
- args: { degrees: l.current }
2895
+ name: U.ROTATE,
2896
+ args: { degrees: d.current }
2831
2897
  }
2832
- }), r(!0);
2898
+ });
2833
2899
  },
2834
- handleClose: () => {
2835
- i(null), r(!0);
2836
- }
2900
+ handleClose: i,
2901
+ isSaving: a
2837
2902
  };
2838
- }, mn = {
2903
+ }, gn = {
2839
2904
  btnH: "_btnH_15adi_1",
2840
2905
  btnV: "_btnV_15adi_7"
2841
- }, hn = () => {
2842
- let { handleRotate: e, handleSave: t, handleClose: n } = pn();
2843
- return /* @__PURE__ */ (0, x.jsxs)(U, { children: [/* @__PURE__ */ (0, x.jsx)("div", {
2844
- className: mn.scGroup,
2906
+ }, _n = () => {
2907
+ let { handleRotate: e, handleSave: t, handleClose: n, isSaving: r } = hn();
2908
+ return /* @__PURE__ */ (0, x.jsxs)(J, { children: [/* @__PURE__ */ (0, x.jsx)("div", {
2909
+ className: gn.scGroup,
2845
2910
  children: /* @__PURE__ */ (0, x.jsxs)(V, {
2846
2911
  position: "top",
2847
2912
  children: [/* @__PURE__ */ (0, x.jsx)(F, {
2848
2913
  variant: "outline",
2849
- className: mn.btnH,
2914
+ className: gn.btnH,
2850
2915
  onClick: () => e(90),
2851
2916
  "aria-label": "+90°",
2852
2917
  "data-tooltip": "+90°",
2853
- children: /* @__PURE__ */ (0, x.jsx)(pe, {})
2918
+ children: /* @__PURE__ */ (0, x.jsx)(N, {})
2854
2919
  }), /* @__PURE__ */ (0, x.jsx)(F, {
2855
2920
  variant: "outline",
2856
- className: mn.btnV,
2921
+ className: gn.btnV,
2857
2922
  onClick: () => e(-90),
2858
2923
  "aria-label": "-90°",
2859
2924
  "data-tooltip": "-90°",
2860
- children: /* @__PURE__ */ (0, x.jsx)(me, {})
2925
+ children: /* @__PURE__ */ (0, x.jsx)(ae, {})
2861
2926
  })]
2862
2927
  })
2863
2928
  }), /* @__PURE__ */ (0, x.jsx)(R, {
2864
2929
  onSave: t,
2865
- onClose: n
2930
+ onClose: n,
2931
+ saving: r
2866
2932
  })] });
2867
- }, gn = { frame: "_frame_1p6kh_1" }, _n = () => {
2868
- let { currentAction: e } = N(), t = e?.name === h.RESIZE, n = e?.name === h.CROP, r = e?.name === h.PRESET_CROP, i = e?.name === h.FLIP, a = e?.name === h.ROTATE, o = e?.name === h.FILTERS, s = n || r;
2869
- return /* @__PURE__ */ (0, x.jsx)("div", {
2870
- className: `${gn.frame} ${s ? L.mask : ""}`,
2871
- children: /* @__PURE__ */ (0, x.jsxs)(Ue, { children: [
2872
- /* @__PURE__ */ (0, x.jsx)(Et, { faded: s }),
2873
- t && /* @__PURE__ */ (0, x.jsx)(Ht, {}),
2874
- n && /* @__PURE__ */ (0, x.jsx)(qt, {}),
2875
- r && /* @__PURE__ */ (0, x.jsx)(ln, {}),
2876
- i && /* @__PURE__ */ (0, x.jsx)(fn, {}),
2877
- a && /* @__PURE__ */ (0, x.jsx)(hn, {}),
2878
- o && /* @__PURE__ */ (0, x.jsx)(wt, {}),
2879
- (n || r) && /* @__PURE__ */ (0, x.jsx)(Ut, {}, e?.args?.id),
2880
- o && /* @__PURE__ */ (0, x.jsx)(Ot, {})
2881
- ] })
2933
+ }, vn = { frame: "_frame_1p6kh_1" }, yn = () => {
2934
+ let { currentAction: e } = W(), t = e?.name === U.RESIZE, n = e?.name === U.CROP, r = e?.name === U.PRESET_CROP, i = e?.name === U.FLIP, a = e?.name === U.ROTATE, o = e?.name === U.FILTERS, s = n || r;
2935
+ return /* @__PURE__ */ (0, x.jsxs)("div", {
2936
+ className: `${vn.frame} ${s ? L.mask : ""}`,
2937
+ children: [
2938
+ /* @__PURE__ */ (0, x.jsx)(xt, { faded: s }),
2939
+ t && /* @__PURE__ */ (0, x.jsx)(Wt, {}),
2940
+ n && /* @__PURE__ */ (0, x.jsx)(Yt, {}),
2941
+ r && /* @__PURE__ */ (0, x.jsx)(dn, {}),
2942
+ i && /* @__PURE__ */ (0, x.jsx)(mn, {}),
2943
+ a && /* @__PURE__ */ (0, x.jsx)(_n, {}),
2944
+ o && /* @__PURE__ */ (0, x.jsx)(yt, {}),
2945
+ (n || r) && /* @__PURE__ */ (0, x.jsx)(Gt, {}, e?.args?.id),
2946
+ o && /* @__PURE__ */ (0, x.jsx)(Ct, {})
2947
+ ]
2882
2948
  });
2883
- }, vn = () => /* @__PURE__ */ (0, x.jsx)("svg", {
2949
+ }, bn = () => /* @__PURE__ */ (0, x.jsx)("svg", {
2884
2950
  style: {
2885
2951
  position: "absolute",
2886
2952
  width: 0,
@@ -3022,11 +3088,11 @@ var tn = ({ boxRef: e }) => {
3022
3088
  })]
3023
3089
  })
3024
3090
  ] })
3025
- }), yn = ({ image: e, onSave: t, onBack: n, theme: r = "light", settings: i = g }) => {
3026
- let [a, o] = d(null), s = k("sm", a), c = {
3027
- ...g,
3091
+ }), xn = ({ image: e, onSave: t, onBack: n, theme: r = "light", settings: i = Et }) => {
3092
+ let [a, o] = d(null), s = Pe("sm", a), c = {
3093
+ ...Et,
3028
3094
  ...i
3029
- }, { loading: l, error: u, mimeType: f, width: p, height: m, originalBlob: h, previewUrl: _, isAlpha: v } = E({
3095
+ }, { loading: l, error: u, mimeType: f, width: p, height: m, originalBlob: h, previewUrl: g, isAlpha: _ } = je({
3030
3096
  src: e,
3031
3097
  skip: c?.tools?.length === 0
3032
3098
  });
@@ -3046,7 +3112,7 @@ var tn = ({ boxRef: e }) => {
3046
3112
  children: /* @__PURE__ */ (0, x.jsxs)("div", {
3047
3113
  className: L.system,
3048
3114
  children: [
3049
- l && /* @__PURE__ */ (0, x.jsx)(Se, { style: {
3115
+ l && /* @__PURE__ */ (0, x.jsx)(pe, { style: {
3050
3116
  width: 48,
3051
3117
  height: 48
3052
3118
  } }),
@@ -3060,33 +3126,34 @@ var tn = ({ boxRef: e }) => {
3060
3126
  })
3061
3127
  ]
3062
3128
  })
3063
- }) : /* @__PURE__ */ (0, x.jsx)(S, {
3129
+ }) : /* @__PURE__ */ (0, x.jsx)(kt, {
3064
3130
  mimeType: f,
3065
3131
  width: p,
3066
3132
  height: m,
3067
3133
  originalBlob: h,
3068
- previewUrl: _,
3069
- isAlpha: v,
3134
+ previewUrl: g,
3135
+ isAlpha: _,
3070
3136
  settings: c,
3137
+ onSave: t,
3138
+ onBack: n,
3071
3139
  children: /* @__PURE__ */ (0, x.jsxs)("div", {
3072
3140
  ref: o,
3073
3141
  className: `${L.root} ${L.wrapper}`,
3074
3142
  "data-theme": r,
3075
- children: [/* @__PURE__ */ (0, x.jsx)(vn, {}), /* @__PURE__ */ (0, x.jsxs)("div", {
3143
+ children: [c?.tools?.includes(U.FILTERS) && /* @__PURE__ */ (0, x.jsx)(bn, {}), c?.tools?.length === 1 ? /* @__PURE__ */ (0, x.jsx)("div", {
3144
+ className: L.gridSingleTool,
3145
+ children: /* @__PURE__ */ (0, x.jsx)(yn, {})
3146
+ }) : /* @__PURE__ */ (0, x.jsxs)("div", {
3076
3147
  className: `${c?.infobar ? L.grid : L.gridNoInfobar} ${s ? L.mobile : ""}`,
3077
3148
  children: [
3078
- /* @__PURE__ */ (0, x.jsx)(_t, {
3079
- onSave: t,
3080
- onBack: n,
3081
- isMobile: s
3082
- }),
3083
- /* @__PURE__ */ (0, x.jsx)(Nt, { isMobile: s }),
3084
- /* @__PURE__ */ (0, x.jsx)(_n, {}),
3085
- c?.infobar && /* @__PURE__ */ (0, x.jsx)(It, {})
3149
+ /* @__PURE__ */ (0, x.jsx)(At, { isMobile: s }),
3150
+ /* @__PURE__ */ (0, x.jsx)(Pt, { isMobile: s }),
3151
+ /* @__PURE__ */ (0, x.jsx)(yn, {}),
3152
+ c?.infobar && /* @__PURE__ */ (0, x.jsx)(Lt, {})
3086
3153
  ]
3087
3154
  })]
3088
3155
  })
3089
3156
  });
3090
3157
  };
3091
3158
  //#endregion
3092
- export { yn as Pixedi };
3159
+ export { xn as Pixedi };