import { jsx as _jsx } from "react/jsx-runtime";
import { Children } from "react";
import { View, useMedia, withStaticProperties } from "tamagui";
function Container(param) {
  var {
      children,
      gap = "$spacing.form_gap",
      ...props
    } = param,
    rowSpan = 0,
    currentRow = [],
    rows = [],
    media = useMedia();
  return Children.forEach(children, function (child, index) {
    var _child_props,
      _child_props1,
      _child_props2,
      childSpan = media?.compact ? child == null || (_child_props = child.props) === null || _child_props === void 0 ? void 0 : _child_props.compact : media?.medium ? child == null || (_child_props1 = child.props) === null || _child_props1 === void 0 ? void 0 : _child_props1.medium : media?.expanded ? child == null || (_child_props2 = child.props) === null || _child_props2 === void 0 ? void 0 : _child_props2.exp : 12;
    childSpan || (childSpan = 12), childSpan && (rowSpan + childSpan > 12 && (12 - rowSpan > 0 && currentRow.push(/* @__PURE__ */_jsx(View, {
      flex: 12 - rowSpan
    }, `filler-${index}`)), rows.push(currentRow), currentRow = [], rowSpan = 0), currentRow.push(child), rowSpan += childSpan);
  }), currentRow?.length > 0 && (rowSpan < 12 && currentRow.push(/* @__PURE__ */_jsx(View, {
    flex: 12 - rowSpan
  }, "final-row")), rows.push(currentRow)), /* @__PURE__ */_jsx(View, {
    display: "flex",
    flexDirection: "column",
    width: "100%",
    ...props,
    gap,
    children: rows.map(function (row, index) {
      return /* @__PURE__ */_jsx(View, {
        display: "flex",
        flexDirection: "row",
        gap,
        width: "100%",
        children: row
      }, `grid-row-${index}`);
    })
  });
}
function Item(param) {
  var {
      children,
      exp = 12,
      compact = 12,
      medium = 12,
      ...props
    } = param,
    media = useMedia(),
    flex = media?.compact ? compact : media?.medium ? medium : (media?.expanded, exp);
  return /* @__PURE__ */_jsx(View, {
    ...props,
    flex,
    width: 0,
    children
  });
}
var Grid = withStaticProperties(Container, {
  Item
});
export { Grid };
//# sourceMappingURL=Grid.native.js.map
