"use client";
import { createSlice as l } from "../../../@reduxjs/toolkit/dist/redux-toolkit.modern.js";
import { current as t, castDraft as d } from "../../../immer/dist/immer.js";
var n = {
  settings: {
    layout: "horizontal",
    align: "center",
    verticalAlign: "middle",
    itemSorter: "value"
  },
  size: {
    width: 0,
    height: 0
  },
  payload: []
}, o = l({
  name: "legend",
  initialState: n,
  reducers: {
    setLegendSize(e, a) {
      e.size.width = a.payload.width, e.size.height = a.payload.height;
    },
    setLegendSettings(e, a) {
      e.settings.align = a.payload.align, e.settings.layout = a.payload.layout, e.settings.verticalAlign = a.payload.verticalAlign, e.settings.itemSorter = a.payload.itemSorter;
    },
    addLegendPayload(e, a) {
      e.payload.push(d(a.payload));
    },
    removeLegendPayload(e, a) {
      var i = t(e).payload.indexOf(d(a.payload));
      i > -1 && e.payload.splice(i, 1);
    }
  }
}), {
  setLegendSize: s,
  setLegendSettings: y,
  addLegendPayload: p,
  removeLegendPayload: h
} = o.actions;
export {
  p as addLegendPayload,
  h as removeLegendPayload,
  y as setLegendSettings,
  s as setLegendSize
};
