// Safeguard to ensure we aren't exceeding the length of innerDivs array
if (innerDivs[0]) innerDivs[0].style.width = '100%';
if (innerDivs[1]) innerDivs[1].style.width = '100%';
if (innerDivs[2]) innerDivs[2].style.width = '100%';
if (innerDivs[3]) innerDivs[3].style.width = '100%';
const scrollable = qsiContainer.querySelector(".scrollable");
if (scrollable) scrollable.style.width = '100%';
// Adjust the iframe width to 100%
const iframe = qsiContainer.querySelector('iframe');
if (iframe) iframe.style.width = '100%';
}
const handleWalkerResize = (event) => {
if (event.data) {
// console.log("EVENTDATA:", event.data);
let newHeight;
// Check if event.data is a string "closeQSIWindow"
if (event.data === "closeQSIWindow") {
newHeight = 175;
} else {
try {
const message = JSON.parse(event.data);
// Check for event type "walkerResize" and get the newHeight value
if (message.event === "walkerResize") {
newHeight = message.value;
}
} catch (error) {
// console.error("Invalid message data", error);
}
}
// If newHeight has been set, adjust the heights of the elements
if (newHeight !== undefined) {
// console.log("newHeight", newHeight);
const qsiContainer = document.querySelector('.QSIUserDefinedHTML');
if (qsiContainer) {
// Adjust elements' height based on the newHeight
const innerDivs = qsiContainer.querySelectorAll('div[style]');
if (innerDivs[0]) innerDivs[0].style.height = `${newHeight}px`;
if (innerDivs[1]) innerDivs[1].style.height = `${newHeight}px`;
if (innerDivs[2]) innerDivs[2].style.height = `${newHeight}px`;
if (innerDivs[3]) innerDivs[3].style.height = `${newHeight}px`;
qsiContainer.style.height = `${newHeight}px`
const scrollable = qsiContainer.querySelector('.scrollable');
if (scrollable) scrollable.style.height = `${newHeight}px`;