text: var advanced_data_table_timeout,advanced_data_table_drag_start_x,advanced_data_table_drag_start_width,advanced_data_table_drag_el,advanced_data_table_active_cell=null,advanced_data_table_dragging=!1,Advanced_Data_Table_Update_View=function(e,a,t){var n=e.model;if(n.remoteRender=a,"2.7.6"<elementor.config.version){var r=e.getContainer(),d=e.getContainer().settings.attributes;Object.keys(t).forEach(function(e){d[e]=t[e]}),parent.window.$e.run("document/elements/settings",{container:r,settings:d,options:{external:a}})}else Object.keys(t).forEach(function(e){n.setSetting(e,t[e])});advanced_data_table_timeout=setTimeout(function(){n.remoteRender=!0},1001)},Advanced_Data_Table_Update_Model=function(a,e,t,n){if(a.remoteRender=t,"2.7.6"<elementor.config.version){var r=e.settings.attributes;Object.keys(n).forEach(function(e){r[e]=n[e]}),parent.window.$e.run("document/elements/settings",{container:e,settings:r,options:{external:t}})}else Object.keys(n).forEach(function(e){a.setSetting(e,n[e])});advanced_data_table_timeout=setTimeout(function(){a.remoteRender=!0},1001)},Advanced_Data_Table=function(e,n){var u=e.context.querySelector(".ea-advanced-data-table"),a=e.context.querySelector(".ea-advanced-data-table-search"),v=e.context.querySelector(".ea-advanced-data-table-pagination"),b={};if(isEditMode){var t="readonly";u.classList.contains("ea-advanced-data-table-static")&&(t="",u.querySelectorAll("th, td").forEach(function(e){var a=e.innerHTML;0!==a.indexOf('<textarea rows="1">')&&(e.innerHTML='<textarea rows="1" '+t+">"+a+"</textarea>")})),u.addEventListener("mousedown",function(e){"th"===e.target.tagName.toLowerCase()&&(e.stopPropagation(),advanced_data_table_dragging=!0,advanced_data_table_drag_el=e.target,advanced_data_table_drag_start_x=e.pageX,advanced_data_table_drag_start_width=e.target.offsetWidth)}),document.addEventListener("mousemove",function(e){advanced_data_table_dragging&&(advanced_data_table_drag_el.style.width=advanced_data_table_drag_start_width+(event.pageX-advanced_data_table_drag_start_x)+"px")}),document.addEventListener("mouseup",function(e){advanced_data_table_dragging=advanced_data_table_dragging&&!1})}else{if(a&&a.addEventListener("input",function(e){var a=this.value.toLowerCase(),t=u.classList.contains("ea-advanced-data-table-sortable"),n="thead"==u.rows[0].parentNode.tagName.toLowerCase()?1:0;if(1<u.rows.length)if(0<a.length){t&&u.classList.add("ea-advanced-data-table-unsortable"),v&&0<v.innerHTML.length&&(v.style.display="none");for(var r=n;r<u.rows.length;r++){var d=!1;if(0<u.rows[r].cells.length)for(var l=0;l<u.rows[r].cells.length;l++)if(-1<u.rows[r].cells[l].textContent.toLowerCase().indexOf(a)){d=!0;break}u.rows[r].style.display=d?"table-row":"none"}}else if(t&&u.classList.remove("ea-advanced-data-table-unsortable"),v&&0<v.innerHTML.length){v.style.display="";var o=v.querySelector(".ea-advanced-data-table-pagination-current").dataset.page,c=(o-1)*u.dataset.itemsPerPage+1,i=o*u.dataset.itemsPerPage;for(r=1;r<=u.rows.length-1;r++)u.rows[r].style.display=c<=r&&r<=i?"table-row":"none"}else for(r=1;r<=u.rows.length-1;r++)u.rows[r].style.display="table-row"}),u.classList.contains("ea-advanced-data-table-sortable")&&u.addEventListener("click",function(e){if("th"===e.target.tagName.toLowerCase()){var a=e.target.cellIndex,t=1,n=1,r=u.rows.length-1,d="",l=e.target.classList,o=[],c=u.cloneNode(!0);d=l.contains("asc")?(e.target.classList.remove("asc"),e.target.classList.add("desc"),"desc"):(l.contains("desc")&&e.target.classList.remove("desc"),e.target.classList.add("asc"),"asc"),v&&0<v.innerHTML.length&&(t=v.querySelector(".ea-advanced-data-table-pagination-current").dataset.page,n=(t-1)*u.dataset.itemsPerPage+1,r=r-(t-1)*u.dataset.itemsPerPage>=u.dataset.itemsPerPage?t*u.dataset.itemsPerPage:r),b[t]=[],u.querySelectorAll("th").forEach(function(e){e.cellIndex!=a&&e.classList.remove("asc","desc"),b[t].push(e.classList.contains("asc")?"asc":e.classList.contains("desc")?"desc":"")});for(var i=n;i<=r;i++){var s,_=u.rows[i].cells[a];s=isNaN(parseInt(_.innerText))?_.innerText.toLowerCase():parseInt(_.innerText),o.push({index:i,value:s})}"asc"==d?o.sort(function(e,a){return e.value>a.value?1:-1}):"desc"==d&&o.sort(function(e,a){return e.value<a.value?1:-1}),o.forEach(function(e,a){u.rows[n+a].innerHTML=c.rows[e.index].innerHTML})}}),u.classList.contains("ea-advanced-data-table-paginated")){var r="",d=v.classList.contains("ea-advanced-data-table-pagination-button")?"button":"select",l=1,o="thead"==u.rows[0].parentNode.tagName.toLowerCase()?1:0,c=l*u.dataset.itemsPerPage,i=Math.ceil((u.rows.length-1)/u.dataset.itemsPerPage);if(1<i)if("button"==d){for(var s=1;s<=i;s++)r+='<a href="#" data-page="'+s+'" class="'+(1==s?"ea-advanced-data-table-pagination-current":"")+'">'+s+"</a>";v.insertAdjacentHTML("beforeend",'<a href="#" data-page="1">&laquo;</a>'+r+'<a href="#" data-page="'+i+'">&raquo;</a>')}else{for(s=1;s<=i;s++)r+='<option value="'+s+'">'+s+"</option>";v.insertAdjacentHTML("beforeend","<select>"+r+"</select>")}for(s=0;s<=c&&!(s>=u.rows.length);s++)u.rows[s].style.display="table-row";"button"==d?v.addEventListener("click",function(e){if(e.preventDefault(),"a"==e.target.tagName.toLowerCase()){l=e.target.dataset.page,offset="thead"==u.rows[0].parentNode.tagName.toLowerCase()?1:0,o=(l-1)*u.dataset.itemsPerPage+offset,c=l*u.dataset.itemsPerPage,v.querySelectorAll(".ea-advanced-data-table-pagination-current").forEach(function(e){e.classList.remove("ea-advanced-data-table-pagination-current")}),v.querySelectorAll('[data-page="'+l+'"]').forEach(function(e){e.classList.add("ea-advanced-data-table-pagination-current")});for(var a=offset;a<=u.rows.length-1;a++)u.rows[a].style.display=o<=a&&a<=c?"table-row":"none";u.querySelectorAll("th").forEach(function(e,a){e.classList.remove("asc","desc"),void 0!==b[l]&&b[l][a]&&e.classList.add(b[l][a])})}}):v.hasChildNodes()&&v.querySelector("select").addEventListener("input",function(e){e.preventDefault(),l=e.target.value,offset="thead"==u.rows[0].parentNode.tagName.toLowerCase()?1:0,o=(l-1)*u.dataset.itemsPerPage+offset,c=l*u.dataset.itemsPerPage;for(var a=offset;a<=u.rows.length-1;a++)u.rows[a].style.display=o<=a&&a<=c?"table-row":"none";u.querySelectorAll("th").forEach(function(e,a){e.classList.remove("asc","desc"),void 0!==b[l]&&b[l][a]&&e.classList.add(b[l][a])})})}u.querySelectorAll(".nt_button_woo").forEach(function(e){e.classList.add("add_to_cart_button","ajax_add_to_cart")}),u.querySelectorAll(".nt_woo_quantity").forEach(function(e){e.addEventListener("input",function(e){var a=e.target.dataset.product_id,t=e.target.value;n(".nt_add_to_cart_"+a,n(u)).data("quantity",t)})})}},Advanced_Data_Table_Click_Handler=function(a,e,n){if("ea:advTable:export"==event.target.dataset.event){for(var t=n.el.querySelector(".ea-advanced-data-table-"+e.attributes.id),r=t.querySelectorAll("table tr"),d=[],l=0;l<r.length;l++){var o=[],c=r[l].querySelectorAll("th, td");if(t.classList.contains("ea-advanced-data-table-static"))for(var i=0;i<c.length;i++)o.push(JSON.stringify(c[i].querySelector("textarea").value.replace(/(\r\n|\n|\r)/gm," ").trim()));else for(i=0;i<c.length;i++)o.push(JSON.stringify(c[i].innerHTML.replace(/(\r\n|\n|\r)/gm," ").trim()));d.push(o.join(","))}var s=new Blob([d.join("\n")],{type:"text/csv"}),_=parent.document.createElement("a");_.classList.add("ea-adv-data-table-download-"+e.attributes.id),_.download="ea-adv-data-table-"+e.attributes.id+".csv",_.href=window.URL.createObjectURL(s),_.style.display="none",parent.document.body.appendChild(_),_.click(),parent.document.querySelector(".ea-adv-data-table-download-"+e.attributes.id).remove()}else if("ea:advTable:import"==event.target.dataset.event){var u=a.el.querySelector(".ea_adv_table_csv_string"),v=a.el.querySelector(".ea_adv_table_csv_string_table").checked,b=u.value.split("\n"),f="",g="";0<u.value.length&&(g+="<tbody>",b.forEach(function(e,a){0<e.length&&0<(c=e.match(/("(?:[^"\\]|\\.)*"|[^","]+)/gm)).length&&(v&&0==a?(f+="<thead><tr>",c.forEach(function(e){e.match(/(^"")|(^")|("$)|(""$)/g)?f+="<th>"+JSON.parse(e)+"</th>":f+="<th>"+e+"</th>"}),f+="</tr></thead>"):(g+="<tr>",c.forEach(function(e){e.match(/(^"")|(^")|("$)|(""$)/g)?g+="<td>"+JSON.parse(e)+"</td>":g+="<td>"+e+"</td>"}),g+="</tr>"))}),g+="</tbody>",(0<f.length||0<g.length)&&Advanced_Data_Table_Update_View(n,!0,{ea_adv_data_table_static_html:f+g})),u.value=""}else if("ea:advTable:connect"==event.target.dataset.event){var m=event.target;m.innerHTML="Connecting",jQuery.ajax({url:localize.ajaxurl,type:"post",data:{action:"connect_remote_db",security:localize.nonce,host:e.attributes.settings.attributes.ea_adv_data_table_source_remote_host,username:e.attributes.settings.attributes.ea_adv_data_table_source_remote_username,password:e.attributes.settings.attributes.ea_adv_data_table_source_remote_password,database:e.attributes.settings.attributes.ea_adv_data_table_source_remote_database},success:function(e){if(1==e.connected){m.innerHTML="Connected",Advanced_Data_Table_Update_View(n,!0,{ea_adv_data_table_source_remote_connected:!0,ea_adv_data_table_source_remote_tables:e.tables}),a.content.el.querySelector(".elementor-section-title").click(),a.content.el.querySelector(".elementor-section-title").click();var t=a.el.querySelector('[data-setting="ea_adv_data_table_source_remote_table"]');t.length=0,e.tables.forEach(function(e,a){t[a]=new Option(e,e)})}else m.innerHTML="Failed"},error:function(){m.innerHTML="Failed"}}),setTimeout(function(){m.innerHTML="Connect"},2e3)}else"ea:advTable:disconnect"==event.target.dataset.event&&(Advanced_Data_Table_Update_View(n,!0,{ea_adv_data_table_source_remote_connected:!1,ea_adv_data_table_source_remote_tables:[]}),a.content.el.querySelector(".elementor-section-title").click(),a.content.el.querySelector(".elementor-section-title").click())},Advanced_Data_Table_Inline_Edit=function(e,r,d){function a(){var e=setInterval(function(){if(d.el.querySelector(".ea-advanced-data-table")){var n=d.el.querySelector(".ea-advanced-data-table-"+r.attributes.id);n.addEventListener("focusin",function(e){"textarea"==e.target.tagName.toLowerCase()&&(advanced_data_table_active_cell=e.target)}),n.addEventListener("input",function(e){if("textarea"==e.target.tagName.toLowerCase()){clearTimeout(advanced_data_table_timeout);var a=n.cloneNode(!0);a.querySelectorAll("th, td").forEach(function(e){var a=e.querySelector("textarea").value;e.innerHTML=a}),Advanced_Data_Table_Update_View(d,!1,{ea_adv_data_table_static_html:a.innerHTML})}}),n.addEventListener("mouseup",function(e){if(clearTimeout(advanced_data_table_timeout),"th"===e.target.tagName.toLowerCase())if(n.classList.contains("ea-advanced-data-table-static")){var a=n.cloneNode(!0);a.querySelectorAll("th, td").forEach(function(e){var a=e.querySelector("textarea").value;e.innerHTML=a}),Advanced_Data_Table_Update_View(d,!1,{ea_adv_data_table_static_html:a.innerHTML})}else{var t=[];n.querySelectorAll("th").forEach(function(e,a){t[a]=e.style.width}),Advanced_Data_Table_Update_View(d,!1,{ea_adv_data_table_dynamic_th_width:t})}}),n.addEventListener("dblclick",function(e){"th"===e.target.tagName.toLowerCase()&&(e.stopPropagation(),e.target.style.width="")}),clearInterval(e)}},10)}a(),r.on("remote:render",function(){a()});var t=Advanced_Data_Table_Click_Handler.bind(this,e,r,d);e.el.addEventListener("click",t),e.currentPageView.on("destroy",function(){e.el.removeEventListener("click",t)});function n(){setTimeout(function(){var t=e.el.querySelector('[data-setting="ea_adv_data_table_source_remote_table"]');null!=t&&0==t.length&&r.attributes.settings.attributes.ea_adv_data_table_source_remote_tables.forEach(function(e,a){t[a]=new Option(e,e,!1,e==r.attributes.settings.attributes.ea_adv_data_table_source_remote_table)})},50)}n(),e.el.addEventListener("mousedown",function(e){(e.target.classList.contains("elementor-section-title")||e.target.parentNode.classList.contains("elementor-panel-navigation-tab"))&&n()})};Advanced_Data_Table_Context_Menu=function(e,d){return"eael-advanced-data-table"==d.options.model.attributes.widgetType&&"static"==d.options.model.attributes.settings.attributes.ea_adv_data_table_source&&e.push({name:"ea_advanced_data_table",actions:[{name:"add_row_above",title:"Add Row Above",callback:function(){var e=document.querySelector(".ea-advanced-data-table-"+d.options.model.attributes.id);if(null!==advanced_data_table_active_cell&&"th"!=advanced_data_table_active_cell.parentNode.tagName.toLowerCase()){for(var a=advanced_data_table_active_cell.parentNode.parentNode.rowIndex,t=e.insertRow(a),n=0;n<e.rows[0].cells.length;n++){t.insertCell(n).innerHTML='<textarea rows="1"></textarea>'}advanced_data_table_active_cell=null;var r=e.cloneNode(!0);r.querySelectorAll("th, td").forEach(function(e){var a=e.querySelector("textarea").value;e.innerHTML=a}),Advanced_Data_Table_Update_Model(d.options.model,d.container,!1,{ea_adv_data_table_static_html:r.innerHTML})}}},{name:"add_row_below",title:"Add Row Below",callback:function(){var e=document.querySelector(".ea-advanced-data-table-"+d.options.model.attributes.id);if(null!==advanced_data_table_active_cell){for(var a=advanced_data_table_active_cell.parentNode.parentNode.rowIndex+1,t=e.insertRow(a),n=0;n<e.rows[0].cells.length;n++){t.insertCell(n).innerHTML='<textarea rows="1"></textarea>'}advanced_data_table_active_cell=null;var r=e.cloneNode(!0);r.querySelectorAll("th, td").forEach(function(e){var a=e.querySelector("textarea").value;e.innerHTML=a}),Advanced_Data_Table_Update_Model(d.options.model,d.container,!1,{ea_adv_data_table_static_html:r.innerHTML})}}},{name:"add_column_left",title:"Add Column Left",callback:function(){var e=document.querySelector(".ea-advanced-data-table-"+d.options.model.attributes.id);if(null!==advanced_data_table_active_cell){for(var a=advanced_data_table_active_cell.parentNode.cellIndex,t=0;t<e.rows.length;t++){if("th"==e.rows[t].cells[0].tagName.toLowerCase())var n=e.rows[t].insertBefore(document.createElement("th"),e.rows[t].cells[a]);else n=e.rows[t].insertCell(a);n.innerHTML='<textarea rows="1"></textarea>'}advanced_data_table_active_cell=null;var r=e.cloneNode(!0);r.querySelectorAll("th, td").forEach(function(e){var a=e.querySelector("textarea").value;e.innerHTML=a}),Advanced_Data_Table_Update_Model(d.options.model,d.container,!1,{ea_adv_data_table_static_html:r.innerHTML})}}},{name:"add_column_right",title:"Add Column Right",callback:function(){var e=document.querySelector(".ea-advanced-data-table-"+d.options.model.attributes.id);if(null!==advanced_data_table_active_cell){for(var a=advanced_data_table_active_cell.parentNode.cellIndex+1,t=0;t<e.rows.length;t++){if("th"==e.rows[t].cells[0].tagName.toLowerCase())var n=e.rows[t].insertBefore(document.createElement("th"),e.rows[t].cells[a]);else n=e.rows[t].insertCell(a);n.innerHTML='<textarea rows="1"></textarea>'}advanced_data_table_active_cell=null;var r=e.cloneNode(!0);r.querySelectorAll("th, td").forEach(function(e){var a=e.querySelector("textarea").value;e.innerHTML=a}),Advanced_Data_Table_Update_Model(d.options.model,d.container,!1,{ea_adv_data_table_static_html:r.innerHTML})}}},{name:"delete_row",title:"Delete Row",callback:function(){var e=document.querySelector(".ea-advanced-data-table-"+d.options.model.attributes.id);if(null!==advanced_data_table_active_cell){var a=advanced_data_table_active_cell.parentNode.parentNode.rowIndex;e.deleteRow(a),advanced_data_table_active_cell=null;var t=e.cloneNode(!0);t.querySelectorAll("th, td").forEach(function(e){var a=e.querySelector("textarea").value;e.innerHTML=a}),Advanced_Data_Table_Update_Model(d.options.model,d.container,!1,{ea_adv_data_table_static_html:t.innerHTML})}}},{name:"delete_column",title:"Delete Column",callback:function(){var e=document.querySelector(".ea-advanced-data-table-"+d.options.model.attributes.id);if(null!==advanced_data_table_active_cell){for(var a=advanced_data_table_active_cell.parentNode.cellIndex,t=0;t<e.rows.length;t++)e.rows[t].deleteCell(a);advanced_data_table_active_cell=null;var n=e.cloneNode(!0);n.querySelectorAll("th, td").forEach(function(e){var a=e.querySelector("textarea").value;e.innerHTML=a}),Advanced_Data_Table_Update_Model(d.options.model,d.container,!1,{ea_adv_data_table_static_html:n.innerHTML})}}}]}),e},jQuery(window).on("elementor/frontend/init",function(){isEditMode&&(elementor.hooks.addFilter("elements/widget/contextMenuGroups",Advanced_Data_Table_Context_Menu),elementor.hooks.addAction("panel/open_editor/widget/eael-advanced-data-table",Advanced_Data_Table_Inline_Edit)),elementorFrontend.hooks.addAction("frontend/element_ready/eael-advanced-data-table.default",Advanced_Data_Table)});