{ "version": 3, "sources": ["../../../javascript/entrypoints/warp/product-title-shortener.tsx", "../../../javascript/warp/components/pdp/ReadMore.tsx"], "sourcesContent": ["import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport ReadMore from \"@warp/components/pdp/ReadMore\"\nimport parseJSONData from \"@warp/utilities/parseJSONData\"\nimport TranslationContext from \"@warp/context/TranslationContext\"\n\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n document.querySelectorAll(\"[data-react-read-more]\").forEach((element) => {\n const text = element.textContent || \"\"\n const textLength = element.getAttribute(\"data-length\")\n const translations = parseJSONData(\n (element as HTMLDivElement).dataset,\n \"translations\"\n )\n\n if (text && textLength) {\n const length = parseInt(textLength, 10)\n ReactDOM.render(\n \n \n ,\n element\n )\n }\n })\n})\n", "import { useTranslation } from \"@warp/context/TranslationContext\"\nimport { useIsDesktop } from \"@warp/hooks/breakpoints\"\nimport React, { useState } from \"react\"\n\ninterface ReadMoreProps {\n text: string\n length: number\n}\n\nconst ReadMore: React.FC = ({ text, length }) => {\n const THRESHOLD = 5\n const isDesktop = useIsDesktop()\n const [isExpanded, setIsExpanded] = useState(false)\n const t = useTranslation()\n\n const toggleReadMore = () => {\n setIsExpanded(!isExpanded)\n }\n\n if (text.length <= length + THRESHOLD) {\n return {text}\n }\n\n return isDesktop ? (\n {text}\n ) : (\n \n {isExpanded ? text : `${text.substring(0, length)}...`}\n \n \n )\n}\n\nexport default ReadMore\n"], "mappings": "wPAAA,IAAAA,EAAkB,SAClBC,EAAqB,SCCrB,IAAAC,EAAgC,SAO1BC,EAAoC,CAAC,CAAE,KAAAC,EAAM,OAAAC,CAAO,IAAM,CAE9D,IAAMC,EAAYC,EAAa,EACzB,CAACC,EAAYC,CAAa,KAAI,YAAS,EAAK,EAC5CC,EAAIC,EAAe,EAEnBC,EAAiB,IAAM,CAC3BH,EAAc,CAACD,CAAU,CAC3B,EAEA,OAAIJ,EAAK,QAAUC,EAAS,EACnB,EAAAQ,QAAA,cAAC,YAAMT,CAAK,EAGdE,EACL,EAAAO,QAAA,cAAC,YAAMT,CAAK,EAEZ,EAAAS,QAAA,cAAC,YACEL,EAAaJ,EAAO,GAAGA,EAAK,UAAU,EAAGC,CAAM,OAChD,EAAAQ,QAAA,cAAC,UAAO,UAAU,mBAAmB,QAASD,GAC3CJ,EAAaE,EAAE,UAAYA,EAAE,SAChC,CACF,CAEJ,EAEOI,EAAQX,ED7Bf,SAAS,iBAAiB,mBAAoB,IAAM,CAClD,SAAS,iBAAiB,wBAAwB,EAAE,QAASY,GAAY,CACvE,IAAMC,EAAOD,EAAQ,aAAe,GAC9BE,EAAaF,EAAQ,aAAa,aAAa,EAC/CG,EAAeC,EAClBJ,EAA2B,QAC5B,cACF,EAEA,GAAIC,GAAQC,EAAY,CACtB,IAAMG,EAAS,SAASH,EAAY,EAAE,EACtC,EAAAI,QAAS,OACP,EAAAC,QAAA,cAACC,EAAmB,SAAnB,CAA4B,MAAOL,GAClC,EAAAI,QAAA,cAACE,EAAA,CAAS,KAAMR,EAAM,OAAQI,EAAQ,CACxC,EACAL,CACF,CACF,CACF,CAAC,CACH,CAAC", "names": ["import_react", "import_react_dom", "import_react", "ReadMore", "text", "length", "isDesktop", "useIsDesktop", "isExpanded", "setIsExpanded", "t", "useTranslation", "toggleReadMore", "React", "ReadMore_default", "element", "text", "textLength", "translations", "parseJSONData_default", "length", "ReactDOM", "React", "TranslationContext", "ReadMore_default"] }