75 lines
2.1 KiB
JavaScript
75 lines
2.1 KiB
JavaScript
import {r as l, ad as i} from "./index-CdMy-Rhi.js";
|
|
function M(p=[]) {
|
|
const [r,n] = l.useState(p);
|
|
return [r, {
|
|
setState: n,
|
|
append: (...e) => n(t => [...t, ...e]),
|
|
prepend: (...e) => n(t => [...e, ...t]),
|
|
insert: (e, ...t) => n(o => [...o.slice(0, e), ...t, ...o.slice(e)]),
|
|
pop: () => n(e => {
|
|
const t = [...e];
|
|
return t.pop(),
|
|
t
|
|
}
|
|
),
|
|
shift: () => n(e => {
|
|
const t = [...e];
|
|
return t.shift(),
|
|
t
|
|
}
|
|
),
|
|
apply: e => n(t => t.map( (o, s) => e(o, s))),
|
|
applyWhere: (e, t) => n(o => o.map( (s, c) => e(s, c) ? t(s, c) : s)),
|
|
remove: (...e) => n(t => t.filter( (o, s) => !e.includes(s))),
|
|
reorder: ({from: e, to: t}) => n(o => {
|
|
const s = [...o]
|
|
, c = o[e];
|
|
return s.splice(e, 1),
|
|
s.splice(t, 0, c),
|
|
s
|
|
}
|
|
),
|
|
swap: ({from: e, to: t}) => n(o => {
|
|
const s = [...o]
|
|
, c = s[e]
|
|
, a = s[t];
|
|
return s.splice(t, 1, c),
|
|
s.splice(e, 1, a),
|
|
s
|
|
}
|
|
),
|
|
setItem: (e, t) => n(o => {
|
|
const s = [...o];
|
|
return s[e] = t,
|
|
s
|
|
}
|
|
),
|
|
setItemProp: (e, t, o) => n(s => {
|
|
const c = [...s];
|
|
return c[e] = {
|
|
...c[e],
|
|
[t]: o
|
|
},
|
|
c
|
|
}
|
|
),
|
|
filter: e => {
|
|
n(t => t.filter(e))
|
|
}
|
|
}]
|
|
}
|
|
/**
|
|
* @license @tabler/icons-react v3.21.0 - MIT
|
|
*
|
|
* This source code is licensed under the MIT license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/
|
|
var W = i("outline", "player-pause", "IconPlayerPause", [["path", {
|
|
d: "M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z",
|
|
key: "svg-0"
|
|
}], ["path", {
|
|
d: "M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z",
|
|
key: "svg-1"
|
|
}]]);
|
|
export {W as I, M as u};
|