{"version":3,"file":"92add5bc.js","sources":["../../../node_modules/@shopify/hydrogen/dist/esnext/utilities/flattenConnection/flattenConnection.js"],"sourcesContent":["/**\n * The `flattenConnection` utility transforms a connection object from the Storefront API (for example, [Product-related connections](https://shopify.dev/api/storefront/reference/products/product)) into a flat array of nodes.\n * The utility works with either `nodes` or `edges.node`.\n */\nexport function flattenConnection(connection) {\n if (connection.nodes) {\n return connection.nodes;\n }\n if (connection.edges) {\n return connection.edges.map((edge) => {\n if (!edge?.node) {\n throw new Error('Connection edges must contain nodes');\n }\n return edge.node;\n });\n }\n return [];\n}\n"],"names":["flattenConnection","connection","edge"],"mappings":"AAIO,SAASA,EAAkBC,EAAY,CAC1C,OAAIA,EAAW,MACJA,EAAW,MAElBA,EAAW,MACJA,EAAW,MAAM,IAAKC,GAAS,CAClC,GAAI,EAACA,GAAA,MAAAA,EAAM,MACP,MAAM,IAAI,MAAM,qCAAqC,EAEzD,OAAOA,EAAK,IACxB,CAAS,EAEE,EACX"}