"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    renderAnswerContent: ()=>renderAnswerContent
});
const external_lit_namespaceObject = require("lit");
const when_js_namespaceObject = require("lit/directives/when.js");
const external_generated_content_container_cjs_namespaceObject = require("./generated-content-container.cjs");
const external_retry_prompt_cjs_namespaceObject = require("./retry-prompt.cjs");
const external_show_button_cjs_namespaceObject = require("./show-button.cjs");
const external_source_citations_cjs_namespaceObject = require("./source-citations.cjs");
const external_render_generating_answer_label_cjs_namespaceObject = require("./render-generating-answer-label.cjs");
require("../atomic-icon/atomic-icon.cjs");
const renderAnswerContent = ({ props })=>{
    const { i18n, generatedAnswer, collapsible, renderFeedbackAndCopyButtonsSlot, renderCitationsSlot, onRetry, onClickShowButton } = props;
    const { answer, isStreaming, citations, answerContentFormat, expanded, error } = generatedAnswer;
    const hasRetryableError = error?.isRetryable === true;
    return (0, external_lit_namespaceObject.html)`
    <div>
      ${hasRetryableError ? (0, external_retry_prompt_cjs_namespaceObject.renderRetryPrompt)({
        props: {
            onClick: onRetry,
            buttonLabel: i18n.t('retry'),
            message: i18n.t('retry-stream-message')
        }
    }) : external_lit_namespaceObject.nothing}
      ${!hasRetryableError ? (0, external_generated_content_container_cjs_namespaceObject.renderGeneratedContentContainer)({
        props: {
            answer,
            answerContentFormat,
            isStreaming: !!isStreaming
        }
    })((0, external_lit_namespaceObject.html)`
            ${(0, external_source_citations_cjs_namespaceObject.renderSourceCitations)({
        props: {
            label: i18n.t('citations'),
            isVisible: !!citations?.length
        }
    })(renderCitationsSlot())}
          `) : external_lit_namespaceObject.nothing}
      ${(0, when_js_namespaceObject.when)(!hasRetryableError && (collapsible ? expanded : true), ()=>(0, external_lit_namespaceObject.html)`
          <div class="mt-4" part="feedback-and-copy-buttons">
            ${renderFeedbackAndCopyButtonsSlot()}
          </div>
        `)}
      ${!hasRetryableError ? (0, external_lit_namespaceObject.html)`
            <div part="generated-answer-footer" class="mt-6">
              ${(0, external_render_generating_answer_label_cjs_namespaceObject.renderGeneratingAnswerLabel)({
        props: {
            i18n,
            isStreaming: !!isStreaming,
            collapsible
        }
    })}
              ${collapsible && !isStreaming ? (0, external_show_button_cjs_namespaceObject.renderShowButton)({
        props: {
            i18n,
            onClick: onClickShowButton,
            isCollapsed: !expanded
        }
    }) : external_lit_namespaceObject.nothing}
            </div>
          ` : external_lit_namespaceObject.nothing}
    </div>
  `;
};
exports.renderAnswerContent = __webpack_exports__.renderAnswerContent;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "renderAnswerContent"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
