As far as the line geometries are connected, each line geometry first coordinate and last coordinate are identical. Polygon geometries can be constructed by passing the coordiantes from Polyline geometry into Polygon Geometry as below.
From your post, I assume you are thinking of solution specifically for intersection lines into multiple geometries?
In that case it is two step process, convert the grey lines into single polygon geometry and apply the intersection function to generate the polygons.
Retrieving data ...