/*! For license information please see grid.bundle.js.LICENSE.txt */ !function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){"use strict";(function(t){var n=function(){if("undefined"!=typeof Map)return Map;function t(t,e){var n=-1;return t.some((function(t,o){return t[0]===e&&(n=o,!0)})),n}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var n=t(this.__entries__,e),o=this.__entries__[n];return o&&o[1]},e.prototype.set=function(e,n){var o=t(this.__entries__,e);~o?this.__entries__[o][1]=n:this.__entries__.push([e,n])},e.prototype.delete=function(e){var n=this.__entries__,o=t(n,e);~o&&n.splice(o,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var n=0,o=this.__entries__;n0},t.prototype.connect_=function(){o&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),s?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},t.prototype.disconnect_=function(){o&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},t.prototype.onTransitionEnd_=function(t){var e=t.propertyName,n=void 0===e?"":e;a.some((function(t){return!!~n.indexOf(t)}))&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),c=function(t,e){for(var n=0,o=Object.keys(e);n0},t}(),D="undefined"!=typeof WeakMap?new WeakMap:new n,_=function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=l.getInstance(),o=new w(e,n,this);D.set(this,o)};["observe","unobserve","disconnect"].forEach((function(t){_.prototype[t]=function(){var e;return(e=D.get(this))[t].apply(e,arguments)}}));var O=void 0!==i.ResizeObserver?i.ResizeObserver:_;e.a=O}).call(this,n(3))},,function(t,e,n){t.exports=n(6)},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){var n,o,i,r,a,s;n=jQuery,o=window,i=window.document,r="touchstart mousedown",a="touchmove mousemove",s="touchend mouseup",n(i).ready((function(){function t(t){for(var e={},n=t.match(/([^;:]+)/g)||[];n.length;)e[n.shift()]=n.shift().trim();return e}n("table").each((function(){"dnd"===n(this).data("table")&&n(this).tableDnD({onDragStyle:n(this).data("ondragstyle")&&t(n(this).data("ondragstyle"))||null,onDropStyle:n(this).data("ondropstyle")&&t(n(this).data("ondropstyle"))||null,onDragClass:void 0===n(this).data("ondragclass")?"tDnD_whileDrag":n(this).data("ondragclass"),onDrop:n(this).data("ondrop")&&new Function("table","row",n(this).data("ondrop")),onDragStart:n(this).data("ondragstart")&&new Function("table","row",n(this).data("ondragstart")),onDragStop:n(this).data("ondragstop")&&new Function("table","row",n(this).data("ondragstop")),scrollAmount:n(this).data("scrollamount")||5,sensitivity:n(this).data("sensitivity")||10,hierarchyLevel:n(this).data("hierarchylevel")||0,indentArtifact:n(this).data("indentartifact")||'
 
',autoWidthAdjust:n(this).data("autowidthadjust")||!0,autoCleanRelations:n(this).data("autocleanrelations")||!0,jsonPretifySeparator:n(this).data("jsonpretifyseparator")||"\t",serializeRegexp:n(this).data("serializeregexp")&&new RegExp(n(this).data("serializeregexp"))||/[^\-]*$/,serializeParamName:n(this).data("serializeparamname")||!1,dragHandle:n(this).data("draghandle")||null})}))})),jQuery.tableDnD={currentTable:null,dragObject:null,mouseOffset:null,oldX:0,oldY:0,build:function(t){return this.each((function(){this.tableDnDConfig=n.extend({onDragStyle:null,onDropStyle:null,onDragClass:"tDnD_whileDrag",onDrop:null,onDragStart:null,onDragStop:null,scrollAmount:5,sensitivity:10,hierarchyLevel:0,indentArtifact:'
 
',autoWidthAdjust:!0,autoCleanRelations:!0,jsonPretifySeparator:"\t",serializeRegexp:/[^\-]*$/,serializeParamName:!1,dragHandle:null},t||{}),n.tableDnD.makeDraggable(this),this.tableDnDConfig.hierarchyLevel&&n.tableDnD.makeIndented(this)})),this},makeIndented:function(t){var e,o,i=t.tableDnDConfig,r=t.rows,a=n(r).first().find("td:first")[0],s=0,l=0;if(n(t).hasClass("indtd"))return null;o=n(t).addClass("indtd").attr("style"),n(t).css({whiteSpace:"nowrap"});for(var c=0;ct.vertical&&this.dragObject.parentNode.insertBefore(this.dragObject,e.nextSibling)||00&&n(e).find("td:first").children(":first").remove()&&n(e).data("level",--o),0>t.horizontal&&o=o&&n(e).children(":first").prepend(i.indentArtifact)&&n(e).data("level",++o)},mousemove:function(t){var e,o,i,r,a,s=n(n.tableDnD.dragObject),l=n.tableDnD.currentTable.tableDnDConfig;return t&&t.preventDefault(),!!n.tableDnD.dragObject&&("touchmove"===t.type&&event.preventDefault(),l.onDragClass&&s.addClass(l.onDragClass)||s.css(l.onDragStyle),r=(o=n.tableDnD.mouseCoords(t)).x-n.tableDnD.mouseOffset.x,a=o.y-n.tableDnD.mouseOffset.y,n.tableDnD.autoScroll(o),e=n.tableDnD.findDropTargetRow(s,a),i=n.tableDnD.findDragDirection(r,a),n.tableDnD.moveVerticle(i,e),n.tableDnD.moveHorizontal(i,e),!1)},findDragDirection:function(t,e){var n=this.currentTable.tableDnDConfig.sensitivity,o=this.oldX,i=this.oldY,r={horizontal:t>=o-n&&t<=o+n?0:t>o?-1:1,vertical:e>=i-n&&e<=i+n?0:e>i?-1:1};return 0!==r.horizontal&&(this.oldX=t),0!==r.vertical&&(this.oldY=e),r},findDropTargetRow:function(t,e){for(var o=0,i=this.currentTable.rows,r=this.currentTable.tableDnDConfig,a=0,s=null,l=0;la-o&&e1&&n(this.currentTable.rows).each((function(){if((r=n(this).data("level"))>1)for(o=n(this).prev().data("level");r>o+1;)n(this).find("td:first").children(":first").remove(),n(this).data("level",--r)})),t.onDragClass&&n(e).removeClass(t.onDragClass)||n(e).css(t.onDropStyle),this.dragObject=null,t.onDrop&&this.originalOrder!==this.currentOrder()&&n(e).hide().fadeIn("fast")&&t.onDrop(this.currentTable,e),t.onDragStop&&t.onDragStop(this.currentTable,e),this.currentTable=null},mouseup:function(t){return t&&t.preventDefault(),n.tableDnD.processMouseup(),!1},jsonize:function(t){var e=this.currentTable;return t?JSON.stringify(this.tableData(e),null,e.tableDnDConfig.jsonPretifySeparator):JSON.stringify(this.tableData(e))},serialize:function(){return n.param(this.tableData(this.currentTable))},serializeTable:function(t){for(var e="",n=t.tableDnDConfig.serializeParamName||t.id,o=t.rows,i=0;i0&&(e+="&");var r=o[i].id;r&&t.tableDnDConfig&&t.tableDnDConfig.serializeRegexp&&(e+=n+"[]="+(r=r.match(t.tableDnDConfig.serializeRegexp)[0]))}return e},serializeTables:function(){var t=[];return n("table").each((function(){this.id&&t.push(n.param(n.tableDnD.tableData(this)))})),t.join("&")},tableData:function(t){var e,o,i,r,a=t.tableDnDConfig,s=[],l=0,c=0,d=null,u={};if(t||(t=this.currentTable),!t||!t.rows||!t.rows.length)return{error:{code:500,message:"Not a valid table."}};if(!t.id&&!a.serializeParamName)return{error:{code:500,message:"No serializable unique id provided."}};r=a.autoCleanRelations&&t.rows||n.makeArray(t.rows),e=function(t){return t&&a&&a.serializeRegexp?t.match(a.serializeRegexp)[0]:t},u[i=o=a.serializeParamName||t.id]=[],!a.autoCleanRelations&&n(r[0]).data("level")&&r.unshift({id:"undefined"});for(var h=0;hl)s.push([i,l]),i=e(r[h-1].id);else if(c=l&&(s[f][1]=0);l=c,n.isArray(u[i])||(u[i]=[]),(d=e(r[h].id))&&u[i].push(d)}else(d=e(r[h].id))&&u[i].push(d);return u}},jQuery.fn.extend({tableDnD:n.tableDnD.build,tableDnDUpdate:n.tableDnD.updateTables,tableDnDSerialize:n.proxy(n.tableDnD.serialize,n.tableDnD),tableDnDSerializeAll:n.tableDnD.serializeTables,tableDnDData:n.proxy(n.tableDnD.tableData,n.tableDnD)})},,function(t,e,n){"use strict";n.r(e);var o={categoryDeleteAction:".js-delete-category-row-action",customerDeleteAction:".js-delete-customer-row-action",linkRowAction:".js-link-row-action",linkRowActionClickableFirst:".js-link-row-action[data-clickable-row=1]:first",clickableTd:"td.clickable"},i=function(t){return"".concat(t,"-grid-confirm-modal")},r=".js-grid-table",a=".js-drag-handle",s="js-drag-handle",l=function(t){return"#".concat(t,"_grid")},c=".js-grid-panel",d=".js-grid-header",u=function(t){return".js-grid-table .js-".concat(t,"-position")},h=function(t){return".js-".concat(t,"-position:first")},f="table.table",p="position-row-while-drag",m=window.$,b=function(){function t(t){this.id=t,this.$container=m(l(this.id))}return t.prototype.getId=function(){return this.id},t.prototype.getContainer=function(){return this.$container},t.prototype.getHeaderContainer=function(){return this.$container.closest(c).find(d)},t.prototype.addExtension=function(t){t.extend(this)},t}(),v=window.$,g=function(){function t(){}return t.prototype.extend=function(t){this.initRowLinks(t),this.initConfirmableActions(t)},t.prototype.initConfirmableActions=function(t){t.getContainer().on("click",o.linkRowAction,(function(t){var e=v(t.currentTarget).data("confirm-message");e.length&&!window.confirm(e)&&t.preventDefault()}))},t.prototype.initRowLinks=function(t){v("tr",t.getContainer()).each((function(){var t=v(this);v(o.linkRowActionClickableFirst,t).each((function(){var e=v(this),n=e.closest("td"),i=v(o.clickableTd,t).not(n),r=!1;i.addClass("cursor-pointer").mousedown((function(){v(window).mousemove((function(){r=!0,v(window).unbind("mousemove")}))})),i.mouseup((function(){var t=r;if(r=!1,v(window).unbind("mousemove"),!t){var n=e.data("confirm-message");(!n.length||window.confirm(n)&&e.attr("href"))&&(document.location.href=e.attr("href"))}}))}))}))},t}(),y=function(){return y=Object.assign||function(t){for(var e,n=1,o=arguments.length;n",{action:t.data("url"),method:n?e:"POST"}).appendTo("body");n||o.append(I("",{type:"hidden",name:"_method",value:e})),o.submit()},t.prototype.showConfirmModal=function(t,e,n,o,r){var a=this,s=t.data("confirmButtonLabel"),l=t.data("closeButtonLabel"),c=t.data("confirmButtonClass");new j({id:i(e.getId()),confirmTitle:o,confirmMessage:n,confirmButtonLabel:s,closeButtonLabel:l,confirmButtonClass:c},(function(){return a.postForm(t,r)})).show()},t}(),N=window.$,W=function(){function t(t){var e;this.selector=".ps-sortable-column",this.idTable=null!==(e=t.attr("id"))&&void 0!==e?e:"",this.columns=t.find(this.selector)}return t.prototype.attach=function(){var t=this;this.columns.on("click",(function(e){var n=N(e.delegateTarget);t.sortByColumn(n,t.getToggledSortDirection(n))}))},t.prototype.sortBy=function(t,e){if(!this.columns.is('[data-sort-col-name="'.concat(t,'"]')))throw new Error('Cannot sort by "'.concat(t,'": invalid column'));this.sortByColumn(this.columns,e)},t.prototype.sortByColumn=function(t,e){window.location.href=this.getUrl(t.data("sortColName"),"desc"===e?"desc":"asc",t.data("sortPrefix"))},t.prototype.getToggledSortDirection=function(t){return"asc"===t.data("sortDirection")?"desc":"asc"},t.prototype.getUrl=function(t,e,n){var o=new URL(window.location.href),i=o.searchParams;return n?(i.set("".concat(n,"[orderBy]"),t),i.set("".concat(n,"[sortOrder]"),e)):(i.set("orderBy",t),i.set("sortOrder",e)),o.hash=this.idTable,o.toString()},t}(),F=function(){function t(){}return t.prototype.extend=function(t){var e=t.getContainer().find(f);new W(e).attach()},t}(),q=(n(4),window.$),U=function(){function t(t){this.grid=t}return t.prototype.extend=function(t){var e=this;this.grid=t,this.addIdsToGridTableRows(),t.getContainer().find(r).tableDnD({onDragClass:p,dragHandle:a,onDrop:function(t,n){return e.handlePositionChange(n)}}),t.getContainer().find(".js-drag-handle").hover((function(){q(this).closest("tr").addClass("hover")}),(function(){q(this).closest("tr").removeClass("hover")}))},t.prototype.handlePositionChange=function(t){var e=q(t).find(h(this.grid.getId())),n=e.data("update-url"),o=e.data("update-method"),i={positions:this.getRowsPositions()};this.updatePosition(n,i,o)},t.prototype.getRowsPositions=function(){for(var t,e=JSON.parse(q.tableDnD.jsonize())["".concat(this.grid.getId(),"_grid_table")],n=[],o=0;o",{action:t,method:i?n:"POST"}).appendTo("body"),a=e.positions.length,s=0;s",{type:"hidden",name:"positions[".concat(s,"][rowId]"),value:o.rowId}),q("",{type:"hidden",name:"positions[".concat(s,"][oldPosition]"),value:o.oldPosition}),q("",{type:"hidden",name:"positions[".concat(s,"][newPosition]"),value:o.newPosition}));i||r.append(q("",{type:"hidden",name:"_method",value:n})),r.submit()},t.prototype.computeMappingBetweenOldAndNewPositions=function(t){for(var e,n=/^row_(?\d+)_(?\d+)$/,o=[],i=0;i{document.querySelectorAll(".js-grid").forEach((t=>{const e=new b(t.dataset.gridId);e.addExtension(new F),e.addExtension(new g),e.addExtension(new H),e.addExtension(new U)}))}))}]);