@gudhub/core 1.1.13 → 1.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -136,7 +136,7 @@ export function compiler(scheme, item, util, variables) {
136
136
 
137
137
  async function getFilteredItems(filtersList, element_app_id, app_id, item_id, itemsList) {
138
138
  const modified_filters_list = await util.gudhub.prefilter(
139
- filtersList,
139
+ JSON.parse(JSON.stringify(filtersList)),
140
140
  element_app_id,
141
141
  app_id,
142
142
  item_id,
@@ -17,6 +17,15 @@ describe("JSON CONSTRUCTOR", function () {
17
17
  json.fishtank[0].should.have.property("url","https://google.com,https://test.com");
18
18
  json.fishtank[0].should.have.property("notes","https://gudhub.com/userdata/16259/811770.html?timestamp=0");
19
19
  });
20
+ it("GET FILTERED ITEMS LENGTH WITH CURRENT ITEM FILTER", async function () {
21
+ let json = await gudhub.jsonConstructor(currentItemScheme);
22
+ let firstLength = json.scheme[0].array.length;
23
+ let secondLength = json.scheme[1].array.length;
24
+
25
+ firstLength.should.equal("4");
26
+ secondLength.should.equal("8");
27
+
28
+ });
20
29
  });
21
30
 
22
31
  var fishtank_scheme = {
@@ -68,3 +77,56 @@ var fishtank_scheme = {
68
77
  app_id: "16259",
69
78
  filter: [],
70
79
  };
80
+
81
+ let currentItemScheme = {
82
+ type: "array",
83
+ id: 1,
84
+ childs: [
85
+ {
86
+ type: "property",
87
+ id: 3,
88
+ property_name: "value",
89
+ property_type: "field_value",
90
+ field_id: "254056",
91
+ interpretation: 1,
92
+ },
93
+ {
94
+ type: "property",
95
+ id: 4,
96
+ property_name: "image",
97
+ property_type: "field_value",
98
+ field_id: "551380",
99
+ interpretation: 1,
100
+ },
101
+ {
102
+ type: "array",
103
+ id: 2,
104
+ childs: [
105
+ {
106
+ type: "property",
107
+ id: 5,
108
+ property_name: "date",
109
+ property_type: "field_value",
110
+ field_id: "1455",
111
+ interpretation: 1,
112
+ },
113
+ ],
114
+ property_name: "array",
115
+ app_id: "214",
116
+ filter: [
117
+ {
118
+ field_id: 254058,
119
+ data_type: "item_ref",
120
+ valuesArray: [],
121
+ search_type: "equal_or",
122
+ selected_search_option_variable: "Variable",
123
+ input_type: "variable",
124
+ input_value: "current_item",
125
+ },
126
+ ],
127
+ },
128
+ ],
129
+ property_name: "scheme",
130
+ app_id: "16259",
131
+ filter: [],
132
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gudhub/core",
3
- "version": "1.1.13",
3
+ "version": "1.1.14",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -34,9 +34,11 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "express": "^4.17.1",
37
+ "jsdom": "^20.0.0",
37
38
  "mocha": "^8.1.2",
38
39
  "parcel-bundler": "^1.12.5",
39
- "should": "^13.2.3"
40
+ "should": "^13.2.3",
41
+ "sinon": "^14.0.0"
40
42
  },
41
43
  "type": "module",
42
44
  "publishConfig": {
@@ -167,9 +167,9 @@ var e,t=arguments[3],n=require("process");!function(n){if("object"==typeof expor
167
167
  },{}],"xR4c":[function(require,module,exports) {
168
168
  "use strict";function e(){return'function createList(items) {\n return items.reduce(\n (acc, item) => {\n acc.list[item.item_id] = item;\n acc.ids.push(item.item_id);\n return acc;\n },\n { ids: [], list: {} }\n );\n };\n function compareItemsLists(oldItems, newItems) {\n const { ids: oldIds, list: oldList } = createList(oldItems);\n const { ids: newIds, list: newList } = createList(newItems);\n\n const deletedItemsIds = oldIds.filter((id) => !newIds.includes(id));\n const recentItemsIds = oldIds.filter((id) => !deletedItemsIds.includes(id));\n const newItemsIds = newIds.filter((id) => !oldIds.includes(id));\n\n const diff_fields_items = {};\n const diff_fields_items_Ids = [];\n \n recentItemsIds.forEach((id) => {\n const newItem = newList[id];\n const oldItem = oldList[id];\n\n oldItem.fields.forEach((field1) => {\n const sameField = newItem.fields.find(\n (field2) => Number(field2.field_id) === Number(field1.field_id)\n );\n\n if (!sameField) {\n if (!diff_fields_items[newItem.item_id]) {\n diff_fields_items[newItem.item_id] = [];\n diff_fields_items_Ids.push(newItem.item_id);\n }\n\n return diff_fields_items[newItem.item_id].push(field1);\n }\n\n if (field1.field_value != sameField.field_value) {\n if (!diff_fields_items[newItem.item_id]) {\n diff_fields_items[newItem.item_id] = [];\n diff_fields_items_Ids.push(newItem.item_id);\n }\n return diff_fields_items[newItem.item_id].push(field1);\n }\n });\n });\n\n return {\n newItems: newItemsIds.reduce((acc, id) => {\n acc.push(newList[id]);\n return acc;\n }, []),\n deletedItems: deletedItemsIds.reduce((acc, id) => {\n acc.push(oldList[id]);\n return acc;\n }, []),\n diff_fields_items_Ids,\n diff_fields_items,\n diff_items: diff_fields_items_Ids.reduce((acc, id) => {\n acc.push(oldList[id]);\n return acc;\n }, []),\n };\n }\n\n self.addEventListener("message", (event) => {\n const { items_list1, items_list2 } = event.data;\n\n const diff = compareItemsLists(items_list1, items_list2);\n self.postMessage({ diff });\n });'}Object.defineProperty(exports,"__esModule",{value:!0}),exports.compare_items_lists_Worker=e;
169
169
  },{}],"nKaW":[function(require,module,exports) {
170
- "use strict";function e(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function r(r){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?e(Object(n),!0).forEach(function(e){c(r,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))})}return r}function t(e){return a(e)||i(e)||u(e)||n()}function n(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,r){if(e){if("string"==typeof e)return o(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(e,r):void 0}}function i(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function a(e){if(Array.isArray(e))return o(e)}function o(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function c(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function s(e,r,t,n,u,i,a){try{var o=e[i](a),c=o.value}catch(s){return void t(s)}o.done?r(c):Promise.resolve(c).then(n,u)}function p(e){return function(){var r=this,t=arguments;return new Promise(function(n,u){var i=e.apply(r,t);function a(e){s(i,n,u,a,o,"next",e)}function o(e){s(i,n,u,a,o,"throw",e)}a(void 0)})}}function f(e,n,u,i){function a(e,r,t){return o.apply(this,arguments)}function o(){return(o=p(regeneratorRuntime.mark(function e(r,t,n){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(u=null,"array"!==r.type){e.next=13;break}if(!Number(r.is_static)){e.next=10;break}return e.t0=Array,e.next=6,b(r.childs,t,n);case 6:e.t1=e.sent,u=new e.t0(e.t1),e.next=13;break;case 10:return e.next=12,s(r,t,n);case 12:u=e.sent;case 13:if("object"!==r.type){e.next=23;break}if(!Number(r.current_item)){e.next=20;break}return e.next=17,l(r,t);case 17:u=e.sent,e.next=23;break;case 20:return e.next=22,b(r.childs,t,n);case 22:u=e.sent;case 23:if("property"!==r.type){e.next=27;break}return e.next=26,y(r,t,n);case 26:u=e.sent;case 27:return e.abrupt("return",c({},r.property_name,u));case 28:case"end":return e.stop()}},e)}))).apply(this,arguments)}function s(e,r,t){return f.apply(this,arguments)}function f(){return(f=p(regeneratorRuntime.mark(function e(r,n,i){var a,o,c,s,f;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.gudhub.getApp(Number(r.app_id));case 2:return a=e.sent,e.next=5,g(r.filter,a.items_list,i,n);case 5:return o=e.sent,r.isSortable&&r.field_id_to_sort&&""!==r.field_id_to_sort&&(c=o.flatMap(function(e){var t=e.fields.find(function(e){return e.field_id==r.field_id_to_sort});return t&&""!=t.field_value?e:[]}),s=o.filter(function(e){if(!c.includes(e))return e}),c=c.sort(function(e,t){return"desc"==r.sortType?t.fields.find(function(e){return e.field_id==r.field_id_to_sort}).field_value-e.fields.find(function(e){return e.field_id==r.field_id_to_sort}).field_value:e.fields.find(function(e){return e.field_id==r.field_id_to_sort}).field_value-t.fields.find(function(e){return e.field_id==r.field_id_to_sort}).field_value}),o=[].concat(t(c),t(s))),f=o.map(function(){var e=p(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",b(r.childs,t,a));case 1:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}()),e.abrupt("return",Promise.all(f));case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}function l(e,r){return d.apply(this,arguments)}function d(){return(d=p(regeneratorRuntime.mark(function e(r,t){var n,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.gudhub.getApp(r.app_id);case 2:return n=e.sent,i=n.items_list||[],e.abrupt("return",b(r.childs,t||i[0],n));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function b(e,r,t){return m.apply(this,arguments)}function m(){return(m=p(regeneratorRuntime.mark(function e(t,n,u){var i,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.map(function(){var e=p(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",a(r,n,u));case 1:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}());case 2:return i=e.sent,e.next=5,Promise.all(i);case 5:return o=e.sent,e.abrupt("return",o.reduce(function(e,t){return r(r({},e),t)},{}));case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function y(e,r,t){return _.apply(this,arguments)}function _(){return(_=p(regeneratorRuntime.mark(function e(r,n,i){var a,o,c,s,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=r.property_type,e.next="static"===e.t0?3:"variable"===e.t0?4:"field_id"===e.t0?9:"function"===e.t0?10:(e.t0,20);break;case 3:return e.abrupt("return",r.static_field_value);case 4:e.t1=r.variable_type,e.next="app_id"===e.t1?7:(e.t1,8);break;case 7:return e.abrupt("return",i.app_id);case 8:return e.abrupt("return","".concat(i.app_id,".").concat(n.item_id));case 9:return e.abrupt("return",r.field_id);case 10:if("function"!=typeof r.function){e.next=15;break}return a=r.function.apply(r,[n,i].concat(t(r.args))),e.abrupt("return",a);case 15:return o=new Function("item, app","return (async "+r.function+")(item, app)"),e.next=18,o(n,i);case 18:return c=e.sent,e.abrupt("return",c);case 20:if(!Boolean(Number(r.interpretation))){e.next=27;break}return e.next=23,u.gudhub.getInterpretationById(Number(i.app_id),Number(n.item_id),Number(r.field_id),"value");case 23:return s=e.sent,e.abrupt("return",s);case 27:return e.next=29,u.gudhub.getFieldValue(Number(i.app_id),Number(n.item_id),Number(r.field_id));case 29:return p=e.sent,e.abrupt("return",p);case 31:case"end":return e.stop()}},e)}))).apply(this,arguments)}function h(e,r,t,n,u){return v.apply(this,arguments)}function v(){return(v=p(regeneratorRuntime.mark(function e(r,n,a,o,c){var s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.gudhub.prefilter(r,n,a,o,i);case 2:return s=e.sent,e.abrupt("return",u.gudhub.filter(c,[].concat(t(s),t(r))));case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}function g(){return x.apply(this,arguments)}function x(){return(x=p(regeneratorRuntime.mark(function e(){var r,n,u,i,a=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>0&&void 0!==a[0]?a[0]:[],n=a.length>1&&void 0!==a[1]?a[1]:[],u=a.length>2&&void 0!==a[2]?a[2]:{},i=a.length>3&&void 0!==a[3]?a[3]:{},e.abrupt("return",r.length?h(r,u.app_id,u.app_id,i.item_id,n):t(n));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}return a(e,n)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.compiler=f;
170
+ "use strict";function e(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function r(r){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?e(Object(n),!0).forEach(function(e){c(r,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))})}return r}function t(e){return a(e)||i(e)||u(e)||n()}function n(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,r){if(e){if("string"==typeof e)return o(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(e,r):void 0}}function i(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function a(e){if(Array.isArray(e))return o(e)}function o(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function c(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function s(e,r,t,n,u,i,a){try{var o=e[i](a),c=o.value}catch(s){return void t(s)}o.done?r(c):Promise.resolve(c).then(n,u)}function p(e){return function(){var r=this,t=arguments;return new Promise(function(n,u){var i=e.apply(r,t);function a(e){s(i,n,u,a,o,"next",e)}function o(e){s(i,n,u,a,o,"throw",e)}a(void 0)})}}function f(e,n,u,i){function a(e,r,t){return o.apply(this,arguments)}function o(){return(o=p(regeneratorRuntime.mark(function e(r,t,n){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(u=null,"array"!==r.type){e.next=13;break}if(!Number(r.is_static)){e.next=10;break}return e.t0=Array,e.next=6,b(r.childs,t,n);case 6:e.t1=e.sent,u=new e.t0(e.t1),e.next=13;break;case 10:return e.next=12,s(r,t,n);case 12:u=e.sent;case 13:if("object"!==r.type){e.next=23;break}if(!Number(r.current_item)){e.next=20;break}return e.next=17,l(r,t);case 17:u=e.sent,e.next=23;break;case 20:return e.next=22,b(r.childs,t,n);case 22:u=e.sent;case 23:if("property"!==r.type){e.next=27;break}return e.next=26,y(r,t,n);case 26:u=e.sent;case 27:return e.abrupt("return",c({},r.property_name,u));case 28:case"end":return e.stop()}},e)}))).apply(this,arguments)}function s(e,r,t){return f.apply(this,arguments)}function f(){return(f=p(regeneratorRuntime.mark(function e(r,n,i){var a,o,c,s,f;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.gudhub.getApp(Number(r.app_id));case 2:return a=e.sent,e.next=5,g(r.filter,a.items_list,i,n);case 5:return o=e.sent,r.isSortable&&r.field_id_to_sort&&""!==r.field_id_to_sort&&(c=o.flatMap(function(e){var t=e.fields.find(function(e){return e.field_id==r.field_id_to_sort});return t&&""!=t.field_value?e:[]}),s=o.filter(function(e){if(!c.includes(e))return e}),c=c.sort(function(e,t){return"desc"==r.sortType?t.fields.find(function(e){return e.field_id==r.field_id_to_sort}).field_value-e.fields.find(function(e){return e.field_id==r.field_id_to_sort}).field_value:e.fields.find(function(e){return e.field_id==r.field_id_to_sort}).field_value-t.fields.find(function(e){return e.field_id==r.field_id_to_sort}).field_value}),o=[].concat(t(c),t(s))),f=o.map(function(){var e=p(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",b(r.childs,t,a));case 1:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}()),e.abrupt("return",Promise.all(f));case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}function l(e,r){return d.apply(this,arguments)}function d(){return(d=p(regeneratorRuntime.mark(function e(r,t){var n,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.gudhub.getApp(r.app_id);case 2:return n=e.sent,i=n.items_list||[],e.abrupt("return",b(r.childs,t||i[0],n));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function b(e,r,t){return m.apply(this,arguments)}function m(){return(m=p(regeneratorRuntime.mark(function e(t,n,u){var i,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.map(function(){var e=p(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",a(r,n,u));case 1:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}());case 2:return i=e.sent,e.next=5,Promise.all(i);case 5:return o=e.sent,e.abrupt("return",o.reduce(function(e,t){return r(r({},e),t)},{}));case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function y(e,r,t){return _.apply(this,arguments)}function _(){return(_=p(regeneratorRuntime.mark(function e(r,n,i){var a,o,c,s,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=r.property_type,e.next="static"===e.t0?3:"variable"===e.t0?4:"field_id"===e.t0?9:"function"===e.t0?10:(e.t0,20);break;case 3:return e.abrupt("return",r.static_field_value);case 4:e.t1=r.variable_type,e.next="app_id"===e.t1?7:(e.t1,8);break;case 7:return e.abrupt("return",i.app_id);case 8:return e.abrupt("return","".concat(i.app_id,".").concat(n.item_id));case 9:return e.abrupt("return",r.field_id);case 10:if("function"!=typeof r.function){e.next=15;break}return a=r.function.apply(r,[n,i].concat(t(r.args))),e.abrupt("return",a);case 15:return o=new Function("item, app","return (async "+r.function+")(item, app)"),e.next=18,o(n,i);case 18:return c=e.sent,e.abrupt("return",c);case 20:if(!Boolean(Number(r.interpretation))){e.next=27;break}return e.next=23,u.gudhub.getInterpretationById(Number(i.app_id),Number(n.item_id),Number(r.field_id),"value");case 23:return s=e.sent,e.abrupt("return",s);case 27:return e.next=29,u.gudhub.getFieldValue(Number(i.app_id),Number(n.item_id),Number(r.field_id));case 29:return p=e.sent,e.abrupt("return",p);case 31:case"end":return e.stop()}},e)}))).apply(this,arguments)}function h(e,r,t,n,u){return v.apply(this,arguments)}function v(){return(v=p(regeneratorRuntime.mark(function e(r,n,a,o,c){var s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.gudhub.prefilter(JSON.parse(JSON.stringify(r)),n,a,o,i);case 2:return s=e.sent,e.abrupt("return",u.gudhub.filter(c,[].concat(t(s),t(r))));case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}function g(){return x.apply(this,arguments)}function x(){return(x=p(regeneratorRuntime.mark(function e(){var r,n,u,i,a=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>0&&void 0!==a[0]?a[0]:[],n=a.length>1&&void 0!==a[1]?a[1]:[],u=a.length>2&&void 0!==a[2]?a[2]:{},i=a.length>3&&void 0!==a[3]?a[3]:{},e.abrupt("return",r.length?h(r,u.app_id,u.app_id,i.item_id,n):t(n));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}return a(e,n)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.compiler=f;
171
171
  },{}],"zqOZ":[function(require,module,exports) {
172
- "use strict";function e(e,n,i,t,a,r,o){try{var c=e[r](o),p=c.value}catch(u){return void i(u)}c.done?n(p):Promise.resolve(p).then(t,a)}function n(n){return function(){var i=this,t=arguments;return new Promise(function(a,r){var o=n.apply(i,t);function c(n){e(o,a,r,c,p,"next",n)}function p(n){e(o,a,r,c,p,"throw",n)}c(void 0)})}}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function t(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function a(e,n){for(var i=0;i<n.length;i++){var t=n[i];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}function r(e,n,i){return n&&a(e.prototype,n),i&&a(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var o=function(){function e(n){t(this,e),this.gudhub=n,this.appsConnectingMap={apps:[],fields:[],items:[],views:[]}}return r(e,[{key:"createAppsFromTemplate",value:function(e,n,t){var a=this,r=this;return new Promise(function(o){var c=100/(6*e.apps.length),p=0;r.createApps(e,function(e){p+=1,t.call(a,{percent:p*c,status:e})}).then(function(e){r.createItems(e,n,function(e){"string"==typeof e?(p+=1,t.call(a,{percent:p*c,status:e})):"object"===i(e)&&t.call(a,{status:"Done",apps:e})}).then(function(){o()})})})}},{key:"createItems",value:function(e,n,i){var t=this;return new Promise(function(a){var r=n||1e5,o=t,c=[],p=[];e.forEach(function(e){p.push(new Promise(function(n){o.gudhub.getApp(o._searchOldAppId(e.app_id,o.appsConnectingMap.apps)).then(function(a){i&&i.call(t,"GET APP: ".concat(a.app_name," (Items steps)"));var p=JSON.parse(JSON.stringify(a)),u=p.items_list.map(function(e){return{index_number:e.index_number,item_id:0,fields:[]}}).filter(function(e,n){return n<=r});o.gudhub.addNewItems(e.app_id,u).then(function(r){i&&i.call(t,"ADD NEW ITEMS: ".concat(a.app_name," (Items steps)")),0===r.length&&(i&&i.call(t,"NO ITEMS TO REPLACE VALUE: ".concat(a.app_name," (Items steps)")),n()),e.items_list=r,o._updateMap(e.items_list,p.items_list),o._addFieldValue(p.items_list,e.items_list,o.appsConnectingMap),c.push(e),o.appsConnectingMap.apps.length===c.length&&(c.forEach(function(e){e.items_list.forEach(function(e){e.fields.forEach(function(e){o.appsConnectingMap.fields.forEach(function(n){e.field_id===n.old_field_id&&(e.field_id=n.new_field_id,e.element_id=n.new_field_id)})})})}),o.deleteField(c),o.replaceValue(c,o.appsConnectingMap).then(function(){i&&i.call(t,"REPLACE VALUE: ".concat(a.app_name," (Items steps)")),c.forEach(function(e){var i=e.items_list.map(function(e){return e.fields.forEach(function(e){delete e.data_id}),e});o.gudhub.updateItems(e.app_id,i).then(function(){n()})})}))})})}))}),Promise.all(p).then(function(){var n=e.map(function(e){return e.app_id});i.call(t,n),a()})})}},{key:"deleteField",value:function(e){e.forEach(function(e){e.items_list.forEach(function(n){n.fields=n.fields.filter(function(n){return e.field_list.findIndex(function(e){return e.field_id==n.field_id})>-1})})})}},{key:"replaceValue",value:function(e,i){var t=this;return new Promise(function(){var a=n(regeneratorRuntime.mark(function n(a){var r,o;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:r=[],o=t,e.forEach(function(e){e.field_list.forEach(function(n){"item_ref"===n.data_type&&o._replaceValueItemRef(e,n,i),r.push(o.gudhub.ghconstructor.getInstance(n.data_type).then(function(i){return"file"==i.getTemplate().constructor?o.gudhub.util.fileInstallerHelper(e.app_id,e.items_list,n.field_id).then(function(e){return e}):"document"!=i.getTemplate().constructor?i:void o.documentInstallerHelper(e.app_id,e.items_list,n.field_id).then(function(e){return i})}))})}),r.length>0?Promise.all(r).then(function(e){a(e)}):a(result);case 4:case"end":return n.stop()}},n)}));return function(e){return a.apply(this,arguments)}}())}},{key:"documentInstallerHelper",value:function(e,i,t){var a=this;return new Promise(function(){var r=n(regeneratorRuntime.mark(function n(r){return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:i.forEach(function(n){var i=n.item_id,o=n.fields.find(function(e){return e.element_id===t});o&&o.field_value&&o.field_value.length>0&&a.gudhub.getDocument({_id:o.field_value}).then(function(n){a.gudhub.createDocument({app_id:e,item_id:i,element_id:t,data:n.data}).then(function(e){o.field_value=e._id,r()})})});case 1:case"end":return n.stop()}},n)}));return function(e){return r.apply(this,arguments)}}())}},{key:"_replaceValueItemRef",value:function(e,n,i){e.items_list.forEach(function(e){e.fields.forEach(function(e){if(e.field_id===n.field_id&&e.field_value){var t=e.field_value.split(",");t.forEach(function(e,n){var a=e.split(".");i.apps.forEach(function(e){a[0]==e.old_app_id&&(a[0]=e.new_app_id)}),i.items.forEach(function(e){a[1]==e.old_item_id&&(a[1]=e.new_item_id)}),t[n]=a.join(".")}),e.field_value=t.join(",")}})})}},{key:"_addFieldValue",value:function(e,n,i){n.forEach(function(n){i.items.forEach(function(i){n.item_id===i.new_item_id&&e.forEach(function(e){i.old_item_id===e.item_id&&(n.fields=e.fields)})})})}},{key:"_updateMap",value:function(e,n){var i=this;n.forEach(function(n){e.forEach(function(e){n.index_number===e.index_number&&i.appsConnectingMap.items.push({old_item_id:n.item_id,new_item_id:e.item_id})})})}},{key:"_searchOldAppId",value:function(e,n){var i=0;return n.forEach(function(n){n.new_app_id===e&&(i=n.old_app_id)}),i}},{key:"createApps",value:function(e,n){var i=this,t=this,a={step_size:100/(3*e.apps.length),apps:[]};return new Promise(function(r){var o={},c=[],p=[];e.apps.forEach(function(u){t.gudhub.getApp(u).then(function(u){n&&n.call(i,"GET APP: ".concat(u.app_name," (App steps)"));var f=JSON.parse(JSON.stringify(u));o[f.app_id]=f,a.apps.push(f.icon);var l=t.prepareAppTemplate(f);l.app_name=l.app_name+" New",l.privacy=1,t.resetViewsIds(l),t.gudhub.createNewApp(l).then(function(a){n&&n.call(i,"CREATE NEW APP: ".concat(u.app_name," (App steps)")),c.push(a),t.mapApp(f,a,t.appsConnectingMap),e.apps.length==c.length&&(t.connectApps(c,t.appsConnectingMap,o),c.forEach(function(a){t.gudhub.updateApp(a).then(function(t){n&&n.call(i,"UPDATE APP: ".concat(u.app_name," (App steps)")),p.push(t),e.apps.length==p.length&&r(p)})}))})})})})}},{key:"mapApp",value:function(e,n,i){i.apps.push({old_app_id:e.app_id,new_app_id:n.app_id,old_view_init:e.view_init,new_view_init:n.view_init}),e.field_list.forEach(function(e){n.field_list.forEach(function(n){e.name_space==n.name_space&&i.fields.push({name_space:e.name_space,old_field_id:e.field_id,new_field_id:n.field_id})})}),e.views_list.forEach(function(e){n.views_list.forEach(function(n){e.name==n.name&&i.views.push({name:e.name,old_view_id:e.view_id,new_view_id:n.view_id})})})}},{key:"crawling",value:function(e,n){var i=null===e?[]:Object.keys(e),t=this;i.length>0&&i.forEach(function(i){var a=e[i];void 0!==a&&"string"!=typeof e&&(n(i,a,e),t.crawling(a,n))})}},{key:"resetViewsIds",value:function(e){e.view_init=0,this.crawling(e.views_list,function(e,n,i){"view_id"!=e&&"container_id"!=e||(i[e]=0)})}},{key:"connectApps",value:function(e,n,i){var t=this;return e.forEach(function(e){n.apps.forEach(function(i){e.view_init===i.new_view_init&&n.views.forEach(function(n){i.old_view_init===n.old_view_id&&(e.view_init=n.new_view_id)})}),t.crawling(e.field_list,function(a,r,o){if(-1!==a.indexOf("field_id")||-1!==a.indexOf("FieldId")||-1!==a.indexOf("destination_field")){var c=String(r).split(","),p=[];n.fields.forEach(function(e){c.forEach(function(n){n==e.old_field_id&&p.push(e.new_field_id)})}),p.length&&(o[a]=p.join(","))}if(-1==a.indexOf("app_id")&&-1==a.indexOf("AppId")&&-1==a.indexOf("destination_app")||n.apps.forEach(function(e){r==e.old_app_id&&(o[a]=e.new_app_id)}),-1!==a.indexOf("view_id")&&n.views.forEach(function(e){r==e.old_view_id&&(o[a]=e.new_view_id)}),-1!==a.indexOf("src")&&isFinite(r)){var u=n.apps.find(function(n){return n.new_app_id===e.app_id}).old_app_id,f=t.findPath(i[u].views_list,"container_id",r);o[a]="".concat(t.getValueByPath(e.views_list,f,"container_id"))}})}),e}},{key:"getValueByPath",value:function(e,n,i){var t=e;return n.split(".").forEach(function(e){t=t[e]}),t[i]}},{key:"findPath",value:function(e,n,t){var a=!1,r=!1,o=[];return this.crawling(e,function(e,c,p){r&&o.reverse().forEach(function(e){r&&(e.delete=!0,e.parent===p&&(r=!1,(o=o.filter(function(e){return!e.delete})).reverse()))}),a||("object"===i(p[e])&&o.push({prop:e,parent:p}),c==t&&n===e?a=!0:Object.keys(p).pop()===e&&"object"!==i(p[e])&&(r=!0))}),o.map(function(e){return e.prop}).join(".")}},{key:"prepareAppTemplate",value:function(e){var n=JSON.parse(JSON.stringify(e));return this.crawling(n.views_list,function(e,n,i){"element_id"==e&&(i.element_id=-Number(n),i.create_element=-Number(n))}),n.field_list.forEach(function(e){e.create_field=-Number(e.field_id),e.element_id=-Number(e.field_id),e.field_id=-Number(e.field_id),e.field_value=""}),n.items_list=[],delete n.app_id,delete n.icon.id,delete n.group_id,delete n.trash,delete n.last_update,delete n.file_list,n}}]),e}();exports.default=o;
172
+ "use strict";function e(e,n,i,t,a,o,r){try{var p=e[o](r),c=p.value}catch(u){return void i(u)}p.done?n(c):Promise.resolve(c).then(t,a)}function n(n){return function(){var i=this,t=arguments;return new Promise(function(a,o){var r=n.apply(i,t);function p(n){e(r,a,o,p,c,"next",n)}function c(n){e(r,a,o,p,c,"throw",n)}p(void 0)})}}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function t(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function a(e,n){for(var i=0;i<n.length;i++){var t=n[i];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}function o(e,n,i){return n&&a(e.prototype,n),i&&a(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var r=function(){function e(n){t(this,e),this.gudhub=n,this.appsConnectingMap={apps:[],fields:[],items:[],views:[]}}return o(e,[{key:"createAppsFromTemplate",value:function(e,n,t){var a=this,o=this;return new Promise(function(r){var p=100/(6*e.apps.length),c=0;o.createApps(e,function(e){c+=1,t.call(a,{percent:c*p,status:e})}).then(function(e){o.createItems(e,n,function(e){"string"==typeof e?(c+=1,t.call(a,{percent:c*p,status:e})):"object"===i(e)&&t.call(a,{status:"Done",apps:e})}).then(function(){r()})})})}},{key:"createItems",value:function(e,n,i){var t=this;return new Promise(function(a){var o=n||1e5,r=t,p=[],c=[];e.forEach(function(e){c.push(new Promise(function(n){r.gudhub.getApp(r._searchOldAppId(e.app_id,r.appsConnectingMap.apps)).then(function(a){i&&i.call(t,"GET APP: ".concat(a.app_name," (Items steps)"));var c=JSON.parse(JSON.stringify(a)),u=c.items_list.map(function(e){return{index_number:e.index_number,item_id:0,fields:[]}}).filter(function(e,n){return n<=o});r.gudhub.addNewItems(e.app_id,u).then(function(o){i&&i.call(t,"ADD NEW ITEMS: ".concat(a.app_name," (Items steps)")),0===o.length&&(i&&i.call(t,"NO ITEMS TO REPLACE VALUE: ".concat(a.app_name," (Items steps)")),n()),e.items_list=o,r._updateMap(e.items_list,c.items_list),r._addFieldValue(c.items_list,e.items_list,r.appsConnectingMap),p.push(e),r.appsConnectingMap.apps.length===p.length&&(p.forEach(function(e){e.items_list.forEach(function(e){e.fields.forEach(function(e){r.appsConnectingMap.fields.forEach(function(n){e.field_id===n.old_field_id&&(e.field_id=n.new_field_id,e.element_id=n.new_field_id)})})})}),r.deleteField(p),r.replaceValue(p,r.appsConnectingMap).then(function(){i&&i.call(t,"REPLACE VALUE: ".concat(a.app_name," (Items steps)")),p.forEach(function(e){var i=e.items_list.map(function(e){return e.fields.forEach(function(e){delete e.data_id}),e});r.gudhub.updateItems(e.app_id,i).then(function(){n()})})}))})})}))}),Promise.all(c).then(function(){var n=e.map(function(e){return e.app_id});i.call(t,n),a()})})}},{key:"deleteField",value:function(e){e.forEach(function(e){e.items_list.forEach(function(n){n.fields=n.fields.filter(function(n){return e.field_list.findIndex(function(e){return e.field_id==n.field_id})>-1})})})}},{key:"replaceValue",value:function(e,i){var t=this;return new Promise(function(){var a=n(regeneratorRuntime.mark(function n(a){var o,r;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:o=[],r=t,e.forEach(function(e){e.field_list.forEach(function(n){"item_ref"===n.data_type&&r._replaceValueItemRef(e,n,i),o.push(new Promise(function(i){r.gudhub.ghconstructor.getInstance(n.data_type).then(function(t){return void 0===t?(console.log("ERROR WHILE GETTING INSTANCE OF ",n.data_type),void i({type:n.data_type})):"file"==t.getTemplate().constructor?r.gudhub.util.fileInstallerHelper(e.app_id,e.items_list,n.field_id).then(function(e){i(e)}):void("document"==t.getTemplate().constructor?r.documentInstallerHelper(e.app_id,e.items_list,n.field_id).then(function(e){i(t)}):i(t))})}))})}),o.length>0?Promise.all(o).then(function(e){a(e)}):a(result);case 4:case"end":return n.stop()}},n)}));return function(e){return a.apply(this,arguments)}}())}},{key:"documentInstallerHelper",value:function(e,i,t){var a=this;return new Promise(function(){var o=n(regeneratorRuntime.mark(function n(o){return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:i.forEach(function(n){var i=n.item_id,r=n.fields.find(function(e){return e.element_id===t});r&&r.field_value&&r.field_value.length>0&&a.gudhub.getDocument({_id:r.field_value}).then(function(n){a.gudhub.createDocument({app_id:e,item_id:i,element_id:t,data:n.data}).then(function(e){r.field_value=e._id,o()})})});case 1:case"end":return n.stop()}},n)}));return function(e){return o.apply(this,arguments)}}())}},{key:"_replaceValueItemRef",value:function(e,n,i){e.items_list.forEach(function(e){e.fields.forEach(function(e){if(e.field_id===n.field_id&&e.field_value){var t=e.field_value.split(",");t.forEach(function(e,n){var a=e.split(".");i.apps.forEach(function(e){a[0]==e.old_app_id&&(a[0]=e.new_app_id)}),i.items.forEach(function(e){a[1]==e.old_item_id&&(a[1]=e.new_item_id)}),t[n]=a.join(".")}),e.field_value=t.join(",")}})})}},{key:"_addFieldValue",value:function(e,n,i){n.forEach(function(n){i.items.forEach(function(i){n.item_id===i.new_item_id&&e.forEach(function(e){i.old_item_id===e.item_id&&(n.fields=e.fields)})})})}},{key:"_updateMap",value:function(e,n){var i=this;n.forEach(function(n){e.forEach(function(e){n.index_number===e.index_number&&i.appsConnectingMap.items.push({old_item_id:n.item_id,new_item_id:e.item_id})})})}},{key:"_searchOldAppId",value:function(e,n){var i=0;return n.forEach(function(n){n.new_app_id===e&&(i=n.old_app_id)}),i}},{key:"createApps",value:function(e,n){var i=this,t=this,a={step_size:100/(3*e.apps.length),apps:[]};return new Promise(function(o){var r={},p=[],c=[];e.apps.forEach(function(u){t.gudhub.getApp(u).then(function(u){n&&n.call(i,"GET APP: ".concat(u.app_name," (App steps)"));var l=JSON.parse(JSON.stringify(u));r[l.app_id]=l,a.apps.push(l.icon);var f=t.prepareAppTemplate(l);f.app_name=f.app_name+" New",f.privacy=1,t.resetViewsIds(f),t.gudhub.createNewApp(f).then(function(a){n&&n.call(i,"CREATE NEW APP: ".concat(u.app_name," (App steps)")),p.push(a),t.mapApp(l,a,t.appsConnectingMap),e.apps.length==p.length&&(t.connectApps(p,t.appsConnectingMap,r),p.forEach(function(a){t.gudhub.updateApp(a).then(function(t){n&&n.call(i,"UPDATE APP: ".concat(u.app_name," (App steps)")),c.push(t),e.apps.length==c.length&&o(c)})}))})})})})}},{key:"mapApp",value:function(e,n,i){i.apps.push({old_app_id:e.app_id,new_app_id:n.app_id,old_view_init:e.view_init,new_view_init:n.view_init}),e.field_list.forEach(function(e){n.field_list.forEach(function(n){e.name_space==n.name_space&&i.fields.push({name_space:e.name_space,old_field_id:e.field_id,new_field_id:n.field_id})})}),e.views_list.forEach(function(e){n.views_list.forEach(function(n){e.name==n.name&&i.views.push({name:e.name,old_view_id:e.view_id,new_view_id:n.view_id})})})}},{key:"crawling",value:function(e,n){var i=null===e?[]:Object.keys(e),t=this;i.length>0&&i.forEach(function(i){var a=e[i];void 0!==a&&"string"!=typeof e&&(n(i,a,e),t.crawling(a,n))})}},{key:"resetViewsIds",value:function(e){e.view_init=0,this.crawling(e.views_list,function(e,n,i){"view_id"!=e&&"container_id"!=e||(i[e]=0)})}},{key:"connectApps",value:function(e,n,i){var t=this;return e.forEach(function(e){n.apps.forEach(function(i){e.view_init===i.new_view_init&&n.views.forEach(function(n){i.old_view_init===n.old_view_id&&(e.view_init=n.new_view_id)})}),t.crawling(e.field_list,function(a,o,r){if(-1!==a.indexOf("field_id")||-1!==a.indexOf("FieldId")||-1!==a.indexOf("destination_field")){var p=String(o).split(","),c=[];n.fields.forEach(function(e){p.forEach(function(n){n==e.old_field_id&&c.push(e.new_field_id)})}),c.length&&(r[a]=c.join(","))}if(-1==a.indexOf("app_id")&&-1==a.indexOf("AppId")&&-1==a.indexOf("destination_app")||n.apps.forEach(function(e){o==e.old_app_id&&(r[a]=e.new_app_id)}),-1!==a.indexOf("view_id")&&n.views.forEach(function(e){o==e.old_view_id&&(r[a]=e.new_view_id)}),-1!==a.indexOf("src")&&isFinite(o)){var u=n.apps.find(function(n){return n.new_app_id===e.app_id}).old_app_id,l=t.findPath(i[u].views_list,"container_id",o);r[a]="".concat(t.getValueByPath(e.views_list,l,"container_id"))}})}),e}},{key:"getValueByPath",value:function(e,n,i){var t=e;return n.split(".").forEach(function(e){t=t[e]}),t[i]}},{key:"findPath",value:function(e,n,t){var a=!1,o=!1,r=[];return this.crawling(e,function(e,p,c){o&&r.reverse().forEach(function(e){o&&(e.delete=!0,e.parent===c&&(o=!1,(r=r.filter(function(e){return!e.delete})).reverse()))}),a||("object"===i(c[e])&&r.push({prop:e,parent:c}),p==t&&n===e?a=!0:Object.keys(c).pop()===e&&"object"!==i(c[e])&&(o=!0))}),r.map(function(e){return e.prop}).join(".")}},{key:"prepareAppTemplate",value:function(e){var n=JSON.parse(JSON.stringify(e));return this.crawling(n.views_list,function(e,n,i){"element_id"==e&&(i.element_id=-Number(n),i.create_element=-Number(n))}),n.field_list.forEach(function(e){e.create_field=-Number(e.field_id),e.element_id=-Number(e.field_id),e.field_id=-Number(e.field_id),e.field_value=""}),n.items_list=[],delete n.app_id,delete n.icon.id,delete n.group_id,delete n.trash,delete n.last_update,delete n.file_list,n}}]),e}();exports.default=r;
173
173
  },{}],"E7yc":[function(require,module,exports) {
174
174
  "use strict";function e(e){return i(e)||r(e)||n(e)||t()}function t(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}function r(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function i(e){if(Array.isArray(e))return o(e)}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.FileHelper=void 0;var f=function(){function t(e){u(this,t),this.gudhub=e}return a(t,[{key:"fileInstallerHelper",value:function(t,n,r){var i=this;return new Promise(function(o){var u=[[]],l=Promise.resolve(),a=[];n.forEach(function(e){var n=e.item_id,i=e.fields.find(function(e){return e.element_id===r});i&&i.field_value&&i.field_value.split(".").forEach(function(e){var i={source:e,destination:{app_id:t,item_id:n,element_id:r}};10!==u[u.length-1].length?u[u.length-1].push(i):u.push([i])})}),u.forEach(function(t){l=l.then(function(){return i.gudhub.duplicateFile(t)}).then(function(t){a=[].concat(e(a),e(t))})}),l.then(function(){n.forEach(function(e){var t=e.item_id,n=e.fields.find(function(e){return e.element_id===r});n&&n.field_value&&(n.field_value="",a.forEach(function(e){e.item_id===t&&(n.field_value=n.field_value.split(",").filter(function(e){return e}).concat(e.file_id).join(","))}))}),o()})})}}]),t}();exports.FileHelper=f;
175
175
  },{}],"mWlG":[function(require,module,exports) {
@@ -180,12 +180,12 @@ var e,t=arguments[3],n=require("process");!function(n){if("object"==typeof expor
180
180
  "use strict";function e(o){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(o)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.IS_WEB=void 0;var o=!["undefined"==typeof window?"undefined":e(window),"undefined"==typeof document?"undefined":e(document)].includes("undefined");exports.IS_WEB=o;
181
181
  },{}],"osSN":[function(require,module,exports) {
182
182
  var global = arguments[3];
183
- var global=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=createAngularModuleInstance;var _axios=_interopRequireDefault(require("axios")),_consts=require("./../consts.js");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function asyncGeneratorStep(e,t,n,r,o,a,u){try{var c=e[a](u),l=c.value}catch(i){return void n(i)}c.done?t(l):Promise.resolve(l).then(r,o)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function u(e){asyncGeneratorStep(a,r,o,u,c,"next",e)}function c(e){asyncGeneratorStep(a,r,o,u,c,"throw",e)}u(void 0)})}}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var $q={when:function(e){return new Promise(function(t){t(e)})}},factoryReturns={},angular={module:function(){return angular},directive:function(){return angular},factory:function(e,t){try{"object"===_typeof(t)?factoryReturns[e]=t[t.length-1]($q):factoryReturns[e]=t($q)}catch(n){console.log("Errror in data type: ",e),console.log(n)}return angular},service:function(){return angular},run:function(){return angular},filter:function(){return angular},controller:function(){return angular},value:function(){return angular},element:function(){return angular},injector:function(){return angular},invoke:function(){return angular}};function createAngularModuleInstance(e,t,n,r){return _createAngularModuleInstance.apply(this,arguments)}function _createAngularModuleInstance(){return _createAngularModuleInstance=_asyncToGenerator(regeneratorRuntime.mark(function _callee4(module_id,module_url,angularInjector,nodeWindow){var angularModule,importedClass,module,response,code,encodedCode,_module,result;return regeneratorRuntime.wrap(function _callee4$(_context4){for(;;)switch(_context4.prev=_context4.next){case 0:if(_context4.prev=0,!_consts.IS_WEB){_context4.next=16;break}if(angularInjector.has(module_id)){_context4.next=5;break}return _context4.next=5,angularInjector.get("$ocLazyLoad").load(module_url);case 5:return _context4.next=7,angularInjector.get(module_id);case 7:return angularModule=_context4.sent,_context4.next=10,_axios.default.get(module_url);case 10:module=_context4.sent,module=module.data;try{eval(module)}catch(error){console.error("ERROR WHILE EVAL() IN GHCONSTRUCTOR. MODULE ID: ".concat(module_id)),console.log(error)}importedClass=factoryReturns[module_id],_context4.next=33;break;case 16:return global.hasOwnProperty("window")||(global.window=nodeWindow,global.document=nodeWindow.document,global.Element=nodeWindow.Element,global.navigator=nodeWindow.navigator,global.HTMLElement=nodeWindow.HTMLElement,global.angular=angular),_context4.next=19,_axios.default.get(module_url);case 19:return response=_context4.sent,code=response.data,encodedCode=encodeURIComponent(code),encodedCode="data:text/javascript;charset=utf-8,"+encodedCode,_context4.prev=23,_context4.next=26,import(encodedCode);case 26:_module=_context4.sent,_context4.next=32;break;case 29:_context4.prev=29,_context4.t0=_context4.catch(23),console.log("Error while importing module: ".concat(module_id));case 32:importedClass=new _module.default;case 33:return result={type:module_id,getTemplate:function(e,t,n,r,o,a){var u="false"!==n;return importedClass.getTemplate(e,t,u,r,o,a)},getDefaultValue:function(e,t,n,r){return new Promise(function(){var o=_asyncToGenerator(regeneratorRuntime.mark(function o(a){var u,c;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!(u=importedClass.getDefaultValue)){o.next=8;break}return o.next=4,u(e,t,n,r);case 4:c=o.sent,a(c),o.next=9;break;case 8:a(null);case 9:case"end":return o.stop()}},o)}));return function(e){return o.apply(this,arguments)}}())},getSettings:function(e,t,n){return importedClass.getSettings(e,t,n)},filter:{getSearchOptions:function(e){var t=importedClass;return t.filter&&t.filter.getSearchOptions?importedClass.filter.getSearchOptions(e)||null:[]},getDropdownValues:function(){var e=importedClass;return e.filter&&e.filter.getDropdownValues?e.filter.getDropdownValues()||null:[]}},getInterpretation:function(e,t,n,r,o,a){return new Promise(function(){var u=_asyncToGenerator(regeneratorRuntime.mark(function u(c){var l,i,s,d;return regeneratorRuntime.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return l=importedClass,u.prev=1,u.next=4,l.getInterpretation(e,a,o,r,n);case 4:return i=u.sent,s=i.find(function(e){return e.id==t})||i.find(function(e){return"default"==e.id}),u.next=8,s.content();case 8:d=u.sent,c({html:d}),u.next=16;break;case 12:u.prev=12,u.t0=u.catch(1),console.log("ERROR IN ".concat(module_id),u.t0),c({html:"<span>no interpretation</span>"});case 16:case"end":return u.stop()}},u,null,[[1,12]])}));return function(e){return u.apply(this,arguments)}}())},getInterpretationsList:function(e,t,n,r){return importedClass.getInterpretation(e,t,n,r)},getInterpretatedValue:function(e,t,n,r){return new Promise(function(){var o=_asyncToGenerator(regeneratorRuntime.mark(function o(a){var u,c;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!(u=importedClass.getInterpretatedValue)){o.next=8;break}return o.next=4,u(e,t,n,r);case 4:c=o.sent,a(c),o.next=9;break;case 8:a(e);case 9:case"end":return o.stop()}},o)}));return function(e){return o.apply(this,arguments)}}())}},_consts.IS_WEB&&(result.extendController=function(e){angularModule.getActionScope(e)},result.runAction=function(e){try{angularModule.runAction(e)}catch(t){}},result.getWindowScope=function(e){return angularModule.getWindowScope(e)},result.getWindowHTML=function(e){return angularModule.getWindowHTML(e)}),_context4.abrupt("return",result);case 38:_context4.prev=38,_context4.t1=_context4.catch(0),console.log(_context4.t1),console.log("Failed in createAngularModuleInstance (ghconstructor). Module id: ".concat(module_id,"."));case 42:case"end":return _context4.stop()}},_callee4,null,[[0,38],[23,29]])})),_createAngularModuleInstance.apply(this,arguments)}
183
+ var global=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=createAngularModuleInstance;var _axios=_interopRequireDefault(require("axios")),_consts=require("./../consts.js");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function asyncGeneratorStep(e,t,n,r,o,a,u){try{var l=e[a](u),c=l.value}catch(i){return void n(i)}l.done?t(c):Promise.resolve(c).then(r,o)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function u(e){asyncGeneratorStep(a,r,o,u,l,"next",e)}function l(e){asyncGeneratorStep(a,r,o,u,l,"throw",e)}u(void 0)})}}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var $q={when:function(e){return new Promise(function(t){t(e)})}},factoryReturns={},angular={module:function(){return angular},directive:function(){return angular},factory:function(e,t){try{"object"===_typeof(t)?factoryReturns[e]=t[t.length-1]($q):factoryReturns[e]=t($q)}catch(n){console.log("Errror in data type: ",e),console.log(n)}return angular},service:function(){return angular},run:function(){return angular},filter:function(){return angular},controller:function(){return angular},value:function(){return angular},element:function(){return angular},injector:function(){return angular},invoke:function(){return angular}};function createAngularModuleInstance(e,t,n,r){return _createAngularModuleInstance.apply(this,arguments)}function _createAngularModuleInstance(){return _createAngularModuleInstance=_asyncToGenerator(regeneratorRuntime.mark(function _callee4(module_id,module_url,angularInjector,nodeWindow){var angularModule,importedClass,module,proxy,response,code,encodedCode,_module,result;return regeneratorRuntime.wrap(function _callee4$(_context4){for(;;)switch(_context4.prev=_context4.next){case 0:if(_context4.prev=0,!_consts.IS_WEB){_context4.next=16;break}if(angularInjector.has(module_id)){_context4.next=5;break}return _context4.next=5,angularInjector.get("$ocLazyLoad").load(module_url);case 5:return _context4.next=7,angularInjector.get(module_id);case 7:return angularModule=_context4.sent,_context4.next=10,_axios.default.get(module_url);case 10:module=_context4.sent,module=module.data;try{eval(module)}catch(error){console.error("ERROR WHILE EVAL() IN GHCONSTRUCTOR. MODULE ID: ".concat(module_id)),console.log(error)}importedClass=factoryReturns[module_id],_context4.next=35;break;case 16:return proxy=new Proxy(nodeWindow,{get:function(e,t){return e[t]},set:function(e,t,n){return e[t]=n,global[t]=n,!0}}),global.hasOwnProperty("window")||(global.window=proxy,global.document=nodeWindow.document,global.Element=nodeWindow.Element,global.CharacterData=nodeWindow.CharacterData,global.this=proxy,global.self=proxy,global.Blob=nodeWindow.Blob,global.Node=nodeWindow.Node,global.navigator=nodeWindow.navigator,global.HTMLElement=nodeWindow.HTMLElement,global.XMLHttpRequest=nodeWindow.XMLHttpRequest,global.WebSocket=nodeWindow.WebSocket,global.crypto=nodeWindow.crypto,global.DOMParser=nodeWindow.DOMParser,global.Symbol=nodeWindow.Symbol,global.document.queryCommandSupported=function(e){return!1},global.angular=angular),_context4.next=20,_axios.default.get(module_url);case 20:return response=_context4.sent,code=response.data,encodedCode=encodeURIComponent(code),encodedCode="data:text/javascript;charset=utf-8,"+encodedCode,_context4.prev=24,_context4.next=27,import(encodedCode);case 27:_module=_context4.sent,_context4.next=34;break;case 30:_context4.prev=30,_context4.t0=_context4.catch(24),console.log("Error while importing module: ".concat(module_id)),console.log(_context4.t0);case 34:importedClass=new _module.default;case 35:return result={type:module_id,getTemplate:function(e,t,n,r,o,a){var u="false"!==n;return importedClass.getTemplate(e,t,u,r,o,a)},getDefaultValue:function(e,t,n,r){return new Promise(function(){var o=_asyncToGenerator(regeneratorRuntime.mark(function o(a){var u,l;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!(u=importedClass.getDefaultValue)){o.next=8;break}return o.next=4,u(e,t,n,r);case 4:l=o.sent,a(l),o.next=9;break;case 8:a(null);case 9:case"end":return o.stop()}},o)}));return function(e){return o.apply(this,arguments)}}())},getSettings:function(e,t,n){return importedClass.getSettings(e,t,n)},filter:{getSearchOptions:function(e){var t=importedClass;return t.filter&&t.filter.getSearchOptions?importedClass.filter.getSearchOptions(e)||null:[]},getDropdownValues:function(){var e=importedClass;return e.filter&&e.filter.getDropdownValues?e.filter.getDropdownValues()||null:[]}},getInterpretation:function(e,t,n,r,o,a){return new Promise(function(){var u=_asyncToGenerator(regeneratorRuntime.mark(function u(l){var c,i,s,d;return regeneratorRuntime.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return c=importedClass,u.prev=1,u.next=4,c.getInterpretation(e,a,o,r,n);case 4:return i=u.sent,s=i.find(function(e){return e.id==t})||i.find(function(e){return"default"==e.id}),u.next=8,s.content();case 8:d=u.sent,l({html:d}),u.next=16;break;case 12:u.prev=12,u.t0=u.catch(1),console.log("ERROR IN ".concat(module_id),u.t0),l({html:"<span>no interpretation</span>"});case 16:case"end":return u.stop()}},u,null,[[1,12]])}));return function(e){return u.apply(this,arguments)}}())},getInterpretationsList:function(e,t,n,r){return importedClass.getInterpretation(e,t,n,r)},getInterpretatedValue:function(e,t,n,r){return new Promise(function(){var o=_asyncToGenerator(regeneratorRuntime.mark(function o(a){var u,l;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!(u=importedClass.getInterpretatedValue)){o.next=8;break}return o.next=4,u(e,t,n,r);case 4:l=o.sent,a(l),o.next=9;break;case 8:a(e);case 9:case"end":return o.stop()}},o)}));return function(e){return o.apply(this,arguments)}}())}},_consts.IS_WEB&&(result.extendController=function(e){angularModule.getActionScope(e)},result.runAction=function(e){try{angularModule.runAction(e)}catch(t){}},result.getWindowScope=function(e){return angularModule.getWindowScope(e)},result.getWindowHTML=function(e){return angularModule.getWindowHTML(e)}),_context4.abrupt("return",result);case 40:_context4.prev=40,_context4.t1=_context4.catch(0),console.log(_context4.t1),console.log("Failed in createAngularModuleInstance (ghconstructor). Module id: ".concat(module_id,"."));case 44:case"end":return _context4.stop()}},_callee4,null,[[0,40],[24,30]])})),_createAngularModuleInstance.apply(this,arguments)}
184
184
  },{"axios":"O4Aa","./../consts.js":"UV2u"}],"DsUm":[function(require,module,exports) {
185
185
  var global = arguments[3];
186
- var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=u;var t=r(require("axios")),n=require("./../consts.js");function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n,r,o,a,u){try{var c=e[a](u),i=c.value}catch(s){return void n(s)}c.done?t(i):Promise.resolve(i).then(r,o)}function a(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var u=e.apply(t,n);function c(e){o(u,r,a,c,i,"next",e)}function i(e){o(u,r,a,c,i,"throw",e)}c(void 0)})}}function u(e,t,n,r){return c.apply(this,arguments)}function c(){return(c=a(regeneratorRuntime.mark(function r(o,u,c,i){var s,l,f,p,d,g;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,u||console.error("JS link must be provided for this data type - ".concat(o)),s=function(r){return n.IS_WEB||e.hasOwnProperty("window")||(e.window=i,e.document=i.document,e.Element=i.Element,e.navigator=i.navigator,e.HTMLElement=i.HTMLElement),new Promise(function(){var e=a(regeneratorRuntime.mark(function e(n){var a,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.default.get(r).catch(function(e){console.log("Failed to fetch: ".concat(r," in ghconstructor. Module id: ").concat(o))});case 2:a=e.sent,u=encodeURIComponent(a.data),n("data:text/javascript;charset=utf-8,"+u);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())},r.next=5,s(u);case 5:return l=r.sent,r.prev=6,r.next=9,import(l);case 9:f=r.sent,r.next=16;break;case 12:r.prev=12,r.t0=r.catch(6),console.log("Error while importing module: ".concat(o)),console.log(r.t0);case 16:return p=new f.default(o),c&&n.IS_WEB&&((d=document.createElement("link")).href=c,d.setAttribute("data-module",o),d.setAttribute("rel","stylesheet"),document.getElementsByTagName("head")[0].appendChild(d)),g={type:o,getTemplate:function(e,t,n,r,o,a){var u="false"!==n;return p.getTemplate(e,t,u,r,o,a)},getDefaultValue:function(e,t,n,r){return new Promise(function(){var o=a(regeneratorRuntime.mark(function o(a){var u,c;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!(u=p.getDefaultValue)){o.next=8;break}return o.next=4,u(e,t,n,r);case 4:c=o.sent,a(c),o.next=9;break;case 8:a(null);case 9:case"end":return o.stop()}},o)}));return function(e){return o.apply(this,arguments)}}())},getSettings:function(e,t,n){return p.getSettings(e,t,n)},filter:{getSearchOptions:function(e){var t=p;return t.filter&&t.filter.getSearchOptions?p.filter.getSearchOptions(e):[]},getDropdownValues:function(){var e=p;return e.filter&&e.filter.getDropdownValues?e.filter.getDropdownValues():[]}},getInterpretation:function(e,t,n,r,u,c){return new Promise(function(){var i=a(regeneratorRuntime.mark(function a(i){var s,l,f,d;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return s=p,a.prev=1,a.next=4,s.getInterpretation(e,c,u,r,n);case 4:return l=a.sent,f=l.find(function(e){return e.id==t})||l.find(function(e){return"default"==e.id}),a.next=8,f.content();case 8:d=a.sent,i({html:d}),a.next=16;break;case 12:a.prev=12,a.t0=a.catch(1),console.log("ERROR IN ".concat(o),a.t0),i({html:"<span>no interpretation</span>"});case 16:case"end":return a.stop()}},a,null,[[1,12]])}));return function(e){return i.apply(this,arguments)}}())},getInterpretationsList:function(e,t,n,r){return p.getInterpretation(e,t,n,r)},getInterpretatedValue:function(e,t,n,r){return new Promise(function(){var o=a(regeneratorRuntime.mark(function o(a){var u,c;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!(u=p.getInterpretatedValue)){o.next=8;break}return o.next=4,u(e,t,n,r);case 4:c=o.sent,a(c),o.next=9;break;case 8:a(e);case 9:case"end":return o.stop()}},o)}));return function(e){return o.apply(this,arguments)}}())},extendController:function(e){p.getActionScope(e)},runAction:function(e){try{p.runAction(e)}catch(t){}},getWindowScope:function(e){return p.getWindowScope(e)},getWindowHTML:function(e){return p.getWindowHTML(e)}},r.abrupt("return",g);case 22:r.prev=22,r.t1=r.catch(0),console.log(r.t1),console.log("Failed in createClassInstance (ghconstructor). Module id: ".concat(o,". JS url: ").concat(u));case 26:case"end":return r.stop()}},r,null,[[0,22],[6,12]])}))).apply(this,arguments)}
186
+ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=u;var t=r(require("axios")),n=require("./../consts.js");function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n,r,o,a,u){try{var c=e[a](u),i=c.value}catch(s){return void n(s)}c.done?t(i):Promise.resolve(i).then(r,o)}function a(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var u=e.apply(t,n);function c(e){o(u,r,a,c,i,"next",e)}function i(e){o(u,r,a,c,i,"throw",e)}c(void 0)})}}function u(e,t,n,r){return c.apply(this,arguments)}function c(){return(c=a(regeneratorRuntime.mark(function r(o,u,c,i){var s,l,p,f,d,g;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,u||console.error("JS link must be provided for this data type - ".concat(o)),s=function(r){return n.IS_WEB||e.hasOwnProperty("window")||(e.window=proxy,e.document=i.document,e.Element=i.Element,e.CharacterData=i.CharacterData,e.this=proxy,e.self=proxy,e.Blob=i.Blob,e.Node=i.Node,e.navigator=i.navigator,e.HTMLElement=i.HTMLElement,e.XMLHttpRequest=i.XMLHttpRequest,e.WebSocket=i.WebSocket,e.crypto=i.crypto,e.DOMParser=i.DOMParser,e.Symbol=i.Symbol,e.document.queryCommandSupported=function(e){return console.log("QUERY COMMAND SUPPORTED: ",e),!1},e.angular=angular),new Promise(function(){var e=a(regeneratorRuntime.mark(function e(n){var a,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.default.get(r).catch(function(e){console.log("Failed to fetch: ".concat(r," in ghconstructor. Module id: ").concat(o))});case 2:a=e.sent,u=encodeURIComponent(a.data),n("data:text/javascript;charset=utf-8,"+u);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())},r.next=5,s(u);case 5:return l=r.sent,r.prev=6,r.next=9,import(l);case 9:p=r.sent,r.next=16;break;case 12:r.prev=12,r.t0=r.catch(6),console.log("Error while importing module: ".concat(o)),console.log(r.t0);case 16:return f=new p.default(o),c&&n.IS_WEB&&((d=document.createElement("link")).href=c,d.setAttribute("data-module",o),d.setAttribute("rel","stylesheet"),document.getElementsByTagName("head")[0].appendChild(d)),g={type:o,getTemplate:function(e,t,n,r,o,a){var u="false"!==n;return f.getTemplate(e,t,u,r,o,a)},getDefaultValue:function(e,t,n,r){return new Promise(function(){var o=a(regeneratorRuntime.mark(function o(a){var u,c;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!(u=f.getDefaultValue)){o.next=8;break}return o.next=4,u(e,t,n,r);case 4:c=o.sent,a(c),o.next=9;break;case 8:a(null);case 9:case"end":return o.stop()}},o)}));return function(e){return o.apply(this,arguments)}}())},getSettings:function(e,t,n){return f.getSettings(e,t,n)},filter:{getSearchOptions:function(e){var t=f;return t.filter&&t.filter.getSearchOptions?f.filter.getSearchOptions(e):[]},getDropdownValues:function(){var e=f;return e.filter&&e.filter.getDropdownValues?e.filter.getDropdownValues():[]}},getInterpretation:function(e,t,n,r,u,c){return new Promise(function(){var i=a(regeneratorRuntime.mark(function a(i){var s,l,p,d;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return s=f,a.prev=1,a.next=4,s.getInterpretation(e,c,u,r,n);case 4:return l=a.sent,p=l.find(function(e){return e.id==t})||l.find(function(e){return"default"==e.id}),a.next=8,p.content();case 8:d=a.sent,i({html:d}),a.next=16;break;case 12:a.prev=12,a.t0=a.catch(1),console.log("ERROR IN ".concat(o),a.t0),i({html:"<span>no interpretation</span>"});case 16:case"end":return a.stop()}},a,null,[[1,12]])}));return function(e){return i.apply(this,arguments)}}())},getInterpretationsList:function(e,t,n,r){return f.getInterpretation(e,t,n,r)},getInterpretatedValue:function(e,t,n,r){return new Promise(function(){var o=a(regeneratorRuntime.mark(function o(a){var u,c;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!(u=f.getInterpretatedValue)){o.next=8;break}return o.next=4,u(e,t,n,r);case 4:c=o.sent,a(c),o.next=9;break;case 8:a(e);case 9:case"end":return o.stop()}},o)}));return function(e){return o.apply(this,arguments)}}())},extendController:function(e){f.getActionScope(e)},runAction:function(e){try{f.runAction(e)}catch(t){}},getWindowScope:function(e){return f.getWindowScope(e)},getWindowHTML:function(e){return f.getWindowHTML(e)}},r.abrupt("return",g);case 22:r.prev=22,r.t1=r.catch(0),console.log(r.t1),console.log("Failed in createClassInstance (ghconstructor). Module id: ".concat(o,". JS url: ").concat(u));case 26:case"end":return r.stop()}},r,null,[[0,22],[6,12]])}))).apply(this,arguments)}
187
187
  },{"axios":"O4Aa","./../consts.js":"UV2u"}],"Htuh":[function(require,module,exports) {
188
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GHConstructor=void 0;var e=t(require("./createAngularModuleInstance.js")),n=t(require("./createClassInstance.js"));function t(e){return e&&e.__esModule?e:{default:e}}function r(e,n,t,r,u,a,o){try{var i=e[a](o),c=i.value}catch(s){return void t(s)}i.done?n(c):Promise.resolve(c).then(r,u)}function u(e){return function(){var n=this,t=arguments;return new Promise(function(u,a){var o=e.apply(n,t);function i(e){r(o,u,a,i,c,"next",e)}function c(e){r(o,u,a,i,c,"throw",e)}i(void 0)})}}function a(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function o(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,n,t){return n&&o(e.prototype,n),t&&o(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var c=function(){function t(e){a(this,t),this.gudhub=e,this.cache=[],this.modulesQueue={},this.angularInjector,this.nodeWindow}return i(t,[{key:"getInstance",value:function(){var e=u(regeneratorRuntime.mark(function e(n){var t=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=u(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.modulesQueue[n]){e.next=4;break}return e.abrupt("return",t.modulesQueue[n].then(function(){r(t.getCached(n))}));case 4:t.cache.find(function(e){return e.type===n})?r(t.getCached(n)):(t.modulesQueue[n]=t.createInstance(n),t.modulesQueue[n].then(function(){r(t.getCached(n))}));case 5:case"end":return e.stop()}},e)}));return function(n){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}},e)}));return function(n){return e.apply(this,arguments)}}()},{key:"pupToCache",value:function(e){this.cache.push(e)}},{key:"getCached",value:function(e){return this.cache.find(function(n){return n.type===e})}},{key:"initAngularInjector",value:function(e){this.angularInjector=e}},{key:"initJsdomWindow",value:function(e){this.nodeWindow=e}},{key:"createInstance",value:function(){var t=u(regeneratorRuntime.mark(function t(r){var u,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("angular"!==(u=this.gudhub.storage.getModuleUrl(r)).type){t.next=7;break}return t.next=4,(0,e.default)(r,u.url,this.angularInjector,this.nodeWindow);case 4:a=t.sent,t.next=11;break;case 7:if("class"!==u.type){t.next=11;break}return t.next=10,(0,n.default)(r,u.js,u.css,this.nodeWindow);case 10:a=t.sent;case 11:return this.pupToCache(a),t.abrupt("return",a);case 13:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()}]),t}();exports.GHConstructor=c;
188
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GHConstructor=void 0;var e=t(require("./createAngularModuleInstance.js")),n=t(require("./createClassInstance.js"));function t(e){return e&&e.__esModule?e:{default:e}}function r(e,n,t,r,u,a,o){try{var i=e[a](o),c=i.value}catch(s){return void t(s)}i.done?n(c):Promise.resolve(c).then(r,u)}function u(e){return function(){var n=this,t=arguments;return new Promise(function(u,a){var o=e.apply(n,t);function i(e){r(o,u,a,i,c,"next",e)}function c(e){r(o,u,a,i,c,"throw",e)}i(void 0)})}}function a(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function o(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,n,t){return n&&o(e.prototype,n),t&&o(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var c=function(){function t(e){a(this,t),this.gudhub=e,this.cache=[],this.modulesQueue={},this.angularInjector,this.nodeWindow}return i(t,[{key:"getInstance",value:function(){var e=u(regeneratorRuntime.mark(function e(n){var t=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=u(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.modulesQueue[n]){e.next=4;break}return e.abrupt("return",t.modulesQueue[n].then(function(){r(t.getCached(n))}));case 4:t.cache.find(function(e){return e.type===n})?r(t.getCached(n)):(t.modulesQueue[n]=t.createInstance(n),t.modulesQueue[n].then(function(){r(t.getCached(n))}));case 5:case"end":return e.stop()}},e)}));return function(n){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}},e)}));return function(n){return e.apply(this,arguments)}}()},{key:"pupToCache",value:function(e){this.cache.push(e)}},{key:"getCached",value:function(e){return this.cache.find(function(n){return n.type===e})}},{key:"initAngularInjector",value:function(e){this.angularInjector=e}},{key:"initJsdomWindow",value:function(e){this.nodeWindow=e}},{key:"createInstance",value:function(){var t=u(regeneratorRuntime.mark(function t(r){var u,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(u=this.gudhub.storage.getModuleUrl(r)){t.next=4;break}return console.log("Cannot find module: ".concat(r)),t.abrupt("return");case 4:if("angular"!==u.type){t.next=10;break}return t.next=7,(0,e.default)(r,u.url,this.angularInjector,this.nodeWindow);case 7:a=t.sent,t.next=14;break;case 10:if("class"!==u.type){t.next=14;break}return t.next=13,(0,n.default)(r,u.js,u.css,this.nodeWindow);case 13:a=t.sent;case 14:return a&&this.pupToCache(a),t.abrupt("return",a);case 16:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()}]),t}();exports.GHConstructor=c;
189
189
  },{"./createAngularModuleInstance.js":"osSN","./createClassInstance.js":"DsUm"}],"q0my":[function(require,module,exports) {
190
190
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AppProcessor=void 0;var e=require("../consts.js");function t(e){return i(e)||n(e)||o(e)||r()}function r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function i(e){if(Array.isArray(e))return c(e)}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=o(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,p=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return p=e.done,e},e:function(e){s=!0,a=e},f:function(){try{p||null==r.return||r.return()}finally{if(s)throw a}}}}function o(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t,r,n,i,a,p){try{var s=e[a](p),u=s.value}catch(o){return void r(o)}s.done?t(u):Promise.resolve(u).then(n,i)}function l(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function p(e){f(a,n,i,p,s,"next",e)}function s(e){f(a,n,i,p,s,"throw",e)}p(void 0)})}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function g(e,t,r){return t&&v(e.prototype,t),r&&v(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var d=function(){function r(e,t,n,i,a,p,s){h(this,r),this.storage=e,this.pipeService=t,this.req=n,this.ws=i,this.applistReceived=!1,this.activateSW=s,this.chunksManager=a,this.util=p,this.appListeners()}return g(r,[{key:"createNewAppApi",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.post({url:"/api/app/create",form:{app:JSON.stringify(t)}});case 3:return(r=e.sent).from_apps_list=!0,e.abrupt("return",r);case 8:return e.prev=8,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 12:case"end":return e.stop()}},e,this,[[0,8]])}));return function(t){return e.apply(this,arguments)}}()},{key:"updateAppApi",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.post({url:"/api/app/update",form:{app:JSON.stringify(t)}});case 3:return r=e.sent,e.abrupt("return",r);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t){return e.apply(this,arguments)}}()},{key:"deleteAppApi",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.post({url:"/api/app/delete",form:{app_id:t}});case 3:return r=e.sent,e.abrupt("return",r);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t){return e.apply(this,arguments)}}()},{key:"getAppListApi",value:function(){var e=l(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.get({url:"/api/applist/get"});case 3:return t=e.sent,e.abrupt("return",t.apps_list.map(function(e){return e.from_apps_list=!0,e}));case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"getAppApi",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.get({url:"/api/app/get",params:{app_id:t}});case 3:return r=e.sent,e.abrupt("return",r);case 7:return e.prev=7,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 11:case"end":return e.stop()}},e,this,[[0,7]])}));return function(t){return e.apply(this,arguments)}}()},{key:"getAppListFromStorage",value:function(){return this.storage.getAppsList()}},{key:"getAppFromStorage",value:function(e){var t=this.storage.getApp(e);return t&&t.field_list.length?t:null}},{key:"addNewAppToStorage",value:function(e){return this.storage.getAppsList().push(e)}},{key:"saveAppInStorage",value:function(e){var t=this.storage.getApp(e.app_id);return t?(e.from_apps_list=t.from_apps_list,e.permission=t.permission,this.storage.updateApp(e)):(e.from_apps_list=!1,this.addNewAppToStorage(e)),this.getAppFromStorage(e.app_id)}},{key:"updatingAppInStorage",value:function(e){var t=this,r=this.getAppFromStorage(e.app_id);e.items_list=r.items_list,e.file_list=r.file_list,e.from_apps_list=r.from_apps_list,this.storage.updateApp(e),this.pipeService.emit("gh_app_views_update",{app_id:e.app_id},e.views_list),e.field_list.forEach(function(r){t.pipeService.emit("gh_model_update",{app_id:e.app_id,field_id:r.field_id},r)})}},{key:"deletingAppFromStorage",value:function(e){var t=this.storage.getAppsList();return t.forEach(function(r,n){r.app_id==e&&t.splice(n)}),t}},{key:"updateAppsListInStorage",value:function(){var e,t=u(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]);try{for(t.s();!(e=t.n()).done;){var r=e.value,n=this.storage.getApp(r.app_id);n?(n.from_apps_list=r.from_apps_list,n.permission=r.permission):this.addNewAppToStorage(r)}}catch(i){t.e(i)}finally{t.f()}}},{key:"refreshApps",value:function(){var e=l(regeneratorRuntime.mark(function e(){var t,r,n,i,a,p=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=p.length>0&&void 0!==p[0]?p[0]:[],r=u(t),e.prev=2,r.s();case 4:if((n=r.n()).done){e.next=19;break}if(null==(i=n.value)||!this.storage.getApp(i)){e.next=17;break}return e.prev=7,e.next=10,this.getAppApi(i);case 10:(a=e.sent)&&this.storage.updateApp(a),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(7),console.log(e.t0);case 17:e.next=4;break;case 19:e.next=24;break;case 21:e.prev=21,e.t1=e.catch(2),r.e(e.t1);case 24:return e.prev=24,r.f(),e.finish(24);case 27:console.log("Apps refreshed: ",JSON.stringify(t));case 28:case"end":return e.stop()}},e,this,[[2,21,24,27],[7,14]])}));return function(){return e.apply(this,arguments)}}()},{key:"refreshAppsList",value:function(){var e=l(regeneratorRuntime.mark(function e(){var t,r,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.getAppListFromStorage(),e.next=3,this.getAppListApi();case 3:r=e.sent,n=r.map(function(e){return p(p({},e),t.find(function(t){return t.app_id===e.app_id}))}),this.updateAppsListInStorage(n),this.pipeService.emit("gh_apps_list_refreshed",{});case 7:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getAppsList",value:function(){var e=l(regeneratorRuntime.mark(function e(){var t,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.getAppListFromStorage(),this.applistReceived){e.next=10;break}return e.next=4,this.getAppListApi();case 4:if(r=e.sent){e.next=7;break}return e.abrupt("return",null);case 7:this.updateAppsListInStorage(r),this.applistReceived=!0,t=r;case 10:return e.abrupt("return",t);case 11:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getAppInfo",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAppsList();case 2:return r=e.sent,e.abrupt("return",r?r.find(function(e){return e.app_id==t}):null);case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"deleteApp",value:function(){var e=l(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.deleteAppApi(t);case 2:return e.abrupt("return",this.deletingAppFromStorage(t));case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getApp",value:function(){var e=l(regeneratorRuntime.mark(function e(r){var n,i,a,s=this,u=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=u.length>1&&void 0!==u[1]&&u[1],r){e.next=3;break}return e.abrupt("return",null);case 3:if(i=this.getAppFromStorage(r)){e.next=11;break}return e.next=7,this.getAppApi(r);case 7:if(a=e.sent){e.next=10;break}return e.abrupt("return",null);case 10:a.chunks&&a.chunks.length?(this.chunksManager.getChunks(r,a.chunks).then(function(e){a.items_list=s.util.mergeChunks([].concat(t(e),[a])),s.saveAppInStorage(a),s.pipeService.emit("gh_items_update",{app_id:r},a.items_list)}),i=a,this.saveAppInStorage(a)):(i=this.getAppFromStorage(r))||(i=a,this.saveAppInStorage(a),this.ws.addSubscription(r));case 11:return e.abrupt("return",n?i:p(p({},i),{},{items_list:i.items_list.filter(function(e){return!e.trash})}));case 12:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"updateApp",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.views_list&&t.views_list.length&&t.show){e.next=6;break}return e.next=3,this.getApp(t.app_id);case 3:r=e.sent,t.views_list&&t.views_list.length||(t.views_list=r.views_list),void 0===t.show&&(t.show=r.show);case 6:return e.next=8,this.updateAppApi(t);case 8:return n=e.sent,this.updatingAppInStorage(n),e.abrupt("return",n);case 11:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"updateAppInfo",value:function(){var e=l(regeneratorRuntime.mark(function e(){var t,r,n=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:{},r=this.getAppFromStorage(t.app_id),e.abrupt("return",this.updateApp(p(p({},r),t)));case 3:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"createNewApp",value:function(){var e=l(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.createNewAppApi(t);case 2:return r=e.sent,this.addNewAppToStorage(r),e.abrupt("return",r);case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"clearAppProcessor",value:function(){this.getAppListPromises=null,this.getAppPromises={},this.applistReceived=!1}},{key:"appListeners",value:function(){var t=this;this.pipeService.onRoot("gh_app_get",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n||!n.app_id){e.next=5;break}return e.next=3,t.getApp(n.app_id);case 3:i=e.sent,t.pipeService.emit("gh_app_get",n,i);case 5:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_apps_list_get",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAppsList();case 2:i=e.sent,t.pipeService.emit("gh_apps_list_get",n,i);case 4:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_delete_app",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.deleteApp(n.app_id);case 2:i=e.sent,t.pipeService.emit("gh_apps_list_update",{recipient:"all"},i);case 4:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_update",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n.app.items_list=[],n.app.file_list=[],e.next=4,t.updateApp(n.app);case 4:return i=e.sent,t.pipeService.emit("gh_app_views_update",{app_id:i.app_id},i.views_list),e.next=8,t.getAppsList();case 8:a=e.sent,t.pipeService.emit("gh_apps_list_update",{recipient:"all"},a),i.field_list.forEach(function(e){t.pipeService.emit("gh_model_update",{app_id:i.app_id,field_id:e.field_id},e)});case 11:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_view_get",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n||!n.app_id){e.next=5;break}return e.next=3,t.getApp(n.app_id);case 3:(i=e.sent).views_list.forEach(function(e,r){e.view_id==n.view_id&&t.pipeService.emit("gh_app_view_get",n,i.views_list[r])});case 5:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_views_get",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n||!n.app_id){e.next=5;break}return e.next=3,t.getApp(n.app_id);case 3:i=e.sent,t.pipeService.emit("gh_app_views_get",n,i.views_list);case 5:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_info_get",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAppInfo(n.app_id);case 2:(i=e.sent)&&t.pipeService.emit("gh_app_info_get",n,i);case 4:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_info_update",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n||!n.app){e.next=5;break}return e.next=3,t.updateAppInfo(n.app);case 3:i=e.sent,t.pipeService.emit("gh_app_info_update",{app_id:n.app.app_id},i);case 5:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),this.pipeService.onRoot("gh_app_create",{},function(){var e=l(regeneratorRuntime.mark(function e(r,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.createNewApp(n.app);case 2:return e.next=4,t.getAppsList();case 4:i=e.sent,t.pipeService.emit("gh_apps_list_update",{recipient:"all"},i);case 6:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),e.IS_WEB&&this.activateSW&&navigator.serviceWorker.addEventListener("message",function(){var e=l(regeneratorRuntime.mark(function e(r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("refresh app"!==r.data.type){e.next=7;break}return e.next=3,t.getApp(r.data.payload.app_id);case 3:(n=e.sent)&&t.util.compareAppsItemsLists(n.items_list,r.data.payload.items_list.filter(function(e){return!e.trash}),function(e){var n=e.diff_fields_items,i=e.diff_fields_items_Ids,a=e.diff_items,p=e.newItems,s=e.deletedItems;(a.length||p.length||s.length)&&(t.pipeService.emit("gh_items_update",{app_id:r.data.payload.app_id},r.data.payload.items_list.filter(function(e){return!e.trash})),a.forEach(function(e){return t.pipeService.emit("gh_item_update",{app_id:r.data.payload.app_id,item_id:e.item_id},e)})),i.forEach(function(e){var i=n[e];i&&i.forEach(function(n){t.pipeService.emit("gh_value_update",{app_id:r.data.payload.app_id,item_id:e,field_id:n.field_id},n.field_value)})})}),r.data.payload.items_list=t.util.mergeChunks([n,r.data.payload]),t.saveAppInStorage(r.data.payload);case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())}}]),r}();exports.AppProcessor=d;
191
191
  },{"../consts.js":"UV2u"}],"UUd3":[function(require,module,exports) {