summaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/js/workflowengine.js
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-09-14 00:08:53 +0200
committerJulius Härtl <jus@bitgrid.net>2019-09-15 20:35:35 +0200
commite383bf0470bc432f955c65a77ff0b866b2250e3a (patch)
treef3302396213a2eef55293bcd1daa14d2210efa5a /apps/workflowengine/js/workflowengine.js
parent69ed4bb939f7176d24c36fbd1b5dad3556862f62 (diff)
downloadnextcloud-server-e383bf0470bc432f955c65a77ff0b866b2250e3a.tar.gz
nextcloud-server-e383bf0470bc432f955c65a77ff0b866b2250e3a.zip
Bump bundles
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/workflowengine/js/workflowengine.js')
-rw-r--r--apps/workflowengine/js/workflowengine.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/workflowengine/js/workflowengine.js b/apps/workflowengine/js/workflowengine.js
index e7778b8a9d3..2143a2afe61 100644
--- a/apps/workflowengine/js/workflowengine.js
+++ b/apps/workflowengine/js/workflowengine.js
@@ -401,7 +401,7 @@ e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- */i.default.use(r.a);var h,m,_,b=new r.a.Store({state:{rules:[],scope:OCP.InitialState.loadState("workflowengine","scope"),operations:OCP.InitialState.loadState("workflowengine","operators"),plugins:i.default.observable({checks:{},operators:{}}),entities:OCP.InitialState.loadState("workflowengine","entities"),events:OCP.InitialState.loadState("workflowengine","entities").map((function(e){return e.events.map((function(t){return A({id:"".concat(e.id,"::").concat(t.eventName),entity:e},t)}))})).flat(),checks:OCP.InitialState.loadState("workflowengine","checks")},mutations:{addRule:function(e,t){e.rules.push(A({},t,{valid:!0}))},updateRule:function(e,t){var n=e.rules.findIndex((function(e){return t.id===e.id})),o=Object.assign({},t);i.default.set(e.rules,n,o)},removeRule:function(e,t){var n=e.rules.findIndex((function(e){return t.id===e.id}));e.rules.splice(n,1)},addPluginCheck:function(e,t){i.default.set(e.plugins.checks,t.class,t)},addPluginOperator:function(e,t){t=Object.assign({color:"var(--color-primary-element)"},t,e.operations[t.id]||{}),i.default.set(e.operations,t.id,t)}},actions:{fetchRules:(_=p(regeneratorRuntime.mark((function e(t){var n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.a.get(c(""));case 2:n=e.sent,o=n.data,Object.values(o.ocs.data).flat().forEach((function(e){t.commit("addRule",e)}));case 5:case"end":return e.stop()}}),e)}))),function(e){return _.apply(this,arguments)}),createNewRule:function(e,t){var n=null,o=[];!1===t.isComplex&&""===t.fixedEntity&&(o=[(n=(n=e.state.entities.find((function(e){return t.entities&&t.entities[0]===e.id})))||Object.values(e.state.entities)[0]).events[0].eventName]),e.commit("addRule",{id:-(new Date).getTime(),class:t.id,entity:n?n.id:t.fixedEntity,events:o,name:"",checks:[],operation:t.operation||""})},updateRule:function(e,t){e.commit("updateRule",A({},t,{events:"string"==typeof t.events?JSON.parse(t.events):t.events}))},removeRule:function(e,t){e.commit("removeRule",t)},pushUpdateRule:(m=p(regeneratorRuntime.mark((function e(t,n){var o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d()();case 2:if(!(n.id<0)){e.next=8;break}return e.next=5,s.a.post(c(""),n);case 5:o=e.sent,e.next=11;break;case 8:return e.next=10,s.a.put(c("/".concat(n.id)),n);case 10:o=e.sent;case 11:i.default.set(n,"id",o.data.ocs.data.id),t.commit("updateRule",n);case 13:case"end":return e.stop()}}),e)}))),function(e,t){return m.apply(this,arguments)}),deleteRule:(h=p(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d()();case 2:return e.next=4,s.a.delete(c("/".concat(n.id)));case 4:t.commit("removeRule",n);case 5:case"end":return e.stop()}}),e)}))),function(e,t){return h.apply(this,arguments)}),setValid:function(e,t){var n=t.rule,o=t.valid;n.valid=o,e.commit("updateRule",n)}},getters:{getRules:function(e){return e.rules.sort((function(e,t){return e.id-t.id||t.class-e.class}))},getOperationForRule:function(e){return function(t){return e.operations[t.class]}},getEntityForOperation:function(e){return function(t){return e.entities.find((function(e){return t.fixedEntity===e.id}))}},getEventsForOperation:function(e){return function(t){return e.events}},getChecksForEntity:function(e){return function(t){return e.checks.filter((function(e){return e.supportedEntities.indexOf(t)>-1||0===e.supportedEntities.length})).map((function(t){return e.plugins.checks[t.id]})).reduce((function(e,t){return e[t.class]=t,e}),{})}}}}),v=o(193),g=o(30),y=o(31),L=o(1),w={name:"Event",components:{Multiselect:L.Multiselect},props:{rule:{type:Object,required:!0}},computed:{entity:function(){return this.$store.getters.getEntityForOperation(this.operation)},operation:function(){return this.$store.getters.getOperationForRule(this.rule)},allEvents:function(){return this.$store.getters.getEventsForOperation(this.operation)},currentEvent:function(){var e=this;return this.rule.events?this.allEvents.find((function(t){return t.entity.id===e.rule.entity&&-1!==e.rule.events.indexOf(t.eventName)})):this.allEvents.length>0?this.allEvents[0]:null}},methods:{updateEvent:function(e){this.$set(this.rule,"entity",e.entity.id),this.$set(this.rule,"events",[e.eventName]),this.$store.dispatch("updateRule",this.rule)}}};o(215);function z(e,t,n,o,i,r,a,s){var c,u="function"==typeof e?e.options:e;if(t&&(u.render=t,u.staticRenderFns=n,u._compiled=!0),o&&(u.functional=!0),r&&(u._scopeId="data-v-"+r),a?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},u._ssrRegister=c):i&&(c=s?function(){i.call(this,this.$root.$options.shadowRoot)}:i),c)if(u.functional){u._injectStyles=c;var d=u.render;u.render=function(e,t){return c.call(t),d(e,t)}}else{var l=u.beforeCreate;u.beforeCreate=l?[].concat(l,c):[c]}return{exports:e,options:u}}var T=z(w,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[e.operation.isComplex&&""!==e.operation.fixedEntity?n("div",{staticClass:"isComplex"},[n("img",{staticClass:"option__icon",attrs:{src:e.entity.icon}}),e._v(" "),n("span",{staticClass:"option__title option__title_single"},[e._v(e._s(e.operation.triggerHint))])]):n("Multiselect",{attrs:{value:e.currentEvent,options:e.allEvents,label:"eventName","track-by":"id","allow-empty":!1,disabled:e.allEvents.length<=1},on:{input:e.updateEvent},scopedSlots:e._u([{key:"singleLabel",fn:function(t){return[n("img",{staticClass:"option__icon",attrs:{src:t.option.entity.icon}}),e._v(" "),n("span",{staticClass:"option__title option__title_single"},[e._v(e._s(t.option.displayName))])]}},{key:"option",fn:function(t){return[n("img",{staticClass:"option__icon",attrs:{src:t.option.entity.icon}}),e._v(" "),n("span",{staticClass:"option__title"},[e._v(e._s(t.option.displayName))])]}}])})],1)}),[],!1,null,"1e3e715c",null).exports,O=o(194),k=o.n(O),D={name:"Check",components:{ActionButton:y.ActionButton,Actions:g.Actions,Multiselect:L.Multiselect},directives:{ClickOutside:k.a},props:{check:{type:Object,required:!0},rule:{type:Object,required:!0}},data:function(){return{deleteVisible:!1,currentOption:null,currentOperator:null,options:[],valid:!0}},computed:{Checks:function(){return this.$store.getters.getChecksForEntity(this.rule.entity)},operators:function(){return this.currentOption?this.Checks[this.currentOption.class].operators:[]},currentComponent:function(){if(!this.currentOption)return[];var e=this.Checks[this.currentOption.class].component;return e},valuePlaceholder:function(){return this.currentOption&&this.currentOption.placeholder?this.currentOption.placeholder(this.check):""}},watch:{"check.operator":function(){this.validate()}},mounted:function(){var e=this;this.options=Object.values(this.Checks),this.currentOption=this.Checks[this.check.class],this.currentOperator=this.operators.find((function(t){return t.operator===e.check.operator}))},methods:{showDelete:function(){this.deleteVisible=!0},hideDelete:function(){this.deleteVisible=!1},validate:function(){return this.currentOption&&this.currentOption.validate&&(this.currentOption.validate(this.check)?this.valid=!0:this.valid=!1),this.$store.dispatch("setValid",{rule:this.rule,valid:this.rule.valid&&this.valid}),this.valid},updateCheck:function(){this.check.class!==this.currentOption.class&&(this.currentOperator=this.operators[0]),this.check.class=this.currentOption.class,this.check.operator=this.currentOperator.operator,this.validate()&&this.$emit("update",this.check)}}},N=(o(217),z(D,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:e.hideDelete,expression:"hideDelete"}],staticClass:"check",on:{click:e.showDelete}},[n("Multiselect",{ref:"checkSelector",attrs:{options:e.options,label:"name","track-by":"class","allow-empty":!1,placeholder:e.t("workflowengine","Select a filter")},on:{input:e.updateCheck},model:{value:e.currentOption,callback:function(t){e.currentOption=t},expression:"currentOption"}}),e._v(" "),n("Multiselect",{attrs:{disabled:!e.currentOption,options:e.operators,label:"name","track-by":"operator","allow-empty":!1,placeholder:e.t("workflowengine","Select a comparator")},on:{input:e.updateCheck},model:{value:e.currentOperator,callback:function(t){e.currentOperator=t},expression:"currentOperator"}}),e._v(" "),e.currentOperator&&e.currentComponent?n(e.currentOption.component,{tag:"component",attrs:{disabled:!e.currentOption,check:e.check},on:{input:e.updateCheck,valid:function(t){(e.valid=!0)&&e.validate()},invalid:function(t){(e.valid=!1)&&e.validate()}},model:{value:e.check.value,callback:function(t){e.$set(e.check,"value",t)},expression:"check.value"}}):n("input",{directives:[{name:"model",rawName:"v-model",value:e.check.value,expression:"check.value"}],class:{invalid:!e.valid},attrs:{type:"text",disabled:!e.currentOption,placeholder:e.valuePlaceholder},domProps:{value:e.check.value},on:{input:[function(t){t.target.composing||e.$set(e.check,"value",t.target.value)},e.updateCheck]}}),e._v(" "),e.deleteVisible||!e.currentOption?n("Actions",[n("ActionButton",{attrs:{icon:"icon-delete"},on:{click:function(t){return e.$emit("remove")}}})],1):e._e()],1)}),[],!1,null,"767eba54",null).exports),Y={name:"Operation",props:{operation:{type:Object,required:!0},colored:{type:Boolean,default:!0}}},x=(o(219),z(Y,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"actions__item",class:{colored:e.colored},style:{backgroundColor:e.colored?e.operation.color:"transparent"}},[n("div",{staticClass:"icon",class:e.operation.iconClass,style:{backgroundImage:e.operation.iconClass?"":"url("+e.operation.icon+")"}}),e._v(" "),n("div",{staticClass:"actions__item__description"},[n("h3",[e._v(e._s(e.operation.name))]),e._v(" "),n("small",[e._v(e._s(e.operation.description))])]),e._v(" "),n("div",{staticClass:"actions__item_options"},[e._t("default")],2)])}),[],!1,null,"3fff5a4e",null).exports);function S(e,t,n,o,i,r,a){try{var s=e[r](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(o,i)}function E(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var r=e.apply(t,n);function a(e){S(r,o,i,a,s,"next",e)}function s(e){S(r,o,i,a,s,"throw",e)}a(void 0)}))}}var B,C,W,q,j={name:"Rule",components:{Operation:x,Check:N,Event:T,Actions:g.Actions,ActionButton:y.ActionButton},directives:{Tooltip:v.Tooltip},props:{rule:{type:Object,required:!0}},data:function(){return{editing:!1,checks:[],error:null,dirty:this.rule.id<0,checking:!1}},computed:{operation:function(){return this.$store.getters.getOperationForRule(this.rule)},ruleStatus:function(){return this.error||!this.rule.valid?{title:t("workflowengine","The configuration is invalid"),class:"icon-close-white invalid",tooltip:{placement:"bottom",show:!0,content:this.error}}:!this.dirty||this.checking?{title:"Active",class:"icon icon-checkmark"}:{title:"Save",class:"icon-confirm-white primary"}},lastCheckComplete:function(){var e=this.rule.checks[this.rule.checks.length-1];return void 0===e||null!==e.class}},methods:{updateOperation:(q=E(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.$set(this.rule,"operation",t),e.next=3,this.updateRule();case 3:case"end":return e.stop()}}),e,this)}))),function(e){return q.apply(this,arguments)}),updateRule:(W=E(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.checking=!0,this.dirty||(this.dirty=!0);try{this.error=null,this.checking=!1,this.$store.dispatch("updateRule",this.rule)}catch(e){console.error("Failed to update operation",e),this.error=e.response.ocs.meta.message,this.checking=!1}case 3:case"end":return e.stop()}}),e,this)}))),function(){return W.apply(this,arguments)}),saveRule:(C=E(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$store.dispatch("pushUpdateRule",this.rule);case 3:this.dirty=!1,this.error=null,e.next=11;break;case 7:e.prev=7,e.t0=e.catch(0),console.error("Failed to save operation"),this.error=e.t0.response.data.ocs.meta.message;case 11:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return C.apply(this,arguments)}),deleteRule:function(){var e=E(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$store.dispatch("deleteRule",this.rule);case 3:e.next=9;break;case 5:e.prev=5,e.t0=e.catch(0),console.error("Failed to delete operation"),this.error=e.t0.response.data.ocs.meta.message;case 9:case"end":return e.stop()}}),e,this,[[0,5]])})));return function(){return e.apply(this,arguments)}}(),cancelRule:function(){this.$store.dispatch("removeRule",this.rule)},removeCheck:(B=E(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(n=this.rule.checks.findIndex((function(e){return e===t})))>-1&&this.$delete(this.rule.checks,n),this.$store.dispatch("updateRule",this.rule);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})}},H=(o(221),z(j,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"section rule",style:{borderLeftColor:e.operation.color||""}},[n("div",{staticClass:"trigger"},[n("p",[n("span",[e._v(e._s(e.t("workflowengine","When")))]),e._v(" "),n("Event",{attrs:{rule:e.rule},on:{update:e.updateRule}})],1),e._v(" "),e._l(e.rule.checks,(function(t,o){return n("p",{key:o},[n("span",[e._v(e._s(e.t("workflowengine","and")))]),e._v(" "),n("Check",{attrs:{check:t,rule:e.rule},on:{update:e.updateRule,remove:function(n){return e.removeCheck(t)}}})],1)})),e._v(" "),n("p",[n("span"),e._v(" "),e.lastCheckComplete?n("input",{staticClass:"check--add",attrs:{type:"button",value:"Add a new filter"},on:{click:function(t){return e.rule.checks.push({class:null,operator:null,value:null})}}}):e._e()])],2),e._v(" "),n("div",{staticClass:"flow-icon icon-confirm"}),e._v(" "),n("div",{staticClass:"action"},[n("div",{staticClass:"buttons"},[n("Actions",[e.rule.id<-1?n("ActionButton",{attrs:{icon:"icon-close"},on:{click:e.cancelRule}},[e._v("\n\t\t\t\t\t"+e._s(e.t("workflowengine","Cancel rule creation"))+"\n\t\t\t\t")]):n("ActionButton",{attrs:{icon:"icon-close"},on:{click:e.deleteRule}},[e._v("\n\t\t\t\t\t"+e._s(e.t("workflowengine","Remove rule"))+"\n\t\t\t\t")])],1)],1),e._v(" "),n("Operation",{attrs:{operation:e.operation,colored:!1}},[e.operation.options?n(e.operation.options,{tag:"component",on:{input:e.updateOperation},model:{value:e.rule.operation,callback:function(t){e.$set(e.rule,"operation",t)},expression:"rule.operation"}}):e._e()],1),e._v(" "),n("button",{directives:[{name:"tooltip",rawName:"v-tooltip",value:e.ruleStatus.tooltip,expression:"ruleStatus.tooltip"}],staticClass:"status-button icon",class:e.ruleStatus.class,on:{click:e.saveRule}},[e._v("\n\t\t\t"+e._s(e.ruleStatus.title)+"\n\t\t")])],1)])}),[],!1,null,"4d7f90fa",null).exports);function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function I(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var P={name:"Workflow",components:{Operation:x,Rule:H},data:function(){return{showMoreOperations:!1}},computed:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?X(n,!0).forEach((function(t){I(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},Object(r.b)({rules:"getRules"}),{},Object(r.c)({operations:"operations"}),{hasMoreOperations:function(){return Object.keys(this.operations).length>3},getMainOperations:function(){return this.showMoreOperations?Object.values(this.operations):Object.values(this.operations).slice(0,3)}}),mounted:function(){this.$store.dispatch("fetchRules")},methods:{createNewRule:function(e){this.$store.dispatch("createNewRule",e)}}},R=(o(223),z(P,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{attrs:{id:"workflowengine"}},[n("div",{staticClass:"section"},[n("h2",[e._v(e._s(e.t("workflowengine","Workflows")))]),e._v(" "),n("transition-group",{staticClass:"actions",attrs:{name:"slide",tag:"div"}},e._l(e.getMainOperations,(function(t){return n("Operation",{key:t.id,attrs:{operation:t},nativeOn:{click:function(n){return e.createNewRule(t)}}})})),1),e._v(" "),e.hasMoreOperations?n("div",{staticClass:"actions__more"},[n("button",{staticClass:"icon",class:e.showMoreOperations?"icon-triangle-n":"icon-triangle-s",on:{click:function(t){e.showMoreOperations=!e.showMoreOperations}}},[e._v("\n\t\t\t\t"+e._s(e.showMoreOperations?e.t("workflowengine","Show less"):e.t("workflowengine","Show more"))+"\n\t\t\t")])]):e._e()],1),e._v(" "),e.rules.length>0?n("transition-group",{attrs:{name:"slide"}},e._l(e.rules,(function(e){return n("Rule",{key:e.id,attrs:{rule:e}})})),1):e._e()],1)}),[],!1,null,"2b250bf6",null).exports),F={props:{value:{type:String,default:""},check:{type:Object,default:function(){return{}}}},data:function(){return{newValue:""}},watch:{value:{immediate:!0,handler:function(e){this.updateInternalValue(e)}}},methods:{updateInternalValue:function(e){this.newValue=e}}};function U(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var $={name:"FileMimeType",components:{Multiselect:L.Multiselect},mixins:[F],data:function(){return{predefinedTypes:[{icon:"icon-picture",label:t("workflowengine","Images"),pattern:"/image\\/.*/"},{icon:"icon-category-office",label:t("workflowengine","Office documents"),pattern:"/(vnd\\.(ms-|openxmlformats-).*))$/"},{icon:"icon-filetype-file",label:t("workflowengine","PDF documents"),pattern:"application/pdf"}]}},computed:{options:function(){return[].concat(U(this.predefinedTypes),[this.customValue])},isPredefined:function(){var e=this;return!!this.predefinedTypes.find((function(t){return e.newValue===t.pattern}))},customValue:function(){return{icon:"icon-settings-dark",label:t("workflowengine","Custom mimetype"),pattern:""}},currentValue:function(){var e=this,n=this.predefinedTypes.find((function(t){return e.newValue===t.pattern}));return n||{icon:"icon-settings-dark",label:t("workflowengine","Custom mimetype"),pattern:this.newValue}}},methods:{validateRegex:function(e){return null!==/^\/(.*)\/([gui]{0,3})$/.exec(e)},setValue:function(e){null!==e&&(this.newValue=e.pattern,this.$emit("input",this.newValue))},updateCustom:function(e){this.newValue=e.target.value,this.$emit("input",this.newValue)}}},G=(o(225),z($,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("Multiselect",{attrs:{value:e.currentValue,placeholder:e.t("workflowengine","Select a file type"),label:"label","track-by":"pattern",options:e.options,multiple:!1,tagging:!1},on:{input:e.setValue},scopedSlots:e._u([{key:"singleLabel",fn:function(t){return[n("span",{staticClass:"option__icon",class:t.option.icon}),e._v(" "),n("span",{staticClass:"option__title option__title_single"},[e._v(e._s(t.option.label))])]}},{key:"option",fn:function(t){return[n("span",{staticClass:"option__icon",class:t.option.icon}),e._v(" "),n("span",{staticClass:"option__title"},[e._v(e._s(t.option.label))])]}}])}),e._v(" "),e.isPredefined?e._e():n("input",{attrs:{type:"text"},domProps:{value:e.currentValue.pattern},on:{input:e.updateCustom}})],1)}),[],!1,null,"4ab9ec71",null).exports),Q=o(195),V=function(e){var t=function e(t){var n={};if(1===t.nodeType){if(t.attributes.length>0){n["@attributes"]={};for(var o=0;o<t.attributes.length;o++){var i=t.attributes.item(o);n["@attributes"][i.nodeName]=i.nodeValue}}}else 3===t.nodeType&&(n=t.nodeValue);if(t.hasChildNodes())for(var r=0;r<t.childNodes.length;r++){var a=t.childNodes.item(r),s=a.nodeName;if(void 0===n[s])n[s]=e(a);else{if(void 0===n[s].push){var c=n[s];n[s]=[],n[s].push(c)}n[s].push(e(a))}}return n}(function(e){var t=null;try{t=(new DOMParser).parseFromString(e,"text/xml")}catch(e){console.error("Failed to parse xml document",e)}return t}(e))["d:multistatus"]["d:response"],n=[];for(var o in t){var i=t[o]["d:propstat"];"HTTP/1.1 200 OK"===i["d:status"]["#text"]&&n.push({id:i["d:prop"]["oc:id"]["#text"],displayName:i["d:prop"]["oc:display-name"]["#text"],canAssign:"true"===i["d:prop"]["oc:can-assign"]["#text"],userAssignable:"true"===i["d:prop"]["oc:user-assignable"]["#text"],userVisible:"true"===i["d:prop"]["oc:user-visible"]["#text"]})}return n},J=0,Z=z({name:"MultiselectTag",components:{Multiselect:L.Multiselect},props:{label:{type:String,required:!0},value:{default:function(){return[]}},disabled:{type:Boolean,default:!1},multiple:{type:Boolean,default:!0}},data:function(){return{inputValObjects:[],tags:[]}},computed:{id:function(){return"settings-input-text-"+this.uuid}},watch:{value:function(e){this.inputValObjects=this.getValueObject()}},beforeCreate:function(){var e=this;this.uuid=J.toString(),J+=1,s()({method:"PROPFIND",url:Object(Q.generateRemoteUrl)("dav")+"/systemtags/",data:'<?xml version="1.0"?>\n\t\t\t\t\t<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">\n\t\t\t\t\t <d:prop>\n\t\t\t\t\t\t<oc:id />\n\t\t\t\t\t\t<oc:display-name />\n\t\t\t\t\t\t<oc:user-visible />\n\t\t\t\t\t\t<oc:user-assignable />\n\t\t\t\t\t\t<oc:can-assign />\n\t\t\t\t\t </d:prop>\n\t\t\t\t\t</d:propfind>'}).then((function(e){return V(e.data)})).then((function(t){e.tags=t,e.inputValObjects=e.getValueObject()})).catch(console.error.bind(this))},methods:{getValueObject:function(){var e=this;return 0===this.tags.length?[]:this.multiple?this.value.filter((function(e){return""!==e})).map((function(t){return e.tags.find((function(e){return e.id===t}))})):this.tags.find((function(t){return t.id===e.value}))},update:function(){this.multiple?this.$emit("input",this.inputValObjects.map((function(e){return e.id}))):null===this.inputValObjects?this.$emit("input",""):this.$emit("input",this.inputValObjects.id)},tagLabel:function(e){var n=e.displayName,o=e.userVisible,i=e.userAssignable;return!1===o?t("systemtags","%s (invisible)").replace("%s",n):!1===i?t("systemtags","%s (restricted)").replace("%s",n):n}}},(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("Multiselect",{staticClass:"multiselect-vue",attrs:{options:e.tags,"options-limit":5,placeholder:e.label,"track-by":"id","custom-label":e.tagLabel,multiple:e.multiple,"close-on-select":!1,"tag-width":60,disabled:e.disabled},on:{input:e.update},scopedSlots:e._u([{key:"option",fn:function(t){return[e._v("\n\t\t"+e._s(e.tagLabel(t.option))+"\n\t")]}}]),model:{value:e.inputValObjects,callback:function(t){e.inputValObjects=t},expression:"inputValObjects"}},[n("span",{attrs:{slot:"noResult"},slot:"noResult"},[e._v(e._s(e.t("core","No results")))])])}),[],!1,null,null,null).exports,K=z({name:"FileSystemTag",components:{MultiselectTag:Z},props:{value:{type:String,default:""}},data:function(){return{newValue:[]}},watch:{value:function(){this.updateValue()}},beforeMount:function(){this.updateValue()},methods:{updateValue:function(){""!==this.value?this.newValue=this.value:this.newValue=null},update:function(){this.$emit("input",this.newValue||"")}}},(function(){var e=this,t=e.$createElement;return(e._self._c||t)("MultiselectTag",{attrs:{multiple:!1,label:"Select a tag"},on:{input:e.update},model:{value:e.newValue,callback:function(t){e.newValue=t},expression:"newValue"}})}),[],!1,null,"0c858a95",null).exports,ee=[{class:"OCA\\WorkflowEngine\\Check\\FileName",name:t("workflowengine","File name"),operators:[{operator:"is",name:t("workflowengine","is")},{operator:"!is",name:t("workflowengine","is not")},{operator:"matches",name:t("workflowengine","matches")},{operator:"!matches",name:t("workflowengine","does not match")}],placeholder:function(e){return"matches"===e.operator||"!matches"===e.operator?"/^dummy-.+$/i":"filename.txt"},validate:function(e){return"matches"!==e.operator&&"!matches"!==e.operator||(t=e.value,null!==/^\/(.*)\/([gui]{0,3})$/.exec(t));var t}},{class:"OCA\\WorkflowEngine\\Check\\FileMimeType",name:t("workflowengine","File MIME type"),operators:[{operator:"is",name:t("workflowengine","is")},{operator:"!is",name:t("workflowengine","is not")},{operator:"matches",name:t("workflowengine","matches")},{operator:"!matches",name:t("workflowengine","does not match")}],component:G},{class:"OCA\\WorkflowEngine\\Check\\FileSize",name:t("workflowengine","File size (upload)"),operators:[{operator:"less",name:t("workflowengine","less")},{operator:"!greater",name:t("workflowengine","less or equals")},{operator:"!less",name:t("workflowengine","greater or equals")},{operator:"greater",name:t("workflowengine","greater")}],placeholder:function(e){return"5 MB"},validate:function(e){return null!==e.value.match(/^[0-9]+[ ]?[kmgt]?b$/i)}},{class:"OCA\\WorkflowEngine\\Check\\RequestRemoteAddress",name:t("workflowengine","Request remote address"),operators:[{operator:"matchesIPv4",name:t("workflowengine","matches IPv4")},{operator:"!matchesIPv4",name:t("workflowengine","does not match IPv4")},{operator:"matchesIPv6",name:t("workflowengine","matches IPv6")},{operator:"!matchesIPv6",name:t("workflowengine","does not match IPv6")}],placeholder:function(e){return"matchesIPv6"===e.operator||"!matchesIPv6"===e.operator?"::1/128":"127.0.0.1/32"},validate:function(e){return"matchesIPv6"===e.operator||"!matchesIPv6"===e.operator?(t=e.value,null!==/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(1([01][0-9]|2[0-8])|[1-9][0-9]|[0-9])$/.exec(t)):function(e){return null!==/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/(3[0-2]|[1-2][0-9]|[1-9])$/.exec(e)}(e.value);var t}},{class:"OCA\\WorkflowEngine\\Check\\FileSystemTags",name:t("workflowengine","File system tag"),operators:[{operator:"is",name:t("workflowengine","is tagged with")},{operator:"!is",name:t("workflowengine","is not tagged with")}],component:K}];function te(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var ne={name:"RequestUserAgent",components:{Multiselect:L.Multiselect},mixins:[F],data:function(){return{newValue:"",predefinedTypes:[{label:t("workflowengine","Sync clients"),children:[{pattern:"android",label:t("workflowengine","Android client"),icon:"icon-phone"},{pattern:"ios",label:t("workflowengine","iOS client"),icon:"icon-phone"},{pattern:"desktop",label:t("workflowengine","Desktop client"),icon:"icon-desktop"},{pattern:"mail",label:t("workflowengine","Thunderbird & Outlook addons"),icon:"icon-mail"}]}]}},computed:{options:function(){return[].concat(te(this.predefinedTypes),[this.customValue])},matchingPredefined:function(){var e=this;return this.predefinedTypes.map((function(e){return e.children})).flat().find((function(t){return e.newValue===t.pattern}))},isPredefined:function(){return!!this.matchingPredefined},customValue:function(){return{label:t("workflowengine","Others"),children:[{icon:"icon-settings-dark",label:t("workflowengine","Custom user agent"),pattern:""}]}},currentValue:function(){return this.matchingPredefined?this.matchingPredefined:{icon:"icon-settings-dark",label:t("workflowengine","Custom user agent"),pattern:this.newValue}}},methods:{validateRegex:function(e){return null!==/^\/(.*)\/([gui]{0,3})$/.exec(e)},setValue:function(e){null!==e&&(this.newValue=e.pattern,this.$emit("input",this.newValue))},updateCustom:function(e){this.newValue=e.target.value,this.$emit("input",this.newValue)}}},oe=(o(256),z(ne,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("Multiselect",{attrs:{value:e.currentValue,placeholder:e.t("workflowengine","Select a user agent"),label:"label","track-by":"pattern","group-values":"children","group-label":"label",options:e.options,multiple:!1,tagging:!1},on:{input:e.setValue},scopedSlots:e._u([{key:"singleLabel",fn:function(t){return[n("span",{staticClass:"option__icon",class:t.option.icon}),e._v(" "),n("span",{staticClass:"option__title option__title_single"},[e._v(e._s(t.option.label))])]}},{key:"option",fn:function(t){return[n("span",{staticClass:"option__icon",class:t.option.icon}),e._v(" "),n("span",{staticClass:"option__title"},[e._v(e._s(t.option.label)+" "+e._s(t.option.$groupLabel))])]}}])}),e._v(" "),e.isPredefined?e._e():n("input",{attrs:{type:"text"},domProps:{value:e.currentValue.pattern},on:{input:e.updateCustom}})],1)}),[],!1,null,"379c8fb5",null).exports),ie=o(32),re=o.n(ie),ae=re.a.tz.names(),se={name:"RequestTime",components:{Multiselect:L.Multiselect},mixins:[F],props:{value:{type:String,default:"1 MB"}},data:function(){return{timezones:ae,valid:!1,newValue:{startTime:null,endTime:null,timezone:re.a.tz.guess()}}},methods:{updateInternalValue:function(e){var t=JSON.parse(e),n=t[0].split(" ",2)[0],o=t[1].split(" ",2)[0],i=t[0].split(" ",2)[1];this.newValue={startTime:n,endTime:o,timezone:i}},validate:function(){return this.newValue.startTime&&null!==this.newValue.startTime.match(/^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$/i)&&this.newValue.endTime&&null!==this.newValue.endTime.match(/^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$/i)&&null!==re.a.tz.zone(this.newValue.timezone)},update:function(){if(this.validate()){var e='["'.concat(this.newValue.startTime," ").concat(this.newValue.timezone,'","').concat(this.newValue.endTime," ").concat(this.newValue.timezone,'"]');this.$emit("input",e),this.valid=!0}else this.valid=!1}}},ce=(o(262),z(se,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"timeslot"},[n("Multiselect",{attrs:{options:e.timezones},on:{input:e.update},model:{value:e.newValue.timezone,callback:function(t){e.$set(e.newValue,"timezone",t)},expression:"newValue.timezone"}}),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.newValue.startTime,expression:"newValue.startTime"}],staticClass:"timeslot--start",attrs:{type:"text",placeholder:"08:00"},domProps:{value:e.newValue.startTime},on:{input:[function(t){t.target.composing||e.$set(e.newValue,"startTime",t.target.value)},e.update]}}),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.newValue.endTime,expression:"newValue.endTime"}],attrs:{type:"text",placeholder:"18:00"},domProps:{value:e.newValue.endTime},on:{input:[function(t){t.target.composing||e.$set(e.newValue,"endTime",t.target.value)},e.update]}})],1)}),[],!1,null,"615d3f80",null).exports);function ue(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var de={name:"RequestURL",components:{Multiselect:L.Multiselect},mixins:[F],data:function(){return{newValue:"",predefinedTypes:[{label:t("workflowengine","Predefined URLs"),children:[{pattern:"webdav",label:t("workflowengine","Files WebDAV")}]}]}},computed:{options:function(){return[].concat(ue(this.predefinedTypes),[this.customValue])},placeholder:function(){return"matches"===this.check.operator||"!matches"===this.check.operator?"/^https\\:\\/\\/localhost\\/index\\.php$/i":"https://localhost/index.php"},matchingPredefined:function(){var e=this;return this.predefinedTypes.map((function(e){return e.children})).flat().find((function(t){return e.newValue===t.pattern}))},isPredefined:function(){return!!this.matchingPredefined},customValue:function(){return{label:t("workflowengine","Others"),children:[{icon:"icon-settings-dark",label:t("workflowengine","Custom URL"),pattern:""}]}},currentValue:function(){return this.matchingPredefined?this.matchingPredefined:{icon:"icon-settings-dark",label:t("workflowengine","Custom URL"),pattern:this.newValue}}},methods:{validateRegex:function(e){return null!==/^\/(.*)\/([gui]{0,3})$/.exec(e)},setValue:function(e){null!==e&&(this.newValue=e.pattern,this.$emit("input",this.newValue))},updateCustom:function(e){this.newValue=e.target.value,this.$emit("input",this.newValue)}}},le=(o(264),z(de,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("Multiselect",{attrs:{value:e.currentValue,placeholder:e.t("workflowengine","Select a request URL"),label:"label","track-by":"pattern","group-values":"children","group-label":"label",options:e.options,multiple:!1,tagging:!1},on:{input:e.setValue},scopedSlots:e._u([{key:"singleLabel",fn:function(t){return[n("span",{staticClass:"option__icon",class:t.option.icon}),e._v(" "),n("span",{staticClass:"option__title option__title_single"},[e._v(e._s(t.option.label))])]}},{key:"option",fn:function(t){return[n("span",{staticClass:"option__icon",class:t.option.icon}),e._v(" "),n("span",{staticClass:"option__title"},[e._v(e._s(t.option.label)+" "+e._s(t.option.$groupLabel))])]}}])}),e._v(" "),e.isPredefined?e._e():n("input",{attrs:{type:"text",placeholder:e.placeholder},domProps:{value:e.currentValue.pattern},on:{input:e.updateCustom}})],1)}),[],!1,null,"683f5ff4",null).exports),pe={name:"RequestUserGroup",components:{Multiselect:L.Multiselect},mixins:[F],data:function(){return{groups:[]}},beforeMount:function(){var e=this;s.a.get(OC.linkToOCS("cloud",2)+"groups").then((function(t){e.groups=t.data.ocs.data.groups.reduce((function(e,t){return e.push({id:t,displayname:t}),e}),[]),e.updateInternalValue(e.value)}),(function(e){console.error("Error while loading group list",e.response)}))},methods:{updateInternalValue:function(){var e=this;this.newValue=this.groups.find((function(t){return t.id===e.value}))||null},setValue:function(e){null!==e&&this.$emit("input",this.newValue.id)}}},fe=(o(266),z(pe,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("Multiselect",{class:{"icon-loading-small":0===e.groups.length},attrs:{options:e.groups,multiple:!1,label:"displayname","track-by":"id"},on:{input:e.setValue},model:{value:e.newValue,callback:function(t){e.newValue=t},expression:"newValue"}})],1)}),[],!1,null,"606ed772",null).exports),Ae=[{class:"OCA\\WorkflowEngine\\Check\\RequestURL",name:t("workflowengine","Request URL"),operators:[{operator:"is",name:t("workflowengine","is")},{operator:"!is",name:t("workflowengine","is not")},{operator:"matches",name:t("workflowengine","matches")},{operator:"!matches",name:t("workflowengine","does not match")}],component:le},{class:"OCA\\WorkflowEngine\\Check\\RequestTime",name:t("workflowengine","Request time"),operators:[{operator:"in",name:t("workflowengine","between")},{operator:"!in",name:t("workflowengine","not between")}],component:ce},{class:"OCA\\WorkflowEngine\\Check\\RequestUserAgent",name:t("workflowengine","Request user agent"),operators:[{operator:"is",name:t("workflowengine","is")},{operator:"!is",name:t("workflowengine","is not")},{operator:"matches",name:t("workflowengine","matches")},{operator:"!matches",name:t("workflowengine","does not match")}],component:oe},{class:"OCA\\WorkflowEngine\\Check\\UserGroupMembership",name:t("workflowengine","User group membership"),operators:[{operator:"is",name:t("workflowengine","is member of")},{operator:"!is",name:t("workflowengine","is not member of")}],component:fe}];function Me(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}
+ */i.default.use(r.a);var h,m,_,b=new r.a.Store({state:{rules:[],scope:OCP.InitialState.loadState("workflowengine","scope"),operations:OCP.InitialState.loadState("workflowengine","operators"),plugins:i.default.observable({checks:{},operators:{}}),entities:OCP.InitialState.loadState("workflowengine","entities"),events:OCP.InitialState.loadState("workflowengine","entities").map((function(e){return e.events.map((function(t){return A({id:"".concat(e.id,"::").concat(t.eventName),entity:e},t)}))})).flat(),checks:OCP.InitialState.loadState("workflowengine","checks")},mutations:{addRule:function(e,t){e.rules.push(A({},t,{valid:!0}))},updateRule:function(e,t){var n=e.rules.findIndex((function(e){return t.id===e.id})),o=Object.assign({},t);i.default.set(e.rules,n,o)},removeRule:function(e,t){var n=e.rules.findIndex((function(e){return t.id===e.id}));e.rules.splice(n,1)},addPluginCheck:function(e,t){i.default.set(e.plugins.checks,t.class,t)},addPluginOperator:function(e,t){t=Object.assign({color:"var(--color-primary-element)"},t,e.operations[t.id]||{}),i.default.set(e.operations,t.id,t)}},actions:{fetchRules:(_=p(regeneratorRuntime.mark((function e(t){var n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.a.get(c(""));case 2:n=e.sent,o=n.data,Object.values(o.ocs.data).flat().forEach((function(e){t.commit("addRule",e)}));case 5:case"end":return e.stop()}}),e)}))),function(e){return _.apply(this,arguments)}),createNewRule:function(e,t){var n=null,o=[];!1===t.isComplex&&""===t.fixedEntity&&(o=[(n=(n=e.state.entities.find((function(e){return t.entities&&t.entities[0]===e.id})))||Object.values(e.state.entities)[0]).events[0].eventName]),e.commit("addRule",{id:-(new Date).getTime(),class:t.id,entity:n?n.id:t.fixedEntity,events:o,name:"",checks:[],operation:t.operation||""})},updateRule:function(e,t){e.commit("updateRule",A({},t,{events:"string"==typeof t.events?JSON.parse(t.events):t.events}))},removeRule:function(e,t){e.commit("removeRule",t)},pushUpdateRule:(m=p(regeneratorRuntime.mark((function e(t,n){var o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d()();case 2:if(!(n.id<0)){e.next=8;break}return e.next=5,s.a.post(c(""),n);case 5:o=e.sent,e.next=11;break;case 8:return e.next=10,s.a.put(c("/".concat(n.id)),n);case 10:o=e.sent;case 11:i.default.set(n,"id",o.data.ocs.data.id),t.commit("updateRule",n);case 13:case"end":return e.stop()}}),e)}))),function(e,t){return m.apply(this,arguments)}),deleteRule:(h=p(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d()();case 2:return e.next=4,s.a.delete(c("/".concat(n.id)));case 4:t.commit("removeRule",n);case 5:case"end":return e.stop()}}),e)}))),function(e,t){return h.apply(this,arguments)}),setValid:function(e,t){var n=t.rule,o=t.valid;n.valid=o,e.commit("updateRule",n)}},getters:{getRules:function(e){return e.rules.sort((function(e,t){return e.id-t.id||t.class-e.class}))},getOperationForRule:function(e){return function(t){return e.operations[t.class]}},getEntityForOperation:function(e){return function(t){return e.entities.find((function(e){return t.fixedEntity===e.id}))}},getEventsForOperation:function(e){return function(t){return e.events}},getChecksForEntity:function(e){return function(t){return Object.values(e.checks).filter((function(e){return e.supportedEntities.indexOf(t)>-1||0===e.supportedEntities.length})).map((function(t){return e.plugins.checks[t.id]})).reduce((function(e,t){return e[t.class]=t,e}),{})}}}}),v=o(193),g=o(30),y=o(31),L=o(1),w={name:"Event",components:{Multiselect:L.Multiselect},props:{rule:{type:Object,required:!0}},computed:{entity:function(){return this.$store.getters.getEntityForOperation(this.operation)},operation:function(){return this.$store.getters.getOperationForRule(this.rule)},allEvents:function(){return this.$store.getters.getEventsForOperation(this.operation)},currentEvent:function(){var e=this;return this.rule.events?this.allEvents.find((function(t){return t.entity.id===e.rule.entity&&-1!==e.rule.events.indexOf(t.eventName)})):this.allEvents.length>0?this.allEvents[0]:null}},methods:{updateEvent:function(e){this.$set(this.rule,"entity",e.entity.id),this.$set(this.rule,"events",[e.eventName]),this.$store.dispatch("updateRule",this.rule)}}};o(215);function z(e,t,n,o,i,r,a,s){var c,u="function"==typeof e?e.options:e;if(t&&(u.render=t,u.staticRenderFns=n,u._compiled=!0),o&&(u.functional=!0),r&&(u._scopeId="data-v-"+r),a?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},u._ssrRegister=c):i&&(c=s?function(){i.call(this,this.$root.$options.shadowRoot)}:i),c)if(u.functional){u._injectStyles=c;var d=u.render;u.render=function(e,t){return c.call(t),d(e,t)}}else{var l=u.beforeCreate;u.beforeCreate=l?[].concat(l,c):[c]}return{exports:e,options:u}}var T=z(w,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[e.operation.isComplex&&""!==e.operation.fixedEntity?n("div",{staticClass:"isComplex"},[n("img",{staticClass:"option__icon",attrs:{src:e.entity.icon}}),e._v(" "),n("span",{staticClass:"option__title option__title_single"},[e._v(e._s(e.operation.triggerHint))])]):n("Multiselect",{attrs:{value:e.currentEvent,options:e.allEvents,label:"eventName","track-by":"id","allow-empty":!1,disabled:e.allEvents.length<=1},on:{input:e.updateEvent},scopedSlots:e._u([{key:"singleLabel",fn:function(t){return[n("img",{staticClass:"option__icon",attrs:{src:t.option.entity.icon}}),e._v(" "),n("span",{staticClass:"option__title option__title_single"},[e._v(e._s(t.option.displayName))])]}},{key:"option",fn:function(t){return[n("img",{staticClass:"option__icon",attrs:{src:t.option.entity.icon}}),e._v(" "),n("span",{staticClass:"option__title"},[e._v(e._s(t.option.displayName))])]}}])})],1)}),[],!1,null,"1e3e715c",null).exports,O=o(194),k=o.n(O),D={name:"Check",components:{ActionButton:y.ActionButton,Actions:g.Actions,Multiselect:L.Multiselect},directives:{ClickOutside:k.a},props:{check:{type:Object,required:!0},rule:{type:Object,required:!0}},data:function(){return{deleteVisible:!1,currentOption:null,currentOperator:null,options:[],valid:!0}},computed:{Checks:function(){return this.$store.getters.getChecksForEntity(this.rule.entity)},operators:function(){return this.currentOption?this.Checks[this.currentOption.class].operators:[]},currentComponent:function(){if(!this.currentOption)return[];var e=this.Checks[this.currentOption.class].component;return e},valuePlaceholder:function(){return this.currentOption&&this.currentOption.placeholder?this.currentOption.placeholder(this.check):""}},watch:{"check.operator":function(){this.validate()}},mounted:function(){var e=this;this.options=Object.values(this.Checks),this.currentOption=this.Checks[this.check.class],this.currentOperator=this.operators.find((function(t){return t.operator===e.check.operator}))},methods:{showDelete:function(){this.deleteVisible=!0},hideDelete:function(){this.deleteVisible=!1},validate:function(){return this.currentOption&&this.currentOption.validate&&(this.currentOption.validate(this.check)?this.valid=!0:this.valid=!1),this.$store.dispatch("setValid",{rule:this.rule,valid:this.rule.valid&&this.valid}),this.valid},updateCheck:function(){this.check.class!==this.currentOption.class&&(this.currentOperator=this.operators[0]),this.check.class=this.currentOption.class,this.check.operator=this.currentOperator.operator,this.validate()&&this.$emit("update",this.check)}}},N=(o(217),z(D,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:e.hideDelete,expression:"hideDelete"}],staticClass:"check",on:{click:e.showDelete}},[n("Multiselect",{ref:"checkSelector",attrs:{options:e.options,label:"name","track-by":"class","allow-empty":!1,placeholder:e.t("workflowengine","Select a filter")},on:{input:e.updateCheck},model:{value:e.currentOption,callback:function(t){e.currentOption=t},expression:"currentOption"}}),e._v(" "),n("Multiselect",{attrs:{disabled:!e.currentOption,options:e.operators,label:"name","track-by":"operator","allow-empty":!1,placeholder:e.t("workflowengine","Select a comparator")},on:{input:e.updateCheck},model:{value:e.currentOperator,callback:function(t){e.currentOperator=t},expression:"currentOperator"}}),e._v(" "),e.currentOperator&&e.currentComponent?n(e.currentOption.component,{tag:"component",attrs:{disabled:!e.currentOption,check:e.check},on:{input:e.updateCheck,valid:function(t){(e.valid=!0)&&e.validate()},invalid:function(t){(e.valid=!1)&&e.validate()}},model:{value:e.check.value,callback:function(t){e.$set(e.check,"value",t)},expression:"check.value"}}):n("input",{directives:[{name:"model",rawName:"v-model",value:e.check.value,expression:"check.value"}],class:{invalid:!e.valid},attrs:{type:"text",disabled:!e.currentOption,placeholder:e.valuePlaceholder},domProps:{value:e.check.value},on:{input:[function(t){t.target.composing||e.$set(e.check,"value",t.target.value)},e.updateCheck]}}),e._v(" "),e.deleteVisible||!e.currentOption?n("Actions",[n("ActionButton",{attrs:{icon:"icon-delete"},on:{click:function(t){return e.$emit("remove")}}})],1):e._e()],1)}),[],!1,null,"767eba54",null).exports),Y={name:"Operation",props:{operation:{type:Object,required:!0},colored:{type:Boolean,default:!0}}},x=(o(219),z(Y,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"actions__item",class:{colored:e.colored},style:{backgroundColor:e.colored?e.operation.color:"transparent"}},[n("div",{staticClass:"icon",class:e.operation.iconClass,style:{backgroundImage:e.operation.iconClass?"":"url("+e.operation.icon+")"}}),e._v(" "),n("div",{staticClass:"actions__item__description"},[n("h3",[e._v(e._s(e.operation.name))]),e._v(" "),n("small",[e._v(e._s(e.operation.description))])]),e._v(" "),n("div",{staticClass:"actions__item_options"},[e._t("default")],2)])}),[],!1,null,"3fff5a4e",null).exports);function S(e,t,n,o,i,r,a){try{var s=e[r](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(o,i)}function E(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var r=e.apply(t,n);function a(e){S(r,o,i,a,s,"next",e)}function s(e){S(r,o,i,a,s,"throw",e)}a(void 0)}))}}var B,C,W,q,j={name:"Rule",components:{Operation:x,Check:N,Event:T,Actions:g.Actions,ActionButton:y.ActionButton},directives:{Tooltip:v.Tooltip},props:{rule:{type:Object,required:!0}},data:function(){return{editing:!1,checks:[],error:null,dirty:this.rule.id<0,checking:!1}},computed:{operation:function(){return this.$store.getters.getOperationForRule(this.rule)},ruleStatus:function(){return this.error||!this.rule.valid?{title:t("workflowengine","The configuration is invalid"),class:"icon-close-white invalid",tooltip:{placement:"bottom",show:!0,content:this.error}}:!this.dirty||this.checking?{title:"Active",class:"icon icon-checkmark"}:{title:"Save",class:"icon-confirm-white primary"}},lastCheckComplete:function(){var e=this.rule.checks[this.rule.checks.length-1];return void 0===e||null!==e.class}},methods:{updateOperation:(q=E(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.$set(this.rule,"operation",t),e.next=3,this.updateRule();case 3:case"end":return e.stop()}}),e,this)}))),function(e){return q.apply(this,arguments)}),updateRule:(W=E(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.checking=!0,this.dirty||(this.dirty=!0);try{this.error=null,this.checking=!1,this.$store.dispatch("updateRule",this.rule)}catch(e){console.error("Failed to update operation",e),this.error=e.response.ocs.meta.message,this.checking=!1}case 3:case"end":return e.stop()}}),e,this)}))),function(){return W.apply(this,arguments)}),saveRule:(C=E(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$store.dispatch("pushUpdateRule",this.rule);case 3:this.dirty=!1,this.error=null,e.next=11;break;case 7:e.prev=7,e.t0=e.catch(0),console.error("Failed to save operation"),this.error=e.t0.response.data.ocs.meta.message;case 11:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return C.apply(this,arguments)}),deleteRule:function(){var e=E(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$store.dispatch("deleteRule",this.rule);case 3:e.next=9;break;case 5:e.prev=5,e.t0=e.catch(0),console.error("Failed to delete operation"),this.error=e.t0.response.data.ocs.meta.message;case 9:case"end":return e.stop()}}),e,this,[[0,5]])})));return function(){return e.apply(this,arguments)}}(),cancelRule:function(){this.$store.dispatch("removeRule",this.rule)},removeCheck:(B=E(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(n=this.rule.checks.findIndex((function(e){return e===t})))>-1&&this.$delete(this.rule.checks,n),this.$store.dispatch("updateRule",this.rule);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})}},H=(o(221),z(j,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"section rule",style:{borderLeftColor:e.operation.color||""}},[n("div",{staticClass:"trigger"},[n("p",[n("span",[e._v(e._s(e.t("workflowengine","When")))]),e._v(" "),n("Event",{attrs:{rule:e.rule},on:{update:e.updateRule}})],1),e._v(" "),e._l(e.rule.checks,(function(t,o){return n("p",{key:o},[n("span",[e._v(e._s(e.t("workflowengine","and")))]),e._v(" "),n("Check",{attrs:{check:t,rule:e.rule},on:{update:e.updateRule,remove:function(n){return e.removeCheck(t)}}})],1)})),e._v(" "),n("p",[n("span"),e._v(" "),e.lastCheckComplete?n("input",{staticClass:"check--add",attrs:{type:"button",value:"Add a new filter"},on:{click:function(t){return e.rule.checks.push({class:null,operator:null,value:null})}}}):e._e()])],2),e._v(" "),n("div",{staticClass:"flow-icon icon-confirm"}),e._v(" "),n("div",{staticClass:"action"},[n("div",{staticClass:"buttons"},[n("Actions",[e.rule.id<-1?n("ActionButton",{attrs:{icon:"icon-close"},on:{click:e.cancelRule}},[e._v("\n\t\t\t\t\t"+e._s(e.t("workflowengine","Cancel rule creation"))+"\n\t\t\t\t")]):n("ActionButton",{attrs:{icon:"icon-close"},on:{click:e.deleteRule}},[e._v("\n\t\t\t\t\t"+e._s(e.t("workflowengine","Remove rule"))+"\n\t\t\t\t")])],1)],1),e._v(" "),n("Operation",{attrs:{operation:e.operation,colored:!1}},[e.operation.options?n(e.operation.options,{tag:"component",on:{input:e.updateOperation},model:{value:e.rule.operation,callback:function(t){e.$set(e.rule,"operation",t)},expression:"rule.operation"}}):e._e()],1),e._v(" "),n("button",{directives:[{name:"tooltip",rawName:"v-tooltip",value:e.ruleStatus.tooltip,expression:"ruleStatus.tooltip"}],staticClass:"status-button icon",class:e.ruleStatus.class,on:{click:e.saveRule}},[e._v("\n\t\t\t"+e._s(e.ruleStatus.title)+"\n\t\t")])],1)])}),[],!1,null,"4d7f90fa",null).exports);function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function I(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var P={name:"Workflow",components:{Operation:x,Rule:H},data:function(){return{showMoreOperations:!1}},computed:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?X(n,!0).forEach((function(t){I(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},Object(r.b)({rules:"getRules"}),{},Object(r.c)({operations:"operations"}),{hasMoreOperations:function(){return Object.keys(this.operations).length>3},getMainOperations:function(){return this.showMoreOperations?Object.values(this.operations):Object.values(this.operations).slice(0,3)}}),mounted:function(){this.$store.dispatch("fetchRules")},methods:{createNewRule:function(e){this.$store.dispatch("createNewRule",e)}}},R=(o(223),z(P,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{attrs:{id:"workflowengine"}},[n("div",{staticClass:"section"},[n("h2",[e._v(e._s(e.t("workflowengine","Workflows")))]),e._v(" "),n("transition-group",{staticClass:"actions",attrs:{name:"slide",tag:"div"}},e._l(e.getMainOperations,(function(t){return n("Operation",{key:t.id,attrs:{operation:t},nativeOn:{click:function(n){return e.createNewRule(t)}}})})),1),e._v(" "),e.hasMoreOperations?n("div",{staticClass:"actions__more"},[n("button",{staticClass:"icon",class:e.showMoreOperations?"icon-triangle-n":"icon-triangle-s",on:{click:function(t){e.showMoreOperations=!e.showMoreOperations}}},[e._v("\n\t\t\t\t"+e._s(e.showMoreOperations?e.t("workflowengine","Show less"):e.t("workflowengine","Show more"))+"\n\t\t\t")])]):e._e()],1),e._v(" "),e.rules.length>0?n("transition-group",{attrs:{name:"slide"}},e._l(e.rules,(function(e){return n("Rule",{key:e.id,attrs:{rule:e}})})),1):e._e()],1)}),[],!1,null,"2b250bf6",null).exports),F={props:{value:{type:String,default:""},check:{type:Object,default:function(){return{}}}},data:function(){return{newValue:""}},watch:{value:{immediate:!0,handler:function(e){this.updateInternalValue(e)}}},methods:{updateInternalValue:function(e){this.newValue=e}}};function U(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var $={name:"FileMimeType",components:{Multiselect:L.Multiselect},mixins:[F],data:function(){return{predefinedTypes:[{icon:"icon-picture",label:t("workflowengine","Images"),pattern:"/image\\/.*/"},{icon:"icon-category-office",label:t("workflowengine","Office documents"),pattern:"/(vnd\\.(ms-|openxmlformats-).*))$/"},{icon:"icon-filetype-file",label:t("workflowengine","PDF documents"),pattern:"application/pdf"}]}},computed:{options:function(){return[].concat(U(this.predefinedTypes),[this.customValue])},isPredefined:function(){var e=this;return!!this.predefinedTypes.find((function(t){return e.newValue===t.pattern}))},customValue:function(){return{icon:"icon-settings-dark",label:t("workflowengine","Custom mimetype"),pattern:""}},currentValue:function(){var e=this,n=this.predefinedTypes.find((function(t){return e.newValue===t.pattern}));return n||{icon:"icon-settings-dark",label:t("workflowengine","Custom mimetype"),pattern:this.newValue}}},methods:{validateRegex:function(e){return null!==/^\/(.*)\/([gui]{0,3})$/.exec(e)},setValue:function(e){null!==e&&(this.newValue=e.pattern,this.$emit("input",this.newValue))},updateCustom:function(e){this.newValue=e.target.value,this.$emit("input",this.newValue)}}},G=(o(225),z($,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("Multiselect",{attrs:{value:e.currentValue,placeholder:e.t("workflowengine","Select a file type"),label:"label","track-by":"pattern",options:e.options,multiple:!1,tagging:!1},on:{input:e.setValue},scopedSlots:e._u([{key:"singleLabel",fn:function(t){return[n("span",{staticClass:"option__icon",class:t.option.icon}),e._v(" "),n("span",{staticClass:"option__title option__title_single"},[e._v(e._s(t.option.label))])]}},{key:"option",fn:function(t){return[n("span",{staticClass:"option__icon",class:t.option.icon}),e._v(" "),n("span",{staticClass:"option__title"},[e._v(e._s(t.option.label))])]}}])}),e._v(" "),e.isPredefined?e._e():n("input",{attrs:{type:"text"},domProps:{value:e.currentValue.pattern},on:{input:e.updateCustom}})],1)}),[],!1,null,"4ab9ec71",null).exports),Q=o(195),V=function(e){var t=function e(t){var n={};if(1===t.nodeType){if(t.attributes.length>0){n["@attributes"]={};for(var o=0;o<t.attributes.length;o++){var i=t.attributes.item(o);n["@attributes"][i.nodeName]=i.nodeValue}}}else 3===t.nodeType&&(n=t.nodeValue);if(t.hasChildNodes())for(var r=0;r<t.childNodes.length;r++){var a=t.childNodes.item(r),s=a.nodeName;if(void 0===n[s])n[s]=e(a);else{if(void 0===n[s].push){var c=n[s];n[s]=[],n[s].push(c)}n[s].push(e(a))}}return n}(function(e){var t=null;try{t=(new DOMParser).parseFromString(e,"text/xml")}catch(e){console.error("Failed to parse xml document",e)}return t}(e))["d:multistatus"]["d:response"],n=[];for(var o in t){var i=t[o]["d:propstat"];"HTTP/1.1 200 OK"===i["d:status"]["#text"]&&n.push({id:i["d:prop"]["oc:id"]["#text"],displayName:i["d:prop"]["oc:display-name"]["#text"],canAssign:"true"===i["d:prop"]["oc:can-assign"]["#text"],userAssignable:"true"===i["d:prop"]["oc:user-assignable"]["#text"],userVisible:"true"===i["d:prop"]["oc:user-visible"]["#text"]})}return n},J=0,Z=z({name:"MultiselectTag",components:{Multiselect:L.Multiselect},props:{label:{type:String,required:!0},value:{default:function(){return[]}},disabled:{type:Boolean,default:!1},multiple:{type:Boolean,default:!0}},data:function(){return{inputValObjects:[],tags:[]}},computed:{id:function(){return"settings-input-text-"+this.uuid}},watch:{value:function(e){this.inputValObjects=this.getValueObject()}},beforeCreate:function(){var e=this;this.uuid=J.toString(),J+=1,s()({method:"PROPFIND",url:Object(Q.generateRemoteUrl)("dav")+"/systemtags/",data:'<?xml version="1.0"?>\n\t\t\t\t\t<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">\n\t\t\t\t\t <d:prop>\n\t\t\t\t\t\t<oc:id />\n\t\t\t\t\t\t<oc:display-name />\n\t\t\t\t\t\t<oc:user-visible />\n\t\t\t\t\t\t<oc:user-assignable />\n\t\t\t\t\t\t<oc:can-assign />\n\t\t\t\t\t </d:prop>\n\t\t\t\t\t</d:propfind>'}).then((function(e){return V(e.data)})).then((function(t){e.tags=t,e.inputValObjects=e.getValueObject()})).catch(console.error.bind(this))},methods:{getValueObject:function(){var e=this;return 0===this.tags.length?[]:this.multiple?this.value.filter((function(e){return""!==e})).map((function(t){return e.tags.find((function(e){return e.id===t}))})):this.tags.find((function(t){return t.id===e.value}))},update:function(){this.multiple?this.$emit("input",this.inputValObjects.map((function(e){return e.id}))):null===this.inputValObjects?this.$emit("input",""):this.$emit("input",this.inputValObjects.id)},tagLabel:function(e){var n=e.displayName,o=e.userVisible,i=e.userAssignable;return!1===o?t("systemtags","%s (invisible)").replace("%s",n):!1===i?t("systemtags","%s (restricted)").replace("%s",n):n}}},(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("Multiselect",{staticClass:"multiselect-vue",attrs:{options:e.tags,"options-limit":5,placeholder:e.label,"track-by":"id","custom-label":e.tagLabel,multiple:e.multiple,"close-on-select":!1,"tag-width":60,disabled:e.disabled},on:{input:e.update},scopedSlots:e._u([{key:"option",fn:function(t){return[e._v("\n\t\t"+e._s(e.tagLabel(t.option))+"\n\t")]}}]),model:{value:e.inputValObjects,callback:function(t){e.inputValObjects=t},expression:"inputValObjects"}},[n("span",{attrs:{slot:"noResult"},slot:"noResult"},[e._v(e._s(e.t("core","No results")))])])}),[],!1,null,null,null).exports,K=z({name:"FileSystemTag",components:{MultiselectTag:Z},props:{value:{type:String,default:""}},data:function(){return{newValue:[]}},watch:{value:function(){this.updateValue()}},beforeMount:function(){this.updateValue()},methods:{updateValue:function(){""!==this.value?this.newValue=this.value:this.newValue=null},update:function(){this.$emit("input",this.newValue||"")}}},(function(){var e=this,t=e.$createElement;return(e._self._c||t)("MultiselectTag",{attrs:{multiple:!1,label:"Select a tag"},on:{input:e.update},model:{value:e.newValue,callback:function(t){e.newValue=t},expression:"newValue"}})}),[],!1,null,"0c858a95",null).exports,ee=[{class:"OCA\\WorkflowEngine\\Check\\FileName",name:t("workflowengine","File name"),operators:[{operator:"is",name:t("workflowengine","is")},{operator:"!is",name:t("workflowengine","is not")},{operator:"matches",name:t("workflowengine","matches")},{operator:"!matches",name:t("workflowengine","does not match")}],placeholder:function(e){return"matches"===e.operator||"!matches"===e.operator?"/^dummy-.+$/i":"filename.txt"},validate:function(e){return"matches"!==e.operator&&"!matches"!==e.operator||(t=e.value,null!==/^\/(.*)\/([gui]{0,3})$/.exec(t));var t}},{class:"OCA\\WorkflowEngine\\Check\\FileMimeType",name:t("workflowengine","File MIME type"),operators:[{operator:"is",name:t("workflowengine","is")},{operator:"!is",name:t("workflowengine","is not")},{operator:"matches",name:t("workflowengine","matches")},{operator:"!matches",name:t("workflowengine","does not match")}],component:G},{class:"OCA\\WorkflowEngine\\Check\\FileSize",name:t("workflowengine","File size (upload)"),operators:[{operator:"less",name:t("workflowengine","less")},{operator:"!greater",name:t("workflowengine","less or equals")},{operator:"!less",name:t("workflowengine","greater or equals")},{operator:"greater",name:t("workflowengine","greater")}],placeholder:function(e){return"5 MB"},validate:function(e){return null!==e.value.match(/^[0-9]+[ ]?[kmgt]?b$/i)}},{class:"OCA\\WorkflowEngine\\Check\\RequestRemoteAddress",name:t("workflowengine","Request remote address"),operators:[{operator:"matchesIPv4",name:t("workflowengine","matches IPv4")},{operator:"!matchesIPv4",name:t("workflowengine","does not match IPv4")},{operator:"matchesIPv6",name:t("workflowengine","matches IPv6")},{operator:"!matchesIPv6",name:t("workflowengine","does not match IPv6")}],placeholder:function(e){return"matchesIPv6"===e.operator||"!matchesIPv6"===e.operator?"::1/128":"127.0.0.1/32"},validate:function(e){return"matchesIPv6"===e.operator||"!matchesIPv6"===e.operator?(t=e.value,null!==/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(1([01][0-9]|2[0-8])|[1-9][0-9]|[0-9])$/.exec(t)):function(e){return null!==/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/(3[0-2]|[1-2][0-9]|[1-9])$/.exec(e)}(e.value);var t}},{class:"OCA\\WorkflowEngine\\Check\\FileSystemTags",name:t("workflowengine","File system tag"),operators:[{operator:"is",name:t("workflowengine","is tagged with")},{operator:"!is",name:t("workflowengine","is not tagged with")}],component:K}];function te(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var ne={name:"RequestUserAgent",components:{Multiselect:L.Multiselect},mixins:[F],data:function(){return{newValue:"",predefinedTypes:[{label:t("workflowengine","Sync clients"),children:[{pattern:"android",label:t("workflowengine","Android client"),icon:"icon-phone"},{pattern:"ios",label:t("workflowengine","iOS client"),icon:"icon-phone"},{pattern:"desktop",label:t("workflowengine","Desktop client"),icon:"icon-desktop"},{pattern:"mail",label:t("workflowengine","Thunderbird & Outlook addons"),icon:"icon-mail"}]}]}},computed:{options:function(){return[].concat(te(this.predefinedTypes),[this.customValue])},matchingPredefined:function(){var e=this;return this.predefinedTypes.map((function(e){return e.children})).flat().find((function(t){return e.newValue===t.pattern}))},isPredefined:function(){return!!this.matchingPredefined},customValue:function(){return{label:t("workflowengine","Others"),children:[{icon:"icon-settings-dark",label:t("workflowengine","Custom user agent"),pattern:""}]}},currentValue:function(){return this.matchingPredefined?this.matchingPredefined:{icon:"icon-settings-dark",label:t("workflowengine","Custom user agent"),pattern:this.newValue}}},methods:{validateRegex:function(e){return null!==/^\/(.*)\/([gui]{0,3})$/.exec(e)},setValue:function(e){null!==e&&(this.newValue=e.pattern,this.$emit("input",this.newValue))},updateCustom:function(e){this.newValue=e.target.value,this.$emit("input",this.newValue)}}},oe=(o(256),z(ne,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("Multiselect",{attrs:{value:e.currentValue,placeholder:e.t("workflowengine","Select a user agent"),label:"label","track-by":"pattern","group-values":"children","group-label":"label",options:e.options,multiple:!1,tagging:!1},on:{input:e.setValue},scopedSlots:e._u([{key:"singleLabel",fn:function(t){return[n("span",{staticClass:"option__icon",class:t.option.icon}),e._v(" "),n("span",{staticClass:"option__title option__title_single"},[e._v(e._s(t.option.label))])]}},{key:"option",fn:function(t){return[n("span",{staticClass:"option__icon",class:t.option.icon}),e._v(" "),n("span",{staticClass:"option__title"},[e._v(e._s(t.option.label)+" "+e._s(t.option.$groupLabel))])]}}])}),e._v(" "),e.isPredefined?e._e():n("input",{attrs:{type:"text"},domProps:{value:e.currentValue.pattern},on:{input:e.updateCustom}})],1)}),[],!1,null,"379c8fb5",null).exports),ie=o(32),re=o.n(ie),ae=re.a.tz.names(),se={name:"RequestTime",components:{Multiselect:L.Multiselect},mixins:[F],props:{value:{type:String,default:"1 MB"}},data:function(){return{timezones:ae,valid:!1,newValue:{startTime:null,endTime:null,timezone:re.a.tz.guess()}}},methods:{updateInternalValue:function(e){var t=JSON.parse(e),n=t[0].split(" ",2)[0],o=t[1].split(" ",2)[0],i=t[0].split(" ",2)[1];this.newValue={startTime:n,endTime:o,timezone:i}},validate:function(){return this.newValue.startTime&&null!==this.newValue.startTime.match(/^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$/i)&&this.newValue.endTime&&null!==this.newValue.endTime.match(/^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$/i)&&null!==re.a.tz.zone(this.newValue.timezone)},update:function(){if(this.validate()){var e='["'.concat(this.newValue.startTime," ").concat(this.newValue.timezone,'","').concat(this.newValue.endTime," ").concat(this.newValue.timezone,'"]');this.$emit("input",e),this.valid=!0}else this.valid=!1}}},ce=(o(262),z(se,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"timeslot"},[n("Multiselect",{attrs:{options:e.timezones},on:{input:e.update},model:{value:e.newValue.timezone,callback:function(t){e.$set(e.newValue,"timezone",t)},expression:"newValue.timezone"}}),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.newValue.startTime,expression:"newValue.startTime"}],staticClass:"timeslot--start",attrs:{type:"text",placeholder:"08:00"},domProps:{value:e.newValue.startTime},on:{input:[function(t){t.target.composing||e.$set(e.newValue,"startTime",t.target.value)},e.update]}}),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.newValue.endTime,expression:"newValue.endTime"}],attrs:{type:"text",placeholder:"18:00"},domProps:{value:e.newValue.endTime},on:{input:[function(t){t.target.composing||e.$set(e.newValue,"endTime",t.target.value)},e.update]}})],1)}),[],!1,null,"615d3f80",null).exports);function ue(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var de={name:"RequestURL",components:{Multiselect:L.Multiselect},mixins:[F],data:function(){return{newValue:"",predefinedTypes:[{label:t("workflowengine","Predefined URLs"),children:[{pattern:"webdav",label:t("workflowengine","Files WebDAV")}]}]}},computed:{options:function(){return[].concat(ue(this.predefinedTypes),[this.customValue])},placeholder:function(){return"matches"===this.check.operator||"!matches"===this.check.operator?"/^https\\:\\/\\/localhost\\/index\\.php$/i":"https://localhost/index.php"},matchingPredefined:function(){var e=this;return this.predefinedTypes.map((function(e){return e.children})).flat().find((function(t){return e.newValue===t.pattern}))},isPredefined:function(){return!!this.matchingPredefined},customValue:function(){return{label:t("workflowengine","Others"),children:[{icon:"icon-settings-dark",label:t("workflowengine","Custom URL"),pattern:""}]}},currentValue:function(){return this.matchingPredefined?this.matchingPredefined:{icon:"icon-settings-dark",label:t("workflowengine","Custom URL"),pattern:this.newValue}}},methods:{validateRegex:function(e){return null!==/^\/(.*)\/([gui]{0,3})$/.exec(e)},setValue:function(e){null!==e&&(this.newValue=e.pattern,this.$emit("input",this.newValue))},updateCustom:function(e){this.newValue=e.target.value,this.$emit("input",this.newValue)}}},le=(o(264),z(de,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("Multiselect",{attrs:{value:e.currentValue,placeholder:e.t("workflowengine","Select a request URL"),label:"label","track-by":"pattern","group-values":"children","group-label":"label",options:e.options,multiple:!1,tagging:!1},on:{input:e.setValue},scopedSlots:e._u([{key:"singleLabel",fn:function(t){return[n("span",{staticClass:"option__icon",class:t.option.icon}),e._v(" "),n("span",{staticClass:"option__title option__title_single"},[e._v(e._s(t.option.label))])]}},{key:"option",fn:function(t){return[n("span",{staticClass:"option__icon",class:t.option.icon}),e._v(" "),n("span",{staticClass:"option__title"},[e._v(e._s(t.option.label)+" "+e._s(t.option.$groupLabel))])]}}])}),e._v(" "),e.isPredefined?e._e():n("input",{attrs:{type:"text",placeholder:e.placeholder},domProps:{value:e.currentValue.pattern},on:{input:e.updateCustom}})],1)}),[],!1,null,"683f5ff4",null).exports),pe={name:"RequestUserGroup",components:{Multiselect:L.Multiselect},mixins:[F],data:function(){return{groups:[]}},beforeMount:function(){var e=this;s.a.get(OC.linkToOCS("cloud",2)+"groups").then((function(t){e.groups=t.data.ocs.data.groups.reduce((function(e,t){return e.push({id:t,displayname:t}),e}),[]),e.updateInternalValue(e.value)}),(function(e){console.error("Error while loading group list",e.response)}))},methods:{updateInternalValue:function(){var e=this;this.newValue=this.groups.find((function(t){return t.id===e.value}))||null},setValue:function(e){null!==e&&this.$emit("input",this.newValue.id)}}},fe=(o(266),z(pe,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("Multiselect",{class:{"icon-loading-small":0===e.groups.length},attrs:{options:e.groups,multiple:!1,label:"displayname","track-by":"id"},on:{input:e.setValue},model:{value:e.newValue,callback:function(t){e.newValue=t},expression:"newValue"}})],1)}),[],!1,null,"606ed772",null).exports),Ae=[{class:"OCA\\WorkflowEngine\\Check\\RequestURL",name:t("workflowengine","Request URL"),operators:[{operator:"is",name:t("workflowengine","is")},{operator:"!is",name:t("workflowengine","is not")},{operator:"matches",name:t("workflowengine","matches")},{operator:"!matches",name:t("workflowengine","does not match")}],component:le},{class:"OCA\\WorkflowEngine\\Check\\RequestTime",name:t("workflowengine","Request time"),operators:[{operator:"in",name:t("workflowengine","between")},{operator:"!in",name:t("workflowengine","not between")}],component:ce},{class:"OCA\\WorkflowEngine\\Check\\RequestUserAgent",name:t("workflowengine","Request user agent"),operators:[{operator:"is",name:t("workflowengine","is")},{operator:"!is",name:t("workflowengine","is not")},{operator:"matches",name:t("workflowengine","matches")},{operator:"!matches",name:t("workflowengine","does not match")}],component:oe},{class:"OCA\\WorkflowEngine\\Check\\UserGroupMembership",name:t("workflowengine","User group membership"),operators:[{operator:"is",name:t("workflowengine","is member of")},{operator:"!is",name:t("workflowengine","is not member of")}],component:fe}];function Me(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}
/*
* @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net>
*