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AA,EAxCoB,EAAO,EAAa,IAGvC,EACD,E","sources":["","acf-blocks/table-filter-block/table-filter-block.js"],"sourcesContent":["(function () {\n/**\n * Front end interactivity for the table filter blocks.\n *\n * @package\n */ document.addEventListener('DOMContentLoaded', function() {\n const filterFormBlocks = document.querySelectorAll('.paragon-table-filter-block');\n // Loop through each filter form block and add event listeners.\n filterFormBlocks.forEach((formBlock)=>{\n const form = formBlock.querySelector('.pdm-filters');\n const searchInput = form.querySelector('.pdm-filters__input');\n const filterSubmit = form.querySelector('.pdm-filters__button');\n const resetButton = form.querySelector('.pdm-filters__button--reset');\n const tableId = form.getAttribute('data-filter-target');\n const table = document.getElementById(tableId);\n if (table) {\n filterSubmit.addEventListener('click', (event)=>$9f7f5db686d0c3fd$var$handleFilterSubmit(event, searchInput, table));\n resetButton.addEventListener('click', (event)=>$9f7f5db686d0c3fd$var$handleFormReset(event, searchInput, table));\n }\n });\n});\n/**\n * Handles the filter submit event.\n * Prevents default form submission and fires the filtering function, using view transitions if available.\n *\n * @param {Event} event - The event object.\n * @param {HTMLInputElement} searchInput - The search input element.\n * @param {HTMLTableElement} table - The table element to filter.\n */ function $9f7f5db686d0c3fd$var$handleFilterSubmit(event, searchInput, table) {\n event.preventDefault();\n if (!document.startViewTransition) {\n $9f7f5db686d0c3fd$var$updateFilteredRows(searchInput, table);\n return;\n }\n document.startViewTransition(()=>$9f7f5db686d0c3fd$var$updateFilteredRows(searchInput, table));\n}\n/**\n * Handles the form reset event.\n * Fires the reset function, using view transitions if available.\n *\n * @param {Event} event - The event object.\n * @param {HTMLInputElement} searchInput - The search input element.\n * @param {HTMLTableElement} table - The table element to reset.\n */ function $9f7f5db686d0c3fd$var$handleFormReset(event, searchInput, table) {\n if (!document.startViewTransition) {\n $9f7f5db686d0c3fd$var$resetFilteredRows(searchInput, table);\n return;\n }\n document.startViewTransition(()=>$9f7f5db686d0c3fd$var$resetFilteredRows(searchInput, table));\n}\n/**\n * Updates the filtered rows based on the search input value.\n * Hides rows that do not match the search criteria.\n *\n * @param {HTMLInputElement} searchInput - The search input element.\n * @param {HTMLTableElement} table - The table element to filter.\n */ function $9f7f5db686d0c3fd$var$updateFilteredRows(searchInput, table) {\n const filterValue = searchInput.value.toLowerCase();\n const rows = table.querySelectorAll('tbody tr');\n rows.forEach((row)=>{\n const rowText = row.textContent.toLowerCase();\n if (rowText.includes(filterValue)) row.style.display = '';\n else row.style.display = 'none';\n });\n}\n/**\n * Resets the filtered rows to their original state.\n * Displays all rows and focuses on the search input.\n *\n * @param {HTMLInputElement} searchInput - The search input element.\n * @param {HTMLTableElement} table - The table element to reset.\n */ function $9f7f5db686d0c3fd$var$resetFilteredRows(searchInput, table) {\n const rows = table.querySelectorAll('tbody tr');\n rows.forEach((row)=>{\n row.style.display = '';\n });\n searchInput.focus();\n}\n\n})();\n//# sourceMappingURL=table-filter-block.js.map\n","/**\n * Front end interactivity for the table filter blocks.\n *\n * @package\n */\n\ndocument.addEventListener('DOMContentLoaded', function () {\n\tconst filterFormBlocks = document.querySelectorAll(\n\t\t'.paragon-table-filter-block'\n\t);\n\n\t// Loop through each filter form block and add event listeners.\n\tfilterFormBlocks.forEach((formBlock) => {\n\t\tconst form = formBlock.querySelector('.pdm-filters');\n\t\tconst searchInput = form.querySelector('.pdm-filters__input');\n\t\tconst filterSubmit = form.querySelector('.pdm-filters__button');\n\t\tconst resetButton = form.querySelector('.pdm-filters__button--reset');\n\t\tconst tableId = form.getAttribute('data-filter-target');\n\t\tconst table = document.getElementById(tableId);\n\n\t\tif (table) {\n\t\t\tfilterSubmit.addEventListener('click', (event) =>\n\t\t\t\thandleFilterSubmit(event, searchInput, table)\n\t\t\t);\n\t\t\tresetButton.addEventListener('click', (event) =>\n\t\t\t\thandleFormReset(event, searchInput, table)\n\t\t\t);\n\t\t}\n\t});\n});\n\n/**\n * Handles the filter submit event.\n * Prevents default form submission and fires the filtering function, using view transitions if available.\n *\n * @param {Event} event - The event object.\n * @param {HTMLInputElement} searchInput - The search input element.\n * @param {HTMLTableElement} table - The table element to filter.\n */\nfunction handleFilterSubmit(event, searchInput, table) {\n\tevent.preventDefault();\n\n\tif (!document.startViewTransition) {\n\t\tupdateFilteredRows(searchInput, table);\n\t\treturn;\n\t}\n\n\tdocument.startViewTransition(() => updateFilteredRows(searchInput, table));\n}\n\n/**\n * Handles the form reset event.\n * Fires the reset function, using view transitions if available.\n *\n * @param {Event} event - The event object.\n * @param {HTMLInputElement} searchInput - The search input element.\n * @param {HTMLTableElement} table - The table element to reset.\n */\nfunction handleFormReset(event, searchInput, table) {\n\tif (!document.startViewTransition) {\n\t\tresetFilteredRows(searchInput, table);\n\t\treturn;\n\t}\n\n\tdocument.startViewTransition(() => resetFilteredRows(searchInput, table));\n}\n\n/**\n * Updates the filtered rows based on the search input value.\n * Hides rows that do not match the search criteria.\n *\n * @param {HTMLInputElement} searchInput - The search input element.\n * @param {HTMLTableElement} table - The table element to filter.\n */\nfunction updateFilteredRows(searchInput, table) {\n\tconst filterValue = searchInput.value.toLowerCase();\n\tconst rows = table.querySelectorAll('tbody tr');\n\n\trows.forEach((row) => {\n\t\tconst rowText = row.textContent.toLowerCase();\n\t\tif (rowText.includes(filterValue)) {\n\t\t\trow.style.display = '';\n\t\t} else {\n\t\t\trow.style.display = 'none';\n\t\t}\n\t});\n}\n\n/**\n * Resets the filtered rows to their original state.\n * Displays all rows and focuses on the search input.\n *\n * @param {HTMLInputElement} searchInput - The search input element.\n * @param {HTMLTableElement} table - The table element to reset.\n */\nfunction resetFilteredRows(searchInput, table) {\n\tconst rows = table.querySelectorAll('tbody tr');\n\trows.forEach((row) => {\n\t\trow.style.display = '';\n\t});\n\tsearchInput.focus();\n}\n"],"names":["$9f7f5db686d0c3fd$var$updateFilteredRows","searchInput","table","filterValue","value","toLowerCase","rows","querySelectorAll","forEach","row","rowText","textContent","includes","style","display","$9f7f5db686d0c3fd$var$resetFilteredRows","focus","document","addEventListener","filterFormBlocks","formBlock","form","querySelector","filterSubmit","resetButton","tableId","getAttribute","getElementById","event","$9f7f5db686d0c3fd$var$handleFilterSubmit","preventDefault","startViewTransition","$9f7f5db686d0c3fd$var$handleFormReset"],"version":3,"file":"table-filter-block.js.map"}