var ho = Object.defineProperty; var po = (t, e, r) => e in t ? ho(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; var Xe = (t, e, r) => po(t, typeof e != "symbol" ? e + "" : e, r); import { CommandType as Re, ICommandService as ge, IUniverInstanceService as ue, IUndoRedoService as vt, ObjectMatrix as Ze, Range as ze, sequenceExecute as fi, Inject as Q, LocaleService as Ie, Disposable as je, ColorKit as hi, BooleanNumber as De, useDependency as he, Injector as We, UniverInstanceType as re, Rectangle as Be, Tools as tr, get as go, set as mo, createInterceptorKey as pi, InterceptorManager as vo, generateRandomId as yo, toDisposable as gi, InterceptorEffectEnum as bo, DependentOn as mi, Plugin as vi, merge as yi, IConfigService as bi, registerDependencies as So, touchDependencies as $n } from "@univerjs/core"; import { ConditionalFormattingRuleModel as me, CFRuleType as K, CFSubRuleType as G, AddConditionalRuleMutation as _e, AddConditionalRuleMutationUndoFactory as nr, CFNumberOperator as J, setConditionalRuleMutationUndoFactory as Je, SetConditionalRuleMutation as Ve, DeleteConditionalRuleMutationUndoFactory as Ge, DeleteConditionalRuleMutation as Ne, transformSupportSymmetryAnchor as Co, MoveConditionalRuleMutationUndoFactory as wo, MoveConditionalRuleMutation as fn, getColorScaleFromValue as Ro, iconMap as st, DEFAULT_BG_COLOR as _o, DEFAULT_FONT_COLOR as xo, defaultDataBarPositiveColor as Ft, defaultDataBarNativeColor as Vt, CFValueType as te, createDefaultValueByValueType as qt, removeUndefinedAttr as Io, createDefaultValue as hn, CFTextOperator as le, CFTimePeriodOperator as qe, iconGroup as Eo, getOppositeOperator as Qn, compareWithNumber as To, EMPTY_ICON_TYPE as Po, createDefaultRule as nt, ConditionalFormattingViewModel as Xt, SHEET_CONDITIONAL_FORMATTING_PLUGIN as Yt, isRangesEqual as Oo, ConditionalFormattingService as Si, DEFAULT_PADDING as Do, DEFAULT_WIDTH as Mo, UniverSheetsConditionalFormattingPlugin as Ci, CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH as No } from "@univerjs/sheets-conditional-formatting"; import { getSheetCommandTarget as xe, SheetsSelectionsService as ct, findAllRectangle as At, createTopMatrixFromMatrix as Wt, SetWorksheetActiveOperation as rr, SetSelectionsOperation as jo, checkRangesEditablePermission as pn, RemoveSheetMutation as Lo, setEndForRange as $o, SheetPermissionCheckController as zo, WorkbookEditablePermission as wi, RangeProtectionPermissionEditPoint as Ri, WorksheetEditPermission as _i, WorksheetSetCellStylePermission as xi, RefRangeService as Fo, handleDefaultRangeChangeWithEffectRefCommands as Vo, SheetInterceptorService as ir, INTERCEPTOR_POINT as qo, ClearSelectionFormatCommand as Ao, ClearSelectionAllCommand as Wo, RangeMergeUtil as Ho, AFTER_CELL_EDIT as Uo } from "@univerjs/sheets"; import { useObservable as ko, ComponentManager as or, useSidebarClick as Kt, ILayoutService as Bo, useScrollYOverContainer as Go, ISidebarService as Xo, MenuItemType as Yo, getMenuHiddenObservable as Ko, RibbonStartGroup as Zo, IMenuManagerService as Jo } from "@univerjs/ui"; import Le, { forwardRef as ut, useRef as Fe, createElement as yt, useMemo as Se, useState as H, useEffect as we } from "react"; import { Select as Me, Tooltip as mr, DropdownLegacy as sr, ColorPicker as Qo, InputNumber as at, RadioGroup as es, Radio as vr, Checkbox as gn, Input as ts, Button as yr } from "@univerjs/design"; import { serializeRange as Ii, deserializeRangeWithSheet as ns } from "@univerjs/engine-formula"; import { useHighlightRange as rs, ISheetClipboardService as is, COPY_TYPE as br, rangeToDiscreteRange as os, PREDEFINED_HOOK_NAME as zn, virtualizeDiscreteRanges as Ei, getRepeatRange as ss, SheetSkeletonManagerService as Ti, IAutoFillService as as, APPLY_TYPE as Fn, getAutoFillRepeatRange as ls, getCurrentRangeDisable$ as cs, IFormatPainterService as us, FormatPainterStatus as Vn } from "@univerjs/sheets-ui"; import Pi from "react-dom"; import { Observable as ot, debounceTime as Sr, merge as Oi } from "rxjs"; import { FormulaEditor as Tn, RangeSelector as ds } from "@univerjs/sheets-formula-ui"; import { IRenderManagerService as Di } from "@univerjs/engine-render"; import { bufferTime as fs, filter as Cr, debounceTime as wr } from "rxjs/operators"; const Mi = { type: Re.COMMAND, id: "sheet.command.add-average-conditional-rule", handler(t, e) { if (!e) return !1; const { ranges: r, style: n, stopIfTrue: i, operator: o } = e, c = t.get(me), v = t.get(ge), d = t.get(ue), y = xe(d); if (!y) return !1; const { unitId: p, subUnitId: C } = y, _ = c.createCfId(p, C), w = { ranges: r, cfId: _, stopIfTrue: !!i, rule: { type: K.highlightCell, subType: G.average, operator: o, style: n } }; return v.executeCommand(_e.id, { unitId: p, subUnitId: C, rule: w }); } }, Pn = { type: Re.COMMAND, id: "sheet.command.add-conditional-rule", handler(t, e) { if (!e) return !1; const { rule: r } = e, n = t.get(vt), i = t.get(ge), o = t.get(me), c = t.get(ue), v = xe(c); if (!v) return !1; const { unitId: d, subUnitId: y } = v, p = o.createCfId(d, y), C = { unitId: d, subUnitId: y, rule: { ...r, cfId: r.cfId || p } }, _ = nr(t, C), w = i.syncExecuteCommand(_e.id, C); return w && n.pushUndoRedo({ unitID: d, redoMutations: [{ id: _e.id, params: C }], undoMutations: [_] }), w; } }, Ni = { type: Re.COMMAND, id: "sheet.command.add-color-scale-conditional-rule", handler(t, e) { if (!e) return !1; const { ranges: r, config: n, stopIfTrue: i } = e, o = t.get(me), c = t.get(ge), v = t.get(ue), d = xe(v); if (!d) return !1; const { unitId: y, subUnitId: p } = d, C = o.createCfId(y, p), _ = { ranges: r, cfId: C, stopIfTrue: !!i, rule: { type: K.colorScale, config: n } }; return c.executeCommand(_e.id, { unitId: y, subUnitId: p, rule: _ }); } }, ji = { type: Re.COMMAND, id: "sheet.command.add-data-bar-conditional-rule", handler(t, e) { if (!e) return !1; const { ranges: r, min: n, max: i, nativeColor: o, positiveColor: c, isGradient: v, stopIfTrue: d, isShowValue: y } = e, p = t.get(me), C = t.get(ue), _ = xe(C); if (!_) return !1; const { unitId: w, subUnitId: S } = _, R = t.get(ge), h = p.createCfId(w, S), s = { ranges: r, cfId: h, stopIfTrue: !!d, rule: { type: K.dataBar, isShowValue: y, config: { min: n, max: i, nativeColor: o, positiveColor: c, isGradient: v } } }; return R.executeCommand(_e.id, { unitId: w, subUnitId: S, rule: s }); } }, Li = { type: Re.COMMAND, id: "sheet.command.add-duplicate-values-conditional-rule", handler(t, e) { if (!e) return !1; const { ranges: r, style: n, stopIfTrue: i } = e, o = t.get(me), c = t.get(ge), v = t.get(ue), d = xe(v); if (!d) return !1; const { unitId: y, subUnitId: p } = d, C = o.createCfId(y, p), _ = { ranges: r, cfId: C, stopIfTrue: !!i, rule: { type: K.highlightCell, subType: G.duplicateValues, style: n } }; return c.executeCommand(_e.id, { unitId: y, subUnitId: p, rule: _ }); } }, $i = { type: Re.COMMAND, id: "sheet.command.add-number-conditional-rule", handler(t, e) { if (!e) return !1; const { ranges: r, style: n, stopIfTrue: i, operator: o, value: c } = e, v = t.get(me), d = t.get(ge), y = t.get(ue), p = xe(y); if (!p) return !1; const { unitId: C, subUnitId: _ } = p, w = v.createCfId(C, _); let S; if ([J.between, J.notBetween].includes(o)) { const R = c; if (R.length !== 2 || !Array.isArray(R)) return !1; S = { ranges: r, cfId: w, stopIfTrue: !!i, rule: { type: K.highlightCell, subType: G.number, operator: o, style: n, value: R } }; } else { const R = c; if (typeof R != "number") return !1; S = { ranges: r, cfId: w, stopIfTrue: !!i, rule: { type: K.highlightCell, subType: G.number, operator: o, style: n, value: R } }; } return d.executeCommand(_e.id, { unitId: C, subUnitId: _, rule: S }); } }, zi = { type: Re.COMMAND, id: "sheet.command.add-rank-conditional-rule", handler(t, e) { if (!e) return !1; const { ranges: r, style: n, stopIfTrue: i, isPercent: o, isBottom: c, value: v } = e, d = t.get(me), y = t.get(ue), p = t.get(ge), C = xe(y); if (!C) return !1; const { unitId: _, subUnitId: w } = C, S = d.createCfId(_, w), R = { ranges: r, cfId: S, stopIfTrue: !!i, rule: { type: K.highlightCell, subType: G.rank, isPercent: o, isBottom: c, style: n, value: v } }; return p.executeCommand(_e.id, { unitId: _, subUnitId: w, rule: R }); } }, Fi = { type: Re.COMMAND, id: "sheet.command.add-text-conditional-rule", handler(t, e) { if (!e) return !1; const { ranges: r, style: n, stopIfTrue: i, operator: o, value: c } = e, v = t.get(me), d = t.get(ue), y = xe(d); if (!y) return !1; const { unitId: p, subUnitId: C } = y, _ = t.get(ge), w = v.createCfId(p, C), S = { ranges: r, cfId: w, stopIfTrue: !!i, rule: { type: K.highlightCell, subType: G.text, operator: o, style: n, value: c } }; return _.executeCommand(_e.id, { unitId: p, subUnitId: C, rule: S }); } }, Vi = { type: Re.COMMAND, id: "sheet.command.add-time-period-conditional-rule", handler(t, e) { if (!e) return !1; const { ranges: r, style: n, stopIfTrue: i, operator: o } = e, c = t.get(me), v = t.get(ue), d = t.get(ge), y = xe(v); if (!y) return !1; const { unitId: p, subUnitId: C } = y, _ = c.createCfId(p, C), w = { ranges: r, cfId: _, stopIfTrue: !!i, rule: { type: K.highlightCell, subType: G.timePeriod, operator: o, style: n } }; return d.executeCommand(_e.id, { unitId: p, subUnitId: C, rule: w }); } }, qi = { type: Re.COMMAND, id: "sheet.command.add-uniqueValues-conditional-rule", handler(t, e) { if (!e) return !1; const { ranges: r, style: n, stopIfTrue: i } = e, o = t.get(me), c = t.get(ue), v = t.get(ge), d = xe(c); if (!d) return !1; const { unitId: y, subUnitId: p } = d, C = o.createCfId(y, p), _ = { ranges: r, cfId: C, stopIfTrue: !!i, rule: { type: K.highlightCell, subType: G.uniqueValues, style: n } }; return v.executeCommand(_e.id, { unitId: y, subUnitId: p, rule: _ }); } }, ar = { type: Re.COMMAND, id: "sheet.command.clear-range-conditional-rule", handler(t, e) { var R; if (!e) return !1; const r = t.get(me), n = t.get(ue), i = t.get(ge), o = t.get(vt), c = t.get(ct), v = xe(n, e); if (!v) return !1; const { unitId: d, subUnitId: y } = v, p = ((R = c.getCurrentSelections()) == null ? void 0 : R.map((h) => h.range)) || [], C = r.getSubunitRules(d, y); if (!(C != null && C.length) || !p.length) return !1; const _ = [], w = []; C.forEach((h) => { const s = new Ze(); h.ranges.forEach((u) => { ze.foreach(u, (b, l) => { s.setValue(b, l, 1); }); }), p.forEach((u) => { ze.foreach(u, (b, l) => { s.realDeleteValue(b, l); }); }); const a = At(Wt(s)); if (a.length) { const u = { ...h, ranges: a }, b = { unitId: d, subUnitId: y, rule: u }, l = Je(t, b); _.push({ id: Ve.id, params: b }), w.push(...l); } else { const u = { unitId: d, subUnitId: y, cfId: h.cfId }, b = Ge(t, u); _.push({ id: Ne.id, params: u }), w.push(...b); } }); const S = fi(_, i).result; return S && o.pushUndoRedo({ unitID: d, redoMutations: _, undoMutations: w }), S; } }, On = { type: Re.COMMAND, id: "sheet.command.clear-worksheet-conditional-rule", handler(t, e) { const r = t.get(me), n = t.get(ue), i = t.get(ge), o = t.get(vt), c = xe(n, e); if (!c) return !1; const { unitId: v, subUnitId: d } = c, y = r.getSubunitRules(v, d); if (!(y != null && y.length)) return !1; const p = y.map((S) => ({ cfId: S.cfId, unitId: v, subUnitId: d })), C = p.map((S) => ({ id: Ne.id, params: S })), _ = p.map((S) => Ge(t, S)[0]), w = fi(C, i).result; return w && o.pushUndoRedo({ unitID: v, redoMutations: C, undoMutations: _ }), w; } }, mn = { type: Re.COMMAND, id: "sheet.command.delete-conditional-rule", handler(t, e) { if (!e) return !1; const r = t.get(vt), n = t.get(ge), i = t.get(ue), o = xe(i, e); if (!o) return !1; const { unitId: c, subUnitId: v } = o, d = { unitId: c, subUnitId: v, cfId: e.cfId }, y = Ge(t, d), p = n.syncExecuteCommand(Ne.id, d); return p && r.pushUndoRedo({ unitID: c, undoMutations: y, redoMutations: [{ id: Ne.id, params: d }] }), p; } }, lr = { type: Re.COMMAND, id: "sheet.command.move-conditional-rule", handler(t, e) { if (!e) return !1; const r = t.get(vt), n = t.get(ge), i = t.get(ue), o = t.get(me), c = xe(i, e); if (!c) return !1; const { unitId: v, subUnitId: d } = c, y = Co(e.start, e.end, o.getSubunitRules(v, d) || [], (R) => R.cfId); if (!y) return !1; const [p, C] = y, _ = { unitId: v, subUnitId: d, start: p, end: C }, w = wo(_), S = n.syncExecuteCommand(fn.id, _); return S && r.pushUndoRedo({ unitID: v, redoMutations: [{ id: fn.id, params: _ }], undoMutations: w }), S; } }, cr = { type: Re.COMMAND, id: "sheet.command.set-conditional-rule", handler(t, e) { if (!e) return !1; const r = t.get(vt), n = t.get(ge), i = t.get(ue), o = xe(i, e); if (!o) return !1; const { unitId: c, subUnitId: v } = o, d = { unitId: c, subUnitId: v, rule: e.rule }, y = Je(t, d), p = n.syncExecuteCommand(Ve.id, d); return p && r.pushUndoRedo({ unitID: c, undoMutations: y, redoMutations: [{ id: Ve.id, params: d }] }), p; } }; function hs(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; } function Ai(t) { if (t.__esModule) return t; var e = t.default; if (typeof e == "function") { var r = function n() { return this instanceof n ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments); }; r.prototype = e.prototype; } else r = {}; return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(t).forEach(function(n) { var i = Object.getOwnPropertyDescriptor(t, n); Object.defineProperty(r, n, i.get ? i : { enumerable: !0, get: function() { return t[n]; } }); }), r; } var qn = { exports: {} }, wt = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Rr; function ps() { if (Rr) return wt; Rr = 1; var t = Le, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 }; function c(v, d, y) { var p, C = {}, _ = null, w = null; y !== void 0 && (_ = "" + y), d.key !== void 0 && (_ = "" + d.key), d.ref !== void 0 && (w = d.ref); for (p in d) n.call(d, p) && !o.hasOwnProperty(p) && (C[p] = d[p]); if (v && v.defaultProps) for (p in d = v.defaultProps, d) C[p] === void 0 && (C[p] = d[p]); return { $$typeof: e, type: v, key: _, ref: w, props: C, _owner: i.current }; } return wt.Fragment = r, wt.jsx = c, wt.jsxs = c, wt; } var _r; function gs() { return _r || (_r = 1, qn.exports = ps()), qn.exports; } var x = gs(); const ms = "univer-conditional-formatting-wrap", vs = "univer-cf-rule-item", ys = "univer-preview", bs = "univer-create-rule", Ss = "univer-button", Cs = "univer-title", ws = "univer-label", Rs = "univer-label-container", _s = "univer-input-width", xs = "univer-m-t-base", Is = "univer-m-t-sm", Es = "univer-m-t-xl", Ts = "univer-m-l-sm", Ps = "univer-m-l-xl", Os = "univer-m-l-xxs", Ds = "univer-m-l-0", Ms = "univer-m-r-0", $ = { conditionalFormattingWrap: ms, cfRuleItem: vs, preview: ys, createRule: bs, button: Ss, title: Cs, label: ws, labelContainer: Rs, inputWidth: _s, mTBase: xs, mTSm: Is, mTXl: Es, mLSm: Ts, mLXl: Ps, mLXxs: Os, mL0: Ds, mR0: Ms }; var Oe = function() { return Oe = Object.assign || function(t) { for (var e, r = 1, n = arguments.length; r < n; r++) { e = arguments[r]; for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]); } return t; }, Oe.apply(this, arguments); }, Ns = function(t, e) { var r = {}; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]); if (t != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, n = Object.getOwnPropertySymbols(t); i < n.length; i++) e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]); return r; }, bt = ut(function(t, e) { var r = t.icon, n = t.id, i = t.className, o = t.extend, c = Ns(t, ["icon", "id", "className", "extend"]), v = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), d = Fe("_".concat($s())); return Wi(r, "".concat(n), { defIds: r.defIds, idSuffix: d.current }, Oe({ ref: e, className: v }, c), o); }); function Wi(t, e, r, n, i) { return yt(t.tag, Oe(Oe({ key: e }, js(t, r, i)), n), (Ls(t, r).children || []).map(function(o, c) { return Wi(o, "".concat(e, "-").concat(t.tag, "-").concat(c), r, void 0, i); })); } function js(t, e, r) { var n = Oe({}, t.attrs); r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1); var i = e.defIds; return !i || i.length === 0 || (t.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(function(o) { var c = o[0], v = o[1]; typeof v == "string" && (n[c] = v.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")"))); })), n; } function Ls(t, e) { var r, n = e.defIds; return !n || n.length === 0 ? t : t.tag === "defs" && (!((r = t.children) === null || r === void 0) && r.length) ? Oe(Oe({}, t), { children: t.children.map(function(i) { return typeof i.attrs.id == "string" && n && n.indexOf(i.attrs.id) > -1 ? Oe(Oe({}, i), { attrs: Oe(Oe({}, i.attrs), { id: i.attrs.id + e.idSuffix }) }) : i; }) }) : t; } function $s() { return Math.random().toString(36).substring(2, 8); } bt.displayName = "UniverIcon"; var zs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, dn = ut(function(t, e) { return yt(bt, Object.assign({}, t, { id: "delete-single", ref: e, icon: zs })); }); dn.displayName = "DeleteSingle"; var Fs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z" } }] }, Hi = ut(function(t, e) { return yt(bt, Object.assign({}, t, { id: "increase-single", ref: e, icon: Fs })); }); Hi.displayName = "IncreaseSingle"; var Vs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Dn = ut(function(t, e) { return yt(bt, Object.assign({}, t, { id: "more-down-single", ref: e, icon: Vs })); }); Dn.displayName = "MoreDownSingle"; var qs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_622_8", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { fill: "currentColor", mask: "url(#mask0_622_8)" }, children: [{ tag: "path", attrs: { d: "M6 5C6.55228 5 7 4.55228 7 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z" } }] }] }, Ui = ut(function(t, e) { return yt(bt, Object.assign({}, t, { id: "sequence-single", ref: e, icon: qs })); }); Ui.displayName = "SequenceSingle"; var As = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_436_41", style: { maskType: "alpha" }, width: 17, height: 17, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0.35 0.48H16.35V16.48H0.35z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_436_41)", fillRule: "evenodd", clipRule: "evenodd" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.27177 13.714L13.5855 2.40025L14.434 3.24878L3.1203 14.5625L2.27177 13.714Z" } }, { tag: "path", attrs: { fill: "#E5E5E5", d: "M4.2603 1.82495L2.89617 1.82495C2.23343 1.82495 1.69617 2.36221 1.69617 3.02495L1.69617 4.38908L3.02617 4.38908L3.02617 3.15495L4.2603 3.15495L4.2603 1.82495ZM15.0092 4.38908L15.0092 3.02495C15.0092 2.36221 14.4719 1.82495 13.8092 1.82495L12.4451 1.82495L12.4451 3.15495L13.6792 3.15495L13.6792 4.38908L15.0092 4.38908ZM6.98856 1.82495L6.98856 3.15495L9.71681 3.15495L9.71681 1.82495L6.98856 1.82495ZM15.0092 7.11734L13.6792 7.11734L13.6792 9.84559L15.0092 9.84559L15.0092 7.11734ZM15.0092 12.5739L13.6792 12.5739L13.6792 13.808L12.4451 13.808L12.4451 15.138L13.8092 15.138C14.4719 15.138 15.0092 14.6007 15.0092 13.938L15.0092 12.5739ZM9.71681 15.138L9.71681 13.808L6.98856 13.808L6.98856 15.138L9.71681 15.138ZM4.2603 15.138L4.2603 13.808L3.02617 13.808L3.02617 12.5739L1.69617 12.5739L1.69617 13.938C1.69617 14.6007 2.23343 15.138 2.89617 15.138L4.2603 15.138ZM1.69617 9.8456L3.02617 9.8456L3.02617 7.11734L1.69617 7.11734L1.69617 9.8456Z" } }] }] }, Zt = ut(function(t, e) { return yt(bt, Object.assign({}, t, { id: "slash-single", ref: e, icon: As })); }); Zt.displayName = "SlashSingle"; var An = { exports: {} }, Rt = {}, zt = { exports: {} }, Ws = zt.exports, xr; function ur() { return xr || (xr = 1, function(t, e) { (function(r, n) { n(e); })(Ws, function(r) { function n(V) { return function(ce, E, T, D, L, B, q) { return V(ce, E, q); }; } function i(V) { return function(ce, E, T, D) { if (!ce || !E || typeof ce != "object" || typeof E != "object") return V(ce, E, T, D); var L = D.get(ce), B = D.get(E); if (L && B) return L === E && B === ce; D.set(ce, E), D.set(E, ce); var q = V(ce, E, T, D); return D.delete(ce), D.delete(E), q; }; } function o(V, Z) { var ce = {}; for (var E in V) ce[E] = V[E]; for (var E in Z) ce[E] = Z[E]; return ce; } function c(V) { return V.constructor === Object || V.constructor == null; } function v(V) { return typeof V.then == "function"; } function d(V, Z) { return V === Z || V !== V && Z !== Z; } var y = "[object Arguments]", p = "[object Boolean]", C = "[object Date]", _ = "[object RegExp]", w = "[object Map]", S = "[object Number]", R = "[object Object]", h = "[object Set]", s = "[object String]", a = Object.prototype.toString; function u(V) { var Z = V.areArraysEqual, ce = V.areDatesEqual, E = V.areMapsEqual, T = V.areObjectsEqual, D = V.areRegExpsEqual, L = V.areSetsEqual, B = V.createIsNestedEqual, q = B(Y); function Y(X, ne, pe) { if (X === ne) return !0; if (!X || !ne || typeof X != "object" || typeof ne != "object") return X !== X && ne !== ne; if (c(X) && c(ne)) return T(X, ne, q, pe); var et = Array.isArray(X), Pe = Array.isArray(ne); if (et || Pe) return et === Pe && Z(X, ne, q, pe); var Ce = a.call(X); return Ce !== a.call(ne) ? !1 : Ce === C ? ce(X, ne, q, pe) : Ce === _ ? D(X, ne, q, pe) : Ce === w ? E(X, ne, q, pe) : Ce === h ? L(X, ne, q, pe) : Ce === R || Ce === y ? v(X) || v(ne) ? !1 : T(X, ne, q, pe) : Ce === p || Ce === S || Ce === s ? d(X.valueOf(), ne.valueOf()) : !1; } return Y; } function b(V, Z, ce, E) { var T = V.length; if (Z.length !== T) return !1; for (; T-- > 0; ) if (!ce(V[T], Z[T], T, T, V, Z, E)) return !1; return !0; } var l = i(b); function g(V, Z) { return d(V.valueOf(), Z.valueOf()); } function f(V, Z, ce, E) { var T = V.size === Z.size; if (!T) return !1; if (!V.size) return !0; var D = {}, L = 0; return V.forEach(function(B, q) { if (T) { var Y = !1, X = 0; Z.forEach(function(ne, pe) { !Y && !D[X] && (Y = ce(q, pe, L, X, V, Z, E) && ce(B, ne, q, pe, V, Z, E)) && (D[X] = !0), X++; }), L++, T = Y; } }), T; } var m = i(f), P = "_owner", M = Object.prototype.hasOwnProperty; function j(V, Z, ce, E) { var T = Object.keys(V), D = T.length; if (Object.keys(Z).length !== D) return !1; for (var L; D-- > 0; ) { if (L = T[D], L === P) { var B = !!V.$$typeof, q = !!Z.$$typeof; if ((B || q) && B !== q) return !1; } if (!M.call(Z, L) || !ce(V[L], Z[L], L, L, V, Z, E)) return !1; } return !0; } var N = i(j); function I(V, Z) { return V.source === Z.source && V.flags === Z.flags; } function O(V, Z, ce, E) { var T = V.size === Z.size; if (!T) return !1; if (!V.size) return !0; var D = {}; return V.forEach(function(L, B) { if (T) { var q = !1, Y = 0; Z.forEach(function(X, ne) { !q && !D[Y] && (q = ce(L, X, B, ne, V, Z, E)) && (D[Y] = !0), Y++; }), T = q; } }), T; } var z = i(O), U = Object.freeze({ areArraysEqual: b, areDatesEqual: g, areMapsEqual: f, areObjectsEqual: j, areRegExpsEqual: I, areSetsEqual: O, createIsNestedEqual: n }), k = Object.freeze({ areArraysEqual: l, areDatesEqual: g, areMapsEqual: m, areObjectsEqual: N, areRegExpsEqual: I, areSetsEqual: z, createIsNestedEqual: n }), ie = u(U); function ee(V, Z) { return ie(V, Z, void 0); } var A = u(o(U, { createIsNestedEqual: function() { return d; } })); function F(V, Z) { return A(V, Z, void 0); } var oe = u(k); function se(V, Z) { return oe(V, Z, /* @__PURE__ */ new WeakMap()); } var de = u(o(k, { createIsNestedEqual: function() { return d; } })); function ye(V, Z) { return de(V, Z, /* @__PURE__ */ new WeakMap()); } function Ee(V) { return u(o(U, V(U))); } function $e(V) { var Z = u(o(k, V(k))); return function(ce, E, T) { return T === void 0 && (T = /* @__PURE__ */ new WeakMap()), Z(ce, E, T); }; } r.circularDeepEqual = se, r.circularShallowEqual = ye, r.createCustomCircularEqual = $e, r.createCustomEqual = Ee, r.deepEqual = ee, r.sameValueZeroEqual = d, r.shallowEqual = F, Object.defineProperty(r, "__esModule", { value: !0 }); }); }(zt, zt.exports)), zt.exports; } var Qt = { exports: {} }, Ir; function dr() { if (Ir) return Qt.exports; Ir = 1; function t(r) { var n, i, o = ""; if (typeof r == "string" || typeof r == "number") o += r; else if (typeof r == "object") if (Array.isArray(r)) { var c = r.length; for (n = 0; n < c; n++) r[n] && (i = t(r[n])) && (o && (o += " "), o += i); } else for (i in r) r[i] && (o && (o += " "), o += i); return o; } function e() { for (var r, n, i = 0, o = "", c = arguments.length; i < c; i++) (r = arguments[i]) && (n = t(r)) && (o && (o += " "), o += n); return o; } return Qt.exports = e, Qt.exports.clsx = e, Qt.exports; } var ae = {}, Wn, Er; function Hs() { return Er || (Er = 1, Wn = function(e, r, n) { return e === r ? !0 : e.className === r.className && n(e.style, r.style) && e.width === r.width && e.autoSize === r.autoSize && e.cols === r.cols && e.draggableCancel === r.draggableCancel && e.draggableHandle === r.draggableHandle && n(e.verticalCompact, r.verticalCompact) && n(e.compactType, r.compactType) && n(e.layout, r.layout) && n(e.margin, r.margin) && n(e.containerPadding, r.containerPadding) && e.rowHeight === r.rowHeight && e.maxRows === r.maxRows && e.isBounded === r.isBounded && e.isDraggable === r.isDraggable && e.isResizable === r.isResizable && e.allowOverlap === r.allowOverlap && e.preventCollision === r.preventCollision && e.useCSSTransforms === r.useCSSTransforms && e.transformScale === r.transformScale && e.isDroppable === r.isDroppable && n(e.resizeHandles, r.resizeHandles) && n(e.resizeHandle, r.resizeHandle) && e.onLayoutChange === r.onLayoutChange && e.onDragStart === r.onDragStart && e.onDrag === r.onDrag && e.onDragStop === r.onDragStop && e.onResizeStart === r.onResizeStart && e.onResize === r.onResize && e.onResizeStop === r.onResizeStop && e.onDrop === r.onDrop && n(e.droppingItem, r.droppingItem) && n(e.innerRef, r.innerRef); }), Wn; } var Tr; function St() { if (Tr) return ae; Tr = 1, Object.defineProperty(ae, "__esModule", { value: !0 }), ae.bottom = n, ae.childrenEqual = d, ae.cloneLayout = i, ae.cloneLayoutItem = v, ae.collides = p, ae.compact = C, ae.compactItem = S, ae.compactType = V, ae.correctBounds = R, ae.fastPositionEqual = y, ae.fastRGLPropsEqual = void 0, ae.getAllCollisions = a, ae.getFirstCollision = s, ae.getLayoutItem = h, ae.getStatics = u, ae.modifyLayout = o, ae.moveElement = b, ae.moveElementAwayFromCollision = l, ae.noop = void 0, ae.perc = g, ae.resizeItemInDirection = A, ae.setTopLeft = oe, ae.setTransform = F, ae.sortLayoutItems = se, ae.sortLayoutItemsByColRow = ye, ae.sortLayoutItemsByRowCol = de, ae.synchronizeLayoutWithChildren = Ee, ae.validateLayout = $e, ae.withLayoutItem = c; var t = /* @__PURE__ */ ur(), e = r(Le); function r(E) { return E && E.__esModule ? E : { default: E }; } function n(E) { let T = 0, D; for (let L = 0, B = E.length; L < B; L++) D = E[L].y + E[L].h, D > T && (T = D); return T; } function i(E) { const T = Array(E.length); for (let D = 0, L = E.length; D < L; D++) T[D] = v(E[D]); return T; } function o(E, T) { const D = Array(E.length); for (let L = 0, B = E.length; L < B; L++) T.i === E[L].i ? D[L] = T : D[L] = E[L]; return D; } function c(E, T, D) { let L = h(E, T); return L ? (L = D(v(L)), E = o(E, L), [E, L]) : [E, null]; } function v(E) { return { w: E.w, h: E.h, x: E.x, y: E.y, i: E.i, minW: E.minW, maxW: E.maxW, minH: E.minH, maxH: E.maxH, moved: !!E.moved, static: !!E.static, // These can be null/undefined isDraggable: E.isDraggable, isResizable: E.isResizable, resizeHandles: E.resizeHandles, isBounded: E.isBounded }; } function d(E, T) { return (0, t.deepEqual)(e.default.Children.map(E, (D) => D == null ? void 0 : D.key), e.default.Children.map(T, (D) => D == null ? void 0 : D.key)) && (0, t.deepEqual)(e.default.Children.map(E, (D) => D == null ? void 0 : D.props["data-grid"]), e.default.Children.map(T, (D) => D == null ? void 0 : D.props["data-grid"])); } ae.fastRGLPropsEqual = Hs(); function y(E, T) { return E.left === T.left && E.top === T.top && E.width === T.width && E.height === T.height; } function p(E, T) { return !(E.i === T.i || E.x + E.w <= T.x || E.x >= T.x + T.w || E.y + E.h <= T.y || E.y >= T.y + T.h); } function C(E, T, D, L) { const B = u(E), q = se(E, T), Y = Array(E.length); for (let X = 0, ne = q.length; X < ne; X++) { let pe = v(q[X]); pe.static || (pe = S(B, pe, T, D, q, L), B.push(pe)), Y[E.indexOf(q[X])] = pe, pe.moved = !1; } return Y; } const _ = { x: "w", y: "h" }; function w(E, T, D, L) { const B = _[L]; T[L] += 1; const q = E.map((Y) => Y.i).indexOf(T.i); for (let Y = q + 1; Y < E.length; Y++) { const X = E[Y]; if (!X.static) { if (X.y > T.y + T.h) break; p(T, X) && w(E, X, D + T[B], L); } } T[L] = D; } function S(E, T, D, L, B, q) { const Y = D === "vertical", X = D === "horizontal"; if (Y) for (T.y = Math.min(n(E), T.y); T.y > 0 && !s(E, T); ) T.y--; else if (X) for (; T.x > 0 && !s(E, T); ) T.x--; let ne; for (; (ne = s(E, T)) && !(D === null && q); ) if (X ? w(B, T, ne.x + ne.w, "x") : w(B, T, ne.y + ne.h, "y"), X && T.x + T.w > L) for (T.x = L - T.w, T.y++; T.x > 0 && !s(E, T); ) T.x--; return T.y = Math.max(T.y, 0), T.x = Math.max(T.x, 0), T; } function R(E, T) { const D = u(E); for (let L = 0, B = E.length; L < B; L++) { const q = E[L]; if (q.x + q.w > T.cols && (q.x = T.cols - q.w), q.x < 0 && (q.x = 0, q.w = T.cols), !q.static) D.push(q); else for (; s(D, q); ) q.y++; } return E; } function h(E, T) { for (let D = 0, L = E.length; D < L; D++) if (E[D].i === T) return E[D]; } function s(E, T) { for (let D = 0, L = E.length; D < L; D++) if (p(E[D], T)) return E[D]; } function a(E, T) { return E.filter((D) => p(D, T)); } function u(E) { return E.filter((T) => T.static); } function b(E, T, D, L, B, q, Y, X, ne) { if (T.static && T.isDraggable !== !0 || T.y === L && T.x === D) return E; `${T.i}${String(D)}${String(L)}${T.x}${T.y}`; const pe = T.x, et = T.y; typeof D == "number" && (T.x = D), typeof L == "number" && (T.y = L), T.moved = !0; let Pe = se(E, Y); (Y === "vertical" && typeof L == "number" ? et >= L : Y === "horizontal" && typeof D == "number" ? pe >= D : !1) && (Pe = Pe.reverse()); const dt = a(Pe, T), Jt = dt.length > 0; if (Jt && ne) return i(E); if (Jt && q) return `${T.i}`, T.x = pe, T.y = et, T.moved = !1, E; for (let Ln = 0, fo = dt.length; Ln < fo; Ln++) { const tt = dt[Ln]; `${T.i}${T.x}${T.y}${tt.i}${tt.x}${tt.y}`, !tt.moved && (tt.static ? E = l(E, tt, T, B, Y) : E = l(E, T, tt, B, Y)); } return E; } function l(E, T, D, L, B, q) { const Y = B === "horizontal", X = B === "vertical", ne = T.static; if (L) { L = !1; const Pe = { x: Y ? Math.max(T.x - D.w, 0) : D.x, y: X ? Math.max(T.y - D.h, 0) : D.y, w: D.w, h: D.h, i: "-1" }, Ce = s(E, Pe), dt = Ce && Ce.y + Ce.h > T.y, Jt = Ce && T.x + T.w > Ce.x; if (Ce) { if (dt && X) return b(E, D, void 0, T.y + 1, L, ne, B); if (dt && B == null) return T.y = D.y, D.y = D.y + D.h, E; if (Jt && Y) return b(E, T, D.x, void 0, L, ne, B); } else return `${D.i}${Pe.x}${Pe.y}`, b(E, D, Y ? Pe.x : void 0, X ? Pe.y : void 0, L, ne, B); } const pe = Y ? D.x + 1 : void 0, et = X ? D.y + 1 : void 0; return pe == null && et == null ? E : b(E, D, Y ? D.x + 1 : void 0, X ? D.y + 1 : void 0, L, ne, B); } function g(E) { return E * 100 + "%"; } const f = (E, T, D, L) => E + D > L ? T : D, m = (E, T, D) => E < 0 ? T : D, P = (E) => Math.max(0, E), M = (E) => Math.max(0, E), j = (E, T, D) => { let { left: L, height: B, width: q } = T; const Y = E.top - (B - E.height); return { left: L, width: q, height: m(Y, E.height, B), top: M(Y) }; }, N = (E, T, D) => { let { top: L, left: B, height: q, width: Y } = T; return { top: L, height: q, width: f(E.left, E.width, Y, D), left: P(B) }; }, I = (E, T, D) => { let { top: L, height: B, width: q } = T; const Y = E.left - (q - E.width); return { height: B, width: Y < 0 ? E.width : f(E.left, E.width, q, D), top: M(L), left: P(Y) }; }, O = (E, T, D) => { let { top: L, left: B, height: q, width: Y } = T; return { width: Y, left: B, height: m(L, E.height, q), top: M(L) }; }, ee = { n: j, ne: function() { return j(arguments.length <= 0 ? void 0 : arguments[0], N(...arguments)); }, e: N, se: function() { return O(arguments.length <= 0 ? void 0 : arguments[0], N(...arguments)); }, s: O, sw: function() { return O(arguments.length <= 0 ? void 0 : arguments[0], I(...arguments)); }, w: I, nw: function() { return j(arguments.length <= 0 ? void 0 : arguments[0], I(...arguments)); } }; function A(E, T, D, L) { const B = ee[E]; return B ? B(T, { ...T, ...D }, L) : D; } function F(E) { let { top: T, left: D, width: L, height: B } = E; const q = `translate(${D}px,${T}px)`; return { transform: q, WebkitTransform: q, MozTransform: q, msTransform: q, OTransform: q, width: `${L}px`, height: `${B}px`, position: "absolute" }; } function oe(E) { let { top: T, left: D, width: L, height: B } = E; return { top: `${T}px`, left: `${D}px`, width: `${L}px`, height: `${B}px`, position: "absolute" }; } function se(E, T) { return T === "horizontal" ? ye(E) : T === "vertical" ? de(E) : E; } function de(E) { return E.slice(0).sort(function(T, D) { return T.y > D.y || T.y === D.y && T.x > D.x ? 1 : T.y === D.y && T.x === D.x ? 0 : -1; }); } function ye(E) { return E.slice(0).sort(function(T, D) { return T.x > D.x || T.x === D.x && T.y > D.y ? 1 : -1; }); } function Ee(E, T, D, L, B) { E = E || []; const q = []; e.default.Children.forEach(T, (X) => { if ((X == null ? void 0 : X.key) == null) return; const ne = h(E, String(X.key)), pe = X.props["data-grid"]; ne && pe == null ? q.push(v(ne)) : pe ? q.push(v({ ...pe, i: X.key })) : q.push(v({ w: 1, h: 1, x: 0, y: n(q), i: String(X.key) })); }); const Y = R(q, { cols: D }); return B ? Y : C(Y, L, D); } function $e(E) { let T = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "Layout"; const D = ["x", "y", "w", "h"]; if (!Array.isArray(E)) throw new Error(T + " must be an array!"); for (let L = 0, B = E.length; L < B; L++) { const q = E[L]; for (let Y = 0; Y < D.length; Y++) if (typeof q[D[Y]] != "number") throw new Error("ReactGridLayout: " + T + "[" + L + "]." + D[Y] + " must be a number!"); } } function V(E) { const { verticalCompact: T, compactType: D } = E || {}; return T === !1 ? null : D; } function Z() { } const ce = () => { }; return ae.noop = ce, ae; } var He = {}, Pr; function fr() { if (Pr) return He; Pr = 1, Object.defineProperty(He, "__esModule", { value: !0 }), He.calcGridColWidth = t, He.calcGridItemPosition = r, He.calcGridItemWHPx = e, He.calcWH = i, He.calcXY = n, He.clamp = o; function t(c) { const { margin: v, containerPadding: d, containerWidth: y, cols: p } = c; return (y - v[0] * (p - 1) - d[0] * 2) / p; } function e(c, v, d) { return Number.isFinite(c) ? Math.round(v * c + Math.max(0, c - 1) * d) : c; } function r(c, v, d, y, p, C) { const { margin: _, containerPadding: w, rowHeight: S } = c, R = t(c), h = {}; return C && C.resizing ? (h.width = Math.round(C.resizing.width), h.height = Math.round(C.resizing.height)) : (h.width = e(y, R, _[0]), h.height = e(p, S, _[1])), C && C.dragging ? (h.top = Math.round(C.dragging.top), h.left = Math.round(C.dragging.left)) : C && C.resizing && typeof C.resizing.top == "number" && typeof C.resizing.left == "number" ? (h.top = Math.round(C.resizing.top), h.left = Math.round(C.resizing.left)) : (h.top = Math.round((S + _[1]) * d + w[1]), h.left = Math.round((R + _[0]) * v + w[0])), h; } function n(c, v, d, y, p) { const { margin: C, cols: _, rowHeight: w, maxRows: S } = c, R = t(c); let h = Math.round((d - C[0]) / (R + C[0])), s = Math.round((v - C[1]) / (w + C[1])); return h = o(h, 0, _ - y), s = o(s, 0, S - p), { x: h, y: s }; } function i(c, v, d, y, p, C) { const { margin: _, maxRows: w, cols: S, rowHeight: R } = c, h = t(c); let s = Math.round((v + _[0]) / (h + _[0])), a = Math.round((d + _[1]) / (R + _[1])), u = o(s, 0, S - y), b = o(a, 0, w - p); return ["sw", "w", "nw"].indexOf(C) !== -1 && (u = o(s, 0, S)), ["nw", "n", "ne"].indexOf(C) !== -1 && (b = o(a, 0, w)), { w: u, h: b }; } function o(c, v, d) { return Math.max(Math.min(c, d), v); } return He; } var _t = {}, Hn = { exports: {} }, Un, Or; function Us() { if (Or) return Un; Or = 1; var t = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"; return Un = t, Un; } var kn, Dr; function ks() { if (Dr) return kn; Dr = 1; var t = /* @__PURE__ */ Us(); function e() { } function r() { } return r.resetWarningCache = e, kn = function() { function n(c, v, d, y, p, C) { if (C !== t) { var _ = new Error( "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types" ); throw _.name = "Invariant Violation", _; } } n.isRequired = n; function i() { return n; } var o = { array: n, bigint: n, bool: n, func: n, number: n, object: n, string: n, symbol: n, any: n, arrayOf: i, element: n, elementType: n, instanceOf: i, node: n, objectOf: i, oneOf: i, oneOfType: i, shape: i, exact: i, checkPropTypes: r, resetWarningCache: e }; return o.PropTypes = o, o; }, kn; } var Mr; function Qe() { return Mr || (Mr = 1, Hn.exports = /* @__PURE__ */ ks()()), Hn.exports; } var xt = { exports: {} }, Bn = {}; function ki(t) { var e, r, n = ""; if (typeof t == "string" || typeof t == "number") n += t; else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (r = ki(t[e])) && (n && (n += " "), n += r); else for (e in t) t[e] && (n && (n += " "), n += e); return n; } function Nr() { for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = ki(t)) && (n && (n += " "), n += e); return n; } const Bs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, clsx: Nr, default: Nr }, Symbol.toStringTag, { value: "Module" })), Gs = /* @__PURE__ */ Ai(Bs); var ve = {}, Ye = {}, jr; function Mn() { if (jr) return Ye; jr = 1, Object.defineProperty(Ye, "__esModule", { value: !0 }), Ye.dontSetMe = i, Ye.findInArray = t, Ye.int = n, Ye.isFunction = e, Ye.isNum = r; function t(o, c) { for (let v = 0, d = o.length; v < d; v++) if (c.apply(c, [o[v], v, o])) return o[v]; } function e(o) { return typeof o == "function" || Object.prototype.toString.call(o) === "[object Function]"; } function r(o) { return typeof o == "number" && !isNaN(o); } function n(o) { return parseInt(o, 10); } function i(o, c, v) { if (o[c]) return new Error("Invalid prop ".concat(c, " passed to ").concat(v, " - do not set this, set it on the child.")); } return Ye; } var Ke = {}, Lr; function Xs() { if (Lr) return Ke; Lr = 1, Object.defineProperty(Ke, "__esModule", { value: !0 }), Ke.browserPrefixToKey = r, Ke.browserPrefixToStyle = n, Ke.default = void 0, Ke.getPrefix = e; const t = ["Moz", "Webkit", "O", "ms"]; function e() { var o; let c = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "transform"; if (typeof window > "u") return ""; const v = (o = window.document) === null || o === void 0 || (o = o.documentElement) === null || o === void 0 ? void 0 : o.style; if (!v || c in v) return ""; for (let d = 0; d < t.length; d++) if (r(c, t[d]) in v) return t[d]; return ""; } function r(o, c) { return c ? "".concat(c).concat(i(o)) : o; } function n(o, c) { return c ? "-".concat(c.toLowerCase(), "-").concat(o) : o; } function i(o) { let c = "", v = !0; for (let d = 0; d < o.length; d++) v ? (c += o[d].toUpperCase(), v = !1) : o[d] === "-" ? v = !0 : c += o[d]; return c; } return Ke.default = e(), Ke; } var $r; function hr() { if ($r) return ve; $r = 1, Object.defineProperty(ve, "__esModule", { value: !0 }), ve.addClassName = l, ve.addEvent = v, ve.addUserSelectStyles = u, ve.createCSSTransform = S, ve.createSVGTransform = R, ve.getTouch = s, ve.getTouchIdentifier = a, ve.getTranslation = h, ve.innerHeight = C, ve.innerWidth = _, ve.matchesSelector = o, ve.matchesSelectorAndParentsTo = c, ve.offsetXYFromParent = w, ve.outerHeight = y, ve.outerWidth = p, ve.removeClassName = g, ve.removeEvent = d, ve.removeUserSelectStyles = b; var t = Mn(), e = n(Xs()); function r(f) { if (typeof WeakMap != "function") return null; var m = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(); return (r = function(M) { return M ? P : m; })(f); } function n(f, m) { if (f && f.__esModule) return f; if (f === null || typeof f != "object" && typeof f != "function") return { default: f }; var P = r(m); if (P && P.has(f)) return P.get(f); var M = {}, j = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var N in f) if (N !== "default" && Object.prototype.hasOwnProperty.call(f, N)) { var I = j ? Object.getOwnPropertyDescriptor(f, N) : null; I && (I.get || I.set) ? Object.defineProperty(M, N, I) : M[N] = f[N]; } return M.default = f, P && P.set(f, M), M; } let i = ""; function o(f, m) { return i || (i = (0, t.findInArray)(["matches", "webkitMatchesSelector", "mozMatchesSelector", "msMatchesSelector", "oMatchesSelector"], function(P) { return (0, t.isFunction)(f[P]); })), (0, t.isFunction)(f[i]) ? f[i](m) : !1; } function c(f, m, P) { let M = f; do { if (o(M, m)) return !0; if (M === P) return !1; M = M.parentNode; } while (M); return !1; } function v(f, m, P, M) { if (!f) return; const j = { capture: !0, ...M }; f.addEventListener ? f.addEventListener(m, P, j) : f.attachEvent ? f.attachEvent("on" + m, P) : f["on" + m] = P; } function d(f, m, P, M) { if (!f) return; const j = { capture: !0, ...M }; f.removeEventListener ? f.removeEventListener(m, P, j) : f.detachEvent ? f.detachEvent("on" + m, P) : f["on" + m] = null; } function y(f) { let m = f.clientHeight; const P = f.ownerDocument.defaultView.getComputedStyle(f); return m += (0, t.int)(P.borderTopWidth), m += (0, t.int)(P.borderBottomWidth), m; } function p(f) { let m = f.clientWidth; const P = f.ownerDocument.defaultView.getComputedStyle(f); return m += (0, t.int)(P.borderLeftWidth), m += (0, t.int)(P.borderRightWidth), m; } function C(f) { let m = f.clientHeight; const P = f.ownerDocument.defaultView.getComputedStyle(f); return m -= (0, t.int)(P.paddingTop), m -= (0, t.int)(P.paddingBottom), m; } function _(f) { let m = f.clientWidth; const P = f.ownerDocument.defaultView.getComputedStyle(f); return m -= (0, t.int)(P.paddingLeft), m -= (0, t.int)(P.paddingRight), m; } function w(f, m, P) { const j = m === m.ownerDocument.body ? { left: 0, top: 0 } : m.getBoundingClientRect(), N = (f.clientX + m.scrollLeft - j.left) / P, I = (f.clientY + m.scrollTop - j.top) / P; return { x: N, y: I }; } function S(f, m) { const P = h(f, m, "px"); return { [(0, e.browserPrefixToKey)("transform", e.default)]: P }; } function R(f, m) { return h(f, m, ""); } function h(f, m, P) { let { x: M, y: j } = f, N = "translate(".concat(M).concat(P, ",").concat(j).concat(P, ")"); if (m) { const I = "".concat(typeof m.x == "string" ? m.x : m.x + P), O = "".concat(typeof m.y == "string" ? m.y : m.y + P); N = "translate(".concat(I, ", ").concat(O, ")") + N; } return N; } function s(f, m) { return f.targetTouches && (0, t.findInArray)(f.targetTouches, (P) => m === P.identifier) || f.changedTouches && (0, t.findInArray)(f.changedTouches, (P) => m === P.identifier); } function a(f) { if (f.targetTouches && f.targetTouches[0]) return f.targetTouches[0].identifier; if (f.changedTouches && f.changedTouches[0]) return f.changedTouches[0].identifier; } function u(f) { if (!f) return; let m = f.getElementById("react-draggable-style-el"); m || (m = f.createElement("style"), m.type = "text/css", m.id = "react-draggable-style-el", m.innerHTML = `.react-draggable-transparent-selection *::-moz-selection {all: inherit;} `, m.innerHTML += `.react-draggable-transparent-selection *::selection {all: inherit;} `, f.getElementsByTagName("head")[0].appendChild(m)), f.body && l(f.body, "react-draggable-transparent-selection"); } function b(f) { if (f) try { if (f.body && g(f.body, "react-draggable-transparent-selection"), f.selection) f.selection.empty(); else { const m = (f.defaultView || window).getSelection(); m && m.type !== "Caret" && m.removeAllRanges(); } } catch { } } function l(f, m) { f.classList ? f.classList.add(m) : f.className.match(new RegExp("(?:^|\\s)".concat(m, "(?!\\S)"))) || (f.className += " ".concat(m)); } function g(f, m) { f.classList ? f.classList.remove(m) : f.className = f.className.replace(new RegExp("(?:^|\\s)".concat(m, "(?!\\S)"), "g"), ""); } return ve; } var Ae = {}, zr; function Bi() { if (zr) return Ae; zr = 1, Object.defineProperty(Ae, "__esModule", { value: !0 }), Ae.canDragX = i, Ae.canDragY = o, Ae.createCoreData = v, Ae.createDraggableData = d, Ae.getBoundPosition = r, Ae.getControlPosition = c, Ae.snapToGrid = n; var t = Mn(), e = hr(); function r(C, _, w) { if (!C.props.bounds) return [_, w]; let { bounds: S } = C.props; S = typeof S == "string" ? S : y(S); const R = p(C); if (typeof S == "string") { const { ownerDocument: h } = R, s = h.defaultView; let a; if (S === "parent" ? a = R.parentNode : a = h.querySelector(S), !(a instanceof s.HTMLElement)) throw new Error('Bounds selector "' + S + '" could not find an element.'); const u = a, b = s.getComputedStyle(R), l = s.getComputedStyle(u); S = { left: -R.offsetLeft + (0, t.int)(l.paddingLeft) + (0, t.int)(b.marginLeft), top: -R.offsetTop + (0, t.int)(l.paddingTop) + (0, t.int)(b.marginTop), right: (0, e.innerWidth)(u) - (0, e.outerWidth)(R) - R.offsetLeft + (0, t.int)(l.paddingRight) - (0, t.int)(b.marginRight), bottom: (0, e.innerHeight)(u) - (0, e.outerHeight)(R) - R.offsetTop + (0, t.int)(l.paddingBottom) - (0, t.int)(b.marginBottom) }; } return (0, t.isNum)(S.right) && (_ = Math.min(_, S.right)), (0, t.isNum)(S.bottom) && (w = Math.min(w, S.bottom)), (0, t.isNum)(S.left) && (_ = Math.max(_, S.left)), (0, t.isNum)(S.top) && (w = Math.max(w, S.top)), [_, w]; } function n(C, _, w) { const S = Math.round(_ / C[0]) * C[0], R = Math.round(w / C[1]) * C[1]; return [S, R]; } function i(C) { return C.props.axis === "both" || C.props.axis === "x"; } function o(C) { return C.props.axis === "both" || C.props.axis === "y"; } function c(C, _, w) { const S = typeof _ == "number" ? (0, e.getTouch)(C, _) : null; if (typeof _ == "number" && !S) return null; const R = p(w), h = w.props.offsetParent || R.offsetParent || R.ownerDocument.body; return (0, e.offsetXYFromParent)(S || C, h, w.props.scale); } function v(C, _, w) { const S = !(0, t.isNum)(C.lastX), R = p(C); return S ? { node: R, deltaX: 0, deltaY: 0, lastX: _, lastY: w, x: _, y: w } : { node: R, deltaX: _ - C.lastX, deltaY: w - C.lastY, lastX: C.lastX, lastY: C.lastY, x: _, y: w }; } function d(C, _) { const w = C.props.scale; return { node: _.node, x: C.state.x + _.deltaX / w, y: C.state.y + _.deltaY / w, deltaX: _.deltaX / w, deltaY: _.deltaY / w, lastX: C.state.x, lastY: C.state.y }; } function y(C) { return { left: C.left, top: C.top, right: C.right, bottom: C.bottom }; } function p(C) { const _ = C.findDOMNode(); if (!_) throw new Error(": Unmounted during event!"); return _; } return Ae; } var It = {}, en = {}, Fr; function Gi() { if (Fr) return en; Fr = 1, Object.defineProperty(en, "__esModule", { value: !0 }), en.default = t; function t() { } return en; } var Vr; function Ys() { if (Vr) return It; Vr = 1, Object.defineProperty(It, "__esModule", { value: !0 }), It.default = void 0; var t = y(Le), e = v(/* @__PURE__ */ Qe()), r = v(Pi), n = hr(), i = Bi(), o = Mn(), c = v(Gi()); function v(h) { return h && h.__esModule ? h : { default: h }; } function d(h) { if (typeof WeakMap != "function") return null; var s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(); return (d = function(u) { return u ? a : s; })(h); } function y(h, s) { if (h && h.__esModule) return h; if (h === null || typeof h != "object" && typeof h != "function") return { default: h }; var a = d(s); if (a && a.has(h)) return a.get(h); var u = {}, b = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var l in h) if (l !== "default" && Object.prototype.hasOwnProperty.call(h, l)) { var g = b ? Object.getOwnPropertyDescriptor(h, l) : null; g && (g.get || g.set) ? Object.defineProperty(u, l, g) : u[l] = h[l]; } return u.default = h, a && a.set(h, u), u; } function p(h, s, a) { return s = C(s), s in h ? Object.defineProperty(h, s, { value: a, enumerable: !0, configurable: !0, writable: !0 }) : h[s] = a, h; } function C(h) { var s = _(h, "string"); return typeof s == "symbol" ? s : String(s); } function _(h, s) { if (typeof h != "object" || h === null) return h; var a = h[Symbol.toPrimitive]; if (a !== void 0) { var u = a.call(h, s || "default"); if (typeof u != "object") return u; throw new TypeError("@@toPrimitive must return a primitive value."); } return (s === "string" ? String : Number)(h); } const w = { touch: { start: "touchstart", move: "touchmove", stop: "touchend" }, mouse: { start: "mousedown", move: "mousemove", stop: "mouseup" } }; let S = w.mouse, R = class extends t.Component { constructor() { super(...arguments), p(this, "dragging", !1), p(this, "lastX", NaN), p(this, "lastY", NaN), p(this, "touchIdentifier", null), p(this, "mounted", !1), p(this, "handleDragStart", (s) => { if (this.props.onMouseDown(s), !this.props.allowAnyClick && typeof s.button == "number" && s.button !== 0) return !1; const a = this.findDOMNode(); if (!a || !a.ownerDocument || !a.ownerDocument.body) throw new Error(" not mounted on DragStart!"); const { ownerDocument: u } = a; if (this.props.disabled || !(s.target instanceof u.defaultView.Node) || this.props.handle && !(0, n.matchesSelectorAndParentsTo)(s.target, this.props.handle, a) || this.props.cancel && (0, n.matchesSelectorAndParentsTo)(s.target, this.props.cancel, a)) return; s.type === "touchstart" && s.preventDefault(); const b = (0, n.getTouchIdentifier)(s); this.touchIdentifier = b; const l = (0, i.getControlPosition)(s, b, this); if (l == null) return; const { x: g, y: f } = l, m = (0, i.createCoreData)(this, g, f); (0, c.default)("DraggableCore: handleDragStart: %j", m), (0, c.default)("calling", this.props.onStart), !(this.props.onStart(s, m) === !1 || this.mounted === !1) && (this.props.enableUserSelectHack && (0, n.addUserSelectStyles)(u), this.dragging = !0, this.lastX = g, this.lastY = f, (0, n.addEvent)(u, S.move, this.handleDrag), (0, n.addEvent)(u, S.stop, this.handleDragStop)); }), p(this, "handleDrag", (s) => { const a = (0, i.getControlPosition)(s, this.touchIdentifier, this); if (a == null) return; let { x: u, y: b } = a; if (Array.isArray(this.props.grid)) { let f = u - this.lastX, m = b - this.lastY; if ([f, m] = (0, i.snapToGrid)(this.props.grid, f, m), !f && !m) return; u = this.lastX + f, b = this.lastY + m; } const l = (0, i.createCoreData)(this, u, b); if ((0, c.default)("DraggableCore: handleDrag: %j", l), this.props.onDrag(s, l) === !1 || this.mounted === !1) { try { this.handleDragStop(new MouseEvent("mouseup")); } catch { const m = document.createEvent("MouseEvents"); m.initMouseEvent("mouseup", !0, !0, window, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null), this.handleDragStop(m); } return; } this.lastX = u, this.lastY = b; }), p(this, "handleDragStop", (s) => { if (!this.dragging) return; const a = (0, i.getControlPosition)(s, this.touchIdentifier, this); if (a == null) return; let { x: u, y: b } = a; if (Array.isArray(this.props.grid)) { let m = u - this.lastX || 0, P = b - this.lastY || 0; [m, P] = (0, i.snapToGrid)(this.props.grid, m, P), u = this.lastX + m, b = this.lastY + P; } const l = (0, i.createCoreData)(this, u, b); if (this.props.onStop(s, l) === !1 || this.mounted === !1) return !1; const f = this.findDOMNode(); f && this.props.enableUserSelectHack && (0, n.removeUserSelectStyles)(f.ownerDocument), (0, c.default)("DraggableCore: handleDragStop: %j", l), this.dragging = !1, this.lastX = NaN, this.lastY = NaN, f && ((0, c.default)("DraggableCore: Removing handlers"), (0, n.removeEvent)(f.ownerDocument, S.move, this.handleDrag), (0, n.removeEvent)(f.ownerDocument, S.stop, this.handleDragStop)); }), p(this, "onMouseDown", (s) => (S = w.mouse, this.handleDragStart(s))), p(this, "onMouseUp", (s) => (S = w.mouse, this.handleDragStop(s))), p(this, "onTouchStart", (s) => (S = w.touch, this.handleDragStart(s))), p(this, "onTouchEnd", (s) => (S = w.touch, this.handleDragStop(s))); } componentDidMount() { this.mounted = !0; const s = this.findDOMNode(); s && (0, n.addEvent)(s, w.touch.start, this.onTouchStart, { passive: !1 }); } componentWillUnmount() { this.mounted = !1; const s = this.findDOMNode(); if (s) { const { ownerDocument: a } = s; (0, n.removeEvent)(a, w.mouse.move, this.handleDrag), (0, n.removeEvent)(a, w.touch.move, this.handleDrag), (0, n.removeEvent)(a, w.mouse.stop, this.handleDragStop), (0, n.removeEvent)(a, w.touch.stop, this.handleDragStop), (0, n.removeEvent)(s, w.touch.start, this.onTouchStart, { passive: !1 }), this.props.enableUserSelectHack && (0, n.removeUserSelectStyles)(a); } } // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find // the underlying DOM node ourselves. See the README for more information. findDOMNode() { var s, a; return (s = this.props) !== null && s !== void 0 && s.nodeRef ? (a = this.props) === null || a === void 0 || (a = a.nodeRef) === null || a === void 0 ? void 0 : a.current : r.default.findDOMNode(this); } render() { return /* @__PURE__ */ t.cloneElement(t.Children.only(this.props.children), { // Note: mouseMove handler is attached to document so it will still function // when the user drags quickly and leaves the bounds of the element. onMouseDown: this.onMouseDown, onMouseUp: this.onMouseUp, // onTouchStart is added on `componentDidMount` so they can be added with // {passive: false}, which allows it to cancel. See // https://developers.google.com/web/updates/2017/01/scrolling-intervention onTouchEnd: this.onTouchEnd }); } }; return It.default = R, p(R, "displayName", "DraggableCore"), p(R, "propTypes", { /** * `allowAnyClick` allows dragging using any mouse button. * By default, we only accept the left button. * * Defaults to `false`. */ allowAnyClick: e.default.bool, children: e.default.node.isRequired, /** * `disabled`, if true, stops the from dragging. All handlers, * with the exception of `onMouseDown`, will not fire. */ disabled: e.default.bool, /** * By default, we add 'user-select:none' attributes to the document body * to prevent ugly text selection during drag. If this is causing problems * for your app, set this to `false`. */ enableUserSelectHack: e.default.bool, /** * `offsetParent`, if set, uses the passed DOM node to compute drag offsets * instead of using the parent node. */ offsetParent: function(h, s) { if (h[s] && h[s].nodeType !== 1) throw new Error("Draggable's offsetParent must be a DOM Node."); }, /** * `grid` specifies the x and y that dragging should snap to. */ grid: e.default.arrayOf(e.default.number), /** * `handle` specifies a selector to be used as the handle that initiates drag. * * Example: * * ```jsx * let App = React.createClass({ * render: function () { * return ( * *
*
Click me to drag
*
This is some other content
*
*
* ); * } * }); * ``` */ handle: e.default.string, /** * `cancel` specifies a selector to be used to prevent drag initialization. * * Example: * * ```jsx * let App = React.createClass({ * render: function () { * return( * *
*
You can't drag from here
*
Dragging here works fine
*
*
* ); * } * }); * ``` */ cancel: e.default.string, /* If running in React Strict mode, ReactDOM.findDOMNode() is deprecated. * Unfortunately, in order for to work properly, we need raw access * to the underlying DOM node. If you want to avoid the warning, pass a `nodeRef` * as in this example: * * function MyComponent() { * const nodeRef = React.useRef(null); * return ( * *
Example Target
*
* ); * } * * This can be used for arbitrarily nested components, so long as the ref ends up * pointing to the actual child DOM node and not a custom component. */ nodeRef: e.default.object, /** * Called when dragging starts. * If this function returns the boolean false, dragging will be canceled. */ onStart: e.default.func, /** * Called while dragging. * If this function returns the boolean false, dragging will be canceled. */ onDrag: e.default.func, /** * Called when dragging stops. * If this function returns the boolean false, the drag will remain active. */ onStop: e.default.func, /** * A workaround option which can be passed if onMouseDown needs to be accessed, * since it'll always be blocked (as there is internal use of onMouseDown) */ onMouseDown: e.default.func, /** * `scale`, if set, applies scaling while dragging an element */ scale: e.default.number, /** * These properties should be defined on the child, not here. */ className: o.dontSetMe, style: o.dontSetMe, transform: o.dontSetMe }), p(R, "defaultProps", { allowAnyClick: !1, // by default only accept left click disabled: !1, enableUserSelectHack: !0, onStart: function() { }, onDrag: function() { }, onStop: function() { }, onMouseDown: function() { }, scale: 1 }), It; } var qr; function Ks() { return qr || (qr = 1, function(t) { Object.defineProperty(t, "__esModule", { value: !0 }), Object.defineProperty(t, "DraggableCore", { enumerable: !0, get: function() { return d.default; } }), t.default = void 0; var e = _(Le), r = p(/* @__PURE__ */ Qe()), n = p(Pi), i = p(Gs), o = hr(), c = Bi(), v = Mn(), d = p(Ys()), y = p(Gi()); function p(a) { return a && a.__esModule ? a : { default: a }; } function C(a) { if (typeof WeakMap != "function") return null; var u = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(); return (C = function(l) { return l ? b : u; })(a); } function _(a, u) { if (a && a.__esModule) return a; if (a === null || typeof a != "object" && typeof a != "function") return { default: a }; var b = C(u); if (b && b.has(a)) return b.get(a); var l = {}, g = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var f in a) if (f !== "default" && Object.prototype.hasOwnProperty.call(a, f)) { var m = g ? Object.getOwnPropertyDescriptor(a, f) : null; m && (m.get || m.set) ? Object.defineProperty(l, f, m) : l[f] = a[f]; } return l.default = a, b && b.set(a, l), l; } function w() { return w = Object.assign ? Object.assign.bind() : function(a) { for (var u = 1; u < arguments.length; u++) { var b = arguments[u]; for (var l in b) Object.prototype.hasOwnProperty.call(b, l) && (a[l] = b[l]); } return a; }, w.apply(this, arguments); } function S(a, u, b) { return u = R(u), u in a ? Object.defineProperty(a, u, { value: b, enumerable: !0, configurable: !0, writable: !0 }) : a[u] = b, a; } function R(a) { var u = h(a, "string"); return typeof u == "symbol" ? u : String(u); } function h(a, u) { if (typeof a != "object" || a === null) return a; var b = a[Symbol.toPrimitive]; if (b !== void 0) { var l = b.call(a, u || "default"); if (typeof l != "object") return l; throw new TypeError("@@toPrimitive must return a primitive value."); } return (u === "string" ? String : Number)(a); } class s extends e.Component { // React 16.3+ // Arity (props, state) static getDerivedStateFromProps(u, b) { let { position: l } = u, { prevPropsPosition: g } = b; return l && (!g || l.x !== g.x || l.y !== g.y) ? ((0, y.default)("Draggable: getDerivedStateFromProps %j", { position: l, prevPropsPosition: g }), { x: l.x, y: l.y, prevPropsPosition: { ...l } }) : null; } constructor(u) { super(u), S(this, "onDragStart", (b, l) => { if ((0, y.default)("Draggable: onDragStart: %j", l), this.props.onStart(b, (0, c.createDraggableData)(this, l)) === !1) return !1; this.setState({ dragging: !0, dragged: !0 }); }), S(this, "onDrag", (b, l) => { if (!this.state.dragging) return !1; (0, y.default)("Draggable: onDrag: %j", l); const g = (0, c.createDraggableData)(this, l), f = { x: g.x, y: g.y, slackX: 0, slackY: 0 }; if (this.props.bounds) { const { x: P, y: M } = f; f.x += this.state.slackX, f.y += this.state.slackY; const [j, N] = (0, c.getBoundPosition)(this, f.x, f.y); f.x = j, f.y = N, f.slackX = this.state.slackX + (P - f.x), f.slackY = this.state.slackY + (M - f.y), g.x = f.x, g.y = f.y, g.deltaX = f.x - this.state.x, g.deltaY = f.y - this.state.y; } if (this.props.onDrag(b, g) === !1) return !1; this.setState(f); }), S(this, "onDragStop", (b, l) => { if (!this.state.dragging || this.props.onStop(b, (0, c.createDraggableData)(this, l)) === !1) return !1; (0, y.default)("Draggable: onDragStop: %j", l); const f = { dragging: !1, slackX: 0, slackY: 0 }; if (!!this.props.position) { const { x: P, y: M } = this.props.position; f.x = P, f.y = M; } this.setState(f); }), this.state = { // Whether or not we are currently dragging. dragging: !1, // Whether or not we have been dragged before. dragged: !1, // Current transform x and y. x: u.position ? u.position.x : u.defaultPosition.x, y: u.position ? u.position.y : u.defaultPosition.y, prevPropsPosition: { ...u.position }, // Used for compensating for out-of-bounds drags slackX: 0, slackY: 0, // Can only determine if SVG after mounting isElementSVG: !1 }, u.position && !(u.onDrag || u.onStop) && console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element."); } componentDidMount() { typeof window.SVGElement < "u" && this.findDOMNode() instanceof window.SVGElement && this.setState({ isElementSVG: !0 }); } componentWillUnmount() { this.setState({ dragging: !1 }); } // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find // the underlying DOM node ourselves. See the README for more information. findDOMNode() { var u, b; return (u = (b = this.props) === null || b === void 0 || (b = b.nodeRef) === null || b === void 0 ? void 0 : b.current) !== null && u !== void 0 ? u : n.default.findDOMNode(this); } render() { const { axis: u, bounds: b, children: l, defaultPosition: g, defaultClassName: f, defaultClassNameDragging: m, defaultClassNameDragged: P, position: M, positionOffset: j, scale: N, ...I } = this.props; let O = {}, z = null; const k = !!!M || this.state.dragging, ie = M || g, ee = { // Set left if horizontal drag is enabled x: (0, c.canDragX)(this) && k ? this.state.x : ie.x, // Set top if vertical drag is enabled y: (0, c.canDragY)(this) && k ? this.state.y : ie.y }; this.state.isElementSVG ? z = (0, o.createSVGTransform)(ee, j) : O = (0, o.createCSSTransform)(ee, j); const A = (0, i.default)(l.props.className || "", f, { [m]: this.state.dragging, [P]: this.state.dragged }); return /* @__PURE__ */ e.createElement(d.default, w({}, I, { onStart: this.onDragStart, onDrag: this.onDrag, onStop: this.onDragStop }), /* @__PURE__ */ e.cloneElement(e.Children.only(l), { className: A, style: { ...l.props.style, ...O }, transform: z })); } } t.default = s, S(s, "displayName", "Draggable"), S(s, "propTypes", { // Accepts all props accepts. ...d.default.propTypes, /** * `axis` determines which axis the draggable can move. * * Note that all callbacks will still return data as normal. This only * controls flushing to the DOM. * * 'both' allows movement horizontally and vertically. * 'x' limits movement to horizontal axis. * 'y' limits movement to vertical axis. * 'none' limits all movement. * * Defaults to 'both'. */ axis: r.default.oneOf(["both", "x", "y", "none"]), /** * `bounds` determines the range of movement available to the element. * Available values are: * * 'parent' restricts movement within the Draggable's parent node. * * Alternatively, pass an object with the following properties, all of which are optional: * * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND} * * All values are in px. * * Example: * * ```jsx * let App = React.createClass({ * render: function () { * return ( * *
Content
*
* ); * } * }); * ``` */ bounds: r.default.oneOfType([r.default.shape({ left: r.default.number, right: r.default.number, top: r.default.number, bottom: r.default.number }), r.default.string, r.default.oneOf([!1])]), defaultClassName: r.default.string, defaultClassNameDragging: r.default.string, defaultClassNameDragged: r.default.string, /** * `defaultPosition` specifies the x and y that the dragged item should start at * * Example: * * ```jsx * let App = React.createClass({ * render: function () { * return ( * *
I start with transformX: 25px and transformY: 25px;
*
* ); * } * }); * ``` */ defaultPosition: r.default.shape({ x: r.default.number, y: r.default.number }), positionOffset: r.default.shape({ x: r.default.oneOfType([r.default.number, r.default.string]), y: r.default.oneOfType([r.default.number, r.default.string]) }), /** * `position`, if present, defines the current position of the element. * * This is similar to how form elements in React work - if no `position` is supplied, the component * is uncontrolled. * * Example: * * ```jsx * let App = React.createClass({ * render: function () { * return ( * *
I start with transformX: 25px and transformY: 25px;
*
* ); * } * }); * ``` */ position: r.default.shape({ x: r.default.number, y: r.default.number }), /** * These properties should be defined on the child, not here. */ className: v.dontSetMe, style: v.dontSetMe, transform: v.dontSetMe }), S(s, "defaultProps", { ...d.default.defaultProps, axis: "both", bounds: !1, defaultClassName: "react-draggable", defaultClassNameDragging: "react-draggable-dragging", defaultClassNameDragged: "react-draggable-dragged", defaultPosition: { x: 0, y: 0 }, scale: 1 }); }(Bn)), Bn; } var Ar; function pr() { if (Ar) return xt.exports; Ar = 1; const { default: t, DraggableCore: e } = Ks(); return xt.exports = t, xt.exports.default = t, xt.exports.DraggableCore = e, xt.exports; } var Et = { exports: {} }, Tt = {}, tn = {}, Wr; function Zs() { if (Wr) return tn; Wr = 1, tn.__esModule = !0, tn.cloneElement = v; var t = e(Le); function e(d) { return d && d.__esModule ? d : { default: d }; } function r(d, y) { var p = Object.keys(d); if (Object.getOwnPropertySymbols) { var C = Object.getOwnPropertySymbols(d); y && (C = C.filter(function(_) { return Object.getOwnPropertyDescriptor(d, _).enumerable; })), p.push.apply(p, C); } return p; } function n(d) { for (var y = 1; y < arguments.length; y++) { var p = arguments[y] != null ? arguments[y] : {}; y % 2 ? r(Object(p), !0).forEach(function(C) { i(d, C, p[C]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(d, Object.getOwnPropertyDescriptors(p)) : r(Object(p)).forEach(function(C) { Object.defineProperty(d, C, Object.getOwnPropertyDescriptor(p, C)); }); } return d; } function i(d, y, p) { return y = o(y), y in d ? Object.defineProperty(d, y, { value: p, enumerable: !0, configurable: !0, writable: !0 }) : d[y] = p, d; } function o(d) { var y = c(d, "string"); return typeof y == "symbol" ? y : String(y); } function c(d, y) { if (typeof d != "object" || d === null) return d; var p = d[Symbol.toPrimitive]; if (p !== void 0) { var C = p.call(d, y || "default"); if (typeof C != "object") return C; throw new TypeError("@@toPrimitive must return a primitive value."); } return (y === "string" ? String : Number)(d); } function v(d, y) { return y.style && d.props.style && (y.style = n(n({}, d.props.style), y.style)), y.className && d.props.className && (y.className = d.props.className + " " + y.className), /* @__PURE__ */ t.default.cloneElement(d, y); } return tn; } var Pt = {}, Hr; function Xi() { if (Hr) return Pt; Hr = 1, Pt.__esModule = !0, Pt.resizableProps = void 0; var t = e(/* @__PURE__ */ Qe()); pr(); function e(n) { return n && n.__esModule ? n : { default: n }; } var r = { /* * Restricts resizing to a particular axis (default: 'both') * 'both' - allows resizing by width or height * 'x' - only allows the width to be changed * 'y' - only allows the height to be changed * 'none' - disables resizing altogether * */ axis: t.default.oneOf(["both", "x", "y", "none"]), className: t.default.string, /* * Require that one and only one child be present. * */ children: t.default.element.isRequired, /* * These will be passed wholesale to react-draggable's DraggableCore * */ draggableOpts: t.default.shape({ allowAnyClick: t.default.bool, cancel: t.default.string, children: t.default.node, disabled: t.default.bool, enableUserSelectHack: t.default.bool, offsetParent: t.default.node, grid: t.default.arrayOf(t.default.number), handle: t.default.string, nodeRef: t.default.object, onStart: t.default.func, onDrag: t.default.func, onStop: t.default.func, onMouseDown: t.default.func, scale: t.default.number }), /* * Initial height * */ height: function() { for (var i = arguments.length, o = new Array(i), c = 0; c < i; c++) o[c] = arguments[c]; var v = o[0]; if (v.axis === "both" || v.axis === "y") { var d; return (d = t.default.number).isRequired.apply(d, o); } return t.default.number.apply(t.default, o); }, /* * Customize cursor resize handle * */ handle: t.default.oneOfType([t.default.node, t.default.func]), /* * If you change this, be sure to update your css * */ handleSize: t.default.arrayOf(t.default.number), lockAspectRatio: t.default.bool, /* * Max X & Y measure * */ maxConstraints: t.default.arrayOf(t.default.number), /* * Min X & Y measure * */ minConstraints: t.default.arrayOf(t.default.number), /* * Called on stop resize event * */ onResizeStop: t.default.func, /* * Called on start resize event * */ onResizeStart: t.default.func, /* * Called on resize event * */ onResize: t.default.func, /* * Defines which resize handles should be rendered (default: 'se') * 's' - South handle (bottom-center) * 'w' - West handle (left-center) * 'e' - East handle (right-center) * 'n' - North handle (top-center) * 'sw' - Southwest handle (bottom-left) * 'nw' - Northwest handle (top-left) * 'se' - Southeast handle (bottom-right) * 'ne' - Northeast handle (top-center) * */ resizeHandles: t.default.arrayOf(t.default.oneOf(["s", "w", "e", "n", "sw", "nw", "se", "ne"])), /* * If `transform: scale(n)` is set on the parent, this should be set to `n`. * */ transformScale: t.default.number, /* * Initial width */ width: function() { for (var i = arguments.length, o = new Array(i), c = 0; c < i; c++) o[c] = arguments[c]; var v = o[0]; if (v.axis === "both" || v.axis === "x") { var d; return (d = t.default.number).isRequired.apply(d, o); } return t.default.number.apply(t.default, o); } }; return Pt.resizableProps = r, Pt; } var Ur; function Yi() { if (Ur) return Tt; Ur = 1, Tt.__esModule = !0, Tt.default = void 0; var t = c(Le), e = pr(), r = Zs(), n = Xi(), i = ["children", "className", "draggableOpts", "width", "height", "handle", "handleSize", "lockAspectRatio", "axis", "minConstraints", "maxConstraints", "onResize", "onResizeStop", "onResizeStart", "resizeHandles", "transformScale"]; function o(s) { if (typeof WeakMap != "function") return null; var a = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(); return (o = function(l) { return l ? u : a; })(s); } function c(s, a) { if (s && s.__esModule) return s; if (s === null || typeof s != "object" && typeof s != "function") return { default: s }; var u = o(a); if (u && u.has(s)) return u.get(s); var b = {}, l = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var g in s) if (g !== "default" && Object.prototype.hasOwnProperty.call(s, g)) { var f = l ? Object.getOwnPropertyDescriptor(s, g) : null; f && (f.get || f.set) ? Object.defineProperty(b, g, f) : b[g] = s[g]; } return b.default = s, u && u.set(s, b), b; } function v() { return v = Object.assign ? Object.assign.bind() : function(s) { for (var a = 1; a < arguments.length; a++) { var u = arguments[a]; for (var b in u) Object.prototype.hasOwnProperty.call(u, b) && (s[b] = u[b]); } return s; }, v.apply(this, arguments); } function d(s, a) { if (s == null) return {}; var u = {}, b = Object.keys(s), l, g; for (g = 0; g < b.length; g++) l = b[g], !(a.indexOf(l) >= 0) && (u[l] = s[l]); return u; } function y(s, a) { var u = Object.keys(s); if (Object.getOwnPropertySymbols) { var b = Object.getOwnPropertySymbols(s); a && (b = b.filter(function(l) { return Object.getOwnPropertyDescriptor(s, l).enumerable; })), u.push.apply(u, b); } return u; } function p(s) { for (var a = 1; a < arguments.length; a++) { var u = arguments[a] != null ? arguments[a] : {}; a % 2 ? y(Object(u), !0).forEach(function(b) { C(s, b, u[b]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(u)) : y(Object(u)).forEach(function(b) { Object.defineProperty(s, b, Object.getOwnPropertyDescriptor(u, b)); }); } return s; } function C(s, a, u) { return a = _(a), a in s ? Object.defineProperty(s, a, { value: u, enumerable: !0, configurable: !0, writable: !0 }) : s[a] = u, s; } function _(s) { var a = w(s, "string"); return typeof a == "symbol" ? a : String(a); } function w(s, a) { if (typeof s != "object" || s === null) return s; var u = s[Symbol.toPrimitive]; if (u !== void 0) { var b = u.call(s, a || "default"); if (typeof b != "object") return b; throw new TypeError("@@toPrimitive must return a primitive value."); } return (a === "string" ? String : Number)(s); } function S(s, a) { s.prototype = Object.create(a.prototype), s.prototype.constructor = s, R(s, a); } function R(s, a) { return R = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(b, l) { return b.__proto__ = l, b; }, R(s, a); } var h = /* @__PURE__ */ function(s) { S(a, s); function a() { for (var b, l = arguments.length, g = new Array(l), f = 0; f < l; f++) g[f] = arguments[f]; return b = s.call.apply(s, [this].concat(g)) || this, b.handleRefs = {}, b.lastHandleRect = null, b.slack = null, b; } var u = a.prototype; return u.componentWillUnmount = function() { this.resetData(); }, u.resetData = function() { this.lastHandleRect = this.slack = null; }, u.runConstraints = function(l, g) { var f = this.props, m = f.minConstraints, P = f.maxConstraints, M = f.lockAspectRatio; if (!m && !P && !M) return [l, g]; if (M) { var j = this.props.width / this.props.height, N = l - this.props.width, I = g - this.props.height; Math.abs(N) > Math.abs(I * j) ? g = l / j : l = g * j; } var O = l, z = g, U = this.slack || [0, 0], k = U[0], ie = U[1]; return l += k, g += ie, m && (l = Math.max(m[0], l), g = Math.max(m[1], g)), P && (l = Math.min(P[0], l), g = Math.min(P[1], g)), this.slack = [k + (O - l), ie + (z - g)], [l, g]; }, u.resizeHandler = function(l, g) { var f = this; return function(m, P) { var M = P.node, j = P.deltaX, N = P.deltaY; l === "onResizeStart" && f.resetData(); var I = (f.props.axis === "both" || f.props.axis === "x") && g !== "n" && g !== "s", O = (f.props.axis === "both" || f.props.axis === "y") && g !== "e" && g !== "w"; if (!(!I && !O)) { var z = g[0], U = g[g.length - 1], k = M.getBoundingClientRect(); if (f.lastHandleRect != null) { if (U === "w") { var ie = k.left - f.lastHandleRect.left; j += ie; } if (z === "n") { var ee = k.top - f.lastHandleRect.top; N += ee; } } f.lastHandleRect = k, U === "w" && (j = -j), z === "n" && (N = -N); var A = f.props.width + (I ? j / f.props.transformScale : 0), F = f.props.height + (O ? N / f.props.transformScale : 0), oe = f.runConstraints(A, F); A = oe[0], F = oe[1]; var se = A !== f.props.width || F !== f.props.height, de = typeof f.props[l] == "function" ? f.props[l] : null, ye = l === "onResize" && !se; de && !ye && (m.persist == null || m.persist(), de(m, { node: M, size: { width: A, height: F }, handle: g })), l === "onResizeStop" && f.resetData(); } }; }, u.renderResizeHandle = function(l, g) { var f = this.props.handle; if (!f) return /* @__PURE__ */ t.createElement("span", { className: "react-resizable-handle react-resizable-handle-" + l, ref: g }); if (typeof f == "function") return f(l, g); var m = typeof f.type == "string", P = p({ ref: g }, m ? {} : { handleAxis: l }); return /* @__PURE__ */ t.cloneElement(f, P); }, u.render = function() { var l = this, g = this.props, f = g.children, m = g.className, P = g.draggableOpts; g.width, g.height, g.handle, g.handleSize, g.lockAspectRatio, g.axis, g.minConstraints, g.maxConstraints, g.onResize, g.onResizeStop, g.onResizeStart; var M = g.resizeHandles; g.transformScale; var j = d(g, i); return (0, r.cloneElement)(f, p(p({}, j), {}, { className: (m ? m + " " : "") + "react-resizable", children: [].concat(f.props.children, M.map(function(N) { var I, O = (I = l.handleRefs[N]) != null ? I : l.handleRefs[N] = /* @__PURE__ */ t.createRef(); return /* @__PURE__ */ t.createElement(e.DraggableCore, v({}, P, { nodeRef: O, key: "resizableHandle-" + N, onStop: l.resizeHandler("onResizeStop", N), onStart: l.resizeHandler("onResizeStart", N), onDrag: l.resizeHandler("onResize", N) }), l.renderResizeHandle(N, O)); })) })); }, a; }(t.Component); return Tt.default = h, h.propTypes = n.resizableProps, h.defaultProps = { axis: "both", handleSize: [20, 20], lockAspectRatio: !1, minConstraints: [20, 20], maxConstraints: [1 / 0, 1 / 0], resizeHandles: ["se"], transformScale: 1 }, Tt; } var Ot = {}, kr; function Js() { if (kr) return Ot; kr = 1, Ot.__esModule = !0, Ot.default = void 0; var t = v(Le), e = o(/* @__PURE__ */ Qe()), r = o(Yi()), n = Xi(), i = ["handle", "handleSize", "onResize", "onResizeStart", "onResizeStop", "draggableOpts", "minConstraints", "maxConstraints", "lockAspectRatio", "axis", "width", "height", "resizeHandles", "style", "transformScale"]; function o(a) { return a && a.__esModule ? a : { default: a }; } function c(a) { if (typeof WeakMap != "function") return null; var u = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(); return (c = function(g) { return g ? b : u; })(a); } function v(a, u) { if (a && a.__esModule) return a; if (a === null || typeof a != "object" && typeof a != "function") return { default: a }; var b = c(u); if (b && b.has(a)) return b.get(a); var l = {}, g = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var f in a) if (f !== "default" && Object.prototype.hasOwnProperty.call(a, f)) { var m = g ? Object.getOwnPropertyDescriptor(a, f) : null; m && (m.get || m.set) ? Object.defineProperty(l, f, m) : l[f] = a[f]; } return l.default = a, b && b.set(a, l), l; } function d() { return d = Object.assign ? Object.assign.bind() : function(a) { for (var u = 1; u < arguments.length; u++) { var b = arguments[u]; for (var l in b) Object.prototype.hasOwnProperty.call(b, l) && (a[l] = b[l]); } return a; }, d.apply(this, arguments); } function y(a, u) { var b = Object.keys(a); if (Object.getOwnPropertySymbols) { var l = Object.getOwnPropertySymbols(a); u && (l = l.filter(function(g) { return Object.getOwnPropertyDescriptor(a, g).enumerable; })), b.push.apply(b, l); } return b; } function p(a) { for (var u = 1; u < arguments.length; u++) { var b = arguments[u] != null ? arguments[u] : {}; u % 2 ? y(Object(b), !0).forEach(function(l) { C(a, l, b[l]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(b)) : y(Object(b)).forEach(function(l) { Object.defineProperty(a, l, Object.getOwnPropertyDescriptor(b, l)); }); } return a; } function C(a, u, b) { return u = _(u), u in a ? Object.defineProperty(a, u, { value: b, enumerable: !0, configurable: !0, writable: !0 }) : a[u] = b, a; } function _(a) { var u = w(a, "string"); return typeof u == "symbol" ? u : String(u); } function w(a, u) { if (typeof a != "object" || a === null) return a; var b = a[Symbol.toPrimitive]; if (b !== void 0) { var l = b.call(a, u || "default"); if (typeof l != "object") return l; throw new TypeError("@@toPrimitive must return a primitive value."); } return (u === "string" ? String : Number)(a); } function S(a, u) { if (a == null) return {}; var b = {}, l = Object.keys(a), g, f; for (f = 0; f < l.length; f++) g = l[f], !(u.indexOf(g) >= 0) && (b[g] = a[g]); return b; } function R(a, u) { a.prototype = Object.create(u.prototype), a.prototype.constructor = a, h(a, u); } function h(a, u) { return h = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, g) { return l.__proto__ = g, l; }, h(a, u); } var s = /* @__PURE__ */ function(a) { R(u, a); function u() { for (var l, g = arguments.length, f = new Array(g), m = 0; m < g; m++) f[m] = arguments[m]; return l = a.call.apply(a, [this].concat(f)) || this, l.state = { width: l.props.width, height: l.props.height, propsWidth: l.props.width, propsHeight: l.props.height }, l.onResize = function(P, M) { var j = M.size; l.props.onResize ? (P.persist == null || P.persist(), l.setState(j, function() { return l.props.onResize && l.props.onResize(P, M); })) : l.setState(j); }, l; } u.getDerivedStateFromProps = function(g, f) { return f.propsWidth !== g.width || f.propsHeight !== g.height ? { width: g.width, height: g.height, propsWidth: g.width, propsHeight: g.height } : null; }; var b = u.prototype; return b.render = function() { var g = this.props, f = g.handle, m = g.handleSize; g.onResize; var P = g.onResizeStart, M = g.onResizeStop, j = g.draggableOpts, N = g.minConstraints, I = g.maxConstraints, O = g.lockAspectRatio, z = g.axis; g.width, g.height; var U = g.resizeHandles, k = g.style, ie = g.transformScale, ee = S(g, i); return /* @__PURE__ */ t.createElement(r.default, { axis: z, draggableOpts: j, handle: f, handleSize: m, height: this.state.height, lockAspectRatio: O, maxConstraints: I, minConstraints: N, onResizeStart: P, onResize: this.onResize, onResizeStop: M, resizeHandles: U, transformScale: ie, width: this.state.width }, /* @__PURE__ */ t.createElement("div", d({}, ee, { style: p(p({}, k), {}, { width: this.state.width + "px", height: this.state.height + "px" }) }))); }, u; }(t.Component); return Ot.default = s, s.propTypes = p(p({}, n.resizableProps), {}, { children: e.default.element }), Ot; } var Br; function Qs() { return Br || (Br = 1, Et.exports = function() { throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable"); }, Et.exports.Resizable = Yi().default, Et.exports.ResizableBox = Js().default), Et.exports; } var Ue = {}, Gr; function Ki() { if (Gr) return Ue; Gr = 1, Object.defineProperty(Ue, "__esModule", { value: !0 }), Ue.resizeHandleType = Ue.resizeHandleAxesType = Ue.default = void 0; var t = r(/* @__PURE__ */ Qe()), e = r(Le); function r(o) { return o && o.__esModule ? o : { default: o }; } const n = Ue.resizeHandleAxesType = t.default.arrayOf(t.default.oneOf(["s", "w", "e", "n", "sw", "nw", "se", "ne"])), i = Ue.resizeHandleType = t.default.oneOfType([t.default.node, t.default.func]); return Ue.default = { // // Basic props // className: t.default.string, style: t.default.object, // This can be set explicitly. If it is not set, it will automatically // be set to the container width. Note that resizes will *not* cause this to adjust. // If you need that behavior, use WidthProvider. width: t.default.number, // If true, the container height swells and contracts to fit contents autoSize: t.default.bool, // # of cols. cols: t.default.number, // A selector that will not be draggable. draggableCancel: t.default.string, // A selector for the draggable handler draggableHandle: t.default.string, // Deprecated verticalCompact: function(o) { o.verticalCompact; }, // Choose vertical or hotizontal compaction compactType: t.default.oneOf(["vertical", "horizontal"]), // layout is an array of object with the format: // {x: Number, y: Number, w: Number, h: Number, i: String} layout: function(o) { var c = o.layout; c !== void 0 && St().validateLayout(c, "layout"); }, // // Grid Dimensions // // Margin between items [x, y] in px margin: t.default.arrayOf(t.default.number), // Padding inside the container [x, y] in px containerPadding: t.default.arrayOf(t.default.number), // Rows have a static height, but you can change this based on breakpoints if you like rowHeight: t.default.number, // Default Infinity, but you can specify a max here if you like. // Note that this isn't fully fleshed out and won't error if you specify a layout that // extends beyond the row capacity. It will, however, not allow users to drag/resize // an item past the barrier. They can push items beyond the barrier, though. // Intentionally not documented for this reason. maxRows: t.default.number, // // Flags // isBounded: t.default.bool, isDraggable: t.default.bool, isResizable: t.default.bool, // If true, grid can be placed one over the other. allowOverlap: t.default.bool, // If true, grid items won't change position when being dragged over. preventCollision: t.default.bool, // Use CSS transforms instead of top/left useCSSTransforms: t.default.bool, // parent layout transform scale transformScale: t.default.number, // If true, an external element can trigger onDrop callback with a specific grid position as a parameter isDroppable: t.default.bool, // Resize handle options resizeHandles: n, resizeHandle: i, // // Callbacks // // Callback so you can save the layout. Calls after each drag & resize stops. onLayoutChange: t.default.func, // Calls when drag starts. Callback is of the signature (layout, oldItem, newItem, placeholder, e, ?node). // All callbacks below have the same signature. 'start' and 'stop' callbacks omit the 'placeholder'. onDragStart: t.default.func, // Calls on each drag movement. onDrag: t.default.func, // Calls when drag is complete. onDragStop: t.default.func, //Calls when resize starts. onResizeStart: t.default.func, // Calls when resize movement happens. onResize: t.default.func, // Calls when resize is complete. onResizeStop: t.default.func, // Calls when some element is dropped. onDrop: t.default.func, // // Other validations // droppingItem: t.default.shape({ i: t.default.string.isRequired, w: t.default.number.isRequired, h: t.default.number.isRequired }), // Children must not have duplicate keys. children: function(o, c) { const v = o[c], d = {}; e.default.Children.forEach(v, function(y) { if ((y == null ? void 0 : y.key) != null) { if (d[y.key]) throw new Error('Duplicate child key "' + y.key + '" found! This will cause problems in ReactGridLayout.'); d[y.key] = !0; } }); }, // Optional ref for getting a reference for the wrapping div. innerRef: t.default.any }, Ue; } var Xr; function ea() { if (Xr) return _t; Xr = 1, Object.defineProperty(_t, "__esModule", { value: !0 }), _t.default = void 0; var t = d(Le), e = d(/* @__PURE__ */ Qe()), r = pr(), n = Qs(), i = St(), o = fr(), c = Ki(), v = d(dr()); function d(w) { return w && w.__esModule ? w : { default: w }; } function y(w, S, R) { return S = p(S), S in w ? Object.defineProperty(w, S, { value: R, enumerable: !0, configurable: !0, writable: !0 }) : w[S] = R, w; } function p(w) { var S = C(w, "string"); return typeof S == "symbol" ? S : String(S); } function C(w, S) { if (typeof w != "object" || w === null) return w; var R = w[Symbol.toPrimitive]; if (R !== void 0) { var h = R.call(w, S || "default"); if (typeof h != "object") return h; throw new TypeError("@@toPrimitive must return a primitive value."); } return (S === "string" ? String : Number)(w); } let _ = class extends t.default.Component { constructor() { super(...arguments), y(this, "state", { resizing: null, dragging: null, className: "" }), y(this, "elementRef", /* @__PURE__ */ t.default.createRef()), y(this, "onDragStart", (S, R) => { let { node: h } = R; const { onDragStart: s, transformScale: a } = this.props; if (!s) return; const u = { top: 0, left: 0 }, { offsetParent: b } = h; if (!b) return; const l = b.getBoundingClientRect(), g = h.getBoundingClientRect(), f = g.left / a, m = l.left / a, P = g.top / a, M = l.top / a; u.left = f - m + b.scrollLeft, u.top = P - M + b.scrollTop, this.setState({ dragging: u }); const { x: j, y: N } = (0, o.calcXY)(this.getPositionParams(), u.top, u.left, this.props.w, this.props.h); return s.call(this, this.props.i, j, N, { e: S, node: h, newPosition: u }); }), y(this, "onDrag", (S, R) => { let { node: h, deltaX: s, deltaY: a } = R; const { onDrag: u } = this.props; if (!u) return; if (!this.state.dragging) throw new Error("onDrag called before onDragStart."); let b = this.state.dragging.top + a, l = this.state.dragging.left + s; const { isBounded: g, i: f, w: m, h: P, containerWidth: M } = this.props, j = this.getPositionParams(); if (g) { const { offsetParent: U } = h; if (U) { const { margin: k, rowHeight: ie, containerPadding: ee } = this.props, A = U.clientHeight - (0, o.calcGridItemWHPx)(P, ie, k[1]); b = (0, o.clamp)(b - ee[1], 0, A); const F = (0, o.calcGridColWidth)(j), oe = M - (0, o.calcGridItemWHPx)(m, F, k[0]); l = (0, o.clamp)(l - ee[0], 0, oe); } } const N = { top: b, left: l }; this.setState({ dragging: N }); const { containerPadding: I } = this.props, { x: O, y: z } = (0, o.calcXY)(j, b - I[1], l - I[0], m, P); return u.call(this, f, O, z, { e: S, node: h, newPosition: N }); }), y(this, "onDragStop", (S, R) => { let { node: h } = R; const { onDragStop: s } = this.props; if (!s) return; if (!this.state.dragging) throw new Error("onDragEnd called before onDragStart."); const { w: a, h: u, i: b, containerPadding: l } = this.props, { left: g, top: f } = this.state.dragging, m = { top: f, left: g }; this.setState({ dragging: null }); const { x: P, y: M } = (0, o.calcXY)(this.getPositionParams(), f - l[1], g - l[0], a, u); return s.call(this, b, P, M, { e: S, node: h, newPosition: m }); }), y(this, "onResizeStop", (S, R, h) => this.onResizeHandler(S, R, h, "onResizeStop")), y(this, "onResizeStart", (S, R, h) => this.onResizeHandler(S, R, h, "onResizeStart")), y(this, "onResize", (S, R, h) => this.onResizeHandler(S, R, h, "onResize")); } shouldComponentUpdate(S, R) { if (this.props.children !== S.children || this.props.droppingPosition !== S.droppingPosition) return !0; const h = (0, o.calcGridItemPosition)(this.getPositionParams(this.props), this.props.x, this.props.y, this.props.w, this.props.h, this.state), s = (0, o.calcGridItemPosition)(this.getPositionParams(S), S.x, S.y, S.w, S.h, R); return !(0, i.fastPositionEqual)(h, s) || this.props.useCSSTransforms !== S.useCSSTransforms; } componentDidMount() { this.moveDroppingItem({}); } componentDidUpdate(S) { this.moveDroppingItem(S); } // When a droppingPosition is present, this means we should fire a move event, as if we had moved // this element by `x, y` pixels. moveDroppingItem(S) { const { droppingPosition: R } = this.props; if (!R) return; const h = this.elementRef.current; if (!h) return; const s = S.droppingPosition || { left: 0, top: 0 }, { dragging: a } = this.state, u = a && R.left !== s.left || R.top !== s.top; if (!a) this.onDragStart(R.e, { node: h, deltaX: R.left, deltaY: R.top }); else if (u) { const b = R.left - a.left, l = R.top - a.top; this.onDrag(R.e, { node: h, deltaX: b, deltaY: l }); } } getPositionParams() { let S = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props; return { cols: S.cols, containerPadding: S.containerPadding, containerWidth: S.containerWidth, margin: S.margin, maxRows: S.maxRows, rowHeight: S.rowHeight }; } /** * This is where we set the grid item's absolute placement. It gets a little tricky because we want to do it * well when server rendering, and the only way to do that properly is to use percentage width/left because * we don't know exactly what the browser viewport is. * Unfortunately, CSS Transforms, which are great for performance, break in this instance because a percentage * left is relative to the item itself, not its container! So we cannot use them on the server rendering pass. * * @param {Object} pos Position object with width, height, left, top. * @return {Object} Style object. */ createStyle(S) { const { usePercentages: R, containerWidth: h, useCSSTransforms: s } = this.props; let a; return s ? a = (0, i.setTransform)(S) : (a = (0, i.setTopLeft)(S), R && (a.left = (0, i.perc)(S.left / h), a.width = (0, i.perc)(S.width / h))), a; } /** * Mix a Draggable instance into a child. * @param {Element} child Child element. * @return {Element} Child wrapped in Draggable. */ mixinDraggable(S, R) { return /* @__PURE__ */ t.default.createElement(r.DraggableCore, { disabled: !R, onStart: this.onDragStart, onDrag: this.onDrag, onStop: this.onDragStop, handle: this.props.handle, cancel: ".react-resizable-handle" + (this.props.cancel ? "," + this.props.cancel : ""), scale: this.props.transformScale, nodeRef: this.elementRef }, S); } /** * Utility function to setup callback handler definitions for * similarily structured resize events. */ curryResizeHandler(S, R) { return (h, s) => ( /*: Function*/ R(h, s, S) ); } /** * Mix a Resizable instance into a child. * @param {Element} child Child element. * @param {Object} position Position object (pixel values) * @return {Element} Child wrapped in Resizable. */ mixinResizable(S, R, h) { const { cols: s, minW: a, minH: u, maxW: b, maxH: l, transformScale: g, resizeHandles: f, resizeHandle: m } = this.props, P = this.getPositionParams(), M = (0, o.calcGridItemPosition)(P, 0, 0, s, 0).width, j = (0, o.calcGridItemPosition)(P, 0, 0, a, u), N = (0, o.calcGridItemPosition)(P, 0, 0, b, l), I = [j.width, j.height], O = [Math.min(N.width, M), Math.min(N.height, 1 / 0)]; return /* @__PURE__ */ t.default.createElement( n.Resizable, { draggableOpts: { disabled: !h }, className: h ? void 0 : "react-resizable-hide", width: R.width, height: R.height, minConstraints: I, maxConstraints: O, onResizeStop: this.curryResizeHandler(R, this.onResizeStop), onResizeStart: this.curryResizeHandler(R, this.onResizeStart), onResize: this.curryResizeHandler(R, this.onResize), transformScale: g, resizeHandles: f, handle: m }, S ); } /** * Wrapper around resize events to provide more useful data. */ onResizeHandler(S, R, h, s) { let { node: a, size: u, handle: b } = R; const l = this.props[s]; if (!l) return; const { x: g, y: f, i: m, maxH: P, minH: M, containerWidth: j } = this.props, { minW: N, maxW: I } = this.props; let O = u; a && (O = (0, i.resizeItemInDirection)(b, h, u, j), this.setState({ resizing: s === "onResizeStop" ? null : O })); let { w: z, h: U } = (0, o.calcWH)(this.getPositionParams(), O.width, O.height, g, f, b); z = (0, o.clamp)(z, Math.max(N, 1), I), U = (0, o.clamp)(U, M, P), l.call(this, m, z, U, { e: S, node: a, size: O, handle: b }); } render() { const { x: S, y: R, w: h, h: s, isDraggable: a, isResizable: u, droppingPosition: b, useCSSTransforms: l } = this.props, g = (0, o.calcGridItemPosition)(this.getPositionParams(), S, R, h, s, this.state), f = t.default.Children.only(this.props.children); let m = /* @__PURE__ */ t.default.cloneElement(f, { ref: this.elementRef, className: (0, v.default)("react-grid-item", f.props.className, this.props.className, { static: this.props.static, resizing: !!this.state.resizing, "react-draggable": a, "react-draggable-dragging": !!this.state.dragging, dropping: !!b, cssTransforms: l }), // We can set the width and height on the child, but unfortunately we can't set the position. style: { ...this.props.style, ...f.props.style, ...this.createStyle(g) } }); return m = this.mixinResizable(m, g, u), m = this.mixinDraggable(m, a), m; } }; return _t.default = _, y(_, "propTypes", { // Children must be only a single element children: e.default.element, // General grid attributes cols: e.default.number.isRequired, containerWidth: e.default.number.isRequired, rowHeight: e.default.number.isRequired, margin: e.default.array.isRequired, maxRows: e.default.number.isRequired, containerPadding: e.default.array.isRequired, // These are all in grid units x: e.default.number.isRequired, y: e.default.number.isRequired, w: e.default.number.isRequired, h: e.default.number.isRequired, // All optional minW: function(w, S) { const R = w[S]; if (typeof R != "number") return new Error("minWidth not Number"); if (R > w.w || R > w.maxW) return new Error("minWidth larger than item width/maxWidth"); }, maxW: function(w, S) { const R = w[S]; if (typeof R != "number") return new Error("maxWidth not Number"); if (R < w.w || R < w.minW) return new Error("maxWidth smaller than item width/minWidth"); }, minH: function(w, S) { const R = w[S]; if (typeof R != "number") return new Error("minHeight not Number"); if (R > w.h || R > w.maxH) return new Error("minHeight larger than item height/maxHeight"); }, maxH: function(w, S) { const R = w[S]; if (typeof R != "number") return new Error("maxHeight not Number"); if (R < w.h || R < w.minH) return new Error("maxHeight smaller than item height/minHeight"); }, // ID is nice to have for callbacks i: e.default.string.isRequired, // Resize handle options resizeHandles: c.resizeHandleAxesType, resizeHandle: c.resizeHandleType, // Functions onDragStop: e.default.func, onDragStart: e.default.func, onDrag: e.default.func, onResizeStop: e.default.func, onResizeStart: e.default.func, onResize: e.default.func, // Flags isDraggable: e.default.bool.isRequired, isResizable: e.default.bool.isRequired, isBounded: e.default.bool.isRequired, static: e.default.bool, // Use CSS transforms instead of top/left useCSSTransforms: e.default.bool.isRequired, transformScale: e.default.number, // Others className: e.default.string, // Selector for draggable handle handle: e.default.string, // Selector for draggable cancel (see react-draggable) cancel: e.default.string, // Current position of a dropping element droppingPosition: e.default.shape({ e: e.default.object.isRequired, left: e.default.number.isRequired, top: e.default.number.isRequired }) }), y(_, "defaultProps", { className: "", cancel: "", handle: "", minH: 1, minW: 1, maxH: 1 / 0, maxW: 1 / 0, transformScale: 1 }), _t; } var Yr; function Zi() { if (Yr) return Rt; Yr = 1, Object.defineProperty(Rt, "__esModule", { value: !0 }), Rt.default = void 0; var t = y(Le), e = /* @__PURE__ */ ur(), r = v(dr()), n = St(), i = fr(), o = v(ea()), c = v(Ki()); function v(h) { return h && h.__esModule ? h : { default: h }; } function d(h) { if (typeof WeakMap != "function") return null; var s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(); return (d = function(u) { return u ? a : s; })(h); } function y(h, s) { if (h && h.__esModule) return h; if (h === null || typeof h != "object" && typeof h != "function") return { default: h }; var a = d(s); if (a && a.has(h)) return a.get(h); var u = { __proto__: null }, b = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var l in h) if (l !== "default" && Object.prototype.hasOwnProperty.call(h, l)) { var g = b ? Object.getOwnPropertyDescriptor(h, l) : null; g && (g.get || g.set) ? Object.defineProperty(u, l, g) : u[l] = h[l]; } return u.default = h, a && a.set(h, u), u; } function p(h, s, a) { return s = C(s), s in h ? Object.defineProperty(h, s, { value: a, enumerable: !0, configurable: !0, writable: !0 }) : h[s] = a, h; } function C(h) { var s = _(h, "string"); return typeof s == "symbol" ? s : String(s); } function _(h, s) { if (typeof h != "object" || h === null) return h; var a = h[Symbol.toPrimitive]; if (a !== void 0) { var u = a.call(h, s || "default"); if (typeof u != "object") return u; throw new TypeError("@@toPrimitive must return a primitive value."); } return (s === "string" ? String : Number)(h); } const w = "react-grid-layout"; let S = !1; try { S = /firefox/i.test(navigator.userAgent); } catch { } let R = class extends t.Component { constructor() { super(...arguments), p(this, "state", { activeDrag: null, layout: (0, n.synchronizeLayoutWithChildren)( this.props.layout, this.props.children, this.props.cols, // Legacy support for verticalCompact: false (0, n.compactType)(this.props), this.props.allowOverlap ), mounted: !1, oldDragItem: null, oldLayout: null, oldResizeItem: null, resizing: !1, droppingDOMNode: null, children: [] }), p(this, "dragEnterCounter", 0), p(this, "onDragStart", (s, a, u, b) => { let { e: l, node: g } = b; const { layout: f } = this.state, m = (0, n.getLayoutItem)(f, s); if (!m) return; const P = { w: m.w, h: m.h, x: m.x, y: m.y, placeholder: !0, i: s }; return this.setState({ oldDragItem: (0, n.cloneLayoutItem)(m), oldLayout: f, activeDrag: P }), this.props.onDragStart(f, m, m, null, l, g); }), p(this, "onDrag", (s, a, u, b) => { let { e: l, node: g } = b; const { oldDragItem: f } = this.state; let { layout: m } = this.state; const { cols: P, allowOverlap: M, preventCollision: j } = this.props, N = (0, n.getLayoutItem)(m, s); if (!N) return; const I = { w: N.w, h: N.h, x: N.x, y: N.y, placeholder: !0, i: s }; m = (0, n.moveElement)(m, N, a, u, !0, j, (0, n.compactType)(this.props), P, M), this.props.onDrag(m, f, N, I, l, g), this.setState({ layout: M ? m : (0, n.compact)(m, (0, n.compactType)(this.props), P), activeDrag: I }); }), p(this, "onDragStop", (s, a, u, b) => { let { e: l, node: g } = b; if (!this.state.activeDrag) return; const { oldDragItem: f } = this.state; let { layout: m } = this.state; const { cols: P, preventCollision: M, allowOverlap: j } = this.props, N = (0, n.getLayoutItem)(m, s); if (!N) return; m = (0, n.moveElement)(m, N, a, u, !0, M, (0, n.compactType)(this.props), P, j); const O = j ? m : (0, n.compact)(m, (0, n.compactType)(this.props), P); this.props.onDragStop(O, f, N, null, l, g); const { oldLayout: z } = this.state; this.setState({ activeDrag: null, layout: O, oldDragItem: null, oldLayout: null }), this.onLayoutMaybeChanged(O, z); }), p(this, "onResizeStart", (s, a, u, b) => { let { e: l, node: g } = b; const { layout: f } = this.state, m = (0, n.getLayoutItem)(f, s); m && (this.setState({ oldResizeItem: (0, n.cloneLayoutItem)(m), oldLayout: this.state.layout, resizing: !0 }), this.props.onResizeStart(f, m, m, null, l, g)); }), p(this, "onResize", (s, a, u, b) => { let { e: l, node: g, size: f, handle: m } = b; const { oldResizeItem: P } = this.state, { layout: M } = this.state, { cols: j, preventCollision: N, allowOverlap: I } = this.props; let O = !1, z, U, k; const [ie, ee] = (0, n.withLayoutItem)(M, s, (F) => { let oe; return U = F.x, k = F.y, ["sw", "w", "nw", "n", "ne"].indexOf(m) !== -1 && (["sw", "nw", "w"].indexOf(m) !== -1 && (U = F.x + (F.w - a), a = F.x !== U && U < 0 ? F.w : a, U = U < 0 ? 0 : U), ["ne", "n", "nw"].indexOf(m) !== -1 && (k = F.y + (F.h - u), u = F.y !== k && k < 0 ? F.h : u, k = k < 0 ? 0 : k), O = !0), N && !I && (oe = (0, n.getAllCollisions)(M, { ...F, w: a, h: u, x: U, y: k }).filter((de) => de.i !== F.i).length > 0, oe && (k = F.y, u = F.h, U = F.x, a = F.w, O = !1)), F.w = a, F.h = u, F; }); if (!ee) return; z = ie, O && (z = (0, n.moveElement)(ie, ee, U, k, !0, this.props.preventCollision, (0, n.compactType)(this.props), j, I)); const A = { w: ee.w, h: ee.h, x: ee.x, y: ee.y, static: !0, i: s }; this.props.onResize(z, P, ee, A, l, g), this.setState({ layout: I ? z : (0, n.compact)(z, (0, n.compactType)(this.props), j), activeDrag: A }); }), p(this, "onResizeStop", (s, a, u, b) => { let { e: l, node: g } = b; const { layout: f, oldResizeItem: m } = this.state, { cols: P, allowOverlap: M } = this.props, j = (0, n.getLayoutItem)(f, s), N = M ? f : (0, n.compact)(f, (0, n.compactType)(this.props), P); this.props.onResizeStop(N, m, j, null, l, g); const { oldLayout: I } = this.state; this.setState({ activeDrag: null, layout: N, oldResizeItem: null, oldLayout: null, resizing: !1 }), this.onLayoutMaybeChanged(N, I); }), p(this, "onDragOver", (s) => { var ie; if (s.preventDefault(), s.stopPropagation(), S && // $FlowIgnore can't figure this out !((ie = s.nativeEvent.target) != null && ie.classList.contains(w))) return !1; const { droppingItem: a, onDropDragOver: u, margin: b, cols: l, rowHeight: g, maxRows: f, width: m, containerPadding: P, transformScale: M } = this.props, j = u == null ? void 0 : u(s); if (j === !1) return this.state.droppingDOMNode && this.removeDroppingPlaceholder(), !1; const N = { ...a, ...j }, { layout: I } = this.state, O = s.currentTarget.getBoundingClientRect(), z = s.clientX - O.left, U = s.clientY - O.top, k = { left: z / M, top: U / M, e: s }; if (this.state.droppingDOMNode) { if (this.state.droppingPosition) { const { left: ee, top: A } = this.state.droppingPosition; (ee != z || A != U) && this.setState({ droppingPosition: k }); } } else { const ee = { cols: l, margin: b, maxRows: f, rowHeight: g, containerWidth: m, containerPadding: P || b }, A = (0, i.calcXY)(ee, U, z, N.w, N.h); this.setState({ droppingDOMNode: /* @__PURE__ */ t.createElement("div", { key: N.i }), droppingPosition: k, layout: [...I, { ...N, x: A.x, y: A.y, static: !1, isDraggable: !0 }] }); } }), p(this, "removeDroppingPlaceholder", () => { const { droppingItem: s, cols: a } = this.props, { layout: u } = this.state, b = (0, n.compact)(u.filter((l) => l.i !== s.i), (0, n.compactType)(this.props), a, this.props.allowOverlap); this.setState({ layout: b, droppingDOMNode: null, activeDrag: null, droppingPosition: void 0 }); }), p(this, "onDragLeave", (s) => { s.preventDefault(), s.stopPropagation(), this.dragEnterCounter--, this.dragEnterCounter === 0 && this.removeDroppingPlaceholder(); }), p(this, "onDragEnter", (s) => { s.preventDefault(), s.stopPropagation(), this.dragEnterCounter++; }), p(this, "onDrop", (s) => { s.preventDefault(), s.stopPropagation(); const { droppingItem: a } = this.props, { layout: u } = this.state, b = u.find((l) => l.i === a.i); this.dragEnterCounter = 0, this.removeDroppingPlaceholder(), this.props.onDrop(u, b, s); }); } componentDidMount() { this.setState({ mounted: !0 }), this.onLayoutMaybeChanged(this.state.layout, this.props.layout); } static getDerivedStateFromProps(s, a) { let u; return a.activeDrag ? null : (!(0, e.deepEqual)(s.layout, a.propsLayout) || s.compactType !== a.compactType ? u = s.layout : (0, n.childrenEqual)(s.children, a.children) || (u = a.layout), u ? { layout: (0, n.synchronizeLayoutWithChildren)(u, s.children, s.cols, (0, n.compactType)(s), s.allowOverlap), // We need to save these props to state for using // getDerivedStateFromProps instead of componentDidMount (in which we would get extra rerender) compactType: s.compactType, children: s.children, propsLayout: s.layout } : null); } shouldComponentUpdate(s, a) { return ( // NOTE: this is almost always unequal. Therefore the only way to get better performance // from SCU is if the user intentionally memoizes children. If they do, and they can // handle changes properly, performance will increase. this.props.children !== s.children || !(0, n.fastRGLPropsEqual)(this.props, s, e.deepEqual) || this.state.activeDrag !== a.activeDrag || this.state.mounted !== a.mounted || this.state.droppingPosition !== a.droppingPosition ); } componentDidUpdate(s, a) { if (!this.state.activeDrag) { const u = this.state.layout, b = a.layout; this.onLayoutMaybeChanged(u, b); } } /** * Calculates a pixel value for the container. * @return {String} Container height in pixels. */ containerHeight() { if (!this.props.autoSize) return; const s = (0, n.bottom)(this.state.layout), a = this.props.containerPadding ? this.props.containerPadding[1] : this.props.margin[1]; return s * this.props.rowHeight + (s - 1) * this.props.margin[1] + a * 2 + "px"; } onLayoutMaybeChanged(s, a) { a || (a = this.state.layout), (0, e.deepEqual)(a, s) || this.props.onLayoutChange(s); } /** * Create a placeholder object. * @return {Element} Placeholder div. */ placeholder() { const { activeDrag: s } = this.state; if (!s) return null; const { width: a, cols: u, margin: b, containerPadding: l, rowHeight: g, maxRows: f, useCSSTransforms: m, transformScale: P } = this.props; return /* @__PURE__ */ t.createElement(o.default, { w: s.w, h: s.h, x: s.x, y: s.y, i: s.i, className: `react-grid-placeholder ${this.state.resizing ? "placeholder-resizing" : ""}`, containerWidth: a, cols: u, margin: b, containerPadding: l || b, maxRows: f, rowHeight: g, isDraggable: !1, isResizable: !1, isBounded: !1, useCSSTransforms: m, transformScale: P }, /* @__PURE__ */ t.createElement("div", null)); } /** * Given a grid item, set its style attributes & surround in a . * @param {Element} child React element. * @return {Element} Element wrapped in draggable and properly placed. */ processGridItem(s, a) { if (!s || !s.key) return; const u = (0, n.getLayoutItem)(this.state.layout, String(s.key)); if (!u) return null; const { width: b, cols: l, margin: g, containerPadding: f, rowHeight: m, maxRows: P, isDraggable: M, isResizable: j, isBounded: N, useCSSTransforms: I, transformScale: O, draggableCancel: z, draggableHandle: U, resizeHandles: k, resizeHandle: ie } = this.props, { mounted: ee, droppingPosition: A } = this.state, F = typeof u.isDraggable == "boolean" ? u.isDraggable : !u.static && M, oe = typeof u.isResizable == "boolean" ? u.isResizable : !u.static && j, se = u.resizeHandles || k, de = F && N && u.isBounded !== !1; return /* @__PURE__ */ t.createElement(o.default, { containerWidth: b, cols: l, margin: g, containerPadding: f || g, maxRows: P, rowHeight: m, cancel: z, handle: U, onDragStop: this.onDragStop, onDragStart: this.onDragStart, onDrag: this.onDrag, onResizeStart: this.onResizeStart, onResize: this.onResize, onResizeStop: this.onResizeStop, isDraggable: F, isResizable: oe, isBounded: de, useCSSTransforms: I && ee, usePercentages: !ee, transformScale: O, w: u.w, h: u.h, x: u.x, y: u.y, i: u.i, minH: u.minH, minW: u.minW, maxH: u.maxH, maxW: u.maxW, static: u.static, droppingPosition: a ? A : void 0, resizeHandles: se, resizeHandle: ie }, s); } render() { const { className: s, style: a, isDroppable: u, innerRef: b } = this.props, l = (0, r.default)(w, s), g = { height: this.containerHeight(), ...a }; return /* @__PURE__ */ t.createElement("div", { ref: b, className: l, style: g, onDrop: u ? this.onDrop : n.noop, onDragLeave: u ? this.onDragLeave : n.noop, onDragEnter: u ? this.onDragEnter : n.noop, onDragOver: u ? this.onDragOver : n.noop }, t.Children.map(this.props.children, (f) => this.processGridItem(f)), u && this.state.droppingDOMNode && this.processGridItem(this.state.droppingDOMNode, !0), this.placeholder()); } }; return Rt.default = R, p(R, "displayName", "ReactGridLayout"), p(R, "propTypes", c.default), p(R, "defaultProps", { autoSize: !0, cols: 12, className: "", style: {}, draggableHandle: "", draggableCancel: "", containerPadding: null, rowHeight: 150, maxRows: 1 / 0, // infinite vertical growth layout: [], margin: [10, 10], isBounded: !1, isDraggable: !0, isResizable: !0, allowOverlap: !1, isDroppable: !1, useCSSTransforms: !0, transformScale: 1, verticalCompact: !0, compactType: "vertical", preventCollision: !1, droppingItem: { i: "__dropping-elem__", h: 1, w: 1 }, resizeHandles: ["se"], onLayoutChange: n.noop, onDragStart: n.noop, onDrag: n.noop, onDragStop: n.noop, onResizeStart: n.noop, onResize: n.noop, onResizeStop: n.noop, onDrop: n.noop, onDropDragOver: n.noop }), Rt; } var Dt = {}, rt = {}, Kr; function Ji() { if (Kr) return rt; Kr = 1, Object.defineProperty(rt, "__esModule", { value: !0 }), rt.findOrGenerateResponsiveLayout = n, rt.getBreakpointFromWidth = e, rt.getColsFromBreakpoint = r, rt.sortBreakpoints = i; var t = St(); function e(o, c) { const v = i(o); let d = v[0]; for (let y = 1, p = v.length; y < p; y++) { const C = v[y]; c > o[C] && (d = C); } return d; } function r(o, c) { if (!c[o]) throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint " + o + " is missing!"); return c[o]; } function n(o, c, v, d, y, p) { if (o[v]) return (0, t.cloneLayout)(o[v]); let C = o[d]; const _ = i(c), w = _.slice(_.indexOf(v)); for (let S = 0, R = w.length; S < R; S++) { const h = w[S]; if (o[h]) { C = o[h]; break; } } return C = (0, t.cloneLayout)(C || []), (0, t.compact)((0, t.correctBounds)(C, { cols: y }), p, y); } function i(o) { return Object.keys(o).sort(function(v, d) { return o[v] - o[d]; }); } return rt; } var Zr; function ta() { if (Zr) return Dt; Zr = 1, Object.defineProperty(Dt, "__esModule", { value: !0 }), Dt.default = void 0; var t = d(Le), e = c(/* @__PURE__ */ Qe()), r = /* @__PURE__ */ ur(), n = St(), i = Ji(), o = c(Zi()); function c(h) { return h && h.__esModule ? h : { default: h }; } function v(h) { if (typeof WeakMap != "function") return null; var s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(); return (v = function(u) { return u ? a : s; })(h); } function d(h, s) { if (h && h.__esModule) return h; if (h === null || typeof h != "object" && typeof h != "function") return { default: h }; var a = v(s); if (a && a.has(h)) return a.get(h); var u = { __proto__: null }, b = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var l in h) if (l !== "default" && Object.prototype.hasOwnProperty.call(h, l)) { var g = b ? Object.getOwnPropertyDescriptor(h, l) : null; g && (g.get || g.set) ? Object.defineProperty(u, l, g) : u[l] = h[l]; } return u.default = h, a && a.set(h, u), u; } function y() { return y = Object.assign ? Object.assign.bind() : function(h) { for (var s = 1; s < arguments.length; s++) { var a = arguments[s]; for (var u in a) Object.prototype.hasOwnProperty.call(a, u) && (h[u] = a[u]); } return h; }, y.apply(this, arguments); } function p(h, s, a) { return s = C(s), s in h ? Object.defineProperty(h, s, { value: a, enumerable: !0, configurable: !0, writable: !0 }) : h[s] = a, h; } function C(h) { var s = _(h, "string"); return typeof s == "symbol" ? s : String(s); } function _(h, s) { if (typeof h != "object" || h === null) return h; var a = h[Symbol.toPrimitive]; if (a !== void 0) { var u = a.call(h, s || "default"); if (typeof u != "object") return u; throw new TypeError("@@toPrimitive must return a primitive value."); } return (s === "string" ? String : Number)(h); } const w = (h) => Object.prototype.toString.call(h); function S(h, s) { return h == null ? null : Array.isArray(h) ? h : h[s]; } let R = class extends t.Component { constructor() { super(...arguments), p(this, "state", this.generateInitialState()), p(this, "onLayoutChange", (s) => { this.props.onLayoutChange(s, { ...this.props.layouts, [this.state.breakpoint]: s }); }); } generateInitialState() { const { width: s, breakpoints: a, layouts: u, cols: b } = this.props, l = (0, i.getBreakpointFromWidth)(a, s), g = (0, i.getColsFromBreakpoint)(l, b), f = this.props.verticalCompact === !1 ? null : this.props.compactType; return { layout: (0, i.findOrGenerateResponsiveLayout)(u, a, l, l, g, f), breakpoint: l, cols: g }; } static getDerivedStateFromProps(s, a) { if (!(0, r.deepEqual)(s.layouts, a.layouts)) { const { breakpoint: u, cols: b } = a; return { layout: (0, i.findOrGenerateResponsiveLayout)(s.layouts, s.breakpoints, u, u, b, s.compactType), layouts: s.layouts }; } return null; } componentDidUpdate(s) { (this.props.width != s.width || this.props.breakpoint !== s.breakpoint || !(0, r.deepEqual)(this.props.breakpoints, s.breakpoints) || !(0, r.deepEqual)(this.props.cols, s.cols)) && this.onWidthChange(s); } /** * When the width changes work through breakpoints and reset state with the new width & breakpoint. * Width changes are necessary to figure out the widget widths. */ onWidthChange(s) { const { breakpoints: a, cols: u, layouts: b, compactType: l } = this.props, g = this.props.breakpoint || (0, i.getBreakpointFromWidth)(this.props.breakpoints, this.props.width), f = this.state.breakpoint, m = (0, i.getColsFromBreakpoint)(g, u), P = { ...b }; if (f !== g || s.breakpoints !== a || s.cols !== u) { f in P || (P[f] = (0, n.cloneLayout)(this.state.layout)); let N = (0, i.findOrGenerateResponsiveLayout)(P, a, g, f, m, l); N = (0, n.synchronizeLayoutWithChildren)(N, this.props.children, m, l, this.props.allowOverlap), P[g] = N, this.props.onLayoutChange(N, P), this.props.onBreakpointChange(g, m), this.setState({ breakpoint: g, layout: N, cols: m }); } const M = S(this.props.margin, g), j = S(this.props.containerPadding, g); this.props.onWidthChange(this.props.width, M, m, j); } render() { const { breakpoint: s, breakpoints: a, cols: u, layouts: b, margin: l, containerPadding: g, onBreakpointChange: f, onLayoutChange: m, onWidthChange: P, ...M } = this.props; return /* @__PURE__ */ t.createElement(o.default, y({}, M, { // $FlowIgnore should allow nullable here due to DefaultProps margin: S(l, this.state.breakpoint), containerPadding: S(g, this.state.breakpoint), onLayoutChange: this.onLayoutChange, layout: this.state.layout, cols: this.state.cols })); } }; return Dt.default = R, p(R, "propTypes", { // // Basic props // // Optional, but if you are managing width yourself you may want to set the breakpoint // yourself as well. breakpoint: e.default.string, // {name: pxVal}, e.g. {lg: 1200, md: 996, sm: 768, xs: 480} breakpoints: e.default.object, allowOverlap: e.default.bool, // # of cols. This is a breakpoint -> cols map cols: e.default.object, // # of margin. This is a breakpoint -> margin map // e.g. { lg: [5, 5], md: [10, 10], sm: [15, 15] } // Margin between items [x, y] in px // e.g. [10, 10] margin: e.default.oneOfType([e.default.array, e.default.object]), // # of containerPadding. This is a breakpoint -> containerPadding map // e.g. { lg: [5, 5], md: [10, 10], sm: [15, 15] } // Padding inside the container [x, y] in px // e.g. [10, 10] containerPadding: e.default.oneOfType([e.default.array, e.default.object]), // layouts is an object mapping breakpoints to layouts. // e.g. {lg: Layout, md: Layout, ...} layouts(h, s) { if (w(h[s]) !== "[object Object]") throw new Error("Layout property must be an object. Received: " + w(h[s])); Object.keys(h[s]).forEach((a) => { if (!(a in h.breakpoints)) throw new Error("Each key in layouts must align with a key in breakpoints."); (0, n.validateLayout)(h.layouts[a], "layouts." + a); }); }, // The width of this component. // Required in this propTypes stanza because generateInitialState() will fail without it. width: e.default.number.isRequired, // // Callbacks // // Calls back with breakpoint and new # cols onBreakpointChange: e.default.func, // Callback so you can save the layout. // Calls back with (currentLayout, allLayouts). allLayouts are keyed by breakpoint. onLayoutChange: e.default.func, // Calls back with (containerWidth, margin, cols, containerPadding) onWidthChange: e.default.func }), p(R, "defaultProps", { breakpoints: { lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 }, cols: { lg: 12, md: 10, sm: 6, xs: 4, xxs: 2 }, containerPadding: { lg: null, md: null, sm: null, xs: null, xxs: null }, layouts: {}, margin: [10, 10], allowOverlap: !1, onBreakpointChange: n.noop, onLayoutChange: n.noop, onWidthChange: n.noop }), Dt; } var nn = {}, Qi = function() { if (typeof Map < "u") return Map; function t(e, r) { var n = -1; return e.some(function(i, o) { return i[0] === r ? (n = o, !0) : !1; }), n; } return ( /** @class */ function() { function e() { this.__entries__ = []; } return Object.defineProperty(e.prototype, "size", { /** * @returns {boolean} */ get: function() { return this.__entries__.length; }, enumerable: !0, configurable: !0 }), e.prototype.get = function(r) { var n = t(this.__entries__, r), i = this.__entries__[n]; return i && i[1]; }, e.prototype.set = function(r, n) { var i = t(this.__entries__, r); ~i ? this.__entries__[i][1] = n : this.__entries__.push([r, n]); }, e.prototype.delete = function(r) { var n = this.__entries__, i = t(n, r); ~i && n.splice(i, 1); }, e.prototype.has = function(r) { return !!~t(this.__entries__, r); }, e.prototype.clear = function() { this.__entries__.splice(0); }, e.prototype.forEach = function(r, n) { n === void 0 && (n = null); for (var i = 0, o = this.__entries__; i < o.length; i++) { var c = o[i]; r.call(n, c[1], c[0]); } }, e; }() ); }(), er = typeof window < "u" && typeof document < "u" && window.document === document, vn = function() { return typeof global < "u" && global.Math === Math ? global : typeof self < "u" && self.Math === Math ? self : typeof window < "u" && window.Math === Math ? window : Function("return this")(); }(), na = function() { return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(vn) : function(t) { return setTimeout(function() { return t(Date.now()); }, 1e3 / 60); }; }(), ra = 2; function ia(t, e) { var r = !1, n = !1, i = 0; function o() { r && (r = !1, t()), n && v(); } function c() { na(o); } function v() { var d = Date.now(); if (r) { if (d - i < ra) return; n = !0; } else r = !0, n = !1, setTimeout(c, e); i = d; } return v; } var oa = 20, sa = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], aa = typeof MutationObserver < "u", la = ( /** @class */ function() { function t() { this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = ia(this.refresh.bind(this), oa); } return t.prototype.addObserver = function(e) { ~this.observers_.indexOf(e) || this.observers_.push(e), this.connected_ || this.connect_(); }, t.prototype.removeObserver = function(e) { var r = this.observers_, n = r.indexOf(e); ~n && r.splice(n, 1), !r.length && this.connected_ && this.disconnect_(); }, t.prototype.refresh = function() { var e = this.updateObservers_(); e && this.refresh(); }, t.prototype.updateObservers_ = function() { var e = this.observers_.filter(function(r) { return r.gatherActive(), r.hasActive(); }); return e.forEach(function(r) { return r.broadcastActive(); }), e.length > 0; }, t.prototype.connect_ = function() { !er || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), aa ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, { attributes: !0, childList: !0, characterData: !0, subtree: !0 })) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0); }, t.prototype.disconnect_ = function() { !er || !this.connected_ || (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = !1, this.connected_ = !1); }, t.prototype.onTransitionEnd_ = function(e) { var r = e.propertyName, n = r === void 0 ? "" : r, i = sa.some(function(o) { return !!~n.indexOf(o); }); i && this.refresh(); }, t.getInstance = function() { return this.instance_ || (this.instance_ = new t()), this.instance_; }, t.instance_ = null, t; }() ), eo = function(t, e) { for (var r = 0, n = Object.keys(e); r < n.length; r++) { var i = n[r]; Object.defineProperty(t, i, { value: e[i], enumerable: !1, writable: !1, configurable: !0 }); } return t; }, gt = function(t) { var e = t && t.ownerDocument && t.ownerDocument.defaultView; return e || vn; }, to = Nn(0, 0, 0, 0); function yn(t) { return parseFloat(t) || 0; } function Jr(t) { for (var e = [], r = 1; r < arguments.length; r++) e[r - 1] = arguments[r]; return e.reduce(function(n, i) { var o = t["border-" + i + "-width"]; return n + yn(o); }, 0); } function ca(t) { for (var e = ["top", "right", "bottom", "left"], r = {}, n = 0, i = e; n < i.length; n++) { var o = i[n], c = t["padding-" + o]; r[o] = yn(c); } return r; } function ua(t) { var e = t.getBBox(); return Nn(0, 0, e.width, e.height); } function da(t) { var e = t.clientWidth, r = t.clientHeight; if (!e && !r) return to; var n = gt(t).getComputedStyle(t), i = ca(n), o = i.left + i.right, c = i.top + i.bottom, v = yn(n.width), d = yn(n.height); if (n.boxSizing === "border-box" && (Math.round(v + o) !== e && (v -= Jr(n, "left", "right") + o), Math.round(d + c) !== r && (d -= Jr(n, "top", "bottom") + c)), !ha(t)) { var y = Math.round(v + o) - e, p = Math.round(d + c) - r; Math.abs(y) !== 1 && (v -= y), Math.abs(p) !== 1 && (d -= p); } return Nn(i.left, i.top, v, d); } var fa = /* @__PURE__ */ function() { return typeof SVGGraphicsElement < "u" ? function(t) { return t instanceof gt(t).SVGGraphicsElement; } : function(t) { return t instanceof gt(t).SVGElement && typeof t.getBBox == "function"; }; }(); function ha(t) { return t === gt(t).document.documentElement; } function pa(t) { return er ? fa(t) ? ua(t) : da(t) : to; } function ga(t) { var e = t.x, r = t.y, n = t.width, i = t.height, o = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, c = Object.create(o.prototype); return eo(c, { x: e, y: r, width: n, height: i, top: r, right: e + n, bottom: i + r, left: e }), c; } function Nn(t, e, r, n) { return { x: t, y: e, width: r, height: n }; } var ma = ( /** @class */ function() { function t(e) { this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = Nn(0, 0, 0, 0), this.target = e; } return t.prototype.isActive = function() { var e = pa(this.target); return this.contentRect_ = e, e.width !== this.broadcastWidth || e.height !== this.broadcastHeight; }, t.prototype.broadcastRect = function() { var e = this.contentRect_; return this.broadcastWidth = e.width, this.broadcastHeight = e.height, e; }, t; }() ), va = ( /** @class */ /* @__PURE__ */ function() { function t(e, r) { var n = ga(r); eo(this, { target: e, contentRect: n }); } return t; }() ), ya = ( /** @class */ function() { function t(e, r, n) { if (this.activeObservations_ = [], this.observations_ = new Qi(), typeof e != "function") throw new TypeError("The callback provided as parameter 1 is not a function."); this.callback_ = e, this.controller_ = r, this.callbackCtx_ = n; } return t.prototype.observe = function(e) { if (!arguments.length) throw new TypeError("1 argument required, but only 0 present."); if (!(typeof Element > "u" || !(Element instanceof Object))) { if (!(e instanceof gt(e).Element)) throw new TypeError('parameter 1 is not of type "Element".'); var r = this.observations_; r.has(e) || (r.set(e, new ma(e)), this.controller_.addObserver(this), this.controller_.refresh()); } }, t.prototype.unobserve = function(e) { if (!arguments.length) throw new TypeError("1 argument required, but only 0 present."); if (!(typeof Element > "u" || !(Element instanceof Object))) { if (!(e instanceof gt(e).Element)) throw new TypeError('parameter 1 is not of type "Element".'); var r = this.observations_; r.has(e) && (r.delete(e), r.size || this.controller_.removeObserver(this)); } }, t.prototype.disconnect = function() { this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this); }, t.prototype.gatherActive = function() { var e = this; this.clearActive(), this.observations_.forEach(function(r) { r.isActive() && e.activeObservations_.push(r); }); }, t.prototype.broadcastActive = function() { if (this.hasActive()) { var e = this.callbackCtx_, r = this.activeObservations_.map(function(n) { return new va(n.target, n.broadcastRect()); }); this.callback_.call(e, r, e), this.clearActive(); } }, t.prototype.clearActive = function() { this.activeObservations_.splice(0); }, t.prototype.hasActive = function() { return this.activeObservations_.length > 0; }, t; }() ), no = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new Qi(), ro = ( /** @class */ /* @__PURE__ */ function() { function t(e) { if (!(this instanceof t)) throw new TypeError("Cannot call a class as a function."); if (!arguments.length) throw new TypeError("1 argument required, but only 0 present."); var r = la.getInstance(), n = new ya(e, r, this); no.set(this, n); } return t; }() ); [ "observe", "unobserve", "disconnect" ].forEach(function(t) { ro.prototype[t] = function() { var e; return (e = no.get(this))[t].apply(e, arguments); }; }); var ba = function() { return typeof vn.ResizeObserver < "u" ? vn.ResizeObserver : ro; }(); const Sa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: ba }, Symbol.toStringTag, { value: "Module" })), Ca = /* @__PURE__ */ Ai(Sa); var Qr; function wa() { if (Qr) return nn; Qr = 1, Object.defineProperty(nn, "__esModule", { value: !0 }), nn.default = _; var t = c(Le), e = i(/* @__PURE__ */ Qe()), r = i(Ca), n = i(dr()); function i(w) { return w && w.__esModule ? w : { default: w }; } function o(w) { if (typeof WeakMap != "function") return null; var S = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(); return (o = function(h) { return h ? R : S; })(w); } function c(w, S) { if (w && w.__esModule) return w; if (w === null || typeof w != "object" && typeof w != "function") return { default: w }; var R = o(S); if (R && R.has(w)) return R.get(w); var h = { __proto__: null }, s = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var a in w) if (a !== "default" && Object.prototype.hasOwnProperty.call(w, a)) { var u = s ? Object.getOwnPropertyDescriptor(w, a) : null; u && (u.get || u.set) ? Object.defineProperty(h, a, u) : h[a] = w[a]; } return h.default = w, R && R.set(w, h), h; } function v() { return v = Object.assign ? Object.assign.bind() : function(w) { for (var S = 1; S < arguments.length; S++) { var R = arguments[S]; for (var h in R) Object.prototype.hasOwnProperty.call(R, h) && (w[h] = R[h]); } return w; }, v.apply(this, arguments); } function d(w, S, R) { return S = y(S), S in w ? Object.defineProperty(w, S, { value: R, enumerable: !0, configurable: !0, writable: !0 }) : w[S] = R, w; } function y(w) { var S = p(w, "string"); return typeof S == "symbol" ? S : String(S); } function p(w, S) { if (typeof w != "object" || w === null) return w; var R = w[Symbol.toPrimitive]; if (R !== void 0) { var h = R.call(w, S || "default"); if (typeof h != "object") return h; throw new TypeError("@@toPrimitive must return a primitive value."); } return (S === "string" ? String : Number)(w); } const C = "react-grid-layout"; function _(w) { var S; return S = class extends t.Component { constructor() { super(...arguments), d(this, "state", { width: 1280 }), d(this, "elementRef", /* @__PURE__ */ t.createRef()), d(this, "mounted", !1), d(this, "resizeObserver", void 0); } componentDidMount() { this.mounted = !0, this.resizeObserver = new r.default((s) => { if (this.elementRef.current instanceof HTMLElement) { const u = s[0].contentRect.width; this.setState({ width: u }); } }); const h = this.elementRef.current; h instanceof HTMLElement && this.resizeObserver.observe(h); } componentWillUnmount() { this.mounted = !1; const h = this.elementRef.current; h instanceof HTMLElement && this.resizeObserver.unobserve(h), this.resizeObserver.disconnect(); } render() { const { measureBeforeMount: h, ...s } = this.props; return h && !this.mounted ? /* @__PURE__ */ t.createElement("div", { className: (0, n.default)(this.props.className, C), style: this.props.style, ref: this.elementRef }) : /* @__PURE__ */ t.createElement(w, v({ innerRef: this.elementRef }, s, this.state)); } }, d(S, "defaultProps", { measureBeforeMount: !1 }), d(S, "propTypes", { // If true, will not render children until mounted. Useful for getting the exact width before // rendering, to prevent any unsightly resizing. measureBeforeMount: e.default.bool }), S; } return nn; } var ei; function Ra() { return ei || (ei = 1, function(t) { t.exports = Zi().default, t.exports.utils = St(), t.exports.calculateUtils = fr(), t.exports.Responsive = ta().default, t.exports.Responsive.utils = Ji(), t.exports.WidthProvider = wa().default; }(An)), An.exports; } var _a = Ra(); const xa = /* @__PURE__ */ hs(_a); var Ia = Object.defineProperty, Ea = Object.getOwnPropertyDescriptor, Ta = (t, e, r, n) => { for (var i = n > 1 ? void 0 : n ? Ea(e, r) : e, o = t.length - 1, c; o >= 0; o--) (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i); return n && i && Ia(e, r, i), i; }, Pa = (t, e) => (r, n) => e(r, n, t); let mt = class extends je { constructor(e) { super(); Xe(this, "_initLocal", () => { }); Xe(this, "_findReplaceIndex", (e) => { const r = /\{([^}]+)?\}/g, n = []; let i = r.exec(e); for (; i; ) n.push({ startIndex: i.index, key: Number(i[1]), endIndex: i.index + i[0].length - 1 }), i = r.exec(e); return n; }); this._localeService = e, this._initLocal(); } tWithReactNode(e, ...r) { const n = this._localeService.getLocales(), i = e.split("."), o = n && this._localeService.resolveKeyPath(n, i); if (typeof o == "string") { const c = []; return this._findReplaceIndex(o).forEach((v, d, y) => { const p = y[d - 1] || { startIndex: 0, endIndex: -1 }; if (p.endIndex + 1 < v.startIndex) { const C = o.slice(p.endIndex + 1, v.startIndex); C && c.push(C); } if (r[v.key] && c.push(r[v.key]), d === y.length - 1) { const C = o.slice(v.endIndex + 1); C && c.push(C); } }), c; } return []; } }; mt = Ta([ Pa(0, Q(Ie)) ], mt); const Oa = "univer-cf-preview", rn = { cfPreview: Oa }, Ct = (t) => { var i, o; const e = t.rule; if (!e) return null; const r = Se(() => { if (e.type === K.colorScale) { const c = e.config.map((y, p) => ({ color: new hi(y.color), value: p })), v = c.length - 1; return new Array(5).fill("").map((y, p, C) => p * v / (C.length - 1)).map((y) => Ro(c, y)); } return null; }, [e]), n = Se(() => { if (e.type === K.iconSet) return e.config.map((c) => { const v = st[c.iconType]; return v && v[Number(c.iconId)]; }); }, [e]); switch (e.type) { case K.dataBar: { const { isGradient: c } = e.config, v = { width: "50%", height: "100%" }, d = c ? `linear-gradient(to right, ${e.config.positiveColor || Ft}, rgb(255 255 255))` : e.config.positiveColor, y = c ? `linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor || Vt})` : e.config.nativeColor; return /* @__PURE__ */ x.jsxs("div", { className: rn.cfPreview, children: [ /* @__PURE__ */ x.jsx("div", { style: { ...v, background: y, border: `1px solid ${e.config.nativeColor || Vt}` } }), /* @__PURE__ */ x.jsx("div", { style: { ...v, background: d, border: `1px solid ${e.config.positiveColor || Ft}` } }) ] }); } case K.colorScale: return r && /* @__PURE__ */ x.jsx("div", { className: rn.cfPreview, children: r.map((c, v) => /* @__PURE__ */ x.jsx("div", { style: { width: `${100 / r.length}%`, height: "100%", background: c } }, v)) }); case K.iconSet: return n && /* @__PURE__ */ x.jsx("div", { className: rn.cfPreview, children: n.map((c, v) => c ? /* @__PURE__ */ x.jsx("img", { style: { height: "100%" }, src: c }, v) : /* @__PURE__ */ x.jsx(Zt, {}, v)) }); case K.highlightCell: { const { ul: c, st: v, it: d, bl: y, bg: p, cl: C } = e.style, _ = (c == null ? void 0 : c.s) === De.TRUE, w = (v == null ? void 0 : v.s) === De.TRUE, S = d === De.TRUE, R = y === De.TRUE, h = (i = p == null ? void 0 : p.rgb) != null ? i : _o, s = (o = C == null ? void 0 : C.rgb) != null ? o : xo, a = { fontWeight: R ? "bold" : void 0, fontStyle: S ? "italic" : void 0, textDecoration: `${_ ? "underline" : ""} ${w ? "line-through" : ""}`.replace(/^ /, "") || void 0, backgroundColor: h, color: s }; return /* @__PURE__ */ x.jsx("div", { style: a, className: rn.cfPreview, children: "123" }); } } return null; }, Da = "univer-cf-rule-list", Ma = "univer-rule-selector", Na = "univer-select", ja = "univer-select-selector", La = "univer-select-selection-item", $a = "univer-select-selection-search-input", za = "univer-btn-list", Fa = "univer-gap", Va = "univer-icon", qa = "univer-disabled", Aa = "univer-rule-item", Wa = "univer-rule-describe", Ha = "univer-rule-type", Ua = "univer-rule-range", ka = "univer-active", Ba = "univer-draggableHandle", Ga = "univer-delete-item", Xa = "univer-grid-layout-wrap", Ya = "univer-react-grid-item", be = { cfRuleList: Da, ruleSelector: Ma, select: Na, selectSelector: ja, selectSelectionItem: La, selectSelectionSearchInput: $a, btnList: za, gap: Fa, icon: Va, disabled: qa, ruleItem: Aa, ruleDescribe: Wa, ruleType: Ha, ruleRange: Ua, active: ka, draggableHandle: Ba, deleteItem: Ga, gridLayoutWrap: Xa, reactGridItem: Ya }, Ka = (t, e) => { const r = t.rule; switch (r.type) { case K.colorScale: return e.t("sheet.cf.ruleType.colorScale"); case K.dataBar: return e.t("sheet.cf.ruleType.dataBar"); case K.iconSet: return e.t("sheet.cf.ruleType.iconSet"); case K.highlightCell: switch (r.subType) { case G.average: { const n = r.operator; return e.t(`sheet.cf.preview.describe.${n}`, e.t("sheet.cf.subRuleType.average")); } case G.duplicateValues: return e.t("sheet.cf.subRuleType.duplicateValues"); case G.uniqueValues: return e.t("sheet.cf.subRuleType.uniqueValues"); case G.number: { const n = r.operator; return e.t(`sheet.cf.preview.describe.${n}`, ...Array.isArray(r.value) ? r.value.map((i) => String(i)) : [String(r.value || "")]); } case G.text: { const n = r.operator; return e.t(`sheet.cf.preview.describe.${n}`, r.value || ""); } case G.timePeriod: { const n = r.operator; return e.t(`sheet.cf.preview.describe.${n}`); } case G.rank: return r.isPercent ? r.isBottom ? e.t("sheet.cf.preview.describe.bottomNPercent", String(r.value)) : e.t("sheet.cf.preview.describe.topNPercent", String(r.value)) : r.isBottom ? e.t("sheet.cf.preview.describe.bottomN", String(r.value)) : e.t("sheet.cf.preview.describe.topN", String(r.value)); case G.formula: return e.t("sheet.cf.ruleType.formula"); } } }; let ti = 0; const Za = (t) => { const { onClick: e } = t, r = he(me), n = he(ue), i = he(ct), o = he(ge), c = he(Ie), v = he(We), d = he(mt), y = ko(() => n.getCurrentTypeOfUnit$(re.UNIVER_SHEET), void 0, void 0, []), p = y.getUnitId(), C = y.getActiveSheet(); if (!C) throw new Error("No active sheet found"); const _ = C.getSheetId(), [w, S] = H([]), [R, h] = H("2"), [s, a] = H(0), [u, b] = H(-1), [l, g] = H(ti), f = Fe(null), m = [ { label: c.t("sheet.cf.panel.workSheet"), value: "2" }, { label: c.t("sheet.cf.panel.selectedRange"), value: "1" } ], P = () => { const A = r.getSubunitRules(p, _); if (!A || !A.length) return []; if (R === "1") { const F = i.getCurrentLastSelection(); if (!F) return []; const oe = F.range; return A.filter((de) => de.ranges.some((ye) => Be.intersects(ye, oe))); } else if (R === "2") return [...A]; return []; }, [M, j] = H(P); rs(w), we(() => { const A = o.onCommandExecuted((F) => { F.id === rr.id && a(Math.random()); }); return () => A.dispose(); }), we(() => { j(P); }, [R, s, p, _]), we(() => { if (R === "2") return; const A = new ot((F) => { const oe = [jo.id, _e.id, Ve.id, Ne.id, fn.id], se = o.onCommandExecuted((de) => { const { id: ye, params: Ee } = de, $e = n.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(); oe.includes(ye) && Ee.unitId === $e && F.next(null); }); return () => se.dispose(); }).pipe(Sr(16)).subscribe(() => { j(P); }); return () => { A.unsubscribe(); }; }, [n, R, p, _]), we(() => { const A = r.$ruleChange.subscribe(() => { a(Math.random()); }); return () => A.unsubscribe(); }, [r]), we(() => { const A = () => { var de; const se = Math.max(0, (((de = f.current) == null ? void 0 : de.getBoundingClientRect().width) || 0) - 8); return ti = se, se; }, oe = new ot((se) => { const de = document.querySelector(".univer-sidebar"); if (de) { let ye = setTimeout(() => { se.next(); }, 150); const Ee = () => { ye && clearTimeout(ye), ye = null; }, $e = (V) => { V.propertyName === "width" && (Ee(), se.next()); }; return de.addEventListener("transitionend", $e), () => { Ee(), de.removeEventListener("transitionend", $e); }; } }).pipe(Sr(16)).subscribe(() => { g(A()); }); return () => { oe.unsubscribe(); }; }, []); const N = (A) => { var se; const F = n.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(), oe = (se = n.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : se.getSheetId(); if (!F || !oe) throw new Error("No active sheet found"); o.executeCommand(mn.id, { unitId: F, subUnitId: oe, cfId: A.cfId }); }, I = (A, F) => { b(F.y); }, O = (A, F, oe) => { var V; b(-1); const se = n.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(), de = (V = n.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : V.getSheetId(); if (!se || !de) throw new Error("No active sheet found"); const ye = (Z) => { const ce = M.length; return Math.min(ce - 1, Math.max(0, Z)); }, Ee = M[ye(F.y)].cfId, $e = M[ye(oe.y)].cfId; Ee !== $e && o.executeCommand(lr.id, { unitId: se, subUnitId: de, start: { id: Ee, type: "self" }, end: { id: $e, type: oe.y > F.y ? "after" : "before" } }); }, z = () => { t.onCreate(); }, U = () => { R === "2" ? o.executeCommand(On.id) : R === "1" && M.map((F) => ({ unitId: p, subUnitId: _, cfId: F.cfId })).forEach((F) => { o.executeCommand(mn.id, F); }); }, k = Se(() => { const A = n.getCurrentUnitForType(re.UNIVER_SHEET), F = A.getActiveSheet(); return M.filter((oe) => { const se = oe.ranges; return pn(v, A.getUnitId(), F.getSheetId(), se); }); }, [M]), ie = k.map((A, F) => ({ i: A.cfId, x: 0, w: 12, y: F, h: 1, isResizable: !1 })), ee = Se(() => { const A = n.getCurrentUnitForType(re.UNIVER_SHEET), F = A.getActiveSheet(); return M.every((oe) => { const se = oe.ranges; return pn(v, A.getUnitId(), F.getSheetId(), se); }); }, [M]); return /* @__PURE__ */ x.jsxs("div", { className: be.cfRuleList, children: [ /* @__PURE__ */ x.jsxs("div", { className: be.ruleSelector, children: [ /* @__PURE__ */ x.jsx("div", { children: d.tWithReactNode( "sheet.cf.panel.managerRuleSelect", /* @__PURE__ */ x.jsx(Me, { className: be.select, options: m, value: R, onChange: (A) => { h(A); } }) ).map((A, F) => /* @__PURE__ */ x.jsx("span", { children: A }, F)) }), /* @__PURE__ */ x.jsxs("div", { className: be.btnList, children: [ /* @__PURE__ */ x.jsx(mr, { title: c.t("sheet.cf.panel.createRule"), placement: "bottom", children: /* @__PURE__ */ x.jsx( "div", { className: ` ${be.icon} `, onClick: z, children: /* @__PURE__ */ x.jsx(Hi, {}) } ) }), M.length && ee ? /* @__PURE__ */ x.jsx(mr, { title: c.t("sheet.cf.panel.clear"), placement: "bottom", children: /* @__PURE__ */ x.jsx( "div", { className: ` ${be.gap} ${be.icon} `, onClick: U, children: /* @__PURE__ */ x.jsx(dn, {}) } ) }) : /* @__PURE__ */ x.jsx( "div", { className: ` ${be.gap} ${be.disabled} `, children: /* @__PURE__ */ x.jsx(dn, {}) } ) ] }) ] }), /* @__PURE__ */ x.jsx("div", { ref: f, className: be.gridLayoutWrap, children: l ? /* @__PURE__ */ x.jsx( xa, { onDragStop: O, onDragStart: I, layout: ie, cols: 12, rowHeight: 60, width: l, margin: [0, 10], draggableHandle: ".draggableHandle", children: k == null ? void 0 : k.map((A, F) => /* @__PURE__ */ x.jsx("div", { children: /* @__PURE__ */ x.jsxs( "div", { onMouseMove: () => { A.ranges !== w && S(A.ranges); }, onMouseLeave: () => S([]), onClick: () => { e(A); }, className: ` ${be.ruleItem} ${u === F ? be.active : ""} `, children: [ /* @__PURE__ */ x.jsx( "div", { className: ` ${be.draggableHandle} draggableHandle `, onClick: (oe) => oe.stopPropagation(), children: /* @__PURE__ */ x.jsx(Ui, {}) } ), /* @__PURE__ */ x.jsxs("div", { className: be.ruleDescribe, children: [ /* @__PURE__ */ x.jsx("div", { className: be.ruleType, children: Ka(A, c) }), /* @__PURE__ */ x.jsx("div", { className: be.ruleRange, children: A.ranges.map((oe) => Ii(oe)).join(",") }) ] }), /* @__PURE__ */ x.jsx("div", { className: be.preview, children: /* @__PURE__ */ x.jsx(Ct, { rule: A.rule }) }), /* @__PURE__ */ x.jsx( "div", { className: ` ${be.deleteItem} ${u === F ? be.active : ""} `, onClick: (oe) => { oe.stopPropagation(), N(A), S([]); }, children: /* @__PURE__ */ x.jsx(dn, {}) } ) ] } ) }, `${A.cfId}`)) } ) : null }) ] }); }, Ja = "univer-cf-color-picker", Qa = "univer-cf-color-picker-icon", el = "univer-icon-dropdown", Gn = { cfColorPicker: Ja, cfColorPickerIcon: Qa, iconDropdown: el }, lt = (t) => { const { color: e, onChange: r, disable: n = !1, iconId: i = "PaintBucket", className: o, isNeedDropdownIcon: c = !0 } = t, v = he(or), d = Se(() => new hi(e), [e]), y = v.get(i); return y && (n ? /* @__PURE__ */ x.jsx(y, { className: o, extend: { colorChannel1: d.isValid ? e : "rgb(var(--primary-color))" } }) : /* @__PURE__ */ x.jsx( sr, { overlay: /* @__PURE__ */ x.jsx( "div", { className: ` ${Gn.cfColorPicker} `, children: /* @__PURE__ */ x.jsx(Qo, { value: e, onChange: r }) } ), children: /* @__PURE__ */ x.jsxs( "span", { className: ` ${Gn.cfColorPickerIcon} ${o} `, children: [ /* @__PURE__ */ x.jsx(y, { extend: { colorChannel1: d.isValid ? e : "rgb(var(--primary-color))" } }), c && /* @__PURE__ */ x.jsx(Dn, { className: Gn.iconDropdown }) ] } ) } )); }, tl = "univer-cf-rule-style-editor", nl = "univer-cf-preview-wrap", rl = "univer-text", il = "univer-position-relative", ol = "univer-btn-list", sl = "univer-util-item", al = "univer-icon-set", ll = "univer-render-config", cl = "univer-flex", ul = "univer-width45", dl = "univer-icon-wrap", fl = "univer-icon", hl = "univer-dropdown-icon", pl = "univer-error-input", gl = "univer-error-text", ml = "univer-icon-group-list", vl = "univer-title", yl = "univer-group", bl = "univer-item-content", Sl = "univer-item-wrap", Cl = "univer-item", wl = "univer-icon-item-list-wrap", Rl = "univer-none", _l = "univer-icon-item-list", xl = "univer-width100", Il = "univer-stress", W = { cfRuleStyleEditor: tl, cfPreviewWrap: nl, text: rl, positionRelative: il, btnList: ol, utilItem: sl, iconSet: al, renderConfig: ll, flex: cl, width45: ul, iconWrap: dl, icon: fl, dropdownIcon: hl, errorInput: pl, errorText: gl, iconGroupList: ml, title: vl, group: yl, itemContent: bl, itemWrap: Sl, item: Cl, iconItemListWrap: wl, none: Rl, iconItemList: _l, width100: xl, stress: Il }, it = (t, e) => ({ label: e.t(`sheet.cf.valueType.${t}`), value: t }), Xn = (t) => { var S; const { type: e, className: r, onChange: n, id: i, value: o } = t, c = he(ue), v = c.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(), d = (S = c.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : S.getSheetId(), y = Se(() => String(o).startsWith("=") ? String(o) : "=", [o]), p = Se(() => [te.max, te.min, "none"].includes(e) ? { disabled: !0 } : [te.percent, te.percentile].includes(e) ? { min: 0, max: 100 } : { min: Number.MIN_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER }, [e]), C = Fe({}), [_, w] = H(!1); return Kt((R) => { var s; const h = (s = C.current) == null ? void 0 : s.handleOutClick; h && h(R, () => w(!1)); }), e === te.formula ? /* @__PURE__ */ x.jsx("div", { style: { width: "100%", marginLeft: 4 }, children: /* @__PURE__ */ x.jsx( Tn, { initValue: y, unitId: v, subUnitId: d, isFocus: _, onChange: (R = "") => { n(R || ""); }, onFocus: () => w(!0), actions: C.current } ) }) : /* @__PURE__ */ x.jsx(at, { className: r, value: Number(t.value) || 0, onChange: (R) => t.onChange(R || 0), ...p }); }, El = (t) => { var N; const { interceptorManager: e } = t, r = he(Ie), n = ((N = t.rule) == null ? void 0 : N.type) === K.colorScale ? t.rule : void 0, i = [it(te.num, r), it(te.percent, r), it(te.percentile, r), it(te.formula, r)], o = [it(te.min, r), ...i], c = [it("none", r), ...i], v = [it(te.max, r), ...i], [d, y] = H(() => { var O; const I = te.min; return n && ((O = n.config[0]) == null ? void 0 : O.value.type) || I; }), [p, C] = H(() => { var O; const I = "none"; return !n || n.config.length !== 3 ? I : ((O = n.config[1]) == null ? void 0 : O.value.type) || I; }), [_, w] = H(() => { var O; const I = te.max; return n && ((O = n.config[n.config.length - 1]) == null ? void 0 : O.value.type) || I; }), [S, R] = H(() => { if (!n) return 10; const O = n.config[0]; return (O == null ? void 0 : O.value.value) === void 0 ? 10 : O == null ? void 0 : O.value.value; }), [h, s] = H(() => { var z; if (!n || n.config.length !== 3) return 50; const O = (z = n.config[1]) == null ? void 0 : z.value.value; return O === void 0 ? 50 : O; }), [a, u] = H(() => { var z; if (!n) return 90; const O = (z = n.config[n.config.length - 1]) == null ? void 0 : z.value.value; return O === void 0 ? 90 : O; }), [b, l] = H(() => { var O; const I = "#d0d9fb"; return n && ((O = n.config[0]) == null ? void 0 : O.color) || I; }), [g, f] = H(() => { var O; const I = "#7790f3"; return !n || n.config.length !== 3 ? I : ((O = n.config[1]) == null ? void 0 : O.color) || I; }), [m, P] = H(() => { var O; const I = "#2e55ef"; return n && ((O = n.config[n.config.length - 1]) == null ? void 0 : O.color) || I; }), M = Se(() => (I) => { const { minType: O, medianType: z, maxType: U, minValue: k, medianValue: ie, maxValue: ee, minColor: A, medianColor: F, maxColor: oe } = I, se = []; return se.push({ color: A, value: { type: O, value: k } }), z !== "none" && se.push({ color: F, value: { type: z, value: ie } }), se.push({ color: oe, value: { type: U, value: ee } }), { config: se.map((ye, Ee) => ({ ...ye, index: Ee })), type: K.colorScale }; }, []); we(() => e.intercept(e.getInterceptPoints().submit, { handler() { return M({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m }); } }), [M, d, p, _, S, h, a, b, g, m, e]); const j = (I) => { t.onChange(M(I)); }; return /* @__PURE__ */ x.jsxs("div", { children: [ /* @__PURE__ */ x.jsx("div", { className: $.title, children: r.t("sheet.cf.panel.styleRule") }), /* @__PURE__ */ x.jsx( "div", { className: ` ${W.cfPreviewWrap} `, children: /* @__PURE__ */ x.jsx(Ct, { rule: M({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m }) }) } ), /* @__PURE__ */ x.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.min") }), /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.labelContainer} ${$.mTSm} `, children: [ /* @__PURE__ */ x.jsx( Me, { style: { flexShrink: 0 }, options: o, value: d, onChange: (I) => { y(I); const O = qt(I, 10); R(O), j({ minType: I, medianType: p, maxType: _, minValue: O, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m }); } } ), /* @__PURE__ */ x.jsx( Xn, { id: "min", className: ` ${$.mLXxs} `, value: S, type: d, onChange: (I) => { R(I), j({ minType: d, medianType: p, maxType: _, minValue: I, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m }); } } ), /* @__PURE__ */ x.jsx( lt, { className: $.mLXxs, color: b, onChange: (I) => { l(I), j({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: I, medianColor: g, maxColor: m }); } } ) ] } ), /* @__PURE__ */ x.jsx("div", { className: $.label, children: r.t("sheet.cf.panel.medianValue") }), /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.labelContainer} ${$.mTSm} `, children: [ /* @__PURE__ */ x.jsx( Me, { style: { flexShrink: 0 }, options: c, value: p, onChange: (I) => { C(I); const O = qt(I, 50); s(O), j({ minType: d, medianType: I, maxType: _, minValue: S, medianValue: O, maxValue: a, minColor: b, medianColor: g, maxColor: m }); } } ), /* @__PURE__ */ x.jsx( Xn, { id: "median", className: ` ${$.mLXxs} `, value: h, type: p, onChange: (I) => { s(I), j({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: I, maxValue: a, minColor: b, medianColor: g, maxColor: m }); } } ), p !== "none" && /* @__PURE__ */ x.jsx( lt, { className: $.mLXxs, color: g, onChange: (I) => { f(I), j({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: I, maxColor: m }); } } ) ] } ), /* @__PURE__ */ x.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.max") }), /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.labelContainer} ${$.mTSm} `, children: [ /* @__PURE__ */ x.jsx( Me, { style: { flexShrink: 0 }, options: v, value: _, onChange: (I) => { w(I); const O = qt(I, 90); u(O), j({ minType: d, medianType: p, maxType: I, minValue: S, medianValue: h, maxValue: O, minColor: b, medianColor: g, maxColor: m }); } } ), /* @__PURE__ */ x.jsx( Xn, { id: "max", className: ` ${$.mLXxs} `, value: a, type: _, onChange: (I) => { u(I), j({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: I, minColor: b, medianColor: g, maxColor: m }); } } ), /* @__PURE__ */ x.jsx( lt, { className: $.mLXxs, color: m, onChange: (I) => { P(I), j({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: I }); } } ) ] } ) ] }); }, ft = (t, e) => ({ label: e.t(`sheet.cf.valueType.${t}`), value: t }), ni = (t) => { var R; const { onChange: e, className: r, value: n, type: i, id: o, disabled: c = !1 } = t, v = he(ue), d = v.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(), y = (R = v.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : R.getSheetId(), p = Fe({}), [C, _] = H(!1); Kt((h) => { var a; const s = (a = p.current) == null ? void 0 : a.handleOutClick; s && s(h, () => _(!1)); }); const w = Fe(n), S = Se(() => [te.percentile, te.percent].includes(i) ? { max: 100, min: 0 } : { min: Number.MIN_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER }, [i]); if (i === te.formula) { const h = String(w.current).startsWith("=") ? String(w.current) || "" : "="; return /* @__PURE__ */ x.jsx("div", { style: { width: "100%", marginLeft: 12 }, children: /* @__PURE__ */ x.jsx( Tn, { initValue: h, unitId: d, subUnitId: y, isFocus: C, onChange: (s = "") => { e(s || ""); }, onFocus: () => _(!0), actions: p.current } ) }); } return /* @__PURE__ */ x.jsx( at, { className: r, value: Number(n) || 0, disabled: c, onChange: (h) => { e(h || 0); }, ...S } ); }, Tl = (t) => { var N; const { interceptorManager: e } = t, r = he(Ie), n = ((N = t.rule) == null ? void 0 : N.type) === K.dataBar ? t.rule : void 0, [i, o] = H(() => { var O; const I = "0"; return n ? (O = n.config) != null && O.isGradient ? "1" : "0" : I; }), [c, v] = H(() => { var I; return n ? ((I = n.config) == null ? void 0 : I.positiveColor) || Ft : Ft; }), [d, y] = H(() => { var I; return n ? ((I = n.config) == null ? void 0 : I.nativeColor) || Vt : Vt; }), p = [ft(te.num, r), ft(te.percent, r), ft(te.percentile, r), ft(te.formula, r)], C = [ft(te.min, r), ...p], _ = [ft(te.max, r), ...p], [w, S] = H(() => { var O; const I = C[0].value; return n && ((O = n.config) == null ? void 0 : O.min.type) || I; }), [R, h] = H(() => { var O; const I = _[0].value; return n && ((O = n.config) == null ? void 0 : O.max.type) || I; }), [s, a] = H(() => { var z; if (!n) return 0; const O = ((z = n.config) == null ? void 0 : z.min) || {}; return O.type === te.formula ? O.value || "=" : O.value || 0; }), [u, b] = H(() => { var z; if (!n) return 100; const O = ((z = n.config) == null ? void 0 : z.max) || {}; return O.type === te.formula ? O.value || "=" : O.value === void 0 ? 100 : O.value; }), [l, g] = H(() => n ? n.isShowValue === void 0 ? !0 : !!n.isShowValue : !0), f = (I) => ({ config: { min: { type: I.minValueType, value: I.minValue }, max: { type: I.maxValueType, value: I.maxValue }, isGradient: I.isGradient === "1", positiveColor: I.positiveColor || Ft, nativeColor: I.nativeColor || Vt }, type: K.dataBar, isShowValue: I.isShowValue }); we(() => e.intercept(e.getInterceptPoints().submit, { handler() { return f({ isGradient: i, minValue: s, minValueType: w, maxValue: u, maxValueType: R, positiveColor: c, nativeColor: d, isShowValue: l }); } }), [i, s, w, u, R, c, d, e, l]); const m = (I) => { t.onChange(f(I)); }, P = (I) => { v(I), m({ isGradient: i, minValue: s, minValueType: w, maxValue: u, maxValueType: R, positiveColor: I, nativeColor: d, isShowValue: l }); }, M = (I) => { y(I), m({ isGradient: i, minValue: s, minValueType: w, maxValue: u, maxValueType: R, positiveColor: c, nativeColor: I, isShowValue: l }); }, j = (I) => p.map((O) => O.value).includes(I); return /* @__PURE__ */ x.jsxs("div", { children: [ /* @__PURE__ */ x.jsx("div", { className: $.title, children: r.t("sheet.cf.panel.styleRule") }), /* @__PURE__ */ x.jsx( "div", { className: ` ${W.cfPreviewWrap} `, children: /* @__PURE__ */ x.jsx(Ct, { rule: f({ isGradient: i, minValue: s, minValueType: w, maxValue: u, maxValueType: R, positiveColor: c, nativeColor: d, isShowValue: l }) }) } ), /* @__PURE__ */ x.jsxs("div", { children: [ /* @__PURE__ */ x.jsx("div", { className: $.label, children: r.t("sheet.cf.panel.fillType") }), /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.mTSm} ${$.mLXxs} ${$.labelContainer} `, children: [ /* @__PURE__ */ x.jsxs( es, { value: i, onChange: (I) => { o(I), m({ isGradient: I, minValue: s, minValueType: w, maxValue: u, maxValueType: R, positiveColor: c, nativeColor: d, isShowValue: l }); }, children: [ /* @__PURE__ */ x.jsx(vr, { value: "0", children: /* @__PURE__ */ x.jsx("span", { className: W.text, children: r.t("sheet.cf.panel.pureColor") }) }), /* @__PURE__ */ x.jsx(vr, { value: "1", children: /* @__PURE__ */ x.jsx("span", { className: W.text, children: r.t("sheet.cf.panel.gradient") }) }) ] } ), /* @__PURE__ */ x.jsxs( "div", { className: ` ${W.utilItem} ${$.mLXl} `, children: [ /* @__PURE__ */ x.jsx( gn, { checked: !l, onChange: (I) => { g(!I), m({ isGradient: I, minValue: s, minValueType: w, maxValue: u, maxValueType: R, positiveColor: c, nativeColor: d, isShowValue: !I }); } } ), r.t("sheet.cf.panel.onlyShowDataBar") ] } ) ] } ) ] }), /* @__PURE__ */ x.jsxs("div", { children: [ /* @__PURE__ */ x.jsx("div", { className: $.label, children: r.t("sheet.cf.panel.colorSet") }), /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.labelContainer} ${$.mTSm} ${$.mLXxs} `, children: [ /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.labelContainer} `, children: [ /* @__PURE__ */ x.jsx( "div", { className: ` ${W.text} `, children: r.t("sheet.cf.panel.native") } ), /* @__PURE__ */ x.jsx( lt, { color: d, onChange: M } ) ] } ), /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.labelContainer} ${$.mLSm} `, children: [ /* @__PURE__ */ x.jsx( "div", { className: ` ${W.text} `, children: r.t("sheet.cf.panel.positive") } ), /* @__PURE__ */ x.jsx( lt, { color: c, onChange: P } ) ] } ) ] } ) ] }), /* @__PURE__ */ x.jsxs("div", { children: [ /* @__PURE__ */ x.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.min") }), /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.mTSm} ${$.labelContainer} `, children: [ /* @__PURE__ */ x.jsx( Me, { style: { width: "50%", flexShrink: 0 }, options: C, value: w, onChange: (I) => { S(I); const O = qt(I, 10); a(O), m({ isGradient: i, minValue: O, minValueType: I, maxValue: u, maxValueType: R, positiveColor: c, nativeColor: d, isShowValue: l }); } } ), /* @__PURE__ */ x.jsx( ni, { disabled: !j(w), id: "min", type: w, className: $.mLSm, value: s, onChange: (I) => { a(I || 0), m({ isGradient: i, minValue: I || 0, minValueType: w, maxValue: u, maxValueType: R, positiveColor: c, nativeColor: d, isShowValue: l }); } } ) ] } ), /* @__PURE__ */ x.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.max") }), /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.mTSm} ${$.labelContainer} `, children: [ /* @__PURE__ */ x.jsx( Me, { style: { width: "50%", flexShrink: 0 }, options: _, value: R, onChange: (I) => { h(I); const O = qt(I, 90); b(O), m({ isGradient: i, minValue: s, minValueType: w, maxValue: O, maxValueType: I, positiveColor: c, nativeColor: d, isShowValue: l }); } } ), /* @__PURE__ */ x.jsx( ni, { disabled: !j(R), id: "max", type: R, className: $.mLSm, value: u, onChange: (I) => { b(I || 0), m({ isGradient: i, minValue: s, minValueType: w, maxValue: I || 0, maxValueType: R, positiveColor: c, nativeColor: d, isShowValue: l }); } } ) ] } ) ] }) ] }); }; function io(t) { var e, r, n = ""; if (typeof t == "string" || typeof t == "number") n += t; else if (typeof t == "object") if (Array.isArray(t)) { var i = t.length; for (e = 0; e < i; e++) t[e] && (r = io(t[e])) && (n && (n += " "), n += r); } else for (r in t) t[r] && (n && (n += " "), n += r); return n; } function on() { for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = io(t)) && (n && (n += " "), n += e); return n; } const Pl = "univer-cf-style-edit", Ol = "univer-button-item", Dl = "univer-isActive", ke = { cfStyleEdit: Pl, buttonItem: Ol, isActive: Dl }, sn = (t) => [De.FALSE, void 0].includes(t) ? De.TRUE : De.FALSE, an = (t) => t !== De.FALSE, gr = (t) => { const { style: e, onChange: r, className: n } = t, i = he(or), [o, c] = H(() => { if (e != null && e.bl) return e.bl; }), [v, d] = H(() => { if (e != null && e.it) return e.it; }), [y, p] = H(() => { if (e != null && e.ul) return e.ul.s; }), [C, _] = H(() => { if (e != null && e.st) return e.st.s; }), [w, S] = H(() => { var g; const l = "#2f56ef"; return (g = e == null ? void 0 : e.cl) != null && g.rgb ? e.cl.rgb : l; }), [R, h] = H(() => { var g; const l = "#e8ecfc"; return (g = e == null ? void 0 : e.bg) != null && g.rgb ? e.bg.rgb : l; }), s = i.get("BoldSingle"), a = i.get("ItalicSingle"), u = i.get("UnderlineSingle"), b = i.get("StrikethroughSingle"); return we(() => { const l = { bl: o, it: v }; w !== void 0 && (l.cl = { rgb: w }), R !== void 0 && (l.bg = { rgb: R }), C !== void 0 && (l.st = { s: C }), y !== void 0 && (l.ul = { s: y }), r(Io(l)); }, [o, v, y, C, w, R]), /* @__PURE__ */ x.jsxs( "div", { className: ` ${ke.cfStyleEdit} ${n} `, children: [ s && /* @__PURE__ */ x.jsx("div", { className: on({ [ke.isActive]: an(o || De.FALSE) }, ke.buttonItem), onClick: () => c(sn(o)), children: /* @__PURE__ */ x.jsx(s, {}) }), a && /* @__PURE__ */ x.jsx("div", { className: on({ [ke.isActive]: an(v || De.FALSE) }, ke.buttonItem), onClick: () => d(sn(v)), children: /* @__PURE__ */ x.jsx(a, {}) }), u && /* @__PURE__ */ x.jsx("div", { className: on({ [ke.isActive]: an(y || De.FALSE) }, ke.buttonItem), onClick: () => p(sn(y)), children: /* @__PURE__ */ x.jsx(u, {}) }), b && /* @__PURE__ */ x.jsx("div", { className: on({ [ke.isActive]: an(C || De.FALSE) }, ke.buttonItem), onClick: () => _(sn(C)), children: /* @__PURE__ */ x.jsx(b, {}) }), /* @__PURE__ */ x.jsx(lt, { color: w, onChange: S, iconId: "FontColor" }), /* @__PURE__ */ x.jsx(lt, { color: R, onChange: h, iconId: "PaintBucket" }) ] } ); }, Ml = (t) => { var b; const { onChange: e, interceptorManager: r } = t, n = he(Ie), o = he(ue).getCurrentUnitForType(re.UNIVER_SHEET), c = o.getActiveSheet(), v = ((b = t.rule) == null ? void 0 : b.type) === K.highlightCell ? t.rule : void 0, d = Fe(null), [y, p] = H(!1), C = Fe({}), [_, w] = H({}), [S, R] = H(() => (v == null ? void 0 : v.subType) === G.formula ? v.value : "="), [h, s] = H(void 0), a = (l) => ({ style: l.style, value: S, type: K.highlightCell, subType: G.formula }); we(() => r.intercept(r.getInterceptPoints().submit, { handler() { return a({ style: _, formula: S }); } }), [_, S, r]), we(() => r.intercept(r.getInterceptPoints().beforeSubmit, { handler: (g, f, m) => h || S.length === 1 || !S.startsWith("=") ? (s(n.t("sheet.cf.errorMessage.formulaError")), !1) : m(g) }), [h, S]); const u = (l) => { e(a(l)); }; return Kt((l) => { var f; const g = (f = C.current) == null ? void 0 : f.handleOutClick; g && g(l, () => p(!1)); }), /* @__PURE__ */ x.jsxs("div", { ref: d, children: [ /* @__PURE__ */ x.jsx( "div", { className: ` ${$.title} ${$.mTBase} `, children: n.t("sheet.cf.panel.styleRule") } ), /* @__PURE__ */ x.jsx( "div", { className: ` ${$.mTSm} `, children: /* @__PURE__ */ x.jsx( Tn, { onChange: (l) => { R(l), u({ style: _, formula: l }); }, onVerify: (l, g) => { !l || g.length === 1 ? s(n.t("sheet.cf.errorMessage.formulaError")) : s(void 0); }, errorText: h, onFocus: () => { p(!0); }, actions: C.current, isFocus: y, initValue: S, unitId: o.getUnitId(), subUnitId: c == null ? void 0 : c.getSheetId() } ) } ), /* @__PURE__ */ x.jsx( "div", { className: ` ${W.cfPreviewWrap} `, children: /* @__PURE__ */ x.jsx(Ct, { rule: a({ style: _, formula: S }) }) } ), /* @__PURE__ */ x.jsx( gr, { style: v == null ? void 0 : v.style, className: ` ${$.mTSm} `, onChange: (l) => { w(l), u({ style: l, formula: S }); } } ) ] }); }, ln = (t) => /* @__PURE__ */ x.jsxs("div", { style: { position: "relative" }, children: [ /* @__PURE__ */ x.jsx( "div", { style: { position: "absolute", zIndex: 999, bottom: "-13px", fontSize: "10px", color: "red" }, children: t.errorText } ), t.children ] }), fe = (t, e) => ({ label: e.t(`sheet.cf.operator.${t}`), value: t }), Nl = (t) => { const { type: e, operator: r, onChange: n, value: i, interceptorManager: o } = t, c = he(Ie), [v, d] = H(() => typeof i == "number" ? i : 0), [y, p] = H(""), [C, _] = H(() => typeof i == "string" ? i : ""), [w, S] = H(""), [R, h] = H(() => Array.isArray(i) ? i[0] === void 0 ? 0 : i[0] : 0), [s, a] = H(""), [u, b] = H(() => Array.isArray(i) ? i[1] === void 0 ? 100 : i[1] : 100), [l, g] = H(""); switch (we(() => { switch (e) { case G.text: { [ le.beginsWith, le.endsWith, le.containsText, le.notContainsText, le.equal, le.notEqual ].includes(r) && n(C); break; } case G.number: { [ J.equal, J.notEqual, J.greaterThan, J.greaterThanOrEqual, J.lessThan, J.lessThanOrEqual ].includes(r) && n(v), [J.between, J.notBetween].includes(r) && n([R, u]); break; } } }, [e]), we(() => { const f = o.intercept(o.getInterceptPoints().beforeSubmit, { handler: (m, P, M) => { switch (e) { case G.text: if ([ le.beginsWith, le.containsText, le.endsWith, le.notEqual, le.notContainsText, le.equal ].includes(r)) return C ? M(m) : (S(c.t("sheet.cf.errorMessage.notBlank")), !1); } return M(m); } }); return () => { f(); }; }, [e, v, C, r]), e) { case G.text: { if ([ le.beginsWith, le.endsWith, le.containsText, le.notContainsText, le.equal, le.notEqual ].includes(r)) { const f = (m) => { _(m), n(m); }; return /* @__PURE__ */ x.jsx( "div", { className: ` ${$.mTSm} `, children: /* @__PURE__ */ x.jsx(ln, { errorText: w, children: /* @__PURE__ */ x.jsx( ts, { className: W.width100, value: C, onChange: (m) => { S(""), f(m); } } ) }) } ); } break; } case G.number: { if ([ J.equal, J.notEqual, J.greaterThan, J.greaterThanOrEqual, J.lessThan, J.lessThanOrEqual ].includes(r)) { const f = (m) => { d(m || 0), n(m || 0), p(""); }; return /* @__PURE__ */ x.jsx( "div", { className: ` ${$.mTSm} `, children: /* @__PURE__ */ x.jsx(ln, { errorText: y, children: /* @__PURE__ */ x.jsx(at, { min: Number.MIN_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER, className: W.width100, value: v, onChange: f }) }) } ); } if ([J.between, J.notBetween].includes(r)) { const f = (P) => { h(P || 0), n([P || 0, u]), a(""); }, m = (P) => { b(P || 0), n([R, P || 0]), g(""); }; return /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.mTSm} ${$.labelContainer} `, children: [ /* @__PURE__ */ x.jsx(ln, { errorText: s, children: /* @__PURE__ */ x.jsx(at, { min: Number.MIN_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER, value: R, onChange: f }) }), /* @__PURE__ */ x.jsx(ln, { errorText: l, children: /* @__PURE__ */ x.jsx( at, { min: Number.MIN_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER, className: ` ${$.mLSm} `, value: u, onChange: m } ) }) ] } ); } } } return null; }, ri = (t, e) => { switch (t) { case G.text: return [ fe(le.containsText, e), fe(le.notContainsText, e), fe(le.beginsWith, e), fe(le.endsWith, e), fe(le.equal, e), fe(le.notEqual, e), fe(le.containsBlanks, e), fe(le.notContainsBlanks, e), fe(le.containsErrors, e), fe(le.notContainsErrors, e) ]; case G.number: return [ fe(J.between, e), fe(J.notBetween, e), fe(J.equal, e), fe(J.notEqual, e), fe(J.greaterThan, e), fe(J.greaterThanOrEqual, e), fe(J.lessThan, e), fe(J.lessThanOrEqual, e) ]; case G.timePeriod: return [ fe(qe.yesterday, e), fe(qe.today, e), fe(qe.tomorrow, e), fe(qe.last7Days, e), fe(qe.lastWeek, e), fe(qe.thisWeek, e), fe(qe.nextWeek, e), fe(qe.lastMonth, e), fe(qe.thisMonth, e), fe(qe.nextMonth, e) ]; } }, ii = (t) => { var b; const { interceptorManager: e, onChange: r } = t, n = he(Ie), i = ((b = t.rule) == null ? void 0 : b.type) === K.highlightCell ? t.rule : void 0, [o, c] = H(() => { const l = G.text; return i && i.subType || l; }), v = [ { value: G.text, label: n.t("sheet.cf.subRuleType.text") }, { value: G.number, label: n.t("sheet.cf.subRuleType.number") }, { value: G.timePeriod, label: n.t("sheet.cf.subRuleType.timePeriod") }, { value: G.duplicateValues, label: n.t("sheet.cf.subRuleType.duplicateValues") }, { value: G.uniqueValues, label: n.t("sheet.cf.subRuleType.uniqueValues") } ], d = Se(() => ri(o, n), [o]), [y, p] = H(() => { const l = d ? d[0].value : void 0; return i && i.operator || l; }), [C, _] = H(() => { var f; const l = ""; return i ? (f = i.value) != null ? f : hn(i.subType, i.operator) : l; }), [w, S] = H({}), R = Se(() => (l) => { var g, f, m, P, M, j, N, I, O, z, U, k, ie, ee, A; switch (l.subType || o) { case G.text: { if ([ le.beginsWith, le.endsWith, le.containsText, le.notContainsText, le.equal, le.notEqual ].includes(y)) return { type: K.highlightCell, subType: (g = l.subType) != null ? g : o, operator: (f = l.operator) != null ? f : y, style: (m = l.style) != null ? m : w, value: (P = l.value) != null ? P : C }; break; } case G.number: { if ([ J.equal, J.notEqual, J.greaterThan, J.greaterThanOrEqual, J.lessThan, J.lessThanOrEqual ].includes(y)) return { type: K.highlightCell, subType: (M = l.subType) != null ? M : o, operator: (j = l.operator) != null ? j : y, style: (N = l.style) != null ? N : w, value: (I = l.value) != null ? I : C }; if ([J.between, J.notBetween].includes(y)) return { type: K.highlightCell, subType: (O = l.subType) != null ? O : o, operator: (z = l.operator) != null ? z : y, style: (U = l.style) != null ? U : w, value: (k = l.value) != null ? k : C }; break; } } return { type: K.highlightCell, subType: (ie = l.subType) != null ? ie : o, operator: (ee = l.operator) != null ? ee : y, style: (A = l.style) != null ? A : w }; }, [o, y, C, w]); we(() => e.intercept(e.getInterceptPoints().submit, { handler() { return R({}); } }), [R, e]), we(() => { v.some((l) => l.value === o) || c(v[0].value); }, [v]); const h = (l) => { const g = l, f = ri(g, n), m = f && f[0].value; c(g), p(m), m && _(hn(g, m)), r(R({ subType: g, operator: m })); }, s = (l) => { const g = l; p(g), r(R({ operator: g })); }, a = (l) => { _(l), r(R({ value: l })); }, u = Se(() => `${o}_${y}_${Math.random()}`, [o, y]); return /* @__PURE__ */ x.jsxs("div", { children: [ /* @__PURE__ */ x.jsx( "div", { className: ` ${$.title} ${$.mTBase} `, children: n.t("sheet.cf.panel.styleRule") } ), /* @__PURE__ */ x.jsx( Me, { className: ` ${$.mTSm} ${W.width100} `, onChange: h, value: o, options: v } ), (d == null ? void 0 : d.length) && /* @__PURE__ */ x.jsx( Me, { className: ` ${$.mTSm} ${W.width100} `, onChange: s, value: y || "", options: d } ), /* @__PURE__ */ x.jsx(Nl, { value: C, interceptorManager: e, type: o, operator: y, rule: i, onChange: a }, u), /* @__PURE__ */ x.jsx( "div", { className: ` ${W.cfPreviewWrap} `, children: /* @__PURE__ */ x.jsx(Ct, { rule: R({}) }) } ), /* @__PURE__ */ x.jsx( gr, { style: i == null ? void 0 : i.style, className: ` ${$.mLXxs} `, onChange: (l) => { S(l), r(R({ style: l })); } } ) ] }); }, oo = (t, e) => (st[t] || [])[Number(e)] || "", jl = (t) => { var d; const e = he(ue), r = e.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(), n = (d = e.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : d.getSheetId(), i = Se(() => t.error ? W.errorInput : "", [t.error]), o = Fe({}), [c, v] = H(!1); return Kt((y) => { var C; const p = (C = o.current) == null ? void 0 : C.handleOutClick; p && p(y, () => v(!1)); }), /* @__PURE__ */ x.jsx("div", { className: W.positionRelative, children: t.type !== te.formula ? /* @__PURE__ */ x.jsxs(x.Fragment, { children: [ /* @__PURE__ */ x.jsx(at, { className: i, value: Number(t.value) || 0, onChange: (y) => t.onChange(y != null ? y : 0) }), t.error && /* @__PURE__ */ x.jsx("div", { className: W.errorText, children: t.error }) ] }) : /* @__PURE__ */ x.jsx("div", { style: { width: "100%" }, children: /* @__PURE__ */ x.jsx( Tn, { initValue: String(t.value), unitId: r, subUnitId: n, isFocus: c, onChange: (y = "") => { const p = y || ""; t.onChange(p); }, onFocus: () => v(!0), actions: o.current } ) }) }); }, oi = (t, e, r) => ({ operator: J.greaterThan, value: { type: te.num, value: (r.length - 1 - e) * 10 }, iconType: t, iconId: String(e) }), Ll = ut((t, e) => { const r = he(Ie), n = (i) => { t.onClick(i); }; return /* @__PURE__ */ x.jsx("div", { ref: e, className: W.iconGroupList, children: Eo.map((i, o) => /* @__PURE__ */ x.jsxs("div", { className: W.group, children: [ /* @__PURE__ */ x.jsx("div", { className: W.title, children: r.t(i.title) }), /* @__PURE__ */ x.jsx("div", { className: W.itemContent, children: i.group.map((c) => /* @__PURE__ */ x.jsx("div", { className: W.itemWrap, onClick: () => { n(c.name); }, children: /* @__PURE__ */ x.jsx("div", { className: W.item, children: c.list.map((v, d) => /* @__PURE__ */ x.jsx("img", { className: W.icon, src: v }, d)) }) }, c.name)) }) ] }, o)) }); }), $l = (t) => { const e = Se(() => { const n = []; for (const i in st) { const o = st[i], c = i; o.forEach((v, d) => { n.push({ iconType: c, base64: v, iconId: String(d) }); }); } return n; }, []), r = (n) => { t.onClick(n.iconType, n.iconId); }; return /* @__PURE__ */ x.jsxs("div", { className: W.iconItemListWrap, children: [ /* @__PURE__ */ x.jsxs("div", { className: W.none, onClick: () => r({ iconType: Po, iconId: "", base64: "" }), children: [ /* @__PURE__ */ x.jsx(Zt, { className: W.icon }), /* @__PURE__ */ x.jsx("span", { children: "无单元格图标" }) ] }), /* @__PURE__ */ x.jsx("div", { className: W.iconItemList, children: e.map((n) => /* @__PURE__ */ x.jsx("div", { className: W.item, children: /* @__PURE__ */ x.jsx( "img", { onClick: () => r(n), className: ` ${W.icon} `, src: n.base64 } ) }, `${n.iconType}_${n.iconId}`)) }) ] }); }, zl = (t) => { const { onChange: e, configList: r, errorMap: n = {} } = t, i = he(Ie), o = [ { label: i.t(`sheet.cf.symbol.${J.greaterThan}`), value: J.greaterThan }, { label: i.t(`sheet.cf.symbol.${J.greaterThanOrEqual}`), value: J.greaterThanOrEqual } ], c = [ { label: i.t(`sheet.cf.valueType.${te.num}`), value: te.num }, { label: i.t(`sheet.cf.valueType.${te.percent}`), value: te.percent }, { label: i.t(`sheet.cf.valueType.${te.percentile}`), value: te.percentile }, { label: i.t(`sheet.cf.valueType.${te.formula}`), value: te.formula } ], v = (C, _) => { e([String(_), "value", "value"], C); }, d = (C, _) => { e([String(_), "operator"], C); const w = hn(G.number, C); v(w, _); }, y = (C, _) => { e([String(_), "value", "type"], C); const w = r[_], S = hn(G.number, w.operator); v(S, _); }; return Se(() => r.map((C, _) => { const w = n[_], S = oo(C.iconType, C.iconId), R = _ === r.length - 1, h = _ === 0, s = r[_ - 1], a = (s == null ? void 0 : s.value.type) === te.formula ? i.t("sheet.cf.valueType.formula") : s == null ? void 0 : s.value.value, u = (b, l) => { const g = { ...C, iconId: l, iconType: b }; e([String(_)], g); }; return /* @__PURE__ */ x.jsxs( "div", { className: ` ${_ ? $.mTXl : $.mTSm} `, children: [ /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.label} ${W.flex} `, children: [ /* @__PURE__ */ x.jsxs( "div", { className: ` ${W.width45} `, children: [ i.t("sheet.cf.iconSet.icon"), _ + 1 ] } ), /* @__PURE__ */ x.jsx( "div", { className: ` ${W.width45} `, children: /* @__PURE__ */ x.jsxs(x.Fragment, { children: [ !h && !R && i.t("sheet.cf.iconSet.rule"), !h && !R && /* @__PURE__ */ x.jsxs("span", { className: W.stress, children: [ "(", i.t("sheet.cf.iconSet.when"), i.t(`sheet.cf.symbol.${Qn(s.operator)}`), a, R ? "" : ` ${i.t("sheet.cf.iconSet.and")} `, ")" ] }) ] }) } ) ] } ), /* @__PURE__ */ x.jsxs( "div", { className: ` ${W.flex} ${$.mTSm} `, children: [ /* @__PURE__ */ x.jsx( "div", { className: ` ${W.iconWrap} ${W.width45} `, children: /* @__PURE__ */ x.jsx(sr, { overlay: /* @__PURE__ */ x.jsx($l, { onClick: u, iconId: C.iconId, iconType: C.iconType }), children: /* @__PURE__ */ x.jsxs("div", { className: W.dropdownIcon, children: [ S ? /* @__PURE__ */ x.jsx("img", { src: S, className: W.icon }) : /* @__PURE__ */ x.jsx(Zt, { className: W.icon }), /* @__PURE__ */ x.jsx(Dn, {}) ] }) }) } ), R ? /* @__PURE__ */ x.jsxs( "div", { className: ` ${W.width45} ${$.label} `, style: { marginTop: 0 }, children: [ i.t("sheet.cf.iconSet.rule"), /* @__PURE__ */ x.jsxs("span", { className: W.stress, children: [ "(", i.t("sheet.cf.iconSet.when"), i.t(`sheet.cf.symbol.${Qn(s.operator)}`), a, R ? "" : ` ${i.t("sheet.cf.iconSet.and")} `, ")" ] }) ] } ) : /* @__PURE__ */ x.jsx( Me, { className: ` ${$.mL0} ${W.width45} ${$.mR0} `, options: o, value: C.operator, onChange: (b) => { d(b, _); } } ) ] } ), R ? /* @__PURE__ */ x.jsx("div", {}) : /* @__PURE__ */ x.jsxs(x.Fragment, { children: [ /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.mTSm} ${$.label} ${W.flex} `, children: [ /* @__PURE__ */ x.jsx( "div", { className: ` ${W.width45} `, children: i.t("sheet.cf.iconSet.type") } ), /* @__PURE__ */ x.jsx( "div", { className: ` ${W.width45} `, children: i.t("sheet.cf.iconSet.value") } ) ] } ), /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.mTSm} ${W.flex} `, children: [ /* @__PURE__ */ x.jsx( Me, { style: { flexShrink: 0 }, className: ` ${W.width45} ${$.mL0} `, options: c, value: C.value.type, onChange: (b) => { y(b, _); } } ), /* @__PURE__ */ x.jsx( "div", { className: ` ${$.mL0} ${W.width45} `, children: /* @__PURE__ */ x.jsx( jl, { id: _, type: C.value.type, error: w, value: C.value.value || "", onChange: (b) => v(b, _) } ) } ) ] } ) ] }) ] }, _ ); }), [r, n]); }, Fl = (t) => { var b; const { interceptorManager: e } = t, r = ((b = t.rule) == null ? void 0 : b.type) === K.iconSet ? t.rule : void 0, n = he(Ie), [i, o] = H({}), [c, v] = H(() => { const l = Object.keys(st)[0]; if (r && r.config.length) { const g = r.config[0].iconType; if (!r.config.some((m) => m.iconType !== g)) return g; } return l; }), [d, y] = H(() => { if (r && r.config.length) return tr.deepClone(r == null ? void 0 : r.config); const l = st[c] || []; return new Array(l.length).fill("").map((g, f, m) => f === m.length - 1 ? { operator: J.lessThanOrEqual, value: { type: te.num, value: Number.MAX_SAFE_INTEGER }, iconType: c, iconId: String(f) } : oi(c, f, m)); }), [p, C] = H(() => r ? !!r.isShowValue : !0), _ = Se(() => { const l = d.map((g) => oo(g.iconType, g.iconId)); return /* @__PURE__ */ x.jsx("div", { className: W.iconWrap, children: l.map((g, f) => g ? /* @__PURE__ */ x.jsx( "img", { className: W.icon, src: g }, f ) : /* @__PURE__ */ x.jsx(Zt, { className: W.icon }, f)) }); }, [d]), w = (l) => { if (l.reduce((f, m, P) => f.preType && !f.result || l.length - 1 === P ? f : m.value.type === te.formula ? { preType: te.formula, result: !1 } : f.preType ? { result: f.preType === m.value.type, preType: m.value.type } : { result: !0, preType: m.value.type }, { result: !0, preType: "" }).result && [te.num, te.percent, te.percentile].includes(l[0].value.type)) { const f = {}; return l.forEach((m, P, M) => { if (P - 1 < 0 || P === M.length - 1) return; const N = l[P - 1], I = Qn(N.operator); To({ operator: I, value: N.value.value }, m.value.value) || (f[P] = `${n.t(`sheet.cf.form.${I}`, String(N.value.value))} `); }), f; } return {}; }, S = (l, g) => { go(d, l) !== g && (mo(d, l, g), y([...d]), o(w(d))); }, R = (l) => { v(l); const g = st[l] || [], f = new Array(g.length).fill("").map((m, P, M) => oi(l, P, M)); y(f), o(w(f)); }; we(() => { const l = e.intercept(e.getInterceptPoints().submit, { handler() { return { type: K.iconSet, isShowValue: p, config: d }; } }); return () => { l(); }; }, [p, d, e]), we(() => { const l = e.intercept(e.getInterceptPoints().beforeSubmit, { handler() { return Object.keys(i).length === 0; } }); return () => { l(); }; }, [p, d, e, i]); const h = () => { const l = d.map((g) => ({ ...g })); d.forEach((g, f) => { const m = d.length - 1 - f, P = l[m]; g.iconId = P.iconId, g.iconType = P.iconType; }), y([...d]); }, s = he(Bo), [a, u] = H(); return Go(a, s.rootContainerElement), /* @__PURE__ */ x.jsxs("div", { className: W.iconSet, children: [ /* @__PURE__ */ x.jsx("div", { className: $.title, children: n.t("sheet.cf.panel.styleRule") }), /* @__PURE__ */ x.jsx( "div", { className: ` ${$.mTSm} `, children: /* @__PURE__ */ x.jsx( sr, { placement: "bottomLeft", overlay: /* @__PURE__ */ x.jsx( Ll, { ref: (l) => !a && l && u(l), iconType: c, onClick: R } ), children: /* @__PURE__ */ x.jsxs("div", { className: W.dropdownIcon, style: { width: "unset" }, children: [ _, /* @__PURE__ */ x.jsx(Dn, {}) ] }) } ) } ), /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.mTSm} ${W.renderConfig} `, children: [ /* @__PURE__ */ x.jsxs("div", { className: W.utilItem, children: [ /* @__PURE__ */ x.jsx(gn, { onChange: h }), n.t("sheet.cf.iconSet.reverseIconOrder") ] }), /* @__PURE__ */ x.jsxs( "div", { className: ` ${W.utilItem} ${$.mLXl} `, children: [ /* @__PURE__ */ x.jsx(gn, { checked: !p, onChange: (l) => { C(!l); } }), n.t("sheet.cf.iconSet.onlyShowIcon") ] } ) ] } ), /* @__PURE__ */ x.jsx(zl, { errorMap: i, onChange: S, configList: d }) ] }); }, Vl = (t) => { var h; const { onChange: e, interceptorManager: r } = t, n = he(Ie), i = ((h = t.rule) == null ? void 0 : h.type) === K.highlightCell ? t.rule : void 0, o = [ { label: n.t("sheet.cf.panel.isNotBottom"), value: "isNotBottom" }, { label: n.t("sheet.cf.panel.isBottom"), value: "isBottom" }, { label: n.t("sheet.cf.panel.greaterThanAverage"), value: "greaterThanAverage" }, { label: n.t("sheet.cf.panel.lessThanAverage"), value: "lessThanAverage" } ], [c, v] = H(() => { const s = o[0].value, a = i == null ? void 0 : i.type; if (!i) return s; switch (a) { case K.highlightCell: switch (i.subType) { case G.average: return [J.greaterThan, J.greaterThanOrEqual].includes(i.operator) ? "greaterThanAverage" : [J.lessThan, J.lessThanOrEqual].includes(i.operator) ? "lessThanAverage" : s; case G.rank: return i.isBottom ? "isBottom" : "isNotBottom"; } } return s; }), [d, y] = H(() => { const a = i == null ? void 0 : i.type; if (!i) return 10; switch (a) { case K.highlightCell: switch (i.subType) { case G.rank: return i.value || 10; } } return 10; }), [p, C] = H(() => { const a = i == null ? void 0 : i.type; if (!i) return !1; switch (a) { case K.highlightCell: switch (i.subType) { case G.rank: return i.isPercent || !1; } } return !1; }), [_, w] = H({}), S = (s) => { const { type: a, isPercent: u, value: b, style: l } = s; if (a === "isNotBottom") return { type: K.highlightCell, subType: G.rank, isPercent: u, isBottom: !1, value: b, style: l }; if (a === "isBottom") return { type: K.highlightCell, subType: G.rank, isPercent: u, isBottom: !0, value: b, style: l }; if (a === "greaterThanAverage") return { type: K.highlightCell, subType: G.average, operator: J.greaterThan, style: l }; if (a === "lessThanAverage") return { type: K.highlightCell, subType: G.average, operator: J.lessThan, style: l }; }; we(() => r.intercept(r.getInterceptPoints().submit, { handler() { return S({ type: c, isPercent: p, value: d, style: _ }); } }), [c, p, d, _, r]); const R = (s) => { e(S(s)); }; return /* @__PURE__ */ x.jsxs("div", { children: [ /* @__PURE__ */ x.jsx( "div", { className: ` ${$.title} ${$.mTBase} `, children: n.t("sheet.cf.panel.styleRule") } ), /* @__PURE__ */ x.jsx( Me, { className: ` ${W.width100} ${$.mTSm} `, value: c, options: o, onChange: (s) => { v(s), R({ type: s, isPercent: p, value: d, style: _ }); } } ), ["isNotBottom", "isBottom"].includes(c) && /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.labelContainer} ${$.mTSm} `, children: [ /* @__PURE__ */ x.jsx( at, { min: 1, max: 1e3, value: d, onChange: (s) => { const a = s || 0; y(a), R({ type: c, isPercent: p, value: a, style: _ }); } } ), /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.mLSm} ${$.labelContainer} ${W.text} `, children: [ /* @__PURE__ */ x.jsx( gn, { checked: p, onChange: (s) => { C(!!s), R({ type: c, isPercent: !!s, value: d, style: _ }); } } ), n.t("sheet.cf.valueType.percent") ] } ) ] } ), /* @__PURE__ */ x.jsx( "div", { className: ` ${W.cfPreviewWrap} `, children: /* @__PURE__ */ x.jsx(Ct, { rule: S({ type: c, isPercent: p, value: d, style: _ }) }) } ), /* @__PURE__ */ x.jsx( gr, { style: i == null ? void 0 : i.style, className: ` ${$.mTSm} `, onChange: (s) => { w(s), R({ type: c, isPercent: p, value: d, style: s }); } } ) ] }); }, ql = pi("beforeSubmit"), Al = pi("submit"), si = (t) => t.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(), ai = (t) => { var e; return (e = t.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : e.getSheetId(); }, Wl = (t) => { var M, j, N; const e = he(Ie), r = he(ge), n = he(ue), i = he(me), o = he(ct), c = si(n), v = ai(n), [d, y] = H(!0), p = Fe({}), [C, _] = H(void 0), w = Fe((j = (M = t.rule) == null ? void 0 : M.ranges) != null ? j : []), S = Se(() => { var O, z, U; let I = (O = t.rule) == null ? void 0 : O.ranges; return I != null && I.length || (I = (U = (z = o.getCurrentSelections()) == null ? void 0 : z.map((k) => k.range)) != null ? U : []), w.current = I, I != null && I.length ? I.map((k) => { const ie = Ii(k); return ie === "NaN" ? "" : ie; }).filter((k) => !!k).join(",") : ""; }, [t.rule]), R = [ { label: e.t("sheet.cf.ruleType.highlightCell"), value: "1" }, { label: e.t("sheet.cf.panel.rankAndAverage"), value: "2" }, { label: e.t("sheet.cf.ruleType.dataBar"), value: "3" }, { label: e.t("sheet.cf.ruleType.colorScale"), value: "4" }, { label: e.t("sheet.cf.ruleType.formula"), value: "5" }, { label: e.t("sheet.cf.ruleType.iconSet"), value: "6" } ], [h, s] = H(() => { var z, U; const I = (z = t.rule) == null ? void 0 : z.rule.type, O = R[0].value; if (!I) return O; switch (I) { case K.highlightCell: { switch ((U = t.rule) == null ? void 0 : U.rule.subType) { case G.number: case G.text: case G.duplicateValues: case G.uniqueValues: case G.timePeriod: return "1"; case G.average: case G.rank: return "2"; case G.formula: return "5"; } break; } case K.dataBar: return "3"; case K.colorScale: return "4"; case K.iconSet: return "6"; } return O; }), a = Fe(), u = Se(() => new vo({ beforeSubmit: ql, submit: Al }), []), b = Se(() => { switch (h) { case "1": return ii; case "2": return Vl; case "3": return Tl; case "4": return El; case "5": return Ml; case "6": return Fl; default: return ii; } }, [h]); we(() => { const I = r.onCommandExecuted((O) => { if (O.id === Lo.id) { const z = O.params; z.subUnitId === v && z.unitId === c && t.onCancel(); } O.id === rr.id && t.onCancel(); }); return () => I.dispose(); }, []); const l = (I) => { a.current = I; }, g = (I) => { const O = I.split(",").filter((z) => !!z).map(ns).map((z) => z.range); w.current = O; }, f = () => { if (C) return; const O = (() => { const U = n.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet(); if (!U) throw new Error("No active sheet found"); return w.current.map((ee) => $o(ee, U.getRowCount(), U.getColumnCount())).filter((ee) => !(Number.isNaN(ee.startRow) || Number.isNaN(ee.startColumn))); })(); if (u.fetchThroughInterceptors(u.getInterceptPoints().beforeSubmit)(!0, null)) { const U = u.fetchThroughInterceptors(u.getInterceptPoints().submit)(null, null); if (U) { const k = si(n), ie = ai(n); if (!k || !ie) throw new Error("No active sheet found"); let ee = {}; t.rule && t.rule.cfId ? (ee = { ...t.rule, ranges: O, rule: U }, r.executeCommand(cr.id, { unitId: k, subUnitId: ie, rule: ee }), t.onCancel()) : (ee = { cfId: i.createCfId(k, ie), ranges: O, rule: U, stopIfTrue: !1 }, r.executeCommand(Pn.id, { unitId: k, subUnitId: ie, rule: ee }), t.onCancel()); } } }, m = () => { t.onCancel(); }, P = (I, O) => { I ? O.length < 1 ? _(e.t("sheet.cf.errorMessage.rangeError")) : _(void 0) : _(e.t("sheet.cf.errorMessage.rangeError")); }; return Kt((I) => { var z; const O = (z = p.current) == null ? void 0 : z.handleOutClick; O && O(I, () => y(!1)); }), /* @__PURE__ */ x.jsxs("div", { className: W.cfRuleStyleEditor, children: [ /* @__PURE__ */ x.jsx("div", { className: $.title, children: e.t("sheet.cf.panel.range") }), /* @__PURE__ */ x.jsx( "div", { className: ` ${$.mTBase} `, children: /* @__PURE__ */ x.jsx( ds, { unitId: c, errorText: C, subUnitId: v, initValue: S, onChange: g, onVerify: P, onFocus: () => y(!0), isFocus: d, actions: p.current } ) } ), /* @__PURE__ */ x.jsx("div", { className: $.title, children: e.t("sheet.cf.panel.styleType") }), /* @__PURE__ */ x.jsx("div", { className: $.mTBase, children: /* @__PURE__ */ x.jsx(Me, { className: W.width100, value: h, options: R, onChange: (I) => s(I) }) }), /* @__PURE__ */ x.jsx(b, { interceptorManager: u, rule: (N = t.rule) == null ? void 0 : N.rule, onChange: l }), /* @__PURE__ */ x.jsxs( "div", { className: ` ${$.mTBase} ${W.btnList} `, children: [ /* @__PURE__ */ x.jsx(yr, { size: "small", onClick: m, children: e.t("sheet.cf.panel.cancel") }), /* @__PURE__ */ x.jsx(yr, { className: $.mLSm, size: "small", type: "primary", onClick: f, children: e.t("sheet.cf.panel.submit") }) ] } ) ] }); }, Hl = (t) => { const [e, r] = H(t.rule), [n, i] = H(!!t.rule), o = () => { i(!0); }, c = () => { i(!1), r(void 0); }, v = (d) => { r(d), i(!0); }; return /* @__PURE__ */ x.jsx("div", { className: $.conditionalFormattingWrap, children: n ? /* @__PURE__ */ x.jsx(Wl, { onCancel: c, rule: e }) : /* @__PURE__ */ x.jsx(Za, { onClick: v, onCreate: o }) }); }; var Ul = Object.defineProperty, kl = Object.getOwnPropertyDescriptor, Bl = (t, e, r, n) => { for (var i = n > 1 ? void 0 : n ? kl(e, r) : e, o = t.length - 1, c; o >= 0; o--) (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i); return n && i && Ul(e, r, i), i; }, Mt = (t, e) => (r, n) => e(r, n, t); const cn = "sheet.conditional.formatting.panel"; let Ht = class extends je { constructor(e, r, n, i, o) { super(); Xe(this, "_sidebarDisposable", null); this._univerInstanceService = e, this._injector = r, this._componentManager = n, this._sidebarService = i, this._localeService = o, this._initPanel(), this.disposeWithMe( this._univerInstanceService.getCurrentTypeOfUnit$(re.UNIVER_SHEET).subscribe((c) => { var v; c || (v = this._sidebarDisposable) == null || v.dispose(); }) ), this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe((c) => { c.id === cn && (c.visible || setTimeout(() => { this._sidebarService.sidebarOptions$.next({ visible: !1 }); })); })); } openPanel(e) { const r = { id: cn, header: { title: this._localeService.t("sheet.cf.title") }, children: { label: cn, rule: e, key: yo(4) }, onClose: () => this._sidebarDisposable = null }; this._sidebarDisposable = this._sidebarService.open(r); } _initPanel() { this._componentManager.register(cn, Hl); } }; Ht = Bl([ Mt(0, ue), Mt(1, Q(We)), Mt(2, Q(or)), Mt(3, Q(Xo)), Mt(4, Q(Ie)) ], Ht); var Te = /* @__PURE__ */ ((t) => (t[t.createRule = 1] = "createRule", t[t.viewRule = 2] = "viewRule", t[t.highlightCell = 3] = "highlightCell", t[t.rank = 4] = "rank", t[t.formula = 5] = "formula", t[t.colorScale = 6] = "colorScale", t[t.dataBar = 7] = "dataBar", t[t.icon = 8] = "icon", t[t.clearRangeRules = 9] = "clearRangeRules", t[t.clearWorkSheetRules = 10] = "clearWorkSheetRules", t))(Te || {}); const jn = { id: "sheet.operation.open.conditional.formatting.panel", type: Re.OPERATION, handler: (t, e) => { var v; const r = t.get(Ht), n = t.get(ct), i = t.get(ge), o = ((v = n.getCurrentSelections()) == null ? void 0 : v.map((d) => d.range)) || []; switch (e.value) { case 3: { r.openPanel({ ...nt(), ranges: o }); break; } case 4: { const d = { ...nt, ranges: o, rule: { type: K.highlightCell, subType: G.rank } }; r.openPanel(d); break; } case 5: { const d = { ...nt, ranges: o, rule: { type: K.highlightCell, subType: G.formula, value: "=" } }; r.openPanel(d); break; } case 6: { const d = { ...nt, ranges: o, rule: { type: K.colorScale, config: [] } }; r.openPanel(d); break; } case 7: { const d = { ...nt, ranges: o, rule: { type: K.dataBar, isShowValue: !0 } }; r.openPanel(d); break; } case 8: { const d = { ...nt, ranges: o, rule: { type: K.iconSet, config: [], isShowValue: !0 } }; r.openPanel(d); break; } case 2: { r.openPanel(); break; } case 1: { r.openPanel({ ...nt(), ranges: o }); break; } case 9: { i.executeCommand(ar.id, { ranges: o }); break; } case 10: { i.executeCommand(On.id); break; } } return !0; } }; var Gl = Object.defineProperty, Xl = Object.getOwnPropertyDescriptor, Yl = (t, e, r, n) => { for (var i = n > 1 ? void 0 : n ? Xl(e, r) : e, o = t.length - 1, c; o >= 0; o--) (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i); return n && i && Gl(e, r, i), i; }, Nt = (t, e) => (r, n) => e(r, n, t); let Ut = class extends je { constructor(e, r, n, i, o) { super(); Xe(this, "_copyInfo"); this._sheetClipboardService = e, this._conditionalFormattingRuleModel = r, this._injector = n, this._conditionalFormattingViewModel = i, this._univerInstanceService = o, this._initClipboardHook(); } _initClipboardHook() { this.disposeWithMe( this._sheetClipboardService.addClipboardHook({ id: Yt, onBeforeCopy: (e, r, n) => this._collectConditionalRule(e, r, n), onPasteCells: (e, r, n, i) => { const { copyType: o = br.COPY, pasteType: c } = i, { range: v } = e || {}, { range: d } = r; return this._generateConditionalFormattingMutations(d, { copyType: o, pasteType: c, copyRange: v }); } }) ); } _collectConditionalRule(e, r, n) { const i = new Ze(), o = {}; this._copyInfo = { matrix: i, info: { unitId: e, subUnitId: r, cfMap: o } }; const c = this._injector.invoke((p) => os(n, p, e, r)); if (!c) return; const { rows: v, cols: d } = c, y = /* @__PURE__ */ new Set(); v.forEach((p, C) => { d.forEach((_, w) => { const S = this._conditionalFormattingViewModel.getCellCfs(e, r, p, _); S && (S.forEach((R) => y.add(R.cfId)), i.setValue(C, w, S.map((R) => R.cfId))); }); }), y.forEach((p) => { const C = this._conditionalFormattingRuleModel.getRule(e, r, p); C && (o[p] = C.rule); }); } // eslint-disable-next-line max-lines-per-function _generateConditionalFormattingMutations(e, r) { const n = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET), i = n.getActiveSheet(), o = n.getUnitId(); if (!i) return { redos: [], undos: [] }; const c = i.getSheetId(); if (r.copyType === br.CUT) return this._copyInfo = null, { redos: [], undos: [] }; if (!this._copyInfo || !r.copyRange) return { redos: [], undos: [] }; if (![ zn.SPECIAL_PASTE_FORMAT, zn.DEFAULT_PASTE, zn.SPECIAL_PASTE_BESIDES_BORDER ].includes( r.pasteType )) return { redos: [], undos: [] }; const { ranges: [d, y], mapFunc: p } = Ei([r.copyRange, e]), C = ss(d, y, !0), _ = {}; ze.foreach(y, (l, g) => { const { row: f, col: m } = p(l, g), P = this._conditionalFormattingViewModel.getCellCfs(o, c, f, m); P && P.forEach((M) => { if (!_[M.cfId]) { const j = new Ze(); _[M.cfId] = j; const N = this._conditionalFormattingRuleModel.getRule(o, c, M.cfId); N == null || N.ranges.forEach((I) => { ze.foreach(I, (O, z) => { j.setValue(O, z, 1); }); }); } _[M.cfId].realDeleteValue(f, m); }); }); const { matrix: w, info: S } = this._copyInfo, R = []; let h = this._conditionalFormattingRuleModel.createCfId(o, c); const s = {}, a = (l) => { if (s[l]) return s[l]; const g = S == null ? void 0 : S.cfMap[l], f = [...this._conditionalFormattingRuleModel.getSubunitRules(o, c) || [], ...R].find((m) => tr.diffValue(m.rule, g)); if (f) return s[l] = f, f; { const m = { rule: g, cfId: h, ranges: [], stopIfTrue: !1 }; return s[l] = m, R.push(m), h = `${Number(h) + 1}`, m; } }; C.forEach((l) => { w && w.forValue((g, f, m) => { const P = Be.getPositionRange( { startRow: g, endRow: g, startColumn: f, endColumn: f }, l.startRange ), { row: M, col: j } = p(P.startRow, P.startColumn); m.forEach((N) => { if (!_[N]) { const I = a(N), O = new Ze(); _[N] = O, I.ranges.forEach((z) => { ze.foreach(z, (U, k) => { O.setValue(U, k, 1); }); }); } _[N].setValue(M, j, 1); }); }); }); const u = [], b = []; for (const l in _) { const g = _[l], f = At(Wt(g)); if (!f.length) { const m = { unitId: o, subUnitId: c, cfId: l }; u.push({ id: Ne.id, params: m }), b.push(...Ge(this._injector, m)); } if (R.some((m) => m.cfId === l)) { const m = a(l), P = { unitId: o, subUnitId: c, rule: { ...m, ranges: f } }; u.push({ id: _e.id, params: P }), b.push(nr(this._injector, P)); } else { const m = this._conditionalFormattingRuleModel.getRule(o, c, l); if (!m) continue; const P = { unitId: o, subUnitId: c, rule: { ...m, ranges: f } }; u.push({ id: Ve.id, params: P }), b.push(...Je(this._injector, P)); } } return { redos: u, undos: b }; } }; Ut = Yl([ Nt(0, Q(is)), Nt(1, Q(me)), Nt(2, Q(We)), Nt(3, Q(Xt)), Nt(4, Q(ue)) ], Ut); var Kl = Object.defineProperty, Zl = Object.getOwnPropertyDescriptor, Jl = (t, e, r, n) => { for (var i = n > 1 ? void 0 : n ? Zl(e, r) : e, o = t.length - 1, c; o >= 0; o--) (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i); return n && i && Kl(e, r, i), i; }, Yn = (t, e) => (r, n) => e(r, n, t); let kt = class extends je { constructor(t, e, r) { super(), this._localeService = t, this._commandService = e, this._sheetPermissionCheckController = r, this._commandExecutedListener(); } _commandExecutedListener() { this.disposeWithMe( this._commandService.beforeCommandExecuted((t) => { t.id === Pn.id && (this._sheetPermissionCheckController.permissionCheckWithRanges({ workbookTypes: [wi], rangeTypes: [Ri], worksheetTypes: [_i, xi] }, t.params.rule.ranges) || this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr"))); }) ); } }; kt = Jl([ Yn(0, Q(Ie)), Yn(1, ge), Yn(2, Q(zo)) ], kt); var Ql = Object.defineProperty, ec = Object.getOwnPropertyDescriptor, tc = (t, e, r, n) => { for (var i = n > 1 ? void 0 : n ? ec(e, r) : e, o = t.length - 1, c; o >= 0; o--) (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i); return n && i && Ql(e, r, i), i; }, un = (t, e) => (r, n) => e(r, n, t); let Bt = class extends je { constructor(t, e, r, n) { super(), this._conditionalFormattingRuleModel = t, this._univerInstanceService = e, this._injector = r, this._refRangeService = n, this._initRefRange(); } _initRefRange() { const t = /* @__PURE__ */ new Map(), e = (n, i, o) => `${n}_${i}_${o}`, r = (n, i, o) => { const c = (d) => { const y = [...o.ranges], p = y.map((_) => Vo(_, d)).filter((_) => !!_); if (Oo(p, y)) return { redos: [], undos: [] }; if (p.length) { const _ = { unitId: n, subUnitId: i, rule: { ...o, ranges: p } }, w = [{ id: Ve.id, params: _ }], S = Je(this._injector, _); return { redos: w, undos: S }; } else { const _ = { unitId: n, subUnitId: i, cfId: o.cfId }, w = [{ id: Ne.id, params: _ }], S = Ge(this._injector, _); return { redos: w, undos: S }; } }, v = []; o.ranges.forEach((d) => { const y = this._refRangeService.registerRefRange(d, c); v.push(() => y.dispose()); }), t.set(e(n, i, o.cfId), () => v.forEach((d) => d())); }; this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((n) => { const { unitId: i, subUnitId: o, rule: c } = n, v = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET), d = v.getActiveSheet(); if (!(n.unitId !== v.getUnitId() || n.subUnitId !== (d == null ? void 0 : d.getSheetId()))) switch (n.type) { case "add": { r(n.unitId, n.subUnitId, n.rule); break; } case "delete": { const y = t.get(e(i, o, c.cfId)); y && y(); break; } case "set": { const y = t.get(e(i, o, c.cfId)); y && y(), r(n.unitId, n.subUnitId, n.rule); } } })), this.disposeWithMe(gi(() => { t.forEach((n) => { n(); }), t.clear(); })); } }; Bt = tc([ un(0, Q(me)), un(1, Q(ue)), un(2, Q(We)), un(3, Q(Fo)) ], Bt); var nc = Object.defineProperty, rc = Object.getOwnPropertyDescriptor, ic = (t, e, r, n) => { for (var i = n > 1 ? void 0 : n ? rc(e, r) : e, o = t.length - 1, c; o >= 0; o--) (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i); return n && i && nc(e, r, i), i; }, ht = (t, e) => (r, n) => e(r, n, t); let Gt = class extends je { constructor(e, r, n, i, o, c) { super(); /** * When a set operation is triggered multiple times over a short period of time, it may result in some callbacks not being disposed,and caused a render cache exception. * The solution here is to store all the asynchronous tasks and focus on processing after the last callback */ Xe(this, "_ruleChangeCacheMap", /* @__PURE__ */ new Map()); this._sheetInterceptorService = e, this._conditionalFormattingService = r, this._univerInstanceService = n, this._renderManagerService = i, this._conditionalFormattingViewModel = o, this._conditionalFormattingRuleModel = c, this._initViewModelInterceptor(), this._initSkeleton(), this.disposeWithMe(() => { this._ruleChangeCacheMap.clear(); }); } _markDirtySkeleton() { var r, n, i; const e = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(); (r = this._renderManagerService.getRenderById(e)) == null || r.with(Ti).reCalculate(), (i = (n = this._renderManagerService.getRenderById(e)) == null ? void 0 : n.mainComponent) == null || i.makeDirty(); } _initSkeleton() { this.disposeWithMe(Oi(this._conditionalFormattingRuleModel.$ruleChange, this._conditionalFormattingViewModel.markDirty$).pipe( fs(16), Cr((e) => !!e.length), Cr((e) => { const r = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET); if (!r) return !1; const n = r.getActiveSheet(); return n ? e.filter((i) => i.unitId === r.getUnitId() && i.subUnitId === n.getSheetId()).length > 0 : !1; }) ).subscribe(() => this._markDirtySkeleton())); } _initViewModelInterceptor() { this.disposeWithMe(this._sheetInterceptorService.intercept(qo.CELL_CONTENT, { effect: bo.Style, handler: (e, r, n) => { const i = this._conditionalFormattingService.composeStyle(r.unitId, r.subUnitId, r.row, r.col); if (!i) return n(e); const o = r.workbook.getStyles(), v = { ...(typeof (e == null ? void 0 : e.s) == "string" ? o.get(e == null ? void 0 : e.s) : e == null ? void 0 : e.s) || {} }, d = { ...e, s: v }; return i.style && Object.assign(v, i.style), d.fontRenderExtension || (d.fontRenderExtension = {}, i.isShowValue !== void 0 && (d.fontRenderExtension.isSkip = !i.isShowValue)), i.dataBar && (d.dataBar = i.dataBar), i.iconSet && (d.iconSet = i.iconSet, d.fontRenderExtension.leftOffset = Do + Mo), n(d); }, priority: 10 })); } }; Gt = ic([ ht(0, Q(ir)), ht(1, Q(Si)), ht(2, Q(ue)), ht(3, Q(Di)), ht(4, Q(Xt)), ht(5, Q(me)) ], Gt); const so = "sheets-conditional-formatting-ui.config", bn = {}; var ao = Object.defineProperty, oc = Object.getOwnPropertyDescriptor, sc = (t, e, r) => e in t ? ao(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ac = (t, e, r, n) => { for (var i = n > 1 ? void 0 : n ? oc(e, r) : e, o = t.length - 1, c; o >= 0; o--) (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i); return n && i && ao(e, r, i), i; }, Kn = (t, e) => (r, n) => e(r, n, t), lo = (t, e, r) => sc(t, typeof e != "symbol" ? e + "" : e, r); let Sn = class extends vi { constructor(t = bn, e, r, n) { super(), this._config = t, this._injector = e, this._commandService = r, this._configService = n; const { menu: i, ...o } = yi( {}, bn, this._config ); i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(so, o), this._initCommand(), this._injector.add([Gt]), this._injector.add([Bt]), this._injector.add([Ut]), this._injector.add([kt]), this._injector.add([mt]); } _initCommand() { [ Mi, Ni, ji, Li, $i, zi, Fi, Vi, qi, jn, mn, cr, lr, Pn, ar, On ].forEach((t) => { this._commandService.registerCommand(t); }); } }; lo(Sn, "pluginName", `${Yt}_MOBILE_UI_PLUGIN`); lo(Sn, "type", re.UNIVER_SHEET); Sn = ac([ mi(Ci), Kn(1, Q(We)), Kn(2, Q(ge)), Kn(3, bi) ], Sn); var lc = Object.defineProperty, cc = Object.getOwnPropertyDescriptor, uc = (t, e, r, n) => { for (var i = n > 1 ? void 0 : n ? cc(e, r) : e, o = t.length - 1, c; o >= 0; o--) (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i); return n && i && lc(e, r, i), i; }, jt = (t, e) => (r, n) => e(r, n, t); let Cn = class extends je { constructor(t, e, r, n, i) { super(), this._injector = t, this._univerInstanceService = e, this._autoFillService = r, this._conditionalFormattingRuleModel = n, this._conditionalFormattingViewModel = i, this._initAutoFill(); } // eslint-disable-next-line max-lines-per-function _initAutoFill() { const t = () => ({ redos: [], undos: [] }), e = (i, o, c, v, d) => { var w; const y = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(), p = (w = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : w.getSheetId(); if (!y || !p) return; const C = { startRow: i.row, startColumn: i.col, endColumn: i.col, endRow: i.row }, _ = { startRow: o.row, startColumn: o.col, endColumn: o.col, endRow: o.row }; ze.foreach(c, (S, R) => { const h = Be.getPositionRange( { startRow: S, startColumn: R, endColumn: R, endRow: S }, C ), s = Be.getPositionRange( { startRow: S, startColumn: R, endColumn: R, endRow: S }, _ ), { row: a, col: u } = d(h.startRow, h.startColumn), b = this._conditionalFormattingViewModel.getCellCfs( y, p, a, u ), { row: l, col: g } = d(s.startRow, s.startColumn), f = this._conditionalFormattingViewModel.getCellCfs( y, p, l, g ); f && f.forEach((m) => { let P = v.get(m.cfId); if (!v.get(m.cfId)) { const M = this._conditionalFormattingRuleModel.getRule(y, p, m.cfId); if (!M) return; P = new Ze(), M.ranges.forEach((j) => { ze.foreach(j, (N, I) => { P.setValue(N, I, 1); }); }), v.set(m.cfId, P); } P.realDeleteValue(l, g); }), b && b.forEach((m) => { let P = v.get(m.cfId); if (!v.get(m.cfId)) { const M = this._conditionalFormattingRuleModel.getRule(y, p, m.cfId); if (!M) return; P = new Ze(), M.ranges.forEach((j) => { ze.foreach(j, (N, I) => { P.setValue(N, I, 1); }); }), v.set(m.cfId, P); } P.setValue(l, g, 1); }); }); }, r = (i, o) => { var s, a, u; const c = (s = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET)) == null ? void 0 : s.getUnitId(), v = (u = (a = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET)) == null ? void 0 : a.getActiveSheet()) == null ? void 0 : u.getSheetId(), d = /* @__PURE__ */ new Map(), y = [], p = []; if (!c || !v) return t(); const C = Ei([i, o]), [_, w] = C.ranges, { mapFunc: S } = C, R = { row: _.startRow, col: _.startColumn }; return ls(_, w).forEach((b) => { e(R, b.repeatStartCell, b.relativeRange, d, S); }), d.forEach((b, l) => { const g = this._conditionalFormattingRuleModel.getRule(c, v, l); if (!g) return; const f = At(Wt(b)); if (f.length) { const m = { unitId: c, subUnitId: v, rule: { ...g, ranges: f } }; y.push({ id: Ve.id, params: m }), p.push(...Je(this._injector, m)); } else { const m = { unitId: c, subUnitId: v, cfId: g.cfId }; y.push({ id: Ne.id, params: m }), p.push(...Ge(this._injector, m)); } }), { undos: p, redos: y }; }, n = { id: Yt, onFillData: (i, o, c) => { if (c === Fn.COPY || c === Fn.ONLY_FORMAT || c === Fn.SERIES) { const { source: v, target: d } = i; return r(v, d); } return t(); } }; this.disposeWithMe(this._autoFillService.addHook(n)); } }; Cn = uc([ jt(0, Q(We)), jt(1, Q(ue)), jt(2, Q(as)), jt(3, Q(me)), jt(4, Q(Xt)) ], Cn); var dc = Object.defineProperty, fc = Object.getOwnPropertyDescriptor, hc = (t, e, r, n) => { for (var i = n > 1 ? void 0 : n ? fc(e, r) : e, o = t.length - 1, c; o >= 0; o--) (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i); return n && i && dc(e, r, i), i; }, Lt = (t, e) => (r, n) => e(r, n, t); let wn = class extends je { constructor(t, e, r, n, i) { super(), this._injector = t, this._univerInstanceService = e, this._sheetInterceptorService = r, this._selectionManagerService = n, this._conditionalFormattingRuleModel = i, this._init(); } _init() { this.disposeWithMe(this._sheetInterceptorService.interceptCommand({ getMutations: (t) => { var i; const e = [], r = [], n = { redos: e, undos: r }; if ([Ao.id, Wo.id].includes(t.id)) { const o = (i = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : i.map((w) => w.range); if (!o) return n; const c = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET), v = c.getActiveSheet(); if (!v) return n; const d = c.getUnitId(), y = v.getSheetId(), p = this._conditionalFormattingRuleModel.getSubunitRules(d, y); if (!p || !p.length) return n; const { redos: C, undos: _ } = li(this._injector, p, o, d, y); e.push(...C), r.push(..._); } return n; } })), this.disposeWithMe(this._sheetInterceptorService.interceptRanges({ getMutations: ({ unitId: t, subUnitId: e, ranges: r }) => { const n = [], i = [], o = { redos: n, undos: i }; if (!r || !r.length) return o; const c = this._conditionalFormattingRuleModel.getSubunitRules(t, e); if (!c || !c.length) return o; const { redos: v, undos: d } = li(this._injector, c, r, t, e); return n.push(...v), i.push(...d), o; } })); } }; wn = hc([ Lt(0, Q(We)), Lt(1, Q(ue)), Lt(2, Q(ir)), Lt(3, Q(ct)), Lt(4, Q(me)) ], wn); function li(t, e, r, n, i) { const o = [], c = []; return e.filter((v) => r.some((d) => v.ranges.some((y) => Be.getIntersects(y, d)))).forEach((v) => { const y = new Ho().add(...v.ranges).subtract(...r).merge(); if (y.length) { const p = { id: Ve.id, params: { unitId: n, subUnitId: i, rule: { ...v, ranges: y } } }, C = Je(t, p.params); o.push(p), c.push(...C); } else { const p = { id: Ne.id, params: { unitId: n, subUnitId: i, cfId: v.cfId } }, C = Ge(t, p.params); o.push(p), c.push(...C); } }), { redos: o, undos: c }; } var pc = Object.defineProperty, gc = Object.getOwnPropertyDescriptor, mc = (t, e, r, n) => { for (var i = n > 1 ? void 0 : n ? gc(e, r) : e, o = t.length - 1, c; o >= 0; o--) (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i); return n && i && pc(e, r, i), i; }, ci = (t, e) => (r, n) => e(r, n, t); let Rn = class extends je { constructor(t, e) { super(), this._sheetInterceptorService = t, this._conditionalFormattingService = e, this._initInterceptorEditorEnd(); } /** * Process the values after edit * @private * @memberof NumfmtService */ _initInterceptorEditorEnd() { this.disposeWithMe( gi( this._sheetInterceptorService.writeCellInterceptor.intercept( Uo, { handler: (t, e, r) => { var c, v, d; t || r(t); const n = this._conditionalFormattingService.composeStyle(e.unitId, e.subUnitId, e.row, e.col), i = (c = n == null ? void 0 : n.style) != null ? c : {}, o = Object.keys(i); if (t != null && t.p) return (d = (v = t.p.body) == null ? void 0 : v.textRuns) == null || d.forEach((y) => { y.ts && o.forEach((p) => { var C; (C = y.ts) == null || delete C[p]; }); }), r(t); { const y = { ...(typeof (t == null ? void 0 : t.s) == "string" ? e.workbook.getStyles().get(t.s) : t == null ? void 0 : t.s) || {} }; o.forEach((C) => { delete y[C]; }); const p = { ...t, s: { ...y } }; return r(p); } } } ) ) ); } }; Rn = mc([ ci(0, Q(ir)), ci(1, Q(Si)) ], Rn); const ui = [ rr.id, _e.id, Ve.id, Ne.id, fn.id ], $t = [ { label: "sheet.cf.ruleType.highlightCell", value: Te.highlightCell }, { label: "sheet.cf.panel.rankAndAverage", value: Te.rank }, { label: "sheet.cf.ruleType.formula", value: Te.formula }, { label: "sheet.cf.ruleType.colorScale", value: Te.colorScale }, { label: "sheet.cf.ruleType.dataBar", value: Te.dataBar }, { label: "sheet.cf.ruleType.iconSet", value: Te.icon }, { label: "sheet.cf.menu.manageConditionalFormatting", value: Te.viewRule }, { label: "sheet.cf.menu.createConditionalFormatting", value: Te.createRule }, { label: "sheet.cf.menu.clearRangeRules", value: Te.clearRangeRules, disabled: !1 }, { label: "sheet.cf.menu.clearWorkSheetRules", value: Te.clearWorkSheetRules } ], vc = (t) => { const e = t.get(ct), r = t.get(ge), n = t.get(ue), i = t.get(me), o = new ot((d) => Oi( e.selectionMoveEnd$, e.selectionSet$, new ot((y) => { const p = r.onCommandExecuted((C) => { var R; const { id: _, params: w } = C, S = (R = n.getCurrentUnitForType(re.UNIVER_SHEET)) == null ? void 0 : R.getUnitId(); ui.includes(_) && w.unitId === S && y.next(null); }); return () => p.dispose(); }) ).pipe(wr(16)).subscribe(() => { var R; const y = ((R = e.getCurrentSelections()) == null ? void 0 : R.map((h) => h.range)) || [], p = n.getCurrentUnitForType(re.UNIVER_SHEET); if (!p) return; const C = p.getActiveSheet(); if (!C) return; const S = (i.getSubunitRules(p.getUnitId(), C.getSheetId()) || []).filter((h) => h.ranges.some((s) => y.some((a) => Be.intersects(a, s)))).map((h) => h.ranges).every((h) => pn(t, p.getUnitId(), C.getSheetId(), h)); d.next(S); })), c = new ot( (d) => new ot((y) => { const p = r.onCommandExecuted((C) => { var R; const { id: _, params: w } = C, S = (R = n.getCurrentUnitForType(re.UNIVER_SHEET)) == null ? void 0 : R.getUnitId(); ui.includes(_) && w.unitId === S && y.next(null); }); return () => p.dispose(); }).pipe(wr(16)).subscribe(() => { const y = n.getCurrentUnitForType(re.UNIVER_SHEET); if (!y) return; const p = y.getActiveSheet(); if (!p) return; const C = i.getSubunitRules(y.getUnitId(), p.getSheetId()) || []; if (!C.length) return d.next(!1), !1; const _ = C.map((w) => w.ranges).every((w) => pn(t, y.getUnitId(), p.getSheetId(), w)); d.next(_); }) ), v = new ot((d) => { o.subscribe((y) => { const p = $t.find((C) => C.value === Te.clearRangeRules); p && (p.disabled = !y, d.next($t)); }), c.subscribe((y) => { const p = $t.find((C) => C.value === Te.clearWorkSheetRules); p && (p.disabled = !y, d.next($t)); }), d.next($t); }); return { id: jn.id, type: Yo.SELECTOR, icon: "Conditions", tooltip: "sheet.cf.title", selections: v, hidden$: Ko(t, re.UNIVER_SHEET), disabled$: cs(t, { workbookTypes: [wi], worksheetTypes: [xi, _i], rangeTypes: [Ri] }) }; }, yc = { [Zo.FORMULAS_INSERT]: { [jn.id]: { order: 0, menuItemFactory: vc } } }; var bc = Object.defineProperty, Sc = Object.getOwnPropertyDescriptor, Cc = (t, e, r, n) => { for (var i = n > 1 ? void 0 : n ? Sc(e, r) : e, o = t.length - 1, c; o >= 0; o--) (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i); return n && i && bc(e, r, i), i; }, di = (t, e) => (r, n) => e(r, n, t); let _n = class extends je { constructor(e, r) { super(); Xe(this, "_sidebarDisposable", null); this._injector = e, this._menuManagerService = r, this._menuManagerService.mergeMenu(yc); } }; _n = Cc([ di(0, Q(We)), di(1, Jo) ], _n); var wc = Object.defineProperty, Rc = Object.getOwnPropertyDescriptor, _c = (t, e, r, n) => { for (var i = n > 1 ? void 0 : n ? Rc(e, r) : e, o = t.length - 1, c; o >= 0; o--) (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i); return n && i && wc(e, r, i), i; }, pt = (t, e) => (r, n) => e(r, n, t); const xc = (t, e) => { const r = (p) => p.endRow - p.startRow + 1, n = (p) => p.endColumn - p.startColumn + 1, i = r(e) % r(t), o = n(e) % n(t), c = Math.floor(r(e) / r(t)), v = Math.floor(n(e) / n(t)), d = [], y = { startRow: 0, endRow: r(t) - 1, startColumn: 0, endColumn: n(t) - 1 }; if (r(e) === 1 && n(e) === 1) { const p = { startRow: e.startRow, endRow: e.startRow, startColumn: e.startColumn, endColumn: e.startColumn }; return d.push({ repeatRelativeRange: y, startRange: p }), d; } for (let p = 0; p < c + (i ? 0.1 : 0); p++) for (let C = 0; C < v + (o ? 0.1 : 0); C++) { const _ = r(t) * p, w = n(t) * C, S = { startRow: _ + e.startRow, endRow: _ + e.startRow, startColumn: w + e.startColumn, endColumn: w + e.startColumn }; let R = y; p === c && i && (R = { ...R }, R.endRow = R.endRow - (r(t) - i)), C === v && o && (R = { ...R }, R.endColumn = R.endColumn - (n(t) - o)), d.push({ repeatRelativeRange: R, startRange: S }); } return d; }; let xn = class extends je { constructor(e, r, n, i, o, c) { super(); Xe(this, "_painterConfig", null); this._injector = e, this._univerInstanceService = r, this._formatPainterService = n, this._sheetsSelectionsService = i, this._conditionalFormattingRuleModel = o, this._conditionalFormattingViewModel = c, this._initFormattingPainter(); } // eslint-disable-next-line max-lines-per-function _initFormattingPainter() { const e = () => ({ redos: [], undos: [] }), r = (o, c, v, d, y) => { const { unitId: p, subUnitId: C } = this._painterConfig, { targetUnitId: _, targetSubUnitId: w } = y, S = { startRow: o.row, startColumn: o.col, endColumn: o.col, endRow: o.row }, R = { startRow: c.row, startColumn: c.col, endColumn: c.col, endRow: c.row }; ze.foreach(v, (h, s) => { const a = Be.getPositionRange( { startRow: h, startColumn: s, endColumn: s, endRow: h }, S ), u = Be.getPositionRange( { startRow: h, startColumn: s, endColumn: s, endRow: h }, R ), b = this._conditionalFormattingViewModel.getCellCfs( p, C, a.startRow, a.startColumn ), l = this._conditionalFormattingViewModel.getCellCfs( _, w, u.startRow, u.startColumn ); l && l.forEach((g) => { let f = d.get(g.cfId); if (!d.get(g.cfId)) { const m = this._conditionalFormattingRuleModel.getRule(_, w, g.cfId); if (!m) return; f = new Ze(), m.ranges.forEach((P) => { ze.foreach(P, (M, j) => { f.setValue(M, j, 1); }); }), d.set(g.cfId, f); } f.realDeleteValue(u.startRow, u.startColumn); }), b && b.forEach((g) => { const f = d.get(g.cfId); f && f.setValue(u.startRow, u.startColumn, 1); }); }); }, n = (o, c, v) => { var a; const { range: d, unitId: y, subUnitId: p } = this._painterConfig, C = o !== y || p !== c, _ = /* @__PURE__ */ new Map(), w = [], S = []; if (!o || !c || !y || !p) return e(); const R = (a = this._conditionalFormattingRuleModel.getSubunitRules(y, p)) != null ? a : []; R == null || R.forEach((u) => { const { ranges: b, cfId: l } = u; if (b.some((g) => Be.intersects(d, g))) { const g = new Ze(); C || b.forEach((f) => { ze.foreach(f, (m, P) => { g.setValue(m, P, 1); }); }), _.set(l, g); } }); const h = { row: d.startRow, col: d.startColumn }; return xc(d, v).forEach((u) => { r(h, { row: u.startRange.startRow, col: u.startRange.startColumn }, u.repeatRelativeRange, _, { targetUnitId: o, targetSubUnitId: c }); }), _.forEach((u, b) => { if (C) { const l = this._conditionalFormattingRuleModel.getRule(o, c, b), g = At(Wt(u)); if (l) if (g.length) { const f = { unitId: o, subUnitId: c, rule: { ...l, ranges: g } }; w.push({ id: Ve.id, params: f }), S.push(...Je(this._injector, f)); } else { const f = { unitId: o, subUnitId: c, cfId: l.cfId }; w.push({ id: Ne.id, params: f }), S.push(...Ge(this._injector, f)); } else if (g.length) { const f = this._conditionalFormattingRuleModel.getRule(y, p, b); if (f) { const m = { unitId: o, subUnitId: c, rule: { ...tr.deepClone(f), cfId: this._conditionalFormattingRuleModel.createCfId(o, c), ranges: g } }; w.push({ id: _e.id, params: m }), S.push(nr(this._injector, m)); } } } else { const l = this._conditionalFormattingRuleModel.getRule(y, p, b); if (!l) return; const g = At(Wt(u)); if (g.length) { const f = { unitId: y, subUnitId: p, rule: { ...l, ranges: g } }; w.push({ id: Ve.id, params: f }), S.push(...Je(this._injector, f)); } else { const f = { unitId: y, subUnitId: p, cfId: l.cfId }; w.push({ id: Ne.id, params: f }), S.push(...Ge(this._injector, f)); } } }), { undos: S, redos: w }; }, i = { id: Yt, onStatusChange: (o) => { var c, v, d; switch (o) { case Vn.INFINITE: case Vn.ONCE: { const y = (c = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET)) == null ? void 0 : c.getUnitId(), p = (d = (v = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET)) == null ? void 0 : v.getActiveSheet()) == null ? void 0 : d.getSheetId(), C = this._sheetsSelectionsService.getCurrentLastSelection(), _ = C == null ? void 0 : C.range; y && p && _ && (this._painterConfig = { unitId: y, subUnitId: p, range: _ }); break; } case Vn.OFF: { this._painterConfig = null; break; } } }, onApply: (o, c, v) => this._painterConfig ? n(o, c, v) : { redos: [], undos: [] } }; this._formatPainterService.addHook(i); } }; xn = _c([ pt(0, Q(We)), pt(1, Q(ue)), pt(2, Q(us)), pt(3, Q(ct)), pt(4, Q(me)), pt(5, Q(Xt)) ], xn); var Ic = Object.defineProperty, Ec = Object.getOwnPropertyDescriptor, Tc = (t, e, r, n) => { for (var i = n > 1 ? void 0 : n ? Ec(e, r) : e, o = t.length - 1, c; o >= 0; o--) (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i); return n && i && Ic(e, r, i), i; }, Zn = (t, e) => (r, n) => e(r, n, t); let In = class extends je { constructor(t, e, r) { super(), this._conditionalFormattingViewModel = t, this._univerInstanceService = e, this._renderManagerService = r, this._init(); } _init() { const t = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET), e = (r) => { const n = r.getUnitId(), i = this._renderManagerService.getRenderById(n); if (!i) return; const o = i.with(Ti); this.disposeWithMe(o.currentSkeleton$.subscribe((c) => { if (c) { const v = c.skeleton.rowColumnSegment, d = v.endColumn - v.startColumn + 1, p = (v.endRow - v.startRow + 1) * d * 9, C = Math.max(No, p); this._conditionalFormattingViewModel.setCacheLength(C); } })); }; t && e(t), this._univerInstanceService.getCurrentTypeOfUnit$(re.UNIVER_SHEET).subscribe((r) => { r && e(r); }); } }; In = Tc([ Zn(0, Q(Xt)), Zn(1, ue), Zn(2, Di) ], In); var co = Object.defineProperty, Pc = Object.getOwnPropertyDescriptor, Oc = (t, e, r) => e in t ? co(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Dc = (t, e, r, n) => { for (var i = n > 1 ? void 0 : n ? Pc(e, r) : e, o = t.length - 1, c; o >= 0; o--) (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i); return n && i && co(e, r, i), i; }, Jn = (t, e) => (r, n) => e(r, n, t), uo = (t, e, r) => Oc(t, typeof e != "symbol" ? e + "" : e, r); let En = class extends vi { constructor(t = bn, e, r, n) { super(), this._config = t, this._injector = e, this._commandService = r, this._configService = n; const { menu: i, ...o } = yi( {}, bn, this._config ); i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(so, o), this._initCommand(); } onStarting() { So(this._injector, [ [Gt], [Bt], [Ut], [Cn], [kt], [Ht], [_n], [mt], [Rn], [wn], [xn], [In] ]), $n(this._injector, [ [Gt] ]); } onReady() { $n(this._injector, [ [_n], [Ht] ]); } onRendered() { $n(this._injector, [ [Cn], [wn], [Ut], [Rn], [mt], [xn], [kt], [Bt], [In] ]); } _initCommand() { [ Mi, Ni, ji, Li, $i, zi, Fi, Vi, qi, jn, mn, cr, lr, Pn, ar, On ].forEach((t) => { this._commandService.registerCommand(t); }); } }; uo(En, "pluginName", `${Yt}_UI_PLUGIN`); uo(En, "type", re.UNIVER_SHEET); En = Dc([ mi(Ci), Jn(1, Q(We)), Jn(2, Q(ge)), Jn(3, bi) ], En); export { Mi as AddAverageCfCommand, Pn as AddCfCommand, Ni as AddColorScaleConditionalRuleCommand, ji as AddDataBarConditionalRuleCommand, Li as AddDuplicateValuesCfCommand, $i as AddNumberCfCommand, zi as AddRankCfCommand, Fi as AddTextCfCommand, Vi as AddTimePeriodCfCommand, qi as AddUniqueValuesCfCommand, ar as ClearRangeCfCommand, On as ClearWorksheetCfCommand, wn as ConditionalFormattingClearController, mn as DeleteCfCommand, lr as MoveCfCommand, jn as OpenConditionalFormattingOperator, cr as SetCfCommand, Sn as UniverSheetsConditionalFormattingMobileUIPlugin, En as UniverSheetsConditionalFormattingUIPlugin };