File: D:/HostingSpaces/SBogers10/conmeq.komma.pro/wwwroot/js/kms/core.js
function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),t}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function createNewEvent(t){var e;return"function"==typeof Event?e=new Event(t):(e=document.createEvent("Event")).initEvent(t,!0,!0),e}function dispatchEventForElement(t,e){document.createEvent?t.dispatchEvent(e):t.fireEvent("on"+e.eventType,e)}Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},function(){"use strict";if("undefined"!=typeof window){var t=window.navigator.userAgent.match(/Edge\/(\d{2})\./),e=!!t&&16<=parseInt(t[1],10);if("objectFit"in document.documentElement.style==0||e){var n=function(t,e,n){var i,o,r,a,s;if((n=n.split(" ")).length<2&&(n[1]=n[0]),"x"===t)i=n[0],o=n[1],r="left",a="right",s=e.clientWidth;else{if("y"!==t)return;i=n[1],o=n[0],r="top",a="bottom",s=e.clientHeight}if(i!==r&&o!==r){if(i!==a&&o!==a)return"center"===i||"50%"===i?(e.style[r]="50%",void(e.style["margin-"+r]=s/-2+"px")):void(0<=i.indexOf("%")?(i=parseInt(i))<50?(e.style[r]=i+"%",e.style["margin-"+r]=s*(i/-100)+"px"):(i=100-i,e.style[a]=i+"%",e.style["margin-"+a]=s*(i/-100)+"px"):e.style[r]=i);e.style[a]="0"}else e.style[r]="0"},i=function(t){var e=t.dataset?t.dataset.objectFit:t.getAttribute("data-object-fit"),i=t.dataset?t.dataset.objectPosition:t.getAttribute("data-object-position");e=e||"cover",i=i||"50% 50%";var o=t.parentNode;return function(t){var e=window.getComputedStyle(t,null),n=e.getPropertyValue("position"),i=e.getPropertyValue("overflow"),o=e.getPropertyValue("display");n&&"static"!==n||(t.style.position="relative"),"hidden"!==i&&(t.style.overflow="hidden"),o&&"inline"!==o||(t.style.display="block"),0===t.clientHeight&&(t.style.height="100%"),-1===t.className.indexOf("object-fit-polyfill")&&(t.className=t.className+" object-fit-polyfill")}(o),function(t){var e=window.getComputedStyle(t,null),n={"max-width":"none","max-height":"none","min-width":"0px","min-height":"0px",top:"auto",right:"auto",bottom:"auto",left:"auto","margin-top":"0px","margin-right":"0px","margin-bottom":"0px","margin-left":"0px"};for(var i in n)e.getPropertyValue(i)!==n[i]&&(t.style[i]=n[i])}(t),t.style.position="absolute",t.style.width="auto",t.style.height="auto","scale-down"===e&&(e=t.clientWidth<o.clientWidth&&t.clientHeight<o.clientHeight?"none":"contain"),"none"===e?(n("x",t,i),void n("y",t,i)):"fill"===e?(t.style.width="100%",t.style.height="100%",n("x",t,i),void n("y",t,i)):(t.style.height="100%",void("cover"===e&&t.clientWidth>o.clientWidth||"contain"===e&&t.clientWidth<o.clientWidth?(t.style.top="0",t.style.marginTop="0",n("x",t,i)):(t.style.width="100%",t.style.height="auto",t.style.left="0",t.style.marginLeft="0",n("y",t,i))))},o=function(t){if(void 0===t||t instanceof Event)t=document.querySelectorAll("[data-object-fit]");else if(t&&t.nodeName)t=[t];else{if("object"!=_typeof(t)||!t.length||!t[0].nodeName)return!1;t=t}for(var n=0;n<t.length;n++)if(t[n].nodeName){var o=t[n].nodeName.toLowerCase();"img"!==o||e?"video"===o?0<t[n].readyState?i(t[n]):t[n].addEventListener("loadedmetadata",function(){i(this)}):i(t[n]):t[n].complete?i(t[n]):t[n].addEventListener("load",function(){i(this)})}return!0};document.addEventListener("DOMContentLoaded",o),window.addEventListener("resize",o),window.objectFitPolyfill=o}else window.objectFitPolyfill=function(){return!1}}}(),function(t,e){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?e():"function"==typeof define&&define.amd?define(e):e()}(0,function(){"use strict";function t(t){var e=this.constructor;return this.then(function(n){return e.resolve(t()).then(function(){return n})},function(n){return e.resolve(t()).then(function(){return e.reject(n)})})}var e=setTimeout;function n(){}function i(t){if(!(this instanceof i))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],c(t,this)}function o(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,i._immediateFn(function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var i;try{i=n(t._value)}catch(t){return void a(e.promise,t)}r(e.promise,i)}else(1===t._state?r:a)(e.promise,t._value)})):t._deferreds.push(e)}function r(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"===_typeof(e)||"function"==typeof e)){var n=e.then;if(e instanceof i)return t._state=3,t._value=e,void s(t);if("function"==typeof n)return void c((o=n,r=e,function(){o.apply(r,arguments)}),t)}t._state=1,t._value=e,s(t)}catch(e){a(t,e)}var o,r}function a(t,e){t._state=2,t._value=e,s(t)}function s(t){2===t._state&&0===t._deferreds.length&&i._immediateFn(function(){t._handled||i._unhandledRejectionFn(t._value)});for(var e=0,n=t._deferreds.length;e<n;e++)o(t,t._deferreds[e]);t._deferreds=null}function l(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function c(t,e){var n=!1;try{t(function(t){n||(n=!0,r(e,t))},function(t){n||(n=!0,a(e,t))})}catch(t){if(n)return;n=!0,a(e,t)}}i.prototype.catch=function(t){return this.then(null,t)},i.prototype.then=function(t,e){var i=new this.constructor(n);return o(this,new l(t,e,i)),i},i.prototype.finally=t,i.all=function(t){return new i(function(e,n){if(!t||void 0===t.length)throw new TypeError("Promise.all accepts an array");var i=Array.prototype.slice.call(t);if(0===i.length)return e([]);var o=i.length;function r(t,a){try{if(a&&("object"===_typeof(a)||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,function(e){r(t,e)},n)}i[t]=a,0==--o&&e(i)}catch(t){n(t)}}for(var a=0;a<i.length;a++)r(a,i[a])})},i.resolve=function(t){return t&&"object"===_typeof(t)&&t.constructor===i?t:new i(function(e){e(t)})},i.reject=function(t){return new i(function(e,n){n(t)})},i.race=function(t){return new i(function(e,n){for(var i=0,o=t.length;i<o;i++)t[i].then(e,n)})},i._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){e(t,0)},i._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var u=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}();"Promise"in u?u.Promise.prototype.finally||(u.Promise.prototype.finally=t):u.Promise=i}),function(t,e){"use strict";"object"==("undefined"==typeof module?"undefined":_typeof(module))&&"object"==_typeof(module.exports)?module.exports=e(t):e(t)}("undefined"!=typeof window?window:global,function(t){"use strict";var e=Object.defineProperty,n=Object.defineProperties,i=0,o=[],r=Array.prototype.slice,a="object"==_typeof(t.ES6)?t.ES6:t.ES6={},s=Array.isArray,l=Object.prototype.toString,c=Array.prototype.push,u=function(){},d=function(t){return t},h=function(t){return"function"==typeof t},f=function(){},p=function(t,e){this._array=t,this._flag=e,this._nextIndex=0},v=function(t,e){this._string=t,this._flag=e,this._nextIndex=0},m=function(t){return null!==t&&("object"==_typeof(t)||"function"==typeof t)},b=function(t,e){if("number"==typeof t.length&&t.length>=0&&"number"==typeof e.length&&e.length>=0){var n=Math.floor(t.length),i=Math.floor(e.length),o=0;for(t.length=n+i;o<i;++o)e.hasOwnProperty(o)&&(t[n+o]=e[o])}},g=function(t,e){if("function"!=typeof t||"function"!=typeof e)throw new TypeError("Child and Parent must be function type");t.prototype=Object.create(e.prototype),t.prototype.constructor=t},y=function t(e){if(e=void 0===e?"":String(e),this instanceof t)throw new TypeError("Symbol is not a constructor");return function(t,e){return n(t,{_description:{value:e},_isSymbol:{value:!0},_id:{value:i++}}),t}(Object.create(t.prototype),e)};n(y,{for:{value:function(t){t=String(t);for(var e,n=o.length,i=0;i<n;++i)if((e=o[i]).key===t)return e.symbol;return e={key:t,symbol:y(t)},o.push(e),e.symbol},writable:!0,configurable:!0},keyFor:{value:function(t){if(!a.isSymbol(t))throw new TypeError(String(t)+" is not a symbol");for(var e,n=o.length,i=0;i<n;++i)if((e=o[i]).symbol===t)return e.key},writable:!0,configurable:!0},hasInstance:{value:y("Symbol.hasInstance")},isConcatSpreadable:{value:y("Symbol.isConcatSpreadable")},iterator:{value:y("Symbol.iterator")},toStringTag:{value:y("Symbol.toStringTag")}}),y.prototype.toString=function(){return"@@_____"+this._id+"_____"},y.prototype.valueOf=function(){return this},e(f.prototype,y.iterator.toString(),{value:function(){return this},writable:!0,configurable:!0}),g(p,f),g(v,f),e(p.prototype,y.toStringTag.toString(),{value:"Array Iterator",configurable:!0}),e(v.prototype,y.toStringTag.toString(),{value:"String Iterator",configurable:!0}),p.prototype.next=function(){if(!(this instanceof p))throw new TypeError("Method Array Iterator.prototype.next called on incompatible receiver "+String(this));var t;return-1===this._nextIndex?{done:!0,value:void 0}:"number"==typeof this._array.length&&this._array.length>=0&&this._nextIndex<Math.floor(this._array.length)?(1===this._flag?t=[this._nextIndex,this._array[this._nextIndex]]:2===this._flag?t=this._array[this._nextIndex]:3===this._flag&&(t=this._nextIndex),this._nextIndex++,{done:!1,value:t}):(this._nextIndex=-1,{done:!0,value:void 0})},v.prototype.next=function(){if(!(this instanceof v))throw new TypeError("Method String Iterator.prototype.next called on incompatible receiver "+String(this));var t,e=new String(this._string);return-1===this._nextIndex?{done:!0,value:void 0}:this._nextIndex<e.length?(t=e[this._nextIndex],this._nextIndex++,{done:!1,value:t}):(this._nextIndex=-1,{done:!0,value:void 0})};var _=function(t,e){this._target=t,this._values=[],this._thisArg=e};return _.prototype.spread=function(){var t=this;return r.call(arguments).forEach(function(e){a.forOf(e,function(e){t._values.push(e)})}),t},_.prototype.add=function(){var t=this;return r.call(arguments).forEach(function(e){t._values.push(e)}),t},_.prototype.call=function(t){if("function"!=typeof this._target)throw new TypeError("Target is not a function");return t=arguments.length<=0?this._thisArg:t,this._target.apply(t,this._values)},_.prototype.new=function(){if("function"!=typeof this._target)throw new TypeError("Target is not a constructor");var t,e;return t=Object.create(this._target.prototype),e=this._target.apply(t,this._values),m(e)?e:t},_.prototype.array=function(){if(!s(this._target))throw new TypeError("Target is not a array");return c.apply(this._target,this._values),this._target},n(a,{isSymbol:{value:function(t){return t instanceof y&&function(t){return!0===t._isSymbol&&"number"==typeof t._id&&"string"==typeof t._description}(t)},writable:!0,configurable:!0},instanceOf:{value:function(t,e){if(!m(e))throw new TypeError("Right-hand side of 'instanceof' is not an object");var n=e[y.hasInstance];if(void 0===n)return t instanceof e;if("function"!=typeof n)throw new TypeError(_typeof(n)+" is not a function");return n.call(e,t)},writable:!0,configurable:!0},forOf:{value:function(t,e,n){if(e="function"!=typeof e?u:e,"function"!=typeof t[y.iterator])throw new TypeError("Iterable[Symbol.iterator] is not a function");var i,o=t[y.iterator]();if("function"!=typeof o.next)throw new TypeError(".iterator.next is not a function");for(;;){if(i=o.next(),!m(i))throw new TypeError("Iterator result "+i+" is not an object");if(i.done)break;e.call(n,i.value)}},writable:!0,configurable:!0},spreadOperator:{value:function(t,e){if("function"!=typeof t&&!s(t))throw new TypeError("Spread operator only supports on array and function objects at this moment");return new _(t,e)},writable:!0,configurable:!0}}),e(t,"Symbol",{value:y,writable:!0,configurable:!0}),e(Function.prototype,y.hasInstance.toString(),{value:function(t){return"function"==typeof this&&t instanceof this}}),e(Array.prototype,"concat",{value:function(){if(null==this)throw new TypeError("Array.prototype.concat called on null or undefined");var t=Object(this),e=r.call(arguments),n=[];return e.unshift(t),e.forEach(function(t){m(t)?void 0!==t[y.isConcatSpreadable]?t[y.isConcatSpreadable]?b(n,t):n.push(t):s(t)?b(n,t):n.push(t):n.push(t)}),n},writable:!0,configurable:!0}),e(Object.prototype,"toString",{value:function(){return null==this?l.call(this):"string"==typeof this[y.toStringTag]?"[object "+this[y.toStringTag]+"]":l.call(this)},writable:!0,configurable:!0}),e(Array.prototype,y.iterator.toString(),{value:function(){if(null==this)throw new TypeError("Cannot convert undefined or null to object");var t=Object(this);return new p(t,2)},writable:!0,configurable:!0}),e(Array,"from",{value:function(t,e,n){var i,o,r,s=0;if(i=h(this)?this:Array,null==t)throw new TypeError("Cannot convert undefined or null to object");if(t=Object(t),void 0===e)e=d;else if(!h(e))throw new TypeError(e+" is not a function");if(void 0===t[y.iterator]){if(!("number"==typeof t.length&&t.length>=0))return(r=new i(0)).length=0,r;for(o=Math.floor(t.length),(r=new i(o)).length=o;s<o;++s)r[s]=e.call(n,t[s])}else(r=new i).length=0,a.forOf(t,function(t){r.length++,r[r.length-1]=e.call(n,t)});return r},writable:!0,configurable:!0}),e(Array.prototype,"entries",{value:function(){if(null==this)throw new TypeError("Cannot convert undefined or null to object");var t=Object(this);return new p(t,1)},writable:!0,configurable:!0}),e(Array.prototype,"keys",{value:function(){if(null==this)throw new TypeError("Cannot convert undefined or null to object");var t=Object(this);return new p(t,3)},writable:!0,configurable:!0}),e(String.prototype,y.iterator.toString(),{value:function(){if(null==this)throw new TypeError("String.prototype[Symbol.iterator] called on null or undefined");return new v(String(this),0)},writable:!0,configurable:!0}),a});var isset=function(t){return null!=t},EasingFunctions={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:(4-2*t)*t-1},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t}},getScript=function(t,e){var n=document.createElement("script");n.async=1;var i=document.getElementsByTagName("script"),o=i[i.length-1];n.onload=n.onreadystatechange=function(t,i){(i||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n=void 0,i||e&&e())},n.src=t,o.parentNode.insertBefore(n,o)},debounce=function(t,e,n){var i;return function(){var o=this,r=arguments,a=n&&!i;clearTimeout(i),i=setTimeout(function(){i=null,n||t.apply(o,r)},e),a&&t.apply(o,r)}},Cookie={set:function(t,e,n){var i,o,r,a,s;n?((r=new Date).setTime(r.getTime()+24*n*60*60*1e3),a="; expires="+r.toGMTString()):a="",1===(s=location.host).split(".").length?document.cookie=t+"="+e+a+"; path=/":((o=s.split(".")).shift(),i="."+o.join("."),document.cookie=t+"="+e+a+"; path=/; domain="+i,null!=Cookie.get(t)&&Cookie.get(t)==e||(i="."+s,document.cookie=t+"="+e+a+"; path=/; domain="+i))},get:function(t){for(var e=t+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var o=n[i];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(e))return o.substring(e.length,o.length)}return null},erase:function(t){Cookie.set(t,"",-1)}},number_format=function(t,e,n,i){t=(t+"").replace(/[^0-9+\-Ee.]/g,"");var o=isFinite(+t)?+t:0,r=isFinite(+e)?Math.abs(e):0,a=void 0===i?",":i,s=void 0===n?".":n,l="";return(l=(r?function(t,e){var n=Math.pow(10,e);return""+Math.round(t*n)/n}(o,r):""+Math.round(o)).split("."))[0].length>3&&(l[0]=l[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,a)),(l[1]||"").length<r&&(l[1]=l[1]||"",l[1]+=new Array(r-l[1].length+1).join("0")),l.join(s)};Element.prototype.closest||(Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest=function(t){var e=this;if(!document.documentElement.contains(this))return null;do{if(e.matches(t))return e;e=e.parentElement}while(null!==e);return null});var Ajax={get:function(t,e){var n=new XMLHttpRequest,i=document.querySelector('meta[name="csrf-token"]').content;n.open("get",t,!0),n.setRequestHeader("Content-Type","application/json"),n.setRequestHeader("X-CSRF-TOKEN",i),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.onreadystatechange=function(){4===n.readyState&&e(n)},n.send()},post:function(t,e,n){var i=new XMLHttpRequest,o=document.querySelector('meta[name="csrf-token"]').content;i.open("post",t,!0),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("X-CSRF-TOKEN",o),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.onreadystatechange=function(){4===i.readyState&&n(i)},i.send(JSON.stringify(e))}},capitalizeFirstLetter=function(t){return t.charAt(0).toUpperCase()+t.slice(1)};function snakeToCamel(t){return t.replace(/(\-\w)/g,function(t){return t[1].toUpperCase()})}function indexInParent(t){for(var e=t.parentNode.childNodes,n=0,i=0;i<e.length;i++){if(e[i]==t)return n;1==e[i].nodeType&&n++}return-1}function copyToClipboard(t){if(t="string"==typeof t?document.querySelector(t):t,navigator.userAgent.match(/ipad|ipod|iphone/i)){var e=t.contentEditable,n=t.readOnly;t.contentEditable=!0,t.readOnly=!0;var i=document.createRange();i.selectNodeContents(t);var o=window.getSelection();o.removeAllRanges(),o.addRange(i),t.setSelectionRange(0,999999),t.contentEditable=e,t.readOnly=n}else t.select();document.execCommand("copy")}document.addEventListener("DOMContentLoaded",function(){window.axios.defaults.headers.common={"X-Requested-With":"XMLHttpRequest","X-CSRF-TOKEN":document.querySelector('meta[name="csrf-token"]').getAttribute("content")},new TabsController("tab-content","entity-tabs","active",!0,'input[name="tabslug"]');var t=document.getElementById("save-button"),e=new styleClassController(t);if(t){var n=document.querySelector('input[value="submit-cloaked"]');t.addEventListener("click",function(t){t.preventDefault(),e.requestAddClass("disabled"),n.click()})}var i=document.querySelector("input.trash.js-confirm");i&&new ConfirmationController(i);var o=document.getElementById("entity-form"),r=o?o.dataset.globalTranslations:{},a=new Initializer("#entity-form"),s=new Initializer("#entities");if(o){var l=new ComponentAreaCopier;a.bindSelectorToCallback(".js-components-area",function(t,e){var n=new ComponentAreaManager(e,new ComponentManagerApiController);l.registerComponentAreaManager(n),n.on("componentAdded",function(t,e){e&&u&&u.refresh()})})}a.bindSelectorToCallback(".entity-attribute-documents",function(t,n){var i=o.dataset.uploadRoute,a=o.dataset.maxPostSize,s=o.dataset.maxUploadSize,l=new HTML5Uploader(i,a,s,r),c=new DocumentManager(n,l);new FileDragAndDropHandler(n.querySelector(".drag-and-drop-area")).hookTo(c),l.on("uploadStart",function(){e.requestAddClass("disabled")}),l.on("uploadComplete",function(){e.requestRemoveClass("disabled")}),l.on("uploadCanceled",function(){e.requestRemoveClass("disabled")}),l.on("uploadFailed",function(){e.requestRemoveClass("disabled")})}),a.bindSelectorToCallback(".entity-attribute-multiselect-combo-box",function(t,e){if("false"===e.dataset.readonly)new MultiSelect(e)}),a.bindSelectorToCallback(".entity-attribute-on-off",function(t,e){new OnOff(e)}),a.bindSelectorToCallback(".js-video",function(t,e){new Video(e)}),a.bindSelectorToCallback(".js-confirm",function(t,e){new ConfirmationController(e)}),a.bindSelectorToCallback(".entity-attribute-select",function(t,e){new Select(e)}),a.bindSelectorToCallback("[data-to-copy]",function(t,e){console.log("found copy text element"),new CopyText(e)}),s.bindSelectorToCallback(".js-sortable",function(t,e){new SortableController(e).load().then(function(t){u&&(console.log("Refreshing the prevent navigation controller since there may be more anchors."),u.refresh())}).catch(function(t){console.error(t)})}),a.bindSelectorToCallback("textarea.tiny-mce",function(t,e){e.id||(e.id=(new Date).getTime()+Math.random().toString(36).substring(7)),tinymce.remove("#"+e.id),tinymce.init({target:e,menubar:!1,statusbar:!1,plugins:"code paste link lists directionality",toolbar:"styleselect | bold italic strikethrough | numlist bullist | link unlink | outdent indent | code ",height:"200",paste_as_text:!0,style_formats:[{title:"Paragraaf",block:"p"},{title:"Titel",block:"h2"},{title:"Subtitel",block:"h3"}],convert_urls:!1,setup:function(t){t.on("change",function(n){!function(t,e){t.save();var n=createNewEvent("change");dispatchEventForElement(e,n)}(t,e)})}})},!1),a.startObserving(),s.startObserving();var c=document.querySelector(".entity-attributes"),u=null;c&&(u=new PreventNavigationController(c))}),function(t){t(".entities-list-item .dropdown-icon").click(function(e){e.preventDefault(),t(this).parent().parent().hasClass("open")?t(this).parent().parent().removeClass("open"):t(this).parent().parent().addClass("open")});var e=!0;t(window).load(function(){t("#entity-form .lock").hasClass("open")&&(e=!1,t("#entity-form").find("input, textarea").attr("disabled",e));var n=t("#entities .entities-list:visible"),i=t(".active",n).first();if(0!=i.length){var o=i.position().top;n.scrollTop(o),t(".site-brand-name input").attr("placeholder",t("#global_name").val())}}),t("#global_name").change(function(){t(".site-brand-name input").attr("placeholder",t(this).val())}),t(".error-accordion .collapsible-ul").hide(),t(".error-accordion h3").click(function(){t(this).parent().find(".collapsible-ul").toggle()}),t("#selectYearAndMonthForm select").change(function(){var e="/kms/orders/voltooid?month="+t("#selectYearAndMonthForm select#orderMonthSelector").val()+"&year="+t("#selectYearAndMonthForm select#orderYearSelector").val();window.location=e}),t("#productCategorySelector").change(function(){window.location="/kms/products?category="+encodeURIComponent(this.value)});var n=function(){t("#flash-message").fadeOut()};t("#flash-message").click(function(){n()}),setTimeout(function(){n()},5e3),t("#entity-form .lock").click(function(){t(this).toggleClass("open"),e=!e,t(this).parents("#entity-form").find("input, textarea").attr("disabled",e)});var i=jQuery("#sort_order"),o=(jQuery("#autoSubmit"),jQuery("#message-box"),jQuery(".fieldGroupItems"));o.children("li").each(function(){var t=jQuery(this);t.data("id",t.attr("title")).attr("title","")}),o.sortable({opacity:.7,update:function(){}}),jQuery("#dd-form").bind("submit",function(t){var e,n;t&&t.preventDefault(),e=!0,n=[],o.children("li").each(function(){n.push(jQuery(this).data("id"))}),i.val(n.join(",")),console.log(i.val()),e&&request()})}(jQuery),document.addEventListener("DOMContentLoaded",function(){var t=document.querySelector("#sidebar .navigation li.active");function e(t){var n=t.parentElement?t.parentElement:t.parentNode;n.classList.contains("has-sub-items")&&"LI"===n.tagName&&(n.classList.add("active"),e(n))}t&&e(t);for(var n=document.querySelectorAll("#sidebar .navigation .has-sub-items"),i=n.length,o=0;o<i;o++){n[o].addEventListener("click",function(t){this.classList.toggle("active"),e(this),t.stopImmediatePropagation()})}});var SearchController=function(){function t(e,n,i,o,r){_classCallCheck(this,t),this.apiUrl="",this.data="",this.dataToLoad="",this.editEntitiesUrl="",this.initialized=!1,this.sectionId=e,this.selector=n,this.mainUlId=o,this.resultCounterId=r,this.disabled=!0,this.inputSelector=i,this.listItemClass="entities-list-item",this.visibleClass="active",this.invisibleClass="hide",this.section=document.getElementById(this.sectionId);var a=document.querySelector(this.selector);this.siteSlug=a.dataset.siteSlug,this.slug=a.dataset.slug,this.activeId=a.dataset.activeId,axios.defaults.headers.common["X-Requested-With"]="XMLHttpRequest"}return _createClass(t,[{key:"init",value:function(t,e){"string"==typeof t?this.apiUrl=t:this.dataToLoad=t,this.editEntitiesUrl=e,this.initialized=!0}},{key:"load",value:function(){if(!1!==this.initialized){var t=this;return new Promise(function(e,n){if(!1===t.initialized&&n("Please initialize the controller with the init method first."),""!==t.apiUrl&&""===t.dataToLoad)axios.get(t.apiUrl).then(function(i){if(i.data&&0!=i.data.length){for(var o=i.data.children.length,r=0;r<o;r++)for(var a=t.createHtmlElement(i.data.children[r]),s=a.length,l=0;l<s;l++)document.querySelector(t.selector).appendChild(a[l]);t.initializeSearch(),e(document.querySelector(t.selector))}else n("The searchable did not get any data from the api")}).catch(function(t){n(t)});else if(""===t.apiUrl&&""!==t.dataToLoad){for(var i=t.dataToLoad.data.children.length,o=0;o<i;o++)for(var r=t.createHtmlElement(t.dataToLoad.data.children[o]),a=r.length,s=0;s<a;s++)document.querySelector(t.selector).appendChild(r[s]);t.initializeSearch(),e(document.querySelector(t.selector))}})}console.error("Please initialize the controller with the init method first.")}},{key:"initializeSearch",value:function(){var t=this,e=this.section,n=document.querySelector(this.inputSelector),i=document.querySelector(this.selector),o=document.getElementById(this.resultCounterId);n.addEventListener("keyup",function(r){for(var a=document.getElementById(t.mainUlId),s=0,l=n.value.toLowerCase(),c=""==l,u=i.querySelectorAll("li"),d=u.length,h=0;h<d;h++){var f=u[h].dataset.title.toLowerCase(),p=JSON.parse(u[h].dataset.model),v=f.indexOf(l)>-1&&!1===c,m=!1;if(!v&&l.length>=3)for(var b in p)if(p.hasOwnProperty(b)&&-1!==String(p[b]).toLowerCase().indexOf(l.toLowerCase())){m=!0;break}v||m?(s++,u[h].classList.add(t.visibleClass),u[h].setAttribute("dusk","found_search_item")):(u[h].classList.remove(t.visibleClass),u[h].removeAttribute("dusk"))}o.innerHTML=s+"",c?(e.classList.remove(t.visibleClass),a.classList.remove(t.invisibleClass)):(e.classList.add(t.visibleClass),a.classList.add(t.invisibleClass))}),i.classList.remove(this.visibleClass)}},{key:"createHtmlElement",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(!1!==this.initialized){var i=this.activeId,o=t.id,r=t.title,a=t.model,s=t.children,l=t.status,c=t.thumbnail,u=n,d=""!==n?n+" | "+r:r,h=[],f=!0,p=!1,v=void 0;try{for(var m,b=s[Symbol.iterator]();!(f=(m=b.next()).done);f=!0){var g=m.value;h.push(this.createHtmlElement(g,e,d))}}catch(t){p=!0,v=t}finally{try{f||null==b.return||b.return()}finally{if(p)throw v}}var y='\n <span class="color-status" data-status-type="'.concat(l,'">\n \n </span>\n '),_='\n <div class="icon" '.concat(c?"style=\"background-image: url('".concat(c,"');\""):""," >\n ").concat(c?"":"<span>".concat(r?r.substring(0,1):"","</span>"),"\n </div>\n "),w='\n <li data-title="'.concat(r,"\" data-model='").concat(JSON.stringify(a)||JSON.stringify({}),"' class=\"").concat(this.listItemClass," ").concat(o==i?"active":"",'"> \n <a href="').concat(this.editEntitiesUrl,"/").concat(o,'"> \n ').concat(y,"\n ").concat(_,'\n <p data-breadcrumb="').concat(u,'">').concat(r,"</p>\n </a>\n </li> \n "),C=(new DOMParser).parseFromString(w,"text/html");e.push(C.body.firstChild);var S=h.length;if(S>0)for(var k=0;k<S;k++){var E=h[k];e.push(E[0])}return e}console.error("Please initialize the controller with the init method first.")}}]),t}(),SortableController=function(){function t(e){_classCallCheck(this,t),e?(this._wrapper=e,this._list=this._wrapper.querySelector("ul"),this._list?"slug"in this._list.dataset?(this.slug=this._list.dataset.slug,this._apiUrl="/kms/api/"+this.slug,this._editEntitiesUrl="/kms/"+this.slug,this._disabled=!0,this._listItemClass="entities-list-item",this._enableSortButton=this._wrapper.querySelector(".entities-order .sortable-button.enable-sortable"),this._enableSortButton?(this._saveSortOrderButton=this._wrapper.querySelector(".entities-order .sortable-button.save-order"),this._saveSortOrderButton?(this._activeId=this._list.dataset.activeId,axios.defaults.headers.common["X-Requested-With"]="XMLHttpRequest",this._updateVisibility(this._list),this.enableSortable=this.enableSortable.bind(this),this.disableSortable=this.disableSortable.bind(this),this._setSortButtonsEnabled(!0)):console.error("SortableController: The sort button could not be found inside the wrapper.",this._wrapper,'Selector: ".entities-order .sortable-button .save-order". Sortable controller stopped working')):console.error("SortableController: The sort button could not be found inside the wrapper.",this._wrapper,'Selector: ".entities-order .sortable-button .enable-sortable". Sortable controller stopped working')):console.error("Make sure that the wrapper contains the data-slug attribute that contains the slug. Sortable controller stopped working."):console.error("SortableController: Expected the wrapper to have an ul. But did not have any. Sortable controller stopped working")):console.error("SortableController: Expected a wrapper but did not get any. Sortable controller stopped working")}return _createClass(t,[{key:"_setSortButtonsEnabled",value:function(t){this._enableSortButton.removeEventListener("click",this.enableSortable),this._saveSortOrderButton.removeEventListener("click",this.disableSortable),t&&(this._enableSortButton.addEventListener("click",this.enableSortable),this._saveSortOrderButton.addEventListener("click",this.disableSortable))}},{key:"_updateVisibility",value:function(t){"UL"!==t.tagName&&console.error("sortableController: Could not update the unordered list diplay style state since the list is no <ul> tag");for(var e=t.querySelectorAll("li ul"),n=e.length,i=0;i<n;i++){var o=e[i];o.style.display="none"!==o.style.display?"none":"";for(var r=o.children.length,a=0;a<r;a++){var s=o.children[a];"UL"===s.tagName&&this._updateVisibility(s)}}}},{key:"_updateSortableJavascript",value:function(){$(".sortable").sortable({connectWith:".sortable",placeholder:"sortable-placeholder",disabled:this._disabled})}},{key:"enableSortable",value:function(){this._enableSortButton.classList.remove("show"),this._saveSortOrderButton.classList.add("show"),this._disabled=!1,$(this._wrapper).sortable({disabled:this._disabled}).addClass("sorting"),this._updateSortableJavascript()}},{key:"disableSortable",value:function(){this._enableSortButton.classList.add("show"),this._saveSortOrderButton.classList.remove("show"),this._disabled=!0,$(this._wrapper).sortable({disabled:this._disabled}).removeClass("sorting"),this._save()}},{key:"_save",value:function(){var t=this._itemsToJson(this._list),e={id:1,routes:{},status:null,thumbnail:!1,title:null,children:t},n={tree:t=JSON.stringify(e)};axios.post(this._apiUrl,n).then(function(t){}).catch(function(t){console.error(t)})}},{key:"_itemsToJson",value:function(t){for(var e=[],n=!1,i=t.querySelectorAll("li."+this._listItemClass),o=i.length,r=0;r<o;r++){var a=i[r];if(a.parentElement===t){a.dataset.json||(console.error('One or more li HTMLElements with class "'+this._listItemClass+'" did not have data-json attribute set while it should.'),n=!0);var s=JSON.parse(a.dataset.json),l=a.querySelector("ul");l?(s.children=this._itemsToJson(l),s.children||(n=!0)):s.children=[],e.push(s)}}return n?null:e}},{key:"load",value:function(){return self=this,new Promise(function(t,e){axios.get(self._apiUrl).then(function(n){if(n.data&&0!=n.data.length){for(var i=n.data.children.length,o=0;o<i;o++){var r=n.data.children[o];self._list.appendChild(self._createHtmlElement(r))}self._updateSortableJavascript(),t(self._list)}else e("The sortable did not get any data from the api")}).catch(function(t){e(t)})})}},{key:"clearList",value:function(){for(;this._list.firstChild;)this._list.removeChild(this._list.firstChild)}},{key:"_createHtmlElement",value:function(t){self=this;var e=self._activeId,n=t.id,i=t.title||"-",o=t.thumbnail,r=t.children,a=t.status,s=t.routes,l={};for(var c in s)s.hasOwnProperty(c)&&(l[c]=s[c]);l=={}&&(l=[]);var u={id:t.id,title:t.title,thumbnail:t.thumbnail,routes:l,status:t.status};u=JSON.stringify(u);for(var d=[],h=r.length,f=0;f<h;f++){var p=r[f];d.push(this._createHtmlElement(p))}var v='\n <span class="color-status" data-status-type="'.concat(a,'">\n \n </span>\n '),m='\n <div class="icon">\n '.concat(o||"<span>".concat(i?i.substring(0,1):"","</span>"),"\n </div>\n "),b="\n <li data-json='".concat(u,"' class=\"").concat(this._listItemClass," ").concat(n==e?"active":"",'"> \n <a href="').concat(this._editEntitiesUrl,"/").concat(n,'">\n ').concat(v,"\n ").concat(m,"\n <p>").concat(i,"</p>\n </a>\n </li> \n "),g=(new DOMParser).parseFromString(b,"text/html"),y=g.body.firstChild,_=d.length;if(_>0){var w=g.createElement("ul");w.className="sortable";for(var C=0;C<_;C++){var S=d[C];w.appendChild(S)}y.appendChild(w)}return y}}]),t}(),ConfirmationController=function(){function t(e){_classCallCheck(this,t),!1!==this._validateElement(e)?(this._headerText=e.dataset.confirmHeader?e.dataset.confirmHeader:"",this._message=e.dataset.confirmMessage?e.dataset.confirmMessage:"",this._confirmText=e.dataset.confirmConfirmText?e.dataset.confirmConfirmText:"",this._cancelText=e.dataset.confirmCancelText?e.dataset.confirmCancelText:"",this._navigatableElement=e,this._onlyConfirmIfTrueCallback=null,this._confirmCallback=null,this._clickEventHandler=this._clickEventHandler.bind(this),this._confirmClicked=this._confirmClicked.bind(this),this._cancelClicked=this._cancelClicked.bind(this),this.enableListeners()):console.error("The navigatableElement isn't valid. Did not enable the confirmation functionality for that navigatableElement. You passed a \""+e.tagName+'"')}return _createClass(t,[{key:"enableListeners",value:function(){this.disableListeners(),this._navigatableElement.addEventListener("click",this._clickEventHandler)}},{key:"disableListeners",value:function(){this._navigatableElement.removeEventListener("click",this._clickEventHandler)}},{key:"_clickEventHandler",value:function(t){var e=!1;(this._onlyConfirmIfTrueCallback&&!0===this._onlyConfirmIfTrueCallback.call()||!this._onlyConfirmIfTrueCallback)&&(e=!0),e&&(t.preventDefault(),this._showConfirmationPrompt(!0,this._navigatableElement))}},{key:"setOnlyConfirmIfTrueCallback",value:function(t){this._onlyConfirmIfTrueCallback=t}},{key:"_addListenersToModalButtons",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];arguments.length>1&&arguments[1];this.promptElement||console.error("First create the modal with the createPrompt method");var e=this.promptElement.querySelector("button.confirm"),n=this.promptElement.querySelector("button.cancel"),i=this.promptElement.querySelector("div.shader");e.removeEventListener("click",this._confirmClicked),n.removeEventListener("click",this._cancelClicked),i.removeEventListener("click",this._cancelClicked),t&&(e.addEventListener("click",this._confirmClicked),n.addEventListener("click",this._cancelClicked),i.addEventListener("click",this._cancelClicked))}},{key:"setConfirmCallback",value:function(t){return this._confirmCallback=t,this}},{key:"_confirmClicked",value:function(t){t.preventDefault(),this._confirmCallback?this._confirmCallback.call():(this._addNavigatableElementValueToForm(),this._submitNearestForm(!1)),this._showConfirmationPrompt(!1)}},{key:"_addNavigatableElementValueToForm",value:function(){if(this._navigatableElement.hasAttribute("value")&&this._navigatableElement.hasAttribute("name")){var t=this._findForm(this._navigatableElement);if(!t)return;var e=document.createElement("INPUT");e.setAttribute("type","hidden"),e.setAttribute("name",this._navigatableElement.getAttribute("name")),e.setAttribute("value",this._navigatableElement.getAttribute("value")),t.appendChild(e)}}},{key:"_submitNearestForm",value:function(){var t=this._findForm(this._navigatableElement);return t?(t.submit(),!0):(console.error("Could not submit the nearest form this navigatableElement should be in, because it isn't in a form."),!1)}},{key:"_cancelClicked",value:function(t){t.preventDefault(),this._showConfirmationPrompt(!1)}},{key:"_findForm",value:function(t){return!!t.parentNode&&("FORM"===t.parentNode.tagName?t.parentNode:this._findForm(t.parentNode))}},{key:"_createPrompt",value:function(){var t='<div class="modal"><div class="header"><h4>'+this._headerText+'</h4></div><div class="body"><p class="message">'+this._message+'</p><div class="navigatableElements buttons"><button class="confirm" dusk="confirmation_confirm">'+this._confirmText+'</button><button class="cancel" dusk="confirmation_cancel">'+this._cancelText+'</button></div></div></div></div><div class="shader"></div>',e=document.createElement("div");return e.setAttribute("id","confirmBox"),e.setAttribute("dusk","confirmBox"),e.innerHTML=t,e}},{key:"_showConfirmationPrompt",value:function(t,e){console.log(t?"show confirmation prompt":"hide confirmation prompt"),this.promptElement||(this.promptElement=this._createPrompt(),this._addListenersToModalButtons(!0,e)),t?(this.promptElement.classList.add("show"),document.body.appendChild(this.promptElement)):(this.promptElement.classList.remove("show"),this.promptElement.parentElement&&this.promptElement.parentElement.removeChild(this.promptElement),this.promptElement=null)}},{key:"_validateElement",value:function(t){return!!t&&(("BUTTON"===t.tagName||"INPUT"===t.tagName||"A"===t.tagName)&&("INPUT"!==t.tagName||"navigatableElement"===t.getAttribute("type").toLowerCase()||"submit"===t.getAttribute("type").toLowerCase()))}},{key:"setHeaderText",value:function(t){return this._headerText=t,this}},{key:"setMessage",value:function(t){return this._message=t,this}},{key:"setConfirmText",value:function(t){return this._confirmText=t,this}},{key:"setCancelText",value:function(t){return this._cancelText=t,this}}]),t}(),Initializer=function(){function t(e){_classCallCheck(this,t),this._bindings={},this._onceBindings={},this._booted=!1,this._observer=null,this._isObserving=!1,this._showDebugInformation=!1,this._observerConfiguration={subtree:!0,childList:!0},this._wrapper=document.querySelector(e),this._wrapper?this._boot():console.info('The selector "'+e+'" does not match any element. Could not monitor html elements and initialize them when needed.')}return _createClass(t,[{key:"_boot",value:function(){this._booted||(this._booted=!0,this._observer=new MutationObserver(this._mutationsObserved.bind(this)))}},{key:"startObserving",value:function(){return this._booted?(this._showDebugInformation&&console.log("Starting to observe"),this._observer.takeRecords(),this._observer.observe(this._wrapper,this._observerConfiguration),this._isObserving=!0,this):this}},{key:"stopObserving",value:function(){return this._booted?(this._showDebugInformation&&console.log("Stopped to observe"),this._observer.disconnect(),this._isObserving=!1,this):this}},{key:"_mutationsObserved",value:function(t){if(!this._booted)return this;var e=t.length;this._showDebugInformation&&console.info("Detected "+e+" changes");for(var n=0;n<e;n++)for(var i=t[n].addedNodes,o=i.length,r=0;r<o;r++){var a=i[r];this._triggerBoundCallbacksIfElementMatchesSelector(a)}}},{key:"_triggerBoundCallbacksIfElementMatchesSelector",value:function(t){if(t&&t instanceof HTMLElement)for(var e in this._bindings){var n=t.matches(e),i=t.querySelectorAll(e),o=i.length;if((n||o>0)&&(n&&(t.hasAttribute("initialized")&&!1!==this._onceBindings[e]||(this._showDebugInformation&&console.log('Calling callback for selector "'+e+'". HTMLElement',t),this._bindings[e](this,t),t.setAttribute("initialized",""))),o>0))for(var r=0;r<o;r++){var a=i[r];a.hasAttribute("initialized")&&!1!==this._onceBindings[e]||(this._showDebugInformation&&console.log('Calling callback for selector "'+e+'". HTMLElement',a),this._bindings[e](this,a),a.setAttribute("initialized",""))}}}},{key:"bindSelectorToCallback",value:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this._booted)return this;if("string"!=typeof t)return console.error("Initializer:bind The selector must be a string"),this;if("function"!=typeof e)return console.error("Initializer:bind The callback must be a function"),this;if("boolean"!=typeof n)return console.error("Initializer:bind The once variable must be a boolean"),this;this._bindings[t]=e,this._onceBindings[t]=n,this._showDebugInformation&&console.log('bound selector "'+t+'" to a callback');var i=this._isObserving;this._isObserving&&this.stopObserving();var o=this._wrapper.querySelectorAll(t);if(!o)return this;for(var r=o.length,a=0;a<r;a++)e(this,o[a]);return i&&this.startObserving(),this}}]),t}(),PreventNavigationController=function(){function t(e){_classCallCheck(this,t),this._inputs=[],this._wrapperElement=null,this._translation={headerText:"",message:"",confirmText:"",cancelText:""},this._anchorsAndConfirmationControllers=[],this._changed=!1,e?e.dataset.translation?(this._wrapperElement=e,this._inputChanged=this._inputChanged.bind(this),this._loadTranslation(),this.refresh()):console.error("PreventNavigationController: No translation present. Not preventing navigation when not all changes have been saved."):console.error("PreventNavigationController: No wrapper element given. Not preventing navigation.")}return _createClass(t,[{key:"_isTrackableElement",value:function(t){return"INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName}},{key:"_setListenersOnInputs",value:function(t){for(var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=t.length,i=0;i<n;i++)e?t[i].addEventListener("change",this._inputChanged):t[i].removeEventListener("change",this._inputChanged)}},{key:"_inputChanged",value:function(t){this._changed=!0}},{key:"_loadTranslation",value:function(){this._translation=JSON.parse(this._wrapperElement.dataset.translation)}},{key:"refresh",value:function(){this._inputs=this._findAllInputsIn(this._wrapperElement),this._interceptClicksOnAnchors(),this._setListenersOnInputs(this._inputs)}},{key:"_interceptClicksOnAnchors",value:function(){var t=this;this._clearAnchorsAndControllers();for(var e=document.getElementsByTagName("A"),n=e.length,i=function(n){var i=e[n],o=i.getAttribute("href");if(o&&"#"!==o.substr(0,1)){var r=new ConfirmationController(i);r.setHeaderText(t._translation.headerText).setMessage(t._translation.message).setConfirmText(t._translation.confirmText).setCancelText(t._translation.cancelText).setConfirmCallback(function(){window.location=o}).setOnlyConfirmIfTrueCallback(function(t){return function(){return t._hasChanged()}}(t)),t._anchorsAndConfirmationControllers.push({anchor:i,controller:r})}},o=0;o<n;o++)i(o)}},{key:"_clearAnchorsAndControllers",value:function(){for(var t;t=this._anchorsAndConfirmationControllers.pop();){var e=t.controller;e.disableListeners(),e=null}}},{key:"_hasChanged",value:function(){return this._changed}},{key:"_findAllInputsIn",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=t.children.length;if(0===n)return e;for(var i=0;i<n;i++){var o=t.children[i];if(this._isTrackableElement(o)&&e.push(o),o.children.length>0){var r=this._findAllInputsIn(o,e);e.concat(r)}}return e}}]),t}(),TabsController=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"tab",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".tab-buttons",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"active",o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;_classCallCheck(this,t);document.querySelector(this.tabSlugInputId);this.tabButtonGroupSelector=n,this.tabContentDivsClassAndIdPrefix=e,this.tabSlugInputId=r,this.activeClass=i,this.reactToUrlHashChange=o,o&&this.addListenerForHashChange(o)}return _createClass(t,[{key:"openTab",value:function(t,e){(t=this.removeLeftHandSlashInSlug(t))&&(e&&sessionStorage.clear(),this.updateTabSlugInput(t),this.showTabContentForTabWithSlug(t),this.makeTabButtonActiveForSlug(t))}},{key:"removeLeftHandSlashInSlug",value:function(t){return t.replace(/^\/(.*)/,"$1")}},{key:"updateTabSlugInput",value:function(t){if(void 0!==this.tabSlugInputId){var e=document.querySelector(this.tabSlugInputId);e&&(e.value=t)}}},{key:"makeTabButtonActiveForSlug",value:function(t){for(var e=document.querySelectorAll(".entity-tabs > ul > li"),n=e.length,i=0;i<n;i++){e[i].classList.remove("active")}document.querySelector('.entity-tabs > ul > li a[href="#'+t+'"]').parentElement.classList.add("active")}},{key:"showTabContentForTabWithSlug",value:function(t){for(var e=document.querySelectorAll("."+this.tabContentDivsClassAndIdPrefix),n=e.length,i=0;i<n;i++){e[i].classList.remove(this.activeClass)}var o=document.querySelector("#"+this.tabContentDivsClassAndIdPrefix+"-"+t);o?(o.classList.add(this.activeClass),isset(sessionStorage.getItem("componentScrollPosition"))||(o.parentElement.scrollTop=0),o.parentElement.addEventListener("scroll",function(t){sessionStorage.componentScrollPosition=t.currentTarget.scrollTop})):console.error("TabsController: Could not make content tab active. It should have an ID with: #"+this.tabContentDivsClassAndIdPrefix+"-"+t)}},{key:"addListenerForHashChange",value:function(t){t?(window.addEventListener("hashchange",this.hashChanged.bind(this)),window.addEventListener("load",this.hashChanged.bind(this))):(window.removeEventListener("hashchange",this.hashChanged),window.removeEventListener("load",this.hashChanged))}},{key:"hashChanged",value:function(t){var e=window.location.hash.substring(1);if(e)this.openTab(e,!0);else{var n=document.querySelector(this.tabSlugInputId);n&&this.openTab(n.value,!1)}}}]),t}();