@gudhub/core 1.1.13 → 1.1.16

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.
@@ -104,7 +104,7 @@ var t="function"==typeof Map&&Map.prototype,e=Object.getOwnPropertyDescriptor&&t
104
104
  },{}],"E3xI":[function(require,module,exports) {
105
105
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PipeService=void 0;var e=require("./utils.js");function r(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function t(e,r){for(var t=0;t<r.length;t++){var s=r[t];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function s(e,r,s){return r&&t(e.prototype,r),s&&t(e,s),Object.defineProperty(e,"prototype",{writable:!1}),e}var i=function(){function t(){r(this,t),this.subscribers={}}return s(t,[{key:"on",value:function(r,t,s){var i=this;return(0,e.checkParams)(r,t,s)&&r.split(" ").map(function(r){return r+":"+(0,e.createId)(t)}).forEach(function(e){i.subscribers[e]||(i.subscribers[e]=new Set),i.subscribers[e].add(s)}),this}},{key:"emit",value:function(r,t,s,i){var n=this;return r.split(" ").forEach(function(r){var u=r+":"+(0,e.createId)(t);n.subscribers[u]&&n.subscribers[u].forEach(function(e){e(null,s,i)})}),this}},{key:"onRoot",value:function(e,r,t){return this.on(e,r,t)}},{key:"destroy",value:function(r,t,s){var i=this;return r.split(" ").forEach(function(r){var n=r+":"+(0,e.createId)(t);i.subscribers[n]&&s&&i.subscribers[n].delete(s),i.subscribers[n]&&!s&&delete i.subscribers[n]}),this}}]),t}();exports.PipeService=i;
106
106
  },{"./utils.js":"Lc8J"}],"FJWL":[function(require,module,exports) {
107
- "use strict";function a(a,e){return[{name:"text",url:e+"/"+a+"text_data.js",type:"angular"},{name:"text_opt",url:e+"/"+a+"text_options_data.js",type:"angular"},{name:"number",url:e+"/"+a+"number_data.js",type:"angular"},{name:"task_board",url:e+"/"+a+"task_board_data.js",type:"angular"},{name:"visualizer",url:e+"/"+a+"visualizer_data.js",type:"angular"},{name:"enterprice_visualizer",url:e+"/"+a+"enterprice_visualizer_data.js",type:"angular"},{name:"email",url:e+"/"+a+"email_data.js",type:"angular"},{name:"date",url:e+"/"+a+"date_data.js",type:"angular"},{name:"radio_button",url:e+"/"+a+"radio_button_data.js",type:"angular"},{name:"radio_icon",url:e+"/"+a+"radio_icon_data.js",type:"angular"},{name:"twilio_phone",url:e+"/"+a+"twilio_phone_data.js",type:"angular"},{name:"twilio_autodialer",url:e+"/"+a+"twillio_autodialer_data.js",type:"angular"},{name:"color",url:e+"/"+a+"color_data.js",type:"angular"},{name:"charts",url:e+"/"+a+"charts_data.js",type:"angular"},{name:"funnel_chart",url:e+"/"+a+"funnel_chart_data.js",type:"angular"},{name:"add_items_from_template",url:e+"/"+a+"add_items_from_template_data.js",type:"angular"},{name:"item_ref",url:e+"/"+a+"itemRef_data.js",type:"angular"},{name:"calendar",url:e+"/"+a+"calendar_data.js",type:"angular"},{name:"data_ref",url:e+"/"+a+"data_ref_data.js",type:"angular"},{name:"table",url:e+"/"+a+"table_data.js",type:"angular"},{name:"tile",url:e+"/"+a+"tile_data.js",type:"angular"},{name:"file",url:e+"/"+a+"file_data.js",type:"angular"},{name:"image",url:e+"/"+a+"image_data.js",type:"angular"},{name:"text_editor",url:e+"/"+a+"text_editor_data.js",type:"angular"},{name:"tinymse",url:e+"/"+a+"tinymse_data.js",type:"angular"},{name:"duration",url:e+"/"+a+"duration_data.js",type:"angular"},{name:"user",url:e+"/"+a+"user_data.js",type:"angular"},{name:"app",url:e+"/"+a+"application_data.js",type:"angular"},{name:"field",url:e+"/"+a+"field_data.js",type:"angular"},{name:"available",url:e+"/"+a+"available_data.js",type:"angular"},{name:"view_list",url:e+"/"+a+"view_list_data.js",type:"angular"},{name:"calculator",url:e+"/"+a+"calculator_data.js",type:"angular"},{name:"string_join",url:e+"/"+a+"string_joiner_data.js",type:"angular"},{name:"signature",url:e+"/"+a+"signature_data.js",type:"angular"},{name:"sendEmail",url:e+"/"+a+"send_email_data.js",type:"angular"},{name:"boolean",url:e+"/"+a+"boolean_data.js",type:"angular"},{name:"product_gallery",url:e+"/"+a+"product_gallery_data.js",type:"angular"},{name:"online_inventory",url:e+"/"+a+"online_inventory_data.js",type:"angular"},{name:"3d_edges",url:e+"/"+a+"3d_edges_data.js",type:"angular"},{name:"color_list",url:e+"/"+a+"color_list_data.js",type:"angular"},{name:"go_to_link",url:e+"/"+a+"go_to_link_data.js",type:"angular"},{name:"go_to_view",url:e+"/"+a+"go_to_view_data.js",type:"angular"},{name:"range",url:e+"/"+a+"range_data.js",type:"angular"},{name:"barcode",url:e+"/"+a+"barcode_data.js",type:"angular"},{name:"item_remote_add",url:e+"/"+a+"item_remote_add_data.js",type:"angular"},{name:"item_remote_update",url:e+"/"+a+"item_remote_update_data.js",type:"angular"},{name:"timeline",url:e+"/"+a+"timeline_data.js",type:"angular"},{name:"delete_item",url:e+"/"+a+"delete_action.js",type:"angular"},{name:"print_doc",url:e+"/"+a+"print_doc_action.js",type:"angular"},{name:"open_item",url:e+"/"+a+"open_item_action.js",type:"angular"},{name:"edit_template",url:e+"/"+a+"edit_template_action.js",type:"angular"},{name:"open_app",url:e+"/"+a+"open_app_action.js",type:"angular"},{name:"user_settings",url:e+"/"+a+"user_settings_action.js",type:"angular"},{name:"app_sharing",url:e+"/"+a+"sharing_action.js",type:"angular"},{name:"app_constructor",url:e+"/"+a+"app_constructor_action.js",type:"angular"},{name:"export_csv",url:e+"/"+a+"export_csv.js",type:"angular"},{name:"import_csv",url:e+"/"+a+"import_csv.js",type:"angular"},{name:"add_items",url:e+"/"+a+"add_items_action.js",type:"angular"},{name:"update_items",url:e+"/"+a+"update_items_action.js",type:"angular"},{name:"install_app",url:e+"/"+a+"install_app_action.js",type:"angular"},{name:"search_action",url:e+"/"+a+"search_action.js",type:"angular"},{name:"filter_table",url:e+"/"+a+"filter_table_action.js",type:"angular"},{name:"slider",url:e+"/"+a+"slider_data.js",type:"angular"},{name:"clone_item",url:e+"/"+a+"clone_item_action.js",type:"angular"},{name:"close",url:e+"/"+a+"close_action.js",type:"angular"},{name:"phone",url:e+"/"+a+"phone_data.js",type:"angular"},{name:"link",url:e+"/"+a+"link_data.js",type:"angular"},{name:"sheduling",url:e+"/"+a+"sheduling_data.js",type:"angular"},{name:"qrcode",url:e+"/"+a+"qrcode_data.js",type:"angular"},{name:"graph2d",url:e+"/"+a+"graph2d_data.js",type:"angular"},{name:"quote_tool",url:e+"/"+a+"quote_tool_data.js",type:"angular"},{name:"cards",url:e+"/"+a+"cards_data.js",type:"angular"},{name:"jsonConstructor",url:e+"/"+a+"json_constructor_data.js",type:"angular"},{name:"button",js:"https://gudhub.com/modules/button_action/button_action.js",type:"class"},{name:"editorjs",js:"https://gudhub.com/modules/Editor-Js/dist/main.js",css:"https://gudhub.com/modules/Editor-Js/dist/style.css",type:"class"},{name:"filter_advanced",url:e+"/"+a+"filter_advanced_data.js",type:"angular"},{name:"code_editor",url:e+"/"+a+"code_editor_data.js",type:"angular"},{name:"icon",url:e+"/"+a+"icon_data.js",type:"angular"},{name:"quoteRequest",url:e+"/"+a+"quote_request_data.js",type:"angular"},{name:"view_container",url:e+"/"+a+"view_container_data.js",type:"angular"},{name:"element_ref",url:e+"/"+a+"element_ref_data.js",type:"angular"},{name:"quote_tool_objects_renderer",url:e+"/"+a+"quote_tool_objects_renderer_data.js",type:"angular"},{name:"quote_tool_objects_renderer_generator",url:e+"/"+a+"quote_tool_objects_renderer_generator_data.js",type:"angular"},{name:"trigger",url:e+"/"+a+"trigger_data.js",type:"angular"},{name:"voting",url:e+"/"+a+"voting_data.js",type:"angular"},{name:"view_tabs",url:e+"/"+a+"view_tabs.js",type:"angular"},{name:"filter_tabs",url:e+"/"+a+"filter_tabs.js",type:"angular"},{name:"gps_coords",url:e+"/"+a+"gps_coords.js",type:"angular"},{name:"google_map",url:e+"/"+a+"google_map_data.js",type:"angular"},{name:"data_migrations",url:e+"/"+a+"data_migrations.js",type:"angular"},{name:"additional_settings",url:e+"/"+a+"gh_additional_settings_data.js",type:"angular"},{name:"send_request",url:e+"/"+a+"send_request_data.js",type:"angular"},{name:"webcam",url:e+"/"+a+"webcam_data.js",type:"angular"},{name:"json_viewer",url:e+"/"+a+"json_viewer_data.js",type:"angular"},{name:"notifications",url:e+"/"+a+"notifications_data.js",type:"angular"},{name:"api",url:e+"/"+a+"api_data.js",type:"angular"},{name:"smart_input",url:e+"/"+a+"smart_input_data.js",type:"angular"},{name:"json_editor",url:e+"/"+a+"json_editor_data.js",type:"angular"},{name:"grapes_html_editor",url:e+"/"+a+"grapes_html_editor_data.js",type:"angular"},{name:"quiz",url:e+"/"+a+"quiz_data.js",type:"angular"},{name:"markdown_viewer",url:e+"/"+a+"markdown_viewer_data.js",type:"angular"},{name:"password_input",url:e+"/"+a+"password_input_data.js",type:"angular"},{name:"vs_code",url:e+"/"+a+"vs_code_data.js",type:"angular"},{name:"nested_list",js:"https://gudhub.com/modules/Nested-List/dist/main.js",css:"https://gudhub.com/modules/Nested-List/dist/style.css",type:"class"},{name:"fullcalendar",js:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/main.js",css:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/style.css",type:"class"},{name:"countertop_smart_quote",url:e+"/"+a+"countertop_smart_quote_data.js",type:"angular"},{name:"markdown_viewer_web_component",js:"https://gudhub.com/modules/markdown-it-gh-element/dist/main.js",css:"https://gudhub.com/modules/markdown-it-gh-element/dist/style.css",type:"class"}]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=a;
107
+ "use strict";function a(a,e){return[{name:"text",url:e+"/"+a+"text_data.js",type:"angular"},{name:"text_opt",url:e+"/"+a+"text_options_data.js",type:"angular"},{name:"number",url:e+"/"+a+"number_data.js",type:"angular"},{name:"task_board",url:e+"/"+a+"task_board_data.js",type:"angular"},{name:"visualizer",url:e+"/"+a+"visualizer_data.js",type:"angular"},{name:"enterprice_visualizer",url:e+"/"+a+"enterprice_visualizer_data.js",type:"angular"},{name:"email",url:e+"/"+a+"email_data.js",type:"angular"},{name:"date",url:e+"/"+a+"date_data.js",type:"angular"},{name:"radio_button",url:e+"/"+a+"radio_button_data.js",type:"angular"},{name:"radio_icon",url:e+"/"+a+"radio_icon_data.js",type:"angular"},{name:"twilio_phone",url:e+"/"+a+"twilio_phone_data.js",type:"angular"},{name:"twilio_autodialer",url:e+"/"+a+"twillio_autodialer_data.js",type:"angular"},{name:"color",url:e+"/"+a+"color_data.js",type:"angular"},{name:"charts",url:e+"/"+a+"charts_data.js",type:"angular"},{name:"funnel_chart",url:e+"/"+a+"funnel_chart_data.js",type:"angular"},{name:"add_items_from_template",url:e+"/"+a+"add_items_from_template_data.js",type:"angular"},{name:"item_ref",url:e+"/"+a+"itemRef_data.js",type:"angular"},{name:"calendar",js:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/main.js",css:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/style.css",type:"class"},{name:"data_ref",url:e+"/"+a+"data_ref_data.js",type:"angular"},{name:"table",url:e+"/"+a+"table_data.js",type:"angular"},{name:"tile",url:e+"/"+a+"tile_data.js",type:"angular"},{name:"file",url:e+"/"+a+"file_data.js",type:"angular"},{name:"image",url:e+"/"+a+"image_data.js",type:"angular"},{name:"text_editor",url:e+"/"+a+"text_editor_data.js",type:"angular"},{name:"tinymse",url:e+"/"+a+"tinymse_data.js",type:"angular"},{name:"duration",url:e+"/"+a+"duration_data.js",type:"angular"},{name:"user",url:e+"/"+a+"user_data.js",type:"angular"},{name:"app",url:e+"/"+a+"application_data.js",type:"angular"},{name:"field",url:e+"/"+a+"field_data.js",type:"angular"},{name:"available",url:e+"/"+a+"available_data.js",type:"angular"},{name:"view_list",url:e+"/"+a+"view_list_data.js",type:"angular"},{name:"calculator",url:e+"/"+a+"calculator_data.js",type:"angular"},{name:"string_join",url:e+"/"+a+"string_joiner_data.js",type:"angular"},{name:"signature",url:e+"/"+a+"signature_data.js",type:"angular"},{name:"sendEmail",url:e+"/"+a+"send_email_data.js",type:"angular"},{name:"boolean",url:e+"/"+a+"boolean_data.js",type:"angular"},{name:"product_gallery",url:e+"/"+a+"product_gallery_data.js",type:"angular"},{name:"online_inventory",url:e+"/"+a+"online_inventory_data.js",type:"angular"},{name:"3d_edges",url:e+"/"+a+"3d_edges_data.js",type:"angular"},{name:"color_list",url:e+"/"+a+"color_list_data.js",type:"angular"},{name:"go_to_link",url:e+"/"+a+"go_to_link_data.js",type:"angular"},{name:"go_to_view",url:e+"/"+a+"go_to_view_data.js",type:"angular"},{name:"range",url:e+"/"+a+"range_data.js",type:"angular"},{name:"barcode",url:e+"/"+a+"barcode_data.js",type:"angular"},{name:"item_remote_add",url:e+"/"+a+"item_remote_add_data.js",type:"angular"},{name:"item_remote_update",url:e+"/"+a+"item_remote_update_data.js",type:"angular"},{name:"timeline",url:e+"/"+a+"timeline_data.js",type:"angular"},{name:"delete_item",url:e+"/"+a+"delete_action.js",type:"angular"},{name:"print_doc",url:e+"/"+a+"print_doc_action.js",type:"angular"},{name:"open_item",url:e+"/"+a+"open_item_action.js",type:"angular"},{name:"edit_template",url:e+"/"+a+"edit_template_action.js",type:"angular"},{name:"open_app",url:e+"/"+a+"open_app_action.js",type:"angular"},{name:"user_settings",url:e+"/"+a+"user_settings_action.js",type:"angular"},{name:"app_sharing",url:e+"/"+a+"sharing_action.js",type:"angular"},{name:"app_constructor",url:e+"/"+a+"app_constructor_action.js",type:"angular"},{name:"export_csv",url:e+"/"+a+"export_csv.js",type:"angular"},{name:"import_csv",url:e+"/"+a+"import_csv.js",type:"angular"},{name:"add_items",url:e+"/"+a+"add_items_action.js",type:"angular"},{name:"update_items",url:e+"/"+a+"update_items_action.js",type:"angular"},{name:"install_app",url:e+"/"+a+"install_app_action.js",type:"angular"},{name:"search_action",url:e+"/"+a+"search_action.js",type:"angular"},{name:"filter_table",url:e+"/"+a+"filter_table_action.js",type:"angular"},{name:"slider",url:e+"/"+a+"slider_data.js",type:"angular"},{name:"clone_item",url:e+"/"+a+"clone_item_action.js",type:"angular"},{name:"close",url:e+"/"+a+"close_action.js",type:"angular"},{name:"phone",url:e+"/"+a+"phone_data.js",type:"angular"},{name:"link",url:e+"/"+a+"link_data.js",type:"angular"},{name:"sheduling",url:e+"/"+a+"sheduling_data.js",type:"angular"},{name:"qrcode",url:e+"/"+a+"qrcode_data.js",type:"angular"},{name:"graph2d",url:e+"/"+a+"graph2d_data.js",type:"angular"},{name:"quote_tool",url:e+"/"+a+"quote_tool_data.js",type:"angular"},{name:"cards",url:e+"/"+a+"cards_data.js",type:"angular"},{name:"jsonConstructor",url:e+"/"+a+"json_constructor_data.js",type:"angular"},{name:"button",js:"https://gudhub.com/modules/button_action/button_action.js",type:"class"},{name:"editorjs",js:"https://gudhub.com/modules/Editor-Js/dist/main.js",css:"https://gudhub.com/modules/Editor-Js/dist/style.css",type:"class"},{name:"filter_advanced",url:e+"/"+a+"filter_advanced_data.js",type:"angular"},{name:"code_editor",url:e+"/"+a+"code_editor_data.js",type:"angular"},{name:"icon",url:e+"/"+a+"icon_data.js",type:"angular"},{name:"quoteRequest",url:e+"/"+a+"quote_request_data.js",type:"angular"},{name:"view_container",url:e+"/"+a+"view_container_data.js",type:"angular"},{name:"element_ref",url:e+"/"+a+"element_ref_data.js",type:"angular"},{name:"quote_tool_objects_renderer",url:e+"/"+a+"quote_tool_objects_renderer_data.js",type:"angular"},{name:"quote_tool_objects_renderer_generator",url:e+"/"+a+"quote_tool_objects_renderer_generator_data.js",type:"angular"},{name:"trigger",url:e+"/"+a+"trigger_data.js",type:"angular"},{name:"voting",url:e+"/"+a+"voting_data.js",type:"angular"},{name:"view_tabs",url:e+"/"+a+"view_tabs.js",type:"angular"},{name:"filter_tabs",url:e+"/"+a+"filter_tabs.js",type:"angular"},{name:"gps_coords",url:e+"/"+a+"gps_coords.js",type:"angular"},{name:"google_map",url:e+"/"+a+"google_map_data.js",type:"angular"},{name:"data_migrations",url:e+"/"+a+"data_migrations.js",type:"angular"},{name:"additional_settings",url:e+"/"+a+"gh_additional_settings_data.js",type:"angular"},{name:"send_request",url:e+"/"+a+"send_request_data.js",type:"angular"},{name:"webcam",url:e+"/"+a+"webcam_data.js",type:"angular"},{name:"json_viewer",url:e+"/"+a+"json_viewer_data.js",type:"angular"},{name:"notifications",url:e+"/"+a+"notifications_data.js",type:"angular"},{name:"api",url:e+"/"+a+"api_data.js",type:"angular"},{name:"smart_input",url:e+"/"+a+"smart_input_data.js",type:"angular"},{name:"json_editor",url:e+"/"+a+"json_editor_data.js",type:"angular"},{name:"grapes_html_editor",url:e+"/"+a+"grapes_html_editor_data.js",type:"angular"},{name:"quiz",url:e+"/"+a+"quiz_data.js",type:"angular"},{name:"markdown_viewer",url:e+"/"+a+"markdown_viewer_data.js",type:"angular"},{name:"password_input",url:e+"/"+a+"password_input_data.js",type:"angular"},{name:"vs_code",url:e+"/"+a+"vs_code_data.js",type:"angular"},{name:"nested_list",js:"https://gudhub.com/modules/Nested-List/dist/main.js",css:"https://gudhub.com/modules/Nested-List/dist/style.css",type:"class"},{name:"fullcalendar",js:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/main.js",css:"https://gudhub.com/modules/FullCalendar-Gh-Element/dist/style.css",type:"class"},{name:"countertop_smart_quote",url:e+"/"+a+"countertop_smart_quote_data.js",type:"angular"},{name:"markdown_viewer_web_component",js:"https://gudhub.com/modules/markdown-it-gh-element/dist/main.js",css:"https://gudhub.com/modules/markdown-it-gh-element/dist/style.css",type:"class"}]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=a;
108
108
  },{}],"CSHe":[function(require,module,exports) {
109
109
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Storage=void 0;var t=e(require("./ModulesList.js"));function e(t){return t&&t.__esModule?t:{default:t}}function r(t){return s(t)||u(t)||i(t)||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 i(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function u(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function s(t){if(Array.isArray(t))return a(t)}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function o(t,e,r,n,i,u,s){try{var a=t[u](s),o=a.value}catch(p){return void r(p)}a.done?e(o):Promise.resolve(o).then(n,i)}function p(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var u=t.apply(e,r);function s(t){o(u,n,i,s,a,"next",t)}function a(t){o(u,n,i,s,a,"throw",t)}s(void 0)})}}function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach(function(e){f(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function f(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function d(t,e,r){return e&&v(t.prototype,e),r&&v(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var y=function(){function e(r,n){h(this,e),this.apps_list=[],this.users_list=[],this.user={},this.modulesList=(0,t.default)(r,n),this.ghComponentsPromises=[]}return d(e,[{key:"getMainStorage",value:function(){return this}},{key:"getAppsList",value:function(){return this.apps_list}},{key:"getUser",value:function(){return this.user}},{key:"getUsersList",value:function(){return this.users_list}},{key:"getModulesList",value:function(){return this.modulesList}},{key:"getModuleUrl",value:function(t){return this.modulesList.find(function(e){return e.name==t})}},{key:"setUser",value:function(t){this.user=t,this.users_list.push(t)}},{key:"updateUser",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.avatar_128&&(t.avatar_128=t.avatar_128+"?"+(new Date).getTime()),t.avatar_512&&(t.avatar_512=t.avatar_512+"?"+(new Date).getTime()),this.user=l(l({},this.user),t),this.users_list=this.users_list.filter(function(e){return e.user_id!=t.user_id}),this.users_list.push(this.user)}},{key:"unsetUser",value:function(){this.user={}}},{key:"getApp",value:function(t){return this.apps_list.find(function(e){return e.app_id==t})}},{key:"unsetApps",value:function(){this.apps_list=[]}},{key:"updateApp",value:function(t){return this.apps_list=this.apps_list.map(function(e){return e.app_id==t.app_id?t:e}),this.apps_list}},{key:"deleteApp",value:function(t){return this.apps_list=this.apps_list.filter(function(e){return e.app_id!=t}),this.apps_list}},{key:"updateItemsInApp",value:function(){var t=p(regeneratorRuntime.mark(function t(e,r){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getApp(r);case 2:return(n=t.sent)&&(n.items_list=updateItems(e,n.items_list,this.pipeService.emit.bind(this.pipeService),r),this.updateApp(n)),t.abrupt("return",n);case 5:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"addItemsToApp",value:function(){var t=p(regeneratorRuntime.mark(function t(e,n){var i,u;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getApp(n);case 2:return(i=t.sent)&&((u=i.items_list).push.apply(u,r(e)),this.updateApp(i),this.pipeService.emit("gh_items_update",{app_id:n},e)),t.abrupt("return",i);case 5:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"deleteItemsInApp",value:function(){var t=p(regeneratorRuntime.mark(function t(e,r){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getApp(r);case 2:return(n=t.sent)&&(n.items_list=n.items_list.filter(function(t){return!e.find(function(e){return e.item_id==t.item_id})}),this.updateApp(n)),t.abrupt("return",n);case 5:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()}]),e}();exports.Storage=y;
110
110
  },{"./ModulesList.js":"FJWL"}],"p58b":[function(require,module,exports) {
@@ -112,7 +112,7 @@ var t="function"==typeof Map&&Map.prototype,e=Object.getOwnPropertyDescriptor&&t
112
112
  },{}],"pHMV":[function(require,module,exports) {
113
113
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WebSocketApi=void 0;var e=t(require("ws"));function t(e){return e&&e.__esModule?e:{default:e}}function n(e,t,n,r,o,s,i){try{var a=e[s](i),c=a.value}catch(u){return void n(u)}a.done?t(c):Promise.resolve(c).then(r,o)}function r(e){return function(){var t=this,r=arguments;return new Promise(function(o,s){var i=e.apply(t,r);function a(e){n(i,o,s,a,c,"next",e)}function c(e){n(i,o,s,a,c,"throw",e)}a(void 0)})}}function o(e){return(o="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 s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var c=function(){function t(e,n){s(this,t),this.websocket=null,this.connected=!1,this.queue=[],this.url=e,this.auth=n,this.heartBeatTimeStemp=1e13,this.ALLOWED_HEART_BEAT_DELEY=12e3,this.firstHeartBeat=!0,this.reload=!0,this.isBrowser=!["undefined"==typeof window?"undefined":o(window),"undefined"==typeof document?"undefined":o(document)].includes("undefined")}return a(t,[{key:"addSubscription",value:function(){var e=r(regeneratorRuntime.mark(function e(t){var n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.auth.getToken();case 2:n=e.sent,r="token=".concat(n,"/~/app_id=").concat(t),this.connected&&this.websocket.send(r),this.queue.push(t);case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"onOpen",value:function(){var e=r(regeneratorRuntime.mark(function e(){var t,n=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.reload=!0,console.log("websocket opened"),this.connected=!0,e.next=5,this.auth.getToken();case 5:t=e.sent,this.queue.forEach(function(e){var r="token=".concat(t,"/~/app_id=").concat(e);n.websocket.send(r)});case 7:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"onError",value:function(e){console.log("websocket error: ",e),this.websocket.close()}},{key:"onClose",value:function(){console.log("websocket close"),this.connected=!1,this.initWebSocket()}},{key:"onMessage",value:function(){var e=r(regeneratorRuntime.mark(function e(t){var n,r,o,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.isBrowser?t.data:t).match(/HeartBeat/)){e.next=10;break}if(r=(new Date).getTime()-this.heartBeatTimeStemp,!(this.ALLOWED_HEART_BEAT_DELEY<r)){e.next=8;break}return e.next=6,this.onConnectionLost();case 6:e.next=10;break;case 8:this.websocket.send("HeartBeat"),this.heartBeatTimeStemp=(new Date).getTime();case 10:if(this.firstHeartBeat&&(this.connectionChecker(),this.firstHeartBeat=!1),!n.match(/[{}]/)){e.next=17;break}return o=JSON.parse(n),e.next=15,this.auth.getToken();case 15:s=e.sent,o.token!=s&&this.onMassageHandler(o);case 17:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"initWebSocket",value:function(t,n){this.onMassageHandler=t,this.refreshAppsHandler=n,this.isBrowser?(this.websocket=new WebSocket(this.url),this.websocket.onopen=this.onOpen.bind(this),this.websocket.onerror=this.onError.bind(this),this.websocket.onclose=this.onClose.bind(this),this.websocket.onmessage=this.onMessage.bind(this)):(this.websocket=new e.default(this.url),this.websocket.on("open",this.onOpen),this.websocket.on("error",this.onError),this.websocket.on("close",this.onClose),this.websocket.on("message",this.onMessage)),console.log("websocket initialized")}},{key:"connectionChecker",value:function(){var e=this;setInterval(r(regeneratorRuntime.mark(function t(){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=(new Date).getTime()-e.heartBeatTimeStemp,!(e.ALLOWED_HEART_BEAT_DELEY<n)){t.next=4;break}return t.next=4,e.onConnectionLost();case 4:case"end":return t.stop()}},t)})),1e3)}},{key:"onConnectionLost",value:function(){var e=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.auth.getVersion();case 3:this.reload&&(this.reload=!1,console.log("Connected"),this.heartBeatTimeStemp=1e13,this.websocket.close(),this.refreshAppsHandler(this.queue)),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),console.log(e.t0);case 9:case"end":return e.stop()}},e,this,[[0,6]])}));return function(){return e.apply(this,arguments)}}()}]),t}();exports.WebSocketApi=c;
114
114
  },{"ws":"p58b"}],"TPH7":[function(require,module,exports) {
115
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.wss_url=exports.server_url=exports.port=void 0;var r="http://localhost:9000";exports.server_url=r;var e="wss://gudhub.com/GudHub/ws/app/";exports.wss_url=e;var s=9e3;exports.port=s;
115
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.wss_url=exports.server_url=exports.port=exports.file_server_url=exports.async_modules_path=void 0;var r="https://gudhub.com/GudHub";exports.server_url=r;var e="wss://gudhub.com/GudHub/ws/app/";exports.wss_url=e;var s="build/async_modules_node/";exports.async_modules_path=s;var o="http://localhost:8080";exports.file_server_url=o;var t=9e3;exports.port=t;
116
116
  },{}],"DvAj":[function(require,module,exports) {
117
117
  "use strict";function e(e,r){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=t(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var a=0,u=function(){};return{s:u,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(c)throw o}}}}function t(e,t){if(e){if("string"==typeof e)return r(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)?r(e,t):void 0}}function r(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 n(e,t,r,n,a,u,o){try{var i=e[u](o),c=i.value}catch(l){return void r(l)}i.done?t(c):Promise.resolve(c).then(n,a)}function a(e){return function(){var t=this,r=arguments;return new Promise(function(a,u){var o=e.apply(t,r);function i(e){n(o,a,u,i,c,"next",e)}function c(e){n(o,a,u,i,c,"throw",e)}i(void 0)})}}function u(e,t,r,n,a,u){return o.apply(this,arguments)}function o(){return(o=a(regeneratorRuntime.mark(function t(r,n,a,u,o,i){var c,l,f,s,p,v,h,b,d,y,g=arguments;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(y=function(e){return new Promise(function(t){i.on("gh_value_get",e,function r(n,a){i.destroy("gh_value_get",e,r),t(a)}).emit("gh_value_get",{},e)})},c=g.length>6&&void 0!==g[6]?g[6]:[],l=[],f={variableMethodcurrent_app:function(){return[a]},variableMethodelement_app:function(){return[n]},variableMethodcurrent_item:function(){return["".concat(a,".").concat(u)]},variableMethoduser_id:function(){return[o.getUser().user_id]},variableMethoduser_email:function(e){return[o.getUser().username]},variableMethodtoday:function(e){var t=new Date,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()),n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1);return[r.valueOf().toString()+":"+n.valueOf().toString()]},variableMethodvariable:function(){return c}},!r){t.next=40;break}s=e(r),t.prev=6,s.s();case 8:if((p=s.n()).done){t.next=32;break}if(!(v=p.value)){t.next=29;break}t.t0=v.input_type,t.next="variable"===t.t0?14:"field"===t.t0?19:25;break;case 14:return h=v.input_type+"Method"+v.input_value,b=f[h],v.valuesArray="function"==typeof b?b():f.variableMethodvariable(),l.push(v),t.abrupt("break",27);case 19:return t.next=21,y({app_id:a,item_id:u,field_id:v.input_value});case 21:return null!=(d=t.sent)&&v.valuesArray.push(d),l.push(v),t.abrupt("break",27);case 25:return l.push(v),t.abrupt("break",27);case 27:t.next=30;break;case 29:l.push(v);case 30:t.next=8;break;case 32:t.next=37;break;case 34:t.prev=34,t.t1=t.catch(6),s.e(t.t1);case 37:return t.prev=37,s.f(),t.finish(37);case 40:return t.abrupt("return",l);case 41:case"end":return t.stop()}},t,null,[[6,34,37,40]])}))).apply(this,arguments)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.filterPreparation=u;
118
118
  },{}],"jqRt":[function(require,module,exports) {
@@ -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,18 +180,18 @@ 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,o){return _createAngularModuleInstance.apply(this,arguments)}function _createAngularModuleInstance(){return _createAngularModuleInstance=_asyncToGenerator(regeneratorRuntime.mark(function _callee4(gudhub,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(gudhub,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,o){return c.apply(this,arguments)}function c(){return(c=a(regeneratorRuntime.mark(function r(o,u,c,i,s){var l,p,f,d,g,m;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,c||console.error("JS link must be provided for this data type - ".concat(u)),l=function(r){return n.IS_WEB||e.hasOwnProperty("window")||(e.window=proxy,e.document=s.document,e.Element=s.Element,e.CharacterData=s.CharacterData,e.this=proxy,e.self=proxy,e.Blob=s.Blob,e.Node=s.Node,e.navigator=s.navigator,e.HTMLElement=s.HTMLElement,e.XMLHttpRequest=s.XMLHttpRequest,e.WebSocket=s.WebSocket,e.crypto=s.crypto,e.DOMParser=s.DOMParser,e.Symbol=s.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 o,a;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(u))});case 2:o=e.sent,a=encodeURIComponent(o.data),n("data:text/javascript;charset=utf-8,"+a);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())},r.next=5,l(c);case 5:return p=r.sent,r.prev=6,r.next=9,import(p);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(u)),console.log(r.t0);case 16:return d=new f.default(u),i&&n.IS_WEB&&((g=document.createElement("link")).href=i,g.setAttribute("data-module",u),g.setAttribute("rel","stylesheet"),document.getElementsByTagName("head")[0].appendChild(g)),m={type:u,getTemplate:function(e,t,n,r,o,a){var u="false"!==n;return d.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=d.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 d.getSettings(e,t,n)},filter:{getSearchOptions:function(e){var t=d;return t.filter&&t.filter.getSearchOptions?d.filter.getSearchOptions(e):[]},getDropdownValues:function(){var e=d;return e.filter&&e.filter.getDropdownValues?e.filter.getDropdownValues():[]}},getInterpretation:function(e,t,n,r,c,i){return new Promise(function(){var s=a(regeneratorRuntime.mark(function a(s){var l,p,f,g;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return l=d,a.prev=1,a.next=4,l.getInterpretation(o,e,i,c,r,n);case 4:return p=a.sent,f=p.find(function(e){return e.id==t})||p.find(function(e){return"default"==e.id}),a.next=8,f.content();case 8:g=a.sent,s({html:g}),a.next=16;break;case 12:a.prev=12,a.t0=a.catch(1),console.log("ERROR IN ".concat(u),a.t0),s({html:"<span>no interpretation</span>"});case 16:case"end":return a.stop()}},a,null,[[1,12]])}));return function(e){return s.apply(this,arguments)}}())},getInterpretationsList:function(e,t,n,r){return d.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=d.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){d.getActionScope(e)},runAction:function(e){try{d.runAction(e)}catch(t){}},getWindowScope:function(e){return d.getWindowScope(e)},getWindowHTML:function(e){return d.getWindowHTML(e)}},r.abrupt("return",m);case 22:r.prev=22,r.t1=r.catch(0),console.log(r.t1),console.log("Failed in createClassInstance (ghconstructor). Module id: ".concat(u,". JS url: ").concat(c));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)(this.gudhub,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)(this.gudhub,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
- "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;
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 d(e,t,r){return t&&v(e.prototype,t),r&&v(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var g=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 d(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){e.items_object={};for(var t=0;t<e.items_list.length;t++){e.items_object[e.items_list[t].item_id]={};for(var r=0;r<e.items_list[t].fields.length;r++)e.items_object[e.items_list[t].item_id][e.items_list[t].fields[r].field_id]=e.items_list[t].fields[r]}var n=this.storage.getApp(e.app_id);return n?(e.from_apps_list=n.from_apps_list,e.permission=n.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,e.items_object=r.items_object,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,s,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=o.length>0&&void 0!==o[0]?o[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:if(a=e.sent){for(a.items_object={},p=0;p<a.items_list.length;p++)for(a.items_object[a.items_list[p].item_id]={},s=0;s<a.items_list[p].fields.length;s++)a.items_object[a.items_list[p].item_id][a.items_list[p].fields[s].field_id]=a.items_list[p].fields[s];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=this,p=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(p.length>1&&void 0!==p[1]&&p[1],r){e.next=3;break}return e.abrupt("return",null);case 3:if(n=this.getAppFromStorage(r)){e.next=11;break}return e.next=7,this.getAppApi(r);case 7:if(i=e.sent){e.next=10;break}return e.abrupt("return",null);case 10:i.chunks&&i.chunks.length?(this.chunksManager.getChunks(r,i.chunks).then(function(e){i.items_list=a.util.mergeChunks([].concat(t(e),[i])),a.saveAppInStorage(i),a.pipeService.emit("gh_items_update",{app_id:r},i.items_list)}),n=i,this.saveAppInStorage(i)):(n=this.getAppFromStorage(r))||(n=i,this.saveAppInStorage(i),this.ws.addSubscription(r));case 11:return e.abrupt("return",n);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).items_object={},this.addNewAppToStorage(r),e.abrupt("return",r);case 6: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=g;
191
191
  },{"../consts.js":"UV2u"}],"UUd3":[function(require,module,exports) {
192
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ItemProcessor=void 0;var e=require("../utils.js");function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function r(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t,r,i,n,a,s){try{var u=e[a](s),p=u.value}catch(o){return void r(o)}u.done?t(p):Promise.resolve(p).then(i,n)}function a(e){return function(){var t=this,r=arguments;return new Promise(function(i,a){var s=e.apply(t,r);function u(e){n(s,i,a,u,p,"next",e)}function p(e){n(s,i,a,u,p,"throw",e)}u(void 0)})}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function p(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var o=function(){function t(e,r,i,n,a){s(this,t),this.storage=e,this.pipeService=r,this.req=i,this.appProcessor=n,this.util=a,this.itemListeners()}return p(t,[{key:"addItemsApi",value:function(){var e=a(regeneratorRuntime.mark(function e(t,r){var i;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/items/add",form:{items:JSON.stringify(r),app_id:t}});case 3:return i=e.sent,e.abrupt("return",i);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,r){return e.apply(this,arguments)}}()},{key:"updateItemsApi",value:function(){var e=a(regeneratorRuntime.mark(function e(t,r){var i;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/items/update",form:{items:JSON.stringify(r),app_id:t}});case 3:return i=e.sent,e.abrupt("return",i);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,r){return e.apply(this,arguments)}}()},{key:"deleteItemsApi",value:function(e){try{var t=this.req.post({url:"/api/items/delete",form:{items_ids:JSON.stringify(e)}});return t.from_apps_list=!0,t}catch(r){return console.log(r),null}}},{key:"addItemsToStorage",value:function(e,t){var r=this,i=this.storage.getApp(e);return i&&(t.forEach(function(t){i.items_list.push(t),r.pipeService.emit("gh_item_update",{app_id:e},[t])}),this.pipeService.emit("gh_items_update",{app_id:e},i.items_list),this.storage.updateApp(i)),i}},{key:"updateItemsInStorage",value:function(e,t){var r=this;this.pipeService.emit("gh_items_update",{app_id:e},t);var i=this.storage.getApp(e);return i&&t&&t.forEach(function(t){var n={app_id:e};r.pipeService.emit("gh_item_update",n,[t]),n.item_id=t.item_id,r.pipeService.emit("gh_item_update",n,t);var a=i.items_list.find(function(e){return e.item_id==t.item_id});a&&t.fields.forEach(function(e){var t=a.fields.find(function(t){return t.field_id==e.field_id});n.field_id=e.field_id,t?t.field_value!=e.field_value&&(t.field_value=e.field_value,r.pipeService.emit("gh_value_update",n,e.field_value)):(a.fields.push(e),r.pipeService.emit("gh_value_update",n,e.field_value))})}),t}},{key:"deleteItemsFromStorage",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=this.storage.getApp(e);r&&(r.items_list=r.items_list.filter(function(e){return!t.includes(e.item_id)}),this.pipeService.emit("gh_items_update",{app_id:e},r.items_list),this.storage.updateApp(r))}},{key:"getItems",value:function(){var e=a(regeneratorRuntime.mark(function e(t){var r,i,n=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]&&n[1],e.next=3,this.appProcessor.getApp(t,r);case 3:if(i=e.sent){e.next=6;break}return e.abrupt("return",null);case 6:return e.abrupt("return",i.items_list);case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"addNewItems",value:function(){var t=a(regeneratorRuntime.mark(function t(i,n){var a,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=n.map(function(t){return r(r({},t),{},{fields:(0,e.filterFields)(t.fields)})}),t.next=3,this.addItemsApi(i,a);case 3:return s=t.sent,this.addItemsToStorage(i,s),this.pipeService.emit("gh_items_add",{app_id:i},s),t.abrupt("return",s);case 7:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"updateItems",value:function(){var t=a(regeneratorRuntime.mark(function t(i,n){var a,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=n.map(function(t){return r(r({},t),{},{fields:(0,e.filterFields)(t.fields)})}),t.next=3,this.updateItemsApi(i,a);case 3:return s=t.sent,t.abrupt("return",this.updateItemsInStorage(i,s));case 5:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"deleteItems",value:function(){var e=a(regeneratorRuntime.mark(function e(t,r){var i=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.deleteItemsApi(r).then(function(){return i.deleteItemsFromStorage(t,r)}));case 1:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"itemListeners",value:function(){var e=this;this.pipeService.onRoot("gh_items_get",{},function(){var t=a(regeneratorRuntime.mark(function t(r,i){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!i||!i.app_id){t.next=5;break}return t.next=3,e.getItems(i.app_id);case 3:(n=t.sent)?e.pipeService.emit("gh_items_get",i,n):e.pipeService.emit("gh_items_get",i,[]);case 5:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_items_add",{},function(){var t=a(regeneratorRuntime.mark(function t(r,i){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(i&&i.app_id&&i.items)){t.next=5;break}return t.next=3,e.addNewItems(i.app_id,i.items);case 3:(n=t.sent)?e.pipeService.emit("gh_items_add",i,n):e.pipeService.emit("gh_items_add",i,[]);case 5:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_items_update",{},function(){var t=a(regeneratorRuntime.mark(function t(r,i){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(i&&i.app_id&&i.items)){t.next=5;break}return t.next=3,e.updateItems(i.app_id,i.items);case 3:(n=t.sent)?e.pipeService.emit("gh_items_update",i,n):e.pipeService.emit("gh_items_update",i,[]);case 5:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_item_get",{},function(){var t=a(regeneratorRuntime.mark(function t(r,i){var n,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!i||!i.app_id){t.next=6;break}return t.next=3,e.getItems(i.app_id);case 3:n=t.sent,a=n.find(function(e){return e.item_id==i.item_id}),e.pipeService.emit("gh_item_get",i,a);case 6:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_filtered_items_get",{},function(){var t=a(regeneratorRuntime.mark(function t(r,i){var n,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!i||!i.element_app_id){t.next=8;break}return t.next=3,e.getItems(i.element_app_id);case 3:return n=t.sent,t.next=6,e.util.getFilteredItems(n,i.filters_list,i.element_app_id,i.app_id,i.item_id,i.field_groupe,i.search,i.search_params);case 6:a=t.sent,e.pipeService.emit("gh_filtered_items_get",i,a);case 8:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_filter_items",{},function(){var t=a(regeneratorRuntime.mark(function t(r,i){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!i||!i.items){t.next=5;break}return t.next=3,e.util.getFilteredItems(i.items,i.filters_list,i.element_app_id,i.app_id,i.item_id,i.field_groupe,i.search,i.search_params);case 3:n=t.sent,e.pipeService.emit("gh_filter_items",i,n);case 5:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}())}}]),t}();exports.ItemProcessor=o;
192
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ItemProcessor=void 0;var e=require("../utils.js");function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function r(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t,r,i,n,a,s){try{var u=e[a](s),p=u.value}catch(o){return void r(o)}u.done?t(p):Promise.resolve(p).then(i,n)}function a(e){return function(){var t=this,r=arguments;return new Promise(function(i,a){var s=e.apply(t,r);function u(e){n(s,i,a,u,p,"next",e)}function p(e){n(s,i,a,u,p,"throw",e)}u(void 0)})}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function p(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var o=function(){function t(e,r,i,n,a){s(this,t),this.storage=e,this.pipeService=r,this.req=i,this.appProcessor=n,this.util=a,this.itemListeners()}return p(t,[{key:"addItemsApi",value:function(){var e=a(regeneratorRuntime.mark(function e(t,r){var i;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/items/add",form:{items:JSON.stringify(r),app_id:t}});case 3:return i=e.sent,e.abrupt("return",i);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,r){return e.apply(this,arguments)}}()},{key:"updateItemsApi",value:function(){var e=a(regeneratorRuntime.mark(function e(t,r){var i;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/items/update",form:{items:JSON.stringify(r),app_id:t}});case 3:return i=e.sent,e.abrupt("return",i);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,r){return e.apply(this,arguments)}}()},{key:"deleteItemsApi",value:function(e){try{var t=this.req.post({url:"/api/items/delete",form:{items_ids:JSON.stringify(e)}});return t.from_apps_list=!0,t}catch(r){return console.log(r),null}}},{key:"addItemsToStorage",value:function(e,t){var r=this,i=this.storage.getApp(e);return i&&(t.forEach(function(t){i.items_list.push(t),i.items_object[t.item_id]={};for(var n=0;n<t.fields.length;n++)i.items_object[t.item_id][t.fields[n].field_id]=t.fields[n];r.pipeService.emit("gh_item_update",{app_id:e},[t])}),this.pipeService.emit("gh_items_update",{app_id:e},i.items_list),this.storage.updateApp(i)),i}},{key:"updateItemsInStorage",value:function(e,t){var r=this;this.pipeService.emit("gh_items_update",{app_id:e},t);var i=this.storage.getApp(e);return i&&t&&t.forEach(function(t){var n={app_id:e};r.pipeService.emit("gh_item_update",n,[t]),n.item_id=t.item_id,r.pipeService.emit("gh_item_update",n,t);var a=i.items_list.find(function(e){return e.item_id==t.item_id});a&&t.fields.forEach(function(e){var t=a.fields.find(function(t){return t.field_id==e.field_id});n.field_id=e.field_id,t?t.field_value!=e.field_value&&(t.field_value=e.field_value,i.items_object[a.item_id][t.field_id]=t,r.pipeService.emit("gh_value_update",n,e.field_value)):(a.fields.push(e),r.pipeService.emit("gh_value_update",n,e.field_value))})}),t}},{key:"deleteItemsFromStorage",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=this.storage.getApp(e);r&&(r.items_list=r.items_list.filter(function(e){return!t.find(function(t){return e.item_id==t.item_id})||(delete r.items_object[e.item_id],!1)}),this.pipeService.emit("gh_items_update",{app_id:e},r.items_list),this.storage.updateApp(r))}},{key:"getItems",value:function(){var e=a(regeneratorRuntime.mark(function e(t){var r,i,n=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]&&n[1],e.next=3,this.appProcessor.getApp(t,r);case 3:if(i=e.sent){e.next=6;break}return e.abrupt("return",null);case 6:return e.abrupt("return",i.items_list);case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"addNewItems",value:function(){var t=a(regeneratorRuntime.mark(function t(i,n){var a,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=n.map(function(t){return r(r({},t),{},{fields:(0,e.filterFields)(t.fields)})}),t.next=3,this.addItemsApi(i,a);case 3:return s=t.sent,this.addItemsToStorage(i,s),this.pipeService.emit("gh_items_add",{app_id:i},s),t.abrupt("return",s);case 7:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"updateItems",value:function(){var t=a(regeneratorRuntime.mark(function t(i,n){var a,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=n.map(function(t){return r(r({},t),{},{fields:(0,e.filterFields)(t.fields)})}),t.next=3,this.updateItemsApi(i,a);case 3:return s=t.sent,t.abrupt("return",this.updateItemsInStorage(i,s));case 5:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"deleteItems",value:function(){var e=a(regeneratorRuntime.mark(function e(t,r){var i=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.deleteItemsApi(r).then(function(e){return i.deleteItemsFromStorage(t,e)}));case 1:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"itemListeners",value:function(){var e=this;this.pipeService.onRoot("gh_items_get",{},function(){var t=a(regeneratorRuntime.mark(function t(r,i){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!i||!i.app_id){t.next=5;break}return t.next=3,e.getItems(i.app_id);case 3:(n=t.sent)?e.pipeService.emit("gh_items_get",i,n):e.pipeService.emit("gh_items_get",i,[]);case 5:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_items_add",{},function(){var t=a(regeneratorRuntime.mark(function t(r,i){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(i&&i.app_id&&i.items)){t.next=5;break}return t.next=3,e.addNewItems(i.app_id,i.items);case 3:(n=t.sent)?e.pipeService.emit("gh_items_add",i,n):e.pipeService.emit("gh_items_add",i,[]);case 5:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_items_update",{},function(){var t=a(regeneratorRuntime.mark(function t(r,i){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(i&&i.app_id&&i.items)){t.next=5;break}return t.next=3,e.updateItems(i.app_id,i.items);case 3:(n=t.sent)?e.pipeService.emit("gh_items_update",i,n):e.pipeService.emit("gh_items_update",i,[]);case 5:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_item_get",{},function(){var t=a(regeneratorRuntime.mark(function t(r,i){var n,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!i||!i.app_id){t.next=6;break}return t.next=3,e.getItems(i.app_id);case 3:n=t.sent,a=n.find(function(e){return e.item_id==i.item_id}),e.pipeService.emit("gh_item_get",i,a);case 6:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_filtered_items_get",{},function(){var t=a(regeneratorRuntime.mark(function t(r,i){var n,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!i||!i.element_app_id){t.next=8;break}return t.next=3,e.getItems(i.element_app_id);case 3:return n=t.sent,t.next=6,e.util.getFilteredItems(n,i.filters_list,i.element_app_id,i.app_id,i.item_id,i.field_groupe,i.search,i.search_params);case 6:a=t.sent,e.pipeService.emit("gh_filtered_items_get",i,a);case 8:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_filter_items",{},function(){var t=a(regeneratorRuntime.mark(function t(r,i){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!i||!i.items){t.next=5;break}return t.next=3,e.util.getFilteredItems(i.items,i.filters_list,i.element_app_id,i.app_id,i.item_id,i.field_groupe,i.search,i.search_params);case 3:n=t.sent,e.pipeService.emit("gh_filter_items",i,n);case 5:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}())}}]),t}();exports.ItemProcessor=o;
193
193
  },{"../utils.js":"EgeI"}],"PoPF":[function(require,module,exports) {
194
- "use strict";function e(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 t(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach(function(e){r(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t,r,n,i,u,a){try{var o=e[u](a),s=o.value}catch(p){return void r(p)}o.done?t(s):Promise.resolve(s).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise(function(i,u){var a=e.apply(t,r);function o(e){n(a,i,u,o,s,"next",e)}function s(e){n(a,i,u,o,s,"throw",e)}o(void 0)})}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 o(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.FieldProcessor=void 0;var s=function(){function e(t,r,n,i,a){u(this,e),this.storage=t,this.req=r,this.appProcessor=n,this.itemProcessor=i,this.pipeService=a,this.fieldListeners()}return o(e,[{key:"deleteFieldApi",value:function(e){return this.req.post({url:"/api/app/delete-field",form:{field_id:e}})}},{key:"updatedFieldApi",value:function(){var e=i(regeneratorRuntime.mark(function e(r){var n,i,u,a=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:{},e.next=3,this.appProcessor.getApp(r);case 3:return i=e.sent,u={app_id:r,app_name:i.app_name,group_id:i.group_id,icon:i.icon,field_list:i.field_list.map(function(e){return e.field_id==n.field_id?t(t({},e),n):e}),views_list:i.views_list},e.abrupt("return",this.appProcessor.updateApp(u));case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"setFieldValueApi",value:function(e,t,r,n){var i=[{item_id:t,fields:[{field_id:r,field_value:n}]}];return this.itemProcessor.updateItems(e,i)}},{key:"deleteFieldInStorage",value:function(e,t){var r=this.storage.getApp(e);r.field_list=r.field_list.filter(function(e){return e.file_id!=t}),r.items_list=r.items_list.map(function(e){return e.fields=e.fields.filter(function(e){return e.field_id!=t}),e}),this.storage.updateApp(r)}},{key:"updateFieldInStorage",value:function(e,r){var n=this.storage.getApp(e);return n.field_list=n.field_list.map(function(e){return e.field_id==r.field_id?t(t({},e),r):e}),this.storage.updateApp(n),r}},{key:"updateFieldValue",value:function(e,t,r,n){var i=this.storage.getApp(e);i.items_list.forEach(function(e){e.item_id==t&&e.fields.forEach(function(e){e.field_id==r&&(e.field_value=n)})}),this.storage.updateApp(i)}},{key:"getField",value:function(){var e=i(regeneratorRuntime.mark(function e(t,r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.appProcessor.getApp(t);case 2:if(n=e.sent){e.next=5;break}return e.abrupt("return",null);case 5:return e.abrupt("return",n.field_list.find(function(e){return e.field_id==r}));case 6:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"getFieldModels",value:function(){var e=i(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.appProcessor.getApp(t);case 2:if(r=e.sent){e.next=5;break}return e.abrupt("return",null);case 5:return e.abrupt("return",r.field_list);case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"updateField",value:function(){var e=i(regeneratorRuntime.mark(function e(t,r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&r){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.updatedFieldApi(t,r);case 4:return n=e.sent,e.abrupt("return",this.updateFieldInStorage(t,n));case 6:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"deleteField",value:function(){var e=i(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.deleteFieldApi(r);case 2:return e.abrupt("return",this.deleteFieldInStorage(t,r));case 3:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"getFieldValue",value:function(){var e=i(regeneratorRuntime.mark(function e(t,r,n){var i,u,a,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=null,e.next=3,this.appProcessor.getApp(t);case 3:return(u=e.sent)&&(a=u.items_list.find(function(e){return e.item_id==r}))&&(o=a.fields.find(function(e){return e.field_id==n}))&&(i=o.field_value),e.abrupt("return",i);case 6:case"end":return e.stop()}},e,this)}));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"setFieldValue",value:function(){var e=i(regeneratorRuntime.mark(function e(t,r,n,i){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&r&&n){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.setFieldValueApi(t,r,n,i);case 4:this.updateFieldValue(t,r,n,i);case 5:case"end":return e.stop()}},e,this)}));return function(t,r,n,i){return e.apply(this,arguments)}}()},{key:"fieldListeners",value:function(){var e=this;this.pipeService.onRoot("gh_value_get",{},function(){var t=i(regeneratorRuntime.mark(function t(r,n){var i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(n.app_id&&n.item_id&&n.field_id)){t.next=5;break}return t.next=3,e.getFieldValue(n.app_id,n.item_id,n.field_id);case 3:i=t.sent,e.pipeService.emit("gh_value_get",n,i);case 5:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_value_set",{},function(){var t=i(regeneratorRuntime.mark(function t(r,n){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n.item_id&&(e.setFieldValue(n.app_id,n.item_id,n.field_id,n.new_value),delete n.new_value);case 1:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_model_get",{},function(){var t=i(regeneratorRuntime.mark(function t(r,n){var i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.getField(n.app_id,n.field_id);case 3:i=t.sent,e.pipeService.emit("gh_model_get",n,i),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),console.log("Field model: ",t.t0);case 10:case"end":return t.stop()}},t,null,[[0,7]])}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_model_update",{},function(){var t=i(regeneratorRuntime.mark(function t(r,n){var i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.updateField(n.app_id,n.field_model);case 2:i=t.sent,e.pipeService.emit("gh_model_update",{app_id:n.app_id,field_id:n.field_id},i);case 4:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_models_get",{},function(){var t=i(regeneratorRuntime.mark(function t(r,n){var i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getFieldModels(n.app_id);case 2:i=t.sent,e.pipeService.emit("gh_models_get",n,i);case 4:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_model_delete",{},function(){var t=i(regeneratorRuntime.mark(function t(r,n){var i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.deleteField(n.app_id,n.field_id);case 2:i=t.sent,e.pipeService.emit("gh_model_delete",n,i);case 4:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}())}}]),e}();exports.FieldProcessor=s;
194
+ "use strict";function e(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 t(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach(function(e){r(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t,r,n,i,u,a){try{var o=e[u](a),s=o.value}catch(p){return void r(p)}o.done?t(s):Promise.resolve(s).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise(function(i,u){var a=e.apply(t,r);function o(e){n(a,i,u,o,s,"next",e)}function s(e){n(a,i,u,o,s,"throw",e)}o(void 0)})}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 o(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.FieldProcessor=void 0;var s=function(){function e(t,r,n,i,a){u(this,e),this.storage=t,this.req=r,this.appProcessor=n,this.itemProcessor=i,this.pipeService=a,this.fieldListeners()}return o(e,[{key:"deleteFieldApi",value:function(e){return this.req.post({url:"/api/app/delete-field",form:{field_id:e}})}},{key:"updatedFieldApi",value:function(){var e=i(regeneratorRuntime.mark(function e(r){var n,i,u,a=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:{},e.next=3,this.appProcessor.getApp(r);case 3:return i=e.sent,u={app_id:r,app_name:i.app_name,group_id:i.group_id,icon:i.icon,field_list:i.field_list.map(function(e){return e.field_id==n.field_id?t(t({},e),n):e}),views_list:i.views_list},e.abrupt("return",this.appProcessor.updateApp(u));case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"setFieldValueApi",value:function(e,t,r,n){var i=[{item_id:t,fields:[{field_id:r,field_value:n}]}];return this.itemProcessor.updateItems(e,i)}},{key:"deleteFieldInStorage",value:function(e,t){var r=this.storage.getApp(e);r.field_list=r.field_list.filter(function(e){return e.file_id!=t}),r.items_list=r.items_list.map(function(e){return e.fields=e.fields.filter(function(e){return e.field_id!=t}),e}),this.storage.updateApp(r)}},{key:"updateFieldInStorage",value:function(e,r){var n=this.storage.getApp(e);return n.field_list=n.field_list.map(function(e){return e.field_id==r.field_id?t(t({},e),r):e}),this.storage.updateApp(n),r}},{key:"updateFieldValue",value:function(e,t,r,n){var i=this.storage.getApp(e);return i.items_list.forEach(function(e){e.item_id==t&&e.fields.forEach(function(t){t.field_id==r&&(t.field_value=n,i.items_object[e.item_id][t.field_id]=t)})}),this.storage.updateApp(i),n}},{key:"getField",value:function(){var e=i(regeneratorRuntime.mark(function e(t,r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.appProcessor.getApp(t);case 2:if(n=e.sent){e.next=5;break}return e.abrupt("return",null);case 5:return e.abrupt("return",n.field_list.find(function(e){return e.field_id==r}));case 6:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"getFieldModels",value:function(){var e=i(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.appProcessor.getApp(t);case 2:if(r=e.sent){e.next=5;break}return e.abrupt("return",null);case 5:return e.abrupt("return",r.field_list);case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"updateField",value:function(){var e=i(regeneratorRuntime.mark(function e(t,r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&r){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.updatedFieldApi(t,r);case 4:return n=e.sent,e.abrupt("return",this.updateFieldInStorage(t,n));case 6:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"deleteField",value:function(){var e=i(regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.deleteFieldApi(r);case 2:return e.abrupt("return",this.deleteFieldInStorage(t,r));case 3:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"getFieldValue",value:function(){var e=i(regeneratorRuntime.mark(function e(t,r,n){var i,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=null,e.next=3,this.appProcessor.getApp(t);case 3:u=e.sent;try{i=u.items_object[r][n].field_value}catch(a){}return e.abrupt("return",i);case 6:case"end":return e.stop()}},e,this)}));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"setFieldValue",value:function(){var e=i(regeneratorRuntime.mark(function e(t,r,n,i){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&r&&n){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.setFieldValueApi(t,r,n,i);case 4:return e.abrupt("return",this.updateFieldValue(t,r,n,i));case 5:case"end":return e.stop()}},e,this)}));return function(t,r,n,i){return e.apply(this,arguments)}}()},{key:"fieldListeners",value:function(){var e=this;this.pipeService.onRoot("gh_value_get",{},function(){var t=i(regeneratorRuntime.mark(function t(r,n){var i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(n.app_id&&n.item_id&&n.field_id)){t.next=5;break}return t.next=3,e.getFieldValue(n.app_id,n.item_id,n.field_id);case 3:i=t.sent,e.pipeService.emit("gh_value_get",n,i);case 5:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_value_set",{},function(){var t=i(regeneratorRuntime.mark(function t(r,n){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n.item_id&&(e.setFieldValue(n.app_id,n.item_id,n.field_id,n.new_value),delete n.new_value);case 1:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_model_get",{},function(){var t=i(regeneratorRuntime.mark(function t(r,n){var i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.getField(n.app_id,n.field_id);case 3:i=t.sent,e.pipeService.emit("gh_model_get",n,i),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),console.log("Field model: ",t.t0);case 10:case"end":return t.stop()}},t,null,[[0,7]])}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_model_update",{},function(){var t=i(regeneratorRuntime.mark(function t(r,n){var i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.updateField(n.app_id,n.field_model);case 2:i=t.sent,e.pipeService.emit("gh_model_update",{app_id:n.app_id,field_id:n.field_id},i);case 4:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_models_get",{},function(){var t=i(regeneratorRuntime.mark(function t(r,n){var i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getFieldModels(n.app_id);case 2:i=t.sent,e.pipeService.emit("gh_models_get",n,i);case 4:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),this.pipeService.onRoot("gh_model_delete",{},function(){var t=i(regeneratorRuntime.mark(function t(r,n){var i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.deleteField(n.app_id,n.field_id);case 2:i=t.sent,e.pipeService.emit("gh_model_delete",n,i);case 4:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}())}}]),e}();exports.FieldProcessor=s;
195
195
  },{}],"XUT2":[function(require,module,exports) {
196
196
  "use strict";function e(e){return i(e)||n(e)||t(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 t(e,r){if(e){if("string"==typeof e)return a(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)?a(e,r):void 0}}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 a(e)}function a(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 u(e,r,t,n,i,a,u){try{var o=e[a](u),s=o.value}catch(p){return void t(p)}o.done?r(s):Promise.resolve(s).then(n,i)}function o(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var a=e.apply(r,t);function o(e){u(a,n,i,o,s,"next",e)}function s(e){u(a,n,i,o,s,"throw",e)}o(void 0)})}}function s(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function p(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,r,t){return r&&p(e.prototype,r),t&&p(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.FileManager=void 0;var l=function(){function r(e,t,n,i){s(this,r),this.storage=e,this.pipeService=t,this.req=n,this.appProcessor=i}return c(r,[{key:"uploadFileApi",value:function(){var e=o(regeneratorRuntime.mark(function e(r,t,n){var i,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,i={"file-0":r,app_id:t,item_id:n},e.next=4,this.req.post({url:"/file/formupload",form:i});case 4:return a=e.sent,e.abrupt("return",a);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(r,t,n){return e.apply(this,arguments)}}()},{key:"uploadFileFromStringApi",value:function(){var e=o(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.req.post({url:"/file/upload",form:{file:JSON.stringify(r)}});case 3:return t=e.sent,e.abrupt("return",t);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(r){return e.apply(this,arguments)}}()},{key:"updateFileFromStringApi",value:function(){var e=o(regeneratorRuntime.mark(function e(r,t,n,i,a){var u,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,u={file_name:n,extension:i,file_id:t,format:a,source:r},e.next=4,this.req.post({url:"/file/update",form:{file:JSON.stringify(u)}});case 4:return o=e.sent,e.abrupt("return",o);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(r,t,n,i,a){return e.apply(this,arguments)}}()},{key:"duplicateFileApi",value:function(){var e=o(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.req.post({url:"/api/new/file/duplicate",headers:{"Content-Type":"application/x-www-form-urlencoded"},form:{files:JSON.stringify(r)}}));case 1:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"downloadFileFromString",value:function(){var e=o(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,this.isFileExists(r,t);case 2:if(!e.sent){e.next=12;break}return e.next=5,this.getFile(r,t);case 5:return n=e.sent,e.next=8,this.req.get({url:n.url+"?timestamp="+n.last_update,externalResource:!0});case 8:return i=e.sent,e.abrupt("return",{file:n,data:i,type:"file"});case 12:return e.abrupt("return",!1);case 13:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()},{key:"duplicateFile",value:function(){var e=o(regeneratorRuntime.mark(function e(r){var t,n=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.duplicateFileApi(r);case 2:return(t=e.sent).forEach(function(e){n.addFileToStorage(e.app_id,e)}),e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"deleteFileApi",value:function(){var e=o(regeneratorRuntime.mark(function e(r){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:"/file/delete?file_id=".concat(r)});case 3:return t=e.sent,e.abrupt("return",t);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(r){return e.apply(this,arguments)}}()},{key:"addFileToStorage",value:function(e,r){var t=this.storage.getApp(e);t&&(t.file_list.push(r),this.storage.updateApp(t),this.pipeService.emit("gh_file_upload",{app_id:e,item_id:r.item_id,file_id:r.file_id},r))}},{key:"addFilesToStorage",value:function(r,t){var n,i=this,a=this.storage.getApp(r);a&&((n=a.file_list).push.apply(n,e(t)),this.storage.updateApp(a),t.forEach(function(e){i.pipeService.emit("gh_file_upload",{app_id:r,item_id:e.item_id,file_id:e.file_id},e)}))}},{key:"deleteFileFromStorage",value:function(e,r){var t,n=this.storage.getApp(r);n&&(n.file_list=n.file_list.filter(function(r){return r.file_id!=e||(t=r,!1)}),this.storage.updateApp(n),this.pipeService.emit("gh_file_delete",{file_id:e},t))}},{key:"updateFileInStorage",value:function(e,r,t){var n=this.storage.getApp(r);n&&(n.file_list=n.file_list.map(function(r){return r.file_id==e?t:r}),this.storage.updateApp(n),this.pipeService.emit("gh_file_update",{file_id:e}))}},{key:"getFile",value:function(){var e=o(regeneratorRuntime.mark(function e(r,t){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.appProcessor.getApp(r);case 2:return n=e.sent,e.abrupt("return",new Promise(function(e,r){var i=n.file_list.find(function(e){return e.file_id==t});e(i||"")}));case 4:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()},{key:"getFiles",value:function(){var e=o(regeneratorRuntime.mark(function e(r){var t,n,i=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>1&&void 0!==i[1]?i[1]:[],e.next=3,this.appProcessor.getApp(r);case 3:return n=e.sent,e.abrupt("return",new Promise(function(e,r){var i=n.file_list.filter(function(e){return t.some(function(r){return r==e.file_id})});e(i||"")}));case 5:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"uploadFile",value:function(){var e=o(regeneratorRuntime.mark(function e(r,t,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.uploadFileApi(r,t,n);case 2:return i=e.sent,this.addFileToStorage(t,i),e.abrupt("return",i);case 5:case"end":return e.stop()}},e,this)}));return function(r,t,n){return e.apply(this,arguments)}}()},{key:"uploadFileFromString",value:function(){var e=o(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.uploadFileFromStringApi(r);case 2:return t=e.sent,this.addFileToStorage(t.app_id,t),e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"updateFileFromString",value:function(){var e=o(regeneratorRuntime.mark(function e(r,t,n,i,a){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.updateFileFromStringApi(r,t,n,i,a);case 2:return u=e.sent,this.updateFileInStorage(t,u.app_id,u),e.abrupt("return",u);case 5:case"end":return e.stop()}},e,this)}));return function(r,t,n,i,a){return e.apply(this,arguments)}}()},{key:"deleteFile",value:function(){var e=o(regeneratorRuntime.mark(function e(r,t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.deleteFileApi(t);case 2:return this.deleteFileFromStorage(t,r),e.abrupt("return",!0);case 4:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()},{key:"isFileExists",value:function(){var e=o(regeneratorRuntime.mark(function e(r,t){var n,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/,!Boolean(t)){e.next=12;break}return e.next=4,this.getFile(r,t);case 4:if(i=e.sent,!Boolean(i)){e.next=9;break}return e.abrupt("return",n.test(i.url));case 9:return e.abrupt("return",!1);case 10:e.next=13;break;case 12:return e.abrupt("return",!1);case 13:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()}]),r}();exports.FileManager=l;
197
197
  },{}],"KHGc":[function(require,module,exports) {
@@ -203,7 +203,7 @@ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
203
203
  },{}],"sPce":[function(require,module,exports) {
204
204
  "use strict";function e(e,o){switch(o.api){case"/items/update":console.log("/items/update - ",o),e.itemProcessor.updateItemsInStorage(o.app_id,o.response);break;case"/items/add":console.log("/items/add - ",o),e.itemProcessor.addItemsToStorage(o.app_id,o.response);break;case"/items/delete":console.log("/items/delete - ",o),e.itemProcessor.deleteItemsFromStorage(o.app_id,o.response);break;case"/app/update":console.log("/app/update - ",o),e.appProcessor.updatingAppInStorage(o.response);break;case"/file/delete":console.log("file/delete - ",o),e.fileManager.deleteFileFromStorage(o.response.file_id,o.app_id);break;case"/file/upload":console.log("file/upload - ",o),e.fileManager.addFileToStorage(o.app_id,o.response);break;case"/file/formupload":console.log("file/formupload - ",o);break;case"/file/update":e.fileManager.updateFileInStorage(o.response.file_id,o.response.app_id,o.response),console.log("file/update - ",o);break;case"/new/file/duplicate":e.fileManager.addFilesToStorage(o.app_id,o.response),console.log("new/file/duplicate - ",o);break;case"/api/new/document/insert-one":e.documentManager.emitDocumentInsert(o.response),console.log("/api/new/document/insert-one - ",o);break;default:console.warn("WEBSOCKETS is not process this API:",o.api)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.WebsocketHandler=e;
205
205
  },{}],"U9gy":[function(require,module,exports) {
206
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GudHub=void 0;var e=require("./gudhub-https-service.js"),t=require("./PipeService/PipeService.js"),r=require("./Storage/Storage.js"),i=require("./WebSocket/WebSocket.js"),n=require("./config.js"),u=require("./Utils/Utils.js"),s=require("./Auth/Auth.js"),o=require("./GHConstructor/ghconstructor.js"),a=require("./AppProcessor/AppProcessor.js"),c=require("./ItemProcessor/ItemProcessor.js"),l=require("./FieldProcessor/FieldProcessor.js"),p=require("./FileManager/FileManager.js"),h=require("./ChunksManager/ChunksManager.js"),f=require("./DocumentManager/DocumentManager.js"),d=require("./GHConstructor/interpritate.js"),g=require("./consts.js"),v=require("./WebSocket/WebsocketHandler.js");function k(e,t,r,i,n,u,s){try{var o=e[u](s),a=o.value}catch(c){return void r(c)}o.done?t(a):Promise.resolve(a).then(i,n)}function y(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var u=e.apply(t,r);function s(e){k(u,i,n,s,o,"next",e)}function o(e){k(u,i,n,s,o,"throw",e)}s(void 0)})}}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function b(e,t,r){return t&&w(e.prototype,t),r&&w(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var P=function(){function k(g){var y=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{server_url:n.server_url,wss_url:n.wss_url,initWebsocket:!1,activateSW:!1,swLink:"",async_modules_path:"",file_server_url:""};if(m(this,k),this.ghconstructor=new o.GHConstructor(this),this.interpritate=new d.Interpritate(this),this.pipeService=new t.PipeService,this.storage=new r.Storage(y.async_modules_path,y.file_server_url),this.util=new u.Utils(this),this.req=new e.GudHubHttpsService(y.server_url),this.auth=new s.Auth(this.req,this.storage),g&&this.storage.setUser({auth_key:g}),this.req.init(this.auth.getToken.bind(this.auth)),this.ws=new i.WebSocketApi(y.wss_url,this.auth),this.chunksManager=new h.ChunksManager(this.storage,this.pipeService,this.req,this.util),this.appProcessor=new a.AppProcessor(this.storage,this.pipeService,this.req,this.ws,this.chunksManager,this.util,y.activateSW),this.itemProcessor=new c.ItemProcessor(this.storage,this.pipeService,this.req,this.appProcessor,this.util),this.fieldProcessor=new l.FieldProcessor(this.storage,this.req,this.appProcessor,this.itemProcessor,this.pipeService),this.fileManager=new p.FileManager(this.storage,this.pipeService,this.req,this.appProcessor),this.documentManager=new f.DocumentManager(this.req,this.pipeService),y.initWebsocket){this.ws.initWebSocket(v.WebsocketHandler.bind(this,this),this.appProcessor.refreshApps.bind(this.appProcessor))}y.activateSW&&this.activateSW(y.swLink)}return b(k,[{key:"activateSW",value:function(){var e=y(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(g.IS_WEB&&"serviceWorker"in window.navigator)){e.next=14;break}return e.prev=1,e.next=4,window.navigator.serviceWorker.register(t);case 4:(r=e.sent).update().then(function(){return console.log("%cSW ->>> Service worker successful updated","display: inline-block ; background-color: #689f38 ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;")}).catch(function(){return console.warn("SW ->>> Service worker is not updated")}),console.log("%cSW ->>> Service worker is registered","display: inline-block ; background-color: #689f38 ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;",r),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.warn("%cSW ->>> Service worker is not registered","display: inline-block ; background-color: #d32f2f ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;",e.t0);case 12:e.next=15;break;case 14:console.log("%cSW ->>> ServiceWorkers not supported","display: inline-block ; background-color: #d32f2f ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;");case 15:case"end":return e.stop()}},e,null,[[1,9]])}));return function(t){return e.apply(this,arguments)}}()},{key:"on",value:function(e,t,r){return this.pipeService.on(e,t,r),this}},{key:"emit",value:function(e,t,r,i){return this.pipeService.emit(e,t,r,i),this}},{key:"destroy",value:function(e,t,r){return this.pipeService.destroy(e,t,r),this}},{key:"prefilter",value:function(e,t,r,i,n){return this.util.prefilter(e,t,r,i,n)}},{key:"getInterpretation",value:function(e,t,r,i,n,u,s){return this.interpritate.getInterpretation(e,t,r,i,n,u,s)}},{key:"getInterpretationById",value:function(e,t,r,i){return this.interpritate.getInterpretationById(e,t,r,i)}},{key:"filter",value:function(e,t){return this.util.filter(e,t)}},{key:"group",value:function(e,t){return this.util.group(e,t)}},{key:"getFilteredItems",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.util.getFilteredItems(e,t,r.element_app_id,r.app_id,r.item_id,r.field_group,r.search,r.search_params)}},{key:"jsonToItems",value:function(e,t){return this.util.jsonToItems(e,t)}},{key:"getDate",value:function(e){return this.util.getDate(e)}},{key:"populateWithDate",value:function(e,t){return this.util.populateWithDate(e,t)}},{key:"checkRecurringDate",value:function(e,t){return this.util.checkRecurringDate(e,t)}},{key:"populateItems",value:function(e,t,r){return this.util.populateItems(e,t,r)}},{key:"populateWithItemRef",value:function(e,t,r,i,n,u){return this.util.populateWithItemRef(e,t,r,i,n,u)}},{key:"compareItems",value:function(e,t,r){return this.util.compareItems(e,t,r)}},{key:"mergeItems",value:function(e,t,r){return this.util.mergeItems(e,t,r)}},{key:"mergeObjects",value:function(e,t){return this.util.mergeObjects(e,t)}},{key:"makeNestedList",value:function(e,t,r,i,n){return this.util.makeNestedList(e,t,r,i,n)}},{key:"jsonConstructor",value:function(e,t,r){return this.util.jsonConstructor(e,t,r)}},{key:"getAppsList",value:function(){return this.appProcessor.getAppsList()}},{key:"getAppInfo",value:function(e){return this.appProcessor.getAppInfo(e)}},{key:"deleteApp",value:function(e){return this.appProcessor.deleteApp(e)}},{key:"getApp",value:function(e){return this.appProcessor.getApp(e)}},{key:"updateApp",value:function(e){return this.appProcessor.updateApp(e)}},{key:"updateAppInfo",value:function(e){return this.appProcessor.updateAppInfo(e)}},{key:"createNewApp",value:function(e){return this.appProcessor.createNewApp(e)}},{key:"getItems",value:function(e){return this.itemProcessor.getItems(e)}},{key:"getItem",value:function(){var e=y(regeneratorRuntime.mark(function e(t,r){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getItems(t);case 2:if(!(i=e.sent)){e.next=5;break}return e.abrupt("return",i.find(function(e){return e.item_id==r}));case 5:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"addNewItems",value:function(e,t){return this.itemProcessor.addNewItems(e,t)}},{key:"updateItems",value:function(e,t){return this.itemProcessor.updateItems(e,t)}},{key:"deleteItems",value:function(e,t){return this.itemProcessor.deleteItems(e,t)}},{key:"getField",value:function(e,t){return this.fieldProcessor.getField(e,t)}},{key:"getFieldModels",value:function(e){return this.fieldProcessor.getFieldModels(e)}},{key:"updateField",value:function(e,t){return this.fieldProcessor.updateField(e,t)}},{key:"deleteField",value:function(e,t){return this.fieldProcessor.deleteField(e,t)}},{key:"getFieldValue",value:function(e,t,r){return this.fieldProcessor.getFieldValue(e,t,r)}},{key:"setFieldValue",value:function(e,t,r,i){return this.fieldProcessor.setFieldValue(e,t,r,i)}},{key:"getFile",value:function(e,t){return this.fileManager.getFile(e,t)}},{key:"getFiles",value:function(e,t){return this.fileManager.getFiles(e,t)}},{key:"uploadFile",value:function(e,t,r){return this.fileManager.uploadFile(e,t,r)}},{key:"uploadFileFromString",value:function(e,t,r,i,n,u,s){return this.fileManager.uploadFileFromString(e,t,r,i,n,u,s)}},{key:"updateFileFromString",value:function(e,t,r,i,n){return this.fileManager.updateFileFromString(e,t,r,i,n)}},{key:"deleteFile",value:function(e,t){return this.fileManager.deleteFile(e,t)}},{key:"duplicateFile",value:function(e){return this.fileManager.duplicateFile(e)}},{key:"downloadFileFromString",value:function(e,t){return this.fileManager.downloadFileFromString(e,t)}},{key:"createDocument",value:function(e){return this.documentManager.createDocument(e)}},{key:"getDocument",value:function(e){return this.documentManager.getDocument(e)}},{key:"getDocuments",value:function(e){return this.documentManager.getDocuments(e)}},{key:"deleteDocument",value:function(e){return this.documentManager.deleteDocument(e)}},{key:"login",value:function(e){return this.auth.login(e)}},{key:"logout",value:function(e){return this.appProcessor.clearAppProcessor(),this.auth.logout(e)}},{key:"signup",value:function(e){return this.auth.signup(e)}},{key:"getUsersList",value:function(e){return this.auth.getUsersList(e)}},{key:"updateToken",value:function(e){return this.auth.updateToken(e)}},{key:"avatarUploadApi",value:function(e){return this.auth.avatarUploadApi(e)}},{key:"getVersion",value:function(){return this.auth.getVersion()}},{key:"getUserById",value:function(e){return this.auth.getUserById(e)}},{key:"getToken",value:function(){return this.auth.getToken()}},{key:"updateUser",value:function(e){return this.auth.updateUser(e)}},{key:"updateAvatar",value:function(e){return this.auth.updateAvatar(e)}}]),k}();exports.GudHub=P;
206
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GudHub=void 0;var e=require("./gudhub-https-service.js"),t=require("./PipeService/PipeService.js"),r=require("./Storage/Storage.js"),i=require("./WebSocket/WebSocket.js"),n=require("./config.js"),u=require("./Utils/Utils.js"),s=require("./Auth/Auth.js"),o=require("./GHConstructor/ghconstructor.js"),a=require("./AppProcessor/AppProcessor.js"),c=require("./ItemProcessor/ItemProcessor.js"),l=require("./FieldProcessor/FieldProcessor.js"),p=require("./FileManager/FileManager.js"),h=require("./ChunksManager/ChunksManager.js"),f=require("./DocumentManager/DocumentManager.js"),d=require("./GHConstructor/interpritate.js"),g=require("./consts.js"),v=require("./WebSocket/WebsocketHandler.js");function k(e,t,r,i,n,u,s){try{var o=e[u](s),a=o.value}catch(c){return void r(c)}o.done?t(a):Promise.resolve(a).then(i,n)}function y(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var u=e.apply(t,r);function s(e){k(u,i,n,s,o,"next",e)}function o(e){k(u,i,n,s,o,"throw",e)}s(void 0)})}}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function b(e,t,r){return t&&w(e.prototype,t),r&&w(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var P=function(){function k(g){var y=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{server_url:n.server_url,wss_url:n.wss_url,initWebsocket:!1,activateSW:!1,swLink:"",async_modules_path:n.async_modules_path,file_server_url:n.file_server_url};if(m(this,k),this.ghconstructor=new o.GHConstructor(this),this.interpritate=new d.Interpritate(this),this.pipeService=new t.PipeService,this.storage=new r.Storage(y.async_modules_path,y.file_server_url),this.util=new u.Utils(this),this.req=new e.GudHubHttpsService(y.server_url),this.auth=new s.Auth(this.req,this.storage),g&&this.storage.setUser({auth_key:g}),this.req.init(this.auth.getToken.bind(this.auth)),this.ws=new i.WebSocketApi(y.wss_url,this.auth),this.chunksManager=new h.ChunksManager(this.storage,this.pipeService,this.req,this.util),this.appProcessor=new a.AppProcessor(this.storage,this.pipeService,this.req,this.ws,this.chunksManager,this.util,y.activateSW),this.itemProcessor=new c.ItemProcessor(this.storage,this.pipeService,this.req,this.appProcessor,this.util),this.fieldProcessor=new l.FieldProcessor(this.storage,this.req,this.appProcessor,this.itemProcessor,this.pipeService),this.fileManager=new p.FileManager(this.storage,this.pipeService,this.req,this.appProcessor),this.documentManager=new f.DocumentManager(this.req,this.pipeService),y.initWebsocket){this.ws.initWebSocket(v.WebsocketHandler.bind(this,this),this.appProcessor.refreshApps.bind(this.appProcessor))}y.activateSW&&this.activateSW(y.swLink)}return b(k,[{key:"activateSW",value:function(){var e=y(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(g.IS_WEB&&"serviceWorker"in window.navigator)){e.next=14;break}return e.prev=1,e.next=4,window.navigator.serviceWorker.register(t);case 4:(r=e.sent).update().then(function(){return console.log("%cSW ->>> Service worker successful updated","display: inline-block ; background-color: #689f38 ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;")}).catch(function(){return console.warn("SW ->>> Service worker is not updated")}),console.log("%cSW ->>> Service worker is registered","display: inline-block ; background-color: #689f38 ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;",r),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.warn("%cSW ->>> Service worker is not registered","display: inline-block ; background-color: #d32f2f ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;",e.t0);case 12:e.next=15;break;case 14:console.log("%cSW ->>> ServiceWorkers not supported","display: inline-block ; background-color: #d32f2f ; color: #ffffff ; font-weight: bold ; padding: 3px 7px; border-radius: 3px;");case 15:case"end":return e.stop()}},e,null,[[1,9]])}));return function(t){return e.apply(this,arguments)}}()},{key:"on",value:function(e,t,r){return this.pipeService.on(e,t,r),this}},{key:"emit",value:function(e,t,r,i){return this.pipeService.emit(e,t,r,i),this}},{key:"destroy",value:function(e,t,r){return this.pipeService.destroy(e,t,r),this}},{key:"prefilter",value:function(e,t,r,i,n){return this.util.prefilter(e,t,r,i,n)}},{key:"getInterpretation",value:function(e,t,r,i,n,u,s){return this.interpritate.getInterpretation(e,t,r,i,n,u,s)}},{key:"getInterpretationById",value:function(e,t,r,i){return this.interpritate.getInterpretationById(e,t,r,i)}},{key:"filter",value:function(e,t){return this.util.filter(e,t)}},{key:"group",value:function(e,t){return this.util.group(e,t)}},{key:"getFilteredItems",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.util.getFilteredItems(e,t,r.element_app_id,r.app_id,r.item_id,r.field_group,r.search,r.search_params)}},{key:"jsonToItems",value:function(e,t){return this.util.jsonToItems(e,t)}},{key:"getDate",value:function(e){return this.util.getDate(e)}},{key:"populateWithDate",value:function(e,t){return this.util.populateWithDate(e,t)}},{key:"checkRecurringDate",value:function(e,t){return this.util.checkRecurringDate(e,t)}},{key:"populateItems",value:function(e,t,r){return this.util.populateItems(e,t,r)}},{key:"populateWithItemRef",value:function(e,t,r,i,n,u){return this.util.populateWithItemRef(e,t,r,i,n,u)}},{key:"compareItems",value:function(e,t,r){return this.util.compareItems(e,t,r)}},{key:"mergeItems",value:function(e,t,r){return this.util.mergeItems(e,t,r)}},{key:"mergeObjects",value:function(e,t){return this.util.mergeObjects(e,t)}},{key:"makeNestedList",value:function(e,t,r,i,n){return this.util.makeNestedList(e,t,r,i,n)}},{key:"jsonConstructor",value:function(e,t,r){return this.util.jsonConstructor(e,t,r)}},{key:"getAppsList",value:function(){return this.appProcessor.getAppsList()}},{key:"getAppInfo",value:function(e){return this.appProcessor.getAppInfo(e)}},{key:"deleteApp",value:function(e){return this.appProcessor.deleteApp(e)}},{key:"getApp",value:function(e){return this.appProcessor.getApp(e)}},{key:"updateApp",value:function(e){return this.appProcessor.updateApp(e)}},{key:"updateAppInfo",value:function(e){return this.appProcessor.updateAppInfo(e)}},{key:"createNewApp",value:function(e){return this.appProcessor.createNewApp(e)}},{key:"getItems",value:function(e){return this.itemProcessor.getItems(e)}},{key:"getItem",value:function(){var e=y(regeneratorRuntime.mark(function e(t,r){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getItems(t);case 2:if(!(i=e.sent)){e.next=5;break}return e.abrupt("return",i.find(function(e){return e.item_id==r}));case 5:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"addNewItems",value:function(e,t){return this.itemProcessor.addNewItems(e,t)}},{key:"updateItems",value:function(e,t){return this.itemProcessor.updateItems(e,t)}},{key:"deleteItems",value:function(e,t){return this.itemProcessor.deleteItems(e,t)}},{key:"getField",value:function(e,t){return this.fieldProcessor.getField(e,t)}},{key:"getFieldModels",value:function(e){return this.fieldProcessor.getFieldModels(e)}},{key:"updateField",value:function(e,t){return this.fieldProcessor.updateField(e,t)}},{key:"deleteField",value:function(e,t){return this.fieldProcessor.deleteField(e,t)}},{key:"getFieldValue",value:function(e,t,r){return this.fieldProcessor.getFieldValue(e,t,r)}},{key:"setFieldValue",value:function(e,t,r,i){return this.fieldProcessor.setFieldValue(e,t,r,i)}},{key:"getFile",value:function(e,t){return this.fileManager.getFile(e,t)}},{key:"getFiles",value:function(e,t){return this.fileManager.getFiles(e,t)}},{key:"uploadFile",value:function(e,t,r){return this.fileManager.uploadFile(e,t,r)}},{key:"uploadFileFromString",value:function(e,t,r,i,n,u,s){return this.fileManager.uploadFileFromString(e,t,r,i,n,u,s)}},{key:"updateFileFromString",value:function(e,t,r,i,n){return this.fileManager.updateFileFromString(e,t,r,i,n)}},{key:"deleteFile",value:function(e,t){return this.fileManager.deleteFile(e,t)}},{key:"duplicateFile",value:function(e){return this.fileManager.duplicateFile(e)}},{key:"downloadFileFromString",value:function(e,t){return this.fileManager.downloadFileFromString(e,t)}},{key:"createDocument",value:function(e){return this.documentManager.createDocument(e)}},{key:"getDocument",value:function(e){return this.documentManager.getDocument(e)}},{key:"getDocuments",value:function(e){return this.documentManager.getDocuments(e)}},{key:"deleteDocument",value:function(e){return this.documentManager.deleteDocument(e)}},{key:"login",value:function(e){return this.auth.login(e)}},{key:"logout",value:function(e){return this.appProcessor.clearAppProcessor(),this.auth.logout(e)}},{key:"signup",value:function(e){return this.auth.signup(e)}},{key:"getUsersList",value:function(e){return this.auth.getUsersList(e)}},{key:"updateToken",value:function(e){return this.auth.updateToken(e)}},{key:"avatarUploadApi",value:function(e){return this.auth.avatarUploadApi(e)}},{key:"getVersion",value:function(){return this.auth.getVersion()}},{key:"getUserById",value:function(e){return this.auth.getUserById(e)}},{key:"getToken",value:function(){return this.auth.getToken()}},{key:"updateUser",value:function(e){return this.auth.updateUser(e)}},{key:"updateAvatar",value:function(e){return this.auth.updateAvatar(e)}}]),k}();exports.GudHub=P;
207
207
  },{"./gudhub-https-service.js":"hDvy","./PipeService/PipeService.js":"E3xI","./Storage/Storage.js":"CSHe","./WebSocket/WebSocket.js":"pHMV","./config.js":"TPH7","./Utils/Utils.js":"mWlG","./Auth/Auth.js":"rK64","./GHConstructor/ghconstructor.js":"Htuh","./AppProcessor/AppProcessor.js":"q0my","./ItemProcessor/ItemProcessor.js":"UUd3","./FieldProcessor/FieldProcessor.js":"PoPF","./FileManager/FileManager.js":"XUT2","./ChunksManager/ChunksManager.js":"KHGc","./DocumentManager/DocumentManager.js":"K1Gs","./GHConstructor/interpritate.js":"X4Dt","./consts.js":"UV2u","./WebSocket/WebsocketHandler.js":"sPce"}],"iRRN":[function(require,module,exports) {
208
208
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"GudHub",{enumerable:!0,get:function(){return e.GudHub}}),exports.default=void 0,require("regenerator-runtime/runtime.js");var e=require("./GUDHUB/gudhub.js"),r=e.GudHub;exports.default=r;
209
209
  },{"regenerator-runtime/runtime.js":"KA2S","./GUDHUB/gudhub.js":"U9gy"}]},{},["iRRN"], "GudHubLibrary")