import { h } from '@stencil/core';
const parseJSON = (prop) => {
  return typeof prop === 'string' && prop ? JSON.parse(prop) : prop;
};
const renderPropsOrSlots = (text, leftIcon, rightIcon) => {
  let leftIconParsed, rightIconParsed;
  try {
    leftIconParsed = parseJSON(leftIcon);
    rightIconParsed = parseJSON(rightIcon);
  }
  catch (err) {
    console.warn('Unable to parse passed prop as JSON: ', err);
  }
  return [
    leftIconParsed ? (h("telia-icon", Object.assign({ slot: "left" }, leftIconParsed))) : (h("slot", { name: "left" })),
    text ? text : h("slot", null),
    rightIconParsed ? (h("telia-icon", Object.assign({ slot: "right" }, rightIconParsed))) : (h("slot", { name: "right" })),
  ];
};
export default renderPropsOrSlots;
