"use strict";var _a,_b,_c;Object.defineProperty(exports,"__esModule",{value:!0}),exports.Spacer=exports.Column=exports.Row=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),widget_1=require("./widget");class Row{constructor(...widgets){this.offsets=[],jsiiDeprecationWarnings.aws_cdk_lib_aws_cloudwatch_IWidget(widgets),this.widgets=widgets,this.width=0,this.height=0;let x=0,y=0;for(const widget of widgets)x+widget.width>widget_1.GRID_WIDTH&&(y=this.height,x=0),this.offsets.push({x,y}),this.width=Math.max(this.width,x+widget.width),this.height=Math.max(this.height,y+widget.height),x+=widget.width}position(x,y){for(let i=0;i<this.widgets.length;i++)this.widgets[i].position(x+this.offsets[i].x,y+this.offsets[i].y)}toJson(){const ret=[];for(const widget of this.widgets)ret.push(...widget.toJson());return ret}}exports.Row=Row,_a=JSII_RTTI_SYMBOL_1,Row[_a]={fqn:"aws-cdk-lib.aws_cloudwatch.Row",version:"2.13.0"};class Column{constructor(...widgets){jsiiDeprecationWarnings.aws_cdk_lib_aws_cloudwatch_IWidget(widgets),this.widgets=widgets,this.width=Math.max(...this.widgets.map(w=>w.width)),this.height=sum(...this.widgets.map(w=>w.height))}position(x,y){let widgetY=y;for(const widget of this.widgets)widget.position(x,widgetY),widgetY+=widget.height}toJson(){const ret=[];for(const widget of this.widgets)ret.push(...widget.toJson());return ret}}exports.Column=Column,_b=JSII_RTTI_SYMBOL_1,Column[_b]={fqn:"aws-cdk-lib.aws_cloudwatch.Column",version:"2.13.0"};class Spacer{constructor(props={}){jsiiDeprecationWarnings.aws_cdk_lib_aws_cloudwatch_SpacerProps(props),this.width=props.width||1,this.height=props.height||1}position(_x,_y){}toJson(){return[]}}exports.Spacer=Spacer,_c=JSII_RTTI_SYMBOL_1,Spacer[_c]={fqn:"aws-cdk-lib.aws_cloudwatch.Spacer",version:"2.13.0"};function sum(...xs){let ret=0;for(const x of xs)ret+=x;return ret}
//# sourceMappingURL=layout.js.map
