OwlCyberSecurity - MANAGER
Edit File: envira-permissions-min.js
(()=>{var r={669:e=>{"use strict";e.exports=jQuery}},o={};function f(e,t){var n,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),n=0,{s:t=function(){},n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}(function e(t){var n=o[t];if(void 0!==n)return n.exports;n=o[t]={exports:{}};return r[t](n,n.exports,e),n.exports})(669)(document).ready(function(l){for(var e=document.getElementById("envira-permissions-dialog-id"),u=null,u=new A11yDialog(e),t=document.getElementsByClassName("envira-permissions-select-field"),d=[],n=0;n<t.length;n++){var r,o=t[n];0<o.length&&(r=o.getAttribute("id")+"_select",d[r]=new Choices(o,{allowHTML:!0,searchChoices:!1,searchEnabled:!1,removeItemButton:!0,itemSelectText:"",addItemText:"",shouldSort:!1,shouldSortItems:!1,classNames:{containerInner:"choices__inner roles_inner",containerOuter:"choices roles_inner"}}),o.addEventListener("addItem",function(e){s(l(this).attr("id"),e.detail.value,e.detail.label,"add"),i()},!1),o.addEventListener("removeItem",function(e){s(l(this).attr("id"),e.detail.value,e.detail.label,"remove"),i()},!1))}function i(){l(".choices__item").each(function(){"administrator"===l(this).attr("data-value")&&(l(this).removeClass("choices__item--selectable"),l(this).removeAttr("data-deletable"),l(this).removeAttr("data-item"),l(this).addClass("demos"),l(this).off("click"))}),l(".choices__button").each(function(){"Remove item: 'administrator'"===l(this).attr("aria-label")&&l(this).hide()})}function s(e,t,n,r){var o,i,s,a,c;enviraPermissions&&enviraPermissions.hasOwnProperty(e)&&(o=enviraPermissionsLabels[e],i=enviraPermissions[e],s=e+"_select",e="",c=1<(a=(a=function(i,s,a){for(var c=[],l=0;l<i.length;l++)!function(){var e,t=i[l],n=[],r=f(document.querySelector("#"+t).selectedOptions);try{for(r.s();!(e=r.n()).done;){var o=e.value;n.push(o.value)}}catch(e){r.e(e)}finally{r.f()}"add"===s?-1===n.indexOf(a)&&(n.push(a),c.push(enviraPermissionsLabels[t])):-1!==n.indexOf(a)&&(n=n.filter(function(e){return e!==a}),c=c.filter(function(e){return e!==enviraPermissionsLabels[t]}))}();return c}(i,r,t)).filter(function(e){return e!==o})).length?"permissions":"permission","add"===r?(e="<p>In order to give <strong>".concat(o,"</strong> permission,\n\t\t\t\t<strong>").concat(a,"</strong> ").concat(c," ").concat(1<a.length?"are":"is"," also required.</p>"),e+="<p>Would you like to also grant <strong>".concat(a,"</strong> ").concat(c," to ").concat(n,"?</p>")):(e="<p>In order to remove <strong>".concat(o,"</strong> permission,\n\t\t\t\t<strong>").concat(a,"</strong> ").concat(c," will also be removed.</p>"),e+="<p>Would you like to also remove <strong>".concat(a,"</strong> ").concat(c," to <strong>").concat(n,"</strong>?</p>")),0<a.length?(l("#envira-permissions-alert").html(e),u.show(),l(".envira-permissions-yes").on("click",function(){m(i,t,r),u.hide()}),l(".envira-permissions-cancel").on("click",function(){"add"===r&&d[s].removeActiveItemsByValue(t),"remove"===r&&d[s].setChoiceByValue(t),u.hide()})):m(i,t,r),setTimeout(function(){return d[s].hideDropdown()},0))}function m(a,c,l){for(var u=0;u<a.length;u++)!function(){var e,t=a[u],n=document.querySelector("#"+t).selectedOptions,r=[],o=enviraPermissionsLabels[t],i=f(n);try{for(i.s();!(e=i.n()).done;){var s=e.value;r.push(s.value)}}catch(e){i.e(e)}finally{i.f()}t=Object.keys(enviraPermissionsLabels).find(function(e){return enviraPermissionsLabels[e]===o}),n=d[t+"_select"];"add"===l?-1===r.indexOf(c)&&(r.push(c),n.setChoiceByValue(c)):-1!==r.indexOf(c)&&(r=r.filter(function(e){return e!==c}),n.removeActiveItemsByValue(c))}()}i()})})();