"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.n = (module)=>{
        var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
        __webpack_require__.d(getter, {
            a: getter
        });
        return getter;
    };
})();
(()=>{
    __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__, {
    renderExpandableText: ()=>renderExpandableText
});
const external_lit_namespaceObject = require("lit");
const multi_class_map_cjs_namespaceObject = require("../../../directives/multi-class-map.cjs");
const minus_cjs_namespaceObject = require("../../../images/minus.cjs");
var minus_cjs_default = /*#__PURE__*/ __webpack_require__.n(minus_cjs_namespaceObject);
const plus_cjs_namespaceObject = require("../../../images/plus.cjs");
var plus_cjs_default = /*#__PURE__*/ __webpack_require__.n(plus_cjs_namespaceObject);
const external_button_cjs_namespaceObject = require("../button.cjs");
require("../atomic-icon/atomic-icon.cjs");
const ref_js_namespaceObject = require("lit/directives/ref.js");
const getLineClampClass = (truncateAfter)=>{
    const lineClampMap = {
        none: 'line-clamp-none',
        1: 'line-clamp-1',
        2: 'line-clamp-2',
        3: 'line-clamp-3',
        4: 'line-clamp-4'
    };
    return lineClampMap[truncateAfter] || 'line-clamp-2';
};
const renderExpandableText = ({ props: { isExpanded, isTruncated, isCollapsible, truncateAfter, onToggleExpand, showMoreLabel, showLessLabel, textRef } })=>(children)=>{
        const expandableTextClasses = (0, multi_class_map_cjs_namespaceObject.tw)({
            'expandable-text leading-[var(--line-height)]': true,
            [getLineClampClass(truncateAfter)]: !isExpanded,
            [`min-lines-${truncateAfter}`]: true
        });
        const buttonClasses = (0, multi_class_map_cjs_namespaceObject.tw)({
            'expandable-text-button p-1 text-xs leading-[calc(1/.75)]': true,
            invisible: !isTruncated && !isExpanded,
            hidden: isExpanded && (!isTruncated || !isCollapsible)
        });
        const buttonClassString = Object.entries(buttonClasses).filter(([, value])=>value).map(([key])=>key).join(' ');
        const buttonLabel = isExpanded ? showLessLabel : showMoreLabel;
        const icon = isExpanded ? minus_cjs_default() : plus_cjs_default();
        return (0, external_lit_namespaceObject.html)`<div class="flex flex-col items-start">
      <div
        part="expandable-text"
        class="${(0, multi_class_map_cjs_namespaceObject.multiClassMap)(expandableTextClasses)}"
        ${(0, ref_js_namespaceObject.ref)(textRef)}
      >
        ${children}
      </div>

      ${(0, external_button_cjs_namespaceObject.renderButton)({
            props: {
                style: 'text-primary',
                class: buttonClassString,
                title: buttonLabel,
                onClick: onToggleExpand
            }
        })((0, external_lit_namespaceObject.html)` <atomic-icon
            icon="${icon}"
            class="mx-1 w-2 align-baseline"
          ></atomic-icon>
          ${buttonLabel}`)}
    </div>`;
    };
exports.renderExpandableText = __webpack_exports__.renderExpandableText;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "renderExpandableText"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
