
kerio.waw.ui.trafficServiceEditor = {

x_m: function(x_n) {
var
x_1b = kerio.lib,
x_x = x_1b.x_x,
x_4u,
x_32,
x_3l,
x_5o,
x_10,
x_16,
x_1u7,
x_4k,
x_1u8,
x_2w;
this.x_ga = x_n; x_2w = this.x_ga + '_';

x_1u8 = function(x_b4) {
var
x_41, x_42,
x_1u9,
x_dh;
x_b4 = (x_b4 + '');
x_1u9 = x_b4.length;
x_dh = x_b4;
for (x_41 = 0, x_42 = 5 - x_b4.length; x_41 < x_42; x_41++) {
x_dh = '0' + x_dh;
}
return x_dh;
};
x_1u7 = function(x_8d, x_1ua, x_a4, x_8v) {
var
x_1u3 = true,
x_dr = [],
x_uy,
x_1ub,
x_41, x_42;
for (x_41 = 0, x_42 = x_8v.length; x_41 < x_42; x_41++) {
x_1ub = x_8v[x_41];
x_uy = kerio.lib.x_9m(this.x_1u5);
x_uy.definedService = x_1u3;
x_uy.service.id = x_1ub.id;
x_uy.service.name = x_1ub.name;
x_dr.push(x_uy);
}
this.x_16.x_1u6(x_dr, x_1u3);
};x_4u = {
x_1f: 'x_gr',
x_7v: true,
x_1e: [
{	x_23: x_x('Add service…', 'trafficRuleEditor'),

x_25: function(x_32) {
var
x_28,
x_3l = x_32.x_3m;
x_28 = {
x_7x: true, x_7w: x_3l,
x_7i: {
x_28: {
object: 'IpServiceManager',
method: 'get'
},
x_68: 'services'
},
x_7y: false, x_2e: x_3l.x_1u7
};
kerio.lib.x_5l.x_5m({
x_5g: 'selectItems',
x_n: 'x_8t',
x_28: x_28
});
}},
{	x_23: x_x('Add port…', 'trafficRuleEditor'),

x_25: function(x_32) {
kerio.lib.x_5l.x_5m({
x_5g: 'trafficPortEditor',
x_n: 'x_1u0',
x_28: {
x_5d: x_32.x_3m
}
});
}},
{	x_1j: 'x_4n',
x_31: true,
x_23: x_x('Remove', 'common'),

x_25: function(x_32) {
x_32.x_3m.x_70();
}}
],
x_4c: function(x_4d, x_4e) {
var
x_81 = kerio.lib.x_6b.x_6d,
x_4k = x_81.x_6e,
x_4i = x_81.x_6f,
x_cf,
x_4j;
if (x_4d instanceof kerio.lib.x_4g) {
x_cf = (0 !== x_4d.x_3v.x_46);
if (x_4d.x_16.x_1ch) {
x_cf = false;
}
switch (x_4e.x_1f) {
case x_4k.x_4l:
this.x_3b('x_4n', x_cf);
break; case x_4k.x_4p:
x_4j = x_4e.x_4q.keyCode;
if (x_cf &&
((x_4i.x_4r === x_4j) || (x_4i.x_4s === x_4j))) {
this.x_3m.x_70();
}
break; }
}
} };x_32 = new x_1b.x_37(x_n + '_' + 'x_1uc' + '_' + 'x_1ud', x_4u);
x_5o = {
x_8p: x_x('Any service', 'trafficRuleEditor'),
x_1p: 'policyGrid',
x_5v: {
x_83: x_32
},x_5x: {
x_d2: {
x_7s: 'sortBy'
},
x_1e: [
{	x_7s: 'sortHash',
x_1m: true,
x_gn: true,

x_7u: function(x_1o, x_47) {
var
x_19p = '',
x_1eo;
if ('x_ch' !== x_1o) {
if (x_47.definedService) {
x_19p += '0' + '-' + x_47.service.name;
} else {
x_1eo = x_47.port.ports;
x_19p += 	'1' + '-' +
x_fa.x_1gn[x_47.protocol].x_23 +
'-' + this.x_1u8(x_1eo[0])
+ (x_1eo[0] ? this.x_1u8(x_1eo[0]) : '');
}
x_47.sortBy = x_19p;
}
return {
x_47: ''
};
}},
{	x_7s: 'sortBy',
x_7t: true},
{	x_7s: 'definedService',
x_7t: true},
{	x_7s: 'service',
x_7t: true},
{	x_7s: 'protocol',
x_7t: true},
{	x_7s: 'port',
x_7t: true},
{	x_7s: 'item',
x_cs: false,
x_23: x_x('Item', 'common'),

x_7u: function(x_1o, x_47) {
if (this.x_16.x_1ch) {
return {
x_47: this.x_2p.x_5d.x_vr.x_1rw,
x_cy: 'serviceIcon objectNothing'
};
}
return this.x_1rl(x_47, this.x_2p.x_5d);}}
]
},
x_61: function(x_3l, x_eo) {
if (x_eo.definedService || x_3l.x_16.x_1ch) {
return;
}
kerio.lib.x_5l.x_5m({
x_5g: 'trafficPortEditor',
x_n: 'x_1ue',
x_28: {
x_47: x_eo,
x_5d: x_3l
}
});
}};x_3l = new x_1b.x_4g(x_2w + 'x_1uc', x_5o);
x_3l.x_27(
{	x_1rl: '',
x_1u7: x_1u7,
x_1u5: {
definedService: false,
service: {
id: '',
name: '',
invalid: false
},
protocol: 0,
port: {
comparator: 0,
ports: []
}
}
}
);x_10 = {
x_1u: 400,
x_1v: 350,
x_1y: x_x('Traffic Policy - Service/Port', 'trafficRuleEditor'),
x_1x: x_3l,

x_mc: function(x_32) {
x_32.x_16.x_iy();
} };x_10 = new x_fa.x_md(x_10);
x_16 = new x_1b.x_26(this.x_ga, x_10);
x_16.x_27(
{	x_3l: x_3l,
x_5d: {},
x_o5: {},
x_1ch: false
}
);x_3l.x_27(
{	x_16: x_16,
x_1u8: x_1u8
}
);this.x_2a(x_16);
x_4k = x_1b.x_6b.x_6d.x_6e;
x_1b.x_6o(x_3l, x_32, [x_4k.x_4p, x_4k.x_4l]);
return x_16;
}, 
x_2a: function(x_2b) {

x_2b.x_2c = function(x_28){
var
x_47;
x_47 = x_28.x_47.service;
this.x_o5 = x_28.x_47;
this.x_1ch = (x_r.x_1rt.x_1sl === x_47.type);
this.x_5d = x_28.x_5d;
this.x_3l.x_1rl = this.x_5d.x_1rl;
if (!this.x_1ch) {
this.x_3l.x_7k(x_47.entries);
} else {
this.x_3l.x_7k([{sortHash: 'x_ch'}]);
}
this.x_3l.x_dy();
};
x_2b.x_iy = function() {
var
x_47 = this.x_3l.x_7i(),
x_1f,
x_1uf,
x_41, x_42;
if (!this.x_1ch) {
if (0 === x_47.length) {
x_1f = x_r.x_1rt.x_1f0;
} else {
x_1f = x_r.x_1rt.x_1ru;
for (x_41 = 0, x_42 = x_47.length; x_41 < x_42; x_41++) {
delete x_47[x_41].sortBy;
delete x_47[x_41].sortHash;
}
}
this.x_o5.service = {
type: x_1f,
entries: x_47
};
this.x_5d.x_hg();
}this.x_24(false);
this.x_2r();
kerio.waw.status.x_14.x_15(true);
};
x_2b.x_1u6 = function(x_gk, x_1u3) {
var
x_z1 = true,
x_3l = this.x_3l,
x_uy = [],
x_dr = [],
x_1ug,
x_41, x_42,
x_1uh;
x_1u3 = (x_1u3 ? true : false);
if (!this.x_1ch) {
x_dr = x_3l.x_7i();
}
if (x_1u3) {
x_1ug = this.x_1ui;
} else {
x_1ug = this.x_1uj;
}
for (x_41 = 0, x_42 = x_dr.length; x_41 < x_42; x_41++) {
x_1uh = x_dr[x_41];
if (x_1uh.definedService === x_1u3) {
x_uy.push(x_1uh);
}
}
for (x_41 = 0, x_42 = x_gk.length; x_41 < x_42; x_41++) {
x_1uh = x_gk[x_41];
if (x_1ug(x_1uh, x_uy)) {
x_dr.push(x_1uh);
}
}
if (0 !== x_dr.length) {
this.x_1ch = false;
}
x_3l.x_7k(x_dr);
x_3l.x_dy();
};
x_2b.x_1ui = function(x_1uk, x_47) {
var
x_1j,
x_41, x_42;
x_1j = x_1uk.service.id;
for (x_41 = 0, x_42 = x_47.length; x_41 < x_42; x_41++) {
if (x_1j === x_47[x_41].service.id) {
return false;
}
}
return true;
};
x_2b.x_1uj = function(x_1ul, x_47) {
var
x_17y,
x_1uh,
x_1um,
x_1er,
x_41, x_42;
x_1er = x_1ul.protocol;
x_17y = x_1ul.port;
for (x_41 = 0, x_42 = x_47.length; x_41 < x_42; x_41++) {
x_1um = x_47[x_41].protocol;
x_1uh = x_47[x_41].port;
if (x_1er === x_1um
&& x_17y.comparator === x_1uh.comparator
&& x_17y.ports[0] === x_1uh.ports[0] && x_17y.ports[1] === x_1uh.ports[1]) {
return false;
}
}
return true;
};}
}; 