(()=>{functione(t){returne="function"==typeofSymbol&&"symbol"==typeofSymbol.iterator?function(e){returntypeofe}:function(e){returne&&"function"==typeofSymbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeofe},e(t)}functiont(e,t){varr="undefined"!=typeofSymbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeofe)returnn(e,t);varr=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)returnArray.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))returnn(e,t)}(e))||t&&e&&"number"==typeofe.length){r&&(e=r);varo=0,i=function(){};return{s:i,n:function(){returno>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throwe},f:i}}thrownewTypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}varc,u=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){vare=r.next();returnu=e.done,e},e:function(e){l=!0,c=e},f:function(){try{u||null==r.return||r.return()}finally{if(l)throwc}}}}functionn(e,t){(null==t||t>e.length)&&(t=e.length);for(varn=0,r=newArray(t);n<t;n++)r[n]=e[n];returnr}functionr(t,n){for(varr=0;r<n.length;r++){varo=n[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"ino&&(o.writable=!0),Object.defineProperty(t,(i=o.key,c=void0,c=function(t,n){if("object"!==e(t)||null===t)returnt;varr=t[Symbol.toPrimitive];if(void0!==r){varo=r.call(t,n||"default");if("object"!==e(o))returno;thrownewTypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(i,"string"),"symbol"===e(c)?c:String(c)),o)}vari,c}(new(function(){functione(){!function(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}(this,e),this.parentElement=document.querySelector(".form-check-parent"),this.parentForm=document.getElementById("bulkActions")}varn,o,i;returnn=e,o=[{key:"watchCheckboxes",value:function(e){vart=this;document.querySelectorAll(".child-hidden-input").forEach((function(e){returne.remove()})),document.querySelectorAll(".form-check-child").forEach((function(n){e.checked?(n.checked=e.checked,t.processChildItem(n,document.getElementById("bulkActions"))):(n.checked=!1,document.querySelectorAll(".child-hidden-input").forEach((function(e){returne.remove()})))}))}},{key:"processChildItem",value:function(e,n){if((arguments.length>2&&void0!==arguments[2]?arguments[2]:{}).hasOwnProperty("single")&&document.querySelectorAll(".child-hidden-input").forEach((function(e){returne.remove()})),!1!==e.checked){varr=document.createElement("INPUT");r.setAttribute("name","purchase_orders[]"),r.setAttribute("value",e.dataset.value),r.setAttribute("class","child-hidden-input"),r.hidden=!0,n.append(r)}else{varo,i=t(document.querySelectorAll("input.child-hidden-input"));try{for(i.s();!(o=i.n()).done;){varc=o.value;c.value==e.dataset.value&&c.remove()}}catch(e){i.e(e)}finally{i.f()}}}},{key:"handle",value:function(){vare=this;this.parentElement.addEventListener("click",(function(){e.watchCheckboxes(e.parentElement)}));varn,r=t(document.querySelectorAll(".form-check-child"));try{varo=function(){vart=n.value;t.addEventListener("click",(function(){e.processChildItem(t,e.parentForm)}))};for(r.s();!(n=r.n()).done;)o()}catch(e){r.e(e)}finally{r.f()}}}],o&&r(n.prototype,o),i&&r(n,i),Object.defineProperty(n,"prototype",{writable:!1}),e}())).handle()})();