const getW = (w) => {
    if (typeof w === 'object') {
        return {
            w: w.default,
            minW: w.min,
            maxW: w.max
        };
    }
    if (typeof w === 'number') {
        return { w };
    }
    return { w: 2 };
};
const getH = (h) => {
    if (typeof h === 'object') {
        return {
            h: h.default,
            minH: h.min,
            maxH: h.max
        };
    }
    if (typeof h === 'number') {
        return { h };
    }
    return { h: 2 };
};
/**
 * Get a default layout for widgets of a type
 */
export default function getWidgetLayout(getWidget, widgetType) {
    var _a;
    var _b;
    const { w, h } = (_b = (getWidget && ((_a = getWidget(widgetType)) === null || _a === void 0 ? void 0 : _a.layout))) !== null && _b !== void 0 ? _b : {};
    const layout = Object.assign(Object.assign({}, getW(w)), getH(h));
    const wResizable = 'minW' in layout || 'maxW' in layout;
    const hResizable = 'minH' in layout || 'maxH' in layout;
    layout.isResizable = wResizable || hResizable;
    return layout;
}
//# sourceMappingURL=getWidgetLayout.js.map