// src/molecules/dynamic-form-response-item.tsx
function DynamicFormResponseItem({
  payload,
  questionType,
  config
}) {
  if (!payload || typeof payload !== "object") {
    return String(payload || "\uC751\uB2F5 \uC5C6\uC74C");
  }
  const payloadObj = payload;
  const value = payloadObj.value;
  if (value === void 0 || value === null || value === "") {
    return "\uC751\uB2F5 \uC5C6\uC74C";
  }
  const getOptions = (fieldConfig) => {
    if (!fieldConfig || typeof fieldConfig !== "object") return void 0;
    if ("options" in fieldConfig && Array.isArray(fieldConfig.options)) {
      return fieldConfig.options;
    }
    return void 0;
  };
  const options = getOptions(config);
  switch (questionType) {
    case "text":
    case "textarea":
      return String(value);
    case "radio":
    case "select":
    case "choice":
      if (options) {
        const option = options.find((opt) => opt.value === value);
        return option ? option.label : String(value);
      }
      return String(value);
    case "checkbox":
    case "choices":
      if (Array.isArray(value)) {
        if (options) {
          return value.map((val) => {
            const option = options.find((opt) => opt.value === val);
            return option ? option.label : String(val);
          }).join(", ");
        }
        return value.join(", ");
      }
      return String(value);
    case "rating":
      if (options) {
        const option = options.find((opt) => opt.value === value);
        return option ? option.label : String(value);
      }
      return String(value);
    case "number":
      return String(value);
    case "yes_no":
      if (value === true || value === "true" || value === "yes") {
        return "\uB3D9\uC758";
      }
      if (value === false || value === "false" || value === "no") {
        return "\uBE44\uB3D9\uC758";
      }
      return String(value);
    default:
      return String(value);
  }
}

export {
  DynamicFormResponseItem
};
//# sourceMappingURL=chunk-QTQKJ4A2.js.map