{"version":3,"sources":["webpack:///./app/components/m/product-stage/index.js"],"names":["adjustTextSize","container","textElement","style","fontSize","containerWidth","offsetWidth","textScrollWidth","scrollWidth","parseFloat","window","getComputedStyle","getPropertyValue","maxFontSize","mediaQuery","matchMedia","matches","document","querySelector","adjustOnLoadAndResize","onload","onresize"],"mappings":";;;;;;;;;;AAAA,SAASA,cAAcA,CAACC,SAAS,EAAEC,WAAW,EAAE;EAC9C;EACAA,WAAW,CAACC,KAAK,CAACC,QAAQ,GAAG,EAAE;EAE/B,MAAMC,cAAc,GAAGJ,SAAS,CAACK,WAAW;EAC5C,IAAIC,eAAe,GAAGL,WAAW,CAACM,WAAW;EAC7C,IAAIJ,QAAQ,GAAGK,UAAU,CAACC,MAAM,CAACC,gBAAgB,CAACT,WAAW,EAAE,IAAI,CAAC,CAACU,gBAAgB,CAAC,WAAW,CAAC,CAAC;EACnG,MAAMC,WAAW,GAAG,EAAE,CAAC,CAAC;EACxB,MAAMC,UAAU,GAAGJ,MAAM,CAACK,UAAU,CAAC,oBAAoB,CAAC;;EAE1D;EACA,OAAOR,eAAe,GAAGF,cAAc,IAAID,QAAQ,GAAG,CAAC,EAAEA,QAAQ,EAAE,EAAE;IACnEF,WAAW,CAACC,KAAK,CAACC,QAAQ,GAAGA,QAAQ,GAAG,IAAI;IAC5CG,eAAe,GAAGL,WAAW,CAACM,WAAW;EAC3C;;EAEA;EACA,IAAI,CAACM,UAAU,CAACE,OAAO,EAAE;IACvB,OAAOT,eAAe,GAAGF,cAAc,IAAID,QAAQ,GAAGS,WAAW,EAAET,QAAQ,EAAE,EAAE;MAC7EF,WAAW,CAACC,KAAK,CAACC,QAAQ,GAAGA,QAAQ,GAAG,IAAI;MAC5CG,eAAe,GAAGL,WAAW,CAACM,WAAW;MAEzC,IAAID,eAAe,GAAGF,cAAc,EAAE;QACpCH,WAAW,CAACC,KAAK,CAACC,QAAQ,GAAGA,QAAQ,GAAG,CAAC,GAAG,IAAI;QAChD;MACF;IACF;EACF;AACF;AAEA,MAAMH,SAAS,GAAGgB,QAAQ,CAACC,aAAa,CAAC,0BAA0B,CAAC;AACpE,MAAMhB,WAAW,GAAGD,SAAS,CAACiB,aAAa,CAAC,MAAM,CAAC;;AAEnD;AACA,SAASC,qBAAqBA,CAAA,EAAG;EAC/BnB,cAAc,CAACC,SAAS,EAAEC,WAAW,CAAC;AACxC;AAEAQ,MAAM,CAACU,MAAM,GAAGD,qBAAqB;AAErCT,MAAM,CAACW,QAAQ,GAAGF,qBAAqB,C","file":"product-stage.chunk.js","sourcesContent":["function adjustTextSize(container, textElement) {\r\n // Reset font size to the default size specified in CSS\r\n textElement.style.fontSize = '';\r\n\r\n const containerWidth = container.offsetWidth;\r\n let textScrollWidth = textElement.scrollWidth;\r\n let fontSize = parseFloat(window.getComputedStyle(textElement, null).getPropertyValue('font-size'));\r\n const maxFontSize = 60; // Set a maximum font size to prevent the text from becoming too large\r\n const mediaQuery = window.matchMedia('(max-width: 768px)');\r\n\r\n // Decrease font size if text is too wide\r\n for (; textScrollWidth > containerWidth && fontSize > 0; fontSize--) {\r\n textElement.style.fontSize = fontSize + 'px';\r\n textScrollWidth = textElement.scrollWidth;\r\n }\r\n\r\n // Increase font size if text is too narrow and not on mobile\r\n if (!mediaQuery.matches) {\r\n for (; textScrollWidth < containerWidth && fontSize < maxFontSize; fontSize++) {\r\n textElement.style.fontSize = fontSize + 'px';\r\n textScrollWidth = textElement.scrollWidth;\r\n\r\n if (textScrollWidth > containerWidth) {\r\n textElement.style.fontSize = fontSize - 1 + 'px';\r\n break;\r\n }\r\n }\r\n }\r\n}\r\n\r\nconst container = document.querySelector('.product-stage__headline');\r\nconst textElement = container.querySelector('.hdl');\r\n\r\n// Run adjustTextSize function on load and resize\r\nfunction adjustOnLoadAndResize() {\r\n adjustTextSize(container, textElement);\r\n}\r\n\r\nwindow.onload = adjustOnLoadAndResize;\r\n\r\nwindow.onresize = adjustOnLoadAndResize;\r\n"],"sourceRoot":""}