2 lines
45 KiB
JavaScript
2 lines
45 KiB
JavaScript
!function(e){var t={};function n(a){if(t[a])return t[a].exports;var r=t[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(a,r,function(t){return e[t]}.bind(null,r));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/js/",n(n.s=31)}([function(e,t,n){"use strict";t.__esModule=!0,t.extend=i,t.indexOf=function(e,t){for(var n=0,a=e.length;n<a;n++)if(e[n]===t)return n;return-1},t.escapeExpression=function(e){if("string"!=typeof e){if(e&&e.toHTML)return e.toHTML();if(null==e)return"";if(!e)return e+"";e=""+e}if(!l.test(e))return e;return e.replace(r,o)},t.isEmpty=function(e){return!e&&0!==e||!(!u(e)||0!==e.length)},t.createFrame=function(e){var t=i({},e);return t._parent=e,t},t.blockParams=function(e,t){return e.path=t,e},t.appendContextPath=function(e,t){return(e?e+".":"")+t};var a={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},r=/[&<>"'`=]/g,l=/[&<>"'`=]/;function o(e){return a[e]}function i(e){for(var t=1;t<arguments.length;t++)for(var n in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],n)&&(e[n]=arguments[t][n]);return e}var s=Object.prototype.toString;t.toString=s;var c=function(e){return"function"==typeof e};c(/x/)&&(t.isFunction=c=function(e){return"function"==typeof e&&"[object Function]"===s.call(e)}),t.isFunction=c;var u=Array.isArray||function(e){return!(!e||"object"!=typeof e)&&"[object Array]"===s.call(e)};t.isArray=u},function(e,t,n){"use strict";t.__esModule=!0;var a=["description","fileName","lineNumber","message","name","number","stack"];function r(e,t){var n=t&&t.loc,l=void 0,o=void 0;n&&(e+=" - "+(l=n.start.line)+":"+(o=n.start.column));for(var i=Error.prototype.constructor.call(this,e),s=0;s<a.length;s++)this[a[s]]=i[a[s]];Error.captureStackTrace&&Error.captureStackTrace(this,r);try{n&&(this.lineNumber=l,Object.defineProperty?Object.defineProperty(this,"column",{value:o,enumerable:!0}):this.column=o)}catch(e){}}r.prototype=new Error,t.default=r,e.exports=t.default},function(e,t,n){e.exports=n(6).default},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.HandlebarsEnvironment=c;var r=n(0),l=a(n(1)),o=n(7),i=n(15),s=a(n(17));t.VERSION="4.1.2";t.COMPILER_REVISION=7;t.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0"};function c(e,t,n){this.helpers=e||{},this.partials=t||{},this.decorators=n||{},o.registerDefaultHelpers(this),i.registerDefaultDecorators(this)}c.prototype={constructor:c,logger:s.default,log:s.default.log,registerHelper:function(e,t){if("[object Object]"===r.toString.call(e)){if(t)throw new l.default("Arg not supported with multiple helpers");r.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if("[object Object]"===r.toString.call(e))r.extend(this.partials,e);else{if(void 0===t)throw new l.default('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,t){if("[object Object]"===r.toString.call(e)){if(t)throw new l.default("Arg not supported with multiple decorators");r.extend(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]}};var u=s.default.log;t.log=u,t.createFrame=r.createFrame,t.logger=s.default},function(e,t,n){var a=n(2);e.exports=(a.default||a).template({compiler:[7,">= 4.0.0"],main:function(e,t,n,a,r){return'var Handlebars = require("../../../../node_modules/handlebars/runtime.js");\nfunction __default(obj) { return obj && (obj.__esModule ? obj["default"] : obj); }\nmodule.exports = (Handlebars["default"] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) {\n return " modified";\n},"3":function(container,depth0,helpers,partials,data) {\n return "\t\t\t<span class=\\"button-delete icon-delete\\"></span>\\n";\n},"5":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;\n\n return "\t\t\t<div class=\\"check\\" data-id=\\""\n + alias4(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"index","hash":{},"data":data}) : helper)))\n + "\\">\\n\t\t\t\t<select class=\\"check-class\\">\\n"\n + ((stack1 = helpers.each.call(alias1,(depths[1] != null ? depths[1].classes : depths[1]),{"name":"each","hash":{},"fn":container.program(6, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")\n + "\t\t\t\t</select>\\n\t\t\t\t<select class=\\"check-operator\\">\\n"\n + ((stack1 = helpers.each.call(alias1,(helpers.getOperators || (depth0 && depth0.getOperators) || alias2).call(alias1,(depth0 != null ? depth0["class"] : depth0),{"name":"getOperators","hash":{},"data":data}),{"name":"each","hash":{},"fn":container.program(8, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")\n + "\t\t\t\t</select>\\n\t\t\t\t<input type=\\"text\\" class=\\"check-value\\" value=\\""\n + alias4(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"value","hash":{},"data":data}) : helper)))\n + "\\">\\n\t\t\t\t<span class=\\"button-delete-check icon-delete\\"></span>\\n\t\t\t</div>\\n";\n},"6":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;\n\n return "\t\t\t\t\t\t<option value=\\""\n + alias4(((helper = (helper = helpers["class"] || (depth0 != null ? depth0["class"] : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"class","hash":{},"data":data}) : helper)))\n + "\\" "\n + ((stack1 = (helpers.selectItem || (depth0 && depth0.selectItem) || alias2).call(alias1,(depth0 != null ? depth0["class"] : depth0),(depths[1] != null ? depths[1]["class"] : depths[1]),{"name":"selectItem","hash":{},"data":data})) != null ? stack1 : "")\n + ">"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))\n + "</option>\\n";\n},"8":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;\n\n return "\t\t\t\t\t\t<option value=\\""\n + alias4(((helper = (helper = helpers.operator || (depth0 != null ? depth0.operator : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"operator","hash":{},"data":data}) : helper)))\n + "\\" "\n + ((stack1 = (helpers.selectItem || (depth0 && depth0.selectItem) || alias2).call(alias1,(depth0 != null ? depth0.operator : depth0),(depths[1] != null ? depths[1].operator : depths[1]),{"name":"selectItem","hash":{},"data":data})) != null ? stack1 : "")\n + ">"\n + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))\n + "</option>\\n";\n},"10":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {});\n\n return ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.operation : depth0)) != null ? stack1.id : stack1),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")\n + "\t\t<button class=\\"button-save pull-right\\">"\n + container.escapeExpression(((helper = (helper = helpers.saveTXT || (depth0 != null ? depth0.saveTXT : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"saveTXT","hash":{},"data":data}) : helper)))\n + "</button>\\n";\n},"11":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return "\t\t\t<button class=\\"button-reset pull-right\\">"\n + container.escapeExpression(((helper = (helper = helpers.resetTXT || (depth0 != null ? depth0.resetTXT : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"resetTXT","hash":{},"data":data}) : helper)))\n + "</button>\\n";\n},"13":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return "\t\t<span class=\\"icon-loading-small pull-right\\"></span>\\n\t\t<span class=\\"pull-right\\">"\n + container.escapeExpression(((helper = (helper = helpers.savingTXT || (depth0 != null ? depth0.savingTXT : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"savingTXT","hash":{},"data":data}) : helper)))\n + "</span>\\n\t";\n},"15":function(container,depth0,helpers,partials,data) {\n var stack1;\n\n return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.message : depth0),{"name":"if","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "");\n},"16":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {});\n\n return "\\n\t\t<span class=\\"msg pull-right "\n + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.errorMessage : depth0),{"name":"if","hash":{},"fn":container.program(17, data, 0),"inverse":container.program(19, data, 0),"data":data})) != null ? stack1 : "")\n + "\\">\\n\t\t\t\t\t"\n + container.escapeExpression(((helper = (helper = helpers.message || (depth0 != null ? depth0.message : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"message","hash":{},"data":data}) : helper)))\n + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.errorMessage : depth0),{"name":"if","hash":{},"fn":container.program(21, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")\n + "\\n\t\t\t\t</span>\\n\t";\n},"17":function(container,depth0,helpers,partials,data) {\n return "error";\n},"19":function(container,depth0,helpers,partials,data) {\n return "success";\n},"21":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return " "\n + container.escapeExpression(((helper = (helper = helpers.errorMessage || (depth0 != null ? depth0.errorMessage : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"errorMessage","hash":{},"data":data}) : helper)));\n},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {\n var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda;\n\n return "<div class=\\"operation"\n + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.hasChanged : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")\n + "\\">\\n\t<div class=\\"operation-header\\">\\n\t\t<input type=\\"text\\" class=\\"operation-name\\" placeholder=\\""\n + alias4(((helper = (helper = helpers.shortRuleDescTXT || (depth0 != null ? depth0.shortRuleDescTXT : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"shortRuleDescTXT","hash":{},"data":data}) : helper)))\n + "\\" value=\\""\n + alias4(alias5(((stack1 = (depth0 != null ? depth0.operation : depth0)) != null ? stack1.name : stack1), depth0))\n + "\\" />\\n\t\t<input type=\\"text\\" class=\\"operation-operation\\" value=\\""\n + alias4(alias5(((stack1 = (depth0 != null ? depth0.operation : depth0)) != null ? stack1.operation : stack1), depth0))\n + "\\" />\\n"\n + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.operation : depth0)) != null ? stack1.id : stack1),{"name":"if","hash":{},"fn":container.program(3, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")\n + "\t</div>\\n\\n\t<div class=\\"checks\\">\\n"\n + ((stack1 = helpers.each.call(alias1,((stack1 = (depth0 != null ? depth0.operation : depth0)) != null ? stack1.checks : stack1),{"name":"each","hash":{},"fn":container.program(5, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")\n + "\t</div>\\n\t<button class=\\"button-add\\">"\n + alias4(((helper = (helper = helpers.addRuleTXT || (depth0 != null ? depth0.addRuleTXT : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"addRuleTXT","hash":{},"data":data}) : helper)))\n + "</button>\\n"\n + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.hasChanged : depth0),{"name":"if","hash":{},"fn":container.program(10, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")\n + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.saving : depth0),{"name":"if","hash":{},"fn":container.program(13, data, 0, blockParams, depths),"inverse":container.program(15, data, 0, blockParams, depths),"data":data})) != null ? stack1 : "")\n + "\\n</div>\\n";\n},"useData":true,"useDepths":true});'},useData:!0})},function(e,t,n){var a=n(2);e.exports=(a.default||a).template({compiler:[7,">= 4.0.0"],main:function(e,t,n,a,r){return'var Handlebars = require("../../../../node_modules/handlebars/runtime.js");\nfunction __default(obj) { return obj && (obj.__esModule ? obj["default"] : obj); }\nmodule.exports = (Handlebars["default"] || Handlebars).template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {\n var helper;\n\n return "<div class=\\"operations\\"></div>\\n<button class=\\"button-add-operation\\">"\n + container.escapeExpression(((helper = (helper = helpers.addRuleGroupTXT || (depth0 != null ? depth0.addRuleGroupTXT : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"addRuleGroupTXT","hash":{},"data":data}) : helper)))\n + "</button>\\n";\n},"useData":true});'},useData:!0})},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}t.__esModule=!0;var l=r(n(3)),o=a(n(18)),i=a(n(1)),s=r(n(0)),c=r(n(19)),u=a(n(20));function p(){var e=new l.HandlebarsEnvironment;return s.extend(e,l),e.SafeString=o.default,e.Exception=i.default,e.Utils=s,e.escapeExpression=s.escapeExpression,e.VM=c,e.template=function(t){return c.template(t,e)},e}var d=p();d.create=p,u.default(d),d.default=d,t.default=d,e.exports=t.default},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.registerDefaultHelpers=function(e){r.default(e),l.default(e),o.default(e),i.default(e),s.default(e),c.default(e),u.default(e)};var r=a(n(8)),l=a(n(9)),o=a(n(10)),i=a(n(11)),s=a(n(12)),c=a(n(13)),u=a(n(14))},function(e,t,n){"use strict";t.__esModule=!0;var a=n(0);t.default=function(e){e.registerHelper("blockHelperMissing",function(t,n){var r=n.inverse,l=n.fn;if(!0===t)return l(this);if(!1===t||null==t)return r(this);if(a.isArray(t))return t.length>0?(n.ids&&(n.ids=[n.name]),e.helpers.each(t,n)):r(this);if(n.data&&n.ids){var o=a.createFrame(n.data);o.contextPath=a.appendContextPath(n.data.contextPath,n.name),n={data:o}}return l(t,n)})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var a,r=n(0),l=n(1),o=(a=l)&&a.__esModule?a:{default:a};t.default=function(e){e.registerHelper("each",function(e,t){if(!t)throw new o.default("Must pass iterator to #each");var n=t.fn,a=t.inverse,l=0,i="",s=void 0,c=void 0;function u(t,a,l){s&&(s.key=t,s.index=a,s.first=0===a,s.last=!!l,c&&(s.contextPath=c+t)),i+=n(e[t],{data:s,blockParams:r.blockParams([e[t],t],[c+t,null])})}if(t.data&&t.ids&&(c=r.appendContextPath(t.data.contextPath,t.ids[0])+"."),r.isFunction(e)&&(e=e.call(this)),t.data&&(s=r.createFrame(t.data)),e&&"object"==typeof e)if(r.isArray(e))for(var p=e.length;l<p;l++)l in e&&u(l,l,l===e.length-1);else{var d=void 0;for(var h in e)e.hasOwnProperty(h)&&(void 0!==d&&u(d,l-1),d=h,l++);void 0!==d&&u(d,l-1,!0)}return 0===l&&(i=a(this)),i})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var a,r=n(1),l=(a=r)&&a.__esModule?a:{default:a};t.default=function(e){e.registerHelper("helperMissing",function(){if(1!==arguments.length)throw new l.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var a=n(0);t.default=function(e){e.registerHelper("if",function(e,t){return a.isFunction(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||a.isEmpty(e)?t.inverse(this):t.fn(this)}),e.registerHelper("unless",function(t,n){return e.helpers.if.call(this,t,{fn:n.inverse,inverse:n.fn,hash:n.hash})})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e){e.registerHelper("log",function(){for(var t=[void 0],n=arguments[arguments.length-1],a=0;a<arguments.length-1;a++)t.push(arguments[a]);var r=1;null!=n.hash.level?r=n.hash.level:n.data&&null!=n.data.level&&(r=n.data.level),t[0]=r,e.log.apply(e,t)})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e){e.registerHelper("lookup",function(e,t){return e?"constructor"!==t||e.propertyIsEnumerable(t)?e[t]:void 0:e})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var a=n(0);t.default=function(e){e.registerHelper("with",function(e,t){a.isFunction(e)&&(e=e.call(this));var n=t.fn;if(a.isEmpty(e))return t.inverse(this);var r=t.data;return t.data&&t.ids&&((r=a.createFrame(t.data)).contextPath=a.appendContextPath(t.data.contextPath,t.ids[0])),n(e,{data:r,blockParams:a.blockParams([e],[r&&r.contextPath])})})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.registerDefaultDecorators=function(e){l.default(e)};var a,r=n(16),l=(a=r)&&a.__esModule?a:{default:a}},function(e,t,n){"use strict";t.__esModule=!0;var a=n(0);t.default=function(e){e.registerDecorator("inline",function(e,t,n,r){var l=e;return t.partials||(t.partials={},l=function(r,l){var o=n.partials;n.partials=a.extend({},o,t.partials);var i=e(r,l);return n.partials=o,i}),t.partials[r.args[0]]=r.fn,l})},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var a=n(0),r={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(e){if("string"==typeof e){var t=a.indexOf(r.methodMap,e.toLowerCase());e=t>=0?t:parseInt(e,10)}return e},log:function(e){if(e=r.lookupLevel(e),"undefined"!=typeof console&&r.lookupLevel(r.level)<=e){var t=r.methodMap[e];console[t]||(t="log");for(var n=arguments.length,a=Array(n>1?n-1:0),l=1;l<n;l++)a[l-1]=arguments[l];console[t].apply(console,a)}}};t.default=r,e.exports=t.default},function(e,t,n){"use strict";function a(e){this.string=e}t.__esModule=!0,a.prototype.toString=a.prototype.toHTML=function(){return""+this.string},t.default=a,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.checkRevision=function(e){var t=e&&e[0]||1,n=i.COMPILER_REVISION;if(t!==n){if(t<n){var a=i.REVISION_CHANGES[n],r=i.REVISION_CHANGES[t];throw new o.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+a+") or downgrade your runtime to an older version ("+r+").")}throw new o.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+e[1]+").")}},t.template=function(e,t){if(!t)throw new o.default("No environment passed to template");if(!e||!e.main)throw new o.default("Unknown template object: "+typeof e);e.main.decorator=e.main_d,t.VM.checkRevision(e.compiler);var n={strict:function(e,t){if(!(t in e))throw new o.default('"'+t+'" not defined in '+e);return e[t]},lookup:function(e,t){for(var n=e.length,a=0;a<n;a++)if(e[a]&&null!=e[a][t])return e[a][t]},lambda:function(e,t){return"function"==typeof e?e.call(t):e},escapeExpression:r.escapeExpression,invokePartial:function(n,a,l){l.hash&&(a=r.extend({},a,l.hash),l.ids&&(l.ids[0]=!0));n=t.VM.resolvePartial.call(this,n,a,l);var i=t.VM.invokePartial.call(this,n,a,l);null==i&&t.compile&&(l.partials[l.name]=t.compile(n,e.compilerOptions,t),i=l.partials[l.name](a,l));if(null!=i){if(l.indent){for(var s=i.split("\n"),c=0,u=s.length;c<u&&(s[c]||c+1!==u);c++)s[c]=l.indent+s[c];i=s.join("\n")}return i}throw new o.default("The partial "+l.name+" could not be compiled when running in runtime-only mode")},fn:function(t){var n=e[t];return n.decorator=e[t+"_d"],n},programs:[],program:function(e,t,n,a,r){var l=this.programs[e],o=this.fn(e);return t||r||a||n?l=s(this,e,o,t,n,a,r):l||(l=this.programs[e]=s(this,e,o)),l},data:function(e,t){for(;e&&t--;)e=e._parent;return e},merge:function(e,t){var n=e||t;return e&&t&&e!==t&&(n=r.extend({},t,e)),n},nullContext:Object.seal({}),noop:t.VM.noop,compilerInfo:e.compiler};function a(t){var r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],l=r.data;a._setup(r),!r.partial&&e.useData&&(l=function(e,t){t&&"root"in t||((t=t?i.createFrame(t):{}).root=e);return t}(t,l));var o=void 0,s=e.useBlockParams?[]:void 0;function c(t){return""+e.main(n,t,n.helpers,n.partials,l,s,o)}return e.useDepths&&(o=r.depths?t!=r.depths[0]?[t].concat(r.depths):r.depths:[t]),(c=u(e.main,c,n,r.depths||[],l,s))(t,r)}return a.isTop=!0,a._setup=function(a){a.partial?(n.helpers=a.helpers,n.partials=a.partials,n.decorators=a.decorators):(n.helpers=n.merge(a.helpers,t.helpers),e.usePartial&&(n.partials=n.merge(a.partials,t.partials)),(e.usePartial||e.useDecorators)&&(n.decorators=n.merge(a.decorators,t.decorators)))},a._child=function(t,a,r,l){if(e.useBlockParams&&!r)throw new o.default("must pass block params");if(e.useDepths&&!l)throw new o.default("must pass parent depths");return s(n,t,e[t],a,0,r,l)},a},t.wrapProgram=s,t.resolvePartial=function(e,t,n){e?e.call||n.name||(n.name=e,e=n.partials[e]):e="@partial-block"===n.name?n.data["partial-block"]:n.partials[n.name];return e},t.invokePartial=function(e,t,n){var a=n.data&&n.data["partial-block"];n.partial=!0,n.ids&&(n.data.contextPath=n.ids[0]||n.data.contextPath);var l=void 0;n.fn&&n.fn!==c&&function(){n.data=i.createFrame(n.data);var e=n.fn;l=n.data["partial-block"]=function(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return n.data=i.createFrame(n.data),n.data["partial-block"]=a,e(t,n)},e.partials&&(n.partials=r.extend({},n.partials,e.partials))}();void 0===e&&l&&(e=l);if(void 0===e)throw new o.default("The partial "+n.name+" could not be found");if(e instanceof Function)return e(t,n)},t.noop=c;var a,r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),l=n(1),o=(a=l)&&a.__esModule?a:{default:a},i=n(3);function s(e,t,n,a,r,l,o){function i(t){var r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=o;return!o||t==o[0]||t===e.nullContext&&null===o[0]||(i=[t].concat(o)),n(e,t,e.helpers,e.partials,r.data||a,l&&[r.blockParams].concat(l),i)}return(i=u(n,i,e,o,a,l)).program=t,i.depth=o?o.length:0,i.blockParams=r||0,i}function c(){return""}function u(e,t,n,a,l,o){if(e.decorator){var i={};t=e.decorator(t,i,n,a&&a[0],l,o,a),r.extend(t,i)}return t}},function(e,t,n){"use strict";(function(n){t.__esModule=!0,t.default=function(e){var t=void 0!==n?n:window,a=t.Handlebars;e.noConflict=function(){return t.Handlebars===e&&(t.Handlebars=a),e}},e.exports=t.default}).call(this,n(21))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.FileMimeTypePlugin={getCheck:function(){return{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")}]}},render:function(e,n){if("OCA\\WorkflowEngine\\Check\\FileMimeType"===n.class){var a="text/plain";"matches"!==n.operator&&"!matches"!==n.operator||(a="/^text\\/(plain|html)$/i",this._validateRegex(n.value)?$(e).removeClass("invalid-input"):$(e).addClass("invalid-input")),$(e).css("width","250px").attr("placeholder",a).attr("title",t("workflowengine","Example: {placeholder}",{placeholder:a})).addClass("has-tooltip").tooltip({placement:"bottom"})}},_validateRegex:function(e){return null!==/^\/(.*)\/([gui]{0,3})$/.exec(e)}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.FileMimeTypePlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.FileNamePlugin={getCheck:function(){return{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")}]}},render:function(e,n){if("OCA\\WorkflowEngine\\Check\\FileName"===n.class){var a="dummy.jpg";"matches"!==n.operator&&"!matches"!==n.operator||(a="/^dummy-.+$/i",this._validateRegex(n.value)?$(e).removeClass("invalid-input"):$(e).addClass("invalid-input")),$(e).css("width","250px").attr("placeholder",a).attr("title",t("workflowengine","Example: {placeholder}",{placeholder:a})).addClass("has-tooltip").tooltip({placement:"bottom"})}},_validateRegex:function(e){return null!==/^\/(.*)\/([gui]{0,3})$/.exec(e)}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.FileNamePlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.FileSizePlugin={getCheck:function(){return{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")}]}},render:function(e,n){"OCA\\WorkflowEngine\\Check\\FileSize"===n.class&&$(e).css("width","250px").attr("placeholder","12 MB").attr("title",t("workflowengine","Example: {placeholder}",{placeholder:"12 MB"})).addClass("has-tooltip").tooltip({placement:"bottom"})}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.FileSizePlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.FileSystemTagsPlugin={getCheck:function(){return this.collection=OC.SystemTags.collection,{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")}]}},render:function(e,n){"OCA\\WorkflowEngine\\Check\\FileSystemTags"===n.class&&($(e).css("width","400px"),$(e).select2({allowClear:!1,multiple:!1,placeholder:t("workflowengine","Select tag…"),query:_.debounce(function(e){e.callback({results:OC.SystemTags.collection.filterByName(e.term)})},100,!0),id:function(e){return e.get("id")},initSelection:function(e,t){t($(e).val())},formatResult:function(e){return OC.SystemTags.getDescriptiveTag(e)},formatSelection:function(e){var t=OC.SystemTags.collection.get(e);if(!_.isUndefined(t))return OC.SystemTags.getDescriptiveTag(t)},escapeMarkup:function(e){return e}}))}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.FileSystemTagsPlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.RequestRemoteAddressPlugin={getCheck:function(){return{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")}]}},render:function(e,n){if("OCA\\WorkflowEngine\\Check\\RequestRemoteAddress"===n.class){var a="127.0.0.1/32";"matchesIPv6"===n.operator||"!matchesIPv6"===n.operator?(a="::1/128",this._validateIPv6(n.value)?$(e).removeClass("invalid-input"):$(e).addClass("invalid-input")):this._validateIPv4(n.value)?$(e).removeClass("invalid-input"):$(e).addClass("invalid-input"),$(e).css("width","300px").attr("placeholder",a).attr("title",t("workflowengine","Example: {placeholder}",{placeholder:a})).addClass("has-tooltip").tooltip({placement:"bottom"})}},_validateIPv4: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)},_validateIPv6:function(e){return 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(e)}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.RequestRemoteAddressPlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.RequestTimePlugin={timezones:["Europe/Berlin","Europe/London"],_$element:null,getCheck:function(){return{class:"OCA\\WorkflowEngine\\Check\\RequestTime",name:t("workflowengine","Request time"),operators:[{operator:"in",name:t("workflowengine","between")},{operator:"!in",name:t("workflowengine","not between")}]}},render:function(e,n){if("OCA\\WorkflowEngine\\Check\\RequestTime"===n.class){var a="09:00",r="18:00",l=jstz.determine().name(),o=$(e);if(_.isString(n.value)&&""!==n.value){var i=JSON.parse(n.value),s=i[0].split(" ",2),c=i[1].split(" ",2);a=s[0],r=c[0],l=s[1]}var u=JSON.stringify([a+" "+l,r+" "+l]);n.value!==u&&(n.value=u,o.val(u)),o.css("display","none"),$("<input>").attr("type","text").attr("placeholder",t("workflowengine","Start")).attr("title",t("workflowengine","Example: {placeholder}",{placeholder:"16:00"})).addClass("has-tooltip").tooltip({placement:"bottom"}).addClass("start").val(a).insertBefore(o),$("<input>").attr("type","text").attr("placeholder",t("workflowengine","End")).attr("title",t("workflowengine","Example: {placeholder}",{placeholder:"16:00"})).addClass("has-tooltip").tooltip({placement:"bottom"}).addClass("end").val(r).insertBefore(o);var p=$("<input>").attr("type","hidden").css("width","250px").insertBefore(o).val(l);p.select2({allowClear:!1,multiple:!1,placeholder:t("workflowengine","Select timezone…"),ajax:{url:OC.generateUrl("apps/workflowengine/timezones"),dataType:"json",quietMillis:100,data:function(e){return""===e&&(e=(e=jstz.determine().name().split("/"))[0]),{search:e}},results:function(e){var t=[];return $.each(e,function(e){t.push({id:e})}),{results:t,more:!1}}},initSelection:function(e,t){t(e.val())},formatResult:function(e){return"<span>"+e.id+"</span>"},formatSelection:function(e){return _.isUndefined(e.id)||(e=e.id),"<span>"+e+"</span>"}}),p.addClass("timezone"),o.parent().on("change",".start",_.bind(this.update,this)).on("change",".end",_.bind(this.update,this)).on("change",".timezone",_.bind(this.update,this)),this._$element=o}},update:function(e){for(var t=e.target.value,n=null,a=0;a<e.target.classList.length;a++)n=e.target.classList[a];if(null!==n){var r=JSON.parse(this._$element.val()),l=moment(r[0].split(" ",2)[0],"H:m Z"),o=moment(r[1].split(" ",2)[0],"H:m Z"),i=r[0].split(" ",2)[1];if("start"===n||"end"===n){var s=moment(t,["H:m","h:m a"],!0).format("HH:mm");if("Invalid date"===s)return;var c=0;"end"===n&&(c=1),r[c]=s+" "+i}"timezone"===n&&(r[0]=l.format("HH:mm")+" "+t,r[1]=o.format("HH:mm")+" "+t),this._$element.val(JSON.stringify(r)),this._$element.trigger("change")}else console.warn("update triggered but element doesn't have any class")}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.RequestTimePlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.RequestURLPlugin={predefinedValues:["webdav"],getCheck:function(){return{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")}]}},render:function(e,n){if("OCA\\WorkflowEngine\\Check\\RequestURL"===n.class){var a="https://localhost/index.php";if("matches"!==n.operator&&"!matches"!==n.operator||(a="/^https\\:\\/\\/localhost\\/index\\.php$/i"),$(e).css("width","250px").attr("placeholder",a).attr("title",t("workflowengine","Example: {placeholder}",{placeholder:a})).addClass("has-tooltip").tooltip({placement:"bottom"}),"matches"===n.operator||"!matches"===n.operator)this._validateRegex(n.value)?$(e).removeClass("invalid-input"):$(e).addClass("invalid-input");else{var r=this,l=[{text:t("workflowengine","Predefined URLs"),children:[{id:"webdav",text:t("workflowengine","Files WebDAV")}]}];-1===this.predefinedValues.indexOf(n.value)&&l.unshift({id:n.value,text:n.value}),$(e).select2({data:l,createSearchChoice:function(e){if(-1===r.predefinedValues.indexOf(n.value))return{id:e,text:e}},id:function(e){return e.id},formatResult:function(e){return e.text},formatSelection:function(e){return e.text},escapeMarkup:function(e){return e}})}}},_validateRegex:function(e){return null!==/^\/(.*)\/([gui]{0,3})$/.exec(e)}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.RequestURLPlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.RequestUserAgentPlugin={predefinedValues:["android","ios","desktop"],getCheck:function(){return{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")}]}},render:function(e,n){if("OCA\\WorkflowEngine\\Check\\RequestUserAgent"===n.class){var a="Mozilla/5.0 User Agent";if("matches"!==n.operator&&"!matches"!==n.operator||(a="/^Mozilla\\/5\\.0 (.*)$/i"),$(e).css("width","250px").attr("placeholder",a).attr("title",t("workflowengine","Example: {placeholder}",{placeholder:a})).addClass("has-tooltip").tooltip({placement:"bottom"}),"matches"===n.operator||"!matches"===n.operator)this._validateRegex(n.value)?$(e).removeClass("invalid-input"):$(e).addClass("invalid-input");else{var r=this,l=[{text:t("workflowengine","Sync clients"),children:[{id:"android",text:t("workflowengine","Android client")},{id:"ios",text:t("workflowengine","iOS client")},{id:"desktop",text:t("workflowengine","Desktop client")},{id:"mail",text:t("workflowengine","Thunderbird & Outlook addons")}]}];-1===this.predefinedValues.indexOf(n.value)&&l.unshift({id:n.value,text:n.value}),$(e).select2({data:l,createSearchChoice:function(e){if(-1===r.predefinedValues.indexOf(n.value))return{id:e,text:e}},id:function(e){return e.id},formatResult:function(e){return e.text},formatSelection:function(e){return e.text},escapeMarkup:function(e){return e}})}}},_validateRegex:function(e){return null!==/^\/(.*)\/([gui]{0,3})$/.exec(e)}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.RequestUserAgentPlugin)},function(e,n){OCA.WorkflowEngine=OCA.WorkflowEngine||{},OCA.WorkflowEngine.Plugins=OCA.WorkflowEngine.Plugins||{},OCA.WorkflowEngine.Plugins.UserGroupMembershipPlugin={getCheck:function(){return{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")}]}},render:function(e,t,n){"OCA\\WorkflowEngine\\Check\\UserGroupMembership"===t.class&&($(e).css("width","400px"),$(e).select2({data:{results:n,text:"displayname"},initSelection:function(e,t){var a=e.val();a&&n.length>0?t({id:a,displayname:n.find(function(e){return e.id===a}).displayname}):a?t({id:a,displayname:a}):t()},formatResult:function(e){return"<span>"+escapeHTML(e.displayname)+"</span>"},formatSelection:function(e){return'<span title="'+escapeHTML(e.id)+'">'+escapeHTML(e.displayname)+"</span>"}}))}},OC.Plugins.register("OCA.WorkflowEngine.CheckPlugins",OCA.WorkflowEngine.Plugins.UserGroupMembershipPlugin)},function(e,n,a){"use strict";a.r(n);var r=a(4),l=a.n(r),o=a(5),i=a.n(o);OCA.WorkflowEngine=_.extend(OCA.WorkflowEngine||{},{availablePlugins:[],availableChecks:[],getCheckByClass:function(e){for(var t=OCA.WorkflowEngine.availableChecks.length,n=0;n<t;n++)if(OCA.WorkflowEngine.availableChecks[n].class===e)return OCA.WorkflowEngine.availableChecks[n]}}),OCA.WorkflowEngine.Operation=OC.Backbone.Model.extend({defaults:{class:"OCA\\WorkflowEngine\\Operation",name:"",checks:[],operation:""}}),OCA.WorkflowEngine.OperationsCollection=OC.Backbone.Collection.extend({model:OCA.WorkflowEngine.Operation,url:OC.generateUrl("apps/workflowengine/operations")}),OCA.WorkflowEngine.OperationView=OC.Backbone.View.extend({templateId:"#operation-template",events:{"change .check-class":"checkChanged","change .check-operator":"checkChanged","change .check-value":"checkChanged","change .operation-name":"operationChanged","change .operation-operation":"operationChanged","click .button-reset":"reset","click .button-save":"save","click .button-add":"add","click .button-delete":"delete","click .button-delete-check":"deleteCheck"},originalModel:null,hasChanged:!1,message:"",errorMessage:"",saving:!1,groups:[],template:function(e){return l()(_.extend({shortRuleDescTXT:t("workflowengine","Short rule description"),addRuleTXT:t("workflowengine","Add rule"),resetTXT:t("workflowengine","Reset"),saveTXT:t("workflowengine","Save"),savingTXT:t("workflowengine","Saving…")},e))},initialize:function(){this.originalModel=JSON.parse(JSON.stringify(this.model)),this.model.on("change",function(){console.log("model changed"),this.hasChanged=!0,this.render()},this),void 0===this.model.get("id")&&(this.hasChanged=!0);var e=this;$.ajax({url:OC.linkToOCS("cloud/groups",2)+"details",dataType:"json",quietMillis:100}).success(function(n){n.ocs.data.groups&&n.ocs.data.groups.length>0?(n.ocs.data.groups.forEach(function(t){e.groups.push({id:t.id,displayname:t.displayname})}),e.render()):(OC.Notification.error(t("workflowengine","Group list is empty"),{type:"error"}),console.log(n))}).error(function(e){OC.Notification.error(t("workflowengine","Unable to retrieve the group list"),{type:"error"}),console.log(e)})},delete:function(){OC.PasswordConfirmation.requiresPasswordConfirmation()?OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this.delete,this)):(this.model.destroy(),this.remove())},reset:function(){this.hasChanged=!1,this.model.set(this.originalModel,{silent:!0}),this.render()},save:function(){OC.PasswordConfirmation.requiresPasswordConfirmation()?OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this.save,this)):(this.hasChanged=!1,this.saving=!0,this.render(),this.model.save(null,{success:function(e,n,a){this.saving=!1,this.originalModel=JSON.parse(JSON.stringify(this.model)),this.message=t("workflowengine","Saved"),this.errorMessage="",this.render()},error:function(e,n,a){this.saving=!1,this.hasChanged=!0,this.message=t("workflowengine","Saving failed:"),this.errorMessage=n.responseText,this.render()},context:this}))},add:function(){var e=_.clone(this.model.get("checks")),t=OCA.WorkflowEngine.availableChecks[0].class,n=OCA.WorkflowEngine.availableChecks[0].operators;e.push({class:t,operator:n[0].operator,value:""}),this.model.set({checks:e})},checkChanged:function(e){for(var t=e.target.value,n=$(e.target.parentElement).data("id"),a=JSON.parse(JSON.stringify(this.model.get("checks"))),r=null,l=0;l<e.target.classList.length;l++){var o=e.target.classList[l];if("check-"===o.substr(0,"check-".length)){r=o.substr("check-".length);break}}if(null!==r)if(_.has(a[n],r)){if(a[n][r]=t,"class"===r){var i=OCA.WorkflowEngine.getCheckByClass(t);_.isUndefined(i)||(a[n].operator=i.operators[0].operator,a[n].value="")}this.model.set({checks:a})}else console.warn('key "'+r+'" is not available in check',i);else console.warn('checkChanged triggered but element doesn\'t have any "check-" class')},deleteCheck:function(e){console.log(arguments);var t=$(e.target.parentElement).data("id"),n=JSON.parse(JSON.stringify(this.model.get("checks")));n.splice(t,1),this.model.set({checks:n})},operationChanged:function(e){for(var t=e.target.value,n=null,a=0;a<e.target.classList.length;a++){var r=e.target.classList[a];if("operation-"===r.substr(0,"operation-".length)){n=r.substr("operation-".length);break}}null!==n?"name"===n||"operation"===n?this.model.set(n,t):console.warn('key "'+n+'" is no valid attribute'):console.warn('operationChanged triggered but element doesn\'t have any "operation-" class')},render:function(){this.$el.html(this.template({operation:this.model.toJSON(),classes:OCA.WorkflowEngine.availableChecks,hasChanged:this.hasChanged,message:this.message,errorMessage:this.errorMessage,saving:this.saving}));var e=this.model.get("checks");return _.each(this.$el.find(".check"),function(t){var n=$(t),a=n.data("id"),r=e[a],l=n.find(".check-value").first(),o=this;_.each(OCA.WorkflowEngine.availablePlugins,function(e){_.isFunction(e.render)&&e.render(l,r,o.groups)})},this),""!==this.message&&(_.delay(function(e){$(e).css("opacity",0)},7e3,this.$el.find(".msg.success")),this.message=""),this.$el}}),OCA.WorkflowEngine.OperationsView=OC.Backbone.View.extend({templateId:"#operations-template",collection:null,$el:null,events:{"click .button-add-operation":"add"},template:function(e){return i()(_.extend({addRuleGroupTXT:t("workflowengine","Add rule group")},e))},initialize:function(e){OCA.WorkflowEngine.availablePlugins.length||(OCA.WorkflowEngine.availablePlugins=OC.Plugins.getPlugins("OCA.WorkflowEngine.CheckPlugins"),_.each(OCA.WorkflowEngine.availablePlugins,function(t){_.isFunction(t.getCheck)&&OCA.WorkflowEngine.availableChecks.push(t.getCheck(e))})),this.collection.fetch({data:{class:e}}),this.collection.once("sync",this.render,this)},add:function(){var e=this.collection.create();this.renderOperation(e)},renderOperation:function(e){this.$el.find(".operations").append(e.$el),e.render()},render:function(){this.$el.html(this.template()),this.collection.each(this.renderOperation,this)}});a(22),a(23),a(24),a(25),a(26),a(27),a(28),a(29),a(30);window.OCA.WorkflowEngine=OCA.WorkflowEngine}]);
|
|
//# sourceMappingURL=workflowengine.js.map
|